| 1 |
From Coq Require Import ZArith. |
| 2 |
Require Import Crypto.Util.Decidable. |
| 3 |
Require Import Crypto.Util.ZUtil.Definitions. |
| 4 |
Require Import Crypto.Util.Tactics.BreakMatch. |
| 5 |
Local Open Scope Z_scope. |
| 6 |
|
| 7 |
Module Z. |
| 8 |
Lemma zselect_correct cond zero_case nonzero_case : |
| 9 |
Z.zselect cond zero_case nonzero_case = |
| 10 |
if dec (cond = 0) then zero_case else nonzero_case. |
| 11 |
Proof. |
| 12 |
cbv [Z.zselect]; break_match; |
| 13 |
try reflexivity; try discriminate. |
| 14 |
rewrite <-Z.eqb_neq in *; congruence. |
| 15 |
Qed. |
| 16 |
End Z. |