Tactics guide

intros

Moves things from the goal to the context. It works on quantified variables:

  • FORM: intros x y z
  • WHEN: goal looks like forall a b c, H
  • EFFECT: add x, y, and z to the context (bound to a, b, and c, respectively); goal becomes H
  • INFORMAL: "Let x, y, and z be given."

It also works on premises of implications:

  • FORM: intros H
  • WHEN: goal looks like H1 -> H2
  • EFFECT: add H1 to the context, goal becomes H2
  • INFORMAL: "Suppose H1; we must show H2."

The two forms can be combined, which leads to a canned phrase in informal proofs.

  • FORM: intros n H
  • WHEN goal looks like forall n, H -> H'
  • EFFECT: n and H added to the context; goal becomes H'
  • INFORMAL: "Let n be given such that H; we must show H'."

simpl

  • WHEN: whenever
  • EFFECT: does some reduction in the goal
  • INFORMAL: No real correlate, but it can be nice to show the steps of computation.

You can also simplify in a hypothesis.

  • FORM: simpl in H
  • WHEN: H is in the context
  • EFFECT: does some reduction in H
  • INFORMAL: As above.

reflexivity

  • WHEN: goal looks like 'e = e'
  • EFFECT: finishes the current case
  • INFORMAL: No real correlate, but it can be nice to show the steps of computation. Conclude proofs with appropriate language, like, "and we are done" or "and we have ... immediately".

rewrite

Rewriting using equalities.

  • FORM: rewrite -> H
  • WHEN: H : e1 = e2 is in the context and e1 appears in the goal
  • EFFECT: e1 is replaced with e2 in the goal
  • INFORMAL: "By H, we can replace e1 with e2 to find ...". Or do an algebraic proof, showing a series of equalities.

It's best to always give a direction when rewriting. The direction is in terms of the equation in your context: -> means find an occurrence of the thing on the left of the equality and replace it with the thing on the right; <- means the reverse.

  • FORM: rewrite <- H
  • WHEN: H : e1 = e2 is in the context and e2 appears in the goal
  • EFFECT: e2 is replaced with e1 in the goal
  • INFORMAL: As above.

destruct

Performs case analysis. Its precise use depends on the inductive type being analyzed. Be certain to use -/+/* to nest your case analyses. Always write an as pattern. If you need to remember the result of the case analysis, you can ask for an equation to be saved.

  • FORM: destruct n as [| n'] eqn:E
  • WHEN: n : nat is in the context
  • EFFECT: proofs splits into two cases, where n=0 and n=S n' for some n'; E : n=0 in the first case and E : n = S n' (for some n') in the second)
  • INFORMAL: "By cases on n. - If n=0 then... - If n=S n', then..." If you're at the beginning of a proof, don't forget to "let n be given". It's often good to say what your goal is in each case.

You can combine intros and destruct in one go by replacing the variable name with the pattern.

  • FORM: intros []
  • WHEN: the goal is of the form forall (b : bool), H
  • EFFECT: the same as intros b. destruct b as [], i.e. the goal is split into two cases: H with true substituted for b and H with false substituted for b.
  • INFORMAL: "Let b be given---it could be either true or false; we consider both cases." Or, more tersely, "We go by cases on b."

induction

Performs induction. Its precise use depends on the inductive type. Be certain to use -/+/* to nest your case analyses.

  • FORM: induction l as [|h t IHl']
  • WHEN: l : list X is in the context and the goal is H
  • EFFECT: proof splits into two cases:
    • The "base case", where l = nil. You must prove H where nil is substituted for l.
    • The "inductive case", where l = cons h t. You must prove H where cons h t is substituted for l. You are given an "inductive hypothesis" IHl', which is H where l' is substituted for l.
  • INFORMAL: "By induction on n. - If n=0 then... - If n=S n', then our IH is ... and we must show ... ." It's very important that you state the IH and the new goal in each case.

assert

Sets a new, subsidiary goal. Typically used to control rewriting or perform forward reasoning. Be certain to use { and } to mark your subsidiary proofs.

  • FORM: assert (H: e) or assert (e) as H
  • WHEN: at any time; all variables in e must be in your context
  • EFFECT: introduce a "local lemma" e and call it H
  • INFORMAL: "In order to ..., we first show that ... ."