Same-name linear guards at a compatible interface communicate to Qualified progress at reachable closed runtime states
TheoremSame-name linear guards at a compatible interface communicate#✓fully proved
Actual disjoint same-name linear leaves at an INITIALLY compatible interface have opposite directions and construct a canonical Step. Shapes/nonalias are internally exposed outputs in the GLOBAL proof, not caller readiness hypotheses.
theorem same_name_linear_guards_step {n : Nat} {Γ : ServiceEnv} {Λ Θ : Context}
{g h : Proc} {a : Name} (hg : HasType n Γ Λ g) (hh : HasType n Γ Θ h)
(hd : Finmap.Disjoint Λ Θ) (hc : Conversion.Compatible (Λ ∪ Θ))
(hn : ∀ s sig, Γ.lookup s = some sig → a ≠ .const s)
(sg : (∃ b p, g = .out a b p) ∨ (∃ p, g = .inp a p))
(sh : (∃ b p, h = .out a b p) ∨ (∃ p, h = .inp a p)) :
∃ q, PiCalculus.Step (.par g 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 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 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
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 36 · Used by 1
TheoremBalanced runtime frontiers are idle or step given availability#✓fully proved
A typed balanced runtime frontier with actual persistent service availability is syntactically Idle OR takes an ACTUAL canonical Step. Shared requests are handled even if all owned keys are done; minimum/peer leaves are derived internally.
theorem GuardedFrontier.progress {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(hf : GuardedFrontier Γ p) (ht : HasType n Γ Δ p) (hb : Conversion.Balanced Δ)
(hav : Available Γ p) : Idle Γ p ∨ ∃ q, PiCalculus.Step 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 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 Balanced (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∃ d, Δ.lookup e.opposite = some d ∧ d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/SemanticAdvance.lean:45
def Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
def Idle (Γ : ServiceEnv) (p : Proc) : Prop := ServiceTemplate Γ p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:135
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 35 · Used by 1
TheoremChoice selection is the identity on runtime-typed processes#✓fully proved
Canonical choice selection is identity on an actually runtime-typed root: there is no sum rule, although replication is admitted. No finiteLinear erasure.
theorem HasType.select_eq {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ p) (hs : Select p q) : 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
inductive Select : Proc → Proc → Prop
| refl (p : Proc) : Select p p
| left (p q : Proc) : Select (.sum p q) p
| right (p q : Proc) : Select (.sum p q) q
| trans {p q r : Proc} : Select p q → Select q r → Select p r
CSLibExt/Languages/PiCalculus/Basic.lean:162
Uses 21 · Used by 1
TheoremSubject reduction for runtime typing at compatible interfaces#✓fully proved
From a runtime-typed source at an INITIALLY semantically compatible linear interface, ALL5 canonical Step constructors preserve Γ/n, typing and compatibility. The actual residual interface is unchanged OR has one faithful SemanticAdvance. Shared transfers are exact identity; private projection uses the chosen literal pair.
theorem HasType.subject_reduction {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ p) (hco : Conversion.Compatible Δ) (hs : PiCalculus.Step p q) :
∃ Ξ, HasType n Γ Ξ q ∧ 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 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
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
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 31 · Used by 5
TheoremSubject reduction for runtime typing at balanced interfaces#✓fully proved
An INITIALLY semantically balanced runtime interface derives compatibility and retains balance and the exact zero-or-one external advance after ANY Step.
theorem HasType.subject_reduction_balanced {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ p) (hb : Conversion.Balanced Δ) (hs : PiCalculus.Step p q) :
∃ Ξ, HasType n Γ Ξ q ∧ Conversion.Balanced Ξ ∧
(Ξ = Δ ∨ 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 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 Balanced (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∃ d, Δ.lookup e.opposite = some d ∧ d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/SemanticAdvance.lean:45
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
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
TheoremSubject reduction for runtime typing at the empty interface#✓fully proved
An empty linear interface is initially balanced/compatible and remains EXACTLY empty through any runtime Step, including private sessions and shared services.
theorem HasType.subject_reduction_empty {n : Nat} {Γ : ServiceEnv} {p q : Proc}
(h : HasType n Γ ∅ p) (hs : PiCalculus.Step p q) : HasType n Γ ∅ 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 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 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 21 · Used by 1
TheoremMulti-step subject reduction at compatible interfaces#✓fully proved
From an INITIALLY compatible runtime interface, finite actual reductions retain typing/compatibility and accumulate a trace of faithful semantic advances. Shared/private identity steps introduce no fake external advancement.
theorem HasType.reachable {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ p) (hc : Conversion.Compatible Δ)
(hr : Relation.ReflTransGen PiCalculus.Step p q) :
∃ Ξ, HasType n Γ Ξ q ∧ Conversion.Compatible Ξ ∧
Relation.ReflTransGen 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 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
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
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 8 · Used by 2
TheoremMulti-step subject reduction at balanced interfaces#✓fully proved
Every finite reachable state from an INITIALLY balanced runtime interface retains semantic balance and an ACTUAL faithful advancement trace, not progress.
theorem HasType.reachable_balanced {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ p) (hb : Conversion.Balanced Δ)
(hr : Relation.ReflTransGen PiCalculus.Step p q) :
∃ Ξ, HasType n Γ Ξ q ∧ Conversion.Balanced Ξ ∧
Relation.ReflTransGen 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 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 Balanced (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∃ d, Δ.lookup e.opposite = some d ∧ d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/SemanticAdvance.lean:45
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
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 11 · Used by 1
TheoremMulti-step subject reduction at the empty interface#✓fully proved
Finite runtime execution from an empty interface preserves exact empty ownership. This safety result does not identify idle replicas with Cong nil.
theorem HasType.reachable_empty {n : Nat} {Γ : ServiceEnv} {p q : Proc}
(h : HasType n Γ ∅ p) (hr : Relation.ReflTransGen PiCalculus.Step p q) : HasType n Γ ∅ 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 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 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
TheoremGlobal runtime progress at balanced interfaces given availability#✓fully proved
GLOBAL progress at arbitrary ambient n/shared Γ/actual balanced Δ/process p, qualified ONLY by runtime typing, INITIAL semantic balance and EXISTING persistent availability of ALL declared signatures. Result is actual Idle syntax OR a canonical Step. No frontier/normal form/readiness/Step/fairness/representative is supplied.
theorem HasType.progress_balanced {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p : Proc}
(h : HasType n Γ Δ p) (hb : Conversion.Balanced Δ) (ha : Available Γ p) :
Idle Γ p ∨ ∃ q, PiCalculus.Step 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 Balanced (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∃ d, Δ.lookup e.opposite = some d ∧ d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/SemanticAdvance.lean:45
def Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
def Idle (Γ : ServiceEnv) (p : Proc) : Prop := ServiceTemplate Γ p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:135
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 19 · Used by 3
TheoremClosed runtime processes are idle or step given availability#✓fully proved
Closed empty-interface runtime progress, at arbitrary passive-name depth, requires the SAME actual all-declared-service availability. Idle includes waiting replicas/accepts and nil; no termination or scheduler fairness is asserted.
theorem HasType.progress_empty {n : Nat} {Γ : ServiceEnv} {p : Proc}
(h : HasType n Γ ∅ p) (ha : Available Γ p) : Idle Γ 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 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 Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
def Idle (Γ : ServiceEnv) (p : Proc) : Prop := ServiceTemplate Γ p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:135
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 11 · Used by 2
TheoremQualified progress at every reachable runtime state#✓fully proved
Every finite canonical reduction from an initially balanced, available typed runtime retains qualified GLOBAL progress. Safety supplies actual balanced residual ownership/advance trace, and Available.reachable supplies current persistent syntax.
theorem HasType.reachable_progress {n : Nat} {Γ : ServiceEnv} {Δ : Context} {p q : Proc}
(h : HasType n Γ Δ p) (hb : Conversion.Balanced Δ) (ha : Available Γ p)
(hr : Relation.ReflTransGen PiCalculus.Step p q) : Idle Γ q ∨ ∃ r, PiCalculus.Step q 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 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 Balanced (Δ : Context) : Prop :=
∀ e c, Δ.lookup e = some c → ∃ d, Δ.lookup e.opposite = some d ∧ d.Equivalent c.dual
CSLibExt/Languages/SessionTypes/Endpoint/SemanticAdvance.lean:45
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
def Idle (Γ : ServiceEnv) (p : Proc) : Prop := ServiceTemplate Γ p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:135
Uses 12
TheoremQualified progress at reachable closed runtime states#✓fully proved
Finite reachable empty-interface states retain the same qualified progress; this is one-step safety/progress, not all-schedules eventual responsiveness.
theorem HasType.reachable_progress_empty {n : Nat} {Γ : ServiceEnv} {p q : Proc}
(h : HasType n Γ ∅ p) (ha : Available Γ p)
(hr : Relation.ReflTransGen PiCalculus.Step p q) : Idle Γ q ∨ ∃ r, PiCalculus.Step q 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 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 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
def Idle (Γ : ServiceEnv) (p : Proc) : Prop := ServiceTemplate Γ p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:135
Uses 12
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.