@@ -19,6 +19,7 @@ type pt_env = {
1919 pte_hy : LDecl .hyps ;
2020 pte_ue : EcUnify .unienv ;
2121 pte_ev : EcMatching .mevmap ref ;
22+ pte_lc : EcEnv .simplify_context ; (* proof-local simplify context *)
2223}
2324
2425type pt_ev = {
@@ -78,22 +79,24 @@ let argkind_of_ptarg arg : argkind =
7879 | PVASub _ -> `PTerm
7980
8081(* -------------------------------------------------------------------- *)
81- let ptenv pe hyps (ue , ev ) =
82+ let ptenv ?( simpl = EcEnv.SimplifyContext. empty) pe hyps (ue , ev ) =
8283 { pte_pe = pe;
8384 pte_hy = hyps;
8485 pte_ue = EcUnify.UniEnv. copy ue;
85- pte_ev = ref ev; }
86+ pte_ev = ref ev;
87+ pte_lc = simpl; }
8688
8789(* -------------------------------------------------------------------- *)
8890let copy pe =
89- ptenv pe.pte_pe pe.pte_hy (pe.pte_ue, ! (pe.pte_ev))
91+ ptenv ~simpl: pe.pte_lc pe.pte_pe pe.pte_hy (pe.pte_ue, ! (pe.pte_ev))
9092
9193(* -------------------------------------------------------------------- *)
92- let ptenv_of_penv (hyps : LDecl.hyps ) (pe : proofenv ) =
94+ let ptenv_of_penv ?( simpl = EcEnv.SimplifyContext. empty) (hyps : LDecl.hyps ) (pe : proofenv ) =
9395 { pte_pe = pe;
9496 pte_hy = hyps;
9597 pte_ue = PT. unienv_of_hyps hyps;
96- pte_ev = ref EcMatching.MEV. empty; }
98+ pte_ev = ref EcMatching.MEV. empty;
99+ pte_lc = simpl; }
97100
98101(* -------------------------------------------------------------------- *)
99102let rec get_head_symbol (pt : pt_env ) (f : form ) =
@@ -272,17 +275,21 @@ let pattern_form ?name hyps ~ptn subject =
272275let pf_form_match (pt : pt_env ) ?mode ~ptn subject =
273276 let mode = mode |> odfl EcMatching. fmrigid in
274277
278+ (* conversion during matching sees the proof-local simplify context *)
279+ let conv_ri =
280+ { EcReduction. full_compat with EcReduction. user_local = pt.pte_lc } in
281+
275282 try
276283 let (ue, ev) =
277- EcMatching. f_match_core mode pt.pte_hy
284+ EcMatching. f_match_core ~conv_ri mode pt.pte_hy
278285 (pt.pte_ue, ! (pt.pte_ev)) ptn subject
279286 in
280287 EcUnify.UniEnv. restore ~dst: pt.pte_ue ~src: ue;
281288 pt.pte_ev := ev
282289 with EcMatching. MatchFailure as exn ->
283290 (* FIXME: should we check for empty inters. with ecmap? *)
284291 if not mode.fm_conv ||
285- not (EcReduction. is_conv ~ri: EcReduction. full_compat pt.pte_hy ptn subject) then
292+ not (EcReduction. is_conv ~ri: conv_ri pt.pte_hy ptn subject) then
286293 raise exn
287294
288295(* -------------------------------------------------------------------- *)
@@ -883,37 +890,37 @@ let process_full_closed_pterm pe pf =
883890let tc1_process_pterm_cut ~prcut tc ff =
884891 let pe = FApi. tc1_penv tc in
885892 let hyps = FApi. tc1_hyps tc in
886- process_pterm_cut ~prcut (ptenv_of_penv hyps pe) ff
893+ process_pterm_cut ~prcut (ptenv_of_penv ~simpl: ( FApi. tc1_simplify_context tc) hyps pe) ff
887894
888895(* -------------------------------------------------------------------- *)
889896let tc1_process_pterm tc ff =
890897 let pe = FApi. tc1_penv tc in
891898 let hyps = FApi. tc1_hyps tc in
892- process_pterm (ptenv_of_penv hyps pe) ff
899+ process_pterm (ptenv_of_penv ~simpl: ( FApi. tc1_simplify_context tc) hyps pe) ff
893900
894901(* -------------------------------------------------------------------- *)
895902let tc1_process_full_pterm_cut ~prcut (tc : tcenv1 ) (ff : 'a gppterm ) =
896903 let pe = FApi. tc1_penv tc in
897904 let hyps = FApi. tc1_hyps tc in
898- process_full_pterm_cut ~prcut (ptenv_of_penv hyps pe) ff
905+ process_full_pterm_cut ~prcut (ptenv_of_penv ~simpl: ( FApi. tc1_simplify_context tc) hyps pe) ff
899906
900907(* -------------------------------------------------------------------- *)
901908let tc1_process_full_pterm ?implicits (tc : tcenv1 ) (ff : ppterm ) =
902909 let pe = FApi. tc1_penv tc in
903910 let hyps = FApi. tc1_hyps tc in
904- process_full_pterm ?implicits (ptenv_of_penv hyps pe) ff
911+ process_full_pterm ?implicits (ptenv_of_penv ~simpl: ( FApi. tc1_simplify_context tc) hyps pe) ff
905912
906913(* -------------------------------------------------------------------- *)
907914let tc1_process_full_closed_pterm_cut ~prcut (tc : tcenv1 ) (ff : 'a gppterm ) =
908915 let pe = FApi. tc1_penv tc in
909916 let hyps = FApi. tc1_hyps tc in
910- process_full_closed_pterm_cut ~prcut (ptenv_of_penv hyps pe) ff
917+ process_full_closed_pterm_cut ~prcut (ptenv_of_penv ~simpl: ( FApi. tc1_simplify_context tc) hyps pe) ff
911918
912919(* -------------------------------------------------------------------- *)
913920let tc1_process_full_closed_pterm (tc : tcenv1 ) (ff : ppterm ) =
914921 let pe = FApi. tc1_penv tc in
915922 let hyps = FApi. tc1_hyps tc in
916- process_full_closed_pterm (ptenv_of_penv hyps pe) ff
923+ process_full_closed_pterm (ptenv_of_penv ~simpl: ( FApi. tc1_simplify_context tc) hyps pe) ff
917924
918925(* -------------------------------------------------------------------- *)
919926type prept = [
0 commit comments