• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
          • Syntax-for-tools
          • Atc
          • Transformation-tools
          • Language
            • Abstract-syntax
            • Integer-ranges
            • Implementation-environments
            • Dynamic-semantics
              • Exec-expr
              • Exec
              • Exec-arrsub
              • Variable-resolution-preservation
              • Init-value-to-value
              • Apconvert-expr-value
              • Execution-limit-monotonicity
              • Exec-memberp
              • Exec-stmt
              • Exec-address
              • Init-scope
              • Exec-unary
              • Exec-member
              • Exec-fun
              • Exec-stmt-while
              • Eval-iconst
              • Exec-binary-strict-pure
              • Variable-visibility-preservation
              • Object-type-preservation
              • Eval-binary-strict-pure
              • Exec-block-item-list
              • Exec-indir
              • Exec-ident
              • Exec-block-item
              • Eval-cast
              • Frame-and-scope-peeling
              • Exec-expr-list
              • Exec-obj-declon
              • Exec-cast
              • Exec-const
              • Eval-unary
              • Exec-stmt-dowhile
              • Exec-initer
              • Eval-const
                • Execution-without-function-calls
              • Static-semantics
              • Grammar
              • Types
              • Integer-formats-definitions
              • Computation-states
              • Portable-ascii-identifiers
              • Values
              • Integer-operations
              • Object-designators
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Dynamic-semantics

    Eval-const

    Evaluate a constant.

    Signature
    (eval-const c) → val
    Arguments
    c — Guard (constp c).
    Returns
    val — Type (value-resultp val).

    We only support the evaluation of integer constants for now.

    Definitions and Theorems

    Function: eval-const

    (defun eval-const (c)
      (declare (xargs :guard (constp c)))
      (const-case c
                  :int (eval-iconst c.get)
                  :float (error :exec-const-float)
                  :enum (error :exec-const-enum)
                  :char (error :exec-const-char)))

    Theorem: value-resultp-of-eval-const

    (defthm value-resultp-of-eval-const
      (b* ((val (eval-const c)))
        (value-resultp val))
      :rule-classes :rewrite)

    Theorem: eval-const-of-const-fix-c

    (defthm eval-const-of-const-fix-c
      (equal (eval-const (const-fix c))
             (eval-const c)))

    Theorem: eval-const-const-equiv-congruence-on-c

    (defthm eval-const-const-equiv-congruence-on-c
      (implies (const-equiv c c-equiv)
               (equal (eval-const c)
                      (eval-const c-equiv)))
      :rule-classes :congruence)