diff options
author | jadep <jade.philipoom@gmail.com> | 2017-05-14 15:52:56 -0400 |
---|---|---|
committer | jadep <jade.philipoom@gmail.com> | 2017-05-14 15:56:56 -0400 |
commit | 7df5033c871aef6172d4e98d42ce00005e24f73e (patch) | |
tree | c858b22c861885a5f76d648afb2b102f7fc89662 /src/Util/ZUtil/Zselect.v | |
parent | 7e3d941510ad65ea712f608a9e0b2a19437e9e84 (diff) |
add wrapper for add_get_carry and proofs for add_get_carry and zselect
Diffstat (limited to 'src/Util/ZUtil/Zselect.v')
-rw-r--r-- | src/Util/ZUtil/Zselect.v | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Util/ZUtil/Zselect.v b/src/Util/ZUtil/Zselect.v new file mode 100644 index 000000000..0166ce6f4 --- /dev/null +++ b/src/Util/ZUtil/Zselect.v @@ -0,0 +1,16 @@ +Require Import Coq.ZArith.ZArith. +Require Import Crypto.Util.Decidable. +Require Import Crypto.Util.ZUtil.Definitions. +Require Import Crypto.Util.Tactics. +Local Open Scope Z_scope. + +Module Z. + Lemma zselect_correct cond zero_case nonzero_case : + Z.zselect cond zero_case nonzero_case = + if dec (cond = 0) then zero_case else nonzero_case. + Proof. + cbv [Z.zselect]; break_match; + try reflexivity; try discriminate. + rewrite <-Z.eqb_neq in *; congruence. + Qed. +End Z.
\ No newline at end of file |