• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
          • Name-database
          • Vl-gc
          • Make-lookup-alist
          • Symbol-list-names
          • Html-encoding
          • Nats-from
          • Redundant-mergesort
          • Longest-common-prefix
          • Vl-edition-p
          • Nat-listp
          • Vl-plural-p
          • Vl-remove-keys
          • Sum-nats
          • Vl-maybe-nat-listp
          • Url-encoding
          • Fast-memberp
          • Vl-string-keys-p
          • Max-nats
          • Longest-common-prefix-list
          • Character-list-listp
          • Vl-string-list-values-p
          • Vl-character-list-list-values-p
          • Remove-from-alist
          • Prefix-of-eachp
          • Vl-maybe-string-listp
          • Pos-listp
          • Vl-string-values-p
          • String-list-listp
          • True-list-listp
          • Symbol-list-listp
          • Explode-list
          • All-have-len
            • Min-nats
            • Debuggable-and
            • Vl-starname
            • Remove-equal-without-guard
            • String-fix
            • Longer-than-p
            • Clean-alist
            • Anyp
            • Or*
            • Fast-alist-free-each-alist-val
            • And*
            • Not*
            • Free-list-of-fast-alists
            • *nls*
          • Loader
          • Transforms
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Utilities

    All-have-len

    (all-have-len x n) determines if every element of x has length n.

    Signature
    (all-have-len x n) → *

    Definitions and Theorems

    Function: all-have-len

    (defun all-have-len (x n)
      (declare (xargs :guard t))
      (let ((__function__ 'all-have-len))
        (declare (ignorable __function__))
        (if (consp x)
            (and (eql (len (car x)) n)
                 (all-have-len (cdr x) n))
          t)))

    Theorem: all-have-len-when-not-consp

    (defthm all-have-len-when-not-consp
      (implies (not (consp x))
               (all-have-len x n)))

    Theorem: all-have-len-of-cons

    (defthm all-have-len-of-cons
      (equal (all-have-len (cons a x) n)
             (and (equal (len a) n)
                  (all-have-len x n))))

    Theorem: all-have-len-of-strip-cdrs

    (defthm all-have-len-of-strip-cdrs
      (implies (and (not (zp n)) (all-have-len x n))
               (all-have-len (strip-cdrs x) (1- n))))

    Theorem: alistp-when-all-have-len

    (defthm alistp-when-all-have-len
      (implies (and (not (zp n)) (all-have-len x n))
               (equal (alistp x) (true-listp x))))