• 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
            • Abstract-syntax
            • Integer-ranges
            • Implementation-environments
            • Dynamic-semantics
              • Exec
              • Exec-arrsub
              • Exec-expr-pure
              • Exec-expr-asg
              • Init-value-to-value
              • Exec-memberp
              • Apconvert-expr-value
              • Exec-address
                • Exec-member
                • Init-scope
                • Exec-unary
                • Exec-fun
                • Exec-block-item
                • Eval-iconst
                • Exec-binary-strict-pure
                • Exec-expr-pure-list
                • Eval-binary-strict-pure
                • Exec-block-item-list
                • Exec-indir
                • Exec-expr-call-or-pure
                • Exec-stmt-while
                • Exec-stmt
                • Exec-ident
                • Eval-cast
                • Exec-cast
                • Eval-unary
                • Exec-const
                • Exec-initer
                • Exec-expr-call-or-asg
                • Eval-const
                • Exec-expr-call
              • Static-semantics
              • Grammar
              • Integer-formats
              • Types
              • Portable-ascii-identifiers
              • Values
              • Integer-operations
              • Computation-states
              • Object-designators
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Bytes
              • Keywords
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • 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
    • Dynamic-semantics

    Exec-address

    Execute & on an expression value [C17:6.5.3.2/1] [C17:6.5.3.2/3].

    Signature
    (exec-address arg) → eval
    Arguments
    arg — Guard (expr-valuep arg).
    Returns
    eval — Type (expr-value-resultp eval).

    The expression that the operator & is applied to must be an lvalue [C17:6.5.3.2/1], which in our formalization means that we apply this operator to an expression value (returned by the lvalue). The expression value must contain an object designator, because otherwise the argument expression was not an lvalue. We extract the object designator and we return a pointer value, whose type is determined by the value in the expression value. We return the value as an expression value without object designator, for uniformity with other ACL2 functions for expression execution.

    Here we formalize the actual application of & to the expression value returned by an expression. We do not formalize here the fact that &*E is the same as E in the sense in that case neither * nor & are evaluated [C17:6.5.3.2/4], whether the * is explicit or implied by []; we formalize that elsewhere, while here we assume that the argument expression of & has been evaluated (because the special cases above do not hold), and the resulting expression value is passed here.

    We perform no array-to-pointer conversion, because that conversion is not performed for the operand of & [C17:6.3.2.1/3].

    Definitions and Theorems

    Function: exec-address

    (defun exec-address (arg)
      (declare (xargs :guard (expr-valuep arg)))
      (let ((__function__ 'exec-address))
        (declare (ignorable __function__))
        (b* ((objdes (expr-value->object arg))
             ((unless objdes)
              (error (list :not-lvalue-result (expr-value-fix arg))))
             (type (type-of-value (expr-value->value arg))))
          (make-expr-value
               :value (make-value-pointer :core (pointer-valid objdes)
                                          :reftype type)
               :object nil))))

    Theorem: expr-value-resultp-of-exec-address

    (defthm expr-value-resultp-of-exec-address
      (b* ((eval (exec-address arg)))
        (expr-value-resultp eval))
      :rule-classes :rewrite)

    Theorem: exec-address-of-expr-value-fix-arg

    (defthm exec-address-of-expr-value-fix-arg
      (equal (exec-address (expr-value-fix arg))
             (exec-address arg)))

    Theorem: exec-address-expr-value-equiv-congruence-on-arg

    (defthm exec-address-expr-value-equiv-congruence-on-arg
      (implies (expr-value-equiv arg arg-equiv)
               (equal (exec-address arg)
                      (exec-address arg-equiv)))
      :rule-classes :congruence)