@@ -10,10 +10,100 @@ use thiserror::Error;
1010use zinc_poly:: utils:: ArithErrors ;
1111use zinc_uair:: LookupTableType ;
1212
13+ // ---------------------------------------------------------------------------
14+ // Per-group proof (BatchedDecompLogup)
15+ // ---------------------------------------------------------------------------
16+
17+ /// Proof for one lookup group (columns sharing the same table type).
18+ ///
19+ /// Does **not** contain a sumcheck proof — the sumcheck is shared via
20+ /// the protocol-level multi-degree sumcheck. This struct
21+ /// carries only the auxiliary vectors the verifier needs to reconstruct
22+ /// evaluations at the shared point.
23+ ///
24+ /// Chunk vectors are **not** included — the verifier reconstructs them
25+ /// from the inverse witnesses: `c_k[j] = β − 1/u_k[j]`. Soundness
26+ /// follows from the PCS commitment binding the parent column.
27+ #[ derive( Clone , Debug , PartialEq , Eq ) ]
28+ pub struct BatchedDecompLogupProof < F > {
29+ /// Per-witness aggregated multiplicity vectors:
30+ /// `aggregated_multiplicities[l][j] = Σ_k m_k^(l)[j]`.
31+ pub aggregated_multiplicities : Vec < Vec < F > > ,
32+ /// Per-witness per-chunk inverse witness vectors:
33+ /// `chunk_inverse_witnesses[l][k][i] = 1 / (β − chunk[l][k][i])`.
34+ pub chunk_inverse_witnesses : Vec < Vec < Vec < F > > > ,
35+ /// Shared inverse table vector: `inverse_table[j] = 1 / (β − T[j])`.
36+ pub inverse_table : Vec < F > ,
37+ }
38+
39+ // ---------------------------------------------------------------------------
40+ // Per-group metadata (carried in the proof for the verifier)
41+ // ---------------------------------------------------------------------------
42+
43+ /// Describes how a lookup witness column was derived from the trace.
44+ ///
45+ /// Carried in [`LookupGroupMeta`] so the verifier can reconstruct the
46+ /// parent evaluation without re-receiving the lookup specs.
47+ #[ derive( Clone , Debug , PartialEq , Eq ) ]
48+ pub enum LookupWitnessSource {
49+ /// Standard column lookup: parent eval = `up_evals[column_index]`.
50+ Column {
51+ /// Original trace column index.
52+ column_index : usize ,
53+ } ,
54+ /// Affine-combination lookup: parent eval = `Σ coeff·up_evals[col] +
55+ /// offset`. Currently only needed for BitPoly
56+ Affine {
57+ /// `(column_index, coefficient)` pairs.
58+ terms : Vec < ( usize , i64 ) > ,
59+ /// Constant bit-polynomial offset encoded as a u32 bit pattern.
60+ constant_offset_bits : u32 ,
61+ } ,
62+ }
63+
64+ /// Per-group metadata stored in the proof so the verifier can reconstruct
65+ /// tables and column layout without being passed the original lookup specs.
66+ #[ derive( Clone , Debug , PartialEq , Eq ) ]
67+ pub struct LookupGroupMeta {
68+ /// Table type for this group (determines subtable generation).
69+ pub table_type : LookupTableType ,
70+ /// Number of witness columns batched into this group (L).
71+ pub num_columns : usize ,
72+ /// Number of rows in each witness vector (trace length).
73+ pub witness_len : usize ,
74+ /// Per-witness source descriptors.
75+ pub witness_sources : Vec < LookupWitnessSource > ,
76+ }
77+
78+ // ---------------------------------------------------------------------------
79+ // Complete lookup proof
80+ // ---------------------------------------------------------------------------
81+
82+ /// Top-level proof: one [`BatchedDecompLogupProof`] per lookup group
83+ /// (groups formed by batching columns with the same [`LookupTableType`]).
84+ /// Carries [`LookupGroupMeta`] per group so the verifier needs no
85+ /// external specs.
86+ #[ derive( Clone , Default , Debug , PartialEq , Eq ) ]
87+ pub struct BatchedLookupProof < F > {
88+ /// Per-group proofs, in group order.
89+ pub group_proofs : Vec < BatchedDecompLogupProof < F > > ,
90+ /// Per-group metadata needed by the verifier.
91+ pub group_meta : Vec < LookupGroupMeta > ,
92+ }
93+
1394// ---------------------------------------------------------------------------
1495// Core LogUp types
1596// ---------------------------------------------------------------------------
1697
98+ /// Verifier subclaim from the LogUp protocol.
99+ #[ derive( Clone , Debug ) ]
100+ pub struct LogupVerifierSubClaim < F > {
101+ /// Evaluation point from the sumcheck subclaim.
102+ pub evaluation_point : Vec < F > ,
103+ /// Expected evaluation at the subclaim point.
104+ pub expected_evaluation : F ,
105+ }
106+
17107/// Ancillary prover data for LogUp sumcheck group construction.
18108///
19109/// Borrows the pre-computed auxiliary vectors needed by
0 commit comments