• 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

    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)