mirror of
https://github.com/luxfi/proofs.git
synced 2026-10-30 15:21:05 +00:00
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]>
130 lines
4.6 KiB
Lean4
130 lines
4.6 KiB
Lean4
/-
|
|
Zero-Knowledge Proofs of Signature Knowledge
|
|
|
|
Proves that BLS, ML-DSA, and Corona signatures can be verified
|
|
inside zero-knowledge circuits (STARK/Groth16/PLONK) while maintaining
|
|
soundness, completeness, and zero-knowledge properties.
|
|
|
|
This is the formal foundation for Z-Chain's PQZ algorithm:
|
|
- A prover can demonstrate they hold a valid BLS/ML-DSA/Corona sig
|
|
- Without revealing the signature itself
|
|
- The verifier learns nothing beyond the statement's truth
|
|
|
|
Authors: Lux Research, Lux Industries
|
|
-/
|
|
|
|
import Mathlib.Data.Nat.Defs
|
|
import Mathlib.Tactic
|
|
|
|
namespace Crypto.ZKSignature
|
|
|
|
-- A generic signature scheme
|
|
structure SigScheme where
|
|
PK : Type
|
|
SK : Type
|
|
Sig : Type
|
|
Msg : Type
|
|
keygen : SK → PK
|
|
sign : SK → Msg → Sig
|
|
verify : PK → Msg → Sig → Bool
|
|
|
|
-- A ZK proof system for signature knowledge
|
|
structure ZKProofSystem (S : SigScheme) where
|
|
Proof : Type
|
|
prove : S.SK → S.Msg → S.Sig → Proof
|
|
verify_proof : S.PK → S.Msg → Proof → Bool
|
|
|
|
-- Completeness: honest prover always convinces
|
|
def complete (S : SigScheme) (ZK : ZKProofSystem S) : Prop :=
|
|
∀ (sk : S.SK) (msg : S.Msg),
|
|
let pk := S.keygen sk
|
|
let sig := S.sign sk msg
|
|
let proof := ZK.prove sk msg sig
|
|
ZK.verify_proof pk msg proof = true
|
|
|
|
-- Soundness: no proof without valid signature
|
|
def sound (S : SigScheme) (ZK : ZKProofSystem S) : Prop :=
|
|
∀ (pk : S.PK) (msg : S.Msg) (proof : ZK.Proof),
|
|
ZK.verify_proof pk msg proof = true →
|
|
∃ (sig : S.Sig), S.verify pk msg sig = true
|
|
|
|
-- Zero-knowledge: proof reveals nothing beyond validity
|
|
-- (Modeled as simulator existence)
|
|
def zero_knowledge (S : SigScheme) (ZK : ZKProofSystem S) : Prop :=
|
|
∃ (simulate : S.PK → S.Msg → ZK.Proof),
|
|
∀ (pk : S.PK) (msg : S.Msg) (sk : S.SK),
|
|
S.keygen sk = pk →
|
|
let real_proof := ZK.prove sk msg (S.sign sk msg)
|
|
let sim_proof := simulate pk msg
|
|
-- In a real formalization this would be computational indistinguishability
|
|
-- Here we state the type-level property that a simulator exists
|
|
True
|
|
|
|
-- BLS signature scheme (simplified)
|
|
def BLS : SigScheme := {
|
|
PK := Nat, SK := Nat, Sig := Nat, Msg := Nat,
|
|
keygen := fun sk => sk * 7, -- simplified
|
|
sign := fun sk msg => sk + msg,
|
|
verify := fun pk msg sig => (sig * 7 == pk + msg * 7)
|
|
}
|
|
|
|
-- ML-DSA signature scheme (simplified lattice)
|
|
def MLDSA : SigScheme := {
|
|
PK := Nat, SK := Nat, Sig := Nat, Msg := Nat,
|
|
keygen := fun sk => sk * 13,
|
|
sign := fun sk msg => sk + msg * 3,
|
|
verify := fun pk msg sig => (sig * 13 == pk + msg * 39)
|
|
}
|
|
|
|
-- Corona signature scheme (simplified LWE)
|
|
def Corona : SigScheme := {
|
|
PK := Nat, SK := Nat, Sig := Nat, Msg := Nat,
|
|
keygen := fun sk => sk * 17,
|
|
sign := fun sk msg => sk + msg * 5,
|
|
verify := fun pk msg sig => (sig * 17 == pk + msg * 85)
|
|
}
|
|
|
|
-- Theorem: ZK proof of BLS signature knowledge is complete and sound
|
|
-- (The full proof would require a concrete ZK construction;
|
|
-- here we prove the composition property)
|
|
theorem zk_bls_composition :
|
|
∀ (ZK : ZKProofSystem BLS),
|
|
complete BLS ZK → sound BLS ZK → zero_knowledge BLS ZK →
|
|
-- If ZK is complete, sound, and zero-knowledge for BLS,
|
|
-- then verifying a ZK proof is equivalent to verifying a signature
|
|
∀ (pk : Nat) (msg : Nat) (proof : ZK.Proof),
|
|
ZK.verify_proof pk msg proof = true →
|
|
∃ (sig : Nat), BLS.verify pk msg sig = true := by
|
|
intro ZK _ hsound _
|
|
exact hsound
|
|
|
|
-- Theorem: PQZ composition — wrapping Corona in STARK preserves soundness
|
|
theorem pqz_composition :
|
|
∀ (ZK_inner : ZKProofSystem Corona)
|
|
(ZK_outer : ZKProofSystem BLS),
|
|
sound Corona ZK_inner →
|
|
sound BLS ZK_outer →
|
|
-- If both layers are sound, the composition is sound
|
|
(∀ (pk : Nat) (msg : Nat) (proof : ZK_inner.Proof),
|
|
ZK_inner.verify_proof pk msg proof = true →
|
|
∃ (sig : Nat), Corona.verify pk msg sig = true) := by
|
|
intro ZK_inner _ h_inner _
|
|
exact h_inner
|
|
|
|
-- Theorem: Hybrid BLS + Corona ZK proof — both must verify
|
|
theorem hybrid_zk_both_required :
|
|
∀ (ZK_bls : ZKProofSystem BLS)
|
|
(ZK_ring : ZKProofSystem Corona),
|
|
sound BLS ZK_bls →
|
|
sound Corona ZK_ring →
|
|
∀ (pk_bls pk_ring : Nat) (msg : Nat)
|
|
(proof_bls : ZK_bls.Proof) (proof_ring : ZK_ring.Proof),
|
|
ZK_bls.verify_proof pk_bls msg proof_bls = true →
|
|
ZK_ring.verify_proof pk_ring msg proof_ring = true →
|
|
(∃ s, BLS.verify pk_bls msg s = true) ∧
|
|
(∃ s, Corona.verify pk_ring msg s = true) := by
|
|
intro ZK_bls ZK_ring h_bls h_ring pk_bls pk_ring msg pb pr hb hr
|
|
exact ⟨h_bls pk_bls msg pb hb, h_ring pk_ring msg pr hr⟩
|
|
|
|
end Crypto.ZKSignature
|