• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
        • 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
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • 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)))