• 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-mismatch-aux

    Signature
    (env-mismatch-aux n truth env1 env2 numvars) → var
    Arguments
    n — Guard (natp n).
    truth — Guard (integerp truth).
    env1 — Guard (natp env1).
    env2 — Guard (natp env2).
    numvars — Guard (natp numvars).
    Returns
    var — Type (natp var).

    Definitions and Theorems

    Function: env-mismatch-aux

    (defun env-mismatch-aux
           (n truth env1 env2 numvars)
           (declare (xargs :guard (and (natp n)
                                       (integerp truth)
                                       (natp env1)
                                       (natp env2)
                                       (natp numvars))))
           (declare (xargs :guard (<= n numvars)))
           (let ((__function__ 'env-mismatch-aux))
                (declare (ignorable __function__))
                (b* (((when (mbe :logic (zp (- (nfix numvars) (nfix n)))
                                 :exec (eql n numvars)))
                      0)
                     ((when (and (depends-on n truth numvars)
                                 (xor (env-lookup n env1)
                                      (env-lookup n env2))))
                      (lnfix n)))
                    (env-mismatch-aux (+ 1 (lnfix n))
                                      truth env1 env2 numvars))))

    Theorem: natp-of-env-mismatch-aux

    (defthm natp-of-env-mismatch-aux
            (b* ((var (env-mismatch-aux n truth env1 env2 numvars)))
                (natp var))
            :rule-classes :type-prescription)

    Theorem: env-mismatch-aux-bound

    (defthm env-mismatch-aux-bound
            (b* ((?var (env-mismatch-aux n truth env1 env2 numvars)))
                (implies (posp numvars)
                         (< var numvars))))

    Theorem: env-mismatch-aux-when-mismatch

    (defthm env-mismatch-aux-when-mismatch
            (b* ((?var (env-mismatch-aux n truth env1 env2 numvars)))
                (implies (and (depends-on m truth numvars)
                              (xor (env-lookup m env1)
                                   (env-lookup m env2))
                              (< (nfix m) (nfix numvars))
                              (<= (nfix n) (nfix m)))
                         (and (depends-on var truth numvars)
                              (iff (env-lookup var env1)
                                   (not (env-lookup var env2)))
                              (< var numvars)))))

    Theorem: env-mismatch-aux-when-eval-mismatch

    (defthm
         env-mismatch-aux-when-eval-mismatch
         (b* ((?var (env-mismatch-aux n truth env1 env2 numvars)))
             (implies (and (not (equal (truth-eval truth env1 numvars)
                                       (truth-eval truth env2 numvars)))
                           (equal (loghead n (nfix env1))
                                  (loghead n (nfix env2))))
                      (and (depends-on var truth numvars)
                           (iff (env-lookup var env1)
                                (not (env-lookup var env2)))
                           (< var (nfix numvars))
                           (implies (natp numvars)
                                    (< var numvars))))))

    Theorem: env-mismatch-aux-of-nfix-n

    (defthm env-mismatch-aux-of-nfix-n
            (equal (env-mismatch-aux (nfix n)
                                     truth env1 env2 numvars)
                   (env-mismatch-aux n truth env1 env2 numvars)))

    Theorem: env-mismatch-aux-nat-equiv-congruence-on-n

    (defthm
        env-mismatch-aux-nat-equiv-congruence-on-n
        (implies
             (nat-equiv n n-equiv)
             (equal (env-mismatch-aux n truth env1 env2 numvars)
                    (env-mismatch-aux n-equiv truth env1 env2 numvars)))
        :rule-classes :congruence)

    Theorem: env-mismatch-aux-of-ifix-truth

    (defthm env-mismatch-aux-of-ifix-truth
            (equal (env-mismatch-aux n (ifix truth)
                                     env1 env2 numvars)
                   (env-mismatch-aux n truth env1 env2 numvars)))

    Theorem: env-mismatch-aux-int-equiv-congruence-on-truth

    (defthm
        env-mismatch-aux-int-equiv-congruence-on-truth
        (implies
             (int-equiv truth truth-equiv)
             (equal (env-mismatch-aux n truth env1 env2 numvars)
                    (env-mismatch-aux n truth-equiv env1 env2 numvars)))
        :rule-classes :congruence)

    Theorem: env-mismatch-aux-of-nfix-env1

    (defthm env-mismatch-aux-of-nfix-env1
            (equal (env-mismatch-aux n truth (nfix env1)
                                     env2 numvars)
                   (env-mismatch-aux n truth env1 env2 numvars)))

    Theorem: env-mismatch-aux-nat-equiv-congruence-on-env1

    (defthm
        env-mismatch-aux-nat-equiv-congruence-on-env1
        (implies
             (nat-equiv env1 env1-equiv)
             (equal (env-mismatch-aux n truth env1 env2 numvars)
                    (env-mismatch-aux n truth env1-equiv env2 numvars)))
        :rule-classes :congruence)

    Theorem: env-mismatch-aux-of-nfix-env2

    (defthm env-mismatch-aux-of-nfix-env2
            (equal (env-mismatch-aux n truth env1 (nfix env2)
                                     numvars)
                   (env-mismatch-aux n truth env1 env2 numvars)))

    Theorem: env-mismatch-aux-nat-equiv-congruence-on-env2

    (defthm
        env-mismatch-aux-nat-equiv-congruence-on-env2
        (implies
             (nat-equiv env2 env2-equiv)
             (equal (env-mismatch-aux n truth env1 env2 numvars)
                    (env-mismatch-aux n truth env1 env2-equiv numvars)))
        :rule-classes :congruence)

    Theorem: env-mismatch-aux-of-nfix-numvars

    (defthm env-mismatch-aux-of-nfix-numvars
            (equal (env-mismatch-aux n truth env1 env2 (nfix numvars))
                   (env-mismatch-aux n truth env1 env2 numvars)))

    Theorem: env-mismatch-aux-nat-equiv-congruence-on-numvars

    (defthm
        env-mismatch-aux-nat-equiv-congruence-on-numvars
        (implies
             (nat-equiv numvars numvars-equiv)
             (equal (env-mismatch-aux n truth env1 env2 numvars)
                    (env-mismatch-aux n truth env1 env2 numvars-equiv)))
        :rule-classes :congruence)