Payload and continuation branches of an endpoint action to Tree equivalence is a congruence for endpoint sending
InductivePayload and continuation branches of an endpoint action#✓fully proved
The two distinct children of an endpoint action.
inductive TypeBranch where
| payload
| continuation
deriving DecidableEq
InductiveLabels of observable protocol-tree edges#✓fully proved
Observable guarded tree edges. Endpoint metadata is never erased.
inductive TypeLabel where
| sendName
| recvName
| sendEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
| recvEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
deriving DecidableEq
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
inductive TypeBranch where
| payload
| continuation
deriving DecidableEq
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:27
Uses 2 · Used by 11
InductiveVisible edge of a protocol tree after root unfolding#✓fully proved
One visible tree edge obtained by the existing guarded root unfolding.
inductive TypeEdge : Protocol → TypeLabel → Protocol → Prop where
| sendName {p s : Protocol} : p.unfold = .sendName s → TypeEdge p .sendName s
| recvName {p s : Protocol} : p.unfold = .recvName s → TypeEdge p .recvName s
| sendPayload {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .sendEndpoint r k t s → TypeEdge p (.sendEndpoint r k .payload) t
| sendNext {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .sendEndpoint r k t s → TypeEdge p (.sendEndpoint r k .continuation) s
| recvPayload {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .recvEndpoint r k t s → TypeEdge p (.recvEndpoint r k .payload) t
| recvNext {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .recvEndpoint r k t s → TypeEdge p (.recvEndpoint r k .continuation) s
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive TypeLabel where
| sendName
| recvName
| sendEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
| recvEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
deriving DecidableEq
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:33
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
DefinitionLabelled transition system of protocol-tree observations#✓fully proved
Canonical CSLib LTS instance for guarded type-tree observations only.
def protocolTree : Cslib.LTS Protocol TypeLabel := ⟨TypeEdge⟩
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive TypeLabel where
| sendName
| recvName
| sendEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
| recvEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
deriving DecidableEq
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:33
inductive TypeEdge : Protocol → TypeLabel → Protocol → Prop where
| sendName {p s : Protocol} : p.unfold = .sendName s → TypeEdge p .sendName s
| recvName {p s : Protocol} : p.unfold = .recvName s → TypeEdge p .recvName s
| sendPayload {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .sendEndpoint r k t s → TypeEdge p (.sendEndpoint r k .payload) t
| sendNext {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .sendEndpoint r k t s → TypeEdge p (.sendEndpoint r k .continuation) s
| recvPayload {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .recvEndpoint r k t s → TypeEdge p (.recvEndpoint r k .payload) t
| recvNext {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .recvEndpoint r k t s → TypeEdge p (.recvEndpoint r k .continuation) s
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:41
Uses 3 · Used by 8
DefinitionRegular-tree equivalence of protocols as bisimilarity#✓fully proved
Equirecursive regular-tree equality is canonical strong bisimilarity, not equality of graph codes, cursors or finite constructor syntax.
def Protocol.TreeEquiv : Protocol → Protocol → Prop := Cslib.LTS.HomBisimilarity protocolTree
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 protocolTree : Cslib.LTS Protocol TypeLabel := ⟨TypeEdge⟩
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:54
Uses 3 · Used by 68
TheoremProtocol tree equivalence is reflexive#✓fully proved
Reflexivity comes from the canonical CSLib bisimilarity API.
theorem Protocol.TreeEquiv.refl (p : Protocol) : p.TreeEquiv p
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
Uses 4 · Used by 3
TheoremProtocol tree equivalence is symmetric#✓fully proved
Symmetry comes from the canonical CSLib bisimilarity API.
theorem Protocol.TreeEquiv.symm {p q : Protocol} (h : p.TreeEquiv q) : q.TreeEquiv p
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
Uses 4 · Used by 9
TheoremProtocol tree equivalence is transitive#✓fully proved
Transitivity comes from composition of canonical CSLib bisimulations.
theorem Protocol.TreeEquiv.trans {p q r : Protocol} (h : p.TreeEquiv q)
(h' : q.TreeEquiv r) : p.TreeEquiv r
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
Uses 4 · Used by 3
TheoremRoot unfolding preserves protocol-tree edges#✓fully proved
Root unfolding exposes exactly the same observation edges.
theorem typeEdge_unfold {p q : Protocol} {l : TypeLabel} :
TypeEdge p.unfold l q ↔ TypeEdge p l q
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive TypeLabel where
| sendName
| recvName
| sendEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
| recvEndpoint (role : Role) (rank : Nat) (branch : TypeBranch)
deriving DecidableEq
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:33
inductive TypeEdge : Protocol → TypeLabel → Protocol → Prop where
| sendName {p s : Protocol} : p.unfold = .sendName s → TypeEdge p .sendName s
| recvName {p s : Protocol} : p.unfold = .recvName s → TypeEdge p .recvName s
| sendPayload {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .sendEndpoint r k t s → TypeEdge p (.sendEndpoint r k .payload) t
| sendNext {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .sendEndpoint r k t s → TypeEdge p (.sendEndpoint r k .continuation) s
| recvPayload {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .recvEndpoint r k t s → TypeEdge p (.recvEndpoint r k .payload) t
| recvNext {p t s : Protocol} {r : Role} {k : Nat} :
p.unfold = .recvEndpoint r k t s → TypeEdge p (.recvEndpoint r k .continuation) s
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:41
Uses 7 · Used by 1
TheoremA protocol is tree-equivalent to its unfolding#✓fully proved
One unfolding is semantically equivalent even though its code changes.
theorem Protocol.treeEquiv_unfold (p : Protocol) : p.TreeEquiv p.unfold
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
Uses 7 · Used by 1
InductiveHead and branch matching of protocols up to a child relation#✓fully proved
Exact head and branch correspondence for a relation on child trees. Payload and continuation are related separately; only metadata is literal.
inductive HeadMatch (R : Protocol → Protocol → Prop) : Protocol → Protocol → Prop where
| done : HeadMatch R .done .done
| sendName {s t : Protocol} : R s t → HeadMatch R (.sendName s) (.sendName t)
| recvName {s t : Protocol} : R s t → HeadMatch R (.recvName s) (.recvName t)
| sendEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.sendEndpoint r k p s) (.sendEndpoint r k q t)
| recvEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.recvEndpoint r k p s) (.recvEndpoint r k q t)
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
Uses 2 · Used by 21
TheoremHead matching is monotone in the child relation#✓fully proved
Head matching is monotone in the child relation.
theorem HeadMatch.mono {R S : Protocol → Protocol → Prop} {p q : Protocol}
(h : HeadMatch R p q) (hrs : ∀ a b, R a b → S a b) : HeadMatch S p q
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive HeadMatch (R : Protocol → Protocol → Prop) : Protocol → Protocol → Prop where
| done : HeadMatch R .done .done
| sendName {s t : Protocol} : R s t → HeadMatch R (.sendName s) (.sendName t)
| recvName {s t : Protocol} : R s t → HeadMatch R (.recvName s) (.recvName t)
| sendEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.sendEndpoint r k p s) (.sendEndpoint r k q t)
| recvEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.recvEndpoint r k p s) (.recvEndpoint r k q t)
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:93
Uses 3 · Used by 2
TheoremHead-matching relations are bisimulations#✓fully proved
A relation matching literal unfolded heads and both child branches is a canonical CSLib bisimulation. This is the coinductive proof rule, not an axiom.
theorem headMatch_isBisimulation {R : Protocol → Protocol → Prop}
(hR : ∀ p q, R p q → HeadMatch R p.unfold q.unfold) :
Cslib.LTS.IsBisimulation protocolTree protocolTree R
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive HeadMatch (R : Protocol → Protocol → Prop) : Protocol → Protocol → Prop where
| done : HeadMatch R .done .done
| sendName {s t : Protocol} : R s t → HeadMatch R (.sendName s) (.sendName t)
| recvName {s t : Protocol} : R s t → HeadMatch R (.recvName s) (.recvName t)
| sendEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.sendEndpoint r k p s) (.sendEndpoint r k q t)
| recvEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.recvEndpoint r k p s) (.recvEndpoint r k q t)
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:93
def protocolTree : Cslib.LTS Protocol TypeLabel := ⟨TypeEdge⟩
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:54
Uses 9 · Used by 1
TheoremTree-equivalent protocols have matching heads#✓fully proved
Canonical bisimilarity determines literal head metadata and both semantically equivalent child branches. No graph-code equality is required.
theorem Protocol.TreeEquiv.head {p q : Protocol} (h : p.TreeEquiv q) :
HeadMatch Protocol.TreeEquiv p.unfold q.unfold
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive HeadMatch (R : Protocol → Protocol → Prop) : Protocol → Protocol → Prop where
| done : HeadMatch R .done .done
| sendName {s t : Protocol} : R s t → HeadMatch R (.sendName s) (.sendName t)
| recvName {s t : Protocol} : R s t → HeadMatch R (.recvName s) (.recvName t)
| sendEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.sendEndpoint r k p s) (.sendEndpoint r k q t)
| recvEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.recvEndpoint r k p s) (.recvEndpoint r k q t)
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:93
def Protocol.TreeEquiv : Protocol → Protocol → Prop := Cslib.LTS.HomBisimilarity protocolTree
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:58
Uses 11 · Used by 12
TheoremCoinduction principle for protocol tree equivalence#✓fully proved
Coinduction on an explicitly supplied tree relation, checked by CSLib.
theorem Protocol.TreeEquiv.coind {R : Protocol → Protocol → Prop}
(hR : ∀ a b, R a b → HeadMatch R a.unfold b.unfold) {p q : Protocol}
(hpq : R p q) : p.TreeEquiv q
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive HeadMatch (R : Protocol → Protocol → Prop) : Protocol → Protocol → Prop where
| done : HeadMatch R .done .done
| sendName {s t : Protocol} : R s t → HeadMatch R (.sendName s) (.sendName t)
| recvName {s t : Protocol} : R s t → HeadMatch R (.recvName s) (.recvName t)
| sendEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.sendEndpoint r k p s) (.sendEndpoint r k q t)
| recvEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.recvEndpoint r k p s) (.recvEndpoint r k q t)
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:93
Uses 7 · Used by 2
TheoremCharacterization of tree equivalence by matching heads#✓fully proved
Exact semantic root/branch characterization, in BOTH directions.
theorem Protocol.treeEquiv_iff_head {p q : Protocol} :
p.TreeEquiv q ↔ HeadMatch Protocol.TreeEquiv p.unfold q.unfold
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive HeadMatch (R : Protocol → Protocol → Prop) : Protocol → Protocol → Prop where
| done : HeadMatch R .done .done
| sendName {s t : Protocol} : R s t → HeadMatch R (.sendName s) (.sendName t)
| recvName {s t : Protocol} : R s t → HeadMatch R (.recvName s) (.recvName t)
| sendEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.sendEndpoint r k p s) (.sendEndpoint r k q t)
| recvEndpoint {r : Role} {k : Nat} {p q s t : Protocol} :
R p q → R s t → HeadMatch R (.recvEndpoint r k p s) (.recvEndpoint r k q t)
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:93
def Protocol.TreeEquiv : Protocol → Protocol → Prop := Cslib.LTS.HomBisimilarity protocolTree
CSLibExt/Languages/SessionTypes/Endpoint/TypeEquivalence.lean:58
Uses 7 · Used by 4
TheoremUnfolding both protocols preserves and reflects tree equivalence#✓fully proved
Unfolding on either or both sides leaves the regular tree unchanged.
theorem Protocol.treeEquiv_unfold_iff {p q : Protocol} :
p.unfold.TreeEquiv q.unfold ↔ p.TreeEquiv q
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
Uses 6
TheoremTree equivalence is a congruence for name sending#✓fully proved
Constructor congruence matches same-direction name continuations.
theorem Protocol.TreeEquiv.sendName {p q : Protocol} (h : p.TreeEquiv q) :
(Protocol.sendName p).TreeEquiv (.sendName q)
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
TheoremTree equivalence is a congruence for name receiving#✓fully proved
Constructor congruence also matches input direction separately.
theorem Protocol.TreeEquiv.recvName {p q : Protocol} (h : p.TreeEquiv q) :
(Protocol.recvName p).TreeEquiv (.recvName q)
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
TheoremTree equivalence is a congruence for endpoint sending#✓fully proved
Payload and continuation congruence do not conflate the two branches.
theorem Protocol.TreeEquiv.sendEndpoint {p q s t : Protocol} (hp : p.TreeEquiv q)
(hs : s.TreeEquiv t) (r : Role) (k : Nat) :
(Protocol.sendEndpoint r k p s).TreeEquiv (.sendEndpoint r k q t)
inductive Protocol where
| done
| sendName (next : Protocol)
| recvName (next : Protocol)
| sendEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| recvEndpoint (role : Role) (rank : Nat) (payload next : Protocol)
| regular (graph : Graph) (cursor : Fin graph.size) (reversed : Bool)
CSLibExt/Languages/SessionTypes/Endpoint/Protocol.lean:26
inductive Role where
| positive
| negative
deriving DecidableEq, Repr
CSLibExt/Languages/SessionTypes/Endpoint/Identity.lean:24
Uses 6 · Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.