| 1 |
Module Type SIG. |
| 2 |
Inductive w : Set := |
| 3 |
A : w. |
| 4 |
Parameter f : w -> w. |
| 5 |
End SIG. |
| 6 |
|
| 7 |
Module M : SIG. |
| 8 |
Inductive w : Set := |
| 9 |
A : w. |
| 10 |
Definition f x := match x with |
| 11 |
| A => A |
| 12 |
end. |
| 13 |
End M. |
| 14 |
|
| 15 |
Module N := M. |
| 16 |
|
| 17 |
Check (N.f M.A). |
| 18 |
|
| 19 |
(* Check use of equivalence on inductive types (bug #1242) *) |
| 20 |
|
| 21 |
Module Type ASIG. |
| 22 |
Inductive t : Set := a | b : t. |
| 23 |
Definition f := fun x => match x with a => true | b => false end. |
| 24 |
End ASIG. |
| 25 |
|
| 26 |
Module Type BSIG. |
| 27 |
Declare Module A : ASIG. |
| 28 |
Definition f := fun x => match x with A.a => true | A.b => false end. |
| 29 |
End BSIG. |
| 30 |
|
| 31 |
Module C (A : ASIG) (B : BSIG with Module A:=A). |
| 32 |
|
| 33 |
(* Check equivalence is considered in "case_info" *) |
| 34 |
Lemma test : forall x, A.f x = B.f x. |
| 35 |
intro x. unfold B.f, A.f. |
| 36 |
destruct x; reflexivity. |
| 37 |
Qed. |
| 38 |
|
| 39 |
(* Check equivalence is considered in pattern-matching *) |
| 40 |
Definition f (x : A.t) := match x with B.A.a => true | B.A.b => false end. |
| 41 |
|
| 42 |
End C. |
| 43 |
|
| 44 |
(* Check subtyping of the context of parameters of the inductive types *) |
| 45 |
(* Only the number of expected uniform parameters and the convertibility *) |
| 46 |
(* of the inductive arities and constructors types are checked *) |
| 47 |
|
| 48 |
Module Type S. Inductive I (x:=0) (y:nat): Set := c: x=y -> I y. End S. |
| 49 |
Module P : S. Inductive I (y':nat) (z:=y'): Set := c : 0=y' -> I y'. End P. |