Skip to content

Commit 28c4b7f

Browse files
committed
feat(Combinatorics/SimpleGraph/Operations): a graph is the supremum of edge graphs (leanprover-community#39561)
- `G = ⨆ e ∈ G.edgeSet, fromEdgeSet {e}` - `G = sSup { edge u v | (u : V) (v : V) (_ : G.Adj u v) }` and `edgeSet` & `fromEdgeSet` preserve sup & inf.
1 parent 3eb2bc7 commit 28c4b7f

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Basic.lean

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,27 @@ theorem edgeSet_inf : (G₁ ⊓ G₂).edgeSet = G₁.edgeSet ∩ G₂.edgeSet :=
526526
ext ⟨x, y⟩
527527
rfl
528528

529+
theorem edgeSet_sSup {s : Set (SimpleGraph V)} : (sSup s).edgeSet = ⋃₀ (edgeSet '' s) := by
530+
ext ⟨x, y⟩
531+
simp
532+
533+
theorem edgeSet_sInf {s : Set (SimpleGraph V)} (h : s.Nonempty) :
534+
(sInf s).edgeSet = ⋂₀ (edgeSet '' s) := by
535+
ext ⟨x, y⟩
536+
have ⟨G, hG⟩ := h
537+
simpa using (· G hG |>.ne)
538+
539+
theorem edgeSet_iSup {ι : Sort*} {f : ι → SimpleGraph V} :
540+
(⨆ i, f i).edgeSet = ⋃ i, (f i).edgeSet := by
541+
ext ⟨x, y⟩
542+
simp
543+
544+
theorem edgeSet_iInf {ι : Sort*} [Nonempty ι] {f : ι → SimpleGraph V} :
545+
(⨅ i, f i).edgeSet = ⋂ i, (f i).edgeSet := by
546+
ext ⟨x, y⟩
547+
have ⟨i⟩ := ‹Nonempty ι›
548+
simpa using (· i |>.ne)
549+
529550
@[simp]
530551
theorem edgeSet_sdiff : (G₁ \ G₂).edgeSet = G₁.edgeSet \ G₂.edgeSet := by
531552
ext ⟨x, y⟩
@@ -670,6 +691,27 @@ theorem fromEdgeSet_union (s t : Set (Sym2 V)) :
670691
ext v w
671692
simp [Set.mem_union, or_and_right]
672693

694+
theorem fromEdgeSet_sUnion {s : Set (Set (Sym2 V))} :
695+
fromEdgeSet (⋃₀ s) = sSup (fromEdgeSet '' s) := by
696+
ext u v
697+
simp
698+
grind
699+
700+
theorem fromEdgeSet_iUnion {ι : Sort*} {f : ι → Set (Sym2 V)} :
701+
fromEdgeSet (⋃ i, f i) = ⨆ i, fromEdgeSet (f i) := by
702+
ext u v
703+
simp
704+
705+
theorem fromEdgeSet_sInter {s : Set (Set (Sym2 V))} :
706+
fromEdgeSet (⋂₀ s) = sInf (fromEdgeSet '' s) := by
707+
ext u v
708+
simp_all
709+
710+
theorem fromEdgeSet_iInter {ι : Sort*} {f : ι → Set (Sym2 V)} :
711+
fromEdgeSet (⋂ i, f i) = ⨅ i, fromEdgeSet (f i) := by
712+
ext u v
713+
simp_all
714+
673715
@[simp]
674716
theorem fromEdgeSet_sdiff (s t : Set (Sym2 V)) :
675717
fromEdgeSet (s \ t) = fromEdgeSet s \ fromEdgeSet t := by

Mathlib/Combinatorics/SimpleGraph/Operations.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,15 @@ lemma disjoint_edge {u v : V} : Disjoint G (edge u v) ↔ ¬G.Adj u v := by
195195
lemma sdiff_edge {u v : V} (h : ¬G.Adj u v) : G \ edge u v = G := by
196196
simp [disjoint_edge, h]
197197

198+
theorem biSup_fromEdgeSet_singleton_eq : ⨆ e ∈ G.edgeSet, fromEdgeSet {e} = G := by
199+
simp_rw [← edgeSet_inj, ← iSup_subtype'', edgeSet_iSup, edgeSet_fromEdgeSet, ← Set.iUnion_sdiff,
200+
Set.iUnion_coe_set, Set.biUnion_of_singleton]
201+
exact Set.disjoint_left.mpr G.edgeSet_subset_compl_diagSet |>.sdiff_eq_left
202+
203+
theorem sSup_edge_eq : sSup { edge u v | (u : V) (v : V) (_ : G.Adj u v) } = G := by
204+
refine .trans ?_ G.biSup_fromEdgeSet_singleton_eq
205+
simp_rw [edge, ← iSup_subtype'', iSup, Set.range, Subtype.exists, Sym2.exists, mem_edgeSet]
206+
198207
theorem Subgraph.spanningCoe_sup_edge_le {H : Subgraph (G ⊔ edge s t)} (h : ¬ H.Adj s t) :
199208
H.spanningCoe ≤ G := by
200209
intro v w hvw

0 commit comments

Comments
 (0)