• 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-cast

    Execute a type cast on an expression value.

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

    We perform array-to-pointer conversion [C17:5.3.2.1/3] on the operand.

    Definitions and Theorems

    Function: exec-cast

    (defun exec-cast (tyname arg)
      (declare (xargs :guard (and (tynamep tyname)
                                  (expr-valuep arg))))
      (let ((__function__ 'exec-cast))
        (declare (ignorable __function__))
        (b* ((arg (apconvert-expr-value arg))
             ((when (errorp arg)) arg)
             (val (eval-cast tyname (expr-value->value arg)))
             ((when (errorp val)) val))
          (make-expr-value :value val
                           :object nil))))

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

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

    Theorem: exec-cast-of-tyname-fix-tyname

    (defthm exec-cast-of-tyname-fix-tyname
      (equal (exec-cast (tyname-fix tyname) arg)
             (exec-cast tyname arg)))

    Theorem: exec-cast-tyname-equiv-congruence-on-tyname

    (defthm exec-cast-tyname-equiv-congruence-on-tyname
      (implies (tyname-equiv tyname tyname-equiv)
               (equal (exec-cast tyname arg)
                      (exec-cast tyname-equiv arg)))
      :rule-classes :congruence)

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

    (defthm exec-cast-of-expr-value-fix-arg
      (equal (exec-cast tyname (expr-value-fix arg))
             (exec-cast tyname arg)))

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

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