Skip to content

Conversation

@datokrat
Copy link
Contributor

@datokrat datokrat commented Oct 15, 2025

This PR removes the Finite hypothesis on the toList, toListRev and toArray functions on iterators. The new default implementation uses a fixpoint combinator that is semantically equal to a well-founded recursive function or an opaque function depending on whether the functional is well-founded recursive w.r.t. any well-founded relation. The PR also adds it.ensureTermination.toList and other variants that require a Finite instance and always terminate, in case that one wants intrinsic guarantees that it terminates.

@datokrat datokrat added the changelog-library Library label Oct 15, 2025
@datokrat datokrat changed the title Allow extrinsic termination proofs for toList and toArray iterator functions feat: extrinsic finiteness proofs for toList and toArray iterator functions Oct 15, 2025
@datokrat
Copy link
Contributor Author

!bench

@leanprover-radar
Copy link

leanprover-radar commented Oct 15, 2025

Benchmark results for 840c675 against 746206c are in! @datokrat

@datokrat datokrat changed the base branch from master to paul/base/iterators/extrinsic October 15, 2025 09:43
@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 840c675.
The entire run failed.
Found no significant differences.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Oct 15, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Oct 15, 2025

Mathlib CI status (docs):

  • ❗ Batteries CI can not be attempted yet, as the nightly-testing-2025-10-15 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Batteries CI should run now. You can force Mathlib CI using the force-mathlib-ci label. (2025-10-15 10:45:18)
  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2025-10-21 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. You can force Mathlib CI using the force-mathlib-ci label. (2025-10-21 10:44:26)
  • 🟡 Mathlib branch lean-pr-testing-10785 build this PR didn't complete normally. (2025-10-22 21:18:12) View Log
  • ✅ Mathlib branch lean-pr-testing-10785 has successfully built against this PR. (2025-10-23 14:59:06) View Log
  • ✅ Mathlib branch lean-pr-testing-10785 has successfully built against this PR. (2025-10-31 16:16:39) View Log

@leanprover-bot
Copy link
Collaborator

leanprover-bot commented Oct 15, 2025

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2025-10-15 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2025-10-15 10:45:19)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2025-10-21 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2025-10-21 10:44:27)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2025-10-30 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2025-10-31 15:12:58)

@datokrat
Copy link
Contributor Author

!radar

@leanprover-radar
Copy link

leanprover-radar commented Oct 15, 2025

Benchmark results for c3fe021 against 65315a6 are in! @datokrat

@datokrat
Copy link
Contributor Author

!bench

@leanprover-radar
Copy link

leanprover-radar commented Oct 16, 2025

Benchmark results for 7fd052b against 65315a6 are in! @datokrat

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 7fd052b.Found no runs to compare against.

@datokrat
Copy link
Contributor Author

!radar

@leanprover-radar
Copy link

leanprover-radar commented Oct 16, 2025

Benchmark results for 6854540 against 65315a6 are in! @datokrat

@datokrat datokrat changed the title feat: extrinsic finiteness proofs for toList and toArray iterator functions feat: extrinsic finiteness proofs for toList, toListRev and toArray on iterators Oct 16, 2025
@datokrat datokrat force-pushed the paul/base/iterators/extrinsic branch from 65315a6 to efbbb0b Compare October 21, 2025 09:35
@datokrat datokrat force-pushed the paul/iterators/extrinsic branch from 519b102 to ba26a69 Compare October 21, 2025 09:35
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 22, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Oct 22, 2025
@datokrat datokrat marked this pull request as ready for review October 23, 2025 13:14
@datokrat datokrat requested review from TwoFX and kim-em as code owners October 23, 2025 13:14
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 23, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Oct 23, 2025
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Oct 23, 2025
@@ -0,0 +1,158 @@
/-
Copy link
Member

@TwoFX TwoFX Oct 27, 2025

Choose a reason for hiding this comment

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

I'm not really qualified to review this file, but you have discussed it a lot, so I'll trust your judgement that it's good.

@datokrat datokrat force-pushed the paul/iterators/extrinsic branch from e75744d to 68090fc Compare October 31, 2025 14:12
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 31, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Oct 31, 2025
@datokrat datokrat force-pushed the paul/iterators/extrinsic branch from 68090fc to ba81065 Compare December 4, 2025 15:52
@datokrat
Copy link
Contributor Author

datokrat commented Dec 5, 2025

Closing in favor of #10863.

@datokrat datokrat closed this Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-mathlib CI has verified that Mathlib builds against this PR changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants