AnalysisLibrary.hs revision 96d8cf9817eeb0d26cba09ca192fc5a33e27bc09
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettModule : $Header$
e071fb22ea9923a2a4ff41184d80ca46b55ee932Till MossakowskiDescription : static analysis of DOL documents and CASL specification libraries
e85b224577b78d08ba5c39fe9dcc2e53995454a2Christian MaederCopyright : (c) Till Mossakowski, Uni Magdeburg 2002-2016
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederLicense : GPLv2 or higher, see LICENSE.txt
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachMaintainer : till@informatik.uni-bremen.de
b4fbc96e05117839ca409f5f20f97b3ac872d1edTill MossakowskiStability : provisional
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachPortability : non-portable(Logic)
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachStatic analysis of DOL documents and CASL specification libraries
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett Follows the verification semantics sketched in Chap. IV:6
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach of the CASL Reference Manual.
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach Follows the semantics of DOL documents, DOL OMG standard, clause 10.2.1
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett ( anaLibFileOrGetEnv
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach , anaSourceFile
e771539425f4a0abef9f94cf4b63690f3603f682Andy Gimblettimport Static.ArchDiagram (emptyExtStUnitCtx)
e771539425f4a0abef9f94cf4b63690f3603f682Andy Gimblettimport Common.AS_Annotation hiding (isAxiom, isDef)
e771539425f4a0abef9f94cf4b63690f3603f682Andy Gimblettimport qualified Common.Unlit as Unlit
61051521e4d82769a47f23aecb5fb477de47d534Andy Gimblettimport qualified Data.Map as Map
eeaf0a8a1dc535d105904a2190f26c0835ecf429Andy Gimblettimport qualified Data.Set as Set
eeaf0a8a1dc535d105904a2190f26c0835ecf429Andy Gimblettimport Data.Either (lefts, rights)
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett-- a set of library names to check for cyclic imports
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimbletttype LNS = Set.Set LibName
820947bd01ca952c3909eaa0366c6914c87cc1cbTill Mossakowski{- | parsing and static analysis for files
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy GimblettParameters: logic graph, default logic, file name -}
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy GimblettanaSourceFile :: LogicGraph -> HetcatsOpts -> LNS -> LibEnv -> DGraph
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett -> FilePath -> ResultT IO (LibName, LibEnv)
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy GimblettanaSourceFile = anaSource Nothing
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy GimblettanaSource :: Maybe LibName -- ^ suggested library name
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett -> LogicGraph -> HetcatsOpts -> LNS -> LibEnv -> DGraph
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett -> FilePath -> ResultT IO (LibName, LibEnv)
90047eafd2de482c67bcd13103c6064e9b0cb254Andy GimblettanaSource mln lg opts topLns libenv initDG origName = ResultT $ do
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett let mName = useCatalogURL opts origName
90047eafd2de482c67bcd13103c6064e9b0cb254Andy Gimblett fname = fromMaybe mName $ stripPrefix "file://" mName
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett syn = case defSyntax opts of
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett "" -> Nothing
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett s -> Just $ simpleIdToIRI $ mkSimpleId s
90047eafd2de482c67bcd13103c6064e9b0cb254Andy Gimblett lgraph = setSyntax syn $ setCurLogic (defLogic opts) lg
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach fname' <- getContentAndFileType opts fname
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett case fname' of
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett Left err -> return $ fail err
af745a4a6cb26002e55b69f90d837fe9c6176d4bAndy Gimblett Right (mr, _, file, inputLit) ->
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett if any (`isSuffixOf` file) [envSuffix, prfSuffix] then
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett return . fail $ "no matching source file for '" ++ fname ++ "' found."
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett input = (if unlit opts then Unlit.unlit else id) inputLit
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett libStr = if isAbsolute fname
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett then convertFileToLibStr fname
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett else dropExtensions fname
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett nLn = case mln of
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett Nothing | useLibPos opts && not (checkUri fname) ->
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett Just $ emptyLibName libStr
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett fn2 = keepOrigClifName opts origName file
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett if runMMT opts then mmtRes fname else
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett if takeExtension file /= ('.' : show TwelfIn)
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett then runResultT $
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett anaString nLn lgraph opts topLns libenv initDG input fn2 mr
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett res <- anaTwelfFile opts file
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett return $ case res of
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett Nothing -> fail $ "failed to analyse file: " ++ file
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett Just (lname, lenv) -> return (lname, Map.union lenv libenv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett-- | parsing of input string (content of file)
e95030058b77cb83593c85aa4c506caf154f63b7Andy GimblettanaString :: Maybe LibName -- ^ suggested library name
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett -> LogicGraph -> HetcatsOpts -> LNS -> LibEnv -> DGraph -> String
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett -> FilePath -> Maybe String -- ^ mime-type of file
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett -> ResultT IO (LibName, LibEnv)
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy GimblettanaString mln lgraph opts topLns libenv initDG input file mr = do
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett curDir <- lift getCurrentDirectory -- get full path for parser positions
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett let realFileName = curDir </> file
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett posFileName = case mln of
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett Just gLn | useLibPos opts -> libToFileName gLn
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett _ -> if checkUri file then file else realFileName
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett lift $ putIfVerbose opts 2 $ "Reading file " ++ file
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett libdefns <- readLibDefn lgraph opts mr file posFileName input
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett when (null libdefns) . fail $ "failed to read contents of file: " ++ file
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett foldM (anaStringAux mln lgraph opts topLns initDG mr file posFileName)
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett (error "Static.AnalysisLibrary.anaString", libenv)
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett $ case analysis opts of
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett Skip -> [last libdefns]
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett _ -> libdefns
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett-- | calling static analysis for parsed library-defn
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy GimblettanaStringAux :: Maybe LibName -- ^ suggested library name
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett -> LogicGraph -> HetcatsOpts -> LNS -> DGraph -> Maybe String -> FilePath
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett -> FilePath -> (LibName, LibEnv) -> LIB_DEFN -> ResultT IO (LibName, LibEnv)
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy GimblettanaStringAux mln lgraph opts topLns initDG mt file posFileName (_, libenv)
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett (Lib_defn pln is' ps ans) = do
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett let pm = fst $ partPrefixes ans
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett expnd i = fromMaybe i $ expandCurie pm i
d326dac41dadbe2b84bb7021cbfd91f4dd4a19bcAndy Gimblett spNs = Set.unions . map (Set.map expnd . getSpecNames)
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett $ concatMap (getSpecDef . item) is'
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett declNs = Set.fromList . map expnd
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett $ concatMap (getDeclSpecNames . item) is'
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett missNames = Set.toList $ spNs Set.\\ declNs
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett unDecls = map (addDownload True) $ filter
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett (isNothing . (`lookupGlobalEnvDG` initDG)) missNames
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett is = unDecls ++ is'
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett spN = convertFileToLibStr file
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett noLibName = getLibId pln == nullIRI
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett nIs = case is of
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett [Annoted (Spec_defn spn gn as qs) rs [] []]
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett | noLibName && null (iriToStringUnsecure spn)
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett -> [Annoted (Spec_defn (simpleIdToIRI $ mkSimpleId spN)
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett gn as qs) rs [] []]
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett emptyFilePath = null $ getFilePath pln
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett ln = setMimeType mt $ if emptyFilePath then setFilePath posFileName
e95030058b77cb83593c85aa4c506caf154f63b7Andy Gimblett $ if noLibName then fromMaybe (emptyLibName spN) mln else pln
e8c03c10d7987b223a9f6bfd5c0c54da21da5b86Andy Gimblett ast = Lib_defn ln nIs ps ans
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett case analysis opts of
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett lift $ putIfVerbose opts 1 $
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett "Skipping static analysis of library " ++ show ln
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett ga <- liftR $ addGlobalAnnos emptyGlobalAnnos ans
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett lift $ writeLibDefn lgraph ga file opts ast
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett let libstring = libToFileName ln
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett unless (isSuffixOf libstring (dropExtension file)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett || not emptyFilePath) . lift . putIfVerbose opts 1
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett $ "### file name '" ++ file ++ "' does not match library name '"
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett ++ libstring ++ "'"
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett lift $ putIfVerbose opts 1 $ "Analyzing "
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett ++ (if noLibName then "file " ++ file ++ " as " else "")
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett ++ "library " ++ show ln
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett (lnFinal, ld, ga, lenv) <-
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett anaLibDefn lgraph opts topLns libenv initDG ast file
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett case Map.lookup lnFinal lenv of
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett Nothing -> error $ "anaString: missing library: " ++ show lnFinal
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett Just dg -> lift $ do
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett writeLibDefn lgraph ga file opts ld
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett when (hasEnvOut opts)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett (writeFileInfo opts lnFinal file ld dg)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett return (lnFinal, lenv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett-- lookup or read a library
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy GimblettanaLibFile :: LogicGraph -> HetcatsOpts -> LNS -> LibEnv -> DGraph -> LibName
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett -> ResultT IO (LibName, LibEnv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy GimblettanaLibFile lgraph opts topLns libenv initDG ln =
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett let lnstr = show ln in case find (== ln) $ Map.keys libenv of
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett Just ln' -> do
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett analyzing opts $ "from " ++ lnstr
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett return (ln', libenv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett putMessageIORes opts 1 $ "Downloading " ++ lnstr ++ " ..."
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett res <- anaLibFileOrGetEnv lgraph
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett (if recurse opts then opts else opts
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett { outtypes = []
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett , unlit = False })
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett (Set.insert ln topLns) libenv initDG (Just ln) $ libNameToFile ln
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett putMessageIORes opts 1 $ "... loaded " ++ lnstr
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett-- | lookup or read a library
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy GimblettanaLibFileOrGetEnv :: LogicGraph -> HetcatsOpts -> LNS -> LibEnv -> DGraph
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett -> Maybe LibName -> FilePath -> ResultT IO (LibName, LibEnv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy GimblettanaLibFileOrGetEnv lgraph opts topLns libenv initDG mln file = do
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett let envFile = rmSuffix file ++ envSuffix
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett recent_envFile <- lift $ checkRecentEnv opts envFile file
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett if recent_envFile
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett mgc <- lift $ readVerbose lgraph opts mln envFile
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett Nothing -> do
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett lift $ putIfVerbose opts 1 $ "Deleting " ++ envFile
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett lift $ removeFile envFile
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett anaSource mln lgraph opts topLns libenv initDG file
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett Just (ld@(Lib_defn ln _ _ _), gc) -> do
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett lift $ writeLibDefn lgraph (globalAnnos gc) file opts ld
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett -- get all DGRefs from DGraph
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett mEnv <- foldl
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett ( \ ioLibEnv labOfDG -> let node = snd labOfDG in
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett if isDGRef node then do
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett let ln2 = dgn_libname node
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett p_libEnv <- ioLibEnv
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett if Map.member ln2 p_libEnv then
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett return p_libEnv
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett else fmap snd $ anaLibFile lgraph
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett opts topLns p_libEnv initDG ln2
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett else ioLibEnv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett (return $ Map.insert ln gc libenv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett $ labNodesDG gc
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett return (ln, mEnv)
d9e78002fb0bf01a9b72d3d3415fdf9790bdfee8Andy Gimblett else anaSource mln lgraph opts topLns libenv initDG file
, lgraph, Map.empty) (map item alibItems)
return (ln, newLD, globalAnnos dg2, Map.insert ln dg2 libenv')
| Set.notMember n spNs && null (getThSens locTh) && isGlobalDef lt
{ prefix_map = Map.singleton ""
if Map.member spn genv
, dg'' { globalEnv = Map.insert spn (SpecEntry
if Map.member asn genv
Map.insert aName diag
{ globalEnv = Map.insert asn
if Map.member usn genv
{ globalEnv = Map.insert usn (UnitEntry unitSig) genv },
if Map.member rn genv
{ globalEnv = Map.insert rn (ArchOrRefEntry False rsig) genv }
if Set.member ln topLns then
$ Set.map getLibId topLns
case Map.lookup ln' libenv' of
++ show ln' ++ " available: " ++ show (Map.keys libenv')
let is = Map.keys $ globalEnv dg'
additionalEo = Map.fromList $ map (\ o -> (o, fn)) origItems
eo' = Map.unionWith (\ _ p2 -> p2) eo additionalEo
-> Result (Set.Set (G_symbol, G_symbol))
[] -> return Set.empty
return $ Set.union sPs1 sPs2
([r1], [r2]) -> -- trace (show r1 ++ " " ++ show (Set.toList sys1)) $
( filter (\ sy -> matches l1 sy r1) $ Set.toList sys1
, filter (\ sy -> matches l2 sy r2) $ Set.toList sys2) of
Set.toList sys1
return $ Set.insert p ps
globalEnv = Map.insert en (ViewOrStructEntry True vsig) $ globalEnv dg3},
if Map.member vn genv
{ globalEnv = Map.insert vn (ViewOrStructEntry True vsig) genv }
let leftList = map fst $ Set.toList pairsSet
rightList = map snd $ Set.toList pairsSet
isTotal gsig sList = Set.fromList sList == symsOfGsign gsig
return dg7 {globalEnv = Map.insert an (AlignEntry asign)
if Map.member an $ globalEnv dg
phi1 = Map.empty
phi2 = Map.empty
let p1' = Map.union eMap1 p1
p2' = Map.union eMap2 p2
rsMap1 = Map.mapKeys (symbol_to_raw lid1) $
Map.map (symbol_to_raw lid1) sMap1
rsMap2 = Map.mapKeys (symbol_to_raw lid1) $
Map.map (symbol_to_raw lid1) sMap2
$ case Map.lookup new genv of
genv1 = Map.insert new (ViewOrStructEntry b vsig1) genv
genv1 = Map.insert new (SpecEntry extsig1) genv