From e89a0e24ace7a5e0124952ccb1b9717af20bff7d Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Thu, 23 Apr 2026 09:47:42 +0200 Subject: [PATCH 1/9] spec/ARE_BYTES: introduce ARE_BYTES signature --- spec/src/signatures.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/src/signatures.toml b/spec/src/signatures.toml index b04b3d561..9c0281f03 100644 --- a/spec/src/signatures.toml +++ b/spec/src/signatures.toml @@ -163,6 +163,12 @@ tag = "IS_BYTE" kind = "interaction" input = ["Byte"] +# ARE_BYTES[X, Y] +[[signatures]] +tag = "ARE_BYTES" +kind = "interaction" +input = ["Byte", "Byte"] + # IS_HALF[X] [[signatures]] tag = "IS_HALF" From 7e86d3dbf8af957a421607f054df7f59bb7dbbdc Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Thu, 23 Apr 2026 09:48:49 +0200 Subject: [PATCH 2/9] spec/ARE_BYTES: introduce ARE_BYTES lookup --- spec/src/bitwise.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/src/bitwise.toml b/spec/src/bitwise.toml index 67d73facd..42a6de790 100644 --- a/spec/src/bitwise.toml +++ b/spec/src/bitwise.toml @@ -101,6 +101,11 @@ name = "μ_IS_BYTE" type = "BaseField" desc = "" +[[variables.multiplicity]] +name = "μ_ARE_BYTES" +type = "BaseField" +desc = "" + [[variables.multiplicity]] name = "μ_IS_HALF" type = "BaseField" @@ -168,6 +173,12 @@ tag = "IS_BYTE" input = ["X"] multiplicity = ["-", "μ_IS_BYTE"] +[[constraints.contributions]] +kind = "interaction" +tag = "ARE_BYTES" +input = ["X", "Y"] +multiplicity = ["-", "μ_ARE_BYTES"] + [[constraints.contributions]] kind = "interaction" tag = "IS_HALF" From 9f93d5c01cc063298ea57e89e444d23bde164ea1 Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Thu, 23 Apr 2026 10:01:55 +0200 Subject: [PATCH 3/9] spec/ARE_BYTES: introduce IS_BYTE template --- spec/book.typ | 1 + spec/is_byte.typ | 22 ++++++++++++++++++++++ spec/src/is_byte.toml | 21 +++++++++++++++++++++ spec/src/signatures.toml | 6 ++++++ 4 files changed, 50 insertions(+) create mode 100644 spec/is_byte.typ create mode 100644 spec/src/is_byte.toml diff --git a/spec/book.typ b/spec/book.typ index 3b65642f9..cbea7ab47 100644 --- a/spec/book.typ +++ b/spec/book.typ @@ -18,6 +18,7 @@ )), ("TEMPLATES", ( ("is_bit.typ", [`IS_BIT` template], ), + ("is_byte.typ", [`IS_BYTE` template], ), ("sign.typ", [`SIGN` template], ), ("add.typ", [`ADD`/`SUB` template], ), ("neg.typ", [`NEG` template], ), diff --git a/spec/is_byte.typ b/spec/is_byte.typ new file mode 100644 index 000000000..c910b6df6 --- /dev/null +++ b/spec/is_byte.typ @@ -0,0 +1,22 @@ +#import "/book.typ": book-page +#import "/src.typ": load_config, load_chip +#import "/chip.typ": render_chip_variable_table, render_constraint_table, compute_nr_interactions, total_nr_variables, total_nr_instantiated_columns + +#let config = load_config() +#let chip = load_chip("src/is_byte.toml", config) + +#show: book-page(chip.name) +#let is_byte = raw(chip.name) + +#is_byte is a constraint template that is used to assert that a variable lies in the range $[0, 255]$ with given multiplicity. + +When a chip leverages this template twice or more, implementors are encouraged to merge pairs of #is_byte interactions with identical multiplicities into `ARE_BYTES` interactions; the #is_byte template is included for convenience of notation, and to complete the specification of chips that use an odd number of #is_byte range checks. + += Variables +#let nr_interactions = compute_nr_interactions(chip) + +The #is_byte template leverages #nr_interactions interaction(s): +#render_chip_variable_table(chip, config) + += Constraints +#render_constraint_table(chip, config) \ No newline at end of file diff --git a/spec/src/is_byte.toml b/spec/src/is_byte.toml new file mode 100644 index 000000000..a596d8f00 --- /dev/null +++ b/spec/src/is_byte.toml @@ -0,0 +1,21 @@ +name = "IS_BYTE" + +[[variables.input]] +name = "X" +type = "BaseField" +desc = "Value for which to assert that it lies in the range $[0, 255]$." + +[[variables.multiplicity]] +name = "μ" +type = "BaseField" +desc = "" + +[[constraint_groups]] +name = "all" + +[[constraints.all]] +kind = "interaction" +tag = "ARE_BYTES" +input = [0, "X"] +multiplicity = "μ" +ref = "isbyte:c:isbyte" diff --git a/spec/src/signatures.toml b/spec/src/signatures.toml index 9c0281f03..14936960d 100644 --- a/spec/src/signatures.toml +++ b/spec/src/signatures.toml @@ -5,6 +5,12 @@ kind = "template" input = ["BaseField"] cond = "BaseField" +# IS_BYTE +[[signatures]] +tag = "IS_BYTE" +kind = "template" +input = ["BaseField", "BaseField"] + # cond => ADD [[signatures]] tag = "ADD" From 285ee04d429d23ad67081ed21c808b743590a766 Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Thu, 23 Apr 2026 10:22:01 +0200 Subject: [PATCH 4/9] spec/ARE_BYTES: switch IS_BYTE lookup to IS_BYTE template --- spec/src/bitwise.toml | 5 ++--- spec/src/branch.toml | 5 ++--- spec/src/cpu.toml | 30 ++++++++++++------------------ spec/src/keccak_round.toml | 22 +++++++++------------- spec/src/page.toml | 10 ++++------ spec/src/sha256.toml | 5 ++--- spec/src/sha256msgsched.toml | 10 ++++------ spec/src/sha256round.toml | 10 ++++------ 8 files changed, 39 insertions(+), 58 deletions(-) diff --git a/spec/src/bitwise.toml b/spec/src/bitwise.toml index 42a6de790..e7ea98470 100644 --- a/spec/src/bitwise.toml +++ b/spec/src/bitwise.toml @@ -168,10 +168,9 @@ output = "ZERO" multiplicity = ["-", "μ_ZERO"] [[constraints.contributions]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["X"] -multiplicity = ["-", "μ_IS_BYTE"] +input = ["X", ["-", "μ_IS_BYTE"]] [[constraints.contributions]] kind = "interaction" diff --git a/spec/src/branch.toml b/spec/src/branch.toml index a98974678..e16ef7d16 100644 --- a/spec/src/branch.toml +++ b/spec/src/branch.toml @@ -116,10 +116,9 @@ output = "next_pc_unmasked" cond = "JALR" [[constraints.all]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", "next_pc_low", 1]] -multiplicity = "μ" +input = [["idx", "next_pc_low", 1], "μ"] [[constraints.all]] kind = "interaction" diff --git a/spec/src/cpu.toml b/spec/src/cpu.toml index a455b854f..06d71281e 100644 --- a/spec/src/cpu.toml +++ b/spec/src/cpu.toml @@ -511,43 +511,37 @@ input = ["EBREAK"] ref = "cpu:c:range_EBREAK" [[constraints.range]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["rs1"] -multiplicity = 1 +input = ["rs1", 1] [[constraints.range]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["rs2"] -multiplicity = 1 +input = ["rs2", 1] [[constraints.range]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["rd"] -multiplicity = 1 +input = ["rd", 1] [[constraints.range]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", "arg1", "i"]] +input = [["idx", "arg1", "i"], 1] iter = ["i", 0, 7] -multiplicity = 1 [[constraints.range]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", "arg2", "i"]] +input = [["idx", "arg2", "i"], 1] iter = ["i", 0, 7] -multiplicity = 1 [[constraints.range]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", "res", "i"]] +input = [["idx", "res", "i"], 1] iter = ["i", 0, 7] -multiplicity = 1 [[constraint_groups]] diff --git a/spec/src/keccak_round.toml b/spec/src/keccak_round.toml index 548cb5151..243feb790 100644 --- a/spec/src/keccak_round.toml +++ b/spec/src/keccak_round.toml @@ -211,18 +211,16 @@ multiplicity = "μ" # Cxz_left = [-1, 256, -1, 256, -1, 256, -1, 256] and # Cxz_right = [ 1, -256, 1, -256, 1, -256, 1, -256] [[constraints.theta]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", "Cxz_left", "x"], "z"]] +input = [["idx", ["idx", "Cxz_left", "x"], "z"], "μ"] iters = [["x", 0, 4], ["z", 0, 7]] -multiplicity = "μ" [[constraints.theta]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", "Cxz_right", "x"], "z"]] +input = [["idx", ["idx", "Cxz_right", "x"], "z"], "μ"] iters = [["x", 0, 4], ["z", 0, 7]] -multiplicity = "μ" [[constraints.theta]] kind = "interaction" @@ -257,18 +255,16 @@ multiplicity = "μ" # rot_left = [-1, 256, -1, 256, -1, 256, -1, 256] and # rot_right = [ 1, -256, 1, -256, 1, -256, 1, -256] [[constraints.rho]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", ["idx", "rot_left", "x"], "y"], "z"]] -iters = [["x", 0, 4], ["y", 0, 4], ["z", 0, 7]] -multiplicity = "μ" +input = [["idx", ["idx", ["idx", "rot_left", "x"], "y"], "z"], "μ"] +iters = [["x", 0, 4], ["y", 0, 4], ["z", 0, 7]] [[constraints.rho]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", ["idx", "rot_right", "x"], "y"], "z"]] +input = [["idx", ["idx", ["idx", "rot_right", "x"], "y"], "z"], "μ"] iters = [["x", 0, 4], ["y", 0, 4], ["z", 0, 7]] -multiplicity = "μ" [[constraint_groups]] name = "chi" diff --git a/spec/src/page.toml b/spec/src/page.toml index dff939558..289af9f3d 100644 --- a/spec/src/page.toml +++ b/spec/src/page.toml @@ -40,16 +40,14 @@ def = ["+", "page", ["*", "offset", ["cast", 1, "DWordWL"]]] name = "all" [[constraints.all]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["init"] -multiplicity = 1 +input = ["init", 1] [[constraints.all]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["fini"] -multiplicity = 1 +input = ["fini", 1] [[constraints.all]] kind = "interaction" diff --git a/spec/src/sha256.toml b/spec/src/sha256.toml index 4cd4de9ba..fe072d3dc 100644 --- a/spec/src/sha256.toml +++ b/spec/src/sha256.toml @@ -232,10 +232,9 @@ input = ["timestamp", "last_round_out", 64] multiplicity = ["-", "μ"] [[constraints.compress]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["idx", "out", "i"]] -multiplicity = "μ" +input = [["idx", "out", "i"], "μ"] iter = ["i", 0, 31] [[constraints.compress]] diff --git a/spec/src/sha256msgsched.toml b/spec/src/sha256msgsched.toml index 79664a797..8acf0af4d 100644 --- a/spec/src/sha256msgsched.toml +++ b/spec/src/sha256msgsched.toml @@ -79,10 +79,9 @@ desc = "#`IS_WORD[SHA256_M[timestamp, i]]` for $0 <= i < #`index`$" name = "lookback" [[constraints.lookback]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = [["-", "index", 16]] -multiplicity = "μ" +input = [["-", "index", 16], "μ"] [[constraints.lookback]] kind = "interaction" @@ -130,10 +129,9 @@ output = "s1" multiplicity = "μ" [[constraints.calc]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["carry"] -multiplicity = "μ" +input = ["carry", "μ"] [[constraints.calc]] kind = "interaction" diff --git a/spec/src/sha256round.toml b/spec/src/sha256round.toml index 8ec93ea36..5efbbacaa 100644 --- a/spec/src/sha256round.toml +++ b/spec/src/sha256round.toml @@ -254,10 +254,9 @@ multiplicity = "μ" iter = ["i", 0, 1] [[constraints.addition]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["carry_a"] -multiplicity = "μ" +input = ["carry_a", "μ"] [[constraints.addition]] kind = "interaction" @@ -267,10 +266,9 @@ multiplicity = "μ" iter = ["i", 0, 1] [[constraints.addition]] -kind = "interaction" +kind = "template" tag = "IS_BYTE" -input = ["carry_e"] -multiplicity = "μ" +input = ["carry_e", "μ"] [[constraint_groups]] name = "output" From ca217ff737493a652b76d02f122fea221eeb04db Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Thu, 23 Apr 2026 10:23:01 +0200 Subject: [PATCH 5/9] spec/ARE_BYTES: drop IS_BYTE interaction --- spec/src/bitwise.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spec/src/bitwise.toml b/spec/src/bitwise.toml index e7ea98470..30875a810 100644 --- a/spec/src/bitwise.toml +++ b/spec/src/bitwise.toml @@ -167,11 +167,6 @@ input = [["+", "X", ["*", 256, "Y"], ["*", 65536, "Z"]]] output = "ZERO" multiplicity = ["-", "μ_ZERO"] -[[constraints.contributions]] -kind = "template" -tag = "IS_BYTE" -input = ["X", ["-", "μ_IS_BYTE"]] - [[constraints.contributions]] kind = "interaction" tag = "ARE_BYTES" From 315ebdc0d6019d44dbb87be6e6564edcef254719 Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Thu, 23 Apr 2026 10:23:25 +0200 Subject: [PATCH 6/9] spec/ARE_BYTES: drop IS_BYTE lookup signature --- spec/src/signatures.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/src/signatures.toml b/spec/src/signatures.toml index 14936960d..f80e1fde9 100644 --- a/spec/src/signatures.toml +++ b/spec/src/signatures.toml @@ -163,12 +163,6 @@ kind = "interaction" input = ["B20"] output = "Bit" -# IS_BYTE[X] -[[signatures]] -tag = "IS_BYTE" -kind = "interaction" -input = ["Byte"] - # ARE_BYTES[X, Y] [[signatures]] tag = "ARE_BYTES" From c2c13d7fd21831dc65742e7a11ddbac6f688b7e3 Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Tue, 28 Apr 2026 09:19:10 +0200 Subject: [PATCH 7/9] spec/ARE_BYTES: turn multiplicity into cond --- spec/is_byte.typ | 4 ++-- spec/src/branch.toml | 3 ++- spec/src/cpu.toml | 12 ++++++------ spec/src/is_byte.toml | 12 ++++++------ spec/src/keccak_round.toml | 12 ++++++++---- spec/src/page.toml | 4 ++-- spec/src/sha256.toml | 3 ++- spec/src/sha256msgsched.toml | 6 ++++-- spec/src/sha256round.toml | 6 ++++-- spec/src/signatures.toml | 3 ++- 10 files changed, 38 insertions(+), 27 deletions(-) diff --git a/spec/is_byte.typ b/spec/is_byte.typ index c910b6df6..09bf78e98 100644 --- a/spec/is_byte.typ +++ b/spec/is_byte.typ @@ -8,9 +8,9 @@ #show: book-page(chip.name) #let is_byte = raw(chip.name) -#is_byte is a constraint template that is used to assert that a variable lies in the range $[0, 255]$ with given multiplicity. +#is_byte is a constraint template that is used to assert that a variable lies in the range $[0, 255]$ under the condition that `cond` is non-zero. Note: when `cond` is omitted, it defaults to $1$. -When a chip leverages this template twice or more, implementors are encouraged to merge pairs of #is_byte interactions with identical multiplicities into `ARE_BYTES` interactions; the #is_byte template is included for convenience of notation, and to complete the specification of chips that use an odd number of #is_byte range checks. +When a chip leverages this template twice or more, implementors are encouraged to merge pairs of #is_byte interactions with identical conditions into `ARE_BYTES` interactions; the #is_byte template is included for convenience of notation, and to complete the specification of chips that use an odd number of #is_byte range checks. = Variables #let nr_interactions = compute_nr_interactions(chip) diff --git a/spec/src/branch.toml b/spec/src/branch.toml index e16ef7d16..49a7833a3 100644 --- a/spec/src/branch.toml +++ b/spec/src/branch.toml @@ -118,7 +118,8 @@ cond = "JALR" [[constraints.all]] kind = "template" tag = "IS_BYTE" -input = [["idx", "next_pc_low", 1], "μ"] +input = [["idx", "next_pc_low", 1]] +cond = "μ" [[constraints.all]] kind = "interaction" diff --git a/spec/src/cpu.toml b/spec/src/cpu.toml index 06d71281e..f2131d729 100644 --- a/spec/src/cpu.toml +++ b/spec/src/cpu.toml @@ -513,34 +513,34 @@ ref = "cpu:c:range_EBREAK" [[constraints.range]] kind = "template" tag = "IS_BYTE" -input = ["rs1", 1] +input = ["rs1"] [[constraints.range]] kind = "template" tag = "IS_BYTE" -input = ["rs2", 1] +input = ["rs2"] [[constraints.range]] kind = "template" tag = "IS_BYTE" -input = ["rd", 1] +input = ["rd"] [[constraints.range]] kind = "template" tag = "IS_BYTE" -input = [["idx", "arg1", "i"], 1] +input = [["idx", "arg1", "i"]] iter = ["i", 0, 7] [[constraints.range]] kind = "template" tag = "IS_BYTE" -input = [["idx", "arg2", "i"], 1] +input = [["idx", "arg2", "i"]] iter = ["i", 0, 7] [[constraints.range]] kind = "template" tag = "IS_BYTE" -input = [["idx", "res", "i"], 1] +input = [["idx", "res", "i"]] iter = ["i", 0, 7] diff --git a/spec/src/is_byte.toml b/spec/src/is_byte.toml index a596d8f00..c9f8ee363 100644 --- a/spec/src/is_byte.toml +++ b/spec/src/is_byte.toml @@ -1,15 +1,15 @@ name = "IS_BYTE" +[[variables.condition]] +name = "cond" +type = "BaseField" +desc = "" + [[variables.input]] name = "X" type = "BaseField" desc = "Value for which to assert that it lies in the range $[0, 255]$." -[[variables.multiplicity]] -name = "μ" -type = "BaseField" -desc = "" - [[constraint_groups]] name = "all" @@ -17,5 +17,5 @@ name = "all" kind = "interaction" tag = "ARE_BYTES" input = [0, "X"] -multiplicity = "μ" +multiplicity = "cond" ref = "isbyte:c:isbyte" diff --git a/spec/src/keccak_round.toml b/spec/src/keccak_round.toml index 243feb790..d41b7c472 100644 --- a/spec/src/keccak_round.toml +++ b/spec/src/keccak_round.toml @@ -213,14 +213,16 @@ multiplicity = "μ" [[constraints.theta]] kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", "Cxz_left", "x"], "z"], "μ"] +input = [["idx", ["idx", "Cxz_left", "x"], "z"]] iters = [["x", 0, 4], ["z", 0, 7]] +cond = "μ" [[constraints.theta]] kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", "Cxz_right", "x"], "z"], "μ"] +input = [["idx", ["idx", "Cxz_right", "x"], "z"]] iters = [["x", 0, 4], ["z", 0, 7]] +cond = "μ" [[constraints.theta]] kind = "interaction" @@ -257,14 +259,16 @@ multiplicity = "μ" [[constraints.rho]] kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", ["idx", "rot_left", "x"], "y"], "z"], "μ"] +input = [["idx", ["idx", ["idx", "rot_left", "x"], "y"], "z"]] iters = [["x", 0, 4], ["y", 0, 4], ["z", 0, 7]] +cond = "μ" [[constraints.rho]] kind = "template" tag = "IS_BYTE" -input = [["idx", ["idx", ["idx", "rot_right", "x"], "y"], "z"], "μ"] +input = [["idx", ["idx", ["idx", "rot_right", "x"], "y"], "z"]] iters = [["x", 0, 4], ["y", 0, 4], ["z", 0, 7]] +cond = "μ" [[constraint_groups]] name = "chi" diff --git a/spec/src/page.toml b/spec/src/page.toml index 289af9f3d..b6247a7c7 100644 --- a/spec/src/page.toml +++ b/spec/src/page.toml @@ -42,12 +42,12 @@ name = "all" [[constraints.all]] kind = "template" tag = "IS_BYTE" -input = ["init", 1] +input = ["init"] [[constraints.all]] kind = "template" tag = "IS_BYTE" -input = ["fini", 1] +input = ["fini"] [[constraints.all]] kind = "interaction" diff --git a/spec/src/sha256.toml b/spec/src/sha256.toml index fe072d3dc..78d022515 100644 --- a/spec/src/sha256.toml +++ b/spec/src/sha256.toml @@ -234,8 +234,9 @@ multiplicity = ["-", "μ"] [[constraints.compress]] kind = "template" tag = "IS_BYTE" -input = [["idx", "out", "i"], "μ"] +input = [["idx", "out", "i"]] iter = ["i", 0, 31] +cond = "μ" [[constraints.compress]] kind = "template" diff --git a/spec/src/sha256msgsched.toml b/spec/src/sha256msgsched.toml index 8acf0af4d..402f7459a 100644 --- a/spec/src/sha256msgsched.toml +++ b/spec/src/sha256msgsched.toml @@ -81,7 +81,8 @@ name = "lookback" [[constraints.lookback]] kind = "template" tag = "IS_BYTE" -input = [["-", "index", 16], "μ"] +input = [["-", "index", 16]] +cond = "μ" [[constraints.lookback]] kind = "interaction" @@ -131,7 +132,8 @@ multiplicity = "μ" [[constraints.calc]] kind = "template" tag = "IS_BYTE" -input = ["carry", "μ"] +input = ["carry"] +cond = "μ" [[constraints.calc]] kind = "interaction" diff --git a/spec/src/sha256round.toml b/spec/src/sha256round.toml index 5efbbacaa..2469b560c 100644 --- a/spec/src/sha256round.toml +++ b/spec/src/sha256round.toml @@ -256,7 +256,8 @@ iter = ["i", 0, 1] [[constraints.addition]] kind = "template" tag = "IS_BYTE" -input = ["carry_a", "μ"] +input = ["carry_a"] +cond = "μ" [[constraints.addition]] kind = "interaction" @@ -268,7 +269,8 @@ iter = ["i", 0, 1] [[constraints.addition]] kind = "template" tag = "IS_BYTE" -input = ["carry_e", "μ"] +input = ["carry_e"] +cond = "μ" [[constraint_groups]] name = "output" diff --git a/spec/src/signatures.toml b/spec/src/signatures.toml index f80e1fde9..e93c87b05 100644 --- a/spec/src/signatures.toml +++ b/spec/src/signatures.toml @@ -9,7 +9,8 @@ cond = "BaseField" [[signatures]] tag = "IS_BYTE" kind = "template" -input = ["BaseField", "BaseField"] +input = ["BaseField"] +cond = "BaseField" # cond => ADD [[signatures]] From f8a0595e1729566619f9c654b8bf0eb16421eb92 Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Tue, 28 Apr 2026 09:19:41 +0200 Subject: [PATCH 8/9] spec/ARE_BYTES: remove as potential optimization --- spec/bitwise.typ | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/bitwise.typ b/spec/bitwise.typ index 82f9e36f9..332bef3d9 100644 --- a/spec/bitwise.typ +++ b/spec/bitwise.typ @@ -37,8 +37,6 @@ This chip adds the following interactions to the lookup: = Notes/Optimizations The following ideas may prove to be optimizations for the #bitwise chip: -+ Extend `IS_BYTE[X]` to `ARE_BYTES[X, Y]`, such that two bytes are range checked at once. - When only a single check is required, one can still execute `IS_BYTE[X] := ARE_BYTES[X, 0]`. + Drop `MSB8` column, and instead define the `MSB8` lookup as `MSB8 := MSB16[256X]`. Note: currently, `MSB8` also implicity range checks the input `X` (the lookup fails if `X` is not a `Byte`). This optimization should only be executed when all chips leveraging `MSB8` do _not_ need this implicit range check. From 75216c8d380681eb8725187f81ce7453d24a83ba Mon Sep 17 00:00:00 2001 From: Erik Takke Date: Tue, 28 Apr 2026 09:20:00 +0200 Subject: [PATCH 9/9] spec/ARE_BYTES: update assumptions using IS_BYTE --- spec/src/shift.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/src/shift.toml b/spec/src/shift.toml index bbe22a5d9..18c03ecad 100644 --- a/spec/src/shift.toml +++ b/spec/src/shift.toml @@ -147,7 +147,7 @@ iter = ["i", 0, 3] ref = "shift:a:range_in" [[assumptions]] -desc = "`IS_BYTE[shift]`" +desc = "`IS_BYTE`" ref = "shift:a:range_shift" [[assumptions]]