• 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
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
        • Riscv
        • Bitcoin
        • Zcash
        • Yul
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
          • Process-syntheto-toplevel-fn
          • Translation
          • Language
            • Static-semantics
            • Abstract-syntax
            • Outcome
            • Abstract-syntax-operations
              • Subst-expression-fns
              • Field-list-to-typed-variable-list
              • Negate-expression
              • Get-function-definition-in-function-definitions
              • Get-function-definition
              • Get-type-definition-in-type-definitions
              • Get-type-definition
              • Get-function-specification
              • Get-type-subset
              • Get-alternative-product
              • Direct-supertype
              • Get-function-header-in-list
              • Equate-expression-lists
              • Get-field-type
              • Get-theorem
              • Get-defined-type-names-in-type-definitions
              • Disjoin-expressions
              • Conjoin-expressions
              • Get-type-product
              • Binary-op-nonstrictp
              • Get-type-sum
                • Get-defined-type-names
                • Equate-expressions
                • Field-to-typed-variable
                • Subst-expression
                • Binary-op-strictp
                • Initializer-list-from-flds-vals
                • Typed-variable-list->-expression-variable-list
                • Typed-variable-list->-expression
                • Variable-substitution
                • Local-variables
                • Identifier-list-names
                • Functions-called
                • Subst-expression-list
                • Subst-branch-list
                • Subst-branch
              • Outcome-list
              • Outcomes
            • Process-syntheto-toplevel
            • Shallow-embedding
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Abstract-syntax-operations

    Get-type-sum

    Return the type sum that defines a type, if any.

    Signature
    (get-type-sum type tops) → tprod
    Arguments
    type — Guard (typep type).
    tops — Guard (toplevel-listp tops).
    Returns
    tprod — Type (maybe-type-sump tprod).

    Definitions and Theorems

    Function: get-type-sum

    (defun get-type-sum (type tops)
      (declare (xargs :guard (and (typep type)
                                  (toplevel-listp tops))))
      (let ((__function__ 'get-type-sum))
        (declare (ignorable __function__))
        (type-case type :boolean nil :character nil :string
                   nil :integer nil :set nil :sequence
                   nil :map nil :option nil :defined
                   (b* ((typedef (get-type-definition type.name tops))
                        ((when (not typedef)) nil)
                        (definer (type-definition->body typedef))
                        ((when (not definer)) nil))
                     (type-definer-case definer
                                        :product nil
                                        :sum definer.get
                                        :subset nil)))))

    Theorem: maybe-type-sump-of-get-type-sum

    (defthm maybe-type-sump-of-get-type-sum
      (b* ((tprod (get-type-sum type tops)))
        (maybe-type-sump tprod))
      :rule-classes :rewrite)

    Theorem: get-type-sum-of-type-fix-type

    (defthm get-type-sum-of-type-fix-type
      (equal (get-type-sum (type-fix type) tops)
             (get-type-sum type tops)))

    Theorem: get-type-sum-type-equiv-congruence-on-type

    (defthm get-type-sum-type-equiv-congruence-on-type
      (implies (type-equiv type type-equiv)
               (equal (get-type-sum type tops)
                      (get-type-sum type-equiv tops)))
      :rule-classes :congruence)

    Theorem: get-type-sum-of-toplevel-list-fix-tops

    (defthm get-type-sum-of-toplevel-list-fix-tops
      (equal (get-type-sum type (toplevel-list-fix tops))
             (get-type-sum type tops)))

    Theorem: get-type-sum-toplevel-list-equiv-congruence-on-tops

    (defthm get-type-sum-toplevel-list-equiv-congruence-on-tops
      (implies (toplevel-list-equiv tops tops-equiv)
               (equal (get-type-sum type tops)
                      (get-type-sum type tops-equiv)))
      :rule-classes :congruence)