Skip to content

Conversation

@datokrat
Copy link
Contributor

@datokrat datokrat commented Sep 9, 2025

This PR "monomorphizes" the structure Std.PRange shape α, replacing it with nine distinct structures Std.Rcc, Std.Rco, Std.Rci etc., one for each possible shape of a range's bounds. This change was necessary because the shape polymorphism is detrimental to attempts of automation.

BREAKING CHANGE: While range/slice notation itself is unchanged, this essentially breaks the entire remaining (polymorphic) range and slice API except for the dot-notation(toList, iter, ...). It is not possible to deprecate old declarations that were formulated in a shape-polymorphic way that is not available anymore.

@datokrat datokrat changed the base branch from master to paul/ranges/ints September 9, 2025 18:31
@datokrat datokrat changed the base branch from paul/ranges/ints to master September 23, 2025 08:12
@github-actions github-actions bot added changes-stage0 Contains stage0 changes, merge manually using rebase and removed changes-stage0 Contains stage0 changes, merge manually using rebase labels Sep 23, 2025
@datokrat
Copy link
Contributor Author

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit f4372ef.
There were significant changes against commit d0d5d4c:

  Benchmark                            Metric                      Change
  ==================================================================================
- Init size                            bytes .olean                  2.3%
- Init size                            bytes .olean.private          2.3%
- Init size                            bytes .olean.server           1.9%
- Init.Data.BitVec.Lemmas re-elab      maxrss                        1.1%   (47.2 σ)
- Init.Data.List.Sublist re-elab -j4   maxrss                        1.4%   (36.3 σ)
+ bv_decide_inequality.lean            wall-clock                   -3.5%  (-83.9 σ)
+ iterators (compiled)                 branches                     -8.7% (-774.9 σ)
+ iterators (compiled)                 instructions                 -9.1% (-597.1 σ)
+ iterators (elab)                     branch-misses                -3.1%  (-28.0 σ)
+ iterators (elab)                     branches                     -4.1% (-242.6 σ)
+ iterators (elab)                     instructions                 -4.1% (-199.9 σ)
+ iterators (interpreted)              branches                     -1.8% (-649.2 σ)
+ iterators (interpreted)              instructions                 -1.8% (-727.2 σ)
- lake build clean                     maxrss                        1.3%   (22.9 σ)
+ lake config elab                     instructions                 -1.9%  (-79.3 σ)
+ stdlib                               grind dsimp                  -7.6%  (-32.1 σ)
- stdlib                               number of imported bytes      1.2%
- stdlib                               number of imported consts     1.5%
- stdlib size                          lines                         1.1%
+ treemap.lean                         eraseInsert                  -4.0%  (-39.2 σ)

@datokrat datokrat changed the title draft: make ranges less dependent refactor!: replace PRange shape α with Rcc α and eight other types Sep 23, 2025
@datokrat datokrat added the changelog-library Library label Sep 23, 2025
@datokrat datokrat changed the title refactor!: replace PRange shape α with Rcc α and eight other types refactor: replace PRange shape α with Rcc α and eight other types Sep 23, 2025
@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 Sep 23, 2025
@leanprover-bot
Copy link
Collaborator

leanprover-bot commented Sep 23, 2025

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2025-09-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-09-23 16:18:09)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2025-09-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-01 13:08:15)

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Sep 23, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Sep 23, 2025
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Sep 23, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Sep 23, 2025

Mathlib CI status (docs):

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Sep 24, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Sep 24, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Sep 24, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Sep 24, 2025
@leanprover-community-bot leanprover-community-bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Sep 24, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Sep 24, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Sep 24, 2025
@datokrat datokrat marked this pull request as ready for review September 25, 2025 06:25
@datokrat datokrat requested a review from zwarich as a code owner September 25, 2025 06:25
@datokrat datokrat added the will-merge-soon …unless someone speaks up label Sep 30, 2025
@datokrat datokrat force-pushed the paul/ranges/nondep branch from 73b1991 to a94c596 Compare October 1, 2025 10:00
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 1, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Oct 1, 2025
@datokrat datokrat added this pull request to the merge queue Oct 2, 2025
Merged via the queue into master with commit 89686fc Oct 2, 2025
23 of 24 checks passed
arthur-adjedj pushed a commit to arthur-adjedj/lean4 that referenced this pull request Oct 6, 2025
…leanprover#10319)

This PR "monomorphizes" the structure `Std.PRange shape α`, replacing it
with nine distinct structures `Std.Rcc`, `Std.Rco`, `Std.Rci` etc., one
for each possible shape of a range's bounds. This change was necessary
because the shape polymorphism is detrimental to attempts of automation.

**BREAKING CHANGE:** While range/slice notation itself is unchanged,
this essentially breaks the entire remaining (polymorphic) range and
slice API except for the dot-notation(`toList`, `iter`, ...). It is not
possible to deprecate old declarations that were formulated in a
shape-polymorphic way that is not available anymore.
@Kha Kha deleted the paul/ranges/nondep branch October 14, 2025 12:50
@Kha Kha restored the paul/ranges/nondep branch October 14, 2025 12:50
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 will-merge-soon …unless someone speaks up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants