1e83c8de3aa48b316b28057d53995272baf1260cwroweDescription : Analyzes a logic definition
1e83c8de3aa48b316b28057d53995272baf1260cwroweCopyright : (c) Kristina Sojakova, DFKI Bremen 2010
1e83c8de3aa48b316b28057d53995272baf1260cwroweLicense : GPLv2 or higher, see LICENSE.txt
1e83c8de3aa48b316b28057d53995272baf1260cwroweMaintainer : k.sojakova@jacobs-university.de
1e83c8de3aa48b316b28057d53995272baf1260cwroweStability : experimental
1e83c8de3aa48b316b28057d53995272baf1260cwrowePortability : portable
1e83c8de3aa48b316b28057d53995272baf1260cwrowe ( anaLogicDef
1e83c8de3aa48b316b28057d53995272baf1260cwrowe , anaComorphismDef
1e83c8de3aa48b316b28057d53995272baf1260cwrowe , addLogic2LogicList
1e83c8de3aa48b316b28057d53995272baf1260cwroweimport qualified LF.Logic_LF as Logic_LF
1e83c8de3aa48b316b28057d53995272baf1260cwroweimport qualified Isabelle.Logic_Isabelle as Logic_Isabelle
1e83c8de3aa48b316b28057d53995272baf1260cwroweimport qualified Maude.Logic_Maude as Logic_Maude
1e83c8de3aa48b316b28057d53995272baf1260cwroweimport qualified Data.Map as Map
1e83c8de3aa48b316b28057d53995272baf1260cwroweimport Common.IRI (iriToStringUnsecure, nullIRI)
94b262d3639149df0b02642a9daa6db8bff58577wrowedynLogicsDir :: FilePath
94b262d3639149df0b02642a9daa6db8bff58577wrowedynLogicsDir = "Comorphisms"
94b262d3639149df0b02642a9daa6db8bff58577wrowedynLogicsFile :: FilePath
94b262d3639149df0b02642a9daa6db8bff58577wrowedynLogicsFile = "DynLogicList.hs"
94b262d3639149df0b02642a9daa6db8bff58577wrowedynLogicsCon :: String
94b262d3639149df0b02642a9daa6db8bff58577wrowedynLogicsCon = "dynLogicList"
1e83c8de3aa48b316b28057d53995272baf1260cwrowedynComorphismsDir :: FilePath
1e83c8de3aa48b316b28057d53995272baf1260cwrowedynComorphismsDir = "Comorphisms"
1e83c8de3aa48b316b28057d53995272baf1260cwrowedynComorphismsFile :: FilePath
1e83c8de3aa48b316b28057d53995272baf1260cwrowedynComorphismsFile = "DynComorphismList.hs"
1e83c8de3aa48b316b28057d53995272baf1260cwrowedynComorphismsCon :: String
1e83c8de3aa48b316b28057d53995272baf1260cwrowedynComorphismsCon = "dynComorphismList"
1e83c8de3aa48b316b28057d53995272baf1260cwrowe{- ----------------------------------------------------------------------------
1e83c8de3aa48b316b28057d53995272baf1260cwroweLogic analysis -}
1e83c8de3aa48b316b28057d53995272baf1260cwrowe-- analyzes a logic definition
5ac28f3fe2417368757f29cf381338357605fd52wroweanaLogicDef :: LogicDef -> DGraph -> IO DGraph
e1ad80c048e29e968221817698529d73098f07a4wroweanaLogicDef ld dg =
1e83c8de3aa48b316b28057d53995272baf1260cwrowe case meta ld of
1e83c8de3aa48b316b28057d53995272baf1260cwrowe LF -> anaLogicDefH Logic_LF.LF ld dg
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Isabelle -> anaLogicDefH Logic_Isabelle.Isabelle ld dg
37ad54b8fd2611b7a4f2b269eec3d27ed784a25dwrowe Maude -> anaLogicDefH Logic_Maude.Maude ld dg
1e83c8de3aa48b316b28057d53995272baf1260cwroweanaLogicDefH :: LogicalFramework lid sublogics basic_spec sentence symb_items
1e83c8de3aa48b316b28057d53995272baf1260cwrowe symb_map_items sign morphism symbol raw_symbol
94b262d3639149df0b02642a9daa6db8bff58577wrowe => lid -> LogicDef -> DGraph -> IO DGraph
94b262d3639149df0b02642a9daa6db8bff58577wroweanaLogicDefH ml ld dg =
94b262d3639149df0b02642a9daa6db8bff58577wrowe case retrieveDiagram ml ld dg of
94b262d3639149df0b02642a9daa6db8bff58577wrowe Result _ (Just (ltruth, lmod, found, lpf)) -> do
94b262d3639149df0b02642a9daa6db8bff58577wrowe let l = iriToStringUnsecure $ newlogicName ld
94b262d3639149df0b02642a9daa6db8bff58577wrowe buildLogic ml l ltruth lmod found lpf
94b262d3639149df0b02642a9daa6db8bff58577wrowe addLogic2LogicList l
94b262d3639149df0b02642a9daa6db8bff58577wrowe return $ addLogicDef2DG ld dg
1e83c8de3aa48b316b28057d53995272baf1260cwrowe _ -> error ""
1e83c8de3aa48b316b28057d53995272baf1260cwrowe{- constructs the diagram in the signature category of the meta logic
1e83c8de3aa48b316b28057d53995272baf1260cwrowe which represents the object logic -}
1e83c8de3aa48b316b28057d53995272baf1260cwroweretrieveDiagram :: LogicalFramework lid sublogics basic_spec sentence symb_items
1e83c8de3aa48b316b28057d53995272baf1260cwrowe symb_map_items sign morphism symbol raw_symbol
1e83c8de3aa48b316b28057d53995272baf1260cwrowe => lid -> LogicDef -> DGraph ->
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Result (morphism, Maybe morphism,
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Maybe sign, Maybe morphism)
1e83c8de3aa48b316b28057d53995272baf1260cwroweretrieveDiagram ml (LogicDef _ _ s m f p _) dg = do
1e83c8de3aa48b316b28057d53995272baf1260cwrowe ltruth <- lookupMorph ml s dg
1e83c8de3aa48b316b28057d53995272baf1260cwrowe lmod <- if m == nullIRI
8c8173f49dd7122e10636b3d20ae841551bd0b43wrowe then return Nothing
1e83c8de3aa48b316b28057d53995272baf1260cwrowe else do v <- lookupMorph ml m dg
1e83c8de3aa48b316b28057d53995272baf1260cwrowe return $ Just v
1e83c8de3aa48b316b28057d53995272baf1260cwrowe found <- if f == nullIRI
dg2 = dg1 { globalEnv = Map.insert name gEntry $ globalEnv dg1 }
writeFile (l ++ "/" ++ "Syntax.hs") syntaxCl
writeFile (l ++ "/" ++ "Model.hs") modCl
writeFile (l ++ "/" ++ "Proof.hs") proofCl
LF -> anaComorphismDefH Logic_LF.LF cd dg
Isabelle -> anaComorphismDefH Logic_Isabelle.Isabelle cd dg
Maude -> anaComorphismDefH Logic_Maude.Maude cd dg
dg2 = dg1 { globalEnv = Map.insert name gEntry $ globalEnv dg1 }