-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add phantom permutation in `std::protocols::permutation::permutation(…
…)` + change tests (#2069) With this PR, `std::protocols::permutation::permutation()` adds a phantom permutation as well, making witgen work when using it. Also, I changed the tests to be analogous to recent changes to the `lookup_via_challenges` test: - The `_ext` variant is removed, since we automatically run the extension field variant on Goldilocks (which is tested) - The example itself is more realistic, in this case it emulates a block machine connected via a permutation.
- Loading branch information
1 parent
2c1acf8
commit 0e8b32d
Showing
5 changed files
with
15 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
use std::prelude::Query; | ||
use std::convert::fe; | ||
use std::protocols::permutation::permutation; | ||
use std::math::fp2::from_base; | ||
use std::prover::challenge; | ||
|
||
machine Main with degree: 8 { | ||
|
||
col fixed first_four = [1, 1, 1, 1, 0, 0, 0, 0]; | ||
col fixed x = [0, 0, 1, 2, 3, 4, 5, 6]; | ||
col witness y; | ||
|
||
// Two pairs of witness columns, claimed to be permutations of one another | ||
// (when selected by first_four and (1 - first_four), respectively) | ||
col witness a1, a2, b1, b2; | ||
query |i| { | ||
std::prover::provide_value(a1, i, fe(i)); | ||
std::prover::provide_value(a2, i, fe(i + 42)); | ||
std::prover::provide_value(b1, i, fe(7 - i)); | ||
std::prover::provide_value(b2, i, fe(7 - i + 42)); | ||
}; | ||
// A small block machine that computes f(x) = x + 42; | ||
col witness sub_x, sub_y, sub_sel; | ||
sub_y = sub_x + 42; | ||
|
||
let permutation_constraint = first_four $ [a1, a2] is (1 - first_four) $ [b1, b2]; | ||
// Currently, witgen fails if the block machine has just enough rows to | ||
// fit all the blocks, so let's not have a call in the last row. | ||
col fixed sel = [1, 1, 1, 1, 1, 1, 1, 0]; | ||
|
||
permutation(permutation_constraint); | ||
} | ||
// Add the permutation constraints | ||
permutation(sel $ [x, y] is sub_sel $ [sub_x, sub_y]); | ||
} |
This file was deleted.
Oops, something went wrong.