Skip to content

Commit

Permalink
chore(algebra/{group,group_with_zero}/basic): rename div_mul_div an…
Browse files Browse the repository at this point in the history
…d `div_mul_comm` (#12365)

The new name, `div_mul_div_comm` is consistent with `mul_mul_mul_comm`.

Obviously this renames the additive versions too.
  • Loading branch information
eric-wieser committed Mar 3, 2022
1 parent ca7346d commit e823109
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/algebra/big_operators/multiset.lean
Expand Up @@ -226,7 +226,7 @@ by { convert (m.map f).prod_hom (inv_monoid_with_zero_hom : α →*₀ α), rw m

@[simp]
lemma prod_map_div₀ : (m.map $ λ i, f i / g i).prod = (m.map f).prod / (m.map g).prod :=
m.prod_hom₂ (/) (λ _ _ _ _, (div_mul_div _ _ _ _).symm) (div_one _) _ _
m.prod_hom₂ (/) (λ _ _ _ _, (div_mul_div_comm₀ _ _ _ _).symm) (div_one _) _ _

lemma prod_map_zpow₀ {n : ℤ} : prod (m.map $ λ i, f i ^ n) = (m.map f).prod ^ n :=
by { convert (m.map f).prod_hom (zpow_group_hom₀ _ : α →* α), rw map_map, refl }
Expand Down
2 changes: 1 addition & 1 deletion src/algebra/group/basic.lean
Expand Up @@ -480,7 +480,7 @@ lemma div_eq_of_eq_mul' {a b c : G} (h : a = b * c) : a / b = c :=
by rw [h, div_eq_mul_inv, mul_comm, inv_mul_cancel_left]

@[to_additive]
lemma div_mul_comm (a b c d : G) : a / b * (c / d) = a * c / (b * d) :=
lemma div_mul_div_comm (a b c d : G) : a / b * (c / d) = a * c / (b * d) :=
by rw [div_eq_mul_inv, div_eq_mul_inv, div_eq_mul_inv, mul_inv_rev, mul_assoc, mul_assoc,
mul_left_cancel_iff, mul_comm, mul_assoc]

Expand Down
2 changes: 1 addition & 1 deletion src/algebra/group/prod.lean
Expand Up @@ -502,6 +502,6 @@ def div_monoid_with_zero_hom [comm_group_with_zero α] : α × α →*₀ α :=
{ to_fun := λ a, a.1 / a.2,
map_zero' := zero_div _,
map_one' := div_one _,
map_mul' := λ a b, (div_mul_div _ _ _ _).symm }
map_mul' := λ a b, (div_mul_div_comm₀ _ _ _ _).symm }

end bundled_mul_div
6 changes: 3 additions & 3 deletions src/algebra/group_with_zero/basic.lean
Expand Up @@ -968,7 +968,7 @@ by rw [mul_comm, (div_mul_cancel _ hb)]

local attribute [simp] mul_assoc mul_comm mul_left_comm

lemma div_mul_div (a b c d : G₀) :
lemma div_mul_div_comm₀ (a b c d : G₀) :
(a / b) * (c / d) = (a * c) / (b * d) :=
by simp [div_eq_mul_inv, mul_inv₀]

Expand All @@ -981,7 +981,7 @@ by simp [div_eq_mul_inv]

lemma div_mul_eq_mul_div_comm (a b c : G₀) :
(b / c) * a = b * (a / c) :=
by rw [div_mul_eq_mul_div, ← one_mul c, ← div_mul_div, div_one, one_mul]
by rw [div_mul_eq_mul_div, ← one_mul c, ← div_mul_div_comm₀, div_one, one_mul]

lemma mul_eq_mul_of_div_eq_div (a : G₀) {b : G₀} (c : G₀) {d : G₀} (hb : b ≠ 0)
(hd : d ≠ 0) (h : a / b = c / d) : a * d = c * b :=
Expand All @@ -990,7 +990,7 @@ by rw [← mul_one (a*d), mul_assoc, mul_comm d, ← mul_assoc, ← div_self hb,

@[field_simps] lemma div_div_eq_div_mul (a b c : G₀) :
(a / b) / c = a / (b * c) :=
by rw [div_eq_mul_one_div, div_mul_div, mul_one]
by rw [div_eq_mul_one_div, div_mul_div_comm₀, mul_one]

lemma div_div_div_div_eq (a : G₀) {b c d : G₀} :
(a / b) / (c / d) = (a * d) / (b * c) :=
Expand Down
2 changes: 1 addition & 1 deletion src/algebra/order/lattice_group.lean
Expand Up @@ -382,7 +382,7 @@ begin
rw [sup_right_idem, sup_assoc, inf_assoc],
nth_rewrite 3 inf_comm,
rw [inf_right_idem, inf_assoc], }
... = (b ⊔ a ⊔ c) * ((b ⊔ a) ⊓ c) /(((b ⊓ a) ⊔ c) * (b ⊓ a ⊓ c)) : by rw div_mul_comm
... = (b ⊔ a ⊔ c) * ((b ⊔ a) ⊓ c) /(((b ⊓ a) ⊔ c) * (b ⊓ a ⊓ c)) : by rw div_mul_div_comm
... = (b ⊔ a) * c / ((b ⊓ a) * c) :
by rw [mul_comm, inf_mul_sup, mul_comm (b ⊓ a ⊔ c), inf_mul_sup]
... = (b ⊔ a) / (b ⊓ a) : by rw [div_eq_mul_inv, mul_inv_rev, mul_assoc, mul_inv_cancel_left,
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/box_integral/partition/additive.lean
Expand Up @@ -176,7 +176,7 @@ of_map_split_add
rw with_top.coe_le_coe at hJ,
refine i.succ_above_cases _ _ j,
{ intros x hx,
simp only [box.split_lower_def hx, box.split_upper_def hx, update_same,
simp only [box.split_lower_def hx, box.split_upper_def hx, update_same,
← with_bot.some_eq_coe, option.elim, box.face, (∘), update_noteq (fin.succ_above_ne _ _)],
abel },
{ clear j, intros j x hx,
Expand All @@ -189,7 +189,7 @@ of_map_split_add
simp only [box.split_lower_def hx, box.split_upper_def hx,
box.split_lower_def hx', box.split_upper_def hx',
← with_bot.some_eq_coe, option.elim, box.face_mk,
update_noteq (fin.succ_above_ne _ _).symm, sub_add_comm,
update_noteq (fin.succ_above_ne _ _).symm, sub_add_sub_comm,
update_comp_eq_of_injective _ i.succ_above.injective j x, ← hf],
simp only [box.face] }
end
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/mean_inequalities.lean
Expand Up @@ -340,7 +340,7 @@ begin
let f' := λ i, (f i) / (∑ i in s, (f i) ^ p) ^ (1 / p),
let g' := λ i, (g i) / (∑ i in s, (g i) ^ q) ^ (1 / q),
suffices : ∑ i in s, f' i * g' i ≤ 1,
{ simp_rw [f', g', div_mul_div, ← sum_div] at this,
{ simp_rw [f', g', div_mul_div_comm₀, ← sum_div] at this,
rwa [div_le_iff, one_mul] at this,
refine mul_ne_zero _ _,
{ rw [ne.def, rpow_eq_zero_iff, not_and_distrib], exact or.inl hF_zero, },
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/special_functions/polynomials.lean
Expand Up @@ -141,7 +141,7 @@ begin
refine (P.is_equivalent_at_top_lead.symm.div
Q.is_equivalent_at_top_lead.symm).symm.trans
(eventually_eq.is_equivalent ((eventually_gt_at_top 0).mono $ λ x hx, _)),
simp [← div_mul_div, hP, hQ, zpow_sub₀ hx.ne.symm]
simp [← div_mul_div_comm₀, hP, hQ, zpow_sub₀ hx.ne.symm]
end

lemma div_tendsto_zero_of_degree_lt (hdeg : P.degree < Q.degree) :
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/special_functions/trigonometric/complex.lean
Expand Up @@ -107,7 +107,7 @@ begin
← div_div_div_cancel_right (sin x * cos y + cos x * sin y)
(mul_ne_zero (cos_ne_zero_iff.mpr h1) (cos_ne_zero_iff.mpr h2)),
add_div, sub_div],
simp only [←div_mul_div, ←tan, mul_one, one_mul,
simp only [←div_mul_div_comm₀, ←tan, mul_one, one_mul,
div_self (cos_ne_zero_iff.mpr h1), div_self (cos_ne_zero_iff.mpr h2)] },
{ obtain ⟨t, hx, hy, hxy⟩ := ⟨tan_int_mul_pi_div_two, t (2*k+1), t (2*l+1), t (2*k+1+(2*l+1))⟩,
simp only [int.cast_add, int.cast_bit0, int.cast_mul, int.cast_one, hx, hy] at hx hy hxy,
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/specific_limits.lean
Expand Up @@ -1108,7 +1108,7 @@ begin
-- Finally, we prove the upper estimate
intros n hn,
calc ∥x ^ (n + 1) / (n + 1)!∥ = (∥x∥ / (n + 1)) * ∥x ^ n / n!∥ :
by rw [pow_succ, nat.factorial_succ, nat.cast_mul, ← div_mul_div,
by rw [pow_succ, nat.factorial_succ, nat.cast_mul, ← div_mul_div_comm₀,
norm_mul, norm_div, real.norm_coe_nat, nat.cast_succ]
... ≤ (∥x∥ / (⌊∥x∥⌋₊ + 1)) * ∥x ^ n / n!∥ :
by mono* with [0 ≤ ∥x ^ n / n!∥, 0 ≤ ∥x∥]; apply norm_nonneg
Expand Down
2 changes: 1 addition & 1 deletion src/data/nat/basic.lean
Expand Up @@ -1110,7 +1110,7 @@ show ∃ d, b = c * a * d, from ⟨d, by cc⟩
@[simp] lemma dvd_div_iff {a b c : ℕ} (hbc : c ∣ b) : a ∣ b / c ↔ c * a ∣ b :=
⟨λ h, mul_dvd_of_dvd_div hbc h, λ h, dvd_div_of_mul_dvd h⟩

lemma div_mul_div {a b c d : ℕ} (hab : b ∣ a) (hcd : d ∣ c) :
lemma div_mul_div_comm {a b c d : ℕ} (hab : b ∣ a) (hcd : d ∣ c) :
(a / b) * (c / d) = (a * c) / (b * d) :=
have exi1 : ∃ x, a = b * x, from hab,
have exi2 : ∃ y, c = d * y, from hcd,
Expand Down
2 changes: 1 addition & 1 deletion src/data/nat/prime.lean
Expand Up @@ -792,7 +792,7 @@ lemma succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul {p : ℕ} (p_prime : prime p) {m
have hpd : p^(k+l)*p ∣ m*n, by rwa pow_succ' at hpmn,
have hpd2 : p ∣ (m*n) / p ^ (k+l), from dvd_div_of_mul_dvd hpd,
have hpd3 : p ∣ (m*n) / (p^k * p^l), by simpa [pow_add] using hpd2,
have hpd4 : p ∣ (m / p^k) * (n / p^l), by simpa [nat.div_mul_div hpm hpn] using hpd3,
have hpd4 : p ∣ (m / p^k) * (n / p^l), by simpa [nat.div_mul_div_comm hpm hpn] using hpd3,
have hpd5 : p ∣ (m / p^k) ∨ p ∣ (n / p^l), from (prime.dvd_mul p_prime).1 hpd4,
suffices p^k*p ∣ m ∨ p^l*p ∣ n, by rwa [pow_succ', pow_succ'],
hpd5.elim
Expand Down
2 changes: 1 addition & 1 deletion src/deprecated/subfield.lean
Expand Up @@ -77,7 +77,7 @@ lemma closure.is_submonoid : is_submonoid (closure S) :=
is_submonoid.mul_mem ring.closure.is_subring.to_is_submonoid hp hr,
q * s,
is_submonoid.mul_mem ring.closure.is_subring.to_is_submonoid hq hs,
(div_mul_div _ _ _ _).symm⟩,
(div_mul_div_comm₀ _ _ _ _).symm⟩,
one_mem := ring_closure_subset $ is_submonoid.one_mem ring.closure.is_subring.to_is_submonoid }

lemma closure.is_subfield : is_subfield (closure S) :=
Expand Down
14 changes: 7 additions & 7 deletions src/field_theory/ratfunc.lean
Expand Up @@ -572,7 +572,7 @@ def lift_monoid_with_zero_hom (φ : R[X] →*₀ G₀) (hφ : R[X]⁰ ≤ G₀
simp only [map_one, submonoid.coe_one, div_one] },
map_mul' := λ x y, by { cases x, cases y, induction x with p q, induction y with p' q',
{ rw [←of_fraction_ring_mul, localization.mk_mul],
simp only [lift_on_of_fraction_ring_mk, div_mul_div, map_mul, submonoid.coe_mul] },
simp only [lift_on_of_fraction_ring_mk, div_mul_div_comm₀, map_mul, submonoid.coe_mul] },
{ refl },
{ refl } },
map_zero' := by { rw [←of_fraction_ring_zero, ←localization.mk_zero (1 : R[X]⁰),
Expand Down Expand Up @@ -1037,7 +1037,7 @@ end
lemma num_denom_mul (x y : ratfunc K) :
(x * y).num * (x.denom * y.denom) = x.num * y.num * (x * y).denom :=
(num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr $
by conv_lhs { rw [← num_div_denom x, ← num_div_denom y, div_mul_div,
by conv_lhs { rw [← num_div_denom x, ← num_div_denom y, div_mul_div_comm₀,
← ring_hom.map_mul, ← ring_hom.map_mul] }

lemma num_dvd {x : ratfunc K} {p : K[X]} (hp : p ≠ 0) :
Expand All @@ -1047,7 +1047,7 @@ begin
{ rintro ⟨q, rfl⟩,
obtain ⟨hx, hq⟩ := mul_ne_zero_iff.mp hp,
use denom x * q,
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div, div_self, mul_one, num_div_denom],
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div_comm₀, div_self, mul_one, num_div_denom],
{ exact ⟨mul_ne_zero (denom_ne_zero x) hq, rfl⟩ },
{ exact algebra_map_ne_zero hq } },
{ rintro ⟨q, hq, rfl⟩,
Expand All @@ -1061,7 +1061,7 @@ begin
{ rintro ⟨p, rfl⟩,
obtain ⟨hx, hp⟩ := mul_ne_zero_iff.mp hq,
use num x * p,
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div, div_self, mul_one, num_div_denom],
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div_comm₀, div_self, mul_one, num_div_denom],
{ exact algebra_map_ne_zero hp } },
{ rintro ⟨p, rfl⟩,
exact denom_div_dvd p q },
Expand All @@ -1075,14 +1075,14 @@ begin
{ simp [hy] },
rw num_dvd (mul_ne_zero (num_ne_zero hx) (num_ne_zero hy)),
refine ⟨x.denom * y.denom, mul_ne_zero (denom_ne_zero x) (denom_ne_zero y), _⟩,
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div, num_div_denom, num_div_denom]
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div_comm₀, num_div_denom, num_div_denom]
end

lemma denom_mul_dvd (x y : ratfunc K) : denom (x * y) ∣ denom x * denom y :=
begin
rw denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y)),
refine ⟨x.num * y.num, _⟩,
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div, num_div_denom, num_div_denom]
rw [ring_hom.map_mul, ring_hom.map_mul, ← div_mul_div_comm₀, num_div_denom, num_div_denom]
end

lemma denom_add_dvd (x y : ratfunc K) : denom (x + y) ∣ denom x * denom y :=
Expand Down Expand Up @@ -1234,7 +1234,7 @@ begin
{ have := polynomial.eval₂_eq_zero_of_dvd_of_eval₂_eq_zero f a (denom_mul_dvd x y) hxy,
rw polynomial.eval₂_mul at this,
cases mul_eq_zero.mp this; contradiction },
rw [div_mul_div, eq_div_iff (mul_ne_zero hx hy), div_eq_mul_inv, mul_right_comm,
rw [div_mul_div_comm₀, eq_div_iff (mul_ne_zero hx hy), div_eq_mul_inv, mul_right_comm,
← div_eq_mul_inv, div_eq_iff hxy],
repeat { rw ← polynomial.eval₂_mul },
congr' 1,
Expand Down
2 changes: 1 addition & 1 deletion src/field_theory/subfield.lean
Expand Up @@ -422,7 +422,7 @@ def closure (s : set K) : subfield K :=
obtain ⟨ny, hny, dy, hdy, rfl⟩ := id y_mem,
exact ⟨nx * ny, subring.mul_mem _ hnx hny,
dx * dy, subring.mul_mem _ hdx hdy,
(div_mul_div _ _ _ _).symm⟩
(div_mul_div_comm₀ _ _ _ _).symm⟩
end }

lemma mem_closure_iff {s : set K} {x} :
Expand Down
2 changes: 1 addition & 1 deletion src/linear_algebra/affine_space/affine_map.lean
Expand Up @@ -182,7 +182,7 @@ def mk' (f : P1 → P2) (f' : V1 →ₗ[k] V2) (p : P1) (h : ∀ p' : P1, f p' =
instance : add_comm_group (P1 →ᵃ[k] V2) :=
{ zero := ⟨0, 0, λ p v, (zero_vadd _ _).symm⟩,
add := λ f g, ⟨f + g, f.linear + g.linear, λ p v, by simp [add_add_add_comm]⟩,
sub := λ f g, ⟨f - g, f.linear - g.linear, λ p v, by simp [sub_add_comm]⟩,
sub := λ f g, ⟨f - g, f.linear - g.linear, λ p v, by simp [sub_add_sub_comm]⟩,
sub_eq_add_neg := λ f g, ext $ λ p, sub_eq_add_neg _ _,
neg := λ f, ⟨-f, -f.linear, λ p v, by simp [add_comm]⟩,
add_assoc := λ f₁ f₂ f₃, ext $ λ p, add_assoc _ _ _,
Expand Down
2 changes: 1 addition & 1 deletion src/measure_theory/integral/mean_inequalities.lean
Expand Up @@ -264,7 +264,7 @@ begin
have hpq2 : p * q2 = r,
{ rw [← inv_inv r, ← one_div, ← one_div, h_one_div_r],
field_simp [q2, real.conjugate_exponent, p2, hp0_ne, hq0_ne] },
simp_rw [div_mul_div, mul_one, mul_comm p2, mul_comm q2, hpp2, hpq2],
simp_rw [div_mul_div_comm₀, mul_one, mul_comm p2, mul_comm q2, hpp2, hpq2],
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/number_theory/cyclotomic/discriminant.lean
Expand Up @@ -47,8 +47,8 @@ begin
← hζ.minpoly_eq_cyclotomic_of_irreducible hirr, totient_prime hp.out],
congr' 1,
{ have h := even_sub_one_of_prime_ne_two hp.out hodd',
rw [← mul_one 2, ← nat.div_mul_div (even_iff_two_dvd.1 h) (one_dvd _), nat.div_one, mul_one,
mul_comm, pow_mul],
rw [← mul_one 2, ← nat.div_mul_div_comm (even_iff_two_dvd.1 h) (one_dvd _), nat.div_one,
mul_one, mul_comm, pow_mul],
congr' 1,
exact neg_one_pow_of_odd (even.sub_odd (one_le_iff_ne_zero.2 hpos.ne.symm) h (odd_iff.2 rfl)) },
{ have H := congr_arg derivative (cyclotomic_prime_mul_X_sub_one K p),
Expand Down
2 changes: 1 addition & 1 deletion src/number_theory/liouville/liouville_with.lean
Expand Up @@ -111,7 +111,7 @@ begin
refine ⟨r.denom ^ p * (|r| * C), (tendsto_id.nsmul_at_top r.pos).frequently (hC.mono _)⟩,
rintro n ⟨hn, m, hne, hlt⟩,
have A : (↑(r.num * m) : ℝ) / ↑(r.denom • id n) = (m / n) * r,
by simp [← div_mul_div, ← r.cast_def, mul_comm],
by simp [← div_mul_div_comm₀, ← r.cast_def, mul_comm],
refine ⟨r.num * m, _, _⟩,
{ rw A, simp [hne, hr] },
{ rw [A, ← sub_mul, abs_mul],
Expand Down

0 comments on commit e823109

Please sign in to comment.