diff options
Diffstat (limited to 'src/Algebra')
-rw-r--r-- | src/Algebra/Field.v | 10 | ||||
-rw-r--r-- | src/Algebra/Group.v | 4 | ||||
-rw-r--r-- | src/Algebra/IntegralDomain.v | 11 | ||||
-rw-r--r-- | src/Algebra/Monoid.v | 4 | ||||
-rw-r--r-- | src/Algebra/Ring.v | 13 |
5 files changed, 24 insertions, 18 deletions
diff --git a/src/Algebra/Field.v b/src/Algebra/Field.v index ebc92c0e5..f35e2c1cc 100644 --- a/src/Algebra/Field.v +++ b/src/Algebra/Field.v @@ -1,4 +1,6 @@ -Require Import Crypto.Util.Relations Crypto.Util.Tactics Crypto.Util.Notations. +Require Import Crypto.Util.Relations Crypto.Util.Notations. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.DebugPrint. Require Import Coq.Classes.RelationClasses Coq.Classes.Morphisms. Require Import Crypto.Algebra Crypto.Algebra.Ring Crypto.Algebra.IntegralDomain. Require Coq.setoid_ring.Field_theory. @@ -243,7 +245,7 @@ Ltac inequalities_to_inverse_equations fld := unique pose proof (right_multiplicative_inverse(H:=fld) _ H) | not (eq zero ?d) => unique pose proof (right_multiplicative_inverse(H:=fld) _ (symmetry(R:=fun a b => not (eq a b)) H)) - | not (eq ?x ?y) => + | not (eq ?x ?y) => unique pose proof (right_multiplicative_inverse(H:=fld) _ (Ring.neq_sub_neq_zero _ _ H)) end end. @@ -261,7 +263,7 @@ Ltac inverses_to_conditional_equations fld := repeat match goal with | |- context[inv ?d] => unique_pose_implication constr:(right_multiplicative_inverse(H:=fld) d) - | H: context[inv ?d] |- _ => + | H: context[inv ?d] |- _ => unique_pose_implication constr:(right_multiplicative_inverse(H:=fld) d) end. @@ -324,4 +326,4 @@ Section FieldSquareRoot. eapply zero_product_zero_factor. fsatz. Qed. -End FieldSquareRoot.
\ No newline at end of file +End FieldSquareRoot. diff --git a/src/Algebra/Group.v b/src/Algebra/Group.v index c1c514171..b053fc844 100644 --- a/src/Algebra/Group.v +++ b/src/Algebra/Group.v @@ -1,4 +1,4 @@ -Require Import Coq.Classes.Morphisms Crypto.Util.Relations Crypto.Util.Tactics. +Require Import Coq.Classes.Morphisms Crypto.Util.Relations (*Crypto.Util.Tactics*). Require Import Crypto.Algebra Crypto.Algebra.Monoid Crypto.Algebra.ScalarMult. Section BasicProperties. @@ -213,4 +213,4 @@ Section HomomorphismComposition. Global Instance is_homomorphism_compose_refl : @Monoid.is_homomorphism G EQ OP K eqK opK (fun x => phi' (phi x)) := is_homomorphism_compose (fun x => reflexivity _). -End HomomorphismComposition.
\ No newline at end of file +End HomomorphismComposition. diff --git a/src/Algebra/IntegralDomain.v b/src/Algebra/IntegralDomain.v index f58874710..083c10242 100644 --- a/src/Algebra/IntegralDomain.v +++ b/src/Algebra/IntegralDomain.v @@ -1,6 +1,9 @@ -Require Import Crypto.Util.Tactics Crypto.Util.Relations. +Require Coq.setoid_ring.Integral_domain. +Require Crypto.Tactics.Algebra_syntax.Nsatz. Require Import Crypto.Util.Factorize. Require Import Crypto.Algebra Crypto.Algebra.Ring. +Require Import Crypto.Util.Tactics.RewriteHyp. +Require Import Crypto.Util.Tactics.BreakMatch. Module IntegralDomain. Section IntegralDomain. @@ -25,7 +28,7 @@ Module IntegralDomain. Local Infix "=" := eq. Local Notation "a <> b" := (not (a = b)). Local Infix "=" := eq : type_scope. Local Notation "a <> b" := (not (a = b)) : type_scope. Local Infix "+" := add. Local Infix "-" := sub. Local Infix "*" := mul. - + Inductive coef := | Coef_one | Coef_opp (_:coef) @@ -62,7 +65,7 @@ Module IntegralDomain. Section WithChar. Context C (char_ge_C:@Ring.char_ge R eq zero one opp add sub mul C) (HC: Pos.lt xH C). - + Definition is_factor_nonzero (n:N) : bool := match n with N0 => false | N.pos p => BinPos.Pos.ltb p C end. Lemma is_factor_nonzero_correct (n:N) (refl:Logic.eq (is_factor_nonzero n) true) @@ -79,7 +82,7 @@ Module IntegralDomain. { rewrite Znat.N2Z.inj_mul; Ring.push_homomorphism of_Z. eapply Ring.nonzero_product_iff_nonzero_factor; eauto. } Qed. - + Definition is_constant_nonzero (z:Z) : bool := match factorize_or_fail (Z.abs_N z) with | Some factors => List.forallb is_factor_nonzero factors diff --git a/src/Algebra/Monoid.v b/src/Algebra/Monoid.v index f71efff3e..565058cf7 100644 --- a/src/Algebra/Monoid.v +++ b/src/Algebra/Monoid.v @@ -1,5 +1,5 @@ Require Import Coq.Classes.Morphisms. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.RewriteHyp. Require Import Crypto.Algebra. Section Monoid. @@ -57,4 +57,4 @@ Section Homomorphism. is_homomorphism_phi_proper : Proper (respectful EQ eq) phi }. Global Existing Instance is_homomorphism_phi_proper. -End Homomorphism.
\ No newline at end of file +End Homomorphism. diff --git a/src/Algebra/Ring.v b/src/Algebra/Ring.v index 5c1cb1603..2b0e1ba80 100644 --- a/src/Algebra/Ring.v +++ b/src/Algebra/Ring.v @@ -1,8 +1,13 @@ +Require Coq.setoid_ring.Ncring. +Require Coq.setoid_ring.Cring. Require Import Coq.Classes.Morphisms. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.OnSubterms. +Require Import Crypto.Util.Tactics.Revert. Require Import Crypto.Algebra Crypto.Algebra.Group Crypto.Algebra.Monoid. Require Coq.ZArith.ZArith Coq.PArith.PArith. + Section Ring. Context {T eq zero one opp add sub mul} `{@ring T eq zero one opp add sub mul}. Local Infix "=" := eq : type_scope. Local Notation "a <> b" := (not (a = b)) : type_scope. @@ -86,10 +91,6 @@ Section Ring. forall x y : T, not (eq (mul x y) zero) <-> (not (eq x zero) /\ not (eq y zero)). Proof. intros; rewrite zero_product_iff_zero_factor; tauto. Qed. - Lemma nonzero_hypothesis_to_goal {Hzpzf:@is_zero_product_zero_factor T eq zero mul} : - forall x y : T, (not (eq x zero) -> eq y zero) <-> (eq (mul x y) zero). - Proof. intros; rewrite zero_product_iff_zero_factor; tauto. Qed. - Global Instance Ncring_Ring_ops : @Ncring.Ring_ops T zero one add mul sub opp eq. Global Instance Ncring_Ring : @Ncring.Ring T zero one add mul sub opp eq Ncring_Ring_ops. Proof. @@ -434,4 +435,4 @@ Create HintDb ring_simplify_subterms discriminated. Create HintDb ring_simplify_subterms_in_all discriminated. Hint Extern 1 => progress ring_simplify : ring_simplify. Hint Extern 1 => progress ring_simplify_subterms : ring_simplify_subterms. -Hint Extern 1 => progress ring_simplify_subterms_in_all : ring_simplify_subterms_in_all.
\ No newline at end of file +Hint Extern 1 => progress ring_simplify_subterms_in_all : ring_simplify_subterms_in_all. |