• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • 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
          • Std/strings
          • String-listp
          • Stringp
          • Length
          • Search
          • Remove-duplicates
          • Position
          • Coerce
          • Concatenate
          • Reverse
            • Nrev
              • Nrev-set-hint
              • Nrev-finish
              • Nrev-copy
                • Nrev-push
                • Nrev-fix
                • Nrev-demo
                • Nrev-stobj
                • Nrev2
                • Nrev-append
                • With-local-nrev
                • Nrev$c
              • Rev
              • Std/lists/reverse
              • Hons-reverse
            • String
            • Subseq
            • Substitute
            • String-upcase
            • String-downcase
            • Count
            • Char
            • String<
            • String-equal
            • String-utilities
            • String-append
            • String>=
            • String<=
            • String>
            • Hex-digit-char-theorems
            • String-downcase-gen
            • String-upcase-gen
          • 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
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Nrev

    Nrev-copy

    Slow operation to copy the current contents of nrev, without destroying it.

    Signature: (nrev-copy nrev) → list

    This is an unusual, expensive operation. It may occasionally be useful as a way to inspect the contents of nrev without modifying nrev.

    In the logic, this just returns (list-fix nrev).

    In the pure ACL2 implementation, the underlying representation of nrev keeps the elements in reverse order, so nrev-copy just calls reverse to reverse these elements and give you a list in the proper order. This, of course, takes O(n) conses.

    In the optimized implementation, we similarly need to create a copy of the current contents of nrev, so this again takes O(n) conses.

    Definitions and Theorems

    Function: nrev$a-copy

    (defun nrev$a-copy (nrev$a)
      (declare (xargs :guard t))
      (list-fix nrev$a))

    Function: nrev$c-copy

    (defun nrev$c-copy (nrev$c)
      (declare (xargs :stobjs nrev$c))
      (reverse (nrev$c-acc nrev$c)))