Dataset Viewer
Auto-converted to Parquet Duplicate
statement
stringlengths
1
4.02k
proof
stringlengths
0
28.5k
type
stringclasses
14 values
symbolic_name
stringlengths
1
2.01k
library
stringclasses
21 values
filename
stringclasses
381 values
imports
listlengths
0
133
deps
listlengths
0
64
docstring
stringclasses
140 values
source_url
stringclasses
1 value
commit
stringclasses
1 value
n_pos: 0 < n.
Hypothesis
n_pos
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
znz: Set
:= mkznz {val: Z; inZnZ: val = Z.modulo val n}.
Structure
znz
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "modulo" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
znz_inj: forall a b, a = b -> val a = val b.
intros; subst; auto. Qed.
Theorem
znz_inj
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Zeq_iok: forall x y, x = y -> Zeq_bool x y = true.
intros x y H; subst. apply Zeq_is_eq_bool, eq_refl. Qed.
Theorem
Zeq_iok
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
modz: forall x, (x mod n) = (x mod n) mod n.
intros x; rewrite Zmod_mod; auto with zarith. Qed.
Lemma
modz
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
zero
:= mkznz _ (modz 0).
Definition
zero
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "modz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
one
:= mkznz _ (modz 1).
Definition
one
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "modz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add v1 v2
:= mkznz _ (modz (val v1 + val v2)).
Definition
add
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "modz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
sub v1 v2
:= mkznz _ (modz (val v1 - val v2)).
Definition
sub
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "modz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mul v1 v2
:= mkznz _ (modz (val v1 * val v2)).
Definition
mul
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "modz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
opp v
:= mkznz _ (modz (-val v)).
Definition
opp
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "modz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
zirr: forall x1 x2 H1 H2, x1 = x2 -> mkznz x1 H1 = mkznz x2 H2.
Proof. intros x1 x2 H1 H2 H3. subst x1. rewrite (fun H => eq_proofs_unicity H H1 H2); auto. intros x y; case (Z.eq_dec x y); auto. Qed.
Theorem
zirr
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
znz1: forall x, x mod 1 = 0.
intros x; apply Zdivide_mod; auto with zarith. Qed.
Lemma
znz1
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
RZnZ: ring_theory zero one add mul sub opp (@eq znz).
split; auto. intros p; case p; intros x H; refine (zirr _ _ _ _ _); simpl; auto. intros [x Hx] [y Hy]. refine (zirr _ _ _ _ _); simpl. rewrite Zplus_comm; auto. intros [x Hx] [y Hy] [z Hz]. refine (zirr _ _ _ _ _); simpl. rewrite Zplus_mod; auto. rewrite (Zplus_mod((x + y) mod n)); auto. repeat rewrite Z...
Definition
RZnZ
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "add", "modulo", "mul", "one", "opp", "split", "sub", "zero", "zirr", "znz", "znz1" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mklist (n: nat): list nat
:= match n with O => nil | (S n) => cons n (mklist n) end.
Fixpoint
mklist
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
It is finite
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mklist_length: forall n1, length (mklist n1) = n1.
Proof. intros n1; elim n1; simpl; auto; clear n1. Qed.
Lemma
mklist_length
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mklist" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mklist_lt: forall n1 x, (In x (mklist n1)) -> (x < n1)%nat.
intros n1; elim n1; simpl; auto; clear n1. intros x H; case H. intros n1 Hrec x [H1 | H1]; try subst x; auto with arith. Qed.
Theorem
mklist_lt
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mklist" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
lt_mklist_lt: forall n1 x, (x < n1)%nat -> (In x (mklist n1)).
intros n1 x H; elim H; simpl; auto. Qed.
Theorem
lt_mklist_lt
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mklist" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
uniq_mklist: forall m, ulist (mklist m).
intros m; elim m; simpl; auto; clear m. intros m H; constructor; auto. intros H1; absurd (m < m)%nat; auto with arith. apply mklist_lt; auto. Qed.
Theorem
uniq_mklist
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mklist", "mklist_lt", "ulist" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
nat_z_kt: forall x, (x < Z.abs_nat n)%nat -> (Z_of_nat x) = (Z_of_nat x) mod n.
Proof. intros x H; rewrite Zmod_small; lia. Qed.
Theorem
nat_z_kt
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mkzlist: forall (l: list nat), (forall x, In x l -> (x < Z.abs_nat n)%nat) -> list znz.
fix mkzlist 1; intros l; case l. intros; exact nil. intros n1 l1 Hn. assert (F1: forall x, In x l1 -> (x < Z.abs_nat n)%nat). intros; apply Hn; simpl; auto. assert (F2: (n1 < Z.abs_nat n)%nat). apply Hn; simpl; auto. exact (cons (mkznz _ (nat_z_kt _ F2)) (mkzlist _ F1)). Defined.
Definition
mkzlist
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "nat_z_kt", "znz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mkzlist_length: forall l H, length (mkzlist l H) = length l.
Proof. intros l; elim l; simpl; auto; clear l. Qed.
Lemma
mkzlist_length
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mkzlist" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
in_mkzlist: forall l a Ha Hl, In (mkznz (Z_of_nat a) Ha) (mkzlist l Hl) -> In a l.
intros l1; elim l1; simpl; auto; clear l1. intros a1 l1 Hrec1 a2 l2 Hl2 [H4 | H4]. generalize (znz_inj _ _ H4); simpl; clear H4; intros H4; left. rewrite <- (Zabs_nat_Z_of_nat a1); rewrite H4; rewrite Zabs_nat_Z_of_nat; auto. right; apply (Hrec1 _ _ _ H4). Qed.
Theorem
in_mkzlist
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mkzlist", "znz_inj" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mkzlist_in: forall l a Ha Hl, In (Z.abs_nat a) l -> In (mkznz a Ha) (mkzlist l Hl).
intros l1; elim l1; simpl; auto; clear l1. intros a1 l1 Hrec1 a2 l2 Hl2 [H4 | H4]; auto. left; apply zirr; auto. rewrite H4; rewrite inj_Zabs_nat; auto. rewrite Z.abs_eq; auto with zarith. case (Z_mod_lt a2 n); auto with zarith. Qed.
Theorem
mkzlist_in
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mkzlist", "zirr" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
mkzlist_uniq: forall l H, ulist l -> ulist (mkzlist l H).
intros l H H1; generalize H; elim H1; simpl; auto; clear l H H1. intros a l H1 H2 Hrec H3; constructor; auto. intros HH; case H1; generalize HH; clear HH H1. assert (F1: forall l a Ha Hl, In (mkznz (Z_of_nat a) Ha) (mkzlist l Hl) -> In a l); auto. intros l1; elim l1; simpl; auto; clear l1. intros a1 l1 Hrec...
Theorem
mkzlist_uniq
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "in_mkzlist", "mkzlist", "ulist", "znz_inj" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
all_znz: list znz
:= (mkzlist (mklist (Z.abs_nat n)) (mklist_lt _)).
Definition
all_znz
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "mklist", "mklist_lt", "mkzlist", "znz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
all_znz_length: length all_znz = (Z.abs_nat n).
Proof. unfold all_znz; rewrite mkzlist_length. rewrite mklist_length; auto. Qed.
Lemma
all_znz_length
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "all_znz", "mklist_length", "mkzlist_length" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
uniq_all_znz: ulist all_znz.
unfold all_znz; apply mkzlist_uniq. apply uniq_mklist. Qed.
Theorem
uniq_all_znz
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "all_znz", "mkzlist_uniq", "ulist", "uniq_mklist" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
in_all_znz: forall z, In z all_znz.
intros (z1, Hz1). unfold all_znz; apply mkzlist_in. apply lt_mklist_lt. case (Z_mod_lt z1 n). auto with zarith. rewrite <- Hz1; intros H1 H2. case (Nat.le_gt_cases (Z.abs_nat n) (Z.abs_nat z1)); auto; intros H3. absurd (z1 < n); auto; apply Zle_not_lt. rewrite <- Z.abs_eq; auto. rewrite <- inj_Zabs_nat; auto. rewrite <...
Theorem
in_all_znz
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "all_znz", "lt_mklist_lt", "mkzlist_in" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
p_pos: 0 < p.
generalize (prime_ge_2 _ p_prime); auto with zarith. Qed.
Theorem
p_pos
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "p_prime" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
inv v
:= mkznz _ _ (modz p (fst (fst (Zegcd (val p v) p)))).
Definition
inv
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "Zegcd", "modz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
div v1 v2
:= mul _ v1 (inv v2).
Definition
div
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "inv", "mul" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
FZpZ: field_theory (zero _) (one _) (add _) (mul _) (sub _) (opp _) div inv (@eq (znz p)).
assert (Hmp := p_pos). split; auto. exact (RZnZ _ p_pos). intros H; injection H; repeat rewrite Zmod_small; auto with zarith. generalize (prime_ge_2 _ p_prime); auto with zarith. intros (n, Hn); unfold zero, one, inv, mul; simpl. intros H; apply zirr. generalize (Zegcd_is_egcd n p); case Zegcd; intros (u,v) w (Hu, (H...
Definition
FZpZ
Coqprime.elliptic
src/Coqprime/elliptic/GZnZ.v
[ "Coq", "ZArith", "Znumtheory", "Eqdep_dec", "List", "Lia", "Coqprime", "UList", "Field", "Pmod" ]
[ "RZnZ", "Zegcd", "Zegcd_is_egcd", "add", "div", "inv", "mul", "one", "opp", "p_pos", "p_prime", "split", "sub", "zero", "zirr", "znz" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"x + y"
:= (kplus x y).
Notation
x + y
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
K notations
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"x * y "
:= (kmul x y).
Notation
x * y
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"x - y "
:= (ksub x y).
Notation
x - y
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"- x"
:= (kopp x).
Notation
- x
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"/ x"
:= (kinv x).
Notation
/ x
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"x / y"
:= (kdiv x y).
Notation
x / y
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"0"
:= kO.
Notation
0
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"1"
:= kI.
Notation
1
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"2"
:= (1+1).
Notation
2
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"3"
:= (1+1 +1).
Notation
3
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"4"
:= (2 * 2).
Notation
4
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
Non singularity
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"27"
:= (3 * 3 * 3).
Notation
27
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
ell_theory: Prop
:= mk_ell_theory { (* field properties *) Kfth : field_theory kO kI kplus kmul ksub kopp kdiv kinv (@eq K); NonSingular: 4 * A * A * A + 27 * B * B <> 0; (* Characteristic greater than 2 *) one_not_zero: 1 <> 0; two_not_zero: 2 <> 0; is_zero_correct: forall k, is_zero k = true <-> k = 0 }.
Record
ell_theory
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "NonSingular", "is_zero_correct" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
pow (k: K) (n: nat)
:= match n with O => 1 | 1%nat => k | S n1 => k * pow k n1 end.
Fixpoint
pow
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"x ^ y"
:= (pow x y).
Notation
x ^ y
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "pow" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
pow_S: forall k n, k ^ (S n) = k * k ^ n.
intros k n; simpl; auto; case n; auto. simpl; rewrite Eth.(Kfth).(F_R).(Rmul_comm). rewrite Eth.(Kfth).(F_R).(Rmul_1_l); auto. Qed.
Theorem
pow_S
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Mkmul
:= rmul_ext3_Proper (Eq_ext kplus kmul kopp).
Let
Mkmul
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kpower_theory : power_theory 1 kmul (eq (A:=K)) BinNat.nat_of_N pow.
constructor. intros r n; case n; simpl; auto. intros p; elim p using BinPos.Pind; auto. intros p1 H. rewrite Pnat.nat_of_P_succ_morphism; rewrite pow_S. rewrite (pow_pos_succ (Eqsth K) Mkmul); auto. rewrite H; auto. exact Eth.(Kfth).(F_R).(Rmul_assoc). Qed.
Lemma
Kpower_theory
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Mkmul", "p1", "pow", "pow_S" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
iskpow_coef t
:= match t with | (S ?x) => iskpow_coef x | O => true | _ => false end.
Ltac
iskpow_coef
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
kpow_tac t
:= match iskpow_coef t with | true => constr:(BinNat.N_of_nat t) | _ => constr:(NotConstant) end.
Ltac
kpow_tac
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "iskpow_coef" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kdiv_def
:= (Fdiv_def Eth.(Kfth)).
Let
Kdiv_def
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kinv_ext : forall p q, p = q -> / p = / q.
Proof. intros p q H; rewrite H; auto. Qed.
Lemma
Kinv_ext
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Ksth
:= (Eqsth K).
Let
Ksth
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Keqe
:= (Eq_ext kplus kmul kopp).
Let
Keqe
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
AFth
:= Field_theory.F2AF Ksth Keqe Eth.(Kfth).
Let
AFth
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Keqe", "Ksth" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kmorph
:= InitialRing.gen_phiZ_morph Ksth Keqe (F_R Eth.(Kfth)).
Let
Kmorph
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Keqe", "Ksth" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kdiv1: forall r, r /1 = r.
Proof. intros r; field; auto. Qed.
Theorem
Kdiv1
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"x ?0"
:= (is_zero x) (at level 10).
Notation
x ?0
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
Some stuff for K
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
n2k (n: nat) : K
:= match n with O => kO | (S O) => kI | (S n1) => (1 + n2k n1) end.
Fixpoint
n2k
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
N2k
:= n2k.
Coercion
N2k
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "n2k" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kdiff_2_0: (2:K) <> 0.
Proof. simpl; auto. Qed.
Theorem
Kdiff_2_0
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Keq_minus_eq: forall x y, x - y = 0 -> x = y.
Proof. intros x y H. apply trans_equal with (y + (x - y)); try ring. rewrite H; ring. Qed.
Theorem
Keq_minus_eq
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Keq_minus_eq_inv: forall x y, x = y -> x - y = 0.
Proof. intros x y HH; rewrite HH; ring. Qed.
Theorem
Keq_minus_eq_inv
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kdiff_diff_minus_eq: forall x y, x <> y -> x - y <> 0.
Proof. intros x y H H1; case H; apply Keq_minus_eq; auto. Qed.
Theorem
Kdiff_diff_minus_eq
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Keq_minus_eq" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kmult_integral: forall x y, x * y = 0 -> x = 0 \/ y = 0.
Proof. intros x y H. generalize (Eth.(is_zero_correct) x); case (is_zero x); intros (H1, H2); auto; right. apply trans_equal with ((/x) * (x * y)); try field. intros H3; assert (H4 := H2 H3); discriminate. rewrite H; ring. Qed.
Theorem
Kmult_integral
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "is_zero_correct" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kmult_integral_contrapositive: forall x y, x <> 0 -> y <> 0 -> x * y <> 0.
Proof. intros x y H H1 H2. case (Kmult_integral H2); auto. Qed.
Theorem
Kmult_integral_contrapositive
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Kmult_integral" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kmult_eq_compat_l: forall x y z, y = z -> x * y = x * z.
intros x y z H; rewrite H; auto. Qed.
Theorem
Kmult_eq_compat_l
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Keq_opp_is_zero: forall x, x = - x -> x = 0.
Proof. intros x H. case (@Kmult_integral (1+1:K) x); simpl; auto. apply trans_equal with (x + x); simpl; try ring. pattern x at 1; rewrite H; ring. intros H1; case two_not_zero; auto. Qed.
Theorem
Keq_opp_is_zero
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Kmult_integral" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kdiv_inv_eq_0: forall x y, x/y = 0 -> y<>0 -> x = 0.
Proof. intros x y H1 H2. apply trans_equal with (y * (x/y)); try field; auto. rewrite H1; ring. Qed.
Theorem
Kdiv_inv_eq_0
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
is_zero_diff: forall x y, (x - y) ?0 = true -> x = y.
Proof. intros x y H. apply trans_equal with (y + (x - y)); try ring. case (Eth.(is_zero_correct) (x - y)); intros H1 H2; rewrite H1; auto; ring. Qed.
Theorem
is_zero_diff
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "is_zero_correct" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
is_zero_diff_inv: forall x y, x = y -> (x - y) ?0 = true.
Proof. intros x y H; rewrite H. case (Eth.(is_zero_correct) (y - y)); intros H1 H2; apply H2; ring. Qed.
Theorem
is_zero_diff_inv
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "is_zero_correct" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Ksqr_eq: forall x y, x^2 = y^2 -> x = y \/ x = - y.
Proof. intros x y H. case (@Kmult_integral (x - y) (x + y)); auto. ring [H]. intros H1; left; apply trans_equal with (y + (x - y)); try ring. rewrite H1; ring. intros H1; right; apply trans_equal with (-y + (x + y)); try ring. rewrite H1; ring. Qed.
Theorem
Ksqr_eq
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Kmult_integral" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
diff_rm_quo: forall x y, x/y <> 0 -> y<>0 -> x <> 0.
intros x y H H0 H1; case H; field [H1]; auto. Qed.
Theorem
diff_rm_quo
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
dtac H
:= match type of H with ?X <> 0 => field_simplify X in H end; [ match type of H with ?X/?Y <> 0 => cut (X <> 0); [clear H; intros H | apply diff_rm_quo with Y; auto] end | auto].
Ltac
dtac
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "diff_rm_quo" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
elt: Set
:= (* The infinity point *) inf_elt: elt (* A point of the curve *) | curve_elt: forall x y, y^2 = x^3 + A * x + B -> elt.
Inductive
elt
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "curve_elt", "inf_elt" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
Kdec : forall a b: K, {a = b} + {a <> b}.
intros a b; case_eq ((a - b) ?0); intros H. left; apply is_zero_diff; auto. right; intros H1. rewrite (is_zero_diff_inv H1) in H; discriminate. Defined.
Definition
Kdec
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "case_eq", "is_zero_diff", "is_zero_diff_inv" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
curve_elt_irr: forall x1 x2 y1 y2 H1 H2, x1 = x2 -> y1 = y2 -> @curve_elt x1 y1 H1 = @curve_elt x2 y2 H2.
Proof. intros x1 x2 y1 y2 H1 H2 H3 H4. subst. rewrite (fun H => eq_proofs_unicity H H1 H2); auto. intros x y; case (Kdec x y); auto. Qed.
Theorem
curve_elt_irr
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Kdec", "curve_elt" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
curve_elt_irr1: forall x1 x2 y1 y2 H1 H2, x1 = x2 -> (x1 = x2 -> y1 = y2) -> @curve_elt x1 y1 H1 = @curve_elt x2 y2 H2.
Proof. intros x1 x2 y1 y2 H1 H2 H3 H4. apply curve_elt_irr; auto. Qed.
Theorem
curve_elt_irr1
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "curve_elt", "curve_elt_irr" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
"x ?= y"
:= (Kdec x y) (at level 70).
Notation
x ?= y
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Kdec" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
ceqb: forall a b: elt, {a = b} + {a<>b}.
Proof. intros a b; case a; case b; auto; try (intros; right; intros; discriminate). intros x1 y1 H1 x2 y2 H2; case (Kdec x1 x2); intros H3. case (Kdec y1 y2); intros H4. left; apply curve_elt_irr1; auto. right; intros H; injection H; intros H5 H6; case H4; auto. right; intros H; injection H; intros H4 H5; cas...
Definition
ceqb
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Kdec", "curve_elt_irr1", "elt" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
is_zero_true: forall e, is_zero e = true -> e = 0.
intro e; generalize (Eth.(is_zero_correct) e); case is_zero; auto; intros (H,_); auto. Qed.
Theorem
is_zero_true
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "is_zero_correct" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
is_zero_false: forall e, is_zero e = false -> e <> 0.
intro e; generalize (Eth.(is_zero_correct) e); case is_zero; auto; intros (_,H); auto. intros; discriminate. intros _ H1; generalize (H H1); discriminate. Qed.
Theorem
is_zero_false
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "is_zero_correct" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
opp_lem: forall x y, y ^ 2 = x ^ 3 + A * x + B -> (- y) ^ 2 = x ^ 3 + A * x + B.
Proof. intros x y H. Time field [H]. Qed.
Lemma
opp_lem
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
opp: elt -> elt.
refine (fun p => match p with inf_elt => inf_elt | @curve_elt x y H => @curve_elt x (-y) _ end). apply opp_lem; auto. Defined.
Definition
opp
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "curve_elt", "elt", "inf_elt", "opp_lem" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
opp_opp: forall p, opp (opp p) = p.
Proof. intros p; case p; simpl; auto; intros; apply curve_elt_irr; ring. Qed.
Theorem
opp_opp
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "curve_elt_irr", "opp" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
curve_elt_opp: forall x1 x2 y1 y2 H1 H2, x1 = x2 -> @curve_elt x1 y1 H1 = @curve_elt x2 y2 H2 \/ @curve_elt x1 y1 H1 = opp (@curve_elt x2 y2 H2).
intros x1 x2 y1 y2 H1 H2 H3. case (@Kmult_integral (y1 - y2) (y1 + y2)); try intros H4. ring_simplify. ring [H1 H2 H3]. left; apply curve_elt_irr; auto. apply Keq_minus_eq; auto. right; unfold opp; apply curve_elt_irr; auto. apply Keq_minus_eq; rewrite <- H4; ring. Qed.
Theorem
curve_elt_opp
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Keq_minus_eq", "Kmult_integral", "curve_elt", "curve_elt_irr", "opp" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add_lem1: forall x1 y1, y1 <> 0 -> y1 ^ 2 = x1 ^ 3 + A * x1 + B -> let l := (3 * x1 * x1 + A) / (2 * y1) in let x3 := l ^ 2 - 2 * x1 in (- y1 - l * (x3 - x1)) ^ 2 = x3 ^ 3 + A * x3 + B.
Proof. intros x1 y1 H H1 l x3; unfold x3, l. Time field [H1]. split; auto. Qed.
Lemma
add_lem1
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "split" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add_lem2: forall x1 y1 x2 y2, x1 <> x2 -> y1 ^ 2 = x1 ^ 3 + A * x1 + B -> y2 ^ 2 = x2 ^ 3 + A * x2 + B -> let l := (y2 - y1) / (x2 - x1) in let x3 := l ^ 2 - x1 - x2 in (- y1 - l * (x3 - x1)) ^ 2 = x3 ^ 3 + A * x3 + B.
Proof. intros x1 y1 x2 y2 H H1 H2 l x3; unfold x3, l. Time field [H1 H2]; auto. Qed.
Lemma
add_lem2
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add_zero: forall x1 x2 y1 y2, x1 = x2 -> y1 ^ 2 = x1 ^ 3 + A * x1 + B -> y2 ^ 2 = x2 ^ 3 + A * x2 + B -> y1 <> -y2 -> y1 = y2.
Proof. intros x1 x2 y1 y2 H H1 H2 H3; subst x2. case (@Kmult_integral (y1 - y2) (y1 + y2)); try (intros H4; apply Keq_minus_eq; auto). ring [H1 H2]. case H3; apply Keq_minus_eq; rewrite <- H4; ring. Qed.
Lemma
add_zero
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Keq_minus_eq", "Kmult_integral" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add_zero_diff: forall x1 x2 y1 y2, x1 = x2 -> y1 ^ 2 = x1 ^ 3 + A * x1 + B -> y2 ^ 2 = x2 ^ 3 + A * x2 + B -> y1 <> -y2 -> y1 <>0.
Proof. intros x1 x2 y1 y2 H H1 H2 H3 H4. assert (H5:= add_zero H H1 H2 H3). case H3; rewrite <- H5; ring [H4]. Qed.
Lemma
add_zero_diff
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "add_zero" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add: elt -> elt -> elt.
refine (fun p1 p2 => match p1 with inf_elt => p2 | @curve_elt x1 y1 H1 => match p2 with inf_elt => p1 | @curve_elt x2 y2 H2 => if x1 ?= x2 then (* we have p1 = p2 or p1 = - p2 *) ...
Definition
add
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "add_lem1", "add_lem2", "add_zero_diff", "curve_elt", "elt", "inf_elt", "p1" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
kauto
:= auto; match goal with H: ~ ?A, H1: ?A |- _ => case H; auto end.
Ltac
kauto
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
ksplit
:= let h := fresh "KD" in case Kdec; intros h; try (case h; kauto; fail).
Ltac
ksplit
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Kdec", "kauto" ]
A little tactic to split kdec
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add_case: forall P, (forall p, P inf_elt p p) -> (forall p, P p inf_elt p) -> (forall p, P p (opp p) inf_elt) -> (forall p1 x1 y1 H1 p2 x2 y2 H2 l, p1 = (@curve_elt x1 y1 H1) -> p2 = (@curve_elt x2 y2 H2) -> p2 = add p1 p1 -> y1<>0 -> l = (3 * x1 * x1 + A) / (2 * y1) -> x2 = l ^ 2 - 2 * ...
Proof. intros P H1 H2 H3 H4 H5 p q; case p; case q; auto. intros x2 y2 e2 x1 y1 e1; unfold add. repeat ksplit. replace (@curve_elt x2 y2 e2) with (opp (@curve_elt x1 y1 e1)); auto; simpl. apply curve_elt_irr; auto; ring [KD0]. assert (HH: y1 <> 0). apply (@add_zero_diff x1 x2 y1 y2); auto. replace (@cur...
Theorem
add_case
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Keq_minus_eq", "Keq_opp_is_zero", "Kmult_integral", "add", "add_zero_diff", "curve_elt", "curve_elt_irr", "inf_elt", "ksplit", "opp", "p1" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
add_casew: forall P, (forall p, P inf_elt p p) -> (forall p, P p inf_elt p) -> (forall p, P p (opp p) inf_elt) -> (forall p1 x1 y1 H1 p2 x2 y2 H2 p3 x3 y3 H3 l, p1 = (@curve_elt x1 y1 H1) -> p2 = (@curve_elt x2 y2 H2) -> p3 = (@curve_elt x3 y3 H3) -> p3 = add p1 p2 -> p1 <> opp p2 -> ((x1 = x2 ...
intros; apply add_case; auto. intros; eapply X2; eauto. rewrite H; simpl; intros tmp; case H4; injection tmp; apply Keq_opp_is_zero. ring [H6]. intros; eapply X2; eauto. rewrite H; rewrite H0; simpl; intros tmp; case H6; injection tmp; auto. Qed.
Theorem
add_casew
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "Keq_opp_is_zero", "add", "add_case", "curve_elt", "inf_elt", "opp", "p1" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
is_tangent p1 p2
:= p1 <> inf_elt /\ p1 = p2 /\ p1 <> opp p2.
Definition
is_tangent
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "inf_elt", "opp", "p1" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
is_generic p1 p2
:= p1 <> inf_elt /\ p2 <> inf_elt /\ p1 <> p2 /\ p1 <> opp p2.
Definition
is_generic
Coqprime.elliptic
src/Coqprime/elliptic/SMain.v
[ "Coq", "Arith_base", "Field_tac", "Ring", "Eqdep_dec", "Coqprime", "FGroup", "List", "UList", "ZArith" ]
[ "inf_elt", "opp", "p1" ]
https://github.com/thery/coqprime
3371791217c6f8dff53972a53f0c3e860d4b54dc
End of preview. Expand in Data Studio

Coq-Prime

Structured dataset from CoqPrime — Primality certificates and number theory.

Source

Schema

Column Type Description
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 11,669
  • With proof: 11,596 (99.4%)
  • With docstring: 147 (1.3%)
  • Libraries: 21

By type

Type Count
Lemma 10,270
Definition 620
Theorem 420
Let 109
Fixpoint 75
Hypothesis 67
Notation 50
Ltac 33
Inductive 10
Record 7
Coercion 3
Parameter 3
Structure 1
Hypotheses 1

Example

Zeq_iok: forall x y, x = y -> Zeq_bool x y = true.
intros x y H; subst. apply Zeq_is_eq_bool, eq_refl.
Qed.
  • type: Theorem | symbolic_name: Zeq_iok | src/Coqprime/elliptic/GZnZ.v

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{coq_prime_dataset,
  title  = {Coq-Prime},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/thery/coqprime, commit 3371791217c6},
  url    = {https://huggingface.co/datasets/phanerozoic/Coq-Prime}
}
Downloads last month
70

Collection including phanerozoic/Coq-Prime