• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Pfcs
        • Proof-support
        • Semantics
        • Lifting
        • R1cs-subset
          • R1cs-monomialp
            • Sr1cs-constraintp
            • R1cs-polynomialp
            • R1cs-constraintp
            • Sr1cs-definitionp
            • R1cs-systemp
            • Sr1cs-systemp
            • Sr1cs-definition-listp
            • Sr1cs-constraint-listp
            • R1cs-constraint-listp
          • Indexed-names
          • Well-formedness
          • Abstract-syntax
          • Concrete-syntax
          • R1cs-bridge
          • Parser-interface
        • Wp-gen
        • Dimacs-reader
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Riscv
        • Bitcoin
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • R1cs-subset

    R1cs-monomialp

    Check if a PFCS expression is an R1CS monomial.

    Signature
    (r1cs-monomialp expr) → yes/no
    Arguments
    expr — Guard (expressionp expr).
    Returns
    yes/no — Type (booleanp yes/no).

    This is an addend of an R1CS polynomial (i.e. linear combination). It is either a constant, or a variable, or a negated constant or variable, or a product of a constant (natural number) by a variable, or a product of a negated constant (negative number) by a variable.

    Although it could be supported, for simplicity we disallow a product of a constant (natural number) by a negated variable.

    Definitions and Theorems

    Function: r1cs-monomialp

    (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 :neg)
            (expression-case (expression-neg->arg expr)
                             :const))
       (and (expression-case expr :neg)
            (expression-case (expression-neg->arg expr)
                             :var))
       (and
         (expression-case expr :mul)
         (or (expression-case (expression-mul->arg1 expr)
                              :const)
             (and (expression-case (expression-mul->arg1 expr)
                                   :neg)
                  (expression-case
                       (expression-neg->arg (expression-mul->arg1 expr))
                       :const)))
         (expression-case (expression-mul->arg2 expr)
                          :var)))))

    Theorem: booleanp-of-r1cs-monomialp

    (defthm booleanp-of-r1cs-monomialp
      (b* ((yes/no (r1cs-monomialp expr)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: r1cs-monomialp-of-expression-fix-expr

    (defthm r1cs-monomialp-of-expression-fix-expr
      (equal (r1cs-monomialp (expression-fix expr))
             (r1cs-monomialp expr)))

    Theorem: r1cs-monomialp-expression-equiv-congruence-on-expr

    (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)