Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 74ca892

Browse files
committed
Merge remote-tracking branch 'origin/master' into shuffle_nnrat
2 parents 594002c + 1f4705c commit 74ca892

File tree

43 files changed

+543
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+543
-144
lines changed

src/algebra/algebra/subalgebra/pointwise.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import ring_theory.adjoin.basic
1111
/-!
1212
# Pointwise actions on subalgebras.
1313
14+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
15+
> Any changes to this file require a corresponding PR to mathlib4.
16+
1417
If `R'` acts on an `R`-algebra `A` (so that `R'` and `R` actions commute)
1518
then we get an `R'` action on the collection of `R`-subalgebras.
1619
-/

src/algebra/algebra/unitization.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import algebra.hom.non_unital_alg
1111
/-!
1212
# Unitization of a non-unital algebra
1313
14+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
15+
> Any changes to this file require a corresponding PR to mathlib4.
16+
1417
Given a non-unital `R`-algebra `A` (given via the type classes
1518
`[non_unital_ring A] [module R A] [smul_comm_class R A A] [is_scalar_tower R A A]`) we construct
1619
the minimal unital `R`-algebra containing `A` as an ideal. This object `algebra.unitization R A` is

src/algebra/char_p/exp_char.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import data.nat.prime
99
/-!
1010
# Exponential characteristic
1111
12+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
13+
> Any changes to this file require a corresponding PR to mathlib4.
14+
1215
This file defines the exponential characteristic and establishes a few basic results relating
1316
it to the (ordinary characteristic).
1417
The definition is stated for a semiring, but the actual results are for nontrivial rings

src/algebra/direct_sum/module.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import linear_algebra.dfinsupp
99
/-!
1010
# Direct sum of modules
1111
12+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
13+
> Any changes to this file require a corresponding PR to mathlib4.
14+
1215
The first part of the file provides constructors for direct sums of modules. It provides a
1316
construction of the direct sum using the universal property and proves its uniqueness
1417
(`direct_sum.to_module.unique`).

src/algebra/field/ulift.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import algebra.ring.ulift
99
/-!
1010
# Field instances for `ulift`
1111
12+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
13+
> Any changes to this file require a corresponding PR to mathlib4.
14+
1215
This file defines instances for field, semifield and related structures on `ulift` types.
1316
1417
(Recall `ulift α` is just a "copy" of a type `α` in a higher universe.)

src/algebra/monoid_algebra/degree.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import algebra.monoid_algebra.support
88
/-!
99
# Lemmas about the `sup` and `inf` of the support of `add_monoid_algebra`
1010
11+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
12+
> Any changes to this file require a corresponding PR to mathlib4.
13+
1114
## TODO
1215
The current plan is to state and prove lemmas about `finset.sup (finsupp.support f) D` with a
1316
"generic" degree/weight function `D` from the grading Type `A` to a somewhat ordered Type `B`.

src/algebra/monoid_algebra/no_zero_divisors.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import algebra.monoid_algebra.support
88
/-!
99
# Variations on non-zero divisors in `add_monoid_algebra`s
1010
11+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
12+
> Any changes to this file require a corresponding PR to mathlib4.
13+
1114
This file studies the interaction between typeclass assumptions on two Types `R` and `A` and
1215
whether `add_monoid_algebra R A` has non-zero zero-divisors. For some background on related
1316
questions, see [Kaplansky's Conjectures](https://en.wikipedia.org/wiki/Kaplansky%27s_conjectures),

src/algebra/quadratic_discriminant.lean

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ This file defines the discriminant of a quadratic and gives the solution to a qu
2525
- `quadratic_ne_zero_of_discrim_ne_sq`: if the discriminant has no square root,
2626
then the corresponding quadratic has no root.
2727
- `discrim_le_zero`: if a quadratic is always non-negative, then its discriminant is non-positive.
28+
- `discrim_le_zero_of_nonpos`, `discrim_lt_zero`, `discrim_lt_zero_of_neg`: versions of this
29+
statement with other inequalities.
2830
2931
## Tags
3032
@@ -39,46 +41,47 @@ variables {R : Type*}
3941
/-- Discriminant of a quadratic -/
4042
def discrim [ring R] (a b c : R) : R := b^2 - 4 * a * c
4143

42-
variables [comm_ring R] [is_domain R] {a b c : R}
44+
@[simp] lemma discrim_neg [ring R] (a b c : R) : discrim (-a) (-b) (-c) = discrim a b c :=
45+
by simp [discrim]
46+
47+
variables [comm_ring R] {a b c : R}
48+
49+
lemma discrim_eq_sq_of_quadratic_eq_zero {x : R} (h : a * x * x + b * x + c = 0) :
50+
discrim a b c = (2 * a * x + b) ^ 2 :=
51+
begin
52+
rw [discrim],
53+
linear_combination -4 * a * h
54+
end
4355

4456
/--
4557
A quadratic has roots if and only if its discriminant equals some square.
4658
-/
47-
lemma quadratic_eq_zero_iff_discrim_eq_sq (h2 : (2 : R) ≠ 0) (ha : a ≠ 0) (x : R) :
59+
lemma quadratic_eq_zero_iff_discrim_eq_sq [ne_zero (2 : R)] [no_zero_divisors R]
60+
(ha : a ≠ 0) {x : R} :
4861
a * x * x + b * x + c = 0 ↔ discrim a b c = (2 * a * x + b) ^ 2 :=
4962
begin
50-
dsimp [discrim] at *,
51-
split,
52-
{ assume h,
53-
linear_combination -4 * a * h },
54-
{ assume h,
55-
have ha : 2 * 2 * a ≠ 0 := mul_ne_zero (mul_ne_zero h2 h2) ha,
56-
apply mul_left_cancel₀ ha,
57-
linear_combination -h }
63+
refine ⟨discrim_eq_sq_of_quadratic_eq_zero, λ h, _⟩,
64+
rw [discrim] at h,
65+
have ha : 2 * 2 * a ≠ 0 := mul_ne_zero (mul_ne_zero (ne_zero.ne _) (ne_zero.ne _)) ha,
66+
apply mul_left_cancel₀ ha,
67+
linear_combination -h
5868
end
5969

6070
/-- A quadratic has no root if its discriminant has no square root. -/
61-
lemma quadratic_ne_zero_of_discrim_ne_sq (h2 : (2 : R) ≠ 0) (ha : a ≠ 0)
62-
(h : ∀ s : R, discrim a b c ≠ s * s) (x : R) :
71+
lemma quadratic_ne_zero_of_discrim_ne_sq (h : ∀ s : R, discrim a b c ≠ s^2) (x : R) :
6372
a * x * x + b * x + c ≠ 0 :=
64-
begin
65-
assume h',
66-
rw [quadratic_eq_zero_iff_discrim_eq_sq h2 ha, sq] at h',
67-
exact h _ h'
68-
end
73+
mt discrim_eq_sq_of_quadratic_eq_zero $ h _
6974

7075
end ring
7176

7277
section field
73-
variables {K : Type*} [field K] [invertible (2 : K)] {a b c x : K}
78+
variables {K : Type*} [field K] [ne_zero (2 : K)] {a b c x : K}
7479

75-
/-- Roots of a quadratic -/
80+
/-- Roots of a quadratic equation. -/
7681
lemma quadratic_eq_zero_iff (ha : a ≠ 0) {s : K} (h : discrim a b c = s * s) (x : K) :
7782
a * x * x + b * x + c = 0 ↔ x = (-b + s) / (2 * a) ∨ x = (-b - s) / (2 * a) :=
7883
begin
79-
have h2 : (2 : K) ≠ 0 := nonzero_of_invertible 2,
80-
rw [quadratic_eq_zero_iff_discrim_eq_sq h2 ha, h, sq, mul_self_eq_mul_self_iff],
81-
have ne : 2 * a ≠ 0 := mul_ne_zero h2 ha,
84+
rw [quadratic_eq_zero_iff_discrim_eq_sq ha, h, sq, mul_self_eq_mul_self_iff],
8285
field_simp,
8386
apply or_congr,
8487
{ split; intro h'; linear_combination -h' },
@@ -108,7 +111,7 @@ end field
108111
section linear_ordered_field
109112
variables {K : Type*} [linear_ordered_field K] {a b c : K}
110113

111-
/-- If a polynomial of degree 2 is always nonnegative, then its discriminant is nonpositive -/
114+
/-- If a polynomial of degree 2 is always nonnegative, then its discriminant is nonpositive. -/
112115
lemma discrim_le_zero (h : ∀ x : K, 0 ≤ a * x * x + b * x + c) : discrim a b c ≤ 0 :=
113116
begin
114117
rw [discrim, sq],
@@ -120,19 +123,20 @@ begin
120123
rcases (this.eventually (eventually_lt_at_bot 0)).exists with ⟨x, hx⟩,
121124
exact false.elim ((h x).not_lt $ by rwa ← add_mul) },
122125
-- if a = 0
123-
{ rcases em (b = 0) with (rfl|hb),
126+
{ rcases eq_or_ne b 0 with (rfl|hb),
124127
{ simp },
125128
{ have := h ((-c - 1) / b), rw [mul_div_cancel' _ hb] at this, linarith } },
126129
-- if a > 0
127-
{ have := calc
128-
4 * a * (a * (-(b / a) * (1 / 2)) * (-(b / a) * (1 / 2)) + b * (-(b / a) * (1 / 2)) + c)
129-
= (a * (b / a)) * (a * (b / a)) - 2 * (a * (b / a)) * b + 4 * a * c : by ring
130-
... = -(b * b - 4 * a * c) : by { simp only [mul_div_cancel' b (ne_of_gt ha)], ring },
131-
have ha' : 04 * a, by linarith,
132-
have h := (mul_nonneg ha' (h (-(b / a) * (1 / 2)))),
133-
rw this at h, rwa ← neg_nonneg }
130+
{ have ha' : 04 * a := mul_nonneg zero_le_four ha.le,
131+
have := h (-b / (2 * a)),
132+
convert neg_nonpos.2 (mul_nonneg ha' (h (-b / (2 * a)))),
133+
field_simp [ha.ne'],
134+
ring }
134135
end
135136

137+
lemma discrim_le_zero_of_nonpos (h : ∀ x : K, a * x * x + b * x + c ≤ 0) : discrim a b c ≤ 0 :=
138+
discrim_neg a b c ▸ discrim_le_zero (by simpa only [neg_mul, ← neg_add, neg_nonneg])
139+
136140
/--
137141
If a polynomial of degree 2 is always positive, then its discriminant is negative,
138142
at least when the coefficient of the quadratic term is nonzero.
@@ -148,4 +152,8 @@ begin
148152
linarith
149153
end
150154

155+
lemma discrim_lt_zero_of_neg (ha : a ≠ 0) (h : ∀ x : K, a * x * x + b * x + c < 0) :
156+
discrim a b c < 0 :=
157+
discrim_neg a b c ▸ discrim_lt_zero (neg_ne_zero.2 ha) (by simpa only [neg_mul, ← neg_add, neg_pos])
158+
151159
end linear_ordered_field

src/algebra/triv_sq_zero_ext.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import linear_algebra.prod
1010
/-!
1111
# Trivial Square-Zero Extension
1212
13+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
14+
> Any changes to this file require a corresponding PR to mathlib4.
15+
1316
Given a ring `R` together with an `(R, R)`-bimodule `M`, the trivial square-zero extension of `M`
1417
over `R` is defined to be the `R`-algebra `R ⊕ M` with multiplication given by
1518
`(r₁ + m₁) * (r₂ + m₂) = r₁ r₂ + r₁ m₂ + m₁ r₂`.

src/category_theory/category/Bipointed.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import category_theory.category.Pointed
88
/-!
99
# The category of bipointed types
1010
11+
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
12+
> Any changes to this file require a corresponding PR to mathlib4.
13+
1114
This defines `Bipointed`, the category of bipointed types.
1215
1316
## TODO

0 commit comments

Comments
 (0)