aboutsummaryrefslogtreecommitdiff
path: root/src/Galois/BaseSystem.v
diff options
context:
space:
mode:
authorGravatar Jade Philipoom <jadep@mit.edu>2015-10-25 17:30:46 -0400
committerGravatar Jade Philipoom <jadep@mit.edu>2015-10-25 17:30:46 -0400
commit25db2573bae9ddcfb19811b0dccd049427384921 (patch)
tree0c54c305a6019d195a6262545fcb4010c7f0c3d8 /src/Galois/BaseSystem.v
parent59b8aacd7f54aa2bc90f2835182ead7d4641d1fe (diff)
parent3ecf80e98f556f86ae9c89fedef2434aad935212 (diff)
Merge branch 'base0_1' into jade
Diffstat (limited to 'src/Galois/BaseSystem.v')
-rw-r--r--src/Galois/BaseSystem.v15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Galois/BaseSystem.v b/src/Galois/BaseSystem.v
index dc41740bc..4467a900e 100644
--- a/src/Galois/BaseSystem.v
+++ b/src/Galois/BaseSystem.v
@@ -27,6 +27,7 @@ Admitted.
Module Type BaseCoefs.
(** [BaseCoefs] represent the weights of each digit in a positional number system, with the weight of least significant digit presented first. The following requirements on the base are preconditions for using it with BaseSystem. *)
Parameter base : list Z.
+ Axiom b0_1 : nth_default 0 base 0 = 1.
Axiom base_positive : forall b, In b base -> b > 0. (* nonzero would probably work too... *)
Axiom base_good :
forall i j, (i+j < length base)%nat ->
@@ -409,6 +410,7 @@ End BaseSystem.
Module Type PolynomialBaseParams.
Parameter b1 : positive. (* the value at which the polynomial is evaluated *)
Parameter baseLength : nat. (* 1 + degree of the polynomial *)
+ Axiom baseLengthNonzero : NPeano.ltb 0 baseLength = true.
End PolynomialBaseParams.
Module PolynomialBaseCoefs (Import P:PolynomialBaseParams) <: BaseCoefs.
@@ -416,6 +418,16 @@ Module PolynomialBaseCoefs (Import P:PolynomialBaseParams) <: BaseCoefs.
Definition bi i := (Zpos b1)^(Z.of_nat i).
Definition base := map bi (seq 0 baseLength).
+ Lemma b0_1 : nth_default 0 base 0 = 1.
+ unfold base, bi, nth_default.
+ case_eq baseLength; intros. {
+ assert ((0 < baseLength)%nat) by
+ (rewrite <-NPeano.ltb_lt; apply baseLengthNonzero).
+ subst; omega.
+ }
+ auto.
+ Qed.
+
Lemma base_positive : forall b, In b base -> b > 0.
unfold base.
intros until 0; intro H.
@@ -457,6 +469,9 @@ End PolynomialBaseCoefs.
Module BasePoly2Degree32Params <: PolynomialBaseParams.
Definition b1 := 2%positive.
Definition baseLength := 32%nat.
+ Lemma baseLengthNonzero : NPeano.ltb 0 baseLength = true.
+ compute; reflexivity.
+ Qed.
End BasePoly2Degree32Params.
Import ListNotations.