• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
          • Omaps
          • Directed-untranslate
          • Include-book-paths
          • Ubi
          • Numbered-names
          • Digits-any-base
            • Defdigits
            • Nat=>lendian*
            • Group-lendian
            • Defdigit-grouping
            • Ungroup-lendian
            • Lendian=>nat
            • Defthm-dab-return-types
            • Bendian=>nat
            • Nat=>bendian*
            • Trim-bendian*
            • Trim-lendian*
            • Nat=>lendian
            • Dab-digit-list-fix
            • Nat=>bendian
            • Ungroup-bendian
            • Group-bendian
            • Digits=>nat-injectivity-theorems
            • Dab-digit-listp
            • Nat=>lendian+
            • Dab-basep
            • Nat=>bendian+
            • Digits=>nat=>digits-inverses-theorems
            • Trim-lendian+
            • Trim-bendian+
            • Nat=>digits=>nat-inverses-theorems
            • Dab-digitp
            • Group/ungroup-inverses-theorems
            • Dab-digit-fix
            • Nat=>digits-injectivity-theorems
            • Dab-base
            • Digits-any-base-pow2
            • Dab-base-fix
          • Context-message-pair
          • With-auto-termination
          • Make-termination-theorem
          • Theorems-about-true-list-lists
          • Checkpoint-list
          • Sublis-expr+
          • Integers-from-to
          • Prove$
          • Defthm<w
          • System-utilities-non-built-in
          • Integer-range-fix
          • Minimize-ruler-extenders
          • Add-const-to-untranslate-preprocess
          • Unsigned-byte-fix
          • Signed-byte-fix
          • Defthmr
          • Paired-names
          • Unsigned-byte-list-fix
          • Signed-byte-list-fix
          • Show-books
          • Skip-in-book
          • Typed-tuplep
          • List-utilities
          • Checkpoint-list-pretty
          • Defunt
          • Keyword-value-list-to-alist
          • Magic-macroexpand
          • Top-command-number-fn
          • Bits-as-digits-in-base-2
          • Show-checkpoint-list
          • Ubyte11s-as-digits-in-base-2048
          • Named-formulas
          • Bytes-as-digits-in-base-256
          • String-utilities
          • Make-keyword-value-list-from-keys-and-value
          • Defmacroq
          • Integer-range-listp
          • Apply-fn-if-known
          • Trans-eval-error-triple
          • Checkpoint-info-list
          • Previous-subsumer-hints
          • Fms!-lst
          • Zp-listp
          • Trans-eval-state
          • Injections
          • Doublets-to-alist
          • Theorems-about-osets
          • Typed-list-utilities
          • Book-runes-alist
          • User-interface
          • Bits/ubyte11s-digit-grouping
          • Bits/bytes-digit-grouping
          • Message-utilities
          • Subsetp-eq-linear
          • Oset-utilities
          • Strict-merge-sort-<
          • Miscellaneous-enumerations
          • Maybe-unquote
          • Thm<w
          • Defthmd<w
          • Io-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
        • Cryptography
        • Number-theory
        • Lists-light
        • Axe
        • Builtins
        • Solidity
        • Helpers
        • Htclient
        • Typed-lists-light
        • Arithmetic-light
      • X86isa
      • Axe
      • Execloader
    • Math
    • Testing-utilities
  • Kestrel-utilities

Digits-any-base

Conversions between natural numbers and their representations as digits in arbitrary bases.

In these utilities, the digits are natural numbers below the base. The base (a natural number above 1) is supplied as argument.

There are conversions for big-endian and little-endian representations. There are conversions to represent natural numbers as lists of digits of fixed length, of minimum length, and of minimum non-zero length.

The names of some functions in these utilities start with dab, which stands for `digits any base'. Without this prefix, the names seem too ``general''.

Subtopics

Defdigits
Generate specialized versions of the operations to convert between natural numbers and digits, using specified existing recognizers and fixers for the digits.
Nat=>lendian*
Convert a natural number to its minimum-length little-endian list of digits.
Group-lendian
Group digits from a smaller base to a larger base, little-endian.
Defdigit-grouping
Generate specialized versions of the operations to group and ungroup digits in arbitrary bases, based on existing instances of defdigits.
Ungroup-lendian
Ungroup digits from a larger base to a smaller base, little-endian.
Lendian=>nat
Convert a little-endian list of digits to their value.
Defthm-dab-return-types
Introduce additional return type theorems for the conversions from natural numbers to digits.
Bendian=>nat
Convert a big-endian list of digits to their value.
Nat=>bendian*
Convert a natural number to its minimum-length big-endian list of digits.
Trim-bendian*
Remove all the most significant zero digits from a big-endian representation.
Trim-lendian*
Remove all the most significant zero digits from a little-endian representation.
Nat=>lendian
Convert a natural number to its little-endian list of digits of specified length.
Dab-digit-list-fix
Fixing function for dab-digit-listp.
Nat=>bendian
Convert a natural number to its big-endian list of digits of specified length.
Ungroup-bendian
Ungroup digits from a larger base to a smaller base, little-endian.
Group-bendian
Group digits from a smaller base to a larger base, big-endian.
Digits=>nat-injectivity-theorems
Theorems about the injectivity of the conversions from digits to natural numbers.
Dab-digit-listp
Recognize true lists of digits in the specified base.
Nat=>lendian+
Convert a natural number to its non-empty minimum-length little-endian list of digits.
Dab-basep
Recognize valid bases for representing natural numbers as digits.
Nat=>bendian+
Convert a natural number to its non-empty minimum-length big-endian list of digits.
Digits=>nat=>digits-inverses-theorems
Theorems about converting digits to natural numbers and back.
Trim-lendian+
Remove all the most significant zero digits from a little-endian representation, but leave one zero if all the digits are zero.
Trim-bendian+
Remove all the most significant zero digits from a big-endian representation, but leave one zero if all the digits are zero.
Nat=>digits=>nat-inverses-theorems
Theorems about converting natural numbers to digits and back.
Dab-digitp
Recognize valid digits for representing natural numbers as digits in the specified base.
Group/ungroup-inverses-theorems
Theorems about grouping and ungrouping digits.
Dab-digit-fix
Fixing function for dab-digitp.
Nat=>digits-injectivity-theorems
Theorems about the injectivity of the conversions from natural numbers to digits.
Dab-base
Fixtype for dab-basep.
Digits-any-base-pow2
Conversions between natural numbers and their representations as digits in power-of-two bases.
Dab-base-fix
Fixing function for dab-basep.