statement
stringlengths
1
2.88k
proof
stringlengths
0
13.9k
type
stringclasses
10 values
symbolic_name
stringlengths
1
131
library
stringclasses
417 values
filename
stringlengths
17
80
imports
listlengths
0
16
deps
listlengths
0
64
docstring
stringlengths
0
10.2k
source_url
stringclasses
1 value
commit
stringclasses
1 value
gcd_dvd_right (a b : R) : gcd a b ∣ b
(gcd_dvd a b).right
theorem
euclidean_domain.gcd_dvd_right
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_eq_zero_iff {a b : R} : gcd a b = 0 ↔ a = 0 ∧ b = 0
⟨λ h, by simpa [h] using gcd_dvd a b, by { rintro ⟨rfl, rfl⟩, exact gcd_zero_right _ }⟩
theorem
euclidean_domain.gcd_eq_zero_iff
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "gcd_eq_zero_iff", "gcd_zero_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
dvd_gcd {a b c : R} : c ∣ a → c ∣ b → c ∣ gcd a b
gcd.induction a b (λ _ _ H, by simpa only [gcd_zero_left] using H) (λ a b a0 IH ca cb, by { rw gcd_val, exact IH ((dvd_mod_iff ca).2 cb) ca })
theorem
euclidean_domain.dvd_gcd
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "gcd_zero_left" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_eq_left {a b : R} : gcd a b = a ↔ a ∣ b
⟨λ h, by {rw ← h, apply gcd_dvd_right }, λ h, by rw [gcd_val, mod_eq_zero.2 h, gcd_zero_left]⟩
theorem
euclidean_domain.gcd_eq_left
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "gcd_zero_left" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_one_left (a : R) : gcd 1 a = 1
gcd_eq_left.2 (one_dvd _)
theorem
euclidean_domain.gcd_one_left
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "gcd_one_left", "one_dvd" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_self (a : R) : gcd a a = a
gcd_eq_left.2 dvd_rfl
theorem
euclidean_domain.gcd_self
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "dvd_rfl" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd_aux_fst (x y : R) : ∀ s t s' t', (xgcd_aux x s t y s' t').1 = gcd x y
gcd.induction x y (by { intros, rw [xgcd_zero_left, gcd_zero_left] }) (λ x y h IH s t s' t', by { simp only [xgcd_aux_rec h, if_neg h, IH], rw ← gcd_val })
theorem
euclidean_domain.xgcd_aux_fst
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "gcd_zero_left" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd_aux_val (x y : R) : xgcd_aux x 1 0 y 0 1 = (gcd x y, xgcd x y)
by rw [xgcd, ← xgcd_aux_fst x y 1 0 0 1, prod.mk.eta]
theorem
euclidean_domain.xgcd_aux_val
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
P (a b : R) : R × R × R → Prop | (r, s, t)
(r : R) = a * s + b * t
def
euclidean_domain.P
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd_aux_P (a b : R) {r r' : R} : ∀ {s t s' t'}, P a b (r, s, t) → P a b (r', s', t') → P a b (xgcd_aux r s t r' s' t')
gcd.induction r r' (by { intros, simpa only [xgcd_zero_left] }) $ λ x y h IH s t s' t' p p', begin rw [xgcd_aux_rec h], refine IH _ p, unfold P at p p' ⊢, rw [mul_sub, mul_sub, add_sub, sub_add_eq_add_sub, ← p', sub_sub, mul_comm _ s, ← mul_assoc, mul_comm _ t, ← mul_assoc, ← add_mul, ← p, mod_eq_sub_mul_di...
theorem
euclidean_domain.xgcd_aux_P
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "mul_assoc", "mul_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_eq_gcd_ab (a b : R) : (gcd a b : R) = a * gcd_a a b + b * gcd_b a b
by { have := @xgcd_aux_P _ _ _ a b a b 1 0 0 1 (by rw [P, mul_one, mul_zero, add_zero]) (by rw [P, mul_one, mul_zero, zero_add]), rwa [xgcd_aux_val, xgcd_val] at this }
theorem
euclidean_domain.gcd_eq_gcd_ab
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "mul_one", "mul_zero" ]
An explicit version of **Bézout's lemma** for Euclidean domains.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
dvd_lcm_left (x y : R) : x ∣ lcm x y
classical.by_cases (assume hxy : gcd x y = 0, by { rw [lcm, hxy, div_zero], exact dvd_zero _ }) (λ hxy, let ⟨z, hz⟩ := (gcd_dvd x y).2 in ⟨z, eq.symm $ eq_div_of_mul_eq_left hxy $ by rw [mul_right_comm, mul_assoc, ← hz]⟩)
theorem
euclidean_domain.dvd_lcm_left
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "div_zero", "dvd_lcm_left", "dvd_zero", "mul_assoc", "mul_right_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
dvd_lcm_right (x y : R) : y ∣ lcm x y
classical.by_cases (assume hxy : gcd x y = 0, by { rw [lcm, hxy, div_zero], exact dvd_zero _ }) (λ hxy, let ⟨z, hz⟩ := (gcd_dvd x y).1 in ⟨z, eq.symm $ eq_div_of_mul_eq_right hxy $ by rw [← mul_assoc, mul_right_comm, ← hz]⟩)
theorem
euclidean_domain.dvd_lcm_right
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "div_zero", "dvd_lcm_right", "dvd_zero", "mul_assoc", "mul_right_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lcm_dvd {x y z : R} (hxz : x ∣ z) (hyz : y ∣ z) : lcm x y ∣ z
begin rw lcm, by_cases hxy : gcd x y = 0, { rw [hxy, div_zero], rw euclidean_domain.gcd_eq_zero_iff at hxy, rwa hxy.1 at hxz }, rcases gcd_dvd x y with ⟨⟨r, hr⟩, ⟨s, hs⟩⟩, suffices : x * y ∣ z * gcd x y, { cases this with p hp, use p, generalize_hyp : gcd x y = g at hxy hs hp ⊢, subst hs, rw [mul_left...
theorem
euclidean_domain.lcm_dvd
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "div_zero", "dvd_add", "euclidean_domain.gcd_eq_zero_iff", "lcm_dvd", "mul_assoc", "mul_comm", "mul_div_cancel_left", "mul_dvd_mul_left", "mul_left_comm", "mul_left_inj'", "mul_right_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lcm_dvd_iff {x y z : R} : lcm x y ∣ z ↔ x ∣ z ∧ y ∣ z
⟨λ hz, ⟨(dvd_lcm_left _ _).trans hz, (dvd_lcm_right _ _).trans hz⟩, λ ⟨hxz, hyz⟩, lcm_dvd hxz hyz⟩
lemma
euclidean_domain.lcm_dvd_iff
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "dvd_lcm_left", "dvd_lcm_right", "lcm_dvd", "lcm_dvd_iff" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lcm_zero_left (x : R) : lcm 0 x = 0
by rw [lcm, zero_mul, zero_div]
lemma
euclidean_domain.lcm_zero_left
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "zero_div", "zero_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lcm_zero_right (x : R) : lcm x 0 = 0
by rw [lcm, mul_zero, zero_div]
lemma
euclidean_domain.lcm_zero_right
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "mul_zero", "zero_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lcm_eq_zero_iff {x y : R} : lcm x y = 0 ↔ x = 0 ∨ y = 0
begin split, { intro hxy, rw [lcm, mul_div_assoc _ (gcd_dvd_right _ _), mul_eq_zero] at hxy, apply or_of_or_of_imp_right hxy, intro hy, by_cases hgxy : gcd x y = 0, { rw euclidean_domain.gcd_eq_zero_iff at hgxy, exact hgxy.2 }, { rcases gcd_dvd x y with ⟨⟨r, hr⟩, ⟨s, hs⟩⟩, generalize_hyp : gcd...
lemma
euclidean_domain.lcm_eq_zero_iff
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "euclidean_domain.gcd_eq_zero_iff", "lcm_eq_zero_iff", "mul_div_assoc", "mul_div_cancel_left", "mul_eq_zero", "mul_zero", "or_of_or_of_imp_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_mul_lcm (x y : R) : gcd x y * lcm x y = x * y
begin rw lcm, by_cases h : gcd x y = 0, { rw [h, zero_mul], rw euclidean_domain.gcd_eq_zero_iff at h, rw [h.1, zero_mul] }, rcases gcd_dvd x y with ⟨⟨r, hr⟩, ⟨s, hs⟩⟩, generalize_hyp : gcd x y = g at h hr ⊢, subst hr, rw [mul_assoc, mul_div_cancel_left _ h] end
lemma
euclidean_domain.gcd_mul_lcm
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "euclidean_domain.gcd_eq_zero_iff", "gcd_mul_lcm", "mul_assoc", "mul_div_cancel_left", "zero_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_div_mul_cancel {a b c : R} (ha : a ≠ 0) (hcb : c ∣ b) : a * b / (a * c) = b / c
begin by_cases hc : c = 0, { simp [hc] }, refine eq_div_of_mul_eq_right hc (mul_left_cancel₀ ha _), rw [← mul_assoc, ← mul_div_assoc _ (mul_dvd_mul_left a hcb), mul_div_cancel_left _ (mul_ne_zero ha hc)] end
lemma
euclidean_domain.mul_div_mul_cancel
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "mul_assoc", "mul_div_assoc", "mul_div_cancel_left", "mul_dvd_mul_left", "mul_left_cancel₀", "mul_ne_zero" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_div_mul_comm_of_dvd_dvd {a b c d : R} (hac : c ∣ a) (hbd : d ∣ b) : a * b / (c * d) = a / c * (b / d)
begin rcases eq_or_ne c 0 with rfl | hc0, { simp }, rcases eq_or_ne d 0 with rfl | hd0, { simp }, obtain ⟨k1, rfl⟩ := hac, obtain ⟨k2, rfl⟩ := hbd, rw [mul_div_cancel_left _ hc0, mul_div_cancel_left _ hd0, mul_mul_mul_comm, mul_div_cancel_left _ (mul_ne_zero hc0 hd0)], end
lemma
euclidean_domain.mul_div_mul_comm_of_dvd_dvd
algebra.euclidean_domain
src/algebra/euclidean_domain/basic.lean
[ "algebra.euclidean_domain.defs", "algebra.ring.divisibility", "algebra.ring.regular", "algebra.group_with_zero.divisibility", "algebra.ring.basic" ]
[ "eq_or_ne", "mul_div_cancel_left", "mul_mul_mul_comm", "mul_ne_zero" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
euclidean_domain (R : Type u) extends comm_ring R, nontrivial R
(quotient : R → R → R) (quotient_zero : ∀ a, quotient a 0 = 0) (remainder : R → R → R) (quotient_mul_add_remainder_eq : ∀ a b, b * quotient a b + remainder a b = a) (r : R → R → Prop) (r_well_founded : well_founded r) (remainder_lt : ∀ a {b}, b ≠ 0 → r (remainder a b) b) (mul_left_not_lt : ∀ a {b}, b ≠ 0 → ¬r (a * b) a...
class
euclidean_domain
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "comm_ring", "nontrivial" ]
A `euclidean_domain` is an non-trivial commutative ring with a division and a remainder, satisfying `b * (a / b) + a % b = a`. The definition of a euclidean domain usually includes a valuation function `R → ℕ`. This definition is slightly generalised to include a well founded relation `r` with the property that...
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_add_mod (a b : R) : b * (a / b) + a % b = a
euclidean_domain.quotient_mul_add_remainder_eq _ _
theorem
euclidean_domain.div_add_mod
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mod_add_div (a b : R) : a % b + b * (a / b) = a
(add_comm _ _).trans (div_add_mod _ _)
lemma
euclidean_domain.mod_add_div
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mod_add_div' (m k : R) : m % k + (m / k) * k = m
by { rw mul_comm, exact mod_add_div _ _ }
lemma
euclidean_domain.mod_add_div'
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "mul_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_add_mod' (m k : R) : (m / k) * k + m % k = m
by { rw mul_comm, exact div_add_mod _ _ }
lemma
euclidean_domain.div_add_mod'
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "mul_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mod_eq_sub_mul_div {R : Type*} [euclidean_domain R] (a b : R) : a % b = a - b * (a / b)
calc a % b = b * (a / b) + a % b - b * (a / b) : (add_sub_cancel' _ _).symm ... = a - b * (a / b) : by rw div_add_mod
lemma
euclidean_domain.mod_eq_sub_mul_div
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "euclidean_domain" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mod_lt : ∀ a {b : R}, b ≠ 0 → (a % b) ≺ b
euclidean_domain.remainder_lt
theorem
euclidean_domain.mod_lt
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_right_not_lt {a : R} (b) (h : a ≠ 0) : ¬(a * b) ≺ b
by { rw mul_comm, exact mul_left_not_lt b h }
theorem
euclidean_domain.mul_right_not_lt
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "mul_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mod_zero (a : R) : a % 0 = a
by simpa only [zero_mul, zero_add] using div_add_mod a 0
lemma
euclidean_domain.mod_zero
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "zero_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_one (a : R) : a ≺ (1:R) → a = 0
by { haveI := classical.dec, exact not_imp_not.1 (λ h, by simpa only [one_mul] using mul_left_not_lt 1 h) }
lemma
euclidean_domain.lt_one
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "classical.dec", "one_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
val_dvd_le : ∀ a b : R, b ∣ a → a ≠ 0 → ¬a ≺ b
| _ b ⟨d, rfl⟩ ha := mul_left_not_lt b (mt (by { rintro rfl, exact mul_zero _ }) ha)
lemma
euclidean_domain.val_dvd_le
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "mul_zero" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_zero (a : R) : a / 0 = 0
euclidean_domain.quotient_zero a
lemma
euclidean_domain.div_zero
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "div_zero" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd.induction {P : R → R → Prop} : ∀ a b : R, (∀ x, P 0 x) → (∀ a b, a ≠ 0 → P (b % a) a → P a b) → P a b
| a := λ b H0 H1, if a0 : a = 0 then a0.symm ▸ H0 _ else have h:_ := mod_lt b a0, H1 _ _ a0 (gcd.induction (b%a) a H0 H1) using_well_founded {dec_tac := tactic.assumption, rel_tac := λ _ _, `[exact ⟨_, r_well_founded⟩]}
theorem
euclidean_domain.gcd.induction
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd : R → R → R
| a := λ b, if a0 : a = 0 then b else have h:_ := mod_lt b a0, gcd (b%a) a using_well_founded {dec_tac := tactic.assumption, rel_tac := λ _ _, `[exact ⟨_, r_well_founded⟩]}
def
euclidean_domain.gcd
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
`gcd a b` is a (non-unique) element such that `gcd a b ∣ a` `gcd a b ∣ b`, and for any element `c` such that `c ∣ a` and `c ∣ b`, then `c ∣ gcd a b`
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_zero_left (a : R) : gcd 0 a = a
by { rw gcd, exact if_pos rfl }
theorem
euclidean_domain.gcd_zero_left
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[ "gcd_zero_left" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd_aux : R → R → R → R → R → R → R × R × R
| r := λ s t r' s' t', if hr : r = 0 then (r', s', t') else have r' % r ≺ r, from mod_lt _ hr, let q := r' / r in xgcd_aux (r' % r) (s' - q * s) (t' - q * t) r s t using_well_founded {dec_tac := tactic.assumption, rel_tac := λ _ _, `[exact ⟨_, r_well_founded⟩]}
def
euclidean_domain.xgcd_aux
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
An implementation of the extended GCD algorithm. At each step we are computing a triple `(r, s, t)`, where `r` is the next value of the GCD algorithm, to compute the greatest common divisor of the input (say `x` and `y`), and `s` and `t` are the coefficients in front of `x` and `y` to obtain `r` (i.e. `r = s * x + t * ...
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd_zero_left {s t r' s' t' : R} : xgcd_aux 0 s t r' s' t' = (r', s', t')
by { unfold xgcd_aux, exact if_pos rfl }
theorem
euclidean_domain.xgcd_zero_left
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd_aux_rec {r s t r' s' t' : R} (h : r ≠ 0) : xgcd_aux r s t r' s' t' = xgcd_aux (r' % r) (s' - (r' / r) * s) (t' - (r' / r) * t) r s t
by { conv {to_lhs, rw [xgcd_aux]}, exact if_neg h}
theorem
euclidean_domain.xgcd_aux_rec
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd (x y : R) : R × R
(xgcd_aux x 1 0 y 0 1).2
def
euclidean_domain.xgcd
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
Use the extended GCD algorithm to generate the `a` and `b` values satisfying `gcd x y = x * a + y * b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_a (x y : R) : R
(xgcd x y).1
def
euclidean_domain.gcd_a
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
The extended GCD `a` value in the equation `gcd x y = x * a + y * b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_b (x y : R) : R
(xgcd x y).2
def
euclidean_domain.gcd_b
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
The extended GCD `b` value in the equation `gcd x y = x * a + y * b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_a_zero_left {s : R} : gcd_a 0 s = 0
by { unfold gcd_a, rw [xgcd, xgcd_zero_left] }
theorem
euclidean_domain.gcd_a_zero_left
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
gcd_b_zero_left {s : R} : gcd_b 0 s = 1
by { unfold gcd_b, rw [xgcd, xgcd_zero_left] }
theorem
euclidean_domain.gcd_b_zero_left
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
xgcd_val (x y : R) : xgcd x y = (gcd_a x y, gcd_b x y)
prod.mk.eta.symm
theorem
euclidean_domain.xgcd_val
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lcm (x y : R) : R
x * y / gcd x y
def
euclidean_domain.lcm
algebra.euclidean_domain
src/algebra/euclidean_domain/defs.lean
[ "logic.nontrivial", "algebra.divisibility.basic", "algebra.group.basic", "algebra.ring.defs" ]
[]
`lcm a b` is a (non-unique) element such that `a ∣ lcm a b` `b ∣ lcm a b`, and for any element `c` such that `a ∣ c` and `b ∣ c`, then `lcm a b ∣ c`
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
int.euclidean_domain : euclidean_domain ℤ
{ add := (+), mul := (*), one := 1, zero := 0, neg := has_neg.neg, quotient := (/), quotient_zero := int.div_zero, remainder := (%), quotient_mul_add_remainder_eq := λ a b, int.div_add_mod _ _, r := λ a b, a.nat_abs < b.nat_abs, r_well_founded := measure_wf (λ a, int.nat_abs a), remainder_lt := λ ...
instance
int.euclidean_domain
algebra.euclidean_domain
src/algebra/euclidean_domain/instances.lean
[ "algebra.euclidean_domain.defs", "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "data.nat.order.basic", "data.int.order.basic" ]
[ "euclidean_domain", "int.coe_nat_abs", "int.div_add_mod", "int.div_zero", "int.mod_lt", "int.mod_nonneg", "int.nat_abs_mul", "mul_le_mul_of_nonneg_left", "mul_one" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
field.to_euclidean_domain {K : Type*} [field K] : euclidean_domain K
{ add := (+), mul := (*), one := 1, zero := 0, neg := has_neg.neg, quotient := (/), remainder := λ a b, a - a * b / b, quotient_zero := div_zero, quotient_mul_add_remainder_eq := λ a b, by { classical, by_cases b = 0; simp [h, mul_div_cancel'] }, r := λ a b, a = 0 ∧ b ≠ 0, r_well_founded := well...
instance
field.to_euclidean_domain
algebra.euclidean_domain
src/algebra/euclidean_domain/instances.lean
[ "algebra.euclidean_domain.defs", "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "data.nat.order.basic", "data.int.order.basic" ]
[ "div_zero", "euclidean_domain", "field", "mul_div_cancel'" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_div (a b c : α) : (a + b) / c = a / c + b / c
by simp_rw [div_eq_mul_inv, add_mul]
lemma
add_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_eq_mul_inv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_add_div_same (a b c : α) : a / c + b / c = (a + b) / c
(add_div _ _ _).symm
lemma
div_add_div_same
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "add_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
same_add_div (h : b ≠ 0) : (b + a) / b = 1 + a / b
by rw [←div_self h, add_div]
lemma
same_add_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "add_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_add_same (h : b ≠ 0) : (a + b) / b = a / b + 1
by rw [←div_self h, add_div]
lemma
div_add_same
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "add_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
one_add_div (h : b ≠ 0 ) : 1 + a / b = (b + a) / b
(same_add_div h).symm
lemma
one_add_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "same_add_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_add_one (h : b ≠ 0) : a / b + 1 = (a + b) / b
(div_add_same h).symm
lemma
div_add_one
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_add_same" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
one_div_mul_add_mul_one_div_eq_one_div_add_one_div (ha : a ≠ 0) (hb : b ≠ 0) : (1 / a) * (a + b) * (1 / b) = 1 / a + 1 / b
by rw [mul_add, one_div_mul_cancel ha, add_mul, one_mul, mul_assoc, mul_one_div_cancel hb, mul_one, add_comm]
lemma
one_div_mul_add_mul_one_div_eq_one_div_add_one_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "mul_assoc", "mul_one", "mul_one_div_cancel", "one_div_mul_cancel", "one_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_div_eq_mul_add_div (a b : α) (hc : c ≠ 0) : a + b / c = (a * c + b) / c
(eq_div_iff_mul_eq hc).2 $ by rw [right_distrib, (div_mul_cancel _ hc)]
lemma
add_div_eq_mul_add_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_mul_cancel", "eq_div_iff_mul_eq", "right_distrib" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_div' (a b c : α) (hc : c ≠ 0) : b + a / c = (b * c + a) / c
by rw [add_div, mul_div_cancel _ hc]
lemma
add_div'
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "add_div", "mul_div_cancel" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_add' (a b c : α) (hc : c ≠ 0) : a / c + b = (a + b * c) / c
by rwa [add_comm, add_div', add_comm]
lemma
div_add'
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "add_div'" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
commute.div_add_div (hbc : commute b c) (hbd : commute b d) (hb : b ≠ 0) (hd : d ≠ 0) : a / b + c / d = (a * d + b * c) / (b * d)
by rw [add_div, mul_div_mul_right _ b hd, hbc.eq, hbd.eq, mul_div_mul_right c d hb]
lemma
commute.div_add_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "add_div", "commute", "mul_div_mul_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
commute.one_div_add_one_div (hab : commute a b) (ha : a ≠ 0) (hb : b ≠ 0) : 1 / a + 1 / b = (a + b) / (a * b)
by rw [(commute.one_right a).div_add_div hab ha hb, one_mul, mul_one, add_comm]
lemma
commute.one_div_add_one_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute", "commute.one_right", "div_add_div", "mul_one", "one_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
commute.inv_add_inv (hab : commute a b) (ha : a ≠ 0) (hb : b ≠ 0) : a⁻¹ + b⁻¹ = (a + b) / (a * b)
by rw [inv_eq_one_div, inv_eq_one_div, hab.one_div_add_one_div ha hb]
lemma
commute.inv_add_inv
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute", "inv_eq_one_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
one_div_neg_one_eq_neg_one : (1:K) / (-1) = -1
have (-1) * (-1) = (1:K), by rw [neg_mul_neg, one_mul], eq.symm (eq_one_div_of_mul_eq_one_right this)
lemma
one_div_neg_one_eq_neg_one
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "eq_one_div_of_mul_eq_one_right", "neg_mul_neg", "one_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
one_div_neg_eq_neg_one_div (a : K) : 1 / (- a) = - (1 / a)
calc 1 / (- a) = 1 / ((-1) * a) : by rw neg_eq_neg_one_mul ... = (1 / a) * (1 / (- 1)) : by rw one_div_mul_one_div_rev ... = (1 / a) * (-1) : by rw one_div_neg_one_eq_neg_one ... = - (1 / a) : by rw [mul_neg, mul_one]
lemma
one_div_neg_eq_neg_one_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "mul_neg", "mul_one", "neg_eq_neg_one_mul", "one_div_mul_one_div_rev", "one_div_neg_one_eq_neg_one" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_neg_eq_neg_div (a b : K) : b / (- a) = - (b / a)
calc b / (- a) = b * (1 / (- a)) : by rw [← inv_eq_one_div, division_def] ... = b * -(1 / a) : by rw one_div_neg_eq_neg_one_div ... = -(b * (1 / a)) : by rw neg_mul_eq_mul_neg ... = - (b / a) : by rw mul_one_div
lemma
div_neg_eq_neg_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "inv_eq_one_div", "mul_one_div", "neg_mul_eq_mul_neg", "one_div_neg_eq_neg_one_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_div (a b : K) : (-b) / a = - (b / a)
by rw [neg_eq_neg_one_mul, mul_div_assoc, ← neg_eq_neg_one_mul]
lemma
neg_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "mul_div_assoc", "neg_eq_neg_one_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_div' (a b : K) : - (b / a) = (-b) / a
by simp [neg_div]
lemma
neg_div'
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "neg_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_div_neg_eq (a b : K) : (-a) / (-b) = a / b
by rw [div_neg_eq_neg_div, neg_div, neg_neg]
lemma
neg_div_neg_eq
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_neg_eq_neg_div", "neg_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_inv : - a⁻¹ = (- a)⁻¹
by rw [inv_eq_one_div, inv_eq_one_div, div_neg_eq_neg_div]
lemma
neg_inv
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_neg_eq_neg_div", "inv_eq_one_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_neg (a : K) : a / -b = -(a / b)
by rw [← div_neg_eq_neg_div]
lemma
div_neg
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_neg_eq_neg_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_neg : (-a)⁻¹ = -(a⁻¹)
by rw neg_inv
lemma
inv_neg
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "neg_inv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_neg_self {a : K} (h : a ≠ 0) : a / -a = -1
by rw [div_neg_eq_neg_div, div_self h]
lemma
div_neg_self
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_neg_eq_neg_div", "div_self" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_div_self {a : K} (h : a ≠ 0) : (-a) / a = -1
by rw [neg_div, div_self h]
lemma
neg_div_self
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_self", "neg_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_sub_div_same (a b c : K) : (a / c) - (b / c) = (a - b) / c
by rw [sub_eq_add_neg, ← neg_div, div_add_div_same, sub_eq_add_neg]
lemma
div_sub_div_same
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_add_div_same", "neg_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
same_sub_div {a b : K} (h : b ≠ 0) : (b - a) / b = 1 - a / b
by simpa only [← @div_self _ _ b h] using (div_sub_div_same b a b).symm
lemma
same_sub_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_self", "div_sub_div_same" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
one_sub_div {a b : K} (h : b ≠ 0) : 1 - a / b = (b - a) / b
(same_sub_div h).symm
lemma
one_sub_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "same_sub_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_sub_same {a b : K} (h : b ≠ 0) : (a - b) / b = a / b - 1
by simpa only [← @div_self _ _ b h] using (div_sub_div_same a b b).symm
lemma
div_sub_same
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_self", "div_sub_div_same" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_sub_one {a b : K} (h : b ≠ 0) : a / b - 1 = (a - b) / b
(div_sub_same h).symm
lemma
div_sub_one
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_sub_same" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sub_div (a b c : K) : (a - b) / c = a / c - b / c
(div_sub_div_same _ _ _).symm
lemma
sub_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_sub_div_same" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_sub_inv' {a b : K} (ha : a ≠ 0) (hb : b ≠ 0) : a⁻¹ - b⁻¹ = a⁻¹ * (b - a) * b⁻¹
by rw [mul_sub, sub_mul, mul_inv_cancel_right₀ hb, inv_mul_cancel ha, one_mul]
lemma
inv_sub_inv'
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "inv_mul_cancel", "mul_inv_cancel_right₀", "one_mul" ]
See `inv_sub_inv` for the more convenient version when `K` is commutative.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
one_div_mul_sub_mul_one_div_eq_one_div_add_one_div (ha : a ≠ 0) (hb : b ≠ 0) : (1 / a) * (b - a) * (1 / b) = 1 / a - 1 / b
by rw [(mul_sub_left_distrib (1 / a)), (one_div_mul_cancel ha), mul_sub_right_distrib, one_mul, mul_assoc, (mul_one_div_cancel hb), mul_one]
lemma
one_div_mul_sub_mul_one_div_eq_one_div_add_one_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "mul_assoc", "mul_one", "mul_one_div_cancel", "mul_sub_left_distrib", "mul_sub_right_distrib", "one_div_mul_cancel", "one_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
division_ring.is_domain : is_domain K
no_zero_divisors.to_is_domain _
instance
division_ring.is_domain
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "is_domain", "no_zero_divisors.to_is_domain" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
commute.div_sub_div (hbc : commute b c) (hbd : commute b d) (hb : b ≠ 0) (hd : d ≠ 0) : a / b - c / d = (a * d - b * c) / (b * d)
by simpa only [mul_neg, neg_div, ←sub_eq_add_neg] using hbc.neg_right.div_add_div hbd hb hd
lemma
commute.div_sub_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute", "mul_neg", "neg_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
commute.inv_sub_inv (hab : commute a b) (ha : a ≠ 0) (hb : b ≠ 0) : a⁻¹ - b⁻¹ = (b - a) / (a * b)
by simp only [inv_eq_one_div, (commute.one_right a).div_sub_div hab ha hb, one_mul, mul_one]
lemma
commute.inv_sub_inv
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute", "commute.one_right", "div_sub_div", "inv_eq_one_div", "mul_one", "one_mul" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_add_div (a : α) (c : α) (hb : b ≠ 0) (hd : d ≠ 0) : (a / b) + (c / d) = ((a * d) + (b * c)) / (b * d)
(commute.all b _).div_add_div (commute.all _ _) hb hd
lemma
div_add_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute.all" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
one_div_add_one_div (ha : a ≠ 0) (hb : b ≠ 0) : 1 / a + 1 / b = (a + b) / (a * b)
(commute.all a _).one_div_add_one_div ha hb
lemma
one_div_add_one_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute.all" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_add_inv (ha : a ≠ 0) (hb : b ≠ 0) : a⁻¹ + b⁻¹ = (a + b) / (a * b)
(commute.all a _).inv_add_inv ha hb
lemma
inv_add_inv
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute.all" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_sub_div (a : K) {b : K} (c : K) {d : K} (hb : b ≠ 0) (hd : d ≠ 0) : (a / b) - (c / d) = ((a * d) - (b * c)) / (b * d)
(commute.all b _).div_sub_div (commute.all _ _) hb hd
lemma
div_sub_div
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute.all" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_sub_inv {a b : K} (ha : a ≠ 0) (hb : b ≠ 0) : a⁻¹ - b⁻¹ = (b - a) / (a * b)
(commute.all a _).inv_sub_inv ha hb
lemma
inv_sub_inv
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "commute.all" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sub_div' (a b c : K) (hc : c ≠ 0) : b - a / c = (b * c - a) / c
by simpa using div_sub_div b a one_ne_zero hc
lemma
sub_div'
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_sub_div", "one_ne_zero" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_sub' (a b c : K) (hc : c ≠ 0) : a / c - b = (a - c * b) / c
by simpa using div_sub_div a b hc one_ne_zero
lemma
div_sub'
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "div_sub_div", "one_ne_zero" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
field.is_domain : is_domain K
{ ..division_ring.is_domain }
instance
field.is_domain
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "division_ring.is_domain", "is_domain" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
injective [division_ring α] [semiring β] [nontrivial β] (f : α →+* β) : injective f
(injective_iff_map_eq_zero f).2 $ λ x, (map_eq_zero f).1
lemma
ring_hom.injective
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "division_ring", "map_eq_zero", "nontrivial", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
division_ring_of_is_unit_or_eq_zero [hR : ring R] (h : ∀ (a : R), is_unit a ∨ a = 0) : division_ring R
{ .. (group_with_zero_of_is_unit_or_eq_zero h), .. hR }
def
division_ring_of_is_unit_or_eq_zero
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "division_ring", "group_with_zero_of_is_unit_or_eq_zero", "is_unit", "ring" ]
Constructs a `division_ring` structure on a `ring` consisting only of units and 0.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
field_of_is_unit_or_eq_zero [hR : comm_ring R] (h : ∀ (a : R), is_unit a ∨ a = 0) : field R
{ .. (group_with_zero_of_is_unit_or_eq_zero h), .. hR }
def
field_of_is_unit_or_eq_zero
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "comm_ring", "field", "group_with_zero_of_is_unit_or_eq_zero", "is_unit" ]
Constructs a `field` structure on a `comm_ring` consisting only of units and 0. See note [reducible non-instances].
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
function.injective.division_semiring [division_semiring β] [has_zero α] [has_mul α] [has_add α] [has_one α] [has_inv α] [has_div α] [has_smul ℕ α] [has_pow α ℕ] [has_pow α ℤ] [has_nat_cast α] (f : α → β) (hf : injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ x y, f (x + y) = f x + f y) (mul : ∀ x y, f (x ...
{ .. hf.group_with_zero f zero one mul inv div npow zpow, .. hf.semiring f zero one add mul nsmul npow nat_cast }
def
function.injective.division_semiring
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "division_semiring", "has_nat_cast", "has_smul" ]
Pullback a `division_semiring` along an injective function.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
function.injective.division_ring [division_ring K] {K'} [has_zero K'] [has_one K'] [has_add K'] [has_mul K'] [has_neg K'] [has_sub K'] [has_inv K'] [has_div K'] [has_smul ℕ K'] [has_smul ℤ K'] [has_smul ℚ K'] [has_pow K' ℕ] [has_pow K' ℤ] [has_nat_cast K'] [has_int_cast K'] [has_rat_cast K'] (f : K' → K) (hf : ...
{ rat_cast := coe, rat_cast_mk := λ a b h1 h2, hf (by erw [rat_cast, mul, inv, int_cast, nat_cast]; exact division_ring.rat_cast_mk a b h1 h2), qsmul := (•), qsmul_eq_mul' := λ a x, hf (by erw [qsmul, mul, rat.smul_def, rat_cast]), .. hf.group_with_zero f zero one mul inv di...
def
function.injective.division_ring
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "division_ring", "has_int_cast", "has_nat_cast", "has_rat_cast", "has_smul", "rat.smul_def" ]
Pullback a `division_ring` along an injective function. See note [reducible non-instances].
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
function.injective.semifield [semifield β] [has_zero α] [has_mul α] [has_add α] [has_one α] [has_inv α] [has_div α] [has_smul ℕ α] [has_pow α ℕ] [has_pow α ℤ] [has_nat_cast α] (f : α → β) (hf : injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ x y, f (x + y) = f x + f y) (mul : ∀ x y, f (x * y) = f x * f y...
{ .. hf.comm_group_with_zero f zero one mul inv div npow zpow, .. hf.comm_semiring f zero one add mul nsmul npow nat_cast }
def
function.injective.semifield
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "has_nat_cast", "has_smul", "semifield" ]
Pullback a `field` along an injective function.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
function.injective.field [field K] {K'} [has_zero K'] [has_mul K'] [has_add K'] [has_neg K'] [has_sub K'] [has_one K'] [has_inv K'] [has_div K'] [has_smul ℕ K'] [has_smul ℤ K'] [has_smul ℚ K'] [has_pow K' ℕ] [has_pow K' ℤ] [has_nat_cast K'] [has_int_cast K'] [has_rat_cast K'] (f : K' → K) (hf : injective f) (ze...
{ rat_cast := coe, rat_cast_mk := λ a b h1 h2, hf (by erw [rat_cast, mul, inv, int_cast, nat_cast]; exact division_ring.rat_cast_mk a b h1 h2), qsmul := (•), qsmul_eq_mul' := λ a x, hf (by erw [qsmul, mul, rat.smul_def, rat_cast]), .. hf.comm_group_with_zero f zero one mul i...
def
function.injective.field
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "field", "has_int_cast", "has_nat_cast", "has_rat_cast", "has_smul", "rat.smul_def" ]
Pullback a `field` along an injective function. See note [reducible non-instances].
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
to_dual_rat_cast [has_rat_cast α] (n : ℚ) : to_dual (n : α) = n
rfl
lemma
to_dual_rat_cast
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "has_rat_cast" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
of_dual_rat_cast [has_rat_cast α] (n : ℚ) : (of_dual n : α) = n
rfl
lemma
of_dual_rat_cast
algebra.field
src/algebra/field/basic.lean
[ "algebra.field.defs", "algebra.group_with_zero.units.lemmas", "algebra.hom.ring", "algebra.ring.commute" ]
[ "has_rat_cast" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83