ITreesEquiv
itree E as a Monad
t1 ≈ t2 : itree E R
Strong Bisimulations
- intuitively, unroll the two trees and compare them structurally for equality.
- we write this as t1 ∼ t2
Weak Bisimulation
- intuitively, unroll the two trees
- "ignore" Tau nodes on each side, then check for equality
- Tau t ≈ t
- "equivalent up to Tau" (or, eutt)
Laws for Iteration
Example iter_unroll_law : ∀ i,
iter step i
≈
x <- step i ;;
match x with
| inl i ⇒ iter step i
| inr v ⇒ ret v
end.
Proof.
intros i.
rewrite unfold_iter_ktree.
(* NOTE: We'll see this theorem later... *)
eapply eutt_clo_bind. reflexivity.
intros. subst.
destruct u2.
rewrite tau_eutt. reflexivity. reflexivity.
Qed.
intros i.
rewrite unfold_iter_ktree.
(* NOTE: We'll see this theorem later... *)
eapply eutt_clo_bind. reflexivity.
intros. subst.
destruct u2.
rewrite tau_eutt. reflexivity. reflexivity.
Qed.
Iter laws, more abstractly
● iter step ⩯ step >>> case (iter step) id
● (iter step >>> k) ⩯ iter (step >>> bimap k id)
● iter (iter step) ⩯ iter (step >>> case inl id)
Module EqMR.
Heterogeneous binary relations:
Definition relationH (A B : Type) := A → B → Prop.
Section EqmR.
Section EqmR.
We consider heterogeneous relations on computations parameterized by a
relation on the return types
Class EqmR (m : Type → Type) : Type :=
{ eqmR : ∀ {A B : Type} (R : relationH A B), relationH (m A) (m B) }.
End EqmR.
Infix "≈{ R }" := (eqmR R) (at level 30) : cat_scope.
Notation "t1 ≋ t2" := (eqmR eq t1 t2) (at level 40) : cat_scope.
Arguments eqmR {m _ A B}.
Import RelNotations.
Local Open Scope relationH_scope.
End EqMR.
{ eqmR : ∀ {A B : Type} (R : relationH A B), relationH (m A) (m B) }.
End EqmR.
Infix "≈{ R }" := (eqmR R) (at level 30) : cat_scope.
Notation "t1 ≋ t2" := (eqmR eq t1 t2) (at level 40) : cat_scope.
Arguments eqmR {m _ A B}.
Import RelNotations.
Local Open Scope relationH_scope.
End EqMR.