intros sz n m H H0 H1.
apply (f_equal (@wordToNat _)) in H.
destruct (wordToNat_natToWord sz n) as [x H2].
destruct (wordToNat_natToWord sz m) as [x0 H3].
intuition.
match goal with
| [ H : wordToNat ?x = wordToNat ?y, H' : wordToNat ?x = ?a, H'' : wordToNat ?y = ?b |- _ ]
=> let H0 := fresh in assert (H0 : a = b) by congruence; clear H H' H''; rename H0 into H
end.
assert (x = 0).
destruct x; auto.
simpl in *.
generalize dependent (x * pow2 sz).
intros.
omega.
assert (x0 = 0).
destruct x0; auto.
simpl in *.
generalize dependent (x0 * pow2 sz).
intros.
omega.
subst; simpl in *; omega.
Qed.

(* Specifications: *)
Lemma wordToNat_natToWord_idempotent : forall sz n,
(N.of_nat n < Npow2 sz)%N
-> wordToNat (natToWord sz n) = n.