• 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
        • 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
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • 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
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • 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)