finset_sdiff_card_le_erase_sdiff_card_add_one
Erasing one element from a finite set lowers the size of its difference with any set by at most one.
Statement
theorem finset_sdiff_card_le_erase_sdiff_card_add_one {V : Type*} [DecidableEq V] (s Q : Finset V) (y : V) : (s \ Q).card ≤ ((s.erase y) \ Q).card + 1
- Source
- OP-1957: graph-to-count transfer for the size-five block forced-edge route (IN-1126).
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 2
- boundary_five_blocks_two_extra_shores_impossibleIn the displayed degree-bounded four-block graph, a 2k-vertex residual cannot split into two endpoint shores with no cross edge except…
- boundary_five_blocks_single_odd_extra_shore_impossibleIn the displayed degree-bounded four-block graph, a 2k-vertex residual cannot split into two endpoint shores with no cross edge except…
The proof, explained
We first establish that s \ Q is a subset of insert y ((s.erase y) \ Q). For any element w ∈ s \ Q, it is either equal to y (hence in the inserted set) or distinct from y (hence in the difference (s.erase y) \ Q). The desired inequality then follows from the monotonicity of cardinality under subset inclusion and the fact that inserting an element increases cardinality by at most one.
To show s \ Q ⊆ insert y ((s.erase y) \ Q), take an arbitrary element w ∈ s \ Q; then w ∈ s and w ∉ Q.
We begin proving the inclusion s \ Q ⊆ insert y ((s.erase y) \ Q) by introducing an element w ∈ s \ Q and rewriting its membership hypothesis with Finset.mem_sdiff into the conjunction w ∈ s and w ∉ Q.
uses
Finset.mem_sdiffhave hsub : s \ Q ⊆ insert y ((s.erase y) \ Q) := by intro w hw rw [Finset.mem_sdiff] at hw
If w = y, then w ∈ insert y ((s.erase y) \ Q).
We split into cases depending on whether w = y. If w = y, then w is the newly inserted element y, so membership in insert y ((s.erase y) \ Q) holds immediately.
by_cases h : w = y · simp [h]
If w ≠ y, then w ∈ (s.erase y) \ Q, and hence w ∈ insert y ((s.erase y) \ Q), completing the inclusion s \ Q ⊆ insert y ((s.erase y) \ Q).
If w ≠ y, then since w ∈ s, we have w ∈ s.erase y by Finset.mem_erase. Since also w ∉ Q, it follows by Finset.mem_sdiff that w ∈ (s.erase y) \ Q. Simplification using these facts completes the second branch and establishes the inclusion.
uses
Finset.mem_sdiff,Finset.mem_erase· simp [Finset.mem_sdiff, Finset.mem_erase, h, hw.1, hw.2]|s \ Q| ≤ |(s.erase y) \ Q| + 1.
Applying monotonicity of cardinality under inclusion (Finset.card_le_card) to the established subset relation yields |s \ Q| ≤ |insert y ((s.erase y) \ Q)|. Since inserting an element increases cardinality by at most one (Finset.card_insert_le), transitivity of inequality gives the result.
uses
Finset.card_le_card,Finset.card_insert_leexact (Finset.card_le_card hsub).trans (Finset.card_insert_le _ _)
Finset.mem_sdiff- An element belongs to the difference of two finite sets s \ t if and only if it belongs to s and not to t.
Finset.mem_erase- An element a belongs to s.erase b if and only if a ≠ b and a ∈ s.
Finset.card_le_card- If s ⊆ t for finite sets s and t, then |s| ≤ |t|.
Finset.card_insert_le- Inserting an element into a finite set increases its cardinality by at most one: |insert a s| ≤ |s| + 1.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem finset_sdiff_card_le_erase_sdiff_card_add_one {V : Type*} [DecidableEq V] (s Q : Finset V) (y : V) : (s \ Q).card ≤ ((s.erase y) \ Q).card + 1 := by have hsub : s \ Q ⊆ insert y ((s.erase y) \ Q) := by intro w hw rw [Finset.mem_sdiff] at hw by_cases h : w = y · simp [h] · simp [Finset.mem_sdiff, Finset.mem_erase, h, hw.1, hw.2] exact (Finset.card_le_card hsub).trans (Finset.card_insert_le _ _)