AFTD Auto-Formalizing Theoretical Domains

DecisionTree.card_symmDiff_singleton

theoremverifiedimported Lean

Cardinality under singleton symmetric difference. Let $S$ be a finite subset of $\{0,1,\dots,n-1\}$ and let $i$ be one of these indices. Then the symmetric difference $S \triangle \{i\}$ satisfies \[ \abs{S} - 1 \le \abs{S \triangle \{i\}}, \] where $\abs{S} - 1$ denotes truncated subtraction on the natural numbers (so it is $0$ when $S$ is empty).

Statement

variable {n : ℕ} in
lemma DecisionTree.card_symmDiff_singleton (S : Finset (Fin n)) (i : Fin n) :
    S.card - 1 ≤ (symmDiff S {i}).card
Source
TCSlib, `DecisionTree.card_symmDiff_singleton`
Lean proof
By Hydroxyi, Owen McGinty, Seyoon Ragavan (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

Lean source view module on GitHub

variable {n : ℕ} inlemma DecisionTree.card_symmDiff_singleton (S : Finset (Fin n)) (i : Fin n) :    S.card - 1 ≤ (symmDiff S {i}).card := by  by_cases h : i ∈ S  · have he : symmDiff S {i} = S.erase i := by      ext j      by_cases hj : j = i <;>        simp [Finset.mem_symmDiff, Finset.mem_erase, hj, h]    rw [he, Finset.card_erase_of_mem h]  · have he : symmDiff S {i} = insert i S := by      ext j      by_cases hj : j = i <;>        simp [Finset.mem_symmDiff, Finset.mem_insert, hj, h]    rw [he, Finset.card_insert_of_notMem h]    omega
See it in the graphDiscuss this resultChallenge it