blob: 8d24f2cd2e4b5065e407d227e2279818d4dd4b48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
Require Import Crypto.ModularArithmetic.PrimeFieldTheorems.
Require Import Crypto.Spec.CompleteEdwardsCurve.
Section ExtendedCoordinates.
Local Open Scope F_scope.
Context {prm:TwistedEdwardsParams}.
Context {p:BinInt.Z} {p_eq_q:p = q}.
Lemma prime_p : Znumtheory.prime p.
rewrite p_eq_q; exact prime_q.
Qed.
Add Field Ffield_Z : (@Ffield_theory p prime_p)
(morphism (@Fring_morph p),
preprocess [Fpreprocess],
postprocess [Fpostprocess],
constants [Fconstant],
div (@Fmorph_div_theory p),
power_tac (@Fpower_theory p) [Fexp_tac]).
Lemma biggerFraction : forall XP YP ZP XQ YQ ZQ d : F q,
ZQ <> 0 ->
ZP <> 0 ->
ZP * ZQ * ZP * ZQ + d * XP * XQ * YP * YQ <> 0 ->
ZP * ZToField 2 * ZQ * (ZP * ZQ) + XP * YP * ZToField 2 * d * (XQ * YQ) <> 0 ->
ZP * ZToField 2 * ZQ * (ZP * ZQ) - XP * YP * ZToField 2 * d * (XQ * YQ) <> 0 ->
((YP + XP) * (YQ + XQ) - (YP - XP) * (YQ - XQ)) *
(ZP * ZToField 2 * ZQ - XP * YP / ZP * ZToField 2 * d * (XQ * YQ / ZQ)) /
((ZP * ZToField 2 * ZQ - XP * YP / ZP * ZToField 2 * d * (XQ * YQ / ZQ)) *
(ZP * ZToField 2 * ZQ + XP * YP / ZP * ZToField 2 * d * (XQ * YQ / ZQ))) =
(XP / ZP * (YQ / ZQ) + YP / ZP * (XQ / ZQ)) / (1 + d * (XP / ZP) * (XQ / ZQ) * (YP / ZP) * (YQ / ZQ)).
Proof.
rewrite <-p_eq_q.
intros.
abstract (field; assumption).
Qed.
End ExtendedCoordinates.
|