1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//! Per-bus emitters for the Miden VM's LogUp argument.
//!
//! The Miden VM's LogUp buses are emitted per AIR: 4 columns for Core, 3 for Chiplets, and 1 for
//! Poseidon2Permutation. Most columns host a single bus, but several host two or more
//! linearly-independent buses sharing one running accumulator via distinct `bus_prefix[bus]`
//! additive bases (see per-bus module docs for the merges).
//! Each emitter is a crate-private `pub(in crate::constraints::lookup) fn emit_*` that
//! opens a single [`super::LookupBuilder::column`] closure and describes the bus's
//! interactions via [`super::LookupColumn::group`] or
//! [`super::LookupColumn::group_with_cached_encoding`].
//!
//! ## Shared merge rules
//!
//! A [`super::LookupColumn::group`] assumes its top-level entries are mutually exclusive,
//! so the column degree is the max over active branches. Simultaneous fractions belong in
//! a [`super::LookupGroup::batch`] with an explicit degree. If two interaction families are
//! not mutually exclusive, they must be emitted as sibling groups; sibling groups compose
//! product-wise and increase the column degree accordingly.
//!
//! Some columns merge multiple bus families into one group. This is valid only when their
//! row selectors are mutually exclusive. Each bus still has its own `bus_prefix[bus]`.
//!
//! The emitters are routed per-AIR:
//! - [`super::main_air::MainLookupAir`] for the main-trace columns, driven by [`crate::CoreAir`]'s
//! `LookupAir` impl.
//! - [`super::chiplet_air::emit_chiplet_lookup_columns`] for the chiplet-trace columns, driven by
//! [`crate::ChipletsAir`]'s `LookupAir` impl.
//! - [`super::poseidon2_permutation_air::emit_poseidon2_permutation_lookup_columns`] for the
//! Poseidon2-permutation trace column, driven by [`crate::Poseidon2PermutationAir`]'s `LookupAir`
//! impl.
//!
//! ## Shared precompute contexts
//!
//! The main-trace and chiplet-trace contexts live next to their respective LookupAirs:
//! - [`super::main_air::MainBusContext`]: two-row window plus the shared [`LookupOpFlags`] instance
//! consumed by the 4 main-trace emitters.
//! - [`super::chiplet_air::ChipletBusContext`]: two-row window plus the shared
//! [`ChipletActiveFlags`] snapshot consumed by the 3 chiplet-trace emitters.
//!
//! Each context is built once per `eval` through an extension-trait hook
//! ([`super::main_air::MainLookupBuilder::build_op_flags`] /
//! [`super::chiplet_air::ChipletLookupBuilder::build_chiplet_active`]). Prover-side
//! implementations can override those hooks with boolean fast paths without changing
//! emitter code. [`ChipletActiveFlags`] lives in this module because it is the pure
//! helper used by the default chiplet hook and by optimized implementations.
use ;
use crateChipletCols;
pub
pub
pub
pub
pub
pub
pub
pub
pub use LookupOpFlags;
// CHIPLET ACTIVE FLAGS
// ================================================================================================
/// Per-chiplet `is_active` expressions, mirroring the active-flag block of
/// [`build_chiplet_selectors`](super::super::chiplets::selectors::build_chiplet_selectors).
///
/// These are the only chiplet flags the LogUp buses consume.
/// `is_transition`, `is_last`, and `next_is_first` are used only by the chiplet
/// constraints, so this type does not carry them.
///
/// The constructor is a pure compute function: it builds the same algebra as
/// `build_chiplet_selectors` but does NOT emit any `when` / `assert_*` calls, so it is
/// safe to run in parallel with the constraint-path chiplet selector pass.
pub