Documentation

CslibFrontier.Computability.Circuit.SpanProgram.Elimination

The algorithm Lin and the program P_L by elimination #

Boneh and Shoup, Theorem 22.14, p. 981 states two algorithms for a monotone span program P whose parties are 1, …, N. For an accepted coalition s, Lin(s) returns vectors λ_j with ∑_{j ∈ s} λ_j M_j = e₁. For a coalition that is not accepted, P_L is a program that accepts the same coalitions and has left-most column zero in the matrix of every member of s. Both are computed here by one run of elimination on the stacked rows of the members (Cslib.LinearAlgebra.vecMulSolve and Cslib.LinearAlgebra.kernelVecAt). The theorem also says that Lin is efficient and that P_L is efficiently computable. The results here concern their values; they are steps toward Theorem 22.14, not the theorem (#5293).

The book proves part (b) by extending a basis of the row space of the coalition. Here P_L is P multiplied on the right by the identity matrix whose first column is a kernel vector v of the members' rows with v₁ = 1. That matrix is invertible with top row e₁, so Lemma 22.15 applies, and it keeps columns 2, …, d of every matrix unchanged. shearMatrix lives in the span-program namespace because normalForm is its only client; it moves to Foundations/LinearAlgebra/Matrix/ when a second client appears.

The three algorithms are total. Outside their domains they return what elimination returns: recombination_eq_zero_of_not_accepts, nullVector_eq_zero_of_accepts and not_accepts_normalForm_of_accepts. The circuit-size bounds, one field-gate circuit for each shape of program, are in CslibFrontier.Computability.Circuit.SpanProgram.EliminationSynthesis; the identities of Theorem 22.14 for the shares and the secret are in CslibFrontier.Crypto.Protocols.SecretSharing.AccessStructure.LinearEquivalence.

Main definitions #

Main results #

References #

def Cslib.Circuits.MonotoneSpanProgram.stack {F : Type u_1} [Field F] {N : ℕ} (P : MonotoneSpanProgram F (Fin N)) (s : Finset (Fin N)) :
Matrix (Fin (∑ i : Fin N, P.rowDim i)) (Fin (P.tailDim + 1)) F

The rows of the matrices of the members of s, stacked in the order of the parties; the rows of the other parties are replaced by zero.

theorem Cslib.Circuits.MonotoneSpanProgram.stack_apply {F : Type u_1} [Field F] {N : ℕ} (P : MonotoneSpanProgram F (Fin N)) (s : Finset (Fin N)) (i : Fin N) (row : Fin (P.rowDim i)) :
P.stack s (finSigmaFinEquiv ⟨i, row⟩) = if i ∈ s then P.matrix i row else 0
theorem Cslib.Circuits.MonotoneSpanProgram.vecMul_stack {F : Type u_1} [Field F] {N : ℕ} (P : MonotoneSpanProgram F (Fin N)) (s : Finset (Fin N)) (W : Fin (∑ i : Fin N, P.rowDim i) → F) :
Matrix.vecMul W (P.stack s) = ∑ i ∈ s, Matrix.vecMul (fun (row : Fin (P.rowDim i)) => W (finSigmaFinEquiv ⟨i, row⟩)) (P.matrix i)
theorem Cslib.Circuits.MonotoneSpanProgram.stack_mulVec_eq_zero_iff {F : Type u_1} [Field F] {N : ℕ} (P : MonotoneSpanProgram F (Fin N)) (s : Finset (Fin N)) (v : Fin (P.tailDim + 1) → F) :
(P.stack s).mulVec v = 0 ↔ ∀ i ∈ s, (P.matrix i).mulVec v = 0
def Cslib.Circuits.MonotoneSpanProgram.shearMatrix {F : Type u_1} [Field F] {d : ℕ} (v : Fin (d + 1) → F) :
Matrix (Fin (d + 1)) (Fin (d + 1)) F

The identity matrix with its first column replaced by v. For v 0 = 1 it is invertible with top row e₁; multiplying a matrix M by it on the right replaces the first column of M by M *ᵥ v and keeps the other columns.

theorem Cslib.Circuits.MonotoneSpanProgram.det_shearMatrix {F : Type u_1} [Field F] {d : ℕ} (v : Fin (d + 1) → F) :
(shearMatrix v).det = v 0
theorem Cslib.Circuits.MonotoneSpanProgram.shearMatrix_zero {F : Type u_1} [Field F] {d : ℕ} {v : Fin (d + 1) → F} (hv : v 0 = 1) :
theorem Cslib.Circuits.MonotoneSpanProgram.mulRight_shearMatrix_matrix_zero {F : Type u_1} [Field F] {Party : Type u_2} (P : MonotoneSpanProgram F Party) (v : Fin (P.tailDim + 1) → F) (i : Party) (row : Fin (P.rowDim i)) :
(P.mulRight (shearMatrix v)).matrix i row 0 = (P.matrix i).mulVec v row

Multiplying by shearMatrix v replaces the first column by the product with v.

def Cslib.Circuits.MonotoneSpanProgram.recombination {F : Type u_1} [Field F] {N : ℕ} [DecidableEq F] (P : MonotoneSpanProgram F (Fin N)) (s : Finset (Fin N)) (i : Fin N) :
Fin (P.rowDim i) → F

Algorithm Lin ([BS23], Theorem 22.14(a), p. 981): recombination vectors for the coalition s, by elimination on the stacked rows. Party i gets the vector P.recombination s i. The rows of a party outside s are zero in stack, and its vector does not enter sum_vecMul_recombination. When s is not accepted, elimination finds no solution and returns the zero vector for every party (recombination_eq_zero_of_not_accepts).

theorem Cslib.Circuits.MonotoneSpanProgram.sum_vecMul_recombination {F : Type u_1} [Field F] {N : ℕ} [DecidableEq F] (P : MonotoneSpanProgram F (Fin N)) {s : Finset (Fin N)} (hs : P.Accepts s) :
∑ i : ↥s, Matrix.vecMul (P.recombination s ↑i) (P.matrix ↑i) = P.target

For an accepted coalition, the vectors of recombination combine the rows of the members to the target e₁.

On a coalition that is not accepted, recombination gives every party the zero vector.

def Cslib.Circuits.MonotoneSpanProgram.nullVector {F : Type u_1} [Field F] {N : ℕ} [DecidableEq F] (P : MonotoneSpanProgram F (Fin N)) (s : Finset (Fin N)) :
Fin (P.tailDim + 1) → F

A kernel vector of the matrices of the members of s with first entry one, by elimination. It exists exactly when s is not accepted (nullVector_zero_eq_one_iff); when s is accepted, elimination returns the zero vector (nullVector_eq_zero_of_accepts).

theorem Cslib.Circuits.MonotoneSpanProgram.matrix_mulVec_nullVector {F : Type u_1} [Field F] {N : ℕ} [DecidableEq F] (P : MonotoneSpanProgram F (Fin N)) {s : Finset (Fin N)} {i : Fin N} (hi : i ∈ s) :
(P.matrix i).mulVec (P.nullVector s) = 0

The first entry of nullVector is one exactly on the coalitions that are not accepted.

On an accepted coalition, nullVector is the zero vector.

For a coalition that is not accepted, shearMatrix (P.nullVector s) satisfies the two hypotheses of Lemma 22.15: it is invertible and its top row is e₁.

The program P_L ([BS23], Theorem 22.14(b), p. 981): the matrices of P multiplied on the right by the identity matrix with first column P.nullVector s. For an accepted s the kernel vector is zero, so every matrix of P.normalForm s has first column zero, for members and non-members alike, and the program accepts no coalition (not_accepts_normalForm_of_accepts).

theorem Cslib.Circuits.MonotoneSpanProgram.normalForm_matrix_zero {F : Type u_1} [Field F] {N : ℕ} [DecidableEq F] (P : MonotoneSpanProgram F (Fin N)) {s : Finset (Fin N)} {i : Fin N} (hi : i ∈ s) (row : Fin (P.rowDim i)) :
(P.normalForm s).matrix i row 0 = 0

The zero column of Theorem 22.14(b)(ii), a step toward [BS23], Theorem 22.14 (p. 981), not that theorem: in P.normalForm s, the left-most column of the matrix of every member of s is zero. This holds for every s. Theorem 22.14(b) also says that P_L is efficiently computable; the only bound is Cslib.Circuits.Synthesis.full_normalForm, one field-gate circuit for each shape of program (#5293).

theorem Cslib.Circuits.MonotoneSpanProgram.normalForm_matrix_succ {F : Type u_1} [Field F] {N : ℕ} [DecidableEq F] (P : MonotoneSpanProgram F (Fin N)) (s : Finset (Fin N)) (i : Fin N) (row : Fin (P.rowDim i)) (c : Fin P.tailDim) :
(P.normalForm s).matrix i row c.succ = P.matrix i row c.succ

The other columns are those of P.

theorem Cslib.Circuits.MonotoneSpanProgram.accepts_normalForm {F : Type u_1} [Field F] {N : ℕ} [DecidableEq F] (P : MonotoneSpanProgram F (Fin N)) {s : Finset (Fin N)} (hs : ¬P.Accepts s) (t : Finset (Fin N)) :

For a coalition s that is not accepted, P.normalForm s accepts the same coalitions as P.

For an accepted coalition s, every matrix of P.normalForm s has first column zero, so the program accepts no coalition.