Created
May 7, 2023 11:07
-
-
Save leonardoalt/a33a6f43a2419a075361b4e3199f1ab7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct State { | |
| field pc; | |
| field A; | |
| } | |
| struct Witness { | |
| field X; | |
| field reg_write_X_A; | |
| field instr_ASSERT_IS_ZERO_A; | |
| field X_const; | |
| field X_read_free; | |
| field read_X_A; | |
| field read_X_pc; | |
| field X_free_value; | |
| field first_step; | |
| field first_step_next; | |
| } | |
| def main(State s, private Witness w) -> State { | |
| assert((w.first_step * s.A) == 0); | |
| assert((w.instr_ASSERT_IS_ZERO_A * (s.A - 0)) == 0); | |
| assert(w.X == ((((w.read_X_A * s.A) + (w.read_X_pc * s.pc)) + w.X_const) + (w.X_read_free * w.X_free_value))); | |
| field A_next = (((w.first_step_next * 0) + (w.reg_write_X_A * w.X)) + ((1 - (w.first_step_next + w.reg_write_X_A)) * s.A)); | |
| field pc_next = ((1 - w.first_step_next) * (s.pc + 1)); | |
| return State { | |
| pc: pc_next, | |
| A: A_next, | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment