chars
int64
40
24k
content_type
stringclasses
9 values
id
stringlengths
13
64
source
stringclasses
5 values
subset
stringclasses
31 values
text
stringlengths
40
24k
184
leanexplore_declaration
leanexplore:387423
leanexplore_sqlite
leanexplore_declarations
@[simp, scoped grind =] theorem mtr_concat_eq {flts : FLTS State Label} {s : State} {μs : List Label} {μ : Label} : flts.mtr s (μs ++ [μ]) = flts.tr (flts.mtr s μs) μ := by grind
153
leanexplore_declaration
leanexplore:387424
leanexplore_sqlite
leanexplore_declarations
/-- `FLTS` is a special case of `LTS`. -/ @[scoped grind =] def toLTS (flts : FLTS State Label) : LTS State Label where Tr s1 μ s2 := flts.tr s1 μ = s2
72
leanexplore_declaration
leanexplore:387425
leanexplore_sqlite
leanexplore_declarations
instance : Coe (FLTS State Label) (LTS State Label) where coe := toLTS
211
leanexplore_declaration
leanexplore:387426
leanexplore_sqlite
leanexplore_declarations
/-- `FLTS.toLTS` correctly characterises transitions. -/ @[scoped grind =] theorem toLTS_tr {flts : FLTS State Label} {s1 : State} {μ : Label} {s2 : State} : flts.toLTS.Tr s1 μ s2 ↔ flts.tr s1 μ = s2 := by rfl
182
leanexplore_declaration
leanexplore:387427
leanexplore_sqlite
leanexplore_declarations
/-- The transition system of a FLTS is deterministic. -/ @[scoped grind ⇒] instance toLTS_deterministic (flts : FLTS State Label) : flts.toLTS.Deterministic := by open LTS in grind
193
leanexplore_declaration
leanexplore:387428
leanexplore_sqlite
leanexplore_declarations
/-- The transition system of a FLTS is image-finite. -/ @[scoped grind ⇒] instance toLTS_imageFinite (flts : FLTS State Label) : flts.toLTS.ImageFinite := flts.toLTS.deterministic_imageFinite
387
leanexplore_declaration
leanexplore:387429
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of multistep transitions. -/ @[scoped grind =] theorem toLTS_mtr {flts : FLTS State Label} {s1 : State} {μs : List Label} {s2 : State} : flts.toLTS.MTr s1 μs s2 ↔ flts.mtr s1 μs = s2 := by have : ∀ μ, flts.toLTS.Tr s1 μ (flts.tr s1 μ) := by grind constructor <;> intro h case mp => inducti...
175
leanexplore_declaration
leanexplore:387430
leanexplore_sqlite
leanexplore_declarations
/-- Converts an `LTS` into an `FLTS` using the subset construction. -/ @[scoped grind =] def toFLTS (lts : LTS State Label) : FLTS (Set State) Label where tr := lts.setImage
332
leanexplore_declaration
leanexplore:387431
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of transitions in `LTS.toFLTS` wrt transitions in the original `LTS`. -/ @[scoped grind =] theorem toFLTS_mem_tr {lts : LTS State Label} {S : Set State} {s' : State} {μ : Label} : s' ∈ lts.toFLTS.tr S μ ↔ ∃ s ∈ S, lts.Tr s μ s' := by simp only [LTS.toFLTS, LTS.setImage, Set.mem_iUnion, exists_p...
318
leanexplore_declaration
leanexplore:387432
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of multistep transitions in `LTS.toFLTS` wrt multistep transitions in the original `LTS`. -/ @[scoped grind =] theorem toFLTS_mem_mtr {lts : LTS State Label} {S : Set State} {s' : State} {μs : List Label} : s' ∈ lts.toFLTS.mtr S μs ↔ ∃ s ∈ S, lts.MTr s μs s' := by grind [LTS.toFLTS, FLTS.mtr]
229
leanexplore_declaration
leanexplore:387433
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of multistep transitions in `LTS.toFLTS` as image transitions in `LTS`. -/ @[scoped grind =] theorem toFLTS_mtr_setImageMultistep {lts : LTS State Label} : lts.toFLTS.mtr = lts.setImageMultistep := by grind
236
leanexplore_declaration
leanexplore:387434
leanexplore_sqlite
leanexplore_declarations
/-- The product of two FLTS with the same label type. -/ @[scoped grind =] def prod (flts1 : FLTS State1 Label) (flts2 : FLTS State2 Label) : FLTS (State1 × State2) Label where tr := fun (s1, s2) μ ↦ (flts1.tr s1 μ, flts2.tr s2 μ)
382
leanexplore_declaration
leanexplore:387435
leanexplore_sqlite
leanexplore_declarations
/-- A state is reachable by the product FLTS iff its components are reachable by the respective FLTS components. -/ @[simp, scoped grind =] theorem prod_mtr_eq (flts1 : FLTS State1 Label) (flts2 : FLTS State2 Label) (s : State1 × State2) (μs : List Label) : (flts1.prod flts2).mtr s μs = (flts1.mtr s.fst μs, flt...
289
leanexplore_declaration
leanexplore:387436
leanexplore_sqlite
leanexplore_declarations
/-- A Labelled Transition System (LTS) for a type of states (`State`) and a type of transition labels (`Label`) consists of a labelled transition relation (`Tr`). -/ structure LTS (State : Type u) (Label : Type v) where /-- The transition relation. -/ Tr : State → Label → State → Prop
606
leanexplore_declaration
leanexplore:387437
leanexplore_sqlite
leanexplore_declarations
/-- Definition of a multistep transition. (Implementation note: compared to [Montesi2023], we choose stepL instead of stepR as fundamental rule. This makes working with lists of labels more convenient, because we follow the same construction. It is also similar to what is done in the `SimpleGraph` library in mathlib.)...
146
leanexplore_declaration
leanexplore:387439
leanexplore_sqlite
leanexplore_declarations
| stepL {s1 : State} {μ : Label} {s2 : State} {μs : List Label} {s3 : State} : lts.Tr s1 μ s2 → lts.MTr s2 μs s3 → lts.MTr s1 (μ :: μs) s3
232
leanexplore_declaration
leanexplore:387440
leanexplore_sqlite
leanexplore_declarations
/-- Any transition is also a multistep transition. -/ @[scoped grind →] theorem MTr.single {s1 : State} {μ : Label} {s2 : State} : lts.Tr s1 μ s2 → lts.MTr s1 [μ] s2 := by intro h apply MTr.stepL · exact h · apply MTr.refl
401
leanexplore_declaration
leanexplore:387441
leanexplore_sqlite
leanexplore_declarations
/-- Any multistep transition can be extended by adding a transition. -/ theorem MTr.stepR {s1 : State} {μs : List Label} {s2 : State} {μ : Label} {s3 : State} : lts.MTr s1 μs s2 → lts.Tr s2 μ s3 → lts.MTr s1 (μs ++ [μ]) s3 := by intro h1 h2 induction h1 case refl s1' => exact MTr.single lts h2 case stepL s1' ...
390
leanexplore_declaration
leanexplore:387442
leanexplore_sqlite
leanexplore_declarations
/-- Multistep transitions can be composed. -/ @[scoped grind <=] theorem MTr.comp {s1 : State} {μs1 : List Label} {s2 : State} {μs2 : List Label} {s3 : State} : lts.MTr s1 μs1 s2 → lts.MTr s2 μs2 s3 → lts.MTr s1 (μs1 ++ μs2) s3 := by intro h1 h2 induction h1 case refl => assumption case stepL s1 μ s' μs1' s...
297
leanexplore_declaration
leanexplore:387443
leanexplore_sqlite
leanexplore_declarations
/-- Any 1-sized multistep transition implies a transition with the same states and label. -/ @[scoped grind .] theorem MTr.single_invert (s1 : State) (μ : Label) (s2 : State) : lts.MTr s1 [μ] s2 → lts.Tr s1 μ s2 := by intro h cases h case stepL s1' htr hmtr => cases hmtr exact htr
182
leanexplore_declaration
leanexplore:387444
leanexplore_sqlite
leanexplore_declarations
/-- In any zero-steps multistep transition, the origin and the derivative are the same. -/ @[scoped grind .] theorem MTr.nil_eq (h : lts.MTr s1 [] s2) : s1 = s2 := by cases h rfl
182
leanexplore_declaration
leanexplore:387445
leanexplore_sqlite
leanexplore_declarations
/-- A state `s1` can reach a state `s2` if there exists a multistep transition from `s1` to `s2`. -/ @[scoped grind =] def CanReach (s1 s2 : State) : Prop := ∃ μs, lts.MTr s1 μs s2
140
leanexplore_declaration
leanexplore:387446
leanexplore_sqlite
leanexplore_declarations
/-- Any state can reach itself. -/ @[scoped grind .] theorem CanReach.refl (s : State) : lts.CanReach s s := by exists [] apply MTr.refl
270
leanexplore_declaration
leanexplore:387447
leanexplore_sqlite
leanexplore_declarations
/-- The LTS generated by a state `s` is the LTS given by all the states reachable from `s`. -/ @[scoped grind =] def generatedBy (s : State) : LTS {s' : State // lts.CanReach s s'} Label where Tr := fun s1 μ s2 => lts.CanReach s s1 ∧ lts.CanReach s s2 ∧ lts.Tr s1 μ s2
274
leanexplore_declaration
leanexplore:387448
leanexplore_sqlite
leanexplore_declarations
/-- An lts is deterministic if a state cannot reach different states with the same transition label. -/ @[scoped grind] class Deterministic (lts : LTS State Label) where deterministic (s1 : State) (μ : Label) (s2 s3 : State) : lts.Tr s1 μ s2 → lts.Tr s1 μ s3 → s2 = s3
175
leanexplore_declaration
leanexplore:387449
leanexplore_sqlite
leanexplore_declarations
/-- The `μ`-image of a state `s` is the set of all `μ`-derivatives of `s`. -/ @[scoped grind =] def image (s : State) (μ : Label) : Set State := { s' : State | lts.Tr s μ s' }
229
leanexplore_declaration
leanexplore:387450
leanexplore_sqlite
leanexplore_declarations
/-- The `μs`-image of a state `s`, where `μs` is a list of labels, is the set of all `μs`-derivatives of `s`. -/ @[scoped grind =] def imageMultistep (s : State) (μs : List Label) : Set State := { s' : State | lts.MTr s μs s' }
195
leanexplore_declaration
leanexplore:387451
leanexplore_sqlite
leanexplore_declarations
/-- The `μ`-image of a set of states `S` is the union of all `μ`-images of the states in `S`. -/ @[scoped grind =] def setImage (S : Set State) (μ : Label) : Set State := ⋃ s ∈ S, lts.image s μ
255
leanexplore_declaration
leanexplore:387452
leanexplore_sqlite
leanexplore_declarations
/-- The `μs`-image of a set of states `S`, where `μs` is a list of labels, is the union of all `μs`-images of the states in `S`. -/ @[scoped grind =] def setImageMultistep (S : Set State) (μs : List Label) : Set State := ⋃ s ∈ S, lts.imageMultistep s μs
227
leanexplore_declaration
leanexplore:387453
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of `setImage` wrt `Tr`. -/ @[scoped grind =] theorem mem_setImage {lts : LTS State Label} : s' ∈ lts.setImage S μ ↔ ∃ s ∈ S, lts.Tr s μ s' := by simp only [setImage, Set.mem_iUnion, exists_prop] grind
116
leanexplore_declaration
leanexplore:387454
leanexplore_sqlite
leanexplore_declarations
theorem tr_setImage {lts : LTS State Label} (hs : s ∈ S) (htr : lts.Tr s μ s') : s' ∈ lts.setImage S μ := by grind
268
leanexplore_declaration
leanexplore:387455
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of `setImageMultistep` with `MTr`. -/ @[scoped grind =] theorem mem_setImageMultistep {lts : LTS State Label} : s' ∈ lts.setImageMultistep S μs ↔ ∃ s ∈ S, lts.MTr s μs s' := by simp only [setImageMultistep, Set.mem_iUnion, exists_prop] grind
148
leanexplore_declaration
leanexplore:387456
leanexplore_sqlite
leanexplore_declarations
@[scoped grind <=] theorem mTr_setImage {lts : LTS State Label} (hs : s ∈ S) (htr : lts.MTr s μs s') : s' ∈ lts.setImageMultistep S μs := by grind
158
leanexplore_declaration
leanexplore:387457
leanexplore_sqlite
leanexplore_declarations
/-- The image of the empty set is always the empty set. -/ @[scoped grind =] theorem setImage_empty (lts : LTS State Label) : lts.setImage ∅ μ = ∅ := by grind
176
leanexplore_declaration
leanexplore:387458
leanexplore_sqlite
leanexplore_declarations
@[scoped grind =] lemma setImageMultistep_setImage_head (lts : LTS State Label) : lts.setImageMultistep S (μ :: μs) = lts.setImageMultistep (lts.setImage S μ ) μs := by grind
274
leanexplore_declaration
leanexplore:387459
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of `setImageMultistep` as `List.foldl` on `setImage`. -/ @[scoped grind _=_] theorem setImageMultistep_foldl_setImage (lts : LTS State Label) : lts.setImageMultistep = List.foldl lts.setImage := by ext S μs s' induction μs generalizing S <;> grind
290
leanexplore_declaration
leanexplore:387460
leanexplore_sqlite
leanexplore_declarations
/-- Characterisation of membership in `List.foldl lts.setImage` with `MTr`. -/ @[scoped grind =] theorem mem_foldl_setImage (lts : LTS State Label) : s' ∈ List.foldl lts.setImage S μs ↔ ∃ s ∈ S, lts.MTr s μs s' := by rw [← setImageMultistep_foldl_setImage] exact mem_setImageMultistep
121
leanexplore_declaration
leanexplore:387461
leanexplore_sqlite
leanexplore_declarations
/-- An lts is image-finite if all images of its states are finite. -/ abbrev ImageFinite := ∀ s μ, Finite (lts.image s μ)
250
leanexplore_declaration
leanexplore:387462
leanexplore_sqlite
leanexplore_declarations
/-- In a deterministic LTS, if a state has a `μ`-derivative, then it can have no other `μ`-derivative. -/ @[scoped grind .] theorem deterministic_not_lto [h : lts.Deterministic] : ∀ s μ s' s'', s' ≠ s'' → lts.Tr s μ s' → ¬lts.Tr s μ s'' := by grind
201
leanexplore_declaration
leanexplore:387463
leanexplore_sqlite
leanexplore_declarations
@[scoped grind _=_] theorem deterministic_tr_image_singleton [lts.Deterministic] : lts.image s μ = {s'} ↔ lts.Tr s μ s' := by have := (lts.image s μ).eq_singleton_iff_unique_mem (a := s') grind
246
leanexplore_declaration
leanexplore:387464
leanexplore_sqlite
leanexplore_declarations
/-- In a deterministic LTS, any image is either a singleton or the empty set. -/ @[scoped grind .] theorem deterministic_image_char [lts.Deterministic] (s : State) (μ : Label) : (∃ s', lts.image s μ = { s' }) ∨ (lts.image s μ = ∅) := by grind
397
leanexplore_declaration
leanexplore:387465
leanexplore_sqlite
leanexplore_declarations
/-- In a deterministic LTS, the image of any state-label combination is finite. -/ instance [lts.Deterministic] (s : State) (μ : Label) : Finite (lts.image s μ) := by have hDet := deterministic_image_char lts s μ cases hDet case inl hDet => obtain ⟨s', hDet'⟩ := hDet simp only [hDet'] apply Set.finite...
142
leanexplore_declaration
leanexplore:387466
leanexplore_sqlite
leanexplore_declarations
/-- Every deterministic LTS is also image-finite. -/ instance deterministic_imageFinite [lts.Deterministic] : lts.ImageFinite := inferInstance
152
leanexplore_declaration
leanexplore:387467
leanexplore_sqlite
leanexplore_declarations
/-- Every finite-state LTS is also image-finite. -/ @[scoped grind .] instance finiteState_imageFinite [Finite State] : lts.ImageFinite := inferInstance
140
leanexplore_declaration
leanexplore:387468
leanexplore_sqlite
leanexplore_declarations
/-- A state has an outgoing label `μ` if it has a `μ`-derivative. -/ def HasOutLabel (s : State) (μ : Label) : Prop := ∃ s', lts.Tr s μ s'
107
leanexplore_declaration
leanexplore:387469
leanexplore_sqlite
leanexplore_declarations
/-- The set of outgoing labels of a state. -/ def outgoingLabels (s : State) := { μ | lts.HasOutLabel s μ }
228
leanexplore_declaration
leanexplore:387470
leanexplore_sqlite
leanexplore_declarations
/-- An LTS is finitely branching if it is image-finite and all states have finite sets of outgoing labels. -/ class FinitelyBranching where [image_finite : lts.ImageFinite] [finite_state : ∀ s, Finite (lts.outgoingLabels s)]
181
leanexplore_declaration
leanexplore:387471
leanexplore_sqlite
leanexplore_declarations
/-- Every LTS with finite types for states and labels is also finitely branching. -/ instance FinitelyBranching.of_finite [Finite State] [Finite Label] : lts.FinitelyBranching where
178
leanexplore_declaration
leanexplore:387472
leanexplore_sqlite
leanexplore_declarations
/-- An LTS is acyclic if there are no infinite multistep transitions. -/ class Acyclic (lts : LTS State Label) where acyclic : ∃ n, ∀ s1 μs s2, lts.MTr s1 μs s2 → μs.length < n
237
leanexplore_declaration
leanexplore:387473
leanexplore_sqlite
leanexplore_declarations
/-- An LTS is finite if it is finite-state and acyclic. We call this `FiniteLTS` instead of just `Finite` to avoid confusion with the standard `Finite` class. -/ class FiniteLTS [Finite State] (lts : LTS State Label) extends lts.Acyclic
494
leanexplore_declaration
leanexplore:387474
leanexplore_sqlite
leanexplore_declarations
/-- A relation is a bisimulation if, whenever it relates two states, the transitions originating from these states mimic each other and the reached derivatives are themselves related. -/ @[scoped grind =] def IsBisimulation (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) (r : State₁ → State₂ → Prop) : Prop := ...
166
leanexplore_declaration
leanexplore:387475
leanexplore_sqlite
leanexplore_declarations
/-- A homogeneous bisimulation is a bisimulation where the underlying LTSs are the same. -/ abbrev IsHomBisimulation (lts : LTS State Label) := IsBisimulation lts lts
267
leanexplore_declaration
leanexplore:387476
leanexplore_sqlite
leanexplore_declarations
/-- Helper for following a transition by the first state in a pair of a `Bisimulation`. -/ theorem IsBisimulation.follow_fst (hb : IsBisimulation lts₁ lts₂ r) (hr : r s₁ s₂) (htr : lts₁.Tr s₁ μ s₁') : ∃ s₂', lts₂.Tr s₂ μ s₂' ∧ r s₁' s₂' := (hb hr μ).1 _ htr
268
leanexplore_declaration
leanexplore:387477
leanexplore_sqlite
leanexplore_declarations
/-- Helper for following a transition by the second state in a pair of a `Bisimulation`. -/ theorem IsBisimulation.follow_snd (hb : IsBisimulation lts₁ lts₂ r) (hr : r s₁ s₂) (htr : lts₂.Tr s₂ μ s₂') : ∃ s₁', lts₁.Tr s₁ μ s₁' ∧ r s₁' s₂' := (hb hr μ).2 _ htr
270
leanexplore_declaration
leanexplore:387478
leanexplore_sqlite
leanexplore_declarations
/-- Two states are bisimilar if they are related by some bisimulation. -/ @[scoped grind =] def Bisimilarity (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) : State₁ → State₂ → Prop := fun s₁ s₂ => ∃ r : State₁ → State₂ → Prop, r s₁ s₂ ∧ IsBisimulation lts₁ lts₂ r
222
leanexplore_declaration
leanexplore:387479
leanexplore_sqlite
leanexplore_declarations
/-- Notation for bisimilarity. Differently from standard pen-and-paper presentations, we require the LTSs to be mentioned explicitly. -/ scoped notation s:max " ~[" lts₁ "," lts₂ "] " s':max => Bisimilarity lts₁ lts₂ s s'
158
leanexplore_declaration
leanexplore:387480
leanexplore_sqlite
leanexplore_declarations
/-- Homogeneous bisimilarity is bisimilarity where the underlying LTSs are the same. -/ abbrev HomBisimilarity (lts : LTS State Label) := Bisimilarity lts lts
117
leanexplore_declaration
leanexplore:387481
leanexplore_sqlite
leanexplore_declarations
/-- Notation for homogeneous bisimilarity. -/ scoped notation s:max " ~[" lts "] " s':max => HomBisimilarity lts s s'
149
leanexplore_declaration
leanexplore:387482
leanexplore_sqlite
leanexplore_declarations
/-- Homogeneous bisimilarity is reflexive. -/ @[scoped grind ., refl] theorem HomBisimilarity.refl (s : State) : s ~[lts] s := by exists Eq grind
190
leanexplore_declaration
leanexplore:387483
leanexplore_sqlite
leanexplore_declarations
/-- The inverse of a bisimulation is a bisimulation. -/ @[scoped grind →] theorem IsBisimulation.inv (h : IsBisimulation lts₁ lts₂ r) : IsBisimulation lts₂ lts₁ (flip r) := by grind [flip]
166
leanexplore_declaration
leanexplore:387484
leanexplore_sqlite
leanexplore_declarations
/-- Bisimilarity is symmetric. -/ @[scoped grind →, symm] theorem Bisimilarity.symm {s₁ s₂ : State} (h : s₁ ~[lts₁,lts₂] s₂) : s₂ ~[lts₂,lts₁] s₁ := by grind [flip]
261
leanexplore_declaration
leanexplore:387485
leanexplore_sqlite
leanexplore_declarations
/-- The composition of two bisimulations is a bisimulation. -/ @[scoped grind .] theorem IsBisimulation.comp (h1 : IsBisimulation lts₁ lts₂ r1) (h2 : IsBisimulation lts₂ lts₃ r2) : IsBisimulation lts₁ lts₃ (Relation.Comp r1 r2) := by grind [Relation.Comp]
269
leanexplore_declaration
leanexplore:387486
leanexplore_sqlite
leanexplore_declarations
/-- Bisimilarity is transitive. -/ @[scoped grind →] theorem Bisimilarity.trans (h1 : s₁ ~[lts₁,lts₂] s₂) (h2 : s₂ ~[lts₂,lts₃] s₃) : s₁ ~[lts₁,lts₃] s₃ := by obtain ⟨r1, _, _⟩ := h1 obtain ⟨r2, _, _⟩ := h2 exists Relation.Comp r1 r2 grind [Relation.Comp]
229
leanexplore_declaration
leanexplore:387487
leanexplore_sqlite
leanexplore_declarations
/-- Homogeneous bisimilarity is an equivalence relation. -/ theorem HomBisimilarity.eqv : Equivalence (HomBisimilarity lts) := { refl := HomBisimilarity.refl symm := Bisimilarity.symm trans := Bisimilarity.trans }
151
leanexplore_declaration
leanexplore:387488
leanexplore_sqlite
leanexplore_declarations
instance : IsEquiv State (HomBisimilarity lts) where refl := HomBisimilarity.refl symm _ _ := Bisimilarity.symm trans _ _ _ := Bisimilarity.trans
1,124
leanexplore_declaration
leanexplore:387489
leanexplore_sqlite
leanexplore_declarations
/-- The union of two bisimulations is a bisimulation. -/ @[scoped grind .] theorem IsBisimulation.sup (hrb : IsBisimulation lts₁ lts₂ r) (hsb : IsBisimulation lts₁ lts₂ s) : IsBisimulation lts₁ lts₂ (r ⊔ s) := by intro s₁ s₂ hrs μ cases hrs case inl h => constructor · intro s₁' htr obtain ⟨s₂', ht...
157
leanexplore_declaration
leanexplore:387490
leanexplore_sqlite
leanexplore_declarations
/-- Bisimilarity is a bisimulation. -/ @[scoped grind .] theorem Bisimilarity.is_bisimulation : IsBisimulation lts₁ lts₂ (Bisimilarity lts₁ lts₂) := by grind
218
leanexplore_declaration
leanexplore:387491
leanexplore_sqlite
leanexplore_declarations
/-- Bisimilarity is the largest bisimulation. -/ @[scoped grind →] theorem Bisimilarity.largest_bisimulation (h : IsBisimulation lts₁ lts₂ r) : Subrelation r (Bisimilarity lts₁ lts₂) := by intro s₁ s₂ hr exists r
309
leanexplore_declaration
leanexplore:387492
leanexplore_sqlite
leanexplore_declarations
/-- The union of bisimilarity with any bisimulation is bisimilarity. -/ @[scoped grind =, simp] theorem Bisimilarity.gfp (r : State₁ → State₂ → Prop) (h : IsBisimulation lts₁ lts₂ r) : (Bisimilarity lts₁ lts₂) ⊔ r = Bisimilarity lts₁ lts₂ := by funext s₁ s₂ simp only [max, SemilatticeSup.sup] grind
167
leanexplore_declaration
leanexplore:387493
leanexplore_sqlite
leanexplore_declarations
/-- `calc` support for bisimilarity. -/ instance : Trans (Bisimilarity lts₁ lts₂) (Bisimilarity lts₂ lts₃) (Bisimilarity lts₁ lts₃) where trans := Bisimilarity.trans
107
leanexplore_declaration
leanexplore:387494
leanexplore_sqlite
leanexplore_declarations
instance : Max {r // IsBisimulation lts₁ lts₂ r} where max r s := ⟨r.1 ⊔ s.1, IsBisimulation.sup r.2 s.2⟩
598
leanexplore_declaration
leanexplore:387495
leanexplore_sqlite
leanexplore_declarations
/-- Bisimulations equipped with union form a join-semilattice. -/ instance : SemilatticeSup {r // IsBisimulation lts₁ lts₂ r} where sup r s := r ⊔ s le_sup_left r s := by simp only [LE.le] intro s₁ s₂ hr simp only [max, SemilatticeSup.sup] left exact hr le_sup_right r s := by simp only [LE...
190
leanexplore_declaration
leanexplore:387496
leanexplore_sqlite
leanexplore_declarations
/-- The empty (heterogeneous) relation is a bisimulation. -/ @[scoped grind .] theorem IsBisimulation.bot : IsBisimulation lts₁ lts₂ Relation.emptyHRelation := by intro s₁ s₂ hr cases hr
99
leanexplore_declaration
leanexplore:387497
leanexplore_sqlite
leanexplore_declarations
instance : Bot {r // IsBisimulation lts₁ lts₂ r} := ⟨Relation.emptyHRelation, IsBisimulation.bot⟩
108
leanexplore_declaration
leanexplore:387498
leanexplore_sqlite
leanexplore_declarations
instance : Top {r // IsBisimulation lts₁ lts₂ r} := ⟨Bisimilarity lts₁ lts₂, Bisimilarity.is_bisimulation⟩
368
leanexplore_declaration
leanexplore:387499
leanexplore_sqlite
leanexplore_declarations
/-- In the inclusion order on bisimulations: - The empty relation is the bottom element. - Bisimilarity is the top element. -/ instance : BoundedOrder {r // IsBisimulation lts₁ lts₂ r} where top := ⊤ bot := ⊥ le_top r := by intro s₁ s₂ simp only [LE.le, Top.top] grind bot_le r := by intro s₁ s₂...
288
leanexplore_declaration
leanexplore:387500
leanexplore_sqlite
leanexplore_declarations
/-- Lifts a relation `r` to homogeneous bisimilarities on its types. -/ def UpToHomBisimilarity (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) (r : State₁ → State₂ → Prop) : State₁ → State₂ → Prop := Relation.Comp (HomBisimilarity lts₁) (Relation.Comp r (HomBisimilarity lts₂))
643
leanexplore_declaration
leanexplore:387501
leanexplore_sqlite
leanexplore_declarations
/-- A relation `r` is a bisimulation up to homogeneous bisimilarity if, whenever it relates two states in an lts, the transitions originating from these states mimic each other and the reached derivatives are themselves related by `r` up to bisimilarity. -/ @[scoped grind] def IsBisimulationUpTo (lts₁ : LTS State₁ Labe...
1,737
leanexplore_declaration
leanexplore:387502
leanexplore_sqlite
leanexplore_declarations
/-- Any bisimulation up to bisimilarity is a bisimulation. -/ @[scoped grind →] theorem IsBisimulationUpTo.is_bisimulation (h : IsBisimulationUpTo lts₁ lts₂ r) : IsBisimulation lts₁ lts₂ (UpToHomBisimilarity lts₁ lts₂ r) := by intro s₁ s₂ hr μ rcases hr with ⟨s₁b, hr1b, s₂b, hrb, hr2b⟩ obtain ⟨r1, hr1, hr1b⟩ :=...
836
leanexplore_declaration
leanexplore:387503
leanexplore_sqlite
leanexplore_declarations
/-- If two states are related by a bisimulation, they can mimic each other's multi-step transitions. -/ theorem IsBisimulation.bisim_trace (hb : IsBisimulation lts₁ lts₂ r) (hr : r s₁ s₂) : ∀ μs s₁', lts₁.MTr s₁ μs s₁' → ∃ s₂', lts₂.MTr s₂ μs s₂' ∧ r s₁' s₂' := by intro μs induction μs generalizing s₁ s₂ ...
542
leanexplore_declaration
leanexplore:387504
leanexplore_sqlite
leanexplore_declarations
/-- Any bisimulation implies trace equivalence. -/ @[scoped grind =>] theorem IsBisimulation.traceEq (hb : IsBisimulation lts₁ lts₂ r) (hr : r s₁ s₂) : s₁ ~tr[lts₁,lts₂] s₂ := by funext μs simp only [eq_iff_iff] constructor case mp => intro h obtain ⟨s₁', h⟩ := h obtain ⟨s₂', hmtr⟩ := IsBisi...
218
leanexplore_declaration
leanexplore:387505
leanexplore_sqlite
leanexplore_declarations
/-- Bisimilarity is included in trace equivalence. -/ @[scoped grind .] theorem Bisimilarity.le_traceEq : Bisimilarity lts₁ lts₂ ≤ TraceEq lts₁ lts₂ := by intro s₁ s₂ h obtain ⟨r, hr, hb⟩ := h apply hb.traceEq hr
7,378
leanexplore_declaration
leanexplore:387506
leanexplore_sqlite
leanexplore_declarations
/-- In general, trace equivalence is not a bisimulation (extra conditions are needed, see for example `Bisimulation.deterministic_trace_eq_is_bisim`). -/ theorem IsBisimulation.traceEq_not_bisim : ∃ (State : Type) (Label : Type) (lts : LTS State Label), ¬(IsHomBisimulation lts (HomTraceEq lts)) := by exists...
486
leanexplore_declaration
leanexplore:387507
leanexplore_sqlite
leanexplore_declarations
/-- In general, bisimilarity and trace equivalence are distinct. -/ theorem Bisimilarity.bisimilarity_neq_traceEq : ∃ (State : Type) (Label : Type) (lts : LTS State Label), HomBisimilarity lts ≠ HomTraceEq lts := by obtain ⟨State, Label, lts, h⟩ := IsBisimulation.traceEq_not_bisim exists State; exists Lab...
688
leanexplore_declaration
leanexplore:387508
leanexplore_sqlite
leanexplore_declarations
/-- In any deterministic LTS, trace equivalence is a bisimulation. -/ theorem IsBisimulation.deterministic_traceEq_isBisimulation {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} [lts₁.Deterministic] [lts₂.Deterministic] : (IsBisimulation lts₁ lts₂ (TraceEq lts₁ lts₂)) := by simp only [IsBisimulation] ...
422
leanexplore_declaration
leanexplore:387509
leanexplore_sqlite
leanexplore_declarations
/-- In deterministic LTSs, trace equivalence implies bisimilarity. -/ theorem Bisimilarity.deterministic_traceEq_bisim {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} [lts₁.Deterministic] [lts₂.Deterministic] (h : s₁ ~tr[lts₁,lts₂] s₂) : (s₁ ~[lts₁,lts₂] s₂) := by exists TraceEq lts₁ lts₂ constructor ...
445
leanexplore_declaration
leanexplore:387510
leanexplore_sqlite
leanexplore_declarations
/-- In deterministic LTSs, bisimilarity and trace equivalence coincide. -/ theorem Bisimilarity.deterministic_bisim_eq_traceEq {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} [lts₁.Deterministic] [lts₂.Deterministic] : Bisimilarity lts₁ lts₂ = TraceEq lts₁ lts₂ := by funext s₁ s₂ simp only [eq_iff_iff] ...
166
leanexplore_declaration
leanexplore:387511
leanexplore_sqlite
leanexplore_declarations
/-- Any bisimulation is also a simulation. -/ theorem IsBisimulation.isSimulation : IsBisimulation lts₁ lts₂ r → IsSimulation lts₁ lts₂ r := by grind [IsSimulation]
299
leanexplore_declaration
leanexplore:387512
leanexplore_sqlite
leanexplore_declarations
/-- A relation is a bisimulation iff both it and its inverse are simulations. -/ theorem IsBisimulation.isSimulation_iff : IsBisimulation lts₁ lts₂ r ↔ (IsSimulation lts₁ lts₂ r ∧ IsSimulation lts₂ lts₁ (flip r)) := by have _ (s₁ s₂) : r s₁ s₂ → flip r s₂ s₁ := id grind [IsSimulation, flip]
689
leanexplore_declaration
leanexplore:387513
leanexplore_sqlite
leanexplore_declarations
/-- Homogeneous bisimilarity can also be characterized through symmetric simulations. -/ theorem HomBisimilarity.symm_simulation : HomBisimilarity lts = fun s₁ s₂ => ∃ r, r s₁ s₂ ∧ Std.Symm r ∧ IsHomSimulation lts r := by funext s₁ s₂ apply Iff.eq apply Iff.intro · intro h have bisim : HomBisimilarity...
373
leanexplore_declaration
leanexplore:387514
leanexplore_sqlite
leanexplore_declarations
/-- A weak bisimulation is similar to a `Bisimulation`, but allows for the related processes to do internal work. Technically, this is defined as a `Bisimulation` on the saturation of the LTSs. -/ def IsWeakBisimulation [HasTau Label] (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) (r : State₁ → State₂ → Prop) ...
189
leanexplore_declaration
leanexplore:387515
leanexplore_sqlite
leanexplore_declarations
/-- A homogeneous bisimulation is a bisimulation where the underlying LTSs are the same. -/ abbrev IsHomWeakBisimulation [HasTau Label] (lts : LTS State Label) := IsWeakBisimulation lts lts
295
leanexplore_declaration
leanexplore:387516
leanexplore_sqlite
leanexplore_declarations
/-- Two states are weakly bisimilar if they are related by some weak bisimulation. -/ def WeakBisimilarity [HasTau Label] (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) : State₁ → State₂ → Prop := fun s₁ s₂ => ∃ r : State₁ → State₂ → Prop, r s₁ s₂ ∧ IsWeakBisimulation lts₁ lts₂ r
127
leanexplore_declaration
leanexplore:387517
leanexplore_sqlite
leanexplore_declarations
/-- Notation for weak bisimilarity. -/ scoped notation s:max " ≈[" lts₁ "," lts₂ "] " s':max => WeakBisimilarity lts₁ lts₂ s s'
181
leanexplore_declaration
leanexplore:387518
leanexplore_sqlite
leanexplore_declarations
/-- Homogeneous bisimilarity is bisimilarity where the underlying LTSs are the same. -/ abbrev HomWeakBisimilarity [HasTau Label] (lts : LTS State Label) := WeakBisimilarity lts lts
121
leanexplore_declaration
leanexplore:387519
leanexplore_sqlite
leanexplore_declarations
/-- Notation for homogeneous bisimilarity. -/ scoped notation s:max " ≈[" lts "] " s':max => HomWeakBisimilarity lts s s'
530
leanexplore_declaration
leanexplore:387520
leanexplore_sqlite
leanexplore_declarations
/-- An `SWBisimulation` is a more convenient definition of weak bisimulation, because the challenge is a single transition. We prove later that this technique is sound, following a strategy inspired by [Sangiorgi2011]. -/ def IsSWBisimulation [HasTau Label] (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) (r : S...
744
leanexplore_declaration
leanexplore:387521
leanexplore_sqlite
leanexplore_declarations
/-- Utility theorem for 'following' internal transitions using an `SWBisimulation` (first component). -/ theorem IsSWBisimulation.follow_internal_fst [HasTau Label] {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} (hswb : IsSWBisimulation lts₁ lts₂ r) (hr : r s₁ s₂) (hstr : lts₁.τSTr s₁ s₁') : ∃ s₂', lts...
746
leanexplore_declaration
leanexplore:387522
leanexplore_sqlite
leanexplore_declarations
/-- Utility theorem for 'following' internal transitions using an `SWBisimulation` (second component). -/ theorem IsSWBisimulation.follow_internal_snd [HasTau Label] {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} (hswb : IsSWBisimulation lts₁ lts₂ r) (hr : r s₁ s₂) (hstr : lts₂.τSTr s₂ s₂') : ∃ s₁', lt...
2,094
leanexplore_declaration
leanexplore:387523
leanexplore_sqlite
leanexplore_declarations
/-- We can now prove that any relation is a `WeakBisimulation` iff it is an `SWBisimulation`. This formalises lemma 4.2.10 in [Sangiorgi2011]. -/ theorem isWeakBisimulation_iff_isSWBisimulation [HasTau Label] {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} : IsWeakBisimulation lts₁ lts₂ r ↔ IsSWBisimulation...