fact stringlengths 8 1.54k | type stringclasses 19 values | library stringclasses 8 values | imports listlengths 1 10 | filename stringclasses 98 values | symbolic_name stringlengths 1 42 | docstring stringclasses 1 value |
|---|---|---|---|---|---|---|
div_annihilant_in_idealp q :
1 < size p -> 1 < size q ->
{uv : {poly {poly R}} * {poly {poly R}}
| size uv.1 < size q /\ size uv.2 < size p
& forall x y,
(div_annihilant p q).[y] = uv.1.[x, y] * p.[x * y] + uv.2.[x, y] * q.[x]}.
Proof.
rewrite -size_poly_XmY -(size_map_polyC q) => p1_gt1 q1_gt1.
have [uv /= [ub_u ub_v Dr]] := resultant_in_ideal p1_gt1 q1_gt1.
exists uv => // x y; rewrite -[r in r.[y] = _](hornerC _ x%:P) Dr.
by rewrite !(hornerE, horner_comp).
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype choice ssrnat seq",
"From mathcomp Require Import fintype tuple finfun bigop fingroup perm div",
"From mathcomp Require Import ssralg zmodp matrix mxalgebra",
"From mathcomp Require Import poly polydiv mxpoly ... | algebra/polyXY.v | div_annihilant_in_ideal | |
div_annihilant_neq0p q : p != 0 -> q.[0] != 0 -> div_annihilant p q != 0.
Proof.
have factorX (S : nzRingType) (u : {poly S}) :
u != 0 -> root u 0 -> exists2 v, v != 0 & u = v * 'X.
move=> nz_u /factor_theorem[v]; rewrite subr0 => Du; exists v => //.
by apply: contraNneq nz_u => v0; rewrite Du v0 mul0r.
have nzX: 'X != 0 := monic_neq0 (monicX _); have rootC0 := root_polyC _ 0.
rewrite resultant_eq0 -leqNgt -rootE // => nz_p nz_q0; apply/eq_leq/eqP.
have nz_q: q != 0 by apply: contraNneq nz_q0 => ->; rewrite root0.
apply/Bezout_coprimepPn; rewrite ?map_polyC_eq0 ?poly_XmY_eq0 // => [[uv]].
rewrite !size_poly_gt0 -andbA ltnNge => /and4P[nz_u /negP ltuq nz_v _] Duv.
pose u := swapXY uv.1; pose v := swapXY uv.2.
suffices{ltuq}: size q <= sizeY u by rewrite sizeYE swapXYK -size_map_polyC.
have{nz_u nz_v} [nz_u nz_v Dvu]: [/\ u != 0, v != 0 & q *: v = u * poly_XmY p].
rewrite !swapXY_eq0; split=> //; apply: (can_inj swapXYK).
by rewrite linearZ rmorphM /= !swapXYK swapXY_poly_XmY Duv mulrC.
have{Duv} [n ltvn]: {n | size v < n} by exists (size v).+1.
elim: n {uv} => // n IHn in p (v) (u) nz_u nz_v Dvu nz_p ltvn *.
have Dp0: root (poly_XmY p) 0 = root p 0 by rewrite root_comp !hornerE rootC0.
have Dv0: root u 0 || root p 0 = root v 0 by rewrite -Dp0 -rootM -Dvu rootZ.
have [v0_0 | nz_v0] := boolP (root v 0); last first.
have nz_p0: ~~ root p 0 by apply: contra nz_v0; rewrite -Dv0 orbC => ->.
apply: (@leq_trans (size (q * v.[0]))).
by rewrite size_mul // (polySpred nz_v0) addnS leq_a
... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype choice ssrnat seq",
"From mathcomp Require Import fintype tuple finfun bigop fingroup perm div",
"From mathcomp Require Import ssralg zmodp matrix mxalgebra",
"From mathcomp Require Import poly polydiv mxpoly ... | algebra/polyXY.v | div_annihilant_neq0 | |
div_annihilantP(p q : {poly E}) (x y : E) :
p != 0 -> q != 0 -> y != 0 -> p.[x] = 0 -> q.[y] = 0 ->
(div_annihilant p q).[x / y] = 0.
Proof.
move=> nz_p nz_q nz_y px0 qy0.
have p_gt1: size p > 1 by have /rootP/root_size_gt1-> := px0.
have q_gt1: size q > 1 by have /rootP/root_size_gt1-> := qy0.
have [uv /= _ /(_ y)->] := div_annihilant_in_ideal p_gt1 q_gt1.
by rewrite (mulrC y) divfK // px0 qy0 !mulr0 addr0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype choice ssrnat seq",
"From mathcomp Require Import fintype tuple finfun bigop fingroup perm div",
"From mathcomp Require Import ssralg zmodp matrix mxalgebra",
"From mathcomp Require Import poly polydiv mxpoly ... | algebra/polyXY.v | div_annihilantP | |
map_sub_annihilantP(p q : {poly F}) (x y : E) :
p != 0 -> q != 0 ->(p ^ FtoE).[x] = 0 -> (q ^ FtoE).[y] = 0 ->
(sub_annihilant p q ^ FtoE).[x - y] = 0.
Proof.
move=> nz_p nz_q px0 qy0; have pFto0 := map_poly_eq0 FtoE.
rewrite map_resultant ?pFto0 ?lead_coef_eq0 ?map_poly_eq0 ?poly_XaY_eq0 //.
rewrite map_comp_poly rmorphD /= map_polyC /= !map_polyX -!map_poly_comp /=.
by rewrite !(eq_map_poly (map_polyC _)) !map_poly_comp sub_annihilantP ?pFto0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype choice ssrnat seq",
"From mathcomp Require Import fintype tuple finfun bigop fingroup perm div",
"From mathcomp Require Import ssralg zmodp matrix mxalgebra",
"From mathcomp Require Import poly polydiv mxpoly ... | algebra/polyXY.v | map_sub_annihilantP | |
map_div_annihilantP(p q : {poly F}) (x y : E) :
p != 0 -> q != 0 -> y != 0 -> (p ^ FtoE).[x] = 0 -> (q ^ FtoE).[y] = 0 ->
(div_annihilant p q ^ FtoE).[x / y] = 0.
Proof.
move=> nz_p nz_q nz_y px0 qy0; have pFto0 := map_poly_eq0 FtoE.
rewrite map_resultant ?pFto0 ?lead_coef_eq0 ?map_poly_eq0 ?poly_XmY_eq0 //.
rewrite map_comp_poly rmorphM /= map_polyC /= !map_polyX -!map_poly_comp /=.
by rewrite !(eq_map_poly (map_polyC _)) !map_poly_comp div_annihilantP ?pFto0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype choice ssrnat seq",
"From mathcomp Require Import fintype tuple finfun bigop fingroup perm div",
"From mathcomp Require Import ssralg zmodp matrix mxalgebra",
"From mathcomp Require Import poly polydiv mxpoly ... | algebra/polyXY.v | map_div_annihilantP | |
root_annihilantx p (pEx := (p ^ pFtoE).[x%:P]) :
pEx != 0 -> algebraicOver FtoE x ->
exists2 r : {poly F}, r != 0 & forall y, root pEx y -> root (r ^ FtoE) y.
Proof.
move=> nz_px [q nz_q qx0].
have [/size1_polyC Dp | p_gt1] := leqP (size p) 1.
by rewrite {}/pEx Dp map_polyC hornerC map_poly_eq0 in nz_px *; exists p`_0.
have nz_p: p != 0 by rewrite -size_poly_gt0 ltnW.
have [m le_qm] := ubnP (size q); elim: m => // m IHm in q le_qm nz_q qx0 *.
have nz_q1: q^:P != 0 by rewrite map_poly_eq0.
have sz_q1: size q^:P = size q by rewrite size_map_polyC.
have q1_gt1: size q^:P > 1.
by rewrite sz_q1 -(size_map_poly FtoE) (root_size_gt1 _ qx0) ?map_poly_eq0.
have [uv _ Dr] := resultant_in_ideal p_gt1 q1_gt1; set r := resultant p _ in Dr.
have /eqP q1x0: (q^:P ^ pFtoE).[x%:P] == 0.
by rewrite -swapXY_polyC -swapXY_map horner_swapXY !map_polyC polyC_eq0.
have [|r_nz] := boolP (r == 0); last first.
exists r => // y pxy0; rewrite -[r ^ _](hornerC _ x%:P) -map_polyC Dr.
by rewrite rmorphD !rmorphM !hornerE q1x0 mulr0 addr0 rootM pxy0 orbT.
rewrite resultant_eq0 => /gtn_eqF/Bezout_coprimepPn[]// [q2 p1] /=.
rewrite size_poly_gt0 sz_q1 => /andP[/andP[nz_q2 ltq2] _] Dq.
pose n := (size (lead_coef q2)).-1; pose q3 := map_poly (coefp n) q2.
have nz_q3: q3 != 0 by rewrite map_poly_eq0_id0 ?lead_coef_eq0.
apply: (IHm q3); rewrite ?(leq_ltn_trans (size_poly _ _)) ?(leq_trans ltq2) //.
have /polyP/(_ n)/eqP: (q2 ^ pFtoE).[x%:P] = 0.
apply: (mulIf nz_px); rewrite -hornerM -rmorphM Dq rmorphM hornerM
... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype choice ssrnat seq",
"From mathcomp Require Import fintype tuple finfun bigop fingroup perm div",
"From mathcomp Require Import ssralg zmodp matrix mxalgebra",
"From mathcomp Require Import poly polydiv mxpoly ... | algebra/polyXY.v | root_annihilant | |
algebraic_root_polyXYx y :
(let pEx p := (p ^ map_poly FtoE).[x%:P] in
exists2 p, pEx p != 0 & root (pEx p) y) ->
algebraicOver FtoE x -> algebraicOver FtoE y.
Proof. by case=> p nz_px pxy0 /(root_annihilant nz_px)[r]; exists r; auto. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype choice ssrnat seq",
"From mathcomp Require Import fintype tuple finfun bigop fingroup perm div",
"From mathcomp Require Import ssralg zmodp matrix mxalgebra",
"From mathcomp Require Import poly polydiv mxpoly ... | algebra/polyXY.v | algebraic_root_polyXY | |
poly_of_size_pred:= fun p : {poly R} => size p <= n.
Arguments poly_of_size_pred _ /. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | poly_of_size_pred | |
poly_of_size:= [qualify a p | poly_of_size_pred p].
Fact npoly_subsemimod_closed : subsemimod_closed poly_of_size.
Proof.
split=> [|x q sq]; first split=> [|p q sp sq]; rewrite qualifE/= ?size_poly0//.
by rewrite (leq_trans (size_polyD _ _)) // geq_max [_ <= _]sp.
exact: leq_trans (size_scale_leq _ _) sq.
Qed.
HB.instance Definition _ :=
GRing.isSubSemiModClosed.Build R {poly R} poly_of_size_pred
npoly_subsemimod_closed. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | poly_of_size | |
npoly: predArgType := NPoly {
polyn :> {poly R};
_ : polyn \is a poly_of_size
}.
HB.instance Definition _ := [isSub for @polyn]. | Record | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly | |
npoly_is_a_poly_of_size(p : npoly) : val p \is a poly_of_size.
Proof. by case: p. Qed.
Hint Resolve npoly_is_a_poly_of_size : core. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly_is_a_poly_of_size | |
size_npoly(p : npoly) : size p <= n.
Proof. exact: npoly_is_a_poly_of_size. Qed.
Hint Resolve size_npoly : core.
HB.instance Definition _ := [Choice of npoly by <:].
HB.instance Definition _ := [SubChoice_isSubLSemiModule of npoly by <:]. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | size_npoly | |
npoly_rV: npoly -> 'rV[R]_n := poly_rV \o val. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly_rV | |
rVnpoly: 'rV[R]_n -> npoly := insubd (0 : npoly) \o rVpoly.
Arguments rVnpoly /.
Arguments npoly_rV /. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | rVnpoly | |
npoly_rV_K: cancel npoly_rV rVnpoly.
Proof.
move=> p /=; apply/val_inj.
by rewrite val_insubd [_ \is a _]size_poly ?poly_rV_K.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly_rV_K | |
rVnpolyK: cancel rVnpoly npoly_rV.
Proof. by move=> p /=; rewrite val_insubd [_ \is a _]size_poly rVpolyK. Qed.
Hint Resolve npoly_rV_K rVnpolyK : core. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | rVnpolyK | |
npoly_vect_axiom: SemiVector.axiom n npoly.
Proof. by exists npoly_rV; [exact: semilinearPZ | exists rVnpoly]. Qed.
HB.instance Definition _ := LSemiModule_hasFinDim.Build R npoly
npoly_vect_axiom. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly_vect_axiom | |
Definition_ (R : countNzSemiRingType) n :=
[Countable of {poly_n R} by <:].
HB.instance Definition _ (R : finNzSemiRingType) n : isFinite {poly_n R} :=
CanIsFinite (@npoly_rV_K R n). | HB.instance | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | Definition | |
Definition_ :=
GRing.isSemilinear.Build R {poly_n R} {poly R} _ (polyn (n:=n))
polyn_is_semilinear. | HB.instance | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | Definition | |
mk_npoly(E : nat -> R) : {poly_n R} :=
@NPoly R _ (\poly_(i < n) E i) (size_poly _ _).
Fact size_npoly0 : size (0 : {poly R}) <= n.
Proof. by rewrite size_poly0. Qed. | Canonical | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | mk_npoly | |
npoly0:= NPoly (size_npoly0).
Fact npolyp_key : unit. Proof. exact: tt. Qed. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly0 | |
npolyp: {poly R} -> {poly_n R} :=
locked_with npolyp_key (mk_npoly \o (nth 0)). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyp | |
npoly_of_seq:= npolyp \o Poly. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly_of_seq | |
npolyP(p q : {poly_n R}) : nth 0 p =1 nth 0 q <-> p = q.
Proof. by split => [/polyP/val_inj|->]. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyP | |
coef_npolyp(p : {poly R}) i : (npolyp p)`_i = if i < n then p`_i else 0.
Proof. by rewrite /npolyp unlock /= coef_poly. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | coef_npolyp | |
big_coef_npoly(p : {poly_n R}) i : n <= i -> p`_i = 0.
Proof.
by move=> i_big; rewrite nth_default // (leq_trans _ i_big) ?size_npoly.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | big_coef_npoly | |
npolypK(p : {poly R}) : size p <= n -> npolyp p = p :> {poly R}.
Proof.
move=> spn; apply/polyP=> i; rewrite coef_npolyp.
by have [i_big|i_small] // := ltnP; rewrite nth_default ?(leq_trans spn).
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolypK | |
coefn_sum(I : Type) (r : seq I) (P : pred I)
(F : I -> {poly_n R}) (k : nat) :
(\sum_(i <- r | P i) F i)`_k = \sum_(i <- r | P i) (F i)`_k.
Proof. by rewrite !raddf_sum //= coef_sum. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | coefn_sum | |
Definition_ :=
GRing.isOppClosed.Build {poly R} (@poly_of_size_pred R n) npoly_oppr_closed.
HB.instance Definition _ := [SubNmodule_isSubZmodule of npoly R n by <:]. | HB.instance | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | Definition | |
Definition_ (R : countNzRingType) n := GRing.Zmodule.on {poly_n R}.
HB.instance Definition _ (R : finNzRingType) n := GRing.Zmodule.on {poly_n R}. | HB.instance | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | Definition | |
npoly_enum: seq {poly_n R} :=
if n isn't n.+1 then [:: npoly0 _] else
pmap insub [seq \poly_(i < n.+1) c (inord i) | c : (R ^ n.+1)%type]. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly_enum | |
npoly_enum_uniq: uniq npoly_enum.
Proof.
rewrite /npoly_enum; case: n=> [|k] //.
rewrite pmap_sub_uniq // map_inj_uniq => [|f g eqfg]; rewrite ?enum_uniq //.
apply/ffunP => /= i; have /(congr1 (fun p : {poly _} => p`_i)) := eqfg.
by rewrite !coef_poly ltn_ord inord_val.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npoly_enum_uniq | |
mem_npoly_enump : p \in npoly_enum.
Proof.
rewrite /npoly_enum; case: n => [|k] // in p *.
case: p => [p sp] /=.
by rewrite in_cons -val_eqE /= -size_poly_leq0 [size _ <= _]sp.
rewrite mem_pmap_sub; apply/mapP.
eexists [ffun i : 'I__ => p`_i]; first by rewrite mem_enum.
apply/polyP => i; rewrite coef_poly.
have [i_small|i_big] := ltnP; first by rewrite ffunE /= inordK.
by rewrite nth_default // 1?(leq_trans _ i_big) // size_npoly.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | mem_npoly_enum | |
card_npoly: #|{poly_n R}| = (#|R| ^ n)%N.
Proof.
rewrite -(card_imset _ (can_inj (@npoly_rV_K _ _))) eq_cardT.
by rewrite -cardT /= card_mx mul1n.
by move=> v; apply/imsetP; exists (rVnpoly v); rewrite ?rVnpolyK //.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | card_npoly | |
irreducibleb:=
((1 < size p) &&
[forall q : {poly_((size p).-1) R}, (rdvdp q p)%R ==> (size q <= 1)])%N. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | irreducibleb | |
irreducibleP: reflect (irreducible_poly p) irreducibleb.
Proof.
rewrite /irreducibleb /irreducible_poly.
apply: (iffP idP) => [/andP[sp /'forall_implyP /= Fp]|[sp Fpoly]].
have sp_gt0 : size p > 0 by case: size sp.
have p_neq0 : p != 0 by rewrite -size_poly_eq0; case: size sp.
split => // q sq_neq1 dvd_qp; rewrite -dvdp_size_eqp // eqn_leq dvdp_leq //=.
apply: contraNT sq_neq1; rewrite -ltnNge => sq_lt_sp.
have q_small: (size q <= (size p).-1)%N by rewrite -ltnS prednK.
rewrite Pdiv.Idomain.dvdpE in dvd_qp.
have /= := Fp (NPoly q_small) dvd_qp.
rewrite leq_eqVlt ltnS => /orP[//|]; rewrite size_poly_leq0 => /eqP q_eq0.
by rewrite -Pdiv.Idomain.dvdpE q_eq0 dvd0p (negPf p_neq0) in dvd_qp.
have sp_gt0 : size p > 0 by case: size sp.
rewrite sp /=; apply/'forall_implyP => /= q.
rewrite -Pdiv.Idomain.dvdpE=> dvd_qp.
have [/eqP->//|/Fpoly/(_ dvd_qp)/eqp_size sq_eq_sp] := boolP (size q == 1%N).
by have := size_npoly q; rewrite sq_eq_sp -ltnS prednK ?ltnn.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | irreducibleP | |
dim_polyn: \dim (fullv : {vspace {poly_n K}}) = n.
Proof. by rewrite [LHS]mxrank_gen mxrank1. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | dim_polyn | |
npolyX: n.-tuple {poly_n K} := [tuple npolyp n 'X^i | i < n]. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyX | |
npolyXE(i : 'I_n) : 'nX^i = 'X^i :> {poly _}.
Proof. by rewrite tnth_map tnth_ord_tuple npolypK // size_polyXn. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyXE | |
nth_npolyX(i : 'I_n) : npolyX`_i = 'nX^i.
Proof. by rewrite -tnth_nth. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | nth_npolyX | |
npolyX_free: free npolyX.
Proof.
apply/freeP=> u /= sum_uX_eq0 i; have /npolyP /(_ i) := sum_uX_eq0.
rewrite (@big_morph _ _ _ 0%R +%R) // coef_sum coef0.
rewrite (bigD1 i) ?big1 /= ?addr0 ?coefZ ?(nth_map 0%N) ?size_iota //.
by rewrite nth_npolyX npolyXE coefXn eqxx mulr1.
move=> j; rewrite -val_eqE /= => neq_ji.
by rewrite nth_npolyX npolyXE coefZ coefXn eq_sym (negPf neq_ji) mulr0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyX_free | |
npolyX_full: basis_of fullv npolyX.
Proof.
by rewrite basisEfree npolyX_free subvf size_map size_enum_ord dim_polyn /=.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyX_full | |
npolyX_coords(p : {poly_n K}) i : coord npolyX i p = p`_i.
Proof.
rewrite [p in RHS](coord_basis npolyX_full) ?memvf // coefn_sum.
rewrite (bigD1 i) //= coefZ nth_npolyX npolyXE coefXn eqxx mulr1 big1 ?addr0//.
move=> j; rewrite -val_eqE => /= neq_ji.
by rewrite coefZ nth_npolyX npolyXE coefXn eq_sym (negPf neq_ji) mulr0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyX_coords | |
npolyX_gen(p : {poly K}) : (size p <= n)%N ->
p = \sum_(i < n) p`_i *: 'nX^i.
Proof.
move=> sp; rewrite -[p](@npolypK _ n) //.
rewrite [npolyp _ _ in LHS](coord_basis npolyX_full) ?memvf //.
rewrite (@big_morph _ _ _ 0%R +%R) // !raddf_sum.
by apply: eq_bigr=> i _; rewrite npolyX_coords //= nth_npolyX npolyXE.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | npolyX_gen | |
lagrange_def:= (fun i :'I_n =>
let k := i in let p := \prod_(j < n | j != k) ('X - (x j)%:P)
in (p.[x k]^-1)%:P * p).
Fact lagrange_key : unit. Proof. exact: tt. Qed. | Notation | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange_def | |
lagrange:= locked_with lagrange_key
[tuple npolyp n (lagrange_def i) | i < n]. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange | |
lagrange_:= (tnth lagrange).
Hypothesis n_gt0 : (0 < n)%N.
Hypothesis x_inj : injective x.
Let lagrange_def_sample (i j : 'I_n) : (lagrange_def i).[x j] = (i == j)%:R.
Proof.
clear n_gt0; rewrite hornerM hornerC; set p := (\prod_(_ < _ | _) _).
have [<-|neq_ij] /= := altP eqP.
rewrite mulVf // horner_prod; apply/prodf_neq0 => k neq_ki.
by rewrite hornerXsubC subr_eq0 inj_eq // eq_sym.
rewrite [X in _ * X]horner_prod (bigD1 j) 1?eq_sym //=.
by rewrite hornerXsubC subrr mul0r mulr0.
Qed.
Let size_lagrange_def i : size (lagrange_def i) = n.
Proof.
rewrite size_Cmul; last first.
suff : (lagrange_def i).[x i] != 0.
by rewrite hornerE mulf_eq0 => /norP [].
by rewrite lagrange_def_sample ?eqxx ?oner_eq0.
rewrite size_prod /=; last first.
by move=> j neq_ji; rewrite polyXsubC_eq0.
rewrite (eq_bigr (fun=> (2 * 1)%N)); last first.
by move=> j neq_ji; rewrite size_XsubC.
rewrite -big_distrr /= sum1_card cardC1 card_ord /=.
by case: (n) {i} n_gt0 => ?; rewrite mul2n -addnn -addSn addnK.
Qed. | Notation | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange_ | |
lagrangeEi : lagrange_ i = lagrange_def i :> {poly _}.
Proof.
rewrite [lagrange]unlock tnth_map.
by rewrite [val _]npolypK tnth_ord_tuple // size_lagrange_def.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrangeE | |
nth_lagrange(i : 'I_n) : lagrange`_i = lagrange_ i.
Proof. by rewrite -tnth_nth. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | nth_lagrange | |
size_lagrange_i : size (lagrange_ i) = n.
Proof. by rewrite lagrangeE size_lagrange_def. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | size_lagrange_ | |
size_lagrange: size lagrange = n.
Proof. by rewrite size_tuple. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | size_lagrange | |
lagrange_sample(i j : 'I_n) : (lagrange_ i).[x j] = (i == j)%:R.
Proof. by rewrite lagrangeE lagrange_def_sample. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange_sample | |
lagrange_free: free lagrange.
Proof.
apply/freeP=> lambda eq_l i.
have /(congr1 (fun p : {poly__ _} => p.[x i])) := eq_l.
rewrite (@big_morph _ _ _ 0%R +%R) // horner_sum horner0.
rewrite (bigD1 i) // big1 => [|j /= /negPf ji] /=;
by rewrite ?hornerE nth_lagrange lagrange_sample ?eqxx ?ji ?mulr1 ?mulr0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange_free | |
lagrange_full: basis_of fullv lagrange.
Proof.
by rewrite basisEfree lagrange_free subvf size_lagrange dim_polyn /=.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange_full | |
lagrange_coords(p : {poly_n K}) i : coord lagrange i p = p.[x i].
Proof.
rewrite [p in RHS](coord_basis lagrange_full) ?memvf //.
rewrite (@big_morph _ _ _ 0%R +%R) // horner_sum.
rewrite (bigD1 i) // big1 => [|j /= /negPf ji] /=;
by rewrite ?hornerE nth_lagrange lagrange_sample ?eqxx ?ji ?mulr1 ?mulr0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange_coords | |
lagrange_gen(p : {poly K}) : (size p <= n)%N ->
p = \sum_(i < n) p.[x i]%:P * lagrange_ i.
Proof.
move=> sp; rewrite -[p](@npolypK _ n) //.
rewrite [npolyp _ _ in LHS](coord_basis lagrange_full) ?memvf //.
rewrite (@big_morph _ _ _ 0%R +%R) //; apply: eq_bigr=> i _.
by rewrite lagrange_coords mul_polyC nth_lagrange.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | lagrange_gen | |
mk_monic:=
if (1 < size h)%N && (h \is monic) then h else 'X. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | mk_monic | |
qpoly:= {poly_(size mk_monic).-1 R}. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly | |
monic_mk_monic: (mk_monic h) \is monic.
Proof.
rewrite /mk_monic; case: leqP=> [_|/=]; first by apply: monicX.
by case E : (h \is monic) => [->//|] => _; apply: monicX.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | monic_mk_monic | |
size_mk_monic_gt1: (1 < size (mk_monic h))%N.
Proof.
by rewrite !fun_if size_polyX; case: leqP => //=; rewrite if_same.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | size_mk_monic_gt1 | |
size_mk_monic_gt0: (0 < size (mk_monic h))%N.
Proof. by rewrite (leq_trans _ size_mk_monic_gt1). Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | size_mk_monic_gt0 | |
mk_monic_neq0: mk_monic h != 0.
Proof. by rewrite -size_poly_gt0 size_mk_monic_gt0. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | mk_monic_neq0 | |
size_mk_monic(p : {poly %/ h}) : size p < size (mk_monic h).
Proof.
have: (p : {poly R}) \is a poly_of_size (size (mk_monic h)).-1 by case: p.
by rewrite qualifE/= -ltnS prednK // size_mk_monic_gt0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | size_mk_monic | |
poly_of_size_modp :
rmodp p (mk_monic h) \is a poly_of_size (size (mk_monic h)).-1.
Proof.
rewrite qualifE/= -ltnS prednK ?size_mk_monic_gt0 //.
by apply: ltn_rmodpN0; rewrite mk_monic_neq0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | poly_of_size_mod | |
in_qpolyp : {poly %/ h} := NPoly (poly_of_size_mod p). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpoly | |
in_qpoly_small(p : {poly R}) :
size p < size (mk_monic h) -> in_qpoly p = p :> {poly R}.
Proof. exact: rmodp_small. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpoly_small | |
in_qpoly0: in_qpoly 0 = 0.
Proof. by apply/val_eqP; rewrite /= rmod0p. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpoly0 | |
in_qpolyDp q : in_qpoly (p + q) = in_qpoly p + in_qpoly q.
Proof. by apply/val_eqP=> /=; rewrite rmodpD ?monic_mk_monic. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpolyD | |
in_qpolyZa p : in_qpoly (a *: p) = a *: in_qpoly p.
Proof. apply/val_eqP=> /=; rewrite rmodpZ ?monic_mk_monic //. Qed.
Fact in_qpoly_is_linear : linear in_qpoly.
Proof. by move=> k p q; rewrite in_qpolyD in_qpolyZ. Qed.
HB.instance Definition _ :=
GRing.isSemilinear.Build R {poly R} {poly_(size (mk_monic h)).-1 R} _ in_qpoly
(GRing.semilinear_linear in_qpoly_is_linear). | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpolyZ | |
qpolyC_proofk :
(k%:P : {poly R}) \is a poly_of_size (size (mk_monic h)).-1.
Proof.
rewrite qualifE/= -ltnS size_polyC prednK ?size_mk_monic_gt0 //.
by rewrite (leq_ltn_trans _ size_mk_monic_gt1) //; case: eqP.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyC_proof | |
qpolyCk : {poly %/ h} := NPoly (qpolyC_proof k). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyC | |
qpolyCEk : qpolyC k = k%:P :> {poly R}.
Proof. by []. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyCE | |
qpolyC0: qpolyC 0 = 0.
Proof. by apply/val_eqP/eqP. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyC0 | |
qpoly1:= qpolyC 1. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly1 | |
qpoly_mul(q1 q2 : {poly %/ h}) : {poly %/ h} :=
in_qpoly ((q1 : {poly R}) * q2). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_mul | |
qpoly_mul1z: left_id qpoly1 qpoly_mul.
Proof.
by move=> x; apply: val_inj; rewrite /= mul1r rmodp_small // size_mk_monic.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_mul1z | |
qpoly_mulz1: right_id qpoly1 qpoly_mul.
Proof.
by move=> x; apply: val_inj; rewrite /= mulr1 rmodp_small // size_mk_monic.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_mulz1 | |
qpoly_nontrivial: qpoly1 != 0.
Proof. by apply/eqP/val_eqP; rewrite /= oner_eq0. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_nontrivial | |
qpolyX:= in_qpoly 'X. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyX | |
qpolyXE: 2 < size h -> h \is monic -> 'qX = 'X :> {poly R}.
Proof.
move=> sh_gt2 h_mo.
by rewrite in_qpoly_small // size_polyX /mk_monic ifT // (ltn_trans _ sh_gt2).
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyXE | |
mk_monic_X(R : nzSemiRingType) : mk_monic 'X = 'X :> {poly R}.
Proof. by rewrite /mk_monic size_polyX monicX. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | mk_monic_X | |
mk_monic_Xn(R : nzSemiRingType) n :
mk_monic 'X^n = 'X^(n.-1.+1) :> {poly R}.
Proof. by case: n => [|n]; rewrite /mk_monic size_polyXn monicXn /= ?expr1. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | mk_monic_Xn | |
card_qpoly(R : finNzSemiRingType) (h : {poly R}):
#|{poly %/ h}| = #|R| ^ (size (mk_monic h)).-1.
Proof. by rewrite card_npoly. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | card_qpoly | |
card_monic_qpoly(R : finNzSemiRingType) (h : {poly R}):
1 < size h -> h \is monic -> #|{poly %/ h}| = #|R| ^ (size h).-1.
Proof. by move=> sh_gt1 hM; rewrite card_qpoly /mk_monic sh_gt1 hM. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | card_monic_qpoly | |
qpoly_mulC: commutative (@qpoly_mul A h).
Proof. by move=> p q; apply: val_inj; rewrite /= mulrC. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_mulC | |
qpoly_mulA: associative (@qpoly_mul A h).
Proof.
have rPM := monic_mk_monic h; move=> p q r; apply: val_inj.
by rewrite /= rmodp_mulml // rmodp_mulmr // mulrA.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_mulA | |
qpoly_mul_addr: right_distributive (@qpoly_mul A h) +%R.
Proof.
have rPM := monic_mk_monic h; move=> p q r; apply: val_inj.
by rewrite /= !(mulrDr, rmodp_mulmr, rmodpD).
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_mul_addr | |
qpoly_mul_addl: left_distributive (@qpoly_mul A h) +%R.
Proof. by move=> p q r; rewrite -!(qpoly_mulC r) qpoly_mul_addr. Qed.
HB.instance Definition _ := GRing.Zmodule_isComNzRing.Build {poly__ A} qpoly_mulA
qpoly_mulC (@qpoly_mul1z _ h) qpoly_mul_addl (@qpoly_nontrivial _ h).
HB.instance Definition _ := GRing.ComNzRing.on {poly %/ h}. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpoly_mul_addl | |
in_qpoly1: in_qpoly h 1 = 1.
Proof.
apply/val_eqP/eqP/in_qpoly_small.
by rewrite size_polyC oner_eq0 /= size_mk_monic_gt1.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpoly1 | |
in_qpolyMq1 q2 : in_qpoly h (q1 * q2) = in_qpoly h q1 * in_qpoly h q2.
Proof.
apply/val_eqP => /=.
by rewrite rmodp_mulml ?rmodp_mulmr // monic_mk_monic.
Qed.
Fact in_qpoly_monoid_morphism : monoid_morphism (in_qpoly h).
Proof. by split; [ apply: in_qpoly1 | apply: in_qpolyM]. Qed.
#[deprecated(since="mathcomp 2.5.0",
note="use `in_qpoly_is_monoid_morphism` instead")] | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpolyM | |
in_qpoly_is_multiplicative:=
(fun g => (g.2,g.1)) in_qpoly_monoid_morphism.
HB.instance Definition _ :=
GRing.isMonoidMorphism.Build {poly A} {poly %/ h} (in_qpoly h)
in_qpoly_monoid_morphism. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | in_qpoly_is_multiplicative | |
poly_of_qpoly_sumI (r : seq I) (P1 : pred I) (F : I -> {poly %/ h}) :
((\sum_(i <- r | P1 i) F i) =
\sum_(p <- r | P1 p) ((F p) : {poly A}) :> {poly A})%R.
Proof. exact: raddf_sum. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | poly_of_qpoly_sum | |
poly_of_qpolyD(p q : {poly %/ h}) :
p + q= (p : {poly A}) + q :> {poly A}.
Proof. by []. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | poly_of_qpolyD | |
qpolyC_natrp : (p%:R : {poly %/ h}) = p%:R :> {poly A}.
Proof. by elim: p => //= p IH; rewrite !mulrS poly_of_qpolyD IH. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyC_natr | |
pchar_qpoly: [pchar {poly %/ h}] =i [pchar A].
Proof.
move=> p; rewrite !inE; congr (_ && _).
apply/eqP/eqP=> [/(congr1 val) /=|pE]; last first.
by apply: val_inj => //=; rewrite qpolyC_natr /= -polyC_natr pE.
rewrite !qpolyC_natr -!polyC_natr => /(congr1 val) /=.
by rewrite polyseqC polyseq0; case: eqP.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | pchar_qpoly | |
poly_of_qpolyM(p q : {poly %/ h}) :
p * q = rmodp ((p : {poly A}) * q) (mk_monic h) :> {poly A}.
Proof. by []. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | poly_of_qpolyM | |
poly_of_qpolyX(p : {poly %/ h}) n :
p ^+ n = rmodp ((p : {poly A}) ^+ n) (mk_monic h) :> {poly A}.
Proof.
have HhQ := monic_mk_monic h.
elim: n => //= [|n IH].
rewrite rmodp_small // size_polyC ?(leq_ltn_trans _ (size_mk_monic_gt1 _)) //.
by case: eqP.
by rewrite exprS /= IH // rmodp_mulmr // -exprS.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | poly_of_qpolyX | |
qpolyCN(a : A) : qpolyC h (- a) = -(qpolyC h a).
Proof. by apply: val_inj; rewrite /= raddfN //= raddfN. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyCN | |
qpolyCD: {morph (qpolyC h) : a b / a + b >-> a + b}%R.
Proof. by move=> a b; apply/val_eqP/eqP=> /=; rewrite -!raddfD. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyCD | |
qpolyCM: {morph (qpolyC h) : a b / a * b >-> a * b}%R.
Proof.
move=> a b; apply/val_eqP/eqP=> /=; rewrite -polyCM rmodp_small //=.
have := qpolyC_proof h (a * b).
by rewrite qualifE/= -ltnS prednK // size_mk_monic_gt0.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import fintype tuple bigop binomial finset finfun ssralg",
"From mathcomp Require Import countalg finalg poly polydiv perm fingroup matrix",
"From mathcomp Require Im... | algebra/qpoly.v | qpolyCM |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.