Vernacular commands¶
Displaying¶
-
Command
Print qualid
¶ This command displays on the screen information about the declared or defined object referred by
qualid
.Error messages:
-
Error
This object does not support universe names.
¶
-
Error
-
Command
About qualid
¶ This displays various information about the object denoted by
qualid
: its kind (module, constant, assumption, inductive, constructor, abbreviation, …), long name, type, implicit arguments and argument scopes. It does not print the body of definitions or proofs.
Flags, Options and Tables¶
Coq has many settings to control its behavior. Setting types include flags, options and tables:
A
flag
has a boolean value, such asAsymmetric Patterns
.An
option
generally has a numeric or string value, such asFirstorder Depth
.A
table
contains a set of strings or qualids.In addition, some commands provide settings, such as
Extraction Language OCaml
.
Flags, options and tables are identified by a series of identifiers, each with an initial capital letter.
-
Command
Local | Global | Export? Set option ( num | string )
¶ Sets
option
to the specified value. Scoping qualifiers are described here.
-
Command
Local | Global | Export? Unset option
¶ Sets
option
to its default value. Scoping qualifiers are described here.
-
Command
Print Options
¶ Prints the current value of all flags and options, and the names of all tables.
-
Command
Test table
A synonym for
Print Table @table
.
-
Command
Print Tables
¶ A synonym for
Print Options
.
Scope qualifiers for Set
and Unset
¶
Local | Global | Export?
Flag and option settings can be global in scope or local to nested scopes created by
Module
and Section
commands. There are four alternatives:
no qualifier: the original setting is not restored at the end of the current module or section.
Local: the setting is applied within the current scope. The original value of the option or flag is restored at the end of the current module or section.
Global: similar to no qualifier, the original setting is not restored at the end of the current module or section. In addition, if the value is set in a file, then
Require
-ing the file sets the option.Export: similar to Local, the original value of the option or flag is restored at the end of the current module or section. In addition, if the value is set in a file, then
Import
-ing the file sets the option.
Newly opened scopes inherit the current settings.
Requests to the environment¶
-
Command
Check term
¶ This command displays the type of
term
. When called in proof mode, the term is checked in the local context of the current subgoal.-
Variant
selector: Check term
This variant specifies on which subgoal to perform typing (see Section Invocation of tactics).
-
Variant
-
Command
Eval convtactic in term
¶ This command performs the specified reduction on
term
, and displays the resulting term with its type. The term to be reduced may depend on hypothesis introduced in the first subgoal (if a proof is in progress).参考
Section Performing computations.
-
Command
Compute term
¶ This command performs a call-by-value evaluation of term by using the bytecode-based virtual machine. It is a shortcut for
Eval vm_compute in
term
.参考
Section Performing computations.
-
Command
Print Assumptions qualid
¶ This commands display all the assumptions (axioms, parameters and variables) a theorem or definition depends on. Especially, it informs on the assumptions with respect to which the validity of a theorem relies.
-
Variant
Print Opaque Dependencies qualid
¶ Displays the set of opaque constants
qualid
relies on in addition to the assumptions.
-
Variant
-
Command
Search qualid
¶ This command displays the name and type of all objects (hypothesis of the current goal, theorems, axioms, etc) of the current context whose statement contains
qualid
. This command is useful to remind the user of the name of library lemmas.-
Error
The reference qualid was not found in the current environment.
¶ There is no constant in the environment named qualid.
-
Variant
Search string
If
string
is a valid identifier, this command displays the name and type of all objects (theorems, axioms, etc) of the current context whose name contains string. If string is a notation’s string denoting some referencequalid
(referred to by its main symbol as in "+" or by its notation’s string as in "_ + _" or "_ 'U' _", see Section Notations), the command works likeSearch
qualid
.
-
Variant
Search string%key
The string string must be a notation or the main symbol of a notation which is then interpreted in the scope bound to the delimiting key
key
(see Section Local interpretation rules for notations).
-
Variant
Search term_pattern
This searches for all statements or types of definition that contains a subterm that matches the pattern term_pattern (holes of the pattern are either denoted by _ or by ?ident when non linear patterns are expected).
-
Variant
Search { + [-]term_pattern_string }
where
term_pattern_string
is a term_pattern, a string, or a string followed by a scope delimiting key %key. This generalization ofSearch
searches for all objects whose statement or type contains a subterm matchingterm_pattern
(orqualid
ifstring
is the notation for a reference qualid) and whose name contains all string of the request that correspond to valid identifiers. If a term_pattern or a string is prefixed by -, the search excludes the objects that mention that term_pattern or that string.
-
Variant
Search term_pattern_string … term_pattern_string inside qualid+
This restricts the search to constructions defined in the modules named by the given
qualid
sequence.
-
Variant
Search term_pattern_string … term_pattern_string outside qualid+
This restricts the search to constructions not defined in the modules named by the given
qualid
sequence.
-
Variant
selector: Search [-]term_pattern_string … [-]term_pattern_string
This specifies the goal on which to search hypothesis (see Section Invocation of tactics). By default the 1st goal is searched. This variant can be combined with other variants presented here.
Example
- Require Import ZArith.
- [Loading ML file z_syntax_plugin.cmxs ... done] [Loading ML file quote_plugin.cmxs ... done] [Loading ML file newring_plugin.cmxs ... done] [Loading ML file omega_plugin.cmxs ... done]
- Search Z.mul Z.add "distr".
- Z.mul_add_distr_l: forall n m p : Z, (n * (m + p))%Z = (n * m + n * p)%Z Z.mul_add_distr_r: forall n m p : Z, ((n + m) * p)%Z = (n * p + m * p)%Z fast_Zmult_plus_distr_l: forall (n m p : Z) (P : Z -> Prop), P (n * p + m * p)%Z -> P ((n + m) * p)%Z
- Search "+"%Z "*"%Z "distr" -positive -Prop.
- Z.mul_add_distr_l: forall n m p : Z, (n * (m + p))%Z = (n * m + n * p)%Z Z.mul_add_distr_r: forall n m p : Z, ((n + m) * p)%Z = (n * p + m * p)%Z
- Search (?x * _ + ?x * _)%Z outside OmegaLemmas.
- Z.mul_add_distr_l: forall n m p : Z, (n * (m + p))%Z = (n * m + n * p)%Z
-
Variant
SearchAbout
¶ バージョン 8.5 で非推奨.
Up to Coq version 8.4,
Search
had the behavior of currentSearchHead
and the behavior of currentSearch
was obtained with commandSearchAbout
. For compatibility, the deprecated nameSearchAbout
can still be used as a synonym ofSearch
. For compatibility, the list of objects to search when usingSearchAbout
may also be enclosed by optional[ ]
delimiters.
-
Error
-
Command
SearchHead term
¶ This command displays the name and type of all hypothesis of the current goal (if any) and theorems of the current context whose statement’s conclusion has the form (term t1 .. tn). This command is useful to remind the user of the name of library lemmas.
Example
- SearchHead le.
- le_n: forall n : nat, n <= n le_0_n: forall n : nat, 0 <= n le_S: forall n m : nat, n <= m -> n <= S m le_pred: forall n m : nat, n <= m -> Nat.pred n <= Nat.pred m le_n_S: forall n m : nat, n <= m -> S n <= S m le_S_n: forall n m : nat, S n <= S m -> n <= m
- SearchHead (@eq bool).
- andb_true_intro: forall b1 b2 : bool, b1 = true /\ b2 = true -> (b1 && b2)%bool = true
-
Variant
SearchHead term inside qualid+
This restricts the search to constructions defined in the modules named by the given
qualid
sequence.
-
Variant
SearchHead term outside qualid+
This restricts the search to constructions not defined in the modules named by the given
qualid
sequence.
-
Error
Module/section qualid not found.
¶ No module
qualid
has been required (see Section コンパイルされたファイル).
-
Variant
selector: SearchHead term
This specifies the goal on which to search hypothesis (see Section Invocation of tactics). By default the 1st goal is searched. This variant can be combined with other variants presented here.
注釈
Up to Coq version 8.4,
SearchHead
was namedSearch
.
-
Command
SearchPattern term
¶ This command displays the name and type of all hypothesis of the current goal (if any) and theorems of the current context whose statement’s conclusion or last hypothesis and conclusion matches the expressionterm where holes in the latter are denoted by _. It is a variant of
Search term_pattern
that does not look for subterms but searches for statements whose conclusion has exactly the expected form, or whose statement finishes by the given series of hypothesis/conclusion.Example
- Require Import Arith.
- SearchPattern (_ + _ = _ + _).
- Nat.add_comm: forall n m : nat, n + m = m + n plus_Snm_nSm: forall n m : nat, S n + m = n + S m Nat.add_succ_comm: forall n m : nat, S n + m = n + S m Nat.add_shuffle3: forall n m p : nat, n + (m + p) = m + (n + p) plus_assoc_reverse: forall n m p : nat, n + m + p = n + (m + p) Nat.add_assoc: forall n m p : nat, n + (m + p) = n + m + p Nat.add_shuffle0: forall n m p : nat, n + m + p = n + p + m f_equal2_plus: forall x1 y1 x2 y2 : nat, x1 = y1 -> x2 = y2 -> x1 + x2 = y1 + y2 Nat.add_shuffle2: forall n m p q : nat, n + m + (p + q) = n + q + (m + p) Nat.add_shuffle1: forall n m p q : nat, n + m + (p + q) = n + p + (m + q)
- SearchPattern (nat -> bool).
- Nat.odd: nat -> bool Init.Nat.odd: nat -> bool Nat.even: nat -> bool Init.Nat.even: nat -> bool Init.Nat.testbit: nat -> nat -> bool Nat.leb: nat -> nat -> bool Nat.eqb: nat -> nat -> bool Init.Nat.eqb: nat -> nat -> bool Nat.ltb: nat -> nat -> bool Nat.testbit: nat -> nat -> bool Init.Nat.leb: nat -> nat -> bool Init.Nat.ltb: nat -> nat -> bool BinNat.N.testbit_nat: BinNums.N -> nat -> bool BinPosDef.Pos.testbit_nat: BinNums.positive -> nat -> bool BinPos.Pos.testbit_nat: BinNums.positive -> nat -> bool BinNatDef.N.testbit_nat: BinNums.N -> nat -> bool
- SearchPattern (forall l : list _, _ l l).
- List.incl_refl: forall (A : Type) (l : list A), List.incl l l List.lel_refl: forall (A : Type) (l : list A), List.lel l l
Patterns need not be linear: you can express that the same expression must occur in two places by using pattern variables ?ident.
Example
- SearchPattern (?X1 + _ = _ + ?X1).
- Nat.add_comm: forall n m : nat, n + m = m + n
-
Variant
SearchPattern term inside qualid+
This restricts the search to constructions defined in the modules named by the given
qualid
sequence.
-
Variant
SearchPattern term outside qualid+
This restricts the search to constructions not defined in the modules named by the given
qualid
sequence.
-
Variant
selector: SearchPattern term
This specifies the goal on which to search hypothesis (see Section Invocation of tactics). By default the 1st goal is searched. This variant can be combined with other variants presented here.
-
Command
SearchRewrite term
¶ This command displays the name and type of all hypothesis of the current goal (if any) and theorems of the current context whose statement’s conclusion is an equality of which one side matches the expression term. Holes in term are denoted by “_”.
Example
- Require Import Arith.
- SearchRewrite (_ + _ + _).
- Nat.add_shuffle0: forall n m p : nat, n + m + p = n + p + m plus_assoc_reverse: forall n m p : nat, n + m + p = n + (m + p) Nat.add_assoc: forall n m p : nat, n + (m + p) = n + m + p Nat.add_shuffle1: forall n m p q : nat, n + m + (p + q) = n + p + (m + q) Nat.add_shuffle2: forall n m p q : nat, n + m + (p + q) = n + q + (m + p) Nat.add_carry_div2: forall (a b : nat) (c0 : bool), (a + b + Nat.b2n c0) / 2 = a / 2 + b / 2 + Nat.b2n (Nat.testbit a 0 && Nat.testbit b 0 || c0 && (Nat.testbit a 0 || Nat.testbit b 0))
-
Variant
SearchRewrite term inside qualid+
This restricts the search to constructions defined in the modules named by the given
qualid
sequence.
-
Variant
SearchRewrite term outside qualid+
This restricts the search to constructions not defined in the modules named by the given
qualid
sequence.
-
Variant
selector: SearchRewrite term
This specifies the goal on which to search hypothesis (see Section Invocation of tactics). By default the 1st goal is searched. This variant can be combined with other variants presented here.
注釈
-
Table
Search Blacklist string
¶ Specifies a set of strings used to exclude lemmas from the results of
Search
,SearchHead
,SearchPattern
andSearchRewrite
queries. A lemma whose fully-qualified name contains any of the strings will be excluded from the search results. The default blacklisted substrings are_subterm
,_subproof
andPrivate_
.Use the
Add @table
andRemove @table
commands to update the set of blacklisted strings.
-
Command
Locate qualid
¶ This command displays the full name of objects whose name is a prefix of the qualified identifier
qualid
, and consequently the Coq module in which they are defined. It searches for objects from the different qualified namespaces of Coq: terms, modules, Ltac, etc.Example
- Locate nat.
- Inductive Coq.Init.Datatypes.nat
- Locate Datatypes.O.
- Constructor Coq.Init.Datatypes.O (shorter name to refer to it in current context is O)
- Locate Init.Datatypes.O.
- Constructor Coq.Init.Datatypes.O (shorter name to refer to it in current context is O)
- Locate Coq.Init.Datatypes.O.
- Constructor Coq.Init.Datatypes.O (shorter name to refer to it in current context is O)
- Locate I.Dont.Exist.
- No object of suffix I.Dont.Exist
-
Variant
Locate Term qualid
As Locate but restricted to terms.
-
Variant
Locate Module qualid
As Locate but restricted to modules.
-
Variant
Locate Ltac qualid
As Locate but restricted to tactics.
参考
Section Locating notations
Loading files¶
Coq offers the possibility of loading different parts of a whole development stored in separate files. Their contents will be loaded as if they were entered from the keyboard. This means that the loaded files are ASCII files containing sequences of commands for Coq’s toplevel. This kind of file is called a script for Coq. The standard (and default) extension of Coq’s script files is .v.
-
Command
Load ident
¶ This command loads the file named
ident
.v, searching successively in each of the directories specified in the loadpath. (see Section Libraries and filesystem)Files loaded this way cannot leave proofs open, and the
Load
command cannot be used inside a proof either.-
Variant
Load string
Loads the file denoted by the string
string
, where string is any complete filename. Then the ~ and .. abbreviations are allowed as well as shell variables. If no extension is specified, Coq will use the default extension.v
.
-
Variant
Load Verbose ident
-
Variant
Load Verbose string
Display, while loading, the answers of Coq to each command (including tactics) contained in the loaded file.
参考
Section Controlling display.
-
Error
Load is not supported inside proofs.
¶
-
Error
Files processed by Load cannot leave open proofs.
¶
-
Variant
コンパイルされたファイル¶
この節ではコンパイルされたファイルのロードに使うコマンドについて説明します (どのようにファイルをコンパイルするかについての文書については The Coq commands の章を参照)。コンパイルされたファイルは ライブラリファイル と呼ばれるモジュールの特殊なケースです。
-
Command
Require qualid
¶ このコマンドはロードパスの中でモジュール
qualid
を含むファイルを探し、対応するモジュールを Coq の環境に追加します。他のライブラリファイルへの依存を持つライブラリファイルについても、コマンドRequire
qualid
はモジュール qualid の依存する全てのライブラリファイルを再帰的に要求し、対応するモジュールを Coq の環境へ追加します。Coq はコンパイルされたファイルは正しい Coq コンパイラによって生成されたことを仮定し、従ってそれらの内容は再実行も再検証もされません。ファイルシステム上でそのファイルの場所を探すため、
qualid
は dirpath.ident という形式に分解され、Coq のロードパスから論理パスである dirpath (節 Libraries and filesystem 参照) へマップされたファイルシステムの物理ディレクトリの中でファイル ident.vo が検索されます。そのファイルを要求した時点での物理ディレクトリと論理名の間のマッピングはそのファイルのコンパイルに使われるマッピングと一貫していなければなりません。幾つかのファイルがマッチした場合、そのうちの一つが不特定の方法で選択されます。-
Variant
Require Import qualid
¶ これは
qualid
モジュールとその依存をロードし宣言し、そして ここ で説明されるようにqualid
の内容をインポートします。それは qualid が依存するモジュールを、これらのモジュールが以下で説明されるように、それら自身がRequire Export
を使うqualid
モジュール内で要求されるか、または再帰的にRequire Export
の列を通して要求されない限りインポートしません。もし要求されたモジュールが既にロードされていたら、Require Import
qualid
はImport
qualid
がそうするように単にそれをインポートします。
-
Variant
Require Export qualid
¶ このコマンドは
Require Import
qualid
のように振る舞いますが、さらなるモジュール(A と称する)がコマンドRequire Export
B を含む場合、コマンドRequire Import
A はモジュール B もインポートします。
-
Variant
Require [Import | Export] qualid+
これは
qualid
の列により指名されたモジュールとそれらの再帰的な依存をロードします。Import
かExport
が与えられると、それはさらにこれらのモジュールとExport
としてマークまたは推移的にマークされた全ての再帰的依存をインポートします。
-
Variant
From dirpath Require qualid
このコマンドは
Require
のように振る舞いますが、その絶対名が幾つかの dirpath' について dirpath.dirpath’.qualid という形式であるようなライブラリを選別します。これはqualid
ライブラリがその絶対ルートを明示することによって与えられたパッケージに由来することを保証するために有用です。
-
Error
Cannot load qualid: no physical path bound to dirpath.
¶
-
Error
Cannot find library foo in loadpath.
¶ そのコマンドはファイル foo.vo を見つけられませんでした。foo.v は存在するがコンパイルされていないか foo.vo はあなたの LoadPath 内には無い (節 Libraries and filesystem 参照) ディレクトリにあるかのどちらかです。
-
Error
Compiled library ident.vo makes inconsistent assumptions over library qualid.
¶ そのコマンドは
qualid
ライブラリのいくつかの特定のバージョンに依存するライブラリファイルident
.vo をロードしようとしましたが、それは現在の Coq セッションに既にロードされているものではありません。恐らく ident.v はモジュールqualid
を含む最新のバージョンのファイルとともに正しく再コンパイルされていません。
-
Error
Bad magic number.
¶ ファイル ident.vo は見つかりましたが、それは Coq がコンパイルしたモジュールではないか、またはそれは互換性の無いバージョンの Coq でコンパイルされたのいずれかです。
-
Error
The file `ident.vo` contains library dirpath and not library dirpath’.
¶ The library file dirpath’ is indirectly required by the
Require
command but it is bound in the current loadpath to the file ident.vo which was bound to a different library name dirpath at the time it was compiled.
-
Variant
-
Command
Print Libraries
¶ このコマンドは現在の Coq セッションにロードされたライブラリファイルのリストを表示します。これらのライブラリそれぞれについて、それがインポートされているならばそれも知らせます。
-
Command
Declare ML Module string+
¶ このコマンドは OCaml がコンパイルしたファイルを
string
の列で与えられた名前でロードします (動的リンク)。それは主にタクティックを動的にロードするために使用されます。そのファイルは現在の OCaml の loadpath の中も検索されます (Libraries and filesystem 節のAdd ML Path
コマンドを参照)。OCaml ファイルの読み込みはバイトコード版のcoqtop
(i.e.coqtop
が-byte
オプションを伴って呼ばれた、The Coq commands の章を参照) かまたは、Coq がネイティブ Dynlink (≥ 3.11) をサポートする OCaml のバージョンによってコンパイルされたときのみ可能です。-
Variant
Local Declare ML Module string+
この派生版はたとえそれがセクションの外であっても、それらが現れたモジュールをインポートしたモジュールへエクスポートされません。
-
Error
Loading of ML object file forbidden in a native Coq.
¶
-
Variant
Loadpath¶
Loadpaths are preferably managed using Coq command line options (see Section libraries-and-filesystem) but there remain vernacular commands to manage them for practical purposes. Such commands are only meant to be issued in the toplevel, and using them in source files is discouraged.
-
Command
Pwd
¶ This command displays the current working directory.
-
Command
Cd string
¶ This command changes the current directory according to
string
which can be any valid path.-
Variant
Cd
Is equivalent to Pwd.
-
Variant
-
Command
Add LoadPath string as dirpath
¶ This command is equivalent to the command line option
-Q
string
dirpath
. It adds the physical directory string to the current Coq loadpath and maps it to the logical directory dirpath.
-
Command
Add Rec LoadPath string as dirpath
¶ This command is equivalent to the command line option
-R
string
dirpath
. It adds the physical directory string and all its subdirectories to the current Coq loadpath.-
Variant
Add Rec LoadPath string
Works as
Add Rec LoadPath
string
asdirpath
but for the empty logical directory path.
-
Variant
-
Command
Print LoadPath
¶ This command displays the current Coq loadpath.
-
Variant
Print LoadPath dirpath
Works as
Print LoadPath
but displays only the paths that extend thedirpath
prefix.
-
Variant
-
Command
Add ML Path string
¶ This command adds the path
string
to the current OCaml loadpath (see the command Declare ML Module` in Section コンパイルされたファイル).
-
Command
Add Rec ML Path string
¶ This command adds the directory
string
and all its subdirectories to the current OCaml loadpath (see the commandDeclare ML Module
).
-
Command
Print ML Path string
¶ This command displays the current OCaml loadpath. This command makes sense only under the bytecode version of
coqtop
, i.e. using option-byte
(see the command Declare ML Module in Section コンパイルされたファイル).
-
Command
Locate File string
¶ This command displays the location of file string in the current loadpath. Typically, string is a .cmo or .vo or .v file.
-
Command
Locate Library dirpath
¶ This command gives the status of the Coq module dirpath. It tells if the module is loaded and if not searches in the load path for a module of logical name
dirpath
.
Backtracking¶
The backtracking commands described in this section can only be used
interactively, they cannot be part of a vernacular file loaded via
Load
or compiled by coqc
.
-
Command
Reset ident
¶ This command removes all the objects in the environment since
ident
was introduced, includingident
.ident
may be the name of a defined or declared object as well as the name of a section. One cannot reset over the name of a module or of an object inside a module.-
Variant
Reset Initial
Goes back to the initial state, just after the start of the interactive session.
-
Variant
-
Command
Back
¶ This command undoes all the effects of the last vernacular command. Commands read from a vernacular file via a
Load
are considered as a single command. Proof management commands are also handled by this command (see Chapter Proof handling). For that, Back may have to undo more than one command in order to reach a state where the proof management information is available. For instance, when the last command is aQed
, the management information about the closed proof has been discarded. In this case,Back
will then undo all the proof steps up to the statement of this proof.-
Variant
Back num
Undo
num
vernacular commands. As for Back, some extra commands may be undone in order to reach an adequate state. For instance Backnum
will not re-enter a closed proof, but rather go just before that proof.
-
Error
Invalid backtrack.
¶ The user wants to undo more commands than available in the history.
-
Variant
-
Command
BackTo num
¶ This command brings back the system to the state labeled
num
, forgetting the effect of all commands executed after this state. The state label is an integer which grows after each successful command. It is displayed in the prompt when in -emacs mode. Just asBack
(see above), theBackTo
command now handles proof states. For that, it may have to undo some extra commands and end on a state num′ ≤ num if necessary.-
Variant
Backtrack num num num
¶ バージョン 8.4 で非推奨.
Backtrack
is a deprecated form ofBackTo
which allows explicitly manipulating the proof environment. The three numbers represent the following:first number : State label to reach, as for
BackTo
.second number : Proof state number to unbury once aborts have been done. Coq will compute the number of
Undo
to perform (see Chapter Proof handling).third number : Number of
Abort
to perform, i.e. the number of currently opened nested proofs that must be canceled (see Chapter Proof handling).
-
Error
Invalid backtrack.
The destination state label is unknown.
-
Variant
Quitting and debugging¶
-
Command
Quit
¶ This command permits to quit Coq.
-
Command
Drop
¶ This is used mostly as a debug facility by Coq’s implementers and does not concern the casual user. This command permits to leave Coq temporarily and enter the OCaml toplevel. The OCaml command:
#use "include";;
adds the right loadpaths and loads some toplevel printers for all abstract types of Coq- section_path, identifiers, terms, judgments, …. You can also use the file base_include instead, that loads only the pretty-printers for section_paths and identifiers. You can return back to Coq with the command:
go();;
警告
It only works with the bytecode version of Coq (i.e. coqtop.byte, see Section interactive-use).
You must have compiled Coq from the source package and set the environment variable COQTOP to the root of your copy of the sources (see Section customization-by-environment-variables).
-
Command
Time command
¶ This command executes the vernacular command
command
and displays the time needed to execute it.
-
Command
Redirect string command
¶ This command executes the vernacular command
command
, redirecting its output to "string
.out".
-
Command
Timeout num command
¶ This command executes the vernacular command
command
. If the command has not terminated after the time specified by thenum
(time expressed in seconds), then it is interrupted and an error message is displayed.
-
Command
Fail command
¶ For debugging scripts, sometimes it is desirable to know whether a command or a tactic fails. If the given
command
fails, theFail
statement succeeds, without changing the proof state, and in interactive mode, the system prints a message confirming the failure. If the givencommand
succeeds, the statement is an error, and it prints a message indicating that the failure did not occur.-
Error
The command has not failed!
¶
-
Error
Controlling display¶
-
Flag
Silent
¶ This option controls the normal displaying.
-
Option
Warnings "- + ? ident+,"
¶ This option configures the display of warnings. It is experimental, and expects, between quotes, a comma-separated list of warning names or categories. Adding - in front of a warning or category disables it, adding + makes it an error. It is possible to use the special categories all and default, the latter containing the warnings enabled by default. The flags are interpreted from left to right, so in case of an overlap, the flags on the right have higher priority, meaning that A,-A is equivalent to -A.
-
Flag
Search Output Name Only
¶ This option restricts the output of search commands to identifier names; turning it on causes invocations of
Search
,SearchHead
,SearchPattern
,SearchRewrite
etc. to omit types from their output, printing only identifiers.
-
Option
Printing Width num
¶ This command sets which left-aligned part of the width of the screen is used for display. At the time of writing this documentation, the default value is 78.
-
Option
Printing Depth num
¶ This option controls the nesting depth of the formatter used for pretty- printing. Beyond this depth, display of subterms is replaced by dots. At the time of writing this documentation, the default value is 50.
-
Flag
Printing Compact Contexts
¶ This option controls the compact display mode for goals contexts. When on, the printer tries to reduce the vertical size of goals contexts by putting several variables (even if of different types) on the same line provided it does not exceed the printing width (see
Printing Width
). At the time of writing this documentation, it is off by default.
-
Flag
Printing Unfocused
¶ This option controls whether unfocused goals are displayed. Such goals are created by focusing other goals with bullets (see Bullets or curly braces). It is off by default.
-
Flag
Printing Dependent Evars Line
¶ This option controls the printing of the “(dependent evars: …)” line when
-emacs
is passed.
Controlling the reduction strategies and the conversion algorithm¶
Coq provides reduction strategies that the tactics can invoke and two different algorithms to check the convertibility of types. The first conversion algorithm lazily compares applicative terms while the other is a brute-force but efficient algorithm that first normalizes the terms before comparing them. The second algorithm is based on a bytecode representation of terms similar to the bytecode representation used in the ZINC virtual machine [Ler90]. It is especially useful for intensive computation of algebraic values, such as numbers, and for reflection-based tactics. The commands to fine- tune the reduction strategies and the lazy conversion algorithm are described first.
-
Command
Opaque qualid+
¶ This command has an effect on unfoldable constants, i.e. on constants defined by
Definition
orLet
(with an explicit body), or by a command assimilated to a definition such asFixpoint
,Program Definition
, etc, or by a proof ended byDefined
. The command tells not to unfold the constants in thequalid
sequence in tactics using δ-conversion (unfolding a constant is replacing it by its definition).Opaque
has also an effect on the conversion algorithm of Coq, telling it to delay the unfolding of a constant as much as possible when Coq has to check the conversion (see Section Conversion rules) of two distinct applied constants.-
Variant
Global Opaque qualid+
¶ The scope of
Opaque
is limited to the current section, or current file, unless the variantGlobal Opaque
is used.
-
Variant
-
Command
Transparent qualid+
¶ This command is the converse of
Opaque
and it applies on unfoldable constants to restore their unfoldability after an Opaque command.Note in particular that constants defined by a proof ended by Qed are not unfoldable and Transparent has no effect on them. This is to keep with the usual mathematical practice of proof irrelevance: what matters in a mathematical development is the sequence of lemma statements, not their actual proofs. This distinguishes lemmas from the usual defined constants, whose actual values are of course relevant in general.
-
Variant
Global Transparent qualid+
¶ The scope of Transparent is limited to the current section, or current file, unless the variant
Global Transparent
is used.
-
Variant
-
Command
Strategy level [ qualid+ ]
¶ This command generalizes the behavior of Opaque and Transparent commands. It is used to fine-tune the strategy for unfolding constants, both at the tactic level and at the kernel level. This command associates a level to the qualified names in the
qualid
sequence. Whenever two expressions with two distinct head constants are compared (for instance, this comparison can be triggered by a type cast), the one with lower level is expanded first. In case of a tie, the second one (appearing in the cast type) is expanded.Levels can be one of the following (higher to lower):
opaque
: level of opaque constants. They cannot be expanded by tactics (behaves like +∞, see next item).num
: levels indexed by an integer. Level 0 corresponds to the default behavior, which corresponds to transparent constants. This level can also be referred to as transparent. Negative levels correspond to constants to be expanded before normal transparent constants, while positive levels correspond to constants to be expanded after normal transparent constants.expand
: level of constants that should be expanded first (behaves like −∞)
-
Variant
Local Strategy level [ qualid+ ]
These directives survive section and module closure, unless the command is prefixed by
Local
. In the latter case, the behavior regarding sections and modules is the same as for theTransparent
andOpaque
commands.
-
Command
Print Strategy qualid
¶ This command prints the strategy currently associated to
qualid
. It fails ifqualid
is not an unfoldable reference, that is, neither a variable nor a constant.-
Error
The reference is not unfoldable.
¶
-
Variant
Print Strategies
Print all the currently non-transparent strategies.
-
Error
-
Command
Declare Reduction ident := convtactic
¶ This command allows giving a short name to a reduction expression, for instance lazy beta delta [foo bar]. This short name can then be used in
Eval
ident
in
... oreval
directives. This command accepts the Local modifier, for discarding this reduction name at the end of the file or module. For the moment the name cannot be qualified. In particular declaring the same name in several modules or in several functor applications will be refused if these declarations are not local. The nameident
cannot be used directly as an Ltac tactic, but nothing prevents the user to also perform aLtac
ident:=
convtactic.
Controlling the locality of commands¶
-
Command
Local command
¶
-
Command
Global command
¶
Some commands support a Local or Global prefix modifier to control the scope of their effect. There are four kinds of commands:
Commands whose default is to extend their effect both outside the section and the module or library file they occur in. For these commands, the Local modifier limits the effect of the command to the current section or module it occurs in. As an example, the
Coercion
andStrategy
commands belong to this category.Commands whose default behavior is to stop their effect at the end of the section they occur in but to extend their effect outside the module or library file they occur in. For these commands, the Local modifier limits the effect of the command to the current module if the command does not occur in a section and the Global modifier extends the effect outside the current sections and current module if the command occurs in a section. As an example, the
Arguments
,Ltac
orNotation
commands belong to this category. Notice that a subclass of these commands do not support extension of their scope outside sections at all and the Global modifier is not applicable to them.Commands whose default behavior is to stop their effect at the end of the section or module they occur in. For these commands, the
Global
modifier extends their effect outside the sections and modules they occur in. TheTransparent
andOpaque
(see Section Controlling the reduction strategies and the conversion algorithm) commands belong to this category.Commands whose default behavior is to extend their effect outside sections but not outside modules when they occur in a section and to extend their effect outside the module or library file they occur in when no section contains them.For these commands, the Local modifier limits the effect to the current section or module while the Global modifier extends the effect outside the module even when the command occurs in a section. The
Set
andUnset
commands belong to this category.