• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Std/io
      • Oslib
      • Bridge
        • Json-encoding
          • Json-encode-main
          • Json-encode-weird-char
          • Json-encode-atom
          • Json-encode
          • Json-encode-chars
          • Json-encode-char
          • Json-encode-str
            • Json-encode-str-aux
            • Json-simple-alist-p
            • Json-comma-and-maybe-newline
          • Security
          • Command
          • In-main-thread
          • Message
          • Start
          • Bindings
          • Stop
          • Try-in-main-thread
        • Clex
        • Tshell
        • Unsound-eval
        • Hacker
        • ACL2s-interface
        • Startup-banner
        • Command-line
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Json-encode-str

    Json-encode-str-aux

    Signature
    (json-encode-str-aux x n xl acc) → *
    Arguments
    x — Guard (stringp x).
    n — Guard (natp n).
    xl — Guard (equal xl (length x)).

    Definitions and Theorems

    Function: json-encode-str-aux

    (defun json-encode-str-aux (x n xl acc)
      (declare (type string x)
               (type (integer 0 *) n)
               (type (integer 0 *) xl))
      (declare (xargs :guard (and (stringp x)
                                  (natp n)
                                  (equal xl (length x)))))
      (declare (xargs :split-types t :guard (<= n xl)))
      (let ((__function__ 'json-encode-str-aux))
        (declare (ignorable __function__))
        (b* (((when (mbe :logic (zp (- (nfix xl) (nfix n)))
                         :exec (eql n xl)))
              acc)
             (acc (json-encode-char (char x n) acc))
             ((the (integer 0 *) n)
              (+ 1 (the (integer 0 *) (lnfix n)))))
          (json-encode-str-aux x n xl acc))))

    Theorem: json-encode-str-aux-redef

    (defthm json-encode-str-aux-redef
      (implies (and (stringp x)
                    (natp n)
                    (natp xl)
                    (<= n xl)
                    (eql xl (length x)))
               (equal (json-encode-str-aux x n xl acc)
                      (json-encode-chars (nthcdr n (explode x))
                                         acc))))