Skip to content
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

[Merged by Bors] - feat(data/*, order/*) supporting lemmas for characterising well-founded complete lattices #5446

Closed
wants to merge 15 commits into from

Conversation

ocfnash
Copy link
Collaborator

@ocfnash ocfnash commented Dec 20, 2020


Note that I have included some extra lemmas even though they are not actually needed (or used). Here is the list of such lemmas together with my justification for including them:

  • finset.not_nonempty_iff_eq_empty: seems to be a gap set.not_nonempty_iff_eq_empty already exists
  • finset.eq_singleton_iff_nonempty_unique_mem: I introduce set.eq_singleton_iff_nonempty_unique_mem here so it seems worth adding the finset version also
  • finset.inf_eq_Inf: I introduce finset.sup_eq_Sup so it seems worth adding the inf version also
  • rel_hom.map_inf: I introduce rel_hom.map_sup here so it seems worth adding the inf version also
  • Inf_eq_top_nonempty_eq_singleton: I introduce Sup_eq_bot_nonempty_eq_singleton so it seems worth adding the inf version also
  • set.finite.preimage_embedding: I used this for an earlier proof of the results here and it seemed worth keeping

I think it is reasonable to bundle these extra results with the other work here but I will happily excise these (or move them to a separate PR) if requested.

@ocfnash ocfnash added RFC Request for comment WIP Work in progress labels Dec 20, 2020
@ocfnash ocfnash force-pushed the compact_complete_lattice branch 2 times, most recently from 50954d3 to 960121f Compare December 21, 2020 16:01
@ocfnash ocfnash changed the title feat(src/order/compactness): introduce some compactness properties for complete lattices feat(src/order/compactness): characterise well-foundedness for complete lattices Dec 21, 2020
@awainverse
Copy link
Collaborator

Rather than prove 4 implications, I think you can prove the equivalence of these 3 conditions with 3 implications. The most logical way to me, without having written any code, would be well_founded -> is_sup_finite_compact -> is_sup_closed_compact.

I'd also rewrite is_sup_finite_compact to be about finsets, but that's an easy equivalence, so you could still use finset API if you don't do this.

The following are suggestions for how to prove some of those directions. I'll investigate these further if I have time. Feel free not to use them if you don't want to, and I'm sorry if some of this is just rehashing what you've already done.

I'd prove well_founded -> is_sup_finite_compact by considering the set of all sups of finsets in your lattice. That's got to have a maximal element, which you can show is the Sup of the whole set.

There should be a quick proof of is_sup_finite_compact -> is_sup_closed_compact by selecting a finset such that finset.sup t = Sup s, and then show by induction (if it's not already in the library) that a set closed under sup will also be closed under finset.sup.

@ocfnash ocfnash removed the RFC Request for comment label Dec 30, 2020
@ocfnash ocfnash force-pushed the compact_complete_lattice branch 2 times, most recently from 808180a to 91f2d0a Compare December 30, 2020 22:33
Still quite a bit of work to do but proofs reasonable now.
@ocfnash ocfnash changed the title feat(src/order/compactness): characterise well-foundedness for complete lattices feat(src/order/complete_well_founded): characterise well-foundedness for complete lattices Dec 31, 2020
Oliver Nash added 2 commits December 31, 2020 11:16
Just for completeness since I have already added `Sup_eq_bot_nonempty_eq_singleton`
@ocfnash ocfnash added awaiting-review The author would like community review of the PR and removed WIP Work in progress labels Dec 31, 2020
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -266,9 +266,17 @@ iff.intro
(assume h a ha, top_unique $ h ▸ Inf_le ha)
(assume h, top_unique $ le_Inf $ assume a ha, top_le_iff.2 $ h a ha)

lemma Inf_eq_top_nonempty_eq_singleton {s : set α}
(h_inf : Inf s = ⊤) (hne : s.nonempty) : s = {⊤} :=
by { rw set.eq_singleton_iff_nonempty_unique_mem, rw Inf_eq_top at h_inf, exact ⟨hne, h_inf⟩, }
Copy link
Member

Choose a reason for hiding this comment

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

Golfs to

Suggested change
by { rw set.eq_singleton_iff_nonempty_unique_mem, rw Inf_eq_top at h_inf, exact ⟨hne, h_inf⟩, }
set.eq_singleton_iff_nonempty_unique_mem.mpr ⟨hne, Inf_eq_top.mp h_inf⟩

I'm sure you can do something similar with the one below

Copy link
Collaborator Author

@ocfnash ocfnash Dec 31, 2020

Choose a reason for hiding this comment

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

I have mixed feelings about this one. I do use term-mode proofs but whenever I'm on the fence, I avoid them because they're harder to read (and, I claim, maintain).

Still, commit away if you like!

src/order/rel_iso.lean Outdated Show resolved Hide resolved
@urkud
Copy link
Member

urkud commented Jan 1, 2021

Could you please move supporting lemmas to a separate PR?

@urkud
Copy link
Member

urkud commented Jan 1, 2021

Once you have all implications, could you please add

  • a tfae lemma?
  • 3 convenience lemmas with iffs?
  • dot-style lemmas for missing implications (can be done using command alias)?

@urkud urkud added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Jan 1, 2021
@ocfnash
Copy link
Collaborator Author

ocfnash commented Jan 1, 2021

Thanks for the review @urkud I have just one question. When you say:

Could you please move supporting lemmas to a separate PR?

do you mean the six "extra" lemmas I mentioned at the very top of this PR, or do you mean all lemmas, e.g., everything except for the contents of complete_well_founded.lean?

Either way, I'm happy to do it!

@ocfnash ocfnash added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jan 1, 2021
@urkud
Copy link
Member

urkud commented Jan 2, 2021

I mean all changes to existing files.

As per @urkud 's request, I am splitting this PR into two pieces:
  * One with all changes to existing files (this branch)
  * One with the proposed new file (a new branch).
@ocfnash ocfnash changed the title feat(src/order/complete_well_founded): characterise well-foundedness for complete lattices feat(data/*, order/*) supporting lemmas for characterising well-founded complete lattices Jan 2, 2021
@ocfnash
Copy link
Collaborator Author

ocfnash commented Jan 2, 2021

I mean all changes to existing files.

Done!

@urkud
Copy link
Member

urkud commented Jan 4, 2021

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Jan 4, 2021
bors bot pushed a commit that referenced this pull request Jan 4, 2021
@bors
Copy link

bors bot commented Jan 4, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/*, order/*) supporting lemmas for characterising well-founded complete lattices [Merged by Bors] - feat(data/*, order/*) supporting lemmas for characterising well-founded complete lattices Jan 4, 2021
@bors bors bot closed this Jan 4, 2021
@bors bors bot deleted the compact_complete_lattice branch January 4, 2021 08:50
pglutz pushed a commit that referenced this pull request Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants