Case bash #
This file provides the tactic fin_cases. fin_cases x performs case analysis on x, that is
creates one goal for each possible value of x, where either:
fin_cases h performs case analysis on a hypothesis of the form
h : A, where [fintype A] is available, or
h : a ∈ A, where A : finset X, A : multiset X or A : list X.
fin_cases * performs case analysis on all suitable hypotheses.
As an example, in
example (f : ℕ → Prop) (p : fin 3) (h0 : f 0) (h1 : f 1) (h2 : f 2) : f p.val :=
begin
fin_cases *; simp,
all_goals { assumption }
end
after fin_cases p; simp, there are three goals, f 0, f 1, and f 2.
fin_cases h with l takes a list of descriptions for the cases of h.
These should be definitionally equal to and in the same order as the
default enumeration of the cases.
For example,
example (x y : ℕ) (h : x ∈ [1, 2]) : x = y :=
begin
fin_cases h with [1, 1+1],
end
produces two cases: 1 = y and 1 + 1 = y.
When using fin_cases a on data a defined with let,
the tactic will not be able to clear the variable a,
and will instead produce hypotheses this : a = ....
These hypotheses can be given a name using fin_cases a using ha.
For example,
produces three goals with hypotheses
ha : a = 0, ha : a = 1, and ha : a = 2.