Skip to content

Commit db15c29

Browse files
committed
Bump mathlib
1 parent 11bed57 commit db15c29

File tree

4 files changed

+9
-192
lines changed

4 files changed

+9
-192
lines changed

LeanCamCombi.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import LeanCamCombi.ExtrProbCombi.BernoulliSeq
22
import LeanCamCombi.ExtrProbCombi.BinomialRandomGraph
33
import LeanCamCombi.ExtrProbCombi.BollobasContainment
44
import LeanCamCombi.ExtrProbCombi.Connectivity
5-
import LeanCamCombi.ExtrProbCombi.Containment
65
import LeanCamCombi.ExtrProbCombi.GiantComponent
76
import LeanCamCombi.GraphTheory.ExampleSheet1
87
import LeanCamCombi.GraphTheory.ExampleSheet2
@@ -12,6 +11,7 @@ import LeanCamCombi.GrowthInGroups.Lecture3
1211
import LeanCamCombi.GrowthInGroups.Lecture4
1312
import LeanCamCombi.Mathlib.Combinatorics.Additive.ApproximateSubgroup
1413
import LeanCamCombi.Mathlib.Combinatorics.SetFamily.LYM
14+
import LeanCamCombi.Mathlib.Combinatorics.SimpleGraph.Copy
1515
import LeanCamCombi.Mathlib.Combinatorics.SimpleGraph.Density
1616
import LeanCamCombi.Mathlib.Combinatorics.SimpleGraph.Subgraph
1717
import LeanCamCombi.Mathlib.Probability.ProbabilityMassFunction.Constructions

LeanCamCombi/ExtrProbCombi/BollobasContainment.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Mathlib.Analysis.SpecialFunctions.Pow.Real
77
import Mathlib.MeasureTheory.Measure.Typeclasses
88
import LeanCamCombi.Mathlib.Combinatorics.SimpleGraph.Density
99
import LeanCamCombi.ExtrProbCombi.BinomialRandomGraph
10-
import LeanCamCombi.ExtrProbCombi.Containment
10+
import LeanCamCombi.Mathlib.Combinatorics.SimpleGraph.Copy
1111

1212
/-!
1313
# Bollobás' graph containment lemma

LeanCamCombi/ExtrProbCombi/Containment.lean renamed to LeanCamCombi/Mathlib/Combinatorics/SimpleGraph/Copy.lean

Lines changed: 5 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Copyright (c) 2023 Yaël Dillies. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yaël Dillies
55
-/
6+
import Mathlib.Combinatorics.SimpleGraph.Copy
67
import LeanCamCombi.Mathlib.Combinatorics.SimpleGraph.Subgraph
78

89
/-!
@@ -50,191 +51,6 @@ open Fintype (card)
5051
open scoped BigOperators Classical
5152

5253
namespace SimpleGraph
53-
54-
variable {V α β γ : Type*} {G G₁ G₂ G₃ : SimpleGraph V}
55-
{A : SimpleGraph α} {B : SimpleGraph β} {C : SimpleGraph γ}
56-
57-
section Copy
58-
59-
/-- The type of copies as a subtype of *injective* homomorphisms. -/
60-
abbrev Copy (A : SimpleGraph α) (B : SimpleGraph β) :=
61-
{ f : A →g B // Function.Injective f }
62-
63-
/-- An injective homomorphism gives rise to a copy. -/
64-
abbrev Hom.toCopy (f : A →g B) (h : Function.Injective f) : Copy A B := ⟨f, h⟩
65-
66-
/-- An embedding gives rise to a copy. -/
67-
abbrev Embedding.toCopy (f : A ↪g B) : Copy A B := f.toHom.toCopy f.injective
68-
69-
/-- An isomorphism gives rise to a copy. -/
70-
abbrev Iso.toCopy (f : A ≃g B) : Copy A B := f.toEmbedding.toCopy
71-
72-
namespace Copy
73-
74-
/-- A copy gives rise to a homomorphism. -/
75-
abbrev toHom : Copy A B → A →g B := Subtype.val
76-
77-
@[simp] lemma coe_toHom (f : Copy A B) : ⇑f.toHom = f := rfl
78-
79-
lemma injective : (f : Copy A B) → (Function.Injective f.toHom) := Subtype.prop
80-
81-
instance : FunLike (Copy A B) α β where
82-
coe f := DFunLike.coe f.toHom
83-
coe_injective' _ _ h := Subtype.val_injective (DFunLike.coe_injective h)
84-
85-
@[simp] lemma coe_toHom_apply (f : Copy A B) (a : α) : ⇑f.toHom a = f a := rfl
86-
87-
/-- A copy induces an embedding of edge sets. -/
88-
def mapEdgeSet (f : Copy A B) : A.edgeSet ↪ B.edgeSet where
89-
toFun := Hom.mapEdgeSet f.toHom
90-
inj' := Hom.mapEdgeSet.injective f.toHom f.injective
91-
92-
/-- A copy induces an embedding of neighbor sets. -/
93-
def mapNeighborSet (f : Copy A B) (a : α) :
94-
A.neighborSet a ↪ B.neighborSet (f a) where
95-
toFun v := ⟨f v, f.toHom.apply_mem_neighborSet v.prop⟩
96-
inj' _ _ h := by
97-
rw [Subtype.mk_eq_mk] at h ⊢
98-
exact f.injective h
99-
100-
/-- A copy gives rise to an embedding of vertex types. -/
101-
def toEmbedding (f : Copy A B) : α ↪ β := ⟨f, f.injective⟩
102-
103-
/-- The identity copy from a simple graph to itself. -/
104-
@[refl] def id (G : SimpleGraph V) : Copy G G := ⟨Hom.id, Function.injective_id⟩
105-
106-
@[simp, norm_cast] lemma coe_id : ⇑(id G) = _root_.id := rfl
107-
108-
/-- The composition of copies is a copy. -/
109-
def comp (g : Copy B C) (f : Copy A B) : Copy A C := by
110-
use g.toHom.comp f.toHom
111-
rw [Hom.coe_comp]
112-
exact Function.Injective.comp g.injective f.injective
113-
114-
@[simp]
115-
theorem comp_apply (g : Copy B C) (f : Copy A B) (a : α) : g.comp f a = g (f a) :=
116-
RelHom.comp_apply g.toHom f.toHom a
117-
118-
/-- The copy from a subgraph to the supergraph. -/
119-
def ofLE (G₁ G₂ : SimpleGraph V) (h : G₁ ≤ G₂) : Copy G₁ G₂ := ⟨Hom.ofLE h, Function.injective_id⟩
120-
121-
@[simp, norm_cast]
122-
theorem coe_comp (g : Copy B C) (f : Copy A B) : ⇑(g.comp f) = g ∘ f := by ext; simp
123-
124-
@[simp, norm_cast] lemma coe_ofLE (h : G₁ ≤ G₂) : ⇑(ofLE G₁ G₂ h) = _root_.id := rfl
125-
126-
@[simp] theorem ofLE_refl : ofLE G G (le_refl G) = id G := by ext; simp
127-
128-
@[simp]
129-
theorem ofLE_comp (h₁₂ : G₁ ≤ G₂) (h₂₃ : G₂ ≤ G₃) :
130-
(ofLE _ _ h₂₃).comp (ofLE _ _ h₁₂) = ofLE _ _ (h₁₂.trans h₂₃) := by ext; simp
131-
132-
/-- The copy from an induced subgraph to the initial simple graph. -/
133-
def induce (G : SimpleGraph V) (s : Set V) : Copy (G.induce s) G :=
134-
(Embedding.induce s).toCopy
135-
136-
end Copy
137-
138-
/-- A `Subgraph G` gives rise to a copy from the coercion to `G`. -/
139-
def Subgraph.coeCopy (G' : G.Subgraph) : Copy G'.coe G :=
140-
G'.hom.toCopy Subgraph.hom.injective
141-
142-
end Copy
143-
144-
section IsContained
145-
146-
/-- The relation `IsContained A B`, `A ⊑ B` says that `B` contains a copy of `A`.
147-
148-
This is equivalent to the existence of an isomorphism from `A` to a subgraph of `B`. -/
149-
abbrev IsContained (A : SimpleGraph α) (B : SimpleGraph β) := Nonempty (Copy A B)
150-
151-
@[inherit_doc] scoped infixl:50 " ⊑ " => SimpleGraph.IsContained
152-
153-
/-- A simple graph contains itself. -/
154-
@[refl] protected theorem IsContained.refl (G : SimpleGraph V) : G ⊑ G := ⟨.id G⟩
155-
156-
protected theorem IsContained.rfl : G ⊑ G := IsContained.refl G
157-
158-
/-- A simple graph contains its subgraphs. -/
159-
theorem isContained_of_le (h : G₁ ≤ G₂) : G₁ ⊑ G₂ := ⟨Copy.ofLE G₁ G₂ h⟩
160-
161-
/-- If `A` contains `B` and `B` contains `C`, then `A` contains `C`. -/
162-
theorem IsContained.trans : A ⊑ B → B ⊑ C → A ⊑ C := fun ⟨f⟩ ⟨g⟩ ↦ ⟨g.comp f⟩
163-
164-
/-- If `B` contains `C` and `A` contains `B`, then `A` contains `C`. -/
165-
theorem IsContained.trans' : B ⊑ C → A ⊑ B → A ⊑ C := flip IsContained.trans
166-
167-
lemma IsContained.mono_right {B' : SimpleGraph β} (h_isub : A ⊑ B) (h_sub : B ≤ B') : A ⊑ B' :=
168-
h_isub.trans <| isContained_of_le h_sub
169-
170-
alias IsContained.trans_le := IsContained.mono_right
171-
172-
lemma IsContained.mono_left {A' : SimpleGraph α} (h_sub : A ≤ A') (h_isub : A' ⊑ B) : A ⊑ B :=
173-
(isContained_of_le h_sub).trans h_isub
174-
175-
alias IsContained.trans_le' := IsContained.mono_left
176-
177-
/-- If `A ≃g B`, then `A` is contained in `C` if and only if `B` is contained in `C`. -/
178-
theorem isContained_congr (e : A ≃g B) : A ⊑ C ↔ B ⊑ C :=
179-
⟨.trans ⟨e.symm.toCopy⟩, .trans ⟨e.toCopy⟩⟩
180-
181-
/-- A simple graph having no vertices is contained in any simple graph. -/
182-
lemma IsContained.of_isEmpty [IsEmpty α] : A ⊑ B :=
183-
⟨⟨isEmptyElim, fun {a} ↦ isEmptyElim a⟩, isEmptyElim⟩
184-
185-
/-- A simple graph having no edges is contained in any simple graph having sufficent vertices. -/
186-
theorem isContained_of_isEmpty_edgeSet [IsEmpty A.edgeSet] [Fintype α] [Fintype β]
187-
(h : card α ≤ card β) : A ⊑ B := by
188-
haveI := Function.Embedding.nonempty_of_card_le h
189-
let ι : α ↪ β := Classical.arbitrary (α ↪ β)
190-
exact ⟨⟨ι, isEmptyElim ∘ fun hadj ↦ (⟨s(_, _), hadj⟩ : A.edgeSet)⟩, ι.injective⟩
191-
192-
lemma bot_isContained (f : α ↪ β) : (⊥ : SimpleGraph α) ⊑ B := ⟨⟨f, False.elim⟩, f.injective⟩
193-
194-
protected alias IsContained.bot := bot_isContained
195-
196-
/-- A simple graph `G` contains all `Subgraph G` coercions. -/
197-
lemma Subgraph.coe_isContained (G' : G.Subgraph) : G'.coe ⊑ G := ⟨G'.coeCopy⟩
198-
199-
/-- The isomorphism from `Subgraph A` to its map under a copy `Copy A B`. -/
200-
noncomputable def Subgraph.isoMap (f : Copy A B) (A' : A.Subgraph) :
201-
A'.coe ≃g (A'.map f.toHom).coe := by
202-
use Equiv.Set.image f.toHom _ f.injective
203-
simp_rw [map_verts, Equiv.Set.image_apply, coe_adj, map_adj, Relation.map_apply,
204-
Function.Injective.eq_iff f.injective, exists_eq_right_right, exists_eq_right, forall_true_iff]
205-
206-
/-- `B` contains `A` if and only if `B` has a subgraph `B'` and `B'` is isomorphic to `A`. -/
207-
theorem isContained_iff_exists_iso_subgraph :
208-
A ⊑ B ↔ ∃ B' : B.Subgraph, Nonempty (A ≃g B'.coe) :=
209-
fun ⟨f⟩ ↦ ⟨Subgraph.map f.toHom ⊤, ⟨(Subgraph.isoMap f ⊤).comp Subgraph.topIso.symm⟩⟩,
210-
fun ⟨B', ⟨e⟩⟩ ↦ B'.coe_isContained.trans' ⟨e.toCopy⟩⟩
211-
212-
alias ⟨IsContained.exists_iso_subgraph, IsContained.of_exists_iso_subgraph⟩ :=
213-
isContained_iff_exists_iso_subgraph
214-
215-
end IsContained
216-
217-
section Free
218-
219-
/-- The proposition that a simple graph does not contain a copy of another simple graph. -/
220-
abbrev Free (A : SimpleGraph α) (B : SimpleGraph β) := ¬A ⊑ B
221-
222-
lemma not_free : ¬A.Free B ↔ A ⊑ B := not_not
223-
224-
/-- If `A ≃g B`, then `C` is `A`-free if and only if `C` is `B`-free. -/
225-
theorem free_congr (e : A ≃g B) : A.Free C ↔ B.Free C := by
226-
rw [not_iff_not]
227-
exact isContained_congr e
228-
229-
lemma free_bot (h : A ≠ ⊥) : A.Free (⊥ : SimpleGraph β) := by
230-
rw [← edgeSet_nonempty] at h
231-
intro ⟨f, hf⟩
232-
absurd f.map_mem_edgeSet h.choose_spec
233-
rw [edgeSet_bot]
234-
exact Set.not_mem_empty (h.choose.map f)
235-
236-
end Free
237-
23854
variable {α β γ : Type*} {G G₁ G₂ G₃ : SimpleGraph α} {H : SimpleGraph β} {I : SimpleGraph γ}
23955

24056
/-!
@@ -276,7 +92,7 @@ lemma isIndContained_iff_exists_iso_subgraph :
27692
constructor
27793
· rintro ⟨f⟩
27894
refine ⟨Subgraph.map f.toHom ⊤,
279-
(Subgraph.isoMap ⟨f.toHom, f.injective⟩ _).comp Subgraph.topIso.symm, ?_⟩
95+
(Subgraph.Copy.map ⟨f.toHom, f.injective⟩ _).comp Subgraph.topIso.symm, ?_⟩
28096
rintro _ _ ⟨a, -, rfl⟩ ⟨b, -, rfl⟩
28197
simp [Relation.map_apply_apply, f.injective]
28298
· rintro ⟨H', e, hH'⟩
@@ -432,13 +248,14 @@ lemma not_isContained_kill (hG : G ≠ ⊥) : ¬ G ⊑ G.kill H := by
432248
rw [← Subgraph.image_coe_edgeSet_coe] at this
433249
subst he
434250
obtain ⟨e, he₀, he₁⟩ := this
435-
let e' : Sym2 H'.verts := Sym2.map (Subgraph.isoMap (.ofLE _ _ _) _).symm e
251+
let e' : Sym2 H'.verts := Sym2.map (Subgraph.Copy.map (.ofLE _ _ _) _).symm e
436252
have he' : e' ∈ H'.coe.edgeSet := (Iso.map_mem_edgeSet_iff _).2 he₀
437253
rw [Subgraph.edgeSet_coe] at he'
438254
have := Subgraph.edgeSet_subset _ he'
439255
simp only [edgeSet_sdiff, edgeSet_fromEdgeSet, edgeSet_sdiff_sdiff_isDiag, Set.mem_diff,
440256
Set.mem_iUnion, not_exists] at this
441-
refine this.2 (H'.map <| Hom.ofLE sdiff_le) ⟨(Subgraph.isoMap (.ofLE _ _ _) _).comp hGH'.some⟩ ?_
257+
refine this.2 (H'.map <| Hom.ofLE sdiff_le)
258+
⟨(Subgraph.Copy.map (.ofLE _ _ _) _).comp hGH'.some⟩ ?_
442259
rw [Sym2.map_map, Set.mem_singleton_iff, ← he₁]
443260
congr 1 with x
444261
exact congr_arg _ (Equiv.Set.image_symm_apply _ _ injective_id _ _)

lake-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "git",
66
"subDir": null,
77
"scope": "",
8-
"rev": "121c5ee484dca93920cce42c304e81528af30d21",
8+
"rev": "3543cd86729039b24e8ac9551a954830f1b28053",
99
"name": "mathlib",
1010
"manifestFile": "lake-manifest.json",
1111
"inputRev": null,
@@ -75,7 +75,7 @@
7575
"type": "git",
7676
"subDir": null,
7777
"scope": "leanprover-community",
78-
"rev": "f2fb9809751c4646c68c329b14f7d229a93176fd",
78+
"rev": "5105c4f21aae2d8dc15b4568951810140e6027cd",
7979
"name": "batteries",
8080
"manifestFile": "lake-manifest.json",
8181
"inputRev": "main",

0 commit comments

Comments
 (0)