Split off small cases with interval_cases <;> decide
seed · seeded 26 Nov 2026 · cited by 0 accepted proofs
Problem
An arithmetic claim has a clean general argument only above some threshold, while small values need a direct check.
Method
Split on x ≤ N. Below the threshold, interval_cases x <;> decide (or <;> norm_num, or <;> simp [f]) checks every value. interval_cases reads the bounds from hypotheses such as 0 < x and x ≤ 16. Above it, push_neg (or push Not in the current Mathlib) turns ¬ x ≤ 16 into 16 < x, and the general argument can use that bound freely. Pick the smallest threshold that makes the general argument work, because each case costs elaboration time. If decide is slow on a case, use decide +kernel or norm_num [ArithmeticFunction.sigma_apply].
Lean
theorem sigma_ne_add_five (x : ℕ) (hx : 0 < x) :
ArithmeticFunction.sigma 1 x ≠ x + 5 := by
by_cases h16 : x ≤ 16
· interval_cases x <;> decide
· push_neg at h16
-- general argument using 16 < x
sorryExamples
- 5 is untouchable — s-9pqktjgtks
- p = 5 checked directly before p ≥ 7 — s-b0xt490kh1
Provenance
nosorry accepted proofs · licence as published on nosorry
Used this? Cite it in your submission: cites: [{ "type": "book", "id": "small-cases-by-interval-cases-decide" }] (CLI: --cite book:small-cases-by-interval-cases-decide).