retained_line_component_count_le_left_roots
For a simple graph on the first n linearly ordered vertices, the number of connected components is at most the number of vertices with no adjacent vertex to their left.
Statement
theorem retained_line_component_count_le_left_roots {n : ℕ} (G : SimpleGraph (Fin n)) :
Nat.card G.ConnectedComponent ≤
{v : Fin n | ∀ w : Fin n, w < v → ¬ G.Adj v w}.ncard- Source
- OP-815: deterministic component-count bound needed for a uniform tail estimate.
- Verified
- 19 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder.
- TotalPreorderA total preorder: a preorder where
- Used by 1
- retained_line_expected_component_count_boundFor n line vertices with each possible edge independently retained with probability q in [0,1], the expected number of connected…
The proof, explained
Every connected component of the graph has a minimum vertex under the standard linear order on Fin n. Because it is minimal in its component, this vertex cannot be adjacent to any strictly smaller vertex, so it belongs to the set S of left-roots. Mapping each left-root to its connected component yields a surjective function, which implies that the number of connected components is at most the number of left-roots.
Let S be the set of vertices with no adjacent vertex to their left.
We enable classical reasoning and define S ⊆ Fin n as the set of vertices v such that no strictly smaller vertex w < v is adjacent to v.
classical let S := {v : Fin n | ∀ w : Fin n, w < v → ¬ G.Adj v w}For any connected component c, let v be the minimum vertex in c.
To show that the map sending a vertex in S to its connected component is surjective, consider an arbitrary component c. Converting its support to a finset F, which is nonempty because every component is nonempty, we let v be the minimum element of F with respect to the linear order on Fin n; by definition v belongs to c.
have surj : Function.Surjective (fun v : S => G.connectedComponentMk v.1) := by intro c let F := c.supp.toFinset have ne : F.Nonempty := by simpa [F] using c.nonempty_supp let v := F.min' ne have hv : v ∈ c.supp := by simpa [F, v] using F.min'_mem ne
The minimum vertex v has no smaller neighbor, hence v ∈ S.
Suppose for contradiction that some w < v is adjacent to v. Since adjacency preserves component membership, w also belongs to c and thus to F. But v is the minimum of F, so v ≤ w, which contradicts w < v by not_lt_of_ge.
uses
not_lt_of_gehave root : v ∈ S := by intro w hw hadj have hwc : w ∈ c.supp := (c.mem_supp_congr_adj hadj).mp hv have hwF : w ∈ F := by simpa [F] using hwc have hmin : v ≤ w := F.min'_le w hwF exact (not_lt_of_ge hmin) hw
The canonical map sending each vertex in S to its connected component is surjective.
The element v ∈ S belongs to the component c, which definitionally means that the component of v is c. Thus v serves as a preimage for c.
exact ⟨⟨v, root⟩, hv⟩The number of connected components is at most the cardinality of S.
Applying Nat.card_le_card_of_surjective to the surjective component map shows that the number of connected components is at most the cardinality of S, which matches the definition of the set's counting measure.
uses
Nat.card_le_card_of_surjectivehave hcard := Nat.card_le_card_of_surjective (fun v : S => G.connectedComponentMk v.1) surj change Nat.card G.ConnectedComponent ≤ Nat.card S exact hcard
not_lt_of_ge- In a preorder, if a ≤ b then b is not strictly less than a.
Nat.card_le_card_of_surjective- If a function between types is surjective and the domain is finite, the cardinality of the codomain is at most the cardinality of the domain.
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 retained_line_component_count_le_left_roots {n : ℕ} (G : SimpleGraph (Fin n)) : Nat.card G.ConnectedComponent ≤ {v : Fin n | ∀ w : Fin n, w < v → ¬ G.Adj v w}.ncard := by classical let S := {v : Fin n | ∀ w : Fin n, w < v → ¬ G.Adj v w} have surj : Function.Surjective (fun v : S => G.connectedComponentMk v.1) := by intro c let F := c.supp.toFinset have ne : F.Nonempty := by simpa [F] using c.nonempty_supp let v := F.min' ne have hv : v ∈ c.supp := by simpa [F, v] using F.min'_mem ne have root : v ∈ S := by intro w hw hadj have hwc : w ∈ c.supp := (c.mem_supp_congr_adj hadj).mp hv have hwF : w ∈ F := by simpa [F] using hwc have hmin : v ≤ w := F.min'_le w hwF exact (not_lt_of_ge hmin) hw exact ⟨⟨v, root⟩, hv⟩ have hcard := Nat.card_le_card_of_surjective (fun v : S => G.connectedComponentMk v.1) surj change Nat.card G.ConnectedComponent ≤ Nat.card S exact hcard