aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jadep <jade.philipoom@gmail.com>2016-07-25 22:41:08 -0400
committerGravatar jadep <jade.philipoom@gmail.com>2016-07-25 22:41:08 -0400
commita8836bda7dc57933098fe5d513a52221591252b0 (patch)
treef86ddaf0f075ae357a852be408c51e9d6a34200b /src
parent4c73b7273c5fae67154ad9dd8bd3a719e4fbcf5f (diff)
Fix 8.4 build.
Diffstat (limited to 'src')
-rw-r--r--src/ModularArithmetic/ModularBaseSystemList.v1
-rw-r--r--src/ModularArithmetic/ModularBaseSystemOpt.v1
-rw-r--r--src/ModularArithmetic/ModularBaseSystemProofs.v11
-rw-r--r--src/Util/NatUtil.v5
4 files changed, 10 insertions, 8 deletions
diff --git a/src/ModularArithmetic/ModularBaseSystemList.v b/src/ModularArithmetic/ModularBaseSystemList.v
index cbab03d6a..b46429fcc 100644
--- a/src/ModularArithmetic/ModularBaseSystemList.v
+++ b/src/ModularArithmetic/ModularBaseSystemList.v
@@ -1,4 +1,5 @@
Require Import Coq.ZArith.Zpower Coq.ZArith.ZArith.
+Require Import Coq.Numbers.Natural.Peano.NPeano.
Require Import Coq.Lists.List.
Require Import Crypto.Util.ListUtil Crypto.Util.CaseUtil Crypto.Util.ZUtil.
Require Import Crypto.ModularArithmetic.PrimeFieldTheorems.
diff --git a/src/ModularArithmetic/ModularBaseSystemOpt.v b/src/ModularArithmetic/ModularBaseSystemOpt.v
index 5f748e0f6..884c0ea72 100644
--- a/src/ModularArithmetic/ModularBaseSystemOpt.v
+++ b/src/ModularArithmetic/ModularBaseSystemOpt.v
@@ -14,6 +14,7 @@ Require Import Crypto.Util.Tuple.
Require Import Crypto.Util.ListUtil Crypto.Util.ZUtil Crypto.Util.NatUtil Crypto.Util.CaseUtil.
Import ListNotations.
Require Import Coq.ZArith.ZArith Coq.ZArith.Zpower Coq.ZArith.ZArith Coq.ZArith.Znumtheory.
+Require Import Coq.Numbers.Natural.Peano.NPeano.
Require Import Coq.QArith.QArith Coq.QArith.Qround.
Require Import Crypto.Tactics.VerdiTactics.
Require Export Crypto.Util.FixCoqMistakes.
diff --git a/src/ModularArithmetic/ModularBaseSystemProofs.v b/src/ModularArithmetic/ModularBaseSystemProofs.v
index 2baf2ccc2..a2ed6ea4c 100644
--- a/src/ModularArithmetic/ModularBaseSystemProofs.v
+++ b/src/ModularArithmetic/ModularBaseSystemProofs.v
@@ -264,14 +264,14 @@ Section CarryProofs.
destruct limb_widths; distr_length; congruence).
repeat break_if; repeat rewrite ?pred_mod, ?Nat.succ_pred,?Nat.mod_same in * by omega;
try omega.
- rewrite !nth_default_base by (omega || auto).
+ rewrite !nth_default_base by (auto || destruct (length limb_widths); auto).
rewrite sum_firstn_0.
autorewrite with zsimplify.
- match goal with |- appcontext [2 ^ ?a * ?b * 2 ^ ?c] =>
+ match goal with |- appcontext[2 ^ ?a * ?b * 2 ^ ?c] =>
replace (2 ^ a * b * 2 ^ c) with (2 ^ (a + c) * b) end.
- { rewrite <-sum_firstn_succ by (apply nth_error_Some_nth_default; omega).
+ { rewrite <-sum_firstn_succ by (apply nth_error_Some_nth_default; destruct (length limb_widths); auto).
rewrite Nat.succ_pred by omega.
- remember (Init.Nat.pred (length limb_widths)) as pred_len.
+ remember (pred (length limb_widths)) as pred_len.
fold k.
rewrite <-Z.mul_sub_distr_r.
replace (c - 2 ^ k) with (modulus * -1) by (cbv [c]; ring).
@@ -361,7 +361,7 @@ Section CanonicalizationProofs.
(if eq_nat_dec n (i mod length limb_widths)
then Z.pow2_mod (nth_default 0 us n) (log_cap n)
else nth_default 0 us n) +
- if PeanoNat.Nat.eq_dec n (S (i mod length limb_widths) mod length limb_widths)
+ if eq_nat_dec n (S (i mod length limb_widths) mod length limb_widths)
then c * nth_default 0 us (i mod length limb_widths) >> log_cap (i mod length limb_widths)
else 0
else 0.
@@ -482,7 +482,6 @@ Section CanonicalizationProofs.
Qed.
Hint Rewrite @nth_default_carry using (omega || distr_length; omega) : push_nth_default.
- Local Notation pred := Init.Nat.pred.
Local Notation "u '[' i ']' " := (nth_default 0 u i) (at level 30).
Local Notation "u '{{' i '}}' " := (carry_sequence (make_chain i) u) (at level 30).
diff --git a/src/Util/NatUtil.v b/src/Util/NatUtil.v
index 84fbb11eb..bf485d0d0 100644
--- a/src/Util/NatUtil.v
+++ b/src/Util/NatUtil.v
@@ -64,9 +64,10 @@ Proof.
reflexivity.
Qed.
-Lemma pred_mod : forall m, (0 < m)%nat -> ((pred m) mod m)%nat = Init.Nat.pred m.
+Lemma pred_mod : forall m, (0 < m)%nat -> ((pred m) mod m)%nat = pred m.
Proof.
- intros; apply Nat.mod_small; omega.
+ intros; apply Nat.mod_small.
+ destruct m; try omega; rewrite Nat.pred_succ; auto.
Qed.
Lemma div_add_l' : forall a b c, a <> 0 -> (a * b + c) / a = b + c / a.