mathlib documentation


meta def tactic.guard_mem_fin (e : expr) :

Checks that the expression looks like x ∈ A for A : finset α, multiset α or A : list α, and returns the type α.

expr_list_to_list_expr converts an expr of type list α to a list of exprs each with type α.

TODO: this should be moved, and possibly duplicates an existing definition.

meta def tactic.fin_cases_at (with_list : option pexpr) (e : expr) :

fin_cases_at with_list e performs case analysis on e : α, where α is a fintype. The optional list of expressions with_list provides descriptions for the cases of e, for example, to display nats as n.succ instead of n+1. These should be defeq to and in the same order as the terms in the enumeration of α.

fin_cases h performs case analysis on a hypothesis of the form h : A, where [fintype A] is available, or h ∈ 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 :=
  fin_cases *; simp,
  all_goals { assumption }

after fin_cases p; simp, there are three goals, f 0, f 1, and f 2.