Reverse restriction swap preserves conversion typing to Erasing a key whose name is absent preserves conversion ranked typing
TheoremReverse restriction swap preserves conversion typing#✓fully proved
Reverse nested restriction commutation uses the canonical involution.
theorem HasType.nu_swap_reverse {n : Nat} {Δ : Context} {p : Proc}
(h : HasType n Δ (.nu (.nu (swapProc 0 p)))) : HasType n Δ (.nu (.nu p))
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 → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
def swapProc (cutoff : ℕ) : Proc → Proc
| .nil => .nil
| .out a b p => .out (swapNameAt cutoff a) (swapNameAt cutoff b) (swapProc cutoff p)
| .inp a p => .inp (swapNameAt cutoff a) (swapProc (cutoff + 1) p)
| .par p q => .par (swapProc cutoff p) (swapProc cutoff q)
| .nu p => .nu (swapProc (cutoff + 1) p)
| .repl p => .repl (swapProc cutoff p)
| .sum p q => .sum (swapProc cutoff p) (swapProc cutoff q)
CSLibExt/Languages/PiCalculus/Basic.lean:119
Uses 6 · Used by 1
TheoremStructural congruence preserves conversion typing#✓fully proved
Every existing canonical structural congruence preserves endpoint typing in both directions with exactly the same depth and ownership. Unsupported choice/replication shapes are rejected by the typing-derived finite invariant.
theorem HasType.cong_iff {n : Nat} {Δ : Context} {p q : Proc} (hc : Cong p q) :
HasType n Δ p ↔ HasType n Δ q
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
inductive HasType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
Uses 31 · Used by 1
TheoremSubject reduction at a compatible conversion interface#✓fully proved
From a typed source at an initially compatible interface, all five canonical reduction constructors preserve typing and compatibility, with one matched external subject-pair advancement or an unchanged interface when communication is private. No fragment or enabled-edge premise is required.
theorem HasType.subject_reduction {n : Nat} {Δ : Context} {p q : Proc}
(h : HasType n Δ p) (hco : Compatible Δ) (hs : PiCalculus.Step p q) :
∃ Ξ, HasType n Ξ q ∧ Compatible Ξ ∧ (Ξ = Δ ∨ SemanticAdvance Δ Ξ)
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 → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
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 29 · Used by 3
TheoremSubject reduction at a balanced interface#✓fully proved
A typed source with a balanced initial interface retains typing and balance after any canonical step. Balance supplies the required compatibility; the exact zero-or-one external advancement evidence is retained.
theorem HasType.subject_reduction_balanced {n : Nat} {Δ : Context} {p q : Proc}
(h : HasType n Δ p) (hb : Balanced Δ) (hs : PiCalculus.Step p q) :
∃ Ξ, HasType n Ξ q ∧ Balanced Ξ ∧ (Ξ = Δ ∨ SemanticAdvance Δ Ξ)
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 → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
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 at the empty interface#✓fully proved
An empty-interface typed network retains empty-interface typing through any canonical step. The empty context is balanced, hence compatible, including communication behind restrictions and pre/post congruence.
theorem HasType.subject_reduction_empty {n : Nat} {p q : Proc}
(h : HasType n ∅ p) (hs : PiCalculus.Step p q) : HasType n ∅ 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 HasType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
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 20 · Used by 1
TheoremTyping and compatibility persist along finite executions#✓fully proved
A typed source at an initially semantically compatible interface retains typing and compatibility through finite actual execution, with a finite trace of faithful advances. This is safety, not progress or termination.
theorem HasType.reachable {n : Nat} {Δ : Context} {p q : Proc} (h : HasType n Δ p)
(hc : Compatible Δ) (hr : Relation.ReflTransGen PiCalculus.Step p q) :
∃ Ξ, HasType n Ξ q ∧ Compatible Ξ ∧ Relation.ReflTransGen SemanticAdvance Δ Ξ
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 → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
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
TheoremEmpty-interface typing persists along finite executions#✓fully proved
Every finite reachable closed state retains the exact empty interface.
theorem HasType.reachable_empty {n : Nat} {p q : Proc} (h : HasType n ∅ p)
(hr : Relation.ReflTransGen PiCalculus.Step p q) : HasType n ∅ 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 HasType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
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
InductivePriority-ranked conversion typing judgement#✓fully proved
Linear ownership typing with a strict priority check at every guard. There is no reduction, enabled-edge, progress or preservation field.
Cslib.SessionTypes.Endpoint.Conversion.RankedType · 34 lines
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
RankedType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
RankedType n Δ (.inp e.name p)
| outEndpoint {n : Nat} {Δ : Context} {e d : Key} {c v : Capability}
{k : Nat} {t s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c →
c.protocol.unfold = .sendEndpoint d.role k t s →
Δ.lookup d = some v → v.Equivalent ⟨k, t⟩ → e ≠ d →
e.name.ClosedAt n → d.name.ClosedAt n →
RankedType n ((Δ.erase d).insert e ⟨c.rank, s⟩) p →
RankedType n Δ (.out e.name d.name p)
| inpEndpoint {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{r : Role} {k : Nat} {t s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c →
c.protocol.unfold = .recvEndpoint r k t s → e.name.ClosedAt n →
RankedType (n + 1)
((Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)).insert ⟨.var 0, r⟩ ⟨k, t⟩) p →
RankedType n Δ (.inp e.name p)
| par {n : Nat} {Δ Θ : Context} {p q : Proc} :
Finmap.Disjoint Δ Θ → RankedType n Δ p → RankedType n Θ q →
RankedType n (Δ ∪ Θ) (.par p q)
| nu {n : Nat} {Δ : Context} {c : Capability} {p : Proc} :
RankedType (n + 1) (Context.bind c Δ) p → RankedType n Δ (.nu p)
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
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 GuardMin (Δ : Context) (e : Key) (rank : Nat) : Prop :=
∀ d c, Δ.lookup d = some c → c.protocol.unfold ≠ .done →
d ≠ e → rank < c.rank
CSLibExt/Languages/SessionTypes/Endpoint/Priority.lean:26
def Context.lift (k : Nat) (Δ : Context) : Context :=
rekey (Key.mapName (liftName k)) Δ
(fun _ _ _ _ h => Key.mapName_injective (liftName_injective k) h)
CSLibExt/Languages/SessionTypes/Endpoint/ContextTransport.lean:28
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
def Context.bind (c : Capability) (Δ : Context) : Context :=
(lift 0 Δ).insert ⟨.var 0, .positive⟩ c |>
Finmap.insert ⟨.var 0, .negative⟩ c.dual
CSLibExt/Languages/SessionTypes/Endpoint/ContextTransport.lean:49
Uses 14 · Used by 55
TheoremForgetting priorities yields conversion typing#✓fully proved
Forgetting guard priorities derives the existing conversion judgement.
theorem RankedType.hasType {n : Nat} {Δ : Context} {p : Proc}
(h : RankedType n Δ p) : HasType n Δ p
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 RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
inductive HasType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
Uses 16 · Used by 9
TheoremRanked typing embeds into conversion ranked typing#✓fully proved
Explicit seven-case raw-ranked embedding, not theorem-value inheritance.
theorem RankedType.of_raw {n : Nat} {Δ : Context} {p : Proc}
(h : Endpoint.RankedType n Δ p) : RankedType n Δ p
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 RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedTyping.lean:31
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
Uses 17
TheoremParallel inversion for conversion ranked typing#✓fully proved
Ranked parallel typing exposes its actual disjoint ownership split.
theorem RankedType.par_inv {n : Nat} {Δ : Context} {p q : Proc}
(h : RankedType n Δ (.par p q)) :
∃ Γ Θ, Δ = Γ ∪ Θ ∧ Finmap.Disjoint Γ Θ ∧ RankedType n Γ p ∧ RankedType n Θ q
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 RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
Uses 15 · Used by 10
TheoremRestriction inversion for conversion ranked typing#✓fully proved
Restriction chooses an actual literal-dual pair.
theorem RankedType.nu_inv {n : Nat} {Δ : Context} {p : Proc}
(h : RankedType n Δ (.nu p)) : ∃ c, RankedType (n + 1) (Context.bind c Δ) p
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 RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
def Context.bind (c : Capability) (Δ : Context) : Context :=
(lift 0 Δ).insert ⟨.var 0, .positive⟩ c |>
Finmap.insert ⟨.var 0, .negative⟩ c.dual
CSLibExt/Languages/SessionTypes/Endpoint/ContextTransport.lean:49
Uses 15 · Used by 6
TheoremNil typing lifts to conversion ranked typing#✓fully proved
Nil adds no priority premise beyond actual completed and scoped ownership.
theorem RankedType.nil_of_hasType {n : Nat} {Δ : Context} (h : HasType n Δ .nil) :
RankedType n Δ .nil
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive HasType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → HasType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
Δ.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} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
Δ.lookup e = some c → c.protocol.unfold = .recvName s → e.name.ClosedAt n →
HasType (n + 1) (Context.lift 0 (Δ.insert e ⟨c.rank, s⟩)) p →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/ConversionTyping.lean:69
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
Uses 10 · Used by 2
TheoremConversion-ranked output subjects are active#✓fully proved
Literal output is active and checks every other owned active key.
theorem RankedType.out_active {n : Nat} {Δ : Context} {a b : Name} {p : Proc}
(h : RankedType n Δ (.out a b p)) :
∃ e c, e.name = a ∧ Δ.lookup e = some c ∧ c.protocol.unfold ≠ .done ∧ GuardMin Δ e c.rank
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
def GuardMin (Δ : Context) (e : Key) (rank : Nat) : Prop :=
∀ d c, Δ.lookup d = some c → c.protocol.unfold ≠ .done →
d ≠ e → rank < c.rank
CSLibExt/Languages/SessionTypes/Endpoint/Priority.lean:26
Uses 16 · Used by 3
TheoremConversion-ranked input subjects are active#✓fully proved
Literal input is active before either payload kind is received.
theorem RankedType.inp_active {n : Nat} {Δ : Context} {a : Name} {p : Proc}
(h : RankedType n Δ (.inp a p)) :
∃ e c, e.name = a ∧ Δ.lookup e = some c ∧ c.protocol.unfold ≠ .done ∧ GuardMin Δ e c.rank
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Name where
| const (n : ℕ) : Name
| var (i : ℕ) : Name
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:45
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
def GuardMin (Δ : Context) (e : Key) (rank : Nat) : Prop :=
∀ d c, Δ.lookup d = some c → c.protocol.unfold ≠ .done →
d ≠ e → rank < c.rank
CSLibExt/Languages/SessionTypes/Endpoint/Priority.lean:26
Uses 16 · Used by 3
TheoremMinimum active role is the subject of a conversion frontier leaf#✓fully proved
A minimum active role is exposed as the EXACT subject of an actual leaf. The disjoint ownership split and canonical rearrangement are DERIVED outputs; no ready guard or normalizing typing result is required from the caller.
theorem GuardFrontier.expose_minimum {n : Nat} {Δ : Context} {p : Proc}
(hf : GuardFrontier p) (ht : RankedType n Δ p) {e : Key} {c : Capability}
(he : Δ.lookup e = some c) (ha : c.protocol.unfold ≠ .done)
(hmin : ∀ x v, Δ.lookup x = some v → v.protocol.unfold ≠ .done → c.rank ≤ v.rank) :
∃ Γ Θ g r, Δ = Γ ∪ Θ ∧ Finmap.Disjoint Γ Θ ∧ Γ.lookup e = some c ∧
Cong p (.par g r) ∧ RankedType n Γ g ∧ RankedType n Θ r ∧
((∃ b t, g = .out e.name b t) ∨ (∃ t, g = .inp e.name t)) ∧ GuardFrontier r
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 GuardFrontier : Proc → Prop where
| nil : GuardFrontier .nil
| out (a b : Name) (p : Proc) : GuardFrontier (.out a b p)
| inp (a : Name) (p : Proc) : GuardFrontier (.inp a p)
| par {p q : Proc} : GuardFrontier p → GuardFrontier q → GuardFrontier (.par p q)
CSLibExt/Languages/SessionTypes/Endpoint/FrontierNormalization.lean:29
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
inductive Cong : Proc → Proc → Prop
| refl (p : Proc) : Cong p p
| symm {p q : Proc} : Cong p q → Cong q p
| trans {p q r : Proc} : Cong p q → Cong q r → Cong p r
| par_comm (p q : Proc) : Cong (.par p q) (.par q p)
| par_assoc (p q r : Proc) : Cong (.par (.par p q) r) (.par p (.par q r))
| par_nil (p : Proc) : Cong (.par p .nil) p
| par_cong {p p' q q' : Proc} : Cong p p' → Cong q q' →
Cong (.par p q) (.par p' q')
| nu_cong {p p' : Proc} : Cong p p' → Cong (.nu p) (.nu p')
| scope (p q : Proc) :
Cong (.par (.nu p) q) (.nu (.par p (liftProc 0 q)))
⋯
CSLibExt/Languages/PiCalculus/Basic.lean:137
Uses 20 · Used by 1
TheoremCompleted conversion-ranked frontiers are congruent to nil#✓fully proved
A frontier with no active ownership cannot contain a live prefix. Completion is the PROCESS congruence to nil, not a completed empty interface.
theorem GuardFrontier.completed_nil {n : Nat} {Δ : Context} {p : Proc}
(hf : GuardFrontier p) (ht : RankedType n Δ p) (hc : Δ.Completed) : Cong p .nil
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 GuardFrontier : Proc → Prop where
| nil : GuardFrontier .nil
| out (a b : Name) (p : Proc) : GuardFrontier (.out a b p)
| inp (a : Name) (p : Proc) : GuardFrontier (.inp a p)
| par {p q : Proc} : GuardFrontier p → GuardFrontier q → GuardFrontier (.par p q)
CSLibExt/Languages/SessionTypes/Endpoint/FrontierNormalization.lean:29
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
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 16 · Used by 1
TheoremMinimum guard leaf cannot own an equivalent dual peer#✓fully proved
A semantic equal-rank active peer cannot inhabit the selected minimum guard.
theorem minimum_peer_separate {n : Nat} {Γ : Context} {g : Proc} {e : Key} {c d : Capability}
(ht : RankedType n Γ g) (he : Γ.lookup e = some c) (ha : c.protocol.unfold ≠ .done)
(hmin : ∀ x v, Γ.lookup x = some v → v.protocol.unfold ≠ .done → c.rank ≤ v.rank)
(hshape : (∃ b t, g = .out e.name b t) ∨ (∃ t, g = .inp e.name t))
(hd : d.Equivalent c.dual) : Γ.lookup e.opposite ≠ some d
abbrev Context := Finmap (fun _ : Key => Capability)
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:32
inductive Proc where
| nil : Proc
| out (a b : Name) (p : Proc) : Proc
| inp (a : Name) (p : Proc) : Proc
| par (p q : Proc) : Proc
| nu (p : Proc) : Proc
| repl (p : Proc) : Proc
| sum (p q : Proc) : Proc
deriving DecidableEq, Repr
CSLibExt/Languages/PiCalculus/Basic.lean:52
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
structure Capability where
rank : Nat
protocol : Protocol
CSLibExt/Languages/SessionTypes/Endpoint/Context.lean:27
inductive RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
Uses 21 · Used by 1
TheoremWeakening conversion ranked typing by a completed capability#✓fully proved
Adding a fresh completed capability preserves every guard inequality through all seven rules. No active capability can be added by this theorem.
theorem RankedType.weaken_completed {n : Nat} {Δ : Context} {p : Proc}
(h : RankedType n Δ p) {z : Key} {u : Capability} (hz : z ∉ Δ)
(hu : u.protocol.unfold = .done) (hscope : z.name.ClosedAt n) :
RankedType n (Δ.insert z u) p
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 RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
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
Uses 28 · Used by 2
TheoremErasing a key whose name is absent preserves conversion ranked typing#✓fully proved
Actual all-position physical-name absence permits erasure in the refinement too. Subject and payload lookup obligations are never discarded.
theorem RankedType.erase_nameAbsent {n : Nat} {Δ : Context} {p : Proc}
(h : RankedType n Δ p) {z : Key} (hab : NameAbsent z.name p) :
RankedType n (Δ.erase z) p
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 RankedType : Nat → Context → Proc → Prop where
| nil {n : Nat} {Δ : Context} :
Δ.Completed → (∀ e ∈ Δ, e.name.ClosedAt n) → RankedType n Δ .nil
| outName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{b : Name} {s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .sendName s →
e.name.ClosedAt n → b.ClosedAt n →
RankedType n (Δ.insert e ⟨c.rank, s⟩) p → RankedType n Δ (.out e.name b p)
| inpName {n : Nat} {Δ : Context} {e : Key} {c : Capability}
{s : Protocol} {p : Proc} :
GuardMin Δ e c.rank → Δ.lookup e = some c → c.protocol.unfold = .recvName s →
e.name.ClosedAt n →
⋯
CSLibExt/Languages/SessionTypes/Endpoint/RankedConversionTyping.lean:30
structure Key where
name : PiCalculus.Name
role : Role
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:30
def NameAbsent (a : Name) : Proc → Prop
| .nil => True
| .out b c p => a ≠ b ∧ a ≠ c ∧ NameAbsent a p
| .inp b p => a ≠ b ∧ NameAbsent (liftName 0 a) p
| .par p q | .sum p q => NameAbsent a p ∧ NameAbsent a q
| .nu p => NameAbsent (liftName 0 a) p
| .repl p => NameAbsent a p
CSLibExt/Languages/SessionTypes/Endpoint/NameAbsence.lean:29
Uses 26 · Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.