Parse a
(lex-operator abnf::input) → (mv abnf::tree abnf::rest-input)
Function:
(defun lex-operator (abnf::input) (declare (xargs :guard (nat-listp abnf::input))) (let ((__function__ 'lex-operator)) (declare (ignorable __function__)) (b* (((mv abnf::treess abnf::input) (b* (((mv abnf::treess1 abnf::input1) (b* (((mv abnf::tree abnf::input) (abnf::parse-ichars "+" abnf::input)) ((when (reserrp abnf::tree)) (mv (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 "*" abnf::input)) ((when (reserrp abnf::tree)) (mv (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 ":=" abnf::input)) ((when (reserrp abnf::tree)) (mv (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 "==" abnf::input)) ((when (reserrp abnf::tree)) (mv (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 (reserrf (list :found (list abnf::treess1 abnf::treess2 abnf::treess3 abnf::treess4) :required '(((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive nil "+")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive nil "*")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive nil ":=")))) ((:repetition (:repeat 1 (:finite 1)) (:char-val (:insensitive nil "=="))))))) abnf::input))) ((when (reserrp abnf::treess)) (mv (reserrf-push abnf::treess) (nat-list-fix abnf::input)))) (mv (abnf::make-tree-nonleaf :rulename? (abnf::rulename "operator") :branches abnf::treess) abnf::input))))
Theorem:
(defthm tree-resultp-of-lex-operator.tree (b* (((mv abnf::?tree abnf::?rest-input) (lex-operator abnf::input))) (abnf::tree-resultp abnf::tree)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-lex-operator.rest-input (b* (((mv abnf::?tree abnf::?rest-input) (lex-operator abnf::input))) (nat-listp abnf::rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-lex-operator-<= (b* (((mv abnf::?tree abnf::?rest-input) (lex-operator abnf::input))) (<= (len abnf::rest-input) (len abnf::input))) :rule-classes :linear)
Theorem:
(defthm len-of-lex-operator-< (b* (((mv abnf::?tree abnf::?rest-input) (lex-operator abnf::input))) (implies (not (reserrp abnf::tree)) (< (len abnf::rest-input) (len abnf::input)))) :rule-classes :linear)
Theorem:
(defthm lex-operator-of-nat-list-fix-input (equal (lex-operator (nat-list-fix abnf::input)) (lex-operator abnf::input)))
Theorem:
(defthm lex-operator-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv abnf::input input-equiv) (equal (lex-operator abnf::input) (lex-operator input-equiv))) :rule-classes :congruence)