-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathtest_readme.v
100 lines (70 loc) · 2.46 KB
/
test_readme.v
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
From elpi.apps Require Import derive.std.
Module example1.
derive Inductive peano := Zero | Succ (p : peano).
Print peano.
(* Inductive peano : Set := Zero : peano | Succ : peano -> peano *)
Eval compute in peano_eqb Zero (Succ Zero).
(* = false : bool *)
Check peano_eqb_OK.
(* peano_eqb_OK : forall x1 x2 : peano, reflect (x1 = x2) (eqb x1 x2) *)
End example1.
Module example2.
#[module]
derive Inductive peano := Zero | Succ (p : peano).
Print peano.
(* Notation peano := peano.peano *)
Print peano.peano.
(* Inductive peano : Set := Zero : peano | Succ : peano -> peano *)
Eval compute in peano.eqb Zero (Succ Zero).
(* = false : bool *)
Check peano.eqb_OK.
(* peano.eqb_OK : forall x1 x2 : peano, reflect (x1 = x2) (eqb x1 x2) *)
End example2.
Module example3.
#[module="Peano"]
derive Inductive peano := Zero | Succ (p : peano).
Print peano.
(* Notation peano := Peano.peano *)
Print Peano.peano.
(* Inductive peano : Set := Zero : peano | Succ : peano -> peano *)
Eval compute in Peano.eqb Zero (Succ Zero).
(* = false : bool *)
Check Peano.eqb_OK.
(* Peano.eqb_OK : forall x1 x2 : peano, reflect (x1 = x2) (eqb x1 x2) *)
End example3.
Module example4.
#[module="Peano",prefix="Peano_"]
derive Inductive peano := Zero | Succ (p : peano).
Print peano.
(* Notation Peano := Peano.peano *)
Print Peano.peano.
(* Inductive peano : Set := Zero : peano | Succ : peano -> peano *)
Print Module Peano.
Eval compute in Peano.Peano_eqb Zero (Succ Zero).
(* = false : bool *)
Check Peano.Peano_eqb_OK.
(* Peano.Peano_eqb_OK : forall x1 x2 : peano, reflect (x1 = x2) (eqb x1 x2) *)
End example4.
Module example5.
#[prefix=""]
derive Inductive peano := Zero | Succ (p : peano).
Print peano.
(* Inductive peano : Set := Zero : peano | Succ : peano -> peano *)
Eval compute in eqb Zero (Succ Zero).
(* = false : bool *)
Check eqb_OK.
(* eqb_OK : forall x1 x2 : peano, reflect (x1 = x2) (eqb x1 x2) *)
End example5.
Module example6.
#[module=Peano,no_alias]
derive Inductive peano := Zero | Succ (p : peano).
Fail Print peano.
Print Peano.peano.
(* Inductive peano : Set := Peano.Zero : peano | Peano.Succ : peano -> peano *)
Eval compute in Peano.eqb Peano.Zero (Peano.Succ Peano.Zero).
(* = false : bool *)
Check Peano.eqb_OK.
(* Peano.eqb_OK : forall x1 x2 : peano, reflect (x1 = x2) (eqb x1 x2) *)
End example6.
Fail #[no_alias]
derive Inductive peano := Zero | Succ (p : peano).