• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
          • Directed-untranslate
          • Include-book-paths
          • Ubi
          • Numbered-names
            • Check-numbered-name
            • Next-numbered-name
            • Resolve-numbered-name-wildcard
            • Set-numbered-name-index
            • Next-fresh-numbered-names
            • Global-numbered-name-index
            • Make-numbered-name
            • Make-numbered-name-list
            • Set-numbered-name-index-to-global
            • Numbered-names-in-use
              • Max-numbered-name-index-in-use
                • Add-numbered-name-in-use
              • Next-fresh-numbered-name
              • Numbered-name-index-wildcard
              • Numbered-name-index-start
              • Numbered-name-index-end
            • Digits-any-base
            • 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
            • Message-utilities
            • Book-runes-alist
            • User-interface
            • Bits/ubyte11s-digit-grouping
            • Bits/bytes-digit-grouping
            • Subsetp-eq-linear
            • Oset-utilities
            • Strict-merge-sort-<
            • Miscellaneous-enumerations
            • Maybe-unquote
            • Thm<w
            • Defthmd<w
            • Io-utilities
          • Set
          • C
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Numbered-names-in-use

    Max-numbered-name-index-in-use

    Largest index of numbered name in use with a given base.

    Signature
    (max-numbered-name-index-in-use base wrld) → max-index
    Arguments
    base — Guard (symbolp base).
    wrld — Guard (plist-worldp wrld).
    Returns
    max-index — Type (natp max-index).

    Return the largest positive integer i such that the numbered name with base base and index i is in use (i.e. it is stored in the table). If no numbered name with base base is in use, return 0.

    Definitions and Theorems

    Function: max-numbered-name-index-in-use-aux

    (defun max-numbered-name-index-in-use-aux
           (indices current-max-index)
     (declare (xargs :guard (and (pos-listp indices)
                                 (natp current-max-index))))
     (let ((__function__ 'max-numbered-name-index-in-use-aux))
      (declare (ignorable __function__))
      (cond
       ((atom indices)
        (mbe :logic (nfix current-max-index)
             :exec current-max-index))
       (t
        (max-numbered-name-index-in-use-aux (cdr indices)
                                            (max (car indices)
                                                 current-max-index))))))

    Theorem: natp-of-max-numbered-name-index-in-use-aux

    (defthm natp-of-max-numbered-name-index-in-use-aux
     (b*
      ((final-max-index
        (max-numbered-name-index-in-use-aux indices current-max-index)))
      (natp final-max-index))
     :rule-classes :rewrite)

    Function: max-numbered-name-index-in-use

    (defun max-numbered-name-index-in-use (base wrld)
      (declare (xargs :guard (and (symbolp base)
                                  (plist-worldp wrld))))
      (let ((__function__ 'max-numbered-name-index-in-use))
        (declare (ignorable __function__))
        (let* ((tab (table-alist 'numbered-names-in-use
                                 wrld))
               (current-indices (cdr (assoc-eq base tab))))
          (max-numbered-name-index-in-use-aux current-indices 0))))

    Theorem: natp-of-max-numbered-name-index-in-use

    (defthm natp-of-max-numbered-name-index-in-use
      (b* ((max-index (max-numbered-name-index-in-use base wrld)))
        (natp max-index))
      :rule-classes :rewrite)