23std::vector<std::string> get_command()
31std::string str_replace(
const std::string& s,
const std::string& search,
const std::string& replace)
35 while ((pos = res.find(search, pos)) != std::string::npos) {
36 res.replace(pos, search.length(), replace);
37 pos += replace.length();
42std::string to_binary(uint64_t n,
bool leading_zeroes =
true)
45 for (
int i = 0; i < 64; ++i) {
46 result = ((n & 1) ?
"1" :
"0") + result;
49 if (!leading_zeroes) {
50 size_t first_one = result.find(
'1');
51 if (first_one != std::string::npos) {
52 result = result.substr(first_one);
70 std::cout <<
" /testrelation <relation_name> [subrelation_name_or_number] - test relation" <<
std::endl;
83 auto command = get_command();
84 if (command.empty()) {
87 if (command[0] ==
"'") {
89 }
else if (command[0] ==
",") {
95 }
else if (command[0].starts_with(
"@")) {
96 row =
static_cast<uint32_t
>(
std::stoi(command[0].substr(1)));
97 }
else if (command[0] ==
"exit" || command[0] ==
"e" || command[0] ==
"q") {
99 }
else if (command[0] ==
"/set" || command[0] ==
"/s") {
100 if (command.size() != 3) {
105 }
else if (command[0] ==
"/prefix" || command[0] ==
"/p") {
106 if (command.size() != 2) {
111 }
else if (command[0] ==
"/noprefix" || command[0] ==
"/np") {
113 }
else if (command[0] ==
"/testrelation" || command[0] ==
"/tr") {
114 if (command.size() != 2 && command.size() != 3) {
115 std::cout <<
"Usage: /testrelation <relation_name> [subrelation_name_or_number]" <<
std::endl;
119 }
else if (command[0].starts_with(
".")) {
121 command[0].erase(0, 1);
133 std::string joined_regex;
134 for (
const auto& str : regexes) {
135 joined_regex +=
prefix + str_replace(str,
"'",
"_shift") +
"|";
137 joined_regex.pop_back();
140 re.assign(joined_regex);
150 if (val ==
FF(
static_cast<uint64_t
>(val))) {
151 uint64_t n =
static_cast<uint64_t
>(val);
152 std::cout <<
" (" << n <<
", " << to_binary(n,
false) <<
"b)";
165 std::string final_name =
prefix + column_name;
182 bb::constexpr_for<0, std::tuple_size_v<typename AvmFlavor::MainRelations>, 1>([&]<
size_t i>() {
185 if (Relation::NAME != relation_name) {
193 for (
size_t j = 0; j < result.size(); ++j) {
194 if (!result[j].is_zero() &&
195 (!subrelation_name || Relation::get_subrelation_label(j) == *subrelation_name)) {
199 Relation::get_subrelation_label(j),
211 }
else if (!failed) {
212 std::cout <<
"Relation " << relation_name <<
" ("
213 << (subrelation_name.has_value() ? *subrelation_name :
"all subrelations") <<
")"
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
ArrayOfValues< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckArrayOfValuesOverSubrelations
void run(uint32_t starting_row=0)
tracegen::TraceContainer & trace
void print_columns(const std::vector< std::string > ®ex)
void test_relation(const std::string &relation_name, std::optional< std::string > subrelation_name)
void set_column(const std::string &column_name, const std::string &value)
const FF & get_column_or_shift(ColumnAndShifts col, uint32_t row) const
void set(Column col, uint32_t row, const FF &value)
std::string format(Args... args)
AvmFullRow get_full_row(const TraceContainer &trace, uint32_t row)
const std::vector< std::string > & COLUMN_NAMES
std::string field_to_string(const FF &ff)
std::vector< std::string > split_and_trim(const std::string &str, char delimiter)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept