| 1 |
Inductive T : Type := |
| 2 |
| Var : nat -> T |
| 3 |
| Arr : T -> T -> T. |
| 4 |
|
| 5 |
Inductive Tele : list T -> Type := |
| 6 |
| Tnil : @Tele nil |
| 7 |
| Tcons : forall ls, forall (t : @Tele ls) (l : T), @Tele (l :: ls). |
| 8 |
|
| 9 |
Fail Fixpoint TeleD (ls : list T) (t : Tele ls) {struct t} |
| 10 |
: { x : Type & x -> nat -> Type } := |
| 11 |
match t return { x : Type & x -> nat -> Type } with |
| 12 |
| Tnil => @existT Type (fun x => x -> nat -> Type) unit (fun (_ : unit) (_ : nat) => unit) |
| 13 |
| Tcons ls t' l => |
| 14 |
let (result, get) := TeleD ls t' in |
| 15 |
@existT Type (fun x => x -> nat -> Type) |
| 16 |
{ v : result & (fix TD (t : T) {struct t} := |
| 17 |
match t with |
| 18 |
| Var n => |
| 19 |
get v n |
| 20 |
| Arr a b => TD a -> TD b |
| 21 |
end) l } |
| 22 |
(fun x n => |
| 23 |
match n return Type with |
| 24 |
| 0 => projT2 x |
| 25 |
| S n => get (projT1 x) n |
| 26 |
end) |
| 27 |
end. |