| 1 |
(** * Declaration of Hint Databases with lemmas about ℤ from the standard library *) |
| 2 |
From Coq Require Import Lia Lqa. |
| 3 |
From Coq Require Import ZArith. |
| 4 |
(* Should we [From Coq Require Import Zhints.]? *) |
| 5 |
|
| 6 |
Global Hint Extern 1 => lia : lia. |
| 7 |
Global Hint Extern 1 => lra : lra. |
| 8 |
Global Hint Extern 1 => nia : nia. |
| 9 |
|
| 10 |
Ltac zutil_arith := solve [ lia | auto with nocore ]. |
| 11 |
Ltac zutil_arith_more_inequalities := solve [ zutil_arith | auto with zarith ]. |
| 12 |
|
| 13 |
(** Only hints that are always safe to apply (i.e., reversible), and |
| 14 |
which can reasonably be said to "simplify" the goal, should go in |
| 15 |
this database. *) |
| 16 |
Create HintDb zsimplify discriminated. |
| 17 |
(** Only hints that are always safe to apply, and "simplify" the goal, |
| 18 |
and don't require any side conditions, should go in this |
| 19 |
database. *) |
| 20 |
Create HintDb zsimplify_fast discriminated. |
| 21 |
(** Hints which turn [Z] operations on concrete positives into the |
| 22 |
corresponding operation on [Pos]. *) |
| 23 |
Create HintDb zsimplify_Z_to_pos discriminated. |
| 24 |
(** Only hints with no side conditions that strip constants, and |
| 25 |
nothing else. *) |
| 26 |
Create HintDb zsimplify_const discriminated. |
| 27 |
(** We create separate databases for two directions of transformations |
| 28 |
involving [Z.log2]; combining them leads to loops. *) |
| 29 |
(* for hints that take in hypotheses of type [log2 _], and spit out conclusions of type [_ ^ _] *) |
| 30 |
Create HintDb hyp_log2 discriminated. |
| 31 |
(* for hints that take in hypotheses of type [_ ^ _], and spit out conclusions of type [log2 _] *) |
| 32 |
Create HintDb concl_log2 discriminated. |
| 33 |
|
| 34 |
(** "push" means transform [-f x] to [f (-x)]; "pull" means go the other way *) |
| 35 |
Create HintDb push_Zopp discriminated. |
| 36 |
Create HintDb pull_Zopp discriminated. |
| 37 |
Create HintDb push_Zpow discriminated. |
| 38 |
Create HintDb pull_Zpow discriminated. |
| 39 |
Create HintDb push_Zmul discriminated. |
| 40 |
Create HintDb pull_Zmul discriminated. |
| 41 |
Create HintDb push_Zdiv discriminated. |
| 42 |
Create HintDb pull_Zdiv discriminated. |
| 43 |
Create HintDb push_Zadd discriminated. |
| 44 |
Create HintDb pull_Zadd discriminated. |
| 45 |
Create HintDb push_Zsub discriminated. |
| 46 |
Create HintDb pull_Zsub discriminated. |
| 47 |
Create HintDb pull_Zmod discriminated. |
| 48 |
Create HintDb push_Zmod discriminated. |
| 49 |
Create HintDb pull_Zof_nat discriminated. |
| 50 |
Create HintDb push_Zof_nat discriminated. |
| 51 |
Create HintDb pull_Zshift discriminated. |
| 52 |
Create HintDb push_Zshift discriminated. |
| 53 |
Create HintDb pull_Zof_N discriminated. |
| 54 |
Create HintDb push_Zof_N discriminated. |
| 55 |
Create HintDb pull_Zto_N discriminated. |
| 56 |
Create HintDb push_Zto_N discriminated. |
| 57 |
Create HintDb Zshift_to_pow discriminated. |
| 58 |
Create HintDb Zpow_to_shift discriminated. |
| 59 |
Create HintDb pull_Zmax discriminated. |
| 60 |
Create HintDb push_Zmax discriminated. |
| 61 |
Global Hint Extern 1 => progress autorewrite with push_Zopp in * : push_Zopp. |
| 62 |
Global Hint Extern 1 => progress autorewrite with pull_Zopp in * : pull_Zopp. |
| 63 |
Global Hint Extern 1 => progress autorewrite with push_Zpow in * : push_Zpow. |
| 64 |
Global Hint Extern 1 => progress autorewrite with pull_Zpow in * : pull_Zpow. |
| 65 |
Global Hint Extern 1 => progress autorewrite with push_Zmul in * : push_Zmul. |
| 66 |
Global Hint Extern 1 => progress autorewrite with pull_Zmul in * : pull_Zmul. |
| 67 |
Global Hint Extern 1 => progress autorewrite with push_Zadd in * : push_Zadd. |
| 68 |
Global Hint Extern 1 => progress autorewrite with pull_Zadd in * : pull_Zadd. |
| 69 |
Global Hint Extern 1 => progress autorewrite with push_Zsub in * : push_Zsub. |
| 70 |
Global Hint Extern 1 => progress autorewrite with pull_Zsub in * : pull_Zsub. |
| 71 |
Global Hint Extern 1 => progress autorewrite with push_Zdiv in * : push_Zmul. |
| 72 |
Global Hint Extern 1 => progress autorewrite with pull_Zdiv in * : pull_Zmul. |
| 73 |
Global Hint Extern 1 => progress autorewrite with pull_Zmod in * : pull_Zmod. |
| 74 |
Global Hint Extern 1 => progress autorewrite with push_Zmod in * : push_Zmod. |
| 75 |
Global Hint Extern 1 => progress autorewrite with pull_Zof_nat in * : pull_Zof_nat. |
| 76 |
Global Hint Extern 1 => progress autorewrite with push_Zof_nat in * : push_Zof_nat. |
| 77 |
Global Hint Extern 1 => progress autorewrite with pull_Zshift in * : pull_Zshift. |
| 78 |
Global Hint Extern 1 => progress autorewrite with push_Zshift in * : push_Zshift. |
| 79 |
Global Hint Extern 1 => progress autorewrite with Zshift_to_pow in * : Zshift_to_pow. |
| 80 |
Global Hint Extern 1 => progress autorewrite with Zpow_to_shift in * : Zpow_to_shift. |
| 81 |
Global Hint Extern 1 => progress autorewrite with pull_Zof_N in * : pull_Zof_N. |
| 82 |
Global Hint Extern 1 => progress autorewrite with push_Zof_N in * : push_Zof_N. |
| 83 |
Global Hint Extern 1 => progress autorewrite with pull_Zto_N in * : pull_Zto_N. |
| 84 |
Global Hint Extern 1 => progress autorewrite with push_Zto_N in * : push_Zto_N. |
| 85 |
Global Hint Extern 1 => progress autorewrite with push_Zmax in * : push_Zmax. |
| 86 |
Global Hint Extern 1 => progress autorewrite with pull_Zmax in * : pull_Zmax. |
| 87 |
|
| 88 |
(** For the occasional lemma that can remove the use of [Z.div] *) |
| 89 |
Create HintDb zstrip_div. |
| 90 |
|
| 91 |
Create HintDb Ztestbit discriminated. |
| 92 |
Create HintDb Ztestbit_full discriminated. |