XComposeAndNotations - coq/coq GitHub Wiki
In Coq, you can use notations to have fancy (and/or more readable) way to write your code in Coq. Here is an example of what you can have:
Set Implicit Arguments.
Record set (A: Type): Type :=
Comprehension {In: A -> Prop}.
Delimit Scope set_scope with set.
Open Scope set_scope.
Notation "{ x : s 'ο¬' P }" :=
({|In:=Ξ» (x: s), P|}) (at level 10, x at level 69): set_scope.
Notation "{ x 'ο¬' P }" := ({x:_ ο¬ P}) (at level 10, x at level 69): set_scope.
Notation "x β X" := (X.(In) x) (at level 40): set_scope.
Notation "x β X" := (Β¬(x β X)) (at level 40): set_scope.
Notation "X β Y" := (β x, x β X β x β Y) (at level 40): set_scope.
Notation "X β‘ Y" := (XβY β§ YβX) (at level 40): set_scope.
Notation "X βͺ Y" := ({x ο¬ x β X β¨ x β Y}) (at level 55): set_scope.
Notation "X β© Y" := ({x ο¬ x β X β§ x β Y}) (at level 50): set_scope.
Notation "β X" := ({x ο¬ β y, x β y β§ y β X}) (at level 35): set_scope.
Notation "β X" := ({x ο¬ β y, y β X β x β y}) (at level 30): set_scope.
Notation "f β»ΒΉ Ξ£" := ({x ο¬ (f x) β Ξ£}) (at level 5): set_scope.
Notation "β A" := ({x ο¬ x β A}) (at level 5): set_scope.
Definition empty_set (A: Type) := {x: A ο¬ β₯}.
Definition full_set (A: Type) := {x: A ο¬ β€}.
Notation "β s" := (empty_set s) (at level 5): set_scope.
Notation "β s" := (full_set s) (at level 5): set_scope.
Definition finite_union {A: Type} (f: nat -> set A) :=
fix finite_union n :=
match n with
| O => βA
| S k => (f k) βͺ (finite_union k)
end.
Axiom Extensionnality: β (S: Type) (Ο1 Ο2: set S), Ο1 β‘ Ο2 β Ο1 = Ο2.
Class Topology (S: Type): Type :=
{ O: set (set S);
Hempty: βS β O;
Hall: βS β O;
Hinter: β Ο1 Ο2, (Ο1 β O) β (Ο2 β O) β (Ο1 β© Ο2) β O;
HUNION: β Οs, (β Ο, (Ο β Οs) β (Ο β O)) β (βΟs) β O
}.
Definition Compact {A: Type} {Ξ©A: Topology A} a :=
β os, (a β βos β§ (β o, (o β os) β (o β O))) β
β subos, β n, (β m, m<n β (subos m) β os) β§ a β (finite_union subos n).
Definition Separables {A: Type} {Ξ©A: Topology A} x y :=
β ox, β oy,
((y β oy) β§ (oy β O)) β§
((x β ox) β§ (ox β O)) β§
(ox β βoy).
Lemma compacts_are_closed:
β A {Ξ©A: Topology A}, (β x y, x β y β Separables x y) β
β a, Compact a β (βa β O).
It seems cool, but how to have a way to input such a code in (almost) any editor under X? A good way is to have a "XIM" compliant editor (under X, almost any editor is XIM compliant; so it is the case for emacs, xterm, url in firefox, β¦), then following some tutorials on XCompose, you can have some cool stuff:
echo 'GTK_IM_MODULE=xim' >> $PROFILE
echo 'QT_IM_MODULE=xim' >> $PROFILE
echo 'XMODIFIERS=@im=xim' >> $PROFILE
where $PROFILE is "/.profile" or "/.xinitrc" (or any script file run at logging time under X).
Now, if you do not have a "<Multi-key>", it can be (although not necessary) to define one:
echo 'keycode 117 = Multi_key' >> ~/.Xmodmap
To know the keycode you want, you can use xev.
Now create or edit "~/.XCompose" to have your wished compositions:
echo 'include "~/.XCompose.my_symbols"' >> ~/.XCompose
touch ~/.XCompose.my_symbols
Now, you have to edit this file to have your own compositions. Take a look at the official webpage of unicode to find the unicode codes you want.
The expected format is:
[non_empty_list_of_keys_or_unicode_name] : [optional """utf8-encoded-character"""] [optional unicode-name] [optional "U"unicode-code]
for instance:
echo '<Multi_key> <a> <l> <l> : "β" U2200' >> ~/.XCompose.my_symbols
Finally restart your X server, and all should work.