• 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
      • Projects
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Truth

    Negative-cofactor

    Signature
    (negative-cofactor n truth numvars) → cofactor
    Arguments
    n — Guard (natp n).
    truth — Guard (integerp truth).
    numvars — Guard (natp numvars).
    Returns
    cofactor — Type (integerp cofactor).

    Definitions and Theorems

    Function: negative-cofactor

    (defun negative-cofactor (n truth numvars)
           (declare (xargs :guard (and (natp n)
                                       (integerp truth)
                                       (natp numvars))))
           (declare (xargs :guard (< n numvars)))
           (let ((__function__ 'negative-cofactor))
                (declare (ignorable __function__))
                (b* ((mask (logand (lognot (var n numvars))
                                   (loghead (ash 1 (lnfix numvars))
                                            truth))))
                    (logior mask (ash mask (ash 1 (lnfix n)))))))

    Theorem: integerp-of-negative-cofactor

    (defthm integerp-of-negative-cofactor
            (b* ((cofactor (negative-cofactor n truth numvars)))
                (integerp cofactor))
            :rule-classes :type-prescription)

    Theorem: negative-cofactor-correct

    (defthm negative-cofactor-correct
            (b* ((?cofactor (negative-cofactor n truth numvars)))
                (implies (< (nfix n) (nfix numvars))
                         (equal (truth-eval cofactor env numvars)
                                (truth-eval truth (env-update n nil env)
                                            numvars)))))

    Theorem: size-of-logand-by-size-of-loghead

    (defthm size-of-logand-by-size-of-loghead
            (implies (and (unsigned-byte-p m a)
                          (unsigned-byte-p n (loghead m b)))
                     (unsigned-byte-p n (logand a b))))

    Theorem: negative-cofactor-size-basic

    (defthm negative-cofactor-size-basic
            (b* ((?cofactor (negative-cofactor n truth numvars)))
                (implies (and (< (nfix n) numvars)
                              (natp numvars))
                         (unsigned-byte-p (ash 1 numvars)
                                          cofactor))))

    Theorem: negative-cofactor-size

    (defthm negative-cofactor-size
            (b* ((?cofactor (negative-cofactor n truth numvars)))
                (implies (and (natp m)
                              (<= (ash 1 numvars) m)
                              (< (nfix n) numvars)
                              (natp numvars))
                         (unsigned-byte-p m cofactor))))

    Theorem: negative-cofactor-of-truth-norm

    (defthm negative-cofactor-of-truth-norm
            (equal (negative-cofactor n (truth-norm truth numvars)
                                      numvars)
                   (negative-cofactor n truth numvars)))

    Theorem: truth-norm-of-negative-cofactor

    (defthm
         truth-norm-of-negative-cofactor
         (implies (< (nfix n) (nfix numvars))
                  (equal (truth-norm (negative-cofactor n truth numvars)
                                     numvars)
                         (negative-cofactor n truth numvars))))

    Theorem: negative-cofactor-of-nfix-n

    (defthm negative-cofactor-of-nfix-n
            (equal (negative-cofactor (nfix n)
                                      truth numvars)
                   (negative-cofactor n truth numvars)))

    Theorem: negative-cofactor-nat-equiv-congruence-on-n

    (defthm negative-cofactor-nat-equiv-congruence-on-n
            (implies (nat-equiv n n-equiv)
                     (equal (negative-cofactor n truth numvars)
                            (negative-cofactor n-equiv truth numvars)))
            :rule-classes :congruence)

    Theorem: negative-cofactor-of-ifix-truth

    (defthm negative-cofactor-of-ifix-truth
            (equal (negative-cofactor n (ifix truth)
                                      numvars)
                   (negative-cofactor n truth numvars)))

    Theorem: negative-cofactor-int-equiv-congruence-on-truth

    (defthm negative-cofactor-int-equiv-congruence-on-truth
            (implies (int-equiv truth truth-equiv)
                     (equal (negative-cofactor n truth numvars)
                            (negative-cofactor n truth-equiv numvars)))
            :rule-classes :congruence)

    Theorem: negative-cofactor-of-nfix-numvars

    (defthm negative-cofactor-of-nfix-numvars
            (equal (negative-cofactor n truth (nfix numvars))
                   (negative-cofactor n truth numvars)))

    Theorem: negative-cofactor-nat-equiv-congruence-on-numvars

    (defthm negative-cofactor-nat-equiv-congruence-on-numvars
            (implies (nat-equiv numvars numvars-equiv)
                     (equal (negative-cofactor n truth numvars)
                            (negative-cofactor n truth numvars-equiv)))
            :rule-classes :congruence)