lean4-htt/src/Std
Paul Reichert b5b34ee054
feat: List slices (#11019)
This PR introduces slices of lists that are available via slice notation
(e.g., `xs[1...5]`).

* Moved the `take` combinator and the `List` iterator producer to
`Init`.
* Introduced a `toTake` combinator: `it.toTake` behaves like `it`, but
it has the same type as `it.take n`. There is a constant cost per
iteration compared to `it` itself.
* Introduced `List` slices. Their iterators are defined as
`suffixList.iter.take n` for upper-bounded slices and
`suffixList.iter.toTake` for unbounded ones.

Performance characteristics of using the slice `list[a...b]`:

* when creating it: `O(a)`
* every iterator step: `O(1)`
* `toList`: `O(b - a + 1)` (given that a <= b)

Because the slice only stores a suffix of `xs` internally, two slices
can be equal even though the underlying lists differ in an irrelevant
prefix. Because the `stop` field is allowed to be beyond the list's
upper bound, the slices `[1][0...1]` and `[1][0...2]` are not equal,
even though they effectively cover the same range of the same list.
Improving this would require us to call `List.length` when building the
slice, which would iterate through the whole list.
2025-11-14 11:33:25 +00:00
..
Data feat: List slices (#11019) 2025-11-14 11:33:25 +00:00
Do chore: remove duplicate lemmas in Std.Do.SPred (#11006) 2025-10-29 07:26:24 +00:00
Internal refactor: do not use String.Iterator (#11127) 2025-11-11 11:46:58 +00:00
Net refactor: module-ize remainder of Std (#9195) 2025-07-17 11:43:57 +00:00
Sat chore: deprecate more duplications (#11004) 2025-10-30 05:58:29 +00:00
Sync chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
Tactic chore: deprecate more duplications (#11004) 2025-10-30 05:58:29 +00:00
Time chore: add deprecations for duplicated theorems (#10967) 2025-10-29 05:26:16 +00:00
Data.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Do.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Internal.lean refactor: module-ize remainder of Std (#9195) 2025-07-17 11:43:57 +00:00
Net.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Sat.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Sync.lean feat: add Std.CancellationToken type (#10510) 2025-10-07 03:21:45 +00:00
Tactic.lean refactor: module-ize remainder of Std (#9195) 2025-07-17 11:43:57 +00:00
Time.lean refactor: module-ize Std.Time (#9100) 2025-07-16 09:57:53 +00:00