aboutsummaryrefslogtreecommitdiff
path: root/src/Algebra.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jagro@google.com>2016-06-23 15:27:35 -0700
committerGravatar Jason Gross <jagro@google.com>2016-06-23 15:27:35 -0700
commitbdbd0ccd67fa493d8362981d093aafb14d2b272a (patch)
tree59d81d5ad9640e81d11595aac10e0f7dbfbfa054 /src/Algebra.v
parent2e760539d15eafeb7ed7018680d9436e4404de34 (diff)
Add tactics to Tactics, at most 2 sq-roots to Algebra
Diffstat (limited to 'src/Algebra.v')
-rw-r--r--src/Algebra.v19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Algebra.v b/src/Algebra.v
index a79d89079..e12f68549 100644
--- a/src/Algebra.v
+++ b/src/Algebra.v
@@ -657,6 +657,25 @@ Ltac field_algebra :=
|trivial
|apply Ring.opp_nonzero_nonzero;trivial].
+Section ExtraLemmas.
+ Context {F zero one opp add sub mul inv div} `{F_field:field F eq zero one opp add sub mul inv div}.
+ Local Infix "+" := add. Local Infix "*" := mul. Local Infix "-" := sub. Local Infix "/" := div.
+ Local Notation "0" := zero. Local Notation "1" := one.
+
+ Lemma only_two_square_roots' x y : x * x = y * y -> x <> y -> x <> opp y -> False.
+ Proof.
+ intros.
+ canonicalize_field_equalities; canonicalize_field_inequalities.
+ assert (H' : (x + y) * (x - y) <> 0) by (apply mul_nonzero_nonzero; assumption).
+ apply H'; nsatz.
+ Qed.
+
+ Lemma only_two_square_roots x y z : x * x = z -> y * y = z -> x <> y -> x <> opp y -> False.
+ Proof.
+ intros; setoid_subst z; eauto using only_two_square_roots'.
+ Qed.
+End ExtraLemmas.
+
Section Example.
Context {F zero one opp add sub mul inv div} `{F_field:field F eq zero one opp add sub mul inv div}.
Local Infix "+" := add. Local Infix "*" := mul. Local Infix "-" := sub. Local Infix "/" := div.