@@ -689,8 +689,8 @@ let f_match_core opts hyps (ue, ev) f1 f2 =
689689 subst
690690 else
691691 Fsubst. f_bind_mem subst hf1.hf_m hf2.hf_m in
692- assert (not (Mid. mem hf1.hf_m mxs) && not (Mid. mem hf2.hf_m mxs));
693- let mxs = Mid. add hf1.hf_m hf2.hf_m mxs in
692+ assert (not (Mid. mem hf1.hf_m mxs) && not (Mid. mem hf2.hf_m mxs));
693+ let mxs = Mid. add hf1.hf_m hf2.hf_m mxs in
694694 List. iter2 (doit env (subst, mxs))
695695 [(hf_pr hf1).inv; (hf_po hf1).inv] [(hf_pr hf2).inv; (hf_po hf2).inv]
696696 end
@@ -700,6 +700,12 @@ let f_match_core opts hyps (ue, ev) f1 f2 =
700700 failure () ;
701701 if hf1.bhf_cmp <> hf2.bhf_cmp then
702702 failure () ;
703+ let subst =
704+ if id_equal hf1.bhf_m hf2.bhf_m then
705+ subst
706+ else
707+ Fsubst. f_bind_mem subst hf1.bhf_m hf2.bhf_m in
708+ assert (not (Mid. mem hf1.bhf_m mxs) && not (Mid. mem hf2.bhf_m mxs));
703709 let mxs = Mid. add hf1.bhf_m hf2.bhf_m mxs in
704710 List. iter2 (doit env (subst, mxs))
705711 [(bhf_pr hf1).inv; (bhf_po hf1).inv; (bhf_bd hf1).inv]
@@ -711,7 +717,19 @@ let f_match_core opts hyps (ue, ev) f1 f2 =
711717 failure () ;
712718 if not (EcReduction.EqTest. for_xp env hf1.ef_fr hf2.ef_fr) then
713719 failure() ;
720+ let subst =
721+ if id_equal hf1.ef_ml hf2.ef_ml then
722+ subst
723+ else
724+ Fsubst. f_bind_mem subst hf1.ef_ml hf2.ef_ml in
725+ assert (not (Mid. mem hf1.ef_ml mxs) && not (Mid. mem hf2.ef_ml mxs));
714726 let mxs = Mid. add hf1.ef_ml hf2.ef_ml mxs in
727+ let subst =
728+ if id_equal hf1.ef_mr hf2.ef_mr then
729+ subst
730+ else
731+ Fsubst. f_bind_mem subst hf1.ef_mr hf2.ef_mr in
732+ assert (not (Mid. mem hf1.ef_mr mxs) && not (Mid. mem hf2.ef_mr mxs));
715733 let mxs = Mid. add hf1.ef_mr hf2.ef_mr mxs in
716734 List. iter2
717735 (doit env (subst, mxs))
@@ -724,6 +742,12 @@ let f_match_core opts hyps (ue, ev) f1 f2 =
724742 doit_mem env mxs pr1.pr_mem pr2.pr_mem;
725743 doit env (subst, mxs) pr1.pr_args pr2.pr_args;
726744 let ev1, ev2 = pr1.pr_event, pr2.pr_event in
745+ let subst =
746+ if id_equal ev1.m ev2.m then
747+ subst
748+ else
749+ Fsubst. f_bind_mem subst ev1.m ev2.m in
750+ assert (not (Mid. mem ev1.m mxs) && not (Mid. mem ev2.m mxs));
727751 let mxs = Mid. add ev1.m ev2.m mxs in
728752 doit env (subst, mxs) ev1.inv ev2.inv;
729753 end
0 commit comments