@@ -44,6 +44,10 @@ equivalent to saying that there is a graph embedding `G ↪ H`.
4444The following notation is declared in locale `SimpleGraph`:
4545* `G ⊑ H` for `SimpleGraph.is_contained G H`.
4646* `G ⊴ H` for `SimpleGraph.isIndContained G H`.
47+
48+ ## TODO
49+
50+ Fix `coe_toHom_apply`
4751-/
4852
4953open Finset Function
@@ -53,6 +57,34 @@ open scoped BigOperators Classical
5357namespace SimpleGraph
5458variable {α β γ : Type *} {G G₁ G₂ G₃ : SimpleGraph α} {H : SimpleGraph β} {I : SimpleGraph γ}
5559
60+ namespace Copy
61+
62+ /-- The subgraph of `H` corresponding to a copy of `G` inside `H`. -/
63+ abbrev toSubgraph (f : Copy G H) : H.Subgraph := .map f.toHom ⊤
64+
65+ @[simp] lemma toHom_mk (f : G →g H) (hf) : toHom ⟨f, hf⟩ = f := rfl
66+
67+ @[simp] lemma range_toSubgraph :
68+ .range (toSubgraph (G := G)) = {H' : H.Subgraph | Nonempty (G ≃g H'.coe)} := by
69+ ext H'
70+ simp [-Subtype.exists]
71+ constructor
72+ · rintro ⟨f, hf, rfl⟩
73+ simpa [toSubgraph] using ⟨(Subgraph.Copy.map f ⊤).comp Subgraph.topIso.symm⟩
74+ · rintro ⟨e⟩
75+ refine ⟨⟨H'.hom.comp e.toHom, Subgraph.hom_injective.comp e.injective⟩, ?_⟩
76+ simp [toSubgraph, Subgraph.map_comp]
77+
78+ lemma toSubgraph_surjOn :
79+ Set.SurjOn (toSubgraph (G := G)) .univ {H' : H.Subgraph | Nonempty (G ≃g H'.coe)} :=
80+ fun H' hH' ↦ by simpa
81+
82+ alias toHom_apply := coe_toHom_apply
83+
84+ @[simp] lemma coe_mk (f : G →g H) (hf) : ⇑(.mk f hf : Copy G H) = f := rfl
85+
86+ end Copy
87+
5688/-!
5789### Induced containment
5890
@@ -164,7 +196,7 @@ variable [Fintype α] [Fintype β]
164196/-- `G.labelledCopyCount H` is the number of labelled copies of `G` in `H`. See
165197`SimpleGraph.copyCount` for the number of unlabelled copies. -/
166198noncomputable def labelledCopyCount (G : SimpleGraph α) (H : SimpleGraph β) : ℕ := by
167- classical exact Fintype.card {f : G →g H // Injective f}
199+ classical exact Fintype.card (Copy G H)
168200
169201@[simp] lemma labelledCopyCount_of_isEmpty [IsEmpty α] (G : SimpleGraph α) (H : SimpleGraph β) :
170202 G.labelledCopyCount H = 1 := by
@@ -180,10 +212,9 @@ noncomputable def labelledCopyCount (G : SimpleGraph α) (H : SimpleGraph β) :
180212/-- There's more labelled copies of `H` of-`G` than unlabelled ones. -/
181213lemma copyCount_le_labelledCopyCount : G.copyCount H ≤ G.labelledCopyCount H := by
182214 rw [copyCount, ← Fintype.card_coe]
183- refine Fintype.card_le_of_injective (fun H' ↦
184- ⟨H'.val.hom.comp (mem_filter.1 H'.2 ).2 .some.toHom,
185- Subtype.coe_injective.comp (mem_filter.1 H'.2 ).2 .some.injective⟩) ?_
186- sorry
215+ refine Fintype.card_le_of_surjective (fun f ↦ ⟨f.toSubgraph, ?_⟩) ?_
216+ · simpa using ⟨(Subgraph.Copy.map f ⊤).comp Subgraph.topIso.symm⟩
217+ · simpa [Surjective, -Copy.range_toSubgraph] using fun H' e ↦ Copy.toSubgraph_surjOn ⟨e⟩
187218
188219end LabelledCopyCount
189220
@@ -268,7 +299,7 @@ noncomputable instance kill.EdgeSet.fintype : Fintype (G.kill H).edgeSet :=
268299/-- Removing an edge from `H` for each subgraph isomorphic to `G` means that the number of edges
269300we've removed is at most the number of copies of `G` in `H`. -/
270301lemma le_card_edgeFinset_kill [Fintype β] :
271- #H.edgeFinset - G.copyCount H ≤ (G.kill H).edgeFinset.card := by
302+ #H.edgeFinset - G.copyCount H ≤ # (G.kill H).edgeFinset := by
272303 obtain rfl | hG := eq_or_ne G ⊥
273304 · simp
274305 let f (H' : {H' : H.Subgraph // Nonempty (G ≃g H'.coe)}) := (aux hG H'.2 ).some
0 commit comments