statement stringlengths 1 4.33k | proof stringlengths 0 37.9k | type stringclasses 25
values | symbolic_name stringlengths 1 67 | library stringclasses 10
values | filename stringclasses 112
values | imports listlengths 2 138 | deps listlengths 0 64 | docstring stringclasses 798
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
elogn2 e q r {struct q} | :=
match q, r with
| 0, _ | _, 0 => (e, q)
| q'.+1, 1 => elogn2 e.+1 q' q'
| q'.+1, r'.+2 => elogn2 e q' r'
end. | Fixpoint | elogn2 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
elogn2_spec n : nat * nat -> Type | :=
Elogn2Spec e m of n = 2 ^ e * m.*2.+1 : elogn2_spec n (e, m). | Variant | elogn2_spec | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"nat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
elogn2P n : elogn2_spec n.+1 (elogn2 0 n n). | Proof.
rewrite -[n.+1]mul1n -[1]/(2 ^ 0) -[n in _ * n.+1](addKn n n) addnn.
elim: n {1 4 6}n {2 3}0 (leqnn n) => [|q IHq] [|[|r]] e //=; last first.
by move/ltnW; apply: IHq.
rewrite subn1 prednK // -mul2n mulnA -expnSr.
by rewrite -[q in _ * q.+1](addKn q q) addnn => _; apply: IHq.
Qed. | Lemma | elogn2P | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"addKn",
"addnn",
"apply",
"elogn2",
"elogn2_spec",
"expnSr",
"last",
"leqnn",
"ltnW",
"mul1n",
"mul2n",
"mulnA",
"prednK",
"subn1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ifnz T n (x y : T) | := if n is 0 then y else x. | Definition | ifnz | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ifnz_spec T n (x y : T) : T -> Type | :=
| IfnzPos of n > 0 : ifnz_spec n x y x
| IfnzZero of n = 0 : ifnz_spec n x y y. | Variant | ifnz_spec | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ifnzP T n (x y : T) : ifnz_spec n x y (ifnz n x y). | Proof. by case: n => [|n]; [right | left]. Qed. | Lemma | ifnzP | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"ifnz",
"ifnz_spec"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
add_divisors f divs | :=
let: (p, e) := f in
let add1 divs' := merge leq (map (NatTrec.mul p) divs') divs in
iter e add1 divs. | Definition | add_divisors | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"iter",
"leq",
"map",
"merge",
"mul"
] | the decomposition, using a merge_sort variant sort of the divisor list. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
add_totient_factor f m | := let: (p, e) := f in p.-1 * p ^ e.-1 * m. | Definition | add_totient_factor | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
cons_pfactor (p e : nat) pd | := ifnz e ((p, e) :: pd) pd. | Definition | cons_pfactor | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"ifnz",
"nat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
"p ^? e :: pd" | := (cons_pfactor p e pd)
(at level 30, e at level 30, pd at level 60) : nat_scope. | Notation | p ^? e :: pd | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"cons_pfactor"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
NumFactor (f : nat * nat) | := ([Num of f.1], f.2). | Definition | NumFactor | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"nat"
] | For pretty-printing. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
pfactor p e | := p ^ e. | Definition | pfactor | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_decomp_rec m k a b c e | :=
let p := k.*2.+1 in
if a is a'.+1 then
if b - (ifnz e 1 k - c) is b'.+1 then
[rec m, k, a', b', ifnz c c.-1 (ifnz e p.-2 1), e] else
if (b == 0) && (c == 0) then
let b' := k + a' in [rec b'.*2.+3, k, a', b', k.-1, e.+1] else
let bc' := ifnz e (ifnz b (k, 0) (edivn2 0 c)) (b, c) in
p ^... | Fixpoint | prime_decomp_rec | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"edivn2",
"ifnz"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_decomp n | :=
let: (e2, m2) := elogn2 0 n.-1 n.-1 in
if m2 < 2 then 2 ^? e2 :: 3 ^? m2 :: [::] else
let: (a, bc) := edivn m2.-2 3 in
let: (b, c) := edivn (2 - bc) 2 in
2 ^? e2 :: [rec m2.*2.+1, 1, a, b, c, 0]. | Definition | prime_decomp | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"edivn",
"elogn2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primes n | := unzip1 (prime_decomp n). | Definition | primes | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"prime_decomp",
"unzip1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime p | := if prime_decomp p is [:: (_ , 1)] then true else false. | Definition | prime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"prime_decomp"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nat_pred | := simpl_pred nat. | Definition | nat_pred | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"nat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pi_arg | := nat. | Definition | pi_arg | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"nat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pi_arg_of_nat (n : nat) : pi_arg | := n. | Coercion | pi_arg_of_nat | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"nat",
"pi_arg"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pi_arg_of_fin_pred T pT (A : @fin_pred_sort T pT) : pi_arg | := #|A|. | Coercion | pi_arg_of_fin_pred | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"fin_pred_sort",
"pi_arg"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pi_of (n : pi_arg) : nat_pred | := [pred p in primes n]. | Definition | pi_of | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"nat_pred",
"pi_arg",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
"\pi ( n )" | := (pi_of n) (format "\pi ( n )") : nat_scope. | Notation | \pi ( n ) | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"pi_of"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
"\p 'i' ( A )" | := \pi(#|A|) (format "\p 'i' ( A )") : nat_scope. | Notation | \p 'i' ( A ) | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"pi"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdiv n | := head 1 (primes n). | Definition | pdiv | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"head",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
max_pdiv n | := last 1 (primes n). | Definition | max_pdiv | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"last",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
divisors n | := foldr add_divisors [:: 1] (prime_decomp n). | Definition | divisors | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"add_divisors",
"foldr",
"prime_decomp"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
totient n | := foldr add_totient_factor (n > 0) (prime_decomp n). | Definition | totient | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"add_totient_factor",
"foldr",
"prime_decomp"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_decomp_correct :
let pd_val pd := \prod_(f <- pd) pfactor f.1 f.2 in
let lb_dvd q m := ~~ has [pred d | d %| m] (index_iota 2 q) in
let pf_ok f := lb_dvd f.1 f.1 && (0 < f.2) in
let pd_ord q pd := path ltn q (unzip1 pd) in
let pd_ok q n pd := [/\ n = pd_val pd, all pf_ok pd & pd_ord q pd] in
forall n,... | Proof.
rewrite unlock => pd_val lb_dvd pf_ok pd_ord pd_ok.
have leq_pd_ok m p q pd: q <= p -> pd_ok p m pd -> pd_ok q m pd.
rewrite /pd_ok /pd_ord; case: pd => [|[r _] pd] //= leqp [<- ->].
by case/andP=> /(leq_trans _)->.
have apd_ok m e q p pd: lb_dvd p p || (e == 0) -> q < p ->
pd_ok p m pd -> pd_ok q (p ^ ... | Lemma | prime_decomp_correct | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"add2n",
"addIn",
"addKn",
"addSn",
"addSnnS",
"addn0",
"addn1",
"addn2",
"addnA",
"addnACA",
"addnC",
"addnCA",
"addnS",
"addn_eq0",
"addnn",
"all",
"apply",
"coprime",
"def_q",
"def_r",
"doubleB",
"doubleD",
"doubleS",
"double_gt0",
"dvdn",
"dvdn2",
"dvdnP",
"... | Correctness of the decomposition algorithm. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
primePn n :
reflect (n < 2 \/ exists2 d, 1 < d < n & d %| n) (~~ prime n). | Proof.
rewrite /prime; case: n => [|[|p2]]; try by do 2!left.
case: (@prime_decomp_correct p2.+2) => //; rewrite unlock.
case: prime_decomp => [|[q [|[|e]]] pd] //=; last first; last by rewrite andbF.
rewrite {1}/pfactor 2!expnS -!mulnA /=.
case: (_ ^ _ * _) => [|u -> _ /andP[lt1q _]]; first by rewrite !muln0.
le... | Lemma | primePn | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"def_q",
"dvdn_mulr",
"expn1",
"expnS",
"hasP",
"last",
"leq_mul",
"ltnLHS",
"ltnW",
"ltn_mul",
"ltn_pmul2l",
"mem_index_iota",
"mul1n",
"muln0",
"muln1",
"mulnA",
"pfactor",
"prime",
"prime_decomp",
"prime_decomp_correct"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primeNsig n : ~~ prime n -> 2 <= n -> { d : nat | 1 < d < n & d %| n }. | Proof.
by move=> /primePn; case: ltnP => // lt1n nP _; apply/sig2W; case: nP.
Qed. | Lemma | primeNsig | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"ltnP",
"nat",
"prime",
"primePn",
"sig2W"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primeP p :
reflect (p > 1 /\ forall d, d %| p -> xpred2 1 p d) (prime p). | Proof.
rewrite -[prime p]negbK; have [npr_p | pr_p] := primePn p.
right=> [[lt1p pr_p]]; case: npr_p => [|[d n1pd]].
by rewrite ltnNge lt1p.
by move/pr_p=> /orP[] /eqP def_d; rewrite def_d ltnn ?andbF in n1pd.
have [lep1 | lt1p] := leqP; first by case: pr_p; left.
left; split=> // d dv_d_p; apply/norP=> [[nd1 n... | Lemma | primeP | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"dvdn_gt0",
"dvdn_leq",
"eq_sym",
"leqP",
"ltnNge",
"ltnW",
"ltn_neqAle",
"ltnn",
"pr_p",
"prime",
"primePn",
"split",
"xpred2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_nt_dvdP d p : prime p -> d != 1 -> reflect (d = p) (d %| p). | Proof.
case/primeP=> _ min_p d_neq1; apply: (iffP idP) => [/min_p|-> //].
by rewrite (negPf d_neq1) /= => /eqP.
Qed. | Lemma | prime_nt_dvdP | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"prime",
"primeP"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_gt1 p : prime p -> 1 < p. | Proof. by case/primeP. Qed. | Lemma | prime_gt1 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"prime",
"primeP"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_gt0 p : prime p -> 0 < p. | Proof. by move/prime_gt1; apply: ltnW. Qed. | Lemma | prime_gt0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"ltnW",
"prime",
"prime_gt1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prod_prime_decomp n :
n > 0 -> n = \prod_(f <- prime_decomp n) f.1 ^ f.2. | Proof. by case/prime_decomp_correct. Qed. | Lemma | prod_prime_decomp | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"prime_decomp",
"prime_decomp_correct"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
even_prime p : prime p -> p = 2 \/ odd p. | Proof.
move=> pr_p; case odd_p: (odd p); [by right | left].
have: 2 %| p by rewrite dvdn2 odd_p.
by case/primeP: pr_p => _ dv_p /dv_p/(2 =P p).
Qed. | Lemma | even_prime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"dvdn2",
"odd",
"pr_p",
"prime",
"primeP"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_oddPn p : prime p -> reflect (p = 2) (~~ odd p). | Proof.
by move=> p_pr; apply: (iffP idP) => [|-> //]; case/even_prime: p_pr => ->.
Qed. | Lemma | prime_oddPn | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"even_prime",
"odd",
"p_pr",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
odd_prime_gt2 p : odd p -> prime p -> p > 2. | Proof. by move=> odd_p /prime_gt1; apply: odd_gt2. Qed. | Lemma | odd_prime_gt2 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"odd",
"odd_gt2",
"prime",
"prime_gt1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mem_prime_decomp n p e :
(p, e) \in prime_decomp n -> [/\ prime p, e > 0 & p ^ e %| n]. | Proof.
case: (posnP n) => [-> //| /prime_decomp_correct[def_n mem_pd ord_pd pd_pe]].
have /andP[pr_p ->] := allP mem_pd _ pd_pe; split=> //; last first.
case/splitPr: pd_pe def_n => pd1 pd2 ->.
by rewrite big_cat big_cons /= mulnCA dvdn_mulr.
have lt1p: 1 < p.
apply: (allP (order_path_min ltn_trans ord_pd)).
by... | Lemma | mem_prime_decomp | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"allP",
"apply",
"big_cat",
"big_cons",
"def_n",
"dvdn_gt0",
"dvdn_leq",
"dvdn_mulr",
"eq_sym",
"hasP",
"last",
"ltnW",
"ltn_neqAle",
"ltn_trans",
"mapP",
"mem_index_iota",
"mulnCA",
"order_path_min",
"posnP",
"pr_p",
"prime",
"primeP",
"prime_decomp",
"prime_decomp_cor... | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_coprime p m : prime p -> coprime p m = ~~ (p %| m). | Proof.
case/primeP=> p_gt1 p_pr; apply/eqP/negP=> [d1 | ndv_pm].
case/dvdnP=> k def_m; rewrite -(addn0 m) def_m gcdnMDl gcdn0 in d1.
by rewrite d1 in p_gt1.
by apply: gcdn_def => // d /p_pr /orP[] /eqP->.
Qed. | Lemma | prime_coprime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"addn0",
"apply",
"coprime",
"dvdnP",
"gcdn0",
"gcdnMDl",
"gcdn_def",
"p_gt1",
"p_pr",
"prime",
"primeP"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
dvdn_prime2 p q : prime p -> prime q -> (p %| q) = (p == q). | Proof.
move=> pr_p pr_q; apply: negb_inj.
by rewrite eqn_dvd negb_and -!prime_coprime // coprime_sym orbb.
Qed. | Lemma | dvdn_prime2 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"coprime_sym",
"eqn_dvd",
"pr_p",
"prime",
"prime_coprime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
Euclid_dvd1 p : prime p -> (p %| 1) = false. | Proof. by rewrite dvdn1; case: eqP => // ->. Qed. | Lemma | Euclid_dvd1 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"dvdn1",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
Euclid_dvdM m n p : prime p -> (p %| m * n) = (p %| m) || (p %| n). | Proof.
move=> pr_p; case dv_pm: (p %| m); first exact: dvdn_mulr.
by rewrite Gauss_dvdr // prime_coprime // dv_pm.
Qed. | Lemma | Euclid_dvdM | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"Gauss_dvdr",
"dvdn_mulr",
"pr_p",
"prime",
"prime_coprime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
Euclid_dvd_prod (I : Type) (r : seq I) (P : pred I) (f : I -> nat) p :
prime p ->
(p %| \prod_(i <- r | P i) f i) = \big[orb/false]_(i <- r | P i) (p %| f i). | Proof.
move=> pP; apply: big_morph=> [x y|]; [exact: Euclid_dvdM | exact: Euclid_dvd1].
Qed. | Lemma | Euclid_dvd_prod | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"Euclid_dvd1",
"Euclid_dvdM",
"apply",
"big_morph",
"nat",
"pP",
"prime",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
Euclid_dvdX m n p : prime p -> (p %| m ^ n) = (p %| m) && (n > 0). | Proof.
case: n => [|n] pr_p; first by rewrite andbF Euclid_dvd1.
by apply: (inv_inj negbK); rewrite !andbT -!prime_coprime // coprime_pexpr.
Qed. | Lemma | Euclid_dvdX | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"Euclid_dvd1",
"apply",
"coprime_pexpr",
"pr_p",
"prime",
"prime_coprime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mem_primes p n : (p \in primes n) = [&& prime p, n > 0 & p %| n]. | Proof.
rewrite andbCA; have [-> // | /= n_gt0] := posnP.
apply/mapP/andP=> [[[q e]]|[pr_p]] /=.
case/mem_prime_decomp=> pr_q e_gt0 /dvdnP [u ->] -> {p}.
by rewrite -(prednK e_gt0) expnS mulnCA dvdn_mulr.
rewrite [n in _ %| n]prod_prime_decomp // big_seq.
apply big_ind => [| u v IHu IHv | [q e] /= mem_qe dv_p_qe].
-... | Lemma | mem_primes | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"Euclid_dvd1",
"Euclid_dvdM",
"Euclid_dvdX",
"apply",
"big_ind",
"big_seq",
"dvdnP",
"dvdn_mulr",
"dvdn_prime2",
"expnS",
"mapP",
"mem_prime_decomp",
"mulnCA",
"n_gt0",
"posnP",
"pr_p",
"prednK",
"prime",
"primes",
"prod_prime_decomp"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sorted_primes n : sorted ltn (primes n). | Proof.
by case: (posnP n) => [-> // | /prime_decomp_correct[_ _]]; apply: path_sorted.
Qed. | Lemma | sorted_primes | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"ltn",
"path_sorted",
"posnP",
"prime_decomp_correct",
"primes",
"sorted"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
all_prime_primes n : all prime (primes n). | Proof. by apply/allP => p; rewrite mem_primes => /and3P[]. Qed. | Lemma | all_prime_primes | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"all",
"allP",
"apply",
"mem_primes",
"prime",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
eq_primes m n : (primes m =i primes n) <-> (primes m = primes n). | Proof.
split=> [eqpr| -> //].
by apply: (irr_sorted_eq ltn_trans ltnn); rewrite ?sorted_primes.
Qed. | Lemma | eq_primes | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"irr_sorted_eq",
"ltn_trans",
"ltnn",
"primes",
"sorted_primes",
"split"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primes_uniq n : uniq (primes n). | Proof. exact: (sorted_uniq ltn_trans ltnn (sorted_primes n)). Qed. | Lemma | primes_uniq | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"ltn_trans",
"ltnn",
"primes",
"sorted_primes",
"sorted_uniq",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pi_pdiv n : (pdiv n \in \pi(n)) = (n > 1). | Proof.
case: n => [|[|n]] //; rewrite /pdiv !inE /primes.
have:= prod_prime_decomp (ltn0Sn n.+1); rewrite unlock.
by case: prime_decomp => //= pf pd _; rewrite mem_head.
Qed. | Lemma | pi_pdiv | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"inE",
"ltn0Sn",
"mem_head",
"pdiv",
"pi",
"prime_decomp",
"primes",
"prod_prime_decomp"
] | The smallest prime divisor | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
pdiv_prime n : 1 < n -> prime (pdiv n). | Proof. by rewrite -pi_pdiv mem_primes; case/and3P. Qed. | Lemma | pdiv_prime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"mem_primes",
"pdiv",
"pi_pdiv",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdiv_dvd n : pdiv n %| n. | Proof. by case: n (pi_pdiv n) => [|[|n]] //; rewrite mem_primes=> /and3P[]. Qed. | Lemma | pdiv_dvd | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"mem_primes",
"pdiv",
"pi_pdiv"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pi_max_pdiv n : (max_pdiv n \in \pi(n)) = (n > 1). | Proof.
rewrite !inE -pi_pdiv /max_pdiv /pdiv !inE.
by case: (primes n) => //= p ps; rewrite mem_head mem_last.
Qed. | Lemma | pi_max_pdiv | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"inE",
"max_pdiv",
"mem_head",
"mem_last",
"pdiv",
"pi",
"pi_pdiv",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
max_pdiv_prime n : n > 1 -> prime (max_pdiv n). | Proof. by rewrite -pi_max_pdiv mem_primes => /andP[]. Qed. | Lemma | max_pdiv_prime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"max_pdiv",
"mem_primes",
"pi_max_pdiv",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
max_pdiv_dvd n : max_pdiv n %| n. | Proof.
by case: n (pi_max_pdiv n) => [|[|n]] //; rewrite mem_primes => /andP[].
Qed. | Lemma | max_pdiv_dvd | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"max_pdiv",
"mem_primes",
"pi_max_pdiv"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdiv_leq n : 0 < n -> pdiv n <= n. | Proof. by move=> n_gt0; rewrite dvdn_leq // pdiv_dvd. Qed. | Lemma | pdiv_leq | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"dvdn_leq",
"n_gt0",
"pdiv",
"pdiv_dvd"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
max_pdiv_leq n : 0 < n -> max_pdiv n <= n. | Proof. by move=> n_gt0; rewrite dvdn_leq // max_pdiv_dvd. Qed. | Lemma | max_pdiv_leq | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"dvdn_leq",
"max_pdiv",
"max_pdiv_dvd",
"n_gt0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdiv_gt0 n : 0 < pdiv n. | Proof. by case: n => [|[|n]] //; rewrite prime_gt0 ?pdiv_prime. Qed. | Lemma | pdiv_gt0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"pdiv",
"pdiv_prime",
"prime_gt0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
max_pdiv_gt0 n : 0 < max_pdiv n. | Proof. by case: n => [|[|n]] //; rewrite prime_gt0 ?max_pdiv_prime. Qed. | Lemma | max_pdiv_gt0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"max_pdiv",
"max_pdiv_prime",
"prime_gt0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdiv_min_dvd m d : 1 < d -> d %| m -> pdiv m <= d. | Proof.
case: (posnP m) => [->|mpos] lt1d dv_d_m; first exact: ltnW.
rewrite /pdiv; apply: leq_trans (pdiv_leq (ltnW lt1d)).
have: pdiv d \in primes m.
by rewrite mem_primes mpos pdiv_prime // (dvdn_trans (pdiv_dvd d)).
case: (primes m) (sorted_primes m) => //= p pm ord_pm; rewrite inE.
by case/predU1P => [-> | /(allP... | Lemma | pdiv_min_dvd | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"allP",
"apply",
"dvdn_trans",
"inE",
"leq_trans",
"ltnW",
"ltn_trans",
"mem_primes",
"order_path_min",
"pdiv",
"pdiv_dvd",
"pdiv_leq",
"pdiv_prime",
"posnP",
"predU1P",
"primes",
"sorted_primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
max_pdiv_max n p : p \in \pi(n) -> p <= max_pdiv n. | Proof.
rewrite /max_pdiv !inE => n_p.
case/splitPr: n_p (sorted_primes n) => p1 p2; rewrite last_cat -cat_rcons /=.
rewrite headI /= cat_path -(last_cons 0) -headI last_rcons; case/andP=> _.
move/(order_path_min ltn_trans); case/lastP: p2 => //= p2 q.
by rewrite all_rcons last_rcons ltn_neqAle -andbA => /and3P[].
Qed. | Lemma | max_pdiv_max | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"all_rcons",
"cat_path",
"cat_rcons",
"headI",
"inE",
"lastP",
"last_cat",
"last_cons",
"last_rcons",
"ltn_neqAle",
"ltn_trans",
"max_pdiv",
"order_path_min",
"pi",
"sorted_primes",
"splitPr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ltn_pdiv2_prime n : 0 < n -> n < pdiv n ^ 2 -> prime n. | Proof.
case def_n: n => [|[|n']] // _; rewrite -def_n => lt_n_p2.
suffices ->: n = pdiv n by rewrite pdiv_prime ?def_n.
apply/eqP; rewrite eqn_leq leqNgt andbC pdiv_leq; first by rewrite def_n.
apply/contraL: lt_n_p2 => lt_pm_m; case/dvdnP: (pdiv_dvd n) => q def_q.
rewrite -leqNgt [leqRHS]def_q leq_pmul2r // pdiv_min_d... | Lemma | ltn_pdiv2_prime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"def_n",
"def_q",
"dvdnP",
"dvdn_mulr",
"eqn_leq",
"leqNgt",
"leqRHS",
"leq_pmul2r",
"ltnRHS",
"ltn_pmul2r",
"mul1n",
"n'",
"pdiv",
"pdiv_dvd",
"pdiv_leq",
"pdiv_min_dvd",
"pdiv_prime",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primePns n :
reflect (n < 2 \/ exists p, [/\ prime p, p ^ 2 <= n & p %| n]) (~~ prime n). | Proof.
apply: (iffP idP) => [npr_p|]; last first.
case=> [|[p [pr_p le_p2_n dv_p_n]]]; first by case: n => [|[]].
apply/negP=> pr_n; move: dv_p_n le_p2_n; rewrite dvdn_prime2 //; move/eqP->.
by rewrite leqNgt -[ltnLHS]muln1 ltn_pmul2l ?prime_gt1 ?prime_gt0.
have [lt1p|] := leqP; [right | by left].
exists (pdiv n)... | Lemma | primePns | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"dvdn_prime2",
"last",
"leqNgt",
"leqP",
"ltnLHS",
"ltnW",
"ltn_pdiv2_prime",
"ltn_pmul2l",
"muln1",
"pdiv",
"pdiv_dvd",
"pdiv_prime",
"pr_p",
"prime",
"prime_gt0",
"prime_gt1",
"split"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdivP n : n > 1 -> {p | prime p & p %| n}. | Proof. by move=> lt1n; exists (pdiv n); rewrite ?pdiv_dvd ?pdiv_prime. Qed. | Lemma | pdivP | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"pdiv",
"pdiv_dvd",
"pdiv_prime",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primes_eq0 n : (primes n == [::]) = (n < 2). | Proof.
case: n => [|[|n']]//=; have [//|p pp pn] := @pdivP (n'.+2).
suff: p \in primes n'.+2 by case: primes.
by rewrite mem_primes pp pn.
Qed. | Lemma | primes_eq0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"mem_primes",
"n'",
"pdivP",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primesM m n p : m > 0 -> n > 0 ->
(p \in primes (m * n)) = (p \in primes m) || (p \in primes n). | Proof.
move=> m_gt0 n_gt0; rewrite !mem_primes muln_gt0 m_gt0 n_gt0.
by case pr_p: (prime p); rewrite // Euclid_dvdM.
Qed. | Lemma | primesM | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"Euclid_dvdM",
"mem_primes",
"muln_gt0",
"n_gt0",
"pr_p",
"prime",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primesX m n : n > 0 -> primes (m ^ n) = primes m. | Proof.
case: n => // n _; rewrite expnS; have [-> // | m_gt0] := posnP m.
apply/eq_primes => /= p; elim: n => [|n IHn]; first by rewrite muln1.
by rewrite primesM ?(expn_gt0, expnS, IHn, orbb, m_gt0).
Qed. | Lemma | primesX | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"eq_primes",
"expnS",
"expn_gt0",
"muln1",
"posnP",
"primes",
"primesM"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
primes_prime p : prime p -> primes p = [:: p]. | Proof.
move=> pr_p; apply: (irr_sorted_eq ltn_trans ltnn) => // [|q].
exact: sorted_primes.
rewrite mem_seq1 mem_primes prime_gt0 //=.
by apply/andP/idP=> [[pr_q q_p] | /eqP-> //]; rewrite -dvdn_prime2.
Qed. | Lemma | primes_prime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"dvdn_prime2",
"irr_sorted_eq",
"ltn_trans",
"ltnn",
"mem_primes",
"mem_seq1",
"pr_p",
"prime",
"prime_gt0",
"primes",
"sorted_primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
coprime_has_primes m n :
0 < m -> 0 < n -> coprime m n = ~~ has [in primes m] (primes n). | Proof.
move=> m_gt0 n_gt0; apply/eqP/hasPn=> [mn1 p | no_p_mn].
rewrite /= !mem_primes m_gt0 n_gt0 /= => /andP[pr_p p_n].
have:= prime_gt1 pr_p; rewrite pr_p ltnNge -mn1 /=; apply: contra => p_m.
by rewrite dvdn_leq ?gcdn_gt0 ?m_gt0 // dvdn_gcd ?p_m.
apply/eqP; rewrite eqn_leq gcdn_gt0 m_gt0 andbT leqNgt; apply/n... | Lemma | coprime_has_primes | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"coprime",
"dvdn_gcd",
"dvdn_gcdl",
"dvdn_gcdr",
"dvdn_leq",
"dvdn_trans",
"eqn_leq",
"gcdn_gt0",
"has",
"hasPn",
"leqNgt",
"ltnNge",
"mem_primes",
"n_gt0",
"pdiv",
"pdiv_dvd",
"pdiv_prime",
"pr_p",
"prime_gt1",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdiv_id p : prime p -> pdiv p = p. | Proof. by move=> p_pr; rewrite /pdiv primes_prime. Qed. | Lemma | pdiv_id | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"p_pr",
"pdiv",
"prime",
"primes_prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pdiv_pfactor p k : prime p -> pdiv (p ^ k.+1) = p. | Proof. by move=> p_pr; rewrite /pdiv primesX ?primes_prime. Qed. | Lemma | pdiv_pfactor | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"p_pr",
"pdiv",
"prime",
"primesX",
"primes_prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_above m : {p | m < p & prime p}. | Proof.
have /pdivP[p pr_p p_dv_m1]: 1 < m`! + 1 by rewrite addn1 ltnS fact_gt0.
exists p => //; rewrite ltnNge; apply: contraL p_dv_m1 => p_le_m.
by rewrite dvdn_addr ?dvdn_fact ?prime_gt0 // gtnNdvd ?prime_gt1.
Qed. | Lemma | prime_above | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"addn1",
"apply",
"dvdn_addr",
"dvdn_fact",
"fact_gt0",
"gtnNdvd",
"ltnNge",
"ltnS",
"pdivP",
"pr_p",
"prime",
"prime_gt0",
"prime_gt1"
] | Primes are unbounded. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
logn_rec d m r | :=
match r, edivn m d with
| r'.+1, (_.+1 as m', 0) => (logn_rec d m' r').+1
| _, _ => 0
end. | Fixpoint | logn_rec | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"edivn"
] | "prime" logarithms and p-parts. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
logn p m | := if prime p then logn_rec p m m else 0. | Definition | logn | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"logn_rec",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
lognE p m :
logn p m = if [&& prime p, 0 < m & p %| m] then (logn p (m %/ p)).+1 else 0. | Proof.
rewrite /logn /dvdn; case p_pr: (prime p) => //.
case def_m: m => // [m']; rewrite !andTb [LHS]/= -def_m /divn modn_def.
case: edivnP def_m => [[|q] [|r] -> _] // def_m; congr _.+1; rewrite [_.1]/=.
have{m def_m}: q < m'.
by rewrite -ltnS -def_m addn0 mulnC -{1}[q.+1]mul1n ltn_pmul2r // prime_gt1.
elim/ltn_ind... | Lemma | lognE | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"addn0",
"def_q",
"divn",
"dvdn",
"edivnP",
"leq_trans",
"logn",
"logn_rec",
"ltn0Sn",
"ltnS",
"ltn_ind",
"ltn_pmul2l",
"ltn_pmul2r",
"modn_def",
"mul1n",
"muln1",
"mulnC",
"p_pr",
"prednK",
"prime",
"prime_gt1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
logn_gt0 p n : (0 < logn p n) = (p \in primes n). | Proof. by rewrite lognE -mem_primes; case: {+}(p \in _). Qed. | Lemma | logn_gt0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"logn",
"lognE",
"mem_primes",
"primes"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ltn_log0 p n : n < p -> logn p n = 0. | Proof. by case: n => [|n] ltnp; rewrite lognE ?andbF // gtnNdvd ?andbF. Qed. | Lemma | ltn_log0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"gtnNdvd",
"logn",
"lognE"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
logn0 p : logn p 0 = 0. | Proof. by rewrite /logn if_same. Qed. | Lemma | logn0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"logn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
logn1 p : logn p 1 = 0. | Proof. by rewrite lognE dvdn1 /= andbC; case: eqP => // ->. Qed. | Lemma | logn1 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"dvdn1",
"logn",
"lognE"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pfactor_gt0 p n : 0 < p ^ logn p n. | Proof. by rewrite expn_gt0 lognE; case: (posnP p) => // ->. Qed. | Lemma | pfactor_gt0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"expn_gt0",
"logn",
"lognE",
"posnP"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pfactor_dvdn p n m : prime p -> m > 0 -> (p ^ n %| m) = (n <= logn p m). | Proof.
move=> p_pr; elim: n m => [|n IHn] m m_gt0; first exact: dvd1n.
rewrite lognE p_pr m_gt0 /=; case dv_pm: (p %| m); last first.
apply/dvdnP=> [] [/= q def_m].
by rewrite def_m expnS mulnCA dvdn_mulr in dv_pm.
case/dvdnP: dv_pm m_gt0 => q ->{m}; rewrite muln_gt0 => /andP[p_gt0 q_gt0].
by rewrite expnSr dvdn_pm... | Lemma | pfactor_dvdn | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"dvd1n",
"dvdnP",
"dvdn_mulr",
"dvdn_pmul2r",
"expnS",
"expnSr",
"last",
"logn",
"lognE",
"mulnCA",
"mulnK",
"muln_gt0",
"p_gt0",
"p_pr",
"prime",
"q_gt0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pfactor_dvdnn p n : p ^ logn p n %| n. | Proof.
case: n => // n; case pr_p: (prime p); first by rewrite pfactor_dvdn.
by rewrite lognE pr_p dvd1n.
Qed. | Lemma | pfactor_dvdnn | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"dvd1n",
"logn",
"lognE",
"pfactor_dvdn",
"pr_p",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
logn_prime p q : prime q -> logn p q = (p == q). | Proof.
move=> pr_q; have q_gt0 := prime_gt0 pr_q; rewrite lognE q_gt0 /=.
case pr_p: (prime p); last by case: eqP pr_p pr_q => // -> ->.
by rewrite dvdn_prime2 //; case: eqP => // ->; rewrite divnn q_gt0 logn1.
Qed. | Lemma | logn_prime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"divnn",
"dvdn_prime2",
"last",
"logn",
"logn1",
"lognE",
"pr_p",
"prime",
"prime_gt0",
"q_gt0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pfactor_coprime p n :
prime p -> n > 0 -> {m | coprime p m & n = m * p ^ logn p n}. | Proof.
move=> p_pr n_gt0; set k := logn p n.
have dv_pk_n: p ^ k %| n by rewrite pfactor_dvdn.
exists (n %/ p ^ k); last by rewrite divnK.
rewrite prime_coprime // -(@dvdn_pmul2r (p ^ k)) ?expn_gt0 ?prime_gt0 //.
by rewrite -expnS divnK // pfactor_dvdn // ltnn.
Qed. | Lemma | pfactor_coprime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"coprime",
"divnK",
"dvdn_pmul2r",
"expnS",
"expn_gt0",
"last",
"logn",
"ltnn",
"n_gt0",
"p_pr",
"pfactor_dvdn",
"prime",
"prime_coprime",
"prime_gt0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pfactorK p n : prime p -> logn p (p ^ n) = n. | Proof.
move=> p_pr; have pn_gt0: p ^ n > 0 by rewrite expn_gt0 prime_gt0.
apply/eqP; rewrite eqn_leq -pfactor_dvdn // dvdnn andbT.
by rewrite -(leq_exp2l _ _ (prime_gt1 p_pr)) dvdn_leq // pfactor_dvdn.
Qed. | Lemma | pfactorK | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"dvdn_leq",
"dvdnn",
"eqn_leq",
"expn_gt0",
"leq_exp2l",
"logn",
"p_pr",
"pfactor_dvdn",
"prime",
"prime_gt0",
"prime_gt1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pfactorKpdiv p n : prime p -> logn (pdiv (p ^ n)) (p ^ n) = n. | Proof. by case: n => // n p_pr; rewrite pdiv_pfactor ?pfactorK. Qed. | Lemma | pfactorKpdiv | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"logn",
"p_pr",
"pdiv",
"pdiv_pfactor",
"pfactorK",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
dvdn_leq_log p m n : 0 < n -> m %| n -> logn p m <= logn p n. | Proof.
move=> n_gt0 dv_m_n; have m_gt0 := dvdn_gt0 n_gt0 dv_m_n.
case p_pr: (prime p); last by do 2!rewrite lognE p_pr /=.
by rewrite -pfactor_dvdn //; apply: dvdn_trans dv_m_n; rewrite pfactor_dvdn.
Qed. | Lemma | dvdn_leq_log | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"dvdn_gt0",
"dvdn_trans",
"last",
"logn",
"lognE",
"n_gt0",
"p_pr",
"pfactor_dvdn",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ltn_logl p n : 0 < n -> logn p n < n. | Proof.
move=> n_gt0; have [p_gt1 | p_le1] := boolP (1 < p).
by rewrite (leq_trans (ltn_expl _ p_gt1)) // dvdn_leq ?pfactor_dvdnn.
by rewrite lognE (contraNF (@prime_gt1 _)).
Qed. | Lemma | ltn_logl | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"dvdn_leq",
"leq_trans",
"logn",
"lognE",
"ltn_expl",
"n_gt0",
"p_gt1",
"pfactor_dvdnn",
"prime_gt1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
logn_Gauss p m n : coprime p m -> logn p (m * n) = logn p n. | Proof.
move=> co_pm; case p_pr: (prime p); last by rewrite /logn p_pr.
have [-> | n_gt0] := posnP n; first by rewrite muln0.
have [m0 | m_gt0] := posnP m; first by rewrite m0 prime_coprime ?dvdn0 in co_pm.
have mn_gt0: m * n > 0 by rewrite muln_gt0 m_gt0.
apply/eqP; rewrite eqn_leq andbC dvdn_leq_log ?dvdn_mull //.
set... | Lemma | logn_Gauss | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"Gauss_dvdr",
"apply",
"coprime",
"coprimeXl",
"dvdn0",
"dvdn_leq_log",
"dvdn_mull",
"eqn_leq",
"last",
"logn",
"muln0",
"muln_gt0",
"n_gt0",
"p_pr",
"pfactor_dvdn",
"posnP",
"prime",
"prime_coprime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
logn_coprime p m : coprime p m -> logn p m = 0. | Proof. by move=> coprime_pm; rewrite -[m]muln1 logn_Gauss// logn1. Qed. | Lemma | logn_coprime | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"coprime",
"logn",
"logn1",
"logn_Gauss",
"muln1"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
lognM p m n : 0 < m -> 0 < n -> logn p (m * n) = logn p m + logn p n. | Proof.
case p_pr: (prime p); last by rewrite /logn p_pr.
have xlp := pfactor_coprime p_pr.
case/xlp=> m' co_m' def_m /xlp[n' co_n' def_n] {xlp}.
rewrite [in LHS]def_m [in LHS]def_n mulnCA -mulnA -expnD !logn_Gauss //.
exact: pfactorK.
Qed. | Lemma | lognM | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"def_n",
"expnD",
"last",
"logn",
"logn_Gauss",
"mulnA",
"mulnCA",
"n'",
"p_pr",
"pfactorK",
"pfactor_coprime",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
lognX p m n : logn p (m ^ n) = n * logn p m. | Proof.
case p_pr: (prime p); last by rewrite /logn p_pr muln0.
elim: n => [|n IHn]; first by rewrite logn1.
have [->|m_gt0] := posnP m; first by rewrite exp0n // lognE andbF muln0.
by rewrite expnS lognM ?IHn // expn_gt0 m_gt0.
Qed. | Lemma | lognX | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"exp0n",
"expnS",
"expn_gt0",
"last",
"logn",
"logn1",
"lognE",
"lognM",
"muln0",
"p_pr",
"posnP",
"prime"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
logn_div p m n : m %| n -> logn p (n %/ m) = logn p n - logn p m. | Proof.
rewrite dvdn_eq => /eqP def_n.
case: (posnP n) => [-> |]; first by rewrite div0n logn0.
by rewrite -{1 3}def_n muln_gt0 => /andP[q_gt0 m_gt0]; rewrite lognM ?addnK.
Qed. | Lemma | logn_div | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"addnK",
"def_n",
"div0n",
"dvdn_eq",
"logn",
"logn0",
"lognM",
"muln_gt0",
"posnP",
"q_gt0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
dvdn_pfactor p d n : prime p ->
reflect (exists2 m, m <= n & d = p ^ m) (d %| p ^ n). | Proof.
move=> p_pr; have pn_gt0: p ^ n > 0 by rewrite expn_gt0 prime_gt0.
apply: (iffP idP) => [dv_d_pn|[m le_m_n ->]]; last first.
by rewrite -(subnK le_m_n) expnD dvdn_mull.
exists (logn p d); first by rewrite -(pfactorK n p_pr) dvdn_leq_log.
have d_gt0: d > 0 by apply: dvdn_gt0 dv_d_pn.
case: (pfactor_coprime p_pr... | Lemma | dvdn_pfactor | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"Gauss_dvdr",
"apply",
"coprimeXl",
"coprime_sym",
"d_gt0",
"dvdn1",
"dvdn_gt0",
"dvdn_leq_log",
"dvdn_mull",
"dvdn_mulr",
"dvdn_trans",
"expnD",
"expn_gt0",
"last",
"logn",
"mul1n",
"muln1",
"p_pr",
"pfactorK",
"pfactor_coprime",
"prime",
"prime_gt0",
"subnK"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prime_decompE n : prime_decomp n = [seq (p, logn p n) | p <- primes n]. | Proof.
case: n => // n; pose f0 := (0, 0); rewrite -map_comp.
apply: (@eq_from_nth _ f0) => [|i lt_i_n]; first by rewrite size_map.
rewrite (nth_map f0) //; case def_f: (nth _ _ i) => [p e] /=.
congr (_, _); rewrite [n.+1]prod_prime_decomp //.
have: (p, e) \in prime_decomp n.+1 by rewrite -def_f mem_nth.
case/mem_prime... | Lemma | prime_decompE | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"apply",
"bigD1",
"big_ind",
"big_mkord",
"big_nth",
"coprimeMr",
"coprime_pexpr",
"coprimen1",
"dvdn_prime2",
"eq_from_nth",
"eq_sym",
"logn",
"logn_Gauss",
"map_comp",
"mem_nth",
"mem_prime_decomp",
"mulnC",
"nth",
"nth_map",
"nth_uniq",
"pfactorK",
"pr_p",
"prime_copri... | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
divn_count_dvd d n : n %/ d = \sum_(1 <= i < n.+1) (d %| i). | Proof.
have [-> | d_gt0] := posnP d; first by rewrite big_add1 divn0 big1.
apply: (@addnI (d %| 0)); rewrite -(@big_ltn _ 0 _ 0 _ (dvdn d)) // big_mkord.
rewrite (partition_big (fun i : 'I_n.+1 => inord (i %/ d)) 'I_(n %/ d).+1) //=.
rewrite dvdn0 add1n -[_.+1 in LHS]card_ord -sum1_card.
apply: eq_bigr => [[q ?] _].
re... | Lemma | divn_count_dvd | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"add1n",
"addnI",
"apply",
"big1",
"bigD1",
"big_add1",
"big_ltn",
"big_mkord",
"card_ord",
"d_gt0",
"divn0",
"dvdn",
"dvdn0",
"dvdn_eq",
"dvdn_mull",
"eq_bigr",
"eq_sym",
"inord",
"inordK",
"leq_div2r",
"leq_divRL",
"ltnS",
"mulnK",
"partition_big",
"posnP",
"sum1_... | Some combinatorial formulae. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
logn_count_dvd p n : prime p -> logn p n = \sum_(1 <= k < n) (p ^ k %| n). | Proof.
rewrite big_add1 => p_prime; case: n => [|n]; first by rewrite logn0 big_geq.
rewrite big_mkord -big_mkcond (eq_bigl _ _ (fun _ => pfactor_dvdn _ _ _)) //=.
by rewrite big_ord_narrow ?sum1_card ?card_ord // -ltnS ltn_logl.
Qed. | Lemma | logn_count_dvd | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"big_add1",
"big_geq",
"big_mkcond",
"big_mkord",
"big_ord_narrow",
"card_ord",
"eq_bigl",
"logn",
"logn0",
"ltnS",
"ltn_logl",
"pfactor_dvdn",
"prime",
"sum1_card"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
trunc_log p n | :=
let fix loop n k :=
if k is k'.+1 then if p <= n then (loop (n %/ p) k').+1 else 0 else 0
in if p <= 1 then 0 else loop n n. | Definition | trunc_log | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [] | Truncated real log. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
trunc_log0 p : trunc_log p 0 = 0. | Proof. by case: p => [] // []. Qed. | Lemma | trunc_log0 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"trunc_log"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.