Documentation

CslibFrontier.Crypto.Protocols.UC.Linking

Laws of linking and composing interactive machines #

Running a program against a composed machine A.comp P is running it against A and running the result against P (Machine.runFrom_comp). Since A.comp P initializes P first, linking is associative as an equation of programs, without any appeal to probabilities (Machine.link_comp): (A.comp P).link Z = P.link (A.link Z). The forwarding machine is a unit for linking (Machine.link_id). These are the package-algebra laws of state-separating proofs, which turn reductions into a regrouping of the same program.

Call budgets compose: a machine making at most u calls per activation, on top of a machine making at most t, makes at most u * (t + 1) + t (Machine.IsBounded.comp), and a program making at most m calls, linked against a machine making at most t per activation, makes at most t + m * (t + 1) (Machine.isQueryBounded_link).

Main results #

References #

theorem Cslib.Crypto.Protocols.UC.Machine.runFrom_call {ιI ιE : Type} {I : ιI → Type} {E : ιE → Type} (M : Machine I E) (q : ℕ ⊕ ιE) (s : M.State) :

A single call of the combined interface is answered by the machine's handler.

theorem Cslib.Crypto.Protocols.UC.Machine.runFrom_map_state {ιI ιE : Type} {I : ιI → Type} {E : ιE → Type} {α : Type} (M₁ M₂ : Machine I E) (f : M₂.State → M₁.State) (h : ∀ (q : ιE) (s : M₂.State), (M₁.handle q).run (f s) = Prod.map _root_.id f <$> (M₂.handle q).run s) (program : ProbOracleComp E α) (s : M₂.State) :
M₁.runFrom program (f s) = Prod.map _root_.id f <$> M₂.runFrom program s

A state representation f that commutes with every activation commutes with every run.

theorem Cslib.Crypto.Protocols.UC.Machine.comp_handle_map_state {ιI ιJ ιE : Type} {I : ιI → Type} {J : ιJ → Type} {E : ιE → Type} (A : Machine J E) (P₁ P₂ : Machine I J) (f : P₂.State → P₁.State) (h : ∀ (q : ιJ) (s : P₂.State), (P₁.handle q).run (f s) = Prod.map _root_.id f <$> (P₂.handle q).run s) (q : ιE) (s : A.State × P₂.State) :

Intertwining the inner machines of a composition intertwines the composed machines on the product state.

theorem Cslib.Crypto.Protocols.UC.Machine.runFrom_comp {ιI ιJ ιE : Type} {I : ιI → Type} {J : ιJ → Type} {E : ιE → Type} {α : Type} (A : Machine J E) (P : Machine I J) (program : ProbOracleComp E α) (sA : A.State) (sP : P.State) :
(A.comp P).runFrom program (sA, sP) = ⇑(Equiv.prodAssoc α A.State P.State) <$> P.runFrom (A.runFrom program sA) sP

Running against a composition runs against the outer machine, and runs the result against the inner machine.

theorem Cslib.Crypto.Protocols.UC.Machine.comp_init {ιI ιJ ιE : Type} {I : ιI → Type} {J : ιJ → Type} {E : ιE → Type} (A : Machine J E) (P : Machine I J) :
(A.comp P).init = do let sP ← P.init let sA ← A.init pure (sA, sP)

The composition samples the inner machine's state first.

theorem Cslib.Crypto.Protocols.UC.Machine.sample_comp_init {ιI ιJ ιE : Type} {I : ιI → Type} {J : ιJ → Type} {E : ιE → Type} {ιK : Type} {K : ιK → Type} (A : Machine J E) (P : Machine I J) :

Sampling the composition's initial state inside a program samples the inner machine's state, then the outer one's.

theorem Cslib.Crypto.Protocols.UC.Machine.run_comp {ιJ ιE : Type} {J : ιJ → Type} {E : ιE → Type} {α : Type} (A : Machine J E) (P : Machine OracleSpec.empty J) (program : ProbOracleComp E α) :
(A.comp P).run program = P.run (A.link program)

Running a program against a closed composition is running its link against the inner machine.

theorem Cslib.Crypto.Protocols.UC.Machine.runFrom_id {ιE : Type} {E : ιE → Type} {α : Type} (program : ProbOracleComp E α) (s : (id E).State) :
(id E).runFrom program s = (fun (a : α) => (a, s)) <$> program

The forwarding machine passes every call through and never changes its state.

Embedded sampling makes as many calls as the closed program.

theorem Cslib.Crypto.Protocols.UC.Machine.isQueryBounded_runFrom {ιI ιJ : Type} {I : ιI → Type} {J : ιJ → Type} {α : Type} {P : Machine I J} {t m : ℕ} (hP : P.IsBounded t) {program : ProbOracleComp J α} (h : OracleComp.IsQueryBounded program m) (s : P.State) :
OracleComp.IsQueryBounded (P.runFrom program s) (m * (t + 1))

A program with at most m calls, run against a machine with at most t calls per activation, makes at most m * (t + 1) calls.

theorem Cslib.Crypto.Protocols.UC.Machine.IsBounded.comp {ιI ιJ ιE : Type} {I : ιI → Type} {J : ιJ → Type} {E : ιE → Type} {A : Machine J E} {P : Machine I J} {u t : ℕ} (hA : A.IsBounded u) (hP : P.IsBounded t) :
(A.comp P).IsBounded (u * (t + 1) + t)

A machine with at most u calls per activation on top of a machine with at most t makes at most u * (t + 1) + t calls per activation.

Lifting right-port programs and machines over an arbitrary left port #

def Cslib.Crypto.Protocols.UC.Machine.liftRightProgram {α ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} (program : ProbOracleComp R α) :

Lift a program on R to a program on L ⊕ₒ R, preserving private samples.

@[simp]
theorem Cslib.Crypto.Protocols.UC.Machine.liftRightProgram_pure {α ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} (a : α) :
@[simp]
theorem Cslib.Crypto.Protocols.UC.Machine.liftRightProgram_bind {α ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} {β : Type} (program : ProbOracleComp R α) (next : α → ProbOracleComp R β) :
liftRightProgram L (program >>= next) = do let a ← liftRightProgram L program liftRightProgram L (next a)
@[simp]
theorem Cslib.Crypto.Protocols.UC.Machine.liftRightProgram_map {α ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} {β : Type} (f : α → β) (program : ProbOracleComp R α) :
liftRightProgram L (f <$> program) = f <$> liftRightProgram L program
@[simp]

A right-port query becomes a query on the right branch of L ⊕ₒ R.

@[simp]
theorem Cslib.Crypto.Protocols.UC.Machine.liftRightProgram_sample {α ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} (program : ProbComp α) :

Private samples are unchanged by lifting.

theorem Cslib.Crypto.Protocols.UC.Machine.isQueryBounded_liftRightProgram {α ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} {program : ProbOracleComp R α} {m : ℕ} (h : OracleComp.IsQueryBounded program m) :

Lifting past L preserves the call budget of a program.

def Cslib.Crypto.Protocols.UC.Machine.liftRight {ιE : Type} {E : ιE → Type} {ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} (M : Machine R E) :

Lift a machine M from R → E to L ⊕ₒ R → L ⊕ₒ E, forwarding left-port queries unchanged and running right-port activations through liftRightProgram.

theorem Cslib.Crypto.Protocols.UC.Machine.runFrom_liftRight_liftRightProgram {α ιL ιR₁ ιR₂ : Type} (L : ιL → Type) {R₁ : ιR₁ → Type} {R₂ : ιR₂ → Type} (S : Machine R₂ R₁) (program : ProbOracleComp R₁ α) (s : S.State) :
(liftRight L S).runFrom (liftRightProgram L program) s = liftRightProgram L (S.runFrom program s)

Running a lifted program against a lifted machine equals lifting the run against the inner machine.

@[simp]
theorem Cslib.Crypto.Protocols.UC.Machine.liftRight_id {ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} :

Lifting the forwarding machine yields the forwarding machine on the combined interface.

theorem Cslib.Crypto.Protocols.UC.Machine.liftRight_comp {ιE : Type} {E : ιE → Type} {ιL ιR₁ ιR₂ : Type} (L : ιL → Type) {R₁ : ιR₁ → Type} {R₂ : ιR₂ → Type} (A : Machine R₁ E) (S : Machine R₂ R₁) :
liftRight L (A.comp S) = (liftRight L A).comp (liftRight L S)

Lifting a composition is composing the lifted machines.

theorem Cslib.Crypto.Protocols.UC.Machine.isBounded_liftRight {ιE : Type} {E : ιE → Type} {ιL ιR : Type} (L : ιL → Type) {R : ιR → Type} {M : Machine R E} {t : ℕ} (h : M.IsBounded t) :
(liftRight L M).IsBounded (t + 1)

Lifting a machine with per-activation call budget t yields budget t + 1: left-port queries forward with one call.