The components left by deleting a separator
Lax263307.SeparatorComponents · concepts/Lax263307/SeparatorComponents.lean · lax-263307
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
Deleting a vertex set partitions the remaining vertices into connected components. Every undeleted vertex belongs to exactly one part, and every edge with undeleted endpoints has both endpoints in one part. These are the properties used to combine the recursive independent sets.
Concept map
Lean source view on GitHub
| 1 | import Lax263307.LinearRelaxation |
| 2 | import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: The components left by deleting a separator |
| 7 | type: definition |
| 8 | --- |
| 9 | Deleting a vertex set partitions the remaining vertices into connected |
| 10 | components. Every undeleted vertex belongs to exactly one part, and every |
| 11 | edge with undeleted endpoints has both endpoints in one part. These are the |
| 12 | properties used to combine the recursive independent sets. |
| 13 | |
| 14 | # Formalization notes |
| 15 | |
| 16 | `Partition` also permits grouping connected components together. The canonical |
| 17 | `components` construction uses precisely the connected components of . |
| 18 | The vertex sets of the parts are finite sets in the original vertex type. |
| 19 | -/ |
| 20 | |
| 21 | namespace Lax263307.SeparatorComponents |
| 22 | |
| 23 | /-- A partition of the undeleted vertices, closed under undeleted edges. -/ |
| 24 | structure Partition {n : ℕ} (G : SimpleGraph (Fin n)) |
| 25 | (S : Finset (Fin n)) (ι : Type) where |
| 26 | /-- The original vertices in each part. -/ |
| 27 | vertices : ι → Finset (Fin n) |
| 28 | /-- Parts exclude the deleted vertices. -/ |
| 29 | outside : ∀ i v, v ∈ vertices i → v ∉ S |
| 30 | /-- Every undeleted vertex belongs to exactly one part. -/ |
| 31 | unique : ∀ v, v ∉ S → ∃! i, v ∈ vertices i |
| 32 | /-- No undeleted edge leaves a part. -/ |
| 33 | closed : ∀ i u v, u ∈ vertices i → v ∉ S → G.Adj u v → v ∈ vertices i |
| 34 | |
| 35 | /-- Connected components of the induced graph give the canonical partition. -/ |
| 36 | noncomputable def components {n : ℕ} (G : SimpleGraph (Fin n)) |
| 37 | (S : Finset (Fin n)) : |
| 38 | Partition G S (G.induce (↑S : Set (Fin n))ᶜ).ConnectedComponent := by |
| 39 | classical |
| 40 | let H := G.induce (↑S : Set (Fin n))ᶜ |
| 41 | let vertices (c : H.ConnectedComponent) := (Subtype.val '' c.supp).toFinset |
| 42 | exact |
| 43 | { vertices := vertices |
| 44 | outside := by |
| 45 | intro c v hv |
| 46 | obtain ⟨u, _, rfl⟩ := Set.mem_toFinset.mp hv |
| 47 | exact u.property |
| 48 | unique := by |
| 49 | intro v hv |
| 50 | let u : ↥((↑S : Set (Fin n))ᶜ) := ⟨v, hv⟩ |
| 51 | refine ⟨H.connectedComponentMk u, ?_, ?_⟩ |
| 52 | · exact Set.mem_toFinset.mpr ⟨u, rfl, rfl⟩ |
| 53 | · intro c hc |
| 54 | obtain ⟨w, hw, he⟩ := Set.mem_toFinset.mp hc |
| 55 | have hwu : w = u := Subtype.ext he |
| 56 | change H.connectedComponentMk w = c at hw |
| 57 | rw [hwu] at hw |
| 58 | exact hw.symm |
| 59 | closed := by |
| 60 | intro c u v hu hv huv |
| 61 | obtain ⟨u', hu', rfl⟩ := Set.mem_toFinset.mp hu |
| 62 | let v' : ↥((↑S : Set (Fin n))ᶜ) := ⟨v, hv⟩ |
| 63 | exact Set.mem_toFinset.mpr ⟨v', |
| 64 | (SimpleGraph.ConnectedComponent.mem_supp_congr_adj c |
| 65 | (show H.Adj u' v' from huv)).mp hu', rfl⟩ } |
| 66 | |
| 67 | /-- The recursive answer is the union of the answers on the parts. -/ |
| 68 | def combine {n : ℕ} {ι : Type} [Fintype ι] (I : ι → Finset (Fin n)) : |
| 69 | Finset (Fin n) := Finset.univ.biUnion I |
| 70 | |
| 71 | end Lax263307.SeparatorComponents |
| 72 |
Formalization notes
also permits grouping connected components together. The canonical construction uses precisely the connected components of . The vertex sets of the parts are finite sets in the original vertex type.
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments