• 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
            • Computation-states
            • Object-designators
              • Objdesign
                • Objdesign-fix
                • Objdesign-case
                • Objdesignp
                • Objdesign-count
                  • Objdesign-equiv
                  • Objdesign-auto
                  • Objdesign-member
                  • Objdesign-element
                  • Objdesign-static
                  • Objdesign-alloc
                  • Objdesign-kind
                • Address
                • Object-disjointp
                • Objdesign-option
              • 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
    • Objdesign

    Objdesign-count

    Measure for recurring over objdesign structures.

    Signature
    (objdesign-count x) → count
    Arguments
    x — Guard (objdesignp x).
    Returns
    count — Type (natp count).

    Definitions and Theorems

    Function: objdesign-count

    (defun objdesign-count (x)
      (declare (xargs :guard (objdesignp x)))
      (let ((__function__ 'objdesign-count))
        (declare (ignorable __function__))
        (case (objdesign-kind x)
          (:static 1)
          (:auto 1)
          (:alloc 1)
          (:element (+ 3
                       (objdesign-count (objdesign-element->super x))))
          (:member (+ 3
                      (objdesign-count (objdesign-member->super x)))))))

    Theorem: natp-of-objdesign-count

    (defthm natp-of-objdesign-count
      (b* ((count (objdesign-count x)))
        (natp count))
      :rule-classes :type-prescription)

    Theorem: objdesign-count-of-objdesign-fix-x

    (defthm objdesign-count-of-objdesign-fix-x
      (equal (objdesign-count (objdesign-fix x))
             (objdesign-count x)))

    Theorem: objdesign-count-objdesign-equiv-congruence-on-x

    (defthm objdesign-count-objdesign-equiv-congruence-on-x
      (implies (objdesign-equiv x x-equiv)
               (equal (objdesign-count x)
                      (objdesign-count x-equiv)))
      :rule-classes :congruence)

    Theorem: objdesign-count-of-objdesign-element

    (defthm objdesign-count-of-objdesign-element
      (implies t
               (< (+ (objdesign-count super))
                  (objdesign-count (objdesign-element super index))))
      :rule-classes :linear)

    Theorem: objdesign-count-of-objdesign-element->super

    (defthm objdesign-count-of-objdesign-element->super
      (implies (equal (objdesign-kind x) :element)
               (< (objdesign-count (objdesign-element->super x))
                  (objdesign-count x)))
      :rule-classes :linear)

    Theorem: objdesign-count-of-objdesign-member

    (defthm objdesign-count-of-objdesign-member
      (implies t
               (< (+ (objdesign-count super))
                  (objdesign-count (objdesign-member super name))))
      :rule-classes :linear)

    Theorem: objdesign-count-of-objdesign-member->super

    (defthm objdesign-count-of-objdesign-member->super
      (implies (equal (objdesign-kind x) :member)
               (< (objdesign-count (objdesign-member->super x))
                  (objdesign-count x)))
      :rule-classes :linear)