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

« back to all changes in this revision

Viewing changes to refman/RefMan-oth.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
 
\chapter{Vernacular commands}
2
 
\label{Vernacular-commands}
3
 
\label{Other-commands}
4
 
 
5
 
\section{Displaying}
6
 
 
7
 
\subsection{\tt Print {\qualid}.}\comindex{Print}
8
 
This command displays on the screen informations about the declared or
9
 
defined object referred by {\qualid}.
10
 
 
11
 
\begin{ErrMsgs}
12
 
\item {\qualid} \errindex{not a defined object}
13
 
\end{ErrMsgs}
14
 
 
15
 
\begin{Variants}
16
 
\item {\tt Print Term {\qualid}.}
17
 
\comindex{Print Term}\\ 
18
 
This is a synonym to {\tt Print {\qualid}} when {\qualid} denotes a
19
 
global constant. 
20
 
 
21
 
\item {\tt About {\qualid}.}
22
 
\label{About}
23
 
\comindex{About}\\ 
24
 
This displays various informations about the object denoted by {\qualid}:
25
 
its kind (module, constant, assumption, inductive,
26
 
constructor, abbreviation\ldots), long name, type, implicit
27
 
arguments and argument scopes.
28
 
 
29
 
%\item {\tt Print Proof {\qualid}.}\comindex{Print Proof}\\
30
 
%In case \qualid\ denotes an opaque theorem defined in a section,
31
 
%it is stored on a special unprintable form and displayed as 
32
 
%{\tt <recipe>}. {\tt Print Proof} forces the printable form of \qualid\
33
 
%to be computed and displays it.
34
 
\end{Variants}
35
 
 
36
 
\subsection{\tt Print All.}\comindex{Print All}
37
 
This command displays informations about the current state of the
38
 
environment, including sections and modules.
39
 
 
40
 
\begin{Variants}
41
 
\item {\tt Inspect \num.}\comindex{Inspect}\\
42
 
This command displays the {\num} last objects of the current
43
 
environment, including sections and modules.
44
 
\item {\tt Print Section {\ident}.}\comindex{Print Section}\\
45
 
should correspond to a currently open section, this command
46
 
displays the objects defined since the beginning of this section.
47
 
% Discontinued
48
 
%% \item {\tt Print.}\comindex{Print}\\
49
 
%% This command displays the axioms and variables declarations in the
50
 
%% environment as well as the constants defined since the last variable
51
 
%% was introduced.
52
 
\end{Variants}
53
 
 
54
 
\section{Requests to the environment}
55
 
 
56
 
\subsection{\tt Check {\term}.}
57
 
\label{Check}
58
 
\comindex{Check}
59
 
This command displays the type of {\term}. When called in proof mode, 
60
 
the term is checked in the local context of the current subgoal.
61
 
 
62
 
\subsection{\tt Eval {\rm\sl convtactic} in {\term}.}
63
 
\comindex{Eval}
64
 
 
65
 
This command performs the specified reduction on {\term}, and displays
66
 
the resulting term with its type. The term to be reduced may depend on
67
 
hypothesis introduced in the first subgoal (if a proof is in
68
 
progress).
69
 
 
70
 
\SeeAlso section~\ref{Conversion-tactics}.
71
 
 
72
 
\subsection{\tt Extraction \term.}
73
 
\label{ExtractionTerm}
74
 
\comindex{Extraction} 
75
 
This command displays the extracted term from
76
 
{\term}. The extraction is processed according to the distinction
77
 
between {\Set} and {\Prop}; that is to say, between logical and
78
 
computational content (see section \ref{Sorts}). The extracted term is
79
 
displayed in Objective Caml syntax, where global identifiers are still
80
 
displayed as in \Coq\ terms.
81
 
 
82
 
\begin{Variants}
83
 
\item \texttt{Recursive Extraction {\qualid$_1$} \ldots{} {\qualid$_n$}.}\\
84
 
  Recursively extracts all the material needed for the extraction of 
85
 
  globals {\qualid$_1$} \ldots{} {\qualid$_n$}.
86
 
\end{Variants}
87
 
 
88
 
\SeeAlso chapter~\ref{Extraction}.
89
 
 
90
 
\subsection{\tt Opaque \qualid$_1$ \dots \qualid$_n$.}
91
 
\comindex{Opaque}\label{Opaque} This command tells not to unfold the
92
 
the constants {\qualid$_1$} \dots {\qualid$_n$} in tactics using
93
 
$\delta$-conversion. Unfolding a constant is replacing it by its
94
 
definition. {\tt Opaque} can only apply on constants originally
95
 
defined as {\tt Transparent}.
96
 
 
97
 
Constants defined by a proof ended by {\tt Qed} are automatically
98
 
stamped as {\tt Opaque} and can no longer be considered as {\tt
99
 
Transparent}. This is to keep with the usual mathematical practice of
100
 
{\em proof irrelevance}: what matters in a mathematical development is
101
 
the sequence of lemma statements, not their actual proofs. This
102
 
distinguishes lemmas from the usual defined constants, whose actual
103
 
values are of course relevant in general.
104
 
 
105
 
\SeeAlso sections \ref{Conversion-tactics}, \ref{Automatizing},
106
 
\ref{Theorem}
107
 
 
108
 
\begin{ErrMsgs}
109
 
\item \errindex{The reference \qualid\ was not found in the current
110
 
environment}\\
111
 
    There is no constant referred by {\qualid} in the environment.
112
 
    Nevertheless, if you asked \texttt{Opaque foo bar}
113
 
    and if \texttt{bar} does not exist, \texttt{foo} is set opaque.
114
 
\end{ErrMsgs}
115
 
 
116
 
\subsection{\tt Transparent \qualid$_1$ \dots \qualid$_n$.}
117
 
\comindex{Transparent}\label{Transparent}
118
 
This command is the converse of {\tt Opaque} and can only apply on constants originally defined as {\tt Transparent} to restore their initial behaviour after an {\tt Opaque} command.
119
 
 
120
 
The constants automatically declared transparent are the ones defined by a proof ended by {\tt Defined}, or by a {\tt
121
 
  Definition} or {\tt Local} with an explicit body.
122
 
 
123
 
\Warning {\tt Transparent} and \texttt{Opaque} are not synchronous
124
 
with the reset mechanism. If a constant was transparent at point A, if
125
 
you set it opaque at point B and reset to point A, you return to state
126
 
of point A with the difference that the constant is still opaque. This
127
 
can cause changes in tactic scripts behaviour.
128
 
 
129
 
At section or module closing, a constant recovers the status it got at
130
 
the time of its definition.
131
 
 
132
 
%TODO: expliquer le rapport avec les sections
133
 
 
134
 
\begin{ErrMsgs}
135
 
% \item \errindex{Can not set transparent.}\\
136
 
%     It is a constant from a required module or a parameter.
137
 
\item \errindex{The reference \qualid\ was not found in the current
138
 
environment}\\
139
 
    There is no constant referred by {\qualid} in the environment.
140
 
\end{ErrMsgs}
141
 
 
142
 
\SeeAlso sections \ref{Conversion-tactics}, \ref{Automatizing},
143
 
\ref{Theorem}
144
 
 
145
 
\subsection{\tt Search {\qualid}.}\comindex{Search}
146
 
This command displays the name and type of all theorems of the current
147
 
context whose statement's conclusion has the form {\tt ({\qualid} t1 ..
148
 
  tn)}.  This command is useful to remind the user of the name of
149
 
library lemmas.
150
 
\begin{ErrMsgs}
151
 
\item \errindex{The reference \qualid\ was not found in the current
152
 
environment}\\
153
 
    There is no constant in the environment named \qualid.
154
 
\end{ErrMsgs}
155
 
 
156
 
\begin{Variants}
157
 
\item
158
 
{\tt Search {\qualid} inside {\module$_1$} \ldots{} {\module$_n$}.}
159
 
 
160
 
This restricts the search to constructions defined in modules
161
 
{\module$_1$} \ldots{} {\module$_n$}.
162
 
 
163
 
\item {\tt Search {\qualid} outside {\module$_1$} \ldots{} {\module$_n$}.}
164
 
 
165
 
This restricts the search to constructions not defined in modules
166
 
{\module$_1$} \ldots{} {\module$_n$}.
167
 
 
168
 
\begin{ErrMsgs}
169
 
\item \errindex{Module/section \module{} not found}
170
 
No module \module{} has been required (see section~\ref{Require}).
171
 
\end{ErrMsgs}
172
 
 
173
 
\end{Variants}
174
 
 
175
 
\subsection{\tt SearchAbout {\qualid}.}\comindex{SearchAbout}
176
 
This command displays the name and type of all objects (theorems,
177
 
axioms, etc) of the current context whose statement contains \qualid.
178
 
This command is useful to remind the user of the name of library
179
 
lemmas.
180
 
 
181
 
\begin{ErrMsgs}
182
 
\item \errindex{The reference \qualid\ was not found in the current
183
 
environment}\\
184
 
    There is no constant in the environment named \qualid.
185
 
\end{ErrMsgs}
186
 
 
187
 
\begin{Variants}
188
 
\item {\tt SearchAbout [ \nelist{\textrm{\textsl{qualid-or-string}}}{}
189
 
].}\\
190
 
\noindent where {\textrm{\textsl{qualid-or-string}}} is a {\qualid} or
191
 
a {\str}.
192
 
 
193
 
This extension of {\tt SearchAbout} searches for all objects whose
194
 
statement mentions all of {\qualid} of the list and whose name
195
 
contains all {\str} of the list.
196
 
 
197
 
\Example
198
 
 
199
 
\begin{coq_example}
200
 
Require Import ZArith.
201
 
SearchAbout [ Zmult Zplus "distr" ].
202
 
\end{coq_example}
203
 
 
204
 
\item
205
 
\begin{tabular}[t]{@{}l}
206
 
  {\tt SearchAbout {\term} inside {\module$_1$} \ldots{} {\module$_n$}.} \\
207
 
  {\tt SearchAbout [ \nelist{\textrm{\textsl{qualid-or-string}}}{} ]
208
 
    inside {\module$_1$} \ldots{} {\module$_n$}.}
209
 
\end{tabular}
210
 
 
211
 
This restricts the search to constructions defined in modules
212
 
{\module$_1$} \ldots{} {\module$_n$}.
213
 
 
214
 
\item
215
 
\begin{tabular}[t]{@{}l}
216
 
  {\tt SearchAbout {\term} outside {\module$_1$}...{\module$_n$}.} \\
217
 
  {\tt SearchAbout [ \nelist{\textrm{\textsl{qualid-or-string}}}{} ]
218
 
     outside {\module$_1$}...{\module$_n$}.}
219
 
\end{tabular}
220
 
 
221
 
This restricts the search to constructions not defined in modules
222
 
{\module$_1$} \ldots{} {\module$_n$}.
223
 
 
224
 
\end{Variants}
225
 
 
226
 
\subsection{\tt SearchPattern {\term}.}\comindex{SearchPattern}
227
 
 
228
 
This command displays the name and type of all theorems of the current
229
 
context whose statement's conclusion matches the expression {\term}
230
 
where holes in the latter are denoted by ``{\texttt \_}''.
231
 
 
232
 
\begin{coq_example}
233
 
Require Import Arith.
234
 
SearchPattern (_ + _ = _ + _).
235
 
\end{coq_example}
236
 
 
237
 
Patterns need not be linear: you can express that the same expression
238
 
must occur in two places by using pattern variables `{\texttt
239
 
?{\ident}}''.
240
 
 
241
 
\begin{coq_example}
242
 
Require Import Arith.
243
 
SearchPattern (?X1 + _ = _ + ?X1).
244
 
\end{coq_example}
245
 
 
246
 
\begin{Variants}
247
 
\item {\tt SearchPattern {\term} inside
248
 
{\module$_1$} \ldots{} {\module$_n$}.}\comindex{SearchPattern \ldots{} inside
249
 
\ldots{}}
250
 
 
251
 
This restricts the search to constructions defined in modules
252
 
{\module$_1$} \ldots{} {\module$_n$}.
253
 
 
254
 
\item {\tt SearchPattern {\term} outside {\module$_1$} \ldots{} {\module$_n$}.}\comindex{SearchPattern \ldots{} outside \ldots{}}
255
 
 
256
 
This restricts the search to constructions not defined in modules
257
 
{\module$_1$} \ldots{} {\module$_n$}.
258
 
 
259
 
\end{Variants}
260
 
 
261
 
\subsection{\tt SearchRewrite {\term}.}\comindex{SearchRewrite}
262
 
 
263
 
This command displays the name and type of all theorems of the current
264
 
context whose statement's conclusion is an equality of which one side matches
265
 
the expression {\term =}. Holes in {\term} are denoted by ``{\texttt \_}''.
266
 
 
267
 
\begin{coq_example}
268
 
Require Import Arith.
269
 
SearchRewrite (_ + _ + _).
270
 
\end{coq_example}
271
 
 
272
 
\begin{Variants}
273
 
\item {\tt SearchRewrite {\term} inside
274
 
{\module$_1$} \ldots{} {\module$_n$}.}
275
 
 
276
 
This restricts the search to constructions defined in modules
277
 
{\module$_1$} \ldots{} {\module$_n$}.
278
 
 
279
 
\item {\tt SearchRewrite {\term} outside {\module$_1$} \ldots{} {\module$_n$}.}
280
 
 
281
 
This restricts the search to constructions not defined in modules
282
 
{\module$_1$} \ldots{} {\module$_n$}.
283
 
 
284
 
\end{Variants}
285
 
 
286
 
% \subsection{\tt SearchIsos {\term}.}\comindex{SearchIsos}
287
 
% \label{searchisos}
288
 
% \texttt{SearchIsos} searches terms by their type modulo isomorphism.
289
 
% This command displays the full name of all constants, variables,
290
 
% inductive types, and inductive constructors of the current
291
 
% context whose type is isomorphic to {\term} modulo the contextual part of the
292
 
% following axiomatization (the mutual inductive types with one constructor,
293
 
% without implicit arguments, and for which projections exist, are regarded as a
294
 
% sequence of $\sa{}$):
295
 
 
296
 
 
297
 
% \begin{tabbing}
298
 
% \ \ \ \ \=11.\ \=\kill
299
 
% \>1.\>$A=B\mx{ if }A\stackrel{\bt{}\io{}}{\lra{}}B$\\
300
 
% \>2.\>$\sa{}x:A.B=\sa{}y:A.B[x\la{}y]\mx{ if }y\not\in{}FV(\sa{}x:A.B)$\\
301
 
% \>3.\>$\Pi{}x:A.B=\Pi{}y:A.B[x\la{}y]\mx{ if }y\not\in{}FV(\Pi{}x:A.B)$\\
302
 
% \>4.\>$\sa{}x:A.B=\sa{}x:B.A\mx{ if }x\not\in{}FV(A,B)$\\
303
 
% \>5.\>$\sa{}x:(\sa{}y:A.B).C=\sa{}x:A.\sa{}y:B[y\la{}x].C[x\la{}(x,y)]$\\
304
 
% \>6.\>$\Pi{}x:(\sa{}y:A.B).C=\Pi{}x:A.\Pi{}y:B[y\la{}x].C[x\la{}(x,y)]$\\
305
 
% \>7.\>$\Pi{}x:A.\sa{}y:B.C=\sa{}y:(\Pi{}x:A.B).(\Pi{}x:A.C[y\la{}(y\sm{}x)]$\\
306
 
% \>8.\>$\sa{}x:A.unit=A$\\
307
 
% \>9.\>$\sa{}x:unit.A=A[x\la{}tt]$\\
308
 
% \>10.\>$\Pi{}x:A.unit=unit$\\
309
 
% \>11.\>$\Pi{}x:unit.A=A[x\la{}tt]$
310
 
% \end{tabbing}
311
 
 
312
 
% For more informations about the exact working of this command, see
313
 
% \cite{Del97}.
314
 
 
315
 
\subsection{\tt Locate {\qualid}.}\comindex{Locate}
316
 
\label{Locate}
317
 
This command displays the full name of the qualified identifier {\qualid}
318
 
and consequently the \Coq\ module in which it is defined.
319
 
 
320
 
\begin{coq_eval}
321
 
(*************** The last line should produce **************************)
322
 
(*********** Error: I.Dont.Exist not a defined object ******************)
323
 
\end{coq_eval}
324
 
\begin{coq_eval}
325
 
Set Printing Depth 50.
326
 
\end{coq_eval}
327
 
\begin{coq_example}
328
 
Locate nat.
329
 
Locate Datatypes.O.
330
 
Locate Init.Datatypes.O.
331
 
Locate Coq.Init.Datatypes.O.
332
 
Locate I.Dont.Exist.
333
 
\end{coq_example}
334
 
 
335
 
\SeeAlso Section \ref{LocateSymbol}
336
 
 
337
 
\subsection{The {\sc Whelp} searching tool
338
 
\label{Whelp}}
339
 
 
340
 
{\sc Whelp} is an experimental searching and browsing tool for the
341
 
whole {\Coq} library and the whole set of {\Coq} user contributions.
342
 
{\sc Whelp} requires a browser to work. {\sc Whelp} has been developed
343
 
at the University of Bologna as part of the HELM\footnote{Hypertextual
344
 
Electronic Library of Mathematics} and MoWGLI\footnote{Mathematics on
345
 
the Web, Get it by Logics and Interfaces} projects.  It can be invoked
346
 
directly from the {\Coq} toplevel or from {\CoqIDE}, assuming a
347
 
graphical environment is also running. The browser to use can be
348
 
selected by setting the environment variable {\tt
349
 
COQREMOTEBROWSER}. If not explicitly set, it defaults to
350
 
\verb!netscape -remote "OpenURL(%s)"!  or
351
 
\verb!C:\\PROGRA~1\\INTERN~1\\IEXPLORE %s!, depending on the
352
 
underlying operating system (in the command, the string \verb!%s!
353
 
serves as metavariable for the url to open).
354
 
 
355
 
The {\sc Whelp} commands are:
356
 
 
357
 
\subsubsection{\tt Whelp Locate "{\sl reg\_expr}".
358
 
\comindex{Whelp Locate}}
359
 
 
360
 
This command opens a browser window and displays the result of seeking
361
 
for all names that match the regular expression {\sl reg\_expr} in the
362
 
{\Coq} library and user contributions. The regular expression can
363
 
contain the special operators are * and ? that respectively stand for
364
 
an arbitrary substring and for exactly one character.
365
 
 
366
 
\variant {\tt Whelp Locate {\ident}.}\\
367
 
This is equivalent to {\tt Whelp Locate "{\ident}"}.
368
 
 
369
 
\subsubsection{\tt Whelp Match {\pattern}.
370
 
\comindex{Whelp Match}}
371
 
 
372
 
This command opens a browser window and displays the result of seeking
373
 
for all statements that match the pattern {\pattern}. Holes in the
374
 
pattern are represented by the wildcard character ``\_''.
375
 
 
376
 
\subsubsection{\tt Whelp Instance {\pattern}.}
377
 
\comindex{Whelp Instance}
378
 
 
379
 
This command opens a browser window and displays the result of seeking
380
 
for all statements that are instances of the pattern {\pattern}. The
381
 
pattern is here assumed to be an universally quantified expression.
382
 
 
383
 
\subsubsection{\tt Whelp Elim {\qualid}.}
384
 
\comindex{Whelp Elim}
385
 
 
386
 
This command opens a browser window and displays the result of seeking
387
 
for all statements that have the ``form'' of an elimination scheme
388
 
over the type denoted by {\qualid}.
389
 
 
390
 
\subsubsection{\tt Whelp Hint {\term}.}
391
 
\comindex{Whelp Hint}
392
 
 
393
 
This command opens a browser window and displays the result of seeking
394
 
for all statements that can be instantiated so that to prove the
395
 
statement {\term}.
396
 
 
397
 
\variant {\tt Whelp Hint.}\\ This is equivalent to {\tt Whelp Hint
398
 
{\sl goal}} where {\sl goal} is the current goal to prove. Notice that
399
 
{\Coq} does not send the local environment of definitions to the {\sc
400
 
Whelp} tool so that it only works on requests strictly based on, only,
401
 
definitions of the standard library and user contributions.
402
 
 
403
 
\section{Loading files}
404
 
 
405
 
\Coq\ offers the possibility of loading different
406
 
parts of a whole development stored in separate files. Their contents
407
 
will be loaded as if they were entered from the keyboard. This means
408
 
that the loaded files are ASCII files containing sequences of commands
409
 
for \Coq's toplevel. This kind of file is called a {\em script} for
410
 
\Coq\index{Script file}. The standard (and default) extension of
411
 
\Coq's script files is {\tt .v}.
412
 
 
413
 
\subsection{\tt Load {\ident}.}
414
 
\comindex{Load}\label{Load}
415
 
This command loads the file named {\ident}{\tt .v}, searching
416
 
successively in each of the directories specified in the {\em
417
 
  loadpath}. (see section \ref{loadpath})
418
 
 
419
 
\begin{Variants}
420
 
\item {\tt Load {\str}.}\label{Load-str}\\
421
 
  Loads the file denoted by the string {\str}, where {\str} is any
422
 
  complete filename. Then the \verb.~. and {\tt ..}
423
 
  abbreviations are allowed as well as shell variables. If no
424
 
  extension is specified, \Coq\ will use the default extension {\tt
425
 
    .v}
426
 
\item {\tt Load Verbose {\ident}.}, 
427
 
  {\tt Load Verbose {\str}}\\
428
 
  \comindex{Load Verbose}
429
 
  Display, while loading, the answers of \Coq\ to each command
430
 
  (including tactics) contained in the loaded file
431
 
  \SeeAlso section \ref{Begin-Silent}
432
 
\end{Variants}
433
 
 
434
 
\begin{ErrMsgs}
435
 
\item \errindex{Can't find file {\ident} on loadpath}
436
 
\end{ErrMsgs}
437
 
 
438
 
\section{Compiled files}\label{compiled}\index{Compiled files}
439
 
 
440
 
This feature allows to build files for a quick loading. When loaded,
441
 
the commands contained in a compiled file will not be {\em replayed}.
442
 
In particular, proofs will not be replayed. This avoids a useless
443
 
waste of time.
444
 
 
445
 
\Rem A module containing an opened section cannot be compiled. 
446
 
 
447
 
% \subsection{\tt Compile Module {\ident}.}
448
 
% \index{Modules}
449
 
% \comindex{Compile Module}
450
 
% \index{.vo files}
451
 
% This command loads the file
452
 
% {\ident}{\tt .v} and plays the script it contains. Declarations,
453
 
% definitions and proofs it contains are {\em "packaged"} in a compiled
454
 
% form: the {\em module} named {\ident}.
455
 
% A file {\ident}{\tt .vo} is then created.
456
 
% The file {\ident}{\tt .v} is searched according to the
457
 
% current loadpath.
458
 
% The {\ident}{\tt .vo} is then written in the directory where
459
 
% {\ident}{\tt .v} was found.
460
 
 
461
 
% \begin{Variants}
462
 
% \item \texttt{Compile Module {\ident} {\str}.}\\ 
463
 
%   Uses the file {\str}{\tt .v} or {\str} if the previous one does not
464
 
%   exist to build the module {\ident}. In this case, {\str} is any
465
 
%   string giving a filename in the UNIX sense (see section
466
 
%   \ref{Load-str}). 
467
 
%   \Warning The given filename can not contain other caracters than
468
 
%   the caracters of \Coq's identifiers : letters or digits or the
469
 
%   underscore symbol ``\_''.
470
 
 
471
 
% \item \texttt{Compile Module Specification {\ident}.}\\
472
 
%   \comindex{Compile Module Specification}
473
 
%   Builds a specification module: only the types of terms are stored
474
 
%   in the module. The bodies (the proofs) are {\em not} written
475
 
%   in the module. In that case, the file created is {\ident}{\tt .vi}.
476
 
%   This is only useful when proof terms take too much place in memory
477
 
%   and are not necessary.
478
 
  
479
 
% \item \texttt{Compile Verbose Module {\ident}.}\\ 
480
 
%   \comindex{Compile Verbose Module}
481
 
%   Verbose version of Compile: shows the contents of the file being
482
 
%   compiled.
483
 
% \end{Variants}
484
 
 
485
 
% These different variants can be combined.
486
 
 
487
 
 
488
 
% \begin{ErrMsgs}
489
 
% \item \texttt{You cannot open a module when there are things other than}\\
490
 
%   \texttt{Modules and Imports in the context.}\\ 
491
 
%   The only commands allowed before a {Compile Module} command are {\tt
492
 
%     Require},\\
493
 
%   {\tt Read Module} and {\tt Import}. Actually, The normal way to
494
 
%   compile modules is by the {\tt coqc} command (see chapter
495
 
%   \ref{Addoc-coqc}).
496
 
% \end{ErrMsgs}
497
 
 
498
 
% \SeeAlso sections \ref{Opaque}, \ref{loadpath}, chapter
499
 
% \ref{Addoc-coqc}
500
 
 
501
 
%\subsection{\tt Import {\qualid}.}\comindex{Import}
502
 
%\label{Import}
503
 
 
504
 
%%%%%%%%%%%%
505
 
% Import and Export described in RefMan-mod.tex
506
 
% the minor difference (to avoid multiple Exporting of libraries) in
507
 
% the treatment of normal modules and libraries by Export omitted
508
 
 
509
 
 
510
 
\subsection{\tt Require {\dirpath}.}
511
 
\label{Require}
512
 
\comindex{Require}
513
 
 
514
 
This command looks in the loadpath for a file containing module
515
 
{\dirpath}, then loads and opens (imports) its contents.
516
 
More precisely, if {\dirpath} splits into a library dirpath {\dirpath'} and a module name {\textsl{ident}}, then the file {\ident}{\tt .vo} is searched in a physical path mapped to the logical path {\dirpath'}.
517
 
 
518
 
TODO: effect on the name table.
519
 
 
520
 
% The implementation file ({\ident}{\tt .vo}) is searched first,
521
 
% then the specification file ({\ident}{\tt .vi}) in case of failure.
522
 
If the module required has already been loaded, \Coq\ 
523
 
simply opens it (as {\tt Import {\dirpath}} would do it).
524
 
%If the module required is already loaded and open, \Coq\ 
525
 
%displays the following warning: {\tt {\ident} already imported}.
526
 
 
527
 
If a module {\it A} contains a command {\tt Require} {\it B} then the
528
 
command {\tt Require} {\it A} loads the module {\it B} but does not
529
 
open it (See the {\tt Require Export} variant below).
530
 
 
531
 
\begin{Variants}
532
 
\item {\tt Require Export {\qualid}.}\\
533
 
  \comindex{Require Export}
534
 
  This command acts as {\tt Require} {\qualid}.  But if a module {\it
535
 
    A} contains a command {\tt Require Export} {\it B}, then the
536
 
  command {\tt Require} {\it A} opens the module {\it B} as if the
537
 
  user would have typed {\tt Require}{\it B}.
538
 
% \item {\tt Require $[$ Implementation $|$ Specification $]$ {\qualid}.}\\
539
 
%   \comindex{Require Implementation}
540
 
%   \comindex{Require Specification}
541
 
%   Is the same as {\tt Require}, but specifying explicitly the
542
 
%   implementation ({\tt.vo} file) or the specification ({\tt.vi}
543
 
%   file).
544
 
 
545
 
% Redundant ?
546
 
% \item {\tt Require {\qualid} {\str}.}\\ 
547
 
%   Specifies the file to load as being {\str} but containing module
548
 
%  {\qualid}. 
549
 
% The opened module is still {\ident} and therefore must have been loaded.
550
 
\item {\tt Require {\qualid} {\str}.}\\ 
551
 
  Specifies the file to load as being {\str} but containing module
552
 
  {\qualid} which is then opened.
553
 
\end{Variants}
554
 
 
555
 
These different variants can be combined.
556
 
 
557
 
\begin{ErrMsgs}
558
 
 
559
 
\item \errindex{Cannot load {\ident}: no physical path bound to {\dirpath}}
560
 
 
561
 
\item \errindex{Can't find module toto on loadpath}
562
 
 
563
 
  The command did not find the file {\tt toto.vo}. Either {\tt
564
 
    toto.v} exists but is not compiled or {\tt toto.vo} is in a directory
565
 
  which is not in your {\tt LoadPath} (see section \ref{loadpath}).
566
 
 
567
 
\item \errindex{Bad magic number}
568
 
 
569
 
  \index{Bad-magic-number@{\tt Bad Magic Number}}
570
 
  The file {\tt{\ident}.vo} was found but either it is not a \Coq\
571
 
  compiled module, or it was compiled with an older and incompatible
572
 
  version of \Coq.
573
 
\end{ErrMsgs}
574
 
 
575
 
\SeeAlso chapter \ref{Addoc-coqc}
576
 
 
577
 
\subsection{\tt Print Modules.}
578
 
\comindex{Print Modules}
579
 
This command shows the currently loaded and currently opened
580
 
(imported) modules.
581
 
 
582
 
\subsection{\tt Declare ML Module {\str$_1$} .. {\str$_n$}.}
583
 
\comindex{Declare ML Module}
584
 
This commands loads the Objective Caml compiled files {\str$_1$} \dots
585
 
{\str$_n$} (dynamic link). It is mainly used to load tactics
586
 
dynamically.
587
 
% (see chapter \ref{WritingTactics}).
588
 
 The files are
589
 
searched into the current Objective Caml loadpath (see the command {\tt
590
 
Add ML Path} in the section \ref{loadpath}).  Loading of Objective Caml
591
 
files is only possible under the bytecode version of {\tt coqtop}
592
 
(i.e. {\tt coqtop} called with options {\tt -byte}, see chapter 
593
 
\ref{Addoc-coqc}).
594
 
 
595
 
\begin{ErrMsgs}
596
 
\item \errindex{File not found on loadpath : \str}
597
 
\item \errindex{Loading of ML object file forbidden in a native Coq}
598
 
\end{ErrMsgs}
599
 
 
600
 
\subsection{\tt Print ML Modules.}\comindex{Print ML Modules}
601
 
This print the name of all \ocaml{} modules loaded with \texttt{Declare
602
 
  ML Module}. To know from where these module were loaded, the user
603
 
should use the command \texttt{Locate File} (see page \pageref{Locate File})
604
 
 
605
 
\section{Loadpath}
606
 
\label{loadpath}\index{Loadpath}
607
 
 
608
 
There are currently two loadpaths in \Coq. A loadpath where seeking
609
 
{\Coq} files (extensions {\tt .v} or {\tt .vo} or {\tt .vi}) and one where
610
 
seeking Objective Caml files. The default loadpath contains the
611
 
directory ``\texttt{.}'' denoting the current directory and mapped to the empty logical path (see section \ref{LongNames}).
612
 
 
613
 
\subsection{\tt Pwd.}\comindex{Pwd}\label{Pwd}
614
 
This command displays the current working directory.
615
 
 
616
 
\subsection{\tt Cd {\str}.}\comindex{Cd}
617
 
This command changes the current directory according to {\str} 
618
 
which can be any valid path.
619
 
 
620
 
\begin{Variants}
621
 
\item {\tt Cd.}\\
622
 
  Is equivalent to {\tt Pwd.}
623
 
\end{Variants}
624
 
 
625
 
\subsection{\tt Add LoadPath {\str} as {\dirpath}.}
626
 
\comindex{Add LoadPath}\label{AddLoadPath}
627
 
 
628
 
This command adds the path {\str} to the current {\Coq} loadpath and
629
 
maps it to the logical directory {\dirpath}, which means that every
630
 
file {\tt M.v} physically lying in directory {\str} becomes accessible
631
 
through logical name ``{\dirpath}{\tt{.M}}''. 
632
 
 
633
 
\Rem {\tt Add LoadPath} also adds {\str} to the current ML loadpath.
634
 
 
635
 
\begin{Variants}
636
 
\item {\tt Add LoadPath {\str}.}\\
637
 
Performs as {\tt Add LoadPath {\str} as {\dirpath}} but for the empty directory path.
638
 
\end{Variants}
639
 
 
640
 
\subsection{\tt Add Rec LoadPath {\str} as {\dirpath}.}\comindex{Add Rec LoadPath}\label{AddRecLoadPath}
641
 
This command adds the directory {\str} and all its subdirectories 
642
 
to the current \Coq\ loadpath. The top directory {\str} is mapped to the logical directory {\dirpath} while any subdirectory {\textsl{pdir}} is mapped to logical directory {\dirpath}{\tt{.pdir}} and so on.
643
 
 
644
 
\Rem {\tt Add Rec LoadPath} also recursively adds {\str} to the current ML loadpath.
645
 
 
646
 
\begin{Variants}
647
 
\item {\tt Add Rec LoadPath {\str}.}\\
648
 
Works as {\tt Add Rec LoadPath {\str} as {\dirpath}} but for the empty logical directory path.
649
 
\end{Variants}
650
 
 
651
 
\subsection{\tt Remove LoadPath {\str}.}\comindex{Remove LoadPath}
652
 
This command removes the path {\str} from the current \Coq\ loadpath.
653
 
 
654
 
\subsection{\tt Print LoadPath.}\comindex{Print LoadPath}
655
 
This command displays the current \Coq\ loadpath.
656
 
 
657
 
\subsection{\tt Add ML Path {\str}.}\comindex{Add ML Path}
658
 
This command adds the path {\str} to the current Objective Caml loadpath (see
659
 
the command {\tt Declare ML Module} in the section \ref{compiled}).
660
 
 
661
 
\Rem This command is implied by {\tt Add LoadPath {\str} as {\dirpath}}.
662
 
 
663
 
\subsection{\tt Add Rec ML Path {\str}.}\comindex{Add Rec ML Path}
664
 
This command adds the directory {\str} and all its subdirectories 
665
 
to the current Objective Caml loadpath (see
666
 
the command {\tt Declare ML Module} in the section \ref{compiled}).
667
 
 
668
 
\Rem This command is implied by {\tt Add Rec LoadPath {\str} as {\dirpath}}.
669
 
 
670
 
\subsection{\tt Print ML Path {\str}.}\comindex{Print ML Path}
671
 
This command displays the current Objective Caml loadpath.
672
 
This command makes sense only under the bytecode version of {\tt
673
 
coqtop}, i.e. using option {\tt -byte} (see the
674
 
command {\tt Declare ML Module} in the section
675
 
\ref{compiled}).
676
 
 
677
 
\subsection{\tt Locate File {\str}.}\comindex{Locate
678
 
  File}\label{Locate File}
679
 
This command displays the location of file {\str} in the current loadpath.
680
 
Typically, {\str} is a \texttt{.cmo} or \texttt{.vo} or \texttt{.v} file.
681
 
 
682
 
\subsection{\tt Locate Library {\dirpath}.}
683
 
\comindex{Locate Library}
684
 
This command gives the status of the \Coq\ module {\dirpath}. It tells if the
685
 
module is loaded and if not searches in the load path for a module
686
 
of logical name {\dirpath}.
687
 
 
688
 
\section{States and Reset}
689
 
 
690
 
\subsection{\tt Reset \ident.}
691
 
\comindex{Reset}
692
 
This command removes all the objects in the environment since \ident\ 
693
 
was introduced, including \ident. \ident\ may be the name of a defined
694
 
or declared object as well as the name of a section.  One cannot reset
695
 
over the name of a module or of an object inside a module.
696
 
 
697
 
\begin{ErrMsgs}
698
 
\item \ident: \errindex{no such entry}
699
 
\end{ErrMsgs}
700
 
 
701
 
\subsection{\tt Back.}
702
 
\comindex{Back}
703
 
 
704
 
This commands undoes all the effects of the last vernacular
705
 
command. This does not include commands that only access to the
706
 
environment like those described in the previous sections of this
707
 
chapter (for instance {\tt Require} and {\tt Load} can be undone, but
708
 
not {\tt Check} and {\tt Locate}). Commands read from a vernacular
709
 
file are considered as a single command.
710
 
 
711
 
\begin{Variants}
712
 
\item {\tt Back $n$} \\
713
 
  Undoes $n$ vernacular commands.
714
 
\end{Variants}
715
 
 
716
 
\begin{ErrMsgs}
717
 
\item \errindex{Reached begin of command history} \\
718
 
  Happens when there is vernacular command to undo.
719
 
\end{ErrMsgs}
720
 
 
721
 
\subsection{\tt Restore State \str.}
722
 
\comindex{Restore State}
723
 
  Restores the state contained in the file \str.
724
 
 
725
 
\begin{Variants}
726
 
\item {\tt Restore State \ident}\\
727
 
 Equivalent to {\tt Restore State "}{\ident}{\tt .coq"}.
728
 
\item {\tt Reset Initial.}\comindex{Reset Initial}\\ 
729
 
  Goes back to the initial state (like after the command {\tt coqtop},
730
 
  when the interactive session began). This command is only available
731
 
  interactively.
732
 
\end{Variants}
733
 
 
734
 
\subsection{\tt Write State \str.}
735
 
\comindex{Write State}
736
 
Writes the current state into a file \str{} for
737
 
use in a further session. This file can be given as the {\tt
738
 
  inputstate} argument of the commands {\tt coqtop} and {\tt coqc}.
739
 
 
740
 
\begin{Variants}
741
 
\item {\tt Write State \ident}\\
742
 
 Equivalent to {\tt Write State "}{\ident}{\tt .coq"}.
743
 
 The state is saved in the current directory (see \pageref{Pwd}).
744
 
\end{Variants}
745
 
 
746
 
\section{Quitting and debugging}
747
 
 
748
 
\subsection{\tt Quit.}\comindex{Quit}
749
 
This command permits to quit \Coq.
750
 
 
751
 
\subsection{\tt Drop.}\comindex{Drop}\label{Drop}
752
 
 
753
 
This is used mostly as a debug facility by \Coq's implementors
754
 
and does not concern the casual user.
755
 
This command permits to leave {\Coq} temporarily and enter the
756
 
Objective Caml toplevel. The Objective Caml command:
757
 
 
758
 
\begin{flushleft}
759
 
\begin{verbatim}
760
 
#use "include";;
761
 
\end{verbatim}
762
 
\end{flushleft}
763
 
 
764
 
\noindent add the right loadpaths and loads some toplevel printers for
765
 
all abstract types of \Coq - section\_path, identfifiers, terms, judgements,
766
 
\dots. You can also use the file \texttt{base\_include} instead,
767
 
that loads only the pretty-printers for section\_paths and
768
 
identifiers.
769
 
% See section \ref{test-and-debug} more information on the
770
 
% usage of the toplevel.
771
 
You can return back to \Coq{} with the command: 
772
 
 
773
 
\begin{flushleft}
774
 
\begin{verbatim}
775
 
go();;
776
 
\end{verbatim}
777
 
\end{flushleft}
778
 
 
779
 
\begin{Warnings}
780
 
\item It only works with the bytecode version of {\Coq} (i.e. {\tt coqtop} called with option {\tt -byte}, see page \pageref{binary-images}).
781
 
\item You must have compiled {\Coq} from the source package and set the
782
 
  environment variable \texttt{COQTOP} to the root of your copy of the sources (see section \ref{EnvVariables}).
783
 
\end{Warnings}
784
 
 
785
 
\subsection{\tt Time \textrm{\textsl{command}}.}\comindex{Time}
786
 
\label{time}
787
 
This command executes the vernac command \textrm{\textsl{command}}
788
 
and display the time needed to execute it.
789
 
 
790
 
\section{Controlling display}
791
 
 
792
 
\subsection{\tt Set Silent.}
793
 
\comindex{Begin Silent}
794
 
\label{Begin-Silent}
795
 
\index{Silent mode}
796
 
This command turns off the normal displaying.
797
 
 
798
 
\subsection{\tt Unset Silent.}\comindex{End Silent}
799
 
This command turns the normal display on.
800
 
 
801
 
\subsection{\tt Set Printing Width {\integer}.}\comindex{Set Printing Width}
802
 
This command sets which left-aligned part of the width of the screen
803
 
is used for display. 
804
 
 
805
 
\subsection{\tt Unset Printing Width.}\comindex{Unset Printing Width}
806
 
This command resets the width of the screen used for display to its
807
 
default value (which is 78 at the time of writing this documentation).
808
 
 
809
 
\subsection{\tt Test Printing Width.}\comindex{Test Printing Width}
810
 
This command displays the current screen width used for display.
811
 
 
812
 
\subsection{\tt Set Printing Depth {\integer}.}\comindex{Set Printing Depth}
813
 
This command sets the nesting depth of the formatter used for
814
 
pretty-printing. Beyond this depth, display of subterms is replaced by
815
 
dots. 
816
 
 
817
 
\subsection{\tt Unset Printing Depth.}\comindex{Unset Printing Depth}
818
 
This command resets the nesting depth of the formatter used for
819
 
pretty-printing to its default value (at the
820
 
time of writing this documentation, the default value is 50).
821
 
 
822
 
\subsection{\tt Test Printing Depth.}\comindex{Test Printing Depth}
823
 
This command displays the current nesting depth used for display.
824
 
 
825
 
%\subsection{\tt Explain ...}
826
 
%Not yet documented.
827
 
 
828
 
%\subsection{\tt Go ...}
829
 
%Not yet documented.
830
 
 
831
 
%\subsection{\tt Abstraction ...}
832
 
%Not yet documented.
833
 
 
834
 
\section{Controlling the conversion algorithm}
835
 
 
836
 
{\Coq} comes with two algorithms to check the convertibility of types
837
 
(see section~\ref{convertibility}). The first algorithm lazily
838
 
compares applicative terms while the other is a brute-force but efficient
839
 
algorithm that first normalizes the terms before comparing them.  The
840
 
second algorithm is based on a bytecode representation of terms
841
 
similar to the bytecode representation used in the ZINC virtual
842
 
machine~\cite{Leroy90}. It is specially useful for intensive
843
 
computation of algebraic values, such as numbers, and for reflexion-based
844
 
tactics.
845
 
 
846
 
\subsection{\tt Set Virtual Machine
847
 
\label{SetVirtualMachine}
848
 
\comindex{Set Virtual Machine}}
849
 
 
850
 
This activates the bytecode-based conversion algorithm.
851
 
 
852
 
\subsection{\tt Unset Virtual Machine
853
 
\comindex{Unset Virtual Machine}}
854
 
 
855
 
This deactivates the bytecode-based conversion algorithm.
856
 
 
857
 
\subsection{\tt Test Virtual Machine
858
 
\comindex{Test Virtual Machine}}
859
 
 
860
 
This tells if the bytecode-based conversion algorithm is
861
 
activated. The default behavior is to have the bytecode-based
862
 
conversion algorithm deactivated.
863
 
 
864
 
\SeeAlso sections~\ref{vmcompute} and~\ref{vmoption}.
865
 
 
866
 
% $Id: RefMan-oth.tex 9044 2006-07-12 13:22:17Z herbelin $ 
867
 
 
868
 
%%% Local Variables: 
869
 
%%% mode: latex
870
 
%%% TeX-master: "Reference-Manual"
871
 
%%% End: