Commit 190208ef authored by acholewa's avatar acholewa

Initial commit to the public repository. Contains all the files needed to run...

Initial commit to the public repository. Contains all the files needed to run Maude-PSL, as well as an examples directory, and a directory of the original npa-examples for use of comparisions with the Maude-PSL examples. Also contains a pdf file containing a description of the language.
parents
---(
Changes made by Andrew Cholewa Wed Oct 30:
Removed the {_} : Module -> ParsedData operator and made Module a subsort of
ParsedData to match FModule, and so that it doesn't clash with the wrapper
being used in parsePSL to put modules in Data.
Commented out the error Sort and constant around line 520 in the module
GEN-MOD in order to avoid clashes with the error in parsePSL. Plus, error
checking at this point should not be necessary.
Changed the System sort to System to avoid clashes with the System imported from
prelude and used in the psl-loop module for the user input.
Added a rule for processing the attack states to handle the case where there is
an empty never pattern.
---)
---(About changing System to System: In order to avoid confusion and conflicting with Maude-NPA, we assume that we don't need to load our modules together with Maude-NPA. --Fan
---)
fmod DEFINITION-PROTOCOL-RULES is
protecting META-LEVEL .
sort Universal . --- Special sort used for unsorted actions (don't remove)
sort Msg . --- Generic sort for messages
sort Fresh . --- Sort for private information.
sort Public . --- Handy sort to say what is public
subsort Public < Msg .
op emptyPublic : -> Public .
op nullFresh : -> Fresh .
op pair : Msg Msg -> Msg [frozen] . --- Special treatment for indistinguishability
sort MsgSet .
subsort Msg < MsgSet .
op emptyMsgSet : -> MsgSet [ctor] .
op _,_ : MsgSet MsgSet -> MsgSet [ctor assoc comm id: emptyMsgSet] .
op noMsg : -> Msg . --- Auxiliar useless message used as a marker
sort SMsg .
sort SignedSMsg .
subsort SignedSMsg < SMsg .
op +`(_`) : Msg -> SignedSMsg [format (nir d d d o)] .
op -`(_`) : Msg -> SignedSMsg [format (nib d d d o)] .
sort Resuscitated .
subsort Resuscitated < SMsg .
op resuscitated`(_`) : Msg -> Resuscitated [ctor format (nic d d d o)] .
sort LazyLearnt .
subsort LazyLearnt < SMsg .
op generatedByIntruder`(_`) : Msg -> LazyLearnt [ctor format (nic d d d o)] .
sort EmptyList .
op nil : -> EmptyList [ctor format (ni d)] .
op _,_ : EmptyList EmptyList -> EmptyList
[ctor assoc id: nil format (d d s d)] .
sort SMsgList .
subsort SMsg Synchro Resuscitated < SMsgList .
subsort EmptyList < SMsgList .
subsort ResuscitatedList < SMsgList .
op _,_ : SMsgList SMsgList -> SMsgList
[ctor assoc id: nil format (d d s d)] .
sort ResuscitatedList .
subsort Resuscitated < ResuscitatedList .
subsort EmptyList < ResuscitatedList .
op _,_ : ResuscitatedList ResuscitatedList -> ResuscitatedList
[ctor assoc id: nil format (d d s d)] .
--- We duplicate the SMsgList sort because A-unification may generate
--- an infinite number of most-general unifiers.
sort SMsgList-L SMsgList-R .
op nil : -> SMsgList-R [ctor] .
op _,_ : SMsg SMsgList-R -> SMsgList-R
[ctor format (d d s d) gather (e E)] .
op _,_ : Synchro SMsgList-R -> SMsgList-R
[ctor format (d d s d) gather (e E)] .
op nil : -> SMsgList-L [ctor] .
op _,_ : SMsgList-L SMsg -> SMsgList-L
[ctor format (d d s d) gather (E e)] .
op _,_ : SMsgList-L Synchro -> SMsgList-L
[ctor format (d d s d) gather (E e)] .
--- Composition
sort Synchro .
op {_->_;;_;;_} : Role Role How Msg -> Synchro [format (nig d d d d d d d d o)] .
sort Role .
op initiator : -> Role .
op responder : -> Role .
sort How .
op 1-1 : -> How .
op 1-* : -> How .
--- Strands
sort FreshSet .
subsort Fresh < FreshSet .
op nil : -> FreshSet [ctor] .
op _,_ : FreshSet FreshSet -> FreshSet
[ctor comm assoc id: nil] .
sort Strand .
op ::_::[_|_] : FreshSet SMsgList-L SMsgList-R -> Strand
[format (ni d d ni s+++ s--- s+++ d s---)] .
sort StrandSet .
subsort Strand < StrandSet .
op empty : -> StrandSet [ctor] .
op _&_ : StrandSet StrandSet -> StrandSet
[ctor assoc comm id: empty format (d d d d)] .
sort Knowledge-!inI Knowledge-inI Knowledge-!= Knowledge
Knowledge-irr Knowledge-inst Knowledge-CPSA .
subsort Knowledge-!inI Knowledge-inI Knowledge-!=
Knowledge-irr Knowledge-inst Knowledge-CPSA < Knowledge .
op _!inI : Msg -> Knowledge-!inI [format (ni d o)] .
op _inI : Msg -> Knowledge-inI [format (niu d o)] .
---prec 26 added by Andrew Cholewa to ensure Maude parses != correctly in
---Maude-PSL 10/27/14
op _!=_ : Msg Msg -> Knowledge-!= [comm format (nig d d o) prec 26] .
op irr`(_`) : Msg -> Knowledge-irr [format (nim d d d o)] .
op inst`(_`) : Msg -> Knowledge-inst [format (nim d d d o)] .
op _before_ : MsgInStrand MsgInStrand -> Knowledge-CPSA [format (nim d d o)] .
op secret`(_`) : Msg -> Knowledge-CPSA [format (nim d d d o)] .
sort MsgInStrand PosNat .
op `(_InStrand_`) : PosNat Fresh -> MsgInStrand .
ops 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th : -> PosNat .
op z : -> PosNat .
op s : PosNat -> PosNat [iter] .
sort Ghost .
op ghost`(_`,_`,_`,_`,_`) : Msg StrandSet IntruderKnowledge SMsgList Properties
-> Ghost
[frozen format (ni d s+++ d d d si d si d si s--- d)] .
sort GhostList .
subsort Ghost < GhostList .
op nil : -> GhostList [ctor format (ni d)] .
op _,_ : GhostList GhostList -> GhostList
[ctor assoc id: nil format (d d n d)] .
sort IntruderKnowledge-!inI IntruderKnowledge-inI
IntruderKnowledge-!= IntruderKnowledgeElem IntruderKnowledge
IntruderKnowledge-irr IntruderKnowledge-inst IntruderKnowledge-CPSA
IntruderKnowledge-empty .
subsort IntruderKnowledge-empty < IntruderKnowledge-!inI .
subsort IntruderKnowledge-empty < IntruderKnowledge-inI .
subsort IntruderKnowledge-empty < IntruderKnowledge-!= .
subsort IntruderKnowledge-empty < IntruderKnowledge-irr .
subsort IntruderKnowledge-empty < IntruderKnowledge-inst .
subsort IntruderKnowledge-empty < IntruderKnowledge-CPSA .
subsort IntruderKnowledge-empty < IntruderKnowledge .
subsort IntruderKnowledge-!inI IntruderKnowledge-inI
IntruderKnowledge-!=
IntruderKnowledge-irr
IntruderKnowledge-inst
IntruderKnowledge-CPSA
< IntruderKnowledge .
subsort Knowledge-!inI < IntruderKnowledge-!inI .
subsort Knowledge-inI < IntruderKnowledge-inI .
subsort Knowledge-!= < IntruderKnowledge-!= .
subsort Knowledge-irr < IntruderKnowledge-irr .
subsort Knowledge-inst < IntruderKnowledge-inst .
subsort Knowledge-CPSA < IntruderKnowledge-CPSA .
subsort Knowledge < IntruderKnowledgeElem < IntruderKnowledge .
op empty : -> IntruderKnowledge-empty [ctor] .
op _,_ : IntruderKnowledge IntruderKnowledge -> IntruderKnowledge
[ctor assoc comm id: empty format (d d d d) prec 28] .
op _,_ : IntruderKnowledge-!inI IntruderKnowledge-!inI
-> IntruderKnowledge-!inI [ditto] .
op _,_ : IntruderKnowledge-inI IntruderKnowledge-inI
-> IntruderKnowledge-inI [ditto] .
op _,_ : IntruderKnowledge-!= IntruderKnowledge-!=
-> IntruderKnowledge-!= [ditto] .
op _,_ : IntruderKnowledge-irr IntruderKnowledge-irr
-> IntruderKnowledge-irr [ditto] .
op _,_ : IntruderKnowledge-inst IntruderKnowledge-inst
-> IntruderKnowledge-inst [ditto] .
op _,_ : IntruderKnowledge-CPSA IntruderKnowledge-CPSA
-> IntruderKnowledge-CPSA [ditto] .
op _,_ : IntruderKnowledge-empty IntruderKnowledge-empty
-> IntruderKnowledge-empty [ditto] .
sort Properties .
op nil : -> Properties [ctor format (ni d)] .
sort System .
************************
--- Stuff for never patterns
sort ExclusionPattern .
subsort ExclusionPattern < Properties .
--- neverPattern as StrandSet + IntruderKnowledge
sort NeverPattern .
sort NeverPatternSet .
subsort NeverPattern < NeverPatternSet .
op _||_ : StrandSet IntruderKnowledge -> NeverPattern .
op nil : -> NeverPatternSet .
op __ : NeverPatternSet NeverPatternSet -> NeverPatternSet
[ctor assoc comm id: nil format (d n d)] .
op never : NeverPatternSet -> ExclusionPattern .
************************
op _||_||_||_||_
: StrandSet IntruderKnowledge SMsgList GhostList Properties -> System
[format (d n d n d n d n d d)] .
--- Auxiliary sorts for comparing strands in _implies_ function
sort SMsgSet .
subsort SMsg < SMsgSet .
op emptySMsgSet : -> SMsgSet [ctor] .
op _;_ : SMsgSet SMsgSet -> SMsgSet
[ctor assoc comm id: emptySMsgSet] .
sort SMsgList$ .
subsort SMsgList < SMsgList$ .
subsort SMsgSet < SMsgList$ .
subsort Synchro < SMsgList$ .
op _,_ : SMsgList$ SMsgList$ -> SMsgList$ [ditto] . --- assoc
sort SMsgList-L$ SMsgList-R$ .
subsort SMsgList-L < SMsgList-L$ .
subsort SMsgList-R < SMsgList-R$ .
op _,_ : SMsgSet SMsgList-R$ -> SMsgList-R$ [ditto] .
op _,_ : Synchro SMsgList-R$ -> SMsgList-R$ [ditto] .
op _,_ : SMsgList-L$ SMsgSet -> SMsgList-L$ [ditto] .
op _,_ : SMsgList-L$ Synchro -> SMsgList-L$ [ditto] .
sort Strand$ .
subsort Strand < Strand$ .
op ::_::[_|_] : FreshSet SMsgList-L$ SMsgList-R$ -> Strand$ [ditto] .
sort StrandSet$ .
subsort Strand$ < StrandSet$ .
subsort StrandSet < StrandSet$ .
op _&_ : StrandSet$ StrandSet$ -> StrandSet$ [ditto] .
*** System$ ********************************************
sort System$ .
subsort System < System$ .
op _||_||_||_||_
: StrandSet$ IntruderKnowledge SMsgList GhostList Properties
-> System$ [ditto] .
subsort SMsgSet < SMsgList .
op _,_ : SMsgSet SMsgList-R -> SMsgList-R [ditto] .
op _,_ : SMsgList-L SMsgSet -> SMsgList-L [ditto] .
sort Attack .
subsort SystemSet < Attack .
sort SystemSet .
subsort System < SystemSet .
op empty : -> SystemSet .
op __ : SystemSet SystemSet -> SystemSet
[ctor assoc comm id: empty format (d n d)] .
op STRANDS-DOLEVYAO : -> StrandSet .
op STRANDS-PROTOCOL : -> StrandSet .
op ATTACK-STATE : Nat -> Attack .
endfm
---(
The following modules contain the operators and axioms for the data structures
used in the translation from Maude-PSL to Maud-NPA specifications. Anything
prefixed by a '$' is considered "internal," and shouldn't be used outside
of the associated SEMANTICS module in psl.maude.
The translation rules can be found in psl.maude.
Note: Because of the ambiguity in Maude's multi-line syntax, I use [] instead of parenthesis inside of multi-line comments.
---)
load NPA-Syntax.maude .
---load nspk.maude
---(
Contains the high level data structures used to store the PSL-specification
and the derived strands. This is the core of Omega from
Andrew Cholewa's masters thesis.
---)
fmod TRANSLATION-SYNTAX is
protecting DEFINITION-PROTOCOL-RULES .
protecting PROTOCOL-EXAMPLE-SYMBOLS .
protecting NAT .
---Terms of sort TranslationData are ACU soups. The soup contains the
---Maude-PSL specification, and all of the data structures used in the
---translation. Bracket operators ([_]) are used to inject various sorts
---into TranslationData.
sort TranslationData .
op mt : -> TranslationData .
op __ : TranslationData TranslationData ->
TranslationData [assoc comm id: mt format(n n o)] .
sort MyNatList .
subsort Nat < MyNatList .
op mt : -> MyNatList .
op _:_ : Nat Nat -> MyNatList [assoc id: mt] .
---StrandData and its singular form StrandDatum are mappings from
---a role a to the role's associated input, strand, and output. Terms
---of this form are built from the Protocol section, and are used to
---populate the attack states.
sort StrandDatum StrandData .
subsort StrandDatum < StrandData .
op mt : -> StrandData [ctor] .
op _&_ : StrandData StrandData -> StrandData [assoc comm id: mt format(d d n d)] .
op [_] : StrandData -> TranslationData .
---(
A mapping from roles to strands.
Arguments:
1. The role to whom this strand and belongs
2. The role's input.
3. The role's strand.
4. The role's output
---)
op _|->{_}_{_} : Role MsgSet Strand MsgSet -> StrandDatum [ctor prec 30] .
endfm
---(
Contains the syntax for the sections Protocol, Intruder and Attacks.
Note that we group them within a larger Specification section in the
Maude code. This is an artifact of an earlier iteration of the
Maude-PSL syntax.
---)
fmod SECTION-SYNTAX is
protecting TRANSLATION-SYNTAX .
*************************Section*********************************
sort Section SubSection SectionName Stmt Stmts .
subsort Section < TranslationData .
subsort Stmt < Stmts .
op pass : -> Stmts [ctor] .
---These are any statements that may appear in a Maude-PSL specification.
---Each section will have its own subsort of Stmts for the statements
---that appear in that section.
op __ : Stmts Stmts -> Stmts [assoc id: pass format(n n o) prec 55] .
ops Protocol Intruder Attacks : -> SectionName .
sorts ProtocolSection IntruderSection AttackSection .
subsorts ProtocolSection IntruderSection AttackSection < SubSection .
op mt : -> SubSection .
op Protocol{} : -> SubSection .
op Intruder{} : -> SubSection .
op Attacks{} : -> SubSection .
eq Protocol{} = Protocol{ pass } .
eq Intruder{} = Intruder{ pass } .
eq Attacks{} = Attacks{ pass } .
---(
Subsections are treated as free floating entities within the larger
Specification Section.
---)
op __ : SubSection SubSection -> SubSection
[ctor assoc comm id: mt format(d n o)] .
op Specification{_} : SubSection -> Section [ctor format(d d n o d)] .
op _{_} : SectionName Stmts -> SubSection [prec 30 format(d o ntt nt o)] .
endfm
fmod DEFINITION-SYNTAX is
protecting TRANSLATION-SYNTAX .
sort Definition NeDefinitions Definitions .
subsort Definition < NeDefinitions < Definitions .
op _:=_ : Msg Msg -> Definition [prec 30] .
op _,_ : Definitions Definitions -> Definitions [ctor comm assoc id: $noDefs] .
op _,_ : NeDefinitions NeDefinitions -> NeDefinitions [ctor ditto] .
op $noDefs : -> Definitions .
---(
The following two functions make the definitions map idempotent. Basically, if we have:
da |-> t
dp |-> f[da]
Then these functions will turn the above into
da |-> t
dp |-> f[t]
If after Nat iterations we fail to compute an idempotent substitution, then we throw an error.
---)
op $makeIdem : Definitions -> Definitions .
---(
Args:
1. Definition after n-1 applications of the other Defs.
2. Definition after n applications of the other Defs. [If these two are equal, that Def has been fully simplified]
3. The Definitions that have not yet been fully simplified.
4. The original definition
5. Our current Iteration.
---)
op $makeIdem : Definition Definition Definitions Definition Nat -> Definitions .
op [_] : Definitions -> TranslationData .
op numIterations : -> Nat .
op $cantMakeDefsIdempotent : Definitions Nat -> [Definitions] .
---(
This structure is used to pair definitions with line numbers for any preliminary error checking that needs to be done on
user-defined terms that don't come up while parsing the terms, or in the Python error checking. For example:
key := (A, B, n(B, r1)) does not throw an error anywhere, however it lifts TranslationData into the kind. We need to be able
recognize these kinds of problems and report them.
---)
sort ShorthandLineNum .
subsort ShorthandLineNum < Msg .
op ((_,_)) : Msg Nat -> ShorthandLineNum .
---(
If a malformed definition term provided by the user lifts the definitions (and the entire specification) to the kind, then
this function will generate an error term for Python to process.
If the definitions are well formed, we just strip away the line number and start translating. Otherwise, we eliminate those
definitions that are well-formed, and report the rest.
---)
op $$$malformedDefs : [Definitions] -> [Definitions] .
op $checkWellFormed : [Definitions] -> [Definitions] .
op $checkWellFormed : Definitions -> Definitions .
---(
Given a multiset of (malformed) definitions of the form
(shorthand, lineNum) := result
converts the list into a list of terms of the form
(shorthand := result$$,$$ lineNum)
in order to simplify error processing by python.
---)
op ((_$$,$$_)) : [Definition] Nat -> [Definition] .
op _$$;;;$$_ : [Definition] [Definition] -> [Definitions] [assoc id: $noDefs] .
op $moveLineNum : [Definitions] -> [Definitions] .
endfm
fmod PROTOCOL-SYNTAX is
protecting TRANSLATION-SYNTAX .
protecting SECTION-SYNTAX .
protecting DEFINITION-SYNTAX .
sort ProtStmt ProtStmts .
subsort ProtStmt < Stmt .
subsort ProtStmt < ProtStmts < Stmts .
op $emptyProtocol : -> ProtocolSection .
---Associative with identity pass.
op __ : ProtStmts ProtStmts -> ProtStmts [ctor ditto] .
---The natural number at the end of each statement is the line number
---on which the statement begins in the original PSL specification.
---This number is used when reporting translation errors to the user.
op In`(_`) = _.[_] : Role MsgSet Nat -> ProtStmt .
op Out`(_`) = _.[_] : Role MsgSet Nat -> ProtStmt .
op _._->_:_|-_.[_] : Nat Role Role Msg Msg Nat -> ProtStmt [prec 30] .
endfm
fmod INTRUDER-SYNTAX is
protecting TRANSLATION-SYNTAX .
protecting SECTION-SYNTAX .
protecting DEFINITION-SYNTAX .
sort IntStmt IntStmts .
subsort IntStmt < Stmt .
subsort IntStmt < IntStmts < Stmts .
---StrandSet is declared in the Maude-NPA syntax (NPA-Syntax.maude), and
---is used as the target of the Intruder translation.
op [_] : StrandSet -> TranslationData [ctor] .
op $emptyIntruder : -> IntruderSection .
op __ : IntStmts IntStmts -> IntStmts [ctor ditto] .
op _=>_.[_] : MsgSet MsgSet Nat -> IntStmt [prec 50] .
op _=>_.[_] : MsgSet Msg Nat -> IntStmt [prec 50] .
op =>_.[_] : MsgSet Nat -> IntStmt [prec 50] .
op _<=>_.[_] : MsgSet MsgSet Nat -> IntStmts [prec 50] .
endfm
---(
Mappings are used both in the Attack Section, and when composing
protocols, hence its separation into its own module.
---)
fmod MAPPINGS is
protecting TRANSLATION-SYNTAX .
sorts Mapping Mappings .
subsort Mapping < Mappings .
op id : -> Mappings [ctor] .
op _|->_ : Msg Msg -> Mapping [ctor prec 20] .
op _,_ : Mappings Mappings -> Mappings [ctor assoc comm id: id prec 25] .
endfm
fmod ATTACK-SYNTAX is
protecting TRANSLATION-SYNTAX .
protecting SECTION-SYNTAX .
protecting PROTOCOL-SYNTAX .
protecting DEFINITION-PROTOCOL-RULES .
protecting MAPPINGS .
---The following code allows us to simulate Maude style variable
---declarations. We need to be able to add a variable of sort StrandSet,
---and one of sort IntruderKnowledge to the attack states. However,
---we can't just declare a constant S:StrandSet, because that's ambiguous.
---Neither can we just insert a variable, because then Maude complains
---that the variable is unbound.
---So instead we need to have two constants S, and K and a simulation
---of variable declarations which can be added to the Maude module
---at the end.
sort NPA-Sort VarDecl .
ops StrandSet IntruderKnowledge SMsgList-R : -> NPA-Sort .
op S : -> StrandSet .
op K : -> IntruderKnowledge .
op LIST : -> SMsgList-R .
op var_:_. : StrandSet NPA-Sort -> VarDecl .
op var_:_. : IntruderKnowledge NPA-Sort -> VarDecl .
op var_:_. : SMsgList-R NPA-Sort -> VarDecl .
op [_] : VarDecl -> TranslationData .
op $emptyAttacks : -> AttackSection .
op $emptyAttackData : -> AttackData .
sort AttDef AttDefs .
subsort AttDef < AttDefs < Stmts .
subsort AttDef < Stmt .
op __ : AttDefs AttDefs -> AttDefs [ctor ditto] .
---An AttDef is an attack pattern.
op _.{_} : Nat AttackPSL -> AttDef .
sorts AttStmt AttStmts .
subsort AttStmt < AttStmts .
op __ : AttStmts AttStmts -> AttStmts [ctor assoc] .
op emptyAttStmt : -> AttStmts [ctor] .
sort Subst .
op Subst`(_`) = _.[_] : Role Mappings Nat -> Subst [ctor prec 26] .
sort ExecStatement .
op _executes protocol .[_] : Role Nat -> ExecStatement [ctor prec 28] .
op _executes up to_.[_] : Role Nat Nat -> ExecStatement [ctor prec 28] .
sort Disequality Disequalities Constraints .
subsort Disequality < Disequalities .
---Observe that this isn't exactly the same as !=. This is to avoid clashes
---with the operator defined in NPA-Syntax, whose connected component isn't
---compatible with Disequalities'. However, the Python code will convert
---the != seen in PSL specifications into $!= before it ever reaches
---the Maude code.
op _$!=_ : Msg Msg -> Disequality [ctor prec 26] .
op $noIneq : -> Disequalities .
op _,_ : Disequalities Disequalities -> Disequalities [ctor assoc comm id: $noIneq] .
op $noConstraints : -> Constraints [ctor] .
op With constraints_.[_] : Disequalities Nat -> Constraints [prec 31] .
sort IntruderKnowledgeStmt .
op Intruder learns_.[_] : MsgSet Nat -> IntruderKnowledgeStmt .
sorts CoreAttack .
subsort ExecStatement Subst Constraints IntruderKnowledgeStmt < CoreAttack .
op $noCore : -> CoreAttack .
op __ : CoreAttack CoreAttack -> CoreAttack [ctor assoc comm id: $noCore prec 33] .
sorts WithoutBlock WithoutBlocks .
subsort WithoutBlock < WithoutBlocks .
op __ : WithoutBlocks WithoutBlocks -> WithoutBlocks [ctor] .
op without:_ : CoreAttack -> WithoutBlock [ctor prec 35] .
sort AttackPSL .
subsort CoreAttack < AttackPSL .
op __ : CoreAttack WithoutBlocks -> AttackPSL [ctor] .
sort AttackData .
op __ : AttackData AttackData -> AttackData
[ctor comm assoc id: $emptyAttackData] .
op [_|->_] : Nat System -> AttackData .
op [_] : AttackData -> TranslationData .
op {_} : StrandSet -> TranslationData .
op {_} : IntruderKnowledge -> TranslationData .
---Error checking operators.
---Takes as argument the set of all pairs that form an invalid order-sorted
---substitution.
op $$$invalidSorting : MsgPairs -> [Mapping] .
---(
The following sorts and operators are used as part of checking that
a user-provided attack substitution is a valid order-sorted substitution
that can be idempotenized.
---)
sort MsgPair MsgPairs MsgNum MsgNumSet .
subsort MsgPair < MsgPairs .
subsort MsgNum < MsgNumSet .
---Ties a Msg m with a natural number n. m is meant to represent one
---of the messages in the range of an attack substitution. n is the
---line number in the PSL specification on which the attack was originally
---defined. The line number will be important when reporting error messages.
op ${_;_}$ : Msg Nat -> MsgNum [prec 28] .
op __ : MsgNumSet MsgNumSet -> MsgNumSet [ctor assoc comm prec 29] .
eq ${M:Msg ; N:Nat}$ ${M:Msg ; N:Nat}$ = ${M:Msg ; N:Nat}$ .
---This a msg m with a set of msg pairs p_1, p_2, ... p_n. m is meant
---to be a message in the domain of an attack substitution, while
---p_1, p_2, ..., p_n contain all of the messages that m maps to.
---In a well-defined substitution, n=1. However, in an invalid substitution
---there may be more than one. We need to be able to extract the invalid
---mappings as well as the lines on which they appear.
op _|->_ : Msg MsgNumSet -> MsgPair [prec 30] .
op $none : -> MsgPairs .
op __ : MsgPairs MsgPairs -> MsgPairs [ctor assoc comm id: $none] .
---Stores the information on an invalid substitution. The Python code
---invoking this Maude code then scans the output for the presence of
---this term. If the Python code finds this term, then it extracts the
---arguments and uses them to build a (hopefully) useful error message.
---Second argument is the list of line numbers on which the offending messages are defined.
op $$$notAFunction : MsgPairs -> [MsgPairs] .