Grammatical lexing.
(grammar-lexp ucodes trees) → yes/no
The lexical grammar specifies how a sequence of Unicode characters can be organized into a sequence of lexemes; more precisely, into a sequence of lexeme CSTs. This is the case when the fringe of the lexeme CSTs is the Unicode character sequence.
Given a Unicode character sequence
If for each
Function:
(defun grammar-lexp (ucodes trees) (declare (xargs :guard (and (unicode-listp ucodes) (abnf::tree-listp trees)))) (let ((__function__ 'grammar-lexp)) (declare (ignorable __function__)) (and (abnf-tree-list-with-root-p (abnf::tree-list-fix trees) "lexeme") (equal (unicode-list->codepoint-list ucodes) (abnf::tree-list->string trees)))))
Theorem:
(defthm booleanp-of-grammar-lexp (b* ((yes/no (grammar-lexp ucodes trees))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm grammar-lexp-of-unicode-list-fix-ucodes (equal (grammar-lexp (unicode-list-fix ucodes) trees) (grammar-lexp ucodes trees)))
Theorem:
(defthm grammar-lexp-unicode-list-equiv-congruence-on-ucodes (implies (unicode-list-equiv ucodes ucodes-equiv) (equal (grammar-lexp ucodes trees) (grammar-lexp ucodes-equiv trees))) :rule-classes :congruence)
Theorem:
(defthm grammar-lexp-of-tree-list-fix-trees (equal (grammar-lexp ucodes (abnf::tree-list-fix trees)) (grammar-lexp ucodes trees)))
Theorem:
(defthm grammar-lexp-tree-list-equiv-congruence-on-trees (implies (abnf::tree-list-equiv trees trees-equiv) (equal (grammar-lexp ucodes trees) (grammar-lexp ucodes trees-equiv))) :rule-classes :congruence)