Parse two natural numbers that encode, case-insensitively, two given characters, into a tree that matches a case-insensitive character value notation that consists of those two characters.
(parse-ichar2 char1 char2 input) → (mv error? tree? rest-input)
Function:
(defun parse-ichar2 (char1 char2 input) (declare (xargs :guard (and (characterp char1) (characterp char2) (nat-listp input)))) (b* (((mv error? nat1 input) (parse-any input)) ((when error?) (mv error? nil input)) ((unless (nat-match-insensitive-char-p nat1 char1)) (mv *grammar-parser-error-msg* nil (cons nat1 input))) ((mv error? nat2 input) (parse-any input)) ((when error?) (mv error? nil input)) ((unless (nat-match-insensitive-char-p nat2 char2)) (mv *grammar-parser-error-msg* nil (cons nat2 input)))) (mv nil (tree-leafterm (list nat1 nat2)) input)))
Theorem:
(defthm maybe-msgp-of-parse-ichar2.error? (b* (((mv ?error? ?tree? ?rest-input) (parse-ichar2 char1 char2 input))) (maybe-msgp error?)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-parse-ichar2.tree? (b* (((mv ?error? ?tree? ?rest-input) (parse-ichar2 char1 char2 input))) (and (tree-optionp tree?) (implies (not error?) (treep tree?)) (implies error? (not tree?)))) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-ichar2.rest-input (b* (((mv ?error? ?tree? ?rest-input) (parse-ichar2 char1 char2 input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-ichar2-linear (b* (((mv ?error? ?tree? ?rest-input) (parse-ichar2 char1 char2 input))) (and (<= (len rest-input) (len input)) (implies (not error?) (< (len rest-input) (len input))))) :rule-classes :linear)
Theorem:
(defthm parse-ichar2-of-char-fix-char1 (equal (parse-ichar2 (char-fix char1) char2 input) (parse-ichar2 char1 char2 input)))
Theorem:
(defthm parse-ichar2-chareqv-congruence-on-char1 (implies (acl2::chareqv char1 char1-equiv) (equal (parse-ichar2 char1 char2 input) (parse-ichar2 char1-equiv char2 input))) :rule-classes :congruence)
Theorem:
(defthm parse-ichar2-of-char-fix-char2 (equal (parse-ichar2 char1 (char-fix char2) input) (parse-ichar2 char1 char2 input)))
Theorem:
(defthm parse-ichar2-chareqv-congruence-on-char2 (implies (acl2::chareqv char2 char2-equiv) (equal (parse-ichar2 char1 char2 input) (parse-ichar2 char1 char2-equiv input))) :rule-classes :congruence)
Theorem:
(defthm parse-ichar2-of-nat-list-fix-input (equal (parse-ichar2 char1 char2 (nat-list-fix input)) (parse-ichar2 char1 char2 input)))
Theorem:
(defthm parse-ichar2-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv input input-equiv) (equal (parse-ichar2 char1 char2 input) (parse-ichar2 char1 char2 input-equiv))) :rule-classes :congruence)