Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | num_lines int64 1 150 |
|---|---|---|---|---|---|---|
import Mathlib.Data.List.Duplicate
import Mathlib.Data.List.Sort
#align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace List
variable {α : Type*}
section Sublist
theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ)
(hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by
induction' l with hd tl IH generalizing l' f
· simp
have : some hd = _ := hf 0
rw [eq_comm, List.get?_eq_some] at this
obtain ⟨w, h⟩ := this
let f' : ℕ ↪o ℕ :=
OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by
dsimp only
rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact b.succ_pos
have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by
intro ix
rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact ix.succ_pos
rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append]
apply List.Sublist.append _ (IH _ this)
rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)]
apply List.get_mem
#align list.sublist_of_order_embedding_nth_eq List.sublist_of_orderEmbedding_get?_eq
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
constructor
· intro H
induction' H with xs ys y _H IH xs ys x _H IH
· simp
· obtain ⟨f, hf⟩ := IH
refine ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), ?_⟩
simpa using hf
· obtain ⟨f, hf⟩ := IH
refine
⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) ?_, ?_⟩
· rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
· rintro ⟨_ | i⟩
· simp
· simpa using hf _
· rintro ⟨f, hf⟩
exact sublist_of_orderEmbedding_get?_eq f hf
#align list.sublist_iff_exists_order_embedding_nth_eq List.sublist_iff_exists_orderEmbedding_get?_eq
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
l <+ l' ↔
∃ f : Fin l.length ↪o Fin l'.length,
∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
rw [sublist_iff_exists_orderEmbedding_get?_eq]
constructor
· rintro ⟨f, hf⟩
have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
intro i hi
specialize hf i
rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
obtain ⟨h, -⟩ := hf
exact h
refine ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) ?_, ?_⟩
· simp
· intro i
apply Option.some_injective
simpa [get?_eq_get i.2, get?_eq_get (h i.2)] using hf i
· rintro ⟨f, hf⟩
refine
⟨OrderEmbedding.ofStrictMono (fun i => if hi : i < l.length then f ⟨i, hi⟩ else i + l'.length)
?_,
?_⟩
· intro i j h
dsimp only
split_ifs with hi hj hj
· rwa [Fin.val_fin_lt, f.lt_iff_lt]
· have := (f ⟨i, hi⟩).is_lt
omega
· exact absurd (h.trans hj) hi
· simpa using h
· intro i
simp only [OrderEmbedding.coe_ofStrictMono]
split_ifs with hi
· rw [get?_eq_get hi, get?_eq_get, ← hf]
· rw [get?_eq_none.mpr, get?_eq_none.mpr]
· simp
· simpa using hi
#align list.sublist_iff_exists_fin_order_embedding_nth_le_eq List.sublist_iff_exists_fin_orderEmbedding_get_eq
| Mathlib/Data/List/NodupEquivFin.lean | 211 | 232 | theorem duplicate_iff_exists_distinct_get {l : List α} {x : α} :
l.Duplicate x ↔
∃ (n m : Fin l.length) (_ : n < m),
x = l.get n ∧ x = l.get m := by |
classical
rw [duplicate_iff_two_le_count, le_count_iff_replicate_sublist,
sublist_iff_exists_fin_orderEmbedding_get_eq]
constructor
· rintro ⟨f, hf⟩
refine ⟨f ⟨0, by simp⟩, f ⟨1, by simp⟩, f.lt_iff_lt.2 (Nat.zero_lt_one), ?_⟩
rw [← hf, ← hf]; simp
· rintro ⟨n, m, hnm, h, h'⟩
refine ⟨OrderEmbedding.ofStrictMono (fun i => if (i : ℕ) = 0 then n else m) ?_, ?_⟩
· rintro ⟨⟨_ | i⟩, hi⟩ ⟨⟨_ | j⟩, hj⟩
· simp
· simp [hnm]
· simp
· simp only [Nat.lt_succ_iff, Nat.succ_le_succ_iff, replicate, length, Nat.le_zero] at hi hj
simp [hi, hj]
· rintro ⟨⟨_ | i⟩, hi⟩
· simpa using h
· simpa using h'
| 18 |
import Mathlib.Algebra.IsPrimePow
import Mathlib.Algebra.Squarefree.Basic
import Mathlib.Order.Hom.Bounded
import Mathlib.Algebra.GCDMonoid.Basic
#align_import ring_theory.chain_of_divisors from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {M : Type*} [CancelCommMonoidWithZero M]
theorem Associates.isAtom_iff {p : Associates M} (h₁ : p ≠ 0) : IsAtom p ↔ Irreducible p :=
⟨fun hp =>
⟨by simpa only [Associates.isUnit_iff_eq_one] using hp.1, fun a b h =>
(hp.le_iff.mp ⟨_, h⟩).casesOn (fun ha => Or.inl (a.isUnit_iff_eq_one.mpr ha)) fun ha =>
Or.inr
(show IsUnit b by
rw [ha] at h
apply isUnit_of_associated_mul (show Associated (p * b) p by conv_rhs => rw [h]) h₁)⟩,
fun hp =>
⟨by simpa only [Associates.isUnit_iff_eq_one, Associates.bot_eq_one] using hp.1,
fun b ⟨⟨a, hab⟩, hb⟩ =>
(hp.isUnit_or_isUnit hab).casesOn
(fun hb => show b = ⊥ by rwa [Associates.isUnit_iff_eq_one, ← Associates.bot_eq_one] at hb)
fun ha =>
absurd
(show p ∣ b from
⟨(ha.unit⁻¹ : Units _), by rw [hab, mul_assoc, IsUnit.mul_val_inv ha, mul_one]⟩)
hb⟩⟩
#align associates.is_atom_iff Associates.isAtom_iff
open UniqueFactorizationMonoid multiplicity Irreducible Associates
namespace DivisorChain
theorem exists_chain_of_prime_pow {p : Associates M} {n : ℕ} (hn : n ≠ 0) (hp : Prime p) :
∃ c : Fin (n + 1) → Associates M,
c 1 = p ∧ StrictMono c ∧ ∀ {r : Associates M}, r ≤ p ^ n ↔ ∃ i, r = c i := by
refine ⟨fun i => p ^ (i : ℕ), ?_, fun n m h => ?_, @fun y => ⟨fun h => ?_, ?_⟩⟩
· dsimp only
rw [Fin.val_one', Nat.mod_eq_of_lt, pow_one]
exact Nat.lt_succ_of_le (Nat.one_le_iff_ne_zero.mpr hn)
· exact Associates.dvdNotUnit_iff_lt.mp
⟨pow_ne_zero n hp.ne_zero, p ^ (m - n : ℕ),
not_isUnit_of_not_isUnit_dvd hp.not_unit (dvd_pow dvd_rfl (Nat.sub_pos_of_lt h).ne'),
(pow_mul_pow_sub p h.le).symm⟩
· obtain ⟨i, i_le, hi⟩ := (dvd_prime_pow hp n).1 h
rw [associated_iff_eq] at hi
exact ⟨⟨i, Nat.lt_succ_of_le i_le⟩, hi⟩
· rintro ⟨i, rfl⟩
exact ⟨p ^ (n - i : ℕ), (pow_mul_pow_sub p (Nat.succ_le_succ_iff.mp i.2)).symm⟩
#align divisor_chain.exists_chain_of_prime_pow DivisorChain.exists_chain_of_prime_pow
theorem element_of_chain_not_isUnit_of_index_ne_zero {n : ℕ} {i : Fin (n + 1)} (i_pos : i ≠ 0)
{c : Fin (n + 1) → Associates M} (h₁ : StrictMono c) : ¬IsUnit (c i) :=
DvdNotUnit.not_unit
(Associates.dvdNotUnit_iff_lt.2
(h₁ <| show (0 : Fin (n + 1)) < i from Fin.pos_iff_ne_zero.mpr i_pos))
#align divisor_chain.element_of_chain_not_is_unit_of_index_ne_zero DivisorChain.element_of_chain_not_isUnit_of_index_ne_zero
theorem first_of_chain_isUnit {q : Associates M} {n : ℕ} {c : Fin (n + 1) → Associates M}
(h₁ : StrictMono c) (h₂ : ∀ {r}, r ≤ q ↔ ∃ i, r = c i) : IsUnit (c 0) := by
obtain ⟨i, hr⟩ := h₂.mp Associates.one_le
rw [Associates.isUnit_iff_eq_one, ← Associates.le_one_iff, hr]
exact h₁.monotone (Fin.zero_le i)
#align divisor_chain.first_of_chain_is_unit DivisorChain.first_of_chain_isUnit
theorem second_of_chain_is_irreducible {q : Associates M} {n : ℕ} (hn : n ≠ 0)
{c : Fin (n + 1) → Associates M} (h₁ : StrictMono c) (h₂ : ∀ {r}, r ≤ q ↔ ∃ i, r = c i)
(hq : q ≠ 0) : Irreducible (c 1) := by
cases' n with n; · contradiction
refine (Associates.isAtom_iff (ne_zero_of_dvd_ne_zero hq (h₂.2 ⟨1, rfl⟩))).mp ⟨?_, fun b hb => ?_⟩
· exact ne_bot_of_gt (h₁ (show (0 : Fin (n + 2)) < 1 from Fin.one_pos))
obtain ⟨⟨i, hi⟩, rfl⟩ := h₂.1 (hb.le.trans (h₂.2 ⟨1, rfl⟩))
cases i
· exact (Associates.isUnit_iff_eq_one _).mp (first_of_chain_isUnit h₁ @h₂)
· simpa [Fin.lt_iff_val_lt_val] using h₁.lt_iff_lt.mp hb
#align divisor_chain.second_of_chain_is_irreducible DivisorChain.second_of_chain_is_irreducible
| Mathlib/RingTheory/ChainOfDivisors.lean | 111 | 132 | theorem eq_second_of_chain_of_prime_dvd {p q r : Associates M} {n : ℕ} (hn : n ≠ 0)
{c : Fin (n + 1) → Associates M} (h₁ : StrictMono c)
(h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i) (hp : Prime p) (hr : r ∣ q) (hp' : p ∣ r) :
p = c 1 := by |
cases' n with n
· contradiction
obtain ⟨i, rfl⟩ := h₂.1 (dvd_trans hp' hr)
refine congr_arg c (eq_of_ge_of_not_gt ?_ fun hi => ?_)
· rw [Fin.le_iff_val_le_val, Fin.val_one, Nat.succ_le_iff, ← Fin.val_zero' (n.succ + 1), ←
Fin.lt_iff_val_lt_val, Fin.pos_iff_ne_zero]
rintro rfl
exact hp.not_unit (first_of_chain_isUnit h₁ @h₂)
obtain rfl | ⟨j, rfl⟩ := i.eq_zero_or_eq_succ
· cases hi
refine
not_irreducible_of_not_unit_dvdNotUnit
(DvdNotUnit.not_unit
(Associates.dvdNotUnit_iff_lt.2 (h₁ (show (0 : Fin (n + 2)) < j from ?_))))
?_ hp.irreducible
· simpa [Fin.succ_lt_succ_iff, Fin.lt_iff_val_lt_val] using hi
· refine Associates.dvdNotUnit_iff_lt.2 (h₁ ?_)
simpa only [Fin.coe_eq_castSucc] using Fin.lt_succ
| 18 |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.GeomSum
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.Log
import Mathlib.Data.Nat.Prime
import Mathlib.Data.Nat.Digits
import Mathlib.RingTheory.Multiplicity
#align_import data.nat.multiplicity from "leanprover-community/mathlib"@"ceb887ddf3344dab425292e497fa2af91498437c"
open Finset Nat multiplicity
open Nat
namespace Nat
theorem multiplicity_eq_card_pow_dvd {m n b : ℕ} (hm : m ≠ 1) (hn : 0 < n) (hb : log m n < b) :
multiplicity m n = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card :=
calc
multiplicity m n = ↑(Ico 1 <| (multiplicity m n).get (finite_nat_iff.2 ⟨hm, hn⟩) + 1).card := by
simp
_ = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card :=
congr_arg _ <|
congr_arg card <|
Finset.ext fun i => by
rw [mem_filter, mem_Ico, mem_Ico, Nat.lt_succ_iff, ← @PartENat.coe_le_coe i,
PartENat.natCast_get, ← pow_dvd_iff_le_multiplicity, and_right_comm]
refine (and_iff_left_of_imp fun h => lt_of_le_of_lt ?_ hb).symm
cases' m with m
· rw [zero_pow, zero_dvd_iff] at h
exacts [(hn.ne' h.2).elim, one_le_iff_ne_zero.1 h.1]
exact le_log_of_pow_le (one_lt_iff_ne_zero_and_ne_one.2 ⟨m.succ_ne_zero, hm⟩)
(le_of_dvd hn h.2)
#align nat.multiplicity_eq_card_pow_dvd Nat.multiplicity_eq_card_pow_dvd
namespace Prime
theorem multiplicity_one {p : ℕ} (hp : p.Prime) : multiplicity p 1 = 0 :=
multiplicity.one_right hp.prime.not_unit
#align nat.prime.multiplicity_one Nat.Prime.multiplicity_one
theorem multiplicity_mul {p m n : ℕ} (hp : p.Prime) :
multiplicity p (m * n) = multiplicity p m + multiplicity p n :=
multiplicity.mul hp.prime
#align nat.prime.multiplicity_mul Nat.Prime.multiplicity_mul
theorem multiplicity_pow {p m n : ℕ} (hp : p.Prime) :
multiplicity p (m ^ n) = n • multiplicity p m :=
multiplicity.pow hp.prime
#align nat.prime.multiplicity_pow Nat.Prime.multiplicity_pow
theorem multiplicity_self {p : ℕ} (hp : p.Prime) : multiplicity p p = 1 :=
multiplicity.multiplicity_self hp.prime.not_unit hp.ne_zero
#align nat.prime.multiplicity_self Nat.Prime.multiplicity_self
theorem multiplicity_pow_self {p n : ℕ} (hp : p.Prime) : multiplicity p (p ^ n) = n :=
multiplicity.multiplicity_pow_self hp.ne_zero hp.prime.not_unit n
#align nat.prime.multiplicity_pow_self Nat.Prime.multiplicity_pow_self
theorem multiplicity_factorial {p : ℕ} (hp : p.Prime) :
∀ {n b : ℕ}, log p n < b → multiplicity p n ! = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ)
| 0, b, _ => by simp [Ico, hp.multiplicity_one]
| n + 1, b, hb =>
calc
multiplicity p (n + 1)! = multiplicity p n ! + multiplicity p (n + 1) := by
rw [factorial_succ, hp.multiplicity_mul, add_comm]
_ = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ) +
((Finset.Ico 1 b).filter fun i => p ^ i ∣ n + 1).card := by
rw [multiplicity_factorial hp ((log_mono_right <| le_succ _).trans_lt hb), ←
multiplicity_eq_card_pow_dvd hp.ne_one (succ_pos _) hb]
_ = (∑ i ∈ Ico 1 b, (n / p ^ i + if p ^ i ∣ n + 1 then 1 else 0) : ℕ) := by
rw [sum_add_distrib, sum_boole]
simp
_ = (∑ i ∈ Ico 1 b, (n + 1) / p ^ i : ℕ) :=
congr_arg _ <| Finset.sum_congr rfl fun _ _ => (succ_div _ _).symm
#align nat.prime.multiplicity_factorial Nat.Prime.multiplicity_factorial
theorem sub_one_mul_multiplicity_factorial {n p : ℕ} (hp : p.Prime) :
(p - 1) * (multiplicity p n !).get (finite_nat_iff.mpr ⟨hp.ne_one, factorial_pos n⟩) =
n - (p.digits n).sum := by
simp only [multiplicity_factorial hp <| lt_succ_of_lt <| lt.base (log p n),
← Finset.sum_Ico_add' _ 0 _ 1, Ico_zero_eq_range,
← sub_one_mul_sum_log_div_pow_eq_sub_sum_digits]
rfl
| Mathlib/Data/Nat/Multiplicity.lean | 138 | 158 | theorem multiplicity_factorial_mul_succ {n p : ℕ} (hp : p.Prime) :
multiplicity p (p * (n + 1))! = multiplicity p (p * n)! + multiplicity p (n + 1) + 1 := by |
have hp' := hp.prime
have h0 : 2 ≤ p := hp.two_le
have h1 : 1 ≤ p * n + 1 := Nat.le_add_left _ _
have h2 : p * n + 1 ≤ p * (n + 1) := by linarith
have h3 : p * n + 1 ≤ p * (n + 1) + 1 := by omega
have hm : multiplicity p (p * n)! ≠ ⊤ := by
rw [Ne, eq_top_iff_not_finite, Classical.not_not, finite_nat_iff]
exact ⟨hp.ne_one, factorial_pos _⟩
revert hm
have h4 : ∀ m ∈ Ico (p * n + 1) (p * (n + 1)), multiplicity p m = 0 := by
intro m hm
rw [multiplicity_eq_zero, ← not_dvd_iff_between_consec_multiples _ hp.pos]
rw [mem_Ico] at hm
exact ⟨n, lt_of_succ_le hm.1, hm.2⟩
simp_rw [← prod_Ico_id_eq_factorial, multiplicity.Finset.prod hp', ← sum_Ico_consecutive _ h1 h3,
add_assoc]
intro h
rw [PartENat.add_left_cancel_iff h, sum_Ico_succ_top h2, multiplicity.mul hp',
hp.multiplicity_self, sum_congr rfl h4, sum_const_zero, zero_add, add_comm (1 : PartENat)]
| 19 |
import Mathlib.Analysis.Fourier.Inversion
open Real Complex Set MeasureTheory
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E]
open scoped FourierTransform
private theorem rexp_neg_deriv_aux :
∀ x ∈ univ, HasDerivWithinAt (rexp ∘ Neg.neg) (-rexp (-x)) univ x :=
fun x _ ↦ mul_neg_one (rexp (-x)) ▸
((Real.hasDerivAt_exp (-x)).comp x (hasDerivAt_neg x)).hasDerivWithinAt
private theorem rexp_neg_image_aux : rexp ∘ Neg.neg '' univ = Ioi 0 := by
rw [Set.image_comp, Set.image_univ_of_surjective neg_surjective, Set.image_univ, Real.range_exp]
private theorem rexp_neg_injOn_aux : univ.InjOn (rexp ∘ Neg.neg) :=
Real.exp_injective.injOn.comp neg_injective.injOn (univ.mapsTo_univ _)
private theorem rexp_cexp_aux (x : ℝ) (s : ℂ) (f : E) :
rexp (-x) • cexp (-↑x) ^ (s - 1) • f = cexp (-s * ↑x) • f := by
show (rexp (-x) : ℂ) • _ = _ • f
rw [← smul_assoc, smul_eq_mul]
push_cast
conv in cexp _ * _ => lhs; rw [← cpow_one (cexp _)]
rw [← cpow_add _ _ (Complex.exp_ne_zero _), cpow_def_of_ne_zero (Complex.exp_ne_zero _),
Complex.log_exp (by norm_num; exact pi_pos) (by simpa using pi_nonneg)]
ring_nf
| Mathlib/Analysis/MellinInversion.lean | 44 | 67 | theorem mellin_eq_fourierIntegral (f : ℝ → E) {s : ℂ} :
mellin f s = 𝓕 (fun (u : ℝ) ↦ (Real.exp (-s.re * u) • f (Real.exp (-u)))) (s.im / (2 * π)) :=
calc
mellin f s
= ∫ (u : ℝ), Complex.exp (-s * u) • f (Real.exp (-u)) := by |
rw [mellin, ← rexp_neg_image_aux, integral_image_eq_integral_abs_deriv_smul
MeasurableSet.univ rexp_neg_deriv_aux rexp_neg_injOn_aux]
simp [rexp_cexp_aux]
_ = ∫ (u : ℝ), Complex.exp (↑(-2 * π * (u * (s.im / (2 * π)))) * I) •
(Real.exp (-s.re * u) • f (Real.exp (-u))) := by
congr
ext u
trans Complex.exp (-s.im * u * I) • (Real.exp (-s.re * u) • f (Real.exp (-u)))
· conv => lhs; rw [← re_add_im s]
rw [neg_add, add_mul, Complex.exp_add, mul_comm, ← smul_eq_mul, smul_assoc]
norm_cast
push_cast
ring_nf
congr
rw [mul_comm (-s.im : ℂ) (u : ℂ), mul_comm (-2 * π)]
have : 2 * (π : ℂ) ≠ 0 := by norm_num; exact pi_ne_zero
field_simp
_ = 𝓕 (fun (u : ℝ) ↦ (Real.exp (-s.re * u) • f (Real.exp (-u)))) (s.im / (2 * π)) := by
simp [fourierIntegral_eq']
| 19 |
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.Tactic.ComputeDegree
#align_import linear_algebra.matrix.polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
set_option linter.uppercaseLean3 false
open Matrix Polynomial
variable {n α : Type*} [DecidableEq n] [Fintype n] [CommRing α]
open Polynomial Matrix Equiv.Perm
namespace Polynomial
| Mathlib/LinearAlgebra/Matrix/Polynomial.lean | 39 | 59 | theorem natDegree_det_X_add_C_le (A B : Matrix n n α) :
natDegree (det ((X : α[X]) • A.map C + B.map C : Matrix n n α[X])) ≤ Fintype.card n := by |
rw [det_apply]
refine (natDegree_sum_le _ _).trans ?_
refine Multiset.max_le_of_forall_le _ _ ?_
simp only [forall_apply_eq_imp_iff, true_and_iff, Function.comp_apply, Multiset.map_map,
Multiset.mem_map, exists_imp, Finset.mem_univ_val]
intro g
calc
natDegree (sign g • ∏ i : n, (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) ≤
natDegree (∏ i : n, (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) := by
cases' Int.units_eq_one_or (sign g) with sg sg
· rw [sg, one_smul]
· rw [sg, Units.neg_smul, one_smul, natDegree_neg]
_ ≤ ∑ i : n, natDegree (((X : α[X]) • A.map C + B.map C : Matrix n n α[X]) (g i) i) :=
(natDegree_prod_le (Finset.univ : Finset n) fun i : n =>
(X • A.map C + B.map C : Matrix n n α[X]) (g i) i)
_ ≤ Finset.univ.card • 1 := (Finset.sum_le_card_nsmul _ _ 1 fun (i : n) _ => ?_)
_ ≤ Fintype.card n := by simp [mul_one, Algebra.id.smul_eq_mul, Finset.card_univ]
dsimp only [add_apply, smul_apply, map_apply, smul_eq_mul]
compute_degree
| 19 |
import Mathlib.Algebra.Field.Basic
import Mathlib.Deprecated.Subring
#align_import deprecated.subfield from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc"
variable {F : Type*} [Field F] (S : Set F)
structure IsSubfield extends IsSubring S : Prop where
inv_mem : ∀ {x : F}, x ∈ S → x⁻¹ ∈ S
#align is_subfield IsSubfield
theorem IsSubfield.div_mem {S : Set F} (hS : IsSubfield S) {x y : F} (hx : x ∈ S) (hy : y ∈ S) :
x / y ∈ S := by
rw [div_eq_mul_inv]
exact hS.toIsSubring.toIsSubmonoid.mul_mem hx (hS.inv_mem hy)
#align is_subfield.div_mem IsSubfield.div_mem
theorem IsSubfield.pow_mem {a : F} {n : ℤ} {s : Set F} (hs : IsSubfield s) (h : a ∈ s) :
a ^ n ∈ s := by
cases' n with n n
· suffices a ^ (n : ℤ) ∈ s by exact this
rw [zpow_natCast]
exact hs.toIsSubring.toIsSubmonoid.pow_mem h
· rw [zpow_negSucc]
exact hs.inv_mem (hs.toIsSubring.toIsSubmonoid.pow_mem h)
#align is_subfield.pow_mem IsSubfield.pow_mem
theorem Univ.isSubfield : IsSubfield (@Set.univ F) :=
{ Univ.isSubmonoid, IsAddSubgroup.univ_addSubgroup with
inv_mem := fun _ ↦ trivial }
#align univ.is_subfield Univ.isSubfield
theorem Preimage.isSubfield {K : Type*} [Field K] (f : F →+* K) {s : Set K} (hs : IsSubfield s) :
IsSubfield (f ⁻¹' s) :=
{ f.isSubring_preimage hs.toIsSubring with
inv_mem := fun {a} (ha : f a ∈ s) ↦ show f a⁻¹ ∈ s by
rw [map_inv₀]
exact hs.inv_mem ha }
#align preimage.is_subfield Preimage.isSubfield
theorem Image.isSubfield {K : Type*} [Field K] (f : F →+* K) {s : Set F} (hs : IsSubfield s) :
IsSubfield (f '' s) :=
{ f.isSubring_image hs.toIsSubring with
inv_mem := fun ⟨x, xmem, ha⟩ ↦ ⟨x⁻¹, hs.inv_mem xmem, ha ▸ map_inv₀ f x⟩ }
#align image.is_subfield Image.isSubfield
theorem Range.isSubfield {K : Type*} [Field K] (f : F →+* K) : IsSubfield (Set.range f) := by
rw [← Set.image_univ]
apply Image.isSubfield _ Univ.isSubfield
#align range.is_subfield Range.isSubfield
namespace Field
def closure : Set F :=
{ x | ∃ y ∈ Ring.closure S, ∃ z ∈ Ring.closure S, y / z = x }
#align field.closure Field.closure
variable {S}
theorem ring_closure_subset : Ring.closure S ⊆ closure S :=
fun x hx ↦ ⟨x, hx, 1, Ring.closure.isSubring.toIsSubmonoid.one_mem, div_one x⟩
#align field.ring_closure_subset Field.ring_closure_subset
theorem closure.isSubmonoid : IsSubmonoid (closure S) :=
{ mul_mem := by
rintro _ _ ⟨p, hp, q, hq, hq0, rfl⟩ ⟨r, hr, s, hs, hs0, rfl⟩
exact ⟨p * r, IsSubmonoid.mul_mem Ring.closure.isSubring.toIsSubmonoid hp hr, q * s,
IsSubmonoid.mul_mem Ring.closure.isSubring.toIsSubmonoid hq hs,
(div_mul_div_comm _ _ _ _).symm⟩
one_mem := ring_closure_subset <| IsSubmonoid.one_mem Ring.closure.isSubring.toIsSubmonoid }
#align field.closure.is_submonoid Field.closure.isSubmonoid
| Mathlib/Deprecated/Subfield.lean | 102 | 123 | theorem closure.isSubfield : IsSubfield (closure S) :=
{ closure.isSubmonoid with
add_mem := by |
intro a b ha hb
rcases id ha with ⟨p, hp, q, hq, rfl⟩
rcases id hb with ⟨r, hr, s, hs, rfl⟩
by_cases hq0 : q = 0
· rwa [hq0, div_zero, zero_add]
by_cases hs0 : s = 0
· rwa [hs0, div_zero, add_zero]
exact ⟨p * s + q * r,
IsAddSubmonoid.add_mem Ring.closure.isSubring.toIsAddSubgroup.toIsAddSubmonoid
(Ring.closure.isSubring.toIsSubmonoid.mul_mem hp hs)
(Ring.closure.isSubring.toIsSubmonoid.mul_mem hq hr),
q * s, Ring.closure.isSubring.toIsSubmonoid.mul_mem hq hs, (div_add_div p r hq0 hs0).symm⟩
zero_mem := ring_closure_subset Ring.closure.isSubring.toIsAddSubgroup.toIsAddSubmonoid.zero_mem
neg_mem := by
rintro _ ⟨p, hp, q, hq, rfl⟩
exact ⟨-p, Ring.closure.isSubring.toIsAddSubgroup.neg_mem hp, q, hq, neg_div q p⟩
inv_mem := by
rintro _ ⟨p, hp, q, hq, rfl⟩
exact ⟨q, hq, p, hp, (inv_div _ _).symm⟩ }
| 19 |
import Mathlib.Analysis.Calculus.LocalExtr.Rolle
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Topology.Algebra.Polynomial
#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
namespace Polynomial
theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]) :
p.roots.toFinset.card ≤ (p.derivative.roots.toFinset \ p.roots.toFinset).card + 1 := by
rcases eq_or_ne (derivative p) 0 with hp' | hp'
· rw [eq_C_of_derivative_eq_zero hp', roots_C, Multiset.toFinset_zero, Finset.card_empty]
exact zero_le _
have hp : p ≠ 0 := ne_of_apply_ne derivative (by rwa [derivative_zero])
refine Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => ?_
rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
obtain ⟨z, hz1, hz2⟩ := exists_deriv_eq_zero hxy p.continuousOn (hx.trans hy.symm)
refine ⟨z, ?_, hz1⟩
rwa [Multiset.mem_toFinset, mem_roots hp', IsRoot, ← p.deriv]
#align polynomial.card_roots_to_finset_le_card_roots_derivative_diff_roots_succ Polynomial.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ
theorem card_roots_toFinset_le_derivative (p : ℝ[X]) :
p.roots.toFinset.card ≤ p.derivative.roots.toFinset.card + 1 :=
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ.trans <|
add_le_add_right (Finset.card_mono Finset.sdiff_subset) _
#align polynomial.card_roots_to_finset_le_derivative Polynomial.card_roots_toFinset_le_derivative
| Mathlib/Analysis/Calculus/LocalExtr/Polynomial.lean | 59 | 86 | theorem card_roots_le_derivative (p : ℝ[X]) :
Multiset.card p.roots ≤ Multiset.card (derivative p).roots + 1 :=
calc
Multiset.card p.roots = ∑ x ∈ p.roots.toFinset, p.roots.count x :=
(Multiset.toFinset_sum_count_eq _).symm
_ = ∑ x ∈ p.roots.toFinset, (p.roots.count x - 1 + 1) :=
(Eq.symm <| Finset.sum_congr rfl fun x hx => tsub_add_cancel_of_le <|
Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx)
_ = (∑ x ∈ p.roots.toFinset, (p.rootMultiplicity x - 1)) + p.roots.toFinset.card := by |
simp only [Finset.sum_add_distrib, Finset.card_eq_sum_ones, count_roots]
_ ≤ (∑ x ∈ p.roots.toFinset, p.derivative.rootMultiplicity x) +
((p.derivative.roots.toFinset \ p.roots.toFinset).card + 1) :=
(add_le_add
(Finset.sum_le_sum fun x _ => rootMultiplicity_sub_one_le_derivative_rootMultiplicity _ _)
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ)
_ ≤ (∑ x ∈ p.roots.toFinset, p.derivative.roots.count x) +
((∑ x ∈ p.derivative.roots.toFinset \ p.roots.toFinset,
p.derivative.roots.count x) + 1) := by
simp only [← count_roots]
refine add_le_add_left (add_le_add_right ((Finset.card_eq_sum_ones _).trans_le ?_) _) _
refine Finset.sum_le_sum fun x hx => Nat.succ_le_iff.2 <| ?_
rw [Multiset.count_pos, ← Multiset.mem_toFinset]
exact (Finset.mem_sdiff.1 hx).1
_ = Multiset.card (derivative p).roots + 1 := by
rw [← add_assoc, ← Finset.sum_union Finset.disjoint_sdiff, Finset.union_sdiff_self_eq_union, ←
Multiset.toFinset_sum_count_eq, ← Finset.sum_subset Finset.subset_union_right]
intro x _ hx₂
simpa only [Multiset.mem_toFinset, Multiset.count_eq_zero] using hx₂
| 19 |
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.Geometry.RingedSpace.SheafedSpace
import Mathlib.Topology.Sheaves.Stalks
import Mathlib.Algebra.Category.Ring.Colimits
import Mathlib.Algebra.Category.Ring.Limits
#align_import algebraic_geometry.ringed_space from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
universe v u
open CategoryTheory
open TopologicalSpace
open Opposite
open TopCat
open TopCat.Presheaf
namespace AlgebraicGeometry
abbrev RingedSpace : TypeMax.{u+1, v+1} :=
SheafedSpace.{_, v, u} CommRingCat.{v}
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.RingedSpace AlgebraicGeometry.RingedSpace
namespace RingedSpace
open SheafedSpace
variable (X : RingedSpace)
-- Porting note (#10670): this was not necessary in mathlib3
instance : CoeSort RingedSpace Type* where
coe X := X.carrier
| Mathlib/Geometry/RingedSpace/Basic.lean | 58 | 79 | theorem isUnit_res_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (x : U)
(h : IsUnit (X.presheaf.germ x f)) :
∃ (V : Opens X) (i : V ⟶ U) (_ : x.1 ∈ V), IsUnit (X.presheaf.map i.op f) := by |
obtain ⟨g', heq⟩ := h.exists_right_inv
obtain ⟨V, hxV, g, rfl⟩ := X.presheaf.germ_exist x.1 g'
let W := U ⊓ V
have hxW : x.1 ∈ W := ⟨x.2, hxV⟩
-- Porting note: `erw` can't write into `HEq`, so this is replaced with another `HEq` in the
-- desired form
replace heq : (X.presheaf.germ ⟨x.val, hxW⟩) ((X.presheaf.map (U.infLELeft V).op) f *
(X.presheaf.map (U.infLERight V).op) g) = (X.presheaf.germ ⟨x.val, hxW⟩) 1 := by
dsimp [germ]
erw [map_mul, map_one, show X.presheaf.germ ⟨x, hxW⟩ ((X.presheaf.map (U.infLELeft V).op) f) =
X.presheaf.germ x f from X.presheaf.germ_res_apply (Opens.infLELeft U V) ⟨x.1, hxW⟩ f,
show X.presheaf.germ ⟨x, hxW⟩ (X.presheaf.map (U.infLERight V).op g) =
X.presheaf.germ ⟨x, hxV⟩ g from X.presheaf.germ_res_apply (Opens.infLERight U V) ⟨x.1, hxW⟩ g]
exact heq
obtain ⟨W', hxW', i₁, i₂, heq'⟩ := X.presheaf.germ_eq x.1 hxW hxW _ _ heq
use W', i₁ ≫ Opens.infLELeft U V, hxW'
rw [(X.presheaf.map i₂.op).map_one, (X.presheaf.map i₁.op).map_mul] at heq'
rw [← comp_apply, ← X.presheaf.map_comp, ← comp_apply, ← X.presheaf.map_comp, ← op_comp] at heq'
exact isUnit_of_mul_eq_one _ _ heq'
| 19 |
import Mathlib.Algebra.Order.CauSeq.BigOperators
import Mathlib.Data.Complex.Abs
import Mathlib.Data.Complex.BigOperators
import Mathlib.Data.Nat.Choose.Sum
#align_import data.complex.exponential from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
open CauSeq Finset IsAbsoluteValue
open scoped Classical ComplexConjugate
namespace Complex
| Mathlib/Data/Complex/Exponential.lean | 1,285 | 1,309 | theorem sum_div_factorial_le {α : Type*} [LinearOrderedField α] (n j : ℕ) (hn : 0 < n) :
(∑ m ∈ filter (fun k => n ≤ k) (range j),
(1 / m.factorial : α)) ≤ n.succ / (n.factorial * n) :=
calc
(∑ m ∈ filter (fun k => n ≤ k) (range j), (1 / m.factorial : α)) =
∑ m ∈ range (j - n), (1 / ((m + n).factorial : α)) := by |
refine sum_nbij' (· - n) (· + n) ?_ ?_ ?_ ?_ ?_ <;>
simp (config := { contextual := true }) [lt_tsub_iff_right, tsub_add_cancel_of_le]
_ ≤ ∑ m ∈ range (j - n), ((n.factorial : α) * (n.succ : α) ^ m)⁻¹ := by
simp_rw [one_div]
gcongr
rw [← Nat.cast_pow, ← Nat.cast_mul, Nat.cast_le, add_comm]
exact Nat.factorial_mul_pow_le_factorial
_ = (n.factorial : α)⁻¹ * ∑ m ∈ range (j - n), (n.succ : α)⁻¹ ^ m := by
simp [mul_inv, ← mul_sum, ← sum_mul, mul_comm, inv_pow]
_ = ((n.succ : α) - n.succ * (n.succ : α)⁻¹ ^ (j - n)) / (n.factorial * n) := by
have h₁ : (n.succ : α) ≠ 1 :=
@Nat.cast_one α _ ▸ mt Nat.cast_inj.1 (mt Nat.succ.inj (pos_iff_ne_zero.1 hn))
have h₂ : (n.succ : α) ≠ 0 := by positivity
have h₃ : (n.factorial * n : α) ≠ 0 := by positivity
have h₄ : (n.succ - 1 : α) = n := by simp
rw [geom_sum_inv h₁ h₂, eq_div_iff_mul_eq h₃, mul_comm _ (n.factorial * n : α),
← mul_assoc (n.factorial⁻¹ : α), ← mul_inv_rev, h₄, ← mul_assoc (n.factorial * n : α),
mul_comm (n : α) n.factorial, mul_inv_cancel h₃, one_mul, mul_comm]
_ ≤ n.succ / (n.factorial * n : α) := by gcongr; apply sub_le_self; positivity
| 19 |
import Mathlib.Algebra.Algebra.Basic
import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue
import Mathlib.Data.Real.Archimedean
#align_import number_theory.class_number.admissible_abs from "leanprover-community/mathlib"@"e97cf15cd1aec9bd5c193b2ffac5a6dc9118912b"
namespace AbsoluteValue
open Int
| Mathlib/NumberTheory/ClassNumber/AdmissibleAbs.lean | 31 | 52 | theorem exists_partition_int (n : ℕ) {ε : ℝ} (hε : 0 < ε) {b : ℤ} (hb : b ≠ 0) (A : Fin n → ℤ) :
∃ t : Fin n → Fin ⌈1 / ε⌉₊,
∀ i₀ i₁, t i₀ = t i₁ → ↑(abs (A i₁ % b - A i₀ % b)) < abs b • ε := by |
have hb' : (0 : ℝ) < ↑(abs b) := Int.cast_pos.mpr (abs_pos.mpr hb)
have hbε : 0 < abs b • ε := by
rw [Algebra.smul_def]
exact mul_pos hb' hε
have hfloor : ∀ i, 0 ≤ floor ((A i % b : ℤ) / abs b • ε : ℝ) :=
fun _ ↦ floor_nonneg.mpr (div_nonneg (cast_nonneg.mpr (emod_nonneg _ hb)) hbε.le)
refine ⟨fun i ↦ ⟨natAbs (floor ((A i % b : ℤ) / abs b • ε : ℝ)), ?_⟩, ?_⟩
· rw [← ofNat_lt, natAbs_of_nonneg (hfloor i), floor_lt]
apply lt_of_lt_of_le _ (Nat.le_ceil _)
rw [Algebra.smul_def, eq_intCast, ← div_div, div_lt_div_right hε, div_lt_iff hb', one_mul,
cast_lt]
exact Int.emod_lt _ hb
intro i₀ i₁ hi
have hi : (⌊↑(A i₀ % b) / abs b • ε⌋.natAbs : ℤ) = ⌊↑(A i₁ % b) / abs b • ε⌋.natAbs :=
congr_arg ((↑) : ℕ → ℤ) (Fin.mk_eq_mk.mp hi)
rw [natAbs_of_nonneg (hfloor i₀), natAbs_of_nonneg (hfloor i₁)] at hi
have hi := abs_sub_lt_one_of_floor_eq_floor hi
rw [abs_sub_comm, ← sub_div, abs_div, abs_of_nonneg hbε.le, div_lt_iff hbε, one_mul] at hi
rwa [Int.cast_abs, Int.cast_sub]
| 19 |
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.MeasureTheory.Integral.FundThmCalculus
#align_import analysis.special_functions.non_integrable from "leanprover-community/mathlib"@"55ec6e9af7d3e0043f57e394cb06a72f6275273e"
open scoped MeasureTheory Topology Interval NNReal ENNReal
open MeasureTheory TopologicalSpace Set Filter Asymptotics intervalIntegral
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F]
theorem not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter_aux
[CompleteSpace E] {f : ℝ → E} {g : ℝ → F}
{k : Set ℝ} (l : Filter ℝ) [NeBot l] [TendstoIxxClass Icc l l]
(hl : k ∈ l) (hd : ∀ᶠ x in l, DifferentiableAt ℝ f x) (hf : Tendsto (fun x => ‖f x‖) l atTop)
(hfg : deriv f =O[l] g) : ¬IntegrableOn g k := by
intro hgi
obtain ⟨C, hC₀, s, hsl, hsub, hfd, hg⟩ :
∃ (C : ℝ) (_ : 0 ≤ C), ∃ s ∈ l, (∀ x ∈ s, ∀ y ∈ s, [[x, y]] ⊆ k) ∧
(∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], DifferentiableAt ℝ f z) ∧
∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], ‖deriv f z‖ ≤ C * ‖g z‖ := by
rcases hfg.exists_nonneg with ⟨C, C₀, hC⟩
have h : ∀ᶠ x : ℝ × ℝ in l.prod l,
∀ y ∈ [[x.1, x.2]], (DifferentiableAt ℝ f y ∧ ‖deriv f y‖ ≤ C * ‖g y‖) ∧ y ∈ k :=
(tendsto_fst.uIcc tendsto_snd).eventually ((hd.and hC.bound).and hl).smallSets
rcases mem_prod_self_iff.1 h with ⟨s, hsl, hs⟩
simp only [prod_subset_iff, mem_setOf_eq] at hs
exact ⟨C, C₀, s, hsl, fun x hx y hy z hz => (hs x hx y hy z hz).2, fun x hx y hy z hz =>
(hs x hx y hy z hz).1.1, fun x hx y hy z hz => (hs x hx y hy z hz).1.2⟩
replace hgi : IntegrableOn (fun x ↦ C * ‖g x‖) k := by exact hgi.norm.smul C
obtain ⟨c, hc, d, hd, hlt⟩ : ∃ c ∈ s, ∃ d ∈ s, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f d‖ := by
rcases Filter.nonempty_of_mem hsl with ⟨c, hc⟩
have : ∀ᶠ x in l, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f x‖ :=
hf.eventually (eventually_gt_atTop _)
exact ⟨c, hc, (this.and hsl).exists.imp fun d hd => ⟨hd.2, hd.1⟩⟩
specialize hsub c hc d hd; specialize hfd c hc d hd
replace hg : ∀ x ∈ Ι c d, ‖deriv f x‖ ≤ C * ‖g x‖ :=
fun z hz => hg c hc d hd z ⟨hz.1.le, hz.2⟩
have hg_ae : ∀ᵐ x ∂volume.restrict (Ι c d), ‖deriv f x‖ ≤ C * ‖g x‖ :=
(ae_restrict_mem measurableSet_uIoc).mono hg
have hsub' : Ι c d ⊆ k := Subset.trans Ioc_subset_Icc_self hsub
have hfi : IntervalIntegrable (deriv f) volume c d := by
rw [intervalIntegrable_iff]
have : IntegrableOn (fun x ↦ C * ‖g x‖) (Ι c d) := IntegrableOn.mono hgi hsub' le_rfl
exact Integrable.mono' this (aestronglyMeasurable_deriv _ _) hg_ae
refine hlt.not_le (sub_le_iff_le_add'.1 ?_)
calc
‖f d‖ - ‖f c‖ ≤ ‖f d - f c‖ := norm_sub_norm_le _ _
_ = ‖∫ x in c..d, deriv f x‖ := congr_arg _ (integral_deriv_eq_sub hfd hfi).symm
_ = ‖∫ x in Ι c d, deriv f x‖ := norm_integral_eq_norm_integral_Ioc _
_ ≤ ∫ x in Ι c d, ‖deriv f x‖ := norm_integral_le_integral_norm _
_ ≤ ∫ x in Ι c d, C * ‖g x‖ :=
setIntegral_mono_on hfi.norm.def' (hgi.mono_set hsub') measurableSet_uIoc hg
_ ≤ ∫ x in k, C * ‖g x‖ := by
apply setIntegral_mono_set hgi
(ae_of_all _ fun x => mul_nonneg hC₀ (norm_nonneg _)) hsub'.eventuallyLE
| Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean | 98 | 121 | theorem not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter
{f : ℝ → E} {g : ℝ → F}
{k : Set ℝ} (l : Filter ℝ) [NeBot l] [TendstoIxxClass Icc l l]
(hl : k ∈ l) (hd : ∀ᶠ x in l, DifferentiableAt ℝ f x) (hf : Tendsto (fun x => ‖f x‖) l atTop)
(hfg : deriv f =O[l] g) : ¬IntegrableOn g k := by |
let a : E →ₗᵢ[ℝ] UniformSpace.Completion E := UniformSpace.Completion.toComplₗᵢ
let f' := a ∘ f
have h'd : ∀ᶠ x in l, DifferentiableAt ℝ f' x := by
filter_upwards [hd] with x hx using a.toContinuousLinearMap.differentiableAt.comp x hx
have h'f : Tendsto (fun x => ‖f' x‖) l atTop := hf.congr (fun x ↦ by simp [f'])
have h'fg : deriv f' =O[l] g := by
apply IsBigO.trans _ hfg
rw [← isBigO_norm_norm]
suffices (fun x ↦ ‖deriv f' x‖) =ᶠ[l] (fun x ↦ ‖deriv f x‖) by exact this.isBigO
filter_upwards [hd] with x hx
have : deriv f' x = a (deriv f x) := by
rw [fderiv.comp_deriv x _ hx]
· have : fderiv ℝ a (f x) = a.toContinuousLinearMap := a.toContinuousLinearMap.fderiv
simp only [this]
rfl
· exact a.toContinuousLinearMap.differentiableAt
simp only [this]
simp
exact not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter_aux l hl h'd h'f h'fg
| 19 |
import Mathlib.Algebra.Module.Torsion
import Mathlib.RingTheory.DedekindDomain.Ideal
#align_import algebra.module.dedekind_domain from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8"
universe u v
variable {R : Type u} [CommRing R] [IsDomain R] {M : Type v} [AddCommGroup M] [Module R M]
open scoped DirectSum
namespace Submodule
variable [IsDedekindDomain R]
open UniqueFactorizationMonoid
open scoped Classical
| Mathlib/Algebra/Module/DedekindDomain.lean | 37 | 59 | theorem isInternal_prime_power_torsion_of_is_torsion_by_ideal {I : Ideal R} (hI : I ≠ ⊥)
(hM : Module.IsTorsionBySet R M I) :
DirectSum.IsInternal fun p : (factors I).toFinset =>
torsionBySet R M (p ^ (factors I).count ↑p : Ideal R) := by |
let P := factors I
have prime_of_mem := fun p (hp : p ∈ P.toFinset) =>
prime_of_factor p (Multiset.mem_toFinset.mp hp)
apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _
· convert hM
rw [← Finset.inf_eq_iInf, IsDedekindDomain.inf_prime_pow_eq_prod, ← Finset.prod_multiset_count,
← associated_iff_eq]
· exact factors_prod hI
· exact prime_of_mem
· exact fun _ _ _ _ ij => ij
· intro p hp q hq pq; dsimp
rw [irreducible_pow_sup]
· suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]
rw [Multiset.count_eq_zero,
normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,
Multiset.mem_replicate]
exact fun H => pq <| H.2.trans <| normalize_eq q
· rw [← Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero
· exact (prime_of_mem p hp).irreducible
| 19 |
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.Tactic.Linarith
#align_import combinatorics.simple_graph.acyclic from "leanprover-community/mathlib"@"b07688016d62f81d14508ff339ea3415558d6353"
universe u v
namespace SimpleGraph
open Walk
variable {V : Type u} (G : SimpleGraph V)
def IsAcyclic : Prop := ∀ ⦃v : V⦄ (c : G.Walk v v), ¬c.IsCycle
#align simple_graph.is_acyclic SimpleGraph.IsAcyclic
@[mk_iff]
structure IsTree : Prop where
protected isConnected : G.Connected
protected IsAcyclic : G.IsAcyclic
#align simple_graph.is_tree SimpleGraph.IsTree
variable {G}
@[simp] lemma isAcyclic_bot : IsAcyclic (⊥ : SimpleGraph V) := fun _a _w hw ↦ hw.ne_bot rfl
theorem isAcyclic_iff_forall_adj_isBridge :
G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.IsBridge s(v, w) := by
simp_rw [isBridge_iff_adj_and_forall_cycle_not_mem]
constructor
· intro ha v w hvw
apply And.intro hvw
intro u p hp
cases ha p hp
· rintro hb v (_ | ⟨ha, p⟩) hp
· exact hp.not_of_nil
· apply (hb ha).2 _ hp
rw [Walk.edges_cons]
apply List.mem_cons_self
#align simple_graph.is_acyclic_iff_forall_adj_is_bridge SimpleGraph.isAcyclic_iff_forall_adj_isBridge
theorem isAcyclic_iff_forall_edge_isBridge :
G.IsAcyclic ↔ ∀ ⦃e⦄, e ∈ (G.edgeSet) → G.IsBridge e := by
simp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]
#align simple_graph.is_acyclic_iff_forall_edge_is_bridge SimpleGraph.isAcyclic_iff_forall_edge_isBridge
theorem IsAcyclic.path_unique {G : SimpleGraph V} (h : G.IsAcyclic) {v w : V} (p q : G.Path v w) :
p = q := by
obtain ⟨p, hp⟩ := p
obtain ⟨q, hq⟩ := q
rw [Subtype.mk.injEq]
induction p with
| nil =>
cases (Walk.isPath_iff_eq_nil _).mp hq
rfl
| cons ph p ih =>
rw [isAcyclic_iff_forall_adj_isBridge] at h
specialize h ph
rw [isBridge_iff_adj_and_forall_walk_mem_edges] at h
replace h := h.2 (q.append p.reverse)
simp only [Walk.edges_append, Walk.edges_reverse, List.mem_append, List.mem_reverse] at h
cases' h with h h
· cases q with
| nil => simp [Walk.isPath_def] at hp
| cons _ q =>
rw [Walk.cons_isPath_iff] at hp hq
simp only [Walk.edges_cons, List.mem_cons, Sym2.eq_iff, true_and] at h
rcases h with (⟨h, rfl⟩ | ⟨rfl, rfl⟩) | h
· cases ih hp.1 q hq.1
rfl
· simp at hq
· exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hq.2
· rw [Walk.cons_isPath_iff] at hp
exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hp.2
#align simple_graph.is_acyclic.path_unique SimpleGraph.IsAcyclic.path_unique
theorem isAcyclic_of_path_unique (h : ∀ (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by
intro v c hc
simp only [Walk.isCycle_def, Ne] at hc
cases c with
| nil => cases hc.2.1 rfl
| cons ha c' =>
simp only [Walk.cons_isTrail_iff, Walk.support_cons, List.tail_cons, true_and_iff] at hc
specialize h _ _ ⟨c', by simp only [Walk.isPath_def, hc.2]⟩ (Path.singleton ha.symm)
rw [Path.singleton, Subtype.mk.injEq] at h
simp [h] at hc
#align simple_graph.is_acyclic_of_path_unique SimpleGraph.isAcyclic_of_path_unique
theorem isAcyclic_iff_path_unique : G.IsAcyclic ↔ ∀ ⦃v w : V⦄ (p q : G.Path v w), p = q :=
⟨IsAcyclic.path_unique, isAcyclic_of_path_unique⟩
#align simple_graph.is_acyclic_iff_path_unique SimpleGraph.isAcyclic_iff_path_unique
| Mathlib/Combinatorics/SimpleGraph/Acyclic.lean | 134 | 154 | theorem isTree_iff_existsUnique_path :
G.IsTree ↔ Nonempty V ∧ ∀ v w : V, ∃! p : G.Walk v w, p.IsPath := by |
classical
rw [isTree_iff, isAcyclic_iff_path_unique]
constructor
· rintro ⟨hc, hu⟩
refine ⟨hc.nonempty, ?_⟩
intro v w
let q := (hc v w).some.toPath
use q
simp only [true_and_iff, Path.isPath]
intro p hp
specialize hu ⟨p, hp⟩ q
exact Subtype.ext_iff.mp hu
· rintro ⟨hV, h⟩
refine ⟨Connected.mk ?_, ?_⟩
· intro v w
obtain ⟨p, _⟩ := h v w
exact p.reachable
· rintro v w ⟨p, hp⟩ ⟨q, hq⟩
simp only [ExistsUnique.unique (h v w) hp hq]
| 19 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Range
#align_import data.list.indexes from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
assert_not_exists MonoidWithZero
universe u v
open Function
namespace List
variable {α : Type u} {β : Type v}
section MapIdx
-- Porting note: Add back old definition because it's easier for writing proofs.
protected def oldMapIdxCore (f : ℕ → α → β) : ℕ → List α → List β
| _, [] => []
| k, a :: as => f k a :: List.oldMapIdxCore f (k + 1) as
protected def oldMapIdx (f : ℕ → α → β) (as : List α) : List β :=
List.oldMapIdxCore f 0 as
@[simp]
theorem mapIdx_nil {α β} (f : ℕ → α → β) : mapIdx f [] = [] :=
rfl
#align list.map_with_index_nil List.mapIdx_nil
-- Porting note (#10756): new theorem.
protected theorem oldMapIdxCore_eq (l : List α) (f : ℕ → α → β) (n : ℕ) :
l.oldMapIdxCore f n = l.oldMapIdx fun i a ↦ f (i + n) a := by
induction' l with hd tl hl generalizing f n
· rfl
· rw [List.oldMapIdx]
simp only [List.oldMapIdxCore, hl, Nat.add_left_comm, Nat.add_comm, Nat.add_zero]
#noalign list.map_with_index_core_eq
-- Porting note: convert new definition to old definition.
-- A few new theorems are added to achieve this
-- 1. Prove that `oldMapIdxCore f (l ++ [e]) = oldMapIdxCore f l ++ [f l.length e]`
-- 2. Prove that `oldMapIdx f (l ++ [e]) = oldMapIdx f l ++ [f l.length e]`
-- 3. Prove list induction using `∀ l e, p [] → (p l → p (l ++ [e])) → p l`
-- Porting note (#10756): new theorem.
theorem list_reverse_induction (p : List α → Prop) (base : p [])
(ind : ∀ (l : List α) (e : α), p l → p (l ++ [e])) : (∀ (l : List α), p l) := by
let q := fun l ↦ p (reverse l)
have pq : ∀ l, p (reverse l) → q l := by simp only [q, reverse_reverse]; intro; exact id
have qp : ∀ l, q (reverse l) → p l := by simp only [q, reverse_reverse]; intro; exact id
intro l
apply qp
generalize (reverse l) = l
induction' l with head tail ih
· apply pq; simp only [reverse_nil, base]
· apply pq; simp only [reverse_cons]; apply ind; apply qp; rw [reverse_reverse]; exact ih
-- Porting note (#10756): new theorem.
protected theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (l₁ l₂ : List α),
List.oldMapIdxCore f n (l₁ ++ l₂) =
List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂ := by
intros f n l₁ l₂
generalize e : (l₁ ++ l₂).length = len
revert n l₁ l₂
induction' len with len ih <;> intros n l₁ l₂ h
· have l₁_nil : l₁ = [] := by
cases l₁
· rfl
· contradiction
have l₂_nil : l₂ = [] := by
cases l₂
· rfl
· rw [List.length_append] at h; contradiction
simp only [l₁_nil, l₂_nil]; rfl
· cases' l₁ with head tail
· rfl
· simp only [List.oldMapIdxCore, List.append_eq, length_cons, cons_append,cons.injEq, true_and]
suffices n + Nat.succ (length tail) = n + 1 + tail.length by
rw [this]
apply ih (n + 1) _ _ _
simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
simp only [length_append, h]
rw [Nat.add_assoc]; simp only [Nat.add_comm]
-- Porting note (#10756): new theorem.
protected theorem oldMapIdx_append : ∀ (f : ℕ → α → β) (l : List α) (e : α),
List.oldMapIdx f (l ++ [e]) = List.oldMapIdx f l ++ [f l.length e] := by
intros f l e
unfold List.oldMapIdx
rw [List.oldMapIdxCore_append f 0 l [e]]
simp only [Nat.zero_add]; rfl
-- Porting note (#10756): new theorem.
| Mathlib/Data/List/Indexes.lean | 109 | 129 | theorem mapIdxGo_append : ∀ (f : ℕ → α → β) (l₁ l₂ : List α) (arr : Array β),
mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (List.toArray (mapIdx.go f l₁ arr)) := by |
intros f l₁ l₂ arr
generalize e : (l₁ ++ l₂).length = len
revert l₁ l₂ arr
induction' len with len ih <;> intros l₁ l₂ arr h
· have l₁_nil : l₁ = [] := by
cases l₁
· rfl
· contradiction
have l₂_nil : l₂ = [] := by
cases l₂
· rfl
· rw [List.length_append] at h; contradiction
rw [l₁_nil, l₂_nil]; simp only [mapIdx.go, Array.toList_eq, Array.toArray_data]
· cases' l₁ with head tail <;> simp only [mapIdx.go]
· simp only [nil_append, Array.toList_eq, Array.toArray_data]
· simp only [List.append_eq]
rw [ih]
· simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
simp only [length_append, h]
| 19 |
import Mathlib.NumberTheory.ZetaValues
import Mathlib.NumberTheory.LSeries.RiemannZeta
open Complex Real Set
open scoped Nat
namespace HurwitzZeta
variable {k : ℕ} {x : ℝ}
theorem cosZeta_two_mul_nat (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k) / 2 / (2 * k)! *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_cosZeta x (?_ : 1 < re (2 * k))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_cos hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc,
← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul, cpow_natCast, ofReal_pow, ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, natCast_re, Nat.cast_lt]
omega
| Mathlib/NumberTheory/LSeries/HurwitzZetaValues.lean | 76 | 97 | theorem sinZeta_two_mul_nat_add_one (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
sinZeta x (2 * k + 1) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k + 1) / 2 / (2 * k + 1)! *
((Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by |
rw [← (hasSum_nat_sinZeta x (?_ : 1 < re (2 * k + 1))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_sin hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc]
congr 1
rw [← Nat.cast_ofNat, ← Nat.cast_mul, ← Nat.cast_add_one, cpow_natCast, ofReal_pow,
ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, ← Nat.cast_add_one, natCast_re,
Nat.cast_lt, lt_add_iff_pos_left]
exact mul_pos two_pos (Nat.pos_of_ne_zero hk)
| 19 |
import Mathlib.Geometry.Euclidean.Inversion.Basic
import Mathlib.Analysis.InnerProductSpace.Calculus
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Tactic.AdaptationNote
open Metric Function AffineMap Set AffineSubspace
open scoped Topology RealInnerProductSpace
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [InnerProductSpace ℝ F]
open EuclideanGeometry
namespace EuclideanGeometry
variable {a b c d x y z : F} {r R : ℝ}
| Mathlib/Geometry/Euclidean/Inversion/Calculus.lean | 87 | 108 | theorem hasFDerivAt_inversion (hx : x ≠ c) :
HasFDerivAt (inversion c R)
((R / dist x c) ^ 2 • (reflection (ℝ ∙ (x - c))ᗮ : F →L[ℝ] F)) x := by |
rcases add_left_surjective c x with ⟨x, rfl⟩
have : HasFDerivAt (inversion c R) (?_ : F →L[ℝ] F) (c + x) := by
#adaptation_note /-- nightly-2024-03-16: simp was
simp (config := { unfoldPartialApp := true }) only [inversion] -/
simp only [inversion_def]
simp_rw [dist_eq_norm, div_pow, div_eq_mul_inv]
have A := (hasFDerivAt_id (𝕜 := ℝ) (c + x)).sub_const c
have B := ((hasDerivAt_inv <| by simpa using hx).comp_hasFDerivAt _ A.norm_sq).const_mul
(R ^ 2)
exact (B.smul A).add_const c
refine this.congr_fderiv (LinearMap.ext_on_codisjoint
(Submodule.isCompl_orthogonal_of_completeSpace (K := ℝ ∙ x)).codisjoint
(LinearMap.eqOn_span' ?_) fun y hy ↦ ?_)
· have : ((‖x‖ ^ 2) ^ 2)⁻¹ * (‖x‖ ^ 2) = (‖x‖ ^ 2)⁻¹ := by
rw [← div_eq_inv_mul, sq (‖x‖ ^ 2), div_self_mul_self']
simp [reflection_orthogonalComplement_singleton_eq_neg, real_inner_self_eq_norm_sq,
two_mul, this, div_eq_mul_inv, mul_add, add_smul, mul_pow]
· simp [Submodule.mem_orthogonal_singleton_iff_inner_right.1 hy,
reflection_mem_subspace_eq_self hy, div_eq_mul_inv, mul_pow]
| 19 |
import Mathlib.Algebra.Algebra.Subalgebra.Unitization
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.StarSubalgebra
import Mathlib.Topology.ContinuousFunction.ContinuousMapZero
import Mathlib.Topology.ContinuousFunction.Weierstrass
#align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb"
noncomputable section
section RCLike
open RCLike
-- Redefine `X`, since for the next lemma it need not be compact
variable {𝕜 : Type*} {X : Type*} [RCLike 𝕜] [TopologicalSpace X]
open ContinuousMap
#noalign continuous_map.conj_invariant_subalgebra
#noalign continuous_map.mem_conj_invariant_subalgebra
#noalign continuous_map.subalgebra_conj_invariant
| Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean | 355 | 377 | theorem Subalgebra.SeparatesPoints.rclike_to_real {A : StarSubalgebra 𝕜 C(X, 𝕜)}
(hA : A.SeparatesPoints) :
((A.restrictScalars ℝ).comap
(ofRealAm.compLeftContinuous ℝ continuous_ofReal)).SeparatesPoints := by |
intro x₁ x₂ hx
-- Let `f` in the subalgebra `A` separate the points `x₁`, `x₂`
obtain ⟨_, ⟨f, hfA, rfl⟩, hf⟩ := hA hx
let F : C(X, 𝕜) := f - const _ (f x₂)
-- Subtract the constant `f x₂` from `f`; this is still an element of the subalgebra
have hFA : F ∈ A := by
refine A.sub_mem hfA (@Eq.subst _ (· ∈ A) _ _ ?_ <| A.smul_mem A.one_mem <| f x₂)
ext1
simp only [coe_smul, coe_one, smul_apply, one_apply, Algebra.id.smul_eq_mul, mul_one,
const_apply]
-- Consider now the function `fun x ↦ |f x - f x₂| ^ 2`
refine ⟨_, ⟨⟨(‖F ·‖ ^ 2), by continuity⟩, ?_, rfl⟩, ?_⟩
· -- This is also an element of the subalgebra, and takes only real values
rw [SetLike.mem_coe, Subalgebra.mem_comap]
convert (A.restrictScalars ℝ).mul_mem hFA (star_mem hFA : star F ∈ A)
ext1
simp [← RCLike.mul_conj]
· -- And it also separates the points `x₁`, `x₂`
simpa [F] using sub_ne_zero.mpr hf
| 19 |
import Mathlib.Analysis.Convex.Slope
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Tactic.LinearCombination
#align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
open Real Set NNReal
| Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean | 39 | 58 | theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by |
apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ
rintro x y z - - hxy hyz
trans exp y
· have h1 : 0 < y - x := by linarith
have h2 : x - y < 0 := by linarith
rw [div_lt_iff h1]
calc
exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf
_ = exp y * (1 - exp (x - y)) := by ring
_ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne]
_ = exp y * (y - x) := by ring
· have h1 : 0 < z - y := by linarith
rw [lt_div_iff h1]
calc
exp y * (z - y) < exp y * (exp (z - y) - 1) := by
gcongr _ * ?_
linarith [add_one_lt_exp h1.ne']
_ = exp (z - y) * exp y - exp y := by ring
_ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl
| 19 |
import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
import Mathlib.Data.Real.ConjExponents
#align_import analysis.mean_inequalities from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
universe u v
open scoped Classical
open Finset NNReal ENNReal
set_option linter.uppercaseLean3 false
noncomputable section
variable {ι : Type u} (s : Finset ι)
section GeomMeanLEArithMean
namespace Real
| Mathlib/Analysis/MeanInequalities.lean | 113 | 134 | theorem geom_mean_le_arith_mean_weighted (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i)
(hw' : ∑ i ∈ s, w i = 1) (hz : ∀ i ∈ s, 0 ≤ z i) :
∏ i ∈ s, z i ^ w i ≤ ∑ i ∈ s, w i * z i := by |
-- If some number `z i` equals zero and has non-zero weight, then LHS is 0 and RHS is nonnegative.
by_cases A : ∃ i ∈ s, z i = 0 ∧ w i ≠ 0
· rcases A with ⟨i, his, hzi, hwi⟩
rw [prod_eq_zero his]
· exact sum_nonneg fun j hj => mul_nonneg (hw j hj) (hz j hj)
· rw [hzi]
exact zero_rpow hwi
-- If all numbers `z i` with non-zero weight are positive, then we apply Jensen's inequality
-- for `exp` and numbers `log (z i)` with weights `w i`.
· simp only [not_exists, not_and, Ne, Classical.not_not] at A
have := convexOn_exp.map_sum_le hw hw' fun i _ => Set.mem_univ <| log (z i)
simp only [exp_sum, (· ∘ ·), smul_eq_mul, mul_comm (w _) (log _)] at this
convert this using 1 <;> [apply prod_congr rfl;apply sum_congr rfl] <;> intro i hi
· cases' eq_or_lt_of_le (hz i hi) with hz hz
· simp [A i hi hz.symm]
· exact rpow_def_of_pos hz _
· cases' eq_or_lt_of_le (hz i hi) with hz hz
· simp [A i hi hz.symm]
· rw [exp_log hz]
| 19 |
import Mathlib.SetTheory.Ordinal.Arithmetic
namespace OrdinalApprox
universe u
variable {α : Type u}
variable [CompleteLattice α] (f : α →o α) (x : α)
open Function fixedPoints Cardinal Order OrderHom
set_option linter.unusedVariables false in
def lfpApprox (a : Ordinal.{u}) : α :=
sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } ∪ {x})
termination_by a
decreasing_by exact h
theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by
unfold Monotone; intros a b h; unfold lfpApprox
refine sSup_le_sSup ?h
apply sup_le_sup_right
simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intros a' h'
use a'
exact ⟨lt_of_lt_of_le h' h, rfl⟩
theorem le_lfpApprox {a : Ordinal} : x ≤ lfpApprox f x a := by
unfold lfpApprox
apply le_sSup
simp only [exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq, true_or]
| Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean | 92 | 112 | theorem lfpApprox_add_one (h : x ≤ f x) (a : Ordinal) :
lfpApprox f x (a+1) = f (lfpApprox f x a) := by |
apply le_antisymm
· conv => left; unfold lfpApprox
apply sSup_le
simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop, Set.union_singleton,
Set.mem_insert_iff, Set.mem_setOf_eq, forall_eq_or_imp, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
apply And.intro
· apply le_trans h
apply Monotone.imp f.monotone
exact le_lfpApprox f x
· intros a' h
apply f.2; apply lfpApprox_monotone; exact h
· conv => right; unfold lfpApprox
apply le_sSup
simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop]
rw [Set.mem_union]
apply Or.inl
simp only [Set.mem_setOf_eq]
use a
| 19 |
import Mathlib.RingTheory.Ideal.IsPrimary
import Mathlib.RingTheory.Localization.AtPrime
import Mathlib.Order.Minimal
#align_import ring_theory.ideal.minimal_prime from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
section
variable {R S : Type*} [CommSemiring R] [CommSemiring S] (I J : Ideal R)
protected def Ideal.minimalPrimes : Set (Ideal R) :=
minimals (· ≤ ·) { p | p.IsPrime ∧ I ≤ p }
#align ideal.minimal_primes Ideal.minimalPrimes
variable (R) in
def minimalPrimes : Set (Ideal R) :=
Ideal.minimalPrimes ⊥
#align minimal_primes minimalPrimes
lemma minimalPrimes_eq_minimals : minimalPrimes R = minimals (· ≤ ·) (setOf Ideal.IsPrime) :=
congr_arg (minimals (· ≤ ·)) (by simp)
variable {I J}
theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by
suffices
∃ m ∈ { p : (Ideal R)ᵒᵈ | Ideal.IsPrime p ∧ I ≤ OrderDual.ofDual p },
OrderDual.toDual J ≤ m ∧ ∀ z ∈ { p : (Ideal R)ᵒᵈ | Ideal.IsPrime p ∧ I ≤ p }, m ≤ z → z = m by
obtain ⟨p, h₁, h₂, h₃⟩ := this
simp_rw [← @eq_comm _ p] at h₃
exact ⟨p, ⟨h₁, fun a b c => le_of_eq (h₃ a b c)⟩, h₂⟩
apply zorn_nonempty_partialOrder₀
swap
· refine ⟨show J.IsPrime by infer_instance, e⟩
rintro (c : Set (Ideal R)) hc hc' J' hJ'
refine
⟨OrderDual.toDual (sInf c),
⟨Ideal.sInf_isPrime_of_isChain ⟨J', hJ'⟩ hc'.symm fun x hx => (hc hx).1, ?_⟩, ?_⟩
· rw [OrderDual.ofDual_toDual, le_sInf_iff]
exact fun _ hx => (hc hx).2
· rintro z hz
rw [OrderDual.le_toDual]
exact sInf_le hz
#align ideal.exists_minimal_primes_le Ideal.exists_minimalPrimes_le
@[simp]
theorem Ideal.radical_minimalPrimes : I.radical.minimalPrimes = I.minimalPrimes := by
rw [Ideal.minimalPrimes, Ideal.minimalPrimes]
ext p
refine ⟨?_, ?_⟩ <;> rintro ⟨⟨a, ha⟩, b⟩
· refine ⟨⟨a, a.radical_le_iff.1 ha⟩, ?_⟩
simp only [Set.mem_setOf_eq, and_imp] at *
exact fun _ h2 h3 h4 => b h2 (h2.radical_le_iff.2 h3) h4
· refine ⟨⟨a, a.radical_le_iff.2 ha⟩, ?_⟩
simp only [Set.mem_setOf_eq, and_imp] at *
exact fun _ h2 h3 h4 => b h2 (h2.radical_le_iff.1 h3) h4
#align ideal.radical_minimal_primes Ideal.radical_minimalPrimes
@[simp]
theorem Ideal.sInf_minimalPrimes : sInf I.minimalPrimes = I.radical := by
rw [I.radical_eq_sInf]
apply le_antisymm
· intro x hx
rw [Ideal.mem_sInf] at hx ⊢
rintro J ⟨e, hJ⟩
obtain ⟨p, hp, hp'⟩ := Ideal.exists_minimalPrimes_le e
exact hp' (hx hp)
· apply sInf_le_sInf _
intro I hI
exact hI.1.symm
#align ideal.Inf_minimal_primes Ideal.sInf_minimalPrimes
| Mathlib/RingTheory/Ideal/MinimalPrime.lean | 104 | 125 | theorem Ideal.exists_comap_eq_of_mem_minimalPrimes_of_injective {f : R →+* S}
(hf : Function.Injective f) (p) (H : p ∈ minimalPrimes R) :
∃ p' : Ideal S, p'.IsPrime ∧ p'.comap f = p := by |
have := H.1.1
have : Nontrivial (Localization (Submonoid.map f p.primeCompl)) := by
refine ⟨⟨1, 0, ?_⟩⟩
convert (IsLocalization.map_injective_of_injective p.primeCompl (Localization.AtPrime p)
(Localization <| p.primeCompl.map f) hf).ne one_ne_zero
· rw [map_one]
· rw [map_zero]
obtain ⟨M, hM⟩ := Ideal.exists_maximal (Localization (Submonoid.map f p.primeCompl))
refine ⟨M.comap (algebraMap S <| Localization (Submonoid.map f p.primeCompl)), inferInstance, ?_⟩
rw [Ideal.comap_comap, ← @IsLocalization.map_comp _ _ _ _ _ _ _ _ Localization.isLocalization
_ _ _ _ p.primeCompl.le_comap_map _ Localization.isLocalization,
← Ideal.comap_comap]
suffices _ ≤ p by exact this.antisymm (H.2 ⟨inferInstance, bot_le⟩ this)
intro x hx
by_contra h
apply hM.ne_top
apply M.eq_top_of_isUnit_mem hx
apply IsUnit.map
apply IsLocalization.map_units _ (show p.primeCompl from ⟨x, h⟩)
| 19 |
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Invertible.Basic
import Mathlib.Algebra.GroupWithZero.Units.Basic
import Mathlib.Data.Set.Basic
import Mathlib.Logic.Basic
#align_import group_theory.subsemigroup.center from "leanprover-community/mathlib"@"1ac8d4304efba9d03fa720d06516fac845aa5353"
variable {M : Type*}
structure IsAddCentral [Add M] (z : M) : Prop where
comm (a : M) : z + a = a + z
left_assoc (b c : M) : z + (b + c) = (z + b) + c
mid_assoc (a c : M) : (a + z) + c = a + (z + c)
right_assoc (a b : M) : (a + b) + z = a + (b + z)
@[to_additive]
structure IsMulCentral [Mul M] (z : M) : Prop where
comm (a : M) : z * a = a * z
left_assoc (b c : M) : z * (b * c) = (z * b) * c
mid_assoc (a c : M) : (a * z) * c = a * (z * c)
right_assoc (a b : M) : (a * b) * z = a * (b * z)
attribute [mk_iff] IsMulCentral IsAddCentral
attribute [to_additive existing] isMulCentral_iff
namespace Set
section Mul
variable (M) [Mul M]
@[to_additive addCenter " The center of an additive magma. "]
def center : Set M :=
{ z | IsMulCentral z }
#align set.center Set.center
#align set.add_center Set.addCenter
-- Porting note: The `to_additive` version used to be `mem_addCenter` without the iff
@[to_additive mem_addCenter_iff]
theorem mem_center_iff {z : M} : z ∈ center M ↔ IsMulCentral z :=
Iff.rfl
#align set.mem_center_iff Set.mem_center_iff
#align set.mem_add_center Set.mem_addCenter_iff
variable {M}
@[to_additive (attr := simp) add_mem_addCenter]
| Mathlib/Algebra/Group/Center.lean | 98 | 119 | theorem mul_mem_center [Mul M] {z₁ z₂ : M} (hz₁ : z₁ ∈ Set.center M) (hz₂ : z₂ ∈ Set.center M) :
z₁ * z₂ ∈ Set.center M where
comm a := calc
z₁ * z₂ * a = z₂ * z₁ * a := by | rw [hz₁.comm]
_ = z₂ * (z₁ * a) := by rw [hz₁.mid_assoc z₂]
_ = (a * z₁) * z₂ := by rw [hz₁.comm, hz₂.comm]
_ = a * (z₁ * z₂) := by rw [hz₂.right_assoc a z₁]
left_assoc (b c : M) := calc
z₁ * z₂ * (b * c) = z₁ * (z₂ * (b * c)) := by rw [hz₂.mid_assoc]
_ = z₁ * ((z₂ * b) * c) := by rw [hz₂.left_assoc]
_ = (z₁ * (z₂ * b)) * c := by rw [hz₁.left_assoc]
_ = z₁ * z₂ * b * c := by rw [hz₂.mid_assoc]
mid_assoc (a c : M) := calc
a * (z₁ * z₂) * c = ((a * z₁) * z₂) * c := by rw [hz₁.mid_assoc]
_ = (a * z₁) * (z₂ * c) := by rw [hz₂.mid_assoc]
_ = a * (z₁ * (z₂ * c)) := by rw [hz₁.mid_assoc]
_ = a * (z₁ * z₂ * c) := by rw [hz₂.mid_assoc]
right_assoc (a b : M) := calc
a * b * (z₁ * z₂) = ((a * b) * z₁) * z₂ := by rw [hz₂.right_assoc]
_ = (a * (b * z₁)) * z₂ := by rw [hz₁.right_assoc]
_ = a * ((b * z₁) * z₂) := by rw [hz₂.right_assoc]
_ = a * (b * (z₁ * z₂)) := by rw [hz₁.mid_assoc]
| 19 |
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic
import Mathlib.Analysis.NormedSpace.Pointwise
#align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Metric
variable {𝕜 : Type*} [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E]
theorem RCLike.norm_coe_norm {z : E} : ‖(‖z‖ : 𝕜)‖ = ‖z‖ := by simp
#align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm
variable [NormedSpace 𝕜 E]
@[simp]
theorem norm_smul_inv_norm {x : E} (hx : x ≠ 0) : ‖(‖x‖⁻¹ : 𝕜) • x‖ = 1 := by
have : ‖x‖ ≠ 0 := by simp [hx]
field_simp [norm_smul]
#align norm_smul_inv_norm norm_smul_inv_norm
theorem norm_smul_inv_norm' {r : ℝ} (r_nonneg : 0 ≤ r) {x : E} (hx : x ≠ 0) :
‖((r : 𝕜) * (‖x‖ : 𝕜)⁻¹) • x‖ = r := by
have : ‖x‖ ≠ 0 := by simp [hx]
field_simp [norm_smul, r_nonneg, rclike_simps]
#align norm_smul_inv_norm' norm_smul_inv_norm'
| Mathlib/Analysis/NormedSpace/RCLike.lean | 55 | 75 | theorem LinearMap.bound_of_sphere_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E →ₗ[𝕜] 𝕜)
(h : ∀ z ∈ sphere (0 : E) r, ‖f z‖ ≤ c) (z : E) : ‖f z‖ ≤ c / r * ‖z‖ := by |
by_cases z_zero : z = 0
· rw [z_zero]
simp only [LinearMap.map_zero, norm_zero, mul_zero]
exact le_rfl
set z₁ := ((r : 𝕜) * (‖z‖ : 𝕜)⁻¹) • z with hz₁
have norm_f_z₁ : ‖f z₁‖ ≤ c := by
apply h
rw [mem_sphere_zero_iff_norm]
exact norm_smul_inv_norm' r_pos.le z_zero
have r_ne_zero : (r : 𝕜) ≠ 0 := RCLike.ofReal_ne_zero.mpr r_pos.ne'
have eq : f z = ‖z‖ / r * f z₁ := by
rw [hz₁, LinearMap.map_smul, smul_eq_mul]
rw [← mul_assoc, ← mul_assoc, div_mul_cancel₀ _ r_ne_zero, mul_inv_cancel, one_mul]
simp only [z_zero, RCLike.ofReal_eq_zero, norm_eq_zero, Ne, not_false_iff]
rw [eq, norm_mul, norm_div, RCLike.norm_coe_norm, RCLike.norm_of_nonneg r_pos.le,
div_mul_eq_mul_div, div_mul_eq_mul_div, mul_comm]
apply div_le_div _ _ r_pos rfl.ge
· exact mul_nonneg ((norm_nonneg _).trans norm_f_z₁) (norm_nonneg z)
apply mul_le_mul norm_f_z₁ rfl.le (norm_nonneg z) ((norm_nonneg _).trans norm_f_z₁)
| 19 |
import Mathlib.Data.SetLike.Fintype
import Mathlib.Algebra.Divisibility.Prod
import Mathlib.RingTheory.Nakayama
import Mathlib.RingTheory.SimpleModule
import Mathlib.Tactic.RSuffices
#align_import ring_theory.artinian from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
open Set Filter Pointwise
class IsArtinian (R M) [Semiring R] [AddCommMonoid M] [Module R M] : Prop where
wellFounded_submodule_lt' : WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop)
#align is_artinian IsArtinian
section
variable {R M P N : Type*}
variable [Ring R] [AddCommGroup M] [AddCommGroup P] [AddCommGroup N]
variable [Module R M] [Module R P] [Module R N]
open IsArtinian
theorem IsArtinian.wellFounded_submodule_lt (R M) [Semiring R] [AddCommMonoid M] [Module R M]
[IsArtinian R M] : WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) :=
IsArtinian.wellFounded_submodule_lt'
#align is_artinian.well_founded_submodule_lt IsArtinian.wellFounded_submodule_lt
theorem isArtinian_of_injective (f : M →ₗ[R] P) (h : Function.Injective f) [IsArtinian R P] :
IsArtinian R M :=
⟨Subrelation.wf
(fun {A B} hAB => show A.map f < B.map f from Submodule.map_strictMono_of_injective h hAB)
(InvImage.wf (Submodule.map f) (IsArtinian.wellFounded_submodule_lt R P))⟩
#align is_artinian_of_injective isArtinian_of_injective
instance isArtinian_submodule' [IsArtinian R M] (N : Submodule R M) : IsArtinian R N :=
isArtinian_of_injective N.subtype Subtype.val_injective
#align is_artinian_submodule' isArtinian_submodule'
theorem isArtinian_of_le {s t : Submodule R M} [IsArtinian R t] (h : s ≤ t) : IsArtinian R s :=
isArtinian_of_injective (Submodule.inclusion h) (Submodule.inclusion_injective h)
#align is_artinian_of_le isArtinian_of_le
variable (M)
theorem isArtinian_of_surjective (f : M →ₗ[R] P) (hf : Function.Surjective f) [IsArtinian R M] :
IsArtinian R P :=
⟨Subrelation.wf
(fun {A B} hAB =>
show A.comap f < B.comap f from Submodule.comap_strictMono_of_surjective hf hAB)
(InvImage.wf (Submodule.comap f) (IsArtinian.wellFounded_submodule_lt R M))⟩
#align is_artinian_of_surjective isArtinian_of_surjective
variable {M}
theorem isArtinian_of_linearEquiv (f : M ≃ₗ[R] P) [IsArtinian R M] : IsArtinian R P :=
isArtinian_of_surjective _ f.toLinearMap f.toEquiv.surjective
#align is_artinian_of_linear_equiv isArtinian_of_linearEquiv
theorem isArtinian_of_range_eq_ker [IsArtinian R M] [IsArtinian R P] (f : M →ₗ[R] N) (g : N →ₗ[R] P)
(hf : Function.Injective f) (hg : Function.Surjective g)
(h : LinearMap.range f = LinearMap.ker g) : IsArtinian R N :=
⟨wellFounded_lt_exact_sequence (IsArtinian.wellFounded_submodule_lt R M)
(IsArtinian.wellFounded_submodule_lt R P) (LinearMap.range f) (Submodule.map f)
(Submodule.comap f) (Submodule.comap g) (Submodule.map g) (Submodule.gciMapComap hf)
(Submodule.giMapComap hg)
(by simp [Submodule.map_comap_eq, inf_comm]) (by simp [Submodule.comap_map_eq, h])⟩
#align is_artinian_of_range_eq_ker isArtinian_of_range_eq_ker
instance isArtinian_prod [IsArtinian R M] [IsArtinian R P] : IsArtinian R (M × P) :=
isArtinian_of_range_eq_ker (LinearMap.inl R M P) (LinearMap.snd R M P) LinearMap.inl_injective
LinearMap.snd_surjective (LinearMap.range_inl R M P)
#align is_artinian_prod isArtinian_prod
instance (priority := 100) isArtinian_of_finite [Finite M] : IsArtinian R M :=
⟨Finite.wellFounded_of_trans_of_irrefl _⟩
#align is_artinian_of_finite isArtinian_of_finite
-- Porting note: elab_as_elim can only be global and cannot be changed on an imported decl
-- attribute [local elab_as_elim] Finite.induction_empty_option
instance isArtinian_pi {R ι : Type*} [Finite ι] :
∀ {M : ι → Type*} [Ring R] [∀ i, AddCommGroup (M i)],
∀ [∀ i, Module R (M i)], ∀ [∀ i, IsArtinian R (M i)], IsArtinian R (∀ i, M i) := by
apply Finite.induction_empty_option _ _ _ ι
· intro α β e hα M _ _ _ _
have := @hα
exact isArtinian_of_linearEquiv (LinearEquiv.piCongrLeft R M e)
· intro M _ _ _ _
infer_instance
· intro α _ ih M _ _ _ _
have := @ih
exact isArtinian_of_linearEquiv (LinearEquiv.piOptionEquivProd R).symm
#align is_artinian_pi isArtinian_pi
instance isArtinian_pi' {R ι M : Type*} [Ring R] [AddCommGroup M] [Module R M] [Finite ι]
[IsArtinian R M] : IsArtinian R (ι → M) :=
isArtinian_pi
#align is_artinian_pi' isArtinian_pi'
--porting note (#10754): new instance
instance isArtinian_finsupp {R ι M : Type*} [Ring R] [AddCommGroup M] [Module R M] [Finite ι]
[IsArtinian R M] : IsArtinian R (ι →₀ M) :=
isArtinian_of_linearEquiv (Finsupp.linearEquivFunOnFinite _ _ _).symm
end
open IsArtinian Submodule Function
section Ring
variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M]
theorem isArtinian_iff_wellFounded :
IsArtinian R M ↔ WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) :=
⟨fun h => h.1, IsArtinian.mk⟩
#align is_artinian_iff_well_founded isArtinian_iff_wellFounded
| Mathlib/RingTheory/Artinian.lean | 175 | 195 | theorem IsArtinian.finite_of_linearIndependent [Nontrivial R] [IsArtinian R M] {s : Set M}
(hs : LinearIndependent R ((↑) : s → M)) : s.Finite := by |
refine by_contradiction fun hf => (RelEmbedding.wellFounded_iff_no_descending_seq.1
(wellFounded_submodule_lt (R := R) (M := M))).elim' ?_
have f : ℕ ↪ s := Set.Infinite.natEmbedding s hf
have : ∀ n, (↑) ∘ f '' { m | n ≤ m } ⊆ s := by
rintro n x ⟨y, _, rfl⟩
exact (f y).2
have : ∀ a b : ℕ, a ≤ b ↔
span R (Subtype.val ∘ f '' { m | b ≤ m }) ≤ span R (Subtype.val ∘ f '' { m | a ≤ m }) := by
intro a b
rw [span_le_span_iff hs (this b) (this a),
Set.image_subset_image_iff (Subtype.coe_injective.comp f.injective), Set.subset_def]
simp only [Set.mem_setOf_eq]
exact ⟨fun hab x => le_trans hab, fun h => h _ le_rfl⟩
exact ⟨⟨fun n => span R (Subtype.val ∘ f '' { m | n ≤ m }), fun x y => by
rw [le_antisymm_iff, ← this y x, ← this x y]
exact fun ⟨h₁, h₂⟩ => le_antisymm_iff.2 ⟨h₂, h₁⟩⟩, by
intro a b
conv_rhs => rw [GT.gt, lt_iff_le_not_le, this, this, ← lt_iff_le_not_le]
rfl⟩
| 19 |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Polynomial.RingDivision
#align_import data.polynomial.mirror from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
namespace Polynomial
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] (p q : R[X])
noncomputable def mirror :=
p.reverse * X ^ p.natTrailingDegree
#align polynomial.mirror Polynomial.mirror
@[simp]
theorem mirror_zero : (0 : R[X]).mirror = 0 := by simp [mirror]
#align polynomial.mirror_zero Polynomial.mirror_zero
theorem mirror_monomial (n : ℕ) (a : R) : (monomial n a).mirror = monomial n a := by
classical
by_cases ha : a = 0
· rw [ha, monomial_zero_right, mirror_zero]
· rw [mirror, reverse, natDegree_monomial n a, if_neg ha, natTrailingDegree_monomial ha, ←
C_mul_X_pow_eq_monomial, reflect_C_mul_X_pow, revAt_le (le_refl n), tsub_self, pow_zero,
mul_one]
#align polynomial.mirror_monomial Polynomial.mirror_monomial
theorem mirror_C (a : R) : (C a).mirror = C a :=
mirror_monomial 0 a
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_C Polynomial.mirror_C
theorem mirror_X : X.mirror = (X : R[X]) :=
mirror_monomial 1 (1 : R)
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_X Polynomial.mirror_X
theorem mirror_natDegree : p.mirror.natDegree = p.natDegree := by
by_cases hp : p = 0
· rw [hp, mirror_zero]
nontriviality R
rw [mirror, natDegree_mul', reverse_natDegree, natDegree_X_pow,
tsub_add_cancel_of_le p.natTrailingDegree_le_natDegree]
rwa [leadingCoeff_X_pow, mul_one, reverse_leadingCoeff, Ne, trailingCoeff_eq_zero]
#align polynomial.mirror_nat_degree Polynomial.mirror_natDegree
theorem mirror_natTrailingDegree : p.mirror.natTrailingDegree = p.natTrailingDegree := by
by_cases hp : p = 0
· rw [hp, mirror_zero]
· rw [mirror, natTrailingDegree_mul_X_pow ((mt reverse_eq_zero.mp) hp),
natTrailingDegree_reverse, zero_add]
#align polynomial.mirror_nat_trailing_degree Polynomial.mirror_natTrailingDegree
theorem coeff_mirror (n : ℕ) :
p.mirror.coeff n = p.coeff (revAt (p.natDegree + p.natTrailingDegree) n) := by
by_cases h2 : p.natDegree < n
· rw [coeff_eq_zero_of_natDegree_lt (by rwa [mirror_natDegree])]
by_cases h1 : n ≤ p.natDegree + p.natTrailingDegree
· rw [revAt_le h1, coeff_eq_zero_of_lt_natTrailingDegree]
exact (tsub_lt_iff_left h1).mpr (Nat.add_lt_add_right h2 _)
· rw [← revAtFun_eq, revAtFun, if_neg h1, coeff_eq_zero_of_natDegree_lt h2]
rw [not_lt] at h2
rw [revAt_le (h2.trans (Nat.le_add_right _ _))]
by_cases h3 : p.natTrailingDegree ≤ n
· rw [← tsub_add_eq_add_tsub h2, ← tsub_tsub_assoc h2 h3, mirror, coeff_mul_X_pow', if_pos h3,
coeff_reverse, revAt_le (tsub_le_self.trans h2)]
rw [not_le] at h3
rw [coeff_eq_zero_of_natDegree_lt (lt_tsub_iff_right.mpr (Nat.add_lt_add_left h3 _))]
exact coeff_eq_zero_of_lt_natTrailingDegree (by rwa [mirror_natTrailingDegree])
#align polynomial.coeff_mirror Polynomial.coeff_mirror
--TODO: Extract `Finset.sum_range_rev_at` lemma.
| Mathlib/Algebra/Polynomial/Mirror.lean | 101 | 120 | theorem mirror_eval_one : p.mirror.eval 1 = p.eval 1 := by |
simp_rw [eval_eq_sum_range, one_pow, mul_one, mirror_natDegree]
refine Finset.sum_bij_ne_zero ?_ ?_ ?_ ?_ ?_
· exact fun n _ _ => revAt (p.natDegree + p.natTrailingDegree) n
· intro n hn hp
rw [Finset.mem_range_succ_iff] at *
rw [revAt_le (hn.trans (Nat.le_add_right _ _))]
rw [tsub_le_iff_tsub_le, add_comm, add_tsub_cancel_right, ← mirror_natTrailingDegree]
exact natTrailingDegree_le_of_ne_zero hp
· exact fun n₁ _ _ _ _ _ h => by rw [← @revAt_invol _ n₁, h, revAt_invol]
· intro n hn hp
use revAt (p.natDegree + p.natTrailingDegree) n
refine ⟨?_, ?_, revAt_invol⟩
· rw [Finset.mem_range_succ_iff] at *
rw [revAt_le (hn.trans (Nat.le_add_right _ _))]
rw [tsub_le_iff_tsub_le, add_comm, add_tsub_cancel_right]
exact natTrailingDegree_le_of_ne_zero hp
· change p.mirror.coeff _ ≠ 0
rwa [coeff_mirror, revAt_invol]
· exact fun n _ _ => p.coeff_mirror n
| 19 |
import Mathlib.GroupTheory.Abelianization
import Mathlib.GroupTheory.Exponent
import Mathlib.GroupTheory.Transfer
#align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6"
open scoped Pointwise
namespace Subgroup
open MemRightTransversals
variable {G : Type*} [Group G] {H : Subgroup G} {R S : Set G}
| Mathlib/GroupTheory/Schreier.lean | 37 | 58 | theorem closure_mul_image_mul_eq_top
(hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure S = ⊤) :
(closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹)) * R = ⊤ := by |
let f : G → R := fun g => toFun hR g
let U : Set G := (R * S).image fun g => g * (f g : G)⁻¹
change (closure U : Set G) * R = ⊤
refine top_le_iff.mp fun g _ => ?_
refine closure_induction_right ?_ ?_ ?_ (eq_top_iff.mp hS (mem_top g))
· exact ⟨1, (closure U).one_mem, 1, hR1, one_mul 1⟩
· rintro - - s hs ⟨u, hu, r, hr, rfl⟩
rw [show u * r * s = u * (r * s * (f (r * s) : G)⁻¹) * f (r * s) by group]
refine Set.mul_mem_mul ((closure U).mul_mem hu ?_) (f (r * s)).coe_prop
exact subset_closure ⟨r * s, Set.mul_mem_mul hr hs, rfl⟩
· rintro - - s hs ⟨u, hu, r, hr, rfl⟩
rw [show u * r * s⁻¹ = u * (f (r * s⁻¹) * s * r⁻¹)⁻¹ * f (r * s⁻¹) by group]
refine Set.mul_mem_mul ((closure U).mul_mem hu ((closure U).inv_mem ?_)) (f (r * s⁻¹)).2
refine subset_closure ⟨f (r * s⁻¹) * s, Set.mul_mem_mul (f (r * s⁻¹)).2 hs, ?_⟩
rw [mul_right_inj, inv_inj, ← Subtype.coe_mk r hr, ← Subtype.ext_iff, Subtype.coe_mk]
apply (mem_rightTransversals_iff_existsUnique_mul_inv_mem.mp hR (f (r * s⁻¹) * s)).unique
(mul_inv_toFun_mem hR (f (r * s⁻¹) * s))
rw [mul_assoc, ← inv_inv s, ← mul_inv_rev, inv_inv]
exact toFun_mul_inv_mem hR (r * s⁻¹)
| 19 |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Order.Filter.IndicatorFunction
open MeasureTheory
section DominatedConvergenceTheorem
open Set Filter TopologicalSpace ENNReal
open scoped Topology
namespace MeasureTheory
variable {α E G: Type*}
[NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
[NormedAddCommGroup G] [NormedSpace ℝ G]
{f g : α → E} {m : MeasurableSpace α} {μ : Measure α}
theorem tendsto_integral_of_dominated_convergence {F : ℕ → α → G} {f : α → G} (bound : α → ℝ)
(F_measurable : ∀ n, AEStronglyMeasurable (F n) μ) (bound_integrable : Integrable bound μ)
(h_bound : ∀ n, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound a)
(h_lim : ∀ᵐ a ∂μ, Tendsto (fun n => F n a) atTop (𝓝 (f a))) :
Tendsto (fun n => ∫ a, F n a ∂μ) atTop (𝓝 <| ∫ a, f a ∂μ) := by
by_cases hG : CompleteSpace G
· simp only [integral, hG, L1.integral]
exact tendsto_setToFun_of_dominated_convergence (dominatedFinMeasAdditive_weightedSMul μ)
bound F_measurable bound_integrable h_bound h_lim
· simp [integral, hG]
#align measure_theory.tendsto_integral_of_dominated_convergence MeasureTheory.tendsto_integral_of_dominated_convergence
theorem tendsto_integral_filter_of_dominated_convergence {ι} {l : Filter ι} [l.IsCountablyGenerated]
{F : ι → α → G} {f : α → G} (bound : α → ℝ) (hF_meas : ∀ᶠ n in l, AEStronglyMeasurable (F n) μ)
(h_bound : ∀ᶠ n in l, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
(h_lim : ∀ᵐ a ∂μ, Tendsto (fun n => F n a) l (𝓝 (f a))) :
Tendsto (fun n => ∫ a, F n a ∂μ) l (𝓝 <| ∫ a, f a ∂μ) := by
by_cases hG : CompleteSpace G
· simp only [integral, hG, L1.integral]
exact tendsto_setToFun_filter_of_dominated_convergence (dominatedFinMeasAdditive_weightedSMul μ)
bound hF_meas h_bound bound_integrable h_lim
· simp [integral, hG, tendsto_const_nhds]
#align measure_theory.tendsto_integral_filter_of_dominated_convergence MeasureTheory.tendsto_integral_filter_of_dominated_convergence
| Mathlib/MeasureTheory/Integral/DominatedConvergence.lean | 79 | 104 | theorem hasSum_integral_of_dominated_convergence {ι} [Countable ι] {F : ι → α → G} {f : α → G}
(bound : ι → α → ℝ) (hF_meas : ∀ n, AEStronglyMeasurable (F n) μ)
(h_bound : ∀ n, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound n a)
(bound_summable : ∀ᵐ a ∂μ, Summable fun n => bound n a)
(bound_integrable : Integrable (fun a => ∑' n, bound n a) μ)
(h_lim : ∀ᵐ a ∂μ, HasSum (fun n => F n a) (f a)) :
HasSum (fun n => ∫ a, F n a ∂μ) (∫ a, f a ∂μ) := by |
have hb_nonneg : ∀ᵐ a ∂μ, ∀ n, 0 ≤ bound n a :=
eventually_countable_forall.2 fun n => (h_bound n).mono fun a => (norm_nonneg _).trans
have hb_le_tsum : ∀ n, bound n ≤ᵐ[μ] fun a => ∑' n, bound n a := by
intro n
filter_upwards [hb_nonneg, bound_summable]
with _ ha0 ha_sum using le_tsum ha_sum _ fun i _ => ha0 i
have hF_integrable : ∀ n, Integrable (F n) μ := by
refine fun n => bound_integrable.mono' (hF_meas n) ?_
exact EventuallyLE.trans (h_bound n) (hb_le_tsum n)
simp only [HasSum, ← integral_finset_sum _ fun n _ => hF_integrable n]
refine tendsto_integral_filter_of_dominated_convergence
(fun a => ∑' n, bound n a) ?_ ?_ bound_integrable h_lim
· exact eventually_of_forall fun s => s.aestronglyMeasurable_sum fun n _ => hF_meas n
· filter_upwards with s
filter_upwards [eventually_countable_forall.2 h_bound, hb_nonneg, bound_summable]
with a hFa ha0 has
calc
‖∑ n ∈ s, F n a‖ ≤ ∑ n ∈ s, bound n a := norm_sum_le_of_le _ fun n _ => hFa n
_ ≤ ∑' n, bound n a := sum_le_tsum _ (fun n _ => ha0 n) has
| 19 |
import Mathlib.Algebra.IsPrimePow
import Mathlib.Data.Nat.Factorization.Basic
#align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : ℕ)
theorem IsPrimePow.minFac_pow_factorization_eq {n : ℕ} (hn : IsPrimePow n) :
n.minFac ^ n.factorization n.minFac = n := by
obtain ⟨p, k, hp, hk, rfl⟩ := hn
rw [← Nat.prime_iff] at hp
rw [hp.pow_minFac hk.ne', hp.factorization_pow, Finsupp.single_eq_same]
#align is_prime_pow.min_fac_pow_factorization_eq IsPrimePow.minFac_pow_factorization_eq
theorem isPrimePow_of_minFac_pow_factorization_eq {n : ℕ}
(h : n.minFac ^ n.factorization n.minFac = n) (hn : n ≠ 1) : IsPrimePow n := by
rcases eq_or_ne n 0 with (rfl | hn')
· simp_all
refine ⟨_, _, (Nat.minFac_prime hn).prime, ?_, h⟩
simp [pos_iff_ne_zero, ← Finsupp.mem_support_iff, Nat.support_factorization, hn',
Nat.minFac_prime hn, Nat.minFac_dvd]
#align is_prime_pow_of_min_fac_pow_factorization_eq isPrimePow_of_minFac_pow_factorization_eq
theorem isPrimePow_iff_minFac_pow_factorization_eq {n : ℕ} (hn : n ≠ 1) :
IsPrimePow n ↔ n.minFac ^ n.factorization n.minFac = n :=
⟨fun h => h.minFac_pow_factorization_eq, fun h => isPrimePow_of_minFac_pow_factorization_eq h hn⟩
#align is_prime_pow_iff_min_fac_pow_factorization_eq isPrimePow_iff_minFac_pow_factorization_eq
theorem isPrimePow_iff_factorization_eq_single {n : ℕ} :
IsPrimePow n ↔ ∃ p k : ℕ, 0 < k ∧ n.factorization = Finsupp.single p k := by
rw [isPrimePow_nat_iff]
refine exists₂_congr fun p k => ?_
constructor
· rintro ⟨hp, hk, hn⟩
exact ⟨hk, by rw [← hn, Nat.Prime.factorization_pow hp]⟩
· rintro ⟨hk, hn⟩
have hn0 : n ≠ 0 := by
rintro rfl
simp_all only [Finsupp.single_eq_zero, eq_comm, Nat.factorization_zero, hk.ne']
rw [Nat.eq_pow_of_factorization_eq_single hn0 hn]
exact ⟨Nat.prime_of_mem_primeFactors <|
Finsupp.mem_support_iff.2 (by simp [hn, hk.ne'] : n.factorization p ≠ 0), hk, rfl⟩
#align is_prime_pow_iff_factorization_eq_single isPrimePow_iff_factorization_eq_single
theorem isPrimePow_iff_card_primeFactors_eq_one {n : ℕ} :
IsPrimePow n ↔ n.primeFactors.card = 1 := by
simp_rw [isPrimePow_iff_factorization_eq_single, ← Nat.support_factorization,
Finsupp.card_support_eq_one', pos_iff_ne_zero]
#align is_prime_pow_iff_card_support_factorization_eq_one isPrimePow_iff_card_primeFactors_eq_one
theorem IsPrimePow.exists_ord_compl_eq_one {n : ℕ} (h : IsPrimePow n) :
∃ p : ℕ, p.Prime ∧ ord_compl[p] n = 1 := by
rcases eq_or_ne n 0 with (rfl | hn0); · cases not_isPrimePow_zero h
rcases isPrimePow_iff_factorization_eq_single.mp h with ⟨p, k, hk0, h1⟩
rcases em' p.Prime with (pp | pp)
· refine absurd ?_ hk0.ne'
simp [← Nat.factorization_eq_zero_of_non_prime n pp, h1]
refine ⟨p, pp, ?_⟩
refine Nat.eq_of_factorization_eq (Nat.ord_compl_pos p hn0).ne' (by simp) fun q => ?_
rw [Nat.factorization_ord_compl n p, h1]
simp
#align is_prime_pow.exists_ord_compl_eq_one IsPrimePow.exists_ord_compl_eq_one
theorem exists_ord_compl_eq_one_iff_isPrimePow {n : ℕ} (hn : n ≠ 1) :
IsPrimePow n ↔ ∃ p : ℕ, p.Prime ∧ ord_compl[p] n = 1 := by
refine ⟨fun h => IsPrimePow.exists_ord_compl_eq_one h, fun h => ?_⟩
rcases h with ⟨p, pp, h⟩
rw [isPrimePow_nat_iff]
rw [← Nat.eq_of_dvd_of_div_eq_one (Nat.ord_proj_dvd n p) h] at hn ⊢
refine ⟨p, n.factorization p, pp, ?_, by simp⟩
contrapose! hn
simp [Nat.le_zero.1 hn]
#align exists_ord_compl_eq_one_iff_is_prime_pow exists_ord_compl_eq_one_iff_isPrimePow
| Mathlib/Data/Nat/Factorization/PrimePow.lean | 89 | 108 | theorem isPrimePow_iff_unique_prime_dvd {n : ℕ} : IsPrimePow n ↔ ∃! p : ℕ, p.Prime ∧ p ∣ n := by |
rw [isPrimePow_nat_iff]
constructor
· rintro ⟨p, k, hp, hk, rfl⟩
refine ⟨p, ⟨hp, dvd_pow_self _ hk.ne'⟩, ?_⟩
rintro q ⟨hq, hq'⟩
exact (Nat.prime_dvd_prime_iff_eq hq hp).1 (hq.dvd_of_dvd_pow hq')
rintro ⟨p, ⟨hp, hn⟩, hq⟩
rcases eq_or_ne n 0 with (rfl | hn₀)
· cases (hq 2 ⟨Nat.prime_two, dvd_zero 2⟩).trans (hq 3 ⟨Nat.prime_three, dvd_zero 3⟩).symm
refine ⟨p, n.factorization p, hp, hp.factorization_pos_of_dvd hn₀ hn, ?_⟩
simp only [and_imp] at hq
apply Nat.dvd_antisymm (Nat.ord_proj_dvd _ _)
-- We need to show n ∣ p ^ n.factorization p
apply Nat.dvd_of_factors_subperm hn₀
rw [hp.factors_pow, List.subperm_ext_iff]
intro q hq'
rw [Nat.mem_factors hn₀] at hq'
cases hq _ hq'.1 hq'.2
simp
| 19 |
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Finset.Sum
import Mathlib.Logic.Embedding.Set
#align_import data.fintype.sum from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
universe u v
variable {α β : Type*}
open Finset
instance (α : Type u) (β : Type v) [Fintype α] [Fintype β] : Fintype (Sum α β) where
elems := univ.disjSum univ
complete := by rintro (_ | _) <;> simp
@[simp]
theorem Finset.univ_disjSum_univ {α β : Type*} [Fintype α] [Fintype β] :
univ.disjSum univ = (univ : Finset (Sum α β)) :=
rfl
#align finset.univ_disj_sum_univ Finset.univ_disjSum_univ
@[simp]
theorem Fintype.card_sum [Fintype α] [Fintype β] :
Fintype.card (Sum α β) = Fintype.card α + Fintype.card β :=
card_disjSum _ _
#align fintype.card_sum Fintype.card_sum
def fintypeOfFintypeNe (a : α) (h : Fintype { b // b ≠ a }) : Fintype α :=
Fintype.ofBijective (Sum.elim ((↑) : { b // b = a } → α) ((↑) : { b // b ≠ a } → α)) <| by
classical exact (Equiv.sumCompl (· = a)).bijective
#align fintype_of_fintype_ne fintypeOfFintypeNe
theorem image_subtype_ne_univ_eq_image_erase [Fintype α] [DecidableEq β] (k : β) (b : α → β) :
image (fun i : { a // b a ≠ k } => b ↑i) univ = (image b univ).erase k := by
apply subset_antisymm
· rw [image_subset_iff]
intro i _
apply mem_erase_of_ne_of_mem i.2 (mem_image_of_mem _ (mem_univ _))
· intro i hi
rw [mem_image]
rcases mem_image.1 (erase_subset _ _ hi) with ⟨a, _, ha⟩
subst ha
exact ⟨⟨a, ne_of_mem_erase hi⟩, mem_univ _, rfl⟩
#align image_subtype_ne_univ_eq_image_erase image_subtype_ne_univ_eq_image_erase
theorem image_subtype_univ_ssubset_image_univ [Fintype α] [DecidableEq β] (k : β) (b : α → β)
(hk : k ∈ Finset.image b univ) (p : β → Prop) [DecidablePred p] (hp : ¬p k) :
image (fun i : { a // p (b a) } => b ↑i) univ ⊂ image b univ := by
constructor
· intro x hx
rcases mem_image.1 hx with ⟨y, _, hy⟩
exact hy ▸ mem_image_of_mem b (mem_univ (y : α))
· intro h
rw [mem_image] at hk
rcases hk with ⟨k', _, hk'⟩
subst hk'
have := h (mem_image_of_mem b (mem_univ k'))
rw [mem_image] at this
rcases this with ⟨j, _, hj'⟩
exact hp (hj' ▸ j.2)
#align image_subtype_univ_ssubset_image_univ image_subtype_univ_ssubset_image_univ
| Mathlib/Data/Fintype/Sum.lean | 79 | 100 | theorem Finset.exists_equiv_extend_of_card_eq [Fintype α] [DecidableEq β] {t : Finset β}
(hαt : Fintype.card α = t.card) {s : Finset α} {f : α → β} (hfst : Finset.image f s ⊆ t)
(hfs : Set.InjOn f s) : ∃ g : α ≃ t, ∀ i ∈ s, (g i : β) = f i := by |
classical
induction' s using Finset.induction with a s has H generalizing f
· obtain ⟨e⟩ : Nonempty (α ≃ ↥t) := by rwa [← Fintype.card_eq, Fintype.card_coe]
use e
simp
have hfst' : Finset.image f s ⊆ t := (Finset.image_mono _ (s.subset_insert a)).trans hfst
have hfs' : Set.InjOn f s := hfs.mono (s.subset_insert a)
obtain ⟨g', hg'⟩ := H hfst' hfs'
have hfat : f a ∈ t := hfst (mem_image_of_mem _ (s.mem_insert_self a))
use g'.trans (Equiv.swap (⟨f a, hfat⟩ : t) (g' a))
simp_rw [mem_insert]
rintro i (rfl | hi)
· simp
rw [Equiv.trans_apply, Equiv.swap_apply_of_ne_of_ne, hg' _ hi]
· exact
ne_of_apply_ne Subtype.val
(ne_of_eq_of_ne (hg' _ hi) <|
hfs.ne (subset_insert _ _ hi) (mem_insert_self _ _) <| ne_of_mem_of_not_mem hi has)
· exact g'.injective.ne (ne_of_mem_of_not_mem hi has)
| 19 |
import Mathlib.LinearAlgebra.FreeModule.IdealQuotient
import Mathlib.RingTheory.Norm
#align_import linear_algebra.free_module.norm from "leanprover-community/mathlib"@"90b0d53ee6ffa910e5c2a977ce7e2fc704647974"
open Ideal Polynomial
open scoped Polynomial
variable {R S ι : Type*} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [CommRing S]
[IsDomain S] [Algebra R S]
section CommRing
variable (F : Type*) [CommRing F] [Algebra F R] [Algebra F S] [IsScalarTower F R S]
| Mathlib/LinearAlgebra/FreeModule/Norm.lean | 30 | 50 | theorem associated_norm_prod_smith [Fintype ι] (b : Basis ι R S) {f : S} (hf : f ≠ 0) :
Associated (Algebra.norm R f) (∏ i, smithCoeffs b _ (span_singleton_eq_bot.not.2 hf) i) := by |
have hI := span_singleton_eq_bot.not.2 hf
let b' := ringBasis b (span {f}) hI
classical
rw [← Matrix.det_diagonal, ← LinearMap.det_toLin b']
let e :=
(b'.equiv ((span {f}).selfBasis b hI) <| Equiv.refl _).trans
((LinearEquiv.coord S S f hf).restrictScalars R)
refine (LinearMap.associated_det_of_eq_comp e _ _ ?_).symm
dsimp only [e, LinearEquiv.trans_apply]
simp_rw [← LinearEquiv.coe_toLinearMap, ← LinearMap.comp_apply, ← LinearMap.ext_iff]
refine b'.ext fun i => ?_
simp_rw [LinearMap.comp_apply, LinearEquiv.coe_toLinearMap, Matrix.toLin_apply, Basis.repr_self,
Finsupp.single_eq_pi_single, Matrix.diagonal_mulVec_single, Pi.single_apply, ite_smul,
zero_smul, Finset.sum_ite_eq', mul_one, if_pos (Finset.mem_univ _), b'.equiv_apply]
change _ = f * _
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [mul_comm, ← smul_eq_mul, LinearEquiv.restrictScalars_apply, LinearEquiv.coord_apply_smul,
Ideal.selfBasis_def]
rfl
| 19 |
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.GaloisConnection
import Mathlib.Order.Hom.Basic
#align_import order.hom.order from "leanprover-community/mathlib"@"ba2245edf0c8bb155f1569fd9b9492a9b384cde6"
namespace OrderHom
variable {α β : Type*}
section Preorder
variable [Preorder α]
instance [SemilatticeSup β] : Sup (α →o β) where
sup f g := ⟨fun a => f a ⊔ g a, f.mono.sup g.mono⟩
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_sup [SemilatticeSup β] (f g : α →o β) :
((f ⊔ g : α →o β) : α → β) = (f : α → β) ⊔ g := rfl
instance [SemilatticeSup β] : SemilatticeSup (α →o β) :=
{ (_ : PartialOrder (α →o β)) with
sup := Sup.sup
le_sup_left := fun _ _ _ => le_sup_left
le_sup_right := fun _ _ _ => le_sup_right
sup_le := fun _ _ _ h₀ h₁ x => sup_le (h₀ x) (h₁ x) }
instance [SemilatticeInf β] : Inf (α →o β) where
inf f g := ⟨fun a => f a ⊓ g a, f.mono.inf g.mono⟩
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_inf [SemilatticeInf β] (f g : α →o β) :
((f ⊓ g : α →o β) : α → β) = (f : α → β) ⊓ g := rfl
instance [SemilatticeInf β] : SemilatticeInf (α →o β) :=
{ (_ : PartialOrder (α →o β)), (dualIso α β).symm.toGaloisInsertion.liftSemilatticeInf with
inf := (· ⊓ ·) }
instance lattice [Lattice β] : Lattice (α →o β) :=
{ (_ : SemilatticeSup (α →o β)), (_ : SemilatticeInf (α →o β)) with }
@[simps]
instance [Preorder β] [OrderBot β] : Bot (α →o β) where
bot := const α ⊥
instance orderBot [Preorder β] [OrderBot β] : OrderBot (α →o β) where
bot := ⊥
bot_le _ _ := bot_le
@[simps]
instance instTopOrderHom [Preorder β] [OrderTop β] : Top (α →o β) where
top := const α ⊤
instance orderTop [Preorder β] [OrderTop β] : OrderTop (α →o β) where
top := ⊤
le_top _ _ := le_top
instance [CompleteLattice β] : InfSet (α →o β) where
sInf s := ⟨fun x => ⨅ f ∈ s, (f : _) x, fun _ _ h => iInf₂_mono fun f _ => f.mono h⟩
@[simp]
theorem sInf_apply [CompleteLattice β] (s : Set (α →o β)) (x : α) :
sInf s x = ⨅ f ∈ s, (f : _) x :=
rfl
#align order_hom.Inf_apply OrderHom.sInf_apply
theorem iInf_apply {ι : Sort*} [CompleteLattice β] (f : ι → α →o β) (x : α) :
(⨅ i, f i) x = ⨅ i, f i x :=
(sInf_apply _ _).trans iInf_range
#align order_hom.infi_apply OrderHom.iInf_apply
@[simp, norm_cast]
theorem coe_iInf {ι : Sort*} [CompleteLattice β] (f : ι → α →o β) :
((⨅ i, f i : α →o β) : α → β) = ⨅ i, (f i : α → β) := by
funext x; simp [iInf_apply]
#align order_hom.coe_infi OrderHom.coe_iInf
instance [CompleteLattice β] : SupSet (α →o β) where
sSup s := ⟨fun x => ⨆ f ∈ s, (f : _) x, fun _ _ h => iSup₂_mono fun f _ => f.mono h⟩
@[simp]
theorem sSup_apply [CompleteLattice β] (s : Set (α →o β)) (x : α) :
sSup s x = ⨆ f ∈ s, (f : _) x :=
rfl
#align order_hom.Sup_apply OrderHom.sSup_apply
theorem iSup_apply {ι : Sort*} [CompleteLattice β] (f : ι → α →o β) (x : α) :
(⨆ i, f i) x = ⨆ i, f i x :=
(sSup_apply _ _).trans iSup_range
#align order_hom.supr_apply OrderHom.iSup_apply
@[simp, norm_cast]
theorem coe_iSup {ι : Sort*} [CompleteLattice β] (f : ι → α →o β) :
((⨆ i, f i : α →o β) : α → β) = ⨆ i, (f i : α → β) := by
funext x; simp [iSup_apply]
#align order_hom.coe_supr OrderHom.coe_iSup
instance [CompleteLattice β] : CompleteLattice (α →o β) :=
{ (_ : Lattice (α →o β)), OrderHom.orderTop, OrderHom.orderBot with
-- sSup := SupSet.sSup -- Porting note: removed, unnecessary?
-- Porting note: Added `by apply`, was `fun s f hf x => le_iSup_of_le f (le_iSup _ hf)`
le_sSup := fun s f hf x => le_iSup_of_le f (by apply le_iSup _ hf)
sSup_le := fun s f hf x => iSup₂_le fun g hg => hf g hg x
--inf := sInf -- Porting note: removed, unnecessary?
le_sInf := fun s f hf x => le_iInf₂ fun g hg => hf g hg x
sInf_le := fun s f hf x => iInf_le_of_le f (iInf_le _ hf)
}
| Mathlib/Order/Hom/Order.lean | 133 | 154 | theorem iterate_sup_le_sup_iff {α : Type*} [SemilatticeSup α] (f : α →o α) :
(∀ n₁ n₂ a₁ a₂, f^[n₁ + n₂] (a₁ ⊔ a₂) ≤ f^[n₁] a₁ ⊔ f^[n₂] a₂) ↔
∀ a₁ a₂, f (a₁ ⊔ a₂) ≤ f a₁ ⊔ a₂ := by |
constructor <;> intro h
· exact h 1 0
· intro n₁ n₂ a₁ a₂
have h' : ∀ n a₁ a₂, f^[n] (a₁ ⊔ a₂) ≤ f^[n] a₁ ⊔ a₂ := by
intro n
induction' n with n ih <;> intro a₁ a₂
· rfl
· calc
f^[n + 1] (a₁ ⊔ a₂) = f^[n] (f (a₁ ⊔ a₂)) := Function.iterate_succ_apply f n _
_ ≤ f^[n] (f a₁ ⊔ a₂) := f.mono.iterate n (h a₁ a₂)
_ ≤ f^[n] (f a₁) ⊔ a₂ := ih _ _
_ = f^[n + 1] a₁ ⊔ a₂ := by rw [← Function.iterate_succ_apply]
calc
f^[n₁ + n₂] (a₁ ⊔ a₂) = f^[n₁] (f^[n₂] (a₁ ⊔ a₂)) :=
Function.iterate_add_apply f n₁ n₂ _
_ = f^[n₁] (f^[n₂] (a₂ ⊔ a₁)) := by rw [sup_comm]
_ ≤ f^[n₁] (f^[n₂] a₂ ⊔ a₁) := f.mono.iterate n₁ (h' n₂ _ _)
_ = f^[n₁] (a₁ ⊔ f^[n₂] a₂) := by rw [sup_comm]
_ ≤ f^[n₁] a₁ ⊔ f^[n₂] a₂ := h' n₁ a₁ _
| 19 |
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Normed.Group.Lemmas
import Mathlib.Analysis.NormedSpace.AddTorsor
import Mathlib.Analysis.NormedSpace.AffineIsometry
import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace
import Mathlib.Analysis.NormedSpace.RieszLemma
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Topology.Algebra.Module.FiniteDimension
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.Matrix
#align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057"
universe u v w x
noncomputable section
open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology
NNReal Metric
section CompleteField
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Type v} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type w} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {F' : Type x}
[AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F']
[ContinuousSMul 𝕜 F'] [CompleteSpace 𝕜]
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E)
-- Porting note: this could be easier with `det_cases`
by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E)
· rcases h with ⟨s, ⟨b⟩⟩
haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b
simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b]
refine Continuous.matrix_det ?_
exact
((LinearMap.toMatrix b b).toLinearMap.comp
(ContinuousLinearMap.coeLM 𝕜)).continuous_of_finiteDimensional
· -- Porting note: was `unfold LinearMap.det`
rw [LinearMap.det_def]
simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const
#align continuous_linear_map.continuous_det ContinuousLinearMap.continuous_det
irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E']
[FiniteDimensional ℝ E'] : ℝ≥0 :=
let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv
max (‖A.symm.toContinuousLinearMap‖₊ * ‖A.toContinuousLinearMap‖₊) 1
#align lipschitz_extension_constant lipschitzExtensionConstant
theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E']
[FiniteDimensional ℝ E'] : 0 < lipschitzExtensionConstant E' := by
rw [lipschitzExtensionConstant]
exact zero_lt_one.trans_le (le_max_right _ _)
#align lipschitz_extension_constant_pos lipschitzExtensionConstant_pos
| Mathlib/Analysis/NormedSpace/FiniteDimension.lean | 198 | 220 | theorem LipschitzOnWith.extend_finite_dimension {α : Type*} [PseudoMetricSpace α] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] {s : Set α} {f : α → E'}
{K : ℝ≥0} (hf : LipschitzOnWith K f s) :
∃ g : α → E', LipschitzWith (lipschitzExtensionConstant E' * K) g ∧ EqOn f g s := by |
/- This result is already known for spaces `ι → ℝ`. We use a continuous linear equiv between
`E'` and such a space to transfer the result to `E'`. -/
let ι : Type _ := Basis.ofVectorSpaceIndex ℝ E'
let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv
have LA : LipschitzWith ‖A.toContinuousLinearMap‖₊ A := by apply A.lipschitz
have L : LipschitzOnWith (‖A.toContinuousLinearMap‖₊ * K) (A ∘ f) s :=
LA.comp_lipschitzOnWith hf
obtain ⟨g, hg, gs⟩ :
∃ g : α → ι → ℝ, LipschitzWith (‖A.toContinuousLinearMap‖₊ * K) g ∧ EqOn (A ∘ f) g s :=
L.extend_pi
refine ⟨A.symm ∘ g, ?_, ?_⟩
· have LAsymm : LipschitzWith ‖A.symm.toContinuousLinearMap‖₊ A.symm := by
apply A.symm.lipschitz
apply (LAsymm.comp hg).weaken
rw [lipschitzExtensionConstant, ← mul_assoc]
exact mul_le_mul' (le_max_left _ _) le_rfl
· intro x hx
have : A (f x) = g x := gs hx
simp only [(· ∘ ·), ← this, A.symm_apply_apply]
| 19 |
import Mathlib.LinearAlgebra.Span
import Mathlib.RingTheory.Ideal.IsPrimary
import Mathlib.RingTheory.Ideal.QuotientOperations
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M]
def IsAssociatedPrime : Prop :=
I.IsPrime ∧ ∃ x : M, I = (R ∙ x).annihilator
#align is_associated_prime IsAssociatedPrime
variable (R)
def associatedPrimes : Set (Ideal R) :=
{ I | IsAssociatedPrime I M }
#align associated_primes associatedPrimes
variable {I J M R}
variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M →ₗ[R] M')
theorem AssociatePrimes.mem_iff : I ∈ associatedPrimes R M ↔ IsAssociatedPrime I M := Iff.rfl
#align associate_primes.mem_iff AssociatePrimes.mem_iff
theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1
#align is_associated_prime.is_prime IsAssociatedPrime.isPrime
theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) :
IsAssociatedPrime I M' := by
obtain ⟨x, rfl⟩ := h.2
refine ⟨h.1, ⟨f x, ?_⟩⟩
ext r
rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, ←
map_smul, ← f.map_zero, hf.eq_iff]
#align is_associated_prime.map_of_injective IsAssociatedPrime.map_of_injective
theorem LinearEquiv.isAssociatedPrime_iff (l : M ≃ₗ[R] M') :
IsAssociatedPrime I M ↔ IsAssociatedPrime I M' :=
⟨fun h => h.map_of_injective l l.injective,
fun h => h.map_of_injective l.symm l.symm.injective⟩
#align linear_equiv.is_associated_prime_iff LinearEquiv.isAssociatedPrime_iff
theorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : ¬IsAssociatedPrime I M := by
rintro ⟨hI, x, hx⟩
apply hI.ne_top
rwa [Subsingleton.elim x 0, Submodule.span_singleton_eq_bot.mpr rfl, Submodule.annihilator_bot]
at hx
#align not_is_associated_prime_of_subsingleton not_isAssociatedPrime_of_subsingleton
variable (R)
| Mathlib/RingTheory/Ideal/AssociatedPrime.lean | 83 | 103 | theorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)
(hx : x ≠ 0) : ∃ P : Ideal R, IsAssociatedPrime P M ∧ (R ∙ x).annihilator ≤ P := by |
have : (R ∙ x).annihilator ≠ ⊤ := by
rwa [Ne, Ideal.eq_top_iff_one, Submodule.mem_annihilator_span_singleton, one_smul]
obtain ⟨P, ⟨l, h₁, y, rfl⟩, h₃⟩ :=
set_has_maximal_iff_noetherian.mpr H
{ P | (R ∙ x).annihilator ≤ P ∧ P ≠ ⊤ ∧ ∃ y : M, P = (R ∙ y).annihilator }
⟨(R ∙ x).annihilator, rfl.le, this, x, rfl⟩
refine ⟨_, ⟨⟨h₁, ?_⟩, y, rfl⟩, l⟩
intro a b hab
rw [or_iff_not_imp_left]
intro ha
rw [Submodule.mem_annihilator_span_singleton] at ha hab
have H₁ : (R ∙ y).annihilator ≤ (R ∙ a • y).annihilator := by
intro c hc
rw [Submodule.mem_annihilator_span_singleton] at hc ⊢
rw [smul_comm, hc, smul_zero]
have H₂ : (Submodule.span R {a • y}).annihilator ≠ ⊤ := by
rwa [Ne, Submodule.annihilator_eq_top_iff, Submodule.span_singleton_eq_bot]
rwa [H₁.eq_of_not_lt (h₃ (R ∙ a • y).annihilator ⟨l.trans H₁, H₂, _, rfl⟩),
Submodule.mem_annihilator_span_singleton, smul_comm, smul_smul]
| 19 |
import Mathlib.CategoryTheory.PathCategory
import Mathlib.CategoryTheory.Functor.FullyFaithful
import Mathlib.CategoryTheory.Bicategory.Free
import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete
#align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff"
open Quiver (Path)
open Quiver.Path
namespace CategoryTheory
open Bicategory Category
universe v u
namespace FreeBicategory
variable {B : Type u} [Quiver.{v + 1} B]
@[simp]
def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b
| _, nil => Hom.id a
| _, cons p f => (inclusionPathAux p).comp (Hom.of f)
#align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux
local instance homCategory' (a b : B) : Category (Hom a b) :=
homCategory a b
def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b :=
Discrete.functor inclusionPathAux
#align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath
def preinclusion (B : Type u) [Quiver.{v + 1} B] :
PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where
obj a := a.as
map := @fun a b f => (@inclusionPath B _ a.as b.as).obj f
map₂ η := (inclusionPath _ _).map η
#align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion
@[simp]
theorem preinclusion_obj (a : B) : (preinclusion B).obj ⟨a⟩ = a :=
rfl
#align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj
@[simp]
theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) :
(preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by
rcases η with ⟨⟨⟩⟩
cases Discrete.ext _ _ (by assumption)
convert (inclusionPath a b).map_id _
#align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂
@[simp]
def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c
| _, _, p, Hom.of f => p.cons f
| _, _, p, Hom.id _ => p
| _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g
#align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux
@[simp]
def normalizeIso {a : B} :
∀ {b c : B} (p : Path a b) (f : Hom b c),
(preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩
| _, _, _, Hom.of _ => Iso.refl _
| _, _, _, Hom.id b => ρ_ _
| _, _, p, Hom.comp f g =>
(α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g
#align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso
theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) :
normalizeAux p f = normalizeAux p g := by
rcases η with ⟨η'⟩
apply @congr_fun _ _ fun p => normalizeAux p f
clear p η
induction η' with
| vcomp _ _ _ _ => apply Eq.trans <;> assumption
| whisker_left _ _ ih => funext; apply congr_fun ih
| whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl
| _ => funext; rfl
#align category_theory.free_bicategory.normalize_aux_congr CategoryTheory.FreeBicategory.normalizeAux_congr
| Mathlib/CategoryTheory/Bicategory/Coherence.lean | 161 | 183 | theorem normalize_naturality {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) :
(preinclusion B).map ⟨p⟩ ◁ η ≫ (normalizeIso p g).hom =
(normalizeIso p f).hom ≫
(preinclusion B).map₂ (eqToHom (Discrete.ext _ _ (normalizeAux_congr p η))) := by |
rcases η with ⟨η'⟩; clear η;
induction η' with
| id => simp
| vcomp η θ ihf ihg =>
simp only [mk_vcomp, Bicategory.whiskerLeft_comp]
slice_lhs 2 3 => rw [ihg]
slice_lhs 1 2 => rw [ihf]
simp
-- p ≠ nil required! See the docstring of `normalizeAux`.
| whisker_left _ _ ih =>
dsimp
rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc, ih]
simp
| whisker_right h η' ih =>
dsimp
rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, ih, comp_whiskerRight]
have := dcongr_arg (fun x => (normalizeIso x h).hom) (normalizeAux_congr p (Quot.mk _ η'))
dsimp at this; simp [this]
| _ => simp
| 19 |
import Mathlib.CategoryTheory.Filtered.Basic
import Mathlib.Topology.Category.TopCat.Limits.Basic
#align_import topology.category.Top.limits.konig from "leanprover-community/mathlib"@"dbdf71cee7bb20367cb7e37279c08b0c218cf967"
-- Porting note: every ML3 decl has an uppercase letter
set_option linter.uppercaseLean3 false
open CategoryTheory
open CategoryTheory.Limits
-- Porting note: changed universe order as `v` is usually passed explicitly
universe v u w
noncomputable section
namespace TopCat
section TopologicalKonig
variable {J : Type u} [SmallCategory J]
-- Porting note: generalized `F` to land in `v` not `u`
variable (F : J ⥤ TopCat.{v})
private abbrev FiniteDiagramArrow {J : Type u} [SmallCategory J] (G : Finset J) :=
Σ' (X Y : J) (_ : X ∈ G) (_ : Y ∈ G), X ⟶ Y
private abbrev FiniteDiagram (J : Type u) [SmallCategory J] :=
Σ G : Finset J, Finset (FiniteDiagramArrow G)
-- Porting note: generalized `F` to land in `v` not `u`
def partialSections {J : Type u} [SmallCategory J] (F : J ⥤ TopCat.{v}) {G : Finset J}
(H : Finset (FiniteDiagramArrow G)) : Set (∀ j, F.obj j) :=
{u | ∀ {f : FiniteDiagramArrow G} (_ : f ∈ H), F.map f.2.2.2.2 (u f.1) = u f.2.1}
#align Top.partial_sections TopCat.partialSections
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)]
{G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
classical
cases isEmpty_or_nonempty J
· exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩
haveI : IsCofiltered J := ⟨⟩
use fun j : J =>
if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some
else (h _).some
rintro ⟨X, Y, hX, hY, f⟩ hf
dsimp only
rwa [dif_pos hX, dif_pos hY, ← comp_app, ← F.map_comp, @IsCofiltered.infTo_commutes _ _ _ G H]
#align Top.partial_sections.nonempty TopCat.partialSections.nonempty
| Mathlib/Topology/Category/TopCat/Limits/Konig.lean | 84 | 104 | theorem partialSections.directed :
Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by |
classical
intro A B
let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
refine ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, ?_, ?_⟩
· rintro u hu f hf
have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_left
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
· rintro u hu f hf
have : ιB f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_right
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
| 19 |
import Mathlib.Analysis.NormedSpace.OperatorNorm.Bilinear
import Mathlib.Analysis.NormedSpace.OperatorNorm.NNNorm
import Mathlib.Analysis.NormedSpace.Span
suppress_compilation
open Bornology
open Filter hiding map_smul
open scoped Classical NNReal Topology Uniformity
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*}
section Normed
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
[NormedAddCommGroup Fₗ]
open Metric ContinuousLinearMap
section
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ] (c : 𝕜)
{σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} (f g : E →SL[σ₁₂] F) (x y z : E)
namespace LinearMap
theorem bound_of_shell [RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F) {ε C : ℝ} (ε_pos : 0 < ε) {c : 𝕜}
(hc : 1 < ‖c‖) (hf : ∀ x, ε / ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) (x : E) :
‖f x‖ ≤ C * ‖x‖ := by
by_cases hx : x = 0; · simp [hx]
exact SemilinearMapClass.bound_of_shell_semi_normed f ε_pos hc hf (norm_ne_zero_iff.2 hx)
#align linear_map.bound_of_shell LinearMap.bound_of_shell
theorem bound_of_ball_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E →ₗ[𝕜] Fₗ)
(h : ∀ z ∈ Metric.ball (0 : E) r, ‖f z‖ ≤ c) : ∃ C, ∀ z : E, ‖f z‖ ≤ C * ‖z‖ := by
cases' @NontriviallyNormedField.non_trivial 𝕜 _ with k hk
use c * (‖k‖ / r)
intro z
refine bound_of_shell _ r_pos hk (fun x hko hxo => ?_) _
calc
‖f x‖ ≤ c := h _ (mem_ball_zero_iff.mpr hxo)
_ ≤ c * (‖x‖ * ‖k‖ / r) := le_mul_of_one_le_right ?_ ?_
_ = _ := by ring
· exact le_trans (norm_nonneg _) (h 0 (by simp [r_pos]))
· rw [div_le_iff (zero_lt_one.trans hk)] at hko
exact (one_le_div r_pos).mpr hko
#align linear_map.bound_of_ball_bound LinearMap.bound_of_ball_bound
| Mathlib/Analysis/NormedSpace/OperatorNorm/NormedSpace.lean | 67 | 87 | theorem antilipschitz_of_comap_nhds_le [h : RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F)
(hf : (𝓝 0).comap f ≤ 𝓝 0) : ∃ K, AntilipschitzWith K f := by |
rcases ((nhds_basis_ball.comap _).le_basis_iff nhds_basis_ball).1 hf 1 one_pos with ⟨ε, ε0, hε⟩
simp only [Set.subset_def, Set.mem_preimage, mem_ball_zero_iff] at hε
lift ε to ℝ≥0 using ε0.le
rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩
refine ⟨ε⁻¹ * ‖c‖₊, AddMonoidHomClass.antilipschitz_of_bound f fun x => ?_⟩
by_cases hx : f x = 0
· rw [← hx] at hf
obtain rfl : x = 0 := Specializes.eq (specializes_iff_pure.2 <|
((Filter.tendsto_pure_pure _ _).mono_right (pure_le_nhds _)).le_comap.trans hf)
exact norm_zero.trans_le (mul_nonneg (NNReal.coe_nonneg _) (norm_nonneg _))
have hc₀ : c ≠ 0 := norm_pos_iff.1 (one_pos.trans hc)
rw [← h.1] at hc
rcases rescale_to_shell_zpow hc ε0 hx with ⟨n, -, hlt, -, hle⟩
simp only [← map_zpow₀, h.1, ← map_smulₛₗ] at hlt hle
calc
‖x‖ = ‖c ^ n‖⁻¹ * ‖c ^ n • x‖ := by
rwa [← norm_inv, ← norm_smul, inv_smul_smul₀ (zpow_ne_zero _ _)]
_ ≤ ‖c ^ n‖⁻¹ * 1 := (mul_le_mul_of_nonneg_left (hε _ hlt).le (inv_nonneg.2 (norm_nonneg _)))
_ ≤ ε⁻¹ * ‖c‖ * ‖f x‖ := by rwa [mul_one]
| 19 |
import Mathlib.Algebra.CharP.LocalRing
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.Tactic.FieldSimp
#align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
variable (R : Type*) [CommRing R]
class MixedCharZero (p : ℕ) : Prop where
[toCharZero : CharZero R]
charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p
#align mixed_char_zero MixedCharZero
namespace MixedCharZero
| Mathlib/Algebra/CharP/MixedCharZero.lean | 85 | 105 | theorem reduce_to_p_prime {P : Prop} :
(∀ p > 0, MixedCharZero R p → P) ↔ ∀ p : ℕ, p.Prime → MixedCharZero R p → P := by |
constructor
· intro h q q_prime q_mixedChar
exact h q (Nat.Prime.pos q_prime) q_mixedChar
· intro h q q_pos q_mixedChar
rcases q_mixedChar.charP_quotient with ⟨I, hI_ne_top, _⟩
-- Krull's Thm: There exists a prime ideal `P` such that `I ≤ P`
rcases Ideal.exists_le_maximal I hI_ne_top with ⟨M, hM_max, h_IM⟩
let r := ringChar (R ⧸ M)
have r_pos : r ≠ 0 := by
have q_zero :=
congr_arg (Ideal.Quotient.factor I M h_IM) (CharP.cast_eq_zero (R ⧸ I) q)
simp only [map_natCast, map_zero] at q_zero
apply ne_zero_of_dvd_ne_zero (ne_of_gt q_pos)
exact (CharP.cast_eq_zero_iff (R ⧸ M) r q).mp q_zero
have r_prime : Nat.Prime r :=
or_iff_not_imp_right.1 (CharP.char_is_prime_or_zero (R ⧸ M) r) r_pos
apply h r r_prime
have : CharZero R := q_mixedChar.toCharZero
exact ⟨⟨M, hM_max.ne_top, ringChar.of_eq rfl⟩⟩
| 19 |
import Mathlib.Algebra.Polynomial.Degree.CardPowDegree
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue
import Mathlib.RingTheory.Ideal.LocalRing
#align_import number_theory.class_number.admissible_card_pow_degree from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
namespace Polynomial
open Polynomial
open AbsoluteValue Real
variable {Fq : Type*} [Fintype Fq]
| Mathlib/NumberTheory/ClassNumber/AdmissibleCardPowDegree.lean | 36 | 57 | theorem exists_eq_polynomial [Semiring Fq] {d : ℕ} {m : ℕ} (hm : Fintype.card Fq ^ d ≤ m)
(b : Fq[X]) (hb : natDegree b ≤ d) (A : Fin m.succ → Fq[X])
(hA : ∀ i, degree (A i) < degree b) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ A i₁ = A i₀ := by |
-- Since there are > q^d elements of A, and only q^d choices for the highest `d` coefficients,
-- there must be two elements of A with the same coefficients at
-- `0`, ... `degree b - 1` ≤ `d - 1`.
-- In other words, the following map is not injective:
set f : Fin m.succ → Fin d → Fq := fun i j => (A i).coeff j
have : Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ) := by
simpa using lt_of_le_of_lt hm (Nat.lt_succ_self m)
-- Therefore, the differences have all coefficients higher than `deg b - d` equal.
obtain ⟨i₀, i₁, i_ne, i_eq⟩ := Fintype.exists_ne_map_eq_of_card_lt f this
use i₀, i₁, i_ne
ext j
-- The coefficients higher than `deg b` are the same because they are equal to 0.
by_cases hbj : degree b ≤ j
· rw [coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj),
coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj)]
-- So we only need to look for the coefficients between `0` and `deg b`.
rw [not_le] at hbj
apply congr_fun i_eq.symm ⟨j, _⟩
exact lt_of_lt_of_le (coe_lt_degree.mp hbj) hb
| 19 |
import Mathlib.Probability.Process.HittingTime
import Mathlib.Probability.Martingale.Basic
#align_import probability.martingale.optional_stopping from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory
namespace MeasureTheory
variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {𝒢 : Filtration ℕ m0} {f : ℕ → Ω → ℝ}
{τ π : Ω → ℕ}
-- We may generalize the below lemma to functions taking value in a `NormedLatticeAddCommGroup`.
-- Similarly, generalize `(Super/Sub)martingale.setIntegral_le`.
| Mathlib/Probability/Martingale/OptionalStopping.lean | 42 | 63 | theorem Submartingale.expected_stoppedValue_mono [SigmaFiniteFiltration μ 𝒢]
(hf : Submartingale f 𝒢 μ) (hτ : IsStoppingTime 𝒢 τ) (hπ : IsStoppingTime 𝒢 π) (hle : τ ≤ π)
{N : ℕ} (hbdd : ∀ ω, π ω ≤ N) : μ[stoppedValue f τ] ≤ μ[stoppedValue f π] := by |
rw [← sub_nonneg, ← integral_sub', stoppedValue_sub_eq_sum' hle hbdd]
· simp only [Finset.sum_apply]
have : ∀ i, MeasurableSet[𝒢 i] {ω : Ω | τ ω ≤ i ∧ i < π ω} := by
intro i
refine (hτ i).inter ?_
convert (hπ i).compl using 1
ext x
simp; rfl
rw [integral_finset_sum]
· refine Finset.sum_nonneg fun i _ => ?_
rw [integral_indicator (𝒢.le _ _ (this _)), integral_sub', sub_nonneg]
· exact hf.setIntegral_le (Nat.le_succ i) (this _)
· exact (hf.integrable _).integrableOn
· exact (hf.integrable _).integrableOn
intro i _
exact Integrable.indicator (Integrable.sub (hf.integrable _) (hf.integrable _))
(𝒢.le _ _ (this _))
· exact hf.integrable_stoppedValue hπ hbdd
· exact hf.integrable_stoppedValue hτ fun ω => le_trans (hle ω) (hbdd ω)
| 19 |
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric
import Mathlib.Topology.Metrizable.Basic
import Mathlib.Topology.IndicatorConstPointwise
#align_import measure_theory.constructions.borel_space.metrizable from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
open Filter MeasureTheory TopologicalSpace
open scoped Classical
open Topology NNReal ENNReal MeasureTheory
variable {α β : Type*} [MeasurableSpace α]
section Limits
variable [TopologicalSpace β] [PseudoMetrizableSpace β] [MeasurableSpace β] [BorelSpace β]
open Metric
theorem measurable_of_tendsto_metrizable' {ι} {f : ι → α → β} {g : α → β} (u : Filter ι) [NeBot u]
[IsCountablyGenerated u] (hf : ∀ i, Measurable (f i)) (lim : Tendsto f u (𝓝 g)) :
Measurable g := by
letI : PseudoMetricSpace β := pseudoMetrizableSpacePseudoMetric β
apply measurable_of_isClosed'
intro s h1s h2s h3s
have : Measurable fun x => infNndist (g x) s := by
suffices Tendsto (fun i x => infNndist (f i x) s) u (𝓝 fun x => infNndist (g x) s) from
NNReal.measurable_of_tendsto' u (fun i => (hf i).infNndist) this
rw [tendsto_pi_nhds] at lim ⊢
intro x
exact ((continuous_infNndist_pt s).tendsto (g x)).comp (lim x)
have h4s : g ⁻¹' s = (fun x => infNndist (g x) s) ⁻¹' {0} := by
ext x
simp [h1s, ← h1s.mem_iff_infDist_zero h2s, ← NNReal.coe_eq_zero]
rw [h4s]
exact this (measurableSet_singleton 0)
#align measurable_of_tendsto_metrizable' measurable_of_tendsto_metrizable'
theorem measurable_of_tendsto_metrizable {f : ℕ → α → β} {g : α → β} (hf : ∀ i, Measurable (f i))
(lim : Tendsto f atTop (𝓝 g)) : Measurable g :=
measurable_of_tendsto_metrizable' atTop hf lim
#align measurable_of_tendsto_metrizable measurable_of_tendsto_metrizable
| Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean | 57 | 78 | theorem aemeasurable_of_tendsto_metrizable_ae {ι} {μ : Measure α} {f : ι → α → β} {g : α → β}
(u : Filter ι) [hu : NeBot u] [IsCountablyGenerated u] (hf : ∀ n, AEMeasurable (f n) μ)
(h_tendsto : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))) : AEMeasurable g μ := by |
rcases u.exists_seq_tendsto with ⟨v, hv⟩
have h'f : ∀ n, AEMeasurable (f (v n)) μ := fun n => hf (v n)
set p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
have hp : ∀ᵐ x ∂μ, p x fun n => f (v n) x := by
filter_upwards [h_tendsto] with x hx using hx.comp hv
set aeSeqLim := fun x => ite (x ∈ aeSeqSet h'f p) (g x) (⟨f (v 0) x⟩ : Nonempty β).some
refine
⟨aeSeqLim,
measurable_of_tendsto_metrizable' atTop (aeSeq.measurable h'f p)
(tendsto_pi_nhds.mpr fun x => ?_),
?_⟩
· simp_rw [aeSeqLim, aeSeq]
split_ifs with hx
· simp_rw [aeSeq.mk_eq_fun_of_mem_aeSeqSet h'f hx]
exact @aeSeq.fun_prop_of_mem_aeSeqSet _ α β _ _ _ _ _ h'f x hx
· exact tendsto_const_nhds
· exact
(ite_ae_eq_of_measure_compl_zero g (fun x => (⟨f (v 0) x⟩ : Nonempty β).some) (aeSeqSet h'f p)
(aeSeq.measure_compl_aeSeqSet_eq_zero h'f hp)).symm
| 19 |
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.Probability.Independence.Basic
#align_import probability.integration from "leanprover-community/mathlib"@"2f8347015b12b0864dfaf366ec4909eb70c78740"
noncomputable section
open Set MeasureTheory
open scoped ENNReal MeasureTheory
variable {Ω : Type*} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {f g : Ω → ℝ≥0∞} {X Y : Ω → ℝ}
namespace ProbabilityTheory
theorem lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator {Mf mΩ : MeasurableSpace Ω}
{μ : Measure Ω} (hMf : Mf ≤ mΩ) (c : ℝ≥0∞) {T : Set Ω} (h_meas_T : MeasurableSet T)
(h_ind : IndepSets {s | MeasurableSet[Mf] s} {T} μ) (h_meas_f : Measurable[Mf] f) :
(∫⁻ ω, f ω * T.indicator (fun _ => c) ω ∂μ) =
(∫⁻ ω, f ω ∂μ) * ∫⁻ ω, T.indicator (fun _ => c) ω ∂μ := by
revert f
have h_mul_indicator : ∀ g, Measurable g → Measurable fun a => g a * T.indicator (fun _ => c) a :=
fun g h_mg => h_mg.mul (measurable_const.indicator h_meas_T)
apply @Measurable.ennreal_induction _ Mf
· intro c' s' h_meas_s'
simp_rw [← inter_indicator_mul]
rw [lintegral_indicator _ (MeasurableSet.inter (hMf _ h_meas_s') h_meas_T),
lintegral_indicator _ (hMf _ h_meas_s'), lintegral_indicator _ h_meas_T]
simp only [measurable_const, lintegral_const, univ_inter, lintegral_const_mul,
MeasurableSet.univ, Measure.restrict_apply]
rw [IndepSets_iff] at h_ind
rw [mul_mul_mul_comm, h_ind s' T h_meas_s' (Set.mem_singleton _)]
· intro f' g _ h_meas_f' _ h_ind_f' h_ind_g
have h_measM_f' : Measurable f' := h_meas_f'.mono hMf le_rfl
simp_rw [Pi.add_apply, right_distrib]
rw [lintegral_add_left (h_mul_indicator _ h_measM_f'), lintegral_add_left h_measM_f',
right_distrib, h_ind_f', h_ind_g]
· intro f h_meas_f h_mono_f h_ind_f
have h_measM_f : ∀ n, Measurable (f n) := fun n => (h_meas_f n).mono hMf le_rfl
simp_rw [ENNReal.iSup_mul]
rw [lintegral_iSup h_measM_f h_mono_f, lintegral_iSup, ENNReal.iSup_mul]
· simp_rw [← h_ind_f]
· exact fun n => h_mul_indicator _ (h_measM_f n)
· exact fun m n h_le a => mul_le_mul_right' (h_mono_f h_le a) _
#align probability_theory.lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator ProbabilityTheory.lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator
| Mathlib/Probability/Integration.lean | 82 | 104 | theorem lintegral_mul_eq_lintegral_mul_lintegral_of_independent_measurableSpace
{Mf Mg mΩ : MeasurableSpace Ω} {μ : Measure Ω} (hMf : Mf ≤ mΩ) (hMg : Mg ≤ mΩ)
(h_ind : Indep Mf Mg μ) (h_meas_f : Measurable[Mf] f) (h_meas_g : Measurable[Mg] g) :
∫⁻ ω, f ω * g ω ∂μ = (∫⁻ ω, f ω ∂μ) * ∫⁻ ω, g ω ∂μ := by |
revert g
have h_measM_f : Measurable f := h_meas_f.mono hMf le_rfl
apply @Measurable.ennreal_induction _ Mg
· intro c s h_s
apply lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator hMf _ (hMg _ h_s) _ h_meas_f
apply indepSets_of_indepSets_of_le_right h_ind
rwa [singleton_subset_iff]
· intro f' g _ h_measMg_f' _ h_ind_f' h_ind_g'
have h_measM_f' : Measurable f' := h_measMg_f'.mono hMg le_rfl
simp_rw [Pi.add_apply, left_distrib]
rw [lintegral_add_left h_measM_f', lintegral_add_left (h_measM_f.mul h_measM_f'), left_distrib,
h_ind_f', h_ind_g']
· intro f' h_meas_f' h_mono_f' h_ind_f'
have h_measM_f' : ∀ n, Measurable (f' n) := fun n => (h_meas_f' n).mono hMg le_rfl
simp_rw [ENNReal.mul_iSup]
rw [lintegral_iSup, lintegral_iSup h_measM_f' h_mono_f', ENNReal.mul_iSup]
· simp_rw [← h_ind_f']
· exact fun n => h_measM_f.mul (h_measM_f' n)
· exact fun n m (h_le : n ≤ m) a => mul_le_mul_left' (h_mono_f' h_le a) _
| 19 |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.Normed.Group.Completion
#align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
noncomputable section
open Set NormedAddGroupHom UniformSpace
section Completion
variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H]
{K : Type*} [SeminormedAddCommGroup K]
def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) :
NormedAddGroupHom (Completion G) (Completion H) :=
.ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map
#align normed_add_group_hom.completion NormedAddGroupHom.completion
theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) :
f.completion x = Completion.map f x :=
rfl
#align normed_add_group_hom.completion_def NormedAddGroupHom.completion_def
@[simp]
theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) :
(f.completion : Completion G → Completion H) = Completion.map f := rfl
#align normed_add_group_hom.completion_coe_to_fun NormedAddGroupHom.completion_coe_to_fun
-- Porting note: `@[simp]` moved to the next lemma
theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) :
f.completion g = f g :=
Completion.map_coe f.uniformContinuous _
#align normed_add_group_hom.completion_coe NormedAddGroupHom.completion_coe
@[simp]
theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) :
Completion.map f g = f g :=
f.completion_coe g
@[simps]
def normedAddGroupHomCompletionHom :
NormedAddGroupHom G H →+ NormedAddGroupHom (Completion G) (Completion H) where
toFun := NormedAddGroupHom.completion
map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero
map_add' f g := toAddMonoidHom_injective <|
f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous
#align normed_add_group_hom_completion_hom normedAddGroupHomCompletionHom
#align normed_add_group_hom_completion_hom_apply normedAddGroupHomCompletionHom_apply
@[simp]
theorem NormedAddGroupHom.completion_id :
(NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by
ext x
rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id]
rfl
#align normed_add_group_hom.completion_id NormedAddGroupHom.completion_id
theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) :
g.completion.comp f.completion = (g.comp f).completion := by
ext x
rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def,
NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun,
Completion.map_comp g.uniformContinuous f.uniformContinuous]
rfl
#align normed_add_group_hom.completion_comp NormedAddGroupHom.completion_comp
theorem NormedAddGroupHom.completion_neg (f : NormedAddGroupHom G H) :
(-f).completion = -f.completion :=
map_neg (normedAddGroupHomCompletionHom : NormedAddGroupHom G H →+ _) f
#align normed_add_group_hom.completion_neg NormedAddGroupHom.completion_neg
theorem NormedAddGroupHom.completion_add (f g : NormedAddGroupHom G H) :
(f + g).completion = f.completion + g.completion :=
normedAddGroupHomCompletionHom.map_add f g
#align normed_add_group_hom.completion_add NormedAddGroupHom.completion_add
theorem NormedAddGroupHom.completion_sub (f g : NormedAddGroupHom G H) :
(f - g).completion = f.completion - g.completion :=
map_sub (normedAddGroupHomCompletionHom : NormedAddGroupHom G H →+ _) f g
#align normed_add_group_hom.completion_sub NormedAddGroupHom.completion_sub
@[simp]
theorem NormedAddGroupHom.zero_completion : (0 : NormedAddGroupHom G H).completion = 0 :=
normedAddGroupHomCompletionHom.map_zero
#align normed_add_group_hom.zero_completion NormedAddGroupHom.zero_completion
@[simps] -- Porting note: added `@[simps]`
def NormedAddCommGroup.toCompl : NormedAddGroupHom G (Completion G) where
toFun := (↑)
map_add' := Completion.toCompl.map_add
bound' := ⟨1, by simp [le_refl]⟩
#align normed_add_comm_group.to_compl NormedAddCommGroup.toCompl
open NormedAddCommGroup
theorem NormedAddCommGroup.norm_toCompl (x : G) : ‖toCompl x‖ = ‖x‖ :=
Completion.norm_coe x
#align normed_add_comm_group.norm_to_compl NormedAddCommGroup.norm_toCompl
theorem NormedAddCommGroup.denseRange_toCompl : DenseRange (toCompl : G → Completion G) :=
Completion.denseInducing_coe.dense
#align normed_add_comm_group.dense_range_to_compl NormedAddCommGroup.denseRange_toCompl
@[simp]
theorem NormedAddGroupHom.completion_toCompl (f : NormedAddGroupHom G H) :
f.completion.comp toCompl = toCompl.comp f := by ext x; simp
#align normed_add_group_hom.completion_to_compl NormedAddGroupHom.completion_toCompl
@[simp]
theorem NormedAddGroupHom.norm_completion (f : NormedAddGroupHom G H) : ‖f.completion‖ = ‖f‖ :=
le_antisymm (ofLipschitz_norm_le _ _) <| opNorm_le_bound _ (norm_nonneg _) fun x => by
simpa using f.completion.le_opNorm x
#align normed_add_group_hom.norm_completion NormedAddGroupHom.norm_completion
theorem NormedAddGroupHom.ker_le_ker_completion (f : NormedAddGroupHom G H) :
(toCompl.comp <| incl f.ker).range ≤ f.completion.ker := by
rintro _ ⟨⟨g, h₀ : f g = 0⟩, rfl⟩
simp [h₀, mem_ker, Completion.coe_zero]
#align normed_add_group_hom.ker_le_ker_completion NormedAddGroupHom.ker_le_ker_completion
| Mathlib/Analysis/Normed/Group/HomCompletion.lean | 171 | 193 | theorem NormedAddGroupHom.ker_completion {f : NormedAddGroupHom G H} {C : ℝ}
(h : f.SurjectiveOnWith f.range C) :
(f.completion.ker : Set <| Completion G) = closure (toCompl.comp <| incl f.ker).range := by |
refine le_antisymm ?_ (closure_minimal f.ker_le_ker_completion f.completion.isClosed_ker)
rintro hatg (hatg_in : f.completion hatg = 0)
rw [SeminormedAddCommGroup.mem_closure_iff]
intro ε ε_pos
rcases h.exists_pos with ⟨C', C'_pos, hC'⟩
rcases exists_pos_mul_lt ε_pos (1 + C' * ‖f‖) with ⟨δ, δ_pos, hδ⟩
obtain ⟨_, ⟨g : G, rfl⟩, hg : ‖hatg - g‖ < δ⟩ :=
SeminormedAddCommGroup.mem_closure_iff.mp (Completion.denseInducing_coe.dense hatg) δ δ_pos
obtain ⟨g' : G, hgg' : f g' = f g, hfg : ‖g'‖ ≤ C' * ‖f g‖⟩ := hC' (f g) (mem_range_self _ g)
have mem_ker : g - g' ∈ f.ker := by rw [f.mem_ker, map_sub, sub_eq_zero.mpr hgg'.symm]
refine ⟨_, ⟨⟨g - g', mem_ker⟩, rfl⟩, ?_⟩
have : ‖f g‖ ≤ ‖f‖ * δ := calc
‖f g‖ ≤ ‖f‖ * ‖hatg - g‖ := by simpa [hatg_in] using f.completion.le_opNorm (hatg - g)
_ ≤ ‖f‖ * δ := by gcongr
calc ‖hatg - ↑(g - g')‖ = ‖hatg - g + g'‖ := by rw [Completion.coe_sub, sub_add]
_ ≤ ‖hatg - g‖ + ‖(g' : Completion G)‖ := norm_add_le _ _
_ = ‖hatg - g‖ + ‖g'‖ := by rw [Completion.norm_coe]
_ < δ + C' * ‖f g‖ := add_lt_add_of_lt_of_le hg hfg
_ ≤ δ + C' * (‖f‖ * δ) := by gcongr
_ < ε := by simpa only [add_mul, one_mul, mul_assoc] using hδ
| 20 |
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.RingTheory.Ideal.QuotientOperations
#align_import ring_theory.quotient_nilpotent from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff"
theorem Ideal.isRadical_iff_quotient_reduced {R : Type*} [CommRing R] (I : Ideal R) :
I.IsRadical ↔ IsReduced (R ⧸ I) := by
conv_lhs => rw [← @Ideal.mk_ker R _ I]
exact RingHom.ker_isRadical_iff_reduced_of_surjective (@Ideal.Quotient.mk_surjective R _ I)
#align ideal.is_radical_iff_quotient_reduced Ideal.isRadical_iff_quotient_reduced
variable {R S : Type*} [CommSemiring R] [CommRing S] [Algebra R S] (I : Ideal S)
| Mathlib/RingTheory/QuotientNilpotent.lean | 26 | 51 | theorem Ideal.IsNilpotent.induction_on (hI : IsNilpotent I)
{P : ∀ ⦃S : Type _⦄ [CommRing S], Ideal S → Prop}
(h₁ : ∀ ⦃S : Type _⦄ [CommRing S], ∀ I : Ideal S, I ^ 2 = ⊥ → P I)
(h₂ : ∀ ⦃S : Type _⦄ [CommRing S], ∀ I J : Ideal S, I ≤ J → P I →
P (J.map (Ideal.Quotient.mk I)) → P J) :
P I := by |
obtain ⟨n, hI : I ^ n = ⊥⟩ := hI
induction' n using Nat.strong_induction_on with n H generalizing S
by_cases hI' : I = ⊥
· subst hI'
apply h₁
rw [← Ideal.zero_eq_bot, zero_pow two_ne_zero]
cases' n with n
· rw [pow_zero, Ideal.one_eq_top] at hI
haveI := subsingleton_of_bot_eq_top hI.symm
exact (hI' (Subsingleton.elim _ _)).elim
cases' n with n
· rw [pow_one] at hI
exact (hI' hI).elim
apply h₂ (I ^ 2) _ (Ideal.pow_le_self two_ne_zero)
· apply H n.succ _ (I ^ 2)
· rw [← pow_mul, eq_bot_iff, ← hI, Nat.succ_eq_add_one]
apply Ideal.pow_le_pow_right (by omega)
· exact n.succ.lt_succ_self
· apply h₁
rw [← Ideal.map_pow, Ideal.map_quotient_self]
| 20 |
import Mathlib.LinearAlgebra.Matrix.Adjugate
import Mathlib.RingTheory.PolynomialAlgebra
#align_import linear_algebra.matrix.charpoly.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
universe u v w
namespace Matrix
open Finset Matrix Polynomial
variable {R S : Type*} [CommRing R] [CommRing S]
variable {m n : Type*} [DecidableEq m] [DecidableEq n] [Fintype m] [Fintype n]
variable (M₁₁ : Matrix m m R) (M₁₂ : Matrix m n R) (M₂₁ : Matrix n m R) (M₂₂ M : Matrix n n R)
variable (i j : n)
def charmatrix (M : Matrix n n R) : Matrix n n R[X] :=
Matrix.scalar n (X : R[X]) - (C : R →+* R[X]).mapMatrix M
#align charmatrix Matrix.charmatrix
theorem charmatrix_apply :
charmatrix M i j = (Matrix.diagonal fun _ : n => X) i j - C (M i j) :=
rfl
#align charmatrix_apply Matrix.charmatrix_apply
@[simp]
theorem charmatrix_apply_eq : charmatrix M i i = (X : R[X]) - C (M i i) := by
simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, map_apply,
diagonal_apply_eq]
#align charmatrix_apply_eq Matrix.charmatrix_apply_eq
@[simp]
theorem charmatrix_apply_ne (h : i ≠ j) : charmatrix M i j = -C (M i j) := by
simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, diagonal_apply_ne _ h,
map_apply, sub_eq_neg_self]
#align charmatrix_apply_ne Matrix.charmatrix_apply_ne
theorem matPolyEquiv_charmatrix : matPolyEquiv (charmatrix M) = X - C M := by
ext k i j
simp only [matPolyEquiv_coeff_apply, coeff_sub, Pi.sub_apply]
by_cases h : i = j
· subst h
rw [charmatrix_apply_eq, coeff_sub]
simp only [coeff_X, coeff_C]
split_ifs <;> simp
· rw [charmatrix_apply_ne _ _ _ h, coeff_X, coeff_neg, coeff_C, coeff_C]
split_ifs <;> simp [h]
#align mat_poly_equiv_charmatrix Matrix.matPolyEquiv_charmatrix
theorem charmatrix_reindex (e : n ≃ m) :
charmatrix (reindex e e M) = reindex e e (charmatrix M) := by
ext i j x
by_cases h : i = j
all_goals simp [h]
#align charmatrix_reindex Matrix.charmatrix_reindex
lemma charmatrix_map (M : Matrix n n R) (f : R →+* S) :
charmatrix (M.map f) = (charmatrix M).map (Polynomial.map f) := by
ext i j
by_cases h : i = j <;> simp [h, charmatrix, diagonal]
lemma charmatrix_fromBlocks :
charmatrix (fromBlocks M₁₁ M₁₂ M₂₁ M₂₂) =
fromBlocks (charmatrix M₁₁) (- M₁₂.map C) (- M₂₁.map C) (charmatrix M₂₂) := by
simp only [charmatrix]
ext (i|i) (j|j) : 2 <;> simp [diagonal]
def charpoly (M : Matrix n n R) : R[X] :=
(charmatrix M).det
#align matrix.charpoly Matrix.charpoly
theorem charpoly_reindex (e : n ≃ m)
(M : Matrix n n R) : (reindex e e M).charpoly = M.charpoly := by
unfold Matrix.charpoly
rw [charmatrix_reindex, Matrix.det_reindex_self]
#align matrix.charpoly_reindex Matrix.charpoly_reindex
lemma charpoly_map (M : Matrix n n R) (f : R →+* S) :
(M.map f).charpoly = M.charpoly.map f := by
rw [charpoly, charmatrix_map, ← Polynomial.coe_mapRingHom, charpoly, RingHom.map_det,
RingHom.mapMatrix_apply]
@[simp]
lemma charpoly_fromBlocks_zero₁₂ :
(fromBlocks M₁₁ 0 M₂₁ M₂₂).charpoly = (M₁₁.charpoly * M₂₂.charpoly) := by
simp only [charpoly, charmatrix_fromBlocks, Matrix.map_zero _ (Polynomial.C_0), neg_zero,
det_fromBlocks_zero₁₂]
@[simp]
lemma charpoly_fromBlocks_zero₂₁ :
(fromBlocks M₁₁ M₁₂ 0 M₂₂).charpoly = (M₁₁.charpoly * M₂₂.charpoly) := by
simp only [charpoly, charmatrix_fromBlocks, Matrix.map_zero _ (Polynomial.C_0), neg_zero,
det_fromBlocks_zero₂₁]
-- This proof follows http://drorbn.net/AcademicPensieve/2015-12/CayleyHamilton.pdf
| Mathlib/LinearAlgebra/Matrix/Charpoly/Basic.lean | 134 | 154 | theorem aeval_self_charpoly (M : Matrix n n R) : aeval M M.charpoly = 0 := by |
-- We begin with the fact $χ_M(t) I = adjugate (t I - M) * (t I - M)$,
-- as an identity in `Matrix n n R[X]`.
have h : M.charpoly • (1 : Matrix n n R[X]) = adjugate (charmatrix M) * charmatrix M :=
(adjugate_mul _).symm
-- Using the algebra isomorphism `Matrix n n R[X] ≃ₐ[R] Polynomial (Matrix n n R)`,
-- we have the same identity in `Polynomial (Matrix n n R)`.
apply_fun matPolyEquiv at h
simp only [matPolyEquiv.map_mul, matPolyEquiv_charmatrix] at h
-- Because the coefficient ring `Matrix n n R` is non-commutative,
-- evaluation at `M` is not multiplicative.
-- However, any polynomial which is a product of the form $N * (t I - M)$
-- is sent to zero, because the evaluation function puts the polynomial variable
-- to the right of any coefficients, so everything telescopes.
apply_fun fun p => p.eval M at h
rw [eval_mul_X_sub_C] at h
-- Now $χ_M (t) I$, when thought of as a polynomial of matrices
-- and evaluated at some `N` is exactly $χ_M (N)$.
rw [matPolyEquiv_smul_one, eval_map] at h
-- Thus we have $χ_M(M) = 0$, which is the desired result.
exact h
| 20 |
import Mathlib.Algebra.MvPolynomial.Funext
import Mathlib.Algebra.Ring.ULift
import Mathlib.RingTheory.WittVector.Basic
#align_import ring_theory.witt_vector.is_poly from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
namespace WittVector
universe u
variable {p : ℕ} {R S : Type u} {σ idx : Type*} [CommRing R] [CommRing S]
local notation "𝕎" => WittVector p -- type as `\bbW`
open MvPolynomial
open Function (uncurry)
variable (p)
noncomputable section
theorem poly_eq_of_wittPolynomial_bind_eq' [Fact p.Prime] (f g : ℕ → MvPolynomial (idx × ℕ) ℤ)
(h : ∀ n, bind₁ f (wittPolynomial p _ n) = bind₁ g (wittPolynomial p _ n)) : f = g := by
ext1 n
apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective
rw [← Function.funext_iff] at h
replace h :=
congr_arg (fun fam => bind₁ (MvPolynomial.map (Int.castRingHom ℚ) ∘ fam) (xInTermsOfW p ℚ n)) h
simpa only [Function.comp, map_bind₁, map_wittPolynomial, ← bind₁_bind₁,
bind₁_wittPolynomial_xInTermsOfW, bind₁_X_right] using h
#align witt_vector.poly_eq_of_witt_polynomial_bind_eq' WittVector.poly_eq_of_wittPolynomial_bind_eq'
theorem poly_eq_of_wittPolynomial_bind_eq [Fact p.Prime] (f g : ℕ → MvPolynomial ℕ ℤ)
(h : ∀ n, bind₁ f (wittPolynomial p _ n) = bind₁ g (wittPolynomial p _ n)) : f = g := by
ext1 n
apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective
rw [← Function.funext_iff] at h
replace h :=
congr_arg (fun fam => bind₁ (MvPolynomial.map (Int.castRingHom ℚ) ∘ fam) (xInTermsOfW p ℚ n)) h
simpa only [Function.comp, map_bind₁, map_wittPolynomial, ← bind₁_bind₁,
bind₁_wittPolynomial_xInTermsOfW, bind₁_X_right] using h
#align witt_vector.poly_eq_of_witt_polynomial_bind_eq WittVector.poly_eq_of_wittPolynomial_bind_eq
-- Ideally, we would generalise this to n-ary functions
-- But we don't have a good theory of n-ary compositions in mathlib
class IsPoly (f : ∀ ⦃R⦄ [CommRing R], WittVector p R → 𝕎 R) : Prop where mk' ::
poly :
∃ φ : ℕ → MvPolynomial ℕ ℤ,
∀ ⦃R⦄ [CommRing R] (x : 𝕎 R), (f x).coeff = fun n => aeval x.coeff (φ n)
#align witt_vector.is_poly WittVector.IsPoly
instance idIsPoly : IsPoly p fun _ _ => id :=
⟨⟨X, by intros; simp only [aeval_X, id]⟩⟩
#align witt_vector.id_is_poly WittVector.idIsPoly
instance idIsPolyI' : IsPoly p fun _ _ a => a :=
WittVector.idIsPoly _
#align witt_vector.id_is_poly_i' WittVector.idIsPolyI'
namespace IsPoly
instance : Inhabited (IsPoly p fun _ _ => id) :=
⟨WittVector.idIsPoly p⟩
variable {p}
| Mathlib/RingTheory/WittVector/IsPoly.lean | 172 | 195 | theorem ext [Fact p.Prime] {f g} (hf : IsPoly p f) (hg : IsPoly p g)
(h : ∀ (R : Type u) [_Rcr : CommRing R] (x : 𝕎 R) (n : ℕ),
ghostComponent n (f x) = ghostComponent n (g x)) :
∀ (R : Type u) [_Rcr : CommRing R] (x : 𝕎 R), f x = g x := by |
obtain ⟨φ, hf⟩ := hf
obtain ⟨ψ, hg⟩ := hg
intros
ext n
rw [hf, hg, poly_eq_of_wittPolynomial_bind_eq p φ ψ]
intro k
apply MvPolynomial.funext
intro x
simp only [hom_bind₁]
specialize h (ULift ℤ) (mk p fun i => ⟨x i⟩) k
simp only [ghostComponent_apply, aeval_eq_eval₂Hom] at h
apply (ULift.ringEquiv.symm : ℤ ≃+* _).injective
simp only [← RingEquiv.coe_toRingHom, map_eval₂Hom]
convert h using 1
all_goals
simp only [hf, hg, MvPolynomial.eval, map_eval₂Hom]
apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl
ext1
apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl
simp only [coeff_mk]; rfl
| 20 |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Rat
import Mathlib.Data.Multiset.Sort
import Mathlib.Data.PNat.Basic
import Mathlib.Data.PNat.Interval
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.IntervalCases
#align_import number_theory.ADE_inequality from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
namespace ADEInequality
open Multiset
-- Porting note: ADE is a special name, exceptionally in upper case in Lean3
set_option linter.uppercaseLean3 false
def A' (q r : ℕ+) : Multiset ℕ+ :=
{1, q, r}
#align ADE_inequality.A' ADEInequality.A'
def A (r : ℕ+) : Multiset ℕ+ :=
A' 1 r
#align ADE_inequality.A ADEInequality.A
def D' (r : ℕ+) : Multiset ℕ+ :=
{2, 2, r}
#align ADE_inequality.D' ADEInequality.D'
def E' (r : ℕ+) : Multiset ℕ+ :=
{2, 3, r}
#align ADE_inequality.E' ADEInequality.E'
def E6 : Multiset ℕ+ :=
E' 3
#align ADE_inequality.E6 ADEInequality.E6
def E7 : Multiset ℕ+ :=
E' 4
#align ADE_inequality.E7 ADEInequality.E7
def E8 : Multiset ℕ+ :=
E' 5
#align ADE_inequality.E8 ADEInequality.E8
def sumInv (pqr : Multiset ℕ+) : ℚ :=
Multiset.sum (pqr.map fun (x : ℕ+) => x⁻¹)
#align ADE_inequality.sum_inv ADEInequality.sumInv
theorem sumInv_pqr (p q r : ℕ+) : sumInv {p, q, r} = (p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ := by
simp only [sumInv, add_zero, insert_eq_cons, add_assoc, map_cons, sum_cons,
map_singleton, sum_singleton]
#align ADE_inequality.sum_inv_pqr ADEInequality.sumInv_pqr
def Admissible (pqr : Multiset ℕ+) : Prop :=
(∃ q r, A' q r = pqr) ∨ (∃ r, D' r = pqr) ∨ E' 3 = pqr ∨ E' 4 = pqr ∨ E' 5 = pqr
#align ADE_inequality.admissible ADEInequality.Admissible
theorem admissible_A' (q r : ℕ+) : Admissible (A' q r) :=
Or.inl ⟨q, r, rfl⟩
#align ADE_inequality.admissible_A' ADEInequality.admissible_A'
theorem admissible_D' (n : ℕ+) : Admissible (D' n) :=
Or.inr <| Or.inl ⟨n, rfl⟩
#align ADE_inequality.admissible_D' ADEInequality.admissible_D'
theorem admissible_E'3 : Admissible (E' 3) :=
Or.inr <| Or.inr <| Or.inl rfl
#align ADE_inequality.admissible_E'3 ADEInequality.admissible_E'3
theorem admissible_E'4 : Admissible (E' 4) :=
Or.inr <| Or.inr <| Or.inr <| Or.inl rfl
#align ADE_inequality.admissible_E'4 ADEInequality.admissible_E'4
theorem admissible_E'5 : Admissible (E' 5) :=
Or.inr <| Or.inr <| Or.inr <| Or.inr rfl
#align ADE_inequality.admissible_E'5 ADEInequality.admissible_E'5
theorem admissible_E6 : Admissible E6 :=
admissible_E'3
#align ADE_inequality.admissible_E6 ADEInequality.admissible_E6
theorem admissible_E7 : Admissible E7 :=
admissible_E'4
#align ADE_inequality.admissible_E7 ADEInequality.admissible_E7
theorem admissible_E8 : Admissible E8 :=
admissible_E'5
#align ADE_inequality.admissible_E8 ADEInequality.admissible_E8
theorem Admissible.one_lt_sumInv {pqr : Multiset ℕ+} : Admissible pqr → 1 < sumInv pqr := by
rw [Admissible]
rintro (⟨p', q', H⟩ | ⟨n, H⟩ | H | H | H)
· rw [← H, A', sumInv_pqr, add_assoc]
simp only [lt_add_iff_pos_right, PNat.one_coe, inv_one, Nat.cast_one]
apply add_pos <;> simp only [PNat.pos, Nat.cast_pos, inv_pos]
· rw [← H, D', sumInv_pqr]
conv_rhs => simp only [OfNat.ofNat, PNat.mk_coe]
norm_num
all_goals
rw [← H, E', sumInv_pqr]
conv_rhs => simp only [OfNat.ofNat, PNat.mk_coe]
rfl
#align ADE_inequality.admissible.one_lt_sum_inv ADEInequality.Admissible.one_lt_sumInv
| Mathlib/NumberTheory/ADEInequality.lean | 175 | 195 | theorem lt_three {p q r : ℕ+} (hpq : p ≤ q) (hqr : q ≤ r) (H : 1 < sumInv {p, q, r}) : p < 3 := by |
have h3 : (0 : ℚ) < 3 := by norm_num
contrapose! H
rw [sumInv_pqr]
have h3q := H.trans hpq
have h3r := h3q.trans hqr
have hp: (p : ℚ)⁻¹ ≤ 3⁻¹ := by
rw [inv_le_inv _ h3]
· assumption_mod_cast
· norm_num
have hq: (q : ℚ)⁻¹ ≤ 3⁻¹ := by
rw [inv_le_inv _ h3]
· assumption_mod_cast
· norm_num
have hr: (r : ℚ)⁻¹ ≤ 3⁻¹ := by
rw [inv_le_inv _ h3]
· assumption_mod_cast
· norm_num
calc
(p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ ≤ 3⁻¹ + 3⁻¹ + 3⁻¹ := add_le_add (add_le_add hp hq) hr
_ = 1 := by norm_num
| 20 |
import Mathlib.Data.ENNReal.Basic
import Mathlib.Topology.ContinuousFunction.Bounded
import Mathlib.Topology.MetricSpace.Thickening
#align_import topology.metric_space.thickened_indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical
open NNReal ENNReal Topology BoundedContinuousFunction
open NNReal ENNReal Set Metric EMetric Filter
noncomputable section thickenedIndicator
variable {α : Type*} [PseudoEMetricSpace α]
def thickenedIndicatorAux (δ : ℝ) (E : Set α) : α → ℝ≥0∞ :=
fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ
#align thickened_indicator_aux thickenedIndicatorAux
theorem continuous_thickenedIndicatorAux {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) :
Continuous (thickenedIndicatorAux δ E) := by
unfold thickenedIndicatorAux
let f := fun x : α => (⟨1, infEdist x E / ENNReal.ofReal δ⟩ : ℝ≥0 × ℝ≥0∞)
let sub := fun p : ℝ≥0 × ℝ≥0∞ => (p.1 : ℝ≥0∞) - p.2
rw [show (fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ) = sub ∘ f by rfl]
apply (@ENNReal.continuous_nnreal_sub 1).comp
apply (ENNReal.continuous_div_const (ENNReal.ofReal δ) _).comp continuous_infEdist
set_option tactic.skipAssignedInstances false in norm_num [δ_pos]
#align continuous_thickened_indicator_aux continuous_thickenedIndicatorAux
theorem thickenedIndicatorAux_le_one (δ : ℝ) (E : Set α) (x : α) :
thickenedIndicatorAux δ E x ≤ 1 := by
apply @tsub_le_self _ _ _ _ (1 : ℝ≥0∞)
#align thickened_indicator_aux_le_one thickenedIndicatorAux_le_one
theorem thickenedIndicatorAux_lt_top {δ : ℝ} {E : Set α} {x : α} :
thickenedIndicatorAux δ E x < ∞ :=
lt_of_le_of_lt (thickenedIndicatorAux_le_one _ _ _) one_lt_top
#align thickened_indicator_aux_lt_top thickenedIndicatorAux_lt_top
theorem thickenedIndicatorAux_closure_eq (δ : ℝ) (E : Set α) :
thickenedIndicatorAux δ (closure E) = thickenedIndicatorAux δ E := by
simp (config := { unfoldPartialApp := true }) only [thickenedIndicatorAux, infEdist_closure]
#align thickened_indicator_aux_closure_eq thickenedIndicatorAux_closure_eq
theorem thickenedIndicatorAux_one (δ : ℝ) (E : Set α) {x : α} (x_in_E : x ∈ E) :
thickenedIndicatorAux δ E x = 1 := by
simp [thickenedIndicatorAux, infEdist_zero_of_mem x_in_E, tsub_zero]
#align thickened_indicator_aux_one thickenedIndicatorAux_one
theorem thickenedIndicatorAux_one_of_mem_closure (δ : ℝ) (E : Set α) {x : α}
(x_mem : x ∈ closure E) : thickenedIndicatorAux δ E x = 1 := by
rw [← thickenedIndicatorAux_closure_eq, thickenedIndicatorAux_one δ (closure E) x_mem]
#align thickened_indicator_aux_one_of_mem_closure thickenedIndicatorAux_one_of_mem_closure
theorem thickenedIndicatorAux_zero {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) {x : α}
(x_out : x ∉ thickening δ E) : thickenedIndicatorAux δ E x = 0 := by
rw [thickening, mem_setOf_eq, not_lt] at x_out
unfold thickenedIndicatorAux
apply le_antisymm _ bot_le
have key := tsub_le_tsub
(@rfl _ (1 : ℝ≥0∞)).le (ENNReal.div_le_div x_out (@rfl _ (ENNReal.ofReal δ : ℝ≥0∞)).le)
rw [ENNReal.div_self (ne_of_gt (ENNReal.ofReal_pos.mpr δ_pos)) ofReal_ne_top] at key
simpa using key
#align thickened_indicator_aux_zero thickenedIndicatorAux_zero
theorem thickenedIndicatorAux_mono {δ₁ δ₂ : ℝ} (hle : δ₁ ≤ δ₂) (E : Set α) :
thickenedIndicatorAux δ₁ E ≤ thickenedIndicatorAux δ₂ E :=
fun _ => tsub_le_tsub (@rfl ℝ≥0∞ 1).le (ENNReal.div_le_div rfl.le (ofReal_le_ofReal hle))
#align thickened_indicator_aux_mono thickenedIndicatorAux_mono
theorem indicator_le_thickenedIndicatorAux (δ : ℝ) (E : Set α) :
(E.indicator fun _ => (1 : ℝ≥0∞)) ≤ thickenedIndicatorAux δ E := by
intro a
by_cases h : a ∈ E
· simp only [h, indicator_of_mem, thickenedIndicatorAux_one δ E h, le_refl]
· simp only [h, indicator_of_not_mem, not_false_iff, zero_le]
#align indicator_le_thickened_indicator_aux indicator_le_thickenedIndicatorAux
theorem thickenedIndicatorAux_subset (δ : ℝ) {E₁ E₂ : Set α} (subset : E₁ ⊆ E₂) :
thickenedIndicatorAux δ E₁ ≤ thickenedIndicatorAux δ E₂ :=
fun _ => tsub_le_tsub (@rfl ℝ≥0∞ 1).le (ENNReal.div_le_div (infEdist_anti subset) rfl.le)
#align thickened_indicator_aux_subset thickenedIndicatorAux_subset
| Mathlib/Topology/MetricSpace/ThickenedIndicator.lean | 130 | 153 | theorem thickenedIndicatorAux_tendsto_indicator_closure {δseq : ℕ → ℝ}
(δseq_lim : Tendsto δseq atTop (𝓝 0)) (E : Set α) :
Tendsto (fun n => thickenedIndicatorAux (δseq n) E) atTop
(𝓝 (indicator (closure E) fun _ => (1 : ℝ≥0∞))) := by |
rw [tendsto_pi_nhds]
intro x
by_cases x_mem_closure : x ∈ closure E
· simp_rw [thickenedIndicatorAux_one_of_mem_closure _ E x_mem_closure]
rw [show (indicator (closure E) fun _ => (1 : ℝ≥0∞)) x = 1 by
simp only [x_mem_closure, indicator_of_mem]]
exact tendsto_const_nhds
· rw [show (closure E).indicator (fun _ => (1 : ℝ≥0∞)) x = 0 by
simp only [x_mem_closure, indicator_of_not_mem, not_false_iff]]
rcases exists_real_pos_lt_infEdist_of_not_mem_closure x_mem_closure with ⟨ε, ⟨ε_pos, ε_lt⟩⟩
rw [Metric.tendsto_nhds] at δseq_lim
specialize δseq_lim ε ε_pos
simp only [dist_zero_right, Real.norm_eq_abs, eventually_atTop, ge_iff_le] at δseq_lim
rcases δseq_lim with ⟨N, hN⟩
apply @tendsto_atTop_of_eventually_const _ _ _ _ _ _ _ N
intro n n_large
have key : x ∉ thickening ε E := by simpa only [thickening, mem_setOf_eq, not_lt] using ε_lt.le
refine le_antisymm ?_ bot_le
apply (thickenedIndicatorAux_mono (lt_of_abs_lt (hN n n_large)).le E x).trans
exact (thickenedIndicatorAux_zero ε_pos E key).le
| 20 |
import Mathlib.Topology.Semicontinuous
import Mathlib.MeasureTheory.Function.AEMeasurableSequence
import Mathlib.MeasureTheory.Order.Lattice
import Mathlib.Topology.Order.Lattice
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
#align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce"
open Set Filter MeasureTheory MeasurableSpace TopologicalSpace
open scoped Classical Topology NNReal ENNReal MeasureTheory
universe u v w x y
variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α}
section OrderTopology
variable (α)
variable [TopologicalSpace α] [SecondCountableTopology α] [LinearOrder α] [OrderTopology α]
| Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean | 54 | 74 | theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by |
refine le_antisymm ?_ (generateFrom_le ?_)
· rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
refine generateFrom_le ?_
rintro _ ⟨a, rfl | rfl⟩
· rcases em (∃ b, a ⋖ b) with ⟨b, hb⟩ | hcovBy
· rw [hb.Ioi_eq, ← compl_Iio]
exact (H _).compl
· rcases isOpen_biUnion_countable (Ioi a) Ioi fun _ _ ↦ isOpen_Ioi with ⟨t, hat, htc, htU⟩
have : Ioi a = ⋃ b ∈ t, Ici b := by
refine Subset.antisymm ?_ <| iUnion₂_subset fun b hb ↦ Ici_subset_Ioi.2 (hat hb)
refine Subset.trans ?_ <| iUnion₂_mono fun _ _ ↦ Ioi_subset_Ici_self
simpa [CovBy, htU, subset_def] using hcovBy
simp only [this, ← compl_Iio]
exact .biUnion htc <| fun _ _ ↦ (H _).compl
· apply H
· rw [forall_mem_range]
intro a
exact GenerateMeasurable.basic _ isOpen_Iio
| 20 |
import Mathlib.Algebra.Algebra.Hom
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72"
universe uR uS uT uA u₄
variable {R : Type uR} [Semiring R]
variable {S : Type uS} [CommSemiring S]
variable {T : Type uT}
variable {A : Type uA} [Semiring A] [Algebra S A]
namespace RingQuot
inductive Rel (r : R → R → Prop) : R → R → Prop
| of ⦃x y : R⦄ (h : r x y) : Rel r x y
| add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c)
| mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c)
| mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c)
#align ring_quot.rel RingQuot.Rel
theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by
rw [add_comm a b, add_comm a c]
exact Rel.add_left h
#align ring_quot.rel.add_right RingQuot.Rel.add_right
theorem Rel.neg {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b : R⦄ (h : Rel r a b) :
Rel r (-a) (-b) := by simp only [neg_eq_neg_one_mul a, neg_eq_neg_one_mul b, Rel.mul_right h]
#align ring_quot.rel.neg RingQuot.Rel.neg
theorem Rel.sub_left {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r a b) :
Rel r (a - c) (b - c) := by simp only [sub_eq_add_neg, h.add_left]
#align ring_quot.rel.sub_left RingQuot.Rel.sub_left
theorem Rel.sub_right {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) :
Rel r (a - b) (a - c) := by simp only [sub_eq_add_neg, h.neg.add_right]
#align ring_quot.rel.sub_right RingQuot.Rel.sub_right
theorem Rel.smul {r : A → A → Prop} (k : S) ⦃a b : A⦄ (h : Rel r a b) : Rel r (k • a) (k • b) := by
simp only [Algebra.smul_def, Rel.mul_right h]
#align ring_quot.rel.smul RingQuot.Rel.smul
def ringCon (r : R → R → Prop) : RingCon R where
r := EqvGen (Rel r)
iseqv := EqvGen.is_equivalence _
add' {a b c d} hab hcd := by
induction hab generalizing c d with
| rel _ _ hab =>
refine (EqvGen.rel _ _ hab.add_left).trans _ _ _ ?_
induction hcd with
| rel _ _ hcd => exact EqvGen.rel _ _ hcd.add_right
| refl => exact EqvGen.refl _
| symm _ _ _ h => exact h.symm _ _
| trans _ _ _ _ _ h h' => exact h.trans _ _ _ h'
| refl => induction hcd with
| rel _ _ hcd => exact EqvGen.rel _ _ hcd.add_right
| refl => exact EqvGen.refl _
| symm _ _ _ h => exact h.symm _ _
| trans _ _ _ _ _ h h' => exact h.trans _ _ _ h'
| symm x y _ hxy => exact (hxy hcd.symm).symm
| trans x y z _ _ h h' => exact (h hcd).trans _ _ _ (h' <| EqvGen.refl _)
mul' {a b c d} hab hcd := by
induction hab generalizing c d with
| rel _ _ hab =>
refine (EqvGen.rel _ _ hab.mul_left).trans _ _ _ ?_
induction hcd with
| rel _ _ hcd => exact EqvGen.rel _ _ hcd.mul_right
| refl => exact EqvGen.refl _
| symm _ _ _ h => exact h.symm _ _
| trans _ _ _ _ _ h h' => exact h.trans _ _ _ h'
| refl => induction hcd with
| rel _ _ hcd => exact EqvGen.rel _ _ hcd.mul_right
| refl => exact EqvGen.refl _
| symm _ _ _ h => exact h.symm _ _
| trans _ _ _ _ _ h h' => exact h.trans _ _ _ h'
| symm x y _ hxy => exact (hxy hcd.symm).symm
| trans x y z _ _ h h' => exact (h hcd).trans _ _ _ (h' <| EqvGen.refl _)
#align ring_quot.ring_con RingQuot.ringCon
| Mathlib/Algebra/RingQuot.lean | 121 | 141 | theorem eqvGen_rel_eq (r : R → R → Prop) : EqvGen (Rel r) = RingConGen.Rel r := by |
ext x₁ x₂
constructor
· intro h
induction h with
| rel _ _ h => induction h with
| of => exact RingConGen.Rel.of _ _ ‹_›
| add_left _ h => exact h.add (RingConGen.Rel.refl _)
| mul_left _ h => exact h.mul (RingConGen.Rel.refl _)
| mul_right _ h => exact (RingConGen.Rel.refl _).mul h
| refl => exact RingConGen.Rel.refl _
| symm => exact RingConGen.Rel.symm ‹_›
| trans => exact RingConGen.Rel.trans ‹_› ‹_›
· intro h
induction h with
| of => exact EqvGen.rel _ _ (Rel.of ‹_›)
| refl => exact (RingQuot.ringCon r).refl _
| symm => exact (RingQuot.ringCon r).symm ‹_›
| trans => exact (RingQuot.ringCon r).trans ‹_› ‹_›
| add => exact (RingQuot.ringCon r).add ‹_› ‹_›
| mul => exact (RingQuot.ringCon r).mul ‹_› ‹_›
| 20 |
import Mathlib.Algebra.Polynomial.Basic
#align_import data.polynomial.monomial from "leanprover-community/mathlib"@"220f71ba506c8958c9b41bd82226b3d06b0991e8"
noncomputable section
namespace Polynomial
open Polynomial
universe u
variable {R : Type u} {a b : R} {m n : ℕ}
variable [Semiring R] {p q r : R[X]}
theorem monomial_one_eq_iff [Nontrivial R] {i j : ℕ} :
(monomial i 1 : R[X]) = monomial j 1 ↔ i = j := by
-- Porting note: `ofFinsupp.injEq` is required.
simp_rw [← ofFinsupp_single, ofFinsupp.injEq]
exact AddMonoidAlgebra.of_injective.eq_iff
#align polynomial.monomial_one_eq_iff Polynomial.monomial_one_eq_iff
instance infinite [Nontrivial R] : Infinite R[X] :=
Infinite.of_injective (fun i => monomial i 1) fun m n h => by simpa [monomial_one_eq_iff] using h
#align polynomial.infinite Polynomial.infinite
theorem card_support_le_one_iff_monomial {f : R[X]} :
Finset.card f.support ≤ 1 ↔ ∃ n a, f = monomial n a := by
constructor
· intro H
rw [Finset.card_le_one_iff_subset_singleton] at H
rcases H with ⟨n, hn⟩
refine ⟨n, f.coeff n, ?_⟩
ext i
by_cases hi : i = n
· simp [hi, coeff_monomial]
· have : f.coeff i = 0 := by
rw [← not_mem_support_iff]
exact fun hi' => hi (Finset.mem_singleton.1 (hn hi'))
simp [this, Ne.symm hi, coeff_monomial]
· rintro ⟨n, a, rfl⟩
rw [← Finset.card_singleton n]
apply Finset.card_le_card
exact support_monomial' _ _
#align polynomial.card_support_le_one_iff_monomial Polynomial.card_support_le_one_iff_monomial
| Mathlib/Algebra/Polynomial/Monomial.lean | 59 | 80 | theorem ringHom_ext {S} [Semiring S] {f g : R[X] →+* S} (h₁ : ∀ a, f (C a) = g (C a))
(h₂ : f X = g X) : f = g := by |
set f' := f.comp (toFinsuppIso R).symm.toRingHom with hf'
set g' := g.comp (toFinsuppIso R).symm.toRingHom with hg'
have A : f' = g' := by
-- Porting note: Was `ext; simp [..]; simpa [..] using h₂`.
ext : 1
· ext
simp [f', g', h₁, RingEquiv.toRingHom_eq_coe]
· refine MonoidHom.ext_mnat ?_
simpa [RingEquiv.toRingHom_eq_coe] using h₂
have B : f = f'.comp (toFinsuppIso R) := by
rw [hf', RingHom.comp_assoc]
ext x
simp only [RingEquiv.toRingHom_eq_coe, RingEquiv.symm_apply_apply, Function.comp_apply,
RingHom.coe_comp, RingEquiv.coe_toRingHom]
have C' : g = g'.comp (toFinsuppIso R) := by
rw [hg', RingHom.comp_assoc]
ext x
simp only [RingEquiv.toRingHom_eq_coe, RingEquiv.symm_apply_apply, Function.comp_apply,
RingHom.coe_comp, RingEquiv.coe_toRingHom]
rw [B, C', A]
| 20 |
import Mathlib.Geometry.Euclidean.Circumcenter
#align_import geometry.euclidean.monge_point from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0"
noncomputable section
open scoped Classical
open scoped RealInnerProductSpace
namespace Affine
namespace Simplex
open Finset AffineSubspace EuclideanGeometry PointsWithCircumcenterIndex
variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P]
def mongePoint {n : ℕ} (s : Simplex ℝ P n) : P :=
(((n + 1 : ℕ) : ℝ) / ((n - 1 : ℕ) : ℝ)) •
((univ : Finset (Fin (n + 1))).centroid ℝ s.points -ᵥ s.circumcenter) +ᵥ
s.circumcenter
#align affine.simplex.monge_point Affine.Simplex.mongePoint
theorem mongePoint_eq_smul_vsub_vadd_circumcenter {n : ℕ} (s : Simplex ℝ P n) :
s.mongePoint =
(((n + 1 : ℕ) : ℝ) / ((n - 1 : ℕ) : ℝ)) •
((univ : Finset (Fin (n + 1))).centroid ℝ s.points -ᵥ s.circumcenter) +ᵥ
s.circumcenter :=
rfl
#align affine.simplex.monge_point_eq_smul_vsub_vadd_circumcenter Affine.Simplex.mongePoint_eq_smul_vsub_vadd_circumcenter
theorem mongePoint_mem_affineSpan {n : ℕ} (s : Simplex ℝ P n) :
s.mongePoint ∈ affineSpan ℝ (Set.range s.points) :=
smul_vsub_vadd_mem _ _ (centroid_mem_affineSpan_of_card_eq_add_one ℝ _ (card_fin (n + 1)))
s.circumcenter_mem_affineSpan s.circumcenter_mem_affineSpan
#align affine.simplex.monge_point_mem_affine_span Affine.Simplex.mongePoint_mem_affineSpan
theorem mongePoint_eq_of_range_eq {n : ℕ} {s₁ s₂ : Simplex ℝ P n}
(h : Set.range s₁.points = Set.range s₂.points) : s₁.mongePoint = s₂.mongePoint := by
simp_rw [mongePoint_eq_smul_vsub_vadd_circumcenter, centroid_eq_of_range_eq h,
circumcenter_eq_of_range_eq h]
#align affine.simplex.monge_point_eq_of_range_eq Affine.Simplex.mongePoint_eq_of_range_eq
def mongePointWeightsWithCircumcenter (n : ℕ) : PointsWithCircumcenterIndex (n + 2) → ℝ
| pointIndex _ => ((n + 1 : ℕ) : ℝ)⁻¹
| circumcenterIndex => -2 / ((n + 1 : ℕ) : ℝ)
#align affine.simplex.monge_point_weights_with_circumcenter Affine.Simplex.mongePointWeightsWithCircumcenter
@[simp]
theorem sum_mongePointWeightsWithCircumcenter (n : ℕ) :
∑ i, mongePointWeightsWithCircumcenter n i = 1 := by
simp_rw [sum_pointsWithCircumcenter, mongePointWeightsWithCircumcenter, sum_const, card_fin,
nsmul_eq_mul]
-- Porting note: replaced
-- have hn1 : (n + 1 : ℝ) ≠ 0 := mod_cast Nat.succ_ne_zero _
field_simp [n.cast_add_one_ne_zero]
ring
#align affine.simplex.sum_monge_point_weights_with_circumcenter Affine.Simplex.sum_mongePointWeightsWithCircumcenter
| Mathlib/Geometry/Euclidean/MongePoint.lean | 130 | 154 | theorem mongePoint_eq_affineCombination_of_pointsWithCircumcenter {n : ℕ}
(s : Simplex ℝ P (n + 2)) :
s.mongePoint =
(univ : Finset (PointsWithCircumcenterIndex (n + 2))).affineCombination ℝ
s.pointsWithCircumcenter (mongePointWeightsWithCircumcenter n) := by |
rw [mongePoint_eq_smul_vsub_vadd_circumcenter,
centroid_eq_affineCombination_of_pointsWithCircumcenter,
circumcenter_eq_affineCombination_of_pointsWithCircumcenter, affineCombination_vsub,
← LinearMap.map_smul, weightedVSub_vadd_affineCombination]
congr with i
rw [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.sub_apply]
-- Porting note: replaced
-- have hn1 : (n + 1 : ℝ) ≠ 0 := mod_cast Nat.succ_ne_zero _
have hn1 : (n + 1 : ℝ) ≠ 0 := n.cast_add_one_ne_zero
cases i <;>
simp_rw [centroidWeightsWithCircumcenter, circumcenterWeightsWithCircumcenter,
mongePointWeightsWithCircumcenter] <;>
rw [add_tsub_assoc_of_le (by decide : 1 ≤ 2), (by decide : 2 - 1 = 1)]
· rw [if_pos (mem_univ _), sub_zero, add_zero, card_fin]
-- Porting note: replaced
-- have hn3 : (n + 2 + 1 : ℝ) ≠ 0 := mod_cast Nat.succ_ne_zero _
have hn3 : (n + 2 + 1 : ℝ) ≠ 0 := by norm_cast
field_simp [hn1, hn3, mul_comm]
· field_simp [hn1]
ring
| 20 |
import Batteries.Classes.SatisfiesM
namespace Array
theorem SatisfiesM_foldlM [Monad m] [LawfulMonad m]
{as : Array α} (motive : Nat → β → Prop) {init : β} (h0 : motive 0 init) {f : β → α → m β}
(hf : ∀ i : Fin as.size, ∀ b, motive i.1 b → SatisfiesM (motive (i.1 + 1)) (f b as[i])) :
SatisfiesM (motive as.size) (as.foldlM f init) := by
let rec go {i j b} (h₁ : j ≤ as.size) (h₂ : as.size ≤ i + j) (H : motive j b) :
SatisfiesM (motive as.size) (foldlM.loop f as as.size (Nat.le_refl _) i j b) := by
unfold foldlM.loop; split
· next hj =>
split
· cases Nat.not_le_of_gt (by simp [hj]) h₂
· exact (hf ⟨j, hj⟩ b H).bind fun _ => go hj (by rwa [Nat.succ_add] at h₂)
· next hj => exact Nat.le_antisymm h₁ (Nat.ge_of_not_lt hj) ▸ .pure H
simp [foldlM]; exact go (Nat.zero_le _) (Nat.le_refl _) h0
theorem SatisfiesM_mapM [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β)
(motive : Nat → Prop) (h0 : motive 0)
(p : Fin as.size → β → Prop)
(hs : ∀ i, motive i.1 → SatisfiesM (p i · ∧ motive (i + 1)) (f as[i])) :
SatisfiesM
(fun arr => motive as.size ∧ ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i])
(Array.mapM f as) := by
rw [mapM_eq_foldlM]
refine SatisfiesM_foldlM (m := m) (β := Array β)
(motive := fun i arr => motive i ∧ arr.size = i ∧ ∀ i h2, p i (arr[i.1]'h2)) ?z ?s
|>.imp fun ⟨h₁, eq, h₂⟩ => ⟨h₁, eq, fun _ _ => h₂ ..⟩
· case z => exact ⟨h0, rfl, nofun⟩
· case s =>
intro ⟨i, hi⟩ arr ⟨ih₁, eq, ih₂⟩
refine (hs _ ih₁).map fun ⟨h₁, h₂⟩ => ⟨h₂, by simp [eq], fun j hj => ?_⟩
simp [get_push] at hj ⊢; split; {apply ih₂}
cases j; cases (Nat.le_or_eq_of_le_succ hj).resolve_left ‹_›; cases eq; exact h₁
theorem SatisfiesM_mapM' [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β)
(p : Fin as.size → β → Prop)
(hs : ∀ i, SatisfiesM (p i) (f as[i])) :
SatisfiesM
(fun arr => ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i])
(Array.mapM f as) :=
(SatisfiesM_mapM _ _ (fun _ => True) trivial _ (fun _ h => (hs _).imp (⟨·, h⟩))).imp (·.2)
theorem size_mapM [Monad m] [LawfulMonad m] (f : α → m β) (as : Array α) :
SatisfiesM (fun arr => arr.size = as.size) (Array.mapM f as) :=
(SatisfiesM_mapM' _ _ (fun _ _ => True) (fun _ => .trivial)).imp (·.1)
theorem SatisfiesM_anyM [Monad m] [LawfulMonad m] (p : α → m Bool) (as : Array α) (start stop)
(hstart : start ≤ min stop as.size) (tru : Prop) (fal : Nat → Prop) (h0 : fal start)
(hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 →
SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) :
SatisfiesM
(fun res => bif res then tru else fal (min stop as.size))
(anyM p as start stop) := by
let rec go {stop j} (hj' : j ≤ stop) (hstop : stop ≤ as.size) (h0 : fal j)
(hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 →
SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) :
SatisfiesM
(fun res => bif res then tru else fal stop)
(anyM.loop p as stop hstop j) := by
unfold anyM.loop; split
· next hj =>
exact (hp ⟨j, Nat.lt_of_lt_of_le hj hstop⟩ hj h0).bind fun
| true, h => .pure h
| false, h => go hj hstop h hp
· next hj => exact .pure <| Nat.le_antisymm hj' (Nat.ge_of_not_lt hj) ▸ h0
termination_by stop - j
simp only [Array.anyM_eq_anyM_loop]
exact go hstart _ h0 fun i hi => hp i <| Nat.lt_of_lt_of_le hi <| Nat.min_le_left ..
| .lake/packages/batteries/Batteries/Data/Array/Monadic.lean | 85 | 110 | theorem SatisfiesM_anyM_iff_exists [Monad m] [LawfulMonad m]
(p : α → m Bool) (as : Array α) (start stop) (q : Fin as.size → Prop)
(hp : ∀ i : Fin as.size, start ≤ i.1 → i.1 < stop → SatisfiesM (· = true ↔ q i) (p as[i])) :
SatisfiesM
(fun res => res = true ↔ ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < stop ∧ q i)
(anyM p as start stop) := by |
cases Nat.le_total start (min stop as.size) with
| inl hstart =>
refine (SatisfiesM_anyM _ _ _ _ hstart
(fal := fun j => start ≤ j ∧ ¬ ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < j ∧ q i)
(tru := ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < stop ∧ q i) ?_ ?_).imp ?_
· exact ⟨Nat.le_refl _, fun ⟨i, h₁, h₂, _⟩ => (Nat.not_le_of_gt h₂ h₁).elim⟩
· refine fun i h₂ ⟨h₁, h₃⟩ => (hp _ h₁ h₂).imp fun hq => ?_
unfold cond; split <;> simp at hq
· exact ⟨_, h₁, h₂, hq⟩
· refine ⟨Nat.le_succ_of_le h₁, h₃.imp fun ⟨j, h₃, h₄, h₅⟩ => ⟨j, h₃, ?_, h₅⟩⟩
refine Nat.lt_of_le_of_ne (Nat.le_of_lt_succ h₄) fun e => hq (Fin.eq_of_val_eq e ▸ h₅)
· intro
| true, h => simp only [true_iff]; exact h
| false, h =>
simp only [false_iff]
exact h.2.imp fun ⟨j, h₁, h₂, hq⟩ => ⟨j, h₁, Nat.lt_min.2 ⟨h₂, j.2⟩, hq⟩
| inr hstart =>
rw [anyM_stop_le_start (h := hstart)]
refine .pure ?_; simp; intro j h₁ h₂
cases Nat.not_lt.2 (Nat.le_trans hstart h₁) (Nat.lt_min.2 ⟨h₂, j.2⟩)
| 20 |
import Mathlib.Data.Fintype.Basic
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Tactic.Zify
import Mathlib.Data.Nat.Totient
#align_import number_theory.lucas_primality from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
| Mathlib/NumberTheory/LucasPrimality.lean | 42 | 63 | theorem lucas_primality (p : ℕ) (a : ZMod p) (ha : a ^ (p - 1) = 1)
(hd : ∀ q : ℕ, q.Prime → q ∣ p - 1 → a ^ ((p - 1) / q) ≠ 1) : p.Prime := by |
have h0 : p ≠ 0 := by
rintro ⟨⟩
exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _)
have h1 : p ≠ 1 := by
rintro ⟨⟩
exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _)
have hp1 : 1 < p := lt_of_le_of_ne h0.bot_lt h1.symm
have order_of_a : orderOf a = p - 1 := by
apply orderOf_eq_of_pow_and_pow_div_prime _ ha hd
exact tsub_pos_of_lt hp1
haveI : NeZero p := ⟨h0⟩
rw [Nat.prime_iff_card_units]
-- Prove cardinality of `Units` of `ZMod p` is both `≤ p-1` and `≥ p-1`
refine le_antisymm (Nat.card_units_zmod_lt_sub_one hp1) ?_
have hp' : p - 2 + 1 = p - 1 := tsub_add_eq_add_tsub hp1
let a' : (ZMod p)ˣ := Units.mkOfMulEqOne a (a ^ (p - 2)) (by rw [← pow_succ', hp', ha])
calc
p - 1 = orderOf a := order_of_a.symm
_ = orderOf a' := (orderOf_injective (Units.coeHom (ZMod p)) Units.ext a')
_ ≤ Fintype.card (ZMod p)ˣ := orderOf_le_card_univ
| 20 |
import Mathlib.Data.Finset.Sigma
import Mathlib.Data.Fintype.Card
#align_import data.finset.pi_induction from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6"
open Function
variable {ι : Type*} {α : ι → Type*} [Finite ι] [DecidableEq ι] [∀ i, DecidableEq (α i)]
namespace Finset
| Mathlib/Data/Finset/PiInduction.lean | 37 | 63 | theorem induction_on_pi_of_choice (r : ∀ i, α i → Finset (α i) → Prop)
(H_ex : ∀ (i) (s : Finset (α i)), s.Nonempty → ∃ x ∈ s, r i x (s.erase x))
{p : (∀ i, Finset (α i)) → Prop} (f : ∀ i, Finset (α i)) (h0 : p fun _ ↦ ∅)
(step :
∀ (g : ∀ i, Finset (α i)) (i : ι) (x : α i),
r i x (g i) → p g → p (update g i (insert x (g i)))) :
p f := by |
cases nonempty_fintype ι
induction' hs : univ.sigma f using Finset.strongInductionOn with s ihs generalizing f; subst s
rcases eq_empty_or_nonempty (univ.sigma f) with he | hne
· convert h0 using 1
simpa [funext_iff] using he
· rcases sigma_nonempty.1 hne with ⟨i, -, hi⟩
rcases H_ex i (f i) hi with ⟨x, x_mem, hr⟩
set g := update f i ((f i).erase x) with hg
clear_value g
have hx' : x ∉ g i := by
rw [hg, update_same]
apply not_mem_erase
rw [show f = update g i (insert x (g i)) by
rw [hg, update_idem, update_same, insert_erase x_mem, update_eq_self]] at hr ihs ⊢
clear hg
rw [update_same, erase_insert hx'] at hr
refine step _ _ _ hr (ihs (univ.sigma g) ?_ _ rfl)
rw [ssubset_iff_of_subset (sigma_mono (Subset.refl _) _)]
exacts [⟨⟨i, x⟩, mem_sigma.2 ⟨mem_univ _, by simp⟩, by simp [hx']⟩,
(@le_update_iff _ _ _ _ g g i _).2 ⟨subset_insert _ _, fun _ _ ↦ le_rfl⟩]
| 20 |
import Mathlib.Topology.Order.MonotoneContinuity
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.Instances.NNReal
import Mathlib.Topology.EMetricSpace.Lipschitz
import Mathlib.Topology.Metrizable.Basic
import Mathlib.Topology.Order.T5
#align_import topology.instances.ennreal from "leanprover-community/mathlib"@"ec4b2eeb50364487f80421c0b4c41328a611f30d"
noncomputable section
open Set Filter Metric Function
open scoped Classical Topology ENNReal NNReal Filter
variable {α : Type*} {β : Type*} {γ : Type*}
namespace ENNReal
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} {x y z : ℝ≥0∞} {ε ε₁ ε₂ : ℝ≥0∞} {s : Set ℝ≥0∞}
section Liminf
theorem exists_frequently_lt_of_liminf_ne_top {ι : Type*} {l : Filter ι} {x : ι → ℝ}
(hx : liminf (fun n => (Real.nnabs (x n) : ℝ≥0∞)) l ≠ ∞) : ∃ R, ∃ᶠ n in l, x n < R := by
by_contra h
simp_rw [not_exists, not_frequently, not_lt] at h
refine hx (ENNReal.eq_top_of_forall_nnreal_le fun r => le_limsInf_of_le (by isBoundedDefault) ?_)
simp only [eventually_map, ENNReal.coe_le_coe]
filter_upwards [h r] with i hi using hi.trans (le_abs_self (x i))
#align ennreal.exists_frequently_lt_of_liminf_ne_top ENNReal.exists_frequently_lt_of_liminf_ne_top
theorem exists_frequently_lt_of_liminf_ne_top' {ι : Type*} {l : Filter ι} {x : ι → ℝ}
(hx : liminf (fun n => (Real.nnabs (x n) : ℝ≥0∞)) l ≠ ∞) : ∃ R, ∃ᶠ n in l, R < x n := by
by_contra h
simp_rw [not_exists, not_frequently, not_lt] at h
refine hx (ENNReal.eq_top_of_forall_nnreal_le fun r => le_limsInf_of_le (by isBoundedDefault) ?_)
simp only [eventually_map, ENNReal.coe_le_coe]
filter_upwards [h (-r)] with i hi using(le_neg.1 hi).trans (neg_le_abs _)
#align ennreal.exists_frequently_lt_of_liminf_ne_top' ENNReal.exists_frequently_lt_of_liminf_ne_top'
| Mathlib/Topology/Instances/ENNReal.lean | 748 | 771 | theorem exists_upcrossings_of_not_bounded_under {ι : Type*} {l : Filter ι} {x : ι → ℝ}
(hf : liminf (fun i => (Real.nnabs (x i) : ℝ≥0∞)) l ≠ ∞)
(hbdd : ¬IsBoundedUnder (· ≤ ·) l fun i => |x i|) :
∃ a b : ℚ, a < b ∧ (∃ᶠ i in l, x i < a) ∧ ∃ᶠ i in l, ↑b < x i := by |
rw [isBoundedUnder_le_abs, not_and_or] at hbdd
obtain hbdd | hbdd := hbdd
· obtain ⟨R, hR⟩ := exists_frequently_lt_of_liminf_ne_top hf
obtain ⟨q, hq⟩ := exists_rat_gt R
refine ⟨q, q + 1, (lt_add_iff_pos_right _).2 zero_lt_one, ?_, ?_⟩
· refine fun hcon => hR ?_
filter_upwards [hcon] with x hx using not_lt.2 (lt_of_lt_of_le hq (not_lt.1 hx)).le
· simp only [IsBoundedUnder, IsBounded, eventually_map, eventually_atTop, ge_iff_le,
not_exists, not_forall, not_le, exists_prop] at hbdd
refine fun hcon => hbdd ↑(q + 1) ?_
filter_upwards [hcon] with x hx using not_lt.1 hx
· obtain ⟨R, hR⟩ := exists_frequently_lt_of_liminf_ne_top' hf
obtain ⟨q, hq⟩ := exists_rat_lt R
refine ⟨q - 1, q, (sub_lt_self_iff _).2 zero_lt_one, ?_, ?_⟩
· simp only [IsBoundedUnder, IsBounded, eventually_map, eventually_atTop, ge_iff_le,
not_exists, not_forall, not_le, exists_prop] at hbdd
refine fun hcon => hbdd ↑(q - 1) ?_
filter_upwards [hcon] with x hx using not_lt.1 hx
· refine fun hcon => hR ?_
filter_upwards [hcon] with x hx using not_lt.2 ((not_lt.1 hx).trans hq.le)
| 20 |
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic
#align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap
open scoped NNReal ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α}
| Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean | 38 | 59 | theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) :
μ[f|m] =ᵐ[μ.restrict s] 0 := by |
by_cases hm : m ≤ m0
swap; · simp_rw [condexp_of_not_le hm]; rfl
by_cases hμm : SigmaFinite (μ.trim hm)
swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl
haveI : SigmaFinite (μ.trim hm) := hμm
have : SigmaFinite ((μ.restrict s).trim hm) := by
rw [← restrict_trim hm _ hs]
exact Restrict.sigmaFinite _ s
by_cases hf_int : Integrable f μ
swap; · rw [condexp_undef hf_int]
refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_
· exact fun t _ _ => integrable_condexp.integrableOn.integrableOn
· exact fun t _ _ => (integrable_zero _ _ _).integrableOn
· intro t ht _
rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ←
Measure.restrict_restrict (hm _ ht)]
refine setIntegral_congr_ae (hm _ ht) ?_
filter_upwards [hf] with x hx _ using hx
· exact stronglyMeasurable_condexp.aeStronglyMeasurable'
· exact stronglyMeasurable_zero.aeStronglyMeasurable'
| 20 |
import Mathlib.RingTheory.WittVector.Basic
import Mathlib.RingTheory.WittVector.IsPoly
#align_import ring_theory.witt_vector.init_tail from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) {R : Type*} [CommRing R]
-- type as `\bbW`
local notation "𝕎" => WittVector p
namespace WittVector
open MvPolynomial
open scoped Classical
noncomputable section
section
def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R :=
mk p fun n => if P n then x.coeff n else 0
#align witt_vector.select WittVector.select
section Select
variable (P : ℕ → Prop)
def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ :=
if P n then X n else 0
#align witt_vector.select_poly WittVector.selectPoly
theorem coeff_select (x : 𝕎 R) (n : ℕ) :
(select P x).coeff n = aeval x.coeff (selectPoly P n) := by
dsimp [select, selectPoly]
split_ifs with hi
· rw [aeval_X, mk]; simp only [hi]; rfl
· rw [AlgHom.map_zero, mk]; simp only [hi]; rfl
#align witt_vector.coeff_select WittVector.coeff_select
-- Porting note: replaced `@[is_poly]` with `instance`. Made the argument `P` implicit in doing so.
instance select_isPoly {P : ℕ → Prop} : IsPoly p fun _ _ x => select P x := by
use selectPoly P
rintro R _Rcr x
funext i
apply coeff_select
#align witt_vector.select_is_poly WittVector.select_isPoly
theorem select_add_select_not : ∀ x : 𝕎 R, select P x + select (fun i => ¬P i) x = x := by
-- Porting note: TC search was insufficient to find this instance, even though all required
-- instances exist. See zulip: [https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/WittVector.20saga/near/370073526]
have : IsPoly p fun {R} [CommRing R] x ↦ select P x + select (fun i ↦ ¬P i) x :=
IsPoly₂.diag (hf := IsPoly₂.comp)
ghost_calc x
intro n
simp only [RingHom.map_add]
suffices
(bind₁ (selectPoly P)) (wittPolynomial p ℤ n) +
(bind₁ (selectPoly fun i => ¬P i)) (wittPolynomial p ℤ n) =
wittPolynomial p ℤ n by
apply_fun aeval x.coeff at this
simpa only [AlgHom.map_add, aeval_bind₁, ← coeff_select]
simp only [wittPolynomial_eq_sum_C_mul_X_pow, selectPoly, AlgHom.map_sum, AlgHom.map_pow,
AlgHom.map_mul, bind₁_X_right, bind₁_C_right, ← Finset.sum_add_distrib, ← mul_add]
apply Finset.sum_congr rfl
refine fun m _ => mul_eq_mul_left_iff.mpr (Or.inl ?_)
rw [ite_pow, zero_pow (pow_ne_zero _ hp.out.ne_zero)]
by_cases Pm : P m
· rw [if_pos Pm, if_neg $ not_not_intro Pm, zero_pow Fin.size_pos'.ne', add_zero]
· rwa [if_neg Pm, if_pos, zero_add]
#align witt_vector.select_add_select_not WittVector.select_add_select_not
| Mathlib/RingTheory/WittVector/InitTail.lean | 112 | 133 | theorem coeff_add_of_disjoint (x y : 𝕎 R) (h : ∀ n, x.coeff n = 0 ∨ y.coeff n = 0) :
(x + y).coeff n = x.coeff n + y.coeff n := by |
let P : ℕ → Prop := fun n => y.coeff n = 0
haveI : DecidablePred P := Classical.decPred P
set z := mk p fun n => if P n then x.coeff n else y.coeff n
have hx : select P z = x := by
ext1 n; rw [select, coeff_mk, coeff_mk]
split_ifs with hn
· rfl
· rw [(h n).resolve_right hn]
have hy : select (fun i => ¬P i) z = y := by
ext1 n; rw [select, coeff_mk, coeff_mk]
split_ifs with hn
· exact hn.symm
· rfl
calc
(x + y).coeff n = z.coeff n := by rw [← hx, ← hy, select_add_select_not P z]
_ = x.coeff n + y.coeff n := by
simp only [z, mk.eq_1]
split_ifs with y0
· rw [y0, add_zero]
· rw [h n |>.resolve_right y0, zero_add]
| 20 |
import Mathlib.FieldTheory.Separable
import Mathlib.RingTheory.IntegralDomain
import Mathlib.Algebra.CharP.Reduced
import Mathlib.Tactic.ApplyFun
#align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43"
variable {K : Type*} {R : Type*}
local notation "q" => Fintype.card K
open Finset
open scoped Polynomial
namespace FiniteField
theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] :
∏ x : Kˣ, x = (-1 : Kˣ) := by
classical
have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 :=
prod_involution (fun x _ => x⁻¹) (by simp)
(fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff])
(fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp)
rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one]
#align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K]
(G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by
let n := Fintype.card G
intro nzero
have ⟨p, char_p⟩ := CharP.exists K
have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero
cases CharP.char_is_prime_or_zero K p with
| inr pzero =>
exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd
| inl pprime =>
have fact_pprime := Fact.mk pprime
-- G has an element x of order p by Cauchy's theorem
have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd
-- F has an element u (= ↑↑x) of order p
let u := ((x : Kˣ) : K)
have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe]
-- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ...
have h : u = 1 := by
rw [← sub_left_inj, sub_self 1]
apply pow_eq_zero (n := p)
rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self]
exact Commute.one_right u
-- ... meaning x didn't have order p after all, contradiction
apply pprime.one_lt.ne
rw [← hu, h, orderOf_one]
| Mathlib/FieldTheory/Finite/Basic.lean | 142 | 164 | theorem sum_subgroup_units_eq_zero [Ring K] [NoZeroDivisors K]
{G : Subgroup Kˣ} [Fintype G] (hg : G ≠ ⊥) :
∑ x : G, (x.val : K) = 0 := by |
rw [Subgroup.ne_bot_iff_exists_ne_one] at hg
rcases hg with ⟨a, ha⟩
-- The action of a on G as an embedding
let a_mul_emb : G ↪ G := mulLeftEmbedding a
-- ... and leaves G unchanged
have h_unchanged : Finset.univ.map a_mul_emb = Finset.univ := by simp
-- Therefore the sum of x over a G is the sum of a x over G
have h_sum_map := Finset.univ.sum_map a_mul_emb fun x => ((x : Kˣ) : K)
-- ... and the former is the sum of x over G.
-- By algebraic manipulation, we have Σ G, x = ∑ G, a x = a ∑ G, x
simp only [a_mul_emb, h_unchanged, Function.Embedding.coeFn_mk, Function.Embedding.toFun_eq_coe,
mulLeftEmbedding_apply, Submonoid.coe_mul, Subgroup.coe_toSubmonoid, Units.val_mul,
← Finset.mul_sum] at h_sum_map
-- thus one of (a - 1) or ∑ G, x is zero
have hzero : (((a : Kˣ) : K) - 1) = 0 ∨ ∑ x : ↥G, ((x : Kˣ) : K) = 0 := by
rw [← mul_eq_zero, sub_mul, ← h_sum_map, one_mul, sub_self]
apply Or.resolve_left hzero
contrapose! ha
ext
rwa [← sub_eq_zero]
| 20 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
#align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Filter Metric Set
open scoped ComplexConjugate Real Topology
namespace Complex
variable {a x z : ℂ}
noncomputable def arg (x : ℂ) : ℝ :=
if 0 ≤ x.re then Real.arcsin (x.im / abs x)
else if 0 ≤ x.im then Real.arcsin ((-x).im / abs x) + π else Real.arcsin ((-x).im / abs x) - π
#align complex.arg Complex.arg
theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by
unfold arg; split_ifs <;>
simp [sub_eq_add_neg, arg,
Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2,
Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg]
#align complex.sin_arg Complex.sin_arg
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
rw [arg]
split_ifs with h₁ h₂
· rw [Real.cos_arcsin]
field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
· rw [Real.cos_add_pi, Real.cos_arcsin]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
_root_.abs_of_neg (not_le.1 h₁), *]
· rw [Real.cos_sub_pi, Real.cos_arcsin]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
_root_.abs_of_neg (not_le.1 h₁), *]
#align complex.cos_arg Complex.cos_arg
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
rcases eq_or_ne x 0 with (rfl | hx)
· simp
· have : abs x ≠ 0 := abs.ne_zero hx
apply Complex.ext <;> field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
set_option linter.uppercaseLean3 false in
#align complex.abs_mul_exp_arg_mul_I Complex.abs_mul_exp_arg_mul_I
@[simp]
theorem abs_mul_cos_add_sin_mul_I (x : ℂ) : (abs x * (cos (arg x) + sin (arg x) * I) : ℂ) = x := by
rw [← exp_mul_I, abs_mul_exp_arg_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.abs_mul_cos_add_sin_mul_I Complex.abs_mul_cos_add_sin_mul_I
@[simp]
lemma abs_mul_cos_arg (x : ℂ) : abs x * Real.cos (arg x) = x.re := by
simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg re (abs_mul_cos_add_sin_mul_I x)
@[simp]
lemma abs_mul_sin_arg (x : ℂ) : abs x * Real.sin (arg x) = x.im := by
simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg im (abs_mul_cos_add_sin_mul_I x)
theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by
refine ⟨fun hz => ⟨arg z, ?_⟩, ?_⟩
· calc
exp (arg z * I) = abs z * exp (arg z * I) := by rw [hz, ofReal_one, one_mul]
_ = z := abs_mul_exp_arg_mul_I z
· rintro ⟨θ, rfl⟩
exact Complex.abs_exp_ofReal_mul_I θ
#align complex.abs_eq_one_iff Complex.abs_eq_one_iff
@[simp]
theorem range_exp_mul_I : (Set.range fun x : ℝ => exp (x * I)) = Metric.sphere 0 1 := by
ext x
simp only [mem_sphere_zero_iff_norm, norm_eq_abs, abs_eq_one_iff, Set.mem_range]
set_option linter.uppercaseLean3 false in
#align complex.range_exp_mul_I Complex.range_exp_mul_I
| Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean | 93 | 114 | theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) :
arg (r * (cos θ + sin θ * I)) = θ := by |
simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
simp only [re_ofReal_mul, im_ofReal_mul, neg_im, ← ofReal_cos, ← ofReal_sin, ←
mk_eq_add_mul_I, neg_div, mul_div_cancel_left₀ _ hr.ne', mul_nonneg_iff_right_nonneg_of_pos hr]
by_cases h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2)
· rw [if_pos]
exacts [Real.arcsin_sin' h₁, Real.cos_nonneg_of_mem_Icc h₁]
· rw [Set.mem_Icc, not_and_or, not_le, not_le] at h₁
cases' h₁ with h₁ h₁
· replace hθ := hθ.1
have hcos : Real.cos θ < 0 := by
rw [← neg_pos, ← Real.cos_add_pi]
refine Real.cos_pos_of_mem_Ioo ⟨?_, ?_⟩ <;> linarith
have hsin : Real.sin θ < 0 := Real.sin_neg_of_neg_of_neg_pi_lt (by linarith) hθ
rw [if_neg, if_neg, ← Real.sin_add_pi, Real.arcsin_sin, add_sub_cancel_right] <;> [linarith;
linarith; exact hsin.not_le; exact hcos.not_le]
· replace hθ := hθ.2
have hcos : Real.cos θ < 0 := Real.cos_neg_of_pi_div_two_lt_of_lt h₁ (by linarith)
have hsin : 0 ≤ Real.sin θ := Real.sin_nonneg_of_mem_Icc ⟨by linarith, hθ⟩
rw [if_neg, if_pos, ← Real.sin_sub_pi, Real.arcsin_sin, sub_add_cancel] <;> [linarith;
linarith; exact hsin; exact hcos.not_le]
| 20 |
import Mathlib.Init.Classical
import Mathlib.Order.FixedPoints
import Mathlib.Order.Zorn
#align_import set_theory.cardinal.schroeder_bernstein from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae"
open Set Function
open scoped Classical
universe u v
namespace Function
namespace Embedding
section Wo
variable {ι : Type u} (β : ι → Type v)
private abbrev sets :=
{ s : Set (∀ i, β i) | ∀ x ∈ s, ∀ y ∈ s, ∀ (i), (x : ∀ i, β i) i = y i → x = y }
| Mathlib/SetTheory/Cardinal/SchroederBernstein.lean | 100 | 131 | theorem min_injective [I : Nonempty ι] : ∃ i, Nonempty (∀ j, β i ↪ β j) :=
let ⟨s, hs, ms⟩ :=
show ∃ s ∈ sets β, ∀ a ∈ sets β, s ⊆ a → a = s from
zorn_subset (sets β) fun c hc hcc =>
⟨⋃₀c, fun x ⟨p, hpc, hxp⟩ y ⟨q, hqc, hyq⟩ i hi =>
(hcc.total hpc hqc).elim (fun h => hc hqc x (h hxp) y hyq i hi) fun h =>
hc hpc x hxp y (h hyq) i hi,
fun _ => subset_sUnion_of_mem⟩
let ⟨i, e⟩ :=
show ∃ i, ∀ y, ∃ x ∈ s, (x : ∀ i, β i) i = y from
Classical.by_contradiction fun h =>
have h : ∀ i, ∃ y, ∀ x ∈ s, (x : ∀ i, β i) i ≠ y := by |
simpa only [ne_eq, not_exists, not_forall, not_and] using h
let ⟨f, hf⟩ := Classical.axiom_of_choice h
have : f ∈ s :=
have : insert f s ∈ sets β := fun x hx y hy => by
cases' hx with hx hx <;> cases' hy with hy hy; · simp [hx, hy]
· subst x
exact fun i e => (hf i y hy e.symm).elim
· subst y
exact fun i e => (hf i x hx e).elim
· exact hs x hx y hy
ms _ this (subset_insert f s) ▸ mem_insert _ _
let ⟨i⟩ := I
hf i f this rfl
let ⟨f, hf⟩ := Classical.axiom_of_choice e
⟨i,
⟨fun j =>
⟨fun a => f a j, fun a b e' => by
let ⟨sa, ea⟩ := hf a
let ⟨sb, eb⟩ := hf b
rw [← ea, ← eb, hs _ sa _ sb _ e']⟩⟩⟩
| 20 |
import Mathlib.Algebra.Star.Basic
import Mathlib.Algebra.Star.Pointwise
import Mathlib.Algebra.Group.Centralizer
variable {R : Type*} [Mul R] [StarMul R] {a : R} {s : Set R}
| Mathlib/Algebra/Star/Center.lean | 14 | 34 | theorem Set.star_mem_center (ha : a ∈ Set.center R) : star a ∈ Set.center R where
comm := by | simpa only [star_mul, star_star] using fun g =>
congr_arg star (((Set.mem_center_iff R).mp ha).comm <| star g).symm
left_assoc b c := calc
star a * (b * c) = star a * (star (star b) * star (star c)) := by rw [star_star, star_star]
_ = star a * star (star c * star b) := by rw [star_mul]
_ = star ((star c * star b) * a) := by rw [← star_mul]
_ = star (star c * (star b * a)) := by rw [ha.right_assoc]
_ = star (star b * a) * c := by rw [star_mul, star_star]
_ = (star a * b) * c := by rw [star_mul, star_star]
mid_assoc b c := calc
b * star a * c = star (star c * star (b * star a)) := by rw [← star_mul, star_star]
_ = star (star c * (a * star b)) := by rw [star_mul b, star_star]
_ = star ((star c * a) * star b) := by rw [ha.mid_assoc]
_ = b * (star a * c) := by rw [star_mul, star_star, star_mul (star c), star_star]
right_assoc b c := calc
b * c * star a = star (a * star (b * c)) := by rw [star_mul, star_star]
_ = star (a * (star c * star b)) := by rw [star_mul b]
_ = star ((a * star c) * star b) := by rw [ha.left_assoc]
_ = b * star (a * star c) := by rw [star_mul, star_star]
_ = b * (c * star a) := by rw [star_mul, star_star]
| 20 |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Data.Set.Function
#align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set MeasureTheory.MeasureSpace
variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ}
theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
simp only [Nat.cast_zero, add_zero]
_ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i < a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
apply hf _ _ hx.1
· simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left,
Nat.cast_le, and_self_iff]
· refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia]
_ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp
#align antitone_on.integral_le_sum AntitoneOn.integral_le_sum
theorem AntitoneOn.integral_le_sum_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) :
(∫ x in a..b, f x) ≤ ∑ x ∈ Finset.Ico a b, f x := by
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
· skip
· skip
rw [add_comm]
· skip
· skip
congr
congr
rw [← zero_add a]
rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
rhs
congr
· skip
ext
rw [Nat.cast_add]
apply AntitoneOn.integral_le_sum
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
#align antitone_on.integral_le_sum_Ico AntitoneOn.integral_le_sum_Ico
theorem AntitoneOn.sum_le_integral (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) ≤ ∫ x in x₀..x₀ + a, f x := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
(∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) =
∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + (i + 1 : ℕ)) := by simp
_ ≤ ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i + 1 ≤ a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (by simp) (hint _ ia) fun x hx => ?_
apply hf _ _ hx.2
· refine mem_Icc.2 ⟨le_trans ((le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _)) hx.1,
le_trans hx.2 ?_⟩
simp only [Nat.cast_le, add_le_add_iff_left, ia]
· refine mem_Icc.2 ⟨(le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _), ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, ia]
_ = ∫ x in x₀..x₀ + a, f x := by
convert intervalIntegral.sum_integral_adjacent_intervals hint
simp only [Nat.cast_zero, add_zero]
#align antitone_on.sum_le_integral AntitoneOn.sum_le_integral
| Mathlib/Analysis/SumIntegralComparisons.lean | 126 | 147 | theorem AntitoneOn.sum_le_integral_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) :
(∑ i ∈ Finset.Ico a b, f (i + 1 : ℕ)) ≤ ∫ x in a..b, f x := by |
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
congr
rw [← zero_add a]
· skip
· skip
· skip
rw [add_comm]
rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
lhs
congr
congr
· skip
ext
rw [add_assoc, Nat.cast_add]
apply AntitoneOn.sum_le_integral
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
| 20 |
import Mathlib.AlgebraicTopology.DoldKan.FunctorN
import Mathlib.AlgebraicTopology.DoldKan.Decomposition
import Mathlib.CategoryTheory.Idempotents.HomologicalComplex
import Mathlib.CategoryTheory.Idempotents.KaroubiKaroubi
#align_import algebraic_topology.dold_kan.n_reflects_iso from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Idempotents Opposite Simplicial
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C]
open MorphComponents
instance : (N₁ : SimplicialObject C ⥤ Karoubi (ChainComplex C ℕ)).ReflectsIsomorphisms :=
⟨fun {X Y} f => by
intro
-- restating the result in a way that allows induction on the degree n
suffices ∀ n : ℕ, IsIso (f.app (op [n])) by
haveI : ∀ Δ : SimplexCategoryᵒᵖ, IsIso (f.app Δ) := fun Δ => this Δ.unop.len
apply NatIso.isIso_of_isIso_app
-- restating the assumption in a more practical form
have h₁ := HomologicalComplex.congr_hom (Karoubi.hom_ext_iff.mp (IsIso.hom_inv_id (N₁.map f)))
have h₂ := HomologicalComplex.congr_hom (Karoubi.hom_ext_iff.mp (IsIso.inv_hom_id (N₁.map f)))
have h₃ := fun n =>
Karoubi.HomologicalComplex.p_comm_f_assoc (inv (N₁.map f)) n (f.app (op [n]))
simp only [N₁_map_f, Karoubi.comp_f, HomologicalComplex.comp_f,
AlternatingFaceMapComplex.map_f, N₁_obj_p, Karoubi.id_eq, assoc] at h₁ h₂ h₃
-- we have to construct an inverse to f in degree n, by induction on n
intro n
induction' n with n hn
-- degree 0
· use (inv (N₁.map f)).f.f 0
have h₁₀ := h₁ 0
have h₂₀ := h₂ 0
dsimp at h₁₀ h₂₀
simp only [id_comp, comp_id] at h₁₀ h₂₀
tauto
· haveI := hn
use φ { a := PInfty.f (n + 1) ≫ (inv (N₁.map f)).f.f (n + 1)
b := fun i => inv (f.app (op [n])) ≫ X.σ i }
simp only [MorphComponents.id, ← id_φ, ← preComp_φ, preComp, ← postComp_φ, postComp,
PInfty_f_naturality_assoc, IsIso.hom_inv_id_assoc, assoc, IsIso.inv_hom_id_assoc,
SimplicialObject.σ_naturality, h₁, h₂, h₃, and_self]⟩
| Mathlib/AlgebraicTopology/DoldKan/NReflectsIso.lean | 68 | 92 | theorem compatibility_N₂_N₁_karoubi :
N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor =
karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
N₁ ⋙ (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse _ := by |
refine CategoryTheory.Functor.ext (fun P => ?_) fun P Q f => ?_
· refine HomologicalComplex.ext ?_ ?_
· ext n
· rfl
· dsimp
simp only [karoubi_PInfty_f, comp_id, PInfty_f_naturality, id_comp, eqToHom_refl]
· rintro _ n (rfl : n + 1 = _)
ext
have h := (AlternatingFaceMapComplex.map P.p).comm (n + 1) n
dsimp [N₂, karoubiChainComplexEquivalence,
KaroubiHomologicalComplexEquivalence.Functor.obj] at h ⊢
simp only [assoc, Karoubi.eqToHom_f, eqToHom_refl, comp_id,
karoubi_alternatingFaceMapComplex_d, karoubi_PInfty_f,
← HomologicalComplex.Hom.comm_assoc, ← h, app_idem_assoc]
· ext n
dsimp [KaroubiKaroubi.inverse, Functor.mapHomologicalComplex]
simp only [karoubi_PInfty_f, HomologicalComplex.eqToHom_f, Karoubi.eqToHom_f,
assoc, comp_id, PInfty_f_naturality, app_p_comp,
karoubiChainComplexEquivalence_functor_obj_X_p, N₂_obj_p_f, eqToHom_refl,
PInfty_f_naturality_assoc, app_comp_p, PInfty_f_idem_assoc]
| 20 |
import Mathlib.Probability.Variance
import Mathlib.MeasureTheory.Function.UniformIntegrable
#align_import probability.ident_distrib from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open MeasureTheory Filter Finset
noncomputable section
open scoped Topology MeasureTheory ENNReal NNReal
variable {α β γ δ : Type*} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
[MeasurableSpace δ]
namespace ProbabilityTheory
structure IdentDistrib (f : α → γ) (g : β → γ)
(μ : Measure α := by volume_tac)
(ν : Measure β := by volume_tac) : Prop where
aemeasurable_fst : AEMeasurable f μ
aemeasurable_snd : AEMeasurable g ν
map_eq : Measure.map f μ = Measure.map g ν
#align probability_theory.ident_distrib ProbabilityTheory.IdentDistrib
section UniformIntegrable
open TopologicalSpace
variable {E : Type*} [MeasurableSpace E] [NormedAddCommGroup E] [BorelSpace E]
{μ : Measure α} [IsFiniteMeasure μ]
| Mathlib/Probability/IdentDistrib.lean | 326 | 348 | theorem Memℒp.uniformIntegrable_of_identDistrib_aux {ι : Type*} {f : ι → α → E} {j : ι} {p : ℝ≥0∞}
(hp : 1 ≤ p) (hp' : p ≠ ∞) (hℒp : Memℒp (f j) p μ) (hfmeas : ∀ i, StronglyMeasurable (f i))
(hf : ∀ i, IdentDistrib (f i) (f j) μ μ) : UniformIntegrable f p μ := by |
refine uniformIntegrable_of' hp hp' hfmeas fun ε hε => ?_
by_cases hι : Nonempty ι
swap; · exact ⟨0, fun i => False.elim (hι <| Nonempty.intro i)⟩
obtain ⟨C, hC₁, hC₂⟩ := hℒp.snorm_indicator_norm_ge_pos_le (hfmeas _) hε
refine ⟨⟨C, hC₁.le⟩, fun i => le_trans (le_of_eq ?_) hC₂⟩
have : {x | (⟨C, hC₁.le⟩ : ℝ≥0) ≤ ‖f i x‖₊} = {x | C ≤ ‖f i x‖} := by
ext x
simp_rw [← norm_toNNReal]
exact Real.le_toNNReal_iff_coe_le (norm_nonneg _)
rw [this, ← snorm_norm, ← snorm_norm (Set.indicator _ _)]
simp_rw [norm_indicator_eq_indicator_norm, coe_nnnorm]
let F : E → ℝ := (fun x : E => if (⟨C, hC₁.le⟩ : ℝ≥0) ≤ ‖x‖₊ then ‖x‖ else 0)
have F_meas : Measurable F := by
apply measurable_norm.indicator (measurableSet_le measurable_const measurable_nnnorm)
have : ∀ k, (fun x ↦ Set.indicator {x | C ≤ ‖f k x‖} (fun a ↦ ‖f k a‖) x) = F ∘ f k := by
intro k
ext x
simp only [Set.indicator, Set.mem_setOf_eq]; norm_cast
rw [this, this, ← snorm_map_measure F_meas.aestronglyMeasurable (hf i).aemeasurable_fst,
(hf i).map_eq, snorm_map_measure F_meas.aestronglyMeasurable (hf j).aemeasurable_fst]
| 20 |
import Mathlib.Algebra.GCDMonoid.Finset
import Mathlib.Algebra.Polynomial.CancelLeads
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.FieldDivision
#align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3"
namespace Polynomial
open Polynomial
variable {R : Type*} [CommRing R] [IsDomain R]
section NormalizedGCDMonoid
variable [NormalizedGCDMonoid R]
def content (p : R[X]) : R :=
p.support.gcd p.coeff
#align polynomial.content Polynomial.content
theorem content_dvd_coeff {p : R[X]} (n : ℕ) : p.content ∣ p.coeff n := by
by_cases h : n ∈ p.support
· apply Finset.gcd_dvd h
rw [mem_support_iff, Classical.not_not] at h
rw [h]
apply dvd_zero
#align polynomial.content_dvd_coeff Polynomial.content_dvd_coeff
@[simp]
theorem content_C {r : R} : (C r).content = normalize r := by
rw [content]
by_cases h0 : r = 0
· simp [h0]
have h : (C r).support = {0} := support_monomial _ h0
simp [h]
set_option linter.uppercaseLean3 false in
#align polynomial.content_C Polynomial.content_C
@[simp]
theorem content_zero : content (0 : R[X]) = 0 := by rw [← C_0, content_C, normalize_zero]
#align polynomial.content_zero Polynomial.content_zero
@[simp]
theorem content_one : content (1 : R[X]) = 1 := by rw [← C_1, content_C, normalize_one]
#align polynomial.content_one Polynomial.content_one
| Mathlib/RingTheory/Polynomial/Content.lean | 109 | 129 | theorem content_X_mul {p : R[X]} : content (X * p) = content p := by |
rw [content, content, Finset.gcd_def, Finset.gcd_def]
refine congr rfl ?_
have h : (X * p).support = p.support.map ⟨Nat.succ, Nat.succ_injective⟩ := by
ext a
simp only [exists_prop, Finset.mem_map, Function.Embedding.coeFn_mk, Ne, mem_support_iff]
cases' a with a
· simp [coeff_X_mul_zero, Nat.succ_ne_zero]
rw [mul_comm, coeff_mul_X]
constructor
· intro h
use a
· rintro ⟨b, ⟨h1, h2⟩⟩
rw [← Nat.succ_injective h2]
apply h1
rw [h]
simp only [Finset.map_val, Function.comp_apply, Function.Embedding.coeFn_mk, Multiset.map_map]
refine congr (congr rfl ?_) rfl
ext a
rw [mul_comm]
simp [coeff_mul_X]
| 20 |
import Mathlib.Topology.Bases
import Mathlib.Order.Filter.CountableInter
import Mathlib.Topology.Compactness.SigmaCompact
open Set Filter Topology TopologicalSpace
universe u v
variable {X : Type u} {Y : Type v} {ι : Type*}
variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X}
section Lindelof
def IsLindelof (s : Set X) :=
∀ ⦃f⦄ [NeBot f] [CountableInterFilter f], f ≤ 𝓟 s → ∃ x ∈ s, ClusterPt x f
theorem IsLindelof.compl_mem_sets (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f]
(hf : ∀ x ∈ s, sᶜ ∈ 𝓝 x ⊓ f) : sᶜ ∈ f := by
contrapose! hf
simp only [not_mem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf ⊢
exact hs inf_le_right
theorem IsLindelof.compl_mem_sets_of_nhdsWithin (hs : IsLindelof s) {f : Filter X}
[CountableInterFilter f] (hf : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, tᶜ ∈ f) : sᶜ ∈ f := by
refine hs.compl_mem_sets fun x hx ↦ ?_
rw [← disjoint_principal_right, disjoint_right_comm, (basis_sets _).disjoint_iff_left]
exact hf x hx
@[elab_as_elim]
theorem IsLindelof.induction_on (hs : IsLindelof s) {p : Set X → Prop}
(hmono : ∀ ⦃s t⦄, s ⊆ t → p t → p s)
(hcountable_union : ∀ (S : Set (Set X)), S.Countable → (∀ s ∈ S, p s) → p (⋃₀ S))
(hnhds : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, p t) : p s := by
let f : Filter X := ofCountableUnion p hcountable_union (fun t ht _ hsub ↦ hmono hsub ht)
have : sᶜ ∈ f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds)
rwa [← compl_compl s]
theorem IsLindelof.inter_right (hs : IsLindelof s) (ht : IsClosed t) : IsLindelof (s ∩ t) := by
intro f hnf _ hstf
rw [← inf_principal, le_inf_iff] at hstf
obtain ⟨x, hsx, hx⟩ : ∃ x ∈ s, ClusterPt x f := hs hstf.1
have hxt : x ∈ t := ht.mem_of_nhdsWithin_neBot <| hx.mono hstf.2
exact ⟨x, ⟨hsx, hxt⟩, hx⟩
theorem IsLindelof.inter_left (ht : IsLindelof t) (hs : IsClosed s) : IsLindelof (s ∩ t) :=
inter_comm t s ▸ ht.inter_right hs
theorem IsLindelof.diff (hs : IsLindelof s) (ht : IsOpen t) : IsLindelof (s \ t) :=
hs.inter_right (isClosed_compl_iff.mpr ht)
theorem IsLindelof.of_isClosed_subset (hs : IsLindelof s) (ht : IsClosed t) (h : t ⊆ s) :
IsLindelof t := inter_eq_self_of_subset_right h ▸ hs.inter_right ht
theorem IsLindelof.image_of_continuousOn {f : X → Y} (hs : IsLindelof s) (hf : ContinuousOn f s) :
IsLindelof (f '' s) := by
intro l lne _ ls
have : NeBot (l.comap f ⊓ 𝓟 s) :=
comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls)
obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, ClusterPt x (l.comap f ⊓ 𝓟 s) := @hs _ this _ inf_le_right
haveI := hx.neBot
use f x, mem_image_of_mem f hxs
have : Tendsto f (𝓝 x ⊓ (comap f l ⊓ 𝓟 s)) (𝓝 (f x) ⊓ l) := by
convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1
rw [nhdsWithin]
ac_rfl
exact this.neBot
theorem IsLindelof.image {f : X → Y} (hs : IsLindelof s) (hf : Continuous f) :
IsLindelof (f '' s) := hs.image_of_continuousOn hf.continuousOn
theorem IsLindelof.adherence_nhdset {f : Filter X} [CountableInterFilter f] (hs : IsLindelof s)
(hf₂ : f ≤ 𝓟 s) (ht₁ : IsOpen t) (ht₂ : ∀ x ∈ s, ClusterPt x f → x ∈ t) : t ∈ f :=
(eq_or_neBot _).casesOn mem_of_eq_bot fun _ ↦
let ⟨x, hx, hfx⟩ := @hs (f ⊓ 𝓟 tᶜ) _ _ <| inf_le_of_left_le hf₂
have : x ∈ t := ht₂ x hx hfx.of_inf_left
have : tᶜ ∩ t ∈ 𝓝[tᶜ] x := inter_mem_nhdsWithin _ (ht₁.mem_nhds this)
have A : 𝓝[tᶜ] x = ⊥ := empty_mem_iff_bot.1 <| compl_inter_self t ▸ this
have : 𝓝[tᶜ] x ≠ ⊥ := hfx.of_inf_right.ne
absurd A this
| Mathlib/Topology/Compactness/Lindelof.lean | 129 | 151 | theorem IsLindelof.elim_countable_subcover {ι : Type v} (hs : IsLindelof s) (U : ι → Set X)
(hUo : ∀ i, IsOpen (U i)) (hsU : s ⊆ ⋃ i, U i) :
∃ r : Set ι, r.Countable ∧ (s ⊆ ⋃ i ∈ r, U i) := by |
have hmono : ∀ ⦃s t : Set X⦄, s ⊆ t → (∃ r : Set ι, r.Countable ∧ t ⊆ ⋃ i ∈ r, U i)
→ (∃ r : Set ι, r.Countable ∧ s ⊆ ⋃ i ∈ r, U i) := by
intro _ _ hst ⟨r, ⟨hrcountable, hsub⟩⟩
exact ⟨r, hrcountable, Subset.trans hst hsub⟩
have hcountable_union : ∀ (S : Set (Set X)), S.Countable
→ (∀ s ∈ S, ∃ r : Set ι, r.Countable ∧ (s ⊆ ⋃ i ∈ r, U i))
→ ∃ r : Set ι, r.Countable ∧ (⋃₀ S ⊆ ⋃ i ∈ r, U i) := by
intro S hS hsr
choose! r hr using hsr
refine ⟨⋃ s ∈ S, r s, hS.biUnion_iff.mpr (fun s hs ↦ (hr s hs).1), ?_⟩
refine sUnion_subset ?h.right.h
simp only [mem_iUnion, exists_prop, iUnion_exists, biUnion_and']
exact fun i is x hx ↦ mem_biUnion is ((hr i is).2 hx)
have h_nhds : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, ∃ r : Set ι, r.Countable ∧ (t ⊆ ⋃ i ∈ r, U i) := by
intro x hx
let ⟨i, hi⟩ := mem_iUnion.1 (hsU hx)
refine ⟨U i, mem_nhdsWithin_of_mem_nhds ((hUo i).mem_nhds hi), {i}, by simp, ?_⟩
simp only [mem_singleton_iff, iUnion_iUnion_eq_left]
exact Subset.refl _
exact hs.induction_on hmono hcountable_union h_nhds
| 20 |
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.RingTheory.Ideal.LocalRing
import Mathlib.RingTheory.Valuation.PrimeMultiplicity
import Mathlib.RingTheory.AdicCompletion.Basic
#align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68"
open scoped Classical
universe u
open Ideal LocalRing
class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R]
extends IsPrincipalIdealRing R, LocalRing R : Prop where
not_a_field' : maximalIdeal R ≠ ⊥
#align discrete_valuation_ring DiscreteValuationRing
namespace DiscreteValuationRing
variable (R : Type*)
def HasUnitMulPowIrreducibleFactorization [CommRing R] : Prop :=
∃ p : R, Irreducible p ∧ ∀ {x : R}, x ≠ 0 → ∃ n : ℕ, Associated (p ^ n) x
#align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization
namespace HasUnitMulPowIrreducibleFactorization
variable {R} [CommRing R] (hR : HasUnitMulPowIrreducibleFactorization R)
| Mathlib/RingTheory/DiscreteValuationRing/Basic.lean | 169 | 190 | theorem unique_irreducible ⦃p q : R⦄ (hp : Irreducible p) (hq : Irreducible q) :
Associated p q := by |
rcases hR with ⟨ϖ, hϖ, hR⟩
suffices ∀ {p : R} (_ : Irreducible p), Associated p ϖ by
apply Associated.trans (this hp) (this hq).symm
clear hp hq p q
intro p hp
obtain ⟨n, hn⟩ := hR hp.ne_zero
have : Irreducible (ϖ ^ n) := hn.symm.irreducible hp
rcases lt_trichotomy n 1 with (H | rfl | H)
· obtain rfl : n = 0 := by
clear hn this
revert H n
decide
simp [not_irreducible_one, pow_zero] at this
· simpa only [pow_one] using hn.symm
· obtain ⟨n, rfl⟩ : ∃ k, n = 1 + k + 1 := Nat.exists_eq_add_of_lt H
rw [pow_succ'] at this
rcases this.isUnit_or_isUnit rfl with (H0 | H0)
· exact (hϖ.not_unit H0).elim
· rw [add_comm, pow_succ'] at H0
exact (hϖ.not_unit (isUnit_of_mul_isUnit_left H0)).elim
| 20 |
import Mathlib.Data.List.Duplicate
import Mathlib.Data.List.Sort
#align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace List
variable {α : Type*}
section Sublist
| Mathlib/Data/List/NodupEquivFin.lean | 116 | 137 | theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ)
(hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by |
induction' l with hd tl IH generalizing l' f
· simp
have : some hd = _ := hf 0
rw [eq_comm, List.get?_eq_some] at this
obtain ⟨w, h⟩ := this
let f' : ℕ ↪o ℕ :=
OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by
dsimp only
rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact b.succ_pos
have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by
intro ix
rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact ix.succ_pos
rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append]
apply List.Sublist.append _ (IH _ this)
rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)]
apply List.get_mem
| 20 |
import Mathlib.Analysis.NormedSpace.Real
import Mathlib.Analysis.Seminorm
import Mathlib.Topology.MetricSpace.HausdorffDistance
#align_import analysis.normed_space.riesz_lemma from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric
open Topology
variable {𝕜 : Type*} [NormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [SeminormedAddCommGroup F] [NormedSpace ℝ F]
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ}
(hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
classical
obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF
let d := Metric.infDist x F
have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩
have hdp : 0 < d :=
lt_of_le_of_ne Metric.infDist_nonneg fun heq =>
hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm)
let r' := max r 2⁻¹
have hr' : r' < 1 := by
simp only [r', ge_iff_le, max_lt_iff, hr, true_and]
norm_num
have hlt : 0 < r' := lt_of_lt_of_le (by norm_num) (le_max_right r 2⁻¹)
have hdlt : d < d / r' := (lt_div_iff hlt).mpr ((mul_lt_iff_lt_one_right hdp).2 hr')
obtain ⟨y₀, hy₀F, hxy₀⟩ : ∃ y ∈ F, dist x y < d / r' := (Metric.infDist_lt_iff hFn).mp hdlt
have x_ne_y₀ : x - y₀ ∉ F := by
by_contra h
have : x - y₀ + y₀ ∈ F := F.add_mem h hy₀F
simp only [neg_add_cancel_right, sub_eq_add_neg] at this
exact hx this
refine ⟨x - y₀, x_ne_y₀, fun y hy => le_of_lt ?_⟩
have hy₀y : y₀ + y ∈ F := F.add_mem hy₀F hy
calc
r * ‖x - y₀‖ ≤ r' * ‖x - y₀‖ := by gcongr; apply le_max_left
_ < d := by
rw [← dist_eq_norm]
exact (lt_div_iff' hlt).1 hxy₀
_ ≤ dist x (y₀ + y) := Metric.infDist_le_dist_of_mem hy₀y
_ = ‖x - y₀ - y‖ := by rw [sub_sub, dist_eq_norm]
#align riesz_lemma riesz_lemma
| Mathlib/Analysis/NormedSpace/RieszLemma.lean | 83 | 105 | theorem riesz_lemma_of_norm_lt {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R) {F : Subspace 𝕜 E}
(hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) :
∃ x₀ : E, ‖x₀‖ ≤ R ∧ ∀ y ∈ F, 1 ≤ ‖x₀ - y‖ := by |
have Rpos : 0 < R := (norm_nonneg _).trans_lt hR
have : ‖c‖ / R < 1 := by
rw [div_lt_iff Rpos]
simpa using hR
rcases riesz_lemma hFc hF this with ⟨x, xF, hx⟩
have x0 : x ≠ 0 := fun H => by simp [H] at xF
obtain ⟨d, d0, dxlt, ledx, -⟩ :
∃ d : 𝕜, d ≠ 0 ∧ ‖d • x‖ < R ∧ R / ‖c‖ ≤ ‖d • x‖ ∧ ‖d‖⁻¹ ≤ R⁻¹ * ‖c‖ * ‖x‖ :=
rescale_to_shell hc Rpos x0
refine ⟨d • x, dxlt.le, fun y hy => ?_⟩
set y' := d⁻¹ • y
have yy' : y = d • y' := by simp [y', smul_smul, mul_inv_cancel d0]
calc
1 = ‖c‖ / R * (R / ‖c‖) := by field_simp [Rpos.ne', (zero_lt_one.trans hc).ne']
_ ≤ ‖c‖ / R * ‖d • x‖ := by gcongr
_ = ‖d‖ * (‖c‖ / R * ‖x‖) := by
simp only [norm_smul]
ring
_ ≤ ‖d‖ * ‖x - y'‖ := by gcongr; exact hx y' (by simp [Submodule.smul_mem _ _ hy])
_ = ‖d • x - y‖ := by rw [yy', ← smul_sub, norm_smul]
| 20 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
#align_import analysis.special_functions.compare_exp from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Asymptotics Filter Function
open scoped Topology
namespace Complex
structure IsExpCmpFilter (l : Filter ℂ) : Prop where
tendsto_re : Tendsto re l atTop
isBigO_im_pow_re : ∀ n : ℕ, (fun z : ℂ => z.im ^ n) =O[l] fun z => Real.exp z.re
#align complex.is_exp_cmp_filter Complex.IsExpCmpFilter
namespace IsExpCmpFilter
variable {l : Filter ℂ}
theorem of_isBigO_im_re_rpow (hre : Tendsto re l atTop) (r : ℝ) (hr : im =O[l] fun z => z.re ^ r) :
IsExpCmpFilter l :=
⟨hre, fun n =>
IsLittleO.isBigO <|
calc
(fun z : ℂ => z.im ^ n) =O[l] fun z => (z.re ^ r) ^ n := hr.pow n
_ =ᶠ[l] fun z => z.re ^ (r * n) :=
((hre.eventually_ge_atTop 0).mono fun z hz => by
simp only [Real.rpow_mul hz r n, Real.rpow_natCast])
_ =o[l] fun z => Real.exp z.re := (isLittleO_rpow_exp_atTop _).comp_tendsto hre ⟩
set_option linter.uppercaseLean3 false in
#align complex.is_exp_cmp_filter.of_is_O_im_re_rpow Complex.IsExpCmpFilter.of_isBigO_im_re_rpow
theorem of_isBigO_im_re_pow (hre : Tendsto re l atTop) (n : ℕ) (hr : im =O[l] fun z => z.re ^ n) :
IsExpCmpFilter l :=
of_isBigO_im_re_rpow hre n <| mod_cast hr
set_option linter.uppercaseLean3 false in
#align complex.is_exp_cmp_filter.of_is_O_im_re_pow Complex.IsExpCmpFilter.of_isBigO_im_re_pow
theorem of_boundedUnder_abs_im (hre : Tendsto re l atTop)
(him : IsBoundedUnder (· ≤ ·) l fun z => |z.im|) : IsExpCmpFilter l :=
of_isBigO_im_re_pow hre 0 <| by
simpa only [pow_zero] using him.isBigO_const (f := im) one_ne_zero
#align complex.is_exp_cmp_filter.of_bounded_under_abs_im Complex.IsExpCmpFilter.of_boundedUnder_abs_im
theorem of_boundedUnder_im (hre : Tendsto re l atTop) (him_le : IsBoundedUnder (· ≤ ·) l im)
(him_ge : IsBoundedUnder (· ≥ ·) l im) : IsExpCmpFilter l :=
of_boundedUnder_abs_im hre <| isBoundedUnder_le_abs.2 ⟨him_le, him_ge⟩
#align complex.is_exp_cmp_filter.of_bounded_under_im Complex.IsExpCmpFilter.of_boundedUnder_im
theorem eventually_ne (hl : IsExpCmpFilter l) : ∀ᶠ w : ℂ in l, w ≠ 0 :=
hl.tendsto_re.eventually_ne_atTop' _
#align complex.is_exp_cmp_filter.eventually_ne Complex.IsExpCmpFilter.eventually_ne
theorem tendsto_abs_re (hl : IsExpCmpFilter l) : Tendsto (fun z : ℂ => |z.re|) l atTop :=
tendsto_abs_atTop_atTop.comp hl.tendsto_re
#align complex.is_exp_cmp_filter.tendsto_abs_re Complex.IsExpCmpFilter.tendsto_abs_re
theorem tendsto_abs (hl : IsExpCmpFilter l) : Tendsto abs l atTop :=
tendsto_atTop_mono abs_re_le_abs hl.tendsto_abs_re
#align complex.is_exp_cmp_filter.tendsto_abs Complex.IsExpCmpFilter.tendsto_abs
theorem isLittleO_log_re_re (hl : IsExpCmpFilter l) : (fun z => Real.log z.re) =o[l] re :=
Real.isLittleO_log_id_atTop.comp_tendsto hl.tendsto_re
#align complex.is_exp_cmp_filter.is_o_log_re_re Complex.IsExpCmpFilter.isLittleO_log_re_re
theorem isLittleO_im_pow_exp_re (hl : IsExpCmpFilter l) (n : ℕ) :
(fun z : ℂ => z.im ^ n) =o[l] fun z => Real.exp z.re :=
flip IsLittleO.of_pow two_ne_zero <|
calc
(fun z : ℂ ↦ (z.im ^ n) ^ 2) = (fun z ↦ z.im ^ (2 * n)) := by simp only [pow_mul']
_ =O[l] fun z ↦ Real.exp z.re := hl.isBigO_im_pow_re _
_ = fun z ↦ (Real.exp z.re) ^ 1 := by simp only [pow_one]
_ =o[l] fun z ↦ (Real.exp z.re) ^ 2 :=
(isLittleO_pow_pow_atTop_of_lt one_lt_two).comp_tendsto <|
Real.tendsto_exp_atTop.comp hl.tendsto_re
#align complex.is_exp_cmp_filter.is_o_im_pow_exp_re Complex.IsExpCmpFilter.isLittleO_im_pow_exp_re
theorem abs_im_pow_eventuallyLE_exp_re (hl : IsExpCmpFilter l) (n : ℕ) :
(fun z : ℂ => |z.im| ^ n) ≤ᶠ[l] fun z => Real.exp z.re := by
simpa using (hl.isLittleO_im_pow_exp_re n).bound zero_lt_one
#align complex.is_exp_cmp_filter.abs_im_pow_eventually_le_exp_re Complex.IsExpCmpFilter.abs_im_pow_eventuallyLE_exp_re
| Mathlib/Analysis/SpecialFunctions/CompareExp.lean | 127 | 151 | theorem isLittleO_log_abs_re (hl : IsExpCmpFilter l) : (fun z => Real.log (abs z)) =o[l] re :=
calc
(fun z => Real.log (abs z)) =O[l] fun z => Real.log (√2) + Real.log (max z.re |z.im|) :=
IsBigO.of_bound 1 <|
(hl.tendsto_re.eventually_ge_atTop 1).mono fun z hz => by
have h2 : 0 < √2 := by | simp
have hz' : 1 ≤ abs z := hz.trans (re_le_abs z)
have hm₀ : 0 < max z.re |z.im| := lt_max_iff.2 (Or.inl <| one_pos.trans_le hz)
rw [one_mul, Real.norm_eq_abs, _root_.abs_of_nonneg (Real.log_nonneg hz')]
refine le_trans ?_ (le_abs_self _)
rw [← Real.log_mul, Real.log_le_log_iff, ← _root_.abs_of_nonneg (le_trans zero_le_one hz)]
exacts [abs_le_sqrt_two_mul_max z, one_pos.trans_le hz', mul_pos h2 hm₀, h2.ne', hm₀.ne']
_ =o[l] re :=
IsLittleO.add (isLittleO_const_left.2 <| Or.inr <| hl.tendsto_abs_re) <|
isLittleO_iff_nat_mul_le.2 fun n => by
filter_upwards [isLittleO_iff_nat_mul_le'.1 hl.isLittleO_log_re_re n,
hl.abs_im_pow_eventuallyLE_exp_re n,
hl.tendsto_re.eventually_gt_atTop 1] with z hre him h₁
rcases le_total |z.im| z.re with hle | hle
· rwa [max_eq_left hle]
· have H : 1 < |z.im| := h₁.trans_le hle
norm_cast at *
rwa [max_eq_right hle, Real.norm_eq_abs, Real.norm_eq_abs, abs_of_pos (Real.log_pos H),
← Real.log_pow, Real.log_le_iff_le_exp (pow_pos (one_pos.trans H) _),
abs_of_pos (one_pos.trans h₁)]
| 20 |
import Mathlib.Algebra.Field.Subfield
import Mathlib.Topology.Algebra.Field
import Mathlib.Topology.Algebra.UniformRing
#align_import topology.algebra.uniform_field from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open uniformity Topology
open Set UniformSpace UniformSpace.Completion Filter
variable (K : Type*) [Field K] [UniformSpace K]
local notation "hat" => Completion
class CompletableTopField extends T0Space K : Prop where
nice : ∀ F : Filter K, Cauchy F → 𝓝 0 ⊓ F = ⊥ → Cauchy (map (fun x => x⁻¹) F)
#align completable_top_field CompletableTopField
namespace UniformSpace
namespace Completion
instance (priority := 100) [T0Space K] : Nontrivial (hat K) :=
⟨⟨0, 1, fun h => zero_ne_one <| (uniformEmbedding_coe K).inj h⟩⟩
variable {K}
def hatInv : hat K → hat K :=
denseInducing_coe.extend fun x : K => (↑x⁻¹ : hat K)
#align uniform_space.completion.hat_inv UniformSpace.Completion.hatInv
| Mathlib/Topology/Algebra/UniformField.lean | 72 | 93 | theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
ContinuousAt hatInv x := by |
refine denseInducing_coe.continuousAt_extend ?_
apply mem_of_superset (compl_singleton_mem_nhds h)
intro y y_ne
rw [mem_compl_singleton_iff] at y_ne
apply CompleteSpace.complete
have : (fun (x : K) => (↑x⁻¹: hat K)) =
((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
unfold Function.comp
simp
rw [this, ← Filter.map_map]
apply Cauchy.map _ (Completion.uniformContinuous_coe K)
apply CompletableTopField.nice
· haveI := denseInducing_coe.comap_nhds_neBot y
apply cauchy_nhds.comap
rw [Completion.comap_coe_eq_uniformity]
· have eq_bot : 𝓝 (0 : hat K) ⊓ 𝓝 y = ⊥ := by
by_contra h
exact y_ne (eq_of_nhds_neBot <| neBot_iff.mpr h).symm
erw [denseInducing_coe.nhds_eq_comap (0 : K), ← Filter.comap_inf, eq_bot]
exact comap_bot
| 20 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Monic
#align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
open Polynomial
noncomputable section
namespace Polynomial
universe u v w
section Semiring
variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S}
def lifts (f : R →+* S) : Subsemiring S[X] :=
RingHom.rangeS (mapRingHom f)
#align polynomial.lifts Polynomial.lifts
theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by
simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS]
#align polynomial.mem_lifts Polynomial.mem_lifts
theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by
simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS]
#align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range
theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by
simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS]
#align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS
theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by
rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f]
rfl
#align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts
theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f :=
⟨C r, by
simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true,
and_self_iff]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.C_mem_lifts Polynomial.C_mem_lifts
theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by
obtain ⟨r, rfl⟩ := Set.mem_range.1 h
use C r
simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true,
and_self_iff]
set_option linter.uppercaseLean3 false in
#align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts
theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f :=
⟨X, by
simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X,
and_self_iff]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.X_mem_lifts Polynomial.X_mem_lifts
theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f :=
⟨X ^ n, by
simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true,
map_X, and_self_iff]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts
theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by
simp only [lifts, RingHom.mem_rangeS] at hp ⊢
obtain ⟨p₁, rfl⟩ := hp
use C r * p₁
simp only [coe_mapRingHom, map_C, map_mul]
#align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts
theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by
obtain ⟨r, rfl⟩ := Set.mem_range.1 h
use monomial n r
simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true,
and_self_iff]
#align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts
theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by
rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢
intro k
by_cases hk : k = n
· use 0
simp only [hk, RingHom.map_zero, erase_same]
obtain ⟨i, hi⟩ := h k
use i
simp only [hi, hk, erase_ne, Ne, not_false_iff]
#align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts
section LiftDeg
| Mathlib/Algebra/Polynomial/Lifts.lean | 141 | 162 | theorem monomial_mem_lifts_and_degree_eq {s : S} {n : ℕ} (hl : monomial n s ∈ lifts f) :
∃ q : R[X], map f q = monomial n s ∧ q.degree = (monomial n s).degree := by |
by_cases hzero : s = 0
· use 0
simp only [hzero, degree_zero, eq_self_iff_true, and_self_iff, monomial_zero_right,
Polynomial.map_zero]
rw [lifts_iff_set_range] at hl
obtain ⟨q, hq⟩ := hl
replace hq := (ext_iff.1 hq) n
have hcoeff : f (q.coeff n) = s := by
simp? [coeff_monomial] at hq says simp only [coeff_map, coeff_monomial, ↓reduceIte] at hq
exact hq
use monomial n (q.coeff n)
constructor
· simp only [hcoeff, map_monomial]
have hqzero : q.coeff n ≠ 0 := by
intro habs
simp only [habs, RingHom.map_zero] at hcoeff
exact hzero hcoeff.symm
rw [← C_mul_X_pow_eq_monomial]
rw [← C_mul_X_pow_eq_monomial]
simp only [hzero, hqzero, Ne, not_false_iff, degree_C_mul_X_pow]
| 20 |
import Mathlib.Order.Atoms
import Mathlib.Order.OrderIsoNat
import Mathlib.Order.RelIso.Set
import Mathlib.Order.SupClosed
import Mathlib.Order.SupIndep
import Mathlib.Order.Zorn
import Mathlib.Data.Finset.Order
import Mathlib.Order.Interval.Set.OrderIso
import Mathlib.Data.Finite.Set
import Mathlib.Tactic.TFAE
#align_import order.compactly_generated from "leanprover-community/mathlib"@"c813ed7de0f5115f956239124e9b30f3a621966f"
open Set
variable {ι : Sort*} {α : Type*} [CompleteLattice α] {f : ι → α}
namespace CompleteLattice
variable (α)
def IsSupClosedCompact : Prop :=
∀ (s : Set α) (_ : s.Nonempty), SupClosed s → sSup s ∈ s
#align complete_lattice.is_sup_closed_compact CompleteLattice.IsSupClosedCompact
def IsSupFiniteCompact : Prop :=
∀ s : Set α, ∃ t : Finset α, ↑t ⊆ s ∧ sSup s = t.sup id
#align complete_lattice.is_Sup_finite_compact CompleteLattice.IsSupFiniteCompact
def IsCompactElement {α : Type*} [CompleteLattice α] (k : α) :=
∀ s : Set α, k ≤ sSup s → ∃ t : Finset α, ↑t ⊆ s ∧ k ≤ t.sup id
#align complete_lattice.is_compact_element CompleteLattice.IsCompactElement
| Mathlib/Order/CompactlyGenerated/Basic.lean | 83 | 105 | theorem isCompactElement_iff.{u} {α : Type u} [CompleteLattice α] (k : α) :
CompleteLattice.IsCompactElement k ↔
∀ (ι : Type u) (s : ι → α), k ≤ iSup s → ∃ t : Finset ι, k ≤ t.sup s := by |
classical
constructor
· intro H ι s hs
obtain ⟨t, ht, ht'⟩ := H (Set.range s) hs
have : ∀ x : t, ∃ i, s i = x := fun x => ht x.prop
choose f hf using this
refine ⟨Finset.univ.image f, ht'.trans ?_⟩
rw [Finset.sup_le_iff]
intro b hb
rw [← show s (f ⟨b, hb⟩) = id b from hf _]
exact Finset.le_sup (Finset.mem_image_of_mem f <| Finset.mem_univ (Subtype.mk b hb))
· intro H s hs
obtain ⟨t, ht⟩ :=
H s Subtype.val
(by
delta iSup
rwa [Subtype.range_coe])
refine ⟨t.image Subtype.val, by simp, ht.trans ?_⟩
rw [Finset.sup_le_iff]
exact fun x hx => @Finset.le_sup _ _ _ _ _ id _ (Finset.mem_image_of_mem Subtype.val hx)
| 20 |
import Mathlib.MeasureTheory.Integral.Lebesgue
#align_import measure_theory.measure.giry_monad from "leanprover-community/mathlib"@"56f4cd1ef396e9fd389b5d8371ee9ad91d163625"
noncomputable section
open scoped Classical
open ENNReal
open scoped Classical
open Set Filter
variable {α β : Type*}
namespace MeasureTheory
namespace Measure
variable [MeasurableSpace α] [MeasurableSpace β]
instance instMeasurableSpace : MeasurableSpace (Measure α) :=
⨆ (s : Set α) (_ : MeasurableSet s), (borel ℝ≥0∞).comap fun μ => μ s
#align measure_theory.measure.measurable_space MeasureTheory.Measure.instMeasurableSpace
theorem measurable_coe {s : Set α} (hs : MeasurableSet s) : Measurable fun μ : Measure α => μ s :=
Measurable.of_comap_le <| le_iSup_of_le s <| le_iSup_of_le hs <| le_rfl
#align measure_theory.measure.measurable_coe MeasureTheory.Measure.measurable_coe
theorem measurable_of_measurable_coe (f : β → Measure α)
(h : ∀ (s : Set α), MeasurableSet s → Measurable fun b => f b s) : Measurable f :=
Measurable.of_le_map <|
iSup₂_le fun s hs =>
MeasurableSpace.comap_le_iff_le_map.2 <| by rw [MeasurableSpace.map_comp]; exact h s hs
#align measure_theory.measure.measurable_of_measurable_coe MeasureTheory.Measure.measurable_of_measurable_coe
instance instMeasurableAdd₂ {α : Type*} {m : MeasurableSpace α} : MeasurableAdd₂ (Measure α) := by
refine ⟨Measure.measurable_of_measurable_coe _ fun s hs => ?_⟩
simp_rw [Measure.coe_add, Pi.add_apply]
refine Measurable.add ?_ ?_
· exact (Measure.measurable_coe hs).comp measurable_fst
· exact (Measure.measurable_coe hs).comp measurable_snd
#align measure_theory.measure.has_measurable_add₂ MeasureTheory.Measure.instMeasurableAdd₂
theorem measurable_measure {μ : α → Measure β} :
Measurable μ ↔ ∀ (s : Set β), MeasurableSet s → Measurable fun b => μ b s :=
⟨fun hμ _s hs => (measurable_coe hs).comp hμ, measurable_of_measurable_coe μ⟩
#align measure_theory.measure.measurable_measure MeasureTheory.Measure.measurable_measure
theorem measurable_map (f : α → β) (hf : Measurable f) :
Measurable fun μ : Measure α => map f μ := by
refine measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [map_apply hf hs]
exact measurable_coe (hf hs)
#align measure_theory.measure.measurable_map MeasureTheory.Measure.measurable_map
theorem measurable_dirac : Measurable (Measure.dirac : α → Measure α) := by
refine measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [dirac_apply' _ hs]
exact measurable_one.indicator hs
#align measure_theory.measure.measurable_dirac MeasureTheory.Measure.measurable_dirac
theorem measurable_lintegral {f : α → ℝ≥0∞} (hf : Measurable f) :
Measurable fun μ : Measure α => ∫⁻ x, f x ∂μ := by
simp only [lintegral_eq_iSup_eapprox_lintegral, hf, SimpleFunc.lintegral]
refine measurable_iSup fun n => Finset.measurable_sum _ fun i _ => ?_
refine Measurable.const_mul ?_ _
exact measurable_coe ((SimpleFunc.eapprox f n).measurableSet_preimage _)
#align measure_theory.measure.measurable_lintegral MeasureTheory.Measure.measurable_lintegral
def join (m : Measure (Measure α)) : Measure α :=
Measure.ofMeasurable (fun s _ => ∫⁻ μ, μ s ∂m)
(by simp only [measure_empty, lintegral_const, zero_mul])
(by
intro f hf h
simp_rw [measure_iUnion h hf]
apply lintegral_tsum
intro i; exact (measurable_coe (hf i)).aemeasurable)
#align measure_theory.measure.join MeasureTheory.Measure.join
@[simp]
theorem join_apply {m : Measure (Measure α)} {s : Set α} (hs : MeasurableSet s) :
join m s = ∫⁻ μ, μ s ∂m :=
Measure.ofMeasurable_apply s hs
#align measure_theory.measure.join_apply MeasureTheory.Measure.join_apply
@[simp]
theorem join_zero : (0 : Measure (Measure α)).join = 0 := by
ext1 s hs
simp only [hs, join_apply, lintegral_zero_measure, coe_zero, Pi.zero_apply]
#align measure_theory.measure.join_zero MeasureTheory.Measure.join_zero
theorem measurable_join : Measurable (join : Measure (Measure α) → Measure α) :=
measurable_of_measurable_coe _ fun s hs => by
simp only [join_apply hs]; exact measurable_lintegral (measurable_coe hs)
#align measure_theory.measure.measurable_join MeasureTheory.Measure.measurable_join
| Mathlib/MeasureTheory/Measure/GiryMonad.lean | 128 | 149 | theorem lintegral_join {m : Measure (Measure α)} {f : α → ℝ≥0∞} (hf : Measurable f) :
∫⁻ x, f x ∂join m = ∫⁻ μ, ∫⁻ x, f x ∂μ ∂m := by |
simp_rw [lintegral_eq_iSup_eapprox_lintegral hf, SimpleFunc.lintegral,
join_apply (SimpleFunc.measurableSet_preimage _ _)]
suffices
∀ (s : ℕ → Finset ℝ≥0∞) (f : ℕ → ℝ≥0∞ → Measure α → ℝ≥0∞), (∀ n r, Measurable (f n r)) →
Monotone (fun n μ => ∑ r ∈ s n, r * f n r μ) →
⨆ n, ∑ r ∈ s n, r * ∫⁻ μ, f n r μ ∂m = ∫⁻ μ, ⨆ n, ∑ r ∈ s n, r * f n r μ ∂m by
refine
this (fun n => SimpleFunc.range (SimpleFunc.eapprox f n))
(fun n r μ => μ (SimpleFunc.eapprox f n ⁻¹' {r})) ?_ ?_
· exact fun n r => measurable_coe (SimpleFunc.measurableSet_preimage _ _)
· exact fun n m h μ => SimpleFunc.lintegral_mono (SimpleFunc.monotone_eapprox _ h) le_rfl
intro s f hf hm
rw [lintegral_iSup _ hm]
swap
· exact fun n => Finset.measurable_sum _ fun r _ => (hf _ _).const_mul _
congr
funext n
rw [lintegral_finset_sum (s n)]
· simp_rw [lintegral_const_mul _ (hf _ _)]
· exact fun r _ => (hf _ _).const_mul _
| 20 |
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.MeasureTheory.Integral.Layercake
#align_import measure_theory.integral.layercake from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b"
open Set
namespace MeasureTheory
variable {α : Type*} [MeasurableSpace α] {f : α → ℝ} (μ : Measure α) (f_nn : 0 ≤ᵐ[μ] f)
(f_mble : AEMeasurable f μ) {p : ℝ} (p_pos : 0 < p)
section Layercake
| Mathlib/Analysis/SpecialFunctions/Pow/Integral.lean | 50 | 72 | theorem lintegral_rpow_eq_lintegral_meas_le_mul :
∫⁻ ω, ENNReal.ofReal (f ω ^ p) ∂μ =
ENNReal.ofReal p * ∫⁻ t in Ioi 0, μ {a : α | t ≤ f a} * ENNReal.ofReal (t ^ (p - 1)) := by |
have one_lt_p : -1 < p - 1 := by linarith
have obs : ∀ x : ℝ, ∫ t : ℝ in (0)..x, t ^ (p - 1) = x ^ p / p := by
intro x
rw [integral_rpow (Or.inl one_lt_p)]
simp [Real.zero_rpow p_pos.ne.symm]
set g := fun t : ℝ => t ^ (p - 1)
have g_nn : ∀ᵐ t ∂volume.restrict (Ioi (0 : ℝ)), 0 ≤ g t := by
filter_upwards [self_mem_ae_restrict (measurableSet_Ioi : MeasurableSet (Ioi (0 : ℝ)))]
intro t t_pos
exact Real.rpow_nonneg (mem_Ioi.mp t_pos).le (p - 1)
have g_intble : ∀ t > 0, IntervalIntegrable g volume 0 t := fun _ _ =>
intervalIntegral.intervalIntegrable_rpow' one_lt_p
have key := lintegral_comp_eq_lintegral_meas_le_mul μ f_nn f_mble g_intble g_nn
rw [← key, ← lintegral_const_mul'' (ENNReal.ofReal p)] <;> simp_rw [obs]
· congr with ω
rw [← ENNReal.ofReal_mul p_pos.le, mul_div_cancel₀ (f ω ^ p) p_pos.ne.symm]
· have aux := (@measurable_const ℝ α (by infer_instance) (by infer_instance) p).aemeasurable
(μ := μ)
exact (Measurable.ennreal_ofReal (hf := measurable_id)).comp_aemeasurable
((f_mble.pow aux).div_const p)
| 20 |
import Mathlib.Topology.Algebra.Valuation
import Mathlib.Topology.Algebra.WithZeroTopology
import Mathlib.Topology.Algebra.UniformField
#align_import topology.algebra.valued_field from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064"
open Filter Set
open Topology
section DivisionRing
variable {K : Type*} [DivisionRing K] {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀]
section ValuationTopologicalDivisionRing
section InversionEstimate
variable (v : Valuation K Γ₀)
-- The following is the main technical lemma ensuring that inversion is continuous
-- in the topology induced by a valuation on a division ring (i.e. the next instance)
-- and the fact that a valued field is completable
-- [BouAC, VI.5.1 Lemme 1]
| Mathlib/Topology/Algebra/ValuedField.lean | 51 | 72 | theorem Valuation.inversion_estimate {x y : K} {γ : Γ₀ˣ} (y_ne : y ≠ 0)
(h : v (x - y) < min (γ * (v y * v y)) (v y)) : v (x⁻¹ - y⁻¹) < γ := by |
have hyp1 : v (x - y) < γ * (v y * v y) := lt_of_lt_of_le h (min_le_left _ _)
have hyp1' : v (x - y) * (v y * v y)⁻¹ < γ := mul_inv_lt_of_lt_mul₀ hyp1
have hyp2 : v (x - y) < v y := lt_of_lt_of_le h (min_le_right _ _)
have key : v x = v y := Valuation.map_eq_of_sub_lt v hyp2
have x_ne : x ≠ 0 := by
intro h
apply y_ne
rw [h, v.map_zero] at key
exact v.zero_iff.1 key.symm
have decomp : x⁻¹ - y⁻¹ = x⁻¹ * (y - x) * y⁻¹ := by
rw [mul_sub_left_distrib, sub_mul, mul_assoc, show y * y⁻¹ = 1 from mul_inv_cancel y_ne,
show x⁻¹ * x = 1 from inv_mul_cancel x_ne, mul_one, one_mul]
calc
v (x⁻¹ - y⁻¹) = v (x⁻¹ * (y - x) * y⁻¹) := by rw [decomp]
_ = v x⁻¹ * (v <| y - x) * v y⁻¹ := by repeat' rw [Valuation.map_mul]
_ = (v x)⁻¹ * (v <| y - x) * (v y)⁻¹ := by rw [map_inv₀, map_inv₀]
_ = (v <| y - x) * (v y * v y)⁻¹ := by rw [mul_assoc, mul_comm, key, mul_assoc, mul_inv_rev]
_ = (v <| y - x) * (v y * v y)⁻¹ := rfl
_ = (v <| x - y) * (v y * v y)⁻¹ := by rw [Valuation.map_sub_swap]
_ < γ := hyp1'
| 20 |
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Set.Finite
#align_import combinatorics.hall.finite from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
open Finset
universe u v
namespace HallMarriageTheorem
variable {ι : Type u} {α : Type v} [DecidableEq α] {t : ι → Finset α}
section Fintype
variable [Fintype ι]
theorem hall_cond_of_erase {x : ι} (a : α)
(ha : ∀ s : Finset ι, s.Nonempty → s ≠ univ → s.card < (s.biUnion t).card)
(s' : Finset { x' : ι | x' ≠ x }) : s'.card ≤ (s'.biUnion fun x' => (t x').erase a).card := by
haveI := Classical.decEq ι
specialize ha (s'.image fun z => z.1)
rw [image_nonempty, Finset.card_image_of_injective s' Subtype.coe_injective] at ha
by_cases he : s'.Nonempty
· have ha' : s'.card < (s'.biUnion fun x => t x).card := by
convert ha he fun h => by simpa [← h] using mem_univ x using 2
ext x
simp only [mem_image, mem_biUnion, exists_prop, SetCoe.exists, exists_and_right,
exists_eq_right, Subtype.coe_mk]
rw [← erase_biUnion]
by_cases hb : a ∈ s'.biUnion fun x => t x
· rw [card_erase_of_mem hb]
exact Nat.le_sub_one_of_lt ha'
· rw [erase_eq_of_not_mem hb]
exact Nat.le_of_lt ha'
· rw [nonempty_iff_ne_empty, not_not] at he
subst s'
simp
#align hall_marriage_theorem.hall_cond_of_erase HallMarriageTheorem.hall_cond_of_erase
theorem hall_hard_inductive_step_A {n : ℕ} (hn : Fintype.card ι = n + 1)
(ht : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card)
(ih :
∀ {ι' : Type u} [Fintype ι'] (t' : ι' → Finset α),
Fintype.card ι' ≤ n →
(∀ s' : Finset ι', s'.card ≤ (s'.biUnion t').card) →
∃ f : ι' → α, Function.Injective f ∧ ∀ x, f x ∈ t' x)
(ha : ∀ s : Finset ι, s.Nonempty → s ≠ univ → s.card < (s.biUnion t).card) :
∃ f : ι → α, Function.Injective f ∧ ∀ x, f x ∈ t x := by
haveI : Nonempty ι := Fintype.card_pos_iff.mp (hn.symm ▸ Nat.succ_pos _)
haveI := Classical.decEq ι
-- Choose an arbitrary element `x : ι` and `y : t x`.
let x := Classical.arbitrary ι
have tx_ne : (t x).Nonempty := by
rw [← Finset.card_pos]
calc
0 < 1 := Nat.one_pos
_ ≤ (Finset.biUnion {x} t).card := ht {x}
_ = (t x).card := by rw [Finset.singleton_biUnion]
choose y hy using tx_ne
-- Restrict to everything except `x` and `y`.
let ι' := { x' : ι | x' ≠ x }
let t' : ι' → Finset α := fun x' => (t x').erase y
have card_ι' : Fintype.card ι' = n :=
calc
Fintype.card ι' = Fintype.card ι - 1 := Set.card_ne_eq _
_ = n := by rw [hn, Nat.add_succ_sub_one, add_zero]
rcases ih t' card_ι'.le (hall_cond_of_erase y ha) with ⟨f', hfinj, hfr⟩
-- Extend the resulting function.
refine ⟨fun z => if h : z = x then y else f' ⟨z, h⟩, ?_, ?_⟩
· rintro z₁ z₂
have key : ∀ {x}, y ≠ f' x := by
intro x h
simpa [t', ← h] using hfr x
by_cases h₁ : z₁ = x <;> by_cases h₂ : z₂ = x <;> simp [h₁, h₂, hfinj.eq_iff, key, key.symm]
· intro z
simp only [ne_eq, Set.mem_setOf_eq]
split_ifs with hz
· rwa [hz]
· specialize hfr ⟨z, hz⟩
rw [mem_erase] at hfr
exact hfr.2
set_option linter.uppercaseLean3 false in
#align hall_marriage_theorem.hall_hard_inductive_step_A HallMarriageTheorem.hall_hard_inductive_step_A
theorem hall_cond_of_restrict {ι : Type u} {t : ι → Finset α} {s : Finset ι}
(ht : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (s' : Finset (s : Set ι)) :
s'.card ≤ (s'.biUnion fun a' => t a').card := by
classical
rw [← card_image_of_injective s' Subtype.coe_injective]
convert ht (s'.image fun z => z.1) using 1
apply congr_arg
ext y
simp
#align hall_marriage_theorem.hall_cond_of_restrict HallMarriageTheorem.hall_cond_of_restrict
| Mathlib/Combinatorics/Hall/Finite.lean | 136 | 158 | theorem hall_cond_of_compl {ι : Type u} {t : ι → Finset α} {s : Finset ι}
(hus : s.card = (s.biUnion t).card) (ht : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card)
(s' : Finset (sᶜ : Set ι)) : s'.card ≤ (s'.biUnion fun x' => t x' \ s.biUnion t).card := by |
haveI := Classical.decEq ι
have disj : Disjoint s (s'.image fun z => z.1) := by
simp only [disjoint_left, not_exists, mem_image, exists_prop, SetCoe.exists, exists_and_right,
exists_eq_right, Subtype.coe_mk]
intro x hx hc _
exact absurd hx hc
have : s'.card = (s ∪ s'.image fun z => z.1).card - s.card := by
simp [disj, card_image_of_injective _ Subtype.coe_injective, Nat.add_sub_cancel_left]
rw [this, hus]
refine (Nat.sub_le_sub_right (ht _) _).trans ?_
rw [← card_sdiff]
· refine (card_le_card ?_).trans le_rfl
intro t
simp only [mem_biUnion, mem_sdiff, not_exists, mem_image, and_imp, mem_union, exists_and_right,
exists_imp]
rintro x (hx | ⟨x', hx', rfl⟩) rat hs
· exact False.elim <| (hs x) <| And.intro hx rat
· use x', hx', rat, hs
· apply biUnion_subset_biUnion_of_subset_left
apply subset_union_left
| 20 |
import Mathlib.Data.Stream.Init
import Mathlib.Tactic.ApplyFun
import Mathlib.Control.Fix
import Mathlib.Order.OmegaCompletePartialOrder
#align_import control.lawful_fix from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
universe u v
open scoped Classical
variable {α : Type*} {β : α → Type*}
open OmegaCompletePartialOrder
class LawfulFix (α : Type*) [OmegaCompletePartialOrder α] extends Fix α where
fix_eq : ∀ {f : α →o α}, Continuous f → Fix.fix f = f (Fix.fix f)
#align lawful_fix LawfulFix
theorem LawfulFix.fix_eq' {α} [OmegaCompletePartialOrder α] [LawfulFix α] {f : α → α}
(hf : Continuous' f) : Fix.fix f = f (Fix.fix f) :=
LawfulFix.fix_eq (hf.to_bundled _)
#align lawful_fix.fix_eq' LawfulFix.fix_eq'
namespace Part
open Part Nat Nat.Upto
namespace Fix
variable (f : ((a : _) → Part <| β a) →o (a : _) → Part <| β a)
theorem approx_mono' {i : ℕ} : Fix.approx f i ≤ Fix.approx f (succ i) := by
induction i with
| zero => dsimp [approx]; apply @bot_le _ _ _ (f ⊥)
| succ _ i_ih => intro; apply f.monotone; apply i_ih
#align part.fix.approx_mono' Part.Fix.approx_mono'
theorem approx_mono ⦃i j : ℕ⦄ (hij : i ≤ j) : approx f i ≤ approx f j := by
induction' j with j ih
· cases hij
exact le_rfl
cases hij; · exact le_rfl
exact le_trans (ih ‹_›) (approx_mono' f)
#align part.fix.approx_mono Part.Fix.approx_mono
| Mathlib/Control/LawfulFix.lean | 71 | 91 | theorem mem_iff (a : α) (b : β a) : b ∈ Part.fix f a ↔ ∃ i, b ∈ approx f i a := by |
by_cases h₀ : ∃ i : ℕ, (approx f i a).Dom
· simp only [Part.fix_def f h₀]
constructor <;> intro hh
· exact ⟨_, hh⟩
have h₁ := Nat.find_spec h₀
rw [dom_iff_mem] at h₁
cases' h₁ with y h₁
replace h₁ := approx_mono' f _ _ h₁
suffices y = b by
subst this
exact h₁
cases' hh with i hh
revert h₁; generalize succ (Nat.find h₀) = j; intro h₁
wlog case : i ≤ j
· rcases le_total i j with H | H <;> [skip; symm] <;> apply_assumption <;> assumption
replace hh := approx_mono f case _ _ hh
apply Part.mem_unique h₁ hh
· simp only [fix_def' (⇑f) h₀, not_exists, false_iff_iff, not_mem_none]
simp only [dom_iff_mem, not_exists] at h₀
intro; apply h₀
| 20 |
import Mathlib.RingTheory.DedekindDomain.Dvr
import Mathlib.RingTheory.DedekindDomain.Ideal
#align_import ring_theory.dedekind_domain.pid from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940"
variable {R : Type*} [CommRing R]
open Ideal
open UniqueFactorizationMonoid
open scoped nonZeroDivisors
open UniqueFactorizationMonoid
theorem Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne {P : Ideal R}
(hP : P.IsPrime) [IsDedekindDomain R] {x : R} (x_mem : x ∈ P) (hxP2 : x ∉ P ^ 2)
(hxQ : ∀ Q : Ideal R, IsPrime Q → Q ≠ P → x ∉ Q) : P = Ideal.span {x} := by
letI := Classical.decEq (Ideal R)
have hx0 : x ≠ 0 := by
rintro rfl
exact hxP2 (zero_mem _)
by_cases hP0 : P = ⊥
· subst hP0
-- Porting note: was `simpa using hxP2` but that hypothesis didn't even seem relevant in Lean 3
rwa [eq_comm, span_singleton_eq_bot, ← mem_bot]
have hspan0 : span ({x} : Set R) ≠ ⊥ := mt Ideal.span_singleton_eq_bot.mp hx0
have span_le := (Ideal.span_singleton_le_iff_mem _).mpr x_mem
refine
associated_iff_eq.mp
((associated_iff_normalizedFactors_eq_normalizedFactors hP0 hspan0).mpr
(le_antisymm ((dvd_iff_normalizedFactors_le_normalizedFactors hP0 hspan0).mp ?_) ?_))
· rwa [Ideal.dvd_iff_le, Ideal.span_singleton_le_iff_mem]
simp only [normalizedFactors_irreducible (Ideal.prime_of_isPrime hP0 hP).irreducible,
normalize_eq, Multiset.le_iff_count, Multiset.count_singleton]
intro Q
split_ifs with hQ
· subst hQ
refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;>
simp only [Ideal.span_singleton_le_iff_mem, pow_one] <;>
assumption
by_cases hQp : IsPrime Q
· refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;>
-- Porting note: included `zero_add` in the simp arguments
simp only [Ideal.span_singleton_le_iff_mem, zero_add, pow_one, pow_zero, one_eq_top,
Submodule.mem_top]
exact hxQ _ hQp hQ
· exact
(Multiset.count_eq_zero.mpr fun hQi =>
hQp
(isPrime_of_prime
(irreducible_iff_prime.mp (irreducible_of_normalized_factor _ hQi)))).le
#align ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne
-- Porting note: replaced three implicit coercions of `I` with explicit `(I : Submodule R A)`
| Mathlib/RingTheory/DedekindDomain/PID.lean | 78 | 102 | theorem FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top {R A : Type*}
[CommRing R] [CommRing A] [Algebra R A] {S : Submonoid R} [IsLocalization S A]
(I : (FractionalIdeal S A)ˣ) {v : A} (hv : v ∈ (↑I⁻¹ : FractionalIdeal S A))
(h : Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v}) = ⊤) :
Submodule.IsPrincipal (I : Submodule R A) := by |
have hinv := I.mul_inv
set J := Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v})
have hJ : IsLocalization.coeSubmodule A J = ↑I * Submodule.span R {v} := by
-- Porting note: had to insert `val_eq_coe` into this rewrite.
-- Arguably this is because `Subtype.ext_iff` is breaking the `FractionalIdeal` API.
rw [Subtype.ext_iff, val_eq_coe, coe_mul, val_eq_coe, coe_one] at hinv
apply Submodule.map_comap_eq_self
rw [← Submodule.one_eq_range, ← hinv]
exact Submodule.mul_le_mul_right ((Submodule.span_singleton_le_iff_mem _ _).2 hv)
have : (1 : A) ∈ ↑I * Submodule.span R {v} := by
rw [← hJ, h, IsLocalization.coeSubmodule_top, Submodule.mem_one]
exact ⟨1, (algebraMap R _).map_one⟩
obtain ⟨w, hw, hvw⟩ := Submodule.mem_mul_span_singleton.1 this
refine ⟨⟨w, ?_⟩⟩
rw [← FractionalIdeal.coe_spanSingleton S, ← inv_inv I, eq_comm]
refine congr_arg coeToSubmodule (Units.eq_inv_of_mul_eq_one_left (le_antisymm ?_ ?_))
· conv_rhs => rw [← hinv, mul_comm]
apply FractionalIdeal.mul_le_mul_left (FractionalIdeal.spanSingleton_le_iff_mem.mpr hw)
· rw [FractionalIdeal.one_le, ← hvw, mul_comm]
exact FractionalIdeal.mul_mem_mul hv (FractionalIdeal.mem_spanSingleton_self _ _)
| 20 |
import Mathlib.RingTheory.FractionalIdeal.Basic
import Mathlib.RingTheory.Ideal.Norm
namespace FractionalIdeal
open scoped Pointwise nonZeroDivisors
variable {R : Type*} [CommRing R] [IsDedekindDomain R] [Module.Free ℤ R] [Module.Finite ℤ R]
variable {K : Type*} [CommRing K] [Algebra R K] [IsFractionRing R K]
theorem absNorm_div_norm_eq_absNorm_div_norm {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R)
(h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) :
(Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den:R)| =
(Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by
rw [div_eq_div_iff]
· replace h := congr_arg (I.den • ·) h
have h' := congr_arg (a • ·) (den_mul_self_eq_num I)
dsimp only at h h'
rw [smul_comm] at h
rw [h, Submonoid.smul_def, Submonoid.smul_def, ← Submodule.ideal_span_singleton_smul,
← Submodule.ideal_span_singleton_smul, ← Submodule.map_smul'', ← Submodule.map_smul'',
(LinearMap.map_injective ?_).eq_iff, smul_eq_mul, smul_eq_mul] at h'
· simp_rw [← Int.cast_natAbs, ← Nat.cast_mul, ← Ideal.absNorm_span_singleton]
rw [← _root_.map_mul, ← _root_.map_mul, mul_comm, ← h', mul_comm]
· exact LinearMap.ker_eq_bot.mpr (IsFractionRing.injective R K)
all_goals simpa [Algebra.norm_eq_zero_iff] using nonZeroDivisors.coe_ne_zero _
noncomputable def absNorm : FractionalIdeal R⁰ K →*₀ ℚ where
toFun I := (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)|
map_zero' := by
dsimp only
rw [num_zero_eq, Submodule.zero_eq_bot, Ideal.absNorm_bot, Nat.cast_zero, zero_div]
exact IsFractionRing.injective R K
map_one' := by
dsimp only
rw [absNorm_div_norm_eq_absNorm_div_norm 1 ⊤ (by simp [Submodule.one_eq_range]),
Ideal.absNorm_top, Nat.cast_one, OneMemClass.coe_one, _root_.map_one, abs_one, Int.cast_one,
one_div_one]
map_mul' I J := by
dsimp only
rw [absNorm_div_norm_eq_absNorm_div_norm (I.den * J.den) (I.num * J.num) (by
have : Algebra.linearMap R K = (IsScalarTower.toAlgHom R R K).toLinearMap := rfl
rw [coe_mul, this, Submodule.map_mul, ← this, ← den_mul_self_eq_num, ← den_mul_self_eq_num]
exact Submodule.mul_smul_mul_eq_smul_mul_smul _ _ _ _),
Submonoid.coe_mul, _root_.map_mul, _root_.map_mul, Nat.cast_mul, div_mul_div_comm,
Int.cast_abs, Int.cast_abs, Int.cast_abs, ← abs_mul, Int.cast_mul]
theorem absNorm_eq (I : FractionalIdeal R⁰ K) :
absNorm I = (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)| := rfl
theorem absNorm_eq' {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R)
(h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) :
absNorm I = (Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by
rw [absNorm, ← absNorm_div_norm_eq_absNorm_div_norm a I₀ h, MonoidWithZeroHom.coe_mk,
ZeroHom.coe_mk]
theorem absNorm_nonneg (I : FractionalIdeal R⁰ K) : 0 ≤ absNorm I := by dsimp [absNorm]; positivity
theorem absNorm_bot : absNorm (⊥ : FractionalIdeal R⁰ K) = 0 := absNorm.map_zero'
theorem absNorm_one : absNorm (1 : FractionalIdeal R⁰ K) = 1 := by convert absNorm.map_one'
theorem absNorm_eq_zero_iff [NoZeroDivisors K] {I : FractionalIdeal R⁰ K} :
absNorm I = 0 ↔ I = 0 := by
refine ⟨fun h ↦ zero_of_num_eq_bot zero_not_mem_nonZeroDivisors ?_, fun h ↦ h ▸ absNorm_bot⟩
rw [absNorm_eq, div_eq_zero_iff] at h
refine Ideal.absNorm_eq_zero_iff.mp <| Nat.cast_eq_zero.mp <| h.resolve_right ?_
simpa [Algebra.norm_eq_zero_iff] using nonZeroDivisors.coe_ne_zero _
theorem coeIdeal_absNorm (I₀ : Ideal R) :
absNorm (I₀ : FractionalIdeal R⁰ K) = Ideal.absNorm I₀ := by
rw [absNorm_eq' 1 I₀ (by rw [one_smul]; rfl), OneMemClass.coe_one, _root_.map_one, abs_one,
Int.cast_one, _root_.div_one]
section IsLocalization
variable [IsLocalization (Algebra.algebraMapSubmonoid R ℤ⁰) K] [Algebra ℚ K]
| Mathlib/RingTheory/FractionalIdeal/Norm.lean | 106 | 128 | theorem abs_det_basis_change [NoZeroDivisors K] {ι : Type*} [Fintype ι]
[DecidableEq ι] (b : Basis ι ℤ R) (I : FractionalIdeal R⁰ K) (bI : Basis ι ℤ I) :
|(b.localizationLocalization ℚ ℤ⁰ K).det ((↑) ∘ bI)| = absNorm I := by |
have := IsFractionRing.nontrivial R K
let b₀ : Basis ι ℚ K := b.localizationLocalization ℚ ℤ⁰ K
let bI.num : Basis ι ℤ I.num := bI.map
((equivNum (nonZeroDivisors.coe_ne_zero _)).restrictScalars ℤ)
rw [absNorm_eq, ← Ideal.natAbs_det_basis_change b I.num bI.num, Int.cast_natAbs, Int.cast_abs,
Int.cast_abs, Basis.det_apply, Basis.det_apply]
change _ = |algebraMap ℤ ℚ _| / _
rw [RingHom.map_det, show RingHom.mapMatrix (algebraMap ℤ ℚ) (b.toMatrix ((↑) ∘ bI.num)) =
b₀.toMatrix ((algebraMap R K (den I : R)) • ((↑) ∘ bI)) by
ext : 2
simp_rw [bI.num, RingHom.mapMatrix_apply, Matrix.map_apply, Basis.toMatrix_apply,
← Basis.localizationLocalization_repr_algebraMap ℚ ℤ⁰ K, Function.comp_apply,
Basis.map_apply, LinearEquiv.restrictScalars_apply, equivNum_apply, Submonoid.smul_def,
Algebra.smul_def]
rfl]
rw [Basis.toMatrix_smul, Matrix.det_mul, abs_mul, ← Algebra.norm_eq_matrix_det,
Algebra.norm_localization ℤ ℤ⁰, show (Algebra.norm ℤ (den I: R) : ℚ) =
algebraMap ℤ ℚ (Algebra.norm ℤ (den I: R)) by rfl, mul_div_assoc, mul_div_cancel₀ _ (by
rw [ne_eq, abs_eq_zero, IsFractionRing.to_map_eq_zero_iff, Algebra.norm_eq_zero_iff_of_basis b]
exact nonZeroDivisors.coe_ne_zero _)]
| 20 |
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Nat.GCD.BigOperators
import Mathlib.Order.SupIndep
#align_import group_theory.noncomm_pi_coprod from "leanprover-community/mathlib"@"6f9f36364eae3f42368b04858fd66d6d9ae730d8"
namespace Subgroup
variable {G : Type*} [Group G]
@[to_additive "`Finset.noncommSum` is “injective” in `f` if `f` maps into independent subgroups.
This generalizes (one direction of) `AddSubgroup.disjoint_iff_add_eq_zero`. "]
| Mathlib/GroupTheory/NoncommPiCoprod.lean | 55 | 78 | theorem eq_one_of_noncommProd_eq_one_of_independent {ι : Type*} (s : Finset ι) (f : ι → G) (comm)
(K : ι → Subgroup G) (hind : CompleteLattice.Independent K) (hmem : ∀ x ∈ s, f x ∈ K x)
(heq1 : s.noncommProd f comm = 1) : ∀ i ∈ s, f i = 1 := by |
classical
revert heq1
induction' s using Finset.induction_on with i s hnmem ih
· simp
· have hcomm := comm.mono (Finset.coe_subset.2 <| Finset.subset_insert _ _)
simp only [Finset.forall_mem_insert] at hmem
have hmem_bsupr : s.noncommProd f hcomm ∈ ⨆ i ∈ (s : Set ι), K i := by
refine Subgroup.noncommProd_mem _ _ ?_
intro x hx
have : K x ≤ ⨆ i ∈ (s : Set ι), K i := le_iSup₂ (f := fun i _ => K i) x hx
exact this (hmem.2 x hx)
intro heq1
rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ hnmem] at heq1
have hnmem' : i ∉ (s : Set ι) := by simpa
obtain ⟨heq1i : f i = 1, heq1S : s.noncommProd f _ = 1⟩ :=
Subgroup.disjoint_iff_mul_eq_one.mp (hind.disjoint_biSup hnmem') hmem.1 hmem_bsupr heq1
intro i h
simp only [Finset.mem_insert] at h
rcases h with (rfl | h)
· exact heq1i
· refine ih hcomm hmem.2 heq1S _ h
| 21 |
import Mathlib.RingTheory.Derivation.ToSquareZero
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.IsTensorProduct
import Mathlib.Algebra.Exact
import Mathlib.Algebra.MvPolynomial.PDeriv
import Mathlib.Algebra.Polynomial.Derivation
#align_import ring_theory.kaehler from "leanprover-community/mathlib"@"4b92a463033b5587bb011657e25e4710bfca7364"
suppress_compilation
section KaehlerDifferential
open scoped TensorProduct
open Algebra
universe u v
variable (R : Type u) (S : Type v) [CommRing R] [CommRing S] [Algebra R S]
abbrev KaehlerDifferential.ideal : Ideal (S ⊗[R] S) :=
RingHom.ker (TensorProduct.lmul' R : S ⊗[R] S →ₐ[R] S)
#align kaehler_differential.ideal KaehlerDifferential.ideal
variable {S}
theorem KaehlerDifferential.one_smul_sub_smul_one_mem_ideal (a : S) :
(1 : S) ⊗ₜ[R] a - a ⊗ₜ[R] (1 : S) ∈ KaehlerDifferential.ideal R S := by simp [RingHom.mem_ker]
#align kaehler_differential.one_smul_sub_smul_one_mem_ideal KaehlerDifferential.one_smul_sub_smul_one_mem_ideal
variable {R}
variable {M : Type*} [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower R S M]
def Derivation.tensorProductTo (D : Derivation R S M) : S ⊗[R] S →ₗ[S] M :=
TensorProduct.AlgebraTensorModule.lift ((LinearMap.lsmul S (S →ₗ[R] M)).flip D.toLinearMap)
#align derivation.tensor_product_to Derivation.tensorProductTo
theorem Derivation.tensorProductTo_tmul (D : Derivation R S M) (s t : S) :
D.tensorProductTo (s ⊗ₜ t) = s • D t := rfl
#align derivation.tensor_product_to_tmul Derivation.tensorProductTo_tmul
theorem Derivation.tensorProductTo_mul (D : Derivation R S M) (x y : S ⊗[R] S) :
D.tensorProductTo (x * y) =
TensorProduct.lmul' (S := S) R x • D.tensorProductTo y +
TensorProduct.lmul' (S := S) R y • D.tensorProductTo x := by
refine TensorProduct.induction_on x ?_ ?_ ?_
· rw [zero_mul, map_zero, map_zero, zero_smul, smul_zero, add_zero]
swap
· intro x₁ y₁ h₁ h₂
rw [add_mul, map_add, map_add, map_add, add_smul, smul_add, h₁, h₂, add_add_add_comm]
intro x₁ x₂
refine TensorProduct.induction_on y ?_ ?_ ?_
· rw [mul_zero, map_zero, map_zero, zero_smul, smul_zero, add_zero]
swap
· intro x₁ y₁ h₁ h₂
rw [mul_add, map_add, map_add, map_add, add_smul, smul_add, h₁, h₂, add_add_add_comm]
intro x y
simp only [TensorProduct.tmul_mul_tmul, Derivation.tensorProductTo,
TensorProduct.AlgebraTensorModule.lift_apply, TensorProduct.lift.tmul',
TensorProduct.lmul'_apply_tmul]
dsimp
rw [D.leibniz]
simp only [smul_smul, smul_add, mul_comm (x * y) x₁, mul_right_comm x₁ x₂, ← mul_assoc]
#align derivation.tensor_product_to_mul Derivation.tensorProductTo_mul
variable (R S)
| Mathlib/RingTheory/Kaehler.lean | 105 | 128 | theorem KaehlerDifferential.submodule_span_range_eq_ideal :
Submodule.span S (Set.range fun s : S => (1 : S) ⊗ₜ[R] s - s ⊗ₜ[R] (1 : S)) =
(KaehlerDifferential.ideal R S).restrictScalars S := by |
apply le_antisymm
· rw [Submodule.span_le]
rintro _ ⟨s, rfl⟩
exact KaehlerDifferential.one_smul_sub_smul_one_mem_ideal _ _
· rintro x (hx : _ = _)
have : x - TensorProduct.lmul' (S := S) R x ⊗ₜ[R] (1 : S) = x := by
rw [hx, TensorProduct.zero_tmul, sub_zero]
rw [← this]
clear this hx
refine TensorProduct.induction_on x ?_ ?_ ?_
· rw [map_zero, TensorProduct.zero_tmul, sub_zero]; exact zero_mem _
· intro x y
have : x ⊗ₜ[R] y - (x * y) ⊗ₜ[R] (1 : S) = x • ((1 : S) ⊗ₜ y - y ⊗ₜ (1 : S)) := by
simp_rw [smul_sub, TensorProduct.smul_tmul', smul_eq_mul, mul_one]
rw [TensorProduct.lmul'_apply_tmul, this]
refine Submodule.smul_mem _ x ?_
apply Submodule.subset_span
exact Set.mem_range_self y
· intro x y hx hy
rw [map_add, TensorProduct.add_tmul, ← sub_add_sub_comm]
exact add_mem hx hy
| 21 |
import Mathlib.FieldTheory.Fixed
import Mathlib.FieldTheory.NormalClosure
import Mathlib.FieldTheory.PrimitiveElement
import Mathlib.GroupTheory.GroupAction.FixingSubgroup
#align_import field_theory.galois from "leanprover-community/mathlib"@"9fb8964792b4237dac6200193a0d533f1b3f7423"
open scoped Polynomial IntermediateField
open FiniteDimensional AlgEquiv
section
variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E]
class IsGalois : Prop where
[to_isSeparable : IsSeparable F E]
[to_normal : Normal F E]
#align is_galois IsGalois
variable {F E}
theorem isGalois_iff : IsGalois F E ↔ IsSeparable F E ∧ Normal F E :=
⟨fun h => ⟨h.1, h.2⟩, fun h =>
{ to_isSeparable := h.1
to_normal := h.2 }⟩
#align is_galois_iff isGalois_iff
attribute [instance 100] IsGalois.to_isSeparable IsGalois.to_normal
-- see Note [lower instance priority]
variable (F E)
namespace IsGalois
instance self : IsGalois F F :=
⟨⟩
#align is_galois.self IsGalois.self
variable {E}
theorem integral [IsGalois F E] (x : E) : IsIntegral F x :=
to_normal.isIntegral x
#align is_galois.integral IsGalois.integral
theorem separable [IsGalois F E] (x : E) : (minpoly F x).Separable :=
IsSeparable.separable F x
#align is_galois.separable IsGalois.separable
theorem splits [IsGalois F E] (x : E) : (minpoly F x).Splits (algebraMap F E) :=
Normal.splits' x
#align is_galois.splits IsGalois.splits
variable (E)
instance of_fixed_field (G : Type*) [Group G] [Finite G] [MulSemiringAction G E] :
IsGalois (FixedPoints.subfield G E) E :=
⟨⟩
#align is_galois.of_fixed_field IsGalois.of_fixed_field
theorem IntermediateField.AdjoinSimple.card_aut_eq_finrank [FiniteDimensional F E] {α : E}
(hα : IsIntegral F α) (h_sep : (minpoly F α).Separable)
(h_splits : (minpoly F α).Splits (algebraMap F F⟮α⟯)) :
Fintype.card (F⟮α⟯ ≃ₐ[F] F⟮α⟯) = finrank F F⟮α⟯ := by
letI : Fintype (F⟮α⟯ →ₐ[F] F⟮α⟯) := IntermediateField.fintypeOfAlgHomAdjoinIntegral F hα
rw [IntermediateField.adjoin.finrank hα]
rw [← IntermediateField.card_algHom_adjoin_integral F hα h_sep h_splits]
exact Fintype.card_congr (algEquivEquivAlgHom F F⟮α⟯)
#align is_galois.intermediate_field.adjoin_simple.card_aut_eq_finrank IsGalois.IntermediateField.AdjoinSimple.card_aut_eq_finrank
| Mathlib/FieldTheory/Galois.lean | 103 | 125 | theorem card_aut_eq_finrank [FiniteDimensional F E] [IsGalois F E] :
Fintype.card (E ≃ₐ[F] E) = finrank F E := by |
cases' Field.exists_primitive_element F E with α hα
let iso : F⟮α⟯ ≃ₐ[F] E :=
{ toFun := fun e => e.val
invFun := fun e => ⟨e, by rw [hα]; exact IntermediateField.mem_top⟩
left_inv := fun _ => by ext; rfl
right_inv := fun _ => rfl
map_mul' := fun _ _ => rfl
map_add' := fun _ _ => rfl
commutes' := fun _ => rfl }
have H : IsIntegral F α := IsGalois.integral F α
have h_sep : (minpoly F α).Separable := IsGalois.separable F α
have h_splits : (minpoly F α).Splits (algebraMap F E) := IsGalois.splits F α
replace h_splits : Polynomial.Splits (algebraMap F F⟮α⟯) (minpoly F α) := by
simpa using
Polynomial.splits_comp_of_splits (algebraMap F E) iso.symm.toAlgHom.toRingHom h_splits
rw [← LinearEquiv.finrank_eq iso.toLinearEquiv]
rw [← IntermediateField.AdjoinSimple.card_aut_eq_finrank F E H h_sep h_splits]
apply Fintype.card_congr
apply Equiv.mk (fun ϕ => iso.trans (ϕ.trans iso.symm)) fun ϕ => iso.symm.trans (ϕ.trans iso)
· intro ϕ; ext1; simp only [trans_apply, apply_symm_apply]
· intro ϕ; ext1; simp only [trans_apply, symm_apply_apply]
| 21 |
import Mathlib.Data.PFunctor.Univariate.Basic
#align_import data.pfunctor.univariate.M from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
universe u v w
open Nat Function
open List
variable (F : PFunctor.{u})
-- Porting note: the ♯ tactic is never used
-- local prefix:0 "♯" => cast (by first |simp [*]|cc|solve_by_elim)
namespace PFunctor
namespace Approx
inductive CofixA : ℕ → Type u
| continue : CofixA 0
| intro {n} : ∀ a, (F.B a → CofixA n) → CofixA (succ n)
#align pfunctor.approx.cofix_a PFunctor.Approx.CofixA
protected def CofixA.default [Inhabited F.A] : ∀ n, CofixA F n
| 0 => CofixA.continue
| succ n => CofixA.intro default fun _ => CofixA.default n
#align pfunctor.approx.cofix_a.default PFunctor.Approx.CofixA.default
instance [Inhabited F.A] {n} : Inhabited (CofixA F n) :=
⟨CofixA.default F n⟩
theorem cofixA_eq_zero : ∀ x y : CofixA F 0, x = y
| CofixA.continue, CofixA.continue => rfl
#align pfunctor.approx.cofix_a_eq_zero PFunctor.Approx.cofixA_eq_zero
variable {F}
def head' : ∀ {n}, CofixA F (succ n) → F.A
| _, CofixA.intro i _ => i
#align pfunctor.approx.head' PFunctor.Approx.head'
def children' : ∀ {n} (x : CofixA F (succ n)), F.B (head' x) → CofixA F n
| _, CofixA.intro _ f => f
#align pfunctor.approx.children' PFunctor.Approx.children'
theorem approx_eta {n : ℕ} (x : CofixA F (n + 1)) : x = CofixA.intro (head' x) (children' x) := by
cases x; rfl
#align pfunctor.approx.approx_eta PFunctor.Approx.approx_eta
inductive Agree : ∀ {n : ℕ}, CofixA F n → CofixA F (n + 1) → Prop
| continu (x : CofixA F 0) (y : CofixA F 1) : Agree x y
| intro {n} {a} (x : F.B a → CofixA F n) (x' : F.B a → CofixA F (n + 1)) :
(∀ i : F.B a, Agree (x i) (x' i)) → Agree (CofixA.intro a x) (CofixA.intro a x')
#align pfunctor.approx.agree PFunctor.Approx.Agree
def AllAgree (x : ∀ n, CofixA F n) :=
∀ n, Agree (x n) (x (succ n))
#align pfunctor.approx.all_agree PFunctor.Approx.AllAgree
@[simp]
theorem agree_trival {x : CofixA F 0} {y : CofixA F 1} : Agree x y := by constructor
#align pfunctor.approx.agree_trival PFunctor.Approx.agree_trival
theorem agree_children {n : ℕ} (x : CofixA F (succ n)) (y : CofixA F (succ n + 1)) {i j}
(h₀ : HEq i j) (h₁ : Agree x y) : Agree (children' x i) (children' y j) := by
cases' h₁ with _ _ _ _ _ _ hagree; cases h₀
apply hagree
#align pfunctor.approx.agree_children PFunctor.Approx.agree_children
def truncate : ∀ {n : ℕ}, CofixA F (n + 1) → CofixA F n
| 0, CofixA.intro _ _ => CofixA.continue
| succ _, CofixA.intro i f => CofixA.intro i <| truncate ∘ f
#align pfunctor.approx.truncate PFunctor.Approx.truncate
theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n)) (h : Agree x y) :
truncate y = x := by
induction n <;> cases x <;> cases y
· rfl
· -- cases' h with _ _ _ _ _ h₀ h₁
cases h
simp only [truncate, Function.comp, true_and_iff, eq_self_iff_true, heq_iff_eq]
-- Porting note: used to be `ext y`
rename_i n_ih a f y h₁
suffices (fun x => truncate (y x)) = f
by simp [this]
funext y
apply n_ih
apply h₁
#align pfunctor.approx.truncate_eq_of_agree PFunctor.Approx.truncate_eq_of_agree
variable {X : Type w}
variable (f : X → F X)
def sCorec : X → ∀ n, CofixA F n
| _, 0 => CofixA.continue
| j, succ _ => CofixA.intro (f j).1 fun i => sCorec ((f j).2 i) _
#align pfunctor.approx.s_corec PFunctor.Approx.sCorec
theorem P_corec (i : X) (n : ℕ) : Agree (sCorec f i n) (sCorec f i (succ n)) := by
induction' n with n n_ih generalizing i
constructor
cases' f i with y g
constructor
introv
apply n_ih
set_option linter.uppercaseLean3 false in
#align pfunctor.approx.P_corec PFunctor.Approx.P_corec
def Path (F : PFunctor.{u}) :=
List F.Idx
#align pfunctor.approx.path PFunctor.Approx.Path
instance Path.inhabited : Inhabited (Path F) :=
⟨[]⟩
#align pfunctor.approx.path.inhabited PFunctor.Approx.Path.inhabited
open List Nat
instance CofixA.instSubsingleton : Subsingleton (CofixA F 0) :=
⟨by rintro ⟨⟩ ⟨⟩; rfl⟩
| Mathlib/Data/PFunctor/Univariate/M.lean | 152 | 174 | theorem head_succ' (n m : ℕ) (x : ∀ n, CofixA F n) (Hconsistent : AllAgree x) :
head' (x (succ n)) = head' (x (succ m)) := by |
suffices ∀ n, head' (x (succ n)) = head' (x 1) by simp [this]
clear m n
intro n
cases' h₀ : x (succ n) with _ i₀ f₀
cases' h₁ : x 1 with _ i₁ f₁
dsimp only [head']
induction' n with n n_ih
· rw [h₁] at h₀
cases h₀
trivial
· have H := Hconsistent (succ n)
cases' h₂ : x (succ n) with _ i₂ f₂
rw [h₀, h₂] at H
apply n_ih (truncate ∘ f₀)
rw [h₂]
cases' H with _ _ _ _ _ _ hagree
congr
funext j
dsimp only [comp_apply]
rw [truncate_eq_of_agree]
apply hagree
| 21 |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.Order.Module.OrderedSMul
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.Data.Prod.Lex
import Mathlib.Data.Set.Image
import Mathlib.GroupTheory.Perm.Support
import Mathlib.Order.Monotone.Monovary
import Mathlib.Tactic.Abel
#align_import algebra.order.rearrangement from "leanprover-community/mathlib"@"b3f25363ae62cb169e72cd6b8b1ac97bacf21ca7"
open Equiv Equiv.Perm Finset Function OrderDual
variable {ι α β : Type*}
section SMul
variable [LinearOrderedRing α] [LinearOrderedAddCommGroup β] [Module α β] [OrderedSMul α β]
{s : Finset ι} {σ : Perm ι} {f : ι → α} {g : ι → β}
theorem MonovaryOn.sum_smul_comp_perm_le_sum_smul (hfg : MonovaryOn f g s)
(hσ : { x | σ x ≠ x } ⊆ s) : (∑ i ∈ s, f i • g (σ i)) ≤ ∑ i ∈ s, f i • g i := by
classical
revert hσ σ hfg
-- Porting note: Specify `p` to get around `∀ {σ}` in the current goal.
apply Finset.induction_on_max_value (fun i ↦ toLex (g i, f i))
(p := fun t ↦ ∀ {σ : Perm ι}, MonovaryOn f g t → { x | σ x ≠ x } ⊆ t →
(∑ i ∈ t, f i • g (σ i)) ≤ ∑ i ∈ t, f i • g i) s
· simp only [le_rfl, Finset.sum_empty, imp_true_iff]
intro a s has hamax hind σ hfg hσ
set τ : Perm ι := σ.trans (swap a (σ a)) with hτ
have hτs : { x | τ x ≠ x } ⊆ s := by
intro x hx
simp only [τ, Ne, Set.mem_setOf_eq, Equiv.coe_trans, Equiv.swap_comp_apply] at hx
split_ifs at hx with h₁ h₂
· obtain rfl | hax := eq_or_ne x a
· contradiction
· exact mem_of_mem_insert_of_ne (hσ fun h ↦ hax <| h.symm.trans h₁) hax
· exact (hx <| σ.injective h₂.symm).elim
· exact mem_of_mem_insert_of_ne (hσ hx) (ne_of_apply_ne _ h₂)
specialize hind (hfg.subset <| subset_insert _ _) hτs
simp_rw [sum_insert has]
refine le_trans ?_ (add_le_add_left hind _)
obtain hσa | hσa := eq_or_ne a (σ a)
· rw [hτ, ← hσa, swap_self, trans_refl]
have h1s : σ⁻¹ a ∈ s := by
rw [Ne, ← inv_eq_iff_eq] at hσa
refine mem_of_mem_insert_of_ne (hσ fun h ↦ hσa ?_) hσa
rwa [apply_inv_self, eq_comm] at h
simp only [← s.sum_erase_add _ h1s, add_comm]
rw [← add_assoc, ← add_assoc]
simp only [hτ, swap_apply_left, Function.comp_apply, Equiv.coe_trans, apply_inv_self]
refine add_le_add (smul_add_smul_le_smul_add_smul' ?_ ?_) (sum_congr rfl fun x hx ↦ ?_).le
· specialize hamax (σ⁻¹ a) h1s
rw [Prod.Lex.le_iff] at hamax
cases' hamax with hamax hamax
· exact hfg (mem_insert_of_mem h1s) (mem_insert_self _ _) hamax
· exact hamax.2
· specialize hamax (σ a) (mem_of_mem_insert_of_ne (hσ <| σ.injective.ne hσa.symm) hσa.symm)
rw [Prod.Lex.le_iff] at hamax
cases' hamax with hamax hamax
· exact hamax.le
· exact hamax.1.le
· rw [mem_erase, Ne, eq_inv_iff_eq] at hx
rw [swap_apply_of_ne_of_ne hx.1 (σ.injective.ne _)]
rintro rfl
exact has hx.2
#align monovary_on.sum_smul_comp_perm_le_sum_smul MonovaryOn.sum_smul_comp_perm_le_sum_smul
| Mathlib/Algebra/Order/Rearrangement.lean | 114 | 137 | theorem MonovaryOn.sum_smul_comp_perm_eq_sum_smul_iff (hfg : MonovaryOn f g s)
(hσ : { x | σ x ≠ x } ⊆ s) :
((∑ i ∈ s, f i • g (σ i)) = ∑ i ∈ s, f i • g i) ↔ MonovaryOn f (g ∘ σ) s := by |
classical
refine ⟨not_imp_not.1 fun h ↦ ?_, fun h ↦ (hfg.sum_smul_comp_perm_le_sum_smul hσ).antisymm ?_⟩
· rw [MonovaryOn] at h
push_neg at h
obtain ⟨x, hx, y, hy, hgxy, hfxy⟩ := h
set τ : Perm ι := (Equiv.swap x y).trans σ
have hτs : { x | τ x ≠ x } ⊆ s := by
refine (set_support_mul_subset σ <| swap x y).trans (Set.union_subset hσ fun z hz ↦ ?_)
obtain ⟨_, rfl | rfl⟩ := swap_apply_ne_self_iff.1 hz <;> assumption
refine ((hfg.sum_smul_comp_perm_le_sum_smul hτs).trans_lt' ?_).ne
obtain rfl | hxy := eq_or_ne x y
· cases lt_irrefl _ hfxy
simp only [τ, ← s.sum_erase_add _ hx,
← (s.erase x).sum_erase_add _ (mem_erase.2 ⟨hxy.symm, hy⟩),
add_assoc, Equiv.coe_trans, Function.comp_apply, swap_apply_right, swap_apply_left]
refine add_lt_add_of_le_of_lt (Finset.sum_congr rfl fun z hz ↦ ?_).le
(smul_add_smul_lt_smul_add_smul hfxy hgxy)
simp_rw [mem_erase] at hz
rw [swap_apply_of_ne_of_ne hz.2.1 hz.1]
· convert h.sum_smul_comp_perm_le_sum_smul ((set_support_inv_eq _).subset.trans hσ) using 1
simp_rw [Function.comp_apply, apply_inv_self]
| 21 |
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator
import Mathlib.MeasureTheory.Function.UniformIntegrable
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
#align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f"
noncomputable section
open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap
open scoped NNReal ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α}
theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ}
(hf : Integrable f μ) :
SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by
refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_
· exact fun _ _ _ => (integrable_of_integrable_trim hm
(SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn
· intro s hs _
conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs,
← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm)
(hf.withDensityᵥ_trim_absolutelyContinuous hm)]
rw [withDensityᵥ_apply
(SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs,
← setIntegral_trim hm _ hs]
exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable
· exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable'
#align measure_theory.rn_deriv_ae_eq_condexp MeasureTheory.rnDeriv_ae_eq_condexp
-- TODO: the following couple of lemmas should be generalized and proved using Jensen's inequality
-- for the conditional expectation (not in mathlib yet) .
theorem snorm_one_condexp_le_snorm (f : α → ℝ) : snorm (μ[f|m]) 1 μ ≤ snorm f 1 μ := by
by_cases hf : Integrable f μ
swap; · rw [condexp_undef hf, snorm_zero]; exact zero_le _
by_cases hm : m ≤ m0
swap; · rw [condexp_of_not_le hm, snorm_zero]; exact zero_le _
by_cases hsig : SigmaFinite (μ.trim hm)
swap; · rw [condexp_of_not_sigmaFinite hm hsig, snorm_zero]; exact zero_le _
calc
snorm (μ[f|m]) 1 μ ≤ snorm (μ[(|f|)|m]) 1 μ := by
refine snorm_mono_ae ?_
filter_upwards [condexp_mono hf hf.abs
(ae_of_all μ (fun x => le_abs_self (f x) : ∀ x, f x ≤ |f x|)),
EventuallyLE.trans (condexp_neg f).symm.le
(condexp_mono hf.neg hf.abs
(ae_of_all μ (fun x => neg_le_abs (f x): ∀ x, -f x ≤ |f x|)))] with x hx₁ hx₂
exact abs_le_abs hx₁ hx₂
_ = snorm f 1 μ := by
rw [snorm_one_eq_lintegral_nnnorm, snorm_one_eq_lintegral_nnnorm, ←
ENNReal.toReal_eq_toReal (ne_of_lt integrable_condexp.2) (ne_of_lt hf.2), ←
integral_norm_eq_lintegral_nnnorm
(stronglyMeasurable_condexp.mono hm).aestronglyMeasurable,
← integral_norm_eq_lintegral_nnnorm hf.1]
simp_rw [Real.norm_eq_abs]
rw [← integral_condexp hm hf.abs]
refine integral_congr_ae ?_
have : 0 ≤ᵐ[μ] μ[(|f|)|m] := by
rw [← condexp_zero]
exact condexp_mono (integrable_zero _ _ _) hf.abs
(ae_of_all μ (fun x => abs_nonneg (f x) : ∀ x, 0 ≤ |f x|))
filter_upwards [this] with x hx
exact abs_eq_self.2 hx
#align measure_theory.snorm_one_condexp_le_snorm MeasureTheory.snorm_one_condexp_le_snorm
theorem integral_abs_condexp_le (f : α → ℝ) : ∫ x, |(μ[f|m]) x| ∂μ ≤ ∫ x, |f x| ∂μ := by
by_cases hm : m ≤ m0
swap
· simp_rw [condexp_of_not_le hm, Pi.zero_apply, abs_zero, integral_zero]
positivity
by_cases hfint : Integrable f μ
swap
· simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul,
mul_zero]
positivity
rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae]
· rw [ENNReal.toReal_le_toReal] <;> simp_rw [← Real.norm_eq_abs, ofReal_norm_eq_coe_nnnorm]
· rw [← snorm_one_eq_lintegral_nnnorm, ← snorm_one_eq_lintegral_nnnorm]
exact snorm_one_condexp_le_snorm _
· exact integrable_condexp.2.ne
· exact hfint.2.ne
· filter_upwards with x using abs_nonneg _
· simp_rw [← Real.norm_eq_abs]
exact hfint.1.norm
· filter_upwards with x using abs_nonneg _
· simp_rw [← Real.norm_eq_abs]
exact (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable.norm
#align measure_theory.integral_abs_condexp_le MeasureTheory.integral_abs_condexp_le
| Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean | 116 | 138 | theorem setIntegral_abs_condexp_le {s : Set α} (hs : MeasurableSet[m] s) (f : α → ℝ) :
∫ x in s, |(μ[f|m]) x| ∂μ ≤ ∫ x in s, |f x| ∂μ := by |
by_cases hnm : m ≤ m0
swap
· simp_rw [condexp_of_not_le hnm, Pi.zero_apply, abs_zero, integral_zero]
positivity
by_cases hfint : Integrable f μ
swap
· simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul,
mul_zero]
positivity
have : ∫ x in s, |(μ[f|m]) x| ∂μ = ∫ x, |(μ[s.indicator f|m]) x| ∂μ := by
rw [← integral_indicator (hnm _ hs)]
refine integral_congr_ae ?_
have : (fun x => |(μ[s.indicator f|m]) x|) =ᵐ[μ] fun x => |s.indicator (μ[f|m]) x| :=
(condexp_indicator hfint hs).fun_comp abs
refine EventuallyEq.trans (eventually_of_forall fun x => ?_) this.symm
rw [← Real.norm_eq_abs, norm_indicator_eq_indicator_norm]
simp only [Real.norm_eq_abs]
rw [this, ← integral_indicator (hnm _ hs)]
refine (integral_abs_condexp_le _).trans
(le_of_eq <| integral_congr_ae <| eventually_of_forall fun x => ?_)
simp_rw [← Real.norm_eq_abs, norm_indicator_eq_indicator_norm]
| 21 |
import Mathlib.RingTheory.DiscreteValuationRing.Basic
import Mathlib.RingTheory.MvPowerSeries.Inverse
import Mathlib.RingTheory.PowerSeries.Basic
import Mathlib.RingTheory.PowerSeries.Order
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Polynomial
open Finset (antidiagonal mem_antidiagonal)
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section Ring
variable [Ring R]
protected def inv.aux : R → R⟦X⟧ → R⟦X⟧ :=
MvPowerSeries.inv.aux
#align power_series.inv.aux PowerSeries.inv.aux
| Mathlib/RingTheory/PowerSeries/Inverse.lean | 54 | 81 | theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
coeff R n (inv.aux a φ) =
if n = 0 then a
else
-a *
∑ x ∈ antidiagonal n,
if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by |
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
simp only [Finsupp.single_eq_zero]
split_ifs; · rfl
congr 1
symm
apply Finset.sum_nbij' (fun (a, b) ↦ (single () a, single () b))
fun (f, g) ↦ (f (), g ())
· aesop
· aesop
· aesop
· aesop
· rintro ⟨i, j⟩ _hij
obtain H | H := le_or_lt n j
· aesop
rw [if_pos H, if_pos]
· rfl
refine ⟨?_, fun hh ↦ H.not_le ?_⟩
· rintro ⟨⟩
simpa [Finsupp.single_eq_same] using le_of_lt H
· simpa [Finsupp.single_eq_same] using hh ()
| 21 |
import Mathlib.Analysis.Complex.AbsMax
import Mathlib.Analysis.Complex.RemovableSingularity
#align_import analysis.complex.schwarz from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Metric Set Function Filter TopologicalSpace
open scoped Topology
namespace Complex
section Space
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {R R₁ R₂ : ℝ} {f : ℂ → E}
{c z z₀ : ℂ}
| Mathlib/Analysis/Complex/Schwarz.lean | 65 | 88 | theorem schwarz_aux {f : ℂ → ℂ} (hd : DifferentiableOn ℂ f (ball c R₁))
(h_maps : MapsTo f (ball c R₁) (ball (f c) R₂)) (hz : z ∈ ball c R₁) :
‖dslope f c z‖ ≤ R₂ / R₁ := by |
have hR₁ : 0 < R₁ := nonempty_ball.1 ⟨z, hz⟩
suffices ∀ᶠ r in 𝓝[<] R₁, ‖dslope f c z‖ ≤ R₂ / r by
refine ge_of_tendsto ?_ this
exact (tendsto_const_nhds.div tendsto_id hR₁.ne').mono_left nhdsWithin_le_nhds
rw [mem_ball] at hz
filter_upwards [Ioo_mem_nhdsWithin_Iio ⟨hz, le_rfl⟩] with r hr
have hr₀ : 0 < r := dist_nonneg.trans_lt hr.1
replace hd : DiffContOnCl ℂ (dslope f c) (ball c r) := by
refine DifferentiableOn.diffContOnCl ?_
rw [closure_ball c hr₀.ne']
exact ((differentiableOn_dslope <| ball_mem_nhds _ hR₁).mpr hd).mono
(closedBall_subset_ball hr.2)
refine norm_le_of_forall_mem_frontier_norm_le isBounded_ball hd ?_ ?_
· rw [frontier_ball c hr₀.ne']
intro z hz
have hz' : z ≠ c := ne_of_mem_sphere hz hr₀.ne'
rw [dslope_of_ne _ hz', slope_def_module, norm_smul, norm_inv, mem_sphere_iff_norm.1 hz, ←
div_eq_inv_mul, div_le_div_right hr₀, ← dist_eq_norm]
exact le_of_lt (h_maps (mem_ball.2 (by rw [mem_sphere.1 hz]; exact hr.2)))
· rw [closure_ball c hr₀.ne', mem_closedBall]
exact hr.1.le
| 21 |
import Mathlib.Algebra.Homology.ExactSequence
import Mathlib.CategoryTheory.Abelian.Refinements
#align_import category_theory.abelian.diagram_lemmas.four from "leanprover-community/mathlib"@"d34cbcf6c94953e965448c933cd9cc485115ebbd"
namespace CategoryTheory
open Category Limits Preadditive
namespace Abelian
variable {C : Type*} [Category C] [Abelian C]
open ComposableArrows
section Four
variable {R₁ R₂ : ComposableArrows C 3} (φ : R₁ ⟶ R₂)
theorem mono_of_epi_of_mono_of_mono' (hR₁ : R₁.map' 0 2 = 0)
(hR₁' : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
(hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact)
(h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
Mono (app' φ 2) := by
apply mono_of_cancel_zero
intro A f₂ h₁
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
rw [← cancel_mono (app' φ 3 _), assoc, NatTrans.naturality, reassoc_of% h₁,
zero_comp, zero_comp]
obtain ⟨A₁, π₁, _, f₁, hf₁⟩ := (hR₁'.exact 0).exact_up_to_refinements f₂ h₂
dsimp at hf₁
have h₃ : (f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
rw [assoc, ← NatTrans.naturality, ← reassoc_of% hf₁, h₁, comp_zero]
obtain ⟨A₂, π₂, _, g₀, hg₀⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₃
obtain ⟨A₃, π₃, _, f₀, hf₀⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
have h₄ : f₀ ≫ R₁.map' 0 1 = π₃ ≫ π₂ ≫ f₁ := by
rw [← cancel_mono (app' φ 1 _), assoc, assoc, assoc, NatTrans.naturality,
← reassoc_of% hf₀, hg₀]
rfl
rw [← cancel_epi π₁, comp_zero, hf₁, ← cancel_epi π₂, ← cancel_epi π₃, comp_zero,
comp_zero, ← reassoc_of% h₄, ← R₁.map'_comp 0 1 2, hR₁, comp_zero]
#align category_theory.abelian.mono_of_epi_of_mono_of_mono CategoryTheory.Abelian.mono_of_epi_of_mono_of_mono'
theorem mono_of_epi_of_mono_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
(h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
Mono (app' φ 2) :=
mono_of_epi_of_mono_of_mono' φ
(by simpa only [R₁.map'_comp 0 1 2] using hR₁.toIsComplex.zero 0)
(hR₁.exact 1).exact_toComposableArrows (hR₂.exact 0).exact_toComposableArrows h₀ h₁ h₃
attribute [local instance] epi_comp
| Mathlib/CategoryTheory/Abelian/DiagramLemmas/Four.lean | 95 | 120 | theorem epi_of_epi_of_epi_of_mono'
(hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
(hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
(h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
Epi (app' φ 1) := by |
rw [epi_iff_surjective_up_to_refinements]
intro A g₁
obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
dsimp at f₁ h₃
have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1 _) ≫ R₂.map' 1 2 = 0 := by
rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
dsimp at g₀ h₅
rw [comp_sub] at h₅
obtain ⟨A₄, π₄, _, f₀, h₆⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
refine ⟨A₄, π₄ ≫ π₃ ≫ π₂ ≫ π₁, inferInstance,
π₄ ≫ π₃ ≫ f₁ + f₀ ≫ (by exact R₁.map' 0 1), ?_⟩
rw [assoc, assoc, assoc, add_comp, assoc, assoc, assoc, NatTrans.naturality,
← reassoc_of% h₆, ← h₅, comp_sub]
dsimp
rw [add_sub_cancel]
| 21 |
import Mathlib.Topology.LocalAtTarget
import Mathlib.AlgebraicGeometry.Morphisms.Basic
#align_import algebraic_geometry.morphisms.open_immersion from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace
universe u
namespace AlgebraicGeometry
variable {X Y Z : Scheme.{u}} (f : X ⟶ Y) (g : Y ⟶ Z)
theorem isOpenImmersion_iff_stalk {f : X ⟶ Y} : IsOpenImmersion f ↔
OpenEmbedding f.1.base ∧ ∀ x, IsIso (PresheafedSpace.stalkMap f.1 x) := by
constructor
· intro h; exact ⟨h.1, inferInstance⟩
· rintro ⟨h₁, h₂⟩; exact IsOpenImmersion.of_stalk_iso f h₁
#align algebraic_geometry.is_open_immersion_iff_stalk AlgebraicGeometry.isOpenImmersion_iff_stalk
instance isOpenImmersion_isStableUnderComposition :
MorphismProperty.IsStableUnderComposition @IsOpenImmersion where
comp_mem f g _ _ := LocallyRingedSpace.IsOpenImmersion.comp f g
#align algebraic_geometry.is_open_immersion_stable_under_composition AlgebraicGeometry.isOpenImmersion_isStableUnderComposition
theorem isOpenImmersion_respectsIso : MorphismProperty.RespectsIso @IsOpenImmersion := by
apply MorphismProperty.respectsIso_of_isStableUnderComposition
intro _ _ f (hf : IsIso f)
have : IsIso f := hf
infer_instance
#align algebraic_geometry.is_open_immersion_respects_iso AlgebraicGeometry.isOpenImmersion_respectsIso
| Mathlib/AlgebraicGeometry/Morphisms/OpenImmersion.lean | 53 | 74 | theorem isOpenImmersion_is_local_at_target : PropertyIsLocalAtTarget @IsOpenImmersion := by |
constructor
· exact isOpenImmersion_respectsIso
· intros; infer_instance
· intro X Y f 𝒰 H
rw [isOpenImmersion_iff_stalk]
constructor
· apply (openEmbedding_iff_openEmbedding_of_iSup_eq_top 𝒰.iSup_opensRange f.1.base.2).mpr
intro i
have := ((isOpenImmersion_respectsIso.arrow_iso_iff
(morphismRestrictOpensRange f (𝒰.map i))).mpr (H i)).1
erw [Arrow.mk_hom, morphismRestrict_val_base] at this
norm_cast
· intro x
have := Arrow.iso_w (morphismRestrictStalkMap
f (Scheme.Hom.opensRange (𝒰.map <| 𝒰.f <| f.1.base x)) ⟨x, 𝒰.Covers _⟩)
dsimp only [Arrow.mk_hom] at this
rw [this]
haveI : IsOpenImmersion (f ∣_ Scheme.Hom.opensRange (𝒰.map <| 𝒰.f <| f.1.base x)) :=
(isOpenImmersion_respectsIso.arrow_iso_iff
(morphismRestrictOpensRange f (𝒰.map _))).mpr (H _)
infer_instance
| 21 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.Choose.Central
import Mathlib.Data.Tree.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Positivity
#align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da"
open Finset
open Finset.antidiagonal (fst_le snd_le)
def catalan : ℕ → ℕ
| 0 => 1
| n + 1 =>
∑ i : Fin n.succ,
catalan i * catalan (n - i)
#align catalan catalan
@[simp]
theorem catalan_zero : catalan 0 = 1 := by rw [catalan]
#align catalan_zero catalan_zero
theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) := by
rw [catalan]
#align catalan_succ catalan_succ
theorem catalan_succ' (n : ℕ) :
catalan (n + 1) = ∑ ij ∈ antidiagonal n, catalan ij.1 * catalan ij.2 := by
rw [catalan_succ, Nat.sum_antidiagonal_eq_sum_range_succ (fun x y => catalan x * catalan y) n,
sum_range]
#align catalan_succ' catalan_succ'
@[simp]
theorem catalan_one : catalan 1 = 1 := by simp [catalan_succ]
#align catalan_one catalan_one
private def gosperCatalan (n j : ℕ) : ℚ :=
Nat.centralBinom j * Nat.centralBinom (n - j) * (2 * j - n) / (2 * n * (n + 1))
private theorem gosper_trick {n i : ℕ} (h : i ≤ n) :
gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
Nat.centralBinom i / (i + 1) * Nat.centralBinom (n - i) / (n - i + 1) := by
have l₁ : (i : ℚ) + 1 ≠ 0 := by norm_cast
have l₂ : (n : ℚ) - i + 1 ≠ 0 := by norm_cast
have h₁ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (i + 1))) l₁).symm
have h₂ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (n - i + 1))) l₂).symm
have h₃ : ((i : ℚ) + 1) * (i + 1).centralBinom = 2 * (2 * i + 1) * i.centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ i
have h₄ :
((n : ℚ) - i + 1) * (n - i + 1).centralBinom = 2 * (2 * (n - i) + 1) * (n - i).centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ (n - i)
simp only [gosperCatalan]
push_cast
rw [show n + 1 - i = n - i + 1 by rw [Nat.add_comm (n - i) 1, ← (Nat.add_sub_assoc h 1),
add_comm]]
rw [h₁, h₂, h₃, h₄]
field_simp
ring
private theorem gosper_catalan_sub_eq_central_binom_div (n : ℕ) : gosperCatalan (n + 1) (n + 1) -
gosperCatalan (n + 1) 0 = Nat.centralBinom (n + 1) / (n + 2) := by
have : (n : ℚ) + 1 ≠ 0 := by norm_cast
have : (n : ℚ) + 1 + 1 ≠ 0 := by norm_cast
have h : (n : ℚ) + 2 ≠ 0 := by norm_cast
simp only [gosperCatalan, Nat.sub_zero, Nat.centralBinom_zero, Nat.sub_self]
field_simp
ring
| Mathlib/Combinatorics/Enumerative/Catalan.lean | 116 | 137 | theorem catalan_eq_centralBinom_div (n : ℕ) : catalan n = n.centralBinom / (n + 1) := by |
suffices (catalan n : ℚ) = Nat.centralBinom n / (n + 1) by
have h := Nat.succ_dvd_centralBinom n
exact mod_cast this
induction' n using Nat.case_strong_induction_on with d hd
· simp
· simp_rw [catalan_succ, Nat.cast_sum, Nat.cast_mul]
trans (∑ i : Fin d.succ, Nat.centralBinom i / (i + 1) *
(Nat.centralBinom (d - i) / (d - i + 1)) : ℚ)
· congr
ext1 x
have m_le_d : x.val ≤ d := by apply Nat.le_of_lt_succ; apply x.2
have d_minus_x_le_d : (d - x.val) ≤ d := tsub_le_self
rw [hd _ m_le_d, hd _ d_minus_x_le_d]
norm_cast
· trans (∑ i : Fin d.succ, (gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i))
· refine sum_congr rfl fun i _ => ?_
rw [gosper_trick i.is_le, mul_div]
· rw [← sum_range fun i => gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i,
sum_range_sub, Nat.succ_eq_add_one]
rw [gosper_catalan_sub_eq_central_binom_div d]
norm_cast
| 21 |
import Mathlib.Algebra.Group.Center
import Mathlib.Data.Int.Cast.Lemmas
#align_import group_theory.subsemigroup.center from "leanprover-community/mathlib"@"1ac8d4304efba9d03fa720d06516fac845aa5353"
variable {M : Type*}
namespace Set
variable (M)
@[simp]
theorem natCast_mem_center [NonAssocSemiring M] (n : ℕ) : (n : M) ∈ Set.center M where
comm _:= by rw [Nat.commute_cast]
left_assoc _ _ := by
induction n with
| zero => rw [Nat.cast_zero, zero_mul, zero_mul, zero_mul]
| succ n ihn => rw [Nat.cast_succ, add_mul, one_mul, ihn, add_mul, add_mul, one_mul]
mid_assoc _ _ := by
induction n with
| zero => rw [Nat.cast_zero, zero_mul, mul_zero, zero_mul]
| succ n ihn => rw [Nat.cast_succ, add_mul, mul_add, add_mul, ihn, mul_add, one_mul, mul_one]
right_assoc _ _ := by
induction n with
| zero => rw [Nat.cast_zero, mul_zero, mul_zero, mul_zero]
| succ n ihn => rw [Nat.cast_succ, mul_add, ihn, mul_add, mul_add, mul_one, mul_one]
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem ofNat_mem_center [NonAssocSemiring M] (n : ℕ) [n.AtLeastTwo] :
(no_index (OfNat.ofNat n)) ∈ Set.center M :=
natCast_mem_center M n
@[simp]
| Mathlib/Algebra/Ring/Center.lean | 46 | 67 | theorem intCast_mem_center [NonAssocRing M] (n : ℤ) : (n : M) ∈ Set.center M where
comm _ := by | rw [Int.commute_cast]
left_assoc _ _ := match n with
| (n : ℕ) => by rw [Int.cast_natCast, (natCast_mem_center _ n).left_assoc _ _]
| Int.negSucc n => by
rw [Int.cast_negSucc, Nat.cast_add, Nat.cast_one, neg_add_rev, add_mul, add_mul, add_mul,
neg_mul, one_mul, neg_mul 1, one_mul, ← neg_mul, add_right_inj, neg_mul,
(natCast_mem_center _ n).left_assoc _ _, neg_mul, neg_mul]
mid_assoc _ _ := match n with
| (n : ℕ) => by rw [Int.cast_natCast, (natCast_mem_center _ n).mid_assoc _ _]
| Int.negSucc n => by
simp only [Int.cast_negSucc, Nat.cast_add, Nat.cast_one, neg_add_rev]
rw [add_mul, mul_add, add_mul, mul_add, neg_mul, one_mul]
rw [neg_mul, mul_neg, mul_one, mul_neg, neg_mul, neg_mul]
rw [(natCast_mem_center _ n).mid_assoc _ _]
simp only [mul_neg]
right_assoc _ _ := match n with
| (n : ℕ) => by rw [Int.cast_natCast, (natCast_mem_center _ n).right_assoc _ _]
| Int.negSucc n => by
simp only [Int.cast_negSucc, Nat.cast_add, Nat.cast_one, neg_add_rev]
rw [mul_add, mul_add, mul_add, mul_neg, mul_one, mul_neg, mul_neg, mul_one, mul_neg,
add_right_inj, (natCast_mem_center _ n).right_assoc _ _, mul_neg, mul_neg]
| 21 |
import Mathlib.MeasureTheory.Integral.FundThmCalculus
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
import Mathlib.Analysis.SpecialFunctions.NonIntegrable
import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
#align_import analysis.special_functions.integrals from "leanprover-community/mathlib"@"011cafb4a5bc695875d186e245d6b3df03bf6c40"
open Real Nat Set Finset
open scoped Real Interval
variable {a b : ℝ} (n : ℕ)
namespace intervalIntegral
open MeasureTheory
variable {f : ℝ → ℝ} {μ ν : Measure ℝ} [IsLocallyFiniteMeasure μ] (c d : ℝ)
@[simp]
theorem intervalIntegrable_pow : IntervalIntegrable (fun x => x ^ n) μ a b :=
(continuous_pow n).intervalIntegrable a b
#align interval_integral.interval_integrable_pow intervalIntegral.intervalIntegrable_pow
theorem intervalIntegrable_zpow {n : ℤ} (h : 0 ≤ n ∨ (0 : ℝ) ∉ [[a, b]]) :
IntervalIntegrable (fun x => x ^ n) μ a b :=
(continuousOn_id.zpow₀ n fun _ hx => h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable
#align interval_integral.interval_integrable_zpow intervalIntegral.intervalIntegrable_zpow
theorem intervalIntegrable_rpow {r : ℝ} (h : 0 ≤ r ∨ (0 : ℝ) ∉ [[a, b]]) :
IntervalIntegrable (fun x => x ^ r) μ a b :=
(continuousOn_id.rpow_const fun _ hx =>
h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable
#align interval_integral.interval_integrable_rpow intervalIntegral.intervalIntegrable_rpow
| Mathlib/Analysis/SpecialFunctions/Integrals.lean | 73 | 95 | theorem intervalIntegrable_rpow' {r : ℝ} (h : -1 < r) :
IntervalIntegrable (fun x => x ^ r) volume a b := by |
suffices ∀ c : ℝ, IntervalIntegrable (fun x => x ^ r) volume 0 c by
exact IntervalIntegrable.trans (this a).symm (this b)
have : ∀ c : ℝ, 0 ≤ c → IntervalIntegrable (fun x => x ^ r) volume 0 c := by
intro c hc
rw [intervalIntegrable_iff, uIoc_of_le hc]
have hderiv : ∀ x ∈ Ioo 0 c, HasDerivAt (fun x : ℝ => x ^ (r + 1) / (r + 1)) (x ^ r) x := by
intro x hx
convert (Real.hasDerivAt_rpow_const (p := r + 1) (Or.inl hx.1.ne')).div_const (r + 1) using 1
field_simp [(by linarith : r + 1 ≠ 0)]
apply integrableOn_deriv_of_nonneg _ hderiv
· intro x hx; apply rpow_nonneg hx.1.le
· refine (continuousOn_id.rpow_const ?_).div_const _; intro x _; right; linarith
intro c; rcases le_total 0 c with (hc | hc)
· exact this c hc
· rw [IntervalIntegrable.iff_comp_neg, neg_zero]
have m := (this (-c) (by linarith)).smul (cos (r * π))
rw [intervalIntegrable_iff] at m ⊢
refine m.congr_fun ?_ measurableSet_Ioc; intro x hx
rw [uIoc_of_le (by linarith : 0 ≤ -c)] at hx
simp only [Pi.smul_apply, Algebra.id.smul_eq_mul, log_neg_eq_log, mul_comm,
rpow_def_of_pos hx.1, rpow_def_of_neg (by linarith [hx.1] : -x < 0)]
| 21 |
import Mathlib.CategoryTheory.Sites.Sheaf
#align_import category_theory.sites.canonical from "leanprover-community/mathlib"@"9e7c80f638149bfb3504ba8ff48dfdbfc949fb1a"
universe v u
namespace CategoryTheory
open scoped Classical
open CategoryTheory Category Limits Sieve
variable {C : Type u} [Category.{v} C]
namespace Sheaf
variable {P : Cᵒᵖ ⥤ Type v}
variable {X Y : C} {S : Sieve X} {R : Presieve X}
variable (J J₂ : GrothendieckTopology C)
theorem isSheafFor_bind (P : Cᵒᵖ ⥤ Type v) (U : Sieve X) (B : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, U f → Sieve Y)
(hU : Presieve.IsSheafFor P (U : Presieve X))
(hB : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.IsSheafFor P (B hf : Presieve Y))
(hB' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (h : U f) ⦃Z⦄ (g : Z ⟶ Y),
Presieve.IsSeparatedFor P (((B h).pullback g) : Presieve Z)) :
Presieve.IsSheafFor P (Sieve.bind (U : Presieve X) B : Presieve X) := by
intro s hs
let y : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.FamilyOfElements P (B hf : Presieve Y) :=
fun Y f hf Z g hg => s _ (Presieve.bind_comp _ _ hg)
have hy : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).Compatible := by
intro Y f H Y₁ Y₂ Z g₁ g₂ f₁ f₂ hf₁ hf₂ comm
apply hs
apply reassoc_of% comm
let t : Presieve.FamilyOfElements P (U : Presieve X) :=
fun Y f hf => (hB hf).amalgamate (y hf) (hy hf)
have ht : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).IsAmalgamation (t f hf) := fun Y f hf =>
(hB hf).isAmalgamation _
have hT : t.Compatible := by
rw [Presieve.compatible_iff_sieveCompatible]
intro Z W f h hf
apply (hB (U.downward_closed hf h)).isSeparatedFor.ext
intro Y l hl
apply (hB' hf (l ≫ h)).ext
intro M m hm
have : bind U B (m ≫ l ≫ h ≫ f) := by
-- Porting note: had to make explicit the parameter `((m ≫ l ≫ h) ≫ f)` and
-- using `by exact`
have : bind U B ((m ≫ l ≫ h) ≫ f) := by exact Presieve.bind_comp f hf hm
simpa using this
trans s (m ≫ l ≫ h ≫ f) this
· have := ht (U.downward_closed hf h) _ ((B _).downward_closed hl m)
rw [op_comp, FunctorToTypes.map_comp_apply] at this
rw [this]
change s _ _ = s _ _
-- Porting note: the proof was `by simp`
congr 1
simp only [assoc]
· have h : s _ _ = _ := (ht hf _ hm).symm
-- Porting note: this was done by `simp only [assoc] at`
conv_lhs at h => congr; rw [assoc, assoc]
rw [h]
simp only [op_comp, assoc, FunctorToTypes.map_comp_apply]
refine ⟨hU.amalgamate t hT, ?_, ?_⟩
· rintro Z _ ⟨Y, f, g, hg, hf, rfl⟩
rw [op_comp, FunctorToTypes.map_comp_apply, Presieve.IsSheafFor.valid_glue _ _ _ hg]
apply ht hg _ hf
· intro y hy
apply hU.isSeparatedFor.ext
intro Y f hf
apply (hB hf).isSeparatedFor.ext
intro Z g hg
rw [← FunctorToTypes.map_comp_apply, ← op_comp, hy _ (Presieve.bind_comp _ _ hg),
hU.valid_glue _ _ hf, ht hf _ hg]
#align category_theory.sheaf.is_sheaf_for_bind CategoryTheory.Sheaf.isSheafFor_bind
| Mathlib/CategoryTheory/Sites/Canonical.lean | 125 | 150 | theorem isSheafFor_trans (P : Cᵒᵖ ⥤ Type v) (R S : Sieve X)
(hR : Presieve.IsSheafFor P (R : Presieve X))
(hR' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : S f), Presieve.IsSeparatedFor P (R.pullback f : Presieve Y))
(hS : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : R f), Presieve.IsSheafFor P (S.pullback f : Presieve Y)) :
Presieve.IsSheafFor P (S : Presieve X) := by |
have : (bind R fun Y f _ => S.pullback f : Presieve X) ≤ S := by
rintro Z f ⟨W, f, g, hg, hf : S _, rfl⟩
apply hf
apply Presieve.isSheafFor_subsieve_aux P this
· apply isSheafFor_bind _ _ _ hR hS
intro Y f hf Z g
rw [← pullback_comp]
apply (hS (R.downward_closed hf _)).isSeparatedFor
· intro Y f hf
have : Sieve.pullback f (bind R fun T (k : T ⟶ X) (_ : R k) => pullback k S) =
R.pullback f := by
ext Z g
constructor
· rintro ⟨W, k, l, hl, _, comm⟩
rw [pullback_apply, ← comm]
simp [hl]
· intro a
refine ⟨Z, 𝟙 Z, _, a, ?_⟩
simp [hf]
rw [this]
apply hR' hf
| 21 |
import Mathlib.LinearAlgebra.Basis.VectorSpace
import Mathlib.LinearAlgebra.Dimension.Finite
import Mathlib.SetTheory.Cardinal.Subfield
import Mathlib.LinearAlgebra.Dimension.RankNullity
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u₀ u v v' v'' u₁' w w'
variable {K R : Type u} {V V₁ V₂ V₃ : Type v} {V' V'₁ : Type v'} {V'' : Type v''}
variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*}
open Cardinal Basis Submodule Function Set
section Module
section Basis
open FiniteDimensional
variable [DivisionRing K] [AddCommGroup V] [Module K V]
theorem linearIndependent_of_top_le_span_of_card_eq_finrank {ι : Type*} [Fintype ι] {b : ι → V}
(spans : ⊤ ≤ span K (Set.range b)) (card_eq : Fintype.card ι = finrank K V) :
LinearIndependent K b :=
linearIndependent_iff'.mpr fun s g dependent i i_mem_s => by
classical
by_contra gx_ne_zero
-- We'll derive a contradiction by showing `b '' (univ \ {i})` of cardinality `n - 1`
-- spans a vector space of dimension `n`.
refine not_le_of_gt (span_lt_top_of_card_lt_finrank
(show (b '' (Set.univ \ {i})).toFinset.card < finrank K V from ?_)) ?_
· calc
(b '' (Set.univ \ {i})).toFinset.card = ((Set.univ \ {i}).toFinset.image b).card := by
rw [Set.toFinset_card, Fintype.card_ofFinset]
_ ≤ (Set.univ \ {i}).toFinset.card := Finset.card_image_le
_ = (Finset.univ.erase i).card := (congr_arg Finset.card (Finset.ext (by simp [and_comm])))
_ < Finset.univ.card := Finset.card_erase_lt_of_mem (Finset.mem_univ i)
_ = finrank K V := card_eq
-- We already have that `b '' univ` spans the whole space,
-- so we only need to show that the span of `b '' (univ \ {i})` contains each `b j`.
refine spans.trans (span_le.mpr ?_)
rintro _ ⟨j, rfl, rfl⟩
-- The case that `j ≠ i` is easy because `b j ∈ b '' (univ \ {i})`.
by_cases j_eq : j = i
swap
· refine subset_span ⟨j, (Set.mem_diff _).mpr ⟨Set.mem_univ _, ?_⟩, rfl⟩
exact mt Set.mem_singleton_iff.mp j_eq
-- To show `b i ∈ span (b '' (univ \ {i}))`, we use that it's a weighted sum
-- of the other `b j`s.
rw [j_eq, SetLike.mem_coe, show b i = -((g i)⁻¹ • (s.erase i).sum fun j => g j • b j) from _]
· refine neg_mem (smul_mem _ _ (sum_mem fun k hk => ?_))
obtain ⟨k_ne_i, _⟩ := Finset.mem_erase.mp hk
refine smul_mem _ _ (subset_span ⟨k, ?_, rfl⟩)
simp_all only [Set.mem_univ, Set.mem_diff, Set.mem_singleton_iff, and_self, not_false_eq_true]
-- To show `b i` is a weighted sum of the other `b j`s, we'll rewrite this sum
-- to have the form of the assumption `dependent`.
apply eq_neg_of_add_eq_zero_left
calc
(b i + (g i)⁻¹ • (s.erase i).sum fun j => g j • b j) =
(g i)⁻¹ • (g i • b i + (s.erase i).sum fun j => g j • b j) := by
rw [smul_add, ← mul_smul, inv_mul_cancel gx_ne_zero, one_smul]
_ = (g i)⁻¹ • (0 : V) := congr_arg _ ?_
_ = 0 := smul_zero _
-- And then it's just a bit of manipulation with finite sums.
rwa [← Finset.insert_erase i_mem_s, Finset.sum_insert (Finset.not_mem_erase _ _)] at dependent
#align linear_independent_of_top_le_span_of_card_eq_finrank linearIndependent_of_top_le_span_of_card_eq_finrank
| Mathlib/LinearAlgebra/Dimension/DivisionRing.lean | 171 | 193 | theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by |
constructor
· intro h
exact (finrank_span_eq_card h).symm
· intro hc
let f := Submodule.subtype (span K (Set.range b))
let b' : ι → span K (Set.range b) := fun i =>
⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
have hs : ⊤ ≤ span K (Set.range b') := by
intro x
have h : span K (f '' Set.range b') = map f (span K (Set.range b')) := span_image f
have hf : f '' Set.range b' = Set.range b := by
ext x
simp [f, Set.mem_image, Set.mem_range]
rw [hf] at h
have hx : (x : V) ∈ span K (Set.range b) := x.property
conv at hx =>
arg 2
rw [h]
simpa [f, mem_map] using hx
have hi : LinearMap.ker f = ⊥ := ker_subtype _
convert (linearIndependent_of_top_le_span_of_card_eq_finrank hs hc).map' _ hi
| 21 |
import Mathlib.Order.Filter.Partial
import Mathlib.Topology.Basic
#align_import topology.partial from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Filter
open Topology
variable {X Y : Type*} [TopologicalSpace X]
theorem rtendsto_nhds {r : Rel Y X} {l : Filter Y} {x : X} :
RTendsto r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.core s ∈ l :=
all_mem_nhds_filter _ _ (fun _s _t => id) _
#align rtendsto_nhds rtendsto_nhds
theorem rtendsto'_nhds {r : Rel Y X} {l : Filter Y} {x : X} :
RTendsto' r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.preimage s ∈ l := by
rw [rtendsto'_def]
apply all_mem_nhds_filter
apply Rel.preimage_mono
#align rtendsto'_nhds rtendsto'_nhds
theorem ptendsto_nhds {f : Y →. X} {l : Filter Y} {x : X} :
PTendsto f l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → f.core s ∈ l :=
rtendsto_nhds
#align ptendsto_nhds ptendsto_nhds
theorem ptendsto'_nhds {f : Y →. X} {l : Filter Y} {x : X} :
PTendsto' f l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → f.preimage s ∈ l :=
rtendsto'_nhds
#align ptendsto'_nhds ptendsto'_nhds
variable [TopologicalSpace Y]
def PContinuous (f : X →. Y) :=
∀ s, IsOpen s → IsOpen (f.preimage s)
#align pcontinuous PContinuous
theorem open_dom_of_pcontinuous {f : X →. Y} (h : PContinuous f) : IsOpen f.Dom := by
rw [← PFun.preimage_univ]; exact h _ isOpen_univ
#align open_dom_of_pcontinuous open_dom_of_pcontinuous
| Mathlib/Topology/Partial.lean | 61 | 83 | theorem pcontinuous_iff' {f : X →. Y} :
PContinuous f ↔ ∀ {x y} (h : y ∈ f x), PTendsto' f (𝓝 x) (𝓝 y) := by |
constructor
· intro h x y h'
simp only [ptendsto'_def, mem_nhds_iff]
rintro s ⟨t, tsubs, opent, yt⟩
exact ⟨f.preimage t, PFun.preimage_mono _ tsubs, h _ opent, ⟨y, yt, h'⟩⟩
intro hf s os
rw [isOpen_iff_nhds]
rintro x ⟨y, ys, fxy⟩ t
rw [mem_principal]
intro (h : f.preimage s ⊆ t)
change t ∈ 𝓝 x
apply mem_of_superset _ h
have h' : ∀ s ∈ 𝓝 y, f.preimage s ∈ 𝓝 x := by
intro s hs
have : PTendsto' f (𝓝 x) (𝓝 y) := hf fxy
rw [ptendsto'_def] at this
exact this s hs
show f.preimage s ∈ 𝓝 x
apply h'
rw [mem_nhds_iff]
exact ⟨s, Set.Subset.refl _, os, ys⟩
| 21 |
import Mathlib.MeasureTheory.MeasurableSpace.Defs
import Mathlib.SetTheory.Cardinal.Cofinality
import Mathlib.SetTheory.Cardinal.Continuum
#align_import measure_theory.card_measurable_space from "leanprover-community/mathlib"@"f2b108e8e97ba393f22bf794989984ddcc1da89b"
universe u
variable {α : Type u}
open Cardinal Set
-- Porting note: fix universe below, not here
local notation "ω₁" => (WellOrder.α <| Quotient.out <| Cardinal.ord (aleph 1 : Cardinal))
namespace MeasurableSpace
def generateMeasurableRec (s : Set (Set α)) : (ω₁ : Type u) → Set (Set α)
| i =>
let S := ⋃ j : Iio i, generateMeasurableRec s (j.1)
s ∪ {∅} ∪ compl '' S ∪ Set.range fun f : ℕ → S => ⋃ n, (f n).1
termination_by i => i
decreasing_by exact j.2
#align measurable_space.generate_measurable_rec MeasurableSpace.generateMeasurableRec
theorem self_subset_generateMeasurableRec (s : Set (Set α)) (i : ω₁) :
s ⊆ generateMeasurableRec s i := by
unfold generateMeasurableRec
apply_rules [subset_union_of_subset_left]
exact subset_rfl
#align measurable_space.self_subset_generate_measurable_rec MeasurableSpace.self_subset_generateMeasurableRec
theorem empty_mem_generateMeasurableRec (s : Set (Set α)) (i : ω₁) :
∅ ∈ generateMeasurableRec s i := by
unfold generateMeasurableRec
exact mem_union_left _ (mem_union_left _ (mem_union_right _ (mem_singleton ∅)))
#align measurable_space.empty_mem_generate_measurable_rec MeasurableSpace.empty_mem_generateMeasurableRec
theorem compl_mem_generateMeasurableRec {s : Set (Set α)} {i j : ω₁} (h : j < i) {t : Set α}
(ht : t ∈ generateMeasurableRec s j) : tᶜ ∈ generateMeasurableRec s i := by
unfold generateMeasurableRec
exact mem_union_left _ (mem_union_right _ ⟨t, mem_iUnion.2 ⟨⟨j, h⟩, ht⟩, rfl⟩)
#align measurable_space.compl_mem_generate_measurable_rec MeasurableSpace.compl_mem_generateMeasurableRec
theorem iUnion_mem_generateMeasurableRec {s : Set (Set α)} {i : ω₁} {f : ℕ → Set α}
(hf : ∀ n, ∃ j < i, f n ∈ generateMeasurableRec s j) :
(⋃ n, f n) ∈ generateMeasurableRec s i := by
unfold generateMeasurableRec
exact mem_union_right _ ⟨fun n => ⟨f n, let ⟨j, hj, hf⟩ := hf n; mem_iUnion.2 ⟨⟨j, hj⟩, hf⟩⟩, rfl⟩
#align measurable_space.Union_mem_generate_measurable_rec MeasurableSpace.iUnion_mem_generateMeasurableRec
theorem generateMeasurableRec_subset (s : Set (Set α)) {i j : ω₁} (h : i ≤ j) :
generateMeasurableRec s i ⊆ generateMeasurableRec s j := fun x hx => by
rcases eq_or_lt_of_le h with (rfl | h)
· exact hx
· convert iUnion_mem_generateMeasurableRec fun _ => ⟨i, h, hx⟩
exact (iUnion_const x).symm
#align measurable_space.generate_measurable_rec_subset MeasurableSpace.generateMeasurableRec_subset
| Mathlib/MeasureTheory/MeasurableSpace/Card.lean | 91 | 113 | theorem cardinal_generateMeasurableRec_le (s : Set (Set α)) (i : ω₁) :
#(generateMeasurableRec s i) ≤ max #s 2 ^ aleph0.{u} := by |
apply (aleph 1).ord.out.wo.wf.induction i
intro i IH
have A := aleph0_le_aleph 1
have B : aleph 1 ≤ max #s 2 ^ aleph0.{u} :=
aleph_one_le_continuum.trans (power_le_power_right (le_max_right _ _))
have C : ℵ₀ ≤ max #s 2 ^ aleph0.{u} := A.trans B
have J : #(⋃ j : Iio i, generateMeasurableRec s j.1) ≤ max #s 2 ^ aleph0.{u} := by
refine (mk_iUnion_le _).trans ?_
have D : ⨆ j : Iio i, #(generateMeasurableRec s j) ≤ _ := ciSup_le' fun ⟨j, hj⟩ => IH j hj
apply (mul_le_mul' ((mk_subtype_le _).trans (aleph 1).mk_ord_out.le) D).trans
rw [mul_eq_max A C]
exact max_le B le_rfl
rw [generateMeasurableRec]
apply_rules [(mk_union_le _ _).trans, add_le_of_le C, mk_image_le.trans]
· exact (le_max_left _ _).trans (self_le_power _ one_lt_aleph0.le)
· rw [mk_singleton]
exact one_lt_aleph0.le.trans C
· apply mk_range_le.trans
simp only [mk_pi, prod_const, lift_uzero, mk_denumerable, lift_aleph0]
have := @power_le_power_right _ _ ℵ₀ J
rwa [← power_mul, aleph0_mul_aleph0] at this
| 21 |
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.Probability.Kernel.Disintegration.CdfToKernel
#align_import probability.kernel.cond_cdf from "leanprover-community/mathlib"@"3b88f4005dc2e28d42f974cc1ce838f0dafb39b8"
open MeasureTheory Set Filter TopologicalSpace
open scoped NNReal ENNReal MeasureTheory Topology
namespace MeasureTheory.Measure
variable {α β : Type*} {mα : MeasurableSpace α} (ρ : Measure (α × ℝ))
noncomputable def IicSnd (r : ℝ) : Measure α :=
(ρ.restrict (univ ×ˢ Iic r)).fst
#align measure_theory.measure.Iic_snd MeasureTheory.Measure.IicSnd
theorem IicSnd_apply (r : ℝ) {s : Set α} (hs : MeasurableSet s) :
ρ.IicSnd r s = ρ (s ×ˢ Iic r) := by
rw [IicSnd, fst_apply hs,
restrict_apply' (MeasurableSet.univ.prod (measurableSet_Iic : MeasurableSet (Iic r))), ←
prod_univ, prod_inter_prod, inter_univ, univ_inter]
#align measure_theory.measure.Iic_snd_apply MeasureTheory.Measure.IicSnd_apply
theorem IicSnd_univ (r : ℝ) : ρ.IicSnd r univ = ρ (univ ×ˢ Iic r) :=
IicSnd_apply ρ r MeasurableSet.univ
#align measure_theory.measure.Iic_snd_univ MeasureTheory.Measure.IicSnd_univ
theorem IicSnd_mono {r r' : ℝ} (h_le : r ≤ r') : ρ.IicSnd r ≤ ρ.IicSnd r' := by
refine Measure.le_iff.2 fun s hs ↦ ?_
simp_rw [IicSnd_apply ρ _ hs]
refine measure_mono (prod_subset_prod_iff.mpr (Or.inl ⟨subset_rfl, Iic_subset_Iic.mpr ?_⟩))
exact mod_cast h_le
#align measure_theory.measure.Iic_snd_mono MeasureTheory.Measure.IicSnd_mono
theorem IicSnd_le_fst (r : ℝ) : ρ.IicSnd r ≤ ρ.fst := by
refine Measure.le_iff.2 fun s hs ↦ ?_
simp_rw [fst_apply hs, IicSnd_apply ρ r hs]
exact measure_mono (prod_subset_preimage_fst _ _)
#align measure_theory.measure.Iic_snd_le_fst MeasureTheory.Measure.IicSnd_le_fst
theorem IicSnd_ac_fst (r : ℝ) : ρ.IicSnd r ≪ ρ.fst :=
Measure.absolutelyContinuous_of_le (IicSnd_le_fst ρ r)
#align measure_theory.measure.Iic_snd_ac_fst MeasureTheory.Measure.IicSnd_ac_fst
theorem IsFiniteMeasure.IicSnd {ρ : Measure (α × ℝ)} [IsFiniteMeasure ρ] (r : ℝ) :
IsFiniteMeasure (ρ.IicSnd r) :=
isFiniteMeasure_of_le _ (IicSnd_le_fst ρ _)
#align measure_theory.measure.is_finite_measure.Iic_snd MeasureTheory.Measure.IsFiniteMeasure.IicSnd
theorem iInf_IicSnd_gt (t : ℚ) {s : Set α} (hs : MeasurableSet s) [IsFiniteMeasure ρ] :
⨅ r : { r' : ℚ // t < r' }, ρ.IicSnd r s = ρ.IicSnd t s := by
simp_rw [ρ.IicSnd_apply _ hs, Measure.iInf_rat_gt_prod_Iic hs]
#align measure_theory.measure.infi_Iic_snd_gt MeasureTheory.Measure.iInf_IicSnd_gt
theorem tendsto_IicSnd_atTop {s : Set α} (hs : MeasurableSet s) :
Tendsto (fun r : ℚ ↦ ρ.IicSnd r s) atTop (𝓝 (ρ.fst s)) := by
simp_rw [ρ.IicSnd_apply _ hs, fst_apply hs, ← prod_univ]
rw [← Real.iUnion_Iic_rat, prod_iUnion]
refine tendsto_measure_iUnion fun r q hr_le_q x ↦ ?_
simp only [mem_prod, mem_Iic, and_imp]
refine fun hxs hxr ↦ ⟨hxs, hxr.trans ?_⟩
exact mod_cast hr_le_q
#align measure_theory.measure.tendsto_Iic_snd_at_top MeasureTheory.Measure.tendsto_IicSnd_atTop
| Mathlib/Probability/Kernel/Disintegration/CondCdf.lean | 102 | 124 | theorem tendsto_IicSnd_atBot [IsFiniteMeasure ρ] {s : Set α} (hs : MeasurableSet s) :
Tendsto (fun r : ℚ ↦ ρ.IicSnd r s) atBot (𝓝 0) := by |
simp_rw [ρ.IicSnd_apply _ hs]
have h_empty : ρ (s ×ˢ ∅) = 0 := by simp only [prod_empty, measure_empty]
rw [← h_empty, ← Real.iInter_Iic_rat, prod_iInter]
suffices h_neg :
Tendsto (fun r : ℚ ↦ ρ (s ×ˢ Iic ↑(-r))) atTop (𝓝 (ρ (⋂ r : ℚ, s ×ˢ Iic ↑(-r)))) by
have h_inter_eq : ⋂ r : ℚ, s ×ˢ Iic ↑(-r) = ⋂ r : ℚ, s ×ˢ Iic (r : ℝ) := by
ext1 x
simp only [Rat.cast_eq_id, id, mem_iInter, mem_prod, mem_Iic]
refine ⟨fun h i ↦ ⟨(h i).1, ?_⟩, fun h i ↦ ⟨(h i).1, ?_⟩⟩ <;> have h' := h (-i)
· rw [neg_neg] at h'; exact h'.2
· exact h'.2
rw [h_inter_eq] at h_neg
have h_fun_eq : (fun r : ℚ ↦ ρ (s ×ˢ Iic (r : ℝ))) = fun r : ℚ ↦ ρ (s ×ˢ Iic ↑(- -r)) := by
simp_rw [neg_neg]
rw [h_fun_eq]
exact h_neg.comp tendsto_neg_atBot_atTop
refine tendsto_measure_iInter (fun q ↦ hs.prod measurableSet_Iic) ?_ ⟨0, measure_ne_top ρ _⟩
refine fun q r hqr ↦ prod_subset_prod_iff.mpr (Or.inl ⟨subset_rfl, fun x hx ↦ ?_⟩)
simp only [Rat.cast_neg, mem_Iic] at hx ⊢
refine hx.trans (neg_le_neg ?_)
exact mod_cast hqr
| 21 |
import Mathlib.LinearAlgebra.FreeModule.PID
import Mathlib.LinearAlgebra.FreeModule.Finite.Basic
import Mathlib.LinearAlgebra.BilinearForm.DualLattice
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.Localization.Module
import Mathlib.RingTheory.Trace
#align_import ring_theory.dedekind_domain.integral_closure from "leanprover-community/mathlib"@"4cf7ca0e69e048b006674cf4499e5c7d296a89e0"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
variable [IsDomain A]
section IsIntegralClosure
open Algebra
variable [Algebra A K] [IsFractionRing A K]
variable (L : Type*) [Field L] (C : Type*) [CommRing C]
variable [Algebra K L] [Algebra A L] [IsScalarTower A K L]
variable [Algebra C L] [IsIntegralClosure C A L] [Algebra A C] [IsScalarTower A C L]
theorem IsIntegralClosure.isLocalization [Algebra.IsAlgebraic K L] :
IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
haveI : IsDomain C :=
(IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L)
haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L
haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L
refine ⟨?_, fun z => ?_, fun {x y} h => ⟨1, ?_⟩⟩
· rintro ⟨_, x, hx, rfl⟩
rw [isUnit_iff_ne_zero, map_ne_zero_iff _ (IsIntegralClosure.algebraMap_injective C A L),
Subtype.coe_mk, map_ne_zero_iff _ (NoZeroSMulDivisors.algebraMap_injective A C)]
exact mem_nonZeroDivisors_iff_ne_zero.mp hx
· obtain ⟨m, hm⟩ :=
IsIntegral.exists_multiple_integral_of_isLocalization A⁰ z
(Algebra.IsIntegral.isIntegral (R := K) z)
obtain ⟨x, hx⟩ : ∃ x, algebraMap C L x = m • z := IsIntegralClosure.isIntegral_iff.mp hm
refine ⟨⟨x, algebraMap A C m, m, SetLike.coe_mem m, rfl⟩, ?_⟩
rw [Subtype.coe_mk, ← IsScalarTower.algebraMap_apply, hx, mul_comm, Submonoid.smul_def,
smul_def]
· simp only [IsIntegralClosure.algebraMap_injective C A L h]
theorem IsIntegralClosure.isLocalization_of_isSeparable [IsSeparable K L] :
IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L :=
IsIntegralClosure.isLocalization A K L C
#align is_integral_closure.is_localization IsIntegralClosure.isLocalization_of_isSeparable
variable [FiniteDimensional K L]
variable {A K L}
theorem IsIntegralClosure.range_le_span_dualBasis [IsSeparable K L] {ι : Type*} [Fintype ι]
[DecidableEq ι] (b : Basis ι K L) (hb_int : ∀ i, IsIntegral A (b i)) [IsIntegrallyClosed A] :
LinearMap.range ((Algebra.linearMap C L).restrictScalars A) ≤
Submodule.span A (Set.range <| (traceForm K L).dualBasis (traceForm_nondegenerate K L) b) := by
rw [← LinearMap.BilinForm.dualSubmodule_span_of_basis,
← LinearMap.BilinForm.le_flip_dualSubmodule, Submodule.span_le]
rintro _ ⟨i, rfl⟩ _ ⟨y, rfl⟩
simp only [LinearMap.coe_restrictScalars, linearMap_apply, LinearMap.BilinForm.flip_apply,
traceForm_apply]
refine IsIntegrallyClosed.isIntegral_iff.mp ?_
exact isIntegral_trace ((IsIntegralClosure.isIntegral A L y).algebraMap.mul (hb_int i))
#align is_integral_closure.range_le_span_dual_basis IsIntegralClosure.range_le_span_dualBasis
theorem integralClosure_le_span_dualBasis [IsSeparable K L] {ι : Type*} [Fintype ι] [DecidableEq ι]
(b : Basis ι K L) (hb_int : ∀ i, IsIntegral A (b i)) [IsIntegrallyClosed A] :
Subalgebra.toSubmodule (integralClosure A L) ≤
Submodule.span A (Set.range <| (traceForm K L).dualBasis (traceForm_nondegenerate K L) b) := by
refine le_trans ?_ (IsIntegralClosure.range_le_span_dualBasis (integralClosure A L) b hb_int)
intro x hx
exact ⟨⟨x, hx⟩, rfl⟩
#align integral_closure_le_span_dual_basis integralClosure_le_span_dualBasis
variable (A K)
theorem exists_integral_multiples (s : Finset L) :
∃ y ≠ (0 : A), ∀ x ∈ s, IsIntegral A (y • x) := by
haveI := Classical.decEq L
refine s.induction ?_ ?_
· use 1, one_ne_zero
rintro x ⟨⟩
· rintro x s hx ⟨y, hy, hs⟩
have := exists_integral_multiple
((IsFractionRing.isAlgebraic_iff A K L).mpr (.of_finite _ x))
((injective_iff_map_eq_zero (algebraMap A L)).mp ?_)
· rcases this with ⟨x', y', hy', hx'⟩
refine ⟨y * y', mul_ne_zero hy hy', fun x'' hx'' => ?_⟩
rcases Finset.mem_insert.mp hx'' with (rfl | hx'')
· rw [mul_smul, Algebra.smul_def, Algebra.smul_def, mul_comm _ x'', hx']
exact isIntegral_algebraMap.mul x'.2
· rw [mul_comm, mul_smul, Algebra.smul_def]
exact isIntegral_algebraMap.mul (hs _ hx'')
· rw [IsScalarTower.algebraMap_eq A K L]
apply (algebraMap K L).injective.comp
exact IsFractionRing.injective _ _
#align exists_integral_multiples exists_integral_multiples
variable (L)
| Mathlib/RingTheory/DedekindDomain/IntegralClosure.lean | 145 | 167 | theorem FiniteDimensional.exists_is_basis_integral :
∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by |
letI := Classical.decEq L
letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
let s' := IsNoetherian.finsetBasisIndex K L
let bs' := IsNoetherian.finsetBasis K L
obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
have hy' : algebraMap A L y ≠ 0 := by
refine mt ((injective_iff_map_eq_zero (algebraMap A L)).mp ?_ _) hy
rw [IsScalarTower.algebraMap_eq A K L]
exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
refine ⟨s', bs'.map {Algebra.lmul _ _ (algebraMap A L y) with
toFun := fun x => algebraMap A L y * x
invFun := fun x => (algebraMap A L y)⁻¹ * x
left_inv := ?_
right_inv := ?_}, ?_⟩
· intro x; simp only [inv_mul_cancel_left₀ hy']
· intro x; simp only [mul_inv_cancel_left₀ hy']
· rintro ⟨x', hx'⟩
simp only [Algebra.smul_def, Finset.mem_image, exists_prop, Finset.mem_univ,
true_and_iff] at his'
simp only [Basis.map_apply, LinearEquiv.coe_mk]
exact his' _ ⟨_, rfl⟩
| 21 |
import Mathlib.Data.PFunctor.Multivariate.Basic
#align_import data.qpf.multivariate.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u
open MvFunctor
class MvQPF {n : ℕ} (F : TypeVec.{u} n → Type*) [MvFunctor F] where
P : MvPFunctor.{u} n
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α ⟹ β) (p : P α), abs (f <$$> p) = f <$$> abs p
#align mvqpf MvQPF
namespace MvQPF
variable {n : ℕ} {F : TypeVec.{u} n → Type*} [MvFunctor F] [q : MvQPF F]
open MvFunctor (LiftP LiftR)
protected theorem id_map {α : TypeVec n} (x : F α) : TypeVec.id <$$> x = x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map]
rfl
#align mvqpf.id_map MvQPF.id_map
@[simp]
theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) (x : F α) :
(g ⊚ f) <$$> x = g <$$> f <$$> x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map, ← abs_map, ← abs_map]
rfl
#align mvqpf.comp_map MvQPF.comp_map
instance (priority := 100) lawfulMvFunctor : LawfulMvFunctor F where
id_map := @MvQPF.id_map n F _ _
comp_map := @comp_map n F _ _
#align mvqpf.is_lawful_mvfunctor MvQPF.lawfulMvFunctor
-- Lifting predicates and relations
theorem liftP_iff {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (x : F α) :
LiftP p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i j, p (f i j) := by
constructor
· rintro ⟨y, hy⟩
cases' h : repr y with a f
use a, fun i j => (f i j).val
constructor
· rw [← hy, ← abs_repr y, h, ← abs_map]; rfl
intro i j
apply (f i j).property
rintro ⟨a, f, h₀, h₁⟩
use abs ⟨a, fun i j => ⟨f i j, h₁ i j⟩⟩
rw [← abs_map, h₀]; rfl
#align mvqpf.liftp_iff MvQPF.liftP_iff
theorem liftR_iff {α : TypeVec n} (r : ∀ {i}, α i → α i → Prop) (x y : F α) :
LiftR r x y ↔ ∃ a f₀ f₁, x = abs ⟨a, f₀⟩ ∧ y = abs ⟨a, f₁⟩ ∧ ∀ i j, r (f₀ i j) (f₁ i j) := by
constructor
· rintro ⟨u, xeq, yeq⟩
cases' h : repr u with a f
use a, fun i j => (f i j).val.fst, fun i j => (f i j).val.snd
constructor
· rw [← xeq, ← abs_repr u, h, ← abs_map]; rfl
constructor
· rw [← yeq, ← abs_repr u, h, ← abs_map]; rfl
intro i j
exact (f i j).property
rintro ⟨a, f₀, f₁, xeq, yeq, h⟩
use abs ⟨a, fun i j => ⟨(f₀ i j, f₁ i j), h i j⟩⟩
dsimp; constructor
· rw [xeq, ← abs_map]; rfl
rw [yeq, ← abs_map]; rfl
#align mvqpf.liftr_iff MvQPF.liftR_iff
open Set
open MvFunctor (LiftP LiftR)
theorem mem_supp {α : TypeVec n} (x : F α) (i) (u : α i) :
u ∈ supp x i ↔ ∀ a f, abs ⟨a, f⟩ = x → u ∈ f i '' univ := by
rw [supp]; dsimp; constructor
· intro h a f haf
have : LiftP (fun i u => u ∈ f i '' univ) x := by
rw [liftP_iff]
refine ⟨a, f, haf.symm, ?_⟩
intro i u
exact mem_image_of_mem _ (mem_univ _)
exact h this
intro h p; rw [liftP_iff]
rintro ⟨a, f, xeq, h'⟩
rcases h a f xeq.symm with ⟨i, _, hi⟩
rw [← hi]; apply h'
#align mvqpf.mem_supp MvQPF.mem_supp
theorem supp_eq {α : TypeVec n} {i} (x : F α) :
supp x i = { u | ∀ a f, abs ⟨a, f⟩ = x → u ∈ f i '' univ } := by ext; apply mem_supp
#align mvqpf.supp_eq MvQPF.supp_eq
| Mathlib/Data/QPF/Multivariate/Basic.lean | 184 | 207 | theorem has_good_supp_iff {α : TypeVec n} (x : F α) :
(∀ p, LiftP p x ↔ ∀ (i), ∀ u ∈ supp x i, p i u) ↔
∃ a f, abs ⟨a, f⟩ = x ∧ ∀ i a' f', abs ⟨a', f'⟩ = x → f i '' univ ⊆ f' i '' univ := by |
constructor
· intro h
have : LiftP (supp x) x := by rw [h]; introv; exact id
rw [liftP_iff] at this
rcases this with ⟨a, f, xeq, h'⟩
refine ⟨a, f, xeq.symm, ?_⟩
intro a' f' h''
rintro hu u ⟨j, _h₂, hfi⟩
have hh : u ∈ supp x a' := by rw [← hfi]; apply h'
exact (mem_supp x _ u).mp hh _ _ hu
rintro ⟨a, f, xeq, h⟩ p; rw [liftP_iff]; constructor
· rintro ⟨a', f', xeq', h'⟩ i u usuppx
rcases (mem_supp x _ u).mp (@usuppx) a' f' xeq'.symm with ⟨i, _, f'ieq⟩
rw [← f'ieq]
apply h'
intro h'
refine ⟨a, f, xeq.symm, ?_⟩; intro j y
apply h'; rw [mem_supp]
intro a' f' xeq'
apply h _ a' f' xeq'
apply mem_image_of_mem _ (mem_univ _)
| 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.