-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(Combinatorics/SimpleGraph/Bipartite): upper bound on the number of edges of a bipartite graph #34315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(Combinatorics/SimpleGraph/Bipartite): upper bound on the number of edges of a bipartite graph #34315
Changes from 8 commits
7d79324
3738639
cf43a39
58c5b43
19acaef
4e9de3c
1c28de1
71b3a90
28b15c3
8b8497a
5f16c48
fe4b98e
597410d
217b66d
5bba909
9771749
a3b60da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -445,4 +445,82 @@ theorem degree_le_between_add_compl (hw : w ∈ sᶜ) : | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| end Between | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| section | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| variable {W₁ W₂ : Type*} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| theorem Sym2.eq_out (v : Sym2 V) : v = s(v.out.1, v.out.2) := Sym2.ext (by simp) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| theorem edgeSet_eq : G.edgeSet = { x | ∃ v w : V, x = s(v, w) ∧ G.Adj v w } := by | ||||||||||||||||||||||||
| refine Set.ext fun x ↦ ⟨fun h ↦ ?_, by grind [mem_edgeSet]⟩ | ||||||||||||||||||||||||
| exact ⟨x.out.1, x.out.2, by simp [G.mem_edgeSet.mp <| Sym2.eq_out x ▸ h]⟩ | ||||||||||||||||||||||||
LessnessRandomness marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| theorem completeBipartiteGraph_edgeSet : (completeBipartiteGraph W₁ W₂).edgeSet = | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same below |
||||||||||||||||||||||||
| Set.range (fun x : W₁ × W₂ ↦ s(.inl x.1, .inr x.2)) := by | ||||||||||||||||||||||||
|
Comment on lines
+456
to
+457
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
| refine Set.ext fun x ↦ ⟨fun h ↦ ?_, fun h ↦ ?_⟩ | ||||||||||||||||||||||||
| · simp only [edgeSet_eq, completeBipartiteGraph_adj, Sum.exists, Sum.isRight_inl, | ||||||||||||||||||||||||
| Bool.false_eq_true, and_false, Sum.isLeft_inl, and_true, false_or, exists_and_right, | ||||||||||||||||||||||||
| Sum.isRight_inr, Sum.isLeft_inr, or_false, Set.mem_setOf_eq] at h | ||||||||||||||||||||||||
| rcases h with ⟨_, _, rfl⟩ | ⟨_, _, rfl⟩ <;> simp | ||||||||||||||||||||||||
| · obtain ⟨_, _, _⟩ := h | ||||||||||||||||||||||||
| simp | ||||||||||||||||||||||||
LessnessRandomness marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| theorem completeBipartiteGraph_edgeSet_encard : | ||||||||||||||||||||||||
| (completeBipartiteGraph W₁ W₂).edgeSet.encard = | ||||||||||||||||||||||||
| ENat.card W₁ * ENat.card W₂ := by | ||||||||||||||||||||||||
| let g (x : W₁ × W₂) : Sym2 (W₁ ⊕ W₂) := s(.inl x.1, .inr x.2) | ||||||||||||||||||||||||
| have : Function.Injective g := fun _ _ _ ↦ by grind | ||||||||||||||||||||||||
| have := this.encard_image Set.univ | ||||||||||||||||||||||||
| simpa [completeBipartiteGraph_edgeSet, this] | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| theorem completeBipartiteGraph_edgeSet_encard : | |
| (completeBipartiteGraph W₁ W₂).edgeSet.encard = | |
| ENat.card W₁ * ENat.card W₂ := by | |
| let g (x : W₁ × W₂) : Sym2 (W₁ ⊕ W₂) := s(.inl x.1, .inr x.2) | |
| have : Function.Injective g := fun _ _ _ ↦ by grind | |
| have := this.encard_image Set.univ | |
| simpa [completeBipartiteGraph_edgeSet, this] | |
| theorem completeBipartiteGraph_edgeSet_encard : | |
| (completeBipartiteGraph W₁ W₂).edgeSet.encard = ENat.card W₁ * ENat.card W₂ := by | |
| rw [completeBipartiteGraph_edgeSet, ← ENat.card_prod, ← Set.encard_univ, ← Set.image_univ] | |
| exact Function.Injective.encard_image (by grind [Function.Injective]) Set.univ |
Also I think it would be great to add a lemma that combines Function.Injective.encard_image with Set.image_univ creating (Set.range f).encard = (Set.univ : α).encard for an injective f : α → β, though I'm not sure what it should be called since Function.Injective.encard_image already exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Function.Injective.encard_range? 🤔
Although it seems to be very simple (too simple?), if I understood everything correctly. Almost the same as Function.Injective.encard_image.
import Mathlib
lemma Function.Injective.encard_range {α β} {f : α → β} (hf : Function.Injective f) :
(Set.range f).encard = (Set.univ : Set α).encard :=
Set.image_univ.symm ▸ Function.Injective.encard_image hf Set.univ
Uh oh!
There was an error while loading. Please reload this page.