Skip to content

feat: add little-endian numeral notation conversions for positive, N, Z#278

Draft
JasonGross wants to merge 1 commit into
rocq-prover:masterfrom
JasonGross:littleendian-numeral-notation
Draft

feat: add little-endian numeral notation conversions for positive, N, Z#278
JasonGross wants to merge 1 commit into
rocq-prover:masterfrom
JasonGross:littleendian-numeral-notation

Conversation

@JasonGross

Copy link
Copy Markdown
Member

Summary

  • Adds little-endian conversion functions (of_luint/to_luint, of_lint/to_lint, etc.) for positive, N, and Z
  • Sets up Number Notation declarations with (little endian) option for all numeric scopes
  • Motivated by lia (zify) fails to recognize large nat literals rocq#22122: with little-endian digit lists, zify can provide smooth support for large number literals

Details

The little-endian conversions simply reverse digits then delegate to existing big-endian conversions (for parsing), or skip the final reversal (for printing). For example:

  • Pos.of_luint d := Pos.of_uint (Decimal.rev d)
  • Pos.to_luint p := Pos.to_little_uint p (already exists, was only used internally)

Files changed

  • theories/PArith/BinPosDef.v + BinPos.v — positive conversions
  • theories/NArith/BinNatDef.v + BinNat.v — N conversions
  • theories/ZArith/BinIntDef.v + BinInt.v — Z conversions

Dependency

Requires rocq-prover/rocq#22135 for the (little endian) grammar option.

Test plan

  • BinPosDef.vo, BinNatDef.vo, BinIntDef.vo compile
  • BinPos.vo, BinNat.vo, BinInt.vo compile
  • Full stdlib build (in progress)
  • CI

🤖 Generated with Claude Code

Add little-endian conversion functions using the new Decimal.luint/lint,
Hexadecimal.luint/lint, and Number.luint/lint wrapper types from
corelib. These functions reverse the digit list and delegate to the
existing big-endian converters, keeping the implementation minimal.

The existing big-endian Number Notations are unchanged; the LE
conversion functions are provided for downstream use.

Depends on: rocq-prover/rocq#22135

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ttctspSoVoquHLQtbPVZw
@JasonGross JasonGross force-pushed the littleendian-numeral-notation branch from 3b2aeec to 6261f8a Compare June 20, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant