• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
          • World
          • Io
          • Wormhole
          • Programming-with-state
          • W
          • Set-state-ok
          • Random$
            • Seed-random$
            • Random-list-aux
              • Random$-lemmas
              • Random-list
          • Memoize
          • Mbe
          • Io
          • Apply$
          • Defpkg
          • Mutual-recursion
          • Loop$
          • Programming-with-state
          • Arrays
          • Characters
          • Time$
          • Loop$-primer
          • Fast-alists
          • Defmacro
          • Defconst
          • Guard
          • Evaluation
          • Equality-variants
          • Compilation
          • Hons
          • ACL2-built-ins
          • System-attachments
          • Advanced-features
          • Set-check-invariant-risk
          • Developers-guide
          • Numbers
          • Irrelevant-formals
          • Efficiency
          • 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
          • Defmacro-untouchable
          • Primitive
          • <<
          • Revert-world
          • Set-duplicate-keys-action
          • Unmemoize
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Defopen
          • Sleep
        • Start-here
        • Real
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Random$

    Random-list-aux

    Add random numbers onto an accumulator.

    Definitions and Theorems

    Function: random-list-aux

    (defun random-list-aux (n limit acc state)
           (declare (xargs :guard (and (natp n)
                                       (posp limit)
                                       (true-listp acc))))
           (if (zp n)
               (mv (reverse acc) state)
               (b* (((mv x1 state) (random$ limit state)))
                   (random-list-aux (- n 1)
                                    limit (cons x1 acc)
                                    state))))

    Theorem: nat-listp-of-random-list-aux

    (defthm
     nat-listp-of-random-list-aux
     (implies
       (nat-listp acc)
       (equal (nat-listp (mv-nth 0 (random-list-aux n limit acc state)))
              (nat-listp acc))))

    Theorem: state-p1-of-random-list-aux

    (defthm
      state-p1-of-random-list-aux
      (implies (force (state-p1 state))
               (state-p1 (mv-nth 1
                                 (random-list-aux n limit acc state)))))