op874_four_two_slot_hall
In a four-by-two incidence system with at most two required edges at each left vertex, every edge set has enough allowed first and second slots for an injective assignment.
Statement
theorem op874_four_two_slot_hall {L E : Type*} [Fintype L] [Fintype E] [DecidableEq L] [DecidableEq E] (inc : L → E → Prop) [DecidableRel inc] (S : Finset E) (hleft : ∀ l, (univ.filter fun e => inc l e).card = 4) (hright : ∀ e, (univ.filter fun l => inc l e).card = 2) (hS : ∀ l, (S.filter fun e => inc l e).card ≤ 2) (X : Finset E) : X.card ≤ (X.biUnion fun e => univ.filter fun p : L × Bool => inc p.1 e ∧ (e ∈ S → p.2 = false)).card
- Source
- Incidence and matching reduction for OP-874, https://arxiv.org/abs/2610.41950, Section 2.
- Verified
- 27 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- op874_four_two_incidence_countIn a four-by-two incidence system, the total number of incidences of any finite set of right vertices is twice its cardinality.
- Used by 1
- op874_four_two_incidence_two_pseudoforest_coverIn a finite four-by-two incidence system, if every left vertex meets at most two required edges, the edges split into two injective…
The proof, explained
To show that every edge set X has enough allowed slots, we partition the incident left vertices into A \ B (incident only to constrained edges in S) and B (incident to at least one unconstrained edge outside S). Since vertices in A \ B have degree at most 2 in X and vertices in B have degree at most 4, double counting edge-vertex incidences gives 2|X| ≤ 2|A \ B| + 4|B| ≤ 2|A| + 2|B|, so |X| ≤ |A| + |B|. Associating A with first slots (false) and B with second slots (true) produces |A| + |B| distinct valid slots, establishing the Hall-type condition.
Define active left vertices A, vertices B incident to unconstrained edges, vertex degrees d(l) in X, and observe that B ⊆ A.
For an edge set X, let A be the set of left vertices incident to some edge in X, let B be the set of left vertices incident to some edge in X \ S, and let d(l) be the number of edges in X incident to l. Since any edge in X \ S is in X, any vertex in B is also in A, so B ⊆ A.
classical let A : Finset L := univ.filter fun l => ∃ e ∈ X, inc l e let B : Finset L := univ.filter fun l => ∃ e ∈ X, e ∉ S ∧ inc l e let d : L → ℕ := fun l => (X.filter fun e => inc l e).card have hBA : B ⊆ A := by intro l hl simp only [B, A, mem_filter, mem_univ, true_and] at hl ⊢ obtain ⟨e, he, -, hi⟩ := hl exact ⟨e, he, hi⟩
Left vertices outside A have degree 0 in X.
If l ∉ A, then by definition of A no edge of X is incident to l. Therefore, the set of incident edges in X is empty, and its cardinality d(l) is 0.
uses
Finset.card_eq_zero.mpr,Finset.eq_empty_iff_forall_notMem.mprhave hdn : ∀ l, l ∉ A → d l = 0 := by intro l hl apply Finset.card_eq_zero.mpr apply Finset.eq_empty_iff_forall_notMem.mpr intro e he have hx := mem_filter.mp he apply hl simp only [A, mem_filter, mem_univ, true_and] exact ⟨e, hx.1, hx.2⟩
Every left vertex has degree at most 4 in X.
For any vertex l, the set of edges in X incident to l is a subset of all edges incident to l. By hypothesis hleft, the total degree of l in the graph is 4, so d(l) ≤ 4.
uses
Finset.card_le_cardhave hd4 : ∀ l, d l ≤ 4 := by intro l calc d l ≤ (univ.filter fun e => inc l e).card := by apply Finset.card_le_card intro e he simp only [mem_filter, mem_univ, true_and] at he ⊢ exact he.2 _ = 4 := hleft l
Vertices in A \ B have degree at most 2 in X.
Let l ∈ A \ B, so l ∉ B. If an edge e ∈ X is incident to l, it cannot belong to X \ S (otherwise l would be in B), so e must belong to S. Thus all edges in X incident to l lie in S. Since hypothesis hS states that l is incident to at most 2 edges of S, we have d(l) ≤ 2.
uses
Finset.card_le_cardhave hd2 : ∀ l ∈ A \ B, d l ≤ 2 := by intro l hl have hnot : l ∉ B := (mem_sdiff.mp hl).2 calc d l ≤ (S.filter fun e => inc l e).card := by apply Finset.card_le_card intro e he simp only [d, mem_filter] at he simp only [mem_filter] refine ⟨?_, he.2⟩ by_contra hn apply hnot simp only [B, mem_filter, mem_univ, true_and] exact ⟨e, he.1, hn, he.2⟩ _ ≤ 2 := hS l
The total sum of degrees over L equals the sum over A \ B plus the sum over B.
Since d(l) = 0 for l ∉ A, the sum over all vertices of L equals the sum over A. Since B ⊆ A, partitioning A into A \ B and B splits the sum into the sum of d(l) over A \ B plus the sum over B.
uses
Finset.sum_subset,Finset.subset_univ,Finset.sum_sdiffhave hsum0 : (∑ l : L, d l) = ∑ l ∈ A, d l := by symm apply Finset.sum_subset (Finset.subset_univ A) intro l _ hl exact hdn l hl have hsum : (∑ l : L, d l) = (∑ l ∈ A \ B, d l) + ∑ l ∈ B, d l := by rw [hsum0, Finset.sum_sdiff hBA]
The edge set X satisfies |X| ≤ |A| + |B|.
Summing the pointwise bounds yields ∑_{l ∈ A \ B} d(l) ≤ 2 |A \ B| and ∑_{l ∈ B} d(l) ≤ 4 |B|. By double counting incidences (op874_four_two_incidence_count), the sum of all degrees is 2 |X|. Together with |A \ B| + |B| = |A|, we obtain 2 |X| ≤ 2 |A \ B| + 4 |B| = 2 |A| + 2 |B|, which implies |X| ≤ |A| + |B| by linear arithmetic.
uses
Finset.sum_le_sum,mul_comm,op874_four_two_incidence_count,Finset.card_sdiff_add_card_eq_cardhave hbound1 : (∑ l ∈ A \ B, d l) ≤ 2 * (A \ B).card := by calc _ ≤ ∑ _l ∈ A \ B, 2 := Finset.sum_le_sum (by intro l hl; exact hd2 l hl) _ = _ := by simp [mul_comm] have hbound2 : (∑ l ∈ B, d l) ≤ 4 * B.card := by calc _ ≤ ∑ _l ∈ B, 4 := Finset.sum_le_sum (by intro l _; exact hd4 l) _ = _ := by simp [mul_comm] have hdouble := op874_four_two_incidence_count inc hright X change (∑ l : L, d l) = 2 * X.card at hdouble have hcardAB : (A \ B).card + B.card = A.card := Finset.card_sdiff_add_card_eq_card hBA have hineq : X.card ≤ A.card + B.card := by omega
Construct the slot set and show its cardinality is |A| + |B|.
Define the set of slots as (A × {false}) ∪ (B × {true}). The two pieces are disjoint because their second components differ. Since the injection maps l ↦ (l, false) and l ↦ (l, true) preserve cardinality, the size of the union is |A| + |B|.
uses
Finset.disjoint_left.mpr,Finset.card_union_of_disjoint,Finset.card_image_of_injectivelet slots : Finset (L × Bool) := A.image (fun l => (l,false)) ∪ B.image (fun l => (l,true)) have hdisj : Disjoint (A.image (fun l => (l,false))) (B.image (fun l => (l,true))) := by apply Finset.disjoint_left.mpr intro p hp hq rcases Finset.mem_image.mp hp with ⟨a, -, rfl⟩ rcases Finset.mem_image.mp hq with ⟨b, -, he⟩ have := congrArg Prod.snd he cases this have hslots : slots.card = A.card + B.card := by dsimp [slots] rw [Finset.card_union_of_disjoint hdisj] rw [Finset.card_image_of_injective _ (by intro a b h; exact congrArg Prod.fst h), Finset.card_image_of_injective _ (by intro a b h; exact congrArg Prod.fst h)]
Every slot in the constructed set is allowed for at least one edge in X.
For any slot p, if p = (l, false) with l ∈ A, there is some incident edge e ∈ X; the requirement that e ∈ S implies p.2 = false holds because p.2 is false. If p = (l, true) with l ∈ B, there is some incident edge e ∈ X \ S; since e ∉ S, the implication holds vacuously. Hence, the slot set is a subset of the union of allowed slots over e ∈ X.
have hsub : slots ⊆ X.biUnion (fun e => univ.filter fun p : L × Bool => inc p.1 e ∧ (e ∈ S → p.2 = false)) := by intro p hp rcases Finset.mem_union.mp hp with hp | hp · rcases Finset.mem_image.mp hp with ⟨l, hl, rfl⟩ simp only [A, mem_filter, mem_univ, true_and] at hl obtain ⟨e, he, hi⟩ := hl simp only [mem_biUnion, mem_filter, mem_univ, true_and] exact ⟨e, he, hi, by simp⟩ · rcases Finset.mem_image.mp hp with ⟨l, hl, rfl⟩ simp only [B, mem_filter, mem_univ, true_and] at hl obtain ⟨e, he, hn, hi⟩ := hl simp only [mem_biUnion, mem_filter, mem_univ, true_and] exact ⟨e, he, hi, by intro hs; exact (hn hs).elim⟩
|X| is at most the total number of allowed slots.
By combining the inequalities, |X| ≤ |A| + |B| = |slots| ≤ |⋃_{e ∈ X} (allowed slots for e)|.
uses
Finset.card_le_cardcalc X.card ≤ A.card + B.card := hineq _ = slots.card := hslots.symm _ ≤ _ := Finset.card_le_card hsub
Finset.card_eq_zero.mpr- A finite set has cardinality 0 if it is empty.
Finset.eq_empty_iff_forall_notMem.mpr- A set is empty if and only if every element is not in the set.
Finset.card_le_card- If one finite set is a subset of another, its cardinality is at most that of the other.
Finset.sum_subset- If s₁ ⊆ s₂ and f vanishes on s₂ \ s₁, then the sum of f over s₁ equals the sum of f over s₂.
Finset.subset_univ- Every finite set of elements of a finite type is a subset of the universal set.
Finset.sum_sdiff- If s₁ ⊆ s₂, the sum over s₂ can be decomposed into the sum over s₂ \ s₁ plus the sum over s₁.
Finset.sum_le_sum- If f(i) ≤ g(i) for all elements i of a finite set, then the sum of f over the set is at most the sum of g.
mul_comm- Multiplication is commutative (a * b = b * a).
op874_four_two_incidence_count- In a bipartite incidence system where every edge is incident to 2 left vertices, the sum of degrees of all left vertices in an edge set X equals 2 * |X|.
Finset.card_sdiff_add_card_eq_card- If s ⊆ t, then |t \ s| + |s| = |t|.
Finset.disjoint_left.mpr- Two sets are disjoint if no element of the first belongs to the second.
Finset.card_union_of_disjoint- The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.card_image_of_injective- The image of a finite set under an injective function has the same cardinality as the domain set.
- The inequality |X| ≤ |A| + |B| in step 6 is discharged by `omega` using linear integer arithmetic on the degree sum bounds and set cardinalities.
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.
open Finsetset_option maxHeartbeats 4000000set_option maxRecDepth 8192theorem op874_four_two_slot_hall {L E : Type*} [Fintype L] [Fintype E] [DecidableEq L] [DecidableEq E] (inc : L → E → Prop) [DecidableRel inc] (S : Finset E) (hleft : ∀ l, (univ.filter fun e => inc l e).card = 4) (hright : ∀ e, (univ.filter fun l => inc l e).card = 2) (hS : ∀ l, (S.filter fun e => inc l e).card ≤ 2) (X : Finset E) : X.card ≤ (X.biUnion fun e => univ.filter fun p : L × Bool => inc p.1 e ∧ (e ∈ S → p.2 = false)).card := by classical let A : Finset L := univ.filter fun l => ∃ e ∈ X, inc l e let B : Finset L := univ.filter fun l => ∃ e ∈ X, e ∉ S ∧ inc l e let d : L → ℕ := fun l => (X.filter fun e => inc l e).card have hBA : B ⊆ A := by intro l hl simp only [B, A, mem_filter, mem_univ, true_and] at hl ⊢ obtain ⟨e, he, -, hi⟩ := hl exact ⟨e, he, hi⟩ have hdn : ∀ l, l ∉ A → d l = 0 := by intro l hl apply Finset.card_eq_zero.mpr apply Finset.eq_empty_iff_forall_notMem.mpr intro e he have hx := mem_filter.mp he apply hl simp only [A, mem_filter, mem_univ, true_and] exact ⟨e, hx.1, hx.2⟩ have hd4 : ∀ l, d l ≤ 4 := by intro l calc d l ≤ (univ.filter fun e => inc l e).card := by apply Finset.card_le_card intro e he simp only [mem_filter, mem_univ, true_and] at he ⊢ exact he.2 _ = 4 := hleft l have hd2 : ∀ l ∈ A \ B, d l ≤ 2 := by intro l hl have hnot : l ∉ B := (mem_sdiff.mp hl).2 calc d l ≤ (S.filter fun e => inc l e).card := by apply Finset.card_le_card intro e he simp only [d, mem_filter] at he simp only [mem_filter] refine ⟨?_, he.2⟩ by_contra hn apply hnot simp only [B, mem_filter, mem_univ, true_and] exact ⟨e, he.1, hn, he.2⟩ _ ≤ 2 := hS l have hsum0 : (∑ l : L, d l) = ∑ l ∈ A, d l := by symm apply Finset.sum_subset (Finset.subset_univ A) intro l _ hl exact hdn l hl have hsum : (∑ l : L, d l) = (∑ l ∈ A \ B, d l) + ∑ l ∈ B, d l := by rw [hsum0, Finset.sum_sdiff hBA] have hbound1 : (∑ l ∈ A \ B, d l) ≤ 2 * (A \ B).card := by calc _ ≤ ∑ _l ∈ A \ B, 2 := Finset.sum_le_sum (by intro l hl; exact hd2 l hl) _ = _ := by simp [mul_comm] have hbound2 : (∑ l ∈ B, d l) ≤ 4 * B.card := by calc _ ≤ ∑ _l ∈ B, 4 := Finset.sum_le_sum (by intro l _; exact hd4 l) _ = _ := by simp [mul_comm] have hdouble := op874_four_two_incidence_count inc hright X change (∑ l : L, d l) = 2 * X.card at hdouble have hcardAB : (A \ B).card + B.card = A.card := Finset.card_sdiff_add_card_eq_card hBA have hineq : X.card ≤ A.card + B.card := by omega let slots : Finset (L × Bool) := A.image (fun l => (l,false)) ∪ B.image (fun l => (l,true)) have hdisj : Disjoint (A.image (fun l => (l,false))) (B.image (fun l => (l,true))) := by apply Finset.disjoint_left.mpr intro p hp hq rcases Finset.mem_image.mp hp with ⟨a, -, rfl⟩ rcases Finset.mem_image.mp hq with ⟨b, -, he⟩ have := congrArg Prod.snd he cases this have hslots : slots.card = A.card + B.card := by dsimp [slots] rw [Finset.card_union_of_disjoint hdisj] rw [Finset.card_image_of_injective _ (by intro a b h; exact congrArg Prod.fst h), Finset.card_image_of_injective _ (by intro a b h; exact congrArg Prod.fst h)] have hsub : slots ⊆ X.biUnion (fun e => univ.filter fun p : L × Bool => inc p.1 e ∧ (e ∈ S → p.2 = false)) := by intro p hp rcases Finset.mem_union.mp hp with hp | hp · rcases Finset.mem_image.mp hp with ⟨l, hl, rfl⟩ simp only [A, mem_filter, mem_univ, true_and] at hl obtain ⟨e, he, hi⟩ := hl simp only [mem_biUnion, mem_filter, mem_univ, true_and] exact ⟨e, he, hi, by simp⟩ · rcases Finset.mem_image.mp hp with ⟨l, hl, rfl⟩ simp only [B, mem_filter, mem_univ, true_and] at hl obtain ⟨e, he, hn, hi⟩ := hl simp only [mem_biUnion, mem_filter, mem_univ, true_and] exact ⟨e, he, hi, by intro hs; exact (hn hs).elim⟩ calc X.card ≤ A.card + B.card := hineq _ = slots.card := hslots.symm _ ≤ _ := Finset.card_le_card hsub