• 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

    Env-update

    Signature
    (env-update var val env) → new-env
    Arguments
    var — Guard (natp var).
    val — Guard (booleanp val).
    env — Guard (natp env).
    Returns
    new-env — Type (natp new-env).

    Definitions and Theorems

    Function: env-update

    (defun env-update (var val env)
           (declare (xargs :guard (and (natp var)
                                       (booleanp val)
                                       (natp env))))
           (let ((__function__ 'env-update))
                (declare (ignorable __function__))
                (install-bit var (bool->bit val)
                             (lnfix env))))

    Theorem: natp-of-env-update

    (defthm natp-of-env-update
            (b* ((new-env (env-update var val env)))
                (natp new-env))
            :rule-classes :type-prescription)

    Theorem: env-lookup-of-env-update-split

    (defthm env-lookup-of-env-update-split
            (equal (env-lookup var (env-update var1 val env))
                   (if (equal (nfix var) (nfix var1))
                       (acl2::bool-fix val)
                       (env-lookup var env))))

    Theorem: env-update-of-env-update

    (defthm env-update-of-env-update
            (equal (env-update n x (env-update n y env))
                   (env-update n x env)))

    Theorem: env-update-swap

    (defthm
        env-update-swap
        (implies
             (not (nat-equiv var1 var2))
             (equal (env-update var2 val2 (env-update var1 val1 env))
                    (env-update var1 val1 (env-update var2 val2 env)))))

    Theorem: env-update-redundant

    (defthm env-update-redundant
            (implies (iff (env-lookup n env) val)
                     (equal (env-update n val env)
                            (nfix env))))

    Theorem: env-update-of-nfix-var

    (defthm env-update-of-nfix-var
            (equal (env-update (nfix var) val env)
                   (env-update var val env)))

    Theorem: env-update-nat-equiv-congruence-on-var

    (defthm env-update-nat-equiv-congruence-on-var
            (implies (nat-equiv var var-equiv)
                     (equal (env-update var val env)
                            (env-update var-equiv val env)))
            :rule-classes :congruence)

    Theorem: env-update-of-bool-fix-val

    (defthm env-update-of-bool-fix-val
            (equal (env-update var (acl2::bool-fix val)
                               env)
                   (env-update var val env)))

    Theorem: env-update-iff-congruence-on-val

    (defthm env-update-iff-congruence-on-val
            (implies (iff val val-equiv)
                     (equal (env-update var val env)
                            (env-update var val-equiv env)))
            :rule-classes :congruence)

    Theorem: env-update-of-nfix-env

    (defthm env-update-of-nfix-env
            (equal (env-update var val (nfix env))
                   (env-update var val env)))

    Theorem: env-update-nat-equiv-congruence-on-env

    (defthm env-update-nat-equiv-congruence-on-env
            (implies (nat-equiv env env-equiv)
                     (equal (env-update var val env)
                            (env-update var val env-equiv)))
            :rule-classes :congruence)