Skip to content

Apply claim LHS substitution to RHS after simplification #2740

@virgil-serbanuta

Description

@virgil-serbanuta

Tested with commit 07c0fc8

The final configuration on one of the two proof branches contains this (the other branch fails in a similar way):

  #Not ( {
    empty
  #Equals
    copy ( empty , I )
  } )
...
#And
  {
    true
  #Equals
    I >Int 0
  }

The semantics has a rule for evaluating copy that should make this branch succeed:

  rule  copy(empty, I:Int) => empty
    requires I >Int 0

and the side condition contains true #Equals I >Int 0 since the start configuration, however, that rule is not applied. After staring at the function evaluation logs for a while, I think it's because the side condition is not used when attempting to apply the rule above.

To reproduce:

tmp.k

module TMP
  imports INT
  imports K-EQUAL

  syntax IntList  ::= "empty" | concat(Int, IntList)

  syntax IntList ::= copy(IntList, Int)  [function, functional]

  rule  copy(empty, I:Int) => empty
    requires I >Int 0
  rule  copy(concat(E:Int, Es:IntList), I:Int) => concat(E, copy(Es, I -Int 1))
    requires I >Int 0
  rule  copy(Es:IntList, _:Int) => Es
    [owise]

  syntax KItem ::= iterateList(IntList, Int)

  rule  iterateList(empty, _:Int) => .K  [label(i1)]
  rule  iterateList(concat(_:Int, L:IntList), A:Int) => iterateList(L, A)  [label(i2)]

endmodule

tmp-proof.k

module TMP-PROOF
  imports TMP

  claim iterateList(Es, I) => .K
    requires I >Int 0
    ensures copy(Es:IntList, I:Int) ==K Es

endmodule

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions