A deduction rule is a link between some (unique) formula, that we call the conclusion and (several) formulas that we call the premises. Indeed, a deduction rule can be read in two ways. The first one has the shape: “if I know this and this then I can deduce this”. For instance, if I have a proof of A and a proof of B then I have a proof of A ∧ B. This is forward reasoning from premises to conclusion. The other way says: “to prove this I have to prove this and this”. For instance, to prove A ∧ B, I have to prove A and I have to prove B. This is backward reasoning which proceeds from conclusion to premises. We say that the conclusion is the goal to prove and premises are the subgoals. The tactics implement backward reasoning. When applied to a goal, a tactic replaces this goal with the subgoals it generates. We say that a tactic reduces a goal to its subgoal(s).
Each (sub)goal is denoted with a number. The current goal is numbered 1. By default, a tactic is applied to the current goal, but one can address a particular goal in the list by writing n:tactic which means “apply tactic tactic to goal number n”. We can show the list of subgoals by typing Show (see Section 7.3.1).
Since not every rule applies to a given statement, every tactic cannot be used to reduce any goal. In other words, before applying a tactic to a given goal, the system checks that some preconditions are satisfied. If it is not the case, the tactic raises an error message.
Tactics are build from atomic tactics and tactic expressions (which extends the folklore notion of tactical) to combine those atomic tactics. This chapter is devoted to atomic tactics. The tactic language will be described in Chapter 9.
There are, at least, three levels of atomic tactics. The simplest one implements basic rules of the logical framework. The second level is the one of derived rules which are built by combination of other tactics. The third one implements heuristics or decision procedures to build a complete proof of a goal.
A tactic is applied as an ordinary command. If the tactic does not address the first subgoal, the command may be preceded by the wished subgoal number as shown below:
tactic_invocation | ::= | num : tactic . |
| | tactic . |
This tactic applies to any goal. It gives directly the exact proof term of the goal. Let T be our goal, let p be a term of type U then exact p succeeds iff T and U are convertible (see Section 4.3).
Error messages:
Variants:
This tactic allows to give an exact proof but still with some holes. The holes are noted “_”.
Error messages:
An example of use is given in Section 10.1.
Tactics presented in this section implement the basic typing rules of Cic given in Chapter 4.
This tactic applies to any goal. It implements the “Var” rule given in Section 4.2. It looks in the local context for an hypothesis which type is equal to the goal. If it is the case, the subgoal is proved. Otherwise, it fails.
Error messages:
Variants:
This tactic erases the hypothesis named ident in the local context of the current goal. Then ident is no more displayed and no more usable in the proof development.
Variants:
This is equivalent to clear ident1. … clear identn.
This tactic expects ident to be a local definition then clears its body. Otherwise said, this tactic turns a definition into an assumption.
This tactic clears all hypotheses except the ones depending in the hypotheses named ident1 … identn and in the goal.
This tactic clears all hypotheses except the ones depending in goal.
Error messages:
This moves the hypothesis named ident1 in the local context after the hypothesis named ident2.
If ident1 comes before ident2 in the order of dependences, then all hypotheses between ident1 and ident2 which (possibly indirectly) depend on ident1 are moved also.
If ident1 comes after ident2 in the order of dependences, then all hypotheses between ident1 and ident2 which (possibly indirectly) occur in ident1 are moved also.
Error messages:
This renames hypothesis ident1 into ident2 in the current context1
Error messages:
This tactic applies to a goal which is either a product or starts with a let binder. If the goal is a product, the tactic implements the “Lam” rule given in Section 4.22. If the goal starts with a let binder then the tactic implements a mix of the “Let” and “Conv”.
If the current goal is a dependent product forall x:T, U (resp let x:=t in U) then intro puts x:T (resp x:=t) in the local context. The new subgoal is U.
If the goal is a non dependent product T -> U, then it puts in the local context either Hn:T (if T is of type Set or Prop) or Xn:T (if the type of T is Type). The optional index n is such that Hn or Xn is a fresh identifier. In both cases the new subgoal is U.
If the goal is neither a product nor starting with a let definition, the tactic intro applies the tactic red until the tactic intro can be applied or the goal is not reducible.
Error messages:
Variants:
Repeats intro until it meets the head-constant. It never reduces head-constants and it never fails.
Applies intro but forces ident to be the name of the introduced hypothesis.
Error message: name ident is already used
Remark: If a name used by intro hides the base name of a global
constant then the latter can still be referred to by a qualified name
(see 2.6.2).
Is equivalent to the composed tactic intro ident1; … ; intro identn.
More generally, the intros tactic takes a pattern as argument in order to introduce names for components of an inductive definition or to clear introduced hypotheses; This is explained in 8.7.3.
Repeats intro until it meets a premise of the goal having form ( ident : term ) and discharges the variable named ident of the current goal.
Repeats intro until the num-th non-dependent product. For
instance, on the subgoal forall x y:nat, x=y -> y=x
the tactic intros until 1
is equivalent to intros x y H, as x=y -> y=x
is the
first non-dependent product. And on the subgoal forall x y z:nat, x=y -> y=x
the tactic intros until 1
is equivalent to intros x y z as the product on z
can be rewritten as a non-dependent product: forall x y:nat, nat -> x=y -> y=x
Error message: No such hypothesis in current goal
Happens when num is 0 or is greater than the number of non-dependent products of the goal.
Applies intro but puts the introduced hypothesis after the hypothesis ident in the hypotheses.
Error messages:
Behaves as previously but ident1 is the name of the introduced hypothesis. It is equivalent to intro ident1; move ident1 after ident2.
Error messages:
This tactic applies to any goal. The argument term is a term well-formed in the local context. The tactic apply tries to match the current goal against the conclusion of the type of term. If it succeeds, then the tactic returns as many subgoals as the number of non dependent premises of the type of term. The tactic apply relies on first-order pattern-matching with dependent types. See pattern in Section 8.5.7 to transform a second-order pattern-matching problem into a first-order one.
Error messages:
The apply tactic failed to match the conclusion of term and the current goal. You can help the apply tactic by transforming your goal with the change or pattern tactics (see sections 8.5.7, 8.3.11).
This occurs when some instantiations of premises of term are not deducible from the unification. This is the case, for instance, when you want to apply a transitivity property. In this case, you have to use one of the variants below:
Variants:
Provides apply with explicit instantiations for all dependent premises of the type of term which do not occur in the conclusion and consequently cannot be found by unification. Notice that term1 … termn must be given according to the order of these dependent premises of the type of term.
This also provides apply with values for instantiating premises. But variables are referred by names and non dependent products by order (see syntax in Section 8.3.12).
The tactic eapply behaves as apply but does not fail when no instantiation are deducible for some variables in the premises. Rather, it turns these variables into so-called existential variables which are variables still to instantiate. An existential variable is identified by a name of the form ?n where n is a number. The instantiation is intended to be found later in the proof.
An example of use of eapply is given in Section 10.2.
This tactic applies to any goal, say G. The argument term has to be well-formed in the current context, its type being reducible to a non-dependent product A -> B with B possibly containing products. Then it generates two subgoals B->G and A. Applying lapply H (where H has type A->B and B does not start with a product) does the same as giving the sequence cut B. 2:apply H. where cut is described below.
Warning: When term contains more than one non
dependent product the tactic lapply only takes into account the
first product.
This replaces term by ident in the conclusion or in the hypotheses of the current goal and adds the new definition ident:= term to the local context. The default is to make this replacement only in the conclusion.
Variants:
This behaves the same but substitutes term in the hypotheses only (not in the conclusion).
This is equivalent to set ( ident := term ), i.e. it substitutes term in the conclusion only.
This behaves the same but substitutes term only in the hypothesis named ident1.
This notation allows to specify which occurrences of term have to be substituted in the hypothesis named ident1. The occurrences are numbered from left to right and are meaningful on a pure expression using no implicit argument, notation or coercion. A negative occurrence number means an occurrence which should not be substituted. As an exception of the left-to-right order, the occurrences in the return subexpression of a match are considered before the occurrences in the matched term.
For expressions using notations, or hiding implicit arguments or coercions, it is recommended to make explicit all occurrences in order by using Set Printing All (see section 2.9).
This allows to specify which occurrences of the conclusion are concerned.
It substitutes term at occurrences num1i … numnii of hypothesis identi. Each at part is optional.
This is the more general form which combines all the previous possibilities.
This behaves as set ( ident := term ) but ident is generated by Coq. This variant is available for the forms with in too.
This adds the local definition ident := term to the current context without performing any replacement in the goal or in the hypotheses.
This behaves as pose ( ident := term ) but ident is generated by Coq.
This tactic applies to any goal. assert (H : U) adds a new hypothesis of name H asserting U to the current goal and opens a new subgoal U3. The subgoal U comes first in the list of subgoals remaining to prove.
Error messages:
Variants:
This behaves as assert ( ident : form ) but ident is generated by Coq.
This behaves as assert (ident : type);[exact term|idtac] where type is the type of term.
This tactic applies to any goal. It implements the non dependent case of the “App” rule given in Section 4.2. (This is Modus Ponens inference rule.) cut U transforms the current goal T into the two following subgoals: U -> T and U. The subgoal U -> T comes first in the list of remaining subgoal to prove.
This tactic behaves like assert but tries to apply tactic to any subgoals generated by assert.
This tactic behaves like assert (ident : form).
This tactic behaves like assert (ident:T by exact term where T is the type of term.
This tactic applies to any goal. The argument term is a term well-formed in the local context and the argument ident is an hypothesis of the context. The tactic apply term in ident tries to match the conclusion of the type of ident against a non dependent premises of the type of term, trying them from right to left. If it succeeds, the statement of hypothesis ident is replaced by the conclusion of the type of term. The tactic also returns as many subgoals as the number of other non dependent premises in the type of term and of the non dependent premises of the type of ident. The tactic apply … in relies on first-order pattern-matching with dependent types.
Error messages:
This happens if the type of term has no non dependent premise.
This happens if the conclusion of ident does not match any of the non dependent premises of the type of term.
Variants:
This applies each of term in sequence in ident.
This does the same but uses the bindings in each bindings_list to instanciate the parameters of the corresponding type of term (see syntax of bindings in Section 8.3.12).
This tactic applies to any goal. It generalizes the conclusion w.r.t. one subterm of it. For example:
If the goal is G and t is a subterm of type T in the goal, then generalize t replaces the goal by forall (x:T), G′ where G′ is obtained from G by replacing all occurrences of t by x. The name of the variable (here n) is chosen accordingly to T.
Variants:
Is equivalent to generalize termn; … ; generalize term1. Note that the sequence of termi’s are processed from n to 1.
This generalizes term but also all hypotheses which depend on term. It clears the generalized hypotheses.
This is equivalent to a generalize followed by a clear.
This tactic applies to any goal. It implements the rule “Conv” given in Section 4.3. change U replaces the current goal T with U providing that U is well-formed and that T and U are convertible.
Error messages:
This replaces the occurrences of term1 by term2 in the current goal. The terms term1 and term2 must be convertible.
This replaces the occurrences numbered num1 … numi of term1 by term2 in the current goal. The terms term1 and term2 must be convertible.
Error message: Too few occurrences
This applies the change tactic not to the goal but to the hypothesis ident.
See also: 8.5
A bindings list is generally used after the keyword with in tactics. The general shape of a bindings list is (ref1 := term1) … (refn := termn) where ref is either an ident or a num. It is used to provide a tactic with a list of values (term1, …, termn) that have to be substituted respectively to ref1, …, refn. For all i ∈ [1… n], if refi is identi then it references the dependent product identi:T (for some type T); if refi is numi then it references the numi-th non dependent premise.
A bindings list can also be a simple list of terms term1 term2 …termn. In that case the references to which these terms correspond are determined by the tactic. In case of elim (see Section 5) the terms should correspond to all the dependent products in the type of term while in the case of apply only the dependent products which are not bound in the conclusion of the type are given.
The evar tactic creates a new local definition named ident with type term in the context. The body of this binding is a fresh existential variable.
The instantiate tactic allows to solve an existential variable with the term term. The num argument is the position of the existential variable from right to left in the conclusion. This cannot be the number of the existential variable since this number is different in every session.
Variants:
These allow to refer respectively to existential variables occurring in a hypothesis or in the body or the type of a local definition.
This tactic applies to any goal. The argument term is any proposition P of type Prop. This tactic applies False elimination, that is it deduces the current goal from False, and generates as subgoals ∼P and P. It is very useful in proofs by cases, where some cases are impossible. In most cases, P or ∼P is one of the hypotheses of the local context.
This tactic applies to any goal. The contradiction tactic attempts to find in the current context (after all intros) one which is equivalent to False. It permits to prune irrelevant cases. This tactic is a macro for the tactics sequence intros; elimtype False; assumption.
Error messages:
This set of tactics implements different specialized usages of the tactic change.
All conversion tactics (including change) can be parameterized by the parts of the goal where the conversion can occur. The specification of such parts are called clauses. It can be either the conclusion, or an hypothesis. In the case of a defined hypothesis it is possible to specify if the conversion should occur on the type part, the body part or both (default).
Clauses are written after a conversion tactic (tactics set 8.3.7, rewrite 8.8.1, replace 8.8.3 and autorewrite 8.12.12 also use clauses) and are introduced by the keyword in. If no clause is provided, the default is to perform the conversion only in the conclusion.
The syntax and description of the various clauses follows:
For backward compatibility, the notation in H1… Hn performs the conversion in hypotheses H1… Hn.
These parameterized reduction tactics apply to any goal and perform the normalization of the goal according to the specified flags. Since the reduction considered in Coq include β (reduction of functional application), δ (unfolding of transparent constants, see 6.2.5), ι (reduction of Cases, Fix and CoFix expressions) and ζ (removal of local definitions), every flag is one of beta, delta, iota, zeta, [qualid1…qualidk] and -[qualid1…qualidk]. The last two flags give the list of constants to unfold, or the list of constants not to unfold. These two flags can occur only after the delta flag. If alone (i.e. not followed by [qualid1…qualidk] or -[qualid1…qualidk]), the delta flag means that all constants must be unfolded. However, the delta flag does not apply to variables bound by a let-in construction whose unfolding is controlled by the zeta flag only.
The goal may be normalized with two strategies: lazy (lazy tactic), or call-by-value (cbv tactic). The lazy strategy is a call-by-need strategy, with sharing of reductions: the arguments of a function call are partially evaluated only when necessary, but if an argument is used several times, it is computed only once. This reduction is efficient for reducing expressions with dead code. For instance, the proofs of a proposition ∃T x. P(x) reduce to a pair of a witness t, and a proof that t verifies the predicate P. Most of the time, t may be computed without computing the proof of P(t), thanks to the lazy strategy.
The call-by-value strategy is the one used in ML languages: the arguments of a function call are evaluated first, using a weak reduction (no reduction under the λ-abstractions). Despite the lazy strategy always performs fewer reductions than the call-by-value strategy, the latter should be preferred for evaluating purely computational expressions (i.e. with few dead code).
Variants:
This tactic is an alias for cbv beta delta iota zeta.
This tactic evaluates the goal using the optimized call-by-value evaluation bytecode-based virtual machine. This algorithm is dramatically more efficient than the algorithm used for the cbv tactic, but it cannot be fine-tuned. It is specially interesting for full evaluation of algebraic objects. This includes the case of reflexion-based tactics.
Error messages:
This tactic applies to a goal which has the form forall (x:T1)…(xk:Tk), c t1 … tn where c is a constant. If c is transparent then it replaces c with its definition (say t) and then reduces (t t1 … tn) according to βιζ-reduction rules.
Error messages:
This tactic applies to any goal. It replaces the current goal with its head normal form according to the βδιζ-reduction rules. hnf does not produce a real head normal form but either a product or an applicative term in head normal form or a variable.
Example: The term forall n:nat, (plus (S n) (S n))
is not reduced by hnf.
Remark: The δ rule only applies to transparent constants
(see Section 6.2.4 on transparency and opacity).
This tactic applies to any goal. The tactic simpl first applies βι-reduction rule. Then it expands transparent constants and tries to reduce T’ according, once more, to βι rules. But when the ι rule is not applicable then possible δ-reductions are not applied. For instance trying to use simpl on (plus n O)=n does change nothing. Notice that only transparent constants whose name can be reused as such in the recursive calls are possibly unfolded. For instance a constant defined by plus’ := plus is possibly unfolded and reused in the recursive calls, but a constant such as succ := plus (S O) is never unfolded.
This applies simpl only to the occurrences of term in the current goal.
This applies simpl only to the num1, …, numi occurrences of term in the current goal.
Error message: Too few occurrences
This applies simpl only to the applicative subterms whose head occurrence is ident.
This applies simpl only to the num1, …, numi applicative subterms whose head occurrence is ident.
This tactic applies to any goal. The argument qualid must denote a defined transparent constant or local definition (see Sections 1.3.2 and 6.2.5). The tactic unfold applies the δ rule to each occurrence of the constant to which qualid refers in the current goal and then replaces it with its βι-normal form.
Error messages:
Variants:
Replaces simultaneously qualid1, …, qualidn with their definitions and replaces the current goal with its βι normal form.
The lists num11, …, numi1 and num1n, …, numjn specify the occurrences of qualid1, …, qualidn to be unfolded. Occurrences are located from left to right.
Error message: bad occurrence number of qualidi
Error message: qualidi does not occur
This tactic applies to any goal. The term term is reduced using the red tactic. Every occurrence of the resulting term in the goal is then replaced by term.
Variants:
Equivalent to fold term1;…; fold termn.
This command applies to any goal. The argument term must be a free subterm of the current goal. The command pattern performs β-expansion (the inverse of β-reduction) of the current goal (say T) by
For instance, if the current goal T is expressible has φ(t) where the notation captures all the instances of t in φ(t), then pattern t transforms it into (fun x:A => φ(x)) t. This command can be used, for instance, when the tactic apply fails on matching.
Variants:
Only the occurrences num1 … numn of term will be considered for β-expansion. Occurrences are located from left to right.
Starting from a goal φ(t1 … tm), the tactic
pattern t1, …, tm generates the equivalent goal (fun (x1:A1) … (xm:Am) => φ(x1…
xm)) t1 … tm.
If ti occurs in one of the
generated types Aj these occurrences will also be considered and
possibly abstracted.
This behaves as above but processing only the occurrences num11, …, numi1 of term1, …, num1m, …, numjm of termm starting from termm.
conv_tactic in ident1 … identn
Applies the conversion tactic conv_tactic to the hypotheses ident1, …, identn. The tactic conv_tactic is any of the conversion tactics listed in this section.
If identi is a local definition, then identi can be replaced by (Type of identi) to address not the body but the type of the local definition. Example: unfold not in (Type of H1) (Type of H3).
Error messages:
Introduction tactics address goals which are inductive constants. They are used when one guesses that the goal can be obtained with one of its constructors’ type.
This tactic applies to a goal such that the head of its conclusion is an inductive constant (say I). The argument num must be less or equal to the numbers of constructor(s) of I. Let ci be the i-th constructor of I, then constructor i is equivalent to intros; apply ci.
Error messages:
Variants:
This tries constructor 1 then constructor 2, … , then constructor n where n if the number of constructors of the head of the goal.
Let ci be the i-th constructor of I, then constructor i with bindings_list is equivalent to intros; apply ci with bindings_list.
Warning: the terms in the bindings_list are checked
in the context where constructor is executed and not in the
context where apply is executed (the introductions are not
taken into account).
Applies if I has only one constructor, typically in the case of conjunction A∧ B. Then, it is equivalent to constructor 1.
Applies if I has only one constructor, for instance in the case of existential quantification ∃ x· P(x). Then, it is equivalent to intros; constructor 1 with bindings_list.
Apply if I has two constructors, for instance in the case of disjunction A∨ B. Then, they are respectively equivalent to constructor 1 and constructor 2.
As soon as the inductive type has the right number of constructors, these expressions are equivalent to the corresponding constructor i with bindings_list.
This tactic behaves like constructor but is able to introduce existential variables if an instanciation for a variable cannot be found (cf eapply). The tactics eexists, esplit, eleft and eright follows the same behaviour.
Elimination tactics are useful to prove statements by induction or case analysis. Indeed, they make use of the elimination (or induction) principles generated with inductive definitions (see Section 4.5).
This tactic applies to any goal. The type of the argument term must be an inductive constant. Then, the tactic induction generates subgoals, one for each possible form of term, i.e. one for each constructor of the inductive type.
The tactic induction automatically replaces every occurrences of term in the conclusion and the hypotheses of the goal. It automatically adds induction hypotheses (using names of the form IHn1) to the local context. If some hypothesis must not be taken into account in the induction hypothesis, then it needs to be removed first (you can also use the tactics elim or simple induction, see below).
There are particular cases:
Remark: For simple induction on a numeral, use syntax induction
(num) (not very interesting anyway).
Example:
Error messages:
As induction uses apply, see Section 8.3.6 and the variant elim … with … below.
Variants:
This behaves as induction term but uses the names in intro_pattern to names the variables introduced in the context. The intro_pattern must have the form [ p11 …p1n1 | … | pm1 …pmnm ] with m being the number of constructors of the type of term. Each variable introduced by induction in the context of the ith goal gets its name from the list pi1 …pini in order. If there are not enough names, induction invents names for the remaining variables to introduce. More generally, the p’s can be any introduction patterns (see Section 8.7.3). This provides a concise notation for nested induction.
Remark: for an inductive type with one constructor, the pattern notation
(p1,…,pn) can be used instead of
[ p1 …pn ].
This behaves as induction term but using the induction scheme of name qualid. It does not expect that the type of term is inductive.
where qualid is an induction principle with complex predicates (like the ones generated by function induction).
This combines induction term using qualid and induction term as intro_pattern.
This is a more basic induction tactic. Again, the type of the argument term must be an inductive constant. Then according to the type of the goal, the tactic elim chooses the right destructor and applies it (as in the case of the apply tactic). For instance, assume that our proof context contains n:nat, assume that our current goal is T of type Prop, then elim n is equivalent to apply nat_ind with (n:=n). The tactic elim does not affect the hypotheses of the goal, neither introduces the induction loading into the context of hypotheses.
also works when the type of term starts with products and the head symbol is an inductive definition. In that case the tactic tries both to find an object in the inductive definition and to use this inductive definition for elimination. In case of non-dependent products in the type, subgoals are generated corresponding to the hypotheses. In the case of dependent products, the tactic will try to find an instance for which the elimination lemma applies.
Provides also elim with values for instantiating premises by associating explicitly variables (or non dependent products) with their intended instance.
Allows the user to give explicitly an elimination predicate term2 which is not the standard one for the underlying inductive type of term1. Each of the term1 and term2 is either a simple term or a term with a bindings list (see 8.3.12).
The argument form must be inductively defined. elimtype I is equivalent to cut I. intro Hn; elim Hn; clear Hn. Therefore the hypothesis Hn will not appear in the context(s) of the subgoal(s). Conversely, if t is a term of (inductive) type I and which does not occur in the goal then elim t is equivalent to elimtype I; 2: exact t.
Error message: Impossible to unify … with …
Arises when form needs to be applied to parameters.
This tactic behaves as intros until ident; elim ident when ident is a quantified variable of the goal.
This tactic behaves as intros until num; elim ident where ident is the name given by intros until num to the num-th non-dependent premise of the goal.
The tactic destruct is used to perform case analysis without recursion. Its behavior is similar to induction except that no induction hypothesis is generated. It applies to any goal and the type of term must be inductively defined. There are particular cases:
Remark: For destruction of a numeral, use syntax destruct
(num) (not very interesting anyway).
Variants:
This behaves as destruct term but uses the names in intro_pattern to names the variables introduced in the context. The intro_pattern must have the form [ p11 …p1n1 | … | pm1 …pmnm ] with m being the number of constructors of the type of term. Each variable introduced by destruct in the context of the ith goal gets its name from the list pi1 …pini in order. If there are not enough names, destruct invents names for the remaining variables to introduce. More generally, the p’s can be any introduction patterns (see Section 8.7.3). This provides a concise notation for nested destruction.
Remark: for an inductive type with one constructor, the pattern notation
(p1,…,pn) can be used instead of
[ p1 …pn ].
This tactic behaves like destruct term as intro_pattern.
This is a synonym of induction term using qualid.
This is a synonym of induction term using qualid as intro_pattern.
The tactic case is a more basic tactic to perform case analysis without recursion. It behaves as elim term but using a case-analysis elimination principle and not a recursive one.
The tactic case_eq is a variant of the case tactic that allow to perform case analysis on a term without completely forgetting its original form. This is done by generating equalities between the original form of the term and the outcomes of the case analysis.
Analogous to elim … with above.
This tactic behaves as intros until ident; case ident when ident is a quantified variable of the goal.
This tactic behaves as intros until num; case ident where ident is the name given by intros until num to the num-th non-dependent premise of the goal.
The tactic intros applied to introduction patterns performs both introduction of variables and case analysis in order to give names to components of an hypothesis.
An introduction pattern is either:
The behavior of intros is defined inductively over the structure of the pattern given as argument:
Remark: The pattern (p1, …, pn)
is a synonym for the pattern [p1 … pn], i.e. it
corresponds to the decomposition of an hypothesis typed by an
inductive type with a single constructor.
This tactic applies to any goal. If the variables ident1 and
ident2 of the goal have an inductive type, then this tactic
performs double induction on these variables. For instance, if the
current goal is forall n m:nat, P n m
then, double induction n
m yields the four cases with their respective inductive hypotheses.
In particular the case for (P (S n) (S m))
with the induction
hypotheses (P (S n) m)
and (m:nat)(P n m)
(hence
(P n m)
and (P n (S m))
).
Remark: When the induction hypothesis (P (S n) m)
is not
needed, induction ident1; destruct ident2 produces
more concise subgoals.
Variant:
This applies double induction on the num1th and num2th non dependent premises of the goal. More generally, any combination of an ident and an num is valid.
This tactic allows to recursively decompose a complex proposition in order to obtain atomic ones. Example:
decompose does not work on right-hand sides of implications or products.
Variants:
The experimental tactic functional induction performs case analysis and induction following the definition of a function. It makes use of a principle generated by Function (see Section 2.3) or Functional Scheme (see Section 8.15).
Remark: (qualid term1 … termn) must be a correct
full application of qualid. In particular, the rules for implicit
arguments are the same as usual. For example use @qualid if
you want to write implicit arguments explicitly.
Remark: Parenthesis over qualid…termn are mandatory.
Remark: functional induction (f x1 x2 x3) is actually a wrapper
for induction x1 x2 x3 (f x1 x2 x3) using qualid followed by
a cleaning phase, where qualid is the induction principle
registered for f (by the Function (see Section 2.3)
or Functional Scheme (see Section 8.15) command)
corresponding to the sort of the goal. Therefore functional
induction may fail if the induction scheme (qualid) is
not defined. See also Section 2.3 for the function terms
accepted by Function.
Remark: There is a difference between obtaining an induction scheme for a
function by using Function (see Section 2.3) and by
using Functional Scheme after a normal definition using
Fixpoint or Definition. See 2.3 for
details.
See also: 2.3,8.15,10.4,
8.10.3
Error messages:
Variants:
Similar to Induction and elim (see Section 8.7), allows to give explicitly the induction principle and the values of dependent premises of the elimination scheme, including predicates for mutual induction when qualidis mutually recursive.
Similar to induction and elim (see Section 8.7).
These tactics use the equality eq:forall A:Type, A->A->Prop defined in file Logic.v (see Section 3.1.2). The notation for eq T t u is simply t=u dropping the implicit type of t and u.
This tactic applies to any goal. The type of term must have the form
(x1:A1) … (xn:An)eqterm1 term2.
where eq is the Leibniz equality or a registered setoid equality.
Then rewrite term replaces every occurrence of term1 by term2 in the goal. Some of the variables x1 are solved by unification, and some of the types A1, …, An become new subgoals.
Remark: In case the type of
term1 contains occurrences of variables bound in the
type of term, the tactic tries first to find a subterm of the goal
which matches this term in order to find a closed instance term′1
of term1, and then all instances of term′1 will be replaced.
Error messages:
Variants:
This tactic acts like replace term1 with term2 (see below).
This tactic applies to any goal. It replaces all free occurrences of term1 in the current goal with term2 and generates the equality term2=term1 as a subgoal. This equality is automatically solved if it occurs amongst the assumption, or if its symmetric form occurs. It is equivalent to cut term2=term1; [intro Hn; rewrite <- Hn; clear Hn| assumption || symmetry; try assumption].
Error messages:
Variants:
This tactic applies to a goal which has the form t=u. It checks that t and u are convertible and then solves the goal. It is equivalent to apply refl_equal.
Error messages:
This tactic applies to a goal which has the form t=u and changes it into u=t.
Variant: symmetry in ident
If the statement of the hypothesis ident has the form t=u,
the tactic changes it to u=t.
This tactic applies to a goal which has the form t=u and transforms it into the two subgoals t=term and term=u.
This tactic applies to a goal which has ident in its context and (at least) one hypothesis, say H, of type ident=t or t=ident. Then it replaces ident by t everywhere in the goal (in the hypotheses and in the conclusion) and clears ident and H from the context.
Remark: When several hypotheses have the form ident=t or t=ident, the first one is used.
Variants:
This tactic is for chaining rewriting steps. It assumes a goal of the form “R term1 term2” where R is a binary relation and relies on a database of lemmas of the form forall x y z, R x y -> eq x z -> R z y where eq is typically a setoid equality. The application of stepl term then replaces the goal by “R term term2” and adds a new goal stating “eq term term1”.
Lemmas are added to the database using the command
Declare Left Step term.
The tactic is especially useful for parametric setoids which are not accepted as regular setoids for rewrite and setoid_replace (see Chapter 21).
Declare Right Step term.
This tactic applies to a goal of the form f a1 … an = f′ a′1 … a′n. Using f_equal on such a goal leads to subgoals f=f′ and a1=a′1 and so on up to an=a′n. Amongst these subgoals, the simple ones (e.g. provable by reflexivity or congruence) are automatically solved by f_equal.
Remark: f_equal currently handles goals with only up to 5 arguments
(i.e. n≤ 5).
We describe in this section some special purpose tactics dealing with equality and inductive sets or types. These tactics use the equality eq:forall (A:Type), A->A->Prop, simply written with the infix symbol =.
This tactic solves a goal of the form
forall x y:R, {x=y}+{~
x=y}, where R
is an inductive type such that its constructors do not take proofs or
functions as arguments, nor objects in dependent types.
Variants:
~
term1=term2}.
This tactic compares two given objects term1 and term2
of an inductive datatype. If G is the current goal, it leaves the sub-goals
term1=term2 -> G and ~
term1=term2
-> G. The type
of term1 and term2 must satisfy the same restrictions as in the tactic
decide equality.
This tactic proves any goal from an absurd hypothesis stating that two structurally different terms of an inductive set are equal. For example, from the hypothesis (S (S O))=(S O) we can derive by absurdity any proposition. Let ident be a hypothesis of type term1 = term2 in the local context, term1 and term2 being elements of an inductive set. To build the proof, the tactic traverses the normal forms4 of term1 and term2 looking for a couple of subterms u and w (u subterm of the normal form of term1 and w subterm of the normal form of term2), placed at the same positions and whose head symbols are two different constructors. If such a couple of subterms exists, then the proof of the current goal is completed, otherwise the tactic fails.
Remark: If ident does not denote an hypothesis in the local context
but refers to an hypothesis quantified in the goal, then the
latter is first introduced in the local context using
intros until ident.
Error messages:
Variants:
~
term1=term2 and it is equivalent to:
unfold not; intro ident; discriminate
ident.
Error messages:
The injection tactic is based on the fact that constructors of inductive sets are injections. That means that if c is a constructor of an inductive set, and if (c t1) and (c t2) are two terms that are equal then t1 and t2 are equal too.
If ident is an hypothesis of type term1 = term2, then injection behaves as applying injection as deep as possible to derive the equality of all the subterms of term1 and term2 placed in the same positions. For example, from the hypothesis (S (S n))=(S (S (S m)) we may derive n=(S m). To use this tactic term1 and term2 should be elements of an inductive set and they should be neither explicitly equal, nor structurally different. We mean by this that, if n1 and n2 are their respective normal forms, then:
If these conditions are satisfied, then, the tactic derives the equality of all the subterms of term1 and term2 placed in the same positions and puts them as antecedents of the current goal.
Example: Consider the following goal:
Beware that injection yields always an equality in a sigma type whenever the injected object has a dependent type.
Remark: If ident does not denote an hypothesis in the local context
but refers to an hypothesis quantified in the goal, then the
latter is first introduced in the local context using
intros until ident.
Error messages:
Variants:
This does the same thing as intros until num then injection ident where ident is the identifier for the last introduced hypothesis.
If the current goal is of the form term1 <> term2, the tactic computes the head normal form of the goal and then behaves as the sequence: unfold not; intro ident; injection ident.
Error message: goal does not satisfy the expected preconditions
These variants apply intros intro_pattern … intro_pattern after the call to injection.
Let ident be the name of an hypothesis of type term1=term2 in the local context. If term1 and term2 are structurally different (in the sense described for the tactic discriminate), then the tactic simplify_eq behaves as discriminate ident otherwise it behaves as injection ident.
Remark: If ident does not denote an hypothesis in the local context
but refers to an hypothesis quantified in the goal, then the
latter is first introduced in the local context using
intros until ident.
Variants:
This does the same thing as intros until num then simplify_eq ident where ident is the identifier for the last introduced hypothesis.
~
t1=t2, then this tactic does
hnf; intro ident; simplify_eq ident.
This tactic applies to any goal. If ident has type
(existS A B a b)=(existS A B a' b')
in the local context (i.e. each term of the
equality has a sigma type { a:A & (B a)}) this tactic rewrites
a
into a'
and b
into b'
in the current
goal. This tactic works even if B is also a sigma type. This kind
of equalities between dependent pairs may be derived by the injection
and inversion tactics.
Variants:
Let the type of ident in the local context be (I t), where I is a (co)inductive predicate. Then, inversion applied to ident derives for each possible constructor ci of (I t), all the necessary conditions that should hold for the instance (I t) to be proved by ci.
Remark: If ident does not denote an hypothesis in the local context
but refers to an hypothesis quantified in the goal, then the
latter is first introduced in the local context using
intros until ident.
Variants:
This does the same thing as intros until num then inversion ident where ident is the identifier for the last introduced hypothesis.
This behaves as inversion and then erases ident from the context.
This behaves as inversion but using names in intro_pattern for naming hypotheses. The intro_pattern must have the form [ p11 …p1n1 | … | pm1 …pmnm ] with m being the number of constructors of the type of ident. Be careful that the list must be of length m even if inversion discards some cases (which is precisely one of its roles): for the discarded cases, just use an empty list (i.e. ni=0).
The arguments of the ith constructor and the equalities that inversion introduces in the context of the goal corresponding to the ith constructor, if it exists, get their names from the list pi1 …pini in order. If there are not enough names, induction invents names for the remaining variables to introduce. In case an equation splits into several equations (because inversion applies injection on the equalities it generates), the corresponding name pij in the list must be replaced by a sublist of the form [pij1 …pijq] (or, equivalently, (pij1, …, pijq)) where q is the number of subequations obtained from splitting the original equation. Here is an example.
This allows to name the hypotheses introduced by inversion num in the context.
This allows to name the hypotheses introduced by inversion_clear in the context.
Let ident1 … identn, be identifiers in the local context. This tactic behaves as generalizing ident1 … identn, and then performing inversion.
This allows to name the hypotheses introduced in the context by inversion ident in ident1 … identn.
Let ident1 … identn, be identifiers in the local context. This tactic behaves as generalizing ident1 … identn, and then performing inversion_clear.
This allows to name the hypotheses introduced in the context by inversion_clear ident in ident1 …identn.
That must be used when ident appears in the current goal. It acts like inversion and then substitutes ident for the corresponding term in the goal.
This allows to name the hypotheses introduced in the context by dependent inversion ident.
Like dependent inversion, except that ident is cleared from the local context.
This allows to name the hypotheses introduced in the context by dependent inversion_clear ident
This variant allow to give the good generalization of the goal. It is useful when the system fails to generalize the goal automatically. If ident has type (I t) and I has type forall (x:T), s, then term must be of type I:forall (x:T), I x→ s′ where s′ is the type of the goal.
This allows to name the hypotheses introduced in the context by dependent inversion ident with term.
Like dependent inversion … with but clears identfrom the local context.
This allows to name the hypotheses introduced in the context by dependent inversion_clear ident with term.
It is a very primitive inversion tactic that derives all the necessary equalities but it does not simplify the constraints as inversion do.
This allows to name the hypotheses introduced in the context by simple inversion.
Let ident have type (I t) (I an inductive predicate) in the local context, and ident′ be a (dependent) inversion lemma. Then, this tactic refines the current goal with the specified lemma.
This tactic behaves as generalizing ident1… identn, then doing inversionidentusing ident′.
See also: 10.5 for detailed examples
This command generates an inversion principle for the inversion … using tactic. Let I be an inductive predicate and x the variables occurring in t. This command generates and stocks the inversion lemma for the sort sort corresponding to the instance forall (x:T), I t with the name ident in the global environment. When applied it is equivalent to have inverted the instance with the tactic inversion.
Variants:
See also: 10.5 for examples
functional inversion is a highly experimental tactic which performs inversion on hypothesis ident of the form qualid term1…termn = term or term = qualid term1…termn where qualid must have been defined using Function (see Section 2.3).
Error messages:
Variants:
This does the same thing as intros until num then functional inversion ident where ident is the identifier for the last introduced hypothesis.
In case the hypothesis ident(or num) has a type of the form qualid1 term1…termn =qualid2 termn+1…termn+m where qualid1 and qualid2 are valid candidates to functional inversion, this variant allows to chose which must be inverted.
This kind of inversion has nothing to do with the tactic inversion above. This tactic does change (ident t), where t is a term build in order to ensure the convertibility. In other words, it does inversion of the function ident. This function must be a fixpoint on a simple recursive datatype: see 10.7 for the full details.
Error messages:
Variants:
In order to ease the proving process, when the Classical module is loaded. A few more tactics are available. Make sure to load the module using the Require Import command.
The tactics classical_left and classical_right are the analog of the left and right but using classical logic. They can only be used for disjunctions. Use classical_left to prove the left part of the disjunction with the assumption that the negation of right part holds. Use classical_left to prove the right part of the disjunction with the assumption that the negation of left part holds.
This tactic implements a Prolog-like resolution procedure to solve the current goal. It first tries to solve the goal using the assumption tactic, then it reduces the goal to an atomic one using intros and introducing the newly generated hypotheses as hints. Then it looks at the list of tactics associated to the head symbol of the goal and tries to apply one of them (starting from the tactics with lower cost). This process is recursively applied to the generated subgoals.
By default, auto only uses the hypotheses of the current goal and the hints of the database named core.
Variants:
Forces the search depth to be num. The maximal search depth is 5 by default.
Uses the hint databases ident1 … identn in addition to the database core. See Section 8.13.1 for the list of pre-defined databases and the way to create or extend a database. This option can be combined with the previous one.
Uses all existing hint databases, minus the special database v62. See Section 8.13.1
Uses lemma1, …, lemman in addition to hints (can be conbined with the with ident option).
This tactic is a restriction of auto that is not recursive and tries only hints which cost is 0. Typically it solves trivial equalities like X=X.
Remark: auto either solves completely the goal or else leave it
intact. auto and trivial never fail.
See also: Section 8.13.1
This tactic generalizes auto. In contrast with the latter, eauto uses unification of the goal against the hints rather than pattern-matching (in other words, it uses eapply instead of apply). As a consequence, eauto can solve such a goal:
Note that ex_intro should be declared as an hint.
See also: Section 8.13.1
This tactic implements a decision procedure for intuitionistic propositional calculus based on the contraction-free sequent calculi LJT* of Roy Dyckhoff [50]. Note that tauto succeeds on any instance of an intuitionistic tautological proposition. tauto unfolds negations and logical equivalence but does not unfold any other definition.
The following goal can be proved by tauto whereas auto would fail:
Moreover, if it has nothing else to do, tauto performs introductions. Therefore, the use of intros in the previous proof is unnecessary. tauto can for instance prove the following:
Remark: In contrast, tauto cannot solve the following goal
because (forall x:nat, ~ A -> P x)
cannot be treated as atomic and an
instantiation of x
is necessary.
The tactic intuition takes advantage of the search-tree built by the decision procedure involved in the tactic tauto. It uses this information to generate a set of subgoals equivalent to the original one (but simpler than it) and applies the tactic tactic to them [96]. If this tactic fails on some goals then intuition fails. In fact, tauto is simply intuition fail.
For instance, the tactic intuition auto applied to the goal
(forall (x:nat), P x)/\B -> (forall (y:nat),P y)/\ P O \/B/\ P O
internally replaces it by the equivalent one:
(forall (x:nat), P x), B |- P O
and then uses auto which completes the proof.
Originally due to César Muñoz, these tactics (tauto and intuition) have been completely reengineered by David Delahaye using mainly the tactic language (see Chapter 9). The code is now quite shorter and a significant increase in performances has been noticed. The general behavior with respect to dependent types, unfolding and introductions has slightly changed to get clearer semantics. This may lead to some incompatibilities.
Variants:
The rtauto tactic solves propositional tautologies similarly to what tauto does. The main difference is that the proof term is built using a reflection scheme applied to a sequent calculus proof of the goal. The search procedure is also implemented using a different technique.
Users should be aware that this difference may result in faster proof-search but slower proof-checking, and rtauto might not solve goals that tauto would be able to solve (e.g. goals involving universal quantifiers).
The tactic firstorder is an experimental extension of tauto to first-order reasoning, written by Pierre Corbineau. It is not restricted to usual logical connectives but instead may reason about any first-order class inductive definition.
Variants:
Tries to solve the goal with tactic when no logical rule may apply.
Adds lemmas ident1 … identn to the proof-search environment.
Adds lemmas in auto hints bases ident1 … identn to the proof-search environment.
Proof-search is bounded by a depth parameter which can be set by typing the Set Firstorder Depth n vernacular command.
The tactic congruence, by Pierre Corbineau, implements the standard Nelson and Oppen congruence closure algorithm, which is a decision procedure for ground equalities with uninterpreted symbols. It also include the constructor theory (see 8.9.4 and 8.9.3). If the goal is a non-quantified equality, congruence tries to prove it with non-quantified equalities in the context. Otherwise it tries to infer a discriminable equality from those in the context. Alternatively, congruence tries to prove that an hypothesis is equal to the goal or to the negation of another hypothesis.
congruence is also able to take advantage of hypotheses stating quantified equalities, you have to provide a bound for the number of extra equalities generated that way. Please note that one of the memebers of the equality must contain all the quantified variables in order for congruence to match against it.
Variants:
Variants:
Error messages:
The tactic omega, due to Pierre Crégut,
is an automatic decision procedure for Presburger
arithmetic. It solves quantifier-free
formulas built with ~
, \/
, /\
,
->
on top of equalities and inequalities on
both the type nat of natural numbers and Z of binary
integers. This tactic must be loaded by the command Require Import
Omega. See the additional documentation about omega
(see Chapter 17).
The ring tactic solves equations upon polynomial expressions of a ring (or semi-ring) structure. It proceeds by normalizing both hand sides of the equation (w.r.t. associativity, commutativity and distributivity, constant propagation) and comparing syntactically the results.
ring_simplify applies the normalization procedure described above to the terms given. The tactic then replaces all occurrences of the terms given in the conclusion of the goal by their normal forms. If no term is given, then the conclusion should be an equation and both hand sides are normalized.
See Chapter 20 for more information on the tactic and how to declare new ring structures.
The field tactic is built on the same ideas as ring: this is a reflexive tactic that solves or simplifies equations in a field structure. The main idea is to reduce a field expression (which is an extension of ring expressions with the inverse and division operations) to a fraction made of two polynomial expressions.
Tactic field is used to solve subgoals, whereas field_simplify term1…termn replaces the provided terms by their reducted fraction. field_simplify_eq applies when the conclusion is an equation: it simplifies both hand sides and multiplies so as to cancel denominators. So it produces an equation without division nor inverse.
All of these 3 tactics may generate a subgoal in order to prove that denominators are different from zero.
See Chapter 20 for more information on the tactic and how to declare new field structures.
Example:
See also: file contrib/setoid_ring/RealField.v for an example of instantiation,
theory theories/Reals for many examples of use of field.
This tactic written by Loïc Pottier solves linear inequations on real numbers using Fourier’s method [59]. This tactic must be loaded by Require Import Fourier.
Example:
This tactic 5 carries out rewritings according the rewriting rule bases ident1 …identn.
Each rewriting rule of a base identi is applied to the main subgoal until it fails. Once all the rules have been processed, if the main subgoal has progressed (e.g., if it is distinct from the initial main goal) then the rules of this base are processed again. If the main subgoal has not progressed then the next base is processed. For the bases, the behavior is exactly similar to the processing of the rewriting rules.
The rewriting rule bases are built with the Hint Rewrite vernacular command.
Warning: This tactic may loop if you build non terminating rewriting systems.
Variant:
Performs all the rewritings in hypothesis qualid.
Performs all the rewritings in hypothesis qualid applying tactic to the main subgoal after each rewriting step.
See also: Section 8.13.4 for feeding the database of lemmas used by autorewrite.
See also: Section 10.6 for examples showing the use of
this tactic.
The hints for auto and eauto are stored in databases. Each database maps head symbols to a list of hints. One can use the command Print Hint ident to display the hints associated to the head symbol ident (see 8.13.3). Each hint has a cost that is an nonnegative integer, and a pattern. The hints with lower cost are tried first. A hint is tried by auto when the conclusion of the current goal matches its pattern. The general command to add a hint to some database ident1, …, identn is:
Hint hint_definition : ident1 … identn |
where hint_definition is one of the following expressions:
This command adds apply term to the hint list with the head symbol of the type of term. The cost of that hint is the number of subgoals generated by apply term.
In case the inferred type of term does not start with a product the tactic added in the hint list is exact term. In case this type can be reduced to a type starting with a product, the tactic apply term is also stored in the hints list.
If the inferred type of term does contain a dependent quantification on a predicate, it is added to the hint list of eapply instead of the hint list of apply. In this case, a warning is printed since the hint is only used by the tactic eauto (see 8.12.2). A typical example of hint that is used only by eauto is a transitivity lemma.
Error messages:
The head symbol of the type of term is a bound variable such that this tactic cannot be associated to a constant.
The type of term contains products over variables which do not appear in the conclusion. A typical example is a transitivity axiom. In that case the apply tactic fails, and thus is useless.
Variants:
Adds each Resolve termi.
This command adds apply term; trivial to the hint list associated with the head symbol of the type of identin the given database. This tactic will fail if all the subgoals generated by apply term are not solved immediately by the trivial tactic which only tries tactics with cost 0.
This command is useful for theorems such that the symmetry of equality or n+1=m+1 → n=m that we may like to introduce with a limited use in order to avoid useless proof-search.
The cost of this tactic (which never generates subgoals) is always 1, so that it is not used by trivial itself.
Error messages:
Variants:
Adds each Immediate termi.
If ident is an inductive type, this command adds all its constructors as hints of type Resolve. Then, when the conclusion of current goal has the form (ident …), auto will try to apply each constructor.
Error messages:
Variants:
Adds each Constructors identi.
This adds the tactic unfold qualid to the hint list that will only be used when the head constant of the goal is ident. Its cost is 4.
Variants:
Adds each Unfold identi.
This hint type is to extend auto with tactics other than apply and unfold. For that, we must specify a cost, a pattern and a tactic to execute. Here is an example:
Hint Extern 4 ~(?=?) => discriminate.
Now, when the head of the goal is a disequality, auto will try discriminate if it does not succeed to solve the goal with hints with a cost less than 4.
One can even use some sub-patterns of the pattern in the tactic script. A sub-pattern is a question mark followed by an ident, like ?X1 or ?X2. Here is an example:
Remark: There is currently (in the 8.1pl4 release) no way to do
pattern-matching on hypotheses.
Variants:
No database name is given : the hint is registered in the core database.
This is used to declare hints that must not be exported to the other modules that require and import the current module. Inside a section, the option Local is useless since hints do not survive anyway to the closure of sections.
Idem for the core database.
Several hint databases are defined in the Coq standard library. The actual content of a database is the collection of the hints declared to belong to this database in each of the various modules currently loaded. Especially, requiring new modules potentially extend a database. At Coq startup, only the core and v62 databases are non empty and can be used.
There is also a special database called v62. It collects all hints that were declared in the versions of Coq prior to version 6.2.4 when the databases core, arith, and so on were introduced. The purpose of the database v62 is to ensure compatibility with further versions of Coq for developments done in versions prior to 6.2.4 (auto being replaced by auto with v62). The database v62 is intended not to be extended (!). It is not included in the hint databases list used in the auto with * tactic.
Furthermore, you are advised not to put your own hints in the core database, but use one or several databases specific to your development.
This command displays all hints that apply to the current goal. It fails if no proof is being edited, while the two variants can be used at every moment.
Variants:
This command displays only tactics associated with ident in the hints list. This is independent of the goal being edited, to this command will not fail if no goal is being edited.
This command displays all declared hints.
This command displays all hints from database ident.
This vernacular command adds the terms term1 …termn (their types must be equalities) in the rewriting base ident with the default orientation (left to right). Notice that the rewriting bases are distinct from the auto hint bases and that auto does not take them into account.
This command is synchronous with the section mechanism (see 2.4): when closing a section, all aliases created by Hint Rewrite in that section are lost. Conversely, when loading a module, all Hint Rewrite declarations at the global level of that module are loaded.
Variants:
This command displays all rewrite hints contained in ident.
Hints provided by the Hint commands are erased when closing a section. Conversely, all hints of a module A that are not defined inside a section (and not defined with option Local) become available when the module A is imported (using e.g. Require Import A.).
This command may be used to start a proof. It defines a default
tactic to be used each time a tactic command tactic1 is ended by
“...
”. In this case the tactic command typed by the user is
equivalent to tactic1;tactic.
See also: Proof. in Section 7.1.5.
This command declares a tactic to be used to solve implicit arguments that Coq does not know how to solve by unification. It is used every time the term argument of a tactic has one of its holes not fully resolved.
Here is an example:
The tactic exists (n // m) did not fail. The hole was solved by assumption so that it behaved as exists (quo n m H).
The Scheme command is a high-level tool for generating automatically (possibly mutual) induction principles for given types and sorts. Its syntax follows the schema:
Scheme ident1 := Induction for ident’1 Sort sort1
with
…
with identm := Induction for ident’m Sort sortm
where ident’1 … ident’m are different inductive type identifiers belonging to the same package of mutual inductive definitions. This command generates ident1… identm to be mutually recursive definitions. Each term identi proves a general principle of mutual induction for objects in type termi.
Variants:
Same as before but defines a non-dependent elimination principle more natural in case of inductively defined relations.
See also: 10.3
See also: Section 10.3
The Combined Scheme command is a tool for combining induction principles generated by the Scheme command. Its syntax follows the schema :
Combined Scheme ident0 from ident1, .., identn
ident1 …identn are different inductive principles that must belong to
the same package of mutual inductive principle definitions. This command
generates ident0 to be the conjunction of the principles: it is
built from the common premises of the principles and concluded by the
conjunction of their conclusions.
See also: 10.3.1
See also: Section 10.3.1
The Functional Scheme command is a high-level experimental tool for generating automatically induction principles corresponding to (possibly mutually recursive) functions. Its syntax follows the schema:
Functional Scheme ident1 := Induction for ident’1 Sort sort1
with
…
with identm := Induction for ident’m Sort sortm
where ident’1 … ident’m are different mutually defined function names (they must be in the same order as when they were defined). This command generates the induction principles ident1…identm, following the recursive structure and case analyses of the functions ident’1 … ident’m.
There is a difference between obtaining an induction scheme by using Functional Scheme on a function defined by Function or not. Indeed Function generally produces smaller principles, closer to the definition written by the user.
See also: Section 10.4
A simple example has more value than a long explanation:
The tactics macros are synchronous with the Coq section mechanism: a tactic definition is deleted from the current environment when you close the section (see also 2.4) where it was defined. If you want that a tactic macro defined in a module is usable in the modules that require it, you should put it outside of any section.
Chapter 9 gives examples of more complex user-defined tactics.