Check if address is valid Bech32.
Verifies that
Disallows a mixed-case string; then downcases the string before converting the data characters to bytes and verifying the checksum.
Function:
(defun valid-bech32 (address) (declare (xargs :guard (stringp address))) (let ((__function__ 'valid-bech32)) (declare (ignorable __function__)) (b* (((when (mixed-case-stringp address)) nil) (address (str::downcase-string address)) ((mv erp hrp data) (bech32-split-address address)) ((when erp) nil)) (bech32-verify-checksum hrp data))))
Theorem:
(defthm booleanp-of-valid-bech32 (b* ((y/n (valid-bech32 address))) (booleanp y/n)) :rule-classes :rewrite)