• 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-fix

    Fixing function for location structures.

    Signature
    (location-fix x) → new-x
    Arguments
    x — Guard (locationp x).
    Returns
    new-x — Type (locationp new-x).

    Definitions and Theorems

    Function: location-fix$inline

    (defun location-fix$inline (x)
     (declare (xargs :guard (locationp x)))
     (let ((__function__ 'location-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (case (location-kind x)
        (:var (b* ((name (identifier-fix (std::da-nth 0 (cdr x)))))
                (cons :var (list name))))
        (:tuple-comp (b* ((tuple (location-fix (std::da-nth 0 (cdr x))))
                          (index (nfix (std::da-nth 1 (cdr x)))))
                       (cons :tuple-comp (list tuple index))))
        (:struct-comp
             (b* ((struct (location-fix (std::da-nth 0 (cdr x))))
                  (name (identifier-fix (std::da-nth 1 (cdr x)))))
               (cons :struct-comp (list struct name)))))
       :exec x)))

    Theorem: locationp-of-location-fix

    (defthm locationp-of-location-fix
      (b* ((new-x (location-fix$inline x)))
        (locationp new-x))
      :rule-classes :rewrite)

    Theorem: location-fix-when-locationp

    (defthm location-fix-when-locationp
      (implies (locationp x)
               (equal (location-fix x) x)))

    Function: location-equiv$inline

    (defun location-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (locationp acl2::x)
                                  (locationp acl2::y))))
      (equal (location-fix acl2::x)
             (location-fix acl2::y)))

    Theorem: location-equiv-is-an-equivalence

    (defthm location-equiv-is-an-equivalence
      (and (booleanp (location-equiv x y))
           (location-equiv x x)
           (implies (location-equiv x y)
                    (location-equiv y x))
           (implies (and (location-equiv x y)
                         (location-equiv y z))
                    (location-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: location-equiv-implies-equal-location-fix-1

    (defthm location-equiv-implies-equal-location-fix-1
      (implies (location-equiv acl2::x x-equiv)
               (equal (location-fix acl2::x)
                      (location-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: location-fix-under-location-equiv

    (defthm location-fix-under-location-equiv
      (location-equiv (location-fix acl2::x)
                      acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-location-fix-1-forward-to-location-equiv

    (defthm equal-of-location-fix-1-forward-to-location-equiv
      (implies (equal (location-fix acl2::x) acl2::y)
               (location-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-location-fix-2-forward-to-location-equiv

    (defthm equal-of-location-fix-2-forward-to-location-equiv
      (implies (equal acl2::x (location-fix acl2::y))
               (location-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: location-equiv-of-location-fix-1-forward

    (defthm location-equiv-of-location-fix-1-forward
      (implies (location-equiv (location-fix acl2::x)
                               acl2::y)
               (location-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: location-equiv-of-location-fix-2-forward

    (defthm location-equiv-of-location-fix-2-forward
      (implies (location-equiv acl2::x (location-fix acl2::y))
               (location-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: location-kind$inline-of-location-fix-x

    (defthm location-kind$inline-of-location-fix-x
      (equal (location-kind$inline (location-fix x))
             (location-kind$inline x)))

    Theorem: location-kind$inline-location-equiv-congruence-on-x

    (defthm location-kind$inline-location-equiv-congruence-on-x
      (implies (location-equiv x x-equiv)
               (equal (location-kind$inline x)
                      (location-kind$inline x-equiv)))
      :rule-classes :congruence)

    Theorem: consp-of-location-fix

    (defthm consp-of-location-fix
      (consp (location-fix x))
      :rule-classes :type-prescription)