• 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
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • 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
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
                • Execution
                • Values
                • Dynamic-environments
                • Arithmetic-operations
                • Curve-parameterization
                • Shift-operations
                • Errors
                • Value-expressions
                • Locations
                  • Location
                    • Location-case
                    • Location-fix
                    • Location-count
                      • Location-equiv
                      • Locationp
                      • Location-tuple-comp
                      • Location-struct-comp
                      • Location-var
                      • Location-kind
                  • Input-execution
                  • Edwards-bls12-generator
                  • Equality-operations
                  • Logical-operations
                  • Program-execution
                  • Ordering-operations
                  • Bitwise-operations
                  • Literal-evaluation
                  • Type-maps-for-struct-components
                  • Output-execution
                  • Tuple-operations
                  • Struct-operations
                • Compilation
                • Static-semantics
                • Concrete-syntax
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Location

    Location-count

    Measure for recurring over location structures.

    Signature
    (location-count x) → count
    Arguments
    x — Guard (locationp x).
    Returns
    count — Type (natp count).

    Definitions and Theorems

    Function: location-count

    (defun location-count (x)
     (declare (xargs :guard (locationp x)))
     (let ((__function__ 'location-count))
      (declare (ignorable __function__))
      (case (location-kind x)
       (:var 1)
       (:tuple-comp (+ 3
                       (location-count (location-tuple-comp->tuple x))))
       (:struct-comp
            (+ 3
               (location-count (location-struct-comp->struct x)))))))

    Theorem: natp-of-location-count

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

    Theorem: location-count-of-location-fix-x

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

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

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

    Theorem: location-count-of-location-tuple-comp

    (defthm location-count-of-location-tuple-comp
      (implies t
               (< (+ (location-count tuple))
                  (location-count (location-tuple-comp tuple index))))
      :rule-classes :linear)

    Theorem: location-count-of-location-tuple-comp->tuple

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

    Theorem: location-count-of-location-struct-comp

    (defthm location-count-of-location-struct-comp
      (implies t
               (< (+ (location-count struct))
                  (location-count (location-struct-comp struct name))))
      :rule-classes :linear)

    Theorem: location-count-of-location-struct-comp->struct

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