Skip to content

[Merged by Bors] - feat(Combinatorics/Graph): OrderBot instance for Graph#37610

Closed
Jun2M wants to merge 9 commits intoleanprover-community:masterfrom
Jun2M:GraphOrderBot
Closed

[Merged by Bors] - feat(Combinatorics/Graph): OrderBot instance for Graph#37610
Jun2M wants to merge 9 commits intoleanprover-community:masterfrom
Jun2M:GraphOrderBot

Conversation

@Jun2M
Copy link
Copy Markdown
Collaborator

@Jun2M Jun2M commented Apr 3, 2026

This PR adds an OrderBot instance for Graph α β, where the bottom element is the empty graph (no vertices, no edges).

Co-authored-by: Peter Nelson apn.uni@gmail.com


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

PR summary fa6418a815

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ IsSubgraph.compatible
+ IsSubgraph.compatible'
+ banana_mono
+ bot_isClosedSubgraph
+ edgeSet_bot
+ eq_bot_or_vertexSet_nonempty
+ instance : Inhabited (Graph α β)
+ instance : OrderBot (Graph α β)
+ isClosedSubgraph_bot_iff
+ isInducedSubgraph_bot_iff
+ isSpanningSubgraph_bot_iff
+ le_noEdge_iff
+ ne_bot_iff
+ ne_bot_of_mem_vertexSet
+ noEdge_empty
+ noEdge_le_iff
+ not_disjoint_of_mem_mem
+ vertexSet_bot
+ vertexSet_eq_empty_iff
+ vertexSet_not_nonempty_iff
-- le

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-combinatorics Combinatorics label Apr 3, 2026
@Jun2M Jun2M changed the title feat(Combinatorics.Graph.Subgraph): add OrderBot instance for Graph feat(Combinatorics/Graph): add OrderBot instance for Graph Apr 3, 2026
@Jun2M Jun2M changed the title feat(Combinatorics/Graph): add OrderBot instance for Graph feat(Combinatorics/Graph): OrderBot instance for Graph Apr 6, 2026
@Jun2M Jun2M requested a review from YaelDillies April 8, 2026 00:10
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean
@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 8, 2026
@Jun2M Jun2M removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 8, 2026
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment thread Mathlib/Combinatorics/Graph/Subgraph.lean Outdated
Comment on lines +388 to +407
lemma eq_bot_or_vertexSet_nonempty (G : Graph α β) : G = ⊥ ∨ V(G).Nonempty := by
refine (em (V(G) = ∅)).elim (fun he ↦ .inl (Graph.ext he fun e x y ↦ ?_)) (Or.inr ∘
nonempty_iff_ne_empty.mpr)
simp only [edgeSet_bot, mem_empty_iff_false, not_false_eq_true, not_isLink_of_notMem_edgeSet,
iff_false]
exact fun h ↦ by simpa [he] using h.left_mem

lemma vertexSet_eq_empty_iff : V(G) = ∅ ↔ G = ⊥ := by
refine ⟨fun h ↦ bot_le.antisymm' ⟨by simp [h], fun e x y he ↦ ?_⟩, fun h ↦ by simp [h]⟩
simpa [h] using he.left_mem

@[push, simp]
lemma ne_bot_iff : G ≠ ⊥ ↔ V(G).Nonempty :=
not_iff_not.mp <| by simp [vertexSet_eq_empty_iff, not_nonempty_iff_eq_empty]

@[push, simp]
lemma vertexSet_not_nonempty_iff : ¬ V(G).Nonempty ↔ G = ⊥ := by
simp [vertexSet_eq_empty_iff, not_nonempty_iff_eq_empty]

lemma ne_bot_of_mem_vertexSet (h : x ∈ V(G)) : G ≠ ⊥ := ne_bot_iff.mpr ⟨x, h⟩
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I do not buy this still. For me, G = ⊥ is simpler and more useful than V(G) = ∅: it only involves equality, and can be substituted in. I would therefore suggest you build the API around G = ⊥ rather than V(G) = ∅. Right now, it looks like a confusing mix of both

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the question here is: should the negation of SNF(simp normal form) also be SNF?

In my view, answer is 'not necessarily'. "s.Nonempty is a great example: just because s = ∅ is SNF, you wouldn't argue s ≠ ∅ should be the SNF, not s.Nonempty, would you?

I agree that "G = ⊥ is simpler and more useful than V(G) = ∅". But I would also argue that V(G).Nonempty is more useful than G ≠ ⊥; In almost all cases I can think of, the next step from showing a graph is nonempty is to take a vertex from the said graph. In my mind, this situation is not so different from Set.Nonempty one.

In this perspective, there is no "mix", all equivalent forms of G = ⊥ are simplified to G = ⊥ and all equivalent forms of V(G).Nonempty are simplified to V(G).Nonempty. The fact that those two SNF are not negation of each other is not a problem.

@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 9, 2026
Jun2M and others added 2 commits April 9, 2026 09:14
@Jun2M Jun2M removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 9, 2026
@Jun2M Jun2M requested a review from YaelDillies April 10, 2026 19:20
Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ask someone else (@Bhavik Mehta ?) about the simp normal form question.

maintainer merge?

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by YaelDillies.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Apr 12, 2026
Copy link
Copy Markdown
Contributor

@b-mehta b-mehta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

wrt the simp-normal-form question, I think the current set-up is sensible, we prefer = ∅ for the positive version and .Nonempty for the negative one.

@b-mehta
Copy link
Copy Markdown
Contributor

b-mehta commented Apr 13, 2026

bors merge

@mathlib-triage mathlib-triage Bot added the ready-to-merge This PR has been sent to bors. label Apr 13, 2026
@mathlib-triage mathlib-triage Bot removed the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Apr 13, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Apr 13, 2026
This PR adds an `OrderBot` instance for `Graph α β`, where the bottom element `⊥` is the empty graph (no vertices, no edges).

Co-authored-by: Peter Nelson [apn.uni@gmail.com](mailto:apn.uni@gmail.com)
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors Bot commented Apr 13, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat(Combinatorics/Graph): OrderBot instance for Graph [Merged by Bors] - feat(Combinatorics/Graph): OrderBot instance for Graph Apr 13, 2026
@mathlib-bors mathlib-bors Bot closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants