Case bash on variables in finite intervals #
This file provides the tactic interval_cases
. interval_cases n
will:
- inspect hypotheses looking for lower and upper bounds of the form
a ≤ n
andn < b
(inℕ
,ℤ
,ℕ+
, bounds of the forma < n
andn ≤ b
are also allowed), and also makes use of lower and upper bounds found viale_top
andbot_le
(so for example ifn : ℕ
, then the bound0 ≤ n
is automatically found). - call
fin_cases
on the synthesised hypothesisn ∈ set.Ico a b
, assuming an appropriatefintype
instance can be found for the type ofn
.
The variable n
can belong to any type α
, with the following restrictions:
- only bounds on which
expr.to_rat
succeeds will be considered "explicit" (TODO: generalise this?) - an instance of
decidable_eq α
is available, - an explicit lower bound can be found among the hypotheses, or from
bot_le n
, - an explicit upper bound can be found among the hypotheses, or from
le_top n
, - if multiple bounds are located, an instance of
linear_order α
is available, and - an instance of
fintype set.Ico l u
is available for the relevant bounds.
You can also explicitly specify a lower and upper bound to use, as interval_cases using hl hu
,
where the hypotheses should be of the form hl : a ≤ n
and hu : n < b
. In that case,
interval_cases
calls fin_cases
on the resulting hypothesis h : n ∈ set.Ico a b
.
def
tactic.interval_cases.set_elems
{α : Type u_1}
[decidable_eq α]
(s : set α)
[fintype ↥s] :
finset α
The finset of elements of a set s
for which we have fintype s
.
Equations
theorem
tactic.interval_cases.mem_set_elems
{α : Type u_1}
[decidable_eq α]
(s : set α)
[fintype ↥s]
{a : α}
(h : a ∈ s) :
Each element of s
is a member of set_elems s
.