Documentation

CslibFrontier.Computability.Communication.Protocol.Alternating

Alternating bit protocols #

Every bit protocol can be made alternating by inserting constant messages when the next real speaker is out of turn. The first player can be specified, and the depth increases by at most a factor of two. Both branches of each inserted node are the same continuation, so the construction also alternates on unreachable branches. This structural guarantee supports simulations whose source-density invariant depends on the next speaker.

def Cslib.Communication.Protocol.Alternates {X : Type u_1} {Y : Type u_2} {Z : Type u_3} :
Bool → Protocol X Y Z → Prop

Every internal node has the prescribed speaker and its children have the opposite speaker. true means Alice's turn; false means Bob's turn. Leaves satisfy either turn.

def Cslib.Communication.Protocol.alternate {X : Type u_1} {Y : Type u_2} {Z : Type u_3} :
Protocol X Y Z → Bool → Protocol X Y Z

Insert constant messages so the protocol alternates from the requested first speaker. true starts with Alice and false starts with Bob.

@[simp]
theorem Cslib.Communication.Protocol.run_alternate {X : Type u_1} {Y : Type u_2} {Z : Type u_3} (p : Protocol X Y Z) (turn : Bool) (x : X) (y : Y) :
(p.alternate turn).run x y = p.run x y

Inserting dummy messages preserves every output.

theorem Cslib.Communication.Protocol.alternates_alternate {X : Type u_1} {Y : Type u_2} {Z : Type u_3} (p : Protocol X Y Z) (turn : Bool) :
Alternates turn (p.alternate turn)

The normalized protocol alternates even along unreachable branches.

theorem Cslib.Communication.Protocol.depth_alternate_le {X : Type u_1} {Y : Type u_2} {Z : Type u_3} (p : Protocol X Y Z) (turn : Bool) :
(p.alternate turn).depth ≤ 2 * p.depth

At most one dummy message is inserted per original message.