Skip to content

Commit 83b8f23

Browse files
authored
Allow abstract phoare proc on >= 1 bounds and make postcondition side goal use implication (#887)
1 parent 3b85034 commit 83b8f23

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

src/phl/ecPhlFun.ml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ module FunAbsLow = struct
181181
PV.check_depend env fv top;
182182
let ospec o =
183183
check_oracle_use pf env top o;
184-
f_bdHoareF inv o inv FHeq {m=inv.m;inv=f_r1} in
184+
f_bdHoareF inv o inv FHge {m=inv.m;inv=f_r1} in
185185

186186
let sg = List.map ospec (OI.allowed oi) in
187187
(inv, inv, lossless_hyps env top f.x_sub :: sg)
@@ -259,19 +259,32 @@ let t_ehoareF_abs_r inv tc =
259259
FApi.t_last tactic (EcPhlConseq.t_ehoareF_conseq pre post tc)
260260

261261
(* ------------------------------------------------------------------ *)
262-
let t_bdhoareF_abs_r inv tc =
262+
let t_bdhoareF_abs_ge_r inv tc =
263263
let env = FApi.tc1_env tc in
264264
let bhf = tc1_as_bdhoareF tc in
265265

266266
match bhf.bhf_cmp with
267-
| FHeq when f_equal (bhf_bd bhf).inv f_r1 ->
267+
| FHge when f_equal (bhf_bd bhf).inv f_r1 ->
268268
let pre, post, sg =
269269
FunAbsLow.bdhoareF_abs_spec !!tc env bhf.bhf_f inv
270270
in
271271
let tactic tc = FApi.xmutate1 tc `FunAbs sg in
272272
FApi.t_last tactic (EcPhlConseq.t_bdHoareF_conseq pre post tc)
273273

274-
| _ -> tc_error !!tc "bound must of \"= 1\""
274+
| _ -> tc_error !!tc "bound must \">= 1%%r\""
275+
276+
let t_bdhoareF_abs_r inv tc =
277+
let bhf = tc1_as_bdhoareF tc in
278+
279+
match bhf.bhf_cmp with
280+
| FHeq when f_equal (bhf_bd bhf).inv f_r1 ->
281+
let tc = FApi.t_seqsub (EcPhlConseq.t_bdHoareF_conseq_bd FHge (bhf_bd bhf)) [EcLowGoal.t_close EcLowGoal.t_trivial; t_bdhoareF_abs_ge_r inv] tc in
282+
let pl_goal_count = FApi.tc_count tc - 3 in
283+
assert (pl_goal_count >= 0);
284+
FApi.t_lasts (EcPhlConseq.t_bdHoareF_conseq_bd FHeq (bhf_bd bhf) |- FApi.t_first (EcLowGoal.t_close EcLowGoal.t_trivial)) pl_goal_count tc
285+
| FHge when f_equal (bhf_bd bhf).inv f_r1 ->
286+
t_bdhoareF_abs_ge_r inv tc
287+
| _ -> tc_error !!tc "bound must \"= 1%%r\" or \">= 1%%r\""
275288

276289
(* ------------------------------------------------------------------ *)
277290
let t_equivF_abs_r inv tc =

0 commit comments

Comments
 (0)