Portability | portable |
---|---|
Maintainer | Simon Meier <iridcode@gmail.com> |
Safe Haskell | None |
Rewriting rules representing protocol execution and intruder deduction. Once modulo the full Diffie-Hellman equational theory and once modulo AC.
- data Rule i = Rule {}
- newtype PremIdx = PremIdx {
- getPremIdx :: Int
- newtype ConcIdx = ConcIdx {
- getConcIdx :: Int
- rInfo :: forall arr i. Arrow arr => Lens arr (Rule i) i
- rPrems :: forall arr i. Arrow arr => Lens arr (Rule i) [LNFact]
- rConcs :: forall arr i. Arrow arr => Lens arr (Rule i) [LNFact]
- rActs :: forall arr i. Arrow arr => Lens arr (Rule i) [LNFact]
- rPrem :: PremIdx -> Rule i :-> LNFact
- rConc :: ConcIdx -> Rule i :-> LNFact
- lookupPrem :: PremIdx -> Rule i -> Maybe LNFact
- lookupConc :: ConcIdx -> Rule i -> Maybe LNFact
- enumPrems :: Rule i -> [(PremIdx, LNFact)]
- enumConcs :: Rule i -> [(ConcIdx, LNFact)]
- data RuleInfo p i
- ruleInfo :: (p -> c) -> (i -> c) -> RuleInfo p i -> c
- data ProtoRuleName
- data ProtoRuleACInfo = ProtoRuleACInfo {}
- pracName :: forall arr. Arrow arr => Lens arr ProtoRuleACInfo ProtoRuleName
- pracVariants :: forall arr. Arrow arr => Lens arr ProtoRuleACInfo (Disj LNSubstVFresh)
- pracLoopBreakers :: forall arr. Arrow arr => Lens arr ProtoRuleACInfo [PremIdx]
- data ProtoRuleACInstInfo = ProtoRuleACInstInfo {}
- praciName :: forall arr. Arrow arr => Lens arr ProtoRuleACInstInfo ProtoRuleName
- praciLoopBreakers :: forall arr. Arrow arr => Lens arr ProtoRuleACInstInfo [PremIdx]
- type RuleACConstrs = Disj LNSubstVFresh
- data IntrRuleACInfo
- type ProtoRuleE = Rule ProtoRuleName
- type ProtoRuleAC = Rule ProtoRuleACInfo
- type IntrRuleAC = Rule IntrRuleACInfo
- type RuleAC = Rule (RuleInfo ProtoRuleACInfo IntrRuleACInfo)
- type RuleACInst = Rule (RuleInfo ProtoRuleACInstInfo IntrRuleACInfo)
- class HasRuleName t where
- ruleName :: t -> RuleInfo ProtoRuleName IntrRuleACInfo
- isIntruderRule :: HasRuleName r => r -> Bool
- isDestrRule :: HasRuleName r => r -> Bool
- isConstrRule :: HasRuleName r => r -> Bool
- isFreshRule :: HasRuleName r => r -> Bool
- isIRecvRule :: HasRuleName r => r -> Bool
- isISendRule :: HasRuleName r => r -> Bool
- isCoerceRule :: HasRuleName r => r -> Bool
- nfRule :: Rule i -> WithMaude Bool
- isTrivialProtoVariantAC :: ProtoRuleAC -> ProtoRuleE -> Bool
- ruleACToIntrRuleAC :: RuleAC -> Maybe IntrRuleAC
- ruleACIntrToRuleAC :: IntrRuleAC -> RuleAC
- ruleACIntrToRuleACInst :: IntrRuleAC -> RuleACInst
- someRuleACInst :: MonadFresh m => RuleAC -> m (RuleACInst, Maybe RuleACConstrs)
- unifyRuleACInstEqs :: [Equal RuleACInst] -> WithMaude [LNSubstVFresh]
- unifiableRuleACInsts :: RuleACInst -> RuleACInst -> WithMaude Bool
- reservedRuleNames :: [String]
- showRuleCaseName :: HasRuleName (Rule i) => Rule i -> String
- prettyProtoRuleName :: Document d => ProtoRuleName -> d
- prettyRuleName :: (HighlightDocument d, HasRuleName (Rule i)) => Rule i -> d
- prettyProtoRuleE :: HighlightDocument d => ProtoRuleE -> d
- prettyProtoRuleAC :: HighlightDocument d => ProtoRuleAC -> d
- prettyIntrRuleAC :: HighlightDocument d => IntrRuleAC -> d
- prettyIntrRuleACInfo :: Document d => IntrRuleACInfo -> d
- prettyRuleAC :: HighlightDocument d => RuleAC -> d
- prettyLoopBreakers :: HighlightDocument d => ProtoRuleACInfo -> d
- prettyRuleACInst :: HighlightDocument d => RuleACInst -> d
General Rules
Rewriting rules with arbitrary additional information and facts with names and logical variables.
Functor Rule | |
Typeable1 Rule | |
HasRuleName RuleACInst | |
HasRuleName RuleAC | |
HasRuleName ProtoRuleAC | |
HasRuleName ProtoRuleE | |
HasRuleName IntrRuleAC | |
Eq i => Eq (Rule i) | |
Data i => Data (Rule i) | |
Ord i => Ord (Rule i) | |
Show i => Show (Rule i) | |
Binary i_1627482811 => Binary (Rule i_1627482811) | |
NFData i_1627482811 => NFData (Rule i_1627482811) | |
Apply i => Apply (Rule i) | |
(Show i, HasFrees i) => HasFrees (Rule i) | |
Sized (Rule i) |
An index of a premise. The first premise has index '0'.
PremIdx | |
|
An index of a conclusion. The first conclusion has index '0'.
ConcIdx | |
|
Accessors
lookupPrem :: PremIdx -> Rule i -> Maybe LNFactSource
lookupPrem i ru
returns the i
-th premise of rule ru
, if possible.
lookupConc :: ConcIdx -> Rule i -> Maybe LNFactSource
lookupConc i ru
returns the i
-th conclusion of rule ru
, if possible.
Genereal protocol and intruder rules
Rule information for protocol and intruder rules.
HasRuleName RuleACInst | |
HasRuleName RuleAC | |
(Eq p, Eq i) => Eq (RuleInfo p i) | |
(Ord p, Ord i) => Ord (RuleInfo p i) | |
(Show p, Show i) => Show (RuleInfo p i) | |
(Binary p_1627483252, Binary i_1627483253) => Binary (RuleInfo p_1627483252 i_1627483253) | |
(NFData p_1627483252, NFData i_1627483253) => NFData (RuleInfo p_1627483252 i_1627483253) | |
(Apply p, Apply i) => Apply (RuleInfo p i) | |
(HasFrees p, HasFrees i) => HasFrees (RuleInfo p i) |
ruleInfo :: (p -> c) -> (i -> c) -> RuleInfo p i -> cSource
ruleInfo proto intr
maps the protocol information with proto
and the
intruder information with intr
.
Protocol Rule Information
data ProtoRuleName Source
A name of a protocol rule is either one of the special reserved rules or some standard rule.
data ProtoRuleACInfo Source
Information for protocol rules modulo AC. The variants list the possible instantiations of the free variables of the rule. The typing is interpreted modulo AC; i.e., its variants were also built.
pracName :: forall arr. Arrow arr => Lens arr ProtoRuleACInfo ProtoRuleNameSource
pracVariants :: forall arr. Arrow arr => Lens arr ProtoRuleACInfo (Disj LNSubstVFresh)Source
pracLoopBreakers :: forall arr. Arrow arr => Lens arr ProtoRuleACInfo [PremIdx]Source
data ProtoRuleACInstInfo Source
Information for instances of protocol rules modulo AC.
praciName :: forall arr. Arrow arr => Lens arr ProtoRuleACInstInfo ProtoRuleNameSource
praciLoopBreakers :: forall arr. Arrow arr => Lens arr ProtoRuleACInstInfo [PremIdx]Source
type RuleACConstrs = Disj LNSubstVFreshSource
Intruder Rule Information
data IntrRuleACInfo Source
An intruder rule modulo AC is described by its name.
Concrete Rules
type ProtoRuleE = Rule ProtoRuleNameSource
A rule modulo E is always a protocol rule. Intruder rules are specified abstractly by their operations generating them and are only available once their variants are built.
type ProtoRuleAC = Rule ProtoRuleACInfoSource
A protocol rule modulo AC.
type IntrRuleAC = Rule IntrRuleACInfoSource
An intruder rule modulo AC.
type RuleAC = Rule (RuleInfo ProtoRuleACInfo IntrRuleACInfo)Source
A rule modulo AC is either a protocol rule or an intruder rule
type RuleACInst = Rule (RuleInfo ProtoRuleACInstInfo IntrRuleACInfo)Source
A rule instance module AC is either a protocol rule or an intruder rule. The info identifies the corresponding rule modulo AC that the instance was derived from.
Queries
class HasRuleName t whereSource
Types that have an associated name.
isIntruderRule :: HasRuleName r => r -> BoolSource
True iff the rule is an intruder rule
isDestrRule :: HasRuleName r => r -> BoolSource
True iff the rule is a destruction rule.
isConstrRule :: HasRuleName r => r -> BoolSource
True iff the rule is a construction rule.
isFreshRule :: HasRuleName r => r -> BoolSource
True iff the rule is the special fresh rule.
isIRecvRule :: HasRuleName r => r -> BoolSource
True iff the rule is the special learn rule.
isISendRule :: HasRuleName r => r -> BoolSource
True iff the rule is the special knows rule.
isCoerceRule :: HasRuleName r => r -> BoolSource
True iff the rule is the special coerce rule.
nfRule :: Rule i -> WithMaude BoolSource
True if the messages in premises and conclusions are in normal form
isTrivialProtoVariantAC :: ProtoRuleAC -> ProtoRuleE -> BoolSource
True if the protocol rule has only the trivial variant.
Conversion
ruleACToIntrRuleAC :: RuleAC -> Maybe IntrRuleACSource
Converts between these two types of rules, if possible.
ruleACIntrToRuleAC :: IntrRuleAC -> RuleACSource
Converts between these two types of rules.
ruleACIntrToRuleACInst :: IntrRuleAC -> RuleACInstSource
Converts between these two types of rules.
Construction
someRuleACInst :: MonadFresh m => RuleAC -> m (RuleACInst, Maybe RuleACConstrs)Source
Compute some rule instance of a rule modulo AC. If the rule is a protocol rule, then the given typing and variants also need to be handled.
Unification
unifyRuleACInstEqs :: [Equal RuleACInst] -> WithMaude [LNSubstVFresh]Source
Unify a list of RuleACInst
equalities.
unifiableRuleACInsts :: RuleACInst -> RuleACInst -> WithMaude BoolSource
Are these two rule instances unifiable.
Pretty-Printing
reservedRuleNames :: [String]Source
List of all reserved rule names.
showRuleCaseName :: HasRuleName (Rule i) => Rule i -> StringSource
Pretty print the rule name such that it can be used as a case name
prettyProtoRuleName :: Document d => ProtoRuleName -> dSource
prettyRuleName :: (HighlightDocument d, HasRuleName (Rule i)) => Rule i -> dSource
prettyProtoRuleE :: HighlightDocument d => ProtoRuleE -> dSource
prettyProtoRuleAC :: HighlightDocument d => ProtoRuleAC -> dSource
prettyIntrRuleAC :: HighlightDocument d => IntrRuleAC -> dSource
prettyIntrRuleACInfo :: Document d => IntrRuleACInfo -> dSource
prettyRuleAC :: HighlightDocument d => RuleAC -> dSource
prettyLoopBreakers :: HighlightDocument d => ProtoRuleACInfo -> dSource
prettyRuleACInst :: HighlightDocument d => RuleACInst -> dSource