## miden::core::stark::utils
| Procedure | Description |
| ----------- | ------------- |
| load_security_params | Loads the proof's security parameters from advice into the generic verifier context.<br /><br />Advice order: [num_queries, query_pow_bits, deep_pow_bits, folding_pow_bits].<br />Inputs: [...]<br />Outputs: [...]<br /> |
| compute_lde_generator | Compute the LDE domain generator from the log2 of its size.<br /><br />Input: [log2(domain_size), ..]<br />Output: [domain_gen, ..]<br />Cycles: 63<br /> |
| validate_inputs | Validates the inputs to the recursive verifier.<br /><br />Checks security parameters from memory. Relation wrappers validate and store trace metadata<br />before calling the generic verifier.<br /><br />Input: [...]<br />Output: [...]<br /> |
| bit_reverse_len_parallel | Reverse the lowest `bits` bits of `index` using parallel bit-swap.<br />`pow2_shift` must equal 2^(32 - bits); the caller pre-computes it once.<br /><br />The algorithm has two parts:<br /><br />1) Left-shift: multiply index by pow2_shift = 2^(32-bits) to place the `bits`<br />meaningful bits into the top of a 32-bit word. Since index < 2^bits, the<br />product is always < 2^32 so u32wrapping_mul is exact.<br /><br />2) Full 32-bit reversal via 5 parallel swap steps. Each step k (for k=1,2,4,8,16)<br />swaps every adjacent group of k bits. A mask isolates the even-positioned<br />groups; the odd-positioned groups are the complement. Shifting each half by<br />k positions and combining swaps all groups simultaneously. After all 5 steps,<br />bit position i has moved to position 31-i, which (because of the initial<br />left-shift) is exactly position (bits-1-i) of the original -- i.e., the<br />reversed index. No final shift is needed.<br /><br />The two halves never overlap, so XOR = OR = ADD; we use XOR (1 cycle vs 3 for<br />u32wrapping_add).<br /><br />Input: [index, pow2_shift, ...]<br />Output: [rev_index, ...]<br />Cycles: 78<br /> |
| execute_constraint_evaluation_check | Executes the constraints evaluation check.<br /><br />Inputs: [...]<br />Outputs: [...]<br /><br />Invocation: exec<br /> |
| observe_aux_trace | Observes the auxiliary trace: draws aux randomness, reseeds with the aux trace commitment,<br />and absorbs aux trace boundary values into the transcript.<br /><br />For AIRs without an auxiliary trace, the implementation should be a no-op.<br /><br />Inputs: [...]<br />Outputs: [...]<br /><br />Invocation: exec<br /> |
| store_dynamically_executed_procedures | Stores digests of dynamically executed procedures.<br /><br />Input: [D0, D1, D2, D3, D4, ...]<br />Output: [...]<br /> |
| derive_order_tag_from_heights | Derives the Lehmer proof-order tag of a height-sorted relation.<br /><br />The proof order sorts the relation's AIRs by ascending log height, with the canonical<br />instance order breaking ties (a stable sort). For each canonical AIR k with log height h_k<br />read from `heights_ptr + k`:<br /><br />inv_k = #{m < k : h_m > h_k}<br />pos_k = #{m < k : h_m <= h_k} + #{m > k : h_m < h_k}<br />tag += inv_k * (num_airs - 1 - pos_k)!<br /><br />Splitting the scan at k makes the stable tie-break explicit and needs one height comparison per<br />other AIR. The loops are `while`-based so this procedure can serve any relation (repeat bounds<br />would need compile-time counts). PVM uses this generic path. The VM uses a fixed-count<br />specialization; tests pin both implementations to the shared Rust `order_tag` convention.<br /><br />This procedure uses `tmp1..tmp3` as a twelve-entry factorial table and clobbers<br />their previous contents.<br /><br />Precondition: `num_airs >= 2`. The procedure rejects counts above `MAX_ORDER_AIRS = 12`, the<br />largest count whose complete tag range fits in u32. The AIR count is relation metadata, never<br />prover data. Height comparisons reject out-of-range values.<br /><br />Input: [num_airs, heights_ptr]<br />Output: [tag]<br /> |
| factorial | Computes x! for small x.<br /><br />Input: [x]<br />Output: [x!]<br /> |