Morphism.hs revision d5fe06af711a6912ae028ebf873eada4ee8733f8
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski{- |
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskiModule : $Header$
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskiDescription : Symbol related functions for SoftFOL.
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskiCopyright : (c) Klaus Luettich, Uni Bremen 2007
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskiLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskiMaintainer : luecke@informatik.uni-bremen.de
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian MaederStability : provisional
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskiPortability : portable
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskiFunctions for symbols of SoftFOL.
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski-}
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowskimodule SoftFOL.Morphism (symOf, symbolToId) where
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowskiimport SoftFOL.Sign
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowskiimport Common.Id
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowskiimport qualified Data.Set as Set
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowskiimport qualified Data.Map as Map
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till Mossakowski
41cff438a611c7aac5b2a2c3e395fc5b88d68230Till MossakowskisymOf :: Sign -> Set.Set SFSymbol
4918e2f622cfb96f9a57b7617cd18ca7e4f8b5d4Christian MaedersymOf sig =
let opSymbs = Set.unions $ map toOpSymb $ Map.toList $ funcMap sig
predSymbs = Set.unions $ map toPredSymb $ Map.toList $ predMap sig
sortSymbs = Set.map toSortSymb $ Map.keysSet $ sortMap sig
in Set.unions [opSymbs,predSymbs,sortSymbs]
toOpSymb :: (SPIdentifier,Set.Set([SPIdentifier], SPIdentifier))
-> Set.Set SFSymbol
toOpSymb (ident,ts) = Set.map toSymb ts
where toSymb (args,res) =
SFSymbol { sym_ident = ident
, sym_type = SFOpType args res}
toPredSymb :: (SPIdentifier,Set.Set [SPIdentifier]) -> Set.Set SFSymbol
toPredSymb (ident,ts) = Set.map toSymb ts
where toSymb args =
SFSymbol { sym_ident = ident
, sym_type = SFPredType args}
toSortSymb :: SPIdentifier -> SFSymbol
toSortSymb ident = SFSymbol { sym_ident = ident
, sym_type = SFSortType}
symbolToId :: SFSymbol -> Id
symbolToId = mkId . (:[]) . sym_ident