-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arrabiata: define correctly the different challenges used in the protocol #2684
Changes from 3 commits
9b78f11
9a20e08
e815585
363fc03
286dfc6
bde9704
4d7c283
3e5f19f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,18 +146,6 @@ pub struct Variable<Column> { | |
pub row: CurrOrNext, | ||
} | ||
|
||
/// Define challenges the verifier coins during the interactive protocol. | ||
/// It has been defined initially to handle the PLONK IOP, hence: | ||
/// - `alpha` for the quotient polynomial | ||
/// - `beta` and `gamma` for the permutation challenges. | ||
/// The joint combiner is to handle vector lookups, initially designed to be | ||
/// used with PLOOKUP. | ||
/// The terms have no built-in semantic in the expression framework, and can be | ||
/// used for any other four challenges the verifier coins in other polynomial | ||
/// interactive protocol. | ||
/// TODO: we should generalize the expression type over challenges and constants. | ||
/// See <https://github.com/MinaProtocol/mina/issues/15287> | ||
|
||
/// Define the constant terms an expression can use. | ||
/// It can be any constant term (`Literal`), a matrix (`Mds` - used by the | ||
/// permutation used by Poseidon for instance), or endomorphism coefficients | ||
|
@@ -855,28 +843,6 @@ impl<Column: Copy> Variable<Column> { | |
} | ||
} | ||
|
||
impl<Column: FormattedOutput + Debug> Variable<Column> { | ||
pub fn ocaml(&self) -> String { | ||
format!("var({:?}, {:?})", self.col, self.row) | ||
} | ||
|
||
pub fn latex(&self) -> String { | ||
let col = self.col.latex(&mut HashMap::new()); | ||
match self.row { | ||
Curr => col, | ||
Next => format!("\\tilde{{{col}}}"), | ||
} | ||
} | ||
|
||
pub fn text(&self) -> String { | ||
let col = self.col.text(&mut HashMap::new()); | ||
match self.row { | ||
Curr => format!("Curr({col})"), | ||
Next => format!("Next({col})"), | ||
} | ||
} | ||
} | ||
|
||
impl<F: FftField, Column: Copy, ChallengeTerm: Copy> PolishToken<F, Column, ChallengeTerm> { | ||
/// Evaluate an RPN expression to a field element. | ||
pub fn evaluate<Evaluations: ColumnEvaluations<F, Column = Column>>( | ||
|
@@ -2882,6 +2848,32 @@ where | |
} | ||
} | ||
|
||
impl<Column: FormattedOutput + Debug> FormattedOutput for Variable<Column> { | ||
fn is_alpha(&self) -> bool { | ||
false | ||
} | ||
|
||
fn ocaml(&self, _cache: &mut HashMap<CacheId, Self>) -> String { | ||
format!("var({:?}, {:?})", self.col, self.row) | ||
} | ||
|
||
fn latex(&self, _cache: &mut HashMap<CacheId, Self>) -> String { | ||
let col = self.col.latex(&mut HashMap::new()); | ||
match self.row { | ||
Curr => col, | ||
Next => format!("\\tilde{{{col}}}"), | ||
} | ||
} | ||
|
||
fn text(&self, _cache: &mut HashMap<CacheId, Self>) -> String { | ||
let col = self.col.text(&mut HashMap::new()); | ||
match self.row { | ||
Curr => format!("Curr({col})"), | ||
Next => format!("Next({col})"), | ||
} | ||
} | ||
} | ||
|
||
impl<T: FormattedOutput + Clone> FormattedOutput for Operations<T> { | ||
fn is_alpha(&self) -> bool { | ||
match self { | ||
|
@@ -3023,7 +3015,7 @@ where | |
}); | ||
res | ||
} | ||
Atom(Cell(v)) => format!("cell({})", v.ocaml()), | ||
Atom(Cell(v)) => format!("cell({})", v.ocaml(&mut HashMap::new())), | ||
Atom(UnnormalizedLagrangeBasis(i)) => { | ||
format!("unnormalized_lagrange_basis({}, {})", i.zk_rows, i.offset) | ||
} | ||
|
@@ -3087,7 +3079,7 @@ where | |
}); | ||
res | ||
} | ||
Atom(Cell(v)) => v.latex(), | ||
Atom(Cell(v)) => v.latex(&mut HashMap::new()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why isn't the cache in the arg of the function given as arg to the recursive call ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the same type, and also, it is unused in any case. |
||
Atom(UnnormalizedLagrangeBasis(RowOffset { | ||
zk_rows: true, | ||
offset: i, | ||
|
@@ -3134,7 +3126,7 @@ where | |
}); | ||
res | ||
} | ||
Atom(Cell(v)) => v.text(), | ||
Atom(Cell(v)) => v.text(&mut HashMap::new()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why isn't the cache in the arg of the function given as arg to the recursive call ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the same type, and also, it is unused in any case. |
||
Atom(UnnormalizedLagrangeBasis(RowOffset { | ||
zk_rows: true, | ||
offset: i, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't the cache in the arg of the function given as arg to the recursive call of text ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the same type, and also, it is unused in any case.