| 1 |
|
| 2 |
Inductive equivalent P Q := Equivalent (P_to_Q : P -> Q) (Q_to_P : Q -> P). |
| 3 |
|
| 4 |
Inductive equal T (x : T) : T -> Type := Equal : equal T x x. |
| 5 |
|
| 6 |
(* Arithmetic *) |
| 7 |
|
| 8 |
Inductive natural := Zero | Add_1_to (n : natural). |
| 9 |
|
| 10 |
Fixpoint add (m n : natural) : natural := |
| 11 |
match m with Zero => n | Add_1_to m_minus_1 => add m_minus_1 (Add_1_to n) end. |
| 12 |
|
| 13 |
Definition double (n : natural) : natural := add n n. |
| 14 |
|
| 15 |
Inductive odd (n : natural) := |
| 16 |
Odd (half : natural) |
| 17 |
(n_odd : equal natural n (Add_1_to (double half))). |
| 18 |
|
| 19 |
Inductive less_than (m n : natural) := |
| 20 |
LessThan (diff : natural) |
| 21 |
(m_lt_n : equal natural n (Add_1_to (add m diff))). |
| 22 |
|
| 23 |
(* Finite subsets *) |
| 24 |
|
| 25 |
Definition injective_in T R (D : T -> Type) (f : T -> R) := |
| 26 |
forall x y, D x -> D y -> equal R (f x) (f y) -> equal T x y. |
| 27 |
|
| 28 |
Inductive in_image T R (D : T -> Type) (f : T -> R) (a : R) := |
| 29 |
InImage (x : T) (x_in_D : D x) (a_is_fx : equal R a (f x)). |
| 30 |
|
| 31 |
Inductive finite_of_order T (D : T -> Type) (n : natural) := |
| 32 |
FiniteOfOrder (rank : T -> natural) |
| 33 |
(rank_injective : injective_in T natural D rank) |
| 34 |
(rank_onto : |
| 35 |
forall i, equivalent (less_than i n) (in_image T natural D rank i)). |
| 36 |
|
| 37 |
(* Constraints *) |
| 38 |
Universes i j. |
| 39 |
Inductive constraint1 : (Type -> Type) -> Type := mk_constraint1 : constraint1 (fun x : Type@{i} => (x : Type@{j})). |
| 40 |
Constraint i < j. |
| 41 |
Inductive constraint2 : Type@{j} := mkc2 (_ : Type@{i}). |
| 42 |
Universes i' j'. |
| 43 |
Constraint i' = j'. |
| 44 |
Inductive constraint3 : (Type -> Type) -> Type := mk_constraint3 : constraint3 (fun x : Type@{i'} => (x : Type@{j'})). |
| 45 |
Inductive constraint4 : (Type -> Type) -> Type |
| 46 |
:= mk_constraint4 : let U1 := Type in |
| 47 |
let U2 := Type in |
| 48 |
constraint4 (fun x : U1 => (x : U2)). |
| 49 |
|
| 50 |
Module CMP_CON. |
| 51 |
(* Comparison of opaque constants MUST be up to the universe graph. |
| 52 |
See #6798. *) |
| 53 |
Universe big. |
| 54 |
|
| 55 |
Polymorphic Lemma foo@{u} : Type@{big}. |
| 56 |
Proof. exact Type@{u}. Qed. |
| 57 |
|
| 58 |
Universes U V. |
| 59 |
|
| 60 |
Definition yo : foo@{U} = foo@{V} := eq_refl. |
| 61 |
End CMP_CON. |
| 62 |
|
| 63 |
Set Universe Polymorphism. |
| 64 |
|
| 65 |
Module POLY_SUBTYP. |
| 66 |
|
| 67 |
Module Type T. |
| 68 |
Axiom foo : Type. |
| 69 |
Parameter bar@{u v|u = v} : foo@{u}. |
| 70 |
End T. |
| 71 |
|
| 72 |
Module M. |
| 73 |
Axiom foo : Type. |
| 74 |
Axiom bar@{u v|u = v} : foo@{v}. |
| 75 |
End M. |
| 76 |
|
| 77 |
Module F (A:T). End F. |
| 78 |
|
| 79 |
Module X := F M. |
| 80 |
|
| 81 |
End POLY_SUBTYP. |
| 82 |
|
| 83 |
Module POLY_IND. |
| 84 |
|
| 85 |
Polymorphic Inductive ind@{u v | u < v} : Prop := . |
| 86 |
|
| 87 |
Polymorphic Definition cst@{u v | v < u} := Prop. |
| 88 |
|
| 89 |
End POLY_IND. |