Skip to content

feat: lemmas about step size iterators#12748

Open
datokrat wants to merge 18 commits intomasterfrom
paul/humanevup-33
Open

feat: lemmas about step size iterators#12748
datokrat wants to merge 18 commits intomasterfrom
paul/humanevup-33

Conversation

@datokrat
Copy link
Copy Markdown
Contributor

@datokrat datokrat commented Mar 1, 2026

This PR provides lemmas about the it.stepSize n iterator.

@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 Mar 1, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2026-03-01 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. (2026-03-01 16:44:57)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

leanprover-bot commented Mar 1, 2026

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-03-01 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. (2026-03-01 16:44:58)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-03-05 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. (2026-03-09 21:40:11)

@datokrat
Copy link
Copy Markdown
Contributor Author

datokrat commented Mar 2, 2026

!radar

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Mar 2, 2026

Benchmark results for 38d20b0 against 3ea59e1 are in! @datokrat

  • 🟥 build//instructions: +24.1G (+0.19%)

Large changes (1🟥)

  • 🟥 size/Init/.olean.private//bytes: +3MiB (+1.09%)

Small changes (2✅, 21🟥)

Too many entries to display here. View the full report on radar instead.

@datokrat datokrat added the changelog-library Library label Mar 2, 2026
datokrat and others added 18 commits March 9, 2026 21:27
This PR adds comprehensive verification lemmas for the stepSize iterator
combinator, including atIdxSlow?_stepSize, atIdxSlow?_intermediate_stepSize,
and getElem?_toList_stepSize. It also proves the sorry in
IterM.atIdxSlow?_eq_match, adds a missing docstring for
Iter.IsPlausibleNthOutputStep, and fixes unused variable warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This PR adds a theorem proving that the length of a stepSize iterator
relates to the original iterator's length via ceiling division:
`(it.stepSize n).length = (it.length + (n - 1)) / (n - 1 + 1)`.

Also adds the generalized intermediate version `length_intermediate_stepSize`
and supporting helper lemmas connecting `nextAtIdxSlow?` results to length
bounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This PR provides a LawfulDeterministicIterator instance for
StepSizeIterator, proving that the stepSize combinator preserves
determinism when the base iterator is deterministic. Also removes
commented-out code from previous incomplete attempts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d combinators

This PR adds LawfulDeterministicIterator instances for ListIterator,
ArrayIterator, Zipper, AssocListIterator, FilterMap (pure), Map (pure),
and Flatten combinators, enabling deterministic reasoning about
tree map and hash map iterators built from these components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This PR adds a theorem relating toArray indexing on stepSize iterators
to toArray indexing on the underlying iterator, complementing the
existing toList and atIdxSlow? versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…xoIterator

This PR adds LawfulDeterministicIterator instances for the tree map range
iterators RxcIterator and RxoIterator, complementing the existing Zipper
instance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@datokrat datokrat force-pushed the paul/humanevup-33 branch from 38d20b0 to 9f7df0e Compare March 9, 2026 20:41
@datokrat datokrat marked this pull request as ready for review March 9, 2026 20:42
@datokrat datokrat requested a review from TwoFX as a code owner March 9, 2026 20:42
mathlib-nightly-testing bot pushed a commit to leanprover-community/batteries that referenced this pull request Mar 9, 2026
@github-actions github-actions bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Mar 9, 2026
mathlib-nightly-testing bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Mar 9, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

@mathlib-lean-pr-testing mathlib-lean-pr-testing bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Mar 9, 2026
@datokrat datokrat added this pull request to the merge queue Mar 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 10, 2026
@datokrat datokrat added this pull request to the merge queue Mar 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 10, 2026
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 mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

3 participants