Skip to content

Commit

Permalink
feat(Data/Set/Finite): Induction principle for Set (#9123)
Browse files Browse the repository at this point in the history
This PR adds another induction principle for `Set` where you prove that a property `C` holds of `Set.univ` by proving the inductive step `C S → ∃ a ∉ S, C (insert a S)` (the key being exists the use of exists rather than forall).



Co-authored-by: Thomas Browning <tb65536@users.noreply.github.com>
  • Loading branch information
tb65536 and tb65536 committed Jan 19, 2024
1 parent 38082d8 commit a3794dc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Mathlib/Data/Set/Finite.lean
Expand Up @@ -1228,6 +1228,23 @@ theorem Finite.dinduction_on {C : ∀ s : Set α, s.Finite → Prop} (s : Set α
this h
#align set.finite.dinduction_on Set.Finite.dinduction_on

/-- Induction up to a finite set `S`. -/
theorem Finite.induction_to {C : Set α → Prop} {S : Set α} (h : S.Finite)
(S0 : Set α) (hS0 : S0 ⊆ S) (H0 : C S0) (H1 : ∀ s ⊂ S, C s → ∃ a ∈ S \ s, C (insert a s)) :
C S := by
have : Finite S := Finite.to_subtype h
have : Finite {T : Set α // T ⊆ S} := Finite.of_equiv (Set S) (Equiv.Set.powerset S).symm
rw [← Subtype.coe_mk (p := (· ⊆ S)) _ le_rfl]
rw [← Subtype.coe_mk (p := (· ⊆ S)) _ hS0] at H0
refine Finite.to_wellFoundedGT.wf.induction_bot' (fun s hs hs' ↦ ?_) H0
obtain ⟨a, ⟨ha1, ha2⟩, ha'⟩ := H1 s (ssubset_of_ne_of_subset hs s.2) hs'
exact ⟨⟨insert a s.1, insert_subset ha1 s.2⟩, Set.ssubset_insert ha2, ha'⟩

/-- Induction up to `univ`. -/
theorem Finite.induction_to_univ [Finite α] {C : Set α → Prop} (S0 : Set α)
(H0 : C S0) (H1 : ∀ S ≠ univ, C S → ∃ a ∉ S, C (insert a S)) : C univ :=
finite_univ.induction_to S0 (subset_univ S0) H0 (by simpa [ssubset_univ_iff])

section

attribute [local instance] Nat.fintypeIio
Expand Down

0 comments on commit a3794dc

Please sign in to comment.