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 |
|---|---|---|---|---|---|---|
qpolyC_is_zmod_morphism: zmod_morphism (qpolyC h).
Proof. by move=> x y; rewrite qpolyCD qpolyCN. Qed.
#[deprecated(since="mathcomp 2.5.0",
note="use `qpolyC_is_zmod_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 | qpolyC_is_zmod_morphism | |
qpolyC_is_additive:= qpolyC_is_zmod_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 | qpolyC_is_additive | |
qpolyC_is_monoid_morphism: monoid_morphism (qpolyC h).
Proof. by split=> // x y; rewrite qpolyCM. Qed.
#[deprecated(since="mathcomp 2.5.0",
note="use `qpolyC_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 | qpolyC_is_monoid_morphism | |
qpolyC_is_multiplicative:=
(fun g => (g.2,g.1)) qpolyC_is_monoid_morphism.
HB.instance Definition _ := GRing.isZmodMorphism.Build A {poly %/ h} (qpolyC h)
qpolyC_is_zmod_morphism.
HB.instance Definition _ :=
GRing.isMonoidMorphism.Build A {poly %/ h} (qpolyC h)
qpolyC_is_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 | qpolyC_is_multiplicative | |
qpoly_scalek (p : {poly %/ h}) : {poly %/ h} := (k *: p)%R.
Fact qpoly_scaleA a b p :
qpoly_scale a (qpoly_scale b p) = qpoly_scale (a * b) p.
Proof. by apply/val_eqP; rewrite /= scalerA. Qed.
Fact qpoly_scale1l : left_id 1%R qpoly_scale.
Proof. by move=> p; apply/val_eqP; rewrite /= scale1r. Qed.
Fact qpoly_scaleDr... | 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_scale | |
poly_of_qpolyZ(p : {poly %/ h}) a :
a *: p = a *: (p : {poly A}) :> {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_qpolyZ | |
char_qpoly:= (pchar_qpoly) (only parsing). | 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 | char_qpoly | |
qpoly_inv(p : {poly %/ h}) :=
if coprimep hQ p then let v : {poly %/ h} := in_qpoly h (egcdp hQ p).2 in
((lead_coef (v * p)) ^-1 *: v) else 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 | qpoly_inv | |
qpoly_mulVz(p : {poly %/ h}) : coprimep hQ p -> (qpoly_inv p * p = 1)%R.
Proof.
have hQM := monic_mk_monic h.
move=> hCp; apply: val_inj; rewrite /qpoly_inv /in_qpoly hCp /=.
have p_neq0 : p != 0%R.
apply/eqP=> pZ; move: hCp; rewrite pZ.
rewrite coprimep0 -size_poly_eq1.
by case: size (size_mk_monic_gt1 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_mulVz | |
qpoly_mulzV(p : {poly %/ h}) :
coprimep hQ p -> (p * (qpoly_inv p) = 1)%R.
Proof. by move=> hCp; rewrite /= mulrC qpoly_mulVz. 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_mulzV | |
qpoly_intro_unit(p q : {poly %/ h}) : (q * p = 1)%R -> coprimep hQ p.
Proof.
have hQM := monic_mk_monic h.
case; rewrite -[rmodp]/rmodp -!Pdiv.IdomainMonic.modpE // => qp1.
have:= coprimep1 hQ.
rewrite -coprimep_modr -[1%R]qp1 !coprimep_modr coprimepMr; by case/andP.
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_intro_unit | |
qpoly_inv_out(p : {poly %/ h}) : ~~ coprimep hQ p -> qpoly_inv p = p.
Proof. by rewrite /qpoly_inv => /negPf->. Qed.
HB.instance Definition _ := GRing.ComNzRing_hasMulInverse.Build {poly__ _}
qpoly_mulVz qpoly_intro_unit qpoly_inv_out.
HB.instance Definition _ := GRing.ComUnitAlgebra.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_inv_out | |
irreducible_poly_coprime(A : idomainType) (p q : {poly A}) :
irreducible_poly p -> coprimep p q = ~~(p %| q)%R.
Proof.
case => H1 H2; apply/coprimepP/negP.
move=> sPq H.
by have := sPq p (dvdpp _) H; rewrite -size_poly_eq1; case: size H1 => [|[]].
move=> pNDq d dDp dPq.
rewrite -size_poly_eq1; case: eqP => // /eq... | 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 | irreducible_poly_coprime | |
rat: Set := Rat {
valq : (int * int);
_ : (0 < valq.2) && coprime `|valq.1| `|valq.2|
}.
Bind Scope ring_scope with rat.
Delimit Scope rat_scope with Q. | Record | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | rat | |
ratz(n : int) := @Rat (n, 1) (coprimen1 _). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | ratz | |
rat_isSub:= Eval hnf in [isSub for valq].
HB.instance Definition _ := rat_isSub.
#[hnf] HB.instance Definition _ := [Equality of rat by <:].
HB.instance Definition _ := [Countable of rat by <:]. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | rat_isSub | |
numqx := (valq x).1. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numq | |
denqx := (valq x).2.
Arguments numq : simpl never.
Arguments denq : simpl never. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denq | |
denq_gt0x : 0 < denq x.
Proof. by rewrite /denq; case: x=> [[a b] /= /andP []]. Qed.
#[global] Hint Resolve denq_gt0 : core. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denq_gt0 | |
denq_ge0x := ltW (denq_gt0 x). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denq_ge0 | |
denq_lt0x : (denq x < 0) = false. Proof. by rewrite lt_gtF. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denq_lt0 | |
denq_neq0x : denq x != 0.
Proof. by rewrite /denq gt_eqF ?denq_gt0. Qed.
#[global] Hint Resolve denq_neq0 : core. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denq_neq0 | |
denq_eq0x : (denq x == 0) = false.
Proof. exact: negPf (denq_neq0 _). Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denq_eq0 | |
coprime_num_denx : coprime `|numq x| `|denq x|.
Proof. by rewrite /numq /denq; case: x=> [[a b] /= /andP []]. Qed.
Fact RatK x P : @Rat (numq x, denq x) P = x.
Proof. by move: x P => [[a b] P'] P; apply: 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 prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | coprime_num_den | |
fracq_subdefx :=
if x.2 != 0 then let g := gcdn `|x.1| `|x.2| in
((-1) ^ ((x.2 < 0) (+) (x.1 < 0)) * (`|x.1| %/ g)%:Z, (`|x.2| %/ g)%:Z)
else (0, 1).
Arguments fracq_subdef /. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | fracq_subdef | |
fracq_opt_subdef(x : int * int) :=
if (0 < x.2) && coprime `|x.1| `|x.2| then x else fracq_subdef x. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | fracq_opt_subdef | |
fracq_opt_subdefEx : fracq_opt_subdef x = fracq_subdef x.
Proof.
rewrite /fracq_opt_subdef; case: ifP => //; case: x => n d /= /andP[d_gt0 cnd].
rewrite /fracq_subdef gt_eqF//= lt_gtF//= (eqP cnd) !divn1 abszEsg gtz0_abs//.
rewrite mulrA sgz_def mulrnAr -signr_addb addbb expr0.
by have [->|] := eqVneq n 0; rewrite (mul... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | fracq_opt_subdefE | |
fracq_opt_subdef_idx :
fracq_opt_subdef (fracq_opt_subdef x) = fracq_subdef x.
Proof.
rewrite [fracq_opt_subdef (_ x)]/fracq_opt_subdef.
by rewrite fracq_subproof fracq_opt_subdefE.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | fracq_opt_subdef_id | |
fracq'((n', d')) : rat :=
match d', n' with
| Posz 0 as d, _ as n => Rat (fracq_subproof (1, 0))
| _ as d, Posz _ as n | _ as d, _ as n =>
Rat (fracq_subproof (fracq_opt_subdef (n, d)))
end.
Arguments fracq : simpl never. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | fracq | |
Irat_prf:= Ifracq_subproof : (int * int) -> Irat_prf. | Variant | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | Irat_prf | |
Irat:= IRat : (int * int) -> Irat_prf -> Irat. | Variant | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | Irat | |
parse(x : Number.number) : option Irat :=
let parse_pos i f :=
let nf := Decimal.nb_digits f in
let d := (10 ^ nf)%nat in
let n := (Nat.of_uint i * d + Nat.of_uint f)%nat in
valq (fracq (Posz n, Posz d)) in
let parse i f :=
match i with
| Decimal.Pos i => parse_pos i f
| Decimal.Neg i =>... | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | parse | |
print(r : Irat) : option Number.number :=
let print_pos n d :=
if d == 1%nat then Some (Nat.to_uint n, Decimal.Nil) else
let d2d5 :=
match prime_decomp d with
| [:: (2, d2); (5, d5)] => Some (d2, d5)
| [:: (2, d2)] => Some (d2, O)
| [:: (5, d5)] => Some (O, d5)
| _ =>... | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | print | |
val_fracqx : val (fracq x) = fracq_subdef x.
Proof. by case: x => [[n|n] [[|[|d]]|d]]//=; rewrite !fracq_opt_subdef_id. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | val_fracq | |
num_fracqx : numq (fracq x) = if x.2 != 0 then
(-1) ^ ((x.2 < 0) (+) (x.1 < 0)) * (`|x.1| %/ gcdn `|x.1| `|x.2|)%:Z else 0.
Proof. by rewrite /numq val_fracq/=; case: ifP. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | num_fracq | |
den_fracqx : denq (fracq x) =
if x.2 != 0 then (`|x.2| %/ gcdn `|x.1| `|x.2|)%:Z else 1.
Proof. by rewrite /denq val_fracq/=; case: ifP. Qed.
Fact ratz_frac n : ratz n = fracq (n, 1).
Proof.
by apply: val_inj; rewrite val_fracq/= gcdn1 !divn1 abszE mulr_sign_norm.
Qed.
Fact valqK x : fracq (valq x) = x.
Proof.
move: ... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | den_fracq | |
scalq'(n, d) := sgr d * (gcdn `|n| `|d|)%:Z. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | scalq | |
scalq_defx : scalq x = sgr x.2 * (gcdn `|x.1| `|x.2|)%:Z.
Proof. by case: x. Qed.
Fact scalq_eq0 x : (scalq x == 0) = (x.2 == 0).
Proof.
case: x => n d; rewrite scalq_def /= mulf_eq0 sgr_eq0 /= eqz_nat.
rewrite -[gcdn _ _ == 0]negbK -lt0n gcdn_gt0 ?absz_gt0 [X in ~~ X]orbC.
by case: sgrP.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | scalq_def | |
sgr_scalqx : sgr (scalq x) = sgr x.2.
Proof.
rewrite scalq_def sgrM sgr_id -[(gcdn _ _)%:Z]intz sgr_nat.
by rewrite -lt0n gcdn_gt0 ?absz_gt0 orbC; case: sgrP; rewrite // mul0r.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | sgr_scalq | |
signr_scalqx : (scalq x < 0) = (x.2 < 0).
Proof. by rewrite -!sgr_cp0 sgr_scalq. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | signr_scalq | |
scalqEx :
x.2 != 0 -> scalq x = (-1) ^+ (x.2 < 0)%R * (gcdn `|x.1| `|x.2|)%:Z.
Proof. by rewrite scalq_def; case: sgrP. Qed.
Fact valq_frac x :
x.2 != 0 -> x = (scalq x * numq (fracq x), scalq x * denq (fracq x)).
Proof.
move=> x2_neq0; rewrite scalqE//; move: x2_neq0.
case: x => [n d] /= d_neq0; rewrite num_fracq ... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | scalqE | |
zeroq:= 0%Q. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | zeroq | |
oneq:= 1%Q.
Fact frac0q x : fracq (0, x) = zeroq.
Proof.
apply: val_inj; rewrite //= val_fracq/= div0n !gcd0n !mulr0 !divnn.
by have [//|x_neq0] := eqVneq; rewrite absz_gt0 x_neq0.
Qed.
Fact fracq0 x : fracq (x, 0) = zeroq. Proof. exact/eqP. Qed. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | oneq | |
fracq_spec(x : int * int) : int * int -> rat -> Type :=
| FracqSpecN of x.2 = 0 : fracq_spec x (x.1, 0) zeroq
| FracqSpecP k fx of k != 0 : fracq_spec x (k * numq fx, k * denq fx) fx.
Fact fracqP x : fracq_spec x x (fracq x).
Proof.
case: x => n d /=; have [d_eq0 | d_neq0] := eqVneq d 0.
by rewrite d_eq0 fracq0; ... | Variant | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | fracq_spec | |
rat_eqEx y : (x == y) = (numq x == numq y) && (denq x == denq y).
Proof.
rewrite -val_eqE [val x]surjective_pairing [val y]surjective_pairing /=.
by rewrite xpair_eqE.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | rat_eqE | |
sgr_denqx : sgr (denq x) = 1. Proof. by apply/eqP; rewrite sgr_cp0. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | sgr_denq | |
normr_denqx : `|denq x| = denq x. Proof. by rewrite gtr0_norm. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | normr_denq | |
absz_denqx : `|denq x|%N = denq x :> int.
Proof. by rewrite abszE normr_denq. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | absz_denq | |
rat_eqx y : (x == y) = (numq x * denq y == numq y * denq x).
Proof.
symmetry; rewrite rat_eqE andbC.
have [->|] /= := eqVneq (denq _); first by rewrite (inj_eq (mulIf _)).
apply: contraNF => /eqP hxy; rewrite -absz_denq -[eqbRHS]absz_denq.
rewrite eqz_nat /= eqn_dvd.
rewrite -(@Gauss_dvdr _ `|numq x|) 1?coprime_sym ?co... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | rat_eq | |
addq_subdef(x y : int * int) :=
let: (x1, x2) := x in
let: (y1, y2) := y in
match x2, y2 with
| Posz 1, Posz 1 =>
match x1, y1 with
| Posz 0, _ => (y1, 1)
| _, Posz 0 => (x1, 1)
| Posz n, Posz 1 => (Posz n.+1, 1)
| Posz 1, Posz n => (Posz n.+1, 1)
| _, _ => (x... | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | addq_subdef | |
addq'(Rat x xP) '(Rat y yP) := fracq (addq_subdef x y). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | addq | |
addq_defx y : addq x y = fracq (addq_subdef (valq x) (valq y)).
Proof. by case: x; case: y. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | addq_def | |
addq_subdefEx y : addq_subdef x y = (x.1 * y.2 + y.1 * x.2, x.2 * y.2).
Proof.
case: x y => [x1 [[|[|x2]]|x2]] [y1 [[|[|y2]]|y2]]/=; rewrite ?Monoid.simpm//.
by case: x1 y1 => [[|[|m]]|m] [[|[|n]]|n]; rewrite ?Monoid.simpm// -PoszD addn1.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | addq_subdefE | |
oppq_subdef(x : int * int) := (- x.1, x.2). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | oppq_subdef | |
oppq'(Rat x xP) := fracq (oppq_subdef x). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | oppq | |
oppq_defx : oppq x = fracq (oppq_subdef (valq x)).
Proof. by case: x. Qed.
Fact addq_subdefC : commutative addq_subdef.
Proof. by move=> x y; rewrite !addq_subdefE addrC [x.2 * _]mulrC. Qed.
Fact addq_subdefA : associative addq_subdef.
Proof.
move=> x y z; rewrite !addq_subdefE.
by rewrite !mulrA !mulrDl addrA ![_ * x.... | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | oppq_def | |
mulq_subdef(x y : int * int) :=
let: (x1, x2) := x in
let: (y1, y2) := y in
match x2, y2 with
| Posz 1, Posz 1 => (x1 * y1, 1)
| Posz 1, _ => (x1 * y1, y2)
| _, Posz 1 => (x1 * y1, x2)
| _, _ => (x1 * y1, x2 * y2)
end. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | mulq_subdef | |
mulq'(Rat x xP) '(Rat y yP) := fracq (mulq_subdef x y). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | mulq | |
mulq_defx y : mulq x y = fracq (mulq_subdef (valq x) (valq y)).
Proof. by case: x; case: y. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | mulq_def | |
mulq_subdefEx y : mulq_subdef x y = (x.1 * y.1, x.2 * y.2).
Proof.
by case: x y => [x1 [[|[|x2]]|x2]] [y1 [[|[|y2]]|y2]]/=; rewrite ?Monoid.simpm.
Qed.
Fact mulq_subdefC : commutative mulq_subdef.
Proof. by move=> x y; rewrite !mulq_subdefE mulrC [_ * x.2]mulrC. Qed.
Fact mul_subdefA : associative mulq_subdef.
Proof. b... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | mulq_subdefE | |
invq_subdef(x : int * int) := (x.2, x.1). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | invq_subdef | |
invq'(Rat x xP) := fracq (invq_subdef x). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | invq | |
invq_defx : invq x = fracq (invq_subdef (valq x)).
Proof. by case: x. Qed.
Fact mulq_frac x y : (mulq (fracq x) (fracq y)) = fracq (mulq_subdef x y).
Proof.
rewrite mulq_def !mulq_subdefE; case: (fracqP x) => /= [|u fx u_neq0].
by rewrite !mul0r !mul1r fracq0 frac0q.
case: (fracqP y) => /= [|v fy v_neq0].
by rewrit... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | invq_def | |
numq_eq0x : (numq x == 0) = (x == 0).
Proof.
rewrite -[x]valqK fracq_eq0; case: fracqP=> /= [|k {}x k0].
by rewrite eqxx orbT.
by rewrite !mulf_eq0 (negPf k0) /= denq_eq0 orbF.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numq_eq0 | |
subq(x y : rat) : rat := (addq x (oppq y)). | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | subq | |
divq(x y : rat) : rat := (mulq x (invq y)).
Infix "+" := addq : rat_scope. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | divq | |
ratzEn : ratz n = n%:Q.
Proof.
elim: n=> [|n ihn|n ihn]; first by rewrite mulr0z ratz_frac.
by rewrite intS mulrzDr ratzD ihn.
by rewrite intS opprD mulrzDr ratzD ihn.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | ratzE | |
numq_intn : numq n%:Q = n. Proof. by rewrite -ratzE. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numq_int | |
denq_intn : denq n%:Q = 1. Proof. by rewrite -ratzE. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denq_int | |
rat0: 0%:Q = 0. 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 prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | rat0 | |
rat1: 1%:Q = 1. 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 prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | rat1 | |
numqNx : numq (- x) = - numq x.
Proof.
rewrite [- _]oppq_def/= num_fracq.
case: x => -[a b]; rewrite /numq/= => /andP[b_gt0].
rewrite /coprime => /eqP cab.
by rewrite lt_gtF ?gt_eqF // {2}abszN cab divn1 mulz_sign_abs.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numqN | |
denqNx : denq (- x) = denq x.
Proof.
rewrite [- _]oppq_def den_fracq.
case: x => -[a b]; rewrite /denq/= => /andP[b_gt0].
by rewrite /coprime=> /eqP cab; rewrite gt_eqF // abszN cab divn1 gtz0_abs.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denqN | |
fracqEx : fracq x = x.1%:Q / x.2%:Q.
Proof.
move: x => [m n] /=; apply/val_inj; rewrite val_fracq/=.
case: eqVneq => //= [->|n_neq0]; first by rewrite rat0 invr0 mulr0.
rewrite -[m%:Q]valqK -[n%:Q]valqK.
rewrite [_^-1]invq_frac ?denq_neq0 ?numq_eq0 ?intq_eq0//=.
rewrite [X in valq X]mulq_frac val_fracq /invq_subdef !mu... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | fracqE | |
divq_num_denx : (numq x)%:Q / (denq x)%:Q = x.
Proof. by rewrite -{3}[x]valqK [valq _]surjective_pairing /= fracqE. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | divq_num_den | |
divq_spec(n d : int) : int -> int -> rat -> Type :=
| DivqSpecN of d = 0 : divq_spec n d n 0 0
| DivqSpecP k x of k != 0 : divq_spec n d (k * numq x) (k * denq x) x. | Variant | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | divq_spec | |
divqPn d : divq_spec n d n d (n%:Q / d%:Q).
Proof.
set x := (n, d); rewrite -[n]/x.1 -[d]/x.2 -fracqE.
by case: fracqP => [_|k fx k_neq0] /=; constructor.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | divqP | |
rat_spec : rat -> int -> int -> Type :=
Rat_spec (n : int) (d : nat) & coprime `|n| d.+1
: rat_spec (n%:Q / d.+1%:Q) n d.+1. | Variant | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | rat_spec | |
ratPx : rat_spec x (numq x) (denq x).
Proof.
rewrite -{1}[x](divq_num_den); case hd: denq => [p|n].
have: 0 < p%:Z by rewrite -hd denq_gt0.
case: p hd=> //= n hd; constructor; rewrite -?hd ?divq_num_den //.
by rewrite -[n.+1]/`|n.+1|%N -hd coprime_num_den.
by move: (denq_gt0 x); rewrite hd.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | ratP | |
coprimeq_numn d : coprime `|n| `|d| -> numq (n%:~R / d%:~R) = sgr d * n.
Proof.
move=> cnd /=; have <- := fracqE (n, d).
rewrite num_fracq/= (eqP (cnd : _ == 1)) divn1.
have [|d_gt0|d_lt0] := sgrP d;
by rewrite (mul0r, mul1r, mulN1r) //= ?[_ ^ _]signrN ?mulNr mulz_sign_abs.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | coprimeq_num | |
coprimeq_denn d :
coprime `|n| `|d| -> denq (n%:~R / d%:~R) = (if d == 0 then 1 else `|d|).
Proof.
move=> cnd; have <- := fracqE (n, d).
by rewrite den_fracq/= (eqP (cnd : _ == 1)) divn1; case: d {cnd}; case.
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | coprimeq_den | |
denqVz(i : int) : i != 0 -> denq (i%:~R^-1) = `|i|.
Proof.
move=> h; rewrite -div1r -[1]/(1%:~R).
by rewrite coprimeq_den /= ?coprime1n // (negPf h).
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denqVz | |
numqEx : (numq x)%:~R = x * (denq x)%:~R.
Proof. by rewrite -{2}[x]divq_num_den divfK // intq_eq0 denq_eq0. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numqE | |
denqPx : {d | denq x = d.+1}.
Proof. by rewrite /denq; case: x => [[_ [[|d]|]] //= _]; exists d. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | denqP | |
normq'(Rat x _) : rat := `|x.1|%:~R / (x.2)%:~R. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | normq | |
le_rat'(Rat x _) '(Rat y _) := x.1 * y.2 <= y.1 * x.2. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | le_rat | |
lt_rat'(Rat x _) '(Rat y _) := x.1 * y.2 < y.1 * x.2. | Definition | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | lt_rat | |
normqEx : normq x = `|numq x|%:~R / (denq x)%:~R.
Proof. by case: x. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | normqE | |
le_ratEx y : le_rat x y = (numq x * denq y <= numq y * denq x).
Proof. by case: x; case: y. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | le_ratE | |
lt_ratEx y : lt_rat x y = (numq x * denq y < numq y * denq x).
Proof. by case: x; case: y. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | lt_ratE | |
gt_rat0x : lt_rat 0 x = (0 < numq x).
Proof. by rewrite lt_ratE mul0r mulr1. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | gt_rat0 | |
lt_rat0x : lt_rat x 0 = (numq x < 0).
Proof. by rewrite lt_ratE mul0r mulr1. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | lt_rat0 | |
ge_rat0x : le_rat 0 x = (0 <= numq x).
Proof. by rewrite le_ratE mul0r mulr1. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | ge_rat0 | |
le_rat0x : le_rat x 0 = (numq x <= 0).
Proof. by rewrite le_ratE mul0r mulr1. Qed.
Fact le_rat0D x y : le_rat 0 x -> le_rat 0 y -> le_rat 0 (x + y).
Proof.
rewrite !ge_rat0 => hnx hny.
have hxy: (0 <= numq x * denq y + numq y * denq x).
by rewrite addr_ge0 ?mulr_ge0.
rewrite [_ + _]addq_def /numq /= -!/(denq _) ?mulf... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | le_rat0 | |
sgr_numq_div(n d : int) : sgr (numq (n%:Q / d%:Q)) = sgr n * sgr d.
Proof.
set x := (n, d); rewrite -[n]/x.1 -[d]/x.2 -fracqE.
case: fracqP => [|k fx k_neq0] /=; first by rewrite mulr0.
by rewrite !sgrM mulrACA -expr2 sqr_sg k_neq0 sgr_denq mulr1 mul1r.
Qed.
Fact subq_ge0 x y : le_rat 0 (y - x) = le_rat x y.
Proof.
sy... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | sgr_numq_div | |
normr_num_divn d : `|numq (n%:~R / d%:~R)| = numq (`|n|%:~R / `|d|%:~R).
Proof.
rewrite (normrEsg n) (normrEsg d) !rmorphM /= invfM mulrACA !sgr_def.
have [->|n_neq0] := eqVneq; first by rewrite mul0r mulr0.
have [->|d_neq0] := eqVneq; first by rewrite invr0 !mulr0.
rewrite !intr_sign invr_sign -signr_addb numq_sign_mu... | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | normr_num_div | |
numq_ge0x : (0 <= numq x) = (0 <= x).
Proof.
by case: ratP => n d cnd; rewrite ?pmulr_lge0 ?invr_gt0 (ler0z, ltr0z).
Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numq_ge0 | |
numq_le0x : (numq x <= 0) = (x <= 0).
Proof. by rewrite -oppr_ge0 -numqN numq_ge0 oppr_ge0. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numq_le0 | |
numq_gt0x : (0 < numq x) = (0 < x).
Proof. by rewrite !ltNge numq_le0. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numq_gt0 | |
numq_lt0x : (numq x < 0) = (x < 0).
Proof. by rewrite !ltNge numq_ge0. Qed. | Lemma | algebra | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice",
"From mathcomp Require Import prime fintype finfun bigop order tuple ssralg",
"From mathcomp Require Import countalg div ssrnum ssrint archimedean poly zmodp",
"From mathcomp Require Import... | algebra/rat.v | numq_lt0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.