| 1 |
Set Universe Polymorphism. |
| 2 |
|
| 3 |
Inductive Acc@{s s';u v} {A : Type@{s;u}} (R : A -> A -> Prop) (x : A) : Type@{s';v} := |
| 4 |
| Acc_intro : (forall y : A, R y x -> Acc R y) -> Acc R x. |
| 5 |
|
| 6 |
(* We should be able to define (with tactics) a fixpoint from [s'] to [Type] if [s' -> Prop]. *) |
| 7 |
Fixpoint Acc_elim@{s s' ; u v w | s' -> Prop, u <= w} |
| 8 |
{A : Type@{s;u}} {R : A -> A -> Prop} {P : A -> Type@{w}} |
| 9 |
(f : forall x : A, (forall y : A, R y x -> Acc@{s s';u w} R y) -> (forall y : A, R y x -> P y) -> P x) |
| 10 |
(x : A) (a : Acc@{s s';u w} R x) {struct a} : P x. |
| 11 |
Proof. |
| 12 |
refine (f x (fun y r => _) (fun y r => _)). |
| 13 |
- destruct a. now apply a. |
| 14 |
- unshelve eapply Acc_elim; eauto. |
| 15 |
destruct a. now apply a. |
| 16 |
Defined. |
| 17 |
|
| 18 |
Inductive sum@{sl sr s;ul ur|} (A : Type@{sl;ul}) (B : Type@{sr;ur}) : Type@{s;max(ul,ur)} := |
| 19 |
| inl : A -> sum A B |
| 20 |
| inr : B -> sum A B. |
| 21 |
Arguments inl {_ _} _. |
| 22 |
Arguments inr {_ _} _. |
| 23 |
|
| 24 |
(* Likewise but with an opaque proof. *) |
| 25 |
Lemma test@{sl sr s;ul ur|s -> Prop} {A : Type@{sl;ul}} {B : Type@{sr;ur}} |
| 26 |
(u : sum@{sl sr s;ul ur} A B) : sum@{sl sr Prop;ul ur} A B. |
| 27 |
Proof. |
| 28 |
destruct u. |
| 29 |
- exact (inl a). |
| 30 |
- exact (inr b). |
| 31 |
Qed. |