0N/ADescription : OMDoc-related functions for conversion (in\/out)
0N/ACopyright : (c) Hendrik Iben, Uni Bremen 2005-2007
0N/ALicense : GPLv2 or higher
Maintainer : hiben@informatik.uni-bremen.de
Portability : non-portable
Definitions for reading\/writing omdoc
debugEnv::forall a . DbgKey -> String -> a -> a
-- Global-Options (for debugging currently)
, hetsOpts :: HetcatsOpts
, processingConstraint :: Bool
debugGO::forall a . GlobalOptions->DbgKey->String->a->a
debugGO go = debug (dbgInf go)
debugGOIO::GlobalOptions->DbgKey->String->IO ()
debugGOIO go = debugIO (dbgInf go)
emptyGlobalOptions::GlobalOptions
dbgInf = (simpleDebug [])
, processingConstraint = False
,omdocNameXMLAttr :: String
,theoryNameXMLAttr :: String
,axiomNameXMLAttr :: String
,sortNameXMLAttr :: String
,symbolTypeXMLAttr :: String
symbolTypeXMLAttr = "role"
,predNameXMLAttr :: String
,caslSort_gen_axS :: String
caslSymbolQuantUniversalS
,caslSymbolQuantExistentialS
,caslSymbolQuantUnique_existentialS
,caslSymbolAtomTrueS :: String
,theoryInclusionS :: String
--caslQuantificationS = "quantification"
caslConjunctionS = "conjunction"
caslDisjunctionS = "disjunction"
caslImplicationS = "implication"
caslImplication2S = "implies"
caslEquivalenceS = "equivalence"
caslEquivalence2S = "equal"
caslPredicationS = "predication"
caslDefinednessS = "definedness"
caslExistl_equationS = "existial-equation"
caslStrong_equationS = "strong-equation"
caslMembershipS = "membership"
caslSort_gen_axS = "sort-gen-ax"
instance Show FormulaType where
show FTConjunction = caslConjunctionS
show FTDisjunction = caslDisjunctionS
show FTImplication = caslImplicationS
show FTEquivalence = caslEquivalenceS
show FTNegation = caslNegationS
show FTPredication = caslPredicationS
show FTDefinedness = caslDefinednessS
show FTExistl_equation = caslExistl_equationS
show FTStrong_equation = caslStrong_equationS
show FTMembership = caslMembershipS
show FTSort_gen_ax = caslSort_gen_axS
instance Read FormulaType where
readsPrec _ "conjunction" = [(FTConjunction, "")]
readsPrec _ "disjunction" = [(FTDisjunction, "")]
readsPrec _ "implication" = [(FTImplication, "")]
readsPrec _ "implies" = [(FTImplication, "")]
readsPrec _ "equivalence" = [(FTEquivalence, "")]
readsPrec _ "equal" = [(FTEquivalence, "")]
readsPrec _ "neg" = [(FTNegation, "")]
readsPrec _ "predication" = [(FTPredication, "")]
readsPrec _ "definedness" = [(FTDefinedness, "")]
readsPrec _ "existial-equation" = [(FTExistl_equation, "")]
readsPrec _ "strong-equation" = [(FTStrong_equation, "")]
readsPrec _ "membership" = [(FTMembership, "")]
readsPrec _ "sort-gen-ax" = [(FTSort_gen_ax, "")]
caslSymbolQuantUniversalS = "universal"
caslSymbolQuantExistentialS = "existential"
caslSymbolQuantUnique_existentialS = "unique-existential"
caslSymbolAtomFalseS = "false"
caslSymbolAtomTrueS = "true"
unsupportedS = "unsupported-formula"
axiomInclusionS = "axiom-inclusion"
theoryInclusionS = "theory-inclusion"
-- | describes a value with an xml-name and an origin
-- | describes a value with an xml-name and a
Graph.Node for origin
-- | a SORT with an xml-name and a
Graph.Node for origin
type XmlNamedWONSORT = XmlNamedWON SORT
xnWOaToXNa::XmlNamedWO a b->XmlNamed a
xnWOaToXNa a = XmlNamed (
Hets.woItem (xnItem a)) (xnName a)
xnWOaToa::XmlNamedWO a b->a
-- | get origin (strip value and name)
xnWOaToO::XmlNamedWO a b->b
-- just an alias to complete this
-- | a predicate with xml-name and origin
data PredTypeXNWON = PredTypeXNWON {predArgsXNWON :: [XmlNamedWONSORT]}
-- | an operator with xml-name and origin
data OpTypeXNWON = OpTypeXNWON { opKindX :: OpKind, opArgsXNWON :: [XmlNamedWONSORT], opResXNWON :: XmlNamedWONSORT }
-- | tries to find the 'pure' sort among named sorts
sortToXmlNamedWONSORT::[XmlNamedWONSORT]->SORT->(Maybe XmlNamedWONSORT)
sortToXmlNamedWONSORTSet::
Set.Set XmlNamedWONSORT->SORT->(Maybe XmlNamedWONSORT)
sortToXmlNamedWONSORTSet sortset sort =
aToXmlNamedWONa::(Eq a)=>[XmlNamedWON a]->a->(Maybe (XmlNamedWON a))
aToXmlNamedWONa xnlist a = find (\i -> a == (xnWOaToa i)) xnlist
aToXmlNamedWONaSet::(Eq a, Ord a)=>
Set.Set (XmlNamedWON a)->a->(Maybe (XmlNamedWON a))
aToXmlNamedWONaSet xnset a =
predTypeToPredTypeXNWON::[XmlNamedWON SORT]->PredType->PredTypeXNWON
predTypeToPredTypeXNWON xnwonsorts (PredType {predArgs = pA}) =
xnwonargs = map (\a -> case (sortToXmlNamedWONSORT xnwonsorts a) of
Nothing -> error "Unable to find xml-named sort for predicate argument!"
(Just xnsort) -> xnsort) pA
predTypeXNWONToPredType::PredTypeXNWON->PredType
predTypeXNWONToPredType (PredTypeXNWON xnargs) =
PredType $ map xnWOaToa xnargs
opTypeToOpTypeXNWON::[XmlNamedWON SORT]->OpType->OpTypeXNWON
opTypeToOpTypeXNWON xnwonsorts (OpType {
CASL.Sign.opKind = oK, opArgs = oA, opRes = oR}) =
xnwonargs = map (\a -> case (sortToXmlNamedWONSORT xnwonsorts a) of
Nothing -> error "Unable to find xml-named sort for operator argument!"
(Just xnsort) -> xnsort) oA
xnwonres = case sortToXmlNamedWONSORT xnwonsorts oR of
Nothing -> error "Unable to find xml-named sort for operator result!"
OpTypeXNWON oK xnwonargs xnwonres
opTypeXNWONToOpType::OpTypeXNWON->OpType
opTypeXNWONToOpType (OpTypeXNWON fk xnargs xnres) =
OpType fk (map xnWOaToa xnargs) (xnWOaToa xnres)
type XmlNamedWONId = XmlNamedWON
Id.Id-- | A Theory (DevGraph-Node) with an xml-name
type TheoryXNSet =
Set.Set TheoryXN
getTheoryXmlName::TheoryXNSet->
Graph.Node->Maybe XmlName
case find (\i -> (fst (xnItem i)) == n) $
Set.toList ts of
(Just i) -> Just (xnName i)
getNodeForTheoryName::TheoryXNSet->XmlName->Maybe
Graph.NodegetNodeForTheoryName xntheoryset xname =
searchname = case xname of
case find (\i -> (xnName i) == searchname) $
Set.toList xntheoryset of
(Just i) -> Just (fst (xnItem i))
, [(XmlNamedWONId, PredType)]
, [(XmlNamedWONId, OpType)]