Skip to content

Commit

Permalink
perf: Combine constraints of illegal num_words
Browse files Browse the repository at this point in the history
The constraints prohibiting an illegal value for `NumberOfWords`
are mutually exclusive. More importantly, the set of all the constraints
has Hamming weight 1. This implies they can safely (and soundly) be
summed.
  • Loading branch information
jan-ferdinand committed Jun 10, 2024
1 parent 6ff8500 commit d74e10a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions specification/src/arithmetization-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Before automatic degree lowering:
| table name | #initial | #consistency | #transition | #terminal | max degree |
|:-----------------------------------------------|---------:|-------------:|------------:|----------:|-----------:|
| [ProgramTable](program-table.md) | 6 | 4 | 10 | 2 | 4 |
| [ProcessorTable](processor-table.md) | 29 | 10 | 49 | 1 | 19 |
| [ProcessorTable](processor-table.md) | 29 | 10 | 41 | 1 | 19 |
| [OpStackTable](operational-stack-table.md) | 3 | 0 | 5 | 0 | 4 |
| [RamTable](random-access-memory-table.md) | 7 | 0 | 12 | 1 | 5 |
| [JumpStackTable](jump-stack-table.md) | 6 | 0 | 6 | 0 | 4 |
Expand All @@ -43,14 +43,14 @@ Before automatic degree lowering:
| [LookupTable](lookup-table.md) | 3 | 1 | 4 | 1 | 3 |
| [U32Table](u32-table.md) | 1 | 15 | 22 | 2 | 12 |
| [Grand Cross-Table Argument](table-linking.md) | 0 | 0 | 0 | 14 | 1 |
| **TOTAL** | **79** | **76** | **158** | **23** | **19** |
| **TOTAL** | **79** | **76** | **150** | **23** | **19** |

After automatically lowering degree to 4:

| table name | #initial | #consistency | #transition | #terminal |
|:-----------------------------------------------|---------:|-------------:|------------:|----------:|
| [ProgramTable](program-table.md) | 6 | 4 | 10 | 2 |
| [ProcessorTable](processor-table.md) | 31 | 10 | 227 | 1 |
| [ProcessorTable](processor-table.md) | 31 | 10 | 219 | 1 |
| [OpStackTable](operational-stack-table.md) | 3 | 0 | 5 | 0 |
| [RamTable](random-access-memory-table.md) | 7 | 0 | 13 | 1 |
| [JumpStackTable](jump-stack-table.md) | 6 | 0 | 6 | 0 |
Expand All @@ -59,7 +59,7 @@ After automatically lowering degree to 4:
| [LookupTable](lookup-table.md) | 3 | 1 | 4 | 1 |
| [U32Table](u32-table.md) | 1 | 26 | 34 | 2 |
| [Grand Cross-Table Argument](table-linking.md) | 0 | 0 | 0 | 14 |
| **TOTAL** | **81** | **94** | **386** | **23** |
| **TOTAL** | **81** | **94** | **378** | **23** |
<!-- auto-gen info stop constraints_overview -->


Expand All @@ -71,5 +71,5 @@ In order to gauge the runtime cost for this step, the following table provides e
<!-- auto-gen info start tasm_air_evaluation_cost -->
| Processor | Op Stack | RAM |
|----------:|---------:|------:|
| 35689 | 66327 | 23592 |
| 35207 | 65377 | 23220 |
<!-- auto-gen info stop tasm_air_evaluation_cost -->
5 changes: 3 additions & 2 deletions triton-vm/src/table/processor_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2720,9 +2720,10 @@ impl ExtProcessorTable {
fn prohibit_any_illegal_number_of_words(
circuit_builder: &ConstraintCircuitBuilder<DualRowIndicator>,
) -> Vec<ConstraintCircuitMonad<DualRowIndicator>> {
NumberOfWords::illegal_values()
vec![NumberOfWords::illegal_values()
.map(|n| Self::indicator_polynomial(circuit_builder, n))
.to_vec()
.into_iter()
.sum()]
}

fn log_derivative_accumulates_clk_next(
Expand Down

0 comments on commit d74e10a

Please sign in to comment.