Grammatical parsing.
(grammar-parsep ucodes tree) → yes/no
The ABNF grammar of Aleo instructions specifies how a sequence of Unicode characters can be organized into a program, more precisely a program CST. This is the case when the fringe of the CST is the Unicode character sequence.
Given a Unicode character sequence
Function:
(defun grammar-parsep (ucodes tree) (declare (xargs :guard (and (leo-early::unicode-listp ucodes) (abnf::treep tree)))) (let ((__function__ 'grammar-parsep)) (declare (ignorable __function__)) (and (cst-matchp tree "program") (equal (leo-early::unicode-list->codepoint-list ucodes) (abnf::tree->string tree)))))
Theorem:
(defthm booleanp-of-grammar-parsep (b* ((yes/no (grammar-parsep ucodes tree))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm grammar-parsep-of-unicode-list-fix-ucodes (equal (grammar-parsep (leo-early::unicode-list-fix ucodes) tree) (grammar-parsep ucodes tree)))
Theorem:
(defthm grammar-parsep-unicode-list-equiv-congruence-on-ucodes (implies (leo-early::unicode-list-equiv ucodes ucodes-equiv) (equal (grammar-parsep ucodes tree) (grammar-parsep ucodes-equiv tree))) :rule-classes :congruence)
Theorem:
(defthm grammar-parsep-of-tree-fix-tree (equal (grammar-parsep ucodes (abnf::tree-fix tree)) (grammar-parsep ucodes tree)))
Theorem:
(defthm grammar-parsep-tree-equiv-congruence-on-tree (implies (abnf::tree-equiv tree tree-equiv) (equal (grammar-parsep ucodes tree) (grammar-parsep ucodes tree-equiv))) :rule-classes :congruence)