• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Pfcs
      • Wp-gen
      • Dimacs-reader
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Riscv
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
        • Primitive-functions
        • Translated-terms
        • Values
        • Evaluation
        • Program-equivalence
        • Functions
        • Packages
        • Programs
        • Interpreter
        • Evaluation-states
          • Eval-state
          • Frame
          • Binding
          • Stack
            • Stack-fix
            • Stack-equiv
            • Stackp
              • Stackp-basics
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Stackp

    Stackp-basics

    Basic theorems about stackp, generated by std::deflist.

    Definitions and Theorems

    Theorem: stackp-of-cons

    (defthm stackp-of-cons
      (equal (stackp (cons acl2::a acl2::x))
             (and (framep acl2::a) (stackp acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-cdr-when-stackp

    (defthm stackp-of-cdr-when-stackp
      (implies (stackp (double-rewrite acl2::x))
               (stackp (cdr acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-when-not-consp

    (defthm stackp-when-not-consp
      (implies (not (consp acl2::x))
               (equal (stackp acl2::x) (not acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: framep-of-car-when-stackp

    (defthm framep-of-car-when-stackp
      (implies (stackp acl2::x)
               (iff (framep (car acl2::x))
                    (consp acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: true-listp-when-stackp-compound-recognizer

    (defthm true-listp-when-stackp-compound-recognizer
      (implies (stackp acl2::x)
               (true-listp acl2::x))
      :rule-classes :compound-recognizer)

    Theorem: stackp-of-list-fix

    (defthm stackp-of-list-fix
      (implies (stackp acl2::x)
               (stackp (list-fix acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-sfix

    (defthm stackp-of-sfix
      (iff (stackp (sfix acl2::x))
           (or (stackp acl2::x)
               (not (setp acl2::x))))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-insert

    (defthm stackp-of-insert
      (iff (stackp (insert acl2::a acl2::x))
           (and (stackp (sfix acl2::x))
                (framep acl2::a)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-delete

    (defthm stackp-of-delete
      (implies (stackp acl2::x)
               (stackp (delete acl2::k acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-mergesort

    (defthm stackp-of-mergesort
      (iff (stackp (mergesort acl2::x))
           (stackp (list-fix acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-union

    (defthm stackp-of-union
      (iff (stackp (union acl2::x acl2::y))
           (and (stackp (sfix acl2::x))
                (stackp (sfix acl2::y))))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-intersect-1

    (defthm stackp-of-intersect-1
      (implies (stackp acl2::x)
               (stackp (intersect acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-intersect-2

    (defthm stackp-of-intersect-2
      (implies (stackp acl2::y)
               (stackp (intersect acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-difference

    (defthm stackp-of-difference
      (implies (stackp acl2::x)
               (stackp (difference acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-duplicated-members

    (defthm stackp-of-duplicated-members
      (implies (stackp acl2::x)
               (stackp (duplicated-members acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-rev

    (defthm stackp-of-rev
      (equal (stackp (rev acl2::x))
             (stackp (list-fix acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-append

    (defthm stackp-of-append
      (equal (stackp (append acl2::a acl2::b))
             (and (stackp (list-fix acl2::a))
                  (stackp acl2::b)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-rcons

    (defthm stackp-of-rcons
      (iff (stackp (rcons acl2::a acl2::x))
           (and (framep acl2::a)
                (stackp (list-fix acl2::x))))
      :rule-classes ((:rewrite)))

    Theorem: framep-when-member-equal-of-stackp

    (defthm framep-when-member-equal-of-stackp
      (and (implies (and (member-equal acl2::a acl2::x)
                         (stackp acl2::x))
                    (framep acl2::a))
           (implies (and (stackp acl2::x)
                         (member-equal acl2::a acl2::x))
                    (framep acl2::a)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-when-subsetp-equal

    (defthm stackp-when-subsetp-equal
      (and (implies (and (subsetp-equal acl2::x acl2::y)
                         (stackp acl2::y))
                    (equal (stackp acl2::x)
                           (true-listp acl2::x)))
           (implies (and (stackp acl2::y)
                         (subsetp-equal acl2::x acl2::y))
                    (equal (stackp acl2::x)
                           (true-listp acl2::x))))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-set-difference-equal

    (defthm stackp-of-set-difference-equal
      (implies (stackp acl2::x)
               (stackp (set-difference-equal acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-intersection-equal-1

    (defthm stackp-of-intersection-equal-1
      (implies (stackp (double-rewrite acl2::x))
               (stackp (intersection-equal acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-intersection-equal-2

    (defthm stackp-of-intersection-equal-2
      (implies (stackp (double-rewrite acl2::y))
               (stackp (intersection-equal acl2::x acl2::y)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-union-equal

    (defthm stackp-of-union-equal
      (equal (stackp (union-equal acl2::x acl2::y))
             (and (stackp (list-fix acl2::x))
                  (stackp (double-rewrite acl2::y))))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-take

    (defthm stackp-of-take
      (implies (stackp (double-rewrite acl2::x))
               (iff (stackp (take acl2::n acl2::x))
                    (or (framep nil)
                        (<= (nfix acl2::n) (len acl2::x)))))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-repeat

    (defthm stackp-of-repeat
      (iff (stackp (repeat acl2::n acl2::x))
           (or (framep acl2::x) (zp acl2::n)))
      :rule-classes ((:rewrite)))

    Theorem: framep-of-nth-when-stackp

    (defthm framep-of-nth-when-stackp
      (implies (stackp acl2::x)
               (iff (framep (nth acl2::n acl2::x))
                    (< (nfix acl2::n) (len acl2::x))))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-update-nth

    (defthm stackp-of-update-nth
      (implies (stackp (double-rewrite acl2::x))
               (iff (stackp (update-nth acl2::n acl2::y acl2::x))
                    (and (framep acl2::y)
                         (or (<= (nfix acl2::n) (len acl2::x))
                             (framep nil)))))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-butlast

    (defthm stackp-of-butlast
      (implies (stackp (double-rewrite acl2::x))
               (stackp (butlast acl2::x acl2::n)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-nthcdr

    (defthm stackp-of-nthcdr
      (implies (stackp (double-rewrite acl2::x))
               (stackp (nthcdr acl2::n acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-last

    (defthm stackp-of-last
      (implies (stackp (double-rewrite acl2::x))
               (stackp (last acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-remove

    (defthm stackp-of-remove
      (implies (stackp acl2::x)
               (stackp (remove acl2::a acl2::x)))
      :rule-classes ((:rewrite)))

    Theorem: stackp-of-revappend

    (defthm stackp-of-revappend
      (equal (stackp (revappend acl2::x acl2::y))
             (and (stackp (list-fix acl2::x))
                  (stackp acl2::y)))
      :rule-classes ((:rewrite)))