aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2018-07-14 10:50:24 -0400
committerGravatar Jason Gross <jgross@mit.edu>2018-07-14 10:50:24 -0400
commitf79fdb77c7baff92444204c00787d2c95da18997 (patch)
tree7a473a57f0903a14feca467e0e984b4275d524a5 /src
parentce401baf05f0228807cfe53da8d37595429a9761 (diff)
Add a stronger version of eval_reduce
Diffstat (limited to 'src')
-rw-r--r--src/Experiments/NewPipeline/Arithmetic.v10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Experiments/NewPipeline/Arithmetic.v b/src/Experiments/NewPipeline/Arithmetic.v
index 0433bcda0..013b28b93 100644
--- a/src/Experiments/NewPipeline/Arithmetic.v
+++ b/src/Experiments/NewPipeline/Arithmetic.v
@@ -157,6 +157,16 @@ Module Associational.
rewrite <-reduction_rule, eval_split; trivial. Qed.
Hint Rewrite eval_reduce : push_eval.
+ Lemma eval_reduce_adjusted s c p w c' (s_nz:s<>0) (modulus_nz:s-eval c<>0)
+ (w_mod:w mod s = 0) (w_nz:w <> 0) (Hc' : eval c' = (w / s) * eval c) :
+ eval (reduce w c' p) mod (s - eval c) = eval p mod (s - eval c).
+ Proof using Type.
+ cbv [reduce]; push.
+ rewrite Hc', <- (Z.mul_comm (eval c)), <- !Z.mul_assoc, <-reduction_rule by auto.
+ autorewrite with zsimplify_const; rewrite !Z.mul_assoc, Z.mul_div_eq_full, w_mod by auto.
+ autorewrite with zsimplify_const; rewrite eval_split; trivial.
+ Qed.
+
(*
Definition splitQ (s:Q) (p:list (Z*Z)) : list (Z*Z) * list (Z*Z)
:= let hi_lo := partition (fun t => (fst t * Zpos (Qden s)) mod (Qnum s) =? 0) p in