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
goals
listlengths
0
224
goals_before
listlengths
0
220
import Mathlib.Topology.ContinuousFunction.Bounded import Mathlib.Topology.UniformSpace.Compact import Mathlib.Topology.CompactOpen import Mathlib.Topology.Sets.Compacts import Mathlib.Analysis.Normed.Group.InfiniteSum #align_import topology.continuous_function.compact from "leanprover-community/mathlib"@"d3af0609f6db8691dffdc3e1fb7feb7da72698f2" noncomputable section open scoped Classical open Topology NNReal BoundedContinuousFunction open Set Filter Metric open BoundedContinuousFunction namespace ContinuousMap variable {α β E : Type*} [TopologicalSpace α] [CompactSpace α] [MetricSpace β] [NormedAddCommGroup E] section variable (α β) @[simps (config := .asFn)] def equivBoundedOfCompact : C(α, β) ≃ (α →ᵇ β) := ⟨mkOfCompact, BoundedContinuousFunction.toContinuousMap, fun f => by ext rfl, fun f => by ext rfl⟩ #align continuous_map.equiv_bounded_of_compact ContinuousMap.equivBoundedOfCompact theorem uniformInducing_equivBoundedOfCompact : UniformInducing (equivBoundedOfCompact α β) := UniformInducing.mk' (by simp only [hasBasis_compactConvergenceUniformity.mem_iff, uniformity_basis_dist_le.mem_iff] exact fun s => ⟨fun ⟨⟨a, b⟩, ⟨_, ⟨ε, hε, hb⟩⟩, hs⟩ => ⟨{ p | ∀ x, (p.1 x, p.2 x) ∈ b }, ⟨ε, hε, fun _ h x => hb ((dist_le hε.le).mp h x)⟩, fun f g h => hs fun x _ => h x⟩, fun ⟨_, ⟨ε, hε, ht⟩, hs⟩ => ⟨⟨Set.univ, { p | dist p.1 p.2 ≤ ε }⟩, ⟨isCompact_univ, ⟨ε, hε, fun _ h => h⟩⟩, fun ⟨f, g⟩ h => hs _ _ (ht ((dist_le hε.le).mpr fun x => h x (mem_univ x)))⟩⟩) #align continuous_map.uniform_inducing_equiv_bounded_of_compact ContinuousMap.uniformInducing_equivBoundedOfCompact theorem uniformEmbedding_equivBoundedOfCompact : UniformEmbedding (equivBoundedOfCompact α β) := { uniformInducing_equivBoundedOfCompact α β with inj := (equivBoundedOfCompact α β).injective } #align continuous_map.uniform_embedding_equiv_bounded_of_compact ContinuousMap.uniformEmbedding_equivBoundedOfCompact -- Porting note: the following `simps` received a "maximum recursion depth" error -- @[simps! (config := .asFn) apply symm_apply] def addEquivBoundedOfCompact [AddMonoid β] [LipschitzAdd β] : C(α, β) ≃+ (α →ᵇ β) := ({ toContinuousMapAddHom α β, (equivBoundedOfCompact α β).symm with } : (α →ᵇ β) ≃+ C(α, β)).symm #align continuous_map.add_equiv_bounded_of_compact ContinuousMap.addEquivBoundedOfCompact -- Porting note: added this `simp` lemma manually because of the `simps` error above @[simp] theorem addEquivBoundedOfCompact_symm_apply [AddMonoid β] [LipschitzAdd β] : ⇑((addEquivBoundedOfCompact α β).symm) = toContinuousMapAddHom α β := rfl -- Porting note: added this `simp` lemma manually because of the `simps` error above @[simp] theorem addEquivBoundedOfCompact_apply [AddMonoid β] [LipschitzAdd β] : ⇑(addEquivBoundedOfCompact α β) = mkOfCompact := rfl instance metricSpace : MetricSpace C(α, β) := (uniformEmbedding_equivBoundedOfCompact α β).comapMetricSpace _ #align continuous_map.metric_space ContinuousMap.metricSpace @[simps! (config := .asFn) toEquiv apply symm_apply] def isometryEquivBoundedOfCompact : C(α, β) ≃ᵢ (α →ᵇ β) where isometry_toFun _ _ := rfl toEquiv := equivBoundedOfCompact α β #align continuous_map.isometry_equiv_bounded_of_compact ContinuousMap.isometryEquivBoundedOfCompact end @[simp] theorem _root_.BoundedContinuousFunction.dist_mkOfCompact (f g : C(α, β)) : dist (mkOfCompact f) (mkOfCompact g) = dist f g := rfl #align bounded_continuous_function.dist_mk_of_compact BoundedContinuousFunction.dist_mkOfCompact @[simp] theorem _root_.BoundedContinuousFunction.dist_toContinuousMap (f g : α →ᵇ β) : dist f.toContinuousMap g.toContinuousMap = dist f g := rfl #align bounded_continuous_function.dist_to_continuous_map BoundedContinuousFunction.dist_toContinuousMap open BoundedContinuousFunction section variable {f g : C(α, β)} {C : ℝ} theorem dist_apply_le_dist (x : α) : dist (f x) (g x) ≤ dist f g := by simp only [← dist_mkOfCompact, dist_coe_le_dist, ← mkOfCompact_apply] #align continuous_map.dist_apply_le_dist ContinuousMap.dist_apply_le_dist theorem dist_le (C0 : (0 : ℝ) ≤ C) : dist f g ≤ C ↔ ∀ x : α, dist (f x) (g x) ≤ C := by simp only [← dist_mkOfCompact, BoundedContinuousFunction.dist_le C0, mkOfCompact_apply] #align continuous_map.dist_le ContinuousMap.dist_le
Mathlib/Topology/ContinuousFunction/Compact.lean
141
143
theorem dist_le_iff_of_nonempty [Nonempty α] : dist f g ≤ C ↔ ∀ x, dist (f x) (g x) ≤ C := by
simp only [← dist_mkOfCompact, BoundedContinuousFunction.dist_le_iff_of_nonempty, mkOfCompact_apply]
[ " (mkOfCompact f).toContinuousMap = f", " (mkOfCompact f).toContinuousMap a✝ = f a✝", " mkOfCompact f.toContinuousMap = f", " (mkOfCompact f.toContinuousMap) x✝ = f x✝", " ∀ (s : Set (C(α, β) × C(α, β))),\n s ∈ uniformity C(α, β) ↔\n ∃ t ∈ uniformity (α →ᵇ β),\n ∀ (x y : C(α, β)), ((equivBoun...
[ " (mkOfCompact f).toContinuousMap = f", " (mkOfCompact f).toContinuousMap a✝ = f a✝", " mkOfCompact f.toContinuousMap = f", " (mkOfCompact f.toContinuousMap) x✝ = f x✝", " ∀ (s : Set (C(α, β) × C(α, β))),\n s ∈ uniformity C(α, β) ↔\n ∃ t ∈ uniformity (α →ᵇ β),\n ∀ (x y : C(α, β)), ((equivBoun...
import Mathlib.Analysis.SpecialFunctions.Log.Deriv import Mathlib.MeasureTheory.Integral.FundThmCalculus #align_import analysis.special_functions.non_integrable from "leanprover-community/mathlib"@"55ec6e9af7d3e0043f57e394cb06a72f6275273e" open scoped MeasureTheory Topology Interval NNReal ENNReal open MeasureTheory TopologicalSpace Set Filter Asymptotics intervalIntegral variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] theorem not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter_aux [CompleteSpace E] {f : ℝ → E} {g : ℝ → F} {k : Set ℝ} (l : Filter ℝ) [NeBot l] [TendstoIxxClass Icc l l] (hl : k ∈ l) (hd : ∀ᶠ x in l, DifferentiableAt ℝ f x) (hf : Tendsto (fun x => ‖f x‖) l atTop) (hfg : deriv f =O[l] g) : ¬IntegrableOn g k := by intro hgi obtain ⟨C, hC₀, s, hsl, hsub, hfd, hg⟩ : ∃ (C : ℝ) (_ : 0 ≤ C), ∃ s ∈ l, (∀ x ∈ s, ∀ y ∈ s, [[x, y]] ⊆ k) ∧ (∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], DifferentiableAt ℝ f z) ∧ ∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], ‖deriv f z‖ ≤ C * ‖g z‖ := by rcases hfg.exists_nonneg with ⟨C, C₀, hC⟩ have h : ∀ᶠ x : ℝ × ℝ in l.prod l, ∀ y ∈ [[x.1, x.2]], (DifferentiableAt ℝ f y ∧ ‖deriv f y‖ ≤ C * ‖g y‖) ∧ y ∈ k := (tendsto_fst.uIcc tendsto_snd).eventually ((hd.and hC.bound).and hl).smallSets rcases mem_prod_self_iff.1 h with ⟨s, hsl, hs⟩ simp only [prod_subset_iff, mem_setOf_eq] at hs exact ⟨C, C₀, s, hsl, fun x hx y hy z hz => (hs x hx y hy z hz).2, fun x hx y hy z hz => (hs x hx y hy z hz).1.1, fun x hx y hy z hz => (hs x hx y hy z hz).1.2⟩ replace hgi : IntegrableOn (fun x ↦ C * ‖g x‖) k := by exact hgi.norm.smul C obtain ⟨c, hc, d, hd, hlt⟩ : ∃ c ∈ s, ∃ d ∈ s, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f d‖ := by rcases Filter.nonempty_of_mem hsl with ⟨c, hc⟩ have : ∀ᶠ x in l, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f x‖ := hf.eventually (eventually_gt_atTop _) exact ⟨c, hc, (this.and hsl).exists.imp fun d hd => ⟨hd.2, hd.1⟩⟩ specialize hsub c hc d hd; specialize hfd c hc d hd replace hg : ∀ x ∈ Ι c d, ‖deriv f x‖ ≤ C * ‖g x‖ := fun z hz => hg c hc d hd z ⟨hz.1.le, hz.2⟩ have hg_ae : ∀ᵐ x ∂volume.restrict (Ι c d), ‖deriv f x‖ ≤ C * ‖g x‖ := (ae_restrict_mem measurableSet_uIoc).mono hg have hsub' : Ι c d ⊆ k := Subset.trans Ioc_subset_Icc_self hsub have hfi : IntervalIntegrable (deriv f) volume c d := by rw [intervalIntegrable_iff] have : IntegrableOn (fun x ↦ C * ‖g x‖) (Ι c d) := IntegrableOn.mono hgi hsub' le_rfl exact Integrable.mono' this (aestronglyMeasurable_deriv _ _) hg_ae refine hlt.not_le (sub_le_iff_le_add'.1 ?_) calc ‖f d‖ - ‖f c‖ ≤ ‖f d - f c‖ := norm_sub_norm_le _ _ _ = ‖∫ x in c..d, deriv f x‖ := congr_arg _ (integral_deriv_eq_sub hfd hfi).symm _ = ‖∫ x in Ι c d, deriv f x‖ := norm_integral_eq_norm_integral_Ioc _ _ ≤ ∫ x in Ι c d, ‖deriv f x‖ := norm_integral_le_integral_norm _ _ ≤ ∫ x in Ι c d, C * ‖g x‖ := setIntegral_mono_on hfi.norm.def' (hgi.mono_set hsub') measurableSet_uIoc hg _ ≤ ∫ x in k, C * ‖g x‖ := by apply setIntegral_mono_set hgi (ae_of_all _ fun x => mul_nonneg hC₀ (norm_nonneg _)) hsub'.eventuallyLE
Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean
98
121
theorem not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter {f : ℝ → E} {g : ℝ → F} {k : Set ℝ} (l : Filter ℝ) [NeBot l] [TendstoIxxClass Icc l l] (hl : k ∈ l) (hd : ∀ᶠ x in l, DifferentiableAt ℝ f x) (hf : Tendsto (fun x => ‖f x‖) l atTop) (hfg : deriv f =O[l] g) : ¬IntegrableOn g k := by
let a : E →ₗᵢ[ℝ] UniformSpace.Completion E := UniformSpace.Completion.toComplₗᵢ let f' := a ∘ f have h'd : ∀ᶠ x in l, DifferentiableAt ℝ f' x := by filter_upwards [hd] with x hx using a.toContinuousLinearMap.differentiableAt.comp x hx have h'f : Tendsto (fun x => ‖f' x‖) l atTop := hf.congr (fun x ↦ by simp [f']) have h'fg : deriv f' =O[l] g := by apply IsBigO.trans _ hfg rw [← isBigO_norm_norm] suffices (fun x ↦ ‖deriv f' x‖) =ᶠ[l] (fun x ↦ ‖deriv f x‖) by exact this.isBigO filter_upwards [hd] with x hx have : deriv f' x = a (deriv f x) := by rw [fderiv.comp_deriv x _ hx] · have : fderiv ℝ a (f x) = a.toContinuousLinearMap := a.toContinuousLinearMap.fderiv simp only [this] rfl · exact a.toContinuousLinearMap.differentiableAt simp only [this] simp exact not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter_aux l hl h'd h'f h'fg
[ " ¬IntegrableOn g k volume", " False", " ∃ C,\n ∃ (_ : 0 ≤ C),\n ∃ s ∈ l,\n (∀ x ∈ s, ∀ y ∈ s, [[x, y]] ⊆ k) ∧\n (∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], DifferentiableAt ℝ f z) ∧\n ∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], ‖deriv f z‖ ≤ C * ‖g z‖", " IntegrableOn (fun x => C * ‖g x‖) k v...
[ " ¬IntegrableOn g k volume", " False", " ∃ C,\n ∃ (_ : 0 ≤ C),\n ∃ s ∈ l,\n (∀ x ∈ s, ∀ y ∈ s, [[x, y]] ⊆ k) ∧\n (∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], DifferentiableAt ℝ f z) ∧\n ∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], ‖deriv f z‖ ≤ C * ‖g z‖", " IntegrableOn (fun x => C * ‖g x‖) k v...
import Mathlib.Topology.Order.IsLUB open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) variable {α β γ : Type*} section DenselyOrdered variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [DenselyOrdered α] {a b : α} {s : Set α}
Mathlib/Topology/Order/DenselyOrdered.lean
25
29
theorem closure_Ioi' {a : α} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by
apply Subset.antisymm · exact closure_minimal Ioi_subset_Ici_self isClosed_Ici · rw [← diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff] exact isGLB_Ioi.mem_closure h
[ " closure (Ioi a) = Ici a", " closure (Ioi a) ⊆ Ici a", " Ici a ⊆ closure (Ioi a)", " a ∈ closure (Ioi a)" ]
[]
import Mathlib.MeasureTheory.Covering.DensityTheorem import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.covering.one_dim from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open Set MeasureTheory IsUnifLocDoublingMeasure Filter open scoped Topology namespace Real
Mathlib/MeasureTheory/Covering/OneDim.lean
26
30
theorem Icc_mem_vitaliFamily_at_right {x y : ℝ} (hxy : x < y) : Icc x y ∈ (vitaliFamily (volume : Measure ℝ) 1).setsAt x := by
rw [Icc_eq_closedBall] refine closedBall_mem_vitaliFamily_of_dist_le_mul _ ?_ (by linarith) rw [dist_comm, Real.dist_eq, abs_of_nonneg] <;> linarith
[ " Icc x y ∈ (vitaliFamily volume 1).setsAt x", " Metric.closedBall ((x + y) / 2) ((y - x) / 2) ∈ (vitaliFamily volume 1).setsAt x", " 0 < (y - x) / 2", " dist x ((x + y) / 2) ≤ 1 * ((y - x) / 2)", " (x + y) / 2 - x ≤ 1 * ((y - x) / 2)", " 0 ≤ (x + y) / 2 - x" ]
[]
import Mathlib.Init.Control.Combinators import Mathlib.Data.Option.Defs import Mathlib.Logic.IsEmpty import Mathlib.Logic.Relator import Mathlib.Util.CompileInductive import Aesop #align_import data.option.basic from "leanprover-community/mathlib"@"f340f229b1f461aa1c8ee11e0a172d0a3b301a4a" universe u namespace Option variable {α β γ δ : Type*} theorem coe_def : (fun a ↦ ↑a : α → Option α) = some := rfl #align option.coe_def Option.coe_def theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp #align option.mem_map Option.mem_map -- The simpNF linter says that the LHS can be simplified via `Option.mem_def`. -- However this is a higher priority lemma. -- https://github.com/leanprover/std4/issues/207 @[simp 1100, nolint simpNF] theorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {o : Option α} : f a ∈ o.map f ↔ a ∈ o := by aesop theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp #align option.forall_mem_map Option.forall_mem_map
Mathlib/Data/Option/Basic.lean
61
62
theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by
simp
[ " y ∈ Option.map f o ↔ ∃ x, x ∈ o ∧ f x = y", " f a ∈ Option.map f o ↔ a ∈ o", " (∀ (y : β), y ∈ Option.map f o → p y) ↔ ∀ (x : α), x ∈ o → p (f x)", " (∃ y, y ∈ Option.map f o ∧ p y) ↔ ∃ x, x ∈ o ∧ p (f x)" ]
[ " y ∈ Option.map f o ↔ ∃ x, x ∈ o ∧ f x = y", " f a ∈ Option.map f o ↔ a ∈ o", " (∀ (y : β), y ∈ Option.map f o → p y) ↔ ∀ (x : α), x ∈ o → p (f x)" ]
import Mathlib.MeasureTheory.Measure.NullMeasurable import Mathlib.MeasureTheory.MeasurableSpace.Basic import Mathlib.Topology.Algebra.Order.LiminfLimsup #align_import measure_theory.measure.measure_space from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set open Filter hiding map open Function MeasurableSpace open scoped Classical symmDiff open Topology Filter ENNReal NNReal Interval MeasureTheory variable {α β γ δ ι R R' : Type*} namespace MeasureTheory section variable {m : MeasurableSpace α} {μ μ₁ μ₂ : Measure α} {s s₁ s₂ t : Set α} instance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae μ) := ⟨fun _s hs => let ⟨t, hst, htm, htμ⟩ := exists_measurable_superset_of_null hs ⟨tᶜ, compl_mem_ae_iff.2 htμ, htm.compl, compl_subset_comm.1 hst⟩⟩ #align measure_theory.ae_is_measurably_generated MeasureTheory.ae_isMeasurablyGenerated
Mathlib/MeasureTheory/Measure/MeasureSpace.lean
107
109
theorem ae_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} : (∀ᵐ x ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ x ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ x ∂μ, x ∈ Ioc b a → P x := by
simp only [uIoc_eq_union, mem_union, or_imp, eventually_and]
[ " (∀ᵐ (x : α) ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ (x : α) ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ (x : α) ∂μ, x ∈ Ioc b a → P x" ]
[]
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Factorial.DoubleFactorial #align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"938d3db9c278f8a52c0f964a405806f0f2b09b74" noncomputable section open Polynomial namespace Polynomial noncomputable def hermite : ℕ → Polynomial ℤ | 0 => 1 | n + 1 => X * hermite n - derivative (hermite n) #align polynomial.hermite Polynomial.hermite @[simp] theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - derivative (hermite n) := by rw [hermite] #align polynomial.hermite_succ Polynomial.hermite_succ
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
59
62
theorem hermite_eq_iterate (n : ℕ) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by
induction' n with n ih · rfl · rw [Function.iterate_succ_apply', ← ih, hermite_succ]
[ " hermite (n + 1) = X * hermite n - derivative (hermite n)", " hermite n = (fun p => X * p - derivative p)^[n] 1", " hermite 0 = (fun p => X * p - derivative p)^[0] 1", " hermite (n + 1) = (fun p => X * p - derivative p)^[n + 1] 1" ]
[ " hermite (n + 1) = X * hermite n - derivative (hermite n)" ]
import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.SimpleGraph.Density import Mathlib.Data.Rat.BigOperators #align_import combinatorics.simple_graph.regularity.energy from "leanprover-community/mathlib"@"bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d" open Finset variable {α : Type*} [DecidableEq α] {s : Finset α} (P : Finpartition s) (G : SimpleGraph α) [DecidableRel G.Adj] namespace Finpartition def energy : ℚ := ((∑ uv ∈ P.parts.offDiag, G.edgeDensity uv.1 uv.2 ^ 2) : ℚ) / (P.parts.card : ℚ) ^ 2 #align finpartition.energy Finpartition.energy
Mathlib/Combinatorics/SimpleGraph/Regularity/Energy.lean
42
43
theorem energy_nonneg : 0 ≤ P.energy G := by
exact div_nonneg (Finset.sum_nonneg fun _ _ => sq_nonneg _) <| sq_nonneg _
[ " 0 ≤ P.energy G" ]
[]
import Mathlib.MeasureTheory.Group.Arithmetic #align_import measure_theory.group.pointwise from "leanprover-community/mathlib"@"66f7114a1d5cba41c47d417a034bbb2e96cf564a" open Pointwise open Set @[to_additive] theorem MeasurableSet.const_smul {G α : Type*} [Group G] [MulAction G α] [MeasurableSpace G] [MeasurableSpace α] [MeasurableSMul G α] {s : Set α} (hs : MeasurableSet s) (a : G) : MeasurableSet (a • s) := by rw [← preimage_smul_inv] exact measurable_const_smul _ hs #align measurable_set.const_smul MeasurableSet.const_smul #align measurable_set.const_vadd MeasurableSet.const_vadd theorem MeasurableSet.const_smul_of_ne_zero {G₀ α : Type*} [GroupWithZero G₀] [MulAction G₀ α] [MeasurableSpace G₀] [MeasurableSpace α] [MeasurableSMul G₀ α] {s : Set α} (hs : MeasurableSet s) {a : G₀} (ha : a ≠ 0) : MeasurableSet (a • s) := by rw [← preimage_smul_inv₀ ha] exact measurable_const_smul _ hs #align measurable_set.const_smul_of_ne_zero MeasurableSet.const_smul_of_ne_zero
Mathlib/MeasureTheory/Group/Pointwise.lean
39
44
theorem MeasurableSet.const_smul₀ {G₀ α : Type*} [GroupWithZero G₀] [Zero α] [MulActionWithZero G₀ α] [MeasurableSpace G₀] [MeasurableSpace α] [MeasurableSMul G₀ α] [MeasurableSingletonClass α] {s : Set α} (hs : MeasurableSet s) (a : G₀) : MeasurableSet (a • s) := by
rcases eq_or_ne a 0 with (rfl | ha) exacts [(subsingleton_zero_smul_set s).measurableSet, hs.const_smul_of_ne_zero ha]
[ " MeasurableSet (a • s)", " MeasurableSet ((fun x => a⁻¹ • x) ⁻¹' s)" ]
[ " MeasurableSet (a • s)", " MeasurableSet ((fun x => a⁻¹ • x) ⁻¹' s)" ]
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd" namespace Polynomial open Polynomial Finsupp Finset open Polynomial section Semiring variable {R : Type*} [Semiring R] {f : R[X]} def revAtFun (N i : ℕ) : ℕ := ite (i ≤ N) (N - i) i #align polynomial.rev_at_fun Polynomial.revAtFun theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by unfold revAtFun split_ifs with h j · exact tsub_tsub_cancel_of_le h · exfalso apply j exact Nat.sub_le N i · rfl #align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by intro a b hab rw [← @revAtFun_invol N a, hab, revAtFun_invol] #align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj def revAt (N : ℕ) : Function.Embedding ℕ ℕ where toFun i := ite (i ≤ N) (N - i) i inj' := revAtFun_inj #align polynomial.rev_at Polynomial.revAt @[simp] theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i := rfl #align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq @[simp] theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i := revAtFun_invol #align polynomial.rev_at_invol Polynomial.revAt_invol @[simp] theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i := if_pos H #align polynomial.rev_at_le Polynomial.revAt_le lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h] theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) : revAt (N + O) (n + o) = revAt N n + revAt O o := by rcases Nat.le.dest hn with ⟨n', rfl⟩ rcases Nat.le.dest ho with ⟨o', rfl⟩ repeat' rw [revAt_le (le_add_right rfl.le)] rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)] repeat' rw [add_tsub_cancel_left] #align polynomial.rev_at_add Polynomial.revAt_add -- @[simp] -- Porting note (#10618): simp can prove this theorem revAt_zero (N : ℕ) : revAt N 0 = N := by simp #align polynomial.rev_at_zero Polynomial.revAt_zero noncomputable def reflect (N : ℕ) : R[X] → R[X] | ⟨f⟩ => ⟨Finsupp.embDomain (revAt N) f⟩ #align polynomial.reflect Polynomial.reflect theorem reflect_support (N : ℕ) (f : R[X]) : (reflect N f).support = Finset.image (revAt N) f.support := by rcases f with ⟨⟩ ext1 simp only [reflect, support_ofFinsupp, support_embDomain, Finset.mem_map, Finset.mem_image] #align polynomial.reflect_support Polynomial.reflect_support @[simp]
Mathlib/Algebra/Polynomial/Reverse.lean
113
119
theorem coeff_reflect (N : ℕ) (f : R[X]) (i : ℕ) : coeff (reflect N f) i = f.coeff (revAt N i) := by
rcases f with ⟨f⟩ simp only [reflect, coeff] calc Finsupp.embDomain (revAt N) f i = Finsupp.embDomain (revAt N) f (revAt N (revAt N i)) := by rw [revAt_invol] _ = f (revAt N i) := Finsupp.embDomain_apply _ _ _
[ " revAtFun N (revAtFun N i) = i", " (if (if i ≤ N then N - i else i) ≤ N then N - if i ≤ N then N - i else i else if i ≤ N then N - i else i) = i", " N - (N - i) = i", " N - i = i", " False", " N - i ≤ N", " i = i", " Function.Injective (revAtFun N)", " a = b", " (revAt N) i = i", " (revAt (N + ...
[ " revAtFun N (revAtFun N i) = i", " (if (if i ≤ N then N - i else i) ≤ N then N - if i ≤ N then N - i else i else if i ≤ N then N - i else i) = i", " N - (N - i) = i", " N - i = i", " False", " N - i ≤ N", " i = i", " Function.Injective (revAtFun N)", " a = b", " (revAt N) i = i", " (revAt (N + ...
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Mul import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open scoped Classical Topology Filter ENNReal open Filter Asymptotics Set open ContinuousLinearMap (smulRight smulRight_one_eq_iff) variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} namespace ContinuousLinearMap variable {B : E →L[𝕜] F →L[𝕜] G} {u : 𝕜 → E} {v : 𝕜 → F} {u' : E} {v' : F}
Mathlib/Analysis/Calculus/Deriv/Mul.lean
52
56
theorem hasDerivWithinAt_of_bilinear (hu : HasDerivWithinAt u u' s x) (hv : HasDerivWithinAt v v' s x) : HasDerivWithinAt (fun x ↦ B (u x) (v x)) (B (u x) v' + B u' (v x)) s x := by
simpa using (B.hasFDerivWithinAt_of_bilinear hu.hasFDerivWithinAt hv.hasFDerivWithinAt).hasDerivWithinAt
[ " HasDerivWithinAt (fun x => (B (u x)) (v x)) ((B (u x)) v' + (B u') (v x)) s x" ]
[]
import Mathlib.CategoryTheory.Filtered.Connected import Mathlib.CategoryTheory.Limits.TypesFiltered import Mathlib.CategoryTheory.Limits.Final universe v₁ v₂ u₁ u₂ namespace CategoryTheory open CategoryTheory.Limits CategoryTheory.Functor Opposite section ArbitraryUniverses variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D) theorem Functor.final_of_isFiltered_structuredArrow [∀ d, IsFiltered (StructuredArrow d F)] : Final F where out _ := IsFiltered.isConnected _ theorem Functor.initial_of_isCofiltered_costructuredArrow [∀ d, IsCofiltered (CostructuredArrow F d)] : Initial F where out _ := IsCofiltered.isConnected _ theorem isFiltered_structuredArrow_of_isFiltered_of_exists [IsFilteredOrEmpty C] (h₁ : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) (h₂ : ∀ {d : D} {c : C} (s s' : d ⟶ F.obj c), ∃ (c' : C) (t : c ⟶ c'), s ≫ F.map t = s' ≫ F.map t) (d : D) : IsFiltered (StructuredArrow d F) := by have : Nonempty (StructuredArrow d F) := by obtain ⟨c, ⟨f⟩⟩ := h₁ d exact ⟨.mk f⟩ suffices IsFilteredOrEmpty (StructuredArrow d F) from IsFiltered.mk refine ⟨fun f g => ?_, fun f g η μ => ?_⟩ · obtain ⟨c, ⟨t, ht⟩⟩ := h₂ (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right)) (g.hom ≫ F.map (IsFiltered.rightToMax f.right g.right)) refine ⟨.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t)), ?_, ?_, trivial⟩ · exact StructuredArrow.homMk (IsFiltered.leftToMax _ _ ≫ t) rfl · exact StructuredArrow.homMk (IsFiltered.rightToMax _ _ ≫ t) (by simpa using ht.symm) · refine ⟨.mk (f.hom ≫ F.map (η.right ≫ IsFiltered.coeqHom η.right μ.right)), StructuredArrow.homMk (IsFiltered.coeqHom η.right μ.right) (by simp), ?_⟩ simpa using IsFiltered.coeq_condition _ _ theorem isCofiltered_costructuredArrow_of_isCofiltered_of_exists [IsCofilteredOrEmpty C] (h₁ : ∀ d, ∃ c, Nonempty (F.obj c ⟶ d)) (h₂ : ∀ {d : D} {c : C} (s s' : F.obj c ⟶ d), ∃ (c' : C) (t : c' ⟶ c), F.map t ≫ s = F.map t ≫ s') (d : D) : IsCofiltered (CostructuredArrow F d) := by suffices IsFiltered (CostructuredArrow F d)ᵒᵖ from isCofiltered_of_isFiltered_op _ suffices IsFiltered (StructuredArrow (op d) F.op) from IsFiltered.of_equivalence (costructuredArrowOpEquivalence _ _).symm apply isFiltered_structuredArrow_of_isFiltered_of_exists · intro d obtain ⟨c, ⟨t⟩⟩ := h₁ d.unop exact ⟨op c, ⟨Quiver.Hom.op t⟩⟩ · intro d c s s' obtain ⟨c', t, ht⟩ := h₂ s.unop s'.unop exact ⟨op c', Quiver.Hom.op t, Quiver.Hom.unop_inj ht⟩ theorem Functor.final_of_exists_of_isFiltered [IsFilteredOrEmpty C] (h₁ : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) (h₂ : ∀ {d : D} {c : C} (s s' : d ⟶ F.obj c), ∃ (c' : C) (t : c ⟶ c'), s ≫ F.map t = s' ≫ F.map t) : Functor.Final F := by suffices ∀ d, IsFiltered (StructuredArrow d F) from final_of_isFiltered_structuredArrow F exact isFiltered_structuredArrow_of_isFiltered_of_exists F h₁ h₂
Mathlib/CategoryTheory/Filtered/Final.lean
99
104
theorem Functor.initial_of_exists_of_isCofiltered [IsCofilteredOrEmpty C] (h₁ : ∀ d, ∃ c, Nonempty (F.obj c ⟶ d)) (h₂ : ∀ {d : D} {c : C} (s s' : F.obj c ⟶ d), ∃ (c' : C) (t : c' ⟶ c), F.map t ≫ s = F.map t ≫ s') : Functor.Initial F := by
suffices ∀ d, IsCofiltered (CostructuredArrow F d) from initial_of_isCofiltered_costructuredArrow F exact isCofiltered_costructuredArrow_of_isCofiltered_of_exists F h₁ h₂
[ " IsFiltered (StructuredArrow d F)", " Nonempty (StructuredArrow d F)", " IsFilteredOrEmpty (StructuredArrow d F)", " ∃ Z x x, True", " f ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))", " g ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))", ...
[ " IsFiltered (StructuredArrow d F)", " Nonempty (StructuredArrow d F)", " IsFilteredOrEmpty (StructuredArrow d F)", " ∃ Z x x, True", " f ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))", " g ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))", ...
import Mathlib.Algebra.Lie.Submodule #align_import algebra.lie.ideal_operations from "leanprover-community/mathlib"@"8983bec7cdf6cb2dd1f21315c8a34ab00d7b2f6d" universe u v w w₁ w₂ namespace LieSubmodule variable {R : Type u} {L : Type v} {M : Type w} {M₂ : Type w₁} variable [CommRing R] [LieRing L] [LieAlgebra R L] variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] variable [AddCommGroup M₂] [Module R M₂] [LieRingModule L M₂] [LieModule R L M₂] variable (N N' : LieSubmodule R L M) (I J : LieIdeal R L) (N₂ : LieSubmodule R L M₂) section LieIdealOperations instance hasBracket : Bracket (LieIdeal R L) (LieSubmodule R L M) := ⟨fun I N => lieSpan R L { m | ∃ (x : I) (n : N), ⁅(x : L), (n : M)⁆ = m }⟩ #align lie_submodule.has_bracket LieSubmodule.hasBracket theorem lieIdeal_oper_eq_span : ⁅I, N⁆ = lieSpan R L { m | ∃ (x : I) (n : N), ⁅(x : L), (n : M)⁆ = m } := rfl #align lie_submodule.lie_ideal_oper_eq_span LieSubmodule.lieIdeal_oper_eq_span theorem lieIdeal_oper_eq_linear_span : (↑⁅I, N⁆ : Submodule R M) = Submodule.span R { m | ∃ (x : I) (n : N), ⁅(x : L), (n : M)⁆ = m } := by apply le_antisymm · let s := { m : M | ∃ (x : ↥I) (n : ↥N), ⁅(x : L), (n : M)⁆ = m } have aux : ∀ (y : L), ∀ m' ∈ Submodule.span R s, ⁅y, m'⁆ ∈ Submodule.span R s := by intro y m' hm' refine Submodule.span_induction (R := R) (M := M) (s := s) (p := fun m' ↦ ⁅y, m'⁆ ∈ Submodule.span R s) hm' ?_ ?_ ?_ ?_ · rintro m'' ⟨x, n, hm''⟩; rw [← hm'', leibniz_lie] refine Submodule.add_mem _ ?_ ?_ <;> apply Submodule.subset_span · use ⟨⁅y, ↑x⁆, I.lie_mem x.property⟩, n · use x, ⟨⁅y, ↑n⁆, N.lie_mem n.property⟩ · simp only [lie_zero, Submodule.zero_mem] · intro m₁ m₂ hm₁ hm₂; rw [lie_add]; exact Submodule.add_mem _ hm₁ hm₂ · intro t m'' hm''; rw [lie_smul]; exact Submodule.smul_mem _ t hm'' change _ ≤ ({ Submodule.span R s with lie_mem := fun hm' => aux _ _ hm' } : LieSubmodule R L M) rw [lieIdeal_oper_eq_span, lieSpan_le] exact Submodule.subset_span · rw [lieIdeal_oper_eq_span]; apply submodule_span_le_lieSpan #align lie_submodule.lie_ideal_oper_eq_linear_span LieSubmodule.lieIdeal_oper_eq_linear_span theorem lieIdeal_oper_eq_linear_span' : (↑⁅I, N⁆ : Submodule R M) = Submodule.span R { m | ∃ x ∈ I, ∃ n ∈ N, ⁅x, n⁆ = m } := by rw [lieIdeal_oper_eq_linear_span] congr ext m constructor · rintro ⟨⟨x, hx⟩, ⟨n, hn⟩, rfl⟩ exact ⟨x, hx, n, hn, rfl⟩ · rintro ⟨x, hx, n, hn, rfl⟩ exact ⟨⟨x, hx⟩, ⟨n, hn⟩, rfl⟩ #align lie_submodule.lie_ideal_oper_eq_linear_span' LieSubmodule.lieIdeal_oper_eq_linear_span' theorem lie_le_iff : ⁅I, N⁆ ≤ N' ↔ ∀ x ∈ I, ∀ m ∈ N, ⁅x, m⁆ ∈ N' := by rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le] refine ⟨fun h x hx m hm => h ⟨⟨x, hx⟩, ⟨m, hm⟩, rfl⟩, ?_⟩ rintro h _ ⟨⟨x, hx⟩, ⟨m, hm⟩, rfl⟩ exact h x hx m hm #align lie_submodule.lie_le_iff LieSubmodule.lie_le_iff
Mathlib/Algebra/Lie/IdealOperations.lean
103
104
theorem lie_coe_mem_lie (x : I) (m : N) : ⁅(x : L), (m : M)⁆ ∈ ⁅I, N⁆ := by
rw [lieIdeal_oper_eq_span]; apply subset_lieSpan; use x, m
[ " ↑⁅I, N⁆ = Submodule.span R {m | ∃ x n, ⁅↑x, ↑n⁆ = m}", " ↑⁅I, N⁆ ≤ Submodule.span R {m | ∃ x n, ⁅↑x, ↑n⁆ = m}", " ∀ (y : L), ∀ m' ∈ Submodule.span R s, ⁅y, m'⁆ ∈ Submodule.span R s", " ⁅y, m'⁆ ∈ Submodule.span R s", " ∀ x ∈ s, (fun m' => ⁅y, m'⁆ ∈ Submodule.span R s) x", " ⁅y, m''⁆ ∈ Submodule.span R s"...
[ " ↑⁅I, N⁆ = Submodule.span R {m | ∃ x n, ⁅↑x, ↑n⁆ = m}", " ↑⁅I, N⁆ ≤ Submodule.span R {m | ∃ x n, ⁅↑x, ↑n⁆ = m}", " ∀ (y : L), ∀ m' ∈ Submodule.span R s, ⁅y, m'⁆ ∈ Submodule.span R s", " ⁅y, m'⁆ ∈ Submodule.span R s", " ∀ x ∈ s, (fun m' => ⁅y, m'⁆ ∈ Submodule.span R s) x", " ⁅y, m''⁆ ∈ Submodule.span R s"...
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Laurent import Mathlib.LinearAlgebra.Matrix.Charpoly.Basic import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.RingTheory.Polynomial.Nilpotent #align_import linear_algebra.matrix.charpoly.coeff from "leanprover-community/mathlib"@"9745b093210e9dac443af24da9dba0f9e2b6c912" noncomputable section -- porting note: whenever there was `∏ i : n, X - C (M i i)`, I replaced it with -- `∏ i : n, (X - C (M i i))`, since otherwise Lean would parse as `(∏ i : n, X) - C (M i i)` universe u v w z open Finset Matrix Polynomial variable {R : Type u} [CommRing R] variable {n G : Type v} [DecidableEq n] [Fintype n] variable {α β : Type v} [DecidableEq α] variable {M : Matrix n n R} namespace Matrix theorem charmatrix_apply_natDegree [Nontrivial R] (i j : n) : (charmatrix M i j).natDegree = ite (i = j) 1 0 := by by_cases h : i = j <;> simp [h, ← degree_eq_iff_natDegree_eq_of_pos (Nat.succ_pos 0)] #align charmatrix_apply_nat_degree Matrix.charmatrix_apply_natDegree theorem charmatrix_apply_natDegree_le (i j : n) : (charmatrix M i j).natDegree ≤ ite (i = j) 1 0 := by split_ifs with h <;> simp [h, natDegree_X_le] #align charmatrix_apply_nat_degree_le Matrix.charmatrix_apply_natDegree_le variable (M) theorem charpoly_sub_diagonal_degree_lt : (M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1) := by rw [charpoly, det_apply', ← insert_erase (mem_univ (Equiv.refl n)), sum_insert (not_mem_erase (Equiv.refl n) univ), add_comm] simp only [charmatrix_apply_eq, one_mul, Equiv.Perm.sign_refl, id, Int.cast_one, Units.val_one, add_sub_cancel_right, Equiv.coe_refl] rw [← mem_degreeLT] apply Submodule.sum_mem (degreeLT R (Fintype.card n - 1)) intro c hc; rw [← C_eq_intCast, C_mul'] apply Submodule.smul_mem (degreeLT R (Fintype.card n - 1)) ↑↑(Equiv.Perm.sign c) rw [mem_degreeLT] apply lt_of_le_of_lt degree_le_natDegree _ rw [Nat.cast_lt] apply lt_of_le_of_lt _ (Equiv.Perm.fixed_point_card_lt_of_ne_one (ne_of_mem_erase hc)) apply le_trans (Polynomial.natDegree_prod_le univ fun i : n => charmatrix M (c i) i) _ rw [card_eq_sum_ones]; rw [sum_filter]; apply sum_le_sum intros apply charmatrix_apply_natDegree_le #align matrix.charpoly_sub_diagonal_degree_lt Matrix.charpoly_sub_diagonal_degree_lt theorem charpoly_coeff_eq_prod_coeff_of_le {k : ℕ} (h : Fintype.card n - 1 ≤ k) : M.charpoly.coeff k = (∏ i : n, (X - C (M i i))).coeff k := by apply eq_of_sub_eq_zero; rw [← coeff_sub] apply Polynomial.coeff_eq_zero_of_degree_lt apply lt_of_lt_of_le (charpoly_sub_diagonal_degree_lt M) ?_ rw [Nat.cast_le]; apply h #align matrix.charpoly_coeff_eq_prod_coeff_of_le Matrix.charpoly_coeff_eq_prod_coeff_of_le
Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean
89
93
theorem det_of_card_zero (h : Fintype.card n = 0) (M : Matrix n n R) : M.det = 1 := by
rw [Fintype.card_eq_zero_iff] at h suffices M = 1 by simp [this] ext i exact h.elim i
[ " (M.charmatrix i j).natDegree = if i = j then 1 else 0", " (M.charmatrix i j).natDegree ≤ if i = j then 1 else 0", " (M.charmatrix i j).natDegree ≤ 1", " (M.charmatrix i j).natDegree ≤ 0", " (M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1)", " (∑ x ∈ univ.erase (Equiv.refl n), ↑↑(Eq...
[ " (M.charmatrix i j).natDegree = if i = j then 1 else 0", " (M.charmatrix i j).natDegree ≤ if i = j then 1 else 0", " (M.charmatrix i j).natDegree ≤ 1", " (M.charmatrix i j).natDegree ≤ 0", " (M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1)", " (∑ x ∈ univ.erase (Equiv.refl n), ↑↑(Eq...
import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Topology.Algebra.Field import Mathlib.Topology.Algebra.Order.Group #align_import topology.algebra.order.field from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" open Set Filter TopologicalSpace Function open scoped Pointwise Topology open OrderDual (toDual ofDual) theorem TopologicalRing.of_norm {R 𝕜 : Type*} [NonUnitalNonAssocRing R] [LinearOrderedField 𝕜] [TopologicalSpace R] [TopologicalAddGroup R] (norm : R → 𝕜) (norm_nonneg : ∀ x, 0 ≤ norm x) (norm_mul_le : ∀ x y, norm (x * y) ≤ norm x * norm y) (nhds_basis : (𝓝 (0 : R)).HasBasis ((0 : 𝕜) < ·) (fun ε ↦ { x | norm x < ε })) : TopologicalRing R := by have h0 : ∀ f : R → R, ∀ c ≥ (0 : 𝕜), (∀ x, norm (f x) ≤ c * norm x) → Tendsto f (𝓝 0) (𝓝 0) := by refine fun f c c0 hf ↦ (nhds_basis.tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ rcases exists_pos_mul_lt ε0 c with ⟨δ, δ0, hδ⟩ refine ⟨δ, δ0, fun x hx ↦ (hf _).trans_lt ?_⟩ exact (mul_le_mul_of_nonneg_left (le_of_lt hx) c0).trans_lt hδ apply TopologicalRing.of_addGroup_of_nhds_zero case hmul => refine ((nhds_basis.prod nhds_basis).tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ refine ⟨(1, ε), ⟨one_pos, ε0⟩, fun (x, y) ⟨hx, hy⟩ => ?_⟩ simp only [sub_zero] at * calc norm (x * y) ≤ norm x * norm y := norm_mul_le _ _ _ < ε := mul_lt_of_le_one_of_lt_of_nonneg hx.le hy (norm_nonneg _) case hmul_left => exact fun x => h0 _ (norm x) (norm_nonneg _) (norm_mul_le x) case hmul_right => exact fun y => h0 (· * y) (norm y) (norm_nonneg y) fun x => (norm_mul_le x y).trans_eq (mul_comm _ _) variable {𝕜 α : Type*} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] {l : Filter α} {f g : α → 𝕜} -- see Note [lower instance priority] instance (priority := 100) LinearOrderedField.topologicalRing : TopologicalRing 𝕜 := .of_norm abs abs_nonneg (fun _ _ ↦ (abs_mul _ _).le) <| by simpa using nhds_basis_abs_sub_lt (0 : 𝕜) theorem Filter.Tendsto.atTop_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atTop) (hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by refine tendsto_atTop_mono' _ ?_ (hf.atTop_mul_const (half_pos hC)) filter_upwards [hg.eventually (lt_mem_nhds (half_lt_self hC)), hf.eventually_ge_atTop 0] with x hg hf using mul_le_mul_of_nonneg_left hg.le hf #align filter.tendsto.at_top_mul Filter.Tendsto.atTop_mul
Mathlib/Topology/Algebra/Order/Field.lean
72
74
theorem Filter.Tendsto.mul_atTop {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atTop := by
simpa only [mul_comm] using hg.atTop_mul hC hf
[ " TopologicalRing R", " ∀ (f : R → R), ∀ c ≥ 0, (∀ (x : R), norm (f x) ≤ c * norm x) → Tendsto f (𝓝 0) (𝓝 0)", " ∃ ia, 0 < ia ∧ ∀ x ∈ {x | norm x < ia}, f x ∈ {x | norm x < ε}", " c * norm x < ε", " ∀ (x₀ : R), Tendsto (fun x => x * x₀) (𝓝 0) (𝓝 0)", " Tendsto (uncurry fun x x_1 => x * x_1) (𝓝 0 ×ˢ �...
[ " TopologicalRing R", " ∀ (f : R → R), ∀ c ≥ 0, (∀ (x : R), norm (f x) ≤ c * norm x) → Tendsto f (𝓝 0) (𝓝 0)", " ∃ ia, 0 < ia ∧ ∀ x ∈ {x | norm x < ia}, f x ∈ {x | norm x < ε}", " c * norm x < ε", " ∀ (x₀ : R), Tendsto (fun x => x * x₀) (𝓝 0) (𝓝 0)", " Tendsto (uncurry fun x x_1 => x * x_1) (𝓝 0 ×ˢ �...
import Mathlib.Algebra.Order.Field.Pi import Mathlib.Algebra.Order.UpperLower import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Data.Real.Sqrt import Mathlib.Topology.Algebra.Order.UpperLower import Mathlib.Topology.MetricSpace.Sequences #align_import analysis.normed.order.upper_lower from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010" open Bornology Function Metric Set open scoped Pointwise variable {α ι : Type*} section Finite variable [Finite ι] {s : Set (ι → ℝ)} {x y : ι → ℝ}
Mathlib/Analysis/Normed/Order/UpperLower.lean
94
109
theorem IsUpperSet.mem_interior_of_forall_lt (hs : IsUpperSet s) (hx : x ∈ closure s) (h : ∀ i, x i < y i) : y ∈ interior s := by
cases nonempty_fintype ι obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε rw [dist_pi_lt_iff hε] at hxz have hyz : ∀ i, z i < y i := by refine fun i => (hxy _).trans_le' (sub_le_iff_le_add'.1 <| (le_abs_self _).trans ?_) rw [← Real.norm_eq_abs, ← dist_eq_norm'] exact (hxz _).le obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩ rintro w hw refine hs (fun i => ?_) hz simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw exact ((lt_sub_iff_add_lt.2 <| hyz _).trans (hw _ <| mem_univ _).1).le
[ " y ∈ interior s", " ∀ (i : ι), z i < y i", " |z i - x i| ≤ ε", " dist (x i) (z i) ≤ ε", " ball y δ ⊆ s", " w ∈ s", " z i ≤ w i" ]
[]
import Mathlib.MeasureTheory.Integral.SetToL1 #align_import measure_theory.integral.bochner from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" assert_not_exists Differentiable noncomputable section open scoped Topology NNReal ENNReal MeasureTheory open Set Filter TopologicalSpace ENNReal EMetric namespace MeasureTheory variable {α E F 𝕜 : Type*} local infixr:25 " →ₛ " => SimpleFunc namespace SimpleFunc section PosPart variable [LinearOrder E] [Zero E] [MeasurableSpace α] def posPart (f : α →ₛ E) : α →ₛ E := f.map fun b => max b 0 #align measure_theory.simple_func.pos_part MeasureTheory.SimpleFunc.posPart def negPart [Neg E] (f : α →ₛ E) : α →ₛ E := posPart (-f) #align measure_theory.simple_func.neg_part MeasureTheory.SimpleFunc.negPart theorem posPart_map_norm (f : α →ₛ ℝ) : (posPart f).map norm = posPart f := by ext; rw [map_apply, Real.norm_eq_abs, abs_of_nonneg]; exact le_max_right _ _ #align measure_theory.simple_func.pos_part_map_norm MeasureTheory.SimpleFunc.posPart_map_norm theorem negPart_map_norm (f : α →ₛ ℝ) : (negPart f).map norm = negPart f := by rw [negPart]; exact posPart_map_norm _ #align measure_theory.simple_func.neg_part_map_norm MeasureTheory.SimpleFunc.negPart_map_norm
Mathlib/MeasureTheory/Integral/Bochner.lean
282
286
theorem posPart_sub_negPart (f : α →ₛ ℝ) : f.posPart - f.negPart = f := by
simp only [posPart, negPart] ext a rw [coe_sub] exact max_zero_sub_eq_self (f a)
[ " map norm f.posPart = f.posPart", " ↑(map norm f.posPart) a✝ = ↑f.posPart a✝", " 0 ≤ ↑f.posPart a✝", " map norm f.negPart = f.negPart", " map norm (-f).posPart = (-f).posPart", " f.posPart - f.negPart = f", " map (fun b => max b 0) f - map (fun b => max b 0) (-f) = f", " ↑(map (fun b => max b 0) f - ...
[ " map norm f.posPart = f.posPart", " ↑(map norm f.posPart) a✝ = ↑f.posPart a✝", " 0 ≤ ↑f.posPart a✝", " map norm f.negPart = f.negPart", " map norm (-f).posPart = (-f).posPart" ]
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Data.ENat.Basic #align_import data.polynomial.degree.trailing_degree from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836" noncomputable section open Function Polynomial Finsupp Finset open scoped Polynomial namespace Polynomial universe u v variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ} section Semiring variable [Semiring R] {p q r : R[X]} def trailingDegree (p : R[X]) : ℕ∞ := p.support.min #align polynomial.trailing_degree Polynomial.trailingDegree theorem trailingDegree_lt_wf : WellFounded fun p q : R[X] => trailingDegree p < trailingDegree q := InvImage.wf trailingDegree wellFounded_lt #align polynomial.trailing_degree_lt_wf Polynomial.trailingDegree_lt_wf def natTrailingDegree (p : R[X]) : ℕ := (trailingDegree p).getD 0 #align polynomial.nat_trailing_degree Polynomial.natTrailingDegree def trailingCoeff (p : R[X]) : R := coeff p (natTrailingDegree p) #align polynomial.trailing_coeff Polynomial.trailingCoeff def TrailingMonic (p : R[X]) := trailingCoeff p = (1 : R) #align polynomial.trailing_monic Polynomial.TrailingMonic theorem TrailingMonic.def : TrailingMonic p ↔ trailingCoeff p = 1 := Iff.rfl #align polynomial.trailing_monic.def Polynomial.TrailingMonic.def instance TrailingMonic.decidable [DecidableEq R] : Decidable (TrailingMonic p) := inferInstanceAs <| Decidable (trailingCoeff p = (1 : R)) #align polynomial.trailing_monic.decidable Polynomial.TrailingMonic.decidable @[simp] theorem TrailingMonic.trailingCoeff {p : R[X]} (hp : p.TrailingMonic) : trailingCoeff p = 1 := hp #align polynomial.trailing_monic.trailing_coeff Polynomial.TrailingMonic.trailingCoeff @[simp] theorem trailingDegree_zero : trailingDegree (0 : R[X]) = ⊤ := rfl #align polynomial.trailing_degree_zero Polynomial.trailingDegree_zero @[simp] theorem trailingCoeff_zero : trailingCoeff (0 : R[X]) = 0 := rfl #align polynomial.trailing_coeff_zero Polynomial.trailingCoeff_zero @[simp] theorem natTrailingDegree_zero : natTrailingDegree (0 : R[X]) = 0 := rfl #align polynomial.nat_trailing_degree_zero Polynomial.natTrailingDegree_zero theorem trailingDegree_eq_top : trailingDegree p = ⊤ ↔ p = 0 := ⟨fun h => support_eq_empty.1 (Finset.min_eq_top.1 h), fun h => by simp [h]⟩ #align polynomial.trailing_degree_eq_top Polynomial.trailingDegree_eq_top theorem trailingDegree_eq_natTrailingDegree (hp : p ≠ 0) : trailingDegree p = (natTrailingDegree p : ℕ∞) := by let ⟨n, hn⟩ := not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt trailingDegree_eq_top.1 hp)) have hn : trailingDegree p = n := Classical.not_not.1 hn rw [natTrailingDegree, hn] rfl #align polynomial.trailing_degree_eq_nat_trailing_degree Polynomial.trailingDegree_eq_natTrailingDegree theorem trailingDegree_eq_iff_natTrailingDegree_eq {p : R[X]} {n : ℕ} (hp : p ≠ 0) : p.trailingDegree = n ↔ p.natTrailingDegree = n := by rw [trailingDegree_eq_natTrailingDegree hp] exact WithTop.coe_eq_coe #align polynomial.trailing_degree_eq_iff_nat_trailing_degree_eq Polynomial.trailingDegree_eq_iff_natTrailingDegree_eq theorem trailingDegree_eq_iff_natTrailingDegree_eq_of_pos {p : R[X]} {n : ℕ} (hn : 0 < n) : p.trailingDegree = n ↔ p.natTrailingDegree = n := by constructor · intro H rwa [← trailingDegree_eq_iff_natTrailingDegree_eq] rintro rfl rw [trailingDegree_zero] at H exact Option.noConfusion H · intro H rwa [trailingDegree_eq_iff_natTrailingDegree_eq] rintro rfl rw [natTrailingDegree_zero] at H rw [H] at hn exact lt_irrefl _ hn #align polynomial.trailing_degree_eq_iff_nat_trailing_degree_eq_of_pos Polynomial.trailingDegree_eq_iff_natTrailingDegree_eq_of_pos theorem natTrailingDegree_eq_of_trailingDegree_eq_some {p : R[X]} {n : ℕ} (h : trailingDegree p = n) : natTrailingDegree p = n := have hp0 : p ≠ 0 := fun hp0 => by rw [hp0] at h; exact Option.noConfusion h Option.some_inj.1 <| show (natTrailingDegree p : ℕ∞) = n by rwa [← trailingDegree_eq_natTrailingDegree hp0] #align polynomial.nat_trailing_degree_eq_of_trailing_degree_eq_some Polynomial.natTrailingDegree_eq_of_trailingDegree_eq_some @[simp] theorem natTrailingDegree_le_trailingDegree : ↑(natTrailingDegree p) ≤ trailingDegree p := by by_cases hp : p = 0; · rw [hp, trailingDegree_zero] exact le_top rw [trailingDegree_eq_natTrailingDegree hp] #align polynomial.nat_trailing_degree_le_trailing_degree Polynomial.natTrailingDegree_le_trailingDegree theorem natTrailingDegree_eq_of_trailingDegree_eq [Semiring S] {q : S[X]} (h : trailingDegree p = trailingDegree q) : natTrailingDegree p = natTrailingDegree q := by unfold natTrailingDegree rw [h] #align polynomial.nat_trailing_degree_eq_of_trailing_degree_eq Polynomial.natTrailingDegree_eq_of_trailingDegree_eq theorem trailingDegree_le_of_ne_zero (h : coeff p n ≠ 0) : trailingDegree p ≤ n := show @LE.le ℕ∞ _ p.support.min n from min_le (mem_support_iff.2 h) #align polynomial.le_trailing_degree_of_ne_zero Polynomial.trailingDegree_le_of_ne_zero
Mathlib/Algebra/Polynomial/Degree/TrailingDegree.lean
158
164
theorem natTrailingDegree_le_of_ne_zero (h : coeff p n ≠ 0) : natTrailingDegree p ≤ n := by
have : WithTop.some (natTrailingDegree p) = Nat.cast (natTrailingDegree p) := rfl rw [← WithTop.coe_le_coe, this, ← trailingDegree_eq_natTrailingDegree] · exact trailingDegree_le_of_ne_zero h · intro h subst h exact h rfl
[ " p.trailingDegree = ⊤", " p.trailingDegree = ↑p.natTrailingDegree", " ↑n = ↑(Option.getD (↑n) 0)", " p.trailingDegree = ↑n ↔ p.natTrailingDegree = n", " ↑p.natTrailingDegree = ↑n ↔ p.natTrailingDegree = n", " p.trailingDegree = ↑n → p.natTrailingDegree = n", " p.natTrailingDegree = n", " p ≠ 0", " ...
[ " p.trailingDegree = ⊤", " p.trailingDegree = ↑p.natTrailingDegree", " ↑n = ↑(Option.getD (↑n) 0)", " p.trailingDegree = ↑n ↔ p.natTrailingDegree = n", " ↑p.natTrailingDegree = ↑n ↔ p.natTrailingDegree = n", " p.trailingDegree = ↑n → p.natTrailingDegree = n", " p.natTrailingDegree = n", " p ≠ 0", " ...
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Algebra.Ring.Nat import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.OrderOfElement import Mathlib.RingTheory.Fintype import Mathlib.Tactic.IntervalCases #align_import number_theory.lucas_lehmer from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" def mersenne (p : ℕ) : ℕ := 2 ^ p - 1 #align mersenne mersenne theorem strictMono_mersenne : StrictMono mersenne := fun m n h ↦ (Nat.sub_lt_sub_iff_right <| Nat.one_le_pow _ _ two_pos).2 <| by gcongr; norm_num1 @[simp] theorem mersenne_lt_mersenne {p q : ℕ} : mersenne p < mersenne q ↔ p < q := strictMono_mersenne.lt_iff_lt @[gcongr] protected alias ⟨_, GCongr.mersenne_lt_mersenne⟩ := mersenne_lt_mersenne @[simp] theorem mersenne_le_mersenne {p q : ℕ} : mersenne p ≤ mersenne q ↔ p ≤ q := strictMono_mersenne.le_iff_le @[gcongr] protected alias ⟨_, GCongr.mersenne_le_mersenne⟩ := mersenne_le_mersenne @[simp] theorem mersenne_zero : mersenne 0 = 0 := rfl @[simp] theorem mersenne_pos {p : ℕ} : 0 < mersenne p ↔ 0 < p := mersenne_lt_mersenne (p := 0) #align mersenne_pos mersenne_pos @[simp] theorem one_lt_mersenne {p : ℕ} : 1 < mersenne p ↔ 1 < p := mersenne_lt_mersenne (p := 1) @[simp] theorem succ_mersenne (k : ℕ) : mersenne k + 1 = 2 ^ k := by rw [mersenne, tsub_add_cancel_of_le] exact one_le_pow_of_one_le (by norm_num) k #align succ_mersenne succ_mersenne namespace LucasLehmer open Nat def s : ℕ → ℤ | 0 => 4 | i + 1 => s i ^ 2 - 2 #align lucas_lehmer.s LucasLehmer.s def sZMod (p : ℕ) : ℕ → ZMod (2 ^ p - 1) | 0 => 4 | i + 1 => sZMod p i ^ 2 - 2 #align lucas_lehmer.s_zmod LucasLehmer.sZMod def sMod (p : ℕ) : ℕ → ℤ | 0 => 4 % (2 ^ p - 1) | i + 1 => (sMod p i ^ 2 - 2) % (2 ^ p - 1) #align lucas_lehmer.s_mod LucasLehmer.sMod theorem mersenne_int_pos {p : ℕ} (hp : p ≠ 0) : (0 : ℤ) < 2 ^ p - 1 := sub_pos.2 <| mod_cast Nat.one_lt_two_pow hp theorem mersenne_int_ne_zero (p : ℕ) (hp : p ≠ 0) : (2 ^ p - 1 : ℤ) ≠ 0 := (mersenne_int_pos hp).ne' #align lucas_lehmer.mersenne_int_ne_zero LucasLehmer.mersenne_int_ne_zero theorem sMod_nonneg (p : ℕ) (hp : p ≠ 0) (i : ℕ) : 0 ≤ sMod p i := by cases i <;> dsimp [sMod] · exact sup_eq_right.mp rfl · apply Int.emod_nonneg exact mersenne_int_ne_zero p hp #align lucas_lehmer.s_mod_nonneg LucasLehmer.sMod_nonneg theorem sMod_mod (p i : ℕ) : sMod p i % (2 ^ p - 1) = sMod p i := by cases i <;> simp [sMod] #align lucas_lehmer.s_mod_mod LucasLehmer.sMod_mod theorem sMod_lt (p : ℕ) (hp : p ≠ 0) (i : ℕ) : sMod p i < 2 ^ p - 1 := by rw [← sMod_mod] refine (Int.emod_lt _ (mersenne_int_ne_zero p hp)).trans_eq ?_ exact abs_of_nonneg (mersenne_int_pos hp).le #align lucas_lehmer.s_mod_lt LucasLehmer.sMod_lt
Mathlib/NumberTheory/LucasLehmer.lean
154
158
theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) := by
induction' i with i ih · dsimp [s, sZMod] norm_num · push_cast [s, sZMod, ih]; rfl
[ " 2 ^ m < 2 ^ n", " 1 < 2", " mersenne k + 1 = 2 ^ k", " 1 ≤ 2 ^ k", " 1 ≤ 2", " 0 ≤ sMod p i", " 0 ≤ sMod p 0", " 0 ≤ sMod p (n✝ + 1)", " 0 ≤ 4 % (2 ^ p - 1)", " 0 ≤ (sMod p n✝ ^ 2 - 2) % (2 ^ p - 1)", " 2 ^ p - 1 ≠ 0", " sMod p i % (2 ^ p - 1) = sMod p i", " sMod p 0 % (2 ^ p - 1) = sMod p...
[ " 2 ^ m < 2 ^ n", " 1 < 2", " mersenne k + 1 = 2 ^ k", " 1 ≤ 2 ^ k", " 1 ≤ 2", " 0 ≤ sMod p i", " 0 ≤ sMod p 0", " 0 ≤ sMod p (n✝ + 1)", " 0 ≤ 4 % (2 ^ p - 1)", " 0 ≤ (sMod p n✝ ^ 2 - 2) % (2 ^ p - 1)", " 2 ^ p - 1 ≠ 0", " sMod p i % (2 ^ p - 1) = sMod p i", " sMod p 0 % (2 ^ p - 1) = sMod p...
import Mathlib.Topology.Order.IsLUB open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) variable {α β γ : Type*} section ConditionallyCompleteLinearOrder variable [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderClosedTopology β] [Nonempty γ] theorem Monotone.map_sSup_of_continuousAt' {f : α → β} {A : Set α} (Cf : ContinuousAt f (sSup A)) (Mf : Monotone f) (A_nonemp : A.Nonempty) (A_bdd : BddAbove A := by bddDefault) : f (sSup A) = sSup (f '' A) := --This is a particular case of the more general `IsLUB.isLUB_of_tendsto` .symm <| ((isLUB_csSup A_nonemp A_bdd).isLUB_of_tendsto (Mf.monotoneOn _) A_nonemp <| Cf.mono_left inf_le_left).csSup_eq (A_nonemp.image f) #align monotone.map_Sup_of_continuous_at' Monotone.map_sSup_of_continuousAt' theorem Monotone.map_iSup_of_continuousAt' {ι : Sort*} [Nonempty ι] {f : α → β} {g : ι → α} (Cf : ContinuousAt f (iSup g)) (Mf : Monotone f) (bdd : BddAbove (range g) := by bddDefault) : f (⨆ i, g i) = ⨆ i, f (g i) := by rw [iSup, Monotone.map_sSup_of_continuousAt' Cf Mf (range_nonempty g) bdd, ← range_comp, iSup] rfl #align monotone.map_supr_of_continuous_at' Monotone.map_iSup_of_continuousAt' theorem Monotone.map_sInf_of_continuousAt' {f : α → β} {A : Set α} (Cf : ContinuousAt f (sInf A)) (Mf : Monotone f) (A_nonemp : A.Nonempty) (A_bdd : BddBelow A := by bddDefault) : f (sInf A) = sInf (f '' A) := Monotone.map_sSup_of_continuousAt' (α := αᵒᵈ) (β := βᵒᵈ) Cf Mf.dual A_nonemp A_bdd #align monotone.map_Inf_of_continuous_at' Monotone.map_sInf_of_continuousAt'
Mathlib/Topology/Order/Monotone.lean
58
62
theorem Monotone.map_iInf_of_continuousAt' {ι : Sort*} [Nonempty ι] {f : α → β} {g : ι → α} (Cf : ContinuousAt f (iInf g)) (Mf : Monotone f) (bdd : BddBelow (range g) := by
bddDefault) : f (⨅ i, g i) = ⨅ i, f (g i) := by rw [iInf, Monotone.map_sInf_of_continuousAt' Cf Mf (range_nonempty g) bdd, ← range_comp, iInf] rfl
[ " f (⨆ i, g i) = ⨆ i, f (g i)", " sSup (range (f ∘ g)) = sSup (range fun i => f (g i))", " f (⨅ i, g i) = ⨅ i, f (g i)", " sInf (range (f ∘ g)) = sInf (range fun i => f (g i))" ]
[ " f (⨆ i, g i) = ⨆ i, f (g i)", " sSup (range (f ∘ g)) = sSup (range fun i => f (g i))" ]
import Mathlib.CategoryTheory.Closed.Cartesian import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts import Mathlib.CategoryTheory.Adjunction.FullyFaithful #align_import category_theory.closed.functor from "leanprover-community/mathlib"@"cea27692b3fdeb328a2ddba6aabf181754543184" noncomputable section namespace CategoryTheory open Category Limits CartesianClosed universe v u u' variable {C : Type u} [Category.{v} C] variable {D : Type u'} [Category.{v} D] variable [HasFiniteProducts C] [HasFiniteProducts D] variable (F : C ⥤ D) {L : D ⥤ C} def frobeniusMorphism (h : L ⊣ F) (A : C) : prod.functor.obj (F.obj A) ⋙ L ⟶ L ⋙ prod.functor.obj A := prodComparisonNatTrans L (F.obj A) ≫ whiskerLeft _ (prod.functor.map (h.counit.app _)) #align category_theory.frobenius_morphism CategoryTheory.frobeniusMorphism instance frobeniusMorphism_iso_of_preserves_binary_products (h : L ⊣ F) (A : C) [PreservesLimitsOfShape (Discrete WalkingPair) L] [F.Full] [F.Faithful] : IsIso (frobeniusMorphism F h A) := suffices ∀ (X : D), IsIso ((frobeniusMorphism F h A).app X) from NatIso.isIso_of_isIso_app _ fun B ↦ by dsimp [frobeniusMorphism]; infer_instance #align category_theory.frobenius_morphism_iso_of_preserves_binary_products CategoryTheory.frobeniusMorphism_iso_of_preserves_binary_products variable [CartesianClosed C] [CartesianClosed D] variable [PreservesLimitsOfShape (Discrete WalkingPair) F] def expComparison (A : C) : exp A ⋙ F ⟶ F ⋙ exp (F.obj A) := transferNatTrans (exp.adjunction A) (exp.adjunction (F.obj A)) (prodComparisonNatIso F A).inv #align category_theory.exp_comparison CategoryTheory.expComparison theorem expComparison_ev (A B : C) : Limits.prod.map (𝟙 (F.obj A)) ((expComparison F A).app B) ≫ (exp.ev (F.obj A)).app (F.obj B) = inv (prodComparison F _ _) ≫ F.map ((exp.ev _).app _) := by convert transferNatTrans_counit _ _ (prodComparisonNatIso F A).inv B using 2 apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext` simp only [Limits.prodComparisonNatIso_inv, asIso_inv, NatIso.isIso_inv_app, IsIso.hom_inv_id] #align category_theory.exp_comparison_ev CategoryTheory.expComparison_ev
Mathlib/CategoryTheory/Closed/Functor.lean
91
97
theorem coev_expComparison (A B : C) : F.map ((exp.coev A).app B) ≫ (expComparison F A).app (A ⨯ B) = (exp.coev _).app (F.obj B) ≫ (exp (F.obj A)).map (inv (prodComparison F A B)) := by
convert unit_transferNatTrans _ _ (prodComparisonNatIso F A).inv B using 3 apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext` dsimp simp
[ " IsIso ((frobeniusMorphism F h A).app B)", " IsIso (prodComparison L (F.obj A) B ≫ prod.map (h.counit.app A) (𝟙 (L.obj B)))", " prod.map (𝟙 (F.obj A)) ((expComparison F A).app B) ≫ (exp.ev (F.obj A)).app (F.obj B) =\n inv (prodComparison F A (A ⟹ B)) ≫ F.map ((exp.ev A).app B)", " inv (prodComparison F ...
[ " IsIso ((frobeniusMorphism F h A).app B)", " IsIso (prodComparison L (F.obj A) B ≫ prod.map (h.counit.app A) (𝟙 (L.obj B)))", " prod.map (𝟙 (F.obj A)) ((expComparison F A).app B) ≫ (exp.ev (F.obj A)).app (F.obj B) =\n inv (prodComparison F A (A ⟹ B)) ≫ F.map ((exp.ev A).app B)", " inv (prodComparison F ...
import Mathlib.Topology.PartialHomeomorph import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Data.Real.Sqrt #align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Set Metric Pointwise variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] noncomputable section @[simps (config := .lemmasOnly)] def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where toFun x := (√(1 + ‖x‖ ^ 2))⁻¹ • x invFun y := (√(1 - ‖(y : E)‖ ^ 2))⁻¹ • (y : E) source := univ target := ball 0 1 map_source' x _ := by have : 0 < 1 + ‖x‖ ^ 2 := by positivity rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ← _root_.div_eq_inv_mul, div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ← abs_norm x, ← sq_lt_sq, abs_norm, Real.sq_sqrt this.le] exact lt_one_add _ map_target' _ _ := trivial left_inv' x _ := by field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs, Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, ← Real.sqrt_div (zero_lt_one_add_norm_sq x).le] right_inv' y hy := by have : 0 < 1 - ‖y‖ ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le, ← Real.sqrt_div this.le] open_source := isOpen_univ open_target := isOpen_ball continuousOn_toFun := by suffices Continuous fun (x:E) => (√(1 + ‖x‖ ^ 2))⁻¹ from (this.smul continuous_id).continuousOn refine Continuous.inv₀ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity) continuity continuousOn_invFun := by have : ∀ y ∈ ball (0 : E) 1, √(1 - ‖(y : E)‖ ^ 2) ≠ 0 := fun y hy ↦ by rw [Real.sqrt_ne_zero'] nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] exact ContinuousOn.smul (ContinuousOn.inv₀ (continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id @[simp] theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_apply] @[simp] theorem PartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_symm_apply] @[simps! (config := .lemmasOnly)] def Homeomorph.unitBall : E ≃ₜ ball (0 : E) 1 := (Homeomorph.Set.univ _).symm.trans PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget #align homeomorph_unit_ball Homeomorph.unitBall @[simp] theorem Homeomorph.coe_unitBall_apply_zero : (Homeomorph.unitBall (0 : E) : E) = 0 := PartialHomeomorph.univUnitBall_apply_zero #align coe_homeomorph_unit_ball_apply_zero Homeomorph.coe_unitBall_apply_zero variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P] namespace PartialHomeomorph @[simps!] def unitBallBall (c : P) (r : ℝ) (hr : 0 < r) : PartialHomeomorph E P := ((Homeomorph.smulOfNeZero r hr.ne').trans (IsometryEquiv.vaddConst c).toHomeomorph).toPartialHomeomorphOfImageEq (ball 0 1) isOpen_ball (ball c r) <| by change (IsometryEquiv.vaddConst c) ∘ (r • ·) '' ball (0 : E) 1 = ball c r rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball] simp [abs_of_pos hr] def univBall (c : P) (r : ℝ) : PartialHomeomorph E P := if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl else (IsometryEquiv.vaddConst c).toHomeomorph.toPartialHomeomorph @[simp] theorem univBall_source (c : P) (r : ℝ) : (univBall c r).source = univ := by unfold univBall; split_ifs <;> rfl theorem univBall_target (c : P) {r : ℝ} (hr : 0 < r) : (univBall c r).target = ball c r := by rw [univBall, dif_pos hr]; rfl theorem ball_subset_univBall_target (c : P) (r : ℝ) : ball c r ⊆ (univBall c r).target := by by_cases hr : 0 < r · rw [univBall_target c hr] · rw [univBall, dif_neg hr] exact subset_univ _ @[simp]
Mathlib/Analysis/NormedSpace/HomeomorphBall.lean
140
141
theorem univBall_apply_zero (c : P) (r : ℝ) : univBall c r 0 = c := by
unfold univBall; split_ifs <;> simp
[ " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x ∈ ball 0 1", " 0 < 1 + ‖x‖ ^ 2", " ‖x‖ ^ 2 < 1 + ‖x‖ ^ 2", " (fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) ((fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x) = x", " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) ((fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) y) = y", " 0 < 1 - ‖y‖ ^ 2", " ContinuousOn\n ↑{ toFu...
[ " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x ∈ ball 0 1", " 0 < 1 + ‖x‖ ^ 2", " ‖x‖ ^ 2 < 1 + ‖x‖ ^ 2", " (fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) ((fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x) = x", " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) ((fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) y) = y", " 0 < 1 - ‖y‖ ^ 2", " ContinuousOn\n ↑{ toFu...
import Mathlib.NumberTheory.Liouville.Basic import Mathlib.Topology.Baire.Lemmas import Mathlib.Topology.Baire.LocallyCompactRegular import Mathlib.Topology.Instances.Irrational #align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" open scoped Filter open Filter Set Metric
Mathlib/NumberTheory/Liouville/Residual.lean
25
31
theorem setOf_liouville_eq_iInter_iUnion : { x | Liouville x } = ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b), ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by
ext x simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff, mem_singleton_iff, mem_ball, Real.dist_eq, and_comm]
[ " {x | Liouville x} = ⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), ball (↑a / ↑b) (1 / ↑b ^ n) \\ {↑a / ↑b}", " x ∈ {x | Liouville x} ↔ x ∈ ⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), ball (↑a / ↑b) (1 / ↑b ^ n) \\ {↑a / ↑b}" ]
[]
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.Adjugate import Mathlib.LinearAlgebra.FiniteDimensional #align_import linear_algebra.matrix.nonsingular_inverse from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422" namespace Matrix universe u u' v variable {l : Type*} {m : Type u} {n : Type u'} {α : Type v} open Matrix Equiv Equiv.Perm Finset section Inv variable [Fintype n] [DecidableEq n] [CommRing α] variable (A : Matrix n n α) (B : Matrix n n α) theorem isUnit_det_transpose (h : IsUnit A.det) : IsUnit Aᵀ.det := by rw [det_transpose] exact h #align matrix.is_unit_det_transpose Matrix.isUnit_det_transpose noncomputable instance inv : Inv (Matrix n n α) := ⟨fun A => Ring.inverse A.det • A.adjugate⟩ theorem inv_def (A : Matrix n n α) : A⁻¹ = Ring.inverse A.det • A.adjugate := rfl #align matrix.inv_def Matrix.inv_def
Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean
221
222
theorem nonsing_inv_apply_not_isUnit (h : ¬IsUnit A.det) : A⁻¹ = 0 := by
rw [inv_def, Ring.inverse_non_unit _ h, zero_smul]
[ " IsUnit Aᵀ.det", " IsUnit A.det", " A⁻¹ = 0" ]
[ " IsUnit Aᵀ.det", " IsUnit A.det" ]
import Mathlib.Data.Set.Function import Mathlib.Logic.Relation import Mathlib.Logic.Pairwise #align_import data.set.pairwise.basic from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Function Order Set variable {α β γ ι ι' : Type*} {r p q : α → α → Prop} section Pairwise variable {f g : ι → α} {s t u : Set α} {a b : α} theorem pairwise_on_bool (hr : Symmetric r) {a b : α} : Pairwise (r on fun c => cond c a b) ↔ r a b := by simpa [Pairwise, Function.onFun] using @hr a b #align pairwise_on_bool pairwise_on_bool theorem pairwise_disjoint_on_bool [SemilatticeInf α] [OrderBot α] {a b : α} : Pairwise (Disjoint on fun c => cond c a b) ↔ Disjoint a b := pairwise_on_bool Disjoint.symm #align pairwise_disjoint_on_bool pairwise_disjoint_on_bool theorem Symmetric.pairwise_on [LinearOrder ι] (hr : Symmetric r) (f : ι → α) : Pairwise (r on f) ↔ ∀ ⦃m n⦄, m < n → r (f m) (f n) := ⟨fun h _m _n hmn => h hmn.ne, fun h _m _n hmn => hmn.lt_or_lt.elim (@h _ _) fun h' => hr (h h')⟩ #align symmetric.pairwise_on Symmetric.pairwise_on theorem pairwise_disjoint_on [SemilatticeInf α] [OrderBot α] [LinearOrder ι] (f : ι → α) : Pairwise (Disjoint on f) ↔ ∀ ⦃m n⦄, m < n → Disjoint (f m) (f n) := Symmetric.pairwise_on Disjoint.symm f #align pairwise_disjoint_on pairwise_disjoint_on theorem pairwise_disjoint_mono [SemilatticeInf α] [OrderBot α] (hs : Pairwise (Disjoint on f)) (h : g ≤ f) : Pairwise (Disjoint on g) := hs.mono fun i j hij => Disjoint.mono (h i) (h j) hij #align pairwise_disjoint.mono pairwise_disjoint_mono
Mathlib/Data/Set/Pairwise/Basic.lean
234
236
theorem pairwise_subtype_iff_pairwise_set (s : Set α) (r : α → α → Prop) : (Pairwise fun (x : s) (y : s) => r x y) ↔ s.Pairwise r := by
simp only [Pairwise, Set.Pairwise, SetCoe.forall, Ne, Subtype.ext_iff, Subtype.coe_mk]
[ " Pairwise (r on fun c => bif c then a else b) ↔ r a b", " (Pairwise fun x y => r ↑x ↑y) ↔ s.Pairwise r" ]
[ " Pairwise (r on fun c => bif c then a else b) ↔ r a b" ]
import Mathlib.Data.Matrix.Basis import Mathlib.Data.Matrix.DMatrix import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.Tactic.FieldSimp #align_import linear_algebra.matrix.transvection from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6" universe u₁ u₂ namespace Matrix open Matrix variable (n p : Type*) (R : Type u₂) {𝕜 : Type*} [Field 𝕜] variable [DecidableEq n] [DecidableEq p] variable [CommRing R] section Transvection variable {R n} (i j : n) def transvection (c : R) : Matrix n n R := 1 + Matrix.stdBasisMatrix i j c #align matrix.transvection Matrix.transvection @[simp] theorem transvection_zero : transvection i j (0 : R) = 1 := by simp [transvection] #align matrix.transvection_zero Matrix.transvection_zero section theorem updateRow_eq_transvection [Finite n] (c : R) : updateRow (1 : Matrix n n R) i ((1 : Matrix n n R) i + c • (1 : Matrix n n R) j) = transvection i j c := by cases nonempty_fintype n ext a b by_cases ha : i = a · by_cases hb : j = b · simp only [updateRow_self, transvection, ha, hb, Pi.add_apply, StdBasisMatrix.apply_same, one_apply_eq, Pi.smul_apply, mul_one, Algebra.id.smul_eq_mul, add_apply] · simp only [updateRow_self, transvection, ha, hb, StdBasisMatrix.apply_of_ne, Pi.add_apply, Ne, not_false_iff, Pi.smul_apply, and_false_iff, one_apply_ne, Algebra.id.smul_eq_mul, mul_zero, add_apply] · simp only [updateRow_ne, transvection, ha, Ne.symm ha, StdBasisMatrix.apply_of_ne, add_zero, Algebra.id.smul_eq_mul, Ne, not_false_iff, DMatrix.add_apply, Pi.smul_apply, mul_zero, false_and_iff, add_apply] #align matrix.update_row_eq_transvection Matrix.updateRow_eq_transvection variable [Fintype n] theorem transvection_mul_transvection_same (h : i ≠ j) (c d : R) : transvection i j c * transvection i j d = transvection i j (c + d) := by simp [transvection, Matrix.add_mul, Matrix.mul_add, h, h.symm, add_smul, add_assoc, stdBasisMatrix_add] #align matrix.transvection_mul_transvection_same Matrix.transvection_mul_transvection_same @[simp] theorem transvection_mul_apply_same (b : n) (c : R) (M : Matrix n n R) : (transvection i j c * M) i b = M i b + c * M j b := by simp [transvection, Matrix.add_mul] #align matrix.transvection_mul_apply_same Matrix.transvection_mul_apply_same @[simp] theorem mul_transvection_apply_same (a : n) (c : R) (M : Matrix n n R) : (M * transvection i j c) a j = M a j + c * M a i := by simp [transvection, Matrix.mul_add, mul_comm] #align matrix.mul_transvection_apply_same Matrix.mul_transvection_apply_same @[simp] theorem transvection_mul_apply_of_ne (a b : n) (ha : a ≠ i) (c : R) (M : Matrix n n R) : (transvection i j c * M) a b = M a b := by simp [transvection, Matrix.add_mul, ha] #align matrix.transvection_mul_apply_of_ne Matrix.transvection_mul_apply_of_ne @[simp] theorem mul_transvection_apply_of_ne (a b : n) (hb : b ≠ j) (c : R) (M : Matrix n n R) : (M * transvection i j c) a b = M a b := by simp [transvection, Matrix.mul_add, hb] #align matrix.mul_transvection_apply_of_ne Matrix.mul_transvection_apply_of_ne @[simp] theorem det_transvection_of_ne (h : i ≠ j) (c : R) : det (transvection i j c) = 1 := by rw [← updateRow_eq_transvection i j, det_updateRow_add_smul_self _ h, det_one] #align matrix.det_transvection_of_ne Matrix.det_transvection_of_ne end variable (R n) -- porting note (#5171): removed @[nolint has_nonempty_instance] structure TransvectionStruct where (i j : n) hij : i ≠ j c : R #align matrix.transvection_struct Matrix.TransvectionStruct instance [Nontrivial n] : Nonempty (TransvectionStruct n R) := by choose x y hxy using exists_pair_ne n exact ⟨⟨x, y, hxy, 0⟩⟩ namespace Pivot variable {R} {r : ℕ} (M : Matrix (Sum (Fin r) Unit) (Sum (Fin r) Unit) 𝕜) open Sum Unit Fin TransvectionStruct def listTransvecCol : List (Matrix (Sum (Fin r) Unit) (Sum (Fin r) Unit) 𝕜) := List.ofFn fun i : Fin r => transvection (inl i) (inr unit) <| -M (inl i) (inr unit) / M (inr unit) (inr unit) #align matrix.pivot.list_transvec_col Matrix.Pivot.listTransvecCol def listTransvecRow : List (Matrix (Sum (Fin r) Unit) (Sum (Fin r) Unit) 𝕜) := List.ofFn fun i : Fin r => transvection (inr unit) (inl i) <| -M (inr unit) (inl i) / M (inr unit) (inr unit) #align matrix.pivot.list_transvec_row Matrix.Pivot.listTransvecRow
Mathlib/LinearAlgebra/Matrix/Transvection.lean
371
380
theorem listTransvecCol_mul_last_row_drop (i : Sum (Fin r) Unit) {k : ℕ} (hk : k ≤ r) : (((listTransvecCol M).drop k).prod * M) (inr unit) i = M (inr unit) i := by
-- Porting note: `apply` didn't work anymore, because of the implicit arguments refine Nat.decreasingInduction' ?_ hk ?_ · intro n hn _ IH have hn' : n < (listTransvecCol M).length := by simpa [listTransvecCol] using hn rw [List.drop_eq_get_cons hn'] simpa [listTransvecCol, Matrix.mul_assoc] · simp only [listTransvecCol, List.length_ofFn, le_refl, List.drop_eq_nil_of_le, List.prod_nil, Matrix.one_mul]
[ " transvection i j 0 = 1", " updateRow 1 i (1 i + c • 1 j) = transvection i j c", " updateRow 1 i (1 i + c • 1 j) a b = transvection i j c a b", " transvection i j c * transvection i j d = transvection i j (c + d)", " (transvection i j c * M) i b = M i b + c * M j b", " (M * transvection i j c) a j = M a ...
[ " transvection i j 0 = 1", " updateRow 1 i (1 i + c • 1 j) = transvection i j c", " updateRow 1 i (1 i + c • 1 j) a b = transvection i j c a b", " transvection i j c * transvection i j d = transvection i j (c + d)", " (transvection i j c * M) i b = M i b + c * M j b", " (M * transvection i j c) a j = M a ...
import Batteries.Tactic.SeqFocus import Batteries.Data.List.Lemmas import Batteries.Data.List.Init.Attach namespace Std.Range def numElems (r : Range) : Nat := if r.step = 0 then -- This is a very weird choice, but it is chosen to coincide with the `forIn` impl if r.stop ≤ r.start then 0 else r.stop else (r.stop - r.start + r.step - 1) / r.step theorem numElems_stop_le_start : ∀ r : Range, r.stop ≤ r.start → r.numElems = 0 | ⟨start, stop, step⟩, h => by simp [numElems]; split <;> simp_all apply Nat.div_eq_of_lt; simp [Nat.sub_eq_zero_of_le h] exact Nat.pred_lt ‹_› theorem numElems_step_1 (start stop) : numElems ⟨start, stop, 1⟩ = stop - start := by simp [numElems] private theorem numElems_le_iff {start stop step i} (hstep : 0 < step) : (stop - start + step - 1) / step ≤ i ↔ stop ≤ start + step * i := calc (stop - start + step - 1) / step ≤ i _ ↔ stop - start + step - 1 < step * i + step := by rw [← Nat.lt_succ (n := i), Nat.div_lt_iff_lt_mul hstep, Nat.mul_comm, ← Nat.mul_succ] _ ↔ stop - start + step - 1 < step * i + 1 + (step - 1) := by rw [Nat.add_right_comm, Nat.add_assoc, Nat.sub_add_cancel hstep] _ ↔ stop ≤ start + step * i := by rw [Nat.add_sub_assoc hstep, Nat.add_lt_add_iff_right, Nat.lt_succ, Nat.sub_le_iff_le_add']
.lake/packages/batteries/Batteries/Data/Range/Lemmas.lean
40
47
theorem mem_range'_elems (r : Range) (h : x ∈ List.range' r.start r.numElems r.step) : x ∈ r := by
obtain ⟨i, h', rfl⟩ := List.mem_range'.1 h refine ⟨Nat.le_add_right .., ?_⟩ unfold numElems at h'; split at h' · split at h' <;> [cases h'; simp_all] · next step0 => refine Nat.not_le.1 fun h => Nat.not_le.2 h' <| (numElems_le_iff (Nat.pos_of_ne_zero step0)).2 h
[ " { start := start, stop := stop, step := step }.numElems = 0", " (if step = 0 then if stop ≤ start then 0 else stop else (stop - start + step - 1) / step) = 0", " 0 = 0", " (stop - start + step - 1) / step = 0", " stop - start + step - 1 < step", " step - 1 < step", " { start := start, stop := stop, st...
[ " { start := start, stop := stop, step := step }.numElems = 0", " (if step = 0 then if stop ≤ start then 0 else stop else (stop - start + step - 1) / step) = 0", " 0 = 0", " (stop - start + step - 1) / step = 0", " stop - start + step - 1 < step", " step - 1 < step", " { start := start, stop := stop, st...
import Mathlib.Algebra.Group.Indicator import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Order.Field.Rat import Mathlib.GroupTheory.GroupAction.Group import Mathlib.GroupTheory.GroupAction.Pi #align_import algebra.module.basic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e" open Function Set universe u v variable {α R M M₂ : Type*} @[deprecated (since := "2024-04-17")] alias map_nat_cast_smul := map_natCast_smul theorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M₂] {F : Type*} [FunLike F M M₂] [AddMonoidHomClass F M M₂] (f : F) (R S : Type*) [DivisionSemiring R] [DivisionSemiring S] [Module R M] [Module S M₂] (n : ℕ) (x : M) : f ((n⁻¹ : R) • x) = (n⁻¹ : S) • f x := by by_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0 · simp [hR, hS, map_zero f] · suffices ∀ y, f y = 0 by rw [this, this, smul_zero] clear x intro x rw [← inv_smul_smul₀ hS (f x), ← map_natCast_smul f R S] simp [hR, map_zero f] · suffices ∀ y, f y = 0 by simp [this] clear x intro x rw [← smul_inv_smul₀ hR x, map_natCast_smul f R S, hS, zero_smul] · rw [← inv_smul_smul₀ hS (f _), ← map_natCast_smul f R S, smul_inv_smul₀ hR] #align map_inv_nat_cast_smul map_inv_natCast_smul @[deprecated (since := "2024-04-17")] alias map_inv_nat_cast_smul := map_inv_natCast_smul theorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M₂] {F : Type*} [FunLike F M M₂] [AddMonoidHomClass F M M₂] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M] [Module S M₂] (z : ℤ) (x : M) : f ((z⁻¹ : R) • x) = (z⁻¹ : S) • f x := by obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg · rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S] · simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg, map_inv_natCast_smul _ R S] #align map_inv_int_cast_smul map_inv_intCast_smul @[deprecated (since := "2024-04-17")] alias map_inv_int_cast_smul := map_inv_intCast_smul
Mathlib/Algebra/Module/Basic.lean
61
66
theorem map_ratCast_smul [AddCommGroup M] [AddCommGroup M₂] {F : Type*} [FunLike F M M₂] [AddMonoidHomClass F M M₂] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M] [Module S M₂] (c : ℚ) (x : M) : f ((c : R) • x) = (c : S) • f x := by
rw [Rat.cast_def, Rat.cast_def, div_eq_mul_inv, div_eq_mul_inv, mul_smul, mul_smul, map_intCast_smul f R S, map_inv_natCast_smul f R S]
[ " f ((↑n)⁻¹ • x) = (↑n)⁻¹ • f x", " ∀ (y : M), f y = 0", " f x = 0", " (↑n)⁻¹ • f (↑n • x) = 0", " f ((↑z)⁻¹ • x) = (↑z)⁻¹ • f x", " f ((↑↑n)⁻¹ • x) = (↑↑n)⁻¹ • f x", " f ((↑(-↑n))⁻¹ • x) = (↑(-↑n))⁻¹ • f x", " f (↑c • x) = ↑c • f x" ]
[ " f ((↑n)⁻¹ • x) = (↑n)⁻¹ • f x", " ∀ (y : M), f y = 0", " f x = 0", " (↑n)⁻¹ • f (↑n • x) = 0", " f ((↑z)⁻¹ • x) = (↑z)⁻¹ • f x", " f ((↑↑n)⁻¹ • x) = (↑↑n)⁻¹ • f x", " f ((↑(-↑n))⁻¹ • x) = (↑(-↑n))⁻¹ • f x" ]
import Mathlib.Algebra.Homology.Linear import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex import Mathlib.Tactic.Abel #align_import algebra.homology.homotopy from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff" universe v u open scoped Classical noncomputable section open CategoryTheory Category Limits HomologicalComplex variable {ι : Type*} variable {V : Type u} [Category.{v} V] [Preadditive V] variable {c : ComplexShape ι} {C D E : HomologicalComplex V c} variable (f g : C ⟶ D) (h k : D ⟶ E) (i : ι) section def dNext (i : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.X i ⟶ D.X i) := AddMonoidHom.mk' (fun f => C.d i (c.next i) ≫ f (c.next i) i) fun _ _ => Preadditive.comp_add _ _ _ _ _ _ #align d_next dNext def fromNext (i : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.xNext i ⟶ D.X i) := AddMonoidHom.mk' (fun f => f (c.next i) i) fun _ _ => rfl #align from_next fromNext @[simp] theorem dNext_eq_dFrom_fromNext (f : ∀ i j, C.X i ⟶ D.X j) (i : ι) : dNext i f = C.dFrom i ≫ fromNext i f := rfl #align d_next_eq_d_from_from_next dNext_eq_dFrom_fromNext theorem dNext_eq (f : ∀ i j, C.X i ⟶ D.X j) {i i' : ι} (w : c.Rel i i') : dNext i f = C.d i i' ≫ f i' i := by obtain rfl := c.next_eq' w rfl #align d_next_eq dNext_eq lemma dNext_eq_zero (f : ∀ i j, C.X i ⟶ D.X j) (i : ι) (hi : ¬ c.Rel i (c.next i)) : dNext i f = 0 := by dsimp [dNext] rw [shape _ _ _ hi, zero_comp] @[simp 1100] theorem dNext_comp_left (f : C ⟶ D) (g : ∀ i j, D.X i ⟶ E.X j) (i : ι) : (dNext i fun i j => f.f i ≫ g i j) = f.f i ≫ dNext i g := (f.comm_assoc _ _ _).symm #align d_next_comp_left dNext_comp_left @[simp 1100] theorem dNext_comp_right (f : ∀ i j, C.X i ⟶ D.X j) (g : D ⟶ E) (i : ι) : (dNext i fun i j => f i j ≫ g.f j) = dNext i f ≫ g.f i := (assoc _ _ _).symm #align d_next_comp_right dNext_comp_right def prevD (j : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.X j ⟶ D.X j) := AddMonoidHom.mk' (fun f => f j (c.prev j) ≫ D.d (c.prev j) j) fun _ _ => Preadditive.add_comp _ _ _ _ _ _ #align prev_d prevD lemma prevD_eq_zero (f : ∀ i j, C.X i ⟶ D.X j) (i : ι) (hi : ¬ c.Rel (c.prev i) i) : prevD i f = 0 := by dsimp [prevD] rw [shape _ _ _ hi, comp_zero] def toPrev (j : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.X j ⟶ D.xPrev j) := AddMonoidHom.mk' (fun f => f j (c.prev j)) fun _ _ => rfl #align to_prev toPrev @[simp] theorem prevD_eq_toPrev_dTo (f : ∀ i j, C.X i ⟶ D.X j) (j : ι) : prevD j f = toPrev j f ≫ D.dTo j := rfl #align prev_d_eq_to_prev_d_to prevD_eq_toPrev_dTo
Mathlib/Algebra/Homology/Homotopy.lean
96
99
theorem prevD_eq (f : ∀ i j, C.X i ⟶ D.X j) {j j' : ι} (w : c.Rel j' j) : prevD j f = f j j' ≫ D.d j' j := by
obtain rfl := c.prev_eq' w rfl
[ " (dNext i) f = C.d i i' ≫ f i' i", " (dNext i) f = C.d i (c.next i) ≫ f (c.next i) i", " (dNext i) f = 0", " C.d i (c.next i) ≫ f (c.next i) i = 0", " (prevD i) f = 0", " f i (c.prev i) ≫ D.d (c.prev i) i = 0", " (prevD j) f = f j j' ≫ D.d j' j", " (prevD j) f = f j (c.prev j) ≫ D.d (c.prev j) j" ]
[ " (dNext i) f = C.d i i' ≫ f i' i", " (dNext i) f = C.d i (c.next i) ≫ f (c.next i) i", " (dNext i) f = 0", " C.d i (c.next i) ≫ f (c.next i) i = 0", " (prevD i) f = 0", " f i (c.prev i) ≫ D.d (c.prev i) i = 0" ]
import Mathlib.Analysis.InnerProductSpace.Adjoint #align_import analysis.inner_product_space.positive from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c" open InnerProductSpace RCLike ContinuousLinearMap open scoped InnerProduct ComplexConjugate namespace ContinuousLinearMap variable {𝕜 E F : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 F] variable [CompleteSpace E] [CompleteSpace F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y def IsPositive (T : E →L[𝕜] E) : Prop := IsSelfAdjoint T ∧ ∀ x, 0 ≤ T.reApplyInnerSelf x #align continuous_linear_map.is_positive ContinuousLinearMap.IsPositive theorem IsPositive.isSelfAdjoint {T : E →L[𝕜] E} (hT : IsPositive T) : IsSelfAdjoint T := hT.1 #align continuous_linear_map.is_positive.is_self_adjoint ContinuousLinearMap.IsPositive.isSelfAdjoint theorem IsPositive.inner_nonneg_left {T : E →L[𝕜] E} (hT : IsPositive T) (x : E) : 0 ≤ re ⟪T x, x⟫ := hT.2 x #align continuous_linear_map.is_positive.inner_nonneg_left ContinuousLinearMap.IsPositive.inner_nonneg_left theorem IsPositive.inner_nonneg_right {T : E →L[𝕜] E} (hT : IsPositive T) (x : E) : 0 ≤ re ⟪x, T x⟫ := by rw [inner_re_symm]; exact hT.inner_nonneg_left x #align continuous_linear_map.is_positive.inner_nonneg_right ContinuousLinearMap.IsPositive.inner_nonneg_right theorem isPositive_zero : IsPositive (0 : E →L[𝕜] E) := by refine ⟨isSelfAdjoint_zero _, fun x => ?_⟩ change 0 ≤ re ⟪_, _⟫ rw [zero_apply, inner_zero_left, ZeroHomClass.map_zero] #align continuous_linear_map.is_positive_zero ContinuousLinearMap.isPositive_zero theorem isPositive_one : IsPositive (1 : E →L[𝕜] E) := ⟨isSelfAdjoint_one _, fun _ => inner_self_nonneg⟩ #align continuous_linear_map.is_positive_one ContinuousLinearMap.isPositive_one theorem IsPositive.add {T S : E →L[𝕜] E} (hT : T.IsPositive) (hS : S.IsPositive) : (T + S).IsPositive := by refine ⟨hT.isSelfAdjoint.add hS.isSelfAdjoint, fun x => ?_⟩ rw [reApplyInnerSelf, add_apply, inner_add_left, map_add] exact add_nonneg (hT.inner_nonneg_left x) (hS.inner_nonneg_left x) #align continuous_linear_map.is_positive.add ContinuousLinearMap.IsPositive.add theorem IsPositive.conj_adjoint {T : E →L[𝕜] E} (hT : T.IsPositive) (S : E →L[𝕜] F) : (S ∘L T ∘L S†).IsPositive := by refine ⟨hT.isSelfAdjoint.conj_adjoint S, fun x => ?_⟩ rw [reApplyInnerSelf, comp_apply, ← adjoint_inner_right] exact hT.inner_nonneg_left _ #align continuous_linear_map.is_positive.conj_adjoint ContinuousLinearMap.IsPositive.conj_adjoint theorem IsPositive.adjoint_conj {T : E →L[𝕜] E} (hT : T.IsPositive) (S : F →L[𝕜] E) : (S† ∘L T ∘L S).IsPositive := by convert hT.conj_adjoint (S†) rw [adjoint_adjoint] #align continuous_linear_map.is_positive.adjoint_conj ContinuousLinearMap.IsPositive.adjoint_conj theorem IsPositive.conj_orthogonalProjection (U : Submodule 𝕜 E) {T : E →L[𝕜] E} (hT : T.IsPositive) [CompleteSpace U] : (U.subtypeL ∘L orthogonalProjection U ∘L T ∘L U.subtypeL ∘L orthogonalProjection U).IsPositive := by have := hT.conj_adjoint (U.subtypeL ∘L orthogonalProjection U) rwa [(orthogonalProjection_isSelfAdjoint U).adjoint_eq] at this #align continuous_linear_map.is_positive.conj_orthogonal_projection ContinuousLinearMap.IsPositive.conj_orthogonalProjection
Mathlib/Analysis/InnerProductSpace/Positive.lean
109
112
theorem IsPositive.orthogonalProjection_comp {T : E →L[𝕜] E} (hT : T.IsPositive) (U : Submodule 𝕜 E) [CompleteSpace U] : (orthogonalProjection U ∘L T ∘L U.subtypeL).IsPositive := by
have := hT.conj_adjoint (orthogonalProjection U : E →L[𝕜] U) rwa [U.adjoint_orthogonalProjection] at this
[ " 0 ≤ re ⟪x, T x⟫_𝕜", " 0 ≤ re ⟪T x, x⟫_𝕜", " IsPositive 0", " 0 ≤ reApplyInnerSelf 0 x", " 0 ≤ re ⟪0 x, x⟫_𝕜", " (T + S).IsPositive", " 0 ≤ (T + S).reApplyInnerSelf x", " 0 ≤ re ⟪T x, x⟫_𝕜 + re ⟪S x, x⟫_𝕜", " (S.comp (T.comp (adjoint S))).IsPositive", " 0 ≤ (S.comp (T.comp (adjoint S))).reAp...
[ " 0 ≤ re ⟪x, T x⟫_𝕜", " 0 ≤ re ⟪T x, x⟫_𝕜", " IsPositive 0", " 0 ≤ reApplyInnerSelf 0 x", " 0 ≤ re ⟪0 x, x⟫_𝕜", " (T + S).IsPositive", " 0 ≤ (T + S).reApplyInnerSelf x", " 0 ≤ re ⟪T x, x⟫_𝕜 + re ⟪S x, x⟫_𝕜", " (S.comp (T.comp (adjoint S))).IsPositive", " 0 ≤ (S.comp (T.comp (adjoint S))).reAp...
import Mathlib.Dynamics.Ergodic.MeasurePreserving #align_import dynamics.ergodic.ergodic from "leanprover-community/mathlib"@"809e920edfa343283cea507aedff916ea0f1bd88" open Set Function Filter MeasureTheory MeasureTheory.Measure open ENNReal variable {α : Type*} {m : MeasurableSpace α} (f : α → α) {s : Set α} structure PreErgodic (μ : Measure α := by volume_tac) : Prop where ae_empty_or_univ : ∀ ⦃s⦄, MeasurableSet s → f ⁻¹' s = s → s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ #align pre_ergodic PreErgodic -- porting note (#5171): removed @[nolint has_nonempty_instance] structure Ergodic (μ : Measure α := by volume_tac) extends MeasurePreserving f μ μ, PreErgodic f μ : Prop #align ergodic Ergodic -- porting note (#5171): removed @[nolint has_nonempty_instance] structure QuasiErgodic (μ : Measure α := by volume_tac) extends QuasiMeasurePreserving f μ μ, PreErgodic f μ : Prop #align quasi_ergodic QuasiErgodic variable {f} {μ : Measure α} namespace QuasiErgodic
Mathlib/Dynamics/Ergodic/Ergodic.lean
124
127
theorem ae_empty_or_univ' (hf : QuasiErgodic f μ) (hs : MeasurableSet s) (hs' : f ⁻¹' s =ᵐ[μ] s) : s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := by
obtain ⟨t, h₀, h₁, h₂⟩ := hf.toQuasiMeasurePreserving.exists_preimage_eq_of_preimage_ae hs hs' rcases hf.ae_empty_or_univ h₀ h₂ with (h₃ | h₃) <;> [left; right] <;> exact ae_eq_trans h₁.symm h₃
[ " s =ᶠ[ae μ] ∅ ∨ s =ᶠ[ae μ] univ", " s =ᶠ[ae μ] ∅", " s =ᶠ[ae μ] univ" ]
[]
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Coxeter.Basic namespace CoxeterSystem open List Matrix Function Classical variable {B : Type*} variable {W : Type*} [Group W] variable {M : CoxeterMatrix B} (cs : CoxeterSystem M W) local prefix:100 "s" => cs.simple local prefix:100 "π" => cs.wordProd private theorem exists_word_with_prod (w : W) : ∃ n ω, ω.length = n ∧ π ω = w := by rcases cs.wordProd_surjective w with ⟨ω, rfl⟩ use ω.length, ω noncomputable def length (w : W) : ℕ := Nat.find (cs.exists_word_with_prod w) local prefix:100 "ℓ" => cs.length
Mathlib/GroupTheory/Coxeter/Length.lean
71
73
theorem exists_reduced_word (w : W) : ∃ ω, ω.length = ℓ w ∧ w = π ω := by
have := Nat.find_spec (cs.exists_word_with_prod w) tauto
[ " ∃ n ω, ω.length = n ∧ cs.wordProd ω = w", " ∃ n ω_1, ω_1.length = n ∧ cs.wordProd ω_1 = cs.wordProd ω", " ∃ ω, ω.length = cs.length w ∧ w = cs.wordProd ω" ]
[ " ∃ n ω, ω.length = n ∧ cs.wordProd ω = w", " ∃ n ω_1, ω_1.length = n ∧ cs.wordProd ω_1 = cs.wordProd ω" ]
import Mathlib.Control.Bitraversable.Basic #align_import control.bitraversable.lemmas from "leanprover-community/mathlib"@"58581d0fe523063f5651df0619be2bf65012a94a" universe u variable {t : Type u → Type u → Type u} [Bitraversable t] variable {β : Type u} namespace Bitraversable open Functor LawfulApplicative variable {F G : Type u → Type u} [Applicative F] [Applicative G] abbrev tfst {α α'} (f : α → F α') : t α β → F (t α' β) := bitraverse f pure #align bitraversable.tfst Bitraversable.tfst abbrev tsnd {α α'} (f : α → F α') : t β α → F (t β α') := bitraverse pure f #align bitraversable.tsnd Bitraversable.tsnd variable [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] @[higher_order tfst_id] theorem id_tfst : ∀ {α β} (x : t α β), tfst (F := Id) pure x = pure x := id_bitraverse #align bitraversable.id_tfst Bitraversable.id_tfst @[higher_order tsnd_id] theorem id_tsnd : ∀ {α β} (x : t α β), tsnd (F := Id) pure x = pure x := id_bitraverse #align bitraversable.id_tsnd Bitraversable.id_tsnd @[higher_order tfst_comp_tfst] theorem comp_tfst {α₀ α₁ α₂ β} (f : α₀ → F α₁) (f' : α₁ → G α₂) (x : t α₀ β) : Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x := by rw [← comp_bitraverse] simp only [Function.comp, tfst, map_pure, Pure.pure] #align bitraversable.comp_tfst Bitraversable.comp_tfst @[higher_order tfst_comp_tsnd]
Mathlib/Control/Bitraversable/Lemmas.lean
79
83
theorem tfst_tsnd {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) : Comp.mk (tfst f <$> tsnd f' x) = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x := by
rw [← comp_bitraverse] simp only [Function.comp, map_pure]
[ " Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x", " bitraverse (Comp.mk ∘ map f' ∘ f) (Comp.mk ∘ map pure ∘ pure) x = tfst (Comp.mk ∘ map f' ∘ f) x", " Comp.mk (tfst f <$> tsnd f' x) = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x", " bitraverse (Comp.mk ∘ map f ∘ pure) (Comp.mk...
[ " Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x", " bitraverse (Comp.mk ∘ map f' ∘ f) (Comp.mk ∘ map pure ∘ pure) x = tfst (Comp.mk ∘ map f' ∘ f) x" ]
import Mathlib.MeasureTheory.Measure.MeasureSpace #align_import measure_theory.covering.vitali_family from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure open Filter MeasureTheory Topology variable {α : Type*} [MetricSpace α] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure VitaliFamily {m : MeasurableSpace α} (μ : Measure α) where setsAt : α → Set (Set α) measurableSet : ∀ x : α, ∀ s ∈ setsAt x, MeasurableSet s nonempty_interior : ∀ x : α, ∀ s ∈ setsAt x, (interior s).Nonempty nontrivial : ∀ (x : α), ∀ ε > (0 : ℝ), ∃ s ∈ setsAt x, s ⊆ closedBall x ε covering : ∀ (s : Set α) (f : α → Set (Set α)), (∀ x ∈ s, f x ⊆ setsAt x) → (∀ x ∈ s, ∀ ε > (0 : ℝ), ∃ a ∈ f x, a ⊆ closedBall x ε) → ∃ t : Set (α × Set α), (∀ p ∈ t, p.1 ∈ s) ∧ (t.PairwiseDisjoint fun p ↦ p.2) ∧ (∀ p ∈ t, p.2 ∈ f p.1) ∧ μ (s \ ⋃ p ∈ t, p.2) = 0 #align vitali_family VitaliFamily namespace VitaliFamily variable {m0 : MeasurableSpace α} {μ : Measure α} def mono (v : VitaliFamily μ) (ν : Measure α) (hν : ν ≪ μ) : VitaliFamily ν where __ := v covering s f h h' := let ⟨t, ts, disj, mem_f, hμ⟩ := v.covering s f h h' ⟨t, ts, disj, mem_f, hν hμ⟩ #align vitali_family.mono VitaliFamily.mono def FineSubfamilyOn (v : VitaliFamily μ) (f : α → Set (Set α)) (s : Set α) : Prop := ∀ x ∈ s, ∀ ε > 0, ∃ a ∈ v.setsAt x ∩ f x, a ⊆ closedBall x ε #align vitali_family.fine_subfamily_on VitaliFamily.FineSubfamilyOn def enlarge (v : VitaliFamily μ) (δ : ℝ) (δpos : 0 < δ) : VitaliFamily μ where setsAt x := v.setsAt x ∪ { a | MeasurableSet a ∧ (interior a).Nonempty ∧ ¬a ⊆ closedBall x δ } measurableSet x a ha := by cases' ha with ha ha exacts [v.measurableSet _ _ ha, ha.1] nonempty_interior x a ha := by cases' ha with ha ha exacts [v.nonempty_interior _ _ ha, ha.2.1] nontrivial := by intro x ε εpos rcases v.nontrivial x ε εpos with ⟨a, ha, h'a⟩ exact ⟨a, mem_union_left _ ha, h'a⟩ covering := by intro s f fset ffine let g : α → Set (Set α) := fun x => f x ∩ v.setsAt x have : ∀ x ∈ s, ∀ ε : ℝ, ε > 0 → ∃ (a : Set α), a ∈ g x ∧ a ⊆ closedBall x ε := by intro x hx ε εpos obtain ⟨a, af, ha⟩ : ∃ a ∈ f x, a ⊆ closedBall x (min ε δ) := ffine x hx (min ε δ) (lt_min εpos δpos) rcases fset x hx af with (h'a | h'a) · exact ⟨a, ⟨af, h'a⟩, ha.trans (closedBall_subset_closedBall (min_le_left _ _))⟩ · refine False.elim (h'a.2.2 ?_) exact ha.trans (closedBall_subset_closedBall (min_le_right _ _)) rcases v.covering s g (fun x _ => inter_subset_right) this with ⟨t, ts, tdisj, tg, μt⟩ exact ⟨t, ts, tdisj, fun p hp => (tg p hp).1, μt⟩ #align vitali_family.enlarge VitaliFamily.enlarge variable (v : VitaliFamily μ) def filterAt (x : α) : Filter (Set α) := (𝓝 x).smallSets ⊓ 𝓟 (v.setsAt x) #align vitali_family.filter_at VitaliFamily.filterAt theorem _root_.Filter.HasBasis.vitaliFamily {ι : Sort*} {p : ι → Prop} {s : ι → Set α} {x : α} (h : (𝓝 x).HasBasis p s) : (v.filterAt x).HasBasis p (fun i ↦ {t ∈ v.setsAt x | t ⊆ s i}) := by simpa only [← Set.setOf_inter_eq_sep] using h.smallSets.inf_principal _ theorem filterAt_basis_closedBall (x : α) : (v.filterAt x).HasBasis (0 < ·) ({a ∈ v.setsAt x | a ⊆ closedBall x ·}) := nhds_basis_closedBall.vitaliFamily v
Mathlib/MeasureTheory/Covering/VitaliFamily.lean
234
236
theorem mem_filterAt_iff {x : α} {s : Set (Set α)} : s ∈ v.filterAt x ↔ ∃ ε > (0 : ℝ), ∀ a ∈ v.setsAt x, a ⊆ closedBall x ε → a ∈ s := by
simp only [(v.filterAt_basis_closedBall x).mem_iff, ← and_imp, subset_def, mem_setOf]
[ " MeasurableSet a", " (interior a).Nonempty", " ∀ (x : α),\n ∀ ε > 0,\n ∃ s ∈ (fun x => v.setsAt x ∪ {a | MeasurableSet a ∧ (interior a).Nonempty ∧ ¬a ⊆ closedBall x δ}) x,\n s ⊆ closedBall x ε", " ∃ s ∈ (fun x => v.setsAt x ∪ {a | MeasurableSet a ∧ (interior a).Nonempty ∧ ¬a ⊆ closedBall x δ})...
[ " MeasurableSet a", " (interior a).Nonempty", " ∀ (x : α),\n ∀ ε > 0,\n ∃ s ∈ (fun x => v.setsAt x ∪ {a | MeasurableSet a ∧ (interior a).Nonempty ∧ ¬a ⊆ closedBall x δ}) x,\n s ⊆ closedBall x ε", " ∃ s ∈ (fun x => v.setsAt x ∪ {a | MeasurableSet a ∧ (interior a).Nonempty ∧ ¬a ⊆ closedBall x δ})...
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
Mathlib/FieldTheory/Separable.lean
76
78
theorem separable_X : (X : R[X]).Separable := by
rw [separable_def, derivative_X] exact isCoprime_one_right
[ " ¬Separable 0", " False", " f.Separable", " (X + C a).Separable", " IsCoprime (X + C a) 1", " X.Separable", " IsCoprime X 1" ]
[ " ¬Separable 0", " False", " f.Separable", " (X + C a).Separable", " IsCoprime (X + C a) 1" ]
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.Galois universe u v w open scoped Classical Polynomial open Polynomial variable (k : Type u) [Field k] (K : Type v) [Field K] class IsSepClosed : Prop where splits_of_separable : ∀ p : k[X], p.Separable → (p.Splits <| RingHom.id k) instance IsSepClosed.of_isAlgClosed [IsAlgClosed k] : IsSepClosed k := ⟨fun p _ ↦ IsAlgClosed.splits p⟩ variable {k} {K} theorem IsSepClosed.splits_codomain [IsSepClosed K] {f : k →+* K} (p : k[X]) (h : p.Separable) : p.Splits f := by convert IsSepClosed.splits_of_separable (p.map f) (Separable.map h); simp [splits_map_iff] theorem IsSepClosed.splits_domain [IsSepClosed k] {f : k →+* K} (p : k[X]) (h : p.Separable) : p.Splits f := Polynomial.splits_of_splits_id _ <| IsSepClosed.splits_of_separable _ h namespace IsSepClosed theorem exists_root [IsSepClosed k] (p : k[X]) (hp : p.degree ≠ 0) (hsep : p.Separable) : ∃ x, IsRoot p x := exists_root_of_splits _ (IsSepClosed.splits_of_separable p hsep) hp variable (k) in instance (priority := 100) isAlgClosed_of_perfectField [IsSepClosed k] [PerfectField k] : IsAlgClosed k := IsAlgClosed.of_exists_root k fun p _ h ↦ exists_root p ((degree_pos_of_irreducible h).ne') (PerfectField.separable_of_irreducible h) theorem exists_pow_nat_eq [IsSepClosed k] (x : k) (n : ℕ) [hn : NeZero (n : k)] : ∃ z, z ^ n = x := by have hn' : 0 < n := Nat.pos_of_ne_zero fun h => by rw [h, Nat.cast_zero] at hn exact hn.out rfl have : degree (X ^ n - C x) ≠ 0 := by rw [degree_X_pow_sub_C hn' x] exact (WithBot.coe_lt_coe.2 hn').ne' by_cases hx : x = 0 · exact ⟨0, by rw [hx, pow_eq_zero_iff hn'.ne']⟩ · obtain ⟨z, hz⟩ := exists_root _ this <| separable_X_pow_sub_C x hn.out hx use z simpa [eval_C, eval_X, eval_pow, eval_sub, IsRoot.def, sub_eq_zero] using hz theorem exists_eq_mul_self [IsSepClosed k] (x : k) [h2 : NeZero (2 : k)] : ∃ z, x = z * z := by rcases exists_pow_nat_eq x 2 with ⟨z, rfl⟩ exact ⟨z, sq z⟩ theorem roots_eq_zero_iff [IsSepClosed k] {p : k[X]} (hsep : p.Separable) : p.roots = 0 ↔ p = Polynomial.C (p.coeff 0) := by refine ⟨fun h => ?_, fun hp => by rw [hp, roots_C]⟩ rcases le_or_lt (degree p) 0 with hd | hd · exact eq_C_of_degree_le_zero hd · obtain ⟨z, hz⟩ := IsSepClosed.exists_root p hd.ne' hsep rw [← mem_roots (ne_zero_of_degree_gt hd), h] at hz simp at hz theorem exists_eval₂_eq_zero [IsSepClosed K] (f : k →+* K) (p : k[X]) (hp : p.degree ≠ 0) (hsep : p.Separable) : ∃ x, p.eval₂ f x = 0 := let ⟨x, hx⟩ := exists_root (p.map f) (by rwa [degree_map_eq_of_injective f.injective]) (Separable.map hsep) ⟨x, by rwa [eval₂_eq_eval_map, ← IsRoot]⟩ variable (K) theorem exists_aeval_eq_zero [IsSepClosed K] [Algebra k K] (p : k[X]) (hp : p.degree ≠ 0) (hsep : p.Separable) : ∃ x : K, aeval x p = 0 := exists_eval₂_eq_zero (algebraMap k K) p hp hsep variable (k) {K} theorem of_exists_root (H : ∀ p : k[X], p.Monic → Irreducible p → Separable p → ∃ x, p.eval x = 0) : IsSepClosed k := by refine ⟨fun p hsep ↦ Or.inr ?_⟩ intro q hq hdvd simp only [map_id] at hdvd have hlc : IsUnit (leadingCoeff q)⁻¹ := IsUnit.inv <| Ne.isUnit <| leadingCoeff_ne_zero.2 <| Irreducible.ne_zero hq have hsep' : Separable (q * C (leadingCoeff q)⁻¹) := Separable.mul (Separable.of_dvd hsep hdvd) ((separable_C _).2 hlc) (by simpa only [← isCoprime_mul_unit_right_right (isUnit_C.2 hlc) q 1, one_mul] using isCoprime_one_right (x := q)) have hirr' := hq rw [← irreducible_mul_isUnit (isUnit_C.2 hlc)] at hirr' obtain ⟨x, hx⟩ := H (q * C (leadingCoeff q)⁻¹) (monic_mul_leadingCoeff_inv hq.ne_zero) hirr' hsep' exact degree_mul_leadingCoeff_inv q hq.ne_zero ▸ degree_eq_one_of_irreducible_of_root hirr' hx theorem degree_eq_one_of_irreducible [IsSepClosed k] {p : k[X]} (hp : Irreducible p) (hsep : p.Separable) : p.degree = 1 := degree_eq_one_of_irreducible_of_splits hp (IsSepClosed.splits_codomain p hsep) variable (K)
Mathlib/FieldTheory/IsSepClosed.lean
168
179
theorem algebraMap_surjective [IsSepClosed k] [Algebra k K] [IsSeparable k K] : Function.Surjective (algebraMap k K) := by
refine fun x => ⟨-(minpoly k x).coeff 0, ?_⟩ have hq : (minpoly k x).leadingCoeff = 1 := minpoly.monic (IsSeparable.isIntegral k x) have hsep : (minpoly k x).Separable := IsSeparable.separable k x have h : (minpoly k x).degree = 1 := degree_eq_one_of_irreducible k (minpoly.irreducible (IsSeparable.isIntegral k x)) hsep have : aeval x (minpoly k x) = 0 := minpoly.aeval k x rw [eq_X_add_C_of_degree_eq_one h, hq, C_1, one_mul, aeval_add, aeval_X, aeval_C, add_eq_zero_iff_eq_neg] at this exact (RingHom.map_neg (algebraMap k K) ((minpoly k x).coeff 0)).symm ▸ this.symm
[ " Splits f p", " Splits f p ↔ Splits (RingHom.id K) (map f p)", " ∃ z, z ^ n = x", " False", " (X ^ n - C x).degree ≠ 0", " ↑n ≠ 0", " 0 ^ n = x", " z ^ n = x", " ∃ z, x = z * z", " ∃ z_1, z ^ 2 = z_1 * z_1", " p.roots = 0 ↔ p = C (p.coeff 0)", " p.roots = 0", " p = C (p.coeff 0)", " (map ...
[ " Splits f p", " Splits f p ↔ Splits (RingHom.id K) (map f p)", " ∃ z, z ^ n = x", " False", " (X ^ n - C x).degree ≠ 0", " ↑n ≠ 0", " 0 ^ n = x", " z ^ n = x", " ∃ z, x = z * z", " ∃ z_1, z ^ 2 = z_1 * z_1", " p.roots = 0 ↔ p = C (p.coeff 0)", " p.roots = 0", " p = C (p.coeff 0)", " (map ...
import Mathlib.Topology.Bornology.Basic #align_import topology.bornology.constructions from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d" open Set Filter Bornology Function open Filter variable {α β ι : Type*} {π : ι → Type*} [Bornology α] [Bornology β] [∀ i, Bornology (π i)] instance Prod.instBornology : Bornology (α × β) where cobounded' := (cobounded α).coprod (cobounded β) le_cofinite' := @coprod_cofinite α β ▸ coprod_mono ‹Bornology α›.le_cofinite ‹Bornology β›.le_cofinite #align prod.bornology Prod.instBornology instance Pi.instBornology : Bornology (∀ i, π i) where cobounded' := Filter.coprodᵢ fun i => cobounded (π i) le_cofinite' := iSup_le fun _ ↦ (comap_mono (Bornology.le_cofinite _)).trans (comap_cofinite_le _) #align pi.bornology Pi.instBornology abbrev Bornology.induced {α β : Type*} [Bornology β] (f : α → β) : Bornology α where cobounded' := comap f (cobounded β) le_cofinite' := (comap_mono (Bornology.le_cofinite β)).trans (comap_cofinite_le _) #align bornology.induced Bornology.induced instance {p : α → Prop} : Bornology (Subtype p) := Bornology.induced (Subtype.val : Subtype p → α) namespace Bornology theorem cobounded_prod : cobounded (α × β) = (cobounded α).coprod (cobounded β) := rfl #align bornology.cobounded_prod Bornology.cobounded_prod theorem isBounded_image_fst_and_snd {s : Set (α × β)} : IsBounded (Prod.fst '' s) ∧ IsBounded (Prod.snd '' s) ↔ IsBounded s := compl_mem_coprod.symm #align bornology.is_bounded_image_fst_and_snd Bornology.isBounded_image_fst_and_snd lemma IsBounded.image_fst {s : Set (α × β)} (hs : IsBounded s) : IsBounded (Prod.fst '' s) := (isBounded_image_fst_and_snd.2 hs).1 lemma IsBounded.image_snd {s : Set (α × β)} (hs : IsBounded s) : IsBounded (Prod.snd '' s) := (isBounded_image_fst_and_snd.2 hs).2 variable {s : Set α} {t : Set β} {S : ∀ i, Set (π i)} theorem IsBounded.fst_of_prod (h : IsBounded (s ×ˢ t)) (ht : t.Nonempty) : IsBounded s := fst_image_prod s ht ▸ h.image_fst #align bornology.is_bounded.fst_of_prod Bornology.IsBounded.fst_of_prod theorem IsBounded.snd_of_prod (h : IsBounded (s ×ˢ t)) (hs : s.Nonempty) : IsBounded t := snd_image_prod hs t ▸ h.image_snd #align bornology.is_bounded.snd_of_prod Bornology.IsBounded.snd_of_prod theorem IsBounded.prod (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s ×ˢ t) := isBounded_image_fst_and_snd.1 ⟨hs.subset <| fst_image_prod_subset _ _, ht.subset <| snd_image_prod_subset _ _⟩ #align bornology.is_bounded.prod Bornology.IsBounded.prod theorem isBounded_prod_of_nonempty (hne : Set.Nonempty (s ×ˢ t)) : IsBounded (s ×ˢ t) ↔ IsBounded s ∧ IsBounded t := ⟨fun h => ⟨h.fst_of_prod hne.snd, h.snd_of_prod hne.fst⟩, fun h => h.1.prod h.2⟩ #align bornology.is_bounded_prod_of_nonempty Bornology.isBounded_prod_of_nonempty
Mathlib/Topology/Bornology/Constructions.lean
88
91
theorem isBounded_prod : IsBounded (s ×ˢ t) ↔ s = ∅ ∨ t = ∅ ∨ IsBounded s ∧ IsBounded t := by
rcases s.eq_empty_or_nonempty with (rfl | hs); · simp rcases t.eq_empty_or_nonempty with (rfl | ht); · simp simp only [hs.ne_empty, ht.ne_empty, isBounded_prod_of_nonempty (hs.prod ht), false_or_iff]
[ " IsBounded (s ×ˢ t) ↔ s = ∅ ∨ t = ∅ ∨ IsBounded s ∧ IsBounded t", " IsBounded (∅ ×ˢ t) ↔ ∅ = ∅ ∨ t = ∅ ∨ IsBounded ∅ ∧ IsBounded t", " IsBounded (s ×ˢ ∅) ↔ s = ∅ ∨ ∅ = ∅ ∨ IsBounded s ∧ IsBounded ∅" ]
[]
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 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 #align qpf.liftp_iff QPF.liftp_iff theorem liftp_iff' {α : Type u} (p : α → Prop) (x : F α) : Liftp p x ↔ ∃ u : q.P α, abs u = x ∧ ∀ i, p (u.snd i) := by constructor · rintro ⟨y, hy⟩ cases' h : repr y with a f use ⟨a, fun i => (f i).val⟩ dsimp constructor · rw [← hy, ← abs_repr y, h, ← abs_map] rfl intro i apply (f i).property rintro ⟨⟨a, f⟩, h₀, h₁⟩; dsimp at * use abs ⟨a, fun i => ⟨f i, h₁ i⟩⟩ rw [← abs_map, ← h₀]; rfl #align qpf.liftp_iff' QPF.liftp_iff' theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : F α) : Liftr r x y ↔ ∃ a f₀ f₁, x = abs ⟨a, f₀⟩ ∧ y = abs ⟨a, f₁⟩ ∧ ∀ i, r (f₀ i) (f₁ i) := by constructor · rintro ⟨u, xeq, yeq⟩ cases' h : repr u with a f use a, fun i => (f i).val.fst, fun i => (f i).val.snd constructor · rw [← xeq, ← abs_repr u, h, ← abs_map] rfl constructor · rw [← yeq, ← abs_repr u, h, ← abs_map] rfl intro i exact (f i).property rintro ⟨a, f₀, f₁, xeq, yeq, h⟩ use abs ⟨a, fun i => ⟨(f₀ i, f₁ i), h i⟩⟩ constructor · rw [xeq, ← abs_map] rfl rw [yeq, ← abs_map]; rfl #align qpf.liftr_iff QPF.liftr_iff end def recF {α : Type _} (g : F α → α) : q.P.W → α | ⟨a, f⟩ => g (abs ⟨a, fun x => recF g (f x)⟩) set_option linter.uppercaseLean3 false in #align qpf.recF QPF.recF
Mathlib/Data/QPF/Univariate/Basic.lean
169
172
theorem recF_eq {α : Type _} (g : F α → α) (x : q.P.W) : recF g x = g (abs (q.P.map (recF g) x.dest)) := by
cases x rfl
[ " id <$> x = x", " id <$> abs (repr x) = abs (repr x)", " id <$> abs ⟨a, f⟩ = abs ⟨a, f⟩", " abs ((P F).map id ⟨a, f⟩) = abs ⟨a, f⟩", " (g ∘ f) <$> x = g <$> f <$> x", " (g ∘ f) <$> abs (repr x) = g <$> f <$> abs (repr x)", " (g ∘ f✝) <$> abs ⟨a, f⟩ = g <$> f✝ <$> abs ⟨a, f⟩", " abs ((P F).map (g ∘ f✝...
[ " id <$> x = x", " id <$> abs (repr x) = abs (repr x)", " id <$> abs ⟨a, f⟩ = abs ⟨a, f⟩", " abs ((P F).map id ⟨a, f⟩) = abs ⟨a, f⟩", " (g ∘ f) <$> x = g <$> f <$> x", " (g ∘ f) <$> abs (repr x) = g <$> f <$> abs (repr x)", " (g ∘ f✝) <$> abs ⟨a, f⟩ = g <$> f✝ <$> abs ⟨a, f⟩", " abs ((P F).map (g ∘ f✝...
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory variable {α E : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] {p : ℝ≥0∞} {q : ℝ} {μ : Measure α} {f g : α → E} theorem snorm'_add_le {f g : α → E} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (hq1 : 1 ≤ q) : snorm' (f + g) q μ ≤ snorm' f q μ + snorm' g q μ := calc (∫⁻ a, (‖(f + g) a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) ≤ (∫⁻ a, ((fun a => (‖f a‖₊ : ℝ≥0∞)) + fun a => (‖g a‖₊ : ℝ≥0∞)) a ^ q ∂μ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≤ snorm' f q μ + snorm' g q μ := ENNReal.lintegral_Lp_add_le hf.ennnorm hg.ennnorm hq1 #align measure_theory.snorm'_add_le MeasureTheory.snorm'_add_le theorem snorm'_add_le_of_le_one {f g : α → E} (hf : AEStronglyMeasurable f μ) (hq0 : 0 ≤ q) (hq1 : q ≤ 1) : snorm' (f + g) q μ ≤ (2 : ℝ≥0∞) ^ (1 / q - 1) * (snorm' f q μ + snorm' g q μ) := calc (∫⁻ a, (‖(f + g) a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) ≤ (∫⁻ a, ((fun a => (‖f a‖₊ : ℝ≥0∞)) + fun a => (‖g a‖₊ : ℝ≥0∞)) a ^ q ∂μ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≤ (2 : ℝ≥0∞) ^ (1 / q - 1) * (snorm' f q μ + snorm' g q μ) := ENNReal.lintegral_Lp_add_le_of_le_one hf.ennnorm hq0 hq1 #align measure_theory.snorm'_add_le_of_le_one MeasureTheory.snorm'_add_le_of_le_one theorem snormEssSup_add_le {f g : α → E} : snormEssSup (f + g) μ ≤ snormEssSup f μ + snormEssSup g μ := by refine le_trans (essSup_mono_ae (eventually_of_forall fun x => ?_)) (ENNReal.essSup_add_le _ _) simp_rw [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe] exact nnnorm_add_le _ _ #align measure_theory.snorm_ess_sup_add_le MeasureTheory.snormEssSup_add_le theorem snorm_add_le {f g : α → E} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (hp1 : 1 ≤ p) : snorm (f + g) p μ ≤ snorm f p μ + snorm g p μ := by by_cases hp0 : p = 0 · simp [hp0] by_cases hp_top : p = ∞ · simp [hp_top, snormEssSup_add_le] have hp1_real : 1 ≤ p.toReal := by rwa [← ENNReal.one_toReal, ENNReal.toReal_le_toReal ENNReal.one_ne_top hp_top] repeat rw [snorm_eq_snorm' hp0 hp_top] exact snorm'_add_le hf hg hp1_real #align measure_theory.snorm_add_le MeasureTheory.snorm_add_le noncomputable def LpAddConst (p : ℝ≥0∞) : ℝ≥0∞ := if p ∈ Set.Ioo (0 : ℝ≥0∞) 1 then (2 : ℝ≥0∞) ^ (1 / p.toReal - 1) else 1 set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const MeasureTheory.LpAddConst theorem LpAddConst_of_one_le {p : ℝ≥0∞} (hp : 1 ≤ p) : LpAddConst p = 1 := by rw [LpAddConst, if_neg] intro h exact lt_irrefl _ (h.2.trans_le hp) set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_of_one_le MeasureTheory.LpAddConst_of_one_le theorem LpAddConst_zero : LpAddConst 0 = 1 := by rw [LpAddConst, if_neg] intro h exact lt_irrefl _ h.1 set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_zero MeasureTheory.LpAddConst_zero
Mathlib/MeasureTheory/Function/LpSeminorm/TriangleInequality.lean
87
94
theorem LpAddConst_lt_top (p : ℝ≥0∞) : LpAddConst p < ∞ := by
rw [LpAddConst] split_ifs with h · apply ENNReal.rpow_lt_top_of_nonneg _ ENNReal.two_ne_top simp only [one_div, sub_nonneg] apply one_le_inv (ENNReal.toReal_pos h.1.ne' (h.2.trans ENNReal.one_lt_top).ne) simpa using ENNReal.toReal_mono ENNReal.one_ne_top h.2.le · exact ENNReal.one_lt_top
[ " (∫⁻ (a : α), ↑‖(f + g) a‖₊ ^ q ∂μ) ^ (1 / q) ≤\n (∫⁻ (a : α), ((fun a => ↑‖f a‖₊) + fun a => ↑‖g a‖₊) a ^ q ∂μ) ^ (1 / q)", " ↑‖(f + g) a‖₊ ≤ ((fun a => ↑‖f a‖₊) + fun a => ↑‖g a‖₊) a", " snormEssSup (f + g) μ ≤ snormEssSup f μ + snormEssSup g μ", " (fun x => ↑‖(f + g) x‖₊) x ≤ ((fun x => ↑‖f x‖₊) + fun ...
[ " (∫⁻ (a : α), ↑‖(f + g) a‖₊ ^ q ∂μ) ^ (1 / q) ≤\n (∫⁻ (a : α), ((fun a => ↑‖f a‖₊) + fun a => ↑‖g a‖₊) a ^ q ∂μ) ^ (1 / q)", " ↑‖(f + g) a‖₊ ≤ ((fun a => ↑‖f a‖₊) + fun a => ↑‖g a‖₊) a", " snormEssSup (f + g) μ ≤ snormEssSup f μ + snormEssSup g μ", " (fun x => ↑‖(f + g) x‖₊) x ≤ ((fun x => ↑‖f x‖₊) + fun ...
import Mathlib.Logic.Function.Basic import Mathlib.Logic.Relator import Mathlib.Init.Data.Quot import Mathlib.Tactic.Cases import Mathlib.Tactic.Use import Mathlib.Tactic.MkIffOfInductiveProp import Mathlib.Tactic.SimpRw #align_import logic.relation from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe" open Function variable {α β γ δ ε ζ : Type*} namespace Relation variable {r : α → α → Prop} {a b c d : α} @[mk_iff ReflTransGen.cases_tail_iff] inductive ReflTransGen (r : α → α → Prop) (a : α) : α → Prop | refl : ReflTransGen r a a | tail {b c} : ReflTransGen r a b → r b c → ReflTransGen r a c #align relation.refl_trans_gen Relation.ReflTransGen #align relation.refl_trans_gen.cases_tail_iff Relation.ReflTransGen.cases_tail_iff attribute [refl] ReflTransGen.refl @[mk_iff] inductive ReflGen (r : α → α → Prop) (a : α) : α → Prop | refl : ReflGen r a a | single {b} : r a b → ReflGen r a b #align relation.refl_gen Relation.ReflGen #align relation.refl_gen_iff Relation.reflGen_iff @[mk_iff] inductive TransGen (r : α → α → Prop) (a : α) : α → Prop | single {b} : r a b → TransGen r a b | tail {b c} : TransGen r a b → r b c → TransGen r a c #align relation.trans_gen Relation.TransGen #align relation.trans_gen_iff Relation.transGen_iff attribute [refl] ReflGen.refl namespace ReflTransGen @[trans] theorem trans (hab : ReflTransGen r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by induction hbc with | refl => assumption | tail _ hcd hac => exact hac.tail hcd #align relation.refl_trans_gen.trans Relation.ReflTransGen.trans theorem single (hab : r a b) : ReflTransGen r a b := refl.tail hab #align relation.refl_trans_gen.single Relation.ReflTransGen.single theorem head (hab : r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by induction hbc with | refl => exact refl.tail hab | tail _ hcd hac => exact hac.tail hcd #align relation.refl_trans_gen.head Relation.ReflTransGen.head theorem symmetric (h : Symmetric r) : Symmetric (ReflTransGen r) := by intro x y h induction' h with z w _ b c · rfl · apply Relation.ReflTransGen.head (h b) c #align relation.refl_trans_gen.symmetric Relation.ReflTransGen.symmetric theorem cases_tail : ReflTransGen r a b → b = a ∨ ∃ c, ReflTransGen r a c ∧ r c b := (cases_tail_iff r a b).1 #align relation.refl_trans_gen.cases_tail Relation.ReflTransGen.cases_tail @[elab_as_elim] theorem head_induction_on {P : ∀ a : α, ReflTransGen r a b → Prop} {a : α} (h : ReflTransGen r a b) (refl : P b refl) (head : ∀ {a c} (h' : r a c) (h : ReflTransGen r c b), P c h → P a (h.head h')) : P a h := by induction h with | refl => exact refl | @tail b c _ hbc ih => apply ih · exact head hbc _ refl · exact fun h1 h2 ↦ head h1 (h2.tail hbc) #align relation.refl_trans_gen.head_induction_on Relation.ReflTransGen.head_induction_on @[elab_as_elim] theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α} (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h)) (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (h₁.trans h₂)) : P h := by induction h with | refl => exact ih₁ a | tail hab hbc ih => exact ih₃ hab (single hbc) ih (ih₂ hbc) #align relation.refl_trans_gen.trans_induction_on Relation.ReflTransGen.trans_induction_on
Mathlib/Logic/Relation.lean
345
350
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
induction h using Relation.ReflTransGen.head_induction_on · left rfl · right exact ⟨_, by assumption, by assumption⟩;
[ " ReflTransGen r a c", " ReflTransGen r a b", " ReflTransGen r a c✝", " Symmetric (ReflTransGen r)", " ReflTransGen r y x", " ReflTransGen r x x", " ReflTransGen r w x", " P a h", " P a ⋯", " P b ⋯", " ∀ {a c_1 : α} (h' : r a c_1) (h : ReflTransGen r c_1 b), P c_1 ⋯ → P a ⋯", " P h", " P ⋯",...
[ " ReflTransGen r a c", " ReflTransGen r a b", " ReflTransGen r a c✝", " Symmetric (ReflTransGen r)", " ReflTransGen r y x", " ReflTransGen r x x", " ReflTransGen r w x", " P a h", " P a ⋯", " P b ⋯", " ∀ {a c_1 : α} (h' : r a c_1) (h : ReflTransGen r c_1 b), P c_1 ⋯ → P a ⋯", " P h", " P ⋯" ...
import Mathlib.Algebra.BigOperators.Group.Multiset import Mathlib.Data.PNat.Prime import Mathlib.Data.Nat.Factors import Mathlib.Data.Multiset.Sort #align_import data.pnat.factors from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d" -- Porting note: `deriving` contained Inhabited, CanonicallyOrderedAddCommMonoid, DistribLattice, -- SemilatticeSup, OrderBot, Sub, OrderedSub def PrimeMultiset := Multiset Nat.Primes deriving Inhabited, CanonicallyOrderedAddCommMonoid, DistribLattice, SemilatticeSup, Sub #align prime_multiset PrimeMultiset instance : OrderBot PrimeMultiset where bot_le := by simp only [bot_le, forall_const] instance : OrderedSub PrimeMultiset where tsub_le_iff_right _ _ _ := Multiset.sub_le_iff_le_add namespace PrimeMultiset -- `@[derive]` doesn't work for `meta` instances unsafe instance : Repr PrimeMultiset := by delta PrimeMultiset; infer_instance def ofPrime (p : Nat.Primes) : PrimeMultiset := ({p} : Multiset Nat.Primes) #align prime_multiset.of_prime PrimeMultiset.ofPrime theorem card_ofPrime (p : Nat.Primes) : Multiset.card (ofPrime p) = 1 := rfl #align prime_multiset.card_of_prime PrimeMultiset.card_ofPrime def toNatMultiset : PrimeMultiset → Multiset ℕ := fun v => v.map Coe.coe #align prime_multiset.to_nat_multiset PrimeMultiset.toNatMultiset instance coeNat : Coe PrimeMultiset (Multiset ℕ) := ⟨toNatMultiset⟩ #align prime_multiset.coe_nat PrimeMultiset.coeNat def coeNatMonoidHom : PrimeMultiset →+ Multiset ℕ := { Multiset.mapAddMonoidHom Coe.coe with toFun := Coe.coe } #align prime_multiset.coe_nat_monoid_hom PrimeMultiset.coeNatMonoidHom @[simp] theorem coe_coeNatMonoidHom : (coeNatMonoidHom : PrimeMultiset → Multiset ℕ) = Coe.coe := rfl #align prime_multiset.coe_coe_nat_monoid_hom PrimeMultiset.coe_coeNatMonoidHom theorem coeNat_injective : Function.Injective (Coe.coe : PrimeMultiset → Multiset ℕ) := Multiset.map_injective Nat.Primes.coe_nat_injective #align prime_multiset.coe_nat_injective PrimeMultiset.coeNat_injective theorem coeNat_ofPrime (p : Nat.Primes) : (ofPrime p : Multiset ℕ) = {(p : ℕ)} := rfl #align prime_multiset.coe_nat_of_prime PrimeMultiset.coeNat_ofPrime theorem coeNat_prime (v : PrimeMultiset) (p : ℕ) (h : p ∈ (v : Multiset ℕ)) : p.Prime := by rcases Multiset.mem_map.mp h with ⟨⟨_, hp'⟩, ⟨_, h_eq⟩⟩ exact h_eq ▸ hp' #align prime_multiset.coe_nat_prime PrimeMultiset.coeNat_prime def toPNatMultiset : PrimeMultiset → Multiset ℕ+ := fun v => v.map Coe.coe #align prime_multiset.to_pnat_multiset PrimeMultiset.toPNatMultiset instance coePNat : Coe PrimeMultiset (Multiset ℕ+) := ⟨toPNatMultiset⟩ #align prime_multiset.coe_pnat PrimeMultiset.coePNat def coePNatMonoidHom : PrimeMultiset →+ Multiset ℕ+ := { Multiset.mapAddMonoidHom Coe.coe with toFun := Coe.coe } #align prime_multiset.coe_pnat_monoid_hom PrimeMultiset.coePNatMonoidHom @[simp] theorem coe_coePNatMonoidHom : (coePNatMonoidHom : PrimeMultiset → Multiset ℕ+) = Coe.coe := rfl #align prime_multiset.coe_coe_pnat_monoid_hom PrimeMultiset.coe_coePNatMonoidHom theorem coePNat_injective : Function.Injective (Coe.coe : PrimeMultiset → Multiset ℕ+) := Multiset.map_injective Nat.Primes.coe_pnat_injective #align prime_multiset.coe_pnat_injective PrimeMultiset.coePNat_injective theorem coePNat_ofPrime (p : Nat.Primes) : (ofPrime p : Multiset ℕ+) = {(p : ℕ+)} := rfl #align prime_multiset.coe_pnat_of_prime PrimeMultiset.coePNat_ofPrime theorem coePNat_prime (v : PrimeMultiset) (p : ℕ+) (h : p ∈ (v : Multiset ℕ+)) : p.Prime := by rcases Multiset.mem_map.mp h with ⟨⟨_, hp'⟩, ⟨_, h_eq⟩⟩ exact h_eq ▸ hp' #align prime_multiset.coe_pnat_prime PrimeMultiset.coePNat_prime instance coeMultisetPNatNat : Coe (Multiset ℕ+) (Multiset ℕ) := ⟨fun v => v.map Coe.coe⟩ #align prime_multiset.coe_multiset_pnat_nat PrimeMultiset.coeMultisetPNatNat theorem coePNat_nat (v : PrimeMultiset) : ((v : Multiset ℕ+) : Multiset ℕ) = (v : Multiset ℕ) := by change (v.map (Coe.coe : Nat.Primes → ℕ+)).map Subtype.val = v.map Subtype.val rw [Multiset.map_map] congr #align prime_multiset.coe_pnat_nat PrimeMultiset.coePNat_nat def prod (v : PrimeMultiset) : ℕ+ := (v : Multiset PNat).prod #align prime_multiset.prod PrimeMultiset.prod
Mathlib/Data/PNat/Factors.lean
141
146
theorem coe_prod (v : PrimeMultiset) : (v.prod : ℕ) = (v : Multiset ℕ).prod := by
let h : (v.prod : ℕ) = ((v.map Coe.coe).map Coe.coe).prod := PNat.coeMonoidHom.map_multiset_prod v.toPNatMultiset rw [Multiset.map_map] at h have : (Coe.coe : ℕ+ → ℕ) ∘ (Coe.coe : Nat.Primes → ℕ+) = Coe.coe := funext fun p => rfl rw [this] at h; exact h
[ " ∀ (a : PrimeMultiset), ⊥ ≤ a", " Repr PrimeMultiset", " Repr (Multiset Nat.Primes)", " p.Prime", " Multiset.map PNat.val v.toPNatMultiset = v.toNatMultiset", " Multiset.map Subtype.val (Multiset.map Coe.coe v) = Multiset.map Subtype.val v", " Multiset.map (Subtype.val ∘ Coe.coe) v = Multiset.map Subty...
[ " ∀ (a : PrimeMultiset), ⊥ ≤ a", " Repr PrimeMultiset", " Repr (Multiset Nat.Primes)", " p.Prime", " Multiset.map PNat.val v.toPNatMultiset = v.toNatMultiset", " Multiset.map Subtype.val (Multiset.map Coe.coe v) = Multiset.map Subtype.val v", " Multiset.map (Subtype.val ∘ Coe.coe) v = Multiset.map Subty...
import Mathlib.Tactic.FinCases import Mathlib.Data.Nat.Choose.Sum import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.Field.IsField #align_import ring_theory.ideal.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" universe u v w variable {α : Type u} {β : Type v} open Set Function open Pointwise abbrev Ideal (R : Type u) [Semiring R] := Submodule R R #align ideal Ideal @[mk_iff] class IsPrincipalIdealRing (R : Type u) [Semiring R] : Prop where principal : ∀ S : Ideal R, S.IsPrincipal #align is_principal_ideal_ring IsPrincipalIdealRing attribute [instance] IsPrincipalIdealRing.principal section Semiring namespace Ideal variable [Semiring α] (I : Ideal α) {a b : α} protected theorem zero_mem : (0 : α) ∈ I := Submodule.zero_mem I #align ideal.zero_mem Ideal.zero_mem protected theorem add_mem : a ∈ I → b ∈ I → a + b ∈ I := Submodule.add_mem I #align ideal.add_mem Ideal.add_mem variable (a) theorem mul_mem_left : b ∈ I → a * b ∈ I := Submodule.smul_mem I a #align ideal.mul_mem_left Ideal.mul_mem_left variable {a} @[ext] theorem ext {I J : Ideal α} (h : ∀ x, x ∈ I ↔ x ∈ J) : I = J := Submodule.ext h #align ideal.ext Ideal.ext theorem sum_mem (I : Ideal α) {ι : Type*} {t : Finset ι} {f : ι → α} : (∀ c ∈ t, f c ∈ I) → (∑ i ∈ t, f i) ∈ I := Submodule.sum_mem I #align ideal.sum_mem Ideal.sum_mem theorem eq_top_of_unit_mem (x y : α) (hx : x ∈ I) (h : y * x = 1) : I = ⊤ := eq_top_iff.2 fun z _ => calc z = z * (y * x) := by simp [h] _ = z * y * x := Eq.symm <| mul_assoc z y x _ ∈ I := I.mul_mem_left _ hx #align ideal.eq_top_of_unit_mem Ideal.eq_top_of_unit_mem theorem eq_top_of_isUnit_mem {x} (hx : x ∈ I) (h : IsUnit x) : I = ⊤ := let ⟨y, hy⟩ := h.exists_left_inv eq_top_of_unit_mem I x y hx hy #align ideal.eq_top_of_is_unit_mem Ideal.eq_top_of_isUnit_mem theorem eq_top_iff_one : I = ⊤ ↔ (1 : α) ∈ I := ⟨by rintro rfl; trivial, fun h => eq_top_of_unit_mem _ _ 1 h (by simp)⟩ #align ideal.eq_top_iff_one Ideal.eq_top_iff_one theorem ne_top_iff_one : I ≠ ⊤ ↔ (1 : α) ∉ I := not_congr I.eq_top_iff_one #align ideal.ne_top_iff_one Ideal.ne_top_iff_one @[simp]
Mathlib/RingTheory/Ideal/Basic.lean
106
110
theorem unit_mul_mem_iff_mem {x y : α} (hy : IsUnit y) : y * x ∈ I ↔ x ∈ I := by
refine ⟨fun h => ?_, fun h => I.mul_mem_left y h⟩ obtain ⟨y', hy'⟩ := hy.exists_left_inv have := I.mul_mem_left y' h rwa [← mul_assoc, hy', one_mul] at this
[ " z = z * (y * x)", " I = ⊤ → 1 ∈ I", " 1 ∈ ⊤", " 1 * 1 = 1", " y * x ∈ I ↔ x ∈ I", " x ∈ I" ]
[ " z = z * (y * x)", " I = ⊤ → 1 ∈ I", " 1 ∈ ⊤", " 1 * 1 = 1" ]
import Mathlib.Algebra.Order.Field.Power import Mathlib.Data.Int.LeastGreatest import Mathlib.Data.Rat.Floor import Mathlib.Data.NNRat.Defs #align_import algebra.order.archimedean from "leanprover-community/mathlib"@"6f413f3f7330b94c92a5a27488fdc74e6d483a78" open Int Set variable {α : Type*} class Archimedean (α) [OrderedAddCommMonoid α] : Prop where arch : ∀ (x : α) {y : α}, 0 < y → ∃ n : ℕ, x ≤ n • y #align archimedean Archimedean instance OrderDual.archimedean [OrderedAddCommGroup α] [Archimedean α] : Archimedean αᵒᵈ := ⟨fun x y hy => let ⟨n, hn⟩ := Archimedean.arch (-ofDual x) (neg_pos.2 hy) ⟨n, by rwa [neg_nsmul, neg_le_neg_iff] at hn⟩⟩ #align order_dual.archimedean OrderDual.archimedean variable {M : Type*} theorem exists_lt_nsmul [OrderedAddCommMonoid M] [Archimedean M] [CovariantClass M M (· + ·) (· < ·)] {a : M} (ha : 0 < a) (b : M) : ∃ n : ℕ, b < n • a := let ⟨k, hk⟩ := Archimedean.arch b ha ⟨k + 1, hk.trans_lt <| nsmul_lt_nsmul_left ha k.lt_succ_self⟩
Mathlib/Algebra/Order/Archimedean.lean
120
122
theorem exists_nat_ge [OrderedSemiring α] [Archimedean α] (x : α) : ∃ n : ℕ, x ≤ n := by
nontriviality α exact (Archimedean.arch x one_pos).imp fun n h => by rwa [← nsmul_one]
[ " x ≤ n • y", " ∃ n, x ≤ ↑n", " x ≤ ↑n" ]
[ " x ≤ n • y" ]
import Batteries.Tactic.SeqFocus namespace Ordering @[simp] theorem swap_swap {o : Ordering} : o.swap.swap = o := by cases o <;> rfl @[simp] theorem swap_inj {o₁ o₂ : Ordering} : o₁.swap = o₂.swap ↔ o₁ = o₂ := ⟨fun h => by simpa using congrArg swap h, congrArg _⟩ theorem swap_then (o₁ o₂ : Ordering) : (o₁.then o₂).swap = o₁.swap.then o₂.swap := by cases o₁ <;> rfl theorem then_eq_lt {o₁ o₂ : Ordering} : o₁.then o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by cases o₁ <;> cases o₂ <;> decide
.lake/packages/batteries/Batteries/Classes/Order.lean
23
24
theorem then_eq_eq {o₁ o₂ : Ordering} : o₁.then o₂ = eq ↔ o₁ = eq ∧ o₂ = eq := by
cases o₁ <;> simp [«then»]
[ " o.swap.swap = o", " lt.swap.swap = lt", " eq.swap.swap = eq", " gt.swap.swap = gt", " o₁ = o₂", " (o₁.then o₂).swap = o₁.swap.then o₂.swap", " (lt.then o₂).swap = lt.swap.then o₂.swap", " (eq.then o₂).swap = eq.swap.then o₂.swap", " (gt.then o₂).swap = gt.swap.then o₂.swap", " o₁.then o₂ = lt ↔ ...
[ " o.swap.swap = o", " lt.swap.swap = lt", " eq.swap.swap = eq", " gt.swap.swap = gt", " o₁ = o₂", " (o₁.then o₂).swap = o₁.swap.then o₂.swap", " (lt.then o₂).swap = lt.swap.then o₂.swap", " (eq.then o₂).swap = eq.swap.then o₂.swap", " (gt.then o₂).swap = gt.swap.then o₂.swap", " o₁.then o₂ = lt ↔ ...
import Mathlib.Data.Vector.Basic import Mathlib.Data.List.Zip #align_import data.vector.zip from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe" namespace Vector section ZipWith variable {α β γ : Type*} {n : ℕ} (f : α → β → γ) def zipWith : Vector α n → Vector β n → Vector γ n := fun x y => ⟨List.zipWith f x.1 y.1, by simp⟩ #align vector.zip_with Vector.zipWith @[simp] theorem zipWith_toList (x : Vector α n) (y : Vector β n) : (Vector.zipWith f x y).toList = List.zipWith f x.toList y.toList := rfl #align vector.zip_with_to_list Vector.zipWith_toList @[simp] theorem zipWith_get (x : Vector α n) (y : Vector β n) (i) : (Vector.zipWith f x y).get i = f (x.get i) (y.get i) := by dsimp only [Vector.zipWith, Vector.get] simp only [List.get_zipWith, Fin.cast] #align vector.zip_with_nth Vector.zipWith_get @[simp]
Mathlib/Data/Vector/Zip.lean
40
43
theorem zipWith_tail (x : Vector α n) (y : Vector β n) : (Vector.zipWith f x y).tail = Vector.zipWith f x.tail y.tail := by
ext simp [get_tail]
[ " (List.zipWith f ↑x ↑y).length = n", " (zipWith f x y).get i = f (x.get i) (y.get i)", " (List.zipWith f ↑x ↑y).get (Fin.cast ⋯ i) = f ((↑x).get (Fin.cast ⋯ i)) ((↑y).get (Fin.cast ⋯ i))", " (zipWith f x y).tail = zipWith f x.tail y.tail", " (zipWith f x y).tail.get m✝ = (zipWith f x.tail y.tail).get m✝" ]
[ " (List.zipWith f ↑x ↑y).length = n", " (zipWith f x y).get i = f (x.get i) (y.get i)", " (List.zipWith f ↑x ↑y).get (Fin.cast ⋯ i) = f ((↑x).get (Fin.cast ⋯ i)) ((↑y).get (Fin.cast ⋯ i))" ]
import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Logic.Encodable.Lattice noncomputable section open Filter Finset Function Encodable open scoped Topology variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M} variable {G : Type*} [CommGroup G] {g g' : G} -- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead section Nat section Monoid namespace HasProd @[to_additive "If `f : ℕ → M` has sum `m`, then the partial sums `∑ i ∈ range n, f i` converge to `m`."] theorem tendsto_prod_nat {f : ℕ → M} (h : HasProd f m) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := h.comp tendsto_finset_range #align has_sum.tendsto_sum_nat HasSum.tendsto_sum_nat @[to_additive "If `f : ℕ → M` is summable, then the partial sums `∑ i ∈ range n, f i` converge to `∑' i, f i`."] theorem Multipliable.tendsto_prod_tprod_nat {f : ℕ → M} (h : Multipliable f) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) := tendsto_prod_nat h.hasProd section tprod variable [T2Space M] {α β γ : Type*} section TopologicalGroup variable [TopologicalSpace G] [TopologicalGroup G] @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean
218
221
theorem hasProd_nat_add_iff {f : ℕ → G} (k : ℕ) : HasProd (fun n ↦ f (n + k)) g ↔ HasProd f (g * ∏ i ∈ range k, f i) := by
refine Iff.trans ?_ (range k).hasProd_compl_iff rw [← (notMemRangeEquiv k).symm.hasProd_iff, Function.comp_def, coe_notMemRangeEquiv_symm]
[ " HasProd (fun n => f (n + k)) g ↔ HasProd f (g * ∏ i ∈ range k, f i)", " HasProd (fun n => f (n + k)) g ↔ HasProd (fun x => f ↑x) g" ]
[]
import Mathlib.Data.Finset.Grade import Mathlib.Order.Interval.Finset.Basic #align_import data.finset.interval from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" variable {α β : Type*} namespace Finset section Decidable variable [DecidableEq α] (s t : Finset α) instance instLocallyFiniteOrder : LocallyFiniteOrder (Finset α) where finsetIcc s t := t.powerset.filter (s ⊆ ·) finsetIco s t := t.ssubsets.filter (s ⊆ ·) finsetIoc s t := t.powerset.filter (s ⊂ ·) finsetIoo s t := t.ssubsets.filter (s ⊂ ·) finset_mem_Icc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ico s t u := by rw [mem_filter, mem_ssubsets] exact and_comm finset_mem_Ioc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ioo s t u := by rw [mem_filter, mem_ssubsets] exact and_comm theorem Icc_eq_filter_powerset : Icc s t = t.powerset.filter (s ⊆ ·) := rfl #align finset.Icc_eq_filter_powerset Finset.Icc_eq_filter_powerset theorem Ico_eq_filter_ssubsets : Ico s t = t.ssubsets.filter (s ⊆ ·) := rfl #align finset.Ico_eq_filter_ssubsets Finset.Ico_eq_filter_ssubsets theorem Ioc_eq_filter_powerset : Ioc s t = t.powerset.filter (s ⊂ ·) := rfl #align finset.Ioc_eq_filter_powerset Finset.Ioc_eq_filter_powerset theorem Ioo_eq_filter_ssubsets : Ioo s t = t.ssubsets.filter (s ⊂ ·) := rfl #align finset.Ioo_eq_filter_ssubsets Finset.Ioo_eq_filter_ssubsets theorem Iic_eq_powerset : Iic s = s.powerset := filter_true_of_mem fun t _ => empty_subset t #align finset.Iic_eq_powerset Finset.Iic_eq_powerset theorem Iio_eq_ssubsets : Iio s = s.ssubsets := filter_true_of_mem fun t _ => empty_subset t #align finset.Iio_eq_ssubsets Finset.Iio_eq_ssubsets variable {s t} theorem Icc_eq_image_powerset (h : s ⊆ t) : Icc s t = (t \ s).powerset.image (s ∪ ·) := by ext u simp_rw [mem_Icc, mem_image, mem_powerset] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_le_sdiff_right ht, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, union_subset h <| hv.trans sdiff_subset⟩ #align finset.Icc_eq_image_powerset Finset.Icc_eq_image_powerset theorem Ico_eq_image_ssubsets (h : s ⊆ t) : Ico s t = (t \ s).ssubsets.image (s ∪ ·) := by ext u simp_rw [mem_Ico, mem_image, mem_ssubsets] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_lt_sdiff_right ht hs, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, sup_lt_of_lt_sdiff_left hv h⟩ #align finset.Ico_eq_image_ssubsets Finset.Ico_eq_image_ssubsets theorem card_Icc_finset (h : s ⊆ t) : (Icc s t).card = 2 ^ (t.card - s.card) := by rw [← card_sdiff h, ← card_powerset, Icc_eq_image_powerset h, Finset.card_image_iff] rintro u hu v hv (huv : s ⊔ u = s ⊔ v) rw [mem_coe, mem_powerset] at hu hv rw [← (disjoint_sdiff.mono_right hu : Disjoint s u).sup_sdiff_cancel_left, ← (disjoint_sdiff.mono_right hv : Disjoint s v).sup_sdiff_cancel_left, huv] #align finset.card_Icc_finset Finset.card_Icc_finset theorem card_Ico_finset (h : s ⊆ t) : (Ico s t).card = 2 ^ (t.card - s.card) - 1 := by rw [card_Ico_eq_card_Icc_sub_one, card_Icc_finset h] #align finset.card_Ico_finset Finset.card_Ico_finset
Mathlib/Data/Finset/Interval.lean
115
116
theorem card_Ioc_finset (h : s ⊆ t) : (Ioc s t).card = 2 ^ (t.card - s.card) - 1 := by
rw [card_Ioc_eq_card_Icc_sub_one, card_Icc_finset h]
[ " u ∈ (fun s t => filter (fun x => s ⊆ x) t.powerset) s t ↔ s ≤ u ∧ u ≤ t", " u ⊆ t ∧ s ⊆ u ↔ s ≤ u ∧ u ≤ t", " u ∈ (fun s t => filter (fun x => s ⊆ x) t.ssubsets) s t ↔ s ≤ u ∧ u < t", " u ⊂ t ∧ s ⊆ u ↔ s ≤ u ∧ u < t", " u ∈ (fun s t => filter (fun x => s ⊂ x) t.powerset) s t ↔ s < u ∧ u ≤ t", " u ⊆ t ∧ ...
[ " u ∈ (fun s t => filter (fun x => s ⊆ x) t.powerset) s t ↔ s ≤ u ∧ u ≤ t", " u ⊆ t ∧ s ⊆ u ↔ s ≤ u ∧ u ≤ t", " u ∈ (fun s t => filter (fun x => s ⊆ x) t.ssubsets) s t ↔ s ≤ u ∧ u < t", " u ⊂ t ∧ s ⊆ u ↔ s ≤ u ∧ u < t", " u ∈ (fun s t => filter (fun x => s ⊂ x) t.powerset) s t ↔ s < u ∧ u ≤ t", " u ⊆ t ∧ ...
import Mathlib.Order.CompleteLattice import Mathlib.Order.Cover import Mathlib.Order.Iterate import Mathlib.Order.WellFounded #align_import order.succ_pred.basic from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" open Function OrderDual Set variable {α β : Type*} @[ext] class SuccOrder (α : Type*) [Preorder α] where succ : α → α le_succ : ∀ a, a ≤ succ a max_of_succ_le {a} : succ a ≤ a → IsMax a succ_le_of_lt {a b} : a < b → succ a ≤ b le_of_lt_succ {a b} : a < succ b → a ≤ b #align succ_order SuccOrder #align succ_order.ext_iff SuccOrder.ext_iff #align succ_order.ext SuccOrder.ext @[ext] class PredOrder (α : Type*) [Preorder α] where pred : α → α pred_le : ∀ a, pred a ≤ a min_of_le_pred {a} : a ≤ pred a → IsMin a le_pred_of_lt {a b} : a < b → a ≤ pred b le_of_pred_lt {a b} : pred a < b → a ≤ b #align pred_order PredOrder #align pred_order.ext PredOrder.ext #align pred_order.ext_iff PredOrder.ext_iff instance [Preorder α] [SuccOrder α] : PredOrder αᵒᵈ where pred := toDual ∘ SuccOrder.succ ∘ ofDual pred_le := by simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual, SuccOrder.le_succ, implies_true] min_of_le_pred h := by apply SuccOrder.max_of_succ_le h le_pred_of_lt := by intro a b h; exact SuccOrder.succ_le_of_lt h le_of_pred_lt := SuccOrder.le_of_lt_succ instance [Preorder α] [PredOrder α] : SuccOrder αᵒᵈ where succ := toDual ∘ PredOrder.pred ∘ ofDual le_succ := by simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual, PredOrder.pred_le, implies_true] max_of_succ_le h := by apply PredOrder.min_of_le_pred h succ_le_of_lt := by intro a b h; exact PredOrder.le_pred_of_lt h le_of_lt_succ := PredOrder.le_of_pred_lt namespace Order section Preorder variable [Preorder α] [SuccOrder α] {a b : α} def succ : α → α := SuccOrder.succ #align order.succ Order.succ theorem le_succ : ∀ a : α, a ≤ succ a := SuccOrder.le_succ #align order.le_succ Order.le_succ theorem max_of_succ_le {a : α} : succ a ≤ a → IsMax a := SuccOrder.max_of_succ_le #align order.max_of_succ_le Order.max_of_succ_le theorem succ_le_of_lt {a b : α} : a < b → succ a ≤ b := SuccOrder.succ_le_of_lt #align order.succ_le_of_lt Order.succ_le_of_lt theorem le_of_lt_succ {a b : α} : a < succ b → a ≤ b := SuccOrder.le_of_lt_succ #align order.le_of_lt_succ Order.le_of_lt_succ @[simp] theorem succ_le_iff_isMax : succ a ≤ a ↔ IsMax a := ⟨max_of_succ_le, fun h => h <| le_succ _⟩ #align order.succ_le_iff_is_max Order.succ_le_iff_isMax @[simp] theorem lt_succ_iff_not_isMax : a < succ a ↔ ¬IsMax a := ⟨not_isMax_of_lt, fun ha => (le_succ a).lt_of_not_le fun h => ha <| max_of_succ_le h⟩ #align order.lt_succ_iff_not_is_max Order.lt_succ_iff_not_isMax alias ⟨_, lt_succ_of_not_isMax⟩ := lt_succ_iff_not_isMax #align order.lt_succ_of_not_is_max Order.lt_succ_of_not_isMax theorem wcovBy_succ (a : α) : a ⩿ succ a := ⟨le_succ a, fun _ hb => (succ_le_of_lt hb).not_lt⟩ #align order.wcovby_succ Order.wcovBy_succ theorem covBy_succ_of_not_isMax (h : ¬IsMax a) : a ⋖ succ a := (wcovBy_succ a).covBy_of_lt <| lt_succ_of_not_isMax h #align order.covby_succ_of_not_is_max Order.covBy_succ_of_not_isMax theorem lt_succ_iff_of_not_isMax (ha : ¬IsMax a) : b < succ a ↔ b ≤ a := ⟨le_of_lt_succ, fun h => h.trans_lt <| lt_succ_of_not_isMax ha⟩ #align order.lt_succ_iff_of_not_is_max Order.lt_succ_iff_of_not_isMax theorem succ_le_iff_of_not_isMax (ha : ¬IsMax a) : succ a ≤ b ↔ a < b := ⟨(lt_succ_of_not_isMax ha).trans_le, succ_le_of_lt⟩ #align order.succ_le_iff_of_not_is_max Order.succ_le_iff_of_not_isMax lemma succ_lt_succ_of_not_isMax (h : a < b) (hb : ¬ IsMax b) : succ a < succ b := (lt_succ_iff_of_not_isMax hb).2 <| succ_le_of_lt h theorem succ_lt_succ_iff_of_not_isMax (ha : ¬IsMax a) (hb : ¬IsMax b) : succ a < succ b ↔ a < b := by rw [lt_succ_iff_of_not_isMax hb, succ_le_iff_of_not_isMax ha] #align order.succ_lt_succ_iff_of_not_is_max Order.succ_lt_succ_iff_of_not_isMax
Mathlib/Order/SuccPred/Basic.lean
284
286
theorem succ_le_succ_iff_of_not_isMax (ha : ¬IsMax a) (hb : ¬IsMax b) : succ a ≤ succ b ↔ a ≤ b := by
rw [succ_le_iff_of_not_isMax ha, lt_succ_iff_of_not_isMax hb]
[ " ∀ (a : αᵒᵈ), (⇑toDual ∘ SuccOrder.succ ∘ ⇑ofDual) a ≤ a", " IsMin a✝", " ∀ {a b : αᵒᵈ}, a < b → a ≤ (⇑toDual ∘ SuccOrder.succ ∘ ⇑ofDual) b", " a ≤ (⇑toDual ∘ SuccOrder.succ ∘ ⇑ofDual) b", " ∀ (a : αᵒᵈ), a ≤ (⇑toDual ∘ PredOrder.pred ∘ ⇑ofDual) a", " IsMax a✝", " ∀ {a b : αᵒᵈ}, a < b → (⇑toDual ∘ PredO...
[ " ∀ (a : αᵒᵈ), (⇑toDual ∘ SuccOrder.succ ∘ ⇑ofDual) a ≤ a", " IsMin a✝", " ∀ {a b : αᵒᵈ}, a < b → a ≤ (⇑toDual ∘ SuccOrder.succ ∘ ⇑ofDual) b", " a ≤ (⇑toDual ∘ SuccOrder.succ ∘ ⇑ofDual) b", " ∀ (a : αᵒᵈ), a ≤ (⇑toDual ∘ PredOrder.pred ∘ ⇑ofDual) a", " IsMax a✝", " ∀ {a b : αᵒᵈ}, a < b → (⇑toDual ∘ PredO...
import Mathlib.CategoryTheory.Limits.Preserves.Finite import Mathlib.CategoryTheory.Sites.Canonical import Mathlib.CategoryTheory.Sites.Coherent.Basic import Mathlib.CategoryTheory.Sites.Preserves universe v u w namespace CategoryTheory open Limits variable {C : Type u} [Category.{v} C] variable [FinitaryPreExtensive C] class Presieve.Extensive {X : C} (R : Presieve X) : Prop where arrows_nonempty_isColimit : ∃ (α : Type) (_ : Finite α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)), R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π)) instance {X : C} (S : Presieve X) [S.Extensive] : S.hasPullbacks where has_pullbacks := by obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.Extensive.arrows_nonempty_isColimit (R := S) intro _ _ _ _ _ hg cases hg apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc open Presieve Opposite theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.Extensive] (F : Cᵒᵖ ⥤ Type w) [PreservesFiniteProducts F] : S.IsSheafFor F := by obtain ⟨α, _, Z, π, rfl, ⟨hc⟩⟩ := Extensive.arrows_nonempty_isColimit (R := S) have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks := (inferInstance : (ofArrows Z π).hasPullbacks) cases nonempty_fintype α exact isSheafFor_of_preservesProduct _ _ hc instance {α : Type} [Finite α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).Extensive := ⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩ theorem extensiveTopology.isSheaf_yoneda_obj (W : C) : Presieve.IsSheaf (extensiveTopology C) (yoneda.obj W) := by erw [isSheaf_coverage] intro X R ⟨Y, α, Z, π, hR, hi⟩ have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi have : R.Extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩ exact isSheafFor_extensive_of_preservesFiniteProducts _ _ theorem extensiveTopology.subcanonical : Sheaf.Subcanonical (extensiveTopology C) := Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
Mathlib/CategoryTheory/Sites/Coherent/ExtensiveSheaves.lean
80
110
theorem Presieve.isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (extensiveTopology C) F ↔ Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩ · erw [Presieve.isSheaf_coverage] at hF let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩) have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks := (inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks) have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) := (inferInstance : ∀ (i : α), Mono (Sigma.ι Z i)) let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F := Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z) (FinitaryExtensive.isPullback_initial_to_sigma_ι Z) (hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_) · exact preservesLimitOfIsoDiagram F i.symm · apply hF refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩ · ext b cases b · simp only [eq_iff_true_of_subsingleton] · refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩ suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance ext simp · let _ := hF.some erw [Presieve.isSheaf_coverage] intro X R ⟨Y, α, Z, π, hR, hi⟩ have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi have : R.Extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩ exact isSheafFor_extensive_of_preservesFiniteProducts R F
[ " ∀ {Y Z : C} {f : Y ⟶ X}, S f → ∀ {g : Z ⟶ X}, S g → HasPullback f g", " ∀ {Y Z : C} {f : Y ⟶ X}, Presieve.ofArrows w✝¹ w✝ f → ∀ {g : Z ⟶ X}, Presieve.ofArrows w✝¹ w✝ g → HasPullback f g", " HasPullback f✝ g✝", " HasPullback f✝ (w✝ i✝)", " IsSheafFor F S", " IsSheafFor F (ofArrows Z π)", " IsSheaf (ext...
[ " ∀ {Y Z : C} {f : Y ⟶ X}, S f → ∀ {g : Z ⟶ X}, S g → HasPullback f g", " ∀ {Y Z : C} {f : Y ⟶ X}, Presieve.ofArrows w✝¹ w✝ f → ∀ {g : Z ⟶ X}, Presieve.ofArrows w✝¹ w✝ g → HasPullback f g", " HasPullback f✝ g✝", " HasPullback f✝ (w✝ i✝)", " IsSheafFor F S", " IsSheafFor F (ofArrows Z π)", " IsSheaf (ext...
import Mathlib.Algebra.DualNumber import Mathlib.Algebra.QuaternionBasis import Mathlib.Data.Complex.Module import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.CliffordAlgebra.Star import Mathlib.LinearAlgebra.QuadraticForm.Prod #align_import linear_algebra.clifford_algebra.equivs from "leanprover-community/mathlib"@"cf7a7252c1989efe5800e0b3cdfeb4228ac6b40e" open CliffordAlgebra namespace CliffordAlgebraQuaternion open scoped Quaternion open QuaternionAlgebra variable {R : Type*} [CommRing R] (c₁ c₂ : R) def Q : QuadraticForm R (R × R) := (c₁ • QuadraticForm.sq (R := R)).prod (c₂ • QuadraticForm.sq) -- Porting note: Added `(R := R)` set_option linter.uppercaseLean3 false in #align clifford_algebra_quaternion.Q CliffordAlgebraQuaternion.Q @[simp] theorem Q_apply (v : R × R) : Q c₁ c₂ v = c₁ * (v.1 * v.1) + c₂ * (v.2 * v.2) := rfl set_option linter.uppercaseLean3 false in #align clifford_algebra_quaternion.Q_apply CliffordAlgebraQuaternion.Q_apply @[simps i j k] def quaternionBasis : QuaternionAlgebra.Basis (CliffordAlgebra (Q c₁ c₂)) c₁ c₂ where i := ι (Q c₁ c₂) (1, 0) j := ι (Q c₁ c₂) (0, 1) k := ι (Q c₁ c₂) (1, 0) * ι (Q c₁ c₂) (0, 1) i_mul_i := by rw [ι_sq_scalar, Q_apply, ← Algebra.algebraMap_eq_smul_one] simp j_mul_j := by rw [ι_sq_scalar, Q_apply, ← Algebra.algebraMap_eq_smul_one] simp i_mul_j := rfl j_mul_i := by rw [eq_neg_iff_add_eq_zero, ι_mul_ι_add_swap, QuadraticForm.polar] simp #align clifford_algebra_quaternion.quaternion_basis CliffordAlgebraQuaternion.quaternionBasis variable {c₁ c₂} def toQuaternion : CliffordAlgebra (Q c₁ c₂) →ₐ[R] ℍ[R,c₁,c₂] := CliffordAlgebra.lift (Q c₁ c₂) ⟨{ toFun := fun v => (⟨0, v.1, v.2, 0⟩ : ℍ[R,c₁,c₂]) map_add' := fun v₁ v₂ => by simp map_smul' := fun r v => by dsimp; rw [mul_zero] }, fun v => by dsimp ext all_goals dsimp; ring⟩ #align clifford_algebra_quaternion.to_quaternion CliffordAlgebraQuaternion.toQuaternion @[simp] theorem toQuaternion_ι (v : R × R) : toQuaternion (ι (Q c₁ c₂) v) = (⟨0, v.1, v.2, 0⟩ : ℍ[R,c₁,c₂]) := CliffordAlgebra.lift_ι_apply _ _ v #align clifford_algebra_quaternion.to_quaternion_ι CliffordAlgebraQuaternion.toQuaternion_ι
Mathlib/LinearAlgebra/CliffordAlgebra/Equivs.lean
311
322
theorem toQuaternion_star (c : CliffordAlgebra (Q c₁ c₂)) : toQuaternion (star c) = star (toQuaternion c) := by
simp only [CliffordAlgebra.star_def'] induction c using CliffordAlgebra.induction with | algebraMap r => simp only [reverse.commutes, AlgHom.commutes, QuaternionAlgebra.coe_algebraMap, QuaternionAlgebra.star_coe] | ι x => rw [reverse_ι, involute_ι, toQuaternion_ι, AlgHom.map_neg, toQuaternion_ι, QuaternionAlgebra.neg_mk, star_mk, neg_zero] | mul x₁ x₂ hx₁ hx₂ => simp only [reverse.map_mul, AlgHom.map_mul, hx₁, hx₂, star_mul] | add x₁ x₂ hx₁ hx₂ => simp only [reverse.map_add, AlgHom.map_add, hx₁, hx₂, star_add]
[ " (ι (Q c₁ c₂)) (1, 0) * (ι (Q c₁ c₂)) (1, 0) = c₁ • 1", " (algebraMap R (CliffordAlgebra (Q c₁ c₂))) (c₁ * ((1, 0).1 * (1, 0).1) + c₂ * ((1, 0).2 * (1, 0).2)) =\n (algebraMap R (CliffordAlgebra (Q c₁ c₂))) c₁", " (ι (Q c₁ c₂)) (0, 1) * (ι (Q c₁ c₂)) (0, 1) = c₂ • 1", " (algebraMap R (CliffordAlgebra (Q c₁...
[ " (ι (Q c₁ c₂)) (1, 0) * (ι (Q c₁ c₂)) (1, 0) = c₁ • 1", " (algebraMap R (CliffordAlgebra (Q c₁ c₂))) (c₁ * ((1, 0).1 * (1, 0).1) + c₂ * ((1, 0).2 * (1, 0).2)) =\n (algebraMap R (CliffordAlgebra (Q c₁ c₂))) c₁", " (ι (Q c₁ c₂)) (0, 1) * (ι (Q c₁ c₂)) (0, 1) = c₂ • 1", " (algebraMap R (CliffordAlgebra (Q c₁...
import Mathlib.Data.List.Basic open Function open Nat hiding one_pos assert_not_exists Set.range namespace List universe u v w variable {ι : Type*} {α : Type u} {β : Type v} {γ : Type w} {l₁ l₂ : List α} section InsertNth variable {a : α} @[simp] theorem insertNth_zero (s : List α) (x : α) : insertNth 0 x s = x :: s := rfl #align list.insert_nth_zero List.insertNth_zero @[simp] theorem insertNth_succ_nil (n : ℕ) (a : α) : insertNth (n + 1) a [] = [] := rfl #align list.insert_nth_succ_nil List.insertNth_succ_nil @[simp] theorem insertNth_succ_cons (s : List α) (hd x : α) (n : ℕ) : insertNth (n + 1) x (hd :: s) = hd :: insertNth n x s := rfl #align list.insert_nth_succ_cons List.insertNth_succ_cons theorem length_insertNth : ∀ n as, n ≤ length as → length (insertNth n a as) = length as + 1 | 0, _, _ => rfl | _ + 1, [], h => (Nat.not_succ_le_zero _ h).elim | n + 1, _ :: as, h => congr_arg Nat.succ <| length_insertNth n as (Nat.le_of_succ_le_succ h) #align list.length_insert_nth List.length_insertNth theorem eraseIdx_insertNth (n : ℕ) (l : List α) : (l.insertNth n a).eraseIdx n = l := by rw [eraseIdx_eq_modifyNthTail, insertNth, modifyNthTail_modifyNthTail_same] exact modifyNthTail_id _ _ #align list.remove_nth_insert_nth List.eraseIdx_insertNth @[deprecated (since := "2024-05-04")] alias removeNth_insertNth := eraseIdx_insertNth theorem insertNth_eraseIdx_of_ge : ∀ n m as, n < length as → n ≤ m → insertNth m a (as.eraseIdx n) = (as.insertNth (m + 1) a).eraseIdx n | 0, 0, [], has, _ => (lt_irrefl _ has).elim | 0, 0, _ :: as, _, _ => by simp [eraseIdx, insertNth] | 0, m + 1, a :: as, _, _ => rfl | n + 1, m + 1, a :: as, has, hmn => congr_arg (cons a) <| insertNth_eraseIdx_of_ge n m as (Nat.lt_of_succ_lt_succ has) (Nat.le_of_succ_le_succ hmn) #align list.insert_nth_remove_nth_of_ge List.insertNth_eraseIdx_of_ge @[deprecated (since := "2024-05-04")] alias insertNth_removeNth_of_ge := insertNth_eraseIdx_of_ge theorem insertNth_eraseIdx_of_le : ∀ n m as, n < length as → m ≤ n → insertNth m a (as.eraseIdx n) = (as.insertNth m a).eraseIdx (n + 1) | _, 0, _ :: _, _, _ => rfl | n + 1, m + 1, a :: as, has, hmn => congr_arg (cons a) <| insertNth_eraseIdx_of_le n m as (Nat.lt_of_succ_lt_succ has) (Nat.le_of_succ_le_succ hmn) #align list.insert_nth_remove_nth_of_le List.insertNth_eraseIdx_of_le @[deprecated (since := "2024-05-04")] alias insertNth_removeNth_of_le := insertNth_eraseIdx_of_le theorem insertNth_comm (a b : α) : ∀ (i j : ℕ) (l : List α) (_ : i ≤ j) (_ : j ≤ length l), (l.insertNth i a).insertNth (j + 1) b = (l.insertNth j b).insertNth i a | 0, j, l => by simp [insertNth] | i + 1, 0, l => fun h => (Nat.not_lt_zero _ h).elim | i + 1, j + 1, [] => by simp | i + 1, j + 1, c :: l => fun h₀ h₁ => by simp only [insertNth_succ_cons, cons.injEq, true_and] exact insertNth_comm a b i j l (Nat.le_of_succ_le_succ h₀) (Nat.le_of_succ_le_succ h₁) #align list.insert_nth_comm List.insertNth_comm theorem mem_insertNth {a b : α} : ∀ {n : ℕ} {l : List α} (_ : n ≤ l.length), a ∈ l.insertNth n b ↔ a = b ∨ a ∈ l | 0, as, _ => by simp | n + 1, [], h => (Nat.not_succ_le_zero _ h).elim | n + 1, a' :: as, h => by rw [List.insertNth_succ_cons, mem_cons, mem_insertNth (Nat.le_of_succ_le_succ h), ← or_assoc, @or_comm (a = a'), or_assoc, mem_cons] #align list.mem_insert_nth List.mem_insertNth theorem insertNth_of_length_lt (l : List α) (x : α) (n : ℕ) (h : l.length < n) : insertNth n x l = l := by induction' l with hd tl IH generalizing n · cases n · simp at h · simp · cases n · simp at h · simp only [Nat.succ_lt_succ_iff, length] at h simpa using IH _ h #align list.insert_nth_of_length_lt List.insertNth_of_length_lt @[simp] theorem insertNth_length_self (l : List α) (x : α) : insertNth l.length x l = l ++ [x] := by induction' l with hd tl IH · simp · simpa using IH #align list.insert_nth_length_self List.insertNth_length_self
Mathlib/Data/List/InsertNth.lean
122
127
theorem length_le_length_insertNth (l : List α) (x : α) (n : ℕ) : l.length ≤ (insertNth n x l).length := by
rcases le_or_lt n l.length with hn | hn · rw [length_insertNth _ _ hn] exact (Nat.lt_succ_self _).le · rw [insertNth_of_length_lt _ _ _ hn]
[ " (insertNth n a l).eraseIdx n = l", " modifyNthTail (tail ∘ cons a) n l = l", " insertNth 0 a ((head✝ :: as).eraseIdx 0) = (insertNth (0 + 1) a (head✝ :: as)).eraseIdx 0", " 0 ≤ j → j ≤ l.length → insertNth (j + 1) b (insertNth 0 a l) = insertNth 0 a (insertNth j b l)", " i + 1 ≤ j + 1 →\n j + 1 ≤ [].le...
[ " (insertNth n a l).eraseIdx n = l", " modifyNthTail (tail ∘ cons a) n l = l", " insertNth 0 a ((head✝ :: as).eraseIdx 0) = (insertNth (0 + 1) a (head✝ :: as)).eraseIdx 0", " 0 ≤ j → j ≤ l.length → insertNth (j + 1) b (insertNth 0 a l) = insertNth 0 a (insertNth j b l)", " i + 1 ≤ j + 1 →\n j + 1 ≤ [].le...
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Ring variable {R S : Type*} [Ring R] [Ring S] def invUnitsSub (u : Rˣ) : PowerSeries R := mk fun n => 1 /ₚ u ^ (n + 1) #align power_series.inv_units_sub PowerSeries.invUnitsSub @[simp] theorem coeff_invUnitsSub (u : Rˣ) (n : ℕ) : coeff R n (invUnitsSub u) = 1 /ₚ u ^ (n + 1) := coeff_mk _ _ #align power_series.coeff_inv_units_sub PowerSeries.coeff_invUnitsSub @[simp] theorem constantCoeff_invUnitsSub (u : Rˣ) : constantCoeff R (invUnitsSub u) = 1 /ₚ u := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_invUnitsSub, zero_add, pow_one] #align power_series.constant_coeff_inv_units_sub PowerSeries.constantCoeff_invUnitsSub @[simp] theorem invUnitsSub_mul_X (u : Rˣ) : invUnitsSub u * X = invUnitsSub u * C R u - 1 := by ext (_ | n) · simp · simp [n.succ_ne_zero, pow_succ'] set_option linter.uppercaseLean3 false in #align power_series.inv_units_sub_mul_X PowerSeries.invUnitsSub_mul_X @[simp] theorem invUnitsSub_mul_sub (u : Rˣ) : invUnitsSub u * (C R u - X) = 1 := by simp [mul_sub, sub_sub_cancel] #align power_series.inv_units_sub_mul_sub PowerSeries.invUnitsSub_mul_sub
Mathlib/RingTheory/PowerSeries/WellKnown.lean
64
68
theorem map_invUnitsSub (f : R →+* S) (u : Rˣ) : map f (invUnitsSub u) = invUnitsSub (Units.map (f : R →* S) u) := by
ext simp only [← map_pow, coeff_map, coeff_invUnitsSub, one_divp] rfl
[ " (constantCoeff R) (invUnitsSub u) = 1 /ₚ u", " invUnitsSub u * X = invUnitsSub u * (C R) ↑u - 1", " (coeff R 0) (invUnitsSub u * X) = (coeff R 0) (invUnitsSub u * (C R) ↑u - 1)", " (coeff R (n + 1)) (invUnitsSub u * X) = (coeff R (n + 1)) (invUnitsSub u * (C R) ↑u - 1)", " invUnitsSub u * ((C R) ↑u - X) =...
[ " (constantCoeff R) (invUnitsSub u) = 1 /ₚ u", " invUnitsSub u * X = invUnitsSub u * (C R) ↑u - 1", " (coeff R 0) (invUnitsSub u * X) = (coeff R 0) (invUnitsSub u * (C R) ↑u - 1)", " (coeff R (n + 1)) (invUnitsSub u * X) = (coeff R (n + 1)) (invUnitsSub u * (C R) ↑u - 1)", " invUnitsSub u * ((C R) ↑u - X) =...
import Mathlib.CategoryTheory.Preadditive.Injective import Mathlib.Algebra.Category.ModuleCat.EpiMono import Mathlib.RingTheory.Ideal.Basic import Mathlib.LinearAlgebra.LinearPMap import Mathlib.Logic.Equiv.TransferInstance #align_import algebra.module.injective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946" noncomputable section universe u v v' variable (R : Type u) [Ring R] (Q : Type v) [AddCommGroup Q] [Module R Q] @[mk_iff] class Module.Injective : Prop where out : ∀ ⦃X Y : Type v⦄ [AddCommGroup X] [AddCommGroup Y] [Module R X] [Module R Y] (f : X →ₗ[R] Y) (_ : Function.Injective f) (g : X →ₗ[R] Q), ∃ h : Y →ₗ[R] Q, ∀ x, h (f x) = g x #align module.injective Module.Injective theorem Module.injective_object_of_injective_module [inj : Module.Injective R Q] : CategoryTheory.Injective (ModuleCat.of R Q) where factors g f m := have ⟨l, h⟩ := inj.out f ((ModuleCat.mono_iff_injective f).mp m) g ⟨l, LinearMap.ext h⟩ #align module.injective_object_of_injective_module Module.injective_object_of_injective_module
Mathlib/Algebra/Module/Injective.lean
70
76
theorem Module.injective_module_of_injective_object [inj : CategoryTheory.Injective <| ModuleCat.of R Q] : Module.Injective R Q where out X Y _ _ _ _ f hf g := by
have : CategoryTheory.Mono (ModuleCat.ofHom f) := (ModuleCat.mono_iff_injective _).mpr hf obtain ⟨l, rfl⟩ := inj.factors (ModuleCat.ofHom g) (ModuleCat.ofHom f) exact ⟨l, fun _ ↦ rfl⟩
[ " ∃ h, ∀ (x : X), h (f x) = g x", " ∃ h, ∀ (x : X), h (f x) = (CategoryTheory.CategoryStruct.comp (ModuleCat.ofHom f) l) x" ]
[]
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.RingTheory.Polynomial.Bernstein import Mathlib.Topology.ContinuousFunction.Polynomial import Mathlib.Topology.ContinuousFunction.Compact #align_import analysis.special_functions.bernstein from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" set_option linter.uppercaseLean3 false -- S noncomputable section open scoped Classical BoundedContinuousFunction unitInterval def bernstein (n ν : ℕ) : C(I, ℝ) := (bernsteinPolynomial ℝ n ν).toContinuousMapOn I #align bernstein bernstein @[simp]
Mathlib/Analysis/SpecialFunctions/Bernstein.lean
61
64
theorem bernstein_apply (n ν : ℕ) (x : I) : bernstein n ν x = (n.choose ν : ℝ) * (x : ℝ) ^ ν * (1 - (x : ℝ)) ^ (n - ν) := by
dsimp [bernstein, Polynomial.toContinuousMapOn, Polynomial.toContinuousMap, bernsteinPolynomial] simp
[ " (bernstein n ν) x = ↑(n.choose ν) * ↑x ^ ν * (1 - ↑x) ^ (n - ν)", " Polynomial.eval (↑x) (↑(n.choose ν) * Polynomial.X ^ ν * (1 - Polynomial.X) ^ (n - ν)) =\n ↑(n.choose ν) * ↑x ^ ν * (1 - ↑x) ^ (n - ν)" ]
[]
import Mathlib.Topology.MetricSpace.PseudoMetric open Filter open scoped Uniformity Topology universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] theorem Metric.complete_of_convergent_controlled_sequences (B : ℕ → Real) (hB : ∀ n, 0 < B n) (H : ∀ u : ℕ → α, (∀ N n m : ℕ, N ≤ n → N ≤ m → dist (u n) (u m) < B N) → ∃ x, Tendsto u atTop (𝓝 x)) : CompleteSpace α := UniformSpace.complete_of_convergent_controlled_sequences (fun n => { p : α × α | dist p.1 p.2 < B n }) (fun n => dist_mem_uniformity <| hB n) H #align metric.complete_of_convergent_controlled_sequences Metric.complete_of_convergent_controlled_sequences theorem Metric.complete_of_cauchySeq_tendsto : (∀ u : ℕ → α, CauchySeq u → ∃ a, Tendsto u atTop (𝓝 a)) → CompleteSpace α := EMetric.complete_of_cauchySeq_tendsto #align metric.complete_of_cauchy_seq_tendsto Metric.complete_of_cauchySeq_tendsto section CauchySeq variable [Nonempty β] [SemilatticeSup β] -- Porting note: @[nolint ge_or_gt] doesn't exist theorem Metric.cauchySeq_iff {u : β → α} : CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ m ≥ N, ∀ n ≥ N, dist (u m) (u n) < ε := uniformity_basis_dist.cauchySeq_iff #align metric.cauchy_seq_iff Metric.cauchySeq_iff theorem Metric.cauchySeq_iff' {u : β → α} : CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) (u N) < ε := uniformity_basis_dist.cauchySeq_iff' #align metric.cauchy_seq_iff' Metric.cauchySeq_iff' -- see Note [nolint_ge] -- Porting note: no attr @[nolint ge_or_gt] theorem Metric.uniformCauchySeqOn_iff {γ : Type*} {F : β → γ → α} {s : Set γ} : UniformCauchySeqOn F atTop s ↔ ∀ ε > (0 : ℝ), ∃ N : β, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε := by constructor · intro h ε hε let u := { a : α × α | dist a.fst a.snd < ε } have hu : u ∈ 𝓤 α := Metric.mem_uniformity_dist.mpr ⟨ε, hε, by simp [u]⟩ rw [← @Filter.eventually_atTop_prod_self' _ _ _ fun m => ∀ x ∈ s, dist (F m.fst x) (F m.snd x) < ε] specialize h u hu rw [prod_atTop_atTop_eq] at h exact h.mono fun n h x hx => h x hx · intro h u hu rcases Metric.mem_uniformity_dist.mp hu with ⟨ε, hε, hab⟩ rcases h ε hε with ⟨N, hN⟩ rw [prod_atTop_atTop_eq, eventually_atTop] use (N, N) intro b hb x hx rcases hb with ⟨hbl, hbr⟩ exact hab (hN b.fst hbl.ge b.snd hbr.ge x hx) #align metric.uniform_cauchy_seq_on_iff Metric.uniformCauchySeqOn_iff theorem cauchySeq_of_le_tendsto_0' {s : β → α} (b : β → ℝ) (h : ∀ n m : β, n ≤ m → dist (s n) (s m) ≤ b n) (h₀ : Tendsto b atTop (𝓝 0)) : CauchySeq s := Metric.cauchySeq_iff'.2 fun ε ε0 => (h₀.eventually (gt_mem_nhds ε0)).exists.imp fun N hN n hn => calc dist (s n) (s N) = dist (s N) (s n) := dist_comm _ _ _ ≤ b N := h _ _ hn _ < ε := hN #align cauchy_seq_of_le_tendsto_0' cauchySeq_of_le_tendsto_0' theorem cauchySeq_of_le_tendsto_0 {s : β → α} (b : β → ℝ) (h : ∀ n m N : β, N ≤ n → N ≤ m → dist (s n) (s m) ≤ b N) (h₀ : Tendsto b atTop (𝓝 0)) : CauchySeq s := cauchySeq_of_le_tendsto_0' b (fun _n _m hnm => h _ _ _ le_rfl hnm) h₀ #align cauchy_seq_of_le_tendsto_0 cauchySeq_of_le_tendsto_0
Mathlib/Topology/MetricSpace/Cauchy.lean
113
123
theorem cauchySeq_bdd {u : ℕ → α} (hu : CauchySeq u) : ∃ R > 0, ∀ m n, dist (u m) (u n) < R := by
rcases Metric.cauchySeq_iff'.1 hu 1 zero_lt_one with ⟨N, hN⟩ rsuffices ⟨R, R0, H⟩ : ∃ R > 0, ∀ n, dist (u n) (u N) < R · exact ⟨_, add_pos R0 R0, fun m n => lt_of_le_of_lt (dist_triangle_right _ _ _) (add_lt_add (H m) (H n))⟩ let R := Finset.sup (Finset.range N) fun n => nndist (u n) (u N) refine ⟨↑R + 1, add_pos_of_nonneg_of_pos R.2 zero_lt_one, fun n => ?_⟩ rcases le_or_lt N n with h | h · exact lt_of_lt_of_le (hN _ h) (le_add_of_nonneg_left R.2) · have : _ ≤ R := Finset.le_sup (Finset.mem_range.2 h) exact lt_of_le_of_lt this (lt_add_of_pos_right _ zero_lt_one)
[ " UniformCauchySeqOn F atTop s ↔ ∀ ε > 0, ∃ N, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε", " UniformCauchySeqOn F atTop s → ∀ ε > 0, ∃ N, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε", " ∃ N, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε", " ∀ {a b : α}, dist a b < ε → (a, b) ∈ u", " ...
[ " UniformCauchySeqOn F atTop s ↔ ∀ ε > 0, ∃ N, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε", " UniformCauchySeqOn F atTop s → ∀ ε > 0, ∃ N, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε", " ∃ N, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε", " ∀ {a b : α}, dist a b < ε → (a, b) ∈ u", " ...
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
64
70
theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by
refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩
[ " (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree", " (fun x => ∑ i ∈ range P.natDegree, P.coeff i * x ^ i + P.coeff P.natDegree * x ^ P.natDegree) ~[atTop] fun x =>\n P.leadingCoeff * x ^ P.natDegree", " Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff", "...
[ " (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree", " (fun x => ∑ i ∈ range P.natDegree, P.coeff i * x ^ i + P.coeff P.natDegree * x ^ P.natDegree) ~[atTop] fun x =>\n P.leadingCoeff * x ^ P.natDegree" ]
import Mathlib.Algebra.Star.Subalgebra import Mathlib.Topology.Algebra.Algebra import Mathlib.Topology.Algebra.Star #align_import topology.algebra.star_subalgebra from "leanprover-community/mathlib"@"b7f5a77fa29ad9a3ccc484109b0d7534178e7ecd" open scoped Classical open Set TopologicalSpace open scoped Classical namespace StarSubalgebra section TopologicalStarAlgebra variable {R A B : Type*} [CommSemiring R] [StarRing R] variable [TopologicalSpace A] [Semiring A] [Algebra R A] [StarRing A] [StarModule R A] instance [TopologicalSemiring A] (s : StarSubalgebra R A) : TopologicalSemiring s := s.toSubalgebra.topologicalSemiring theorem embedding_inclusion {S₁ S₂ : StarSubalgebra R A} (h : S₁ ≤ S₂) : Embedding (inclusion h) := { induced := Eq.symm induced_compose inj := Subtype.map_injective h Function.injective_id } #align star_subalgebra.embedding_inclusion StarSubalgebra.embedding_inclusion theorem closedEmbedding_inclusion {S₁ S₂ : StarSubalgebra R A} (h : S₁ ≤ S₂) (hS₁ : IsClosed (S₁ : Set A)) : ClosedEmbedding (inclusion h) := { embedding_inclusion h with isClosed_range := isClosed_induced_iff.2 ⟨S₁, hS₁, by convert (Set.range_subtype_map id _).symm · rw [Set.image_id]; rfl · intro _ h' apply h h' ⟩ } #align star_subalgebra.closed_embedding_inclusion StarSubalgebra.closedEmbedding_inclusion variable [TopologicalSemiring A] [ContinuousStar A] variable [TopologicalSpace B] [Semiring B] [Algebra R B] [StarRing B] def topologicalClosure (s : StarSubalgebra R A) : StarSubalgebra R A := { s.toSubalgebra.topologicalClosure with carrier := closure (s : Set A) star_mem' := fun ha => map_mem_closure continuous_star ha fun x => (star_mem : x ∈ s → star x ∈ s) } #align star_subalgebra.topological_closure StarSubalgebra.topologicalClosure theorem topologicalClosure_toSubalgebra_comm (s : StarSubalgebra R A) : s.topologicalClosure.toSubalgebra = s.toSubalgebra.topologicalClosure := SetLike.coe_injective rfl @[simp] theorem topologicalClosure_coe (s : StarSubalgebra R A) : (s.topologicalClosure : Set A) = closure (s : Set A) := rfl #align star_subalgebra.topological_closure_coe StarSubalgebra.topologicalClosure_coe theorem le_topologicalClosure (s : StarSubalgebra R A) : s ≤ s.topologicalClosure := subset_closure #align star_subalgebra.le_topological_closure StarSubalgebra.le_topologicalClosure theorem isClosed_topologicalClosure (s : StarSubalgebra R A) : IsClosed (s.topologicalClosure : Set A) := isClosed_closure #align star_subalgebra.is_closed_topological_closure StarSubalgebra.isClosed_topologicalClosure instance {A : Type*} [UniformSpace A] [CompleteSpace A] [Semiring A] [StarRing A] [TopologicalSemiring A] [ContinuousStar A] [Algebra R A] [StarModule R A] {S : StarSubalgebra R A} : CompleteSpace S.topologicalClosure := isClosed_closure.completeSpace_coe theorem topologicalClosure_minimal {s t : StarSubalgebra R A} (h : s ≤ t) (ht : IsClosed (t : Set A)) : s.topologicalClosure ≤ t := closure_minimal h ht #align star_subalgebra.topological_closure_minimal StarSubalgebra.topologicalClosure_minimal theorem topologicalClosure_mono : Monotone (topologicalClosure : _ → StarSubalgebra R A) := fun _ S₂ h => topologicalClosure_minimal (h.trans <| le_topologicalClosure S₂) (isClosed_topologicalClosure S₂) #align star_subalgebra.topological_closure_mono StarSubalgebra.topologicalClosure_mono theorem topologicalClosure_map_le [StarModule R B] [TopologicalSemiring B] [ContinuousStar B] (s : StarSubalgebra R A) (φ : A →⋆ₐ[R] B) (hφ : IsClosedMap φ) : (map φ s).topologicalClosure ≤ map φ s.topologicalClosure := hφ.closure_image_subset _ theorem map_topologicalClosure_le [StarModule R B] [TopologicalSemiring B] [ContinuousStar B] (s : StarSubalgebra R A) (φ : A →⋆ₐ[R] B) (hφ : Continuous φ) : map φ s.topologicalClosure ≤ (map φ s).topologicalClosure := image_closure_subset_closure_image hφ theorem topologicalClosure_map [StarModule R B] [TopologicalSemiring B] [ContinuousStar B] (s : StarSubalgebra R A) (φ : A →⋆ₐ[R] B) (hφ : ClosedEmbedding φ) : (map φ s).topologicalClosure = map φ s.topologicalClosure := SetLike.coe_injective <| hφ.closure_image_eq _
Mathlib/Topology/Algebra/StarSubalgebra.lean
122
127
theorem _root_.Subalgebra.topologicalClosure_star_comm (s : Subalgebra R A) : (star s).topologicalClosure = star s.topologicalClosure := by
suffices ∀ t : Subalgebra R A, (star t).topologicalClosure ≤ star t.topologicalClosure from le_antisymm (this s) (by simpa only [star_star] using Subalgebra.star_mono (this (star s))) exact fun t => (star t).topologicalClosure_minimal (Subalgebra.star_mono subset_closure) (isClosed_closure.preimage continuous_star)
[ " Subtype.val ⁻¹' ↑S₁ = range ⇑(inclusion h)", " ↑S₁ = id '' {x | x ∈ S₁}", " ↑S₁ = {x | x ∈ S₁}", " ∀ x ∈ S₁, id x ∈ S₂", " id x✝ ∈ S₂", " (star s).topologicalClosure = star s.topologicalClosure", " star s.topologicalClosure ≤ (star s).topologicalClosure", " ∀ (t : Subalgebra R A), (star t).topologic...
[ " Subtype.val ⁻¹' ↑S₁ = range ⇑(inclusion h)", " ↑S₁ = id '' {x | x ∈ S₁}", " ↑S₁ = {x | x ∈ S₁}", " ∀ x ∈ S₁, id x ∈ S₂", " id x✝ ∈ S₂" ]
import Mathlib.Algebra.GCDMonoid.Basic import Mathlib.Data.Multiset.FinsetOps import Mathlib.Data.Multiset.Fold #align_import algebra.gcd_monoid.multiset from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" namespace Multiset variable {α : Type*} [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] section lcm def lcm (s : Multiset α) : α := s.fold GCDMonoid.lcm 1 #align multiset.lcm Multiset.lcm @[simp] theorem lcm_zero : (0 : Multiset α).lcm = 1 := fold_zero _ _ #align multiset.lcm_zero Multiset.lcm_zero @[simp] theorem lcm_cons (a : α) (s : Multiset α) : (a ::ₘ s).lcm = GCDMonoid.lcm a s.lcm := fold_cons_left _ _ _ _ #align multiset.lcm_cons Multiset.lcm_cons @[simp] theorem lcm_singleton {a : α} : ({a} : Multiset α).lcm = normalize a := (fold_singleton _ _ _).trans <| lcm_one_right _ #align multiset.lcm_singleton Multiset.lcm_singleton @[simp] theorem lcm_add (s₁ s₂ : Multiset α) : (s₁ + s₂).lcm = GCDMonoid.lcm s₁.lcm s₂.lcm := Eq.trans (by simp [lcm]) (fold_add _ _ _ _ _) #align multiset.lcm_add Multiset.lcm_add theorem lcm_dvd {s : Multiset α} {a : α} : s.lcm ∣ a ↔ ∀ b ∈ s, b ∣ a := Multiset.induction_on s (by simp) (by simp (config := { contextual := true }) [or_imp, forall_and, lcm_dvd_iff]) #align multiset.lcm_dvd Multiset.lcm_dvd theorem dvd_lcm {s : Multiset α} {a : α} (h : a ∈ s) : a ∣ s.lcm := lcm_dvd.1 dvd_rfl _ h #align multiset.dvd_lcm Multiset.dvd_lcm theorem lcm_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₁.lcm ∣ s₂.lcm := lcm_dvd.2 fun _ hb ↦ dvd_lcm (h hb) #align multiset.lcm_mono Multiset.lcm_mono @[simp 1100] theorem normalize_lcm (s : Multiset α) : normalize s.lcm = s.lcm := Multiset.induction_on s (by simp) fun a s _ ↦ by simp #align multiset.normalize_lcm Multiset.normalize_lcm @[simp] nonrec theorem lcm_eq_zero_iff [Nontrivial α] (s : Multiset α) : s.lcm = 0 ↔ (0 : α) ∈ s := by induction' s using Multiset.induction_on with a s ihs · simp only [lcm_zero, one_ne_zero, not_mem_zero] · simp only [mem_cons, lcm_cons, lcm_eq_zero_iff, ihs, @eq_comm _ a] #align multiset.lcm_eq_zero_iff Multiset.lcm_eq_zero_iff variable [DecidableEq α] @[simp] theorem lcm_dedup (s : Multiset α) : (dedup s).lcm = s.lcm := Multiset.induction_on s (by simp) fun a s IH ↦ by by_cases h : a ∈ s <;> simp [IH, h] unfold lcm rw [← cons_erase h, fold_cons_left, ← lcm_assoc, lcm_same] apply lcm_eq_of_associated_left (associated_normalize _) #align multiset.lcm_dedup Multiset.lcm_dedup @[simp]
Mathlib/Algebra/GCDMonoid/Multiset.lean
104
106
theorem lcm_ndunion (s₁ s₂ : Multiset α) : (ndunion s₁ s₂).lcm = GCDMonoid.lcm s₁.lcm s₂.lcm := by
rw [← lcm_dedup, dedup_ext.2, lcm_dedup, lcm_add] simp
[ " (s₁ + s₂).lcm = fold GCDMonoid.lcm (GCDMonoid.lcm 1 1) (s₁ + s₂)", " lcm 0 ∣ a ↔ ∀ b ∈ 0, b ∣ a", " ∀ (a_1 : α) (s : Multiset α), (s.lcm ∣ a ↔ ∀ b ∈ s, b ∣ a) → ((a_1 ::ₘ s).lcm ∣ a ↔ ∀ b ∈ a_1 ::ₘ s, b ∣ a)", " normalize (lcm 0) = lcm 0", " normalize (a ::ₘ s).lcm = (a ::ₘ s).lcm", " s.lcm = 0 ↔ 0 ∈ s"...
[ " (s₁ + s₂).lcm = fold GCDMonoid.lcm (GCDMonoid.lcm 1 1) (s₁ + s₂)", " lcm 0 ∣ a ↔ ∀ b ∈ 0, b ∣ a", " ∀ (a_1 : α) (s : Multiset α), (s.lcm ∣ a ↔ ∀ b ∈ s, b ∣ a) → ((a_1 ::ₘ s).lcm ∣ a ↔ ∀ b ∈ a_1 ::ₘ s, b ∣ a)", " normalize (lcm 0) = lcm 0", " normalize (a ::ₘ s).lcm = (a ::ₘ s).lcm", " s.lcm = 0 ↔ 0 ∈ s"...
import Mathlib.Algebra.CharP.Basic import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.RingTheory.Coprime.Lemmas #align_import algebra.char_p.char_and_card from "leanprover-community/mathlib"@"2fae5fd7f90711febdadf19c44dc60fae8834d1b" theorem isUnit_iff_not_dvd_char_of_ringChar_ne_zero (R : Type*) [CommRing R] (p : ℕ) [Fact p.Prime] (hR : ringChar R ≠ 0) : IsUnit (p : R) ↔ ¬p ∣ ringChar R := by have hch := CharP.cast_eq_zero R (ringChar R) have hp : p.Prime := Fact.out constructor · rintro h₁ ⟨q, hq⟩ rcases IsUnit.exists_left_inv h₁ with ⟨a, ha⟩ have h₃ : ¬ringChar R ∣ q := by rintro ⟨r, hr⟩ rw [hr, ← mul_assoc, mul_comm p, mul_assoc] at hq nth_rw 1 [← mul_one (ringChar R)] at hq exact Nat.Prime.not_dvd_one hp ⟨r, mul_left_cancel₀ hR hq⟩ have h₄ := mt (CharP.intCast_eq_zero_iff R (ringChar R) q).mp apply_fun ((↑) : ℕ → R) at hq apply_fun (· * ·) a at hq rw [Nat.cast_mul, hch, mul_zero, ← mul_assoc, ha, one_mul] at hq norm_cast at h₄ exact h₄ h₃ hq.symm · intro h rcases (hp.coprime_iff_not_dvd.mpr h).isCoprime with ⟨a, b, hab⟩ apply_fun ((↑) : ℤ → R) at hab push_cast at hab rw [hch, mul_zero, add_zero, mul_comm] at hab exact isUnit_of_mul_eq_one (p : R) a hab #align is_unit_iff_not_dvd_char_of_ring_char_ne_zero isUnit_iff_not_dvd_char_of_ringChar_ne_zero theorem isUnit_iff_not_dvd_char (R : Type*) [CommRing R] (p : ℕ) [Fact p.Prime] [Finite R] : IsUnit (p : R) ↔ ¬p ∣ ringChar R := isUnit_iff_not_dvd_char_of_ringChar_ne_zero R p <| CharP.char_ne_zero_of_finite R (ringChar R) #align is_unit_iff_not_dvd_char isUnit_iff_not_dvd_char
Mathlib/Algebra/CharP/CharAndCard.lean
59
75
theorem prime_dvd_char_iff_dvd_card {R : Type*} [CommRing R] [Fintype R] (p : ℕ) [Fact p.Prime] : p ∣ ringChar R ↔ p ∣ Fintype.card R := by
refine ⟨fun h => h.trans <| Int.natCast_dvd_natCast.mp <| (CharP.intCast_eq_zero_iff R (ringChar R) (Fintype.card R)).mp <| mod_cast Nat.cast_card_eq_zero R, fun h => ?_⟩ by_contra h₀ rcases exists_prime_addOrderOf_dvd_card p h with ⟨r, hr⟩ have hr₁ := addOrderOf_nsmul_eq_zero r rw [hr, nsmul_eq_mul] at hr₁ rcases IsUnit.exists_left_inv ((isUnit_iff_not_dvd_char R p).mpr h₀) with ⟨u, hu⟩ apply_fun (· * ·) u at hr₁ rw [mul_zero, ← mul_assoc, hu, one_mul] at hr₁ exact mt AddMonoid.addOrderOf_eq_one_iff.mpr (ne_of_eq_of_ne hr (Nat.Prime.ne_one Fact.out)) hr₁
[ " IsUnit ↑p ↔ ¬p ∣ ringChar R", " IsUnit ↑p → ¬p ∣ ringChar R", " False", " ¬ringChar R ∣ q", " ¬p ∣ ringChar R → IsUnit ↑p", " IsUnit ↑p", " p ∣ ringChar R ↔ p ∣ Fintype.card R", " p ∣ ringChar R" ]
[ " IsUnit ↑p ↔ ¬p ∣ ringChar R", " IsUnit ↑p → ¬p ∣ ringChar R", " False", " ¬ringChar R ∣ q", " ¬p ∣ ringChar R → IsUnit ↑p", " IsUnit ↑p" ]
import Mathlib.SetTheory.Cardinal.Finite #align_import data.set.ncard from "leanprover-community/mathlib"@"74c2af38a828107941029b03839882c5c6f87a04" namespace Set variable {α β : Type*} {s t : Set α} noncomputable def encard (s : Set α) : ℕ∞ := PartENat.withTopEquiv (PartENat.card s) @[simp] theorem encard_univ_coe (s : Set α) : encard (univ : Set s) = encard s := by rw [encard, encard, PartENat.card_congr (Equiv.Set.univ ↑s)] theorem encard_univ (α : Type*) : encard (univ : Set α) = PartENat.withTopEquiv (PartENat.card α) := by rw [encard, PartENat.card_congr (Equiv.Set.univ α)] theorem Finite.encard_eq_coe_toFinset_card (h : s.Finite) : s.encard = h.toFinset.card := by have := h.fintype rw [encard, PartENat.card_eq_coe_fintype_card, PartENat.withTopEquiv_natCast, toFinite_toFinset, toFinset_card] theorem encard_eq_coe_toFinset_card (s : Set α) [Fintype s] : encard s = s.toFinset.card := by have h := toFinite s rw [h.encard_eq_coe_toFinset_card, toFinite_toFinset] theorem encard_coe_eq_coe_finsetCard (s : Finset α) : encard (s : Set α) = s.card := by rw [Finite.encard_eq_coe_toFinset_card (Finset.finite_toSet s)]; simp theorem Infinite.encard_eq {s : Set α} (h : s.Infinite) : s.encard = ⊤ := by have := h.to_subtype rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.withTopEquiv_symm_top, PartENat.card_eq_top_of_infinite] @[simp] theorem encard_eq_zero : s.encard = 0 ↔ s = ∅ := by rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.withTopEquiv_symm_zero, PartENat.card_eq_zero_iff_empty, isEmpty_subtype, eq_empty_iff_forall_not_mem] @[simp] theorem encard_empty : (∅ : Set α).encard = 0 := by rw [encard_eq_zero] theorem nonempty_of_encard_ne_zero (h : s.encard ≠ 0) : s.Nonempty := by rwa [nonempty_iff_ne_empty, Ne, ← encard_eq_zero] theorem encard_ne_zero : s.encard ≠ 0 ↔ s.Nonempty := by rw [ne_eq, encard_eq_zero, nonempty_iff_ne_empty] @[simp] theorem encard_pos : 0 < s.encard ↔ s.Nonempty := by rw [pos_iff_ne_zero, encard_ne_zero] @[simp] theorem encard_singleton (e : α) : ({e} : Set α).encard = 1 := by rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.card_eq_coe_fintype_card, Fintype.card_ofSubsingleton, Nat.cast_one]; rfl theorem encard_union_eq (h : Disjoint s t) : (s ∪ t).encard = s.encard + t.encard := by classical have e := (Equiv.Set.union (by rwa [subset_empty_iff, ← disjoint_iff_inter_eq_empty])).symm simp [encard, ← PartENat.card_congr e, PartENat.card_sum, PartENat.withTopEquiv] theorem encard_insert_of_not_mem {a : α} (has : a ∉ s) : (insert a s).encard = s.encard + 1 := by rw [← union_singleton, encard_union_eq (by simpa), encard_singleton] theorem Finite.encard_lt_top (h : s.Finite) : s.encard < ⊤ := by refine h.induction_on (by simp) ?_ rintro a t hat _ ht' rw [encard_insert_of_not_mem hat] exact lt_tsub_iff_right.1 ht' theorem Finite.encard_eq_coe (h : s.Finite) : s.encard = ENat.toNat s.encard := (ENat.coe_toNat h.encard_lt_top.ne).symm theorem Finite.exists_encard_eq_coe (h : s.Finite) : ∃ (n : ℕ), s.encard = n := ⟨_, h.encard_eq_coe⟩ @[simp] theorem encard_lt_top_iff : s.encard < ⊤ ↔ s.Finite := ⟨fun h ↦ by_contra fun h' ↦ h.ne (Infinite.encard_eq h'), Finite.encard_lt_top⟩ @[simp] theorem encard_eq_top_iff : s.encard = ⊤ ↔ s.Infinite := by rw [← not_iff_not, ← Ne, ← lt_top_iff_ne_top, encard_lt_top_iff, not_infinite] theorem encard_ne_top_iff : s.encard ≠ ⊤ ↔ s.Finite := by simp theorem finite_of_encard_le_coe {k : ℕ} (h : s.encard ≤ k) : s.Finite := by rw [← encard_lt_top_iff]; exact h.trans_lt (WithTop.coe_lt_top _) theorem finite_of_encard_eq_coe {k : ℕ} (h : s.encard = k) : s.Finite := finite_of_encard_le_coe h.le theorem encard_le_coe_iff {k : ℕ} : s.encard ≤ k ↔ s.Finite ∧ ∃ (n₀ : ℕ), s.encard = n₀ ∧ n₀ ≤ k := ⟨fun h ↦ ⟨finite_of_encard_le_coe h, by rwa [ENat.le_coe_iff] at h⟩, fun ⟨_,⟨n₀,hs, hle⟩⟩ ↦ by rwa [hs, Nat.cast_le]⟩ section Lattice
Mathlib/Data/Set/Card.lean
152
153
theorem encard_le_card (h : s ⊆ t) : s.encard ≤ t.encard := by
rw [← union_diff_cancel h, encard_union_eq disjoint_sdiff_right]; exact le_self_add
[ " univ.encard = s.encard", " univ.encard = PartENat.withTopEquiv (PartENat.card α)", " s.encard = ↑h.toFinset.card", " s.encard = ↑s.toFinset.card", " (↑s).encard = ↑s.card", " ↑⋯.toFinset.card = ↑s.card", " s.encard = ⊤", " s.encard = 0 ↔ s = ∅", " ∅.encard = 0", " s.Nonempty", " s.encard ≠ 0 ↔...
[ " univ.encard = s.encard", " univ.encard = PartENat.withTopEquiv (PartENat.card α)", " s.encard = ↑h.toFinset.card", " s.encard = ↑s.toFinset.card", " (↑s).encard = ↑s.card", " ↑⋯.toFinset.card = ↑s.card", " s.encard = ⊤", " s.encard = 0 ↔ s = ∅", " ∅.encard = 0", " s.Nonempty", " s.encard ≠ 0 ↔...
import Mathlib.Order.Interval.Set.Disjoint import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.Basic #align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open scoped Classical open MeasureTheory Set Filter Function open scoped Classical Topology Filter ENNReal Interval NNReal variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E] def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop := IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ #align interval_integrable IntervalIntegrable section variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ} theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable] #align interval_integrable_iff intervalIntegrable_iff theorem IntervalIntegrable.def' (h : IntervalIntegrable f μ a b) : IntegrableOn f (Ι a b) μ := intervalIntegrable_iff.mp h #align interval_integrable.def IntervalIntegrable.def'
Mathlib/MeasureTheory/Integral/IntervalIntegral.lean
93
95
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a ≤ b) : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
[ " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ" ]
[ " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ" ]
import Mathlib.Init.Algebra.Classes import Mathlib.Data.FunLike.Basic import Mathlib.Logic.Embedding.Basic import Mathlib.Order.RelClasses #align_import order.rel_iso.basic from "leanprover-community/mathlib"@"f29120f82f6e24a6f6579896dfa2de6769fec962" set_option autoImplicit true open Function universe u v w variable {α β γ δ : Type*} {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} {u : δ → δ → Prop} structure RelHom {α β : Type*} (r : α → α → Prop) (s : β → β → Prop) where toFun : α → β map_rel' : ∀ {a b}, r a b → s (toFun a) (toFun b) #align rel_hom RelHom infixl:25 " →r " => RelHom section class RelHomClass (F : Type*) {α β : Type*} (r : outParam <| α → α → Prop) (s : outParam <| β → β → Prop) [FunLike F α β] : Prop where map_rel : ∀ (f : F) {a b}, r a b → s (f a) (f b) #align rel_hom_class RelHomClass export RelHomClass (map_rel) end
Mathlib/Order/RelIso/Basic.lean
168
180
theorem injective_of_increasing (r : α → α → Prop) (s : β → β → Prop) [IsTrichotomous α r] [IsIrrefl β s] (f : α → β) (hf : ∀ {x y}, r x y → s (f x) (f y)) : Injective f := by
intro x y hxy rcases trichotomous_of r x y with (h | h | h) · have := hf h rw [hxy] at this exfalso exact irrefl_of s (f y) this · exact h · have := hf h rw [hxy] at this exfalso exact irrefl_of s (f y) this
[ " Injective f", " x = y", " False" ]
[]
import Mathlib.Data.Int.Bitwise import Mathlib.Data.Int.Order.Lemmas import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.Basic #align_import data.int.lemmas from "leanprover-community/mathlib"@"09597669f02422ed388036273d8848119699c22f" open Nat namespace Int theorem le_natCast_sub (m n : ℕ) : (m - n : ℤ) ≤ ↑(m - n : ℕ) := by by_cases h : m ≥ n · exact le_of_eq (Int.ofNat_sub h).symm · simp [le_of_not_ge h, ofNat_le] #align int.le_coe_nat_sub Int.le_natCast_sub -- Porting note (#10618): simp can prove this @[simp] theorem succ_natCast_pos (n : ℕ) : 0 < (n : ℤ) + 1 := lt_add_one_iff.mpr (by simp) #align int.succ_coe_nat_pos Int.succ_natCast_pos variable {a b : ℤ} {n : ℕ} theorem natAbs_eq_iff_sq_eq {a b : ℤ} : a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2 := by rw [sq, sq] exact natAbs_eq_iff_mul_self_eq #align int.nat_abs_eq_iff_sq_eq Int.natAbs_eq_iff_sq_eq theorem natAbs_lt_iff_sq_lt {a b : ℤ} : a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2 := by rw [sq, sq] exact natAbs_lt_iff_mul_self_lt #align int.nat_abs_lt_iff_sq_lt Int.natAbs_lt_iff_sq_lt theorem natAbs_le_iff_sq_le {a b : ℤ} : a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2 := by rw [sq, sq] exact natAbs_le_iff_mul_self_le #align int.nat_abs_le_iff_sq_le Int.natAbs_le_iff_sq_le theorem natAbs_inj_of_nonneg_of_nonneg {a b : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b) : natAbs a = natAbs b ↔ a = b := by rw [← sq_eq_sq ha hb, ← natAbs_eq_iff_sq_eq] #align int.nat_abs_inj_of_nonneg_of_nonneg Int.natAbs_inj_of_nonneg_of_nonneg theorem natAbs_inj_of_nonpos_of_nonpos {a b : ℤ} (ha : a ≤ 0) (hb : b ≤ 0) : natAbs a = natAbs b ↔ a = b := by simpa only [Int.natAbs_neg, neg_inj] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) (neg_nonneg_of_nonpos hb) #align int.nat_abs_inj_of_nonpos_of_nonpos Int.natAbs_inj_of_nonpos_of_nonpos theorem natAbs_inj_of_nonneg_of_nonpos {a b : ℤ} (ha : 0 ≤ a) (hb : b ≤ 0) : natAbs a = natAbs b ↔ a = -b := by simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg ha (neg_nonneg_of_nonpos hb) #align int.nat_abs_inj_of_nonneg_of_nonpos Int.natAbs_inj_of_nonneg_of_nonpos theorem natAbs_inj_of_nonpos_of_nonneg {a b : ℤ} (ha : a ≤ 0) (hb : 0 ≤ b) : natAbs a = natAbs b ↔ -a = b := by simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) hb #align int.nat_abs_inj_of_nonpos_of_nonneg Int.natAbs_inj_of_nonpos_of_nonneg theorem natAbs_coe_sub_coe_le_of_le {a b n : ℕ} (a_le_n : a ≤ n) (b_le_n : b ≤ n) : natAbs (a - b : ℤ) ≤ n := by rw [← Nat.cast_le (α := ℤ), natCast_natAbs] exact abs_sub_le_of_nonneg_of_le (ofNat_nonneg a) (ofNat_le.mpr a_le_n) (ofNat_nonneg b) (ofNat_le.mpr b_le_n) theorem natAbs_coe_sub_coe_lt_of_lt {a b n : ℕ} (a_lt_n : a < n) (b_lt_n : b < n) : natAbs (a - b : ℤ) < n := by rw [← Nat.cast_lt (α := ℤ), natCast_natAbs] exact abs_sub_lt_of_nonneg_of_lt (ofNat_nonneg a) (ofNat_lt.mpr a_lt_n) (ofNat_nonneg b) (ofNat_lt.mpr b_lt_n) theorem toNat_of_nonpos : ∀ {z : ℤ}, z ≤ 0 → z.toNat = 0 | 0, _ => rfl | (n + 1 : ℕ), h => (h.not_lt (by simp)).elim | -[n+1], _ => rfl #align int.to_nat_of_nonpos Int.toNat_of_nonpos attribute [local simp] Int.zero_div @[simp]
Mathlib/Data/Int/Lemmas.lean
137
143
theorem div2_bit (b n) : div2 (bit b n) = n := by
rw [bit_val, div2_val, add_comm, Int.add_mul_ediv_left, (_ : (_ / 2 : ℤ) = 0), zero_add] cases b · decide · show ofNat _ = _ rw [Nat.div_eq_of_lt] <;> simp · decide
[ " ↑m - ↑n ≤ ↑(m - n)", " 0 ≤ ↑n", " a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2", " a.natAbs = b.natAbs ↔ a * a = b * b", " a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2", " a.natAbs < b.natAbs ↔ a * a < b * b", " a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2", " a.natAbs ≤ b.natAbs ↔ a * a ≤ b * b", " a.natAbs = b.natAbs ↔ a ...
[ " ↑m - ↑n ≤ ↑(m - n)", " 0 ≤ ↑n", " a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2", " a.natAbs = b.natAbs ↔ a * a = b * b", " a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2", " a.natAbs < b.natAbs ↔ a * a < b * b", " a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2", " a.natAbs ≤ b.natAbs ↔ a * a ≤ b * b", " a.natAbs = b.natAbs ↔ a ...
import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec" suppress_compilation -- Porting note: universe metavariables behave oddly universe w u v₁ v₂ v₃ v₄ variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂) (P : Type v₃) (Q : Type v₄) -- Porting note: we need high priority for this to fire first; not the case in ML3 attribute [local ext high] TensorProduct.ext section Contraction open TensorProduct LinearMap Matrix Module open TensorProduct section CommSemiring variable [CommSemiring R] variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] variable [Module R M] [Module R N] [Module R P] [Module R Q] variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M) -- Porting note: doesn't like implicit ring in the tensor product def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R := (uncurry _ _ _ _).toFun LinearMap.id #align contract_left contractLeft -- Porting note: doesn't like implicit ring in the tensor product def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R := (uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id) #align contract_right contractRight -- Porting note: doesn't like implicit ring in the tensor product def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N := let M' := Module.Dual R M (uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ #align dual_tensor_hom dualTensorHom variable {R M N P Q} @[simp] theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m := rfl #align contract_left_apply contractLeft_apply @[simp] theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m := rfl #align contract_right_apply contractRight_apply @[simp] theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) : dualTensorHom R M N (f ⊗ₜ n) m = f m • n := rfl #align dual_tensor_hom_apply dualTensorHom_apply @[simp] theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) : Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) = dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by ext f' m' simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply, LinearMap.smul_apply] exact mul_comm _ _ #align transpose_dual_tensor_hom transpose_dualTensorHom @[simp]
Mathlib/LinearAlgebra/Contraction.lean
96
101
theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) : ((dualTensorHom R M P) (f ⊗ₜ[R] p)).prodMap (0 : N →ₗ[R] Q) = dualTensorHom R (M × N) (P × Q) ((f ∘ₗ fst R M N) ⊗ₜ inl R P Q p) := by
ext <;> simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply, fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero]
[ " Dual.transpose ((dualTensorHom R M M) (f ⊗ₜ[R] m)) =\n (dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ⊗ₜ[R] f)", " ((Dual.transpose ((dualTensorHom R M M) (f ⊗ₜ[R] m))) f') m' =\n (((dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ⊗ₜ[R] f)) f') m'", " f m' * f' m = f' m * f m'", ...
[ " Dual.transpose ((dualTensorHom R M M) (f ⊗ₜ[R] m)) =\n (dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ⊗ₜ[R] f)", " ((Dual.transpose ((dualTensorHom R M M) (f ⊗ₜ[R] m))) f') m' =\n (((dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ⊗ₜ[R] f)) f') m'", " f m' * f' m = f' m * f m'" ]
import Mathlib.Algebra.Homology.ComplexShape import Mathlib.CategoryTheory.Subobject.Limits import Mathlib.CategoryTheory.GradedObject import Mathlib.Algebra.Homology.ShortComplex.Basic #align_import algebra.homology.homological_complex from "leanprover-community/mathlib"@"88bca0ce5d22ebfd9e73e682e51d60ea13b48347" universe v u open CategoryTheory CategoryTheory.Category CategoryTheory.Limits variable {ι : Type*} variable (V : Type u) [Category.{v} V] [HasZeroMorphisms V] structure HomologicalComplex (c : ComplexShape ι) where X : ι → V d : ∀ i j, X i ⟶ X j shape : ∀ i j, ¬c.Rel i j → d i j = 0 := by aesop_cat d_comp_d' : ∀ i j k, c.Rel i j → c.Rel j k → d i j ≫ d j k = 0 := by aesop_cat #align homological_complex HomologicalComplex abbrev ChainComplex (α : Type*) [AddRightCancelSemigroup α] [One α] : Type _ := HomologicalComplex V (ComplexShape.down α) #align chain_complex ChainComplex abbrev CochainComplex (α : Type*) [AddRightCancelSemigroup α] [One α] : Type _ := HomologicalComplex V (ComplexShape.up α) #align cochain_complex CochainComplex namespace HomologicalComplex variable {V} variable {c : ComplexShape ι} (C : HomologicalComplex V c) @[ext] structure Hom (A B : HomologicalComplex V c) where f : ∀ i, A.X i ⟶ B.X i comm' : ∀ i j, c.Rel i j → f i ≫ B.d i j = A.d i j ≫ f j := by aesop_cat #align homological_complex.hom HomologicalComplex.Hom @[reassoc (attr := simp)] theorem Hom.comm {A B : HomologicalComplex V c} (f : A.Hom B) (i j : ι) : f.f i ≫ B.d i j = A.d i j ≫ f.f j := by by_cases hij : c.Rel i j · exact f.comm' i j hij · rw [A.shape i j hij, B.shape i j hij, comp_zero, zero_comp] #align homological_complex.hom.comm HomologicalComplex.Hom.comm instance (A B : HomologicalComplex V c) : Inhabited (Hom A B) := ⟨{ f := fun i => 0 }⟩ def id (A : HomologicalComplex V c) : Hom A A where f _ := 𝟙 _ #align homological_complex.id HomologicalComplex.id def comp (A B C : HomologicalComplex V c) (φ : Hom A B) (ψ : Hom B C) : Hom A C where f i := φ.f i ≫ ψ.f i #align homological_complex.comp HomologicalComplex.comp section attribute [local simp] id comp instance : Category (HomologicalComplex V c) where Hom := Hom id := id comp := comp _ _ _ end -- Porting note: added because `Hom.ext` is not triggered automatically @[ext] lemma hom_ext {C D : HomologicalComplex V c} (f g : C ⟶ D) (h : ∀ i, f.f i = g.f i) : f = g := by apply Hom.ext funext apply h @[simp] theorem id_f (C : HomologicalComplex V c) (i : ι) : Hom.f (𝟙 C) i = 𝟙 (C.X i) := rfl #align homological_complex.id_f HomologicalComplex.id_f @[simp, reassoc] theorem comp_f {C₁ C₂ C₃ : HomologicalComplex V c} (f : C₁ ⟶ C₂) (g : C₂ ⟶ C₃) (i : ι) : (f ≫ g).f i = f.f i ≫ g.f i := rfl #align homological_complex.comp_f HomologicalComplex.comp_f @[simp] theorem eqToHom_f {C₁ C₂ : HomologicalComplex V c} (h : C₁ = C₂) (n : ι) : HomologicalComplex.Hom.f (eqToHom h) n = eqToHom (congr_fun (congr_arg HomologicalComplex.X h) n) := by subst h rfl #align homological_complex.eq_to_hom_f HomologicalComplex.eqToHom_f -- We'll use this later to show that `HomologicalComplex V c` is preadditive when `V` is.
Mathlib/Algebra/Homology/HomologicalComplex.lean
294
295
theorem hom_f_injective {C₁ C₂ : HomologicalComplex V c} : Function.Injective fun f : Hom C₁ C₂ => f.f := by
aesop_cat
[ " f.f i ≫ B.d i j = A.d i j ≫ f.f j", " f = g", " f.f = g.f", " f.f x✝ = g.f x✝", " (eqToHom h).f n = eqToHom ⋯", " (eqToHom ⋯).f n = eqToHom ⋯", " Function.Injective fun f => f.f" ]
[ " f.f i ≫ B.d i j = A.d i j ≫ f.f j", " f = g", " f.f = g.f", " f.f x✝ = g.f x✝", " (eqToHom h).f n = eqToHom ⋯", " (eqToHom ⋯).f n = eqToHom ⋯" ]
import Mathlib.Data.Fin.Tuple.Basic import Mathlib.Data.List.Join #align_import data.list.of_fn from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b" universe u variable {α : Type u} open Nat namespace List #noalign list.length_of_fn_aux @[simp] theorem length_ofFn_go {n} (f : Fin n → α) (i j h) : length (ofFn.go f i j h) = i := by induction i generalizing j <;> simp_all [ofFn.go] @[simp] theorem length_ofFn {n} (f : Fin n → α) : length (ofFn f) = n := by simp [ofFn, length_ofFn_go] #align list.length_of_fn List.length_ofFn #noalign list.nth_of_fn_aux theorem get_ofFn_go {n} (f : Fin n → α) (i j h) (k) (hk) : get (ofFn.go f i j h) ⟨k, hk⟩ = f ⟨j + k, by simp at hk; omega⟩ := by let i+1 := i cases k <;> simp [ofFn.go, get_ofFn_go (i := i)] congr 2; omega -- Porting note (#10756): new theorem @[simp]
Mathlib/Data/List/OfFn.lean
58
59
theorem get_ofFn {n} (f : Fin n → α) (i) : get (ofFn f) i = f (Fin.cast (by simp) i) := by
cases i; simp [ofFn, get_ofFn_go]
[ " (ofFn.go f i j h).length = i", " (ofFn.go f 0 j h).length = 0", " (ofFn.go f (n✝ + 1) j h).length = n✝ + 1", " (ofFn f).length = n", " j + k < n", " (ofFn.go f i j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨0, hk⟩ = f ⟨j + 0,...
[ " (ofFn.go f i j h).length = i", " (ofFn.go f 0 j h).length = 0", " (ofFn.go f (n✝ + 1) j h).length = n✝ + 1", " (ofFn f).length = n", " j + k < n", " (ofFn.go f i j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨0, hk⟩ = f ⟨j + 0,...
import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.LinearAlgebra.Dimension.Constructions open Cardinal Submodule Set FiniteDimensional universe u v section Module variable {K : Type u} {V : Type v} [Ring K] [StrongRankCondition K] [AddCommGroup V] [Module K V] noncomputable def Basis.ofRankEqZero [Module.Free K V] {ι : Type*} [IsEmpty ι] (hV : Module.rank K V = 0) : Basis ι K V := haveI : Subsingleton V := by obtain ⟨_, b⟩ := Module.Free.exists_basis (R := K) (M := V) haveI := mk_eq_zero_iff.1 (hV ▸ b.mk_eq_rank'') exact b.repr.toEquiv.subsingleton Basis.empty _ #align basis.of_rank_eq_zero Basis.ofRankEqZero @[simp] theorem Basis.ofRankEqZero_apply [Module.Free K V] {ι : Type*} [IsEmpty ι] (hV : Module.rank K V = 0) (i : ι) : Basis.ofRankEqZero hV i = 0 := rfl #align basis.of_rank_eq_zero_apply Basis.ofRankEqZero_apply theorem le_rank_iff_exists_linearIndependent [Module.Free K V] {c : Cardinal} : c ≤ Module.rank K V ↔ ∃ s : Set V, #s = c ∧ LinearIndependent K ((↑) : s → V) := by haveI := nontrivial_of_invariantBasisNumber K constructor · intro h obtain ⟨κ, t'⟩ := Module.Free.exists_basis (R := K) (M := V) let t := t'.reindexRange have : LinearIndependent K ((↑) : Set.range t' → V) := by convert t.linearIndependent ext; exact (Basis.reindexRange_apply _ _).symm rw [← t.mk_eq_rank'', le_mk_iff_exists_subset] at h rcases h with ⟨s, hst, hsc⟩ exact ⟨s, hsc, this.mono hst⟩ · rintro ⟨s, rfl, si⟩ exact si.cardinal_le_rank #align le_rank_iff_exists_linear_independent le_rank_iff_exists_linearIndependent
Mathlib/LinearAlgebra/Dimension/FreeAndStrongRankCondition.lean
63
71
theorem le_rank_iff_exists_linearIndependent_finset [Module.Free K V] {n : ℕ} : ↑n ≤ Module.rank K V ↔ ∃ s : Finset V, s.card = n ∧ LinearIndependent K ((↑) : ↥(s : Set V) → V) := by
simp only [le_rank_iff_exists_linearIndependent, mk_set_eq_nat_iff_finset] constructor · rintro ⟨s, ⟨t, rfl, rfl⟩, si⟩ exact ⟨t, rfl, si⟩ · rintro ⟨s, rfl, si⟩ exact ⟨s, ⟨s, rfl, rfl⟩, si⟩
[ " Subsingleton V", " c ≤ Module.rank K V ↔ ∃ s, #↑s = c ∧ LinearIndependent (ι := { x // x ∈ s }) K Subtype.val", " c ≤ Module.rank K V → ∃ s, #↑s = c ∧ LinearIndependent (ι := { x // x ∈ s }) K Subtype.val", " ∃ s, #↑s = c ∧ LinearIndependent (ι := { x // x ∈ s }) K Subtype.val", " LinearIndependent (ι := ...
[ " Subsingleton V", " c ≤ Module.rank K V ↔ ∃ s, #↑s = c ∧ LinearIndependent (ι := { x // x ∈ s }) K Subtype.val", " c ≤ Module.rank K V → ∃ s, #↑s = c ∧ LinearIndependent (ι := { x // x ∈ s }) K Subtype.val", " ∃ s, #↑s = c ∧ LinearIndependent (ι := { x // x ∈ s }) K Subtype.val", " LinearIndependent (ι := ...
import Mathlib.Analysis.NormedSpace.PiLp import Mathlib.Analysis.InnerProductSpace.PiL2 #align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped NNReal Matrix namespace Matrix variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n] section LinfLinf protected def normedAddCommGroup [NormedAddCommGroup α] : NormedAddCommGroup (Matrix m n α) := Pi.normedAddCommGroup #align matrix.normed_add_comm_group Matrix.normedAddCommGroup section LinftyOp @[local instance] protected def linftyOpSeminormedAddCommGroup [SeminormedAddCommGroup α] : SeminormedAddCommGroup (Matrix m n α) := (by infer_instance : SeminormedAddCommGroup (m → PiLp 1 fun j : n => α)) #align matrix.linfty_op_seminormed_add_comm_group Matrix.linftyOpSeminormedAddCommGroup @[local instance] protected def linftyOpNormedAddCommGroup [NormedAddCommGroup α] : NormedAddCommGroup (Matrix m n α) := (by infer_instance : NormedAddCommGroup (m → PiLp 1 fun j : n => α)) #align matrix.linfty_op_normed_add_comm_group Matrix.linftyOpNormedAddCommGroup @[local instance] protected theorem linftyOpBoundedSMul [SeminormedRing R] [SeminormedAddCommGroup α] [Module R α] [BoundedSMul R α] : BoundedSMul R (Matrix m n α) := (by infer_instance : BoundedSMul R (m → PiLp 1 fun j : n => α)) @[local instance] protected def linftyOpNormedSpace [NormedField R] [SeminormedAddCommGroup α] [NormedSpace R α] : NormedSpace R (Matrix m n α) := (by infer_instance : NormedSpace R (m → PiLp 1 fun j : n => α)) #align matrix.linfty_op_normed_space Matrix.linftyOpNormedSpace section SeminormedAddCommGroup variable [SeminormedAddCommGroup α] theorem linfty_opNorm_def (A : Matrix m n α) : ‖A‖ = ((Finset.univ : Finset m).sup fun i : m => ∑ j : n, ‖A i j‖₊ : ℝ≥0) := by -- Porting note: added change ‖fun i => (WithLp.equiv 1 _).symm (A i)‖ = _ simp [Pi.norm_def, PiLp.nnnorm_eq_sum ENNReal.one_ne_top] #align matrix.linfty_op_norm_def Matrix.linfty_opNorm_def @[deprecated (since := "2024-02-02")] alias linfty_op_norm_def := linfty_opNorm_def theorem linfty_opNNNorm_def (A : Matrix m n α) : ‖A‖₊ = (Finset.univ : Finset m).sup fun i : m => ∑ j : n, ‖A i j‖₊ := Subtype.ext <| linfty_opNorm_def A #align matrix.linfty_op_nnnorm_def Matrix.linfty_opNNNorm_def @[deprecated (since := "2024-02-02")] alias linfty_op_nnnorm_def := linfty_opNNNorm_def @[simp, nolint simpNF] -- Porting note: linter times out theorem linfty_opNNNorm_col (v : m → α) : ‖col v‖₊ = ‖v‖₊ := by rw [linfty_opNNNorm_def, Pi.nnnorm_def] simp #align matrix.linfty_op_nnnorm_col Matrix.linfty_opNNNorm_col @[deprecated (since := "2024-02-02")] alias linfty_op_nnnorm_col := linfty_opNNNorm_col @[simp] theorem linfty_opNorm_col (v : m → α) : ‖col v‖ = ‖v‖ := congr_arg ((↑) : ℝ≥0 → ℝ) <| linfty_opNNNorm_col v #align matrix.linfty_op_norm_col Matrix.linfty_opNorm_col @[deprecated (since := "2024-02-02")] alias linfty_op_norm_col := linfty_opNorm_col @[simp] theorem linfty_opNNNorm_row (v : n → α) : ‖row v‖₊ = ∑ i, ‖v i‖₊ := by simp [linfty_opNNNorm_def] #align matrix.linfty_op_nnnorm_row Matrix.linfty_opNNNorm_row @[deprecated (since := "2024-02-02")] alias linfty_op_nnnorm_row := linfty_opNNNorm_row @[simp] theorem linfty_opNorm_row (v : n → α) : ‖row v‖ = ∑ i, ‖v i‖ := (congr_arg ((↑) : ℝ≥0 → ℝ) <| linfty_opNNNorm_row v).trans <| by simp [NNReal.coe_sum] #align matrix.linfty_op_norm_row Matrix.linfty_opNorm_row @[deprecated (since := "2024-02-02")] alias linfty_op_norm_row := linfty_opNorm_row @[simp]
Mathlib/Analysis/Matrix.lean
318
323
theorem linfty_opNNNorm_diagonal [DecidableEq m] (v : m → α) : ‖diagonal v‖₊ = ‖v‖₊ := by
rw [linfty_opNNNorm_def, Pi.nnnorm_def] congr 1 with i : 1 refine (Finset.sum_eq_single_of_mem _ (Finset.mem_univ i) fun j _hj hij => ?_).trans ?_ · rw [diagonal_apply_ne' _ hij, nnnorm_zero] · rw [diagonal_apply_eq]
[ " SeminormedAddCommGroup (m → PiLp 1 fun j => α)", " NormedAddCommGroup (m → PiLp 1 fun j => α)", " BoundedSMul R (m → PiLp 1 fun j => α)", " NormedSpace R (m → PiLp 1 fun j => α)", " ‖A‖ = ↑(Finset.univ.sup fun i => ∑ j : n, ‖A i j‖₊)", " ‖fun i => (WithLp.equiv 1 (n → α)).symm (A i)‖ = ↑(Finset.univ.sup...
[ " SeminormedAddCommGroup (m → PiLp 1 fun j => α)", " NormedAddCommGroup (m → PiLp 1 fun j => α)", " BoundedSMul R (m → PiLp 1 fun j => α)", " NormedSpace R (m → PiLp 1 fun j => α)", " ‖A‖ = ↑(Finset.univ.sup fun i => ∑ j : n, ‖A i j‖₊)", " ‖fun i => (WithLp.equiv 1 (n → α)).symm (A i)‖ = ↑(Finset.univ.sup...
import Mathlib.Topology.Separation import Mathlib.Topology.NoetherianSpace #align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" open TopologicalSpace variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β} def IsQuasiSeparated (s : Set α) : Prop := ∀ U V : Set α, U ⊆ s → IsOpen U → IsCompact U → V ⊆ s → IsOpen V → IsCompact V → IsCompact (U ∩ V) #align is_quasi_separated IsQuasiSeparated @[mk_iff] class QuasiSeparatedSpace (α : Type*) [TopologicalSpace α] : Prop where inter_isCompact : ∀ U V : Set α, IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V) #align quasi_separated_space QuasiSeparatedSpace theorem isQuasiSeparated_univ_iff {α : Type*} [TopologicalSpace α] : IsQuasiSeparated (Set.univ : Set α) ↔ QuasiSeparatedSpace α := by rw [quasiSeparatedSpace_iff] simp [IsQuasiSeparated] #align is_quasi_separated_univ_iff isQuasiSeparated_univ_iff theorem isQuasiSeparated_univ {α : Type*} [TopologicalSpace α] [QuasiSeparatedSpace α] : IsQuasiSeparated (Set.univ : Set α) := isQuasiSeparated_univ_iff.mpr inferInstance #align is_quasi_separated_univ isQuasiSeparated_univ theorem IsQuasiSeparated.image_of_embedding {s : Set α} (H : IsQuasiSeparated s) (h : Embedding f) : IsQuasiSeparated (f '' s) := by intro U V hU hU' hU'' hV hV' hV'' convert (H (f ⁻¹' U) (f ⁻¹' V) ?_ (h.continuous.1 _ hU') ?_ ?_ (h.continuous.1 _ hV') ?_).image h.continuous · symm rw [← Set.preimage_inter, Set.image_preimage_eq_inter_range, Set.inter_eq_left] exact Set.inter_subset_left.trans (hU.trans (Set.image_subset_range _ _)) · intro x hx rw [← h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial] exact hU hx · rw [h.isCompact_iff] convert hU'' rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left] exact hU.trans (Set.image_subset_range _ _) · intro x hx rw [← h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial] exact hV hx · rw [h.isCompact_iff] convert hV'' rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left] exact hV.trans (Set.image_subset_range _ _) #align is_quasi_separated.image_of_embedding IsQuasiSeparated.image_of_embedding theorem OpenEmbedding.isQuasiSeparated_iff (h : OpenEmbedding f) {s : Set α} : IsQuasiSeparated s ↔ IsQuasiSeparated (f '' s) := by refine ⟨fun hs => hs.image_of_embedding h.toEmbedding, ?_⟩ intro H U V hU hU' hU'' hV hV' hV'' rw [h.toEmbedding.isCompact_iff, Set.image_inter h.inj] exact H (f '' U) (f '' V) (Set.image_subset _ hU) (h.isOpenMap _ hU') (hU''.image h.continuous) (Set.image_subset _ hV) (h.isOpenMap _ hV') (hV''.image h.continuous) #align open_embedding.is_quasi_separated_iff OpenEmbedding.isQuasiSeparated_iff theorem isQuasiSeparated_iff_quasiSeparatedSpace (s : Set α) (hs : IsOpen s) : IsQuasiSeparated s ↔ QuasiSeparatedSpace s := by rw [← isQuasiSeparated_univ_iff] convert (hs.openEmbedding_subtype_val.isQuasiSeparated_iff (s := Set.univ)).symm simp #align is_quasi_separated_iff_quasi_separated_space isQuasiSeparated_iff_quasiSeparatedSpace
Mathlib/Topology/QuasiSeparated.lean
106
109
theorem IsQuasiSeparated.of_subset {s t : Set α} (ht : IsQuasiSeparated t) (h : s ⊆ t) : IsQuasiSeparated s := by
intro U V hU hU' hU'' hV hV' hV'' exact ht U V (hU.trans h) hU' hU'' (hV.trans h) hV' hV''
[ " IsQuasiSeparated Set.univ ↔ QuasiSeparatedSpace α", " IsQuasiSeparated Set.univ ↔ ∀ (U V : Set α), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)", " IsQuasiSeparated (f '' s)", " IsCompact (U ∩ V)", " U ∩ V = f '' (f ⁻¹' U ∩ f ⁻¹' V)", " f '' (f ⁻¹' U ∩ f ⁻¹' V) = U ∩ V", " U ∩ V...
[ " IsQuasiSeparated Set.univ ↔ QuasiSeparatedSpace α", " IsQuasiSeparated Set.univ ↔ ∀ (U V : Set α), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)", " IsQuasiSeparated (f '' s)", " IsCompact (U ∩ V)", " U ∩ V = f '' (f ⁻¹' U ∩ f ⁻¹' V)", " f '' (f ⁻¹' U ∩ f ⁻¹' V) = U ∩ V", " U ∩ V...
import Mathlib.Data.Finset.Fold import Mathlib.Algebra.GCDMonoid.Multiset #align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" #align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d" variable {ι α β γ : Type*} namespace Finset open Multiset variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] section gcd def gcd (s : Finset β) (f : β → α) : α := s.fold GCDMonoid.gcd 0 f #align finset.gcd Finset.gcd variable {s s₁ s₂ : Finset β} {f : β → α} theorem gcd_def : s.gcd f = (s.1.map f).gcd := rfl #align finset.gcd_def Finset.gcd_def @[simp] theorem gcd_empty : (∅ : Finset β).gcd f = 0 := fold_empty #align finset.gcd_empty Finset.gcd_empty theorem dvd_gcd_iff {a : α} : a ∣ s.gcd f ↔ ∀ b ∈ s, a ∣ f b := by apply Iff.trans Multiset.dvd_gcd simp only [Multiset.mem_map, and_imp, exists_imp] exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩ #align finset.dvd_gcd_iff Finset.dvd_gcd_iff theorem gcd_dvd {b : β} (hb : b ∈ s) : s.gcd f ∣ f b := dvd_gcd_iff.1 dvd_rfl _ hb #align finset.gcd_dvd Finset.gcd_dvd theorem dvd_gcd {a : α} : (∀ b ∈ s, a ∣ f b) → a ∣ s.gcd f := dvd_gcd_iff.2 #align finset.dvd_gcd Finset.dvd_gcd @[simp]
Mathlib/Algebra/GCDMonoid/Finset.lean
166
171
theorem gcd_insert [DecidableEq β] {b : β} : (insert b s : Finset β).gcd f = GCDMonoid.gcd (f b) (s.gcd f) := by
by_cases h : b ∈ s · rw [insert_eq_of_mem h, (gcd_eq_right_iff (f b) (s.gcd f) (Multiset.normalize_gcd (s.1.map f))).2 (gcd_dvd h)] apply fold_insert h
[ " a ∣ s.gcd f ↔ ∀ b ∈ s, a ∣ f b", " (∀ b ∈ Multiset.map f s.val, a ∣ b) ↔ ∀ b ∈ s, a ∣ f b", " (∀ (b : α), ∀ x ∈ s.val, f x = b → a ∣ b) ↔ ∀ b ∈ s, a ∣ f b", " (insert b s).gcd f = GCDMonoid.gcd (f b) (s.gcd f)" ]
[ " a ∣ s.gcd f ↔ ∀ b ∈ s, a ∣ f b", " (∀ b ∈ Multiset.map f s.val, a ∣ b) ↔ ∀ b ∈ s, a ∣ f b", " (∀ (b : α), ∀ x ∈ s.val, f x = b → a ∣ b) ↔ ∀ b ∈ s, a ∣ f b" ]
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Data.Setoid.Basic import Mathlib.Dynamics.FixedPoints.Topology import Mathlib.Topology.MetricSpace.Lipschitz #align_import topology.metric_space.contracting from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open scoped Classical open NNReal Topology ENNReal Filter Function variable {α : Type*} def ContractingWith [EMetricSpace α] (K : ℝ≥0) (f : α → α) := K < 1 ∧ LipschitzWith K f #align contracting_with ContractingWith namespace ContractingWith variable [EMetricSpace α] [cs : CompleteSpace α] {K : ℝ≥0} {f : α → α} open EMetric Set theorem toLipschitzWith (hf : ContractingWith K f) : LipschitzWith K f := hf.2 #align contracting_with.to_lipschitz_with ContractingWith.toLipschitzWith theorem one_sub_K_pos' (hf : ContractingWith K f) : (0 : ℝ≥0∞) < 1 - K := by simp [hf.1] set_option linter.uppercaseLean3 false in #align contracting_with.one_sub_K_pos' ContractingWith.one_sub_K_pos' theorem one_sub_K_ne_zero (hf : ContractingWith K f) : (1 : ℝ≥0∞) - K ≠ 0 := ne_of_gt hf.one_sub_K_pos' set_option linter.uppercaseLean3 false in #align contracting_with.one_sub_K_ne_zero ContractingWith.one_sub_K_ne_zero theorem one_sub_K_ne_top : (1 : ℝ≥0∞) - K ≠ ∞ := by norm_cast exact ENNReal.coe_ne_top set_option linter.uppercaseLean3 false in #align contracting_with.one_sub_K_ne_top ContractingWith.one_sub_K_ne_top theorem edist_inequality (hf : ContractingWith K f) {x y} (h : edist x y ≠ ∞) : edist x y ≤ (edist x (f x) + edist y (f y)) / (1 - K) := suffices edist x y ≤ edist x (f x) + edist y (f y) + K * edist x y by rwa [ENNReal.le_div_iff_mul_le (Or.inl hf.one_sub_K_ne_zero) (Or.inl one_sub_K_ne_top), mul_comm, ENNReal.sub_mul fun _ _ ↦ h, one_mul, tsub_le_iff_right] calc edist x y ≤ edist x (f x) + edist (f x) (f y) + edist (f y) y := edist_triangle4 _ _ _ _ _ = edist x (f x) + edist y (f y) + edist (f x) (f y) := by rw [edist_comm y, add_right_comm] _ ≤ edist x (f x) + edist y (f y) + K * edist x y := add_le_add le_rfl (hf.2 _ _) #align contracting_with.edist_inequality ContractingWith.edist_inequality theorem edist_le_of_fixedPoint (hf : ContractingWith K f) {x y} (h : edist x y ≠ ∞) (hy : IsFixedPt f y) : edist x y ≤ edist x (f x) / (1 - K) := by simpa only [hy.eq, edist_self, add_zero] using hf.edist_inequality h #align contracting_with.edist_le_of_fixed_point ContractingWith.edist_le_of_fixedPoint
Mathlib/Topology/MetricSpace/Contracting.lean
84
87
theorem eq_or_edist_eq_top_of_fixedPoints (hf : ContractingWith K f) {x y} (hx : IsFixedPt f x) (hy : IsFixedPt f y) : x = y ∨ edist x y = ∞ := by
refine or_iff_not_imp_right.2 fun h ↦ edist_le_zero.1 ?_ simpa only [hx.eq, edist_self, add_zero, ENNReal.zero_div] using hf.edist_le_of_fixedPoint h hy
[ " 0 < 1 - ↑K", " 1 - ↑K ≠ ⊤", " ¬1 - ↑K = ⊤", " edist x (f x) + edist (f x) (f y) + edist (f y) y = edist x (f x) + edist y (f y) + edist (f x) (f y)", " edist x y ≤ (edist x (f x) + edist y (f y)) / (1 - ↑K)", " edist x y ≤ edist x (f x) / (1 - ↑K)", " x = y ∨ edist x y = ⊤", " edist x y ≤ 0" ]
[ " 0 < 1 - ↑K", " 1 - ↑K ≠ ⊤", " ¬1 - ↑K = ⊤", " edist x (f x) + edist (f x) (f y) + edist (f y) y = edist x (f x) + edist y (f y) + edist (f x) (f y)", " edist x y ≤ (edist x (f x) + edist y (f y)) / (1 - ↑K)", " edist x y ≤ edist x (f x) / (1 - ↑K)" ]
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
Mathlib/Analysis/NormedSpace/ConformalLinearMap.lean
62
65
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 _ _ _⟩
[ " ContinuousLinearMap.id R M = 1 • LinearIsometry.id.toContinuousLinearMap", " IsConformalMap (c • f)", " IsConformalMap (c • c' • li.toContinuousLinearMap)" ]
[ " ContinuousLinearMap.id R M = 1 • LinearIsometry.id.toContinuousLinearMap" ]
import Mathlib.Probability.ConditionalProbability import Mathlib.MeasureTheory.Measure.Count #align_import probability.cond_count from "leanprover-community/mathlib"@"117e93f82b5f959f8193857370109935291f0cc4" noncomputable section open ProbabilityTheory open MeasureTheory MeasurableSpace namespace ProbabilityTheory variable {Ω : Type*} [MeasurableSpace Ω] def condCount (s : Set Ω) : Measure Ω := Measure.count[|s] #align probability_theory.cond_count ProbabilityTheory.condCount @[simp] theorem condCount_empty_meas : (condCount ∅ : Measure Ω) = 0 := by simp [condCount] #align probability_theory.cond_count_empty_meas ProbabilityTheory.condCount_empty_meas theorem condCount_empty {s : Set Ω} : condCount s ∅ = 0 := by simp #align probability_theory.cond_count_empty ProbabilityTheory.condCount_empty theorem finite_of_condCount_ne_zero {s t : Set Ω} (h : condCount s t ≠ 0) : s.Finite := by by_contra hs' simp [condCount, cond, Measure.count_apply_infinite hs'] at h #align probability_theory.finite_of_cond_count_ne_zero ProbabilityTheory.finite_of_condCount_ne_zero theorem condCount_univ [Fintype Ω] {s : Set Ω} : condCount Set.univ s = Measure.count s / Fintype.card Ω := by rw [condCount, cond_apply _ MeasurableSet.univ, ← ENNReal.div_eq_inv_mul, Set.univ_inter] congr rw [← Finset.coe_univ, Measure.count_apply, Finset.univ.tsum_subtype' fun _ => (1 : ENNReal)] · simp [Finset.card_univ] · exact (@Finset.coe_univ Ω _).symm ▸ MeasurableSet.univ #align probability_theory.cond_count_univ ProbabilityTheory.condCount_univ variable [MeasurableSingletonClass Ω] theorem condCount_isProbabilityMeasure {s : Set Ω} (hs : s.Finite) (hs' : s.Nonempty) : IsProbabilityMeasure (condCount s) := { measure_univ := by rw [condCount, cond_apply _ hs.measurableSet, Set.inter_univ, ENNReal.inv_mul_cancel] · exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h · exact (Measure.count_apply_lt_top.2 hs).ne } #align probability_theory.cond_count_is_probability_measure ProbabilityTheory.condCount_isProbabilityMeasure
Mathlib/Probability/CondCount.lean
89
95
theorem condCount_singleton (ω : Ω) (t : Set Ω) [Decidable (ω ∈ t)] : condCount {ω} t = if ω ∈ t then 1 else 0 := by
rw [condCount, cond_apply _ (measurableSet_singleton ω), Measure.count_singleton, inv_one, one_mul] split_ifs · rw [(by simpa : ({ω} : Set Ω) ∩ t = {ω}), Measure.count_singleton] · rw [(by simpa : ({ω} : Set Ω) ∩ t = ∅), Measure.count_empty]
[ " condCount ∅ = 0", " (condCount s) ∅ = 0", " s.Finite", " False", " (condCount Set.univ) s = Measure.count s / ↑(Fintype.card Ω)", " Measure.count s / Measure.count Set.univ = Measure.count s / ↑(Fintype.card Ω)", " Measure.count Set.univ = ↑(Fintype.card Ω)", " ∑ x : Ω, 1 = ↑(Fintype.card Ω)", " M...
[ " condCount ∅ = 0", " (condCount s) ∅ = 0", " s.Finite", " False", " (condCount Set.univ) s = Measure.count s / ↑(Fintype.card Ω)", " Measure.count s / Measure.count Set.univ = Measure.count s / ↑(Fintype.card Ω)", " Measure.count Set.univ = ↑(Fintype.card Ω)", " ∑ x : Ω, 1 = ↑(Fintype.card Ω)", " M...
import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.Data.Set.Finite import Mathlib.Data.Set.Subsingleton import Mathlib.Topology.Category.TopCat.Limits.Konig import Mathlib.Tactic.AdaptationNote #align_import category_theory.cofiltered_system from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" universe u v w open CategoryTheory CategoryTheory.IsCofiltered Set CategoryTheory.FunctorToTypes namespace CategoryTheory namespace Functor variable {J : Type u} [Category J] (F : J ⥤ Type v) {i j k : J} (s : Set (F.obj i)) def eventualRange (j : J) := ⋂ (i) (f : i ⟶ j), range (F.map f) #align category_theory.functor.eventual_range CategoryTheory.Functor.eventualRange theorem mem_eventualRange_iff {x : F.obj j} : x ∈ F.eventualRange j ↔ ∀ ⦃i⦄ (f : i ⟶ j), x ∈ range (F.map f) := mem_iInter₂ #align category_theory.functor.mem_eventual_range_iff CategoryTheory.Functor.mem_eventualRange_iff def IsMittagLeffler : Prop := ∀ j : J, ∃ (i : _) (f : i ⟶ j), ∀ ⦃k⦄ (g : k ⟶ j), range (F.map f) ⊆ range (F.map g) #align category_theory.functor.is_mittag_leffler CategoryTheory.Functor.IsMittagLeffler theorem isMittagLeffler_iff_eventualRange : F.IsMittagLeffler ↔ ∀ j : J, ∃ (i : _) (f : i ⟶ j), F.eventualRange j = range (F.map f) := forall_congr' fun _ => exists₂_congr fun _ _ => ⟨fun h => (iInter₂_subset _ _).antisymm <| subset_iInter₂ h, fun h => h ▸ iInter₂_subset⟩ #align category_theory.functor.is_mittag_leffler_iff_eventual_range CategoryTheory.Functor.isMittagLeffler_iff_eventualRange theorem IsMittagLeffler.subset_image_eventualRange (h : F.IsMittagLeffler) (f : j ⟶ i) : F.eventualRange i ⊆ F.map f '' F.eventualRange j := by obtain ⟨k, g, hg⟩ := F.isMittagLeffler_iff_eventualRange.1 h j rw [hg]; intro x hx obtain ⟨x, rfl⟩ := F.mem_eventualRange_iff.1 hx (g ≫ f) exact ⟨_, ⟨x, rfl⟩, by rw [map_comp_apply]⟩ #align category_theory.functor.is_mittag_leffler.subset_image_eventual_range CategoryTheory.Functor.IsMittagLeffler.subset_image_eventualRange
Mathlib/CategoryTheory/CofilteredSystem.lean
166
171
theorem eventualRange_eq_range_precomp (f : i ⟶ j) (g : j ⟶ k) (h : F.eventualRange k = range (F.map g)) : F.eventualRange k = range (F.map <| f ≫ g) := by
apply subset_antisymm · apply iInter₂_subset · rw [h, F.map_comp] apply range_comp_subset_range
[ " F.eventualRange i ⊆ F.map f '' F.eventualRange j", " F.eventualRange i ⊆ F.map f '' range (F.map g)", " x ∈ F.map f '' range (F.map g)", " F.map (g ≫ f) x ∈ F.map f '' range (F.map g)", " F.map f (F.map g x) = F.map (g ≫ f) x", " F.eventualRange k = range (F.map (f ≫ g))", " F.eventualRange k ⊆ range ...
[ " F.eventualRange i ⊆ F.map f '' F.eventualRange j", " F.eventualRange i ⊆ F.map f '' range (F.map g)", " x ∈ F.map f '' range (F.map g)", " F.map (g ≫ f) x ∈ F.map f '' range (F.map g)", " F.map f (F.map g x) = F.map (g ≫ f) x" ]
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z ≠ 2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : ℤ) : z * z % 4 ≠ 2 := by suffices ¬z * z % (4 : ℕ) = 2 % (4 : ℕ) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : ℤ) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : ℤ} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : ℤ} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm] theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm] #align pythagorean_triple.symm PythagoreanTriple.symm theorem mul (k : ℤ) : PythagoreanTriple (k * x) (k * y) (k * z) := calc k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring _ = k ^ 2 * (z * z) := by rw [h.eq] _ = k * z * (k * z) := by ring #align pythagorean_triple.mul PythagoreanTriple.mul theorem mul_iff (k : ℤ) (hk : k ≠ 0) : PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z := by refine ⟨?_, fun h => h.mul k⟩ simp only [PythagoreanTriple] intro h rw [← mul_left_inj' (mul_ne_zero hk hk)] convert h using 1 <;> ring #align pythagorean_triple.mul_iff PythagoreanTriple.mul_iff @[nolint unusedArguments] def IsClassified (_ : PythagoreanTriple x y z) := ∃ k m n : ℤ, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 #align pythagorean_triple.is_classified PythagoreanTriple.IsClassified @[nolint unusedArguments] def IsPrimitiveClassified (_ : PythagoreanTriple x y z) := ∃ m n : ℤ, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) #align pythagorean_triple.is_primitive_classified PythagoreanTriple.IsPrimitiveClassified
Mathlib/NumberTheory/PythagoreanTriples.lean
120
129
theorem mul_isClassified (k : ℤ) (hc : h.IsClassified) : (h.mul k).IsClassified := by
obtain ⟨l, m, n, ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, co⟩⟩ := hc · use k * l, m, n apply And.intro _ co left constructor <;> ring · use k * l, m, n apply And.intro _ co right constructor <;> ring
[ " z * z ≠ 2", " ⟨0, ⋯⟩ * ⟨0, ⋯⟩ ≠ 2", " ⟨1, ⋯⟩ * ⟨1, ⋯⟩ ≠ 2", " ⟨2, ⋯⟩ * ⟨2, ⋯⟩ ≠ 2", " ⟨3, ⋯⟩ * ⟨3, ⋯⟩ ≠ 2", " z * z % 4 ≠ 2", " ¬z * z % ↑4 = 2 % ↑4", " ¬↑(z * z) = ↑2", " PythagoreanTriple x y z ↔ PythagoreanTriple y x z", " x * x + y * y = z * z ↔ y * y + x * x = z * z", " PythagoreanTriple ...
[ " z * z ≠ 2", " ⟨0, ⋯⟩ * ⟨0, ⋯⟩ ≠ 2", " ⟨1, ⋯⟩ * ⟨1, ⋯⟩ ≠ 2", " ⟨2, ⋯⟩ * ⟨2, ⋯⟩ ≠ 2", " ⟨3, ⋯⟩ * ⟨3, ⋯⟩ ≠ 2", " z * z % 4 ≠ 2", " ¬z * z % ↑4 = 2 % ↑4", " ¬↑(z * z) = ↑2", " PythagoreanTriple x y z ↔ PythagoreanTriple y x z", " x * x + y * y = z * z ↔ y * y + x * x = z * z", " PythagoreanTriple ...
import Mathlib.Analysis.SpecialFunctions.Gamma.Beta import Mathlib.NumberTheory.LSeries.HurwitzZeta import Mathlib.Analysis.Complex.RemovableSingularity import Mathlib.Analysis.PSeriesComplex #align_import number_theory.zeta_function from "leanprover-community/mathlib"@"57f9349f2fe19d2de7207e99b0341808d977cdcf" open MeasureTheory Set Filter Asymptotics TopologicalSpace Real Asymptotics Classical HurwitzZeta open Complex hiding exp norm_eq_abs abs_of_nonneg abs_two continuous_exp open scoped Topology Real Nat noncomputable section def completedRiemannZeta₀ (s : ℂ) : ℂ := completedHurwitzZetaEven₀ 0 s #align riemann_completed_zeta₀ completedRiemannZeta₀ def completedRiemannZeta (s : ℂ) : ℂ := completedHurwitzZetaEven 0 s #align riemann_completed_zeta completedRiemannZeta lemma HurwitzZeta.completedHurwitzZetaEven_zero (s : ℂ) : completedHurwitzZetaEven 0 s = completedRiemannZeta s := rfl lemma HurwitzZeta.completedHurwitzZetaEven₀_zero (s : ℂ) : completedHurwitzZetaEven₀ 0 s = completedRiemannZeta₀ s := rfl lemma HurwitzZeta.completedCosZeta_zero (s : ℂ) : completedCosZeta 0 s = completedRiemannZeta s := by rw [completedRiemannZeta, completedHurwitzZetaEven, completedCosZeta, hurwitzEvenFEPair_zero_symm] lemma HurwitzZeta.completedCosZeta₀_zero (s : ℂ) : completedCosZeta₀ 0 s = completedRiemannZeta₀ s := by rw [completedRiemannZeta₀, completedHurwitzZetaEven₀, completedCosZeta₀, hurwitzEvenFEPair_zero_symm] lemma completedRiemannZeta_eq (s : ℂ) : completedRiemannZeta s = completedRiemannZeta₀ s - 1 / s - 1 / (1 - s) := by simp_rw [completedRiemannZeta, completedRiemannZeta₀, completedHurwitzZetaEven_eq, if_true] theorem differentiable_completedZeta₀ : Differentiable ℂ completedRiemannZeta₀ := differentiable_completedHurwitzZetaEven₀ 0 #align differentiable_completed_zeta₀ differentiable_completedZeta₀ theorem differentiableAt_completedZeta {s : ℂ} (hs : s ≠ 0) (hs' : s ≠ 1) : DifferentiableAt ℂ completedRiemannZeta s := differentiableAt_completedHurwitzZetaEven 0 (Or.inl hs) hs' theorem completedRiemannZeta₀_one_sub (s : ℂ) : completedRiemannZeta₀ (1 - s) = completedRiemannZeta₀ s := by rw [← completedHurwitzZetaEven₀_zero, ← completedCosZeta₀_zero, completedHurwitzZetaEven₀_one_sub] #align riemann_completed_zeta₀_one_sub completedRiemannZeta₀_one_sub
Mathlib/NumberTheory/LSeries/RiemannZeta.lean
110
112
theorem completedRiemannZeta_one_sub (s : ℂ) : completedRiemannZeta (1 - s) = completedRiemannZeta s := by
rw [← completedHurwitzZetaEven_zero, ← completedCosZeta_zero, completedHurwitzZetaEven_one_sub]
[ " completedCosZeta 0 s = completedRiemannZeta s", " completedCosZeta₀ 0 s = completedRiemannZeta₀ s", " completedRiemannZeta s = completedRiemannZeta₀ s - 1 / s - 1 / (1 - s)", " completedRiemannZeta₀ (1 - s) = completedRiemannZeta₀ s", " completedRiemannZeta (1 - s) = completedRiemannZeta s" ]
[ " completedCosZeta 0 s = completedRiemannZeta s", " completedCosZeta₀ 0 s = completedRiemannZeta₀ s", " completedRiemannZeta s = completedRiemannZeta₀ s - 1 / s - 1 / (1 - s)", " completedRiemannZeta₀ (1 - s) = completedRiemannZeta₀ s" ]
import Mathlib.Analysis.Calculus.LocalExtr.Rolle import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Topology.Algebra.Polynomial #align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" namespace Polynomial
Mathlib/Analysis/Calculus/LocalExtr/Polynomial.lean
36
46
theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]) : p.roots.toFinset.card ≤ (p.derivative.roots.toFinset \ p.roots.toFinset).card + 1 := by
rcases eq_or_ne (derivative p) 0 with hp' | hp' · rw [eq_C_of_derivative_eq_zero hp', roots_C, Multiset.toFinset_zero, Finset.card_empty] exact zero_le _ have hp : p ≠ 0 := ne_of_apply_ne derivative (by rwa [derivative_zero]) refine Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => ?_ rw [Multiset.mem_toFinset, mem_roots hp] at hx hy obtain ⟨z, hz1, hz2⟩ := exists_deriv_eq_zero hxy p.continuousOn (hx.trans hy.symm) refine ⟨z, ?_, hz1⟩ rwa [Multiset.mem_toFinset, mem_roots hp', IsRoot, ← p.deriv]
[ " p.roots.toFinset.card ≤ ((derivative p).roots.toFinset \\ p.roots.toFinset).card + 1", " 0 ≤ ((derivative (C (p.coeff 0))).roots.toFinset \\ ∅).card + 1", " derivative p ≠ derivative 0", " ∃ z ∈ (derivative p).roots.toFinset, x < z ∧ z < y", " z ∈ (derivative p).roots.toFinset" ]
[]
import Mathlib.SetTheory.Ordinal.Arithmetic #align_import set_theory.ordinal.exponential from "leanprover-community/mathlib"@"b67044ba53af18680e1dd246861d9584e968495d" noncomputable section open Function Cardinal Set Equiv Order open scoped Classical open Cardinal Ordinal universe u v w namespace Ordinal instance pow : Pow Ordinal Ordinal := ⟨fun a b => if a = 0 then 1 - b else limitRecOn b 1 (fun _ IH => IH * a) fun b _ => bsup.{u, u} b⟩ -- Porting note: Ambiguous notations. -- local infixr:0 "^" => @Pow.pow Ordinal Ordinal Ordinal.instPowOrdinalOrdinal theorem opow_def (a b : Ordinal) : a ^ b = if a = 0 then 1 - b else limitRecOn b 1 (fun _ IH => IH * a) fun b _ => bsup.{u, u} b := rfl #align ordinal.opow_def Ordinal.opow_def -- Porting note: `if_pos rfl` → `if_true`
Mathlib/SetTheory/Ordinal/Exponential.lean
42
42
theorem zero_opow' (a : Ordinal) : 0 ^ a = 1 - a := by
simp only [opow_def, if_true]
[ " 0 ^ a = 1 - a" ]
[]
import Mathlib.Algebra.Regular.Basic import Mathlib.Algebra.Ring.Defs #align_import algebra.ring.regular from "leanprover-community/mathlib"@"2f3994e1b117b1e1da49bcfb67334f33460c3ce4" variable {α : Type*}
Mathlib/Algebra/Ring/Regular.lean
20
23
theorem isLeftRegular_of_non_zero_divisor [NonUnitalNonAssocRing α] (k : α) (h : ∀ x : α, k * x = 0 → x = 0) : IsLeftRegular k := by
refine fun x y (h' : k * x = k * y) => sub_eq_zero.mp (h _ ?_) rw [mul_sub, sub_eq_zero, h']
[ " IsLeftRegular k", " k * (x - y) = 0" ]
[]
import Mathlib.Data.Option.Basic import Mathlib.Data.Set.Basic #align_import data.pequiv from "leanprover-community/mathlib"@"7c3269ca3fa4c0c19e4d127cd7151edbdbf99ed4" universe u v w x structure PEquiv (α : Type u) (β : Type v) where toFun : α → Option β invFun : β → Option α inv : ∀ (a : α) (b : β), a ∈ invFun b ↔ b ∈ toFun a #align pequiv PEquiv infixr:25 " ≃. " => PEquiv namespace PEquiv variable {α : Type u} {β : Type v} {γ : Type w} {δ : Type x} open Function Option instance : FunLike (α ≃. β) α (Option β) := { coe := toFun coe_injective' := by rintro ⟨f₁, f₂, hf⟩ ⟨g₁, g₂, hg⟩ (rfl : f₁ = g₁) congr with y x simp only [hf, hg] } @[simp] theorem coe_mk (f₁ : α → Option β) (f₂ h) : (mk f₁ f₂ h : α → Option β) = f₁ := rfl theorem coe_mk_apply (f₁ : α → Option β) (f₂ : β → Option α) (h) (x : α) : (PEquiv.mk f₁ f₂ h : α → Option β) x = f₁ x := rfl #align pequiv.coe_mk_apply PEquiv.coe_mk_apply @[ext] theorem ext {f g : α ≃. β} (h : ∀ x, f x = g x) : f = g := DFunLike.ext f g h #align pequiv.ext PEquiv.ext theorem ext_iff {f g : α ≃. β} : f = g ↔ ∀ x, f x = g x := DFunLike.ext_iff #align pequiv.ext_iff PEquiv.ext_iff @[refl] protected def refl (α : Type*) : α ≃. α where toFun := some invFun := some inv _ _ := eq_comm #align pequiv.refl PEquiv.refl @[symm] protected def symm (f : α ≃. β) : β ≃. α where toFun := f.2 invFun := f.1 inv _ _ := (f.inv _ _).symm #align pequiv.symm PEquiv.symm theorem mem_iff_mem (f : α ≃. β) : ∀ {a : α} {b : β}, a ∈ f.symm b ↔ b ∈ f a := f.3 _ _ #align pequiv.mem_iff_mem PEquiv.mem_iff_mem theorem eq_some_iff (f : α ≃. β) : ∀ {a : α} {b : β}, f.symm b = some a ↔ f a = some b := f.3 _ _ #align pequiv.eq_some_iff PEquiv.eq_some_iff @[trans] protected def trans (f : α ≃. β) (g : β ≃. γ) : α ≃. γ where toFun a := (f a).bind g invFun a := (g.symm a).bind f.symm inv a b := by simp_all [and_comm, eq_some_iff f, eq_some_iff g, bind_eq_some] #align pequiv.trans PEquiv.trans @[simp] theorem refl_apply (a : α) : PEquiv.refl α a = some a := rfl #align pequiv.refl_apply PEquiv.refl_apply @[simp] theorem symm_refl : (PEquiv.refl α).symm = PEquiv.refl α := rfl #align pequiv.symm_refl PEquiv.symm_refl @[simp] theorem symm_symm (f : α ≃. β) : f.symm.symm = f := by cases f; rfl #align pequiv.symm_symm PEquiv.symm_symm theorem symm_bijective : Function.Bijective (PEquiv.symm : (α ≃. β) → β ≃. α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ theorem symm_injective : Function.Injective (@PEquiv.symm α β) := symm_bijective.injective #align pequiv.symm_injective PEquiv.symm_injective theorem trans_assoc (f : α ≃. β) (g : β ≃. γ) (h : γ ≃. δ) : (f.trans g).trans h = f.trans (g.trans h) := ext fun _ => Option.bind_assoc _ _ _ #align pequiv.trans_assoc PEquiv.trans_assoc theorem mem_trans (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ) : c ∈ f.trans g a ↔ ∃ b, b ∈ f a ∧ c ∈ g b := Option.bind_eq_some' #align pequiv.mem_trans PEquiv.mem_trans theorem trans_eq_some (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ) : f.trans g a = some c ↔ ∃ b, f a = some b ∧ g b = some c := Option.bind_eq_some' #align pequiv.trans_eq_some PEquiv.trans_eq_some
Mathlib/Data/PEquiv.lean
161
165
theorem trans_eq_none (f : α ≃. β) (g : β ≃. γ) (a : α) : f.trans g a = none ↔ ∀ b c, b ∉ f a ∨ c ∉ g b := by
simp only [eq_none_iff_forall_not_mem, mem_trans, imp_iff_not_or.symm] push_neg exact forall_swap
[ " Injective toFun", " { toFun := f₁, invFun := f₂, inv := hf } = { toFun := f₁, invFun := g₂, inv := hg }", " x ∈ f₂ y ↔ x ∈ g₂ y", " a ∈ (fun a => (g.symm a).bind ⇑f.symm) b ↔ b ∈ (fun a => (f a).bind ⇑g) a", " f.symm.symm = f", " { toFun := toFun✝, invFun := invFun✝, inv := inv✝ }.symm.symm = { toFun :=...
[ " Injective toFun", " { toFun := f₁, invFun := f₂, inv := hf } = { toFun := f₁, invFun := g₂, inv := hg }", " x ∈ f₂ y ↔ x ∈ g₂ y", " a ∈ (fun a => (g.symm a).bind ⇑f.symm) b ↔ b ∈ (fun a => (f a).bind ⇑g) a", " f.symm.symm = f", " { toFun := toFun✝, invFun := invFun✝, inv := inv✝ }.symm.symm = { toFun :=...
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory section Bilinear variable {α E F G : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] {μ : Measure α} {f : α → E} {g : α → F} theorem snorm_le_snorm_top_mul_snorm (p : ℝ≥0∞) (f : α → E) {g : α → F} (hg : AEStronglyMeasurable g μ) (b : E → F → G) (h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) : snorm (fun x => b (f x) (g x)) p μ ≤ snorm f ∞ μ * snorm g p μ := by by_cases hp_top : p = ∞ · simp_rw [hp_top, snorm_exponent_top] refine le_trans (essSup_mono_ae <| h.mono fun a ha => ?_) (ENNReal.essSup_mul_le _ _) simp_rw [Pi.mul_apply, ← ENNReal.coe_mul, ENNReal.coe_le_coe] exact ha by_cases hp_zero : p = 0 · simp only [hp_zero, snorm_exponent_zero, mul_zero, le_zero_iff] simp_rw [snorm_eq_lintegral_rpow_nnnorm hp_zero hp_top, snorm_exponent_top, snormEssSup] calc (∫⁻ x, (‖b (f x) (g x)‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) ≤ (∫⁻ x, (‖f x‖₊ : ℝ≥0∞) ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by gcongr ?_ ^ _ refine lintegral_mono_ae (h.mono fun a ha => ?_) rw [← ENNReal.mul_rpow_of_nonneg _ _ ENNReal.toReal_nonneg] refine ENNReal.rpow_le_rpow ?_ ENNReal.toReal_nonneg rw [← ENNReal.coe_mul, ENNReal.coe_le_coe] exact ha _ ≤ (∫⁻ x, essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by gcongr ?_ ^ _ refine lintegral_mono_ae ?_ filter_upwards [@ENNReal.ae_le_essSup _ _ μ fun x => (‖f x‖₊ : ℝ≥0∞)] with x hx gcongr _ = essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ * (∫⁻ x, (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by rw [lintegral_const_mul''] swap; · exact hg.nnnorm.aemeasurable.coe_nnreal_ennreal.pow aemeasurable_const rw [ENNReal.mul_rpow_of_nonneg] swap; · rw [one_div_nonneg] exact ENNReal.toReal_nonneg rw [← ENNReal.rpow_mul, one_div, mul_inv_cancel, ENNReal.rpow_one] rw [Ne, ENNReal.toReal_eq_zero_iff, not_or] exact ⟨hp_zero, hp_top⟩ #align measure_theory.snorm_le_snorm_top_mul_snorm MeasureTheory.snorm_le_snorm_top_mul_snorm theorem snorm_le_snorm_mul_snorm_top (p : ℝ≥0∞) {f : α → E} (hf : AEStronglyMeasurable f μ) (g : α → F) (b : E → F → G) (h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) : snorm (fun x => b (f x) (g x)) p μ ≤ snorm f p μ * snorm g ∞ μ := calc snorm (fun x ↦ b (f x) (g x)) p μ ≤ snorm g ∞ μ * snorm f p μ := snorm_le_snorm_top_mul_snorm p g hf (flip b) <| by simpa only [mul_comm] using h _ = snorm f p μ * snorm g ∞ μ := mul_comm _ _ #align measure_theory.snorm_le_snorm_mul_snorm_top MeasureTheory.snorm_le_snorm_mul_snorm_top
Mathlib/MeasureTheory/Function/LpSeminorm/CompareExp.lean
208
222
theorem snorm'_le_snorm'_mul_snorm' {p q r : ℝ} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (b : E → F → G) (h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) (hp0_lt : 0 < p) (hpq : p < q) (hpqr : 1 / p = 1 / q + 1 / r) : snorm' (fun x => b (f x) (g x)) p μ ≤ snorm' f q μ * snorm' g r μ := by
rw [snorm'] calc (∫⁻ a : α, ↑‖b (f a) (g a)‖₊ ^ p ∂μ) ^ (1 / p) ≤ (∫⁻ a : α, ↑(‖f a‖₊ * ‖g a‖₊) ^ p ∂μ) ^ (1 / p) := (ENNReal.rpow_le_rpow_iff <| one_div_pos.mpr hp0_lt).mpr <| lintegral_mono_ae <| h.mono fun a ha => (ENNReal.rpow_le_rpow_iff hp0_lt).mpr <| ENNReal.coe_le_coe.mpr <| ha _ ≤ _ := ?_ simp_rw [snorm', ENNReal.coe_mul] exact ENNReal.lintegral_Lp_mul_le_Lq_mul_Lr hp0_lt hpq hpqr μ hf.ennnorm hg.ennnorm
[ " snorm (fun x => b (f x) (g x)) p μ ≤ snorm f ⊤ μ * snorm g p μ", " snormEssSup (fun x => b (f x) (g x)) μ ≤ snormEssSup f μ * snormEssSup g μ", " (fun x => ↑‖(fun x => b (f x) (g x)) x‖₊) a ≤ ((fun x => ↑‖f x‖₊) * fun x => ↑‖g x‖₊) a", " ‖b (f a) (g a)‖₊ ≤ ‖f a‖₊ * ‖g a‖₊", " (∫⁻ (x : α), ↑‖b (f x) (g x)‖...
[ " snorm (fun x => b (f x) (g x)) p μ ≤ snorm f ⊤ μ * snorm g p μ", " snormEssSup (fun x => b (f x) (g x)) μ ≤ snormEssSup f μ * snormEssSup g μ", " (fun x => ↑‖(fun x => b (f x) (g x)) x‖₊) a ≤ ((fun x => ↑‖f x‖₊) * fun x => ↑‖g x‖₊) a", " ‖b (f a) (g a)‖₊ ≤ ‖f a‖₊ * ‖g a‖₊", " (∫⁻ (x : α), ↑‖b (f x) (g x)‖...
import Mathlib.Algebra.Associated import Mathlib.Algebra.GeomSum import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.Choose.Sum import Mathlib.Data.Nat.Lattice import Mathlib.RingTheory.Nilpotent.Defs #align_import ring_theory.nilpotent from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" universe u v open Function Set variable {R S : Type*} {x y : R} theorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by obtain ⟨n, hn⟩ := h use n rw [neg_pow, hn, mul_zero] #align is_nilpotent.neg IsNilpotent.neg @[simp] theorem isNilpotent_neg_iff [Ring R] : IsNilpotent (-x) ↔ IsNilpotent x := ⟨fun h => neg_neg x ▸ h.neg, fun h => h.neg⟩ #align is_nilpotent_neg_iff isNilpotent_neg_iff lemma IsNilpotent.smul [MonoidWithZero R] [MonoidWithZero S] [MulActionWithZero R S] [SMulCommClass R S S] [IsScalarTower R S S] {a : S} (ha : IsNilpotent a) (t : R) : IsNilpotent (t • a) := by obtain ⟨k, ha⟩ := ha use k rw [smul_pow, ha, smul_zero] theorem IsNilpotent.isUnit_sub_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r - 1) := by obtain ⟨n, hn⟩ := hnil refine ⟨⟨r - 1, -∑ i ∈ Finset.range n, r ^ i, ?_, ?_⟩, rfl⟩ · simp [mul_geom_sum, hn] · simp [geom_sum_mul, hn] theorem IsNilpotent.isUnit_one_sub [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 - r) := by rw [← IsUnit.neg_iff, neg_sub] exact isUnit_sub_one hnil theorem IsNilpotent.isUnit_add_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r + 1) := by rw [← IsUnit.neg_iff, neg_add'] exact isUnit_sub_one hnil.neg theorem IsNilpotent.isUnit_one_add [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 + r) := add_comm r 1 ▸ isUnit_add_one hnil theorem IsNilpotent.isUnit_add_left_of_commute [Ring R] {r u : R} (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) : IsUnit (u + r) := by rw [← Units.isUnit_mul_units _ hu.unit⁻¹, add_mul, IsUnit.mul_val_inv] replace h_comm : Commute r (↑hu.unit⁻¹) := Commute.units_inv_right h_comm refine IsNilpotent.isUnit_one_add ?_ exact (hu.unit⁻¹.isUnit.isNilpotent_mul_unit_of_commute_iff h_comm).mpr hnil theorem IsNilpotent.isUnit_add_right_of_commute [Ring R] {r u : R} (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) : IsUnit (r + u) := add_comm r u ▸ hnil.isUnit_add_left_of_commute hu h_comm instance [Zero R] [Pow R ℕ] [Zero S] [Pow S ℕ] [IsReduced R] [IsReduced S] : IsReduced (R × S) where eq_zero _ := fun ⟨n, hn⟩ ↦ have hn := Prod.ext_iff.1 hn Prod.ext (IsReduced.eq_zero _ ⟨n, hn.1⟩) (IsReduced.eq_zero _ ⟨n, hn.2⟩) theorem Prime.isRadical [CommMonoidWithZero R] {y : R} (hy : Prime y) : IsRadical y := fun _ _ ↦ hy.dvd_of_dvd_pow theorem zero_isRadical_iff [MonoidWithZero R] : IsRadical (0 : R) ↔ IsReduced R := by simp_rw [isReduced_iff, IsNilpotent, exists_imp, ← zero_dvd_iff] exact forall_swap #align zero_is_radical_iff zero_isRadical_iff theorem isReduced_iff_pow_one_lt [MonoidWithZero R] (k : ℕ) (hk : 1 < k) : IsReduced R ↔ ∀ x : R, x ^ k = 0 → x = 0 := by simp_rw [← zero_isRadical_iff, isRadical_iff_pow_one_lt k hk, zero_dvd_iff] #align is_reduced_iff_pow_one_lt isReduced_iff_pow_one_lt theorem IsRadical.of_dvd [CancelCommMonoidWithZero R] {x y : R} (hy : IsRadical y) (h0 : y ≠ 0) (hxy : x ∣ y) : IsRadical x := (isRadical_iff_pow_one_lt 2 one_lt_two).2 <| by obtain ⟨z, rfl⟩ := hxy refine fun w dvd ↦ ((mul_dvd_mul_iff_right <| right_ne_zero_of_mul h0).mp <| hy 2 _ ?_) rw [mul_pow, sq z]; exact mul_dvd_mul dvd (dvd_mul_left z z) namespace Commute section Semiring variable [Semiring R] (h_comm : Commute x y)
Mathlib/RingTheory/Nilpotent/Basic.lean
117
127
theorem add_pow_eq_zero_of_add_le_succ_of_pow_eq_zero {m n k : ℕ} (hx : x ^ m = 0) (hy : y ^ n = 0) (h : m + n ≤ k + 1) : (x + y) ^ k = 0 := by
rw [h_comm.add_pow'] apply Finset.sum_eq_zero rintro ⟨i, j⟩ hij suffices x ^ i * y ^ j = 0 by simp only [this, nsmul_eq_mul, mul_zero] by_cases hi : m ≤ i · rw [pow_eq_zero_of_le hi hx, zero_mul] rw [pow_eq_zero_of_le ?_ hy, mul_zero] linarith [Finset.mem_antidiagonal.mp hij]
[ " IsNilpotent (-x)", " (-x) ^ n = 0", " IsNilpotent (t • a)", " (t • a) ^ k = 0", " IsUnit (r - 1)", " (r - 1) * -∑ i ∈ Finset.range n, r ^ i = 1", " (-∑ i ∈ Finset.range n, r ^ i) * (r - 1) = 1", " IsUnit (1 - r)", " IsUnit (r + 1)", " IsUnit (-r - 1)", " IsUnit (u + r)", " IsUnit (1 + r * ↑h...
[ " IsNilpotent (-x)", " (-x) ^ n = 0", " IsNilpotent (t • a)", " (t • a) ^ k = 0", " IsUnit (r - 1)", " (r - 1) * -∑ i ∈ Finset.range n, r ^ i = 1", " (-∑ i ∈ Finset.range n, r ^ i) * (r - 1) = 1", " IsUnit (1 - r)", " IsUnit (r + 1)", " IsUnit (-r - 1)", " IsUnit (u + r)", " IsUnit (1 + r * ↑h...
import Mathlib.RingTheory.FiniteType import Mathlib.RingTheory.Localization.AtPrime import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.Localization.Integer import Mathlib.RingTheory.Localization.Submodule import Mathlib.RingTheory.Nilpotent.Lemmas import Mathlib.RingTheory.RingHomProperties import Mathlib.Data.Set.Subsingleton #align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0" open scoped Pointwise Classical universe u variable {R S : Type u} [CommRing R] [CommRing S] (M : Submonoid R) variable (N : Submonoid S) (R' S' : Type u) [CommRing R'] [CommRing S'] (f : R →+* S) variable [Algebra R R'] [Algebra S S'] section Properties section RingHom variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S] (_ : R →+* S), Prop) def RingHom.LocalizationPreserves := ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (M : Submonoid R) (R' S' : Type u) [CommRing R'] [CommRing S'] [Algebra R R'] [Algebra S S'] [IsLocalization M R'] [IsLocalization (M.map f) S'], P f → P (IsLocalization.map S' f (Submonoid.le_comap_map M) : R' →+* S') #align ring_hom.localization_preserves RingHom.LocalizationPreserves def RingHom.OfLocalizationFiniteSpan := ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Finset R) (_ : Ideal.span (s : Set R) = ⊤) (_ : ∀ r : s, P (Localization.awayMap f r)), P f #align ring_hom.of_localization_finite_span RingHom.OfLocalizationFiniteSpan def RingHom.OfLocalizationSpan := ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Set R) (_ : Ideal.span s = ⊤) (_ : ∀ r : s, P (Localization.awayMap f r)), P f #align ring_hom.of_localization_span RingHom.OfLocalizationSpan def RingHom.HoldsForLocalizationAway : Prop := ∀ ⦃R : Type u⦄ (S : Type u) [CommRing R] [CommRing S] [Algebra R S] (r : R) [IsLocalization.Away r S], P (algebraMap R S) #align ring_hom.holds_for_localization_away RingHom.HoldsForLocalizationAway def RingHom.OfLocalizationFiniteSpanTarget : Prop := ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Finset S) (_ : Ideal.span (s : Set S) = ⊤) (_ : ∀ r : s, P ((algebraMap S (Localization.Away (r : S))).comp f)), P f #align ring_hom.of_localization_finite_span_target RingHom.OfLocalizationFiniteSpanTarget def RingHom.OfLocalizationSpanTarget : Prop := ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Set S) (_ : Ideal.span s = ⊤) (_ : ∀ r : s, P ((algebraMap S (Localization.Away (r : S))).comp f)), P f #align ring_hom.of_localization_span_target RingHom.OfLocalizationSpanTarget def RingHom.OfLocalizationPrime : Prop := ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S), (∀ (J : Ideal S) (_ : J.IsPrime), P (Localization.localRingHom _ J f rfl)) → P f #align ring_hom.of_localization_prime RingHom.OfLocalizationPrime structure RingHom.PropertyIsLocal : Prop where LocalizationPreserves : RingHom.LocalizationPreserves @P OfLocalizationSpanTarget : RingHom.OfLocalizationSpanTarget @P StableUnderComposition : RingHom.StableUnderComposition @P HoldsForLocalizationAway : RingHom.HoldsForLocalizationAway @P #align ring_hom.property_is_local RingHom.PropertyIsLocal theorem RingHom.ofLocalizationSpan_iff_finite : RingHom.OfLocalizationSpan @P ↔ RingHom.OfLocalizationFiniteSpan @P := by delta RingHom.OfLocalizationSpan RingHom.OfLocalizationFiniteSpan apply forall₅_congr -- TODO: Using `refine` here breaks `resetI`. intros constructor · intro h s; exact h s · intro h s hs hs' obtain ⟨s', h₁, h₂⟩ := (Ideal.span_eq_top_iff_finite s).mp hs exact h s' h₂ fun x => hs' ⟨_, h₁ x.prop⟩ #align ring_hom.of_localization_span_iff_finite RingHom.ofLocalizationSpan_iff_finite theorem RingHom.ofLocalizationSpanTarget_iff_finite : RingHom.OfLocalizationSpanTarget @P ↔ RingHom.OfLocalizationFiniteSpanTarget @P := by delta RingHom.OfLocalizationSpanTarget RingHom.OfLocalizationFiniteSpanTarget apply forall₅_congr -- TODO: Using `refine` here breaks `resetI`. intros constructor · intro h s; exact h s · intro h s hs hs' obtain ⟨s', h₁, h₂⟩ := (Ideal.span_eq_top_iff_finite s).mp hs exact h s' h₂ fun x => hs' ⟨_, h₁ x.prop⟩ #align ring_hom.of_localization_span_target_iff_finite RingHom.ofLocalizationSpanTarget_iff_finite variable {P f R' S'} theorem RingHom.PropertyIsLocal.respectsIso (hP : RingHom.PropertyIsLocal @P) : RingHom.RespectsIso @P := by apply hP.StableUnderComposition.respectsIso introv letI := e.toRingHom.toAlgebra -- Porting note: was `apply_with hP.holds_for_localization_away { instances := ff }` have : IsLocalization.Away (1 : R) S := by apply IsLocalization.away_of_isUnit_of_bijective _ isUnit_one e.bijective exact RingHom.PropertyIsLocal.HoldsForLocalizationAway hP S (1 : R) #align ring_hom.property_is_local.respects_iso RingHom.PropertyIsLocal.respectsIso -- Almost all arguments are implicit since this is not intended to use mid-proof.
Mathlib/RingTheory/LocalProperties.lean
193
197
theorem RingHom.LocalizationPreserves.away (H : RingHom.LocalizationPreserves @P) (r : R) [IsLocalization.Away r R'] [IsLocalization.Away (f r) S'] (hf : P f) : P (IsLocalization.Away.map R' S' f r) := by
have : IsLocalization ((Submonoid.powers r).map f) S' := by rw [Submonoid.map_powers]; assumption exact H f (Submonoid.powers r) R' S' hf
[ " OfLocalizationSpan P ↔ OfLocalizationFiniteSpan P", " (∀ ⦃R S : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] (f : R →+* S) (s : Set R),\n Ideal.span s = ⊤ → (∀ (r : ↑s), P (Localization.awayMap f ↑r)) → P f) ↔\n ∀ ⦃R S : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] (f : R →+* S) (s : Finset R)...
[ " OfLocalizationSpan P ↔ OfLocalizationFiniteSpan P", " (∀ ⦃R S : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] (f : R →+* S) (s : Set R),\n Ideal.span s = ⊤ → (∀ (r : ↑s), P (Localization.awayMap f ↑r)) → P f) ↔\n ∀ ⦃R S : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] (f : R →+* S) (s : Finset R)...
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.Combinatorics.Pigeonhole #align_import dynamics.ergodic.conservative from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" noncomputable section open scoped Classical open Set Filter MeasureTheory Finset Function TopologicalSpace open scoped Classical open Topology variable {ι : Type*} {α : Type*} [MeasurableSpace α] {f : α → α} {s : Set α} {μ : Measure α} namespace MeasureTheory open Measure structure Conservative (f : α → α) (μ : Measure α) extends QuasiMeasurePreserving f μ μ : Prop where exists_mem_iterate_mem : ∀ ⦃s⦄, MeasurableSet s → μ s ≠ 0 → ∃ x ∈ s, ∃ m ≠ 0, f^[m] x ∈ s #align measure_theory.conservative MeasureTheory.Conservative protected theorem MeasurePreserving.conservative [IsFiniteMeasure μ] (h : MeasurePreserving f μ μ) : Conservative f μ := ⟨h.quasiMeasurePreserving, fun _ hsm h0 => h.exists_mem_iterate_mem hsm h0⟩ #align measure_theory.measure_preserving.conservative MeasureTheory.MeasurePreserving.conservative namespace Conservative protected theorem id (μ : Measure α) : Conservative id μ := { toQuasiMeasurePreserving := QuasiMeasurePreserving.id μ exists_mem_iterate_mem := fun _ _ h0 => let ⟨x, hx⟩ := nonempty_of_measure_ne_zero h0 ⟨x, hx, 1, one_ne_zero, hx⟩ } #align measure_theory.conservative.id MeasureTheory.Conservative.id theorem frequently_measure_inter_ne_zero (hf : Conservative f μ) (hs : MeasurableSet s) (h0 : μ s ≠ 0) : ∃ᶠ m in atTop, μ (s ∩ f^[m] ⁻¹' s) ≠ 0 := by by_contra H simp only [not_frequently, eventually_atTop, Ne, Classical.not_not] at H rcases H with ⟨N, hN⟩ induction' N with N ihN · apply h0 simpa using hN 0 le_rfl rw [imp_false] at ihN push_neg at ihN rcases ihN with ⟨n, hn, hμn⟩ set T := s ∩ ⋃ n ≥ N + 1, f^[n] ⁻¹' s have hT : MeasurableSet T := hs.inter (MeasurableSet.biUnion (to_countable _) fun _ _ => hf.measurable.iterate _ hs) have hμT : μ T = 0 := by convert (measure_biUnion_null_iff <| to_countable _).2 hN rw [← inter_iUnion₂] rfl have : μ ((s ∩ f^[n] ⁻¹' s) \ T) ≠ 0 := by rwa [measure_diff_null hμT] rcases hf.exists_mem_iterate_mem ((hs.inter (hf.measurable.iterate n hs)).diff hT) this with ⟨x, ⟨⟨hxs, _⟩, hxT⟩, m, hm0, ⟨_, hxm⟩, _⟩ refine hxT ⟨hxs, mem_iUnion₂.2 ⟨n + m, ?_, ?_⟩⟩ · exact add_le_add hn (Nat.one_le_of_lt <| pos_iff_ne_zero.2 hm0) · rwa [Set.mem_preimage, ← iterate_add_apply] at hxm #align measure_theory.conservative.frequently_measure_inter_ne_zero MeasureTheory.Conservative.frequently_measure_inter_ne_zero theorem exists_gt_measure_inter_ne_zero (hf : Conservative f μ) (hs : MeasurableSet s) (h0 : μ s ≠ 0) (N : ℕ) : ∃ m > N, μ (s ∩ f^[m] ⁻¹' s) ≠ 0 := let ⟨m, hm, hmN⟩ := ((hf.frequently_measure_inter_ne_zero hs h0).and_eventually (eventually_gt_atTop N)).exists ⟨m, hmN, hm⟩ #align measure_theory.conservative.exists_gt_measure_inter_ne_zero MeasureTheory.Conservative.exists_gt_measure_inter_ne_zero
Mathlib/Dynamics/Ergodic/Conservative.lean
121
130
theorem measure_mem_forall_ge_image_not_mem_eq_zero (hf : Conservative f μ) (hs : MeasurableSet s) (n : ℕ) : μ ({ x ∈ s | ∀ m ≥ n, f^[m] x ∉ s }) = 0 := by
by_contra H have : MeasurableSet (s ∩ { x | ∀ m ≥ n, f^[m] x ∉ s }) := by simp only [setOf_forall, ← compl_setOf] exact hs.inter (MeasurableSet.biInter (to_countable _) fun m _ => hf.measurable.iterate m hs.compl) rcases (hf.exists_gt_measure_inter_ne_zero this H) n with ⟨m, hmn, hm⟩ rcases nonempty_of_measure_ne_zero hm with ⟨x, ⟨_, hxn⟩, hxm, -⟩ exact hxn m hmn.lt.le hxm
[ " ∃ᶠ (m : ℕ) in atTop, μ (s ∩ f^[m] ⁻¹' s) ≠ 0", " False", " μ s = 0", " μ T = 0", " T = ⋃ i ∈ fun i => (N + 1).le i, s ∩ f^[i] ⁻¹' s", " T = s ∩ ⋃ i ∈ fun i => (N + 1).le i, f^[i] ⁻¹' s", " μ ((s ∩ f^[n] ⁻¹' s) \\ T) ≠ 0", " n + m ≥ N + 1", " x ∈ f^[n + m] ⁻¹' s", " μ {x | x ∈ s ∧ ∀ m ≥ n, f^[m] ...
[ " ∃ᶠ (m : ℕ) in atTop, μ (s ∩ f^[m] ⁻¹' s) ≠ 0", " False", " μ s = 0", " μ T = 0", " T = ⋃ i ∈ fun i => (N + 1).le i, s ∩ f^[i] ⁻¹' s", " T = s ∩ ⋃ i ∈ fun i => (N + 1).le i, f^[i] ⁻¹' s", " μ ((s ∩ f^[n] ⁻¹' s) \\ T) ≠ 0", " n + m ≥ N + 1", " x ∈ f^[n + m] ⁻¹' s" ]
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Group.Submonoid.Basic import Mathlib.Deprecated.Group #align_import deprecated.submonoid from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" variable {M : Type*} [Monoid M] {s : Set M} variable {A : Type*} [AddMonoid A] {t : Set A} structure IsAddSubmonoid (s : Set A) : Prop where zero_mem : (0 : A) ∈ s add_mem {a b} : a ∈ s → b ∈ s → a + b ∈ s #align is_add_submonoid IsAddSubmonoid @[to_additive] structure IsSubmonoid (s : Set M) : Prop where one_mem : (1 : M) ∈ s mul_mem {a b} : a ∈ s → b ∈ s → a * b ∈ s #align is_submonoid IsSubmonoid theorem Additive.isAddSubmonoid {s : Set M} : IsSubmonoid s → @IsAddSubmonoid (Additive M) _ s | ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩ #align additive.is_add_submonoid Additive.isAddSubmonoid theorem Additive.isAddSubmonoid_iff {s : Set M} : @IsAddSubmonoid (Additive M) _ s ↔ IsSubmonoid s := ⟨fun ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩, Additive.isAddSubmonoid⟩ #align additive.is_add_submonoid_iff Additive.isAddSubmonoid_iff theorem Multiplicative.isSubmonoid {s : Set A} : IsAddSubmonoid s → @IsSubmonoid (Multiplicative A) _ s | ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩ #align multiplicative.is_submonoid Multiplicative.isSubmonoid theorem Multiplicative.isSubmonoid_iff {s : Set A} : @IsSubmonoid (Multiplicative A) _ s ↔ IsAddSubmonoid s := ⟨fun ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩, Multiplicative.isSubmonoid⟩ #align multiplicative.is_submonoid_iff Multiplicative.isSubmonoid_iff @[to_additive "The intersection of two `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of M."] theorem IsSubmonoid.inter {s₁ s₂ : Set M} (is₁ : IsSubmonoid s₁) (is₂ : IsSubmonoid s₂) : IsSubmonoid (s₁ ∩ s₂) := { one_mem := ⟨is₁.one_mem, is₂.one_mem⟩ mul_mem := @fun _ _ hx hy => ⟨is₁.mul_mem hx.1 hy.1, is₂.mul_mem hx.2 hy.2⟩ } #align is_submonoid.inter IsSubmonoid.inter #align is_add_submonoid.inter IsAddSubmonoid.inter @[to_additive "The intersection of an indexed set of `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of `M`."] theorem IsSubmonoid.iInter {ι : Sort*} {s : ι → Set M} (h : ∀ y : ι, IsSubmonoid (s y)) : IsSubmonoid (Set.iInter s) := { one_mem := Set.mem_iInter.2 fun y => (h y).one_mem mul_mem := fun h₁ h₂ => Set.mem_iInter.2 fun y => (h y).mul_mem (Set.mem_iInter.1 h₁ y) (Set.mem_iInter.1 h₂ y) } #align is_submonoid.Inter IsSubmonoid.iInter #align is_add_submonoid.Inter IsAddSubmonoid.iInter @[to_additive "The union of an indexed, directed, nonempty set of `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of `M`. "] theorem isSubmonoid_iUnion_of_directed {ι : Type*} [hι : Nonempty ι] {s : ι → Set M} (hs : ∀ i, IsSubmonoid (s i)) (Directed : ∀ i j, ∃ k, s i ⊆ s k ∧ s j ⊆ s k) : IsSubmonoid (⋃ i, s i) := { one_mem := let ⟨i⟩ := hι Set.mem_iUnion.2 ⟨i, (hs i).one_mem⟩ mul_mem := fun ha hb => let ⟨i, hi⟩ := Set.mem_iUnion.1 ha let ⟨j, hj⟩ := Set.mem_iUnion.1 hb let ⟨k, hk⟩ := Directed i j Set.mem_iUnion.2 ⟨k, (hs k).mul_mem (hk.1 hi) (hk.2 hj)⟩ } #align is_submonoid_Union_of_directed isSubmonoid_iUnion_of_directed #align is_add_submonoid_Union_of_directed isAddSubmonoid_iUnion_of_directed @[to_additive "Create a bundled additive submonoid from a set `s` and `[IsAddSubmonoid s]`."] def Submonoid.of {s : Set M} (h : IsSubmonoid s) : Submonoid M := ⟨⟨s, @fun _ _ => h.2⟩, h.1⟩ #align submonoid.of Submonoid.of #align add_submonoid.of AddSubmonoid.of @[to_additive]
Mathlib/Deprecated/Submonoid.lean
426
427
theorem Submonoid.isSubmonoid (S : Submonoid M) : IsSubmonoid (S : Set M) := by
exact ⟨S.2, S.1.2⟩
[ " IsSubmonoid ↑S" ]
[]
import Mathlib.Algebra.Algebra.Prod import Mathlib.LinearAlgebra.Basic import Mathlib.LinearAlgebra.Span import Mathlib.Order.PartialSups #align_import linear_algebra.prod from "leanprover-community/mathlib"@"cd391184c85986113f8c00844cfe6dda1d34be3d" universe u v w x y z u' v' w' y' variable {R : Type u} {K : Type u'} {M : Type v} {V : Type v'} {M₂ : Type w} {V₂ : Type w'} variable {M₃ : Type y} {V₃ : Type y'} {M₄ : Type z} {ι : Type x} variable {M₅ M₆ : Type*} section Prod namespace LinearMap variable (S : Type*) [Semiring R] [Semiring S] variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃] [AddCommMonoid M₄] variable [AddCommMonoid M₅] [AddCommMonoid M₆] variable [Module R M] [Module R M₂] [Module R M₃] [Module R M₄] variable [Module R M₅] [Module R M₆] variable (f : M →ₗ[R] M₂) section variable (R M M₂) def fst : M × M₂ →ₗ[R] M where toFun := Prod.fst map_add' _x _y := rfl map_smul' _x _y := rfl #align linear_map.fst LinearMap.fst def snd : M × M₂ →ₗ[R] M₂ where toFun := Prod.snd map_add' _x _y := rfl map_smul' _x _y := rfl #align linear_map.snd LinearMap.snd end @[simp] theorem fst_apply (x : M × M₂) : fst R M M₂ x = x.1 := rfl #align linear_map.fst_apply LinearMap.fst_apply @[simp] theorem snd_apply (x : M × M₂) : snd R M M₂ x = x.2 := rfl #align linear_map.snd_apply LinearMap.snd_apply theorem fst_surjective : Function.Surjective (fst R M M₂) := fun x => ⟨(x, 0), rfl⟩ #align linear_map.fst_surjective LinearMap.fst_surjective theorem snd_surjective : Function.Surjective (snd R M M₂) := fun x => ⟨(0, x), rfl⟩ #align linear_map.snd_surjective LinearMap.snd_surjective @[simps] def prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : M →ₗ[R] M₂ × M₃ where toFun := Pi.prod f g map_add' x y := by simp only [Pi.prod, Prod.mk_add_mk, map_add] map_smul' c x := by simp only [Pi.prod, Prod.smul_mk, map_smul, RingHom.id_apply] #align linear_map.prod LinearMap.prod theorem coe_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : ⇑(f.prod g) = Pi.prod f g := rfl #align linear_map.coe_prod LinearMap.coe_prod @[simp] theorem fst_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : (fst R M₂ M₃).comp (prod f g) = f := rfl #align linear_map.fst_prod LinearMap.fst_prod @[simp] theorem snd_prod (f : M →ₗ[R] M₂) (g : M →ₗ[R] M₃) : (snd R M₂ M₃).comp (prod f g) = g := rfl #align linear_map.snd_prod LinearMap.snd_prod @[simp] theorem pair_fst_snd : prod (fst R M M₂) (snd R M M₂) = LinearMap.id := rfl #align linear_map.pair_fst_snd LinearMap.pair_fst_snd theorem prod_comp (f : M₂ →ₗ[R] M₃) (g : M₂ →ₗ[R] M₄) (h : M →ₗ[R] M₂) : (f.prod g).comp h = (f.comp h).prod (g.comp h) := rfl @[simps] def prodEquiv [Module S M₂] [Module S M₃] [SMulCommClass R S M₂] [SMulCommClass R S M₃] : ((M →ₗ[R] M₂) × (M →ₗ[R] M₃)) ≃ₗ[S] M →ₗ[R] M₂ × M₃ where toFun f := f.1.prod f.2 invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f) left_inv f := by ext <;> rfl right_inv f := by ext <;> rfl map_add' a b := rfl map_smul' r a := rfl #align linear_map.prod_equiv LinearMap.prodEquiv section variable (R M M₂) def inl : M →ₗ[R] M × M₂ := prod LinearMap.id 0 #align linear_map.inl LinearMap.inl def inr : M₂ →ₗ[R] M × M₂ := prod 0 LinearMap.id #align linear_map.inr LinearMap.inr theorem range_inl : range (inl R M M₂) = ker (snd R M M₂) := by ext x simp only [mem_ker, mem_range] constructor · rintro ⟨y, rfl⟩ rfl · intro h exact ⟨x.fst, Prod.ext rfl h.symm⟩ #align linear_map.range_inl LinearMap.range_inl theorem ker_snd : ker (snd R M M₂) = range (inl R M M₂) := Eq.symm <| range_inl R M M₂ #align linear_map.ker_snd LinearMap.ker_snd
Mathlib/LinearAlgebra/Prod.lean
162
169
theorem range_inr : range (inr R M M₂) = ker (fst R M M₂) := by
ext x simp only [mem_ker, mem_range] constructor · rintro ⟨y, rfl⟩ rfl · intro h exact ⟨x.snd, Prod.ext h.symm rfl⟩
[ " Pi.prod (⇑f) (⇑g) (x + y) = Pi.prod (⇑f) (⇑g) x + Pi.prod (⇑f) (⇑g) y", " { toFun := Pi.prod ⇑f ⇑g, map_add' := ⋯ }.toFun (c • x) =\n (RingHom.id R) c • { toFun := Pi.prod ⇑f ⇑g, map_add' := ⋯ }.toFun x", " (fun f => (fst R M₂ M₃ ∘ₗ f, snd R M₂ M₃ ∘ₗ f))\n ({ toFun := fun f => f.1.prod f.2, map_add' :...
[ " Pi.prod (⇑f) (⇑g) (x + y) = Pi.prod (⇑f) (⇑g) x + Pi.prod (⇑f) (⇑g) y", " { toFun := Pi.prod ⇑f ⇑g, map_add' := ⋯ }.toFun (c • x) =\n (RingHom.id R) c • { toFun := Pi.prod ⇑f ⇑g, map_add' := ⋯ }.toFun x", " (fun f => (fst R M₂ M₃ ∘ₗ f, snd R M₂ M₃ ∘ₗ f))\n ({ toFun := fun f => f.1.prod f.2, map_add' :...
import Mathlib.Data.Multiset.Nodup #align_import data.multiset.sum from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Sum namespace Multiset variable {α β : Type*} (s : Multiset α) (t : Multiset β) def disjSum : Multiset (Sum α β) := s.map inl + t.map inr #align multiset.disj_sum Multiset.disjSum @[simp] theorem zero_disjSum : (0 : Multiset α).disjSum t = t.map inr := zero_add _ #align multiset.zero_disj_sum Multiset.zero_disjSum @[simp] theorem disjSum_zero : s.disjSum (0 : Multiset β) = s.map inl := add_zero _ #align multiset.disj_sum_zero Multiset.disjSum_zero @[simp] theorem card_disjSum : Multiset.card (s.disjSum t) = Multiset.card s + Multiset.card t := by rw [disjSum, card_add, card_map, card_map] #align multiset.card_disj_sum Multiset.card_disjSum variable {s t} {s₁ s₂ : Multiset α} {t₁ t₂ : Multiset β} {a : α} {b : β} {x : Sum α β} theorem mem_disjSum : x ∈ s.disjSum t ↔ (∃ a, a ∈ s ∧ inl a = x) ∨ ∃ b, b ∈ t ∧ inr b = x := by simp_rw [disjSum, mem_add, mem_map] #align multiset.mem_disj_sum Multiset.mem_disjSum @[simp] theorem inl_mem_disjSum : inl a ∈ s.disjSum t ↔ a ∈ s := by rw [mem_disjSum, or_iff_left] -- Porting note: Previous code for L62 was: simp only [exists_eq_right] · simp only [inl.injEq, exists_eq_right] rintro ⟨b, _, hb⟩ exact inr_ne_inl hb #align multiset.inl_mem_disj_sum Multiset.inl_mem_disjSum @[simp]
Mathlib/Data/Multiset/Sum.lean
64
69
theorem inr_mem_disjSum : inr b ∈ s.disjSum t ↔ b ∈ t := by
rw [mem_disjSum, or_iff_right] -- Porting note: Previous code for L72 was: simp only [exists_eq_right] · simp only [inr.injEq, exists_eq_right] rintro ⟨a, _, ha⟩ exact inl_ne_inr ha
[ " card (s.disjSum t) = card s + card t", " x ∈ s.disjSum t ↔ (∃ a ∈ s, inl a = x) ∨ ∃ b ∈ t, inr b = x", " inl a ∈ s.disjSum t ↔ a ∈ s", " (∃ a_1 ∈ s, inl a_1 = inl a) ↔ a ∈ s", " ¬∃ b ∈ t, inr b = inl a", " False", " inr b ∈ s.disjSum t ↔ b ∈ t", " (∃ b_1 ∈ t, inr b_1 = inr b) ↔ b ∈ t", " ¬∃ a ∈ s,...
[ " card (s.disjSum t) = card s + card t", " x ∈ s.disjSum t ↔ (∃ a ∈ s, inl a = x) ∨ ∃ b ∈ t, inr b = x", " inl a ∈ s.disjSum t ↔ a ∈ s", " (∃ a_1 ∈ s, inl a_1 = inl a) ↔ a ∈ s", " ¬∃ b ∈ t, inr b = inl a", " False" ]
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics import Mathlib.NumberTheory.Liouville.Basic import Mathlib.Topology.Instances.Irrational #align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Filter Metric Real Set open scoped Filter Topology def LiouvilleWith (p x : ℝ) : Prop := ∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p #align liouville_with LiouvilleWith theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by use 2 refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently have hn' : (0 : ℝ) < n := by simpa have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by rw [lt_div_iff hn', Int.cast_add, Int.cast_one]; exact Int.lt_floor_add_one _ refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩ rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add', add_div_eq_mul_add_div _ _ hn'.ne'] gcongr calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le _ < x * n + 2 := by linarith #align liouville_with_one liouvilleWith_one namespace LiouvilleWith variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ} theorem exists_pos (h : LiouvilleWith p x) : ∃ (C : ℝ) (_h₀ : 0 < C), ∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by rcases h with ⟨C, hC⟩ refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩ refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_ rintro n ⟨hle, m, hne, hlt⟩ refine ⟨hle, m, hne, hlt.trans_le ?_⟩ gcongr apply le_max_left #align liouville_with.exists_pos LiouvilleWith.exists_pos theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by rcases h.exists_pos with ⟨C, hC₀, hC⟩ refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩ refine ⟨m, hne, hlt.trans_le <| ?_⟩ gcongr exact_mod_cast hn #align liouville_with.mono LiouvilleWith.mono theorem frequently_lt_rpow_neg (h : LiouvilleWith p x) (hlt : q < p) : ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < n ^ (-q) := by rcases h.exists_pos with ⟨C, _hC₀, hC⟩ have : ∀ᶠ n : ℕ in atTop, C < n ^ (p - q) := by simpa only [(· ∘ ·), neg_sub, one_div] using ((tendsto_rpow_atTop (sub_pos.2 hlt)).comp tendsto_natCast_atTop_atTop).eventually (eventually_gt_atTop C) refine (this.and_frequently hC).mono ?_ rintro n ⟨hnC, hn, m, hne, hlt⟩ replace hn : (0 : ℝ) < n := Nat.cast_pos.2 hn refine ⟨m, hne, hlt.trans <| (div_lt_iff <| rpow_pos_of_pos hn _).2 ?_⟩ rwa [mul_comm, ← rpow_add hn, ← sub_eq_add_neg] #align liouville_with.frequently_lt_rpow_neg LiouvilleWith.frequently_lt_rpow_neg
Mathlib/NumberTheory/Liouville/LiouvilleWith.lean
114
128
theorem mul_rat (h : LiouvilleWith p x) (hr : r ≠ 0) : LiouvilleWith p (x * r) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩ refine ⟨r.den ^ p * (|r| * C), (tendsto_id.nsmul_atTop r.pos).frequently (hC.mono ?_)⟩ rintro n ⟨_hn, m, hne, hlt⟩ have A : (↑(r.num * m) : ℝ) / ↑(r.den • id n) = m / n * r := by simp [← div_mul_div_comm, ← r.cast_def, mul_comm] refine ⟨r.num * m, ?_, ?_⟩ · rw [A]; simp [hne, hr] · rw [A, ← sub_mul, abs_mul] simp only [smul_eq_mul, id, Nat.cast_mul] calc _ < C / ↑n ^ p * |↑r| := by gcongr _ = ↑r.den ^ p * (↑|r| * C) / (↑r.den * ↑n) ^ p := ?_ rw [mul_rpow, mul_div_mul_left, mul_comm, mul_div_assoc] · simp only [Rat.cast_abs, le_refl] all_goals positivity
[ " LiouvilleWith 1 x", " ∃ᶠ (n : ℕ) in atTop, ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " 0 < ↑n", " x < ↑(⌊x * ↑n⌋ + 1) / ↑n", " x * ↑n < ↑⌊x * ↑n⌋ + 1", " |x - ↑(⌊x * ↑n⌋ + 1) / ↑n| < 2 / ↑n ^ 1", " ↑(⌊x * ↑n⌋ + 1) / ↑n < (x * ↑n + 2) / ↑n", "...
[ " LiouvilleWith 1 x", " ∃ᶠ (n : ℕ) in atTop, ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " 0 < ↑n", " x < ↑(⌊x * ↑n⌋ + 1) / ↑n", " x * ↑n < ↑⌊x * ↑n⌋ + 1", " |x - ↑(⌊x * ↑n⌋ + 1) / ↑n| < 2 / ↑n ^ 1", " ↑(⌊x * ↑n⌋ + 1) / ↑n < (x * ↑n + 2) / ↑n", "...
import Mathlib.Order.Filter.Lift import Mathlib.Topology.Separation import Mathlib.Order.Interval.Set.Monotone #align_import topology.filter from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set Filter TopologicalSpace open Filter Topology variable {ι : Sort*} {α β X Y : Type*} namespace Filter instance : TopologicalSpace (Filter α) := generateFrom <| range <| Iic ∘ 𝓟 theorem isOpen_Iic_principal {s : Set α} : IsOpen (Iic (𝓟 s)) := GenerateOpen.basic _ (mem_range_self _) #align filter.is_open_Iic_principal Filter.isOpen_Iic_principal theorem isOpen_setOf_mem {s : Set α} : IsOpen { l : Filter α | s ∈ l } := by simpa only [Iic_principal] using isOpen_Iic_principal #align filter.is_open_set_of_mem Filter.isOpen_setOf_mem theorem isTopologicalBasis_Iic_principal : IsTopologicalBasis (range (Iic ∘ 𝓟 : Set α → Set (Filter α))) := { exists_subset_inter := by rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩ l hl exact ⟨Iic (𝓟 s) ∩ Iic (𝓟 t), ⟨s ∩ t, by simp⟩, hl, Subset.rfl⟩ sUnion_eq := sUnion_eq_univ_iff.2 fun l => ⟨Iic ⊤, ⟨univ, congr_arg Iic principal_univ⟩, mem_Iic.2 le_top⟩ eq_generateFrom := rfl } #align filter.is_topological_basis_Iic_principal Filter.isTopologicalBasis_Iic_principal theorem isOpen_iff {s : Set (Filter α)} : IsOpen s ↔ ∃ T : Set (Set α), s = ⋃ t ∈ T, Iic (𝓟 t) := isTopologicalBasis_Iic_principal.open_iff_eq_sUnion.trans <| by simp only [exists_subset_range_and_iff, sUnion_image, (· ∘ ·)] #align filter.is_open_iff Filter.isOpen_iff theorem nhds_eq (l : Filter α) : 𝓝 l = l.lift' (Iic ∘ 𝓟) := nhds_generateFrom.trans <| by simp only [mem_setOf_eq, @and_comm (l ∈ _), iInf_and, iInf_range, Filter.lift', Filter.lift, (· ∘ ·), mem_Iic, le_principal_iff] #align filter.nhds_eq Filter.nhds_eq theorem nhds_eq' (l : Filter α) : 𝓝 l = l.lift' fun s => { l' | s ∈ l' } := by simpa only [(· ∘ ·), Iic_principal] using nhds_eq l #align filter.nhds_eq' Filter.nhds_eq' protected theorem tendsto_nhds {la : Filter α} {lb : Filter β} {f : α → Filter β} : Tendsto f la (𝓝 lb) ↔ ∀ s ∈ lb, ∀ᶠ a in la, s ∈ f a := by simp only [nhds_eq', tendsto_lift', mem_setOf_eq] #align filter.tendsto_nhds Filter.tendsto_nhds protected theorem HasBasis.nhds {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis (𝓝 l) p fun i => Iic (𝓟 (s i)) := by rw [nhds_eq] exact h.lift' monotone_principal.Iic #align filter.has_basis.nhds Filter.HasBasis.nhds protected theorem tendsto_pure_self (l : Filter X) : Tendsto (pure : X → Filter X) l (𝓝 l) := by rw [Filter.tendsto_nhds] exact fun s hs ↦ Eventually.mono hs fun x ↦ id instance {l : Filter α} [IsCountablyGenerated l] : IsCountablyGenerated (𝓝 l) := let ⟨_b, hb⟩ := l.exists_antitone_basis HasCountableBasis.isCountablyGenerated <| ⟨hb.nhds, Set.to_countable _⟩ theorem HasBasis.nhds' {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis (𝓝 l) p fun i => { l' | s i ∈ l' } := by simpa only [Iic_principal] using h.nhds #align filter.has_basis.nhds' Filter.HasBasis.nhds' protected theorem mem_nhds_iff {l : Filter α} {S : Set (Filter α)} : S ∈ 𝓝 l ↔ ∃ t ∈ l, Iic (𝓟 t) ⊆ S := l.basis_sets.nhds.mem_iff #align filter.mem_nhds_iff Filter.mem_nhds_iff theorem mem_nhds_iff' {l : Filter α} {S : Set (Filter α)} : S ∈ 𝓝 l ↔ ∃ t ∈ l, ∀ ⦃l' : Filter α⦄, t ∈ l' → l' ∈ S := l.basis_sets.nhds'.mem_iff #align filter.mem_nhds_iff' Filter.mem_nhds_iff' @[simp] theorem nhds_bot : 𝓝 (⊥ : Filter α) = pure ⊥ := by simp [nhds_eq, (· ∘ ·), lift'_bot monotone_principal.Iic] #align filter.nhds_bot Filter.nhds_bot @[simp] theorem nhds_top : 𝓝 (⊤ : Filter α) = ⊤ := by simp [nhds_eq] #align filter.nhds_top Filter.nhds_top @[simp] theorem nhds_principal (s : Set α) : 𝓝 (𝓟 s) = 𝓟 (Iic (𝓟 s)) := (hasBasis_principal s).nhds.eq_of_same_basis (hasBasis_principal _) #align filter.nhds_principal Filter.nhds_principal @[simp] theorem nhds_pure (x : α) : 𝓝 (pure x : Filter α) = 𝓟 {⊥, pure x} := by rw [← principal_singleton, nhds_principal, principal_singleton, Iic_pure] #align filter.nhds_pure Filter.nhds_pure @[simp]
Mathlib/Topology/Filter.lean
139
141
theorem nhds_iInf (f : ι → Filter α) : 𝓝 (⨅ i, f i) = ⨅ i, 𝓝 (f i) := by
simp only [nhds_eq] apply lift'_iInf_of_map_univ <;> simp
[ " IsOpen {l | s ∈ l}", " ∀ t₁ ∈ range (Iic ∘ 𝓟), ∀ t₂ ∈ range (Iic ∘ 𝓟), ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ range (Iic ∘ 𝓟), x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂", " ∃ t₃ ∈ range (Iic ∘ 𝓟), l ∈ t₃ ∧ t₃ ⊆ (Iic ∘ 𝓟) s ∩ (Iic ∘ 𝓟) t", " (Iic ∘ 𝓟) (s ∩ t) = Iic (𝓟 s) ∩ Iic (𝓟 t)", " (∃ S ⊆ range (Iic ∘ 𝓟), s = ⋃₀ S) ↔ ∃ T, s = ⋃...
[ " IsOpen {l | s ∈ l}", " ∀ t₁ ∈ range (Iic ∘ 𝓟), ∀ t₂ ∈ range (Iic ∘ 𝓟), ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ range (Iic ∘ 𝓟), x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂", " ∃ t₃ ∈ range (Iic ∘ 𝓟), l ∈ t₃ ∧ t₃ ⊆ (Iic ∘ 𝓟) s ∩ (Iic ∘ 𝓟) t", " (Iic ∘ 𝓟) (s ∩ t) = Iic (𝓟 s) ∩ Iic (𝓟 t)", " (∃ S ⊆ range (Iic ∘ 𝓟), s = ⋃₀ S) ↔ ∃ T, s = ⋃...
import Mathlib.Order.CompleteLattice import Mathlib.Order.GaloisConnection import Mathlib.Data.Set.Lattice import Mathlib.Tactic.AdaptationNote #align_import data.rel from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2" variable {α β γ : Type*} def Rel (α β : Type*) := α → β → Prop -- deriving CompleteLattice, Inhabited #align rel Rel -- Porting note: `deriving` above doesn't work. instance : CompleteLattice (Rel α β) := show CompleteLattice (α → β → Prop) from inferInstance instance : Inhabited (Rel α β) := show Inhabited (α → β → Prop) from inferInstance namespace Rel variable (r : Rel α β) -- Porting note: required for later theorems. @[ext] theorem ext {r s : Rel α β} : (∀ a, r a = s a) → r = s := funext def inv : Rel β α := flip r #align rel.inv Rel.inv theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y := Iff.rfl #align rel.inv_def Rel.inv_def
Mathlib/Data/Rel.lean
70
72
theorem inv_inv : inv (inv r) = r := by
ext x y rfl
[ " r.inv.inv = r", " r.inv.inv x y ↔ r x y" ]
[]
import Mathlib.Algebra.FreeMonoid.Basic import Mathlib.Algebra.Group.Submonoid.MulOpposite import Mathlib.Algebra.Group.Submonoid.Operations import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Data.Finset.NoncommProd import Mathlib.Data.Int.Order.Lemmas #align_import group_theory.submonoid.membership from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802" variable {M A B : Type*} section Assoc variable [Monoid M] [SetLike B M] [SubmonoidClass B M] {S : B} namespace Submonoid variable [Monoid M] {a : M} open MonoidHom theorem closure_singleton_eq (x : M) : closure ({x} : Set M) = mrange (powersHom M x) := closure_eq_of_le (Set.singleton_subset_iff.2 ⟨Multiplicative.ofAdd 1, pow_one x⟩) fun _ ⟨_, hn⟩ => hn ▸ pow_mem (subset_closure <| Set.mem_singleton _) _ #align submonoid.closure_singleton_eq Submonoid.closure_singleton_eq theorem mem_closure_singleton {x y : M} : y ∈ closure ({x} : Set M) ↔ ∃ n : ℕ, x ^ n = y := by rw [closure_singleton_eq, mem_mrange]; rfl #align submonoid.mem_closure_singleton Submonoid.mem_closure_singleton theorem mem_closure_singleton_self {y : M} : y ∈ closure ({y} : Set M) := mem_closure_singleton.2 ⟨1, pow_one y⟩ #align submonoid.mem_closure_singleton_self Submonoid.mem_closure_singleton_self
Mathlib/Algebra/Group/Submonoid/Membership.lean
340
341
theorem closure_singleton_one : closure ({1} : Set M) = ⊥ := by
simp [eq_bot_iff_forall, mem_closure_singleton]
[ " y ∈ closure {x} ↔ ∃ n, x ^ n = y", " (∃ x_1, ((powersHom M) x) x_1 = y) ↔ ∃ n, x ^ n = y", " closure {1} = ⊥" ]
[ " y ∈ closure {x} ↔ ∃ n, x ^ n = y", " (∃ x_1, ((powersHom M) x) x_1 = y) ↔ ∃ n, x ^ n = y" ]
import Batteries.Tactic.Lint.Basic import Mathlib.Algebra.Order.Monoid.Unbundled.Basic import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Order import Mathlib.Init.Data.Int.Order set_option autoImplicit true namespace Linarith theorem lt_irrefl {α : Type u} [Preorder α] {a : α} : ¬a < a := _root_.lt_irrefl a theorem eq_of_eq_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b = 0) : a + b = 0 := by simp [*] theorem le_of_eq_of_le {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b ≤ 0) : a + b ≤ 0 := by simp [*]
Mathlib/Tactic/Linarith/Lemmas.lean
33
34
theorem lt_of_eq_of_lt {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b < 0) : a + b < 0 := by
simp [*]
[ " a + b = 0", " a + b ≤ 0", " a + b < 0" ]
[ " a + b = 0", " a + b ≤ 0" ]
import Mathlib.Data.DFinsupp.Basic #align_import data.dfinsupp.ne_locus from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α : Type*} {N : α → Type*} namespace DFinsupp variable [DecidableEq α] section NHasZero variable [∀ a, DecidableEq (N a)] [∀ a, Zero (N a)] (f g : Π₀ a, N a) def neLocus (f g : Π₀ a, N a) : Finset α := (f.support ∪ g.support).filter fun x ↦ f x ≠ g x #align dfinsupp.ne_locus DFinsupp.neLocus @[simp]
Mathlib/Data/DFinsupp/NeLocus.lean
41
43
theorem mem_neLocus {f g : Π₀ a, N a} {a : α} : a ∈ f.neLocus g ↔ f a ≠ g a := by
simpa only [neLocus, Finset.mem_filter, Finset.mem_union, mem_support_iff, and_iff_right_iff_imp] using Ne.ne_or_ne _
[ " a ∈ f.neLocus g ↔ f a ≠ g a" ]
[]
import Mathlib.Data.List.Lattice import Mathlib.Data.List.Range import Mathlib.Data.Bool.Basic #align_import data.list.intervals from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213" open Nat namespace List def Ico (n m : ℕ) : List ℕ := range' n (m - n) #align list.Ico List.Ico namespace Ico theorem zero_bot (n : ℕ) : Ico 0 n = range n := by rw [Ico, Nat.sub_zero, range_eq_range'] #align list.Ico.zero_bot List.Ico.zero_bot @[simp] theorem length (n m : ℕ) : length (Ico n m) = m - n := by dsimp [Ico] simp [length_range', autoParam] #align list.Ico.length List.Ico.length theorem pairwise_lt (n m : ℕ) : Pairwise (· < ·) (Ico n m) := by dsimp [Ico] simp [pairwise_lt_range', autoParam] #align list.Ico.pairwise_lt List.Ico.pairwise_lt theorem nodup (n m : ℕ) : Nodup (Ico n m) := by dsimp [Ico] simp [nodup_range', autoParam] #align list.Ico.nodup List.Ico.nodup @[simp] theorem mem {n m l : ℕ} : l ∈ Ico n m ↔ n ≤ l ∧ l < m := by suffices n ≤ l ∧ l < n + (m - n) ↔ n ≤ l ∧ l < m by simp [Ico, this] rcases le_total n m with hnm | hmn · rw [Nat.add_sub_cancel' hnm] · rw [Nat.sub_eq_zero_iff_le.mpr hmn, Nat.add_zero] exact and_congr_right fun hnl => Iff.intro (fun hln => (not_le_of_gt hln hnl).elim) fun hlm => lt_of_lt_of_le hlm hmn #align list.Ico.mem List.Ico.mem theorem eq_nil_of_le {n m : ℕ} (h : m ≤ n) : Ico n m = [] := by simp [Ico, Nat.sub_eq_zero_iff_le.mpr h] #align list.Ico.eq_nil_of_le List.Ico.eq_nil_of_le theorem map_add (n m k : ℕ) : (Ico n m).map (k + ·) = Ico (n + k) (m + k) := by rw [Ico, Ico, map_add_range', Nat.add_sub_add_right m k, Nat.add_comm n k] #align list.Ico.map_add List.Ico.map_add theorem map_sub (n m k : ℕ) (h₁ : k ≤ n) : ((Ico n m).map fun x => x - k) = Ico (n - k) (m - k) := by rw [Ico, Ico, Nat.sub_sub_sub_cancel_right h₁, map_sub_range' _ _ _ h₁] #align list.Ico.map_sub List.Ico.map_sub @[simp] theorem self_empty {n : ℕ} : Ico n n = [] := eq_nil_of_le (le_refl n) #align list.Ico.self_empty List.Ico.self_empty @[simp] theorem eq_empty_iff {n m : ℕ} : Ico n m = [] ↔ m ≤ n := Iff.intro (fun h => Nat.sub_eq_zero_iff_le.mp <| by rw [← length, h, List.length]) eq_nil_of_le #align list.Ico.eq_empty_iff List.Ico.eq_empty_iff theorem append_consecutive {n m l : ℕ} (hnm : n ≤ m) (hml : m ≤ l) : Ico n m ++ Ico m l = Ico n l := by dsimp only [Ico] convert range'_append n (m-n) (l-m) 1 using 2 · rw [Nat.one_mul, Nat.add_sub_cancel' hnm] · rw [Nat.sub_add_sub_cancel hml hnm] #align list.Ico.append_consecutive List.Ico.append_consecutive @[simp] theorem inter_consecutive (n m l : ℕ) : Ico n m ∩ Ico m l = [] := by apply eq_nil_iff_forall_not_mem.2 intro a simp only [and_imp, not_and, not_lt, List.mem_inter_iff, List.Ico.mem] intro _ h₂ h₃ exfalso exact not_lt_of_ge h₃ h₂ #align list.Ico.inter_consecutive List.Ico.inter_consecutive @[simp] theorem bagInter_consecutive (n m l : Nat) : @List.bagInter ℕ instBEqOfDecidableEq (Ico n m) (Ico m l) = [] := (bagInter_nil_iff_inter_nil _ _).2 (by convert inter_consecutive n m l) #align list.Ico.bag_inter_consecutive List.Ico.bagInter_consecutive @[simp]
Mathlib/Data/List/Intervals.lean
120
122
theorem succ_singleton {n : ℕ} : Ico n (n + 1) = [n] := by
dsimp [Ico] simp [range', Nat.add_sub_cancel_left]
[ " Ico 0 n = range n", " (Ico n m).length = m - n", " (range' n (m - n)).length = m - n", " Pairwise (fun x x_1 => x < x_1) (Ico n m)", " Pairwise (fun x x_1 => x < x_1) (range' n (m - n))", " (Ico n m).Nodup", " (range' n (m - n)).Nodup", " l ∈ Ico n m ↔ n ≤ l ∧ l < m", " n ≤ l ∧ l < n + (m - n) ↔ n...
[ " Ico 0 n = range n", " (Ico n m).length = m - n", " (range' n (m - n)).length = m - n", " Pairwise (fun x x_1 => x < x_1) (Ico n m)", " Pairwise (fun x x_1 => x < x_1) (range' n (m - n))", " (Ico n m).Nodup", " (range' n (m - n)).Nodup", " l ∈ Ico n m ↔ n ≤ l ∧ l < m", " n ≤ l ∧ l < n + (m - n) ↔ n...
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow import Mathlib.Data.Finset.Fold import Mathlib.Data.Finset.Option import Mathlib.Data.Finset.Pi import Mathlib.Data.Finset.Prod import Mathlib.Data.Multiset.Lattice import Mathlib.Data.Set.Lattice import Mathlib.Order.Hom.Lattice import Mathlib.Order.Nat #align_import data.finset.lattice from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d" -- TODO: -- assert_not_exists OrderedCommMonoid assert_not_exists MonoidWithZero open Function Multiset OrderDual variable {F α β γ ι κ : Type*} namespace Finset section Sup -- TODO: define with just `[Bot α]` where some lemmas hold without requiring `[OrderBot α]` variable [SemilatticeSup α] [OrderBot α] def sup (s : Finset β) (f : β → α) : α := s.fold (· ⊔ ·) ⊥ f #align finset.sup Finset.sup variable {s s₁ s₂ : Finset β} {f g : β → α} {a : α} theorem sup_def : s.sup f = (s.1.map f).sup := rfl #align finset.sup_def Finset.sup_def @[simp] theorem sup_empty : (∅ : Finset β).sup f = ⊥ := fold_empty #align finset.sup_empty Finset.sup_empty @[simp] theorem sup_cons {b : β} (h : b ∉ s) : (cons b s h).sup f = f b ⊔ s.sup f := fold_cons h #align finset.sup_cons Finset.sup_cons @[simp] theorem sup_insert [DecidableEq β] {b : β} : (insert b s : Finset β).sup f = f b ⊔ s.sup f := fold_insert_idem #align finset.sup_insert Finset.sup_insert @[simp] theorem sup_image [DecidableEq β] (s : Finset γ) (f : γ → β) (g : β → α) : (s.image f).sup g = s.sup (g ∘ f) := fold_image_idem #align finset.sup_image Finset.sup_image @[simp] theorem sup_map (s : Finset γ) (f : γ ↪ β) (g : β → α) : (s.map f).sup g = s.sup (g ∘ f) := fold_map #align finset.sup_map Finset.sup_map @[simp] theorem sup_singleton {b : β} : ({b} : Finset β).sup f = f b := Multiset.sup_singleton #align finset.sup_singleton Finset.sup_singleton
Mathlib/Data/Finset/Lattice.lean
82
87
theorem sup_sup : s.sup (f ⊔ g) = s.sup f ⊔ s.sup g := by
induction s using Finset.cons_induction with | empty => rw [sup_empty, sup_empty, sup_empty, bot_sup_eq] | cons _ _ _ ih => rw [sup_cons, sup_cons, sup_cons, ih] exact sup_sup_sup_comm _ _ _ _
[ " s.sup (f ⊔ g) = s.sup f ⊔ s.sup g", " ∅.sup (f ⊔ g) = ∅.sup f ⊔ ∅.sup g", " (cons a✝ s✝ h✝).sup (f ⊔ g) = (cons a✝ s✝ h✝).sup f ⊔ (cons a✝ s✝ h✝).sup g", " (f ⊔ g) a✝ ⊔ (s✝.sup f ⊔ s✝.sup g) = f a✝ ⊔ s✝.sup f ⊔ (g a✝ ⊔ s✝.sup g)" ]
[]
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.BigOperators import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.LinearAlgebra.Finsupp import Mathlib.Tactic.FinCases #align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Affine namespace Finset theorem univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := by ext x fin_cases x <;> simp #align finset.univ_fin2 Finset.univ_fin2 variable {k : Type*} {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [S : AffineSpace V P] variable {ι : Type*} (s : Finset ι) variable {ι₂ : Type*} (s₂ : Finset ι₂) def weightedVSubOfPoint (p : ι → P) (b : P) : (ι → k) →ₗ[k] V := ∑ i ∈ s, (LinearMap.proj i : (ι → k) →ₗ[k] k).smulRight (p i -ᵥ b) #align finset.weighted_vsub_of_point Finset.weightedVSubOfPoint @[simp] theorem weightedVSubOfPoint_apply (w : ι → k) (p : ι → P) (b : P) : s.weightedVSubOfPoint p b w = ∑ i ∈ s, w i • (p i -ᵥ b) := by simp [weightedVSubOfPoint, LinearMap.sum_apply] #align finset.weighted_vsub_of_point_apply Finset.weightedVSubOfPoint_apply @[simp (high)]
Mathlib/LinearAlgebra/AffineSpace/Combination.lean
79
81
theorem weightedVSubOfPoint_apply_const (w : ι → k) (p : P) (b : P) : s.weightedVSubOfPoint (fun _ => p) b w = (∑ i ∈ s, w i) • (p -ᵥ b) := by
rw [weightedVSubOfPoint_apply, sum_smul]
[ " univ = {0, 1}", " x ∈ univ ↔ x ∈ {0, 1}", " ⟨0, ⋯⟩ ∈ univ ↔ ⟨0, ⋯⟩ ∈ {0, 1}", " ⟨1, ⋯⟩ ∈ univ ↔ ⟨1, ⋯⟩ ∈ {0, 1}", " (s.weightedVSubOfPoint p b) w = ∑ i ∈ s, w i • (p i -ᵥ b)", " (s.weightedVSubOfPoint (fun x => p) b) w = (∑ i ∈ s, w i) • (p -ᵥ b)" ]
[ " univ = {0, 1}", " x ∈ univ ↔ x ∈ {0, 1}", " ⟨0, ⋯⟩ ∈ univ ↔ ⟨0, ⋯⟩ ∈ {0, 1}", " ⟨1, ⋯⟩ ∈ univ ↔ ⟨1, ⋯⟩ ∈ {0, 1}", " (s.weightedVSubOfPoint p b) w = ∑ i ∈ s, w i • (p i -ᵥ b)" ]
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd" namespace Polynomial open Polynomial Finsupp Finset open Polynomial section Semiring variable {R : Type*} [Semiring R] {f : R[X]} def revAtFun (N i : ℕ) : ℕ := ite (i ≤ N) (N - i) i #align polynomial.rev_at_fun Polynomial.revAtFun theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by unfold revAtFun split_ifs with h j · exact tsub_tsub_cancel_of_le h · exfalso apply j exact Nat.sub_le N i · rfl #align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by intro a b hab rw [← @revAtFun_invol N a, hab, revAtFun_invol] #align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj def revAt (N : ℕ) : Function.Embedding ℕ ℕ where toFun i := ite (i ≤ N) (N - i) i inj' := revAtFun_inj #align polynomial.rev_at Polynomial.revAt @[simp] theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i := rfl #align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq @[simp] theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i := revAtFun_invol #align polynomial.rev_at_invol Polynomial.revAt_invol @[simp] theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i := if_pos H #align polynomial.rev_at_le Polynomial.revAt_le lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h] theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) : revAt (N + O) (n + o) = revAt N n + revAt O o := by rcases Nat.le.dest hn with ⟨n', rfl⟩ rcases Nat.le.dest ho with ⟨o', rfl⟩ repeat' rw [revAt_le (le_add_right rfl.le)] rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)] repeat' rw [add_tsub_cancel_left] #align polynomial.rev_at_add Polynomial.revAt_add -- @[simp] -- Porting note (#10618): simp can prove this theorem revAt_zero (N : ℕ) : revAt N 0 = N := by simp #align polynomial.rev_at_zero Polynomial.revAt_zero noncomputable def reflect (N : ℕ) : R[X] → R[X] | ⟨f⟩ => ⟨Finsupp.embDomain (revAt N) f⟩ #align polynomial.reflect Polynomial.reflect theorem reflect_support (N : ℕ) (f : R[X]) : (reflect N f).support = Finset.image (revAt N) f.support := by rcases f with ⟨⟩ ext1 simp only [reflect, support_ofFinsupp, support_embDomain, Finset.mem_map, Finset.mem_image] #align polynomial.reflect_support Polynomial.reflect_support @[simp] theorem coeff_reflect (N : ℕ) (f : R[X]) (i : ℕ) : coeff (reflect N f) i = f.coeff (revAt N i) := by rcases f with ⟨f⟩ simp only [reflect, coeff] calc Finsupp.embDomain (revAt N) f i = Finsupp.embDomain (revAt N) f (revAt N (revAt N i)) := by rw [revAt_invol] _ = f (revAt N i) := Finsupp.embDomain_apply _ _ _ #align polynomial.coeff_reflect Polynomial.coeff_reflect @[simp] theorem reflect_zero {N : ℕ} : reflect N (0 : R[X]) = 0 := rfl #align polynomial.reflect_zero Polynomial.reflect_zero @[simp] theorem reflect_eq_zero_iff {N : ℕ} {f : R[X]} : reflect N (f : R[X]) = 0 ↔ f = 0 := by rw [ofFinsupp_eq_zero, reflect, embDomain_eq_zero, ofFinsupp_eq_zero] #align polynomial.reflect_eq_zero_iff Polynomial.reflect_eq_zero_iff @[simp] theorem reflect_add (f g : R[X]) (N : ℕ) : reflect N (f + g) = reflect N f + reflect N g := by ext simp only [coeff_add, coeff_reflect] #align polynomial.reflect_add Polynomial.reflect_add @[simp] theorem reflect_C_mul (f : R[X]) (r : R) (N : ℕ) : reflect N (C r * f) = C r * reflect N f := by ext simp only [coeff_reflect, coeff_C_mul] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C_mul Polynomial.reflect_C_mul -- @[simp] -- Porting note (#10618): simp can prove this (once `reflect_monomial` is in simp scope) theorem reflect_C_mul_X_pow (N n : ℕ) {c : R} : reflect N (C c * X ^ n) = C c * X ^ revAt N n := by ext rw [reflect_C_mul, coeff_C_mul, coeff_C_mul, coeff_X_pow, coeff_reflect] split_ifs with h · rw [h, revAt_invol, coeff_X_pow_self] · rw [not_mem_support_iff.mp] intro a rw [← one_mul (X ^ n), ← C_1] at a apply h rw [← mem_support_C_mul_X_pow a, revAt_invol] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C_mul_X_pow Polynomial.reflect_C_mul_X_pow @[simp]
Mathlib/Algebra/Polynomial/Reverse.lean
160
161
theorem reflect_C (r : R) (N : ℕ) : reflect N (C r) = C r * X ^ N := by
conv_lhs => rw [← mul_one (C r), ← pow_zero X, reflect_C_mul_X_pow, revAt_zero]
[ " revAtFun N (revAtFun N i) = i", " (if (if i ≤ N then N - i else i) ≤ N then N - if i ≤ N then N - i else i else if i ≤ N then N - i else i) = i", " N - (N - i) = i", " N - i = i", " False", " N - i ≤ N", " i = i", " Function.Injective (revAtFun N)", " a = b", " (revAt N) i = i", " (revAt (N + ...
[ " revAtFun N (revAtFun N i) = i", " (if (if i ≤ N then N - i else i) ≤ N then N - if i ≤ N then N - i else i else if i ≤ N then N - i else i) = i", " N - (N - i) = i", " N - i = i", " False", " N - i ≤ N", " i = i", " Function.Injective (revAtFun N)", " a = b", " (revAt N) i = i", " (revAt (N + ...
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Combinatorics.SimpleGraph.Basic import Mathlib.Data.Rat.Cast.Order import Mathlib.Order.Partition.Finpartition import Mathlib.Tactic.GCongr import Mathlib.Tactic.NormNum import Mathlib.Tactic.Positivity import Mathlib.Tactic.Ring #align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1" open Finset variable {𝕜 ι κ α β : Type*} namespace Rel section Asymmetric variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α} {t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜} def interedges (s : Finset α) (t : Finset β) : Finset (α × β) := (s ×ˢ t).filter fun e ↦ r e.1 e.2 #align rel.interedges Rel.interedges def edgeDensity (s : Finset α) (t : Finset β) : ℚ := (interedges r s t).card / (s.card * t.card) #align rel.edge_density Rel.edgeDensity variable {r} theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by rw [interedges, mem_filter, Finset.mem_product, and_assoc] #align rel.mem_interedges_iff Rel.mem_interedges_iff theorem mk_mem_interedges_iff : (a, b) ∈ interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b := mem_interedges_iff #align rel.mk_mem_interedges_iff Rel.mk_mem_interedges_iff @[simp] theorem interedges_empty_left (t : Finset β) : interedges r ∅ t = ∅ := by rw [interedges, Finset.empty_product, filter_empty] #align rel.interedges_empty_left Rel.interedges_empty_left theorem interedges_mono (hs : s₂ ⊆ s₁) (ht : t₂ ⊆ t₁) : interedges r s₂ t₂ ⊆ interedges r s₁ t₁ := fun x ↦ by simp_rw [mem_interedges_iff] exact fun h ↦ ⟨hs h.1, ht h.2.1, h.2.2⟩ #align rel.interedges_mono Rel.interedges_mono variable (r) theorem card_interedges_add_card_interedges_compl (s : Finset α) (t : Finset β) : (interedges r s t).card + (interedges (fun x y ↦ ¬r x y) s t).card = s.card * t.card := by classical rw [← card_product, interedges, interedges, ← card_union_of_disjoint, filter_union_filter_neg_eq] exact disjoint_filter.2 fun _ _ ↦ Classical.not_not.2 #align rel.card_interedges_add_card_interedges_compl Rel.card_interedges_add_card_interedges_compl
Mathlib/Combinatorics/SimpleGraph/Density.lean
85
90
theorem interedges_disjoint_left {s s' : Finset α} (hs : Disjoint s s') (t : Finset β) : Disjoint (interedges r s t) (interedges r s' t) := by
rw [Finset.disjoint_left] at hs ⊢ intro _ hx hy rw [mem_interedges_iff] at hx hy exact hs hx.1 hy.1
[ " x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2", " interedges r ∅ t = ∅", " x ∈ interedges r s₂ t₂ → x ∈ interedges r s₁ t₁", " x.1 ∈ s₂ ∧ x.2 ∈ t₂ ∧ r x.1 x.2 → x.1 ∈ s₁ ∧ x.2 ∈ t₁ ∧ r x.1 x.2", " (interedges r s t).card + (interedges (fun x y => ¬r x y) s t).card = s.card * t.card", " Disjoint (...
[ " x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2", " interedges r ∅ t = ∅", " x ∈ interedges r s₂ t₂ → x ∈ interedges r s₁ t₁", " x.1 ∈ s₂ ∧ x.2 ∈ t₂ ∧ r x.1 x.2 → x.1 ∈ s₁ ∧ x.2 ∈ t₁ ∧ r x.1 x.2", " (interedges r s t).card + (interedges (fun x y => ¬r x y) s t).card = s.card * t.card", " Disjoint (...
import Mathlib.Algebra.Module.Equiv import Mathlib.Data.DFinsupp.Basic import Mathlib.Data.Finsupp.Basic #align_import data.finsupp.to_dfinsupp from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" variable {ι : Type*} {R : Type*} {M : Type*} section Defs def Finsupp.toDFinsupp [Zero M] (f : ι →₀ M) : Π₀ _ : ι, M where toFun := f support' := Trunc.mk ⟨f.support.1, fun i => (Classical.em (f i = 0)).symm.imp_left Finsupp.mem_support_iff.mpr⟩ #align finsupp.to_dfinsupp Finsupp.toDFinsupp @[simp] theorem Finsupp.toDFinsupp_coe [Zero M] (f : ι →₀ M) : ⇑f.toDFinsupp = f := rfl #align finsupp.to_dfinsupp_coe Finsupp.toDFinsupp_coe section variable [DecidableEq ι] [Zero M] @[simp]
Mathlib/Data/Finsupp/ToDFinsupp.lean
88
91
theorem Finsupp.toDFinsupp_single (i : ι) (m : M) : (Finsupp.single i m).toDFinsupp = DFinsupp.single i m := by
ext simp [Finsupp.single_apply, DFinsupp.single_apply]
[ " (single i m).toDFinsupp = DFinsupp.single i m", " (single i m).toDFinsupp i✝ = (DFinsupp.single i m) i✝" ]
[]
import Mathlib.CategoryTheory.Sites.Canonical #align_import category_theory.sites.types from "leanprover-community/mathlib"@"9f9015c645d85695581237cc761981036be8bd37" universe u namespace CategoryTheory --open scoped CategoryTheory.Type -- Porting note: unknown namespace def typesGrothendieckTopology : GrothendieckTopology (Type u) where sieves α S := ∀ x : α, S fun _ : PUnit => x top_mem' _ _ := trivial pullback_stable' _ _ _ f hs x := hs (f x) transitive' _ _ hs _ hr x := hr (hs x) PUnit.unit #align category_theory.types_grothendieck_topology CategoryTheory.typesGrothendieckTopology @[simps] def discreteSieve (α : Type u) : Sieve α where arrows _ f := ∃ x, ∀ y, f y = x downward_closed := fun ⟨x, hx⟩ g => ⟨x, fun y => hx <| g y⟩ #align category_theory.discrete_sieve CategoryTheory.discreteSieve theorem discreteSieve_mem (α : Type u) : discreteSieve α ∈ typesGrothendieckTopology α := fun x => ⟨x, fun _ => rfl⟩ #align category_theory.discrete_sieve_mem CategoryTheory.discreteSieve_mem def discretePresieve (α : Type u) : Presieve α := fun β _ => ∃ x : β, ∀ y : β, y = x #align category_theory.discrete_presieve CategoryTheory.discretePresieve theorem generate_discretePresieve_mem (α : Type u) : Sieve.generate (discretePresieve α) ∈ typesGrothendieckTopology α := fun x => ⟨PUnit, id, fun _ => x, ⟨PUnit.unit, fun _ => Subsingleton.elim _ _⟩, rfl⟩ #align category_theory.generate_discrete_presieve_mem CategoryTheory.generate_discretePresieve_mem open Presieve theorem isSheaf_yoneda' {α : Type u} : IsSheaf typesGrothendieckTopology (yoneda.obj α) := fun β S hs x hx => ⟨fun y => x _ (hs y) PUnit.unit, fun γ f h => funext fun z => by convert congr_fun (hx (𝟙 _) (fun _ => z) (hs <| f z) h rfl) PUnit.unit using 1, fun f hf => funext fun y => by convert congr_fun (hf _ (hs y)) PUnit.unit⟩ #align category_theory.is_sheaf_yoneda' CategoryTheory.isSheaf_yoneda' @[simps] def yoneda' : Type u ⥤ SheafOfTypes typesGrothendieckTopology where obj α := ⟨yoneda.obj α, isSheaf_yoneda'⟩ map f := ⟨yoneda.map f⟩ #align category_theory.yoneda' CategoryTheory.yoneda' @[simp] theorem yoneda'_comp : yoneda'.{u} ⋙ sheafOfTypesToPresheaf _ = yoneda := rfl #align category_theory.yoneda'_comp CategoryTheory.yoneda'_comp open Opposite def eval (P : Type uᵒᵖ ⥤ Type u) (α : Type u) (s : P.obj (op α)) (x : α) : P.obj (op PUnit) := P.map (↾fun _ => x).op s #align category_theory.eval CategoryTheory.eval noncomputable def typesGlue (S : Type uᵒᵖ ⥤ Type u) (hs : IsSheaf typesGrothendieckTopology S) (α : Type u) (f : α → S.obj (op PUnit)) : S.obj (op α) := (hs.isSheafFor _ _ (generate_discretePresieve_mem α)).amalgamate (fun β g hg => S.map (↾fun _ => PUnit.unit).op <| f <| g <| Classical.choose hg) fun β γ δ g₁ g₂ f₁ f₂ hf₁ hf₂ h => (hs.isSheafFor _ _ (generate_discretePresieve_mem δ)).isSeparatedFor.ext fun ε g ⟨x, _⟩ => by have : f₁ (Classical.choose hf₁) = f₂ (Classical.choose hf₂) := Classical.choose_spec hf₁ (g₁ <| g x) ▸ Classical.choose_spec hf₂ (g₂ <| g x) ▸ congr_fun h _ simp_rw [← FunctorToTypes.map_comp_apply, this, ← op_comp] rfl #align category_theory.types_glue CategoryTheory.typesGlue theorem eval_typesGlue {S hs α} (f) : eval.{u} S α (typesGlue S hs α f) = f := by funext x apply (IsSheafFor.valid_glue _ _ _ <| ⟨PUnit.unit, fun _ => Subsingleton.elim _ _⟩).trans convert FunctorToTypes.map_id_apply S _ #align category_theory.eval_types_glue CategoryTheory.eval_typesGlue
Mathlib/CategoryTheory/Sites/Types.lean
108
117
theorem typesGlue_eval {S hs α} (s) : typesGlue.{u} S hs α (eval S α s) = s := by
apply (hs.isSheafFor _ _ (generate_discretePresieve_mem α)).isSeparatedFor.ext intro β f hf apply (IsSheafFor.valid_glue _ _ _ hf).trans apply (FunctorToTypes.map_comp_apply _ _ _ _).symm.trans rw [← op_comp] --congr 2 -- Porting note: This tactic didn't work. Find an alternative. suffices ((↾fun _ ↦ PUnit.unit) ≫ ↾fun _ ↦ f (Classical.choose hf)) = f by rw [this] funext x exact congr_arg f (Classical.choose_spec hf x).symm
[ " (yoneda.obj α).map f.op (fun y => x (fun x => y) ⋯ PUnit.unit) z = x f h z", " f y = x (fun x => y) ⋯ PUnit.unit", " S.map g.op (S.map g₁.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op (f (g (Classical.choose hg)))) β f₁ hf₁)) =\n S.map g.op (S.map g₂.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op ...
[ " (yoneda.obj α).map f.op (fun y => x (fun x => y) ⋯ PUnit.unit) z = x f h z", " f y = x (fun x => y) ⋯ PUnit.unit", " S.map g.op (S.map g₁.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op (f (g (Classical.choose hg)))) β f₁ hf₁)) =\n S.map g.op (S.map g₂.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op ...