vfhe.piop.relations¶
The relation toolbox (piop.md section 4).
- class vfhe.piop.relations.FamilyShape(widths: Mapping[str, int | tuple[int, ...]])¶
The shape of a family of sparse tables packed into one master oracle.
widthsmaps each sparse index field of the inner relation to the width (number of variables) of the table it holds, or to the tuple of widths of the tables it holds; the slots are those tables in that order,aof them. The master P is an oracle overselectors + xs:ceil(log2 a)slot variables T (none for a single slot) followed bymax widthtable variables X, with the index bits of a nonzeroi || kread LSB-first – slotiin the low bits, the table’s own indexkabove them (index_of). Memberiis the restriction of P atT = bin(i)(bitjofiatT_j), the coordinates of X past its width fixed to 0, the rest renamed to variables of its own.The shape sits in the index of the dense relation, as data (not an
Oracle, soRelation.index_oraclesdoes not take it for one), anddigest()is by the widths.- classmethod of(index: Mapping, fields: tuple[str, ...]) FamilyShape¶
The shape of the tables an index holds in its sparse
fields.
- property count: int¶
The number of slots, a.
- implicit() ImplicitOracle¶
A fresh handle for the master, over
selectors + xs.
- slot_bits(i: int) dict¶
T = bin(i): the slot variables fixed to the bits ofi.
- index_of(i: int, k: int) int¶
The master’s index of entry
kof the table in sloti.
- restriction(P, i: int) VirtualOracle¶
Member
iof the family as a restriction ofP(the master’s handle, or its table):T = bin(i), the coordinates of X past the slot’s width fixed to 0, the rest renamed to variables of its own.
- place(P) dict¶
The sparse index fields filled with the restrictions of
P, in the shape of the family: one restriction, or a tuple of them.
- class vfhe.piop.relations.Relation_Circuit(index=None)¶
Circuit satisfiability with the wiring predicates committed through one dense index oracle:
Relation_CircuitSparseIndexwith its"predicates"replaced by("dense", "shape", "speval"), the index("circuit", "dense", "shape", "speval");oracles = (out, w_in)and the headoutas there. The decider decodes the predicates once through the realization and decides the sparse-index relation;compute_headis its (the output table from the input through the circuit). Its protocol iscompose(dense_layering), registered against this class and itsStart:GKRruns in the first layer over restrictions of the master, the realization’s protocol in the second (protocols/sparse.py).- Start¶
alias of
Start
- compute_head(statement: Statement)¶
The head’s table from the statement’s other oracles (prover view).
- decode()¶
The master’s sparse table, as the realization decodes it from the dense index oracle.
- inner¶
alias of
Relation_CircuitSparseIndex
- class vfhe.piop.relations.Relation_CircuitSparseIndex(index=None)¶
The input oracle evaluates, under the circuit in the index, to the output oracle:
oracles = (out, w_in),outa table over s_out variables (public, committed, or plain, or the implicit head of a headed statement) andw_inone over s_in variables. The index is the circuit description and its wiring predicates,("circuit", "predicates"), the latter the tuplewiring_predicatesbuilds – the sparse index field, public tables or restrictions of a master – whichGKR’s layer bodies read;indexed(circuit, domain)is the indexer. The ideal decider evaluates the circuit gate by gate over the input table;compute_headreturns its output table, so a circuit can define an implicit oracle of a larger reduction.- classmethod indexed(circuit: gkr.Circuit, domain)¶
The relation indexed by
circuit, its predicates built indomain(a Ring, a Field, or None for plain Python values).
- property circuit: gkr.Circuit¶
The circuit this relation is indexed by.
- property predicates: tuple[TableOracle, ...]¶
The wiring predicates,
(lin_0, xmult_0, ..., lin_{d-1}, xmult_{d-1}).
- layer_tables(table) list¶
Every layer’s padded wire values from the input
table(a dense table): entry 0 is the input, entry l + 1 the gates of layer l (zeros past the last gate).
- compute_head(statement: Statement)¶
The head’s table from the statement’s other oracles (prover view).
- Start¶
alias of
Start
- class vfhe.piop.relations.Relation_Equal(index=None)¶
Two oracles over the same number of variables agree on the hypercube,
oracles = (a, b): the headless statement that ties a circuit’s output oracle to its output layer.
- class vfhe.piop.relations.Relation_Layer(index=None)¶
Gate layer l of a circuit as a sum definition, indexed by
("circuit", "layer", "lin", "xmult"), the circuit, l and the layer’s two sparse predicates:oracles = (W_{l+1}, G_l)with G_l the layer identity over those predicates and the layer below under two renamings (GKRbuilds it).compute_headevaluates the gates on the table of the layer below, linear in the wires, where the generic route would materialize the predicates.- compute_head(statement: Statement)¶
L’s table, the hypercube sums of G over the summed variables, from G’s constituent tables (the prover view): the generic, exponential route. A relation that knows G’s structure (a circuit layer) computes the table directly instead.
- Start¶
alias of
Start
- class vfhe.piop.relations.Relation_Lookup(beta: int)¶
f(b) in t_betafor everybin{0,1}^n, witht_beta = {0, ..., beta - 1}the relation’s index.The table is an index rather than an instance field because it is the large, reusable, preprocessable part of the claim: one
betaserves every lookup of a given digit width, and it is public data both parties hold (piop.md§3).- property beta: int¶
The table size;
t_betais{0, ..., beta - 1}.
- class vfhe.piop.relations.Relation_Range(bound: int)¶
Every
Z_qcoefficient of every hypercube evaluation of theR_qoracle lies in[0, B), the coefficients read as their representatives in[0, q): the range relation on packed polynomials of [CCCFGS25; CCCFGS26]. The index is the boundB.
- class vfhe.piop.relations.Relation_ResidueRange(bound: int)¶
Every entry of an integer table lies in
[0, B), the table given by its residues modulo the primesp_1, ..., p_Uofq: one oracle per prime, over a field of characteristicp_i(F_(p_i)or an extension of it), whose entries are the residues as elements of the prime subfield. The index is the boundB.This is
Relation_Rangeon the unpacked tableu = unpack(v)of [CCCFGS26] – the multilinear extension of the coefficients ofv’s values, one entry perZ_qcoefficient – written in residue number system form [Gar59], the CRT components ofZ_q: the relation of a range proof whose coefficient oracles are committed per prime instead of as oneR_qoracle. An integer belowqis determined by its residues (the Chinese remainder theorem), so the claim is that the residue tuple at every hypercube point is that of an integer belowB; an entry outside the prime subfield (F_(p^d),d > 1) is the residue of no integer.
- class vfhe.piop.relations.Relation_SpEval(index=None)¶
The sparse-evaluation relation: the sparse oracle
"sparse"(P, the head) is what the dense index oracle"dense"(P_dense) encodes, for a family of the given"shape"; no instance fields.Abstract: the decoding is
compute_head, which a realization supplies. A realization subclasses this relation, implementscompute_head(the sparse table over the head’s variables, from the dense table and the shape), holds any parameter of its own as a class attribute – the dense layering builds it over the three index fields and nothing else – is decorated withwith_startitself (the registry keys on the exact class), and registers against itsStarta sequentially composable protocol: one that takes any claims on P, never queries P, draws every challenge itself, and ends in evaluation claims on P_dense – carried inoracles, so that the driver bundles them for the commitment scheme, or terminal when P_dense is a plain table of the ideal model. The generic decider compares the nonzeros of the"sparse"entry, a table in the ideal model, with those of the decoding.
- class vfhe.piop.relations.Relation_Sum(index=None)¶
sum_{b in {0,1}^n} f(b) == value, for a single oracle f.
- class vfhe.piop.relations.Relation_SumDef(index=None)¶
L(z) = sum_{b in {0,1}^m} G(z, b)on the hypercube: a sum definition of the oracle L, the head, by the virtual oracle G over L’s variables z and the summed variables b, the others of G, in G’s order: a layer of a layered circuit in terms of the layer below it [Tha22, §4.6], a grand-product level [Tha13, §5.3.1]. A statement headed at L is how an oracle that is defined and never committed enters a layered reduction: it sits in the layer of L, andSumDefStart, registered againstRelation_SumDef.Start, is its composable protocol.- static summed_of(L, G) list¶
The summed variables: G’s that are not L’s.
- static definition(statement: Statement) tuple[Oracle, VirtualOracle]¶
The head L and the defining virtual oracle G of a sum-definition statement, G’s type checked.
- compute_head(statement: Statement)¶
L’s table, the hypercube sums of G over the summed variables, from G’s constituent tables (the prover view): the generic, exponential route. A relation that knows G’s structure (a circuit layer) computes the table directly instead.
- Start¶
alias of
Start
- class vfhe.piop.relations.Relation_SumProd(index=None)¶
sum_{b in {0,1}^n} prod_j f_j(b) == value, for oracles f_1..f_k over the same variables (an instance whose oracles disagree on them is not in the relation).
- class vfhe.piop.relations.Relation_Zero(index=None)¶
f(b) == 0 for every b in {0,1}^n, for a single oracle f.
- vfhe.piop.relations.dense_relation(inner_cls: type[Relation]) type[Relation]¶
The relation with a dense index derived from
inner_cls, a relation whose index holds a family of sparse tables in the fields it declares assparse_index_fields: the same instance fields and head, the index fields ofinner_clsthat are not sparse, then"dense"(P_dense, a table),"shape"(aFamilyShape) and"speval"(the realization, aRelation_SpEvalsubclass). Its decider decodes once through the realization and decidesinner_clswith the slices in the sparse fields’ place;compute_headisinner_cls’s, over the index with the sparse fields holding restrictions of the master’s handle (the head of a relation does not depend on its sparse index oracles). The class is returned undecorated: applywith_startwheninner_clshas a head.
- vfhe.piop.relations.wiring_predicates(circuit: gkr.Circuit, domain) tuple[TableOracle, ...]¶
The indexer’s predicates of
circuitindomain: the tuple(lin_0, xmult_0, ..., lin_{d-1}, xmult_{d-1}), public sparse tables, those of layerlover variables[y..., x..., z...]of their own, created here (s_inofyand ofx,s_outofz).