• Top
    • Documentation
    • Books
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
      • Truth
        • Index-permute-shrink
        • Permute-stretch
        • Permute-shrink
        • Env-mismatch-aux
        • Env-permute-shrink
        • Permute-polarity
        • Env-permute-polarity
        • Permute-var-down
        • Env-permute-stretch
        • Swap-vars-aux
        • Swap-vars
        • Permute-var-up
        • Truth-perm-rev
        • Negative-cofactor
        • Index-permute-stretch
        • Env-mismatch
        • Swap-polarity
        • Positive-cofactor
        • Truth-perm
        • Index-perm-rev
        • Nth-set-bit-pos
        • Env-perm-rev
        • Is-xor-with-var
        • Index-swap
        • Index-perm
        • Env-move-var-down
        • Truth-eval
          • Env-swap-vars
          • Env-perm
          • Depends-on-witness
          • Var
          • Index-move-down
          • Env-update
          • Env-swap-polarity
          • Var-repetitions
          • Env-move-var-up
          • Depends-on
          • Index-move-up
          • 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
      • Math
      • Testing-utilities
    • Truth

    Truth-eval

    Signature
    (truth-eval truth env numvars) → *
    Arguments
    truth — Guard (integerp truth).
    env — Guard (natp env).
    numvars — Guard (natp numvars).

    Definitions and Theorems

    Function: truth-eval

    (defun truth-eval (truth env numvars)
      (declare (xargs :guard (and (integerp truth)
                                  (natp env)
                                  (natp numvars))))
      (declare (xargs :guard (unsigned-byte-p numvars env)))
      (let ((__function__ 'truth-eval))
        (declare (ignorable __function__))
        (b* ((env (mbe :logic (loghead (nfix numvars) (nfix env))
                       :exec env)))
          (logbitp env truth))))

    Theorem: truth-eval-of-lognot

    (defthm truth-eval-of-lognot
      (equal (truth-eval (lognot truth) env numvars)
             (not (truth-eval truth env numvars))))

    Theorem: truth-eval-of-logand

    (defthm truth-eval-of-logand
      (equal (truth-eval (logand x y) env numvars)
             (and (truth-eval x env numvars)
                  (truth-eval y env numvars))))

    Theorem: truth-eval-of-logior

    (defthm truth-eval-of-logior
      (equal (truth-eval (logior x y) env numvars)
             (or (truth-eval x env numvars)
                 (truth-eval y env numvars))))

    Theorem: truth-eval-of-logxor

    (defthm truth-eval-of-logxor
      (equal (truth-eval (logxor x y) env numvars)
             (xor (truth-eval x env numvars)
                  (truth-eval y env numvars))))

    Theorem: truth-eval-of-consts

    (defthm truth-eval-of-consts
      (and (equal (truth-eval 0 env numvars) nil)
           (equal (truth-eval -1 env numvars) t)))

    Theorem: truth-eval-of-ifix-truth

    (defthm truth-eval-of-ifix-truth
      (equal (truth-eval (ifix truth) env numvars)
             (truth-eval truth env numvars)))

    Theorem: truth-eval-int-equiv-congruence-on-truth

    (defthm truth-eval-int-equiv-congruence-on-truth
      (implies (int-equiv truth truth-equiv)
               (equal (truth-eval truth env numvars)
                      (truth-eval truth-equiv env numvars)))
      :rule-classes :congruence)

    Theorem: truth-eval-of-nfix-env

    (defthm truth-eval-of-nfix-env
      (equal (truth-eval truth (nfix env) numvars)
             (truth-eval truth env numvars)))

    Theorem: truth-eval-nat-equiv-congruence-on-env

    (defthm truth-eval-nat-equiv-congruence-on-env
      (implies (nat-equiv env env-equiv)
               (equal (truth-eval truth env numvars)
                      (truth-eval truth env-equiv numvars)))
      :rule-classes :congruence)

    Theorem: truth-eval-of-nfix-numvars

    (defthm truth-eval-of-nfix-numvars
      (equal (truth-eval truth env (nfix numvars))
             (truth-eval truth env numvars)))

    Theorem: truth-eval-nat-equiv-congruence-on-numvars

    (defthm truth-eval-nat-equiv-congruence-on-numvars
      (implies (nat-equiv numvars numvars-equiv)
               (equal (truth-eval truth env numvars)
                      (truth-eval truth env numvars-equiv)))
      :rule-classes :congruence)