• 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

    Env-perm

    Signature
    (env-perm n perm x numvars) → perm-env
    Arguments
    n — current position in the list.
        Guard (natp n).
    perm — indices to permute.
        Guard (nat-listp perm).
    x — env to permute.
        Guard (natp x).
    numvars — Guard (natp numvars).
    Returns
    perm-env — Type (natp perm-env).

    Definitions and Theorems

    Function: env-perm

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

    Theorem: natp-of-env-perm

    (defthm natp-of-env-perm
      (b* ((perm-env (env-perm n perm x numvars)))
        (natp perm-env))
      :rule-classes :type-prescription)

    Theorem: lookup-index-perm-in-env-perm

    (defthm lookup-index-perm-in-env-perm
      (equal (env-lookup (index-perm n perm k numvars)
                         (env-perm n perm env numvars))
             (env-lookup k env)))

    Theorem: lookup-in-env-perm

    (defthm lookup-in-env-perm
      (equal (env-lookup k (env-perm n perm env numvars))
             (env-lookup (index-perm-rev n perm k numvars)
                         env)))

    Theorem: env-perm-of-nfix-n

    (defthm env-perm-of-nfix-n
      (equal (env-perm (nfix n) perm x numvars)
             (env-perm n perm x numvars)))

    Theorem: env-perm-nat-equiv-congruence-on-n

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

    Theorem: env-perm-of-nfix-x

    (defthm env-perm-of-nfix-x
      (equal (env-perm n perm (nfix x) numvars)
             (env-perm n perm x numvars)))

    Theorem: env-perm-nat-equiv-congruence-on-x

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

    Theorem: env-perm-of-nfix-numvars

    (defthm env-perm-of-nfix-numvars
      (equal (env-perm n perm x (nfix numvars))
             (env-perm n perm x numvars)))

    Theorem: env-perm-nat-equiv-congruence-on-numvars

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