Skip to content

Commit 977f84b

Browse files
committed
feat(Combinatorics/SimpleGraph/Maps): characterize neighborSet and edgeSet across an embedding (#35628)
1 parent c7a9524 commit 977f84b

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Maps.lean

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,21 @@ theorem edgeSet_map (f : V ↪ W) (G : SimpleGraph V) :
8888
rw [Embedding.sym2Map_apply, Sym2.map_mk, Sym2.eq_iff] at he
8989
exact he.elim (fun ⟨h, h'⟩ ↦ ⟨_, _, hadj, h, h'⟩) (fun ⟨h', h⟩ ↦ ⟨_, _, hadj.symm, h, h'⟩)
9090

91+
@[simp]
92+
theorem neighborSet_map (f : V ↪ W) (v : V) :
93+
(G.map f).neighborSet (f v) = f '' G.neighborSet v := by
94+
refine Set.ext fun u ↦ ⟨?_, ?_⟩
95+
· exact fun ⟨hne, v', u', hadj, hv, hu⟩ ↦ ⟨u', f.injective hv ▸ hadj, hu⟩
96+
· exact fun ⟨u', hadj, hu⟩ ↦ ⟨hu ▸ f.injective.ne hadj.ne, v, u', hadj, rfl, hu⟩
97+
9198
lemma map_adj_apply {G : SimpleGraph V} {f : V ↪ W} {a b : V} :
9299
(G.map f).Adj (f a) (f b) ↔ G.Adj a b := by simp
93100

101+
variable {G} in
102+
theorem map_adj_apply' {f : V → W} (hadj : G.Adj u v) (hne : f u ≠ f v) :
103+
(G.map f).Adj (f u) (f v) :=
104+
⟨hne, u, v, hadj, rfl, rfl⟩
105+
94106
theorem map_monotone (f : V → W) : Monotone (SimpleGraph.map f) := by
95107
rintro G G' h z1 z2 ⟨huv, u, v, ha, rfl, rfl⟩
96108
exact ⟨huv, _, _, h ha, rfl, rfl⟩
@@ -329,9 +341,23 @@ theorem map_adj {v w : V} (h : G.Adj v w) : G'.Adj (f v) (f w) :=
329341
theorem map_mem_edgeSet {e : Sym2 V} (h : e ∈ G.edgeSet) : e.map f ∈ G'.edgeSet :=
330342
Sym2.ind (fun _ _ => f.map_rel') e h
331343

344+
theorem subset_preimage_edgeSet : G.edgeSet ⊆ Sym2.map f ⁻¹' G'.edgeSet :=
345+
fun _ ↦ f.map_mem_edgeSet
346+
347+
theorem image_edgeSet_subset : Sym2.map f '' G.edgeSet ⊆ G'.edgeSet :=
348+
Set.image_subset_iff.mpr f.subset_preimage_edgeSet
349+
332350
theorem apply_mem_neighborSet {v w : V} (h : w ∈ G.neighborSet v) : f w ∈ G'.neighborSet (f v) :=
333351
map_adj f h
334352

353+
variable (v) in
354+
theorem subset_preimage_neighborSet : G.neighborSet v ⊆ f ⁻¹' G'.neighborSet (f v) :=
355+
fun _ ↦ f.apply_mem_neighborSet
356+
357+
variable (v) in
358+
theorem image_neighborSet_subset : f '' G.neighborSet v ⊆ G'.neighborSet (f v) :=
359+
Set.image_subset_iff.mpr <| f.subset_preimage_neighborSet v
360+
335361
/-- The map between edge sets induced by a homomorphism.
336362
The underlying map on edges is given by `Sym2.map`. -/
337363
@[simps]
@@ -364,6 +390,11 @@ theorem mapEdgeSet.injective (hinj : Function.Injective f) : Function.Injective
364390
repeat rw [Subtype.mk_eq_mk]
365391
apply Sym2.map.injective hinj
366392

393+
@[gcongr]
394+
theorem _root_.SimpleGraph.neighborSet_mono (hle : G₁ ≤ G₂) (v : V) :
395+
G₁.neighborSet v ⊆ G₂.neighborSet v :=
396+
subset_preimage_neighborSet v <| .ofLE hle
397+
367398
/-- Every graph homomorphism from a complete graph is injective. -/
368399
theorem injective_of_top_hom (f : (⊤ : SimpleGraph V) →g G') : Function.Injective f := by
369400
intro v w h
@@ -419,9 +450,18 @@ abbrev toHom : G →g G' :=
419450
theorem map_mem_edgeSet_iff {e : Sym2 V} : e.map f ∈ G'.edgeSet ↔ e ∈ G.edgeSet :=
420451
Sym2.ind (fun _ _ => f.map_adj_iff) e
421452

453+
@[simp]
454+
theorem preimage_edgeSet : Sym2.map f ⁻¹' G'.edgeSet = G.edgeSet :=
455+
Set.ext fun _ ↦ map_mem_edgeSet_iff f
456+
422457
theorem apply_mem_neighborSet_iff {v w : V} : f w ∈ G'.neighborSet (f v) ↔ w ∈ G.neighborSet v :=
423458
map_adj_iff f
424459

460+
variable (v) in
461+
@[simp]
462+
theorem preimage_neighborSet : f ⁻¹' G'.neighborSet (f v) = G.neighborSet v :=
463+
Set.ext fun _ ↦ apply_mem_neighborSet_iff f
464+
425465
/-- A graph embedding induces an embedding of edge sets. -/
426466
@[simps]
427467
def mapEdgeSet : G.edgeSet ↪ G'.edgeSet where
@@ -574,6 +614,10 @@ theorem map_mem_edgeSet_iff {e : Sym2 V} : e.map f ∈ G'.edgeSet ↔ e ∈ G.ed
574614
theorem apply_mem_neighborSet_iff {v w : V} : f w ∈ G'.neighborSet (f v) ↔ w ∈ G.neighborSet v :=
575615
map_adj_iff f
576616

617+
theorem image_neighborSet : f '' G.neighborSet v = G'.neighborSet (f v) := by
618+
rw [← f.toEmbedding.preimage_neighborSet]
619+
apply Equiv.image_preimage
620+
577621
@[simp]
578622
theorem symm_toHom_comp_toHom : f.symm.toHom.comp f.toHom = Hom.id := by
579623
ext v
@@ -666,6 +710,18 @@ theorem coe_comp (f' : G' ≃g G'') (f : G ≃g G') : ⇑(f'.comp f) = f' ∘ f
666710

667711
end Iso
668712

713+
theorem neighborSet_comap (f : V → W) (v : V) :
714+
(G'.comap f).neighborSet v = f ⁻¹' G'.neighborSet (f v) :=
715+
rfl
716+
717+
theorem neighborSet_induce (s : Set V) (v : s) :
718+
(G.induce s).neighborSet v = (↑) ⁻¹' G.neighborSet v :=
719+
G.neighborSet_comap _ v
720+
721+
theorem neighborSet_map_equiv (e : V ≃ W) (w : W) :
722+
(G.map e).neighborSet w = e.symm ⁻¹' G.neighborSet (e.symm w) :=
723+
Iso.map e G |>.symm.toEmbedding.preimage_neighborSet w |>.symm
724+
669725
/-- The graph induced on `Set.univ` is isomorphic to the original graph. -/
670726
@[simps!]
671727
def induceUnivIso (G : SimpleGraph V) : G.induce Set.univ ≃g G where

0 commit comments

Comments
 (0)