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

refactor(order/complete_lattice): ditch complete_semilattice_Inf and complete_semilattice_Sup #14863

Closed
wants to merge 16 commits into from

Conversation

vihdzp
Copy link
Collaborator

@vihdzp vihdzp commented Jun 21, 2022

These typeclasses are made entirely redundant by complete_lattice. They were only used to define complete_lattice instances through complete_lattice_of_complete_semilattice_Inf and complete_lattice_of_complete_semilattice_Sup, but this can more directly be done with complete_lattice_of_Inf and complete_lattice_of_Sup.


Zulip

Open in Gitpod

@vihdzp vihdzp added WIP Work in progress awaiting-review The author would like community review of the PR awaiting-CI The author would like to see what CI has to say before doing more work. labels Jun 21, 2022
@YaelDillies
Copy link
Collaborator

Note, we do not need to delete them to remove them from the typeclass hierarchy. You can consider them as alternative constructors and simply not give them any instance nor lemmas.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Jun 21, 2022

I do think it's best to remove them, so that nobody gets the wrong impression that these are useful standalone typeclasses. The complete_lattice_of_Inf and complete_lattice_of_Sup constructors pretty much retain all the convenience these typeclasses had.

@github-actions github-actions bot removed the awaiting-CI The author would like to see what CI has to say before doing more work. label Jun 22, 2022
@vihdzp vihdzp removed the WIP Work in progress label Jun 22, 2022
src/measure_theory/measure/measure_space.lean Show resolved Hide resolved
src/order/complete_lattice.lean Show resolved Hide resolved
src/topology/algebra/group.lean Show resolved Hide resolved
src/topology/algebra/ring.lean Show resolved Hide resolved
src/topology/algebra/ring.lean Show resolved Hide resolved
src/topology/metric_space/emetric_space.lean Show resolved Hide resolved
@YaelDillies
Copy link
Collaborator

Well no, because it uses is_glb instead of Inf_le, le_Inf, and you need to copy the resulting complete_lattice to fix definitional equalities.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Jun 22, 2022

is_glb (Inf s) is def-eq to Inf_le s \and le_Inf s. And you also needed to copy the resulting complete_lattice with the previous approach.

@YaelDillies
Copy link
Collaborator

Filling in p ∧ q is still more annoying than filling in p and q. So you can make it better by turning complete_semilattice_Inf into an actual constructor, which doesn't require copying.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Jun 23, 2022

If this is the problem, then I could just separate the hypotheses. But what's the point of even having the is_glb predicate if we consider working with the separate hypotheses simpler?

complete_semilattice_Inf is already a constructor. The only reason we copy it is to get nicer def-eqs.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Jun 23, 2022

Assuming there's situations where proving is_glb (Inf s) is easier than proving both fields Inf_le and le_Inf separately, we could merge them into a single field. If there's no such situations, then what purpose does that predicate serve?

@urkud
Copy link
Member

urkud commented Jun 27, 2022

These were added in #6797 by @semorrison. I wouldn't delete them without his approval.

As for is_glb vs Inf_le/le_Inf, I tried to refactor complete_lattice using is_glb_Inf/is_lub_Sup some time ago but failed to fix all errors. In many cases, the new proofs were shorter.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Jun 28, 2022

I would like to mention that Scott has been quite silent these past few weeks. I can wait, though I do plan to keep refactoring this and adjacent files, and might eventually cause trouble.

(set_lintegral_congr_fun hm
(ae_of_all _ (λ x, @max_eq_right ℝ≥0∞ _ _ _)))
(set_lintegral_congr_fun hm.compl
(ae_of_all _ (λ x (hx : ¬ _ ≤ _), max_eq_left (not_le.1 hx).le)))
Copy link
Member

Choose a reason for hiding this comment

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

Why did you need this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have no idea, all I know is the code broke. To be fair, this was quite a nontrivial def-eq.

Copy link
Member

Choose a reason for hiding this comment

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

I hope that #15056 will fix this. I'll try to make it compile tonight.

Copy link
Member

Choose a reason for hiding this comment

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

Could you please merge master and see whether you still need this change?


top := (⊤ : outer_measure α).to_measure (by rw [outer_measure.top_caratheodory]; exact le_top),
bot_le := λ a s hs, bot_le,
top := (⊤ : outer_measure α).to_measure $ by { rw outer_measure.top_caratheodory, exact le_top },
Copy link
Member

Choose a reason for hiding this comment

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

I wonder why this no longer makes leanchecker fail.

..group_topology.semilattice_inf,
..complete_lattice_of_complete_semilattice_Inf _ }
..group_topology.partial_order,
..complete_lattice_of_Inf (group_topology α) $ λ S, ⟨
Copy link
Member

Choose a reason for hiding this comment

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

Can you use is_glb.of_image here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so. These lemmas aren't def-eq even if they're very similar, because one is about all topological spaces, while the other is about all group topologies.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Jul 12, 2022

Seems like this PR inadvertently undos @YaelDillies' refactor on upper_set, since the proof for upper_set.Icoi_le_Ioi (isn't this a typo?) no longer works, but flipping the to a fixes it. I have no idea what could have caused this, since I don't ever touch the upper_lower.lean file. Maybe @urkud's recent refactor interacts weirdly with this?

@vihdzp vihdzp added help-wanted The author needs attention to resolve issues awaiting-CI The author would like to see what CI has to say before doing more work. labels Jul 13, 2022
@vihdzp vihdzp closed this Mar 30, 2023
@YaelDillies YaelDillies deleted the conditional_refactor branch March 30, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-CI The author would like to see what CI has to say before doing more work. awaiting-review The author would like community review of the PR help-wanted The author needs attention to resolve issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants