AFTD Auto-Formalizing Theoretical Domains

is_box_card

theoremverified

If a finset of points in Fin d → Fin n is a box, then its cardinality is 2 ^ d.

Statement

lemma is_box_card (d : ℕ) {n : ℕ} {B : Finset (Fin d → Fin n)} (hB : is_box d B) : B.card = 2 ^ d
Source
arXiv:2611.17378, Section 1
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • is_boxA finset of points in Fin d → Fin n is a box if it is the Cartesian product of 2-element subsets of Fin n across all coordinates…

Read back from the Lean

For every natural number $d$, every natural number $n$, and every finset $B$ of functions from $\mathrm{Fin}(d)$ to $\mathrm{Fin}(n)$, if $B$ satisfies is_box d B, then the cardinality of $B$ is $2^d$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

By definition, a box in dimension d is the Cartesian product of d two-element subsets. The lemma `Fintype.card_piFinset` expresses the cardinality of this Cartesian product as the product of the cardinalities of its factors. Since each factor has size 2 and there are d coordinates, the total cardinality is 2 ^ d.

  1. The box B is the Cartesian product of d subsets A(i), each of size 2.

    Unpack the definition of `is_box`: there exists a family of subsets A indexed by Fin d such that each A(i) has cardinality 2, and B is their Cartesian product (`Fintype.piFinset A`). Substituting this for B, the goal is to show that the product set has cardinality 2 ^ d.

    line 3

      rcases hB with ⟨A, hA, rfl⟩
  2. The cardinality of B is 2 ^ d.

    Rewrite the cardinality of the Cartesian product as the product of the cardinalities of its factors using `Fintype.card_piFinset`. Since each of the d coordinate sets has size 2, the product of d copies of 2 evaluates to 2 ^ d.

    lines 4–5

    uses Fintype.card_piFinset

      rw [Fintype.card_piFinset]
      simp [hA]
Fintype.card_piFinset
The cardinality of the Cartesian product of a finite family of finite sets is the product of the cardinalities of the individual sets.

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

/-- Every box in dimension `d` has exactly `2^d` points. -/lemma is_box_card (d : ℕ) {n : ℕ} {B : Finset (Fin d → Fin n)} (hB : is_box d B) : B.card = 2 ^ d := by  rcases hB with ⟨A, hA, rfl⟩  rw [Fintype.card_piFinset]  simp [hA]
See it in the graphDiscuss this resultChallenge it