Skip to content

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

Closed
PhoenixIra wants to merge 13 commits intomasterfrom
ira/OrdinalApprox_monos
Closed

[Merged by Bors] - feat: monotonicity lemmas for OrdinalApprox#15522
PhoenixIra wants to merge 13 commits intomasterfrom
ira/OrdinalApprox_monos

Conversation

@PhoenixIra
Copy link
Copy Markdown
Collaborator

@PhoenixIra PhoenixIra commented Aug 5, 2024

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
Copy link
Copy Markdown

github-actions bot commented Aug 5, 2024

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.

Copy link
Copy Markdown
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Copy Markdown
Collaborator

@vihdzp vihdzp left a comment

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
Copy link
Copy Markdown
Collaborator

@vihdzp vihdzp Aug 31, 2024

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.

Copy link
Copy Markdown
Collaborator Author

@PhoenixIra PhoenixIra Aug 31, 2024

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
Copy link
Copy Markdown
Collaborator Author

PhoenixIra commented Aug 31, 2024

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
Copy link
Copy Markdown
Collaborator

vihdzp commented Aug 31, 2024

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
Copy link
Copy Markdown
Collaborator Author

PhoenixIra commented Aug 31, 2024

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
Copy link
Copy Markdown
Collaborator

vihdzp commented Aug 31, 2024

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
Copy link
Copy Markdown
Collaborator

vihdzp commented Aug 31, 2024

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

@PhoenixIra
Copy link
Copy Markdown
Collaborator Author

PhoenixIra commented Sep 2, 2024

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 A reviewer has asked the author a question or requested changes. label Sep 24, 2024
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.

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 <vi.hdz.p@gmail.com>
Co-authored-by: Ira Fesefeldt <public@feuervogel.me>
Copy link
Copy Markdown
Member

@fpvandoorn fpvandoorn left a comment

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
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Sep 25, 2024

✌️ 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 <vi.hdz.p@gmail.com>
Co-authored-by: Ira Fesefeldt <public@feuervogel.me>
@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 <public@feuervogel.me>
Co-authored-by: Ira Fesefeldt <9974411+PhoenixIra@users.noreply.github.com>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Sep 26, 2024

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 <public@feuervogel.me>
Co-authored-by: Ira Fesefeldt <9974411+PhoenixIra@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. 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