• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defconst
        • Fast-alists
        • Defmacro
        • Loop$-primer
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
          • Let
          • Declare
          • Mbe
          • Apply$
          • Loop$
          • Fmt
          • Return-last
          • Mv-let
          • Df
          • Pseudo-termp
          • Defwarrant
          • Er
          • Mbt
          • Time$
          • Msg
          • Ec-call
          • Mv-nth
          • Sys-call
          • Value-triple
          • O-p
          • Comp
          • Member
          • Cw
          • O<
          • Flet
          • Or
          • Hons
          • Cbd
          • Mv
          • Defbadge
          • Append
          • *ACL2-exports*
          • Comment
          • Eql
          • List
          • Unsigned-byte-p
            • Defbyte
              • Defbytelist
                • Defbytelist-standard-instances
                • Defbytelist-implementation
                  • Defbytelist-fn
                    • Defbytelist-macro-definition
                • Defbyte-standard-instances
                • Defbyte-ihs-theorems
                • Defbyte-implementation
              • Unsigned-byte-p-discussion
              • Unsigned-byte-listp
              • Bitops/signed-byte-p
              • Unsigned-byte-fix
              • Bytep
              • Nibblep
              • Ihs/unsigned-byte-p-lemmas
              • Unsigned-byte-p*
              • Unsigned-byte-p-basics
            • Posp
            • Natp
            • The
            • Nth
            • And
            • Len
            • Time-tracker
            • Term-order
            • True-listp
            • Msgp
            • Booleanp
            • <
            • If
            • Pseudo-term-listp
            • +
            • Not
            • With-global-stobj
            • Bitp
            • Equal
            • Cdr
            • Car
            • String-listp
            • Nat-listp
            • Implies
            • Iff
            • Character-listp
            • Alistp
            • Cons
            • Symbol-listp
            • Macrolet
            • Characterp
            • Quote
            • Integerp
            • Consp
            • State-global-let*
            • Compress1
            • Symbolp
            • Stringp
            • *common-lisp-symbols-from-main-lisp-package*
            • True-list-listp
            • Prog2$
            • *
            • Last-prover-steps
            • Hons-acons
            • Let*
            • Eq
            • With-guard-checking
            • @
            • Length
            • With-local-stobj
            • Hard-error
            • Zp
            • -
            • Search
            • Intersection$
            • Assign
            • Aset1
            • Symbol-name
            • Union$
            • Set-gc-strategy
            • Pand
            • In-tau-intervalp
            • Cons-with-hint
            • Break-on-error
            • Case-match
            • Fast-alist-fork
            • Sys-call+
            • Signed-byte-p
            • ACL2-count
            • Remove-duplicates
            • With-serialize-character
            • Observation
            • Hons-resize
            • Make-tau-interval
            • Assoc
            • Logbitp
            • Termp
            • Position
            • *standard-co*
            • Hons-acons!
            • Update-nth
            • Aref1
            • Read-run-time
            • Non-exec
            • Take
            • Swap-stobjs
            • Symbol-package-name
            • Hons-wash
            • Expt
            • Coerce
            • Get-internal-time
            • Keywordp
            • Intern
            • Standard-co
            • Case
            • Standard-oi
            • Good-bye
            • Formula
            • Error1
            • Atom
            • Without-evisc
            • Symbol-alistp
            • Rationalp
            • Ash
            • With-local-state
            • Spec-mv-let
            • Intern-in-package-of-symbol
            • Binary-+
            • <=
            • With-fast-alist
            • Set-difference$
            • Hons-clear
            • Flush-compress
            • Por
            • Rassoc
            • Logand
            • Remove-assoc
            • =
            • Nthcdr
            • Pargs
            • Nfix
            • Hons-copy
            • Alphorder
            • Subsetp
            • Floor
            • Remove1-assoc
            • No-duplicatesp
            • Mv-list
            • Fmt-to-comment-window
            • Canonical-pathname
            • Aset2
            • Serialize-read
            • Random$
            • F-put-global
            • Compress2
            • Concatenate
            • Fast-alist-clean
            • Assert$
            • Remove
            • Remove1
            • Intersectp
            • Endp
            • Put-assoc
            • Princ$
            • Primitive
            • Keyword-value-listp
            • True-list-fix
            • Integer-listp
            • Illegal
            • Hons-get
            • With-output-lock
            • Setenv$
            • Open-output-channel!
            • Fast-alist-free
            • Er-progn
            • Cw-print-base-radix
            • Reverse
            • Cond
            • Complex
            • Add-to-set
            • Truncate
            • Digit-char-p
            • Code-char
            • Char-code
            • Set-print-case
            • Set-print-base
            • Read-ACL2-oracle
            • Plet
            • Print-object$
            • Logior
            • Integer-length
            • Zip
            • With-live-state
            • Hons-assoc-equal
            • Extend-pathname
            • In-package
            • With-guard-checking-event
            • Term-listp
            • Print-object$+
            • Fmx-cw
            • String
            • Mod
            • Unary--
            • Set-print-radix
            • Resize-list
            • Pkg-witness
            • Revappend
            • Null
            • Term-list-listp
            • Make-fast-alist
            • Header
            • Boole$
            • Subseq
            • Logxor
            • With-guard-checking-error-triple
            • /
            • Make-list
            • Char-upcase
            • Char-downcase
            • Strip-cars
            • Set-fmt-hard-right-margin
            • Make-ord
            • Integer-range-p
            • Ifix
            • Fast-alist-free-on-exit
            • F-get-global
            • Binary-append
            • Aref2
            • Standard-char-p
            • Lognot
            • Must-be-equal
            • Getenv$
            • Er-hard
            • Eqlablep
            • Cpu-core-count
            • Boolean-listp
            • Allocate-fixnum-range
            • ACL2-numberp
            • Butlast
            • Pairlis$
            • Mod-expt
            • Hons-equal
            • Gc$
            • Substitute
            • Ceiling
            • With-stolen-alist
            • Mv?-let
            • String-upcase
            • String-downcase
            • Round
            • Evenp
            • Count
            • Char
            • Sys-call-status
            • Progn$
            • Pprogn
            • Lexorder
            • Hons-summary
            • Break$
            • Assert*
            • Lower-case-p
            • Alpha-char-p
            • Strip-cdrs
            • Serialize-write
            • Keyword-listp
            • Upper-case-p
            • Logeqv
            • List*
            • Last
            • Proofs-co
            • Maximum-length
            • Fix
            • Explode-nonnegative-integer
            • Eqlable-listp
            • Dimensions
            • Default
            • Arity
            • Sublis
            • Max
            • Explode-atom
            • Change
            • Zerop
            • String<
            • String-equal
            • Abs
            • Set-print-base-radix
            • Print-base-p
            • Nonnegative-integer-quotient
            • Intern$
            • Getprop
            • Binary-*
            • Aset1-trusted
            • Symbol<
            • String-append
            • Rfix
            • Mv?
            • Logic-fns-list-listp
            • Fast-alist-fork!
            • Er-hard?
            • Char-equal
            • 1+
            • *standard-oi*
            • Sys-call*
            • Mbt*
            • Hons-wash!
            • Hons-clear!
            • Signum
            • Rem
            • Real/rationalp
            • Rational-listp
            • Pos-listp
            • O-first-coeff
            • Logic-fnsp
            • Logic-fns-listp
            • Hons-copy-persistent
            • Gc-strategy
            • Fast-alist-summary
            • String>=
            • String<=
            • Acons
            • O-first-expt
            • Getpropc
            • Fast-alist-clean!
            • >=
            • >
            • Subst
            • Logcount
            • Evens
            • Er-soft
            • Digit-to-char
            • Comp-gcl
            • Atom-listp
            • Arities-okp
            • ACL2-number-listp
            • /=
            • Cadr
            • *standard-ci*
            • Unary-/
            • The-true-list
            • Realfix
            • O-rst
            • Fast-alist-len
            • Complex/complex-rationalp
            • Array2p
            • Array1p
            • Logtest
            • Logandc1
            • Char<
            • 1-
            • Trace-co
            • Putprop
            • Get-real-time
            • Eqlable-alistp
            • Count-keys
            • Assoc-string-equal
            • Logorc1
            • Logandc2
            • Denominator
            • Packn
            • Logic-termp
            • Logic-term-list-listp
            • Fmt!
            • Fms
            • Cw!
            • Assoc-keyword
            • String>
            • Numerator
            • Logorc2
            • Lognor
            • Char>=
            • Update-nth-array
            • The-number
            • Odds
            • Makunbound-global
            • Make-character-list
            • Make
            • List$
            • Int=
            • Get-cpu-time
            • Fmt-to-comment-window!
            • Fms!
            • F-boundp-global
            • Complex-rationalp
            • Alist-to-doublets
            • Access
            • Min
            • Lognand
            • Listp
            • Identity
            • Char>
            • Char<=
            • Zpf
            • Standard-char-listp
            • O-finp
            • Number-subtrees
            • Logic-term-listp
            • Last-cdr
            • Fmt1!
            • Fmt-to-comment-window!+
            • Character-alistp
            • Oddp
            • Minusp
            • Imagpart
            • Conjugate
            • Xor
            • Unquote
            • String-alistp
            • Packn-pos
            • Maybe-flush-and-compress1
            • Kwote
            • Fmt1
            • Fmt-to-comment-window+
            • Cw-print-base-radix!
            • Alist-keys-subsetp
            • Realpart
            • Plusp
            • First
            • Symbol-name-lst
            • R-symbol-alistp
            • R-eqlable-alistp
            • Fmx
            • Cw!+
            • Cons-subtrees
            • Cons-count-bounded
            • Cddr
            • Caar
            • Proper-consp
            • Kwote-lst
            • Improper-consp
            • Cw+
            • Rest
            • Standard-char-p+
            • Mbe1
            • Caddr
            • Pairlis-x2
            • Pairlis-x1
            • O>=
            • O<=
            • O-infp
            • Merge-sort-lexorder
            • Fix-true-list
            • Cdddr
            • Set-fmt-soft-right-margin
            • Real-listp
            • O>
            • Cddar
            • Cdar
            • Cdadr
            • Cdaar
            • Cadar
            • Caadr
            • Caaar
            • Cadddr
            • Caddar
            • Third
            • Tenth
            • Sixth
            • Seventh
            • Second
            • Ninth
            • Fourth
            • Fifth
            • Eighth
            • Cddddr
            • Cdddar
            • Cddadr
            • Cddaar
            • Cdaddr
            • Cdadar
            • Cdaadr
            • Cdaaar
            • Cadadr
            • Cadaar
            • Caaddr
            • Caadar
            • Caaadr
            • Caaaar
            • Hons-shrink-alist!
            • Hons-shrink-alist
            • Flush-hons-get-hash-table-link
            • Delete-assoc
          • Developers-guide
          • System-attachments
          • Advanced-features
          • Set-check-invariant-risk
          • Numbers
          • Efficiency
          • Irrelevant-formals
          • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
          • Redefining-programs
          • Lists
          • Invariant-risk
          • Errors
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Miscellaneous
        • Output-controls
        • Bdd
        • Macros
        • Installation
        • Mailing-lists
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Defbytelist-implementation

    Defbytelist-fn

    Events generated by defbytelist.

    Signature
    (defbytelist-fn type elt-type 
                    pred fix equiv parents short long wrld) 
     
      → 
    event
    Arguments
    wrld — Guard (plist-worldp wrld).
    Returns
    event — A ACL2::maybe-pseudo-event-formp.

    For now we only perform partial validation of the inputs. Future implementations may perform a more thorough validation.

    Definitions and Theorems

    Function: defbytelist-fn

    (defun defbytelist-fn (type elt-type
                                pred fix equiv parents short long wrld)
     (declare (xargs :guard (plist-worldp wrld)))
     (let ((__function__ 'defbytelist-fn))
      (declare (ignorable __function__))
      (b*
       (((unless (symbolp type))
         (raise
          "The TYPE input must be a symbol, ~
                    but it is ~x0 instead."
          type))
        ((unless (symbolp elt-type))
         (raise
          "The :ELT-TYPE input must be a symbol,
                    but it is ~x0 instead."
          elt-type))
        (defbyte-table (table-alist *defbyte-table-name* wrld))
        (defbyte-pair (assoc-eq elt-type defbyte-table))
        ((unless defbyte-pair)
         (raise
          "The :ELT-TYPE input ~x0 must name a type ~
                    previously introduced via DEFBYTE, ~
                    but this is not the case."
          elt-type))
        (defbyte-info (cdr defbyte-pair))
        (size (defbyte-info->size defbyte-info))
        (signed (defbyte-info->signed defbyte-info))
        (fty-table (get-fixtypes-alist wrld))
        (fty-info (find-fixtype elt-type fty-table))
        (bytep (fixtype->pred fty-info))
        (byte-fix (fixtype->fix fty-info))
        ((unless (symbolp pred))
         (raise
          "The :PRED input must be a symbol, ~
                    but it is ~x0 instead."
          pred))
        ((unless (symbolp fix))
         (raise
          "The :FIX input must be a symbol, ~
                    but it is ~x0 instead."
          fix))
        ((unless (symbolp equiv))
         (raise
          "The :EQUIV input must be a symbol, ~
                    but it is ~x0 instead."
          equiv))
        (binpred (if signed 'acl2::signed-byte-listp
                   'acl2::unsigned-byte-listp))
        (pkg (symbol-package-name type))
        (pkg (if (equal pkg *main-lisp-package-name*)
                 "ACL2"
               pkg))
        (pkg-witness (pkg-witness pkg))
        (pred (or pred (add-suffix-to-fn type "-P")))
        (fix (or fix (add-suffix-to-fn type "-FIX")))
        (equiv (or equiv (add-suffix-to-fn type "-EQUIV")))
        (pred-forward-binpred
             (acl2::packn-pos (list pred '-forward- binpred)
                              pkg-witness))
        (pred-rewrite-binpred
             (acl2::packn-pos (list pred '-rewrite- binpred)
                              pkg-witness))
        (binpred-rewrite-pred
             (acl2::packn-pos (list binpred '-rewrite- pred)
                              pkg-witness))
        (true-listp-when-pred-rewrite
             (acl2::packn-pos (list 'true-listp-when- pred '-rewrite)
                              pkg-witness))
        (fix-of-take (acl2::packn-pos (list fix '-of-take)
                                      pkg-witness))
        (fix-of-rcons (acl2::packn-pos (list fix '-of-rcons)
                                       pkg-witness))
        (x (intern-in-package-of-symbol "X" pkg-witness))
        (a (intern-in-package-of-symbol "A" pkg-witness))
        (n (intern-in-package-of-symbol "N" pkg-witness))
        (type-theorems (add-suffix-to-fn type "-THEOREMS"))
        (deflist-event
         (cons
          'deflist
          (cons
           type
           (cons
            ':elt-type
            (cons
             elt-type
             (append
              (and parents (list :parents parents))
              (append
               (and short (list :short short))
               (append
                (and long (list :long long))
                (cons
                 ':true-listp
                 (cons
                  't
                  (cons
                   ':elementp-of-nil
                   (cons
                    'nil
                    (cons
                     ':pred
                     (cons
                      pred
                      (cons
                          ':fix
                          (cons fix
                                (cons ':equiv
                                      (cons equiv 'nil))))))))))))))))))
        (theorems-event
         (cons
          'defsection
          (cons
           type-theorems
           (cons
            ':extension
            (cons
             type
             (cons
              (cons
               'defrule
               (cons
                pred-forward-binpred
                (cons
                 (cons
                    'implies
                    (cons (cons pred (cons x 'nil))
                          (cons (cons binpred (cons size (cons x 'nil)))
                                'nil)))
                 (cons
                  ':rule-classes
                  (cons
                   ':forward-chaining
                   (cons
                    ':in-theory
                    (cons
                     (cons
                      'quote
                      (cons (cons pred (cons bytep (cons binpred 'nil)))
                            'nil))
                     'nil)))))))
              (cons
               (cons
                'defruled
                (cons
                 pred-rewrite-binpred
                 (cons
                  (cons
                    'equal
                    (cons (cons pred (cons x 'nil))
                          (cons (cons binpred (cons size (cons x 'nil)))
                                'nil)))
                  (cons
                   ':in-theory
                   (cons
                    (cons
                      'quote
                      (cons (cons pred (cons bytep (cons binpred 'nil)))
                            'nil))
                    'nil)))))
               (cons
                (cons
                 'defruled
                 (cons
                  binpred-rewrite-pred
                  (cons
                   (cons 'equal
                         (cons (cons binpred (cons size (cons x 'nil)))
                               (cons (cons pred (cons x 'nil)) 'nil)))
                   (cons
                      ':in-theory
                      (cons (cons 'quote
                                  (cons (cons pred-rewrite-binpred 'nil)
                                        'nil))
                            'nil)))))
                (cons
                 (cons
                  'theory-invariant
                  (cons
                   (cons
                     'incompatible
                     (cons (cons ':rewrite
                                 (cons pred-rewrite-binpred 'nil))
                           (cons (cons ':rewrite
                                       (cons binpred-rewrite-pred 'nil))
                                 'nil)))
                   'nil))
                 (cons
                  (cons
                   'defruled
                   (cons
                    true-listp-when-pred-rewrite
                    (cons
                     (cons 'implies
                           (cons (cons pred (cons x 'nil))
                                 (cons (cons 'true-listp (cons x 'nil))
                                       'nil)))
                     (cons
                      ':in-theory
                      (cons (cons 'quote
                                  (cons (cons pred '(true-listp)) 'nil))
                            'nil)))))
                  (cons
                   (cons
                    'defrule
                    (cons
                     fix-of-take
                     (cons
                      (cons
                       'implies
                       (cons
                        (cons
                           '<=
                           (cons (cons 'nfix (cons n 'nil))
                                 (cons (cons 'len (cons x 'nil)) 'nil)))
                        (cons
                         (cons
                          'equal
                          (cons
                           (cons
                               fix
                               (cons (cons 'take (cons n (cons x 'nil)))
                                     'nil))
                           (cons
                            (cons
                             'take
                             (cons
                                n (cons (cons fix (cons x 'nil)) 'nil)))
                            'nil)))
                         'nil)))
                      (cons
                       ':in-theory
                       (cons
                        (cons
                         'quote
                         (cons
                          (cons
                           fix
                           (cons
                                (add-suffix-to-fn fix "-OF-CONS")
                                '(nfix zp len take acl2::take-of-cons)))
                          'nil))
                        'nil)))))
                   (cons
                    (cons
                     'defrule
                     (cons
                      fix-of-rcons
                      (cons
                       (cons
                        'equal
                        (cons
                         (cons
                              fix
                              (cons (cons 'rcons (cons a (cons x 'nil)))
                                    'nil))
                         (cons
                          (cons
                            'rcons
                            (cons (cons byte-fix (cons a 'nil))
                                  (cons (cons fix (cons x 'nil)) 'nil)))
                          'nil)))
                       (cons
                        ':in-theory
                        (cons
                         (cons
                          'quote
                          (cons
                           (cons
                            fix
                            (cons
                               (add-suffix-to-fn fix "-OF-CONS")
                               (cons (add-suffix-to-fn fix "-OF-APPEND")
                                     '(acl2::binary-append-without-guard
                                           rcons))))
                           'nil))
                         'nil)))))
                    'nil)))))))))))))
       (cons 'encapsulate
             (cons 'nil
                   (cons '(logic)
                         (cons deflist-event
                               (cons '(acl2::evmac-prepare-proofs)
                                     (cons theorems-event 'nil)))))))))