Skip to content

Commit c8e119e

Browse files
bgregoirstrub
authored andcommitted
Fix implementation of async-while
Add missing side-conditions to the rule implementation.
1 parent 1393a49 commit c8e119e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/phl/ecPhlWhile.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ let process_async_while (winfos : EP.async_while_info) tc =
640640
let modir = s_write env cr in
641641
let post = generalize_mod env mr modir post in
642642
let post = generalize_mod env ml modil post in
643-
f_equivS_r { evs with es_sl = sl; es_sr = sr; es_po = post; } in
643+
f_equivS_r { evs with es_sl = sl; es_sr = sr; es_po = f_and inv post; } in
644644

645645
FApi.t_onfsub (function
646646
| 6 -> Some (EcLowGoal.t_intros_n c1)

theories/looping/LoopTransform.ec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ declare module B <:AdvLoop.
130130
equiv loop1_loopk : Loop(B).loop1 ~ Loop(B).loopk :
131131
={t, glob B} /\ n{1} = (k * n){2} /\ 0 < k{2} ==> ={res, glob B}.
132132
proof.
133-
proc.
133+
proc => /=.
134+
case: (n{2} < 0).
135+
+ rcondf{1} ^while; 1: by auto => /> /#.
136+
by rcondf{2} ^while; auto => /> /#.
134137
async while [ (fun r => i%r < r), (i{1}+k{2})%r ]
135138
[ (fun r => i%r < r), (i{2} + 1)%r ]
136139
( (i < n){1})
@@ -151,7 +154,7 @@ proof.
151154
by wp;skip => /> /#.
152155
+ rcondf 1; skip => /#.
153156
+ rcondf 1; skip => /#.
154-
by auto.
157+
auto => /> /#.
155158
qed.
156159

157160
equiv loopk_loopc : Loop(B).loopk ~ Loop(B).loopc : ={n,t, glob B} /\ k{1} = c ==> ={res, glob B}.

0 commit comments

Comments
 (0)