aboutsummaryrefslogtreecommitdiff
path: root/src/Galois/ModularBaseSystem.v
diff options
context:
space:
mode:
authorGravatar Jade Philipoom <jadep@mit.edu>2015-11-07 12:47:34 -0500
committerGravatar Jade Philipoom <jadep@mit.edu>2015-11-07 12:47:34 -0500
commit9e767c9bfe4158215e4efaa1a4cc1744bb0b2b58 (patch)
tree8b1c01773816711230363925704a145de0162cab /src/Galois/ModularBaseSystem.v
parent46f3eb0abe028acf7aae9868aabc1920695c6a56 (diff)
ModularBaseSystem: continuing to prove base_good.
Diffstat (limited to 'src/Galois/ModularBaseSystem.v')
-rw-r--r--src/Galois/ModularBaseSystem.v51
1 files changed, 31 insertions, 20 deletions
diff --git a/src/Galois/ModularBaseSystem.v b/src/Galois/ModularBaseSystem.v
index 379f7c4d8..70903536f 100644
--- a/src/Galois/ModularBaseSystem.v
+++ b/src/Galois/ModularBaseSystem.v
@@ -85,32 +85,43 @@ Module GFPseudoMersenneBase (BC:BaseCoefs) (M:Modulus) (P:PseudoMersenneBasePara
}
Qed.
+ Lemma map_nth_default_base_high : forall n, (n < (length BC.base))%nat ->
+ nth_default 0 (map (Z.mul (2 ^ P.k)) BC.base) n =
+ (2 ^ P.k) * (nth_default 0 BC.base n).
+ Proof.
+ intros.
+ erewrite map_nth_default; auto.
+ Qed.
+
Lemma base_good :
forall i j, (i+j < length base)%nat ->
let b := nth_default 0 base in
let r := (b i * b j) / b (i+j)%nat in
b i * b j = r * b (i+j)%nat.
Proof.
- (* TODO: move to listutil *)
- Lemma nth_error_app : forall {T} n (xs ys:list T), nth_error (xs ++ ys) n =
- if lt_dec n (length xs)
- then nth_error xs n
- else nth_error ys (n - length xs).
- Proof.
- induction n; destruct xs; destruct ys; nth_tac.
- Admitted.
-
- intros.
- subst b.
- unfold base, nth_default.
- repeat rewrite nth_error_app.
- destruct (lt_dec i (length BC.base)); destruct (lt_dec j (length BC.base)).
- nth_tac. destruct (lt_dec (i + j) (length BC.base)); try omega.
- SearchAbout nth_error.
-
-
- Admitted.
-
+ intros.
+ subst b. subst r.
+ unfold base in *.
+ rewrite app_length in H; rewrite map_length in H.
+ repeat rewrite nth_default_app.
+ destruct (lt_dec i (length BC.base)); destruct (lt_dec j (length BC.base)); destruct (lt_dec (i + j) (length BC.base)); try omega.
+ {
+ (* i < length BC.base, j < length BC.base, i + j < length BC.base *)
+ apply BC.base_good; auto.
+ } {
+ (* i < length BC.base, j < length BC.base, i + j >= length BC.base *)
+ admit.
+ } {
+ (* i < length BC.base, j >= length BC.base, i + j >= length BC.base *)
+ do 2 rewrite map_nth_default_base_high by omega.
+ remember (nth_default 0 BC.base) as b.
+ remember (j - length BC.base)%nat as j'.
+ admit.
+ } {
+ (* i >= length BC.base, j < length BC.base, i + j >= length BC.base *)
+ admit.
+ }
+ Qed.
End EC.
Module E := BaseSystem EC.