Section Monad.
Definition state := nat.
Definition monad (A:Type) := state → state * A.
Definition Meval {A:Type} (m:monad A) st := m st.
Definition Meq {A:Type} (m:monad A) := ∀ st, st = fst (Meval m st).
Definition Mlt {A:Type} (m:monad A) := ∀ st, st < fst (Meval m st).
Definition Mle {A:Type} (m:monad A) := ∀ st, st ≤ fst (Meval m st).

Lemma Mbind_ind {A:Type} (ma:monad A) (f:A→monad A) (P:A → Prop):
(∀ st, P (snd (ma st))) → (∀ (a:A), P a → ∀ st, P (snd ((f a) st))) →
∀ st, P (snd ((ma>>=f) st)).