| 1 |
From Coq Require Import ZArith. |
| 2 |
Require Import Crypto.Util.ZUtil.Hints.Core. |
| 3 |
|
| 4 |
Local Open Scope Z. |
| 5 |
|
| 6 |
Module Z. |
| 7 |
Ltac peel_le_step := |
| 8 |
match goal with |
| 9 |
| [ |- ?x + _ <= ?x + _ ] |
| 10 |
=> apply Z.add_le_mono_l |
| 11 |
| [ |- _ + ?x <= _ + ?x ] |
| 12 |
=> apply Z.add_le_mono_r |
| 13 |
| [ |- ?x - _ <= ?x - _ ] |
| 14 |
=> apply Z.sub_le_mono_l |
| 15 |
| [ |- _ - ?x <= _ - ?x ] |
| 16 |
=> apply Z.sub_le_mono_r |
| 17 |
| [ |- ?x^_ <= ?x^_ ] |
| 18 |
=> apply Z.pow_le_mono_r; [ zutil_arith | ] |
| 19 |
| [ |- _^?x <= _^?x ] |
| 20 |
=> apply Z.pow_le_mono_l; split; [ zutil_arith | ] |
| 21 |
| [ |- Z.log2_up _ <= Z.log2_up _ ] |
| 22 |
=> apply Z.log2_up_le_mono |
| 23 |
| [ |- Z.log2 _ <= Z.log2 _ ] |
| 24 |
=> apply Z.log2_le_mono |
| 25 |
| [ |- Z.succ _ <= Z.succ _ ] |
| 26 |
=> apply Zsucc_le_compat |
| 27 |
| [ |- Z.pred _ <= Z.pred _ ] |
| 28 |
=> apply Z.pred_le_mono |
| 29 |
| [ |- ?x * _ <= ?x * _ ] |
| 30 |
=> first [ apply Z.mul_le_mono_nonneg_l; [ zutil_arith | ] |
| 31 |
| apply Z.mul_le_mono_nonpos_l; [ zutil_arith | ] ] |
| 32 |
| [ |- _ * ?x <= _ * ?x ] |
| 33 |
=> first [ apply Z.mul_le_mono_nonneg_r; [ zutil_arith | ] |
| 34 |
| apply Z.mul_le_mono_nonpos_r; [ zutil_arith | ] ] |
| 35 |
| [ |- -_ <= -_ ] |
| 36 |
=> apply -> Z.opp_le_mono |
| 37 |
| [ |- _ / ?x <= _ / ?x ] |
| 38 |
=> apply Z.div_le_mono; [ zutil_arith | ] |
| 39 |
| [ |- ?x / _ <= ?x / _ ] |
| 40 |
=> apply Z.div_le_compat_l; [ zutil_arith | split; [ zutil_arith | ] ] |
| 41 |
| [ |- Z.quot _ ?x <= Z.quot _ ?x ] |
| 42 |
=> apply Z.quot_le_mono; [ zutil_arith | ] |
| 43 |
| [ |- Z.quot ?x _ <= Z.quot ?x _ ] |
| 44 |
=> apply Z.quot_le_compat_l; [ zutil_arith | split; [ zutil_arith | ] ] |
| 45 |
| [ |- Z.max ?x _ <= Z.max ?x _ ] |
| 46 |
=> apply Z.max_le_compat_l |
| 47 |
| [ |- Z.max _ ?x <= Z.max _ ?x ] |
| 48 |
=> apply Z.max_le_compat_r |
| 49 |
| [ |- Z.min ?x _ <= Z.min ?x _ ] |
| 50 |
=> apply Z.min_le_compat_l |
| 51 |
| [ |- Z.min _ ?x <= Z.min _ ?x ] |
| 52 |
=> apply Z.min_le_compat_r |
| 53 |
end. |
| 54 |
Ltac peel_le := repeat peel_le_step. |
| 55 |
End Z. |