aboutsummaryrefslogtreecommitdiff
path: root/src/Algebra.v
diff options
context:
space:
mode:
authorGravatar Andres Erbsen <andreser@mit.edu>2016-06-16 11:41:09 -0400
committerGravatar Andres Erbsen <andreser@mit.edu>2016-06-16 11:41:09 -0400
commit4a3ef560a1232a8628e24a054c78483115192ce9 (patch)
tree7cd6bb784f9c7bb72716c865b94a25bb6be6666d /src/Algebra.v
parent52fd1ef20745ec8487870cd0faec558d614e562a (diff)
prove ring admits
Diffstat (limited to 'src/Algebra.v')
-rw-r--r--src/Algebra.v23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/Algebra.v b/src/Algebra.v
index 85602e64a..462c8b38d 100644
--- a/src/Algebra.v
+++ b/src/Algebra.v
@@ -240,6 +240,13 @@ Module Ring.
- eapply @right_identity; eauto with typeclass_instances.
- eapply associative.
Qed.
+
+ Lemma opp_nonzero_nonzero : forall x, x <> 0 -> opp x <> 0.
+ Proof.
+ intros ? Hx Ho.
+ assert (Hxo: x + opp x = 0) by (rewrite right_inverse; reflexivity).
+ rewrite Ho, right_identity in Hxo. intuition.
+ Qed.
End Ring.
Section TacticSupportCommutative.
@@ -248,6 +255,20 @@ Module Ring.
Global Instance Cring_Cring_commutative_ring :
@Cring.Cring T zero one add mul sub opp eq Ring.Ncring_Ring_ops Ring.Ncring_Ring.
Proof. unfold Cring.Cring; intros; dropRingSyntax. eapply commutative. Qed.
+
+ Lemma ring_theory_for_stdlib_tactic : Ring_theory.ring_theory zero one add mul sub opp eq.
+ Proof.
+ constructor; intros. (* TODO(automation): make [auto] do this? *)
+ - apply left_identity.
+ - apply commutative.
+ - apply associative.
+ - apply left_identity.
+ - apply commutative.
+ - apply associative.
+ - apply right_distributive.
+ - apply ring_sub_definition.
+ - apply right_inverse.
+ Qed.
End TacticSupportCommutative.
End Ring.
@@ -299,7 +320,7 @@ Module Field.
Lemma field_theory_for_stdlib_tactic : Field_theory.field_theory 0 1 add mul sub opp div inv eq.
Proof.
constructor.
- admit.
+ { apply Ring.ring_theory_for_stdlib_tactic. }
{ intro H01. symmetry in H01. auto using zero_neq_one. }
{ apply field_div_definition. }
{ apply left_multiplicative_inverse. }