Built with Alectryon, running Coq+SerAPI v8.18.0+0.18.1. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use instead of Ctrl.
[Loading ML file ssrmatching_plugin.cmxs (using legacy method) ... done]
[Loading ML file ssreflect_plugin.cmxs (using legacy method) ... done]
Set Implicit Arguments. Unset Strict Implicit. Import Prenex Implicits.

Utility: Definition of Possibly-Infinite Traces

Ltac invs h := inversion h; subst => {h}.

Section sec_traces.

Context {A B : Type}.

Core trace definition and decomposition

This definition is similar to that for lazy lists from Chapter 13 of the Coq'Art book. However, to support traces following labeled transition relations, constructors have additional elements.
CoInductive trace : Type :=
| Tnil : A -> trace
| Tcons : A -> B -> trace -> trace.

Definition hd tr :=
match tr with
| Tnil a => a
| Tcons a b tr0 => a
end.

Definition trace_decompose (tr : trace) : trace :=
match tr with
| Tnil a => Tnil a
| Tcons a b tr' => Tcons a b tr'
end.

A, B: Type

forall tr : trace, tr = trace_decompose tr
A, B: Type

forall tr : trace, tr = trace_decompose tr
by case. Qed.

Bisimulations between traces

CoInductive bisim : trace -> trace -> Prop :=
| bisim_nil : forall a,
   bisim (Tnil a) (Tnil a)
| bisim_cons : forall a b tr tr',
   bisim tr tr' ->
   bisim (Tcons a b tr) (Tcons a b tr').

A, B: Type

forall tr : trace, bisim tr tr
A, B: Type

forall tr : trace, bisim tr tr
A, B: Type
CIH: forall tr : trace, bisim tr tr

forall tr : trace, bisim tr tr
A, B: Type
CIH: forall tr : trace, bisim tr tr
a: A
b: B
tr: trace

bisim (Tcons a b tr) (Tcons a b tr)
exact/bisim_cons/CIH. Qed.
A, B: Type

forall tr1 tr2 : trace, bisim tr1 tr2 -> bisim tr2 tr1
A, B: Type

forall tr1 tr2 : trace, bisim tr1 tr2 -> bisim tr2 tr1
A, B: Type
CIH: forall tr1 tr2 : trace, bisim tr1 tr2 -> bisim tr2 tr1

forall tr1 tr2 : trace, bisim tr1 tr2 -> bisim tr2 tr1
A, B: Type
CIH: forall tr1 tr2 : trace, bisim tr1 tr2 -> bisim tr2 tr1
a: A
b: B
tr1, tr': trace
H3: bisim tr1 tr'

bisim (Tcons a b tr') (Tcons a b tr1)
exact/bisim_cons/CIH. Qed.
A, B: Type

forall tr1 tr2 tr3 : trace, bisim tr1 tr2 -> bisim tr2 tr3 -> bisim tr1 tr3
A, B: Type

forall tr1 tr2 tr3 : trace, bisim tr1 tr2 -> bisim tr2 tr3 -> bisim tr1 tr3
A, B: Type
CIH: forall tr1 tr2 tr3 : trace, bisim tr1 tr2 -> bisim tr2 tr3 -> bisim tr1 tr3

forall tr1 tr2 tr3 : trace, bisim tr1 tr2 -> bisim tr2 tr3 -> bisim tr1 tr3
A, B: Type
CIH: forall tr1 tr2 tr3 : trace, bisim tr1 tr2 -> bisim tr2 tr3 -> bisim tr1 tr3
a: A
b: B
tr1, tr', tr'0: trace
H3: bisim tr1 tr'
H4: bisim tr' tr'0

bisim (Tcons a b tr1) (Tcons a b tr'0)
exact: (bisim_cons _ _ (CIH _ _ _ H3 H4)). Qed.
A, B: Type

forall tr0 tr1 : trace, bisim tr0 tr1 -> hd tr0 = hd tr1
A, B: Type

forall tr0 tr1 : trace, bisim tr0 tr1 -> hd tr0 = hd tr1
by move => tr0 tr1 []. Qed.

Appending traces to one another

CoFixpoint trace_append (tr tr' : trace) : trace :=
match tr with
| Tnil a => tr'
| Tcons a b tr0 => Tcons a b (trace_append tr0 tr')
end.

#[local] Infix "+++" := trace_append (at level 60, right associativity).

A, B: Type

forall (a : A) (tr : trace), Tnil a +++ tr = tr
A, B: Type

forall (a : A) (tr : trace), Tnil a +++ tr = tr
A, B: Type
a: A
tr: trace

Tnil a +++ tr = tr
A, B: Type
a: A
tr: trace

trace_decompose (Tnil a +++ tr) = tr
by case tr. Qed.
A, B: Type

forall (a : A) (b : B) (tr tr' : trace), Tcons a b tr +++ tr' = Tcons a b (tr +++ tr')
A, B: Type

forall (a : A) (b : B) (tr tr' : trace), Tcons a b tr +++ tr' = Tcons a b (tr +++ tr')
A, B: Type
a: A
b: B
tr, tr': trace

Tcons a b tr +++ tr' = Tcons a b (tr +++ tr')
A, B: Type
a: A
b: B
tr, tr': trace

trace_decompose (Tcons a b tr +++ tr') = Tcons a b (tr +++ tr')
by case tr. Qed.
A, B: Type

forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
A, B: Type

forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)

forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
Hbs2: bisim tr3 tr4

bisim (Tnil a1 +++ tr3) (Tnil a1 +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
b1: B
tr1', tr2': trace
Hbs1': bisim tr1' tr2'
Hbs2: bisim tr3 tr4
bisim (Tcons a1 b1 tr1' +++ tr3) (Tcons a1 b1 tr2' +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
Hbs2: bisim tr3 tr4

bisim (Tnil a1 +++ tr3) (Tnil a1 +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
b1: B
tr1', tr2': trace
Hbs1': bisim tr1' tr2'
Hbs2: bisim tr3 tr4
bisim (Tcons a1 b1 tr1' +++ tr3) (Tcons a1 b1 tr2' +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
Hbs2: bisim tr3 tr4

bisim tr3 tr4
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
b1: B
tr1', tr2': trace
Hbs1': bisim tr1' tr2'
Hbs2: bisim tr3 tr4
bisim (Tcons a1 b1 tr1' +++ tr3) (Tcons a1 b1 tr2' +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
b1: B
tr1', tr2': trace
Hbs1': bisim tr1' tr2'
Hbs2: bisim tr3 tr4

bisim (Tcons a1 b1 tr1' +++ tr3) (Tcons a1 b1 tr2' +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
b1: B
tr1', tr2': trace
Hbs1': bisim tr1' tr2'
Hbs2: bisim tr3 tr4

bisim (Tcons a1 b1 tr1' +++ tr3) (Tcons a1 b1 tr2' +++ tr4)
A, B: Type
CIH: forall tr1 tr2 tr3 tr4 : trace, bisim tr1 tr2 -> bisim tr3 tr4 -> bisim (tr1 +++ tr3) (tr2 +++ tr4)
tr1, tr2, tr3, tr4: trace
a1: A
b1: B
tr1', tr2': trace
Hbs1': bisim tr1' tr2'
Hbs2: bisim tr3 tr4

bisim (Tcons a1 b1 (tr1' +++ tr3)) (Tcons a1 b1 (tr2' +++ tr4))
exact/bisim_cons/CIH. Qed. End sec_traces. Infix "+++" := trace_append (at level 60, right associativity).