Skip to content

Commit

Permalink
Add bindDispatch lemma for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
huynhtrankhanh committed Nov 6, 2024
1 parent 7afdcaf commit e108e63
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions theories/Imperative.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Fixpoint bind {effectType effectResponse A B} (a : Action effectType effectRespo

Notation "x >>= f" := (bind x f) (at level 50, left associativity).

Lemma bindDispatch {effectType effectResponse A B} effect (continuation : effectResponse effect -> Action effectType effectResponse A) (f : A -> Action effectType effectResponse B) : Dispatch _ _ _ effect continuation >>= f = Dispatch _ _ _ effect (fun response => continuation response >>= f).
Proof. easy. Qed.

Lemma leftIdentity {effectType effectResponse A B} (x : A) (f : A -> Action effectType effectResponse B) : bind (Done _ _ _ x) f = f x.
Proof. easy. Qed.

Expand Down

0 comments on commit e108e63

Please sign in to comment.