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.MeasureTheory.Function.Jacobian import Mathlib.MeasureTheory.Measure.Lebesgue.Complex import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.polar_coord from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section Real open Real Set MeasureTheory open scoped Real Topology @[simps] def polarCoord : PartialHomeomorph (ℝ × ℝ) (ℝ × ℝ) where toFun q := (√(q.1 ^ 2 + q.2 ^ 2), Complex.arg (Complex.equivRealProd.symm q)) invFun p := (p.1 * cos p.2, p.1 * sin p.2) source := {q | 0 < q.1} ∪ {q | q.2 ≠ 0} target := Ioi (0 : ℝ) ×ˢ Ioo (-π) π map_target' := by rintro ⟨r, θ⟩ ⟨hr, hθ⟩ dsimp at hr hθ rcases eq_or_ne θ 0 with (rfl | h'θ) · simpa using hr · right simp at hr simpa only [ne_of_gt hr, Ne, mem_setOf_eq, mul_eq_zero, false_or_iff, sin_eq_zero_iff_of_lt_of_lt hθ.1 hθ.2] using h'θ map_source' := by rintro ⟨x, y⟩ hxy simp only [prod_mk_mem_set_prod_eq, mem_Ioi, sqrt_pos, mem_Ioo, Complex.neg_pi_lt_arg, true_and_iff, Complex.arg_lt_pi_iff] constructor · cases' hxy with hxy hxy · dsimp at hxy; linarith [sq_pos_of_ne_zero hxy.ne', sq_nonneg y] · linarith [sq_nonneg x, sq_pos_of_ne_zero hxy] · cases' hxy with hxy hxy · exact Or.inl (le_of_lt hxy) · exact Or.inr hxy right_inv' := by rintro ⟨r, θ⟩ ⟨hr, hθ⟩ dsimp at hr hθ simp only [Prod.mk.inj_iff] constructor · conv_rhs => rw [← sqrt_sq (le_of_lt hr), ← one_mul (r ^ 2), ← sin_sq_add_cos_sq θ] congr 1 ring · convert Complex.arg_mul_cos_add_sin_mul_I hr ⟨hθ.1, hθ.2.le⟩ simp only [Complex.equivRealProd_symm_apply, Complex.ofReal_mul, Complex.ofReal_cos, Complex.ofReal_sin] ring left_inv' := by rintro ⟨x, y⟩ _ have A : √(x ^ 2 + y ^ 2) = Complex.abs (x + y * Complex.I) := by rw [Complex.abs_apply, Complex.normSq_add_mul_I] have Z := Complex.abs_mul_cos_add_sin_mul_I (x + y * Complex.I) simp only [← Complex.ofReal_cos, ← Complex.ofReal_sin, mul_add, ← Complex.ofReal_mul, ← mul_assoc] at Z simp [A] open_target := isOpen_Ioi.prod isOpen_Ioo open_source := (isOpen_lt continuous_const continuous_fst).union (isOpen_ne_fun continuous_snd continuous_const) continuousOn_invFun := ((continuous_fst.mul (continuous_cos.comp continuous_snd)).prod_mk (continuous_fst.mul (continuous_sin.comp continuous_snd))).continuousOn continuousOn_toFun := by apply ((continuous_fst.pow 2).add (continuous_snd.pow 2)).sqrt.continuousOn.prod have A : MapsTo Complex.equivRealProd.symm ({q : ℝ × ℝ | 0 < q.1} ∪ {q : ℝ × ℝ | q.2 ≠ 0}) Complex.slitPlane := by rintro ⟨x, y⟩ hxy; simpa only using hxy refine ContinuousOn.comp (f := Complex.equivRealProd.symm) (g := Complex.arg) (fun z hz => ?_) ?_ A · exact (Complex.continuousAt_arg hz).continuousWithinAt · exact Complex.equivRealProdCLM.symm.continuous.continuousOn #align polar_coord polarCoord
Mathlib/Analysis/SpecialFunctions/PolarCoord.lean
95
103
theorem hasFDerivAt_polarCoord_symm (p : ℝ × ℝ) : HasFDerivAt polarCoord.symm (LinearMap.toContinuousLinearMap (Matrix.toLin (Basis.finTwoProd ℝ) (Basis.finTwoProd ℝ) !![cos p.2, -p.1 * sin p.2; sin p.2, p.1 * cos p.2])) p := by
rw [Matrix.toLin_finTwoProd_toContinuousLinearMap] convert HasFDerivAt.prod (𝕜 := ℝ) (hasFDerivAt_fst.mul ((hasDerivAt_cos p.2).comp_hasFDerivAt p hasFDerivAt_snd)) (hasFDerivAt_fst.mul ((hasDerivAt_sin p.2).comp_hasFDerivAt p hasFDerivAt_snd)) using 2 <;> simp [smul_smul, add_comm, neg_mul, smul_neg, neg_smul _ (ContinuousLinearMap.snd ℝ ℝ ℝ)]
5
148.413159
2
2
2
2,067
import Mathlib.MeasureTheory.Function.Jacobian import Mathlib.MeasureTheory.Measure.Lebesgue.Complex import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.polar_coord from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section Real open Real Set MeasureTheory open scoped Real Topology @[simps] def polarCoord : PartialHomeomorph (ℝ × ℝ) (ℝ × ℝ) where toFun q := (√(q.1 ^ 2 + q.2 ^ 2), Complex.arg (Complex.equivRealProd.symm q)) invFun p := (p.1 * cos p.2, p.1 * sin p.2) source := {q | 0 < q.1} ∪ {q | q.2 ≠ 0} target := Ioi (0 : ℝ) ×ˢ Ioo (-π) π map_target' := by rintro ⟨r, θ⟩ ⟨hr, hθ⟩ dsimp at hr hθ rcases eq_or_ne θ 0 with (rfl | h'θ) · simpa using hr · right simp at hr simpa only [ne_of_gt hr, Ne, mem_setOf_eq, mul_eq_zero, false_or_iff, sin_eq_zero_iff_of_lt_of_lt hθ.1 hθ.2] using h'θ map_source' := by rintro ⟨x, y⟩ hxy simp only [prod_mk_mem_set_prod_eq, mem_Ioi, sqrt_pos, mem_Ioo, Complex.neg_pi_lt_arg, true_and_iff, Complex.arg_lt_pi_iff] constructor · cases' hxy with hxy hxy · dsimp at hxy; linarith [sq_pos_of_ne_zero hxy.ne', sq_nonneg y] · linarith [sq_nonneg x, sq_pos_of_ne_zero hxy] · cases' hxy with hxy hxy · exact Or.inl (le_of_lt hxy) · exact Or.inr hxy right_inv' := by rintro ⟨r, θ⟩ ⟨hr, hθ⟩ dsimp at hr hθ simp only [Prod.mk.inj_iff] constructor · conv_rhs => rw [← sqrt_sq (le_of_lt hr), ← one_mul (r ^ 2), ← sin_sq_add_cos_sq θ] congr 1 ring · convert Complex.arg_mul_cos_add_sin_mul_I hr ⟨hθ.1, hθ.2.le⟩ simp only [Complex.equivRealProd_symm_apply, Complex.ofReal_mul, Complex.ofReal_cos, Complex.ofReal_sin] ring left_inv' := by rintro ⟨x, y⟩ _ have A : √(x ^ 2 + y ^ 2) = Complex.abs (x + y * Complex.I) := by rw [Complex.abs_apply, Complex.normSq_add_mul_I] have Z := Complex.abs_mul_cos_add_sin_mul_I (x + y * Complex.I) simp only [← Complex.ofReal_cos, ← Complex.ofReal_sin, mul_add, ← Complex.ofReal_mul, ← mul_assoc] at Z simp [A] open_target := isOpen_Ioi.prod isOpen_Ioo open_source := (isOpen_lt continuous_const continuous_fst).union (isOpen_ne_fun continuous_snd continuous_const) continuousOn_invFun := ((continuous_fst.mul (continuous_cos.comp continuous_snd)).prod_mk (continuous_fst.mul (continuous_sin.comp continuous_snd))).continuousOn continuousOn_toFun := by apply ((continuous_fst.pow 2).add (continuous_snd.pow 2)).sqrt.continuousOn.prod have A : MapsTo Complex.equivRealProd.symm ({q : ℝ × ℝ | 0 < q.1} ∪ {q : ℝ × ℝ | q.2 ≠ 0}) Complex.slitPlane := by rintro ⟨x, y⟩ hxy; simpa only using hxy refine ContinuousOn.comp (f := Complex.equivRealProd.symm) (g := Complex.arg) (fun z hz => ?_) ?_ A · exact (Complex.continuousAt_arg hz).continuousWithinAt · exact Complex.equivRealProdCLM.symm.continuous.continuousOn #align polar_coord polarCoord theorem hasFDerivAt_polarCoord_symm (p : ℝ × ℝ) : HasFDerivAt polarCoord.symm (LinearMap.toContinuousLinearMap (Matrix.toLin (Basis.finTwoProd ℝ) (Basis.finTwoProd ℝ) !![cos p.2, -p.1 * sin p.2; sin p.2, p.1 * cos p.2])) p := by rw [Matrix.toLin_finTwoProd_toContinuousLinearMap] convert HasFDerivAt.prod (𝕜 := ℝ) (hasFDerivAt_fst.mul ((hasDerivAt_cos p.2).comp_hasFDerivAt p hasFDerivAt_snd)) (hasFDerivAt_fst.mul ((hasDerivAt_sin p.2).comp_hasFDerivAt p hasFDerivAt_snd)) using 2 <;> simp [smul_smul, add_comm, neg_mul, smul_neg, neg_smul _ (ContinuousLinearMap.snd ℝ ℝ ℝ)] #align has_fderiv_at_polar_coord_symm hasFDerivAt_polarCoord_symm -- Porting note: this instance is needed but not automatically synthesised instance : Measure.IsAddHaarMeasure volume (G := ℝ × ℝ) := Measure.prod.instIsAddHaarMeasure _ _
Mathlib/Analysis/SpecialFunctions/PolarCoord.lean
110
123
theorem polarCoord_source_ae_eq_univ : polarCoord.source =ᵐ[volume] univ := by
have A : polarCoord.sourceᶜ ⊆ LinearMap.ker (LinearMap.snd ℝ ℝ ℝ) := by intro x hx simp only [polarCoord_source, compl_union, mem_inter_iff, mem_compl_iff, mem_setOf_eq, not_lt, Classical.not_not] at hx exact hx.2 have B : volume (LinearMap.ker (LinearMap.snd ℝ ℝ ℝ) : Set (ℝ × ℝ)) = 0 := by apply Measure.addHaar_submodule rw [Ne, LinearMap.ker_eq_top] intro h have : (LinearMap.snd ℝ ℝ ℝ) (0, 1) = (0 : ℝ × ℝ →ₗ[ℝ] ℝ) (0, 1) := by rw [h] simp at this simp only [ae_eq_univ] exact le_antisymm ((measure_mono A).trans (le_of_eq B)) bot_le
13
442,413.392009
2
2
2
2,067
import Mathlib.RingTheory.GradedAlgebra.HomogeneousIdeal #align_import ring_theory.graded_algebra.radical from "leanprover-community/mathlib"@"f1944b30c97c5eb626e498307dec8b022a05bd0a" open GradedRing DirectSum SetLike Finset variable {ι σ A : Type*} variable [CommRing A] variable [LinearOrderedCancelAddCommMonoid ι] variable [SetLike σ A] [AddSubmonoidClass σ A] {𝒜 : ι → σ} [GradedRing 𝒜] -- Porting note: This proof needs a long time to elaborate
Mathlib/RingTheory/GradedAlgebra/Radical.lean
47
136
theorem Ideal.IsHomogeneous.isPrime_of_homogeneous_mem_or_mem {I : Ideal A} (hI : I.IsHomogeneous 𝒜) (I_ne_top : I ≠ ⊤) (homogeneous_mem_or_mem : ∀ {x y : A}, Homogeneous 𝒜 x → Homogeneous 𝒜 y → x * y ∈ I → x ∈ I ∨ y ∈ I) : Ideal.IsPrime I := ⟨I_ne_top, by intro x y hxy by_contra! rid obtain ⟨rid₁, rid₂⟩ := rid classical /- The idea of the proof is the following : since `x * y ∈ I` and `I` homogeneous, then `proj i (x * y) ∈ I` for any `i : ι`. Then consider two sets `{i ∈ x.support | xᵢ ∉ I}` and `{j ∈ y.support | yⱼ ∉ J}`; let `max₁, max₂` be the maximum of the two sets, then `proj (max₁ + max₂) (x * y) ∈ I`. Then, `proj max₁ x ∉ I` and `proj max₂ j ∉ I` but `proj i x ∈ I` for all `max₁ < i` and `proj j y ∈ I` for all `max₂ < j`. ` proj (max₁ + max₂) (x * y)` `= ∑ {(i, j) ∈ supports | i + j = max₁ + max₂}, xᵢ * yⱼ` `= proj max₁ x * proj max₂ y` ` + ∑ {(i, j) ∈ supports \ {(max₁, max₂)} | i + j = max₁ + max₂}, xᵢ * yⱼ`. This is a contradiction, because both `proj (max₁ + max₂) (x * y) ∈ I` and the sum on the right hand side is in `I` however `proj max₁ x * proj max₂ y` is not in `I`. -/ set set₁ := (decompose 𝒜 x).support.filter (fun i => proj 𝒜 i x ∉ I) with set₁_eq set set₂ := (decompose 𝒜 y).support.filter (fun i => proj 𝒜 i y ∉ I) with set₂_eq have nonempty : ∀ x : A, x ∉ I → ((decompose 𝒜 x).support.filter (fun i => proj 𝒜 i x ∉ I)).Nonempty := by
intro x hx rw [filter_nonempty_iff] contrapose! hx simp_rw [proj_apply] at hx rw [← sum_support_decompose 𝒜 x] exact Ideal.sum_mem _ hx set max₁ := set₁.max' (nonempty x rid₁) set max₂ := set₂.max' (nonempty y rid₂) have mem_max₁ : max₁ ∈ set₁ := max'_mem set₁ (nonempty x rid₁) have mem_max₂ : max₂ ∈ set₂ := max'_mem set₂ (nonempty y rid₂) replace hxy : proj 𝒜 (max₁ + max₂) (x * y) ∈ I := hI _ hxy have mem_I : proj 𝒜 max₁ x * proj 𝒜 max₂ y ∈ I := by set antidiag := ((decompose 𝒜 x).support ×ˢ (decompose 𝒜 y).support).filter (fun z : ι × ι => z.1 + z.2 = max₁ + max₂) with ha have mem_antidiag : (max₁, max₂) ∈ antidiag := by simp only [antidiag, add_sum_erase, mem_filter, mem_product] exact ⟨⟨mem_of_mem_filter _ mem_max₁, mem_of_mem_filter _ mem_max₂⟩, trivial⟩ have eq_add_sum := calc proj 𝒜 (max₁ + max₂) (x * y) = ∑ ij ∈ antidiag, proj 𝒜 ij.1 x * proj 𝒜 ij.2 y := by simp_rw [ha, proj_apply, DirectSum.decompose_mul, DirectSum.coe_mul_apply 𝒜] _ = proj 𝒜 max₁ x * proj 𝒜 max₂ y + ∑ ij ∈ antidiag.erase (max₁, max₂), proj 𝒜 ij.1 x * proj 𝒜 ij.2 y := (add_sum_erase _ _ mem_antidiag).symm rw [eq_sub_of_add_eq eq_add_sum.symm] refine Ideal.sub_mem _ hxy (Ideal.sum_mem _ fun z H => ?_) rcases z with ⟨i, j⟩ simp only [antidiag, mem_erase, Prod.mk.inj_iff, Ne, mem_filter, mem_product] at H rcases H with ⟨H₁, ⟨H₂, H₃⟩, H₄⟩ have max_lt : max₁ < i ∨ max₂ < j := by rcases lt_trichotomy max₁ i with (h | rfl | h) · exact Or.inl h · refine False.elim (H₁ ⟨rfl, add_left_cancel H₄⟩) · apply Or.inr have := add_lt_add_right h j rw [H₄] at this exact lt_of_add_lt_add_left this cases' max_lt with max_lt max_lt · -- in this case `max₁ < i`, then `xᵢ ∈ I`; for otherwise `i ∈ set₁` then `i ≤ max₁`. have not_mem : i ∉ set₁ := fun h => lt_irrefl _ ((max'_lt_iff set₁ (nonempty x rid₁)).mp max_lt i h) rw [set₁_eq] at not_mem simp only [not_and, Classical.not_not, Ne, mem_filter] at not_mem exact Ideal.mul_mem_right _ I (not_mem H₂) · -- in this case `max₂ < j`, then `yⱼ ∈ I`; for otherwise `j ∈ set₂`, then `j ≤ max₂`. have not_mem : j ∉ set₂ := fun h => lt_irrefl _ ((max'_lt_iff set₂ (nonempty y rid₂)).mp max_lt j h) rw [set₂_eq] at not_mem simp only [not_and, Classical.not_not, Ne, mem_filter] at not_mem exact Ideal.mul_mem_left I _ (not_mem H₃) have not_mem_I : proj 𝒜 max₁ x * proj 𝒜 max₂ y ∉ I := by have neither_mem : proj 𝒜 max₁ x ∉ I ∧ proj 𝒜 max₂ y ∉ I := by rw [mem_filter] at mem_max₁ mem_max₂ exact ⟨mem_max₁.2, mem_max₂.2⟩ intro _rid cases' homogeneous_mem_or_mem ⟨max₁, SetLike.coe_mem _⟩ ⟨max₂, SetLike.coe_mem _⟩ mem_I with h h · apply neither_mem.1 h · apply neither_mem.2 h exact not_mem_I mem_I⟩
62
843,835,666,874,145,400,000,000,000
2
2
1
2,068
import Mathlib.Algebra.Algebra.Quasispectrum import Mathlib.Topology.ContinuousFunction.Compact import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.FunctionalCalculus import Mathlib.Topology.UniformSpace.CompactConvergence local notation "σₙ" => quasispectrum open scoped ContinuousMapZero class NonUnitalContinuousFunctionalCalculus (R : Type*) {A : Type*} (p : outParam (A → Prop)) [CommSemiring R] [Nontrivial R] [StarRing R] [MetricSpace R] [TopologicalSemiring R] [ContinuousStar R] [NonUnitalRing A] [StarRing A] [TopologicalSpace A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] : Prop where exists_cfc_of_predicate : ∀ a, p a → ∃ φ : C(σₙ R a, R)₀ →⋆ₙₐ[R] A, ClosedEmbedding φ ∧ φ ⟨(ContinuousMap.id R).restrict <| σₙ R a, rfl⟩ = a ∧ (∀ f, σₙ R (φ f) = Set.range f) ∧ ∀ f, p (φ f) -- TODO: try to unify with the unital version. The `ℝ≥0` case makes it tricky. class UniqueNonUnitalContinuousFunctionalCalculus (R A : Type*) [CommSemiring R] [StarRing R] [MetricSpace R] [TopologicalSemiring R] [ContinuousStar R] [NonUnitalRing A] [StarRing A] [TopologicalSpace A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] : Prop where eq_of_continuous_of_map_id (s : Set R) [CompactSpace s] [Zero s] (h0 : (0 : s) = (0 : R)) (φ ψ : C(s, R)₀ →⋆ₙₐ[R] A) (hφ : Continuous φ) (hψ : Continuous ψ) (h : φ (⟨.restrict s <| .id R, h0⟩) = ψ (⟨.restrict s <| .id R, h0⟩)) : φ = ψ compactSpace_quasispectrum (a : A) : CompactSpace (σₙ R a) section Main variable {R A : Type*} {p : A → Prop} [CommSemiring R] [Nontrivial R] [StarRing R] [MetricSpace R] variable [TopologicalSemiring R] [ContinuousStar R] [NonUnitalRing A] [StarRing A] variable [TopologicalSpace A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] variable [NonUnitalContinuousFunctionalCalculus R p] lemma NonUnitalStarAlgHom.ext_continuousMap [UniqueNonUnitalContinuousFunctionalCalculus R A] (a : A) (φ ψ : C(σₙ R a, R)₀ →⋆ₙₐ[R] A) (hφ : Continuous φ) (hψ : Continuous ψ) (h : φ ⟨.restrict (σₙ R a) <| .id R, rfl⟩ = ψ ⟨.restrict (σₙ R a) <| .id R, rfl⟩) : φ = ψ := have := UniqueNonUnitalContinuousFunctionalCalculus.compactSpace_quasispectrum (R := R) a UniqueNonUnitalContinuousFunctionalCalculus.eq_of_continuous_of_map_id _ (by simp) φ ψ hφ hψ h section cfcₙHom variable {a : A} (ha : p a) noncomputable def cfcₙHom : C(σₙ R a, R)₀ →⋆ₙₐ[R] A := (NonUnitalContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose lemma cfcₙHom_closedEmbedding : ClosedEmbedding <| (cfcₙHom ha : C(σₙ R a, R)₀ →⋆ₙₐ[R] A) := (NonUnitalContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.1 lemma cfcₙHom_id : cfcₙHom ha ⟨(ContinuousMap.id R).restrict <| σₙ R a, rfl⟩ = a := (NonUnitalContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.1 lemma cfcₙHom_map_quasispectrum (f : C(σₙ R a, R)₀) : σₙ R (cfcₙHom ha f) = Set.range f := (NonUnitalContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.1 f lemma cfcₙHom_predicate (f : C(σₙ R a, R)₀) : p (cfcₙHom ha f) := (NonUnitalContinuousFunctionalCalculus.exists_cfc_of_predicate a ha).choose_spec.2.2.2 f lemma cfcₙHom_eq_of_continuous_of_map_id [UniqueNonUnitalContinuousFunctionalCalculus R A] (φ : C(σₙ R a, R)₀ →⋆ₙₐ[R] A) (hφ₁ : Continuous φ) (hφ₂ : φ ⟨.restrict (σₙ R a) <| .id R, rfl⟩ = a) : cfcₙHom ha = φ := (cfcₙHom ha).ext_continuousMap a φ (cfcₙHom_closedEmbedding ha).continuous hφ₁ <| by rw [cfcₙHom_id ha, hφ₂]
Mathlib/Topology/ContinuousFunction/NonUnitalFunctionalCalculus.lean
147
167
theorem cfcₙHom_comp [UniqueNonUnitalContinuousFunctionalCalculus R A] (f : C(σₙ R a, R)₀) (f' : C(σₙ R a, σₙ R (cfcₙHom ha f))₀) (hff' : ∀ x, f x = f' x) (g : C(σₙ R (cfcₙHom ha f), R)₀) : cfcₙHom ha (g.comp f') = cfcₙHom (cfcₙHom_predicate ha f) g := by
let ψ : C(σₙ R (cfcₙHom ha f), R)₀ →⋆ₙₐ[R] C(σₙ R a, R)₀ := { toFun := (ContinuousMapZero.comp · f') map_smul' := fun _ _ ↦ rfl map_add' := fun _ _ ↦ rfl map_mul' := fun _ _ ↦ rfl map_zero' := rfl map_star' := fun _ ↦ rfl } let φ : C(σₙ R (cfcₙHom ha f), R)₀ →⋆ₙₐ[R] A := (cfcₙHom ha).comp ψ suffices cfcₙHom (cfcₙHom_predicate ha f) = φ from DFunLike.congr_fun this.symm g refine cfcₙHom_eq_of_continuous_of_map_id (cfcₙHom_predicate ha f) φ ?_ ?_ · refine (cfcₙHom_closedEmbedding ha).continuous.comp <| continuous_induced_rng.mpr ?_ exact f'.toContinuousMap.continuous_comp_left.comp continuous_induced_dom · simp only [φ, ψ, NonUnitalStarAlgHom.comp_apply, NonUnitalStarAlgHom.coe_mk', NonUnitalAlgHom.coe_mk] congr ext x simp [hff']
17
24,154,952.753575
2
2
1
2,069
import Mathlib.Algebra.CharP.Basic import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import algebra.char_p.local_ring from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
Mathlib/Algebra/CharP/LocalRing.lean
25
67
theorem charP_zero_or_prime_power (R : Type*) [CommRing R] [LocalRing R] (q : ℕ) [char_R_q : CharP R q] : q = 0 ∨ IsPrimePow q := by
-- Assume `q := char(R)` is not zero. apply or_iff_not_imp_left.2 intro q_pos let K := LocalRing.ResidueField R haveI RM_char := ringChar.charP K let r := ringChar K let n := q.factorization r -- `r := char(R/m)` is either prime or zero: cases' CharP.char_is_prime_or_zero K r with r_prime r_zero · let a := q / r ^ n -- If `r` is prime, we can write it as `r = a * q^n` ... have q_eq_a_mul_rn : q = r ^ n * a := by rw [Nat.mul_div_cancel' (Nat.ord_proj_dvd q r)] have r_ne_dvd_a := Nat.not_dvd_ord_compl r_prime q_pos have rn_dvd_q : r ^ n ∣ q := ⟨a, q_eq_a_mul_rn⟩ rw [mul_comm] at q_eq_a_mul_rn -- ... where `a` is a unit. have a_unit : IsUnit (a : R) := by by_contra g rw [← mem_nonunits_iff] at g rw [← LocalRing.mem_maximalIdeal] at g have a_cast_zero := Ideal.Quotient.eq_zero_iff_mem.2 g rw [map_natCast] at a_cast_zero have r_dvd_a := (ringChar.spec K a).1 a_cast_zero exact absurd r_dvd_a r_ne_dvd_a -- Let `b` be the inverse of `a`. cases' a_unit.exists_left_inv with a_inv h_inv_mul_a have rn_cast_zero : ↑(r ^ n) = (0 : R) := by rw [← @mul_one R _ ↑(r ^ n), mul_comm, ← Classical.choose_spec a_unit.exists_left_inv, mul_assoc, ← Nat.cast_mul, ← q_eq_a_mul_rn, CharP.cast_eq_zero R q] simp have q_eq_rn := Nat.dvd_antisymm ((CharP.cast_eq_zero_iff R q (r ^ n)).mp rn_cast_zero) rn_dvd_q have n_pos : n ≠ 0 := fun n_zero => absurd (by simpa [n_zero] using q_eq_rn) (CharP.char_ne_one R q) -- Definition of prime power: `∃ r n, Prime r ∧ 0 < n ∧ r ^ n = q`. exact ⟨r, ⟨n, ⟨r_prime.prime, ⟨pos_iff_ne_zero.mpr n_pos, q_eq_rn.symm⟩⟩⟩⟩ · haveI K_char_p_0 := ringChar.of_eq r_zero haveI K_char_zero : CharZero K := CharP.charP_to_charZero K haveI R_char_zero := RingHom.charZero (LocalRing.residue R) -- Finally, `r = 0` would lead to a contradiction: have q_zero := CharP.eq R char_R_q (CharP.ofCharZero R) exact absurd q_zero q_pos
41
639,843,493,530,055,000
2
2
1
2,070
import Mathlib.Algebra.Order.CauSeq.BigOperators import Mathlib.Data.Complex.Abs import Mathlib.Data.Complex.BigOperators import Mathlib.Data.Nat.Choose.Sum #align_import data.complex.exponential from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb" open CauSeq Finset IsAbsoluteValue open scoped Classical ComplexConjugate namespace Complex
Mathlib/Data/Complex/Exponential.lean
1,285
1,309
theorem sum_div_factorial_le {α : Type*} [LinearOrderedField α] (n j : ℕ) (hn : 0 < n) : (∑ m ∈ filter (fun k => n ≤ k) (range j), (1 / m.factorial : α)) ≤ n.succ / (n.factorial * n) := calc (∑ m ∈ filter (fun k => n ≤ k) (range j), (1 / m.factorial : α)) = ∑ m ∈ range (j - n), (1 / ((m + n).factorial : α)) := by
refine sum_nbij' (· - n) (· + n) ?_ ?_ ?_ ?_ ?_ <;> simp (config := { contextual := true }) [lt_tsub_iff_right, tsub_add_cancel_of_le] _ ≤ ∑ m ∈ range (j - n), ((n.factorial : α) * (n.succ : α) ^ m)⁻¹ := by simp_rw [one_div] gcongr rw [← Nat.cast_pow, ← Nat.cast_mul, Nat.cast_le, add_comm] exact Nat.factorial_mul_pow_le_factorial _ = (n.factorial : α)⁻¹ * ∑ m ∈ range (j - n), (n.succ : α)⁻¹ ^ m := by simp [mul_inv, ← mul_sum, ← sum_mul, mul_comm, inv_pow] _ = ((n.succ : α) - n.succ * (n.succ : α)⁻¹ ^ (j - n)) / (n.factorial * n) := by have h₁ : (n.succ : α) ≠ 1 := @Nat.cast_one α _ ▸ mt Nat.cast_inj.1 (mt Nat.succ.inj (pos_iff_ne_zero.1 hn)) have h₂ : (n.succ : α) ≠ 0 := by positivity have h₃ : (n.factorial * n : α) ≠ 0 := by positivity have h₄ : (n.succ - 1 : α) = n := by simp rw [geom_sum_inv h₁ h₂, eq_div_iff_mul_eq h₃, mul_comm _ (n.factorial * n : α), ← mul_assoc (n.factorial⁻¹ : α), ← mul_inv_rev, h₄, ← mul_assoc (n.factorial * n : α), mul_comm (n : α) n.factorial, mul_inv_cancel h₃, one_mul, mul_comm] _ ≤ n.succ / (n.factorial * n : α) := by gcongr; apply sub_le_self; positivity
19
178,482,300.963187
2
2
1
2,071
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {α : Type u} {β : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : ℤˣ) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm section Conjugation variable [DecidableEq α] [Fintype α] {σ τ : Perm α}
Mathlib/GroupTheory/Perm/Finite.lean
37
50
theorem isConj_of_support_equiv (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) }) (hf : ∀ (x : α) (hx : x ∈ (σ.support : Set α)), (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) : IsConj σ τ := by
refine isConj_iff.2 ⟨Equiv.extendSubtype f, ?_⟩ rw [mul_inv_eq_iff_eq_mul] ext x simp only [Perm.mul_apply] by_cases hx : x ∈ σ.support · rw [Equiv.extendSubtype_apply_of_mem, Equiv.extendSubtype_apply_of_mem] · exact hf x (Finset.mem_coe.2 hx) · rwa [Classical.not_not.1 ((not_congr mem_support).1 (Equiv.extendSubtype_not_mem f _ _)), Classical.not_not.1 ((not_congr mem_support).mp hx)]
9
8,103.083928
2
2
5
2,072
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {α : Type u} {β : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : ℤˣ) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm
Mathlib/GroupTheory/Perm/Finite.lean
57
65
theorem perm_inv_on_of_perm_on_finset {s : Finset α} {f : Perm α} (h : ∀ x ∈ s, f x ∈ s) {y : α} (hy : y ∈ s) : f⁻¹ y ∈ s := by
have h0 : ∀ y ∈ s, ∃ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ a₂ ha₁ ha₂ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self]
7
1,096.633158
2
2
5
2,072
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {α : Type u} {β : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : ℤˣ) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm theorem perm_inv_on_of_perm_on_finset {s : Finset α} {f : Perm α} (h : ∀ x ∈ s, f x ∈ s) {y : α} (hy : y ∈ s) : f⁻¹ y ∈ s := by have h0 : ∀ y ∈ s, ∃ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ a₂ ha₁ ha₂ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self] #align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset
Mathlib/GroupTheory/Perm/Finite.lean
68
75
theorem perm_inv_mapsTo_of_mapsTo (f : Perm α) {s : Set α} [Finite s] (h : Set.MapsTo f s s) : Set.MapsTo (f⁻¹ : _) s s := by
cases nonempty_fintype s exact fun x hx => Set.mem_toFinset.mp <| perm_inv_on_of_perm_on_finset (fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha))) (Set.mem_toFinset.mpr hx)
6
403.428793
2
2
5
2,072
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {α : Type u} {β : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : ℤˣ) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm theorem perm_inv_on_of_perm_on_finset {s : Finset α} {f : Perm α} (h : ∀ x ∈ s, f x ∈ s) {y : α} (hy : y ∈ s) : f⁻¹ y ∈ s := by have h0 : ∀ y ∈ s, ∃ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ a₂ ha₁ ha₂ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self] #align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset theorem perm_inv_mapsTo_of_mapsTo (f : Perm α) {s : Set α} [Finite s] (h : Set.MapsTo f s s) : Set.MapsTo (f⁻¹ : _) s s := by cases nonempty_fintype s exact fun x hx => Set.mem_toFinset.mp <| perm_inv_on_of_perm_on_finset (fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha))) (Set.mem_toFinset.mpr hx) #align equiv.perm.perm_inv_maps_to_of_maps_to Equiv.Perm.perm_inv_mapsTo_of_mapsTo @[simp] theorem perm_inv_mapsTo_iff_mapsTo {f : Perm α} {s : Set α} [Finite s] : Set.MapsTo (f⁻¹ : _) s s ↔ Set.MapsTo f s s := ⟨perm_inv_mapsTo_of_mapsTo f⁻¹, perm_inv_mapsTo_of_mapsTo f⟩ #align equiv.perm.perm_inv_maps_to_iff_maps_to Equiv.Perm.perm_inv_mapsTo_iff_mapsTo theorem perm_inv_on_of_perm_on_finite {f : Perm α} {p : α → Prop} [Finite { x // p x }] (h : ∀ x, p x → p (f x)) {x : α} (hx : p x) : p (f⁻¹ x) := -- Porting note: relies heavily on the definitions of `Subtype` and `setOf` unfolding to their -- underlying predicate. have : Finite { x | p x } := ‹_› perm_inv_mapsTo_of_mapsTo (s := {x | p x}) f h hx #align equiv.perm.perm_inv_on_of_perm_on_finite Equiv.Perm.perm_inv_on_of_perm_on_finite abbrev subtypePermOfFintype (f : Perm α) {p : α → Prop} [Finite { x // p x }] (h : ∀ x, p x → p (f x)) : Perm { x // p x } := f.subtypePerm fun x => ⟨h x, fun h₂ => f.inv_apply_self x ▸ perm_inv_on_of_perm_on_finite h h₂⟩ #align equiv.perm.subtype_perm_of_fintype Equiv.Perm.subtypePermOfFintype @[simp] theorem subtypePermOfFintype_apply (f : Perm α) {p : α → Prop} [Finite { x // p x }] (h : ∀ x, p x → p (f x)) (x : { x // p x }) : subtypePermOfFintype f h x = ⟨f x, h x x.2⟩ := rfl #align equiv.perm.subtype_perm_of_fintype_apply Equiv.Perm.subtypePermOfFintype_apply theorem subtypePermOfFintype_one (p : α → Prop) [Finite { x // p x }] (h : ∀ x, p x → p ((1 : Perm α) x)) : @subtypePermOfFintype α 1 p _ h = 1 := rfl #align equiv.perm.subtype_perm_of_fintype_one Equiv.Perm.subtypePermOfFintype_one
Mathlib/GroupTheory/Perm/Finite.lean
111
129
theorem perm_mapsTo_inl_iff_mapsTo_inr {m n : Type*} [Finite m] [Finite n] (σ : Perm (Sum m n)) : Set.MapsTo σ (Set.range Sum.inl) (Set.range Sum.inl) ↔ Set.MapsTo σ (Set.range Sum.inr) (Set.range Sum.inr) := by
constructor <;> ( intro h classical rw [← perm_inv_mapsTo_iff_mapsTo] at h intro x cases' hx : σ x with l r) · rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨l, rfl⟩ rw [← hx, σ.inv_apply_self] at hy exact absurd hy Sum.inl_ne_inr · rintro _; exact ⟨r, rfl⟩ · rintro _; exact ⟨l, rfl⟩ · rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨r, rfl⟩ rw [← hx, σ.inv_apply_self] at hy exact absurd hy Sum.inr_ne_inl
16
8,886,110.520508
2
2
5
2,072
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {α : Type u} {β : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : ℤˣ) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm theorem perm_inv_on_of_perm_on_finset {s : Finset α} {f : Perm α} (h : ∀ x ∈ s, f x ∈ s) {y : α} (hy : y ∈ s) : f⁻¹ y ∈ s := by have h0 : ∀ y ∈ s, ∃ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ a₂ ha₁ ha₂ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self] #align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset theorem perm_inv_mapsTo_of_mapsTo (f : Perm α) {s : Set α} [Finite s] (h : Set.MapsTo f s s) : Set.MapsTo (f⁻¹ : _) s s := by cases nonempty_fintype s exact fun x hx => Set.mem_toFinset.mp <| perm_inv_on_of_perm_on_finset (fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha))) (Set.mem_toFinset.mpr hx) #align equiv.perm.perm_inv_maps_to_of_maps_to Equiv.Perm.perm_inv_mapsTo_of_mapsTo @[simp] theorem perm_inv_mapsTo_iff_mapsTo {f : Perm α} {s : Set α} [Finite s] : Set.MapsTo (f⁻¹ : _) s s ↔ Set.MapsTo f s s := ⟨perm_inv_mapsTo_of_mapsTo f⁻¹, perm_inv_mapsTo_of_mapsTo f⟩ #align equiv.perm.perm_inv_maps_to_iff_maps_to Equiv.Perm.perm_inv_mapsTo_iff_mapsTo theorem perm_inv_on_of_perm_on_finite {f : Perm α} {p : α → Prop} [Finite { x // p x }] (h : ∀ x, p x → p (f x)) {x : α} (hx : p x) : p (f⁻¹ x) := -- Porting note: relies heavily on the definitions of `Subtype` and `setOf` unfolding to their -- underlying predicate. have : Finite { x | p x } := ‹_› perm_inv_mapsTo_of_mapsTo (s := {x | p x}) f h hx #align equiv.perm.perm_inv_on_of_perm_on_finite Equiv.Perm.perm_inv_on_of_perm_on_finite abbrev subtypePermOfFintype (f : Perm α) {p : α → Prop} [Finite { x // p x }] (h : ∀ x, p x → p (f x)) : Perm { x // p x } := f.subtypePerm fun x => ⟨h x, fun h₂ => f.inv_apply_self x ▸ perm_inv_on_of_perm_on_finite h h₂⟩ #align equiv.perm.subtype_perm_of_fintype Equiv.Perm.subtypePermOfFintype @[simp] theorem subtypePermOfFintype_apply (f : Perm α) {p : α → Prop} [Finite { x // p x }] (h : ∀ x, p x → p (f x)) (x : { x // p x }) : subtypePermOfFintype f h x = ⟨f x, h x x.2⟩ := rfl #align equiv.perm.subtype_perm_of_fintype_apply Equiv.Perm.subtypePermOfFintype_apply theorem subtypePermOfFintype_one (p : α → Prop) [Finite { x // p x }] (h : ∀ x, p x → p ((1 : Perm α) x)) : @subtypePermOfFintype α 1 p _ h = 1 := rfl #align equiv.perm.subtype_perm_of_fintype_one Equiv.Perm.subtypePermOfFintype_one theorem perm_mapsTo_inl_iff_mapsTo_inr {m n : Type*} [Finite m] [Finite n] (σ : Perm (Sum m n)) : Set.MapsTo σ (Set.range Sum.inl) (Set.range Sum.inl) ↔ Set.MapsTo σ (Set.range Sum.inr) (Set.range Sum.inr) := by constructor <;> ( intro h classical rw [← perm_inv_mapsTo_iff_mapsTo] at h intro x cases' hx : σ x with l r) · rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨l, rfl⟩ rw [← hx, σ.inv_apply_self] at hy exact absurd hy Sum.inl_ne_inr · rintro _; exact ⟨r, rfl⟩ · rintro _; exact ⟨l, rfl⟩ · rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨r, rfl⟩ rw [← hx, σ.inv_apply_self] at hy exact absurd hy Sum.inr_ne_inl #align equiv.perm.perm_maps_to_inl_iff_maps_to_inr Equiv.Perm.perm_mapsTo_inl_iff_mapsTo_inr
Mathlib/GroupTheory/Perm/Finite.lean
132
163
theorem mem_sumCongrHom_range_of_perm_mapsTo_inl {m n : Type*} [Finite m] [Finite n] {σ : Perm (Sum m n)} (h : Set.MapsTo σ (Set.range Sum.inl) (Set.range Sum.inl)) : σ ∈ (sumCongrHom m n).range := by
classical have h1 : ∀ x : Sum m n, (∃ a : m, Sum.inl a = x) → ∃ a : m, Sum.inl a = σ x := by rintro x ⟨a, ha⟩ apply h rw [← ha] exact ⟨a, rfl⟩ have h3 : ∀ x : Sum m n, (∃ b : n, Sum.inr b = x) → ∃ b : n, Sum.inr b = σ x := by rintro x ⟨b, hb⟩ apply (perm_mapsTo_inl_iff_mapsTo_inr σ).mp h rw [← hb] exact ⟨b, rfl⟩ let σ₁' := subtypePermOfFintype σ h1 let σ₂' := subtypePermOfFintype σ h3 let σ₁ := permCongr (Equiv.ofInjective _ Sum.inl_injective).symm σ₁' let σ₂ := permCongr (Equiv.ofInjective _ Sum.inr_injective).symm σ₂' rw [MonoidHom.mem_range, Prod.exists] use σ₁, σ₂ rw [Perm.sumCongrHom_apply] ext x cases' x with a b · rw [Equiv.sumCongr_apply, Sum.map_inl, permCongr_apply, Equiv.symm_symm, apply_ofInjective_symm Sum.inl_injective] rw [ofInjective_apply, Subtype.coe_mk, Subtype.coe_mk] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [subtypePerm_apply] · rw [Equiv.sumCongr_apply, Sum.map_inr, permCongr_apply, Equiv.symm_symm, apply_ofInjective_symm Sum.inr_injective] erw [subtypePerm_apply] rw [ofInjective_apply, Subtype.coe_mk, Subtype.coe_mk]
29
3,931,334,297,144.042
2
2
5
2,072
import Mathlib.Topology.CompactOpen import Mathlib.Topology.Sets.Closeds open Function Set Filter TopologicalSpace open scoped Topology variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [CompactSpace Y]
Mathlib/Topology/ClopenBox.lean
36
44
theorem TopologicalSpace.Clopens.exists_prod_subset (W : Clopens (X × Y)) {a : X × Y} (h : a ∈ W) : ∃ U : Clopens X, a.1 ∈ U ∧ ∃ V : Clopens Y, a.2 ∈ V ∧ U ×ˢ V ≤ W := by
have hp : Continuous (fun y : Y ↦ (a.1, y)) := Continuous.Prod.mk _ let V : Set Y := {y | (a.1, y) ∈ W} have hV : IsCompact V := (W.2.1.preimage hp).isCompact let U : Set X := {x | MapsTo (Prod.mk x) V W} have hUV : U ×ˢ V ⊆ W := fun ⟨_, _⟩ hw ↦ hw.1 hw.2 exact ⟨⟨U, (ContinuousMap.isClopen_setOf_mapsTo hV W.2).preimage (ContinuousMap.id (X × Y)).curry.2⟩, by simp [U, V, MapsTo], ⟨V, W.2.preimage hp⟩, h, hUV⟩
7
1,096.633158
2
2
2
2,073
import Mathlib.Topology.CompactOpen import Mathlib.Topology.Sets.Closeds open Function Set Filter TopologicalSpace open scoped Topology variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [CompactSpace Y] theorem TopologicalSpace.Clopens.exists_prod_subset (W : Clopens (X × Y)) {a : X × Y} (h : a ∈ W) : ∃ U : Clopens X, a.1 ∈ U ∧ ∃ V : Clopens Y, a.2 ∈ V ∧ U ×ˢ V ≤ W := by have hp : Continuous (fun y : Y ↦ (a.1, y)) := Continuous.Prod.mk _ let V : Set Y := {y | (a.1, y) ∈ W} have hV : IsCompact V := (W.2.1.preimage hp).isCompact let U : Set X := {x | MapsTo (Prod.mk x) V W} have hUV : U ×ˢ V ⊆ W := fun ⟨_, _⟩ hw ↦ hw.1 hw.2 exact ⟨⟨U, (ContinuousMap.isClopen_setOf_mapsTo hV W.2).preimage (ContinuousMap.id (X × Y)).curry.2⟩, by simp [U, V, MapsTo], ⟨V, W.2.preimage hp⟩, h, hUV⟩ variable [CompactSpace X]
Mathlib/Topology/ClopenBox.lean
50
61
theorem TopologicalSpace.Clopens.exists_finset_eq_sup_prod (W : Clopens (X × Y)) : ∃ (I : Finset (Clopens X × Clopens Y)), W = I.sup fun i ↦ i.1 ×ˢ i.2 := by
choose! U hxU V hxV hUV using fun x ↦ W.exists_prod_subset (a := x) rcases W.2.1.isCompact.elim_nhds_subcover (fun x ↦ U x ×ˢ V x) (fun x hx ↦ (U x ×ˢ V x).2.isOpen.mem_nhds ⟨hxU x hx, hxV x hx⟩) with ⟨I, hIW, hWI⟩ classical use I.image fun x ↦ (U x, V x) rw [Finset.sup_image] refine le_antisymm (fun x hx ↦ ?_) (Finset.sup_le fun x hx ↦ ?_) · rcases Set.mem_iUnion₂.1 (hWI hx) with ⟨i, hi, hxi⟩ exact SetLike.le_def.1 (Finset.le_sup hi) hxi · exact hUV _ <| hIW _ hx
10
22,026.465795
2
2
2
2,073
import Mathlib.Computability.Encoding import Mathlib.Logic.Small.List import Mathlib.ModelTheory.Syntax import Mathlib.SetTheory.Cardinal.Ordinal #align_import model_theory.encoding from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} open FirstOrder Cardinal open Computability List Structure Cardinal Fin namespace Term def listEncode : L.Term α → List (Sum α (Σi, L.Functions i)) | var i => [Sum.inl i] | func f ts => Sum.inr (⟨_, f⟩ : Σi, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode #align first_order.language.term.list_encode FirstOrder.Language.Term.listEncode def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.Term α)) | [] => [] | Sum.inl a::l => some (var a)::listDecode l | Sum.inr ⟨n, f⟩::l => if h : ∀ i : Fin n, ((listDecode l).get? i).join.isSome then (func f fun i => Option.get _ (h i))::(listDecode l).drop n else [none] #align first_order.language.term.list_decode FirstOrder.Language.Term.listDecode
Mathlib/ModelTheory/Encoding.lean
67
98
theorem listDecode_encode_list (l : List (L.Term α)) : listDecode (l.bind listEncode) = l.map Option.some := by
suffices h : ∀ (t : L.Term α) (l : List (Sum α (Σi, L.Functions i))), listDecode (t.listEncode ++ l) = some t::listDecode l by induction' l with t l lih · rfl · rw [cons_bind, h t (l.bind listEncode), lih, List.map] intro t induction' t with a n f ts ih <;> intro l · rw [listEncode, singleton_append, listDecode] · rw [listEncode, cons_append, listDecode] have h : listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l) = (finRange n).map (Option.some ∘ ts) ++ listDecode l := by induction' finRange n with i l' l'ih · rfl · rw [cons_bind, List.append_assoc, ih, map_cons, l'ih, cons_append, Function.comp] have h' : ∀ i : Fin n, (listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l)).get? ↑i = some (some (ts i)) := by intro i rw [h, get?_append, get?_map] · simp only [Option.map_eq_some', Function.comp_apply, get?_eq_some] refine ⟨i, ⟨lt_of_lt_of_le i.2 (ge_of_eq (length_finRange _)), ?_⟩, rfl⟩ rw [get_finRange, Fin.eta] · refine lt_of_lt_of_le i.2 ?_ simp refine (dif_pos fun i => Option.isSome_iff_exists.2 ⟨ts i, ?_⟩).trans ?_ · rw [Option.join_eq_some, h'] refine congr (congr rfl (congr rfl (congr rfl (funext fun i => Option.get_of_mem _ ?_)))) ?_ · simp [h'] · rw [h, drop_left'] rw [length_map, length_finRange]
30
10,686,474,581,524.463
2
2
3
2,074
import Mathlib.Computability.Encoding import Mathlib.Logic.Small.List import Mathlib.ModelTheory.Syntax import Mathlib.SetTheory.Cardinal.Ordinal #align_import model_theory.encoding from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} open FirstOrder Cardinal open Computability List Structure Cardinal Fin namespace Term def listEncode : L.Term α → List (Sum α (Σi, L.Functions i)) | var i => [Sum.inl i] | func f ts => Sum.inr (⟨_, f⟩ : Σi, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode #align first_order.language.term.list_encode FirstOrder.Language.Term.listEncode def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.Term α)) | [] => [] | Sum.inl a::l => some (var a)::listDecode l | Sum.inr ⟨n, f⟩::l => if h : ∀ i : Fin n, ((listDecode l).get? i).join.isSome then (func f fun i => Option.get _ (h i))::(listDecode l).drop n else [none] #align first_order.language.term.list_decode FirstOrder.Language.Term.listDecode theorem listDecode_encode_list (l : List (L.Term α)) : listDecode (l.bind listEncode) = l.map Option.some := by suffices h : ∀ (t : L.Term α) (l : List (Sum α (Σi, L.Functions i))), listDecode (t.listEncode ++ l) = some t::listDecode l by induction' l with t l lih · rfl · rw [cons_bind, h t (l.bind listEncode), lih, List.map] intro t induction' t with a n f ts ih <;> intro l · rw [listEncode, singleton_append, listDecode] · rw [listEncode, cons_append, listDecode] have h : listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l) = (finRange n).map (Option.some ∘ ts) ++ listDecode l := by induction' finRange n with i l' l'ih · rfl · rw [cons_bind, List.append_assoc, ih, map_cons, l'ih, cons_append, Function.comp] have h' : ∀ i : Fin n, (listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l)).get? ↑i = some (some (ts i)) := by intro i rw [h, get?_append, get?_map] · simp only [Option.map_eq_some', Function.comp_apply, get?_eq_some] refine ⟨i, ⟨lt_of_lt_of_le i.2 (ge_of_eq (length_finRange _)), ?_⟩, rfl⟩ rw [get_finRange, Fin.eta] · refine lt_of_lt_of_le i.2 ?_ simp refine (dif_pos fun i => Option.isSome_iff_exists.2 ⟨ts i, ?_⟩).trans ?_ · rw [Option.join_eq_some, h'] refine congr (congr rfl (congr rfl (congr rfl (funext fun i => Option.get_of_mem _ ?_)))) ?_ · simp [h'] · rw [h, drop_left'] rw [length_map, length_finRange] #align first_order.language.term.list_decode_encode_list FirstOrder.Language.Term.listDecode_encode_list @[simps] protected def encoding : Encoding (L.Term α) where Γ := Sum α (Σi, L.Functions i) encode := listEncode decode l := (listDecode l).head?.join decode_encode t := by have h := listDecode_encode_list [t] rw [bind_singleton] at h simp only [h, Option.join, head?, List.map, Option.some_bind, id] #align first_order.language.term.encoding FirstOrder.Language.Term.encoding theorem listEncode_injective : Function.Injective (listEncode : L.Term α → List (Sum α (Σi, L.Functions i))) := Term.encoding.encode_injective #align first_order.language.term.list_encode_injective FirstOrder.Language.Term.listEncode_injective theorem card_le : #(L.Term α) ≤ max ℵ₀ #(Sum α (Σi, L.Functions i)) := lift_le.1 (_root_.trans Term.encoding.card_le_card_list (lift_le.2 (mk_list_le_max _))) #align first_order.language.term.card_le FirstOrder.Language.Term.card_le
Mathlib/ModelTheory/Encoding.lean
122
151
theorem card_sigma : #(Σn, L.Term (Sum α (Fin n))) = max ℵ₀ #(Sum α (Σi, L.Functions i)) := by
refine le_antisymm ?_ ?_ · rw [mk_sigma] refine (sum_le_iSup_lift _).trans ?_ rw [mk_nat, lift_aleph0, mul_eq_max_of_aleph0_le_left le_rfl, max_le_iff, ciSup_le_iff' (bddAbove_range _)] · refine ⟨le_max_left _ _, fun i => card_le.trans ?_⟩ refine max_le (le_max_left _ _) ?_ rw [← add_eq_max le_rfl, mk_sum, mk_sum, mk_sum, add_comm (Cardinal.lift #α), lift_add, add_assoc, lift_lift, lift_lift, mk_fin, lift_natCast] exact add_le_add_right (nat_lt_aleph0 _).le _ · rw [← one_le_iff_ne_zero] refine _root_.trans ?_ (le_ciSup (bddAbove_range _) 1) rw [one_le_iff_ne_zero, mk_ne_zero_iff] exact ⟨var (Sum.inr 0)⟩ · rw [max_le_iff, ← infinite_iff] refine ⟨Infinite.of_injective (fun i => ⟨i + 1, var (Sum.inr i)⟩) fun i j ij => ?_, ?_⟩ · cases ij rfl · rw [Cardinal.le_def] refine ⟨⟨Sum.elim (fun i => ⟨0, var (Sum.inl i)⟩) fun F => ⟨1, func F.2 fun _ => var (Sum.inr 0)⟩, ?_⟩⟩ rintro (a | a) (b | b) h · simp only [Sum.elim_inl, Sigma.mk.inj_iff, heq_eq_eq, var.injEq, Sum.inl.injEq, true_and] at h rw [h] · simp only [Sum.elim_inl, Sum.elim_inr, Sigma.mk.inj_iff, false_and] at h · simp only [Sum.elim_inr, Sum.elim_inl, Sigma.mk.inj_iff, false_and] at h · simp only [Sum.elim_inr, Sigma.mk.inj_iff, heq_eq_eq, func.injEq, true_and] at h rw [Sigma.ext_iff.2 ⟨h.1, h.2.1⟩]
29
3,931,334,297,144.042
2
2
3
2,074
import Mathlib.Computability.Encoding import Mathlib.Logic.Small.List import Mathlib.ModelTheory.Syntax import Mathlib.SetTheory.Cardinal.Ordinal #align_import model_theory.encoding from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} open FirstOrder Cardinal open Computability List Structure Cardinal Fin namespace BoundedFormula def listEncode : ∀ {n : ℕ}, L.BoundedFormula α n → List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)) | n, falsum => [Sum.inr (Sum.inr (n + 2))] | _, equal t₁ t₂ => [Sum.inl ⟨_, t₁⟩, Sum.inl ⟨_, t₂⟩] | n, rel R ts => [Sum.inr (Sum.inl ⟨_, R⟩), Sum.inr (Sum.inr n)] ++ (List.finRange _).map fun i => Sum.inl ⟨n, ts i⟩ | _, imp φ₁ φ₂ => (Sum.inr (Sum.inr 0)::φ₁.listEncode) ++ φ₂.listEncode | _, all φ => Sum.inr (Sum.inr 1)::φ.listEncode #align first_order.language.bounded_formula.list_encode FirstOrder.Language.BoundedFormula.listEncode def sigmaAll : (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n | ⟨n + 1, φ⟩ => ⟨n, φ.all⟩ | _ => default #align first_order.language.bounded_formula.sigma_all FirstOrder.Language.BoundedFormula.sigmaAll def sigmaImp : (Σn, L.BoundedFormula α n) → (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n | ⟨m, φ⟩, ⟨n, ψ⟩ => if h : m = n then ⟨m, φ.imp (Eq.mp (by rw [h]) ψ)⟩ else default #align first_order.language.bounded_formula.sigma_imp FirstOrder.Language.BoundedFormula.sigmaImp @[simp] def listDecode : ∀ l : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)), (Σn, L.BoundedFormula α n) × { l' : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)) // SizeOf.sizeOf l' ≤ max 1 (SizeOf.sizeOf l) } | Sum.inr (Sum.inr (n + 2))::l => ⟨⟨n, falsum⟩, l, le_max_of_le_right le_add_self⟩ | Sum.inl ⟨n₁, t₁⟩::Sum.inl ⟨n₂, t₂⟩::l => ⟨if h : n₁ = n₂ then ⟨n₁, equal t₁ (Eq.mp (by rw [h]) t₂)⟩ else default, l, by simp only [SizeOf.sizeOf, List._sizeOf_1, ← add_assoc] exact le_max_of_le_right le_add_self⟩ | Sum.inr (Sum.inl ⟨n, R⟩)::Sum.inr (Sum.inr k)::l => ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft?).get? i).join.isSome then if h' : ∀ i, (Option.get _ (h i)).1 = k then ⟨k, BoundedFormula.rel R fun i => Eq.mp (by rw [h' i]) (Option.get _ (h i)).2⟩ else default else default, l.drop n, le_max_of_le_right (le_add_left (le_add_left (List.drop_sizeOf_le _ _)))⟩ | Sum.inr (Sum.inr 0)::l => have : SizeOf.sizeOf (↑(listDecode l).2 : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ))) < 1 + (1 + 1) + SizeOf.sizeOf l := by refine lt_of_le_of_lt (listDecode l).2.2 (max_lt ?_ (Nat.lt_add_of_pos_left (by decide))) rw [add_assoc, lt_add_iff_pos_right, add_pos_iff] exact Or.inl zero_lt_two ⟨sigmaImp (listDecode l).1 (listDecode (listDecode l).2).1, (listDecode (listDecode l).2).2, le_max_of_le_right (_root_.trans (listDecode _).2.2 (max_le (le_add_right le_self_add) (_root_.trans (listDecode _).2.2 (max_le (le_add_right le_self_add) le_add_self))))⟩ | Sum.inr (Sum.inr 1)::l => ⟨sigmaAll (listDecode l).1, (listDecode l).2, (listDecode l).2.2.trans (max_le_max le_rfl le_add_self)⟩ | _ => ⟨default, [], le_max_left _ _⟩ #align first_order.language.bounded_formula.list_decode FirstOrder.Language.BoundedFormula.listDecode @[simp]
Mathlib/ModelTheory/Encoding.lean
235
287
theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) : (listDecode (l.bind fun φ => φ.2.listEncode)).1 = l.headI := by
suffices h : ∀ (φ : Σn, L.BoundedFormula α n) (l), (listDecode (listEncode φ.2 ++ l)).1 = φ ∧ (listDecode (listEncode φ.2 ++ l)).2.1 = l by induction' l with φ l _ · rw [List.nil_bind] simp [listDecode] · rw [cons_bind, (h φ _).1, headI_cons] rintro ⟨n, φ⟩ induction' φ with _ _ _ _ φ_n φ_l φ_R ts _ _ _ ih1 ih2 _ _ ih <;> intro l · rw [listEncode, singleton_append, listDecode] simp only [eq_self_iff_true, heq_iff_eq, and_self_iff] · rw [listEncode, cons_append, cons_append, listDecode, dif_pos] · simp only [eq_mp_eq_cast, cast_eq, eq_self_iff_true, heq_iff_eq, and_self_iff, nil_append] · simp only [eq_self_iff_true, heq_iff_eq, and_self_iff] · rw [listEncode, cons_append, cons_append, singleton_append, cons_append, listDecode] have h : ∀ i : Fin φ_l, ((List.map Sum.getLeft? (List.map (fun i : Fin φ_l => Sum.inl (⟨(⟨φ_n, rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ : Σn, L.Term (Sum α (Fin n)))) (finRange φ_l) ++ l)).get? ↑i).join = some ⟨_, ts i⟩ := by intro i simp only [Option.join, map_append, map_map, Option.bind_eq_some, id, exists_eq_right, get?_eq_some, length_append, length_map, length_finRange] refine ⟨lt_of_lt_of_le i.2 le_self_add, ?_⟩ rw [get_append, get_map] · simp only [Sum.getLeft?, get_finRange, Fin.eta, Function.comp_apply, eq_self_iff_true, heq_iff_eq, and_self_iff] · simp only [length_map, length_finRange, is_lt] rw [dif_pos] swap · exact fun i => Option.isSome_iff_exists.2 ⟨⟨_, ts i⟩, h i⟩ rw [dif_pos] swap · intro i obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i) rw [h2] simp only [Sigma.mk.inj_iff, heq_eq_eq, rel.injEq, true_and] refine ⟨funext fun i => ?_, ?_⟩ · obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i) rw [eq_mp_eq_cast, cast_eq_iff_heq] exact (Sigma.ext_iff.1 ((Sigma.eta (Option.get _ h1)).trans h2)).2 rw [List.drop_append_eq_append_drop, length_map, length_finRange, Nat.sub_self, drop, drop_eq_nil_of_le, nil_append] rw [length_map, length_finRange] · rw [listEncode, List.append_assoc, cons_append, listDecode] simp only [] at * rw [(ih1 _).1, (ih1 _).2, (ih2 _).1, (ih2 _).2, sigmaImp] simp only [dite_true] exact ⟨rfl, trivial⟩ · rw [listEncode, cons_append, listDecode] simp only simp only [] at * rw [(ih _).1, (ih _).2, sigmaAll] exact ⟨rfl, rfl⟩
51
14,093,490,824,269,389,000,000
2
2
3
2,074
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Order.Archimedean import Mathlib.Algebra.Order.CauSeq.Basic #align_import data.real.cau_seq from "leanprover-community/mathlib"@"9116dd6709f303dcf781632e15fdef382b0fc579" open Finset IsAbsoluteValue namespace IsCauSeq variable {α β : Type*} [LinearOrderedField α] [Ring β] {abv : β → α} [IsAbsoluteValue abv] {f g : ℕ → β} {a : ℕ → α} lemma of_abv_le (n : ℕ) (hm : ∀ m, n ≤ m → abv (f m) ≤ a m) : IsCauSeq abs (fun n ↦ ∑ i ∈ range n, a i) → IsCauSeq abv fun n ↦ ∑ i ∈ range n, f i := by intro hg ε ε0 cases' hg (ε / 2) (div_pos ε0 (by norm_num)) with i hi exists max n i intro j ji have hi₁ := hi j (le_trans (le_max_right n i) ji) have hi₂ := hi (max n i) (le_max_right n i) have sub_le := abs_sub_le (∑ k ∈ range j, a k) (∑ k ∈ range i, a k) (∑ k ∈ range (max n i), a k) have := add_lt_add hi₁ hi₂ rw [abs_sub_comm (∑ k ∈ range (max n i), a k), add_halves ε] at this refine lt_of_le_of_lt (le_trans (le_trans ?_ (le_abs_self _)) sub_le) this generalize hk : j - max n i = k clear this hi₂ hi₁ hi ε0 ε hg sub_le rw [tsub_eq_iff_eq_add_of_le ji] at hk rw [hk] dsimp only clear hk ji j induction' k with k' hi · simp [abv_zero abv] simp only [Nat.succ_add, Nat.succ_eq_add_one, Finset.sum_range_succ_comm] simp only [add_assoc, sub_eq_add_neg] refine le_trans (abv_add _ _ _) ?_ simp only [sub_eq_add_neg] at hi exact add_le_add (hm _ (le_add_of_nonneg_of_le (Nat.zero_le _) (le_max_left _ _))) hi #align is_cau_series_of_abv_le_cau IsCauSeq.of_abv_le lemma of_abv (hf : IsCauSeq abs fun m ↦ ∑ n ∈ range m, abv (f n)) : IsCauSeq abv fun m ↦ ∑ n ∈ range m, f n := hf.of_abv_le 0 fun _ _ ↦ le_rfl #align is_cau_series_of_abv_cau IsCauSeq.of_abv
Mathlib/Algebra/Order/CauSeq/BigOperators.lean
57
141
theorem _root_.cauchy_product (ha : IsCauSeq abs fun m ↦ ∑ n ∈ range m, abv (f n)) (hb : IsCauSeq abv fun m ↦ ∑ n ∈ range m, g n) (ε : α) (ε0 : 0 < ε) : ∃ i : ℕ, ∀ j ≥ i, abv ((∑ k ∈ range j, f k) * ∑ k ∈ range j, g k - ∑ n ∈ range j, ∑ m ∈ range (n + 1), f m * g (n - m)) < ε := by
let ⟨P, hP⟩ := ha.bounded let ⟨Q, hQ⟩ := hb.bounded have hP0 : 0 < P := lt_of_le_of_lt (abs_nonneg _) (hP 0) have hPε0 : 0 < ε / (2 * P) := div_pos ε0 (mul_pos (show (2 : α) > 0 by norm_num) hP0) let ⟨N, hN⟩ := hb.cauchy₂ hPε0 have hQε0 : 0 < ε / (4 * Q) := div_pos ε0 (mul_pos (show (0 : α) < 4 by norm_num) (lt_of_le_of_lt (abv_nonneg _ _) (hQ 0))) let ⟨M, hM⟩ := ha.cauchy₂ hQε0 refine ⟨2 * (max N M + 1), fun K hK ↦ ?_⟩ have h₁ : (∑ m ∈ range K, ∑ k ∈ range (m + 1), f k * g (m - k)) = ∑ m ∈ range K, ∑ n ∈ range (K - m), f m * g n := by simpa using sum_range_diag_flip K fun m n ↦ f m * g n have h₂ : (fun i ↦ ∑ k ∈ range (K - i), f i * g k) = fun i ↦ f i * ∑ k ∈ range (K - i), g k := by simp [Finset.mul_sum] have h₃ : ∑ i ∈ range K, f i * ∑ k ∈ range (K - i), g k = ∑ i ∈ range K, f i * (∑ k ∈ range (K - i), g k - ∑ k ∈ range K, g k) + ∑ i ∈ range K, f i * ∑ k ∈ range K, g k := by rw [← sum_add_distrib]; simp [(mul_add _ _ _).symm] have two_mul_two : (4 : α) = 2 * 2 := by norm_num have hQ0 : Q ≠ 0 := fun h ↦ by simp [h, lt_irrefl] at hQε0 have h2Q0 : 2 * Q ≠ 0 := mul_ne_zero two_ne_zero hQ0 have hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε := by rw [← div_div, div_mul_cancel₀ _ (Ne.symm (ne_of_lt hP0)), two_mul_two, mul_assoc, ← div_div, div_mul_cancel₀ _ h2Q0, add_halves] have hNMK : max N M + 1 < K := lt_of_lt_of_le (by rw [two_mul]; exact lt_add_of_pos_left _ (Nat.succ_pos _)) hK have hKN : N < K := calc N ≤ max N M := le_max_left _ _ _ < max N M + 1 := Nat.lt_succ_self _ _ < K := hNMK have hsumlesum : (∑ i ∈ range (max N M + 1), abv (f i) * abv ((∑ k ∈ range (K - i), g k) - ∑ k ∈ range K, g k)) ≤ ∑ i ∈ range (max N M + 1), abv (f i) * (ε / (2 * P)) := by gcongr with m hmJ refine le_of_lt $ hN (K - m) (le_tsub_of_add_le_left $ hK.trans' ?_) K hKN.le rw [two_mul] gcongr · exact (mem_range.1 hmJ).le · exact Nat.le_succ_of_le (le_max_left _ _) have hsumltP : (∑ n ∈ range (max N M + 1), abv (f n)) < P := calc (∑ n ∈ range (max N M + 1), abv (f n)) = |∑ n ∈ range (max N M + 1), abv (f n)| := Eq.symm (abs_of_nonneg (sum_nonneg fun x _ ↦ abv_nonneg abv (f x))) _ < P := hP (max N M + 1) rw [h₁, h₂, h₃, sum_mul, ← sub_sub, sub_right_comm, sub_self, zero_sub, abv_neg abv] refine lt_of_le_of_lt (IsAbsoluteValue.abv_sum _ _ _) ?_ suffices (∑ i ∈ range (max N M + 1), abv (f i) * abv ((∑ k ∈ range (K - i), g k) - ∑ k ∈ range K, g k)) + ((∑ i ∈ range K, abv (f i) * abv ((∑ k ∈ range (K - i), g k) - ∑ k ∈ range K, g k)) - ∑ i ∈ range (max N M + 1), abv (f i) * abv ((∑ k ∈ range (K - i), g k) - ∑ k ∈ range K, g k)) < ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) by rw [hε] at this simpa [abv_mul abv] using this gcongr · exact lt_of_le_of_lt hsumlesum (by rw [← sum_mul, mul_comm]; gcongr) rw [sum_range_sub_sum_range (le_of_lt hNMK)] calc (∑ i ∈ (range K).filter fun k ↦ max N M + 1 ≤ k, abv (f i) * abv ((∑ k ∈ range (K - i), g k) - ∑ k ∈ range K, g k)) ≤ ∑ i ∈ (range K).filter fun k ↦ max N M + 1 ≤ k, abv (f i) * (2 * Q) := by gcongr rw [sub_eq_add_neg] refine le_trans (abv_add _ _ _) ?_ rw [two_mul, abv_neg abv] gcongr <;> exact le_of_lt (hQ _) _ < ε / (4 * Q) * (2 * Q) := by rw [← sum_mul, ← sum_range_sub_sum_range (le_of_lt hNMK)] have := lt_of_le_of_lt (abv_nonneg _ _) (hQ 0) gcongr exact (le_abs_self _).trans_lt $ hM _ ((Nat.le_succ_of_le (le_max_right _ _)).trans hNMK.le) _ $ Nat.le_succ_of_le $ le_max_right _ _
79
20,382,810,665,126,688,000,000,000,000,000,000
2
2
1
2,075
import Mathlib.Data.Real.Irrational import Mathlib.Data.Rat.Encodable import Mathlib.Topology.GDelta #align_import topology.instances.irrational from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Filter Metric open Filter Topology protected theorem IsGδ.setOf_irrational : IsGδ { x | Irrational x } := (countable_range _).isGδ_compl set_option linter.uppercaseLean3 false in #align is_Gδ_irrational IsGδ.setOf_irrational @[deprecated (since := "2024-02-15")] alias isGδ_irrational := IsGδ.setOf_irrational
Mathlib/Topology/Instances/Irrational.lean
45
51
theorem dense_irrational : Dense { x : ℝ | Irrational x } := by
refine Real.isTopologicalBasis_Ioo_rat.dense_iff.2 ?_ simp only [gt_iff_lt, Rat.cast_lt, not_lt, ge_iff_le, Rat.cast_le, mem_iUnion, mem_singleton_iff, exists_prop, forall_exists_index, and_imp] rintro _ a b hlt rfl _ rw [inter_comm] exact exists_irrational_btwn (Rat.cast_lt.2 hlt)
6
403.428793
2
2
2
2,076
import Mathlib.Data.Real.Irrational import Mathlib.Data.Rat.Encodable import Mathlib.Topology.GDelta #align_import topology.instances.irrational from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Filter Metric open Filter Topology protected theorem IsGδ.setOf_irrational : IsGδ { x | Irrational x } := (countable_range _).isGδ_compl set_option linter.uppercaseLean3 false in #align is_Gδ_irrational IsGδ.setOf_irrational @[deprecated (since := "2024-02-15")] alias isGδ_irrational := IsGδ.setOf_irrational theorem dense_irrational : Dense { x : ℝ | Irrational x } := by refine Real.isTopologicalBasis_Ioo_rat.dense_iff.2 ?_ simp only [gt_iff_lt, Rat.cast_lt, not_lt, ge_iff_le, Rat.cast_le, mem_iUnion, mem_singleton_iff, exists_prop, forall_exists_index, and_imp] rintro _ a b hlt rfl _ rw [inter_comm] exact exists_irrational_btwn (Rat.cast_lt.2 hlt) #align dense_irrational dense_irrational theorem eventually_residual_irrational : ∀ᶠ x in residual ℝ, Irrational x := residual_of_dense_Gδ .setOf_irrational dense_irrational #align eventually_residual_irrational eventually_residual_irrational namespace Irrational variable {x : ℝ} instance : OrderTopology { x // Irrational x } := induced_orderTopology _ Iff.rfl <| @fun _ _ hlt => let ⟨z, hz, hxz, hzy⟩ := exists_irrational_btwn hlt ⟨⟨z, hz⟩, hxz, hzy⟩ instance : NoMaxOrder { x // Irrational x } := ⟨fun ⟨x, hx⟩ => ⟨⟨x + (1 : ℕ), hx.add_nat 1⟩, by simp⟩⟩ instance : NoMinOrder { x // Irrational x } := ⟨fun ⟨x, hx⟩ => ⟨⟨x - (1 : ℕ), hx.sub_nat 1⟩, by simp⟩⟩ instance : DenselyOrdered { x // Irrational x } := ⟨fun _ _ hlt => let ⟨z, hz, hxz, hzy⟩ := exists_irrational_btwn hlt ⟨⟨z, hz⟩, hxz, hzy⟩⟩
Mathlib/Topology/Instances/Irrational.lean
78
89
theorem eventually_forall_le_dist_cast_div (hx : Irrational x) (n : ℕ) : ∀ᶠ ε : ℝ in 𝓝 0, ∀ m : ℤ, ε ≤ dist x (m / n) := by
have A : IsClosed (range (fun m => (n : ℝ)⁻¹ * m : ℤ → ℝ)) := ((isClosedMap_smul₀ (n⁻¹ : ℝ)).comp Int.closedEmbedding_coe_real.isClosedMap).isClosed_range have B : x ∉ range (fun m => (n : ℝ)⁻¹ * m : ℤ → ℝ) := by rintro ⟨m, rfl⟩ simp at hx rcases Metric.mem_nhds_iff.1 (A.isOpen_compl.mem_nhds B) with ⟨ε, ε0, hε⟩ refine (ge_mem_nhds ε0).mono fun δ hδ m => not_lt.1 fun hlt => ?_ rw [dist_comm] at hlt refine hε (ball_subset_ball hδ hlt) ⟨m, ?_⟩ simp [div_eq_inv_mul]
10
22,026.465795
2
2
2
2,076
import Mathlib.Analysis.NormedSpace.Real import Mathlib.Analysis.Seminorm import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed_space.riesz_lemma from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Metric open Topology variable {𝕜 : Type*} [NormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [SeminormedAddCommGroup F] [NormedSpace ℝ F]
Mathlib/Analysis/NormedSpace/RieszLemma.lean
41
70
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ} (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
classical obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF let d := Metric.infDist x F have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩ have hdp : 0 < d := lt_of_le_of_ne Metric.infDist_nonneg fun heq => hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm) let r' := max r 2⁻¹ have hr' : r' < 1 := by simp only [r', ge_iff_le, max_lt_iff, hr, true_and] norm_num have hlt : 0 < r' := lt_of_lt_of_le (by norm_num) (le_max_right r 2⁻¹) have hdlt : d < d / r' := (lt_div_iff hlt).mpr ((mul_lt_iff_lt_one_right hdp).2 hr') obtain ⟨y₀, hy₀F, hxy₀⟩ : ∃ y ∈ F, dist x y < d / r' := (Metric.infDist_lt_iff hFn).mp hdlt have x_ne_y₀ : x - y₀ ∉ F := by by_contra h have : x - y₀ + y₀ ∈ F := F.add_mem h hy₀F simp only [neg_add_cancel_right, sub_eq_add_neg] at this exact hx this refine ⟨x - y₀, x_ne_y₀, fun y hy => le_of_lt ?_⟩ have hy₀y : y₀ + y ∈ F := F.add_mem hy₀F hy calc r * ‖x - y₀‖ ≤ r' * ‖x - y₀‖ := by gcongr; apply le_max_left _ < d := by rw [← dist_eq_norm] exact (lt_div_iff' hlt).1 hxy₀ _ ≤ dist x (y₀ + y) := Metric.infDist_le_dist_of_mem hy₀y _ = ‖x - y₀ - y‖ := by rw [sub_sub, dist_eq_norm]
28
1,446,257,064,291.475
2
2
3
2,077
import Mathlib.Analysis.NormedSpace.Real import Mathlib.Analysis.Seminorm import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed_space.riesz_lemma from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Metric open Topology variable {𝕜 : Type*} [NormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [SeminormedAddCommGroup F] [NormedSpace ℝ F] theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ} (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by classical obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF let d := Metric.infDist x F have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩ have hdp : 0 < d := lt_of_le_of_ne Metric.infDist_nonneg fun heq => hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm) let r' := max r 2⁻¹ have hr' : r' < 1 := by simp only [r', ge_iff_le, max_lt_iff, hr, true_and] norm_num have hlt : 0 < r' := lt_of_lt_of_le (by norm_num) (le_max_right r 2⁻¹) have hdlt : d < d / r' := (lt_div_iff hlt).mpr ((mul_lt_iff_lt_one_right hdp).2 hr') obtain ⟨y₀, hy₀F, hxy₀⟩ : ∃ y ∈ F, dist x y < d / r' := (Metric.infDist_lt_iff hFn).mp hdlt have x_ne_y₀ : x - y₀ ∉ F := by by_contra h have : x - y₀ + y₀ ∈ F := F.add_mem h hy₀F simp only [neg_add_cancel_right, sub_eq_add_neg] at this exact hx this refine ⟨x - y₀, x_ne_y₀, fun y hy => le_of_lt ?_⟩ have hy₀y : y₀ + y ∈ F := F.add_mem hy₀F hy calc r * ‖x - y₀‖ ≤ r' * ‖x - y₀‖ := by gcongr; apply le_max_left _ < d := by rw [← dist_eq_norm] exact (lt_div_iff' hlt).1 hxy₀ _ ≤ dist x (y₀ + y) := Metric.infDist_le_dist_of_mem hy₀y _ = ‖x - y₀ - y‖ := by rw [sub_sub, dist_eq_norm] #align riesz_lemma riesz_lemma
Mathlib/Analysis/NormedSpace/RieszLemma.lean
83
105
theorem riesz_lemma_of_norm_lt {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R) {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) : ∃ x₀ : E, ‖x₀‖ ≤ R ∧ ∀ y ∈ F, 1 ≤ ‖x₀ - y‖ := by
have Rpos : 0 < R := (norm_nonneg _).trans_lt hR have : ‖c‖ / R < 1 := by rw [div_lt_iff Rpos] simpa using hR rcases riesz_lemma hFc hF this with ⟨x, xF, hx⟩ have x0 : x ≠ 0 := fun H => by simp [H] at xF obtain ⟨d, d0, dxlt, ledx, -⟩ : ∃ d : 𝕜, d ≠ 0 ∧ ‖d • x‖ < R ∧ R / ‖c‖ ≤ ‖d • x‖ ∧ ‖d‖⁻¹ ≤ R⁻¹ * ‖c‖ * ‖x‖ := rescale_to_shell hc Rpos x0 refine ⟨d • x, dxlt.le, fun y hy => ?_⟩ set y' := d⁻¹ • y have yy' : y = d • y' := by simp [y', smul_smul, mul_inv_cancel d0] calc 1 = ‖c‖ / R * (R / ‖c‖) := by field_simp [Rpos.ne', (zero_lt_one.trans hc).ne'] _ ≤ ‖c‖ / R * ‖d • x‖ := by gcongr _ = ‖d‖ * (‖c‖ / R * ‖x‖) := by simp only [norm_smul] ring _ ≤ ‖d‖ * ‖x - y'‖ := by gcongr; exact hx y' (by simp [Submodule.smul_mem _ _ hy]) _ = ‖d • x - y‖ := by rw [yy', ← smul_sub, norm_smul]
20
485,165,195.40979
2
2
3
2,077
import Mathlib.Analysis.NormedSpace.Real import Mathlib.Analysis.Seminorm import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed_space.riesz_lemma from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Metric open Topology variable {𝕜 : Type*} [NormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [SeminormedAddCommGroup F] [NormedSpace ℝ F] theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ} (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by classical obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF let d := Metric.infDist x F have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩ have hdp : 0 < d := lt_of_le_of_ne Metric.infDist_nonneg fun heq => hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm) let r' := max r 2⁻¹ have hr' : r' < 1 := by simp only [r', ge_iff_le, max_lt_iff, hr, true_and] norm_num have hlt : 0 < r' := lt_of_lt_of_le (by norm_num) (le_max_right r 2⁻¹) have hdlt : d < d / r' := (lt_div_iff hlt).mpr ((mul_lt_iff_lt_one_right hdp).2 hr') obtain ⟨y₀, hy₀F, hxy₀⟩ : ∃ y ∈ F, dist x y < d / r' := (Metric.infDist_lt_iff hFn).mp hdlt have x_ne_y₀ : x - y₀ ∉ F := by by_contra h have : x - y₀ + y₀ ∈ F := F.add_mem h hy₀F simp only [neg_add_cancel_right, sub_eq_add_neg] at this exact hx this refine ⟨x - y₀, x_ne_y₀, fun y hy => le_of_lt ?_⟩ have hy₀y : y₀ + y ∈ F := F.add_mem hy₀F hy calc r * ‖x - y₀‖ ≤ r' * ‖x - y₀‖ := by gcongr; apply le_max_left _ < d := by rw [← dist_eq_norm] exact (lt_div_iff' hlt).1 hxy₀ _ ≤ dist x (y₀ + y) := Metric.infDist_le_dist_of_mem hy₀y _ = ‖x - y₀ - y‖ := by rw [sub_sub, dist_eq_norm] #align riesz_lemma riesz_lemma theorem riesz_lemma_of_norm_lt {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R) {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) : ∃ x₀ : E, ‖x₀‖ ≤ R ∧ ∀ y ∈ F, 1 ≤ ‖x₀ - y‖ := by have Rpos : 0 < R := (norm_nonneg _).trans_lt hR have : ‖c‖ / R < 1 := by rw [div_lt_iff Rpos] simpa using hR rcases riesz_lemma hFc hF this with ⟨x, xF, hx⟩ have x0 : x ≠ 0 := fun H => by simp [H] at xF obtain ⟨d, d0, dxlt, ledx, -⟩ : ∃ d : 𝕜, d ≠ 0 ∧ ‖d • x‖ < R ∧ R / ‖c‖ ≤ ‖d • x‖ ∧ ‖d‖⁻¹ ≤ R⁻¹ * ‖c‖ * ‖x‖ := rescale_to_shell hc Rpos x0 refine ⟨d • x, dxlt.le, fun y hy => ?_⟩ set y' := d⁻¹ • y have yy' : y = d • y' := by simp [y', smul_smul, mul_inv_cancel d0] calc 1 = ‖c‖ / R * (R / ‖c‖) := by field_simp [Rpos.ne', (zero_lt_one.trans hc).ne'] _ ≤ ‖c‖ / R * ‖d • x‖ := by gcongr _ = ‖d‖ * (‖c‖ / R * ‖x‖) := by simp only [norm_smul] ring _ ≤ ‖d‖ * ‖x - y'‖ := by gcongr; exact hx y' (by simp [Submodule.smul_mem _ _ hy]) _ = ‖d • x - y‖ := by rw [yy', ← smul_sub, norm_smul] #align riesz_lemma_of_norm_lt riesz_lemma_of_norm_lt
Mathlib/Analysis/NormedSpace/RieszLemma.lean
108
114
theorem Metric.closedBall_infDist_compl_subset_closure {x : F} {s : Set F} (hx : x ∈ s) : closedBall x (infDist x sᶜ) ⊆ closure s := by
rcases eq_or_ne (infDist x sᶜ) 0 with h₀ | h₀ · rw [h₀, closedBall_zero'] exact closure_mono (singleton_subset_iff.2 hx) · rw [← closure_ball x h₀] exact closure_mono ball_infDist_compl_subset
5
148.413159
2
2
3
2,077
import Mathlib.RingTheory.WittVector.StructurePolynomial #align_import ring_theory.witt_vector.defs from "leanprover-community/mathlib"@"f1944b30c97c5eb626e498307dec8b022a05bd0a" noncomputable section structure WittVector (p : ℕ) (R : Type*) where mk' :: coeff : ℕ → R #align witt_vector WittVector -- Porting note: added to make the `p` argument explicit def WittVector.mk (p : ℕ) {R : Type*} (coeff : ℕ → R) : WittVector p R := mk' coeff variable {p : ℕ} local notation "𝕎" => WittVector p -- type as `\bbW` namespace WittVector variable {R : Type*} @[ext]
Mathlib/RingTheory/WittVector/Defs.lean
74
78
theorem ext {x y : 𝕎 R} (h : ∀ n, x.coeff n = y.coeff n) : x = y := by
cases x cases y simp only at h simp [Function.funext_iff, h]
4
54.59815
2
2
1
2,078
import Batteries.Data.Nat.Gcd import Batteries.Data.Int.DivMod import Batteries.Lean.Float -- `Rat` is not tagged with the `ext` attribute, since this is more often than not undesirable structure Rat where mk' :: num : Int den : Nat := 1 den_nz : den ≠ 0 := by decide reduced : num.natAbs.Coprime den := by decide deriving DecidableEq instance : Inhabited Rat := ⟨{ num := 0 }⟩ instance : ToString Rat where toString a := if a.den = 1 then toString a.num else s!"{a.num}/{a.den}" instance : Repr Rat where reprPrec a _ := if a.den = 1 then repr a.num else s!"({a.num} : Rat)/{a.den}" theorem Rat.den_pos (self : Rat) : 0 < self.den := Nat.pos_of_ne_zero self.den_nz -- Note: `Rat.normalize` uses `Int.div` internally, -- but we may want to refactor to use `/` (`Int.ediv`) @[inline] def Rat.maybeNormalize (num : Int) (den g : Nat) (den_nz : den / g ≠ 0) (reduced : (num.div g).natAbs.Coprime (den / g)) : Rat := if hg : g = 1 then { num, den den_nz := by simp [hg] at den_nz; exact den_nz reduced := by simp [hg, Int.natAbs_ofNat] at reduced; exact reduced } else { num := num.div g, den := den / g, den_nz, reduced } theorem Rat.normalize.den_nz {num : Int} {den g : Nat} (den_nz : den ≠ 0) (e : g = num.natAbs.gcd den) : den / g ≠ 0 := e ▸ Nat.ne_of_gt (Nat.div_gcd_pos_of_pos_right _ (Nat.pos_of_ne_zero den_nz))
.lake/packages/batteries/Batteries/Data/Rat/Basic.lean
60
66
theorem Rat.normalize.reduced {num : Int} {den g : Nat} (den_nz : den ≠ 0) (e : g = num.natAbs.gcd den) : (num.div g).natAbs.Coprime (den / g) := have : Int.natAbs (num.div ↑g) = num.natAbs / g := by
match num, num.eq_nat_or_neg with | _, ⟨_, .inl rfl⟩ => rfl | _, ⟨_, .inr rfl⟩ => rw [Int.neg_div, Int.natAbs_neg, Int.natAbs_neg]; rfl this ▸ e ▸ Nat.coprime_div_gcd_div_gcd (Nat.gcd_pos_of_pos_right _ (Nat.pos_of_ne_zero den_nz))
4
54.59815
2
2
1
2,079
import Mathlib.Dynamics.Ergodic.Ergodic import Mathlib.MeasureTheory.Function.AEEqFun open Function Set Filter MeasureTheory Topology TopologicalSpace variable {α X : Type*} [MeasurableSpace α] {μ : MeasureTheory.Measure α}
Mathlib/Dynamics/Ergodic/Function.lean
27
35
theorem QuasiErgodic.ae_eq_const_of_ae_eq_comp_of_ae_range₀ [Nonempty X] [MeasurableSpace X] {s : Set X} [MeasurableSpace.CountablySeparated s] {f : α → α} {g : α → X} (h : QuasiErgodic f μ) (hs : ∀ᵐ x ∂μ, g x ∈ s) (hgm : NullMeasurable g μ) (hg_eq : g ∘ f =ᵐ[μ] g) : ∃ c, g =ᵐ[μ] const α c := by
refine exists_eventuallyEq_const_of_eventually_mem_of_forall_separating MeasurableSet hs ?_ refine fun U hU ↦ h.ae_mem_or_ae_nmem₀ (s := g ⁻¹' U) (hgm hU) ?_b refine (hg_eq.mono fun x hx ↦ ?_).set_eq rw [← preimage_comp, mem_preimage, mem_preimage, hx]
4
54.59815
2
2
2
2,080
import Mathlib.Dynamics.Ergodic.Ergodic import Mathlib.MeasureTheory.Function.AEEqFun open Function Set Filter MeasureTheory Topology TopologicalSpace variable {α X : Type*} [MeasurableSpace α] {μ : MeasureTheory.Measure α} theorem QuasiErgodic.ae_eq_const_of_ae_eq_comp_of_ae_range₀ [Nonempty X] [MeasurableSpace X] {s : Set X} [MeasurableSpace.CountablySeparated s] {f : α → α} {g : α → X} (h : QuasiErgodic f μ) (hs : ∀ᵐ x ∂μ, g x ∈ s) (hgm : NullMeasurable g μ) (hg_eq : g ∘ f =ᵐ[μ] g) : ∃ c, g =ᵐ[μ] const α c := by refine exists_eventuallyEq_const_of_eventually_mem_of_forall_separating MeasurableSet hs ?_ refine fun U hU ↦ h.ae_mem_or_ae_nmem₀ (s := g ⁻¹' U) (hgm hU) ?_b refine (hg_eq.mono fun x hx ↦ ?_).set_eq rw [← preimage_comp, mem_preimage, mem_preimage, hx] variable [TopologicalSpace X] [MetrizableSpace X] [Nonempty X] {f : α → α} namespace QuasiErgodic
Mathlib/Dynamics/Ergodic/Function.lean
77
82
theorem ae_eq_const_of_ae_eq_comp_ae {g : α → X} (h : QuasiErgodic f μ) (hgm : AEStronglyMeasurable g μ) (hg_eq : g ∘ f =ᵐ[μ] g) : ∃ c, g =ᵐ[μ] const α c := by
borelize X rcases hgm.isSeparable_ae_range with ⟨t, ht, hgt⟩ haveI := ht.secondCountableTopology exact h.ae_eq_const_of_ae_eq_comp_of_ae_range₀ hgt hgm.aemeasurable.nullMeasurable hg_eq
4
54.59815
2
2
2
2,080
import Mathlib.Analysis.Convex.Topology import Mathlib.LinearAlgebra.Dimension.DivisionRing import Mathlib.Topology.Algebra.Module.Cardinality open Convex Set Metric section TopologicalVectorSpace variable {E : Type*} [AddCommGroup E] [Module ℝ E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul ℝ E]
Mathlib/Analysis/NormedSpace/Connected.lean
34
103
theorem Set.Countable.isPathConnected_compl_of_one_lt_rank (h : 1 < Module.rank ℝ E) {s : Set E} (hs : s.Countable) : IsPathConnected sᶜ := by
have : Nontrivial E := (rank_pos_iff_nontrivial (R := ℝ)).1 (zero_lt_one.trans h) -- the set `sᶜ` is dense, therefore nonempty. Pick `a ∈ sᶜ`. We have to show that any -- `b ∈ sᶜ` can be joined to `a`. obtain ⟨a, ha⟩ : sᶜ.Nonempty := (hs.dense_compl ℝ).nonempty refine ⟨a, ha, ?_⟩ intro b hb rcases eq_or_ne a b with rfl|hab · exact JoinedIn.refl ha /- Assume `b ≠ a`. Write `a = c - x` and `b = c + x` for some nonzero `x`. Choose `y` which is linearly independent from `x`. Then the segments joining `a = c - x` to `c + ty` are pairwise disjoint for varying `t` (except for the endpoint `a`) so only countably many of them can intersect `s`. In the same way, there are countably many `t`s for which the segment from `b = c + x` to `c + ty` intersects `s`. Choosing `t` outside of these countable exceptions, one gets a path in the complement of `s` from `a` to `z = c + ty` and then to `b`. -/ let c := (2 : ℝ)⁻¹ • (a + b) let x := (2 : ℝ)⁻¹ • (b - a) have Ia : c - x = a := by simp only [c, x, smul_add, smul_sub] abel_nf simp [zsmul_eq_smul_cast ℝ 2] have Ib : c + x = b := by simp only [c, x, smul_add, smul_sub] abel_nf simp [zsmul_eq_smul_cast ℝ 2] have x_ne_zero : x ≠ 0 := by simpa [x] using sub_ne_zero.2 hab.symm obtain ⟨y, hy⟩ : ∃ y, LinearIndependent ℝ ![x, y] := exists_linearIndependent_pair_of_one_lt_rank h x_ne_zero have A : Set.Countable {t : ℝ | ([c + x -[ℝ] c + t • y] ∩ s).Nonempty} := by apply countable_setOf_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs intro t t' htt' apply disjoint_iff_inter_eq_empty.2 have N : {c + x} ∩ s = ∅ := by simpa only [singleton_inter_eq_empty, mem_compl_iff, Ib] using hb rw [inter_assoc, inter_comm s, inter_assoc, inter_self, ← inter_assoc, ← subset_empty_iff, ← N] apply inter_subset_inter_left apply Eq.subset apply segment_inter_eq_endpoint_of_linearIndependent_of_ne hy htt'.symm have B : Set.Countable {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ s).Nonempty} := by apply countable_setOf_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs intro t t' htt' apply disjoint_iff_inter_eq_empty.2 have N : {c - x} ∩ s = ∅ := by simpa only [singleton_inter_eq_empty, mem_compl_iff, Ia] using ha rw [inter_assoc, inter_comm s, inter_assoc, inter_self, ← inter_assoc, ← subset_empty_iff, ← N] apply inter_subset_inter_left rw [sub_eq_add_neg _ x] apply Eq.subset apply segment_inter_eq_endpoint_of_linearIndependent_of_ne _ htt'.symm convert hy.units_smul ![-1, 1] simp [← List.ofFn_inj] obtain ⟨t, ht⟩ : Set.Nonempty ({t : ℝ | ([c + x -[ℝ] c + t • y] ∩ s).Nonempty} ∪ {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ s).Nonempty})ᶜ := ((A.union B).dense_compl ℝ).nonempty let z := c + t • y simp only [compl_union, mem_inter_iff, mem_compl_iff, mem_setOf_eq, not_nonempty_iff_eq_empty] at ht have JA : JoinedIn sᶜ a z := by apply JoinedIn.of_segment_subset rw [subset_compl_iff_disjoint_right, disjoint_iff_inter_eq_empty] convert ht.2 exact Ia.symm have JB : JoinedIn sᶜ b z := by apply JoinedIn.of_segment_subset rw [subset_compl_iff_disjoint_right, disjoint_iff_inter_eq_empty] convert ht.1 exact Ib.symm exact JA.trans JB.symm
67
125,236,317,084,221,370,000,000,000,000
2
2
1
2,081
import Mathlib.CategoryTheory.Limits.ColimitLimit import Mathlib.CategoryTheory.Limits.Preserves.FunctorCategory import Mathlib.CategoryTheory.Limits.Preserves.Finite import Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits import Mathlib.CategoryTheory.Limits.TypesFiltered import Mathlib.CategoryTheory.ConcreteCategory.Basic import Mathlib.CategoryTheory.Products.Bifunctor import Mathlib.Data.Countable.Small #align_import category_theory.limits.filtered_colimit_commutes_finite_limit from "leanprover-community/mathlib"@"3f409bd9df181d26dd223170da7b6830ece18442" -- Various pieces of algebra that have previously been spuriously imported here: assert_not_exists map_ne_zero assert_not_exists Field -- TODO: We should morally be able to strengthen this to `assert_not_exists GroupWithZero`, but -- finiteness currently relies on more algebra than it needs. universe w v₁ v₂ v u₁ u₂ u open CategoryTheory CategoryTheory.Category CategoryTheory.Limits.Types CategoryTheory.Limits.Types.FilteredColimit namespace CategoryTheory.Limits section variable {J : Type u₁} {K : Type u₂} [Category.{v₁} J] [Category.{v₂} K] [Small.{v} K] @[ext] lemma comp_lim_obj_ext {j : J} {G : J ⥤ K ⥤ Type v} (x y : (G ⋙ lim).obj j) (w : ∀ (k : K), limit.π (G.obj j) k x = limit.π (G.obj j) k y) : x = y := limit_ext _ x y w variable (F : J × K ⥤ Type v) open CategoryTheory.Prod variable [IsFiltered K] section variable [Finite J]
Mathlib/CategoryTheory/Limits/FilteredColimitCommutesFiniteLimit.lean
72
142
theorem colimitLimitToLimitColimit_injective : Function.Injective (colimitLimitToLimitColimit F) := by
classical cases nonempty_fintype J -- Suppose we have two terms `x y` in the colimit (over `K`) of the limits (over `J`), -- and that these have the same image under `colimitLimitToLimitColimit F`. intro x y h -- These elements of the colimit have representatives somewhere: obtain ⟨kx, x, rfl⟩ := jointly_surjective' x obtain ⟨ky, y, rfl⟩ := jointly_surjective' y dsimp at x y -- Since the images of `x` and `y` are equal in a limit, they are equal componentwise -- (indexed by `j : J`), replace h := fun j => congr_arg (limit.π (curry.obj F ⋙ colim) j) h -- and they are equations in a filtered colimit, -- so for each `j` we have some place `k j` to the right of both `kx` and `ky` simp? [colimit_eq_iff] at h says simp only [Functor.comp_obj, colim_obj, ι_colimitLimitToLimitColimit_π_apply, colimit_eq_iff, curry_obj_obj_obj, curry_obj_obj_map] at h let k j := (h j).choose let f : ∀ j, kx ⟶ k j := fun j => (h j).choose_spec.choose let g : ∀ j, ky ⟶ k j := fun j => (h j).choose_spec.choose_spec.choose -- where the images of the components of the representatives become equal: have w : ∀ j, F.map ((𝟙 j, f j) : (j, kx) ⟶ (j, k j)) (limit.π ((curry.obj (swap K J ⋙ F)).obj kx) j x) = F.map ((𝟙 j, g j) : (j, ky) ⟶ (j, k j)) (limit.π ((curry.obj (swap K J ⋙ F)).obj ky) j y) := fun j => (h j).choose_spec.choose_spec.choose_spec -- We now use that `K` is filtered, picking some point to the right of all these -- morphisms `f j` and `g j`. let O : Finset K := Finset.univ.image k ∪ {kx, ky} have kxO : kx ∈ O := Finset.mem_union.mpr (Or.inr (by simp)) have kyO : ky ∈ O := Finset.mem_union.mpr (Or.inr (by simp)) have kjO : ∀ j, k j ∈ O := fun j => Finset.mem_union.mpr (Or.inl (by simp)) let H : Finset (Σ' (X Y : K) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) := (Finset.univ.image fun j : J => ⟨kx, k j, kxO, Finset.mem_union.mpr (Or.inl (by simp)), f j⟩) ∪ Finset.univ.image fun j : J => ⟨ky, k j, kyO, Finset.mem_union.mpr (Or.inl (by simp)), g j⟩ obtain ⟨S, T, W⟩ := IsFiltered.sup_exists O H have fH : ∀ j, (⟨kx, k j, kxO, kjO j, f j⟩ : Σ' (X Y : K) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H := fun j => Finset.mem_union.mpr (Or.inl (by simp only [true_and_iff, Finset.mem_univ, eq_self_iff_true, exists_prop_of_true, Finset.mem_image, heq_iff_eq] refine ⟨j, ?_⟩ simp only [heq_iff_eq] )) have gH : ∀ j, (⟨ky, k j, kyO, kjO j, g j⟩ : Σ' (X Y : K) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H := fun j => Finset.mem_union.mpr (Or.inr (by simp only [true_and_iff, Finset.mem_univ, eq_self_iff_true, exists_prop_of_true, Finset.mem_image, heq_iff_eq] refine ⟨j, ?_⟩ simp only [heq_iff_eq])) -- Our goal is now an equation between equivalence classes of representatives of a colimit, -- and so it suffices to show those representative become equal somewhere, in particular at `S`. apply colimit_sound' (T kxO) (T kyO) -- We can check if two elements of a limit (in `Type`) -- are equal by comparing them componentwise. ext j -- Now it's just a calculation using `W` and `w`. simp only [Functor.comp_map, Limit.map_π_apply, curry_obj_map_app, swap_map] rw [← W _ _ (fH j), ← W _ _ (gH j)] -- Porting note(#10745): had to add `Limit.map_π_apply` -- (which was un-tagged simp since "simp can prove it") simp [Limit.map_π_apply, w]
69
925,378,172,558,778,900,000,000,000,000
2
2
1
2,082
import Mathlib.AlgebraicGeometry.Pullbacks import Mathlib.AlgebraicGeometry.AffineScheme #align_import algebraic_geometry.limits from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" suppress_compilation set_option linter.uppercaseLean3 false universe u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace AlgebraicGeometry noncomputable def specZIsTerminal : IsTerminal (Scheme.Spec.obj (op <| CommRingCat.of ℤ)) := @IsTerminal.isTerminalObj _ _ _ _ Scheme.Spec _ inferInstance (terminalOpOfInitial CommRingCat.zIsInitial) #align algebraic_geometry.Spec_Z_is_terminal AlgebraicGeometry.specZIsTerminal instance : HasTerminal Scheme := hasTerminal_of_hasTerminal_of_preservesLimit Scheme.Spec instance : IsAffine (⊤_ Scheme.{u}) := isAffineOfIso (PreservesTerminal.iso Scheme.Spec).inv instance : HasFiniteLimits Scheme := hasFiniteLimits_of_hasTerminal_and_pullbacks section Initial @[simps] def Scheme.emptyTo (X : Scheme.{u}) : ∅ ⟶ X := ⟨{ base := ⟨fun x => PEmpty.elim x, by continuity⟩ c := { app := fun U => CommRingCat.punitIsTerminal.from _ } }, fun x => PEmpty.elim x⟩ #align algebraic_geometry.Scheme.empty_to AlgebraicGeometry.Scheme.emptyTo @[ext] theorem Scheme.empty_ext {X : Scheme.{u}} (f g : ∅ ⟶ X) : f = g := -- Porting note: `ext` regression -- see https://github.com/leanprover-community/mathlib4/issues/5229 LocallyRingedSpace.Hom.ext _ _ <| PresheafedSpace.ext _ _ (by ext a; exact PEmpty.elim a) <| NatTrans.ext _ _ <| funext fun a => by aesop_cat #align algebraic_geometry.Scheme.empty_ext AlgebraicGeometry.Scheme.empty_ext theorem Scheme.eq_emptyTo {X : Scheme.{u}} (f : ∅ ⟶ X) : f = Scheme.emptyTo X := Scheme.empty_ext f (Scheme.emptyTo X) #align algebraic_geometry.Scheme.eq_empty_to AlgebraicGeometry.Scheme.eq_emptyTo instance Scheme.hom_unique_of_empty_source (X : Scheme.{u}) : Unique (∅ ⟶ X) := ⟨⟨Scheme.emptyTo _⟩, fun _ => Scheme.empty_ext _ _⟩ def emptyIsInitial : IsInitial (∅ : Scheme.{u}) := IsInitial.ofUnique _ #align algebraic_geometry.empty_is_initial AlgebraicGeometry.emptyIsInitial @[simp] theorem emptyIsInitial_to : emptyIsInitial.to = Scheme.emptyTo := rfl #align algebraic_geometry.empty_is_initial_to AlgebraicGeometry.emptyIsInitial_to instance : IsEmpty Scheme.empty.carrier := show IsEmpty PEmpty by infer_instance instance spec_punit_isEmpty : IsEmpty (Scheme.Spec.obj (op <| CommRingCat.of PUnit)).carrier := inferInstanceAs <| IsEmpty (PrimeSpectrum PUnit) #align algebraic_geometry.Spec_punit_is_empty AlgebraicGeometry.spec_punit_isEmpty instance (priority := 100) isOpenImmersion_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty X.carrier] : IsOpenImmersion f := by apply (config := { allowSynthFailures := true }) IsOpenImmersion.of_stalk_iso · exact .of_isEmpty (X := X.carrier) _ · intro (i : X.carrier); exact isEmptyElim i #align algebraic_geometry.is_open_immersion_of_is_empty AlgebraicGeometry.isOpenImmersion_of_isEmpty instance (priority := 100) isIso_of_isEmpty {X Y : Scheme} (f : X ⟶ Y) [IsEmpty Y.carrier] : IsIso f := by haveI : IsEmpty X.carrier := f.1.base.1.isEmpty have : Epi f.1.base := by rw [TopCat.epi_iff_surjective]; rintro (x : Y.carrier) exact isEmptyElim x apply IsOpenImmersion.to_iso #align algebraic_geometry.is_iso_of_is_empty AlgebraicGeometry.isIso_of_isEmpty noncomputable def isInitialOfIsEmpty {X : Scheme} [IsEmpty X.carrier] : IsInitial X := emptyIsInitial.ofIso (asIso <| emptyIsInitial.to _) #align algebraic_geometry.is_initial_of_is_empty AlgebraicGeometry.isInitialOfIsEmpty noncomputable def specPunitIsInitial : IsInitial (Scheme.Spec.obj (op <| CommRingCat.of PUnit)) := emptyIsInitial.ofIso (asIso <| emptyIsInitial.to _) #align algebraic_geometry.Spec_punit_is_initial AlgebraicGeometry.specPunitIsInitial instance (priority := 100) isAffine_of_isEmpty {X : Scheme} [IsEmpty X.carrier] : IsAffine X := isAffineOfIso (inv (emptyIsInitial.to X) ≫ emptyIsInitial.to (Scheme.Spec.obj (op <| CommRingCat.of PUnit))) #align algebraic_geometry.is_affine_of_is_empty AlgebraicGeometry.isAffine_of_isEmpty instance : HasInitial Scheme := -- Porting note: this instance was not needed haveI : (Y : Scheme) → Unique (Scheme.empty ⟶ Y) := Scheme.hom_unique_of_empty_source hasInitial_of_unique Scheme.empty instance initial_isEmpty : IsEmpty (⊥_ Scheme).carrier := ⟨fun x => ((initial.to Scheme.empty : _).1.base x).elim⟩ #align algebraic_geometry.initial_is_empty AlgebraicGeometry.initial_isEmpty
Mathlib/AlgebraicGeometry/Limits.lean
133
139
theorem bot_isAffineOpen (X : Scheme) : IsAffineOpen (⊥ : Opens X.carrier) := by
convert rangeIsAffineOpenOfOpenImmersion (initial.to X) ext -- Porting note: added this `erw` to turn LHS to `False` erw [Set.mem_empty_iff_false] rw [false_iff_iff] exact fun x => isEmptyElim (show (⊥_ Scheme).carrier from x.choose)
6
403.428793
2
2
1
2,083
import Mathlib.Algebra.Group.Nat set_option autoImplicit true open Lean hiding Literal HashMap open Batteries namespace Sat inductive Literal | pos : Nat → Literal | neg : Nat → Literal def Literal.ofInt (i : Int) : Literal := if i < 0 then Literal.neg (-i-1).toNat else Literal.pos (i-1).toNat def Literal.negate : Literal → Literal | pos i => neg i | neg i => pos i instance : ToExpr Literal where toTypeExpr := mkConst ``Literal toExpr | Literal.pos i => mkApp (mkConst ``Literal.pos) (mkRawNatLit i) | Literal.neg i => mkApp (mkConst ``Literal.neg) (mkRawNatLit i) def Clause := List Literal def Clause.nil : Clause := [] def Clause.cons : Literal → Clause → Clause := List.cons abbrev Fmla := List Clause def Fmla.one (c : Clause) : Fmla := [c] def Fmla.and (a b : Fmla) : Fmla := a ++ b structure Fmla.subsumes (f f' : Fmla) : Prop where prop : ∀ x, x ∈ f' → x ∈ f theorem Fmla.subsumes_self (f : Fmla) : f.subsumes f := ⟨fun _ h ↦ h⟩ theorem Fmla.subsumes_left (f f₁ f₂ : Fmla) (H : f.subsumes (f₁.and f₂)) : f.subsumes f₁ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inl h⟩ theorem Fmla.subsumes_right (f f₁ f₂ : Fmla) (H : f.subsumes (f₁.and f₂)) : f.subsumes f₂ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inr h⟩ def Valuation := Nat → Prop def Valuation.neg (v : Valuation) : Literal → Prop | Literal.pos i => ¬ v i | Literal.neg i => v i def Valuation.satisfies (v : Valuation) : Clause → Prop | [] => False | l::c => v.neg l → v.satisfies c structure Valuation.satisfies_fmla (v : Valuation) (f : Fmla) : Prop where prop : ∀ c, c ∈ f → v.satisfies c def Fmla.proof (f : Fmla) (c : Clause) : Prop := ∀ v : Valuation, v.satisfies_fmla f → v.satisfies c theorem Fmla.proof_of_subsumes (H : Fmla.subsumes f (Fmla.one c)) : f.proof c := fun _ h ↦ h.1 _ <| H.1 _ <| List.Mem.head .. theorem Valuation.by_cases {v : Valuation} {l} (h₁ : v.neg l.negate → False) (h₂ : v.neg l → False) : False := match l with | Literal.pos _ => h₂ h₁ | Literal.neg _ => h₁ h₂ def Valuation.implies (v : Valuation) (p : Prop) : List Prop → Nat → Prop | [], _ => p | a::as, n => (v n ↔ a) → v.implies p as (n+1) def Valuation.mk : List Prop → Valuation | [], _ => False | a::_, 0 => a | _::as, n+1 => mk as n
Mathlib/Tactic/Sat/FromLRAT.lean
156
166
theorem Valuation.mk_implies {as ps} (as₁) : as = List.reverseAux as₁ ps → (Valuation.mk as).implies p ps as₁.length → p := by
induction ps generalizing as₁ with | nil => exact fun _ ↦ id | cons a as ih => refine fun e H ↦ @ih (a::as₁) e (H ?_) subst e; clear ih H suffices ∀ n n', n' = List.length as₁ + n → ∀ bs, mk (as₁.reverseAux bs) n' ↔ mk bs n from this 0 _ rfl (a::as) induction as₁ with simp | cons b as₁ ih => exact fun n bs ↦ ih (n+1) _ (Nat.succ_add ..) _
9
8,103.083928
2
2
2
2,084
import Mathlib.Algebra.Group.Nat set_option autoImplicit true open Lean hiding Literal HashMap open Batteries namespace Sat inductive Literal | pos : Nat → Literal | neg : Nat → Literal def Literal.ofInt (i : Int) : Literal := if i < 0 then Literal.neg (-i-1).toNat else Literal.pos (i-1).toNat def Literal.negate : Literal → Literal | pos i => neg i | neg i => pos i instance : ToExpr Literal where toTypeExpr := mkConst ``Literal toExpr | Literal.pos i => mkApp (mkConst ``Literal.pos) (mkRawNatLit i) | Literal.neg i => mkApp (mkConst ``Literal.neg) (mkRawNatLit i) def Clause := List Literal def Clause.nil : Clause := [] def Clause.cons : Literal → Clause → Clause := List.cons abbrev Fmla := List Clause def Fmla.one (c : Clause) : Fmla := [c] def Fmla.and (a b : Fmla) : Fmla := a ++ b structure Fmla.subsumes (f f' : Fmla) : Prop where prop : ∀ x, x ∈ f' → x ∈ f theorem Fmla.subsumes_self (f : Fmla) : f.subsumes f := ⟨fun _ h ↦ h⟩ theorem Fmla.subsumes_left (f f₁ f₂ : Fmla) (H : f.subsumes (f₁.and f₂)) : f.subsumes f₁ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inl h⟩ theorem Fmla.subsumes_right (f f₁ f₂ : Fmla) (H : f.subsumes (f₁.and f₂)) : f.subsumes f₂ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inr h⟩ def Valuation := Nat → Prop def Valuation.neg (v : Valuation) : Literal → Prop | Literal.pos i => ¬ v i | Literal.neg i => v i def Valuation.satisfies (v : Valuation) : Clause → Prop | [] => False | l::c => v.neg l → v.satisfies c structure Valuation.satisfies_fmla (v : Valuation) (f : Fmla) : Prop where prop : ∀ c, c ∈ f → v.satisfies c def Fmla.proof (f : Fmla) (c : Clause) : Prop := ∀ v : Valuation, v.satisfies_fmla f → v.satisfies c theorem Fmla.proof_of_subsumes (H : Fmla.subsumes f (Fmla.one c)) : f.proof c := fun _ h ↦ h.1 _ <| H.1 _ <| List.Mem.head .. theorem Valuation.by_cases {v : Valuation} {l} (h₁ : v.neg l.negate → False) (h₂ : v.neg l → False) : False := match l with | Literal.pos _ => h₂ h₁ | Literal.neg _ => h₁ h₂ def Valuation.implies (v : Valuation) (p : Prop) : List Prop → Nat → Prop | [], _ => p | a::as, n => (v n ↔ a) → v.implies p as (n+1) def Valuation.mk : List Prop → Valuation | [], _ => False | a::_, 0 => a | _::as, n+1 => mk as n theorem Valuation.mk_implies {as ps} (as₁) : as = List.reverseAux as₁ ps → (Valuation.mk as).implies p ps as₁.length → p := by induction ps generalizing as₁ with | nil => exact fun _ ↦ id | cons a as ih => refine fun e H ↦ @ih (a::as₁) e (H ?_) subst e; clear ih H suffices ∀ n n', n' = List.length as₁ + n → ∀ bs, mk (as₁.reverseAux bs) n' ↔ mk bs n from this 0 _ rfl (a::as) induction as₁ with simp | cons b as₁ ih => exact fun n bs ↦ ih (n+1) _ (Nat.succ_add ..) _ structure Fmla.reify (v : Valuation) (f : Fmla) (p : Prop) : Prop where prop : ¬ v.satisfies_fmla f → p theorem Fmla.refute {ps} (f : Fmla) (hf : f.proof []) (hv : ∀ v, Valuation.implies v (Fmla.reify v f p) ps 0) : p := (Valuation.mk_implies [] rfl (hv _)).1 (hf _)
Mathlib/Tactic/Sat/FromLRAT.lean
180
185
theorem Fmla.reify_or (h₁ : Fmla.reify v f₁ a) (h₂ : Fmla.reify v f₂ b) : Fmla.reify v (f₁.and f₂) (a ∨ b) := by
refine ⟨fun H ↦ by_contra fun hn ↦ H ⟨fun c h ↦ by_contra fun hn' ↦ ?_⟩⟩ rcases List.mem_append.1 h with h | h · exact hn <| Or.inl <| h₁.1 fun Hc ↦ hn' <| Hc.1 _ h · exact hn <| Or.inr <| h₂.1 fun Hc ↦ hn' <| Hc.1 _ h
4
54.59815
2
2
2
2,084
import Mathlib.Algebra.Polynomial.Module.AEval #align_import data.polynomial.module from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" universe u v open Polynomial BigOperators @[nolint unusedArguments] def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] := ℕ →₀ M #align polynomial_module PolynomialModule variable (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R) -- Porting note: stated instead of deriving noncomputable instance : Inhabited (PolynomialModule R M) := Finsupp.instInhabited noncomputable instance : AddCommGroup (PolynomialModule R M) := Finsupp.instAddCommGroup variable {M} variable {S : Type*} [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] namespace PolynomialModule @[nolint unusedArguments] noncomputable instance : Module S (PolynomialModule R M) := Finsupp.module ℕ M instance instFunLike : FunLike (PolynomialModule R M) ℕ M := Finsupp.instFunLike instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M := Finsupp.instCoeFun theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 := Finsupp.zero_apply theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a := Finsupp.add_apply g₁ g₂ a noncomputable def single (i : ℕ) : M →+ PolynomialModule R M := Finsupp.singleAddHom i #align polynomial_module.single PolynomialModule.single theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 := Finsupp.single_apply #align polynomial_module.single_apply PolynomialModule.single_apply noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M := Finsupp.lsingle i #align polynomial_module.lsingle PolynomialModule.lsingle theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 := Finsupp.single_apply #align polynomial_module.lsingle_apply PolynomialModule.lsingle_apply theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m := (lsingle R i).map_smul r m #align polynomial_module.single_smul PolynomialModule.single_smul variable {R} theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0) (hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f := Finsupp.induction_linear f h0 hadd hsingle #align polynomial_module.induction_linear PolynomialModule.induction_linear noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) := inferInstanceAs (Module R[X] (Module.AEval' (Finsupp.lmapDomain M R Nat.succ))) #align polynomial_module.polynomial_module PolynomialModule.polynomialModule lemma smul_def (f : R[X]) (m : PolynomialModule R M) : f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m := by rfl instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] : IsScalarTower S R (PolynomialModule R M) := Finsupp.isScalarTower _ _ instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) := by haveI : IsScalarTower R R[X] (PolynomialModule R M) := inferInstanceAs <| IsScalarTower R R[X] <| Module.AEval' <| Finsupp.lmapDomain M R Nat.succ constructor intro x y z rw [← @IsScalarTower.algebraMap_smul S R, ← @IsScalarTower.algebraMap_smul S R, smul_assoc] #align polynomial_module.is_scalar_tower' PolynomialModule.isScalarTower' @[simp]
Mathlib/Algebra/Polynomial/Module/Basic.lean
123
135
theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) : monomial i r • single R j m = single R (i + j) (r • m) := by
simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply, Module.algebraMap_end_apply, smul_def] induction i generalizing r j m with | zero => rw [Function.iterate_zero, zero_add] exact Finsupp.smul_single r j m | succ n hn => rw [Function.iterate_succ, Function.comp_apply, add_assoc, ← hn] congr 2 rw [Nat.one_add] exact Finsupp.mapDomain_single
11
59,874.141715
2
2
3
2,085
import Mathlib.Algebra.Polynomial.Module.AEval #align_import data.polynomial.module from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" universe u v open Polynomial BigOperators @[nolint unusedArguments] def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] := ℕ →₀ M #align polynomial_module PolynomialModule variable (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R) -- Porting note: stated instead of deriving noncomputable instance : Inhabited (PolynomialModule R M) := Finsupp.instInhabited noncomputable instance : AddCommGroup (PolynomialModule R M) := Finsupp.instAddCommGroup variable {M} variable {S : Type*} [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] namespace PolynomialModule @[nolint unusedArguments] noncomputable instance : Module S (PolynomialModule R M) := Finsupp.module ℕ M instance instFunLike : FunLike (PolynomialModule R M) ℕ M := Finsupp.instFunLike instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M := Finsupp.instCoeFun theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 := Finsupp.zero_apply theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a := Finsupp.add_apply g₁ g₂ a noncomputable def single (i : ℕ) : M →+ PolynomialModule R M := Finsupp.singleAddHom i #align polynomial_module.single PolynomialModule.single theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 := Finsupp.single_apply #align polynomial_module.single_apply PolynomialModule.single_apply noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M := Finsupp.lsingle i #align polynomial_module.lsingle PolynomialModule.lsingle theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 := Finsupp.single_apply #align polynomial_module.lsingle_apply PolynomialModule.lsingle_apply theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m := (lsingle R i).map_smul r m #align polynomial_module.single_smul PolynomialModule.single_smul variable {R} theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0) (hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f := Finsupp.induction_linear f h0 hadd hsingle #align polynomial_module.induction_linear PolynomialModule.induction_linear noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) := inferInstanceAs (Module R[X] (Module.AEval' (Finsupp.lmapDomain M R Nat.succ))) #align polynomial_module.polynomial_module PolynomialModule.polynomialModule lemma smul_def (f : R[X]) (m : PolynomialModule R M) : f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m := by rfl instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] : IsScalarTower S R (PolynomialModule R M) := Finsupp.isScalarTower _ _ instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) := by haveI : IsScalarTower R R[X] (PolynomialModule R M) := inferInstanceAs <| IsScalarTower R R[X] <| Module.AEval' <| Finsupp.lmapDomain M R Nat.succ constructor intro x y z rw [← @IsScalarTower.algebraMap_smul S R, ← @IsScalarTower.algebraMap_smul S R, smul_assoc] #align polynomial_module.is_scalar_tower' PolynomialModule.isScalarTower' @[simp] theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) : monomial i r • single R j m = single R (i + j) (r • m) := by simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply, Module.algebraMap_end_apply, smul_def] induction i generalizing r j m with | zero => rw [Function.iterate_zero, zero_add] exact Finsupp.smul_single r j m | succ n hn => rw [Function.iterate_succ, Function.comp_apply, add_assoc, ← hn] congr 2 rw [Nat.one_add] exact Finsupp.mapDomain_single #align polynomial_module.monomial_smul_single PolynomialModule.monomial_smul_single @[simp]
Mathlib/Algebra/Polynomial/Module/Basic.lean
139
153
theorem monomial_smul_apply (i : ℕ) (r : R) (g : PolynomialModule R M) (n : ℕ) : (monomial i r • g) n = ite (i ≤ n) (r • g (n - i)) 0 := by
induction' g using PolynomialModule.induction_linear with p q hp hq · simp only [smul_zero, zero_apply, ite_self] · simp only [smul_add, add_apply, hp, hq] split_ifs exacts [rfl, zero_add 0] · rw [monomial_smul_single, single_apply, single_apply, smul_ite, smul_zero, ← ite_and] congr rw [eq_iff_iff] constructor · rintro rfl simp · rintro ⟨e, rfl⟩ rw [add_comm, tsub_add_cancel_of_le e]
13
442,413.392009
2
2
3
2,085
import Mathlib.Algebra.Polynomial.Module.AEval #align_import data.polynomial.module from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" universe u v open Polynomial BigOperators @[nolint unusedArguments] def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] := ℕ →₀ M #align polynomial_module PolynomialModule variable (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R) -- Porting note: stated instead of deriving noncomputable instance : Inhabited (PolynomialModule R M) := Finsupp.instInhabited noncomputable instance : AddCommGroup (PolynomialModule R M) := Finsupp.instAddCommGroup variable {M} variable {S : Type*} [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] namespace PolynomialModule @[nolint unusedArguments] noncomputable instance : Module S (PolynomialModule R M) := Finsupp.module ℕ M instance instFunLike : FunLike (PolynomialModule R M) ℕ M := Finsupp.instFunLike instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M := Finsupp.instCoeFun theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 := Finsupp.zero_apply theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a := Finsupp.add_apply g₁ g₂ a noncomputable def single (i : ℕ) : M →+ PolynomialModule R M := Finsupp.singleAddHom i #align polynomial_module.single PolynomialModule.single theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 := Finsupp.single_apply #align polynomial_module.single_apply PolynomialModule.single_apply noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M := Finsupp.lsingle i #align polynomial_module.lsingle PolynomialModule.lsingle theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 := Finsupp.single_apply #align polynomial_module.lsingle_apply PolynomialModule.lsingle_apply theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m := (lsingle R i).map_smul r m #align polynomial_module.single_smul PolynomialModule.single_smul variable {R} theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0) (hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f := Finsupp.induction_linear f h0 hadd hsingle #align polynomial_module.induction_linear PolynomialModule.induction_linear noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) := inferInstanceAs (Module R[X] (Module.AEval' (Finsupp.lmapDomain M R Nat.succ))) #align polynomial_module.polynomial_module PolynomialModule.polynomialModule lemma smul_def (f : R[X]) (m : PolynomialModule R M) : f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m := by rfl instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] : IsScalarTower S R (PolynomialModule R M) := Finsupp.isScalarTower _ _ instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) := by haveI : IsScalarTower R R[X] (PolynomialModule R M) := inferInstanceAs <| IsScalarTower R R[X] <| Module.AEval' <| Finsupp.lmapDomain M R Nat.succ constructor intro x y z rw [← @IsScalarTower.algebraMap_smul S R, ← @IsScalarTower.algebraMap_smul S R, smul_assoc] #align polynomial_module.is_scalar_tower' PolynomialModule.isScalarTower' @[simp] theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) : monomial i r • single R j m = single R (i + j) (r • m) := by simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply, Module.algebraMap_end_apply, smul_def] induction i generalizing r j m with | zero => rw [Function.iterate_zero, zero_add] exact Finsupp.smul_single r j m | succ n hn => rw [Function.iterate_succ, Function.comp_apply, add_assoc, ← hn] congr 2 rw [Nat.one_add] exact Finsupp.mapDomain_single #align polynomial_module.monomial_smul_single PolynomialModule.monomial_smul_single @[simp] theorem monomial_smul_apply (i : ℕ) (r : R) (g : PolynomialModule R M) (n : ℕ) : (monomial i r • g) n = ite (i ≤ n) (r • g (n - i)) 0 := by induction' g using PolynomialModule.induction_linear with p q hp hq · simp only [smul_zero, zero_apply, ite_self] · simp only [smul_add, add_apply, hp, hq] split_ifs exacts [rfl, zero_add 0] · rw [monomial_smul_single, single_apply, single_apply, smul_ite, smul_zero, ← ite_and] congr rw [eq_iff_iff] constructor · rintro rfl simp · rintro ⟨e, rfl⟩ rw [add_comm, tsub_add_cancel_of_le e] #align polynomial_module.monomial_smul_apply PolynomialModule.monomial_smul_apply @[simp]
Mathlib/Algebra/Polynomial/Module/Basic.lean
157
169
theorem smul_single_apply (i : ℕ) (f : R[X]) (m : M) (n : ℕ) : (f • single R i m) n = ite (i ≤ n) (f.coeff (n - i) • m) 0 := by
induction' f using Polynomial.induction_on' with p q hp hq · rw [add_smul, Finsupp.add_apply, hp, hq, coeff_add, add_smul] split_ifs exacts [rfl, zero_add 0] · rw [monomial_smul_single, single_apply, coeff_monomial, ite_smul, zero_smul] by_cases h : i ≤ n · simp_rw [eq_tsub_iff_add_eq_of_le h, if_pos h] · rw [if_neg h, ite_eq_right_iff] intro e exfalso linarith
11
59,874.141715
2
2
3
2,085
import Mathlib.Algebra.Algebra.Prod import Mathlib.LinearAlgebra.Basic import Mathlib.LinearAlgebra.Span import Mathlib.Order.PartialSups #align_import linear_algebra.prod from "leanprover-community/mathlib"@"cd391184c85986113f8c00844cfe6dda1d34be3d" universe u v w x y z u' v' w' y' variable {R : Type u} {K : Type u'} {M : Type v} {V : Type v'} {M₂ : Type w} {V₂ : Type w'} variable {M₃ : Type y} {V₃ : Type y'} {M₄ : Type z} {ι : Type x} variable {M₅ M₆ : Type*} section Prod namespace LinearMap variable (S : Type*) [Semiring R] [Semiring S] variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃] [AddCommMonoid M₄] variable [AddCommMonoid M₅] [AddCommMonoid M₆] variable [Module R M] [Module R M₂] [Module R M₃] [Module R M₄] variable [Module R M₅] [Module R M₆] variable (f : M →ₗ[R] M₂) section variable (R M M₂) def fst : M × M₂ →ₗ[R] M where toFun := Prod.fst map_add' _x _y := rfl map_smul' _x _y := rfl #align linear_map.fst LinearMap.fst def snd : M × M₂ →ₗ[R] M₂ where toFun := Prod.snd map_add' _x _y := rfl map_smul' _x _y := rfl #align linear_map.snd LinearMap.snd end @[simp] theorem fst_apply (x : M × M₂) : fst R M M₂ x = x.1 := rfl #align linear_map.fst_apply LinearMap.fst_apply @[simp] theorem snd_apply (x : M × M₂) : snd R M M₂ x = x.2 := rfl #align linear_map.snd_apply LinearMap.snd_apply theorem fst_surjective : Function.Surjective (fst R M M₂) := fun x => ⟨(x, 0), rfl⟩ #align linear_map.fst_surjective LinearMap.fst_surjective theorem snd_surjective : Function.Surjective (snd R M M₂) := fun x => ⟨(0, x), rfl⟩ #align linear_map.snd_surjective LinearMap.snd_surjective @[simps] def prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : M →ₗ[R] M₂ × M₃ where toFun := Pi.prod f g map_add' x y := by simp only [Pi.prod, Prod.mk_add_mk, map_add] map_smul' c x := by simp only [Pi.prod, Prod.smul_mk, map_smul, RingHom.id_apply] #align linear_map.prod LinearMap.prod theorem coe_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : ⇑(f.prod g) = Pi.prod f g := rfl #align linear_map.coe_prod LinearMap.coe_prod @[simp] theorem fst_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : (fst R M₂ M₃).comp (prod f g) = f := rfl #align linear_map.fst_prod LinearMap.fst_prod @[simp] theorem snd_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : (snd R M₂ M₃).comp (prod f g) = g := rfl #align linear_map.snd_prod LinearMap.snd_prod @[simp] theorem pair_fst_snd : prod (fst R M M₂) (snd R M M₂) = LinearMap.id := rfl #align linear_map.pair_fst_snd LinearMap.pair_fst_snd theorem prod_comp (f : M₂ →ₗ[R] M₃) (g : M₂ →ₗ[R] M₄) (h : M →ₗ[R] M₂) : (f.prod g).comp h = (f.comp h).prod (g.comp h) := rfl @[simps] def prodEquiv [Module S M₂] [Module S M₃] [SMulCommClass R S M₂] [SMulCommClass R S M₃] : ((M →ₗ[R] M₂) × (M →ₗ[R] M₃)) ≃ₗ[S] M →ₗ[R] M₂ × M₃ where toFun f := f.1.prod f.2 invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f) left_inv f := by ext <;> rfl right_inv f := by ext <;> rfl map_add' a b := rfl map_smul' r a := rfl #align linear_map.prod_equiv LinearMap.prodEquiv section variable (R M M₂) def inl : M →ₗ[R] M × M₂ := prod LinearMap.id 0 #align linear_map.inl LinearMap.inl def inr : M₂ →ₗ[R] M × M₂ := prod 0 LinearMap.id #align linear_map.inr LinearMap.inr
Mathlib/LinearAlgebra/Prod.lean
148
155
theorem range_inl : range (inl R M M₂) = ker (snd R M M₂) := by
ext x simp only [mem_ker, mem_range] constructor · rintro ⟨y, rfl⟩ rfl · intro h exact ⟨x.fst, Prod.ext rfl h.symm⟩
7
1,096.633158
2
2
2
2,086
import Mathlib.Algebra.Algebra.Prod import Mathlib.LinearAlgebra.Basic import Mathlib.LinearAlgebra.Span import Mathlib.Order.PartialSups #align_import linear_algebra.prod from "leanprover-community/mathlib"@"cd391184c85986113f8c00844cfe6dda1d34be3d" universe u v w x y z u' v' w' y' variable {R : Type u} {K : Type u'} {M : Type v} {V : Type v'} {M₂ : Type w} {V₂ : Type w'} variable {M₃ : Type y} {V₃ : Type y'} {M₄ : Type z} {ι : Type x} variable {M₅ M₆ : Type*} section Prod namespace LinearMap variable (S : Type*) [Semiring R] [Semiring S] variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃] [AddCommMonoid M₄] variable [AddCommMonoid M₅] [AddCommMonoid M₆] variable [Module R M] [Module R M₂] [Module R M₃] [Module R M₄] variable [Module R M₅] [Module R M₆] variable (f : M →ₗ[R] M₂) section variable (R M M₂) def fst : M × M₂ →ₗ[R] M where toFun := Prod.fst map_add' _x _y := rfl map_smul' _x _y := rfl #align linear_map.fst LinearMap.fst def snd : M × M₂ →ₗ[R] M₂ where toFun := Prod.snd map_add' _x _y := rfl map_smul' _x _y := rfl #align linear_map.snd LinearMap.snd end @[simp] theorem fst_apply (x : M × M₂) : fst R M M₂ x = x.1 := rfl #align linear_map.fst_apply LinearMap.fst_apply @[simp] theorem snd_apply (x : M × M₂) : snd R M M₂ x = x.2 := rfl #align linear_map.snd_apply LinearMap.snd_apply theorem fst_surjective : Function.Surjective (fst R M M₂) := fun x => ⟨(x, 0), rfl⟩ #align linear_map.fst_surjective LinearMap.fst_surjective theorem snd_surjective : Function.Surjective (snd R M M₂) := fun x => ⟨(0, x), rfl⟩ #align linear_map.snd_surjective LinearMap.snd_surjective @[simps] def prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : M →ₗ[R] M₂ × M₃ where toFun := Pi.prod f g map_add' x y := by simp only [Pi.prod, Prod.mk_add_mk, map_add] map_smul' c x := by simp only [Pi.prod, Prod.smul_mk, map_smul, RingHom.id_apply] #align linear_map.prod LinearMap.prod theorem coe_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : ⇑(f.prod g) = Pi.prod f g := rfl #align linear_map.coe_prod LinearMap.coe_prod @[simp] theorem fst_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : (fst R M₂ M₃).comp (prod f g) = f := rfl #align linear_map.fst_prod LinearMap.fst_prod @[simp] theorem snd_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : (snd R M₂ M₃).comp (prod f g) = g := rfl #align linear_map.snd_prod LinearMap.snd_prod @[simp] theorem pair_fst_snd : prod (fst R M M₂) (snd R M M₂) = LinearMap.id := rfl #align linear_map.pair_fst_snd LinearMap.pair_fst_snd theorem prod_comp (f : M₂ →ₗ[R] M₃) (g : M₂ →ₗ[R] M₄) (h : M →ₗ[R] M₂) : (f.prod g).comp h = (f.comp h).prod (g.comp h) := rfl @[simps] def prodEquiv [Module S M₂] [Module S M₃] [SMulCommClass R S M₂] [SMulCommClass R S M₃] : ((M →ₗ[R] M₂) × (M →ₗ[R] M₃)) ≃ₗ[S] M →ₗ[R] M₂ × M₃ where toFun f := f.1.prod f.2 invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f) left_inv f := by ext <;> rfl right_inv f := by ext <;> rfl map_add' a b := rfl map_smul' r a := rfl #align linear_map.prod_equiv LinearMap.prodEquiv section variable (R M M₂) def inl : M →ₗ[R] M × M₂ := prod LinearMap.id 0 #align linear_map.inl LinearMap.inl def inr : M₂ →ₗ[R] M × M₂ := prod 0 LinearMap.id #align linear_map.inr LinearMap.inr theorem range_inl : range (inl R M M₂) = ker (snd R M M₂) := by ext x simp only [mem_ker, mem_range] constructor · rintro ⟨y, rfl⟩ rfl · intro h exact ⟨x.fst, Prod.ext rfl h.symm⟩ #align linear_map.range_inl LinearMap.range_inl theorem ker_snd : ker (snd R M M₂) = range (inl R M M₂) := Eq.symm <| range_inl R M M₂ #align linear_map.ker_snd LinearMap.ker_snd
Mathlib/LinearAlgebra/Prod.lean
162
169
theorem range_inr : range (inr R M M₂) = ker (fst R M M₂) := by
ext x simp only [mem_ker, mem_range] constructor · rintro ⟨y, rfl⟩ rfl · intro h exact ⟨x.snd, Prod.ext h.symm rfl⟩
7
1,096.633158
2
2
2
2,086
import Mathlib.Probability.Process.Adapted import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import probability.process.stopping from "leanprover-community/mathlib"@"ba074af83b6cf54c3104e59402b39410ddbd6dca" open Filter Order TopologicalSpace open scoped Classical MeasureTheory NNReal ENNReal Topology namespace MeasureTheory variable {Ω β ι : Type*} {m : MeasurableSpace Ω} def IsStoppingTime [Preorder ι] (f : Filtration ι m) (τ : Ω → ι) := ∀ i : ι, MeasurableSet[f i] <| {ω | τ ω ≤ i} #align measure_theory.is_stopping_time MeasureTheory.IsStoppingTime theorem isStoppingTime_const [Preorder ι] (f : Filtration ι m) (i : ι) : IsStoppingTime f fun _ => i := fun j => by simp only [MeasurableSet.const] #align measure_theory.is_stopping_time_const MeasureTheory.isStoppingTime_const section MeasurableSet section Preorder variable [Preorder ι] {f : Filtration ι m} {τ : Ω → ι} protected theorem IsStoppingTime.measurableSet_le (hτ : IsStoppingTime f τ) (i : ι) : MeasurableSet[f i] {ω | τ ω ≤ i} := hτ i #align measure_theory.is_stopping_time.measurable_set_le MeasureTheory.IsStoppingTime.measurableSet_le
Mathlib/Probability/Process/Stopping.lean
72
82
theorem IsStoppingTime.measurableSet_lt_of_pred [PredOrder ι] (hτ : IsStoppingTime f τ) (i : ι) : MeasurableSet[f i] {ω | τ ω < i} := by
by_cases hi_min : IsMin i · suffices {ω : Ω | τ ω < i} = ∅ by rw [this]; exact @MeasurableSet.empty _ (f i) ext1 ω simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false_iff] rw [isMin_iff_forall_not_lt] at hi_min exact hi_min (τ ω) have : {ω : Ω | τ ω < i} = τ ⁻¹' Set.Iic (pred i) := by ext; simp [Iic_pred_of_not_isMin hi_min] rw [this] exact f.mono (pred_le i) _ (hτ.measurableSet_le <| pred i)
9
8,103.083928
2
2
1
2,087
import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.Spectrum import Mathlib.Analysis.SpecialFunctions.Exponential import Mathlib.Algebra.Star.StarAlgHom #align_import analysis.normed_space.star.spectrum from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" local postfix:max "⋆" => star section open scoped Topology ENNReal open Filter ENNReal spectrum CstarRing NormedSpace section UnitarySpectrum variable {𝕜 : Type*} [NormedField 𝕜] {E : Type*} [NormedRing E] [StarRing E] [CstarRing E] [NormedAlgebra 𝕜 E] [CompleteSpace E]
Mathlib/Analysis/NormedSpace/Star/Spectrum.lean
31
41
theorem unitary.spectrum_subset_circle (u : unitary E) : spectrum 𝕜 (u : E) ⊆ Metric.sphere 0 1 := by
nontriviality E refine fun k hk => mem_sphere_zero_iff_norm.mpr (le_antisymm ?_ ?_) · simpa only [CstarRing.norm_coe_unitary u] using norm_le_norm_of_mem hk · rw [← unitary.val_toUnits_apply u] at hk have hnk := ne_zero_of_mem_of_unit hk rw [← inv_inv (unitary.toUnits u), ← spectrum.map_inv, Set.mem_inv] at hk have : ‖k‖⁻¹ ≤ ‖(↑(unitary.toUnits u)⁻¹ : E)‖ := by simpa only [norm_inv] using norm_le_norm_of_mem hk simpa using inv_le_of_inv_le (norm_pos_iff.mpr hnk) this
9
8,103.083928
2
2
3
2,088
import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.Spectrum import Mathlib.Analysis.SpecialFunctions.Exponential import Mathlib.Algebra.Star.StarAlgHom #align_import analysis.normed_space.star.spectrum from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" local postfix:max "⋆" => star section open scoped Topology ENNReal open Filter ENNReal spectrum CstarRing NormedSpace section ComplexScalars open Complex variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A] [StarRing A] [CstarRing A] local notation "↑ₐ" => algebraMap ℂ A
Mathlib/Analysis/NormedSpace/Star/Spectrum.lean
60
69
theorem IsSelfAdjoint.spectralRadius_eq_nnnorm {a : A} (ha : IsSelfAdjoint a) : spectralRadius ℂ a = ‖a‖₊ := by
have hconst : Tendsto (fun _n : ℕ => (‖a‖₊ : ℝ≥0∞)) atTop _ := tendsto_const_nhds refine tendsto_nhds_unique ?_ hconst convert (spectrum.pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius (a : A)).comp (Nat.tendsto_pow_atTop_atTop_of_one_lt one_lt_two) using 1 refine funext fun n => ?_ rw [Function.comp_apply, ha.nnnorm_pow_two_pow, ENNReal.coe_pow, ← rpow_natCast, ← rpow_mul] simp
8
2,980.957987
2
2
3
2,088
import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.Spectrum import Mathlib.Analysis.SpecialFunctions.Exponential import Mathlib.Algebra.Star.StarAlgHom #align_import analysis.normed_space.star.spectrum from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" local postfix:max "⋆" => star section open scoped Topology ENNReal open Filter ENNReal spectrum CstarRing NormedSpace section ComplexScalars open Complex variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A] [StarRing A] [CstarRing A] local notation "↑ₐ" => algebraMap ℂ A theorem IsSelfAdjoint.spectralRadius_eq_nnnorm {a : A} (ha : IsSelfAdjoint a) : spectralRadius ℂ a = ‖a‖₊ := by have hconst : Tendsto (fun _n : ℕ => (‖a‖₊ : ℝ≥0∞)) atTop _ := tendsto_const_nhds refine tendsto_nhds_unique ?_ hconst convert (spectrum.pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius (a : A)).comp (Nat.tendsto_pow_atTop_atTop_of_one_lt one_lt_two) using 1 refine funext fun n => ?_ rw [Function.comp_apply, ha.nnnorm_pow_two_pow, ENNReal.coe_pow, ← rpow_natCast, ← rpow_mul] simp #align is_self_adjoint.spectral_radius_eq_nnnorm IsSelfAdjoint.spectralRadius_eq_nnnorm
Mathlib/Analysis/NormedSpace/Star/Spectrum.lean
72
86
theorem IsStarNormal.spectralRadius_eq_nnnorm (a : A) [IsStarNormal a] : spectralRadius ℂ a = ‖a‖₊ := by
refine (ENNReal.pow_strictMono two_ne_zero).injective ?_ have heq : (fun n : ℕ => (‖(a⋆ * a) ^ n‖₊ : ℝ≥0∞) ^ (1 / n : ℝ)) = (fun x => x ^ 2) ∘ fun n : ℕ => (‖a ^ n‖₊ : ℝ≥0∞) ^ (1 / n : ℝ) := by funext n rw [Function.comp_apply, ← rpow_natCast, ← rpow_mul, mul_comm, rpow_mul, rpow_natCast, ← coe_pow, sq, ← nnnorm_star_mul_self, Commute.mul_pow (star_comm_self' a), star_pow] have h₂ := ((ENNReal.continuous_pow 2).tendsto (spectralRadius ℂ a)).comp (spectrum.pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius a) rw [← heq] at h₂ convert tendsto_nhds_unique h₂ (pow_nnnorm_pow_one_div_tendsto_nhds_spectralRadius (a⋆ * a)) rw [(IsSelfAdjoint.star_mul_self a).spectralRadius_eq_nnnorm, sq, nnnorm_star_mul_self, coe_mul]
13
442,413.392009
2
2
3
2,088
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.IndicatorConstPointwise #align_import measure_theory.constructions.borel_space.metrizable from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" open Filter MeasureTheory TopologicalSpace open scoped Classical open Topology NNReal ENNReal MeasureTheory variable {α β : Type*} [MeasurableSpace α] section Limits variable [TopologicalSpace β] [PseudoMetrizableSpace β] [MeasurableSpace β] [BorelSpace β] open Metric
Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean
31
47
theorem measurable_of_tendsto_metrizable' {ι} {f : ι → α → β} {g : α → β} (u : Filter ι) [NeBot u] [IsCountablyGenerated u] (hf : ∀ i, Measurable (f i)) (lim : Tendsto f u (𝓝 g)) : Measurable g := by
letI : PseudoMetricSpace β := pseudoMetrizableSpacePseudoMetric β apply measurable_of_isClosed' intro s h1s h2s h3s have : Measurable fun x => infNndist (g x) s := by suffices Tendsto (fun i x => infNndist (f i x) s) u (𝓝 fun x => infNndist (g x) s) from NNReal.measurable_of_tendsto' u (fun i => (hf i).infNndist) this rw [tendsto_pi_nhds] at lim ⊢ intro x exact ((continuous_infNndist_pt s).tendsto (g x)).comp (lim x) have h4s : g ⁻¹' s = (fun x => infNndist (g x) s) ⁻¹' {0} := by ext x simp [h1s, ← h1s.mem_iff_infDist_zero h2s, ← NNReal.coe_eq_zero] rw [h4s] exact this (measurableSet_singleton 0)
14
1,202,604.284165
2
2
3
2,089
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.IndicatorConstPointwise #align_import measure_theory.constructions.borel_space.metrizable from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" open Filter MeasureTheory TopologicalSpace open scoped Classical open Topology NNReal ENNReal MeasureTheory variable {α β : Type*} [MeasurableSpace α] section Limits variable [TopologicalSpace β] [PseudoMetrizableSpace β] [MeasurableSpace β] [BorelSpace β] open Metric theorem measurable_of_tendsto_metrizable' {ι} {f : ι → α → β} {g : α → β} (u : Filter ι) [NeBot u] [IsCountablyGenerated u] (hf : ∀ i, Measurable (f i)) (lim : Tendsto f u (𝓝 g)) : Measurable g := by letI : PseudoMetricSpace β := pseudoMetrizableSpacePseudoMetric β apply measurable_of_isClosed' intro s h1s h2s h3s have : Measurable fun x => infNndist (g x) s := by suffices Tendsto (fun i x => infNndist (f i x) s) u (𝓝 fun x => infNndist (g x) s) from NNReal.measurable_of_tendsto' u (fun i => (hf i).infNndist) this rw [tendsto_pi_nhds] at lim ⊢ intro x exact ((continuous_infNndist_pt s).tendsto (g x)).comp (lim x) have h4s : g ⁻¹' s = (fun x => infNndist (g x) s) ⁻¹' {0} := by ext x simp [h1s, ← h1s.mem_iff_infDist_zero h2s, ← NNReal.coe_eq_zero] rw [h4s] exact this (measurableSet_singleton 0) #align measurable_of_tendsto_metrizable' measurable_of_tendsto_metrizable' theorem measurable_of_tendsto_metrizable {f : ℕ → α → β} {g : α → β} (hf : ∀ i, Measurable (f i)) (lim : Tendsto f atTop (𝓝 g)) : Measurable g := measurable_of_tendsto_metrizable' atTop hf lim #align measurable_of_tendsto_metrizable measurable_of_tendsto_metrizable
Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean
57
78
theorem aemeasurable_of_tendsto_metrizable_ae {ι} {μ : Measure α} {f : ι → α → β} {g : α → β} (u : Filter ι) [hu : NeBot u] [IsCountablyGenerated u] (hf : ∀ n, AEMeasurable (f n) μ) (h_tendsto : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))) : AEMeasurable g μ := by
rcases u.exists_seq_tendsto with ⟨v, hv⟩ have h'f : ∀ n, AEMeasurable (f (v n)) μ := fun n => hf (v n) set p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x)) have hp : ∀ᵐ x ∂μ, p x fun n => f (v n) x := by filter_upwards [h_tendsto] with x hx using hx.comp hv set aeSeqLim := fun x => ite (x ∈ aeSeqSet h'f p) (g x) (⟨f (v 0) x⟩ : Nonempty β).some refine ⟨aeSeqLim, measurable_of_tendsto_metrizable' atTop (aeSeq.measurable h'f p) (tendsto_pi_nhds.mpr fun x => ?_), ?_⟩ · simp_rw [aeSeqLim, aeSeq] split_ifs with hx · simp_rw [aeSeq.mk_eq_fun_of_mem_aeSeqSet h'f hx] exact @aeSeq.fun_prop_of_mem_aeSeqSet _ α β _ _ _ _ _ h'f x hx · exact tendsto_const_nhds · exact (ite_ae_eq_of_measure_compl_zero g (fun x => (⟨f (v 0) x⟩ : Nonempty β).some) (aeSeqSet h'f p) (aeSeq.measure_compl_aeSeqSet_eq_zero h'f hp)).symm
19
178,482,300.963187
2
2
3
2,089
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.IndicatorConstPointwise #align_import measure_theory.constructions.borel_space.metrizable from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" open Filter MeasureTheory TopologicalSpace open scoped Classical open Topology NNReal ENNReal MeasureTheory variable {α β : Type*} [MeasurableSpace α] section Limits variable [TopologicalSpace β] [PseudoMetrizableSpace β] [MeasurableSpace β] [BorelSpace β] open Metric theorem measurable_of_tendsto_metrizable' {ι} {f : ι → α → β} {g : α → β} (u : Filter ι) [NeBot u] [IsCountablyGenerated u] (hf : ∀ i, Measurable (f i)) (lim : Tendsto f u (𝓝 g)) : Measurable g := by letI : PseudoMetricSpace β := pseudoMetrizableSpacePseudoMetric β apply measurable_of_isClosed' intro s h1s h2s h3s have : Measurable fun x => infNndist (g x) s := by suffices Tendsto (fun i x => infNndist (f i x) s) u (𝓝 fun x => infNndist (g x) s) from NNReal.measurable_of_tendsto' u (fun i => (hf i).infNndist) this rw [tendsto_pi_nhds] at lim ⊢ intro x exact ((continuous_infNndist_pt s).tendsto (g x)).comp (lim x) have h4s : g ⁻¹' s = (fun x => infNndist (g x) s) ⁻¹' {0} := by ext x simp [h1s, ← h1s.mem_iff_infDist_zero h2s, ← NNReal.coe_eq_zero] rw [h4s] exact this (measurableSet_singleton 0) #align measurable_of_tendsto_metrizable' measurable_of_tendsto_metrizable' theorem measurable_of_tendsto_metrizable {f : ℕ → α → β} {g : α → β} (hf : ∀ i, Measurable (f i)) (lim : Tendsto f atTop (𝓝 g)) : Measurable g := measurable_of_tendsto_metrizable' atTop hf lim #align measurable_of_tendsto_metrizable measurable_of_tendsto_metrizable theorem aemeasurable_of_tendsto_metrizable_ae {ι} {μ : Measure α} {f : ι → α → β} {g : α → β} (u : Filter ι) [hu : NeBot u] [IsCountablyGenerated u] (hf : ∀ n, AEMeasurable (f n) μ) (h_tendsto : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))) : AEMeasurable g μ := by rcases u.exists_seq_tendsto with ⟨v, hv⟩ have h'f : ∀ n, AEMeasurable (f (v n)) μ := fun n => hf (v n) set p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x)) have hp : ∀ᵐ x ∂μ, p x fun n => f (v n) x := by filter_upwards [h_tendsto] with x hx using hx.comp hv set aeSeqLim := fun x => ite (x ∈ aeSeqSet h'f p) (g x) (⟨f (v 0) x⟩ : Nonempty β).some refine ⟨aeSeqLim, measurable_of_tendsto_metrizable' atTop (aeSeq.measurable h'f p) (tendsto_pi_nhds.mpr fun x => ?_), ?_⟩ · simp_rw [aeSeqLim, aeSeq] split_ifs with hx · simp_rw [aeSeq.mk_eq_fun_of_mem_aeSeqSet h'f hx] exact @aeSeq.fun_prop_of_mem_aeSeqSet _ α β _ _ _ _ _ h'f x hx · exact tendsto_const_nhds · exact (ite_ae_eq_of_measure_compl_zero g (fun x => (⟨f (v 0) x⟩ : Nonempty β).some) (aeSeqSet h'f p) (aeSeq.measure_compl_aeSeqSet_eq_zero h'f hp)).symm #align ae_measurable_of_tendsto_metrizable_ae aemeasurable_of_tendsto_metrizable_ae theorem aemeasurable_of_tendsto_metrizable_ae' {μ : Measure α} {f : ℕ → α → β} {g : α → β} (hf : ∀ n, AEMeasurable (f n) μ) (h_ae_tendsto : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) atTop (𝓝 (g x))) : AEMeasurable g μ := aemeasurable_of_tendsto_metrizable_ae atTop hf h_ae_tendsto #align ae_measurable_of_tendsto_metrizable_ae' aemeasurable_of_tendsto_metrizable_ae'
Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean
87
101
theorem aemeasurable_of_unif_approx {β} [MeasurableSpace β] [PseudoMetricSpace β] [BorelSpace β] {μ : Measure α} {g : α → β} (hf : ∀ ε > (0 : ℝ), ∃ f : α → β, AEMeasurable f μ ∧ ∀ᵐ x ∂μ, dist (f x) (g x) ≤ ε) : AEMeasurable g μ := by
obtain ⟨u, -, u_pos, u_lim⟩ : ∃ u : ℕ → ℝ, StrictAnti u ∧ (∀ n : ℕ, 0 < u n) ∧ Tendsto u atTop (𝓝 0) := exists_seq_strictAnti_tendsto (0 : ℝ) choose f Hf using fun n : ℕ => hf (u n) (u_pos n) have : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) atTop (𝓝 (g x)) := by have : ∀ᵐ x ∂μ, ∀ n, dist (f n x) (g x) ≤ u n := ae_all_iff.2 fun n => (Hf n).2 filter_upwards [this] intro x hx rw [tendsto_iff_dist_tendsto_zero] exact squeeze_zero (fun n => dist_nonneg) hx u_lim exact aemeasurable_of_tendsto_metrizable_ae' (fun n => (Hf n).1) this
11
59,874.141715
2
2
3
2,089
import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.Order.Closure #align_import category_theory.sites.closed from "leanprover-community/mathlib"@"4cfc30e317caad46858393f1a7a33f609296cc30" universe v u namespace CategoryTheory variable {C : Type u} [Category.{v} C] variable (J₁ J₂ : GrothendieckTopology C) namespace GrothendieckTopology @[simps] def close {X : C} (S : Sieve X) : Sieve X where arrows _ f := J₁.Covers S f downward_closed hS := J₁.arrow_stable _ _ hS #align category_theory.grothendieck_topology.close CategoryTheory.GrothendieckTopology.close theorem le_close {X : C} (S : Sieve X) : S ≤ J₁.close S := fun _ _ hg => J₁.covering_of_eq_top (S.pullback_eq_top_of_mem hg) #align category_theory.grothendieck_topology.le_close CategoryTheory.GrothendieckTopology.le_close def IsClosed {X : C} (S : Sieve X) : Prop := ∀ ⦃Y : C⦄ (f : Y ⟶ X), J₁.Covers S f → S f #align category_theory.grothendieck_topology.is_closed CategoryTheory.GrothendieckTopology.IsClosed theorem covers_iff_mem_of_isClosed {X : C} {S : Sieve X} (h : J₁.IsClosed S) {Y : C} (f : Y ⟶ X) : J₁.Covers S f ↔ S f := ⟨h _, J₁.arrow_max _ _⟩ #align category_theory.grothendieck_topology.covers_iff_mem_of_closed CategoryTheory.GrothendieckTopology.covers_iff_mem_of_isClosed theorem isClosed_pullback {X Y : C} (f : Y ⟶ X) (S : Sieve X) : J₁.IsClosed S → J₁.IsClosed (S.pullback f) := fun hS Z g hg => hS (g ≫ f) (by rwa [J₁.covers_iff, Sieve.pullback_comp]) #align category_theory.grothendieck_topology.is_closed_pullback CategoryTheory.GrothendieckTopology.isClosed_pullback theorem le_close_of_isClosed {X : C} {S T : Sieve X} (h : S ≤ T) (hT : J₁.IsClosed T) : J₁.close S ≤ T := fun _ f hf => hT _ (J₁.superset_covering (Sieve.pullback_monotone f h) hf) #align category_theory.grothendieck_topology.le_close_of_is_closed CategoryTheory.GrothendieckTopology.le_close_of_isClosed theorem close_isClosed {X : C} (S : Sieve X) : J₁.IsClosed (J₁.close S) := fun _ g hg => J₁.arrow_trans g _ S hg fun _ hS => hS #align category_theory.grothendieck_topology.close_is_closed CategoryTheory.GrothendieckTopology.close_isClosed @[simps! isClosed] def closureOperator (X : C) : ClosureOperator (Sieve X) := .ofPred J₁.close J₁.IsClosed J₁.le_close J₁.close_isClosed fun _ _ ↦ J₁.le_close_of_isClosed #align category_theory.grothendieck_topology.closure_operator CategoryTheory.GrothendieckTopology.closureOperator #align category_theory.grothendieck_topology.closed_iff_closed CategoryTheory.GrothendieckTopology.closureOperator_isClosed theorem isClosed_iff_close_eq_self {X : C} (S : Sieve X) : J₁.IsClosed S ↔ J₁.close S = S := (J₁.closureOperator _).isClosed_iff #align category_theory.grothendieck_topology.is_closed_iff_close_eq_self CategoryTheory.GrothendieckTopology.isClosed_iff_close_eq_self theorem close_eq_self_of_isClosed {X : C} {S : Sieve X} (hS : J₁.IsClosed S) : J₁.close S = S := (J₁.isClosed_iff_close_eq_self S).1 hS #align category_theory.grothendieck_topology.close_eq_self_of_is_closed CategoryTheory.GrothendieckTopology.close_eq_self_of_isClosed
Mathlib/CategoryTheory/Sites/Closed.lean
124
132
theorem pullback_close {X Y : C} (f : Y ⟶ X) (S : Sieve X) : J₁.close (S.pullback f) = (J₁.close S).pullback f := by
apply le_antisymm · refine J₁.le_close_of_isClosed (Sieve.pullback_monotone _ (J₁.le_close S)) ?_ apply J₁.isClosed_pullback _ _ (J₁.close_isClosed _) · intro Z g hg change _ ∈ J₁ _ rw [← Sieve.pullback_comp] apply hg
7
1,096.633158
2
2
2
2,090
import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.Order.Closure #align_import category_theory.sites.closed from "leanprover-community/mathlib"@"4cfc30e317caad46858393f1a7a33f609296cc30" universe v u namespace CategoryTheory variable {C : Type u} [Category.{v} C] variable (J₁ J₂ : GrothendieckTopology C) namespace GrothendieckTopology @[simps] def close {X : C} (S : Sieve X) : Sieve X where arrows _ f := J₁.Covers S f downward_closed hS := J₁.arrow_stable _ _ hS #align category_theory.grothendieck_topology.close CategoryTheory.GrothendieckTopology.close theorem le_close {X : C} (S : Sieve X) : S ≤ J₁.close S := fun _ _ hg => J₁.covering_of_eq_top (S.pullback_eq_top_of_mem hg) #align category_theory.grothendieck_topology.le_close CategoryTheory.GrothendieckTopology.le_close def IsClosed {X : C} (S : Sieve X) : Prop := ∀ ⦃Y : C⦄ (f : Y ⟶ X), J₁.Covers S f → S f #align category_theory.grothendieck_topology.is_closed CategoryTheory.GrothendieckTopology.IsClosed theorem covers_iff_mem_of_isClosed {X : C} {S : Sieve X} (h : J₁.IsClosed S) {Y : C} (f : Y ⟶ X) : J₁.Covers S f ↔ S f := ⟨h _, J₁.arrow_max _ _⟩ #align category_theory.grothendieck_topology.covers_iff_mem_of_closed CategoryTheory.GrothendieckTopology.covers_iff_mem_of_isClosed theorem isClosed_pullback {X Y : C} (f : Y ⟶ X) (S : Sieve X) : J₁.IsClosed S → J₁.IsClosed (S.pullback f) := fun hS Z g hg => hS (g ≫ f) (by rwa [J₁.covers_iff, Sieve.pullback_comp]) #align category_theory.grothendieck_topology.is_closed_pullback CategoryTheory.GrothendieckTopology.isClosed_pullback theorem le_close_of_isClosed {X : C} {S T : Sieve X} (h : S ≤ T) (hT : J₁.IsClosed T) : J₁.close S ≤ T := fun _ f hf => hT _ (J₁.superset_covering (Sieve.pullback_monotone f h) hf) #align category_theory.grothendieck_topology.le_close_of_is_closed CategoryTheory.GrothendieckTopology.le_close_of_isClosed theorem close_isClosed {X : C} (S : Sieve X) : J₁.IsClosed (J₁.close S) := fun _ g hg => J₁.arrow_trans g _ S hg fun _ hS => hS #align category_theory.grothendieck_topology.close_is_closed CategoryTheory.GrothendieckTopology.close_isClosed @[simps! isClosed] def closureOperator (X : C) : ClosureOperator (Sieve X) := .ofPred J₁.close J₁.IsClosed J₁.le_close J₁.close_isClosed fun _ _ ↦ J₁.le_close_of_isClosed #align category_theory.grothendieck_topology.closure_operator CategoryTheory.GrothendieckTopology.closureOperator #align category_theory.grothendieck_topology.closed_iff_closed CategoryTheory.GrothendieckTopology.closureOperator_isClosed theorem isClosed_iff_close_eq_self {X : C} (S : Sieve X) : J₁.IsClosed S ↔ J₁.close S = S := (J₁.closureOperator _).isClosed_iff #align category_theory.grothendieck_topology.is_closed_iff_close_eq_self CategoryTheory.GrothendieckTopology.isClosed_iff_close_eq_self theorem close_eq_self_of_isClosed {X : C} {S : Sieve X} (hS : J₁.IsClosed S) : J₁.close S = S := (J₁.isClosed_iff_close_eq_self S).1 hS #align category_theory.grothendieck_topology.close_eq_self_of_is_closed CategoryTheory.GrothendieckTopology.close_eq_self_of_isClosed theorem pullback_close {X Y : C} (f : Y ⟶ X) (S : Sieve X) : J₁.close (S.pullback f) = (J₁.close S).pullback f := by apply le_antisymm · refine J₁.le_close_of_isClosed (Sieve.pullback_monotone _ (J₁.le_close S)) ?_ apply J₁.isClosed_pullback _ _ (J₁.close_isClosed _) · intro Z g hg change _ ∈ J₁ _ rw [← Sieve.pullback_comp] apply hg #align category_theory.grothendieck_topology.pullback_close CategoryTheory.GrothendieckTopology.pullback_close @[mono] theorem monotone_close {X : C} : Monotone (J₁.close : Sieve X → Sieve X) := (J₁.closureOperator _).monotone #align category_theory.grothendieck_topology.monotone_close CategoryTheory.GrothendieckTopology.monotone_close @[simp] theorem close_close {X : C} (S : Sieve X) : J₁.close (J₁.close S) = J₁.close S := (J₁.closureOperator _).idempotent _ #align category_theory.grothendieck_topology.close_close CategoryTheory.GrothendieckTopology.close_close
Mathlib/CategoryTheory/Sites/Closed.lean
149
159
theorem close_eq_top_iff_mem {X : C} (S : Sieve X) : J₁.close S = ⊤ ↔ S ∈ J₁ X := by
constructor · intro h apply J₁.transitive (J₁.top_mem X) intro Y f hf change J₁.close S f rwa [h] · intro hS rw [eq_top_iff] intro Y f _ apply J₁.pullback_stable _ hS
10
22,026.465795
2
2
2
2,090
import Mathlib.Analysis.NormedSpace.Star.ContinuousFunctionalCalculus.Restrict import Mathlib.Analysis.NormedSpace.Star.ContinuousFunctionalCalculus import Mathlib.Analysis.NormedSpace.Star.Spectrum import Mathlib.Analysis.NormedSpace.Star.Unitization import Mathlib.Topology.ContinuousFunction.UniqueCFC noncomputable section local notation "σₙ" => quasispectrum local notation "σ" => spectrum section RCLike variable {𝕜 A : Type*} [RCLike 𝕜] [NonUnitalNormedRing A] [StarRing A] [CstarRing A] variable [CompleteSpace A] [NormedSpace 𝕜 A] [IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A] variable [StarModule 𝕜 A] {p : A → Prop} {p₁ : Unitization 𝕜 A → Prop} local postfix:max "⁺¹" => Unitization 𝕜 variable (hp₁ : ∀ {x : A}, p₁ x ↔ p x) (a : A) (ha : p a) variable [ContinuousFunctionalCalculus 𝕜 p₁] open scoped ContinuousMapZero open Unitization in noncomputable def cfcₙAux : C(σₙ 𝕜 a, 𝕜)₀ →⋆ₙₐ[𝕜] A⁺¹ := (cfcHom (R := 𝕜) (hp₁.mpr ha) : C(σ 𝕜 (a : A⁺¹), 𝕜) →⋆ₙₐ[𝕜] A⁺¹) |>.comp (Homeomorph.compStarAlgEquiv' 𝕜 𝕜 <| .setCongr <| (quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a).symm) |>.comp ContinuousMapZero.toContinuousMapHom lemma cfcₙAux_id : cfcₙAux hp₁ a ha (ContinuousMapZero.id rfl) = a := cfcHom_id (hp₁.mpr ha) open Unitization in lemma closedEmbedding_cfcₙAux : ClosedEmbedding (cfcₙAux hp₁ a ha) := by simp only [cfcₙAux, NonUnitalStarAlgHom.coe_comp] refine ((cfcHom_closedEmbedding (hp₁.mpr ha)).comp ?_).comp ContinuousMapZero.closedEmbedding_toContinuousMap let e : C(σₙ 𝕜 a, 𝕜) ≃ₜ C(σ 𝕜 (a : A⁺¹), 𝕜) := { (Homeomorph.compStarAlgEquiv' 𝕜 𝕜 <| .setCongr <| (quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a).symm) with continuous_toFun := ContinuousMap.continuous_comp_left _ continuous_invFun := ContinuousMap.continuous_comp_left _ } exact e.closedEmbedding lemma spec_cfcₙAux (f : C(σₙ 𝕜 a, 𝕜)₀) : σ 𝕜 (cfcₙAux hp₁ a ha f) = Set.range f := by rw [cfcₙAux, NonUnitalStarAlgHom.comp_assoc, NonUnitalStarAlgHom.comp_apply] simp only [NonUnitalStarAlgHom.comp_apply, NonUnitalStarAlgHom.coe_coe] rw [cfcHom_map_spectrum (hp₁.mpr ha) (R := 𝕜) _] ext x constructor all_goals rintro ⟨x, rfl⟩ · exact ⟨⟨x, (Unitization.quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a).symm ▸ x.property⟩, rfl⟩ · exact ⟨⟨x, Unitization.quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a ▸ x.property⟩, rfl⟩ lemma cfcₙAux_mem_range_inr (f : C(σₙ 𝕜 a, 𝕜)₀) : cfcₙAux hp₁ a ha f ∈ NonUnitalStarAlgHom.range (Unitization.inrNonUnitalStarAlgHom 𝕜 A) := by have h₁ := (closedEmbedding_cfcₙAux hp₁ a ha).continuous.range_subset_closure_image_dense (ContinuousMapZero.adjoin_id_dense (s := σₙ 𝕜 a) rfl) ⟨f, rfl⟩ rw [← SetLike.mem_coe] refine closure_minimal ?_ ?_ h₁ · rw [← NonUnitalStarSubalgebra.coe_map, SetLike.coe_subset_coe, NonUnitalStarSubalgebra.map_le] apply NonUnitalStarAlgebra.adjoin_le apply Set.singleton_subset_iff.mpr rw [SetLike.mem_coe, NonUnitalStarSubalgebra.mem_comap, cfcₙAux_id hp₁ a ha] exact ⟨a, rfl⟩ · have : Continuous (Unitization.fst (R := 𝕜) (A := A)) := Unitization.uniformEquivProd.continuous.fst simp only [NonUnitalStarAlgHom.coe_range] convert IsClosed.preimage this (isClosed_singleton (x := 0)) aesop open Unitization NonUnitalStarAlgHom in
Mathlib/Analysis/NormedSpace/Star/ContinuousFunctionalCalculus/Instances.lean
120
136
theorem RCLike.nonUnitalContinuousFunctionalCalculus : NonUnitalContinuousFunctionalCalculus 𝕜 (p : A → Prop) where exists_cfc_of_predicate a ha := by
let ψ : C(σₙ 𝕜 a, 𝕜)₀ →⋆ₙₐ[𝕜] A := comp (inrRangeEquiv 𝕜 A).symm <| codRestrict (cfcₙAux hp₁ a ha) _ (cfcₙAux_mem_range_inr hp₁ a ha) have coe_ψ (f : C(σₙ 𝕜 a, 𝕜)₀) : ψ f = cfcₙAux hp₁ a ha f := congr_arg Subtype.val <| (inrRangeEquiv 𝕜 A).apply_symm_apply ⟨cfcₙAux hp₁ a ha f, cfcₙAux_mem_range_inr hp₁ a ha f⟩ refine ⟨ψ, ?closedEmbedding, ?map_id, fun f ↦ ?map_spec, fun f ↦ ?isStarNormal⟩ case closedEmbedding => apply isometry_inr (𝕜 := 𝕜) (A := A) |>.closedEmbedding |>.of_comp_iff.mp have : inr ∘ ψ = cfcₙAux hp₁ a ha := by ext1; rw [Function.comp_apply, coe_ψ] exact this ▸ closedEmbedding_cfcₙAux hp₁ a ha case map_id => exact inr_injective (R := 𝕜) <| coe_ψ _ ▸ cfcₙAux_id hp₁ a ha case map_spec => exact quasispectrum_eq_spectrum_inr' 𝕜 𝕜 (ψ f) ▸ coe_ψ _ ▸ spec_cfcₙAux hp₁ a ha f case isStarNormal => exact hp₁.mp <| coe_ψ _ ▸ cfcHom_predicate (R := 𝕜) (hp₁.mpr ha) _
14
1,202,604.284165
2
2
1
2,091
import Mathlib.Geometry.Manifold.Algebra.Structures import Mathlib.Geometry.Manifold.BumpFunction import Mathlib.Topology.MetricSpace.PartitionOfUnity import Mathlib.Topology.ShrinkingLemma #align_import geometry.manifold.partition_of_unity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" universe uι uE uH uM uF open Function Filter FiniteDimensional Set open scoped Topology Manifold Classical Filter noncomputable section variable {ι : Type uι} {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace ℝ F] {H : Type uH} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) {M : Type uM} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] variable (ι M) -- Porting note(#5171): was @[nolint has_nonempty_instance] structure SmoothBumpCovering (s : Set M := univ) where c : ι → M toFun : ∀ i, SmoothBumpFunction I (c i) c_mem' : ∀ i, c i ∈ s locallyFinite' : LocallyFinite fun i => support (toFun i) eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1 #align smooth_bump_covering SmoothBumpCovering structure SmoothPartitionOfUnity (s : Set M := univ) where toFun : ι → C^∞⟮I, M; 𝓘(ℝ), ℝ⟯ locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : ∀ i x, 0 ≤ toFun i x sum_eq_one' : ∀ x ∈ s, ∑ᶠ i, toFun i x = 1 sum_le_one' : ∀ x, ∑ᶠ i, toFun i x ≤ 1 #align smooth_partition_of_unity SmoothPartitionOfUnity variable {ι I M} namespace SmoothPartitionOfUnity variable {s : Set M} (f : SmoothPartitionOfUnity ι I M s) {n : ℕ∞} instance {s : Set M} : FunLike (SmoothPartitionOfUnity ι I M s) ι C^∞⟮I, M; 𝓘(ℝ), ℝ⟯ where coe := toFun coe_injective' f g h := by cases f; cases g; congr protected theorem locallyFinite : LocallyFinite fun i => support (f i) := f.locallyFinite' #align smooth_partition_of_unity.locally_finite SmoothPartitionOfUnity.locallyFinite theorem nonneg (i : ι) (x : M) : 0 ≤ f i x := f.nonneg' i x #align smooth_partition_of_unity.nonneg SmoothPartitionOfUnity.nonneg theorem sum_eq_one {x} (hx : x ∈ s) : ∑ᶠ i, f i x = 1 := f.sum_eq_one' x hx #align smooth_partition_of_unity.sum_eq_one SmoothPartitionOfUnity.sum_eq_one
Mathlib/Geometry/Manifold/PartitionOfUnity.lean
157
162
theorem exists_pos_of_mem {x} (hx : x ∈ s) : ∃ i, 0 < f i x := by
by_contra! h have H : ∀ i, f i x = 0 := fun i ↦ le_antisymm (h i) (f.nonneg i x) have := f.sum_eq_one hx simp_rw [H] at this simpa
5
148.413159
2
2
1
2,092
import Mathlib.FieldTheory.Finite.Basic #align_import field_theory.chevalley_warning from "leanprover-community/mathlib"@"e001509c11c4d0f549d91d89da95b4a0b43c714f" universe u v section FiniteField open MvPolynomial open Function hiding eval open Finset FiniteField variable {K σ ι : Type*} [Fintype K] [Field K] [Fintype σ] [DecidableEq σ] local notation "q" => Fintype.card K
Mathlib/FieldTheory/ChevalleyWarning.lean
53
97
theorem MvPolynomial.sum_eval_eq_zero (f : MvPolynomial σ K) (h : f.totalDegree < (q - 1) * Fintype.card σ) : ∑ x, eval x f = 0 := by
haveI : DecidableEq K := Classical.decEq K calc ∑ x, eval x f = ∑ x : σ → K, ∑ d ∈ f.support, f.coeff d * ∏ i, x i ^ d i := by simp only [eval_eq'] _ = ∑ d ∈ f.support, ∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i := sum_comm _ = 0 := sum_eq_zero ?_ intro d hd obtain ⟨i, hi⟩ : ∃ i, d i < q - 1 := f.exists_degree_lt (q - 1) h hd calc (∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i) = f.coeff d * ∑ x : σ → K, ∏ i, x i ^ d i := (mul_sum ..).symm _ = 0 := (mul_eq_zero.mpr ∘ Or.inr) ?_ calc (∑ x : σ → K, ∏ i, x i ^ d i) = ∑ x₀ : { j // j ≠ i } → K, ∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j := (Fintype.sum_fiberwise _ _).symm _ = 0 := Fintype.sum_eq_zero _ ?_ intro x₀ let e : K ≃ { x // x ∘ ((↑) : _ → σ) = x₀ } := (Equiv.subtypeEquivCodomain _).symm calc (∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j) = ∑ a : K, ∏ j : σ, (e a : σ → K) j ^ d j := (e.sum_comp _).symm _ = ∑ a : K, (∏ j, x₀ j ^ d j) * a ^ d i := Fintype.sum_congr _ _ ?_ _ = (∏ j, x₀ j ^ d j) * ∑ a : K, a ^ d i := by rw [mul_sum] _ = 0 := by rw [sum_pow_lt_card_sub_one K _ hi, mul_zero] intro a let e' : Sum { j // j = i } { j // j ≠ i } ≃ σ := Equiv.sumCompl _ letI : Unique { j // j = i } := { default := ⟨i, rfl⟩ uniq := fun ⟨j, h⟩ => Subtype.val_injective h } calc (∏ j : σ, (e a : σ → K) j ^ d j) = (e a : σ → K) i ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [← e'.prod_comp, Fintype.prod_sum_type, univ_unique, prod_singleton]; rfl _ = a ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [Equiv.subtypeEquivCodomain_symm_apply_eq] _ = a ^ d i * ∏ j, x₀ j ^ d j := congr_arg _ (Fintype.prod_congr _ _ ?_) -- see below _ = (∏ j, x₀ j ^ d j) * a ^ d i := mul_comm _ _ -- the remaining step of the calculation above rintro ⟨j, hj⟩ show (e a : σ → K) j ^ d j = x₀ ⟨j, hj⟩ ^ d j rw [Equiv.subtypeEquivCodomain_symm_apply_ne]
43
4,727,839,468,229,346,000
2
2
2
2,093
import Mathlib.FieldTheory.Finite.Basic #align_import field_theory.chevalley_warning from "leanprover-community/mathlib"@"e001509c11c4d0f549d91d89da95b4a0b43c714f" universe u v section FiniteField open MvPolynomial open Function hiding eval open Finset FiniteField variable {K σ ι : Type*} [Fintype K] [Field K] [Fintype σ] [DecidableEq σ] local notation "q" => Fintype.card K theorem MvPolynomial.sum_eval_eq_zero (f : MvPolynomial σ K) (h : f.totalDegree < (q - 1) * Fintype.card σ) : ∑ x, eval x f = 0 := by haveI : DecidableEq K := Classical.decEq K calc ∑ x, eval x f = ∑ x : σ → K, ∑ d ∈ f.support, f.coeff d * ∏ i, x i ^ d i := by simp only [eval_eq'] _ = ∑ d ∈ f.support, ∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i := sum_comm _ = 0 := sum_eq_zero ?_ intro d hd obtain ⟨i, hi⟩ : ∃ i, d i < q - 1 := f.exists_degree_lt (q - 1) h hd calc (∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i) = f.coeff d * ∑ x : σ → K, ∏ i, x i ^ d i := (mul_sum ..).symm _ = 0 := (mul_eq_zero.mpr ∘ Or.inr) ?_ calc (∑ x : σ → K, ∏ i, x i ^ d i) = ∑ x₀ : { j // j ≠ i } → K, ∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j := (Fintype.sum_fiberwise _ _).symm _ = 0 := Fintype.sum_eq_zero _ ?_ intro x₀ let e : K ≃ { x // x ∘ ((↑) : _ → σ) = x₀ } := (Equiv.subtypeEquivCodomain _).symm calc (∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j) = ∑ a : K, ∏ j : σ, (e a : σ → K) j ^ d j := (e.sum_comp _).symm _ = ∑ a : K, (∏ j, x₀ j ^ d j) * a ^ d i := Fintype.sum_congr _ _ ?_ _ = (∏ j, x₀ j ^ d j) * ∑ a : K, a ^ d i := by rw [mul_sum] _ = 0 := by rw [sum_pow_lt_card_sub_one K _ hi, mul_zero] intro a let e' : Sum { j // j = i } { j // j ≠ i } ≃ σ := Equiv.sumCompl _ letI : Unique { j // j = i } := { default := ⟨i, rfl⟩ uniq := fun ⟨j, h⟩ => Subtype.val_injective h } calc (∏ j : σ, (e a : σ → K) j ^ d j) = (e a : σ → K) i ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [← e'.prod_comp, Fintype.prod_sum_type, univ_unique, prod_singleton]; rfl _ = a ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [Equiv.subtypeEquivCodomain_symm_apply_eq] _ = a ^ d i * ∏ j, x₀ j ^ d j := congr_arg _ (Fintype.prod_congr _ _ ?_) -- see below _ = (∏ j, x₀ j ^ d j) * a ^ d i := mul_comm _ _ -- the remaining step of the calculation above rintro ⟨j, hj⟩ show (e a : σ → K) j ^ d j = x₀ ⟨j, hj⟩ ^ d j rw [Equiv.subtypeEquivCodomain_symm_apply_ne] #align mv_polynomial.sum_eval_eq_zero MvPolynomial.sum_eval_eq_zero variable [DecidableEq K] (p : ℕ) [CharP K p]
Mathlib/FieldTheory/ChevalleyWarning.lean
107
160
theorem char_dvd_card_solutions_of_sum_lt {s : Finset ι} {f : ι → MvPolynomial σ K} (h : (∑ i ∈ s, (f i).totalDegree) < Fintype.card σ) : p ∣ Fintype.card { x : σ → K // ∀ i ∈ s, eval x (f i) = 0 } := by
have hq : 0 < q - 1 := by rw [← Fintype.card_units, Fintype.card_pos_iff]; exact ⟨1⟩ let S : Finset (σ → K) := { x ∈ univ | ∀ i ∈ s, eval x (f i) = 0 }.toFinset have hS : ∀ x : σ → K, x ∈ S ↔ ∀ i : ι, i ∈ s → eval x (f i) = 0 := by intro x simp only [S, Set.toFinset_setOf, mem_univ, true_and, mem_filter] /- The polynomial `F = ∏ i ∈ s, (1 - (f i)^(q - 1))` has the nice property that it takes the value `1` on elements of `{x : σ → K // ∀ i ∈ s, (f i).eval x = 0}` while it is `0` outside that locus. Hence the sum of its values is equal to the cardinality of `{x : σ → K // ∀ i ∈ s, (f i).eval x = 0}` modulo `p`. -/ let F : MvPolynomial σ K := ∏ i ∈ s, (1 - f i ^ (q - 1)) have hF : ∀ x, eval x F = if x ∈ S then 1 else 0 := by intro x calc eval x F = ∏ i ∈ s, eval x (1 - f i ^ (q - 1)) := eval_prod s _ x _ = if x ∈ S then 1 else 0 := ?_ simp only [(eval x).map_sub, (eval x).map_pow, (eval x).map_one] split_ifs with hx · apply Finset.prod_eq_one intro i hi rw [hS] at hx rw [hx i hi, zero_pow hq.ne', sub_zero] · obtain ⟨i, hi, hx⟩ : ∃ i ∈ s, eval x (f i) ≠ 0 := by simpa [hS, not_forall, Classical.not_imp] using hx apply Finset.prod_eq_zero hi rw [pow_card_sub_one_eq_one (eval x (f i)) hx, sub_self] -- In particular, we can now show: have key : ∑ x, eval x F = Fintype.card { x : σ → K // ∀ i ∈ s, eval x (f i) = 0 } := by rw [Fintype.card_of_subtype S hS, card_eq_sum_ones, Nat.cast_sum, Nat.cast_one, ← Fintype.sum_extend_by_zero S, sum_congr rfl fun x _ => hF x] -- With these preparations under our belt, we will approach the main goal. show p ∣ Fintype.card { x // ∀ i : ι, i ∈ s → eval x (f i) = 0 } rw [← CharP.cast_eq_zero_iff K, ← key] show (∑ x, eval x F) = 0 -- We are now ready to apply the main machine, proven before. apply F.sum_eval_eq_zero -- It remains to verify the crucial assumption of this machine show F.totalDegree < (q - 1) * Fintype.card σ calc F.totalDegree ≤ ∑ i ∈ s, (1 - f i ^ (q - 1)).totalDegree := totalDegree_finset_prod s _ _ ≤ ∑ i ∈ s, (q - 1) * (f i).totalDegree := sum_le_sum fun i _ => ?_ -- see ↓ _ = (q - 1) * ∑ i ∈ s, (f i).totalDegree := (mul_sum ..).symm _ < (q - 1) * Fintype.card σ := by rwa [mul_lt_mul_left hq] -- Now we prove the remaining step from the preceding calculation show (1 - f i ^ (q - 1)).totalDegree ≤ (q - 1) * (f i).totalDegree calc (1 - f i ^ (q - 1)).totalDegree ≤ max (1 : MvPolynomial σ K).totalDegree (f i ^ (q - 1)).totalDegree := totalDegree_sub _ _ _ ≤ (f i ^ (q - 1)).totalDegree := by simp _ ≤ (q - 1) * (f i).totalDegree := totalDegree_pow _ _
51
14,093,490,824,269,389,000,000
2
2
2
2,093
import Mathlib.Analysis.NormedSpace.ConformalLinearMap import Mathlib.Analysis.InnerProductSpace.Basic #align_import analysis.inner_product_space.conformal_linear_map from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" variable {E F : Type*} variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable [InnerProductSpace ℝ E] [InnerProductSpace ℝ F] open LinearIsometry ContinuousLinearMap open RealInnerProductSpace
Mathlib/Analysis/InnerProductSpace/ConformalLinearMap.lean
29
43
theorem isConformalMap_iff (f : E →L[ℝ] F) : IsConformalMap f ↔ ∃ c : ℝ, 0 < c ∧ ∀ u v : E, ⟪f u, f v⟫ = c * ⟪u, v⟫ := by
constructor · rintro ⟨c₁, hc₁, li, rfl⟩ refine ⟨c₁ * c₁, mul_self_pos.2 hc₁, fun u v => ?_⟩ simp only [real_inner_smul_left, real_inner_smul_right, mul_assoc, coe_smul', coe_toContinuousLinearMap, Pi.smul_apply, inner_map_map] · rintro ⟨c₁, hc₁, huv⟩ obtain ⟨c, hc, rfl⟩ : ∃ c : ℝ, 0 < c ∧ c₁ = c * c := ⟨√c₁, Real.sqrt_pos.2 hc₁, (Real.mul_self_sqrt hc₁.le).symm⟩ refine ⟨c, hc.ne', (c⁻¹ • f : E →ₗ[ℝ] F).isometryOfInner fun u v => ?_, ?_⟩ · simp only [real_inner_smul_left, real_inner_smul_right, huv, mul_assoc, coe_smul, inv_mul_cancel_left₀ hc.ne', LinearMap.smul_apply, ContinuousLinearMap.coe_coe] · ext1 x exact (smul_inv_smul₀ hc.ne' (f x)).symm
13
442,413.392009
2
2
1
2,094
import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic import Mathlib.CategoryTheory.Preadditive.Projective import Mathlib.Algebra.Category.GroupCat.EpiMono #align_import category_theory.preadditive.yoneda.projective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946" universe v u open Opposite namespace CategoryTheory variable {C : Type u} [Category.{v} C] section Preadditive variable [Preadditive C] namespace Projective
Mathlib/CategoryTheory/Preadditive/Yoneda/Projective.lean
31
39
theorem projective_iff_preservesEpimorphisms_preadditiveCoyoneda_obj (P : C) : Projective P ↔ (preadditiveCoyoneda.obj (op P)).PreservesEpimorphisms := by
rw [projective_iff_preservesEpimorphisms_coyoneda_obj] refine ⟨fun h : (preadditiveCoyoneda.obj (op P) ⋙ forget AddCommGroupCat).PreservesEpimorphisms => ?_, ?_⟩ · exact Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveCoyoneda.obj (op P)) (forget _) · intro exact (inferInstance : (preadditiveCoyoneda.obj (op P) ⋙ forget _).PreservesEpimorphisms)
7
1,096.633158
2
2
2
2,095
import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic import Mathlib.CategoryTheory.Preadditive.Projective import Mathlib.Algebra.Category.GroupCat.EpiMono #align_import category_theory.preadditive.yoneda.projective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946" universe v u open Opposite namespace CategoryTheory variable {C : Type u} [Category.{v} C] section Preadditive variable [Preadditive C] namespace Projective theorem projective_iff_preservesEpimorphisms_preadditiveCoyoneda_obj (P : C) : Projective P ↔ (preadditiveCoyoneda.obj (op P)).PreservesEpimorphisms := by rw [projective_iff_preservesEpimorphisms_coyoneda_obj] refine ⟨fun h : (preadditiveCoyoneda.obj (op P) ⋙ forget AddCommGroupCat).PreservesEpimorphisms => ?_, ?_⟩ · exact Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveCoyoneda.obj (op P)) (forget _) · intro exact (inferInstance : (preadditiveCoyoneda.obj (op P) ⋙ forget _).PreservesEpimorphisms) #align category_theory.projective.projective_iff_preserves_epimorphisms_preadditive_coyoneda_obj CategoryTheory.Projective.projective_iff_preservesEpimorphisms_preadditiveCoyoneda_obj
Mathlib/CategoryTheory/Preadditive/Yoneda/Projective.lean
42
50
theorem projective_iff_preservesEpimorphisms_preadditiveCoyoneda_obj' (P : C) : Projective P ↔ (preadditiveCoyoneda.obj (op P)).PreservesEpimorphisms := by
rw [projective_iff_preservesEpimorphisms_coyoneda_obj] refine ⟨fun h : (preadditiveCoyoneda.obj (op P) ⋙ forget AddCommGroupCat).PreservesEpimorphisms => ?_, ?_⟩ · exact Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveCoyoneda.obj (op P)) (forget _) · intro exact (inferInstance : (preadditiveCoyoneda.obj (op P) ⋙ forget _).PreservesEpimorphisms)
7
1,096.633158
2
2
2
2,095
import Mathlib.CategoryTheory.Adjunction.Reflective import Mathlib.Topology.StoneCech import Mathlib.CategoryTheory.Monad.Limits import Mathlib.Topology.UrysohnsLemma import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.Data.Set.Subsingleton import Mathlib.CategoryTheory.Elementwise #align_import topology.category.CompHaus.basic from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" universe v u -- This was a global instance prior to #13170. We may experiment with removing it. attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike open CategoryTheory structure CompHaus where toTop : TopCat -- Porting note: Renamed field. [is_compact : CompactSpace toTop] [is_hausdorff : T2Space toTop] set_option linter.uppercaseLean3 false in #align CompHaus CompHaus namespace CompHaus instance : Inhabited CompHaus := ⟨{ toTop := { α := PEmpty } }⟩ instance : CoeSort CompHaus Type* := ⟨fun X => X.toTop⟩ instance {X : CompHaus} : CompactSpace X := X.is_compact instance {X : CompHaus} : T2Space X := X.is_hausdorff instance category : Category CompHaus := InducedCategory.category toTop set_option linter.uppercaseLean3 false in #align CompHaus.category CompHaus.category instance concreteCategory : ConcreteCategory CompHaus := InducedCategory.concreteCategory _ set_option linter.uppercaseLean3 false in #align CompHaus.concrete_category CompHaus.concreteCategory variable (X : Type*) [TopologicalSpace X] [CompactSpace X] [T2Space X] def of : CompHaus where toTop := TopCat.of X is_compact := ‹_› is_hausdorff := ‹_› set_option linter.uppercaseLean3 false in #align CompHaus.of CompHaus.of @[simp] theorem coe_of : (CompHaus.of X : Type _) = X := rfl set_option linter.uppercaseLean3 false in #align CompHaus.coe_of CompHaus.coe_of -- Porting note (#10754): Adding instance instance (X : CompHaus.{u}) : TopologicalSpace ((forget CompHaus).obj X) := show TopologicalSpace X.toTop from inferInstance -- Porting note (#10754): Adding instance instance (X : CompHaus.{u}) : CompactSpace ((forget CompHaus).obj X) := show CompactSpace X.toTop from inferInstance -- Porting note (#10754): Adding instance instance (X : CompHaus.{u}) : T2Space ((forget CompHaus).obj X) := show T2Space X.toTop from inferInstance theorem isClosedMap {X Y : CompHaus.{u}} (f : X ⟶ Y) : IsClosedMap f := fun _ hC => (hC.isCompact.image f.continuous).isClosed set_option linter.uppercaseLean3 false in #align CompHaus.is_closed_map CompHaus.isClosedMap
Mathlib/Topology/Category/CompHaus/Basic.lean
123
135
theorem isIso_of_bijective {X Y : CompHaus.{u}} (f : X ⟶ Y) (bij : Function.Bijective f) : IsIso f := by
let E := Equiv.ofBijective _ bij have hE : Continuous E.symm := by rw [continuous_iff_isClosed] intro S hS rw [← E.image_eq_preimage] exact isClosedMap f S hS refine ⟨⟨⟨E.symm, hE⟩, ?_, ?_⟩⟩ · ext x apply E.symm_apply_apply · ext x apply E.apply_symm_apply
11
59,874.141715
2
2
1
2,096
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic import Mathlib.MeasureTheory.Covering.VitaliFamily import Mathlib.Data.Set.Pairwise.Lattice #align_import measure_theory.covering.vitali from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" variable {α ι : Type*} open Set Metric MeasureTheory TopologicalSpace Filter open scoped NNReal Classical ENNReal Topology namespace Vitali
Mathlib/MeasureTheory/Covering/Vitali.lean
58
153
theorem exists_disjoint_subfamily_covering_enlargment (B : ι → Set α) (t : Set ι) (δ : ι → ℝ) (τ : ℝ) (hτ : 1 < τ) (δnonneg : ∀ a ∈ t, 0 ≤ δ a) (R : ℝ) (δle : ∀ a ∈ t, δ a ≤ R) (hne : ∀ a ∈ t, (B a).Nonempty) : ∃ u ⊆ t, u.PairwiseDisjoint B ∧ ∀ a ∈ t, ∃ b ∈ u, (B a ∩ B b).Nonempty ∧ δ a ≤ τ * δ b := by
/- The proof could be formulated as a transfinite induction. First pick an element of `t` with `δ` as large as possible (up to a factor of `τ`). Then among the remaining elements not intersecting the already chosen one, pick another element with large `δ`. Go on forever (transfinitely) until there is nothing left. Instead, we give a direct Zorn-based argument. Consider a maximal family `u` of disjoint sets with the following property: if an element `a` of `t` intersects some element `b` of `u`, then it intersects some `b' ∈ u` with `δ b' ≥ δ a / τ`. Such a maximal family exists by Zorn. If this family did not intersect some element `a ∈ t`, then take an element `a' ∈ t` which does not intersect any element of `u`, with `δ a'` almost as large as possible. One checks easily that `u ∪ {a'}` still has this property, contradicting the maximality. Therefore, `u` intersects all elements of `t`, and by definition it satisfies all the desired properties. -/ let T : Set (Set ι) := { u | u ⊆ t ∧ u.PairwiseDisjoint B ∧ ∀ a ∈ t, ∀ b ∈ u, (B a ∩ B b).Nonempty → ∃ c ∈ u, (B a ∩ B c).Nonempty ∧ δ a ≤ τ * δ c } -- By Zorn, choose a maximal family in the good set `T` of disjoint families. obtain ⟨u, uT, hu⟩ : ∃ u ∈ T, ∀ v ∈ T, u ⊆ v → v = u := by refine zorn_subset _ fun U UT hU => ?_ refine ⟨⋃₀ U, ?_, fun s hs => subset_sUnion_of_mem hs⟩ simp only [T, Set.sUnion_subset_iff, and_imp, exists_prop, forall_exists_index, mem_sUnion, Set.mem_setOf_eq] refine ⟨fun u hu => (UT hu).1, (pairwiseDisjoint_sUnion hU.directedOn).2 fun u hu => (UT hu).2.1, fun a hat b u uU hbu hab => ?_⟩ obtain ⟨c, cu, ac, hc⟩ : ∃ c, c ∈ u ∧ (B a ∩ B c).Nonempty ∧ δ a ≤ τ * δ c := (UT uU).2.2 a hat b hbu hab exact ⟨c, ⟨u, uU, cu⟩, ac, hc⟩ -- The only nontrivial bit is to check that every `a ∈ t` intersects an element `b ∈ u` with -- comparatively large `δ b`. Assume this is not the case, then we will contradict the maximality. refine ⟨u, uT.1, uT.2.1, fun a hat => ?_⟩ contrapose! hu have a_disj : ∀ c ∈ u, Disjoint (B a) (B c) := by intro c hc by_contra h rw [not_disjoint_iff_nonempty_inter] at h obtain ⟨d, du, ad, hd⟩ : ∃ d, d ∈ u ∧ (B a ∩ B d).Nonempty ∧ δ a ≤ τ * δ d := uT.2.2 a hat c hc h exact lt_irrefl _ ((hu d du ad).trans_le hd) -- Let `A` be all the elements of `t` which do not intersect the family `u`. It is nonempty as it -- contains `a`. We will pick an element `a'` of `A` with `δ a'` almost as large as possible. let A := { a' | a' ∈ t ∧ ∀ c ∈ u, Disjoint (B a') (B c) } have Anonempty : A.Nonempty := ⟨a, hat, a_disj⟩ let m := sSup (δ '' A) have bddA : BddAbove (δ '' A) := by refine ⟨R, fun x xA => ?_⟩ rcases (mem_image _ _ _).1 xA with ⟨a', ha', rfl⟩ exact δle a' ha'.1 obtain ⟨a', a'A, ha'⟩ : ∃ a' ∈ A, m / τ ≤ δ a' := by have : 0 ≤ m := (δnonneg a hat).trans (le_csSup bddA (mem_image_of_mem _ ⟨hat, a_disj⟩)) rcases eq_or_lt_of_le this with (mzero | mpos) · refine ⟨a, ⟨hat, a_disj⟩, ?_⟩ simpa only [← mzero, zero_div] using δnonneg a hat · have I : m / τ < m := by rw [div_lt_iff (zero_lt_one.trans hτ)] conv_lhs => rw [← mul_one m] exact (mul_lt_mul_left mpos).2 hτ rcases exists_lt_of_lt_csSup (Anonempty.image _) I with ⟨x, xA, hx⟩ rcases (mem_image _ _ _).1 xA with ⟨a', ha', rfl⟩ exact ⟨a', ha', hx.le⟩ clear hat hu a_disj a have a'_ne_u : a' ∉ u := fun H => (hne _ a'A.1).ne_empty (disjoint_self.1 (a'A.2 _ H)) -- we claim that `u ∪ {a'}` still belongs to `T`, contradicting the maximality of `u`. refine ⟨insert a' u, ⟨?_, ?_, ?_⟩, subset_insert _ _, (ne_insert_of_not_mem _ a'_ne_u).symm⟩ · -- check that `u ∪ {a'}` is made of elements of `t`. rw [insert_subset_iff] exact ⟨a'A.1, uT.1⟩ · -- Check that `u ∪ {a'}` is a disjoint family. This follows from the fact that `a'` does not -- intersect `u`. exact uT.2.1.insert fun b bu _ => a'A.2 b bu · -- check that every element `c` of `t` intersecting `u ∪ {a'}` intersects an element of this -- family with large `δ`. intro c ct b ba'u hcb -- if `c` already intersects an element of `u`, then it intersects an element of `u` with -- large `δ` by the assumption on `u`, and there is nothing left to do. by_cases H : ∃ d ∈ u, (B c ∩ B d).Nonempty · rcases H with ⟨d, du, hd⟩ rcases uT.2.2 c ct d du hd with ⟨d', d'u, hd'⟩ exact ⟨d', mem_insert_of_mem _ d'u, hd'⟩ · -- Otherwise, `c` belongs to `A`. The element of `u ∪ {a'}` that it intersects has to be `a'`. -- Moreover, `δ c` is smaller than the maximum `m` of `δ` over `A`, which is `≤ δ a' / τ` -- thanks to the good choice of `a'`. This is the desired inequality. push_neg at H simp only [← disjoint_iff_inter_eq_empty] at H rcases mem_insert_iff.1 ba'u with (rfl | H') · refine ⟨b, mem_insert _ _, hcb, ?_⟩ calc δ c ≤ m := le_csSup bddA (mem_image_of_mem _ ⟨ct, H⟩) _ = τ * (m / τ) := by field_simp [(zero_lt_one.trans hτ).ne'] _ ≤ τ * δ b := by gcongr · rw [← not_disjoint_iff_nonempty_inter] at hcb exact (hcb (H _ H')).elim
90
1,220,403,294,317,840,800,000,000,000,000,000,000,000
2
2
1
2,097
import Mathlib.AlgebraicGeometry.Properties #align_import algebraic_geometry.function_field from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 set_option linter.uppercaseLean3 false universe u v open TopologicalSpace Opposite CategoryTheory CategoryTheory.Limits TopCat namespace AlgebraicGeometry variable (X : Scheme) noncomputable abbrev Scheme.functionField [IrreducibleSpace X.carrier] : CommRingCat := X.presheaf.stalk (genericPoint X.carrier) #align algebraic_geometry.Scheme.function_field AlgebraicGeometry.Scheme.functionField noncomputable abbrev Scheme.germToFunctionField [IrreducibleSpace X.carrier] (U : Opens X.carrier) [h : Nonempty U] : X.presheaf.obj (op U) ⟶ X.functionField := X.presheaf.germ ⟨genericPoint X.carrier, ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ #align algebraic_geometry.Scheme.germ_to_function_field AlgebraicGeometry.Scheme.germToFunctionField noncomputable instance [IrreducibleSpace X.carrier] (U : Opens X.carrier) [Nonempty U] : Algebra (X.presheaf.obj (op U)) X.functionField := (X.germToFunctionField U).toAlgebra noncomputable instance [IsIntegral X] : Field X.functionField := by refine .ofIsUnitOrEqZero fun a ↦ ?_ obtain ⟨U, m, s, rfl⟩ := TopCat.Presheaf.germ_exist _ _ a rw [or_iff_not_imp_right, ← (X.presheaf.germ ⟨_, m⟩).map_zero] intro ha replace ha := ne_of_apply_ne _ ha have hs : genericPoint X.carrier ∈ RingedSpace.basicOpen _ s := by rw [← SetLike.mem_coe, (genericPoint_spec X.carrier).mem_open_set_iff, Set.top_eq_univ, Set.univ_inter, Set.nonempty_iff_ne_empty, Ne, ← Opens.coe_bot, ← SetLike.ext'_iff] · erw [basicOpen_eq_bot_iff] exact ha · exact (RingedSpace.basicOpen _ _).isOpen have := (X.presheaf.germ ⟨_, hs⟩).isUnit_map (RingedSpace.isUnit_res_basicOpen _ s) rwa [TopCat.Presheaf.germ_res_apply] at this
Mathlib/AlgebraicGeometry/FunctionField.lean
67
75
theorem germ_injective_of_isIntegral [IsIntegral X] {U : Opens X.carrier} (x : U) : Function.Injective (X.presheaf.germ x) := by
rw [injective_iff_map_eq_zero] intro y hy rw [← (X.presheaf.germ x).map_zero] at hy obtain ⟨W, hW, iU, iV, e⟩ := X.presheaf.germ_eq _ x.prop x.prop _ _ hy cases Subsingleton.elim iU iV haveI : Nonempty W := ⟨⟨_, hW⟩⟩ exact map_injective_of_isIntegral X iU e
7
1,096.633158
2
2
3
2,098
import Mathlib.AlgebraicGeometry.Properties #align_import algebraic_geometry.function_field from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 set_option linter.uppercaseLean3 false universe u v open TopologicalSpace Opposite CategoryTheory CategoryTheory.Limits TopCat namespace AlgebraicGeometry variable (X : Scheme) noncomputable abbrev Scheme.functionField [IrreducibleSpace X.carrier] : CommRingCat := X.presheaf.stalk (genericPoint X.carrier) #align algebraic_geometry.Scheme.function_field AlgebraicGeometry.Scheme.functionField noncomputable abbrev Scheme.germToFunctionField [IrreducibleSpace X.carrier] (U : Opens X.carrier) [h : Nonempty U] : X.presheaf.obj (op U) ⟶ X.functionField := X.presheaf.germ ⟨genericPoint X.carrier, ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ #align algebraic_geometry.Scheme.germ_to_function_field AlgebraicGeometry.Scheme.germToFunctionField noncomputable instance [IrreducibleSpace X.carrier] (U : Opens X.carrier) [Nonempty U] : Algebra (X.presheaf.obj (op U)) X.functionField := (X.germToFunctionField U).toAlgebra noncomputable instance [IsIntegral X] : Field X.functionField := by refine .ofIsUnitOrEqZero fun a ↦ ?_ obtain ⟨U, m, s, rfl⟩ := TopCat.Presheaf.germ_exist _ _ a rw [or_iff_not_imp_right, ← (X.presheaf.germ ⟨_, m⟩).map_zero] intro ha replace ha := ne_of_apply_ne _ ha have hs : genericPoint X.carrier ∈ RingedSpace.basicOpen _ s := by rw [← SetLike.mem_coe, (genericPoint_spec X.carrier).mem_open_set_iff, Set.top_eq_univ, Set.univ_inter, Set.nonempty_iff_ne_empty, Ne, ← Opens.coe_bot, ← SetLike.ext'_iff] · erw [basicOpen_eq_bot_iff] exact ha · exact (RingedSpace.basicOpen _ _).isOpen have := (X.presheaf.germ ⟨_, hs⟩).isUnit_map (RingedSpace.isUnit_res_basicOpen _ s) rwa [TopCat.Presheaf.germ_res_apply] at this theorem germ_injective_of_isIntegral [IsIntegral X] {U : Opens X.carrier} (x : U) : Function.Injective (X.presheaf.germ x) := by rw [injective_iff_map_eq_zero] intro y hy rw [← (X.presheaf.germ x).map_zero] at hy obtain ⟨W, hW, iU, iV, e⟩ := X.presheaf.germ_eq _ x.prop x.prop _ _ hy cases Subsingleton.elim iU iV haveI : Nonempty W := ⟨⟨_, hW⟩⟩ exact map_injective_of_isIntegral X iU e #align algebraic_geometry.germ_injective_of_is_integral AlgebraicGeometry.germ_injective_of_isIntegral theorem Scheme.germToFunctionField_injective [IsIntegral X] (U : Opens X.carrier) [Nonempty U] : Function.Injective (X.germToFunctionField U) := germ_injective_of_isIntegral _ _ #align algebraic_geometry.Scheme.germ_to_function_field_injective AlgebraicGeometry.Scheme.germToFunctionField_injective
Mathlib/AlgebraicGeometry/FunctionField.lean
83
93
theorem genericPoint_eq_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] [hX : IrreducibleSpace X.carrier] [IrreducibleSpace Y.carrier] : f.1.base (genericPoint X.carrier : _) = (genericPoint Y.carrier : _) := by
apply ((genericPoint_spec Y).eq _).symm convert (genericPoint_spec X.carrier).image (show Continuous f.1.base by continuity) symm rw [eq_top_iff, Set.top_eq_univ, Set.top_eq_univ] convert subset_closure_inter_of_isPreirreducible_of_isOpen _ H.base_open.isOpen_range _ · rw [Set.univ_inter, Set.image_univ] · apply PreirreducibleSpace.isPreirreducible_univ (X := Y.carrier) · exact ⟨_, trivial, Set.mem_range_self hX.2.some⟩
8
2,980.957987
2
2
3
2,098
import Mathlib.AlgebraicGeometry.Properties #align_import algebraic_geometry.function_field from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 set_option linter.uppercaseLean3 false universe u v open TopologicalSpace Opposite CategoryTheory CategoryTheory.Limits TopCat namespace AlgebraicGeometry variable (X : Scheme) noncomputable abbrev Scheme.functionField [IrreducibleSpace X.carrier] : CommRingCat := X.presheaf.stalk (genericPoint X.carrier) #align algebraic_geometry.Scheme.function_field AlgebraicGeometry.Scheme.functionField noncomputable abbrev Scheme.germToFunctionField [IrreducibleSpace X.carrier] (U : Opens X.carrier) [h : Nonempty U] : X.presheaf.obj (op U) ⟶ X.functionField := X.presheaf.germ ⟨genericPoint X.carrier, ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ #align algebraic_geometry.Scheme.germ_to_function_field AlgebraicGeometry.Scheme.germToFunctionField noncomputable instance [IrreducibleSpace X.carrier] (U : Opens X.carrier) [Nonempty U] : Algebra (X.presheaf.obj (op U)) X.functionField := (X.germToFunctionField U).toAlgebra noncomputable instance [IsIntegral X] : Field X.functionField := by refine .ofIsUnitOrEqZero fun a ↦ ?_ obtain ⟨U, m, s, rfl⟩ := TopCat.Presheaf.germ_exist _ _ a rw [or_iff_not_imp_right, ← (X.presheaf.germ ⟨_, m⟩).map_zero] intro ha replace ha := ne_of_apply_ne _ ha have hs : genericPoint X.carrier ∈ RingedSpace.basicOpen _ s := by rw [← SetLike.mem_coe, (genericPoint_spec X.carrier).mem_open_set_iff, Set.top_eq_univ, Set.univ_inter, Set.nonempty_iff_ne_empty, Ne, ← Opens.coe_bot, ← SetLike.ext'_iff] · erw [basicOpen_eq_bot_iff] exact ha · exact (RingedSpace.basicOpen _ _).isOpen have := (X.presheaf.germ ⟨_, hs⟩).isUnit_map (RingedSpace.isUnit_res_basicOpen _ s) rwa [TopCat.Presheaf.germ_res_apply] at this theorem germ_injective_of_isIntegral [IsIntegral X] {U : Opens X.carrier} (x : U) : Function.Injective (X.presheaf.germ x) := by rw [injective_iff_map_eq_zero] intro y hy rw [← (X.presheaf.germ x).map_zero] at hy obtain ⟨W, hW, iU, iV, e⟩ := X.presheaf.germ_eq _ x.prop x.prop _ _ hy cases Subsingleton.elim iU iV haveI : Nonempty W := ⟨⟨_, hW⟩⟩ exact map_injective_of_isIntegral X iU e #align algebraic_geometry.germ_injective_of_is_integral AlgebraicGeometry.germ_injective_of_isIntegral theorem Scheme.germToFunctionField_injective [IsIntegral X] (U : Opens X.carrier) [Nonempty U] : Function.Injective (X.germToFunctionField U) := germ_injective_of_isIntegral _ _ #align algebraic_geometry.Scheme.germ_to_function_field_injective AlgebraicGeometry.Scheme.germToFunctionField_injective theorem genericPoint_eq_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] [hX : IrreducibleSpace X.carrier] [IrreducibleSpace Y.carrier] : f.1.base (genericPoint X.carrier : _) = (genericPoint Y.carrier : _) := by apply ((genericPoint_spec Y).eq _).symm convert (genericPoint_spec X.carrier).image (show Continuous f.1.base by continuity) symm rw [eq_top_iff, Set.top_eq_univ, Set.top_eq_univ] convert subset_closure_inter_of_isPreirreducible_of_isOpen _ H.base_open.isOpen_range _ · rw [Set.univ_inter, Set.image_univ] · apply PreirreducibleSpace.isPreirreducible_univ (X := Y.carrier) · exact ⟨_, trivial, Set.mem_range_self hX.2.some⟩ #align algebraic_geometry.generic_point_eq_of_is_open_immersion AlgebraicGeometry.genericPoint_eq_of_isOpenImmersion noncomputable instance stalkFunctionFieldAlgebra [IrreducibleSpace X.carrier] (x : X.carrier) : Algebra (X.presheaf.stalk x) X.functionField := by apply RingHom.toAlgebra exact X.presheaf.stalkSpecializes ((genericPoint_spec X.carrier).specializes trivial) #align algebraic_geometry.stalk_function_field_algebra AlgebraicGeometry.stalkFunctionFieldAlgebra instance functionField_isScalarTower [IrreducibleSpace X.carrier] (U : Opens X.carrier) (x : U) [Nonempty U] : IsScalarTower (X.presheaf.obj <| op U) (X.presheaf.stalk x) X.functionField := by apply IsScalarTower.of_algebraMap_eq' simp_rw [RingHom.algebraMap_toAlgebra] change _ = X.presheaf.germ x ≫ _ rw [X.presheaf.germ_stalkSpecializes] #align algebraic_geometry.function_field_is_scalar_tower AlgebraicGeometry.functionField_isScalarTower noncomputable instance (R : CommRingCat.{u}) [IsDomain R] : Algebra R (Scheme.Spec.obj <| op R).functionField := RingHom.toAlgebra <| by change CommRingCat.of R ⟶ _; apply StructureSheaf.toStalk @[simp]
Mathlib/AlgebraicGeometry/FunctionField.lean
115
121
theorem genericPoint_eq_bot_of_affine (R : CommRingCat) [IsDomain R] : genericPoint (Scheme.Spec.obj <| op R).carrier = (⟨0, Ideal.bot_prime⟩ : PrimeSpectrum R) := by
apply (genericPoint_spec (Scheme.Spec.obj <| op R).carrier).eq rw [isGenericPoint_def] rw [← PrimeSpectrum.zeroLocus_vanishingIdeal_eq_closure, PrimeSpectrum.vanishingIdeal_singleton] rw [Set.top_eq_univ, ← PrimeSpectrum.zeroLocus_singleton_zero] simp_rw [Submodule.zero_eq_bot, Submodule.bot_coe]
5
148.413159
2
2
3
2,098
import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.RingTheory.Polynomial.Basic import Mathlib.RingTheory.PrincipalIdealDomain #align_import ring_theory.adjoin.fg from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" universe u v w open Subsemiring Ring Submodule open Pointwise namespace Algebra variable {R : Type u} {A : Type v} {B : Type w} [CommSemiring R] [CommSemiring A] [Algebra R A] {s t : Set A}
Mathlib/RingTheory/Adjoin/FG.lean
40
80
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) : (adjoin R (s ∪ t)).toSubmodule.FG := by
rcases fg_def.1 h1 with ⟨p, hp, hp'⟩ rcases fg_def.1 h2 with ⟨q, hq, hq'⟩ refine fg_def.2 ⟨p * q, hp.mul hq, le_antisymm ?_ ?_⟩ · rw [span_le, Set.mul_subset_iff] intro x hx y hy change x * y ∈ adjoin R (s ∪ t) refine Subalgebra.mul_mem _ ?_ ?_ · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by rw [← hp'] exact subset_span hx exact adjoin_mono Set.subset_union_left this have : y ∈ Subalgebra.toSubmodule (adjoin (adjoin R s) t) := by rw [← hq'] exact subset_span hy change y ∈ adjoin R (s ∪ t) rwa [adjoin_union_eq_adjoin_adjoin] · intro r hr change r ∈ adjoin R (s ∪ t) at hr rw [adjoin_union_eq_adjoin_adjoin] at hr change r ∈ Subalgebra.toSubmodule (adjoin (adjoin R s) t) at hr rw [← hq', ← Set.image_id q, Finsupp.mem_span_image_iff_total (adjoin R s)] at hr rcases hr with ⟨l, hlq, rfl⟩ have := @Finsupp.total_apply A A (adjoin R s) rw [this, Finsupp.sum] refine sum_mem ?_ intro z hz change (l z).1 * _ ∈ _ have : (l z).1 ∈ Subalgebra.toSubmodule (adjoin R s) := (l z).2 rw [← hp', ← Set.image_id p, Finsupp.mem_span_image_iff_total R] at this rcases this with ⟨l2, hlp, hl⟩ have := @Finsupp.total_apply A A R rw [this] at hl rw [← hl, Finsupp.sum_mul] refine sum_mem ?_ intro t ht change _ * _ ∈ _ rw [smul_mul_assoc] refine smul_mem _ _ ?_ exact subset_span ⟨t, hlp ht, z, hlq hz, rfl⟩
39
86,593,400,423,993,740
2
2
3
2,099
import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.RingTheory.Polynomial.Basic import Mathlib.RingTheory.PrincipalIdealDomain #align_import ring_theory.adjoin.fg from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" universe u v w open Subsemiring Ring Submodule open Pointwise namespace Subalgebra variable {R : Type u} {A : Type v} {B : Type w} variable [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B] def FG (S : Subalgebra R A) : Prop := ∃ t : Finset A, Algebra.adjoin R ↑t = S #align subalgebra.fg Subalgebra.FG theorem fg_adjoin_finset (s : Finset A) : (Algebra.adjoin R (↑s : Set A)).FG := ⟨s, rfl⟩ #align subalgebra.fg_adjoin_finset Subalgebra.fg_adjoin_finset theorem fg_def {S : Subalgebra R A} : S.FG ↔ ∃ t : Set A, Set.Finite t ∧ Algebra.adjoin R t = S := Iff.symm Set.exists_finite_iff_finset #align subalgebra.fg_def Subalgebra.fg_def theorem fg_bot : (⊥ : Subalgebra R A).FG := ⟨∅, Finset.coe_empty ▸ Algebra.adjoin_empty R A⟩ #align subalgebra.fg_bot Subalgebra.fg_bot theorem fg_of_fg_toSubmodule {S : Subalgebra R A} : S.toSubmodule.FG → S.FG := fun ⟨t, ht⟩ ↦ ⟨t, le_antisymm (Algebra.adjoin_le fun x hx ↦ show x ∈ Subalgebra.toSubmodule S from ht ▸ subset_span hx) <| show Subalgebra.toSubmodule S ≤ Subalgebra.toSubmodule (Algebra.adjoin R ↑t) from fun x hx ↦ span_le.mpr (fun x hx ↦ Algebra.subset_adjoin hx) (show x ∈ span R ↑t by rw [ht] exact hx)⟩ #align subalgebra.fg_of_fg_to_submodule Subalgebra.fg_of_fg_toSubmodule theorem fg_of_noetherian [IsNoetherian R A] (S : Subalgebra R A) : S.FG := fg_of_fg_toSubmodule (IsNoetherian.noetherian (Subalgebra.toSubmodule S)) #align subalgebra.fg_of_noetherian Subalgebra.fg_of_noetherian theorem fg_of_submodule_fg (h : (⊤ : Submodule R A).FG) : (⊤ : Subalgebra R A).FG := let ⟨s, hs⟩ := h ⟨s, toSubmodule.injective <| by rw [Algebra.top_toSubmodule, eq_top_iff, ← hs, span_le] exact Algebra.subset_adjoin⟩ #align subalgebra.fg_of_submodule_fg Subalgebra.fg_of_submodule_fg
Mathlib/RingTheory/Adjoin/FG.lean
129
137
theorem FG.prod {S : Subalgebra R A} {T : Subalgebra R B} (hS : S.FG) (hT : T.FG) : (S.prod T).FG := by
obtain ⟨s, hs⟩ := fg_def.1 hS obtain ⟨t, ht⟩ := fg_def.1 hT rw [← hs.2, ← ht.2] exact fg_def.2 ⟨LinearMap.inl R A B '' (s ∪ {1}) ∪ LinearMap.inr R A B '' (t ∪ {1}), Set.Finite.union (Set.Finite.image _ (Set.Finite.union hs.1 (Set.finite_singleton _))) (Set.Finite.image _ (Set.Finite.union ht.1 (Set.finite_singleton _))), Algebra.adjoin_inl_union_inr_eq_prod R s t⟩
7
1,096.633158
2
2
3
2,099
import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.RingTheory.Polynomial.Basic import Mathlib.RingTheory.PrincipalIdealDomain #align_import ring_theory.adjoin.fg from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" universe u v w open Subsemiring Ring Submodule open Pointwise namespace Subalgebra variable {R : Type u} {A : Type v} {B : Type w} variable [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B] def FG (S : Subalgebra R A) : Prop := ∃ t : Finset A, Algebra.adjoin R ↑t = S #align subalgebra.fg Subalgebra.FG theorem fg_adjoin_finset (s : Finset A) : (Algebra.adjoin R (↑s : Set A)).FG := ⟨s, rfl⟩ #align subalgebra.fg_adjoin_finset Subalgebra.fg_adjoin_finset theorem fg_def {S : Subalgebra R A} : S.FG ↔ ∃ t : Set A, Set.Finite t ∧ Algebra.adjoin R t = S := Iff.symm Set.exists_finite_iff_finset #align subalgebra.fg_def Subalgebra.fg_def theorem fg_bot : (⊥ : Subalgebra R A).FG := ⟨∅, Finset.coe_empty ▸ Algebra.adjoin_empty R A⟩ #align subalgebra.fg_bot Subalgebra.fg_bot theorem fg_of_fg_toSubmodule {S : Subalgebra R A} : S.toSubmodule.FG → S.FG := fun ⟨t, ht⟩ ↦ ⟨t, le_antisymm (Algebra.adjoin_le fun x hx ↦ show x ∈ Subalgebra.toSubmodule S from ht ▸ subset_span hx) <| show Subalgebra.toSubmodule S ≤ Subalgebra.toSubmodule (Algebra.adjoin R ↑t) from fun x hx ↦ span_le.mpr (fun x hx ↦ Algebra.subset_adjoin hx) (show x ∈ span R ↑t by rw [ht] exact hx)⟩ #align subalgebra.fg_of_fg_to_submodule Subalgebra.fg_of_fg_toSubmodule theorem fg_of_noetherian [IsNoetherian R A] (S : Subalgebra R A) : S.FG := fg_of_fg_toSubmodule (IsNoetherian.noetherian (Subalgebra.toSubmodule S)) #align subalgebra.fg_of_noetherian Subalgebra.fg_of_noetherian theorem fg_of_submodule_fg (h : (⊤ : Submodule R A).FG) : (⊤ : Subalgebra R A).FG := let ⟨s, hs⟩ := h ⟨s, toSubmodule.injective <| by rw [Algebra.top_toSubmodule, eq_top_iff, ← hs, span_le] exact Algebra.subset_adjoin⟩ #align subalgebra.fg_of_submodule_fg Subalgebra.fg_of_submodule_fg theorem FG.prod {S : Subalgebra R A} {T : Subalgebra R B} (hS : S.FG) (hT : T.FG) : (S.prod T).FG := by obtain ⟨s, hs⟩ := fg_def.1 hS obtain ⟨t, ht⟩ := fg_def.1 hT rw [← hs.2, ← ht.2] exact fg_def.2 ⟨LinearMap.inl R A B '' (s ∪ {1}) ∪ LinearMap.inr R A B '' (t ∪ {1}), Set.Finite.union (Set.Finite.image _ (Set.Finite.union hs.1 (Set.finite_singleton _))) (Set.Finite.image _ (Set.Finite.union ht.1 (Set.finite_singleton _))), Algebra.adjoin_inl_union_inr_eq_prod R s t⟩ #align subalgebra.fg.prod Subalgebra.FG.prod section open scoped Classical theorem FG.map {S : Subalgebra R A} (f : A →ₐ[R] B) (hs : S.FG) : (S.map f).FG := let ⟨s, hs⟩ := hs ⟨s.image f, by rw [Finset.coe_image, Algebra.adjoin_image, hs]⟩ #align subalgebra.fg.map Subalgebra.FG.map end theorem fg_of_fg_map (S : Subalgebra R A) (f : A →ₐ[R] B) (hf : Function.Injective f) (hs : (S.map f).FG) : S.FG := let ⟨s, hs⟩ := hs ⟨s.preimage f fun _ _ _ _ h ↦ hf h, map_injective hf <| by rw [← Algebra.adjoin_image, Finset.coe_preimage, Set.image_preimage_eq_of_subset, hs] rw [← AlgHom.coe_range, ← Algebra.adjoin_le_iff, hs, ← Algebra.map_top] exact map_mono le_top⟩ #align subalgebra.fg_of_fg_map Subalgebra.fg_of_fg_map theorem fg_top (S : Subalgebra R A) : (⊤ : Subalgebra R S).FG ↔ S.FG := ⟨fun h ↦ by rw [← S.range_val, ← Algebra.map_top] exact FG.map _ h, fun h ↦ fg_of_fg_map _ S.val Subtype.val_injective <| by rw [Algebra.map_top, range_val] exact h⟩ #align subalgebra.fg_top Subalgebra.fg_top
Mathlib/RingTheory/Adjoin/FG.lean
170
179
theorem induction_on_adjoin [IsNoetherian R A] (P : Subalgebra R A → Prop) (base : P ⊥) (ih : ∀ (S : Subalgebra R A) (x : A), P S → P (Algebra.adjoin R (insert x S))) (S : Subalgebra R A) : P S := by
classical obtain ⟨t, rfl⟩ := S.fg_of_noetherian refine Finset.induction_on t ?_ ?_ · simpa using base intro x t _ h rw [Finset.coe_insert] simpa only [Algebra.adjoin_insert_adjoin] using ih _ x h
7
1,096.633158
2
2
3
2,099
import Mathlib.CategoryTheory.Limits.Preserves.Finite import Mathlib.CategoryTheory.Limits.Opposites import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.Topology.Category.TopCat.Limits.Products universe w w' v u open CategoryTheory Opposite Limits variable {C : Type u} [Category.{v} C] (F : C ⥤ TopCat.{w}) (Y : Type w') [TopologicalSpace Y] namespace ContinuousMap @[simps] def yonedaPresheaf : Cᵒᵖ ⥤ Type (max w w') where obj X := C(F.obj (unop X), Y) map f g := ContinuousMap.comp g (F.map f.unop) @[simps] def yonedaPresheaf' : TopCat.{w}ᵒᵖ ⥤ Type (max w w') where obj X := C((unop X).1, Y) map f g := ContinuousMap.comp g f.unop theorem comp_yonedaPresheaf' : yonedaPresheaf F Y = F.op ⋙ yonedaPresheaf' Y := rfl
Mathlib/Topology/Category/TopCat/Yoneda.lean
48
58
theorem piComparison_fac {α : Type} (X : α → TopCat) : piComparison (yonedaPresheaf'.{w, w'} Y) (fun x ↦ op (X x)) = (yonedaPresheaf' Y).map ((opCoproductIsoProduct X).inv ≫ (TopCat.sigmaIsoSigma X).inv.op) ≫ (equivEquivIso (sigmaEquiv Y (fun x ↦ (X x).1))).inv ≫ (Types.productIso _).inv := by
rw [← Category.assoc, Iso.eq_comp_inv] ext simp only [yonedaPresheaf', unop_op, piComparison, types_comp_apply, Types.productIso_hom_comp_eval_apply, Types.pi_lift_π_apply, comp_apply, TopCat.coe_of, unop_comp, Quiver.Hom.unop_op, sigmaEquiv, equivEquivIso_hom, Equiv.toIso_inv, Equiv.coe_fn_symm_mk, comp_assoc, sigmaMk_apply, ← opCoproductIsoProduct_inv_comp_ι] rfl
7
1,096.633158
2
2
1
2,100
import Mathlib.Data.List.Basic import Mathlib.Order.MinMax import Mathlib.Order.WithBot #align_import data.list.min_max from "leanprover-community/mathlib"@"6d0adfa76594f304b4650d098273d4366edeb61b" namespace List variable {α β : Type*} section ArgAux variable (r : α → α → Prop) [DecidableRel r] {l : List α} {o : Option α} {a m : α} def argAux (a : Option α) (b : α) : Option α := Option.casesOn a (some b) fun c => if r b c then some b else some c #align list.arg_aux List.argAux @[simp] theorem foldl_argAux_eq_none : l.foldl (argAux r) o = none ↔ l = [] ∧ o = none := List.reverseRecOn l (by simp) fun tl hd => by simp only [foldl_append, foldl_cons, argAux, foldl_nil, append_eq_nil, and_false, false_and, iff_false]; cases foldl (argAux r) o tl <;> simp; try split_ifs <;> simp #align list.foldl_arg_aux_eq_none List.foldl_argAux_eq_none private theorem foldl_argAux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (some a) l → m ∈ a :: l := List.reverseRecOn l (by simp [eq_comm]) (by intro tl hd ih a m simp only [foldl_append, foldl_cons, foldl_nil, argAux] cases hf : foldl (argAux r) (some a) tl · simp (config := { contextual := true }) · dsimp only split_ifs · simp (config := { contextual := true }) · -- `finish [ih _ _ hf]` closes this goal simp only [List.mem_cons] at ih rcases ih _ _ hf with rfl | H · simp (config := { contextual := true }) only [Option.mem_def, Option.some.injEq, find?, eq_comm, mem_cons, mem_append, mem_singleton, true_or, implies_true] · simp (config := { contextual := true }) [@eq_comm _ _ m, H]) @[simp] theorem argAux_self (hr₀ : Irreflexive r) (a : α) : argAux r (some a) a = a := if_neg <| hr₀ _ #align list.arg_aux_self List.argAux_self
Mathlib/Data/List/MinMax.lean
69
86
theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) : ∀ {a m : α} {o : Option α}, a ∈ l → m ∈ foldl (argAux r) o l → ¬r a m := by
induction' l using List.reverseRecOn with tl a ih · simp intro b m o hb ho rw [foldl_append, foldl_cons, foldl_nil, argAux] at ho cases' hf : foldl (argAux r) o tl with c · rw [hf] at ho rw [foldl_argAux_eq_none] at hf simp_all [hf.1, hf.2, hr₀ _] rw [hf, Option.mem_def] at ho dsimp only at ho split_ifs at ho with hac <;> cases' mem_append.1 hb with h h <;> injection ho with ho <;> subst ho · exact fun hba => ih h hf (hr₁ hba hac) · simp_all [hr₀ _] · exact ih h hf · simp_all
16
8,886,110.520508
2
2
1
2,101
import Mathlib.NumberTheory.FLT.Basic import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.Cyclotomic.Rat section case1 open ZMod private lemma cube_of_castHom_ne_zero {n : ZMod 9} : castHom (show 3 ∣ 9 by norm_num) (ZMod 3) n ≠ 0 → n ^ 3 = 1 ∨ n ^ 3 = 8 := by revert n; decide private lemma cube_of_not_dvd {n : ℤ} (h : ¬ 3 ∣ n) : (n : ZMod 9) ^ 3 = 1 ∨ (n : ZMod 9) ^ 3 = 8 := by apply cube_of_castHom_ne_zero rwa [map_intCast, Ne, ZMod.intCast_zmod_eq_zero_iff_dvd]
Mathlib/NumberTheory/FLT/Three.lean
36
44
theorem fermatLastTheoremThree_case_1 {a b c : ℤ} (hdvd : ¬ 3 ∣ a * b * c) : a ^ 3 + b ^ 3 ≠ c ^ 3 := by
simp_rw [Int.prime_three.dvd_mul, not_or] at hdvd apply mt (congrArg (Int.cast : ℤ → ZMod 9)) simp_rw [Int.cast_add, Int.cast_pow] rcases cube_of_not_dvd hdvd.1.1 with ha | ha <;> rcases cube_of_not_dvd hdvd.1.2 with hb | hb <;> rcases cube_of_not_dvd hdvd.2 with hc | hc <;> rw [ha, hb, hc] <;> decide
7
1,096.633158
2
2
1
2,102
import Mathlib.ModelTheory.ElementarySubstructures #align_import model_theory.skolem from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" universe u v w w' namespace FirstOrder namespace Language open Structure Cardinal open Cardinal variable (L : Language.{u, v}) {M : Type w} [Nonempty M] [L.Structure M] @[simps] def skolem₁ : Language := ⟨fun n => L.BoundedFormula Empty (n + 1), fun _ => Empty⟩ #align first_order.language.skolem₁ FirstOrder.Language.skolem₁ #align first_order.language.skolem₁_functions FirstOrder.Language.skolem₁_Functions variable {L}
Mathlib/ModelTheory/Skolem.lean
50
62
theorem card_functions_sum_skolem₁ : #(Σ n, (L.sum L.skolem₁).Functions n) = #(Σ n, L.BoundedFormula Empty (n + 1)) := by
simp only [card_functions_sum, skolem₁_Functions, mk_sigma, sum_add_distrib'] conv_lhs => enter [2, 1, i]; rw [lift_id'.{u, v}] rw [add_comm, add_eq_max, max_eq_left] · refine sum_le_sum _ _ fun n => ?_ rw [← lift_le.{_, max u v}, lift_lift, lift_mk_le.{v}] refine ⟨⟨fun f => (func f default).bdEqual (func f default), fun f g h => ?_⟩⟩ rcases h with ⟨rfl, ⟨rfl⟩⟩ rfl · rw [← mk_sigma] exact infinite_iff.1 (Infinite.of_injective (fun n => ⟨n, ⊥⟩) fun x y xy => (Sigma.mk.inj_iff.1 xy).1)
11
59,874.141715
2
2
3
2,103
import Mathlib.ModelTheory.ElementarySubstructures #align_import model_theory.skolem from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" universe u v w w' namespace FirstOrder namespace Language open Structure Cardinal open Cardinal variable (L : Language.{u, v}) {M : Type w} [Nonempty M] [L.Structure M] @[simps] def skolem₁ : Language := ⟨fun n => L.BoundedFormula Empty (n + 1), fun _ => Empty⟩ #align first_order.language.skolem₁ FirstOrder.Language.skolem₁ #align first_order.language.skolem₁_functions FirstOrder.Language.skolem₁_Functions variable {L} theorem card_functions_sum_skolem₁ : #(Σ n, (L.sum L.skolem₁).Functions n) = #(Σ n, L.BoundedFormula Empty (n + 1)) := by simp only [card_functions_sum, skolem₁_Functions, mk_sigma, sum_add_distrib'] conv_lhs => enter [2, 1, i]; rw [lift_id'.{u, v}] rw [add_comm, add_eq_max, max_eq_left] · refine sum_le_sum _ _ fun n => ?_ rw [← lift_le.{_, max u v}, lift_lift, lift_mk_le.{v}] refine ⟨⟨fun f => (func f default).bdEqual (func f default), fun f g h => ?_⟩⟩ rcases h with ⟨rfl, ⟨rfl⟩⟩ rfl · rw [← mk_sigma] exact infinite_iff.1 (Infinite.of_injective (fun n => ⟨n, ⊥⟩) fun x y xy => (Sigma.mk.inj_iff.1 xy).1) #align first_order.language.card_functions_sum_skolem₁ FirstOrder.Language.card_functions_sum_skolem₁
Mathlib/ModelTheory/Skolem.lean
65
73
theorem card_functions_sum_skolem₁_le : #(Σ n, (L.sum L.skolem₁).Functions n) ≤ max ℵ₀ L.card := by
rw [card_functions_sum_skolem₁] trans #(Σ n, L.BoundedFormula Empty n) · exact ⟨⟨Sigma.map Nat.succ fun _ => id, Nat.succ_injective.sigma_map fun _ => Function.injective_id⟩⟩ · refine _root_.trans BoundedFormula.card_le (lift_le.{max u v}.1 ?_) simp only [mk_empty, lift_zero, lift_uzero, zero_add] rfl
8
2,980.957987
2
2
3
2,103
import Mathlib.ModelTheory.ElementarySubstructures #align_import model_theory.skolem from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" universe u v w w' namespace FirstOrder namespace Language open Structure Cardinal open Cardinal variable (L : Language.{u, v}) {M : Type w} [Nonempty M] [L.Structure M] @[simps] def skolem₁ : Language := ⟨fun n => L.BoundedFormula Empty (n + 1), fun _ => Empty⟩ #align first_order.language.skolem₁ FirstOrder.Language.skolem₁ #align first_order.language.skolem₁_functions FirstOrder.Language.skolem₁_Functions variable {L} theorem card_functions_sum_skolem₁ : #(Σ n, (L.sum L.skolem₁).Functions n) = #(Σ n, L.BoundedFormula Empty (n + 1)) := by simp only [card_functions_sum, skolem₁_Functions, mk_sigma, sum_add_distrib'] conv_lhs => enter [2, 1, i]; rw [lift_id'.{u, v}] rw [add_comm, add_eq_max, max_eq_left] · refine sum_le_sum _ _ fun n => ?_ rw [← lift_le.{_, max u v}, lift_lift, lift_mk_le.{v}] refine ⟨⟨fun f => (func f default).bdEqual (func f default), fun f g h => ?_⟩⟩ rcases h with ⟨rfl, ⟨rfl⟩⟩ rfl · rw [← mk_sigma] exact infinite_iff.1 (Infinite.of_injective (fun n => ⟨n, ⊥⟩) fun x y xy => (Sigma.mk.inj_iff.1 xy).1) #align first_order.language.card_functions_sum_skolem₁ FirstOrder.Language.card_functions_sum_skolem₁ theorem card_functions_sum_skolem₁_le : #(Σ n, (L.sum L.skolem₁).Functions n) ≤ max ℵ₀ L.card := by rw [card_functions_sum_skolem₁] trans #(Σ n, L.BoundedFormula Empty n) · exact ⟨⟨Sigma.map Nat.succ fun _ => id, Nat.succ_injective.sigma_map fun _ => Function.injective_id⟩⟩ · refine _root_.trans BoundedFormula.card_le (lift_le.{max u v}.1 ?_) simp only [mk_empty, lift_zero, lift_uzero, zero_add] rfl #align first_order.language.card_functions_sum_skolem₁_le FirstOrder.Language.card_functions_sum_skolem₁_le noncomputable instance skolem₁Structure : L.skolem₁.Structure M := ⟨fun {_} φ x => Classical.epsilon fun a => φ.Realize default (Fin.snoc x a : _ → M), fun {_} r => Empty.elim r⟩ set_option linter.uppercaseLean3 false in #align first_order.language.skolem₁_Structure FirstOrder.Language.skolem₁Structure namespace Substructure
Mathlib/ModelTheory/Skolem.lean
86
95
theorem skolem₁_reduct_isElementary (S : (L.sum L.skolem₁).Substructure M) : (LHom.sumInl.substructureReduct S).IsElementary := by
apply (LHom.sumInl.substructureReduct S).isElementary_of_exists intro n φ x a h let φ' : (L.sum L.skolem₁).Functions n := LHom.sumInr.onFunction φ exact ⟨⟨funMap φ' ((↑) ∘ x), S.fun_mem (LHom.sumInr.onFunction φ) ((↑) ∘ x) (by exact fun i => (x i).2)⟩, by exact Classical.epsilon_spec (p := fun a => BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a)) ⟨a, h⟩⟩
8
2,980.957987
2
2
3
2,103
import Mathlib.CategoryTheory.Types import Mathlib.CategoryTheory.Functor.EpiMono import Mathlib.CategoryTheory.Limits.Constructions.EpiMono #align_import category_theory.concrete_category.basic from "leanprover-community/mathlib"@"311ef8c4b4ae2804ea76b8a611bc5ea1d9c16872" universe w w' v v' v'' u u' u'' namespace CategoryTheory open CategoryTheory.Limits class ConcreteCategory (C : Type u) [Category.{v} C] where protected forget : C ⥤ Type w [forget_faithful : forget.Faithful] #align category_theory.concrete_category CategoryTheory.ConcreteCategory #align category_theory.concrete_category.forget CategoryTheory.ConcreteCategory.forget attribute [reducible] ConcreteCategory.forget attribute [instance] ConcreteCategory.forget_faithful abbrev forget (C : Type u) [Category.{v} C] [ConcreteCategory.{w} C] : C ⥤ Type w := ConcreteCategory.forget #align category_theory.forget CategoryTheory.forget -- this is reducible because we want `forget (Type u)` to unfold to `𝟭 _` @[instance] abbrev ConcreteCategory.types : ConcreteCategory.{u, u, u+1} (Type u) where forget := 𝟭 _ #align category_theory.concrete_category.types CategoryTheory.ConcreteCategory.types def ConcreteCategory.hasCoeToSort (C : Type u) [Category.{v} C] [ConcreteCategory.{w} C] : CoeSort C (Type w) where coe := fun X => (forget C).obj X #align category_theory.concrete_category.has_coe_to_sort CategoryTheory.ConcreteCategory.hasCoeToSort section attribute [local instance] ConcreteCategory.hasCoeToSort variable {C : Type u} [Category.{v} C] [ConcreteCategory.{w} C] -- Porting note: forget_obj_eq_coe has become a syntactic tautology. #noalign category_theory.forget_obj_eq_coe abbrev ConcreteCategory.instFunLike {X Y : C} : FunLike (X ⟶ Y) X Y where coe f := (forget C).map f coe_injective' _ _ h := (forget C).map_injective h attribute [local instance] ConcreteCategory.instFunLike @[ext low] -- Porting note: lowered priority
Mathlib/CategoryTheory/ConcreteCategory/Basic.lean
106
110
theorem ConcreteCategory.hom_ext {X Y : C} (f g : X ⟶ Y) (w : ∀ x : X, f x = g x) : f = g := by
apply (forget C).map_injective dsimp [forget] funext x exact w x
4
54.59815
2
2
1
2,104
import Mathlib.Analysis.Convex.Combination import Mathlib.Analysis.Convex.Join #align_import analysis.convex.stone_separation from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" open Set variable {𝕜 E ι : Type*} [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E}
Mathlib/Analysis/Convex/StoneSeparation.lean
30
77
theorem not_disjoint_segment_convexHull_triple {p q u v x y z : E} (hz : z ∈ segment 𝕜 x y) (hu : u ∈ segment 𝕜 x p) (hv : v ∈ segment 𝕜 y q) : ¬Disjoint (segment 𝕜 u v) (convexHull 𝕜 {p, q, z}) := by
rw [not_disjoint_iff] obtain ⟨az, bz, haz, hbz, habz, rfl⟩ := hz obtain rfl | haz' := haz.eq_or_lt · rw [zero_add] at habz rw [zero_smul, zero_add, habz, one_smul] refine ⟨v, by apply right_mem_segment, segment_subset_convexHull ?_ ?_ hv⟩ <;> simp obtain ⟨av, bv, hav, hbv, habv, rfl⟩ := hv obtain rfl | hav' := hav.eq_or_lt · rw [zero_add] at habv rw [zero_smul, zero_add, habv, one_smul] exact ⟨q, right_mem_segment _ _ _, subset_convexHull _ _ <| by simp⟩ obtain ⟨au, bu, hau, hbu, habu, rfl⟩ := hu have hab : 0 < az * av + bz * au := by positivity refine ⟨(az * av / (az * av + bz * au)) • (au • x + bu • p) + (bz * au / (az * av + bz * au)) • (av • y + bv • q), ⟨_, _, ?_, ?_, ?_, rfl⟩, ?_⟩ · positivity · positivity · rw [← add_div, div_self]; positivity rw [smul_add, smul_add, add_add_add_comm, add_comm, ← mul_smul, ← mul_smul] classical let w : Fin 3 → 𝕜 := ![az * av * bu, bz * au * bv, au * av] let z : Fin 3 → E := ![p, q, az • x + bz • y] have hw₀ : ∀ i, 0 ≤ w i := by rintro i fin_cases i · exact mul_nonneg (mul_nonneg haz hav) hbu · exact mul_nonneg (mul_nonneg hbz hau) hbv · exact mul_nonneg hau hav have hw : ∑ i, w i = az * av + bz * au := by trans az * av * bu + (bz * au * bv + au * av) · simp [w, Fin.sum_univ_succ, Fin.sum_univ_zero] rw [← one_mul (au * av), ← habz, add_mul, ← add_assoc, add_add_add_comm, mul_assoc, ← mul_add, mul_assoc, ← mul_add, mul_comm av, ← add_mul, ← mul_add, add_comm bu, add_comm bv, habu, habv, one_mul, mul_one] have hz : ∀ i, z i ∈ ({p, q, az • x + bz • y} : Set E) := fun i => by fin_cases i <;> simp [z] convert Finset.centerMass_mem_convexHull (Finset.univ : Finset (Fin 3)) (fun i _ => hw₀ i) (by rwa [hw]) fun i _ => hz i rw [Finset.centerMass] simp_rw [div_eq_inv_mul, hw, mul_assoc, mul_smul (az * av + bz * au)⁻¹, ← smul_add, add_assoc, ← mul_assoc] congr 3 rw [← mul_smul, ← mul_rotate, mul_right_comm, mul_smul, ← mul_smul _ av, mul_rotate, mul_smul _ bz, ← smul_add] simp only [w, z, smul_add, List.foldr, Matrix.cons_val_succ', Fin.mk_one, Matrix.cons_val_one, Matrix.head_cons, add_zero]
45
34,934,271,057,485,095,000
2
2
2
2,105
import Mathlib.Analysis.Convex.Combination import Mathlib.Analysis.Convex.Join #align_import analysis.convex.stone_separation from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" open Set variable {𝕜 E ι : Type*} [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E} theorem not_disjoint_segment_convexHull_triple {p q u v x y z : E} (hz : z ∈ segment 𝕜 x y) (hu : u ∈ segment 𝕜 x p) (hv : v ∈ segment 𝕜 y q) : ¬Disjoint (segment 𝕜 u v) (convexHull 𝕜 {p, q, z}) := by rw [not_disjoint_iff] obtain ⟨az, bz, haz, hbz, habz, rfl⟩ := hz obtain rfl | haz' := haz.eq_or_lt · rw [zero_add] at habz rw [zero_smul, zero_add, habz, one_smul] refine ⟨v, by apply right_mem_segment, segment_subset_convexHull ?_ ?_ hv⟩ <;> simp obtain ⟨av, bv, hav, hbv, habv, rfl⟩ := hv obtain rfl | hav' := hav.eq_or_lt · rw [zero_add] at habv rw [zero_smul, zero_add, habv, one_smul] exact ⟨q, right_mem_segment _ _ _, subset_convexHull _ _ <| by simp⟩ obtain ⟨au, bu, hau, hbu, habu, rfl⟩ := hu have hab : 0 < az * av + bz * au := by positivity refine ⟨(az * av / (az * av + bz * au)) • (au • x + bu • p) + (bz * au / (az * av + bz * au)) • (av • y + bv • q), ⟨_, _, ?_, ?_, ?_, rfl⟩, ?_⟩ · positivity · positivity · rw [← add_div, div_self]; positivity rw [smul_add, smul_add, add_add_add_comm, add_comm, ← mul_smul, ← mul_smul] classical let w : Fin 3 → 𝕜 := ![az * av * bu, bz * au * bv, au * av] let z : Fin 3 → E := ![p, q, az • x + bz • y] have hw₀ : ∀ i, 0 ≤ w i := by rintro i fin_cases i · exact mul_nonneg (mul_nonneg haz hav) hbu · exact mul_nonneg (mul_nonneg hbz hau) hbv · exact mul_nonneg hau hav have hw : ∑ i, w i = az * av + bz * au := by trans az * av * bu + (bz * au * bv + au * av) · simp [w, Fin.sum_univ_succ, Fin.sum_univ_zero] rw [← one_mul (au * av), ← habz, add_mul, ← add_assoc, add_add_add_comm, mul_assoc, ← mul_add, mul_assoc, ← mul_add, mul_comm av, ← add_mul, ← mul_add, add_comm bu, add_comm bv, habu, habv, one_mul, mul_one] have hz : ∀ i, z i ∈ ({p, q, az • x + bz • y} : Set E) := fun i => by fin_cases i <;> simp [z] convert Finset.centerMass_mem_convexHull (Finset.univ : Finset (Fin 3)) (fun i _ => hw₀ i) (by rwa [hw]) fun i _ => hz i rw [Finset.centerMass] simp_rw [div_eq_inv_mul, hw, mul_assoc, mul_smul (az * av + bz * au)⁻¹, ← smul_add, add_assoc, ← mul_assoc] congr 3 rw [← mul_smul, ← mul_rotate, mul_right_comm, mul_smul, ← mul_smul _ av, mul_rotate, mul_smul _ bz, ← smul_add] simp only [w, z, smul_add, List.foldr, Matrix.cons_val_succ', Fin.mk_one, Matrix.cons_val_one, Matrix.head_cons, add_zero] #align not_disjoint_segment_convex_hull_triple not_disjoint_segment_convexHull_triple
Mathlib/Analysis/Convex/StoneSeparation.lean
81
109
theorem exists_convex_convex_compl_subset (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) (hst : Disjoint s t) : ∃ C : Set E, Convex 𝕜 C ∧ Convex 𝕜 Cᶜ ∧ s ⊆ C ∧ t ⊆ Cᶜ := by
let S : Set (Set E) := { C | Convex 𝕜 C ∧ Disjoint C t } obtain ⟨C, hC, hsC, hCmax⟩ := zorn_subset_nonempty S (fun c hcS hc ⟨_, _⟩ => ⟨⋃₀ c, ⟨hc.directedOn.convex_sUnion fun s hs => (hcS hs).1, disjoint_sUnion_left.2 fun c hc => (hcS hc).2⟩, fun s => subset_sUnion_of_mem⟩) s ⟨hs, hst⟩ refine ⟨C, hC.1, convex_iff_segment_subset.2 fun x hx y hy z hz hzC => ?_, hsC, hC.2.subset_compl_left⟩ suffices h : ∀ c ∈ Cᶜ, ∃ a ∈ C, (segment 𝕜 c a ∩ t).Nonempty by obtain ⟨p, hp, u, hu, hut⟩ := h x hx obtain ⟨q, hq, v, hv, hvt⟩ := h y hy refine not_disjoint_segment_convexHull_triple hz hu hv (hC.2.symm.mono (ht.segment_subset hut hvt) <| convexHull_min ?_ hC.1) simp [insert_subset_iff, hp, hq, singleton_subset_iff.2 hzC] rintro c hc by_contra! h suffices h : Disjoint (convexHull 𝕜 (insert c C)) t by rw [← hCmax _ ⟨convex_convexHull _ _, h⟩ ((subset_insert _ _).trans <| subset_convexHull _ _)] at hc exact hc (subset_convexHull _ _ <| mem_insert _ _) rw [convexHull_insert ⟨z, hzC⟩, convexJoin_singleton_left] refine disjoint_iUnion₂_left.2 fun a ha => disjoint_iff_inter_eq_empty.2 (h a ?_) rwa [← hC.1.convexHull_eq]
27
532,048,240,601.79865
2
2
2
2,105
import Mathlib.Topology.UniformSpace.CompactConvergence import Mathlib.Topology.UniformSpace.Equicontinuity import Mathlib.Topology.UniformSpace.Equiv open Set Filter Uniformity Topology Function UniformConvergence variable {ι X Y α β : Type*} [TopologicalSpace X] [UniformSpace α] [UniformSpace β] variable {F : ι → X → α} {G : ι → β → α}
Mathlib/Topology/UniformSpace/Ascoli.lean
85
125
theorem Equicontinuous.comap_uniformFun_eq [CompactSpace X] (F_eqcont : Equicontinuous F) : (UniformFun.uniformSpace X α).comap F = (Pi.uniformSpace _).comap F := by
-- The `≤` inequality is trivial refine le_antisymm (UniformSpace.comap_mono UniformFun.uniformContinuous_toFun) ?_ -- A bit of rewriting to get a nice intermediate statement. change comap _ _ ≤ comap _ _ simp_rw [Pi.uniformity, Filter.comap_iInf, comap_comap, Function.comp] refine ((UniformFun.hasBasis_uniformity X α).comap (Prod.map F F)).ge_iff.mpr ?_ -- Core of the proof: we need to show that, for any entourage `U` in `α`, -- the set `𝐓(U) := {(i,j) : ι × ι | ∀ x : X, (F i x, F j x) ∈ U}` belongs to the filter -- `⨅ x, comap ((i,j) ↦ (F i x, F j x)) (𝓤 α)`. -- In other words, we have to show that it contains a finite intersection of -- sets of the form `𝐒(V, x) := {(i,j) : ι × ι | (F i x, F j x) ∈ V}` for some -- `x : X` and `V ∈ 𝓤 α`. intro U hU -- We will do an `ε/3` argument, so we start by choosing a symmetric entourage `V ∈ 𝓤 α` -- such that `V ○ V ○ V ⊆ U`. rcases comp_comp_symm_mem_uniformity_sets hU with ⟨V, hV, Vsymm, hVU⟩ -- Set `Ω x := {y | ∀ i, (F i x, F i y) ∈ V}`. The equicontinuity of `F` guarantees that -- each `Ω x` is a neighborhood of `x`. let Ω x : Set X := {y | ∀ i, (F i x, F i y) ∈ V} -- Hence, by compactness of `X`, we can find some `A ⊆ X` finite such that the `Ω a`s for `a ∈ A` -- still cover `X`. rcases CompactSpace.elim_nhds_subcover Ω (fun x ↦ F_eqcont x V hV) with ⟨A, Acover⟩ -- We now claim that `⋂ a ∈ A, 𝐒(V, a) ⊆ 𝐓(U)`. have : (⋂ a ∈ A, {ij : ι × ι | (F ij.1 a, F ij.2 a) ∈ V}) ⊆ (Prod.map F F) ⁻¹' UniformFun.gen X α U := by -- Given `(i, j) ∈ ⋂ a ∈ A, 𝐒(V, a)` and `x : X`, we have to prove that `(F i x, F j x) ∈ U`. rintro ⟨i, j⟩ hij x rw [mem_iInter₂] at hij -- We know that `x ∈ Ω a` for some `a ∈ A`, so that both `(F i x, F i a)` and `(F j a, F j x)` -- are in `V`. rcases mem_iUnion₂.mp (Acover.symm.subset <| mem_univ x) with ⟨a, ha, hax⟩ -- Since `(i, j) ∈ 𝐒(V, a)` we also have `(F i a, F j a) ∈ V`, and finally we get -- `(F i x, F j x) ∈ V ○ V ○ V ⊆ U`. exact hVU (prod_mk_mem_compRel (prod_mk_mem_compRel (Vsymm.mk_mem_comm.mp (hax i)) (hij a ha)) (hax j)) -- This completes the proof. exact mem_of_superset (A.iInter_mem_sets.mpr fun x _ ↦ mem_iInf_of_mem x <| preimage_mem_comap hV) this
38
31,855,931,757,113,756
2
2
2
2,106
import Mathlib.Topology.UniformSpace.CompactConvergence import Mathlib.Topology.UniformSpace.Equicontinuity import Mathlib.Topology.UniformSpace.Equiv open Set Filter Uniformity Topology Function UniformConvergence variable {ι X Y α β : Type*} [TopologicalSpace X] [UniformSpace α] [UniformSpace β] variable {F : ι → X → α} {G : ι → β → α} theorem Equicontinuous.comap_uniformFun_eq [CompactSpace X] (F_eqcont : Equicontinuous F) : (UniformFun.uniformSpace X α).comap F = (Pi.uniformSpace _).comap F := by -- The `≤` inequality is trivial refine le_antisymm (UniformSpace.comap_mono UniformFun.uniformContinuous_toFun) ?_ -- A bit of rewriting to get a nice intermediate statement. change comap _ _ ≤ comap _ _ simp_rw [Pi.uniformity, Filter.comap_iInf, comap_comap, Function.comp] refine ((UniformFun.hasBasis_uniformity X α).comap (Prod.map F F)).ge_iff.mpr ?_ -- Core of the proof: we need to show that, for any entourage `U` in `α`, -- the set `𝐓(U) := {(i,j) : ι × ι | ∀ x : X, (F i x, F j x) ∈ U}` belongs to the filter -- `⨅ x, comap ((i,j) ↦ (F i x, F j x)) (𝓤 α)`. -- In other words, we have to show that it contains a finite intersection of -- sets of the form `𝐒(V, x) := {(i,j) : ι × ι | (F i x, F j x) ∈ V}` for some -- `x : X` and `V ∈ 𝓤 α`. intro U hU -- We will do an `ε/3` argument, so we start by choosing a symmetric entourage `V ∈ 𝓤 α` -- such that `V ○ V ○ V ⊆ U`. rcases comp_comp_symm_mem_uniformity_sets hU with ⟨V, hV, Vsymm, hVU⟩ -- Set `Ω x := {y | ∀ i, (F i x, F i y) ∈ V}`. The equicontinuity of `F` guarantees that -- each `Ω x` is a neighborhood of `x`. let Ω x : Set X := {y | ∀ i, (F i x, F i y) ∈ V} -- Hence, by compactness of `X`, we can find some `A ⊆ X` finite such that the `Ω a`s for `a ∈ A` -- still cover `X`. rcases CompactSpace.elim_nhds_subcover Ω (fun x ↦ F_eqcont x V hV) with ⟨A, Acover⟩ -- We now claim that `⋂ a ∈ A, 𝐒(V, a) ⊆ 𝐓(U)`. have : (⋂ a ∈ A, {ij : ι × ι | (F ij.1 a, F ij.2 a) ∈ V}) ⊆ (Prod.map F F) ⁻¹' UniformFun.gen X α U := by -- Given `(i, j) ∈ ⋂ a ∈ A, 𝐒(V, a)` and `x : X`, we have to prove that `(F i x, F j x) ∈ U`. rintro ⟨i, j⟩ hij x rw [mem_iInter₂] at hij -- We know that `x ∈ Ω a` for some `a ∈ A`, so that both `(F i x, F i a)` and `(F j a, F j x)` -- are in `V`. rcases mem_iUnion₂.mp (Acover.symm.subset <| mem_univ x) with ⟨a, ha, hax⟩ -- Since `(i, j) ∈ 𝐒(V, a)` we also have `(F i a, F j a) ∈ V`, and finally we get -- `(F i x, F j x) ∈ V ○ V ○ V ⊆ U`. exact hVU (prod_mk_mem_compRel (prod_mk_mem_compRel (Vsymm.mk_mem_comm.mp (hax i)) (hij a ha)) (hax j)) -- This completes the proof. exact mem_of_superset (A.iInter_mem_sets.mpr fun x _ ↦ mem_iInf_of_mem x <| preimage_mem_comap hV) this lemma Equicontinuous.uniformInducing_uniformFun_iff_pi [UniformSpace ι] [CompactSpace X] (F_eqcont : Equicontinuous F) : UniformInducing (UniformFun.ofFun ∘ F) ↔ UniformInducing F := by rw [uniformInducing_iff_uniformSpace, uniformInducing_iff_uniformSpace, ← F_eqcont.comap_uniformFun_eq] rfl lemma Equicontinuous.inducing_uniformFun_iff_pi [TopologicalSpace ι] [CompactSpace X] (F_eqcont : Equicontinuous F) : Inducing (UniformFun.ofFun ∘ F) ↔ Inducing F := by rw [inducing_iff, inducing_iff] change (_ = (UniformFun.uniformSpace X α |>.comap F |>.toTopologicalSpace)) ↔ (_ = (Pi.uniformSpace _ |>.comap F |>.toTopologicalSpace)) rw [F_eqcont.comap_uniformFun_eq]
Mathlib/Topology/UniformSpace/Ascoli.lean
163
199
theorem Equicontinuous.tendsto_uniformFun_iff_pi [CompactSpace X] (F_eqcont : Equicontinuous F) (ℱ : Filter ι) (f : X → α) : Tendsto (UniformFun.ofFun ∘ F) ℱ (𝓝 <| UniformFun.ofFun f) ↔ Tendsto F ℱ (𝓝 f) := by
-- Assume `ℱ` is non trivial. rcases ℱ.eq_or_neBot with rfl | ℱ_ne · simp constructor <;> intro H -- The forward direction is always true, the interesting part is the converse. · exact UniformFun.uniformContinuous_toFun.continuous.tendsto _|>.comp H -- To prove it, assume that `F` tends to `f` *pointwise* along `ℱ`. · set S : Set (X → α) := closure (range F) set 𝒢 : Filter S := comap (↑) (map F ℱ) -- We would like to use `Equicontinuous.comap_uniformFun_eq`, but applying it to `F` is not -- enough since `f` has no reason to be in the range of `F`. -- Instead, we will apply it to the inclusion `(↑) : S → (X → α)` where `S` is the closure of -- the range of `F` *for the product topology*. -- We know that `S` is still equicontinuous... have hS : S.Equicontinuous := closure' (by rwa [equicontinuous_iff_range] at F_eqcont) continuous_id -- ... hence, as announced, the product topology and uniform convergence topology -- coincide on `S`. have ind : Inducing (UniformFun.ofFun ∘ (↑) : S → X →ᵤ α) := hS.inducing_uniformFun_iff_pi.mpr ⟨rfl⟩ -- By construction, `f` is in `S`. have f_mem : f ∈ S := mem_closure_of_tendsto H range_mem_map -- To conclude, we just have to translate our hypothesis and goal as statements about -- `S`, on which we know the two topologies at play coincide. -- For this, we define a filter on `S` by `𝒢 := comap (↑) (map F ℱ)`, and note that -- it satisfies `map (↑) 𝒢 = map F ℱ`. Thus, both our hypothesis and our goal -- can be rewritten as `𝒢 ≤ 𝓝 f`, where the neighborhood filter in the RHS corresponds -- to one of the two topologies at play on `S`. Since they coincide, we are done. have h𝒢ℱ : map (↑) 𝒢 = map F ℱ := Filter.map_comap_of_mem (Subtype.range_coe ▸ mem_of_superset range_mem_map subset_closure) have H' : Tendsto id 𝒢 (𝓝 ⟨f, f_mem⟩) := by rwa [tendsto_id', nhds_induced, ← map_le_iff_le_comap, h𝒢ℱ] rwa [ind.tendsto_nhds_iff, comp_id, ← tendsto_map'_iff, h𝒢ℱ] at H'
33
214,643,579,785,916.06
2
2
2
2,106
import Mathlib.RingTheory.IntegrallyClosed import Mathlib.RingTheory.Localization.NumDen import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.rational_root from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" open scoped Polynomial section ScaleRoots variable {A K R S : Type*} [CommRing A] [Field K] [CommRing R] [CommRing S] variable {M : Submonoid A} [Algebra A S] [IsLocalization M S] [Algebra A K] [IsFractionRing A K] open Finsupp IsFractionRing IsLocalization Polynomial
Mathlib/RingTheory/Polynomial/RationalRoot.lean
39
44
theorem scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero {p : A[X]} {r : A} {s : M} (hr : aeval (mk' S r s) p = 0) : aeval (algebraMap A S r) (scaleRoots p s) = 0 := by
convert scaleRoots_eval₂_eq_zero (algebraMap A S) hr -- Porting note: added funext rw [aeval_def, mk'_spec' _ r s]
4
54.59815
2
2
2
2,107
import Mathlib.RingTheory.IntegrallyClosed import Mathlib.RingTheory.Localization.NumDen import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.rational_root from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" open scoped Polynomial section ScaleRoots variable {A K R S : Type*} [CommRing A] [Field K] [CommRing R] [CommRing S] variable {M : Submonoid A} [Algebra A S] [IsLocalization M S] [Algebra A K] [IsFractionRing A K] open Finsupp IsFractionRing IsLocalization Polynomial theorem scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero {p : A[X]} {r : A} {s : M} (hr : aeval (mk' S r s) p = 0) : aeval (algebraMap A S r) (scaleRoots p s) = 0 := by convert scaleRoots_eval₂_eq_zero (algebraMap A S) hr -- Porting note: added funext rw [aeval_def, mk'_spec' _ r s] #align scale_roots_aeval_eq_zero_of_aeval_mk'_eq_zero scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero variable [IsDomain A]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
49
54
theorem num_isRoot_scaleRoots_of_aeval_eq_zero [UniqueFactorizationMonoid A] {p : A[X]} {x : K} (hr : aeval x p = 0) : IsRoot (scaleRoots p (den A x)) (num A x) := by
apply isRoot_of_eval₂_map_eq_zero (IsFractionRing.injective A K) refine scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero ?_ rw [mk'_num_den] exact hr
4
54.59815
2
2
2
2,107
import Mathlib.Order.Zorn import Mathlib.Order.Atoms #align_import order.zorn_atoms from "leanprover-community/mathlib"@"9aba7801eeecebb61f58a5763c2b6dd1b47dc6ef" open Set
Mathlib/Order/ZornAtoms.lean
24
36
theorem IsCoatomic.of_isChain_bounded {α : Type*} [PartialOrder α] [OrderTop α] (h : ∀ c : Set α, IsChain (· ≤ ·) c → c.Nonempty → ⊤ ∉ c → ∃ x ≠ ⊤, x ∈ upperBounds c) : IsCoatomic α := by
refine ⟨fun x => le_top.eq_or_lt.imp_right fun hx => ?_⟩ have : ∃ y ∈ Ico x ⊤, x ≤ y ∧ ∀ z ∈ Ico x ⊤, y ≤ z → z = y := by refine zorn_nonempty_partialOrder₀ (Ico x ⊤) (fun c hxc hc y hy => ?_) x (left_mem_Ico.2 hx) rcases h c hc ⟨y, hy⟩ fun h => (hxc h).2.ne rfl with ⟨z, hz, hcz⟩ exact ⟨z, ⟨le_trans (hxc hy).1 (hcz hy), hz.lt_top⟩, hcz⟩ rcases this with ⟨y, ⟨hxy, hy⟩, -, hy'⟩ refine ⟨y, ⟨hy.ne, fun z hyz => le_top.eq_or_lt.resolve_right fun hz => ?_⟩, hxy⟩ exact hyz.ne' (hy' z ⟨hxy.trans hyz.le, hz⟩ hyz.le)
8
2,980.957987
2
2
1
2,108
import Mathlib.Algebra.Star.Basic import Mathlib.Algebra.Star.Pointwise import Mathlib.Algebra.Group.Centralizer variable {R : Type*} [Mul R] [StarMul R] {a : R} {s : Set R}
Mathlib/Algebra/Star/Center.lean
14
34
theorem Set.star_mem_center (ha : a ∈ Set.center R) : star a ∈ Set.center R where comm := by
simpa only [star_mul, star_star] using fun g => congr_arg star (((Set.mem_center_iff R).mp ha).comm <| star g).symm left_assoc b c := calc star a * (b * c) = star a * (star (star b) * star (star c)) := by rw [star_star, star_star] _ = star a * star (star c * star b) := by rw [star_mul] _ = star ((star c * star b) * a) := by rw [← star_mul] _ = star (star c * (star b * a)) := by rw [ha.right_assoc] _ = star (star b * a) * c := by rw [star_mul, star_star] _ = (star a * b) * c := by rw [star_mul, star_star] mid_assoc b c := calc b * star a * c = star (star c * star (b * star a)) := by rw [← star_mul, star_star] _ = star (star c * (a * star b)) := by rw [star_mul b, star_star] _ = star ((star c * a) * star b) := by rw [ha.mid_assoc] _ = b * (star a * c) := by rw [star_mul, star_star, star_mul (star c), star_star] right_assoc b c := calc b * c * star a = star (a * star (b * c)) := by rw [star_mul, star_star] _ = star (a * (star c * star b)) := by rw [star_mul b] _ = star ((a * star c) * star b) := by rw [ha.left_assoc] _ = b * star (a * star c) := by rw [star_mul, star_star] _ = b * (c * star a) := by rw [star_mul, star_star]
20
485,165,195.40979
2
2
1
2,109
import Mathlib.Algebra.Order.Field.Pi import Mathlib.Algebra.Order.UpperLower import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Data.Real.Sqrt import Mathlib.Topology.Algebra.Order.UpperLower import Mathlib.Topology.MetricSpace.Sequences #align_import analysis.normed.order.upper_lower from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010" open Bornology Function Metric Set open scoped Pointwise variable {α ι : Type*} section Finite variable [Finite ι] {s : Set (ι → ℝ)} {x y : ι → ℝ}
Mathlib/Analysis/Normed/Order/UpperLower.lean
94
109
theorem IsUpperSet.mem_interior_of_forall_lt (hs : IsUpperSet s) (hx : x ∈ closure s) (h : ∀ i, x i < y i) : y ∈ interior s := by
cases nonempty_fintype ι obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε rw [dist_pi_lt_iff hε] at hxz have hyz : ∀ i, z i < y i := by refine fun i => (hxy _).trans_le' (sub_le_iff_le_add'.1 <| (le_abs_self _).trans ?_) rw [← Real.norm_eq_abs, ← dist_eq_norm'] exact (hxz _).le obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩ rintro w hw refine hs (fun i => ?_) hz simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw exact ((lt_sub_iff_add_lt.2 <| hyz _).trans (hw _ <| mem_univ _).1).le
14
1,202,604.284165
2
2
2
2,110
import Mathlib.Algebra.Order.Field.Pi import Mathlib.Algebra.Order.UpperLower import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Data.Real.Sqrt import Mathlib.Topology.Algebra.Order.UpperLower import Mathlib.Topology.MetricSpace.Sequences #align_import analysis.normed.order.upper_lower from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010" open Bornology Function Metric Set open scoped Pointwise variable {α ι : Type*} section Finite variable [Finite ι] {s : Set (ι → ℝ)} {x y : ι → ℝ} theorem IsUpperSet.mem_interior_of_forall_lt (hs : IsUpperSet s) (hx : x ∈ closure s) (h : ∀ i, x i < y i) : y ∈ interior s := by cases nonempty_fintype ι obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε rw [dist_pi_lt_iff hε] at hxz have hyz : ∀ i, z i < y i := by refine fun i => (hxy _).trans_le' (sub_le_iff_le_add'.1 <| (le_abs_self _).trans ?_) rw [← Real.norm_eq_abs, ← dist_eq_norm'] exact (hxz _).le obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩ rintro w hw refine hs (fun i => ?_) hz simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw exact ((lt_sub_iff_add_lt.2 <| hyz _).trans (hw _ <| mem_univ _).1).le #align is_upper_set.mem_interior_of_forall_lt IsUpperSet.mem_interior_of_forall_lt
Mathlib/Analysis/Normed/Order/UpperLower.lean
112
128
theorem IsLowerSet.mem_interior_of_forall_lt (hs : IsLowerSet s) (hx : x ∈ closure s) (h : ∀ i, y i < x i) : y ∈ interior s := by
cases nonempty_fintype ι obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε rw [dist_pi_lt_iff hε] at hxz have hyz : ∀ i, y i < z i := by refine fun i => (lt_sub_iff_add_lt.2 <| hxy _).trans_le (sub_le_comm.1 <| (le_abs_self _).trans ?_) rw [← Real.norm_eq_abs, ← dist_eq_norm] exact (hxz _).le obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩ rintro w hw refine hs (fun i => ?_) hz simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw exact ((hw _ <| mem_univ _).2.trans <| hyz _).le
15
3,269,017.372472
2
2
2
2,110
import Mathlib.CategoryTheory.Idempotents.Karoubi #align_import category_theory.idempotents.functor_extension from "leanprover-community/mathlib"@"5f68029a863bdf76029fa0f7a519e6163c14152e" namespace CategoryTheory namespace Idempotents open Category Karoubi variable {C D E : Type*} [Category C] [Category D] [Category E]
Mathlib/CategoryTheory/Idempotents/FunctorExtension.lean
35
40
theorem natTrans_eq {F G : Karoubi C ⥤ D} (φ : F ⟶ G) (P : Karoubi C) : φ.app P = F.map (decompId_i P) ≫ φ.app P.X ≫ G.map (decompId_p P) := by
rw [← φ.naturality, ← assoc, ← F.map_comp] conv_lhs => rw [← id_comp (φ.app P), ← F.map_id] congr apply decompId
4
54.59815
2
2
1
2,111
import Mathlib.RepresentationTheory.Basic import Mathlib.RepresentationTheory.FdRep #align_import representation_theory.invariants from "leanprover-community/mathlib"@"55b3f8206b8596db8bb1804d8a92814a0b6670c9" suppress_compilation open MonoidAlgebra open Representation namespace GroupAlgebra variable (k G : Type*) [CommSemiring k] [Group G] variable [Fintype G] [Invertible (Fintype.card G : k)] noncomputable def average : MonoidAlgebra k G := ⅟ (Fintype.card G : k) • ∑ g : G, of k G g #align group_algebra.average GroupAlgebra.average @[simp]
Mathlib/RepresentationTheory/Invariants.lean
43
48
theorem mul_average_left (g : G) : ↑(Finsupp.single g 1) * average k G = average k G := by
simp only [mul_one, Finset.mul_sum, Algebra.mul_smul_comm, average, MonoidAlgebra.of_apply, Finset.sum_congr, MonoidAlgebra.single_mul_single] set f : G → MonoidAlgebra k G := fun x => Finsupp.single x 1 show ⅟ (Fintype.card G : k) • ∑ x : G, f (g * x) = ⅟ (Fintype.card G : k) • ∑ x : G, f x rw [Function.Bijective.sum_comp (Group.mulLeft_bijective g) _]
5
148.413159
2
2
3
2,112
import Mathlib.RepresentationTheory.Basic import Mathlib.RepresentationTheory.FdRep #align_import representation_theory.invariants from "leanprover-community/mathlib"@"55b3f8206b8596db8bb1804d8a92814a0b6670c9" suppress_compilation open MonoidAlgebra open Representation namespace GroupAlgebra variable (k G : Type*) [CommSemiring k] [Group G] variable [Fintype G] [Invertible (Fintype.card G : k)] noncomputable def average : MonoidAlgebra k G := ⅟ (Fintype.card G : k) • ∑ g : G, of k G g #align group_algebra.average GroupAlgebra.average @[simp] theorem mul_average_left (g : G) : ↑(Finsupp.single g 1) * average k G = average k G := by simp only [mul_one, Finset.mul_sum, Algebra.mul_smul_comm, average, MonoidAlgebra.of_apply, Finset.sum_congr, MonoidAlgebra.single_mul_single] set f : G → MonoidAlgebra k G := fun x => Finsupp.single x 1 show ⅟ (Fintype.card G : k) • ∑ x : G, f (g * x) = ⅟ (Fintype.card G : k) • ∑ x : G, f x rw [Function.Bijective.sum_comp (Group.mulLeft_bijective g) _] #align group_algebra.mul_average_left GroupAlgebra.mul_average_left @[simp]
Mathlib/RepresentationTheory/Invariants.lean
54
59
theorem mul_average_right (g : G) : average k G * ↑(Finsupp.single g 1) = average k G := by
simp only [mul_one, Finset.sum_mul, Algebra.smul_mul_assoc, average, MonoidAlgebra.of_apply, Finset.sum_congr, MonoidAlgebra.single_mul_single] set f : G → MonoidAlgebra k G := fun x => Finsupp.single x 1 show ⅟ (Fintype.card G : k) • ∑ x : G, f (x * g) = ⅟ (Fintype.card G : k) • ∑ x : G, f x rw [Function.Bijective.sum_comp (Group.mulRight_bijective g) _]
5
148.413159
2
2
3
2,112
import Mathlib.RepresentationTheory.Basic import Mathlib.RepresentationTheory.FdRep #align_import representation_theory.invariants from "leanprover-community/mathlib"@"55b3f8206b8596db8bb1804d8a92814a0b6670c9" suppress_compilation open MonoidAlgebra open Representation namespace Representation namespace linHom universe u open CategoryTheory Action section Rep variable {k : Type u} [CommRing k] {G : GroupCat.{u}}
Mathlib/RepresentationTheory/Invariants.lean
133
139
theorem mem_invariants_iff_comm {X Y : Rep k G} (f : X.V →ₗ[k] Y.V) (g : G) : (linHom X.ρ Y.ρ) g f = f ↔ f.comp (X.ρ g) = (Y.ρ g).comp f := by
dsimp erw [← ρAut_apply_inv] rw [← LinearMap.comp_assoc, ← ModuleCat.comp_def, ← ModuleCat.comp_def, Iso.inv_comp_eq, ρAut_apply_hom] exact comm
5
148.413159
2
2
3
2,112
import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic import Mathlib.CategoryTheory.Monoidal.Functorial import Mathlib.CategoryTheory.Monoidal.Types.Basic import Mathlib.LinearAlgebra.DirectSum.Finsupp import Mathlib.CategoryTheory.Linear.LinearFunctor #align_import algebra.category.Module.adjunctions from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4" set_option linter.uppercaseLean3 false -- `Module` noncomputable section open CategoryTheory namespace ModuleCat universe u open scoped Classical variable (R : Type u) section variable [Ring R] @[simps] def free : Type u ⥤ ModuleCat R where obj X := ModuleCat.of R (X →₀ R) map {X Y} f := Finsupp.lmapDomain _ _ f map_id := by intros; exact Finsupp.lmapDomain_id _ _ map_comp := by intros; exact Finsupp.lmapDomain_comp _ _ _ _ #align Module.free ModuleCat.free def adj : free R ⊣ forget (ModuleCat.{u} R) := Adjunction.mkOfHomEquiv { homEquiv := fun X M => (Finsupp.lift M R X).toEquiv.symm homEquiv_naturality_left_symm := fun {_ _} M f g => Finsupp.lhom_ext' fun x => LinearMap.ext_ring (Finsupp.sum_mapDomain_index_addMonoidHom fun y => (smulAddHom R M).flip (g y)).symm } #align Module.adj ModuleCat.adj instance : (forget (ModuleCat.{u} R)).IsRightAdjoint := (adj R).isRightAdjoint end namespace Free open MonoidalCategory variable [CommRing R] attribute [local ext] TensorProduct.ext def ε : 𝟙_ (ModuleCat.{u} R) ⟶ (free R).obj (𝟙_ (Type u)) := Finsupp.lsingle PUnit.unit #align Module.free.ε ModuleCat.Free.ε -- This lemma has always been bad, but lean4#2644 made `simp` start noticing @[simp, nolint simpNF] theorem ε_apply (r : R) : ε R r = Finsupp.single PUnit.unit r := rfl #align Module.free.ε_apply ModuleCat.Free.ε_apply def μ (α β : Type u) : (free R).obj α ⊗ (free R).obj β ≅ (free R).obj (α ⊗ β) := (finsuppTensorFinsupp' R α β).toModuleIso #align Module.free.μ ModuleCat.Free.μ
Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean
89
109
theorem μ_natural {X Y X' Y' : Type u} (f : X ⟶ Y) (g : X' ⟶ Y') : ((free R).map f ⊗ (free R).map g) ≫ (μ R Y Y').hom = (μ R X X').hom ≫ (free R).map (f ⊗ g) := by
-- Porting note (#11041): broken ext apply TensorProduct.ext apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply Finsupp.lhom_ext' intro x' apply LinearMap.ext_ring apply Finsupp.ext intro ⟨y, y'⟩ -- Porting note (#10934): used to be dsimp [μ] change (finsuppTensorFinsupp' R Y Y') (Finsupp.mapDomain f (Finsupp.single x 1) ⊗ₜ[R] Finsupp.mapDomain g (Finsupp.single x' 1)) _ = (Finsupp.mapDomain (f ⊗ g) (finsuppTensorFinsupp' R X X' (Finsupp.single x 1 ⊗ₜ[R] Finsupp.single x' 1))) _ -- extra `rfl` after leanprover/lean4#2466 simp_rw [Finsupp.mapDomain_single, finsuppTensorFinsupp'_single_tmul_single, mul_one, Finsupp.mapDomain_single, CategoryTheory.tensor_apply]; rfl
18
65,659,969.137331
2
2
3
2,113
import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic import Mathlib.CategoryTheory.Monoidal.Functorial import Mathlib.CategoryTheory.Monoidal.Types.Basic import Mathlib.LinearAlgebra.DirectSum.Finsupp import Mathlib.CategoryTheory.Linear.LinearFunctor #align_import algebra.category.Module.adjunctions from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4" set_option linter.uppercaseLean3 false -- `Module` noncomputable section open CategoryTheory namespace ModuleCat universe u open scoped Classical variable (R : Type u) section variable [Ring R] @[simps] def free : Type u ⥤ ModuleCat R where obj X := ModuleCat.of R (X →₀ R) map {X Y} f := Finsupp.lmapDomain _ _ f map_id := by intros; exact Finsupp.lmapDomain_id _ _ map_comp := by intros; exact Finsupp.lmapDomain_comp _ _ _ _ #align Module.free ModuleCat.free def adj : free R ⊣ forget (ModuleCat.{u} R) := Adjunction.mkOfHomEquiv { homEquiv := fun X M => (Finsupp.lift M R X).toEquiv.symm homEquiv_naturality_left_symm := fun {_ _} M f g => Finsupp.lhom_ext' fun x => LinearMap.ext_ring (Finsupp.sum_mapDomain_index_addMonoidHom fun y => (smulAddHom R M).flip (g y)).symm } #align Module.adj ModuleCat.adj instance : (forget (ModuleCat.{u} R)).IsRightAdjoint := (adj R).isRightAdjoint end namespace Free open MonoidalCategory variable [CommRing R] attribute [local ext] TensorProduct.ext def ε : 𝟙_ (ModuleCat.{u} R) ⟶ (free R).obj (𝟙_ (Type u)) := Finsupp.lsingle PUnit.unit #align Module.free.ε ModuleCat.Free.ε -- This lemma has always been bad, but lean4#2644 made `simp` start noticing @[simp, nolint simpNF] theorem ε_apply (r : R) : ε R r = Finsupp.single PUnit.unit r := rfl #align Module.free.ε_apply ModuleCat.Free.ε_apply def μ (α β : Type u) : (free R).obj α ⊗ (free R).obj β ≅ (free R).obj (α ⊗ β) := (finsuppTensorFinsupp' R α β).toModuleIso #align Module.free.μ ModuleCat.Free.μ theorem μ_natural {X Y X' Y' : Type u} (f : X ⟶ Y) (g : X' ⟶ Y') : ((free R).map f ⊗ (free R).map g) ≫ (μ R Y Y').hom = (μ R X X').hom ≫ (free R).map (f ⊗ g) := by -- Porting note (#11041): broken ext apply TensorProduct.ext apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply Finsupp.lhom_ext' intro x' apply LinearMap.ext_ring apply Finsupp.ext intro ⟨y, y'⟩ -- Porting note (#10934): used to be dsimp [μ] change (finsuppTensorFinsupp' R Y Y') (Finsupp.mapDomain f (Finsupp.single x 1) ⊗ₜ[R] Finsupp.mapDomain g (Finsupp.single x' 1)) _ = (Finsupp.mapDomain (f ⊗ g) (finsuppTensorFinsupp' R X X' (Finsupp.single x 1 ⊗ₜ[R] Finsupp.single x' 1))) _ -- extra `rfl` after leanprover/lean4#2466 simp_rw [Finsupp.mapDomain_single, finsuppTensorFinsupp'_single_tmul_single, mul_one, Finsupp.mapDomain_single, CategoryTheory.tensor_apply]; rfl #align Module.free.μ_natural ModuleCat.Free.μ_natural
Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean
112
129
theorem left_unitality (X : Type u) : (λ_ ((free R).obj X)).hom = (ε R ⊗ 𝟙 ((free R).obj X)) ≫ (μ R (𝟙_ (Type u)) X).hom ≫ map (free R).obj (λ_ X).hom := by
-- Porting note (#11041): broken ext apply TensorProduct.ext apply LinearMap.ext_ring apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply Finsupp.ext intro x' -- Porting note (#10934): used to be dsimp [ε, μ] let q : X →₀ R := ((λ_ (of R (X →₀ R))).hom) (1 ⊗ₜ[R] Finsupp.single x 1) change q x' = Finsupp.mapDomain (λ_ X).hom (finsuppTensorFinsupp' R (𝟙_ (Type u)) X (Finsupp.single PUnit.unit 1 ⊗ₜ[R] Finsupp.single x 1)) x' simp_rw [q, finsuppTensorFinsupp'_single_tmul_single, ModuleCat.MonoidalCategory.leftUnitor_hom_apply, mul_one, Finsupp.mapDomain_single, CategoryTheory.leftUnitor_hom_apply, one_smul]
15
3,269,017.372472
2
2
3
2,113
import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic import Mathlib.CategoryTheory.Monoidal.Functorial import Mathlib.CategoryTheory.Monoidal.Types.Basic import Mathlib.LinearAlgebra.DirectSum.Finsupp import Mathlib.CategoryTheory.Linear.LinearFunctor #align_import algebra.category.Module.adjunctions from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4" set_option linter.uppercaseLean3 false -- `Module` noncomputable section open CategoryTheory namespace ModuleCat universe u open scoped Classical variable (R : Type u) section variable [Ring R] @[simps] def free : Type u ⥤ ModuleCat R where obj X := ModuleCat.of R (X →₀ R) map {X Y} f := Finsupp.lmapDomain _ _ f map_id := by intros; exact Finsupp.lmapDomain_id _ _ map_comp := by intros; exact Finsupp.lmapDomain_comp _ _ _ _ #align Module.free ModuleCat.free def adj : free R ⊣ forget (ModuleCat.{u} R) := Adjunction.mkOfHomEquiv { homEquiv := fun X M => (Finsupp.lift M R X).toEquiv.symm homEquiv_naturality_left_symm := fun {_ _} M f g => Finsupp.lhom_ext' fun x => LinearMap.ext_ring (Finsupp.sum_mapDomain_index_addMonoidHom fun y => (smulAddHom R M).flip (g y)).symm } #align Module.adj ModuleCat.adj instance : (forget (ModuleCat.{u} R)).IsRightAdjoint := (adj R).isRightAdjoint end namespace Free open MonoidalCategory variable [CommRing R] attribute [local ext] TensorProduct.ext def ε : 𝟙_ (ModuleCat.{u} R) ⟶ (free R).obj (𝟙_ (Type u)) := Finsupp.lsingle PUnit.unit #align Module.free.ε ModuleCat.Free.ε -- This lemma has always been bad, but lean4#2644 made `simp` start noticing @[simp, nolint simpNF] theorem ε_apply (r : R) : ε R r = Finsupp.single PUnit.unit r := rfl #align Module.free.ε_apply ModuleCat.Free.ε_apply def μ (α β : Type u) : (free R).obj α ⊗ (free R).obj β ≅ (free R).obj (α ⊗ β) := (finsuppTensorFinsupp' R α β).toModuleIso #align Module.free.μ ModuleCat.Free.μ theorem μ_natural {X Y X' Y' : Type u} (f : X ⟶ Y) (g : X' ⟶ Y') : ((free R).map f ⊗ (free R).map g) ≫ (μ R Y Y').hom = (μ R X X').hom ≫ (free R).map (f ⊗ g) := by -- Porting note (#11041): broken ext apply TensorProduct.ext apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply Finsupp.lhom_ext' intro x' apply LinearMap.ext_ring apply Finsupp.ext intro ⟨y, y'⟩ -- Porting note (#10934): used to be dsimp [μ] change (finsuppTensorFinsupp' R Y Y') (Finsupp.mapDomain f (Finsupp.single x 1) ⊗ₜ[R] Finsupp.mapDomain g (Finsupp.single x' 1)) _ = (Finsupp.mapDomain (f ⊗ g) (finsuppTensorFinsupp' R X X' (Finsupp.single x 1 ⊗ₜ[R] Finsupp.single x' 1))) _ -- extra `rfl` after leanprover/lean4#2466 simp_rw [Finsupp.mapDomain_single, finsuppTensorFinsupp'_single_tmul_single, mul_one, Finsupp.mapDomain_single, CategoryTheory.tensor_apply]; rfl #align Module.free.μ_natural ModuleCat.Free.μ_natural theorem left_unitality (X : Type u) : (λ_ ((free R).obj X)).hom = (ε R ⊗ 𝟙 ((free R).obj X)) ≫ (μ R (𝟙_ (Type u)) X).hom ≫ map (free R).obj (λ_ X).hom := by -- Porting note (#11041): broken ext apply TensorProduct.ext apply LinearMap.ext_ring apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply Finsupp.ext intro x' -- Porting note (#10934): used to be dsimp [ε, μ] let q : X →₀ R := ((λ_ (of R (X →₀ R))).hom) (1 ⊗ₜ[R] Finsupp.single x 1) change q x' = Finsupp.mapDomain (λ_ X).hom (finsuppTensorFinsupp' R (𝟙_ (Type u)) X (Finsupp.single PUnit.unit 1 ⊗ₜ[R] Finsupp.single x 1)) x' simp_rw [q, finsuppTensorFinsupp'_single_tmul_single, ModuleCat.MonoidalCategory.leftUnitor_hom_apply, mul_one, Finsupp.mapDomain_single, CategoryTheory.leftUnitor_hom_apply, one_smul] #align Module.free.left_unitality ModuleCat.Free.left_unitality
Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean
132
149
theorem right_unitality (X : Type u) : (ρ_ ((free R).obj X)).hom = (𝟙 ((free R).obj X) ⊗ ε R) ≫ (μ R X (𝟙_ (Type u))).hom ≫ map (free R).obj (ρ_ X).hom := by
-- Porting note (#11041): broken ext apply TensorProduct.ext apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply LinearMap.ext_ring apply Finsupp.ext intro x' -- Porting note (#10934): used to be dsimp [ε, μ] let q : X →₀ R := ((ρ_ (of R (X →₀ R))).hom) (Finsupp.single x 1 ⊗ₜ[R] 1) change q x' = Finsupp.mapDomain (ρ_ X).hom (finsuppTensorFinsupp' R X (𝟙_ (Type u)) (Finsupp.single x 1 ⊗ₜ[R] Finsupp.single PUnit.unit 1)) x' simp_rw [q, finsuppTensorFinsupp'_single_tmul_single, ModuleCat.MonoidalCategory.rightUnitor_hom_apply, mul_one, Finsupp.mapDomain_single, CategoryTheory.rightUnitor_hom_apply, one_smul]
15
3,269,017.372472
2
2
3
2,113
import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.Algebra.Group.UniqueProds #align_import algebra.monoid_algebra.no_zero_divisors from "leanprover-community/mathlib"@"3e067975886cf5801e597925328c335609511b1a" open Finsupp variable {R A : Type*} [Semiring R] namespace MonoidAlgebra
Mathlib/Algebra/MonoidAlgebra/NoZeroDivisors.lean
68
79
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A} (h : UniqueMul f.support g.support a0 b0) : (f * g) (a0 * b0) = f a0 * g b0 := by
classical simp_rw [mul_apply, sum, ← Finset.sum_product'] refine (Finset.sum_eq_single (a0, b0) ?_ ?_).trans (if_pos rfl) <;> simp_rw [Finset.mem_product] · refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_) exacts [(h hab.1 hab.2 he).1, (h hab.1 hab.2 he).2] · refine fun hnmem => ite_eq_right_iff.mpr (fun _ => ?_) rcases not_and_or.mp hnmem with af | bg · rw [not_mem_support_iff.mp af, zero_mul] · rw [not_mem_support_iff.mp bg, mul_zero]
9
8,103.083928
2
2
1
2,114
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.LinearAlgebra.FreeModule.Basic #align_import linear_algebra.free_module.pid from "leanprover-community/mathlib"@"d87199d51218d36a0a42c66c82d147b5a7ff87b3" universe u v section Ring variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type*} (b : Basis ι R M) open Submodule.IsPrincipal Submodule
Mathlib/LinearAlgebra/FreeModule/PID.lean
59
69
theorem eq_bot_of_generator_maximal_map_eq_zero (b : Basis ι R M) {N : Submodule R M} {ϕ : M →ₗ[R] R} (hϕ : ∀ ψ : M →ₗ[R] R, ¬N.map ϕ < N.map ψ) [(N.map ϕ).IsPrincipal] (hgen : generator (N.map ϕ) = (0 : R)) : N = ⊥ := by
rw [Submodule.eq_bot_iff] intro x hx refine b.ext_elem fun i ↦ ?_ rw [(eq_bot_iff_generator_eq_zero _).mpr hgen] at hϕ rw [LinearEquiv.map_zero, Finsupp.zero_apply] exact (Submodule.eq_bot_iff _).mp (not_bot_lt_iff.1 <| hϕ (Finsupp.lapply i ∘ₗ ↑b.repr)) _ ⟨x, hx, rfl⟩
8
2,980.957987
2
2
3
2,115
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.LinearAlgebra.FreeModule.Basic #align_import linear_algebra.free_module.pid from "leanprover-community/mathlib"@"d87199d51218d36a0a42c66c82d147b5a7ff87b3" universe u v section Ring variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type*} (b : Basis ι R M) open Submodule.IsPrincipal Submodule theorem eq_bot_of_generator_maximal_map_eq_zero (b : Basis ι R M) {N : Submodule R M} {ϕ : M →ₗ[R] R} (hϕ : ∀ ψ : M →ₗ[R] R, ¬N.map ϕ < N.map ψ) [(N.map ϕ).IsPrincipal] (hgen : generator (N.map ϕ) = (0 : R)) : N = ⊥ := by rw [Submodule.eq_bot_iff] intro x hx refine b.ext_elem fun i ↦ ?_ rw [(eq_bot_iff_generator_eq_zero _).mpr hgen] at hϕ rw [LinearEquiv.map_zero, Finsupp.zero_apply] exact (Submodule.eq_bot_iff _).mp (not_bot_lt_iff.1 <| hϕ (Finsupp.lapply i ∘ₗ ↑b.repr)) _ ⟨x, hx, rfl⟩ #align eq_bot_of_generator_maximal_map_eq_zero eq_bot_of_generator_maximal_map_eq_zero
Mathlib/LinearAlgebra/FreeModule/PID.lean
72
81
theorem eq_bot_of_generator_maximal_submoduleImage_eq_zero {N O : Submodule R M} (b : Basis ι R O) (hNO : N ≤ O) {ϕ : O →ₗ[R] R} (hϕ : ∀ ψ : O →ₗ[R] R, ¬ϕ.submoduleImage N < ψ.submoduleImage N) [(ϕ.submoduleImage N).IsPrincipal] (hgen : generator (ϕ.submoduleImage N) = 0) : N = ⊥ := by
rw [Submodule.eq_bot_iff] intro x hx refine (mk_eq_zero _ _).mp (show (⟨x, hNO hx⟩ : O) = 0 from b.ext_elem fun i ↦ ?_) rw [(eq_bot_iff_generator_eq_zero _).mpr hgen] at hϕ rw [LinearEquiv.map_zero, Finsupp.zero_apply] refine (Submodule.eq_bot_iff _).mp (not_bot_lt_iff.1 <| hϕ (Finsupp.lapply i ∘ₗ ↑b.repr)) _ ?_ exact (LinearMap.mem_submoduleImage_of_le hNO).mpr ⟨x, hx, rfl⟩
7
1,096.633158
2
2
3
2,115
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.LinearAlgebra.FreeModule.Basic #align_import linear_algebra.free_module.pid from "leanprover-community/mathlib"@"d87199d51218d36a0a42c66c82d147b5a7ff87b3" universe u v section IsDomain variable {ι : Type*} {R : Type*} [CommRing R] [IsDomain R] variable {M : Type*} [AddCommGroup M] [Module R M] {b : ι → M} open Submodule.IsPrincipal Set Submodule
Mathlib/LinearAlgebra/FreeModule/PID.lean
93
98
theorem dvd_generator_iff {I : Ideal R} [I.IsPrincipal] {x : R} (hx : x ∈ I) : x ∣ generator I ↔ I = Ideal.span {x} := by
conv_rhs => rw [← span_singleton_generator I] rw [Ideal.submodule_span_eq, Ideal.span_singleton_eq_span_singleton, ← dvd_dvd_iff_associated, ← mem_iff_generator_dvd] exact ⟨fun h ↦ ⟨hx, h⟩, fun h ↦ h.2⟩
4
54.59815
2
2
3
2,115
import Mathlib.Analysis.Complex.Liouville import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.FieldTheory.PolynomialGaloisGroup import Mathlib.Topology.Algebra.Polynomial #align_import analysis.complex.polynomial from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" open Polynomial Bornology Complex open scoped ComplexConjugate namespace Complex
Mathlib/Analysis/Complex/Polynomial.lean
34
45
theorem exists_root {f : ℂ[X]} (hf : 0 < degree f) : ∃ z : ℂ, IsRoot f z := by
by_contra! hf' /- Since `f` has no roots, `f⁻¹` is differentiable. And since `f` is a polynomial, it tends to infinity at infinity, thus `f⁻¹` tends to zero at infinity. By Liouville's theorem, `f⁻¹ = 0`. -/ have (z : ℂ) : (f.eval z)⁻¹ = 0 := (f.differentiable.inv hf').apply_eq_of_tendsto_cocompact z <| Metric.cobounded_eq_cocompact (α := ℂ) ▸ (Filter.tendsto_inv₀_cobounded.comp <| by simpa only [tendsto_norm_atTop_iff_cobounded] using f.tendsto_norm_atTop hf tendsto_norm_cobounded_atTop) -- Thus `f = 0`, contradicting the fact that `0 < degree f`. obtain rfl : f = C 0 := Polynomial.funext fun z ↦ inv_injective <| by simp [this] simp at hf
11
59,874.141715
2
2
1
2,116
import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.Extr import Mathlib.Topology.Order.ExtrClosure #align_import analysis.complex.abs_max from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory AffineMap Bornology open scoped Topology Filter NNReal Real universe u v w variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] {F : Type v} [NormedAddCommGroup F] [NormedSpace ℂ F] local postfix:100 "̂" => UniformSpace.Completion namespace Complex
Mathlib/Analysis/Complex/AbsMax.lean
106
137
theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by
-- Consider a circle of radius `r = dist w z`. set r : ℝ := dist w z have hw : w ∈ closedBall z r := mem_closedBall.2 le_rfl -- Assume the converse. Since `‖f w‖ ≤ ‖f z‖`, we have `‖f w‖ < ‖f z‖`. refine (isMaxOn_iff.1 hz _ hw).antisymm (not_lt.1 ?_) rintro hw_lt : ‖f w‖ < ‖f z‖ have hr : 0 < r := dist_pos.2 (ne_of_apply_ne (norm ∘ f) hw_lt.ne) -- Due to Cauchy integral formula, it suffices to prove the following inequality. suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖ by refine this.ne ?_ have A : (∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ) = (2 * π * I : ℂ) • f z := hd.circleIntegral_sub_inv_smul (mem_ball_self hr) simp [A, norm_smul, Real.pi_pos.le] suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r) by rwa [mul_assoc, mul_div_cancel₀ _ hr.ne'] at this /- This inequality is true because `‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r` for all `ζ` on the circle and this inequality is strict at `ζ = w`. -/ have hsub : sphere z r ⊆ closedBall z r := sphere_subset_closedBall refine circleIntegral.norm_integral_lt_of_norm_le_const_of_lt hr ?_ ?_ ⟨w, rfl, ?_⟩ · show ContinuousOn (fun ζ : ℂ => (ζ - z)⁻¹ • f ζ) (sphere z r) refine ((continuousOn_id.sub continuousOn_const).inv₀ ?_).smul (hd.continuousOn_ball.mono hsub) exact fun ζ hζ => sub_ne_zero.2 (ne_of_mem_sphere hζ hr.ne') · show ∀ ζ ∈ sphere z r, ‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r rintro ζ (hζ : abs (ζ - z) = r) rw [le_div_iff hr, norm_smul, norm_inv, norm_eq_abs, hζ, mul_comm, mul_inv_cancel_left₀ hr.ne'] exact hz (hsub hζ) show ‖(w - z)⁻¹ • f w‖ < ‖f z‖ / r rw [norm_smul, norm_inv, norm_eq_abs, ← div_eq_inv_mul] exact (div_lt_div_right hr).2 hw_lt
29
3,931,334,297,144.042
2
2
4
2,117
import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.Extr import Mathlib.Topology.Order.ExtrClosure #align_import analysis.complex.abs_max from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory AffineMap Bornology open scoped Topology Filter NNReal Real universe u v w variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] {F : Type v} [NormedAddCommGroup F] [NormedSpace ℂ F] local postfix:100 "̂" => UniformSpace.Completion namespace Complex theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by -- Consider a circle of radius `r = dist w z`. set r : ℝ := dist w z have hw : w ∈ closedBall z r := mem_closedBall.2 le_rfl -- Assume the converse. Since `‖f w‖ ≤ ‖f z‖`, we have `‖f w‖ < ‖f z‖`. refine (isMaxOn_iff.1 hz _ hw).antisymm (not_lt.1 ?_) rintro hw_lt : ‖f w‖ < ‖f z‖ have hr : 0 < r := dist_pos.2 (ne_of_apply_ne (norm ∘ f) hw_lt.ne) -- Due to Cauchy integral formula, it suffices to prove the following inequality. suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖ by refine this.ne ?_ have A : (∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ) = (2 * π * I : ℂ) • f z := hd.circleIntegral_sub_inv_smul (mem_ball_self hr) simp [A, norm_smul, Real.pi_pos.le] suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r) by rwa [mul_assoc, mul_div_cancel₀ _ hr.ne'] at this have hsub : sphere z r ⊆ closedBall z r := sphere_subset_closedBall refine circleIntegral.norm_integral_lt_of_norm_le_const_of_lt hr ?_ ?_ ⟨w, rfl, ?_⟩ · show ContinuousOn (fun ζ : ℂ => (ζ - z)⁻¹ • f ζ) (sphere z r) refine ((continuousOn_id.sub continuousOn_const).inv₀ ?_).smul (hd.continuousOn_ball.mono hsub) exact fun ζ hζ => sub_ne_zero.2 (ne_of_mem_sphere hζ hr.ne') · show ∀ ζ ∈ sphere z r, ‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r rintro ζ (hζ : abs (ζ - z) = r) rw [le_div_iff hr, norm_smul, norm_inv, norm_eq_abs, hζ, mul_comm, mul_inv_cancel_left₀ hr.ne'] exact hz (hsub hζ) show ‖(w - z)⁻¹ • f w‖ < ‖f z‖ / r rw [norm_smul, norm_inv, norm_eq_abs, ← div_eq_inv_mul] exact (div_lt_div_right hr).2 hw_lt #align complex.norm_max_aux₁ Complex.norm_max_aux₁
Mathlib/Analysis/Complex/AbsMax.lean
144
151
theorem norm_max_aux₂ {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by
set e : F →L[ℂ] F̂ := UniformSpace.Completion.toComplL have he : ∀ x, ‖e x‖ = ‖x‖ := UniformSpace.Completion.norm_coe replace hz : IsMaxOn (norm ∘ e ∘ f) (closedBall z (dist w z)) z := by simpa only [IsMaxOn, (· ∘ ·), he] using hz simpa only [he, (· ∘ ·)] using norm_max_aux₁ (e.differentiable.comp_diffContOnCl hd) hz
6
403.428793
2
2
4
2,117
import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.Extr import Mathlib.Topology.Order.ExtrClosure #align_import analysis.complex.abs_max from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory AffineMap Bornology open scoped Topology Filter NNReal Real universe u v w variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] {F : Type v} [NormedAddCommGroup F] [NormedSpace ℂ F] local postfix:100 "̂" => UniformSpace.Completion namespace Complex theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by -- Consider a circle of radius `r = dist w z`. set r : ℝ := dist w z have hw : w ∈ closedBall z r := mem_closedBall.2 le_rfl -- Assume the converse. Since `‖f w‖ ≤ ‖f z‖`, we have `‖f w‖ < ‖f z‖`. refine (isMaxOn_iff.1 hz _ hw).antisymm (not_lt.1 ?_) rintro hw_lt : ‖f w‖ < ‖f z‖ have hr : 0 < r := dist_pos.2 (ne_of_apply_ne (norm ∘ f) hw_lt.ne) -- Due to Cauchy integral formula, it suffices to prove the following inequality. suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖ by refine this.ne ?_ have A : (∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ) = (2 * π * I : ℂ) • f z := hd.circleIntegral_sub_inv_smul (mem_ball_self hr) simp [A, norm_smul, Real.pi_pos.le] suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r) by rwa [mul_assoc, mul_div_cancel₀ _ hr.ne'] at this have hsub : sphere z r ⊆ closedBall z r := sphere_subset_closedBall refine circleIntegral.norm_integral_lt_of_norm_le_const_of_lt hr ?_ ?_ ⟨w, rfl, ?_⟩ · show ContinuousOn (fun ζ : ℂ => (ζ - z)⁻¹ • f ζ) (sphere z r) refine ((continuousOn_id.sub continuousOn_const).inv₀ ?_).smul (hd.continuousOn_ball.mono hsub) exact fun ζ hζ => sub_ne_zero.2 (ne_of_mem_sphere hζ hr.ne') · show ∀ ζ ∈ sphere z r, ‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r rintro ζ (hζ : abs (ζ - z) = r) rw [le_div_iff hr, norm_smul, norm_inv, norm_eq_abs, hζ, mul_comm, mul_inv_cancel_left₀ hr.ne'] exact hz (hsub hζ) show ‖(w - z)⁻¹ • f w‖ < ‖f z‖ / r rw [norm_smul, norm_inv, norm_eq_abs, ← div_eq_inv_mul] exact (div_lt_div_right hr).2 hw_lt #align complex.norm_max_aux₁ Complex.norm_max_aux₁ theorem norm_max_aux₂ {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by set e : F →L[ℂ] F̂ := UniformSpace.Completion.toComplL have he : ∀ x, ‖e x‖ = ‖x‖ := UniformSpace.Completion.norm_coe replace hz : IsMaxOn (norm ∘ e ∘ f) (closedBall z (dist w z)) z := by simpa only [IsMaxOn, (· ∘ ·), he] using hz simpa only [he, (· ∘ ·)] using norm_max_aux₁ (e.differentiable.comp_diffContOnCl hd) hz #align complex.norm_max_aux₂ Complex.norm_max_aux₂
Mathlib/Analysis/Complex/AbsMax.lean
159
164
theorem norm_max_aux₃ {f : ℂ → F} {z w : ℂ} {r : ℝ} (hr : dist w z = r) (hd : DiffContOnCl ℂ f (ball z r)) (hz : IsMaxOn (norm ∘ f) (ball z r) z) : ‖f w‖ = ‖f z‖ := by
subst r rcases eq_or_ne w z with (rfl | hne); · rfl rw [← dist_ne_zero] at hne exact norm_max_aux₂ hd (closure_ball z hne ▸ hz.closure hd.continuousOn.norm)
4
54.59815
2
2
4
2,117
import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.Extr import Mathlib.Topology.Order.ExtrClosure #align_import analysis.complex.abs_max from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory AffineMap Bornology open scoped Topology Filter NNReal Real universe u v w variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] {F : Type v} [NormedAddCommGroup F] [NormedSpace ℂ F] local postfix:100 "̂" => UniformSpace.Completion namespace Complex theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by -- Consider a circle of radius `r = dist w z`. set r : ℝ := dist w z have hw : w ∈ closedBall z r := mem_closedBall.2 le_rfl -- Assume the converse. Since `‖f w‖ ≤ ‖f z‖`, we have `‖f w‖ < ‖f z‖`. refine (isMaxOn_iff.1 hz _ hw).antisymm (not_lt.1 ?_) rintro hw_lt : ‖f w‖ < ‖f z‖ have hr : 0 < r := dist_pos.2 (ne_of_apply_ne (norm ∘ f) hw_lt.ne) -- Due to Cauchy integral formula, it suffices to prove the following inequality. suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖ by refine this.ne ?_ have A : (∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ) = (2 * π * I : ℂ) • f z := hd.circleIntegral_sub_inv_smul (mem_ball_self hr) simp [A, norm_smul, Real.pi_pos.le] suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r) by rwa [mul_assoc, mul_div_cancel₀ _ hr.ne'] at this have hsub : sphere z r ⊆ closedBall z r := sphere_subset_closedBall refine circleIntegral.norm_integral_lt_of_norm_le_const_of_lt hr ?_ ?_ ⟨w, rfl, ?_⟩ · show ContinuousOn (fun ζ : ℂ => (ζ - z)⁻¹ • f ζ) (sphere z r) refine ((continuousOn_id.sub continuousOn_const).inv₀ ?_).smul (hd.continuousOn_ball.mono hsub) exact fun ζ hζ => sub_ne_zero.2 (ne_of_mem_sphere hζ hr.ne') · show ∀ ζ ∈ sphere z r, ‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r rintro ζ (hζ : abs (ζ - z) = r) rw [le_div_iff hr, norm_smul, norm_inv, norm_eq_abs, hζ, mul_comm, mul_inv_cancel_left₀ hr.ne'] exact hz (hsub hζ) show ‖(w - z)⁻¹ • f w‖ < ‖f z‖ / r rw [norm_smul, norm_inv, norm_eq_abs, ← div_eq_inv_mul] exact (div_lt_div_right hr).2 hw_lt #align complex.norm_max_aux₁ Complex.norm_max_aux₁ theorem norm_max_aux₂ {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by set e : F →L[ℂ] F̂ := UniformSpace.Completion.toComplL have he : ∀ x, ‖e x‖ = ‖x‖ := UniformSpace.Completion.norm_coe replace hz : IsMaxOn (norm ∘ e ∘ f) (closedBall z (dist w z)) z := by simpa only [IsMaxOn, (· ∘ ·), he] using hz simpa only [he, (· ∘ ·)] using norm_max_aux₁ (e.differentiable.comp_diffContOnCl hd) hz #align complex.norm_max_aux₂ Complex.norm_max_aux₂ theorem norm_max_aux₃ {f : ℂ → F} {z w : ℂ} {r : ℝ} (hr : dist w z = r) (hd : DiffContOnCl ℂ f (ball z r)) (hz : IsMaxOn (norm ∘ f) (ball z r) z) : ‖f w‖ = ‖f z‖ := by subst r rcases eq_or_ne w z with (rfl | hne); · rfl rw [← dist_ne_zero] at hne exact norm_max_aux₂ hd (closure_ball z hne ▸ hz.closure hd.continuousOn.norm) #align complex.norm_max_aux₃ Complex.norm_max_aux₃
Mathlib/Analysis/Complex/AbsMax.lean
181
196
theorem norm_eqOn_closedBall_of_isMaxOn {f : E → F} {z : E} {r : ℝ} (hd : DiffContOnCl ℂ f (ball z r)) (hz : IsMaxOn (norm ∘ f) (ball z r) z) : EqOn (norm ∘ f) (const E ‖f z‖) (closedBall z r) := by
intro w hw rw [mem_closedBall, dist_comm] at hw rcases eq_or_ne z w with (rfl | hne); · rfl set e := (lineMap z w : ℂ → E) have hde : Differentiable ℂ e := (differentiable_id.smul_const (w - z)).add_const z suffices ‖(f ∘ e) (1 : ℂ)‖ = ‖(f ∘ e) (0 : ℂ)‖ by simpa [e] have hr : dist (1 : ℂ) 0 = 1 := by simp have hball : MapsTo e (ball 0 1) (ball z r) := by refine ((lipschitzWith_lineMap z w).mapsTo_ball (mt nndist_eq_zero.1 hne) 0 1).mono Subset.rfl ?_ simpa only [lineMap_apply_zero, mul_one, coe_nndist] using ball_subset_ball hw exact norm_max_aux₃ hr (hd.comp hde.diffContOnCl hball) (hz.comp_mapsTo hball (lineMap_apply_zero z w))
13
442,413.392009
2
2
4
2,117
import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.RingTheory.Ideal.Basic #align_import algebra.monoid_algebra.ideal from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951" variable {k A G : Type*}
Mathlib/Algebra/MonoidAlgebra/Ideal.lean
23
58
theorem MonoidAlgebra.mem_ideal_span_of_image [Monoid G] [Semiring k] {s : Set G} {x : MonoidAlgebra k G} : x ∈ Ideal.span (MonoidAlgebra.of k G '' s) ↔ ∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d * m' := by
let RHS : Ideal (MonoidAlgebra k G) := { carrier := { p | ∀ m : G, m ∈ p.support → ∃ m' ∈ s, ∃ d, m = d * m' } add_mem' := fun {x y} hx hy m hm => by classical exact (Finset.mem_union.1 <| Finsupp.support_add hm).elim (hx m) (hy m) zero_mem' := fun m hm => by cases hm smul_mem' := fun x y hy m hm => by classical rw [smul_eq_mul, mul_def] at hm replace hm := Finset.mem_biUnion.mp (Finsupp.support_sum hm) obtain ⟨xm, -, hm⟩ := hm replace hm := Finset.mem_biUnion.mp (Finsupp.support_sum hm) obtain ⟨ym, hym, hm⟩ := hm obtain rfl := Finset.mem_singleton.mp (Finsupp.support_single_subset hm) refine (hy _ hym).imp fun sm p => And.imp_right ?_ p rintro ⟨d, rfl⟩ exact ⟨xm * d, (mul_assoc _ _ _).symm⟩ } change _ ↔ x ∈ RHS constructor · revert x rw [← SetLike.le_def] -- Porting note: refine needs this even though it's defeq? refine Ideal.span_le.2 ?_ rintro _ ⟨i, hi, rfl⟩ m hm refine ⟨_, hi, 1, ?_⟩ obtain rfl := Finset.mem_singleton.mp (Finsupp.support_single_subset hm) exact (one_mul _).symm · intro hx rw [← Finsupp.sum_single x] refine Ideal.sum_mem _ fun i hi => ?_ -- Porting note: changed `apply` to `refine` obtain ⟨d, hd, d2, rfl⟩ := hx _ hi convert Ideal.mul_mem_left _ (id <| Finsupp.single d2 <| x (d2 * d) : MonoidAlgebra k G) _ pick_goal 3 · exact Ideal.subset_span ⟨_, hd, rfl⟩ rw [id, MonoidAlgebra.of_apply, MonoidAlgebra.single_mul_single, mul_one]
33
214,643,579,785,916.06
2
2
1
2,118
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
30
49
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩
18
65,659,969.137331
2
2
6
2,119
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ #align real.deriv_arcsin_aux Real.deriv_arcsin_aux theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x := (deriv_arcsin_aux h₁ h₂).1 #align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasDerivAt arcsin (1 / √(1 - x ^ 2)) x := (hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt #align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x := (deriv_arcsin_aux h₁ h₂).2.of_le le_top #align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
66
71
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h') · convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_one_le] · exact (hasDerivAt_arcsin h h').hasDerivWithinAt
4
54.59815
2
2
6
2,119
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ #align real.deriv_arcsin_aux Real.deriv_arcsin_aux theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x := (deriv_arcsin_aux h₁ h₂).1 #align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasDerivAt arcsin (1 / √(1 - x ^ 2)) x := (hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt #align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x := (deriv_arcsin_aux h₁ h₂).2.of_le le_top #align real.cont_diff_at_arcsin Real.contDiffAt_arcsin theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by rcases eq_or_ne x 1 with (rfl | h') · convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_one_le] · exact (hasDerivAt_arcsin h h').hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
74
79
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h') · convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_le_neg_one] · exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
4
54.59815
2
2
6
2,119
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ #align real.deriv_arcsin_aux Real.deriv_arcsin_aux theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x := (deriv_arcsin_aux h₁ h₂).1 #align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasDerivAt arcsin (1 / √(1 - x ^ 2)) x := (hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt #align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x := (deriv_arcsin_aux h₁ h₂).2.of_le le_top #align real.cont_diff_at_arcsin Real.contDiffAt_arcsin theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by rcases eq_or_ne x 1 with (rfl | h') · convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_one_le] · exact (hasDerivAt_arcsin h h').hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by rcases em (x = -1) with (rfl | h') · convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_le_neg_one] · exact (hasDerivAt_arcsin h' h).hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
82
90
theorem differentiableWithinAt_arcsin_Ici {x : ℝ} : DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩ rintro h rfl have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using sin_arcsin' have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp) simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
7
1,096.633158
2
2
6
2,119
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ #align real.deriv_arcsin_aux Real.deriv_arcsin_aux theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x := (deriv_arcsin_aux h₁ h₂).1 #align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasDerivAt arcsin (1 / √(1 - x ^ 2)) x := (hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt #align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x := (deriv_arcsin_aux h₁ h₂).2.of_le le_top #align real.cont_diff_at_arcsin Real.contDiffAt_arcsin theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by rcases eq_or_ne x 1 with (rfl | h') · convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_one_le] · exact (hasDerivAt_arcsin h h').hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by rcases em (x = -1) with (rfl | h') · convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_le_neg_one] · exact (hasDerivAt_arcsin h' h).hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic theorem differentiableWithinAt_arcsin_Ici {x : ℝ} : DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩ rintro h rfl have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using sin_arcsin' have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp) simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _) #align real.differentiable_within_at_arcsin_Ici Real.differentiableWithinAt_arcsin_Ici
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
93
98
theorem differentiableWithinAt_arcsin_Iic {x : ℝ} : DifferentiableWithinAt ℝ arcsin (Iic x) x ↔ x ≠ 1 := by
refine ⟨fun h => ?_, fun h => (hasDerivWithinAt_arcsin_Iic h).differentiableWithinAt⟩ rw [← neg_neg x, ← image_neg_Ici] at h have := (h.comp (-x) differentiableWithinAt_id.neg (mapsTo_image _ _)).neg simpa [(· ∘ ·), differentiableWithinAt_arcsin_Ici] using this
4
54.59815
2
2
6
2,119
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ #align real.deriv_arcsin_aux Real.deriv_arcsin_aux theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x := (deriv_arcsin_aux h₁ h₂).1 #align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasDerivAt arcsin (1 / √(1 - x ^ 2)) x := (hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt #align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x := (deriv_arcsin_aux h₁ h₂).2.of_le le_top #align real.cont_diff_at_arcsin Real.contDiffAt_arcsin theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by rcases eq_or_ne x 1 with (rfl | h') · convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_one_le] · exact (hasDerivAt_arcsin h h').hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by rcases em (x = -1) with (rfl | h') · convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_le_neg_one] · exact (hasDerivAt_arcsin h' h).hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic theorem differentiableWithinAt_arcsin_Ici {x : ℝ} : DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩ rintro h rfl have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using sin_arcsin' have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp) simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _) #align real.differentiable_within_at_arcsin_Ici Real.differentiableWithinAt_arcsin_Ici theorem differentiableWithinAt_arcsin_Iic {x : ℝ} : DifferentiableWithinAt ℝ arcsin (Iic x) x ↔ x ≠ 1 := by refine ⟨fun h => ?_, fun h => (hasDerivWithinAt_arcsin_Iic h).differentiableWithinAt⟩ rw [← neg_neg x, ← image_neg_Ici] at h have := (h.comp (-x) differentiableWithinAt_id.neg (mapsTo_image _ _)).neg simpa [(· ∘ ·), differentiableWithinAt_arcsin_Ici] using this #align real.differentiable_within_at_arcsin_Iic Real.differentiableWithinAt_arcsin_Iic theorem differentiableAt_arcsin {x : ℝ} : DifferentiableAt ℝ arcsin x ↔ x ≠ -1 ∧ x ≠ 1 := ⟨fun h => ⟨differentiableWithinAt_arcsin_Ici.1 h.differentiableWithinAt, differentiableWithinAt_arcsin_Iic.1 h.differentiableWithinAt⟩, fun h => (hasDerivAt_arcsin h.1 h.2).differentiableAt⟩ #align real.differentiable_at_arcsin Real.differentiableAt_arcsin @[simp]
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
108
114
theorem deriv_arcsin : deriv arcsin = fun x => 1 / √(1 - x ^ 2) := by
funext x by_cases h : x ≠ -1 ∧ x ≠ 1 · exact (hasDerivAt_arcsin h.1 h.2).deriv · rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_arcsin.1 h)] simp only [not_and_or, Ne, Classical.not_not] at h rcases h with (rfl | rfl) <;> simp
6
403.428793
2
2
6
2,119