op874_four_two_incidence_two_pseudoforest_cover
In a finite four-by-two incidence system, if every left vertex meets at most two required edges, the edges split into two injective incident assignments, one covering every required edge and one containing none of them.
Statement
theorem op874_four_two_incidence_two_pseudoforest_cover {L E : Type*} [Fintype L] [Fintype E] [DecidableEq L] [DecidableEq E] (inc : L → E → Prop) [DecidableRel inc] (S : Finset E) (hleft : ∀ l, (Finset.univ.filter fun e => inc l e).card = 4) (hright : ∀ e, (Finset.univ.filter fun l => inc l e).card = 2) (hS : ∀ l, (S.filter fun e => inc l e).card ≤ 2) : ∃ f g : L → E, Function.Injective f ∧ Function.Injective g ∧ (∀ l, inc l (f l) ∧ inc l (g l) ∧ g l ∉ S) ∧ (∀ x y, f x ≠ g y) ∧ ∀ e ∈ S, ∃ l, f l = e
- Source
- Low-port and pseudoforest decomposition for OP-874, https://arxiv.org/abs/2610.41950.
- Verified
- 27 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- 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.
- op874_four_two_slot_hallIn 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…
- Used by 1
- op874_disjoint_two_edge_families_hit_by_pair_swapsIf the edges are partitioned into paired assignments f and g, g avoids required edges, and disjoint edge families each contain at least…
The proof, explained
The theorem is proved by rephrasing the two assignments as a bipartite matching problem between edges $E$ and vertex-slot pairs $L \times \{\text{false}, \text{true}\}$, where required edges $S$ can only be assigned to $\text{false}$ (the slot for $f$). Hall's Marriage Condition is shown to hold by an auxiliary lemma, yielding an injective matching $m : E \to L \times \{\text{false}, \text{true}\}$. A double-counting of incidences reveals that $|E| = 2|L| = |L \times \text{Bool}|$, ensuring that $m$ is in fact a bijection whose inverse separates into two injective functions $f$ and $g$. The choices defining the matching guarantee that both functions respect incidences, have disjoint images, $g$ contains no edge from $S$, and $f$ covers all required edges.
There exists an injective matching $m : E \to L \times \text{Bool}$ such that every edge is sent to an incident vertex, with required edges restricted to the false slot.
We define the available slots for each edge $e \in E$ as pairs $(l, b) \in L \times \text{Bool}$ such that $l$ is incident to $e$, with the requirement that if $e \in S$, then $b = \text{false}$. By lemma `op874_four_two_slot_hall`, Hall's marriage condition $|X| \le |\bigcup_{e \in X} \text{choices}(e)|$ holds for every subset of edges $X \subseteq E$. Applying Hall's Marriage Theorem (`Finset.all_card_le_biUnion_card_iff_existsInjective'`) gives an injective assignment $m : E \to L \times \text{Bool}$ such that $m(e) \in \text{choices}(e)$ for every $e \in E$.
uses
op874_four_two_slot_hall,Finset.all_card_le_biUnion_card_iff_existsInjective'classical let choices : E → Finset (L × Bool) := fun e => univ.filter fun p => inc p.1 e ∧ (e ∈ S → p.2 = false) have hhall : ∀ X : Finset E, X.card ≤ (X.biUnion choices).card := fun X => op874_four_two_slot_hall inc S hleft hright hS X obtain ⟨m, hminj, hm⟩ := (Finset.all_card_le_biUnion_card_iff_existsInjective' choices).mp hhall
The matching $m$ is a bijection, and its inverse $\text{inv} : L \times \text{Bool} \to E$ satisfies $m(\text{inv}(p)) = p$ for all $p$.
Double counting edge-vertex incidences via `op874_four_two_incidence_count` shows that $\sum_{l \in L} 4 = 2 |E|$, which simplifies to $4|L| = 2|E|$, and thus $|E| = 2|L| = |L \times \text{Bool}|$. Since $m : E \to L \times \text{Bool}$ is an injective function between finite types of the same size, it is also surjective and hence bijective (`Fintype.bijective_iff_injective_and_card`). We define the inverse function $\text{inv} : L \times \text{Bool} \to E$ using `Classical.choose`, which satisfies $m(\text{inv}(p)) = p$ by `Classical.choose_spec`.
uses
op874_four_two_incidence_count,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Fintype.card_prod,Fintype.card_bool,Nat.cast_id,Fintype.bijective_iff_injective_and_card,Classical.choose,Classical.choose_spechave hcard : Fintype.card E = Fintype.card (L × Bool) := by have h := op874_four_two_incidence_count inc hright (univ : Finset E) simp only [hleft, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, Fintype.card_prod, Fintype.card_bool] at h ⊢ simp only [Nat.cast_id] at h omega have hmsurj : Function.Surjective m := ((Fintype.bijective_iff_injective_and_card m).2 ⟨hminj,hcard⟩).2 let inv : L × Bool → E := fun p => Classical.choose (hmsurj p) have hinv : ∀ p, m (inv p) = p := fun p => Classical.choose_spec (hmsurj p)
The candidate functions $f(l) = \text{inv}(l, \text{false})$ and $g(l) = \text{inv}(l, \text{true})$ are injective.
We set $f(l) = \text{inv}(l, \text{false})$ and $g(l) = \text{inv}(l, \text{true})$. If $f(x) = f(y)$, applying $m$ to both sides gives $m(f(x)) = m(f(y))$. Since $m(\text{inv}(p)) = p$, this reduces to $(x, \text{false}) = (y, \text{false})$, so $x = y$. The identical argument proves that $g$ is injective.
uses
congrArg,Prod.mk.injEq,and_truelet f : L → E := fun l => inv (l,false) let g : L → E := fun l => inv (l,true) have hf : Function.Injective f := by intro x y h have := congrArg m h simp only [f, hinv, Prod.mk.injEq, and_true] at this exact this have hg : Function.Injective g := by intro x y h have := congrArg m h simp only [g, hinv, Prod.mk.injEq, and_true] at this exact this
Providing $f$ and $g$ reduces the goal to incidence, edge avoidance for $g$, range disjointness, and covering $S$.
We instantiate the existential quantifiers with $f$ and $g$ along with their injectivity proofs, leaving three subgoals: incidence and $g(l) \notin S$, disjointness of the ranges of $f$ and $g$, and coverage of $S$ by $f$.
refine ⟨f,g,hf,hg,?_,?_,?_⟩For each vertex $l \in L$, $l$ is incident to both $f(l)$ and $g(l)$, and $g(l) \notin S$.
From $m(f(l)) \in \text{choices}(f(l))$ and $m(f(l)) = (l, \text{false})$, the definition of choices implies $l$ is incident to $f(l)$. Likewise, $m(g(l)) \in \text{choices}(g(l))$ with $m(g(l)) = (l, \text{true})$ implies that $l$ is incident to $g(l)$ and that $g(l) \in S \implies \text{true} = \text{false}$, which means $g(l) \notin S$.
uses
mem_filter,mem_univ,true_and,Prod.fst,Prod.snd,Bool.true_eq_false,imp_false· intro l have h0 := hm (f l) have h1 := hm (g l) simp only [choices, mem_filter, mem_univ, true_and] at h0 h1 rw [show m (f l) = (l,false) from hinv _] at h0 rw [show m (g l) = (l,true) from hinv _] at h1 simp only [Prod.fst, Prod.snd, Bool.true_eq_false, imp_false] at h0 h1 exact ⟨h0.1,h1.1,h1.2⟩
The images of $f$ and $g$ are disjoint: $f(x) \neq g(y)$ for all $x, y \in L$.
If $f(x) = g(y)$, applying $m$ to both sides yields $m(f(x)) = m(g(y))$, meaning $(x, \text{false}) = (y, \text{true})$. Comparing the second coordinates yields $\text{false} = \text{true}$, a contradiction.
uses
congrArg,Prod.mk.injEq,Bool.false_eq_true,and_false· intro x y h have := congrArg m h simp only [f,g,hinv,Prod.mk.injEq,Bool.false_eq_true,and_false] at this
Every required edge $e \in S$ is covered by $f$: there exists $l \in L$ such that $f(l) = e$.
Given $e \in S$, the condition $m(e) \in \text{choices}(e)$ forces $(m(e)).2 = \text{false}$, so $m(e) = (l, \text{false})$ where $l = (m(e)).1$. Then $m(f(l)) = (l, \text{false}) = m(e)$. Since $m$ is injective, this implies $f(l) = e$.
uses
mem_filter,mem_univ,true_and,Prod.fst,Prod.snd· intro e he have h := hm e simp only [choices,mem_filter,mem_univ,true_and] at h have hb := h.2 he refine ⟨(m e).1, ?_⟩ apply hminj rw [show m (f (m e).1) = ((m e).1,false) from hinv _] cases hme : m e with | mk l b => simp only [hme, Prod.fst, Prod.snd] at hb ⊢; subst b; rfl
op874_four_two_slot_hall- In a 4-by-2 incidence system where every left vertex has at most 2 incident edges in $S$, Hall's marriage condition holds for assigning edges to pairs in $L \times \text{Bool}$ with edges in $S$ restricted to $\text{false}$: $|X| \le |\bigcup_{e \in X} \text{choices}(e)|$ for every edge subset $X$.
Finset.all_card_le_biUnion_card_iff_existsInjective'- Hall's Marriage Theorem for finite indexed families of sets: an injective choice function exists if and only if Hall's condition $|s| \le |\bigcup_{i \in s} t(i)|$ holds for all finite subsets $s$.
op874_four_two_incidence_count- In an incidence system where every edge has degree 2, the sum over all vertices of their degrees in an edge subset $X$ equals $2|X|$.
Finset.sum_const- The sum of a constant term over a finite set equals the cardinality of the set multiplied by the constant.
Finset.card_univ- The cardinality of the universal finset `univ` of a finite type is the cardinality of that type.
nsmul_eq_mul- Scalar multiplication by a natural number $n \cdot a$ in a semiring equals multiplication $n * a$.
Fintype.card_prod- The cardinality of a product type $\alpha \times \beta$ is the product of the cardinalities of $\alpha$ and $\beta$.
Fintype.card_bool- The boolean type $\text{Bool}$ has cardinality 2.
Nat.cast_id- The coercion from $\mathbb{N}$ to $\mathbb{N}$ is the identity map.
Fintype.bijective_iff_injective_and_card- A map between finite types of the same cardinality is bijective if and only if it is injective.
Classical.choose- Produces an element satisfying a given property from an existential proof.
Classical.choose_spec- The element produced by `Classical.choose` satisfies the predicate of the existential statement.
congrArg- If $x = y$, then $h(x) = h(y)$ for any function $h$.
Prod.mk.injEq- Two ordered pairs $(a, b)$ and $(c, d)$ are equal if and only if $a = c$ and $b = d$.
and_true- The logical conjunction $P \land \text{True}$ simplifies to $P$.
mem_filter- An element belongs to a filtered finset $\{x \in s \mid p(x)\}$ if and only if it belongs to $s$ and satisfies $p$.
mem_univ- Every element of a finite type belongs to the universal finset `univ`.
true_and- The logical conjunction $\text{True} \land P$ simplifies to $P$.
Prod.fst- The first coordinate projection of a pair $(a, b)$ is $a$.
Prod.snd- The second coordinate projection of a pair $(a, b)$ is $b$.
Bool.true_eq_false- The proposition $\text{true} = \text{false}$ is false.
imp_false- An implication $P \to \text{False}$ is equivalent to $\neg P$.
Bool.false_eq_true- The proposition $\text{false} = \text{true}$ is false.
and_false- The logical conjunction $P \land \text{False}$ simplifies to $\text{False}$.
- The inverse of the matching $m$ is constructed non-computably using `Classical.choose`.
- The cardinality identity $|E| = 2|L|$ is derived from $4|L| = 2|E|$ via linear integer arithmetic automation (`omega`).
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_incidence_two_pseudoforest_cover {L E : Type*} [Fintype L] [Fintype E] [DecidableEq L] [DecidableEq E] (inc : L → E → Prop) [DecidableRel inc] (S : Finset E) (hleft : ∀ l, (Finset.univ.filter fun e => inc l e).card = 4) (hright : ∀ e, (Finset.univ.filter fun l => inc l e).card = 2) (hS : ∀ l, (S.filter fun e => inc l e).card ≤ 2) : ∃ f g : L → E, Function.Injective f ∧ Function.Injective g ∧ (∀ l, inc l (f l) ∧ inc l (g l) ∧ g l ∉ S) ∧ (∀ x y, f x ≠ g y) ∧ ∀ e ∈ S, ∃ l, f l = e := by classical let choices : E → Finset (L × Bool) := fun e => univ.filter fun p => inc p.1 e ∧ (e ∈ S → p.2 = false) have hhall : ∀ X : Finset E, X.card ≤ (X.biUnion choices).card := fun X => op874_four_two_slot_hall inc S hleft hright hS X obtain ⟨m, hminj, hm⟩ := (Finset.all_card_le_biUnion_card_iff_existsInjective' choices).mp hhall have hcard : Fintype.card E = Fintype.card (L × Bool) := by have h := op874_four_two_incidence_count inc hright (univ : Finset E) simp only [hleft, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, Fintype.card_prod, Fintype.card_bool] at h ⊢ simp only [Nat.cast_id] at h omega have hmsurj : Function.Surjective m := ((Fintype.bijective_iff_injective_and_card m).2 ⟨hminj,hcard⟩).2 let inv : L × Bool → E := fun p => Classical.choose (hmsurj p) have hinv : ∀ p, m (inv p) = p := fun p => Classical.choose_spec (hmsurj p) let f : L → E := fun l => inv (l,false) let g : L → E := fun l => inv (l,true) have hf : Function.Injective f := by intro x y h have := congrArg m h simp only [f, hinv, Prod.mk.injEq, and_true] at this exact this have hg : Function.Injective g := by intro x y h have := congrArg m h simp only [g, hinv, Prod.mk.injEq, and_true] at this exact this refine ⟨f,g,hf,hg,?_,?_,?_⟩ · intro l have h0 := hm (f l) have h1 := hm (g l) simp only [choices, mem_filter, mem_univ, true_and] at h0 h1 rw [show m (f l) = (l,false) from hinv _] at h0 rw [show m (g l) = (l,true) from hinv _] at h1 simp only [Prod.fst, Prod.snd, Bool.true_eq_false, imp_false] at h0 h1 exact ⟨h0.1,h1.1,h1.2⟩ · intro x y h have := congrArg m h simp only [f,g,hinv,Prod.mk.injEq,Bool.false_eq_true,and_false] at this · intro e he have h := hm e simp only [choices,mem_filter,mem_univ,true_and] at h have hb := h.2 he refine ⟨(m e).1, ?_⟩ apply hminj rw [show m (f (m e).1) = ((m e).1,false) from hinv _] cases hme : m e with | mk l b => simp only [hme, Prod.fst, Prod.snd] at hb ⊢; subst b; rfl