diff options
author | Andres Erbsen <andreser@mit.edu> | 2016-06-20 03:13:59 -0400 |
---|---|---|
committer | Andres Erbsen <andreser@mit.edu> | 2016-06-20 03:13:59 -0400 |
commit | aafcec91728330c79d74f4c984729cf3aadc3605 (patch) | |
tree | 8699975633a47b5d1929014af1e14eb19ecd1993 /src/ModularArithmetic/ModularArithmeticTheorems.v | |
parent | a7c3e57cb7c3280dfec3a95b18dec83ee6e6d4f4 (diff) | |
parent | b41ac7998a11354618b122874c03bc68c2833a94 (diff) |
Merge branch 'field-experiment'
includes broken files to be removed in next commit
Diffstat (limited to 'src/ModularArithmetic/ModularArithmeticTheorems.v')
-rw-r--r-- | src/ModularArithmetic/ModularArithmeticTheorems.v | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ModularArithmetic/ModularArithmeticTheorems.v b/src/ModularArithmetic/ModularArithmeticTheorems.v index 6168f88bd..8e526745c 100644 --- a/src/ModularArithmetic/ModularArithmeticTheorems.v +++ b/src/ModularArithmetic/ModularArithmeticTheorems.v @@ -150,6 +150,15 @@ Section FandZ. intuition; find_inversion; rewrite ?Z.mod_0_l, ?Z.mod_small in *; intuition. Qed. + Require Crypto.Algebra. + Global Instance commutative_ring_modulo : @Algebra.commutative_ring (F m) Logic.eq (ZToField 0) (ZToField 1) opp add sub mul. + Proof. + repeat split; Fdefn; try apply F_eq_dec. + { rewrite Z.add_0_r. auto. } + { rewrite <-Z.add_sub_swap, <-Z.add_sub_assoc, Z.sub_diag, Z.add_0_r. apply Z_mod_same_full. } + { rewrite Z.mul_1_r. auto. } + Qed. + Lemma ZToField_0 : @ZToField m 0 = 0. Proof. Fdefn. |