AFTD Auto-Formalizing Theoretical Domains

card_three_subsets_fin

theoremverified

The number of 3-element subsets of Fin n is n.choose 3.

Statement

theorem card_three_subsets_fin (n : ℕ) :
    Fintype.card { s : Finset (Fin n) // s.card = 3 } = n.choose 3
Source
step towards three_token_odd_cycle_indep_num_le
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1

The proof, explained

The theorem states that the number of 3-element subsets of a set with n elements is n.choose 3. In the proof, an automated search via `first | ...` resolves the goal with `simpa`, which uses standard library simplification rules for the cardinality of fixed-size sub-finsets and the cardinality of Fin n.

  1. The number of 3-element subsets of Fin n is n.choose 3. automation

    The tactic `first` evaluates candidate tactics in sequence. The first three attempts to apply `card_generalized_kneser_graph_verts` fail because that lemma specifically concerns n-element subsets of a 2n-element set rather than 3-element subsets of an n-element set. The fourth branch, `simpa using card_generalized_kneser_graph_verts`, succeeds because the simplifier reduces the cardinality of `{ s : Finset (Fin n) // s.card = 3 }` directly to `n.choose 3` using standard simplification lemmas for the size of fixed-cardinality subsets of `Fin n`.

    line 3

    uses card_generalized_kneser_graph_verts

        Fintype.card { s : Finset (Fin n) // s.card = 3 } = n.choose 3 := by first | exact card_generalized_kneser_graph_verts | (apply card_generalized_kneser_graph_verts <;> assumption) | (apply card_generalized_kneser_graph_verts <;> simp_all) | simpa using card_generalized_kneser_graph_verts
card_generalized_kneser_graph_verts
The number of n-element subsets of Fin (2 * n) is (2 * n).choose n.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- The number of 3-element subsets of Fin n is n.choose 3. -/theorem card_three_subsets_fin (n : ℕ) :    Fintype.card { s : Finset (Fin n) // s.card = 3 } = n.choose 3 := by first | exact card_generalized_kneser_graph_verts | (apply card_generalized_kneser_graph_verts <;> assumption) | (apply card_generalized_kneser_graph_verts <;> simp_all) | simpa using card_generalized_kneser_graph_verts
See it in the graphDiscuss this resultChallenge it