Debian Codegraph @

test-suite/bugs/bug_4932.v

raw
1 (* Testing recursive notations with binders seen as terms *)
2
3 Inductive ftele : Type :=
4 | fb {T:Type} : T -> ftele
5 | fr {T} : (T -> ftele) -> ftele.
6
7 Fixpoint args ftele : Type :=
8 match ftele with
9 | fb _ => unit
10 | fr f => sigT (fun t => args (f t))
11 end.
12
13 Definition fpack := sigT args.
14 Definition pack fp fa : fpack := existT _ fp fa.
15
16 Notation "'tele' x .. z := b" :=
17 (
18 (fun x => ..
19 (fun z =>
20 pack
21 (fr (fun x => .. ( fr (fun z => fb b) ) .. ) )
22 (existT _ x .. (existT _ z tt) .. )
23 ) ..
24 )
25 ) (at level 85, x binder, z binder).
26
27 Check fun '((y,z):nat*nat) => pack (fr (fun '((y,z):nat*nat) => fb tt))
28 (existT _ (y,z) tt).
29
30 Example test := tele (t : Type) := tt.
31 Example test' := test nat.
32 Print test.
33
34 Example test2 := tele (t : Type) (x:t) := tt.
35 Example test2' := test2 nat 0.
36 Print test2.
37
38 Example test3 := tele (t : Type) (y:=0) (x:t) := tt.
39 Example test3' := test3 nat 0.
40 Print test3.
41
42 Example test4 := tele (t : Type) '((y,z):nat*nat) (x:t) := tt.
43 Example test4' := test4 nat (1,2) 3.
44 Print test4.