Skip to content

Commit d4bbb01

Browse files
committed
InterpFacts
1 parent a3259c8 commit d4bbb01

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

theories/Interp/InterpFacts.v

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Definition _interp {E F R} (f : E ~> itree F) (ot : itreeF E R _)
6565
match ot with
6666
| RetF r => Ret r
6767
| TauF t => Tau (interp f t)
68-
| VisF e k => f _ e >>= (fun x => Tau (interp f (k x)))
68+
| VisF e k => f _ e = (fun x => Tau (interp f (k x)))
6969
end.
7070

7171
(** Unfold lemma. *)
@@ -74,7 +74,13 @@ Lemma unfold_interp {E F R} {f : E ~> itree F} (t : itree E R) :
7474
Proof.
7575
unfold interp, Basics.iter, MonadIter_itree. rewrite unfold_iter.
7676
destruct (observe t); cbn;
77-
rewrite ?bind_ret_l, ?bind_map. all: try reflexivity.
77+
rewrite ?bind_ret_l, ?bind_map.
78+
all: change (mret ?x) with (Ret x :> itree F _).
79+
all: rewrite ?bind_ret_l.
80+
all: try reflexivity.
81+
unfold fmap, FMap_itree.
82+
rewrite bind_map.
83+
reflexivity.
7884
Qed.
7985

8086
(** ** [interp] and constructors *)
@@ -122,15 +128,15 @@ Proof.
122128
intros l r0 Hlr.
123129
rewrite 2 unfold_interp.
124130
punfold Hlr; red in Hlr.
125-
destruct Hlr; cbn; subst; try discriminate; pclearbot; try (gstep; constructor; eauto with paco; fail).
131+
destruct Hlr; cbn; subst; try contradiction; pclearbot; try (gstep; constructor; eauto with paco; fail).
126132
guclo eqit_clo_bind. econstructor; [eapply Hfg|].
127133
intros ? _ [].
128134
gstep; econstructor; eauto with paco itree.
129135
Qed.
130136

131137
#[global]
132138
Instance eq_itree_interp' {E F R f}
133-
: Proper (eq_itree eq ==> eq_itree eq) (@interp E (itree F) _ _ _ f R).
139+
: Proper (eq_itree eq ==> eq_itree eq) (@interp E (itree F) _ _ _ _ f R).
134140
Proof.
135141
repeat red.
136142
eapply eq_itree_interp.
@@ -177,13 +183,13 @@ Proof.
177183
intros; subst.
178184
gstep; constructor; eauto with paco itree.
179185
- rewrite tau_euttge, unfold_interp. auto.
180-
- discriminate.
186+
- contradiction.
181187
Qed.
182188

183189
#[global]
184190
Instance eutt_interp' {E F : Type -> Type} {R : Type} (RR: R -> R -> Prop) (f : E ~> itree F) :
185191
Proper (eutt RR ==> eutt RR)
186-
(@interp E (itree F) _ _ _ f R).
192+
(@interp E (itree F) _ _ _ _ f R).
187193
Proof.
188194
repeat red.
189195
einit.
@@ -203,7 +209,7 @@ Qed.
203209
#[global]
204210
Instance euttge_interp' {E F : Type -> Type} {R : Type} (f : E ~> itree F) :
205211
Proper (euttge eq ==> euttge eq)
206-
(@interp E (itree F) _ _ _ f R).
212+
(@interp E (itree F) _ _ _ _ f R).
207213
Proof.
208214
repeat red. apply euttge_interp. reflexivity.
209215
Qed.
@@ -379,7 +385,7 @@ Lemma interp_loop {E F} (f : E ~> itree F) {A B C}
379385
(t : C + A -> itree E (C + B)) a :
380386
interp f (loop (C := ktree E) t a) ≅ loop (C := ktree F) (fun ca => interp f (t ca)) a.
381387
Proof.
382-
unfold loop. unfold cat, Cat_Kleisli, ITree.cat; cbn.
388+
unfold loop. unfold cat, Cat_Kleisli, ITree.cat.
383389
rewrite interp_bind.
384390
apply eqit_bind.
385391
{ unfold inr_, Inr_Kleisli, lift_ktree, pure; cbn.

0 commit comments

Comments
 (0)