Section read_write.
Variable (f: file) (fptr: nat).
Let contents := get_contents f.
Fixpoint read_file_aux (nbytes sz cur: nat): list memval :=
match nbytes with
| O => nil
| S nbytes' => if eq_nat_dec sz cur then nil
else contents cur :: read_file_aux nbytes' sz (S cur)
end.

Lemma read_file_aux_id nbytes sz cur:
read_file_aux nbytes sz cur =
read_file_aux (length (read_file_aux nbytes sz cur)) sz cur.