Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Section 2 — reconstruction from any authorized coalition

Proved
Shamir1979.reconstruction

by Victorized · Oct 29, 2026 · Mathlib c5ea003 (Lean v4.30.0)

cryptographyfinite-fieldssecret-sharing

Let ppp be prime and 1≤k≤n<p1\le k\le n<p1≤k≤n<p. Participants have the distinct public identifiers 1,…,n1,\ldots,n1,…,n in Fp\mathbb F_pFp​. For every secret, every coefficient vector, and every set Γ\GammaΓ of at least kkk participants, the explicitly defined Lagrange-at-zero reconstruction formula returns the secret from their jointly observed shares. The formula uses all the supplied locations, so the statement covers coalitions larger than kkk as well as those of size exactly kkk.

Preamble
import Definitions.Def_Shamir1979_Model

open scoped BigOperators
universe u
Formal statement
namespace Shamir1979

theorem reconstruction (p n k : Nat) [Fact (Nat.Prime p)]
    (hk : 0 < k) (hkn : k ≤ n) (hnp : n < p)
    (secret : ZMod p) (coins : Coins p k) (Γ : Finset (Fin n)) (hΓ : k ≤ Γ.card) :
    recover Γ (observe Γ secret coins) = secret := by sorry

end Shamir1979
Source
Adi Shamir, How to Share a Secret, Communications of the ACM 22(11), 612–613 (1979), https://doi.org/10.1145/359168.359176, §2, p. 613, reconstruction paragraph
Read-back

What the Lean code literally says, in plain math · OpenAI Codex (inherited session model)

For every prime natural number ppp, natural numbers n,kn,kn,k satisfying 0<k0<k0<k, k≤nk\le nk≤n, and n<pn<pn<p, every secret s∈Fp=Z/pZs\in\mathbb F_p=\mathbb Z/p\mathbb Zs∈Fp​=Z/pZ, every coefficient tuple a=(a1,…,ak−1)∈Fpk−1a=(a_1,\ldots,a_{k-1})\in\mathbb F_p^{k-1}a=(a1​,…,ak−1​)∈Fpk−1​, and every subset Γ⊆In={0,…,n−1}\Gamma\subseteq I_n=\{0,\ldots,n-1\}Γ⊆In​={0,…,n−1} with k≤∣Γ∣k\le|\Gamma|k≤∣Γ∣, set f(X)=s+∑r=1k−1arXrf(X)=s+\sum_{r=1}^{k-1}a_rX^rf(X)=s+∑r=1k−1​ar​Xr and xi=i+1(modp)x_i=i+1\pmod pxi​=i+1(modp) for i∈Ini\in I_ni∈In​. The complete observed tuple on Γ\GammaΓ is (f(xi))i∈Γ(f(x_i))_{i\in\Gamma}(f(xi​))i∈Γ​. Applying the recovery function to this tuple gives exactly sss; explicitly, ∑i∈Γf(xi)∏j∈Γ, j≠i−xjxi−xj=s\sum_{i\in\Gamma}f(x_i)\prod_{j\in\Gamma,\,j\ne i}\frac{-x_j}{x_i-x_j}=s∑i∈Γ​f(xi​)∏j∈Γ,j=i​xi​−xj​−xj​​=s in Fp\mathbb F_pFp​. In the recovery definition, the factor indexed by j=ij=ij=i is 111, so it contributes no division. The inequality n<pn<pn<p makes all the xix_ixi​ distinct and nonzero, hence every displayed denominator with j≠ij\ne ij=i is nonzero. The formula uses every member of Γ\GammaΓ, including when ∣Γ∣>k|\Gamma|>k∣Γ∣>k. These hypotheses exclude k=0k=0k=0, n=0n=0n=0, and empty Γ\GammaΓ; they include k=nk=nk=n and k=1k=1k=1. For k=1k=1k=1 the coefficient tuple and polynomial sum are empty and every observed value is the constant sss; the all-zero secret and coefficients are also allowed.

Human review
  • Endorsed by Shuze Chen · Oct 29, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Victorized · Oct 29, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me