Documentation

Cslib.Foundations.Semantics.LTS.Simulation

IsSimulation and Similarity #

A simulation is a binary relation on the states of two LTSs: if two states s₁ and s2 are related by a simulation, then s2 can mimic all transitions of s₁ in their respective LTSs. Furthermore, the derivatives reaches through these transitions remain related by the simulation.

Similarity is the largest simulation: given an LTS, it relates any two states that are related by a simulation for that LTS.

The module provides abbreviations for the homogeneous case of comparing states in the same LTS.

For an introduction to theory of simulation, we refer to [San].

Main definitions #

Notations #

Main statements #

def Cslib.LTS.IsSimulation {State₁ : Type u_1} {Label : Type u_2} {State₂ : Type u_3} (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) (r : State₁ → State₂ → Prop) :

A relation is a simulation if, whenever it relates two states in an lts, any transition originating from the first state is mimicked by a transition from the second state and the reached derivatives are themselves related.

@[reducible, inline]
abbrev Cslib.LTS.IsHomSimulation {State : Type u_1} {Label : Type u_2} (lts : LTS State Label) (r : State → State → Prop) :

A homogeneous simulation is a simulation where the underlying LTSs are the same.

def Cslib.LTS.Similarity {State₁ : Type u_1} {Label : Type u_2} {State₂ : Type u_3} (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) :
State₁ → State₂ → Prop

Two states are similar if they are related by some simulation.

Notation for similarity.

Differently from standard pen-and-paper presentations, we require the lts to be mentioned explicitly.

@[reducible, inline]
abbrev Cslib.LTS.HomSimilarity {State : Type u_1} {Label : Type u_2} (lts : LTS State Label) :
State → State → Prop

Homogeneous similarity is similarity where the underlying LTSs are the same.

Notation for homogeneous similarity.

theorem Cslib.LTS.HomSimilarity.refl {State : Type u_1} {Label✝ : Type u_2} {lts : LTS State Label✝} (s : State) :

Homogeneous similarity is reflexive.

theorem Cslib.LTS.IsSimulation.comp {State₁ : Type u_1} {State₂ : Type u_2} {State₃ : Type u_3} {Label✝ : Type u_4} {lts₁ : LTS State₁ Label✝} {lts₂ : LTS State₂ Label✝} {lts₃ : LTS State₃ Label✝} (r1 : State₁ → State₂ → Prop) (r2 : State₂ → State₃ → Prop) (h1 : lts₁.IsSimulation lts₂ r1) (h2 : lts₂.IsSimulation lts₃ r2) :
lts₁.IsSimulation lts₃ (Relation.Comp r1 r2)

The composition of two simulations is a simulation.

theorem Cslib.LTS.Similarity.trans {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {s₁ : State✝} {s2 : State✝¹} {State✝² : Type u_4} {lts₃ : LTS State✝² Label✝} {s₃ : State✝²} (h1 : lts₁.Similarity lts₂ s₁ s2) (h2 : lts₂.Similarity lts₃ s2 s₃) :
lts₁.Similarity lts₃ s₁ s₃

Similarity is transitive.

theorem Cslib.LTS.IsSimulation.sup {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {r s : State✝ → State✝¹ → Prop} (hr : lts₁.IsSimulation lts₂ r) (hs : lts₁.IsSimulation lts₂ s) :
lts₁.IsSimulation lts₂ (r ⊔ s)
theorem Cslib.LTS.IsSimulation.sim_trace {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {r : State✝ → State✝¹ → Prop} {s₁ : State✝} {s₂ : State✝¹} (hr : lts₁.IsSimulation lts₂ r) (hrel : r s₁ s₂) (μs : List Label✝) (s₁' : State✝) :
lts₁.MTr s₁ μs s₁' → ∃ (s₂' : State✝¹), lts₂.MTr s₂ μs s₂' ∧ r s₁' s₂'
def Cslib.LTS.IsSimulationMap {State₁ : Type u_1} {Label : Type u_2} {State₂ : Type u_3} (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) (f : State₁ → State₂) :

A map of states is a simulation map if it sends every transition of lts₁ to a transition of lts₂ with the same label.

theorem Cslib.LTS.IsSimulationMap.isSimulation {State₁ : Type u_1} {Label : Type u_2} {State₂ : Type u_3} {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} {f : State₁ → State₂} (hf : lts₁.IsSimulationMap lts₂ f) :
lts₁.IsSimulation lts₂ fun (s : State₁) (t : State₂) => t = f s

The graph of a simulation map is a simulation.

theorem Cslib.LTS.IsSimulationMap.sim_trace {State₁ : Type u_1} {Label : Type u_2} {State₂ : Type u_3} {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} {f : State₁ → State₂} (hf : lts₁.IsSimulationMap lts₂ f) {s s' : State₁} {μs : List Label} (h : lts₁.MTr s μs s') :
lts₂.MTr (f s) μs (f s')

A simulation map sends multistep transitions to multistep transitions.

def Cslib.LTS.SimulationEquiv {State₁ : Type u_1} {Label : Type u_2} {State₂ : Type u_3} (lts₁ : LTS State₁ Label) (lts₂ : LTS State₂ Label) :
State₁ → State₂ → Prop

Simulation equivalence relates all states s₁ and s2 such that s₁ ≤[lts₁ lts₂] s2 and s2 ≤[lts₂ lts₁] s₁.

Instances For

    Notation for simulation equivalence.

    @[reducible, inline]
    abbrev Cslib.LTS.HomSimulationEquiv {State : Type u_1} {Label : Type u_2} (lts : LTS State Label) :
    State → State → Prop

    Homogeneous simulation equivalence.

    Notation for homogeneous simulation equivalence.

    theorem Cslib.LTS.HomSimulationEquiv.refl {State : Type u_1} {Label✝ : Type u_2} {lts : LTS State Label✝} (s : State) :

    Homogeneous simulation equivalence is reflexive.

    theorem Cslib.LTS.SimulationEquiv.symm {State₁ : Type u_1} {State₂ : Type u_2} {Label : Type u_3} {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} {s₁ : State₁} {s2 : State₂} (h : lts₁.SimulationEquiv lts₂ s₁ s2) :
    lts₂.SimulationEquiv lts₁ s2 s₁

    Simulation equivalence is symmetric.

    theorem Cslib.LTS.SimulationEquiv.trans {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {s₁ : State✝} {s2 : State✝¹} {State✝² : Type u_4} {lts₃ : LTS State✝² Label✝} {s₃ : State✝²} (h1 : lts₁.SimulationEquiv lts₂ s₁ s2) (h2 : lts₂.SimulationEquiv lts₃ s2 s₃) :
    lts₁.SimulationEquiv lts₃ s₁ s₃

    Simulation equivalence is transitive.

    theorem Cslib.LTS.HomSimulationEquiv.eqv {State✝ : Type u_1} {Label✝ : Type u_2} {lts : LTS State✝ Label✝} :
    Equivalence fun (x1 x2 : State✝) => lts.HomSimulationEquiv x1 x2

    Homogeneous simulation equivalence is an equivalence relation.

    @[instance_reducible]
    instance Cslib.LTS.instTransSimulationEquiv {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {State✝² : Type u_4} {lts₃ : LTS State✝² Label✝} :
    Trans (lts₁.SimulationEquiv lts₂) (lts₂.SimulationEquiv lts₃) (lts₁.SimulationEquiv lts₃)

    calc support for simulation equivalence.

    theorem Cslib.LTS.IsSimulation.follow {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {r : State✝ → State✝¹ → Prop} {s₁ : State✝} {s₂ : State✝¹} {μ : Label✝} {s₁' : State✝} (hb : lts₁.IsSimulation lts₂ r) (hr : r s₁ s₂) (htr : lts₁.Tr s₁ μ s₁') :
    ∃ (s₂' : State✝¹), lts₂.Tr s₂ μ s₂' ∧ r s₁' s₂'

    Helper for following a transition by the first state in a pair of a simulation.

    theorem Cslib.LTS.IsSimulation.follow_internal {Label : Type u_1} {State₁ : Type u_2} {State₂ : Type u_3} {r : State₁ → State₂ → Prop} {s₁ : State₁} {s₂ : State₂} {s₁' : State₁} [HasTau Label] {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} (h : lts₁.IsSimulation lts₂.saturate r) (hr : r s₁ s₂) (hstr : lts₁.τSTr s₁ s₁') :
    ∃ (s₂' : State₂), lts₂.τSTr s₂ s₂' ∧ r s₁' s₂'

    Utility theorem for following internal transitions along a saturated lts.

    theorem Cslib.LTS.IsSimulation.isSimulation_saturate_left {Label : Type u_1} {State₁ : Type u_2} {State₂ : Type u_3} {r : State₁ → State₂ → Prop} [HasTau Label] {lts₁ : LTS State₁ Label} {lts₂ : LTS State₂ Label} (h : lts₁.IsSimulation lts₂.saturate r) :

    If the right-hand lts is saturated, a simulation lifts along saturating the left-hand lts.

    theorem Cslib.LTS.IsSimulation.mono {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {r : State✝ → State✝¹ → Prop} {lts₁' : LTS State✝ Label✝} {lts₂' : LTS State✝¹ Label✝} (h₁ : lts₁'.Tr ≤ lts₁.Tr) (h₂ : lts₂.Tr ≤ lts₂'.Tr) (h : lts₁.IsSimulation lts₂ r) :
    lts₁'.IsSimulation lts₂' r

    Simulation is preserved by removing transitions on the left, and adding transitions on the right.

    theorem Cslib.LTS.IsSimulation.match_deterministic {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {r : State✝ → State✝¹ → Prop} {s₁ : State✝} {s₂ : State✝¹} {μ : Label✝} {s₁' : State✝} {s₂' : State✝¹} (hb : lts₁.IsSimulation lts₂ r) (hr : r s₁ s₂) (hdet : lts₂.DeterministicStateLabel s₂ μ) (htr₁ : lts₁.Tr s₁ μ s₁') (htr₂ : lts₂.Tr s₂ μ s₂') :
    r s₁' s₂'

    When a deterministic state matches a transition in a simulation, then the derivatives are still in the simulation.

    theorem Cslib.LTS.IsSimulation.follow_deterministic {State✝ : Type u_1} {Label✝ : Type u_2} {lts₁ : LTS State✝ Label✝} {State✝¹ : Type u_3} {lts₂ : LTS State✝¹ Label✝} {r : State✝ → State✝¹ → Prop} {s₁ : State✝} {s₂ : State✝¹} {μ : Label✝} {s₁' : State✝} (hb : lts₁.IsSimulation lts₂ r) (hr : r s₁ s₂) (hdet : lts₂.DeterministicStateLabel s₂ μ) (htr : lts₁.Tr s₁ μ s₁') :
    ∃! s₂' : State✝¹, lts₂.Tr s₂ μ s₂' ∧ r s₁' s₂'

    If a state is deterministic for μ, then any transition made by a related state in a simulation is matched by a unique transition.