(** Parsing one char *)

Definition uint_of_char (a:ascii)(d:option uint) :=
  match d with
  | None => None
  | Some d =>
    match a with
    | "0" => Some (D0 d)
    | "1" => Some (D1 d)
    | "2" => Some (D2 d)
    | "3" => Some (D3 d)
    | "4" => Some (D4 d)
    | "5" => Some (D5 d)
    | "6" => Some (D6 d)
    | "7" => Some (D7 d)
    | "8" => Some (D8 d)
    | "9" => Some (D9 d)
    | "a" => Some (Da d)
    | "b" => Some (Db d)
    | "c" => Some (Dc d)
    | "d" => Some (Dd d)
    | "e" => Some (De d)
    | "f" => Some (Df d)
    | _ => None
    end
  end%char.

(* Specifications: *)
Lemma uint_of_char_spec c d d' : uint_of_char c (Some d) = Some d' -> (c = "0" /\ d' = D0 d \/ c = "1" /\ d' = D1 d \/ c = "2" /\ d' = D2 d \/ c = "3" /\ d' = D3 d \/ c = "4" /\ d' = D4 d \/ c = "5" /\ d' = D5 d \/ c = "6" /\ d' = D6 d \/ c = "7" /\ d' = D7 d \/ c = "8" /\ d' = D8 d \/ c = "9" /\ d' = D9 d \/ c = "a" /\ d' = Da d \/ c = "b" /\ d' = Db d \/ c = "c" /\ d' = Dc d \/ c = "d" /\ d' = Dd d \/ c = "e" /\ d' = De d \/ c = "f" /\ d' = Df d)%char.