Skip to content

Commit 2cac942

Browse files
committed
feat(Combinatorics/SimpleGraph/Maps): G →g G.map f (#38422)
The existing `SimpleGraph.Embedding.map` takes an embedding and lifts it to a graph embedding `G ↪g G.map f`. #36130 generalized `SimpleGraph.map` from embeddings to functions, so now we can get a graph homomorphism `G →g G.map f` without requiring that `f` is injective, although we still have to require that it is injective on adjacent vertices (aka a valid coloring). This adds `Coloring.homMap`, and `Hom.map` which is identical but avoids coloring terminology/spelling.
1 parent c87cc97 commit 2cac942

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Coloring/VertexColoring.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V := by
179179
lemma colorable_zero_iff : G.Colorable 0 ↔ IsEmpty V :=
180180
⟨isEmpty_of_colorable_zero, fun _ ↦ .of_isEmpty 0
181181

182+
/-- A coloring of a graph `G` is a homomorphism from it to the mapped graph.
183+
This is `Hom.map` spelled using colorings. The mapped graph `G.map f` can be thought of as taking
184+
the original graph `G` and considering every color class (independent set) as a single vertex. -/
185+
@[simps!]
186+
abbrev Coloring.homMap {α : Type*} (f : G.Coloring α) : G →g G.map f :=
187+
.map f G f.map_adj
188+
182189
/-- If `G` is `n`-colorable, then mapping the vertices of `G` produces an `n`-colorable simple
183190
graph. -/
184191
theorem Colorable.map (f : V ↪ β) [NeZero n] (hc : G.Colorable n) : (G.map f).Colorable n := by

Mathlib/Combinatorics/SimpleGraph/Maps.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ theorem injective_of_top_hom (f : (⊤ : SimpleGraph V) →g G') : Function.Inje
401401
contrapose! h
402402
exact G'.ne_of_adj (map_adj _ ((top_adj _ _).mpr h))
403403

404+
/-- A function `f` that is injective on adjacent vertices in a graph `G`
405+
(equivalently `f` is a valid `W`-coloring of `G`, or `G ≤ comap ⊤ f`)
406+
is a homomorphism from `G` to the mapped graph. -/
407+
@[simps]
408+
protected def map (f : V → W) (G : SimpleGraph V) (h : ∀ {u v}, G.Adj u v → f u ≠ f v) :
409+
G →g G.map f where
410+
toFun := f
411+
map_rel' {u v} hadj := ⟨h hadj, u, v, hadj, rfl, rfl⟩
412+
404413
/-- There is a homomorphism to a graph from a comapped graph.
405414
When the function is injective, this is an embedding (see `SimpleGraph.Embedding.comap`). -/
406415
@[simps]

0 commit comments

Comments
 (0)