Skip to content

Commit 63c61b8

Browse files
committed
Address review comments from YaelDillies
- Rename `Embedding.comp_toHom` → `Embedding.toHom_comp` (Maps.lean) - Add `protected` to `IsInduced.map` (Subgraph.lean) - Rename `IsInduced.toEmbedding` → `Embedding.ofIsInduced`, move outside `Subgraph` namespace so it lives in `SimpleGraph.Embedding` (Subgraph.lean) - Drop redundant `simp only [indLabelledCopyCount, labelledCopyCount]` (Copy.lean) - Style: `¬(H ⊴ G)` → `¬ H ⊴ G` (Copy.lean) - Golf `indCopyCount_le_copyCount` with `grind` (Copy.lean)
1 parent 578c033 commit 63c61b8

3 files changed

Lines changed: 18 additions & 17 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Copy.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ lemma range_embeddingToSubgraph :
201201
· rintro ⟨f, rfl⟩
202202
exact ⟨Subgraph.IsInduced.top.map f, ⟨f.toCopy.isoToSubgraph⟩⟩
203203
· rintro ⟨hInd, ⟨e⟩⟩
204-
exact ⟨hInd.toEmbedding.comp e.toEmbedding, by simp [toSubgraph, Subgraph.map_comp]⟩
204+
exact ⟨(Embedding.ofIsInduced _ hInd).comp e.toEmbedding,
205+
by simp [toSubgraph, Subgraph.map_comp]⟩
205206

206207
lemma toSubgraph_surjOn :
207208
Set.SurjOn (toSubgraph (A := A)) .univ {B' : B.Subgraph | Nonempty (A ≃g B'.coe)} :=
@@ -427,7 +428,7 @@ protected lemma Iso.isIndContained' (e : G ≃g H) : H ⊴ G := e.symm.isIndCont
427428

428429
protected lemma Subgraph.IsInduced.isIndContained {G' : G.Subgraph} (hG' : G'.IsInduced) :
429430
G'.coe ⊴ G :=
430-
⟨hG'.toEmbedding
431+
Embedding.ofIsInduced _ hG'⟩
431432

432433
@[refl] lemma IsIndContained.refl (G : SimpleGraph V) : G ⊴ G := ⟨Embedding.refl⟩
433434
lemma IsIndContained.rfl : G ⊴ G := .refl _
@@ -575,7 +576,7 @@ noncomputable def indLabelledCopyCount (G : SimpleGraph V) (H : SimpleGraph W) :
575576
exact { default := RelEmbedding.ofIsEmpty H.Adj G.Adj
576577
uniq := fun f => RelEmbedding.ext fun a => isEmptyElim a }
577578

578-
@[simp] lemma indLabelledCopyCount_eq_zero : G.indLabelledCopyCount H = 0 ↔ ¬(H ⊴ G) := by
579+
@[simp] lemma indLabelledCopyCount_eq_zero : G.indLabelledCopyCount H = 0 ↔ ¬ H ⊴ G := by
579580
simp [indLabelledCopyCount, Fintype.card_eq_zero_iff, IsIndContained]
580581

581582
@[simp] lemma indLabelledCopyCount_pos : 0 < G.indLabelledCopyCount H ↔ H ⊴ G := by
@@ -585,7 +586,6 @@ noncomputable def indLabelledCopyCount (G : SimpleGraph V) (H : SimpleGraph W) :
585586
lemma indLabelledCopyCount_le_labelledCopyCount :
586587
G.indLabelledCopyCount H ≤ G.labelledCopyCount H := by
587588
classical
588-
simp only [indLabelledCopyCount, labelledCopyCount]
589589
exact Fintype.card_le_of_injective Embedding.toCopy fun f g h =>
590590
RelEmbedding.ext fun w => DFunLike.congr_fun h w
591591

@@ -616,7 +616,7 @@ lemma indCopyCount_eq_card_image_embeddingToSubgraph
616616
exact ⟨fun ⟨G', hInd, hn⟩ => ⟨G', hn.some, hInd⟩,
617617
fun ⟨G', e, hInd⟩ => ⟨G', hInd, ⟨e⟩⟩⟩
618618

619-
@[simp] lemma indCopyCount_eq_zero : G.indCopyCount H = 0 ↔ ¬(H ⊴ G) := by
619+
@[simp] lemma indCopyCount_eq_zero : G.indCopyCount H = 0 ↔ ¬ H ⊴ G := by
620620
rw [← indCopyCount_pos]; omega
621621

622622
/-- Every induced unlabelled copy corresponds to at least one induced labelled copy. -/
@@ -638,7 +638,7 @@ lemma indCopyCount_le_copyCount : G.indCopyCount H ≤ G.copyCount H := by
638638
classical
639639
simp only [indCopyCount, copyCount]
640640
exact Finset.card_le_card fun G' hG' => by
641-
simp only [mem_filter, mem_univ, true_and] at hG' ⊢; exact hG'.2
641+
simp only [mem_filter, mem_univ, true_and] at hG'; grind
642642

643643
end IndCopyCount
644644

Mathlib/Combinatorics/SimpleGraph/Maps.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ abbrev comp (f' : G' ↪g G'') (f : G ↪g G') : G ↪g G'' :=
529529
theorem coe_comp (f' : G' ↪g G'') (f : G ↪g G') : ⇑(f'.comp f) = f' ∘ f :=
530530
rfl
531531

532-
@[simp] lemma comp_toHom (f' : G' ↪g G'') (f : G ↪g G') :
532+
@[simp] lemma toHom_comp (f' : G' ↪g G'') (f : G ↪g G') :
533533
(f'.comp f).toHom = f'.toHom.comp f.toHom := rfl
534534

535535
/-- Graph embeddings from `G` to `H` are the same thing as graph embeddings from `Gᶜ` to `Hᶜ`. -/

Mathlib/Combinatorics/SimpleGraph/Subgraph.lean

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ theorem map_sup (f : G →g G') (H₁ H₂ : G.Subgraph) : (H₁ ⊔ H₂).map f
669669
@[simp] lemma edgeSet_map (f : G →g G') (H : G.Subgraph) :
670670
(H.map f).edgeSet = Sym2.map f '' H.edgeSet := Sym2.fromRel_relationMap ..
671671

672-
lemma IsInduced.map {H : G.Subgraph} (hH : H.IsInduced) (e : G ↪g G') :
672+
protected lemma IsInduced.map {H : G.Subgraph} (hH : H.IsInduced) (e : G ↪g G') :
673673
(H.map e.toHom).IsInduced := by
674674
intro v hv w hw hAdj
675675
rw [map_verts] at hv hw
@@ -756,15 +756,6 @@ theorem hom_injective {x : Subgraph G} : Function.Injective x.hom :=
756756
@[simp] lemma map_hom_top (G' : G.Subgraph) : Subgraph.map G'.hom ⊤ = G' := by
757757
aesop (add unfold safe Relation.Map, unsafe G'.edge_vert, unsafe Adj.symm)
758758

759-
/-- The canonical embedding of an induced subgraph into the ambient graph.
760-
Unlike `Subgraph.hom`, this is an embedding rather than a homomorphism, since induced subgraphs
761-
reflect adjacency. -/
762-
def IsInduced.toEmbedding {G' : G.Subgraph} (hG' : G'.IsInduced) : G'.coe ↪g G :=
763-
{ toFun := (↑), inj' := Subtype.coe_injective, map_rel_iff' := hG'.adj.symm }
764-
765-
@[simp] lemma IsInduced.toHom_toEmbedding {G' : G.Subgraph} (hG' : G'.IsInduced) :
766-
hG'.toEmbedding.toHom = G'.hom := rfl
767-
768759
/-- There is an induced injective homomorphism of a subgraph of `G` as
769760
a spanning subgraph into `G`. -/
770761
@[simps]
@@ -886,6 +877,16 @@ lemma adj_iff_of_neighborSet_equiv {v : V} {H : Subgraph G}
886877

887878
end Subgraph
888879

880+
/-- The canonical embedding of an induced subgraph into the ambient graph.
881+
Unlike `Subgraph.hom`, this is an embedding rather than a homomorphism, since induced subgraphs
882+
reflect adjacency. -/
883+
def Embedding.ofIsInduced {G : SimpleGraph V} (G' : G.Subgraph) (hG' : G'.IsInduced) :
884+
G'.coe ↪g G :=
885+
{ toFun := (↑), inj' := Subtype.coe_injective, map_rel_iff' := hG'.adj.symm }
886+
887+
@[simp] lemma Embedding.toHom_ofIsInduced {G : SimpleGraph V} (G' : G.Subgraph)
888+
(hG' : G'.IsInduced) : (Embedding.ofIsInduced G' hG').toHom = G'.hom := rfl
889+
889890
@[simp]
890891
theorem card_neighborSet_toSubgraph (G H : SimpleGraph V) (h : H ≤ G)
891892
(v : V) [Fintype ↑((toSubgraph H h).neighborSet v)] [Fintype ↑(H.neighborSet v)] :

0 commit comments

Comments
 (0)