diff options
author | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2015-02-23 11:59:04 +0100 |
---|---|---|
committer | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2015-02-23 12:50:45 +0100 |
commit | 71def2f885989376c8c2940d37f7fc407ed0a4c5 (patch) | |
tree | ef9be0c569c3664f530446b0960d4be2a10fa2f7 | |
parent | f4ee7ee31e4bc4a49de784d90b331abd3a21e34f (diff) |
Fixing occur-check which was too strong in unification.ml.
-rw-r--r-- | pretyping/unification.ml | 6 | ||||
-rw-r--r-- | test-suite/success/apply.v | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/pretyping/unification.ml b/pretyping/unification.ml index 203b1ec8a..99c20ef6c 100644 --- a/pretyping/unification.ml +++ b/pretyping/unification.ml @@ -673,6 +673,10 @@ let rec unify_0_with_initial_metas (sigma,ms,es as subst) conv_at_top env cv_pb (sigma,(k,lift (-nb) cM,fst (extract_instance_status pb))::metasubst, evarsubst) else error_cannot_unify_local curenv sigma (m,n,cM) + | Evar (evk,_ as ev), Evar (evk',_) + when not (Evar.Set.mem evk flags.frozen_evars) + && Evar.equal evk evk' -> + sigma,metasubst,((curenv,ev,cN)::evarsubst) | Evar (evk,_ as ev), _ when not (Evar.Set.mem evk flags.frozen_evars) && not (occur_evar evk cN) -> @@ -1673,11 +1677,13 @@ let w_unify_to_subterm env evd ?(flags=default_unify_flags ()) (op,cl) = matchrec t with ex when precatchable_exception ex -> matchrec c) + | Lambda (_,t,c) -> (try matchrec t with ex when precatchable_exception ex -> matchrec c) + | _ -> error "Match_subterm")) in try matchrec cl diff --git a/test-suite/success/apply.v b/test-suite/success/apply.v index 21b829aa1..a4ed76c5a 100644 --- a/test-suite/success/apply.v +++ b/test-suite/success/apply.v @@ -536,3 +536,13 @@ Goal forall f:nat->nat, (forall P x, P (f x)) -> let x:=f 0 in x = 0. intros f H x. apply H. Qed. + +(* Test that occur-check is not too restrictive (see comments of #3141) *) +Lemma bar (X: nat -> nat -> Prop) (foo:forall x, X x x) (a: unit) (H: tt = a): + exists x, exists y, X x y. +Proof. +intros; eexists; eexists; case H. +apply (foo ?y). +Grab Existential Variables. +exact 0. +Qed. |