| 1 |
(** * Push-Button Synthesis of Saturated Solinas: Reification Cache *) |
| 2 |
From Coq Require Import QArith_base Qround. |
| 3 |
From Coq Require Import ZArith. |
| 4 |
From Coq Require Import Derive. |
| 5 |
Require Import Crypto.Arithmetic.Core. |
| 6 |
Require Import Crypto.Arithmetic.ModOps. |
| 7 |
Require Import Crypto.Arithmetic.Saturated. |
| 8 |
Require Import Crypto.PushButtonSynthesis.ReificationCache. |
| 9 |
Local Open Scope Z_scope. |
| 10 |
|
| 11 |
Local Set Keyed Unification. (* needed for making [autorewrite] fast, c.f. COQBUG(https://github.com/coq/coq/issues/9283) *) |
| 12 |
|
| 13 |
Module Export SaturatedSolinas. |
| 14 |
Definition mulmod |
| 15 |
(s : Z) |
| 16 |
(c : list (Z * Z)) |
| 17 |
(log2base : Z) |
| 18 |
(n nreductions : nat) |
| 19 |
:= @Rows.mulmod (weight log2base 1) (2^log2base) s c n nreductions. |
| 20 |
|
| 21 |
Derive reified_mul_gen |
| 22 |
SuchThat (is_reification_of reified_mul_gen mulmod) |
| 23 |
As reified_mul_gen_correct. |
| 24 |
Proof. Time cache_reify (). Time Qed. |
| 25 |
#[global] |
| 26 |
Hint Extern 1 (_ = _) => apply_cached_reification mulmod (proj1 reified_mul_gen_correct) : reify_cache_gen. |
| 27 |
Local Definition reified_mul_gen_correct_proj2 := proj2 reified_mul_gen_correct. |
| 28 |
|
| 29 |
Hint Immediate reified_mul_gen_correct_proj2 : wf_gen_cache. |
| 30 |
#[global] |
| 31 |
Hint Rewrite (proj1 reified_mul_gen_correct) : interp_gen_cache. |
| 32 |
Local Opaque reified_mul_gen. (* needed for making [autorewrite] not take a very long time *) |
| 33 |
End SaturatedSolinas. |