Evaluating the CMMSA partial truth table from explicit tables #
FromCMMSA.entry f x reads its input x as a bit string and the functions f v of the variables
as Boolean functions. This module computes the same entries from explicit data: the input is a
number x < 2 ^ L, and the function of variable v is a list T[v] of its values in the order
of BitString.equivFin. The definitions use only Nat.testBit, division and remainder by powers
of two, List.getD and folds, so a polynomial-time proof can follow them directly.
The input fields are read arithmetically. The formula index is x mod 2 ^ indexWidth
(formulaIndex_equivFin_symm). The slot (t, q) starts at bit
slotOffset I Δ k lam t q = indexWidth + slotWidth · (q + Δ t), its k seeds of W bits come
first, then its mask bit. A variable v evaluates a seed z at entry z mod 2 ^ ℓ v of T[v],
reading false past the end of T[v].
Correctness is local. termParityN T x t equals termParity f x t as soon as T[v] is the table
of f v for the variables v of term t alone (termParityN_eq), so a caller can evaluate a
term from the tables of only some variables. With every table present (IsVarTable for all v),
the entries agree (entryN_eq), and tables f, the list of all tables, gives the whole table of
toInstance (tableN_tables).
The evaluator definitions are exposed because their polynomial-time proofs, in a separate module, follow their bodies.
Main definitions #
Cslib.PartialMCSP.FromCMMSA.slotOffset: the position of the first bit of a slot.Cslib.PartialMCSP.FromCMMSA.slotBitN,termParityN,entryN,tableN: the slot bits, term parities, entries and whole table, computed from explicit tables and a numeric input.Cslib.PartialMCSP.FromCMMSA.IsVarTable:T[v]is the table off v.Cslib.PartialMCSP.FromCMMSA.varTable,tables: the explicit tables of the functionsf.
Main results #
Cslib.PartialMCSP.FromCMMSA.formulaIndex_equivFin_symm: the formula index of the input numberedxisx mod 2 ^ indexWidth, the index thattermParityNandentryNread.Cslib.PartialMCSP.FromCMMSA.slotBitN_eq,termParityN_eq: local correctness, from the tables of the variables that the slot or term reads.Cslib.PartialMCSP.FromCMMSA.entryN_eq: with every table present,entryNisentry.Cslib.PartialMCSP.FromCMMSA.tableN_eq_ofFn: from any listTwith the table of every variable,tableN Tis the table oftoInstance I Δ k lam P f.Cslib.PartialMCSP.FromCMMSA.tableN_tables: in particular,tableN (tables f)is.Cslib.PartialMCSP.FromCMMSA.isVarTable_tables,IsVarTable.of_getD_eq:tables fhas the table of every variable, and so does any list that agrees with it atv.
References #
The evaluator #
The position of the first bit of slot (t, q): indexWidth + slotWidth · (q + Δ t).
The bit of slot (t, q) at a numeric input x, computed from the tables T: the mask bit of
the slot plus, over its k seeds z, entry z mod 2 ^ ℓ v of T[v] for the variable v of its
literal.
The parity of term t at a numeric input x: the sum of the bits of its occupied slots.
The entry at a numeric input x: b when the formula index j is below m and every term of
φ_j has parity b; otherwise undefined.
The whole table: the entries at x = 0, …, 2 ^ L - 1.
T[v] is the table of f v in the order of BitString.equivFin, and reads false at 0 when
v is not a variable.
The table of f v in the order of BitString.equivFin; empty when v is not a variable.
The tables of all variables.
Reading the input fields #
The formula index of the input numbered x is x mod 2 ^ indexWidth.
Correctness #
Local correctness of a slot. If T[v] is the table of f v for the variable v of slot
(t, q), then slotBitN computes the slot bit.
Local correctness of a term. If T[v] is the table of f v for every variable v of
term t of the indexed formula, then termParityN computes the parity of term t.
Correctness of an entry. With the table of every variable, entryN is entry.
With every table, tableN lists the table of toInstance I Δ k lam P f.
The tables of all variables, as a list, at a number v.
A list of tables that agrees with tables f at v has the table of f v.
tables f has the table of every variable.
The table of toInstance from explicit tables.