Debian Codegraph @

test-suite/bugs/bug_12467.v

raw
1 Module ClosedBinder.
2
3 Notation "'WITH' ( x1 : t1 ) , x2t2 , .. , xntn 'PRE' [ ] P 'POST' [ ] Q" :=
4 ((fun x1 : t1 => (fun x2t2 => .. (fun xntn => (pair .. (pair x1 x2t2) .. xntn)) .. )),
5 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => P) .. )),
6 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => Q) .. )))
7 (at level 200, x1 at level 0, x2t2 closed binder, P at level 100, Q at level 100, only parsing).
8 Check WITH (x : nat) , (y : nat) , (z : nat) PRE [] (x, y, z) POST [] (z, y, x).
9
10 End ClosedBinder.
11
12 Module OpenBinder.
13
14 (* Not eligible as an open binder because of the separating comma *)
15 Fail Notation "'WITH' ( x1 : t1 ) , x2t2 , .. , xntn 'PRE' [ ] P 'POST' [ ] Q" :=
16 ((fun x1 : t1 => (fun x2t2 => .. (fun xntn => (pair .. (pair x1 x2t2) .. xntn)) .. )),
17 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => P) .. )),
18 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => Q) .. )))
19 (at level 200, x1 at level 0, x2t2 binder, P at level 100, Q at level 100, only parsing).
20
21 End OpenBinder.
22
23 Module Constr.
24
25 Notation "'WITH' ( x1 : t1 ) , x2t2 , .. , xntn 'PRE' [ ] P 'POST' [ ] Q" :=
26 ((fun x1 : t1 => (fun x2t2 => .. (fun xntn => (pair .. (pair x1 x2t2) .. xntn)) .. )),
27 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => P) .. )),
28 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => Q) .. )))
29 (at level 200, x1 at level 0, x2t2, P at level 100, Q at level 100, only parsing).
30 (* Fail because, constr used for binder defaults to name *)
31 Fail Check WITH (x : nat) , (y : nat) , (z : nat) PRE [] (x, y, z) POST [] (z, y, x).
32
33 End Constr.
34
35 Module ConstrAsPattern.
36
37 Notation "'WITH' ( x1 : t1 ) , x2t2 , .. , xntn 'PRE' [ ] P 'POST' [ ] Q" :=
38 ((fun x1 : t1 => (fun x2t2 => .. (fun xntn => (pair .. (pair x1 x2t2) .. xntn)) .. )),
39 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => P) .. )),
40 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => Q) .. )))
41 (at level 200, x1 at level 0, x2t2 constr as pattern, P at level 100, Q at level 100, only parsing).
42 Check WITH (x : nat) , (y : nat) , (z : nat) PRE [] (x, y, z) POST [] (z, y, x).
43
44 End ConstrAsPattern.
45
46 Module Pattern.
47
48 Notation "'WITH' ( x1 : t1 ) , x2t2 , .. , xntn 'PRE' [ ] P 'POST' [ ] Q" :=
49 ((fun x1 : t1 => (fun x2t2 => .. (fun xntn => (pair .. (pair x1 x2t2) .. xntn)) .. )),
50 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => P) .. )),
51 (fun x1 : t1 => (fun x2t2 => .. (fun xntn => Q) .. )))
52 (at level 200, x1 at level 0, x2t2 pattern, P at level 100, Q at level 100, only parsing).
53 Check WITH (x : nat) , (y : nat) , (z : nat) PRE [] (x, y, z) POST [] (z, y, x).
54
55 End Pattern.
56
57 Module OnlyRecursiveBinderPartOfIssue17904.
58
59 Notation "∀ x .. y , P" := (forall x , .. (forall y , P) .. )
60 (at level 200, x constr at level 8 as pattern, right associativity,
61 format "'[ ' '[ ' ∀ x .. y ']' , '/' P ']'") : type_scope.
62 Check ∀ a b, a + b = 0.
63
64 End OnlyRecursiveBinderPartOfIssue17904.