• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Vwsim
      • Fgl
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
        • Mlib
          • Scopestack
          • Hid-tools
          • Filtering-by-name
          • Vl-interface-mocktype
          • Stripping-functions
          • Genblob
          • Expr-tools
          • Hierarchy
          • Extract-vl-types
          • Range-tools
          • Finding-by-name
          • Stmt-tools
          • Modnamespace
          • Flat-warnings
          • Reordering-by-name
          • Datatype-tools
            • Vl-dimensionlist-total-size
            • Vl-maybe-usertype-resolve
            • Vl-dimensionlist-resolved-p
            • Vl-datatype-packedp
            • Vl-datatype-select-ok
            • Vl-dimension-size
            • Vl-datatype-size
            • Vl-maybe-dimension-size
            • Vl-hidexpr-name1
            • Maybe-nat-list
              • Maybe-nat-list-fix
                • Maybe-nat-list-equiv
                • Maybe-nat-list-p
            • Syscalls
            • Allexprs
            • Lvalues
            • Port-tools
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Maybe-nat-list

    Maybe-nat-list-fix

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

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

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

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

    Theorem: maybe-nat-list-p-of-maybe-nat-list-fix

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

    Theorem: maybe-nat-list-fix-when-maybe-nat-list-p

    (defthm maybe-nat-list-fix-when-maybe-nat-list-p
            (implies (maybe-nat-list-p x)
                     (equal (maybe-nat-list-fix x) x)))

    Function: maybe-nat-list-equiv$inline

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Theorem: cons-of-maybe-natp-fix-x-under-maybe-nat-list-equiv

    (defthm
         cons-of-maybe-natp-fix-x-under-maybe-nat-list-equiv
         (maybe-nat-list-equiv (cons (maybe-natp-fix acl2::x) acl2::y)
                               (cons acl2::x acl2::y)))

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

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

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

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

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

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

    Theorem: consp-of-maybe-nat-list-fix

    (defthm consp-of-maybe-nat-list-fix
            (equal (consp (maybe-nat-list-fix acl2::x))
                   (consp acl2::x)))

    Theorem: maybe-nat-list-fix-of-cons

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

    Theorem: len-of-maybe-nat-list-fix

    (defthm len-of-maybe-nat-list-fix
            (equal (len (maybe-nat-list-fix acl2::x))
                   (len acl2::x)))

    Theorem: maybe-nat-list-fix-of-append

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

    Theorem: maybe-nat-list-fix-of-repeat

    (defthm maybe-nat-list-fix-of-repeat
            (equal (maybe-nat-list-fix (repeat acl2::n acl2::x))
                   (repeat acl2::n (maybe-natp-fix acl2::x))))

    Theorem: nth-of-maybe-nat-list-fix

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

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

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

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

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

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

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

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

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