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
dvdn_mul d1 d2 m1 m2 : d1 %| m1 -> d2 %| m2 -> d1 * d2 %| m1 * m2.
Proof. by move=> /dvdnP[q1 ->] /dvdnP[q2 ->]; rewrite mulnCA -mulnA 2?dvdn_mull. Qed.
Lemma
dvdn_mul
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdnP", "dvdn_mull", "mulnA", "mulnCA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_trans n d m : d %| n -> n %| m -> d %| m.
Proof. by move=> d_dv_n /dvdnP[n1 ->]; apply: dvdn_mull. Qed.
Lemma
dvdn_trans
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdnP", "dvdn_mull" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_eq d m : (d %| m) = (m %/ d * d == m).
Proof. apply/eqP/eqP=> [modm0 | <-]; last exact: modnMl. by rewrite [RHS](divn_eq m d) modm0 addn0. Qed.
Lemma
dvdn_eq
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addn0", "apply", "divn_eq", "last", "modnMl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn2 n : (2 %| n) = ~~ odd n.
Proof. by rewrite /dvdn modn2; case (odd n). Qed.
Lemma
dvdn2
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn", "modn2", "odd" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_odd m n : m %| n -> odd n -> odd m.
Proof. by move=> m_dv_n; apply: contraTT; rewrite -!dvdn2 => /dvdn_trans->. Qed.
Lemma
dvdn_odd
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdn2", "dvdn_trans", "odd" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnK d m : d %| m -> m %/ d * d = m.
Proof. by rewrite dvdn_eq; move/eqP. Qed.
Lemma
divnK
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_eq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
leq_divLR d m n : d %| m -> (m %/ d <= n) = (m <= n * d).
Proof. by case: d m => [|d] [|m] ///divnK=> {2}<-; rewrite leq_pmul2r. Qed.
Lemma
leq_divLR
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnK", "leq_pmul2r" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
ltn_divRL d m n : d %| m -> (n < m %/ d) = (n * d < m).
Proof. by move=> dv_d_m; rewrite !ltnNge leq_divLR. Qed.
Lemma
ltn_divRL
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "leq_divLR", "ltnNge" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
eqn_div d m n : d > 0 -> d %| m -> (n == m %/ d) = (n * d == m).
Proof. by move=> d_gt0 dv_d_m; rewrite -(eqn_pmul2r d_gt0) divnK. Qed.
Lemma
eqn_div
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "d_gt0", "divnK", "eqn_pmul2r" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
eqn_mul d m n : d > 0 -> d %| m -> (m == n * d) = (m %/ d == n).
Proof. by move=> d_gt0 dv_d_m; rewrite eq_sym -eqn_div // eq_sym. Qed.
Lemma
eqn_mul
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "d_gt0", "eq_sym", "eqn_div" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divn_mulAC d m n : d %| m -> m %/ d * n = m * n %/ d.
Proof. case: d m => [[] //| d m] dv_d_m; apply/eqP. by rewrite eqn_div ?dvdn_mulr // mulnAC divnK. Qed.
Lemma
divn_mulAC
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "divnK", "dvdn_mulr", "eqn_div", "mulnAC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_divA d m n : d %| n -> m * (n %/ d) = m * n %/ d.
Proof. by move=> dv_d_m; rewrite !(mulnC m) divn_mulAC. Qed.
Lemma
muln_divA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divn_mulAC", "mulnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_divCA d m n : d %| m -> d %| n -> m * (n %/ d) = n * (m %/ d).
Proof. by move=> dv_d_m dv_d_n; rewrite mulnC divn_mulAC ?muln_divA. Qed.
Lemma
muln_divCA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divn_mulAC", "mulnC", "muln_divA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnA m n p : p %| n -> m %/ (n %/ p) = m * p %/ n.
Proof. by case: p => [|p] dv_n; rewrite -[in RHS](divnK dv_n) // divnMr. Qed.
Lemma
divnA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnK", "divnMr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
modn_dvdm m n d : d %| m -> n %% m = n %[mod d].
Proof. by case/dvdnP=> q def_m; rewrite [in RHS](divn_eq n m) def_m mulnA modnMDl. Qed.
Lemma
modn_dvdm
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divn_eq", "dvdnP", "modnMDl", "mulnA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_leq d m : 0 < m -> d %| m -> d <= m.
Proof. by move=> m_gt0 /dvdnP[[|k] Dm]; rewrite Dm // leq_addr in m_gt0 *. Qed.
Lemma
dvdn_leq
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdnP", "leq_addr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gtnNdvd n d : 0 < n -> n < d -> (d %| n) = false.
Proof. by move=> n_gt0 lt_nd; rewrite /dvdn eqn0Ngt modn_small ?n_gt0. Qed.
Lemma
gtnNdvd
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn", "eqn0Ngt", "modn_small", "n_gt0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
eqn_dvd m n : (m == n) = (m %| n) && (n %| m).
Proof. case: m n => [|m] [|n] //; apply/idP/andP => [/eqP -> //| []]. by rewrite eqn_leq => Hmn Hnm; do 2 rewrite dvdn_leq //. Qed.
Lemma
eqn_dvd
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdn_leq", "eqn_leq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_pmul2l p d m : 0 < p -> (p * d %| p * m) = (d %| m).
Proof. by case: p => // p _; rewrite /dvdn -muln_modr // muln_eq0. Qed.
Lemma
dvdn_pmul2l
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn", "muln_eq0", "muln_modr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_pmul2r p d m : 0 < p -> (d * p %| m * p) = (d %| m).
Proof. by move=> p_gt0; rewrite -!(mulnC p) dvdn_pmul2l. Qed.
Lemma
dvdn_pmul2r
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_pmul2l", "mulnC", "p_gt0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_divLR p d m : 0 < p -> p %| d -> (d %/ p %| m) = (d %| m * p).
Proof. by move=> /(@dvdn_pmul2r p _ m) <- /divnK->. Qed.
Lemma
dvdn_divLR
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnK", "dvdn_pmul2r" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_divRL p d m : p %| m -> (d %| m %/ p) = (d * p %| m).
Proof. have [-> | /(@dvdn_pmul2r p d) <- /divnK-> //] := posnP p. by rewrite divn0 muln0 dvdn0. Qed.
Lemma
dvdn_divRL
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divn0", "divnK", "dvdn0", "dvdn_pmul2r", "muln0", "posnP" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_div d m : d %| m -> m %/ d %| m.
Proof. by move/divnK=> {2}<-; apply: dvdn_mulr. Qed.
Lemma
dvdn_div
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "divnK", "dvdn_mulr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_exp2l p m n : m <= n -> p ^ m %| p ^ n.
Proof. by move/subnK <-; rewrite expnD dvdn_mull. Qed.
Lemma
dvdn_exp2l
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_mull", "expnD", "subnK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_Pexp2l p m n : p > 1 -> (p ^ m %| p ^ n) = (m <= n).
Proof. move=> p_gt1; case: leqP => [|gt_n_m]; first exact: dvdn_exp2l. by rewrite gtnNdvd ?ltn_exp2l ?expn_gt0 // ltnW. Qed.
Lemma
dvdn_Pexp2l
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_exp2l", "expn_gt0", "gtnNdvd", "leqP", "ltnW", "ltn_exp2l", "p_gt1" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_exp2r m n k : m %| n -> m ^ k %| n ^ k.
Proof. by case/dvdnP=> q ->; rewrite expnMn dvdn_mull. Qed.
Lemma
dvdn_exp2r
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdnP", "dvdn_mull", "expnMn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divn_modl m n d : d %| n -> (m %% n) %/ d = (m %/ d) %% (n %/ d).
Proof. by move=> dvd_dn; rewrite modn_divl divnK. Qed.
Lemma
divn_modl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnK", "modn_divl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_addr m d n : d %| m -> (d %| m + n) = (d %| n).
Proof. by case/dvdnP=> q ->; rewrite /dvdn modnMDl. Qed.
Lemma
dvdn_addr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn", "dvdnP", "modnMDl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_addl n d m : d %| n -> (d %| m + n) = (d %| m).
Proof. by rewrite addnC; apply: dvdn_addr. Qed.
Lemma
dvdn_addl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addnC", "apply", "dvdn_addr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_add d m n : d %| m -> d %| n -> d %| m + n.
Proof. by move/dvdn_addr->. Qed.
Lemma
dvdn_add
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_addr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_add_eq d m n : d %| m + n -> (d %| m) = (d %| n).
Proof. by move=> dv_d_mn; apply/idP/idP => [/dvdn_addr | /dvdn_addl] <-. Qed.
Lemma
dvdn_add_eq
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdn_addl", "dvdn_addr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_subr d m n : n <= m -> d %| m -> (d %| m - n) = (d %| n).
Proof. by move=> le_n_m dv_d_m; apply: dvdn_add_eq; rewrite subnK. Qed.
Lemma
dvdn_subr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdn_add_eq", "subnK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_subl d m n : n <= m -> d %| n -> (d %| m - n) = (d %| m).
Proof. by move=> le_n_m dv_d_m; rewrite -(dvdn_addl _ dv_d_m) subnK. Qed.
Lemma
dvdn_subl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_addl", "subnK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_sub d m n : d %| m -> d %| n -> d %| m - n.
Proof. by case: (leqP n m) => [le_nm /dvdn_subr <- // | /ltnW/eqnP ->]; rewrite dvdn0. Qed.
Lemma
dvdn_sub
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn0", "dvdn_subr", "eqnP", "leqP", "ltnW" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_exp k d m : 0 < k -> d %| m -> d %| (m ^ k).
Proof. by case: k => // k _ d_dv_m; rewrite expnS dvdn_mulr. Qed.
Lemma
dvdn_exp
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_mulr", "expnS" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_fact m n : 0 < m <= n -> m %| n`!.
Proof. case: m => //= m; elim: n => //= n IHn; rewrite ltnS. have [/IHn/dvdn_mull->||-> _] // := ltngtP m n; exact: dvdn_mulr. Qed.
Lemma
dvdn_fact
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_mull", "dvdn_mulr", "ltnS", "ltngtP" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
eqn_mod_dvd d m n : n <= m -> (m == n %[mod d]) = (d %| m - n).
Proof. by move/subnK=> Dm; rewrite -[n in LHS]add0n -[in LHS]Dm eqn_modDr mod0n. Qed.
Lemma
eqn_mod_dvd
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "add0n", "eqn_modDr", "mod0n", "subnK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnDMl q m d : 0 < d -> (m + q * d) %/ d = (m %/ d) + q.
Proof. by move=> d_gt0; rewrite addnC divnMDl// addnC. Qed.
Lemma
divnDMl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addnC", "d_gt0", "divnMDl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnMBl q m d : 0 < d -> (q * d - m) %/ d = q - (m %/ d) - (~~ (d %| m)).
Proof. by move=> d_gt0; rewrite divnB// mulnK// modnMl lt0n. Qed.
Lemma
divnMBl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "d_gt0", "divnB", "lt0n", "modnMl", "mulnK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnBMl q m d : (m - q * d) %/ d = (m %/ d) - q.
Proof. by case: d => [|d]//=; rewrite divnB// mulnK// modnMl ltn0 subn0. Qed.
Lemma
divnBMl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnB", "ltn0", "modnMl", "mulnK", "subn0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnDl m n d : d %| m -> (m + n) %/ d = m %/ d + n %/ d.
Proof. by case: d => // d /divnK-Dm; rewrite -[in LHS]Dm divnMDl. Qed.
Lemma
divnDl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnK", "divnMDl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnDr m n d : d %| n -> (m + n) %/ d = m %/ d + n %/ d.
Proof. by move=> dv_n; rewrite addnC divnDl // addnC. Qed.
Lemma
divnDr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addnC", "divnDl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnBl m n d : d %| m -> (m - n) %/ d = m %/ d - (n %/ d) - (~~ (d %| n)).
Proof. by case: d => [|d] // /divnK-Dm; rewrite -[in LHS]Dm divnMBl. Qed.
Lemma
divnBl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnK", "divnMBl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnBr m n d : d %| n -> (m - n) %/ d = m %/ d - n %/ d.
Proof. by case: d => [|d]// /divnK-Dm; rewrite -[in LHS]Dm divnBMl. Qed.
Lemma
divnBr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnBMl", "divnK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
edivnS m d : 0 < d -> edivn m.+1 d = if d %| m.+1 then ((m %/ d).+1, 0) else (m %/ d, (m %% d).+1).
Proof. case: d => [|[|d]] //= _; first by rewrite edivn_def modn1 dvd1n !divn1. rewrite -addn1 /dvdn modn_def edivnD//= (@modn_small 1)// (@divn_small 1)//. rewrite addn1 addn0 ltnS; have [||<-] := ltngtP d.+1. - by rewrite ltnNge -ltnS ltn_pmod. - by rewrite addn0 mul0n subn0. - by rewrite addn1 mul1n subnn. Qed.
Lemma
edivnS
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addn0", "addn1", "divn1", "divn_small", "dvd1n", "dvdn", "edivn", "edivnD", "edivn_def", "ltnNge", "ltnS", "ltn_pmod", "ltngtP", "modn1", "modn_def", "modn_small", "mul0n", "mul1n", "subn0", "subnn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
modnS m d : m.+1 %% d = if d %| m.+1 then 0 else (m %% d).+1.
Proof. by case: d => [|d]//; rewrite modn_def edivnS//; case: ifP. Qed.
Lemma
modnS
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "edivnS", "modn_def" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divnS m d : 0 < d -> m.+1 %/ d = (d %| m.+1) + m %/ d.
Proof. by move=> d_gt0; rewrite /divn edivnS//; case: ifP. Qed.
Lemma
divnS
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "d_gt0", "divn", "edivnS" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divn_pred m d : m.-1 %/ d = (m %/ d) - (d %| m).
Proof. by case: d m => [|d] [|m]; rewrite ?divn1 ?dvd1n ?subn1//= divnS// addnC addnK. Qed.
Lemma
divn_pred
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addnC", "addnK", "divn1", "divnS", "dvd1n", "subn1" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
modn_pred m d : d != 1 -> 0 < m -> m.-1 %% d = if d %| m then d.-1 else (m %% d).-1.
Proof. rewrite -subn1; case: d m => [|[|d]] [|m]//= _ _. by rewrite ?modn1 ?dvd1n ?modn0 ?subn1. rewrite modnB// (@modn_small 1)// [_ < _]leqn0 /dvdn mulnbl/= subn1. by case: eqP => // ->; rewrite addn0. Qed.
Lemma
modn_pred
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addn0", "dvd1n", "dvdn", "leqn0", "modn0", "modn1", "modnB", "modn_small", "mulnbl", "subn1" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
edivn_pred m d : d != 1 -> 0 < m -> edivn m.-1 d = if d %| m then ((m %/ d).-1, d.-1) else (m %/ d, (m %% d).-1).
Proof. move=> d_neq1 m_gt0; rewrite edivn_def divn_pred modn_pred//. by case: ifP; rewrite ?subn0 ?subn1. Qed.
Lemma
edivn_pred
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divn_pred", "edivn", "edivn_def", "modn_pred", "subn0", "subn1" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn m n
:= let n' := n %% m in if n' is 0 then m else if m - n'.-1 is m'.+1 then gcdn (m' %% n') n' else n'.
Fixpoint
gcdn
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "n'" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnE m n : gcdn m n = if m == 0 then n else gcdn (n %% m) m.
Proof. elim/ltn_ind: m n => -[|m] IHm [|n] //=; rewrite /gcdn -/gcdn. case def_p: (_ %% _) => // [p]. have{def_p} lt_pm: p.+1 < m.+1 by rewrite -def_p ltn_pmod. rewrite {}IHm // subn_if_gt ltnW //=; congr gcdn. by rewrite -(subnK (ltnW lt_pm)) modnDr. Qed.
Lemma
gcdnE
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "def_p", "gcdn", "ltnW", "ltn_ind", "ltn_pmod", "modnDr", "subnK", "subn_if_gt" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnn : idempotent_op gcdn.
Proof. by case=> // n; rewrite gcdnE modnn. Qed.
Lemma
gcdnn
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnE", "idempotent_op", "modnn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnC : commutative gcdn.
Proof. move=> m n; wlog lt_nm: m n / n < m by have [? ->|? <-|-> //] := ltngtP n m. by rewrite gcdnE -[in m == 0](ltn_predK lt_nm) modn_small. Qed.
Lemma
gcdnC
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnE", "ltn_predK", "ltngtP", "modn_small" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcd0n : left_id 0 gcdn.
Proof. by case. Qed.
Lemma
gcd0n
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn0 : right_id 0 gcdn.
Proof. by case. Qed.
Lemma
gcdn0
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcd1n : left_zero 1 gcdn.
Proof. by move=> n; rewrite gcdnE modn1. Qed.
Lemma
gcd1n
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnE", "modn1" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn1 : right_zero 1 gcdn.
Proof. by move=> n; rewrite gcdnC gcd1n. Qed.
Lemma
gcdn1
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcd1n", "gcdn", "gcdnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_gcdr m n : gcdn m n %| n.
Proof. elim/ltn_ind: m n => -[|m] IHm [|n] //=. rewrite gcdnE; case def_p: (_ %% _) => [|p]; first by rewrite /dvdn def_p. have lt_pm: p < m by rewrite -ltnS -def_p ltn_pmod. rewrite /= (divn_eq n.+1 m.+1) def_p dvdn_addr ?dvdn_mull //; first exact: IHm. by rewrite gcdnE /= IHm // (ltn_trans (ltn_pmod _ _)). Qed.
Lemma
dvdn_gcdr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "def_p", "divn_eq", "dvdn", "dvdn_addr", "dvdn_mull", "gcdn", "gcdnE", "ltnS", "ltn_ind", "ltn_pmod", "ltn_trans" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_gcdl m n : gcdn m n %| m.
Proof. by rewrite gcdnC dvdn_gcdr. Qed.
Lemma
dvdn_gcdl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_gcdr", "gcdn", "gcdnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn_gt0 m n : (0 < gcdn m n) = (0 < m) || (0 < n).
Proof. by case: m n => [|m] [|n] //; apply: (@dvdn_gt0 _ m.+1) => //; apply: dvdn_gcdl. Qed.
Lemma
gcdn_gt0
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdn_gcdl", "dvdn_gt0", "gcdn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnMDl k m n : gcdn m (k * m + n) = gcdn m n.
Proof. by rewrite !(gcdnE m) modnMDl mulnC; case: m. Qed.
Lemma
gcdnMDl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnE", "modnMDl", "mulnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnDl m n : gcdn m (m + n) = gcdn m n.
Proof. by rewrite -[m in m + n]mul1n gcdnMDl. Qed.
Lemma
gcdnDl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnMDl", "mul1n" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnDr m n : gcdn m (n + m) = gcdn m n.
Proof. by rewrite addnC gcdnDl. Qed.
Lemma
gcdnDr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addnC", "gcdn", "gcdnDl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnMl n m : gcdn n (m * n) = n.
Proof. by case: n => [|n]; rewrite gcdnE modnMl // muln0. Qed.
Lemma
gcdnMl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnE", "modnMl", "muln0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnMr n m : gcdn n (n * m) = n.
Proof. by rewrite mulnC gcdnMl. Qed.
Lemma
gcdnMr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnMl", "mulnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn_idPl {m n} : reflect (gcdn m n = m) (m %| n).
Proof. by apply: (iffP idP) => [/dvdnP[q ->] | <-]; rewrite (gcdnMl, dvdn_gcdr). Qed.
Lemma
gcdn_idPl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdnP", "dvdn_gcdr", "gcdn", "gcdnMl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn_idPr {m n} : reflect (gcdn m n = n) (n %| m).
Proof. by rewrite gcdnC; apply: gcdn_idPl. Qed.
Lemma
gcdn_idPr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "gcdn", "gcdnC", "gcdn_idPl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
expn_min e m n : e ^ minn m n = gcdn (e ^ m) (e ^ n).
Proof. by case: leqP => [|/ltnW] /(dvdn_exp2l e) /gcdn_idPl; rewrite gcdnC. Qed.
Lemma
expn_min
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_exp2l", "gcdn", "gcdnC", "gcdn_idPl", "leqP", "ltnW", "minn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn_modr m n : gcdn m (n %% m) = gcdn m n.
Proof. by rewrite [in RHS](divn_eq n m) gcdnMDl. Qed.
Lemma
gcdn_modr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divn_eq", "gcdn", "gcdnMDl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn_modl m n : gcdn (m %% n) n = gcdn m n.
Proof. by rewrite !(gcdnC _ n) gcdn_modr. Qed.
Lemma
gcdn_modl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnC", "gcdn_modr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
Bezout_rec km kn qs
:= if qs is q :: qs' then Bezout_rec kn (NatTrec.add_mul q kn km) qs' else (km, kn).
Fixpoint
Bezout_rec
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "add_mul" ]
Extended gcd, which computes Bezout coefficients.
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
egcdn_rec m n s qs
:= if s is s'.+1 then let: (q, r) := edivn m n in if r > 0 then egcdn_rec n r s' (q :: qs) else if odd (size qs) then qs else q.-1 :: qs else [::0].
Fixpoint
egcdn_rec
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "edivn", "odd", "size" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
egcdn m n
:= Bezout_rec 0 1 (egcdn_rec m n n [::]).
Definition
egcdn
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "Bezout_rec", "egcdn_rec" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
egcdn_spec m n : nat * nat -> Type
:= EgcdnSpec km kn of km * m = kn * n + gcdn m n & kn * gcdn m n < m : egcdn_spec m n (km, kn).
Variant
egcdn_spec
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "nat" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
egcd0n n : egcdn 0 n = (1, 0).
Proof. by case: n. Qed.
Lemma
egcd0n
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "egcdn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
egcdnP m n : m > 0 -> egcdn_spec m n (egcdn m n).
Proof. have [-> /= | n_gt0 m_gt0] := posnP n; first by split; rewrite // mul1n gcdn0. rewrite /egcdn; set s := (s in egcdn_rec _ _ s); pose bz := Bezout_rec n m [::]. have: n < s.+1 by []; move defSpec: (egcdn_spec bz.2 bz.1) s => Spec s. elim: s => [[]|s IHs] //= in n m (qs := [::]) bz defSpec n_gt0 m_gt0 *. case: edi...
Lemma
egcdnP
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "Bezout_rec", "addIn", "addn", "addn0", "addn1", "addnA", "addnACA", "addnC", "addn_gt0", "addn_negb", "addnn", "apply", "d_gt0", "dvdn_gt0", "dvdn_mulr", "edivnP", "egcdn", "egcdn_rec", "egcdn_spec", "gcd0n", "gcdn", "gcdn0", "gcdnC", "gcdnE", "gcdnMDl", "gcdn_gt0"...
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
Bezoutl m n : m > 0 -> {a | a < m & m %| gcdn m n + a * n}.
Proof. move=> m_gt0; case: (egcdnP n m_gt0) => km kn def_d lt_kn_m. exists kn; last by rewrite addnC -def_d dvdn_mull. apply: leq_ltn_trans lt_kn_m. by rewrite -{1}[kn]muln1 leq_mul2l gcdn_gt0 m_gt0 orbT. Qed.
Lemma
Bezoutl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "addnC", "apply", "dvdn_mull", "egcdnP", "gcdn", "gcdn_gt0", "last", "leq_ltn_trans", "leq_mul2l", "muln1" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
Bezoutr m n : n > 0 -> {a | a < n & n %| gcdn m n + a * m}.
Proof. by rewrite gcdnC; apply: Bezoutl. Qed.
Lemma
Bezoutr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "Bezoutl", "apply", "gcdn", "gcdnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
dvdn_gcd p m n : (p %| gcdn m n) = (p %| m) && (p %| n).
Proof. apply/idP/andP=> [dv_pmn | [dv_pm dv_pn]]. by rewrite !(dvdn_trans dv_pmn) ?dvdn_gcdl ?dvdn_gcdr. have [->|n_gt0] := posnP n; first by rewrite gcdn0. case: (Bezoutr m n_gt0) => // km _ /(dvdn_trans dv_pn). by rewrite dvdn_addl // dvdn_mull. Qed.
Lemma
dvdn_gcd
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "Bezoutr", "apply", "dvdn_addl", "dvdn_gcdl", "dvdn_gcdr", "dvdn_mull", "dvdn_trans", "gcdn", "gcdn0", "n_gt0", "posnP" ]
Back to the gcd.
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnAC : right_commutative gcdn.
Proof. suffices dvd m n p: gcdn (gcdn m n) p %| gcdn (gcdn m p) n. by move=> m n p; apply/eqP; rewrite eqn_dvd !dvd. rewrite !dvdn_gcd dvdn_gcdr. by rewrite !(dvdn_trans (dvdn_gcdl _ p)) ?dvdn_gcdl ?dvdn_gcdr. Qed.
Lemma
gcdnAC
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvd", "dvdn_gcd", "dvdn_gcdl", "dvdn_gcdr", "dvdn_trans", "eqn_dvd", "gcdn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnA : associative gcdn.
Proof. by move=> m n p; rewrite !(gcdnC m) gcdnAC. Qed.
Lemma
gcdnA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnAC", "gcdnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnCA : left_commutative gcdn.
Proof. by move=> m n p; rewrite !gcdnA (gcdnC m). Qed.
Lemma
gcdnCA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnA", "gcdnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdnACA : interchange gcdn gcdn.
Proof. by move=> m n p q; rewrite -!gcdnA (gcdnCA n). Qed.
Lemma
gcdnACA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "gcdnA", "gcdnCA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_gcdr : right_distributive muln gcdn.
Proof. move=> p m n; have [-> //|p_gt0] := posnP p. elim/ltn_ind: m n => m IHm n; rewrite gcdnE [RHS]gcdnE muln_eq0 (gtn_eqF p_gt0). by case: posnP => // m_gt0; rewrite -muln_modr //=; apply/IHm/ltn_pmod. Qed.
Lemma
muln_gcdr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "gcdn", "gcdnE", "gtn_eqF", "ltn_ind", "ltn_pmod", "muln", "muln_eq0", "muln_modr", "p_gt0", "posnP" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_gcdl : left_distributive muln gcdn.
Proof. by move=> m n p; rewrite -!(mulnC p) muln_gcdr. Qed.
Lemma
muln_gcdl
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn", "muln", "mulnC", "muln_gcdr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
gcdn_def d m n : d %| m -> d %| n -> (forall d', d' %| m -> d' %| n -> d' %| d) -> gcdn m n = d.
Proof. move=> dv_dm dv_dn gdv_d; apply/eqP. by rewrite eqn_dvd dvdn_gcd dv_dm dv_dn gdv_d ?dvdn_gcdl ?dvdn_gcdr. Qed.
Lemma
gcdn_def
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "dvdn_gcd", "dvdn_gcdl", "dvdn_gcdr", "eqn_dvd", "gcdn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_divCA_gcd n m : n * (m %/ gcdn n m) = m * (n %/ gcdn n m).
Proof. by rewrite muln_divCA ?dvdn_gcdl ?dvdn_gcdr. Qed.
Lemma
muln_divCA_gcd
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_gcdl", "dvdn_gcdr", "gcdn", "muln_divCA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcmn m n
:= m * n %/ gcdn m n.
Definition
lcmn
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdn" ]
We derive the lcm directly.
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcmnC : commutative lcmn.
Proof. by move=> m n; rewrite /lcmn mulnC gcdnC. Qed.
Lemma
lcmnC
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "gcdnC", "lcmn", "mulnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcm0n : left_zero 0 lcmn.
Proof. by move=> n; apply: div0n. Qed.
Lemma
lcm0n
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "div0n", "lcmn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcmn0 : right_zero 0 lcmn.
Proof. by move=> n; rewrite lcmnC lcm0n. Qed.
Lemma
lcmn0
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "lcm0n", "lcmn", "lcmnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcm1n : left_id 1 lcmn.
Proof. by move=> n; rewrite /lcmn gcd1n mul1n divn1. Qed.
Lemma
lcm1n
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divn1", "gcd1n", "lcmn", "mul1n" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcmn1 : right_id 1 lcmn.
Proof. by move=> n; rewrite lcmnC lcm1n. Qed.
Lemma
lcmn1
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "lcm1n", "lcmn", "lcmnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_lcm_gcd m n : lcmn m n * gcdn m n = m * n.
Proof. by apply/eqP; rewrite divnK ?dvdn_mull ?dvdn_gcdr. Qed.
Lemma
muln_lcm_gcd
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "apply", "divnK", "dvdn_gcdr", "dvdn_mull", "gcdn", "lcmn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcmn_gt0 m n : (0 < lcmn m n) = (0 < m) && (0 < n).
Proof. by rewrite -muln_gt0 ltn_divRL ?dvdn_mull ?dvdn_gcdr. Qed.
Lemma
lcmn_gt0
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "dvdn_gcdr", "dvdn_mull", "lcmn", "ltn_divRL", "muln_gt0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_lcmr : right_distributive muln lcmn.
Proof. case=> // m n p; rewrite /lcmn -muln_gcdr -!mulnA divnMl // mulnCA. by rewrite muln_divA ?dvdn_mull ?dvdn_gcdr. Qed.
Lemma
muln_lcmr
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnMl", "dvdn_gcdr", "dvdn_mull", "lcmn", "muln", "mulnA", "mulnCA", "muln_divA", "muln_gcdr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
muln_lcml : left_distributive muln lcmn.
Proof. by move=> m n p; rewrite -!(mulnC p) muln_lcmr. Qed.
Lemma
muln_lcml
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "lcmn", "muln", "mulnC", "muln_lcmr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcmnA : associative lcmn.
Proof. move=> m n p; rewrite [LHS]/lcmn [RHS]/lcmn mulnC. rewrite !divn_mulAC ?dvdn_mull ?dvdn_gcdr // -!divnMA ?dvdn_mulr ?dvdn_gcdl //. rewrite mulnC mulnA !muln_gcdr; congr (_ %/ _). by rewrite ![_ * lcmn _ _]mulnC !muln_lcm_gcd !muln_gcdl -!(mulnC m) gcdnA. Qed.
Lemma
lcmnA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "divnMA", "divn_mulAC", "dvdn_gcdl", "dvdn_gcdr", "dvdn_mull", "dvdn_mulr", "gcdnA", "lcmn", "mulnA", "mulnC", "muln_gcdl", "muln_gcdr", "muln_lcm_gcd" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
lcmnCA : left_commutative lcmn.
Proof. by move=> m n p; rewrite !lcmnA (lcmnC m). Qed.
Lemma
lcmnCA
boot
boot/div.v
[ "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq" ]
[ "lcmn", "lcmnA", "lcmnC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d