Ltac simpl_of_lu :=
match goal with
| |- context [ of_lu (?f ?x) ] =>
rewrite (of_lu_eqn (f x)); simpl hd; simpl tl
end.

(* Specifications: *)
Lemma of_lu_succ d :
of_lu (Little.succ d) = S (of_lu d).
Lemma of_to_lu n :
of_lu (to_lu n) = n.
Lemma of_lu_revapp d d' :
of_lu (revapp d d') =
of_lu (rev d) + of_lu d' * 0x10^usize d.
Lemma of_uint_acc_spec n d :
Nat.of_hex_uint_acc d n = of_lu (rev d) + n * 0x10^usize d.
Lemma of_uint_alt d : Nat.of_hex_uint d = of_lu (rev d).
(** First main bijection result *)
Lemma of_to (n:nat) : Nat.of_hex_uint (Nat.to_hex_uint n) = n.
(** The other direction *)
Lemma to_lu_sixteenfold n : n<>0 ->
to_lu (0x10 * n) = D0 (to_lu n).
Lemma of_lu_0 d : of_lu d = 0 <-> nztail d = Nil.
Lemma to_of_lu_sixteenfold d :
to_lu (of_lu d) = lnorm d ->
to_lu (0x10 * of_lu d) = lnorm (D0 d).
Lemma to_of_lu d : to_lu (of_lu d) = lnorm d.
(** Second bijection result *)
Lemma to_of (d:uint) : Nat.to_hex_uint (Nat.of_hex_uint d) = unorm d.
(** Some consequences *)
Lemma to_uint_inj n n' : Nat.to_hex_uint n = Nat.to_hex_uint n' -> n = n'.
Lemma to_uint_surj d : exists n, Nat.to_hex_uint n = unorm d.
Lemma of_uint_norm d : Nat.of_hex_uint (unorm d) = Nat.of_hex_uint d.
Lemma of_inj d d' :
Nat.of_hex_uint d = Nat.of_hex_uint d' -> unorm d = unorm d'.
Lemma of_iff d d' : Nat.of_hex_uint d = Nat.of_hex_uint d' <-> unorm d = unorm d'.
End Unsigned.
Lemma of_lu_succ d :
of_lu (Little.succ d) = S (of_lu d).
Lemma of_to_lu n :
of_lu (to_lu n) = n.
Lemma of_lu_revapp d d' :
of_lu (revapp d d') =
of_lu (rev d) + of_lu d' * 10^usize d.
Lemma of_uint_acc_spec n d :
Nat.of_uint_acc d n = of_lu (rev d) + n * 10^usize d.
Lemma of_uint_alt d : Nat.of_uint d = of_lu (rev d).
(** First main bijection result *)
Lemma of_to (n:nat) : Nat.of_uint (Nat.to_uint n) = n.
(** The other direction *)
Lemma to_lu_tenfold n : n<>0 ->
to_lu (10 * n) = D0 (to_lu n).
Lemma of_lu_0 d : of_lu d = 0 <-> nztail d = Nil.
Lemma to_of_lu_tenfold d :
to_lu (of_lu d) = lnorm d ->
to_lu (10 * of_lu d) = lnorm (D0 d).
Lemma to_of_lu d : to_lu (of_lu d) = lnorm d.
(** Second bijection result *)
Lemma to_of (d:uint) : Nat.to_uint (Nat.of_uint d) = unorm d.
(** Some consequences *)
Lemma to_uint_inj n n' : Nat.to_uint n = Nat.to_uint n' -> n = n'.
Lemma to_uint_surj d : exists n, Nat.to_uint n = unorm d.
Lemma of_uint_norm d : Nat.of_uint (unorm d) = Nat.of_uint d.
Lemma of_inj d d' :
Nat.of_uint d = Nat.of_uint d' -> unorm d = unorm d'.
Lemma of_iff d d' : Nat.of_uint d = Nat.of_uint d' <-> unorm d = unorm d'.
End Unsigned.