aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherbelin2009-02-23 10:46:20 +0000
committerherbelin2009-02-23 10:46:20 +0000
commit999b303a775257ee076adffe6daa7d528bcd35bc (patch)
treefb033dc46102c01b98de526872b2f6f101943f4e
parent3c5c74b9763debfcfc2b4683efd85184ae21875b (diff)
Add support for dependent "destruct" over terms in dependent types.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11944 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--CHANGES2
-rw-r--r--tactics/tactics.ml6
-rw-r--r--test-suite/success/destruct.v14
3 files changed, 17 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index d1a8e41bd1..99efbdf0d9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,8 @@ Tactics
- Tactic "intuition" now preserves inner "iff" (exceptional source of
incompatibilities solvable by redefining "intuition" as
"unfold iff in *; intuition".
+- Improved support of dependent goals over objects in dependent types for
+ "destruct".
Tools
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index b45861fd33..d74c9f05e0 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -2460,7 +2460,11 @@ let find_elim_signature isrec elim hyp0 gl =
let s = elimination_sort_of_goal gl in
let elimc =
if isrec then lookup_eliminator mind s
- else pf_apply make_case_gen gl mind s in
+ else
+ let case =
+ if occur_term (mkVar hyp0) (pf_concl gl) then make_case_dep
+ else make_case_gen in
+ pf_apply case gl mind s in
let elimt = pf_type_of gl elimc in
((elimc, NoBindings), elimt), mkInd mind
| Some (elimc,lbind as e) ->
diff --git a/test-suite/success/destruct.v b/test-suite/success/destruct.v
index 5aa78816b0..59d583feec 100644
--- a/test-suite/success/destruct.v
+++ b/test-suite/success/destruct.v
@@ -1,6 +1,6 @@
(* Submitted by Robert Schneck *)
-Parameter A B C D : Prop.
+Parameters A B C D : Prop.
Axiom X : A -> B -> C /\ D.
Lemma foo : A -> B -> C.
@@ -45,9 +45,9 @@ Require Import List.
Definition alist R := list (nat * R)%type.
Section Properties.
- Variables A : Type.
- Variables a : A.
- Variables E : alist A.
+ Variable A : Type.
+ Variable a : A.
+ Variable E : alist A.
Lemma silly : E = E.
Proof.
@@ -55,3 +55,9 @@ Section Properties.
Abort.
End Properties.
+
+(* This used not to work before revision 11944 *)
+
+Goal forall P:(forall n, 0=n -> Prop), forall H: 0=0, P 0 H.
+destruct H.
+Abort.