Request-freeness is invariant under structural congruence to Runtime head communication advances or keeps the interface
TheoremRequest-freeness is invariant under structural congruence#✓fully proved
All canonical structural laws preserve absence of an exposed shared request.
theorem RequestFree.cong_iff {Γ : ServiceEnv} {p q : Proc} (h : Cong p q) :
RequestFree Γ p ↔ RequestFree Γ q
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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 Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
Uses 10 · Used by 1
TheoremService templates are request-free#✓fully proved
Existing guarded templates have no exposed output/request.
theorem ServiceTemplate.request_free {Γ : ServiceEnv} {p : Proc} (h : ServiceTemplate Γ p) :
RequestFree Γ p
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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
def ServiceTemplate (Γ : ServiceEnv) : Proc → Prop
| .nil => True
| .inp a _ => ∃ s, a = .const s ∧ s ∈ Γ
| .par p q => ServiceTemplate Γ p ∧ ServiceTemplate Γ q
| .nu p | .repl p => ServiceTemplate Γ p
| .out .. | .sum .. => False
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:29
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
Uses 5 · Used by 1
TheoremLifting preserves guarded frontiers#✓fully proved
Canonical lifting maps guards and existing idle templates literally.
theorem GuardedFrontier.lift {Γ : ServiceEnv} {p : Proc} (h : GuardedFrontier Γ p) (k : Nat) :
GuardedFrontier Γ (liftProc k p)
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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 GuardedFrontier (Γ : ServiceEnv) : Proc → Prop where
| template {p : Proc} : ServiceTemplate Γ p → GuardedFrontier Γ p
| out (a b : Name) (p : Proc) : GuardedFrontier Γ (.out a b p)
| inp (a : Name) (p : Proc) : GuardedFrontier Γ (.inp a p)
| par {p q : Proc} : GuardedFrontier Γ p → GuardedFrontier Γ q → GuardedFrontier Γ (.par p q)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:27
def liftProc (cutoff : ℕ) : Proc → Proc
| .nil => .nil
| .out a b p => .out (liftName cutoff a) (liftName cutoff b) (liftProc cutoff p)
| .inp a p => .inp (liftName cutoff a) (liftProc (cutoff + 1) p)
| .par p q => .par (liftProc cutoff p) (liftProc cutoff q)
| .nu p => .nu (liftProc (cutoff + 1) p)
| .repl p => .repl (liftProc cutoff p)
| .sum p q => .sum (liftProc cutoff p) (liftProc cutoff q)
CSLibExt/Languages/PiCalculus/Basic.lean:70
Uses 8 · Used by 2
TheoremLifting preserves guarded normal forms#✓fully proved
Lifting preserves the actual unguarded private restriction tower.
theorem GuardedNormal.lift {Γ : ServiceEnv} {p : Proc} (h : GuardedNormal Γ p) (k : Nat) :
GuardedNormal Γ (liftProc k p)
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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 GuardedNormal (Γ : ServiceEnv) : Proc → Prop where
| frontier {p : Proc} : GuardedFrontier Γ p → GuardedNormal Γ p
| nu {p : Proc} : GuardedNormal Γ p → GuardedNormal Γ (.nu p)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:34
def liftProc (cutoff : ℕ) : Proc → Proc
| .nil => .nil
| .out a b p => .out (liftName cutoff a) (liftName cutoff b) (liftProc cutoff p)
| .inp a p => .inp (liftName cutoff a) (liftProc (cutoff + 1) p)
| .par p q => .par (liftProc cutoff p) (liftProc cutoff q)
| .nu p => .nu (liftProc (cutoff + 1) p)
| .repl p => .repl (liftProc cutoff p)
| .sum p q => .sum (liftProc cutoff p) (liftProc cutoff q)
CSLibExt/Languages/PiCalculus/Basic.lean:70
Uses 6 · Used by 1
TheoremParallel composition preserves guarded normal forms up to congruence#✓fully proved
All private restrictions on either component are extruded canonically; no process execution or ready pair is stored in the normal form.
theorem GuardedNormal.parallel {Γ : ServiceEnv} {p q : Proc} (hp : GuardedNormal Γ p)
(hq : GuardedNormal Γ q) : ∃ r, Cong (.par p q) r ∧ GuardedNormal Γ r
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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 GuardedNormal (Γ : ServiceEnv) : Proc → Prop where
| frontier {p : Proc} : GuardedFrontier Γ p → GuardedNormal Γ p
| nu {p : Proc} : GuardedNormal Γ p → GuardedNormal Γ (.nu p)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:34
inductive Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
Uses 8 · Used by 1
TheoremRuntime-typed processes are congruent to a guarded normal form#✓fully proved
ALL10 runtime rules derive a syntactic normal form internally. Replicas remain actual guarded templates; no recursive process is erased to finite typing.
theorem HasType.syntax_normal {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(h : HasType n Γ Δ p) : ∃ q, Cong p q ∧ GuardedNormal Γ q
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
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 → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
inductive Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
inductive GuardedNormal (Γ : ServiceEnv) : Proc → Prop where
| frontier {p : Proc} : GuardedFrontier Γ p → GuardedNormal Γ p
| nu {p : Proc} : GuardedNormal Γ p → GuardedNormal Γ (.nu p)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:34
Uses 24 · Used by 1
TheoremGuarded normal form of a typed process keeps its typing#✓fully proved
Actual runtime normalization retains SAME Γ/n/Δ through the proved Cong invariance; this theorem supplies the frontier, never the GLOBAL caller.
theorem HasType.frontier_normal {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(h : HasType n Γ Δ p) : ∃ q, Cong p q ∧ HasType n Γ Δ q ∧ GuardedNormal Γ q
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
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 → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
inductive Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
inductive GuardedNormal (Γ : ServiceEnv) : Proc → Prop where
| frontier {p : Proc} : GuardedFrontier Γ p → GuardedNormal Γ p
| nu {p : Proc} : GuardedNormal Γ p → GuardedNormal Γ (.nu p)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:34
Uses 8 · Used by 1
TheoremRequest-free runtime outputs have an active linear subject#✓fully proved
A request-free output has an ACTUAL active linear subject and GuardMin.
theorem HasType.linear_out_active {n : Nat} {Γ : ServiceEnv} {Δ : Context}
{a b : Name} {p : Proc} (h : HasType n Γ Δ (.out a b p))
(hf : RequestFree Γ (.out a b p)) :
∃ e c, e.name = a ∧ Δ.lookup e = some c ∧ c.protocol.unfold ≠ .done ∧ GuardMin Δ e c.rank
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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 → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
def GuardMin (Δ : Context) (e : Key) (rank : Nat) : Prop :=
∀ d c, Δ.lookup d = some c → c.protocol.unfold ≠ .done →
d ≠ e → rank < c.rank
CSLibExt/Languages/SessionTypes/Endpoint/Priority.lean:26
Uses 22 · Used by 3
TheoremRuntime inputs are active linear or have completed ownership#✓fully proved
Linear inputs expose active subjects; once-only shared accepts have only completed AMBIENT ownership and may wait quiescently.
theorem HasType.inp_active_or_completed {n : Nat} {Γ : ServiceEnv} {Δ : Context}
{a : Name} {p : Proc} (h : HasType n Γ Δ (.inp a p)) :
(∃ e c, e.name = a ∧ Δ.lookup e = some c ∧ c.protocol.unfold ≠ .done ∧
GuardMin Δ e c.rank) ∨ Δ.Completed
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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 → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def GuardMin (Δ : Context) (e : Key) (rank : Nat) : Prop :=
∀ d c, Δ.lookup d = some c → c.protocol.unfold ≠ .done →
d ≠ e → rank < c.rank
CSLibExt/Languages/SessionTypes/Endpoint/Priority.lean:26
Uses 21 · Used by 2
TheoremRequest-free completed runtime frontiers are service templates#✓fully proved
With no actual requests or active owned keys, typing derives ACTUAL idle service-template syntax, not merely an empty/completed interface.
theorem GuardedFrontier.completed_idle {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(hf : GuardedFrontier Γ p) (ht : HasType n Γ Δ p) (hr : RequestFree Γ p)
(hc : Δ.Completed) : ServiceTemplate Γ p
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
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 GuardedFrontier (Γ : ServiceEnv) : Proc → Prop where
| template {p : Proc} : ServiceTemplate Γ p → GuardedFrontier Γ p
| out (a b : Name) (p : Proc) : GuardedFrontier Γ (.out a b p)
| inp (a : Name) (p : Proc) : GuardedFrontier Γ (.inp a p)
| par {p q : Proc} : GuardedFrontier Γ p → GuardedFrontier Γ q → GuardedFrontier Γ (.par p q)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:27
inductive HasType : Nat → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
def ServiceTemplate (Γ : ServiceEnv) : Proc → Prop
| .nil => True
| .inp a _ => ∃ s, a = .const s ∧ s ∈ Γ
| .par p q => ServiceTemplate Γ p ∧ ServiceTemplate Γ q
| .nu p | .repl p => ServiceTemplate Γ p
| .out .. | .sum .. => False
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:29
Uses 25 · Used by 1
TheoremMinimum active key is the subject of a runtime frontier leaf#✓fully proved
A minimum over ALL actual active owned keys exposes the EXACT linear subject of a real runtime leaf. Idle templates/accept ambient are completed; shared outputs are excluded only by the internally established request-free case.
theorem GuardedFrontier.expose_minimum {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(hf : GuardedFrontier Γ p) (ht : HasType n Γ Δ p) (hr : RequestFree Γ p)
{e : Key} {c : Capability} (he : Δ.lookup e = some c) (ha : c.protocol.unfold ≠ .done)
(hmin : ∀ x v, Δ.lookup x = some v → v.protocol.unfold ≠ .done → c.rank ≤ v.rank) :
∃ Λ Θ g r, Δ = Λ ∪ Θ ∧ Finmap.Disjoint Λ Θ ∧ Λ.lookup e = some c ∧
Cong p (.par g r) ∧ HasType n Γ Λ g ∧ HasType n Γ Θ r ∧
((∃ b t, g = .out e.name b t) ∨ (∃ t, g = .inp e.name t)) ∧ GuardedFrontier Γ r
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
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 GuardedFrontier (Γ : ServiceEnv) : Proc → Prop where
| template {p : Proc} : ServiceTemplate Γ p → GuardedFrontier Γ p
| out (a b : Name) (p : Proc) : GuardedFrontier Γ (.out a b p)
| inp (a : Name) (p : Proc) : GuardedFrontier Γ (.inp a p)
| par {p q : Proc} : GuardedFrontier Γ p → GuardedFrontier Γ q → GuardedFrontier Γ (.par p q)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:27
inductive HasType : Nat → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
inductive Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
Uses 25 · Used by 1
TheoremRuntime minimum guard leaf cannot own an equivalent dual peer#✓fully proved
The equal-rank semantic peer of a minimum active role cannot share its actual guard leaf. Opposite roles on the SAME physical name are distinct keys.
theorem minimum_peer_separate {n : Nat} {Γ : ServiceEnv} {Δ : Context} {g : Proc}
{e : Key} {c d : Capability} (ht : HasType n Γ Δ g) (hr : RequestFree Γ g)
(he : Δ.lookup e = some c) (ha : c.protocol.unfold ≠ .done)
(hmin : ∀ x v, Δ.lookup x = some v → v.protocol.unfold ≠ .done → c.rank ≤ v.rank)
(hs : (∃ b t, g = .out e.name b t) ∨ (∃ t, g = .inp e.name t))
(hd : d.Equivalent c.dual) : Δ.lookup e.opposite ≠ some d
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
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
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
inductive HasType : Nat → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
Uses 24 · Used by 1
TheoremNon-request-free frontier exposes a shared output up to congruence#✓fully proved
A non-request-free frontier yields an ACTUAL declared output leaf through canonical par rearrangement. Neither readiness nor a progress result is supplied.
theorem GuardedFrontier.expose_request {Γ : ServiceEnv} {p : Proc} (hf : GuardedFrontier Γ p)
(hn : ¬ RequestFree Γ p) :
∃ s sig b c r, Γ.lookup s = some sig ∧ Cong p (.par (.out (.const s) b c) r)
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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 GuardedFrontier (Γ : ServiceEnv) : Proc → Prop where
| template {p : Proc} : ServiceTemplate Γ p → GuardedFrontier Γ p
| out (a b : Name) (p : Proc) : GuardedFrontier Γ (.out a b p)
| inp (a : Name) (p : Proc) : GuardedFrontier Γ (.inp a p)
| par {p q : Proc} : GuardedFrontier Γ p → GuardedFrontier Γ q → GuardedFrontier Γ (.par p q)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:27
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
inductive Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
Uses 9 · Used by 1
TheoremExposed shared requests step when declared services are available#✓fully proved
Any actual exposed request fires under the EXISTING all-declared-services availability qualifier, even with ZERO active owned keys or a DONE payload. The Step is constructed from actual offered input syntax, not stored in Available.
theorem GuardedFrontier.request_progress {Γ : ServiceEnv} {p : Proc} (hf : GuardedFrontier Γ p)
(hn : ¬ RequestFree Γ p) (ha : Available Γ p) : ∃ q, PiCalculus.Step p q
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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 GuardedFrontier (Γ : ServiceEnv) : Proc → Prop where
| template {p : Proc} : ServiceTemplate Γ p → GuardedFrontier Γ p
| out (a b : Name) (p : Proc) : GuardedFrontier Γ (.out a b p)
| inp (a : Name) (p : Proc) : GuardedFrontier Γ (.inp a p)
| par {p q : Proc} : GuardedFrontier Γ p → GuardedFrontier Γ q → GuardedFrontier Γ (.par p q)
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:27
def RequestFree (Γ : ServiceEnv) : Proc → Prop
| .nil | .inp .. => True
| .out a _ _ => ∀ s sig, Γ.lookup s = some sig → a ≠ .const s
| .par p q | .sum p q => RequestFree Γ p ∧ RequestFree Γ q
| .nu p | .repl p => RequestFree Γ p
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNormalization.lean:40
def Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
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
Uses 13 · Used by 1
TheoremShared invocation and input worker preserve the combined interface#✓fully proved
A declared shared invocation and ANY typed input worker preserve their EXACT combined linear interface. The actual owned payload is substituted, not the advertised raw protocol; completed receiver annotations remain ambient.
theorem HasType.shared_head {n : Nat} {Γ : ServiceEnv} {Δ Θ : Context}
{s : Nat} {sig : ServiceSignature} {b : Name} {p q : Proc}
(hs : Γ.lookup s = some sig) (hd : Finmap.Disjoint Δ Θ)
(hout : HasType n Γ Δ (.out (.const s) b p))
(hin : HasType n Γ Θ (.inp (.const s) q)) :
HasType n Γ (Δ ∪ Θ) (.par p (PiCalculus.subst q b))
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
structure ServiceSignature where
priority : Nat
role : Role
capability : Capability
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:27
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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 → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
Uses 25 · Used by 1
TheoremInversion of runtime input on a nonshared subject#✓fully proved
A nonshared input subject exposes a genuine linear passive or endpoint head. The shared accept alternative is excluded by actual subject nonalias.
theorem HasType.linear_input_inv {n : Nat} {Γ : ServiceEnv} {Δ : Context} {a : Name} {p : Proc}
(h : HasType n Γ Δ (.inp a p))
(hn : ∀ s sig, Γ.lookup s = some sig → a ≠ .const s) :
∃ e c, e.name = a ∧ Δ.lookup e = some c ∧
((∃ s, c.protocol.unfold = .recvName s ∧
HasType (n + 1) Γ (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p) ∨
∃ r k t s, c.protocol.unfold = .recvEndpoint r k t s ∧
HasType (n + 1) Γ
((Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)).insert ⟨.var 0, r⟩ ⟨k, t⟩) p)
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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 → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def Context.lift (k : Nat) (Δ : Context) : Context :=
rekey (Key.mapName (liftName k)) Δ
(fun _ _ _ _ h => Key.mapName_injective (liftName_injective k) h)
CSLibExt/Languages/SessionTypes/Endpoint/ContextTransport.lean:28
Uses 20 · Used by 3
TheoremSemantic advance preserves shared-linear separation#✓fully proved
Faithful semantic advancement preserves shared/linear separation by its actual owned-domain invariance, including every completed entry.
theorem Separated.advance {Γ : ServiceEnv} {Δ Ξ : Context}
(h : Separated Γ Δ) (ha : Conversion.SemanticAdvance Δ Ξ) : Separated Γ Ξ
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
def Separated (Γ : ServiceEnv) (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∀ s sig, Γ.lookup s = some sig → e.name ≠ .const s
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:36
inductive SemanticAdvance : Context → Context → Prop where
| matched {Δ : Context} {e : Key} {c d : Capability} {s u : Protocol} :
Δ.lookup e = some c → Δ.lookup e.opposite = some d → d.Equivalent c.dual →
CommunicationHeads c d s u → u.TreeEquiv s.dual →
SemanticAdvance Δ ((Δ.insert e ⟨c.rank, s⟩).insert e.opposite ⟨d.rank, u⟩)
CSLibExt/Languages/SessionTypes/Endpoint/SemanticAdvance.lean:38
Uses 10 · Used by 1
TheoremPassive head communication preserves runtime typing#✓fully proved
At an INITIALLY compatible disjoint interface, a linear passive head retains both actual carrier codes and every runtime continuation guard at unchanged Γ.
theorem passive_head_preservation {n : Nat} {Γ : ServiceEnv} {Λ Θ : Context}
{e : Key} {c : Capability} {s : Protocol} {b : Name} {p q : Proc}
(hd : Finmap.Disjoint Λ Θ) (hsep : Separated Γ Λ) (hc : Λ.lookup e = some c)
(hh : c.protocol.unfold = .sendName s) (hp : HasType n Γ (Λ.insert e ⟨c.rank, s⟩) p)
(hq : HasType n Γ Θ (.inp e.name q)) (hb : b.ClosedAt n)
(hco : Conversion.Compatible (Λ ∪ Θ)) :
∃ d u, Θ.lookup e.opposite = some d ∧ d.rank = c.rank ∧
d.protocol.unfold = .recvName u ∧ u.TreeEquiv s.dual ∧
HasType n Γ (((Λ ∪ Θ).insert e ⟨c.rank, s⟩).insert e.opposite ⟨d.rank, u⟩)
(.par p (PiCalculus.subst q b))
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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
def Separated (Γ : ServiceEnv) (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∀ s sig, Γ.lookup s = some sig → e.name ≠ .const s
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:36
inductive HasType : Nat → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def Compatible (Δ : Context) : Prop :=
∀ e c d, Δ.lookup e = some c → Δ.lookup e.opposite = some d → d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:57
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
Uses 28 · Used by 1
TheoremEndpoint head communication preserves runtime typing#✓fully proved
At an INITIALLY compatible split, linear endpoint communication transfers ACTUAL v and keeps the receiver's independent advertised payload/tail codes. The Γ-preserving runtime substitution retains all continuation priorities.
theorem endpoint_head_preservation {n k : Nat} {Γ : ServiceEnv} {Λ Θ : Context}
{e f : Key} {c v : Capability} {t s : Protocol} {p q : Proc}
(hd : Finmap.Disjoint Λ Θ) (hsep : Separated Γ Λ) (hc : Λ.lookup e = some c)
(hh : c.protocol.unfold = .sendEndpoint f.role k t s)
(hv : Λ.lookup f = some v) (hvt : v.Equivalent ⟨k, t⟩) (hne : e ≠ f)
(hp : HasType n Γ ((Λ.erase f).insert e ⟨c.rank, s⟩) p)
(hq : HasType n Γ Θ (.inp e.name q)) (hb : f.name.ClosedAt n)
(hco : Conversion.Compatible (Λ ∪ Θ)) :
∃ d t' u, Θ.lookup e.opposite = some d ∧ d.rank = c.rank ∧
d.protocol.unfold = .recvEndpoint f.role k t' u ∧ t'.TreeEquiv t ∧ u.TreeEquiv s.dual ∧
HasType n Γ (((Λ ∪ Θ).insert e ⟨c.rank, s⟩).insert e.opposite ⟨d.rank, u⟩)
(.par p (PiCalculus.subst q f.name))
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
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
def Separated (Γ : ServiceEnv) (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∀ s sig, Γ.lookup s = some sig → e.name ≠ .const s
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:36
inductive HasType : Nat → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def Compatible (Δ : Context) : Prop :=
∀ e c d, Δ.lookup e = some c → Δ.lookup e.opposite = some d → d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:57
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
Uses 30 · Used by 1
TheoremRuntime head communication advances or keeps the interface#✓fully proved
At an INITIALLY semantically compatible linear interface, actual runtime heads either advance the paired linear subjects faithfully or transfer on a shared service with the EXACT unchanged interface. Mixed shared/linear heads are excluded by source separation, not a finite-fragment erasure or supplied result field.
theorem HasType.head_advance {n : Nat} {Γ : ServiceEnv} {Δ : Context} {a b : Name} {p q : Proc}
(h : HasType n Γ Δ (.par (.out a b p) (.inp a q))) (hco : Conversion.Compatible Δ) :
∃ Ξ, HasType n Γ Ξ (.par p (PiCalculus.subst q b)) ∧ Conversion.Compatible Ξ ∧
(Ξ = Δ ∨ Conversion.SemanticAdvance Δ Ξ)
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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 → ServiceEnv → Context → Proc → Prop where
| nil {n : Nat} {Γ : ServiceEnv} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → Separated Γ Δ → HasType n Γ Δ .nil
| outName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .sendName s → e.name.ClosedAt n → b.ClosedAt n →
HasType n Γ (Δ.insert e ⟨c.rank, s⟩) p → HasType n Γ Δ (.out e.name b p)
| inpName {n : Nat} {Γ : ServiceEnv} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Separated Γ Δ → Δ.lookup e = some c →
c.protocol.unfold = .recvName s → e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/SharedServices.lean:32
def Compatible (Δ : Context) : Prop :=
∀ e c d, Δ.lookup e = some c → Δ.lookup e.opposite = some d → d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:57
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
inductive SemanticAdvance : Context → Context → Prop where
| matched {Δ : Context} {e : Key} {c d : Capability} {s u : Protocol} :
Δ.lookup e = some c → Δ.lookup e.opposite = some d → d.Equivalent c.dual →
CommunicationHeads c d s u → u.TreeEquiv s.dual →
SemanticAdvance Δ ((Δ.insert e ⟨c.rank, s⟩).insert e.opposite ⟨d.rank, u⟩)
CSLibExt/Languages/SessionTypes/Endpoint/SemanticAdvance.lean:38
Uses 33 · Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.