Documentation

CslibFrontier.Crypto.Protocols.UC.PPT

Strict-PPT certificates for typed UC machine families #

This module defines strict polynomial-time certificates and predicates for typed UC machine families (Machine, Protocol, Adversary, Environment, and IdealFunctionality) in this library's word model, following the typed-object-plus-encoding convention of AdversaryOf.IsPPT and building on WordInterface (CslibFrontier.Crypto.Protocols.UC.WordInterface).

Every definition in this file is a library construction for this word model rather than Definition 6 of [Can20a]. In particular:

  1. PPTParam.replyBound and EnvParam.replyBound are explicit reply-length caps passed to ProbOracleComp.lowerWith (bounding how many bits are read from each lowered imported reply), not the import field of [Can20a], Section 3.2.
  2. PPTCertificate.init certifies (M p.secParam p.corrupted).init under encPPTParam n so it shares a parameter encoding with PPTCertificate.handle; the initialization program itself does not inspect p.replyBound.
  3. PPTCertificate bounds only additive encoded-state growth per activation (growth, growth_poly, preserve) and omits any state-independent reply-length bound: replies may grow with the encoded state, bounded automatically by PPTCertificate.handle's IsOraclePPTOn output-length bound and consumed by IsOraclePPTOn.run_interpret_preprocess_open_of_bounded_growth via PPTCertificate.preserve_wordHandle.
  4. Environment.IsPPT is uniform (no nonuniform advice) and runs in time polynomial in secParam + replyBound + aux.length, admitting environments whose work grows with replyBound and aux.length (unlike Environment.PolyBounded's κ-only call budget).
  5. No implication is claimed between Protocol.IsPPT / Adversary.IsPPT / Environment.IsPPT and the call-budget predicates Protocol.PolyBounded / Adversary.PolyBounded / Environment.PolyBounded.

Main definitions #

Main results #

References #

Activation parameters #

Library construction (no cited definition): activation parameters for a UC machine family in this library's word model. Here replyBound is the prefix length read from each lowered imported oracle reply (not the import field of [Can20a], Section 3.2).

  • secParam : ℕ

    The security parameter.

  • replyBound : ℕ

    Prefix length read from each lowered imported oracle reply.

  • corrupted : Finset (Fin n)

    The set of statically corrupted parties.

theorem Cslib.Crypto.Protocols.UC.encPPTParam_secParam_budget (n : ℕ) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → PPTParam n} :
theorem Cslib.Crypto.Protocols.UC.encPPTParam_mk_inO (n : ℕ) {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 x1 T1 S1 : γ → ℕ} {x2 : γ → Finset (Fin n)} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encUnary T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn (Turing.MultiTapeTM.encFinite (Finset (Fin n))) T2 S2) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { secParam := x0 x, replyBound := x1 x, corrupted := x2 x }) encIn (encPPTParam n) (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
theorem Cslib.Crypto.Protocols.UC.encPPTParam_mk_budget (n : ℕ) {γ : Type} {encIn : γ ↪ List Bool} {budget x0 x1 : γ → ℕ} {x2 : γ → Finset (Fin n)} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encUnary budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn (Turing.MultiTapeTM.encFinite (Finset (Fin n))) budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { secParam := x0 x, replyBound := x1 x, corrupted := x2 x }) encIn (encPPTParam n) budget
@[reducible, inline]

The tuple of the fields of encPPTParam.

Library construction (no cited definition): binary encoding of PPTParam n as framed unary secParam, framed unary replyBound, and encFinite (Finset (Fin n)) corrupted.

theorem Cslib.Crypto.Protocols.UC.encPPTParam_mk_deg (n : ℕ) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : ℕ × ℕ × Finset (Fin n)) => { secParam := p.1, replyBound := p.2.1, corrupted := p.2.2 }) (encPPTParamFields n) (encPPTParam n) 1 1
theorem Cslib.Crypto.Protocols.UC.encPPTParam_mk_polyTime (n : ℕ) {γ : Type} {encIn : γ ↪ List Bool} {x0 x1 : γ → ℕ} {x2 : γ → Finset (Fin n)} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn Turing.MultiTapeTM.encUnary) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn Turing.MultiTapeTM.encUnary) (h2 : Turing.MultiTapeTM.ComputableInPolyTime x2 encIn (Turing.MultiTapeTM.encFinite (Finset (Fin n)))) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { secParam := x0 x, replyBound := x1 x, corrupted := x2 x }) encIn (encPPTParam n)
theorem Cslib.Crypto.Protocols.UC.encPPTParam_corrupted_budget (n : ℕ) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → PPTParam n} :
theorem Cslib.Crypto.Protocols.UC.encPPTParam_replyBound_budget (n : ℕ) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → PPTParam n} :

Library construction (no cited definition): activation parameters for a UC environment in this library's word model. Here replyBound is the prefix length read from each lowered execution query (not the import field of [Can20a], Section 3.2).

  • secParam : ℕ

    The security parameter.

  • replyBound : ℕ

    Prefix length read from each lowered query to the execution interface.

  • aux : List Bool

    Auxiliary input word passed to the environment.

theorem Cslib.Crypto.Protocols.UC.encEnvParam_aux_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → EnvParam} :
theorem Cslib.Crypto.Protocols.UC.encEnvParam_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget x0 x1 : γ → ℕ} {x2 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encUnary budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { secParam := x0 x, replyBound := x1 x, aux := x2 x }) encIn encEnvParam budget
theorem Cslib.Crypto.Protocols.UC.encEnvParam_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 x1 T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encUnary T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { secParam := x0 x, replyBound := x1 x, aux := x2 x }) encIn encEnvParam (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
@[reducible, inline]

The tuple of the fields of encEnvParam.

theorem Cslib.Crypto.Protocols.UC.encEnvParam_secParam_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → EnvParam} :

Library construction (no cited definition): binary encoding of EnvParam as framed unary secParam, framed unary replyBound, and unframed aux (encBits).

theorem Cslib.Crypto.Protocols.UC.encEnvParam_mk_deg :
Turing.MultiTapeTM.ComputableInDegree (fun (p : ℕ × ℕ × List Bool) => { secParam := p.1, replyBound := p.2.1, aux := p.2.2 }) encEnvParamFields encEnvParam 1 1
theorem Cslib.Crypto.Protocols.UC.encEnvParam_replyBound_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → EnvParam} :

State codecs, word activations, and strict-PPT certificates #

Library construction (no cited definition): injective binary presentation of a type α with a total left-inverse decoder. Unlike Turing.MultiTapeTM.Decoder, this omits a standalone ComputableInDegree obligation on decode; instead PPTCertificate.normalize and IdealFunctionality.PPTCertificate.normalize certify the combined word map enc ∘ decode in polynomial time, matching PPTCertificate.handle (and onInput / onBackdoor).

  • enc : α ↪ List Bool

    Injectively encode a value as a bit word.

  • decode : List Bool → α

    Total decoder recovering a value from a bit word.

  • decode_enc (s : α) : self.decode (self.enc s) = s

    Decoding an encoded value recovers it.

@[reducible, inline]
abbrev Cslib.Crypto.Protocols.UC.StateCodec {n : ℕ} {ιI ιE : Type} {I : ιI → Type} {E : ιE → Type} (M : ℕ → Finset (Fin n) → Machine I E) :

Library construction (no cited definition): binary state presentation for a family of UC machines, supplying a WordCodec at every (κ, C).

def Cslib.Crypto.Protocols.UC.wordHandle {n : ℕ} {ιI ιE : Type} {I : ιI → Type} {E : ιE → Type} (M : ℕ → Finset (Fin n) → Machine I E) (iI : WordInterface I) (iE : WordInterface E) (codec : StateCodec M) (p : PPTParam n) (request : iE.Channel × List Bool) (state : List Bool) :

Library construction (no cited definition): one word-level activation of M p.secParam p.corrupted. It decodes the exported request via iE and the state word via codec, runs the lowered activation with imported replies truncated to p.replyBound bits, and re-encodes the typed reply and updated state.

structure Cslib.Crypto.Protocols.UC.PPTCertificate {n : ℕ} {ιI ιE : Type} {I : ιI → Type} {E : ιE → Type} (M : ℕ → Finset (Fin n) → Machine I E) (iI : WordInterface I) (iE : WordInterface E) :

Library construction (no cited definition; not Definition 6 of [Can20a]): a strict-PPT certificate for a UC machine family M in this library's word model.

  • init certifies (M p.secParam p.corrupted).init under encPPTParam n so it shares the parameter encoding with handle; the initialization program ignores p.replyBound.
  • handle certifies wordHandle as a uniform strict oracle-PPT program on encHandlerCall.
  • normalize certifies state-word renormalization enc ∘ decode in polynomial time (analogous to WordInterface.computable_replyNormalize), needed so composite routing/composition branches can preserve untouched components' behavior on off-image state words.
  • growth, growth_poly, and preserve bound additive encoded-state growth per activation by a polynomial in the encoded parameter and request word alone (independent of the current state). No state-independent reply bound is imposed: replies may depend on the current state and are bounded automatically by handle's output-length bound.
theorem Cslib.Crypto.Protocols.UC.PPTCertificate.preserve_wordHandle {n : ℕ} {ιI ιE : Type} {I : ιI → Type} {E : ιE → Type} {M : ℕ → Finset (Fin n) → Machine I E} {iI : WordInterface I} {iE : WordInterface E} (cert : PPTCertificate M iI iE) (p : PPTParam n) (request : iE.Channel × List Bool) (state : List Bool) (hstate : state ∈ Set.range ⇑(cert.codec p.secParam p.corrupted).enc) (result : List Bool × List Bool) (hresult : result ∈ OracleComp.support (wordHandle M iI iE cert.codec p request state)) :
result.2 ∈ Set.range ⇑(cert.codec p.secParam p.corrupted).enc ∧ result.2.length ≤ state.length + cert.growth p request.2

Library infrastructure (no cited result): PPTCertificate.preserve in the exact invariant and additive-growth form consumed by IsOraclePPTOn.run_interpret_preprocess_open_of_bounded_growth.

Strict-PPT predicates for UC machines, protocols, adversaries, and environments #

def Cslib.Crypto.Protocols.UC.Machine.IsPPTFamily {n : ℕ} {ιI ιE : Type} {I : ιI → Type} {E : ιE → Type} (M : ℕ → Finset (Fin n) → Machine I E) (iI : WordInterface I) (iE : WordInterface E) :

Library construction (no cited definition; not Definition 6 of [Can20a]): a UC machine family is strict PPT in this library's word model when it admits a PPTCertificate.

def Cslib.Crypto.Protocols.UC.Protocol.IsPPT {n : ℕ} {In Out NetQ NetR : Type} (π : Protocol n In Out NetQ NetR) (party : WordPort (Fin n × In) (Option Out)) (netPort : WordPort NetQ NetR) :

Library construction (no cited definition; follows the typed-object-plus-encoding convention of AdversaryOf.IsPPT, not Definition 6 of [Can20a]): a UC protocol is strict PPT in this library's word model for party port party and network port netPort when it admits a PPTCertificate over WordInterface.empty and WordInterface.protocol party netPort. No implication to or from Protocol.PolyBounded is claimed.

def Cslib.Crypto.Protocols.UC.Adversary.IsPPT {n : ℕ} {AdvQ AdvR NetQ NetR : Type} (A : Adversary n AdvQ AdvR NetQ NetR) (netPort : WordPort NetQ NetR) (adv : WordPort AdvQ AdvR) :

Library construction (no cited definition; follows the typed-object-plus-encoding convention of AdversaryOf.IsPPT, not Definition 6 of [Can20a]): a UC adversary is strict PPT in this library's word model for imported network port netPort and exported adversary port adv when it admits a PPTCertificate over WordInterface.net netPort and WordInterface.net adv. No implication to or from Adversary.PolyBounded is claimed.

def Cslib.Crypto.Protocols.UC.Environment.IsPPT {n : ℕ} {In Out AdvQ AdvR : Type} (Z : Environment n In Out AdvQ AdvR) (party : WordPort (Fin n × In) (Option Out)) (adv : WordPort AdvQ AdvR) :

Library construction (no cited definition; follows the typed-object-plus-encoding convention of AdversaryOf.IsPPT and aligns docstring style with MPC.Environment.IsPPT, not Definition 6 of [Can20a]): a UC environment is uniform strict oracle PPT for party and adv when one uniform strict oracle-PPT machine reads encEnvParam (unary secParam, unary replyBound, and aux) and simulates the lowered execution program ProbOracleComp.lowerWith (WordInterface.exec party adv) e.replyBound (Z e.secParam e.aux).

Because the clock is polynomial in secParam + replyBound + aux.length, this admits environments whose work grows with replyBound and aux.length (unlike Environment.PolyBounded's κ-only call budget), and it is uniform (no nonuniform advice). No implication to or from Environment.PolyBounded is claimed.

Ideal functionalities #

Library construction (no cited definition): one word-level activation of a closed ideal functionality step step, decoding the request word through port and the state word through codec, running step, and re-encoding the reply and updated state.

structure Cslib.Crypto.Protocols.UC.IdealFunctionality.PPTCertificate {n : ℕ} {In Out BackQ BackR : Type} (F : IdealFunctionality n In Out BackQ BackR) (party : WordPort (Fin n × In) (Option Out)) (back : WordPort BackQ BackR) :

Library construction (no cited definition; not Definition 6 of [Can20a]): a strict-PPT certificate for a UC ideal functionality in this library's word model. Because an ideal functionality makes no imported oracle calls and onInput/onBackdoor do not depend on κ or C, init is certified on (κ, C) while onInput and onBackdoor are certified as closed IsPPTOn programs on (request word, state word) with one additive encoded-state growth bound.

def Cslib.Crypto.Protocols.UC.IdealFunctionality.IsPPT {n : ℕ} {In Out BackQ BackR : Type} (F : IdealFunctionality n In Out BackQ BackR) (party : WordPort (Fin n × In) (Option Out)) (back : WordPort BackQ BackR) :

Library construction (no cited definition; follows the typed-object-plus-encoding convention of AdversaryOf.IsPPT, not Definition 6 of [Can20a]): a UC ideal functionality is strict PPT in this library's word model for party port party and backdoor port back when it admits an IdealFunctionality.PPTCertificate.

Environment-machine composition #

def Cslib.Crypto.Protocols.UC.wordRunFrom {n : ℕ} {ιI : Type} {I : ιI → Type} {In Out AdvQ AdvR : Type} (M : ℕ → Finset (Fin n) → Machine I (execSpec n In Out AdvQ AdvR)) (iI : WordInterface I) (party : WordPort (Fin n × In) (Option Out)) (adv : WordPort AdvQ AdvR) (codec : StateCodec M) (Z : Environment n In Out AdvQ AdvR) (param : EnvParam → PPTParam n) (envParam : EnvParam → EnvParam) (e : EnvParam) (state : List Bool) :

Library construction (no cited definition): state-passing word-level execution of a lowered UC environment Z evaluated at envParam e against wordHandle at param e, starting from an already-encoded machine state state.

def Cslib.Crypto.Protocols.UC.wordRun {n : ℕ} {ιI : Type} {I : ιI → Type} {In Out AdvQ AdvR : Type} (M : ℕ → Finset (Fin n) → Machine I (execSpec n In Out AdvQ AdvR)) (iI : WordInterface I) (party : WordPort (Fin n × In) (Option Out)) (adv : WordPort AdvQ AdvR) (codec : StateCodec M) (Z : Environment n In Out AdvQ AdvR) (param : EnvParam → PPTParam n) (envParam : EnvParam → EnvParam) (e : EnvParam) :

Library construction (no cited definition): word-level execution of a lowered UC environment Z evaluated at envParam e against a machine family M at param e equipped with a StateCodec, sampling the encoded initial state of M (param e).secParam (param e).corrupted and interpreting the lowered environment through wordHandle.

theorem Cslib.Crypto.Protocols.UC.Environment.IsPPT.isOraclePPTOn_run_wordHandle {n : ℕ} {ιI : Type} {I : ιI → Type} {In Out AdvQ AdvR : Type} {party : WordPort (Fin n × In) (Option Out)} {adv : WordPort AdvQ AdvR} {Z : Environment n In Out AdvQ AdvR} (hZ : Z.IsPPT party adv) {iI : WordInterface I} {M : ℕ → Finset (Fin n) → Machine I (execSpec n In Out AdvQ AdvR)} (cert : PPTCertificate M iI (WordInterface.exec party adv)) {param : EnvParam → PPTParam n} {envParam : EnvParam → EnvParam} (hparam : Turing.MultiTapeTM.ComputableInPolyTime param encEnvParam (encPPTParam n)) (henv : Turing.MultiTapeTM.ComputableInPolyTime envParam encEnvParam encEnvParam) :

Library infrastructure (no cited result): running a strict-PPT environment at envParam e against any machine family equipped with a PPTCertificate at param e via wordRun (sampling the initial encoded state via cert.init and interpreting lowered queries via cert.handle with polynomially bounded additive state growth cert.preserve_wordHandle) yields a uniform strict oracle-PPT program over iI.Channel.

Baseline certificates #

Library construction (no cited definition): canonical WordCodec for PUnit states, encoding PUnit.unit as [].

theorem Cslib.Crypto.Protocols.UC.Machine.isPPTFamily_id {n : ℕ} {ι : Type} {E : ι → Type} (I : WordInterface E) :
IsPPTFamily (fun (x : ℕ) (x_1 : Finset (Fin n)) => id E) I I

Library infrastructure (no cited result): the stateless forwarding machine Machine.id E has a strict-PPT certificate over any WordInterface E.

theorem Cslib.Crypto.Protocols.UC.Adversary.isPPT_dummyAdversary (n : ℕ) {NetQ NetR : Type} (net : WordPort NetQ NetR) :
(dummyAdversary n NetQ NetR).IsPPT net net

Library infrastructure (no cited result): the dummy adversary forwarding netSpec NetQ NetR has a strict-PPT certificate in this library's word model (toward #6043, not Definition 6 of [Canetti2020]).

theorem Cslib.Crypto.Protocols.UC.IdealFunctionality.IsPPT.toProtocol {n : ℕ} {In Out BackQ BackR : Type} {F : IdealFunctionality n In Out BackQ BackR} {party : WordPort (Fin n × In) (Option Out)} {back : WordPort BackQ BackR} (h : F.IsPPT party back) :
F.toProtocol.IsPPT party back

Library infrastructure (no cited result): a strict-PPT ideal functionality induces a strict-PPT protocol via IdealFunctionality.toProtocol.