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
similar_diagPpm n (P : 'M[F]_(m, n)) A : reflect (forall i j : 'I__, i != j :> nat -> conjmx P A i j = 0) (similar_diag P A). Proof. exact: @is_diag_mxP. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
similar_diagPp
similar_diagPn (P : 'M[F]_n) A : P \in unitmx -> reflect (forall i j : 'I__, i != j :> nat -> (P *m A *m invmx P) i j = 0) (similar_diag P A). Proof. by move=> Pu; rewrite -conjumx//; exact: is_diag_mxP. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
similar_diagP
similar_diagPex{m} {n} {P : 'M[F]_(m, n)} {A} : reflect (exists D, similar P A (diag_mx D)) (similar_diag P A). Proof. by apply: (iffP (diag_mxP _)) => -[D]/eqP; exists D. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
similar_diagPex
similar_diagLRn {P : 'M[F]_n} {A} : P \in unitmx -> reflect (exists D, A = conjmx (invmx P) (diag_mx D)) (similar_diag P A). Proof. by move=> Punit; apply: (iffP similar_diagPex) => -[D /(similarLR Punit)]; exists D. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
similar_diagLR
similar_diag_mxminpoly{n} {p f : 'M[F]_n.+1} (rs := undup [seq conjmx p f i i | i <- enum 'I_n.+1]) : p \in unitmx -> similar_diag p f -> mxminpoly f = \prod_(r <- rs) ('X - r%:P). Proof. rewrite /rs => pu /(similar_diagLR pu)[d {f rs}->]. rewrite mxminpoly_uconj ?unitmx_inv// mxminpoly_diag. by rewrite [in RHS](@eq_map _ _ _ (d 0))// => i; rewrite conjmxVK// mxE eqxx. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
similar_diag_mxminpoly
similar_diag_sum(F : fieldType) (m n : nat) (p_ : 'I_n -> nat) (V_ : forall i, 'M[F]_(p_ i, m)) (f : 'M[F]_m) : mxdirect (\sum_i <<V_ i>>) -> (forall i, stablemx (V_ i) f) -> (forall i, row_free (V_ i)) -> similar_diag (\mxcol_i V_ i) f = [forall i, similar_diag (V_ i) f]. Proof. move=> Vd Vf rfV; have aVf : stablemx (\mxcol_i V_ i) f. rewrite (eqmx_stable _ (eqmx_col _)) stablemx_sums//. by move=> i; rewrite (eqmx_stable _ (genmxE _)). apply/similar_diagPex/'forall_similar_diagPex => /= [[D /(similarPp aVf) +] i|/(_ _)/sigW Dof]. rewrite mxcol_mul -[D]submxrowK diag_mxrow mul_mxdiag_mxcol. move=> /eq_mxcolP/(_ i); set D0 := (submxrow _ _) => VMeq. by exists D0; apply/similarW. exists (\mxrow_i tag (Dof i)); apply/similarW. rewrite -row_leq_rank eqmx_col (mxdirectP Vd)/=. by under [X in (_ <= X)%N]eq_bigr do rewrite genmxE (eqP (rfV _)). rewrite mxcol_mul diag_mxrow mul_mxdiag_mxcol; apply: eq_mxcol => i. by case: Dof => /= k /(similarPp); rewrite Vf => /(_ isT) ->. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
similar_diag_sum
codiagonalizable1n (A : 'M[F]_n) : codiagonalizable [:: A] <-> diagonalizable A. Proof. by split=> -[P Punit PA]; exists P; move: PA; rewrite //= andbT. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
codiagonalizable1
codiagonalizablePfulln (As : seq 'M[F]_n) : codiagonalizable As <-> exists m, exists2 P : 'M_(m, n), row_full P & all [pred A | similar_diag P A] As. Proof. split => [[P Punit SPA]|[m [P Pfull SPA]]]. by exists n => //; exists P; rewrite ?row_full_unit. have Qfull := fullrowsub_unit Pfull. exists (rowsub (fullrankfun Pfull) P) => //; apply/allP => A AAs/=. have /allP /(_ _ AAs)/= /similar_diagPex[d /similarPp] := SPA. rewrite submx_full// => /(_ isT) PA_eq. apply/similar_diagPex; exists (colsub (fullrankfun Pfull) d). apply/similarP => //; apply/row_matrixP => i. rewrite !row_mul row_diag_mx -scalemxAl -rowE !row_rowsub !mxE. have /(congr1 (row (fullrankfun Pfull i))) := PA_eq. by rewrite !row_mul row_diag_mx -scalemxAl -rowE => ->. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
codiagonalizablePfull
codiagonalizable_onm n (V_ : 'I_n -> 'M[F]_m) (As : seq 'M[F]_m) : (\sum_i V_ i :=: 1%:M)%MS -> mxdirect (\sum_i V_ i) -> (forall i, all (fun A => stablemx (V_ i) A) As) -> (forall i, codiagonalizable (map (restrictmx (V_ i)) As)) -> codiagonalizable As. Proof. move=> V1 Vdirect /(_ _)/allP AV /(_ _) /sig2W/= Pof. pose P_ i := tag (Pof i). have P_unit i : P_ i \in unitmx by rewrite /P_; case: {+}Pof. have P_diag i A : A \in As -> similar_diag (P_ i *m row_base (V_ i)) A. move=> AAs; rewrite /P_; case: {+}Pof => /= P Punit. rewrite all_map => /allP/(_ A AAs); rewrite /similar_to/=. by rewrite conjuMmx ?row_base_free ?stablemx_row_base ?AV. pose P := \mxcol_i (P_ i *m row_base (V_ i)). have P_full i : row_full (P_ i) by rewrite row_full_unit. have PrV i : (P_ i *m row_base (V_ i) :=: V_ i)%MS. exact/(eqmx_trans _ (eq_row_base _))/eqmxMfull. apply/codiagonalizablePfull; eexists _; last exists P; rewrite /=. - rewrite -sub1mx eqmx_col. by under eq_bigr do rewrite (eq_genmx (PrV _)); rewrite -genmx_sums genmxE V1. apply/allP => A AAs /=; rewrite similar_diag_sum. - by apply/forallP => i; apply: P_diag. - rewrite mxdirectE/=. under eq_bigr do rewrite (eq_genmx (PrV _)); rewrite -genmx_sums genmxE V1. by under eq_bigr do rewrite genmxE PrV; rewrite -(mxdirectP Vdirect)//= V1. - by move=> i; rewrite (eqmx_stable _ (PrV _)) ?AV. - by move=> i; rewrite /row_free eqmxMfull ?eq_row_base ?row_full_unit. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
codiagonalizable_on
diagonalizable_diag{n} (d : 'rV[F]_n) : diagonalizable (diag_mx d). Proof. by exists 1%:M; rewrite ?unitmx1// /similar_to conj1mx diag_mx_is_diag. Qed. Hint Resolve diagonalizable_diag : core.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
diagonalizable_diag
diagonalizable_scalar{n} (a : F) : diagonalizable (a%:M : 'M_n). Proof. by rewrite -diag_const_mx. Qed. Hint Resolve diagonalizable_scalar : core.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
diagonalizable_scalar
diagonalizable0{n} : diagonalizable (0 : 'M[F]_n). Proof. by rewrite (_ : 0 = 0%:M)//; apply/matrixP => i j; rewrite !mxE// mul0rn. Qed. Hint Resolve diagonalizable0 : core.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
diagonalizable0
diagonalizablePeigen{n} {f : 'M[F]_n} : diagonalizable f <-> exists2 rs, uniq rs & (\sum_(r <- rs) eigenspace f r :=: 1%:M)%MS. Proof. split=> [df|[rs urs rsP]]. suff [rs rsP] : exists rs, (\sum_(r <- rs) eigenspace f r :=: 1%:M)%MS. exists (undup rs); rewrite ?undup_uniq//; apply: eqmx_trans rsP. elim: rs => //= r rs IHrs; rewrite big_cons. case: ifPn => in_rs; rewrite ?big_cons; last exact: adds_eqmx. apply/(eqmx_trans IHrs)/eqmx_sym/addsmx_idPr. have rrs : (index r rs < size rs)%N by rewrite index_mem. rewrite (big_nth 0) big_mkord (sumsmx_sup (Ordinal rrs)) ?nth_index//. move: df => [P Punit /(similar_diagLR Punit)[d ->]]. exists [seq d 0 i | i <- enum 'I_n]; rewrite big_image/=. apply: (@eqmx_trans _ _ _ _ _ _ P); apply/eqmxP; rewrite ?sub1mx ?submx1 ?row_full_unit//. rewrite submx_full ?row_full_unit//=. apply/row_subP => i; rewrite rowE (sumsmx_sup i)//. apply/eigenspaceP; rewrite conjVmx// !mulmxA mulmxK//. by rewrite -rowE row_diag_mx scalemxAl. have mxdirect_eigenspaces : mxdirect (\sum_(i < size rs) eigenspace f rs`_i). apply: mxdirect_sum_eigenspace => i j _ _ rsij; apply/val_inj. by apply: uniqP rsij; rewrite ?inE. rewrite (big_nth 0) big_mkord in rsP; apply/codiagonalizable1. apply/(codiagonalizable_on _ mxdirect_eigenspaces) => // i/=. case: n => [|n] in f {mxdirect_eigenspaces} rsP *. by rewrite thinmx0 sub0mx. by rewrite comm_mx_stable_eigenspace. apply/codiagonalizable1. by rewrite (@conjmx_eigenvalue _ _ _ rs`_i) ?eq_ ...
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
diagonalizablePeigen
diagonalizablePn' (n := n'.+1) (f : 'M[F]_n) : diagonalizable f <-> exists2 rs, uniq rs & mxminpoly f %| \prod_(x <- rs) ('X - x%:P). Proof. split=> [[P Punit /similar_diagPex[d /(similarLR Punit)->]]|]. rewrite mxminpoly_uconj ?unitmx_inv// mxminpoly_diag. by eexists; [|by []]; rewrite undup_uniq. move=> [rs rsU rsP]; apply: diagonalizablePeigen.2. exists rs => //. rewrite (big_nth 0) big_mkord (eq_bigr _ (fun _ _ => eigenspace_poly _ _)). apply: (eqmx_trans (eqmx_sym (kermxpoly_prod _ _)) (kermxpoly_min _)). by move=> i j _ _; rewrite coprimep_XsubC root_XsubC nth_uniq. by rewrite (big_nth 0) big_mkord in rsP. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
diagonalizableP
diagonalizable_conj_diagm n (V : 'M[F]_(m, n)) (d : 'rV[F]_n) : stablemx V (diag_mx d) -> row_free V -> diagonalizable (conjmx V (diag_mx d)). Proof. (move: m n => [|m] [|n] in V d *; rewrite ?thinmx0; [by []|by []| |]) => Vd rdV. - by rewrite /row_free mxrank0 in rdV. - apply/diagonalizableP; pose u := undup [seq d 0 i | i <- enum 'I_n.+1]. exists u; first by rewrite undup_uniq. by rewrite (dvdp_trans (mxminpoly_conj rdV _))// mxminpoly_diag. Qed.
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
diagonalizable_conj_diag
codiagonalizablePn (fs : seq 'M[F]_n) : {in fs &, forall f g, comm_mx f g} /\ (forall f, f \in fs -> diagonalizable f) <-> codiagonalizable fs. Proof. split => [cdfs|[P Punit /allP/= fsD]]/=; last first. split; last by exists P; rewrite // fsD. move=> f g ffs gfs; move=> /(_ _ _)/similar_diagPex/sigW in fsD. have [[df /similarLR->//] [dg /similarLR->//]] := (fsD _ ffs, fsD _ gfs). by rewrite /comm_mx -!conjmxM 1?diag_mxC// inE stablemx_unit ?unitmx_inv. move: cdfs => [/(rwP (all_comm_mxP _)).1 cdfs1 cdfs2]. have [k] := ubnP (size fs); elim: k => [|k IHk]//= in n fs cdfs1 cdfs2 *. case: fs cdfs1 cdfs2 => [|f fs]//=; first by exists 1%:M; rewrite ?unitmx1. rewrite ltnS all_comm_mx_cons => /andP[/allP/(_ _ _)/eqP ffsC fsC dffs] fsk. have /diagonalizablePeigen [rs urs rs1] := dffs _ (mem_head _ _). rewrite (big_nth 0) big_mkord in rs1. have efg (i : 'I_(size rs)) g : g \in f :: fs -> stablemx (eigenspace f rs`_i) g. case: n => [|n'] in g f fs ffsC fsC {dffs rs1 fsk} * => g_ffs. by rewrite thinmx0 sub0mx. rewrite comm_mx_stable_eigenspace//. by move: g_ffs; rewrite !inE => /predU1P [->//|/ffsC]. apply/(@codiagonalizable_on _ _ _ (_ :: _) rs1) => [|i|i /=]. - apply: mxdirect_sum_eigenspace => i j _ _ rsij; apply/val_inj. by apply: uniqP rsij; rewrite ?inE. - by apply/allP => g g_ffs; rewrite efg. rewrite (@conjmx_eigenvalue _ _ _ rs`_i) ?eq_row_base ?row_base_free//. set gs := map _ _; suff [P Punit /= Pgs] : codiagonalizable gs. exists P; rewrite /= ?Pgs ?andbT// /simi ...
Lemma
algebra
[ "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq div", "From mathcomp Require Import choice fintype finfun bigop fingroup perm order", "From mathcomp Require Import ssralg zmodp matrix mxalgebra poly polydiv mxpoly" ]
algebra/mxred.v
codiagonalizableP
polynomial:= Polynomial {polyseq :> seq R; _ : last 1 polyseq != 0}. HB.instance Definition _ := [isSub for polyseq]. HB.instance Definition _ := [Choice of polynomial by <:].
Record
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polynomial
poly_inj: injective polyseq. Proof. exact: val_inj. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
poly_inj
coefpi (p : polynomial) := p`_i.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefp
lead_coefp := p`_(size p).-1.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coef
lead_coefEp : lead_coef p = p`_(size p).-1. Proof. by []. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coefE
poly_nil:= @Polynomial R [::] (oner_neq0 R).
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
poly_nil
polyCc : {poly R} := insubd poly_nil [:: c]. Local Notation "c %:P" := (polyC c).
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyC
polyseqCc : c%:P = nseq (c != 0) c :> seq R. Proof. by rewrite val_insubd /=; case: (c == 0). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyseqC
size_polyCc : size c%:P = (c != 0). Proof. by rewrite polyseqC size_nseq. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_polyC
coefCc i : c%:P`_i = if i == 0 then c else 0. Proof. by rewrite polyseqC; case: i => [|[]]; case: eqP. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefC
polyCK: cancel polyC (coefp 0). Proof. by move=> c; rewrite [coefp 0 _]coefC. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyCK
polyC_inj: injective polyC. Proof. exact: can_inj polyCK. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyC_inj
lead_coefCc : lead_coef c%:P = c. Proof. by rewrite /lead_coef polyseqC; case: eqP. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coefC
polyPp q : nth 0 p =1 nth 0 q <-> p = q. Proof. split=> [eq_pq | -> //]; apply: poly_inj. without loss lt_pq: p q eq_pq / size p < size q. move=> IH; case: (ltngtP (size p) (size q)); try by move/IH->. by move/(@eq_from_nth _ 0); apply. case: q => q nz_q /= in lt_pq eq_pq *; case/eqP: nz_q. by rewrite (last_nth 0) -(subnKC lt_pq) /= -eq_pq nth_default ?leq_addr. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyP
size1_polyCp : size p <= 1 -> p = (p`_0)%:P. Proof. move=> le_p_1; apply/polyP=> i; rewrite coefC. by case: i => // i; rewrite nth_default // (leq_trans le_p_1). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size1_polyC
cons_polyc p : {poly R} := if p is Polynomial ((_ :: _) as s) ns then @Polynomial R (c :: s) ns else c%:P.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
cons_poly
polyseq_consc p : cons_poly c p = (if ~~ nilp p then c :: p else c%:P) :> seq R. Proof. by case: p => [[]]. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyseq_cons
size_cons_polyc p : size (cons_poly c p) = (if nilp p && (c == 0) then 0 else (size p).+1). Proof. by case: p => [[|c' s] _] //=; rewrite size_polyC; case: eqP. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_cons_poly
coef_consc p i : (cons_poly c p)`_i = if i == 0 then c else p`_i.-1. Proof. by case: p i => [[|c' s] _] [] //=; rewrite polyseqC; case: eqP => //= _ []. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef_cons
Poly:= foldr cons_poly 0%:P.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
Poly
PolyKc s : last c s != 0 -> Poly s = s :> seq R. Proof. case: s => {c}/= [_ |c s]; first by rewrite polyseqC eqxx. elim: s c => /= [|a s IHs] c nz_c; rewrite polyseq_cons ?{}IHs //. by rewrite !polyseqC !eqxx nz_c. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
PolyK
polyseqKp : Poly p = p. Proof. by apply: poly_inj; apply: PolyK (valP p). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyseqK
size_Polys : size (Poly s) <= size s. Proof. elim: s => [|c s IHs] /=; first by rewrite polyseqC eqxx. by rewrite size_cons_poly; case: ifP. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_Poly
coef_Polys i : (Poly s)`_i = s`_i. Proof. by elim: s i => [|c s IHs] /= [|i]; rewrite !(coefC, eqxx, coef_cons) /=. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef_Poly
poly_expanded_defn E := Poly (mkseq E n). Fact poly_key : unit. Proof. by []. Qed.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
poly_expanded_def
poly:= locked_with poly_key poly_expanded_def.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
poly
poly_unlockable:= [unlockable fun poly]. Local Notation "\poly_ ( i < n ) E" := (poly n (fun i : nat => E)).
Canonical
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
poly_unlockable
polyseq_polyn E : E n.-1 != 0 -> \poly_(i < n) E i = mkseq [eta E] n :> seq R. Proof. rewrite unlock; case: n => [|n] nzEn; first by rewrite polyseqC eqxx. by rewrite (@PolyK 0) // -nth_last nth_mkseq size_mkseq. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyseq_poly
size_polyn E : size (\poly_(i < n) E i) <= n. Proof. by rewrite unlock (leq_trans (size_Poly _)) ?size_mkseq. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly
size_poly_eqn E : E n.-1 != 0 -> size (\poly_(i < n) E i) = n. Proof. by move/polyseq_poly->; apply: size_mkseq. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly_eq
coef_polyn E k : (\poly_(i < n) E i)`_k = (if k < n then E k else 0). Proof. rewrite unlock coef_Poly. have [lt_kn | le_nk] := ltnP k n; first by rewrite nth_mkseq. by rewrite nth_default // size_mkseq. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef_poly
lead_coef_polyn E : n > 0 -> E n.-1 != 0 -> lead_coef (\poly_(i < n) E i) = E n.-1. Proof. by case: n => // n _ nzE; rewrite /lead_coef size_poly_eq // coef_poly leqnn. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coef_poly
coefKp : \poly_(i < size p) p`_i = p. Proof. by apply/polyP=> i; rewrite coef_poly; case: ltnP => // /(nth_default 0)->. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefK
add_poly_defp q := \poly_(i < maxn (size p) (size q)) (p`_i + q`_i). Fact add_poly_key : unit. Proof. by []. Qed.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
add_poly_def
add_poly:= locked_with add_poly_key add_poly_def.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
add_poly
add_poly_unlockable:= [unlockable fun add_poly]. Fact coef_add_poly p q i : (add_poly p q)`_i = p`_i + q`_i. Proof. rewrite unlock coef_poly; case: leqP => //. by rewrite geq_max => /andP[le_p_i le_q_i]; rewrite !nth_default ?add0r. Qed. Fact add_polyA : associative add_poly. Proof. by move=> p q r; apply/polyP=> i; rewrite !coef_add_poly addrA. Qed. Fact add_polyC : commutative add_poly. Proof. by move=> p q; apply/polyP=> i; rewrite !coef_add_poly addrC. Qed. Fact add_poly0 : left_id 0%:P add_poly. Proof. by move=> p; apply/polyP=> i; rewrite coef_add_poly coefC if_same add0r. Qed. HB.instance Definition _ := GRing.isNmodule.Build (polynomial R) add_polyA add_polyC add_poly0.
Canonical
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
add_poly_unlockable
polyC0: 0%:P = 0 :> {poly R}. Proof. by []. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyC0
polyseq0: (0 : {poly R}) = [::] :> seq R. Proof. by rewrite polyseqC eqxx. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyseq0
size_poly0: size (0 : {poly R}) = 0%N. Proof. by rewrite polyseq0. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly0
coef0i : (0 : {poly R})`_i = 0. Proof. by rewrite coefC if_same. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef0
lead_coef0: lead_coef 0 = 0 :> R. Proof. exact: lead_coefC. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coef0
size_poly_eq0p : (size p == 0) = (p == 0). Proof. by rewrite size_eq0 -polyseq0. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly_eq0
size_poly_leq0p : (size p <= 0) = (p == 0). Proof. by rewrite leqn0 size_poly_eq0. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly_leq0
size_poly_leq0Pp : reflect (p = 0) (size p <= 0). Proof. by apply: (iffP idP); rewrite size_poly_leq0; move/eqP. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly_leq0P
size_poly_gt0p : (0 < size p) = (p != 0). Proof. by rewrite lt0n size_poly_eq0. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly_gt0
gt_size_poly_neq0p n : size p > n -> p != 0. Proof. by move=> /(leq_ltn_trans _) h; rewrite -size_poly_eq0 lt0n_neq0 ?h. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
gt_size_poly_neq0
nil_polyp : nilp p = (p == 0). Proof. exact: size_poly_eq0. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
nil_poly
poly0Vposp : {p = 0} + {size p > 0}. Proof. by rewrite lt0n size_poly_eq0; case: eqVneq; [left | right]. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
poly0Vpos
polySpredp : p != 0 -> size p = (size p).-1.+1. Proof. by rewrite -size_poly_eq0 -lt0n => /prednK. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polySpred
lead_coef_eq0p : (lead_coef p == 0) = (p == 0). Proof. rewrite -nil_poly /lead_coef nth_last. by case: p => [[|x s] /= /negbTE // _]; rewrite eqxx. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coef_eq0
polyC_eq0c : (c%:P == 0) = (c == 0). Proof. by rewrite -nil_poly polyseqC; case: (c == 0). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyC_eq0
size_poly1Pp : reflect (exists2 c, c != 0 & p = c%:P) (size p == 1). Proof. apply: (iffP eqP) => [pC | [c nz_c ->]]; last by rewrite size_polyC nz_c. have def_p: p = (p`_0)%:P by rewrite -size1_polyC ?pC. by exists p`_0; rewrite // -polyC_eq0 -def_p -size_poly_eq0 pC. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly1P
size_polyC_leq1c : (size c%:P <= 1)%N. Proof. by rewrite size_polyC; case: (c == 0). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_polyC_leq1
leq_sizePp i : reflect (forall j, i <= j -> p`_j = 0) (size p <= i). Proof. apply: (iffP idP) => [hp j hij| hp]. by apply: nth_default; apply: leq_trans hij. case: (eqVneq p) (lead_coef_eq0 p) => [->|p0]; first by rewrite size_poly0. rewrite leqNgt; apply/contraFN => hs. by apply/eqP/hp; rewrite -ltnS (ltn_predK hs). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
leq_sizeP
coefDp q i : (p + q)`_i = p`_i + q`_i. Proof. exact: coef_add_poly. Qed. HB.instance Definition _ i := GRing.isNmodMorphism.Build {poly R} R (coefp i) (coef0 i, fun p q => coefD p q i).
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefD
coefMnp n i : (p *+ n)`_i = p`_i *+ n. Proof. exact: (raddfMn (coefp i)). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefMn
coef_sumI (r : seq I) (P : pred I) (F : I -> {poly R}) k : (\sum_(i <- r | P i) F i)`_k = \sum_(i <- r | P i) (F i)`_k. Proof. exact: (raddf_sum (coefp k)). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef_sum
polyCD: {morph polyC : a b / a + b}. Proof. by move=> a b; apply/polyP=> [[|i]]; rewrite coefD !coefC ?addr0. Qed. HB.instance Definition _ := GRing.isNmodMorphism.Build R {poly R} polyC (polyC0, polyCD).
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyCD
polyCMnn : {morph polyC : c / c *+ n}. Proof. exact: raddfMn. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyCMn
size_polyDp q : size (p + q) <= maxn (size p) (size q). Proof. by rewrite -[+%R]/add_poly unlock; exact: size_poly. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_polyD
size_polyDlp q : size p > size q -> size (p + q) = size p. Proof. move=> ltqp; rewrite -[+%R]/add_poly unlock size_poly_eq (maxn_idPl (ltnW _))//. by rewrite addrC nth_default ?simp ?nth_last //; case: p ltqp => [[]]. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_polyDl
size_sumI (r : seq I) (P : pred I) (F : I -> {poly R}) : size (\sum_(i <- r | P i) F i) <= \max_(i <- r | P i) size (F i). Proof. elim/big_rec2: _ => [|i p q _ IHp]; first by rewrite size_poly0. by rewrite -(maxn_idPr IHp) maxnA leq_max size_polyD. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_sum
lead_coefDlp q : size p > size q -> lead_coef (p + q) = lead_coef p. Proof. move=> ltqp; rewrite /lead_coef coefD size_polyDl //. by rewrite addrC nth_default ?simp // -ltnS (ltn_predK ltqp). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coefDl
lead_coefDrp q : size q > size p -> lead_coef (p + q) = lead_coef q. Proof. by move/lead_coefDl<-; rewrite addrC. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coefDr
mul_poly_defp q := \poly_(i < (size p + size q).-1) (\sum_(j < i.+1) p`_j * q`_(i - j)). Fact mul_poly_key : unit. Proof. by []. Qed.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
mul_poly_def
mul_poly:= locked_with mul_poly_key mul_poly_def.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
mul_poly
mul_poly_unlockable:= [unlockable fun mul_poly]. Fact coef_mul_poly p q i : (mul_poly p q)`_i = \sum_(j < i.+1) p`_j * q`_(i - j). Proof. rewrite unlock coef_poly ltn_predRL; case: leqP => // le_pq_i1. rewrite big1 // => j _; have [lq_p_j|lt_j_p] := leqP (size p) j. by rewrite nth_default ?mul0r. rewrite [q`__]nth_default ?mulr0 // leq_subRL -ltnS //. by rewrite (leq_trans _ le_pq_i1) // ltn_add2r. Qed. Fact coef_mul_poly_rev p q i : (mul_poly p q)`_i = \sum_(j < i.+1) p`_(i - j) * q`_j. Proof. rewrite coef_mul_poly (reindex_inj rev_ord_inj) /=. by apply: eq_bigr => j _; rewrite (sub_ordK j). Qed. Fact mul_polyA : associative mul_poly. Proof. move=> p q r; apply/polyP=> i; rewrite coef_mul_poly coef_mul_poly_rev. pose coef3 j k := p`_j * (q`_(i - j - k) * r`_k). transitivity (\sum_(j < i.+1) \sum_(k < i.+1 | k <= i - j) coef3 j k). apply: eq_bigr => /= j _; rewrite coef_mul_poly_rev big_distrr /=. by rewrite (big_ord_narrow_leq (leq_subr _ _)). rewrite (exchange_big_dep predT) //=; apply: eq_bigr => k _. transitivity (\sum_(j < i.+1 | j <= i - k) coef3 j k). apply: eq_bigl => j; rewrite -ltnS -(ltnS j) -!subSn ?leq_ord //. by rewrite -subn_gt0 -(subn_gt0 j) -!subnDA addnC. rewrite (big_ord_narrow_leq (leq_subr _ _)) coef_mul_poly big_distrl /=. by apply: eq_bigr => j _; rewrite /coef3 -!subnDA addnC mulrA. Qed. Fact mul_1poly : left_id 1%:P mul_poly. Proof. move=> p; apply/polyP => i; rewrite coef_mul_poly big_ord_recl subn0. by rewrite big1 => [|j _]; rewrite coefC !simp. Qed.
Canonical
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
mul_poly_unlockable
polyC1: 1%:P = 1 :> {poly R}. Proof. by []. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyC1
polyseq1: (1 : {poly R}) = [:: 1] :> seq R. Proof. by rewrite polyseqC oner_neq0. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
polyseq1
size_poly1: size (1 : {poly R}) = 1. Proof. by rewrite polyseq1. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly1
coef1i : (1 : {poly R})`_i = (i == 0)%:R. Proof. by case: i => [|i]; rewrite polyseq1 /= ?nth_nil. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef1
lead_coef1: lead_coef 1 = 1 :> R. Proof. exact: lead_coefC. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coef1
coefMp q i : (p * q)`_i = \sum_(j < i.+1) p`_j * q`_(i - j). Proof. exact: coef_mul_poly. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefM
coefMrp q i : (p * q)`_i = \sum_(j < i.+1) p`_(i - j) * q`_j. Proof. exact: coef_mul_poly_rev. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefMr
coef0Mp q : (p * q)`_0 = p`_0 * q`_0. Proof. by rewrite coefM big_ord1. Qed. Fact coefp0_is_monoid_morphism : monoid_morphism (coefp 0). Proof. by split; [exact: polyCK | exact: coef0M]. Qed. #[deprecated(since="mathcomp 2.5.0", note="use `coefp0_is_monoid_morphism` instead")]
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef0M
coefp0_multiplicative:= (fun g => (g.2, g.1)) coefp0_is_monoid_morphism. HB.instance Definition _ := GRing.isMonoidMorphism.Build {poly R} R (coefp 0) coefp0_is_monoid_morphism.
Definition
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefp0_multiplicative
coef0_prodI rI (F : I -> {poly R}) P : (\prod_(i <- rI| P i) F i)`_0 = \prod_(i <- rI | P i) (F i)`_0. Proof. exact: (rmorph_prod (coefp 0)). Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coef0_prod
size_polyMleqp q : size (p * q) <= (size p + size q).-1. Proof. by rewrite -[*%R]/mul_poly unlock size_poly. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_polyMleq
mul_lead_coefp q : lead_coef p * lead_coef q = (p * q)`_(size p + size q).-2. Proof. pose dp := (size p).-1; pose dq := (size q).-1. have [-> | nz_p] := eqVneq p 0; first by rewrite lead_coef0 !mul0r coef0. have [-> | nz_q] := eqVneq q 0; first by rewrite lead_coef0 !mulr0 coef0. have ->: (size p + size q).-2 = (dp + dq)%N. by do 2!rewrite polySpred // addSn addnC. have lt_p_pq: dp < (dp + dq).+1 by rewrite ltnS leq_addr. rewrite coefM (bigD1 (Ordinal lt_p_pq)) ?big1 ?simp ?addKn //= => i. rewrite -val_eqE neq_ltn /= => /orP[lt_i_p | gt_i_p]; last first. by rewrite nth_default ?mul0r //; rewrite -polySpred in gt_i_p. rewrite [q`__]nth_default ?mulr0 //= -subSS -{1}addnS -polySpred //. by rewrite addnC -addnBA ?leq_addr. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
mul_lead_coef
size_proper_mulp q : lead_coef p * lead_coef q != 0 -> size (p * q) = (size p + size q).-1. Proof. apply: contraNeq; rewrite mul_lead_coef eqn_leq size_polyMleq -ltnNge => lt_pq. by rewrite nth_default // -subn1 -(leq_add2l 1) -leq_subLR leq_sub2r. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_proper_mul
lead_coef_proper_mulp q : let c := lead_coef p * lead_coef q in c != 0 -> lead_coef (p * q) = c. Proof. by move=> /= nz_c; rewrite mul_lead_coef -size_proper_mul. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
lead_coef_proper_mul
size_poly_prod_leq(I : finType) (P : pred I) (F : I -> {poly R}) : size (\prod_(i | P i) F i) <= (\sum_(i | P i) size (F i)).+1 - #|P|. Proof. rewrite -sum1_card. elim/big_rec3: _ => [|i n m p _ IHp]; first by rewrite size_poly1. have [-> | nz_p] := eqVneq p 0; first by rewrite mulr0 size_poly0. rewrite (leq_trans (size_polyMleq _ _)) // subnS -!subn1 leq_sub2r //. rewrite -addnS -addnBA ?leq_add2l // ltnW // -subn_gt0 (leq_trans _ IHp) //. by rewrite polySpred. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
size_poly_prod_leq
coefCMc p i : (c%:P * p)`_i = c * p`_i. Proof. by rewrite coefM big_ord_recl subn0 big1 => [|j _]; rewrite coefC !simp. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefCM
coefMCc p i : (p * c%:P)`_i = p`_i * c. Proof. by rewrite coefMr big_ord_recl subn0 big1 => [|j _]; rewrite coefC !simp. Qed.
Lemma
algebra
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice", "From mathcomp Require Import fintype bigop finset tuple div ssralg", "From mathcomp Require Import countalg binomial" ]
algebra/poly.v
coefMC