Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data TermFragment
- termFragToTruncatedTerm :: TermFragment -> Term
- data SuspendedConstraint = SuspendedConstraint !PathTrie !UVar
- scGetPathTrie :: SuspendedConstraint -> PathTrie
- scGetUVar :: SuspendedConstraint -> UVar
- descendScs :: Int -> Seq SuspendedConstraint -> Seq SuspendedConstraint
- data UVarValue
- = UVarUnenumerated {
- contents :: !(Maybe Node)
- constraints :: !(Seq SuspendedConstraint)
- | UVarEnumerated { }
- | UVarEliminated
- = UVarUnenumerated {
- data EnumerationState = EnumerationState {}
- uvarCounter :: Lens' EnumerationState UVarGen
- uvarRepresentative :: Lens' EnumerationState UnionFind
- uvarValues :: Lens' EnumerationState (Seq UVarValue)
- initEnumerationState :: Node -> EnumerationState
- type EnumerateM = StateT EnumerationState []
- getUVarRepresentative :: UVar -> EnumerateM UVar
- assimilateUvarVal :: UVar -> UVar -> EnumerateM ()
- mergeNodeIntoUVarVal :: UVar -> Node -> Seq SuspendedConstraint -> EnumerateM ()
- getUVarValue :: UVar -> EnumerateM UVarValue
- getTermFragForUVar :: UVar -> EnumerateM TermFragment
- runEnumerateM :: EnumerateM a -> EnumerationState -> [(a, EnumerationState)]
- enumerateNode :: Seq SuspendedConstraint -> Node -> EnumerateM TermFragment
- enumerateEdge :: Seq SuspendedConstraint -> Edge -> EnumerateM TermFragment
- firstExpandableUVar :: EnumerateM ExpandableUVarResult
- enumerateOutUVar :: UVar -> EnumerateM TermFragment
- enumerateOutFirstExpandableUVar :: EnumerateM ()
- enumerateFully :: EnumerateM ()
- expandTermFrag :: TermFragment -> EnumerateM Term
- expandUVar :: UVar -> EnumerateM Term
- getAllTruncatedTerms :: Node -> [Term]
- getAllTerms :: Node -> [Term]
- naiveDenotation :: Node -> [Term]
Documentation
data TermFragment Source #
Instances
Eq TermFragment Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration (==) :: TermFragment -> TermFragment -> Bool # (/=) :: TermFragment -> TermFragment -> Bool # | |
Ord TermFragment Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration compare :: TermFragment -> TermFragment -> Ordering # (<) :: TermFragment -> TermFragment -> Bool # (<=) :: TermFragment -> TermFragment -> Bool # (>) :: TermFragment -> TermFragment -> Bool # (>=) :: TermFragment -> TermFragment -> Bool # max :: TermFragment -> TermFragment -> TermFragment # min :: TermFragment -> TermFragment -> TermFragment # | |
Show TermFragment Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration showsPrec :: Int -> TermFragment -> ShowS # show :: TermFragment -> String # showList :: [TermFragment] -> ShowS # |
data SuspendedConstraint Source #
Instances
Eq SuspendedConstraint Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration (==) :: SuspendedConstraint -> SuspendedConstraint -> Bool # (/=) :: SuspendedConstraint -> SuspendedConstraint -> Bool # | |
Ord SuspendedConstraint Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration compare :: SuspendedConstraint -> SuspendedConstraint -> Ordering # (<) :: SuspendedConstraint -> SuspendedConstraint -> Bool # (<=) :: SuspendedConstraint -> SuspendedConstraint -> Bool # (>) :: SuspendedConstraint -> SuspendedConstraint -> Bool # (>=) :: SuspendedConstraint -> SuspendedConstraint -> Bool # max :: SuspendedConstraint -> SuspendedConstraint -> SuspendedConstraint # min :: SuspendedConstraint -> SuspendedConstraint -> SuspendedConstraint # | |
Show SuspendedConstraint Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration showsPrec :: Int -> SuspendedConstraint -> ShowS # show :: SuspendedConstraint -> String # showList :: [SuspendedConstraint] -> ShowS # |
scGetUVar :: SuspendedConstraint -> UVar Source #
descendScs :: Int -> Seq SuspendedConstraint -> Seq SuspendedConstraint Source #
UVarUnenumerated | |
| |
UVarEnumerated | |
UVarEliminated |
data EnumerationState Source #
Instances
Eq EnumerationState Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration (==) :: EnumerationState -> EnumerationState -> Bool # (/=) :: EnumerationState -> EnumerationState -> Bool # | |
Ord EnumerationState Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration compare :: EnumerationState -> EnumerationState -> Ordering # (<) :: EnumerationState -> EnumerationState -> Bool # (<=) :: EnumerationState -> EnumerationState -> Bool # (>) :: EnumerationState -> EnumerationState -> Bool # (>=) :: EnumerationState -> EnumerationState -> Bool # max :: EnumerationState -> EnumerationState -> EnumerationState # min :: EnumerationState -> EnumerationState -> EnumerationState # | |
Show EnumerationState Source # | |
Defined in Data.ECTA.Internal.ECTA.Enumeration showsPrec :: Int -> EnumerationState -> ShowS # show :: EnumerationState -> String # showList :: [EnumerationState] -> ShowS # |
type EnumerateM = StateT EnumerationState [] Source #
assimilateUvarVal :: UVar -> UVar -> EnumerateM () Source #
mergeNodeIntoUVarVal :: UVar -> Node -> Seq SuspendedConstraint -> EnumerateM () Source #
getUVarValue :: UVar -> EnumerateM UVarValue Source #
runEnumerateM :: EnumerateM a -> EnumerationState -> [(a, EnumerationState)] Source #
firstExpandableUVar :: EnumerateM ExpandableUVarResult Source #
enumerateFully :: EnumerateM () Source #
expandUVar :: UVar -> EnumerateM Term Source #
getAllTruncatedTerms :: Node -> [Term] Source #
getAllTerms :: Node -> [Term] Source #
naiveDenotation :: Node -> [Term] Source #
Inefficient enumeration
For ECTAs with Mu
nodes may produce an infinite list or may loop indefinitely, depending on the ECTAs. For example, for
createMu $ \r -> Node [Edge "f" [r], Edge "a" []]
it will produce
[ Term "a" [] , Term "f" [Term "a" []] , Term "f" [Term "f" [Term "a" []]] , ... ]
This happens to work currently because non-recursive edges are interned before recursive edges.
TODO: It would be much nicer if this did fair enumeration. It would avoid the beforementioned dependency on interning order, and it would give better enumeration for examples such as
Node [Edge "h" [ createMu $ \r -> Node [Edge "f" [r], Edge "a" []] , createMu $ \r -> Node [Edge "g" [r], Edge "b" []] ]]
This will currently produce
[ Term "h" [Term "a" [], Term "b" []] , Term "h" [Term "a" [], Term "g" [Term "b" []]] , Term "h" [Term "a" [], Term "g" [Term "g" [Term "b" []]]] , .. ]
where it always unfolds the second argument to h
, never the first.