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
complexity_score
float64
2.72
139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000B
diff_level
int64
0
2
file_diff_level
float64
0
2
theorem_same_file
int64
1
32
rank_file
int64
0
2.51k
import Mathlib.Order.PrimeIdeal import Mathlib.Order.Zorn universe u variable {α : Type*} open Order Ideal Set variable [DistribLattice α] [BoundedOrder α] variable {F : PFilter α} {I : Ideal α} namespace DistribLattice lemma mem_ideal_sup_principal (a b : α) (J : Ideal α) : b ∈ J ⊔ principal a ↔ ∃ j ∈ J, b ≤ j ⊔ a := ⟨fun ⟨j, ⟨jJ, _, ha', bja'⟩⟩ => ⟨j, jJ, le_trans bja' (sup_le_sup_left ha' j)⟩, fun ⟨j, hj, hbja⟩ => ⟨j, hj, a, le_refl a, hbja⟩⟩
Mathlib/Order/PrimeSeparator.lean
46
143
theorem prime_ideal_of_disjoint_filter_ideal (hFI : Disjoint (F : Set α) (I : Set α)) : ∃ J : Ideal α, (IsPrime J) ∧ I ≤ J ∧ Disjoint (F : Set α) J := by
-- Let S be the set of ideals containing I and disjoint from F. set S : Set (Set α) := { J : Set α | IsIdeal J ∧ I ≤ J ∧ Disjoint (F : Set α) J } -- Then I is in S... have IinS : ↑I ∈ S := by refine ⟨Order.Ideal.isIdeal I, by trivial⟩ -- ...and S contains upper bounds for any non-empty chains. have chainub : ∀ c ⊆ S, IsChain (· ⊆ ·) c → c.Nonempty → ∃ ub ∈ S, ∀ s ∈ c, s ⊆ ub := by intros c hcS hcC hcNe use sUnion c refine ⟨?_, fun s hs ↦ le_sSup hs⟩ simp only [le_eq_subset, mem_setOf_eq, disjoint_sUnion_right, S] let ⟨J, hJ⟩ := hcNe refine ⟨Order.isIdeal_sUnion_of_isChain (fun _ hJ ↦ (hcS hJ).1) hcC hcNe, ⟨le_trans (hcS hJ).2.1 (le_sSup hJ), fun J hJ ↦ (hcS hJ).2.2⟩⟩ -- Thus, by Zorn's lemma, we can pick a maximal ideal J in S. obtain ⟨Jset, ⟨Jidl, IJ, JF⟩, ⟨_, Jmax⟩⟩ := zorn_subset_nonempty S chainub I IinS set J := IsIdeal.toIdeal Jidl use J have IJ' : I ≤ J := IJ clear chainub IinS -- By construction, J contains I and is disjoint from F. It remains to prove that J is prime. refine ⟨?_, ⟨IJ, JF⟩⟩ -- First note that J is proper: ⊤ ∈ F so ⊤ ∉ J because F and J are disjoint. have Jpr : IsProper J := isProper_of_not_mem (Set.disjoint_left.1 JF F.top_mem) -- Suppose that a₁ ∉ J, a₂ ∉ J. We need to prove that a₁ ⊔ a₂ ∉ J. rw [isPrime_iff_mem_or_mem] intros a₁ a₂ contrapose! intro ⟨ha₁, ha₂⟩ -- Consider the ideals J₁, J₂ generated by J ∪ {a₁} and J ∪ {a₂}, respectively. let J₁ := J ⊔ principal a₁ let J₂ := J ⊔ principal a₂ -- For each i, Jᵢ is an ideal that contains aᵢ, and is not equal to J. have a₁J₁ : a₁ ∈ J₁ := mem_of_subset_of_mem (le_sup_right : _ ≤ J ⊔ _) mem_principal_self have a₂J₂ : a₂ ∈ J₂ := mem_of_subset_of_mem (le_sup_right : _ ≤ J ⊔ _) mem_principal_self have J₁J : ↑J₁ ≠ Jset := ne_of_mem_of_not_mem' a₁J₁ ha₁ have J₂J : ↑J₂ ≠ Jset := ne_of_mem_of_not_mem' a₂J₂ ha₂ -- Therefore, since J is maximal, we must have Jᵢ ∉ S. have J₁S : ↑J₁ ∉ S := fun h => J₁J (Jmax J₁ h (le_sup_left : J ≤ J₁)) have J₂S : ↑J₂ ∉ S := fun h => J₂J (Jmax J₂ h (le_sup_left : J ≤ J₂)) -- Since Jᵢ is an ideal that contains I, we have that Jᵢ is not disjoint from F. have J₁F : ¬ (Disjoint (F : Set α) J₁) := by intro hdis apply J₁S simp only [le_eq_subset, mem_setOf_eq, SetLike.coe_subset_coe, S] exact ⟨J₁.isIdeal, le_trans IJ' le_sup_left, hdis⟩ have J₂F : ¬ (Disjoint (F : Set α) J₂) := by intro hdis apply J₂S simp only [le_eq_subset, mem_setOf_eq, SetLike.coe_subset_coe, S] exact ⟨J₂.isIdeal, le_trans IJ' le_sup_left, hdis⟩ -- Thus, pick cᵢ ∈ F ∩ Jᵢ. let ⟨c₁, ⟨c₁F, c₁J₁⟩⟩ := Set.not_disjoint_iff.1 J₁F let ⟨c₂, ⟨c₂F, c₂J₂⟩⟩ := Set.not_disjoint_iff.1 J₂F -- Using the definition of Jᵢ, we can pick bᵢ ∈ J such that cᵢ ≤ bᵢ ⊔ aᵢ. let ⟨b₁, ⟨b₁J, cba₁⟩⟩ := (mem_ideal_sup_principal a₁ c₁ J).1 c₁J₁ let ⟨b₂, ⟨b₂J, cba₂⟩⟩ := (mem_ideal_sup_principal a₂ c₂ J).1 c₂J₂ -- Since J is an ideal, we have b := b₁ ⊔ b₂ ∈ J. let b := b₁ ⊔ b₂ have bJ : b ∈ J := sup_mem b₁J b₂J -- We now prove a key inequality, using crucially that the lattice is distributive. have ineq : c₁ ⊓ c₂ ≤ b ⊔ (a₁ ⊓ a₂) := calc c₁ ⊓ c₂ ≤ (b₁ ⊔ a₁) ⊓ (b₂ ⊔ a₂) := inf_le_inf cba₁ cba₂ _ ≤ (b ⊔ a₁) ⊓ (b ⊔ a₂) := by apply inf_le_inf <;> apply sup_le_sup_right; exact le_sup_left; exact le_sup_right _ = b ⊔ (a₁ ⊓ a₂) := (sup_inf_left b a₁ a₂).symm -- Note that c₁ ⊓ c₂ ∈ F, since c₁ and c₂ are both in F and F is a filter. -- Since F is an upper set, it now follows that b ⊔ (a₁ ⊓ a₂) ∈ F. have ba₁a₂F : b ⊔ (a₁ ⊓ a₂) ∈ F := PFilter.mem_of_le ineq (PFilter.inf_mem c₁F c₂F) -- Now, if we would have a₁ ⊓ a₂ ∈ J, then, since J is an ideal and b ∈ J, we would also get -- b ⊔ (a₁ ⊓ a₂) ∈ J. But this contradicts that J is disjoint from F. contrapose! JF with ha₁a₂ rw [Set.not_disjoint_iff] use b ⊔ (a₁ ⊓ a₂) exact ⟨ba₁a₂F, sup_mem bJ ha₁a₂⟩
76
1,014,800,388,113,888,700,000,000,000,000,000
2
2
1
2,455
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.Matrix.AbsoluteValue import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.ClassGroup import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.Norm #align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176" open scoped nonZeroDivisors namespace ClassGroup open Ring section EuclideanDomain variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S] variable [Field K] [Field L] variable [Algebra R K] [IsFractionRing R K] variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L] variable [algRL : Algebra R L] [IsScalarTower R K L] variable [Algebra R S] [Algebra S L] variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L] variable (abv : AbsoluteValue R ℤ) variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S) noncomputable def normBound : ℤ := let n := Fintype.card ι let i : ι := Nonempty.some bS.index_nonempty let m : ℤ := Finset.max' (Finset.univ.image fun ijk : ι × ι × ι => abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2)) ⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩ Nat.factorial n • (n • m) ^ n #align class_group.norm_bound ClassGroup.normBound
Mathlib/NumberTheory/ClassNumber/Finite.lean
58
71
theorem normBound_pos : 0 < normBound abv bS := by
obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by by_contra! h obtain ⟨i⟩ := bS.index_nonempty apply bS.ne_zero i apply (injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS) ext j k simp [h, DMatrix.zero_apply] simp only [normBound, Algebra.smul_def, eq_natCast] apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _)) refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _ refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_) exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩
13
442,413.392009
2
2
4
2,456
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.Matrix.AbsoluteValue import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.ClassGroup import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.Norm #align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176" open scoped nonZeroDivisors namespace ClassGroup open Ring section EuclideanDomain variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S] variable [Field K] [Field L] variable [Algebra R K] [IsFractionRing R K] variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L] variable [algRL : Algebra R L] [IsScalarTower R K L] variable [Algebra R S] [Algebra S L] variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L] variable (abv : AbsoluteValue R ℤ) variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S) noncomputable def normBound : ℤ := let n := Fintype.card ι let i : ι := Nonempty.some bS.index_nonempty let m : ℤ := Finset.max' (Finset.univ.image fun ijk : ι × ι × ι => abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2)) ⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩ Nat.factorial n • (n • m) ^ n #align class_group.norm_bound ClassGroup.normBound theorem normBound_pos : 0 < normBound abv bS := by obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by by_contra! h obtain ⟨i⟩ := bS.index_nonempty apply bS.ne_zero i apply (injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS) ext j k simp [h, DMatrix.zero_apply] simp only [normBound, Algebra.smul_def, eq_natCast] apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _)) refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _ refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_) exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩ #align class_group.norm_bound_pos ClassGroup.normBound_pos
Mathlib/NumberTheory/ClassNumber/Finite.lean
76
86
theorem norm_le (a : S) {y : ℤ} (hy : ∀ k, abv (bS.repr a k) ≤ y) : abv (Algebra.norm R a) ≤ normBound abv bS * y ^ Fintype.card ι := by
conv_lhs => rw [← bS.sum_repr a] rw [Algebra.norm_apply, ← LinearMap.det_toMatrix bS] simp only [Algebra.norm_apply, AlgHom.map_sum, AlgHom.map_smul, map_sum, map_smul, Algebra.toMatrix_lmul_eq, normBound, smul_mul_assoc, ← mul_pow] convert Matrix.det_sum_smul_le Finset.univ _ hy using 3 · rw [Finset.card_univ, smul_mul_assoc, mul_comm] · intro i j k apply Finset.le_max' exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩
9
8,103.083928
2
2
4
2,456
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.Matrix.AbsoluteValue import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.ClassGroup import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.Norm #align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176" open scoped nonZeroDivisors namespace ClassGroup open Ring section EuclideanDomain variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S] variable [Field K] [Field L] variable [Algebra R K] [IsFractionRing R K] variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L] variable [algRL : Algebra R L] [IsScalarTower R K L] variable [Algebra R S] [Algebra S L] variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L] variable (abv : AbsoluteValue R ℤ) variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S) noncomputable def normBound : ℤ := let n := Fintype.card ι let i : ι := Nonempty.some bS.index_nonempty let m : ℤ := Finset.max' (Finset.univ.image fun ijk : ι × ι × ι => abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2)) ⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩ Nat.factorial n • (n • m) ^ n #align class_group.norm_bound ClassGroup.normBound theorem normBound_pos : 0 < normBound abv bS := by obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by by_contra! h obtain ⟨i⟩ := bS.index_nonempty apply bS.ne_zero i apply (injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS) ext j k simp [h, DMatrix.zero_apply] simp only [normBound, Algebra.smul_def, eq_natCast] apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _)) refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _ refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_) exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩ #align class_group.norm_bound_pos ClassGroup.normBound_pos theorem norm_le (a : S) {y : ℤ} (hy : ∀ k, abv (bS.repr a k) ≤ y) : abv (Algebra.norm R a) ≤ normBound abv bS * y ^ Fintype.card ι := by conv_lhs => rw [← bS.sum_repr a] rw [Algebra.norm_apply, ← LinearMap.det_toMatrix bS] simp only [Algebra.norm_apply, AlgHom.map_sum, AlgHom.map_smul, map_sum, map_smul, Algebra.toMatrix_lmul_eq, normBound, smul_mul_assoc, ← mul_pow] convert Matrix.det_sum_smul_le Finset.univ _ hy using 3 · rw [Finset.card_univ, smul_mul_assoc, mul_comm] · intro i j k apply Finset.le_max' exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩ #align class_group.norm_le ClassGroup.norm_le
Mathlib/NumberTheory/ClassNumber/Finite.lean
91
114
theorem norm_lt {T : Type*} [LinearOrderedRing T] (a : S) {y : T} (hy : ∀ k, (abv (bS.repr a k) : T) < y) : (abv (Algebra.norm R a) : T) < normBound abv bS * y ^ Fintype.card ι := by
obtain ⟨i⟩ := bS.index_nonempty have him : (Finset.univ.image fun k => abv (bS.repr a k)).Nonempty := ⟨_, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩⟩ set y' : ℤ := Finset.max' _ him with y'_def have hy' : ∀ k, abv (bS.repr a k) ≤ y' := by intro k exact @Finset.le_max' ℤ _ _ _ (Finset.mem_image.mpr ⟨k, Finset.mem_univ _, rfl⟩) have : (y' : T) < y := by rw [y'_def, ← Finset.max'_image (show Monotone (_ : ℤ → T) from fun x y h => Int.cast_le.mpr h)] apply (Finset.max'_lt_iff _ (him.image _)).mpr simp only [Finset.mem_image, exists_prop] rintro _ ⟨x, ⟨k, -, rfl⟩, rfl⟩ exact hy k have y'_nonneg : 0 ≤ y' := le_trans (abv.nonneg _) (hy' i) apply (Int.cast_le.mpr (norm_le abv bS a hy')).trans_lt simp only [Int.cast_mul, Int.cast_pow] apply mul_lt_mul' le_rfl · exact pow_lt_pow_left this (Int.cast_nonneg.mpr y'_nonneg) (@Fintype.card_ne_zero _ _ ⟨i⟩) · exact pow_nonneg (Int.cast_nonneg.mpr y'_nonneg) _ · exact Int.cast_pos.mpr (normBound_pos abv bS)
21
1,318,815,734.483215
2
2
4
2,456
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.Matrix.AbsoluteValue import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.ClassGroup import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.Norm #align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176" open scoped nonZeroDivisors namespace ClassGroup open Ring section EuclideanDomain variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S] variable [Field K] [Field L] variable [Algebra R K] [IsFractionRing R K] variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L] variable [algRL : Algebra R L] [IsScalarTower R K L] variable [Algebra R S] [Algebra S L] variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L] variable (abv : AbsoluteValue R ℤ) variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S) noncomputable def normBound : ℤ := let n := Fintype.card ι let i : ι := Nonempty.some bS.index_nonempty let m : ℤ := Finset.max' (Finset.univ.image fun ijk : ι × ι × ι => abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2)) ⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩ Nat.factorial n • (n • m) ^ n #align class_group.norm_bound ClassGroup.normBound theorem normBound_pos : 0 < normBound abv bS := by obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by by_contra! h obtain ⟨i⟩ := bS.index_nonempty apply bS.ne_zero i apply (injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS) ext j k simp [h, DMatrix.zero_apply] simp only [normBound, Algebra.smul_def, eq_natCast] apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _)) refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _ refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_) exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩ #align class_group.norm_bound_pos ClassGroup.normBound_pos theorem norm_le (a : S) {y : ℤ} (hy : ∀ k, abv (bS.repr a k) ≤ y) : abv (Algebra.norm R a) ≤ normBound abv bS * y ^ Fintype.card ι := by conv_lhs => rw [← bS.sum_repr a] rw [Algebra.norm_apply, ← LinearMap.det_toMatrix bS] simp only [Algebra.norm_apply, AlgHom.map_sum, AlgHom.map_smul, map_sum, map_smul, Algebra.toMatrix_lmul_eq, normBound, smul_mul_assoc, ← mul_pow] convert Matrix.det_sum_smul_le Finset.univ _ hy using 3 · rw [Finset.card_univ, smul_mul_assoc, mul_comm] · intro i j k apply Finset.le_max' exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩ #align class_group.norm_le ClassGroup.norm_le theorem norm_lt {T : Type*} [LinearOrderedRing T] (a : S) {y : T} (hy : ∀ k, (abv (bS.repr a k) : T) < y) : (abv (Algebra.norm R a) : T) < normBound abv bS * y ^ Fintype.card ι := by obtain ⟨i⟩ := bS.index_nonempty have him : (Finset.univ.image fun k => abv (bS.repr a k)).Nonempty := ⟨_, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩⟩ set y' : ℤ := Finset.max' _ him with y'_def have hy' : ∀ k, abv (bS.repr a k) ≤ y' := by intro k exact @Finset.le_max' ℤ _ _ _ (Finset.mem_image.mpr ⟨k, Finset.mem_univ _, rfl⟩) have : (y' : T) < y := by rw [y'_def, ← Finset.max'_image (show Monotone (_ : ℤ → T) from fun x y h => Int.cast_le.mpr h)] apply (Finset.max'_lt_iff _ (him.image _)).mpr simp only [Finset.mem_image, exists_prop] rintro _ ⟨x, ⟨k, -, rfl⟩, rfl⟩ exact hy k have y'_nonneg : 0 ≤ y' := le_trans (abv.nonneg _) (hy' i) apply (Int.cast_le.mpr (norm_le abv bS a hy')).trans_lt simp only [Int.cast_mul, Int.cast_pow] apply mul_lt_mul' le_rfl · exact pow_lt_pow_left this (Int.cast_nonneg.mpr y'_nonneg) (@Fintype.card_ne_zero _ _ ⟨i⟩) · exact pow_nonneg (Int.cast_nonneg.mpr y'_nonneg) _ · exact Int.cast_pos.mpr (normBound_pos abv bS) #align class_group.norm_lt ClassGroup.norm_lt
Mathlib/NumberTheory/ClassNumber/Finite.lean
119
135
theorem exists_min (I : (Ideal S)⁰) : ∃ b ∈ (I : Ideal S), b ≠ 0 ∧ ∀ c ∈ (I : Ideal S), abv (Algebra.norm R c) < abv (Algebra.norm R b) → c = (0 : S) := by
obtain ⟨_, ⟨b, b_mem, b_ne_zero, rfl⟩, min⟩ := @Int.exists_least_of_bdd (fun a => ∃ b ∈ (I : Ideal S), b ≠ (0 : S) ∧ abv (Algebra.norm R b) = a) (by use 0 rintro _ ⟨b, _, _, rfl⟩ apply abv.nonneg) (by obtain ⟨b, b_mem, b_ne_zero⟩ := (I : Ideal S).ne_bot_iff.mp (nonZeroDivisors.coe_ne_zero I) exact ⟨_, ⟨b, b_mem, b_ne_zero, rfl⟩⟩) refine ⟨b, b_mem, b_ne_zero, ?_⟩ intro c hc lt contrapose! lt with c_ne_zero exact min _ ⟨c, hc, c_ne_zero, rfl⟩
13
442,413.392009
2
2
4
2,456
import Mathlib.Geometry.Manifold.PartitionOfUnity import Mathlib.Geometry.Manifold.Metrizable import Mathlib.MeasureTheory.Function.AEEqOfIntegral open MeasureTheory Filter Metric Function Set TopologicalSpace open scoped Topology Manifold variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] section Manifold variable {H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] [MeasurableSpace M] [BorelSpace M] [SigmaCompactSpace M] [T2Space M] {f f' : M → F} {μ : Measure M}
Mathlib/Analysis/Distribution/AEEqOfIntegralContDiff.lean
41
112
theorem ae_eq_zero_of_integral_smooth_smul_eq_zero (hf : LocallyIntegrable f μ) (h : ∀ g : M → ℝ, Smooth I 𝓘(ℝ) g → HasCompactSupport g → ∫ x, g x • f x ∂μ = 0) : ∀ᵐ x ∂μ, f x = 0 := by
-- record topological properties of `M` have := I.locallyCompactSpace have := ChartedSpace.locallyCompactSpace H M have := I.secondCountableTopology have := ChartedSpace.secondCountable_of_sigma_compact H M have := ManifoldWithCorners.metrizableSpace I M let _ : MetricSpace M := TopologicalSpace.metrizableSpaceMetric M -- it suffices to show that the integral of the function vanishes on any compact set `s` apply ae_eq_zero_of_forall_setIntegral_isCompact_eq_zero' hf (fun s hs ↦ Eq.symm ?_) obtain ⟨δ, δpos, hδ⟩ : ∃ δ, 0 < δ ∧ IsCompact (cthickening δ s) := hs.exists_isCompact_cthickening -- choose a sequence of smooth functions `gₙ` equal to `1` on `s` and vanishing outside of the -- `uₙ`-neighborhood of `s`, where `uₙ` tends to zero. Then each integral `∫ gₙ f` vanishes, -- and by dominated convergence these integrals converge to `∫ x in s, f`. obtain ⟨u, -, u_pos, u_lim⟩ : ∃ u, StrictAnti u ∧ (∀ (n : ℕ), u n ∈ Ioo 0 δ) ∧ Tendsto u atTop (𝓝 0) := exists_seq_strictAnti_tendsto' δpos let v : ℕ → Set M := fun n ↦ thickening (u n) s obtain ⟨K, K_compact, vK⟩ : ∃ K, IsCompact K ∧ ∀ n, v n ⊆ K := ⟨_, hδ, fun n ↦ thickening_subset_cthickening_of_le (u_pos n).2.le _⟩ have : ∀ n, ∃ (g : M → ℝ), support g = v n ∧ Smooth I 𝓘(ℝ) g ∧ Set.range g ⊆ Set.Icc 0 1 ∧ ∀ x ∈ s, g x = 1 := by intro n rcases exists_msmooth_support_eq_eq_one_iff I isOpen_thickening hs.isClosed (self_subset_thickening (u_pos n).1 s) with ⟨g, g_smooth, g_range, g_supp, hg⟩ exact ⟨g, g_supp, g_smooth, g_range, fun x hx ↦ (hg x).1 hx⟩ choose g g_supp g_diff g_range hg using this -- main fact: the integral of `∫ gₙ f` tends to `∫ x in s, f`. have L : Tendsto (fun n ↦ ∫ x, g n x • f x ∂μ) atTop (𝓝 (∫ x in s, f x ∂μ)) := by rw [← integral_indicator hs.measurableSet] let bound : M → ℝ := K.indicator (fun x ↦ ‖f x‖) have A : ∀ n, AEStronglyMeasurable (fun x ↦ g n x • f x) μ := fun n ↦ (g_diff n).continuous.aestronglyMeasurable.smul hf.aestronglyMeasurable have B : Integrable bound μ := by rw [integrable_indicator_iff K_compact.measurableSet] exact (hf.integrableOn_isCompact K_compact).norm have C : ∀ n, ∀ᵐ x ∂μ, ‖g n x • f x‖ ≤ bound x := by intro n filter_upwards with x rw [norm_smul] refine le_indicator_apply (fun _ ↦ ?_) (fun hxK ↦ ?_) · have : ‖g n x‖ ≤ 1 := by have := g_range n (mem_range_self (f := g n) x) rw [Real.norm_of_nonneg this.1] exact this.2 exact mul_le_of_le_one_left (norm_nonneg _) this · have : g n x = 0 := by rw [← nmem_support, g_supp]; contrapose! hxK; exact vK n hxK simp [this] have D : ∀ᵐ x ∂μ, Tendsto (fun n => g n x • f x) atTop (𝓝 (s.indicator f x)) := by filter_upwards with x by_cases hxs : x ∈ s · have : ∀ n, g n x = 1 := fun n ↦ hg n x hxs simp [this, indicator_of_mem hxs f] · simp_rw [indicator_of_not_mem hxs f] apply tendsto_const_nhds.congr' suffices H : ∀ᶠ n in atTop, g n x = 0 by filter_upwards [H] with n hn using by simp [hn] obtain ⟨ε, εpos, hε⟩ : ∃ ε, 0 < ε ∧ x ∉ thickening ε s := by rw [← hs.isClosed.closure_eq, closure_eq_iInter_thickening s] at hxs simpa using hxs filter_upwards [(tendsto_order.1 u_lim).2 _ εpos] with n hn rw [← nmem_support, g_supp] contrapose! hε exact thickening_mono hn.le s hε exact tendsto_integral_of_dominated_convergence bound A B C D -- deduce that `∫ x in s, f = 0` as each integral `∫ gₙ f` vanishes by assumption have : ∀ n, ∫ x, g n x • f x ∂μ = 0 := by refine fun n ↦ h _ (g_diff n) ?_ apply HasCompactSupport.of_support_subset_isCompact K_compact simpa [g_supp] using vK n simpa [this] using L
69
925,378,172,558,778,900,000,000,000,000
2
2
1
2,457
import Mathlib.Order.Interval.Set.Image import Mathlib.Order.CompleteLatticeIntervals import Mathlib.Topology.Order.DenselyOrdered import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.intermediate_value from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter OrderDual TopologicalSpace Function Set open Topology Filter universe u v w section variable {X : Type u} {α : Type v} [TopologicalSpace X] [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α]
Mathlib/Topology/Order/IntermediateValue.lean
70
75
theorem intermediate_value_univ₂ [PreconnectedSpace X] {a b : X} {f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (hb : g b ≤ f b) : ∃ x, f x = g x := by
obtain ⟨x, _, hfg, hgf⟩ : (univ ∩ { x | f x ≤ g x ∧ g x ≤ f x }).Nonempty := isPreconnected_closed_iff.1 PreconnectedSpace.isPreconnected_univ _ _ (isClosed_le hf hg) (isClosed_le hg hf) (fun _ _ => le_total _ _) ⟨a, trivial, ha⟩ ⟨b, trivial, hb⟩ exact ⟨x, le_antisymm hfg hgf⟩
4
54.59815
2
2
3
2,458
import Mathlib.Order.Interval.Set.Image import Mathlib.Order.CompleteLatticeIntervals import Mathlib.Topology.Order.DenselyOrdered import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.intermediate_value from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter OrderDual TopologicalSpace Function Set open Topology Filter universe u v w section variable {X : Type u} {α : Type v} [TopologicalSpace X] [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] theorem intermediate_value_univ₂ [PreconnectedSpace X] {a b : X} {f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (hb : g b ≤ f b) : ∃ x, f x = g x := by obtain ⟨x, _, hfg, hgf⟩ : (univ ∩ { x | f x ≤ g x ∧ g x ≤ f x }).Nonempty := isPreconnected_closed_iff.1 PreconnectedSpace.isPreconnected_univ _ _ (isClosed_le hf hg) (isClosed_le hg hf) (fun _ _ => le_total _ _) ⟨a, trivial, ha⟩ ⟨b, trivial, hb⟩ exact ⟨x, le_antisymm hfg hgf⟩ #align intermediate_value_univ₂ intermediate_value_univ₂ theorem intermediate_value_univ₂_eventually₁ [PreconnectedSpace X] {a : X} {l : Filter X} [NeBot l] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x, f x = g x := let ⟨_, h⟩ := he.exists; intermediate_value_univ₂ hf hg ha h #align intermediate_value_univ₂_eventually₁ intermediate_value_univ₂_eventually₁ theorem intermediate_value_univ₂_eventually₂ [PreconnectedSpace X] {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (he₁ : f ≤ᶠ[l₁] g) (he₂ : g ≤ᶠ[l₂] f) : ∃ x, f x = g x := let ⟨_, h₁⟩ := he₁.exists let ⟨_, h₂⟩ := he₂.exists intermediate_value_univ₂ hf hg h₁ h₂ #align intermediate_value_univ₂_eventually₂ intermediate_value_univ₂_eventually₂ theorem IsPreconnected.intermediate_value₂ {s : Set X} (hs : IsPreconnected s) {a b : X} (ha : a ∈ s) (hb : b ∈ s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (ha' : f a ≤ g a) (hb' : g b ≤ f b) : ∃ x ∈ s, f x = g x := let ⟨x, hx⟩ := @intermediate_value_univ₂ s α _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ ⟨b, hb⟩ _ _ (continuousOn_iff_continuous_restrict.1 hf) (continuousOn_iff_continuous_restrict.1 hg) ha' hb' ⟨x, x.2, hx⟩ #align is_preconnected.intermediate_value₂ IsPreconnected.intermediate_value₂
Mathlib/Topology/Order/IntermediateValue.lean
105
112
theorem IsPreconnected.intermediate_value₂_eventually₁ {s : Set X} (hs : IsPreconnected s) {a : X} {l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (ha' : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x ∈ s, f x = g x := by
rw [continuousOn_iff_continuous_restrict] at hf hg obtain ⟨b, h⟩ := @intermediate_value_univ₂_eventually₁ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ _ (comap_coe_neBot_of_le_principal hl) _ _ hf hg ha' (he.comap _) exact ⟨b, b.prop, h⟩
5
148.413159
2
2
3
2,458
import Mathlib.Order.Interval.Set.Image import Mathlib.Order.CompleteLatticeIntervals import Mathlib.Topology.Order.DenselyOrdered import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.intermediate_value from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter OrderDual TopologicalSpace Function Set open Topology Filter universe u v w section variable {X : Type u} {α : Type v} [TopologicalSpace X] [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] theorem intermediate_value_univ₂ [PreconnectedSpace X] {a b : X} {f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (hb : g b ≤ f b) : ∃ x, f x = g x := by obtain ⟨x, _, hfg, hgf⟩ : (univ ∩ { x | f x ≤ g x ∧ g x ≤ f x }).Nonempty := isPreconnected_closed_iff.1 PreconnectedSpace.isPreconnected_univ _ _ (isClosed_le hf hg) (isClosed_le hg hf) (fun _ _ => le_total _ _) ⟨a, trivial, ha⟩ ⟨b, trivial, hb⟩ exact ⟨x, le_antisymm hfg hgf⟩ #align intermediate_value_univ₂ intermediate_value_univ₂ theorem intermediate_value_univ₂_eventually₁ [PreconnectedSpace X] {a : X} {l : Filter X} [NeBot l] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x, f x = g x := let ⟨_, h⟩ := he.exists; intermediate_value_univ₂ hf hg ha h #align intermediate_value_univ₂_eventually₁ intermediate_value_univ₂_eventually₁ theorem intermediate_value_univ₂_eventually₂ [PreconnectedSpace X] {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (he₁ : f ≤ᶠ[l₁] g) (he₂ : g ≤ᶠ[l₂] f) : ∃ x, f x = g x := let ⟨_, h₁⟩ := he₁.exists let ⟨_, h₂⟩ := he₂.exists intermediate_value_univ₂ hf hg h₁ h₂ #align intermediate_value_univ₂_eventually₂ intermediate_value_univ₂_eventually₂ theorem IsPreconnected.intermediate_value₂ {s : Set X} (hs : IsPreconnected s) {a b : X} (ha : a ∈ s) (hb : b ∈ s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (ha' : f a ≤ g a) (hb' : g b ≤ f b) : ∃ x ∈ s, f x = g x := let ⟨x, hx⟩ := @intermediate_value_univ₂ s α _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ ⟨b, hb⟩ _ _ (continuousOn_iff_continuous_restrict.1 hf) (continuousOn_iff_continuous_restrict.1 hg) ha' hb' ⟨x, x.2, hx⟩ #align is_preconnected.intermediate_value₂ IsPreconnected.intermediate_value₂ theorem IsPreconnected.intermediate_value₂_eventually₁ {s : Set X} (hs : IsPreconnected s) {a : X} {l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (ha' : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x ∈ s, f x = g x := by rw [continuousOn_iff_continuous_restrict] at hf hg obtain ⟨b, h⟩ := @intermediate_value_univ₂_eventually₁ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ _ (comap_coe_neBot_of_le_principal hl) _ _ hf hg ha' (he.comap _) exact ⟨b, b.prop, h⟩ #align is_preconnected.intermediate_value₂_eventually₁ IsPreconnected.intermediate_value₂_eventually₁
Mathlib/Topology/Order/IntermediateValue.lean
115
124
theorem IsPreconnected.intermediate_value₂_eventually₂ {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (he₁ : f ≤ᶠ[l₁] g) (he₂ : g ≤ᶠ[l₂] f) : ∃ x ∈ s, f x = g x := by
rw [continuousOn_iff_continuous_restrict] at hf hg obtain ⟨b, h⟩ := @intermediate_value_univ₂_eventually₂ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) _ _ (comap_coe_neBot_of_le_principal hl₁) (comap_coe_neBot_of_le_principal hl₂) _ _ hf hg (he₁.comap _) (he₂.comap _) exact ⟨b, b.prop, h⟩
6
403.428793
2
2
3
2,458
import Mathlib.CategoryTheory.Generator import Mathlib.CategoryTheory.Limits.ConeCategory import Mathlib.CategoryTheory.Limits.Constructions.WeaklyInitial import Mathlib.CategoryTheory.Limits.FunctorCategory import Mathlib.CategoryTheory.Subobject.Comma #align_import category_theory.adjunction.adjoint_functor_theorems from "leanprover-community/mathlib"@"361aa777b4d262212c31d7c4a245ccb23645c156" universe v u u' namespace CategoryTheory open Limits variable {J : Type v} variable {C : Type u} [Category.{v} C] def SolutionSetCondition {D : Type u} [Category.{v} D] (G : D ⥤ C) : Prop := ∀ A : C, ∃ (ι : Type v) (B : ι → D) (f : ∀ i : ι, A ⟶ G.obj (B i)), ∀ (X) (h : A ⟶ G.obj X), ∃ (i : ι) (g : B i ⟶ X), f i ≫ G.map g = h #align category_theory.solution_set_condition CategoryTheory.SolutionSetCondition section GeneralAdjointFunctorTheorem variable {D : Type u} [Category.{v} D] variable (G : D ⥤ C)
Mathlib/CategoryTheory/Adjunction/AdjointFunctorTheorems.lean
69
75
theorem solutionSetCondition_of_isRightAdjoint [G.IsRightAdjoint] : SolutionSetCondition G := by
intro A refine ⟨PUnit, fun _ => G.leftAdjoint.obj A, fun _ => (Adjunction.ofIsRightAdjoint G).unit.app A, ?_⟩ intro B h refine ⟨PUnit.unit, ((Adjunction.ofIsRightAdjoint G).homEquiv _ _).symm h, ?_⟩ rw [← Adjunction.homEquiv_unit, Equiv.apply_symm_apply]
6
403.428793
2
2
1
2,459
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Order.Filter.Curry #align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Filter open scoped uniformity Filter Topology section LimitsOfDerivatives variable {ι : Type*} {l : Filter ι} {E : Type*} [NormedAddCommGroup E] {𝕜 : Type*} [RCLike 𝕜] [NormedSpace 𝕜 E] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {f : ι → E → G} {g : E → G} {f' : ι → E → E →L[𝕜] G} {g' : E → E →L[𝕜] G} {x : E}
Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean
112
163
theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (𝓝 x)) (hf : ∀ᶠ n : ι × E in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2) (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (𝓝 x) := by
letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _ rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero] at hf' ⊢ suffices TendstoUniformlyOnFilter (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0 (l ×ˢ l) (𝓝 x) ∧ TendstoUniformlyOnFilter (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (𝓝 x) by have := this.1.add this.2 rw [add_zero] at this exact this.congr (by simp) constructor · -- This inequality follows from the mean value theorem. To apply it, we will need to shrink our -- neighborhood to small enough ball rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢ intro ε hε have := (tendsto_swap4_prod.eventually (hf.prod_mk hf)).diag_of_prod_right obtain ⟨a, b, c, d, e⟩ := eventually_prod_iff.1 ((hf' ε hε).and this) obtain ⟨R, hR, hR'⟩ := Metric.nhds_basis_ball.eventually_iff.mp d let r := min 1 R have hr : 0 < r := by simp [r, hR] have hr' : ∀ ⦃y : E⦄, y ∈ Metric.ball x r → c y := fun y hy => hR' (lt_of_lt_of_le (Metric.mem_ball.mp hy) (min_le_right _ _)) have hxy : ∀ y : E, y ∈ Metric.ball x r → ‖y - x‖ < 1 := by intro y hy rw [Metric.mem_ball, dist_eq_norm] at hy exact lt_of_lt_of_le hy (min_le_left _ _) have hxyε : ∀ y : E, y ∈ Metric.ball x r → ε * ‖y - x‖ < ε := by intro y hy exact (mul_lt_iff_lt_one_right hε.lt).mpr (hxy y hy) -- With a small ball in hand, apply the mean value theorem refine eventually_prod_iff.mpr ⟨_, b, fun e : E => Metric.ball x r e, eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩ simp only [Pi.zero_apply, dist_zero_left] at e ⊢ refine lt_of_le_of_lt ?_ (hxyε y hy) exact Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le (fun y hy => ((e hn (hr' hy)).2.1.sub (e hn (hr' hy)).2.2).hasFDerivWithinAt) (fun y hy => (e hn (hr' hy)).1.le) (convex_ball x r) (Metric.mem_ball_self hr) hy · -- This is just `hfg` run through `eventually_prod_iff` refine Metric.tendstoUniformlyOnFilter_iff.mpr fun ε hε => ?_ obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε exact eventually_prod_iff.mpr ⟨fun n : ι × ι => f n.1 x ∈ t ∧ f n.2 x ∈ t, eventually_prod_iff.mpr ⟨_, ht, _, ht, fun {n} hn {n'} hn' => ⟨hn, hn'⟩⟩, fun _ => True, by simp, fun {n} hn {y} _ => by simpa [norm_sub_rev, dist_eq_norm] using ht' _ hn.1 _ hn.2⟩
49
1,907,346,572,495,099,800,000
2
2
3
2,460
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Order.Filter.Curry #align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Filter open scoped uniformity Filter Topology section LimitsOfDerivatives variable {ι : Type*} {l : Filter ι} {E : Type*} [NormedAddCommGroup E] {𝕜 : Type*} [RCLike 𝕜] [NormedSpace 𝕜 E] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {f : ι → E → G} {g : E → G} {f' : ι → E → E →L[𝕜] G} {g' : E → E →L[𝕜] G} {x : E} theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (𝓝 x)) (hf : ∀ᶠ n : ι × E in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2) (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (𝓝 x) := by letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _ rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero] at hf' ⊢ suffices TendstoUniformlyOnFilter (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0 (l ×ˢ l) (𝓝 x) ∧ TendstoUniformlyOnFilter (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (𝓝 x) by have := this.1.add this.2 rw [add_zero] at this exact this.congr (by simp) constructor · -- This inequality follows from the mean value theorem. To apply it, we will need to shrink our -- neighborhood to small enough ball rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢ intro ε hε have := (tendsto_swap4_prod.eventually (hf.prod_mk hf)).diag_of_prod_right obtain ⟨a, b, c, d, e⟩ := eventually_prod_iff.1 ((hf' ε hε).and this) obtain ⟨R, hR, hR'⟩ := Metric.nhds_basis_ball.eventually_iff.mp d let r := min 1 R have hr : 0 < r := by simp [r, hR] have hr' : ∀ ⦃y : E⦄, y ∈ Metric.ball x r → c y := fun y hy => hR' (lt_of_lt_of_le (Metric.mem_ball.mp hy) (min_le_right _ _)) have hxy : ∀ y : E, y ∈ Metric.ball x r → ‖y - x‖ < 1 := by intro y hy rw [Metric.mem_ball, dist_eq_norm] at hy exact lt_of_lt_of_le hy (min_le_left _ _) have hxyε : ∀ y : E, y ∈ Metric.ball x r → ε * ‖y - x‖ < ε := by intro y hy exact (mul_lt_iff_lt_one_right hε.lt).mpr (hxy y hy) -- With a small ball in hand, apply the mean value theorem refine eventually_prod_iff.mpr ⟨_, b, fun e : E => Metric.ball x r e, eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩ simp only [Pi.zero_apply, dist_zero_left] at e ⊢ refine lt_of_le_of_lt ?_ (hxyε y hy) exact Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le (fun y hy => ((e hn (hr' hy)).2.1.sub (e hn (hr' hy)).2.2).hasFDerivWithinAt) (fun y hy => (e hn (hr' hy)).1.le) (convex_ball x r) (Metric.mem_ball_self hr) hy · -- This is just `hfg` run through `eventually_prod_iff` refine Metric.tendstoUniformlyOnFilter_iff.mpr fun ε hε => ?_ obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε exact eventually_prod_iff.mpr ⟨fun n : ι × ι => f n.1 x ∈ t ∧ f n.2 x ∈ t, eventually_prod_iff.mpr ⟨_, ht, _, ht, fun {n} hn {n'} hn' => ⟨hn, hn'⟩⟩, fun _ => True, by simp, fun {n} hn {y} _ => by simpa [norm_sub_rev, dist_eq_norm] using ht' _ hn.1 _ hn.2⟩ #align uniform_cauchy_seq_on_filter_of_fderiv uniformCauchySeqOnFilter_of_fderiv
Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean
176
220
theorem uniformCauchySeqOn_ball_of_fderiv {r : ℝ} (hf' : UniformCauchySeqOn f' l (Metric.ball x r)) (hf : ∀ n : ι, ∀ y : E, y ∈ Metric.ball x r → HasFDerivAt (f n) (f' n y) y) (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOn f l (Metric.ball x r) := by
letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _ have : NeBot l := (cauchy_map_iff.1 hfg).1 rcases le_or_lt r 0 with (hr | hr) · simp only [Metric.ball_eq_empty.2 hr, UniformCauchySeqOn, Set.mem_empty_iff_false, IsEmpty.forall_iff, eventually_const, imp_true_iff] rw [SeminormedAddGroup.uniformCauchySeqOn_iff_tendstoUniformlyOn_zero] at hf' ⊢ suffices TendstoUniformlyOn (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0 (l ×ˢ l) (Metric.ball x r) ∧ TendstoUniformlyOn (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (Metric.ball x r) by have := this.1.add this.2 rw [add_zero] at this refine this.congr ?_ filter_upwards with n z _ using (by simp) constructor · -- This inequality follows from the mean value theorem rw [Metric.tendstoUniformlyOn_iff] at hf' ⊢ intro ε hε obtain ⟨q, hqpos, hq⟩ : ∃ q : ℝ, 0 < q ∧ q * r < ε := by simp_rw [mul_comm] exact exists_pos_mul_lt hε.lt r apply (hf' q hqpos.gt).mono intro n hn y hy simp_rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn ⊢ have mvt := Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le (fun z hz => ((hf n.1 z hz).sub (hf n.2 z hz)).hasFDerivWithinAt) (fun z hz => (hn z hz).le) (convex_ball x r) (Metric.mem_ball_self hr) hy refine lt_of_le_of_lt mvt ?_ have : q * ‖y - x‖ < q * r := mul_lt_mul' rfl.le (by simpa only [dist_eq_norm] using Metric.mem_ball.mp hy) (norm_nonneg _) hqpos exact this.trans hq · -- This is just `hfg` run through `eventually_prod_iff` refine Metric.tendstoUniformlyOn_iff.mpr fun ε hε => ?_ obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε rw [eventually_prod_iff] refine ⟨fun n => f n x ∈ t, ht, fun n => f n x ∈ t, ht, ?_⟩ intro n hn n' hn' z _ rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg, ← dist_eq_norm] exact ht' _ hn _ hn'
42
1,739,274,941,520,501,200
2
2
3
2,460
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Order.Filter.Curry #align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Filter open scoped uniformity Filter Topology section deriv variable {ι : Type*} {l : Filter ι} {𝕜 : Type*} [RCLike 𝕜] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {f : ι → 𝕜 → G} {g : 𝕜 → G} {f' : ι → 𝕜 → G} {g' : 𝕜 → G} {x : 𝕜}
Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean
455
474
theorem UniformCauchySeqOnFilter.one_smulRight {l' : Filter 𝕜} (hf' : UniformCauchySeqOnFilter f' l l') : UniformCauchySeqOnFilter (fun n => fun z => (1 : 𝕜 →L[𝕜] 𝕜).smulRight (f' n z)) l l' := by
-- The tricky part of this proof is that operator norms are written in terms of `≤` whereas -- metrics are written in terms of `<`. So we need to shrink `ε` utilizing the archimedean -- property of `ℝ` rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero, Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢ intro ε hε obtain ⟨q, hq, hq'⟩ := exists_between hε.lt apply (hf' q hq).mono intro n hn refine lt_of_le_of_lt ?_ hq' simp only [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn ⊢ refine ContinuousLinearMap.opNorm_le_bound _ hq.le ?_ intro z simp only [ContinuousLinearMap.coe_sub', Pi.sub_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply] rw [← smul_sub, norm_smul, mul_comm] gcongr
17
24,154,952.753575
2
2
3
2,460
import Mathlib.Analysis.Calculus.Deriv.Pow import Mathlib.Analysis.Calculus.MeanValue #align_import analysis.calculus.fderiv_symmetric from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Asymptotics Set open scoped Topology variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {s : Set E} (s_conv : Convex ℝ s) {f : E → F} {f' : E → E →L[ℝ] F} {f'' : E →L[ℝ] E →L[ℝ] F} (hf : ∀ x ∈ interior s, HasFDerivAt f (f' x) x) {x : E} (xs : x ∈ s) (hx : HasFDerivWithinAt f' f'' (interior s) x)
Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean
68
172
theorem Convex.taylor_approx_two_segment {v w : E} (hv : x + v ∈ interior s) (hw : x + v + w ∈ interior s) : (fun h : ℝ => f (x + h • v + h • w) - f (x + h • v) - h • f' x w - h ^ 2 • f'' v w - (h ^ 2 / 2) • f'' w w) =o[𝓝[>] 0] fun h => h ^ 2 := by
-- it suffices to check that the expression is bounded by `ε * ((‖v‖ + ‖w‖) * ‖w‖) * h^2` for -- small enough `h`, for any positive `ε`. refine IsLittleO.trans_isBigO (isLittleO_iff.2 fun ε εpos => ?_) (isBigO_const_mul_self ((‖v‖ + ‖w‖) * ‖w‖) _ _) -- consider a ball of radius `δ` around `x` in which the Taylor approximation for `f''` is -- good up to `δ`. rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, isLittleO_iff] at hx rcases Metric.mem_nhdsWithin_iff.1 (hx εpos) with ⟨δ, δpos, sδ⟩ have E1 : ∀ᶠ h in 𝓝[>] (0 : ℝ), h * (‖v‖ + ‖w‖) < δ := by have : Filter.Tendsto (fun h => h * (‖v‖ + ‖w‖)) (𝓝[>] (0 : ℝ)) (𝓝 (0 * (‖v‖ + ‖w‖))) := (continuous_id.mul continuous_const).continuousWithinAt apply (tendsto_order.1 this).2 δ simpa only [zero_mul] using δpos have E2 : ∀ᶠ h in 𝓝[>] (0 : ℝ), (h : ℝ) < 1 := mem_nhdsWithin_Ioi_iff_exists_Ioo_subset.2 ⟨(1 : ℝ), by simp only [mem_Ioi, zero_lt_one], fun x hx => hx.2⟩ filter_upwards [E1, E2, self_mem_nhdsWithin] with h hδ h_lt_1 hpos -- we consider `h` small enough that all points under consideration belong to this ball, -- and also with `0 < h < 1`. replace hpos : 0 < h := hpos have xt_mem : ∀ t ∈ Icc (0 : ℝ) 1, x + h • v + (t * h) • w ∈ interior s := by intro t ht have : x + h • v ∈ interior s := s_conv.add_smul_mem_interior xs hv ⟨hpos, h_lt_1.le⟩ rw [← smul_smul] apply s_conv.interior.add_smul_mem this _ ht rw [add_assoc] at hw rw [add_assoc, ← smul_add] exact s_conv.add_smul_mem_interior xs hw ⟨hpos, h_lt_1.le⟩ -- define a function `g` on `[0,1]` (identified with `[v, v + w]`) such that `g 1 - g 0` is the -- quantity to be estimated. We will check that its derivative is given by an explicit -- expression `g'`, that we can bound. Then the desired bound for `g 1 - g 0` follows from the -- mean value inequality. let g t := f (x + h • v + (t * h) • w) - (t * h) • f' x w - (t * h ^ 2) • f'' v w - ((t * h) ^ 2 / 2) • f'' w w set g' := fun t => f' (x + h • v + (t * h) • w) (h • w) - h • f' x w - h ^ 2 • f'' v w - (t * h ^ 2) • f'' w w with hg' -- check that `g'` is the derivative of `g`, by a straightforward computation have g_deriv : ∀ t ∈ Icc (0 : ℝ) 1, HasDerivWithinAt g (g' t) (Icc 0 1) t := by intro t ht apply_rules [HasDerivWithinAt.sub, HasDerivWithinAt.add] · refine (hf _ ?_).comp_hasDerivWithinAt _ ?_ · exact xt_mem t ht apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.const_add, HasDerivAt.smul_const, hasDerivAt_mul_const] · apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_mul_const] · apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_mul_const] · suffices H : HasDerivWithinAt (fun u => ((u * h) ^ 2 / 2) • f'' w w) ((((2 : ℕ) : ℝ) * (t * h) ^ (2 - 1) * (1 * h) / 2) • f'' w w) (Icc 0 1) t by convert H using 2 ring apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_id', HasDerivAt.pow, HasDerivAt.mul_const] -- check that `g'` is uniformly bounded, with a suitable bound `ε * ((‖v‖ + ‖w‖) * ‖w‖) * h^2`. have g'_bound : ∀ t ∈ Ico (0 : ℝ) 1, ‖g' t‖ ≤ ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by intro t ht have I : ‖h • v + (t * h) • w‖ ≤ h * (‖v‖ + ‖w‖) := calc ‖h • v + (t * h) • w‖ ≤ ‖h • v‖ + ‖(t * h) • w‖ := norm_add_le _ _ _ = h * ‖v‖ + t * (h * ‖w‖) := by simp only [norm_smul, Real.norm_eq_abs, hpos.le, abs_of_nonneg, abs_mul, ht.left, mul_assoc] _ ≤ h * ‖v‖ + 1 * (h * ‖w‖) := by gcongr; exact ht.2.le _ = h * (‖v‖ + ‖w‖) := by ring calc ‖g' t‖ = ‖(f' (x + h • v + (t * h) • w) - f' x - f'' (h • v + (t * h) • w)) (h • w)‖ := by rw [hg'] have : h * (t * h) = t * (h * h) := by ring simp only [ContinuousLinearMap.coe_sub', ContinuousLinearMap.map_add, pow_two, ContinuousLinearMap.add_apply, Pi.smul_apply, smul_sub, smul_add, smul_smul, ← sub_sub, ContinuousLinearMap.coe_smul', Pi.sub_apply, ContinuousLinearMap.map_smul, this] _ ≤ ‖f' (x + h • v + (t * h) • w) - f' x - f'' (h • v + (t * h) • w)‖ * ‖h • w‖ := (ContinuousLinearMap.le_opNorm _ _) _ ≤ ε * ‖h • v + (t * h) • w‖ * ‖h • w‖ := by apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) have H : x + h • v + (t * h) • w ∈ Metric.ball x δ ∩ interior s := by refine ⟨?_, xt_mem t ⟨ht.1, ht.2.le⟩⟩ rw [add_assoc, add_mem_ball_iff_norm] exact I.trans_lt hδ simpa only [mem_setOf_eq, add_assoc x, add_sub_cancel_left] using sδ H _ ≤ ε * (‖h • v‖ + ‖h • w‖) * ‖h • w‖ := by gcongr apply (norm_add_le _ _).trans gcongr simp only [norm_smul, Real.norm_eq_abs, abs_mul, abs_of_nonneg, ht.1, hpos.le, mul_assoc] exact mul_le_of_le_one_left (mul_nonneg hpos.le (norm_nonneg _)) ht.2.le _ = ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by simp only [norm_smul, Real.norm_eq_abs, abs_mul, abs_of_nonneg, hpos.le]; ring -- conclude using the mean value inequality have I : ‖g 1 - g 0‖ ≤ ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by simpa only [mul_one, sub_zero] using norm_image_sub_le_of_norm_deriv_le_segment' g_deriv g'_bound 1 (right_mem_Icc.2 zero_le_one) convert I using 1 · congr 1 simp only [g, Nat.one_ne_zero, add_zero, one_mul, zero_div, zero_mul, sub_zero, zero_smul, Ne, not_false_iff, bit0_eq_zero, zero_pow] abel · simp only [Real.norm_eq_abs, abs_mul, add_nonneg (norm_nonneg v) (norm_nonneg w), abs_of_nonneg, hpos.le, mul_assoc, norm_nonneg, abs_pow]
100
26,881,171,418,161,356,000,000,000,000,000,000,000,000,000
2
2
1
2,461
import Mathlib.LinearAlgebra.FinsuppVectorSpace import Mathlib.LinearAlgebra.Matrix.Basis import Mathlib.LinearAlgebra.Matrix.Nondegenerate import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.ToLinearEquiv import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.LinearAlgebra.Basis.Bilinear #align_import linear_algebra.matrix.sesquilinear_form from "leanprover-community/mathlib"@"84582d2872fb47c0c17eec7382dc097c9ec7137a" variable {R R₁ R₂ M M₁ M₂ M₁' M₂' n m n' m' ι : Type*} open Finset LinearMap Matrix open Matrix section AuxToLinearMap variable [CommSemiring R] [Semiring R₁] [Semiring R₂] variable [Fintype n] [Fintype m] variable (σ₁ : R₁ →+* R) (σ₂ : R₂ →+* R) def Matrix.toLinearMap₂'Aux (f : Matrix n m R) : (n → R₁) →ₛₗ[σ₁] (m → R₂) →ₛₗ[σ₂] R := -- Porting note: we don't seem to have `∑ i j` as valid notation yet mk₂'ₛₗ σ₁ σ₂ (fun (v : n → R₁) (w : m → R₂) => ∑ i, ∑ j, σ₁ (v i) * f i j * σ₂ (w j)) (fun _ _ _ => by simp only [Pi.add_apply, map_add, add_mul, sum_add_distrib]) (fun _ _ _ => by simp only [Pi.smul_apply, smul_eq_mul, RingHom.map_mul, mul_assoc, mul_sum]) (fun _ _ _ => by simp only [Pi.add_apply, map_add, mul_add, sum_add_distrib]) fun _ _ _ => by simp only [Pi.smul_apply, smul_eq_mul, RingHom.map_mul, mul_assoc, mul_left_comm, mul_sum] #align matrix.to_linear_map₂'_aux Matrix.toLinearMap₂'Aux variable [DecidableEq n] [DecidableEq m]
Mathlib/LinearAlgebra/Matrix/SesquilinearForm.lean
66
74
theorem Matrix.toLinearMap₂'Aux_stdBasis (f : Matrix n m R) (i : n) (j : m) : f.toLinearMap₂'Aux σ₁ σ₂ (LinearMap.stdBasis R₁ (fun _ => R₁) i 1) (LinearMap.stdBasis R₂ (fun _ => R₂) j 1) = f i j := by
rw [Matrix.toLinearMap₂'Aux, mk₂'ₛₗ_apply] have : (∑ i', ∑ j', (if i = i' then 1 else 0) * f i' j' * if j = j' then 1 else 0) = f i j := by simp_rw [mul_assoc, ← Finset.mul_sum] simp only [boole_mul, Finset.sum_ite_eq, Finset.mem_univ, if_true, mul_comm (f _ _)] rw [← this] exact Finset.sum_congr rfl fun _ _ => Finset.sum_congr rfl fun _ _ => by simp
6
403.428793
2
2
1
2,462
import Mathlib.Data.Nat.Totient import Mathlib.Data.Nat.Nth import Mathlib.NumberTheory.SmoothNumbers #align_import number_theory.prime_counting from "leanprover-community/mathlib"@"7fdd4f3746cb059edfdb5d52cba98f66fce418c0" namespace Nat open Finset def primeCounting' : ℕ → ℕ := Nat.count Prime #align nat.prime_counting' Nat.primeCounting' def primeCounting (n : ℕ) : ℕ := primeCounting' (n + 1) #align nat.prime_counting Nat.primeCounting @[inherit_doc] scoped notation "π" => Nat.primeCounting @[inherit_doc] scoped notation "π'" => Nat.primeCounting' theorem monotone_primeCounting' : Monotone primeCounting' := count_monotone Prime #align nat.monotone_prime_counting' Nat.monotone_primeCounting' theorem monotone_primeCounting : Monotone primeCounting := monotone_primeCounting'.comp (monotone_id.add_const _) #align nat.monotone_prime_counting Nat.monotone_primeCounting @[simp] theorem primeCounting'_nth_eq (n : ℕ) : π' (nth Prime n) = n := count_nth_of_infinite infinite_setOf_prime _ #align nat.prime_counting'_nth_eq Nat.primeCounting'_nth_eq @[simp] theorem prime_nth_prime (n : ℕ) : Prime (nth Prime n) := nth_mem_of_infinite infinite_setOf_prime _ #align nat.prime_nth_prime Nat.prime_nth_prime lemma primesBelow_card_eq_primeCounting' (n : ℕ) : n.primesBelow.card = primeCounting' n := by simp only [primesBelow, primeCounting'] exact (count_eq_card_filter_range Prime n).symm
Mathlib/NumberTheory/PrimeCounting.lean
83
102
theorem primeCounting'_add_le {a k : ℕ} (h0 : 0 < a) (h1 : a < k) (n : ℕ) : π' (k + n) ≤ π' k + Nat.totient a * (n / a + 1) := calc π' (k + n) ≤ ((range k).filter Prime).card + ((Ico k (k + n)).filter Prime).card := by
rw [primeCounting', count_eq_card_filter_range, range_eq_Ico, ← Ico_union_Ico_eq_Ico (zero_le k) le_self_add, filter_union] apply card_union_le _ ≤ π' k + ((Ico k (k + n)).filter Prime).card := by rw [primeCounting', count_eq_card_filter_range] _ ≤ π' k + ((Ico k (k + n)).filter (Coprime a)).card := by refine add_le_add_left (card_le_card ?_) k.primeCounting' simp only [subset_iff, and_imp, mem_filter, mem_Ico] intro p succ_k_le_p p_lt_n p_prime constructor · exact ⟨succ_k_le_p, p_lt_n⟩ · rw [coprime_comm] exact coprime_of_lt_prime h0 (gt_of_ge_of_gt succ_k_le_p h1) p_prime _ ≤ π' k + totient a * (n / a + 1) := by rw [add_le_add_iff_left] exact Ico_filter_coprime_le k n h0
16
8,886,110.520508
2
2
1
2,463
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots import Mathlib.NumberTheory.NumberField.Discriminant #align_import number_theory.cyclotomic.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" universe u v open Algebra Polynomial Nat IsPrimitiveRoot PowerBasis open scoped Polynomial Cyclotomic namespace IsPrimitiveRoot variable {n : ℕ+} {K : Type u} [Field K] [CharZero K] {ζ : K} variable [ce : IsCyclotomicExtension {n} ℚ K]
Mathlib/NumberTheory/Cyclotomic/Discriminant.lean
37
48
theorem discr_zeta_eq_discr_zeta_sub_one (hζ : IsPrimitiveRoot ζ n) : discr ℚ (hζ.powerBasis ℚ).basis = discr ℚ (hζ.subOnePowerBasis ℚ).basis := by
haveI : NumberField K := @NumberField.mk _ _ _ (IsCyclotomicExtension.finiteDimensional {n} ℚ K) have H₁ : (aeval (hζ.powerBasis ℚ).gen) (X - 1 : ℤ[X]) = (hζ.subOnePowerBasis ℚ).gen := by simp have H₂ : (aeval (hζ.subOnePowerBasis ℚ).gen) (X + 1 : ℤ[X]) = (hζ.powerBasis ℚ).gen := by simp refine discr_eq_discr_of_toMatrix_coeff_isIntegral _ (fun i j => toMatrix_isIntegral H₁ ?_ ?_ _ _) fun i j => toMatrix_isIntegral H₂ ?_ ?_ _ _ · exact hζ.isIntegral n.pos · refine minpoly.isIntegrallyClosed_eq_field_fractions' (K := ℚ) (hζ.isIntegral n.pos) · exact (hζ.isIntegral n.pos).sub isIntegral_one · refine minpoly.isIntegrallyClosed_eq_field_fractions' (K := ℚ) ?_ exact (hζ.isIntegral n.pos).sub isIntegral_one
10
22,026.465795
2
2
2
2,464
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots import Mathlib.NumberTheory.NumberField.Discriminant #align_import number_theory.cyclotomic.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" universe u v open Algebra Polynomial Nat IsPrimitiveRoot PowerBasis open scoped Polynomial Cyclotomic namespace IsCyclotomicExtension variable {p : ℕ+} {k : ℕ} {K : Type u} {L : Type v} {ζ : L} [Field K] [Field L] variable [Algebra K L] set_option tactic.skipAssignedInstances false in
Mathlib/NumberTheory/Cyclotomic/Discriminant.lean
62
122
theorem discr_prime_pow_ne_two [IsCyclotomicExtension {p ^ (k + 1)} K L] [hp : Fact (p : ℕ).Prime] (hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))) (hirr : Irreducible (cyclotomic (↑(p ^ (k + 1)) : ℕ) K)) (hk : p ^ (k + 1) ≠ 2) : discr K (hζ.powerBasis K).basis = (-1) ^ ((p ^ (k + 1) : ℕ).totient / 2) * p ^ ((p : ℕ) ^ k * ((p - 1) * (k + 1) - 1)) := by
haveI hne := IsCyclotomicExtension.neZero' (p ^ (k + 1)) K L -- Porting note: these two instances are not automatically synthesised and must be constructed haveI mf : Module.Finite K L := finiteDimensional {p ^ (k + 1)} K L haveI se : IsSeparable K L := (isGalois (p ^ (k + 1)) K L).to_isSeparable rw [discr_powerBasis_eq_norm, finrank L hirr, hζ.powerBasis_gen _, ← hζ.minpoly_eq_cyclotomic_of_irreducible hirr, PNat.pow_coe, totient_prime_pow hp.out (succ_pos k), Nat.add_one_sub_one] have coe_two : ((2 : ℕ+) : ℕ) = 2 := rfl have hp2 : p = 2 → k ≠ 0 := by rintro rfl rfl exact absurd rfl hk congr 1 · rcases eq_or_ne p 2 with (rfl | hp2) · rcases Nat.exists_eq_succ_of_ne_zero (hp2 rfl) with ⟨k, rfl⟩ rw [coe_two, succ_sub_succ_eq_sub, tsub_zero, mul_one]; simp only [_root_.pow_succ'] rw [mul_assoc, Nat.mul_div_cancel_left _ zero_lt_two, Nat.mul_div_cancel_left _ zero_lt_two] cases k · simp · simp_rw [_root_.pow_succ', (even_two.mul_right _).neg_one_pow, ((even_two.mul_right _).mul_right _).neg_one_pow] · replace hp2 : (p : ℕ) ≠ 2 := by rwa [Ne, ← coe_two, PNat.coe_inj] have hpo : Odd (p : ℕ) := hp.out.odd_of_ne_two hp2 obtain ⟨a, ha⟩ := (hp.out.even_sub_one hp2).two_dvd rw [ha, mul_left_comm, mul_assoc, Nat.mul_div_cancel_left _ two_pos, Nat.mul_div_cancel_left _ two_pos, mul_right_comm, pow_mul, (hpo.pow.mul _).neg_one_pow, pow_mul, hpo.pow.neg_one_pow] refine Nat.Even.sub_odd ?_ (even_two_mul _) odd_one rw [mul_left_comm, ← ha] exact one_le_mul (one_le_pow _ _ hp.1.pos) (succ_le_iff.2 <| tsub_pos_of_lt hp.1.one_lt) · have H := congr_arg (@derivative K _) (cyclotomic_prime_pow_mul_X_pow_sub_one K p k) rw [derivative_mul, derivative_sub, derivative_one, sub_zero, derivative_X_pow, C_eq_natCast, derivative_sub, derivative_one, sub_zero, derivative_X_pow, C_eq_natCast, ← PNat.pow_coe, hζ.minpoly_eq_cyclotomic_of_irreducible hirr] at H replace H := congr_arg (fun P => aeval ζ P) H simp only [aeval_add, aeval_mul, minpoly.aeval, zero_mul, add_zero, aeval_natCast, _root_.map_sub, aeval_one, aeval_X_pow] at H replace H := congr_arg (Algebra.norm K) H have hnorm : (norm K) (ζ ^ (p : ℕ) ^ k - 1) = (p : K) ^ (p : ℕ) ^ k := by by_cases hp : p = 2 · exact mod_cast hζ.norm_pow_sub_one_eq_prime_pow_of_ne_zero hirr le_rfl (hp2 hp) · exact mod_cast hζ.norm_pow_sub_one_of_prime_ne_two hirr le_rfl hp rw [MonoidHom.map_mul, hnorm, MonoidHom.map_mul, ← map_natCast (algebraMap K L), Algebra.norm_algebraMap, finrank L hirr] at H conv_rhs at H => -- Porting note: need to drill down to successfully rewrite the totient enter [1, 2] rw [PNat.pow_coe, ← succ_eq_add_one, totient_prime_pow hp.out (succ_pos k), Nat.sub_one, Nat.pred_succ] rw [← hζ.minpoly_eq_cyclotomic_of_irreducible hirr, map_pow, hζ.norm_eq_one hk hirr, one_pow, mul_one, PNat.pow_coe, cast_pow, ← pow_mul, ← mul_assoc, mul_comm (k + 1), mul_assoc] at H have := mul_pos (succ_pos k) (tsub_pos_of_lt hp.out.one_lt) rw [← succ_pred_eq_of_pos this, mul_succ, pow_add _ _ ((p : ℕ) ^ k)] at H replace H := (mul_left_inj' fun h => ?_).1 H · simp only [H, mul_comm _ (k + 1)]; norm_cast · -- Porting note: was `replace h := pow_eq_zero h; rw [coe_coe] at h; simpa using hne.1` have := hne.1 rw [PNat.pow_coe, Nat.cast_pow, Ne, pow_eq_zero_iff (by omega)] at this exact absurd (pow_eq_zero h) this
57
5,685,719,999,335,932,000,000,000
2
2
2
2,464
import Mathlib.Combinatorics.SimpleGraph.Regularity.Increment #align_import combinatorics.simple_graph.regularity.lemma from "leanprover-community/mathlib"@"1d4d3ca5ec44693640c4f5e407a6b611f77accc8" open Finpartition Finset Fintype Function SzemerediRegularity variable {α : Type*} [DecidableEq α] [Fintype α] (G : SimpleGraph α) [DecidableRel G.Adj] {ε : ℝ} {l : ℕ}
Mathlib/Combinatorics/SimpleGraph/Regularity/Lemma.lean
74
151
theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) : ∃ P : Finpartition univ, P.IsEquipartition ∧ l ≤ P.parts.card ∧ P.parts.card ≤ bound ε l ∧ P.IsUniform G ε := by
obtain hα | hα := le_total (card α) (bound ε l) -- If `card α ≤ bound ε l`, then the partition into singletons is acceptable. · refine ⟨⊥, bot_isEquipartition _, ?_⟩ rw [card_bot, card_univ] exact ⟨hl, hα, bot_isUniform _ hε⟩ -- Else, let's start from a dummy equipartition of size `initialBound ε l`. let t := initialBound ε l have htα : t ≤ (univ : Finset α).card := (initialBound_le_bound _ _).trans (by rwa [Finset.card_univ]) obtain ⟨dum, hdum₁, hdum₂⟩ := exists_equipartition_card_eq (univ : Finset α) (initialBound_pos _ _).ne' htα obtain hε₁ | hε₁ := le_total 1 ε -- If `ε ≥ 1`, then this dummy equipartition is `ε`-uniform, so we're done. · exact ⟨dum, hdum₁, (le_initialBound ε l).trans hdum₂.ge, hdum₂.le.trans (initialBound_le_bound ε l), (dum.isUniform_one G).mono hε₁⟩ -- Else, set up the induction on energy. We phrase it through the existence for each `i` of an -- equipartition of size bounded by `stepBound^[i] (initialBound ε l)` and which is either -- `ε`-uniform or has energy at least `ε ^ 5 / 4 * i`. have : Nonempty α := by rw [← Fintype.card_pos_iff] exact (bound_pos _ _).trans_le hα suffices h : ∀ i, ∃ P : Finpartition (univ : Finset α), P.IsEquipartition ∧ t ≤ P.parts.card ∧ P.parts.card ≤ stepBound^[i] t ∧ (P.IsUniform G ε ∨ ε ^ 5 / 4 * i ≤ P.energy G) by -- For `i > 4 / ε ^ 5` we know that the partition we get can't have energy `≥ ε ^ 5 / 4 * i > 1`, -- so it must instead be `ε`-uniform and we won. obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := h (⌊4 / ε ^ 5⌋₊ + 1) refine ⟨P, hP₁, (le_initialBound _ _).trans hP₂, hP₃.trans ?_, hP₄.resolve_right fun hPenergy => lt_irrefl (1 : ℝ) ?_⟩ · rw [iterate_succ_apply'] exact mul_le_mul_left' (pow_le_pow_left (by norm_num) (by norm_num) _) _ calc (1 : ℝ) = ε ^ 5 / ↑4 * (↑4 / ε ^ 5) := by rw [mul_comm, div_mul_div_cancel 4 (pow_pos hε 5).ne']; norm_num _ < ε ^ 5 / 4 * (⌊4 / ε ^ 5⌋₊ + 1) := ((mul_lt_mul_left <| by positivity).2 (Nat.lt_floor_add_one _)) _ ≤ (P.energy G : ℝ) := by rwa [← Nat.cast_add_one] _ ≤ 1 := mod_cast P.energy_le_one G -- Let's do the actual induction. intro i induction' i with i ih -- For `i = 0`, the dummy equipartition is enough. · refine ⟨dum, hdum₁, hdum₂.ge, hdum₂.le, Or.inr ?_⟩ rw [Nat.cast_zero, mul_zero] exact mod_cast dum.energy_nonneg G -- For the induction step at `i + 1`, find `P` the equipartition at `i`. obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := ih by_cases huniform : P.IsUniform G ε -- If `P` is already uniform, then no need to break it up further. We can just return `P` again. · refine ⟨P, hP₁, hP₂, ?_, Or.inl huniform⟩ rw [iterate_succ_apply'] exact hP₃.trans (le_stepBound _) -- Else, `P` must instead have energy at least `ε ^ 5 / 4 * i`. replace hP₄ := hP₄.resolve_left huniform -- We gather a few numerical facts. have hεl' : 100 ≤ 4 ^ P.parts.card * ε ^ 5 := (hundred_lt_pow_initialBound_mul hε l).le.trans (mul_le_mul_of_nonneg_right (pow_le_pow_right (by norm_num) hP₂) <| by positivity) have hi : (i : ℝ) ≤ 4 / ε ^ 5 := by have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (mod_cast P.energy_le_one G) rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi set_option tactic.skipAssignedInstances false in norm_num at hi rwa [le_div_iff' (pow_pos hε _)] have hsize : P.parts.card ≤ stepBound^[⌊4 / ε ^ 5⌋₊] t := hP₃.trans (monotone_iterate_of_id_le le_stepBound (Nat.le_floor hi) _) have hPα : P.parts.card * 16 ^ P.parts.card ≤ card α := (Nat.mul_le_mul hsize (Nat.pow_le_pow_of_le_right (by norm_num) hsize)).trans hα -- We return the increment equipartition of `P`, which has energy `≥ ε ^ 5 / 4 * (i + 1)`. refine ⟨increment hP₁ G ε, increment_isEquipartition hP₁ G ε, ?_, ?_, Or.inr <| le_trans ?_ <| energy_increment hP₁ ((seven_le_initialBound ε l).trans hP₂) hεl' hPα huniform hε.le hε₁⟩ · rw [card_increment hPα huniform] exact hP₂.trans (le_stepBound _) · rw [card_increment hPα huniform, iterate_succ_apply'] exact stepBound_mono hP₃ · rw [Nat.cast_succ, mul_add, mul_one] exact add_le_add_right hP₄ _
75
373,324,199,679,900,150,000,000,000,000,000
2
2
1
2,465
import Mathlib.Analysis.Convex.StrictConvexSpace #align_import analysis.convex.uniform from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" open Set Metric open Convex Pointwise class UniformConvexSpace (E : Type*) [SeminormedAddCommGroup E] : Prop where uniform_convex : ∀ ⦃ε : ℝ⦄, 0 < ε → ∃ δ, 0 < δ ∧ ∀ ⦃x : E⦄, ‖x‖ = 1 → ∀ ⦃y⦄, ‖y‖ = 1 → ε ≤ ‖x - y‖ → ‖x + y‖ ≤ 2 - δ #align uniform_convex_space UniformConvexSpace variable {E : Type*} section SeminormedAddCommGroup variable (E) [SeminormedAddCommGroup E] [UniformConvexSpace E] {ε : ℝ} theorem exists_forall_sphere_dist_add_le_two_sub (hε : 0 < ε) : ∃ δ, 0 < δ ∧ ∀ ⦃x : E⦄, ‖x‖ = 1 → ∀ ⦃y⦄, ‖y‖ = 1 → ε ≤ ‖x - y‖ → ‖x + y‖ ≤ 2 - δ := UniformConvexSpace.uniform_convex hε #align exists_forall_sphere_dist_add_le_two_sub exists_forall_sphere_dist_add_le_two_sub variable [NormedSpace ℝ E]
Mathlib/Analysis/Convex/Uniform.lean
60
112
theorem exists_forall_closed_ball_dist_add_le_two_sub (hε : 0 < ε) : ∃ δ, 0 < δ ∧ ∀ ⦃x : E⦄, ‖x‖ ≤ 1 → ∀ ⦃y⦄, ‖y‖ ≤ 1 → ε ≤ ‖x - y‖ → ‖x + y‖ ≤ 2 - δ := by
have hε' : 0 < ε / 3 := div_pos hε zero_lt_three obtain ⟨δ, hδ, h⟩ := exists_forall_sphere_dist_add_le_two_sub E hε' set δ' := min (1 / 2) (min (ε / 3) <| δ / 3) refine ⟨δ', lt_min one_half_pos <| lt_min hε' (div_pos hδ zero_lt_three), fun x hx y hy hxy => ?_⟩ obtain hx' | hx' := le_or_lt ‖x‖ (1 - δ') · rw [← one_add_one_eq_two] exact (norm_add_le_of_le hx' hy).trans (sub_add_eq_add_sub _ _ _).le obtain hy' | hy' := le_or_lt ‖y‖ (1 - δ') · rw [← one_add_one_eq_two] exact (norm_add_le_of_le hx hy').trans (add_sub_assoc _ _ _).ge have hδ' : 0 < 1 - δ' := sub_pos_of_lt (min_lt_of_left_lt one_half_lt_one) have h₁ : ∀ z : E, 1 - δ' < ‖z‖ → ‖‖z‖⁻¹ • z‖ = 1 := by rintro z hz rw [norm_smul_of_nonneg (inv_nonneg.2 <| norm_nonneg _), inv_mul_cancel (hδ'.trans hz).ne'] have h₂ : ∀ z : E, ‖z‖ ≤ 1 → 1 - δ' ≤ ‖z‖ → ‖‖z‖⁻¹ • z - z‖ ≤ δ' := by rintro z hz hδz nth_rw 3 [← one_smul ℝ z] rwa [← sub_smul, norm_smul_of_nonneg (sub_nonneg_of_le <| one_le_inv (hδ'.trans_le hδz) hz), sub_mul, inv_mul_cancel (hδ'.trans_le hδz).ne', one_mul, sub_le_comm] set x' := ‖x‖⁻¹ • x set y' := ‖y‖⁻¹ • y have hxy' : ε / 3 ≤ ‖x' - y'‖ := calc ε / 3 = ε - (ε / 3 + ε / 3) := by ring _ ≤ ‖x - y‖ - (‖x' - x‖ + ‖y' - y‖) := by gcongr · exact (h₂ _ hx hx'.le).trans <| min_le_of_right_le <| min_le_left _ _ · exact (h₂ _ hy hy'.le).trans <| min_le_of_right_le <| min_le_left _ _ _ ≤ _ := by have : ∀ x' y', x - y = x' - y' + (x - x') + (y' - y) := fun _ _ => by abel rw [sub_le_iff_le_add, norm_sub_rev _ x, ← add_assoc, this] exact norm_add₃_le _ _ _ calc ‖x + y‖ ≤ ‖x' + y'‖ + ‖x' - x‖ + ‖y' - y‖ := by have : ∀ x' y', x + y = x' + y' + (x - x') + (y - y') := fun _ _ => by abel rw [norm_sub_rev, norm_sub_rev y', this] exact norm_add₃_le _ _ _ _ ≤ 2 - δ + δ' + δ' := (add_le_add_three (h (h₁ _ hx') (h₁ _ hy') hxy') (h₂ _ hx hx'.le) (h₂ _ hy hy'.le)) _ ≤ 2 - δ' := by dsimp [δ'] rw [← le_sub_iff_add_le, ← le_sub_iff_add_le, sub_sub, sub_sub] refine sub_le_sub_left ?_ _ ring_nf rw [← mul_div_cancel₀ δ three_ne_zero] set_option tactic.skipAssignedInstances false in norm_num -- Porting note: these three extra lines needed to make `exact` work have : 3 * (δ / 3) * (1 / 3) = δ / 3 := by linarith rw [this, mul_comm] gcongr exact min_le_of_right_le <| min_le_right _ _
51
14,093,490,824,269,389,000,000
2
2
2
2,466
import Mathlib.Analysis.Convex.StrictConvexSpace #align_import analysis.convex.uniform from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" open Set Metric open Convex Pointwise class UniformConvexSpace (E : Type*) [SeminormedAddCommGroup E] : Prop where uniform_convex : ∀ ⦃ε : ℝ⦄, 0 < ε → ∃ δ, 0 < δ ∧ ∀ ⦃x : E⦄, ‖x‖ = 1 → ∀ ⦃y⦄, ‖y‖ = 1 → ε ≤ ‖x - y‖ → ‖x + y‖ ≤ 2 - δ #align uniform_convex_space UniformConvexSpace variable {E : Type*} section SeminormedAddCommGroup variable (E) [SeminormedAddCommGroup E] [UniformConvexSpace E] {ε : ℝ} theorem exists_forall_sphere_dist_add_le_two_sub (hε : 0 < ε) : ∃ δ, 0 < δ ∧ ∀ ⦃x : E⦄, ‖x‖ = 1 → ∀ ⦃y⦄, ‖y‖ = 1 → ε ≤ ‖x - y‖ → ‖x + y‖ ≤ 2 - δ := UniformConvexSpace.uniform_convex hε #align exists_forall_sphere_dist_add_le_two_sub exists_forall_sphere_dist_add_le_two_sub variable [NormedSpace ℝ E] theorem exists_forall_closed_ball_dist_add_le_two_sub (hε : 0 < ε) : ∃ δ, 0 < δ ∧ ∀ ⦃x : E⦄, ‖x‖ ≤ 1 → ∀ ⦃y⦄, ‖y‖ ≤ 1 → ε ≤ ‖x - y‖ → ‖x + y‖ ≤ 2 - δ := by have hε' : 0 < ε / 3 := div_pos hε zero_lt_three obtain ⟨δ, hδ, h⟩ := exists_forall_sphere_dist_add_le_two_sub E hε' set δ' := min (1 / 2) (min (ε / 3) <| δ / 3) refine ⟨δ', lt_min one_half_pos <| lt_min hε' (div_pos hδ zero_lt_three), fun x hx y hy hxy => ?_⟩ obtain hx' | hx' := le_or_lt ‖x‖ (1 - δ') · rw [← one_add_one_eq_two] exact (norm_add_le_of_le hx' hy).trans (sub_add_eq_add_sub _ _ _).le obtain hy' | hy' := le_or_lt ‖y‖ (1 - δ') · rw [← one_add_one_eq_two] exact (norm_add_le_of_le hx hy').trans (add_sub_assoc _ _ _).ge have hδ' : 0 < 1 - δ' := sub_pos_of_lt (min_lt_of_left_lt one_half_lt_one) have h₁ : ∀ z : E, 1 - δ' < ‖z‖ → ‖‖z‖⁻¹ • z‖ = 1 := by rintro z hz rw [norm_smul_of_nonneg (inv_nonneg.2 <| norm_nonneg _), inv_mul_cancel (hδ'.trans hz).ne'] have h₂ : ∀ z : E, ‖z‖ ≤ 1 → 1 - δ' ≤ ‖z‖ → ‖‖z‖⁻¹ • z - z‖ ≤ δ' := by rintro z hz hδz nth_rw 3 [← one_smul ℝ z] rwa [← sub_smul, norm_smul_of_nonneg (sub_nonneg_of_le <| one_le_inv (hδ'.trans_le hδz) hz), sub_mul, inv_mul_cancel (hδ'.trans_le hδz).ne', one_mul, sub_le_comm] set x' := ‖x‖⁻¹ • x set y' := ‖y‖⁻¹ • y have hxy' : ε / 3 ≤ ‖x' - y'‖ := calc ε / 3 = ε - (ε / 3 + ε / 3) := by ring _ ≤ ‖x - y‖ - (‖x' - x‖ + ‖y' - y‖) := by gcongr · exact (h₂ _ hx hx'.le).trans <| min_le_of_right_le <| min_le_left _ _ · exact (h₂ _ hy hy'.le).trans <| min_le_of_right_le <| min_le_left _ _ _ ≤ _ := by have : ∀ x' y', x - y = x' - y' + (x - x') + (y' - y) := fun _ _ => by abel rw [sub_le_iff_le_add, norm_sub_rev _ x, ← add_assoc, this] exact norm_add₃_le _ _ _ calc ‖x + y‖ ≤ ‖x' + y'‖ + ‖x' - x‖ + ‖y' - y‖ := by have : ∀ x' y', x + y = x' + y' + (x - x') + (y - y') := fun _ _ => by abel rw [norm_sub_rev, norm_sub_rev y', this] exact norm_add₃_le _ _ _ _ ≤ 2 - δ + δ' + δ' := (add_le_add_three (h (h₁ _ hx') (h₁ _ hy') hxy') (h₂ _ hx hx'.le) (h₂ _ hy hy'.le)) _ ≤ 2 - δ' := by dsimp [δ'] rw [← le_sub_iff_add_le, ← le_sub_iff_add_le, sub_sub, sub_sub] refine sub_le_sub_left ?_ _ ring_nf rw [← mul_div_cancel₀ δ three_ne_zero] set_option tactic.skipAssignedInstances false in norm_num -- Porting note: these three extra lines needed to make `exact` work have : 3 * (δ / 3) * (1 / 3) = δ / 3 := by linarith rw [this, mul_comm] gcongr exact min_le_of_right_le <| min_le_right _ _ #align exists_forall_closed_ball_dist_add_le_two_sub exists_forall_closed_ball_dist_add_le_two_sub
Mathlib/Analysis/Convex/Uniform.lean
115
126
theorem exists_forall_closed_ball_dist_add_le_two_mul_sub (hε : 0 < ε) (r : ℝ) : ∃ δ, 0 < δ ∧ ∀ ⦃x : E⦄, ‖x‖ ≤ r → ∀ ⦃y⦄, ‖y‖ ≤ r → ε ≤ ‖x - y‖ → ‖x + y‖ ≤ 2 * r - δ := by
obtain hr | hr := le_or_lt r 0 · exact ⟨1, one_pos, fun x hx y hy h => (hε.not_le <| h.trans <| (norm_sub_le _ _).trans <| add_nonpos (hx.trans hr) (hy.trans hr)).elim⟩ obtain ⟨δ, hδ, h⟩ := exists_forall_closed_ball_dist_add_le_two_sub E (div_pos hε hr) refine ⟨δ * r, mul_pos hδ hr, fun x hx y hy hxy => ?_⟩ rw [← div_le_one hr, div_eq_inv_mul, ← norm_smul_of_nonneg (inv_nonneg.2 hr.le)] at hx hy have := h hx hy simp_rw [← smul_add, ← smul_sub, norm_smul_of_nonneg (inv_nonneg.2 hr.le), ← div_eq_inv_mul, div_le_div_right hr, div_le_iff hr, sub_mul] at this exact this hxy
10
22,026.465795
2
2
2
2,466
import Mathlib.CategoryTheory.EqToHom import Mathlib.CategoryTheory.Functor.Const import Mathlib.CategoryTheory.Opposites import Mathlib.Data.Prod.Basic #align_import category_theory.products.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace CategoryTheory -- declare the `v`'s first; see `CategoryTheory.Category` for an explanation universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄ section variable (C : Type u₁) [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D] -- the generates simp lemmas like `id_fst` and `comp_snd` @[simps (config := { notRecursive := [] }) Hom id_fst id_snd comp_fst comp_snd] instance prod : Category.{max v₁ v₂} (C × D) where Hom X Y := (X.1 ⟶ Y.1) × (X.2 ⟶ Y.2) id X := ⟨𝟙 X.1, 𝟙 X.2⟩ comp f g := (f.1 ≫ g.1, f.2 ≫ g.2) #align category_theory.prod CategoryTheory.prod @[simp] theorem prod_id (X : C) (Y : D) : 𝟙 (X, Y) = (𝟙 X, 𝟙 Y) := rfl #align category_theory.prod_id CategoryTheory.prod_id @[simp] theorem prod_comp {P Q R : C} {S T U : D} (f : (P, S) ⟶ (Q, T)) (g : (Q, T) ⟶ (R, U)) : f ≫ g = (f.1 ≫ g.1, f.2 ≫ g.2) := rfl #align category_theory.prod_comp CategoryTheory.prod_comp
Mathlib/CategoryTheory/Products/Basic.lean
64
75
theorem isIso_prod_iff {P Q : C} {S T : D} {f : (P, S) ⟶ (Q, T)} : IsIso f ↔ IsIso f.1 ∧ IsIso f.2 := by
constructor · rintro ⟨g, hfg, hgf⟩ simp? at hfg hgf says simp only [prod_Hom, prod_comp, prod_id, Prod.mk.injEq] at hfg hgf rcases hfg with ⟨hfg₁, hfg₂⟩ rcases hgf with ⟨hgf₁, hgf₂⟩ exact ⟨⟨⟨g.1, hfg₁, hgf₁⟩⟩, ⟨⟨g.2, hfg₂, hgf₂⟩⟩⟩ · rintro ⟨⟨g₁, hfg₁, hgf₁⟩, ⟨g₂, hfg₂, hgf₂⟩⟩ dsimp at hfg₁ hgf₁ hfg₂ hgf₂ refine ⟨⟨(g₁, g₂), ?_, ?_⟩⟩ repeat { simp; constructor; assumption; assumption }
10
22,026.465795
2
2
1
2,467
import Mathlib.Analysis.Calculus.LocalExtr.Basic import Mathlib.Topology.Algebra.Order.Rolle #align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open Set Filter Topology variable {f f' : ℝ → ℝ} {a b l : ℝ} theorem exists_hasDerivAt_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) : ∃ c ∈ Ioo a b, f' c = 0 := let ⟨c, cmem, hc⟩ := exists_isLocalExtr_Ioo hab hfc hfI ⟨c, cmem, hc.hasDerivAt_eq_zero <| hff' c cmem⟩ #align exists_has_deriv_at_eq_zero exists_hasDerivAt_eq_zero theorem exists_deriv_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) : ∃ c ∈ Ioo a b, deriv f c = 0 := let ⟨c, cmem, hc⟩ := exists_isLocalExtr_Ioo hab hfc hfI ⟨c, cmem, hc.deriv_eq_zero⟩ #align exists_deriv_eq_zero exists_deriv_eq_zero theorem exists_hasDerivAt_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l)) (hfb : Tendsto f (𝓝[<] b) (𝓝 l)) (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) : ∃ c ∈ Ioo a b, f' c = 0 := let ⟨c, cmem, hc⟩ := exists_isLocalExtr_Ioo_of_tendsto hab (fun x hx ↦ (hff' x hx).continuousAt.continuousWithinAt) hfa hfb ⟨c, cmem, hc.hasDerivAt_eq_zero <| hff' c cmem⟩ #align exists_has_deriv_at_eq_zero' exists_hasDerivAt_eq_zero'
Mathlib/Analysis/Calculus/LocalExtr/Rolle.lean
78
84
theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l)) (hfb : Tendsto f (𝓝[<] b) (𝓝 l)) : ∃ c ∈ Ioo a b, deriv f c = 0 := by
by_cases h : ∀ x ∈ Ioo a b, DifferentiableAt ℝ f x · exact exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).hasDerivAt · obtain ⟨c, hc, hcdiff⟩ : ∃ x ∈ Ioo a b, ¬DifferentiableAt ℝ f x := by push_neg at h; exact h exact ⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
5
148.413159
2
2
1
2,468
import Mathlib.LinearAlgebra.Span import Mathlib.LinearAlgebra.BilinearMap #align_import algebra.module.submodule.bilinear from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940" universe uι u v open Set open Pointwise namespace Submodule variable {ι : Sort uι} {R M N P : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] variable [Module R M] [Module R N] [Module R P] def map₂ (f : M →ₗ[R] N →ₗ[R] P) (p : Submodule R M) (q : Submodule R N) : Submodule R P := ⨆ s : p, q.map (f s) #align submodule.map₂ Submodule.map₂ theorem apply_mem_map₂ (f : M →ₗ[R] N →ₗ[R] P) {m : M} {n : N} {p : Submodule R M} {q : Submodule R N} (hm : m ∈ p) (hn : n ∈ q) : f m n ∈ map₂ f p q := (le_iSup _ ⟨m, hm⟩ : _ ≤ map₂ f p q) ⟨n, hn, by rfl⟩ #align submodule.apply_mem_map₂ Submodule.apply_mem_map₂ theorem map₂_le {f : M →ₗ[R] N →ₗ[R] P} {p : Submodule R M} {q : Submodule R N} {r : Submodule R P} : map₂ f p q ≤ r ↔ ∀ m ∈ p, ∀ n ∈ q, f m n ∈ r := ⟨fun H _m hm _n hn => H <| apply_mem_map₂ _ hm hn, fun H => iSup_le fun ⟨m, hm⟩ => map_le_iff_le_comap.2 fun n hn => H m hm n hn⟩ #align submodule.map₂_le Submodule.map₂_le variable (R)
Mathlib/Algebra/Module/Submodule/Bilinear.lean
59
73
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) : map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
apply le_antisymm · rw [map₂_le] apply @span_induction' R M _ _ _ s intro a ha apply @span_induction' R N _ _ _ t intro b hb exact subset_span ⟨_, ‹_›, _, ‹_›, rfl⟩ all_goals intros; simp only [*, add_mem, smul_mem, zero_mem, _root_.map_zero, map_add, LinearMap.zero_apply, LinearMap.add_apply, LinearMap.smul_apply, map_smul] · rw [span_le, image2_subset_iff] intro a ha b hb exact apply_mem_map₂ _ (subset_span ha) (subset_span hb)
13
442,413.392009
2
2
1
2,469
import Mathlib.Algebra.Algebra.Spectrum import Mathlib.FieldTheory.IsAlgClosed.Basic #align_import field_theory.is_alg_closed.spectrum from "leanprover-community/mathlib"@"58a272265b5e05f258161260dd2c5d247213cbd3" namespace spectrum open Set Polynomial open scoped Pointwise Polynomial universe u v section ScalarRing variable {R : Type u} {A : Type v} variable [CommRing R] [Ring A] [Algebra R A] local notation "σ" => spectrum R local notation "↑ₐ" => algebraMap R A -- Porting note: removed an unneeded assumption `p ≠ 0`
Mathlib/FieldTheory/IsAlgClosed/Spectrum.lean
55
63
theorem exists_mem_of_not_isUnit_aeval_prod [IsDomain R] {p : R[X]} {a : A} (h : ¬IsUnit (aeval a (Multiset.map (fun x : R => X - C x) p.roots).prod)) : ∃ k : R, k ∈ σ a ∧ eval k p = 0 := by
rw [← Multiset.prod_toList, AlgHom.map_list_prod] at h replace h := mt List.prod_isUnit h simp only [not_forall, exists_prop, aeval_C, Multiset.mem_toList, List.mem_map, aeval_X, exists_exists_and_eq_and, Multiset.mem_map, AlgHom.map_sub] at h rcases h with ⟨r, r_mem, r_nu⟩ exact ⟨r, by rwa [mem_iff, ← IsUnit.sub_iff], (mem_roots'.1 r_mem).2⟩
6
403.428793
2
2
2
2,470
import Mathlib.Algebra.Algebra.Spectrum import Mathlib.FieldTheory.IsAlgClosed.Basic #align_import field_theory.is_alg_closed.spectrum from "leanprover-community/mathlib"@"58a272265b5e05f258161260dd2c5d247213cbd3" namespace spectrum open Set Polynomial open scoped Pointwise Polynomial universe u v section ScalarField variable {𝕜 : Type u} {A : Type v} variable [Field 𝕜] [Ring A] [Algebra 𝕜 A] local notation "σ" => spectrum 𝕜 local notation "↑ₐ" => algebraMap 𝕜 A open Polynomial
Mathlib/FieldTheory/IsAlgClosed/Spectrum.lean
81
91
theorem subset_polynomial_aeval (a : A) (p : 𝕜[X]) : (eval · p) '' σ a ⊆ σ (aeval a p) := by
rintro _ ⟨k, hk, rfl⟩ let q := C (eval k p) - p have hroot : IsRoot q k := by simp only [q, eval_C, eval_sub, sub_self, IsRoot.def] rw [← mul_div_eq_iff_isRoot, ← neg_mul_neg, neg_sub] at hroot have aeval_q_eq : ↑ₐ (eval k p) - aeval a p = aeval a q := by simp only [q, aeval_C, AlgHom.map_sub, sub_left_inj] rw [mem_iff, aeval_q_eq, ← hroot, aeval_mul] have hcomm := (Commute.all (C k - X) (-(q / (X - C k)))).map (aeval a : 𝕜[X] →ₐ[𝕜] A) apply mt fun h => (hcomm.isUnit_mul_iff.mp h).1 simpa only [aeval_X, aeval_C, AlgHom.map_sub] using hk
10
22,026.465795
2
2
2
2,470
import Mathlib.Algebra.Group.Basic import Mathlib.Order.Basic import Mathlib.Order.Monotone.Basic #align_import algebra.covariant_and_contravariant from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f" -- TODO: convert `ExistsMulOfLE`, `ExistsAddOfLE`? -- TODO: relationship with `Con/AddCon` -- TODO: include equivalence of `LeftCancelSemigroup` with -- `Semigroup PartialOrder ContravariantClass α α (*) (≤)`? -- TODO : use ⇒, as per Eric's suggestion? See -- https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/ordered.20stuff/near/236148738 -- for a discussion. open Function section Variants variable {M N : Type*} (μ : M → N → N) (r : N → N → Prop) variable (M N) def Covariant : Prop := ∀ (m) {n₁ n₂}, r n₁ n₂ → r (μ m n₁) (μ m n₂) #align covariant Covariant def Contravariant : Prop := ∀ (m) {n₁ n₂}, r (μ m n₁) (μ m n₂) → r n₁ n₂ #align contravariant Contravariant class CovariantClass : Prop where protected elim : Covariant M N μ r #align covariant_class CovariantClass class ContravariantClass : Prop where protected elim : Contravariant M N μ r #align contravariant_class ContravariantClass theorem rel_iff_cov [CovariantClass M N μ r] [ContravariantClass M N μ r] (m : M) {a b : N} : r (μ m a) (μ m b) ↔ r a b := ⟨ContravariantClass.elim _, CovariantClass.elim _⟩ #align rel_iff_cov rel_iff_cov section Covariant variable {M N μ r} [CovariantClass M N μ r] theorem act_rel_act_of_rel (m : M) {a b : N} (ab : r a b) : r (μ m a) (μ m b) := CovariantClass.elim _ ab #align act_rel_act_of_rel act_rel_act_of_rel @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/Defs.lean
154
160
theorem Group.covariant_iff_contravariant [Group N] : Covariant N N (· * ·) r ↔ Contravariant N N (· * ·) r := by
refine ⟨fun h a b c bc ↦ ?_, fun h a b c bc ↦ ?_⟩ · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] exact h a⁻¹ bc · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] at bc exact h a⁻¹ bc
5
148.413159
2
2
3
2,471
import Mathlib.Algebra.Group.Basic import Mathlib.Order.Basic import Mathlib.Order.Monotone.Basic #align_import algebra.covariant_and_contravariant from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f" -- TODO: convert `ExistsMulOfLE`, `ExistsAddOfLE`? -- TODO: relationship with `Con/AddCon` -- TODO: include equivalence of `LeftCancelSemigroup` with -- `Semigroup PartialOrder ContravariantClass α α (*) (≤)`? -- TODO : use ⇒, as per Eric's suggestion? See -- https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/ordered.20stuff/near/236148738 -- for a discussion. open Function section Variants variable {M N : Type*} (μ : M → N → N) (r : N → N → Prop) variable (M N) def Covariant : Prop := ∀ (m) {n₁ n₂}, r n₁ n₂ → r (μ m n₁) (μ m n₂) #align covariant Covariant def Contravariant : Prop := ∀ (m) {n₁ n₂}, r (μ m n₁) (μ m n₂) → r n₁ n₂ #align contravariant Contravariant class CovariantClass : Prop where protected elim : Covariant M N μ r #align covariant_class CovariantClass class ContravariantClass : Prop where protected elim : Contravariant M N μ r #align contravariant_class ContravariantClass theorem rel_iff_cov [CovariantClass M N μ r] [ContravariantClass M N μ r] (m : M) {a b : N} : r (μ m a) (μ m b) ↔ r a b := ⟨ContravariantClass.elim _, CovariantClass.elim _⟩ #align rel_iff_cov rel_iff_cov section Covariant variable {M N μ r} [CovariantClass M N μ r] theorem act_rel_act_of_rel (m : M) {a b : N} (ab : r a b) : r (μ m a) (μ m b) := CovariantClass.elim _ ab #align act_rel_act_of_rel act_rel_act_of_rel @[to_additive] theorem Group.covariant_iff_contravariant [Group N] : Covariant N N (· * ·) r ↔ Contravariant N N (· * ·) r := by refine ⟨fun h a b c bc ↦ ?_, fun h a b c bc ↦ ?_⟩ · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] exact h a⁻¹ bc · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] at bc exact h a⁻¹ bc #align group.covariant_iff_contravariant Group.covariant_iff_contravariant #align add_group.covariant_iff_contravariant AddGroup.covariant_iff_contravariant @[to_additive] instance (priority := 100) Group.covconv [Group N] [CovariantClass N N (· * ·) r] : ContravariantClass N N (· * ·) r := ⟨Group.covariant_iff_contravariant.mp CovariantClass.elim⟩ @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/Defs.lean
170
176
theorem Group.covariant_swap_iff_contravariant_swap [Group N] : Covariant N N (swap (· * ·)) r ↔ Contravariant N N (swap (· * ·)) r := by
refine ⟨fun h a b c bc ↦ ?_, fun h a b c bc ↦ ?_⟩ · rw [← mul_inv_cancel_right b a, ← mul_inv_cancel_right c a] exact h a⁻¹ bc · rw [← mul_inv_cancel_right b a, ← mul_inv_cancel_right c a] at bc exact h a⁻¹ bc
5
148.413159
2
2
3
2,471
import Mathlib.Algebra.Group.Basic import Mathlib.Order.Basic import Mathlib.Order.Monotone.Basic #align_import algebra.covariant_and_contravariant from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f" -- TODO: convert `ExistsMulOfLE`, `ExistsAddOfLE`? -- TODO: relationship with `Con/AddCon` -- TODO: include equivalence of `LeftCancelSemigroup` with -- `Semigroup PartialOrder ContravariantClass α α (*) (≤)`? -- TODO : use ⇒, as per Eric's suggestion? See -- https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/ordered.20stuff/near/236148738 -- for a discussion. open Function section Variants variable {M N : Type*} (μ : M → N → N) (r : N → N → Prop) variable (M N) def Covariant : Prop := ∀ (m) {n₁ n₂}, r n₁ n₂ → r (μ m n₁) (μ m n₂) #align covariant Covariant def Contravariant : Prop := ∀ (m) {n₁ n₂}, r (μ m n₁) (μ m n₂) → r n₁ n₂ #align contravariant Contravariant class CovariantClass : Prop where protected elim : Covariant M N μ r #align covariant_class CovariantClass class ContravariantClass : Prop where protected elim : Contravariant M N μ r #align contravariant_class ContravariantClass theorem rel_iff_cov [CovariantClass M N μ r] [ContravariantClass M N μ r] (m : M) {a b : N} : r (μ m a) (μ m b) ↔ r a b := ⟨ContravariantClass.elim _, CovariantClass.elim _⟩ #align rel_iff_cov rel_iff_cov section Covariant variable {M N μ r} [CovariantClass M N μ r] theorem act_rel_act_of_rel (m : M) {a b : N} (ab : r a b) : r (μ m a) (μ m b) := CovariantClass.elim _ ab #align act_rel_act_of_rel act_rel_act_of_rel @[to_additive] theorem Group.covariant_iff_contravariant [Group N] : Covariant N N (· * ·) r ↔ Contravariant N N (· * ·) r := by refine ⟨fun h a b c bc ↦ ?_, fun h a b c bc ↦ ?_⟩ · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] exact h a⁻¹ bc · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] at bc exact h a⁻¹ bc #align group.covariant_iff_contravariant Group.covariant_iff_contravariant #align add_group.covariant_iff_contravariant AddGroup.covariant_iff_contravariant @[to_additive] instance (priority := 100) Group.covconv [Group N] [CovariantClass N N (· * ·) r] : ContravariantClass N N (· * ·) r := ⟨Group.covariant_iff_contravariant.mp CovariantClass.elim⟩ @[to_additive] theorem Group.covariant_swap_iff_contravariant_swap [Group N] : Covariant N N (swap (· * ·)) r ↔ Contravariant N N (swap (· * ·)) r := by refine ⟨fun h a b c bc ↦ ?_, fun h a b c bc ↦ ?_⟩ · rw [← mul_inv_cancel_right b a, ← mul_inv_cancel_right c a] exact h a⁻¹ bc · rw [← mul_inv_cancel_right b a, ← mul_inv_cancel_right c a] at bc exact h a⁻¹ bc #align group.covariant_swap_iff_contravariant_swap Group.covariant_swap_iff_contravariant_swap #align add_group.covariant_swap_iff_contravariant_swap AddGroup.covariant_swap_iff_contravariant_swap @[to_additive] instance (priority := 100) Group.covconv_swap [Group N] [CovariantClass N N (swap (· * ·)) r] : ContravariantClass N N (swap (· * ·)) r := ⟨Group.covariant_swap_iff_contravariant_swap.mp CovariantClass.elim⟩ -- Lemma with 4 elements.
Mathlib/Algebra/Order/Monoid/Unbundled/Defs.lean
281
286
theorem covariant_le_of_covariant_lt [PartialOrder N] : Covariant M N μ (· < ·) → Covariant M N μ (· ≤ ·) := by
intro h a b c bc rcases bc.eq_or_lt with (rfl | bc) · exact le_rfl · exact (h _ bc).le
4
54.59815
2
2
3
2,471
import Mathlib.Combinatorics.Quiver.Basic #align_import combinatorics.quiver.push from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f" namespace Quiver universe v v₁ v₂ u u₁ u₂ variable {V : Type*} [Quiver V] {W : Type*} (σ : V → W) @[nolint unusedArguments] def Push (_ : V → W) := W #align quiver.push Quiver.Push instance [h : Nonempty W] : Nonempty (Push σ) := h inductive PushQuiver {V : Type u} [Quiver.{v} V] {W : Type u₂} (σ : V → W) : W → W → Type max u u₂ v | arrow {X Y : V} (f : X ⟶ Y) : PushQuiver σ (σ X) (σ Y) #align quiver.push_quiver Quiver.PushQuiver instance : Quiver (Push σ) := ⟨PushQuiver σ⟩ namespace Push def of : V ⥤q Push σ where obj := σ map f := PushQuiver.arrow f #align quiver.push.of Quiver.Push.of @[simp] theorem of_obj : (of σ).obj = σ := rfl #align quiver.push.of_obj Quiver.Push.of_obj variable {W' : Type*} [Quiver W'] (φ : V ⥤q W') (τ : W → W') (h : ∀ x, φ.obj x = τ (σ x)) noncomputable def lift : Push σ ⥤q W' where obj := τ map := @PushQuiver.rec V _ W σ (fun X Y _ => τ X ⟶ τ Y) @fun X Y f => by dsimp only rw [← h X, ← h Y] exact φ.map f #align quiver.push.lift Quiver.Push.lift theorem lift_obj : (lift σ φ τ h).obj = τ := rfl #align quiver.push.lift_obj Quiver.Push.lift_obj
Mathlib/Combinatorics/Quiver/Push.lean
73
89
theorem lift_comp : (of σ ⋙q lift σ φ τ h) = φ := by
fapply Prefunctor.ext · rintro X simp only [Prefunctor.comp_obj] apply Eq.symm exact h X · rintro X Y f simp only [Prefunctor.comp_map] apply eq_of_heq iterate 2 apply (cast_heq _ _).trans apply HEq.symm apply (eqRec_heq _ _).trans have : ∀ {α γ} {β : α → γ → Sort _} {a a'} (p : a = a') g (b : β a g), HEq (p ▸ b) b := by intros subst_vars rfl apply this
16
8,886,110.520508
2
2
2
2,472
import Mathlib.Combinatorics.Quiver.Basic #align_import combinatorics.quiver.push from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f" namespace Quiver universe v v₁ v₂ u u₁ u₂ variable {V : Type*} [Quiver V] {W : Type*} (σ : V → W) @[nolint unusedArguments] def Push (_ : V → W) := W #align quiver.push Quiver.Push instance [h : Nonempty W] : Nonempty (Push σ) := h inductive PushQuiver {V : Type u} [Quiver.{v} V] {W : Type u₂} (σ : V → W) : W → W → Type max u u₂ v | arrow {X Y : V} (f : X ⟶ Y) : PushQuiver σ (σ X) (σ Y) #align quiver.push_quiver Quiver.PushQuiver instance : Quiver (Push σ) := ⟨PushQuiver σ⟩ namespace Push def of : V ⥤q Push σ where obj := σ map f := PushQuiver.arrow f #align quiver.push.of Quiver.Push.of @[simp] theorem of_obj : (of σ).obj = σ := rfl #align quiver.push.of_obj Quiver.Push.of_obj variable {W' : Type*} [Quiver W'] (φ : V ⥤q W') (τ : W → W') (h : ∀ x, φ.obj x = τ (σ x)) noncomputable def lift : Push σ ⥤q W' where obj := τ map := @PushQuiver.rec V _ W σ (fun X Y _ => τ X ⟶ τ Y) @fun X Y f => by dsimp only rw [← h X, ← h Y] exact φ.map f #align quiver.push.lift Quiver.Push.lift theorem lift_obj : (lift σ φ τ h).obj = τ := rfl #align quiver.push.lift_obj Quiver.Push.lift_obj theorem lift_comp : (of σ ⋙q lift σ φ τ h) = φ := by fapply Prefunctor.ext · rintro X simp only [Prefunctor.comp_obj] apply Eq.symm exact h X · rintro X Y f simp only [Prefunctor.comp_map] apply eq_of_heq iterate 2 apply (cast_heq _ _).trans apply HEq.symm apply (eqRec_heq _ _).trans have : ∀ {α γ} {β : α → γ → Sort _} {a a'} (p : a = a') g (b : β a g), HEq (p ▸ b) b := by intros subst_vars rfl apply this #align quiver.push.lift_comp Quiver.Push.lift_comp
Mathlib/Combinatorics/Quiver/Push.lean
92
102
theorem lift_unique (Φ : Push σ ⥤q W') (Φ₀ : Φ.obj = τ) (Φcomp : (of σ ⋙q Φ) = φ) : Φ = lift σ φ τ h := by
dsimp only [of, lift] fapply Prefunctor.ext · intro X simp only rw [Φ₀] · rintro _ _ ⟨⟩ subst_vars simp only [Prefunctor.comp_map, cast_eq] rfl
9
8,103.083928
2
2
2
2,472
import Mathlib.Algebra.Polynomial.Eval import Mathlib.Analysis.SpecialFunctions.Exp open Filter Topology Real namespace Polynomial
Mathlib/Analysis/SpecialFunctions/PolynomialExp.lean
27
31
theorem tendsto_div_exp_atTop (p : ℝ[X]) : Tendsto (fun x ↦ p.eval x / exp x) atTop (𝓝 0) := by
induction p using Polynomial.induction_on' with | h_monomial n c => simpa [exp_neg, div_eq_mul_inv, mul_assoc] using tendsto_const_nhds.mul (tendsto_pow_mul_exp_neg_atTop_nhds_zero n) | h_add p q hp hq => simpa [add_div] using hp.add hq
4
54.59815
2
2
1
2,473
import Mathlib.Topology.Homeomorph import Mathlib.Topology.StoneCech #align_import topology.extremally_disconnected from "leanprover-community/mathlib"@"7e281deff072232a3c5b3e90034bd65dde396312" noncomputable section open scoped Classical open Function Set universe u section variable (X : Type u) [TopologicalSpace X] class ExtremallyDisconnected : Prop where open_closure : ∀ U : Set X, IsOpen U → IsOpen (closure U) #align extremally_disconnected ExtremallyDisconnected section def CompactT2.Projective : Prop := ∀ {Y Z : Type u} [TopologicalSpace Y] [TopologicalSpace Z], ∀ [CompactSpace Y] [T2Space Y] [CompactSpace Z] [T2Space Z], ∀ {f : X → Z} {g : Y → Z} (_ : Continuous f) (_ : Continuous g) (_ : Surjective g), ∃ h : X → Y, Continuous h ∧ g ∘ h = f #align compact_t2.projective CompactT2.Projective variable {X}
Mathlib/Topology/ExtremallyDisconnected.lean
83
92
theorem StoneCech.projective [DiscreteTopology X] : CompactT2.Projective (StoneCech X) := by
intro Y Z _tsY _tsZ _csY _t2Y _csZ _csZ f g hf hg g_sur let s : Z → Y := fun z => Classical.choose <| g_sur z have hs : g ∘ s = id := funext fun z => Classical.choose_spec (g_sur z) let t := s ∘ f ∘ stoneCechUnit have ht : Continuous t := continuous_of_discreteTopology let h : StoneCech X → Y := stoneCechExtend ht have hh : Continuous h := continuous_stoneCechExtend ht refine ⟨h, hh, denseRange_stoneCechUnit.equalizer (hg.comp hh) hf ?_⟩ rw [comp.assoc, stoneCechExtend_extends ht, ← comp.assoc, hs, id_comp]
9
8,103.083928
2
2
1
2,474
import Mathlib.Analysis.BoxIntegral.DivergenceTheorem import Mathlib.Analysis.BoxIntegral.Integrability import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Analysis.Calculus.FDeriv.Equiv #align_import measure_theory.integral.divergence_theorem from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open Set Finset TopologicalSpace Function BoxIntegral MeasureTheory Filter open scoped Classical Topology Interval universe u namespace MeasureTheory variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] section variable {n : ℕ} local macro:arg t:term:max noWs "ⁿ" : term => `(Fin n → $t) local macro:arg t:term:max noWs "ⁿ⁺¹" : term => `(Fin (n + 1) → $t) local notation "e " i => Pi.single i 1 section
Mathlib/MeasureTheory/Integral/DivergenceTheorem.lean
111
137
theorem integral_divergence_of_hasFDerivWithinAt_off_countable_aux₁ (I : Box (Fin (n + 1))) (f : ℝⁿ⁺¹ → Eⁿ⁺¹) (f' : ℝⁿ⁺¹ → ℝⁿ⁺¹ →L[ℝ] Eⁿ⁺¹) (s : Set ℝⁿ⁺¹) (hs : s.Countable) (Hc : ContinuousOn f (Box.Icc I)) (Hd : ∀ x ∈ (Box.Icc I) \ s, HasFDerivWithinAt f (f' x) (Box.Icc I) x) (Hi : IntegrableOn (fun x => ∑ i, f' x (e i) i) (Box.Icc I)) : (∫ x in Box.Icc I, ∑ i, f' x (e i) i) = ∑ i : Fin (n + 1), ((∫ x in Box.Icc (I.face i), f (i.insertNth (I.upper i) x) i) - ∫ x in Box.Icc (I.face i), f (i.insertNth (I.lower i) x) i) := by
simp only [← setIntegral_congr_set_ae (Box.coe_ae_eq_Icc _)] have A := (Hi.mono_set Box.coe_subset_Icc).hasBoxIntegral ⊥ rfl have B := hasIntegral_GP_divergence_of_forall_hasDerivWithinAt I f f' (s ∩ Box.Icc I) (hs.mono inter_subset_left) (fun x hx => Hc _ hx.2) fun x hx => Hd _ ⟨hx.1, fun h => hx.2 ⟨h, hx.1⟩⟩ rw [continuousOn_pi] at Hc refine (A.unique B).trans (sum_congr rfl fun i _ => ?_) refine congr_arg₂ Sub.sub ?_ ?_ · have := Box.continuousOn_face_Icc (Hc i) (Set.right_mem_Icc.2 (I.lower_le_upper i)) have := (this.integrableOn_compact (μ := volume) (Box.isCompact_Icc _)).mono_set Box.coe_subset_Icc exact (this.hasBoxIntegral ⊥ rfl).integral_eq · have := Box.continuousOn_face_Icc (Hc i) (Set.left_mem_Icc.2 (I.lower_le_upper i)) have := (this.integrableOn_compact (μ := volume) (Box.isCompact_Icc _)).mono_set Box.coe_subset_Icc exact (this.hasBoxIntegral ⊥ rfl).integral_eq
17
24,154,952.753575
2
2
2
2,475
import Mathlib.Analysis.BoxIntegral.DivergenceTheorem import Mathlib.Analysis.BoxIntegral.Integrability import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Analysis.Calculus.FDeriv.Equiv #align_import measure_theory.integral.divergence_theorem from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open Set Finset TopologicalSpace Function BoxIntegral MeasureTheory Filter open scoped Classical Topology Interval universe u namespace MeasureTheory variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] section variable {n : ℕ} local macro:arg t:term:max noWs "ⁿ" : term => `(Fin n → $t) local macro:arg t:term:max noWs "ⁿ⁺¹" : term => `(Fin (n + 1) → $t) local notation "e " i => Pi.single i 1 section theorem integral_divergence_of_hasFDerivWithinAt_off_countable_aux₁ (I : Box (Fin (n + 1))) (f : ℝⁿ⁺¹ → Eⁿ⁺¹) (f' : ℝⁿ⁺¹ → ℝⁿ⁺¹ →L[ℝ] Eⁿ⁺¹) (s : Set ℝⁿ⁺¹) (hs : s.Countable) (Hc : ContinuousOn f (Box.Icc I)) (Hd : ∀ x ∈ (Box.Icc I) \ s, HasFDerivWithinAt f (f' x) (Box.Icc I) x) (Hi : IntegrableOn (fun x => ∑ i, f' x (e i) i) (Box.Icc I)) : (∫ x in Box.Icc I, ∑ i, f' x (e i) i) = ∑ i : Fin (n + 1), ((∫ x in Box.Icc (I.face i), f (i.insertNth (I.upper i) x) i) - ∫ x in Box.Icc (I.face i), f (i.insertNth (I.lower i) x) i) := by simp only [← setIntegral_congr_set_ae (Box.coe_ae_eq_Icc _)] have A := (Hi.mono_set Box.coe_subset_Icc).hasBoxIntegral ⊥ rfl have B := hasIntegral_GP_divergence_of_forall_hasDerivWithinAt I f f' (s ∩ Box.Icc I) (hs.mono inter_subset_left) (fun x hx => Hc _ hx.2) fun x hx => Hd _ ⟨hx.1, fun h => hx.2 ⟨h, hx.1⟩⟩ rw [continuousOn_pi] at Hc refine (A.unique B).trans (sum_congr rfl fun i _ => ?_) refine congr_arg₂ Sub.sub ?_ ?_ · have := Box.continuousOn_face_Icc (Hc i) (Set.right_mem_Icc.2 (I.lower_le_upper i)) have := (this.integrableOn_compact (μ := volume) (Box.isCompact_Icc _)).mono_set Box.coe_subset_Icc exact (this.hasBoxIntegral ⊥ rfl).integral_eq · have := Box.continuousOn_face_Icc (Hc i) (Set.left_mem_Icc.2 (I.lower_le_upper i)) have := (this.integrableOn_compact (μ := volume) (Box.isCompact_Icc _)).mono_set Box.coe_subset_Icc exact (this.hasBoxIntegral ⊥ rfl).integral_eq #align measure_theory.integral_divergence_of_has_fderiv_within_at_off_countable_aux₁ MeasureTheory.integral_divergence_of_hasFDerivWithinAt_off_countable_aux₁
Mathlib/MeasureTheory/Integral/DivergenceTheorem.lean
143
245
theorem integral_divergence_of_hasFDerivWithinAt_off_countable_aux₂ (I : Box (Fin (n + 1))) (f : ℝⁿ⁺¹ → Eⁿ⁺¹) (f' : ℝⁿ⁺¹ → ℝⁿ⁺¹ →L[ℝ] Eⁿ⁺¹) (s : Set ℝⁿ⁺¹) (hs : s.Countable) (Hc : ContinuousOn f (Box.Icc I)) (Hd : ∀ x ∈ Box.Ioo I \ s, HasFDerivAt f (f' x) x) (Hi : IntegrableOn (∑ i, f' · (e i) i) (Box.Icc I)) : (∫ x in Box.Icc I, ∑ i, f' x (e i) i) = ∑ i : Fin (n + 1), ((∫ x in Box.Icc (I.face i), f (i.insertNth (I.upper i) x) i) - ∫ x in Box.Icc (I.face i), f (i.insertNth (I.lower i) x) i) := by
/- Choose a monotone sequence `J k` of subboxes that cover the interior of `I` and prove that these boxes satisfy the assumptions of the previous lemma. -/ rcases I.exists_seq_mono_tendsto with ⟨J, hJ_sub, hJl, hJu⟩ have hJ_sub' : ∀ k, Box.Icc (J k) ⊆ Box.Icc I := fun k => (hJ_sub k).trans I.Ioo_subset_Icc have hJ_le : ∀ k, J k ≤ I := fun k => Box.le_iff_Icc.2 (hJ_sub' k) have HcJ : ∀ k, ContinuousOn f (Box.Icc (J k)) := fun k => Hc.mono (hJ_sub' k) have HdJ : ∀ (k), ∀ x ∈ (Box.Icc (J k)) \ s, HasFDerivWithinAt f (f' x) (Box.Icc (J k)) x := fun k x hx => (Hd x ⟨hJ_sub k hx.1, hx.2⟩).hasFDerivWithinAt have HiJ : ∀ k, IntegrableOn (∑ i, f' · (e i) i) (Box.Icc (J k)) volume := fun k => Hi.mono_set (hJ_sub' k) -- Apply the previous lemma to `J k`. have HJ_eq := fun k => integral_divergence_of_hasFDerivWithinAt_off_countable_aux₁ (J k) f f' s hs (HcJ k) (HdJ k) (HiJ k) -- Note that the LHS of `HJ_eq k` tends to the LHS of the goal as `k → ∞`. have hI_tendsto : Tendsto (fun k => ∫ x in Box.Icc (J k), ∑ i, f' x (e i) i) atTop (𝓝 (∫ x in Box.Icc I, ∑ i, f' x (e i) i)) := by simp only [IntegrableOn, ← Measure.restrict_congr_set (Box.Ioo_ae_eq_Icc _)] at Hi ⊢ rw [← Box.iUnion_Ioo_of_tendsto J.monotone hJl hJu] at Hi ⊢ exact tendsto_setIntegral_of_monotone (fun k => (J k).measurableSet_Ioo) (Box.Ioo.comp J).monotone Hi -- Thus it suffices to prove the same about the RHS. refine tendsto_nhds_unique_of_eventuallyEq hI_tendsto ?_ (eventually_of_forall HJ_eq) clear hI_tendsto rw [tendsto_pi_nhds] at hJl hJu /- We'll need to prove a similar statement about the integrals over the front sides and the integrals over the back sides. In order to avoid repeating ourselves, we formulate a lemma. -/ suffices ∀ (i : Fin (n + 1)) (c : ℕ → ℝ) (d), (∀ k, c k ∈ Icc (I.lower i) (I.upper i)) → Tendsto c atTop (𝓝 d) → Tendsto (fun k => ∫ x in Box.Icc ((J k).face i), f (i.insertNth (c k) x) i) atTop (𝓝 <| ∫ x in Box.Icc (I.face i), f (i.insertNth d x) i) by rw [Box.Icc_eq_pi] at hJ_sub' refine tendsto_finset_sum _ fun i _ => (this _ _ _ ?_ (hJu _)).sub (this _ _ _ ?_ (hJl _)) exacts [fun k => hJ_sub' k (J k).upper_mem_Icc _ trivial, fun k => hJ_sub' k (J k).lower_mem_Icc _ trivial] intro i c d hc hcd /- First we prove that the integrals of the restriction of `f` to `{x | x i = d}` over increasing boxes `((J k).face i).Icc` tend to the desired limit. The proof mostly repeats the one above. -/ have hd : d ∈ Icc (I.lower i) (I.upper i) := isClosed_Icc.mem_of_tendsto hcd (eventually_of_forall hc) have Hic : ∀ k, IntegrableOn (fun x => f (i.insertNth (c k) x) i) (Box.Icc (I.face i)) := fun k => (Box.continuousOn_face_Icc ((continuous_apply i).comp_continuousOn Hc) (hc k)).integrableOn_Icc have Hid : IntegrableOn (fun x => f (i.insertNth d x) i) (Box.Icc (I.face i)) := (Box.continuousOn_face_Icc ((continuous_apply i).comp_continuousOn Hc) hd).integrableOn_Icc have H : Tendsto (fun k => ∫ x in Box.Icc ((J k).face i), f (i.insertNth d x) i) atTop (𝓝 <| ∫ x in Box.Icc (I.face i), f (i.insertNth d x) i) := by have hIoo : (⋃ k, Box.Ioo ((J k).face i)) = Box.Ioo (I.face i) := Box.iUnion_Ioo_of_tendsto ((Box.monotone_face i).comp J.monotone) (tendsto_pi_nhds.2 fun _ => hJl _) (tendsto_pi_nhds.2 fun _ => hJu _) simp only [IntegrableOn, ← Measure.restrict_congr_set (Box.Ioo_ae_eq_Icc _), ← hIoo] at Hid ⊢ exact tendsto_setIntegral_of_monotone (fun k => ((J k).face i).measurableSet_Ioo) (Box.Ioo.monotone.comp ((Box.monotone_face i).comp J.monotone)) Hid /- Thus it suffices to show that the distance between the integrals of the restrictions of `f` to `{x | x i = c k}` and `{x | x i = d}` over `((J k).face i).Icc` tends to zero as `k → ∞`. Choose `ε > 0`. -/ refine H.congr_dist (Metric.nhds_basis_closedBall.tendsto_right_iff.2 fun ε εpos => ?_) have hvol_pos : ∀ J : Box (Fin n), 0 < ∏ j, (J.upper j - J.lower j) := fun J => prod_pos fun j hj => sub_pos.2 <| J.lower_lt_upper _ /- Choose `δ > 0` such that for any `x y ∈ I.Icc` at distance at most `δ`, the distance between `f x` and `f y` is at most `ε / volume (I.face i).Icc`, then the distance between the integrals is at most `(ε / volume (I.face i).Icc) * volume ((J k).face i).Icc ≤ ε`. -/ rcases Metric.uniformContinuousOn_iff_le.1 (I.isCompact_Icc.uniformContinuousOn_of_continuous Hc) (ε / ∏ j, ((I.face i).upper j - (I.face i).lower j)) (div_pos εpos (hvol_pos (I.face i))) with ⟨δ, δpos, hδ⟩ refine (hcd.eventually (Metric.ball_mem_nhds _ δpos)).mono fun k hk => ?_ have Hsub : Box.Icc ((J k).face i) ⊆ Box.Icc (I.face i) := Box.le_iff_Icc.1 (Box.face_mono (hJ_le _) i) rw [mem_closedBall_zero_iff, Real.norm_eq_abs, abs_of_nonneg dist_nonneg, dist_eq_norm, ← integral_sub (Hid.mono_set Hsub) ((Hic _).mono_set Hsub)] calc ‖∫ x in Box.Icc ((J k).face i), f (i.insertNth d x) i - f (i.insertNth (c k) x) i‖ ≤ (ε / ∏ j, ((I.face i).upper j - (I.face i).lower j)) * (volume (Box.Icc ((J k).face i))).toReal := by refine norm_setIntegral_le_of_norm_le_const' (((J k).face i).measure_Icc_lt_top _) ((J k).face i).measurableSet_Icc fun x hx => ?_ rw [← dist_eq_norm] calc dist (f (i.insertNth d x) i) (f (i.insertNth (c k) x) i) ≤ dist (f (i.insertNth d x)) (f (i.insertNth (c k) x)) := dist_le_pi_dist (f (i.insertNth d x)) (f (i.insertNth (c k) x)) i _ ≤ ε / ∏ j, ((I.face i).upper j - (I.face i).lower j) := hδ _ (I.mapsTo_insertNth_face_Icc hd <| Hsub hx) _ (I.mapsTo_insertNth_face_Icc (hc _) <| Hsub hx) ?_ rw [Fin.dist_insertNth_insertNth, dist_self, dist_comm] exact max_le hk.le δpos.lt.le _ ≤ ε := by rw [Box.Icc_def, Real.volume_Icc_pi_toReal ((J k).face i).lower_le_upper, ← le_div_iff (hvol_pos _)] gcongr exacts [hvol_pos _, fun _ _ ↦ sub_nonneg.2 (Box.lower_le_upper _ _), (hJ_sub' _ (J _).upper_mem_Icc).2 _, (hJ_sub' _ (J _).lower_mem_Icc).1 _]
93
24,512,455,429,200,860,000,000,000,000,000,000,000,000
2
2
2
2,475
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.ContDiff.RCLike import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv noncomputable section namespace ContDiffAt variable {𝕂 : Type*} [RCLike 𝕂] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕂 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕂 F] variable [CompleteSpace E] (f : E → F) {f' : E ≃L[𝕂] F} {a : E} def toPartialHomeomorph {n : ℕ∞} (hf : ContDiffAt 𝕂 n f a) (hf' : HasFDerivAt f (f' : E →L[𝕂] F) a) (hn : 1 ≤ n) : PartialHomeomorph E F := (hf.hasStrictFDerivAt' hf' hn).toPartialHomeomorph f #align cont_diff_at.to_local_homeomorph ContDiffAt.toPartialHomeomorph variable {f} @[simp] theorem toPartialHomeomorph_coe {n : ℕ∞} (hf : ContDiffAt 𝕂 n f a) (hf' : HasFDerivAt f (f' : E →L[𝕂] F) a) (hn : 1 ≤ n) : (hf.toPartialHomeomorph f hf' hn : E → F) = f := rfl #align cont_diff_at.to_local_homeomorph_coe ContDiffAt.toPartialHomeomorph_coe theorem mem_toPartialHomeomorph_source {n : ℕ∞} (hf : ContDiffAt 𝕂 n f a) (hf' : HasFDerivAt f (f' : E →L[𝕂] F) a) (hn : 1 ≤ n) : a ∈ (hf.toPartialHomeomorph f hf' hn).source := (hf.hasStrictFDerivAt' hf' hn).mem_toPartialHomeomorph_source #align cont_diff_at.mem_to_local_homeomorph_source ContDiffAt.mem_toPartialHomeomorph_source theorem image_mem_toPartialHomeomorph_target {n : ℕ∞} (hf : ContDiffAt 𝕂 n f a) (hf' : HasFDerivAt f (f' : E →L[𝕂] F) a) (hn : 1 ≤ n) : f a ∈ (hf.toPartialHomeomorph f hf' hn).target := (hf.hasStrictFDerivAt' hf' hn).image_mem_toPartialHomeomorph_target #align cont_diff_at.image_mem_to_local_homeomorph_target ContDiffAt.image_mem_toPartialHomeomorph_target def localInverse {n : ℕ∞} (hf : ContDiffAt 𝕂 n f a) (hf' : HasFDerivAt f (f' : E →L[𝕂] F) a) (hn : 1 ≤ n) : F → E := (hf.hasStrictFDerivAt' hf' hn).localInverse f f' a #align cont_diff_at.local_inverse ContDiffAt.localInverse theorem localInverse_apply_image {n : ℕ∞} (hf : ContDiffAt 𝕂 n f a) (hf' : HasFDerivAt f (f' : E →L[𝕂] F) a) (hn : 1 ≤ n) : hf.localInverse hf' hn (f a) = a := (hf.hasStrictFDerivAt' hf' hn).localInverse_apply_image #align cont_diff_at.local_inverse_apply_image ContDiffAt.localInverse_apply_image
Mathlib/Analysis/Calculus/InverseFunctionTheorem/ContDiff.lean
68
75
theorem to_localInverse {n : ℕ∞} (hf : ContDiffAt 𝕂 n f a) (hf' : HasFDerivAt f (f' : E →L[𝕂] F) a) (hn : 1 ≤ n) : ContDiffAt 𝕂 n (hf.localInverse hf' hn) (f a) := by
have := hf.localInverse_apply_image hf' hn apply (hf.toPartialHomeomorph f hf' hn).contDiffAt_symm (image_mem_toPartialHomeomorph_target hf hf' hn) · convert hf' · convert hf
5
148.413159
2
2
1
2,476
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
485,165,195.40979
2
2
1
2,477
import Mathlib.Algebra.CharP.Basic import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.RingTheory.Coprime.Lemmas #align_import algebra.char_p.char_and_card from "leanprover-community/mathlib"@"2fae5fd7f90711febdadf19c44dc60fae8834d1b"
Mathlib/Algebra/CharP/CharAndCard.lean
24
47
theorem isUnit_iff_not_dvd_char_of_ringChar_ne_zero (R : Type*) [CommRing R] (p : ℕ) [Fact p.Prime] (hR : ringChar R ≠ 0) : IsUnit (p : R) ↔ ¬p ∣ ringChar R := by
have hch := CharP.cast_eq_zero R (ringChar R) have hp : p.Prime := Fact.out constructor · rintro h₁ ⟨q, hq⟩ rcases IsUnit.exists_left_inv h₁ with ⟨a, ha⟩ have h₃ : ¬ringChar R ∣ q := by rintro ⟨r, hr⟩ rw [hr, ← mul_assoc, mul_comm p, mul_assoc] at hq nth_rw 1 [← mul_one (ringChar R)] at hq exact Nat.Prime.not_dvd_one hp ⟨r, mul_left_cancel₀ hR hq⟩ have h₄ := mt (CharP.intCast_eq_zero_iff R (ringChar R) q).mp apply_fun ((↑) : ℕ → R) at hq apply_fun (· * ·) a at hq rw [Nat.cast_mul, hch, mul_zero, ← mul_assoc, ha, one_mul] at hq norm_cast at h₄ exact h₄ h₃ hq.symm · intro h rcases (hp.coprime_iff_not_dvd.mpr h).isCoprime with ⟨a, b, hab⟩ apply_fun ((↑) : ℤ → R) at hab push_cast at hab rw [hch, mul_zero, add_zero, mul_comm] at hab exact isUnit_of_mul_eq_one (p : R) a hab
22
3,584,912,846.131591
2
2
2
2,478
import Mathlib.Algebra.CharP.Basic import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.RingTheory.Coprime.Lemmas #align_import algebra.char_p.char_and_card from "leanprover-community/mathlib"@"2fae5fd7f90711febdadf19c44dc60fae8834d1b" theorem isUnit_iff_not_dvd_char_of_ringChar_ne_zero (R : Type*) [CommRing R] (p : ℕ) [Fact p.Prime] (hR : ringChar R ≠ 0) : IsUnit (p : R) ↔ ¬p ∣ ringChar R := by have hch := CharP.cast_eq_zero R (ringChar R) have hp : p.Prime := Fact.out constructor · rintro h₁ ⟨q, hq⟩ rcases IsUnit.exists_left_inv h₁ with ⟨a, ha⟩ have h₃ : ¬ringChar R ∣ q := by rintro ⟨r, hr⟩ rw [hr, ← mul_assoc, mul_comm p, mul_assoc] at hq nth_rw 1 [← mul_one (ringChar R)] at hq exact Nat.Prime.not_dvd_one hp ⟨r, mul_left_cancel₀ hR hq⟩ have h₄ := mt (CharP.intCast_eq_zero_iff R (ringChar R) q).mp apply_fun ((↑) : ℕ → R) at hq apply_fun (· * ·) a at hq rw [Nat.cast_mul, hch, mul_zero, ← mul_assoc, ha, one_mul] at hq norm_cast at h₄ exact h₄ h₃ hq.symm · intro h rcases (hp.coprime_iff_not_dvd.mpr h).isCoprime with ⟨a, b, hab⟩ apply_fun ((↑) : ℤ → R) at hab push_cast at hab rw [hch, mul_zero, add_zero, mul_comm] at hab exact isUnit_of_mul_eq_one (p : R) a hab #align is_unit_iff_not_dvd_char_of_ring_char_ne_zero isUnit_iff_not_dvd_char_of_ringChar_ne_zero theorem isUnit_iff_not_dvd_char (R : Type*) [CommRing R] (p : ℕ) [Fact p.Prime] [Finite R] : IsUnit (p : R) ↔ ¬p ∣ ringChar R := isUnit_iff_not_dvd_char_of_ringChar_ne_zero R p <| CharP.char_ne_zero_of_finite R (ringChar R) #align is_unit_iff_not_dvd_char isUnit_iff_not_dvd_char
Mathlib/Algebra/CharP/CharAndCard.lean
59
75
theorem prime_dvd_char_iff_dvd_card {R : Type*} [CommRing R] [Fintype R] (p : ℕ) [Fact p.Prime] : p ∣ ringChar R ↔ p ∣ Fintype.card R := by
refine ⟨fun h => h.trans <| Int.natCast_dvd_natCast.mp <| (CharP.intCast_eq_zero_iff R (ringChar R) (Fintype.card R)).mp <| mod_cast Nat.cast_card_eq_zero R, fun h => ?_⟩ by_contra h₀ rcases exists_prime_addOrderOf_dvd_card p h with ⟨r, hr⟩ have hr₁ := addOrderOf_nsmul_eq_zero r rw [hr, nsmul_eq_mul] at hr₁ rcases IsUnit.exists_left_inv ((isUnit_iff_not_dvd_char R p).mpr h₀) with ⟨u, hu⟩ apply_fun (· * ·) u at hr₁ rw [mul_zero, ← mul_assoc, hu, one_mul] at hr₁ exact mt AddMonoid.addOrderOf_eq_one_iff.mpr (ne_of_eq_of_ne hr (Nat.Prime.ne_one Fact.out)) hr₁
15
3,269,017.372472
2
2
2
2,478
import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import measure_theory.function.strongly_measurable.lp from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open MeasureTheory Filter TopologicalSpace Function open scoped ENNReal Topology MeasureTheory namespace MeasureTheory local infixr:25 " →ₛ " => SimpleFunc variable {α G : Type*} {p : ℝ≥0∞} {m m0 : MeasurableSpace α} {μ : Measure α} [NormedAddCommGroup G] {f : α → G}
Mathlib/MeasureTheory/Function/StronglyMeasurable/Lp.lean
40
54
theorem Memℒp.finStronglyMeasurable_of_stronglyMeasurable (hf : Memℒp f p μ) (hf_meas : StronglyMeasurable f) (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) : FinStronglyMeasurable f μ := by
borelize G haveI : SeparableSpace (Set.range f ∪ {0} : Set G) := hf_meas.separableSpace_range_union_singleton let fs := SimpleFunc.approxOn f hf_meas.measurable (Set.range f ∪ {0}) 0 (by simp) refine ⟨fs, ?_, ?_⟩ · have h_fs_Lp : ∀ n, Memℒp (fs n) p μ := SimpleFunc.memℒp_approxOn_range hf_meas.measurable hf exact fun n => (fs n).measure_support_lt_top_of_memℒp (h_fs_Lp n) hp_ne_zero hp_ne_top · intro x apply SimpleFunc.tendsto_approxOn apply subset_closure simp
12
162,754.791419
2
2
1
2,479
import Mathlib.Analysis.BoxIntegral.Basic import Mathlib.Analysis.BoxIntegral.Partition.Additive import Mathlib.Analysis.Calculus.FDeriv.Prod #align_import analysis.box_integral.divergence_theorem from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee" open scoped Classical NNReal ENNReal Topology BoxIntegral open ContinuousLinearMap (lsmul) open Filter Set Finset Metric open BoxIntegral.IntegrationParams (GP gp_le) noncomputable section universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] {n : ℕ} namespace BoxIntegral variable [CompleteSpace E] (I : Box (Fin (n + 1))) {i : Fin (n + 1)} open MeasureTheory
Mathlib/Analysis/BoxIntegral/DivergenceTheorem.lean
65
136
theorem norm_volume_sub_integral_face_upper_sub_lower_smul_le {f : (Fin (n + 1) → ℝ) → E} {f' : (Fin (n + 1) → ℝ) →L[ℝ] E} (hfc : ContinuousOn f (Box.Icc I)) {x : Fin (n + 1) → ℝ} (hxI : x ∈ (Box.Icc I)) {a : E} {ε : ℝ} (h0 : 0 < ε) (hε : ∀ y ∈ (Box.Icc I), ‖f y - a - f' (y - x)‖ ≤ ε * ‖y - x‖) {c : ℝ≥0} (hc : I.distortion ≤ c) : ‖(∏ j, (I.upper j - I.lower j)) • f' (Pi.single i 1) - (integral (I.face i) ⊥ (f ∘ i.insertNth (α := fun _ ↦ ℝ) (I.upper i)) BoxAdditiveMap.volume - integral (I.face i) ⊥ (f ∘ i.insertNth (α := fun _ ↦ ℝ) (I.lower i)) BoxAdditiveMap.volume)‖ ≤ 2 * ε * c * ∏ j, (I.upper j - I.lower j) := by
-- Porting note: Lean fails to find `α` in the next line set e : ℝ → (Fin n → ℝ) → (Fin (n + 1) → ℝ) := i.insertNth (α := fun _ ↦ ℝ) /- **Plan of the proof**. The difference of the integrals of the affine function `fun y ↦ a + f' (y - x)` over the faces `x i = I.upper i` and `x i = I.lower i` is equal to the volume of `I` multiplied by `f' (Pi.single i 1)`, so it suffices to show that the integral of `f y - a - f' (y - x)` over each of these faces is less than or equal to `ε * c * vol I`. We integrate a function of the norm `≤ ε * diam I.Icc` over a box of volume `∏ j ≠ i, (I.upper j - I.lower j)`. Since `diam I.Icc ≤ c * (I.upper i - I.lower i)`, we get the required estimate. -/ have Hl : I.lower i ∈ Icc (I.lower i) (I.upper i) := Set.left_mem_Icc.2 (I.lower_le_upper i) have Hu : I.upper i ∈ Icc (I.lower i) (I.upper i) := Set.right_mem_Icc.2 (I.lower_le_upper i) have Hi : ∀ x ∈ Icc (I.lower i) (I.upper i), Integrable.{0, u, u} (I.face i) ⊥ (f ∘ e x) BoxAdditiveMap.volume := fun x hx => integrable_of_continuousOn _ (Box.continuousOn_face_Icc hfc hx) volume /- We start with an estimate: the difference of the values of `f` at the corresponding points of the faces `x i = I.lower i` and `x i = I.upper i` is `(2 * ε * diam I.Icc)`-close to the value of `f'` on `Pi.single i (I.upper i - I.lower i) = lᵢ • eᵢ`, where `lᵢ = I.upper i - I.lower i` is the length of `i`-th edge of `I` and `eᵢ = Pi.single i 1` is the `i`-th unit vector. -/ have : ∀ y ∈ Box.Icc (I.face i), ‖f' (Pi.single i (I.upper i - I.lower i)) - (f (e (I.upper i) y) - f (e (I.lower i) y))‖ ≤ 2 * ε * diam (Box.Icc I) := fun y hy ↦ by set g := fun y => f y - a - f' (y - x) with hg change ∀ y ∈ (Box.Icc I), ‖g y‖ ≤ ε * ‖y - x‖ at hε clear_value g; obtain rfl : f = fun y => a + f' (y - x) + g y := by simp [hg] convert_to ‖g (e (I.lower i) y) - g (e (I.upper i) y)‖ ≤ _ · congr 1 have := Fin.insertNth_sub_same (α := fun _ ↦ ℝ) i (I.upper i) (I.lower i) y simp only [← this, f'.map_sub]; abel · have : ∀ z ∈ Icc (I.lower i) (I.upper i), e z y ∈ (Box.Icc I) := fun z hz => I.mapsTo_insertNth_face_Icc hz hy replace hε : ∀ y ∈ (Box.Icc I), ‖g y‖ ≤ ε * diam (Box.Icc I) := by intro y hy refine (hε y hy).trans (mul_le_mul_of_nonneg_left ?_ h0.le) rw [← dist_eq_norm] exact dist_le_diam_of_mem I.isCompact_Icc.isBounded hy hxI rw [two_mul, add_mul] exact norm_sub_le_of_le (hε _ (this _ Hl)) (hε _ (this _ Hu)) calc ‖(∏ j, (I.upper j - I.lower j)) • f' (Pi.single i 1) - (integral (I.face i) ⊥ (f ∘ e (I.upper i)) BoxAdditiveMap.volume - integral (I.face i) ⊥ (f ∘ e (I.lower i)) BoxAdditiveMap.volume)‖ = ‖integral.{0, u, u} (I.face i) ⊥ (fun x : Fin n → ℝ => f' (Pi.single i (I.upper i - I.lower i)) - (f (e (I.upper i) x) - f (e (I.lower i) x))) BoxAdditiveMap.volume‖ := by rw [← integral_sub (Hi _ Hu) (Hi _ Hl), ← Box.volume_face_mul i, mul_smul, ← Box.volume_apply, ← BoxAdditiveMap.toSMul_apply, ← integral_const, ← BoxAdditiveMap.volume, ← integral_sub (integrable_const _) ((Hi _ Hu).sub (Hi _ Hl))] simp only [(· ∘ ·), Pi.sub_def, ← f'.map_smul, ← Pi.single_smul', smul_eq_mul, mul_one] _ ≤ (volume (I.face i : Set (Fin n → ℝ))).toReal * (2 * ε * c * (I.upper i - I.lower i)) := by -- The hard part of the estimate was done above, here we just replace `diam I.Icc` -- with `c * (I.upper i - I.lower i)` refine norm_integral_le_of_le_const (fun y hy => (this y hy).trans ?_) volume rw [mul_assoc (2 * ε)] gcongr exact I.diam_Icc_le_of_distortion_le i hc _ = 2 * ε * c * ∏ j, (I.upper j - I.lower j) := by rw [← Measure.toBoxAdditive_apply, Box.volume_apply, ← I.volume_face_mul i] ac_rfl
62
843,835,666,874,145,400,000,000,000
2
2
1
2,480
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat section CancelMonoidWithZero -- There doesn't seem to be a better home for these right now variable {M : Type*} [CancelMonoidWithZero M] [Finite M] theorem mul_right_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => a * b := Finite.injective_iff_bijective.1 <| mul_right_injective₀ ha #align mul_right_bijective_of_finite₀ mul_right_bijective_of_finite₀ theorem mul_left_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => b * a := Finite.injective_iff_bijective.1 <| mul_left_injective₀ ha #align mul_left_bijective_of_finite₀ mul_left_bijective_of_finite₀ def Fintype.groupWithZeroOfCancel (M : Type*) [CancelMonoidWithZero M] [DecidableEq M] [Fintype M] [Nontrivial M] : GroupWithZero M := { ‹Nontrivial M›, ‹CancelMonoidWithZero M› with inv := fun a => if h : a = 0 then 0 else Fintype.bijInv (mul_right_bijective_of_finite₀ h) 1 mul_inv_cancel := fun a ha => by simp only [Inv.inv, dif_neg ha] exact Fintype.rightInverse_bijInv _ _ inv_zero := by simp [Inv.inv, dif_pos rfl] } #align fintype.group_with_zero_of_cancel Fintype.groupWithZeroOfCancel
Mathlib/RingTheory/IntegralDomain.lean
61
69
theorem exists_eq_pow_of_mul_eq_pow_of_coprime {R : Type*} [CommSemiring R] [IsDomain R] [GCDMonoid R] [Unique Rˣ] {a b c : R} {n : ℕ} (cp : IsCoprime a b) (h : a * b = c ^ n) : ∃ d : R, a = d ^ n := by
refine exists_eq_pow_of_mul_eq_pow (isUnit_of_dvd_one ?_) h obtain ⟨x, y, hxy⟩ := cp rw [← hxy] exact -- Porting note: added `GCDMonoid.` twice dvd_add (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_left _ _) _) (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_right _ _) _)
6
403.428793
2
2
6
2,481
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat section CancelMonoidWithZero -- There doesn't seem to be a better home for these right now variable {M : Type*} [CancelMonoidWithZero M] [Finite M] theorem mul_right_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => a * b := Finite.injective_iff_bijective.1 <| mul_right_injective₀ ha #align mul_right_bijective_of_finite₀ mul_right_bijective_of_finite₀ theorem mul_left_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => b * a := Finite.injective_iff_bijective.1 <| mul_left_injective₀ ha #align mul_left_bijective_of_finite₀ mul_left_bijective_of_finite₀ def Fintype.groupWithZeroOfCancel (M : Type*) [CancelMonoidWithZero M] [DecidableEq M] [Fintype M] [Nontrivial M] : GroupWithZero M := { ‹Nontrivial M›, ‹CancelMonoidWithZero M› with inv := fun a => if h : a = 0 then 0 else Fintype.bijInv (mul_right_bijective_of_finite₀ h) 1 mul_inv_cancel := fun a ha => by simp only [Inv.inv, dif_neg ha] exact Fintype.rightInverse_bijInv _ _ inv_zero := by simp [Inv.inv, dif_pos rfl] } #align fintype.group_with_zero_of_cancel Fintype.groupWithZeroOfCancel theorem exists_eq_pow_of_mul_eq_pow_of_coprime {R : Type*} [CommSemiring R] [IsDomain R] [GCDMonoid R] [Unique Rˣ] {a b c : R} {n : ℕ} (cp : IsCoprime a b) (h : a * b = c ^ n) : ∃ d : R, a = d ^ n := by refine exists_eq_pow_of_mul_eq_pow (isUnit_of_dvd_one ?_) h obtain ⟨x, y, hxy⟩ := cp rw [← hxy] exact -- Porting note: added `GCDMonoid.` twice dvd_add (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_left _ _) _) (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_right _ _) _) #align exists_eq_pow_of_mul_eq_pow_of_coprime exists_eq_pow_of_mul_eq_pow_of_coprime nonrec
Mathlib/RingTheory/IntegralDomain.lean
73
84
theorem Finset.exists_eq_pow_of_mul_eq_pow_of_coprime {ι R : Type*} [CommSemiring R] [IsDomain R] [GCDMonoid R] [Unique Rˣ] {n : ℕ} {c : R} {s : Finset ι} {f : ι → R} (h : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → IsCoprime (f i) (f j)) (hprod : ∏ i ∈ s, f i = c ^ n) : ∀ i ∈ s, ∃ d : R, f i = d ^ n := by
classical intro i hi rw [← insert_erase hi, prod_insert (not_mem_erase i s)] at hprod refine exists_eq_pow_of_mul_eq_pow_of_coprime (IsCoprime.prod_right fun j hj => h i hi j (erase_subset i s hj) fun hij => ?_) hprod rw [hij] at hj exact (s.not_mem_erase _) hj
8
2,980.957987
2
2
6
2,481
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead
Mathlib/RingTheory/IntegralDomain.lean
122
133
theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by
haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption
9
8,103.083928
2
2
6
2,481
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption #align card_nth_roots_subgroup_units card_nthRoots_subgroup_units
Mathlib/RingTheory/IntegralDomain.lean
137
142
theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by
classical cases nonempty_fintype G apply isCyclic_of_card_pow_eq_one_le intro n hn exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1))
5
148.413159
2
2
6
2,481
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption #align card_nth_roots_subgroup_units card_nthRoots_subgroup_units theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by classical cases nonempty_fintype G apply isCyclic_of_card_pow_eq_one_le intro n hn exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1)) #align is_cyclic_of_subgroup_is_domain isCyclic_of_subgroup_isDomain instance [Finite Rˣ] : IsCyclic Rˣ := isCyclic_of_subgroup_isDomain (Units.coeHom R) <| Units.ext section variable (S : Subgroup Rˣ) [Finite S] instance subgroup_units_cyclic : IsCyclic S := by -- Porting note: the original proof used a `coe`, but I was not able to get it to work. apply isCyclic_of_subgroup_isDomain (R := R) (G := S) _ _ · exact MonoidHom.mk (OneHom.mk (fun s => ↑s.val) rfl) (by simp) · exact Units.ext.comp Subtype.val_injective #align subgroup_units_cyclic subgroup_units_cyclic end section EuclideanDivision namespace Polynomial open Polynomial variable (K : Type) [Field K] [Algebra R[X] K] [IsFractionRing R[X] K]
Mathlib/RingTheory/IntegralDomain.lean
174
185
theorem div_eq_quo_add_rem_div (f : R[X]) {g : R[X]} (hg : g.Monic) : ∃ q r : R[X], r.degree < g.degree ∧ (algebraMap R[X] K f) / (algebraMap R[X] K g) = algebraMap R[X] K q + (algebraMap R[X] K r) / (algebraMap R[X] K g) := by
refine ⟨f /ₘ g, f %ₘ g, ?_, ?_⟩ · exact degree_modByMonic_lt _ hg · have hg' : algebraMap R[X] K g ≠ 0 := -- Porting note: the proof was `by exact_mod_cast Monic.ne_zero hg` (map_ne_zero_iff _ (IsFractionRing.injective R[X] K)).mpr (Monic.ne_zero hg) field_simp [hg'] -- Porting note: `norm_cast` was here, but does nothing. rw [add_comm, mul_comm, ← map_mul, ← map_add, modByMonic_add_div f hg]
8
2,980.957987
2
2
6
2,481
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption #align card_nth_roots_subgroup_units card_nthRoots_subgroup_units theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by classical cases nonempty_fintype G apply isCyclic_of_card_pow_eq_one_le intro n hn exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1)) #align is_cyclic_of_subgroup_is_domain isCyclic_of_subgroup_isDomain instance [Finite Rˣ] : IsCyclic Rˣ := isCyclic_of_subgroup_isDomain (Units.coeHom R) <| Units.ext section variable (S : Subgroup Rˣ) [Finite S] instance subgroup_units_cyclic : IsCyclic S := by -- Porting note: the original proof used a `coe`, but I was not able to get it to work. apply isCyclic_of_subgroup_isDomain (R := R) (G := S) _ _ · exact MonoidHom.mk (OneHom.mk (fun s => ↑s.val) rfl) (by simp) · exact Units.ext.comp Subtype.val_injective #align subgroup_units_cyclic subgroup_units_cyclic end section EuclideanDivision variable [Fintype G] @[deprecated (since := "2024-06-10")] alias card_fiber_eq_of_mem_range := MonoidHom.card_fiber_eq_of_mem_range
Mathlib/RingTheory/IntegralDomain.lean
200
254
theorem sum_hom_units_eq_zero (f : G →* R) (hf : f ≠ 1) : ∑ g : G, f g = 0 := by
classical obtain ⟨x, hx⟩ : ∃ x : MonoidHom.range f.toHomUnits, ∀ y : MonoidHom.range f.toHomUnits, y ∈ Submonoid.powers x := IsCyclic.exists_monoid_generator have hx1 : x ≠ 1 := by rintro rfl apply hf ext g rw [MonoidHom.one_apply] cases' hx ⟨f.toHomUnits g, g, rfl⟩ with n hn rwa [Subtype.ext_iff, Units.ext_iff, Subtype.coe_mk, MonoidHom.coe_toHomUnits, one_pow, eq_comm] at hn replace hx1 : (x.val : R) - 1 ≠ 0 := -- Porting note: was `(x : R)` fun h => hx1 (Subtype.eq (Units.ext (sub_eq_zero.1 h))) let c := (univ.filter fun g => f.toHomUnits g = 1).card calc ∑ g : G, f g = ∑ g : G, (f.toHomUnits g : R) := rfl _ = ∑ u ∈ univ.image f.toHomUnits, (univ.filter fun g => f.toHomUnits g = u).card • (u : R) := (sum_comp ((↑) : Rˣ → R) f.toHomUnits) _ = ∑ u ∈ univ.image f.toHomUnits, c • (u : R) := (sum_congr rfl fun u hu => congr_arg₂ _ ?_ rfl) -- remaining goal 1, proven below -- Porting note: have to change `(b : R)` into `((b : Rˣ) : R)` _ = ∑ b : MonoidHom.range f.toHomUnits, c • ((b : Rˣ) : R) := (Finset.sum_subtype _ (by simp) _) _ = c • ∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R) := smul_sum.symm _ = c • (0 : R) := congr_arg₂ _ rfl ?_ -- remaining goal 2, proven below _ = (0 : R) := smul_zero _ · -- remaining goal 1 show (univ.filter fun g : G => f.toHomUnits g = u).card = c apply MonoidHom.card_fiber_eq_of_mem_range f.toHomUnits · simpa only [mem_image, mem_univ, true_and, Set.mem_range] using hu · exact ⟨1, f.toHomUnits.map_one⟩ -- remaining goal 2 show (∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R)) = 0 calc (∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R)) = ∑ n ∈ range (orderOf x), ((x : Rˣ) : R) ^ n := Eq.symm <| sum_nbij (x ^ ·) (by simp only [mem_univ, forall_true_iff]) (by simpa using pow_injOn_Iio_orderOf) (fun b _ => let ⟨n, hn⟩ := hx b ⟨n % orderOf x, mem_range.2 (Nat.mod_lt _ (orderOf_pos _)), -- Porting note: have to use `dsimp` to apply the function by dsimp at hn ⊢; rw [pow_mod_orderOf, hn]⟩) (by simp only [imp_true_iff, eq_self_iff_true, Subgroup.coe_pow, Units.val_pow_eq_pow_val]) _ = 0 := ?_ rw [← mul_left_inj' hx1, zero_mul, geom_sum_mul] norm_cast simp [pow_orderOf_eq_one]
53
104,137,594,330,290,870,000,000
2
2
6
2,481
import Mathlib.MeasureTheory.Decomposition.Lebesgue import Mathlib.MeasureTheory.Measure.Complex import Mathlib.MeasureTheory.Decomposition.Jordan import Mathlib.MeasureTheory.Measure.WithDensityVectorMeasure noncomputable section open scoped Classical MeasureTheory NNReal ENNReal open Set variable {α β : Type*} {m : MeasurableSpace α} {μ ν : MeasureTheory.Measure α} namespace MeasureTheory namespace SignedMeasure open Measure class HaveLebesgueDecomposition (s : SignedMeasure α) (μ : Measure α) : Prop where posPart : s.toJordanDecomposition.posPart.HaveLebesgueDecomposition μ negPart : s.toJordanDecomposition.negPart.HaveLebesgueDecomposition μ #align measure_theory.signed_measure.have_lebesgue_decomposition MeasureTheory.SignedMeasure.HaveLebesgueDecomposition #align measure_theory.signed_measure.have_lebesgue_decomposition.pos_part MeasureTheory.SignedMeasure.HaveLebesgueDecomposition.posPart #align measure_theory.signed_measure.have_lebesgue_decomposition.neg_part MeasureTheory.SignedMeasure.HaveLebesgueDecomposition.negPart attribute [instance] HaveLebesgueDecomposition.posPart attribute [instance] HaveLebesgueDecomposition.negPart theorem not_haveLebesgueDecomposition_iff (s : SignedMeasure α) (μ : Measure α) : ¬s.HaveLebesgueDecomposition μ ↔ ¬s.toJordanDecomposition.posPart.HaveLebesgueDecomposition μ ∨ ¬s.toJordanDecomposition.negPart.HaveLebesgueDecomposition μ := ⟨fun h => not_or_of_imp fun hp hn => h ⟨hp, hn⟩, fun h hl => (not_and_or.2 h) ⟨hl.1, hl.2⟩⟩ #align measure_theory.signed_measure.not_have_lebesgue_decomposition_iff MeasureTheory.SignedMeasure.not_haveLebesgueDecomposition_iff -- `inferInstance` directly does not work -- see Note [lower instance priority] instance (priority := 100) haveLebesgueDecomposition_of_sigmaFinite (s : SignedMeasure α) (μ : Measure α) [SigmaFinite μ] : s.HaveLebesgueDecomposition μ where posPart := inferInstance negPart := inferInstance #align measure_theory.signed_measure.have_lebesgue_decomposition_of_sigma_finite MeasureTheory.SignedMeasure.haveLebesgueDecomposition_of_sigmaFinite instance haveLebesgueDecomposition_neg (s : SignedMeasure α) (μ : Measure α) [s.HaveLebesgueDecomposition μ] : (-s).HaveLebesgueDecomposition μ where posPart := by rw [toJordanDecomposition_neg, JordanDecomposition.neg_posPart] infer_instance negPart := by rw [toJordanDecomposition_neg, JordanDecomposition.neg_negPart] infer_instance #align measure_theory.signed_measure.have_lebesgue_decomposition_neg MeasureTheory.SignedMeasure.haveLebesgueDecomposition_neg instance haveLebesgueDecomposition_smul (s : SignedMeasure α) (μ : Measure α) [s.HaveLebesgueDecomposition μ] (r : ℝ≥0) : (r • s).HaveLebesgueDecomposition μ where posPart := by rw [toJordanDecomposition_smul, JordanDecomposition.smul_posPart] infer_instance negPart := by rw [toJordanDecomposition_smul, JordanDecomposition.smul_negPart] infer_instance #align measure_theory.signed_measure.have_lebesgue_decomposition_smul MeasureTheory.SignedMeasure.haveLebesgueDecomposition_smul instance haveLebesgueDecomposition_smul_real (s : SignedMeasure α) (μ : Measure α) [s.HaveLebesgueDecomposition μ] (r : ℝ) : (r • s).HaveLebesgueDecomposition μ := by by_cases hr : 0 ≤ r · lift r to ℝ≥0 using hr exact s.haveLebesgueDecomposition_smul μ _ · rw [not_le] at hr refine { posPart := by rw [toJordanDecomposition_smul_real, JordanDecomposition.real_smul_posPart_neg _ _ hr] infer_instance negPart := by rw [toJordanDecomposition_smul_real, JordanDecomposition.real_smul_negPart_neg _ _ hr] infer_instance } #align measure_theory.signed_measure.have_lebesgue_decomposition_smul_real MeasureTheory.SignedMeasure.haveLebesgueDecomposition_smul_real def singularPart (s : SignedMeasure α) (μ : Measure α) : SignedMeasure α := (s.toJordanDecomposition.posPart.singularPart μ).toSignedMeasure - (s.toJordanDecomposition.negPart.singularPart μ).toSignedMeasure #align measure_theory.signed_measure.singular_part MeasureTheory.SignedMeasure.singularPart section
Mathlib/MeasureTheory/Decomposition/SignedLebesgue.lean
131
145
theorem singularPart_mutuallySingular (s : SignedMeasure α) (μ : Measure α) : s.toJordanDecomposition.posPart.singularPart μ ⟂ₘ s.toJordanDecomposition.negPart.singularPart μ := by
by_cases hl : s.HaveLebesgueDecomposition μ · obtain ⟨i, hi, hpos, hneg⟩ := s.toJordanDecomposition.mutuallySingular rw [s.toJordanDecomposition.posPart.haveLebesgueDecomposition_add μ] at hpos rw [s.toJordanDecomposition.negPart.haveLebesgueDecomposition_add μ] at hneg rw [add_apply, add_eq_zero_iff] at hpos hneg exact ⟨i, hi, hpos.1, hneg.1⟩ · rw [not_haveLebesgueDecomposition_iff] at hl cases' hl with hp hn · rw [Measure.singularPart, dif_neg hp] exact MutuallySingular.zero_left · rw [Measure.singularPart, Measure.singularPart, dif_neg hn] exact MutuallySingular.zero_right
12
162,754.791419
2
2
2
2,482
import Mathlib.MeasureTheory.Decomposition.Lebesgue import Mathlib.MeasureTheory.Measure.Complex import Mathlib.MeasureTheory.Decomposition.Jordan import Mathlib.MeasureTheory.Measure.WithDensityVectorMeasure noncomputable section open scoped Classical MeasureTheory NNReal ENNReal open Set variable {α β : Type*} {m : MeasurableSpace α} {μ ν : MeasureTheory.Measure α} namespace MeasureTheory namespace SignedMeasure open Measure class HaveLebesgueDecomposition (s : SignedMeasure α) (μ : Measure α) : Prop where posPart : s.toJordanDecomposition.posPart.HaveLebesgueDecomposition μ negPart : s.toJordanDecomposition.negPart.HaveLebesgueDecomposition μ #align measure_theory.signed_measure.have_lebesgue_decomposition MeasureTheory.SignedMeasure.HaveLebesgueDecomposition #align measure_theory.signed_measure.have_lebesgue_decomposition.pos_part MeasureTheory.SignedMeasure.HaveLebesgueDecomposition.posPart #align measure_theory.signed_measure.have_lebesgue_decomposition.neg_part MeasureTheory.SignedMeasure.HaveLebesgueDecomposition.negPart attribute [instance] HaveLebesgueDecomposition.posPart attribute [instance] HaveLebesgueDecomposition.negPart theorem not_haveLebesgueDecomposition_iff (s : SignedMeasure α) (μ : Measure α) : ¬s.HaveLebesgueDecomposition μ ↔ ¬s.toJordanDecomposition.posPart.HaveLebesgueDecomposition μ ∨ ¬s.toJordanDecomposition.negPart.HaveLebesgueDecomposition μ := ⟨fun h => not_or_of_imp fun hp hn => h ⟨hp, hn⟩, fun h hl => (not_and_or.2 h) ⟨hl.1, hl.2⟩⟩ #align measure_theory.signed_measure.not_have_lebesgue_decomposition_iff MeasureTheory.SignedMeasure.not_haveLebesgueDecomposition_iff -- `inferInstance` directly does not work -- see Note [lower instance priority] instance (priority := 100) haveLebesgueDecomposition_of_sigmaFinite (s : SignedMeasure α) (μ : Measure α) [SigmaFinite μ] : s.HaveLebesgueDecomposition μ where posPart := inferInstance negPart := inferInstance #align measure_theory.signed_measure.have_lebesgue_decomposition_of_sigma_finite MeasureTheory.SignedMeasure.haveLebesgueDecomposition_of_sigmaFinite instance haveLebesgueDecomposition_neg (s : SignedMeasure α) (μ : Measure α) [s.HaveLebesgueDecomposition μ] : (-s).HaveLebesgueDecomposition μ where posPart := by rw [toJordanDecomposition_neg, JordanDecomposition.neg_posPart] infer_instance negPart := by rw [toJordanDecomposition_neg, JordanDecomposition.neg_negPart] infer_instance #align measure_theory.signed_measure.have_lebesgue_decomposition_neg MeasureTheory.SignedMeasure.haveLebesgueDecomposition_neg instance haveLebesgueDecomposition_smul (s : SignedMeasure α) (μ : Measure α) [s.HaveLebesgueDecomposition μ] (r : ℝ≥0) : (r • s).HaveLebesgueDecomposition μ where posPart := by rw [toJordanDecomposition_smul, JordanDecomposition.smul_posPart] infer_instance negPart := by rw [toJordanDecomposition_smul, JordanDecomposition.smul_negPart] infer_instance #align measure_theory.signed_measure.have_lebesgue_decomposition_smul MeasureTheory.SignedMeasure.haveLebesgueDecomposition_smul instance haveLebesgueDecomposition_smul_real (s : SignedMeasure α) (μ : Measure α) [s.HaveLebesgueDecomposition μ] (r : ℝ) : (r • s).HaveLebesgueDecomposition μ := by by_cases hr : 0 ≤ r · lift r to ℝ≥0 using hr exact s.haveLebesgueDecomposition_smul μ _ · rw [not_le] at hr refine { posPart := by rw [toJordanDecomposition_smul_real, JordanDecomposition.real_smul_posPart_neg _ _ hr] infer_instance negPart := by rw [toJordanDecomposition_smul_real, JordanDecomposition.real_smul_negPart_neg _ _ hr] infer_instance } #align measure_theory.signed_measure.have_lebesgue_decomposition_smul_real MeasureTheory.SignedMeasure.haveLebesgueDecomposition_smul_real def singularPart (s : SignedMeasure α) (μ : Measure α) : SignedMeasure α := (s.toJordanDecomposition.posPart.singularPart μ).toSignedMeasure - (s.toJordanDecomposition.negPart.singularPart μ).toSignedMeasure #align measure_theory.signed_measure.singular_part MeasureTheory.SignedMeasure.singularPart section theorem singularPart_mutuallySingular (s : SignedMeasure α) (μ : Measure α) : s.toJordanDecomposition.posPart.singularPart μ ⟂ₘ s.toJordanDecomposition.negPart.singularPart μ := by by_cases hl : s.HaveLebesgueDecomposition μ · obtain ⟨i, hi, hpos, hneg⟩ := s.toJordanDecomposition.mutuallySingular rw [s.toJordanDecomposition.posPart.haveLebesgueDecomposition_add μ] at hpos rw [s.toJordanDecomposition.negPart.haveLebesgueDecomposition_add μ] at hneg rw [add_apply, add_eq_zero_iff] at hpos hneg exact ⟨i, hi, hpos.1, hneg.1⟩ · rw [not_haveLebesgueDecomposition_iff] at hl cases' hl with hp hn · rw [Measure.singularPart, dif_neg hp] exact MutuallySingular.zero_left · rw [Measure.singularPart, Measure.singularPart, dif_neg hn] exact MutuallySingular.zero_right #align measure_theory.signed_measure.singular_part_mutually_singular MeasureTheory.SignedMeasure.singularPart_mutuallySingular
Mathlib/MeasureTheory/Decomposition/SignedLebesgue.lean
148
158
theorem singularPart_totalVariation (s : SignedMeasure α) (μ : Measure α) : (s.singularPart μ).totalVariation = s.toJordanDecomposition.posPart.singularPart μ + s.toJordanDecomposition.negPart.singularPart μ := by
have : (s.singularPart μ).toJordanDecomposition = ⟨s.toJordanDecomposition.posPart.singularPart μ, s.toJordanDecomposition.negPart.singularPart μ, singularPart_mutuallySingular s μ⟩ := by refine JordanDecomposition.toSignedMeasure_injective ?_ rw [toSignedMeasure_toJordanDecomposition, singularPart, JordanDecomposition.toSignedMeasure] rw [totalVariation, this]
7
1,096.633158
2
2
2
2,482
import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Functor.EpiMono #align_import category_theory.adjunction.evaluation from "leanprover-community/mathlib"@"937c692d73f5130c7fecd3fd32e81419f4e04eb7" namespace CategoryTheory open CategoryTheory.Limits universe v₁ v₂ u₁ u₂ variable {C : Type u₁} [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D] noncomputable section section variable [∀ a b : C, HasCoproductsOfShape (a ⟶ b) D] @[simps] def evaluationLeftAdjoint (c : C) : D ⥤ C ⥤ D where obj d := { obj := fun t => ∐ fun _ : c ⟶ t => d map := fun f => Sigma.desc fun g => (Sigma.ι fun _ => d) <| g ≫ f} map {_ d₂} f := { app := fun e => Sigma.desc fun h => f ≫ Sigma.ι (fun _ => d₂) h naturality := by intros dsimp ext simp } #align category_theory.evaluation_left_adjoint CategoryTheory.evaluationLeftAdjoint @[simps! unit_app counit_app_app] def evaluationAdjunctionRight (c : C) : evaluationLeftAdjoint D c ⊣ (evaluation _ _).obj c := Adjunction.mkOfHomEquiv { homEquiv := fun d F => { toFun := fun f => Sigma.ι (fun _ => d) (𝟙 _) ≫ f.app c invFun := fun f => { app := fun e => Sigma.desc fun h => f ≫ F.map h naturality := by intros dsimp ext simp } left_inv := by intro f ext x dsimp ext g simp only [colimit.ι_desc, Cofan.mk_ι_app, Category.assoc, ← f.naturality, evaluationLeftAdjoint_obj_map, colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Discrete.natTrans_app, Category.id_comp] right_inv := fun f => by dsimp simp } -- This used to be automatic before leanprover/lean4#2644 homEquiv_naturality_right := by intros; dsimp; simp } #align category_theory.evaluation_adjunction_right CategoryTheory.evaluationAdjunctionRight instance evaluationIsRightAdjoint (c : C) : ((evaluation _ D).obj c).IsRightAdjoint := ⟨_, ⟨evaluationAdjunctionRight _ _⟩⟩ #align category_theory.evaluation_is_right_adjoint CategoryTheory.evaluationIsRightAdjoint
Mathlib/CategoryTheory/Adjunction/Evaluation.lean
81
86
theorem NatTrans.mono_iff_mono_app {F G : C ⥤ D} (η : F ⟶ G) : Mono η ↔ ∀ c, Mono (η.app c) := by
constructor · intro h c exact (inferInstance : Mono (((evaluation _ _).obj c).map η)) · intro _ apply NatTrans.mono_of_mono_app
5
148.413159
2
2
2
2,483
import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Functor.EpiMono #align_import category_theory.adjunction.evaluation from "leanprover-community/mathlib"@"937c692d73f5130c7fecd3fd32e81419f4e04eb7" namespace CategoryTheory open CategoryTheory.Limits universe v₁ v₂ u₁ u₂ variable {C : Type u₁} [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D] noncomputable section section variable [∀ a b : C, HasCoproductsOfShape (a ⟶ b) D] @[simps] def evaluationLeftAdjoint (c : C) : D ⥤ C ⥤ D where obj d := { obj := fun t => ∐ fun _ : c ⟶ t => d map := fun f => Sigma.desc fun g => (Sigma.ι fun _ => d) <| g ≫ f} map {_ d₂} f := { app := fun e => Sigma.desc fun h => f ≫ Sigma.ι (fun _ => d₂) h naturality := by intros dsimp ext simp } #align category_theory.evaluation_left_adjoint CategoryTheory.evaluationLeftAdjoint @[simps! unit_app counit_app_app] def evaluationAdjunctionRight (c : C) : evaluationLeftAdjoint D c ⊣ (evaluation _ _).obj c := Adjunction.mkOfHomEquiv { homEquiv := fun d F => { toFun := fun f => Sigma.ι (fun _ => d) (𝟙 _) ≫ f.app c invFun := fun f => { app := fun e => Sigma.desc fun h => f ≫ F.map h naturality := by intros dsimp ext simp } left_inv := by intro f ext x dsimp ext g simp only [colimit.ι_desc, Cofan.mk_ι_app, Category.assoc, ← f.naturality, evaluationLeftAdjoint_obj_map, colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Discrete.natTrans_app, Category.id_comp] right_inv := fun f => by dsimp simp } -- This used to be automatic before leanprover/lean4#2644 homEquiv_naturality_right := by intros; dsimp; simp } #align category_theory.evaluation_adjunction_right CategoryTheory.evaluationAdjunctionRight instance evaluationIsRightAdjoint (c : C) : ((evaluation _ D).obj c).IsRightAdjoint := ⟨_, ⟨evaluationAdjunctionRight _ _⟩⟩ #align category_theory.evaluation_is_right_adjoint CategoryTheory.evaluationIsRightAdjoint theorem NatTrans.mono_iff_mono_app {F G : C ⥤ D} (η : F ⟶ G) : Mono η ↔ ∀ c, Mono (η.app c) := by constructor · intro h c exact (inferInstance : Mono (((evaluation _ _).obj c).map η)) · intro _ apply NatTrans.mono_of_mono_app #align category_theory.nat_trans.mono_iff_mono_app CategoryTheory.NatTrans.mono_iff_mono_app end section variable [∀ a b : C, HasProductsOfShape (a ⟶ b) D] @[simps] def evaluationRightAdjoint (c : C) : D ⥤ C ⥤ D where obj d := { obj := fun t => ∏ᶜ fun _ : t ⟶ c => d map := fun f => Pi.lift fun g => Pi.π _ <| f ≫ g } map f := { app := fun t => Pi.lift fun g => Pi.π _ g ≫ f naturality := by intros dsimp ext simp } #align category_theory.evaluation_right_adjoint CategoryTheory.evaluationRightAdjoint @[simps! unit_app_app counit_app] def evaluationAdjunctionLeft (c : C) : (evaluation _ _).obj c ⊣ evaluationRightAdjoint D c := Adjunction.mkOfHomEquiv { homEquiv := fun F d => { toFun := fun f => { app := fun t => Pi.lift fun g => F.map g ≫ f naturality := by intros dsimp ext simp } invFun := fun f => f.app _ ≫ Pi.π _ (𝟙 _) left_inv := fun f => by dsimp simp right_inv := by intro f ext x dsimp ext g simp only [Discrete.functor_obj, NatTrans.naturality_assoc, evaluationRightAdjoint_obj_obj, evaluationRightAdjoint_obj_map, limit.lift_π, Fan.mk_pt, Fan.mk_π_app, Discrete.natTrans_app, Category.comp_id] } } #align category_theory.evaluation_adjunction_left CategoryTheory.evaluationAdjunctionLeft instance evaluationIsLeftAdjoint (c : C) : ((evaluation _ D).obj c).IsLeftAdjoint := ⟨_, ⟨evaluationAdjunctionLeft _ _⟩⟩ #align category_theory.evaluation_is_left_adjoint CategoryTheory.evaluationIsLeftAdjoint
Mathlib/CategoryTheory/Adjunction/Evaluation.lean
140
145
theorem NatTrans.epi_iff_epi_app {F G : C ⥤ D} (η : F ⟶ G) : Epi η ↔ ∀ c, Epi (η.app c) := by
constructor · intro h c exact (inferInstance : Epi (((evaluation _ _).obj c).map η)) · intros apply NatTrans.epi_of_epi_app
5
148.413159
2
2
2
2,483
import Mathlib.Topology.GDelta import Mathlib.MeasureTheory.Group.Arithmetic import Mathlib.Topology.Instances.EReal import Mathlib.Analysis.Normed.Group.Basic #align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce" noncomputable section open Set Filter MeasureTheory open scoped Classical Topology NNReal ENNReal MeasureTheory universe u v w x y variable {α β γ γ₂ δ : Type*} {ι : Sort y} {s t u : Set α} open MeasurableSpace TopologicalSpace def borel (α : Type u) [TopologicalSpace α] : MeasurableSpace α := generateFrom { s : Set α | IsOpen s } #align borel borel theorem borel_anti : Antitone (@borel α) := fun _ _ h => MeasurableSpace.generateFrom_le fun _ hs => .basic _ (h _ hs) #align borel_anti borel_anti theorem borel_eq_top_of_discrete [TopologicalSpace α] [DiscreteTopology α] : borel α = ⊤ := top_le_iff.1 fun s _ => GenerateMeasurable.basic s (isOpen_discrete s) #align borel_eq_top_of_discrete borel_eq_top_of_discrete
Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean
63
69
theorem borel_eq_top_of_countable [TopologicalSpace α] [T1Space α] [Countable α] : borel α = ⊤ := by
refine top_le_iff.1 fun s _ => biUnion_of_singleton s ▸ ?_ apply MeasurableSet.biUnion s.to_countable intro x _ apply MeasurableSet.of_compl apply GenerateMeasurable.basic exact isClosed_singleton.isOpen_compl
6
403.428793
2
2
1
2,484
import Mathlib.Topology.Algebra.Module.StrongTopology import Mathlib.Topology.Algebra.Module.LocallyConvex #align_import analysis.locally_convex.strong_topology from "leanprover-community/mathlib"@"47b12e7f2502f14001f891ca87fbae2b4acaed3f" open Topology UniformConvergence variable {R 𝕜₁ 𝕜₂ E F : Type*} variable [AddCommGroup E] [TopologicalSpace E] [AddCommGroup F] [TopologicalSpace F] [TopologicalAddGroup F] section General namespace UniformConvergenceCLM variable (R) variable [OrderedSemiring R] variable [NormedField 𝕜₁] [NormedField 𝕜₂] [Module 𝕜₁ E] [Module 𝕜₂ F] {σ : 𝕜₁ →+* 𝕜₂} variable [Module R F] [ContinuousConstSMul R F] [LocallyConvexSpace R F] [SMulCommClass 𝕜₂ R F]
Mathlib/Analysis/LocallyConvex/StrongTopology.lean
47
54
theorem locallyConvexSpace (𝔖 : Set (Set E)) (h𝔖₁ : 𝔖.Nonempty) (h𝔖₂ : DirectedOn (· ⊆ ·) 𝔖) : LocallyConvexSpace R (UniformConvergenceCLM σ F 𝔖) := by
apply LocallyConvexSpace.ofBasisZero _ _ _ _ (UniformConvergenceCLM.hasBasis_nhds_zero_of_basis _ _ _ h𝔖₁ h𝔖₂ (LocallyConvexSpace.convex_basis_zero R F)) _ rintro ⟨S, V⟩ ⟨_, _, hVconvex⟩ f hf g hg a b ha hb hab x hx exact hVconvex (hf x hx) (hg x hx) ha hb hab
5
148.413159
2
2
1
2,485
import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Data.ZMod.Quotient #align_import measure_theory.group.add_circle from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter MeasureTheory MeasureTheory.Measure Metric open scoped MeasureTheory Pointwise Topology ENNReal namespace AddCircle variable {T : ℝ} [hT : Fact (0 < T)]
Mathlib/MeasureTheory/Group/AddCircle.lean
34
48
theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε =ᵐ[volume] ball x ε := by
rcases le_or_lt ε 0 with hε | hε · rw [ball_eq_empty.mpr hε, ae_eq_empty, volume_closedBall, min_eq_right (by linarith [hT.out] : 2 * ε ≤ T), ENNReal.ofReal_eq_zero] exact mul_nonpos_of_nonneg_of_nonpos zero_le_two hε · suffices volume (closedBall x ε) ≤ volume (ball x ε) by exact (ae_eq_of_subset_of_measure_ge ball_subset_closedBall this measurableSet_ball (measure_ne_top _ _)).symm have : Tendsto (fun δ => volume (closedBall x δ)) (𝓝[<] ε) (𝓝 <| volume (closedBall x ε)) := by simp_rw [volume_closedBall] refine ENNReal.tendsto_ofReal (Tendsto.min tendsto_const_nhds <| Tendsto.const_mul _ ?_) convert (@monotone_id ℝ _).tendsto_nhdsWithin_Iio ε simp refine le_of_tendsto this (mem_nhdsWithin_Iio_iff_exists_Ioo_subset.mpr ⟨0, hε, fun r hr => ?_⟩) exact measure_mono (closedBall_subset_ball hr.2)
14
1,202,604.284165
2
2
3
2,486
import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Data.ZMod.Quotient #align_import measure_theory.group.add_circle from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter MeasureTheory MeasureTheory.Measure Metric open scoped MeasureTheory Pointwise Topology ENNReal namespace AddCircle variable {T : ℝ} [hT : Fact (0 < T)] theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε =ᵐ[volume] ball x ε := by rcases le_or_lt ε 0 with hε | hε · rw [ball_eq_empty.mpr hε, ae_eq_empty, volume_closedBall, min_eq_right (by linarith [hT.out] : 2 * ε ≤ T), ENNReal.ofReal_eq_zero] exact mul_nonpos_of_nonneg_of_nonpos zero_le_two hε · suffices volume (closedBall x ε) ≤ volume (ball x ε) by exact (ae_eq_of_subset_of_measure_ge ball_subset_closedBall this measurableSet_ball (measure_ne_top _ _)).symm have : Tendsto (fun δ => volume (closedBall x δ)) (𝓝[<] ε) (𝓝 <| volume (closedBall x ε)) := by simp_rw [volume_closedBall] refine ENNReal.tendsto_ofReal (Tendsto.min tendsto_const_nhds <| Tendsto.const_mul _ ?_) convert (@monotone_id ℝ _).tendsto_nhdsWithin_Iio ε simp refine le_of_tendsto this (mem_nhdsWithin_Iio_iff_exists_Ioo_subset.mpr ⟨0, hε, fun r hr => ?_⟩) exact measure_mono (closedBall_subset_ball hr.2) #align add_circle.closed_ball_ae_eq_ball AddCircle.closedBall_ae_eq_ball
Mathlib/MeasureTheory/Group/AddCircle.lean
54
92
theorem isAddFundamentalDomain_of_ae_ball (I : Set <| AddCircle T) (u x : AddCircle T) (hu : IsOfFinAddOrder u) (hI : I =ᵐ[volume] ball x (T / (2 * addOrderOf u))) : IsAddFundamentalDomain (AddSubgroup.zmultiples u) I := by
set G := AddSubgroup.zmultiples u set n := addOrderOf u set B := ball x (T / (2 * n)) have hn : 1 ≤ (n : ℝ) := by norm_cast; linarith [hu.addOrderOf_pos] refine IsAddFundamentalDomain.mk_of_measure_univ_le ?_ ?_ ?_ ?_ · -- `NullMeasurableSet I volume` exact measurableSet_ball.nullMeasurableSet.congr hI.symm · -- `∀ (g : G), g ≠ 0 → AEDisjoint volume (g +ᵥ I) I` rintro ⟨g, hg⟩ hg' replace hg' : g ≠ 0 := by simpa only [Ne, AddSubgroup.mk_eq_zero] using hg' change AEDisjoint volume (g +ᵥ I) I refine AEDisjoint.congr (Disjoint.aedisjoint ?_) ((quasiMeasurePreserving_add_left volume (-g)).vadd_ae_eq_of_ae_eq g hI) hI have hBg : g +ᵥ B = ball (g + x) (T / (2 * n)) := by rw [add_comm g x, ← singleton_add_ball _ x g, add_ball, thickening_singleton] rw [hBg] apply ball_disjoint_ball rw [dist_eq_norm, add_sub_cancel_right, div_mul_eq_div_div, ← add_div, ← add_div, add_self_div_two, div_le_iff' (by positivity : 0 < (n : ℝ)), ← nsmul_eq_mul] refine (le_add_order_smul_norm_of_isOfFinAddOrder (hu.of_mem_zmultiples hg) hg').trans (nsmul_le_nsmul_left (norm_nonneg g) ?_) exact Nat.le_of_dvd (addOrderOf_pos_iff.mpr hu) (addOrderOf_dvd_of_mem_zmultiples hg) · -- `∀ (g : G), QuasiMeasurePreserving (VAdd.vadd g) volume volume` exact fun g => quasiMeasurePreserving_add_left (G := AddCircle T) volume g · -- `volume univ ≤ ∑' (g : G), volume (g +ᵥ I)` replace hI := hI.trans closedBall_ae_eq_ball.symm haveI : Fintype G := @Fintype.ofFinite _ hu.finite_zmultiples.to_subtype have hG_card : (Finset.univ : Finset G).card = n := by show _ = addOrderOf u rw [← Nat.card_zmultiples, Nat.card_eq_fintype_card]; rfl simp_rw [measure_vadd] rw [AddCircle.measure_univ, tsum_fintype, Finset.sum_const, measure_congr hI, volume_closedBall, ← ENNReal.ofReal_nsmul, mul_div, mul_div_mul_comm, div_self, one_mul, min_eq_right (div_le_self hT.out.le hn), hG_card, nsmul_eq_mul, mul_div_cancel₀ T (lt_of_lt_of_le zero_lt_one hn).ne.symm] exact two_ne_zero
36
4,311,231,547,115,195
2
2
3
2,486
import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Data.ZMod.Quotient #align_import measure_theory.group.add_circle from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter MeasureTheory MeasureTheory.Measure Metric open scoped MeasureTheory Pointwise Topology ENNReal namespace AddCircle variable {T : ℝ} [hT : Fact (0 < T)] theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε =ᵐ[volume] ball x ε := by rcases le_or_lt ε 0 with hε | hε · rw [ball_eq_empty.mpr hε, ae_eq_empty, volume_closedBall, min_eq_right (by linarith [hT.out] : 2 * ε ≤ T), ENNReal.ofReal_eq_zero] exact mul_nonpos_of_nonneg_of_nonpos zero_le_two hε · suffices volume (closedBall x ε) ≤ volume (ball x ε) by exact (ae_eq_of_subset_of_measure_ge ball_subset_closedBall this measurableSet_ball (measure_ne_top _ _)).symm have : Tendsto (fun δ => volume (closedBall x δ)) (𝓝[<] ε) (𝓝 <| volume (closedBall x ε)) := by simp_rw [volume_closedBall] refine ENNReal.tendsto_ofReal (Tendsto.min tendsto_const_nhds <| Tendsto.const_mul _ ?_) convert (@monotone_id ℝ _).tendsto_nhdsWithin_Iio ε simp refine le_of_tendsto this (mem_nhdsWithin_Iio_iff_exists_Ioo_subset.mpr ⟨0, hε, fun r hr => ?_⟩) exact measure_mono (closedBall_subset_ball hr.2) #align add_circle.closed_ball_ae_eq_ball AddCircle.closedBall_ae_eq_ball theorem isAddFundamentalDomain_of_ae_ball (I : Set <| AddCircle T) (u x : AddCircle T) (hu : IsOfFinAddOrder u) (hI : I =ᵐ[volume] ball x (T / (2 * addOrderOf u))) : IsAddFundamentalDomain (AddSubgroup.zmultiples u) I := by set G := AddSubgroup.zmultiples u set n := addOrderOf u set B := ball x (T / (2 * n)) have hn : 1 ≤ (n : ℝ) := by norm_cast; linarith [hu.addOrderOf_pos] refine IsAddFundamentalDomain.mk_of_measure_univ_le ?_ ?_ ?_ ?_ · -- `NullMeasurableSet I volume` exact measurableSet_ball.nullMeasurableSet.congr hI.symm · -- `∀ (g : G), g ≠ 0 → AEDisjoint volume (g +ᵥ I) I` rintro ⟨g, hg⟩ hg' replace hg' : g ≠ 0 := by simpa only [Ne, AddSubgroup.mk_eq_zero] using hg' change AEDisjoint volume (g +ᵥ I) I refine AEDisjoint.congr (Disjoint.aedisjoint ?_) ((quasiMeasurePreserving_add_left volume (-g)).vadd_ae_eq_of_ae_eq g hI) hI have hBg : g +ᵥ B = ball (g + x) (T / (2 * n)) := by rw [add_comm g x, ← singleton_add_ball _ x g, add_ball, thickening_singleton] rw [hBg] apply ball_disjoint_ball rw [dist_eq_norm, add_sub_cancel_right, div_mul_eq_div_div, ← add_div, ← add_div, add_self_div_two, div_le_iff' (by positivity : 0 < (n : ℝ)), ← nsmul_eq_mul] refine (le_add_order_smul_norm_of_isOfFinAddOrder (hu.of_mem_zmultiples hg) hg').trans (nsmul_le_nsmul_left (norm_nonneg g) ?_) exact Nat.le_of_dvd (addOrderOf_pos_iff.mpr hu) (addOrderOf_dvd_of_mem_zmultiples hg) · -- `∀ (g : G), QuasiMeasurePreserving (VAdd.vadd g) volume volume` exact fun g => quasiMeasurePreserving_add_left (G := AddCircle T) volume g · -- `volume univ ≤ ∑' (g : G), volume (g +ᵥ I)` replace hI := hI.trans closedBall_ae_eq_ball.symm haveI : Fintype G := @Fintype.ofFinite _ hu.finite_zmultiples.to_subtype have hG_card : (Finset.univ : Finset G).card = n := by show _ = addOrderOf u rw [← Nat.card_zmultiples, Nat.card_eq_fintype_card]; rfl simp_rw [measure_vadd] rw [AddCircle.measure_univ, tsum_fintype, Finset.sum_const, measure_congr hI, volume_closedBall, ← ENNReal.ofReal_nsmul, mul_div, mul_div_mul_comm, div_self, one_mul, min_eq_right (div_le_self hT.out.le hn), hG_card, nsmul_eq_mul, mul_div_cancel₀ T (lt_of_lt_of_le zero_lt_one hn).ne.symm] exact two_ne_zero #align add_circle.is_add_fundamental_domain_of_ae_ball AddCircle.isAddFundamentalDomain_of_ae_ball
Mathlib/MeasureTheory/Group/AddCircle.lean
95
104
theorem volume_of_add_preimage_eq (s I : Set <| AddCircle T) (u x : AddCircle T) (hu : IsOfFinAddOrder u) (hs : (u +ᵥ s : Set <| AddCircle T) =ᵐ[volume] s) (hI : I =ᵐ[volume] ball x (T / (2 * addOrderOf u))) : volume s = addOrderOf u • volume (s ∩ I) := by
let G := AddSubgroup.zmultiples u haveI : Fintype G := @Fintype.ofFinite _ hu.finite_zmultiples.to_subtype have hsG : ∀ g : G, (g +ᵥ s : Set <| AddCircle T) =ᵐ[volume] s := by rintro ⟨y, hy⟩; exact (vadd_ae_eq_self_of_mem_zmultiples hs hy : _) rw [(isAddFundamentalDomain_of_ae_ball I u x hu hI).measure_eq_card_smul_of_vadd_ae_eq_self s hsG, ← Nat.card_zmultiples u]
6
403.428793
2
2
3
2,486
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 antisymm variable {α : Type u} {β : Type v}
Mathlib/SetTheory/Cardinal/SchroederBernstein.lean
47
76
theorem schroeder_bernstein {f : α → β} {g : β → α} (hf : Function.Injective f) (hg : Function.Injective g) : ∃ h : α → β, Bijective h := by
cases' isEmpty_or_nonempty β with hβ hβ · have : IsEmpty α := Function.isEmpty f exact ⟨_, ((Equiv.equivEmpty α).trans (Equiv.equivEmpty β).symm).bijective⟩ set F : Set α →o Set α := { toFun := fun s => (g '' (f '' s)ᶜ)ᶜ monotone' := fun s t hst => compl_subset_compl.mpr <| image_subset _ <| compl_subset_compl.mpr <| image_subset _ hst } -- Porting note: dot notation `F.lfp` doesn't work here set s : Set α := OrderHom.lfp F have hs : (g '' (f '' s)ᶜ)ᶜ = s := F.map_lfp have hns : g '' (f '' s)ᶜ = sᶜ := compl_injective (by simp [hs]) set g' := invFun g have g'g : LeftInverse g' g := leftInverse_invFun hg have hg'ns : g' '' sᶜ = (f '' s)ᶜ := by rw [← hns, g'g.image_image] set h : α → β := s.piecewise f g' have : Surjective h := by rw [← range_iff_surjective, range_piecewise, hg'ns, union_compl_self] have : Injective h := by refine (injective_piecewise_iff _).2 ⟨hf.injOn, ?_, ?_⟩ · intro x hx y hy hxy obtain ⟨x', _, rfl⟩ : x ∈ g '' (f '' s)ᶜ := by rwa [hns] obtain ⟨y', _, rfl⟩ : y ∈ g '' (f '' s)ᶜ := by rwa [hns] rw [g'g _, g'g _] at hxy rw [hxy] · intro x hx y hy hxy obtain ⟨y', hy', rfl⟩ : y ∈ g '' (f '' s)ᶜ := by rwa [hns] rw [g'g _] at hxy exact hy' ⟨x, hx, hxy⟩ exact ⟨h, ‹Injective h›, ‹Surjective h›⟩
28
1,446,257,064,291.475
2
2
2
2,487
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
485,165,195.40979
2
2
2
2,487
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
485,165,195.40979
2
2
3
2,488
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 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) #align complete_lattice.is_compact_element_iff CompleteLattice.isCompactElement_iff
Mathlib/Order/CompactlyGenerated/Basic.lean
110
149
theorem isCompactElement_iff_le_of_directed_sSup_le (k : α) : IsCompactElement k ↔ ∀ s : Set α, s.Nonempty → DirectedOn (· ≤ ·) s → k ≤ sSup s → ∃ x : α, x ∈ s ∧ k ≤ x := by
classical constructor · intro hk s hne hdir hsup obtain ⟨t, ht⟩ := hk s hsup -- certainly every element of t is below something in s, since ↑t ⊆ s. have t_below_s : ∀ x ∈ t, ∃ y ∈ s, x ≤ y := fun x hxt => ⟨x, ht.left hxt, le_rfl⟩ obtain ⟨x, ⟨hxs, hsupx⟩⟩ := Finset.sup_le_of_le_directed s hne hdir t t_below_s exact ⟨x, ⟨hxs, le_trans ht.right hsupx⟩⟩ · intro hk s hsup -- Consider the set of finite joins of elements of the (plain) set s. let S : Set α := { x | ∃ t : Finset α, ↑t ⊆ s ∧ x = t.sup id } -- S is directed, nonempty, and still has sup above k. have dir_US : DirectedOn (· ≤ ·) S := by rintro x ⟨c, hc⟩ y ⟨d, hd⟩ use x ⊔ y constructor · use c ∪ d constructor · simp only [hc.left, hd.left, Set.union_subset_iff, Finset.coe_union, and_self_iff] · simp only [hc.right, hd.right, Finset.sup_union] simp only [and_self_iff, le_sup_left, le_sup_right] have sup_S : sSup s ≤ sSup S := by apply sSup_le_sSup intro x hx use {x} simpa only [and_true_iff, id, Finset.coe_singleton, eq_self_iff_true, Finset.sup_singleton, Set.singleton_subset_iff] have Sne : S.Nonempty := by suffices ⊥ ∈ S from Set.nonempty_of_mem this use ∅ simp only [Set.empty_subset, Finset.coe_empty, Finset.sup_empty, eq_self_iff_true, and_self_iff] -- Now apply the defn of compact and finish. obtain ⟨j, ⟨hjS, hjk⟩⟩ := hk S Sne dir_US (le_trans hsup sup_S) obtain ⟨t, ⟨htS, htsup⟩⟩ := hjS use t exact ⟨htS, by rwa [← htsup]⟩
37
11,719,142,372,802,612
2
2
3
2,488
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 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) #align complete_lattice.is_compact_element_iff CompleteLattice.isCompactElement_iff theorem isCompactElement_iff_le_of_directed_sSup_le (k : α) : IsCompactElement k ↔ ∀ s : Set α, s.Nonempty → DirectedOn (· ≤ ·) s → k ≤ sSup s → ∃ x : α, x ∈ s ∧ k ≤ x := by classical constructor · intro hk s hne hdir hsup obtain ⟨t, ht⟩ := hk s hsup -- certainly every element of t is below something in s, since ↑t ⊆ s. have t_below_s : ∀ x ∈ t, ∃ y ∈ s, x ≤ y := fun x hxt => ⟨x, ht.left hxt, le_rfl⟩ obtain ⟨x, ⟨hxs, hsupx⟩⟩ := Finset.sup_le_of_le_directed s hne hdir t t_below_s exact ⟨x, ⟨hxs, le_trans ht.right hsupx⟩⟩ · intro hk s hsup -- Consider the set of finite joins of elements of the (plain) set s. let S : Set α := { x | ∃ t : Finset α, ↑t ⊆ s ∧ x = t.sup id } -- S is directed, nonempty, and still has sup above k. have dir_US : DirectedOn (· ≤ ·) S := by rintro x ⟨c, hc⟩ y ⟨d, hd⟩ use x ⊔ y constructor · use c ∪ d constructor · simp only [hc.left, hd.left, Set.union_subset_iff, Finset.coe_union, and_self_iff] · simp only [hc.right, hd.right, Finset.sup_union] simp only [and_self_iff, le_sup_left, le_sup_right] have sup_S : sSup s ≤ sSup S := by apply sSup_le_sSup intro x hx use {x} simpa only [and_true_iff, id, Finset.coe_singleton, eq_self_iff_true, Finset.sup_singleton, Set.singleton_subset_iff] have Sne : S.Nonempty := by suffices ⊥ ∈ S from Set.nonempty_of_mem this use ∅ simp only [Set.empty_subset, Finset.coe_empty, Finset.sup_empty, eq_self_iff_true, and_self_iff] -- Now apply the defn of compact and finish. obtain ⟨j, ⟨hjS, hjk⟩⟩ := hk S Sne dir_US (le_trans hsup sup_S) obtain ⟨t, ⟨htS, htsup⟩⟩ := hjS use t exact ⟨htS, by rwa [← htsup]⟩ #align complete_lattice.is_compact_element_iff_le_of_directed_Sup_le CompleteLattice.isCompactElement_iff_le_of_directed_sSup_le
Mathlib/Order/CompactlyGenerated/Basic.lean
152
169
theorem IsCompactElement.exists_finset_of_le_iSup {k : α} (hk : IsCompactElement k) {ι : Type*} (f : ι → α) (h : k ≤ ⨆ i, f i) : ∃ s : Finset ι, k ≤ ⨆ i ∈ s, f i := by
classical let g : Finset ι → α := fun s => ⨆ i ∈ s, f i have h1 : DirectedOn (· ≤ ·) (Set.range g) := by rintro - ⟨s, rfl⟩ - ⟨t, rfl⟩ exact ⟨g (s ∪ t), ⟨s ∪ t, rfl⟩, iSup_le_iSup_of_subset Finset.subset_union_left, iSup_le_iSup_of_subset Finset.subset_union_right⟩ have h2 : k ≤ sSup (Set.range g) := h.trans (iSup_le fun i => le_sSup_of_le ⟨{i}, rfl⟩ (le_iSup_of_le i (le_iSup_of_le (Finset.mem_singleton_self i) le_rfl))) obtain ⟨-, ⟨s, rfl⟩, hs⟩ := (isCompactElement_iff_le_of_directed_sSup_le α k).mp hk (Set.range g) (Set.range_nonempty g) h1 h2 exact ⟨s, hs⟩
16
8,886,110.520508
2
2
3
2,488
import Mathlib.Analysis.Calculus.ContDiff.Defs import Mathlib.Analysis.Calculus.MeanValue #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Set Fin Filter Function open scoped NNReal Topology section Real variable {n : ℕ∞} {𝕂 : Type*} [RCLike 𝕂] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕂 E'] {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕂 F'] theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' → F'} {x : E'} {p : E' → FormalMultilinearSeries 𝕂 E' F'} (hf : HasFTaylorSeriesUpToOn n f p s) (hn : 1 ≤ n) (hs : s ∈ 𝓝 x) : HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕂 E' F') (p x 1)) x := hasStrictFDerivAt_of_hasFDerivAt_of_continuousAt (hf.eventually_hasFDerivAt hn hs) <| (continuousMultilinearCurryFin1 𝕂 E' F').continuousAt.comp <| (hf.cont 1 hn).continuousAt hs #align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFTaylorSeriesUpToOn.hasStrictFDerivAt
Mathlib/Analysis/Calculus/ContDiff/RCLike.lean
43
49
theorem ContDiffAt.hasStrictFDerivAt' {f : E' → F'} {f' : E' →L[𝕂] F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≤ n) : HasStrictFDerivAt f f' x := by
rcases hf 1 hn with ⟨u, H, p, hp⟩ simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H have := hp.hasStrictFDerivAt le_rfl H rwa [hf'.unique this.hasFDerivAt]
4
54.59815
2
2
2
2,489
import Mathlib.Analysis.Calculus.ContDiff.Defs import Mathlib.Analysis.Calculus.MeanValue #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Set Fin Filter Function open scoped NNReal Topology section Real variable {n : ℕ∞} {𝕂 : Type*} [RCLike 𝕂] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕂 E'] {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕂 F'] theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' → F'} {x : E'} {p : E' → FormalMultilinearSeries 𝕂 E' F'} (hf : HasFTaylorSeriesUpToOn n f p s) (hn : 1 ≤ n) (hs : s ∈ 𝓝 x) : HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕂 E' F') (p x 1)) x := hasStrictFDerivAt_of_hasFDerivAt_of_continuousAt (hf.eventually_hasFDerivAt hn hs) <| (continuousMultilinearCurryFin1 𝕂 E' F').continuousAt.comp <| (hf.cont 1 hn).continuousAt hs #align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFTaylorSeriesUpToOn.hasStrictFDerivAt theorem ContDiffAt.hasStrictFDerivAt' {f : E' → F'} {f' : E' →L[𝕂] F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≤ n) : HasStrictFDerivAt f f' x := by rcases hf 1 hn with ⟨u, H, p, hp⟩ simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H have := hp.hasStrictFDerivAt le_rfl H rwa [hf'.unique this.hasFDerivAt] #align cont_diff_at.has_strict_fderiv_at' ContDiffAt.hasStrictFDerivAt' theorem ContDiffAt.hasStrictDerivAt' {f : 𝕂 → F'} {f' : F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x) (hf' : HasDerivAt f f' x) (hn : 1 ≤ n) : HasStrictDerivAt f f' x := hf.hasStrictFDerivAt' hf' hn #align cont_diff_at.has_strict_deriv_at' ContDiffAt.hasStrictDerivAt' theorem ContDiffAt.hasStrictFDerivAt {f : E' → F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≤ n) : HasStrictFDerivAt f (fderiv 𝕂 f x) x := hf.hasStrictFDerivAt' (hf.differentiableAt hn).hasFDerivAt hn #align cont_diff_at.has_strict_fderiv_at ContDiffAt.hasStrictFDerivAt theorem ContDiffAt.hasStrictDerivAt {f : 𝕂 → F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≤ n) : HasStrictDerivAt f (deriv f x) x := (hf.hasStrictFDerivAt hn).hasStrictDerivAt #align cont_diff_at.has_strict_deriv_at ContDiffAt.hasStrictDerivAt theorem ContDiff.hasStrictFDerivAt {f : E' → F'} {x : E'} (hf : ContDiff 𝕂 n f) (hn : 1 ≤ n) : HasStrictFDerivAt f (fderiv 𝕂 f x) x := hf.contDiffAt.hasStrictFDerivAt hn #align cont_diff.has_strict_fderiv_at ContDiff.hasStrictFDerivAt theorem ContDiff.hasStrictDerivAt {f : 𝕂 → F'} {x : 𝕂} (hf : ContDiff 𝕂 n f) (hn : 1 ≤ n) : HasStrictDerivAt f (deriv f x) x := hf.contDiffAt.hasStrictDerivAt hn #align cont_diff.has_strict_deriv_at ContDiff.hasStrictDerivAt
Mathlib/Analysis/Calculus/ContDiff/RCLike.lean
87
101
theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E → F} {p : E → FormalMultilinearSeries ℝ E F} {s : Set E} {x : E} (hf : HasFTaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) (K : ℝ≥0) (hK : ‖p x 1‖₊ < K) : ∃ t ∈ 𝓝[s] x, LipschitzOnWith K f t := by
set f' := fun y => continuousMultilinearCurryFin1 ℝ E F (p y 1) have hder : ∀ y ∈ s, HasFDerivWithinAt f (f' y) s y := fun y hy => (hf.hasFDerivWithinAt le_rfl (subset_insert x s hy)).mono (subset_insert x s) have hcont : ContinuousWithinAt f' s x := (continuousMultilinearCurryFin1 ℝ E F).continuousAt.comp_continuousWithinAt ((hf.cont _ le_rfl _ (mem_insert _ _)).mono (subset_insert x s)) replace hK : ‖f' x‖₊ < K := by simpa only [f', LinearIsometryEquiv.nnnorm_map] exact hs.exists_nhdsWithin_lipschitzOnWith_of_hasFDerivWithinAt_of_nnnorm_lt (eventually_nhdsWithin_iff.2 <| eventually_of_forall hder) hcont K hK
10
22,026.465795
2
2
2
2,489
import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.RingTheory.Ideal.Quotient #align_import topology.algebra.ring.ideal from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" section CommRing variable {R : Type*} [TopologicalSpace R] [CommRing R] (N : Ideal R) open Ideal.Quotient instance topologicalRingQuotientTopology : TopologicalSpace (R ⧸ N) := instTopologicalSpaceQuotient #align topological_ring_quotient_topology topologicalRingQuotientTopology -- note for the reader: in the following, `mk` is `Ideal.Quotient.mk`, the canonical map `R → R/I`. variable [TopologicalRing R]
Mathlib/Topology/Algebra/Ring/Ideal.lean
61
65
theorem QuotientRing.isOpenMap_coe : IsOpenMap (mk N) := by
intro s s_op change IsOpen (mk N ⁻¹' (mk N '' s)) rw [quotient_ring_saturate] exact isOpen_iUnion fun ⟨n, _⟩ => isOpenMap_add_left n s s_op
4
54.59815
2
2
1
2,490
import Mathlib.Topology.Algebra.GroupCompletion import Mathlib.Topology.Algebra.InfiniteSum.Group open UniformSpace.Completion variable {α β : Type*} [AddCommGroup α] [UniformSpace α] [UniformAddGroup α] theorem hasSum_iff_hasSum_compl (f : β → α) (a : α): HasSum (toCompl ∘ f) a ↔ HasSum f a := (denseInducing_toCompl α).hasSum_iff f a theorem summable_iff_summable_compl_and_tsum_mem (f : β → α) : Summable f ↔ Summable (toCompl ∘ f) ∧ ∑' i, toCompl (f i) ∈ Set.range toCompl := (denseInducing_toCompl α).summable_iff_tsum_comp_mem_range f
Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean
32
45
theorem summable_iff_cauchySeq_finset_and_tsum_mem (f : β → α) : Summable f ↔ CauchySeq (fun s : Finset β ↦ ∑ b in s, f b) ∧ ∑' i, toCompl (f i) ∈ Set.range toCompl := by
classical constructor · rintro ⟨a, ha⟩ exact ⟨ha.cauchySeq, ((summable_iff_summable_compl_and_tsum_mem f).mp ⟨a, ha⟩).2⟩ · rintro ⟨h_cauchy, h_tsum⟩ apply (summable_iff_summable_compl_and_tsum_mem f).mpr constructor · apply summable_iff_cauchySeq_finset.mpr simp_rw [Function.comp_apply, ← map_sum] exact h_cauchy.map (uniformContinuous_coe α) · exact h_tsum
11
59,874.141715
2
2
1
2,491
import Mathlib.Algebra.Category.GroupCat.Basic import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects #align_import algebra.category.Group.zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open CategoryTheory open CategoryTheory.Limits universe u namespace GroupCat @[to_additive]
Mathlib/Algebra/Category/GroupCat/Zero.lean
28
34
theorem isZero_of_subsingleton (G : GroupCat) [Subsingleton G] : IsZero G := by
refine ⟨fun X => ⟨⟨⟨1⟩, fun f => ?_⟩⟩, fun X => ⟨⟨⟨1⟩, fun f => ?_⟩⟩⟩ · ext x have : x = 1 := Subsingleton.elim _ _ rw [this, map_one, map_one] · ext apply Subsingleton.elim
6
403.428793
2
2
2
2,492
import Mathlib.Algebra.Category.GroupCat.Basic import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects #align_import algebra.category.Group.zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open CategoryTheory open CategoryTheory.Limits universe u namespace CommGroupCat @[to_additive]
Mathlib/Algebra/Category/GroupCat/Zero.lean
49
55
theorem isZero_of_subsingleton (G : CommGroupCat) [Subsingleton G] : IsZero G := by
refine ⟨fun X => ⟨⟨⟨1⟩, fun f => ?_⟩⟩, fun X => ⟨⟨⟨1⟩, fun f => ?_⟩⟩⟩ · ext x have : x = 1 := Subsingleton.elim _ _ rw [this, map_one, map_one] · ext apply Subsingleton.elim
6
403.428793
2
2
2
2,492
import Mathlib.CategoryTheory.Groupoid import Mathlib.Combinatorics.Quiver.Basic #align_import category_theory.groupoid.basic from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da" namespace CategoryTheory namespace Groupoid variable (C : Type*) [Groupoid C] section Thin
Mathlib/CategoryTheory/Groupoid/Basic.lean
23
30
theorem isThin_iff : Quiver.IsThin C ↔ ∀ c : C, Subsingleton (c ⟶ c) := by
refine ⟨fun h c => h c c, fun h c d => Subsingleton.intro fun f g => ?_⟩ haveI := h d calc f = f ≫ inv g ≫ g := by simp only [inv_eq_inv, IsIso.inv_hom_id, Category.comp_id] _ = f ≫ inv f ≫ g := by congr 1 simp only [inv_eq_inv, IsIso.inv_hom_id, eq_iff_true_of_subsingleton] _ = g := by simp only [inv_eq_inv, IsIso.hom_inv_id_assoc]
7
1,096.633158
2
2
1
2,493
import Mathlib.AlgebraicTopology.DoldKan.Homotopies import Mathlib.Tactic.Ring #align_import algebraic_topology.dold_kan.faces from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Limits CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.SimplicialObject Simplicial namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] variable {X : SimplicialObject C} def HigherFacesVanish {Y : C} {n : ℕ} (q : ℕ) (φ : Y ⟶ X _[n + 1]) : Prop := ∀ j : Fin (n + 1), n + 1 ≤ (j : ℕ) + q → φ ≫ X.δ j.succ = 0 #align algebraic_topology.dold_kan.higher_faces_vanish AlgebraicTopology.DoldKan.HigherFacesVanish namespace HigherFacesVanish @[reassoc]
Mathlib/AlgebraicTopology/DoldKan/Faces.lean
53
58
theorem comp_δ_eq_zero {Y : C} {n : ℕ} {q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (j : Fin (n + 2)) (hj₁ : j ≠ 0) (hj₂ : n + 2 ≤ (j : ℕ) + q) : φ ≫ X.δ j = 0 := by
obtain ⟨i, rfl⟩ := Fin.eq_succ_of_ne_zero hj₁ apply v i simp only [Fin.val_succ] at hj₂ omega
4
54.59815
2
2
2
2,494
import Mathlib.AlgebraicTopology.DoldKan.Homotopies import Mathlib.Tactic.Ring #align_import algebraic_topology.dold_kan.faces from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Limits CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.SimplicialObject Simplicial namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] variable {X : SimplicialObject C} def HigherFacesVanish {Y : C} {n : ℕ} (q : ℕ) (φ : Y ⟶ X _[n + 1]) : Prop := ∀ j : Fin (n + 1), n + 1 ≤ (j : ℕ) + q → φ ≫ X.δ j.succ = 0 #align algebraic_topology.dold_kan.higher_faces_vanish AlgebraicTopology.DoldKan.HigherFacesVanish namespace HigherFacesVanish @[reassoc] theorem comp_δ_eq_zero {Y : C} {n : ℕ} {q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (j : Fin (n + 2)) (hj₁ : j ≠ 0) (hj₂ : n + 2 ≤ (j : ℕ) + q) : φ ≫ X.δ j = 0 := by obtain ⟨i, rfl⟩ := Fin.eq_succ_of_ne_zero hj₁ apply v i simp only [Fin.val_succ] at hj₂ omega #align algebraic_topology.dold_kan.higher_faces_vanish.comp_δ_eq_zero AlgebraicTopology.DoldKan.HigherFacesVanish.comp_δ_eq_zero theorem of_succ {Y : C} {n q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish (q + 1) φ) : HigherFacesVanish q φ := fun j hj => v j (by simpa only [← add_assoc] using le_add_right hj) #align algebraic_topology.dold_kan.higher_faces_vanish.of_succ AlgebraicTopology.DoldKan.HigherFacesVanish.of_succ theorem of_comp {Y Z : C} {q n : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (f : Z ⟶ Y) : HigherFacesVanish q (f ≫ φ) := fun j hj => by rw [assoc, v j hj, comp_zero] #align algebraic_topology.dold_kan.higher_faces_vanish.of_comp AlgebraicTopology.DoldKan.HigherFacesVanish.of_comp
Mathlib/AlgebraicTopology/DoldKan/Faces.lean
69
139
theorem comp_Hσ_eq {Y : C} {n a q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (hnaq : n = a + q) : φ ≫ (Hσ q).f (n + 1) = -φ ≫ X.δ ⟨a + 1, Nat.succ_lt_succ (Nat.lt_succ_iff.mpr (Nat.le.intro hnaq.symm))⟩ ≫ X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro hnaq.symm)⟩ := by
have hnaq_shift : ∀ d : ℕ, n + d = a + d + q := by intro d rw [add_assoc, add_comm d, ← add_assoc, hnaq] rw [Hσ, Homotopy.nullHomotopicMap'_f (c_mk (n + 2) (n + 1) rfl) (c_mk (n + 1) n rfl), hσ'_eq hnaq (c_mk (n + 1) n rfl), hσ'_eq (hnaq_shift 1) (c_mk (n + 2) (n + 1) rfl)] simp only [AlternatingFaceMapComplex.obj_d_eq, eqToHom_refl, comp_id, comp_sum, sum_comp, comp_add] simp only [comp_zsmul, zsmul_comp, ← assoc, ← mul_zsmul] -- cleaning up the first sum rw [← Fin.sum_congr' _ (hnaq_shift 2).symm, Fin.sum_trunc] swap · rintro ⟨k, hk⟩ suffices φ ≫ X.δ (⟨a + 2 + k, by omega⟩ : Fin (n + 2)) = 0 by simp only [this, Fin.natAdd_mk, Fin.cast_mk, zero_comp, smul_zero] convert v ⟨a + k + 1, by omega⟩ (by rw [Fin.val_mk]; omega) dsimp omega -- cleaning up the second sum rw [← Fin.sum_congr' _ (hnaq_shift 3).symm, @Fin.sum_trunc _ _ (a + 3)] swap · rintro ⟨k, hk⟩ rw [assoc, X.δ_comp_σ_of_gt', v.comp_δ_eq_zero_assoc, zero_comp, zsmul_zero] · simp only [Fin.lt_iff_val_lt_val] dsimp [Fin.natAdd, Fin.cast] omega · intro h rw [Fin.pred_eq_iff_eq_succ, Fin.ext_iff] at h dsimp [Fin.cast] at h omega · dsimp [Fin.cast, Fin.pred] rw [Nat.add_right_comm, Nat.add_sub_assoc (by norm_num : 1 ≤ 3)] omega simp only [assoc] conv_lhs => congr · rw [Fin.sum_univ_castSucc] · rw [Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] dsimp [Fin.cast, Fin.castLE, Fin.castLT] /- the purpose of the following `simplif` is to create three subgoals in order to finish the proof -/ have simplif : ∀ a b c d e f : Y ⟶ X _[n + 1], b = f → d + e = 0 → c + a = 0 → a + b + (c + d + e) = f := by intro a b c d e f h1 h2 h3 rw [add_assoc c d e, h2, add_zero, add_comm a, add_assoc, add_comm a, h3, add_zero, h1] apply simplif · -- b = f rw [← pow_add, Odd.neg_one_pow, neg_smul, one_zsmul] exact ⟨a, by omega⟩ · -- d + e = 0 rw [X.δ_comp_σ_self' (Fin.castSucc_mk _ _ _).symm, X.δ_comp_σ_succ' (Fin.succ_mk _ _ _).symm] simp only [comp_id, pow_add _ (a + 1) 1, pow_one, mul_neg, mul_one, neg_mul, neg_smul, add_right_neg] · -- c + a = 0 rw [← Finset.sum_add_distrib] apply Finset.sum_eq_zero rintro ⟨i, hi⟩ _ simp only have hia : (⟨i, by omega⟩ : Fin (n + 2)) ≤ Fin.castSucc (⟨a, by omega⟩ : Fin (n + 1)) := by rw [Fin.le_iff_val_le_val] dsimp omega erw [δ_comp_σ_of_le X hia, add_eq_zero_iff_eq_neg, ← neg_zsmul] congr 2 ring
66
46,071,866,343,312,910,000,000,000,000
2
2
2
2,494
import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.SpecialFunctions.Log.Deriv #align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973" namespace Real open IsAbsoluteValue Finset CauSeq Complex
Mathlib/Data/Complex/ExponentialBounds.lean
20
25
theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by
apply exp_approx_start iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1
5
148.413159
2
2
5
2,495
import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.SpecialFunctions.Log.Deriv #align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973" namespace Real open IsAbsoluteValue Finset CauSeq Complex theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by apply exp_approx_start iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1 #align real.exp_one_near_10 Real.exp_one_near_10
Mathlib/Data/Complex/ExponentialBounds.lean
28
33
theorem exp_one_near_20 : |exp 1 - 363916618873 / 133877442384| ≤ 1 / 10 ^ 20 := by
apply exp_approx_start iterate 21 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1
5
148.413159
2
2
5
2,495
import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.SpecialFunctions.Log.Deriv #align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973" namespace Real open IsAbsoluteValue Finset CauSeq Complex theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by apply exp_approx_start iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1 #align real.exp_one_near_10 Real.exp_one_near_10 theorem exp_one_near_20 : |exp 1 - 363916618873 / 133877442384| ≤ 1 / 10 ^ 20 := by apply exp_approx_start iterate 21 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1 #align real.exp_one_near_20 Real.exp_one_near_20 theorem exp_one_gt_d9 : 2.7182818283 < exp 1 := lt_of_lt_of_le (by norm_num) (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2) #align real.exp_one_gt_d9 Real.exp_one_gt_d9 theorem exp_one_lt_d9 : exp 1 < 2.7182818286 := lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) (by norm_num) #align real.exp_one_lt_d9 Real.exp_one_lt_d9
Mathlib/Data/Complex/ExponentialBounds.lean
44
48
theorem exp_neg_one_gt_d9 : 0.36787944116 < exp (-1) := by
rw [exp_neg, lt_inv _ (exp_pos _)] · refine lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) ?_ norm_num · norm_num
4
54.59815
2
2
5
2,495
import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.SpecialFunctions.Log.Deriv #align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973" namespace Real open IsAbsoluteValue Finset CauSeq Complex theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by apply exp_approx_start iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1 #align real.exp_one_near_10 Real.exp_one_near_10 theorem exp_one_near_20 : |exp 1 - 363916618873 / 133877442384| ≤ 1 / 10 ^ 20 := by apply exp_approx_start iterate 21 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1 #align real.exp_one_near_20 Real.exp_one_near_20 theorem exp_one_gt_d9 : 2.7182818283 < exp 1 := lt_of_lt_of_le (by norm_num) (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2) #align real.exp_one_gt_d9 Real.exp_one_gt_d9 theorem exp_one_lt_d9 : exp 1 < 2.7182818286 := lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) (by norm_num) #align real.exp_one_lt_d9 Real.exp_one_lt_d9 theorem exp_neg_one_gt_d9 : 0.36787944116 < exp (-1) := by rw [exp_neg, lt_inv _ (exp_pos _)] · refine lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) ?_ norm_num · norm_num #align real.exp_neg_one_gt_d9 Real.exp_neg_one_gt_d9
Mathlib/Data/Complex/ExponentialBounds.lean
51
55
theorem exp_neg_one_lt_d9 : exp (-1) < 0.3678794412 := by
rw [exp_neg, inv_lt (exp_pos _)] · refine lt_of_lt_of_le ?_ (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2) norm_num · norm_num
4
54.59815
2
2
5
2,495
import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.SpecialFunctions.Log.Deriv #align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973" namespace Real open IsAbsoluteValue Finset CauSeq Complex theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by apply exp_approx_start iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1 #align real.exp_one_near_10 Real.exp_one_near_10 theorem exp_one_near_20 : |exp 1 - 363916618873 / 133877442384| ≤ 1 / 10 ^ 20 := by apply exp_approx_start iterate 21 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_ norm_num1 refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_ rw [_root_.abs_one, abs_of_pos] <;> norm_num1 #align real.exp_one_near_20 Real.exp_one_near_20 theorem exp_one_gt_d9 : 2.7182818283 < exp 1 := lt_of_lt_of_le (by norm_num) (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2) #align real.exp_one_gt_d9 Real.exp_one_gt_d9 theorem exp_one_lt_d9 : exp 1 < 2.7182818286 := lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) (by norm_num) #align real.exp_one_lt_d9 Real.exp_one_lt_d9 theorem exp_neg_one_gt_d9 : 0.36787944116 < exp (-1) := by rw [exp_neg, lt_inv _ (exp_pos _)] · refine lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) ?_ norm_num · norm_num #align real.exp_neg_one_gt_d9 Real.exp_neg_one_gt_d9 theorem exp_neg_one_lt_d9 : exp (-1) < 0.3678794412 := by rw [exp_neg, inv_lt (exp_pos _)] · refine lt_of_lt_of_le ?_ (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2) norm_num · norm_num #align real.exp_neg_one_lt_d9 Real.exp_neg_one_lt_d9 set_option tactic.skipAssignedInstances false in
Mathlib/Data/Complex/ExponentialBounds.lean
59
71
theorem log_two_near_10 : |log 2 - 287209 / 414355| ≤ 1 / 10 ^ 10 := by
suffices |log 2 - 287209 / 414355| ≤ 1 / 17179869184 + (1 / 10 ^ 10 - 1 / 2 ^ 34) by norm_num1 at * assumption have t : |(2⁻¹ : ℝ)| = 2⁻¹ := by rw [abs_of_pos]; norm_num have z := Real.abs_log_sub_add_sum_range_le (show |(2⁻¹ : ℝ)| < 1 by rw [t]; norm_num) 34 rw [t] at z norm_num1 at z rw [one_div (2 : ℝ), log_inv, ← sub_eq_add_neg, _root_.abs_sub_comm] at z apply le_trans (_root_.abs_sub_le _ _ _) (add_le_add z _) simp_rw [sum_range_succ] norm_num rw [abs_of_pos] <;> norm_num
12
162,754.791419
2
2
5
2,495
import Mathlib.Topology.CompactOpen noncomputable section open scoped Topology open Filter variable {X ι : Type*} {Y : ι → Type*} [TopologicalSpace X] [∀ i, TopologicalSpace (Y i)] namespace ContinuousMap
Mathlib/Topology/ContinuousFunction/Sigma.lean
44
54
theorem embedding_sigmaMk_comp [Nonempty X] : Embedding (fun g : Σ i, C(X, Y i) ↦ (sigmaMk g.1).comp g.2) where toInducing := inducing_sigma.2 ⟨fun i ↦ (sigmaMk i).inducing_comp embedding_sigmaMk.toInducing, fun i ↦ let ⟨x⟩ := ‹Nonempty X› ⟨_, (isOpen_sigma_fst_preimage {i}).preimage (continuous_eval_const x), fun _ ↦ Iff.rfl⟩⟩ inj := by
· rintro ⟨i, g⟩ ⟨i', g'⟩ h obtain ⟨rfl, hg⟩ : i = i' ∧ HEq (⇑g) (⇑g') := Function.eq_of_sigmaMk_comp <| congr_arg DFunLike.coe h simpa using hg
4
54.59815
2
2
1
2,496
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Topology.MetricSpace.HausdorffDistance import Mathlib.Topology.Sets.Compacts #align_import topology.metric_space.closeds from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Topology ENNReal universe u open scoped Classical open Set Function TopologicalSpace Filter namespace EMetric section variable {α : Type u} [EMetricSpace α] {s : Set α} instance Closeds.emetricSpace : EMetricSpace (Closeds α) where edist s t := hausdorffEdist (s : Set α) t edist_self s := hausdorffEdist_self edist_comm s t := hausdorffEdist_comm edist_triangle s t u := hausdorffEdist_triangle eq_of_edist_eq_zero {s t} h := Closeds.ext <| (hausdorffEdist_zero_iff_eq_of_closed s.closed t.closed).1 h #align emetric.closeds.emetric_space EMetric.Closeds.emetricSpace
Mathlib/Topology/MetricSpace/Closeds.lean
56
69
theorem continuous_infEdist_hausdorffEdist : Continuous fun p : α × Closeds α => infEdist p.1 p.2 := by
refine continuous_of_le_add_edist 2 (by simp) ?_ rintro ⟨x, s⟩ ⟨y, t⟩ calc infEdist x s ≤ infEdist x t + hausdorffEdist (t : Set α) s := infEdist_le_infEdist_add_hausdorffEdist _ ≤ infEdist y t + edist x y + hausdorffEdist (t : Set α) s := (add_le_add_right infEdist_le_infEdist_add_edist _) _ = infEdist y t + (edist x y + hausdorffEdist (s : Set α) t) := by rw [add_assoc, hausdorffEdist_comm] _ ≤ infEdist y t + (edist (x, s) (y, t) + edist (x, s) (y, t)) := (add_le_add_left (add_le_add (le_max_left _ _) (le_max_right _ _)) _) _ = infEdist y t + 2 * edist (x, s) (y, t) := by rw [← mul_two, mul_comm]
12
162,754.791419
2
2
2
2,497
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Topology.MetricSpace.HausdorffDistance import Mathlib.Topology.Sets.Compacts #align_import topology.metric_space.closeds from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Topology ENNReal universe u open scoped Classical open Set Function TopologicalSpace Filter namespace EMetric section variable {α : Type u} [EMetricSpace α] {s : Set α} instance Closeds.emetricSpace : EMetricSpace (Closeds α) where edist s t := hausdorffEdist (s : Set α) t edist_self s := hausdorffEdist_self edist_comm s t := hausdorffEdist_comm edist_triangle s t u := hausdorffEdist_triangle eq_of_edist_eq_zero {s t} h := Closeds.ext <| (hausdorffEdist_zero_iff_eq_of_closed s.closed t.closed).1 h #align emetric.closeds.emetric_space EMetric.Closeds.emetricSpace theorem continuous_infEdist_hausdorffEdist : Continuous fun p : α × Closeds α => infEdist p.1 p.2 := by refine continuous_of_le_add_edist 2 (by simp) ?_ rintro ⟨x, s⟩ ⟨y, t⟩ calc infEdist x s ≤ infEdist x t + hausdorffEdist (t : Set α) s := infEdist_le_infEdist_add_hausdorffEdist _ ≤ infEdist y t + edist x y + hausdorffEdist (t : Set α) s := (add_le_add_right infEdist_le_infEdist_add_edist _) _ = infEdist y t + (edist x y + hausdorffEdist (s : Set α) t) := by rw [add_assoc, hausdorffEdist_comm] _ ≤ infEdist y t + (edist (x, s) (y, t) + edist (x, s) (y, t)) := (add_le_add_left (add_le_add (le_max_left _ _) (le_max_right _ _)) _) _ = infEdist y t + 2 * edist (x, s) (y, t) := by rw [← mul_two, mul_comm] set_option linter.uppercaseLean3 false in #align emetric.continuous_infEdist_hausdorffEdist EMetric.continuous_infEdist_hausdorffEdist
Mathlib/Topology/MetricSpace/Closeds.lean
74
84
theorem isClosed_subsets_of_isClosed (hs : IsClosed s) : IsClosed { t : Closeds α | (t : Set α) ⊆ s } := by
refine isClosed_of_closure_subset fun (t : Closeds α) (ht : t ∈ closure {t : Closeds α | (t : Set α) ⊆ s}) (x : α) (hx : x ∈ t) => ?_ have : x ∈ closure s := by refine mem_closure_iff.2 fun ε εpos => ?_ obtain ⟨u : Closeds α, hu : u ∈ {t : Closeds α | (t : Set α) ⊆ s}, Dtu : edist t u < ε⟩ := mem_closure_iff.1 ht ε εpos obtain ⟨y : α, hy : y ∈ u, Dxy : edist x y < ε⟩ := exists_edist_lt_of_hausdorffEdist_lt hx Dtu exact ⟨y, hu hy, Dxy⟩ rwa [hs.closure_eq] at this
9
8,103.083928
2
2
2
2,497
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace LocallyRingedSpace section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note (#10754): this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen
Mathlib/Geometry/RingedSpace/LocallyRingedSpace/HasColimits.lean
185
211
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by
fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note: Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note (#11224): change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine (RingedSpace.basicOpen_le _ _).trans ?_ rw [coequalizer.condition f.1 g.1]
24
26,489,122,129.84347
2
2
2
2,498
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace LocallyRingedSpace section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note (#10754): this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note: Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note (#11224): change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine (RingedSpace.basicOpen_le _ _).trans ?_ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage
Mathlib/Geometry/RingedSpace/LocallyRingedSpace/HasColimits.lean
214
223
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by
rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← TopCat.coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note (#11224): change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2
8
2,980.957987
2
2
2
2,498
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
485,165,195.40979
2
2
3
2,499
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 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 #align uniform_space.completion.continuous_hat_inv UniformSpace.Completion.continuous_hatInv instance instInvCompletion : Inv (hat K) := ⟨fun x => if x = 0 then 0 else hatInv x⟩ variable [TopologicalDivisionRing K] theorem hatInv_extends {x : K} (h : x ≠ 0) : hatInv (x : hat K) = ↑(x⁻¹ : K) := denseInducing_coe.extend_eq_at ((continuous_coe K).continuousAt.comp (continuousAt_inv₀ h)) #align uniform_space.completion.hat_inv_extends UniformSpace.Completion.hatInv_extends variable [CompletableTopField K] @[norm_cast]
Mathlib/Topology/Algebra/UniformField.lean
112
121
theorem coe_inv (x : K) : (x : hat K)⁻¹ = ((x⁻¹ : K) : hat K) := by
by_cases h : x = 0 · rw [h, inv_zero] dsimp [Inv.inv] norm_cast simp · conv_lhs => dsimp [Inv.inv] rw [if_neg] · exact hatInv_extends h · exact fun H => h (denseEmbedding_coe.inj H)
9
8,103.083928
2
2
3
2,499
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 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 #align uniform_space.completion.continuous_hat_inv UniformSpace.Completion.continuous_hatInv instance instInvCompletion : Inv (hat K) := ⟨fun x => if x = 0 then 0 else hatInv x⟩ variable [TopologicalDivisionRing K] theorem hatInv_extends {x : K} (h : x ≠ 0) : hatInv (x : hat K) = ↑(x⁻¹ : K) := denseInducing_coe.extend_eq_at ((continuous_coe K).continuousAt.comp (continuousAt_inv₀ h)) #align uniform_space.completion.hat_inv_extends UniformSpace.Completion.hatInv_extends variable [CompletableTopField K] @[norm_cast] theorem coe_inv (x : K) : (x : hat K)⁻¹ = ((x⁻¹ : K) : hat K) := by by_cases h : x = 0 · rw [h, inv_zero] dsimp [Inv.inv] norm_cast simp · conv_lhs => dsimp [Inv.inv] rw [if_neg] · exact hatInv_extends h · exact fun H => h (denseEmbedding_coe.inj H) #align uniform_space.completion.coe_inv UniformSpace.Completion.coe_inv variable [UniformAddGroup K]
Mathlib/Topology/Algebra/UniformField.lean
126
153
theorem mul_hatInv_cancel {x : hat K} (x_ne : x ≠ 0) : x * hatInv x = 1 := by
haveI : T1Space (hat K) := T2Space.t1Space let f := fun x : hat K => x * hatInv x let c := (fun (x : K) => (x : hat K)) change f x = 1 have cont : ContinuousAt f x := by letI : TopologicalSpace (hat K × hat K) := instTopologicalSpaceProd have : ContinuousAt (fun y : hat K => ((y, hatInv y) : hat K × hat K)) x := continuous_id.continuousAt.prod (continuous_hatInv x_ne) exact (_root_.continuous_mul.continuousAt.comp this : _) have clo : x ∈ closure (c '' {0}ᶜ) := by have := denseInducing_coe.dense x rw [← image_univ, show (univ : Set K) = {0} ∪ {0}ᶜ from (union_compl_self _).symm, image_union] at this apply mem_closure_of_mem_closure_union this rw [image_singleton] exact compl_singleton_mem_nhds x_ne have fxclo : f x ∈ closure (f '' (c '' {0}ᶜ)) := mem_closure_image cont clo have : f '' (c '' {0}ᶜ) ⊆ {1} := by rw [image_image] rintro _ ⟨z, z_ne, rfl⟩ rw [mem_singleton_iff] rw [mem_compl_singleton_iff] at z_ne dsimp [f] rw [hatInv_extends z_ne, ← coe_mul] rw [mul_inv_cancel z_ne, coe_one] replace fxclo := closure_mono this fxclo rwa [closure_singleton, mem_singleton_iff] at fxclo
27
532,048,240,601.79865
2
2
3
2,499
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Analysis.Analytic.Constructions import Mathlib.Topology.Algebra.Module.FiniteDimension variable {𝕜 E A B : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [CommSemiring A] {z : E} {s : Set E} section Polynomial open Polynomial variable [NormedRing B] [NormedAlgebra 𝕜 B] [Algebra A B] {f : E → B}
Mathlib/Analysis/Analytic/Polynomial.lean
26
32
theorem AnalyticAt.aeval_polynomial (hf : AnalyticAt 𝕜 f z) (p : A[X]) : AnalyticAt 𝕜 (fun x ↦ aeval (f x) p) z := by
refine p.induction_on (fun k ↦ ?_) (fun p q hp hq ↦ ?_) fun p i hp ↦ ?_ · simp_rw [aeval_C]; apply analyticAt_const · simp_rw [aeval_add]; exact hp.add hq · convert hp.mul hf simp_rw [pow_succ, aeval_mul, ← mul_assoc, aeval_X]
5
148.413159
2
2
2
2,500
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Analysis.Analytic.Constructions import Mathlib.Topology.Algebra.Module.FiniteDimension variable {𝕜 E A B : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [CommSemiring A] {z : E} {s : Set E} section MvPolynomial open MvPolynomial variable [NormedCommRing B] [NormedAlgebra 𝕜 B] [Algebra A B] {σ : Type*} {f : E → σ → B}
Mathlib/Analysis/Analytic/Polynomial.lean
47
52
theorem AnalyticAt.aeval_mvPolynomial (hf : ∀ i, AnalyticAt 𝕜 (f · i) z) (p : MvPolynomial σ A) : AnalyticAt 𝕜 (fun x ↦ aeval (f x) p) z := by
apply p.induction_on (fun k ↦ ?_) (fun p q hp hq ↦ ?_) fun p i hp ↦ ?_ -- `refine` doesn't work · simp_rw [aeval_C]; apply analyticAt_const · simp_rw [map_add]; exact hp.add hq · simp_rw [map_mul, aeval_X]; exact hp.mul (hf i)
4
54.59815
2
2
2
2,500
import Mathlib.CategoryTheory.Galois.Basic import Mathlib.RepresentationTheory.Action.Basic import Mathlib.RepresentationTheory.Action.Concrete import Mathlib.RepresentationTheory.Action.Limits import Mathlib.CategoryTheory.Limits.FintypeCat import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.Logic.Equiv.TransferInstance universe u v w namespace CategoryTheory namespace FintypeCat open Limits Functor PreGaloisCategory noncomputable def imageComplement {X Y : FintypeCat.{u}} (f : X ⟶ Y) : FintypeCat.{u} := by haveI : Fintype (↑(Set.range f)ᶜ) := Fintype.ofFinite _ exact FintypeCat.of (↑(Set.range f)ᶜ) def imageComplementIncl {X Y : FintypeCat.{u}} (f : X ⟶ Y) : imageComplement f ⟶ Y := Subtype.val variable (G : Type u) [Group G] noncomputable def Action.imageComplement {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Action FintypeCat (MonCat.of G) where V := FintypeCat.imageComplement f.hom ρ := MonCat.ofHom <| { toFun := fun g y ↦ Subtype.mk (Y.ρ g y.val) <| by intro ⟨x, h⟩ apply y.property use X.ρ g⁻¹ x calc (X.ρ g⁻¹ ≫ f.hom) x = (Y.ρ g⁻¹ * Y.ρ g) y.val := by rw [f.comm, FintypeCat.comp_apply, h]; rfl _ = y.val := by rw [← map_mul, mul_left_inv, Action.ρ_one, FintypeCat.id_apply] map_one' := by simp only [Action.ρ_one]; rfl map_mul' := fun g h ↦ FintypeCat.hom_ext _ _ <| fun y ↦ Subtype.ext <| by exact congrFun (MonoidHom.map_mul Y.ρ g h) y.val } def Action.imageComplementIncl {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Action.imageComplement G f ⟶ Y where hom := FintypeCat.imageComplementIncl f.hom comm _ := rfl instance {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Mono (Action.imageComplementIncl G f) := by apply Functor.mono_of_mono_map (forget _) apply ConcreteCategory.mono_of_injective exact Subtype.val_injective instance [Finite G] : HasColimitsOfShape (SingleObj G) FintypeCat.{w} := by obtain ⟨G', hg, hf, ⟨e⟩⟩ := Finite.exists_type_zero_nonempty_mulEquiv G exact Limits.hasColimitsOfShape_of_equivalence e.toSingleObjEquiv.symm noncomputable instance : PreservesFiniteLimits (forget (Action FintypeCat (MonCat.of G))) := by show PreservesFiniteLimits (Action.forget FintypeCat _ ⋙ FintypeCat.incl) apply compPreservesFiniteLimits instance : PreGaloisCategory (Action FintypeCat (MonCat.of G)) where hasQuotientsByFiniteGroups G _ _ := inferInstance monoInducesIsoOnDirectSummand {X Y} i h := ⟨Action.imageComplement G i, Action.imageComplementIncl G i, ⟨isColimitOfReflects (Action.forget _ _ ⋙ FintypeCat.incl) <| (isColimitMapCoconeBinaryCofanEquiv (forget _) i _).symm (Types.isCoprodOfMono ((forget _).map i))⟩⟩ noncomputable instance : FiberFunctor (Action.forget FintypeCat (MonCat.of G)) where preservesFiniteCoproducts := ⟨fun _ _ ↦ inferInstance⟩ preservesQuotientsByFiniteGroups _ _ _ := inferInstance reflectsIsos := ⟨fun f (h : IsIso f.hom) => inferInstance⟩ instance : GaloisCategory (Action FintypeCat (MonCat.of G)) where hasFiberFunctor := ⟨Action.forget FintypeCat (MonCat.of G), ⟨inferInstance⟩⟩
Mathlib/CategoryTheory/Galois/Examples.lean
104
124
theorem Action.pretransitive_of_isConnected (X : Action FintypeCat (MonCat.of G)) [IsConnected X] : MulAction.IsPretransitive G X.V where exists_smul_eq x y := by
/- We show that the `G`-orbit of `x` is a non-initial subobject of `X` and hence by connectedness, the orbit equals `X.V`. -/ let T : Set X.V := MulAction.orbit G x have : Fintype T := Fintype.ofFinite T letI : MulAction G (FintypeCat.of T) := inferInstanceAs <| MulAction G ↑(MulAction.orbit G x) let T' : Action FintypeCat (MonCat.of G) := Action.FintypeCat.ofMulAction G (FintypeCat.of T) let i : T' ⟶ X := ⟨Subtype.val, fun _ ↦ rfl⟩ have : Mono i := ConcreteCategory.mono_of_injective _ (Subtype.val_injective) have : IsIso i := by apply IsConnected.noTrivialComponent T' i apply (not_initial_iff_fiber_nonempty (Action.forget _ _) T').mpr exact Set.Nonempty.coe_sort (MulAction.orbit_nonempty x) have hb : Function.Bijective i.hom := by apply (ConcreteCategory.isIso_iff_bijective i.hom).mp exact map_isIso (forget₂ _ FintypeCat) i obtain ⟨⟨y', ⟨g, (hg : g • x = y')⟩⟩, (hy' : y' = y)⟩ := hb.surjective y use g exact hg.trans hy'
18
65,659,969.137331
2
2
2
2,501
import Mathlib.CategoryTheory.Galois.Basic import Mathlib.RepresentationTheory.Action.Basic import Mathlib.RepresentationTheory.Action.Concrete import Mathlib.RepresentationTheory.Action.Limits import Mathlib.CategoryTheory.Limits.FintypeCat import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.Logic.Equiv.TransferInstance universe u v w namespace CategoryTheory namespace FintypeCat open Limits Functor PreGaloisCategory noncomputable def imageComplement {X Y : FintypeCat.{u}} (f : X ⟶ Y) : FintypeCat.{u} := by haveI : Fintype (↑(Set.range f)ᶜ) := Fintype.ofFinite _ exact FintypeCat.of (↑(Set.range f)ᶜ) def imageComplementIncl {X Y : FintypeCat.{u}} (f : X ⟶ Y) : imageComplement f ⟶ Y := Subtype.val variable (G : Type u) [Group G] noncomputable def Action.imageComplement {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Action FintypeCat (MonCat.of G) where V := FintypeCat.imageComplement f.hom ρ := MonCat.ofHom <| { toFun := fun g y ↦ Subtype.mk (Y.ρ g y.val) <| by intro ⟨x, h⟩ apply y.property use X.ρ g⁻¹ x calc (X.ρ g⁻¹ ≫ f.hom) x = (Y.ρ g⁻¹ * Y.ρ g) y.val := by rw [f.comm, FintypeCat.comp_apply, h]; rfl _ = y.val := by rw [← map_mul, mul_left_inv, Action.ρ_one, FintypeCat.id_apply] map_one' := by simp only [Action.ρ_one]; rfl map_mul' := fun g h ↦ FintypeCat.hom_ext _ _ <| fun y ↦ Subtype.ext <| by exact congrFun (MonoidHom.map_mul Y.ρ g h) y.val } def Action.imageComplementIncl {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Action.imageComplement G f ⟶ Y where hom := FintypeCat.imageComplementIncl f.hom comm _ := rfl instance {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Mono (Action.imageComplementIncl G f) := by apply Functor.mono_of_mono_map (forget _) apply ConcreteCategory.mono_of_injective exact Subtype.val_injective instance [Finite G] : HasColimitsOfShape (SingleObj G) FintypeCat.{w} := by obtain ⟨G', hg, hf, ⟨e⟩⟩ := Finite.exists_type_zero_nonempty_mulEquiv G exact Limits.hasColimitsOfShape_of_equivalence e.toSingleObjEquiv.symm noncomputable instance : PreservesFiniteLimits (forget (Action FintypeCat (MonCat.of G))) := by show PreservesFiniteLimits (Action.forget FintypeCat _ ⋙ FintypeCat.incl) apply compPreservesFiniteLimits instance : PreGaloisCategory (Action FintypeCat (MonCat.of G)) where hasQuotientsByFiniteGroups G _ _ := inferInstance monoInducesIsoOnDirectSummand {X Y} i h := ⟨Action.imageComplement G i, Action.imageComplementIncl G i, ⟨isColimitOfReflects (Action.forget _ _ ⋙ FintypeCat.incl) <| (isColimitMapCoconeBinaryCofanEquiv (forget _) i _).symm (Types.isCoprodOfMono ((forget _).map i))⟩⟩ noncomputable instance : FiberFunctor (Action.forget FintypeCat (MonCat.of G)) where preservesFiniteCoproducts := ⟨fun _ _ ↦ inferInstance⟩ preservesQuotientsByFiniteGroups _ _ _ := inferInstance reflectsIsos := ⟨fun f (h : IsIso f.hom) => inferInstance⟩ instance : GaloisCategory (Action FintypeCat (MonCat.of G)) where hasFiberFunctor := ⟨Action.forget FintypeCat (MonCat.of G), ⟨inferInstance⟩⟩ theorem Action.pretransitive_of_isConnected (X : Action FintypeCat (MonCat.of G)) [IsConnected X] : MulAction.IsPretransitive G X.V where exists_smul_eq x y := by let T : Set X.V := MulAction.orbit G x have : Fintype T := Fintype.ofFinite T letI : MulAction G (FintypeCat.of T) := inferInstanceAs <| MulAction G ↑(MulAction.orbit G x) let T' : Action FintypeCat (MonCat.of G) := Action.FintypeCat.ofMulAction G (FintypeCat.of T) let i : T' ⟶ X := ⟨Subtype.val, fun _ ↦ rfl⟩ have : Mono i := ConcreteCategory.mono_of_injective _ (Subtype.val_injective) have : IsIso i := by apply IsConnected.noTrivialComponent T' i apply (not_initial_iff_fiber_nonempty (Action.forget _ _) T').mpr exact Set.Nonempty.coe_sort (MulAction.orbit_nonempty x) have hb : Function.Bijective i.hom := by apply (ConcreteCategory.isIso_iff_bijective i.hom).mp exact map_isIso (forget₂ _ FintypeCat) i obtain ⟨⟨y', ⟨g, (hg : g • x = y')⟩⟩, (hy' : y' = y)⟩ := hb.surjective y use g exact hg.trans hy'
Mathlib/CategoryTheory/Galois/Examples.lean
127
145
theorem Action.isConnected_of_transitive (X : FintypeCat) [MulAction G X] [MulAction.IsPretransitive G X] [h : Nonempty X] : IsConnected (Action.FintypeCat.ofMulAction G X) where notInitial := not_initial_of_inhabited (Action.forget _ _) h.some noTrivialComponent Y i hm hni := by
/- We show that the induced inclusion `i.hom` of finite sets is surjective, using the transitivity of the `G`-action. -/ obtain ⟨(y : Y.V)⟩ := (not_initial_iff_fiber_nonempty (Action.forget _ _) Y).mp hni have : IsIso i.hom := by refine (ConcreteCategory.isIso_iff_bijective i.hom).mpr ⟨?_, fun x' ↦ ?_⟩ · haveI : Mono i.hom := map_mono (forget₂ _ _) i exact ConcreteCategory.injective_of_mono_of_preservesPullback i.hom · letI x : X := i.hom y obtain ⟨σ, hσ⟩ := MulAction.exists_smul_eq G x x' use σ • y show (Y.ρ σ ≫ i.hom) y = x' rw [i.comm, FintypeCat.comp_apply] exact hσ apply isIso_of_reflects_iso i (Action.forget _ _)
14
1,202,604.284165
2
2
2
2,501
import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.Polynomial.SeparableDegree open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField Field noncomputable section universe u v w variable (F : Type u) (E : Type v) [Field F] [Field E] [Algebra F E] variable (K : Type w) [Field K] [Algebra F K] namespace Field def Emb := E →ₐ[F] AlgebraicClosure E def finSepDegree : ℕ := Nat.card (Emb F E) instance instInhabitedEmb : Inhabited (Emb F E) := ⟨IsScalarTower.toAlgHom F E _⟩ instance instNeZeroFinSepDegree [FiniteDimensional F E] : NeZero (finSepDegree F E) := ⟨Nat.card_ne_zero.2 ⟨inferInstance, Fintype.finite <| minpoly.AlgHom.fintype _ _ _⟩⟩ def embEquivOfEquiv (i : E ≃ₐ[F] K) : Emb F E ≃ Emb F K := AlgEquiv.arrowCongr i <| AlgEquiv.symm <| by let _ : Algebra E K := i.toAlgHom.toRingHom.toAlgebra have : Algebra.IsAlgebraic E K := by constructor intro x have h := isAlgebraic_algebraMap (R := E) (A := K) (i.symm.toAlgHom x) rw [show ∀ y : E, (algebraMap E K) y = i.toAlgHom y from fun y ↦ rfl] at h simpa only [AlgEquiv.toAlgHom_eq_coe, AlgHom.coe_coe, AlgEquiv.apply_symm_apply] using h apply AlgEquiv.restrictScalars (R := F) (S := E) exact IsAlgClosure.equivOfAlgebraic E K (AlgebraicClosure K) (AlgebraicClosure E) theorem finSepDegree_eq_of_equiv (i : E ≃ₐ[F] K) : finSepDegree F E = finSepDegree F K := Nat.card_congr (embEquivOfEquiv F E K i) @[simp]
Mathlib/FieldTheory/SeparableDegree.lean
168
172
theorem finSepDegree_self : finSepDegree F F = 1 := by
have : Cardinal.mk (Emb F F) = 1 := le_antisymm (Cardinal.le_one_iff_subsingleton.2 AlgHom.subsingleton) (Cardinal.one_le_iff_ne_zero.2 <| Cardinal.mk_ne_zero _) rw [finSepDegree, Nat.card, this, Cardinal.one_toNat]
4
54.59815
2
2
1
2,502
import Mathlib.Init.Data.Prod import Mathlib.Data.Seq.WSeq #align_import data.seq.parallel from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" universe u v namespace Computation open Stream' variable {α : Type u} {β : Type v} def parallel.aux2 : List (Computation α) → Sum α (List (Computation α)) := List.foldr (fun c o => match o with | Sum.inl a => Sum.inl a | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr []) #align computation.parallel.aux2 Computation.parallel.aux2 def parallel.aux1 : List (Computation α) × WSeq (Computation α) → Sum α (List (Computation α) × WSeq (Computation α)) | (l, S) => rmap (fun l' => match Seq.destruct S with | none => (l', Seq.nil) | some (none, S') => (l', S') | some (some c, S') => (c :: l', S')) (parallel.aux2 l) #align computation.parallel.aux1 Computation.parallel.aux1 def parallel (S : WSeq (Computation α)) : Computation α := corec parallel.aux1 ([], S) #align computation.parallel Computation.parallel
Mathlib/Data/Seq/Parallel.lean
57
119
theorem terminates_parallel.aux : ∀ {l : List (Computation α)} {S c}, c ∈ l → Terminates c → Terminates (corec parallel.aux1 (l, S)) := by
have lem1 : ∀ l S, (∃ a : α, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S)) := by intro l S e cases' e with a e have : corec parallel.aux1 (l, S) = return a := by apply destruct_eq_pure simp only [parallel.aux1, rmap, corec_eq] rw [e] rw [this] -- Porting note: This line is required. exact ret_terminates a intro l S c m T revert l S apply @terminatesRecOn _ _ c T _ _ · intro a l S m apply lem1 induction' l with c l IH <;> simp at m cases' m with e m · rw [← e] simp only [parallel.aux2, rmap, List.foldr_cons, destruct_pure] split <;> simp · cases' IH m with a' e simp only [parallel.aux2, rmap, List.foldr_cons] simp? [parallel.aux2] at e says simp only [parallel.aux2, rmap] at e rw [e] exact ⟨a', rfl⟩ · intro s IH l S m have H1 : ∀ l', parallel.aux2 l = Sum.inr l' → s ∈ l' := by induction' l with c l IH' <;> intro l' e' <;> simp at m cases' m with e m <;> simp [parallel.aux2] at e' · rw [← e] at e' -- Porting note: `revert e'` & `intro e'` are required. revert e' split · simp · simp only [destruct_think, Sum.inr.injEq] rintro rfl simp · induction' e : List.foldr (fun c o => match o with | Sum.inl a => Sum.inl a | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr List.nil) l with a' ls <;> erw [e] at e' · contradiction have := IH' m _ e -- Porting note: `revert e'` & `intro e'` are required. revert e' cases destruct c <;> intro e' <;> [injection e'; injection e' with h'] rw [← h'] simp [this] induction' h : parallel.aux2 l with a l' · exact lem1 _ _ ⟨a, h⟩ · have H2 : corec parallel.aux1 (l, S) = think _ := destruct_eq_think (by simp only [parallel.aux1, rmap, corec_eq] rw [h]) rw [H2] refine @Computation.think_terminates _ _ ?_ have := H1 _ h rcases Seq.destruct S with (_ | ⟨_ | c, S'⟩) <;> simp [parallel.aux1] <;> apply IH <;> simp [this]
60
114,200,738,981,568,440,000,000,000
2
2
2
2,503
import Mathlib.Init.Data.Prod import Mathlib.Data.Seq.WSeq #align_import data.seq.parallel from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" universe u v namespace Computation open Stream' variable {α : Type u} {β : Type v} def parallel.aux2 : List (Computation α) → Sum α (List (Computation α)) := List.foldr (fun c o => match o with | Sum.inl a => Sum.inl a | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr []) #align computation.parallel.aux2 Computation.parallel.aux2 def parallel.aux1 : List (Computation α) × WSeq (Computation α) → Sum α (List (Computation α) × WSeq (Computation α)) | (l, S) => rmap (fun l' => match Seq.destruct S with | none => (l', Seq.nil) | some (none, S') => (l', S') | some (some c, S') => (c :: l', S')) (parallel.aux2 l) #align computation.parallel.aux1 Computation.parallel.aux1 def parallel (S : WSeq (Computation α)) : Computation α := corec parallel.aux1 ([], S) #align computation.parallel Computation.parallel theorem terminates_parallel.aux : ∀ {l : List (Computation α)} {S c}, c ∈ l → Terminates c → Terminates (corec parallel.aux1 (l, S)) := by have lem1 : ∀ l S, (∃ a : α, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S)) := by intro l S e cases' e with a e have : corec parallel.aux1 (l, S) = return a := by apply destruct_eq_pure simp only [parallel.aux1, rmap, corec_eq] rw [e] rw [this] -- Porting note: This line is required. exact ret_terminates a intro l S c m T revert l S apply @terminatesRecOn _ _ c T _ _ · intro a l S m apply lem1 induction' l with c l IH <;> simp at m cases' m with e m · rw [← e] simp only [parallel.aux2, rmap, List.foldr_cons, destruct_pure] split <;> simp · cases' IH m with a' e simp only [parallel.aux2, rmap, List.foldr_cons] simp? [parallel.aux2] at e says simp only [parallel.aux2, rmap] at e rw [e] exact ⟨a', rfl⟩ · intro s IH l S m have H1 : ∀ l', parallel.aux2 l = Sum.inr l' → s ∈ l' := by induction' l with c l IH' <;> intro l' e' <;> simp at m cases' m with e m <;> simp [parallel.aux2] at e' · rw [← e] at e' -- Porting note: `revert e'` & `intro e'` are required. revert e' split · simp · simp only [destruct_think, Sum.inr.injEq] rintro rfl simp · induction' e : List.foldr (fun c o => match o with | Sum.inl a => Sum.inl a | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr List.nil) l with a' ls <;> erw [e] at e' · contradiction have := IH' m _ e -- Porting note: `revert e'` & `intro e'` are required. revert e' cases destruct c <;> intro e' <;> [injection e'; injection e' with h'] rw [← h'] simp [this] induction' h : parallel.aux2 l with a l' · exact lem1 _ _ ⟨a, h⟩ · have H2 : corec parallel.aux1 (l, S) = think _ := destruct_eq_think (by simp only [parallel.aux1, rmap, corec_eq] rw [h]) rw [H2] refine @Computation.think_terminates _ _ ?_ have := H1 _ h rcases Seq.destruct S with (_ | ⟨_ | c, S'⟩) <;> simp [parallel.aux1] <;> apply IH <;> simp [this] #align computation.terminates_parallel.aux Computation.terminates_parallel.aux
Mathlib/Data/Seq/Parallel.lean
122
186
theorem terminates_parallel {S : WSeq (Computation α)} {c} (h : c ∈ S) [T : Terminates c] : Terminates (parallel S) := by
suffices ∀ (n) (l : List (Computation α)) (S c), c ∈ l ∨ some (some c) = Seq.get? S n → Terminates c → Terminates (corec parallel.aux1 (l, S)) from let ⟨n, h⟩ := h this n [] S c (Or.inr h) T intro n; induction' n with n IH <;> intro l S c o T · cases' o with a a · exact terminates_parallel.aux a T have H : Seq.destruct S = some (some c, Seq.tail S) := by simp [Seq.destruct, (· <$> ·), ← a] induction' h : parallel.aux2 l with a l' · have C : corec parallel.aux1 (l, S) = pure a := by apply destruct_eq_pure rw [corec_eq, parallel.aux1] dsimp only [] rw [h] simp only [rmap] rw [C] infer_instance · have C : corec parallel.aux1 (l, S) = _ := destruct_eq_think (by simp only [corec_eq, rmap, parallel.aux1.eq_1] rw [h, H]) rw [C] refine @Computation.think_terminates _ _ ?_ apply terminates_parallel.aux _ T simp · cases' o with a a · exact terminates_parallel.aux a T induction' h : parallel.aux2 l with a l' · have C : corec parallel.aux1 (l, S) = pure a := by apply destruct_eq_pure rw [corec_eq, parallel.aux1] dsimp only [] rw [h] simp only [rmap] rw [C] infer_instance · have C : corec parallel.aux1 (l, S) = _ := destruct_eq_think (by simp only [corec_eq, rmap, parallel.aux1.eq_1] rw [h]) rw [C] refine @Computation.think_terminates _ _ ?_ have TT : ∀ l', Terminates (corec parallel.aux1 (l', S.tail)) := by intro apply IH _ _ _ (Or.inr _) T rw [a] cases' S with f al rfl induction' e : Seq.get? S 0 with o · have D : Seq.destruct S = none := by dsimp [Seq.destruct] rw [e] rfl rw [D] simp only have TT := TT l' rwa [Seq.destruct_eq_nil D, Seq.tail_nil] at TT · have D : Seq.destruct S = some (o, S.tail) := by dsimp [Seq.destruct] rw [e] rfl rw [D] cases' o with c <;> simp [parallel.aux1, TT]
63
2,293,783,159,469,610,000,000,000,000
2
2
2
2,503
import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.SpecificLimits.Normed open Filter Finset open scoped Topology namespace Complex section StolzSet open Real def stolzSet (M : ℝ) : Set ℂ := {z | ‖z‖ < 1 ∧ ‖1 - z‖ < M * (1 - ‖z‖)} def stolzCone (s : ℝ) : Set ℂ := {z | |z.im| < s * (1 - z.re)}
Mathlib/Analysis/Complex/AbelLimit.lean
47
54
theorem stolzSet_empty {M : ℝ} (hM : M ≤ 1) : stolzSet M = ∅ := by
ext z rw [stolzSet, Set.mem_setOf, Set.mem_empty_iff_false, iff_false, not_and, not_lt, ← sub_pos] intro zn calc _ ≤ 1 * (1 - ‖z‖) := mul_le_mul_of_nonneg_right hM zn.le _ = ‖(1 : ℂ)‖ - ‖z‖ := by rw [one_mul, norm_one] _ ≤ _ := norm_sub_norm_le _ _
7
1,096.633158
2
2
2
2,504
import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.SpecificLimits.Normed open Filter Finset open scoped Topology namespace Complex section StolzSet open Real def stolzSet (M : ℝ) : Set ℂ := {z | ‖z‖ < 1 ∧ ‖1 - z‖ < M * (1 - ‖z‖)} def stolzCone (s : ℝ) : Set ℂ := {z | |z.im| < s * (1 - z.re)} theorem stolzSet_empty {M : ℝ} (hM : M ≤ 1) : stolzSet M = ∅ := by ext z rw [stolzSet, Set.mem_setOf, Set.mem_empty_iff_false, iff_false, not_and, not_lt, ← sub_pos] intro zn calc _ ≤ 1 * (1 - ‖z‖) := mul_le_mul_of_nonneg_right hM zn.le _ = ‖(1 : ℂ)‖ - ‖z‖ := by rw [one_mul, norm_one] _ ≤ _ := norm_sub_norm_le _ _
Mathlib/Analysis/Complex/AbelLimit.lean
56
66
theorem nhdsWithin_lt_le_nhdsWithin_stolzSet {M : ℝ} (hM : 1 < M) : (𝓝[<] 1).map ofReal' ≤ 𝓝[stolzSet M] 1 := by
rw [← tendsto_id'] refine tendsto_map' <| tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within ofReal' (tendsto_nhdsWithin_of_tendsto_nhds <| ofRealCLM.continuous.tendsto' 1 1 rfl) ?_ simp only [eventually_iff, norm_eq_abs, abs_ofReal, abs_lt, mem_nhdsWithin] refine ⟨Set.Ioo 0 2, isOpen_Ioo, by norm_num, fun x hx ↦ ?_⟩ simp only [Set.mem_inter_iff, Set.mem_Ioo, Set.mem_Iio] at hx simp only [Set.mem_setOf_eq, stolzSet, ← ofReal_one, ← ofReal_sub, norm_eq_abs, abs_ofReal, abs_of_pos hx.1.1, abs_of_pos <| sub_pos.mpr hx.2] exact ⟨hx.2, lt_mul_left (sub_pos.mpr hx.2) hM⟩
9
8,103.083928
2
2
2
2,504
import Mathlib.Data.Finset.Pointwise import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.DFinsupp.Order import Mathlib.Order.Interval.Finset.Basic #align_import data.dfinsupp.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open DFinsupp Finset open Pointwise variable {ι : Type*} {α : ι → Type*} namespace Finset variable [DecidableEq ι] [∀ i, Zero (α i)] {s : Finset ι} {f : Π₀ i, α i} {t : ∀ i, Finset (α i)} def dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : Finset (Π₀ i, α i) := (s.pi t).map ⟨fun f => DFinsupp.mk s fun i => f i i.2, by refine (mk_injective _).comp fun f g h => ?_ ext i hi convert congr_fun h ⟨i, hi⟩⟩ #align finset.dfinsupp Finset.dfinsupp @[simp] theorem card_dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : (s.dfinsupp t).card = ∏ i ∈ s, (t i).card := (card_map _).trans <| card_pi _ _ #align finset.card_dfinsupp Finset.card_dfinsupp variable [∀ i, DecidableEq (α i)]
Mathlib/Data/DFinsupp/Interval.lean
48
58
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
refine mem_map.trans ⟨?_, ?_⟩ · rintro ⟨f, hf, rfl⟩ rw [Function.Embedding.coeFn_mk] -- Porting note: added to avoid heartbeat timeout refine ⟨support_mk_subset, fun i hi => ?_⟩ convert mem_pi.1 hf i hi exact mk_of_mem hi · refine fun h => ⟨fun i _ => f i, mem_pi.2 h.2, ?_⟩ ext i dsimp exact ite_eq_left_iff.2 fun hi => (not_mem_support_iff.1 fun H => hi <| h.1 H).symm
10
22,026.465795
2
2
3
2,505
import Mathlib.Data.Finset.Pointwise import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.DFinsupp.Order import Mathlib.Order.Interval.Finset.Basic #align_import data.dfinsupp.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open DFinsupp Finset open Pointwise variable {ι : Type*} {α : ι → Type*} namespace Finset variable [DecidableEq ι] [∀ i, Zero (α i)] {s : Finset ι} {f : Π₀ i, α i} {t : ∀ i, Finset (α i)} def dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : Finset (Π₀ i, α i) := (s.pi t).map ⟨fun f => DFinsupp.mk s fun i => f i i.2, by refine (mk_injective _).comp fun f g h => ?_ ext i hi convert congr_fun h ⟨i, hi⟩⟩ #align finset.dfinsupp Finset.dfinsupp @[simp] theorem card_dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : (s.dfinsupp t).card = ∏ i ∈ s, (t i).card := (card_map _).trans <| card_pi _ _ #align finset.card_dfinsupp Finset.card_dfinsupp variable [∀ i, DecidableEq (α i)] theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by refine mem_map.trans ⟨?_, ?_⟩ · rintro ⟨f, hf, rfl⟩ rw [Function.Embedding.coeFn_mk] -- Porting note: added to avoid heartbeat timeout refine ⟨support_mk_subset, fun i hi => ?_⟩ convert mem_pi.1 hf i hi exact mk_of_mem hi · refine fun h => ⟨fun i _ => f i, mem_pi.2 h.2, ?_⟩ ext i dsimp exact ite_eq_left_iff.2 fun hi => (not_mem_support_iff.1 fun H => hi <| h.1 H).symm #align finset.mem_dfinsupp_iff Finset.mem_dfinsupp_iff @[simp]
Mathlib/Data/DFinsupp/Interval.lean
64
73
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) : f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
refine mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i => ⟨ fun h => ?_, fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi ?_, fun _ => h⟩⟩) · by_cases hi : i ∈ s · exact h.2 hi · rw [not_mem_support_iff.1 (mt h.1 hi), not_mem_support_iff.1 (not_mem_mono ht hi)] exact zero_mem_zero · rwa [H, mem_zero] at h
8
2,980.957987
2
2
3
2,505
import Mathlib.Data.Finset.Pointwise import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.DFinsupp.Order import Mathlib.Order.Interval.Finset.Basic #align_import data.dfinsupp.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open DFinsupp Finset open Pointwise variable {ι : Type*} {α : ι → Type*} open Finset namespace DFinsupp section BundledIcc variable [∀ i, Zero (α i)] [∀ i, PartialOrder (α i)] [∀ i, LocallyFiniteOrder (α i)] {f g : Π₀ i, α i} {i : ι} {a : α i} def rangeIcc (f g : Π₀ i, α i) : Π₀ i, Finset (α i) where toFun i := Icc (f i) (g i) support' := f.support'.bind fun fs => g.support'.map fun gs => ⟨ fs.1 + gs.1, fun i => or_iff_not_imp_left.2 fun h => by have hf : f i = 0 := (fs.prop i).resolve_left (Multiset.not_mem_mono (Multiset.Le.subset <| Multiset.le_add_right _ _) h) have hg : g i = 0 := (gs.prop i).resolve_left (Multiset.not_mem_mono (Multiset.Le.subset <| Multiset.le_add_left _ _) h) -- Porting note: was rw, but was rewriting under lambda, so changed to simp_rw simp_rw [hf, hg] exact Icc_self _⟩ #align dfinsupp.range_Icc DFinsupp.rangeIcc @[simp] theorem rangeIcc_apply (f g : Π₀ i, α i) (i : ι) : f.rangeIcc g i = Icc (f i) (g i) := rfl #align dfinsupp.range_Icc_apply DFinsupp.rangeIcc_apply theorem mem_rangeIcc_apply_iff : a ∈ f.rangeIcc g i ↔ f i ≤ a ∧ a ≤ g i := mem_Icc #align dfinsupp.mem_range_Icc_apply_iff DFinsupp.mem_rangeIcc_apply_iff
Mathlib/Data/DFinsupp/Interval.lean
125
132
theorem support_rangeIcc_subset [DecidableEq ι] [∀ i, DecidableEq (α i)] : (f.rangeIcc g).support ⊆ f.support ∪ g.support := by
refine fun x hx => ?_ by_contra h refine not_mem_support_iff.2 ?_ hx rw [rangeIcc_apply, not_mem_support_iff.1 (not_mem_mono subset_union_left h), not_mem_support_iff.1 (not_mem_mono subset_union_right h)] exact Icc_self _
6
403.428793
2
2
3
2,505
import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Multiset.Antidiagonal #align_import data.finsupp.antidiagonal from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace Finsupp open Finset universe u variable {α : Type u} [DecidableEq α] def antidiagonal' (f : α →₀ ℕ) : (α →₀ ℕ) × (α →₀ ℕ) →₀ ℕ := Multiset.toFinsupp ((Finsupp.toMultiset f).antidiagonal.map (Prod.map Multiset.toFinsupp Multiset.toFinsupp)) #align finsupp.antidiagonal' Finsupp.antidiagonal' instance instHasAntidiagonal : HasAntidiagonal (α →₀ ℕ) where antidiagonal f := f.antidiagonal'.support mem_antidiagonal {f} {p} := by rcases p with ⟨p₁, p₂⟩ simp [antidiagonal', ← and_assoc, Multiset.toFinsupp_eq_iff, ← Multiset.toFinsupp_eq_iff (f := f)] #align finsupp.antidiagonal_filter_fst_eq Finset.filter_fst_eq_antidiagonal #align finsupp.antidiagonal_filter_snd_eq Finset.filter_snd_eq_antidiagonal -- nolint as this is for dsimp @[simp, nolint simpNF] theorem antidiagonal_zero : antidiagonal (0 : α →₀ ℕ) = singleton (0, 0) := rfl #align finsupp.antidiagonal_zero Finsupp.antidiagonal_zero @[to_additive] theorem prod_antidiagonal_swap {M : Type*} [CommMonoid M] (n : α →₀ ℕ) (f : (α →₀ ℕ) → (α →₀ ℕ) → M) : ∏ p ∈ antidiagonal n, f p.1 p.2 = ∏ p ∈ antidiagonal n, f p.2 p.1 := prod_equiv (Equiv.prodComm _ _) (by simp [add_comm]) (by simp) #align finsupp.prod_antidiagonal_swap Finsupp.prod_antidiagonal_swap #align finsupp.sum_antidiagonal_swap Finsupp.sum_antidiagonal_swap @[simp]
Mathlib/Data/Finsupp/Antidiagonal.lean
61
79
theorem antidiagonal_single (a : α) (n : ℕ) : antidiagonal (single a n) = (antidiagonal n).map (Function.Embedding.prodMap ⟨_, single_injective a⟩ ⟨_, single_injective a⟩) := by
ext ⟨x, y⟩ simp only [mem_antidiagonal, mem_map, mem_antidiagonal, Function.Embedding.coe_prodMap, Function.Embedding.coeFn_mk, Prod.map_apply, Prod.mk.injEq, Prod.exists] constructor · intro h refine ⟨x a, y a, DFunLike.congr_fun h a |>.trans single_eq_same, ?_⟩ simp_rw [DFunLike.ext_iff, ← forall_and] intro i replace h := DFunLike.congr_fun h i simp_rw [single_apply, Finsupp.add_apply] at h ⊢ obtain rfl | hai := Decidable.eq_or_ne a i · exact ⟨if_pos rfl, if_pos rfl⟩ · simp_rw [if_neg hai, _root_.add_eq_zero_iff] at h ⊢ exact h.imp Eq.symm Eq.symm · rintro ⟨a, b, rfl, rfl, rfl⟩ exact (single_add _ _ _).symm
16
8,886,110.520508
2
2
1
2,506
import Mathlib.Data.Real.Cardinality import Mathlib.Topology.Separation import Mathlib.Topology.TietzeExtension open Set Function Cardinal Topology TopologicalSpace universe u variable {X : Type u} [TopologicalSpace X] [SeparableSpace X]
Mathlib/Topology/Separation/NotNormal.lean
26
53
theorem IsClosed.mk_lt_continuum [NormalSpace X] {s : Set X} (hs : IsClosed s) [DiscreteTopology s] : #s < 𝔠 := by
-- Proof by contradiction: assume `𝔠 ≤ #s` by_contra! h -- Choose a countable dense set `t : Set X` rcases exists_countable_dense X with ⟨t, htc, htd⟩ haveI := htc.to_subtype -- To obtain a contradiction, we will prove `2 ^ 𝔠 ≤ 𝔠`. refine (Cardinal.cantor 𝔠).not_le ?_ calc -- Any function `s → ℝ` is continuous, hence `2 ^ 𝔠 ≤ #C(s, ℝ)` 2 ^ 𝔠 ≤ #C(s, ℝ) := by rw [(ContinuousMap.equivFnOfDiscrete _ _).cardinal_eq, mk_arrow, mk_real, lift_continuum, lift_uzero] exact (power_le_power_left two_ne_zero h).trans (power_le_power_right (nat_lt_continuum 2).le) -- By the Tietze Extension Theorem, any function `f : C(s, ℝ)` can be extended to `C(X, ℝ)`, -- hence `#C(s, ℝ) ≤ #C(X, ℝ)` _ ≤ #C(X, ℝ) := by choose f hf using ContinuousMap.exists_restrict_eq (Y := ℝ) hs have hfi : Injective f := LeftInverse.injective hf exact mk_le_of_injective hfi -- Since `t` is dense, restriction `C(X, ℝ) → C(t, ℝ)` is injective, hence `#C(X, ℝ) ≤ #C(t, ℝ)` _ ≤ #C(t, ℝ) := mk_le_of_injective <| ContinuousMap.injective_restrict htd _ ≤ #(t → ℝ) := mk_le_of_injective DFunLike.coe_injective -- Since `t` is countable, we have `#(t → ℝ) ≤ 𝔠` _ ≤ 𝔠 := by rw [mk_arrow, mk_real, lift_uzero, lift_continuum, continuum, ← power_mul] exact power_le_power_left two_ne_zero mk_le_aleph0
26
195,729,609,428.83878
2
2
1
2,507
import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.CategoryTheory.Filtered.Basic #align_import topology.category.Top.limits.cofiltered from "leanprover-community/mathlib"@"dbdf71cee7bb20367cb7e37279c08b0c218cf967" -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace open CategoryTheory open CategoryTheory.Limits universe u v w noncomputable section namespace TopCat section CofilteredLimit variable {J : Type v} [SmallCategory J] [IsCofiltered J] (F : J ⥤ TopCat.{max v u}) (C : Cone F) (hC : IsLimit C)
Mathlib/Topology/Category/TopCat/Limits/Cofiltered.lean
43
122
theorem isTopologicalBasis_cofiltered_limit (T : ∀ j, Set (Set (F.obj j))) (hT : ∀ j, IsTopologicalBasis (T j)) (univ : ∀ i : J, Set.univ ∈ T i) (inter : ∀ (i) (U1 U2 : Set (F.obj i)), U1 ∈ T i → U2 ∈ T i → U1 ∩ U2 ∈ T i) (compat : ∀ (i j : J) (f : i ⟶ j) (V : Set (F.obj j)) (_hV : V ∈ T j), F.map f ⁻¹' V ∈ T i) : IsTopologicalBasis {U : Set C.pt | ∃ (j : _) (V : Set (F.obj j)), V ∈ T j ∧ U = C.π.app j ⁻¹' V} := by
classical -- The limit cone for `F` whose topology is defined as an infimum. let D := limitConeInfi F -- The isomorphism between the cone point of `C` and the cone point of `D`. let E : C.pt ≅ D.pt := hC.conePointUniqueUpToIso (limitConeInfiIsLimit _) have hE : Inducing E.hom := (TopCat.homeoOfIso E).inducing -- Reduce to the assertion of the theorem with `D` instead of `C`. suffices IsTopologicalBasis {U : Set D.pt | ∃ (j : _) (V : Set (F.obj j)), V ∈ T j ∧ U = D.π.app j ⁻¹' V} by convert this.inducing hE ext U0 constructor · rintro ⟨j, V, hV, rfl⟩ exact ⟨D.π.app j ⁻¹' V, ⟨j, V, hV, rfl⟩, rfl⟩ · rintro ⟨W, ⟨j, V, hV, rfl⟩, rfl⟩ exact ⟨j, V, hV, rfl⟩ -- Using `D`, we can apply the characterization of the topological basis of a -- topology defined as an infimum... convert IsTopologicalBasis.iInf_induced hT fun j (x : D.pt) => D.π.app j x using 1 ext U0 constructor · rintro ⟨j, V, hV, rfl⟩ let U : ∀ i, Set (F.obj i) := fun i => if h : i = j then by rw [h]; exact V else Set.univ refine ⟨U, {j}, ?_, ?_⟩ · simp only [Finset.mem_singleton] rintro i rfl simpa [U] · simp [U] · rintro ⟨U, G, h1, h2⟩ obtain ⟨j, hj⟩ := IsCofiltered.inf_objs_exists G let g : ∀ e ∈ G, j ⟶ e := fun _ he => (hj he).some let Vs : J → Set (F.obj j) := fun e => if h : e ∈ G then F.map (g e h) ⁻¹' U e else Set.univ let V : Set (F.obj j) := ⋂ (e : J) (_he : e ∈ G), Vs e refine ⟨j, V, ?_, ?_⟩ · -- An intermediate claim used to apply induction along `G : Finset J` later on. have : ∀ (S : Set (Set (F.obj j))) (E : Finset J) (P : J → Set (F.obj j)) (_univ : Set.univ ∈ S) (_inter : ∀ A B : Set (F.obj j), A ∈ S → B ∈ S → A ∩ B ∈ S) (_cond : ∀ (e : J) (_he : e ∈ E), P e ∈ S), (⋂ (e) (_he : e ∈ E), P e) ∈ S := by intro S E induction E using Finset.induction_on with | empty => intro P he _hh simpa | @insert a E _ha hh1 => intro hh2 hh3 hh4 hh5 rw [Finset.set_biInter_insert] refine hh4 _ _ (hh5 _ (Finset.mem_insert_self _ _)) (hh1 _ hh3 hh4 ?_) intro e he exact hh5 e (Finset.mem_insert_of_mem he) -- use the intermediate claim to finish off the goal using `univ` and `inter`. refine this _ _ _ (univ _) (inter _) ?_ intro e he dsimp [Vs] rw [dif_pos he] exact compat j e (g e he) (U e) (h1 e he) · -- conclude... rw [h2] change _ = (D.π.app j)⁻¹' ⋂ (e : J) (_ : e ∈ G), Vs e rw [Set.preimage_iInter] apply congrArg ext1 e erw [Set.preimage_iInter] apply congrArg ext1 he -- Porting note: needed more hand holding here change (D.π.app e)⁻¹' U e = (D.π.app j) ⁻¹' if h : e ∈ G then F.map (g e h) ⁻¹' U e else Set.univ rw [dif_pos he, ← Set.preimage_comp] apply congrFun apply congrArg erw [← coe_comp, D.w] -- now `erw` after #13170 rfl
74
137,338,297,954,017,610,000,000,000,000,000
2
2
1
2,508
import Mathlib.Data.Fin.Tuple.Sort import Mathlib.Order.WellFounded #align_import data.fin.tuple.bubble_sort_induction from "leanprover-community/mathlib"@"bf2428c9486c407ca38b5b3fb10b87dad0bc99fa" namespace Tuple
Mathlib/Data/Fin/Tuple/BubbleSortInduction.lean
34
44
theorem bubble_sort_induction' {n : ℕ} {α : Type*} [LinearOrder α] {f : Fin n → α} {P : (Fin n → α) → Prop} (hf : P f) (h : ∀ (σ : Equiv.Perm (Fin n)) (i j : Fin n), i < j → (f ∘ σ) j < (f ∘ σ) i → P (f ∘ σ) → P (f ∘ σ ∘ Equiv.swap i j)) : P (f ∘ sort f) := by
letI := @Preorder.lift _ (Lex (Fin n → α)) _ fun σ : Equiv.Perm (Fin n) => toLex (f ∘ σ) refine @WellFounded.induction_bot' _ _ _ (IsWellFounded.wf : WellFounded (· < ·)) (Equiv.refl _) (sort f) P (fun σ => f ∘ σ) (fun σ hσ hfσ => ?_) hf obtain ⟨i, j, hij₁, hij₂⟩ := antitone_pair_of_not_sorted' hσ exact ⟨σ * Equiv.swap i j, Pi.lex_desc hij₁.le hij₂, h σ i j hij₁ hij₂ hfσ⟩
6
403.428793
2
2
1
2,509
import ProofWidgets.Component.HtmlDisplay open scoped ProofWidgets.Jsx -- ⟵ remember this! def htmlLetters : Array ProofWidgets.Html := #[ <span style={json% {color: "red"}}>H</span>, <span style={json% {color: "yellow"}}>T</span>, <span style={json% {color: "green"}}>M</span>, <span style={json% {color: "blue"}}>L</span> ] def x := <b>You can use {...htmlLetters} {.text " "} in lean! {.text <| toString <| 4 + 5} <hr/> </b> -- Put your cursor over this #html x
.lake/packages/proofwidgets/ProofWidgets/Demos/Jsx.lean
18
24
theorem ghjk : True := by
-- Put your cursor over any of the `html!` lines html! <b>What, HTML in Lean?! </b> html! <i>And another!</i> -- attributes and text nodes can be interpolated html! <img src={ "https://" ++ "upload.wikimedia.org/wikipedia/commons/a/a5/Parrot_montage.jpg"} alt="parrots" /> trivial
6
403.428793
2
2
1
2,510