statement
stringlengths
1
4.33k
proof
stringlengths
0
37.9k
type
stringclasses
25 values
symbolic_name
stringlengths
1
67
library
stringclasses
10 values
filename
stringclasses
112 values
imports
listlengths
2
138
deps
listlengths
0
64
docstring
stringclasses
798 values
source_url
stringclasses
1 value
commit
stringclasses
1 value
qpoly_inv_out (p : {poly %/ h}) : ~~ coprimep hQ p -> qpoly_inv p = p.
Proof. by rewrite /qpoly_inv => /negPf->. Qed.
Lemma
qpoly_inv_out
algebra
algebra/qpoly.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "choice", "fintype", "tuple", "finfun", "bigop", "finset", "nmodule", "rings_modules_and_algebras", "divalg", "countalg", "finalg", "poly", "polydiv", "matrix", "mxalgebra", "...
[ "coprimep", "hQ", "poly", "qpoly_inv" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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 => // /eqP /(H2 _) => /(_ dDp) dEp. by case: pNDq; rewrite -(eqp_dvdl _ dEp). Qed.
Lemma
irreducible_poly_coprime
algebra
algebra/qpoly.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "choice", "fintype", "tuple", "finfun", "bigop", "finset", "nmodule", "rings_modules_and_algebras", "divalg", "countalg", "finalg", "poly", "polydiv", "matrix", "mxalgebra", "...
[ "apply", "coprimep", "coprimepP", "dvdpp", "eqp_dvdl", "irreducible_poly", "poly", "size", "size_poly_eq1" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
sgr
:= Num.sg.
Notation
sgr
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "sg" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
rat : Set
:= Rat { valq : (int * int); _ : (0 < valq.2) && coprime `|valq.1| `|valq.2| }.
Record
rat
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "coprime", "int" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
ratz (n : int)
:= @Rat (n, 1) (coprimen1 _).
Definition
ratz
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "coprimen1", "int" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
rat_isSub
:= Eval hnf in [isSub for valq].
Definition
rat_isSub
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[]
Coercion ratz (n : int) := @Rat (n, 1) (coprimen1 _).
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
numq x
:= (valq x).1.
Definition
numq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denq x
:= (valq x).2.
Definition
denq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denq_gt0 x : 0 < denq x.
Proof. by rewrite /denq; case: x=> [[a b] /= /andP []]. Qed.
Lemma
denq_gt0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denq_ge0 x
:= ltW (denq_gt0 x).
Definition
denq_ge0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq_gt0", "ltW" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denq_lt0 x : (denq x < 0) = false.
Proof. by rewrite lt_gtF. Qed.
Lemma
denq_lt0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "lt_gtF" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denq_neq0 x : denq x != 0.
Proof. by rewrite /denq gt_eqF ?denq_gt0. Qed.
Lemma
denq_neq0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "denq_gt0", "gt_eqF" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denq_eq0 x : (denq x == 0) = false.
Proof. exact: negPf (denq_neq0 _). Qed.
Lemma
denq_eq0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "denq_neq0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
coprime_num_den x : coprime `|numq x| `|denq x|.
Proof. by rewrite /numq /denq; case: x=> [[a b] /= /andP []]. Qed.
Lemma
coprime_num_den
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "coprime", "denq", "numq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
RatK x P : @Rat (numq x, denq x) P = x.
Proof. by move: x P => [[a b] P'] P; apply: val_inj. Qed.
Fact
RatK
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "apply", "denq", "numq", "val_inj" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq_subdef x
:= 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).
Definition
fracq_subdef
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "gcdn" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq_opt_subdef (x : int * int)
:= if (0 < x.2) && coprime `|x.1| `|x.2| then x else fracq_subdef x.
Definition
fracq_opt_subdef
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "coprime", "fracq_subdef", "int" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq_opt_subdefE x : 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 (mulr0, mul1r). Qed.
Lemma
fracq_opt_subdefE
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "abszEsg", "d_gt0", "divn1", "eqVneq", "expr0", "fracq_opt_subdef", "fracq_subdef", "gt_eqF", "gtz0_abs", "lt_gtF", "mul1r", "mulr0", "mulrA", "mulrnAr", "sgz_def", "signr_addb" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq_subproof x (y := fracq_opt_subdef x) : (0 < y.2) && (coprime `|y.1| `|y.2|).
Proof. rewrite {}/y fracq_opt_subdefE /=; have [] //= := eqVneq x.2 0. case: x => [/= n d]; rewrite -absz_gt0 => dN0. have ggt0 : (0 < gcdn `|n| `|d|)%N by rewrite gcdn_gt0 dN0 orbT. rewrite ltz_nat divn_gt0// dvdn_leq ?dvdn_gcdr//=. rewrite abszM abszX abszN1 exp1n mul1n absz_nat. rewrite /coprime -(@eqn_pmul2r (gcdn ...
Fact
fracq_subproof
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "abszM", "abszN1", "abszX", "absz_gt0", "absz_nat", "coprime", "divnK", "divn_gt0", "dvdn_gcdl", "dvdn_gcdr", "dvdn_leq", "eqVneq", "eqn_pmul2r", "exp1n", "fracq_opt_subdef", "fracq_opt_subdefE", "gcdn", "gcdn_gt0", "ltz_nat", "mul1n", "muln_gcdl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq_opt_subdef_id x : 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
fracq_opt_subdef_id
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq_opt_subdef", "fracq_opt_subdefE", "fracq_subdef", "fracq_subproof" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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.
Definition
fracq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "Posz", "fracq_opt_subdef", "fracq_subproof", "n'", "rat" ]
As a consequence val (fracq x) = fracq_opt_subdef (fracq_opt_subdef x))
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
Irat_prf
:= Ifracq_subproof : (int * int) -> Irat_prf.
Variant
Irat_prf
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "int" ]
inductive type.
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
Irat
:= IRat : (int * int) -> Irat_prf -> Irat.
Variant
Irat
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "Irat_prf", "int" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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 => let (n, d) := parse_pos i f in ((- n)%...
Definition
parse
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "Irat", "Posz", "fracq", "nat", "number", "of_uint" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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) | _ => None end in match d2d5 w...
Definition
print
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "Irat", "Nil", "Posz", "edivn", "nat", "number", "prime_decomp", "to_uint" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
val_fracq x : val (fracq x) = fracq_subdef x.
Proof. by case: x => [[n|n] [[|[|d]]|d]]//=; rewrite !fracq_opt_subdef_id. Qed.
Lemma
val_fracq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "fracq_opt_subdef_id", "fracq_subdef", "val" ]
Check 0.2%Q.
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
num_fracq x : 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
num_fracq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "gcdn", "numq", "val_fracq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
den_fracq x : 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.
Lemma
den_fracq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "fracq", "gcdn", "val_fracq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
ratz_frac n : ratz n = fracq (n, 1).
Proof. by apply: val_inj; rewrite val_fracq/= gcdn1 !divn1 abszE mulr_sign_norm. Qed.
Fact
ratz_frac
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "abszE", "apply", "divn1", "fracq", "gcdn1", "mulr_sign_norm", "ratz", "val_fracq", "val_inj" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
valqK x : fracq (valq x) = x.
Proof. move: x => [[n d] /= Pnd]; apply: val_inj; rewrite ?val_fracq/=. move: Pnd; rewrite /coprime /fracq /= => /andP[] hd -/eqP hnd. by rewrite lt_gtF ?gt_eqF //= hnd !divn1 mulz_sign_abs abszE gtr0_norm. Qed.
Fact
valqK
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "abszE", "apply", "coprime", "divn1", "fracq", "gt_eqF", "gtr0_norm", "lt_gtF", "mulz_sign_abs", "val_fracq", "val_inj" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
scalq '(n, d)
:= sgr d * (gcdn `|n| `|d|)%:Z.
Definition
scalq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "gcdn", "sgr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
scalq_def x : scalq x = sgr x.2 * (gcdn `|x.1| `|x.2|)%:Z.
Proof. by case: x. Qed.
Lemma
scalq_def
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "gcdn", "scalq", "sgr" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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.
Fact
scalq_eq0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "absz_gt0", "eqz_nat", "gcdn", "gcdn_gt0", "lt0n", "mulf_eq0", "scalq", "scalq_def", "sgrP", "sgr_eq0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
sgr_scalq x : 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
sgr_scalq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "absz_gt0", "gcdn", "gcdn_gt0", "intz", "lt0n", "mul0r", "scalq", "scalq_def", "sgr", "sgrM", "sgrP", "sgr_id", "sgr_nat" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
signr_scalq x : (scalq x < 0) = (x.2 < 0).
Proof. by rewrite -!sgr_cp0 sgr_scalq. Qed.
Lemma
signr_scalq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "scalq", "sgr_cp0", "sgr_scalq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
scalqE x : x.2 != 0 -> scalq x = (-1) ^+ (x.2 < 0)%R * (gcdn `|x.1| `|x.2|)%:Z.
Proof. by rewrite scalq_def; case: sgrP. Qed.
Lemma
scalqE
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "gcdn", "scalq", "scalq_def", "sgrP" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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 den_fracq/= ?d_neq0. rewrite mulr_signM -mulrA -!PoszM addKb. do 2!rewrite muln_divCA ?(dvdn_gcdl, dvdn_gcdr) // divnn. by rewrite gcdn_gt0 !absz_gt0 d_neq0 orbT !muln1 !mulz_sign_abs. Qed.
Fact
valq_frac
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "PoszM", "absz_gt0", "den_fracq", "denq", "divnn", "dvdn_gcdl", "dvdn_gcdr", "fracq", "gcdn_gt0", "muln1", "muln_divCA", "mulrA", "mulr_signM", "mulz_sign_abs", "num_fracq", "numq", "scalq", "scalqE" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
zeroq
:= 0%Q.
Definition
zeroq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
oneq
:= 1%Q.
Definition
oneq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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
frac0q
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "absz_gt0", "apply", "div0n", "divnn", "eqVneq", "fracq", "gcd0n", "mulr0", "val_fracq", "val_inj", "zeroq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq0 x : fracq (x, 0) = zeroq.
Proof. exact/eqP. Qed.
Fact
fracq0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "zeroq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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.
Variant
fracq_spec
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "int", "numq", "rat", "zeroq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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; constructor. by rewrite {2}[(_, _)]valq_frac //; constructor; rewrite scalq_eq0. Qed.
Fact
fracqP
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "eqVneq", "fracq", "fracq0", "fracq_spec", "scalq_eq0", "valq_frac" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
rat_eqE x 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
rat_eqE
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "numq", "val", "val_eqE", "xpair_eqE" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
sgr_denq x : sgr (denq x) = 1.
Proof. by apply/eqP; rewrite sgr_cp0. Qed.
Lemma
sgr_denq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "apply", "denq", "sgr", "sgr_cp0" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
normr_denq x : `|denq x| = denq x.
Proof. by rewrite gtr0_norm. Qed.
Lemma
normr_denq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "gtr0_norm" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
absz_denq x : `|denq x|%N = denq x :> int.
Proof. by rewrite abszE normr_denq. Qed.
Lemma
absz_denq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "abszE", "denq", "int", "normr_denq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
rat_eq x 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 ?coprime_num_den // andbC. rewrite -(@Gauss_dvdr _ `|numq y|) 1?...
Lemma
rat_eq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "Gauss_dvdr", "abszM", "absz_denq", "apply", "coprime_num_den", "coprime_sym", "denq", "dvdn_mull", "dvdnn", "eqVneq", "eqbRHS", "eqn_dvd", "eqz_nat", "inj_eq", "mulIf", "numq", "rat_eqE" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq_eq x y : x.2 != 0 -> y.2 != 0 -> (fracq x == fracq y) = (x.1 * y.2 == y.1 * x.2).
Proof. case: fracqP=> //= u fx u_neq0 _; case: fracqP=> //= v fy v_neq0 _; symmetry. rewrite [eqbRHS]mulrC mulrACA [eqbRHS]mulrACA. by rewrite [denq _ * _]mulrC (inj_eq (mulfI _)) ?mulf_neq0 // rat_eq. Qed.
Fact
fracq_eq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "eqbRHS", "fracq", "fracqP", "inj_eq", "mulfI", "mulf_neq0", "mulrACA", "mulrC", "rat_eq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracq_eq0 x : (fracq x == zeroq) = (x.1 == 0) || (x.2 == 0).
Proof. move: x=> [n d] /=; have [->|d0] := eqVneq d 0. by rewrite fracq0 eqxx orbT. by rewrite -[zeroq]valqK orbF fracq_eq ?d0 //= mulr1 mul0r. Qed.
Fact
fracq_eq0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "eqVneq", "eqxx", "fracq", "fracq0", "fracq_eq", "mul0r", "mulr1", "valqK", "zeroq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
fracqMM x n d : x != 0 -> fracq (x * n, x * d) = fracq (n, d).
Proof. move=> x_neq0; apply/eqP. have [->|d_neq0] := eqVneq d 0; first by rewrite mulr0 !fracq0. by rewrite fracq_eq ?mulf_neq0 //= mulrCA mulrA. Qed.
Fact
fracqMM
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "apply", "eqVneq", "fracq", "fracq0", "fracq_eq", "mulf_neq0", "mulr0", "mulrA", "mulrCA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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) | _, _ => (x1 + y1, 1) end | ...
Definition
addq_subdef
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "Posz", "int" ]
of terms of the form N%:Q when N is a concrete natural number.
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addq '(Rat x xP) '(Rat y yP)
:= fracq (addq_subdef x y).
Definition
addq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq_subdef", "fracq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addq_def x y : addq x y = fracq (addq_subdef (valq x) (valq y)).
Proof. by case: x; case: y. Qed.
Lemma
addq_def
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq", "addq_subdef", "fracq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addq_subdefE x 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
addq_subdefE
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "PoszD", "addn1", "addq_subdef", "simpm" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
oppq_subdef (x : int * int)
:= (- x.1, x.2).
Definition
oppq_subdef
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "int" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
oppq '(Rat x xP)
:= fracq (oppq_subdef x).
Definition
oppq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "oppq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
oppq_def x : oppq x = fracq (oppq_subdef (valq x)).
Proof. by case: x. Qed.
Definition
oppq_def
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "oppq", "oppq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addq_subdefC : commutative addq_subdef.
Proof. by move=> x y; rewrite !addq_subdefE addrC [x.2 * _]mulrC. Qed.
Fact
addq_subdefC
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq_subdef", "addq_subdefE", "addrC", "mulrC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addq_subdefA : associative addq_subdef.
Proof. move=> x y z; rewrite !addq_subdefE/=. by rewrite !mulrDl addrA !mulrA 2![_ * _ * x.2]mulrAC. Qed.
Fact
addq_subdefA
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq_subdef", "addq_subdefE", "addrA", "mulrA", "mulrAC", "mulrDl" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addq_frac x y : x.2 != 0 -> y.2 != 0 -> (addq (fracq x) (fracq y)) = fracq (addq_subdef x y).
Proof. case: fracqP => // u fx u_neq0 _; case: fracqP => // v fy v_neq0 _. rewrite addq_def !addq_subdefE /=. rewrite ![(_ * numq _) * _]mulrACA [(_ * denq _) * _]mulrACA. by rewrite [v * _]mulrC -mulrDr fracqMM ?mulf_neq0. Qed.
Fact
addq_frac
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq", "addq_def", "addq_subdef", "addq_subdefE", "denq", "fracq", "fracqMM", "fracqP", "mulf_neq0", "mulrACA", "mulrC", "mulrDr", "numq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
ratzD : {morph ratz : x y / x + y >-> addq x y}.
Proof. by move=> x y; rewrite !ratz_frac addq_frac// addq_subdefE/= !mulr1. Qed.
Fact
ratzD
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq", "addq_frac", "addq_subdefE", "mulr1", "ratz", "ratz_frac" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
oppq_frac x : oppq (fracq x) = fracq (oppq_subdef x).
Proof. rewrite /oppq_subdef; case: fracqP => /= [|u fx u_neq0]. by rewrite fracq0. by rewrite oppq_def -mulrN fracqMM. Qed.
Fact
oppq_frac
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "fracq0", "fracqMM", "fracqP", "mulrN", "oppq", "oppq_def", "oppq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
ratzN : {morph ratz : x / - x >-> oppq x}.
Proof. by move=> x /=; rewrite !ratz_frac // /add /= !mulr1. Qed.
Fact
ratzN
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "add", "mulr1", "oppq", "ratz", "ratz_frac" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addqC : commutative addq.
Proof. by move=> x y; rewrite !addq_def /= addq_subdefC. Qed.
Fact
addqC
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq", "addq_def", "addq_subdefC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addqA : associative addq.
Proof. move=> x y z; rewrite -[x]valqK -[y]valqK -[z]valqK. by rewrite ?addq_frac ?addq_subdefA// ?addq_subdefE ?mulf_neq0 ?denq_neq0. Qed.
Fact
addqA
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq", "addq_frac", "addq_subdefA", "addq_subdefE", "denq_neq0", "mulf_neq0", "valqK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
add0q : left_id zeroq addq.
Proof. move=> x; rewrite -[x]valqK -[zeroq]valqK addq_frac ?denq_neq0 // !addq_subdefE. by rewrite mul0r add0r mulr1 mul1r -surjective_pairing. Qed.
Fact
add0q
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "add0r", "addq", "addq_frac", "addq_subdefE", "denq_neq0", "mul0r", "mul1r", "mulr1", "valqK", "zeroq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
addNq : left_inverse (fracq (0, 1)) oppq addq.
Proof. move=> x; rewrite -[x]valqK !(addq_frac, oppq_frac) ?denq_neq0 //. rewrite !addq_subdefE /oppq_subdef //= mulNr addNr; apply/eqP. by rewrite fracq_eq ?mulf_neq0 ?denq_neq0 //= !mul0r. Qed.
Fact
addNq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addNr", "addq", "addq_frac", "addq_subdefE", "apply", "denq_neq0", "fracq", "fracq_eq", "mul0r", "mulNr", "mulf_neq0", "oppq", "oppq_frac", "oppq_subdef", "valqK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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
mulq_subdef
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "Posz", "int" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulq '(Rat x xP) '(Rat y yP)
:= fracq (mulq_subdef x y).
Definition
mulq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "mulq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulq_def x y : mulq x y = fracq (mulq_subdef (valq x) (valq y)).
Proof. by case: x; case: y. Qed.
Lemma
mulq_def
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "mulq", "mulq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulq_subdefE x 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.
Lemma
mulq_subdefE
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "mulq_subdef", "simpm" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulq_subdefC : commutative mulq_subdef.
Proof. by move=> x y; rewrite !mulq_subdefE mulrC [_ * x.2]mulrC. Qed.
Fact
mulq_subdefC
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "mulq_subdef", "mulq_subdefE", "mulrC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mul_subdefA : associative mulq_subdef.
Proof. by move=> x y z; rewrite !mulq_subdefE !mulrA. Qed.
Fact
mul_subdefA
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "mulq_subdef", "mulq_subdefE", "mulrA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
invq_subdef (x : int * int)
:= (x.2, x.1).
Definition
invq_subdef
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "int" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
invq '(Rat x xP)
:= fracq (invq_subdef x).
Definition
invq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "invq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
invq_def x : invq x = fracq (invq_subdef (valq x)).
Proof. by case: x. Qed.
Lemma
invq_def
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "invq", "invq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
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 rewrite !mulr0 !mulr1 fracq0 frac0q. by rewrite ![_ * (v * _)]mulrACA [RHS]fracqMM ?mulf_neq0. Qed.
Fact
mulq_frac
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "frac0q", "fracq", "fracq0", "fracqMM", "fracqP", "mul0r", "mul1r", "mulf_neq0", "mulq", "mulq_def", "mulq_subdef", "mulq_subdefE", "mulr0", "mulr1", "mulrACA" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
ratzM : {morph ratz : x y / x * y >-> mulq x y}.
Proof. by move=> x y /=; rewrite !ratz_frac //= !mulr1. Qed.
Fact
ratzM
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "mulq", "mulr1", "ratz", "ratz_frac" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
invq_frac x : x.1 != 0 -> x.2 != 0 -> invq (fracq x) = fracq (invq_subdef x).
Proof. by rewrite invq_def; case: (fracqP x) => // k ? k0; rewrite fracqMM. Qed.
Fact
invq_frac
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "fracq", "fracqMM", "fracqP", "invq", "invq_def", "invq_subdef" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulqC : commutative mulq.
Proof. by move=> x y; rewrite !mulq_def mulq_subdefC. Qed.
Fact
mulqC
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "mulq", "mulq_def", "mulq_subdefC" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulqA : associative mulq.
Proof. by move=> x y z; rewrite -[x]valqK -[y]valqK -[z]valqK !mulq_frac mul_subdefA. Qed.
Fact
mulqA
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "mul_subdefA", "mulq", "mulq_frac", "valqK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mul1q : left_id oneq mulq.
Proof. move=> x; rewrite -[x]valqK -[oneq]valqK; rewrite mulq_frac !mulq_subdefE. by rewrite !mul1r -surjective_pairing. Qed.
Fact
mul1q
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "mul1r", "mulq", "mulq_frac", "mulq_subdefE", "oneq", "valqK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulq_addl : left_distributive mulq addq.
Proof. move=> x y z; rewrite -[x]valqK -[y]valqK -[z]valqK /=. rewrite !(mulq_frac, addq_frac, mulq_subdefE, addq_subdefE) ?mulf_neq0 ?denq_neq0 //=. apply/eqP; rewrite fracq_eq ?mulf_neq0 ?denq_neq0 //= !mulrDl; apply/eqP. by rewrite !mulrA ![_ * (valq z).1]mulrC !mulrA ![_ * (valq x).2]mulrC !mulrA. Qed.
Fact
mulq_addl
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq", "addq_frac", "addq_subdefE", "apply", "denq_neq0", "fracq_eq", "mulf_neq0", "mulq", "mulq_frac", "mulq_subdefE", "mulrA", "mulrC", "mulrDl", "valqK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
nonzero1q : oneq != zeroq.
Proof. by []. Qed.
Fact
nonzero1q
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "oneq", "zeroq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
mulVq x : x != 0 -> mulq (invq x) x = 1.
Proof. rewrite -[x]valqK -[0]valqK fracq_eq ?denq_neq0 //= mulr1 mul0r=> nx0. rewrite !(mulq_frac, invq_frac, mulq_subdefE) ?denq_neq0 // -[1]valqK. by apply/eqP; rewrite fracq_eq ?mulf_neq0 ?denq_neq0 //= mulr1 mul1r mulrC. Qed.
Fact
mulVq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "apply", "denq_neq0", "fracq_eq", "invq", "invq_frac", "mul0r", "mul1r", "mulf_neq0", "mulq", "mulq_frac", "mulq_subdefE", "mulr1", "mulrC", "valqK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
invq0 : invq 0 = 0.
Proof. exact/eqP. Qed.
Fact
invq0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "invq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
numq_eq0 x : (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
numq_eq0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq_eq0", "eqxx", "fracqP", "fracq_eq0", "mulf_eq0", "numq", "valqK" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
"n %:Q"
:= ((n : int)%:~R : rat) : ring_scope.
Notation
n %:Q
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "int", "rat" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
subq (x y : rat) : rat
:= (addq x (oppq y)).
Definition
subq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "addq", "oppq", "rat" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
divq (x y : rat) : rat
:= (mulq x (invq y)).
Definition
divq
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "invq", "mulq", "rat" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
"- x"
:= (oppq x) : rat_scope.
Notation
- x
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "oppq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
"x ^-1"
:= (invq x) : rat_scope.
Notation
x ^-1
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "invq" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
ratzE n : 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
ratzE
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "intS", "mulr0z", "mulrzDr", "opprD", "ratz", "ratzD", "ratz_frac" ]
ratz should not be used, %:Q should be used instead
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
numq_int n : numq n%:Q = n.
Proof. by rewrite -ratzE. Qed.
Lemma
numq_int
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "numq", "ratzE" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denq_int n : denq n%:Q = 1.
Proof. by rewrite -ratzE. Qed.
Lemma
denq_int
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "denq", "ratzE" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
rat0 : 0%:Q = 0.
Proof. by []. Qed.
Lemma
rat0
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
rat1 : 1%:Q = 1.
Proof. by []. Qed.
Lemma
rat1
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
numqN x : 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
numqN
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "abszN", "coprime", "divn1", "gt_eqF", "lt_gtF", "mulz_sign_abs", "num_fracq", "numq", "oppq_def" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d
denqN x : 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
denqN
algebra
algebra/rat.v
[ "HB", "structures", "mathcomp", "ssreflect", "ssrfun", "ssrbool", "eqtype", "ssrnat", "seq", "div", "choice", "fintype", "tuple", "finfun", "bigop", "prime", "nmodule", "order", "rings_modules_and_algebras", "divalg", "countalg", "poly", "polydiv", "zmodp", "matrix", ...
[ "abszN", "coprime", "den_fracq", "denq", "divn1", "gt_eqF", "gtz0_abs", "oppq_def" ]
https://github.com/math-comp/math-comp
91d97df9cf3204b4dab84f4e24bc633e84b6473d