• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
          • Name-database
          • Vl-gc
          • Symbol-list-names
          • Ints-from
          • Nats-from
          • Make-lookup-alist
          • Redundant-mergesort
          • Longest-common-prefix
          • Vl-remove-keys
          • Vl-plural-p
          • Vl-merge-contiguous-indices
          • Sum-nats
          • Vl-edition-p
          • Vl-maybe-integer-listp
          • Fast-memberp
          • Nat-listp
          • Max-nats
          • Longest-common-prefix-list
          • Character-list-listp
          • Vl-character-list-list-values-p
          • Remove-from-alist
          • Prefix-of-eachp
          • Vl-string-keys-p
          • Vl-maybe-nat-listp
          • Vl-string-list-values-p
          • String-list-listp
          • Vl-string-values-p
          • Explode-list
          • True-list-listp
          • Symbol-list-listp
          • All-have-len
            • Pos-listp
            • Min-nats
            • Debuggable-and
            • Vl-starname
            • Remove-equal-without-guard
            • String-fix
            • Anyp
            • Vl-maybe-string-list
            • Longer-than-p
            • Fast-alist-free-each-alist-val
            • Not*
            • Free-list-of-fast-alists
            • *nls*
          • Printer
          • Kit
          • Mlib
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • 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))))