Skip to content

in_keys() not evaluated even when it's present in term constraint #1948

@denis-bogdanas

Description

@denis-bogdanas

#lookupMemory implementation:

    syntax Int ::= #lookupMemory  ( Map , Int ) [function, functional, smtlib(lookupMemory)]

    rule [#lookupMemory.some]:   #lookupMemory( (KEY |-> VAL:Int) _M, KEY ) => VAL modInt 256
    rule [#lookupMemory.none]:   #lookupMemory(                    M, KEY ) => 0                 requires notBool KEY in_keys(M)
    //Impossible case, for completeness
    rule [#lookupMemory.notInt]: #lookupMemory( (KEY |-> VAL    ) _M, KEY ) => 0                 requires notBool isInt(VAL)

Test:

rule <k> runLemma ( #lookupMemory((KEY |-> 33), KEY') ) => doneLemma ( 0 ) ... </k> requires notBool KEY' in_keys(KEY |-> 33)

Result:

  #Not ( {
    #lookupMemory ( KEY |-> 33 , KEY' )
  #Equals
    0
  } )
#And
  #Not ( {
    KEY
  #Equals
    KEY':Int
  } )
#And
  <kevm>
    <k>
      doneLemma ( #lookupMemory ( KEY |-> 33 , KEY' ) ) ~> DotVar2 ~> .
    </k>
...

Code: https://github.com/kframework/evm-semantics/blob/6937f1ebf3645b962cc5e7d654a8f716a873c518/tests/specs/functional/lemmas-spec.k#L39

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions