• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
      • Std/lists
      • Omaps
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/osets
      • Std/io
      • Std/basic
        • Maybe-stringp
        • Maybe-natp
        • Two-nats-measure
        • Impossible
        • Bytep
          • Byte
            • Byte-list
              • Byte-listp
              • Byte-list-fix
                • Byte-list20
                • Byte-list32
                • Byte-list64
                • Byte-list-equiv
              • Byte-fix
              • Bytep-additional-theorems
            • Bytes-as-digits-in-base-256
            • Bytep-additional-theorems
          • Nat-list-measure
          • Maybe-posp
          • Nibblep
          • Organize-symbols-by-pkg
          • Organize-symbols-by-name
          • Lnfix
          • Good-valuep
          • Streqv
          • Chareqv
          • Symbol-package-name-non-cl
          • Arith-equivs
          • Induction-schemes
          • Maybe-integerp
          • Char-fix
          • Pos-fix
          • Symbol-package-name-lst
          • Mbt$
          • Maybe-bitp
          • Good-pseudo-termp
          • Str-fix
          • Maybe-string-fix
          • Nonkeyword-listp
          • Lifix
          • Bfix
          • Std/basic/if*
          • Impliez
          • Tuplep
          • Std/basic/intern-in-package-of-symbol
          • Lbfix
          • Std/basic/symbol-name-lst
          • True
          • Std/basic/rfix
          • Std/basic/realfix
          • Std/basic/member-symbol-name
          • Std/basic/fix
          • False
          • Std/basic/nfix
          • Std/basic/ifix
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Byte-list

    Byte-list-fix

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

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

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

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

    Theorem: byte-listp-of-byte-list-fix

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

    Theorem: byte-list-fix-when-byte-listp

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

    Function: byte-list-equiv$inline

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

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

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

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

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

    Theorem: byte-list-fix-under-byte-list-equiv

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Theorem: cons-of-byte-fix-x-under-byte-list-equiv

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

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

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

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

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

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

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

    Theorem: consp-of-byte-list-fix

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

    Theorem: byte-list-fix-under-iff

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

    Theorem: byte-list-fix-of-cons

    (defthm byte-list-fix-of-cons
      (equal (byte-list-fix (cons a x))
             (cons (byte-fix a) (byte-list-fix x))))

    Theorem: len-of-byte-list-fix

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

    Theorem: byte-list-fix-of-append

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

    Theorem: byte-list-fix-of-repeat

    (defthm byte-list-fix-of-repeat
      (equal (byte-list-fix (repeat n x))
             (repeat n (byte-fix x))))

    Theorem: list-equiv-refines-byte-list-equiv

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

    Theorem: nth-of-byte-list-fix

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

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

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

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

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

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

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

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

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