• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
          • Saving-event-data
          • Trans-eval
          • System-utilities-non-built-in
            • Pseudo-event-formp
            • Pseudo-event-form-listp
            • Directed-untranslate
            • Irrelevant-formals-info
            • 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
              • Context-message-pair
              • Prove$
              • Minimize-ruler-extenders
              • Paired-names
              • Orelse
              • Fresh-name-in-world-with-$s
              • Encapsulate-report-errors
              • On-failure
              • Chk-irrelevant-formals-ok
              • Named-formulas
              • Pseudo-event-landmarkp
              • All-program-fns
              • All-logic-fns
              • Trans-eval-error-triple
              • Trans-eval-state
              • Pseudo-tests-and-callsp
              • User-interface
              • Pseudo-command-landmarkp
              • Pseudo-tests-and-calls-listp
              • Pseudo-command-formp
              • Orelse*
              • Identity-macro
            • Get-event-data
            • Untranslate
            • Constraint-info
          • Stobj
          • State
          • Mutual-recursion
          • Memoize
          • Mbe
          • Io
          • Defpkg
          • Apply$
          • Loop$
          • Programming-with-state
          • Arrays
          • Characters
          • Time$
          • Defconst
          • Fast-alists
          • Defmacro
          • Loop$-primer
          • Evaluation
          • Guard
          • Equality-variants
          • Compilation
          • Hons
          • ACL2-built-ins
          • Developers-guide
          • System-attachments
          • Advanced-features
          • Set-check-invariant-risk
          • Numbers
          • Efficiency
          • Irrelevant-formals
          • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
          • Redefining-programs
          • Lists
          • Invariant-risk
          • Errors
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Miscellaneous
        • Output-controls
        • Bdd
        • Macros
        • Installation
        • Mailing-lists
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • 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)