Portability | GHC only |
---|---|
Maintainer | Simon Meier <iridcode@gmail.com> |
Safe Haskell | None |
This is the public interface for constructing and deconstructing constraint systems. The interface for performing constraint solving provided by Theory.Constraint.Solver.
- module Theory.Constraint.System.Constraints
- data System
- emptySystem :: CaseDistKind -> System
- data SystemTraceQuantifier
- formulaToSystem :: [LNGuarded] -> CaseDistKind -> SystemTraceQuantifier -> LNFormula -> System
- sNodes :: forall arr. Arrow arr => Lens arr System (Map NodeId RuleACInst)
- allKDConcs :: System -> [(NodeId, RuleACInst, LNTerm)]
- nodeRule :: NodeId -> System -> RuleACInst
- nodeConcNode :: NodeConc -> NodeId
- nodePremNode :: NodePrem -> NodeId
- nodePremFact :: NodePrem -> System -> LNFact
- nodeConcFact :: NodeConc -> System -> LNFact
- resolveNodePremFact :: NodePrem -> System -> Maybe LNFact
- resolveNodeConcFact :: NodeConc -> System -> Maybe LNFact
- allActions :: System -> [(NodeId, LNFact)]
- allKUActions :: System -> [(NodeId, LNFact, LNTerm)]
- unsolvedActionAtoms :: System -> [(NodeId, LNFact)]
- kuActionAtoms :: System -> [(NodeId, LNFact, LNTerm)]
- standardActionAtoms :: System -> [(NodeId, LNFact)]
- sEdges :: forall arr. Arrow arr => Lens arr System (Set Edge)
- unsolvedChains :: System -> [(NodeConc, NodePrem)]
- sLessAtoms :: forall arr. Arrow arr => Lens arr System (Set (NodeId, NodeId))
- rawLessRel :: System -> [(NodeId, NodeId)]
- rawEdgeRel :: System -> [(NodeId, NodeId)]
- alwaysBefore :: System -> NodeId -> NodeId -> Bool
- isInTrace :: System -> NodeId -> Bool
- sLastAtom :: forall arr. Arrow arr => Lens arr System (Maybe NodeId)
- isLast :: System -> NodeId -> Bool
- module Theory.Tools.EquationStore
- sEqStore :: forall arr. Arrow arr => Lens arr System EqStore
- sSubst :: System :-> LNSubst
- sConjDisjEqs :: System :-> Conj (SplitId, Set LNSubstVFresh)
- sFormulas :: forall arr. Arrow arr => Lens arr System (Set LNGuarded)
- sSolvedFormulas :: forall arr. Arrow arr => Lens arr System (Set LNGuarded)
- sLemmas :: forall arr. Arrow arr => Lens arr System (Set LNGuarded)
- insertLemmas :: [LNGuarded] -> System -> System
- data CaseDistKind
- sCaseDistKind :: forall arr. Arrow arr => Lens arr System CaseDistKind
- data GoalStatus = GoalStatus {}
- gsSolved :: forall arr. Arrow arr => Lens arr GoalStatus Bool
- gsLoopBreaker :: forall arr. Arrow arr => Lens arr GoalStatus Bool
- gsNr :: forall arr. Arrow arr => Lens arr GoalStatus Integer
- sGoals :: forall arr. Arrow arr => Lens arr System (Map Goal GoalStatus)
- sNextGoalNr :: forall arr. Arrow arr => Lens arr System Integer
- prettySystem :: HighlightDocument d => System -> d
- prettyNonGraphSystem :: HighlightDocument d => System -> d
Constraints
Constraint systems
A constraint system.
Construction
emptySystem :: CaseDistKind -> SystemSource
The empty constraint system, which is logically equivalent to true.
data SystemTraceQuantifier Source
Whether we are checking for the existence of a trace satisfiying a the current constraint system or whether we're checking that no traces satisfies the current constraint system.
:: [LNGuarded] | Axioms to add |
-> CaseDistKind | Case distinction kind |
-> SystemTraceQuantifier | Trace quantifier |
-> LNFormula | |
-> System |
Returns the constraint system that has to be proven to show that given formula holds in the context of the given theory.
Node constraints
allKDConcs :: System -> [(NodeId, RuleACInst, LNTerm)]Source
A list of all KD-conclusions in the System
.
nodeRule :: NodeId -> System -> RuleACInstSource
nodeRule v
accesses the rule label of node v
under the assumption that
it is present in the sequent.
nodeConcNode :: NodeConc -> NodeIdSource
nodeConcNode
c
compute the node-id of the node conclusion c
.
nodePremNode :: NodePrem -> NodeIdSource
nodePremNode prem
is the node that this premise is referring to.
nodePremFact :: NodePrem -> System -> LNFactSource
nodePremFact prem se
computes the fact associated to premise prem
in
sequent se
under the assumption that premise prem
is a a premise in
se
.
nodeConcFact :: NodeConc -> System -> LNFactSource
nodeConcFact (NodeConc (v, i))
accesses the i
-th conclusion of the
rule associated with node v
under the assumption that v
is labeled with
a rule that has an i
-th conclusion.
resolveNodePremFact :: NodePrem -> System -> Maybe LNFactSource
All facts associated to this node premise.
resolveNodeConcFact :: NodeConc -> System -> Maybe LNFactSource
The fact associated with this node conclusion, if there is one.
Actions
allActions :: System -> [(NodeId, LNFact)]Source
All actions that hold in a sequent.
unsolvedActionAtoms :: System -> [(NodeId, LNFact)]Source
All actions that hold in a sequent.
standardActionAtoms :: System -> [(NodeId, LNFact)]Source
The standard actions, i.e., non-KU-actions.
Edge and chain constraints
unsolvedChains :: System -> [(NodeConc, NodePrem)]Source
All unsolved destruction chains in the constraint system.
Temporal ordering
rawLessRel :: System -> [(NodeId, NodeId)]Source
(from,to)
is in rawLessRel se
iff we can prove that there is a path
(possibly using the Less
relation) from from
to to
in se
without
appealing to transitivity.
rawEdgeRel :: System -> [(NodeId, NodeId)]Source
(from,to)
is in rawEdgeRel se
iff we can prove that there is an
edge-path from from
to to
in se
without appealing to transitivity.
alwaysBefore :: System -> NodeId -> NodeId -> BoolSource
Returns a predicate that is True
iff the first argument happens before
the second argument in all models of the sequent.
isInTrace :: System -> NodeId -> BoolSource
True
iff the given node id is guaranteed to be instantiated to an
index in the trace.
The last node
isLast :: System -> NodeId -> BoolSource
True
iff the given node id is guaranteed to be instantiated to the last
index of the trace.
Equations
module Theory.Tools.EquationStore
sConjDisjEqs :: System :-> Conj (SplitId, Set LNSubstVFresh)Source
Label to access the conjunction of disjunctions of fresh substutitution in the equation store.
Formulas
Lemmas
insertLemmas :: [LNGuarded] -> System -> SystemSource
Add lemmas / additional assumptions to a constraint system.
Keeping track of typing assumptions
data CaseDistKind Source
Case dinstinction kind that are allowed. The order of the kinds corresponds to the subkinding relation: untyped < typed.
sCaseDistKind :: forall arr. Arrow arr => Lens arr System CaseDistKindSource
Goals
data GoalStatus Source
The status of a Goal
. Use its Semigroup
instance to combine the
status info of goals that collapse.
gsLoopBreaker :: forall arr. Arrow arr => Lens arr GoalStatus BoolSource
Pretty-printing
prettySystem :: HighlightDocument d => System -> dSource
Pretty print a sequent
prettyNonGraphSystem :: HighlightDocument d => System -> dSource
Pretty print the non-graph part of the sequent; i.e. equation store and clauses.