Base64 decode a character list.
(base64-decode-list x) → (mv okp ans)
Function:
(defun base64-decode-list (x) (declare (xargs :guard (character-listp x))) (let ((acl2::__function__ 'base64-decode-list)) (declare (ignorable acl2::__function__)) (mbe :logic (b* (((when (atom x)) (mv t nil)) ((when (atom (cdddr x))) (mv nil nil)) (c1 (first x)) (c2 (second x)) (c3 (third x)) (c4 (fourth x)) (rest (cddddr x)) ((when (atom rest)) (b64-decode-last-group c1 c2 c3 c4)) ((mv okp x1 x2 x3) (b64-dec3 c1 c2 c3 c4)) ((unless okp) (mv nil nil)) ((mv rest-ok rest-ans) (base64-decode-list (cddddr x)))) (mv (and okp rest-ok) (list* x1 x2 x3 rest-ans))) :exec (b* (((mv okp acc) (b64-decode-list-impl x nil))) (mv okp (reverse acc))))))
Theorem:
(defthm booleanp-of-base64-decode-list.okp (b* (((mv ?okp ?ans) (base64-decode-list x))) (booleanp okp)) :rule-classes :type-prescription)
Theorem:
(defthm character-listp-of-base64-decode-list.ans (b* (((mv ?okp ?ans) (base64-decode-list x))) (character-listp ans)) :rule-classes :rewrite)
Theorem:
(defthm b64-decode-list-impl-removal (equal (b64-decode-list-impl x acc) (mv (mv-nth 0 (base64-decode-list x)) (revappend (mv-nth 1 (base64-decode-list x)) acc))))
Theorem:
(defthm base64-decode-list-of-base64-encode-list (implies (character-listp x) (b* ((encoded (base64-encode-list x)) ((mv okp decoded) (base64-decode-list encoded))) (and okp (equal decoded x)))))