lean4-htt/src/Init/Data
Markus Himmel dca8d6d188
refactor: discipline around arithmetic of String.Pos.Raw (#10713)
This PR enforces rules around arithmetic of `String.Pos.Raw`.

Specifically, it adopts the following conventions:

- Byte indices ("ordinals") in strings should be represented using
`String.Pos.Raw`
- Amounts of bytes ("cardinals") in strings should be represented using
`Nat`.

For example, `String.Slice.utf8ByteSize` now returns `Nat` instead of
`String.Pos.Raw`, and there is a new function `String.Slice.rawEndPos`.

Finally, the `HAdd` and `HSub` instances for `String.Pos.Raw` are
reorganized. This is a **breaking change**.

The `HAdd/HSub String.Pos.Raw String.Pos.Raw String.Pos.Raw` instances
have been removed. For the use case of tracking positions relative to
some other position, we instead provide `offsetBy` and `unoffsetBy`
functions. For the use case of advancing/unadvancing a position by an
arbitrary number of bytes, we instead provide `increaseBy` and
`decreaseBy` functions. For
offsetting/unoffsetting/advancing/unadvancing a position `p` by the size
of a string `s` (resp. character `c`), use `s + p`/`p - s`/`p + s`/`p -
s` (resp. `c + p`/`p - c`/`p + c`/`p - c`).
2025-10-09 07:47:45 +00:00
..
Array chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
BitVec perf: shorten critical build path around String.Basic (#10614) 2025-09-29 19:45:21 +00:00
ByteArray chore: docstring review for ByteArray (#10632) 2025-10-02 04:20:18 +00:00
Char chore: reorganize Init imports around strings (#10289) 2025-09-07 17:09:14 +00:00
Dyadic refactor: structural recursion: prove .eq_def directly (#10606) 2025-10-07 12:53:09 +00:00
Fin chore: more module system fixes and improvements from Mathlib porting (#10655) 2025-10-08 11:30:09 +00:00
FloatArray chore: remove bootstrap tricks from #9951 (#10203) 2025-09-01 13:30:42 +00:00
Format chore: rename String.Pos to String.Pos.Raw (#10624) 2025-10-01 07:45:24 +00:00
Int chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Iterators feat: add lemmas about iterator fold and map interactions (#10653) 2025-10-06 16:12:13 +00:00
List chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Nat fix: Nat.and_distrib_right -> Nat.and_or_distrib_right (#10649) 2025-10-07 12:57:46 +00:00
Option chore: remove unhelpful grind annotations (#10435) 2025-09-24 03:02:46 +00:00
Ord perf: shorten critical build path around String.Basic (#10614) 2025-09-29 19:45:21 +00:00
Order chore: further cleanup from shaking Init (#10658) 2025-10-02 17:29:00 +00:00
Range refactor: improve naming in the range API (#10537) 2025-10-06 20:51:09 +00:00
Rat chore: cleanups uncovered by Shake (#10572) 2025-09-26 14:38:30 +00:00
SInt fix: expose Int* definitions for simprocs and decide (fixes #10546) (#10631) 2025-10-01 15:53:02 +00:00
Slice chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
String refactor: discipline around arithmetic of String.Pos.Raw (#10713) 2025-10-09 07:47:45 +00:00
Subtype feat: integrate high-level order typeclasses with BEq and Ord (#9908) 2025-08-19 07:54:53 +00:00
Sum chore: missing grind modifiers and local grind theorems config (#10428) 2025-09-17 16:15:16 +00:00
ToString chore: use UTF8 instead of Utf8 in identifiers (#10636) 2025-10-01 17:57:32 +00:00
UInt feat: new String.Slice API (#10514) 2025-09-25 12:18:52 +00:00
Vector chore: rename Stream to Std.Stream (#10645) 2025-10-02 15:25:56 +00:00
AC.lean refactor: module-ize remainder of Std (#9195) 2025-07-17 11:43:57 +00:00
Array.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Basic.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
BEq.lean feat: integrate high-level order typeclasses with BEq and Ord (#9908) 2025-08-19 07:54:53 +00:00
BitVec.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Bool.lean chore: reorganize Init imports around strings (#10289) 2025-09-07 17:09:14 +00:00
ByteArray.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Cast.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Char.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Dyadic.lean feat: (approximate) inverses of dyadic rationals (#10194) 2025-09-02 03:43:53 +00:00
Fin.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Float.lean chore: remove bootstrap tricks from #9951 (#10203) 2025-09-01 13:30:42 +00:00
Float32.lean chore: remove bootstrap tricks from #9951 (#10203) 2025-09-01 13:30:42 +00:00
FloatArray.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Format.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Function.lean feat: helper definitions for injective function support in grind (#10445) 2025-09-18 19:42:15 +00:00
Hashable.lean chore: rename String.Pos to String.Pos.Raw (#10624) 2025-10-01 07:45:24 +00:00
Int.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Iterators.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
LawfulHashable.lean perf: shorten critical build path around String.Basic (#10614) 2025-09-29 19:45:21 +00:00
List.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Nat.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
NeZero.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
OfScientific.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Option.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Ord.lean perf: shorten critical build path around String.Basic (#10614) 2025-09-29 19:45:21 +00:00
Order.lean feat: package factories for order typeclasses (#9797) 2025-08-19 13:43:29 +00:00
PLift.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Prod.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Queue.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Random.lean chore: reorganize Init imports around strings (#10289) 2025-09-07 17:09:14 +00:00
Range.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
RArray.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Rat.lean feat: upstream definition of Rat from Batteries (#9957) 2025-08-19 01:58:24 +00:00
Repr.lean chore: rename String.Pos to String.Pos.Raw (#10624) 2025-10-01 07:45:24 +00:00
SInt.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Slice.lean chore: cleanups uncovered by Shake (#10572) 2025-09-26 14:38:30 +00:00
Stream.lean chore: rename Stream to Std.Stream (#10645) 2025-10-02 15:25:56 +00:00
String.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Subtype.lean feat: high-level order typeclasses (#9729) 2025-08-11 14:55:17 +00:00
Sum.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
ToString.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
UInt.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
ULift.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Vector.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Zero.lean chore: module system fixes and refinements from Mathlib porting (#10643) 2025-10-02 08:28:08 +00:00