lean4-htt/src/Std
Paul Reichert 70b4b2b36c
feat: polymorphic ranges (#8784)
This PR introduces ranges that are polymorphic, in contrast to the
existing `Std.Range` which only supports natural numbers.

Breakdown of core changes:

* `Lean.Parser.Basic`: Modified the number parser (`Lean.Parser.Basic`)
so that it will only consider a *single* dot to be part of a decimal
number. `1..` will no longer be parsed as `1.` followed by `.`, but as
`1` followed by `..`.
* The test `ellipsisProjIssue` ensures that `#check Nat.add ...succ`
produces a syntax error. After introducing the new range notation (see
below), it returns a different (less nice) error message. I updated the
test to reflect the new error message. (The error message will become
nicer as soon as a delaborator for the ranges is implemented. This is
out of scope for this PR.)

Breakdown of standard library changes:

Modified modules: `Init.Data.Range.Polymorphic` (added),
`Init.Data.Iterators`, `Std.Data.Iterators`

* Introduced the type `Std.PRange` that is parameterized over the type
in which the range operates and the shapes of the lower and upper bound.
* Introduced a new notation for ranges. Examples for this notation are:
`1...*`, `1...=3`, `1...<3`, `1<...=2`, `*...=3`.
* Defined lots of typeclasses for different capabilities of ranges,
depending on their shape and underlying type.
* Introduced `Iter(M).size`.
* Introduced the `Iter(M).stepSize n` combinator, which iterates over an
iterator with the given step size `n`. It will drop `n - 1` values
between every value it emits.
* Replaced `LawfulPureIterator` with a new and better typeclass
`LawfulDeterministicIterator`.
* Simplified some lemma statements in the iterator library such as
`IterM.toList_eq_match`, which unnecessarily matched over a `Subtype`,
hindering rewrites due to type dependencies.

Reasons for the concrete choice of notation:

* `lean4-cli` uses `...`-based notation for the `Cmd` notation and it
clashes with `...a` range notation.
* test `2461` fails when using two-dot-based notation because of the
existing `{ a.. }` notation.
2025-06-26 08:18:11 +00:00
..
Classes chore: remove unused simp args (#8905) 2025-06-20 22:34:30 +00:00
Data feat: polymorphic ranges (#8784) 2025-06-26 08:18:11 +00:00
Internal feat: monadic interface for asynchronous operations in Std (#8003) 2025-06-26 02:51:26 +00:00
Net feat: add network interfaces (#7578) 2025-03-24 17:57:05 +00:00
Sat chore: remove unused simp args (#8905) 2025-06-20 22:34:30 +00:00
Sync chore: fix spelling mistakes (#8324) 2025-05-14 06:52:16 +00:00
Tactic chore: Revert "feat: Upstream MPL.SPred.* from mpl" (#8927) 2025-06-22 09:02:54 +00:00
Time chore: remove unused simp args (#8905) 2025-06-20 22:34:30 +00:00
Classes.lean feat: tree map data structures and operations (#6914) 2025-02-11 14:47:47 +00:00
Data.lean feat: minimal iterator library (#8358) 2025-05-20 14:53:57 +00:00
Internal.lean feat: implement basic async IO with timers (#6505) 2025-01-13 18:11:04 +00:00
Net.lean feat: Std.Net.Addr (#6563) 2025-01-09 09:33:03 +00:00
Sat.lean feat: Std.Sat.AIG (#4953) 2024-08-12 14:58:38 +00:00
Sync.lean feat: add Std.SharedMutex (#7770) 2025-04-03 08:30:54 +00:00
Tactic.lean chore: Revert "feat: Upstream MPL.SPred.* from mpl" (#8927) 2025-06-22 09:02:54 +00:00
Time.lean chore: fix spelling mistakes (#7328) 2025-04-07 01:15:48 +00:00