• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
      • B*
      • Defunc
      • Fty
        • Deftagsum
        • Defprod
        • Defflexsum
        • Defbitstruct
        • Deflist
        • Defalist
        • Defbyte
        • Deffixequiv
        • Defresult
        • Deffixtype
        • Defoption
        • Fty-discipline
        • Fold
        • Fty-extensions
        • Defsubtype
        • Deftypes
        • Specific-types
        • Defset
        • Defflatsum
        • Deflist-of-len
        • Defbytelist
        • Fty::basetypes
        • Defomap
        • Defvisitors
        • Deffixtype-alias
        • Deffixequiv-sk
        • Defunit
        • Multicase
        • Deffixequiv-mutual
        • Fty::baselists
          • Symbol-list
          • True-list-list
          • Nat-list
            • Nat-list-fix
              • Nat-list-fix-theorems
            • Nat-list-equiv
          • Rational-list
          • Integer-list
          • Boolean-list
          • ACL2-number-list
        • Def-enumcase
        • Defmap
      • Apt
      • Std/util
      • Defdata
      • Defrstobj
      • Seq
      • Match-tree
      • Defrstobj
      • With-supporters
      • Def-partial-measure
      • Template-subst
      • Soft
      • Defthm-domain
      • Event-macros
      • Def-universal-equiv
      • Def-saved-obligs
      • With-supporters-after
      • Definec
      • Sig
      • Outer-local
      • Data-structures
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Nat-list

Nat-list-fix

(nat-list-fix x) is a usual fty list fixing function.

Signature
(nat-list-fix x) → fty::newx
Arguments
x — Guard (nat-listp x).
Returns
fty::newx — Type (nat-listp fty::newx).

In the logic, we apply nfix 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: nat-list-fix$inline

(defun nat-list-fix$inline (x)
  (declare (xargs :guard (nat-listp x)))
  (let ((__function__ 'nat-list-fix))
    (declare (ignorable __function__))
    (mbe :logic
         (if (atom x)
             nil
           (cons (nfix (car x))
                 (nat-list-fix (cdr x))))
         :exec x)))

Theorem: nat-listp-of-nat-list-fix

(defthm nat-listp-of-nat-list-fix
  (b* ((fty::newx (nat-list-fix$inline x)))
    (nat-listp fty::newx))
  :rule-classes :rewrite)

Theorem: nat-list-fix-when-nat-listp

(defthm nat-list-fix-when-nat-listp
  (implies (nat-listp x)
           (equal (nat-list-fix x) x)))

Function: nat-list-equiv$inline

(defun nat-list-equiv$inline (x y)
  (declare (xargs :guard (and (nat-listp x) (nat-listp y))))
  (equal (nat-list-fix x)
         (nat-list-fix y)))

Theorem: nat-list-equiv-is-an-equivalence

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

Theorem: nat-list-equiv-implies-equal-nat-list-fix-1

(defthm nat-list-equiv-implies-equal-nat-list-fix-1
  (implies (nat-list-equiv x x-equiv)
           (equal (nat-list-fix x)
                  (nat-list-fix x-equiv)))
  :rule-classes (:congruence))

Theorem: nat-list-fix-under-nat-list-equiv

(defthm nat-list-fix-under-nat-list-equiv
  (nat-list-equiv (nat-list-fix x) x)
  :rule-classes (:rewrite :rewrite-quoted-constant))

Theorem: equal-of-nat-list-fix-1-forward-to-nat-list-equiv

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

Theorem: equal-of-nat-list-fix-2-forward-to-nat-list-equiv

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

Theorem: nat-list-equiv-of-nat-list-fix-1-forward

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

Theorem: nat-list-equiv-of-nat-list-fix-2-forward

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

Theorem: car-of-nat-list-fix-x-under-nat-equiv

(defthm car-of-nat-list-fix-x-under-nat-equiv
  (nat-equiv (car (nat-list-fix x))
             (car x)))

Theorem: car-nat-list-equiv-congruence-on-x-under-nat-equiv

(defthm car-nat-list-equiv-congruence-on-x-under-nat-equiv
  (implies (nat-list-equiv x x-equiv)
           (nat-equiv (car x) (car x-equiv)))
  :rule-classes :congruence)

Theorem: cdr-of-nat-list-fix-x-under-nat-list-equiv

(defthm cdr-of-nat-list-fix-x-under-nat-list-equiv
  (nat-list-equiv (cdr (nat-list-fix x))
                  (cdr x)))

Theorem: cdr-nat-list-equiv-congruence-on-x-under-nat-list-equiv

(defthm cdr-nat-list-equiv-congruence-on-x-under-nat-list-equiv
  (implies (nat-list-equiv x x-equiv)
           (nat-list-equiv (cdr x) (cdr x-equiv)))
  :rule-classes :congruence)

Theorem: cons-of-nfix-x-under-nat-list-equiv

(defthm cons-of-nfix-x-under-nat-list-equiv
  (nat-list-equiv (cons (nfix x) y)
                  (cons x y)))

Theorem: cons-nat-equiv-congruence-on-x-under-nat-list-equiv

(defthm cons-nat-equiv-congruence-on-x-under-nat-list-equiv
  (implies (nat-equiv x x-equiv)
           (nat-list-equiv (cons x y)
                           (cons x-equiv y)))
  :rule-classes :congruence)

Theorem: cons-of-nat-list-fix-y-under-nat-list-equiv

(defthm cons-of-nat-list-fix-y-under-nat-list-equiv
  (nat-list-equiv (cons x (nat-list-fix y))
                  (cons x y)))

Theorem: cons-nat-list-equiv-congruence-on-y-under-nat-list-equiv

(defthm cons-nat-list-equiv-congruence-on-y-under-nat-list-equiv
  (implies (nat-list-equiv y y-equiv)
           (nat-list-equiv (cons x y)
                           (cons x y-equiv)))
  :rule-classes :congruence)

Theorem: consp-of-nat-list-fix

(defthm consp-of-nat-list-fix
  (equal (consp (nat-list-fix x))
         (consp x)))

Theorem: nat-list-fix-under-iff

(defthm nat-list-fix-under-iff
  (iff (nat-list-fix x) (consp x)))

Theorem: nat-list-fix-of-cons

(defthm nat-list-fix-of-cons
  (equal (nat-list-fix (cons a x))
         (cons (nfix a) (nat-list-fix x))))

Theorem: len-of-nat-list-fix

(defthm len-of-nat-list-fix
  (equal (len (nat-list-fix x)) (len x)))

Theorem: nat-list-fix-of-append

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

Theorem: nat-list-fix-of-repeat

(defthm nat-list-fix-of-repeat
  (equal (nat-list-fix (repeat n x))
         (repeat n (nfix x))))

Theorem: list-equiv-refines-nat-list-equiv

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

Theorem: nth-of-nat-list-fix

(defthm nth-of-nat-list-fix
  (equal (nth n (nat-list-fix x))
         (if (< (nfix n) (len x))
             (nfix (nth n x))
           nil)))

Theorem: nat-list-equiv-implies-nat-list-equiv-append-1

(defthm nat-list-equiv-implies-nat-list-equiv-append-1
  (implies (nat-list-equiv x fty::x-equiv)
           (nat-list-equiv (append x y)
                           (append fty::x-equiv y)))
  :rule-classes (:congruence))

Theorem: nat-list-equiv-implies-nat-list-equiv-append-2

(defthm nat-list-equiv-implies-nat-list-equiv-append-2
  (implies (nat-list-equiv y fty::y-equiv)
           (nat-list-equiv (append x y)
                           (append x fty::y-equiv)))
  :rule-classes (:congruence))

Theorem: nat-list-equiv-implies-nat-list-equiv-nthcdr-2

(defthm nat-list-equiv-implies-nat-list-equiv-nthcdr-2
  (implies (nat-list-equiv l l-equiv)
           (nat-list-equiv (nthcdr n l)
                           (nthcdr n l-equiv)))
  :rule-classes (:congruence))

Theorem: nat-list-equiv-implies-nat-list-equiv-take-2

(defthm nat-list-equiv-implies-nat-list-equiv-take-2
  (implies (nat-list-equiv l l-equiv)
           (nat-list-equiv (take n l)
                           (take n l-equiv)))
  :rule-classes (:congruence))

Subtopics

Nat-list-fix-theorems
Some theorems about the library function nat-list-fix.