~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to refman/coqdoc.tex

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
%\newcommand{\Coq}{\textsf{Coq}}
3
 
\newcommand{\javadoc}{\textsf{javadoc}}
4
 
\newcommand{\ocamldoc}{\textsf{ocamldoc}}
5
 
\newcommand{\coqdoc}{\textsf{coqdoc}}
6
 
\newcommand{\texmacs}{\TeX{}macs}
7
 
\newcommand{\monurl}[1]{#1}
8
 
%HEVEA\renewcommand{\monurl}[1]{\ahref{#1}{#1}}
9
 
%HEVEA\newcommand{\lnot}{not}
10
 
%HEVEA\newcommand{\lor}{or}
11
 
%HEVEA\newcommand{\land}{\&}
12
 
%%% attention : -- dans un argument de \texttt est affich� comme un
13
 
%%% seul - d'o� l'utilisation de la macro suivante
14
 
\newcommand{\mm}{\symbol{45}\symbol{45}}
15
 
 
16
 
 
17
 
\coqdoc\ is a documentation tool for the proof assistant
18
 
\Coq, similar to \javadoc\ or \ocamldoc. 
19
 
The task of \coqdoc\ is
20
 
\begin{enumerate}
21
 
\item to produce a nice \LaTeX\ and/or HTML document from the \Coq\ 
22
 
  sources, readable for a human and not only for the proof assistant;
23
 
\item to help the user navigating in his own (or third-party) sources.
24
 
\end{enumerate}
25
 
 
26
 
 
27
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
 
 
29
 
\subsection{Principles}
30
 
 
31
 
Documentation is inserted into \Coq\ files as \emph{special comments}.  
32
 
Thus your files will compile as usual, whether you use \coqdoc\ or not.
33
 
\coqdoc\ presupposes that the given \Coq\ files are well-formed (at
34
 
least lexically).  Documentation starts with
35
 
\texttt{(**}, followed by a space, and ends with the pending \texttt{*)}. 
36
 
The documentation format is inspired
37
 
  by Todd~A.~Coram's \emph{Almost Free Text (AFT)} tool: it is mainly
38
 
ASCII text with some syntax-light controls, described below.
39
 
\coqdoc\ is robust: it shouldn't fail, whatever the input is. But
40
 
remember: ``garbage in, garbage out''.
41
 
 
42
 
\paragraph{\Coq\ material inside documentation.}
43
 
\Coq\ material is quoted between the
44
 
delimiters \texttt{[} and \texttt{]}. Square brackets may be nested,
45
 
the inner ones being understood as being part of the quoted code (thus
46
 
you can quote a term like $[x:T]u$ by writing
47
 
\texttt{[[x:T]u]}). Inside quotations, the code is pretty-printed in
48
 
the same way as it is in code parts.
49
 
 
50
 
Pre-formatted vernacular is enclosed by \texttt{[[} and
51
 
\texttt{]]}. The former must be followed by a newline and the latter
52
 
must follow a newline.
53
 
 
54
 
\paragraph{Pretty-printing.}
55
 
\coqdoc\ uses different faces for identifiers and keywords.  
56
 
The pretty-printing of \Coq\ tokens (identifiers or symbols) can be
57
 
controlled using one of the following commands:
58
 
\begin{alltt}
59
 
(** printing \emph{token} %...\LaTeX...% #...HTML...# *)
60
 
\end{alltt}
61
 
or
62
 
\begin{alltt}
63
 
(** printing \emph{token} $...\LaTeX\ math...$ #...HTML...# *)
64
 
\end{alltt}
65
 
It gives the \LaTeX\ and HTML texts to be produced for the given \Coq\
66
 
token. One of the \LaTeX\ or HTML text may be ommitted, causing the
67
 
default pretty-printing to be used for this token.
68
 
 
69
 
The printing for one token can be removed with
70
 
\begin{alltt}
71
 
(** remove printing \emph{token} *)
72
 
\end{alltt}
73
 
 
74
 
Initially, the pretty-printing table contains the following mapping:
75
 
\begin{center}
76
 
  \begin{tabular}{ll@{\qquad\qquad}ll@{\qquad\qquad}ll@{\qquad\qquad}}
77
 
    \verb!->!            & $\rightarrow$   &
78
 
    \verb!<-!            & $\leftarrow$    &
79
 
    \verb|*|             & $\times$        \\
80
 
    \verb|<=|            & $\le$           &
81
 
    \verb|>=|            & $\ge$           &
82
 
    \verb|=>|            & $\Rightarrow$   \\
83
 
    \verb|<>|            & $\not=$         &
84
 
    \verb|<->|           & $\leftrightarrow$ &
85
 
    \verb!|-!            & $\vdash$        \\
86
 
    \verb|\/|            & $\lor$          &
87
 
    \verb|/\|            & $\land$         &
88
 
    \verb|~|             & $\lnot$ 
89
 
  \end{tabular}
90
 
\end{center}
91
 
Any of these can be overwritten or suppressed using the
92
 
\texttt{printing} commands.
93
 
 
94
 
Important note: the recognition of tokens is done by a (ocaml)lex
95
 
automaton and thus applies the longest-match rule. For instance,
96
 
\verb!->~! is recognized as a single token, where \Coq\ sees two
97
 
tokens. It is the responsability of the user to insert space between
98
 
tokens \emph{or} to give pretty-printing rules for the possible
99
 
combinations, e.g. 
100
 
\begin{verbatim}
101
 
(** printing ->~ %\ensuremath{\rightarrow\lnot}% *)
102
 
\end{verbatim}
103
 
 
104
 
 
105
 
\paragraph{Sections.}
106
 
Sections are introduced by 1 to 4 leading stars (i.e. at the beginning of the
107
 
line). One star is a section, two stars a sub-section, etc.
108
 
The section title is given on the remaining of the line.
109
 
Example:
110
 
\begin{verbatim}
111
 
    (** * Well-founded relations
112
 
  
113
 
        In this section, we introduce...  *)
114
 
\end{verbatim}
115
 
 
116
 
 
117
 
%TODO \paragraph{Fonts.}
118
 
 
119
 
 
120
 
\paragraph{Lists.}
121
 
List items are introduced by 1 to 4 leading dashes.
122
 
Deepness of the list is indicated by the number of dashes.
123
 
List ends with a blank line.
124
 
Example:
125
 
\begin{verbatim}
126
 
    This module defines
127
 
        - the predecessor [pred]
128
 
        - the addition [plus]
129
 
        - order relations:
130
 
          -- less or equal [le]
131
 
          -- less [lt]
132
 
\end{verbatim}
133
 
 
134
 
\paragraph{Rules.}
135
 
More than 4 leading dashes produce an horizontal rule.
136
 
 
137
 
 
138
 
\paragraph{Escapings to \LaTeX\ and HTML.}
139
 
Pure \LaTeX\ or HTML material can be inserted using the following
140
 
escape sequences:
141
 
\begin{itemize}
142
 
\item \verb+$...LaTeX stuff...$+ inserts some \LaTeX\ material in math mode.
143
 
  Simply discarded in HTML output.
144
 
 
145
 
\item \verb+%...LaTeX stuff...%+ inserts some \LaTeX\ material.
146
 
  Simply discarded in HTML output.
147
 
 
148
 
\item \verb+#...HTML stuff...#+ inserts some HTML material. Simply
149
 
  discarded in \LaTeX\ output.
150
 
\end{itemize}
151
 
 
152
 
 
153
 
\paragraph{Verbatim.} 
154
 
Verbatim material is introduced by a leading \verb+<<+ and closed by
155
 
\verb+>>+. Example:
156
 
\begin{verbatim}
157
 
Here is the corresponding caml code:
158
 
<<
159
 
  let rec fact n = 
160
 
    if n <= 1 then 1 else n * fact (n-1)
161
 
>>
162
 
\end{verbatim}
163
 
 
164
 
 
165
 
\paragraph{Hyperlinks.}
166
 
Hyperlinks can be inserted into the HTML output, so that any
167
 
identifier is linked to the place of its definition.
168
 
 
169
 
In order to get hyperlinks you need to first compile your \Coq\ file
170
 
using \texttt{coqc \mm{}dump-glob \emph{file}}; this appends 
171
 
\Coq\ names resolutions done during the compilation to file
172
 
\texttt{\emph{file}}. Take care of erasing this file, if any, when
173
 
starting the whole compilation process.
174
 
 
175
 
Then invoke \texttt{coqdoc \mm{}glob-from \emph{file}} to tell
176
 
\coqdoc\ to look for name resolutions into the file \texttt{\emph{file}}.
177
 
 
178
 
Identifiers from the \Coq\ standard library are linked to the \Coq\
179
 
web site at \url{http://coq.inria.fr/library/}. This behavior can be
180
 
changed using command line options \url{--no-externals} and
181
 
\url{--coqlib}; see below.
182
 
 
183
 
 
184
 
\paragraph{Hiding / Showing parts of the source.}
185
 
Some parts of the source can be hidden using command line options
186
 
\texttt{-g} and \texttt{-l} (see below), or using such comments:
187
 
\begin{alltt}
188
 
(* begin hide *)
189
 
\emph{some Coq material}
190
 
(* end hide *)
191
 
\end{alltt}
192
 
Conversely, some parts of the source which would be hidden can be
193
 
shown using such comments: 
194
 
\begin{alltt}
195
 
(* begin show *)
196
 
\emph{some Coq material}
197
 
(* end show *)
198
 
\end{alltt}
199
 
The latter cannot be used around some inner parts of a proof, but can
200
 
be used around a whole proof.
201
 
 
202
 
 
203
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204
 
 
205
 
\subsection{Usage}
206
 
 
207
 
\coqdoc\ is invoked on a shell command line as follows:
208
 
\begin{displaymath}
209
 
  \texttt{coqdoc }<\textit{options and files}>
210
 
\end{displaymath}
211
 
Any command line argument which is not an option is considered to be a
212
 
file (even if it starts with a \verb!-!). \Coq\ files are identified
213
 
by the suffixes \verb!.v! and \verb!.g! and \LaTeX\ files by the
214
 
suffix \verb!.tex!. 
215
 
 
216
 
\begin{description}
217
 
\item[HTML output] ~\par
218
 
  This is the default output.
219
 
  One HTML file is created for each \Coq\ file given on the command line,
220
 
  together with a file \texttt{index.html} (unless option
221
 
  \texttt{-no-index} is passed). The HTML pages use a style sheet
222
 
  named \texttt{style.css}. Such a file is distributed with \coqdoc.
223
 
 
224
 
\item[\LaTeX\ output] ~\par
225
 
  A single \LaTeX\ file is created, on standard output. It can be
226
 
  redirected to a file with option \texttt{-o}. 
227
 
  The order of files on the command line is kept in the final
228
 
  document. \LaTeX\ files given on the command line are copied `as is'
229
 
  in the final document .
230
 
  DVI and PostScript can be produced directly with the options
231
 
  \texttt{-dvi} and \texttt{-ps} respectively.
232
 
 
233
 
\item[\texmacs\ output] ~\par
234
 
  To translate the input files to \texmacs\ format, to be used by
235
 
  the \texmacs\ Coq interface 
236
 
  (see \url{http://www-sop.inria.fr/lemme/Philippe.Audebaud/tmcoq/}).
237
 
\end{description}
238
 
 
239
 
 
240
 
\subsubsection*{Command line options}
241
 
 
242
 
 
243
 
\paragraph{Overall options}
244
 
 
245
 
\begin{description}
246
 
 
247
 
\item[\texttt{\mm{}html}] ~\par
248
 
  
249
 
  Select a HTML output.
250
 
 
251
 
\item[\texttt{\mm{}latex}] ~\par
252
 
  
253
 
  Select a \LaTeX\ output.
254
 
 
255
 
\item[\texttt{\mm{}dvi}] ~\par
256
 
  
257
 
  Select a DVI output.
258
 
 
259
 
\item[\texttt{\mm{}ps}] ~\par
260
 
  
261
 
  Select a PostScript output.
262
 
 
263
 
\item[\texttt{\mm{}texmacs}] ~\par
264
 
  
265
 
  Select a \texmacs\ output.
266
 
 
267
 
\item[\texttt{--stdout}] ~\par
268
 
 
269
 
  Write output to stdout.
270
 
 
271
 
\item[\texttt{-o }\textit{file}, \texttt{\mm{}output }\textit{file}] ~\par
272
 
  
273
 
  Redirect the output into the file `\textit{file}' (meaningless with
274
 
  \texttt{-html}).
275
 
 
276
 
\item[\texttt{-d }\textit{dir}, \texttt{\mm{}directory }\textit{dir}] ~\par
277
 
 
278
 
  Output files into directory `\textit{dir}' instead of current
279
 
  directory (option \texttt{-d} does not change the filename specified
280
 
  with option \texttt{-o}, if any).
281
 
 
282
 
\item[\texttt{-s }, \texttt{\mm{}short}] ~\par
283
 
  
284
 
  Do not insert titles for the files. The default behavior is to
285
 
  insert a title like ``Library Foo'' for each file.
286
 
 
287
 
\item[\texttt{-t }\textit{string}, 
288
 
      \texttt{\mm{}title }\textit{string}] ~\par
289
 
  
290
 
  Set the document title.      
291
 
 
292
 
\item[\texttt{\mm{}body-only}] ~\par
293
 
 
294
 
  Suppress the header and trailer of the final document. Thus, you can
295
 
  insert the resulting document into a larger one.
296
 
 
297
 
\item[\texttt{-p} \textit{string}, \texttt{\mm{}preamble} \textit{string}]~\par
298
 
 
299
 
  Insert some material in the \LaTeX\ preamble, right before
300
 
  \verb!\begin{document}! (meaningless with \texttt{-html}).
301
 
 
302
 
\item[\texttt{\mm{}vernac-file }\textit{file},
303
 
      \texttt{\mm{}tex-file }\textit{file}] ~\par
304
 
      
305
 
      Considers the file `\textit{file}' respectively as a \verb!.v!
306
 
      (or \verb!.g!) file or a \verb!.tex! file.
307
 
 
308
 
\item[\texttt{\mm{}files-from }\textit{file}] ~\par
309
 
 
310
 
  Read file names to process in file `\textit{file}' as if they were
311
 
  given on the command line. Useful for program sources splitted in
312
 
  several directories.
313
 
  
314
 
\item[\texttt{-q}, \texttt{\mm{}quiet}] ~\par
315
 
 
316
 
  Be quiet. Do not print anything except errors.
317
 
 
318
 
\item[\texttt{-h}, \texttt{\mm{}help}] ~\par
319
 
 
320
 
  Give a short summary of the options and exit.
321
 
 
322
 
\item[\texttt{-v}, \texttt{\mm{}version}] ~\par
323
 
 
324
 
  Print the version and exit.
325
 
 
326
 
\end{description}
327
 
 
328
 
\paragraph{Index options} ~\par
329
 
 
330
 
Default behavior is to build an index, for the HTML output only, into
331
 
\texttt{index.html}.
332
 
 
333
 
\begin{description}
334
 
 
335
 
\item[\texttt{\mm{}no-index}] ~\par
336
 
  
337
 
  Do not output the index.
338
 
 
339
 
\item[\texttt{\mm{}multi-index}] ~\par
340
 
  
341
 
  Generate one page for each category and each letter in the index,
342
 
  together with a top page \texttt{index.html}.
343
 
 
344
 
\end{description}
345
 
 
346
 
\paragraph{Table of contents option} ~\par
347
 
 
348
 
\begin{description}
349
 
 
350
 
\item[\texttt{-toc}, \texttt{\mm{}table-of-contents}] ~\par
351
 
 
352
 
  Insert a table of contents.
353
 
  For a \LaTeX\ output, it inserts a \verb!\tableofcontents! at the
354
 
  beginning of the document. For a HTML output, it builds a table of
355
 
  contents into \texttt{toc.html}.
356
 
 
357
 
\end{description}
358
 
 
359
 
\paragraph{Hyperlinks options}
360
 
\begin{description}
361
 
 
362
 
\item[\texttt{\mm{}glob-from }\textit{file}] ~\par
363
 
  
364
 
  Make references using \Coq\ globalizations from file \textit{file}. 
365
 
  (Such globalizations are obtained with \Coq\ option \texttt{-dump-glob}).
366
 
 
367
 
\item[\texttt{\mm{}no-externals}] ~\par
368
 
  
369
 
  Do not insert links to the \Coq\ standard library.
370
 
 
371
 
\item[\texttt{\mm{}coqlib }\textit{url}] ~\par
372
 
 
373
 
  Set base URL for the \Coq\ standard library (default is 
374
 
  \url{http://coq.inria.fr/library/}).
375
 
 
376
 
\item[\texttt{-R }\textit{dir }\textit{coqdir}] ~\par
377
 
 
378
 
  Map physical directory \textit{dir} to \Coq\ logical directory
379
 
  \textit{coqdir} (similarly to \Coq\ option \texttt{-R}).
380
 
 
381
 
  Note: option \texttt{-R} only has effect on the files
382
 
  \emph{following} it on the command line, so you will probably need
383
 
  to put this option first.
384
 
 
385
 
\end{description}
386
 
 
387
 
\paragraph{Contents options}
388
 
\begin{description}
389
 
 
390
 
\item[\texttt{-g}, \texttt{\mm{}gallina}] ~\par
391
 
 
392
 
  Do not print proofs.
393
 
 
394
 
\item[\texttt{-l}, \texttt{\mm{}light}] ~\par
395
 
  
396
 
  Light mode. Suppress proofs (as with \texttt{-g}) and the following commands:
397
 
  \begin{itemize}
398
 
  \item {}[\texttt{Recursive}] \texttt{Tactic Definition}
399
 
  \item \texttt{Hint / Hints} 
400
 
  \item \texttt{Require}
401
 
  \item \texttt{Transparent / Opaque}
402
 
  \item \texttt{Implicit Argument / Implicits}
403
 
  \item \texttt{Section / Variable / Hypothesis / End}
404
 
  \end{itemize}
405
 
 
406
 
\end{description}
407
 
The behavior of options \texttt{-g} and \texttt{-l} can be locally
408
 
overridden using the \texttt{(* begin show *)} \dots\ \texttt{(* end
409
 
  show *)} environment (see above).
410
 
 
411
 
\paragraph{Language options} ~\par
412
 
 
413
 
Default behavior is to assume ASCII 7 bits input files.
414
 
 
415
 
\begin{description}
416
 
 
417
 
\item[\texttt{-latin1}, \texttt{\mm{}latin1}] ~\par
418
 
 
419
 
  Select ISO-8859-1 input files. It is equivalent to
420
 
  \texttt{--inputenc latin1 --charset iso-8859-1}.
421
 
 
422
 
\item[\texttt{-utf8}, \texttt{\mm{}utf8}] ~\par
423
 
 
424
 
  Select UTF-8 (Unicode) input files. It is equivalent to
425
 
  \texttt{--inputenc utf8 --charset utf-8}.
426
 
  \LaTeX\ UTF-8 support can be found at
427
 
 \url{http://www.ctan.org/tex-archive/macros/latex/contrib/supported/unicode/}.
428
 
 
429
 
\item[\texttt{\mm{}inputenc} \textit{string}] ~\par
430
 
 
431
 
  Give a \LaTeX\ input encoding, as an option to \LaTeX\ package
432
 
  \texttt{inputenc}. 
433
 
 
434
 
\item[\texttt{\mm{}charset} \textit{string}] ~\par
435
 
 
436
 
  Specify the HTML character set, to be inserted in the HTML header.
437
 
 
438
 
\end{description}
439
 
 
440
 
 
441
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
442
 
 
443
 
\subsection{The coqdoc \LaTeX{} style file}
444
 
\label{section:coqdoc.sty}
445
 
 
446
 
In case you choose to produce a document without the default \LaTeX{}
447
 
preamble (by using option \verb|--no-preamble|), then you must insert
448
 
into your own preamble the command
449
 
\begin{quote}
450
 
  \verb|\usepackage{coqdoc}|
451
 
\end{quote}
452
 
Then you may alter the rendering of the document by
453
 
redefining some macros:
454
 
\begin{description}
455
 
 
456
 
\item[\texttt{coqdockw}, \texttt{coqdocid}] ~ 
457
 
  
458
 
  The one-argument macros for typesetting keywords and identifiers.
459
 
  Defaults are sans-serif for keywords and italic for identifiers.
460
 
 
461
 
  For example, if you would like a slanted font for keywords, you
462
 
  may insert  
463
 
\begin{verbatim}
464
 
     \renewcommand{\coqdockw}[1]{\textsl{#1}}
465
 
\end{verbatim}
466
 
  anywhere between \verb|\usepackage{coqdoc}| and
467
 
  \verb|\begin{document}|. 
468
 
 
469
 
\item[\texttt{coqdocmodule}] ~ 
470
 
  
471
 
  One-argument macro for typesetting the title of a \verb|.v| file.
472
 
  Default is
473
 
\begin{verbatim}
474
 
\newcommand{\coqdocmodule}[1]{\section*{Module #1}}
475
 
\end{verbatim}
476
 
  and you may redefine it using \verb|\renewcommand|.
477
 
 
478
 
\end{description}
479
 
 
480