Check if a PFCS expression is an R1CS monomial.
(r1cs-monomialp expr) → yes/no
This is an addend of an R1CS polynomial (i.e. linear combination). It is either a constant or a variable or a product of a constant by a variable.
Function:
(defun r1cs-monomialp (expr) (declare (xargs :guard (expressionp expr))) (let ((__function__ 'r1cs-monomialp)) (declare (ignorable __function__)) (or (expression-case expr :const) (expression-case expr :var) (and (expression-case expr :mul) (expression-case (expression-mul->arg1 expr) :const) (expression-case (expression-mul->arg2 expr) :var)))))
Theorem:
(defthm booleanp-of-r1cs-monomialp (b* ((yes/no (r1cs-monomialp expr))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm r1cs-monomialp-of-expression-fix-expr (equal (r1cs-monomialp (expression-fix expr)) (r1cs-monomialp expr)))
Theorem:
(defthm r1cs-monomialp-expression-equiv-congruence-on-expr (implies (expression-equiv expr expr-equiv) (equal (r1cs-monomialp expr) (r1cs-monomialp expr-equiv))) :rule-classes :congruence)