| 1 |
(* This failed in 8.3pl2 *) |
| 2 |
|
| 3 |
Scheme Induction for eq Sort Prop. |
| 4 |
Check eq_ind_dep. |
| 5 |
|
| 6 |
(* This was broken in v8.5 *) |
| 7 |
|
| 8 |
Set Rewriting Schemes. |
| 9 |
Inductive myeq A (a:A) : A -> Prop := myrefl : myeq A a a. |
| 10 |
Unset Rewriting Schemes. |
| 11 |
|
| 12 |
Check myeq_rect. |
| 13 |
Check myeq_ind. |
| 14 |
Check myeq_rec. |
| 15 |
Check myeq_congr. |
| 16 |
Check myeq_sym. |
| 17 |
Check myeq_rew. |
| 18 |
Check myeq_rew_dep. |
| 19 |
Check myeq_rew_fwd_dep. |
| 20 |
Check myeq_rew_r. |
| 21 |
Check myeq_sym_involutive. |
| 22 |
Check myeq_rew_r_dep. |
| 23 |
Check myeq_rew_fwd_r_dep. |
| 24 |
|
| 25 |
Set Rewriting Schemes. |
| 26 |
Inductive myeq_true : bool -> Prop := myrefl_true : myeq_true true. |
| 27 |
Unset Rewriting Schemes. |
| 28 |
|
| 29 |
(* check that the scheme doesn't minimize itself into something non general *) |
| 30 |
Polymorphic Inductive foo@{u v|u<=v} : Type@{u}:= . |
| 31 |
Lemma bla@{u v|u < v} : foo@{u v} -> False. |
| 32 |
Proof. induction 1. Qed. |
| 33 |
|
| 34 |
Set Warnings "+deprecated-lookup-elim-by-name". |
| 35 |
|
| 36 |
Unset Elimination Schemes. |
| 37 |
Inductive bar := A | B (_:bar). |
| 38 |
|
| 39 |
Scheme bar_myind := Induction for bar Sort Prop. |
| 40 |
Scheme bar_myind_nodep := Minimality for bar Sort Prop. |
| 41 |
|
| 42 |
(* ignored *) |
| 43 |
Definition bar_ind := bar_myind. |
| 44 |
|
| 45 |
Lemma a_or_b : forall f:bar, f = A \/ exists f', f = B f'. |
| 46 |
Proof. |
| 47 |
intros f. |
| 48 |
induction f. |
| 49 |
- left;reflexivity. |
| 50 |
- right;eexists;reflexivity. |
| 51 |
Qed. |
| 52 |
|
| 53 |
Fixpoint bar_rec (P : Set) (f : P) (f0 : bar -> P -> P) b := |
| 54 |
match b with |
| 55 |
| A => f |
| 56 |
| B b0 => f0 b0 (bar_rec P f f0 b0) |
| 57 |
end. |
| 58 |
|
| 59 |
Lemma to_bool : bar -> bool. |
| 60 |
Proof. |
| 61 |
intros f. |
| 62 |
Fail induction f. |
| 63 |
Abort. |
| 64 |
|
| 65 |
Module Attribute. |
| 66 |
(* test schemes attribute *) |
| 67 |
|
| 68 |
Set Elimination Schemes. |
| 69 |
|
| 70 |
#[schemes=none] |
| 71 |
Inductive foo1 := Foo1. |
| 72 |
Fail Check foo1_ind. |
| 73 |
|
| 74 |
#[schemes=default] |
| 75 |
Inductive foo2 := Foo2. |
| 76 |
Check foo2_ind. |
| 77 |
|
| 78 |
Unset Elimination Schemes. |
| 79 |
|
| 80 |
#[schemes=none] |
| 81 |
Inductive foo3 := Foo3. |
| 82 |
Fail Check foo3_ind. |
| 83 |
|
| 84 |
(* XXX should default ignore Elimination Schemes? *) |
| 85 |
#[schemes=default] |
| 86 |
Inductive foo4 := Foo4. |
| 87 |
Fail Check foo4_ind. |
| 88 |
|
| 89 |
Set Elimination Schemes. |
| 90 |
Set Rewriting Schemes. |
| 91 |
|
| 92 |
#[schemes=default] |
| 93 |
Inductive foo5 : bool -> Prop := Foo5 : foo5 true. |
| 94 |
Check foo5_ind. |
| 95 |
Check foo5_rew. |
| 96 |
|
| 97 |
#[schemes=none] |
| 98 |
Inductive foo6 : bool -> Prop := Foo6 : foo6 true. |
| 99 |
Fail Check foo6_ind. |
| 100 |
Fail Check foo6_rew. |
| 101 |
|
| 102 |
(* can't do rewriting schemes for this *) |
| 103 |
Fail Inductive foo7 := Foo7. |
| 104 |
|
| 105 |
(* but disabling schemes doesn't try rewriting schemes *) |
| 106 |
#[schemes=none] |
| 107 |
Inductive foo7 := Foo7. |
| 108 |
|
| 109 |
End Attribute. |