diff options
| author | Hugo Herbelin | 2015-05-05 19:25:24 +0200 |
|---|---|---|
| committer | Hugo Herbelin | 2015-05-09 13:44:01 +0200 |
| commit | 5cbc018fe934750bdf1043da68f99911be4ee6f6 (patch) | |
| tree | 034e3574779ff1279d7ba73268adcbede9379791 /tactics | |
| parent | 3bcfff90470ef079b5e711ef72db28b670eeacd0 (diff) | |
Adding a flag "Set Regular Subst Tactic" off by default in v8.5 for
preserving compatibility of subst after #4214 being solved.
Diffstat (limited to 'tactics')
| -rw-r--r-- | tactics/equality.ml | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tactics/equality.ml b/tactics/equality.ml index 591fbabaef..593b7e9ea0 100644 --- a/tactics/equality.ml +++ b/tactics/equality.ml @@ -1662,8 +1662,21 @@ let default_subst_tactic_flags () = else { only_leibniz = true; rewrite_dependent_proof = false } +let regular_subst_tactic = ref false + +let _ = + declare_bool_option + { optsync = true; + optdepr = false; + optname = "more regular behavior of tactic subst"; + optkey = ["Regular";"Subst";"Tactic"]; + optread = (fun () -> !regular_subst_tactic); + optwrite = (:=) regular_subst_tactic } + let subst_all ?(flags=default_subst_tactic_flags ()) () = + if !regular_subst_tactic then + (* First step: find hypotheses to treat in linear time *) let find_equations gl = let gl = Proofview.Goal.assume gl in @@ -1708,6 +1721,30 @@ let subst_all ?(flags=default_subst_tactic_flags ()) () = tclMAP process ids end + else + +(* Old implementation, not able to manage configurations like a=b, a=t, + or situations like "a = S b, b = S a", or also accidentally unfolding + let-ins *) + Proofview.Goal.nf_enter begin fun gl -> + let find_eq_data_decompose = find_eq_data_decompose gl in + let test (_,c) = + try + let lbeq,u,(_,x,y) = find_eq_data_decompose c in + let eq = Universes.constr_of_global_univ (lbeq.eq,u) in + if flags.only_leibniz then restrict_to_eq_and_identity eq; + (* J.F.: added to prevent failure on goal containing x=x as an hyp *) + if Term.eq_constr x y then failwith "caught"; + match kind_of_term x with Var x -> x | _ -> + match kind_of_term y with Var y -> y | _ -> failwith "caught" + with Constr_matching.PatternMatchingFailure -> failwith "caught" in + let test p = try Some (test p) with Failure _ -> None in + let hyps = pf_hyps_types gl in + let ids = List.map_filter test hyps in + let ids = List.uniquize ids in + subst_gen flags.rewrite_dependent_proof ids + end + (* Rewrite the first assumption for which a condition holds and gives the direction of the rewrite *) |
