5.2 Requests to the environment

5.2.1 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.


Variants:
  1. Check num term
    Displays the type of term in the context of the num-th subgoal.

5.2.2 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).


Variants:
  1. Eval num convtactic in term.
    Evaluates term in the context of the num-th subgoal.

See also: section 7.5.

5.2.3 Extraction term.

This command displays the extracted term from term. The extraction is processed according to the distinction between Set and Prop; that is to say, between logical and computational content (see section 4.1.1). The extracted term is displayed in Objective Caml syntax, where global identifiers are still displayed as in Coq terms.


Variants:
  1. Recursive Extraction qualid1 ... qualidn.
    Recursively extracts all the material needed for the extraction of globals qualid1 ... qualidn.

See also: chapter 17.

5.2.4 Opaque qualid1 ...qualidn.

This command tells not to unfold the the constants qualid1 ...qualidn in tactics using d-conversion. Unfolding a constant is replacing it by its definition. Opaque can only apply on constants originally defined as Transparent.

Constants defined by a proof ended by Qed are automatically stamped as Opaque and can no longer be considered as Transparent. 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.
See also: sections 7.5, 7.11, 6.1.3


Error messages:
  1. The reference qualid was not found in the current environment
    There is no constant referred by qualid in the environment. Nevertheless, if you asked Opaque foo bar and if bar does not exist, foo is set opaque.

5.2.5 Transparent qualid1 ...qualidn.

This command is the converse of Opaque and can only apply on constants originally defined as Transparent to restore their initial behaviour after an Opaque command.

The constants automatically declared transparent are the ones defined by a proof ended by Defined, or by a Definition or Local with an explicit body.
Warning: Transparent and Opaque are not synchronous with the reset mechanism. If a constant was transparent at point A, if you set it opaque at point B and reset to point A, you return to state of point A with the difference that the constant is still opaque. This can cause changes in tactic scripts behaviour.

At section or module closing, a constant recovers the status it got at the time of its definition.


Error messages:
  1. The reference qualid was not found in the current environment
    There is no constant referred by qualid in the environment.

See also: sections 7.5, 7.11, 6.1.3

5.2.6 Search qualid.

This command displays the name and type of all theorems of the current context whose statement's conclusion has the form (qualid t1 .. tn). This command is useful to remind the user of the name of library lemmas.
Error messages:
  1. The reference qualid was not found in the current environment
    There is no constant in the environment named qualid.

5.2.7 SearchPattern term.

This command displays the name and type of all theorems of the current context whose statement's conclusion matches the expression term where holes in the latter are denoted by ``?''.

Coq < Require Arith.

Coq < SearchPattern (plus ? ?)=?.
le_plus_minus_r: (n,m:nat)(le n m)->(plus n (minus m n))=m
mult_acc_aux: (n,s,m:nat)(plus s (mult n m))=(mult_acc s m n)
plus_sym: (n,m:nat)(plus n m)=(plus m n)
plus_Snm_nSm: (n,m:nat)(plus (S n) m)=(plus n (S m))
plus_assoc_l: (n,m,p:nat)(plus n (plus m p))=(plus (plus n m) p)
plus_permute: (n,m,p:nat)(plus n (plus m p))=(plus m (plus n p))
plus_assoc_r: (n,m,p:nat)(plus (plus n m) p)=(plus n (plus m p))
plus_permute_2_in_4:
  (a,b,c,d:nat)
   (plus (plus a b) (plus c d))=(plus (plus a c) (plus b d))
plus_tail_plus: (n,m:nat)(plus n m)=(tail_plus n m)
plus_O_n: (n:nat)(plus (0) n)=n
plus_Sn_m: (n,m:nat)(plus (S n) m)=(S (plus n m))
mult_n_Sm: (n,m:nat)(plus (mult n m) n)=(mult n (S m))

Patterns need not be linear: you can express that the same expression must occur in two places by using indexed `?''.

Coq < Require Arith.

Coq < SearchPattern (plus ?1 ?)=?1.

5.2.8 SearchRewrite term.

This command displays the name and type of all 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 ``?''.

Coq < Require Arith.

Coq < SearchRewrite (plus ? ?).
le_plus_minus: (n,m:nat)(le n m)->m=(plus n (minus m n))
le_plus_minus_r: (n,m:nat)(le n m)->(plus n (minus m n))=m
mult_plus_distr:
  (n,m,p:nat)(mult (plus n m) p)=(plus (mult n p) (mult m p))
mult_plus_distr_r:
  (n,m,p:nat)(mult n (plus m p))=(plus (mult n m) (mult n p))
mult_acc_aux: (n,s,m:nat)(plus s (mult n m))=(mult_acc s m n)
plus_sym: (n,m:nat)(plus n m)=(plus m n)
plus_Snm_nSm: (n,m:nat)(plus (S n) m)=(plus n (S m))
plus_assoc_l: (n,m,p:nat)(plus n (plus m p))=(plus (plus n m) p)
plus_permute: (n,m,p:nat)(plus n (plus m p))=(plus m (plus n p))
plus_assoc_r: (n,m,p:nat)(plus (plus n m) p)=(plus n (plus m p))
plus_permute_2_in_4:
  (a,b,c,d:nat)
   (plus (plus a b) (plus c d))=(plus (plus a c) (plus b d))
plus_tail_plus: (n,m:nat)(plus n m)=(tail_plus n m)
plus_n_O: (n:nat)n=(plus n (0))
plus_O_n: (n:nat)(plus (0) n)=n
plus_n_Sm: (n,m:nat)(S (plus n m))=(plus n (S m))
plus_Sn_m: (n,m:nat)(plus (S n) m)=(S (plus n m))
mult_n_Sm: (n,m:nat)(plus (mult n m) n)=(mult n (S m))


Variants:
  1. Search qualid inside module1...modulen.
    SearchPattern term inside module1...modulen.
    SearchRewrite term inside module1...modulen.

    This restricts the search to constructions defined in modules module1...modulen.

  2. Search qualid outside module1...modulen.
    SearchPattern term outside module1...modulen.
    SearchRewrite term outside module1...modulen.

    This restricts the search to constructions not defined in modules module1...modulen.

Error messages:
  1. Module/section module not found No module module has been required (see section 5.4.2).

5.2.9 Locate qualid.

This command displays the full name of the qualified identifier qualid and consequently the Coq module in which it is defined.

Coq < Locate nat.
Coq.Init.Datatypes.nat

Coq < Locate Datatypes.O.
Coq.Init.Datatypes.O

Coq < Locate Init.Datatypes.O.
Coq.Init.Datatypes.O

Coq < Locate Coq.Init.Datatypes.O.
Coq.Init.Datatypes.O

Coq < Locate I.Dont.Exist.
Error: I.Dont.Exist is not a defined object