Safe Haskell | None |
---|---|
Language | Haskell2010 |
Defines the syntax of invariant annotations. See Camfort.Specification.Hoare for a high-level overview.
In this module, the word 'primitive' is used to refer to untyped expression syntax (as opposed to the typed expression syntax defined in Language.Fortran.Model.Op).
Synopsis
- data PrimLogic a
- data PrimFormula ann
- = PFExpr (Expression ann)
- | PFLogical (PrimLogic (PrimFormula ann))
- data SpecKind
- data Specification a = Specification {
- _specType :: SpecKind
- _specFormula :: a
- data AuxDecl ann = AuxDecl {}
- type PrimSpec ann = Specification (PrimFormula ann)
- data SpecOrDecl ann
- specType :: forall a. Lens' (Specification a) SpecKind
- specFormula :: forall a a. Lens (Specification a) (Specification a) a a
- adTy :: forall ann ann. Lens (AuxDecl ann) (AuxDecl ann) (TypeSpec ann) (TypeSpec ann)
- adName :: forall ann. Lens' (AuxDecl ann) Name
- _Specification :: forall a a. Iso (Specification a) (Specification a) (SpecKind, a) (SpecKind, a)
- _SodDecl :: forall ann. Prism' (SpecOrDecl ann) (AuxDecl ann)
- _SodSpec :: forall ann. Prism' (SpecOrDecl ann) (PrimSpec ann)
- refining :: Eq r => r -> APrism s t (a, r) (a, r) -> Prism s t a a
- _SpecPre :: Prism' (Specification a) a
- _SpecPost :: Prism' (Specification a) a
- _SpecSeq :: Prism' (Specification a) a
- _SpecInvariant :: Prism' (Specification a) a
Syntax Types
A type of primitive logical operators.
Instances
Functor PrimLogic Source # | |
Foldable PrimLogic Source # | |
Defined in Camfort.Specification.Hoare.Syntax fold :: Monoid m => PrimLogic m -> m # foldMap :: Monoid m => (a -> m) -> PrimLogic a -> m # foldMap' :: Monoid m => (a -> m) -> PrimLogic a -> m # foldr :: (a -> b -> b) -> b -> PrimLogic a -> b # foldr' :: (a -> b -> b) -> b -> PrimLogic a -> b # foldl :: (b -> a -> b) -> b -> PrimLogic a -> b # foldl' :: (b -> a -> b) -> b -> PrimLogic a -> b # foldr1 :: (a -> a -> a) -> PrimLogic a -> a # foldl1 :: (a -> a -> a) -> PrimLogic a -> a # toList :: PrimLogic a -> [a] # length :: PrimLogic a -> Int # elem :: Eq a => a -> PrimLogic a -> Bool # maximum :: Ord a => PrimLogic a -> a # minimum :: Ord a => PrimLogic a -> a # | |
Traversable PrimLogic Source # | |
Defined in Camfort.Specification.Hoare.Syntax | |
Eq a => Eq (PrimLogic a) Source # | |
Data a => Data (PrimLogic a) Source # | |
Defined in Camfort.Specification.Hoare.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PrimLogic a -> c (PrimLogic a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PrimLogic a) # toConstr :: PrimLogic a -> Constr # dataTypeOf :: PrimLogic a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (PrimLogic a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PrimLogic a)) # gmapT :: (forall b. Data b => b -> b) -> PrimLogic a -> PrimLogic a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PrimLogic a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PrimLogic a -> r # gmapQ :: (forall d. Data d => d -> u) -> PrimLogic a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PrimLogic a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PrimLogic a -> m (PrimLogic a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimLogic a -> m (PrimLogic a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimLogic a -> m (PrimLogic a) # | |
Show a => Show (PrimLogic a) Source # | |
data PrimFormula ann Source #
Logical expressions over Fortran expressions.
PFExpr (Expression ann) | |
PFLogical (PrimLogic (PrimFormula ann)) |
Instances
Functor PrimFormula Source # | |
Defined in Camfort.Specification.Hoare.Syntax fmap :: (a -> b) -> PrimFormula a -> PrimFormula b # (<$) :: a -> PrimFormula b -> PrimFormula a # | |
Eq ann => Eq (PrimFormula ann) Source # | |
Defined in Camfort.Specification.Hoare.Syntax (==) :: PrimFormula ann -> PrimFormula ann -> Bool # (/=) :: PrimFormula ann -> PrimFormula ann -> Bool # | |
Data ann => Data (PrimFormula ann) Source # | |
Defined in Camfort.Specification.Hoare.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PrimFormula ann -> c (PrimFormula ann) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PrimFormula ann) # toConstr :: PrimFormula ann -> Constr # dataTypeOf :: PrimFormula ann -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (PrimFormula ann)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PrimFormula ann)) # gmapT :: (forall b. Data b => b -> b) -> PrimFormula ann -> PrimFormula ann # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PrimFormula ann -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PrimFormula ann -> r # gmapQ :: (forall d. Data d => d -> u) -> PrimFormula ann -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PrimFormula ann -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PrimFormula ann -> m (PrimFormula ann) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimFormula ann -> m (PrimFormula ann) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimFormula ann -> m (PrimFormula ann) # | |
Show ann => Show (PrimFormula ann) Source # | |
Defined in Camfort.Specification.Hoare.Syntax showsPrec :: Int -> PrimFormula ann -> ShowS # show :: PrimFormula ann -> String # showList :: [PrimFormula ann] -> ShowS # | |
Show a => Pretty (PrimFormula a) Source # | |
Defined in Camfort.Specification.Hoare.Syntax pretty :: PrimFormula a -> String prettysPrec :: Int -> PrimFormula a -> ShowS |
Labels for the keyword used in static_assert
annotations.
SpecPre | static_assert pre(...) |
SpecPost | static_assert post(...) |
SpecSeq | static_assert seq(...) |
SpecInvariant | static_assert invariant(...) |
Instances
Eq SpecKind Source # | |
Data SpecKind Source # | |
Defined in Camfort.Specification.Hoare.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SpecKind -> c SpecKind # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SpecKind # toConstr :: SpecKind -> Constr # dataTypeOf :: SpecKind -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SpecKind) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SpecKind) # gmapT :: (forall b. Data b => b -> b) -> SpecKind -> SpecKind # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SpecKind -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SpecKind -> r # gmapQ :: (forall d. Data d => d -> u) -> SpecKind -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SpecKind -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SpecKind -> m SpecKind # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SpecKind -> m SpecKind # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SpecKind -> m SpecKind # | |
Show SpecKind Source # | |
data Specification a Source #
A static_assert
annotation.
Specification | |
|
Instances
Functor Specification Source # | |
Defined in Camfort.Specification.Hoare.Syntax fmap :: (a -> b) -> Specification a -> Specification b # (<$) :: a -> Specification b -> Specification a # | |
Eq a => Eq (Specification a) Source # | |
Defined in Camfort.Specification.Hoare.Syntax (==) :: Specification a -> Specification a -> Bool # (/=) :: Specification a -> Specification a -> Bool # | |
Data a => Data (Specification a) Source # | |
Defined in Camfort.Specification.Hoare.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Specification a -> c (Specification a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Specification a) # toConstr :: Specification a -> Constr # dataTypeOf :: Specification a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Specification a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Specification a)) # gmapT :: (forall b. Data b => b -> b) -> Specification a -> Specification a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Specification a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Specification a -> r # gmapQ :: (forall d. Data d => d -> u) -> Specification a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Specification a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Specification a -> m (Specification a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Specification a -> m (Specification a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Specification a -> m (Specification a) # | |
Pretty a => Show (Specification a) Source # | |
Defined in Camfort.Specification.Hoare.Syntax showsPrec :: Int -> Specification a -> ShowS # show :: Specification a -> String # showList :: [Specification a] -> ShowS # |
A decl_aux
annotation.
Instances
Functor AuxDecl Source # | |
Eq ann => Eq (AuxDecl ann) Source # | |
Data ann => Data (AuxDecl ann) Source # | |
Defined in Camfort.Specification.Hoare.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AuxDecl ann -> c (AuxDecl ann) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (AuxDecl ann) # toConstr :: AuxDecl ann -> Constr # dataTypeOf :: AuxDecl ann -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (AuxDecl ann)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (AuxDecl ann)) # gmapT :: (forall b. Data b => b -> b) -> AuxDecl ann -> AuxDecl ann # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AuxDecl ann -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AuxDecl ann -> r # gmapQ :: (forall d. Data d => d -> u) -> AuxDecl ann -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AuxDecl ann -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AuxDecl ann -> m (AuxDecl ann) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AuxDecl ann -> m (AuxDecl ann) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AuxDecl ann -> m (AuxDecl ann) # | |
Show ann => Show (AuxDecl ann) Source # | |
type PrimSpec ann = Specification (PrimFormula ann) Source #
A specification over untyped logical expressions.
data SpecOrDecl ann Source #
A static_assert
or decl_aux
annotation.
Instances
Functor SpecOrDecl Source # | |
Defined in Camfort.Specification.Hoare.Syntax fmap :: (a -> b) -> SpecOrDecl a -> SpecOrDecl b # (<$) :: a -> SpecOrDecl b -> SpecOrDecl a # | |
ASTEmbeddable HA (SpecOrDecl InnerHA) Source # | |
Defined in Camfort.Specification.Hoare.Annotation annotateWithAST :: HA -> SpecOrDecl InnerHA -> HA Source # | |
Eq ann => Eq (SpecOrDecl ann) Source # | |
Defined in Camfort.Specification.Hoare.Syntax (==) :: SpecOrDecl ann -> SpecOrDecl ann -> Bool # (/=) :: SpecOrDecl ann -> SpecOrDecl ann -> Bool # | |
Data ann => Data (SpecOrDecl ann) Source # | |
Defined in Camfort.Specification.Hoare.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SpecOrDecl ann -> c (SpecOrDecl ann) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (SpecOrDecl ann) # toConstr :: SpecOrDecl ann -> Constr # dataTypeOf :: SpecOrDecl ann -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (SpecOrDecl ann)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (SpecOrDecl ann)) # gmapT :: (forall b. Data b => b -> b) -> SpecOrDecl ann -> SpecOrDecl ann # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SpecOrDecl ann -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SpecOrDecl ann -> r # gmapQ :: (forall d. Data d => d -> u) -> SpecOrDecl ann -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SpecOrDecl ann -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SpecOrDecl ann -> m (SpecOrDecl ann) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SpecOrDecl ann -> m (SpecOrDecl ann) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SpecOrDecl ann -> m (SpecOrDecl ann) # | |
Show ann => Show (SpecOrDecl ann) Source # | |
Defined in Camfort.Specification.Hoare.Syntax showsPrec :: Int -> SpecOrDecl ann -> ShowS # show :: SpecOrDecl ann -> String # showList :: [SpecOrDecl ann] -> ShowS # |
Lenses
specType :: forall a. Lens' (Specification a) SpecKind Source #
specFormula :: forall a a. Lens (Specification a) (Specification a) a a Source #
_Specification :: forall a a. Iso (Specification a) (Specification a) (SpecKind, a) (SpecKind, a) Source #
_SodDecl :: forall ann. Prism' (SpecOrDecl ann) (AuxDecl ann) Source #
_SodSpec :: forall ann. Prism' (SpecOrDecl ann) (PrimSpec ann) Source #
refining :: Eq r => r -> APrism s t (a, r) (a, r) -> Prism s t a a Source #
Given a prism p
projecting a pair,
projects values from
the front left of the pair such that the right of the pair matches refining
x px
.
>>>
[1, 2, 3] ^? refining [] _Cons
Nothing
>>>
[1] ^? refining [] _Cons
Just 1
_SpecPre :: Prism' (Specification a) a Source #
Match a static_assert pre(...)
annotation.
_SpecPost :: Prism' (Specification a) a Source #
Match a static_assert post(...)
annotation.
_SpecSeq :: Prism' (Specification a) a Source #
Match a static_assert seq(...)
annotation.
_SpecInvariant :: Prism' (Specification a) a Source #
Match a static_assert invariant(...)
annotation.