snarkify / sirius

A Plonkish folding framework for Incrementally Verifiable Computation (IVC).
MIT License
119 stars 17 forks source link

fix(expr): improve the string representation of expression #231

Closed chaosma closed 5 months ago

chaosma commented 5 months ago

Issue Link / Motivation Improve string representation of expression by removing unnecessary brackets. e.g.

// our main_gate expression is given by: 
qm * s1_0 * s1_1 + qi * in1 + rc + qo * out1 + q1_0 * s1_0 + q5_0 * s1_0^5 + q1_1 * s1_1 + q5_1 * s1_1^5

// Before we have:
 (((((((Z_4 * Z_9) * Z_10) + (Z_6 * Z_11)) + Z_8) + (Z_7 * Z_12)) + ((Z_0 * Z_9) + (Z_2 * (((Z_9 * Z_9) * (Z_9 * Z_9)) * Z_9)))) + ((Z_1 * Z_10) + (Z_3 * (((Z_10 * Z_10) * (Z_10 * Z_10)) * Z_10))))

// Now we have:
Z_4 * Z_9 * Z_10 + Z_6 * Z_11 + Z_8 + Z_7 * Z_12 + Z_0 * Z_9 + Z_2 * Z_9 * Z_9 * Z_9 * Z_9 * Z_9 + Z_1 * Z_10 + Z_3 * Z_10 * Z_10 * Z_10 * Z_10 * Z_10

Changes Overview Change the fn visualize accordingly