• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
          • Isodata
          • Simplify-defun
          • Tailrec
          • Schemalg
          • Restrict
          • Expdata
            • Expdata-implementation
              • Expdata-event-generation
              • Expdata-fn
              • Expdata-input-processing
                • Expdata-symbol-surjmap-alistp
                • Expdata-surjmapp
                • Expdata-pos-surjmap-alistp
                  • Expdata-process-surj
                  • Expdata-process-arg/res-list-surj
                  • Expdata-process-inputs
                  • Expdata-process-surjmaps
                  • Expdata-fresh-defsurj-thm-names
                  • Expdata-process-arg/res-list
                  • Expdata-process-arg/res-list-surj-list
                  • Expdata-process-res
                  • Expdata-process-newp-of-new-name
                  • Expdata-fresh-defsurj-name-with-*s-suffix
                  • Expdata-process-surjmaps-ress
                  • Expdata-process-surjmaps-args
                  • Expdata-process-arg/res-list-surj-add-args
                  • Expdata-process-arg/res-list-surj-add-ress
                  • Expdata-process-old
                  • Expdata-process-arg/res-list-aux
                  • Expdata-surjmap-listp
                  • Expdata-fresh-defsurj-name-with-*s-suffix-aux
                • Expdata-macro-definition
            • Casesplit
            • Simplify-term
            • Simplify-defun-sk
            • Parteval
            • Solve
            • Wrap-output
            • Propagate-iso
            • Simplify
            • Finite-difference
            • Drop-irrelevant-params
            • Copy-function
            • Lift-iso
            • Rename-params
            • Utilities
            • Simplify-term-programmatic
            • Simplify-defun-sk-programmatic
            • Simplify-defun-programmatic
            • Simplify-defun+
            • Common-options
            • Common-concepts
          • Error-checking
          • Fty-extensions
          • Isar
          • Kestrel-utilities
          • Set
          • C
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Expdata-input-processing

    Expdata-pos-surjmap-alistp

    Recognize alists from positive integers to surjective mapping records.

    This is an ordinary std::defalist.

    Function: expdata-pos-surjmap-alistp

    (defun expdata-pos-surjmap-alistp (x)
      (declare (xargs :guard t))
      (if (consp x)
          (and (consp (car x))
               (posp (caar x))
               (expdata-surjmapp (cdar x))
               (expdata-pos-surjmap-alistp (cdr x)))
        (null x)))

    Definitions and Theorems

    Function: expdata-pos-surjmap-alistp

    (defun expdata-pos-surjmap-alistp (x)
      (declare (xargs :guard t))
      (if (consp x)
          (and (consp (car x))
               (posp (caar x))
               (expdata-surjmapp (cdar x))
               (expdata-pos-surjmap-alistp (cdr x)))
        (null x)))

    Theorem: expdata-pos-surjmap-alistp-of-revappend

    (defthm expdata-pos-surjmap-alistp-of-revappend
      (equal (expdata-pos-surjmap-alistp (revappend acl2::x acl2::y))
             (and (expdata-pos-surjmap-alistp (list-fix acl2::x))
                  (expdata-pos-surjmap-alistp acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-remove

    (defthm expdata-pos-surjmap-alistp-of-remove
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (expdata-pos-surjmap-alistp (remove acl2::a acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-last

    (defthm expdata-pos-surjmap-alistp-of-last
      (implies (expdata-pos-surjmap-alistp (double-rewrite acl2::x))
               (expdata-pos-surjmap-alistp (last acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-nthcdr

    (defthm expdata-pos-surjmap-alistp-of-nthcdr
      (implies (expdata-pos-surjmap-alistp (double-rewrite acl2::x))
               (expdata-pos-surjmap-alistp (nthcdr acl2::n acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-butlast

    (defthm expdata-pos-surjmap-alistp-of-butlast
      (implies (expdata-pos-surjmap-alistp (double-rewrite acl2::x))
               (expdata-pos-surjmap-alistp (butlast acl2::x acl2::n)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-update-nth

    (defthm expdata-pos-surjmap-alistp-of-update-nth
     (implies
      (expdata-pos-surjmap-alistp (double-rewrite acl2::x))
      (iff
       (expdata-pos-surjmap-alistp (update-nth acl2::n acl2::y acl2::x))
       (and (and (consp acl2::y)
                 (posp (car acl2::y))
                 (expdata-surjmapp (cdr acl2::y)))
            (or (<= (nfix acl2::n) (len acl2::x))
                (and (consp nil)
                     (posp (car nil))
                     (expdata-surjmapp (cdr nil)))))))
     :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-repeat

    (defthm expdata-pos-surjmap-alistp-of-repeat
      (iff (expdata-pos-surjmap-alistp (repeat acl2::n acl2::x))
           (or (and (consp acl2::x)
                    (posp (car acl2::x))
                    (expdata-surjmapp (cdr acl2::x)))
               (zp acl2::n)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-take

    (defthm expdata-pos-surjmap-alistp-of-take
      (implies (expdata-pos-surjmap-alistp (double-rewrite acl2::x))
               (iff (expdata-pos-surjmap-alistp (take acl2::n acl2::x))
                    (or (and (consp nil)
                             (posp (car nil))
                             (expdata-surjmapp (cdr nil)))
                        (<= (nfix acl2::n) (len acl2::x)))))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-union-equal

    (defthm expdata-pos-surjmap-alistp-of-union-equal
     (equal (expdata-pos-surjmap-alistp (union-equal acl2::x acl2::y))
            (and (expdata-pos-surjmap-alistp (list-fix acl2::x))
                 (expdata-pos-surjmap-alistp (double-rewrite acl2::y))))
     :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-intersection-equal-2

    (defthm expdata-pos-surjmap-alistp-of-intersection-equal-2
     (implies
      (expdata-pos-surjmap-alistp (double-rewrite acl2::y))
      (expdata-pos-surjmap-alistp (intersection-equal acl2::x acl2::y)))
     :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-intersection-equal-1

    (defthm expdata-pos-surjmap-alistp-of-intersection-equal-1
     (implies
      (expdata-pos-surjmap-alistp (double-rewrite acl2::x))
      (expdata-pos-surjmap-alistp (intersection-equal acl2::x acl2::y)))
     :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-set-difference-equal

    (defthm expdata-pos-surjmap-alistp-of-set-difference-equal
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (expdata-pos-surjmap-alistp
                    (set-difference-equal acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-when-subsetp-equal

    (defthm expdata-pos-surjmap-alistp-when-subsetp-equal
      (and (implies (and (subsetp-equal acl2::x acl2::y)
                         (expdata-pos-surjmap-alistp acl2::y))
                    (equal (expdata-pos-surjmap-alistp acl2::x)
                           (true-listp acl2::x)))
           (implies (and (expdata-pos-surjmap-alistp acl2::y)
                         (subsetp-equal acl2::x acl2::y))
                    (equal (expdata-pos-surjmap-alistp acl2::x)
                           (true-listp acl2::x))))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-rcons

    (defthm expdata-pos-surjmap-alistp-of-rcons
      (iff (expdata-pos-surjmap-alistp (rcons acl2::a acl2::x))
           (and (and (consp acl2::a)
                     (posp (car acl2::a))
                     (expdata-surjmapp (cdr acl2::a)))
                (expdata-pos-surjmap-alistp (list-fix acl2::x))))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-append

    (defthm expdata-pos-surjmap-alistp-of-append
      (equal (expdata-pos-surjmap-alistp (append acl2::a acl2::b))
             (and (expdata-pos-surjmap-alistp (list-fix acl2::a))
                  (expdata-pos-surjmap-alistp acl2::b)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-rev

    (defthm expdata-pos-surjmap-alistp-of-rev
      (equal (expdata-pos-surjmap-alistp (rev acl2::x))
             (expdata-pos-surjmap-alistp (list-fix acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-duplicated-members

    (defthm expdata-pos-surjmap-alistp-of-duplicated-members
     (implies (expdata-pos-surjmap-alistp acl2::x)
              (expdata-pos-surjmap-alistp (duplicated-members acl2::x)))
     :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-difference

    (defthm expdata-pos-surjmap-alistp-of-difference
     (implies (expdata-pos-surjmap-alistp acl2::x)
              (expdata-pos-surjmap-alistp (difference acl2::x acl2::y)))
     :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-intersect-2

    (defthm expdata-pos-surjmap-alistp-of-intersect-2
      (implies (expdata-pos-surjmap-alistp acl2::y)
               (expdata-pos-surjmap-alistp (intersect acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-intersect-1

    (defthm expdata-pos-surjmap-alistp-of-intersect-1
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (expdata-pos-surjmap-alistp (intersect acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-union

    (defthm expdata-pos-surjmap-alistp-of-union
      (iff (expdata-pos-surjmap-alistp (union acl2::x acl2::y))
           (and (expdata-pos-surjmap-alistp (sfix acl2::x))
                (expdata-pos-surjmap-alistp (sfix acl2::y))))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-mergesort

    (defthm expdata-pos-surjmap-alistp-of-mergesort
      (iff (expdata-pos-surjmap-alistp (mergesort acl2::x))
           (expdata-pos-surjmap-alistp (list-fix acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-delete

    (defthm expdata-pos-surjmap-alistp-of-delete
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (expdata-pos-surjmap-alistp (delete acl2::k acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-insert

    (defthm expdata-pos-surjmap-alistp-of-insert
      (iff (expdata-pos-surjmap-alistp (insert acl2::a acl2::x))
           (and (expdata-pos-surjmap-alistp (sfix acl2::x))
                (and (consp acl2::a)
                     (posp (car acl2::a))
                     (expdata-surjmapp (cdr acl2::a)))))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-sfix

    (defthm expdata-pos-surjmap-alistp-of-sfix
      (iff (expdata-pos-surjmap-alistp (sfix acl2::x))
           (or (expdata-pos-surjmap-alistp acl2::x)
               (not (setp acl2::x))))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-list-fix

    (defthm expdata-pos-surjmap-alistp-of-list-fix
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (expdata-pos-surjmap-alistp (list-fix acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: true-listp-when-expdata-pos-surjmap-alistp-compound-recognizer

    (defthm
         true-listp-when-expdata-pos-surjmap-alistp-compound-recognizer
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (true-listp acl2::x))
      :rule-classes :compound-recognizer)

    Theorem: expdata-pos-surjmap-alistp-when-not-consp

    (defthm expdata-pos-surjmap-alistp-when-not-consp
      (implies (not (consp acl2::x))
               (equal (expdata-pos-surjmap-alistp acl2::x)
                      (not acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-cdr-when-expdata-pos-surjmap-alistp

    (defthm
      expdata-pos-surjmap-alistp-of-cdr-when-expdata-pos-surjmap-alistp
      (implies (expdata-pos-surjmap-alistp (double-rewrite acl2::x))
               (expdata-pos-surjmap-alistp (cdr acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-cons

    (defthm expdata-pos-surjmap-alistp-of-cons
      (equal (expdata-pos-surjmap-alistp (cons acl2::a acl2::x))
             (and (and (consp acl2::a)
                       (posp (car acl2::a))
                       (expdata-surjmapp (cdr acl2::a)))
                  (expdata-pos-surjmap-alistp acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-make-fal

    (defthm expdata-pos-surjmap-alistp-of-make-fal
      (implies (and (expdata-pos-surjmap-alistp acl2::x)
                    (expdata-pos-surjmap-alistp acl2::y))
               (expdata-pos-surjmap-alistp (make-fal acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-surjmapp-of-cdr-when-member-equal-of-expdata-pos-surjmap-alistp

    (defthm
     expdata-surjmapp-of-cdr-when-member-equal-of-expdata-pos-surjmap-alistp
     (and (implies (and (expdata-pos-surjmap-alistp acl2::x)
                        (member-equal acl2::a acl2::x))
                   (expdata-surjmapp (cdr acl2::a)))
          (implies (and (member-equal acl2::a acl2::x)
                        (expdata-pos-surjmap-alistp acl2::x))
                   (expdata-surjmapp (cdr acl2::a))))
     :rule-classes ((:rewrite)))

    Theorem: posp-of-car-when-member-equal-of-expdata-pos-surjmap-alistp

    (defthm posp-of-car-when-member-equal-of-expdata-pos-surjmap-alistp
      (and (implies (and (expdata-pos-surjmap-alistp acl2::x)
                         (member-equal acl2::a acl2::x))
                    (posp (car acl2::a)))
           (implies (and (member-equal acl2::a acl2::x)
                         (expdata-pos-surjmap-alistp acl2::x))
                    (posp (car acl2::a))))
      :rule-classes ((:rewrite)))

    Theorem: consp-when-member-equal-of-expdata-pos-surjmap-alistp

    (defthm consp-when-member-equal-of-expdata-pos-surjmap-alistp
      (implies (and (expdata-pos-surjmap-alistp acl2::x)
                    (member-equal acl2::a acl2::x))
               (consp acl2::a))
      :rule-classes
      ((:rewrite :backchain-limit-lst (0 0))
       (:rewrite
            :backchain-limit-lst (0 0)
            :corollary (implies (if (member-equal acl2::a acl2::x)
                                    (expdata-pos-surjmap-alistp acl2::x)
                                  'nil)
                                (consp acl2::a)))))

    Theorem: expdata-pos-surjmap-alistp-of-remove-assoc

    (defthm expdata-pos-surjmap-alistp-of-remove-assoc
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (expdata-pos-surjmap-alistp
                    (remove-assoc-equal acl2::name acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-put-assoc

    (defthm expdata-pos-surjmap-alistp-of-put-assoc
      (implies (and (expdata-pos-surjmap-alistp acl2::x))
               (iff (expdata-pos-surjmap-alistp
                         (put-assoc-equal acl2::name acl2::val acl2::x))
                    (and (posp acl2::name)
                         (expdata-surjmapp acl2::val))))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-fast-alist-clean

    (defthm expdata-pos-surjmap-alistp-of-fast-alist-clean
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (expdata-pos-surjmap-alistp (fast-alist-clean acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-hons-shrink-alist

    (defthm expdata-pos-surjmap-alistp-of-hons-shrink-alist
     (implies
       (and (expdata-pos-surjmap-alistp acl2::x)
            (expdata-pos-surjmap-alistp acl2::y))
       (expdata-pos-surjmap-alistp (hons-shrink-alist acl2::x acl2::y)))
     :rule-classes ((:rewrite)))

    Theorem: expdata-pos-surjmap-alistp-of-hons-acons

    (defthm expdata-pos-surjmap-alistp-of-hons-acons
     (equal
       (expdata-pos-surjmap-alistp (hons-acons acl2::a acl2::n acl2::x))
       (and (posp acl2::a)
            (expdata-surjmapp acl2::n)
            (expdata-pos-surjmap-alistp acl2::x)))
     :rule-classes ((:rewrite)))

    Theorem: expdata-surjmapp-of-cdr-of-hons-assoc-equal-when-expdata-pos-surjmap-alistp

    (defthm
     expdata-surjmapp-of-cdr-of-hons-assoc-equal-when-expdata-pos-surjmap-alistp
     (implies
        (expdata-pos-surjmap-alistp acl2::x)
        (iff (expdata-surjmapp (cdr (hons-assoc-equal acl2::k acl2::x)))
             (hons-assoc-equal acl2::k acl2::x)))
     :rule-classes ((:rewrite)))

    Theorem: alistp-when-expdata-pos-surjmap-alistp-rewrite

    (defthm alistp-when-expdata-pos-surjmap-alistp-rewrite
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (alistp acl2::x))
      :rule-classes ((:rewrite)))

    Theorem: alistp-when-expdata-pos-surjmap-alistp

    (defthm alistp-when-expdata-pos-surjmap-alistp
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (alistp acl2::x))
      :rule-classes :tau-system)

    Theorem: expdata-surjmapp-of-cdar-when-expdata-pos-surjmap-alistp

    (defthm expdata-surjmapp-of-cdar-when-expdata-pos-surjmap-alistp
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (iff (expdata-surjmapp (cdar acl2::x))
                    (consp acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: posp-of-caar-when-expdata-pos-surjmap-alistp

    (defthm posp-of-caar-when-expdata-pos-surjmap-alistp
      (implies (expdata-pos-surjmap-alistp acl2::x)
               (iff (posp (caar acl2::x))
                    (consp acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: expdata-posp-of-key-of-pos-surjmap-alist

    (defthm expdata-posp-of-key-of-pos-surjmap-alist
      (implies (and (expdata-pos-surjmap-alistp x)
                    (consp (assoc-equal k x)))
               (posp (car (assoc-equal k x)))))

    Theorem: expdata-surjmapp-of-val-of-pos-surjmap-alist

    (defthm expdata-surjmapp-of-val-of-pos-surjmap-alist
      (implies (and (expdata-pos-surjmap-alistp x)
                    (consp (assoc-equal k x)))
               (expdata-surjmapp (cdr (assoc-equal k x)))))