Shared leaf-guarded signing handler combinators #
Common PMF-level state-handler infrastructure shared by the two security reduction hops of
TreeSignature.scheme:
CslibFrontier.Crypto.Computational.TreeSignature.IdealToLazy(replacing random-function coins with lazy node keys and edge signatures).CslibFrontier.Crypto.Computational.TreeSignature.LazyToIndexed(coupling lazy node keys with a pre-sampled planted-key table).
Keeping these leaf-guarded handler combinators in a dedicated topic module isolates PMF.Coupling
and its support machinery from Reduction and ForgerEfficiency.
Main definitions #
Cslib.Crypto.TreeSignature.TreeBody: leaf-signing body type parameterized by a cache stateσ.Cslib.Crypto.TreeSignature.guardedTreeHandler: leaf-collision-guarded wrapper around aTreeBodyoperating onTreeState σ.Cslib.Crypto.TreeSignature.lazySignBody:PMF-level body oflazySignHandler.
Main results #
Cslib.Crypto.TreeSignature.guardedTreeHandler_bind_comm: lift aPMF.HiddenCouplingacrossguardedTreeHandler.Cslib.Crypto.TreeSignature.guardedTreeHandler_map: lift aPMF.RepInvacrossguardedTreeHandler.Cslib.Crypto.TreeSignature.guardedTreeHandler_support_inv: invariant preservation forguardedTreeHandler.Cslib.Crypto.TreeSignature.eval_lazySignHandler_eq: semantic equality betweenlazySignHandlerandguardedTreeHandleronlazySignBody.
@[reducible, inline]
Inner leaf-signing body parameterized by the cache state σ.
theorem Cslib.Crypto.TreeSignature.guardedTreeHandler_bind_comm {σ₁ σ₂ γ : Type} (depth : ℕ → ℕ) (n : ℕ) {body₁ : TreeBody σ₁} {body₂ : γ → TreeBody σ₂} (exp : σ₁ → PMF γ) (rep : σ₁ → σ₂) (inv : TreeState σ₁ → Prop) (req : Unit × List Bool) (inner : σ₁) (queried seen : List (List Bool)) (bad : Bool) (hinv_pure :
∀ (b' : Bool), inv { inner := inner, log := { queried := req.2 :: queried, seenLeaves := seen, bad := b' } }) (hgood :
req.2.length = n →
bad = false →
∀ leaf ∈ (BitString.uniformList (depth n)).support,
seen.contains leaf = false →
Probability.PMF.HiddenCoupling (body₁ leaf req.2 inner) (exp inner) (fun (x : List Bool × σ₁) => exp x.2)
(fun (x : List Bool × σ₁) => (x.1, rep x.2)) (fun (k : γ) => body₂ k leaf req.2 (rep inner))
fun (x : List Bool × σ₁) =>
inv { inner := x.2, log := { queried := req.2 :: queried, seenLeaves := leaf :: seen, bad := false } }) :
Probability.PMF.HiddenCoupling
(guardedTreeHandler depth n body₁ req
{ inner := inner, log := { queried := queried, seenLeaves := seen, bad := bad } })
(exp inner)
(fun (x : List Bool × TreeState σ₁) =>
match x with
| (fst, s') => exp s'.inner)
(fun (x : List Bool × TreeState σ₁) =>
match x with
| (a, { inner := inner', log := log }) => (a, { inner := rep inner', log := log }))
(fun (k : γ) =>
guardedTreeHandler depth n (body₂ k) req
{ inner := rep inner, log := { queried := queried, seenLeaves := seen, bad := bad } })
fun (x : List Bool × TreeState σ₁) => inv x.2
Lift a PMF.HiddenCoupling of two leaf-signing bodies through guardedTreeHandler.
theorem Cslib.Crypto.TreeSignature.guardedTreeHandler_map {σ₁ σ₂ : Type} (depth : ℕ → ℕ) (n : ℕ) {body₁ : TreeBody σ₁} {body₂ : TreeBody σ₂} (rep : σ₁ → σ₂) (inv : TreeState σ₁ → Prop) (req : Unit × List Bool) (inner : σ₁) (queried seen : List (List Bool)) (bad : Bool) (hinv_pure :
∀ (b' : Bool), inv { inner := inner, log := { queried := req.2 :: queried, seenLeaves := seen, bad := b' } }) (hgood :
req.2.length = n →
bad = false →
∀ leaf ∈ (BitString.uniformList (depth n)).support,
seen.contains leaf = false →
Probability.PMF.RepInv (body₁ leaf req.2 inner) (body₂ leaf req.2 (rep inner))
(fun (x : List Bool × σ₁) =>
match x with
| (sig, inner') => (sig, rep inner'))
fun (x : List Bool × σ₁) =>
inv { inner := x.2, log := { queried := req.2 :: queried, seenLeaves := leaf :: seen, bad := false } }) :
Probability.PMF.RepInv
(guardedTreeHandler depth n body₁ req
{ inner := inner, log := { queried := queried, seenLeaves := seen, bad := bad } })
(guardedTreeHandler depth n body₂ req
{ inner := rep inner, log := { queried := queried, seenLeaves := seen, bad := bad } })
(fun (x : List Bool × TreeState σ₁) =>
match x with
| (ans, { inner := inner', log := log }) => (ans, { inner := rep inner', log := log }))
fun (x : List Bool × TreeState σ₁) => inv x.2
Lift a PMF.RepInv simulation of two leaf-signing bodies through guardedTreeHandler.
theorem Cslib.Crypto.TreeSignature.guardedTreeHandler_support_inv {σ : Type} (depth : ℕ → ℕ) (n : ℕ) (body : TreeBody σ) (inv : TreeState σ → Prop) (req : Unit × List Bool) (inner : σ) (queried seen : List (List Bool)) (bad : Bool) (hinv_pure :
∀ (b' : Bool), inv { inner := inner, log := { queried := req.2 :: queried, seenLeaves := seen, bad := b' } }) (hgood :
req.2.length = n →
bad = false →
∀ leaf ∈ (BitString.uniformList (depth n)).support,
seen.contains leaf = false →
∀ (sig : List Bool) (inner' : σ),
(sig, inner') ∈ (body leaf req.2 inner).support →
inv { inner := inner', log := { queried := req.2 :: queried, seenLeaves := leaf :: seen, bad := false } }) (ans : List Bool) (s' : TreeState σ) :
Lift support invariant preservation from a leaf-signing body to guardedTreeHandler.
theorem Cslib.Crypto.TreeSignature.eval_lazySignHandler_eq (S : IndexedSignatureScheme) (depth : ℕ → ℕ) (n : ℕ) (root : List Bool × List Bool) (req : Unit × List Bool) (s : LazyTreeState) :
(lazySignHandler S depth n root req s).eval = guardedTreeHandler depth n (lazySignBody S depth n root) req s
ProbComp.eval transforms lazySignHandler into guardedTreeHandler over lazySignBody.