7.7 Eliminations (Induction and Case Analysis)

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

7.7.1 NewInduction term

This tactic applies to any goal. The type of the argument term must be an inductive constant. Then, the tactic NewInduction generates subgoals, one for each possible form of term, i.e. one for each constructor of the inductive type.

The tactic NewInduction 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 tactic Elim, see below).

NewInduction works also when term is an identifier denoting a quantified variable of the conclusion of the goal. Then it behaves as Intros until ident; NewInduction ident.

Coq < Lemma induction_test : (n:nat) n=n -> (le n n).
1 subgoal
  
  ============================
   (n:nat)n=n->(le n n)

Coq < Intros n H.
1 subgoal
  
  n : nat
  H : n=n
  ============================
   (le n n)

Coq < NewInduction n.
2 subgoals
  
  H : O=O
  ============================
   (le O O)
subgoal 2 is:
 (le (S n) (S n))


Error messages:
  1. Not an inductive product
  2. Cannot refine to conclusions with meta-variables
    As NewInduction uses Apply, see section 7.3.6 and the variant Elim ... with ... below.

Variants:
  1. NewInduction num is analogous to NewInduction ident (when ident a quantified variable of the goal) but for the num-th non-dependent premise of the goal.

  2. Elim term
    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.

  3. Elim term 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.

  4. Elim term with term1 ... termn
    Allows the user to give explicitly the values for dependent premises of the elimination schema. All arguments must be given.

    Error message: Not the right number of dependent arguments
  5. Elim term with ref1 := term1 ... refn := termn
    Provides also Elim with values for instantiating premises by associating explicitly variables (or non dependent products) with their intended instance.
  6. Elim term1 using term2
    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 7.3.11).
  7. ElimType form
    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.

  8. Induction ident
    This is a deprecated tactic, which behaves as Intros until ident; Elim ident when ident is a quantified variable of the goal, and similarly as NewInduction ident, when ident is an hypothesis (except in the way induction hypotheses are named).

  9. Induction num
    This is a deprecated tactic, which 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.

7.7.2 NewDestruct term

The tactic NewDestruct is used to perform case analysis without recursion. Its behaviour is similar to NewInduction term except that no induction hypotheses is generated. It applies to any goal and the type of term must be inductively defined. NewDestruct works also when term is an identifier denoting a quantified variable of the conclusion of the goal. Then it behaves as Intros until ident; NewDestruct ident.


Variants:
  1. NewDestruct num
    Is analogous to NewDestruct ident (when ident a quantified variable of the goal), but for the num-th non-dependent premise of the goal.

  2. Case term
    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.

  3. Case term with term1 ... termn
    Analogous to Elim ... with above.
  4. Destruct ident
    This is a deprecated tactic, which behaves as Intros until ident; Case ident when ident is a quantified variable of the goal.
  5. Destruct num
    This is a deprecated tactic, which 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.

7.7.3 Intros pattern

The tactic Intros applied to a pattern performs both introduction of variables and case analysis in order to give names to components of an hypothesis.

A pattern is either: The behavior of Intros is defined inductively over the structure of the pattern given as argument:
Coq < Lemma intros_test : (A,B,C:Prop)(A\/(B/\C))->(A->C)->C.
1 subgoal
  
  ============================
   (A,B,C:Prop)A\/B/\C->(A->C)->C

Coq < Intros A B C [a|(_,c)] f.
2 subgoals
  
  A : Prop
  B : Prop
  C : Prop
  a : A
  f : A->C
  ============================
   C
subgoal 2 is:
 C

Coq < Apply (f a).
1 subgoal
  
  A : Prop
  B : Prop
  C : Prop
  c : C
  f : A->C
  ============================
   C

Coq < Proof c.
intros_test is defined

7.7.4 Double Induction num1 num2

This tactic applies to any goal. If the num1th and num2th premises of the goal have an inductive type, then this tactic performs double induction on these premises. For instance, if the current goal is (n,m:nat)(P n m) then, Double Induction 1 2 yields the four cases with their respective inductive hypothesis. In particular the case for (P (S n) (S m)) with the inductive hypothesis about both n and m.

7.7.5 Decompose [ ident1 ... identn ] term

This tactic allows to recursively decompose a complex proposition in order to obtain atomic ones. Example:

Coq < Lemma ex1: (A,B,C:Prop)(A/\B/\C \/ B/\C \/ C/\A) -> C.
1 subgoal
  
  ============================
   (A,B,C:Prop)A/\B/\C\/B/\C\/C/\A->C

Coq < Intros A B C H; Decompose [and or] H; Assumption.
Subtree proved!
Coq < Qed.

Decompose does not work on right-hand sides of implications or products.


Variants:
  1. Decompose Sum term This decomposes sum types (like or).
  2. Decompose Record term This decomposes record types (inductive types with one constructor, like and and exists and those defined with the Record macro, see p. ??).