Lex a
(lex-repetition-1*6-hex-digit input) → (mv trees rest-input)
This is used to lex Unicode escape sequences. We just lex any number of hexadecimal digits, and we ensure that we find between one and six. If we read none, it is clearly a failure. If we read more than six, there is no point in just considering the first six and continuing the lexing, because the six hexadecimal digits must be followed by a closing brace: so, if instead there is a seventh hexadecimal digit, this cannot be part of a valid Unicode character escape.
Function:
(defun lex-repetition-1*6-hex-digit (input) (declare (xargs :guard (nat-listp input))) (let ((__function__ 'lex-repetition-1*6-hex-digit)) (declare (ignorable __function__)) (b* (((mv trees input1) (lex-repetition-*-hex-digit input)) ((unless (and (<= 1 (len trees)) (<= (len trees) 6))) (mv (reserrf (list :found trees)) (nat-list-fix input)))) (mv trees input1))))
Theorem:
(defthm tree-list-resultp-of-lex-repetition-1*6-hex-digit.trees (b* (((mv ?trees ?rest-input) (lex-repetition-1*6-hex-digit input))) (abnf::tree-list-resultp trees)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-lex-repetition-1*6-hex-digit.rest-input (b* (((mv ?trees ?rest-input) (lex-repetition-1*6-hex-digit input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-lex-1*6-hex-digit-<= (b* (((mv ?trees ?rest-input) (lex-repetition-1*6-hex-digit input))) (<= (len rest-input) (len input))) :rule-classes :linear)
Theorem:
(defthm lex-repetition-1*6-hex-digit-of-nat-list-fix-input (equal (lex-repetition-1*6-hex-digit (nat-list-fix input)) (lex-repetition-1*6-hex-digit input)))
Theorem:
(defthm lex-repetition-1*6-hex-digit-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv input input-equiv) (equal (lex-repetition-1*6-hex-digit input) (lex-repetition-1*6-hex-digit input-equiv))) :rule-classes :congruence)