| 1 |
Set Universe Polymorphism. |
| 2 |
|
| 3 |
Section Global. |
| 4 |
Sort s s'. |
| 5 |
|
| 6 |
Fail Constraint Prop -> Type. |
| 7 |
Fail Constraint Type -> Prop. |
| 8 |
Fail Constraint SProp -> s. |
| 9 |
|
| 10 |
Constraint Prop -> s. |
| 11 |
Constraint s -> Prop. |
| 12 |
Constraint s -> SProp. |
| 13 |
|
| 14 |
Polymorphic Axiom ad@{s;u} : forall A : Type@{s;u}, A. |
| 15 |
|
| 16 |
Polymorphic Definition t@{s s';u v|s -> s'} (A : Type@{s;u}) (B : Type@{s';v}) : A := ad A. |
| 17 |
|
| 18 |
Fail Check t@{s s';Set Set}. |
| 19 |
Check t@{s Prop;Set Set}. |
| 20 |
Check t@{Prop s;Set Set}. |
| 21 |
Check t@{Type s;Set Set}. |
| 22 |
Check t@{s' s';Set Set}. |
| 23 |
Fail Check t@{s Type;Set Set}. |
| 24 |
End Global. |
| 25 |
|
| 26 |
Section Dominant. |
| 27 |
Sort Exn. |
| 28 |
|
| 29 |
Sort Test. |
| 30 |
Constraint Prop -> Test. |
| 31 |
Fail Constraint Exn -> Test. |
| 32 |
|
| 33 |
Fail Polymorphic Definition test@{s;l|Prop -> s, Exn -> s} (A : Type@{s;l}) : A := ad A. |
| 34 |
End Dominant. |
| 35 |
|
| 36 |
Module Syntax. |
| 37 |
Fail Definition foo@{u|Type -> Prop} := Type@{u}. |
| 38 |
Fail Definition foo'@{|Prop -> SProp} := Prop. |
| 39 |
|
| 40 |
Definition bar@{s;u|s -> Type} := Type@{s;u}. |
| 41 |
Definition bar'@{s;u|Prop -> s} := Type@{s;u}. |
| 42 |
|
| 43 |
Definition bar''@{s s';|s -> s', s' -> Prop} := Prop. |
| 44 |
Fail Definition bar'''@{s;|s -> Type, Prop -> s} := Prop. |
| 45 |
End Syntax. |
| 46 |
|
| 47 |
Inductive sum@{sl sr s;ul ur} (A : Type@{sl;ul}) (B : Type@{sr;ur}) : Type@{s;max(ul,ur)} := |
| 48 |
| inl : A -> sum A B |
| 49 |
| inr : B -> sum A B. |
| 50 |
|
| 51 |
Arguments inl {A B} _ , [A] B _. |
| 52 |
Arguments inr {A B} _ , A [B] _. |
| 53 |
|
| 54 |
Definition sum_elim@{sl sr s0 s0';ul ur v|s0 -> s0'} |
| 55 |
(A : Type@{sl;ul}) (B : Type@{sr;ur}) (P : sum@{sl sr s0;ul ur} A B -> Type@{s0';v}) |
| 56 |
(fl : forall a, P (inl a)) (fr : forall b, P (inr b)) (x : sum@{sl sr s0;ul ur} A B) := |
| 57 |
match x with |
| 58 |
| inl a => fl a |
| 59 |
| inr b => fr b |
| 60 |
end. |
| 61 |
|
| 62 |
Definition sum_sind := sum_elim@{Type Type Type SProp;_ _ _}. |
| 63 |
Definition sum_rect := sum_elim@{Type Type Type Type;_ _ _}. |
| 64 |
Definition sum_ind := sum_elim@{Type Type Type Prop;_ _ _}. |
| 65 |
|
| 66 |
Definition or_ind := sum_elim@{Prop Prop Prop Prop;_ _ _}. |
| 67 |
Definition or_sind := sum_elim@{Prop Prop Prop SProp;_ _ _}. |
| 68 |
Fail Definition or_rect := sum_elim@{Prop Prop Prop Type;_ _ _}. |
| 69 |
|
| 70 |
Definition sumor := sum@{Type Prop Type;_ _}. |
| 71 |
|
| 72 |
Definition sumor_sind := sum_elim@{Type Prop Type SProp;_ _ _}. |
| 73 |
Definition sumor_rect := sum_elim@{Type Prop Type Type;_ _ _}. |
| 74 |
Definition sumor_ind := sum_elim@{Type Prop Type Prop;_ _ _}. |
| 75 |
|
| 76 |
Fail Definition idT@{sl sr s;ul ur|} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 77 |
: sum@{sl sr Type;ul ur} A B := |
| 78 |
match x return sum@{sl sr Type;ul ur} A B with |
| 79 |
| inl a => inl a |
| 80 |
| inr b => inr b |
| 81 |
end. |
| 82 |
|
| 83 |
Fail Definition idP@{sl sr s;ul ur|} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 84 |
: sum@{sl sr Prop;ul ur} A B := |
| 85 |
match x return sum@{sl sr Prop;ul ur} A B with |
| 86 |
| inl a => inl a |
| 87 |
| inr b => inr b |
| 88 |
end. |
| 89 |
|
| 90 |
Fail Definition idS@{sl sr s;ul ur|} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 91 |
: sum@{sl sr SProp;ul ur} A B := |
| 92 |
match x return sum@{sl sr SProp;ul ur} A B with |
| 93 |
| inl a => inl a |
| 94 |
| inr b => inr b |
| 95 |
end. |
| 96 |
|
| 97 |
Fail Definition idV@{sl sr s s';ul ur|} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 98 |
: sum@{sl sr s';ul ur} A B := |
| 99 |
match x return sum@{sl sr s';ul ur} A B with |
| 100 |
| inl a => inl a |
| 101 |
| inr b => inr b |
| 102 |
end. |
| 103 |
|
| 104 |
Definition idT@{sl sr s;ul ur|s -> Type} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 105 |
: sum@{sl sr Type;ul ur} A B := |
| 106 |
match x return sum@{sl sr Type;ul ur} A B with |
| 107 |
| inl a => inl a |
| 108 |
| inr b => inr b |
| 109 |
end. |
| 110 |
|
| 111 |
Definition idP@{sl sr s;ul ur|s -> Prop} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 112 |
: sum@{sl sr Prop;ul ur} A B := |
| 113 |
match x return sum@{sl sr Prop;ul ur} A B with |
| 114 |
| inl a => inl a |
| 115 |
| inr b => inr b |
| 116 |
end. |
| 117 |
|
| 118 |
Definition idS@{sl sr s;ul ur|s -> SProp} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 119 |
: sum@{sl sr SProp;ul ur} A B := |
| 120 |
match x return sum@{sl sr SProp;ul ur} A B with |
| 121 |
| inl a => inl a |
| 122 |
| inr b => inr b |
| 123 |
end. |
| 124 |
|
| 125 |
Definition idV@{sl sr s;ul ur} (A : Type@{sl;ul}) (B : Type@{sr;ur}) (x : sum@{sl sr s;ul ur} A B) |
| 126 |
: sum@{sl sr s;ul ur} A B := |
| 127 |
match x return sum@{sl sr s;ul ur} A B with |
| 128 |
| inl a => inl a |
| 129 |
| inr b => inr b |
| 130 |
end. |
| 131 |
|
| 132 |
Inductive List'@{s s';l} (A : Type@{s;l}) : Type@{s';l} := |
| 133 |
| nil' : List' A |
| 134 |
| cons' : A -> List' A -> List' A. |
| 135 |
|
| 136 |
Arguments nil' {A}. |
| 137 |
Arguments cons' {A} _ _. |
| 138 |
|
| 139 |
Definition list'_elim@{s s0 s';l l'|s0 -> s'} |
| 140 |
(A : Type@{s;l}) (P : List'@{s s0;l} A -> Type@{s';l'}) |
| 141 |
(fn : P nil') (fc : forall (x : A) (l : List' A), P l -> P (cons' x l)) := |
| 142 |
fix F (l : List'@{s s0;l} A) : P l := |
| 143 |
match l with |
| 144 |
| nil' => fn |
| 145 |
| cons' x l => fc x l (F l) |
| 146 |
end. |
| 147 |
|
| 148 |
Fail Fixpoint list'_idT@{s s';l|} {A : Type@{s;l}} (l : List'@{s s';l} A) : List'@{s Type;l} A := |
| 149 |
match l with |
| 150 |
| nil' => nil' |
| 151 |
| cons' x l => cons' x (list'_idT l) |
| 152 |
end. |
| 153 |
|
| 154 |
Fail Fixpoint list'_idP@{s s';l|} {A : Type@{s;l}} (l : List'@{s s';l} A) : List'@{s Prop;l} A := |
| 155 |
match l with |
| 156 |
| nil' => nil' |
| 157 |
| cons' x l => cons' x (list'_idP l) |
| 158 |
end. |
| 159 |
|
| 160 |
Fail Fixpoint list'_idS@{s s';l|} {A : Type@{s;l}} (l : List'@{s s';l} A) : List'@{s SProp;l} A := |
| 161 |
match l with |
| 162 |
| nil' => nil' |
| 163 |
| cons' x l => cons' x (list'_idS l) |
| 164 |
end. |
| 165 |
|
| 166 |
Fail Fixpoint list'_idV@{s s0 s';l l'|l <= l'} {A : Type@{s;l}} (l : List'@{s s0;l} A) : List'@{s s';l'} A := |
| 167 |
match l with |
| 168 |
| nil' => nil' |
| 169 |
| cons' x l => cons' x (list'_idV l) |
| 170 |
end. |
| 171 |
|
| 172 |
Fixpoint list'_idT@{s s';l|s' -> Type} {A : Type@{s;l}} (l : List'@{s s';l} A) : List'@{s Type;l} A := |
| 173 |
match l with |
| 174 |
| nil' => nil' |
| 175 |
| cons' x l => cons' x (list'_idT l) |
| 176 |
end. |
| 177 |
|
| 178 |
Fixpoint list'_idP@{s s';l|s' -> Prop} {A : Type@{s;l}} (l : List'@{s s';l} A) {struct l} : List'@{s Prop;l} A := |
| 179 |
match l with |
| 180 |
| nil' => nil' |
| 181 |
| cons' x l => cons' x (list'_idP l) |
| 182 |
end. |
| 183 |
|
| 184 |
Fixpoint list'_idS@{s s';l|s' -> SProp} {A : Type@{s;l}} (l : List'@{s s';l} A) : List'@{s SProp;l} A := |
| 185 |
match l with |
| 186 |
| nil' => nil' |
| 187 |
| cons' x l => cons' x (list'_idS l) |
| 188 |
end. |
| 189 |
|
| 190 |
Fixpoint list'_idV@{s s0 s';l l'|l <= l', s0 -> s'} {A : Type@{s;l}} (l : List'@{s s0;l} A) : List'@{s s';l'} A := |
| 191 |
match l with |
| 192 |
| nil' => nil' |
| 193 |
| cons' x l => cons' x (list'_idV l) |
| 194 |
end. |