| 1 |
Set Implicit Arguments. |
| 2 |
|
| 3 |
Record Monad : Type := { |
| 4 |
functor :> Type -> Type ; |
| 5 |
ret : forall T : Type, T -> functor T ; |
| 6 |
bind : forall T U : Type, functor T -> (T -> functor U) -> functor U ; |
| 7 |
left_id : forall (T U : Type) (t : T) (f : T -> functor U), bind (ret t) f = f t ; |
| 8 |
}. |
| 9 |
|
| 10 |
Program Definition IdMonad : Monad := {| |
| 11 |
functor := fun X => X ; |
| 12 |
ret := fun _ t => t ; |
| 13 |
bind := fun _ _ t f => f t |
| 14 |
|}. |
| 15 |
|
| 16 |
Lemma ft_equal : forall (T U : Type) (t : T) (f : T -> U), f t = f t. |
| 17 |
Proof. |
| 18 |
reflexivity. |
| 19 |
Qed. |
| 20 |
|
| 21 |
Final Obligation. |
| 22 |
apply ft_equal. |
| 23 |
Qed. |