Debian Codegraph @

test-suite/output/Naming.v

raw
1 (* This file checks the compatibility of naming strategy *)
2 (* This does not mean that the given naming strategy is good *)
3
4 Parameter x2:nat.
5 Definition foo y := forall x x3 x4 S, x + S = x3 + x4 + y.
6 Section A.
7 Variable x3:nat.
8 Goal forall x x1 x2 x3:nat,
9 (forall x x3:nat, x+x1 = x2+x3) -> x+x1 = x2+x3.
10 Show.
11 intros.
12 Show.
13
14 (* Remark: in V8.2, this used to be printed
15
16 x3 : nat
17 ============================
18 forall x x1 x4 x5 : nat,
19 (forall x0 x6 : nat, x0 + x1 = x4 + x6) -> x + x1 = x4 + x5
20
21 before intro and
22
23 x3 : nat
24 x : nat
25 x1 : nat
26 x4 : nat
27 x0 : nat
28 H : forall x x3 : nat, x + x1 = x4 + x3
29 ============================
30 x + x1 = x4 + x0
31
32 after. From V8.3, the quantified hypotheses are printed the sames as
33 they would be intro. However the hypothesis H remains printed
34 differently to avoid using the same name in autonomous but nested
35 subterms *)
36
37 Abort.
38
39 Goal forall x x1 x2 x3:nat,
40 (forall x x3:nat, x+x1 = x2+x3 -> foo (S x + x1)) ->
41 x+x1 = x2+x3 -> foo (S x).
42 Show.
43 unfold foo.
44 Show.
45 do 4 intro. (* --> x, x1, x4, x0, ... *)
46 Show.
47 do 2 intro.
48 Show.
49 do 4 intro.
50 Show.
51
52 (* Remark: in V8.2, this used to be printed
53
54 x3 : nat
55 ============================
56 forall x x1 x4 x5 : nat,
57 (forall x0 x6 : nat,
58 x0 + x1 = x4 + x6 ->
59 forall x7 x8 x9 S0 : nat, x7 + S0 = x8 + x9 + (S x0 + x1)) ->
60 x + x1 = x4 + x5 -> forall x0 x6 x7 S0 : nat, x0 + S0 = x6 + x7 + S x
61
62 before the intros and
63
64 x3 : nat
65 x : nat
66 x1 : nat
67 x4 : nat
68 x0 : nat
69 H : forall x x3 : nat,
70 x + x1 = x4 + x3 ->
71 forall x0 x4 x5 S0 : nat, x0 + S0 = x4 + x5 + (S x + x1)
72 H0 : x + x1 = x4 + x0
73 x5 : nat
74 x6 : nat
75 x7 : nat
76 S : nat
77 ============================
78 x5 + S = x6 + x7 + Datatypes.S x
79
80 after (note the x5/x0 and the S0/S) *)
81
82 Abort.
83
84 (* Check naming in hypotheses *)
85
86 Goal forall a, (a = 0 -> forall a, a = 0) -> a = 0.
87 intros.
88 Show.
89 apply H with (a:=a). (* test compliance with printing *)
90 Abort.
91
92 End A.
93
94 Module B.
95
96 (* Check valid/invalid implicit arguments *)
97 Definition f1 {x} (y:forall {x}, x=0) := x+0.
98 Definition f2 := (((fun x => 0):forall {x:nat}, nat), 0).
99 Definition f3 := fun {x} (y:forall {x}, x=0) => x+0.
100
101 Definition g1 {x} := match x with true => fun {x:bool} => x | false => fun x:bool => x end.
102 (* TODO: do not ignore the implicit here *)
103 Definition g2 '(x,y) {z} := x+y+z.
104
105 Definition h1 := fun x:nat => (fun {x} => x) 0.
106 Definition h2 := let g := forall {y}, y=0 in g.
107
108 Notation "∀ x .. y , P" := (forall x, .. (forall y, P) ..)
109 (at level 200, x binder, y binder, right associativity,
110 format "'[ ' '[ ' ∀ x .. y ']' , '/' P ']'") : type_scope.
111
112 Definition l1 := ∀ {x:nat} {y:nat}, x=0.
113
114 End B.