{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
module CSL.Logic_CSL where
import ATC.ProofTree ()
import CSL.AS_BASIC_CSL
import CSL.ATC_CSL ()
import CSL.Analysis
import CSL.Morphism
import CSL.Parse_AS_Basic
import CSL.ReduceProve
import CSL.Sign
import CSL.Symbol
import CSL.Tools
import qualified Data.Map as Map
import Data.Monoid ()
import Logic.Logic
data CSL = CSL
instance Show CSL where
show :: CSL -> String
show _ = "EnCL"
instance Language CSL where
description :: CSL -> String
description _ = "A Domain-Specific Language for Engineering Calculations\n"
instance Category Sign Morphism where
ide :: Sign -> Morphism
ide = Sign -> Morphism
idMor
dom :: Morphism -> Sign
dom = Morphism -> Sign
source
cod :: Morphism -> Sign
cod = Morphism -> Sign
target
isInclusion :: Morphism -> Bool
isInclusion = Map Id Id -> Bool
forall k a. Map k a -> Bool
Map.null (Map Id Id -> Bool) -> (Morphism -> Map Id Id) -> Morphism -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Morphism -> Map Id Id
operatorMap
composeMorphisms :: Morphism -> Morphism -> Result Morphism
composeMorphisms = Morphism -> Morphism -> Result Morphism
composeMor
instance Sentences CSL CMD
Sign Morphism Symbol where
negation :: CSL -> CMD -> Maybe CMD
negation CSL = CMD -> Maybe CMD
forall a. a -> Maybe a
Just (CMD -> Maybe CMD) -> (CMD -> CMD) -> CMD -> Maybe CMD
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CMD -> CMD
negateFormula
sym_of :: CSL -> Sign -> [Set Symbol]
sym_of CSL = Set Symbol -> [Set Symbol]
forall a. a -> [a]
singletonList (Set Symbol -> [Set Symbol])
-> (Sign -> Set Symbol) -> Sign -> [Set Symbol]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sign -> Set Symbol
symOf
symmap_of :: CSL -> Morphism -> EndoMap Symbol
symmap_of CSL = Morphism -> EndoMap Symbol
getSymbolMap
sym_name :: CSL -> Symbol -> Id
sym_name CSL = Symbol -> Id
getSymbolName
map_sen :: CSL -> Morphism -> CMD -> Result CMD
map_sen CSL = Morphism -> CMD -> Result CMD
mapSentence
simplify_sen :: CSL -> Sign -> CMD -> CMD
simplify_sen CSL _ = CMD -> CMD
forall a. a -> a
id
symKind :: CSL -> Symbol -> String
symKind CSL _ = "op"
instance Semigroup BASIC_SPEC where
(Basic_spec l1 :: [Annoted BASIC_ITEM]
l1) <> :: BASIC_SPEC -> BASIC_SPEC -> BASIC_SPEC
<> (Basic_spec l2 :: [Annoted BASIC_ITEM]
l2) = [Annoted BASIC_ITEM] -> BASIC_SPEC
Basic_spec ([Annoted BASIC_ITEM] -> BASIC_SPEC)
-> [Annoted BASIC_ITEM] -> BASIC_SPEC
forall a b. (a -> b) -> a -> b
$ [Annoted BASIC_ITEM]
l1 [Annoted BASIC_ITEM]
-> [Annoted BASIC_ITEM] -> [Annoted BASIC_ITEM]
forall a. [a] -> [a] -> [a]
++ [Annoted BASIC_ITEM]
l2
instance Monoid BASIC_SPEC where
mempty :: BASIC_SPEC
mempty = [Annoted BASIC_ITEM] -> BASIC_SPEC
Basic_spec []
instance Syntax CSL BASIC_SPEC Symbol
SYMB_ITEMS SYMB_MAP_ITEMS where
parse_basic_spec :: CSL -> Maybe (PrefixMap -> AParser st BASIC_SPEC)
parse_basic_spec CSL = Maybe (PrefixMap -> AParser st BASIC_SPEC)
forall st. Maybe (PrefixMap -> AParser st BASIC_SPEC)
parseBasicSpec
parse_symb_items :: CSL -> Maybe (PrefixMap -> AParser st SYMB_ITEMS)
parse_symb_items CSL = (AParser st SYMB_ITEMS -> PrefixMap -> AParser st SYMB_ITEMS)
-> Maybe (AParser st SYMB_ITEMS)
-> Maybe (PrefixMap -> AParser st SYMB_ITEMS)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AParser st SYMB_ITEMS -> PrefixMap -> AParser st SYMB_ITEMS
forall a b. a -> b -> a
const Maybe (AParser st SYMB_ITEMS)
forall st. Maybe (GenParser Char st SYMB_ITEMS)
parseSymbItems
parse_symb_map_items :: CSL -> Maybe (PrefixMap -> AParser st SYMB_MAP_ITEMS)
parse_symb_map_items CSL = (AParser st SYMB_MAP_ITEMS
-> PrefixMap -> AParser st SYMB_MAP_ITEMS)
-> Maybe (AParser st SYMB_MAP_ITEMS)
-> Maybe (PrefixMap -> AParser st SYMB_MAP_ITEMS)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AParser st SYMB_MAP_ITEMS -> PrefixMap -> AParser st SYMB_MAP_ITEMS
forall a b. a -> b -> a
const Maybe (AParser st SYMB_MAP_ITEMS)
forall st. Maybe (GenParser Char st SYMB_MAP_ITEMS)
parseSymbMapItems
instance Logic CSL
()
BASIC_SPEC
CMD
SYMB_ITEMS
SYMB_MAP_ITEMS
Sign
Morphism
Symbol
Symbol
[EXPRESSION]
where
stability :: CSL -> Stability
stability CSL = Stability
Experimental
empty_proof_tree :: CSL -> [EXPRESSION]
empty_proof_tree CSL = []
provers :: CSL -> [Prover Sign CMD Morphism () [EXPRESSION]]
provers CSL = [Prover Sign CMD Morphism () [EXPRESSION]
reduceProver]
instance StaticAnalysis CSL
BASIC_SPEC
CMD
SYMB_ITEMS
SYMB_MAP_ITEMS
Sign
Morphism
Symbol
Symbol
where
basic_analysis :: CSL
-> Maybe
((BASIC_SPEC, Sign, GlobalAnnos)
-> Result (BASIC_SPEC, ExtSign Sign Symbol, [Named CMD]))
basic_analysis CSL = ((BASIC_SPEC, Sign, GlobalAnnos)
-> Result (BASIC_SPEC, ExtSign Sign Symbol, [Named CMD]))
-> Maybe
((BASIC_SPEC, Sign, GlobalAnnos)
-> Result (BASIC_SPEC, ExtSign Sign Symbol, [Named CMD]))
forall a. a -> Maybe a
Just (BASIC_SPEC, Sign, GlobalAnnos)
-> Result (BASIC_SPEC, ExtSign Sign Symbol, [Named CMD])
forall a.
(BASIC_SPEC, Sign, a)
-> Result (BASIC_SPEC, ExtSign Sign Symbol, [Named CMD])
basicCSLAnalysis
empty_signature :: CSL -> Sign
empty_signature CSL = Sign
emptySig
is_subsig :: CSL -> Sign -> Sign -> Bool
is_subsig CSL = Sign -> Sign -> Bool
isSubSigOf
subsig_inclusion :: CSL -> Sign -> Sign -> Result Morphism
subsig_inclusion CSL s :: Sign
s = Morphism -> Result Morphism
forall (m :: * -> *) a. Monad m => a -> m a
return (Morphism -> Result Morphism)
-> (Sign -> Morphism) -> Sign -> Result Morphism
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sign -> Sign -> Morphism
inclusionMap Sign
s
signature_union :: CSL -> Sign -> Sign -> Result Sign
signature_union CSL = Sign -> Sign -> Result Sign
sigUnion
symbol_to_raw :: CSL -> Symbol -> Symbol
symbol_to_raw CSL = Symbol -> Symbol
symbolToRaw
id_to_raw :: CSL -> Id -> Symbol
id_to_raw CSL = Id -> Symbol
idToRaw
morphism_union :: CSL -> Morphism -> Morphism -> Result Morphism
morphism_union CSL = Morphism -> Morphism -> Result Morphism
morphismUnion