diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-08-31 09:16:44 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-08-31 09:16:44 +0200 |
commit | 7c790ecd1c32b529a5e5e5977ce84cfade8e1eb6 (patch) | |
tree | 494902529850b5261911a1c6447d72bc1fe78fac /mppa_k1c | |
parent | bd6781204d578c30c33c958137619ce8d4be2628 (diff) | |
download | compcert-kvx-7c790ecd1c32b529a5e5e5977ce84cfade8e1eb6.tar.gz compcert-kvx-7c790ecd1c32b529a5e5e5977ce84cfade8e1eb6.zip |
some more proofs on integers, preparing for absolute value instruction
Diffstat (limited to 'mppa_k1c')
-rw-r--r-- | mppa_k1c/ExtValues.v | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mppa_k1c/ExtValues.v b/mppa_k1c/ExtValues.v index 3370fae3..e9c62a8d 100644 --- a/mppa_k1c/ExtValues.v +++ b/mppa_k1c/ExtValues.v @@ -2,6 +2,24 @@ Require Import Coqlib. Require Import Integers. Require Import Values. +Open Scope Z_scope. + +Definition abs_diff (x y : Z) := Z.abs (x - y). +Definition abs_diff2 (x y : Z) := + if x <=? y then y - x else x - y. +Lemma abs_diff2_correct : + forall x y : Z, (abs_diff x y) = (abs_diff2 x y). +Proof. + intros. + unfold abs_diff, abs_diff2. + unfold Z.leb. + pose proof (Z.compare_spec x y) as Hspec. + inv Hspec. + - rewrite Z.abs_eq; omega. + - rewrite Z.abs_neq; omega. + - rewrite Z.abs_eq; omega. +Qed. + Inductive shift1_4 : Type := | SHIFT1 | SHIFT2 | SHIFT3 | SHIFT4. |