Recursive sessions through replicated services
TheoremSelection preserves persistent offers#✓fully proved
Choice selection cannot discard a persistent SOURCE offer: sums do not expose OfferedIn, and selecting an actual communicating guard exposes no persistent offer.
theorem offered_select {s : Nat} {p q : Proc} (h : Select p q) :
OfferedIn s p → OfferedIn s q
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive 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
def OfferedIn (s : Nat) : Proc → Prop
| .repl p => AcceptIn s p
| .par p q => OfferedIn s p ∨ OfferedIn s q
| .nu p => OfferedIn s p
| .nil | .inp .. | .out .. | .sum .. => False
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:99
Uses 3 · Used by 1
TheoremPersistent service offers survive one reduction step#✓fully proved
ALL5 canonical Step rules retain every actual persistent source service offer. This is valid for arbitrary Pi syntax, WITHOUT a HasType premise.
theorem offered_step {s : Nat} {p q : Proc} (h : PiCalculus.Step p q) :
OfferedIn s p → OfferedIn s q
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive 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 OfferedIn (s : Nat) : Proc → Prop
| .repl p => AcceptIn s p
| .par p q => OfferedIn s p ∨ OfferedIn s q
| .nu p => OfferedIn s p
| .nil | .inp .. | .out .. | .sum .. => False
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:99
Uses 9 · Used by 2
TheoremDeclared signature offers survive one reduction step#✓fully proved
Exact declared signature lookup plus an actual persistent offer is retained by every canonical Step, at unchanged shared environment/signature.
theorem Offered.step {Γ : ServiceEnv} {s : Nat} {sig : ServiceSignature} {p q : Proc}
(h : Offered Γ p s sig) (hs : PiCalculus.Step p q) : Offered Γ q s sig
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
structure ServiceSignature where
priority : Nat
role : Role
capability : Capability
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.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
def Offered (Γ : ServiceEnv) (p : Proc) (s : Nat) (sig : ServiceSignature) : Prop :=
Γ.lookup s = some sig ∧ OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:131
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
TheoremDeclared signature offers survive finite reduction#✓fully proved
Every finite actual reduction preserves each SOURCE persistent signature offer. No liveness, all-schedules fairness or eventual service invocation is asserted.
theorem Offered.reachable {Γ : ServiceEnv} {s : Nat} {sig : ServiceSignature} {p q : Proc}
(h : Offered Γ p s sig) (hr : Relation.ReflTransGen PiCalculus.Step p q) :
Offered Γ q s sig
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
structure ServiceSignature where
priority : Nat
role : Role
capability : Capability
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.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
def Offered (Γ : ServiceEnv) (p : Proc) (s : Nat) (sig : ServiceSignature) : Prop :=
Γ.lookup s = some sig ∧ OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:131
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
DefinitionAvailability of all declared services#✓fully proved
Every declared shared signature has an ACTUAL persistent offer in current syntax. There is NO typing, Step, future trace, ready pair or step-closure field.
def Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s 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 OfferedIn (s : Nat) : Proc → Prop
| .repl p => AcceptIn s p
| .par p q => OfferedIn s p ∨ OfferedIn s q
| .nu p => OfferedIn s p
| .nil | .inp .. | .out .. | .sum .. => False
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:99
Uses 4 · Used by 14
TheoremAvailability as offers of all declared signatures#✓fully proved
Availability is exactly current declared signature lookup plus persistent syntax.
theorem available_iff_offered {Γ : ServiceEnv} {p : Proc} :
Available Γ p ↔ ∀ s sig, Γ.lookup s = some sig → Offered Γ p s sig
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 Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
def Offered (Γ : ServiceEnv) (p : Proc) (s : Nat) (sig : ServiceSignature) : Prop :=
Γ.lookup s = some sig ∧ OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:131
TheoremStructural congruence preserves service availability#✓fully proved
All canonical structural laws preserve current syntactic availability.
theorem Available.cong_iff {Γ : ServiceEnv} {p q : Proc} (h : Cong p q) :
Available Γ p ↔ Available Γ 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 Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
Uses 7 · Used by 2
TheoremService availability survives one reduction step#✓fully proved
Strong actual syntactic availability survives ANY canonical Step.
theorem Available.step {Γ : ServiceEnv} {p q : Proc} (h : Available Γ p)
(hs : PiCalculus.Step p q) : Available Γ 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 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 6 · Used by 1
TheoremService availability survives finite reduction#✓fully proved
Finite actual reductions preserve source syntactic availability; preservation is PROVED here, not encoded into its definition. This is not a progress theorem.
theorem Available.reachable {Γ : ServiceEnv} {p q : Proc} (h : Available Γ p)
(hr : Relation.ReflTransGen PiCalculus.Step p q) : Available Γ 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 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 5 · Used by 3
TheoremIdle processes have no unguarded output#✓fully proved
Idle is syntax-only and excludes a canonical exposed output, including inside parallel, restriction and inert replicated templates.
theorem Idle.no_unguarded_output {Γ : ServiceEnv} {p : Proc} (h : Idle Γ p) :
¬ PiCalculus.HasUnguardedOutput 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 Idle (Γ : ServiceEnv) (p : Proc) : Prop := ServiceTemplate Γ p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:135
def HasUnguardedOutput : Proc → Prop
| .nil => False
| .out _ _ _ => True
| .inp _ _ => False
| .par p q => HasUnguardedOutput p ∨ HasUnguardedOutput q
| .nu p => HasUnguardedOutput p
| .repl p => HasUnguardedOutput p
| .sum p q => HasUnguardedOutput p ∨ HasUnguardedOutput q
CSLibExt/Languages/PiCalculus/Behavioural.lean:132
Uses 6 · Used by 3
TheoremIdle processes cannot step#✓fully proved
Idle services cannot Step, even through arbitrary canonical congruence.
theorem Idle.no_step {Γ : ServiceEnv} {p : Proc} (h : Idle Γ p) (q : Proc) :
¬ 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
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
TheoremInvoking a replicated service is a reduction step#✓fully proved
Canonical replication unfolds and communicates on a real shared trigger.
theorem service_invocation_step (s : Nat) (b : Name) (body : Proc) :
PiCalculus.Step (.par (.out (.const s) b .nil) (.repl (.inp (.const s) body)))
(.par (PiCalculus.subst body b) (.repl (.inp (.const s) body)))
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 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 subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
DefinitionOne-state recurring send graph#✓fully proved
Every edge of this reachable one-state graph performs a session send.
def recurringGraph : Graph := ⟨1, fun _ => .sendName ⟨0, by decide⟩⟩
structure Graph where
size : Nat
node : Fin size → Node size
CSLibExt/Languages/SessionTypes/Endpoint/Graph.lean:37
Uses 2 · Used by 1
DefinitionRecurring send protocol#✓fully proved
Initial cursor of the one-state recurring send protocol.
def recurringProtocol : Protocol := .regular recurringGraph ⟨0, by decide⟩ false
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
def recurringGraph : Graph := ⟨1, fun _ => .sendName ⟨0, by decide⟩⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:40
Uses 3 · Used by 6
DefinitionFixed-rank capability of the recurring session#✓fully proved
The recurring session keeps one literal static capability rank throughout.
def recurringCap : Capability := ⟨7, recurringProtocol⟩
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
def recurringProtocol : Protocol := .regular recurringGraph ⟨0, by decide⟩ false
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:43
Uses 3 · Used by 13
TheoremThe recurring protocol unfolds to a send of itself#✓fully proved
Literal guarded self-loop unfolding, not an unreachable extra graph node.
theorem recurring_unfold : recurringProtocol.unfold = .sendName recurringProtocol
def recurringProtocol : Protocol := .regular recurringGraph ⟨0, by decide⟩ false
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:43
Uses 3 · Used by 2
TheoremThe dual recurring protocol unfolds to a receive of itself#✓fully proved
The peer's literal guarded cursor returns to the same receive protocol.
theorem recurring_dual_unfold :
recurringProtocol.dual.unfold = .recvName recurringProtocol.dual
def recurringProtocol : Protocol := .regular recurringGraph ⟨0, by decide⟩ false
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:43
DefinitionSender worker process#✓fully proved
Worker code has one session action and a real endpoint-transfer reentry.
def senderWorker (b : Name) : Proc := .out b (.const 712) (.out (.const 710) b .nil)
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
Uses 2 · Used by 12
DefinitionReceiver worker process#✓fully proved
A received session endpoint survives the worker's passive input binder.
def receiverWorker (b : Name) : Proc := .inp b (.out (.const 711) (liftName 0 b) .nil)
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 liftName (cutoff : ℕ) : Name → Name
| .const n => .const n
| .var i => if cutoff ≤ i then .var (i + 1) else .var i
CSLibExt/Languages/PiCalculus/Basic.lean:64
Uses 3 · Used by 9
DefinitionReplicated sender daemon#✓fully proved
Sender replication captures only shared constants and its per-invocation formal.
def senderDaemon : Proc := .repl (.inp (.const 710) (senderWorker (.var 0)))
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 senderWorker (b : Name) : Proc := .out b (.const 712) (.out (.const 710) b .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:56
Uses 3 · Used by 12
DefinitionReplicated receiver daemon#✓fully proved
Receiver replication likewise receives, rather than captures, its endpoint.
def receiverDaemon : Proc := .repl (.inp (.const 711) (receiverWorker (.var 0)))
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 receiverWorker (b : Name) : Proc := .inp b (.out (.const 711) (liftName 0 b) .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:59
Uses 3 · Used by 12
DefinitionSender-role transfer to its trigger#✓fully proved
Transfer the actual sender-role endpoint to its shared trigger.
def senderRequest (b : Name) : Proc := .out (.const 710) b .nil
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
Uses 2 · Used by 6
DefinitionReceiver-role transfer to its trigger#✓fully proved
Transfer the actual opposite-role endpoint to its shared trigger.
def receiverRequest (b : Name) : Proc := .out (.const 711) b .nil
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
Uses 2 · Used by 10
DefinitionPending state with two role transfers#✓fully proved
Persistent services plus TWO pending role transfers, on one physical endpoint.
def pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
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 senderRequest (b : Name) : Proc := .out (.const 710) b .nil
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:68
def senderDaemon : Proc := .repl (.inp (.const 710) (senderWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:62
def receiverRequest (b : Name) : Proc := .out (.const 711) b .nil
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:71
def receiverDaemon : Proc := .repl (.inp (.const 711) (receiverWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:65
Uses 6 · Used by 18
DefinitionState after the sender trigger invocation#✓fully proved
After one trigger invocation, the opposite request and both daemons remain.
def sentInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
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 senderWorker (b : Name) : Proc := .out b (.const 712) (.out (.const 710) b .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:56
def senderDaemon : Proc := .repl (.inp (.const 710) (senderWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:62
def receiverRequest (b : Name) : Proc := .out (.const 711) b .nil
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:71
def receiverDaemon : Proc := .repl (.inp (.const 711) (receiverWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:65
Uses 6 · Used by 14
DefinitionState after both trigger invocations#✓fully proved
Both received-role workers can now communicate on their actual session name.
def bothInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverWorker b) receiverDaemon)
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 senderWorker (b : Name) : Proc := .out b (.const 712) (.out (.const 710) b .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:56
def senderDaemon : Proc := .repl (.inp (.const 710) (senderWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:62
def receiverWorker (b : Name) : Proc := .inp b (.out (.const 711) (liftName 0 b) .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:59
def receiverDaemon : Proc := .repl (.inp (.const 711) (receiverWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:65
Uses 6 · Used by 14
TheoremSubstitution instantiates the sender worker's endpoint#✓fully proved
Capture-safe first trigger communication instantiates the actual bound endpoint.
theorem sender_subst (b : Name) : PiCalculus.subst (senderWorker (.var 0)) b = senderWorker b
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
def senderWorker (b : Name) : Proc := .out b (.const 712) (.out (.const 710) b .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:56
TheoremSubstitution instantiates the receiver worker's endpoint#✓fully proved
Receiver preserves the actual endpoint under its inner passive input binder.
theorem receiver_subst (b : Name) :
PiCalculus.subst (receiverWorker (.var 0)) b = receiverWorker b
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
def receiverWorker (b : Name) : Proc := .inp b (.out (.const 711) (liftName 0 b) .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:59
TheoremPending state steps by invoking the sender trigger#✓fully proved
The first real trigger Step, leaving both persistent daemons untouched.
theorem sender_invocation (b : Name) : PiCalculus.Step (pending b) (sentInvoked b)
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.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
def pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:74
def sentInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:78
Uses 11 · Used by 1
TheoremSender-invoked state steps by invoking the receiver trigger#✓fully proved
The second actual trigger Step, not a pre-generated finite unrolling.
theorem receiver_invocation (b : Name) : PiCalculus.Step (sentInvoked b) (bothInvoked b)
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.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
def sentInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:78
def bothInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverWorker b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:82
Uses 11 · Used by 1
TheoremInterchange law for four parallel components#✓fully proved
Four canonical parallel components regroup without evaluating any body.
theorem parallel_interchange (a b c d : Proc) :
Cong (.par (.par a b) (.par c d)) (.par (.par a c) (.par b d))
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
Uses 2 · Used by 1
TheoremData substitution yields the receiver's return request#✓fully proved
A passive input removes ONLY its data binder, retaining the actual endpoint.
theorem receiver_return_subst (b : Name) :
PiCalculus.subst (.out (.const 711) (liftName 0 b) .nil) (.const 712) = receiverRequest b
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def subst (p : Proc) (n : Name) : Proc := substProc n 0 p
CSLibExt/Languages/PiCalculus/Basic.lean:108
def liftName (cutoff : ℕ) : Name → Name
| .const n => .const n
| .var i => if cutoff ≤ i then .var (i + 1) else .var i
CSLibExt/Languages/PiCalculus/Basic.lean:64
def receiverRequest (b : Name) : Proc := .out (.const 711) b .nil
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:71
TheoremSession action steps back to the pending state#✓fully proved
Actual session action restores BOTH pending endpoint-role transfers and daemons.
theorem session_and_reentry (b : Name) : PiCalculus.Step (bothInvoked b) (pending b)
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.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
def bothInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverWorker b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:82
def pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:74
Uses 17 · Used by 2
DefinitionSender service signature of the recurring example#✓fully proved
Static sender and receiver permissions use opposite roles, exact rank7 types.
def senderSignature (r : Role) : ServiceSignature := ⟨0, r, recurringCap⟩
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
structure ServiceSignature where
priority : Nat
role : Role
capability : Capability
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:27
def recurringCap : Capability := ⟨7, recurringProtocol⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:46
Uses 4 · Used by 8
DefinitionReceiver service signature of the recurring example#✓fully proved
Opposite-role receive permission retains the exact literal dual capability.
def receiverSignature (r : Role) : ServiceSignature := ⟨0, r.opposite, recurringCap.dual⟩
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
structure ServiceSignature where
priority : Nat
role : Role
capability : Capability
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:27
def recurringCap : Capability := ⟨7, recurringProtocol⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:46
Uses 6 · Used by 8
DefinitionService environment declaring the two triggers#✓fully proved
Two distinct declared constant triggers; declaration alone is not an offer.
def services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
def senderSignature (r : Role) : ServiceSignature := ⟨0, r, recurringCap⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:28
def receiverSignature (r : Role) : ServiceSignature := ⟨0, r.opposite, recurringCap.dual⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:31
Uses 5 · Used by 24
DefinitionEndpoint distinct from both service triggers#✓fully proved
Session endpoints are physically distinct from BOTH declared shared triggers.
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
Uses 1 · Used by 16
TheoremThe sender trigger declares the sender signature#✓fully proved
Actual sender signature lookup with literal role, cap rank and raw protocol.
theorem sender_declared (r : Role) : (services r).lookup 710 = some (senderSignature r)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
def services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def senderSignature (r : Role) : ServiceSignature := ⟨0, r, recurringCap⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:28
Uses 6 · Used by 3
TheoremThe receiver trigger declares the receiver signature#✓fully proved
The other trigger declares exactly the opposite-role receive permission.
theorem receiver_declared (r : Role) : (services r).lookup 711 = some (receiverSignature r)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
def services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def receiverSignature (r : Role) : ServiceSignature := ⟨0, r.opposite, recurringCap.dual⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:31
Uses 5 · Used by 3
TheoremLifting preserves trigger freshness of an endpoint#✓fully proved
Actual canonical lifting cannot turn a distinct endpoint into a service constant.
theorem EndpointFresh.lift {b : Name} (h : EndpointFresh b) : EndpointFresh (liftName 0 b)
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
def liftName (cutoff : ℕ) : Name → Name
| .const n => .const n
| .var i => if cutoff ≤ i then .var (i + 1) else .var i
CSLibExt/Languages/PiCalculus/Basic.lean:64
Uses 3 · Used by 1
TheoremA fresh endpoint singleton is separated from the triggers#✓fully proved
The exact actual-role singleton does not capture a shared trigger as a linear name.
theorem endpoint_separated (r role : Role) (b : Name) (c : Capability) (hb : EndpointFresh b) :
Separated (services r) (Finmap.singleton (⟨b, role⟩ : Key) c)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
Uses 11 · Used by 4
TheoremErasing a singleton's only key leaves the empty map#✓fully proved
Erasing the actual sole endpoint leaves exactly the empty ownership map. Shared by request and delegation consumers instead of duplicating lookup proofs.
theorem erase_singleton (e : Key) (c : Capability) :
(Finmap.singleton e c : Context).erase e = ∅
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
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
Uses 4 · Used by 2
TheoremNil is runtime-typed with empty ownership#✓fully proved
Nil embeds the finite ranked fragment with genuinely empty ownership.
theorem nil_typed (n : Nat) (Γ : ServiceEnv) : HasType n Γ ∅ .nil
abbrev ServiceEnv := Finmap (fun _ : Nat => ServiceSignature)
CSLibExt/Languages/SessionTypes/Endpoint/SharedEnvironment.lean:33
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 13 · Used by 2
TheoremThe sender reentry request is runtime-typed#✓fully proved
Reentry transfers the actual sender capability out, preserving role/rank/code.
theorem sender_request_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) : HasType n (services r)
(Finmap.singleton (⟨b, r⟩ : Key) recurringCap) (senderRequest b)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
def recurringCap : Capability := ⟨7, recurringProtocol⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:46
def senderRequest (b : Name) : Proc := .out (.const 710) b .nil
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:68
Uses 24 · Used by 2
TheoremThe receiver reentry request is runtime-typed#✓fully proved
Reentry of the opposite role likewise consumes EXACTLY its own linear slot.
theorem receiver_request_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) : HasType n (services r)
(Finmap.singleton (⟨b, r.opposite⟩ : Key) recurringCap.dual) (receiverRequest b)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
def recurringCap : Capability := ⟨7, recurringProtocol⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:46
def receiverRequest (b : Name) : Proc := .out (.const 711) b .nil
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:71
Uses 26 · Used by 3
TheoremThe sender worker is runtime-typed#✓fully proved
One linear session send keeps the same actual guarded protocol cursor and rank.
theorem sender_worker_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) : HasType n (services r)
(Finmap.singleton (⟨b, r⟩ : Key) recurringCap) (senderWorker b)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
def recurringCap : Capability := ⟨7, recurringProtocol⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:46
def senderWorker (b : Name) : Proc := .out b (.const 712) (.out (.const 710) b .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:56
Uses 22 · Used by 3
TheoremThe receiver worker is runtime-typed#✓fully proved
One receive retains the outer received endpoint through its passive input binder.
theorem receiver_worker_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) : HasType n (services r)
(Finmap.singleton (⟨b, r.opposite⟩ : Key) recurringCap.dual) (receiverWorker b)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
def recurringCap : Capability := ⟨7, recurringProtocol⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:46
def receiverWorker (b : Name) : Proc := .inp b (.out (.const 711) (liftName 0 b) .nil)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:59
Uses 31 · Used by 2
TheoremThe sender daemon is typed with empty ownership#✓fully proved
The sender daemon starts with NO captured linear capability, only its fresh formal.
theorem sender_daemon_typed (n : Nat) (r : Role) : HasType n (services r) ∅ senderDaemon
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def senderDaemon : Proc := .repl (.inp (.const 710) (senderWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:62
Uses 16 · Used by 3
TheoremThe receiver daemon is typed with empty ownership#✓fully proved
The receiver daemon likewise captures no linear endpoint, in either orientation.
theorem receiver_daemon_typed (n : Nat) (r : Role) : HasType n (services r) ∅ receiverDaemon
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def receiverDaemon : Proc := .repl (.inp (.const 711) (receiverWorker (.var 0)))
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:65
Uses 16 · Used by 3
DefinitionTwo-role linear interface of the recurring session#✓fully proved
Actual linear interface, one sender role and its opposite receiver role.
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
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
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
def recurringCap : Capability := ⟨7, recurringProtocol⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:46
Uses 8 · Used by 14
TheoremThe pending state is typed at the two-role interface#✓fully proved
The real pending state owns two distinct opposite keys, not daemon captures.
theorem pending_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) : HasType n (services r) (recurringInterface b r) (pending b)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
def pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:74
Uses 24 · Used by 2
TheoremThe state after the sender invocation is typed#✓fully proved
First invocation transfers the exact sender slot into one worker; frame unchanged.
theorem sentInvoked_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) : HasType n (services r) (recurringInterface b r) (sentInvoked b)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
def sentInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:78
Uses 24 · Used by 1
TheoremThe state after both trigger invocations is typed#✓fully proved
Both workers own their actual distinct roles after the two trigger communications.
theorem bothInvoked_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) : HasType n (services r) (recurringInterface b r) (bothInvoked b)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
def bothInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverWorker b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:82
Uses 24 · Used by 1
DefinitionPhases of the repeated-session execution#✓fully proved
Three phases of actual execution; this does not generate unrolled Pi code.
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
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 pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:74
def sentInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:78
def bothInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverWorker b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:82
Uses 5 · Used by 15
TheoremEach phase steps to the next#✓fully proved
Every consecutive phase has a real canonical Step, including session reentry.
theorem phase_step (b : Name) (i : Nat) : PiCalculus.Step (phase b i) (phase b (i + 1))
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.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
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 10 · Used by 6
TheoremEvery round count has a trace returning to the pending state#✓fully proved
For EVERY requested count, a nonzero trace returns to the identical pending code. It has exactly three times (m+1) actual Steps, never a reflexive reachability proof.
theorem repeatable_trace (b : Name) (m : Nat) :
∃ f : Fin (3 * (m + 1) + 1) → Proc,
f ⟨0, by omega⟩ = pending b ∧
f ⟨3 * (m + 1), Nat.lt_succ_self _⟩ = pending b ∧
(∀ i : Fin (3 * (m + 1)), PiCalculus.Step (f i.castSucc) (f i.succ)) ∧
∀ j : Fin (m + 1),
f ⟨3 * j.val + 2, by omega⟩ = bothInvoked b ∧
f ⟨3 * j.val + 3, by omega⟩ = pending b
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
TheoremEvery round has a session action on the same endpoint#✓fully proved
EVERY round contains an actual action on the SAME session endpoint b.
theorem session_round_phase (b : Name) (i : Nat) :
phase b (3 * i + 2) = bothInvoked b ∧ phase b (3 * i + 3) = pending b ∧
PiCalculus.Step (phase b (3 * i + 2)) (phase b (3 * i + 3))
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
def bothInvoked (b : Name) : Proc := .par (.par (senderWorker b) senderDaemon)
(.par (receiverWorker b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:82
def pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:74
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 8 · Used by 3
TheoremEvery phase is typed at the two-role interface#✓fully proved
Every actual runtime phase retains the same exact two-role linear interface.
theorem phase_typed {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) (i : Nat) :
HasType n (services r) (recurringInterface b r) (phase b i)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 15 · Used by 2
TheoremArbitrarily long typed repeated-session traces#✓fully proved
Arbitrarily long NONZERO actual execution with ownership at EVERY state. The conclusion is a trace; no trace/Step/result is part of service admission.
theorem typed_repeatable_trace {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) (m : Nat) :
∃ f : Fin (3 * (m + 1) + 1) → Proc,
f ⟨0, by omega⟩ = pending b ∧
f ⟨3 * (m + 1), Nat.lt_succ_self _⟩ = pending b ∧
(∀ i : Fin (3 * (m + 1)), PiCalculus.Step (f i.castSucc) (f i.succ)) ∧
(∀ i, HasType n (services r) (recurringInterface b r) (f i)) ∧
∀ j : Fin (m + 1),
f ⟨3 * j.val + 2, by omega⟩ = bothInvoked b ∧
f ⟨3 * j.val + 3, by omega⟩ = pending b
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 16
TheoremEvery phase is reachable from the pending state#✓fully proved
Induction on actual Step count reaches each phase of the persistent runtime code.
theorem phase_reachable (b : Name) (i : Nat) :
Relation.ReflTransGen PiCalculus.Step (pending b) (phase b i)
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.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
def pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:74
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 6 · Used by 2
TheoremBoth services are offered at every phase#✓fully proved
Actual unguarded daemons offer BOTH declared services at EVERY runtime phase.
theorem phase_offers (b : Name) (r : Role) (i : Nat) :
Offered (services r) (phase b i) 710 (senderSignature r) ∧
Offered (services r) (phase b i) 711 (receiverSignature r)
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
def Offered (Γ : ServiceEnv) (p : Proc) (s : Nat) (sig : ServiceSignature) : Prop :=
Γ.lookup s = some sig ∧ OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:131
def services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
def senderSignature (r : Role) : ServiceSignature := ⟨0, r, recurringCap⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:28
def receiverSignature (r : Role) : ServiceSignature := ⟨0, r.opposite, recurringCap.dual⟩
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:31
Uses 19 · Used by 1
TheoremThe recurring interface is balanced#✓fully proved
Both literal opposite-role self-loop slots form an ACTUAL balanced initial interface; balance is derived from lookup/code facts, not a ready-pair hypothesis.
theorem recurring_balanced (b : Name) (r : Role) :
Conversion.Balanced (recurringInterface b r)
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
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 recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
Uses 15 · Used by 4
TheoremSemantic advances of the recurring interface are the identity#✓fully proved
EVERY faithful advance of this actual literal self-loop interface is exact identity. This is a code-level property of the concrete regular cursors, not a claim that arbitrary equivalent recursive codes stay syntactically unchanged.
theorem recurring_advance_identity {b : Name} {r : Role} {Ξ : Context}
(h : Conversion.SemanticAdvance (recurringInterface b r) Ξ) : Ξ = recurringInterface b r
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
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
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
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
Uses 23 · Used by 3
TheoremSteps preserve typing at the recurring interface#✓fully proved
ANY actually runtime-typed process at the concrete recurring interface keeps that EXACT interface after a canonical Step, by GENERAL preservation and the literal self-loop code property. No phase, readiness or schedule hypothesis.
theorem recurring_step_preserved {n : Nat} {p q : Proc} (r : Role) (b : Name)
(h : HasType n (services r) (recurringInterface b r) p) (hs : PiCalculus.Step p q) :
HasType n (services r) (recurringInterface b r) q
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
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 14
TheoremEach next phase is typed by subject reduction#✓fully proved
GENERAL runtime subject reduction applies to every recursive phase (hence all THREE phase kinds) in BOTH role orientations, at the exact self-loop interface.
theorem phase_step_preserved {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) (i : Nat) :
HasType n (services r) (recurringInterface b r) (phase b (i + 1))
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 17
TheoremEvery phase is typed by preservation from the pending state#✓fully proved
Every phase's ownership follows from the INITIAL pending typing and GENERAL finite runtime preservation, not repeated application of concrete phase typing.
theorem phase_typed_by_preservation {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) (i : Nat) :
HasType n (services r) (recurringInterface b r) (phase b i)
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def recurringInterface (b : Name) (r : Role) : Context :=
Finmap.singleton ⟨b, r⟩ recurringCap ∪ Finmap.singleton ⟨b, r.opposite⟩ recurringCap.dual
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:154
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 18 · Used by 4
TheoremAll declared services are available in the pending state#✓fully proved
Initial actual replicated daemons supply EVERY declared signature, not just requests or shared permissions. Availability remains a syntactic predicate.
theorem initial_available (b : Name) (r : Role) : Available (services r) (pending b)
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
def Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
def services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def pending (b : Name) : Proc := .par (.par (senderRequest b) senderDaemon)
(.par (receiverRequest b) receiverDaemon)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveTrigger.lean:74
Uses 12 · Used by 1
TheoremServices stay available at every phase#✓fully proved
GENERAL persistent-offer reduction closure preserves the real source daemons through every finite actual prefix of the recursive execution.
theorem phase_available_by_reduction (b : Name) (r : Role) (i : Nat) :
Available (services r) (phase b i)
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
def Available (Γ : ServiceEnv) (p : Proc) : Prop :=
∀ s sig, Γ.lookup s = some sig → OfferedIn s p
CSLibExt/Languages/SessionTypes/Endpoint/PersistentOffers.lean:68
def services (r : Role) : ServiceEnv := (Finmap.singleton 710 (senderSignature r)).insert
711 (receiverSignature r)
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:34
def phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 9 · Used by 4
TheoremRepeated-session traces with preserved typing and availability#✓fully proved
EVERY m has one nonzero finite SAME-session trace with all neighbor Steps, ALL round markers, ownership derived by GENERAL runtime preservation, and actual persistent availability derived by GENERAL reduction closure at EVERY state.
theorem repeatable_trace_preserved {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) (m : Nat) :
∃ f : Fin (3 * (m + 1) + 1) → Proc,
f ⟨0, by omega⟩ = pending b ∧
f ⟨3 * (m + 1), Nat.lt_succ_self _⟩ = pending b ∧
(∀ i : Fin (3 * (m + 1)), PiCalculus.Step (f i.castSucc) (f i.succ)) ∧
(∀ i, HasType n (services r) (recurringInterface b r) (f i)) ∧
(∀ i, Available (services r) (f i)) ∧
∀ j : Fin (m + 1),
f ⟨3 * j.val + 2, by omega⟩ = bothInvoked b ∧
f ⟨3 * j.val + 3, by omega⟩ = pending b
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 18
TheoremEvery phase of the repeated session can step#✓fully proved
GENERAL qualified progress produces an ACTUAL Step at every recursive phase, BOTH roles and arbitrary scoped endpoint. Idle is excluded by exposed output syntax, not by assuming the previously selected execution or readiness.
theorem phase_general_step {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) (i : Nat) : ∃ q, PiCalculus.Step (phase b i) q
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 22 · Used by 1
TheoremEvery phase of the restricted repeated session can step#✓fully proved
GENERAL empty-interface progress includes the genuine private session in BOTH orientations/all phases. Actual output syntax forces its Step branch.
theorem bound_phase_general_step (r : Role) (i : Nat) :
∃ q, PiCalculus.Step (.nu (phase (.var 0) i)) q
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
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 phase (b : Name) (i : Nat) : Proc :=
match i % 3 with
| 0 => pending b
| 1 => sentInvoked b
| _ => bothInvoked b
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveRepeatability.lean:28
Uses 31
TheoremRepeated-session traces with typing, availability and progress#✓fully proved
EVERY m has a SAME-witness counted repeated-session trace, all state types, actual availability and ALL marked session edges, plus GENERAL progress at EVERY state (including the last). This is not all-schedules fairness or termination.
theorem repeatable_trace_global {n : Nat} (r : Role) (b : Name) (hb : b.ClosedAt n)
(hf : EndpointFresh b) (m : Nat) :
∃ f : Fin (3 * (m + 1) + 1) → Proc,
f ⟨0, by omega⟩ = pending b ∧
f ⟨3 * (m + 1), Nat.lt_succ_self _⟩ = pending b ∧
(∀ i : Fin (3 * (m + 1)), PiCalculus.Step (f i.castSucc) (f i.succ)) ∧
(∀ i, HasType n (services r) (recurringInterface b r) (f i)) ∧
(∀ i, Available (services r) (f i)) ∧
(∀ i, ∃ q, PiCalculus.Step (f i) q) ∧
∀ j : Fin (m + 1),
f ⟨3 * j.val + 2, by omega⟩ = bothInvoked b ∧
f ⟨3 * j.val + 3, by omega⟩ = pending b
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
def EndpointFresh (b : Name) : Prop := b ≠ .const 710 ∧ b ≠ .const 711
CSLibExt/Languages/SessionTypes/Endpoint/RecursiveOwnership.lean:38
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 19
TheoremUnguarded shared input communicates with a matching output#✓fully proved
Actual input syntax supplies an ACTUAL canonical Step with any matching shared-constant output. Payload and continuation are not finite-unrolled, and nested private/parallel/replica wrappers are handled by existing Cong/Step.
theorem accept_invocation_step {s : Nat} {p : Proc} (h : AcceptIn s p) (b : Name) (c : Proc) :
∃ q, PiCalculus.Step (.par (.out (.const s) b c) p) q
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
def AcceptIn (s : Nat) : Proc → Prop
| .inp a _ => a = .const s
| .par p q => AcceptIn s p ∨ AcceptIn s q
| .nu p | .repl p => AcceptIn s p
| .nil | .out .. | .sum .. => False
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:69
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.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
Uses 9 · Used by 1
TheoremOffered service communicates with a matching shared output#✓fully proved
A persistent offered input exposes real canonical communication, including nested templates and DONE endpoint payloads; no typing or active-key premise.
theorem offered_invocation_step {s : Nat} {p : Proc} (h : OfferedIn s p) (b : Name) (c : Proc) :
∃ q, PiCalculus.Step (.par (.out (.const s) b c) p) q
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
def OfferedIn (s : Nat) : Proc → Prop
| .repl p => AcceptIn s p
| .par p q => OfferedIn s p ∨ OfferedIn s q
| .nu p => OfferedIn s p
| .nil | .inp .. | .out .. | .sum .. => False
CSLibExt/Languages/SessionTypes/Endpoint/ServiceTemplates.lean:99
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.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
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.