• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
        • Mlib
        • Server
        • Kit
        • Printer
          • Ps
          • Basic-printing
          • Verilog-printing
          • Printing-locally
          • Formatted-printing
          • Accessing-printed-output
          • Vl-printedlist
            • Vl-printedlist-fix
            • Vl-printedlist-p
              • Vl-printedlist-p-basics
              • Vl-printedlist-peek
              • Vl-printedlist-length
              • Vl-printedlist-equiv
              • Vl-printedlist->string
              • Vl-printed-p
            • Json-printing
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-printedlist-p

    Vl-printedlist-length

    Compute the total length of the list, in characters.

    Signature
    (vl-printedlist-length x acc) → len
    Arguments
    x — Guard (vl-printedlist-p x).
    acc — Guard (natp acc).
    Returns
    len — Type (natp len).

    This is different than ordinary len because any strings within the list may have their own lengths.

    Definitions and Theorems

    Function: vl-printedlist-length

    (defun vl-printedlist-length (x acc)
      (declare (xargs :guard (and (vl-printedlist-p x) (natp acc))))
      (let ((__function__ 'vl-printedlist-length))
        (declare (ignorable __function__))
        (b* (((when (atom x)) (lnfix acc))
             (x1 (vl-printed-fix (car x)))
             (len1 (if (characterp x1) 1 (length x1))))
          (vl-printedlist-length (cdr x)
                                 (+ len1 (lnfix acc))))))

    Theorem: natp-of-vl-printedlist-length

    (defthm natp-of-vl-printedlist-length
      (b* ((len (vl-printedlist-length x acc)))
        (natp len))
      :rule-classes :type-prescription)