• 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

    Permute-var-up

    Signature
    (permute-var-up m n truth numvars) → perm-truth
    Arguments
    m — Guard (natp m).
    n — Guard (natp n).
    truth — Guard (integerp truth).
    numvars — Guard (natp numvars).
    Returns
    perm-truth — Type (natp perm-truth).

    Definitions and Theorems

    Function: permute-var-up

    (defun permute-var-up (m n truth numvars)
           (declare (xargs :guard (and (natp m)
                                       (natp n)
                                       (integerp truth)
                                       (natp numvars))))
           (declare (xargs :guard (and (<= m n) (< n numvars))))
           (let ((__function__ 'permute-var-up))
                (declare (ignorable __function__))
                (b* (((when (mbe :logic (zp (- (nfix n) (nfix m)))
                                 :exec (eql n m)))
                      (truth-norm truth numvars))
                     (next (1+ (lnfix m)))
                     (truth (swap-vars next m truth numvars)))
                    (permute-var-up next n truth numvars))))

    Theorem: natp-of-permute-var-up

    (defthm natp-of-permute-var-up
            (b* ((perm-truth (permute-var-up m n truth numvars)))
                (natp perm-truth))
            :rule-classes :type-prescription)

    Theorem: eval-of-permute-var-up-with-env-move-var-up

    (defthm
     eval-of-permute-var-up-with-env-move-var-up
     (b*
        ((?perm-truth (permute-var-up m n truth numvars)))
        (implies (and (<= (nfix m) (nfix n))
                      (< (nfix n) (nfix numvars)))
                 (equal (truth-eval perm-truth (env-move-var-up m n env)
                                    numvars)
                        (truth-eval truth env numvars)))))

    Theorem: eval-of-permute-var-up

    (defthm
       eval-of-permute-var-up
       (b* ((?perm-truth (permute-var-up m n truth numvars)))
           (implies (and (<= (nfix m) (nfix n))
                         (< (nfix n) (nfix numvars)))
                    (equal (truth-eval perm-truth env numvars)
                           (truth-eval truth (env-move-var-down m n env)
                                       numvars)))))

    Theorem: size-of-permute-var-up

    (defthm size-of-permute-var-up
            (b* ((?perm-truth (permute-var-up m n truth numvars)))
                (implies (and (< (nfix n) (nfix numvars))
                              (natp size)
                              (<= (ash 1 numvars) size))
                         (unsigned-byte-p size perm-truth))))

    Theorem: permute-var-up-of-truth-norm

    (defthm permute-var-up-of-truth-norm
            (equal (permute-var-up m n (truth-norm truth numvars)
                                   numvars)
                   (permute-var-up m n truth numvars)))

    Theorem: permute-var-up-of-nfix-m

    (defthm permute-var-up-of-nfix-m
            (equal (permute-var-up (nfix m)
                                   n truth numvars)
                   (permute-var-up m n truth numvars)))

    Theorem: permute-var-up-nat-equiv-congruence-on-m

    (defthm permute-var-up-nat-equiv-congruence-on-m
            (implies (nat-equiv m m-equiv)
                     (equal (permute-var-up m n truth numvars)
                            (permute-var-up m-equiv n truth numvars)))
            :rule-classes :congruence)

    Theorem: permute-var-up-of-nfix-n

    (defthm permute-var-up-of-nfix-n
            (equal (permute-var-up m (nfix n)
                                   truth numvars)
                   (permute-var-up m n truth numvars)))

    Theorem: permute-var-up-nat-equiv-congruence-on-n

    (defthm permute-var-up-nat-equiv-congruence-on-n
            (implies (nat-equiv n n-equiv)
                     (equal (permute-var-up m n truth numvars)
                            (permute-var-up m n-equiv truth numvars)))
            :rule-classes :congruence)

    Theorem: permute-var-up-of-ifix-truth

    (defthm permute-var-up-of-ifix-truth
            (equal (permute-var-up m n (ifix truth)
                                   numvars)
                   (permute-var-up m n truth numvars)))

    Theorem: permute-var-up-int-equiv-congruence-on-truth

    (defthm permute-var-up-int-equiv-congruence-on-truth
            (implies (int-equiv truth truth-equiv)
                     (equal (permute-var-up m n truth numvars)
                            (permute-var-up m n truth-equiv numvars)))
            :rule-classes :congruence)

    Theorem: permute-var-up-of-nfix-numvars

    (defthm permute-var-up-of-nfix-numvars
            (equal (permute-var-up m n truth (nfix numvars))
                   (permute-var-up m n truth numvars)))

    Theorem: permute-var-up-nat-equiv-congruence-on-numvars

    (defthm permute-var-up-nat-equiv-congruence-on-numvars
            (implies (nat-equiv numvars numvars-equiv)
                     (equal (permute-var-up m n truth numvars)
                            (permute-var-up m n truth numvars-equiv)))
            :rule-classes :congruence)