(* Don't allow simpl to expand out these functions *)
Arguments natToWord : simpl never.
Arguments weq : simpl never.
(* Making wlt_dec opaque is necessary to prevent the [exact H] in the * example below from blowing up.. *)
Global Opaque wlt_dec.
Definition test_wlt_f (a : nat) (b : nat) : nat :=
if wlt_dec (natToWord 64 a) $0 then 0 else 0.

Lemma wordNotNot: forall sz (a b: word sz), (a <> b -> False) -> a = b.
Ltac pre_word_omega :=
unfold wzero, wone in *;
repeat match goal with
| H: @eq ?T ?a ?b |- _ =>
match T with
| word ?sz =>
apply (@wordToNat_eq1 sz a b) in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
end
| |- @eq ?T ?a ?b =>
match T with
| word ?sz =>
apply (@wordToNat_eq2 sz a b);
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
end
| H: ?a < ?b |- _ =>
apply wordToNat_lt1 in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
| |- ?a < ?b =>
apply wordToNat_lt2;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
| H: ?a > ?b |- _ =>
apply wordToNat_gt1 in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
| |- ?a > ?b =>
apply wordToNat_gt2;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
| H: ?a <= ?b |- _ =>
apply wordToNat_le1 in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
| |- ?a <= ?b =>
apply wordToNat_le2;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
| H: ?a > ?b -> False |- _ =>
apply wordToNat_le1 in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
| |- ?a > ?b -> False =>
apply wordToNat_le2;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
| H: ?a < ?b -> False |- _ =>
apply wordToNat_ge1 in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
| |- ?a < ?b -> False =>
apply wordToNat_ge2;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
| H: not (@eq ?T ?a ?b) |- _ =>
match T with
| word ?sz =>
apply (@wordToNat_neq1 sz a b) in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
end
| |- not (@eq ?T ?a ?b) =>
match T with
| word ?sz =>
apply (@wordToNat_neq2 sz a b);
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
end
| H: @eq ?T ?a ?b -> False |- _ =>
match T with
| word ?sz =>
apply (@wordToNat_neq1 sz a b) in H;
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one in H;
simpl in H
end
| |- @eq ?T ?a ?b -> False =>
match T with
| word ?sz =>
apply (@wordToNat_neq2 sz a b);
rewrite ?roundTrip_0, ?roundTrip_1, ?wones_pow2_minus_one;
simpl
end
| H: (@eq ?T ?a ?b -> False) -> False |- _ =>
match T with
| word ?sz =>
apply (@wordNotNot sz a b) in H
end
| H: (not (@eq ?T ?a ?b)) -> False |- _ =>
match T with
| word ?sz =>
apply (@wordNotNot sz a b) in H
end
| H: not (@eq ?T ?a ?b -> False) |- _ =>
match T with
| word ?sz =>
apply (@wordNotNot sz a b) in H
end
| H: not (not (@eq ?T ?a ?b)) |- _ =>
match T with
| word ?sz =>
apply (@wordNotNot sz a b) in H
end
end.