• 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
              • Convert-integer-value
              • Result-integer-value
              • Uaconvert-values
              • Bitnot-integer-value
              • Bitand-integer-values
              • Promote-value
              • Rem-integer-values
              • Shr-integer-values
              • Shl-integer-values
              • Value-integer
              • Div-integer-values
              • Bitxor-integer-values
              • Bitior-integer-values
              • Sub-integer-values
              • Mul-integer-values
              • Add-integer-values
              • Ne-integer-values
              • Lt-integer-values
              • Le-integer-values
              • Gt-integer-values
              • Ge-integer-values
              • Eq-integer-values
              • Minus-integer-value
              • Plus-integer-value
              • Value-integer->get
              • Lognot-integer-value
              • Test-integer-value
                • Value-integer-and-value-integer->get
              • 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
    • Integer-operations

    Test-integer-value

    Test an integer value logically.

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

    In some contexts (e.g. conditional tests), an integer is treated as a logical boolean: false if 0, true if not 0. This is captured by this ACL2 function.

    Definitions and Theorems

    Function: test-integer-value

    (defun test-integer-value (val)
      (declare (xargs :guard (valuep val)))
      (declare (xargs :guard (value-integerp val)))
      (let ((__function__ 'test-integer-value))
        (declare (ignorable __function__))
        (not (equal (value-integer->get val) 0))))

    Theorem: booleanp-of-test-integer-value

    (defthm booleanp-of-test-integer-value
      (b* ((res (test-integer-value val)))
        (booleanp res))
      :rule-classes :rewrite)

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

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

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

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