Search LWE with exact-secret recovery
DefinitionCityLWE_SearchExperimentSample a uniform matrix, a single uniform secret, and independent errors from a specified modular law. Run a valid uniform probabilistic polynomial-time machine on the security parameter and the public transcript. Recovery requires its output string to equal the canonical encoding of the secret. Search hardness requires negligible recovery probability for every such machine and every unary polynomial-time sample schedule. The final predicate gives the existential prime-modulus discrete-Gaussian parameter regime from Cryptology City, with eventual noise inequalities. A City width of is converted to the platform scale .
import Definitions.Def_PPSLattice_LWEHard
set_option autoImplicit false
open scoped BigOperators
open QAlgorithms.Complexity PPSLattice
namespace CityLWE
abbrev Vec (q d : ℕ) := Fin d → ZMod q
abbrev Mat (q n m : ℕ) := Matrix (Fin n) (Fin m) (ZMod q)
abbrev Transcript (q n m : ℕ) := Mat q n m × Vec q m
def rhs {q n m : ℕ} (A : Mat q n m) (s : Vec q n) (e : Vec q m) : Vec q m :=
fun j => (∑ i, s i * A i j) + e j
noncomputable def joint (q n m : ℕ) (χ : PMF (ZMod q)) :
PMF (Vec q n × Transcript q n m) :=
(uniformMat q n m).bind fun A =>
(iidVec (uniformZq q) n).bind fun s =>
(iidVec χ m).map fun e => (s, A, rhs A s e)
noncomputable def searchProb (q n m param : ℕ) (χ : PMF (ZMod q))
(S : RestrictedDec.Adversary) : ℝ :=
(((joint q n m χ).bind fun witness =>
let s := witness.1
let view := witness.2
let input := BeyondDS.tup [encMat q view.1, encVec q view.2]
(S.activate param [] input).map fun out =>
decide (out.2 = encVec q s)) true).toReal
def SearchHard (dim modulus : ℕ → ℕ) (error : (t : ℕ) → PMF (ZMod (modulus t))) : Prop :=
∀ m : ℕ → ℕ, PolyTimeOn (fun t : ℕ => encNat t) (fun t => encNat (m t)) →
∀ S : RestrictedDec.Adversary, S.Valid →
NoisyOWMPC.Negligible fun t =>
searchProb (modulus t) (dim t) (m t) t (error t) S
noncomputable def cityGaussian (q : ℕ) (w : ℝ) : PMF (ZMod q) :=
dGaussZq q (w / Real.sqrt (2 * Real.pi))
def PrimeGaussianSearchLWE : Prop :=
∃ (dim modulus : ℕ → ℕ) (α : ℕ → ℝ) (c : ℝ),
0 < c ∧
PolyTimeOn (fun t : ℕ => encNat t) (fun t => encNat (dim t)) ∧
PolyTimeOn (fun t : ℕ => encNat t) (fun t => encNat (modulus t)) ∧
(∀ t, (modulus t).Prime) ∧
(∃ C k : ℕ, ∀ t, modulus t ≤ C * (dim t + 1) ^ k) ∧
(∃ N : ℕ, ∀ t ≥ N, 0 < dim t ∧
2 * Real.sqrt (dim t : ℝ) ≤ α t * (modulus t : ℝ) ∧
α t ≤ (dim t : ℝ) ^ (-c)) ∧
SearchHard dim modulus (fun t => cityGaussian (modulus t) (α t * (modulus t : ℝ)))
end CityLWE
Read-back
What the Lean code literally says, in plain math · GPT-6 (Codex)
For , a length- vector is a function from to , with . A matrix has rows and columns over . A transcript is a pair consisting of such a matrix and a length- vector.
For each matrix , length- vector and length- vector , the right-hand side is the length- vector with in . An empty sum is zero.
For any probability mass function on , the joint law returns . It draws the entries of and independently from the uniform law on for and from the point mass at zero for . Independently it draws the errors from the product law and forms the right-hand side above. A vector of length zero has a single possible value.
For these , any parameter and any adversary, the search probability is the real probability, over that joint law and the activation coins, that the move on equals the entire vector code of the sampled . An adversary consists of a bit-string function and . Validity means that one deterministic polynomial-time machine computes . At parameter , one activation runs on the tuple of , the empty state, the encoded input, and independent fair bits. Its move is the second parsed output field, empty if missing, truncated to bits. The returned state is discarded. The encoded input is the tuple of the row-major matrix code and the label-vector code. Each residue occupies bits least significant first, of width zero for . Tuple encoding doubles each bit of a field and appends to that field. Thus if or , the target string is empty.
For arbitrary dimension and modulus functions and error laws on , search hardness requires that for every unary-polynomial-time and every valid adversary the search probability at with law is negligible in . Write . A unary-polynomial-time function has one deterministic polynomial-time bit-string machine sending to for every . A real function is negligible if for every and, for every real , there exists such that for every .
For and , the specified Gaussian law is the image in of the integer distribution with mass proportional to if , or the point mass at zero if .
The final proposition asserts the existence of functions , , and a real such that and are unary-polynomial-time, is prime for every , there are with for every , and there is with , and for every . It additionally requires search hardness for with the just-defined Gaussian of parameter at each . has no computability hypothesis.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.