Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - refactor(analysis/analytic/basic): refactor change_origin #8282

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6b91db1
Snapshot
urkud Feb 19, 2021
322e7d4
Merge branch 'master' into change-origin
urkud Feb 25, 2021
5f33328
Snapshot
urkud Feb 25, 2021
8a9643d
Snapshot
urkud Feb 27, 2021
b18a715
Merge branch 'master' into change-origin
urkud Apr 4, 2021
4fb38f1
chore(data/real/nnreal): use `function.injective.*` constructors
urkud Apr 4, 2021
2f4dee3
Fix compile
urkud Apr 4, 2021
f899c2f
Merge commit '4fb38f122' into change-origin
urkud Apr 4, 2021
b3e5eab
Merge branch 'nnreal-instance' into change-origin
urkud Apr 4, 2021
cf32258
Snapshot
urkud Apr 6, 2021
2738fff
Snapshot
urkud Apr 6, 2021
e7b995c
Snapshot
urkud Apr 8, 2021
96f9d69
Merge branch 'master' into change-origin
urkud Apr 11, 2021
1376ca1
Merge branch 'master' into change-origin
urkud Jun 21, 2021
e21d263
Merge branch 'master' into change-origin
urkud Jul 10, 2021
38cb0c7
Remove some unneeded inequalities
urkud Jul 10, 2021
84a6bbb
Merge branch 'master' into change-origin
urkud Jul 11, 2021
20fbfbe
Snapshot
urkud Jul 11, 2021
67e29c7
Fix
urkud Jul 11, 2021
e755bc1
Fix, use notation
urkud Jul 11, 2021
da9e6c4
Fix
urkud Jul 11, 2021
d6e3882
Fix
urkud Jul 12, 2021
3a80cb9
Add docs
urkud Jul 12, 2021
64b002a
Merge branch 'master' into change-origin
urkud Jul 13, 2021
ca487ec
Snapshot
urkud Jul 13, 2021
dc0ccb7
Merge branch 'mul-le-mul' into change-origin
urkud Jul 13, 2021
9faa67a
speedup
sgouezel Jul 13, 2021
97537c3
use coercion
sgouezel Jul 13, 2021
6132c01
Merge remote-tracking branch 'origin/speedup_gromov' into change-origin
urkud Jul 13, 2021
7af6623
Merge branch 'master' into change-origin
urkud Jul 13, 2021
f2d7c7d
Update src/analysis/analytic/basic.lean
urkud Jul 13, 2021
c56100e
Merge branch 'master' into change-origin
urkud Jul 15, 2021
9bc04ed
Merge branch 'change-origin' of git://github.com/leanprover-community…
urkud Jul 15, 2021
eb57023
Fix docs and a whitespace
urkud Jul 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/algebra/big_operators/order.lean
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ begin
induction s using finset.induction with a s has ih h,
{ simp },
{ rw [finset.prod_insert has, finset.prod_insert has],
apply canonically_ordered_semiring.mul_le_mul,
apply mul_le_mul',
{ exact h _ (finset.mem_insert_self a s) },
{ exact ih (λ i hi, h _ (finset.mem_insert_of_mem hi)) } }
end
Expand All @@ -418,9 +418,9 @@ lemma prod_add_prod_le' (hi : i ∈ s) (h2i : g i + h i ≤ f i)
∏ i in s, g i + ∏ i in s, h i ≤ ∏ i in s, f i :=
begin
classical, simp_rw [prod_eq_mul_prod_diff_singleton hi],
refine le_trans _ (canonically_ordered_semiring.mul_le_mul_right' h2i _),
refine le_trans _ (mul_le_mul_right' h2i _),
rw [right_distrib],
apply add_le_add; apply canonically_ordered_semiring.mul_le_mul_left'; apply prod_le_prod';
apply add_le_add; apply mul_le_mul_left'; apply prod_le_prod';
simp only [and_imp, mem_sdiff, mem_singleton]; intros; apply_assumption; assumption
end

Expand Down
10 changes: 5 additions & 5 deletions src/algebra/group_power/order.lean
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,25 @@ end

end cancel_add_monoid

namespace canonically_ordered_semiring
namespace canonically_ordered_comm_semiring
variable [canonically_ordered_comm_semiring R]

theorem pow_pos {a : R} (H : 0 < a) : ∀ n : ℕ, 0 < a ^ n
| 0 := by { nontriviality, rw pow_zero, exact canonically_ordered_semiring.zero_lt_one }
| (n+1) := by { rw pow_succ, exact canonically_ordered_semiring.mul_pos.2 ⟨H, pow_pos n⟩ }
| 0 := by { nontriviality, rw pow_zero, exact zero_lt_one }
| (n+1) := by { rw pow_succ, exact mul_pos.2 ⟨H, pow_pos n⟩ }

@[mono] lemma pow_le_pow_of_le_left {a b : R} (hab : a ≤ b) : ∀ i : ℕ, a^i ≤ b^i
| 0 := by simp
| (k+1) := by { rw [pow_succ, pow_succ],
exact canonically_ordered_semiring.mul_le_mul hab (pow_le_pow_of_le_left k) }
exact mul_le_mul' hab (pow_le_pow_of_le_left k) }

theorem one_le_pow_of_one_le {a : R} (H : 1 ≤ a) (n : ℕ) : 1 ≤ a ^ n :=
by simpa only [one_pow] using pow_le_pow_of_le_left H n

theorem pow_le_one {a : R} (H : a ≤ 1) (n : ℕ) : a ^ n ≤ 1:=
by simpa only [one_pow] using pow_le_pow_of_le_left H n

end canonically_ordered_semiring
end canonically_ordered_comm_semiring

section ordered_semiring
variable [ordered_semiring R]
Expand Down
26 changes: 9 additions & 17 deletions src/algebra/ordered_ring.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1333,37 +1333,29 @@ class canonically_ordered_comm_semiring (α : Type*) extends
canonically_ordered_add_monoid α, comm_semiring α :=
(eq_zero_or_eq_zero_of_mul_eq_zero : ∀ a b : α, a * b = 0 → a = 0 ∨ b = 0)

namespace canonically_ordered_semiring
namespace canonically_ordered_comm_semiring
variables [canonically_ordered_comm_semiring α] {a b : α}

open canonically_ordered_add_monoid (le_iff_exists_add)

@[priority 100] -- see Note [lower instance priority]
instance canonically_ordered_comm_semiring.to_no_zero_divisors :
no_zero_divisors α :=
instance to_no_zero_divisors : no_zero_divisors α :=
⟨canonically_ordered_comm_semiring.eq_zero_or_eq_zero_of_mul_eq_zero⟩

lemma mul_le_mul {a b c d : α} (hab : a ≤ b) (hcd : c ≤ d) : a * c ≤ b * d :=
@[priority 100] -- see Note [lower instance priority]
instance to_covariant_mul_le : covariant_class α α (*) (≤) :=
begin
rcases (le_iff_exists_add _ _).1 hab with ⟨b, rfl⟩,
rcases (le_iff_exists_add _ _).1 hcd with ⟨d, rfl⟩,
suffices : a * c ≤ a * c + (a * d + b * c + b * d), by simpa [mul_add, add_mul, add_assoc],
exact (le_iff_exists_add _ _).2 ⟨_, rfl⟩
refine ⟨λ a b c h, _⟩,
rcases le_iff_exists_add.1 h with ⟨c, rfl⟩,
rw mul_add,
apply self_le_add_right
end

lemma mul_le_mul_left' {b c : α} (h : b ≤ c) (a : α) : a * b ≤ a * c :=
mul_le_mul le_rfl h

lemma mul_le_mul_right' {b c : α} (h : b ≤ c) (a : α) : b * a ≤ c * a :=
mul_le_mul h le_rfl

/-- A version of `zero_lt_one : 0 < 1` for a `canonically_ordered_comm_semiring`. -/
lemma zero_lt_one [nontrivial α] : (0:α) < 1 := (zero_le 1).lt_of_ne zero_ne_one

lemma mul_pos : 0 < a * b ↔ (0 < a) ∧ (0 < b) :=
by simp only [pos_iff_ne_zero, ne.def, mul_eq_zero, not_or_distrib]

end canonically_ordered_semiring
end canonically_ordered_comm_semiring

/-! ### Structures involving `*` and `0` on `with_top` and `with_bot`

Expand Down
2 changes: 1 addition & 1 deletion src/algebra/squarefree.lean
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ begin
simp only [finset.sep_def, S, finset.mem_filter, finset.mem_range] at hs,
obtain ⟨hsn1, ⟨a, hsa⟩, ⟨b, hsb⟩⟩ := hs,
rw hsa at hn,
obtain ⟨hlts, hlta⟩ := canonically_ordered_semiring.mul_pos.mp hn,
obtain ⟨hlts, hlta⟩ := canonically_ordered_comm_semiring.mul_pos.mp hn,
rw hsb at hsa hn hlts,
refine ⟨a, b, hlta, (pow_pos_iff zero_lt_two).mp hlts, hsa.symm, _⟩,
rintro x ⟨y, hy⟩,
Expand Down