Parse a
(lex-hex-digit abnf::input) → (mv abnf::tree abnf::rest-input)
Function:
(defun lex-hex-digit (abnf::input) (declare (xargs :guard (nat-listp abnf::input))) (let ((__function__ 'lex-hex-digit)) (declare (ignorable __function__)) (b* (((mv abnf::treess abnf::input) (b* (((mv abnf::treess1 abnf::input1) (b* (((mv abnf::tree abnf::input) (lex-decimal-digit abnf::input)) ((when (reserrp abnf::tree)) (mv (fty::reserrf-push abnf::tree) abnf::input)) (abnf::trees1 (list abnf::tree)) (abnf::treess (list abnf::trees1))) (mv abnf::treess abnf::input))) ((when (not (reserrp abnf::treess1))) (mv abnf::treess1 abnf::input1)) ((mv abnf::treess2 abnf::input1) (b* (((mv abnf::tree abnf::input) (abnf::parse-ichars "a" abnf::input)) ((when (reserrp abnf::tree)) (mv (fty::reserrf-push abnf::tree) abnf::input)) (abnf::trees1 (list abnf::tree)) (abnf::treess (list abnf::trees1))) (mv abnf::treess abnf::input))) ((when (not (reserrp abnf::treess2))) (mv abnf::treess2 abnf::input1)) ((mv abnf::treess3 abnf::input1) (b* (((mv abnf::tree abnf::input) (abnf::parse-ichars "b" abnf::input)) ((when (reserrp abnf::tree)) (mv (fty::reserrf-push abnf::tree) abnf::input)) (abnf::trees1 (list abnf::tree)) (abnf::treess (list abnf::trees1))) (mv abnf::treess abnf::input))) ((when (not (reserrp abnf::treess3))) (mv abnf::treess3 abnf::input1)) ((mv abnf::treess4 abnf::input1) (b* (((mv abnf::tree abnf::input) (abnf::parse-ichars "c" abnf::input)) ((when (reserrp abnf::tree)) (mv (fty::reserrf-push abnf::tree) abnf::input)) (abnf::trees1 (list abnf::tree)) (abnf::treess (list abnf::trees1))) (mv abnf::treess abnf::input))) ((when (not (reserrp abnf::treess4))) (mv abnf::treess4 abnf::input1)) ((mv abnf::treess5 abnf::input1) (b* (((mv abnf::tree abnf::input) (abnf::parse-ichars "d" abnf::input)) ((when (reserrp abnf::tree)) (mv (fty::reserrf-push abnf::tree) abnf::input)) (abnf::trees1 (list abnf::tree)) (abnf::treess (list abnf::trees1))) (mv abnf::treess abnf::input))) ((when (not (reserrp abnf::treess5))) (mv abnf::treess5 abnf::input1)) ((mv abnf::treess6 abnf::input1) (b* (((mv abnf::tree abnf::input) (abnf::parse-ichars "e" abnf::input)) ((when (reserrp abnf::tree)) (mv (fty::reserrf-push abnf::tree) abnf::input)) (abnf::trees1 (list abnf::tree)) (abnf::treess (list abnf::trees1))) (mv abnf::treess abnf::input))) ((when (not (reserrp abnf::treess6))) (mv abnf::treess6 abnf::input1)) ((mv abnf::treess7 abnf::input1) (b* (((mv abnf::tree abnf::input) (abnf::parse-ichars "f" abnf::input)) ((when (reserrp abnf::tree)) (mv (fty::reserrf-push abnf::tree) abnf::input)) (abnf::trees1 (list abnf::tree)) (abnf::treess (list abnf::trees1))) (mv abnf::treess abnf::input))) ((when (not (reserrp abnf::treess7))) (mv abnf::treess7 abnf::input1))) (mv (reserrf (list :found (list abnf::treess1 abnf::treess2 abnf::treess3 abnf::treess4 abnf::treess5 abnf::treess6 abnf::treess7) :required '(((:repetition (:repeat 1 (:finite 1)) (:rulename (:rulename "decimal-digit")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive t "a")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive t "b")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive t "c")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive t "d")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive t "e")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive t "f"))))))) abnf::input))) ((when (reserrp abnf::treess)) (mv (fty::reserrf-push abnf::treess) (acl2::nat-list-fix abnf::input)))) (mv (abnf::make-tree-nonleaf :rulename? (abnf::rulename "hex-digit") :branches abnf::treess) abnf::input))))
Theorem:
(defthm tree-resultp-of-lex-hex-digit.tree (b* (((mv abnf::?tree abnf::?rest-input) (lex-hex-digit abnf::input))) (abnf::tree-resultp abnf::tree)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-lex-hex-digit.rest-input (b* (((mv abnf::?tree abnf::?rest-input) (lex-hex-digit abnf::input))) (nat-listp abnf::rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-lex-hex-digit-<= (b* (((mv abnf::?tree abnf::?rest-input) (lex-hex-digit abnf::input))) (<= (len abnf::rest-input) (len abnf::input))) :rule-classes :linear)
Theorem:
(defthm len-of-lex-hex-digit-< (b* (((mv abnf::?tree abnf::?rest-input) (lex-hex-digit abnf::input))) (implies (not (reserrp abnf::tree)) (< (len abnf::rest-input) (len abnf::input)))) :rule-classes :linear)
Theorem:
(defthm lex-hex-digit-of-nat-list-fix-input (equal (lex-hex-digit (acl2::nat-list-fix abnf::input)) (lex-hex-digit abnf::input)))
Theorem:
(defthm lex-hex-digit-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv abnf::input input-equiv) (equal (lex-hex-digit abnf::input) (lex-hex-digit input-equiv))) :rule-classes :congruence)