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
eval_complexity
float64
0
1
import Mathlib.LinearAlgebra.Dimension.Free import Mathlib.Algebra.Module.Torsion #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v v' u₁' w w' variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v} variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*} open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁] variable [Module R M] [Module R M'] [Module R M₁] section Quotient
Mathlib/LinearAlgebra/Dimension/Constructions.lean
47
56
theorem LinearIndependent.sum_elim_of_quotient {M' : Submodule R M} {ι₁ ι₂} {f : ι₁ → M'} (hf : LinearIndependent R f) (g : ι₂ → M) (hg : LinearIndependent R (Submodule.Quotient.mk (p := M') ∘ g)) : LinearIndependent R (Sum.elim (f · : ι₁ → M) g) := by
refine .sum_type (hf.map' M'.subtype M'.ker_subtype) (.of_comp M'.mkQ hg) ?_ refine disjoint_def.mpr fun x h₁ h₂ ↦ ?_ have : x ∈ M' := span_le.mpr (Set.range_subset_iff.mpr fun i ↦ (f i).prop) h₁ obtain ⟨c, rfl⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp h₂ simp_rw [← Quotient.mk_eq_zero, ← mkQ_apply, map_finsupp_sum, map_smul, mkQ_apply] at this rw [linearIndependent_iff.mp hg _ this, Finsupp.sum_zero_index]
0
import Mathlib.Data.Finset.Pointwise import Mathlib.SetTheory.Cardinal.Finite #align_import combinatorics.additive.ruzsa_covering from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205" open Pointwise namespace Finset variable {α : Type*} [DecidableEq α] [CommGroup α] (s : Finset α) {t : Finset α} @[to_additive "**Ruzsa's covering lemma**"]
Mathlib/Combinatorics/Additive/RuzsaCovering.lean
31
53
theorem exists_subset_mul_div (ht : t.Nonempty) : ∃ u : Finset α, u.card * t.card ≤ (s * t).card ∧ s ⊆ u * t / t := by
haveI : ∀ u, Decidable ((u : Set α).PairwiseDisjoint (· • t)) := fun u ↦ Classical.dec _ set C := s.powerset.filter fun u ↦ u.toSet.PairwiseDisjoint (· • t) obtain ⟨u, hu, hCmax⟩ := C.exists_maximal (filter_nonempty_iff.2 ⟨∅, empty_mem_powerset _, by rw [coe_empty]; exact Set.pairwiseDisjoint_empty⟩) rw [mem_filter, mem_powerset] at hu refine ⟨u, (card_mul_iff.2 <| pairwiseDisjoint_smul_iff.1 hu.2).ge.trans (card_le_card <| mul_subset_mul_right hu.1), fun a ha ↦ ?_⟩ rw [mul_div_assoc] by_cases hau : a ∈ u · exact subset_mul_left _ ht.one_mem_div hau by_cases H : ∀ b ∈ u, Disjoint (a • t) (b • t) · refine (hCmax _ ?_ <| ssubset_insert hau).elim rw [mem_filter, mem_powerset, insert_subset_iff, coe_insert] exact ⟨⟨ha, hu.1⟩, hu.2.insert fun _ hb _ ↦ H _ hb⟩ push_neg at H simp_rw [not_disjoint_iff, ← inv_smul_mem_iff] at H obtain ⟨b, hb, c, hc₁, hc₂⟩ := H refine mem_mul.2 ⟨b, hb, a / b, ?_, by simp⟩ exact mem_div.2 ⟨_, hc₂, _, hc₁, by simp [inv_mul_eq_div]⟩
0
import Mathlib.Algebra.Algebra.Subalgebra.Basic import Mathlib.Algebra.MvPolynomial.Rename import Mathlib.Algebra.MvPolynomial.CommRing #align_import ring_theory.mv_polynomial.symmetric from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" open Equiv (Perm) noncomputable section namespace Multiset variable {R : Type*} [CommSemiring R] def esymm (s : Multiset R) (n : ℕ) : R := ((s.powersetCard n).map Multiset.prod).sum #align multiset.esymm Multiset.esymm
Mathlib/RingTheory/MvPolynomial/Symmetric.lean
63
66
theorem _root_.Finset.esymm_map_val {σ} (f : σ → R) (s : Finset σ) (n : ℕ) : (s.val.map f).esymm n = (s.powersetCard n).sum fun t => t.prod f := by
simp only [esymm, powersetCard_map, ← Finset.map_val_val_powersetCard, map_map] rfl
0
import Mathlib.Algebra.Associated import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Order.Group.Abs import Mathlib.Algebra.Ring.Divisibility.Basic #align_import ring_theory.prime from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" section CancelCommMonoidWithZero variable {R : Type*} [CancelCommMonoidWithZero R] open Finset
Mathlib/RingTheory/Prime.lean
28
46
theorem mul_eq_mul_prime_prod {α : Type*} [DecidableEq α] {x y a : R} {s : Finset α} {p : α → R} (hp : ∀ i ∈ s, Prime (p i)) (hx : x * y = a * ∏ i ∈ s, p i) : ∃ (t u : Finset α) (b c : R), t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ (x = b * ∏ i ∈ t, p i) ∧ y = c * ∏ i ∈ u, p i := by
induction' s using Finset.induction with i s his ih generalizing x y a · exact ⟨∅, ∅, x, y, by simp [hx]⟩ · rw [prod_insert his, ← mul_assoc] at hx have hpi : Prime (p i) := hp i (mem_insert_self _ _) rcases ih (fun i hi ↦ hp i (mem_insert_of_mem hi)) hx with ⟨t, u, b, c, htus, htu, hbc, rfl, rfl⟩ have hit : i ∉ t := fun hit ↦ his (htus ▸ mem_union_left _ hit) have hiu : i ∉ u := fun hiu ↦ his (htus ▸ mem_union_right _ hiu) obtain ⟨d, rfl⟩ | ⟨d, rfl⟩ : p i ∣ b ∨ p i ∣ c := hpi.dvd_or_dvd ⟨a, by rw [← hbc, mul_comm]⟩ · rw [mul_assoc, mul_comm a, mul_right_inj' hpi.ne_zero] at hbc exact ⟨insert i t, u, d, c, by rw [insert_union, htus], disjoint_insert_left.2 ⟨hiu, htu⟩, by simp [hbc, prod_insert hit, mul_assoc, mul_comm, mul_left_comm]⟩ · rw [← mul_assoc, mul_right_comm b, mul_left_inj' hpi.ne_zero] at hbc exact ⟨t, insert i u, b, d, by rw [union_insert, htus], disjoint_insert_right.2 ⟨hit, htu⟩, by simp [← hbc, prod_insert hiu, mul_assoc, mul_comm, mul_left_comm]⟩
0
import Mathlib.Analysis.BoxIntegral.Partition.Filter import Mathlib.Analysis.BoxIntegral.Partition.Measure import Mathlib.Topology.UniformSpace.Compact import Mathlib.Init.Data.Bool.Lemmas #align_import analysis.box_integral.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open scoped Classical Topology NNReal Filter Uniformity BoxIntegral open Set Finset Function Filter Metric BoxIntegral.IntegrationParams noncomputable section namespace BoxIntegral universe u v w variable {ι : Type u} {E : Type v} {F : Type w} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {I J : Box ι} {π : TaggedPrepartition I} open TaggedPrepartition local notation "ℝⁿ" => ι → ℝ def integralSum (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) : F := ∑ J ∈ π.boxes, vol J (f (π.tag J)) #align box_integral.integral_sum BoxIntegral.integralSum theorem integralSum_biUnionTagged (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : Prepartition I) (πi : ∀ J, TaggedPrepartition J) : integralSum f vol (π.biUnionTagged πi) = ∑ J ∈ π.boxes, integralSum f vol (πi J) := by refine (π.sum_biUnion_boxes _ _).trans <| sum_congr rfl fun J hJ => sum_congr rfl fun J' hJ' => ?_ rw [π.tag_biUnionTagged hJ hJ'] #align box_integral.integral_sum_bUnion_tagged BoxIntegral.integralSum_biUnionTagged
Mathlib/Analysis/BoxIntegral/Basic.lean
90
100
theorem integralSum_biUnion_partition (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) (πi : ∀ J, Prepartition J) (hπi : ∀ J ∈ π, (πi J).IsPartition) : integralSum f vol (π.biUnionPrepartition πi) = integralSum f vol π := by
refine (π.sum_biUnion_boxes _ _).trans (sum_congr rfl fun J hJ => ?_) calc (∑ J' ∈ (πi J).boxes, vol J' (f (π.tag <| π.toPrepartition.biUnionIndex πi J'))) = ∑ J' ∈ (πi J).boxes, vol J' (f (π.tag J)) := sum_congr rfl fun J' hJ' => by rw [Prepartition.biUnionIndex_of_mem _ hJ hJ'] _ = vol J (f (π.tag J)) := (vol.map ⟨⟨fun g : E →L[ℝ] F => g (f (π.tag J)), rfl⟩, fun _ _ => rfl⟩).sum_partition_boxes le_top (hπi J hJ)
0
import Mathlib.Algebra.CharP.Quotient import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Data.Finsupp.Fintype import Mathlib.Data.Int.AbsoluteValue import Mathlib.Data.Int.Associated import Mathlib.LinearAlgebra.FreeModule.Determinant import Mathlib.LinearAlgebra.FreeModule.IdealQuotient import Mathlib.RingTheory.DedekindDomain.PID import Mathlib.RingTheory.Ideal.Basis import Mathlib.RingTheory.LocalProperties import Mathlib.RingTheory.Localization.NormTrace #align_import ring_theory.ideal.norm from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped nonZeroDivisors section abs_norm namespace Submodule variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] section noncomputable def cardQuot (S : Submodule R M) : ℕ := AddSubgroup.index S.toAddSubgroup #align submodule.card_quot Submodule.cardQuot @[simp]
Mathlib/RingTheory/Ideal/Norm.lean
70
74
theorem cardQuot_apply (S : Submodule R M) [h : Fintype (M ⧸ S)] : cardQuot S = Fintype.card (M ⧸ S) := by
-- Porting note: original proof was AddSubgroup.index_eq_card _ suffices Fintype (M ⧸ S.toAddSubgroup) by convert AddSubgroup.index_eq_card S.toAddSubgroup convert h
0
import Mathlib.Analysis.Calculus.Deriv.Pow import Mathlib.Analysis.Calculus.Deriv.Inv #align_import analysis.calculus.deriv.zpow from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter open Filter Asymptotics Set variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {E : Type v} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {x : 𝕜} variable {s : Set 𝕜} variable {m : ℤ} theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) : HasStrictDerivAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) x := by have : ∀ m : ℤ, 0 < m → HasStrictDerivAt (· ^ m) ((m : 𝕜) * x ^ (m - 1)) x := fun m hm ↦ by lift m to ℕ using hm.le simp only [zpow_natCast, Int.cast_natCast] convert hasStrictDerivAt_pow m x using 2 rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_natCast] norm_cast at hm rcases lt_trichotomy m 0 with (hm | hm | hm) · have hx : x ≠ 0 := h.resolve_right hm.not_le have := (hasStrictDerivAt_inv ?_).scomp _ (this (-m) (neg_pos.2 hm)) <;> [skip; exact zpow_ne_zero _ hx] simp only [(· ∘ ·), zpow_neg, one_div, inv_inv, smul_eq_mul] at this convert this using 1 rw [sq, mul_inv, inv_inv, Int.cast_neg, neg_mul, neg_mul_neg, ← zpow_add₀ hx, mul_assoc, ← zpow_add₀ hx] congr abel · simp only [hm, zpow_zero, Int.cast_zero, zero_mul, hasStrictDerivAt_const] · exact this m hm #align has_strict_deriv_at_zpow hasStrictDerivAt_zpow theorem hasDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) : HasDerivAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) x := (hasStrictDerivAt_zpow m x h).hasDerivAt #align has_deriv_at_zpow hasDerivAt_zpow theorem hasDerivWithinAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) (s : Set 𝕜) : HasDerivWithinAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) s x := (hasDerivAt_zpow m x h).hasDerivWithinAt #align has_deriv_within_at_zpow hasDerivWithinAt_zpow theorem differentiableAt_zpow : DifferentiableAt 𝕜 (fun x => x ^ m) x ↔ x ≠ 0 ∨ 0 ≤ m := ⟨fun H => NormedField.continuousAt_zpow.1 H.continuousAt, fun H => (hasDerivAt_zpow m x H).differentiableAt⟩ #align differentiable_at_zpow differentiableAt_zpow theorem differentiableWithinAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) : DifferentiableWithinAt 𝕜 (fun x => x ^ m) s x := (differentiableAt_zpow.mpr h).differentiableWithinAt #align differentiable_within_at_zpow differentiableWithinAt_zpow theorem differentiableOn_zpow (m : ℤ) (s : Set 𝕜) (h : (0 : 𝕜) ∉ s ∨ 0 ≤ m) : DifferentiableOn 𝕜 (fun x => x ^ m) s := fun x hxs => differentiableWithinAt_zpow m x <| h.imp_left <| ne_of_mem_of_not_mem hxs #align differentiable_on_zpow differentiableOn_zpow theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m - 1) := by by_cases H : x ≠ 0 ∨ 0 ≤ m · exact (hasDerivAt_zpow m x H).deriv · rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_zpow.1 H)] push_neg at H rcases H with ⟨rfl, hm⟩ rw [zero_zpow _ ((sub_one_lt _).trans hm).ne, mul_zero] #align deriv_zpow deriv_zpow @[simp] theorem deriv_zpow' (m : ℤ) : (deriv fun x : 𝕜 => x ^ m) = fun x => (m : 𝕜) * x ^ (m - 1) := funext <| deriv_zpow m #align deriv_zpow' deriv_zpow' theorem derivWithin_zpow (hxs : UniqueDiffWithinAt 𝕜 s x) (h : x ≠ 0 ∨ 0 ≤ m) : derivWithin (fun x => x ^ m) s x = (m : 𝕜) * x ^ (m - 1) := (hasDerivWithinAt_zpow m x h s).derivWithin hxs #align deriv_within_zpow derivWithin_zpow @[simp] theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) : (deriv^[k] fun x : 𝕜 => x ^ m) = fun x => (∏ i ∈ Finset.range k, ((m : 𝕜) - i)) * x ^ (m - k) := by induction' k with k ihk · simp only [Nat.zero_eq, one_mul, Int.ofNat_zero, id, sub_zero, Finset.prod_range_zero, Function.iterate_zero] · simp only [Function.iterate_succ_apply', ihk, deriv_const_mul_field', deriv_zpow', Finset.prod_range_succ, Int.ofNat_succ, ← sub_sub, Int.cast_sub, Int.cast_natCast, mul_assoc] #align iter_deriv_zpow' iter_deriv_zpow' theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) : deriv^[k] (fun y => y ^ m) x = (∏ i ∈ Finset.range k, ((m : 𝕜) - i)) * x ^ (m - k) := congr_fun (iter_deriv_zpow' m k) x #align iter_deriv_zpow iter_deriv_zpow
Mathlib/Analysis/Calculus/Deriv/ZPow.lean
121
128
theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) : deriv^[k] (fun x : 𝕜 => x ^ n) x = (∏ i ∈ Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) := by
simp only [← zpow_natCast, iter_deriv_zpow, Int.cast_natCast] rcases le_or_lt k n with hkn | hnk · rw [Int.ofNat_sub hkn] · have : (∏ i ∈ Finset.range k, (n - i : 𝕜)) = 0 := Finset.prod_eq_zero (Finset.mem_range.2 hnk) (sub_self _) simp only [this, zero_mul]
0
import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.Topology.Category.TopCat.Limits.Basic #align_import topology.category.Top.limits.konig from "leanprover-community/mathlib"@"dbdf71cee7bb20367cb7e37279c08b0c218cf967" -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open CategoryTheory open CategoryTheory.Limits -- Porting note: changed universe order as `v` is usually passed explicitly universe v u w noncomputable section namespace TopCat section TopologicalKonig variable {J : Type u} [SmallCategory J] -- Porting note: generalized `F` to land in `v` not `u` variable (F : J ⥤ TopCat.{v}) private abbrev FiniteDiagramArrow {J : Type u} [SmallCategory J] (G : Finset J) := Σ' (X Y : J) (_ : X ∈ G) (_ : Y ∈ G), X ⟶ Y private abbrev FiniteDiagram (J : Type u) [SmallCategory J] := Σ G : Finset J, Finset (FiniteDiagramArrow G) -- Porting note: generalized `F` to land in `v` not `u` def partialSections {J : Type u} [SmallCategory J] (F : J ⥤ TopCat.{v}) {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : Set (∀ j, F.obj j) := {u | ∀ {f : FiniteDiagramArrow G} (_ : f ∈ H), F.map f.2.2.2.2 (u f.1) = u f.2.1} #align Top.partial_sections TopCat.partialSections theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)] {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by classical cases isEmpty_or_nonempty J · exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩ haveI : IsCofiltered J := ⟨⟩ use fun j : J => if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some else (h _).some rintro ⟨X, Y, hX, hY, f⟩ hf dsimp only rwa [dif_pos hX, dif_pos hY, ← comp_app, ← F.map_comp, @IsCofiltered.infTo_commutes _ _ _ G H] #align Top.partial_sections.nonempty TopCat.partialSections.nonempty
Mathlib/Topology/Category/TopCat/Limits/Konig.lean
84
104
theorem partialSections.directed : Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
classical intro A B let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f => ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩ let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f => ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩ refine ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, ?_, ?_⟩ · rintro u hu f hf have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by apply Finset.mem_union_left rw [Finset.mem_image] exact ⟨f, hf, rfl⟩ exact hu this · rintro u hu f hf have : ιB f ∈ A.2.image ιA ⊔ B.2.image ιB := by apply Finset.mem_union_right rw [Finset.mem_image] exact ⟨f, hf, rfl⟩ exact hu this
0
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import measure_theory.function.egorov from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open MeasureTheory NNReal ENNReal Topology namespace MeasureTheory open Set Filter TopologicalSpace variable {α β ι : Type*} {m : MeasurableSpace α} [MetricSpace β] {μ : Measure α} namespace Egorov def notConvergentSeq [Preorder ι] (f : ι → α → β) (g : α → β) (n : ℕ) (j : ι) : Set α := ⋃ (k) (_ : j ≤ k), { x | 1 / (n + 1 : ℝ) < dist (f k x) (g x) } #align measure_theory.egorov.not_convergent_seq MeasureTheory.Egorov.notConvergentSeq variable {n : ℕ} {i j : ι} {s : Set α} {ε : ℝ} {f : ι → α → β} {g : α → β} theorem mem_notConvergentSeq_iff [Preorder ι] {x : α} : x ∈ notConvergentSeq f g n j ↔ ∃ k ≥ j, 1 / (n + 1 : ℝ) < dist (f k x) (g x) := by simp_rw [notConvergentSeq, Set.mem_iUnion, exists_prop, mem_setOf] #align measure_theory.egorov.mem_not_convergent_seq_iff MeasureTheory.Egorov.mem_notConvergentSeq_iff theorem notConvergentSeq_antitone [Preorder ι] : Antitone (notConvergentSeq f g n) := fun _ _ hjk => Set.iUnion₂_mono' fun l hl => ⟨l, le_trans hjk hl, Set.Subset.rfl⟩ #align measure_theory.egorov.not_convergent_seq_antitone MeasureTheory.Egorov.notConvergentSeq_antitone theorem measure_inter_notConvergentSeq_eq_zero [SemilatticeSup ι] [Nonempty ι] (hfg : ∀ᵐ x ∂μ, x ∈ s → Tendsto (fun n => f n x) atTop (𝓝 (g x))) (n : ℕ) : μ (s ∩ ⋂ j, notConvergentSeq f g n j) = 0 := by simp_rw [Metric.tendsto_atTop, ae_iff] at hfg rw [← nonpos_iff_eq_zero, ← hfg] refine measure_mono fun x => ?_ simp only [Set.mem_inter_iff, Set.mem_iInter, ge_iff_le, mem_notConvergentSeq_iff] push_neg rintro ⟨hmem, hx⟩ refine ⟨hmem, 1 / (n + 1 : ℝ), Nat.one_div_pos_of_nat, fun N => ?_⟩ obtain ⟨n, hn₁, hn₂⟩ := hx N exact ⟨n, hn₁, hn₂.le⟩ #align measure_theory.egorov.measure_inter_not_convergent_seq_eq_zero MeasureTheory.Egorov.measure_inter_notConvergentSeq_eq_zero theorem notConvergentSeq_measurableSet [Preorder ι] [Countable ι] (hf : ∀ n, StronglyMeasurable[m] (f n)) (hg : StronglyMeasurable g) : MeasurableSet (notConvergentSeq f g n j) := MeasurableSet.iUnion fun k => MeasurableSet.iUnion fun _ => StronglyMeasurable.measurableSet_lt stronglyMeasurable_const <| (hf k).dist hg #align measure_theory.egorov.not_convergent_seq_measurable_set MeasureTheory.Egorov.notConvergentSeq_measurableSet
Mathlib/MeasureTheory/Function/Egorov.lean
81
93
theorem measure_notConvergentSeq_tendsto_zero [SemilatticeSup ι] [Countable ι] (hf : ∀ n, StronglyMeasurable (f n)) (hg : StronglyMeasurable g) (hsm : MeasurableSet s) (hs : μ s ≠ ∞) (hfg : ∀ᵐ x ∂μ, x ∈ s → Tendsto (fun n => f n x) atTop (𝓝 (g x))) (n : ℕ) : Tendsto (fun j => μ (s ∩ notConvergentSeq f g n j)) atTop (𝓝 0) := by
cases' isEmpty_or_nonempty ι with h h · have : (fun j => μ (s ∩ notConvergentSeq f g n j)) = fun j => 0 := by simp only [eq_iff_true_of_subsingleton] rw [this] exact tendsto_const_nhds rw [← measure_inter_notConvergentSeq_eq_zero hfg n, Set.inter_iInter] refine tendsto_measure_iInter (fun n => hsm.inter <| notConvergentSeq_measurableSet hf hg) (fun k l hkl => Set.inter_subset_inter_right _ <| notConvergentSeq_antitone hkl) ⟨h.some, ne_top_of_le_ne_top hs (measure_mono Set.inter_subset_left)⟩
0
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open scoped ENNReal namespace MeasureTheory variable {α E : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] {p : ℝ≥0∞} (μ : Measure α) {f : α → E} theorem pow_mul_meas_ge_le_snorm (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) (hf : AEStronglyMeasurable f μ) (ε : ℝ≥0∞) : (ε * μ { x | ε ≤ (‖f x‖₊ : ℝ≥0∞) ^ p.toReal }) ^ (1 / p.toReal) ≤ snorm f p μ := by rw [snorm_eq_lintegral_rpow_nnnorm hp_ne_zero hp_ne_top] gcongr exact mul_meas_ge_le_lintegral₀ (hf.ennnorm.pow_const _) ε #align measure_theory.pow_mul_meas_ge_le_snorm MeasureTheory.pow_mul_meas_ge_le_snorm theorem mul_meas_ge_le_pow_snorm (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) (hf : AEStronglyMeasurable f μ) (ε : ℝ≥0∞) : ε * μ { x | ε ≤ (‖f x‖₊ : ℝ≥0∞) ^ p.toReal } ≤ snorm f p μ ^ p.toReal := by have : 1 / p.toReal * p.toReal = 1 := by refine one_div_mul_cancel ?_ rw [Ne, ENNReal.toReal_eq_zero_iff] exact not_or_of_not hp_ne_zero hp_ne_top rw [← ENNReal.rpow_one (ε * μ { x | ε ≤ (‖f x‖₊ : ℝ≥0∞) ^ p.toReal }), ← this, ENNReal.rpow_mul] gcongr exact pow_mul_meas_ge_le_snorm μ hp_ne_zero hp_ne_top hf ε #align measure_theory.mul_meas_ge_le_pow_snorm MeasureTheory.mul_meas_ge_le_pow_snorm theorem mul_meas_ge_le_pow_snorm' (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) (hf : AEStronglyMeasurable f μ) (ε : ℝ≥0∞) : ε ^ p.toReal * μ { x | ε ≤ ‖f x‖₊ } ≤ snorm f p μ ^ p.toReal := by convert mul_meas_ge_le_pow_snorm μ hp_ne_zero hp_ne_top hf (ε ^ p.toReal) using 4 ext x rw [ENNReal.rpow_le_rpow_iff (ENNReal.toReal_pos hp_ne_zero hp_ne_top)] #align measure_theory.mul_meas_ge_le_pow_snorm' MeasureTheory.mul_meas_ge_le_pow_snorm'
Mathlib/MeasureTheory/Function/LpSeminorm/ChebyshevMarkov.lean
52
61
theorem meas_ge_le_mul_pow_snorm (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) (hf : AEStronglyMeasurable f μ) {ε : ℝ≥0∞} (hε : ε ≠ 0) : μ { x | ε ≤ ‖f x‖₊ } ≤ ε⁻¹ ^ p.toReal * snorm f p μ ^ p.toReal := by
by_cases h : ε = ∞ · simp [h] have hεpow : ε ^ p.toReal ≠ 0 := (ENNReal.rpow_pos (pos_iff_ne_zero.2 hε) h).ne.symm have hεpow' : ε ^ p.toReal ≠ ∞ := ENNReal.rpow_ne_top_of_nonneg ENNReal.toReal_nonneg h rw [ENNReal.inv_rpow, ← ENNReal.mul_le_mul_left hεpow hεpow', ← mul_assoc, ENNReal.mul_inv_cancel hεpow hεpow', one_mul] exact mul_meas_ge_le_pow_snorm' μ hp_ne_zero hp_ne_top hf ε
0
import Mathlib.LinearAlgebra.Matrix.Gershgorin import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody import Mathlib.NumberTheory.NumberField.Units.Basic import Mathlib.RingTheory.RootsOfUnity.Basic #align_import number_theory.number_field.units from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" open scoped NumberField noncomputable section open NumberField NumberField.InfinitePlace NumberField.Units BigOperators variable (K : Type*) [Field K] [NumberField K] namespace NumberField.Units.dirichletUnitTheorem open scoped Classical open Finset variable {K} def w₀ : InfinitePlace K := (inferInstance : Nonempty (InfinitePlace K)).some variable (K) def logEmbedding : Additive ((𝓞 K)ˣ) →+ ({w : InfinitePlace K // w ≠ w₀} → ℝ) := { toFun := fun x w => mult w.val * Real.log (w.val ↑(Additive.toMul x)) map_zero' := by simp; rfl map_add' := fun _ _ => by simp [Real.log_mul, mul_add]; rfl } variable {K} @[simp] theorem logEmbedding_component (x : (𝓞 K)ˣ) (w : {w : InfinitePlace K // w ≠ w₀}) : (logEmbedding K x) w = mult w.val * Real.log (w.val x) := rfl theorem sum_logEmbedding_component (x : (𝓞 K)ˣ) : ∑ w, logEmbedding K x w = - mult (w₀ : InfinitePlace K) * Real.log (w₀ (x : K)) := by have h := congr_arg Real.log (prod_eq_abs_norm (x : K)) rw [show |(Algebra.norm ℚ) (x : K)| = 1 from isUnit_iff_norm.mp x.isUnit, Rat.cast_one, Real.log_one, Real.log_prod] at h · simp_rw [Real.log_pow] at h rw [← insert_erase (mem_univ w₀), sum_insert (not_mem_erase w₀ univ), add_comm, add_eq_zero_iff_eq_neg] at h convert h using 1 · refine (sum_subtype _ (fun w => ?_) (fun w => (mult w) * (Real.log (w (x : K))))).symm exact ⟨ne_of_mem_erase, fun h => mem_erase_of_ne_of_mem h (mem_univ w)⟩ · norm_num · exact fun w _ => pow_ne_zero _ (AbsoluteValue.ne_zero _ (coe_ne_zero x)) theorem mult_log_place_eq_zero {x : (𝓞 K)ˣ} {w : InfinitePlace K} : mult w * Real.log (w x) = 0 ↔ w x = 1 := by rw [mul_eq_zero, or_iff_right, Real.log_eq_zero, or_iff_right, or_iff_left] · linarith [(apply_nonneg _ _ : 0 ≤ w x)] · simp only [ne_eq, map_eq_zero, coe_ne_zero x, not_false_eq_true] · refine (ne_of_gt ?_) rw [mult]; split_ifs <;> norm_num theorem logEmbedding_eq_zero_iff {x : (𝓞 K)ˣ} : logEmbedding K x = 0 ↔ x ∈ torsion K := by rw [mem_torsion] refine ⟨fun h w => ?_, fun h => ?_⟩ · by_cases hw : w = w₀ · suffices -mult w₀ * Real.log (w₀ (x : K)) = 0 by rw [neg_mul, neg_eq_zero, ← hw] at this exact mult_log_place_eq_zero.mp this rw [← sum_logEmbedding_component, sum_eq_zero] exact fun w _ => congrFun h w · exact mult_log_place_eq_zero.mp (congrFun h ⟨w, hw⟩) · ext w rw [logEmbedding_component, h w.val, Real.log_one, mul_zero, Pi.zero_apply] theorem logEmbedding_component_le {r : ℝ} {x : (𝓞 K)ˣ} (hr : 0 ≤ r) (h : ‖logEmbedding K x‖ ≤ r) (w : {w : InfinitePlace K // w ≠ w₀}) : |logEmbedding K x w| ≤ r := by lift r to NNReal using hr simp_rw [Pi.norm_def, NNReal.coe_le_coe, Finset.sup_le_iff, ← NNReal.coe_le_coe] at h exact h w (mem_univ _) theorem log_le_of_logEmbedding_le {r : ℝ} {x : (𝓞 K)ˣ} (hr : 0 ≤ r) (h : ‖logEmbedding K x‖ ≤ r) (w : InfinitePlace K) : |Real.log (w x)| ≤ (Fintype.card (InfinitePlace K)) * r := by have tool : ∀ x : ℝ, 0 ≤ x → x ≤ mult w * x := fun x hx => by nth_rw 1 [← one_mul x] refine mul_le_mul ?_ le_rfl hx ?_ all_goals { rw [mult]; split_ifs <;> norm_num } by_cases hw : w = w₀ · have hyp := congr_arg (‖·‖) (sum_logEmbedding_component x).symm replace hyp := (le_of_eq hyp).trans (norm_sum_le _ _) simp_rw [norm_mul, norm_neg, Real.norm_eq_abs, Nat.abs_cast] at hyp refine (le_trans ?_ hyp).trans ?_ · rw [← hw] exact tool _ (abs_nonneg _) · refine (sum_le_card_nsmul univ _ _ (fun w _ => logEmbedding_component_le hr h w)).trans ?_ rw [nsmul_eq_mul] refine mul_le_mul ?_ le_rfl hr (Fintype.card (InfinitePlace K)).cast_nonneg simp [card_univ] · have hyp := logEmbedding_component_le hr h ⟨w, hw⟩ rw [logEmbedding_component, abs_mul, Nat.abs_cast] at hyp refine (le_trans ?_ hyp).trans ?_ · exact tool _ (abs_nonneg _) · nth_rw 1 [← one_mul r] exact mul_le_mul (Nat.one_le_cast.mpr Fintype.card_pos) (le_of_eq rfl) hr (Nat.cast_nonneg _) variable (K) noncomputable def _root_.NumberField.Units.unitLattice : AddSubgroup ({w : InfinitePlace K // w ≠ w₀} → ℝ) := AddSubgroup.map (logEmbedding K) ⊤
Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean
160
179
theorem unitLattice_inter_ball_finite (r : ℝ) : ((unitLattice K : Set ({ w : InfinitePlace K // w ≠ w₀} → ℝ)) ∩ Metric.closedBall 0 r).Finite := by
obtain hr | hr := lt_or_le r 0 · convert Set.finite_empty rw [Metric.closedBall_eq_empty.mpr hr] exact Set.inter_empty _ · suffices {x : (𝓞 K)ˣ | IsIntegral ℤ (x : K) ∧ ∀ (φ : K →+* ℂ), ‖φ x‖ ≤ Real.exp ((Fintype.card (InfinitePlace K)) * r)}.Finite by refine (Set.Finite.image (logEmbedding K) this).subset ?_ rintro _ ⟨⟨x, ⟨_, rfl⟩⟩, hx⟩ refine ⟨x, ⟨x.val.prop, (le_iff_le _ _).mp (fun w => (Real.log_le_iff_le_exp ?_).mp ?_)⟩, rfl⟩ · exact pos_iff.mpr (coe_ne_zero x) · rw [mem_closedBall_zero_iff] at hx exact (le_abs_self _).trans (log_le_of_logEmbedding_le hr hx w) refine Set.Finite.of_finite_image ?_ (coe_injective K).injOn refine (Embeddings.finite_of_norm_le K ℂ (Real.exp ((Fintype.card (InfinitePlace K)) * r))).subset ?_ rintro _ ⟨x, ⟨⟨h_int, h_le⟩, rfl⟩⟩ exact ⟨h_int, h_le⟩
0
import Mathlib.GroupTheory.Archimedean import Mathlib.Topology.Order.Basic #align_import topology.algebra.order.archimedean from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set theorem Rat.denseRange_cast {𝕜} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] [Archimedean 𝕜] : DenseRange ((↑) : ℚ → 𝕜) := dense_of_exists_between fun _ _ h => Set.exists_range_iff.2 <| exists_rat_btwn h #align rat.dense_range_cast Rat.denseRange_cast namespace AddSubgroup variable {G : Type*} [LinearOrderedAddCommGroup G] [TopologicalSpace G] [OrderTopology G] [Archimedean G]
Mathlib/Topology/Algebra/Order/Archimedean.lean
42
53
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) : Dense (S : Set G) := by
cases subsingleton_or_nontrivial G · refine fun x => _root_.subset_closure ?_ rw [Subsingleton.elim x 0] exact zero_mem S refine dense_of_exists_between fun a b hlt => ?_ rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩ rcases (existsUnique_add_zsmul_mem_Ioc hg0 0 a).exists with ⟨m, hm⟩ rw [zero_add] at hm refine ⟨m • g, zsmul_mem hgS _, hm.1, hm.2.trans_lt ?_⟩ rwa [lt_sub_iff_add_lt'] at hg
0
import Mathlib.Algebra.Group.Subsemigroup.Basic #align_import group_theory.subsemigroup.membership from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" assert_not_exists MonoidWithZero variable {ι : Sort*} {M A B : Type*} section NonAssoc variable [Mul M] open Set namespace Subsemigroup -- TODO: this section can be generalized to `[MulMemClass B M] [CompleteLattice B]` -- such that `complete_lattice.le` coincides with `set_like.le` @[to_additive]
Mathlib/Algebra/Group/Subsemigroup/Membership.lean
47
55
theorem mem_iSup_of_directed {S : ι → Subsemigroup M} (hS : Directed (· ≤ ·) S) {x : M} : (x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i := by
refine ⟨?_, fun ⟨i, hi⟩ ↦ le_iSup S i hi⟩ suffices x ∈ closure (⋃ i, (S i : Set M)) → ∃ i, x ∈ S i by simpa only [closure_iUnion, closure_eq (S _)] using this refine fun hx ↦ closure_induction hx (fun y hy ↦ mem_iUnion.mp hy) ?_ rintro x y ⟨i, hi⟩ ⟨j, hj⟩ rcases hS i j with ⟨k, hki, hkj⟩ exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩
0
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' section Examples @[simp] theorem bernoulli'_zero : bernoulli' 0 = 1 := by rw [bernoulli'_def] norm_num #align bernoulli'_zero bernoulli'_zero @[simp] theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by rw [bernoulli'_def] norm_num #align bernoulli'_one bernoulli'_one @[simp] theorem bernoulli'_two : bernoulli' 2 = 1 / 6 := by rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero] #align bernoulli'_two bernoulli'_two @[simp]
Mathlib/NumberTheory/Bernoulli.lean
122
124
theorem bernoulli'_three : bernoulli' 3 = 0 := by
rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero]
0
import Mathlib.Data.Nat.Choose.Factorization import Mathlib.NumberTheory.Primorial import Mathlib.Analysis.Convex.SpecificFunctions.Basic import Mathlib.Analysis.Convex.SpecificFunctions.Deriv import Mathlib.Tactic.NormNum.Prime #align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39" section Real open Real namespace Bertrand
Mathlib/NumberTheory/Bertrand.lean
52
102
theorem real_main_inequality {x : ℝ} (x_large : (512 : ℝ) ≤ x) : x * (2 * x) ^ √(2 * x) * 4 ^ (2 * x / 3) ≤ 4 ^ x := by
let f : ℝ → ℝ := fun x => log x + √(2 * x) * log (2 * x) - log 4 / 3 * x have hf' : ∀ x, 0 < x → 0 < x * (2 * x) ^ √(2 * x) / 4 ^ (x / 3) := fun x h => div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _) have hf : ∀ x, 0 < x → f x = log (x * (2 * x) ^ √(2 * x) / 4 ^ (x / 3)) := by intro x h5 have h6 := mul_pos (zero_lt_two' ℝ) h5 have h7 := rpow_pos_of_pos h6 (√(2 * x)) rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne', log_rpow h6, log_rpow zero_lt_four, ← mul_div_right_comm, ← mul_div, mul_comm x] have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) x_large rw [← div_le_one (rpow_pos_of_pos four_pos x), ← div_div_eq_mul_div, ← rpow_sub four_pos, ← mul_div 2 x, mul_div_left_comm, ← mul_one_sub, (by norm_num1 : (1 : ℝ) - 2 / 3 = 1 / 3), mul_one_div, ← log_nonpos_iff (hf' x h5), ← hf x h5] -- porting note (#11083): the proof was rewritten, because it was too slow have h : ConcaveOn ℝ (Set.Ioi 0.5) f := by apply ConcaveOn.sub · apply ConcaveOn.add · exact strictConcaveOn_log_Ioi.concaveOn.subset (Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5) convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap ((2 : ℝ) • LinearMap.id))) using 1 ext x simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply, LinearMap.id_coe, id_eq, smul_eq_mul] rw [← mul_lt_mul_left (two_pos)] norm_num1 rfl apply ConvexOn.smul · refine div_nonneg (log_nonneg (by norm_num1)) (by norm_num1) · exact convexOn_id (convex_Ioi (0.5 : ℝ)) suffices ∃ x1 x2, 0.5 < x1 ∧ x1 < x2 ∧ x2 ≤ x ∧ 0 ≤ f x1 ∧ f x2 ≤ 0 by obtain ⟨x1, x2, h1, h2, h0, h3, h4⟩ := this exact (h.right_le_of_le_left'' h1 ((h1.trans h2).trans_le h0) h2 h0 (h4.trans h3)).trans h4 refine ⟨18, 512, by norm_num1, by norm_num1, x_large, ?_, ?_⟩ · have : √(2 * 18 : ℝ) = 6 := (sqrt_eq_iff_mul_self_eq_of_pos (by norm_num1)).mpr (by norm_num1) rw [hf _ (by norm_num1), log_nonneg_iff (by positivity), this, one_le_div (by norm_num1)] norm_num1 · have : √(2 * 512) = 32 := (sqrt_eq_iff_mul_self_eq_of_pos (by norm_num1)).mpr (by norm_num1) rw [hf _ (by norm_num1), log_nonpos_iff (hf' _ (by norm_num1)), this, div_le_one (by positivity)] conv in 512 => equals 2 ^ 9 => norm_num1 conv in 2 * 512 => equals 2 ^ 10 => norm_num1 conv in 32 => rw [← Nat.cast_ofNat] rw [rpow_natCast, ← pow_mul, ← pow_add] conv in 4 => equals 2 ^ (2 : ℝ) => rw [rpow_two]; norm_num1 rw [← rpow_mul, ← rpow_natCast] on_goal 1 => apply rpow_le_rpow_of_exponent_le all_goals norm_num1
0
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type*) def HasUnitMulPowIrreducibleFactorization [CommRing R] : Prop := ∃ p : R, Irreducible p ∧ ∀ {x : R}, x ≠ 0 → ∃ n : ℕ, Associated (p ^ n) x #align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization namespace HasUnitMulPowIrreducibleFactorization variable {R} [CommRing R] (hR : HasUnitMulPowIrreducibleFactorization R)
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
169
190
theorem unique_irreducible ⦃p q : R⦄ (hp : Irreducible p) (hq : Irreducible q) : Associated p q := by
rcases hR with ⟨ϖ, hϖ, hR⟩ suffices ∀ {p : R} (_ : Irreducible p), Associated p ϖ by apply Associated.trans (this hp) (this hq).symm clear hp hq p q intro p hp obtain ⟨n, hn⟩ := hR hp.ne_zero have : Irreducible (ϖ ^ n) := hn.symm.irreducible hp rcases lt_trichotomy n 1 with (H | rfl | H) · obtain rfl : n = 0 := by clear hn this revert H n decide simp [not_irreducible_one, pow_zero] at this · simpa only [pow_one] using hn.symm · obtain ⟨n, rfl⟩ : ∃ k, n = 1 + k + 1 := Nat.exists_eq_add_of_lt H rw [pow_succ'] at this rcases this.isUnit_or_isUnit rfl with (H0 | H0) · exact (hϖ.not_unit H0).elim · rw [add_comm, pow_succ'] at H0 exact (hϖ.not_unit (isUnit_of_mul_isUnit_left H0)).elim
0
import Mathlib.Analysis.Complex.UpperHalfPlane.Basic import Mathlib.LinearAlgebra.GeneralLinearGroup import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup import Mathlib.Topology.Instances.Matrix import Mathlib.Topology.Algebra.Module.FiniteDimension #align_import number_theory.modular from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Complex hiding abs_two open Matrix hiding mul_smul open Matrix.SpecialLinearGroup UpperHalfPlane ModularGroup noncomputable section local notation "SL(" n ", " R ")" => SpecialLinearGroup (Fin n) R local macro "↑ₘ" t:term:80 : term => `(term| ($t : Matrix (Fin 2) (Fin 2) ℤ)) open scoped UpperHalfPlane ComplexConjugate namespace ModularGroup variable {g : SL(2, ℤ)} (z : ℍ) section TendstoLemmas open Filter ContinuousLinearMap attribute [local simp] ContinuousLinearMap.coe_smul
Mathlib/NumberTheory/Modular.lean
117
161
theorem tendsto_normSq_coprime_pair : Filter.Tendsto (fun p : Fin 2 → ℤ => normSq ((p 0 : ℂ) * z + p 1)) cofinite atTop := by
-- using this instance rather than the automatic `Function.module` makes unification issues in -- `LinearEquiv.closedEmbedding_of_injective` less bad later in the proof. letI : Module ℝ (Fin 2 → ℝ) := NormedSpace.toModule let π₀ : (Fin 2 → ℝ) →ₗ[ℝ] ℝ := LinearMap.proj 0 let π₁ : (Fin 2 → ℝ) →ₗ[ℝ] ℝ := LinearMap.proj 1 let f : (Fin 2 → ℝ) →ₗ[ℝ] ℂ := π₀.smulRight (z : ℂ) + π₁.smulRight 1 have f_def : ⇑f = fun p : Fin 2 → ℝ => (p 0 : ℂ) * ↑z + p 1 := by ext1 dsimp only [π₀, π₁, f, LinearMap.coe_proj, real_smul, LinearMap.coe_smulRight, LinearMap.add_apply] rw [mul_one] have : (fun p : Fin 2 → ℤ => normSq ((p 0 : ℂ) * ↑z + ↑(p 1))) = normSq ∘ f ∘ fun p : Fin 2 → ℤ => ((↑) : ℤ → ℝ) ∘ p := by ext1 rw [f_def] dsimp only [Function.comp_def] rw [ofReal_intCast, ofReal_intCast] rw [this] have hf : LinearMap.ker f = ⊥ := by let g : ℂ →ₗ[ℝ] Fin 2 → ℝ := LinearMap.pi ![imLm, imLm.comp ((z : ℂ) • ((conjAe : ℂ →ₐ[ℝ] ℂ) : ℂ →ₗ[ℝ] ℂ))] suffices ((z : ℂ).im⁻¹ • g).comp f = LinearMap.id by exact LinearMap.ker_eq_bot_of_inverse this apply LinearMap.ext intro c have hz : (z : ℂ).im ≠ 0 := z.2.ne' rw [LinearMap.comp_apply, LinearMap.smul_apply, LinearMap.id_apply] ext i dsimp only [Pi.smul_apply, LinearMap.pi_apply, smul_eq_mul] fin_cases i · show (z : ℂ).im⁻¹ * (f c).im = c 0 rw [f_def, add_im, im_ofReal_mul, ofReal_im, add_zero, mul_left_comm, inv_mul_cancel hz, mul_one] · show (z : ℂ).im⁻¹ * ((z : ℂ) * conj (f c)).im = c 1 rw [f_def, RingHom.map_add, RingHom.map_mul, mul_add, mul_left_comm, mul_conj, conj_ofReal, conj_ofReal, ← ofReal_mul, add_im, ofReal_im, zero_add, inv_mul_eq_iff_eq_mul₀ hz] simp only [ofReal_im, ofReal_re, mul_im, zero_add, mul_zero] have hf' : ClosedEmbedding f := f.closedEmbedding_of_injective hf have h₂ : Tendsto (fun p : Fin 2 → ℤ => ((↑) : ℤ → ℝ) ∘ p) cofinite (cocompact _) := by convert Tendsto.pi_map_coprodᵢ fun _ => Int.tendsto_coe_cofinite · rw [coprodᵢ_cofinite] · rw [coprodᵢ_cocompact] exact tendsto_normSq_cocompact_atTop.comp (hf'.tendsto_cocompact.comp h₂)
0
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption #align card_nth_roots_subgroup_units card_nthRoots_subgroup_units theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by classical cases nonempty_fintype G apply isCyclic_of_card_pow_eq_one_le intro n hn exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1)) #align is_cyclic_of_subgroup_is_domain isCyclic_of_subgroup_isDomain instance [Finite Rˣ] : IsCyclic Rˣ := isCyclic_of_subgroup_isDomain (Units.coeHom R) <| Units.ext section variable (S : Subgroup Rˣ) [Finite S] instance subgroup_units_cyclic : IsCyclic S := by -- Porting note: the original proof used a `coe`, but I was not able to get it to work. apply isCyclic_of_subgroup_isDomain (R := R) (G := S) _ _ · exact MonoidHom.mk (OneHom.mk (fun s => ↑s.val) rfl) (by simp) · exact Units.ext.comp Subtype.val_injective #align subgroup_units_cyclic subgroup_units_cyclic end section EuclideanDivision variable [Fintype G] @[deprecated (since := "2024-06-10")] alias card_fiber_eq_of_mem_range := MonoidHom.card_fiber_eq_of_mem_range
Mathlib/RingTheory/IntegralDomain.lean
200
254
theorem sum_hom_units_eq_zero (f : G →* R) (hf : f ≠ 1) : ∑ g : G, f g = 0 := by
classical obtain ⟨x, hx⟩ : ∃ x : MonoidHom.range f.toHomUnits, ∀ y : MonoidHom.range f.toHomUnits, y ∈ Submonoid.powers x := IsCyclic.exists_monoid_generator have hx1 : x ≠ 1 := by rintro rfl apply hf ext g rw [MonoidHom.one_apply] cases' hx ⟨f.toHomUnits g, g, rfl⟩ with n hn rwa [Subtype.ext_iff, Units.ext_iff, Subtype.coe_mk, MonoidHom.coe_toHomUnits, one_pow, eq_comm] at hn replace hx1 : (x.val : R) - 1 ≠ 0 := -- Porting note: was `(x : R)` fun h => hx1 (Subtype.eq (Units.ext (sub_eq_zero.1 h))) let c := (univ.filter fun g => f.toHomUnits g = 1).card calc ∑ g : G, f g = ∑ g : G, (f.toHomUnits g : R) := rfl _ = ∑ u ∈ univ.image f.toHomUnits, (univ.filter fun g => f.toHomUnits g = u).card • (u : R) := (sum_comp ((↑) : Rˣ → R) f.toHomUnits) _ = ∑ u ∈ univ.image f.toHomUnits, c • (u : R) := (sum_congr rfl fun u hu => congr_arg₂ _ ?_ rfl) -- remaining goal 1, proven below -- Porting note: have to change `(b : R)` into `((b : Rˣ) : R)` _ = ∑ b : MonoidHom.range f.toHomUnits, c • ((b : Rˣ) : R) := (Finset.sum_subtype _ (by simp) _) _ = c • ∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R) := smul_sum.symm _ = c • (0 : R) := congr_arg₂ _ rfl ?_ -- remaining goal 2, proven below _ = (0 : R) := smul_zero _ · -- remaining goal 1 show (univ.filter fun g : G => f.toHomUnits g = u).card = c apply MonoidHom.card_fiber_eq_of_mem_range f.toHomUnits · simpa only [mem_image, mem_univ, true_and, Set.mem_range] using hu · exact ⟨1, f.toHomUnits.map_one⟩ -- remaining goal 2 show (∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R)) = 0 calc (∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R)) = ∑ n ∈ range (orderOf x), ((x : Rˣ) : R) ^ n := Eq.symm <| sum_nbij (x ^ ·) (by simp only [mem_univ, forall_true_iff]) (by simpa using pow_injOn_Iio_orderOf) (fun b _ => let ⟨n, hn⟩ := hx b ⟨n % orderOf x, mem_range.2 (Nat.mod_lt _ (orderOf_pos _)), -- Porting note: have to use `dsimp` to apply the function by dsimp at hn ⊢; rw [pow_mod_orderOf, hn]⟩) (by simp only [imp_true_iff, eq_self_iff_true, Subgroup.coe_pow, Units.val_pow_eq_pow_val]) _ = 0 := ?_ rw [← mul_left_inj' hx1, zero_mul, geom_sum_mul] norm_cast simp [pow_orderOf_eq_one]
0
import Mathlib.Init.Core import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots import Mathlib.NumberTheory.NumberField.Basic import Mathlib.FieldTheory.Galois #align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba" open Polynomial Algebra FiniteDimensional Set universe u v w z variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z) variable [CommRing A] [CommRing B] [Algebra A B] variable [Field K] [Field L] [Algebra K L] noncomputable section @[mk_iff] class IsCyclotomicExtension : Prop where exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} #align is_cyclotomic_extension IsCyclotomicExtension namespace IsCyclotomicExtension section variable {A B}
Mathlib/NumberTheory/Cyclotomic/Basic.lean
368
384
theorem adjoin_roots_cyclotomic_eq_adjoin_nth_roots [IsDomain B] {ζ : B} {n : ℕ+} (hζ : IsPrimitiveRoot ζ n) : adjoin A ((cyclotomic n A).rootSet B) = adjoin A {b : B | ∃ a : ℕ+, a ∈ ({n} : Set ℕ+) ∧ b ^ (a : ℕ) = 1} := by
simp only [mem_singleton_iff, exists_eq_left, map_cyclotomic] refine le_antisymm (adjoin_mono fun x hx => ?_) (adjoin_le fun x hx => ?_) · rw [mem_rootSet'] at hx simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] rw [isRoot_of_unity_iff n.pos] refine ⟨n, Nat.mem_divisors_self n n.ne_zero, ?_⟩ rw [IsRoot.def, ← map_cyclotomic n (algebraMap A B), eval_map, ← aeval_def] exact hx.2 · simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] at hx obtain ⟨i, _, rfl⟩ := hζ.eq_pow_of_pow_eq_one hx n.pos refine SetLike.mem_coe.2 (Subalgebra.pow_mem _ (subset_adjoin ?_) _) rw [mem_rootSet', map_cyclotomic, aeval_def, ← eval_map, map_cyclotomic, ← IsRoot] exact ⟨cyclotomic_ne_zero n B, hζ.isRoot_cyclotomic n.pos⟩
0
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finset.Option #align_import algebra.big_operators.option from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" open Function namespace Finset variable {α M : Type*} [CommMonoid M] @[to_additive (attr := simp)] theorem prod_insertNone (f : Option α → M) (s : Finset α) : ∏ x ∈ insertNone s, f x = f none * ∏ x ∈ s, f (some x) := by simp [insertNone] #align finset.prod_insert_none Finset.prod_insertNone #align finset.sum_insert_none Finset.sum_insertNone @[to_additive] theorem mul_prod_eq_prod_insertNone (f : α → M) (x : M) (s : Finset α) : x * ∏ i ∈ s, f i = ∏ i ∈ insertNone s, i.elim x f := (prod_insertNone (fun i => i.elim x f) _).symm @[to_additive]
Mathlib/Algebra/BigOperators/Option.lean
36
42
theorem prod_eraseNone (f : α → M) (s : Finset (Option α)) : ∏ x ∈ eraseNone s, f x = ∏ x ∈ s, Option.elim' 1 f x := by
classical calc ∏ x ∈ eraseNone s, f x = ∏ x ∈ (eraseNone s).map Embedding.some, Option.elim' 1 f x := (prod_map (eraseNone s) Embedding.some <| Option.elim' 1 f).symm _ = ∏ x ∈ s.erase none, Option.elim' 1 f x := by rw [map_some_eraseNone] _ = ∏ x ∈ s, Option.elim' 1 f x := prod_erase _ rfl
0
import Mathlib.Control.EquivFunctor import Mathlib.Data.Option.Basic import Mathlib.Data.Subtype import Mathlib.Logic.Equiv.Defs import Mathlib.Tactic.Cases #align_import logic.equiv.option from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u namespace Equiv open Option variable {α β γ : Type*} section RemoveNone variable (e : Option α ≃ Option β) def removeNone_aux (x : α) : β := if h : (e (some x)).isSome then Option.get _ h else Option.get _ <| show (e none).isSome by rw [← Option.ne_none_iff_isSome] intro hn rw [Option.not_isSome_iff_eq_none, ← hn] at h exact Option.some_ne_none _ (e.injective h) -- Porting note: private -- #align equiv.remove_none_aux Equiv.removeNone_aux theorem removeNone_aux_some {x : α} (h : ∃ x', e (some x) = some x') : some (removeNone_aux e x) = e (some x) := by simp [removeNone_aux, Option.isSome_iff_exists.mpr h] -- Porting note: private -- #align equiv.remove_none_aux_some Equiv.removeNone_aux_some theorem removeNone_aux_none {x : α} (h : e (some x) = none) : some (removeNone_aux e x) = e none := by simp [removeNone_aux, Option.not_isSome_iff_eq_none.mpr h] -- Porting note: private -- #align equiv.remove_none_aux_none Equiv.removeNone_aux_none theorem removeNone_aux_inv (x : α) : removeNone_aux e.symm (removeNone_aux e x) = x := Option.some_injective _ (by cases h1 : e.symm (some (removeNone_aux e x)) <;> cases h2 : e (some x) · rw [removeNone_aux_none _ h1] exact (e.eq_symm_apply.mpr h2).symm · rw [removeNone_aux_some _ ⟨_, h2⟩] at h1 simp at h1 · rw [removeNone_aux_none _ h2] at h1 simp at h1 · rw [removeNone_aux_some _ ⟨_, h1⟩] rw [removeNone_aux_some _ ⟨_, h2⟩] simp) -- Porting note: private -- #align equiv.remove_none_aux_inv Equiv.removeNone_aux_inv def removeNone : α ≃ β where toFun := removeNone_aux e invFun := removeNone_aux e.symm left_inv := removeNone_aux_inv e right_inv := removeNone_aux_inv e.symm #align equiv.remove_none Equiv.removeNone @[simp] theorem removeNone_symm : (removeNone e).symm = removeNone e.symm := rfl #align equiv.remove_none_symm Equiv.removeNone_symm theorem removeNone_some {x : α} (h : ∃ x', e (some x) = some x') : some (removeNone e x) = e (some x) := removeNone_aux_some e h #align equiv.remove_none_some Equiv.removeNone_some theorem removeNone_none {x : α} (h : e (some x) = none) : some (removeNone e x) = e none := removeNone_aux_none e h #align equiv.remove_none_none Equiv.removeNone_none @[simp] theorem option_symm_apply_none_iff : e.symm none = none ↔ e none = none := ⟨fun h => by simpa using (congr_arg e h).symm, fun h => by simpa using (congr_arg e.symm h).symm⟩ #align equiv.option_symm_apply_none_iff Equiv.option_symm_apply_none_iff
Mathlib/Logic/Equiv/Option.lean
148
156
theorem some_removeNone_iff {x : α} : some (removeNone e x) = e none ↔ e.symm none = some x := by
cases' h : e (some x) with a · rw [removeNone_none _ h] simpa using (congr_arg e.symm h).symm · rw [removeNone_some _ ⟨a, h⟩] have h1 := congr_arg e.symm h rw [symm_apply_apply] at h1 simp only [false_iff_iff, apply_eq_iff_eq] simp [h1, apply_eq_iff_eq]
0
import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Metric Set open Pointwise Topology variable {𝕜 E : Type*} variable [NormedField 𝕜] section SeminormedAddCommGroup variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀] #align smul_ball smul_ball theorem smul_unitBall {c : 𝕜} (hc : c ≠ 0) : c • ball (0 : E) (1 : ℝ) = ball (0 : E) ‖c‖ := by rw [_root_.smul_ball hc, smul_zero, mul_one] #align smul_unit_ball smul_unitBall theorem smul_sphere' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • sphere x r = sphere (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r] #align smul_sphere' smul_sphere' theorem smul_closedBall' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • closedBall x r = closedBall (c • x) (‖c‖ * r) := by simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc] #align smul_closed_ball' smul_closedBall' theorem set_smul_sphere_zero {s : Set 𝕜} (hs : 0 ∉ s) (r : ℝ) : s • sphere (0 : E) r = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := calc s • sphere (0 : E) r = ⋃ c ∈ s, c • sphere (0 : E) r := iUnion_smul_left_image.symm _ = ⋃ c ∈ s, sphere (0 : E) (‖c‖ * r) := iUnion₂_congr fun c hc ↦ by rw [smul_sphere' (ne_of_mem_of_not_mem hc hs), smul_zero] _ = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := by ext; simp [eq_comm] theorem Bornology.IsBounded.smul₀ {s : Set E} (hs : IsBounded s) (c : 𝕜) : IsBounded (c • s) := (lipschitzWith_smul c).isBounded_image hs #align metric.bounded.smul Bornology.IsBounded.smul₀
Mathlib/Analysis/NormedSpace/Pointwise.lean
125
143
theorem eventually_singleton_add_smul_subset {x : E} {s : Set E} (hs : Bornology.IsBounded s) {u : Set E} (hu : u ∈ 𝓝 x) : ∀ᶠ r in 𝓝 (0 : 𝕜), {x} + r • s ⊆ u := by
obtain ⟨ε, εpos, hε⟩ : ∃ ε : ℝ, 0 < ε ∧ closedBall x ε ⊆ u := nhds_basis_closedBall.mem_iff.1 hu obtain ⟨R, Rpos, hR⟩ : ∃ R : ℝ, 0 < R ∧ s ⊆ closedBall 0 R := hs.subset_closedBall_lt 0 0 have : Metric.closedBall (0 : 𝕜) (ε / R) ∈ 𝓝 (0 : 𝕜) := closedBall_mem_nhds _ (div_pos εpos Rpos) filter_upwards [this] with r hr simp only [image_add_left, singleton_add] intro y hy obtain ⟨z, zs, hz⟩ : ∃ z : E, z ∈ s ∧ r • z = -x + y := by simpa [mem_smul_set] using hy have I : ‖r • z‖ ≤ ε := calc ‖r • z‖ = ‖r‖ * ‖z‖ := norm_smul _ _ _ ≤ ε / R * R := (mul_le_mul (mem_closedBall_zero_iff.1 hr) (mem_closedBall_zero_iff.1 (hR zs)) (norm_nonneg _) (div_pos εpos Rpos).le) _ = ε := by field_simp have : y = x + r • z := by simp only [hz, add_neg_cancel_left] apply hε simpa only [this, dist_eq_norm, add_sub_cancel_left, mem_closedBall] using I
0
import Mathlib.Algebra.ContinuedFractions.ContinuantsRecurrence import Mathlib.Algebra.ContinuedFractions.TerminatedStable import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Ring #align_import algebra.continued_fractions.convergents_equiv from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" variable {K : Type*} {n : ℕ} namespace GeneralizedContinuedFraction variable {g : GeneralizedContinuedFraction K} {s : Stream'.Seq <| Pair K} section Squash section WithDivisionRing variable [DivisionRing K] def squashSeq (s : Stream'.Seq <| Pair K) (n : ℕ) : Stream'.Seq (Pair K) := match Prod.mk (s.get? n) (s.get? (n + 1)) with | ⟨some gp_n, some gp_succ_n⟩ => Stream'.Seq.nats.zipWith -- return the squashed value at position `n`; otherwise, do nothing. (fun n' gp => if n' = n then ⟨gp_n.a, gp_n.b + gp_succ_n.a / gp_succ_n.b⟩ else gp) s | _ => s #align generalized_continued_fraction.squash_seq GeneralizedContinuedFraction.squashSeq
Mathlib/Algebra/ContinuedFractions/ConvergentsEquiv.lean
106
109
theorem squashSeq_eq_self_of_terminated (terminated_at_succ_n : s.TerminatedAt (n + 1)) : squashSeq s n = s := by
change s.get? (n + 1) = none at terminated_at_succ_n cases s_nth_eq : s.get? n <;> simp only [*, squashSeq]
0
import Mathlib.Algebra.Group.Prod import Mathlib.Data.Set.Lattice #align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" assert_not_exists MonoidWithZero open Prod Decidable Function namespace Nat -- Porting note: no pp_nodot --@[pp_nodot] def pair (a b : ℕ) : ℕ := if a < b then b * b + a else a * a + a + b #align nat.mkpair Nat.pair -- Porting note: no pp_nodot --@[pp_nodot] def unpair (n : ℕ) : ℕ × ℕ := let s := sqrt n if n - s * s < s then (n - s * s, s) else (s, n - s * s - s) #align nat.unpair Nat.unpair @[simp] theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by dsimp only [unpair]; let s := sqrt n have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _) split_ifs with h · simp [pair, h, sm] · have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2 (Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add) simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm] #align nat.mkpair_unpair Nat.pair_unpair theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by simpa [H] using pair_unpair n #align nat.mkpair_unpair' Nat.pair_unpair' @[simp] theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by dsimp only [pair]; split_ifs with h · show unpair (b * b + a) = (a, b) have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _)) simp [unpair, be, Nat.add_sub_cancel_left, h] · show unpair (a * a + a + b) = (a, b) have ae : sqrt (a * a + (a + b)) = a := by rw [sqrt_add_eq] exact Nat.add_le_add_left (le_of_not_gt h) _ simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left] #align nat.unpair_mkpair Nat.unpair_pair @[simps (config := .asFn)] def pairEquiv : ℕ × ℕ ≃ ℕ := ⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩ #align nat.mkpair_equiv Nat.pairEquiv #align nat.mkpair_equiv_apply Nat.pairEquiv_apply #align nat.mkpair_equiv_symm_apply Nat.pairEquiv_symm_apply theorem surjective_unpair : Surjective unpair := pairEquiv.symm.surjective #align nat.surjective_unpair Nat.surjective_unpair @[simp] theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d := pairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d)) #align nat.mkpair_eq_mkpair Nat.pair_eq_pair theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by let s := sqrt n simp only [unpair, ge_iff_le, Nat.sub_le_iff_le_add] by_cases h : n - s * s < s <;> simp [h] · exact lt_of_lt_of_le h (sqrt_le_self _) · simp at h have s0 : 0 < s := sqrt_pos.2 n1 exact lt_of_le_of_lt h (Nat.sub_lt n1 (Nat.mul_pos s0 s0)) #align nat.unpair_lt Nat.unpair_lt @[simp] theorem unpair_zero : unpair 0 = 0 := by rw [unpair] simp #align nat.unpair_zero Nat.unpair_zero theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n | 0 => by simp | n + 1 => le_of_lt (unpair_lt (Nat.succ_pos _)) #align nat.unpair_left_le Nat.unpair_left_le theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (pair a b) #align nat.left_le_mkpair Nat.left_le_pair theorem right_le_pair (a b : ℕ) : b ≤ pair a b := by by_cases h : a < b <;> simp [pair, h] exact le_trans (le_mul_self _) (Nat.le_add_right _ _) #align nat.right_le_mkpair Nat.right_le_pair theorem unpair_right_le (n : ℕ) : (unpair n).2 ≤ n := by simpa using right_le_pair n.unpair.1 n.unpair.2 #align nat.unpair_right_le Nat.unpair_right_le theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair a₂ b := by by_cases h₁ : a₁ < b <;> simp [pair, h₁, Nat.add_assoc] · by_cases h₂ : a₂ < b <;> simp [pair, h₂, h] simp? at h₂ says simp only [not_lt] at h₂ apply Nat.add_lt_add_of_le_of_lt · exact Nat.mul_self_le_mul_self h₂ · exact Nat.lt_add_right _ h · simp at h₁ simp only [not_lt_of_gt (lt_of_le_of_lt h₁ h), ite_false] apply add_lt_add · exact Nat.mul_self_lt_mul_self h · apply Nat.add_lt_add_right; assumption #align nat.mkpair_lt_mkpair_left Nat.pair_lt_pair_left
Mathlib/Data/Nat/Pairing.lean
140
148
theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pair a b₂ := by
by_cases h₁ : a < b₁ <;> simp [pair, h₁, Nat.add_assoc] · simp [pair, lt_trans h₁ h, h] exact mul_self_lt_mul_self h · by_cases h₂ : a < b₂ <;> simp [pair, h₂, h] simp? at h₁ says simp only [not_lt] at h₁ rw [Nat.add_comm, Nat.add_comm _ a, Nat.add_assoc, Nat.add_lt_add_iff_left] rwa [Nat.add_comm, ← sqrt_lt, sqrt_add_eq] exact le_trans h₁ (Nat.le_add_left _ _)
0
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C theorem separable_X : (X : R[X]).Separable := by rw [separable_def, derivative_X] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X Polynomial.separable_X theorem separable_C (r : R) : (C r).Separable ↔ IsUnit r := by rw [separable_def, derivative_C, isCoprime_zero_right, isUnit_C] set_option linter.uppercaseLean3 false in #align polynomial.separable_C Polynomial.separable_C theorem Separable.of_mul_left {f g : R[X]} (h : (f * g).Separable) : f.Separable := by have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_left (IsCoprime.of_add_mul_left_right this) #align polynomial.separable.of_mul_left Polynomial.Separable.of_mul_left theorem Separable.of_mul_right {f g : R[X]} (h : (f * g).Separable) : g.Separable := by rw [mul_comm] at h exact h.of_mul_left #align polynomial.separable.of_mul_right Polynomial.Separable.of_mul_right theorem Separable.of_dvd {f g : R[X]} (hf : f.Separable) (hfg : g ∣ f) : g.Separable := by rcases hfg with ⟨f', rfl⟩ exact Separable.of_mul_left hf #align polynomial.separable.of_dvd Polynomial.Separable.of_dvd theorem separable_gcd_left {F : Type*} [Field F] {f : F[X]} (hf : f.Separable) (g : F[X]) : (EuclideanDomain.gcd f g).Separable := Separable.of_dvd hf (EuclideanDomain.gcd_dvd_left f g) #align polynomial.separable_gcd_left Polynomial.separable_gcd_left theorem separable_gcd_right {F : Type*} [Field F] {g : F[X]} (f : F[X]) (hg : g.Separable) : (EuclideanDomain.gcd f g).Separable := Separable.of_dvd hg (EuclideanDomain.gcd_dvd_right f g) #align polynomial.separable_gcd_right Polynomial.separable_gcd_right
Mathlib/FieldTheory/Separable.lean
112
114
theorem Separable.isCoprime {f g : R[X]} (h : (f * g).Separable) : IsCoprime f g := by
have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_right (IsCoprime.of_add_mul_left_right this)
0
import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ▷ X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (X ◁ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ▷ X) ≫ mul = (α_ X X X).hom ≫ (X ◁ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one attribute [simp] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace Mon_ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding.
Mathlib/CategoryTheory/Monoidal/Mon_.lean
372
382
theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [tensorHom_id, ← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp
0
import Mathlib.Algebra.Module.Card import Mathlib.SetTheory.Cardinal.CountableCover import Mathlib.SetTheory.Cardinal.Continuum import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Topology.MetricSpace.Perfect universe u v open Filter Pointwise Set Function Cardinal open scoped Cardinal Topology
Mathlib/Topology/Algebra/Module/Cardinality.lean
29
45
theorem continuum_le_cardinal_of_nontriviallyNormedField (𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by
suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by rcases this with ⟨f, -, -, f_inj⟩ simpa using lift_mk_le_lift_mk_of_injective f_inj apply Perfect.exists_nat_bool_injection _ univ_nonempty refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩ rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩ have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) := tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc) rw [add_zero] at A have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU rcases B.exists with ⟨n, hn⟩ refine ⟨x + c^n, by simpa using hn, ?_⟩ simp only [ne_eq, add_right_eq_self] apply pow_ne_zero simpa using c_pos
0
import Mathlib.FieldTheory.SeparableDegree import Mathlib.FieldTheory.IsSepClosed open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField Field noncomputable section universe u v w variable (F : Type u) (E : Type v) [Field F] [Field E] [Algebra F E] variable (K : Type w) [Field K] [Algebra F K] section separableClosure def separableClosure : IntermediateField F E where carrier := {x | (minpoly F x).Separable} mul_mem' := separable_mul add_mem' := separable_add algebraMap_mem' := separable_algebraMap E inv_mem' := separable_inv variable {F E K} theorem mem_separableClosure_iff {x : E} : x ∈ separableClosure F E ↔ (minpoly F x).Separable := Iff.rfl theorem map_mem_separableClosure_iff (i : E →ₐ[F] K) {x : E} : i x ∈ separableClosure F K ↔ x ∈ separableClosure F E := by simp_rw [mem_separableClosure_iff, minpoly.algHom_eq i i.injective] theorem separableClosure.comap_eq_of_algHom (i : E →ₐ[F] K) : (separableClosure F K).comap i = separableClosure F E := by ext x exact map_mem_separableClosure_iff i theorem separableClosure.map_le_of_algHom (i : E →ₐ[F] K) : (separableClosure F E).map i ≤ separableClosure F K := map_le_iff_le_comap.2 (comap_eq_of_algHom i).ge variable (F) in
Mathlib/FieldTheory/SeparableClosure.lean
115
121
theorem separableClosure.map_eq_of_separableClosure_eq_bot [Algebra E K] [IsScalarTower F E K] (h : separableClosure E K = ⊥) : (separableClosure F E).map (IsScalarTower.toAlgHom F E K) = separableClosure F K := by
refine le_antisymm (map_le_of_algHom _) (fun x hx ↦ ?_) obtain ⟨y, rfl⟩ := mem_bot.1 <| h ▸ mem_separableClosure_iff.2 (mem_separableClosure_iff.1 hx |>.map_minpoly E) exact ⟨y, (map_mem_separableClosure_iff <| IsScalarTower.toAlgHom F E K).mp hx, rfl⟩
0
import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open FiniteDimensional MeasureTheory MeasureTheory.Measure Set variable {ι E F : Type*} variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] section variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)] theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n)) (b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by have e : ι ≃ Fin n := by refine Fintype.equivFinOfCardEq ?_ rw [← _i.out, finrank_eq_card_basis b.toBasis] have A : ⇑b = b.reindex e ∘ e := by ext x simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply] rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped, o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one] #align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) : o.volumeForm.measure = volume := by have A : o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = 1 := Orientation.measure_orthonormalBasis o (stdOrthonormalBasis ℝ F) rw [addHaarMeasure_unique o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped, A, one_smul] simp only [volume, Basis.addHaar] #align orientation.measure_eq_volume Orientation.measure_eq_volume end theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) : volume (parallelepiped b) = 1 := by haveI : Fact (finrank ℝ F = finrank ℝ F) := ⟨rfl⟩ let o := (stdOrthonormalBasis ℝ F).toBasis.orientation rw [← o.measure_eq_volume] exact o.measure_orthonormalBasis b #align orthonormal_basis.volume_parallelepiped OrthonormalBasis.volume_parallelepiped theorem OrthonormalBasis.addHaar_eq_volume {ι F : Type*} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] (b : OrthonormalBasis ι ℝ F) : b.toBasis.addHaar = volume := by rw [Basis.addHaar_eq_iff] exact b.volume_parallelepiped noncomputable def OrthonormalBasis.measurableEquiv (b : OrthonormalBasis ι ℝ F) : F ≃ᵐ EuclideanSpace ℝ ι := b.repr.toHomeomorph.toMeasurableEquiv theorem OrthonormalBasis.measurePreserving_measurableEquiv (b : OrthonormalBasis ι ℝ F) : MeasurePreserving b.measurableEquiv volume volume := by convert (b.measurableEquiv.symm.measurable.measurePreserving _).symm rw [← (EuclideanSpace.basisFun ι ℝ).addHaar_eq_volume] erw [MeasurableEquiv.coe_toEquiv_symm, Basis.map_addHaar _ b.repr.symm.toContinuousLinearEquiv] exact b.addHaar_eq_volume.symm theorem OrthonormalBasis.measurePreserving_repr (b : OrthonormalBasis ι ℝ F) : MeasurePreserving b.repr volume volume := b.measurePreserving_measurableEquiv theorem OrthonormalBasis.measurePreserving_repr_symm (b : OrthonormalBasis ι ℝ F) : MeasurePreserving b.repr.symm volume volume := b.measurePreserving_measurableEquiv.symm namespace LinearIsometryEquiv variable [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] variable (f : E ≃ₗᵢ[ℝ] F)
Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean
138
143
theorem measurePreserving : MeasurePreserving f := by
refine ⟨f.continuous.measurable, ?_⟩ rcases exists_orthonormalBasis ℝ E with ⟨w, b, _hw⟩ erw [← OrthonormalBasis.addHaar_eq_volume b, ← OrthonormalBasis.addHaar_eq_volume (b.map f), Basis.map_addHaar _ f.toContinuousLinearEquiv] congr
0
import Mathlib.Order.CompleteLatticeIntervals import Mathlib.Order.CompactlyGenerated.Basic variable {ι α : Type*} [CompleteLattice α] namespace Set.Iic
Mathlib/Order/CompactlyGenerated/Intervals.lean
18
24
theorem isCompactElement {a : α} {b : Iic a} (h : CompleteLattice.IsCompactElement (b : α)) : CompleteLattice.IsCompactElement b := by
simp only [CompleteLattice.isCompactElement_iff, Finset.sup_eq_iSup] at h ⊢ intro ι s hb replace hb : (b : α) ≤ iSup ((↑) ∘ s) := le_trans hb <| (coe_iSup s) ▸ le_refl _ obtain ⟨t, ht⟩ := h ι ((↑) ∘ s) hb exact ⟨t, (by simpa using ht : (b : α) ≤ _)⟩
0
import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.MeasureTheory.Integral.PeakFunction #align_import analysis.special_functions.trigonometric.euler_sine_prod from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open scoped Real Topology open Real Set Filter intervalIntegral MeasureTheory.MeasureSpace namespace EulerSine section IntegralRecursion variable {z : ℂ} {n : ℕ} theorem antideriv_cos_comp_const_mul (hz : z ≠ 0) (x : ℝ) : HasDerivAt (fun y : ℝ => Complex.sin (2 * z * y) / (2 * z)) (Complex.cos (2 * z * x)) x := by have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _ have b : HasDerivAt (fun y : ℂ => Complex.sin (y * (2 * z))) _ x := HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_sin (x * (2 * z))) a have c := b.comp_ofReal.div_const (2 * z) field_simp at c; simp only [fun y => mul_comm y (2 * z)] at c exact c #align euler_sine.antideriv_cos_comp_const_mul EulerSine.antideriv_cos_comp_const_mul theorem antideriv_sin_comp_const_mul (hz : z ≠ 0) (x : ℝ) : HasDerivAt (fun y : ℝ => -Complex.cos (2 * z * y) / (2 * z)) (Complex.sin (2 * z * x)) x := by have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _ have b : HasDerivAt (fun y : ℂ => Complex.cos (y * (2 * z))) _ x := HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_cos (x * (2 * z))) a have c := (b.comp_ofReal.div_const (2 * z)).neg field_simp at c; simp only [fun y => mul_comm y (2 * z)] at c exact c #align euler_sine.antideriv_sin_comp_const_mul EulerSine.antideriv_sin_comp_const_mul theorem integral_cos_mul_cos_pow_aux (hn : 2 ≤ n) (hz : z ≠ 0) : (∫ x in (0 : ℝ)..π / 2, Complex.cos (2 * z * x) * (cos x : ℂ) ^ n) = n / (2 * z) * ∫ x in (0 : ℝ)..π / 2, Complex.sin (2 * z * x) * sin x * (cos x : ℂ) ^ (n - 1) := by have der1 : ∀ x : ℝ, x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y : ℝ => (cos y : ℂ) ^ n) (-n * sin x * (cos x : ℂ) ^ (n - 1)) x := by intro x _ have b : HasDerivAt (fun y : ℝ => (cos y : ℂ)) (-sin x) x := by simpa using (hasDerivAt_cos x).ofReal_comp convert HasDerivAt.comp x (hasDerivAt_pow _ _) b using 1 ring convert (config := { sameFun := true }) integral_mul_deriv_eq_deriv_mul der1 (fun x _ => antideriv_cos_comp_const_mul hz x) _ _ using 2 · ext1 x; rw [mul_comm] · rw [Complex.ofReal_zero, mul_zero, Complex.sin_zero, zero_div, mul_zero, sub_zero, cos_pi_div_two, Complex.ofReal_zero, zero_pow (by positivity : n ≠ 0), zero_mul, zero_sub, ← integral_neg, ← integral_const_mul] refine integral_congr fun x _ => ?_ field_simp; ring · apply Continuous.intervalIntegrable exact (continuous_const.mul (Complex.continuous_ofReal.comp continuous_sin)).mul ((Complex.continuous_ofReal.comp continuous_cos).pow (n - 1)) · apply Continuous.intervalIntegrable exact Complex.continuous_cos.comp (continuous_const.mul Complex.continuous_ofReal) #align euler_sine.integral_cos_mul_cos_pow_aux EulerSine.integral_cos_mul_cos_pow_aux
Mathlib/Analysis/SpecialFunctions/Trigonometric/EulerSineProd.lean
88
147
theorem integral_sin_mul_sin_mul_cos_pow_eq (hn : 2 ≤ n) (hz : z ≠ 0) : (∫ x in (0 : ℝ)..π / 2, Complex.sin (2 * z * x) * sin x * (cos x : ℂ) ^ (n - 1)) = (n / (2 * z) * ∫ x in (0 : ℝ)..π / 2, Complex.cos (2 * z * x) * (cos x : ℂ) ^ n) - (n - 1) / (2 * z) * ∫ x in (0 : ℝ)..π / 2, Complex.cos (2 * z * x) * (cos x : ℂ) ^ (n - 2) := by
have der1 : ∀ x : ℝ, x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y : ℝ => sin y * (cos y : ℂ) ^ (n - 1)) ((cos x : ℂ) ^ n - (n - 1) * (sin x : ℂ) ^ 2 * (cos x : ℂ) ^ (n - 2)) x := by intro x _ have c := HasDerivAt.comp (x : ℂ) (hasDerivAt_pow (n - 1) _) (Complex.hasDerivAt_cos x) convert ((Complex.hasDerivAt_sin x).mul c).comp_ofReal using 1 · ext1 y; simp only [Complex.ofReal_sin, Complex.ofReal_cos, Function.comp] · simp only [Complex.ofReal_cos, Complex.ofReal_sin] rw [mul_neg, mul_neg, ← sub_eq_add_neg, Function.comp_apply] congr 1 · rw [← pow_succ', Nat.sub_add_cancel (by omega : 1 ≤ n)] · have : ((n - 1 : ℕ) : ℂ) = (n : ℂ) - 1 := by rw [Nat.cast_sub (one_le_two.trans hn), Nat.cast_one] rw [Nat.sub_sub, this] ring convert integral_mul_deriv_eq_deriv_mul der1 (fun x _ => antideriv_sin_comp_const_mul hz x) _ _ using 1 · refine integral_congr fun x _ => ?_ ring_nf · -- now a tedious rearrangement of terms -- gather into a single integral, and deal with continuity subgoals: rw [sin_zero, cos_pi_div_two, Complex.ofReal_zero, zero_pow, zero_mul, mul_zero, zero_mul, zero_mul, sub_zero, zero_sub, ← integral_neg, ← integral_const_mul, ← integral_const_mul, ← integral_sub] rotate_left · apply Continuous.intervalIntegrable exact continuous_const.mul ((Complex.continuous_cos.comp (continuous_const.mul Complex.continuous_ofReal)).mul ((Complex.continuous_ofReal.comp continuous_cos).pow n)) · apply Continuous.intervalIntegrable exact continuous_const.mul ((Complex.continuous_cos.comp (continuous_const.mul Complex.continuous_ofReal)).mul ((Complex.continuous_ofReal.comp continuous_cos).pow (n - 2))) · exact Nat.sub_ne_zero_of_lt hn refine integral_congr fun x _ => ?_ dsimp only -- get rid of real trig functions and divisions by 2 * z: rw [Complex.ofReal_cos, Complex.ofReal_sin, Complex.sin_sq, ← mul_div_right_comm, ← mul_div_right_comm, ← sub_div, mul_div, ← neg_div] congr 1 have : Complex.cos x ^ n = Complex.cos x ^ (n - 2) * Complex.cos x ^ 2 := by conv_lhs => rw [← Nat.sub_add_cancel hn, pow_add] rw [this] ring · apply Continuous.intervalIntegrable exact ((Complex.continuous_ofReal.comp continuous_cos).pow n).sub ((continuous_const.mul ((Complex.continuous_ofReal.comp continuous_sin).pow 2)).mul ((Complex.continuous_ofReal.comp continuous_cos).pow (n - 2))) · apply Continuous.intervalIntegrable exact Complex.continuous_sin.comp (continuous_const.mul Complex.continuous_ofReal)
0
import Mathlib.CategoryTheory.Extensive import Mathlib.CategoryTheory.Limits.Shapes.KernelPair #align_import category_theory.adhesive from "leanprover-community/mathlib"@"afff1f24a6b68d0077c9d63782a1d093e337758c" namespace CategoryTheory open Limits universe v' u' v u variable {J : Type v'} [Category.{u'} J] {C : Type u} [Category.{v} C] variable {W X Y Z : C} {f : W ⟶ X} {g : W ⟶ Y} {h : X ⟶ Z} {i : Y ⟶ Z} -- This only makes sense when the original diagram is a pushout. @[nolint unusedArguments] def IsPushout.IsVanKampen (_ : IsPushout f g h i) : Prop := ∀ ⦃W' X' Y' Z' : C⦄ (f' : W' ⟶ X') (g' : W' ⟶ Y') (h' : X' ⟶ Z') (i' : Y' ⟶ Z') (αW : W' ⟶ W) (αX : X' ⟶ X) (αY : Y' ⟶ Y) (αZ : Z' ⟶ Z) (_ : IsPullback f' αW αX f) (_ : IsPullback g' αW αY g) (_ : CommSq h' αX αZ h) (_ : CommSq i' αY αZ i) (_ : CommSq f' g' h' i'), IsPushout f' g' h' i' ↔ IsPullback h' αX αZ h ∧ IsPullback i' αY αZ i #align category_theory.is_pushout.is_van_kampen CategoryTheory.IsPushout.IsVanKampen theorem IsPushout.IsVanKampen.flip {H : IsPushout f g h i} (H' : H.IsVanKampen) : H.flip.IsVanKampen := by introv W' hf hg hh hi w simpa only [IsPushout.flip_iff, IsPullback.flip_iff, and_comm] using H' g' f' i' h' αW αY αX αZ hg hf hi hh w.flip #align category_theory.is_pushout.is_van_kampen.flip CategoryTheory.IsPushout.IsVanKampen.flip theorem IsPushout.isVanKampen_iff (H : IsPushout f g h i) : H.IsVanKampen ↔ IsVanKampenColimit (PushoutCocone.mk h i H.w) := by constructor · intro H F' c' α fα eα hα refine Iff.trans ?_ ((H (F'.map WalkingSpan.Hom.fst) (F'.map WalkingSpan.Hom.snd) (c'.ι.app _) (c'.ι.app _) (α.app _) (α.app _) (α.app _) fα (by convert hα WalkingSpan.Hom.fst) (by convert hα WalkingSpan.Hom.snd) ?_ ?_ ?_).trans ?_) · have : F'.map WalkingSpan.Hom.fst ≫ c'.ι.app WalkingSpan.left = F'.map WalkingSpan.Hom.snd ≫ c'.ι.app WalkingSpan.right := by simp only [Cocone.w] rw [(IsColimit.equivOfNatIsoOfIso (diagramIsoSpan F') c' (PushoutCocone.mk _ _ this) _).nonempty_congr] · exact ⟨fun h => ⟨⟨this⟩, h⟩, fun h => h.2⟩ · refine Cocones.ext (Iso.refl c'.pt) ?_ rintro (_ | _ | _) <;> dsimp <;> simp only [c'.w, Category.assoc, Category.id_comp, Category.comp_id] · exact ⟨NatTrans.congr_app eα.symm _⟩ · exact ⟨NatTrans.congr_app eα.symm _⟩ · exact ⟨by simp⟩ constructor · rintro ⟨h₁, h₂⟩ (_ | _ | _) · rw [← c'.w WalkingSpan.Hom.fst]; exact (hα WalkingSpan.Hom.fst).paste_horiz h₁ exacts [h₁, h₂] · intro h; exact ⟨h _, h _⟩ · introv H W' hf hg hh hi w refine Iff.trans ?_ ((H w.cocone ⟨by rintro (_ | _ | _); exacts [αW, αX, αY], ?_⟩ αZ ?_ ?_).trans ?_) rotate_left · rintro i _ (_ | _ | _) · dsimp; simp only [Functor.map_id, Category.comp_id, Category.id_comp] exacts [hf.w, hg.w] · ext (_ | _ | _) · dsimp; rw [PushoutCocone.condition_zero]; erw [Category.assoc, hh.w, hf.w_assoc] exacts [hh.w.symm, hi.w.symm] · rintro i _ (_ | _ | _) · dsimp; simp_rw [Functor.map_id] exact IsPullback.of_horiz_isIso ⟨by rw [Category.comp_id, Category.id_comp]⟩ exacts [hf, hg] · constructor · intro h; exact ⟨h WalkingCospan.left, h WalkingCospan.right⟩ · rintro ⟨h₁, h₂⟩ (_ | _ | _) · dsimp; rw [PushoutCocone.condition_zero]; exact hf.paste_horiz h₁ exacts [h₁, h₂] · exact ⟨fun h => h.2, fun h => ⟨w, h⟩⟩ #align category_theory.is_pushout.is_van_kampen_iff CategoryTheory.IsPushout.isVanKampen_iff
Mathlib/CategoryTheory/Adhesive.lean
113
143
theorem is_coprod_iff_isPushout {X E Y YE : C} (c : BinaryCofan X E) (hc : IsColimit c) {f : X ⟶ Y} {iY : Y ⟶ YE} {fE : c.pt ⟶ YE} (H : CommSq f c.inl iY fE) : Nonempty (IsColimit (BinaryCofan.mk (c.inr ≫ fE) iY)) ↔ IsPushout f c.inl iY fE := by
constructor · rintro ⟨h⟩ refine ⟨H, ⟨Limits.PushoutCocone.isColimitAux' _ ?_⟩⟩ intro s dsimp only [PushoutCocone.inr, PushoutCocone.mk] -- Porting note: Originally `dsimp` refine ⟨h.desc (BinaryCofan.mk (c.inr ≫ s.inr) s.inl), h.fac _ ⟨WalkingPair.right⟩, ?_, ?_⟩ · apply BinaryCofan.IsColimit.hom_ext hc · rw [← H.w_assoc]; erw [h.fac _ ⟨WalkingPair.right⟩]; exact s.condition · rw [← Category.assoc]; exact h.fac _ ⟨WalkingPair.left⟩ · intro m e₁ e₂ apply BinaryCofan.IsColimit.hom_ext h · dsimp only [BinaryCofan.mk, id] -- Porting note: Originally `dsimp` rw [Category.assoc, e₂, eq_comm]; exact h.fac _ ⟨WalkingPair.left⟩ · refine e₁.trans (Eq.symm ?_); exact h.fac _ _ · refine fun H => ⟨?_⟩ fapply Limits.BinaryCofan.isColimitMk · exact fun s => H.isColimit.desc (PushoutCocone.mk s.inr _ <| (hc.fac (BinaryCofan.mk (f ≫ s.inr) s.inl) ⟨WalkingPair.left⟩).symm) · intro s erw [Category.assoc, H.isColimit.fac _ WalkingSpan.right, hc.fac]; rfl · intro s; exact H.isColimit.fac _ WalkingSpan.left · intro s m e₁ e₂ apply PushoutCocone.IsColimit.hom_ext H.isColimit · symm; exact (H.isColimit.fac _ WalkingSpan.left).trans e₂.symm · erw [H.isColimit.fac _ WalkingSpan.right] apply BinaryCofan.IsColimit.hom_ext hc · erw [hc.fac, ← H.w_assoc, e₂]; rfl · refine ((Category.assoc _ _ _).symm.trans e₁).trans ?_; symm; exact hc.fac _ _
0
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal #align_import analysis.special_functions.pow.asymptotics from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" set_option linter.uppercaseLean3 false noncomputable section open scoped Classical open Real Topology NNReal ENNReal Filter ComplexConjugate Finset Set section Limits open Real Filter theorem tendsto_rpow_atTop {y : ℝ} (hy : 0 < y) : Tendsto (fun x : ℝ => x ^ y) atTop atTop := by rw [tendsto_atTop_atTop] intro b use max b 0 ^ (1 / y) intro x hx exact le_of_max_le_left (by convert rpow_le_rpow (rpow_nonneg (le_max_right b 0) (1 / y)) hx (le_of_lt hy) using 1 rw [← rpow_mul (le_max_right b 0), (eq_div_iff (ne_of_gt hy)).mp rfl, Real.rpow_one]) #align tendsto_rpow_at_top tendsto_rpow_atTop theorem tendsto_rpow_neg_atTop {y : ℝ} (hy : 0 < y) : Tendsto (fun x : ℝ => x ^ (-y)) atTop (𝓝 0) := Tendsto.congr' (eventuallyEq_of_mem (Ioi_mem_atTop 0) fun _ hx => (rpow_neg (le_of_lt hx) y).symm) (tendsto_rpow_atTop hy).inv_tendsto_atTop #align tendsto_rpow_neg_at_top tendsto_rpow_neg_atTop open Asymptotics in lemma tendsto_rpow_atTop_of_base_lt_one (b : ℝ) (hb₀ : -1 < b) (hb₁ : b < 1) : Tendsto (b ^ · : ℝ → ℝ) atTop (𝓝 (0:ℝ)) := by rcases lt_trichotomy b 0 with hb|rfl|hb case inl => -- b < 0 simp_rw [Real.rpow_def_of_nonpos hb.le, hb.ne, ite_false] rw [← isLittleO_const_iff (c := (1:ℝ)) one_ne_zero, (one_mul (1 : ℝ)).symm] refine IsLittleO.mul_isBigO ?exp ?cos case exp => rw [isLittleO_const_iff one_ne_zero] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_neg ?_).mpr tendsto_id rw [← log_neg_eq_log, log_neg_iff (by linarith)] linarith case cos => rw [isBigO_iff] exact ⟨1, eventually_of_forall fun x => by simp [Real.abs_cos_le_one]⟩ case inr.inl => -- b = 0 refine Tendsto.mono_right ?_ (Iff.mpr pure_le_nhds_iff rfl) rw [tendsto_pure] filter_upwards [eventually_ne_atTop 0] with _ hx simp [hx] case inr.inr => -- b > 0 simp_rw [Real.rpow_def_of_pos hb] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_neg ?_).mpr tendsto_id exact (log_neg_iff hb).mpr hb₁ lemma tendsto_rpow_atTop_of_base_gt_one (b : ℝ) (hb : 1 < b) : Tendsto (b ^ · : ℝ → ℝ) atBot (𝓝 (0:ℝ)) := by simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_pos ?_).mpr tendsto_id exact (log_pos_iff (by positivity)).mpr <| by aesop lemma tendsto_rpow_atBot_of_base_lt_one (b : ℝ) (hb₀ : 0 < b) (hb₁ : b < 1) : Tendsto (b ^ · : ℝ → ℝ) atBot atTop := by simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)] refine tendsto_exp_atTop.comp <| (tendsto_const_mul_atTop_iff_neg <| tendsto_id (α := ℝ)).mpr ?_ exact (log_neg_iff hb₀).mpr hb₁ lemma tendsto_rpow_atBot_of_base_gt_one (b : ℝ) (hb : 1 < b) : Tendsto (b ^ · : ℝ → ℝ) atBot (𝓝 0) := by simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_iff_pos <| tendsto_id (α := ℝ)).mpr ?_ exact (log_pos_iff (by positivity)).mpr <| by aesop
Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean
102
116
theorem tendsto_rpow_div_mul_add (a b c : ℝ) (hb : 0 ≠ b) : Tendsto (fun x => x ^ (a / (b * x + c))) atTop (𝓝 1) := by
refine Tendsto.congr' ?_ ((tendsto_exp_nhds_zero_nhds_one.comp (by simpa only [mul_zero, pow_one] using (tendsto_const_nhds (x := a)).mul (tendsto_div_pow_mul_exp_add_atTop b c 1 hb))).comp tendsto_log_atTop) apply eventuallyEq_of_mem (Ioi_mem_atTop (0 : ℝ)) intro x hx simp only [Set.mem_Ioi, Function.comp_apply] at hx ⊢ rw [exp_log hx, ← exp_log (rpow_pos_of_pos hx (a / (b * x + c))), log_rpow hx (a / (b * x + c))] field_simp
0
import Mathlib.CategoryTheory.EffectiveEpi.Preserves import Mathlib.CategoryTheory.Limits.Final.ParallelPair import Mathlib.CategoryTheory.Preadditive.Projective import Mathlib.CategoryTheory.Sites.Canonical import Mathlib.CategoryTheory.Sites.Coherent.Basic import Mathlib.CategoryTheory.Sites.EffectiveEpimorphic namespace CategoryTheory open Limits variable {C D E : Type*} [Category C] [Category D] [Category E] open Opposite Presieve Functor class Presieve.regular {X : C} (R : Presieve X) : Prop where single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y) (fun (_ : Unit) ↦ f) ∧ EffectiveEpi f namespace regularTopology lemma equalizerCondition_w (P : Cᵒᵖ ⥤ D) {X B : C} {π : X ⟶ B} (c : PullbackCone π π) : P.map π.op ≫ P.map c.fst.op = P.map π.op ≫ P.map c.snd.op := by simp only [← Functor.map_comp, ← op_comp, c.condition] def SingleEqualizerCondition (P : Cᵒᵖ ⥤ D) ⦃X B : C⦄ (π : X ⟶ B) : Prop := ∀ (c : PullbackCone π π) (_ : IsLimit c), Nonempty (IsLimit (Fork.ofι (P.map π.op) (equalizerCondition_w P c))) def EqualizerCondition (P : Cᵒᵖ ⥤ D) : Prop := ∀ ⦃X B : C⦄ (π : X ⟶ B) [EffectiveEpi π], SingleEqualizerCondition P π theorem equalizerCondition_of_natIso {P P' : Cᵒᵖ ⥤ D} (i : P ≅ P') (hP : EqualizerCondition P) : EqualizerCondition P' := fun X B π _ c hc ↦ ⟨Fork.isLimitOfIsos _ (hP π c hc).some _ (i.app _) (i.app _) (i.app _)⟩
Mathlib/CategoryTheory/Sites/Coherent/RegularSheaves.lean
69
79
theorem equalizerCondition_precomp_of_preservesPullback (P : Cᵒᵖ ⥤ D) (F : E ⥤ C) [∀ {X B} (π : X ⟶ B) [EffectiveEpi π], PreservesLimit (cospan π π) F] [F.PreservesEffectiveEpis] (hP : EqualizerCondition P) : EqualizerCondition (F.op ⋙ P) := by
intro X B π _ c hc have h : P.map (F.map π).op = (F.op ⋙ P).map π.op := by simp refine ⟨(IsLimit.equivIsoLimit (ForkOfι.ext ?_ _ h)) ?_⟩ · simp only [Functor.comp_map, op_map, Quiver.Hom.unop_op, ← map_comp, ← op_comp, c.condition] · refine (hP (F.map π) (PullbackCone.mk (F.map c.fst) (F.map c.snd) ?_) ?_).some · simp only [← map_comp, c.condition] · exact (isLimitMapConePullbackConeEquiv F c.condition) (isLimitOfPreserves F (hc.ofIsoLimit (PullbackCone.ext (Iso.refl _) (by simp) (by simp))))
0
import Mathlib.Topology.Semicontinuous import Mathlib.MeasureTheory.Function.AEMeasurableSequence import Mathlib.MeasureTheory.Order.Lattice import Mathlib.Topology.Order.Lattice import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic #align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce" open Set Filter MeasureTheory MeasurableSpace TopologicalSpace open scoped Classical Topology NNReal ENNReal MeasureTheory universe u v w x y variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α} section OrderTopology variable (α) variable [TopologicalSpace α] [SecondCountableTopology α] [LinearOrder α] [OrderTopology α] theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by refine le_antisymm ?_ (generateFrom_le ?_) · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)] letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio) have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩ refine generateFrom_le ?_ rintro _ ⟨a, rfl | rfl⟩ · rcases em (∃ b, a ⋖ b) with ⟨b, hb⟩ | hcovBy · rw [hb.Ioi_eq, ← compl_Iio] exact (H _).compl · rcases isOpen_biUnion_countable (Ioi a) Ioi fun _ _ ↦ isOpen_Ioi with ⟨t, hat, htc, htU⟩ have : Ioi a = ⋃ b ∈ t, Ici b := by refine Subset.antisymm ?_ <| iUnion₂_subset fun b hb ↦ Ici_subset_Ioi.2 (hat hb) refine Subset.trans ?_ <| iUnion₂_mono fun _ _ ↦ Ioi_subset_Ici_self simpa [CovBy, htU, subset_def] using hcovBy simp only [this, ← compl_Iio] exact .biUnion htc <| fun _ _ ↦ (H _).compl · apply H · rw [forall_mem_range] intro a exact GenerateMeasurable.basic _ isOpen_Iio #align borel_eq_generate_from_Iio borel_eq_generateFrom_Iio theorem borel_eq_generateFrom_Ioi : borel α = .generateFrom (range Ioi) := @borel_eq_generateFrom_Iio αᵒᵈ _ (by infer_instance : SecondCountableTopology α) _ _ #align borel_eq_generate_from_Ioi borel_eq_generateFrom_Ioi
Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean
81
92
theorem borel_eq_generateFrom_Iic : borel α = MeasurableSpace.generateFrom (range Iic) := by
rw [borel_eq_generateFrom_Ioi] refine le_antisymm ?_ ?_ · refine MeasurableSpace.generateFrom_le fun t ht => ?_ obtain ⟨u, rfl⟩ := ht rw [← compl_Iic] exact (MeasurableSpace.measurableSet_generateFrom (mem_range.mpr ⟨u, rfl⟩)).compl · refine MeasurableSpace.generateFrom_le fun t ht => ?_ obtain ⟨u, rfl⟩ := ht rw [← compl_Ioi] exact (MeasurableSpace.measurableSet_generateFrom (mem_range.mpr ⟨u, rfl⟩)).compl
0
import Mathlib.RingTheory.LocalProperties #align_import ring_theory.ring_hom.surjective from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" namespace RingHom open scoped TensorProduct open TensorProduct Algebra.TensorProduct local notation "surjective" => fun {X Y : Type _} [CommRing X] [CommRing Y] => fun f : X →+* Y => Function.Surjective f theorem surjective_stableUnderComposition : StableUnderComposition surjective := by introv R hf hg; exact hg.comp hf #align ring_hom.surjective_stable_under_composition RingHom.surjective_stableUnderComposition theorem surjective_respectsIso : RespectsIso surjective := by apply surjective_stableUnderComposition.respectsIso intros _ _ _ _ e exact e.surjective #align ring_hom.surjective_respects_iso RingHom.surjective_respectsIso theorem surjective_stableUnderBaseChange : StableUnderBaseChange surjective := by refine StableUnderBaseChange.mk _ surjective_respectsIso ?_ classical introv h x induction x using TensorProduct.induction_on with | zero => exact ⟨0, map_zero _⟩ | tmul x y => obtain ⟨y, rfl⟩ := h y; use y • x; dsimp rw [TensorProduct.smul_tmul, Algebra.algebraMap_eq_smul_one] | add x y ex ey => obtain ⟨⟨x, rfl⟩, ⟨y, rfl⟩⟩ := ex, ey; exact ⟨x + y, map_add _ x y⟩ #align ring_hom.surjective_stable_under_base_change RingHom.surjective_stableUnderBaseChange
Mathlib/RingTheory/RingHom/Surjective.lean
48
70
theorem surjective_ofLocalizationSpan : OfLocalizationSpan surjective := by
introv R hs H letI := f.toAlgebra show Function.Surjective (Algebra.ofId R S) rw [← Algebra.range_top_iff_surjective, eq_top_iff] rintro x - obtain ⟨l, hl⟩ := (Finsupp.mem_span_iff_total R s 1).mp (show _ ∈ Ideal.span s by rw [hs]; trivial) fapply Subalgebra.mem_of_finset_sum_eq_one_of_pow_smul_mem _ l.support (fun x : s => f x) fun x : s => f (l x) · simp_rw [← _root_.map_mul, ← map_sum, ← f.map_one]; exact f.congr_arg hl · exact fun _ => Set.mem_range_self _ · exact fun _ => Set.mem_range_self _ · intro r obtain ⟨y, hy⟩ := H r (IsLocalization.mk' _ x (1 : Submonoid.powers (f r))) obtain ⟨z, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.mk'_surjective (Submonoid.powers (r : R)) y erw [IsLocalization.map_mk', IsLocalization.eq] at hy obtain ⟨⟨_, m, rfl⟩, hm⟩ := hy refine ⟨m + n, ?_⟩ dsimp at hm ⊢ simp_rw [_root_.one_mul, ← _root_.mul_assoc, ← map_pow, ← f.map_mul, ← pow_add, map_pow] at hm exact ⟨_, hm⟩
0
import Mathlib.CategoryTheory.ConcreteCategory.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Limits.TypesFiltered import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.Tactic.ApplyFun #align_import category_theory.limits.concrete_category from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" universe t w v u r open CategoryTheory namespace CategoryTheory.Limits attribute [local instance] ConcreteCategory.instFunLike ConcreteCategory.hasCoeToSort section Colimits section variable {C : Type u} [Category.{v} C] [ConcreteCategory.{t} C] {J : Type w} [Category.{r} J] (F : J ⥤ C) [PreservesColimit F (forget C)] theorem Concrete.from_union_surjective_of_isColimit {D : Cocone F} (hD : IsColimit D) : let ff : (Σj : J, F.obj j) → D.pt := fun a => D.ι.app a.1 a.2 Function.Surjective ff := by intro ff x let E : Cocone (F ⋙ forget C) := (forget C).mapCocone D let hE : IsColimit E := isColimitOfPreserves (forget C) hD obtain ⟨j, y, hy⟩ := Types.jointly_surjective_of_isColimit hE x exact ⟨⟨j, y⟩, hy⟩ #align category_theory.limits.concrete.from_union_surjective_of_is_colimit CategoryTheory.Limits.Concrete.from_union_surjective_of_isColimit theorem Concrete.isColimit_exists_rep {D : Cocone F} (hD : IsColimit D) (x : D.pt) : ∃ (j : J) (y : F.obj j), D.ι.app j y = x := by obtain ⟨a, rfl⟩ := Concrete.from_union_surjective_of_isColimit F hD x exact ⟨a.1, a.2, rfl⟩ #align category_theory.limits.concrete.is_colimit_exists_rep CategoryTheory.Limits.Concrete.isColimit_exists_rep theorem Concrete.colimit_exists_rep [HasColimit F] (x : ↑(colimit F)) : ∃ (j : J) (y : F.obj j), colimit.ι F j y = x := Concrete.isColimit_exists_rep F (colimit.isColimit _) x #align category_theory.limits.concrete.colimit_exists_rep CategoryTheory.Limits.Concrete.colimit_exists_rep
Mathlib/CategoryTheory/Limits/ConcreteCategory.lean
97
106
theorem Concrete.isColimit_rep_eq_of_exists {D : Cocone F} {i j : J} (x : F.obj i) (y : F.obj j) (h : ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f x = F.map g y) : D.ι.app i x = D.ι.app j y := by
let E := (forget C).mapCocone D obtain ⟨k, f, g, (hfg : (F ⋙ forget C).map f x = F.map g y)⟩ := h let h1 : (F ⋙ forget C).map f ≫ E.ι.app k = E.ι.app i := E.ι.naturality f let h2 : (F ⋙ forget C).map g ≫ E.ι.app k = E.ι.app j := E.ι.naturality g show E.ι.app i x = E.ι.app j y rw [← h1, types_comp_apply, hfg] exact congrFun h2 y
0
import Mathlib.Dynamics.BirkhoffSum.Basic import Mathlib.Algebra.Module.Basic open Finset section birkhoffAverage variable (R : Type*) {α M : Type*} [DivisionSemiring R] [AddCommMonoid M] [Module R M] def birkhoffAverage (f : α → α) (g : α → M) (n : ℕ) (x : α) : M := (n : R)⁻¹ • birkhoffSum f g n x theorem birkhoffAverage_zero (f : α → α) (g : α → M) (x : α) : birkhoffAverage R f g 0 x = 0 := by simp [birkhoffAverage] @[simp] theorem birkhoffAverage_zero' (f : α → α) (g : α → M) : birkhoffAverage R f g 0 = 0 := funext <| birkhoffAverage_zero _ _ _ theorem birkhoffAverage_one (f : α → α) (g : α → M) (x : α) : birkhoffAverage R f g 1 x = g x := by simp [birkhoffAverage] @[simp] theorem birkhoffAverage_one' (f : α → α) (g : α → M) : birkhoffAverage R f g 1 = g := funext <| birkhoffAverage_one R f g theorem map_birkhoffAverage (S : Type*) {F N : Type*} [DivisionSemiring S] [AddCommMonoid N] [Module S N] [FunLike F M N] [AddMonoidHomClass F M N] (g' : F) (f : α → α) (g : α → M) (n : ℕ) (x : α) : g' (birkhoffAverage R f g n x) = birkhoffAverage S f (g' ∘ g) n x := by simp only [birkhoffAverage, map_inv_natCast_smul g' R S, map_birkhoffSum] theorem birkhoffAverage_congr_ring (S : Type*) [DivisionSemiring S] [Module S M] (f : α → α) (g : α → M) (n : ℕ) (x : α) : birkhoffAverage R f g n x = birkhoffAverage S f g n x := map_birkhoffAverage R S (AddMonoidHom.id M) f g n x theorem birkhoffAverage_congr_ring' (S : Type*) [DivisionSemiring S] [Module S M] : birkhoffAverage (α := α) (M := M) R = birkhoffAverage S := by ext; apply birkhoffAverage_congr_ring
Mathlib/Dynamics/BirkhoffSum/Average.lean
72
75
theorem Function.IsFixedPt.birkhoffAverage_eq [CharZero R] {f : α → α} {x : α} (h : IsFixedPt f x) (g : α → M) {n : ℕ} (hn : n ≠ 0) : birkhoffAverage R f g n x = g x := by
rw [birkhoffAverage, h.birkhoffSum_eq, nsmul_eq_smul_cast R, inv_smul_smul₀] rwa [Nat.cast_ne_zero]
0
import Mathlib.Data.PFunctor.Univariate.M #align_import data.qpf.univariate.basic from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7" universe u class QPF (F : Type u → Type u) [Functor F] where P : PFunctor.{u} abs : ∀ {α}, P α → F α repr : ∀ {α}, F α → P α abs_repr : ∀ {α} (x : F α), abs (repr x) = x abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p #align qpf QPF namespace QPF variable {F : Type u → Type u} [Functor F] [q : QPF F] open Functor (Liftp Liftr) theorem id_map {α : Type _} (x : F α) : id <$> x = x := by rw [← abs_repr x] cases' repr x with a f rw [← abs_map] rfl #align qpf.id_map QPF.id_map theorem comp_map {α β γ : Type _} (f : α → β) (g : β → γ) (x : F α) : (g ∘ f) <$> x = g <$> f <$> x := by rw [← abs_repr x] cases' repr x with a f rw [← abs_map, ← abs_map, ← abs_map] rfl #align qpf.comp_map QPF.comp_map theorem lawfulFunctor (h : ∀ α β : Type u, @Functor.mapConst F _ α _ = Functor.map ∘ Function.const β) : LawfulFunctor F := { map_const := @h id_map := @id_map F _ _ comp_map := @comp_map F _ _ } #align qpf.is_lawful_functor QPF.lawfulFunctor section open Functor
Mathlib/Data/QPF/Univariate/Basic.lean
101
114
theorem liftp_iff {α : Type u} (p : α → Prop) (x : F α) : Liftp p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i, p (f i) := by
constructor · rintro ⟨y, hy⟩ cases' h : repr y with a f use a, fun i => (f i).val constructor · rw [← hy, ← abs_repr y, h, ← abs_map] rfl intro i apply (f i).property rintro ⟨a, f, h₀, h₁⟩ use abs ⟨a, fun i => ⟨f i, h₁ i⟩⟩ rw [← abs_map, h₀]; rfl
0
import Mathlib.LinearAlgebra.TensorProduct.RightExactness import Mathlib.LinearAlgebra.TensorProduct.Finiteness universe u variable (R : Type u) [CommRing R] variable {M : Type u} [AddCommGroup M] [Module R M] variable {N : Type u} [AddCommGroup N] [Module R N] open Classical DirectSum LinearMap Function Submodule namespace TensorProduct variable {ι : Type u} [Fintype ι] {m : ι → M} {n : ι → N} variable (m n) in abbrev VanishesTrivially : Prop := ∃ (κ : Type u) (_ : Fintype κ) (a : ι → κ → R) (y : κ → N), (∀ i, n i = ∑ j, a i j • y j) ∧ ∀ j, ∑ i, a i j • m i = 0 theorem sum_tmul_eq_zero_of_vanishesTrivially (hmn : VanishesTrivially R m n) : ∑ i, m i ⊗ₜ n i = (0 : M ⊗[R] N) := by obtain ⟨κ, _, a, y, h₁, h₂⟩ := hmn simp_rw [h₁, tmul_sum, tmul_smul] rw [Finset.sum_comm] simp_rw [← tmul_smul, ← smul_tmul, ← sum_tmul, h₂, zero_tmul, Finset.sum_const_zero]
Mathlib/LinearAlgebra/TensorProduct/Vanishing.lean
102
157
theorem vanishesTrivially_of_sum_tmul_eq_zero (hm : Submodule.span R (Set.range m) = ⊤) (hmn : ∑ i, m i ⊗ₜ n i = (0 : M ⊗[R] N)) : VanishesTrivially R m n := by
-- Define a map $G \colon R^\iota \to M$ whose matrix entries are the $m_i$. It is surjective. set G : (ι →₀ R) →ₗ[R] M := Finsupp.total ι M R m with hG have G_basis_eq (i : ι) : G (Finsupp.single i 1) = m i := by simp [hG, toModule_lof] have G_surjective : Surjective G := by apply LinearMap.range_eq_top.mp apply top_le_iff.mp rw [← hm] apply Submodule.span_le.mpr rintro _ ⟨i, rfl⟩ use Finsupp.single i 1, G_basis_eq i /- Consider the element $\sum_i e_i \otimes n_i$ of $R^\iota \otimes N$. It is in the kernel of $R^\iota \otimes N \to M \otimes N$. -/ set en : (ι →₀ R) ⊗[R] N := ∑ i, Finsupp.single i 1 ⊗ₜ n i with hen have en_mem_ker : en ∈ ker (rTensor N G) := by simp [hen, G_basis_eq, hmn] -- We have an exact sequence $\ker G \to R^\iota \to M \to 0$. have exact_ker_subtype : Exact (ker G).subtype G := G.exact_subtype_ker_map -- Tensor the exact sequence with $N$. have exact_rTensor_ker_subtype : Exact (rTensor N (ker G).subtype) (rTensor N G) := rTensor_exact (M := ↥(ker G)) N exact_ker_subtype G_surjective /- We conclude that $\sum_i e_i \otimes n_i$ is in the range of $\ker G \otimes N \to R^\iota \otimes N$. -/ have en_mem_range : en ∈ range (rTensor N (ker G).subtype) := exact_rTensor_ker_subtype.linearMap_ker_eq ▸ en_mem_ker /- There is an element of in $\ker G \otimes N$ that maps to $\sum_i e_i \otimes n_i$. Write it as a finite sum of pure tensors. -/ obtain ⟨kn, hkn⟩ := en_mem_range obtain ⟨ma, rfl : kn = ∑ kj ∈ ma, kj.1 ⊗ₜ[R] kj.2⟩ := exists_finset kn use ↑↑ma, FinsetCoe.fintype ma /- Let $\sum_j k_j \otimes y_j$ be the sum obtained in the previous step. In order to show that $\sum_i m_i \otimes n_i$ vanishes trivially, it suffices to prove that there exist $(a_{ij})_{i, j}$ such that for all $i$, $$n_i = \sum_j a_{ij} y_j$$ and for all $j$, $$\sum_{i} a_{ij} m_i = 0.$$ For this, take $a_{ij}$ to be the coefficient of $e_i$ in $k_j$. -/ use fun i ⟨⟨kj, _⟩, _⟩ ↦ (kj : ι →₀ R) i use fun ⟨⟨_, yj⟩, _⟩ ↦ yj constructor · intro i apply_fun finsuppScalarLeft R N ι at hkn apply_fun (· i) at hkn symm at hkn simp only [map_sum, finsuppScalarLeft_apply_tmul, zero_smul, Finsupp.single_zero, Finsupp.sum_single_index, one_smul, Finsupp.finset_sum_apply, Finsupp.single_apply, Finset.sum_ite_eq', Finset.mem_univ, ↓reduceIte, rTensor_tmul, coeSubtype, Finsupp.sum_apply, Finsupp.sum_ite_eq', Finsupp.mem_support_iff, ne_eq, ite_not, en] at hkn simp only [Finset.univ_eq_attach, Finset.sum_attach ma (fun x ↦ (x.1 : ι →₀ R) i • x.2)] convert hkn using 2 with x _ split · next h'x => rw [h'x, zero_smul] · rfl · rintro ⟨⟨⟨k, hk⟩, _⟩, _⟩ simpa only [hG, Finsupp.total_apply, zero_smul, implies_true, Finsupp.sum_fintype] using mem_ker.mp hk
0
import Mathlib.RingTheory.LocalProperties #align_import ring_theory.ring_hom.surjective from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" namespace RingHom open scoped TensorProduct open TensorProduct Algebra.TensorProduct local notation "surjective" => fun {X Y : Type _} [CommRing X] [CommRing Y] => fun f : X →+* Y => Function.Surjective f theorem surjective_stableUnderComposition : StableUnderComposition surjective := by introv R hf hg; exact hg.comp hf #align ring_hom.surjective_stable_under_composition RingHom.surjective_stableUnderComposition theorem surjective_respectsIso : RespectsIso surjective := by apply surjective_stableUnderComposition.respectsIso intros _ _ _ _ e exact e.surjective #align ring_hom.surjective_respects_iso RingHom.surjective_respectsIso
Mathlib/RingTheory/RingHom/Surjective.lean
36
45
theorem surjective_stableUnderBaseChange : StableUnderBaseChange surjective := by
refine StableUnderBaseChange.mk _ surjective_respectsIso ?_ classical introv h x induction x using TensorProduct.induction_on with | zero => exact ⟨0, map_zero _⟩ | tmul x y => obtain ⟨y, rfl⟩ := h y; use y • x; dsimp rw [TensorProduct.smul_tmul, Algebra.algebraMap_eq_smul_one] | add x y ex ey => obtain ⟨⟨x, rfl⟩, ⟨y, rfl⟩⟩ := ex, ey; exact ⟨x + y, map_add _ x y⟩
0
import Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL1 #align_import measure_theory.function.conditional_expectation.basic from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e" open TopologicalSpace MeasureTheory.Lp Filter open scoped ENNReal Topology MeasureTheory namespace MeasureTheory variable {α F F' 𝕜 : Type*} {p : ℝ≥0∞} [RCLike 𝕜] -- 𝕜 for ℝ or ℂ -- F for a Lp submodule [NormedAddCommGroup F] [NormedSpace 𝕜 F] -- F' for integrals on a Lp submodule [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] [NormedSpace ℝ F'] [CompleteSpace F'] open scoped Classical variable {m m0 : MeasurableSpace α} {μ : Measure α} {f g : α → F'} {s : Set α} noncomputable irreducible_def condexp (m : MeasurableSpace α) {m0 : MeasurableSpace α} (μ : Measure α) (f : α → F') : α → F' := if hm : m ≤ m0 then if h : SigmaFinite (μ.trim hm) ∧ Integrable f μ then if StronglyMeasurable[m] f then f else (@aestronglyMeasurable'_condexpL1 _ _ _ _ _ m m0 μ hm h.1 _).mk (@condexpL1 _ _ _ _ _ _ _ hm μ h.1 f) else 0 else 0 #align measure_theory.condexp MeasureTheory.condexp -- We define notation `μ[f|m]` for the conditional expectation of `f` with respect to `m`. scoped notation μ "[" f "|" m "]" => MeasureTheory.condexp m μ f theorem condexp_of_not_le (hm_not : ¬m ≤ m0) : μ[f|m] = 0 := by rw [condexp, dif_neg hm_not] #align measure_theory.condexp_of_not_le MeasureTheory.condexp_of_not_le theorem condexp_of_not_sigmaFinite (hm : m ≤ m0) (hμm_not : ¬SigmaFinite (μ.trim hm)) : μ[f|m] = 0 := by rw [condexp, dif_pos hm, dif_neg]; push_neg; exact fun h => absurd h hμm_not #align measure_theory.condexp_of_not_sigma_finite MeasureTheory.condexp_of_not_sigmaFinite theorem condexp_of_sigmaFinite (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] : μ[f|m] = if Integrable f μ then if StronglyMeasurable[m] f then f else aestronglyMeasurable'_condexpL1.mk (condexpL1 hm μ f) else 0 := by rw [condexp, dif_pos hm] simp only [hμm, Ne, true_and_iff] by_cases hf : Integrable f μ · rw [dif_pos hf, if_pos hf] · rw [dif_neg hf, if_neg hf] #align measure_theory.condexp_of_sigma_finite MeasureTheory.condexp_of_sigmaFinite theorem condexp_of_stronglyMeasurable (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] {f : α → F'} (hf : StronglyMeasurable[m] f) (hfi : Integrable f μ) : μ[f|m] = f := by rw [condexp_of_sigmaFinite hm, if_pos hfi, if_pos hf] #align measure_theory.condexp_of_strongly_measurable MeasureTheory.condexp_of_stronglyMeasurable theorem condexp_const (hm : m ≤ m0) (c : F') [IsFiniteMeasure μ] : μ[fun _ : α => c|m] = fun _ => c := condexp_of_stronglyMeasurable hm (@stronglyMeasurable_const _ _ m _ _) (integrable_const c) #align measure_theory.condexp_const MeasureTheory.condexp_const
Mathlib/MeasureTheory/Function/ConditionalExpectation/Basic.lean
136
148
theorem condexp_ae_eq_condexpL1 (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] (f : α → F') : μ[f|m] =ᵐ[μ] condexpL1 hm μ f := by
rw [condexp_of_sigmaFinite hm] by_cases hfi : Integrable f μ · rw [if_pos hfi] by_cases hfm : StronglyMeasurable[m] f · rw [if_pos hfm] exact (condexpL1_of_aestronglyMeasurable' (StronglyMeasurable.aeStronglyMeasurable' hfm) hfi).symm · rw [if_neg hfm] exact (AEStronglyMeasurable'.ae_eq_mk aestronglyMeasurable'_condexpL1).symm rw [if_neg hfi, condexpL1_undef hfi] exact (coeFn_zero _ _ _).symm
0
import Mathlib.Data.Set.Card import Mathlib.Order.Minimal import Mathlib.Data.Matroid.Init set_option autoImplicit true open Set def Matroid.ExchangeProperty {α : Type _} (P : Set α → Prop) : Prop := ∀ X Y, P X → P Y → ∀ a ∈ X \ Y, ∃ b ∈ Y \ X, P (insert b (X \ {a})) def Matroid.ExistsMaximalSubsetProperty {α : Type _} (P : Set α → Prop) (X : Set α) : Prop := ∀ I, P I → I ⊆ X → (maximals (· ⊆ ·) {Y | P Y ∧ I ⊆ Y ∧ Y ⊆ X}).Nonempty @[ext] structure Matroid (α : Type _) where (E : Set α) (Base : Set α → Prop) (Indep : Set α → Prop) (indep_iff' : ∀ ⦃I⦄, Indep I ↔ ∃ B, Base B ∧ I ⊆ B) (exists_base : ∃ B, Base B) (base_exchange : Matroid.ExchangeProperty Base) (maximality : ∀ X, X ⊆ E → Matroid.ExistsMaximalSubsetProperty Indep X) (subset_ground : ∀ B, Base B → B ⊆ E) namespace Matroid variable {α : Type*} {M : Matroid α} protected class Finite (M : Matroid α) : Prop where (ground_finite : M.E.Finite) protected class Nonempty (M : Matroid α) : Prop where (ground_nonempty : M.E.Nonempty) theorem ground_nonempty (M : Matroid α) [M.Nonempty] : M.E.Nonempty := Nonempty.ground_nonempty theorem ground_nonempty_iff (M : Matroid α) : M.E.Nonempty ↔ M.Nonempty := ⟨fun h ↦ ⟨h⟩, fun ⟨h⟩ ↦ h⟩ theorem ground_finite (M : Matroid α) [M.Finite] : M.E.Finite := Finite.ground_finite theorem set_finite (M : Matroid α) [M.Finite] (X : Set α) (hX : X ⊆ M.E := by aesop) : X.Finite := M.ground_finite.subset hX instance finite_of_finite [Finite α] {M : Matroid α} : M.Finite := ⟨Set.toFinite _⟩ class FiniteRk (M : Matroid α) : Prop where exists_finite_base : ∃ B, M.Base B ∧ B.Finite instance finiteRk_of_finite (M : Matroid α) [M.Finite] : FiniteRk M := ⟨M.exists_base.imp (fun B hB ↦ ⟨hB, M.set_finite B (M.subset_ground _ hB)⟩)⟩ class InfiniteRk (M : Matroid α) : Prop where exists_infinite_base : ∃ B, M.Base B ∧ B.Infinite class RkPos (M : Matroid α) : Prop where empty_not_base : ¬M.Base ∅ theorem rkPos_iff_empty_not_base : M.RkPos ↔ ¬M.Base ∅ := ⟨fun ⟨h⟩ ↦ h, fun h ↦ ⟨h⟩⟩ section exchange namespace ExchangeProperty variable {Base : Set α → Prop} (exch : ExchangeProperty Base) theorem antichain (hB : Base B) (hB' : Base B') (h : B ⊆ B') : B = B' := h.antisymm (fun x hx ↦ by_contra (fun hxB ↦ let ⟨_, hy, _⟩ := exch B' B hB' hB x ⟨hx, hxB⟩; hy.2 <| h hy.1)) theorem encard_diff_le_aux (exch : ExchangeProperty Base) (hB₁ : Base B₁) (hB₂ : Base B₂) : (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard := by obtain (he | hinf | ⟨e, he, hcard⟩) := (B₂ \ B₁).eq_empty_or_encard_eq_top_or_encard_diff_singleton_lt · rw [exch.antichain hB₂ hB₁ (diff_eq_empty.mp he)] · exact le_top.trans_eq hinf.symm obtain ⟨f, hf, hB'⟩ := exch B₂ B₁ hB₂ hB₁ e he have : encard (insert f (B₂ \ {e}) \ B₁) < encard (B₂ \ B₁) := by rw [insert_diff_of_mem _ hf.1, diff_diff_comm]; exact hcard have hencard := encard_diff_le_aux exch hB₁ hB' rw [insert_diff_of_mem _ hf.1, diff_diff_comm, ← union_singleton, ← diff_diff, diff_diff_right, inter_singleton_eq_empty.mpr he.2, union_empty] at hencard rw [← encard_diff_singleton_add_one he, ← encard_diff_singleton_add_one hf] exact add_le_add_right hencard 1 termination_by (B₂ \ B₁).encard theorem encard_diff_eq (hB₁ : Base B₁) (hB₂ : Base B₂) : (B₁ \ B₂).encard = (B₂ \ B₁).encard := (encard_diff_le_aux exch hB₁ hB₂).antisymm (encard_diff_le_aux exch hB₂ hB₁)
Mathlib/Data/Matroid/Basic.lean
295
297
theorem encard_base_eq (hB₁ : Base B₁) (hB₂ : Base B₂) : B₁.encard = B₂.encard := by
rw [← encard_diff_add_encard_inter B₁ B₂, exch.encard_diff_eq hB₁ hB₂, inter_comm, encard_diff_add_encard_inter]
0
import Mathlib.Algebra.BigOperators.Finprod import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Topology.Compactness.Paracompact import Mathlib.Topology.ShrinkingLemma import Mathlib.Topology.UrysohnsLemma #align_import topology.partition_of_unity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" universe u v open Function Set Filter open scoped Classical open Topology noncomputable section structure PartitionOfUnity (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun sum_eq_one' : ∀ x ∈ s, ∑ᶠ i, toFun i x = 1 sum_le_one' : ∀ x, ∑ᶠ i, toFun i x ≤ 1 #align partition_of_unity PartitionOfUnity structure BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun le_one' : toFun ≤ 1 eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1 #align bump_covering BumpCovering variable {ι : Type u} {X : Type v} [TopologicalSpace X] namespace PartitionOfUnity variable {E : Type*} [AddCommMonoid E] [SMulWithZero ℝ E] [TopologicalSpace E] [ContinuousSMul ℝ E] {s : Set X} (f : PartitionOfUnity ι X s) instance : FunLike (PartitionOfUnity ι X s) ι C(X, ℝ) where coe := toFun coe_injective' := fun f g h ↦ by cases f; cases g; congr protected theorem locallyFinite : LocallyFinite fun i => support (f i) := f.locallyFinite' #align partition_of_unity.locally_finite PartitionOfUnity.locallyFinite theorem locallyFinite_tsupport : LocallyFinite fun i => tsupport (f i) := f.locallyFinite.closure #align partition_of_unity.locally_finite_tsupport PartitionOfUnity.locallyFinite_tsupport theorem nonneg (i : ι) (x : X) : 0 ≤ f i x := f.nonneg' i x #align partition_of_unity.nonneg PartitionOfUnity.nonneg theorem sum_eq_one {x : X} (hx : x ∈ s) : ∑ᶠ i, f i x = 1 := f.sum_eq_one' x hx #align partition_of_unity.sum_eq_one PartitionOfUnity.sum_eq_one theorem exists_pos {x : X} (hx : x ∈ s) : ∃ i, 0 < f i x := by have H := f.sum_eq_one hx contrapose! H simpa only [fun i => (H i).antisymm (f.nonneg i x), finsum_zero] using zero_ne_one #align partition_of_unity.exists_pos PartitionOfUnity.exists_pos theorem sum_le_one (x : X) : ∑ᶠ i, f i x ≤ 1 := f.sum_le_one' x #align partition_of_unity.sum_le_one PartitionOfUnity.sum_le_one theorem sum_nonneg (x : X) : 0 ≤ ∑ᶠ i, f i x := finsum_nonneg fun i => f.nonneg i x #align partition_of_unity.sum_nonneg PartitionOfUnity.sum_nonneg theorem le_one (i : ι) (x : X) : f i x ≤ 1 := (single_le_finsum i (f.locallyFinite.point_finite x) fun j => f.nonneg j x).trans (f.sum_le_one x) #align partition_of_unity.le_one PartitionOfUnity.le_one section fintsupport -- partitions of unity have locally finite `tsupport` variable {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X)
Mathlib/Topology/PartitionOfUnity.lean
229
234
theorem finite_tsupport : {i | x₀ ∈ tsupport (ρ i)}.Finite := by
rcases ρ.locallyFinite x₀ with ⟨t, t_in, ht⟩ apply ht.subset rintro i hi simp only [inter_comm] exact mem_closure_iff_nhds.mp hi t t_in
0
import Mathlib.Algebra.Homology.Homotopy import Mathlib.Algebra.Category.ModuleCat.Abelian import Mathlib.Algebra.Category.ModuleCat.Subobject import Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory #align_import algebra.homology.Module from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v u open scoped Classical noncomputable section open CategoryTheory Limits HomologicalComplex variable {R : Type v} [Ring R] variable {ι : Type*} {c : ComplexShape ι} {C D : HomologicalComplex (ModuleCat.{u} R) c} namespace ModuleCat theorem homology'_ext {L M N K : ModuleCat.{u} R} {f : L ⟶ M} {g : M ⟶ N} (w : f ≫ g = 0) {h k : homology' f g w ⟶ K} (w : ∀ x : LinearMap.ker g, h (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x)) = k (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x))) : h = k := by refine Concrete.cokernel_funext fun n => ?_ -- Porting note: as `equiv_rw` was not ported, it was replaced by `Equiv.surjective` -- Gosh it would be nice if `equiv_rw` could directly use an isomorphism, or an enriched `≃`. obtain ⟨n, rfl⟩ := (kernelSubobjectIso g ≪≫ ModuleCat.kernelIsoKer g).toLinearEquiv.toEquiv.symm.surjective n exact w n set_option linter.uppercaseLean3 false in #align Module.homology_ext ModuleCat.homology'_ext abbrev toCycles' {C : HomologicalComplex (ModuleCat.{u} R) c} {i : ι} (x : LinearMap.ker (C.dFrom i)) : (C.cycles' i : Type u) := toKernelSubobject x set_option linter.uppercaseLean3 false in #align Module.to_cycles ModuleCat.toCycles' @[ext] theorem cycles'_ext {C : HomologicalComplex (ModuleCat.{u} R) c} {i : ι} {x y : (C.cycles' i : Type u)} (w : (C.cycles' i).arrow x = (C.cycles' i).arrow y) : x = y := by apply_fun (C.cycles' i).arrow using (ModuleCat.mono_iff_injective _).mp (cycles' C i).arrow_mono exact w set_option linter.uppercaseLean3 false in #align Module.cycles_ext ModuleCat.cycles'_ext -- Porting note: both proofs by `rw` were proofs by `simp` which no longer worked -- see https://github.com/leanprover-community/mathlib4/issues/5026 @[simp]
Mathlib/Algebra/Homology/ModuleCat.lean
72
79
theorem cycles'Map_toCycles' (f : C ⟶ D) {i : ι} (x : LinearMap.ker (C.dFrom i)) : (cycles'Map f i) (toCycles' x) = toCycles' ⟨f.f i x.1, by -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 rw [LinearMap.mem_ker]; erw [Hom.comm_from_apply, x.2, map_zero]⟩ := by
ext -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [cycles'Map_arrow_apply, toKernelSubobject_arrow, toKernelSubobject_arrow] rfl
0
import Mathlib.Analysis.Analytic.Linear import Mathlib.Analysis.Analytic.Composition import Mathlib.Analysis.NormedSpace.Completion #align_import analysis.analytic.uniqueness from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] open Set open scoped Topology ENNReal namespace AnalyticOn theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux [CompleteSpace F] {f : E → F} {U : Set E} (hf : AnalyticOn 𝕜 f U) (hU : IsPreconnected U) {z₀ : E} (h₀ : z₀ ∈ U) (hfz₀ : f =ᶠ[𝓝 z₀] 0) : EqOn f 0 U := by let u := {x | f =ᶠ[𝓝 x] 0} suffices main : closure u ∩ U ⊆ u by have Uu : U ⊆ u := hU.subset_of_closure_inter_subset isOpen_setOf_eventually_nhds ⟨z₀, h₀, hfz₀⟩ main intro z hz simpa using mem_of_mem_nhds (Uu hz) rintro x ⟨xu, xU⟩ rcases hf x xU with ⟨p, r, hp⟩ obtain ⟨y, yu, hxy⟩ : ∃ y ∈ u, edist x y < r / 2 := EMetric.mem_closure_iff.1 xu (r / 2) (ENNReal.half_pos hp.r_pos.ne') let q := p.changeOrigin (y - x) have has_series : HasFPowerSeriesOnBall f q y (r / 2) := by have A : (‖y - x‖₊ : ℝ≥0∞) < r / 2 := by rwa [edist_comm, edist_eq_coe_nnnorm_sub] at hxy have := hp.changeOrigin (A.trans_le ENNReal.half_le_self) simp only [add_sub_cancel] at this apply this.mono (ENNReal.half_pos hp.r_pos.ne') apply ENNReal.le_sub_of_add_le_left ENNReal.coe_ne_top apply (add_le_add A.le (le_refl (r / 2))).trans (le_of_eq _) exact ENNReal.add_halves _ have M : EMetric.ball y (r / 2) ∈ 𝓝 x := EMetric.isOpen_ball.mem_nhds hxy filter_upwards [M] with z hz have A : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) (f z) := has_series.hasSum_sub hz have B : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) 0 := by have : HasFPowerSeriesAt 0 q y := has_series.hasFPowerSeriesAt.congr yu convert hasSum_zero (α := F) using 2 ext n exact this.apply_eq_zero n _ exact HasSum.unique A B #align analytic_on.eq_on_zero_of_preconnected_of_eventually_eq_zero_aux AnalyticOn.eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero {f : E → F} {U : Set E} (hf : AnalyticOn 𝕜 f U) (hU : IsPreconnected U) {z₀ : E} (h₀ : z₀ ∈ U) (hfz₀ : f =ᶠ[𝓝 z₀] 0) : EqOn f 0 U := by let F' := UniformSpace.Completion F set e : F →L[𝕜] F' := UniformSpace.Completion.toComplL have : AnalyticOn 𝕜 (e ∘ f) U := fun x hx => (e.analyticAt _).comp (hf x hx) have A : EqOn (e ∘ f) 0 U := by apply eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux this hU h₀ filter_upwards [hfz₀] with x hx simp only [hx, Function.comp_apply, Pi.zero_apply, map_zero] intro z hz have : e (f z) = e 0 := by simpa only using A hz exact UniformSpace.Completion.coe_injective F this #align analytic_on.eq_on_zero_of_preconnected_of_eventually_eq_zero AnalyticOn.eqOn_zero_of_preconnected_of_eventuallyEq_zero
Mathlib/Analysis/Analytic/Uniqueness.lean
96
101
theorem eqOn_of_preconnected_of_eventuallyEq {f g : E → F} {U : Set E} (hf : AnalyticOn 𝕜 f U) (hg : AnalyticOn 𝕜 g U) (hU : IsPreconnected U) {z₀ : E} (h₀ : z₀ ∈ U) (hfg : f =ᶠ[𝓝 z₀] g) : EqOn f g U := by
have hfg' : f - g =ᶠ[𝓝 z₀] 0 := hfg.mono fun z h => by simp [h] simpa [sub_eq_zero] using fun z hz => (hf.sub hg).eqOn_zero_of_preconnected_of_eventuallyEq_zero hU h₀ hfg' hz
0
import Mathlib.Algebra.Field.ULift import Mathlib.Algebra.MvPolynomial.Cardinal import Mathlib.Data.Nat.Factorization.PrimePow import Mathlib.Data.Rat.Denumerable import Mathlib.FieldTheory.Finite.GaloisField import Mathlib.Logic.Equiv.TransferInstance import Mathlib.RingTheory.Localization.Cardinality import Mathlib.SetTheory.Cardinal.Divisibility #align_import field_theory.cardinality from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" local notation "‖" x "‖" => Fintype.card x open scoped Cardinal nonZeroDivisors universe u theorem Fintype.isPrimePow_card_of_field {α} [Fintype α] [Field α] : IsPrimePow ‖α‖ := by -- TODO: `Algebra` version of `CharP.exists`, of type `∀ p, Algebra (ZMod p) α` cases' CharP.exists α with p _ haveI hp := Fact.mk (CharP.char_is_prime α p) letI : Algebra (ZMod p) α := ZMod.algebra _ _ let b := IsNoetherian.finsetBasis (ZMod p) α rw [Module.card_fintype b, ZMod.card, isPrimePow_pow_iff] · exact hp.1.isPrimePow rw [← FiniteDimensional.finrank_eq_card_basis b] exact FiniteDimensional.finrank_pos.ne' #align fintype.is_prime_pow_card_of_field Fintype.isPrimePow_card_of_field theorem Fintype.nonempty_field_iff {α} [Fintype α] : Nonempty (Field α) ↔ IsPrimePow ‖α‖ := by refine ⟨fun ⟨h⟩ => Fintype.isPrimePow_card_of_field, ?_⟩ rintro ⟨p, n, hp, hn, hα⟩ haveI := Fact.mk hp.nat_prime exact ⟨(Fintype.equivOfCardEq ((GaloisField.card p n hn.ne').trans hα)).symm.field⟩ #align fintype.nonempty_field_iff Fintype.nonempty_field_iff theorem Fintype.not_isField_of_card_not_prime_pow {α} [Fintype α] [Ring α] : ¬IsPrimePow ‖α‖ → ¬IsField α := mt fun h => Fintype.nonempty_field_iff.mp ⟨h.toField⟩ #align fintype.not_is_field_of_card_not_prime_pow Fintype.not_isField_of_card_not_prime_pow
Mathlib/FieldTheory/Cardinality.lean
66
76
theorem Infinite.nonempty_field {α : Type u} [Infinite α] : Nonempty (Field α) := by
letI K := FractionRing (MvPolynomial α <| ULift.{u} ℚ) suffices #α = #K by obtain ⟨e⟩ := Cardinal.eq.1 this exact ⟨e.field⟩ rw [← IsLocalization.card (MvPolynomial α <| ULift.{u} ℚ)⁰ K le_rfl] apply le_antisymm · refine ⟨⟨fun a => MvPolynomial.monomial (Finsupp.single a 1) (1 : ULift.{u} ℚ), fun x y h => ?_⟩⟩ simpa [MvPolynomial.monomial_eq_monomial_iff, Finsupp.single_eq_single_iff] using h · simp
0
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic #align_import number_theory.legendre_symbol.basic from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" open Nat section Euler namespace ZMod variable (p : ℕ) [Fact p.Prime] theorem euler_criterion_units (x : (ZMod p)ˣ) : (∃ y : (ZMod p)ˣ, y ^ 2 = x) ↔ x ^ (p / 2) = 1 := by by_cases hc : p = 2 · subst hc simp only [eq_iff_true_of_subsingleton, exists_const] · have h₀ := FiniteField.unit_isSquare_iff (by rwa [ringChar_zmod_n]) x have hs : (∃ y : (ZMod p)ˣ, y ^ 2 = x) ↔ IsSquare x := by rw [isSquare_iff_exists_sq x] simp_rw [eq_comm] rw [hs] rwa [card p] at h₀ #align zmod.euler_criterion_units ZMod.euler_criterion_units
Mathlib/NumberTheory/LegendreSymbol/Basic.lean
61
70
theorem euler_criterion {a : ZMod p} (ha : a ≠ 0) : IsSquare (a : ZMod p) ↔ a ^ (p / 2) = 1 := by
apply (iff_congr _ (by simp [Units.ext_iff])).mp (euler_criterion_units p (Units.mk0 a ha)) simp only [Units.ext_iff, sq, Units.val_mk0, Units.val_mul] constructor · rintro ⟨y, hy⟩; exact ⟨y, hy.symm⟩ · rintro ⟨y, rfl⟩ have hy : y ≠ 0 := by rintro rfl simp [zero_pow, mul_zero, ne_eq, not_true] at ha refine ⟨Units.mk0 y hy, ?_⟩; simp
0
import Mathlib.AlgebraicTopology.DoldKan.Faces import Mathlib.CategoryTheory.Idempotents.Basic #align_import algebraic_topology.dold_kan.projections from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive CategoryTheory.SimplicialObject Opposite CategoryTheory.Idempotents open Simplicial DoldKan noncomputable section namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] {X : SimplicialObject C} noncomputable def P : ℕ → (K[X] ⟶ K[X]) | 0 => 𝟙 _ | q + 1 => P q ≫ (𝟙 _ + Hσ q) set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.P AlgebraicTopology.DoldKan.P -- Porting note: `P_zero` and `P_succ` have been added to ease the port, because -- `unfold P` would sometimes unfold to a `match` rather than the induction formula lemma P_zero : (P 0 : K[X] ⟶ K[X]) = 𝟙 _ := rfl lemma P_succ (q : ℕ) : (P (q+1) : K[X] ⟶ K[X]) = P q ≫ (𝟙 _ + Hσ q) := rfl @[simp] theorem P_f_0_eq (q : ℕ) : ((P q).f 0 : X _[0] ⟶ X _[0]) = 𝟙 _ := by induction' q with q hq · rfl · simp only [P_succ, HomologicalComplex.add_f_apply, HomologicalComplex.comp_f, HomologicalComplex.id_f, id_comp, hq, Hσ_eq_zero, add_zero] set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.P_f_0_eq AlgebraicTopology.DoldKan.P_f_0_eq def Q (q : ℕ) : K[X] ⟶ K[X] := 𝟙 _ - P q set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.Q AlgebraicTopology.DoldKan.Q theorem P_add_Q (q : ℕ) : P q + Q q = 𝟙 K[X] := by rw [Q] abel set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.P_add_Q AlgebraicTopology.DoldKan.P_add_Q theorem P_add_Q_f (q n : ℕ) : (P q).f n + (Q q).f n = 𝟙 (X _[n]) := HomologicalComplex.congr_hom (P_add_Q q) n set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.P_add_Q_f AlgebraicTopology.DoldKan.P_add_Q_f @[simp] theorem Q_zero : (Q 0 : K[X] ⟶ _) = 0 := sub_self _ set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.Q_eq_zero AlgebraicTopology.DoldKan.Q_zero theorem Q_succ (q : ℕ) : (Q (q + 1) : K[X] ⟶ _) = Q q - P q ≫ Hσ q := by simp only [Q, P_succ, comp_add, comp_id] abel set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.Q_eq AlgebraicTopology.DoldKan.Q_succ @[simp] theorem Q_f_0_eq (q : ℕ) : ((Q q).f 0 : X _[0] ⟶ X _[0]) = 0 := by simp only [HomologicalComplex.sub_f_apply, HomologicalComplex.id_f, Q, P_f_0_eq, sub_self] set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.Q_f_0_eq AlgebraicTopology.DoldKan.Q_f_0_eq namespace HigherFacesVanish theorem of_P : ∀ q n : ℕ, HigherFacesVanish q ((P q).f (n + 1) : X _[n + 1] ⟶ X _[n + 1]) | 0 => fun n j hj₁ => by omega | q + 1 => fun n => by simp only [P_succ] exact (of_P q n).induction set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.higher_faces_vanish.of_P AlgebraicTopology.DoldKan.HigherFacesVanish.of_P @[reassoc]
Mathlib/AlgebraicTopology/DoldKan/Projections.lean
118
134
theorem comp_P_eq_self {Y : C} {n q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) : φ ≫ (P q).f (n + 1) = φ := by
induction' q with q hq · simp only [P_zero] apply comp_id · simp only [P_succ, comp_add, HomologicalComplex.comp_f, HomologicalComplex.add_f_apply, comp_id, ← assoc, hq v.of_succ, add_right_eq_self] by_cases hqn : n < q · exact v.of_succ.comp_Hσ_eq_zero hqn · obtain ⟨a, ha⟩ := Nat.le.dest (not_lt.mp hqn) have hnaq : n = a + q := by omega simp only [v.of_succ.comp_Hσ_eq hnaq, neg_eq_zero, ← assoc] have eq := v ⟨a, by omega⟩ (by simp only [hnaq, Nat.succ_eq_add_one, add_assoc] rfl) simp only [Fin.succ_mk] at eq simp only [eq, zero_comp]
0
import Mathlib.CategoryTheory.Limits.Shapes.CommSq import Mathlib.CategoryTheory.Limits.Shapes.StrictInitial import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.Topology.Category.TopCat.Limits.Pullbacks import Mathlib.CategoryTheory.Limits.FunctorCategory import Mathlib.CategoryTheory.Limits.Constructions.FiniteProductsOfBinaryProducts import Mathlib.CategoryTheory.Limits.VanKampen #align_import category_theory.extensive from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" open CategoryTheory.Limits namespace CategoryTheory universe v' u' v u v'' u'' variable {J : Type v'} [Category.{u'} J] {C : Type u} [Category.{v} C] variable {D : Type u''} [Category.{v''} D] section Extensive variable {X Y : C} class HasPullbacksOfInclusions (C : Type u) [Category.{v} C] [HasBinaryCoproducts C] : Prop where [hasPullbackInl : ∀ {X Y Z : C} (f : Z ⟶ X ⨿ Y), HasPullback coprod.inl f] attribute [instance] HasPullbacksOfInclusions.hasPullbackInl class PreservesPullbacksOfInclusions {C : Type*} [Category C] {D : Type*} [Category D] (F : C ⥤ D) [HasBinaryCoproducts C] where [preservesPullbackInl : ∀ {X Y Z : C} (f : Z ⟶ X ⨿ Y), PreservesLimit (cospan coprod.inl f) F] attribute [instance] PreservesPullbacksOfInclusions.preservesPullbackInl class FinitaryPreExtensive (C : Type u) [Category.{v} C] : Prop where [hasFiniteCoproducts : HasFiniteCoproducts C] [hasPullbacksOfInclusions : HasPullbacksOfInclusions C] universal' : ∀ {X Y : C} (c : BinaryCofan X Y), IsColimit c → IsUniversalColimit c attribute [instance] FinitaryPreExtensive.hasFiniteCoproducts attribute [instance] FinitaryPreExtensive.hasPullbacksOfInclusions class FinitaryExtensive (C : Type u) [Category.{v} C] : Prop where [hasFiniteCoproducts : HasFiniteCoproducts C] [hasPullbacksOfInclusions : HasPullbacksOfInclusions C] van_kampen' : ∀ {X Y : C} (c : BinaryCofan X Y), IsColimit c → IsVanKampenColimit c #align category_theory.finitary_extensive CategoryTheory.FinitaryExtensive attribute [instance] FinitaryExtensive.hasFiniteCoproducts attribute [instance] FinitaryExtensive.hasPullbacksOfInclusions theorem FinitaryExtensive.vanKampen [FinitaryExtensive C] {F : Discrete WalkingPair ⥤ C} (c : Cocone F) (hc : IsColimit c) : IsVanKampenColimit c := by let X := F.obj ⟨WalkingPair.left⟩ let Y := F.obj ⟨WalkingPair.right⟩ have : F = pair X Y := by apply Functor.hext · rintro ⟨⟨⟩⟩ <;> rfl · rintro ⟨⟨⟩⟩ ⟨j⟩ ⟨⟨rfl : _ = j⟩⟩ <;> simp clear_value X Y subst this exact FinitaryExtensive.van_kampen' c hc #align category_theory.finitary_extensive.van_kampen CategoryTheory.FinitaryExtensive.vanKampen instance (priority := 100) FinitaryExtensive.toFinitaryPreExtensive [FinitaryExtensive C] : FinitaryPreExtensive C := ⟨fun c hc ↦ (FinitaryExtensive.van_kampen' c hc).isUniversal⟩ theorem FinitaryExtensive.mono_inr_of_isColimit [FinitaryExtensive C] {c : BinaryCofan X Y} (hc : IsColimit c) : Mono c.inr := BinaryCofan.mono_inr_of_isVanKampen (FinitaryExtensive.vanKampen c hc) #align category_theory.finitary_extensive.mono_inr_of_is_colimit CategoryTheory.FinitaryExtensive.mono_inr_of_isColimit theorem FinitaryExtensive.mono_inl_of_isColimit [FinitaryExtensive C] {c : BinaryCofan X Y} (hc : IsColimit c) : Mono c.inl := FinitaryExtensive.mono_inr_of_isColimit (BinaryCofan.isColimitFlip hc) #align category_theory.finitary_extensive.mono_inl_of_is_colimit CategoryTheory.FinitaryExtensive.mono_inl_of_isColimit instance [FinitaryExtensive C] (X Y : C) : Mono (coprod.inl : X ⟶ X ⨿ Y) := (FinitaryExtensive.mono_inl_of_isColimit (coprodIsCoprod X Y) : _) instance [FinitaryExtensive C] (X Y : C) : Mono (coprod.inr : Y ⟶ X ⨿ Y) := (FinitaryExtensive.mono_inr_of_isColimit (coprodIsCoprod X Y) : _) theorem FinitaryExtensive.isPullback_initial_to_binaryCofan [FinitaryExtensive C] {c : BinaryCofan X Y} (hc : IsColimit c) : IsPullback (initial.to _) (initial.to _) c.inl c.inr := BinaryCofan.isPullback_initial_to_of_isVanKampen (FinitaryExtensive.vanKampen c hc) #align category_theory.finitary_extensive.is_pullback_initial_to_binary_cofan CategoryTheory.FinitaryExtensive.isPullback_initial_to_binaryCofan instance (priority := 100) hasStrictInitialObjects_of_finitaryPreExtensive [FinitaryPreExtensive C] : HasStrictInitialObjects C := hasStrictInitial_of_isUniversal (FinitaryPreExtensive.universal' _ ((BinaryCofan.isColimit_iff_isIso_inr initialIsInitial _).mpr (by dsimp infer_instance)).some) #align category_theory.has_strict_initial_objects_of_finitary_extensive CategoryTheory.hasStrictInitialObjects_of_finitaryPreExtensive
Mathlib/CategoryTheory/Extensive.lean
203
216
theorem finitaryExtensive_iff_of_isTerminal (C : Type u) [Category.{v} C] [HasFiniteCoproducts C] [HasPullbacksOfInclusions C] (T : C) (HT : IsTerminal T) (c₀ : BinaryCofan T T) (hc₀ : IsColimit c₀) : FinitaryExtensive C ↔ IsVanKampenColimit c₀ := by
refine ⟨fun H => H.van_kampen' c₀ hc₀, fun H => ?_⟩ constructor simp_rw [BinaryCofan.isVanKampen_iff] at H ⊢ intro X Y c hc X' Y' c' αX αY f hX hY obtain ⟨d, hd, hd'⟩ := Limits.BinaryCofan.IsColimit.desc' hc (HT.from _ ≫ c₀.inl) (HT.from _ ≫ c₀.inr) rw [H c' (αX ≫ HT.from _) (αY ≫ HT.from _) (f ≫ d) (by rw [← reassoc_of% hX, hd, Category.assoc]) (by rw [← reassoc_of% hY, hd', Category.assoc])] obtain ⟨hl, hr⟩ := (H c (HT.from _) (HT.from _) d hd.symm hd'.symm).mp ⟨hc⟩ rw [hl.paste_vert_iff hX.symm, hr.paste_vert_iff hY.symm]
0
import Mathlib.Analysis.Seminorm import Mathlib.Topology.Algebra.Equicontinuity import Mathlib.Topology.MetricSpace.Equicontinuity import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.Module.LocallyConvex #align_import analysis.locally_convex.with_seminorms from "leanprover-community/mathlib"@"b31173ee05c911d61ad6a05bd2196835c932e0ec" open NormedField Set Seminorm TopologicalSpace Filter List open NNReal Pointwise Topology Uniformity variable {𝕜 𝕜₂ 𝕝 𝕝₂ E F G ι ι' : Type*} section FilterBasis variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable (𝕜 E ι) abbrev SeminormFamily := ι → Seminorm 𝕜 E #align seminorm_family SeminormFamily variable {𝕜 E ι} namespace SeminormFamily def basisSets (p : SeminormFamily 𝕜 E ι) : Set (Set E) := ⋃ (s : Finset ι) (r) (_ : 0 < r), singleton (ball (s.sup p) (0 : E) r) #align seminorm_family.basis_sets SeminormFamily.basisSets variable (p : SeminormFamily 𝕜 E ι) theorem basisSets_iff {U : Set E} : U ∈ p.basisSets ↔ ∃ (i : Finset ι) (r : ℝ), 0 < r ∧ U = ball (i.sup p) 0 r := by simp only [basisSets, mem_iUnion, exists_prop, mem_singleton_iff] #align seminorm_family.basis_sets_iff SeminormFamily.basisSets_iff theorem basisSets_mem (i : Finset ι) {r : ℝ} (hr : 0 < r) : (i.sup p).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨i, _, hr, rfl⟩ #align seminorm_family.basis_sets_mem SeminormFamily.basisSets_mem theorem basisSets_singleton_mem (i : ι) {r : ℝ} (hr : 0 < r) : (p i).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨{i}, _, hr, by rw [Finset.sup_singleton]⟩ #align seminorm_family.basis_sets_singleton_mem SeminormFamily.basisSets_singleton_mem theorem basisSets_nonempty [Nonempty ι] : p.basisSets.Nonempty := by let i := Classical.arbitrary ι refine nonempty_def.mpr ⟨(p i).ball 0 1, ?_⟩ exact p.basisSets_singleton_mem i zero_lt_one #align seminorm_family.basis_sets_nonempty SeminormFamily.basisSets_nonempty
Mathlib/Analysis/LocallyConvex/WithSeminorms.lean
98
112
theorem basisSets_intersect (U V : Set E) (hU : U ∈ p.basisSets) (hV : V ∈ p.basisSets) : ∃ z ∈ p.basisSets, z ⊆ U ∩ V := by
classical rcases p.basisSets_iff.mp hU with ⟨s, r₁, hr₁, hU⟩ rcases p.basisSets_iff.mp hV with ⟨t, r₂, hr₂, hV⟩ use ((s ∪ t).sup p).ball 0 (min r₁ r₂) refine ⟨p.basisSets_mem (s ∪ t) (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ?_⟩ rw [hU, hV, ball_finset_sup_eq_iInter _ _ _ (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ball_finset_sup_eq_iInter _ _ _ hr₁, ball_finset_sup_eq_iInter _ _ _ hr₂] exact Set.subset_inter (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_left hi, ball_mono <| min_le_left _ _⟩) (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_right hi, ball_mono <| min_le_right _ _⟩)
0
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec" noncomputable section open AddCommGroup Set Function AddSubgroup TopologicalSpace open Topology variable {𝕜 B : Type*} @[nolint unusedArguments] abbrev AddCircle [LinearOrderedAddCommGroup 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] (p : 𝕜) := 𝕜 ⧸ zmultiples p #align add_circle AddCircle namespace AddCircle section LinearOrderedAddCommGroup variable [LinearOrderedAddCommGroup 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] (p : 𝕜) theorem coe_nsmul {n : ℕ} {x : 𝕜} : (↑(n • x) : AddCircle p) = n • (x : AddCircle p) := rfl #align add_circle.coe_nsmul AddCircle.coe_nsmul theorem coe_zsmul {n : ℤ} {x : 𝕜} : (↑(n • x) : AddCircle p) = n • (x : AddCircle p) := rfl #align add_circle.coe_zsmul AddCircle.coe_zsmul theorem coe_add (x y : 𝕜) : (↑(x + y) : AddCircle p) = (x : AddCircle p) + (y : AddCircle p) := rfl #align add_circle.coe_add AddCircle.coe_add theorem coe_sub (x y : 𝕜) : (↑(x - y) : AddCircle p) = (x : AddCircle p) - (y : AddCircle p) := rfl #align add_circle.coe_sub AddCircle.coe_sub theorem coe_neg {x : 𝕜} : (↑(-x) : AddCircle p) = -(x : AddCircle p) := rfl #align add_circle.coe_neg AddCircle.coe_neg theorem coe_eq_zero_iff {x : 𝕜} : (x : AddCircle p) = 0 ↔ ∃ n : ℤ, n • p = x := by simp [AddSubgroup.mem_zmultiples_iff] #align add_circle.coe_eq_zero_iff AddCircle.coe_eq_zero_iff theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) : (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by rw [coe_eq_zero_iff] constructor <;> rintro ⟨n, rfl⟩ · replace hx : 0 < n := by contrapose! hx simpa only [← neg_nonneg, ← zsmul_neg, zsmul_neg'] using zsmul_nonneg hp.le (neg_nonneg.2 hx) exact ⟨n.toNat, by rw [← natCast_zsmul, Int.toNat_of_nonneg hx.le]⟩ · exact ⟨(n : ℤ), by simp⟩ #align add_circle.coe_eq_zero_of_pos_iff AddCircle.coe_eq_zero_of_pos_iff theorem coe_period : (p : AddCircle p) = 0 := (QuotientAddGroup.eq_zero_iff p).2 <| mem_zmultiples p #align add_circle.coe_period AddCircle.coe_period theorem coe_add_period (x : 𝕜) : ((x + p : 𝕜) : AddCircle p) = x := by rw [coe_add, ← eq_sub_iff_add_eq', sub_self, coe_period] #align add_circle.coe_add_period AddCircle.coe_add_period @[continuity, nolint unusedArguments] protected theorem continuous_mk' : Continuous (QuotientAddGroup.mk' (zmultiples p) : 𝕜 → AddCircle p) := continuous_coinduced_rng #align add_circle.continuous_mk' AddCircle.continuous_mk' variable [hp : Fact (0 < p)] (a : 𝕜) [Archimedean 𝕜] def equivIco : AddCircle p ≃ Ico a (a + p) := QuotientAddGroup.equivIcoMod hp.out a #align add_circle.equiv_Ico AddCircle.equivIco def equivIoc : AddCircle p ≃ Ioc a (a + p) := QuotientAddGroup.equivIocMod hp.out a #align add_circle.equiv_Ioc AddCircle.equivIoc def liftIco (f : 𝕜 → B) : AddCircle p → B := restrict _ f ∘ AddCircle.equivIco p a #align add_circle.lift_Ico AddCircle.liftIco def liftIoc (f : 𝕜 → B) : AddCircle p → B := restrict _ f ∘ AddCircle.equivIoc p a #align add_circle.lift_Ioc AddCircle.liftIoc variable {p a}
Mathlib/Topology/Instances/AddCircle.lean
213
219
theorem coe_eq_coe_iff_of_mem_Ico {x y : 𝕜} (hx : x ∈ Ico a (a + p)) (hy : y ∈ Ico a (a + p)) : (x : AddCircle p) = y ↔ x = y := by
refine ⟨fun h => ?_, by tauto⟩ suffices (⟨x, hx⟩ : Ico a (a + p)) = ⟨y, hy⟩ by exact Subtype.mk.inj this apply_fun equivIco p a at h rw [← (equivIco p a).right_inv ⟨x, hx⟩, ← (equivIco p a).right_inv ⟨y, hy⟩] exact h
0
import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.Polynomial.Basic import Mathlib.Algebra.Regular.Basic import Mathlib.Data.Nat.Choose.Sum #align_import data.polynomial.coeff from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c" set_option linter.uppercaseLean3 false noncomputable section open Finsupp Finset AddMonoidAlgebra open Polynomial namespace Polynomial universe u v variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ} variable [Semiring R] {p q r : R[X]} section Coeff @[simp] theorem coeff_add (p q : R[X]) (n : ℕ) : coeff (p + q) n = coeff p n + coeff q n := by rcases p with ⟨⟩ rcases q with ⟨⟩ simp_rw [← ofFinsupp_add, coeff] exact Finsupp.add_apply _ _ _ #align polynomial.coeff_add Polynomial.coeff_add set_option linter.deprecated false in @[simp] theorem coeff_bit0 (p : R[X]) (n : ℕ) : coeff (bit0 p) n = bit0 (coeff p n) := by simp [bit0] #align polynomial.coeff_bit0 Polynomial.coeff_bit0 @[simp] theorem coeff_smul [SMulZeroClass S R] (r : S) (p : R[X]) (n : ℕ) : coeff (r • p) n = r • coeff p n := by rcases p with ⟨⟩ simp_rw [← ofFinsupp_smul, coeff] exact Finsupp.smul_apply _ _ _ #align polynomial.coeff_smul Polynomial.coeff_smul theorem support_smul [SMulZeroClass S R] (r : S) (p : R[X]) : support (r • p) ⊆ support p := by intro i hi simp? [mem_support_iff] at hi ⊢ says simp only [mem_support_iff, coeff_smul, ne_eq] at hi ⊢ contrapose! hi simp [hi] #align polynomial.support_smul Polynomial.support_smul open scoped Pointwise in theorem card_support_mul_le : (p * q).support.card ≤ p.support.card * q.support.card := by calc (p * q).support.card _ = (p.toFinsupp * q.toFinsupp).support.card := by rw [← support_toFinsupp, toFinsupp_mul] _ ≤ (p.toFinsupp.support + q.toFinsupp.support).card := Finset.card_le_card (AddMonoidAlgebra.support_mul p.toFinsupp q.toFinsupp) _ ≤ p.support.card * q.support.card := Finset.card_image₂_le .. @[simps] def lsum {R A M : Type*} [Semiring R] [Semiring A] [AddCommMonoid M] [Module R A] [Module R M] (f : ℕ → A →ₗ[R] M) : A[X] →ₗ[R] M where toFun p := p.sum (f · ·) map_add' p q := sum_add_index p q _ (fun n => (f n).map_zero) fun n _ _ => (f n).map_add _ _ map_smul' c p := by -- Porting note: added `dsimp only`; `beta_reduce` alone is not sufficient dsimp only rw [sum_eq_of_subset (f · ·) (fun n => (f n).map_zero) (support_smul c p)] simp only [sum_def, Finset.smul_sum, coeff_smul, LinearMap.map_smul, RingHom.id_apply] #align polynomial.lsum Polynomial.lsum #align polynomial.lsum_apply Polynomial.lsum_apply variable (R) def lcoeff (n : ℕ) : R[X] →ₗ[R] R where toFun p := coeff p n map_add' p q := coeff_add p q n map_smul' r p := coeff_smul r p n #align polynomial.lcoeff Polynomial.lcoeff variable {R} @[simp] theorem lcoeff_apply (n : ℕ) (f : R[X]) : lcoeff R n f = coeff f n := rfl #align polynomial.lcoeff_apply Polynomial.lcoeff_apply @[simp] theorem finset_sum_coeff {ι : Type*} (s : Finset ι) (f : ι → R[X]) (n : ℕ) : coeff (∑ b ∈ s, f b) n = ∑ b ∈ s, coeff (f b) n := map_sum (lcoeff R n) _ _ #align polynomial.finset_sum_coeff Polynomial.finset_sum_coeff lemma coeff_list_sum (l : List R[X]) (n : ℕ) : l.sum.coeff n = (l.map (lcoeff R n)).sum := map_list_sum (lcoeff R n) _ lemma coeff_list_sum_map {ι : Type*} (l : List ι) (f : ι → R[X]) (n : ℕ) : (l.map f).sum.coeff n = (l.map (fun a => (f a).coeff n)).sum := by simp_rw [coeff_list_sum, List.map_map, Function.comp, lcoeff_apply] theorem coeff_sum [Semiring S] (n : ℕ) (f : ℕ → R → S[X]) : coeff (p.sum f) n = p.sum fun a b => coeff (f a b) n := by rcases p with ⟨⟩ -- porting note (#10745): was `simp [Polynomial.sum, support, coeff]`. simp [Polynomial.sum, support_ofFinsupp, coeff_ofFinsupp] #align polynomial.coeff_sum Polynomial.coeff_sum
Mathlib/Algebra/Polynomial/Coeff.lean
130
134
theorem coeff_mul (p q : R[X]) (n : ℕ) : coeff (p * q) n = ∑ x ∈ antidiagonal n, coeff p x.1 * coeff q x.2 := by
rcases p with ⟨p⟩; rcases q with ⟨q⟩ simp_rw [← ofFinsupp_mul, coeff] exact AddMonoidAlgebra.mul_apply_antidiagonal p q n _ Finset.mem_antidiagonal
0
import Mathlib.AlgebraicGeometry.Gluing import Mathlib.CategoryTheory.Limits.Opposites import Mathlib.AlgebraicGeometry.AffineScheme import Mathlib.CategoryTheory.Limits.Shapes.Diagonal #align_import algebraic_geometry.pullbacks from "leanprover-community/mathlib"@"7316286ff2942aa14e540add9058c6b0aa1c8070" set_option linter.uppercaseLean3 false universe v u noncomputable section open CategoryTheory CategoryTheory.Limits AlgebraicGeometry namespace AlgebraicGeometry.Scheme namespace Pullback variable {C : Type u} [Category.{v} C] variable {X Y Z : Scheme.{u}} (𝒰 : OpenCover.{u} X) (f : X ⟶ Z) (g : Y ⟶ Z) variable [∀ i, HasPullback (𝒰.map i ≫ f) g] def v (i j : 𝒰.J) : Scheme := pullback ((pullback.fst : pullback (𝒰.map i ≫ f) g ⟶ _) ≫ 𝒰.map i) (𝒰.map j) #align algebraic_geometry.Scheme.pullback.V AlgebraicGeometry.Scheme.Pullback.v def t (i j : 𝒰.J) : v 𝒰 f g i j ⟶ v 𝒰 f g j i := by have : HasPullback (pullback.snd ≫ 𝒰.map i ≫ f) g := hasPullback_assoc_symm (𝒰.map j) (𝒰.map i) (𝒰.map i ≫ f) g have : HasPullback (pullback.snd ≫ 𝒰.map j ≫ f) g := hasPullback_assoc_symm (𝒰.map i) (𝒰.map j) (𝒰.map j ≫ f) g refine (pullbackSymmetry ..).hom ≫ (pullbackAssoc ..).inv ≫ ?_ refine ?_ ≫ (pullbackAssoc ..).hom ≫ (pullbackSymmetry ..).hom refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (𝟙 _) (𝟙 _) ?_ ?_ · rw [pullbackSymmetry_hom_comp_snd_assoc, pullback.condition_assoc, Category.comp_id] · rw [Category.comp_id, Category.id_comp] #align algebraic_geometry.Scheme.pullback.t AlgebraicGeometry.Scheme.Pullback.t @[simp, reassoc] theorem t_fst_fst (i j : 𝒰.J) : t 𝒰 f g i j ≫ pullback.fst ≫ pullback.fst = pullback.snd := by simp only [t, Category.assoc, pullbackSymmetry_hom_comp_fst_assoc, pullbackAssoc_hom_snd_fst, pullback.lift_fst_assoc, pullbackSymmetry_hom_comp_snd, pullbackAssoc_inv_fst_fst, pullbackSymmetry_hom_comp_fst] #align algebraic_geometry.Scheme.pullback.t_fst_fst AlgebraicGeometry.Scheme.Pullback.t_fst_fst @[simp, reassoc] theorem t_fst_snd (i j : 𝒰.J) : t 𝒰 f g i j ≫ pullback.fst ≫ pullback.snd = pullback.fst ≫ pullback.snd := by simp only [t, Category.assoc, pullbackSymmetry_hom_comp_fst_assoc, pullbackAssoc_hom_snd_snd, pullback.lift_snd, Category.comp_id, pullbackAssoc_inv_snd, pullbackSymmetry_hom_comp_snd_assoc] #align algebraic_geometry.Scheme.pullback.t_fst_snd AlgebraicGeometry.Scheme.Pullback.t_fst_snd @[simp, reassoc]
Mathlib/AlgebraicGeometry/Pullbacks.lean
78
81
theorem t_snd (i j : 𝒰.J) : t 𝒰 f g i j ≫ pullback.snd = pullback.fst ≫ pullback.fst := by
simp only [t, Category.assoc, pullbackSymmetry_hom_comp_snd, pullbackAssoc_hom_fst, pullback.lift_fst_assoc, pullbackSymmetry_hom_comp_fst, pullbackAssoc_inv_fst_snd, pullbackSymmetry_hom_comp_snd_assoc]
0
import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open FiniteDimensional MeasureTheory MeasureTheory.Measure Set variable {ι E F : Type*} variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] section variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)]
Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean
34
43
theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n)) (b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by
have e : ι ≃ Fin n := by refine Fintype.equivFinOfCardEq ?_ rw [← _i.out, finrank_eq_card_basis b.toBasis] have A : ⇑b = b.reindex e ∘ e := by ext x simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply] rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped, o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one]
0
import Mathlib.Algebra.Category.Ring.FilteredColimits import Mathlib.Geometry.RingedSpace.SheafedSpace import Mathlib.Topology.Sheaves.Stalks import Mathlib.Algebra.Category.Ring.Colimits import Mathlib.Algebra.Category.Ring.Limits #align_import algebraic_geometry.ringed_space from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" universe v u open CategoryTheory open TopologicalSpace open Opposite open TopCat open TopCat.Presheaf namespace AlgebraicGeometry abbrev RingedSpace : TypeMax.{u+1, v+1} := SheafedSpace.{_, v, u} CommRingCat.{v} set_option linter.uppercaseLean3 false in #align algebraic_geometry.RingedSpace AlgebraicGeometry.RingedSpace namespace RingedSpace open SheafedSpace variable (X : RingedSpace) -- Porting note (#10670): this was not necessary in mathlib3 instance : CoeSort RingedSpace Type* where coe X := X.carrier theorem isUnit_res_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (x : U) (h : IsUnit (X.presheaf.germ x f)) : ∃ (V : Opens X) (i : V ⟶ U) (_ : x.1 ∈ V), IsUnit (X.presheaf.map i.op f) := by obtain ⟨g', heq⟩ := h.exists_right_inv obtain ⟨V, hxV, g, rfl⟩ := X.presheaf.germ_exist x.1 g' let W := U ⊓ V have hxW : x.1 ∈ W := ⟨x.2, hxV⟩ -- Porting note: `erw` can't write into `HEq`, so this is replaced with another `HEq` in the -- desired form replace heq : (X.presheaf.germ ⟨x.val, hxW⟩) ((X.presheaf.map (U.infLELeft V).op) f * (X.presheaf.map (U.infLERight V).op) g) = (X.presheaf.germ ⟨x.val, hxW⟩) 1 := by dsimp [germ] erw [map_mul, map_one, show X.presheaf.germ ⟨x, hxW⟩ ((X.presheaf.map (U.infLELeft V).op) f) = X.presheaf.germ x f from X.presheaf.germ_res_apply (Opens.infLELeft U V) ⟨x.1, hxW⟩ f, show X.presheaf.germ ⟨x, hxW⟩ (X.presheaf.map (U.infLERight V).op g) = X.presheaf.germ ⟨x, hxV⟩ g from X.presheaf.germ_res_apply (Opens.infLERight U V) ⟨x.1, hxW⟩ g] exact heq obtain ⟨W', hxW', i₁, i₂, heq'⟩ := X.presheaf.germ_eq x.1 hxW hxW _ _ heq use W', i₁ ≫ Opens.infLELeft U V, hxW' rw [(X.presheaf.map i₂.op).map_one, (X.presheaf.map i₁.op).map_mul] at heq' rw [← comp_apply, ← X.presheaf.map_comp, ← comp_apply, ← X.presheaf.map_comp, ← op_comp] at heq' exact isUnit_of_mul_eq_one _ _ heq' set_option linter.uppercaseLean3 false in #align algebraic_geometry.RingedSpace.is_unit_res_of_is_unit_germ AlgebraicGeometry.RingedSpace.isUnit_res_of_isUnit_germ
Mathlib/Geometry/RingedSpace/Basic.lean
84
125
theorem isUnit_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (h : ∀ x : U, IsUnit (X.presheaf.germ x f)) : IsUnit f := by
-- We pick a cover of `U` by open sets `V x`, such that `f` is a unit on each `V x`. choose V iVU m h_unit using fun x : U => X.isUnit_res_of_isUnit_germ U f x (h x) have hcover : U ≤ iSup V := by intro x hxU -- Porting note: in Lean3 `rw` is sufficient erw [Opens.mem_iSup] exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩ -- Let `g x` denote the inverse of `f` in `U x`. choose g hg using fun x : U => IsUnit.exists_right_inv (h_unit x) have ic : IsCompatible (sheaf X).val V g := by intro x y apply section_ext X.sheaf (V x ⊓ V y) rintro ⟨z, hzVx, hzVy⟩ erw [germ_res_apply, germ_res_apply] apply (IsUnit.mul_right_inj (h ⟨z, (iVU x).le hzVx⟩)).mp -- Porting note: now need explicitly typing the rewrites rw [← show X.presheaf.germ ⟨z, hzVx⟩ (X.presheaf.map (iVU x).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply (iVU x) ⟨z, hzVx⟩ f] -- Porting note: change was not necessary in Lean3 change X.presheaf.germ ⟨z, hzVx⟩ _ * (X.presheaf.germ ⟨z, hzVx⟩ _) = X.presheaf.germ ⟨z, hzVx⟩ _ * X.presheaf.germ ⟨z, hzVy⟩ (g y) rw [← RingHom.map_mul, congr_arg (X.presheaf.germ (⟨z, hzVx⟩ : V x)) (hg x), -- Porting note: now need explicitly typing the rewrites show X.presheaf.germ ⟨z, hzVx⟩ (X.presheaf.map (iVU x).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply _ _ f, -- Porting note: now need explicitly typing the rewrites ← show X.presheaf.germ ⟨z, hzVy⟩ (X.presheaf.map (iVU y).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply (iVU y) ⟨z, hzVy⟩ f, ← RingHom.map_mul, congr_arg (X.presheaf.germ (⟨z, hzVy⟩ : V y)) (hg y), RingHom.map_one, RingHom.map_one] -- We claim that these local inverses glue together to a global inverse of `f`. obtain ⟨gl, gl_spec, -⟩ := X.sheaf.existsUnique_gluing' V U iVU hcover g ic apply isUnit_of_mul_eq_one f gl apply X.sheaf.eq_of_locally_eq' V U iVU hcover intro i rw [RingHom.map_one, RingHom.map_mul, gl_spec] exact hg i
0
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Normed.Group.Lemmas import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.NormedSpace.RieszLemma import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Topology.Algebra.Module.FiniteDimension import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.Matrix #align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057" universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology NNReal Metric section CompleteField variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Type v} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type w} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul 𝕜 F'] [CompleteSpace 𝕜] theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E) -- Porting note: this could be easier with `det_cases` by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E) · rcases h with ⟨s, ⟨b⟩⟩ haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b] refine Continuous.matrix_det ?_ exact ((LinearMap.toMatrix b b).toLinearMap.comp (ContinuousLinearMap.coeLM 𝕜)).continuous_of_finiteDimensional · -- Porting note: was `unfold LinearMap.det` rw [LinearMap.det_def] simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const #align continuous_linear_map.continuous_det ContinuousLinearMap.continuous_det irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : ℝ≥0 := let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv max (‖A.symm.toContinuousLinearMap‖₊ * ‖A.toContinuousLinearMap‖₊) 1 #align lipschitz_extension_constant lipschitzExtensionConstant theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : 0 < lipschitzExtensionConstant E' := by rw [lipschitzExtensionConstant] exact zero_lt_one.trans_le (le_max_right _ _) #align lipschitz_extension_constant_pos lipschitzExtensionConstant_pos theorem LipschitzOnWith.extend_finite_dimension {α : Type*} [PseudoMetricSpace α] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] {s : Set α} {f : α → E'} {K : ℝ≥0} (hf : LipschitzOnWith K f s) : ∃ g : α → E', LipschitzWith (lipschitzExtensionConstant E' * K) g ∧ EqOn f g s := by let ι : Type _ := Basis.ofVectorSpaceIndex ℝ E' let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv have LA : LipschitzWith ‖A.toContinuousLinearMap‖₊ A := by apply A.lipschitz have L : LipschitzOnWith (‖A.toContinuousLinearMap‖₊ * K) (A ∘ f) s := LA.comp_lipschitzOnWith hf obtain ⟨g, hg, gs⟩ : ∃ g : α → ι → ℝ, LipschitzWith (‖A.toContinuousLinearMap‖₊ * K) g ∧ EqOn (A ∘ f) g s := L.extend_pi refine ⟨A.symm ∘ g, ?_, ?_⟩ · have LAsymm : LipschitzWith ‖A.symm.toContinuousLinearMap‖₊ A.symm := by apply A.symm.lipschitz apply (LAsymm.comp hg).weaken rw [lipschitzExtensionConstant, ← mul_assoc] exact mul_le_mul' (le_max_left _ _) le_rfl · intro x hx have : A (f x) = g x := gs hx simp only [(· ∘ ·), ← this, A.symm_apply_apply] #align lipschitz_on_with.extend_finite_dimension LipschitzOnWith.extend_finite_dimension theorem LinearMap.exists_antilipschitzWith [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F) (hf : LinearMap.ker f = ⊥) : ∃ K > 0, AntilipschitzWith K f := by cases subsingleton_or_nontrivial E · exact ⟨1, zero_lt_one, AntilipschitzWith.of_subsingleton⟩ · rw [LinearMap.ker_eq_bot] at hf let e : E ≃L[𝕜] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv exact ⟨_, e.nnnorm_symm_pos, e.antilipschitz⟩ #align linear_map.exists_antilipschitz_with LinearMap.exists_antilipschitzWith open Function in theorem LinearMap.injective_iff_antilipschitz [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F) : Injective f ↔ ∃ K > 0, AntilipschitzWith K f := by constructor · rw [← LinearMap.ker_eq_bot] exact f.exists_antilipschitzWith · rintro ⟨K, -, H⟩ exact H.injective open Function in
Mathlib/Analysis/NormedSpace/FiniteDimension.lean
246
255
theorem ContinuousLinearMap.isOpen_injective [FiniteDimensional 𝕜 E] : IsOpen { L : E →L[𝕜] F | Injective L } := by
rw [isOpen_iff_eventually] rintro φ₀ hφ₀ rcases φ₀.injective_iff_antilipschitz.mp hφ₀ with ⟨K, K_pos, H⟩ have : ∀ᶠ φ in 𝓝 φ₀, ‖φ - φ₀‖₊ < K⁻¹ := eventually_nnnorm_sub_lt _ <| inv_pos_of_pos K_pos filter_upwards [this] with φ hφ apply φ.injective_iff_antilipschitz.mpr exact ⟨(K⁻¹ - ‖φ - φ₀‖₊)⁻¹, inv_pos_of_pos (tsub_pos_of_lt hφ), H.add_sub_lipschitzWith (φ - φ₀).lipschitz hφ⟩
0
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Data.Nat.Cast.Order import Mathlib.Tactic.Common #align_import data.nat.cast.field from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829" namespace Nat variable {α : Type*} @[simp] theorem cast_div [DivisionSemiring α] {m n : ℕ} (n_dvd : n ∣ m) (hn : (n : α) ≠ 0) : ((m / n : ℕ) : α) = m / n := by rcases n_dvd with ⟨k, rfl⟩ have : n ≠ 0 := by rintro rfl; simp at hn rw [Nat.mul_div_cancel_left _ this.bot_lt, mul_comm n, cast_mul, mul_div_cancel_right₀ _ hn] #align nat.cast_div Nat.cast_div
Mathlib/Data/Nat/Cast/Field.lean
36
41
theorem cast_div_div_div_cancel_right [DivisionSemiring α] [CharZero α] {m n d : ℕ} (hn : d ∣ n) (hm : d ∣ m) : (↑(m / d) : α) / (↑(n / d) : α) = (m : α) / n := by
rcases eq_or_ne d 0 with (rfl | hd); · simp [Nat.zero_dvd.1 hm] replace hd : (d : α) ≠ 0 := by norm_cast rw [cast_div hm, cast_div hn, div_div_div_cancel_right _ hd] <;> exact hd
0
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine #align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped EuclideanGeometry open scoped Real open scoped RealInnerProductSpace namespace InnerProductGeometry variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero] exact inner_eq_zero_iff_angle_eq_pi_div_two x y #align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two theorem norm_add_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ := (norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h #align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq' theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) : ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero] exact inner_eq_zero_iff_angle_eq_pi_div_two x y #align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two theorem norm_sub_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) : ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ := (norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h #align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq' theorem angle_add_eq_arccos_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) : angle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by rw [angle, inner_add_right, h, add_zero, real_inner_self_eq_norm_mul_norm] by_cases hx : ‖x‖ = 0; · simp [hx] rw [div_mul_eq_div_div, mul_self_div_self] #align inner_product_geometry.angle_add_eq_arccos_of_inner_eq_zero InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero
Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean
77
91
theorem angle_add_eq_arcsin_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x ≠ 0 ∨ y ≠ 0) : angle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖) := by
have hxy : ‖x + y‖ ^ 2 ≠ 0 := by rw [pow_two, norm_add_sq_eq_norm_sq_add_norm_sq_real h, ne_comm] refine ne_of_lt ?_ rcases h0 with (h0 | h0) · exact Left.add_pos_of_pos_of_nonneg (mul_self_pos.2 (norm_ne_zero_iff.2 h0)) (mul_self_nonneg _) · exact Left.add_pos_of_nonneg_of_pos (mul_self_nonneg _) (mul_self_pos.2 (norm_ne_zero_iff.2 h0)) rw [angle_add_eq_arccos_of_inner_eq_zero h, Real.arccos_eq_arcsin (div_nonneg (norm_nonneg _) (norm_nonneg _)), div_pow, one_sub_div hxy] nth_rw 1 [pow_two] rw [norm_add_sq_eq_norm_sq_add_norm_sq_real h, pow_two, add_sub_cancel_left, ← pow_two, ← div_pow, Real.sqrt_sq (div_nonneg (norm_nonneg _) (norm_nonneg _))]
0
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']
0
import Mathlib.SetTheory.Game.Ordinal import Mathlib.SetTheory.Ordinal.NaturalOps #align_import set_theory.game.birthday from "leanprover-community/mathlib"@"a347076985674932c0e91da09b9961ed0a79508c" universe u open Ordinal namespace SetTheory open scoped NaturalOps PGame namespace PGame noncomputable def birthday : PGame.{u} → Ordinal.{u} | ⟨_, _, xL, xR⟩ => max (lsub.{u, u} fun i => birthday (xL i)) (lsub.{u, u} fun i => birthday (xR i)) #align pgame.birthday SetTheory.PGame.birthday theorem birthday_def (x : PGame) : birthday x = max (lsub.{u, u} fun i => birthday (x.moveLeft i)) (lsub.{u, u} fun i => birthday (x.moveRight i)) := by cases x; rw [birthday]; rfl #align pgame.birthday_def SetTheory.PGame.birthday_def theorem birthday_moveLeft_lt {x : PGame} (i : x.LeftMoves) : (x.moveLeft i).birthday < x.birthday := by cases x; rw [birthday]; exact lt_max_of_lt_left (lt_lsub _ i) #align pgame.birthday_move_left_lt SetTheory.PGame.birthday_moveLeft_lt theorem birthday_moveRight_lt {x : PGame} (i : x.RightMoves) : (x.moveRight i).birthday < x.birthday := by cases x; rw [birthday]; exact lt_max_of_lt_right (lt_lsub _ i) #align pgame.birthday_move_right_lt SetTheory.PGame.birthday_moveRight_lt theorem lt_birthday_iff {x : PGame} {o : Ordinal} : o < x.birthday ↔ (∃ i : x.LeftMoves, o ≤ (x.moveLeft i).birthday) ∨ ∃ i : x.RightMoves, o ≤ (x.moveRight i).birthday := by constructor · rw [birthday_def] intro h cases' lt_max_iff.1 h with h' h' · left rwa [lt_lsub_iff] at h' · right rwa [lt_lsub_iff] at h' · rintro (⟨i, hi⟩ | ⟨i, hi⟩) · exact hi.trans_lt (birthday_moveLeft_lt i) · exact hi.trans_lt (birthday_moveRight_lt i) #align pgame.lt_birthday_iff SetTheory.PGame.lt_birthday_iff theorem Relabelling.birthday_congr : ∀ {x y : PGame.{u}}, x ≡r y → birthday x = birthday y | ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩, r => by unfold birthday congr 1 all_goals apply lsub_eq_of_range_eq.{u, u, u} ext i; constructor all_goals rintro ⟨j, rfl⟩ · exact ⟨_, (r.moveLeft j).birthday_congr.symm⟩ · exact ⟨_, (r.moveLeftSymm j).birthday_congr⟩ · exact ⟨_, (r.moveRight j).birthday_congr.symm⟩ · exact ⟨_, (r.moveRightSymm j).birthday_congr⟩ termination_by x y => (x, y) #align pgame.relabelling.birthday_congr SetTheory.PGame.Relabelling.birthday_congr @[simp] theorem birthday_eq_zero {x : PGame} : birthday x = 0 ↔ IsEmpty x.LeftMoves ∧ IsEmpty x.RightMoves := by rw [birthday_def, max_eq_zero, lsub_eq_zero_iff, lsub_eq_zero_iff] #align pgame.birthday_eq_zero SetTheory.PGame.birthday_eq_zero @[simp] theorem birthday_zero : birthday 0 = 0 := by simp [inferInstanceAs (IsEmpty PEmpty)] #align pgame.birthday_zero SetTheory.PGame.birthday_zero @[simp] theorem birthday_one : birthday 1 = 1 := by rw [birthday_def]; simp #align pgame.birthday_one SetTheory.PGame.birthday_one @[simp] theorem birthday_star : birthday star = 1 := by rw [birthday_def]; simp #align pgame.birthday_star SetTheory.PGame.birthday_star @[simp] theorem neg_birthday : ∀ x : PGame, (-x).birthday = x.birthday | ⟨xl, xr, xL, xR⟩ => by rw [birthday_def, birthday_def, max_comm] congr <;> funext <;> apply neg_birthday #align pgame.neg_birthday SetTheory.PGame.neg_birthday @[simp] theorem toPGame_birthday (o : Ordinal) : o.toPGame.birthday = o := by induction' o using Ordinal.induction with o IH rw [toPGame_def, PGame.birthday] simp only [lsub_empty, max_zero_right] -- Porting note: was `nth_rw 1 [← lsub_typein o]` conv_rhs => rw [← lsub_typein o] congr with x exact IH _ (typein_lt_self x) #align pgame.to_pgame_birthday SetTheory.PGame.toPGame_birthday theorem le_birthday : ∀ x : PGame, x ≤ x.birthday.toPGame | ⟨xl, _, xL, _⟩ => le_def.2 ⟨fun i => Or.inl ⟨toLeftMovesToPGame ⟨_, birthday_moveLeft_lt i⟩, by simp [le_birthday (xL i)]⟩, isEmptyElim⟩ #align pgame.le_birthday SetTheory.PGame.le_birthday variable (a b x : PGame.{u})
Mathlib/SetTheory/Game/Birthday.lean
142
143
theorem neg_birthday_le : -x.birthday.toPGame ≤ x := by
simpa only [neg_birthday, ← neg_le_iff] using le_birthday (-x)
0
import Mathlib.Combinatorics.SimpleGraph.DegreeSum import Mathlib.Combinatorics.SimpleGraph.Subgraph #align_import combinatorics.simple_graph.matching from "leanprover-community/mathlib"@"138448ae98f529ef34eeb61114191975ee2ca508" universe u namespace SimpleGraph variable {V : Type u} {G : SimpleGraph V} (M : Subgraph G) namespace Subgraph def IsMatching : Prop := ∀ ⦃v⦄, v ∈ M.verts → ∃! w, M.Adj v w #align simple_graph.subgraph.is_matching SimpleGraph.Subgraph.IsMatching noncomputable def IsMatching.toEdge {M : Subgraph G} (h : M.IsMatching) (v : M.verts) : M.edgeSet := ⟨s(v, (h v.property).choose), (h v.property).choose_spec.1⟩ #align simple_graph.subgraph.is_matching.to_edge SimpleGraph.Subgraph.IsMatching.toEdge theorem IsMatching.toEdge_eq_of_adj {M : Subgraph G} (h : M.IsMatching) {v w : V} (hv : v ∈ M.verts) (hvw : M.Adj v w) : h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩ := by simp only [IsMatching.toEdge, Subtype.mk_eq_mk] congr exact ((h (M.edge_vert hvw)).choose_spec.2 w hvw).symm #align simple_graph.subgraph.is_matching.to_edge_eq_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_of_adj theorem IsMatching.toEdge.surjective {M : Subgraph G} (h : M.IsMatching) : Function.Surjective h.toEdge := by rintro ⟨e, he⟩ refine Sym2.ind (fun x y he => ?_) e he exact ⟨⟨x, M.edge_vert he⟩, h.toEdge_eq_of_adj _ he⟩ #align simple_graph.subgraph.is_matching.to_edge.surjective SimpleGraph.Subgraph.IsMatching.toEdge.surjective theorem IsMatching.toEdge_eq_toEdge_of_adj {M : Subgraph G} {v w : V} (h : M.IsMatching) (hv : v ∈ M.verts) (hw : w ∈ M.verts) (ha : M.Adj v w) : h.toEdge ⟨v, hv⟩ = h.toEdge ⟨w, hw⟩ := by rw [h.toEdge_eq_of_adj hv ha, h.toEdge_eq_of_adj hw (M.symm ha), Subtype.mk_eq_mk, Sym2.eq_swap] #align simple_graph.subgraph.is_matching.to_edge_eq_to_edge_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_toEdge_of_adj def IsPerfectMatching : Prop := M.IsMatching ∧ M.IsSpanning #align simple_graph.subgraph.is_perfect_matching SimpleGraph.Subgraph.IsPerfectMatching theorem IsMatching.support_eq_verts {M : Subgraph G} (h : M.IsMatching) : M.support = M.verts := by refine M.support_subset_verts.antisymm fun v hv => ?_ obtain ⟨w, hvw, -⟩ := h hv exact ⟨_, hvw⟩ #align simple_graph.subgraph.is_matching.support_eq_verts SimpleGraph.Subgraph.IsMatching.support_eq_verts
Mathlib/Combinatorics/SimpleGraph/Matching.lean
96
98
theorem isMatching_iff_forall_degree {M : Subgraph G} [∀ v : V, Fintype (M.neighborSet v)] : M.IsMatching ↔ ∀ v : V, v ∈ M.verts → M.degree v = 1 := by
simp only [degree_eq_one_iff_unique_adj, IsMatching]
0
import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Topology.Algebra.Module.StrongTopology #align_import analysis.normed_space.compact_operator from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open Function Set Filter Bornology Metric Pointwise Topology def IsCompactOperator {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁] [TopologicalSpace M₂] (f : M₁ → M₂) : Prop := ∃ K, IsCompact K ∧ f ⁻¹' K ∈ (𝓝 0 : Filter M₁) #align is_compact_operator IsCompactOperator theorem isCompactOperator_zero {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁] [TopologicalSpace M₂] [Zero M₂] : IsCompactOperator (0 : M₁ → M₂) := ⟨{0}, isCompact_singleton, mem_of_superset univ_mem fun _ _ => rfl⟩ #align is_compact_operator_zero isCompactOperator_zero section Characterizations section variable {R₁ R₂ : Type*} [Semiring R₁] [Semiring R₂] {σ₁₂ : R₁ →+* R₂} {M₁ M₂ : Type*} [TopologicalSpace M₁] [AddCommMonoid M₁] [TopologicalSpace M₂] theorem isCompactOperator_iff_exists_mem_nhds_image_subset_compact (f : M₁ → M₂) : IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), ∃ K : Set M₂, IsCompact K ∧ f '' V ⊆ K := ⟨fun ⟨K, hK, hKf⟩ => ⟨f ⁻¹' K, hKf, K, hK, image_preimage_subset _ _⟩, fun ⟨_, hV, K, hK, hVK⟩ => ⟨K, hK, mem_of_superset hV (image_subset_iff.mp hVK)⟩⟩ #align is_compact_operator_iff_exists_mem_nhds_image_subset_compact isCompactOperator_iff_exists_mem_nhds_image_subset_compact theorem isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image [T2Space M₂] (f : M₁ → M₂) : IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), IsCompact (closure <| f '' V) := by rw [isCompactOperator_iff_exists_mem_nhds_image_subset_compact] exact ⟨fun ⟨V, hV, K, hK, hKV⟩ => ⟨V, hV, hK.closure_of_subset hKV⟩, fun ⟨V, hV, hVc⟩ => ⟨V, hV, closure (f '' V), hVc, subset_closure⟩⟩ #align is_compact_operator_iff_exists_mem_nhds_is_compact_closure_image isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image end section Comp variable {R₁ R₂ R₃ : Type*} [Semiring R₁] [Semiring R₂] [Semiring R₃] {σ₁₂ : R₁ →+* R₂} {σ₂₃ : R₂ →+* R₃} {M₁ M₂ M₃ : Type*} [TopologicalSpace M₁] [TopologicalSpace M₂] [TopologicalSpace M₃] [AddCommMonoid M₁] [Module R₁ M₁]
Mathlib/Analysis/NormedSpace/CompactOperator.lean
252
257
theorem IsCompactOperator.comp_clm [AddCommMonoid M₂] [Module R₂ M₂] {f : M₂ → M₃} (hf : IsCompactOperator f) (g : M₁ →SL[σ₁₂] M₂) : IsCompactOperator (f ∘ g) := by
have := g.continuous.tendsto 0 rw [map_zero] at this rcases hf with ⟨K, hK, hKf⟩ exact ⟨K, hK, this hKf⟩
0
import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.LinearAlgebra.Matrix.Block #align_import analysis.inner_product_space.gram_schmidt_ortho from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0" open Finset Submodule FiniteDimensional variable (𝕜 : Type*) {E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable {ι : Type*} [LinearOrder ι] [LocallyFiniteOrderBot ι] [IsWellOrder ι (· < ·)] attribute [local instance] IsWellOrder.toHasWellFounded local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y noncomputable def gramSchmidt [IsWellOrder ι (· < ·)] (f : ι → E) (n : ι) : E := f n - ∑ i : Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt f i) (f n) termination_by n decreasing_by exact mem_Iio.1 i.2 #align gram_schmidt gramSchmidt theorem gramSchmidt_def (f : ι → E) (n : ι) : gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [← sum_attach, attach_eq_univ, gramSchmidt] #align gram_schmidt_def gramSchmidt_def theorem gramSchmidt_def' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [gramSchmidt_def, sub_add_cancel] #align gram_schmidt_def' gramSchmidt_def' theorem gramSchmidt_def'' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, (⟪gramSchmidt 𝕜 f i, f n⟫ / (‖gramSchmidt 𝕜 f i‖ : 𝕜) ^ 2) • gramSchmidt 𝕜 f i := by convert gramSchmidt_def' 𝕜 f n rw [orthogonalProjection_singleton, RCLike.ofReal_pow] #align gram_schmidt_def'' gramSchmidt_def'' @[simp] theorem gramSchmidt_zero {ι : Type*} [LinearOrder ι] [LocallyFiniteOrder ι] [OrderBot ι] [IsWellOrder ι (· < ·)] (f : ι → E) : gramSchmidt 𝕜 f ⊥ = f ⊥ := by rw [gramSchmidt_def, Iio_eq_Ico, Finset.Ico_self, Finset.sum_empty, sub_zero] #align gram_schmidt_zero gramSchmidt_zero theorem gramSchmidt_orthogonal (f : ι → E) {a b : ι} (h₀ : a ≠ b) : ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := by suffices ∀ a b : ι, a < b → ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 by cases' h₀.lt_or_lt with ha hb · exact this _ _ ha · rw [inner_eq_zero_symm] exact this _ _ hb clear h₀ a b intro a b h₀ revert a apply wellFounded_lt.induction b intro b ih a h₀ simp only [gramSchmidt_def 𝕜 f b, inner_sub_right, inner_sum, orthogonalProjection_singleton, inner_smul_right] rw [Finset.sum_eq_single_of_mem a (Finset.mem_Iio.mpr h₀)] · by_cases h : gramSchmidt 𝕜 f a = 0 · simp only [h, inner_zero_left, zero_div, zero_mul, sub_zero] · rw [RCLike.ofReal_pow, ← inner_self_eq_norm_sq_to_K, div_mul_cancel₀, sub_self] rwa [inner_self_ne_zero] intro i hi hia simp only [mul_eq_zero, div_eq_zero_iff, inner_self_eq_zero] right cases' hia.lt_or_lt with hia₁ hia₂ · rw [inner_eq_zero_symm] exact ih a h₀ i hia₁ · exact ih i (mem_Iio.1 hi) a hia₂ #align gram_schmidt_orthogonal gramSchmidt_orthogonal theorem gramSchmidt_pairwise_orthogonal (f : ι → E) : Pairwise fun a b => ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := fun _ _ => gramSchmidt_orthogonal 𝕜 f #align gram_schmidt_pairwise_orthogonal gramSchmidt_pairwise_orthogonal
Mathlib/Analysis/InnerProductSpace/GramSchmidtOrtho.lean
117
128
theorem gramSchmidt_inv_triangular (v : ι → E) {i j : ι} (hij : i < j) : ⟪gramSchmidt 𝕜 v j, v i⟫ = 0 := by
rw [gramSchmidt_def'' 𝕜 v] simp only [inner_add_right, inner_sum, inner_smul_right] set b : ι → E := gramSchmidt 𝕜 v convert zero_add (0 : 𝕜) · exact gramSchmidt_orthogonal 𝕜 v hij.ne' apply Finset.sum_eq_zero rintro k hki' have hki : k < i := by simpa using hki' have : ⟪b j, b k⟫ = 0 := gramSchmidt_orthogonal 𝕜 v (hki.trans hij).ne' simp [this]
0
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.List.Perm import Mathlib.Data.List.Range #align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6" universe u v w variable {α : Type u} {β : Type v} {γ : Type w} open Nat namespace List @[simp] theorem sublists'_nil : sublists' (@nil α) = [[]] := rfl #align list.sublists'_nil List.sublists'_nil @[simp] theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] := rfl #align list.sublists'_singleton List.sublists'_singleton #noalign list.map_sublists'_aux #noalign list.sublists'_aux_append #noalign list.sublists'_aux_eq_sublists' -- Porting note: Not the same as `sublists'_aux` from Lean3 def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) := r₁.foldl (init := r₂) fun r l => r ++ [a :: l] #align list.sublists'_aux List.sublists'Aux theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)), sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray) (fun r l => r.push (a :: l))).toList := by intro r₁ r₂ rw [sublists'Aux, Array.foldl_eq_foldl_data] have := List.foldl_hom Array.toList (fun r l => r.push (a :: l)) (fun r l => r ++ [a :: l]) r₁ r₂.toArray (by simp) simpa using this
Mathlib/Data/List/Sublists.lean
61
66
theorem sublists'_eq_sublists'Aux (l : List α) : sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] := by
simp only [sublists', sublists'Aux_eq_array_foldl] rw [← List.foldr_hom Array.toList] · rfl · intros _ _; congr <;> simp
0
import Mathlib.CategoryTheory.Sites.Coherent.Basic import Mathlib.CategoryTheory.EffectiveEpi.Comp import Mathlib.CategoryTheory.EffectiveEpi.Extensive namespace CategoryTheory open Limits GrothendieckTopology Sieve variable (C : Type*) [Category C] instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where exists_fac {X Y Z} f g _ := by have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g) simp only [exists_const] at hp rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩ ext b simpa using hι b instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where pullback {B₁ B₂} f α _ X₁ π₁ h := by refine ⟨α, inferInstance, ?_⟩ obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁) let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a) let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance refine ⟨X₂, π₂, ?_, ?_⟩ · have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this] infer_instance · refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩ simp only [π₂, id_eq, Category.assoc, ← hg] rw [← Category.assoc, pullback.condition] simp
Mathlib/CategoryTheory/Sites/Coherent/Comparison.lean
57
94
theorem extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] : ((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck = (coherentTopology C) := by
ext B S refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · induction h with | of Y T hT => apply Coverage.saturate.of simp only [Coverage.sup_covering, Set.mem_union] at hT exact Or.elim hT (fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩) (fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩) | top => apply Coverage.saturate.top | transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption] · induction h with | of Y T hT => obtain ⟨I, _, X, f, rfl, hT⟩ := hT apply Coverage.saturate.transitive Y (generate (Presieve.ofArrows (fun (_ : Unit) ↦ (∐ fun (i : I) => X i)) (fun (_ : Unit) ↦ Sigma.desc f))) · apply Coverage.saturate.of simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union, Set.mem_setOf_eq] exact Or.inr ⟨_, Sigma.desc f, ⟨rfl, inferInstance⟩⟩ · rintro R g ⟨W, ψ, σ, ⟨⟩, rfl⟩ change _ ∈ sieves ((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck _ rw [Sieve.pullback_comp] apply pullback_stable' have : generate (Presieve.ofArrows X fun (i : I) ↦ Sigma.ι X i) ≤ (generate (Presieve.ofArrows X f)).pullback (Sigma.desc f) := by rintro Q q ⟨E, e, r, ⟨hq, rfl⟩⟩ exact ⟨E, e, r ≫ (Sigma.desc f), by cases hq; simpa using Presieve.ofArrows.mk _, by simp⟩ apply Coverage.saturate_of_superset _ this apply Coverage.saturate.of refine Or.inl ⟨I, inferInstance, _, _, ⟨rfl, ?_⟩⟩ convert IsIso.id _ aesop | top => apply Coverage.saturate.top | transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
0
import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.NormedSpace.Banach import Mathlib.LinearAlgebra.SesquilinearForm #align_import analysis.inner_product_space.symmetric from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open RCLike open ComplexConjugate variable {𝕜 E E' F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] variable [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] variable [NormedAddCommGroup E'] [InnerProductSpace ℝ E'] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace LinearMap def IsSymmetric (T : E →ₗ[𝕜] E) : Prop := ∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫ #align linear_map.is_symmetric LinearMap.IsSymmetric theorem IsSymmetric.conj_inner_sym {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) (x y : E) : conj ⟪T x, y⟫ = ⟪T y, x⟫ := by rw [hT x y, inner_conj_symm] #align linear_map.is_symmetric.conj_inner_sym LinearMap.IsSymmetric.conj_inner_sym @[simp] theorem IsSymmetric.apply_clm {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x y : E) : ⟪T x, y⟫ = ⟪x, T y⟫ := hT x y #align linear_map.is_symmetric.apply_clm LinearMap.IsSymmetric.apply_clm theorem isSymmetric_zero : (0 : E →ₗ[𝕜] E).IsSymmetric := fun x y => (inner_zero_right x : ⟪x, 0⟫ = 0).symm ▸ (inner_zero_left y : ⟪0, y⟫ = 0) #align linear_map.is_symmetric_zero LinearMap.isSymmetric_zero theorem isSymmetric_id : (LinearMap.id : E →ₗ[𝕜] E).IsSymmetric := fun _ _ => rfl #align linear_map.is_symmetric_id LinearMap.isSymmetric_id theorem IsSymmetric.add {T S : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (hS : S.IsSymmetric) : (T + S).IsSymmetric := by intro x y rw [LinearMap.add_apply, inner_add_left, hT x y, hS x y, ← inner_add_right] rfl #align linear_map.is_symmetric.add LinearMap.IsSymmetric.add theorem IsSymmetric.continuous [CompleteSpace E] {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) : Continuous T := by -- We prove it by using the closed graph theorem refine T.continuous_of_seq_closed_graph fun u x y hu hTu => ?_ rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜] have hlhs : ∀ k : ℕ, ⟪T (u k) - T x, y - T x⟫ = ⟪u k - x, T (y - T x)⟫ := by intro k rw [← T.map_sub, hT] refine tendsto_nhds_unique ((hTu.sub_const _).inner tendsto_const_nhds) ?_ simp_rw [Function.comp_apply, hlhs] rw [← inner_zero_left (T (y - T x))] refine Filter.Tendsto.inner ?_ tendsto_const_nhds rw [← sub_self x] exact hu.sub_const _ #align linear_map.is_symmetric.continuous LinearMap.IsSymmetric.continuous @[simp] theorem IsSymmetric.coe_reApplyInnerSelf_apply {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x : E) : (T.reApplyInnerSelf x : 𝕜) = ⟪T x, x⟫ := by rsuffices ⟨r, hr⟩ : ∃ r : ℝ, ⟪T x, x⟫ = r · simp [hr, T.reApplyInnerSelf_apply] rw [← conj_eq_iff_real] exact hT.conj_inner_sym x x #align linear_map.is_symmetric.coe_re_apply_inner_self_apply LinearMap.IsSymmetric.coe_reApplyInnerSelf_apply theorem IsSymmetric.restrict_invariant {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) {V : Submodule 𝕜 E} (hV : ∀ v ∈ V, T v ∈ V) : IsSymmetric (T.restrict hV) := fun v w => hT v w #align linear_map.is_symmetric.restrict_invariant LinearMap.IsSymmetric.restrict_invariant theorem IsSymmetric.restrictScalars {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) : @LinearMap.IsSymmetric ℝ E _ _ (InnerProductSpace.rclikeToReal 𝕜 E) (@LinearMap.restrictScalars ℝ 𝕜 _ _ _ _ _ _ (InnerProductSpace.rclikeToReal 𝕜 E).toModule (InnerProductSpace.rclikeToReal 𝕜 E).toModule _ _ _ T) := fun x y => by simp [hT x y, real_inner_eq_re_inner, LinearMap.coe_restrictScalars ℝ] #align linear_map.is_symmetric.restrict_scalars LinearMap.IsSymmetric.restrictScalars
Mathlib/Analysis/InnerProductSpace/Symmetric.lean
163
180
theorem IsSymmetric.inner_map_polarization {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (x y : E) : ⟪T x, y⟫ = (⟪T (x + y), x + y⟫ - ⟪T (x - y), x - y⟫ - I * ⟪T (x + (I : 𝕜) • y), x + (I : 𝕜) • y⟫ + I * ⟪T (x - (I : 𝕜) • y), x - (I : 𝕜) • y⟫) / 4 := by
rcases@I_mul_I_ax 𝕜 _ with (h | h) · simp_rw [h, zero_mul, sub_zero, add_zero, map_add, map_sub, inner_add_left, inner_add_right, inner_sub_left, inner_sub_right, hT x, ← inner_conj_symm x (T y)] suffices (re ⟪T y, x⟫ : 𝕜) = ⟪T y, x⟫ by rw [conj_eq_iff_re.mpr this] ring rw [← re_add_im ⟪T y, x⟫] simp_rw [h, mul_zero, add_zero] norm_cast · simp_rw [map_add, map_sub, inner_add_left, inner_add_right, inner_sub_left, inner_sub_right, LinearMap.map_smul, inner_smul_left, inner_smul_right, RCLike.conj_I, mul_add, mul_sub, sub_sub, ← mul_assoc, mul_neg, h, neg_neg, one_mul, neg_one_mul] ring
0
import Mathlib.LinearAlgebra.Dimension.LinearMap import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition #align_import linear_algebra.free_module.finite.matrix from "leanprover-community/mathlib"@"b1c23399f01266afe392a0d8f71f599a0dad4f7b" universe u u' v w variable (R : Type u) (S : Type u') (M : Type v) (N : Type w) open Module.Free (chooseBasis ChooseBasisIndex) open FiniteDimensional (finrank)
Mathlib/LinearAlgebra/FreeModule/Finite/Matrix.lean
113
119
theorem Matrix.rank_vecMulVec {K m n : Type u} [CommRing K] [Fintype n] [DecidableEq n] (w : m → K) (v : n → K) : (Matrix.vecMulVec w v).toLin'.rank ≤ 1 := by
nontriviality K rw [Matrix.vecMulVec_eq, Matrix.toLin'_mul] refine le_trans (LinearMap.rank_comp_le_left _ _) ?_ refine (LinearMap.rank_le_domain _).trans_eq ?_ rw [rank_fun', Fintype.card_unit, Nat.cast_one]
0
import Mathlib.GroupTheory.Solvable import Mathlib.FieldTheory.PolynomialGaloisGroup import Mathlib.RingTheory.RootsOfUnity.Basic #align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial IntermediateField open Polynomial IntermediateField section AbelRuffini variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E] theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance #align gal_zero_is_solvable gal_zero_isSolvable theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance #align gal_one_is_solvable gal_one_isSolvable theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_C_is_solvable gal_C_isSolvable theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_is_solvable gal_X_isSolvable theorem gal_X_sub_C_isSolvable (x : F) : IsSolvable (X - C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_sub_C_is_solvable gal_X_sub_C_isSolvable theorem gal_X_pow_isSolvable (n : ℕ) : IsSolvable (X ^ n : F[X]).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_pow_is_solvable gal_X_pow_isSolvable theorem gal_mul_isSolvable {p q : F[X]} (_ : IsSolvable p.Gal) (_ : IsSolvable q.Gal) : IsSolvable (p * q).Gal := solvable_of_solvable_injective (Gal.restrictProd_injective p q) #align gal_mul_is_solvable gal_mul_isSolvable theorem gal_prod_isSolvable {s : Multiset F[X]} (hs : ∀ p ∈ s, IsSolvable (Gal p)) : IsSolvable s.prod.Gal := by apply Multiset.induction_on' s · exact gal_one_isSolvable · intro p t hps _ ht rw [Multiset.insert_eq_cons, Multiset.prod_cons] exact gal_mul_isSolvable (hs p hps) ht #align gal_prod_is_solvable gal_prod_isSolvable theorem gal_isSolvable_of_splits {p q : F[X]} (_ : Fact (p.Splits (algebraMap F q.SplittingField))) (hq : IsSolvable q.Gal) : IsSolvable p.Gal := haveI : IsSolvable (q.SplittingField ≃ₐ[F] q.SplittingField) := hq solvable_of_surjective (AlgEquiv.restrictNormalHom_surjective q.SplittingField) #align gal_is_solvable_of_splits gal_isSolvable_of_splits theorem gal_isSolvable_tower (p q : F[X]) (hpq : p.Splits (algebraMap F q.SplittingField)) (hp : IsSolvable p.Gal) (hq : IsSolvable (q.map (algebraMap F p.SplittingField)).Gal) : IsSolvable q.Gal := by let K := p.SplittingField let L := q.SplittingField haveI : Fact (p.Splits (algebraMap F L)) := ⟨hpq⟩ let ϕ : (L ≃ₐ[K] L) ≃* (q.map (algebraMap F K)).Gal := (IsSplittingField.algEquiv L (q.map (algebraMap F K))).autCongr have ϕ_inj : Function.Injective ϕ.toMonoidHom := ϕ.injective haveI : IsSolvable (K ≃ₐ[F] K) := hp haveI : IsSolvable (L ≃ₐ[K] L) := solvable_of_solvable_injective ϕ_inj exact isSolvable_of_isScalarTower F p.SplittingField q.SplittingField #align gal_is_solvable_tower gal_isSolvable_tower section GalXPowSubC
Mathlib/FieldTheory/AbelRuffini.lean
98
114
theorem gal_X_pow_sub_one_isSolvable (n : ℕ) : IsSolvable (X ^ n - 1 : F[X]).Gal := by
by_cases hn : n = 0 · rw [hn, pow_zero, sub_self] exact gal_zero_isSolvable have hn' : 0 < n := pos_iff_ne_zero.mpr hn have hn'' : (X ^ n - 1 : F[X]) ≠ 0 := X_pow_sub_C_ne_zero hn' 1 apply isSolvable_of_comm intro σ τ ext a ha simp only [mem_rootSet_of_ne hn'', map_sub, aeval_X_pow, aeval_one, sub_eq_zero] at ha have key : ∀ σ : (X ^ n - 1 : F[X]).Gal, ∃ m : ℕ, σ a = a ^ m := by intro σ lift n to ℕ+ using hn' exact map_rootsOfUnity_eq_pow_self σ.toAlgHom (rootsOfUnity.mkOfPowEq a ha) obtain ⟨c, hc⟩ := key σ obtain ⟨d, hd⟩ := key τ rw [σ.mul_apply, τ.mul_apply, hc, τ.map_pow, hd, σ.map_pow, hc, ← pow_mul, pow_mul']
0
import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.NormedSpace.Completion #align_import analysis.complex.liouville from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory Bornology open scoped Topology Filter NNReal Real universe u v 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/Liouville.lean
45
50
theorem deriv_eq_smul_circleIntegral [CompleteSpace F] {R : ℝ} {c : ℂ} {f : ℂ → F} (hR : 0 < R) (hf : DiffContOnCl ℂ f (ball c R)) : deriv f c = (2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - c) ^ (-2 : ℤ) • f z := by
lift R to ℝ≥0 using hR.le refine (hf.hasFPowerSeriesOnBall hR).hasFPowerSeriesAt.deriv.trans ?_ simp only [cauchyPowerSeries_apply, one_div, zpow_neg, pow_one, smul_smul, zpow_two, mul_inv]
0
import Mathlib.SetTheory.Cardinal.ToNat import Mathlib.Data.Nat.PartENat #align_import set_theory.cardinal.basic from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" universe u v open Function variable {α : Type u} namespace Cardinal noncomputable def toPartENat : Cardinal →+o PartENat := .comp { (PartENat.withTopAddEquiv.symm : ℕ∞ →+ PartENat), (PartENat.withTopOrderIso.symm : ℕ∞ →o PartENat) with } toENat #align cardinal.to_part_enat Cardinal.toPartENat @[simp] theorem partENatOfENat_toENat (c : Cardinal) : (toENat c : PartENat) = toPartENat c := rfl @[simp] theorem toPartENat_natCast (n : ℕ) : toPartENat n = n := by simp only [← partENatOfENat_toENat, toENat_nat, PartENat.ofENat_coe] #align cardinal.to_part_enat_cast Cardinal.toPartENat_natCast theorem toPartENat_apply_of_lt_aleph0 {c : Cardinal} (h : c < ℵ₀) : toPartENat c = toNat c := by lift c to ℕ using h; simp #align cardinal.to_part_enat_apply_of_lt_aleph_0 Cardinal.toPartENat_apply_of_lt_aleph0
Mathlib/SetTheory/Cardinal/PartENat.lean
47
51
theorem toPartENat_eq_top {c : Cardinal} : toPartENat c = ⊤ ↔ ℵ₀ ≤ c := by
rw [← partENatOfENat_toENat, ← PartENat.withTopEquiv_symm_top, ← toENat_eq_top, ← PartENat.withTopEquiv.symm.injective.eq_iff] simp
0
import Batteries.Classes.Order namespace Batteries.PairingHeapImp inductive Heap (α : Type u) where | nil : Heap α | node (a : α) (child sibling : Heap α) : Heap α deriving Repr def Heap.size : Heap α → Nat | .nil => 0 | .node _ c s => c.size + 1 + s.size def Heap.singleton (a : α) : Heap α := .node a .nil .nil def Heap.isEmpty : Heap α → Bool | .nil => true | _ => false @[specialize] def Heap.merge (le : α → α → Bool) : Heap α → Heap α → Heap α | .nil, .nil => .nil | .nil, .node a₂ c₂ _ => .node a₂ c₂ .nil | .node a₁ c₁ _, .nil => .node a₁ c₁ .nil | .node a₁ c₁ _, .node a₂ c₂ _ => if le a₁ a₂ then .node a₁ (.node a₂ c₂ c₁) .nil else .node a₂ (.node a₁ c₁ c₂) .nil @[specialize] def Heap.combine (le : α → α → Bool) : Heap α → Heap α | h₁@(.node _ _ h₂@(.node _ _ s)) => merge le (merge le h₁ h₂) (s.combine le) | h => h @[inline] def Heap.headD (a : α) : Heap α → α | .nil => a | .node a _ _ => a @[inline] def Heap.head? : Heap α → Option α | .nil => none | .node a _ _ => some a @[inline] def Heap.deleteMin (le : α → α → Bool) : Heap α → Option (α × Heap α) | .nil => none | .node a c _ => (a, combine le c) @[inline] def Heap.tail? (le : α → α → Bool) (h : Heap α) : Option (Heap α) := deleteMin le h |>.map (·.snd) @[inline] def Heap.tail (le : α → α → Bool) (h : Heap α) : Heap α := tail? le h |>.getD .nil inductive Heap.NoSibling : Heap α → Prop | nil : NoSibling .nil | node (a c) : NoSibling (.node a c .nil) instance : Decidable (Heap.NoSibling s) := match s with | .nil => isTrue .nil | .node a c .nil => isTrue (.node a c) | .node _ _ (.node _ _ _) => isFalse nofun theorem Heap.noSibling_merge (le) (s₁ s₂ : Heap α) : (s₁.merge le s₂).NoSibling := by unfold merge (split <;> try split) <;> constructor theorem Heap.noSibling_combine (le) (s : Heap α) : (s.combine le).NoSibling := by unfold combine; split · exact noSibling_merge _ _ _ · match s with | nil | node _ _ nil => constructor | node _ _ (node _ _ s) => rename_i h; exact (h _ _ _ _ _ rfl).elim theorem Heap.noSibling_deleteMin {s : Heap α} (eq : s.deleteMin le = some (a, s')) : s'.NoSibling := by cases s with cases eq | node a c => exact noSibling_combine _ _ theorem Heap.noSibling_tail? {s : Heap α} : s.tail? le = some s' → s'.NoSibling := by simp only [Heap.tail?]; intro eq match eq₂ : s.deleteMin le, eq with | some (a, tl), rfl => exact noSibling_deleteMin eq₂
.lake/packages/batteries/Batteries/Data/PairingHeap.lean
113
117
theorem Heap.noSibling_tail (le) (s : Heap α) : (s.tail le).NoSibling := by
simp only [Heap.tail] match eq : s.tail? le with | none => cases s with cases eq | nil => constructor | some tl => exact Heap.noSibling_tail? eq
0
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order import Mathlib.Topology.Order.LeftRightLim #align_import measure_theory.measure.stieltjes from "leanprover-community/mathlib"@"20d5763051978e9bc6428578ed070445df6a18b3" noncomputable section open scoped Classical open Set Filter Function ENNReal NNReal Topology MeasureTheory open ENNReal (ofReal) structure StieltjesFunction where toFun : ℝ → ℝ mono' : Monotone toFun right_continuous' : ∀ x, ContinuousWithinAt toFun (Ici x) x #align stieltjes_function StieltjesFunction #align stieltjes_function.to_fun StieltjesFunction.toFun #align stieltjes_function.mono' StieltjesFunction.mono' #align stieltjes_function.right_continuous' StieltjesFunction.right_continuous' namespace StieltjesFunction attribute [coe] toFun instance instCoeFun : CoeFun StieltjesFunction fun _ => ℝ → ℝ := ⟨toFun⟩ #align stieltjes_function.has_coe_to_fun StieltjesFunction.instCoeFun initialize_simps_projections StieltjesFunction (toFun → apply) @[ext] lemma ext {f g : StieltjesFunction} (h : ∀ x, f x = g x) : f = g := by exact (StieltjesFunction.mk.injEq ..).mpr (funext (by exact h)) variable (f : StieltjesFunction) theorem mono : Monotone f := f.mono' #align stieltjes_function.mono StieltjesFunction.mono theorem right_continuous (x : ℝ) : ContinuousWithinAt f (Ici x) x := f.right_continuous' x #align stieltjes_function.right_continuous StieltjesFunction.right_continuous theorem rightLim_eq (f : StieltjesFunction) (x : ℝ) : Function.rightLim f x = f x := by rw [← f.mono.continuousWithinAt_Ioi_iff_rightLim_eq, continuousWithinAt_Ioi_iff_Ici] exact f.right_continuous' x #align stieltjes_function.right_lim_eq StieltjesFunction.rightLim_eq theorem iInf_Ioi_eq (f : StieltjesFunction) (x : ℝ) : ⨅ r : Ioi x, f r = f x := by suffices Function.rightLim f x = ⨅ r : Ioi x, f r by rw [← this, f.rightLim_eq] rw [f.mono.rightLim_eq_sInf, sInf_image'] rw [← neBot_iff] infer_instance #align stieltjes_function.infi_Ioi_eq StieltjesFunction.iInf_Ioi_eq theorem iInf_rat_gt_eq (f : StieltjesFunction) (x : ℝ) : ⨅ r : { r' : ℚ // x < r' }, f r = f x := by rw [← iInf_Ioi_eq f x] refine (Real.iInf_Ioi_eq_iInf_rat_gt _ ?_ f.mono).symm refine ⟨f x, fun y => ?_⟩ rintro ⟨y, hy_mem, rfl⟩ exact f.mono (le_of_lt hy_mem) #align stieltjes_function.infi_rat_gt_eq StieltjesFunction.iInf_rat_gt_eq @[simps] protected def id : StieltjesFunction where toFun := id mono' _ _ := id right_continuous' _ := continuousWithinAt_id #align stieltjes_function.id StieltjesFunction.id #align stieltjes_function.id_apply StieltjesFunction.id_apply @[simp] theorem id_leftLim (x : ℝ) : leftLim StieltjesFunction.id x = x := tendsto_nhds_unique (StieltjesFunction.id.mono.tendsto_leftLim x) <| continuousAt_id.tendsto.mono_left nhdsWithin_le_nhds #align stieltjes_function.id_left_lim StieltjesFunction.id_leftLim instance instInhabited : Inhabited StieltjesFunction := ⟨StieltjesFunction.id⟩ #align stieltjes_function.inhabited StieltjesFunction.instInhabited noncomputable def _root_.Monotone.stieltjesFunction {f : ℝ → ℝ} (hf : Monotone f) : StieltjesFunction where toFun := rightLim f mono' x y hxy := hf.rightLim hxy right_continuous' := by intro x s hs obtain ⟨l, u, hlu, lus⟩ : ∃ l u : ℝ, rightLim f x ∈ Ioo l u ∧ Ioo l u ⊆ s := mem_nhds_iff_exists_Ioo_subset.1 hs obtain ⟨y, xy, h'y⟩ : ∃ (y : ℝ), x < y ∧ Ioc x y ⊆ f ⁻¹' Ioo l u := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 (hf.tendsto_rightLim x (Ioo_mem_nhds hlu.1 hlu.2)) change ∀ᶠ y in 𝓝[≥] x, rightLim f y ∈ s filter_upwards [Ico_mem_nhdsWithin_Ici ⟨le_refl x, xy⟩] with z hz apply lus refine ⟨hlu.1.trans_le (hf.rightLim hz.1), ?_⟩ obtain ⟨a, za, ay⟩ : ∃ a : ℝ, z < a ∧ a < y := exists_between hz.2 calc rightLim f z ≤ f a := hf.rightLim_le za _ < u := (h'y ⟨hz.1.trans_lt za, ay.le⟩).2 #align monotone.stieltjes_function Monotone.stieltjesFunction theorem _root_.Monotone.stieltjesFunction_eq {f : ℝ → ℝ} (hf : Monotone f) (x : ℝ) : hf.stieltjesFunction x = rightLim f x := rfl #align monotone.stieltjes_function_eq Monotone.stieltjesFunction_eq
Mathlib/MeasureTheory/Measure/Stieltjes.lean
138
142
theorem countable_leftLim_ne (f : StieltjesFunction) : Set.Countable { x | leftLim f x ≠ f x } := by
refine Countable.mono ?_ f.mono.countable_not_continuousAt intro x hx h'x apply hx exact tendsto_nhds_unique (f.mono.tendsto_leftLim x) (h'x.tendsto.mono_left nhdsWithin_le_nhds)
0
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.ldl from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" variable {𝕜 : Type*} [RCLike 𝕜] variable {n : Type*} [LinearOrder n] [IsWellOrder n (· < ·)] [LocallyFiniteOrderBot n] section set_options set_option linter.uppercaseLean3 false set_option quotPrecheck false local notation "⟪" x ", " y "⟫ₑ" => @inner 𝕜 _ _ ((WithLp.equiv 2 _).symm x) ((WithLp.equiv _ _).symm y) open Matrix open scoped Matrix ComplexOrder variable {S : Matrix n n 𝕜} [Fintype n] (hS : S.PosDef) noncomputable def LDL.lowerInv : Matrix n n 𝕜 := @gramSchmidt 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _ (Pi.basisFun 𝕜 n) #align LDL.lower_inv LDL.lowerInv theorem LDL.lowerInv_eq_gramSchmidtBasis : LDL.lowerInv hS = ((Pi.basisFun 𝕜 n).toMatrix (@gramSchmidtBasis 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _ (Pi.basisFun 𝕜 n)))ᵀ := by letI := NormedAddCommGroup.ofMatrix hS.transpose letI := InnerProductSpace.ofMatrix hS.transpose ext i j rw [LDL.lowerInv, Basis.coePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis] rfl #align LDL.lower_inv_eq_gram_schmidt_basis LDL.lowerInv_eq_gramSchmidtBasis noncomputable instance LDL.invertibleLowerInv : Invertible (LDL.lowerInv hS) := by rw [LDL.lowerInv_eq_gramSchmidtBasis] haveI := Basis.invertibleToMatrix (Pi.basisFun 𝕜 n) (@gramSchmidtBasis 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _ (Pi.basisFun 𝕜 n)) infer_instance #align LDL.invertible_lower_inv LDL.invertibleLowerInv theorem LDL.lowerInv_orthogonal {i j : n} (h₀ : i ≠ j) : ⟪LDL.lowerInv hS i, Sᵀ *ᵥ LDL.lowerInv hS j⟫ₑ = 0 := @gramSchmidt_orthogonal 𝕜 _ _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) _ _ _ _ _ _ _ h₀ #align LDL.lower_inv_orthogonal LDL.lowerInv_orthogonal noncomputable def LDL.diagEntries : n → 𝕜 := fun i => ⟪star (LDL.lowerInv hS i), S *ᵥ star (LDL.lowerInv hS i)⟫ₑ #align LDL.diag_entries LDL.diagEntries noncomputable def LDL.diag : Matrix n n 𝕜 := Matrix.diagonal (LDL.diagEntries hS) #align LDL.diag LDL.diag
Mathlib/LinearAlgebra/Matrix/LDL.lean
93
97
theorem LDL.lowerInv_triangular {i j : n} (hij : i < j) : LDL.lowerInv hS i j = 0 := by
rw [← @gramSchmidt_triangular 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _ i j hij (Pi.basisFun 𝕜 n), Pi.basisFun_repr, LDL.lowerInv]
0
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Data.Nat.Choose.Basic #align_import data.nat.choose.vandermonde from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31" open Polynomial Finset Finset.Nat
Mathlib/Data/Nat/Choose/Vandermonde.lean
27
34
theorem Nat.add_choose_eq (m n k : ℕ) : (m + n).choose k = ∑ ij ∈ antidiagonal k, m.choose ij.1 * n.choose ij.2 := by
calc (m + n).choose k = ((X + 1) ^ (m + n)).coeff k := by rw [coeff_X_add_one_pow, Nat.cast_id] _ = ((X + 1) ^ m * (X + 1) ^ n).coeff k := by rw [pow_add] _ = ∑ ij ∈ antidiagonal k, m.choose ij.1 * n.choose ij.2 := by rw [coeff_mul, Finset.sum_congr rfl] simp only [coeff_X_add_one_pow, Nat.cast_id, eq_self_iff_true, imp_true_iff]
0
import Mathlib.RingTheory.FinitePresentation import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.Localization.Away.AdjoinRoot import Mathlib.RingTheory.QuotientNilpotent import Mathlib.RingTheory.TensorProduct.Basic -- Porting note: added to make the syntax work below. open scoped TensorProduct universe u namespace Algebra section variable (R : Type u) [CommSemiring R] variable (A : Type u) [Semiring A] [Algebra R A] @[mk_iff] class FormallyUnramified : Prop where comp_injective : ∀ ⦃B : Type u⦄ [CommRing B], ∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥), Function.Injective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I) #align algebra.formally_unramified Algebra.FormallyUnramified end namespace FormallyUnramified section variable {R : Type u} [CommSemiring R] variable {A : Type u} [Semiring A] [Algebra R A] variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B) theorem lift_unique {B : Type u} [CommRing B] [_RB : Algebra R B] [FormallyUnramified R A] (I : Ideal B) (hI : IsNilpotent I) (g₁ g₂ : A →ₐ[R] B) (h : (Ideal.Quotient.mkₐ R I).comp g₁ = (Ideal.Quotient.mkₐ R I).comp g₂) : g₁ = g₂ := by revert g₁ g₂ change Function.Injective (Ideal.Quotient.mkₐ R I).comp revert _RB apply Ideal.IsNilpotent.induction_on (R := B) I hI · intro B _ I hI _; exact FormallyUnramified.comp_injective I hI · intro B _ I J hIJ h₁ h₂ _ g₁ g₂ e apply h₁ apply h₂ ext x replace e := AlgHom.congr_fun e x dsimp only [AlgHom.comp_apply, Ideal.Quotient.mkₐ_eq_mk] at e ⊢ rwa [Ideal.Quotient.eq, ← map_sub, Ideal.mem_quotient_iff_mem hIJ, ← Ideal.Quotient.eq] #align algebra.formally_unramified.lift_unique Algebra.FormallyUnramified.lift_unique theorem ext [FormallyUnramified R A] (hI : IsNilpotent I) {g₁ g₂ : A →ₐ[R] B} (H : ∀ x, Ideal.Quotient.mk I (g₁ x) = Ideal.Quotient.mk I (g₂ x)) : g₁ = g₂ := FormallyUnramified.lift_unique I hI g₁ g₂ (AlgHom.ext H) #align algebra.formally_unramified.ext Algebra.FormallyUnramified.ext theorem lift_unique_of_ringHom [FormallyUnramified R A] {C : Type u} [CommRing C] (f : B →+* C) (hf : IsNilpotent <| RingHom.ker f) (g₁ g₂ : A →ₐ[R] B) (h : f.comp ↑g₁ = f.comp (g₂ : A →+* B)) : g₁ = g₂ := FormallyUnramified.lift_unique _ hf _ _ (by ext x have := RingHom.congr_fun h x simpa only [Ideal.Quotient.eq, Function.comp_apply, AlgHom.coe_comp, Ideal.Quotient.mkₐ_eq_mk, RingHom.mem_ker, map_sub, sub_eq_zero]) #align algebra.formally_unramified.lift_unique_of_ring_hom Algebra.FormallyUnramified.lift_unique_of_ringHom theorem ext' [FormallyUnramified R A] {C : Type u} [CommRing C] (f : B →+* C) (hf : IsNilpotent <| RingHom.ker f) (g₁ g₂ : A →ₐ[R] B) (h : ∀ x, f (g₁ x) = f (g₂ x)) : g₁ = g₂ := FormallyUnramified.lift_unique_of_ringHom f hf g₁ g₂ (RingHom.ext h) #align algebra.formally_unramified.ext' Algebra.FormallyUnramified.ext' theorem lift_unique' [FormallyUnramified R A] {C : Type u} [CommRing C] [Algebra R C] (f : B →ₐ[R] C) (hf : IsNilpotent <| RingHom.ker (f : B →+* C)) (g₁ g₂ : A →ₐ[R] B) (h : f.comp g₁ = f.comp g₂) : g₁ = g₂ := FormallyUnramified.ext' _ hf g₁ g₂ (AlgHom.congr_fun h) #align algebra.formally_unramified.lift_unique' Algebra.FormallyUnramified.lift_unique' end section Comp variable (R : Type u) [CommSemiring R] variable (A : Type u) [CommSemiring A] [Algebra R A] variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
Mathlib/RingTheory/Unramified/Basic.lean
139
152
theorem comp [FormallyUnramified R A] [FormallyUnramified A B] : FormallyUnramified R B := by
constructor intro C _ _ I hI f₁ f₂ e have e' := FormallyUnramified.lift_unique I ⟨2, hI⟩ (f₁.comp <| IsScalarTower.toAlgHom R A B) (f₂.comp <| IsScalarTower.toAlgHom R A B) (by rw [← AlgHom.comp_assoc, e, AlgHom.comp_assoc]) letI := (f₁.comp (IsScalarTower.toAlgHom R A B)).toRingHom.toAlgebra let F₁ : B →ₐ[A] C := { f₁ with commutes' := fun r => rfl } let F₂ : B →ₐ[A] C := { f₂ with commutes' := AlgHom.congr_fun e'.symm } ext1 x change F₁ x = F₂ x congr exact FormallyUnramified.ext I ⟨2, hI⟩ (AlgHom.congr_fun e)
0
import Mathlib.Analysis.Calculus.ContDiff.Defs import Mathlib.Analysis.Calculus.FDeriv.Add import Mathlib.Analysis.Calculus.FDeriv.Mul import Mathlib.Analysis.Calculus.Deriv.Inverse #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical NNReal Nat local notation "∞" => (⊤ : ℕ∞) universe u v w uD uE uF uG attribute [local instance 1001] NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid open Set Fin Filter Function open scoped Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {D : Type uD} [NormedAddCommGroup D] [NormedSpace 𝕜 D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {X : Type*} [NormedAddCommGroup X] [NormedSpace 𝕜 X] {s s₁ t u : Set E} {f f₁ : E → F} {g : F → G} {x x₀ : E} {c : F} {b : E × F → G} {m n : ℕ∞} {p : E → FormalMultilinearSeries 𝕜 E F} @[simp] theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {i : ℕ} : iteratedFDerivWithin 𝕜 i (fun _ : E ↦ (0 : F)) s x = 0 := by induction i generalizing x with | zero => ext; simp | succ i IH => ext m rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ ↦ IH) (IH hx)] rw [fderivWithin_const_apply _ (hs x hx)] rfl @[simp] theorem iteratedFDeriv_zero_fun {n : ℕ} : (iteratedFDeriv 𝕜 n fun _ : E ↦ (0 : F)) = 0 := funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x) #align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun theorem contDiff_zero_fun : ContDiff 𝕜 n fun _ : E => (0 : F) := contDiff_of_differentiable_iteratedFDeriv fun m _ => by rw [iteratedFDeriv_zero_fun] exact differentiable_const (0 : E[×m]→L[𝕜] F) #align cont_diff_zero_fun contDiff_zero_fun theorem contDiff_const {c : F} : ContDiff 𝕜 n fun _ : E => c := by suffices h : ContDiff 𝕜 ∞ fun _ : E => c from h.of_le le_top rw [contDiff_top_iff_fderiv] refine ⟨differentiable_const c, ?_⟩ rw [fderiv_const] exact contDiff_zero_fun #align cont_diff_const contDiff_const theorem contDiffOn_const {c : F} {s : Set E} : ContDiffOn 𝕜 n (fun _ : E => c) s := contDiff_const.contDiffOn #align cont_diff_on_const contDiffOn_const theorem contDiffAt_const {c : F} : ContDiffAt 𝕜 n (fun _ : E => c) x := contDiff_const.contDiffAt #align cont_diff_at_const contDiffAt_const theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt 𝕜 n (fun _ : E => c) s x := contDiffAt_const.contDiffWithinAt #align cont_diff_within_at_const contDiffWithinAt_const @[nontriviality] theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff 𝕜 n f := by rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const #align cont_diff_of_subsingleton contDiff_of_subsingleton @[nontriviality] theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt 𝕜 n f x := by rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const #align cont_diff_at_of_subsingleton contDiffAt_of_subsingleton @[nontriviality] theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt 𝕜 n f s x := by rw [Subsingleton.elim f fun _ => 0]; exact contDiffWithinAt_const #align cont_diff_within_at_of_subsingleton contDiffWithinAt_of_subsingleton @[nontriviality] theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn 𝕜 n f s := by rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const #align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton
Mathlib/Analysis/Calculus/ContDiff/Basic.lean
126
132
theorem iteratedFDerivWithin_succ_const (n : ℕ) (c : F) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) : iteratedFDerivWithin 𝕜 (n + 1) (fun _ : E ↦ c) s x = 0 := by
ext m rw [iteratedFDerivWithin_succ_apply_right hs hx] rw [iteratedFDerivWithin_congr (fun y hy ↦ fderivWithin_const_apply c (hs y hy)) hx] rw [iteratedFDerivWithin_zero_fun hs hx] simp [ContinuousMultilinearMap.zero_apply (R := 𝕜)]
0
import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.NormedSpace.LinearIsometry #align_import analysis.normed_space.conformal_linear_map from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1" noncomputable section open Function LinearIsometry ContinuousLinearMap def IsConformalMap {R : Type*} {X Y : Type*} [NormedField R] [SeminormedAddCommGroup X] [SeminormedAddCommGroup Y] [NormedSpace R X] [NormedSpace R Y] (f' : X →L[R] Y) := ∃ c ≠ (0 : R), ∃ li : X →ₗᵢ[R] Y, f' = c • li.toContinuousLinearMap #align is_conformal_map IsConformalMap variable {R M N G M' : Type*} [NormedField R] [SeminormedAddCommGroup M] [SeminormedAddCommGroup N] [SeminormedAddCommGroup G] [NormedSpace R M] [NormedSpace R N] [NormedSpace R G] [NormedAddCommGroup M'] [NormedSpace R M'] {f : M →L[R] N} {g : N →L[R] G} {c : R} theorem isConformalMap_id : IsConformalMap (id R M) := ⟨1, one_ne_zero, id, by simp⟩ #align is_conformal_map_id isConformalMap_id theorem IsConformalMap.smul (hf : IsConformalMap f) {c : R} (hc : c ≠ 0) : IsConformalMap (c • f) := by rcases hf with ⟨c', hc', li, rfl⟩ exact ⟨c * c', mul_ne_zero hc hc', li, smul_smul _ _ _⟩ #align is_conformal_map.smul IsConformalMap.smul theorem isConformalMap_const_smul (hc : c ≠ 0) : IsConformalMap (c • id R M) := isConformalMap_id.smul hc #align is_conformal_map_const_smul isConformalMap_const_smul protected theorem LinearIsometry.isConformalMap (f' : M →ₗᵢ[R] N) : IsConformalMap f'.toContinuousLinearMap := ⟨1, one_ne_zero, f', (one_smul _ _).symm⟩ #align linear_isometry.is_conformal_map LinearIsometry.isConformalMap @[nontriviality] theorem isConformalMap_of_subsingleton [Subsingleton M] (f' : M →L[R] N) : IsConformalMap f' := ⟨1, one_ne_zero, ⟨0, fun x => by simp [Subsingleton.elim x 0]⟩, Subsingleton.elim _ _⟩ #align is_conformal_map_of_subsingleton isConformalMap_of_subsingleton namespace IsConformalMap
Mathlib/Analysis/NormedSpace/ConformalLinearMap.lean
84
89
theorem comp (hg : IsConformalMap g) (hf : IsConformalMap f) : IsConformalMap (g.comp f) := by
rcases hf with ⟨cf, hcf, lif, rfl⟩ rcases hg with ⟨cg, hcg, lig, rfl⟩ refine ⟨cg * cf, mul_ne_zero hcg hcf, lig.comp lif, ?_⟩ rw [smul_comp, comp_smul, mul_smul] rfl
0
import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.NormalClosure import Mathlib.RingTheory.Polynomial.SeparableDegree open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField Field noncomputable section universe u v w variable (F : Type u) (E : Type v) [Field F] [Field E] [Algebra F E] variable (K : Type w) [Field K] [Algebra F K] namespace Field def Emb := E →ₐ[F] AlgebraicClosure E def finSepDegree : ℕ := Nat.card (Emb F E) instance instInhabitedEmb : Inhabited (Emb F E) := ⟨IsScalarTower.toAlgHom F E _⟩ instance instNeZeroFinSepDegree [FiniteDimensional F E] : NeZero (finSepDegree F E) := ⟨Nat.card_ne_zero.2 ⟨inferInstance, Fintype.finite <| minpoly.AlgHom.fintype _ _ _⟩⟩ def embEquivOfEquiv (i : E ≃ₐ[F] K) : Emb F E ≃ Emb F K := AlgEquiv.arrowCongr i <| AlgEquiv.symm <| by let _ : Algebra E K := i.toAlgHom.toRingHom.toAlgebra have : Algebra.IsAlgebraic E K := by constructor intro x have h := isAlgebraic_algebraMap (R := E) (A := K) (i.symm.toAlgHom x) rw [show ∀ y : E, (algebraMap E K) y = i.toAlgHom y from fun y ↦ rfl] at h simpa only [AlgEquiv.toAlgHom_eq_coe, AlgHom.coe_coe, AlgEquiv.apply_symm_apply] using h apply AlgEquiv.restrictScalars (R := F) (S := E) exact IsAlgClosure.equivOfAlgebraic E K (AlgebraicClosure K) (AlgebraicClosure E) theorem finSepDegree_eq_of_equiv (i : E ≃ₐ[F] K) : finSepDegree F E = finSepDegree F K := Nat.card_congr (embEquivOfEquiv F E K i) @[simp]
Mathlib/FieldTheory/SeparableDegree.lean
168
172
theorem finSepDegree_self : finSepDegree F F = 1 := by
have : Cardinal.mk (Emb F F) = 1 := le_antisymm (Cardinal.le_one_iff_subsingleton.2 AlgHom.subsingleton) (Cardinal.one_le_iff_ne_zero.2 <| Cardinal.mk_ne_zero _) rw [finSepDegree, Nat.card, this, Cardinal.one_toNat]
0
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal #align_import analysis.special_functions.pow.asymptotics from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" set_option linter.uppercaseLean3 false noncomputable section open scoped Classical open Real Topology NNReal ENNReal Filter ComplexConjugate Finset Set section Limits open Real Filter theorem tendsto_rpow_atTop {y : ℝ} (hy : 0 < y) : Tendsto (fun x : ℝ => x ^ y) atTop atTop := by rw [tendsto_atTop_atTop] intro b use max b 0 ^ (1 / y) intro x hx exact le_of_max_le_left (by convert rpow_le_rpow (rpow_nonneg (le_max_right b 0) (1 / y)) hx (le_of_lt hy) using 1 rw [← rpow_mul (le_max_right b 0), (eq_div_iff (ne_of_gt hy)).mp rfl, Real.rpow_one]) #align tendsto_rpow_at_top tendsto_rpow_atTop theorem tendsto_rpow_neg_atTop {y : ℝ} (hy : 0 < y) : Tendsto (fun x : ℝ => x ^ (-y)) atTop (𝓝 0) := Tendsto.congr' (eventuallyEq_of_mem (Ioi_mem_atTop 0) fun _ hx => (rpow_neg (le_of_lt hx) y).symm) (tendsto_rpow_atTop hy).inv_tendsto_atTop #align tendsto_rpow_neg_at_top tendsto_rpow_neg_atTop open Asymptotics in lemma tendsto_rpow_atTop_of_base_lt_one (b : ℝ) (hb₀ : -1 < b) (hb₁ : b < 1) : Tendsto (b ^ · : ℝ → ℝ) atTop (𝓝 (0:ℝ)) := by rcases lt_trichotomy b 0 with hb|rfl|hb case inl => -- b < 0 simp_rw [Real.rpow_def_of_nonpos hb.le, hb.ne, ite_false] rw [← isLittleO_const_iff (c := (1:ℝ)) one_ne_zero, (one_mul (1 : ℝ)).symm] refine IsLittleO.mul_isBigO ?exp ?cos case exp => rw [isLittleO_const_iff one_ne_zero] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_neg ?_).mpr tendsto_id rw [← log_neg_eq_log, log_neg_iff (by linarith)] linarith case cos => rw [isBigO_iff] exact ⟨1, eventually_of_forall fun x => by simp [Real.abs_cos_le_one]⟩ case inr.inl => -- b = 0 refine Tendsto.mono_right ?_ (Iff.mpr pure_le_nhds_iff rfl) rw [tendsto_pure] filter_upwards [eventually_ne_atTop 0] with _ hx simp [hx] case inr.inr => -- b > 0 simp_rw [Real.rpow_def_of_pos hb] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_neg ?_).mpr tendsto_id exact (log_neg_iff hb).mpr hb₁ lemma tendsto_rpow_atTop_of_base_gt_one (b : ℝ) (hb : 1 < b) : Tendsto (b ^ · : ℝ → ℝ) atBot (𝓝 (0:ℝ)) := by simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_pos ?_).mpr tendsto_id exact (log_pos_iff (by positivity)).mpr <| by aesop lemma tendsto_rpow_atBot_of_base_lt_one (b : ℝ) (hb₀ : 0 < b) (hb₁ : b < 1) : Tendsto (b ^ · : ℝ → ℝ) atBot atTop := by simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)] refine tendsto_exp_atTop.comp <| (tendsto_const_mul_atTop_iff_neg <| tendsto_id (α := ℝ)).mpr ?_ exact (log_neg_iff hb₀).mpr hb₁ lemma tendsto_rpow_atBot_of_base_gt_one (b : ℝ) (hb : 1 < b) : Tendsto (b ^ · : ℝ → ℝ) atBot (𝓝 0) := by simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)] refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_iff_pos <| tendsto_id (α := ℝ)).mpr ?_ exact (log_pos_iff (by positivity)).mpr <| by aesop theorem tendsto_rpow_div_mul_add (a b c : ℝ) (hb : 0 ≠ b) : Tendsto (fun x => x ^ (a / (b * x + c))) atTop (𝓝 1) := by refine Tendsto.congr' ?_ ((tendsto_exp_nhds_zero_nhds_one.comp (by simpa only [mul_zero, pow_one] using (tendsto_const_nhds (x := a)).mul (tendsto_div_pow_mul_exp_add_atTop b c 1 hb))).comp tendsto_log_atTop) apply eventuallyEq_of_mem (Ioi_mem_atTop (0 : ℝ)) intro x hx simp only [Set.mem_Ioi, Function.comp_apply] at hx ⊢ rw [exp_log hx, ← exp_log (rpow_pos_of_pos hx (a / (b * x + c))), log_rpow hx (a / (b * x + c))] field_simp #align tendsto_rpow_div_mul_add tendsto_rpow_div_mul_add theorem tendsto_rpow_div : Tendsto (fun x => x ^ ((1 : ℝ) / x)) atTop (𝓝 1) := by convert tendsto_rpow_div_mul_add (1 : ℝ) _ (0 : ℝ) zero_ne_one ring #align tendsto_rpow_div tendsto_rpow_div theorem tendsto_rpow_neg_div : Tendsto (fun x => x ^ (-(1 : ℝ) / x)) atTop (𝓝 1) := by convert tendsto_rpow_div_mul_add (-(1 : ℝ)) _ (0 : ℝ) zero_ne_one ring #align tendsto_rpow_neg_div tendsto_rpow_neg_div
Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean
132
137
theorem tendsto_exp_div_rpow_atTop (s : ℝ) : Tendsto (fun x : ℝ => exp x / x ^ s) atTop atTop := by
cases' archimedean_iff_nat_lt.1 Real.instArchimedean s with n hn refine tendsto_atTop_mono' _ ?_ (tendsto_exp_div_pow_atTop n) filter_upwards [eventually_gt_atTop (0 : ℝ), eventually_ge_atTop (1 : ℝ)] with x hx₀ hx₁ rw [div_le_div_left (exp_pos _) (pow_pos hx₀ _) (rpow_pos_of_pos hx₀ _), ← Real.rpow_natCast] exact rpow_le_rpow_of_exponent_le hx₁ hn.le
0
import Mathlib.Analysis.Calculus.FDeriv.Equiv import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn #align_import analysis.calculus.inverse from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Function Set Filter Metric open scoped Topology Classical NNReal noncomputable section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {ε : ℝ} open Asymptotics Filter Metric Set open ContinuousLinearMap (id) namespace HasStrictFDerivAt theorem approximates_deriv_on_nhds {f : E → F} {f' : E →L[𝕜] F} {a : E} (hf : HasStrictFDerivAt f f' a) {c : ℝ≥0} (hc : Subsingleton E ∨ 0 < c) : ∃ s ∈ 𝓝 a, ApproximatesLinearOn f f' s c := by cases' hc with hE hc · refine ⟨univ, IsOpen.mem_nhds isOpen_univ trivial, fun x _ y _ => ?_⟩ simp [@Subsingleton.elim E hE x y] have := hf.def hc rw [nhds_prod_eq, Filter.Eventually, mem_prod_same_iff] at this rcases this with ⟨s, has, hs⟩ exact ⟨s, has, fun x hx y hy => hs (mk_mem_prod hx hy)⟩ #align has_strict_fderiv_at.approximates_deriv_on_nhds HasStrictFDerivAt.approximates_deriv_on_nhds
Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean
86
96
theorem map_nhds_eq_of_surj [CompleteSpace E] [CompleteSpace F] {f : E → F} {f' : E →L[𝕜] F} {a : E} (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) (h : LinearMap.range f' = ⊤) : map f (𝓝 a) = 𝓝 (f a) := by
let f'symm := f'.nonlinearRightInverseOfSurjective h set c : ℝ≥0 := f'symm.nnnorm⁻¹ / 2 with hc have f'symm_pos : 0 < f'symm.nnnorm := f'.nonlinearRightInverseOfSurjective_nnnorm_pos h have cpos : 0 < c := by simp [hc, half_pos, inv_pos, f'symm_pos] obtain ⟨s, s_nhds, hs⟩ : ∃ s ∈ 𝓝 a, ApproximatesLinearOn f f' s c := hf.approximates_deriv_on_nhds (Or.inr cpos) apply hs.map_nhds_eq f'symm s_nhds (Or.inr (NNReal.half_lt_self _)) simp [ne_of_gt f'symm_pos]
0
import Mathlib.Algebra.Lie.BaseChange import Mathlib.Algebra.Lie.Solvable import Mathlib.Algebra.Lie.Quotient import Mathlib.Algebra.Lie.Normalizer import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.Order.Filter.AtTopBot import Mathlib.RingTheory.Artinian import Mathlib.RingTheory.Nilpotent.Lemmas import Mathlib.Tactic.Monotonicity #align_import algebra.lie.nilpotent from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" universe u v w w₁ w₂ section NilpotentModules variable {R : Type u} {L : Type v} {M : Type w} variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M] variable [LieRingModule L M] [LieModule R L M] variable (k : ℕ) (N : LieSubmodule R L M) namespace LieSubmodule variable {N₁ N₂ : LieSubmodule R L M} def ucs (k : ℕ) : LieSubmodule R L M → LieSubmodule R L M := normalizer^[k] #align lie_submodule.ucs LieSubmodule.ucs @[simp] theorem ucs_zero : N.ucs 0 = N := rfl #align lie_submodule.ucs_zero LieSubmodule.ucs_zero @[simp] theorem ucs_succ (k : ℕ) : N.ucs (k + 1) = (N.ucs k).normalizer := Function.iterate_succ_apply' normalizer k N #align lie_submodule.ucs_succ LieSubmodule.ucs_succ theorem ucs_add (k l : ℕ) : N.ucs (k + l) = (N.ucs l).ucs k := Function.iterate_add_apply normalizer k l N #align lie_submodule.ucs_add LieSubmodule.ucs_add @[mono] theorem ucs_mono (k : ℕ) (h : N₁ ≤ N₂) : N₁.ucs k ≤ N₂.ucs k := by induction' k with k ih · simpa simp only [ucs_succ] -- Porting note: `mono` makes no progress apply monotone_normalizer ih #align lie_submodule.ucs_mono LieSubmodule.ucs_mono
Mathlib/Algebra/Lie/Nilpotent.lean
493
496
theorem ucs_eq_self_of_normalizer_eq_self (h : N₁.normalizer = N₁) (k : ℕ) : N₁.ucs k = N₁ := by
induction' k with k ih · simp · rwa [ucs_succ, ih]
0
import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Order.BigOperators.Group.List import Mathlib.Data.Set.Pointwise.SMul import Mathlib.Order.WellFoundedSet #align_import group_theory.submonoid.pointwise from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e" open Set Pointwise variable {α : Type*} {G : Type*} {M : Type*} {R : Type*} {A : Type*} variable [Monoid M] [AddMonoid A] namespace Submonoid namespace AddSubmonoid namespace Set.IsPWO variable [OrderedCancelCommMonoid α] {s : Set α} @[to_additive]
Mathlib/Algebra/Group/Submonoid/Pointwise.lean
700
704
theorem submonoid_closure (hpos : ∀ x : α, x ∈ s → 1 ≤ x) (h : s.IsPWO) : IsPWO (Submonoid.closure s : Set α) := by
rw [Submonoid.closure_eq_image_prod] refine (h.partiallyWellOrderedOn_sublistForall₂ (· ≤ ·)).image_of_monotone_on ?_ exact fun l1 _ l2 hl2 h12 => h12.prod_le_prod' fun x hx => hpos x <| hl2 x hx
0
import Mathlib.Data.Int.Interval import Mathlib.RingTheory.Binomial import Mathlib.RingTheory.HahnSeries.PowerSeries import Mathlib.RingTheory.HahnSeries.Summable import Mathlib.FieldTheory.RatFunc.AsPolynomial import Mathlib.RingTheory.Localization.FractionRing #align_import ring_theory.laurent_series from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" universe u open scoped Classical open HahnSeries Polynomial noncomputable section abbrev LaurentSeries (R : Type u) [Zero R] := HahnSeries ℤ R #align laurent_series LaurentSeries variable {R : Type*} namespace LaurentSeries section Semiring variable [Semiring R] instance : Coe (PowerSeries R) (LaurentSeries R) := ⟨HahnSeries.ofPowerSeries ℤ R⟩ #noalign laurent_series.coe_power_series @[simp] theorem coeff_coe_powerSeries (x : PowerSeries R) (n : ℕ) : HahnSeries.coeff (x : LaurentSeries R) n = PowerSeries.coeff R n x := by rw [ofPowerSeries_apply_coeff] #align laurent_series.coeff_coe_power_series LaurentSeries.coeff_coe_powerSeries def powerSeriesPart (x : LaurentSeries R) : PowerSeries R := PowerSeries.mk fun n => x.coeff (x.order + n) #align laurent_series.power_series_part LaurentSeries.powerSeriesPart @[simp] theorem powerSeriesPart_coeff (x : LaurentSeries R) (n : ℕ) : PowerSeries.coeff R n x.powerSeriesPart = x.coeff (x.order + n) := PowerSeries.coeff_mk _ _ #align laurent_series.power_series_part_coeff LaurentSeries.powerSeriesPart_coeff @[simp] theorem powerSeriesPart_zero : powerSeriesPart (0 : LaurentSeries R) = 0 := by ext simp [(PowerSeries.coeff _ _).map_zero] -- Note: this doesn't get picked up any more #align laurent_series.power_series_part_zero LaurentSeries.powerSeriesPart_zero @[simp]
Mathlib/RingTheory/LaurentSeries.lean
112
121
theorem powerSeriesPart_eq_zero (x : LaurentSeries R) : x.powerSeriesPart = 0 ↔ x = 0 := by
constructor · contrapose! simp only [ne_eq] intro h rw [PowerSeries.ext_iff, not_forall] refine ⟨0, ?_⟩ simp [coeff_order_ne_zero h] · rintro rfl simp
0
import Mathlib.Data.Set.Pointwise.Interval import Mathlib.LinearAlgebra.AffineSpace.Basic import Mathlib.LinearAlgebra.BilinearMap import Mathlib.LinearAlgebra.Pi import Mathlib.LinearAlgebra.Prod #align_import linear_algebra.affine_space.affine_map from "leanprover-community/mathlib"@"bd1fc183335ea95a9519a1630bcf901fe9326d83" open Affine structure AffineMap (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*) [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] where toFun : P1 → P2 linear : V1 →ₗ[k] V2 map_vadd' : ∀ (p : P1) (v : V1), toFun (v +ᵥ p) = linear v +ᵥ toFun p #align affine_map AffineMap notation:25 P1 " →ᵃ[" k:25 "] " P2:0 => AffineMap k P1 P2 instance AffineMap.instFunLike (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*) [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] : FunLike (P1 →ᵃ[k] P2) P1 P2 where coe := AffineMap.toFun coe_injective' := fun ⟨f, f_linear, f_add⟩ ⟨g, g_linear, g_add⟩ => fun (h : f = g) => by cases' (AddTorsor.nonempty : Nonempty P1) with p congr with v apply vadd_right_cancel (f p) erw [← f_add, h, ← g_add] #align affine_map.fun_like AffineMap.instFunLike instance AffineMap.hasCoeToFun (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*) [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] : CoeFun (P1 →ᵃ[k] P2) fun _ => P1 → P2 := DFunLike.hasCoeToFun #align affine_map.has_coe_to_fun AffineMap.hasCoeToFun namespace AffineMap variable {k : Type*} {V1 : Type*} {P1 : Type*} {V2 : Type*} {P2 : Type*} {V3 : Type*} {P3 : Type*} {V4 : Type*} {P4 : Type*} [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] [AddCommGroup V3] [Module k V3] [AffineSpace V3 P3] [AddCommGroup V4] [Module k V4] [AffineSpace V4 P4] @[simp] theorem coe_mk (f : P1 → P2) (linear add) : ((mk f linear add : P1 →ᵃ[k] P2) : P1 → P2) = f := rfl #align affine_map.coe_mk AffineMap.coe_mk @[simp] theorem toFun_eq_coe (f : P1 →ᵃ[k] P2) : f.toFun = ⇑f := rfl #align affine_map.to_fun_eq_coe AffineMap.toFun_eq_coe @[simp] theorem map_vadd (f : P1 →ᵃ[k] P2) (p : P1) (v : V1) : f (v +ᵥ p) = f.linear v +ᵥ f p := f.map_vadd' p v #align affine_map.map_vadd AffineMap.map_vadd @[simp] theorem linearMap_vsub (f : P1 →ᵃ[k] P2) (p1 p2 : P1) : f.linear (p1 -ᵥ p2) = f p1 -ᵥ f p2 := by conv_rhs => rw [← vsub_vadd p1 p2, map_vadd, vadd_vsub] #align affine_map.linear_map_vsub AffineMap.linearMap_vsub @[ext] theorem ext {f g : P1 →ᵃ[k] P2} (h : ∀ p, f p = g p) : f = g := DFunLike.ext _ _ h #align affine_map.ext AffineMap.ext theorem ext_iff {f g : P1 →ᵃ[k] P2} : f = g ↔ ∀ p, f p = g p := ⟨fun h _ => h ▸ rfl, ext⟩ #align affine_map.ext_iff AffineMap.ext_iff theorem coeFn_injective : @Function.Injective (P1 →ᵃ[k] P2) (P1 → P2) (⇑) := DFunLike.coe_injective #align affine_map.coe_fn_injective AffineMap.coeFn_injective protected theorem congr_arg (f : P1 →ᵃ[k] P2) {x y : P1} (h : x = y) : f x = f y := congr_arg _ h #align affine_map.congr_arg AffineMap.congr_arg protected theorem congr_fun {f g : P1 →ᵃ[k] P2} (h : f = g) (x : P1) : f x = g x := h ▸ rfl #align affine_map.congr_fun AffineMap.congr_fun
Mathlib/LinearAlgebra/AffineSpace/AffineMap.lean
162
169
theorem ext_linear {f g : P1 →ᵃ[k] P2} (h₁ : f.linear = g.linear) {p : P1} (h₂ : f p = g p) : f = g := by
ext q have hgl : g.linear (q -ᵥ p) = toFun g ((q -ᵥ p) +ᵥ q) -ᵥ toFun g q := by simp have := f.map_vadd' q (q -ᵥ p) rw [h₁, hgl, toFun_eq_coe, map_vadd, linearMap_vsub, h₂] at this simp at this exact this
0
import Mathlib.Data.List.Duplicate import Mathlib.Data.List.Sort #align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace List variable {α : Type*} section Sublist
Mathlib/Data/List/NodupEquivFin.lean
116
137
theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ) (hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by
induction' l with hd tl IH generalizing l' f · simp have : some hd = _ := hf 0 rw [eq_comm, List.get?_eq_some] at this obtain ⟨w, h⟩ := this let f' : ℕ ↪o ℕ := OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by dsimp only rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact b.succ_pos have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by intro ix rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact ix.succ_pos rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append] apply List.Sublist.append _ (IH _ this) rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)] apply List.get_mem
0
import Mathlib.Topology.Constructions import Mathlib.Topology.ContinuousOn #align_import topology.bases from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Set Filter Function Topology noncomputable section namespace TopologicalSpace universe u variable {α : Type u} {β : Type*} [t : TopologicalSpace α] {B : Set (Set α)} {s : Set α} structure IsTopologicalBasis (s : Set (Set α)) : Prop where exists_subset_inter : ∀ t₁ ∈ s, ∀ t₂ ∈ s, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂ sUnion_eq : ⋃₀ s = univ eq_generateFrom : t = generateFrom s #align topological_space.is_topological_basis TopologicalSpace.IsTopologicalBasis
Mathlib/Topology/Bases.lean
77
90
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) : IsTopologicalBasis (insert ∅ s) := by
refine ⟨?_, by rw [sUnion_insert, empty_union, h.sUnion_eq], ?_⟩ · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩ · cases hx₁ · cases hx₁ · cases hx₂ · obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩ exact ⟨t₃, .inr h₃, hs⟩ · rw [h.eq_generateFrom] refine le_antisymm (le_generateFrom fun t => ?_) (generateFrom_anti <| subset_insert ∅ s) rintro (rfl | ht) · exact @isOpen_empty _ (generateFrom s) · exact .basic t ht
0
import Mathlib.Data.Set.Image #align_import order.directed from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780" open Function universe u v w variable {α : Type u} {β : Type v} {ι : Sort w} (r r' s : α → α → Prop) local infixl:50 " ≼ " => r def Directed (f : ι → α) := ∀ x y, ∃ z, f x ≼ f z ∧ f y ≼ f z #align directed Directed def DirectedOn (s : Set α) := ∀ x ∈ s, ∀ y ∈ s, ∃ z ∈ s, x ≼ z ∧ y ≼ z #align directed_on DirectedOn variable {r r'} theorem directedOn_iff_directed {s} : @DirectedOn α r s ↔ Directed r (Subtype.val : s → α) := by simp only [DirectedOn, Directed, Subtype.exists, exists_and_left, exists_prop, Subtype.forall] exact forall₂_congr fun x _ => by simp [And.comm, and_assoc] #align directed_on_iff_directed directedOn_iff_directed alias ⟨DirectedOn.directed_val, _⟩ := directedOn_iff_directed #align directed_on.directed_coe DirectedOn.directed_val
Mathlib/Order/Directed.lean
66
67
theorem directedOn_range {f : ι → α} : Directed r f ↔ DirectedOn r (Set.range f) := by
simp_rw [Directed, DirectedOn, Set.forall_mem_range, Set.exists_range_iff]
0
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.Tactic.IntervalCases #align_import group_theory.p_group from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" open Fintype MulAction variable (p : ℕ) (G : Type*) [Group G] def IsPGroup : Prop := ∀ g : G, ∃ k : ℕ, g ^ p ^ k = 1 #align is_p_group IsPGroup variable {p} {G} namespace IsPGroup theorem iff_orderOf [hp : Fact p.Prime] : IsPGroup p G ↔ ∀ g : G, ∃ k : ℕ, orderOf g = p ^ k := forall_congr' fun g => ⟨fun ⟨k, hk⟩ => Exists.imp (fun _ h => h.right) ((Nat.dvd_prime_pow hp.out).mp (orderOf_dvd_of_pow_eq_one hk)), Exists.imp fun k hk => by rw [← hk, pow_orderOf_eq_one]⟩ #align is_p_group.iff_order_of IsPGroup.iff_orderOf theorem of_card [Fintype G] {n : ℕ} (hG : card G = p ^ n) : IsPGroup p G := fun g => ⟨n, by rw [← hG, pow_card_eq_one]⟩ #align is_p_group.of_card IsPGroup.of_card theorem of_bot : IsPGroup p (⊥ : Subgroup G) := of_card (by rw [← Nat.card_eq_fintype_card, Subgroup.card_bot, pow_zero]) #align is_p_group.of_bot IsPGroup.of_bot theorem iff_card [Fact p.Prime] [Fintype G] : IsPGroup p G ↔ ∃ n : ℕ, card G = p ^ n := by have hG : card G ≠ 0 := card_ne_zero refine ⟨fun h => ?_, fun ⟨n, hn⟩ => of_card hn⟩ suffices ∀ q ∈ Nat.factors (card G), q = p by use (card G).factors.length rw [← List.prod_replicate, ← List.eq_replicate_of_mem this, Nat.prod_factors hG] intro q hq obtain ⟨hq1, hq2⟩ := (Nat.mem_factors hG).mp hq haveI : Fact q.Prime := ⟨hq1⟩ obtain ⟨g, hg⟩ := exists_prime_orderOf_dvd_card q hq2 obtain ⟨k, hk⟩ := (iff_orderOf.mp h) g exact (hq1.pow_eq_iff.mp (hg.symm.trans hk).symm).1.symm #align is_p_group.iff_card IsPGroup.iff_card alias ⟨exists_card_eq, _⟩ := iff_card section GIsPGroup variable (hG : IsPGroup p G) theorem of_injective {H : Type*} [Group H] (ϕ : H →* G) (hϕ : Function.Injective ϕ) : IsPGroup p H := by simp_rw [IsPGroup, ← hϕ.eq_iff, ϕ.map_pow, ϕ.map_one] exact fun h => hG (ϕ h) #align is_p_group.of_injective IsPGroup.of_injective theorem to_subgroup (H : Subgroup G) : IsPGroup p H := hG.of_injective H.subtype Subtype.coe_injective #align is_p_group.to_subgroup IsPGroup.to_subgroup theorem of_surjective {H : Type*} [Group H] (ϕ : G →* H) (hϕ : Function.Surjective ϕ) : IsPGroup p H := by refine fun h => Exists.elim (hϕ h) fun g hg => Exists.imp (fun k hk => ?_) (hG g) rw [← hg, ← ϕ.map_pow, hk, ϕ.map_one] #align is_p_group.of_surjective IsPGroup.of_surjective theorem to_quotient (H : Subgroup G) [H.Normal] : IsPGroup p (G ⧸ H) := hG.of_surjective (QuotientGroup.mk' H) Quotient.surjective_Quotient_mk'' #align is_p_group.to_quotient IsPGroup.to_quotient theorem of_equiv {H : Type*} [Group H] (ϕ : G ≃* H) : IsPGroup p H := hG.of_surjective ϕ.toMonoidHom ϕ.surjective #align is_p_group.of_equiv IsPGroup.of_equiv theorem orderOf_coprime {n : ℕ} (hn : p.Coprime n) (g : G) : (orderOf g).Coprime n := let ⟨k, hk⟩ := hG g (hn.pow_left k).coprime_dvd_left (orderOf_dvd_of_pow_eq_one hk) #align is_p_group.order_of_coprime IsPGroup.orderOf_coprime noncomputable def powEquiv {n : ℕ} (hn : p.Coprime n) : G ≃ G := let h : ∀ g : G, (Nat.card (Subgroup.zpowers g)).Coprime n := fun g => (Nat.card_zpowers g).symm ▸ hG.orderOf_coprime hn g { toFun := (· ^ n) invFun := fun g => (powCoprime (h g)).symm ⟨g, Subgroup.mem_zpowers g⟩ left_inv := fun g => Subtype.ext_iff.1 <| (powCoprime (h (g ^ n))).left_inv ⟨g, _, Subtype.ext_iff.1 <| (powCoprime (h g)).left_inv ⟨g, Subgroup.mem_zpowers g⟩⟩ right_inv := fun g => Subtype.ext_iff.1 <| (powCoprime (h g)).right_inv ⟨g, Subgroup.mem_zpowers g⟩ } #align is_p_group.pow_equiv IsPGroup.powEquiv @[simp] theorem powEquiv_apply {n : ℕ} (hn : p.Coprime n) (g : G) : hG.powEquiv hn g = g ^ n := rfl #align is_p_group.pow_equiv_apply IsPGroup.powEquiv_apply @[simp]
Mathlib/GroupTheory/PGroup.lean
123
124
theorem powEquiv_symm_apply {n : ℕ} (hn : p.Coprime n) (g : G) : (hG.powEquiv hn).symm g = g ^ (orderOf g).gcdB n := by
rw [← Nat.card_zpowers]; rfl
0
import Batteries.Data.RBMap.Alter import Batteries.Data.List.Lemmas namespace Batteries namespace RBNode open RBColor attribute [simp] fold foldl foldr Any forM foldlM Ordered @[simp] theorem min?_reverse (t : RBNode α) : t.reverse.min? = t.max? := by unfold RBNode.max?; split <;> simp [RBNode.min?] unfold RBNode.min?; rw [min?.match_1.eq_3] · apply min?_reverse · simpa [reverse_eq_iff] @[simp] theorem max?_reverse (t : RBNode α) : t.reverse.max? = t.min? := by rw [← min?_reverse, reverse_reverse] @[simp] theorem mem_nil {x} : ¬x ∈ (.nil : RBNode α) := by simp [(·∈·), EMem] @[simp] theorem mem_node {y c a x b} : y ∈ (.node c a x b : RBNode α) ↔ y = x ∨ y ∈ a ∨ y ∈ b := by simp [(·∈·), EMem] theorem All_def {t : RBNode α} : t.All p ↔ ∀ x ∈ t, p x := by induction t <;> simp [or_imp, forall_and, *] theorem Any_def {t : RBNode α} : t.Any p ↔ ∃ x ∈ t, p x := by induction t <;> simp [or_and_right, exists_or, *] theorem memP_def : MemP cut t ↔ ∃ x ∈ t, cut x = .eq := Any_def theorem mem_def : Mem cmp x t ↔ ∃ y ∈ t, cmp x y = .eq := Any_def theorem mem_congr [@TransCmp α cmp] {t : RBNode α} (h : cmp x y = .eq) : Mem cmp x t ↔ Mem cmp y t := by simp [Mem, TransCmp.cmp_congr_left' h] theorem isOrdered_iff' [@TransCmp α cmp] {t : RBNode α} : isOrdered cmp t L R ↔ (∀ a ∈ L, t.All (cmpLT cmp a ·)) ∧ (∀ a ∈ R, t.All (cmpLT cmp · a)) ∧ (∀ a ∈ L, ∀ b ∈ R, cmpLT cmp a b) ∧ Ordered cmp t := by induction t generalizing L R with | nil => simp [isOrdered]; split <;> simp [cmpLT_iff] next h => intro _ ha _ hb; cases h _ _ ha hb | node _ l v r => simp [isOrdered, *] exact ⟨ fun ⟨⟨Ll, lv, Lv, ol⟩, ⟨vr, rR, vR, or⟩⟩ => ⟨ fun _ h => ⟨Lv _ h, Ll _ h, (Lv _ h).trans_l vr⟩, fun _ h => ⟨vR _ h, (vR _ h).trans_r lv, rR _ h⟩, fun _ hL _ hR => (Lv _ hL).trans (vR _ hR), lv, vr, ol, or⟩, fun ⟨hL, hR, _, lv, vr, ol, or⟩ => ⟨ ⟨fun _ h => (hL _ h).2.1, lv, fun _ h => (hL _ h).1, ol⟩, ⟨vr, fun _ h => (hR _ h).2.2, fun _ h => (hR _ h).1, or⟩⟩⟩ theorem isOrdered_iff [@TransCmp α cmp] {t : RBNode α} : isOrdered cmp t ↔ Ordered cmp t := by simp [isOrdered_iff'] instance (cmp) [@TransCmp α cmp] (t) : Decidable (Ordered cmp t) := decidable_of_iff _ isOrdered_iff class IsCut (cmp : α → α → Ordering) (cut : α → Ordering) : Prop where le_lt_trans [TransCmp cmp] : cmp x y ≠ .gt → cut x = .lt → cut y = .lt le_gt_trans [TransCmp cmp] : cmp x y ≠ .gt → cut y = .gt → cut x = .gt theorem IsCut.lt_trans [IsCut cmp cut] [TransCmp cmp] (H : cmp x y = .lt) : cut x = .lt → cut y = .lt := IsCut.le_lt_trans <| TransCmp.gt_asymm <| OrientedCmp.cmp_eq_gt.2 H theorem IsCut.gt_trans [IsCut cmp cut] [TransCmp cmp] (H : cmp x y = .lt) : cut y = .gt → cut x = .gt := IsCut.le_gt_trans <| TransCmp.gt_asymm <| OrientedCmp.cmp_eq_gt.2 H
.lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean
92
100
theorem IsCut.congr [IsCut cmp cut] [TransCmp cmp] (H : cmp x y = .eq) : cut x = cut y := by
cases ey : cut y · exact IsCut.le_lt_trans (fun h => nomatch H.symm.trans <| OrientedCmp.cmp_eq_gt.1 h) ey · cases ex : cut x · exact IsCut.le_lt_trans (fun h => nomatch H.symm.trans h) ex |>.symm.trans ey · rfl · refine IsCut.le_gt_trans (cmp := cmp) (fun h => ?_) ex |>.symm.trans ey cases H.symm.trans <| OrientedCmp.cmp_eq_gt.1 h · exact IsCut.le_gt_trans (fun h => nomatch H.symm.trans h) ey
0
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset import Mathlib.Data.Finite.Card import Mathlib.GroupTheory.Finiteness import Mathlib.GroupTheory.GroupAction.Quotient #align_import group_theory.index from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace Subgroup open Cardinal variable {G : Type*} [Group G] (H K L : Subgroup G) @[to_additive "The index of a subgroup as a natural number, and returns 0 if the index is infinite."] noncomputable def index : ℕ := Nat.card (G ⧸ H) #align subgroup.index Subgroup.index #align add_subgroup.index AddSubgroup.index @[to_additive "The relative index of a subgroup as a natural number, and returns 0 if the relative index is infinite."] noncomputable def relindex : ℕ := (H.subgroupOf K).index #align subgroup.relindex Subgroup.relindex #align add_subgroup.relindex AddSubgroup.relindex @[to_additive] theorem index_comap_of_surjective {G' : Type*} [Group G'] {f : G' →* G} (hf : Function.Surjective f) : (H.comap f).index = H.index := by letI := QuotientGroup.leftRel H letI := QuotientGroup.leftRel (H.comap f) have key : ∀ x y : G', Setoid.r x y ↔ Setoid.r (f x) (f y) := by simp only [QuotientGroup.leftRel_apply] exact fun x y => iff_of_eq (congr_arg (· ∈ H) (by rw [f.map_mul, f.map_inv])) refine Cardinal.toNat_congr (Equiv.ofBijective (Quotient.map' f fun x y => (key x y).mp) ⟨?_, ?_⟩) · simp_rw [← Quotient.eq''] at key refine Quotient.ind' fun x => ?_ refine Quotient.ind' fun y => ?_ exact (key x y).mpr · refine Quotient.ind' fun x => ?_ obtain ⟨y, hy⟩ := hf x exact ⟨y, (Quotient.map'_mk'' f _ y).trans (congr_arg Quotient.mk'' hy)⟩ #align subgroup.index_comap_of_surjective Subgroup.index_comap_of_surjective #align add_subgroup.index_comap_of_surjective AddSubgroup.index_comap_of_surjective @[to_additive] theorem index_comap {G' : Type*} [Group G'] (f : G' →* G) : (H.comap f).index = H.relindex f.range := Eq.trans (congr_arg index (by rfl)) ((H.subgroupOf f.range).index_comap_of_surjective f.rangeRestrict_surjective) #align subgroup.index_comap Subgroup.index_comap #align add_subgroup.index_comap AddSubgroup.index_comap @[to_additive] theorem relindex_comap {G' : Type*} [Group G'] (f : G' →* G) (K : Subgroup G') : relindex (comap f H) K = relindex H (map f K) := by rw [relindex, subgroupOf, comap_comap, index_comap, ← f.map_range, K.subtype_range] #align subgroup.relindex_comap Subgroup.relindex_comap #align add_subgroup.relindex_comap AddSubgroup.relindex_comap variable {H K L} @[to_additive relindex_mul_index] theorem relindex_mul_index (h : H ≤ K) : H.relindex K * K.index = H.index := ((mul_comm _ _).trans (Cardinal.toNat_mul _ _).symm).trans (congr_arg Cardinal.toNat (Equiv.cardinal_eq (quotientEquivProdOfLE h))).symm #align subgroup.relindex_mul_index Subgroup.relindex_mul_index #align add_subgroup.relindex_mul_index AddSubgroup.relindex_mul_index @[to_additive] theorem index_dvd_of_le (h : H ≤ K) : K.index ∣ H.index := dvd_of_mul_left_eq (H.relindex K) (relindex_mul_index h) #align subgroup.index_dvd_of_le Subgroup.index_dvd_of_le #align add_subgroup.index_dvd_of_le AddSubgroup.index_dvd_of_le @[to_additive] theorem relindex_dvd_index_of_le (h : H ≤ K) : H.relindex K ∣ H.index := dvd_of_mul_right_eq K.index (relindex_mul_index h) #align subgroup.relindex_dvd_index_of_le Subgroup.relindex_dvd_index_of_le #align add_subgroup.relindex_dvd_index_of_le AddSubgroup.relindex_dvd_index_of_le @[to_additive] theorem relindex_subgroupOf (hKL : K ≤ L) : (H.subgroupOf L).relindex (K.subgroupOf L) = H.relindex K := ((index_comap (H.subgroupOf L) (inclusion hKL)).trans (congr_arg _ (inclusion_range hKL))).symm #align subgroup.relindex_subgroup_of Subgroup.relindex_subgroupOf #align add_subgroup.relindex_add_subgroup_of AddSubgroup.relindex_addSubgroupOf variable (H K L) @[to_additive relindex_mul_relindex]
Mathlib/GroupTheory/Index.lean
126
129
theorem relindex_mul_relindex (hHK : H ≤ K) (hKL : K ≤ L) : H.relindex K * K.relindex L = H.relindex L := by
rw [← relindex_subgroupOf hKL] exact relindex_mul_index fun x hx => hHK hx
0
import Mathlib.Data.ENat.Lattice import Mathlib.Order.OrderIsoNat import Mathlib.Tactic.TFAE #align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b" open List hiding le_antisymm open OrderDual universe u v variable {α β : Type*} namespace Set section LT variable [LT α] [LT β] (s t : Set α) def subchain : Set (List α) := { l | l.Chain' (· < ·) ∧ ∀ i ∈ l, i ∈ s } #align set.subchain Set.subchain @[simp] -- porting note: new `simp` theorem nil_mem_subchain : [] ∈ s.subchain := ⟨trivial, fun _ ↦ nofun⟩ #align set.nil_mem_subchain Set.nil_mem_subchain variable {s} {l : List α} {a : α} theorem cons_mem_subchain_iff : (a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm, and_assoc] #align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff @[simp] -- Porting note (#10756): new lemma + `simp` theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by simp [cons_mem_subchain_iff] instance : Nonempty s.subchain := ⟨⟨[], s.nil_mem_subchain⟩⟩ variable (s) noncomputable def chainHeight : ℕ∞ := ⨆ l ∈ s.subchain, length l #align set.chain_height Set.chainHeight theorem chainHeight_eq_iSup_subtype : s.chainHeight = ⨆ l : s.subchain, ↑l.1.length := iSup_subtype' #align set.chain_height_eq_supr_subtype Set.chainHeight_eq_iSup_subtype
Mathlib/Order/Height.lean
93
106
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) : ∃ l ∈ s.subchain, length l = n := by
rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;> rw [chainHeight_eq_iSup_subtype] at ha · obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ := not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩, (l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩ · rw [ENat.iSup_coe_lt_top] at ha obtain ⟨⟨l, h₁, h₂⟩, e : l.length = _⟩ := Nat.sSup_mem (Set.range_nonempty _) ha refine ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩, (l.length_take n).trans <| min_eq_left <| ?_⟩ rwa [e, ← Nat.cast_le (α := ℕ∞), sSup_range, ENat.coe_iSup ha, ← chainHeight_eq_iSup_subtype]
0
import Mathlib.Data.List.OfFn import Mathlib.Data.List.Range #align_import data.list.indexes from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" assert_not_exists MonoidWithZero universe u v open Function namespace List variable {α : Type u} {β : Type v} section MapIdx -- Porting note: Add back old definition because it's easier for writing proofs. protected def oldMapIdxCore (f : ℕ → α → β) : ℕ → List α → List β | _, [] => [] | k, a :: as => f k a :: List.oldMapIdxCore f (k + 1) as protected def oldMapIdx (f : ℕ → α → β) (as : List α) : List β := List.oldMapIdxCore f 0 as @[simp] theorem mapIdx_nil {α β} (f : ℕ → α → β) : mapIdx f [] = [] := rfl #align list.map_with_index_nil List.mapIdx_nil -- Porting note (#10756): new theorem. protected theorem oldMapIdxCore_eq (l : List α) (f : ℕ → α → β) (n : ℕ) : l.oldMapIdxCore f n = l.oldMapIdx fun i a ↦ f (i + n) a := by induction' l with hd tl hl generalizing f n · rfl · rw [List.oldMapIdx] simp only [List.oldMapIdxCore, hl, Nat.add_left_comm, Nat.add_comm, Nat.add_zero] #noalign list.map_with_index_core_eq -- Porting note: convert new definition to old definition. -- A few new theorems are added to achieve this -- 1. Prove that `oldMapIdxCore f (l ++ [e]) = oldMapIdxCore f l ++ [f l.length e]` -- 2. Prove that `oldMapIdx f (l ++ [e]) = oldMapIdx f l ++ [f l.length e]` -- 3. Prove list induction using `∀ l e, p [] → (p l → p (l ++ [e])) → p l` -- Porting note (#10756): new theorem. theorem list_reverse_induction (p : List α → Prop) (base : p []) (ind : ∀ (l : List α) (e : α), p l → p (l ++ [e])) : (∀ (l : List α), p l) := by let q := fun l ↦ p (reverse l) have pq : ∀ l, p (reverse l) → q l := by simp only [q, reverse_reverse]; intro; exact id have qp : ∀ l, q (reverse l) → p l := by simp only [q, reverse_reverse]; intro; exact id intro l apply qp generalize (reverse l) = l induction' l with head tail ih · apply pq; simp only [reverse_nil, base] · apply pq; simp only [reverse_cons]; apply ind; apply qp; rw [reverse_reverse]; exact ih -- Porting note (#10756): new theorem. protected theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (l₁ l₂ : List α), List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂ := by intros f n l₁ l₂ generalize e : (l₁ ++ l₂).length = len revert n l₁ l₂ induction' len with len ih <;> intros n l₁ l₂ h · have l₁_nil : l₁ = [] := by cases l₁ · rfl · contradiction have l₂_nil : l₂ = [] := by cases l₂ · rfl · rw [List.length_append] at h; contradiction simp only [l₁_nil, l₂_nil]; rfl · cases' l₁ with head tail · rfl · simp only [List.oldMapIdxCore, List.append_eq, length_cons, cons_append,cons.injEq, true_and] suffices n + Nat.succ (length tail) = n + 1 + tail.length by rw [this] apply ih (n + 1) _ _ _ simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h simp only [length_append, h] rw [Nat.add_assoc]; simp only [Nat.add_comm] -- Porting note (#10756): new theorem. protected theorem oldMapIdx_append : ∀ (f : ℕ → α → β) (l : List α) (e : α), List.oldMapIdx f (l ++ [e]) = List.oldMapIdx f l ++ [f l.length e] := by intros f l e unfold List.oldMapIdx rw [List.oldMapIdxCore_append f 0 l [e]] simp only [Nat.zero_add]; rfl -- Porting note (#10756): new theorem. theorem mapIdxGo_append : ∀ (f : ℕ → α → β) (l₁ l₂ : List α) (arr : Array β), mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (List.toArray (mapIdx.go f l₁ arr)) := by intros f l₁ l₂ arr generalize e : (l₁ ++ l₂).length = len revert l₁ l₂ arr induction' len with len ih <;> intros l₁ l₂ arr h · have l₁_nil : l₁ = [] := by cases l₁ · rfl · contradiction have l₂_nil : l₂ = [] := by cases l₂ · rfl · rw [List.length_append] at h; contradiction rw [l₁_nil, l₂_nil]; simp only [mapIdx.go, Array.toList_eq, Array.toArray_data] · cases' l₁ with head tail <;> simp only [mapIdx.go] · simp only [nil_append, Array.toList_eq, Array.toArray_data] · simp only [List.append_eq] rw [ih] · simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h simp only [length_append, h] -- Porting note (#10756): new theorem. theorem mapIdxGo_length : ∀ (f : ℕ → α → β) (l : List α) (arr : Array β), length (mapIdx.go f l arr) = length l + arr.size := by intro f l induction' l with head tail ih · intro; simp only [mapIdx.go, Array.toList_eq, length_nil, Nat.zero_add] · intro; simp only [mapIdx.go]; rw [ih]; simp only [Array.size_push, length_cons]; simp only [Nat.add_succ, add_zero, Nat.add_comm] -- Porting note (#10756): new theorem.
Mathlib/Data/List/Indexes.lean
141
147
theorem mapIdx_append_one : ∀ (f : ℕ → α → β) (l : List α) (e : α), mapIdx f (l ++ [e]) = mapIdx f l ++ [f l.length e] := by
intros f l e unfold mapIdx rw [mapIdxGo_append f l [e]] simp only [mapIdx.go, Array.size_toArray, mapIdxGo_length, length_nil, Nat.add_zero, Array.toList_eq, Array.push_data, Array.data_toArray]
0
import Mathlib.Data.Matrix.Block import Mathlib.Data.Matrix.Notation import Mathlib.LinearAlgebra.StdBasis import Mathlib.RingTheory.AlgebraTower import Mathlib.Algebra.Algebra.Subalgebra.Tower #align_import linear_algebra.matrix.to_lin from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6" noncomputable section open LinearMap Matrix Set Submodule section ToMatrixRight variable {R : Type*} [Semiring R] variable {l m n : Type*} def Matrix.vecMulLinear [Fintype m] (M : Matrix m n R) : (m → R) →ₗ[R] n → R where toFun x := x ᵥ* M map_add' _ _ := funext fun _ ↦ add_dotProduct _ _ _ map_smul' _ _ := funext fun _ ↦ smul_dotProduct _ _ _ #align matrix.vec_mul_linear Matrix.vecMulLinear @[simp] theorem Matrix.vecMulLinear_apply [Fintype m] (M : Matrix m n R) (x : m → R) : M.vecMulLinear x = x ᵥ* M := rfl theorem Matrix.coe_vecMulLinear [Fintype m] (M : Matrix m n R) : (M.vecMulLinear : _ → _) = M.vecMul := rfl variable [Fintype m] [DecidableEq m] @[simp] theorem Matrix.vecMul_stdBasis (M : Matrix m n R) (i j) : (LinearMap.stdBasis R (fun _ ↦ R) i 1 ᵥ* M) j = M i j := by have : (∑ i', (if i = i' then 1 else 0) * M i' j) = M i j := by simp_rw [boole_mul, Finset.sum_ite_eq, Finset.mem_univ, if_true] simp only [vecMul, dotProduct] convert this split_ifs with h <;> simp only [stdBasis_apply] · rw [h, Function.update_same] · rw [Function.update_noteq (Ne.symm h), Pi.zero_apply] #align matrix.vec_mul_std_basis Matrix.vecMul_stdBasis
Mathlib/LinearAlgebra/Matrix/ToLin.lean
102
110
theorem range_vecMulLinear (M : Matrix m n R) : LinearMap.range M.vecMulLinear = span R (range M) := by
letI := Classical.decEq m simp_rw [range_eq_map, ← iSup_range_stdBasis, Submodule.map_iSup, range_eq_map, ← Ideal.span_singleton_one, Ideal.span, Submodule.map_span, image_image, image_singleton, Matrix.vecMulLinear_apply, iSup_span, range_eq_iUnion, iUnion_singleton_eq_range, LinearMap.stdBasis, coe_single] unfold vecMul simp_rw [single_dotProduct, one_mul]
0
import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open FiniteDimensional MeasureTheory MeasureTheory.Measure Set variable {ι E F : Type*} variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] section variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)] theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n)) (b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by have e : ι ≃ Fin n := by refine Fintype.equivFinOfCardEq ?_ rw [← _i.out, finrank_eq_card_basis b.toBasis] have A : ⇑b = b.reindex e ∘ e := by ext x simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply] rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped, o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one] #align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) : o.volumeForm.measure = volume := by have A : o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = 1 := Orientation.measure_orthonormalBasis o (stdOrthonormalBasis ℝ F) rw [addHaarMeasure_unique o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped, A, one_smul] simp only [volume, Basis.addHaar] #align orientation.measure_eq_volume Orientation.measure_eq_volume end
Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean
61
66
theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) : volume (parallelepiped b) = 1 := by
haveI : Fact (finrank ℝ F = finrank ℝ F) := ⟨rfl⟩ let o := (stdOrthonormalBasis ℝ F).toBasis.orientation rw [← o.measure_eq_volume] exact o.measure_orthonormalBasis b
0
import Mathlib.GroupTheory.QuotientGroup #align_import algebra.char_zero.quotient from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46" variable {R : Type*} [DivisionRing R] [CharZero R] {p : R} namespace AddSubgroup theorem zsmul_mem_zmultiples_iff_exists_sub_div {r : R} {z : ℤ} (hz : z ≠ 0) : z • r ∈ AddSubgroup.zmultiples p ↔ ∃ k : Fin z.natAbs, r - (k : ℕ) • (p / z : R) ∈ AddSubgroup.zmultiples p := by rw [AddSubgroup.mem_zmultiples_iff] simp_rw [AddSubgroup.mem_zmultiples_iff, div_eq_mul_inv, ← smul_mul_assoc, eq_sub_iff_add_eq] have hz' : (z : R) ≠ 0 := Int.cast_ne_zero.mpr hz conv_rhs => simp (config := { singlePass := true }) only [← (mul_right_injective₀ hz').eq_iff] simp_rw [← zsmul_eq_mul, smul_add, ← mul_smul_comm, zsmul_eq_mul (z : R)⁻¹, mul_inv_cancel hz', mul_one, ← natCast_zsmul, smul_smul, ← add_smul] constructor · rintro ⟨k, h⟩ simp_rw [← h] refine ⟨⟨(k % z).toNat, ?_⟩, k / z, ?_⟩ · rw [← Int.ofNat_lt, Int.toNat_of_nonneg (Int.emod_nonneg _ hz)] exact (Int.emod_lt _ hz).trans_eq (Int.abs_eq_natAbs _) rw [Fin.val_mk, Int.toNat_of_nonneg (Int.emod_nonneg _ hz)] nth_rewrite 3 [← Int.ediv_add_emod k z] rfl · rintro ⟨k, n, h⟩ exact ⟨_, h⟩ #align add_subgroup.zsmul_mem_zmultiples_iff_exists_sub_div AddSubgroup.zsmul_mem_zmultiples_iff_exists_sub_div
Mathlib/Algebra/CharZero/Quotient.lean
42
47
theorem nsmul_mem_zmultiples_iff_exists_sub_div {r : R} {n : ℕ} (hn : n ≠ 0) : n • r ∈ AddSubgroup.zmultiples p ↔ ∃ k : Fin n, r - (k : ℕ) • (p / n : R) ∈ AddSubgroup.zmultiples p := by
rw [← natCast_zsmul r, zsmul_mem_zmultiples_iff_exists_sub_div (Int.natCast_ne_zero.mpr hn), Int.cast_natCast] rfl
0
import Mathlib.LinearAlgebra.Basis import Mathlib.Algebra.Module.LocalizedModule import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Localization.Integer #align_import ring_theory.localization.module from "leanprover-community/mathlib"@"2e59a6de168f95d16b16d217b808a36290398c0a" open nonZeroDivisors section Localization variable {R : Type*} (Rₛ : Type*) [CommSemiring R] (S : Submonoid R) section IsLocalizedModule section AddCommMonoid open Submodule variable [CommSemiring Rₛ] [Algebra R Rₛ] [hT : IsLocalization S Rₛ] variable {M M' : Type*} [AddCommMonoid M] [Module R M] [Module Rₛ M] [IsScalarTower R Rₛ M] [AddCommMonoid M'] [Module R M'] [Module Rₛ M'] [IsScalarTower R Rₛ M'] (f : M →ₗ[R] M') [IsLocalizedModule S f] theorem span_eq_top_of_isLocalizedModule {v : Set M} (hv : span R v = ⊤) : span Rₛ (f '' v) = ⊤ := top_unique fun x _ ↦ by obtain ⟨⟨m, s⟩, h⟩ := IsLocalizedModule.surj S f x rw [Submonoid.smul_def, ← algebraMap_smul Rₛ, ← Units.smul_isUnit (IsLocalization.map_units Rₛ s), eq_comm, ← inv_smul_eq_iff] at h refine h ▸ smul_mem _ _ (span_subset_span R Rₛ _ ?_) rw [← LinearMap.coe_restrictScalars R, ← LinearMap.map_span, hv] exact mem_map_of_mem mem_top
Mathlib/RingTheory/Localization/Module.lean
56
71
theorem LinearIndependent.of_isLocalizedModule {ι : Type*} {v : ι → M} (hv : LinearIndependent R v) : LinearIndependent Rₛ (f ∘ v) := by
rw [linearIndependent_iff'] at hv ⊢ intro t g hg i hi choose! a g' hg' using IsLocalization.exist_integer_multiples S t g have h0 : f (∑ i ∈ t, g' i • v i) = 0 := by apply_fun ((a : R) • ·) at hg rw [smul_zero, Finset.smul_sum] at hg rw [map_sum, ← hg] refine Finset.sum_congr rfl fun i hi => ?_ rw [← smul_assoc, ← hg' i hi, map_smul, Function.comp_apply, algebraMap_smul] obtain ⟨s, hs⟩ := (IsLocalizedModule.eq_zero_iff S f).mp h0 simp_rw [Finset.smul_sum, Submonoid.smul_def, smul_smul] at hs specialize hv t _ hs i hi rw [← (IsLocalization.map_units Rₛ a).mul_right_eq_zero, ← Algebra.smul_def, ← hg' i hi] exact (IsLocalization.map_eq_zero_iff S _ _).2 ⟨s, hv⟩
0
import Mathlib.Algebra.DirectLimit import Mathlib.Algebra.CharP.Algebra import Mathlib.FieldTheory.IsAlgClosed.Basic import Mathlib.FieldTheory.SplittingField.Construction #align_import field_theory.is_alg_closed.algebraic_closure from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" universe u v w noncomputable section open scoped Classical Polynomial open Polynomial variable (k : Type u) [Field k] namespace AlgebraicClosure open MvPolynomial abbrev MonicIrreducible : Type u := { f : k[X] // Monic f ∧ Irreducible f } #align algebraic_closure.monic_irreducible AlgebraicClosure.MonicIrreducible def evalXSelf (f : MonicIrreducible k) : MvPolynomial (MonicIrreducible k) k := Polynomial.eval₂ MvPolynomial.C (X f) f set_option linter.uppercaseLean3 false in #align algebraic_closure.eval_X_self AlgebraicClosure.evalXSelf def spanEval : Ideal (MvPolynomial (MonicIrreducible k) k) := Ideal.span <| Set.range <| evalXSelf k #align algebraic_closure.span_eval AlgebraicClosure.spanEval def toSplittingField (s : Finset (MonicIrreducible k)) : MvPolynomial (MonicIrreducible k) k →ₐ[k] SplittingField (∏ x ∈ s, x : k[X]) := MvPolynomial.aeval fun f => if hf : f ∈ s then rootOfSplits _ ((splits_prod_iff _ fun (j : MonicIrreducible k) _ => j.2.2.ne_zero).1 (SplittingField.splits _) f hf) (mt isUnit_iff_degree_eq_zero.2 f.2.2.not_unit) else 37 #align algebraic_closure.to_splitting_field AlgebraicClosure.toSplittingField theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f ∈ s) : toSplittingField k s (evalXSelf k f) = 0 := by rw [toSplittingField, evalXSelf, ← AlgHom.coe_toRingHom, hom_eval₂, AlgHom.coe_toRingHom, MvPolynomial.aeval_X, dif_pos hf, ← MvPolynomial.algebraMap_eq, AlgHom.comp_algebraMap] exact map_rootOfSplits _ _ _ set_option linter.uppercaseLean3 false in #align algebraic_closure.to_splitting_field_eval_X_self AlgebraicClosure.toSplittingField_evalXSelf
Mathlib/FieldTheory/IsAlgClosed/AlgebraicClosure.lean
85
94
theorem spanEval_ne_top : spanEval k ≠ ⊤ := by
rw [Ideal.ne_top_iff_one, spanEval, Ideal.span, ← Set.image_univ, Finsupp.mem_span_image_iff_total] rintro ⟨v, _, hv⟩ replace hv := congr_arg (toSplittingField k v.support) hv rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv · exact zero_ne_one hv intro j hj rw [smul_eq_mul, AlgHom.map_mul, toSplittingField_evalXSelf (s := v.support) hj, mul_zero]
0
import Mathlib.ModelTheory.FinitelyGenerated import Mathlib.ModelTheory.DirectLimit import Mathlib.ModelTheory.Bundled #align_import model_theory.fraisse from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398" universe u v w w' open scoped FirstOrder open Set CategoryTheory namespace FirstOrder namespace Language open Structure Substructure variable (L : Language.{u, v}) def age (M : Type w) [L.Structure M] : Set (Bundled.{w} L.Structure) := {N | Structure.FG L N ∧ Nonempty (N ↪[L] M)} #align first_order.language.age FirstOrder.Language.age variable {L} (K : Set (Bundled.{w} L.Structure)) def Hereditary : Prop := ∀ M : Bundled.{w} L.Structure, M ∈ K → L.age M ⊆ K #align first_order.language.hereditary FirstOrder.Language.Hereditary def JointEmbedding : Prop := DirectedOn (fun M N : Bundled.{w} L.Structure => Nonempty (M ↪[L] N)) K #align first_order.language.joint_embedding FirstOrder.Language.JointEmbedding def Amalgamation : Prop := ∀ (M N P : Bundled.{w} L.Structure) (MN : M ↪[L] N) (MP : M ↪[L] P), M ∈ K → N ∈ K → P ∈ K → ∃ (Q : Bundled.{w} L.Structure) (NQ : N ↪[L] Q) (PQ : P ↪[L] Q), Q ∈ K ∧ NQ.comp MN = PQ.comp MP #align first_order.language.amalgamation FirstOrder.Language.Amalgamation class IsFraisse : Prop where is_nonempty : K.Nonempty FG : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M is_equiv_invariant : ∀ M N : Bundled.{w} L.Structure, Nonempty (M ≃[L] N) → (M ∈ K ↔ N ∈ K) is_essentially_countable : (Quotient.mk' '' K).Countable hereditary : Hereditary K jointEmbedding : JointEmbedding K amalgamation : Amalgamation K #align first_order.language.is_fraisse FirstOrder.Language.IsFraisse variable {K} (L) (M : Type w) [Structure L M] theorem age.is_equiv_invariant (N P : Bundled.{w} L.Structure) (h : Nonempty (N ≃[L] P)) : N ∈ L.age M ↔ P ∈ L.age M := and_congr h.some.fg_iff ⟨Nonempty.map fun x => Embedding.comp x h.some.symm.toEmbedding, Nonempty.map fun x => Embedding.comp x h.some.toEmbedding⟩ #align first_order.language.age.is_equiv_invariant FirstOrder.Language.age.is_equiv_invariant variable {L} {M} {N : Type w} [Structure L N] theorem Embedding.age_subset_age (MN : M ↪[L] N) : L.age M ⊆ L.age N := fun _ => And.imp_right (Nonempty.map MN.comp) #align first_order.language.embedding.age_subset_age FirstOrder.Language.Embedding.age_subset_age theorem Equiv.age_eq_age (MN : M ≃[L] N) : L.age M = L.age N := le_antisymm MN.toEmbedding.age_subset_age MN.symm.toEmbedding.age_subset_age #align first_order.language.equiv.age_eq_age FirstOrder.Language.Equiv.age_eq_age theorem Structure.FG.mem_age_of_equiv {M N : Bundled L.Structure} (h : Structure.FG L M) (MN : Nonempty (M ≃[L] N)) : N ∈ L.age M := ⟨MN.some.fg_iff.1 h, ⟨MN.some.symm.toEmbedding⟩⟩ set_option linter.uppercaseLean3 false in #align first_order.language.Structure.fg.mem_age_of_equiv FirstOrder.Language.Structure.FG.mem_age_of_equiv theorem Hereditary.is_equiv_invariant_of_fg (h : Hereditary K) (fg : ∀ M : Bundled.{w} L.Structure, M ∈ K → Structure.FG L M) (M N : Bundled.{w} L.Structure) (hn : Nonempty (M ≃[L] N)) : M ∈ K ↔ N ∈ K := ⟨fun MK => h M MK ((fg M MK).mem_age_of_equiv hn), fun NK => h N NK ((fg N NK).mem_age_of_equiv ⟨hn.some.symm⟩)⟩ #align first_order.language.hereditary.is_equiv_invariant_of_fg FirstOrder.Language.Hereditary.is_equiv_invariant_of_fg variable (M) theorem age.nonempty : (L.age M).Nonempty := ⟨Bundled.of (Substructure.closure L (∅ : Set M)), (fg_iff_structure_fg _).1 (fg_closure Set.finite_empty), ⟨Substructure.subtype _⟩⟩ #align first_order.language.age.nonempty FirstOrder.Language.age.nonempty theorem age.hereditary : Hereditary (L.age M) := fun _ hN _ hP => hN.2.some.age_subset_age hP #align first_order.language.age.hereditary FirstOrder.Language.age.hereditary theorem age.jointEmbedding : JointEmbedding (L.age M) := fun _ hN _ hP => ⟨Bundled.of (↥(hN.2.some.toHom.range ⊔ hP.2.some.toHom.range)), ⟨(fg_iff_structure_fg _).1 ((hN.1.range hN.2.some.toHom).sup (hP.1.range hP.2.some.toHom)), ⟨Substructure.subtype _⟩⟩, ⟨Embedding.comp (inclusion le_sup_left) hN.2.some.equivRange.toEmbedding⟩, ⟨Embedding.comp (inclusion le_sup_right) hP.2.some.equivRange.toEmbedding⟩⟩ #align first_order.language.age.joint_embedding FirstOrder.Language.age.jointEmbedding
Mathlib/ModelTheory/Fraisse.lean
169
182
theorem age.countable_quotient [h : Countable M] : (Quotient.mk' '' L.age M).Countable := by
classical refine (congr_arg _ (Set.ext <| Quotient.forall.2 fun N => ?_)).mp (countable_range fun s : Finset M => ⟦⟨closure L (s : Set M), inferInstance⟩⟧) constructor · rintro ⟨s, hs⟩ use Bundled.of (closure L (s : Set M)) exact ⟨⟨(fg_iff_structure_fg _).1 (fg_closure s.finite_toSet), ⟨Substructure.subtype _⟩⟩, hs⟩ · simp only [mem_range, Quotient.eq] rintro ⟨P, ⟨⟨s, hs⟩, ⟨PM⟩⟩, hP2⟩ have : P ≈ N := by apply Quotient.eq'.mp; rw [hP2]; rfl -- Porting note: added refine ⟨s.image PM, Setoid.trans (b := P) ?_ this⟩ rw [← Embedding.coe_toHom, Finset.coe_image, closure_image PM.toHom, hs, ← Hom.range_eq_map] exact ⟨PM.equivRange.symm⟩
0
import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Asymptotics.SpecificAsymptotics import Mathlib.Analysis.Complex.CauchyIntegral #align_import analysis.complex.removable_singularity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function open scoped Topology Filter NNReal Real universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] namespace Complex
Mathlib/Analysis/Complex/RemovableSingularity.lean
34
43
theorem analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt {f : ℂ → E} {c : ℂ} (hd : ∀ᶠ z in 𝓝[≠] c, DifferentiableAt ℂ f z) (hc : ContinuousAt f c) : AnalyticAt ℂ f c := by
rcases (nhdsWithin_hasBasis nhds_basis_closedBall _).mem_iff.1 hd with ⟨R, hR0, hRs⟩ lift R to ℝ≥0 using hR0.le replace hc : ContinuousOn f (closedBall c R) := by refine fun z hz => ContinuousAt.continuousWithinAt ?_ rcases eq_or_ne z c with (rfl | hne) exacts [hc, (hRs ⟨hz, hne⟩).continuousAt] exact (hasFPowerSeriesOnBall_of_differentiable_off_countable (countable_singleton c) hc (fun z hz => hRs (diff_subset_diff_left ball_subset_closedBall hz)) hR0).analyticAt
0