Skip to content

Commit a0bf172

Browse files
bgregoirstrub
authored andcommitted
fix alpha-conversion problems in ehoare
1 parent 1034006 commit a0bf172

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/phl/ecPhlApp.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ let t_hoare_app_r i phi tc =
2626
let t_hoare_app = FApi.t_low2 "hoare-app" t_hoare_app_r
2727

2828
(* -------------------------------------------------------------------- *)
29-
let t_ehoare_app_r i f tc =
29+
let t_ehoare_app_r i phi tc =
3030
let env = FApi.tc1_env tc in
3131
let hs = tc1_as_ehoareS tc in
3232
let s1, s2 = s_split env i hs.ehs_s in
33-
let a = f_eHoareS (snd hs.ehs_m) (ehs_pr hs) (stmt s1) f in
34-
let b = f_eHoareS (snd hs.ehs_m) f (stmt s2) (ehs_po hs) in
33+
let phi = ss_inv_rebind phi (fst hs.ehs_m) in
34+
let a = f_eHoareS (snd hs.ehs_m) (ehs_pr hs) (stmt s1) phi in
35+
let b = f_eHoareS (snd hs.ehs_m) phi (stmt s2) (ehs_po hs) in
3536
FApi.xmutate1 tc `HlApp [a; b]
3637

3738
let t_ehoare_app = FApi.t_low2 "hoare-app" t_ehoare_app_r

src/phl/ecPhlConseq.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ let t_bdHoareS_conseq_nm = gen_conseq_nm t_bdHoareS_notmod t_bdHoareS_conseq
453453
let t_ehoareF_concave (fc: ss_inv) pre post tc =
454454
let env = FApi.tc1_env tc in
455455
let hf = tc1_as_ehoareF tc in
456+
let pre = ss_inv_rebind pre hf.ehf_m in
457+
let post = ss_inv_rebind post hf.ehf_m in
458+
let fc = ss_inv_rebind fc hf.ehf_m in
456459
let f = hf.ehf_f in
457460
let mpr,mpo = Fun.hoareF_memenv hf.ehf_m f env in
458461
let fsig = (Fun.by_xpath f env).f_sig in
@@ -491,6 +494,9 @@ let t_ehoareS_concave (fc: ss_inv) (* xreal -> xreal *) pre post tc =
491494
let hs = tc1_as_ehoareS tc in
492495
let s = hs.ehs_s in
493496
let m = fst hs.ehs_m in
497+
let pre = ss_inv_rebind pre m in
498+
let post = ss_inv_rebind post m in
499+
let fc = ss_inv_rebind fc m in
494500
(* ensure that f only depend of notmod *)
495501
let modi = s_write env s in
496502
let fv = PV.fv env m fc.inv in

src/phl/ecPhlDeno.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ let t_phoare_deno_r pre post tc =
8686

8787
(* -------------------------------------------------------------------- *)
8888
let t_ehoare_deno_r pre post tc =
89-
assert (pre.m = post.m);
9089
let m = pre.m in
90+
assert (m = post.m);
9191
let env, _, concl = FApi.tc1_eflat tc in
9292

9393
let f, bd =
@@ -111,6 +111,7 @@ let t_ehoare_deno_r pre post tc =
111111

112112
(* forall m, ev%r%xr <= post *)
113113
let ev = pr.pr_event in
114+
let ev = ss_inv_rebind ev m in
114115
let concl_po = map_ss_inv2 f_xreal_le (map_ss_inv1 f_b2xr ev) post in
115116
let concl_po = f_forall_mems_ss_inv mpo concl_po in
116117

0 commit comments

Comments
 (0)