pub struct PredicateConstraintSystem<F: Field> { /* private fields */ }Expand description
A constraint system that enforces a predicate
Implementations§
Source§impl<F: Field> PredicateConstraintSystem<F>
impl<F: Field> PredicateConstraintSystem<F>
Sourcepub fn new_polynomial_predicate_cs(
arity: usize,
terms: Vec<(F, Vec<(usize, usize)>)>,
) -> Self
pub fn new_polynomial_predicate_cs( arity: usize, terms: Vec<(F, Vec<(usize, usize)>)>, ) -> Self
Create new polynomial predicate constraint system
Sourcepub fn new_r1cs() -> Result<Self>
pub fn new_r1cs() -> Result<Self>
creates an R1CS predicate which is a special kind of polynomial predicate
Sourcepub fn new_sr1cs_predicate() -> Result<Self>
pub fn new_sr1cs_predicate() -> Result<Self>
Creates a SquareR1CS predicate.
Sourcepub fn get_arity(&self) -> usize
pub fn get_arity(&self) -> usize
Get the arity of the predicate of this PredicateConstraintSystem.
Sourcepub fn num_constraints(&self) -> usize
pub fn num_constraints(&self) -> usize
Get the number of constraints enforced by this predicate.
Sourcepub fn get_constraints(&self) -> &Vec<Constraint>
pub fn get_constraints(&self) -> &Vec<Constraint>
Get a list of constraints enforced in this PredicateConstraintSystem.
Each constraint is a list of linear combinations with size equal to the
arity.
Sourcepub fn get_predicate(&self) -> &Predicate<F>
pub fn get_predicate(&self) -> &Predicate<F>
Get a reference to the predicate in this predicate constraint system
Sourcepub fn enforce_constraint(
&mut self,
constraint: impl IntoIterator<Item = Variable>,
) -> Result<()>
pub fn enforce_constraint( &mut self, constraint: impl IntoIterator<Item = Variable>, ) -> Result<()>
Enforce a constraint in this PredicateConstraintSystem.
The constraint is a list of linear combinations with size equal to the
arity.
Sourcepub fn which_constraint_is_unsatisfied(
&self,
cs: &ConstraintSystem<F>,
) -> Option<usize>
pub fn which_constraint_is_unsatisfied( &self, cs: &ConstraintSystem<F>, ) -> Option<usize>
Check if the constraints enforced by this predicate are satisfied
i.e. L(x_1, x_2, ..., x_n) == 0.
Sourcepub fn to_matrices(&self, cs: &ConstraintSystem<F>) -> Vec<Matrix<F>>
pub fn to_matrices(&self, cs: &ConstraintSystem<F>) -> Vec<Matrix<F>>
Create the set of matrices for this PredicateConstraintSystem.
Trait Implementations§
Source§impl<F: Clone + Field> Clone for PredicateConstraintSystem<F>
impl<F: Clone + Field> Clone for PredicateConstraintSystem<F>
Source§fn clone(&self) -> PredicateConstraintSystem<F>
fn clone(&self) -> PredicateConstraintSystem<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more