Definition t := string.Definition eq := string_dec.Fixpoint positive_of_digits (l : list bool) (p : positive) : positive :=
    match l with
    | [] => p
    | b :: l' => if b then xI (positive_of_digits l' p) else xO (positive_of_digits l' p)
    end.Definition list_bool_of_ascii (a : ascii) : list bool :=
    let (a0,a1,a2,a3,a4,a5,a6,a7) := a in
    [a0; a1; a2; a3; a4; a5; a6; a7].Fixpoint index (s : string) : positive :=
    match s with
    | EmptyString => 1
    | String a s' => positive_of_digits (list_bool_of_ascii a) (index s')
    end.

(* Specifications: *)
Lemma positive_of_digits_inj : forall l l' p p', List.length l = List.length l' -> positive_of_digits l p = positive_of_digits l' p' -> l = l' /\ p = p'.
Theorem index_inj : forall (x y : t), index x = index y -> x = y.