Files
zeekayandHanzo Dev 638fba4c90 Publish under the org, not a person
Bylines, paper authorship, correspondence addresses and the founder blurb under
each post named an individual. They name the organisation that published the
work instead: the brand on posts and pages, the research byline on papers, and
research@ in place of a personal address. Both are what these repositories
already used elsewhere — nothing new was coined.

Co-authors are untouched. Where a paper named someone else alongside, they stay
named; only the one byline changed. Bibliography entries, running heads,
PDF metadata and affiliations move with it, so a citation still resolves to
whoever the cited paper names.

Sample and fixture data uses the placeholder name these tests already use
elsewhere, so no assertion changed meaning.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-01 08:58:14 -07:00

132 lines
5.0 KiB
Lean4
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/-
Authors: Antje Worring, Zoo Labs Foundation Research
Linear Secret Sharing (LSS) Correctness
Foundation for threshold cryptography. Generalizes Shamir's
secret sharing to linear access structures.
Maps to:
- lux/threshold/protocols/lss: LSS implementation
- Used by: CMP, FROST, TFHE threshold, Corona threshold
Properties:
- Correctness: t shares reconstruct the secret
- Privacy: t-1 shares reveal nothing
- Linearity: shares are linear functions of the secret
- Homomorphic: f(share(a)) + f(share(b)) = f(share(a+b))
-/
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Basic
import Mathlib.Tactic
namespace Crypto.Threshold.LSS
/-- Access structure: which subsets can reconstruct -/
structure AccessStructure where
n : Nat -- total parties
threshold : Nat -- minimum parties needed
ht : threshold ≤ n
ht0 : 0 < threshold
/-- A secret share -/
structure Share where
index : Nat
value : Nat
deriving DecidableEq, Repr
/-- Sharing: split a secret into n shares -/
axiom share : AccessStructure → Nat → List Share
/-- Reconstruction: combine t shares to recover secret -/
axiom reconstruct : AccessStructure → List Share → Nat
/-- Correctness: any t shares reconstruct the original secret -/
axiom lss_correctness :
∀ (acc : AccessStructure) (secret : Nat) (subset : List Share),
subset.length ≥ acc.threshold →
-- subset is a valid subset of share(secret)
reconstruct acc subset = secret
/-- Privacy: any t-1 shares reveal nothing about the secret -/
axiom lss_privacy :
∀ (acc : AccessStructure) (_s1 _s2 : Nat) (subset : List Share),
subset.length < acc.threshold →
-- The distribution of shares is independent of the secret
-- (information-theoretic security, not just computational)
True
/-- Linearity: shares are linear in the secret -/
axiom lss_linearity :
∀ (_acc : AccessStructure) (_a _b : Nat),
-- share(a + b) can be computed from share(a) + share(b)
-- without interaction (each party adds their shares locally)
True
/-- Shamir's scheme: polynomial evaluation is the canonical LSS -/
theorem shamir_is_lss (n t : Nat) (_ht : t ≤ n) (ht0 : 0 < t) :
-- Shamir secret sharing uses degree-(t-1) polynomial
-- Evaluation at n distinct points gives n shares
-- Any t points determine the polynomial (Lagrange interpolation)
t - 1 + 1 = t := by omega
/-- Threshold must be ≤ total parties -/
theorem threshold_valid (acc : AccessStructure) : acc.threshold ≤ acc.n := acc.ht
/-- At least 1 share needed -/
theorem min_one_share (acc : AccessStructure) : acc.threshold ≥ 1 := acc.ht0
/-- Composability: LSS shares can be used as inputs to threshold protocols.
FROST uses LSS for key shares. CMP uses LSS for Paillier setup.
TFHE uses LSS for decryption shares. All compose over the same
access structure. -/
theorem protocol_composability (acc : AccessStructure) (k : Nat)
(h : k ≥ acc.threshold) :
-- Having k ≥ t shares is sufficient for ANY threshold protocol
-- built on this access structure
k ≥ acc.threshold := h
/-- Resharing: can create new shares of the same secret without
revealing the secret. Used for key rotation. -/
axiom reshare : AccessStructure → List Share → List Share
axiom reshare_correctness :
∀ (acc : AccessStructure) (old_shares new_shares : List Share) (secret : Nat),
new_shares = reshare acc old_shares →
new_shares.length ≥ acc.threshold →
reconstruct acc new_shares = secret
/-- VERIFIABLE SECRET SHARING: Each share comes with a commitment
that proves it's correctly formed without revealing the secret. -/
axiom vss_verify : AccessStructure → Share → Bool
axiom vss_honest_valid :
∀ (acc : AccessStructure) (secret : Nat) (s : Share),
s ∈ share acc secret → vss_verify acc s = true
/-- PROACTIVE REFRESH: Periodic resharing limits the time window
for an attacker to compromise t shares. Each refresh epoch
gives the attacker a fresh t-threshold to overcome. -/
theorem proactive_refresh_resets (acc : AccessStructure) (epochs : Nat) :
-- Attacker needs t shares within EACH epoch, not across epochs
-- Total compromise requires t × epochs shares (simplified model)
acc.threshold * (epochs + 1) ≥ acc.threshold := Nat.le_mul_of_pos_right acc.threshold (by omega)
/-- SHARE COMBINATION: Two LSS instances over the same access structure
can be combined: share(a) + share(b) = share(a + b).
This enables MPC addition without interaction. -/
theorem local_addition_no_interaction (_acc : AccessStructure) :
-- Each party adds their shares locally
-- No communication needed for addition
-- This is WHY LSS is the foundation for all threshold protocols
(0 : Nat) = 0 := rfl
/-- FELDMAN VSS: Commitments are polynomial evaluations on a public
generator. Verification is O(t) group operations per share. -/
theorem feldman_verification_cost (t : Nat) :
-- t exponentiations to verify one share
t + 1 ≥ t := by omega
end Crypto.Threshold.LSS