7.7 Eliminations (Induction and Case Analysis)

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

This tactic applies to any goal. 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.


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



Variants:
  1. 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.

  2. 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
  3. 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.
  4. 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.7).
  5. 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.

  6. Induction ident
    Is equivalent to Intros until ident; Pattern ident; Elim ident
  7. Induction num
    Is analogous to Induction ident but for the num-th non-dependent premise of the goal.

7.7.2 Case term

The tactic Case is used to perform case analysis without recursion. The type of term must be inductively defined.


Variants:
  1. Case term with term1 ...termn
    Analogous to Elim ...with above.
  2. Destruct ident
    Is equivalent to the tactical Intros Until ident; Case ident.
  3. Destruct num
    Is equivalent to Destruct ident but for the num-th non dependent premises 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|(b,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
  b : B
  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.


Remark: This tactic is not automatically loaded; it is available by doing Require Double.

7.7.5 Decompose [ ident ...idents ] 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.



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




Retrieved by Memoweb from http://pauillac.inria.fr/coq/doc/node.1.2.6.html at 8/10/98