• 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
            • Static-semantics
            • Grammar
            • Integer-formats
            • Types
            • Portable-ascii-identifiers
            • Values
            • Integer-operations
            • Computation-states
            • Object-designators
            • Operations
              • Bitxor-values
              • Bitior-values
              • Bitand-values
              • Shr-values
              • Shl-values
              • Test-value
                • Rem-values
                • Lt-values
                • Le-values
                • Gt-values
                • Ge-values
                • Sub-values
                • Mul-values
                • Div-values
                • Add-values
                • Ne-values
                • Eq-values
                • Bitnot-value
                • Plus-value
                • Minus-value
                • Lognot-value
              • 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
    • Operations

    Test-value

    Test a value logically.

    Signature
    (test-value val) → res
    Arguments
    val — Guard (valuep val).
    Returns
    res — Type (boolean-resultp res).

    In some contexts (e.g. conditional tests), a value is treated as a logical boolean. The value must be scalar; see test-scalar-value for details.

    Definitions and Theorems

    Function: test-value

    (defun test-value (val)
      (declare (xargs :guard (valuep val)))
      (let ((__function__ 'test-value))
        (declare (ignorable __function__))
        (if (value-scalarp val)
            (test-scalar-value val)
          (error (list :test-mistype
                       :required :scalar
                       :supplied (value-fix val))))))

    Theorem: boolean-resultp-of-test-value

    (defthm boolean-resultp-of-test-value
      (b* ((res (test-value val)))
        (boolean-resultp res))
      :rule-classes :rewrite)

    Theorem: test-value-of-value-fix-val

    (defthm test-value-of-value-fix-val
      (equal (test-value (value-fix val))
             (test-value val)))

    Theorem: test-value-value-equiv-congruence-on-val

    (defthm test-value-value-equiv-congruence-on-val
      (implies (value-equiv val val-equiv)
               (equal (test-value val)
                      (test-value val-equiv)))
      :rule-classes :congruence)