Skip to content

Commit 137f970

Browse files
committed
There are more labelled copies than copies
1 parent db15c29 commit 137f970

File tree

2 files changed

+48
-7
lines changed

2 files changed

+48
-7
lines changed

LeanCamCombi/Mathlib/Combinatorics/SimpleGraph/Copy.lean

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ equivalent to saying that there is a graph embedding `G ↪ H`.
4444
The 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

4953
open Finset Function
@@ -53,6 +57,34 @@ open scoped BigOperators Classical
5357
namespace SimpleGraph
5458
variable {α β γ : 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. -/
166198
noncomputable 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. -/
181213
lemma 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

188219
end 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
269300
we've removed is at most the number of copies of `G` in `H`. -/
270301
lemma 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

LeanCamCombi/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@ import Mathlib.Combinatorics.SimpleGraph.Subgraph
22

33
open Function
44

5-
variable {α β γ V : Type*} {G H : SimpleGraph V}
5+
variable {V W : Type*} {G H : SimpleGraph V}
66

77
namespace SimpleGraph
88

99
namespace Subgraph
1010

11+
@[simp] lemma map_equiv_top {H : SimpleGraph W} (e : G ≃g H) : Subgraph.map e.toHom ⊤ = ⊤ := by
12+
ext <;> simp [Relation.Map, e.apply_eq_iff_eq_symm_apply, ← e.map_rel_iff]
13+
14+
@[simp] lemma map_hom_top (G' : G.Subgraph) : Subgraph.map G'.hom ⊤ = G' := by
15+
ext <;> simp [Relation.Map]; exact fun h ↦ ⟨G'.edge_vert h, G'.edge_vert h.symm⟩
16+
17+
-- TODO: Replace
18+
alias hom_injective := hom.injective
19+
alias spanningHom_injective := spanningHom.injective
20+
1121
/-- The subgraph of `H` corresponding to a smaller graph `H`. -/
1222
@[simps]
1323
def ofLE (h : H ≤ G) : G.Subgraph where

0 commit comments

Comments
 (0)