• 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
              • Defdigit-grouping-implementation
                • Defdigit-grouping-fn
                • Defdigit-grouping-find-exp
                  • Defdigit-grouping-macro-definition
              • 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
    • Defdigit-grouping-implementation

    Defdigit-grouping-find-exp

    Find the exponent exp that relates the smaller and larger bases.

    Signature
    (defdigit-grouping-find-exp smaller larger) → exp?
    Arguments
    smaller — Guard (dab-basep smaller).
    larger — Guard (dab-basep larger).
    Returns
    exp? — Type (maybe-posp exp?).

    This is the logarithm to base smaller of larger, i.e. the exponent exp such that larger is smaller^exp. If exp is not a positive integer, we return nil. If the two bases are the same, we return 1.

    Definitions and Theorems

    Function: defdigit-grouping-find-exp

    (defun defdigit-grouping-find-exp (smaller larger)
      (declare (xargs :guard (and (dab-basep smaller)
                                  (dab-basep larger))))
      (let ((__function__ 'defdigit-grouping-find-exp))
        (declare (ignorable __function__))
        (b* (((unless (mbt (and (dab-basep smaller)
                                (dab-basep larger))))
              nil)
             (larger2 (/ larger smaller))
             ((unless (posp larger2)) nil)
             ((when (= larger2 1)) 1)
             (exp2? (defdigit-grouping-find-exp smaller larger2))
             ((unless exp2?) nil))
          (1+ exp2?))))

    Theorem: maybe-posp-of-defdigit-grouping-find-exp

    (defthm maybe-posp-of-defdigit-grouping-find-exp
      (b* ((exp? (defdigit-grouping-find-exp smaller larger)))
        (maybe-posp exp?))
      :rule-classes :rewrite)