Skip to content

Commit 56a3cb8

Browse files
committed
fixed matching - broken reduction
1 parent 9c05374 commit 56a3cb8

5 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/ecHiGoal.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ let process_done tc =
453453

454454
(* -------------------------------------------------------------------- *)
455455
let process_apply_bwd ~implicits mode (ff : ppterm) (tc : tcenv1) =
456-
let pt = PT.tc1_process_full_pterm ~implicits tc ff in
457456

457+
let pt = PT.tc1_process_full_pterm ~implicits tc ff in
458458
try
459459
match mode with
460460
| `Alpha ->

src/ecLowGoal.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,9 @@ type cstate = {
22902290
cs_sbeq : Sid.t;
22912291
}
22922292

2293+
let pp_tc1 tc =
2294+
pp_tc (FApi.tcenv_of_tcenv1 tc)
2295+
22932296
let t_debug ?(tag="") t tc =
22942297
Format.eprintf "Before (tag: %s):" tag;
22952298
pp_tc (FApi.tcenv_of_tcenv1 tc);

src/ecLowGoal.mli

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,9 @@ val t_debug :
358358
-> FApi.backward
359359
-> FApi.backward
360360
[@@ocaml.alert debug "Debug function, remove uses before merging"]
361+
362+
val pp_tc :tcenv -> unit
363+
[@@ocaml.alert debug "Debug function, remove uses before merging"]
364+
365+
val pp_tc1 :tcenv1 -> unit
366+
[@@ocaml.alert debug "Debug function, remove uses before merging"]

src/ecMatching.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,11 @@ let f_match_core opts hyps (ue, ev) f1 f2 =
677677
| FhoareF hf1, FhoareF hf2 -> begin
678678
if not (EcReduction.EqTest.for_xp env hf1.hf_f hf2.hf_f) then
679679
failure ();
680+
let subst =
681+
if id_equal hf1.hf_m hf2.hf_m
682+
then subst
683+
else Fsubst.f_bind_mem subst hf1.hf_m hf2.hf_m in
684+
assert (not (Mid.mem hf1.hf_m mxs) && not (Mid.mem hf2.hf_m mxs));
680685
let mxs = Mid.add hf1.hf_m hf2.hf_m mxs in
681686
List.iter2 (doit env (subst, mxs))
682687
[hf1.hf_pr; hf1.hf_po] [hf2.hf_pr; hf2.hf_po]

src/ecReduction.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,10 @@ let rec conv ri env f1 f2 stk =
14531453
conv_next ri env f1 stk
14541454

14551455
| FhoareF hf1, FhoareF hf2 when EqTest_i.for_xp env hf1.hf_f hf2.hf_f ->
1456-
conv ri env hf1.hf_pr hf2.hf_pr (zhl f1 [hf1.hf_po] [hf2.hf_po] stk)
1456+
let subst = if id_equal hf1.hf_m hf2.hf_m then Fsubst.f_subst_id
1457+
else Fsubst.f_bind_mem Fsubst.f_subst_id hf1.hf_m hf2.hf_m in
1458+
let subst = Fsubst.f_subst subst in
1459+
conv ri env hf1.hf_pr (subst hf2.hf_pr) (zhl f1 [hf1.hf_po] [subst hf2.hf_po] stk)
14571460

14581461
| FhoareS hs1, FhoareS hs2
14591462
when EqTest_i.for_stmt env hs1.hs_s hs2.hs_s ->

0 commit comments

Comments
 (0)