• 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
          • Atj
            • Atj-implementation
              • Atj-types
              • Atj-java-primitive-array-model
              • Atj-java-abstract-syntax
                • Jbinop
                • Jmethod
                • Jtype
                  • Jtype-case
                  • Jtypep
                  • Jtype-fix
                  • Jtype-equiv
                  • Jtype-count
                    • Jtype-prim
                    • Jtype-class
                    • Jtype-array
                    • Jtype-kind
                  • Jfield
                  • Jexprs
                  • Jliteral
                  • Junop
                  • Jlocvar
                  • Jcunit
                  • Jaccess
                  • Maybe-jexpr
                  • Jparam
                  • Jimport
                  • Jcinitializer
                  • Jresult
                  • Jstatems+jblocks
                  • Jexpr-get-field
                  • Jliteral-long-dec-nouscores
                  • Nat-to-dec-chars-theorems
                  • Jmethods-to-jcbody-elements
                  • Jclasses-to-jcbody-elements
                  • Jblock-locvar-final
                  • Jblock-locvar
                  • Jliteral-int-dec-nouscores
                  • Jfields-to-jcbody-elements
                  • Jblock-for
                  • Jblock-smethod
                  • Jblock-imethod
                  • Jblock-ifelse
                  • Jblock-asg-name
                  • Jparam-list->types
                  • Jparam-list->names
                  • Jexpr-lit-long-dec-nouscores
                  • Jexpr-lit-int-dec-nouscores
                  • Jexpr-literal-string
                  • Jexpr-literal-floating
                  • Jexpr-literal-character
                  • Jblock-while
                  • Jblock-method
                  • Jblock-if
                  • Jblock-expr
                  • Jblock-do
                  • Jblock-asg
                  • Jexpr-name-list
                  • Jblock-throw
                  • Jblock-return
                  • Jparam-list
                  • Jimport-list
                  • Jexpr-literal-true
                  • Jexpr-literal-null
                  • Jexpr-literal-false
                  • Jexpr-literal-1
                  • Jexpr-literal-0
                  • Jclass-list
                  • Jblock-continue
                  • Jtype-short
                  • Jtype-long
                  • Jtype-list
                  • Jtype-int
                  • Jtype-float
                  • Jtype-double
                  • Jtype-char
                  • Jtype-byte
                  • Jtype-boolean
                  • Jmethod-list
                  • Jliteral-list
                  • Jfield-list
                  • Jblock-list
                  • Jblock-break
                  • Jclasses+jcmembers
                • Atj-input-processing
                • Atj-java-pretty-printer
                • Atj-code-generation
                • Atj-java-primitives
                • Atj-java-primitive-arrays
                • Atj-type-macros
                • Atj-java-syntax-operations
                • Atj-fn
                • Atj-library-extensions
                • Atj-java-input-types
                • Atj-test-structures
                • Aij-notions
                • Atj-macro-definition
              • Atj-tutorial
            • Aij
            • Language
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Jtype

    Jtype-count

    Measure for recurring over jtype structures.

    Signature
    (jtype-count x) → count
    Arguments
    x — Guard (jtypep x).
    Returns
    count — Type (natp count).

    Definitions and Theorems

    Function: jtype-count

    (defun jtype-count (x)
      (declare (xargs :guard (jtypep x)))
      (let ((__function__ 'jtype-count))
        (declare (ignorable __function__))
        (case (jtype-kind x)
          (:prim 1)
          (:class 1)
          (:array (+ 2
                     (jtype-count (jtype-array->comp x)))))))

    Theorem: natp-of-jtype-count

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

    Theorem: jtype-count-of-jtype-fix-x

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

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

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

    Theorem: jtype-count-of-jtype-array

    (defthm jtype-count-of-jtype-array
      (implies t
               (< (+ (jtype-count comp))
                  (jtype-count (jtype-array comp))))
      :rule-classes :linear)

    Theorem: jtype-count-of-jtype-array->comp

    (defthm jtype-count-of-jtype-array->comp
      (implies (equal (jtype-kind x) :array)
               (< (jtype-count (jtype-array->comp x))
                  (jtype-count x)))
      :rule-classes :linear)