Skip to content

Keep IxVM lazy defeq bounded on open Nat terms - #562

Merged
arthurpaulino merged 2 commits into
mainfrom
ap/ixvm-distill
Aug 17, 2026
Merged

arthurpaulino merged 2 commits into
mainfrom
ap/ixvm-distill

Conversation

@arthurpaulino

Copy link
Copy Markdown
Member

Summary

This PR makes the IxVM's lazy definitional-equality path both more selective and strictly bounded. It avoids eagerly expanding symbolic Nat primitives such as large-offset comparisons, while preventing projection/constant reduction cycles from silently refreshing their fuel budget.

It also adds Batteries as a compile-environment benchmark target so the environment can be included in sharding and compatibility sweeps.

Details

  • Add a structural WHNF pass that performs beta, zeta, iota, and projection reduction without delta-unfolding definitions or dispatching primitives. Defeq uses this pass before its no-delta reducer, allowing structurally equal terms to close without exposing large logical implementations.
  • Leave open Nat primitives in compact symbolic form. Closed primitive applications still dispatch normally, but applications containing bound variables no longer expand into potentially enormous successor/recursive terms.
  • Bound the lazy-delta accelerator end to end:
    • projection and constant retries continue within the same fuel budget instead of re-entering defeq and resetting it;
    • structural comparison shares one reduction credit across the whole expression tree, so work cannot multiply across nested applications or sibling subterms;
    • if the bounded path remains undecided, the compatibility fallback runs full WHNF on the original terms rather than partially unfolded intermediates.
  • Reduce projection-headed terms without delta first, then retain a single scrutinee delta step for cases that need a constructor-built instance exposed.
  • Add and pin regression coverage for large open Nat offsets, projected/indexed values, and the Int8.toInt64_ne_minValue proof shape that exercises the eager compatibility path.
  • Regenerate the native Rust IxVM executor and repin the affected kernel and shard-pipeline FFT costs.
  • Add CompileBatteries alongside the existing compile-environment targets.

Validation

  • The IxVM FFT regression suite is repinned for the new kernel shape, including bytecode/native-codegen parity coverage.
  • The shard-pipeline FFT pin is updated from 6,097,645,626 to 6,098,300,309.
  • Environment sweeps completed across 600 shards covering Init, InitStd, Lean, Batteries, Mathlib, and FLT without timeouts or check failures.

Add a CompileBatteries library alongside the existing environment compilation targets so Batteries can be compiled into an Ix environment for sharding and sweeps.
Distill the IxVM reduction changes into a bounded lazy-defeq path that avoids eagerly unfolding open Nat primitives while retaining the recursor correctness fixes already on main.

Normalize structural heads before primitive dispatch, keep delta and projection retries within one fuel budget, and preserve compact symbolic Nat expressions instead of expanding their logical implementations.

Regenerate the native IxVM executor and update the affected FFT pins.

Validation: all 600 shards across Init, InitStd, Lean, Batteries, Mathlib, and FLT completed successfully with no timeouts or check failures.
@arthurpaulino
arthurpaulino enabled auto-merge (squash) August 16, 2026 15:12
@arthurpaulino
arthurpaulino merged commit 6e10865 into main Aug 17, 2026
11 checks passed
@arthurpaulino
arthurpaulino deleted the ap/ixvm-distill branch August 17, 2026 17:20
samuelburnham added a commit that referenced this pull request Aug 18, 2026
Whole-env checking through the codegen'd IxVM kernel over ONE shared
QueryRecord: worker threads warm-execute a verify_block claim per
schedule block (min-cut linearization keeps closure-overlapping blocks
adjacent), every shared dependency cone derives once, and each sealed
segment runs one verify_segment claim over the digest-bound block list
whose calls memo-hit the warm work.

The record is an insert-once SET under concurrency: lock-free entry
reservation (fetch_add), the stored key hash doubles as the completion
marker (Release-stored last), and every multiplicity is DERIVED at
seal from the unique-query set — racing speculative execution is
confluent because nothing accumulated at runtime enters the witness.
Storage is a mono-typed atomic Segment arena on plain 4 KiB anonymous
mmap (hugepage schemes measured out), with a per-thread probe cache
and striped hashbrown index.

Planning is measurement: one whole-env execution cut into fine
segments at a measured threshold, each segment's per-circuit raw
heights taken at seal, then grouped into shard-sized proof units under
the exact peak-prove-RSS model's bound (calibrated against real STARK
proves). Manifest verify/prove re-executes each shard standalone and
gates on the exact measured peak. Diagnostics: IX_WATCH_DUMP,
IX_QM_LEN_PANIC, IX_SEG_DUMP_COUNTS, IX_EXEC_DUMP_COUNTS/KEYS, stall
detection naming stuck blocks. Includes bench envs and campaign
manifests, and the IxVM codegen regenerated against the merged #562
kernel.
samuelburnham added a commit that referenced this pull request Aug 20, 2026
Whole-env checking through the codegen'd IxVM kernel over ONE shared
QueryRecord: worker threads warm-execute a verify_block claim per
schedule block (min-cut linearization keeps closure-overlapping blocks
adjacent), every shared dependency cone derives once, and each sealed
segment runs one claim over the digest-bound block list whose calls
memo-hit the warm work.

The record is an insert-once SET under concurrency: lock-free entry
reservation (fetch_add), the stored key hash doubles as the completion
marker (Release-stored last), and every multiplicity is DERIVED at
seal from the unique-query set — racing speculative execution is
confluent because nothing accumulated at runtime enters the witness.
Storage is a mono-typed atomic Segment arena on plain 4 KiB anonymous
mmap (hugepage schemes measured out), with a per-thread probe cache
and striped hashbrown index.

Planning is measurement: one whole-env execution cut into fine
segments at a measured threshold, each segment's per-circuit raw
heights taken at seal, then grouped into shard-sized proof units under
the exact peak-prove-RSS model's bound (calibrated against real STARK
proves). Manifest prove does not trust the manifest: a shard that
seals clean but measures over budget is bisected in place with the
plan's partitioner and its halves re-execute, re-measure, and prove
recursively; only a single block over budget is irreducible.

The RAM budget is measured, not assembled from guesses: MemAvailable
at run start times 1 - MODEL_RESIDUAL, where the residual (2%) is the
campaign-measured gap between peak_prove_bytes and real prove RSS.
Cutting belongs to the workers: each tests the mode's metric between
blocks (exec: record_retained_bytes; plan/prove: the RAM model), so no
polling gap exists; the watcher is a stall detector only. Remaining
constants each carry one justification: CUT_FRAC (drain slack),
PLAN_TRIGGER_FRAC (grouping resolution), MODEL_RESIDUAL (measured).
IX_SCAN_RAM_GIB overrides the budget directly.

CLI surface: `ix shard --backend aiur` (default) is the measured
planner writing the `.ixes` manifest; `--backend zisk` keeps the
static/profiled partitioners. Input flags: --env for the `.ixe`,
--shards for the manifest, across check/prove/verify/addr-of/name-of/
validate-lean. Diagnostics: IX_WATCH_DUMP, IX_QM_LEN_PANIC,
IX_SEG_DUMP_COUNTS, IX_EXEC_DUMP_COUNTS/KEYS, stall detection naming
stuck blocks. Includes bench envs and campaign manifests, and the
IxVM codegen regenerated against the merged #562 kernel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants