English
There is a general induction principle on families of finite sets indexed by a finite type, using a choice predicate that decides which index to expand next.
Русский
Существует общая индукция по семействам конечных множеств, индексируемых по конечному типу, с использованием предиката выбора.
LaTeX
$$$\\text{induction\_on\_pi\_of\_choice} : \\dots$$$
Lean4
/-- General theorem for `Finset.induction_on_pi`-style induction principles. -/
theorem induction_on_pi_of_choice (r : ∀ i, α i → Finset (α i) → Prop)
(H_ex : ∀ (i) (s : Finset (α i)), s.Nonempty → ∃ x ∈ s, r i x (s.erase x)) {p : (∀ i, Finset (α i)) → Prop}
(f : ∀ i, Finset (α i)) (h0 : p fun _ ↦ ∅)
(step : ∀ (g : ∀ i, Finset (α i)) (i : ι) (x : α i), r i x (g i) → p g → p (update g i (insert x (g i)))) : p f :=
by
cases nonempty_fintype ι
induction hs : univ.sigma f using Finset.strongInductionOn generalizing f with
| _ s ihs
subst s
rcases eq_empty_or_nonempty (univ.sigma f) with he | hne
· convert h0 using 1
simpa [funext_iff] using he
· rcases sigma_nonempty.1 hne with ⟨i, -, hi⟩
rcases H_ex i (f i) hi with ⟨x, x_mem, hr⟩
set g := update f i ((f i).erase x) with hg
clear_value g
have hx' : x ∉ g i := by
rw [hg, update_self]
apply notMem_erase
rw [show f = update g i (insert x (g i)) by
rw [hg, update_idem, update_self, insert_erase x_mem, update_eq_self]] at hr ihs ⊢
clear hg
rw [update_self, erase_insert hx'] at hr
refine step _ _ _ hr (ihs (univ.sigma g) ?_ _ rfl)
rw [ssubset_iff_of_subset (sigma_mono (Subset.refl _) _)]
exacts [⟨⟨i, x⟩, mem_sigma.2 ⟨mem_univ _, by simp⟩, by simp [hx']⟩,
(@le_update_iff _ _ _ _ g g i _).2 ⟨subset_insert _ _, fun _ _ ↦ le_rfl⟩]