BoundaryConstraint

Struct BoundaryConstraint 

Source
pub struct BoundaryConstraint<F, E>
where F: FieldElement, E: FieldElement<BaseField = <F as FieldElement>::BaseField> + ExtensionOf<F>,
{ /* private fields */ }
Expand description

The numerator portion of a boundary constraint.

A boundary constraint is described by a rational function $\frac{f(x) - b(x)}{z(x)}$, where:

  • $f(x)$ is a trace polynomial for the column against which the constraint is placed.
  • $b(b)$ is the value polynomial for this constraint.
  • $z(x)$ is the constraint divisor polynomial.

In addition to the value polynomial, a BoundaryConstraint also contains info needed to evaluate the constraint and to compose constraint evaluations with other constraints (i.e., constraint composition coefficient).

When the protocol is run in a large field, types F and E are the same. However, when working with small fields, F and E can be set as follows:

  • F could be the base field of the protocol, in which case E is the extension field used.
  • F could be the extension field, in which case F and E are the same type.

Boundary constraints cannot be instantiated directly, they are created internally from Assertions.

Implementations§

Source§

impl<F, E> BoundaryConstraint<F, E>
where F: FieldElement, E: FieldElement<BaseField = <F as FieldElement>::BaseField> + ExtensionOf<F>,

Source

pub fn column(&self) -> usize

Returns index of the column against which this constraint applies.

Source

pub fn poly(&self) -> &[F]

Returns a value polynomial for this constraint.

Source

pub fn poly_offset(&self) -> (usize, <F as FieldElement>::BaseField)

Returns offset by which we need to shift the domain before evaluating this constraint.

The offset is returned as a tuple describing both, the number of steps by which the domain needs to be shifted, and field element by which a domain element needs to be multiplied to achieve the desired shift.

Source

pub fn cc(&self) -> &E

Returns composition coefficient for this constraint.

Source

pub fn evaluate_at(&self, x: E, trace_value: E) -> E

Evaluates this constraint at the specified point x.

The constraint is evaluated by computing $f(x) - b(x)$, where:

  • $f$ is a trace polynomial for the column against which the constraint is placed.
  • $f(x)$ = trace_value
  • $b$ is the value polynomial for this constraint.

For boundary constraints derived from single and periodic assertions, $b(x)$ is a constant.

Trait Implementations§

Source§

impl<F, E> Clone for BoundaryConstraint<F, E>
where F: Clone + FieldElement, E: Clone + FieldElement<BaseField = <F as FieldElement>::BaseField> + ExtensionOf<F>, <F as FieldElement>::BaseField: Clone,

Source§

fn clone(&self) -> BoundaryConstraint<F, E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F, E> Debug for BoundaryConstraint<F, E>
where F: Debug + FieldElement, E: Debug + FieldElement<BaseField = <F as FieldElement>::BaseField> + ExtensionOf<F>, <F as FieldElement>::BaseField: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<F, E> PartialEq for BoundaryConstraint<F, E>

Source§

fn eq(&self, other: &BoundaryConstraint<F, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F, E> Eq for BoundaryConstraint<F, E>
where F: Eq + FieldElement, E: Eq + FieldElement<BaseField = <F as FieldElement>::BaseField> + ExtensionOf<F>, <F as FieldElement>::BaseField: Eq,

Source§

impl<F, E> StructuralPartialEq for BoundaryConstraint<F, E>
where F: FieldElement, E: FieldElement<BaseField = <F as FieldElement>::BaseField> + ExtensionOf<F>,

Auto Trait Implementations§

§

impl<F, E> Freeze for BoundaryConstraint<F, E>
where E: Freeze, <F as FieldElement>::BaseField: Freeze,

§

impl<F, E> RefUnwindSafe for BoundaryConstraint<F, E>

§

impl<F, E> Send for BoundaryConstraint<F, E>

§

impl<F, E> Sync for BoundaryConstraint<F, E>

§

impl<F, E> Unpin for BoundaryConstraint<F, E>
where E: Unpin, <F as FieldElement>::BaseField: Unpin, F: Unpin,

§

impl<F, E> UnwindSafe for BoundaryConstraint<F, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.