• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
      • Truth
        • Index-permute-shrink
        • Permute-stretch
        • Env-mismatch-aux
        • Permute-shrink
        • Permute-polarity
        • Env-permute-polarity
        • Env-permute-shrink
        • Permute-var-down
        • Swap-vars-aux
        • Env-permute-stretch
        • Swap-vars
        • Permute-var-up
        • Negative-cofactor
        • Truth-perm-rev
        • Index-permute-stretch
        • Env-mismatch
        • Truth-perm
        • Swap-polarity
        • Positive-cofactor
        • Index-perm-rev
        • Env-perm-rev
        • Nth-set-bit-pos
        • Index-swap
        • Env-move-var-down
        • Is-xor-with-var
        • Index-perm
        • Env-swap-vars
        • Var
        • Truth-eval
        • Index-move-down
        • Env-update
        • Env-perm
        • Depends-on-witness
        • Env-swap-polarity
        • Var-repetitions
        • Env-move-var-up
        • Index-move-up
        • Depends-on
        • Truth-norm
        • Index-listp
        • Env-diff-index
          • Env-lookup
          • True
          • False
        • Ubdds
        • Bdd
        • Faig
        • Bed
        • 4v
      • Debugging
      • Projects
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Truth

    Env-diff-index

    Signature
    (env-diff-index env1 env2) → idx
    Arguments
    env1 — Guard (natp env1).
    env2 — Guard (natp env2).
    Returns
    idx — Type (natp idx).

    Definitions and Theorems

    Definition: env-diff-index1

    (defchoose env-diff-index1 (idx)
               (env1 env2)
               (not (equal (env-lookup idx env1)
                           (env-lookup idx env2))))

    Function: env-diff-index

    (defun env-diff-index (env1 env2)
           (declare (xargs :guard (and (natp env1) (natp env2))))
           (let ((__function__ 'env-diff-index))
                (declare (ignorable __function__))
                (b* ((idx (nfix (env-diff-index1 (lnfix env1)
                                                 (lnfix env2)))))
                    (if (equal (env-lookup idx env1)
                               (env-lookup idx env2))
                        0 idx))))

    Theorem: natp-of-env-diff-index

    (defthm natp-of-env-diff-index
            (b* ((idx (env-diff-index env1 env2)))
                (natp idx))
            :rule-classes :type-prescription)

    Theorem: env-diff-index-correct

    (defthm env-diff-index-correct
            (implies (not (equal (nfix env1) (nfix env2)))
                     (b* ((idx (env-diff-index env1 env2)))
                         (equal (env-lookup idx env1)
                                (not (env-lookup idx env2))))))

    Theorem: env-diff-index-of-nfix-env1

    (defthm env-diff-index-of-nfix-env1
            (equal (env-diff-index (nfix env1) env2)
                   (env-diff-index env1 env2)))

    Theorem: env-diff-index-nat-equiv-congruence-on-env1

    (defthm env-diff-index-nat-equiv-congruence-on-env1
            (implies (nat-equiv env1 env1-equiv)
                     (equal (env-diff-index env1 env2)
                            (env-diff-index env1-equiv env2)))
            :rule-classes :congruence)

    Theorem: env-diff-index-of-nfix-env2

    (defthm env-diff-index-of-nfix-env2
            (equal (env-diff-index env1 (nfix env2))
                   (env-diff-index env1 env2)))

    Theorem: env-diff-index-nat-equiv-congruence-on-env2

    (defthm env-diff-index-nat-equiv-congruence-on-env2
            (implies (nat-equiv env2 env2-equiv)
                     (equal (env-diff-index env1 env2)
                            (env-diff-index env1 env2-equiv)))
            :rule-classes :congruence)