aboutsummaryrefslogtreecommitdiff
path: root/src/ModularArithmetic/ModularArithmeticTheorems.v
diff options
context:
space:
mode:
authorGravatar Andres Erbsen <andreser@mit.edu>2016-02-20 13:05:10 -0500
committerGravatar Andres Erbsen <andreser@mit.edu>2016-02-26 14:26:37 -0500
commit01f66dcd54921fd973a6ef00706eb41130eb47e5 (patch)
treeb337d997468f7736687a765a20e484e75fa5b542 /src/ModularArithmetic/ModularArithmeticTheorems.v
parent9c129000ea8bce2c794af6179524f42d88a330a1 (diff)
ModularArithmetic: reasonable-time FieldToZ inv implementation
Diffstat (limited to 'src/ModularArithmetic/ModularArithmeticTheorems.v')
-rw-r--r--src/ModularArithmetic/ModularArithmeticTheorems.v23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ModularArithmetic/ModularArithmeticTheorems.v b/src/ModularArithmetic/ModularArithmeticTheorems.v
index f96be4566..4602e8781 100644
--- a/src/ModularArithmetic/ModularArithmeticTheorems.v
+++ b/src/ModularArithmetic/ModularArithmeticTheorems.v
@@ -292,6 +292,18 @@ Section FandZ.
Fdefn.
}
Qed.
+
+ Lemma ZToField_eqmod : forall x y : Z, x mod m = y mod m -> ZToField x = @ZToField m y.
+ Fdefn.
+ Qed.
+
+ Lemma FieldToZ_nonzero:
+ forall x0 : F m, x0 <> 0 -> FieldToZ x0 <> 0%Z.
+ Proof.
+ intros x0 Hnz Hz.
+ rewrite <- Hz, ZToField_FieldToZ in Hnz; auto.
+ Qed.
+
End FandZ.
Section RingModuloPre.
@@ -642,4 +654,15 @@ Section VariousModulo.
omega.
Qed.
+ Lemma F_mul_comm : forall x y : F m, x*y = y*x.
+ intros; ring.
+ Qed.
+
+ Lemma Fq_sub_eq : forall x y a b : F m, a = b -> x-a = y-b -> x = y.
+ Proof.
+ intros x y a b Hab Hxayb; subst.
+ replace x with ((x - b) + b) by ring.
+ replace y with ((y - b) + b) by ring.
+ rewrite Hxayb; ring.
+ Qed.
End VariousModulo.