• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Abnf
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Pfcs
        • Soft
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • C
          • Atc
          • Language
            • Abstract-syntax
            • Integer-ranges
            • Dynamic-semantics
            • Static-semantics
            • Integer-formats
            • Types
            • Portable-ascii-identifiers
            • Values
              • Pointer
              • Member-types-of-member-values
              • Member-value-list->value-list
              • Member-value-list->name-list
              • Expr-value
              • Type-list-of-value-list
              • Type-of-value
              • Value-option
              • Init-value
              • Value-result
              • Type-of-value-option
                • Value-list-result
                • Member-value-list-result
                • Init-value-result
                • Expr-value-result
                • Value-option-result
                • Signed/unsigned-byte-p-of-integer-values
                • Member-type-of-member-value
                • Bounds-of-integer-values
                • Value-promoted-arithmeticp
                • Init-type-of-init-value
                • Value-unsigned-integerp
                • Value-signed-integerp
                • Value-integerp
                • Value-arithmeticp
                • Value-scalarp
                • Value-realp
                • Values/membervalues
              • Integer-operations
              • Computation-states
              • Object-designators
              • Implementation-environments
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Grammar
              • Bytes
              • Keywords
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Pack
          • Syntheto
          • File-io-light
          • Number-theory
          • Cryptography
          • Lists-light
          • Json
          • Axe
          • Builtins
          • Solidity
          • Std-extensions
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Values

    Type-of-value-option

    Type of an optional value.

    Signature
    (type-of-value-option val?) → type
    Arguments
    val? — Guard (value-optionp val?).
    Returns
    type — Type (typep type).

    This is the type of the value if the value is present, while it is void if the value is absent. This is a handy extension of type-of-value, given that, in the dynamic semantics, we model computations that may return void (e.g. function calls) as returning optional values, with nil for no value.

    Definitions and Theorems

    Function: type-of-value-option

    (defun type-of-value-option (val?)
      (declare (xargs :guard (value-optionp val?)))
      (let ((__function__ 'type-of-value-option))
        (declare (ignorable __function__))
        (value-option-case val?
                           :some (type-of-value val?.val)
                           :none (type-void))))

    Theorem: typep-of-type-of-value-option

    (defthm typep-of-type-of-value-option
      (b* ((type (type-of-value-option val?)))
        (typep type))
      :rule-classes :rewrite)

    Theorem: type-of-value-option-of-value-option-fix-val?

    (defthm type-of-value-option-of-value-option-fix-val?
      (equal (type-of-value-option (value-option-fix val?))
             (type-of-value-option val?)))

    Theorem: type-of-value-option-value-option-equiv-congruence-on-val?

    (defthm type-of-value-option-value-option-equiv-congruence-on-val?
      (implies (value-option-equiv val? val?-equiv)
               (equal (type-of-value-option val?)
                      (type-of-value-option val?-equiv)))
      :rule-classes :congruence)