Skip to content

Lemma related to set "in" not always applied #1725

@denis-bogdanas

Description

@denis-bogdanas

Not necessary for ERC20 verifier, small workaround works.

module ISSUE
  imports COLLECTIONS
  imports STRING

  configuration <k> $PGM:KItem </k>
                <theSet> .Set </theSet>

    syntax KItem ::= #checkArg ( String )
                   | "#included"
                   | "#notIncluded"

    rule <k> #checkArg(ARG) => #included ...</k>
         <theSet> S </theSet>
      requires ARG in S

    rule <k> #checkArg(ARG) => #notIncluded ...</k>
         <theSet> S </theSet>
      requires notBool ARG in S

    rule X in ((SetItem(A) REST:Set) #as S) => X ==K A orBool X in REST                    [simplification, symbolic(S)]
endmodule
module NOTINCLUDEDSET-SPEC
  imports ISSUE

  rule <k> #checkArg("foo") => #notIncluded </k>
       <theSet> SetItem(A:KItem) </theSet>
    requires A =/=K "foo"
endmodule

Result:

  #Not ( {
    A
  #Equals
    "foo"
  } )
#And
  <generatedTop>
    <k>
      #included
    </k>
    <theSet>
      SetItem ( A )
    </theSet>
  </generatedTop>
#And
  {
    "foo" in SetItem ( A )
  #Equals
    true
  }

Positive specs works:

module INCLUDEDSET-SPEC
  imports ISSUE

  rule <k> #checkArg("foo") => #included </k>
       <theSet> SetItem("foo") SetItem(A:KItem) </theSet>
    requires A =/=K "foo"
endmodule

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions