Binary communication in the existing π-calculus
DefinitionBinary configuration as a parallel composition#✓fully proved
Embed a binary configuration without changing either process.
def represent (r : Proc × Proc) : Proc := .par r.1 r.2
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
TheoremInjectivity of the binary configuration embedding#✓fully proved
The representation does not identify distinct configurations.
theorem represent_injective : Function.Injective represent
def represent (r : Proc × Proc) : Proc := .par r.1 r.2
CSLibExt/Languages/SessionTypes/Communication.lean:37
Uses 3
InductiveCommunication step of a binary configuration#✓fully proved
Opposite head guards synchronize, in either endpoint orientation.
inductive CommStep : Proc × Proc → Proc × Proc → Prop where
| send (a : Nat) (b : Name) (p q : Proc) :
CommStep (.out (.const a) b p, .inp (.const a) q) (p, subst q b)
| recv (a : Nat) (b : Name) (p q : Proc) :
CommStep (.inp (.const a) p, .out (.const a) b q) (subst p b, q)
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
Uses 3 · Used by 5
TheoremSession communication steps are π-calculus reductions#✓fully proved
Every session communication is a reduction in the unchanged π semantics.
theorem represent_step {r t : Proc × Proc} (h : CommStep r t) :
PiCalculus.Step (represent r) (represent t)
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive CommStep : Proc × Proc → Proc × Proc → Prop where
| send (a : Nat) (b : Name) (p q : Proc) :
CommStep (.out (.const a) b p, .inp (.const a) q) (p, subst q b)
| recv (a : Nat) (b : Name) (p q : Proc) :
CommStep (.inp (.const a) p, .out (.const a) b q) (subst p b, q)
CSLibExt/Languages/SessionTypes/Communication.lean:48
inductive Step : Proc → Proc → Prop
| commSelect {a : Name} {b : Name} {p' q' p q : Proc} :
Select p (.out a b p') → Select q (.inp a q') →
Step (.par p q) (.par p' (subst q' b))
| parL {p p' q : Proc} : Step p p' → Step (.par p q) (.par p' q)
| parR {p p' q : Proc} : Step p p' → Step (.par q p) (.par q p')
| nu {p p' : Proc} : Step p p' → Step (.nu p) (.nu p')
| cong {p p' q q' : Proc} : Cong p p' → Step p' q' → Cong q' q →
Step p q
CSLibExt/Languages/PiCalculus/Basic.lean:172
def represent (r : Proc × Proc) : Proc := .par r.1 r.2
CSLibExt/Languages/SessionTypes/Communication.lean:37
Uses 8 · Used by 1
DefinitionDual session typing of a binary configuration#✓fully proved
Locally linear threads owning opposite roles on every channel. Dual compatibility permits cyclic waits; it does not assert progress.
def BinaryTyped (Γ : Context) (r : Proc × Proc) : Prop :=
HasType 0 Γ r.1 ∧ HasType 0 (dualContext Γ) r.2
abbrev Context := Nat → SessionType
CSLibExt/Languages/SessionTypes/Basic.lean:92
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive HasType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Γ : Context} : (∀ c, Γ c = .end) → HasType n Γ .nil
| out {n a : Nat} {Γ : Context} {b : Name} {s : SessionType} {p : Proc} :
Γ a = .send s → b.ClosedAt n → HasType n (advance Γ a s) p →
HasType n Γ (.out (.const a) b p)
| inp {n a : Nat} {Γ : Context} {s : SessionType} {p : Proc} :
Γ a = .recv s → HasType (n + 1) (advance Γ a s) p →
HasType n Γ (.inp (.const a) p)
CSLibExt/Languages/SessionTypes/Basic.lean:111
def dualContext (Γ : Context) : Context := fun c => (Γ c).dual
CSLibExt/Languages/SessionTypes/Basic.lean:99
Uses 4 · Used by 5
TheoremCommunication preserves binary session typing#✓fully proved
Communication consumes dual heads and preserves linear residual typing; payload substitution never changes the session context.
theorem CommStep.preservation {Γ : Context} {r t : Proc × Proc}
(h : CommStep r t) (hr : BinaryTyped Γ r) :
∃ a s, (Γ a = .send s ∨ Γ a = .recv s) ∧
BinaryTyped (advance Γ a s) t
abbrev Context := Nat → SessionType
CSLibExt/Languages/SessionTypes/Basic.lean:92
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive CommStep : Proc × Proc → Proc × Proc → Prop where
| send (a : Nat) (b : Name) (p q : Proc) :
CommStep (.out (.const a) b p, .inp (.const a) q) (p, subst q b)
| recv (a : Nat) (b : Name) (p q : Proc) :
CommStep (.inp (.const a) p, .out (.const a) b q) (subst p b, q)
CSLibExt/Languages/SessionTypes/Communication.lean:48
def BinaryTyped (Γ : Context) (r : Proc × Proc) : Prop :=
HasType 0 Γ r.1 ∧ HasType 0 (dualContext Γ) r.2
CSLibExt/Languages/SessionTypes/Communication.lean:65
def advance (Γ : Context) (a : Nat) (s : SessionType) : Context :=
fun c => if c = a then s else Γ c
CSLibExt/Languages/SessionTypes/Basic.lean:95
Uses 14
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.