Skip to content

Commit 6784f9a

Browse files
committed
add tests for conseq equiv phoare
1 parent 5bc73e4 commit 6784f9a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/conseq_equiv_phoare.ec

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
require import Real Int.
2+
3+
module M = {
4+
var b: bool
5+
6+
proc run() = {
7+
M.b <- false;
8+
}
9+
}.
10+
11+
lemma dep_bound : phoare[M.run : M.b ==> !M.b] = (b2i M.b)%r.
12+
proof. by proc; auto => &hr ->. qed.
13+
14+
equiv triv_equiv : M.run ~ M.run : true ==> ={M.b}.
15+
proof. proc; auto. qed.
16+
17+
lemma bad_bound : phoare[M.run : true ==> !M.b] = (b2i M.b)%r.
18+
proof.
19+
conseq triv_equiv dep_bound => //=.
20+
move => &1.
21+
fail smt().
22+
abort.
23+
24+
lemma dep_bound_conseq :
25+
phoare[M.run : !M.b ==> !M.b] = (1-b2i M.b)%r.
26+
proof.
27+
conseq triv_equiv dep_bound => //=.
28+
move => &1 -> /=.
29+
by exists true => />.
30+
qed.
31+
32+
lemma nodep_bound : phoare[M.run: true ==> true] = 1%r.
33+
proof. proc; auto. qed.
34+
35+
lemma nodep_bound_conseq :
36+
phoare[M.run : !M.b ==> !M.b] = 1%r.
37+
proof.
38+
conseq triv_equiv dep_bound => //=.
39+
move => &1 /> _.
40+
by exists true.
41+
qed.
42+

0 commit comments

Comments
 (0)