-
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
Open
LessnessRandomness
wants to merge
17
commits into
leanprover-community:master
Choose a base branch
from
LessnessRandomness:bipartite_edgeSet_encard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+54
−0
Open
feat(Combinatorics/SimpleGraph/Bipartite): upper bound on the number of edges of a bipartite graph #34315
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7d79324
Upper limit to cardinality of bipartite graph edge set
LessnessRandomness 3738639
Improve docstrings
LessnessRandomness cf43a39
Merge branch 'master' into bipartite_edgeSet_encard
LessnessRandomness 58c5b43
Made fixes and improvements suggested
LessnessRandomness 19acaef
Changed proof to Vlad Tsyrklevich's proof and also added IsBipartite.…
LessnessRandomness 4e9de3c
myembedding -> nonempty_embedding, also added 'private' to few theorems
LessnessRandomness 1c28de1
Partially applied suggestions
LessnessRandomness 71b3a90
Reorganized sections a bit
LessnessRandomness 28b15c3
Moved two lemmas to better places
LessnessRandomness 8b8497a
Suggestions by SnirBroshi
LessnessRandomness 5f16c48
Fixes by vlad902
LessnessRandomness fe4b98e
Merge branch 'master' into bipartite_edgeSet_encard
LessnessRandomness 597410d
Merge branch 'master' into bipartite_edgeSet_encard
LessnessRandomness 217b66d
applied suggestion by SnirBroshi
LessnessRandomness 5bba909
Merge branch 'master' into bipartite_edgeSet_encard
LessnessRandomness 9771749
Merge branch 'leanprover-community:master' into bipartite_edgeSet_encard
LessnessRandomness a3b60da
TIny fix of an error
LessnessRandomness File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -445,4 +445,59 @@ theorem degree_le_between_add_compl (hw : w ∈ sᶜ) : | |||||||||||
|
|
||||||||||||
| end Between | ||||||||||||
|
|
||||||||||||
| section | ||||||||||||
LessnessRandomness marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||
|
|
||||||||||||
| variable {W₁ W₂ : Type*} | ||||||||||||
|
|
||||||||||||
| 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 <| Sym2.ind fun u v ↦ ⟨fun h ↦ ?_, fun ⟨⟨a, b⟩, z⟩ ↦ ?_⟩ | ||||||||||||
| · cases u <;> cases v <;> simp_all | ||||||||||||
| · grind [completeBipartiteGraph_adj, mem_edgeSet] | ||||||||||||
|
|
||||||||||||
| 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 | ||||||||||||
|
|
||||||||||||
| theorem IsBipartiteWith.nonempty_embedding_completeBipartiteGraph_edgeSet | ||||||||||||
| (hG : G.IsBipartiteWith s t) : | ||||||||||||
| Nonempty (G.edgeSet ↪ (completeBipartiteGraph s t).edgeSet) := by | ||||||||||||
| refine ⟨⟨fun ⟨x, hx⟩ ↦ ?_, fun _ _ _ ↦ ?_⟩⟩ | ||||||||||||
| · by_cases! h : x.out.1 ∈ s | ||||||||||||
| · refine ⟨s(.inl ⟨x.out.1, h⟩, .inr ⟨x.out.2, ?_⟩), by simp⟩ | ||||||||||||
| grind [hG.disjoint, hG.mem_of_adj, edgeSet_eq, Sym2.eq_out] | ||||||||||||
| · refine ⟨s(.inr ⟨x.out.1, ?_⟩, .inl ⟨x.out.2, ?_⟩), by simp⟩ | ||||||||||||
| · grind [hG.mem_of_adj <| G.mem_edgeSet.mpr <| Sym2.eq_out x ▸ hx] | ||||||||||||
| · grind [hG.disjoint, hG.mem_of_adj, edgeSet_eq, Sym2.eq_out] | ||||||||||||
| · grind [Sym2.eq_out] | ||||||||||||
|
|
||||||||||||
| end | ||||||||||||
|
|
||||||||||||
| section | ||||||||||||
|
|
||||||||||||
| /-- An upper bound on the cardinality of the edge set of a bipartite graph when the vertex sets | ||||||||||||
| forming it may also be infinite: in that case as well, the upper bound is the product of | ||||||||||||
| the cardinalities of these two sets. The statement uses `Set.encard`. -/ | ||||||||||||
LessnessRandomness marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||
| theorem IsBipartiteWith.encard_edgeSet_le (hG : G.IsBipartiteWith s t) : | ||||||||||||
| G.edgeSet.encard ≤ s.encard * t.encard := by | ||||||||||||
| grw [hG.nonempty_embedding_completeBipartiteGraph_edgeSet.some.encard_le] | ||||||||||||
| simp [completeBipartiteGraph_edgeSet_encard] | ||||||||||||
|
|
||||||||||||
| /-- An upper bound on the cardinality of the edge set of a bipartite graph when the cardinality | ||||||||||||
LessnessRandomness marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||
| of the entire vertex set of the graph is known. That is, the cardinality of the edge set times `4` | ||||||||||||
| is less or equal to the square of the cardinality of the vertex set. | ||||||||||||
| The statement uses `Set.encard` and `ENat.card`. -/ | ||||||||||||
LessnessRandomness marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||
| theorem IsBipartite.four_mul_encard_edgeSet_le (h : G.IsBipartite) : | ||||||||||||
| 4 * G.edgeSet.encard ≤ ENat.card V ^ 2 := by | ||||||||||||
| refine finite_or_infinite V |>.elim (fun hv ↦ ?_) (fun _ ↦ by simp) | ||||||||||||
| have ⟨s, t, h⟩ := h.exists_isBipartiteWith | ||||||||||||
| grw [h.encard_edgeSet_le] | ||||||||||||
| have := Set.encard_union_eq h.disjoint ▸ Set.encard_le_card | ||||||||||||
| rw [ENat.card_eq_coe_natCard, ← s.toFinite.cast_ncard_eq, ← t.toFinite.cast_ncard_eq] at this ⊢ | ||||||||||||
| norm_cast at this ⊢ | ||||||||||||
| grind [Nat.pow_le_pow_left this 2, four_mul_le_sq_add s.ncard t.ncard] | ||||||||||||
|
|
||||||||||||
| end | ||||||||||||
|
|
||||||||||||
| end SimpleGraph | ||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.