Skip to content

Commit b970fec

Browse files
committed
granular @[expose]
1 parent 4f24d12 commit b970fec

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • Mathlib/Combinatorics/SimpleGraph/Coloring

Mathlib/Combinatorics/SimpleGraph/Coloring/Edge.lean

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

4343
namespace SimpleGraph
4444

@@ -58,23 +58,27 @@ instance : Coe (G.EdgeColoring α) (G.EdgeLabeling α) where
5858

5959
variable (G) in
6060
/-- Whether a graph can be edge-colored using colors from `α`. -/
61+
@[expose]
6162
def EdgeColorableWith (α : Type*) : Prop :=
6263
Nonempty <| G.EdgeColoring α
6364

6465
variable (G n) in
6566
/-- Whether a graph can be edge-colored by at most `n` colors. -/
67+
@[expose]
6668
def EdgeColorable : Prop :=
6769
G.EdgeColorableWith <| Fin n
6870

6971
variable (G) in
7072
/-- The chromatic index of a graph is the minimal number of colors needed to color its edges.
7173
This is `⊤` (infinity) iff `G` isn't edge-colorable with finitely many colors.
7274
If `G` is edge-colorable, then `G.chromaticIndex.toNat` is the `ℕ`-valued chromatic number. -/
75+
@[expose]
7376
noncomputable def chromaticIndex : ℕ∞ :=
7477
⨅ n, ⨅ _ : G.EdgeColorable n, (n : ℕ∞)
7578

7679
variable (α) in
7780
/-- The unique coloring of the empty graph. -/
81+
@[expose]
7882
def 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]
110115
def 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]
114120
def 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]
126133
def 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]
137145
def 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]
142151
def EdgeColoring.ofCopy (f : Copy G G') (C : G'.EdgeColoring α) : G.EdgeColoring α :=
143152
C.ofLineGraphHom f.lineGraph.toHom
144153

145154
variable (α) in
146155
/-- Edge-colorings of graphs with isomorphic line-graphs are equivalent. -/
156+
@[expose]
147157
def 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

154164
variable (α) in
155165
/-- Edge-colorings of isomorphic graphs are equivalent. -/
166+
@[expose]
156167
def 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]
207219
def 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]
273286
def 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

Comments
 (0)