• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
                • Execution
                • Values
                  • Int-valuep
                  • Value-option
                  • Type-of-value
                  • Value-option-result
                  • Value-list-result
                  • Name+value
                  • Value-result
                  • Make-int-value
                  • Type-map-of-value-map
                  • Name+type-of-name+value
                  • Int-value-bound-theorems
                  • Int-value-to-int
                  • Int-value-numbits
                    • Value/valuelist
                    • *most-positive-i8*
                    • *most-positive-i64*
                    • *most-positive-i32*
                    • *most-positive-i16*
                    • *most-positive-i128*
                    • *most-negative-i8*
                    • *most-negative-i64*
                    • *most-negative-i32*
                    • *most-negative-i16*
                    • *most-negative-i128*
                    • *greatest-u8*
                    • *greatest-u64*
                    • *greatest-u32*
                    • *greatest-u16*
                    • *greatest-u128*
                  • Dynamic-environments
                  • Arithmetic-operations
                  • Curve-parameterization
                  • Shift-operations
                  • Errors
                  • Value-expressions
                  • Locations
                  • Input-execution
                  • Edwards-bls12-generator
                  • Equality-operations
                  • Logical-operations
                  • Program-execution
                  • Ordering-operations
                  • Bitwise-operations
                  • Literal-evaluation
                  • Type-maps-for-struct-components
                  • Output-execution
                  • Tuple-operations
                  • Struct-operations
                • Compilation
                • Static-semantics
                • Concrete-syntax
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Values

    Int-value-numbits

    Returns the number of bits that a value of this kind could take.

    Signature
    (int-value-numbits int-v) → result
    Arguments
    int-v — Guard (int-valuep int-v).
    Returns
    result — Type (natp result), given the guard.

    The integer value of int-v is ignored; just its kind is looked at. The size of the kind in bits is returned.

    Definitions and Theorems

    Function: int-value-numbits

    (defun int-value-numbits (int-v)
      (declare (xargs :guard (int-valuep int-v)))
      (let ((__function__ 'int-value-numbits))
        (declare (ignorable __function__))
        (case (value-kind int-v)
          (:u8 8)
          (:u16 16)
          (:u32 32)
          (:u64 64)
          (:u128 128)
          (:i8 8)
          (:i16 16)
          (:i32 32)
          (:i64 64)
          (:i128 128)
          (t (prog2$ (impossible) 0)))))

    Theorem: natp-of-int-value-numbits

    (defthm natp-of-int-value-numbits
      (implies (and (int-valuep int-v))
               (b* ((result (int-value-numbits int-v)))
                 (natp result)))
      :rule-classes :rewrite)