• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
      • B*
      • Defunc
      • Fty
      • Apt
      • Std/util
      • Defdata
      • Defrstobj
      • Seq
      • Match-tree
      • Defrstobj
      • With-supporters
      • Def-partial-measure
      • Template-subst
      • Soft
      • Defthm-domain
      • Event-macros
      • Def-universal-equiv
      • Def-saved-obligs
      • With-supporters-after
      • Definec
      • Sig
      • Outer-local
      • Data-structures
        • Deflist
        • Defalist
        • Memory
          • Private
          • Size
          • Store
          • New
          • Address-p
          • Memory-p
          • Load
        • Defstructure
        • Array1
        • Utilities
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Data-structures
  • Misc/records

Memory

Special records designed for array-like usage.

Loading the library:

(include-book "data-structures/memories" :dir :system)

Memories are specialized records that are designed for array-like usage. Memories have a fixed size, and elements are accessed by the natural numbers 0, 1, ..., size-1, where size is the maximum size of the memory.

Unlike arrays, memories are based on trees. As a result, loading and storing into memories is slower than array access in a typical programming language, and requires an O(log_2 n) search for the right element. However, there are benefits to this system as well. We populate the tree structure as needed when writes occur, allowing us to conceptually represent very large arrays so long as we use them sparesely. Hence, memories are well suited for uses such as simulating the memory systems of processors or virtual machines with many gigabytes of memory, only some of which is used during simulation.

Memories are as easy to reason about as records (see misc/records.lisp) and we provide the same core 'record theorems' about them. However, the load and store operations on memories are guarded more strongly than the records book, in order to achieve efficiency.

See also ACL2::arrays and ACL2::stobjs for more efficient implementations of small arrays. The records book, misc/records.lisp, provides the same reasoning strategy as memories, and may be an appropriate substitution for memories depending upon your needs.

Subtopics

Private
Redundantly define, then serverely restrict the usage of some function.
Size
Returns the capacity of a memory structure.
Store
Update memory, overwriting an address with a new value.
New
Create a new memory object with a given capacity.
Address-p
Recognizes valid addresses for a particular memory.
Memory-p
Recognizes valid memory structures.
Load
Access memory, retrieving the value at some address.