diff options
author | Andres Erbsen <andreser@mit.edu> | 2016-07-28 18:40:28 -0400 |
---|---|---|
committer | Andres Erbsen <andreser@mit.edu> | 2016-08-04 11:47:51 -0400 |
commit | 4964f1ff2d40ba08573deddca56140c4ac4b19eb (patch) | |
tree | 61b24623e414dfa3e09a32cf62e8acd1909dae37 /src/Spec/ModularArithmetic.v | |
parent | fbb0f64892560322ed9dcd0f664e730e74de9b4e (diff) |
Refactor ModularArithmetic into Zmod, expand Decidable
ModularArithmetic now uses Algebra lemmas in various places instead of
custom manual proofs. Similarly, Util.Decidable is used to state and
prove the relevant decidability results.
Backwards-incompatible changes:
F_some_lemma -> Zmod.some_lemma
Arguments ZToField _%Z _%Z : clear implicits.
inv_spec says inv x * x = 1, not x * inv x = 1
Diffstat (limited to 'src/Spec/ModularArithmetic.v')
-rw-r--r-- | src/Spec/ModularArithmetic.v | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Spec/ModularArithmetic.v b/src/Spec/ModularArithmetic.v index fc506f61d..16584c683 100644 --- a/src/Spec/ModularArithmetic.v +++ b/src/Spec/ModularArithmetic.v @@ -35,7 +35,7 @@ Section FieldOperations. Definition inv_with_spec : { inv : F m -> F m | inv zero = zero /\ ( Znumtheory.prime m -> - forall a, a <> zero -> mul a (inv a) = one ) + forall a, a <> zero -> mul (inv a) a = one ) } := Pre.inv_impl. Definition inv : F m -> F m := Eval hnf in proj1_sig inv_with_spec. Definition div (a b:F m) : F m := mul a (inv b). @@ -49,7 +49,7 @@ End FieldOperations. Delimit Scope F_scope with F. Arguments F _%Z. -Arguments ZToField {_} _%Z : simpl never. +Arguments ZToField _%Z _%Z : simpl never, clear implicits. Arguments add {_} _%F _%F : simpl never. Arguments mul {_} _%F _%F : simpl never. Arguments sub {_} _%F _%F : simpl never. @@ -57,11 +57,10 @@ Arguments div {_} _%F _%F : simpl never. Arguments pow {_} _%F _%N : simpl never. Arguments inv {_} _%F : simpl never. Arguments opp {_} _%F : simpl never. -Local Open Scope F_scope. Infix "+" := add : F_scope. Infix "*" := mul : F_scope. Infix "-" := sub : F_scope. Infix "/" := div : F_scope. Infix "^" := pow : F_scope. -Notation "0" := (ZToField 0) : F_scope. -Notation "1" := (ZToField 1) : F_scope. +Notation "0" := (ZToField _ 0) : F_scope. +Notation "1" := (ZToField _ 1) : F_scope.
\ No newline at end of file |