Debian Codegraph @

test-suite/bugs/bug_19661.v

raw
1 Inductive tele : Type :=
2 | TeleO : tele
3 | TeleS {X} (binder : X -> tele) : tele.
4
5 Fixpoint tele_fun (TT : tele) (T : Type) : Type :=
6 match TT with
7 | TeleO => T
8 | TeleS b => forall x, tele_fun (b x) T
9 end.
10
11 Notation "TT -t> A" := (tele_fun TT A) (at level 99, A at level 200, right associativity).
12
13 Record tele_arg_cons {X : Type} (f : X -> Type) : Type := TeleArgCons
14 { tele_arg_head : X;
15 tele_arg_tail : f tele_arg_head }.
16 Global Arguments TeleArgCons {_ _} _ _.
17
18 Fixpoint tele_arg (t : tele) : Type :=
19 match t with
20 | TeleO => unit
21 | TeleS f => tele_arg_cons (fun x => tele_arg (f x))
22 end.
23
24 Fixpoint tele_app {TT : tele} {U} : (TT -t> U) -> tele_arg TT -> U :=
25 match TT as TT return (TT -t> U) -> tele_arg TT -> U with
26 | TeleO => fun F _ => F
27 | TeleS r => fun (F : TeleS r -t> U) '(TeleArgCons x b) =>
28 tele_app (F x) b
29 end.
30 Global Arguments tele_app {!_ _} & _ !_ /.
31
32 Axiom PROP: Type.
33 Axiom T : PROP.
34 Axiom atomic_commit :
35 forall {TB : tele}
36 (_ : forall (_ : tele_arg TB), PROP)
37 (_ : forall (_ : tele_arg TB), PROP),
38 PROP.
39
40 Fixpoint do_after_shatter (next : nat) (d : nat) : PROP :=
41 match d with
42 | 0 => T
43 | S d =>
44 (@atomic_commit
45 (@TeleS _ (fun l' => TeleO))
46 ((@tele_app (@TeleS _ (fun l' => TeleO))
47 _ (fun l' => T)))
48 ((@tele_app (@TeleS _ (fun l' => TeleO))
49 _ (fun l' =>
50 do_after_shatter (l'-1) d
51 ))))
52 end.