-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlistings-coq.tex
151 lines (146 loc) · 4.71 KB
/
listings-coq.tex
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
%% https://github.com/nickgian/thesis/blob/master/lstcoq.sty
\usepackage{color}
\definecolor{ltblue}{rgb}{0,0.4,0.4}
\definecolor{dkblue}{rgb}{0,0.1,0.6}
\definecolor{dkgreen}{rgb}{0,0.35,0}
\definecolor{dkviolet}{rgb}{0.3,0,0.5}
\definecolor{dkred}{rgb}{0.5,0,0}
% lstlisting coq style (inspired from a file of Assia Mahboubi)
%
\lstdefinelanguage{Coq}{
%
% Anything betweeen $ becomes LaTeX math mode
mathescape=true,
%
% Comments may or not include Latex commands
texcl=false,
%
% Vernacular commands
morekeywords=[1]{Section, Module, End, Require, Import, Export,
Variable, Variables, Parameter, Parameters, Axiom, Hypothesis,
Hypotheses, Notation, Local, Tactic, Reserved, Scope, Open, Close,
Bind, Delimit, Definition, Let, Ltac, Fixpoint, CoFixpoint, Add,
Morphism, Relation, Implicit, Arguments, Unset, Contextual,
Strict, Prenex, Implicits, Inductive, CoInductive, Record,
Structure, Canonical, Coercion, Context, Class, Global, Instance,
Program, Infix, Theorem, Lemma, Corollary, Proposition, Fact,
Remark, Example, Proof, Goal, Save, Qed, Defined, Hint, Resolve,
Rewrite, View, Search, Show, Print, Printing, All, Eval, Check,
Projections, inside, outside, Def},
%
% Gallina
morekeywords=[2]{forall, exists, exists2, fun, fix, cofix, struct,
match, with, end, as, in, return, let, if, is, then, else, for, of,
nosimpl, when},
%
% Sorts
morekeywords=[3]{Type, Prop, Set, true, false, option},
%
% Various tactics, some are std Coq subsumed by ssr, for the manual purpose
morekeywords=[4]{pose, set, move, case, elim, apply, clear, hnf,
intro, intros, generalize, rename, pattern, after, destruct,
induction, using, refine, inversion, injection, rewrite, setoid_rewrite, congr,
unlock, compute, ring, field, fourier, replace, setoid_replace, fold, unfold,
change, cutrewrite, simpl, have, suff, wlog, suffices, without,
loss, nat_norm, assert, cut, trivial, revert, bool_congr, nat_congr,
symmetry, transitivity, auto, split, left, right, autorewrite},
%
% Terminators
morekeywords=[5]{by, done, exact, reflexivity, tauto, romega, omega,
assumption, solve, contradiction, discriminate},
%
% Control
morekeywords=[6]{do, last, first, try, idtac, repeat},
%
% Comments delimiters, we do turn this off for the manual
morecomment=[s]{(*}{*)},
%
% Spaces are not displayed as a special character
showstringspaces=false,
%
% String delimiters
morestring=[b]",
morestring=[d],
%
% Size of tabulations
tabsize=3,
%
% Enables ASCII chars 128 to 255
extendedchars=false,
%
% Case sensitivity
sensitive=true,
%
% Automatic breaking of long lines
breaklines=false,
%
% Default style fors listings
basicstyle=\small,
%
% Position of captions is bottom
captionpos=b,
%
% flexible columns
basewidth={2em, 0.5em},
columns=flexible,
%
% Style for (listings') identifiers
identifierstyle={\ttfamily\color{black}},
% Style for declaration keywords
keywordstyle=[1]{\ttfamily\bfseries\color{dkviolet}},
% Style for gallina keywords
keywordstyle=[2]{\ttfamily\bfseries\color{dkgreen}},
% Style for sorts keywords
keywordstyle=[3]{\ttfamily\bfseries\color{ltblue}},
% Style for tactics keywords
keywordstyle=[4]{\ttfamily\color{dkblue}},
% Style for terminators keywords
keywordstyle=[5]{\ttfamily\color{dkred}},
%Style for iterators
%keywordstyle=[6]{\ttfamily\color{dkpink}},
% Style for strings
stringstyle=\ttfamily,
% Style for comments
commentstyle={\ttfamily\itshape\color{dkgreen}},
%
%moredelim=**[is][\ttfamily\color{red}]{/&}{&/},
literate=
{fun}{{\color{dkgreen}{$\lambda\;$}}}1
{bool}{{$\mathbb{B}$}}1
{nat}{{$\mathbb{N}$}}1
{Vforall2}{Vforall2}1 % quick workardoun to avoid partial replacement of 'forall' in identifier
{nat\_equiv}{nat\_equiv}1 % quick workardoun to avoid partial replacement of 'nat' in identifier
{forall}{{\color{dkgreen}{$\forall\;$}}}1
{exists}{{$\exists\;$}}1
{<-}{{$\leftarrow\;\;$}}1
{=>}{{$\Rightarrow\;\;$}}1
{==}{{\texttt{==}\;}}1
{==>}{{$\Longrightarrow\;\;$}}1
% {:>}{{\texttt{:>}\;}}1
{->}{{$\rightarrow\;\;$}}1
{<-->}{{$\longleftrightarrow\;\;$}}1
{<->}{{$\leftrightarrow\;\;$}}1
{<==}{{$\leq\;\;$}}1
{\#}{{$^\star$}}1
{\\o}{{$\circ\;$}}1
% {\@}{{$\cdot$}}1
{\/\\}{{$\wedge\;$}}1
{\\\/}{{$\vee\;$}}1
{++}{{\texttt{++}}}1
{~}{{\ }}1
{¬}{{$\lnot$}}1 % this does not work
{\@\@}{{$@$}}1
{\\mapsto}{{$\mapsto\;$}}1
{\\hline}{{\rule{\linewidth}{0.5pt}}}1
%
}[keywords,comments,strings]
\lstnewenvironment{coq}{\lstset{language=Coq}}{}
% pour inliner dans le texte
\def\coqe{\lstinline[language=Coq, basicstyle=\small]}
% pour inliner dans les tableaux / displaymath...
\def\coqes{\lstinline[language=Coq, basicstyle=\scriptsize]}
%%% Local Variables:
%%% mode: latex
%%% Local IspellDict: british
%%% TeX-master: "main.tex"
%%% End: