@@ -322,63 +322,6 @@ impl<F: Field, T: Into<Self>> Product<T> for SymbolicExpression<F> {
322322 }
323323}
324324
325- pub fn get_log_quotient_degree < F , A > (
326- air : & A ,
327- preprocessed_width : usize ,
328- stage_1_width : usize ,
329- stage_2_width : usize ,
330- num_public_values : usize ,
331- num_stage_2_public_values : usize ,
332-
333- is_zk : usize ,
334- ) -> usize
335- where
336- F : Field ,
337- A : Air < SymbolicAirBuilder > ,
338- {
339- assert ! ( is_zk <= 1 , "is_zk must be either 0 or 1" ) ;
340- // We pad to at least degree 2, since a quotient argument doesn't make sense with smaller degrees.
341- let constraint_degree = ( get_max_constraint_degree (
342- air,
343- preprocessed_width,
344- stage_1_width,
345- stage_2_width,
346- num_public_values,
347- num_stage_2_public_values,
348- ) + is_zk)
349- . max ( 2 ) ;
350-
351- // The quotient's actual degree is approximately (max_constraint_degree - 1) n,
352- // where subtracting 1 comes from division by the vanishing polynomial.
353- // But we pad it to a power of two so that we can efficiently decompose the quotient.
354- log2_ceil_usize ( constraint_degree - 1 )
355- }
356-
357- pub fn get_max_constraint_degree < A > (
358- air : & A ,
359- preprocessed_width : usize ,
360- stage_1_width : usize ,
361- stage_2_width : usize ,
362- num_public_values : usize ,
363- num_stage_2_public_values : usize ,
364- ) -> usize
365- where
366- A : Air < SymbolicAirBuilder > ,
367- {
368- get_symbolic_constraints (
369- air,
370- preprocessed_width,
371- stage_1_width,
372- stage_2_width,
373- num_public_values,
374- num_stage_2_public_values,
375- )
376- . iter ( )
377- . map ( |c| c. degree_multiple ( ) )
378- . max ( )
379- . unwrap_or ( 0 )
380- }
381-
382325pub fn get_symbolic_constraints < A > (
383326 air : & A ,
384327 preprocessed_width : usize ,
@@ -401,6 +344,24 @@ where
401344 builder. constraints
402345}
403346
347+ pub fn get_max_constraint_degree ( constraints : & [ SymbolicExpression < ExtVal > ] ) -> usize {
348+ constraints
349+ . iter ( )
350+ . map ( |c| c. degree_multiple ( ) )
351+ . max ( )
352+ . unwrap_or ( 0 )
353+ }
354+
355+ pub fn get_log_quotient_degree ( max_constraint_degree : usize , is_zk : bool ) -> usize {
356+ // We pad to at least degree 2, since a quotient argument doesn't make sense with smaller degrees.
357+ let constraint_degree = ( max_constraint_degree + usize:: from ( is_zk) ) . max ( 2 ) ;
358+
359+ // The quotient's actual degree is approximately (max_constraint_degree - 1) n,
360+ // where subtracting 1 comes from division by the vanishing polynomial.
361+ // But we pad it to a power of two so that we can efficiently decompose the quotient.
362+ log2_ceil_usize ( constraint_degree - 1 )
363+ }
364+
404365/// An `AirBuilder` for evaluating constraints symbolically, and recording them for later use.
405366#[ derive( Debug ) ]
406367pub struct SymbolicAirBuilder {
0 commit comments