Skip to content

[Merged by Bors] - feat: monotonicity lemmas for OrdinalApprox - #15522

Closed
PhoenixIra wants to merge 13 commits into
masterfrom
ira/OrdinalApprox_monos
Closed

PhoenixIra wants to merge 13 commits into
masterfrom
ira/OrdinalApprox_monos

Conversation

@PhoenixIra

@PhoenixIra PhoenixIra commented Aug 5, 2024 •

Copy link
Copy Markdown
Collaborator

This PR adds two lemmas about monotonicity for lfpApprox and gfpApprox each. I found them helpful when working with the API.


I am a bit unsure about the names and would welcome any suggestions. Especially to make them fit with the already present monotonicity lemma.

Moreover, I could now express the monotonicity for the functions in lfpApprox_mono₁ in terms of Monotone. I welcome any suggestions to express it with Monotone.

Open in Gitpod

@PhoenixIra PhoenixIra added t-order Order theory t-logic Logic (model theory, etc) labels Aug 5, 2024
@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Aug 5, 2024
@github-actions

github-actions Bot commented Aug 5, 2024 •

Copy link
Copy Markdown

PR summary b46332a675

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ gfpApprox_mono_left
+ gfpApprox_mono_mid
+ lfpApprox_mono_left
+ lfpApprox_mono_mid

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

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

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

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@vihdzp vihdzp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry this took so long. I would've reviewed earlier, but I had never heard about "ordinal approximants" to fixed points. For a good while I thought the ordinals themselves were the ones being approximated!

intro f g h x a
induction a using Ordinal.induction with
| h i ih =>
unfold lfpApprox

@vihdzp vihdzp Aug 31, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Having to unfold a definition over and over is somewhat of an antipattern. The issue here is that since your definition of lfpApprox is recursive, it's not unfolded by default, causing it not to be definitionally equal. A simple fix is to introduce a lemma like

theorem lfpApprox_def (a : Ordinal) :
    lfpApprox f x a = sSup ({ f (lfpApprox f x b) | (b : Ordinal) (_ : b < a) } ∪ {x}) := by
  rw [lfpApprox]

and to rewrite using that lemma (which notably, is now searchable) instead of using unfold.

@PhoenixIra PhoenixIra Aug 31, 2024 •

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 added that theorem and refactored it in the previous existing theorems. Is this fine, or should the second part be a separate PR?

@PhoenixIra

PhoenixIra commented Aug 31, 2024 •

Copy link
Copy Markdown
Collaborator Author

Thank you very much for the review!
I think usually the theorem is called "constructive version of Tarski's fixed point theorem" as the documentation mentions. But since mathlib does not define ordinals constructively, we decided against that name and choose to highlight the approximation scheme via ordinals instead.

@vihdzp

vihdzp commented Aug 31, 2024 •

Copy link
Copy Markdown
Collaborator

As a separate thing, I've skimmed through the two references provided, and neither calls these values "ordinal approximants". I find the name to be quite misleading, as really, the approximations are simply ordinal-indexed.

Moreover, the file never mentions the actual result being built towards, that the fixed points of a monotone function on a complete lattice form a complete lattice themselves.

Do you think you could add this documentation to the file in a separate PR?

@PhoenixIra

PhoenixIra commented Aug 31, 2024 •

Copy link
Copy Markdown
Collaborator Author

I can create a separate PR to fix the name confusion. Do you expect this separate PR to only change the wording of "ordinal approximants" to "ordinal-indexed approximants", or would you also like to see some more details (which?) regarding the chosen name?

@vihdzp

vihdzp commented Aug 31, 2024

Copy link
Copy Markdown
Collaborator

Just that change, and a better docstring for lfpApprox and gfpApprox, would go a long way.

By the way, I just noticed that fixedPoints.completeLattice already exists in Mathlib. Is there some other result you're planning to build towards?

@vihdzp

vihdzp commented Aug 31, 2024

Copy link
Copy Markdown
Collaborator

FYI I just opened #16361 which simplifies a lot of the proofs that were already in the file.

@PhoenixIra

PhoenixIra commented Sep 2, 2024 •

Copy link
Copy Markdown
Collaborator Author

I have created the doc PR here: #16406

I do not plan to further make any connections between this theorem and fixedPoints.completeLattice. I believe both proofs are used for different applications. It is sometimes nice to argue about pre fixed points (as Tarski's Theorem is enabling), but it is sometimes nice to be able to apply transfinite induction on fixed points (as Cousot-Cousot's Theorem is enabling).

I considered to maybe generalize the ordinal-indexed approximations to domains with a complete partial order instead of complete lattices - but I have no plan to do it yet.

@PhoenixIra

Copy link
Copy Markdown
Collaborator Author

Moreover, I think it is redundant to give another construction of a complete lattice of fixed points in this file, as the supremum of fixed points is constructed analogous to Tarski's theorem, as far as I remember. The connection to the least fixed point and the greatest fixed point however are created in lfpApprox_ord_eq_lfp and gfpApprox_ord_eq_gfp.

@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 24, 2024

@YaelDillies YaelDillies left a comment

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.

maintainer merge

@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Sep 25, 2024
mathlib-bors Bot pushed a commit that referenced this pull request Sep 25, 2024
As mentioned in #15522, the documentation uses heavily the wording "ordinal approximation", which suggests that ordinals are approximated. This PR changes it to "ordinal-indexed approximation" and highlights the indexed nature of ordinals in various places. It also fixes some apparent then vs than errors.

I appreciate any suggestions to further improve the documentation and hints for spelling mistakes.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)


Co-authored-by: Violeta Hernández <[email protected]>
Co-authored-by: Ira Fesefeldt <[email protected]>

@fpvandoorn fpvandoorn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One comment, otherwise LGTM.

bors d+

@mathlib-bors

mathlib-bors Bot commented Sep 25, 2024

Copy link
Copy Markdown
Contributor

✌️ PhoenixIra can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Sep 25, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 25, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 25, 2024
dagurtomas pushed a commit that referenced this pull request Sep 25, 2024
As mentioned in #15522, the documentation uses heavily the wording "ordinal approximation", which suggests that ordinals are approximated. This PR changes it to "ordinal-indexed approximation" and highlights the indexed nature of ordinals in various places. It also fixes some apparent then vs than errors.

I appreciate any suggestions to further improve the documentation and hints for spelling mistakes.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)


Co-authored-by: Violeta Hernández <[email protected]>
Co-authored-by: Ira Fesefeldt <[email protected]>
@PhoenixIra

Copy link
Copy Markdown
Collaborator Author

bors r+

mathlib-bors Bot pushed a commit that referenced this pull request Sep 26, 2024
This PR adds two lemmas about monotonicity for `lfpApprox` and `gfpApprox` each. I found them helpful when working with the API.



Co-authored-by: Ira Fesefeldt <[email protected]>
Co-authored-by: Ira Fesefeldt <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat: monotonicity lemmas for OrdinalApprox [Merged by Bors] - feat: monotonicity lemmas for OrdinalApprox Sep 26, 2024
@mathlib-bors mathlib-bors Bot closed this Sep 26, 2024
@mathlib-bors
mathlib-bors Bot deleted the ira/OrdinalApprox_monos branch September 26, 2024 02:51
fbarroero pushed a commit that referenced this pull request Oct 2, 2024
This PR adds two lemmas about monotonicity for `lfpApprox` and `gfpApprox` each. I found them helpful when working with the API.



Co-authored-by: Ira Fesefeldt <[email protected]>
Co-authored-by: Ira Fesefeldt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-logic Logic (model theory, etc) t-order Order theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants