`wp_binop` is not very useful for comparing arbitrary values
Consider the following piece of code:
From iris.heap_lang Require Export proofmode notation.
Lemma wut `{heapG Σ} (v1 v2 : val) :
(WP if: (v1 = v2) then #0 else #0 {{ _, True }})%I.
Proof.
wp_binop.
Abort.
The goal that I expected after executing wp_binop
:
WP if: #(bool_decide (v1 = v2)) then #0 else #0 {{ _, True }}
Instead I got two goals:
bin_op_eval EqOp v1 v2 = Some ?Goal0
WP if: ?Goal0 then #0 else #0 {{ _, True }}
This is not very helpful, as it is pretty annoying to get a boolean value for ?Goal0.
I believe this is due to the way that bin_op_eval
is defined:
it first matches v1
and v2
for specific types of values (integers or booleans), and only then considers the case of generalized equality checks.
Since we have generalized/dynamic equality checks in heap_lang, why not first match on the type of the operation, and only then match on the values in bin_op_eval
?
Best -Dan