Grothendieck.hs revision b87efd3db0d2dc41615ea28669faf80fc1b48d56
<http://haskell.org/hawiki/ExistentialTypes> and chapter 7 of /Heterogeneous
module Logic.Grothendieck
import Logic.Coerce
import Logic.Comorphism
import Logic.ExtSign
import Logic.Logic
import Logic.Modification
import Logic.Morphism
import ATerm.Lib
import Common.Doc
import Common.DocUtils
import Common.ExtSign
import Common.Id
import Common.Lexer
import Common.Parsec
import Common.Result
import Common.Token
import Common.Utils
import Control.Monad (foldM)
import Data.Maybe (mapMaybe)
import Data.Typeable
import qualified Data.Map as Map
import Text.ParserCombinators.Parsec (Parser, parse, eof, (<|>))
"Grothendieck.isSubGsign: cannot happen" sigma1
"Grothendieck.isSubGsign: cannot happen" sigma2
G_symbolmap lid (Map.Map symbol a)
G_mapofsymbol lid (Map.Map a symbol)
{ logics :: Map.Map String AnyLogic
, comorphisms :: Map.Map String AnyComorphism
, inclusions :: Map.Map (String, String) AnyComorphism
, unions :: Map.Map (String, String) (AnyComorphism, AnyComorphism)
, morphisms :: Map.Map String AnyMorphism
, modifications :: Map.Map String AnyModification
, squares :: Map.Map (AnyComorphism, AnyComorphism) [Square]
, qTATranslations:: Map.Map String AnyComorphism
{ logics = Map.empty
, comorphisms = Map.empty
, inclusions = Map.empty
, unions = Map.empty
, morphisms = Map.empty
, modifications = Map.empty
, squares = Map.empty
, qTATranslations = Map.empty }
$+$ sepByCommas (map text $ Map.keys $ logics lg)
$+$ vcat (map pretty $ Map.elems $ inclusions lg)
$+$ vcat (map pretty $ Map.elems $ comorphisms lg)
case Map.lookup logname $ logics logicGraph of
_ -> case Map.lookup (ln1,ln2) (unions lg) of
Nothing -> case Map.lookup (ln2,ln1) (unions lg) of
$ Map.lookup mainLogic (logics logicGraph)
$ Map.lookup name (comorphisms logicGraph)
case Map.lookup name (comorphisms lG) of
case Map.lookup name (modifications lG) of
"Ord GMorphism.coerceMorphism" mor1) (Just mor2)
mor2' <- coerceMorphism lid4 lid2 "Grothendieck.comp" mor2
mor1' <- coerceMorphism lid2 lid3 "Grothendieck.comp" mor1
case coerceSublogic lid2 lid3 "Grothendieck.comp"
sigma1' <- coerceSign lid1 lid3 "Grothendieck.comp" sigma1
else case Map.lookup (ln1,ln2) (inclusions logicGraph) of
coMors = Map.elems $ comorphisms lg
sqL1 <- Map.lookup (com1, com2) $ squares lg
sqL2 <- Map.lookup (com2, com1) $ squares lg