From 6133a43c30e03656696a897bcedaf0cfb2cec70d Mon Sep 17 00:00:00 2001 From: Matthieu Sozeau Date: Fri, 20 Jun 2014 16:03:52 +0200 Subject: Allow more relaxed conversion between the types of the two terms of a rewrite equation, fix uncaught exception in setoid_rewrite (bug #3336). --- tactics/rewrite.ml | 16 +++++++--------- test-suite/bugs/closed/3336.v | 9 +++++++++ test-suite/bugs/opened/3336.v | 6 ------ 3 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 test-suite/bugs/closed/3336.v delete mode 100644 test-suite/bugs/opened/3336.v diff --git a/tactics/rewrite.ml b/tactics/rewrite.ml index d7091b5d03..8794557ef6 100644 --- a/tactics/rewrite.ml +++ b/tactics/rewrite.ml @@ -444,7 +444,7 @@ let evd_convertible env evd x y = with e when Errors.noncritical e -> false let convertible env evd x y = - Reductionops.is_conv env evd x y + Reductionops.is_conv_leq env evd x y type hypinfo = { cl : clausenv; @@ -634,13 +634,9 @@ let unify_eqn env (sigma, cstrs) hypinfo by t = let ty1 = Retyping.get_type_of env'.env env'.evd c1 and ty2 = Retyping.get_type_of env'.env env'.evd c2 in - if convertible env env'.evd ty1 ty2 then - (* (if occur_meta_or_existential prf then *) - (hypinfo := refresh_hypinfo env env'.evd !hypinfo; - env'.evd, prf, c1, c2, car, rel) - (* else (\** Evars have been solved, we can go back to the initial evd, *) - (* but keep the potential refinement of existing evars. *\) *) - (* env'.evd, prf, c1, c2, car, rel) *) + if convertible env env'.evd ty2 ty1 then + (hypinfo := refresh_hypinfo env env'.evd !hypinfo; + env'.evd, prf, c1, c2, car, rel) else raise Reduction.NotConvertible in let evars = evd', cstrs in @@ -655,7 +651,9 @@ let unify_eqn env (sigma, cstrs) hypinfo by t = let evars, rel' = poly_inverse !hypinfo.sort env evars car rel in evars, (prf, (car, rel', c2, c1)) in Some (evd, res) - with e when Class_tactics.catchable e -> None + with + | e when Class_tactics.catchable e -> None + | Reduction.NotConvertible -> None type rewrite_flags = { under_lambdas : bool; on_morphisms : bool } diff --git a/test-suite/bugs/closed/3336.v b/test-suite/bugs/closed/3336.v new file mode 100644 index 0000000000..dc358c6004 --- /dev/null +++ b/test-suite/bugs/closed/3336.v @@ -0,0 +1,9 @@ +Require Import Setoid. + +Goal forall x y : Type, x = y -> x = y. +intros x y H. +setoid_rewrite H. +reflexivity. +Defined. +(* Toplevel input, characters 0-16: +Anomaly: Uncaught exception Reduction.NotConvertible(_). Please report. *) diff --git a/test-suite/bugs/opened/3336.v b/test-suite/bugs/opened/3336.v deleted file mode 100644 index d469a13a34..0000000000 --- a/test-suite/bugs/opened/3336.v +++ /dev/null @@ -1,6 +0,0 @@ -Require Import Setoid. -Goal forall x y : Type, x = y -> x = y. -intros x y H. -Fail setoid_rewrite H. -(* Toplevel input, characters 0-16: -Anomaly: Uncaught exception Reduction.NotConvertible(_). Please report. *) -- cgit v1.2.3