Portability | GHC only |
---|---|
Maintainer | Simon Meier <iridcode@gmail.com> |
Safe Haskell | None |
Theory datatype and transformations on it.
- data Axiom = Axiom {
- _axName :: String
- _axFormula :: LNFormula
- axName :: forall arr. Arrow arr => Lens arr Axiom String
- axFormula :: forall arr. Arrow arr => Lens arr Axiom LNFormula
- data LemmaAttribute
- data TraceQuantifier
- = ExistsTrace
- | AllTraces
- data Lemma p
- lName :: forall arr p. Arrow arr => Lens arr (Lemma p) String
- lTraceQuantifier :: forall arr p. Arrow arr => Lens arr (Lemma p) TraceQuantifier
- lFormula :: forall arr p. Arrow arr => Lens arr (Lemma p) LNFormula
- lAttributes :: forall arr p. Arrow arr => Lens arr (Lemma p) [LemmaAttribute]
- lProof :: forall arr p. Arrow arr => Lens arr (Lemma p) p
- unprovenLemma :: String -> [LemmaAttribute] -> TraceQuantifier -> LNFormula -> Lemma ProofSkeleton
- skeletonLemma :: String -> [LemmaAttribute] -> TraceQuantifier -> LNFormula -> ProofSkeleton -> Lemma ProofSkeleton
- data Theory sig c r p = Theory {
- _thyName :: String
- _thySignature :: sig
- _thyCache :: c
- _thyItems :: [TheoryItem r p]
- data TheoryItem r p
- thyName :: forall arr sig c r p. Arrow arr => Lens arr (Theory sig c r p) String
- thySignature :: forall arr sig c r p. Arrow arr => Lens arr (Theory sig c r p) sig
- thyCache :: forall arr sig c r p. Arrow arr => Lens arr (Theory sig c r p) c
- thyItems :: forall arr sig c r p. Arrow arr => Lens arr (Theory sig c r p) [TheoryItem r p]
- theoryRules :: Theory sig c r p -> [r]
- theoryLemmas :: Theory sig c r p -> [Lemma p]
- theoryAxioms :: Theory sig c r p -> [Axiom]
- addAxiom :: Axiom -> Theory sig c r p -> Maybe (Theory sig c r p)
- addLemma :: Lemma p -> Theory sig c r p -> Maybe (Theory sig c r p)
- removeLemma :: String -> Theory sig c r p -> Maybe (Theory sig c r p)
- lookupLemma :: String -> Theory sig c r p -> Maybe (Lemma p)
- addComment :: Doc -> Theory sig c r p -> Theory sig c r p
- addStringComment :: String -> Theory sig c r p -> Theory sig c r p
- addFormalComment :: FormalComment -> Theory sig c r p -> Theory sig c r p
- cprRuleE :: forall arr. Arrow arr => Lens arr ClosedProtoRule ProtoRuleE
- type OpenTheory = Theory SignaturePure [IntrRuleAC] OpenProtoRule ProofSkeleton
- defaultOpenTheory :: OpenTheory
- addProtoRule :: ProtoRuleE -> OpenTheory -> Maybe OpenTheory
- applyPartialEvaluation :: EvaluationStyle -> ClosedTheory -> ClosedTheory
- addIntrRuleACs :: [IntrRuleAC] -> OpenTheory -> OpenTheory
- normalizeTheory :: OpenTheory -> OpenTheory
- type ClosedTheory = Theory SignatureWithMaude ClosedRuleCache ClosedProtoRule IncrementalProof
- data ClosedRuleCache = ClosedRuleCache {}
- closeTheory :: FilePath -> OpenTheory -> IO ClosedTheory
- openTheory :: ClosedTheory -> OpenTheory
- data ClosedProtoRule = ClosedProtoRule {}
- getLemmas :: ClosedTheory -> [Lemma IncrementalProof]
- getIntrVariants :: ClosedTheory -> [IntrRuleAC]
- getProtoRuleEs :: ClosedTheory -> [ProtoRuleE]
- getProofContext :: Lemma a -> ClosedTheory -> ProofContext
- getClassifiedRules :: ClosedTheory -> ClassifiedRules
- getInjectiveFactInsts :: ClosedTheory -> Set FactTag
- getCaseDistinction :: CaseDistKind -> ClosedTheory -> [CaseDistinction]
- type ProofSkeleton = Proof ()
- proveTheory :: (Lemma IncrementalProof -> Bool) -> Prover -> ClosedTheory -> ClosedTheory
- lookupLemmaProof :: LemmaRef -> ClosedTheory -> Maybe IncrementalProof
- modifyLemmaProof :: Prover -> LemmaRef -> ClosedTheory -> Maybe ClosedTheory
- prettyFormalComment :: HighlightDocument d => String -> String -> d
- prettyLemmaName :: HighlightDocument d => Lemma p -> d
- prettyAxiom :: HighlightDocument d => Axiom -> d
- prettyLemma :: HighlightDocument d => (p -> d) -> Lemma p -> d
- prettyClosedTheory :: HighlightDocument d => ClosedTheory -> d
- prettyOpenTheory :: HighlightDocument d => OpenTheory -> d
- prettyClosedSummary :: Document d => ClosedTheory -> d
- prettyIntruderVariants :: HighlightDocument d => [IntrRuleAC] -> d
- prettyTraceQuantifier :: Document d => TraceQuantifier -> d
- module Theory.Model
- module Theory.Proof
Axioms
An axiom describes a property that must hold for all traces. Axioms are always used as lemmas in proofs.
Axiom | |
|
Lemmas
data LemmaAttribute Source
An attribute for a Lemma
.
data TraceQuantifier Source
A TraceQuantifier
stating whether we check satisfiability of validity.
A lemma describes a property that holds in the context of a theory together with a proof of its correctness.
lTraceQuantifier :: forall arr p. Arrow arr => Lens arr (Lemma p) TraceQuantifierSource
lAttributes :: forall arr p. Arrow arr => Lens arr (Lemma p) [LemmaAttribute]Source
unprovenLemma :: String -> [LemmaAttribute] -> TraceQuantifier -> LNFormula -> Lemma ProofSkeletonSource
Create a new unproven lemma from a formula modulo E.
skeletonLemma :: String -> [LemmaAttribute] -> TraceQuantifier -> LNFormula -> ProofSkeleton -> Lemma ProofSkeletonSource
Theories
A theory contains a single set of rewriting rules modeling a protocol and the lemmas that
Theory | |
|
(Eq sig, Eq c, Eq r, Eq p) => Eq (Theory sig c r p) | |
(Ord sig, Ord c, Ord r, Ord p) => Ord (Theory sig c r p) | |
(Show sig, Show c, Show r, Show p) => Show (Theory sig c r p) | |
(Binary sig_1628398556, Binary c_1628398557, Binary r_1628398558, Binary p_1628398559) => Binary (Theory sig_1628398556 c_1628398557 r_1628398558 p_1628398559) | |
(NFData sig_1628398556, NFData c_1628398557, NFData r_1628398558, NFData p_1628398559) => NFData (Theory sig_1628398556 c_1628398557 r_1628398558 p_1628398559) |
data TheoryItem r p Source
A theory item built over the given rule type.
Functor (TheoryItem r) | |
(Eq r, Eq p) => Eq (TheoryItem r p) | |
(Ord r, Ord p) => Ord (TheoryItem r p) | |
(Show r, Show p) => Show (TheoryItem r p) | |
(Binary r_1628398560, Binary p_1628398561) => Binary (TheoryItem r_1628398560 p_1628398561) | |
(NFData r_1628398560, NFData p_1628398561) => NFData (TheoryItem r_1628398560 p_1628398561) |
thySignature :: forall arr sig c r p. Arrow arr => Lens arr (Theory sig c r p) sigSource
theoryRules :: Theory sig c r p -> [r]Source
All rules of a theory.
theoryLemmas :: Theory sig c r p -> [Lemma p]Source
All lemmas of a theory.
theoryAxioms :: Theory sig c r p -> [Axiom]Source
All axioms of a theory.
addAxiom :: Axiom -> Theory sig c r p -> Maybe (Theory sig c r p)Source
Add a new axiom. Fails, if axiom with the same name exists.
addLemma :: Lemma p -> Theory sig c r p -> Maybe (Theory sig c r p)Source
Add a new lemma. Fails, if a lemma with the same name exists.
removeLemma :: String -> Theory sig c r p -> Maybe (Theory sig c r p)Source
Remove a lemma by name. Fails, if the lemma does not exist.
lookupLemma :: String -> Theory sig c r p -> Maybe (Lemma p)Source
Find the lemma with the given name.
addComment :: Doc -> Theory sig c r p -> Theory sig c r pSource
Add a comment to the theory.
addStringComment :: String -> Theory sig c r p -> Theory sig c r pSource
Add a comment represented as a string to the theory.
addFormalComment :: FormalComment -> Theory sig c r p -> Theory sig c r pSource
cprRuleE :: forall arr. Arrow arr => Lens arr ClosedProtoRule ProtoRuleESource
Open theories
type OpenTheory = Theory SignaturePure [IntrRuleAC] OpenProtoRule ProofSkeletonSource
Open theories can be extended. Invariants: 1. Lemma names are unique.
defaultOpenTheory :: OpenTheorySource
Default theory
addProtoRule :: ProtoRuleE -> OpenTheory -> Maybe OpenTheorySource
Add a new protocol rules. Fails, if a protocol rule with the same name exists.
applyPartialEvaluation :: EvaluationStyle -> ClosedTheory -> ClosedTheorySource
Apply partial evaluation.
addIntrRuleACs :: [IntrRuleAC] -> OpenTheory -> OpenTheorySource
Add intruder proof rules.
normalizeTheory :: OpenTheory -> OpenTheorySource
Normalize the theory representation such that they remain semantically equivalent. Use this function when you want to compare two theories (quite strictly) for semantic equality; e.g., when testing the parser.
Closed theories
type ClosedTheory = Theory SignatureWithMaude ClosedRuleCache ClosedProtoRule IncrementalProofSource
Closed theories can be proven. Invariants: 1. Lemma names are unique 2. All proof steps with annotated sequents are sound with respect to the closed rule set of the theory. 3. Maude is running under the given handle.
:: FilePath | Path to the Maude executable. |
-> OpenTheory | |
-> IO ClosedTheory |
Close a theory by closing its associated rule set and checking the proof skeletons and caching AC variants as well as precomputed case distinctions.
This function initializes the relation to the Maude process with the correct signature. This is the right place to do that because in a closed theory the signature may not change any longer.
openTheory :: ClosedTheory -> OpenTheorySource
Open a theory by dropping the closed world assumption and values whose soundness dependens on it.
data ClosedProtoRule Source
A closed proto rule lists its original rule modulo E, the corresponding variant modulo AC, and if required the assertion soundness proof.
getLemmas :: ClosedTheory -> [Lemma IncrementalProof]Source
All lemmas.
getIntrVariants :: ClosedTheory -> [IntrRuleAC]Source
The variants of the intruder rules.
getProtoRuleEs :: ClosedTheory -> [ProtoRuleE]Source
All protocol rules modulo E.
getProofContext :: Lemma a -> ClosedTheory -> ProofContextSource
Get the proof context for a lemma of the closed theory.
getClassifiedRules :: ClosedTheory -> ClassifiedRulesSource
The classified set of rules modulo AC in this theory.
getInjectiveFactInsts :: ClosedTheory -> Set FactTagSource
The facts with injective instances in this theory
getCaseDistinction :: CaseDistKind -> ClosedTheory -> [CaseDistinction]Source
The precomputed case distinctions.
Proving
type ProofSkeleton = Proof ()Source
Proof skeletons are used to represent proofs in open theories.
:: (Lemma IncrementalProof -> Bool) | Lemma selector. |
-> Prover | |
-> ClosedTheory | |
-> ClosedTheory |
Prove both the assertion soundness as well as all lemmas of the theory. If the prover fails on a lemma, then its proof remains unchanged.
Lemma references
lookupLemmaProof :: LemmaRef -> ClosedTheory -> Maybe IncrementalProofSource
Resolve a path in a theory.
modifyLemmaProof :: Prover -> LemmaRef -> ClosedTheory -> Maybe ClosedTheorySource
Modify the proof at the given lemma ref, if there is one. Fails if the path is not present or if the prover fails.
Pretty printing
prettyFormalComment :: HighlightDocument d => String -> String -> dSource
Pretty print a formal comment
prettyLemmaName :: HighlightDocument d => Lemma p -> dSource
Pretty print the lemma name together with its attributes.
prettyAxiom :: HighlightDocument d => Axiom -> dSource
Pretty print an axiom.
prettyLemma :: HighlightDocument d => (p -> d) -> Lemma p -> dSource
Pretty print a lemma.
prettyClosedTheory :: HighlightDocument d => ClosedTheory -> dSource
Pretty print a closed theory.
prettyOpenTheory :: HighlightDocument d => OpenTheory -> dSource
Pretty print an open theory.
prettyClosedSummary :: Document d => ClosedTheory -> dSource
prettyIntruderVariants :: HighlightDocument d => [IntrRuleAC] -> dSource
Pretty-print a non-empty bunch of intruder rules.
prettyTraceQuantifier :: Document d => TraceQuantifier -> dSource
Pretty print a TraceQuantifier
.
Convenience exports
module Theory.Model
module Theory.Proof