• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
        • R1cs
          • R1cs-verification-with-axe
          • R1cs-constraintp
          • Dot-product
          • R1csp
          • R1cs-constraint-holdsp
            • Sparse-vectorp
            • R1cs-holdsp
            • R1cs-constraints-holdp
            • R1cs-constraint-listp
            • Pseudo-varp
            • Pseudo-var-listp
          • Interfaces
          • Sha-2
          • Keccak
          • Kdf
          • Mimc
          • Padding
          • Hmac
          • Elliptic-curves
          • Attachments
          • Elliptic-curve-digital-signature-algorithm
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • R1cs

    R1cs-constraint-holdsp

    Check whether a valuation satisfies an R1CS constraint

    ;; Check whether the VALUATION satisfies the CONSTRAINT.
    (defund r1cs-constraint-holdsp (constraint valuation prime)
      (declare (xargs :guard (and (primep prime)
                                  (r1cs-constraintp constraint)
                                  (r1cs-valuationp valuation prime)
                                  (good-r1cs-constraintp constraint (strip-cars valuation)))))
      ;; The constraint is (a dot x) * (b dot x) - (c dot x) = 0, where x contains
      ;; a single constant 1 followed by the values of the variables.  This is
      ;; equivalent to (a dot x) * (b dot x) = (c dot x).
      (equal (mul (dot-product (r1cs-constraint->a constraint)
                               valuation
                               prime)
                  (dot-product (r1cs-constraint->b constraint)
                               valuation
                               prime)
                  prime)
             (dot-product (r1cs-constraint->c constraint)
                          valuation
                          prime)))