Skip to content

spec v0.2#370

Merged
RobinJadoul merged 81 commits into
mainfrom
spec/main
Apr 10, 2026
Merged

spec v0.2#370
RobinJadoul merged 81 commits into
mainfrom
spec/main

Conversation

@RobinJadoul
Copy link
Copy Markdown
Collaborator

No description provided.

erik-3milabs and others added 30 commits December 29, 2025 10:33
See the original yetanotherco/lambda_vm_spec #1
for more details, if it still exists.

* Introduce `config` and "variables"

* chip column-to-table rendering

* restructuring

* some basic interactions idea

* Sample lt chip design

* Update formatting

* Interpret variable indexing

* BRANCH draft

* Fix indexing + render template

* Render labels for references to constraints

* Rendering chip assumptions

* Add an editorconfig for consistency in indentation and trailing newlines

* The constraint range index found its way back home

* Finish (?) LT chip

* Improve lisp rendering

* support constraint group rendering

* Support "^" type setting

* dvrm

* add dvrm assumptions

* Rendering virtual column definitions and polynomials for arith constraints

* ignore ebook.pdf

* Split LT and BRANCH into groups

* Nicer mutual recursion in expression formatting

* Use negation instead of mult by -1 in lt

* Format expr.typ

* Simplify subtraction expression

* Remove parentheses using precedence rules

* fmt

* improve dvrm readability

* fix lt parentheses

* move `extended_n_sub_r` def from constraint to var

* Set div chip word types to HL

* divrem fixes

* more dvrm tweaks

* Specify grammar

* add docs

* Drop chip files

* Improve `chip` readability

* minor fixes

---------

Co-authored-by: Erik Takke <erik.takke@3milabs.tech>
This fixes the following pain points:
- Assumptions and constraints requiring a `ref` for rendering to succeed
- The `desc` field of `arith` constraints not being rendered
- The `constraint` field of an `arith` constraint using eval in code mode
- Long tables (columns and constraints) didn't break across pages
- Template constraints did not have conditions rendered
- Constraint groups didn't get the proper prefix if specified
- The default branch of expression rendering has missing arguments

It also introduces a nice visual todo macro

---------

Co-authored-by: Erik <159244975+erik-3milabs@users.noreply.github.com>
Support array-like variable types.

Typed as:
```toml
[[variables.auxiliary]]
name = "var"
type = ["Bit", 5]
desc = "five bits"
```

---------

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>
Updated definition rendering:
* definitions are only allowed for virtual variables
* definitions are now labelled with `def` rather than `poly` or `polys`
* more flexible definitions possible for array-type virtuals.
* spec: update `description` printing
* spec: update `polynomial constraint` printing
* spec: Initial CPU version to handle RV64IMC

* Address review comments

* Add word_instr as input to SHIFT

---------

Co-authored-by: Erik <159244975+erik-3milabs@users.noreply.github.com>
* spec: init BRANCH chip

* Small cleanup

* Clean up variable naming and generally address review comments

* outdated comment

---------

Co-authored-by: Erik Takke <erik.takke@3milabs.tech>
* spec: conditionally render constraint table headers

* spec: simplify `selected_constraints` expression

* spec: repurpose `selected_constraints`
Co-authored-by: Erik Takke <erik.takke@3milabs.tech>
* spec: rough draft SHIFT chip

* various minor fixes

* implement right-limb shifting

* Update rendering "polynomial constriant" in table

* fix degree 4 issues

* Further update to SHIFT chip

* Clean up SHIFT

* spec/shift: add assumption

* spec/shift: Add lookup constraint

* spec/shift: make extension virtual
Kudos to Robin for uncovering this!

* spec/shift: Simplify limb-situation
Kudos to Robin for pointing this out!

* spec/SHIFT: fix typo

* Turn `limb_shift_x` into array

* spec: support "sum" expression in math

* Simplify limb-shifting constraint

* spec: attempt at refactoring `shift`

* spec: overhaul SHIFT

* spec: SHIFT: rename `extensions` as `extension`

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>

* spec: SHIFT: make `shift` of type Byte

* spec: SHIFT: replace variable '0x' with constant 0x

* spec: SHIFT: remove "cheaper" remark

* spec: SHIFT: fix `shifted` description

* spec: SHIFT: make output a DWordWL

* spec: SHIFT

* spec: SHIFT: introduce explanation; update some constraint elaborations

* Apply suggestions from the code review

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>

* spec: SHIFT: update `bits_shift` desc

* spec: SHIFT: update `limb_shift` desc

* spec: SHIFT: add missing IS_BIT constraint for limb_shift

* spec: SHIFT: update description

* spec: SHIFT: fix sum's expr-to-math

* Minor language pass

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>

---------

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>
* spec: ADD draft

* spec: ADD: fix `carry` size

* spec: ADD: clarify sum is mod 2^64

* spec: introduce `SUB` template notation.

* Fix assumption indices

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>

* Fix typos

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>

---------

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>
* spec: support "sum" expression

* spec: introduce "QuadHL" type

* spec: introduce MUL chip

* spec: Introduce QuadWL

* spec: introduce B20[4]

* spec: simplify MUL to 26 columns

* spec: Fix expr-sum bug

* spec: simplify MUL to 22 columns

* spec: improve MUL readability

* spec: MUL: fix indexing

* spec: MUL: refactor

* spec: drop B20

* spec: MUL: fix raw_product relation

* spec: MUL: fix IS_B19 check range

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>

* spec: MUL: add missing res range check assumption

* spec: MUL: remove superfluous/invalid constraints

* spec: MUL: leverage SIGN template

* spec: MUL: fix index mistake

* spec: MUL: update description

* spec: permit non-constant exponents

* spec: MUL: drop `limb_product`

* spec: MUL: minor tweaks

* spec: MUL: bump headers

* spec: MUL: update description

* spec: MUL: update to IS_B20

* spec: MUL: remove 'eloquent'

* Apply suggestions from code review

Thanks Robin!

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>

* spec: MUL: define padding

---------

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>
Co-authored-by: Erik <159244975+erik-3milabs@users.noreply.github.com>
Co-authored-by: Erik <159244975+erik-3milabs@users.noreply.github.com>
* spec: introduce BITWISE

* spec: BITWISE: outline optimizations

* spec: BITWISE: fix SLL naming mismatch

* spec: BITWISE: fix length computation mistake

* spec: drop `dot` in `expr_to_code` when multiplying constant with single-letter variable
RobinJadoul and others added 10 commits March 13, 2026 12:50
* spec: Some fixes for SHIFT

Closes: #389

* spec: Merge HWSL with HWSLC, to simplify SHIFT

Closes: #119

* typo

Co-authored-by: Cyprien de Saint Guilhem <c.desaintguilhem@gmail.com>

---------

Co-authored-by: Cyprien de Saint Guilhem <c.desaintguilhem@gmail.com>
* spec/memw: read/write from/to -> read from/write to

* spec/memw: rename add_limb_overflow as carry

* spec/memw: minor var desc updates

* spec/memw: remove superfluous minus symbol

* spec/memw: update description

* spec/memw_a: minor optimization

* Apply suggestions from code review

Co-authored-by: Robin Jadoul <robin.jadoul@gmail.com>

* spec/MEMW: fix interaction typing

* spec/MEMW: drop superfluous notes

* spec/MEMW: update alignment requirement

* spec/MEMW: intentionally separate carry's prose and .toml descriptions

---------

Co-authored-by: Robin Jadoul <robin.jadoul@gmail.com>
* spec/memw: read/write from/to -> read from/write to

* spec/memw: rename add_limb_overflow as carry

* spec/memw: minor var desc updates

* spec/memw: remove superfluous minus symbol

* spec/memw: update description

* spec/memw_a: minor optimization

* Apply suggestions from code review

Co-authored-by: Robin Jadoul <robin.jadoul@gmail.com>

* spec/MEMW: fix interaction typing

* spec/MEMW: drop superfluous notes

* spec/MEMW: update alignment requirement

* spec/MEMW: intentionally separate carry's prose and .toml descriptions

* spec/MEMW: fix multiplicities

* spec/MEMW_A: padding

* spec/MEMW: padding

* spec/MEMW: bit check multiplicities

* spec/MEMW: simplify padding

---------

Co-authored-by: Robin Jadoul <robin.jadoul@gmail.com>
---------

Co-authored-by: Robin Jadoul <robin.jadoul@gmail.com>
* spec: recursively compute chip interaction count

* spec: print interaction count per chip

* spec: cleanup

* spec/interaction-counter: add multi-dimensional iter support

* spec/interaction-counter: count SUB interactions

* spec/interaction-counter: drop silent lookup fails

* spec/interaction-counter: remove superfluous code

* spec/interaction_count: merge getter and setter

* spec/interaction_counter: clean up
* spec: have tooling exit(1) on error

* spec: run spec tooling in CI

* spec/tooling: verbosely state when no issues are found

* spec/CI: ignore benchmarks for spec stuff
* spec: add chapters

* spec: clean up toc

* spec: separate ecalls

* Fixes for shiroa

* Reformat ebook.typ a bit

---------

Co-authored-by: Robin Jadoul <robin.jadoul@3milabs.tech>
* spec: add backticks to section titles

* spec: replace "columns" headers with "variables"

* spec: auto count nr_variables

* spec: standardize "optimizations"-section headers

* spec/config: add missing spaces

* spec/chip: rename *_column_table as *_variable_table

* spec: drop table captions

* spec/v0.2: turn note into aside

* spec: place correctness arguments in separate section
@yetanotherco yetanotherco deleted a comment from github-actions Bot Apr 10, 2026
@erik-3milabs
Copy link
Copy Markdown
Collaborator

Codex Code Review

  1. High - Validation errors can be silently ignored (exit code stays 0)

Previously solved in 6eecb98

  1. Medium - Unknown signature kind crashes with UnboundLocalError

Fixed. See 284b45f

  1. Low - Hidden global dependency on config in iterator parsing

Fixed. See c0c83db

Copy link
Copy Markdown
Collaborator

@erik-3milabs erik-3milabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@RobinJadoul RobinJadoul added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit 7b42e51 Apr 10, 2026
10 checks passed
@RobinJadoul RobinJadoul deleted the spec/main branch April 10, 2026 13:13
@erik-3milabs erik-3milabs restored the spec/main branch April 10, 2026 13:17
@erik-3milabs erik-3milabs deleted the spec/main branch April 10, 2026 13:19
@erik-3milabs erik-3milabs restored the spec/main branch April 10, 2026 14:06
erik-3milabs added a commit that referenced this pull request Apr 10, 2026
spec/tooling: add default case in `build_signature`

spec/tooling: fix hidden global variable

spec/tooling: fix silent side effect

spec/tooling: context manage file reads

spec: fix precedence

Swap precedence of ADD and SUB and treat the first subexpression of a SUB differently
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spec Updates and improvements to the spec document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spec: SHIFT chip updates spec: Remove HWSLC lookup from SHIFT chip

5 participants