vfhe.piop.protocols¶
The protocols (piop.md section 5): the reductions registered against the
relations of the toolbox. The sumcheck protocols are a subpackage,
sumcheck, with their round-message kernels (sumcheck.rounds) and the
prover’s forms of a virtual oracle (sumcheck.prover_view).
- class vfhe.piop.protocols.GKR¶
Relation_CircuitSparseIndexas a layered reduction: the output test in L_0, then the gate layers from the output layer down, oneRelation_Layerstatement per layer headed at the layer’s implicit oracle; the input oracle isw_initself. Registered protocols it relies on:OutputTestforRelation_Equal,SumDefStartforRelation_Layer.Start, the sumcheck andVirtualEval.- reduces_from¶
alias of
Relation_CircuitSparseIndex
- class vfhe.piop.protocols.GKR_Start¶
The sequentially composable form of
GKR, forRelation_CircuitSparseIndex.Start: the gate layers alone, the top one started by the claims the statement carries on its head, the output oracle.- reduces_from¶
alias of
Start
- class vfhe.piop.protocols.LogUpGKR(field: Any, messages: OracleMessages | None = None)¶
Relation_Lookup -> Relation_Eval: the lookup argument of [Hab22] with its fractional sums proven by GKR [PH23].Over a field of characteristic above the number of looked-up entries, every entry of
f(overnvariables) lies int_betaexactly when, for somem,sum_(x in {0,1}^n) 1 / (X - f(x)) = sum_(y < beta) m(y) / (X - y),
m(y)then being the number of entries equal toy(the set-inclusion lemma of [Hab22]). The prover sendsm, the verifier drawsxioutsidet_beta, and the two sides atX = xiare the roots of two trees of fractions (fraction_tree):(1, xi - f)over2^nleaves and(m, xi - t)overbeta. The two trees have their own depths, and the verifier compares the roots as fractions,a_f h_t == a_t h_fwithh_f != 0.Each root is proven by GKR from the root down [PH23, §3]: a claim
(y, y')on layerkat the pointrhois, by the layer rule,- y + lambda y’ = sum_(x in {0,1}^k) eq~(rho, x) [a(x,0) h(x,1)
a(x,1) h(x,0) + lambda h(x,0) h(x,1)]
over layer
k + 1, a sum of degree 3 in each variable, proven by the registeredRelation_Sumprotocol. The prover then sends the four valuesa(r,0), a(r,1), h(r,0), h(r,1)at the sumcheck’s pointr, the verifier checks them against the sumcheck’s final claim, drawspsiand takes the line through them to the claim on layerk + 1at(r, psi). On the leaves, that claim is one evaluation claim onf(f = xi - h) or onm(m = a); the verifier evaluates the table’st~(y) = sum_k 2^k y_kitself.The driver hands the protocol every frontier claim at once, and one run proves all of them. Claims into the same
t_betashare onem, the sum of their counts, and one table-side tree; among them, claims on oracles with the same number of variables are concatenated into one oracle-side tree, as inLookup(s = ceil(log2 k)selector variables after the data ones, zero blocks as padding, counted inm), and the verifier adds the roots of the oracle-side trees of one table before comparing. Every tree of the run, whatever its table and depth, sharesxiand the points: layerkof all the trees deeper thankis one sumcheck, the trees’ claims combined by independent challenges. The run hasmax depth * (max depth - 1) / 2sumcheck rounds.- reduces_from¶
alias of
Relation_Lookup
- parameters() tuple¶
The public parameters of this protocol, in a fixed order; empty by default.
- soundness_error(statement: Statement, domain: Any = None) float | None¶
(2^(n + 1) + beta) / (|A| - beta), twice the entries of a claim on an oracle overnvariables, with|A|the size of the exceptional set the challenges are drawn from.The draw of
xiis where a false claim can pass: the difference of its two sides, a rational function, has a numerator of degree below the entries looked up plusbeta, andxiis drawn among the|A| - betaelements outside the table. Claims into the same table count together: a group ofkclaims on oracles overnvariables is one run over2^(n + s)entries,s = ceil(log2 k), with error(2^(n + s) + beta) / (|A| - beta). A statement does not determine its group, so each claim reports2^(n + 1): since2^s < 2k, the errors of a group’s claims add up to at least the group’s. The rest of the run is below it:3 / |A|per sumcheck round, and3 / |A|for each step from a layer to the next (psi,lambdaand the challenges combining the trees). The bound needs a field of characteristic above the number of looked-up entries of the table.
- class vfhe.piop.protocols.Lookup(field: Any, messages: OracleMessages | None = None)¶
Relation_Lookup -> Relation_Sum^2 x Relation_Eval^4: the lookup PIOP over a prime field of [CCCFGS26].Round 1: the prover sends the two counter polynomials of the memory-checking lemma, and the verifier replies with the fingerprint challenges
sigma_L,tau. (The paper writes the first one assigma, the letter the range decomposition uses for its challenge-set size, so here it iszeta.)Round 2: the prover sends the internal nodes
f^(1)_aof the four grand products – one per fingerprint – together with the four products themselves, and the verifier replies withchiand the two zerocheck pointsrho,xi.It then checks
WSt * WSmu == RS * S, which is the multiset identity of the memory-checking lemma in fingerprinted form, and emits two sum claims: one per side of the cube, each asserting that its pair of grand products was built correctly. Each is a zerocheck over the functiongof that PIOP,- sum_X eq~(point, X) * [ (f^(1)_a(X) - f_a(0,X) * f_a(1,X))
chi * (f^(1)_b(X) - f_b(0,X) * f_b(1,X)) ] == 0
expressed as a single
VirtualOracleof degree 3. The layeredf_ais itself virtual –(1 - W_n) * f^(0)_a + W_n * f^(1)_a, withf^(0)_aspelled out over the oracles the verifier already has – so the sumcheck ends on claims aboutmu,read_ts,final_ctsand thef^(1)_a, and never on anything the verifier has to take on trust.The driver hands the protocol every frontier
Relation_Lookupclaim at once. Claims into the same tablet_betaon oracles with the same number of variablesnform a group, and a group ofk > 1claims is one run over their concatenation: the oracles laid end to end, blockiholdingmu_i, overn + svariables withs = ceil(log2 k), and the blocks pastkholding zeros, an entry of every table. The counters, thef^(1)_aand the products are then those of that one oracle, and inf^(0)_athe term ofmubecomessum_i sel_i * mu_i,sel_ithe publiceq~table of blockiover the lastsvariables, which keepsf_amultilinear. A group of one is the run above, unchanged.- reduces_from¶
alias of
Relation_Lookup
- parameters() tuple¶
The public parameters of this protocol, in a fixed order; empty by default.
- soundness_error(statement: Statement, domain: Any = None) float¶
(2^(n + 1) + beta) / pfor a claim on an oracle overnvariables intot_beta: twice the claim’s entries, where [CCCFGS26]’s soundness theorem for its lookup PIOP counts them once.The theorem bounds a run over
2^ell*looked-up entries into a table of2^b*by(2^ell* + 2^b*) / p, the degree of the polynomialP(Z, Z')whose vanishing the fingerprint challenges test, over the field they are drawn from. Claims into the same table with the same number of variables count together: a group ofkis one run over2^(n + s)entries,s = ceil(log2 k), with error(2^(n + s) + beta) / p. A statement does not determine its group, so each claim reports2^(n + 1): since2^s < 2k, the errors of a group’s claims add up to at least the group’s.
- class vfhe.piop.protocols.OutputTest¶
Relation_Equal(out, top)->Eval(top, r, v), andEval(out, r, v)unlessoutis public: the verifier draws r (one challenge per variable), v = out(r) is computed by the verifier whenoutis public and sent by the prover otherwise — the random-evaluation identity test of [Tha22, §4.6], soundness s /|A|by generalized Schwartz-Zippel [GNS23, Lem. 2]. The step that turns a sequentially composable protocol into a protocol for the relation with its head committed or public.- reduces_from¶
alias of
Relation_Equal
- class vfhe.piop.protocols.RangeDecomposition(field: Any, m: int, alphabet: int, kappa: int, ring: Any, chunks: int | None = None, messages: OracleMessages | None = None, *, max_digit_bits: int | None = None)¶
Relation_Range -> Relation_Lookup x Relation_Eval^(2 kappa)([CCCFGS26]’s optimized range PIOPPi*_range).Round 1: the prover sends
mu', the base-betadigits of the unpacked coefficients, reduced intoF_p. The verifier replies withkappapointsr_etadrawn from the challenge setSigma = {0, ..., sigma-1}, a set of integers exceptional inZ_qand inF_pat once – raw coins (challenge_bits), not domain elements, because the same integers have to be read both inZ_q(to queryv) and inF_p(to querymu').Round 2: the prover sends the partial evaluations
psi_eta = mu'(r'_eta, .)– binding the firstmvariables, an efficiency parameter – and thekapparing valuesv(x_eta). The verifier replies with one spot-check points'.It then checks, per repetition, that the digits recompose:
sum_{delta, j} iota(psi_eta[delta, j]) * eq~(delta; r_eta^{>m}) * beta^{to-int(j)} == u(x_eta, z_eta) (mod q)
with
u(x_eta, z_eta)computed fromv(x_eta)byunpacked_evaluationand both sides computed as exact integers first.iotais sound there because every entry ofpsi_eta, as an integer, is bounded by2^m beta sigma^m < p/2(the parameter conditionp > 2 beta (2 sigma)^m), so nothing overflowsF_p.What is left over becomes statements: that each
psi_etareally is a partial evaluation ofmu'(oneRelation_Evalonmu'per repetition, at(r'_eta, s')), that eachv(x_eta)really is an evaluation ofv(oneRelation_Evalonvper repetition), and that every digit is int_beta(oneRelation_Lookup).When
cdoes not dividelog2(B), the digits arec - 1oflog2(beta)bits and a most significant one of fewer (digit_alphabets), and aRelation_Lookup(top_beta)on the restriction ofmu'to the last digit (Z'all ones) follows the first: with it, the integer the digits rebuild is belowbeta^(c-1) * top_beta = B, not only belowbeta^c.The steps that read the coefficient oracle – the digits, the queries at the integer points, the check against them and the claims they leave – are methods a subclass replaces for another form of that oracle (
ResidueRangeDecomposition); the rounds, the messages ofmu'andpsi, the lookups and the soundness bound are shared.Parameters:
field, the prime fieldF_pof the digits;m, the number of variables ofmu'bound in eachpsi_eta, an efficiency parameter (0 <= m <= ell + nu; a largermmeans a smallerpsiand a largerp);alphabet, the sizesigmaof the challenge setSigma, a power of two at most the smallest prime ofq;kappa, the number of repetitions (soundness((ell + nu) / sigma)^kappa);ring, theR_qof the claims;chunks, the numbercof digits per coefficient (digit_alphabets);messages, howmu'travels (OracleMessages). Instead ofchunks, one may givemax_digit_bits, the widest digit allowed in bits; each claim then getsc = digit_count(bound, max_digit_bits).- reduces_from¶
alias of
Relation_Range
- parameters() tuple¶
The public parameters of this protocol, in a fixed order; empty by default.
- digit_count_for(bound: int) int¶
Return the number of digits
cfor a claim with boundbound:chunkswhen it was given, elsedigit_count(bound, max_digit_bits).
- class vfhe.piop.protocols.ResidueRangeDecomposition(field: Any, m: int, alphabet: int, kappa: int, chunks: int | None = None, messages: OracleMessages | None = None, *, max_digit_bits: int | None = None)¶
Relation_ResidueRange -> Relation_Lookup x Relation_Eval^(kappa (U+1)): [CCCFGS26]’s optimized range PIOPPi*_rangewith the unpacked polynomial given as an oracle of its own, in residue number system form [Gar59]:Uresidue oraclesu_1, ..., u_U, one per prime ofq, each over a field of that characteristic (F_(p_i)or an extension of it) with entries in the prime subfield. An oracle over the auxiliary ringH_q = prod_i F_(p_i^d)of [CCCFGS26] is such a tuple, which is why extension fields are allowed.The rounds are
RangeDecomposition’s:mu', the digits of the integers the residues define, thenkappapointsr_etaofSigma^n,nthe oracles’ variables, then the partial evaluationspsi_etaand the spot point. The query atr_etais answered on every residue oracle: the prover sends(u_1(r_eta), ..., u_U(r_eta)), each coordinate ofr_etaread in the oracle’s field, and the verifier checks, for every prime:sum_{delta, j} iota(psi_eta[delta, j]) * eq~(delta; r_eta^{>m}) * beta^{to-int(j)} == u_i(r_eta) in F_(p_i^d),
the left side the integer of
RangeDecomposition’s check reduced modulop_i. Holding at every prime, the two sides agree moduloq, which isRangeDecomposition’s check with the unpacked evaluation replaced by the oracle’s own value; an answer outside the prime subfield fails the equality. The claims left arekappaonmu', as before, andkappa Uevaluation claims on the residue oracles at the integer points, in place of thekappaclaims on the ring oracle.The constructor takes
RangeDecomposition’s parameters exceptring:(field, m, alphabet, kappa, chunks, messages), withmax_digit_bitsaccepted in place ofchunks. The primes come from the oracles’ domains (Oracle.domain).- reduces_from¶
alias of
Relation_ResidueRange
- class vfhe.piop.protocols.SumDefStart¶
The composable protocol of a sum definition: the started statement’s claims
L(r_i) = y_ibecome oneSum(sum_i alpha_i G(r_i, .), sum_i alpha_i y_i)over the summed variables, the alphas independent challenges (none for a single claim); the registered sumcheck then reduces it to one evaluation claim on that virtual oracle, andVirtualEvalthat claim to claims on G’s constituents, both run by the Composer inside the layer (or by the driver, for a started statement run on its own). Zero communication; soundness error (k-1)/|A|for k claims [Sor22, Lem. 11; CCCFGS25, Eqs. (19)-(20)].- reduces_from¶
alias of
Start
- class vfhe.piop.protocols.Sumcheck¶
Reduces
sum_{b in {0,1}^n} f(b) == vtof(r) == v_nin n rounds.Round i: the prover sends (g_i(0), g_i(1)) — the oracle is a single multilinear polynomial, so deg g_i = 1; the verifier checks g_i(0) + g_i(1) against the running claim, the challenge r_i is drawn from the domain’s exceptional set, and the claim becomes g_i(r_i).
The oracle may also be a virtual oracle in products form: the round message is then g_i at 0..degree, computed by the prover view’s
round_evals(prover_view.py), and the final claim is an evaluation claim on the virtual oracle, whichVirtualEvalreduces to its constituents. After the last round the prover’s bookkeeping tables hold every constituent’s value at r [Tha13; XZZPS19, Alg. 1]; they are recorded as the prover’s witness of that claim (Prover.witnesses[claim], a dict from constituent index to value), so that the prover of the next step reads them instead of evaluating each constituent again.- reduces_from¶
alias of
Relation_Sum
- soundness_error(statement: Statement, domain: Any = None, degree: int | None = None) float | None¶
degree * num_vars /
|A|(piop.md §6); None if|A|is unknown. The domain defaults to the oracle’s (Oracle.domain), the degree to the oracle’s (degreeattribute of a defined oracle in products form), else 1 (a multilinear table).
- class vfhe.piop.protocols.SumcheckProd¶
Libra-style product sumcheck [XZZPS19, Alg. 3]: reduces one
sum_{b in {0,1}^n} prod_j f_j(b) == vclaim to k = #factorsRelation_Evalclaims, all at the same random point r.Round i: each factor is linear in x_i, so the round polynomial g_i(X) = sum_b prod_j f_j(b, X) has degree k, sent as its evaluations at 0..k (values above 1 extrapolated division-free from the table halves as lo + t·(hi - lo)). The verifier checks g_i(0) + g_i(1) against the running claim and interpolates g_i(r_i) as the next claim. After the last round the prover sends the per-factor values v_j = f_j(r); the verifier checks prod_j v_j against the final claim and each (f_j, r, v_j) becomes an output Relation_Eval statement.
The native (C) path covers two native tables over a Ring — the reference Libra shape — and three over the same variables; other arities or representations use the pure-Python path. Both paths produce identical transcripts.
- reduces_from¶
alias of
Relation_SumProd
- class vfhe.piop.protocols.VirtualEval¶
Eval(p*, x, v)on a virtual oracle -> oneEval(p_j, h_j(x), y_j)per distinct non-public constituent query (piop.md §4).The prover sends the constituent values y_j; the verifier evaluates the public constituents itself, checks
ev(y, x) == v, and emits the claims. No challenge: each y_j is bound by its own claim and the check pins v, so the step has soundness error 0. The prover takes a y_j from the claim’s witness when the step that made the claim recorded it (Prover.witnesses[statement], constituent index to value: a sumcheck ending on the oracle does), and evaluates the constituent otherwise.- reduces_from¶
alias of
Relation_Eval
- vfhe.piop.protocols.dense_layering(root: Statement) list[list[Statement]]¶
The protocol of a dense-index relation as a layered reduction:
L_0the inner relation over the root’s instance fields, its sparse index fields holding restrictions of a fresh master P, headed at the root’s head when the root is started (the Composer then starts it with the root’s claims);L_1the realization over(P, P_dense, shape), headed at P through its index. Rule 1: P headsL_1; rule 2:L_0reaches P through its index,L_1mentions only P_dense beside its head. No message, no challenge, soundness error 0. Registercompose(dense_layering)against the dense relation and itsStart.