From Corelib Require Export PrimInt63 Uint63Axioms.
From Corelib Require Export PrimString.
Definition char63_valid (c : char63) :=
PrimInt63.land c 255%uint63 = c.
(** * Conversion to / from lists *)
Notation of_nat n := (of_Z (Z.of_nat n)).
Notation to_nat i := (Z.to_nat (to_Z i)).
Definition to_list (s : string) : list char63 :=
ListDef.map (fun i => get s (of_nat i)) (ListDef.seq 0 (to_nat (length s))).
Fixpoint of_list (cs : list char63) : string :=
match cs with
| nil       => ""%pstring
| cons c cs => cat (make 1 c) (of_list cs)
end.

Axiom to_list_char63_valid :
forall (s : string),
ListDef.Forall char63_valid (to_list s).