Skip to content

Commit 1a1a4e8

Browse files
committed
style(Combinatorics/SimpleGraph): tidy two more namespace/order issues
* `InducedCopy.lean`: flatten the two-decl `namespace Copy` block around `Copy.toEmbeddingOfIsInduced` / `Copy.toEmbeddingOfIsInduced_apply` to prefixed names. Saves the `namespace`/`end` pair and one indentation level for two declarations. * `Copy.lean`: move `Copy.toSubgraph_comp` up to sit between `toSubgraph_adj_iff` and `mem_range_of_toSubgraph_eq`. The new order is basic-to-complex: toSubgraph (def) → isoToSubgraph / range_toSubgraph / toSubgraph_surjOn (existing image API) → verts_toSubgraph / toSubgraph_adj_iff / toSubgraph_comp (basic "shape" facts) → mem_range_of_toSubgraph_eq / equivOfToSubgraphEq / _apply (multi-copy facts using classical choice). `toSubgraph_comp` is a one-line functoriality fact; pairing it with `verts_*` and `*_adj_iff` rather than burying it after the equivOfToSubgraphEq classical-choice scaffolding mirrors the order already used on the Embedding side in `InducedCopy.lean`.
1 parent 0f5e45f commit 1a1a4e8

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Copy.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ lemma toSubgraph_surjOn :
208208
rintro ⟨c, d, hcd, hc, hd⟩
209209
rwa [f.injective hc, f.injective hd] at hcd
210210

211+
/-- Functoriality of `Copy.toSubgraph`: composing two copies and taking the image subgraph is the
212+
same as taking the image subgraph of the inner copy and mapping it through the outer. -/
213+
@[simp] lemma toSubgraph_comp (g : Copy H I) (f : Copy G H) :
214+
(g.comp f).toSubgraph = f.toSubgraph.map g.toHom := by
215+
simp [toSubgraph, Subgraph.map_comp]
216+
211217
lemma mem_range_of_toSubgraph_eq {f f' : Copy G H} (h : f.toSubgraph = f'.toSubgraph) (v : V) :
212218
f v ∈ Set.range (f' : V → W) := by
213219
rw [← f'.verts_toSubgraph, ← congrArg Subgraph.verts h, f.verts_toSubgraph]
@@ -233,12 +239,6 @@ noncomputable def equivOfToSubgraphEq {f f' : Copy G H} (h : f.toSubgraph = f'.t
233239
(v : V) : f' (equivOfToSubgraphEq h v) = f v :=
234240
(mem_range_of_toSubgraph_eq h v).choose_spec
235241

236-
/-- Functoriality of `Copy.toSubgraph`: composing two copies and taking the image subgraph is the
237-
same as taking the image subgraph of the inner copy and mapping it through the outer. -/
238-
@[simp] lemma toSubgraph_comp (g : Copy H I) (f : Copy G H) :
239-
(g.comp f).toSubgraph = f.toSubgraph.map g.toHom := by
240-
simp [toSubgraph, Subgraph.map_comp]
241-
242242
instance [Subsingleton (V → W)] : Subsingleton (G.Copy H) := DFunLike.coe_injective.subsingleton
243243

244244
instance [Fintype {f : G →g H // Injective f}] : Fintype (G.Copy H) :=

Mathlib/Combinatorics/SimpleGraph/InducedCopy.lean

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,9 @@ end Embedding
122122

123123
/-! ### Promoting a copy with induced image to an embedding -/
124124

125-
namespace Copy
126-
127125
/-- A copy whose image subgraph is induced canonically promotes to an embedding,
128126
providing the converse direction to `Embedding.toSubgraph` / `Embedding.toSubgraph_isInduced`. -/
129-
@[expose] def toEmbeddingOfIsInduced (f : Copy G H) (hInd : f.toSubgraph.IsInduced) :
127+
@[expose] def Copy.toEmbeddingOfIsInduced (f : Copy G H) (hInd : f.toSubgraph.IsInduced) :
130128
Embedding G H where
131129
toFun := f
132130
inj' := f.injective
@@ -136,11 +134,9 @@ providing the converse direction to `Embedding.toSubgraph` / `Embedding.toSubgra
136134
(f.verts_toSubgraph ▸ Set.mem_range_self b) hAdj,
137135
fun hAdj ↦ f.toHom.map_adj hAdj⟩
138136

139-
@[simp] lemma toEmbeddingOfIsInduced_apply (f : Copy G H) (hInd : f.toSubgraph.IsInduced)
137+
@[simp] lemma Copy.toEmbeddingOfIsInduced_apply (f : Copy G H) (hInd : f.toSubgraph.IsInduced)
140138
(v : V) : f.toEmbeddingOfIsInduced hInd v = f v := rfl
141139

142-
end Copy
143-
144140
/-!
145141
### Induced containment
146142

0 commit comments

Comments
 (0)