Runtime typing under renamings that fix and avoid shared names to Request-freeness is invariant under binder swapping
TheoremRuntime typing under renamings that fix and avoid shared names#✓fully proved
ALL10 runtime derivation rules transport actual names with Γ unchanged. Shared nonalias is required only on OWNED images, not unrestricted passive names.
theorem HasType.rename {n m : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc} {f : Name → Name}
(h : HasType n Γ Δ p) (hscope : ∀ a, a.ClosedAt n → (f a).ClosedAt m)
(hfix : FixesShared Γ f) (hn : NonAliases Γ Δ f)
(hf : Set.InjOn (Key.mapName f) {e | e ∈ Δ}) :
HasType m Γ (Context.rekey (Key.mapName f) Δ hf) (mapProc f 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 Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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 FixesShared (Γ : ServiceEnv) (f : Name → Name) : Prop :=
∀ s sig, Γ.lookup s = some sig → f (.const s) = .const s
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNames.lean:29
def NonAliases (Γ : ServiceEnv) (Δ : Context) (f : Name → Name) : Prop :=
∀ e ∈ Δ, ∀ s sig, Γ.lookup s = some sig → f e.name ≠ .const s
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNames.lean:33
def Key.mapName (f : PiCalculus.Name → PiCalculus.Name) (e : Key) : Key :=
⟨f e.name, e.role⟩
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:60
def Context.rekey (f : Key → Key) (Δ : Context)
(hf : Set.InjOn f {e | e ∈ Δ}) : Context where
entries := Δ.entries.map (fun x => ⟨f x.1, x.2⟩)
nodupKeys := by
apply Multiset.nodup_keys.mp
have h := Multiset.Nodup.map_on hf Δ.nodupKeys.nodup_keys
simpa [Multiset.keys, Multiset.map_map, Function.comp_def] using h
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:45
def mapProc (f : Name → Name) : Proc → Proc
| .nil => .nil
| .out a b p => .out (f a) (f b) (mapProc f p)
| .inp a p => .inp (f a) (mapProc (under f) p)
| .par p q => .par (mapProc f p) (mapProc f q)
| .nu p => .nu (mapProc (under f) p)
| .repl p => .repl (mapProc f p)
| .sum p q => .sum (mapProc f p) (mapProc f q)
CSLibExt/Languages/SessionTypes/Endpoint/Renaming.lean:39
Uses 56 · Used by 4
TheoremBinder lifting preserves runtime typing#✓fully proved
Canonical binder lift retains the entire runtime derivation and Γ literally.
theorem HasType.lift {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(h : HasType n Γ Δ p) (k : Nat) : HasType (n + 1) Γ (Context.lift k Δ) (liftProc k 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 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
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 22 · Used by 1
TheoremBinder swapping preserves runtime typing#✓fully proved
Canonical swap permutes actual owned binders without changing Γ or cap metadata.
theorem HasType.swap {n k : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(h : HasType n Γ Δ p) (hk : k + 1 < n) : HasType n Γ (Context.swap k Δ) (swapProc k 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 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.swap (k : Nat) (Δ : Context) : Context :=
rekey (Key.mapName (swapNameAt k)) Δ
(fun _ _ _ _ h => Key.mapName_injective (swapNameAt_injective k) h)
CSLibExt/Languages/SessionTypes/Endpoint/SwapTyping.lean:25
def swapProc (cutoff : ℕ) : Proc → Proc
| .nil => .nil
| .out a b p => .out (swapNameAt cutoff a) (swapNameAt cutoff b) (swapProc cutoff p)
| .inp a p => .inp (swapNameAt cutoff a) (swapProc (cutoff + 1) p)
| .par p q => .par (swapProc cutoff p) (swapProc cutoff q)
| .nu p => .nu (swapProc (cutoff + 1) p)
| .repl p => .repl (swapProc cutoff p)
| .sum p q => .sum (swapProc cutoff p) (swapProc cutoff q)
CSLibExt/Languages/PiCalculus/Basic.lean:119
Uses 22 · Used by 1
TheoremNonshared endpoint substitution keeps owned names nonshared#✓fully proved
An actual nonshared endpoint replacement keeps every owned substituted image nonshared.
theorem Separated.nonaliases_subst {Γ : ServiceEnv} {Δ : Context} (h : Separated Γ Δ)
{b : Name} (hb : ∀ s sig, Γ.lookup s = some sig → b ≠ .const s) :
NonAliases Γ Δ (substName b 0)
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 Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def NonAliases (Γ : ServiceEnv) (Δ : Context) (f : Name → Name) : Prop :=
∀ e ∈ Δ, ∀ s sig, Γ.lookup s = some sig → f e.name ≠ .const s
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNames.lean:33
def substName (n : Name) : ℕ → Name → Name
| _, .const m => .const m
| cutoff, .var i =>
if i < cutoff then .var i
else if i = cutoff then n
else .var (i - 1)
CSLibExt/Languages/PiCalculus/Basic.lean:83
Uses 10 · Used by 1
TheoremPassive substitution creates no owned shared-name alias#✓fully proved
Passive var0 is NOT owned: even a shared-constant replacement preserves all actual lifted owned names and creates no linear shared-name alias.
theorem Separated.nonaliases_passive {Γ : ServiceEnv} {Δ : Context}
(h : Separated Γ (Context.lift 0 Δ)) (b : Name) :
NonAliases Γ (Context.lift 0 Δ) (substName b 0)
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
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
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def NonAliases (Γ : ServiceEnv) (Δ : Context) (f : Name → Name) : Prop :=
∀ e ∈ Δ, ∀ s sig, Γ.lookup s = some sig → f e.name ≠ .const s
CSLibExt/Languages/SessionTypes/Endpoint/RuntimeNames.lean:33
def substName (n : Name) : ℕ → Name → Name
| _, .const m => .const m
| cutoff, .var i =>
if i < cutoff then .var i
else if i = cutoff then n
else .var (i - 1)
CSLibExt/Languages/PiCalculus/Basic.lean:83
Uses 12 · Used by 1
TheoremRuntime typing under substitution of a transmitted endpoint#✓fully proved
Actual transmitted endpoint substitution preserves literal role/rank and raw code. Shared nonalias of b is a static consequence of ACTUAL sender ownership/separation.
theorem HasType.subst_endpoint {n : Nat} {Γ : ServiceEnv} {Δ : Context} {b : Name} {r : Role}
{c v : Capability} {p : Proc}
(h : HasType (n + 1) Γ ((Context.lift 0 Δ).insert ⟨.var 0, r⟩ c) p)
(he : v.Equivalent c) (hb : b.ClosedAt n) (hfresh : (⟨b, r⟩ : Key) ∉ Δ)
(hshared : ∀ s sig, Γ.lookup s = some sig → b ≠ .const s) :
HasType n Γ (Δ.insert ⟨b, r⟩ v) (PiCalculus.subst p 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
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
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
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
Uses 29 · Used by 2
TheoremRuntime typing under passive name substitution#✓fully proved
Passive substitution has NO owned var0 and adds NO capability. A scoped shared constant can be received as data without becoming a linear/service subject.
theorem HasType.subst_passive {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc} {b : Name}
(h : HasType (n + 1) Γ (Context.lift 0 Δ) p) (hb : b.ClosedAt n) :
HasType n Γ Δ (PiCalculus.subst p 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
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
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
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
Uses 23 · Used by 2
TheoremEndpoint substitution with side conditions derived from a split#✓fully proved
Real sender ownership and a disjoint receiver carrier derive exact-role freshness and shared nonalias of the actual transmitted endpoint.
theorem HasType.subst_endpoint_from_split {n : Nat} {Γ : ServiceEnv} {Λ Θ : Context}
{b : Name} {r : Role} {c v old next : Capability} {e : Key} {p : Proc}
(hsep : Separated Γ Λ) (hd : Finmap.Disjoint Λ Θ) (hv : Λ.lookup ⟨b, r⟩ = some v)
(hc : Θ.lookup e = some old)
(h : HasType (n + 1) Γ ((Context.lift 0 (Θ.insert e next)).insert ⟨.var 0, r⟩ c) p)
(he : v.Equivalent c) (hb : b.ClosedAt n) :
HasType n Γ ((Θ.insert e next).insert ⟨b, r⟩ v) (PiCalculus.subst p 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
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
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 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
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
Uses 16 · Used by 1
TheoremRuntime typing reflects through binder lifting#✓fully proved
Reflection of a canonical lifted term retains exact owned capabilities and Γ.
theorem HasType.unlift {n : Nat} {Γ : ServiceEnv} {Δ : Context} {q : Proc}
(h : HasType (n + 1) Γ Δ (liftProc 0 q)) (hΔ : ∀ e ∈ Δ, e.name ≠ .var 0) :
HasType n Γ (Context.lower Δ hΔ) 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
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
def Context.lower (Γ : Context) (hΓ : ∀ e ∈ Γ, e.name ≠ .var 0) : Context :=
Context.rekey (Key.mapName (substName (.const 0) 0)) Γ (Context.injOn_lower hΓ)
CSLibExt/Languages/SessionTypes/Endpoint/UnliftContext.lean:53
Uses 15 · Used by 1
TheoremRuntime typing is preserved by forward scope extrusion#✓fully proved
Forward extrusion uses the actual disjoint split and literal bound pair.
theorem HasType.scope_forward {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ (.par (.nu p) q)) :
HasType n Γ Δ (.nu (.par p (liftProc 0 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
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 18 · Used by 1
TheoremRuntime typing absorbs a role absent from its parallel partner#✓fully proved
Partner ownership may be restored only when actual absence DERIVES completion. Shared nonalias is obtained from the typed owner, not a new unchecked assumption.
theorem HasType.insert_from_absent_partner {n : Nat} {Γ : ServiceEnv} {Δ Ξ : Context}
{p q : Proc} {e : Key} {c : Capability} (hp : HasType n Γ Δ p) (hq : HasType n Γ Ξ q)
(hc : (Δ ∪ Ξ).lookup e = some c) (hab : NameAbsent e.name q) (he : e.name.ClosedAt n) :
HasType n Γ (Δ.insert e c) 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
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 NameAbsent (a : Name) : Proc → Prop
| .nil => True
| .out b c p => a ≠ b ∧ a ≠ c ∧ NameAbsent a p
| .inp b p => a ≠ b ∧ NameAbsent (liftName 0 a) p
| .par p q | .sum p q => NameAbsent a p ∧ NameAbsent a q
| .nu p => NameAbsent (liftName 0 a) p
| .repl p => NameAbsent a p
CSLibExt/Languages/SessionTypes/Endpoint/NameAbsence.lean:29
Uses 14 · Used by 1
TheoremRuntime typing restores both bound roles to the restricted side#✓fully proved
Restoring a private pair adds only actually absent completed partner roles.
theorem HasType.restore_scope_pair {n : Nat} {Γ : ServiceEnv} {Δ Λ Ξ : Context} {p q : Proc}
{c : Capability} (hp : HasType (n + 1) Γ Λ p)
(hq : HasType (n + 1) Γ Ξ (liftProc 0 q)) (hs : Context.bind c Δ = Λ ∪ Ξ) :
HasType (n + 1) Γ ((Λ.insert (⟨.var 0, .positive⟩ : Key) c).insert
(⟨.var 0, .negative⟩ : Key) c.dual) 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
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 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
def Context.bind (c : Capability) (Δ : Context) : Context :=
(lift 0 Δ).insert ⟨.var 0, .positive⟩ c |>
Finmap.insert ⟨.var 0, .negative⟩ c.dual
CSLibExt/Languages/SessionTypes/Endpoint/ContextTransport.lean:49
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
Uses 16 · Used by 1
TheoremRuntime typing is preserved by reverse scope extrusion#✓fully proved
Reverse extrusion derives the exact external split from actual typing and removes only genuinely absent partner roles. No closed-hole or ready premise.
theorem HasType.scope_reverse {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ (.nu (.par p (liftProc 0 q)))) :
HasType n Γ Δ (.par (.nu p) 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
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 31 · Used by 1
TheoremRuntime typing is invariant under scope extrusion#✓fully proved
Exact canonical scope transport preserves SAME Γ, n and Δ in both directions.
theorem HasType.scope_iff {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc} :
HasType n Γ Δ (.par (.nu p) q) ↔ HasType n Γ Δ (.nu (.par p (liftProc 0 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
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 7 · Used by 1
TheoremStructural congruence preserves runtime typing#✓fully proved
ALL16 canonical Cong rules preserve the whole runtime derivation at exactly SAME Γ/n/Δ, including guarded replicated templates, completed ambient annotations, and actual runtime delegation continuations. No typing-up-to-Cong constructor.
theorem HasType.cong_iff {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc} (hc : Cong p q) :
HasType n Γ Δ p ↔ HasType n Γ Δ 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 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 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
Uses 45 · Used by 2
InductiveGuarded frontier of guards and idle service templates#✓fully proved
Unguarded frontier atoms are actual guards or existing guarded idle templates.
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)
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
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
Uses 4 · Used by 11
InductiveGuarded normal form: restrictions over a guarded frontier#✓fully proved
Actual private restriction towers around a guarded runtime frontier.
inductive GuardedNormal (Γ : ServiceEnv) : Proc → Prop where
| frontier {p : Proc} : GuardedFrontier Γ p → GuardedNormal Γ p
| nu {p : Proc} : GuardedNormal Γ p → GuardedNormal Γ (.nu 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
Uses 3 · Used by 5
DefinitionProcess with no exposed output on a declared shared name#✓fully proved
No exposed output is addressed to an actually declared shared constant. Prefix bodies are not inspected. This is syntax only, not a GLOBAL premise.
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
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
Uses 4 · Used by 11
TheoremRequest-freeness is invariant under lifting#✓fully proved
Literal shared constants are unaffected by canonical lifting.
theorem RequestFree.lift_iff (Γ : ServiceEnv) (k : Nat) (p : Proc) :
RequestFree Γ (liftProc k 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 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 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 1
TheoremRequest-freeness is invariant under binder swapping#✓fully proved
Canonical binder swap does not turn a nonshared output into a shared one.
theorem RequestFree.swap_iff (Γ : ServiceEnv) (k : Nat) (p : Proc) :
RequestFree Γ (swapProc k 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 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 swapProc (cutoff : ℕ) : Proc → Proc
| .nil => .nil
| .out a b p => .out (swapNameAt cutoff a) (swapNameAt cutoff b) (swapProc cutoff p)
| .inp a p => .inp (swapNameAt cutoff a) (swapProc (cutoff + 1) p)
| .par p q => .par (swapProc cutoff p) (swapProc cutoff q)
| .nu p => .nu (swapProc (cutoff + 1) p)
| .repl p => .repl (swapProc cutoff p)
| .sum p q => .sum (swapProc cutoff p) (swapProc cutoff q)
CSLibExt/Languages/PiCalculus/Basic.lean:119
Uses 8 · Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.