[Merged by Bors] - feat(Combinatorics/Graph): OrderBot instance for Graph#37610
[Merged by Bors] - feat(Combinatorics/Graph): OrderBot instance for Graph#37610Jun2M wants to merge 9 commits intoleanprover-community:masterfrom
OrderBot instance for Graph#37610Conversation
PR summary fa6418a815Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
OrderBot instance for GraphOrderBot instance for Graph
OrderBot instance for GraphOrderBot instance for Graph
| 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⟩ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
YaelDillies
left a comment
There was a problem hiding this comment.
Let's ask someone else (@Bhavik Mehta ?) about the simp normal form question.
maintainer merge?
|
🚀 Pull request has been placed on the maintainer queue by YaelDillies. |
b-mehta
left a comment
There was a problem hiding this comment.
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.
|
bors merge |
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)
|
Pull request successfully merged into master. Build succeeded: |
OrderBot instance for GraphOrderBot instance for Graph
This PR adds an
OrderBotinstance forGraph α β, where the bottom element⊥is the empty graph (no vertices, no edges).Co-authored-by: Peter Nelson apn.uni@gmail.com