Analysis.hs revision b87efd3db0d2dc41615ea28669faf80fc1b48d56
module Propositional.Analysis
import Common.ExtSign
import Common.Lib.Graph
import Common.SetColimit
import Data.Graph.Inductive.Graph
import Propositional.Sign as Sign
import qualified Common.AS_Annotation as AS_Anno
import qualified Common.GlobalAnnotations as GlobalAnnos
import qualified Common.Id as Id
import qualified Common.Result as Result
import qualified Data.List as List
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Propositional.AS_BASIC_Propositional as AS_BASIC
import qualified Propositional.Morphism as Morphism
import qualified Propositional.Symbol as Symbol
diagnosis :: Result.Diagnosis
msign :: Sign.Sign
, tdiagnosis :: [Result.Diagnosis]
AS_BASIC.BASIC_SPEC -- Input SPEC
-> Sign.Sign -- Input Signature
case (AS_Anno.item x) of
(AS_BASIC.Pred_decl apred) ->
, Result.diagString = "All fine"
tsig $ (\(AS_BASIC.Pred_item xs _)-> xs) apred
, Result.diagString = "Definition of proposition " ++
tsig $ (\(AS_BASIC.Pred_item xs _)-> xs) apred
(AS_BASIC.Axiom_items _) -> TestSig { msign = msign tsig
, Result.diagString = "First axiom"
-> Sign.Sign
makeFormulas (AS_BASIC.Basic_spec bspec) sig =
List.foldl (\xs bs -> retrieveFormulaItem xs bs sig) [] bspec
-> Sign.Sign
case (AS_Anno.item x) of
(AS_BASIC.Pred_decl _) -> axs
(AS_BASIC.Axiom_items ax) ->
List.foldl (\xs bs -> addFormula xs bs sig) axs $ numberFormulae ax 0
label = AS_Anno.getRLabel x
-> Sign.Sign
, diagnosis = Result.Diag
, Result.diagString = "All fine"
, Result.diagPos = lnum
, diagnosis = Result.Diag
, Result.diagString = "Unknown propositions "
, Result.diagPos = lnum
nakedFormula = AS_Anno.item f
isLegal = Sign.isSubSigOf varsOfFormula sign
difference = Sign.sigDiff varsOfFormula sign
lnum = AS_Anno.opt_pos f
makeNamed f i = (AS_Anno.makeNamed (if label == "" then "Ax_" ++ show i
else label) $ AS_Anno.item f)
{ AS_Anno.isAxiom = not isTheorem }
label = AS_Anno.getRLabel f
annos = AS_Anno.r_annos f
isImplies = foldl (\y x -> AS_Anno.isImplies x || y) False annos
isImplied = foldl (\y x -> AS_Anno.isImplied x || y) False annos
propsOfFormula (AS_BASIC.Negation form _) = propsOfFormula form
Id.simpleIdToId x }
Result.Result diags $ if exErrs then Nothing else
$ Set.difference (items sigItems) $ items sig
exErrs = Result.hasErrors diags
mkStatSymbMapItem :: [AS_BASIC.SYMB_MAP_ITEMS]
Result.diags = []
, Result.maybeResult = Just $
AS_BASIC.Symb_map_items sitem _ ->
Map.union smap $ statSymbMapItem sitem
statSymbMapItem :: [AS_BASIC.SYMB_OR_MAP]
AS_BASIC.Symb_map s1 s2 _
-> Map.insert (symbToSymbol s1) (symbToSymbol s2) mmap
mkStatSymbItems a = Result.Result
Result.diags = []
, Result.maybeResult = Just $ statSymbItems a
symbItemsToSymbol (AS_BASIC.Symb_items syms _) = map symbToSymbol syms
symbToSymbol (AS_BASIC.Symb_id tok) =
-> Sign.Sign
Result.diags = []
sigItems = Sign.items sig
Set.fold (
Map.insert x y
Map.empty sigItems
Morphism.source = sig
, Morphism.propMap = pMap
{Sign.items =
Sign.items sig
sigItems = Sign.items sig
Set.fold (
Map.insert x y
Map.empty sigItems
targetSig = Sign.Sign
{Sign.items =
Sign.items sig
True -> Result.Result
Result.diags = []
Morphism.source = sig
, Morphism.propMap = pMap
, Morphism.target = tSig
False -> Result.Result
, Result.diagString = "Incompatible mapping"
, Result.maybeResult = Nothing
Map.fromList $ map (\(i, n) ->
(i, Morphism.Morphism{
Morphism.source = n,
Morphism.target = cSig,
Morphism.propMap = maps Map.! i