Skip to content

Integers.v: add unsigned_inj #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/Integers.v
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ Definition one := repr 1.
Definition mone := repr (-1).
Definition iwordsize := repr zwordsize.

Lemma unsigned_inj : forall x y : int,
unsigned x = unsigned y -> x = y.
Proof.
intros [xval Hxrange] [yal Hyrange] E.
cbn in E. subst.
replace Hxrange with Hyrange; [subst; reflexivity|].
destruct Hxrange; destruct Hyrange.
f_equal; apply eq_proofs_unicity;
intros [] [];
match goal with
| |- ?x = ?x \/ ?x <> ?x => left; reflexivity
| |- ?x = ?y \/ ?x <> ?y => right; intro c; inversion c
end.
Qed.

Lemma mkint_eq:
forall x y Px Py, x = y -> mkint x Px = mkint y Py.
Proof.
Expand Down