-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Merged by Bors] - feat(Combinatorics/Graph): infimum #37620
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
Closed
+93
−0
Closed
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1a7aaab
init
Jun2M b4e712b
mk_all
Jun2M 75973de
doc change
Jun2M c576318
build fix
Jun2M c8f839c
Merge branch 'master' into GraphInter
Jun2M 4a0ada6
CompleteSemilatticeInf (WithTop (Graph α β))
Jun2M 29a7927
mk_all
Jun2M 0ed35f9
ExtendedGraph
Jun2M 4fa8b5f
docs
Jun2M ef541e8
rm ExtendedGraph
Jun2M d4c38f5
Remove unused sInf_pair lemma from Lattice.lean
Jun2M 38f9a72
Merge branch 'master' into GraphInter
Jun2M 8e14cb3
rm ConditionallyCompletePartialOrderInf
Jun2M 9e39b01
TODO
Jun2M 158df8f
Update Mathlib/Combinatorics/Graph/Lattice.lean
Jun2M 8fb317d
Update Mathlib/Combinatorics/Graph/Lattice.lean
Jun2M 9a58964
Update Mathlib/Combinatorics/Graph/Lattice.lean
Jun2M 0c18137
clean up variable
Jun2M 204f8b0
minimize import
Jun2M 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 |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| /- | ||
| Copyright (c) 2026 Jun Kwon. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Peter Nelson, Jun Kwon | ||
| -/ | ||
| module | ||
|
|
||
| public import Mathlib.Data.Set.Lattice | ||
| public import Mathlib.Order.ConditionallyCompletePartialOrder.Basic | ||
| public import Mathlib.Order.ConditionallyCompleteLattice.Basic | ||
| public import Mathlib.Order.CompleteLattice.Basic | ||
| public import Mathlib.Combinatorics.Graph.Subgraph | ||
|
|
||
| /-! | ||
| # Intersection and union of graphs | ||
|
|
||
| This file defines the lattice-like structures on graphs. | ||
|
|
||
| ## Main results | ||
|
|
||
| - `SemilatticeInf (Graph α β)` | ||
|
|
||
| ## Implementation notes | ||
|
|
||
| Intersections are defined here as the maximal mutual subgraph of the given graphs. | ||
| This has the effect of, when taking the intersection of non-compatible graphs, | ||
| **any non-compatible edges are removed**. | ||
|
|
||
| ## TODO | ||
|
|
||
| + Add `ConditionallyCompleteCompleteLatticeInf (Graph α β)` after splitting | ||
| `ConditionallyCompleteCompleteLattice`. | ||
|
|
||
| -/ | ||
|
|
||
| public section | ||
|
|
||
| variable {α β ι : Type*} {x y : α} {e : β} {G G₁ G₂ H : Graph α β} {F F₀ : Set β} {X : Set α} | ||
| {Gs : Set (Graph α β)} (Gι : ι → Graph α β) [Nonempty ι] | ||
|
Jun2M marked this conversation as resolved.
Outdated
|
||
|
|
||
| open Set Function | ||
|
Jun2M marked this conversation as resolved.
Outdated
|
||
|
|
||
| namespace Graph | ||
|
|
||
| /-- The infimum of two graphs `G` and `H`. The edges are precisely those on which `G` and `H` agree, | ||
| and the edge set is a subset of `E(G) ∩ E(H)`, with equality if `G` and `H` are compatible. -/ | ||
| instance : SemilatticeInf (Graph α β) where | ||
| inf G H := { | ||
| vertexSet := V(G) ∩ V(H) | ||
| edgeSet := {e ∈ E(G) ∩ E(H) | ∀ x y, G.IsLink e x y ↔ H.IsLink e x y} | ||
| IsLink e x y := G.IsLink e x y ∧ H.IsLink e x y | ||
| isLink_symm _ _ _ _ h := ⟨h.1.symm, h.2.symm⟩ | ||
| eq_or_eq_of_isLink_of_isLink _ _ _ _ _ h h' := h.1.left_eq_or_eq h'.1 | ||
| edge_mem_iff_exists_isLink e := by | ||
| simp only [edgeSet_eq_setOf_exists_isLink, mem_inter_iff, mem_setOf_eq] | ||
| exact ⟨fun ⟨⟨⟨x, y, hexy⟩, ⟨z, w, hezw⟩⟩, h⟩ ↦ ⟨x, y, hexy, by rwa [← h]⟩, | ||
| fun ⟨x, y, hfG, hfH⟩ ↦ ⟨⟨⟨_, _, hfG⟩, ⟨_, _, hfH⟩⟩, | ||
| fun z w ↦ by rw [hfG.isLink_iff_sym2_eq, hfH.isLink_iff_sym2_eq]⟩⟩ | ||
| left_mem_of_isLink e x y h := ⟨h.1.left_mem, h.2.left_mem⟩} | ||
| inf_le_left G H := { | ||
| vertexSet_mono := inter_subset_left | ||
| isLink_mono := by simp +contextual} | ||
| inf_le_right G H := { | ||
| vertexSet_mono := inter_subset_right | ||
| isLink_mono := by simp +contextual} | ||
| le_inf H G₁ G₂ h₁ h₂ := { | ||
| vertexSet_mono := subset_inter h₁.vertexSet_mono h₂.vertexSet_mono | ||
| isLink_mono e x y h := by simp [h₁.isLink_mono h, h₂.isLink_mono h]} | ||
|
|
||
| @[simp] lemma vertexSet_inf (G H : Graph α β) : V(G ⊓ H) = V(G) ∩ V(H) := rfl | ||
|
|
||
| lemma edgeSet_inf (G H : Graph α β) : | ||
| E(G ⊓ H) = {e ∈ E(G) ∩ E(H) | ∀ x y, G.IsLink e x y ↔ H.IsLink e x y} := rfl | ||
|
|
||
| @[simp] lemma inf_isLink : (G ⊓ H).IsLink e x y ↔ G.IsLink e x y ∧ H.IsLink e x y := Iff.rfl | ||
|
|
||
| @[simp] | ||
| lemma inf_inc_iff : (G ⊓ H).Inc e x ↔ ∃ y, G.IsLink e x y ∧ H.IsLink e x y := by | ||
| simp [Inc] | ||
|
|
||
| @[simp] | ||
| lemma inf_isLoopAt_iff : (G ⊓ H).IsLoopAt e x ↔ G.IsLoopAt e x ∧ H.IsLoopAt e x := by | ||
| simp [← isLink_self_iff] | ||
|
|
||
| @[simp] | ||
| lemma inf_isNonloopAt_iff : (G ⊓ H).IsNonloopAt e x ↔ ∃ y ≠ x, G.IsLink e x y ∧ H.IsLink e x y := by | ||
| simp [IsNonloopAt] | ||
|
|
||
| @[simp] | ||
| lemma disjoint_iff_vertexSet_disjoint : Disjoint G₁ G₂ ↔ Disjoint V(G₁) V(G₂) := by | ||
|
Jun2M marked this conversation as resolved.
Outdated
|
||
| rw [disjoint_iff, ← vertexSet_eq_empty_iff, vertexSet_inf, disjoint_iff_inter_eq_empty] | ||
|
|
||
| lemma Compatible.edgeSet_inf (h : G.Compatible H) : E(G ⊓ H) = E(G) ∩ E(H) := by | ||
|
Jun2M marked this conversation as resolved.
Outdated
|
||
| rw [G.edgeSet_inf] | ||
| exact le_antisymm (fun e he ↦ he.1) fun e he ↦ ⟨he, fun _ _ ↦ h.isLink_congr he.1 he.2⟩ | ||
|
|
||
| end Graph | ||
Oops, something went wrong.
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.