• 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

    Encode the last group of (up to three) characters.

    Signature
    (b64-encode-last-group x) → (mv e1 e2 e3 e4)
    Arguments
    x — Guard (character-listp x).
    Returns
    e1 — Type (characterp e1).
    e2 — Type (characterp e2).
    e3 — Type (characterp e3).
    e4 — Type (characterp e4).

    Definitions and Theorems

    Function: b64-encode-last-group

    (defun b64-encode-last-group (x)
      (declare (xargs :guard (character-listp x)))
      (declare (xargs :guard (consp x)))
      (let ((acl2::__function__ 'b64-encode-last-group))
        (declare (ignorable acl2::__function__))
        (cond ((atom (cdr x))
               (b* (((mv c1 c2) (b64-enc1 (first x))))
                 (mv c1 c2 #\= #\=)))
              ((atom (cddr x))
               (b* (((mv c1 c2 c3)
                     (b64-enc2 (first x) (second x))))
                 (mv c1 c2 c3 #\=)))
              (t (b64-enc3 (first x)
                           (second x)
                           (third x))))))

    Theorem: characterp-of-b64-encode-last-group.e1

    (defthm characterp-of-b64-encode-last-group.e1
      (b* (((mv ?e1 ?e2 ?e3 ?e4)
            (b64-encode-last-group x)))
        (characterp e1))
      :rule-classes :type-prescription)

    Theorem: characterp-of-b64-encode-last-group.e2

    (defthm characterp-of-b64-encode-last-group.e2
      (b* (((mv ?e1 ?e2 ?e3 ?e4)
            (b64-encode-last-group x)))
        (characterp e2))
      :rule-classes :type-prescription)

    Theorem: characterp-of-b64-encode-last-group.e3

    (defthm characterp-of-b64-encode-last-group.e3
      (b* (((mv ?e1 ?e2 ?e3 ?e4)
            (b64-encode-last-group x)))
        (characterp e3))
      :rule-classes :type-prescription)

    Theorem: characterp-of-b64-encode-last-group.e4

    (defthm characterp-of-b64-encode-last-group.e4
      (b* (((mv ?e1 ?e2 ?e3 ?e4)
            (b64-encode-last-group x)))
        (characterp e4))
      :rule-classes :type-prescription)