Definition getchar_spec :=
WITH k : int -> IO_itree
PRE [ ]
PROP ()
LOCAL ()
SEP (ITREE (r <- read ;; k r))
POST [ tint ]
EX i : int,
PROP (- two_p 7 <= Int.signed i <= two_p 7 - 1)
LOCAL (temp ret_temp (Vint i))
SEP (ITREE (k i)).
Fixpoint write_list l : IO_itree :=
match l with
| nil => Ret tt
| c :: rest => write c ;; write_list rest
end.

(* Specifications: *)
Lemma ITREE_impl : forall tr tr', eq_utt tr tr' ->
ITREE tr |-- ITREE tr'.
Lemma ITREE_ext : forall tr tr', eq_utt tr tr' ->
ITREE tr = ITREE tr'.
Lemma write_list_app : forall l1 l2,
eq_utt (write_list (l1 ++ l2)) (write_list l1;; write_list l2).