• 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-perm-rev

    Signature
    (truth-perm-rev n perm truth numvars) → perm-truth
    Arguments
    n — current position in the list.
        Guard (natp n).
    perm — indices to permute.
        Guard (index-listp perm numvars).
    truth — truth table to permute.
        Guard (integerp truth).
    numvars — Guard (natp numvars).
    Returns
    perm-truth — Type (integerp perm-truth).

    Definitions and Theorems

    Function: truth-perm-rev

    (defun truth-perm-rev (n perm truth numvars)
      (declare (xargs :guard (and (natp n)
                                  (integerp truth)
                                  (natp numvars)
                                  (index-listp perm numvars))))
      (declare (xargs :guard (and (<= n numvars)
                                  (eql (len perm) numvars))))
      (let ((__function__ 'truth-perm-rev))
        (declare (ignorable __function__))
        (b* (((when (mbe :logic (zp (- (nfix numvars) (nfix n)))
                         :exec (eql n numvars)))
              (truth-norm truth numvars))
             (truth (truth-perm-rev (1+ (lnfix n))
                                    perm truth numvars)))
          (swap-vars n (nth n perm)
                     truth numvars))))

    Theorem: integerp-of-truth-perm-rev

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

    Theorem: eval-of-truth-perm-rev-with-env-perm-rev

    (defthm eval-of-truth-perm-rev-with-env-perm-rev
      (implies (index-listp perm numvars)
               (equal (truth-eval (truth-perm-rev n perm truth numvars)
                                  (env-perm-rev n perm env numvars)
                                  numvars)
                      (truth-eval truth env numvars))))

    Theorem: eval-of-truth-perm-rev

    (defthm eval-of-truth-perm-rev
      (implies (index-listp perm numvars)
               (equal (truth-eval (truth-perm-rev n perm truth numvars)
                                  env numvars)
                      (truth-eval truth (env-perm n perm env numvars)
                                  numvars))))

    Theorem: size-of-truth-perm-rev-basic

    (defthm size-of-truth-perm-rev-basic
      (b* ((?perm-truth (truth-perm-rev n perm truth numvars)))
        (implies (index-listp perm numvars)
                 (unsigned-byte-p (ash 1 (nfix numvars))
                                  perm-truth))))

    Theorem: size-of-truth-perm-rev

    (defthm size-of-truth-perm-rev
      (b* ((?perm-truth (truth-perm-rev n perm truth numvars)))
        (implies (and (natp size)
                      (<= (ash 1 (nfix numvars)) size)
                      (index-listp perm numvars))
                 (unsigned-byte-p size perm-truth))))

    Theorem: truth-perm-rev-of-nfix-n

    (defthm truth-perm-rev-of-nfix-n
      (equal (truth-perm-rev (nfix n)
                             perm truth numvars)
             (truth-perm-rev n perm truth numvars)))

    Theorem: truth-perm-rev-nat-equiv-congruence-on-n

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

    Theorem: truth-perm-rev-of-ifix-truth

    (defthm truth-perm-rev-of-ifix-truth
      (equal (truth-perm-rev n perm (ifix truth)
                             numvars)
             (truth-perm-rev n perm truth numvars)))

    Theorem: truth-perm-rev-int-equiv-congruence-on-truth

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

    Theorem: truth-perm-rev-of-nfix-numvars

    (defthm truth-perm-rev-of-nfix-numvars
      (equal (truth-perm-rev n perm truth (nfix numvars))
             (truth-perm-rev n perm truth numvars)))

    Theorem: truth-perm-rev-nat-equiv-congruence-on-numvars

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