• 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

    Direct-supertype

    Return the direct supertype of a type, if any.

    Signature
    (direct-supertype type tops) → super?
    Arguments
    type — Guard (typep type).
    tops — Guard (toplevel-listp tops).
    Returns
    super? — Type (maybe-typep super?).

    Only a type defined as a subtype has a direct supertype, namely the one referenced in the subtype definition. All the other types do not.

    Definitions and Theorems

    Function: direct-supertype

    (defun direct-supertype (type tops)
      (declare (xargs :guard (and (typep type)
                                  (toplevel-listp tops))))
      (let ((__function__ 'direct-supertype))
        (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 nil
                    :subset (type-subset->supertype definer.get))))))

    Theorem: maybe-typep-of-direct-supertype

    (defthm maybe-typep-of-direct-supertype
      (b* ((super? (direct-supertype type tops)))
        (maybe-typep super?))
      :rule-classes :rewrite)

    Theorem: defined-type-when-direct-supertype

    (defthm defined-type-when-direct-supertype
      (implies (direct-supertype type tops)
               (type-case type :defined))
      :rule-classes :forward-chaining)

    Theorem: direct-supertype-of-type-fix-type

    (defthm direct-supertype-of-type-fix-type
      (equal (direct-supertype (type-fix type) tops)
             (direct-supertype type tops)))

    Theorem: direct-supertype-type-equiv-congruence-on-type

    (defthm direct-supertype-type-equiv-congruence-on-type
      (implies (type-equiv type type-equiv)
               (equal (direct-supertype type tops)
                      (direct-supertype type-equiv tops)))
      :rule-classes :congruence)

    Theorem: direct-supertype-of-toplevel-list-fix-tops

    (defthm direct-supertype-of-toplevel-list-fix-tops
      (equal (direct-supertype type (toplevel-list-fix tops))
             (direct-supertype type tops)))

    Theorem: direct-supertype-toplevel-list-equiv-congruence-on-tops

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