@@ -86,14 +86,14 @@ def LTS.IsBisimulation (lts : LTS State Label) (r : State → State → Prop) :
8686
8787/-- Helper for following a transition by the first state in a pair of a `Bisimulation`. -/
8888theorem LTS.IsBisimulation.follow_fst
89- (hb : lts.IsBisimulation r) (hr : r s1 s2) (htr : lts.Tr s1 μ s1') :
90- ∃ s2', lts.Tr s2 μ s2' ∧ r s1' s2' :=
89+ (hb : lts.IsBisimulation r) (hr : r s1 s2) (htr : lts.Tr s1 μ s1') :
90+ ∃ s2', lts.Tr s2 μ s2' ∧ r s1' s2' :=
9191 (hb hr μ).1 _ htr
9292
9393/-- Helper for following a transition by the second state in a pair of a `Bisimulation`. -/
9494theorem LTS.IsBisimulation.follow_snd
95- (hb : lts.IsBisimulation r) (hr : r s1 s2) (htr : lts.Tr s2 μ s2') :
96- ∃ s1', lts.Tr s1 μ s1' ∧ r s1' s2' :=
95+ (hb : lts.IsBisimulation r) (hr : r s1 s2) (htr : lts.Tr s2 μ s2') :
96+ ∃ s1', lts.Tr s1 μ s1' ∧ r s1' s2' :=
9797 (hb hr μ).2 _ htr
9898
9999/-- Two states are bisimilar if they are related by some bisimulation. -/
@@ -130,14 +130,14 @@ theorem Bisimilarity.symm {s1 s2 : State} (h : s1 ~[lts] s2) : s2 ~[lts] s1 := b
130130/-- The composition of two bisimulations is a bisimulation. -/
131131@ [scoped grind .]
132132theorem LTS.IsBisimulation.comp
133- (h1 : lts.IsBisimulation r1) (h2 : lts.IsBisimulation r2) :
133+ (h1 : lts.IsBisimulation r1) (h2 : lts.IsBisimulation r2) :
134134 lts.IsBisimulation (Relation.Comp r1 r2) := by grind [Relation.Comp]
135135
136136open LTS in
137137/-- Bisimilarity is transitive. -/
138138@ [scoped grind →]
139139theorem Bisimilarity.trans
140- (h1 : s1 ~[lts] s2) (h2 : s2 ~[lts] s3) :
140+ (h1 : s1 ~[lts] s2) (h2 : s2 ~[lts] s3) :
141141 s1 ~[lts] s3 := by
142142 obtain ⟨r1, _, _⟩ := h1
143143 obtain ⟨r2, _, _⟩ := h2
@@ -215,7 +215,7 @@ theorem Bisimilarity.largest_bisimulation (h : lts.IsBisimulation r) :
215215/-- The union of bisimilarity with any bisimulation is bisimilarity. -/
216216@ [scoped grind =, simp]
217217theorem Bisimilarity.gfp (r : State → State → Prop ) (h : lts.IsBisimulation r) :
218- (Bisimilarity lts) ⊔ r = Bisimilarity lts := by
218+ (Bisimilarity lts) ⊔ r = Bisimilarity lts := by
219219 funext s1 s2
220220 simp only [max, SemilatticeSup.sup, eq_iff_iff, or_iff_left_iff_imp]
221221 apply Bisimilarity.largest_bisimulation h
@@ -349,8 +349,8 @@ theorem LTS.IsBisimulationUpTo.isBisimulation (h : lts.IsBisimulationUpTo r) :
349349/-- If two states are related by a bisimulation, they can mimic each other's multi-step
350350transitions. -/
351351theorem Bisimulation.bisim_trace
352- (hb : lts.IsBisimulation r) (hr : r s1 s2) :
353- ∀ μs s1', lts.MTr s1 μs s1' → ∃ s2', lts.MTr s2 μs s2' ∧ r s1' s2' := by
352+ (hb : lts.IsBisimulation r) (hr : r s1 s2) :
353+ ∀ μs s1', lts.MTr s1 μs s1' → ∃ s2', lts.MTr s2 μs s2' ∧ r s1' s2' := by
354354 intro μs
355355 induction μs generalizing s1 s2
356356 case nil =>
@@ -383,8 +383,8 @@ theorem Bisimulation.bisim_trace
383383/-- Any bisimulation implies trace equivalence. -/
384384@ [scoped grind =>]
385385theorem LTS.IsBisimulation.traceEq
386- (hb : lts.IsBisimulation r) (hr : r s1 s2) :
387- s1 ~tr[lts] s2 := by
386+ (hb : lts.IsBisimulation r) (hr : r s1 s2) :
387+ s1 ~tr[lts] s2 := by
388388 funext μs
389389 simp only [eq_iff_iff]
390390 constructor
@@ -424,7 +424,8 @@ private inductive BisimMotTr : ℕ → Char → ℕ → Prop where
424424/-- In general, trace equivalence is not a bisimulation (extra conditions are needed, see for
425425example `Bisimulation.deterministic_trace_eq_is_bisim`). -/
426426theorem Bisimulation.traceEq_not_bisim :
427- ∃ (State : Type ) (Label : Type ) (lts : LTS State Label), ¬(lts.IsBisimulation (TraceEq lts)) := by
427+ ∃ (State : Type ) (Label : Type ) (lts : LTS State Label),
428+ ¬(lts.IsBisimulation (TraceEq lts)) := by
428429 exists ℕ
429430 exists Char
430431 let lts := LTS.mk BisimMotTr
@@ -810,9 +811,9 @@ def LTS.IsSWBisimulation [HasTau Label] (lts : LTS State Label) (r : State → S
810811/-- Utility theorem for 'following' internal transitions using an `SWBisimulation`
811812(first component, weighted version). -/
812813theorem SWBisimulation.follow_internal_fst_n
813- [HasTau Label] {lts : LTS State Label}
814- (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstrN : lts.STrN n s1 HasTau.τ s1') :
815- ∃ s2', lts.STr s2 HasTau.τ s2' ∧ r s1' s2' := by
814+ [HasTau Label] {lts : LTS State Label}
815+ (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstrN : lts.STrN n s1 HasTau.τ s1') :
816+ ∃ s2', lts.STr s2 HasTau.τ s2' ∧ r s1' s2' := by
816817 cases n
817818 case zero =>
818819 cases hstrN
@@ -837,9 +838,9 @@ theorem SWBisimulation.follow_internal_fst_n
837838/-- Utility theorem for 'following' internal transitions using an `SWBisimulation`
838839(second component, weighted version). -/
839840theorem SWBisimulation.follow_internal_snd_n
840- [HasTau Label] {lts : LTS State Label}
841- (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstrN : lts.STrN n s2 HasTau.τ s2') :
842- ∃ s1', lts.STr s1 HasTau.τ s1' ∧ r s1' s2' := by
841+ [HasTau Label] {lts : LTS State Label}
842+ (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstrN : lts.STrN n s2 HasTau.τ s2') :
843+ ∃ s1', lts.STr s1 HasTau.τ s1' ∧ r s1' s2' := by
843844 cases n
844845 case zero =>
845846 cases hstrN
@@ -864,26 +865,26 @@ theorem SWBisimulation.follow_internal_snd_n
864865/-- Utility theorem for 'following' internal transitions using an `SWBisimulation`
865866(first component). -/
866867theorem SWBisimulation.follow_internal_fst
867- [HasTau Label] {lts : LTS State Label}
868- (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstr : lts.STr s1 HasTau.τ s1') :
869- ∃ s2', lts.STr s2 HasTau.τ s2' ∧ r s1' s2' := by
868+ [HasTau Label] {lts : LTS State Label}
869+ (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstr : lts.STr s1 HasTau.τ s1') :
870+ ∃ s2', lts.STr s2 HasTau.τ s2' ∧ r s1' s2' := by
870871 obtain ⟨n, hstrN⟩ := (LTS.sTr_sTrN lts).1 hstr
871872 apply SWBisimulation.follow_internal_fst_n hswb hr hstrN
872873
873874/-- Utility theorem for 'following' internal transitions using an `SWBisimulation`
874875(second component). -/
875876theorem SWBisimulation.follow_internal_snd
876- [HasTau Label] {lts : LTS State Label}
877- (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstr : lts.STr s2 HasTau.τ s2') :
878- ∃ s1', lts.STr s1 HasTau.τ s1' ∧ r s1' s2' := by
877+ [HasTau Label] {lts : LTS State Label}
878+ (hswb : lts.IsSWBisimulation r) (hr : r s1 s2) (hstr : lts.STr s2 HasTau.τ s2') :
879+ ∃ s1', lts.STr s1 HasTau.τ s1' ∧ r s1' s2' := by
879880 obtain ⟨n, hstrN⟩ := (LTS.sTr_sTrN lts).1 hstr
880881 apply SWBisimulation.follow_internal_snd_n hswb hr hstrN
881882
882883/-- We can now prove that any relation is a `WeakBisimulation` iff it is an `SWBisimulation`.
883884This formalises lemma 4.2.10 in [ Sangiorgi2011 ] . -/
884885theorem LTS.isWeakBisimulation_iff_isSWBisimulation
885- [HasTau Label] {lts : LTS State Label} :
886- lts.IsWeakBisimulation r ↔ lts.IsSWBisimulation r := by
886+ [HasTau Label] {lts : LTS State Label} :
887+ lts.IsWeakBisimulation r ↔ lts.IsSWBisimulation r := by
887888 apply Iff.intro
888889 case mp =>
889890 intro h s1 s2 hr μ
@@ -959,8 +960,8 @@ theorem WeakBisimilarity.refl [HasTau Label] (lts : LTS State Label) (s : State)
959960
960961/-- The inverse of a weak bisimulation is a weak bisimulation. -/
961962theorem WeakBisimulation.inv [HasTau Label] (lts : LTS State Label)
962- (r : State → State → Prop ) (h : lts.IsWeakBisimulation r) :
963- lts.IsWeakBisimulation (flip r) := by
963+ (r : State → State → Prop ) (h : lts.IsWeakBisimulation r) :
964+ lts.IsWeakBisimulation (flip r) := by
964965 grind [WeakBisimulation.toSwBisimulation, LTS.IsSWBisimulation,
965966 flip, SWBisimulation.toWeakBisimulation]
966967
@@ -973,19 +974,20 @@ theorem WeakBisimilarity.symm [HasTau Label] (lts : LTS State Label) (h : s1 ≈
973974
974975/-- The composition of two weak bisimulations is a weak bisimulation. -/
975976theorem WeakBisimulation.comp
976- [HasTau Label]
977- (lts : LTS State Label)
978- (r1 r2 : State → State → Prop ) (h1 : lts.IsWeakBisimulation r1) (h2 : lts.IsWeakBisimulation r2) :
979- lts.IsWeakBisimulation (Relation.Comp r1 r2) := by
977+ [HasTau Label]
978+ (lts : LTS State Label)
979+ (r1 r2 : State → State → Prop )
980+ (h1 : lts.IsWeakBisimulation r1) (h2 : lts.IsWeakBisimulation r2) :
981+ lts.IsWeakBisimulation (Relation.Comp r1 r2) := by
980982 simp_all only [LTS.IsWeakBisimulation]
981983 exact h1.comp h2
982984
983985/-- The composition of two sw-bisimulations is an sw-bisimulation. -/
984986theorem SWBisimulation.comp
985- [HasTau Label]
986- (lts : LTS State Label)
987- (r1 r2 : State → State → Prop ) (h1 : lts.IsSWBisimulation r1) (h2 : lts.IsSWBisimulation r2) :
988- lts.IsSWBisimulation (Relation.Comp r1 r2) := by
987+ [HasTau Label]
988+ (lts : LTS State Label)
989+ (r1 r2 : State → State → Prop ) (h1 : lts.IsSWBisimulation r1) (h2 : lts.IsSWBisimulation r2) :
990+ lts.IsSWBisimulation (Relation.Comp r1 r2) := by
989991 simp_all only [LTS.isWeakBisimulation_iff_isSWBisimulation.symm]
990992 apply WeakBisimulation.comp lts r1 r2 h1 h2
991993
@@ -1003,11 +1005,10 @@ theorem WeakBisimilarity.trans [HasTau Label] {s1 s2 s3 : State}
10031005
10041006/-- Weak bisimilarity is an equivalence relation. -/
10051007theorem WeakBisimilarity.eqv [HasTau Label] {lts : LTS State Label} :
1006- Equivalence (WeakBisimilarity lts) := {
1007- refl := WeakBisimilarity.refl lts
1008- symm := WeakBisimilarity.symm lts
1009- trans := WeakBisimilarity.trans lts
1010- }
1008+ Equivalence (WeakBisimilarity lts) where
1009+ refl := WeakBisimilarity.refl lts
1010+ symm := WeakBisimilarity.symm lts
1011+ trans := WeakBisimilarity.trans lts
10111012
10121013end WeakBisimulation
10131014
0 commit comments