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.

Lemma write_list_app : forall l1 l2,
eq_utt (write_list (l1 ++ l2)) (write_list l1;; write_list l2).