• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
      • Std/lists
      • Omaps
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
        • Pretty-printing
        • Printtree
        • Base64
          • Base64-impl
            • B64-bytes-from-vals
            • B64-vals-from-bytes
            • B64-dec3
            • B64-decode-str-impl
            • B64-dec2
            • B64-encode-last-group
            • B64-value-from-code
            • B64-enc3
            • B64-enc2
            • B64-decode-last-group
            • B64-dec1
            • B64-decode-list-impl
            • B64-encode-str-impl
            • B64-encode-last-group-str
              • B64-enc1
              • B64-char-from-value
              • B64-encode-list-impl
            • Base64-decode-list
            • Base64-decode
            • Base64-encode-list
            • Base64-revappend-decode
            • Base64-revappend-encode
            • Base64-encode
          • Charset-p
          • Strtok!
          • Cases
          • Concatenation
          • Character-kinds
          • Html-encoding
          • Substrings
          • Strtok
          • Equivalences
          • Url-encoding
          • Lines
          • Explode-implode-equalities
          • Ordering
          • Numbers
          • Pad-trim
          • Coercion
          • Std/strings/digit-to-char
          • Substitution
          • Symbols
        • Std/osets
        • Std/io
        • Std/basic
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Base64-impl

    B64-encode-last-group-str

    String-based version of b64-encode-last-group.

    Signature
    (b64-encode-last-group-str x n xl) → (mv * * * *)
    Arguments
    x — Guard (stringp x).
    n — Guard (natp n).
    xl — Guard (eql xl (length x)).

    Definitions and Theorems

    Function: b64-encode-last-group-str

    (defun b64-encode-last-group-str (x n xl)
      (declare (xargs :guard (and (stringp x)
                                  (natp n)
                                  (eql xl (length x)))))
      (declare (type (integer 0 *) n xl)
               (type string x))
      (declare (xargs :guard (< n xl)))
      (let ((acl2::__function__ 'b64-encode-last-group-str))
        (declare (ignorable acl2::__function__))
        (b* (((the (integer 0 *) left)
              (mbe :logic (nfix (- (nfix xl) (nfix n)))
                   :exec (- xl n)))
             ((when (int= left 1))
              (b* (((mv c1 c2) (b64-enc1 (char x n))))
                (mv c1 c2 #\= #\=)))
             ((when (int= left 2))
              (b* (((mv c1 c2 c3)
                    (b64-enc2 (char x n) (char x (+ 1 n)))))
                (mv c1 c2 c3 #\=))))
          (b64-enc3 (char x n)
                    (char x (+ 1 n))
                    (char x (+ 2 n))))))

    Theorem: b64-encode-last-group-str-correct

    (defthm b64-encode-last-group-str-correct
      (implies (and (force (stringp x))
                    (force (natp n))
                    (force (equal xl (length x)))
                    (force (< n xl)))
               (equal (b64-encode-last-group-str x n xl)
                      (b64-encode-last-group (nthcdr n (explode x))))))