@@ -38,7 +38,7 @@ whose vertices represent the available colors.
3838 We write `G.chromaticIndex ≠ ⊤` to mean a graph is colorable with finitely many colors.
3939 -/
4040
41- @[expose] public section
41+ public section
4242
4343namespace SimpleGraph
4444
@@ -58,23 +58,27 @@ instance : Coe (G.EdgeColoring α) (G.EdgeLabeling α) where
5858
5959variable (G) in
6060/-- Whether a graph can be edge-colored using colors from `α`. -/
61+ @[expose]
6162def EdgeColorableWith (α : Type *) : Prop :=
6263 Nonempty <| G.EdgeColoring α
6364
6465variable (G n) in
6566/-- Whether a graph can be edge-colored by at most `n` colors. -/
67+ @[expose]
6668def EdgeColorable : Prop :=
6769 G.EdgeColorableWith <| Fin n
6870
6971variable (G) in
7072/-- The chromatic index of a graph is the minimal number of colors needed to color its edges.
7173This is `⊤` (infinity) iff `G` isn't edge-colorable with finitely many colors.
7274If `G` is edge-colorable, then `G.chromaticIndex.toNat` is the `ℕ`-valued chromatic number. -/
75+ @[expose]
7376noncomputable def chromaticIndex : ℕ∞ :=
7477 ⨅ n, ⨅ _ : G.EdgeColorable n, (n : ℕ∞)
7578
7679variable (α) in
7780/-- The unique coloring of the empty graph. -/
81+ @[expose]
7882def EdgeColoring.bot : (⊥ : SimpleGraph V).EdgeColoring α :=
7983 .mk (fun ⟨_, h⟩ ↦ edgeSet_bot ▸ h |>.elim) (lineGraph_bot ▸ · |>.elim)
8084
@@ -107,10 +111,12 @@ theorem chromaticIndex_eq_zero : G.chromaticIndex = 0 ↔ G = ⊥ := by
107111 simpa using isEmpty_of_chromaticNumber_eq_zero h
108112
109113/-- Lift an embedding of colors to an embedding of edge colorings. -/
114+ @[expose]
110115def EdgeColoring.ofColorEmbedding (f : α ↪ β) : G.EdgeColoring α ↪ G.EdgeColoring β :=
111116 recolorOfEmbedding _ f
112117
113118/-- Lift an isomorphism of colors to an isomorphism of edge colorings. -/
119+ @[expose]
114120def EdgeColoring.ofColorIso (f : α ≃ β) : G.EdgeColoring α ≃ G.EdgeColoring β :=
115121 recolorOfEquiv _ f
116122
@@ -123,6 +129,7 @@ theorem EdgeColorable.mono (hle : n ≤ m) (h : G.EdgeColorable n) : G.EdgeColor
123129 Colorable.mono hle h
124130
125131/-- Edge coloring using the edges themselves as colors, coloring with the identity function. -/
132+ @[expose]
126133def EdgeColoring.id : G.EdgeColoring G.edgeSet :=
127134 selfColoring _
128135
@@ -134,16 +141,19 @@ theorem EdgeColorable.of_fintype [Fintype G.edgeSet] : G.EdgeColorable <| card G
134141 colorable_of_fintype _
135142
136143/-- Pre-compose an edge coloring with a line-graph homomorphism. -/
144+ @[expose]
137145def EdgeColoring.ofLineGraphHom (f : G.lineGraph →g G'.lineGraph) (C : G'.EdgeColoring α) :
138146 G.EdgeColoring α :=
139147 C.comp f
140148
141149/-- Pre-compose an edge-coloring with a line-graph homomorphism induced by a copy. -/
150+ @[expose]
142151def EdgeColoring.ofCopy (f : Copy G G') (C : G'.EdgeColoring α) : G.EdgeColoring α :=
143152 C.ofLineGraphHom f.lineGraph.toHom
144153
145154variable (α) in
146155/-- Edge-colorings of graphs with isomorphic line-graphs are equivalent. -/
156+ @[expose]
147157def EdgeColoring.ofLineGraphIso (f : G.lineGraph ≃g G'.lineGraph) :
148158 G.EdgeColoring α ≃ G'.EdgeColoring α where
149159 toFun C := .ofLineGraphHom f.symm.toHom C
@@ -153,6 +163,7 @@ def EdgeColoring.ofLineGraphIso (f : G.lineGraph ≃g G'.lineGraph) :
153163
154164variable (α) in
155165/-- Edge-colorings of isomorphic graphs are equivalent. -/
166+ @[expose]
156167def EdgeColoring.ofIso (f : G ≃g G') : G.EdgeColoring α ≃ G'.EdgeColoring α :=
157168 EdgeColoring.ofLineGraphIso α f.lineGraph
158169
@@ -204,6 +215,7 @@ theorem Iso.chromaticIndex_eq (f : G ≃g G') : G.chromaticIndex = G'.chromaticI
204215 chromaticIndex_eq_of_lineGraph_iso f.lineGraph
205216
206217/-- Induce an edge-coloring of a subgraph from an edge-coloring of a graph. -/
218+ @[expose]
207219def EdgeColoring.ofIsSubgraph (hle : G ≤ H) (C : H.EdgeColoring α) : G.EdgeColoring α :=
208220 C.ofCopy <| .ofLE _ _ hle
209221
@@ -270,6 +282,7 @@ theorem two_le_chromaticIndex_of_adj {u v w : V} (huv : G.Adj u v) (huw : G.Adj
270282 @two_le_chromaticNumber_of_adj _ _ ⟨s(u, v), huv⟩ ⟨s(u, w), huw⟩ ⟨by grind, u, by simp⟩
271283
272284/-- The subgraph containing all the edges colored with the given color, and all their vertices. -/
285+ @[expose]
273286def EdgeColoring.colorClassSubgraph (C : G.EdgeColoring α) (a : α) : G.Subgraph where
274287 verts := {u | ∃ (v : V) (hadj : G.Adj u v), C ⟨s(u, v), hadj⟩ = a}
275288 Adj u v := ∃ (hadj : G.Adj u v), C ⟨s(u, v), hadj⟩ = a
0 commit comments