File: bug_19661.v

package info (click to toggle)
coq 9.1.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 35,964 kB
  • sloc: ml: 239,908; sh: 4,355; python: 2,985; ansic: 2,644; makefile: 874; lisp: 171; javascript: 63; xml: 24; sed: 2
file content (52 lines) | stat: -rw-r--r-- 1,466 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Inductive tele : Type :=
  | TeleO : tele
  | TeleS {X} (binder : X -> tele) : tele.

Fixpoint tele_fun (TT : tele) (T : Type) : Type :=
  match TT with
  | TeleO => T
  | TeleS b => forall x, tele_fun (b x) T
  end.

Notation "TT -t> A" := (tele_fun TT A) (at level 99, A at level 200, right associativity).

Record tele_arg_cons {X : Type} (f : X -> Type) : Type := TeleArgCons
  { tele_arg_head : X;
    tele_arg_tail : f tele_arg_head }.
Global Arguments TeleArgCons {_ _} _ _.

Fixpoint tele_arg (t : tele) : Type :=
  match t with
  | TeleO => unit
  | TeleS f => tele_arg_cons (fun x => tele_arg (f x))
  end.

Fixpoint tele_app {TT : tele} {U} : (TT -t> U) -> tele_arg TT -> U :=
  match TT as TT return (TT -t> U) -> tele_arg TT -> U with
  | TeleO => fun F _ => F
  | TeleS r => fun (F : TeleS r -t> U) '(TeleArgCons x b) =>
      tele_app (F x) b
  end.
Global Arguments tele_app {!_ _} & _ !_ /.

Axiom PROP: Type.
Axiom T : PROP.
Axiom atomic_commit :
  forall {TB : tele}
         (_ : forall (_ : tele_arg TB), PROP)
         (_ : forall (_ : tele_arg TB), PROP),
    PROP.

Fixpoint do_after_shatter  (next : nat) (d : nat) : PROP :=
  match d with
  | 0 => T
  | S d =>
  (@atomic_commit
      (@TeleS _ (fun l' => TeleO))
      ((@tele_app (@TeleS _ (fun l' => TeleO))
          _ (fun l' => T)))
      ((@tele_app (@TeleS _ (fun l' =>  TeleO))
          _ (fun l' =>
                      do_after_shatter (l'-1) d
                    ))))
  end.