pub enum AbstractExpression<F: Field> {
Constant(F),
Selector(MleIndex<F>, Box<AbstractExpression<F>>, Box<AbstractExpression<F>>),
Mle(NodeId),
Sum(Box<AbstractExpression<F>>, Box<AbstractExpression<F>>),
Product(Vec<NodeId>),
Scaled(Box<AbstractExpression<F>>, F),
}Expand description
See [ExpressionNode] for more details. Note that this implementation is somewhat redundant with [Expression] and [ExpressionNode], but the separation allows for more flexibility with respect to this particular frontend being able to create polynomial relationships in any way it chooses, so long as those representations are compile-able into [Expression].
Variants§
Constant(F)
Selector(MleIndex<F>, Box<AbstractExpression<F>>, Box<AbstractExpression<F>>)
Mle(NodeId)
Sum(Box<AbstractExpression<F>>, Box<AbstractExpression<F>>)
Product(Vec<NodeId>)
Scaled(Box<AbstractExpression<F>>, F)
Implementations§
Source§impl<F: Field> AbstractExpression<F>
impl<F: Field> AbstractExpression<F>
Sourcepub fn traverse(
&self,
observer_fn: &mut impl FnMut(&AbstractExpression<F>) -> Result<()>,
) -> Result<()>
pub fn traverse( &self, observer_fn: &mut impl FnMut(&AbstractExpression<F>) -> Result<()>, ) -> Result<()>
Traverses the expression and applies the observer function to all nodes.
Sourcepub fn get_sources(&self) -> Vec<NodeId>
pub fn get_sources(&self) -> Vec<NodeId>
find all the sources this expression depend on
Sourcepub fn get_num_vars(
&self,
num_vars_map: &HashMap<NodeId, usize>,
) -> Result<usize>
pub fn get_num_vars( &self, num_vars_map: &HashMap<NodeId, usize>, ) -> Result<usize>
Computes the num_vars of this expression (how many rounds of sumcheck it would take to prove)
Sourcepub fn build_circuit_expr(
self,
circuit_map: &CircuitMap,
) -> Result<Expression<F, ExprDescription>>
pub fn build_circuit_expr( self, circuit_map: &CircuitMap, ) -> Result<Expression<F, ExprDescription>>
Convert the abstract expression into a circuit expression, which stores information on the shape of the expression, using the CircuitMap.
Sourcepub fn select(self, rhs: Self) -> Self
pub fn select(self, rhs: Self) -> Self
See documentation for select() function within [remainder::expression::circuit_expr::ExprDescription]
Sourcepub fn select_seq<E: Clone + Into<AbstractExpression<F>>>(
expressions: Vec<E>,
) -> Self
pub fn select_seq<E: Clone + Into<AbstractExpression<F>>>( expressions: Vec<E>, ) -> Self
Call Self::select sequentially
Sourcepub fn binary_tree_selector<E: Into<AbstractExpression<F>>>(
expressions: Vec<E>,
) -> Self
pub fn binary_tree_selector<E: Into<AbstractExpression<F>>>( expressions: Vec<E>, ) -> Self
Create a nested selector Expression that selects between 2^k Expressions by creating a binary tree of Selector Expressions. The order of the leaves is the order of the input expressions. (Note that this is very different from Self::select_seq.)
Sourcepub fn pow(pow: usize, node_id: Self) -> Self
pub fn pow(pow: usize, node_id: Self) -> Self
Create a product Expression that raises one expression to a given power
Sourcepub fn products(node_ids: Vec<NodeId>) -> Self
pub fn products(node_ids: Vec<NodeId>) -> Self
Create a product Expression that multiplies many MLEs together
Sourcepub fn mult(lhs: Self, rhs: Self) -> Self
pub fn mult(lhs: Self, rhs: Self) -> Self
Multiplication for expressions, DO NOT USE ON SELECTORS
Sourcepub fn constant(constant: F) -> Self
pub fn constant(constant: F) -> Self
Create a constant Expression that contains one field element
Sourcepub fn scaled(expression: AbstractExpression<F>, scale: F) -> Self
pub fn scaled(expression: AbstractExpression<F>, scale: F) -> Self
scales an Expression by a field element
Trait Implementations§
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> Add<Rhs> for &AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> Add<Rhs> for &AbstractExpression<F>
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> Add<Rhs> for AbstractExpression<F>
implement the Add, Sub, and Mul traits for the Expression
impl<F: Field, Rhs: Into<AbstractExpression<F>>> Add<Rhs> for AbstractExpression<F>
implement the Add, Sub, and Mul traits for the Expression
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> AddAssign<Rhs> for AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> AddAssign<Rhs> for AbstractExpression<F>
Source§fn add_assign(&mut self, rhs: Rhs)
fn add_assign(&mut self, rhs: Rhs)
+= operation. Read moreSource§impl<F: Field, Rhs: Into<AbstractExpression<F>>> BitXor<Rhs> for &AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> BitXor<Rhs> for &AbstractExpression<F>
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> BitXor<Rhs> for AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> BitXor<Rhs> for AbstractExpression<F>
Source§impl<F: Clone + Field> Clone for AbstractExpression<F>
impl<F: Clone + Field> Clone for AbstractExpression<F>
Source§fn clone(&self) -> AbstractExpression<F>
fn clone(&self) -> AbstractExpression<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, F> Deserialize<'de> for AbstractExpression<F>where
F: Field,
impl<'de, F> Deserialize<'de> for AbstractExpression<F>where
F: Field,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<F: Field> From<&AbstractExpression<F>> for AbstractExpression<F>
impl<F: Field> From<&AbstractExpression<F>> for AbstractExpression<F>
Source§fn from(val: &AbstractExpression<F>) -> Self
fn from(val: &AbstractExpression<F>) -> Self
Source§impl<F: Field> From<&InputLayerNodeRef<F>> for AbstractExpression<F>
impl<F: Field> From<&InputLayerNodeRef<F>> for AbstractExpression<F>
Source§fn from(value: &InputLayerNodeRef<F>) -> Self
fn from(value: &InputLayerNodeRef<F>) -> Self
Source§impl<F: Field> From<F> for AbstractExpression<F>
impl<F: Field> From<F> for AbstractExpression<F>
Source§impl<F: Field> From<InputLayerNodeRef<F>> for AbstractExpression<F>
impl<F: Field> From<InputLayerNodeRef<F>> for AbstractExpression<F>
Source§fn from(value: InputLayerNodeRef<F>) -> Self
fn from(value: InputLayerNodeRef<F>) -> Self
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> Mul<Rhs> for &AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> Mul<Rhs> for &AbstractExpression<F>
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> Mul<Rhs> for AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> Mul<Rhs> for AbstractExpression<F>
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> MulAssign<Rhs> for AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> MulAssign<Rhs> for AbstractExpression<F>
Source§fn mul_assign(&mut self, rhs: Rhs)
fn mul_assign(&mut self, rhs: Rhs)
*= operation. Read moreSource§impl<F: Field> Neg for &AbstractExpression<F>
impl<F: Field> Neg for &AbstractExpression<F>
Source§impl<F: Field> Neg for AbstractExpression<F>
impl<F: Field> Neg for AbstractExpression<F>
Source§impl<F> Serialize for AbstractExpression<F>where
F: Field,
impl<F> Serialize for AbstractExpression<F>where
F: Field,
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> Sub<Rhs> for &AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> Sub<Rhs> for &AbstractExpression<F>
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> Sub<Rhs> for AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> Sub<Rhs> for AbstractExpression<F>
Source§impl<F: Field, Rhs: Into<AbstractExpression<F>>> SubAssign<Rhs> for AbstractExpression<F>
impl<F: Field, Rhs: Into<AbstractExpression<F>>> SubAssign<Rhs> for AbstractExpression<F>
Source§fn sub_assign(&mut self, rhs: Rhs)
fn sub_assign(&mut self, rhs: Rhs)
-= operation. Read moreimpl<F: Eq + Field> Eq for AbstractExpression<F>
impl<F: Field> StructuralPartialEq for AbstractExpression<F>
Auto Trait Implementations§
impl<F> Freeze for AbstractExpression<F>where
F: Freeze,
impl<F> RefUnwindSafe for AbstractExpression<F>where
F: RefUnwindSafe,
impl<F> Send for AbstractExpression<F>
impl<F> Sync for AbstractExpression<F>
impl<F> Unpin for AbstractExpression<F>where
F: Unpin,
impl<F> UnwindSafe for AbstractExpression<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.