• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
          • Representation
            • Representation-of-integer-operations
            • Atc-arrays
            • Representation-of-integers
            • Representation-of-integer-conversions
            • Pointed-integers
              • Def-pointed-integer-operations
              • Def-pointed-integer-operations-loop
              • Ushort-write
              • Ullong-write
              • Sshort-write
              • Sllong-write
              • Ulong-write
              • Uint-write
              • Uchar-write
              • Slong-write
              • Sint-write
              • Schar-write
              • Ushort-read
              • Ullong-read
              • Sshort-read
              • Sllong-read
              • Ulong-read
              • Uint-read
              • Uchar-read
              • Slong-read
              • Sint-read
              • Schar-read
            • Shallow-deep-embedding-relation
          • Transformation-tools
          • Insertion-sort
          • Pack
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
        • Cryptography
        • Number-theory
        • Lists-light
        • Axe
        • Builtins
        • Solidity
        • Helpers
        • Htclient
        • Typed-lists-light
        • Arithmetic-light
      • X86isa
      • Axe
      • Execloader
    • Math
    • Testing-utilities
  • Representation

Pointed-integers

An ACL2 representation of C integers manipulated by pointers.

The representation of C integers in the shallow embedding is for C integers manipulated as values. In C, integers may also be manipulated by pointers: that is, given a pointer to an integer, it is possible to read and write that integer, via the indirection operator *.

Pointed-to-integers are represented in the same way as by-value integers, in our shallow embedding of C in ACL2. However, we introduce specific ACL2 operations to read and write pointed-to integers, which represent C code that accesses those integers by pointer.

We define a family of functions to read pointed-to integers. These are identities in ACL2, but they represent applications of indirection * to pointers in C.

We also define a family of functions to write pointed-to integers. They are also identity functions, but, as explained in the ATC user documentation, they are actually applied to the term that represents the expression whose value is being assigned to the pointed-to integer.

To support some level of type checking in the ACL2 representation of C code that uses pointed-to integers, we use the star wrapper (see pointer-types) in the guards of the readers and in the return theorems of the writers: each reader takes a pointed-to integer and returns an integer, and each writer takes an integer and returns a pointed-to integer. The star wrappers are all identities, but by keeping them disabled, one can enforce some type checking at the ACL2 level. (ATC makes all the necessary type checking anyhow, but these additional checks may be useful before calling ATC, when manipulating ACL2 representations of C code.)

Subtopics

Def-pointed-integer-operations
Event to generate operations on pointed integers of a given type.
Def-pointed-integer-operations-loop
Events to generate the operations on pointed integers of give types.
Ushort-write
Representation of a write of a pointed type unsigned short.
Ullong-write
Representation of a write of a pointed type unsigned long long.
Sshort-write
Representation of a write of a pointed type signed short.
Sllong-write
Representation of a write of a pointed type signed long long.
Ulong-write
Representation of a write of a pointed type unsigned long.
Uint-write
Representation of a write of a pointed type unsigned int.
Uchar-write
Representation of a write of a pointed type unsigned char.
Slong-write
Representation of a write of a pointed type signed long.
Sint-write
Representation of a write of a pointed type signed int.
Schar-write
Representation of a write of a pointed type signed char.
Ushort-read
Representation of a read of a pointed type unsigned short.
Ullong-read
Representation of a read of a pointed type unsigned long long.
Sshort-read
Representation of a read of a pointed type signed short.
Sllong-read
Representation of a read of a pointed type signed long long.
Ulong-read
Representation of a read of a pointed type unsigned long.
Uint-read
Representation of a read of a pointed type unsigned int.
Uchar-read
Representation of a read of a pointed type unsigned char.
Slong-read
Representation of a read of a pointed type signed long.
Sint-read
Representation of a read of a pointed type signed int.
Schar-read
Representation of a read of a pointed type signed char.