• 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
        • Semantics
        • Abstract-syntax
          • Aexp
            • Aexp-case
            • Aexp-fix
              • Aexpp
              • Aexp-count
              • Aexp-equiv
              • Aexp-mul
              • Aexp-add
              • Aexp-var
              • Aexp-const
              • Aexp-kind
            • Bexp
            • Comm
            • Comm-list
            • Command-fixtypes
          • Interpreter
        • 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
    • Aexp

    Aexp-fix

    Fixing function for aexp structures.

    Signature
    (aexp-fix x) → new-x
    Arguments
    x — Guard (aexpp x).
    Returns
    new-x — Type (aexpp new-x).

    Definitions and Theorems

    Function: aexp-fix$inline

    (defun aexp-fix$inline (x)
      (declare (xargs :guard (aexpp x)))
      (let ((__function__ 'aexp-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (case (aexp-kind x)
               (:const (b* ((value (ifix (std::da-nth 0 (cdr x)))))
                         (cons :const (list value))))
               (:var (b* ((name (str-fix (std::da-nth 0 (cdr x)))))
                       (cons :var (list name))))
               (:add (b* ((left (aexp-fix (std::da-nth 0 (cdr x))))
                          (right (aexp-fix (std::da-nth 1 (cdr x)))))
                       (cons :add (list left right))))
               (:mul (b* ((left (aexp-fix (std::da-nth 0 (cdr x))))
                          (right (aexp-fix (std::da-nth 1 (cdr x)))))
                       (cons :mul (list left right)))))
             :exec x)))

    Theorem: aexpp-of-aexp-fix

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

    Theorem: aexp-fix-when-aexpp

    (defthm aexp-fix-when-aexpp
      (implies (aexpp x)
               (equal (aexp-fix x) x)))

    Function: aexp-equiv$inline

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

    Theorem: aexp-equiv-is-an-equivalence

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

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

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

    Theorem: aexp-fix-under-aexp-equiv

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

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

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

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

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

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

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

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

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

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

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

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

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

    Theorem: consp-of-aexp-fix

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