• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
          • Representation
          • Transformation-tools
            • Simpadd0
            • Deftrans
            • Splitgso
            • Constant-propagation
              • Value-to-expr
              • Const-prop-eval-impure-binop-expr
              • Env
                • Envp
                • Env-fix
                  • Union-env
                  • Env-equiv
                  • Write-env
                  • Declare-var-env
                  • Read-env
                  • Push-scope-env
                  • In-scope-env
                  • Pop-scope-env
                  • Merge-block-env
                  • Env-block
                • Const-prop-eval-pure-binop-expr
                • Const-prop-filepath-transunit-map
                • Const-prop-eval-unop-expr
                • Const-prop-transunit-ensemble
                • Const-prop-fundef
                • Value-result-to-option
                • Const-prop-extdecl-list
                • Const-prop-extdecl
                • Zero-valuep
                • Iconst-to-value
                • Const-to-value
                • Expr-to-ident
                • Const-prop-transunit
                • Pure-binopp
                • Const-prop-initdeclor-list
                • Const-prop-initdeclor
                • Const-prop-structdeclor-list
                • Const-prop-structdecl-list
                • Const-prop-param-declon-list
                • Const-prop-initer-option
                • Const-prop-initer
                • Const-prop-expr-option
                • Const-prop-dirabsdeclor-option
                • Const-prop-dirabsdeclor
                • Const-prop-const-expr-option
                • Const-prop-absdeclor-option
                • Const-prop-type-spec
                • Const-prop-strunispec
                • Const-prop-structdeclor
                • Const-prop-structdecl
                • Const-prop-statassert
                • Const-prop-spec/qual-list
                • Const-prop-spec/qual
                • Const-prop-param-declor
                • Const-prop-param-declon
                • Const-prop-member-designor
                • Const-prop-genassoc-list
                • Const-prop-genassoc
                • Const-prop-expr-list
                • Const-prop-expr
                • Const-prop-enumspec
                • Const-prop-enumer-list
                • Const-prop-dirdeclor
                • Const-prop-desiniter-list
                • Const-prop-desiniter
                • Const-prop-designor-list
                • Const-prop-designor
                • Const-prop-declor-option
                • Const-prop-decl-spec-list
                • Const-prop-decl-spec
                • Const-prop-decl-list
                • Const-prop-block-item-list
                • Const-prop-align-spec
                • Const-prop-absdeclor
                • Const-prop-tyname
                • Const-prop-stmt
                • Const-prop-label
                • Const-prop-enumer
                • Const-prop-declor
                • Const-prop-decl
                • Const-prop-const-expr
                • Const-prop-block-item
              • Split-fn
              • Copy-fn
              • Specialize
              • Split-all-gso
              • Rename
              • Utilities
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Env

    Env-fix

    (env-fix x) is a usual ACL2::fty list fixing function.

    Signature
    (env-fix x) → fty::newx
    Arguments
    x — Guard (envp x).
    Returns
    fty::newx — Type (envp fty::newx).

    In the logic, we apply env-block-fix to each member of the x. In the execution, none of that is actually necessary and this is just an inlined identity function.

    Definitions and Theorems

    Function: env-fix$inline

    (defun env-fix$inline (x)
      (declare (xargs :guard (envp x)))
      (let ((__function__ 'env-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (if (atom x)
                 nil
               (cons (env-block-fix (car x))
                     (env-fix (cdr x))))
             :exec x)))

    Theorem: envp-of-env-fix

    (defthm envp-of-env-fix
      (b* ((fty::newx (env-fix$inline x)))
        (envp fty::newx))
      :rule-classes :rewrite)

    Theorem: env-fix-when-envp

    (defthm env-fix-when-envp
      (implies (envp x)
               (equal (env-fix x) x)))

    Function: env-equiv$inline

    (defun env-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (envp acl2::x) (envp acl2::y))))
      (equal (env-fix acl2::x)
             (env-fix acl2::y)))

    Theorem: env-equiv-is-an-equivalence

    (defthm env-equiv-is-an-equivalence
      (and (booleanp (env-equiv x y))
           (env-equiv x x)
           (implies (env-equiv x y)
                    (env-equiv y x))
           (implies (and (env-equiv x y) (env-equiv y z))
                    (env-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: env-equiv-implies-equal-env-fix-1

    (defthm env-equiv-implies-equal-env-fix-1
      (implies (env-equiv acl2::x x-equiv)
               (equal (env-fix acl2::x)
                      (env-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: env-fix-under-env-equiv

    (defthm env-fix-under-env-equiv
      (env-equiv (env-fix acl2::x) acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-env-fix-1-forward-to-env-equiv

    (defthm equal-of-env-fix-1-forward-to-env-equiv
      (implies (equal (env-fix acl2::x) acl2::y)
               (env-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-env-fix-2-forward-to-env-equiv

    (defthm equal-of-env-fix-2-forward-to-env-equiv
      (implies (equal acl2::x (env-fix acl2::y))
               (env-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: env-equiv-of-env-fix-1-forward

    (defthm env-equiv-of-env-fix-1-forward
      (implies (env-equiv (env-fix acl2::x) acl2::y)
               (env-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: env-equiv-of-env-fix-2-forward

    (defthm env-equiv-of-env-fix-2-forward
      (implies (env-equiv acl2::x (env-fix acl2::y))
               (env-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: car-of-env-fix-x-under-env-block-equiv

    (defthm car-of-env-fix-x-under-env-block-equiv
      (env-block-equiv (car (env-fix acl2::x))
                       (car acl2::x)))

    Theorem: car-env-equiv-congruence-on-x-under-env-block-equiv

    (defthm car-env-equiv-congruence-on-x-under-env-block-equiv
      (implies (env-equiv acl2::x x-equiv)
               (env-block-equiv (car acl2::x)
                                (car x-equiv)))
      :rule-classes :congruence)

    Theorem: cdr-of-env-fix-x-under-env-equiv

    (defthm cdr-of-env-fix-x-under-env-equiv
      (env-equiv (cdr (env-fix acl2::x))
                 (cdr acl2::x)))

    Theorem: cdr-env-equiv-congruence-on-x-under-env-equiv

    (defthm cdr-env-equiv-congruence-on-x-under-env-equiv
      (implies (env-equiv acl2::x x-equiv)
               (env-equiv (cdr acl2::x) (cdr x-equiv)))
      :rule-classes :congruence)

    Theorem: cons-of-env-block-fix-x-under-env-equiv

    (defthm cons-of-env-block-fix-x-under-env-equiv
      (env-equiv (cons (env-block-fix acl2::x) acl2::y)
                 (cons acl2::x acl2::y)))

    Theorem: cons-env-block-equiv-congruence-on-x-under-env-equiv

    (defthm cons-env-block-equiv-congruence-on-x-under-env-equiv
      (implies (env-block-equiv acl2::x x-equiv)
               (env-equiv (cons acl2::x acl2::y)
                          (cons x-equiv acl2::y)))
      :rule-classes :congruence)

    Theorem: cons-of-env-fix-y-under-env-equiv

    (defthm cons-of-env-fix-y-under-env-equiv
      (env-equiv (cons acl2::x (env-fix acl2::y))
                 (cons acl2::x acl2::y)))

    Theorem: cons-env-equiv-congruence-on-y-under-env-equiv

    (defthm cons-env-equiv-congruence-on-y-under-env-equiv
      (implies (env-equiv acl2::y y-equiv)
               (env-equiv (cons acl2::x acl2::y)
                          (cons acl2::x y-equiv)))
      :rule-classes :congruence)

    Theorem: consp-of-env-fix

    (defthm consp-of-env-fix
      (equal (consp (env-fix acl2::x))
             (consp acl2::x)))

    Theorem: env-fix-under-iff

    (defthm env-fix-under-iff
      (iff (env-fix acl2::x) (consp acl2::x)))

    Theorem: env-fix-of-cons

    (defthm env-fix-of-cons
      (equal (env-fix (cons a x))
             (cons (env-block-fix a) (env-fix x))))

    Theorem: len-of-env-fix

    (defthm len-of-env-fix
      (equal (len (env-fix acl2::x))
             (len acl2::x)))

    Theorem: env-fix-of-append

    (defthm env-fix-of-append
      (equal (env-fix (append std::a std::b))
             (append (env-fix std::a)
                     (env-fix std::b))))

    Theorem: env-fix-of-repeat

    (defthm env-fix-of-repeat
      (equal (env-fix (repeat acl2::n acl2::x))
             (repeat acl2::n (env-block-fix acl2::x))))

    Theorem: list-equiv-refines-env-equiv

    (defthm list-equiv-refines-env-equiv
      (implies (list-equiv acl2::x acl2::y)
               (env-equiv acl2::x acl2::y))
      :rule-classes :refinement)

    Theorem: nth-of-env-fix

    (defthm nth-of-env-fix
      (equal (nth acl2::n (env-fix acl2::x))
             (if (< (nfix acl2::n) (len acl2::x))
                 (env-block-fix (nth acl2::n acl2::x))
               nil)))

    Theorem: env-equiv-implies-env-equiv-append-1

    (defthm env-equiv-implies-env-equiv-append-1
      (implies (env-equiv acl2::x fty::x-equiv)
               (env-equiv (append acl2::x acl2::y)
                          (append fty::x-equiv acl2::y)))
      :rule-classes (:congruence))

    Theorem: env-equiv-implies-env-equiv-append-2

    (defthm env-equiv-implies-env-equiv-append-2
      (implies (env-equiv acl2::y fty::y-equiv)
               (env-equiv (append acl2::x acl2::y)
                          (append acl2::x fty::y-equiv)))
      :rule-classes (:congruence))

    Theorem: env-equiv-implies-env-equiv-nthcdr-2

    (defthm env-equiv-implies-env-equiv-nthcdr-2
      (implies (env-equiv acl2::l l-equiv)
               (env-equiv (nthcdr acl2::n acl2::l)
                          (nthcdr acl2::n l-equiv)))
      :rule-classes (:congruence))

    Theorem: env-equiv-implies-env-equiv-take-2

    (defthm env-equiv-implies-env-equiv-take-2
      (implies (env-equiv acl2::l l-equiv)
               (env-equiv (take acl2::n acl2::l)
                          (take acl2::n l-equiv)))
      :rule-classes (:congruence))