AFTD Auto-Formalizing Theoretical Domains

Cslib.Crypto.Protocols.SecretSharing.Shamir.schemeWith

defimported Lean

Shamir's scheme built from a privacy-compatible tail sampler.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
variable {F Party : Type*} [Field F] [Fintype Party] in
noncomputable def Cslib.Crypto.Protocols.SecretSharing.Shamir.schemeWith (params : Params F Party) (sampler : TailSampler params)
    :
    SecretSharing.Scheme F (Randomness params) Party F
Defined in
CSLib, `Cslib.Crypto.Protocols.SecretSharing.Shamir.schemeWith`
Lean proof
By Samuel Schlesinger, from github.com/leanprover/cslib at 3951377e5a3f (Copyright (c) 2026 Samuel Schlesinger. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.
Verified
08 Oct 2026
Axioms
none listed
Built on 16
Used by 4

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
variable {F Party : Type*} [Field F] [Fintype Party] in
/-- Shamir's scheme built from a privacy-compatible tail sampler. -/
noncomputable def Cslib.Crypto.Protocols.SecretSharing.Shamir.schemeWith (params : Params F Party) (sampler : TailSampler params)
    :
    SecretSharing.Scheme F (Randomness params) Party F :=
  { gen := sampler.gen
    share := share params
    reconstruct := reconstruct params
    authorized := authorized params
    authorized_mono := by
      intro s u hsu hs
      exact le_trans hs (Finset.card_le_card hsu)
    correct := by
      intro coeffs secretValue s hs
      have hdeg₀ :
          (Polynomial.sharingPolynomial secretValue
              (Polynomial.tailPolynomial params.threshold coeffs)).degree <
            (params.threshold + 1 : WithBot ℕ) :=
        Polynomial.degree_sharingPolynomial_tailPolynomial_lt_succ
          secretValue params.threshold coeffs
      have hdeg :
          (Polynomial.sharingPolynomial secretValue
              (Polynomial.tailPolynomial params.threshold coeffs)).degree <
            Fintype.card s := by
        simp [(lt_of_lt_of_le hdeg₀ (by exact_mod_cast hs) :
          (Polynomial.sharingPolynomial secretValue
            (Polynomial.tailPolynomial params.threshold coeffs)).degree <
              s.card)]
      have hx : Function.Injective (fun i : s => params.point i) := by
        intro i j hij
        exact Subtype.ext (params.point_injective hij)
      simpa [share, reconstruct] using
        Polynomial.reconstruct_sharingPolynomial_eq_secret
          (x := fun i : s => params.point i)
          (secretValue := secretValue)
          (tail := Polynomial.tailPolynomial params.threshold coeffs)
          hx
          hdeg
    view_indist := view_indist_of_tailSampler params sampler }
See it in the graphDiscuss this resultChallenge it