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
101
102
103
104
|
(** PARSER TESTS *)
(** Check correct separation of identifiers followed by unicode symbols *)
Notation "x ⊕ w" := (plus x w) (at level 30).
Check fun x => x⊕x.
(** Check Greek letters *)
Definition test_greek : nat -> nat := fun Δ => Δ.
Parameter ℝ : Set.
Parameter π : ℝ.
(** Check indices *)
Definition test_indices : nat -> nat := fun x₁ => x₁.
Definition π₂ := snd.
(** More unicode in identifiers *)
Definition αβ_áà_אב := 0.
(** UNICODE IN STRINGS *)
Require Import List Ascii String.
Open Scope string_scope.
Definition test_string := "azertyαβ∀ééé".
Eval compute in length test_string.
(** last six "chars" are unicode, hence represented by 2 bytes,
except the forall which is 3 bytes *)
Fixpoint string_to_list s :=
match s with
| EmptyString => nil
| String c s => c :: string_to_list s
end.
Eval compute in (string_to_list test_string).
(** for instance, α is \206\177 whereas ∀ is \226\136\128 *)
Close Scope string_scope.
(** INTERFACE TESTS *)
Require Import Utf8.
(** Printing of unicode notation, in *goals* *)
Lemma test : forall A:Prop, A -> A.
Proof.
auto.
Qed.
(** Parsing of unicode notation, in *goals* *)
Lemma test2 : ∀A:Prop, A → A.
Proof.
intro.
intro.
auto.
Qed.
(** Printing of unicode notation, in *response* *)
Check fun (X:Type)(x:X) => x.
(** Parsing of unicode notation, in *response* *)
Check ∀Δ, Δ → Δ.
Check ∀x, x=0 ∨ x=0 → x=0.
(** ISSUES: *)
Notation "x ≠ y" := (x<>y) (at level 70).
Notation "x ≤ y" := (x<=y) (at level 70, no associativity).
(** First Issue : ≤ is attached to "le" of nat, not to notation <= *)
Require Import ZArith.
Open Scope Z_scope.
Locate "≤". (* still le, not Zle *)
Notation "x ≤ y" := (x<=y) (at level 70, no associativity).
Locate "≤".
Close Scope Z_scope.
(** ==> How to proceed modularly ? *)
(** Second Issue : notation for -> generates useless parenthesis
if followed by a binder *)
Check 0≠0 → ∀x:nat,x=x.
(** Example of real situation : *)
Definition pred : ∀x, x≠0 → ∃y, x = S y.
Proof.
destruct x.
destruct 1; auto.
intros _.
exists x; auto.
Defined.
Print pred.
|