(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(** * HexadecimalFacts : some facts about Hexadecimal numbers *)
Variant digits :=
| d0 | d1 | d2 | d3 | d4 | d5 | d6 | d7 | d8 | d9
| da | db | dc | dd | de | df.
Fixpoint to_list (u : uint) : list digits :=
match u with
| Nil => nil
| D0 u => cons d0 (to_list u)
| D1 u => cons d1 (to_list u)
| D2 u => cons d2 (to_list u)
| D3 u => cons d3 (to_list u)
| D4 u => cons d4 (to_list u)
| D5 u => cons d5 (to_list u)
| D6 u => cons d6 (to_list u)
| D7 u => cons d7 (to_list u)
| D8 u => cons d8 (to_list u)
| D9 u => cons d9 (to_list u)
| Da u => cons da (to_list u)
| Db u => cons db (to_list u)
| Dc u => cons dc (to_list u)
| Dd u => cons dd (to_list u)
| De u => cons de (to_list u)
| Df u => cons df (to_list u)
end.
Fixpoint of_list (l : list digits) : uint :=
match l with
| nil => Nil
| cons d0 l => D0 (of_list l)
| cons d1 l => D1 (of_list l)
| cons d2 l => D2 (of_list l)
| cons d3 l => D3 (of_list l)
| cons d4 l => D4 (of_list l)
| cons d5 l => D5 (of_list l)
| cons d6 l => D6 (of_list l)
| cons d7 l => D7 (of_list l)
| cons d8 l => D8 (of_list l)
| cons d9 l => D9 (of_list l)
| cons da l => Da (of_list l)
| cons db l => Db (of_list l)
| cons dc l => Dc (of_list l)
| cons dd l => Dd (of_list l)
| cons de l => De (of_list l)
| cons df l => Df (of_list l)
end.

Lemma of_list_inj u u' : of_list u = of_list u' -> u = u'.