witness#
Witness generation modules.
This module provides per-AIR witness generation that replaces the generic hint-driven witness computation. Each AIR has its own WitnessModule that computes intermediate columns and grand sums directly in readable Python code.
For AIRs without hand-written modules, the bytecode adapter provides a fallback using compiled expression bytecode. The BYTECODE_AIRS dict controls which AIRs use bytecode vs hand-written modules.
Zisk AIRs are auto-discovered from the proving key directory. All discovered AIRs without hand-written modules are registered for bytecode evaluation.
Submodules#
Attributes#
Functions#
|
Get witness module instance for an AIR. |
Package Contents#
- witness.WITNESS_REGISTRY: dict[str, type[base.WitnessModule]][source]#
- witness.get_witness_module(air_name: str, expressions_bin: str | None = None) base.WitnessModule[source]#
Get witness module instance for an AIR.
When expressions_bin is provided (from AirConfig), prefers hand-written modules in WITNESS_REGISTRY to avoid naming collisions between pilouts that share an AIR name (e.g., SpecifiedRanges appears in both Simple pilout and Zisk). If the hand-written module does not implement Stage-2, wraps it with a bytecode fallback.
Without expressions_bin, checks BYTECODE_AIRS first (Zisk AIRs), then falls back to hand-written modules in WITNESS_REGISTRY.
- Args:
air_name: Name of the AIR (e.g., ‘SimpleLeft’, ‘Lookup2_12’) expressions_bin: Optional path to .bin bytecode. When provided, takes priority
over BYTECODE_AIRS to prevent cross-pilout naming collisions.
- Returns:
WitnessModule instance for the AIR
- Raises:
KeyError: If no witness module is registered for the AIR (and no expressions_bin)