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.Dynamics.Ergodic.AddCircle import Mathlib.MeasureTheory.Covering.LiminfLimsup #align_import number_theory.well_approximable from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open Set Filter Function Metric MeasureTheory open scoped MeasureTheory Topology Pointwise @[to_additive "In a seminormed additive group `A`, given `n : ℕ` and `δ : ℝ`, `approxAddOrderOf A n δ` is the set of elements within a distance `δ` of a point of order `n`."] def approxOrderOf (A : Type*) [SeminormedGroup A] (n : ℕ) (δ : ℝ) : Set A := thickening δ {y | orderOf y = n} #align approx_order_of approxOrderOf #align approx_add_order_of approxAddOrderOf @[to_additive mem_approx_add_orderOf_iff] theorem mem_approxOrderOf_iff {A : Type*} [SeminormedGroup A] {n : ℕ} {δ : ℝ} {a : A} : a ∈ approxOrderOf A n δ ↔ ∃ b : A, orderOf b = n ∧ a ∈ ball b δ := by simp only [approxOrderOf, thickening_eq_biUnion_ball, mem_iUnion₂, mem_setOf_eq, exists_prop] #align mem_approx_order_of_iff mem_approxOrderOf_iff #align mem_approx_add_order_of_iff mem_approx_add_orderOf_iff @[to_additive addWellApproximable "In a seminormed additive group `A`, given a sequence of distances `δ₁, δ₂, ...`, `addWellApproximable A δ` is the limsup as `n → ∞` of the sets `approxAddOrderOf A n δₙ`. Thus, it is the set of points that lie in infinitely many of the sets `approxAddOrderOf A n δₙ`."] def wellApproximable (A : Type*) [SeminormedGroup A] (δ : ℕ → ℝ) : Set A := blimsup (fun n => approxOrderOf A n (δ n)) atTop fun n => 0 < n #align well_approximable wellApproximable #align add_well_approximable addWellApproximable @[to_additive mem_add_wellApproximable_iff] theorem mem_wellApproximable_iff {A : Type*} [SeminormedGroup A] {δ : ℕ → ℝ} {a : A} : a ∈ wellApproximable A δ ↔ a ∈ blimsup (fun n => approxOrderOf A n (δ n)) atTop fun n => 0 < n := Iff.rfl #align mem_well_approximable_iff mem_wellApproximable_iff #align mem_add_well_approximable_iff mem_add_wellApproximable_iff namespace UnitAddCircle theorem mem_approxAddOrderOf_iff {δ : ℝ} {x : UnitAddCircle} {n : ℕ} (hn : 0 < n) : x ∈ approxAddOrderOf UnitAddCircle n δ ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑((m : ℝ) / n)‖ < δ := by simp only [mem_approx_add_orderOf_iff, mem_setOf_eq, ball, exists_prop, dist_eq_norm, AddCircle.addOrderOf_eq_pos_iff hn, mul_one] constructor · rintro ⟨y, ⟨m, hm₁, hm₂, rfl⟩, hx⟩; exact ⟨m, hm₁, hm₂, hx⟩ · rintro ⟨m, hm₁, hm₂, hx⟩; exact ⟨↑((m : ℝ) / n), ⟨m, hm₁, hm₂, rfl⟩, hx⟩ #align unit_add_circle.mem_approx_add_order_of_iff UnitAddCircle.mem_approxAddOrderOf_iff
Mathlib/NumberTheory/WellApproximable.lean
183
191
theorem mem_addWellApproximable_iff (δ : ℕ → ℝ) (x : UnitAddCircle) : x ∈ addWellApproximable UnitAddCircle δ ↔ {n : ℕ | ∃ m < n, gcd m n = 1 ∧ ‖x - ↑((m : ℝ) / n)‖ < δ n}.Infinite := by
simp only [mem_add_wellApproximable_iff, ← Nat.cofinite_eq_atTop, cofinite.blimsup_set_eq, mem_setOf_eq] refine iff_of_eq (congr_arg Set.Infinite <| ext fun n => ⟨fun hn => ?_, fun hn => ?_⟩) · exact (mem_approxAddOrderOf_iff hn.1).mp hn.2 · have h : 0 < n := by obtain ⟨m, hm₁, _, _⟩ := hn; exact pos_of_gt hm₁ exact ⟨h, (mem_approxAddOrderOf_iff h).mpr hn⟩
[ " a ∈ approxOrderOf A n δ ↔ ∃ b, orderOf b = n ∧ a ∈ ball b δ", " x ∈ approxAddOrderOf UnitAddCircle n δ ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑(↑m / ↑n)‖ < δ", " (∃ b, (∃ m < n, m.gcd n = 1 ∧ ↑(↑m / ↑n) = b) ∧ ‖x - b‖ < δ) ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑(↑m / ↑n)‖ < δ", " (∃ b, (∃ m < n, m.gcd n = 1 ∧ ↑(↑m / ↑n) = b...
[ " a ∈ approxOrderOf A n δ ↔ ∃ b, orderOf b = n ∧ a ∈ ball b δ", " x ∈ approxAddOrderOf UnitAddCircle n δ ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑(↑m / ↑n)‖ < δ", " (∃ b, (∃ m < n, m.gcd n = 1 ∧ ↑(↑m / ↑n) = b) ∧ ‖x - b‖ < δ) ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑(↑m / ↑n)‖ < δ", " (∃ b, (∃ m < n, m.gcd n = 1 ∧ ↑(↑m / ↑n) = b...
import Mathlib.Data.PNat.Prime import Mathlib.Algebra.IsPrimePow import Mathlib.NumberTheory.Cyclotomic.Basic import Mathlib.RingTheory.Adjoin.PowerBasis import Mathlib.RingTheory.Polynomial.Cyclotomic.Eval import Mathlib.RingTheory.Norm import Mathlib.RingTheory.Polynomial.Cyclotomic.Expand #align_import number_theory.cyclotomic.primitive_roots from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32" open Polynomial Algebra Finset FiniteDimensional IsCyclotomicExtension Nat PNat Set open scoped IntermediateField universe u v w z variable {p n : ℕ+} (A : Type w) (B : Type z) (K : Type u) {L : Type v} (C : Type w) variable [CommRing A] [CommRing B] [Algebra A B] [IsCyclotomicExtension {n} A B] section Zeta section NoOrder variable [Field K] [CommRing L] [IsDomain L] [Algebra K L] [IsCyclotomicExtension {n} K L] {ζ : L} (hζ : IsPrimitiveRoot ζ n) namespace IsPrimitiveRoot variable {C} @[simps!] protected noncomputable def powerBasis : PowerBasis K L := PowerBasis.map (Algebra.adjoin.powerBasis <| (integral {n} K L).isIntegral ζ) <| (Subalgebra.equivOfEq _ _ (IsCyclotomicExtension.adjoin_primitive_root_eq_top hζ)).trans Subalgebra.topEquiv #align is_primitive_root.power_basis IsPrimitiveRoot.powerBasis
Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
128
131
theorem powerBasis_gen_mem_adjoin_zeta_sub_one : (hζ.powerBasis K).gen ∈ adjoin K ({ζ - 1} : Set L) := by
rw [powerBasis_gen, adjoin_singleton_eq_range_aeval, AlgHom.mem_range] exact ⟨X + 1, by simp⟩
[ " (IsPrimitiveRoot.powerBasis K hζ).gen ∈ adjoin K {ζ - 1}", " ∃ x, (aeval (ζ - 1)) x = ζ", " (aeval (ζ - 1)) (X + 1) = ζ" ]
[]
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Topology.Order.ProjIcc #align_import analysis.special_functions.trigonometric.inverse from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Topology Filter open Set Filter open Real namespace Real variable {x y : ℝ} -- @[pp_nodot] Porting note: not implemented noncomputable def arcsin : ℝ → ℝ := Subtype.val ∘ IccExtend (neg_le_self zero_le_one) sinOrderIso.symm #align real.arcsin Real.arcsin theorem arcsin_mem_Icc (x : ℝ) : arcsin x ∈ Icc (-(π / 2)) (π / 2) := Subtype.coe_prop _ #align real.arcsin_mem_Icc Real.arcsin_mem_Icc @[simp] theorem range_arcsin : range arcsin = Icc (-(π / 2)) (π / 2) := by rw [arcsin, range_comp Subtype.val] simp [Icc] #align real.range_arcsin Real.range_arcsin theorem arcsin_le_pi_div_two (x : ℝ) : arcsin x ≤ π / 2 := (arcsin_mem_Icc x).2 #align real.arcsin_le_pi_div_two Real.arcsin_le_pi_div_two theorem neg_pi_div_two_le_arcsin (x : ℝ) : -(π / 2) ≤ arcsin x := (arcsin_mem_Icc x).1 #align real.neg_pi_div_two_le_arcsin Real.neg_pi_div_two_le_arcsin
Mathlib/Analysis/SpecialFunctions/Trigonometric/Inverse.lean
58
61
theorem arcsin_projIcc (x : ℝ) : arcsin (projIcc (-1) 1 (neg_le_self zero_le_one) x) = arcsin x := by
rw [arcsin, Function.comp_apply, IccExtend_val, Function.comp_apply, IccExtend, Function.comp_apply]
[ " range arcsin = Icc (-(π / 2)) (π / 2)", " Subtype.val '' range (IccExtend arcsin.proof_2 ⇑sinOrderIso.symm) = Icc (-(π / 2)) (π / 2)", " (↑(projIcc (-1) 1 ⋯ x)).arcsin = x.arcsin" ]
[ " range arcsin = Icc (-(π / 2)) (π / 2)", " Subtype.val '' range (IccExtend arcsin.proof_2 ⇑sinOrderIso.symm) = Icc (-(π / 2)) (π / 2)" ]
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat import Mathlib.RepresentationTheory.GroupCohomology.Basic import Mathlib.RepresentationTheory.Invariants universe v u noncomputable section open CategoryTheory Limits Representation variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G) namespace groupCohomology section IsCocycle section variable {G A : Type*} [Mul G] [AddCommGroup A] [SMul G A] def IsOneCocycle (f : G → A) : Prop := ∀ g h : G, f (g * h) = g • f h + f g def IsTwoCocycle (f : G × G → A) : Prop := ∀ g h j : G, f (g * h, j) + f (g, h) = g • (f (h, j)) + f (g, h * j) end section variable {G A : Type*} [Monoid G] [AddCommGroup A] [MulAction G A] theorem map_one_of_isOneCocycle {f : G → A} (hf : IsOneCocycle f) : f 1 = 0 := by simpa only [mul_one, one_smul, self_eq_add_right] using hf 1 1 theorem map_one_fst_of_isTwoCocycle {f : G × G → A} (hf : IsTwoCocycle f) (g : G) : f (1, g) = f (1, 1) := by simpa only [one_smul, one_mul, mul_one, add_right_inj] using (hf 1 1 g).symm theorem map_one_snd_of_isTwoCocycle {f : G × G → A} (hf : IsTwoCocycle f) (g : G) : f (g, 1) = g • f (1, 1) := by simpa only [mul_one, add_left_inj] using hf g 1 1 end section variable {G A : Type*} [Group G] [AddCommGroup A] [MulAction G A] @[simp] theorem map_inv_of_isOneCocycle {f : G → A} (hf : IsOneCocycle f) (g : G) : g • f g⁻¹ = - f g := by rw [← add_eq_zero_iff_eq_neg, ← map_one_of_isOneCocycle hf, ← mul_inv_self g, hf g g⁻¹]
Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean
423
427
theorem smul_map_inv_sub_map_inv_of_isTwoCocycle {f : G × G → A} (hf : IsTwoCocycle f) (g : G) : g • f (g⁻¹, g) - f (g, g⁻¹) = f (1, 1) - f (g, 1) := by
have := hf g g⁻¹ g simp only [mul_right_inv, mul_left_inv, map_one_fst_of_isTwoCocycle hf g] at this exact sub_eq_sub_iff_add_eq_add.2 this.symm
[ " f 1 = 0", " f (1, g) = f (1, 1)", " f (g, 1) = g • f (1, 1)", " g • f g⁻¹ = -f g", " g • f (g⁻¹, g) - f (g, g⁻¹) = f (1, 1) - f (g, 1)" ]
[ " f 1 = 0", " f (1, g) = f (1, 1)", " f (g, 1) = g • f (1, 1)", " g • f g⁻¹ = -f g" ]
import Mathlib.Topology.GDelta #align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a" noncomputable section open scoped Topology open Filter Set TopologicalSpace variable {X α : Type*} {ι : Sort*} section BaireTheorem variable [TopologicalSpace X] [BaireSpace X] theorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) := BaireSpace.baire_property f ho hd #align dense_Inter_of_open_nat dense_iInter_of_isOpen_nat theorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable) (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by rcases S.eq_empty_or_nonempty with h | h · simp [h] · rcases hS.exists_eq_range h with ⟨f, rfl⟩ exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd) #align dense_sInter_of_open dense_sInter_of_isOpen theorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s)) (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by rw [← sInter_image] refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image] #align dense_bInter_of_open dense_biInter_of_isOpen theorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i)) (hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) := dense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd) #align dense_Inter_of_open dense_iInter_of_isOpen theorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by constructor · rw [mem_residual_iff] rintro ⟨S, hSo, hSd, Sct, Ss⟩ refine ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, ?_⟩ exact dense_sInter_of_isOpen hSo Sct hSd rintro ⟨t, ts, ho, hd⟩ exact mem_of_superset (residual_of_dense_Gδ ho hd) ts #align mem_residual mem_residual theorem eventually_residual {p : X → Prop} : (∀ᶠ x in residual X, p x) ↔ ∃ t : Set X, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x := by simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq] tauto #align eventually_residual eventually_residual theorem dense_of_mem_residual {s : Set X} (hs : s ∈ residual X) : Dense s := let ⟨_, hts, _, hd⟩ := mem_residual.1 hs hd.mono hts #align dense_of_mem_residual dense_of_mem_residual theorem dense_sInter_of_Gδ {S : Set (Set X)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable) (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := dense_of_mem_residual ((countable_sInter_mem hS).mpr (fun _ hs => residual_of_dense_Gδ (ho _ hs) (hd _ hs))) set_option linter.uppercaseLean3 false in #align dense_sInter_of_Gδ dense_sInter_of_Gδ theorem dense_iInter_of_Gδ [Countable ι] {f : ι → Set X} (ho : ∀ s, IsGδ (f s)) (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) := dense_sInter_of_Gδ (forall_mem_range.2 ‹_›) (countable_range _) (forall_mem_range.2 ‹_›) set_option linter.uppercaseLean3 false in #align dense_Inter_of_Gδ dense_iInter_of_Gδ theorem dense_biInter_of_Gδ {S : Set α} {f : ∀ x ∈ S, Set X} (ho : ∀ s (H : s ∈ S), IsGδ (f s H)) (hS : S.Countable) (hd : ∀ s (H : s ∈ S), Dense (f s H)) : Dense (⋂ s ∈ S, f s ‹_›) := by rw [biInter_eq_iInter] haveI := hS.to_subtype exact dense_iInter_of_Gδ (fun s => ho s s.2) fun s => hd s s.2 set_option linter.uppercaseLean3 false in #align dense_bInter_of_Gδ dense_biInter_of_Gδ theorem Dense.inter_of_Gδ {s t : Set X} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s) (htc : Dense t) : Dense (s ∩ t) := by rw [inter_eq_iInter] apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *] set_option linter.uppercaseLean3 false in #align dense.inter_of_Gδ Dense.inter_of_Gδ
Mathlib/Topology/Baire/Lemmas.lean
132
145
theorem IsGδ.dense_iUnion_interior_of_closed [Countable ι] {s : Set X} (hs : IsGδ s) (hd : Dense s) {f : ι → Set X} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) : Dense (⋃ i, interior (f i)) := by
let g i := (frontier (f i))ᶜ have hgo : ∀ i, IsOpen (g i) := fun i => isClosed_frontier.isOpen_compl have hgd : Dense (⋂ i, g i) := by refine dense_iInter_of_isOpen hgo fun i x => ?_ rw [closure_compl, interior_frontier (hc _)] exact id refine (hd.inter_of_Gδ hs (.iInter_of_isOpen fun i => (hgo i)) hgd).mono ?_ rintro x ⟨hxs, hxg⟩ rw [mem_iInter] at hxg rcases mem_iUnion.1 (hU hxs) with ⟨i, hi⟩ exact mem_iUnion.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
[ " Dense (⋂₀ S)", " Dense (⋂₀ range f)", " Dense (⋂ s ∈ S, f s)", " Dense (⋂₀ ((fun s => f s) '' S))", " ∀ s ∈ (fun s => f s) '' S, IsOpen s", " ∀ s ∈ (fun s => f s) '' S, Dense s", " s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t", " s ∈ residual X → ∃ t ⊆ s, IsGδ t ∧ Dense t", " (∃ S, (∀ t ∈ S, IsOpen ...
[ " Dense (⋂₀ S)", " Dense (⋂₀ range f)", " Dense (⋂ s ∈ S, f s)", " Dense (⋂₀ ((fun s => f s) '' S))", " ∀ s ∈ (fun s => f s) '' S, IsOpen s", " ∀ s ∈ (fun s => f s) '' S, Dense s", " s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t", " s ∈ residual X → ∃ t ⊆ s, IsGδ t ∧ Dense t", " (∃ S, (∀ t ∈ S, IsOpen ...
import Mathlib.CategoryTheory.Sites.Subsheaf import Mathlib.CategoryTheory.Sites.CompatibleSheafification import Mathlib.CategoryTheory.Sites.LocallyInjective #align_import category_theory.sites.surjective from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v u w v' u' w' open Opposite CategoryTheory CategoryTheory.GrothendieckTopology namespace CategoryTheory variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike variable {A : Type u'} [Category.{v'} A] [ConcreteCategory.{w'} A] namespace Presheaf @[simps (config := .lemmasOnly)] def imageSieve {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : Sieve U where arrows V i := ∃ t : F.obj (op V), f.app _ t = G.map i.op s downward_closed := by rintro V W i ⟨t, ht⟩ j refine ⟨F.map j.op t, ?_⟩ rw [op_comp, G.map_comp, comp_apply, ← ht, elementwise_of% f.naturality] #align category_theory.image_sieve CategoryTheory.Presheaf.imageSieve theorem imageSieve_eq_sieveOfSection {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve f s = (imagePresheaf (whiskerRight f (forget A))).sieveOfSection s := rfl #align category_theory.image_sieve_eq_sieve_of_section CategoryTheory.Presheaf.imageSieve_eq_sieveOfSection theorem imageSieve_whisker_forget {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve (whiskerRight f (forget A)) s = imageSieve f s := rfl #align category_theory.image_sieve_whisker_forget CategoryTheory.Presheaf.imageSieve_whisker_forget theorem imageSieve_app {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : F.obj (op U)) : imageSieve f (f.app _ s) = ⊤ := by ext V i simp only [Sieve.top_apply, iff_true_iff, imageSieve_apply] have := elementwise_of% (f.naturality i.op) exact ⟨F.map i.op s, this s⟩ #align category_theory.image_sieve_app CategoryTheory.Presheaf.imageSieve_app noncomputable def localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U) {V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) : F.obj (op V) := hg.choose @[simp] lemma app_localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U) {V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) : f.app _ (localPreimage f s g hg) = G.map g.op s := hg.choose_spec class IsLocallySurjective {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : Prop where imageSieve_mem {U : C} (s : G.obj (op U)) : imageSieve f s ∈ J U #align category_theory.is_locally_surjective CategoryTheory.Presheaf.IsLocallySurjective lemma imageSieve_mem {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] {U : Cᵒᵖ} (s : G.obj U) : imageSieve f s ∈ J U.unop := IsLocallySurjective.imageSieve_mem _ instance {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] : IsLocallySurjective J (whiskerRight f (forget A)) where imageSieve_mem s := imageSieve_mem J f s theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : IsLocallySurjective J f ↔ (imagePresheaf (whiskerRight f (forget A))).sheafify J = ⊤ := by simp only [Subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj, Set.top_eq_univ, Set.mem_univ, iff_true_iff] exact ⟨fun H _ => H.imageSieve_mem, fun H => ⟨H _⟩⟩ #align category_theory.is_locally_surjective_iff_image_presheaf_sheafify_eq_top CategoryTheory.Presheaf.isLocallySurjective_iff_imagePresheaf_sheafify_eq_top theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top' {F G : Cᵒᵖ ⥤ Type w} (f : F ⟶ G) : IsLocallySurjective J f ↔ (imagePresheaf f).sheafify J = ⊤ := by apply isLocallySurjective_iff_imagePresheaf_sheafify_eq_top #align category_theory.is_locally_surjective_iff_image_presheaf_sheafify_eq_top' CategoryTheory.Presheaf.isLocallySurjective_iff_imagePresheaf_sheafify_eq_top' theorem isLocallySurjective_iff_whisker_forget {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : IsLocallySurjective J f ↔ IsLocallySurjective J (whiskerRight f (forget A)) := by simp only [isLocallySurjective_iff_imagePresheaf_sheafify_eq_top] rfl #align category_theory.is_locally_surjective_iff_whisker_forget CategoryTheory.Presheaf.isLocallySurjective_iff_whisker_forget
Mathlib/CategoryTheory/Sites/LocallySurjective.lean
119
124
theorem isLocallySurjective_of_surjective {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) (H : ∀ U, Function.Surjective (f.app U)) : IsLocallySurjective J f where imageSieve_mem {U} s := by
obtain ⟨t, rfl⟩ := H _ s rw [imageSieve_app] exact J.top_mem _
[ " ∀ {Y Z : C} {f_1 : Y ⟶ U},\n (fun V i => ∃ t, (f.app { unop := V }) t = (G.map i.op) s) Y f_1 →\n ∀ (g : Z ⟶ Y), (fun V i => ∃ t, (f.app { unop := V }) t = (G.map i.op) s) Z (g ≫ f_1)", " ∃ t, (f.app { unop := W }) t = (G.map (j ≫ i).op) s", " (f.app { unop := W }) ((F.map j.op) t) = (G.map (j ≫ i).op...
[ " ∀ {Y Z : C} {f_1 : Y ⟶ U},\n (fun V i => ∃ t, (f.app { unop := V }) t = (G.map i.op) s) Y f_1 →\n ∀ (g : Z ⟶ Y), (fun V i => ∃ t, (f.app { unop := V }) t = (G.map i.op) s) Z (g ≫ f_1)", " ∃ t, (f.app { unop := W }) t = (G.map (j ≫ i).op) s", " (f.app { unop := W }) ((F.map j.op) t) = (G.map (j ≫ i).op...
import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.Group.Pi.Basic import Mathlib.Order.Fin import Mathlib.Order.PiLex import Mathlib.Order.Interval.Set.Basic #align_import data.fin.tuple.basic from "leanprover-community/mathlib"@"ef997baa41b5c428be3fb50089a7139bf4ee886b" assert_not_exists MonoidWithZero universe u v namespace Fin variable {m n : ℕ} open Function section Tuple example (α : Fin 0 → Sort u) : Unique (∀ i : Fin 0, α i) := by infer_instance theorem tuple0_le {α : Fin 0 → Type*} [∀ i, Preorder (α i)] (f g : ∀ i, α i) : f ≤ g := finZeroElim #align fin.tuple0_le Fin.tuple0_le variable {α : Fin (n + 1) → Type u} (x : α 0) (q : ∀ i, α i) (p : ∀ i : Fin n, α i.succ) (i : Fin n) (y : α i.succ) (z : α 0) def tail (q : ∀ i, α i) : ∀ i : Fin n, α i.succ := fun i ↦ q i.succ #align fin.tail Fin.tail theorem tail_def {n : ℕ} {α : Fin (n + 1) → Type*} {q : ∀ i, α i} : (tail fun k : Fin (n + 1) ↦ q k) = fun k : Fin n ↦ q k.succ := rfl #align fin.tail_def Fin.tail_def def cons (x : α 0) (p : ∀ i : Fin n, α i.succ) : ∀ i, α i := fun j ↦ Fin.cases x p j #align fin.cons Fin.cons @[simp] theorem tail_cons : tail (cons x p) = p := by simp (config := { unfoldPartialApp := true }) [tail, cons] #align fin.tail_cons Fin.tail_cons @[simp] theorem cons_succ : cons x p i.succ = p i := by simp [cons] #align fin.cons_succ Fin.cons_succ @[simp] theorem cons_zero : cons x p 0 = x := by simp [cons] #align fin.cons_zero Fin.cons_zero @[simp] theorem cons_one {α : Fin (n + 2) → Type*} (x : α 0) (p : ∀ i : Fin n.succ, α i.succ) : cons x p 1 = p 0 := by rw [← cons_succ x p]; rfl @[simp] theorem cons_update : cons x (update p i y) = update (cons x p) i.succ y := by ext j by_cases h : j = 0 · rw [h] simp [Ne.symm (succ_ne_zero i)] · let j' := pred j h have : j'.succ = j := succ_pred j h rw [← this, cons_succ] by_cases h' : j' = i · rw [h'] simp · have : j'.succ ≠ i.succ := by rwa [Ne, succ_inj] rw [update_noteq h', update_noteq this, cons_succ] #align fin.cons_update Fin.cons_update theorem cons_injective2 : Function.Injective2 (@cons n α) := fun x₀ y₀ x y h ↦ ⟨congr_fun h 0, funext fun i ↦ by simpa using congr_fun h (Fin.succ i)⟩ #align fin.cons_injective2 Fin.cons_injective2 @[simp] theorem cons_eq_cons {x₀ y₀ : α 0} {x y : ∀ i : Fin n, α i.succ} : cons x₀ x = cons y₀ y ↔ x₀ = y₀ ∧ x = y := cons_injective2.eq_iff #align fin.cons_eq_cons Fin.cons_eq_cons theorem cons_left_injective (x : ∀ i : Fin n, α i.succ) : Function.Injective fun x₀ ↦ cons x₀ x := cons_injective2.left _ #align fin.cons_left_injective Fin.cons_left_injective theorem cons_right_injective (x₀ : α 0) : Function.Injective (cons x₀) := cons_injective2.right _ #align fin.cons_right_injective Fin.cons_right_injective theorem update_cons_zero : update (cons x p) 0 z = cons z p := by ext j by_cases h : j = 0 · rw [h] simp · simp only [h, update_noteq, Ne, not_false_iff] let j' := pred j h have : j'.succ = j := succ_pred j h rw [← this, cons_succ, cons_succ] #align fin.update_cons_zero Fin.update_cons_zero @[simp, nolint simpNF] -- Porting note: linter claims LHS doesn't simplify
Mathlib/Data/Fin/Tuple/Basic.lean
141
150
theorem cons_self_tail : cons (q 0) (tail q) = q := by
ext j by_cases h : j = 0 · rw [h] simp · let j' := pred j h have : j'.succ = j := succ_pred j h rw [← this] unfold tail rw [cons_succ]
[ " Unique ((i : Fin 0) → α i)", " tail (cons x p) = p", " cons x p i.succ = p i", " cons x p 0 = x", " cons x p 1 = p 0", " cons x p 1 = cons x p (succ 0)", " cons x (update p i y) = update (cons x p) i.succ y", " cons x (update p i y) j = update (cons x p) i.succ y j", " cons x (update p i y) 0 = up...
[ " Unique ((i : Fin 0) → α i)", " tail (cons x p) = p", " cons x p i.succ = p i", " cons x p 0 = x", " cons x p 1 = p 0", " cons x p 1 = cons x p (succ 0)", " cons x (update p i y) = update (cons x p) i.succ y", " cons x (update p i y) j = update (cons x p) i.succ y j", " cons x (update p i y) 0 = up...
import Mathlib.AlgebraicGeometry.Properties #align_import algebraic_geometry.function_field from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 set_option linter.uppercaseLean3 false universe u v open TopologicalSpace Opposite CategoryTheory CategoryTheory.Limits TopCat namespace AlgebraicGeometry variable (X : Scheme) noncomputable abbrev Scheme.functionField [IrreducibleSpace X.carrier] : CommRingCat := X.presheaf.stalk (genericPoint X.carrier) #align algebraic_geometry.Scheme.function_field AlgebraicGeometry.Scheme.functionField noncomputable abbrev Scheme.germToFunctionField [IrreducibleSpace X.carrier] (U : Opens X.carrier) [h : Nonempty U] : X.presheaf.obj (op U) ⟶ X.functionField := X.presheaf.germ ⟨genericPoint X.carrier, ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ #align algebraic_geometry.Scheme.germ_to_function_field AlgebraicGeometry.Scheme.germToFunctionField noncomputable instance [IrreducibleSpace X.carrier] (U : Opens X.carrier) [Nonempty U] : Algebra (X.presheaf.obj (op U)) X.functionField := (X.germToFunctionField U).toAlgebra noncomputable instance [IsIntegral X] : Field X.functionField := by refine .ofIsUnitOrEqZero fun a ↦ ?_ obtain ⟨U, m, s, rfl⟩ := TopCat.Presheaf.germ_exist _ _ a rw [or_iff_not_imp_right, ← (X.presheaf.germ ⟨_, m⟩).map_zero] intro ha replace ha := ne_of_apply_ne _ ha have hs : genericPoint X.carrier ∈ RingedSpace.basicOpen _ s := by rw [← SetLike.mem_coe, (genericPoint_spec X.carrier).mem_open_set_iff, Set.top_eq_univ, Set.univ_inter, Set.nonempty_iff_ne_empty, Ne, ← Opens.coe_bot, ← SetLike.ext'_iff] · erw [basicOpen_eq_bot_iff] exact ha · exact (RingedSpace.basicOpen _ _).isOpen have := (X.presheaf.germ ⟨_, hs⟩).isUnit_map (RingedSpace.isUnit_res_basicOpen _ s) rwa [TopCat.Presheaf.germ_res_apply] at this
Mathlib/AlgebraicGeometry/FunctionField.lean
67
75
theorem germ_injective_of_isIntegral [IsIntegral X] {U : Opens X.carrier} (x : U) : Function.Injective (X.presheaf.germ x) := by
rw [injective_iff_map_eq_zero] intro y hy rw [← (X.presheaf.germ x).map_zero] at hy obtain ⟨W, hW, iU, iV, e⟩ := X.presheaf.germ_eq _ x.prop x.prop _ _ hy cases Subsingleton.elim iU iV haveI : Nonempty W := ⟨⟨_, hW⟩⟩ exact map_injective_of_isIntegral X iU e
[ " (⊤ ∩ ↑U).Nonempty", " Field ↑X.functionField", " IsUnit a ∨ a = 0", " IsUnit ((X.presheaf.germ ⟨genericPoint ↑↑X.toPresheafedSpace, m⟩) s) ∨\n (X.presheaf.germ ⟨genericPoint ↑↑X.toPresheafedSpace, m⟩) s = 0", " ¬(X.presheaf.germ ⟨genericPoint ↑↑X.toPresheafedSpace, m⟩) s =\n (X.presheaf.germ ⟨ge...
[ " (⊤ ∩ ↑U).Nonempty", " Field ↑X.functionField", " IsUnit a ∨ a = 0", " IsUnit ((X.presheaf.germ ⟨genericPoint ↑↑X.toPresheafedSpace, m⟩) s) ∨\n (X.presheaf.germ ⟨genericPoint ↑↑X.toPresheafedSpace, m⟩) s = 0", " ¬(X.presheaf.germ ⟨genericPoint ↑↑X.toPresheafedSpace, m⟩) s =\n (X.presheaf.germ ⟨ge...
import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.Calculus.Deriv.Inv #align_import analysis.calculus.dslope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped Classical Topology Filter open Function Set Filter variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] noncomputable def dslope (f : 𝕜 → E) (a : 𝕜) : 𝕜 → E := update (slope f a) a (deriv f a) #align dslope dslope @[simp] theorem dslope_same (f : 𝕜 → E) (a : 𝕜) : dslope f a a = deriv f a := update_same _ _ _ #align dslope_same dslope_same variable {f : 𝕜 → E} {a b : 𝕜} {s : Set 𝕜} theorem dslope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a b = slope f a b := update_noteq h _ _ #align dslope_of_ne dslope_of_ne theorem ContinuousLinearMap.dslope_comp {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E →L[𝕜] F) (g : 𝕜 → E) (a b : 𝕜) (H : a = b → DifferentiableAt 𝕜 g a) : dslope (f ∘ g) a b = f (dslope g a b) := by rcases eq_or_ne b a with (rfl | hne) · simp only [dslope_same] exact (f.hasFDerivAt.comp_hasDerivAt b (H rfl).hasDerivAt).deriv · simpa only [dslope_of_ne _ hne] using f.toLinearMap.slope_comp g a b #align continuous_linear_map.dslope_comp ContinuousLinearMap.dslope_comp theorem eqOn_dslope_slope (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope f a) (slope f a) {a}ᶜ := fun _ => dslope_of_ne f #align eq_on_dslope_slope eqOn_dslope_slope theorem dslope_eventuallyEq_slope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a =ᶠ[𝓝 b] slope f a := (eqOn_dslope_slope f a).eventuallyEq_of_mem (isOpen_ne.mem_nhds h) #align dslope_eventually_eq_slope_of_ne dslope_eventuallyEq_slope_of_ne theorem dslope_eventuallyEq_slope_punctured_nhds (f : 𝕜 → E) : dslope f a =ᶠ[𝓝[≠] a] slope f a := (eqOn_dslope_slope f a).eventuallyEq_of_mem self_mem_nhdsWithin #align dslope_eventually_eq_slope_punctured_nhds dslope_eventuallyEq_slope_punctured_nhds @[simp] theorem sub_smul_dslope (f : 𝕜 → E) (a b : 𝕜) : (b - a) • dslope f a b = f b - f a := by rcases eq_or_ne b a with (rfl | hne) <;> simp [dslope_of_ne, *] #align sub_smul_dslope sub_smul_dslope theorem dslope_sub_smul_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope (fun x => (x - a) • f x) a b = f b := by rw [dslope_of_ne _ h, slope_sub_smul _ h.symm] #align dslope_sub_smul_of_ne dslope_sub_smul_of_ne theorem eqOn_dslope_sub_smul (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope (fun x => (x - a) • f x) a) f {a}ᶜ := fun _ => dslope_sub_smul_of_ne f #align eq_on_dslope_sub_smul eqOn_dslope_sub_smul theorem dslope_sub_smul [DecidableEq 𝕜] (f : 𝕜 → E) (a : 𝕜) : dslope (fun x => (x - a) • f x) a = update f a (deriv (fun x => (x - a) • f x) a) := eq_update_iff.2 ⟨dslope_same _ _, eqOn_dslope_sub_smul f a⟩ #align dslope_sub_smul dslope_sub_smul @[simp] theorem continuousAt_dslope_same : ContinuousAt (dslope f a) a ↔ DifferentiableAt 𝕜 f a := by simp only [dslope, continuousAt_update_same, ← hasDerivAt_deriv_iff, hasDerivAt_iff_tendsto_slope] #align continuous_at_dslope_same continuousAt_dslope_same theorem ContinuousWithinAt.of_dslope (h : ContinuousWithinAt (dslope f a) s b) : ContinuousWithinAt f s b := by have : ContinuousWithinAt (fun x => (x - a) • dslope f a x + f a) s b := ((continuousWithinAt_id.sub continuousWithinAt_const).smul h).add continuousWithinAt_const simpa only [sub_smul_dslope, sub_add_cancel] using this #align continuous_within_at.of_dslope ContinuousWithinAt.of_dslope theorem ContinuousAt.of_dslope (h : ContinuousAt (dslope f a) b) : ContinuousAt f b := (continuousWithinAt_univ _ _).1 h.continuousWithinAt.of_dslope #align continuous_at.of_dslope ContinuousAt.of_dslope theorem ContinuousOn.of_dslope (h : ContinuousOn (dslope f a) s) : ContinuousOn f s := fun x hx => (h x hx).of_dslope #align continuous_on.of_dslope ContinuousOn.of_dslope
Mathlib/Analysis/Calculus/Dslope.lean
106
111
theorem continuousWithinAt_dslope_of_ne (h : b ≠ a) : ContinuousWithinAt (dslope f a) s b ↔ ContinuousWithinAt f s b := by
refine ⟨ContinuousWithinAt.of_dslope, fun hc => ?_⟩ simp only [dslope, continuousWithinAt_update_of_ne h] exact ((continuousWithinAt_id.sub continuousWithinAt_const).inv₀ (sub_ne_zero.2 h)).smul (hc.sub continuousWithinAt_const)
[ " dslope (⇑f ∘ g) a b = f (dslope g a b)", " dslope (⇑f ∘ g) b b = f (dslope g b b)", " deriv (⇑f ∘ g) b = f (deriv g b)", " (b - a) • dslope f a b = f b - f a", " (b - b) • dslope f b b = f b - f b", " dslope (fun x => (x - a) • f x) a b = f b", " ContinuousAt (dslope f a) a ↔ DifferentiableAt 𝕜 f a",...
[ " dslope (⇑f ∘ g) a b = f (dslope g a b)", " dslope (⇑f ∘ g) b b = f (dslope g b b)", " deriv (⇑f ∘ g) b = f (deriv g b)", " (b - a) • dslope f a b = f b - f a", " (b - b) • dslope f b b = f b - f b", " dslope (fun x => (x - a) • f x) a b = f b", " ContinuousAt (dslope f a) a ↔ DifferentiableAt 𝕜 f a",...
import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Group.Int import Mathlib.Data.Nat.Dist import Mathlib.Data.Ordmap.Ordnode import Mathlib.Tactic.Abel import Mathlib.Tactic.Linarith #align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" variable {α : Type*} namespace Ordnode theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 := not_le_of_gt H #align ordnode.not_le_delta Ordnode.not_le_delta theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False := not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta) #align ordnode.delta_lt_false Ordnode.delta_lt_false def realSize : Ordnode α → ℕ | nil => 0 | node _ l _ r => realSize l + realSize r + 1 #align ordnode.real_size Ordnode.realSize def Sized : Ordnode α → Prop | nil => True | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r #align ordnode.sized Ordnode.Sized theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) := ⟨rfl, hl, hr⟩ #align ordnode.sized.node' Ordnode.Sized.node' theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by rw [h.1] #align ordnode.sized.eq_node' Ordnode.Sized.eq_node' theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) : size (@node α s l x r) = size l + size r + 1 := H.1 #align ordnode.sized.size_eq Ordnode.Sized.size_eq @[elab_as_elim]
Mathlib/Data/Ordmap/Ordset.lean
124
130
theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil) (H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t := by
induction t with | nil => exact H0 | node _ _ _ _ t_ih_l t_ih_r => rw [hl.eq_node'] exact H1 _ _ _ (t_ih_l hl.2.1) (t_ih_r hl.2.2)
[ " 0 < delta", " a ≤ delta * (delta * a)", " 1 ≤ delta * delta", " node s l x r = l.node' x r", " C t", " C nil", " C (node size✝ l✝ x✝ r✝)", " C (l✝.node' x✝ r✝)" ]
[ " 0 < delta", " a ≤ delta * (delta * a)", " 1 ≤ delta * delta", " node s l x r = l.node' x r" ]
import Mathlib.Order.UpperLower.Basic import Mathlib.Data.Finset.Preimage #align_import combinatorics.young.young_diagram from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Function @[ext] structure YoungDiagram where cells : Finset (ℕ × ℕ) isLowerSet : IsLowerSet (cells : Set (ℕ × ℕ)) #align young_diagram YoungDiagram namespace YoungDiagram instance : SetLike YoungDiagram (ℕ × ℕ) where -- Porting note (#11215): TODO: figure out how to do this correctly coe := fun y => y.cells coe_injective' μ ν h := by rwa [YoungDiagram.ext_iff, ← Finset.coe_inj] @[simp] theorem mem_cells {μ : YoungDiagram} (c : ℕ × ℕ) : c ∈ μ.cells ↔ c ∈ μ := Iff.rfl #align young_diagram.mem_cells YoungDiagram.mem_cells @[simp] theorem mem_mk (c : ℕ × ℕ) (cells) (isLowerSet) : c ∈ YoungDiagram.mk cells isLowerSet ↔ c ∈ cells := Iff.rfl #align young_diagram.mem_mk YoungDiagram.mem_mk instance decidableMem (μ : YoungDiagram) : DecidablePred (· ∈ μ) := inferInstanceAs (DecidablePred (· ∈ μ.cells)) #align young_diagram.decidable_mem YoungDiagram.decidableMem theorem up_left_mem (μ : YoungDiagram) {i1 i2 j1 j2 : ℕ} (hi : i1 ≤ i2) (hj : j1 ≤ j2) (hcell : (i2, j2) ∈ μ) : (i1, j1) ∈ μ := μ.isLowerSet (Prod.mk_le_mk.mpr ⟨hi, hj⟩) hcell #align young_diagram.up_left_mem YoungDiagram.up_left_mem protected abbrev card (μ : YoungDiagram) : ℕ := μ.cells.card #align young_diagram.card YoungDiagram.card section Transpose def transpose (μ : YoungDiagram) : YoungDiagram where cells := (Equiv.prodComm _ _).finsetCongr μ.cells isLowerSet _ _ h := by simp only [Finset.mem_coe, Equiv.finsetCongr_apply, Finset.mem_map_equiv] intro hcell apply μ.isLowerSet _ hcell simp [h] #align young_diagram.transpose YoungDiagram.transpose @[simp] theorem mem_transpose {μ : YoungDiagram} {c : ℕ × ℕ} : c ∈ μ.transpose ↔ c.swap ∈ μ := by simp [transpose] #align young_diagram.mem_transpose YoungDiagram.mem_transpose @[simp]
Mathlib/Combinatorics/Young/YoungDiagram.lean
219
221
theorem transpose_transpose (μ : YoungDiagram) : μ.transpose.transpose = μ := by
ext x simp
[ " μ = ν", " x✝¹ ∈ ↑((Equiv.prodComm ℕ ℕ).finsetCongr μ.cells) → x✝ ∈ ↑((Equiv.prodComm ℕ ℕ).finsetCongr μ.cells)", " (Equiv.prodComm ℕ ℕ).symm x✝¹ ∈ μ.cells → (Equiv.prodComm ℕ ℕ).symm x✝ ∈ μ.cells", " (Equiv.prodComm ℕ ℕ).symm x✝ ∈ μ.cells", " (Equiv.prodComm ℕ ℕ).symm x✝ ≤ (Equiv.prodComm ℕ ℕ).symm x✝¹", ...
[ " μ = ν", " x✝¹ ∈ ↑((Equiv.prodComm ℕ ℕ).finsetCongr μ.cells) → x✝ ∈ ↑((Equiv.prodComm ℕ ℕ).finsetCongr μ.cells)", " (Equiv.prodComm ℕ ℕ).symm x✝¹ ∈ μ.cells → (Equiv.prodComm ℕ ℕ).symm x✝ ∈ μ.cells", " (Equiv.prodComm ℕ ℕ).symm x✝ ∈ μ.cells", " (Equiv.prodComm ℕ ℕ).symm x✝ ≤ (Equiv.prodComm ℕ ℕ).symm x✝¹", ...
import Mathlib.Topology.Category.LightProfinite.Limits import Mathlib.CategoryTheory.Sites.Coherent.Comparison universe u attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike open CategoryTheory Limits namespace LightProfinite noncomputable def EffectiveEpi.struct {B X : LightProfinite.{u}} (π : X ⟶ B) (hπ : Function.Surjective π) : EffectiveEpiStruct π where desc e h := (QuotientMap.of_surjective_continuous hπ π.continuous).lift e fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a fac e h := ((QuotientMap.of_surjective_continuous hπ π.continuous).lift_comp e fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a) uniq e h g hm := by suffices g = (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv ⟨e, fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a⟩ by assumption rw [← Equiv.symm_apply_eq (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv] ext simp only [QuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm] rfl
Mathlib/Topology/Category/LightProfinite/EffectiveEpi.lean
54
58
theorem effectiveEpi_iff_surjective {X Y : LightProfinite.{u}} (f : X ⟶ Y) : EffectiveEpi f ↔ Function.Surjective f := by
refine ⟨fun h ↦ ?_, fun h ↦ ⟨⟨EffectiveEpi.struct f h⟩⟩⟩ rw [← epi_iff_surjective] infer_instance
[ " { toFun := fun x => a, continuous_toFun := ⋯ } ≫ π = { toFun := fun x => b, continuous_toFun := ⋯ } ≫ π", " ({ toFun := fun x => a, continuous_toFun := ⋯ } ≫ π) x✝ = ({ toFun := fun x => b, continuous_toFun := ⋯ } ≫ π) x✝", " g = (fun {W} e h => ⋯.lift e ⋯) e ⋯", " g = ⋯.liftEquiv ⟨e, ⋯⟩", " ⋯.liftEquiv.s...
[ " { toFun := fun x => a, continuous_toFun := ⋯ } ≫ π = { toFun := fun x => b, continuous_toFun := ⋯ } ≫ π", " ({ toFun := fun x => a, continuous_toFun := ⋯ } ≫ π) x✝ = ({ toFun := fun x => b, continuous_toFun := ⋯ } ≫ π) x✝", " g = (fun {W} e h => ⋯.lift e ⋯) e ⋯", " g = ⋯.liftEquiv ⟨e, ⋯⟩", " ⋯.liftEquiv.s...
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 α} 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 #align closure_Ioi' closure_Ioi' @[simp] theorem closure_Ioi (a : α) [NoMaxOrder α] : closure (Ioi a) = Ici a := closure_Ioi' nonempty_Ioi #align closure_Ioi closure_Ioi theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a := closure_Ioi' (α := αᵒᵈ) h #align closure_Iio' closure_Iio' @[simp] theorem closure_Iio (a : α) [NoMinOrder α] : closure (Iio a) = Iic a := closure_Iio' nonempty_Iio #align closure_Iio closure_Iio @[simp] theorem closure_Ioo {a b : α} (hab : a ≠ b) : closure (Ioo a b) = Icc a b := by apply Subset.antisymm · exact closure_minimal Ioo_subset_Icc_self isClosed_Icc · cases' hab.lt_or_lt with hab hab · rw [← diff_subset_closure_iff, Icc_diff_Ioo_same hab.le] have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab simp only [insert_subset_iff, singleton_subset_iff] exact ⟨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'⟩ · rw [Icc_eq_empty_of_lt hab] exact empty_subset _ #align closure_Ioo closure_Ioo @[simp]
Mathlib/Topology/Order/DenselyOrdered.lean
66
70
theorem closure_Ioc {a b : α} (hab : a ≠ b) : closure (Ioc a b) = Icc a b := by
apply Subset.antisymm · exact closure_minimal Ioc_subset_Icc_self isClosed_Icc · apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self) rw [closure_Ioo hab]
[ " closure (Ioi a) = Ici a", " closure (Ioi a) ⊆ Ici a", " Ici a ⊆ closure (Ioi a)", " a ∈ closure (Ioi a)", " closure (Ioo a b) = Icc a b", " closure (Ioo a b) ⊆ Icc a b", " Icc a b ⊆ closure (Ioo a b)", " {a, b} ⊆ closure (Ioo a b)", " a ∈ closure (Ioo a b) ∧ b ∈ closure (Ioo a b)", " ∅ ⊆ closure...
[ " closure (Ioi a) = Ici a", " closure (Ioi a) ⊆ Ici a", " Ici a ⊆ closure (Ioi a)", " a ∈ closure (Ioi a)", " closure (Ioo a b) = Icc a b", " closure (Ioo a b) ⊆ Icc a b", " Icc a b ⊆ closure (Ioo a b)", " {a, b} ⊆ closure (Ioo a b)", " a ∈ closure (Ioo a b) ∧ b ∈ closure (Ioo a b)", " ∅ ⊆ closure...
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 invOneSubPow variable {S : Type*} [CommRing S] (d : ℕ) theorem mk_one_mul_one_sub_eq_one : (mk 1 : S⟦X⟧) * (1 - X) = 1 := by rw [mul_comm, ext_iff] intro n cases n with | zero => simp | succ n => simp [sub_mul]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
96
106
theorem mk_one_pow_eq_mk_choose_add : (mk 1 : S⟦X⟧) ^ (d + 1) = (mk fun n => Nat.choose (d + n) d : S⟦X⟧) := by
induction d with | zero => ext; simp | succ d hd => ext n rw [pow_add, hd, pow_one, mul_comm, coeff_mul] simp_rw [coeff_mk, Pi.one_apply, one_mul] norm_cast rw [Finset.sum_antidiagonal_choose_add, ← Nat.choose_succ_succ, Nat.succ_eq_add_one, add_right_comm]
[ " mk 1 * (1 - X) = 1", " ∀ (n : ℕ), (coeff S n) ((1 - X) * mk 1) = (coeff S n) 1", " (coeff S n) ((1 - X) * mk 1) = (coeff S n) 1", " (coeff S 0) ((1 - X) * mk 1) = (coeff S 0) 1", " (coeff S (n + 1)) ((1 - X) * mk 1) = (coeff S (n + 1)) 1", " mk 1 ^ (d + 1) = mk fun n => ↑((d + n).choose d)", " mk 1 ^ ...
[ " mk 1 * (1 - X) = 1", " ∀ (n : ℕ), (coeff S n) ((1 - X) * mk 1) = (coeff S n) 1", " (coeff S n) ((1 - X) * mk 1) = (coeff S n) 1", " (coeff S 0) ((1 - X) * mk 1) = (coeff S 0) 1", " (coeff S (n + 1)) ((1 - X) * mk 1) = (coeff S (n + 1)) 1" ]
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp] theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc #align cardinal.prime_of_aleph_0_le Cardinal.prime_of_aleph0_le theorem not_irreducible_of_aleph0_le (ha : ℵ₀ ≤ a) : ¬Irreducible a := by rw [irreducible_iff, not_and_or] refine Or.inr fun h => ?_ simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀ #align cardinal.not_irreducible_of_aleph_0_le Cardinal.not_irreducible_of_aleph0_le @[simp, norm_cast] theorem nat_coe_dvd_iff : (n : Cardinal) ∣ m ↔ n ∣ m := by refine ⟨?_, fun ⟨h, ht⟩ => ⟨h, mod_cast ht⟩⟩ rintro ⟨k, hk⟩ have : ↑m < ℵ₀ := nat_lt_aleph0 m rw [hk, mul_lt_aleph0_iff] at this rcases this with (h | h | ⟨-, hk'⟩) iterate 2 simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk; simp [hk] lift k to ℕ using hk' exact ⟨k, mod_cast hk⟩ #align cardinal.nat_coe_dvd_iff Cardinal.nat_coe_dvd_iff @[simp]
Mathlib/SetTheory/Cardinal/Divisibility.lean
112
134
theorem nat_is_prime_iff : Prime (n : Cardinal) ↔ n.Prime := by
simp only [Prime, Nat.prime_iff] refine and_congr (by simp) (and_congr ?_ ⟨fun h b c hbc => ?_, fun h b c hbc => ?_⟩) · simp only [isUnit_iff, Nat.isUnit_iff] exact mod_cast Iff.rfl · exact mod_cast h b c (mod_cast hbc) cases' lt_or_le (b * c) ℵ₀ with h' h' · rcases mul_lt_aleph0_iff.mp h' with (rfl | rfl | ⟨hb, hc⟩) · simp · simp lift b to ℕ using hb lift c to ℕ using hc exact mod_cast h b c (mod_cast hbc) rcases aleph0_le_mul_iff.mp h' with ⟨hb, hc, hℵ₀⟩ have hn : (n : Cardinal) ≠ 0 := by intro h rw [h, zero_dvd_iff, mul_eq_zero] at hbc cases hbc <;> contradiction wlog hℵ₀b : ℵ₀ ≤ b apply (this h c b _ _ hc hb hℵ₀.symm hn (hℵ₀.resolve_left hℵ₀b)).symm <;> try assumption · rwa [mul_comm] at hbc · rwa [mul_comm] at h' · exact Or.inl (dvd_of_le_of_aleph0_le hn ((nat_lt_aleph0 n).le.trans hℵ₀b) hℵ₀b)
[ " IsUnit a ↔ a = 1", " a = 1 → IsUnit a", " IsUnit 1", " a = 1", " 0 = 1", " 1 ≤ a", " 1 ≤ t", " t ≠ 0", " False", " a ≤ x", " x = 0", " Prime a", " ¬IsUnit a", " ¬a = 1", " a ∣ b ∨ a ∣ c", " a ∣ 0 ∨ a ∣ c", " a ∣ b ∨ a ∣ 0", " a ∣ c ∨ a ∣ b", " b ≤ c", " c * b ≠ 0", " a ∣ c ...
[ " IsUnit a ↔ a = 1", " a = 1 → IsUnit a", " IsUnit 1", " a = 1", " 0 = 1", " 1 ≤ a", " 1 ≤ t", " t ≠ 0", " False", " a ≤ x", " x = 0", " Prime a", " ¬IsUnit a", " ¬a = 1", " a ∣ b ∨ a ∣ c", " a ∣ 0 ∨ a ∣ c", " a ∣ b ∨ a ∣ 0", " a ∣ c ∨ a ∣ b", " b ≤ c", " c * b ≠ 0", " a ∣ c ...
import Mathlib.Topology.UniformSpace.UniformEmbedding import Mathlib.Topology.UniformSpace.Equiv #align_import topology.uniform_space.abstract_completion from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" noncomputable section attribute [local instance] Classical.propDecidable open Filter Set Function universe u structure AbstractCompletion (α : Type u) [UniformSpace α] where space : Type u coe : α → space uniformStruct : UniformSpace space complete : CompleteSpace space separation : T0Space space uniformInducing : UniformInducing coe dense : DenseRange coe #align abstract_completion AbstractCompletion attribute [local instance] AbstractCompletion.uniformStruct AbstractCompletion.complete AbstractCompletion.separation namespace AbstractCompletion variable {α : Type*} [UniformSpace α] (pkg : AbstractCompletion α) local notation "hatα" => pkg.space local notation "ι" => pkg.coe def ofComplete [T0Space α] [CompleteSpace α] : AbstractCompletion α := mk α id inferInstance inferInstance inferInstance uniformInducing_id denseRange_id #align abstract_completion.of_complete AbstractCompletion.ofComplete theorem closure_range : closure (range ι) = univ := pkg.dense.closure_range #align abstract_completion.closure_range AbstractCompletion.closure_range theorem denseInducing : DenseInducing ι := ⟨pkg.uniformInducing.inducing, pkg.dense⟩ #align abstract_completion.dense_inducing AbstractCompletion.denseInducing theorem uniformContinuous_coe : UniformContinuous ι := UniformInducing.uniformContinuous pkg.uniformInducing #align abstract_completion.uniform_continuous_coe AbstractCompletion.uniformContinuous_coe theorem continuous_coe : Continuous ι := pkg.uniformContinuous_coe.continuous #align abstract_completion.continuous_coe AbstractCompletion.continuous_coe @[elab_as_elim] theorem induction_on {p : hatα → Prop} (a : hatα) (hp : IsClosed { a | p a }) (ih : ∀ a, p (ι a)) : p a := isClosed_property pkg.dense hp ih a #align abstract_completion.induction_on AbstractCompletion.induction_on variable {β : Type*} protected theorem funext [TopologicalSpace β] [T2Space β] {f g : hatα → β} (hf : Continuous f) (hg : Continuous g) (h : ∀ a, f (ι a) = g (ι a)) : f = g := funext fun a => pkg.induction_on a (isClosed_eq hf hg) h #align abstract_completion.funext AbstractCompletion.funext variable [UniformSpace β] section Extend protected def extend (f : α → β) : hatα → β := if UniformContinuous f then pkg.denseInducing.extend f else fun x => f (pkg.dense.some x) #align abstract_completion.extend AbstractCompletion.extend variable {f : α → β} theorem extend_def (hf : UniformContinuous f) : pkg.extend f = pkg.denseInducing.extend f := if_pos hf #align abstract_completion.extend_def AbstractCompletion.extend_def theorem extend_coe [T2Space β] (hf : UniformContinuous f) (a : α) : (pkg.extend f) (ι a) = f a := by rw [pkg.extend_def hf] exact pkg.denseInducing.extend_eq hf.continuous a #align abstract_completion.extend_coe AbstractCompletion.extend_coe variable [CompleteSpace β]
Mathlib/Topology/UniformSpace/AbstractCompletion.lean
143
149
theorem uniformContinuous_extend : UniformContinuous (pkg.extend f) := by
by_cases hf : UniformContinuous f · rw [pkg.extend_def hf] exact uniformContinuous_uniformly_extend pkg.uniformInducing pkg.dense hf · change UniformContinuous (ite _ _ _) rw [if_neg hf] exact uniformContinuous_of_const fun a b => by congr 1
[ " pkg.extend f (pkg.coe a) = f a", " ⋯.extend f (pkg.coe a) = f a", " UniformContinuous (pkg.extend f)", " UniformContinuous (⋯.extend f)", " UniformContinuous (if UniformContinuous f then ⋯.extend f else fun x => f (⋯.some x))", " UniformContinuous fun x => f (⋯.some x)", " f (⋯.some a) = f (⋯.some b)"...
[ " pkg.extend f (pkg.coe a) = f a", " ⋯.extend f (pkg.coe a) = f a" ]
import Mathlib.Topology.Algebra.InfiniteSum.Basic import Mathlib.Topology.Algebra.UniformGroup noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section TopologicalGroup variable [CommGroup α] [TopologicalSpace α] [TopologicalGroup α] variable {f g : β → α} {a a₁ a₂ : α} -- `by simpa using` speeds up elaboration. Why? @[to_additive] theorem HasProd.inv (h : HasProd f a) : HasProd (fun b ↦ (f b)⁻¹) a⁻¹ := by simpa only using h.map (MonoidHom.id α)⁻¹ continuous_inv #align has_sum.neg HasSum.neg @[to_additive] theorem Multipliable.inv (hf : Multipliable f) : Multipliable fun b ↦ (f b)⁻¹ := hf.hasProd.inv.multipliable #align summable.neg Summable.neg @[to_additive] theorem Multipliable.of_inv (hf : Multipliable fun b ↦ (f b)⁻¹) : Multipliable f := by simpa only [inv_inv] using hf.inv #align summable.of_neg Summable.of_neg @[to_additive] theorem multipliable_inv_iff : (Multipliable fun b ↦ (f b)⁻¹) ↔ Multipliable f := ⟨Multipliable.of_inv, Multipliable.inv⟩ #align summable_neg_iff summable_neg_iff @[to_additive] theorem HasProd.div (hf : HasProd f a₁) (hg : HasProd g a₂) : HasProd (fun b ↦ f b / g b) (a₁ / a₂) := by simp only [div_eq_mul_inv] exact hf.mul hg.inv #align has_sum.sub HasSum.sub @[to_additive] theorem Multipliable.div (hf : Multipliable f) (hg : Multipliable g) : Multipliable fun b ↦ f b / g b := (hf.hasProd.div hg.hasProd).multipliable #align summable.sub Summable.sub @[to_additive] theorem Multipliable.trans_div (hg : Multipliable g) (hfg : Multipliable fun b ↦ f b / g b) : Multipliable f := by simpa only [div_mul_cancel] using hfg.mul hg #align summable.trans_sub Summable.trans_sub @[to_additive] theorem multipliable_iff_of_multipliable_div (hfg : Multipliable fun b ↦ f b / g b) : Multipliable f ↔ Multipliable g := ⟨fun hf ↦ hf.trans_div <| by simpa only [inv_div] using hfg.inv, fun hg ↦ hg.trans_div hfg⟩ #align summable_iff_of_summable_sub summable_iff_of_summable_sub @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/Group.lean
75
81
theorem HasProd.update (hf : HasProd f a₁) (b : β) [DecidableEq β] (a : α) : HasProd (update f b a) (a / f b * a₁) := by
convert (hasProd_ite_eq b (a / f b)).mul hf with b' by_cases h : b' = b · rw [h, update_same] simp [eq_self_iff_true, if_true, sub_add_cancel] · simp only [h, update_noteq, if_false, Ne, one_mul, not_false_iff]
[ " HasProd (fun b => (f b)⁻¹) a⁻¹", " Multipliable f", " HasProd (fun b => f b / g b) (a₁ / a₂)", " HasProd (fun b => f b * (g b)⁻¹) (a₁ * a₂⁻¹)", " Multipliable fun b => g b / f b", " HasProd (Function.update f b a) (a / f b * a₁)", " Function.update f b a b' = (if b' = b then a / f b else 1) * f b'", ...
[ " HasProd (fun b => (f b)⁻¹) a⁻¹", " Multipliable f", " HasProd (fun b => f b / g b) (a₁ / a₂)", " HasProd (fun b => f b * (g b)⁻¹) (a₁ * a₂⁻¹)", " Multipliable fun b => g b / f b" ]
import Mathlib.CategoryTheory.Category.Grpd import Mathlib.CategoryTheory.Groupoid import Mathlib.Topology.Category.TopCat.Basic import Mathlib.Topology.Homotopy.Path import Mathlib.Data.Set.Subsingleton #align_import algebraic_topology.fundamental_groupoid.basic from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" open CategoryTheory universe u v variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] variable {x₀ x₁ : X} noncomputable section open unitInterval namespace Path namespace Homotopy section def reflTransSymmAux (x : I × I) : ℝ := if (x.2 : ℝ) ≤ 1 / 2 then x.1 * 2 * x.2 else x.1 * (2 - 2 * x.2) #align path.homotopy.refl_trans_symm_aux Path.Homotopy.reflTransSymmAux @[continuity] theorem continuous_reflTransSymmAux : Continuous reflTransSymmAux := by refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_ · continuity · continuity · continuity · continuity intro x hx norm_num [hx, mul_assoc] #align path.homotopy.continuous_refl_trans_symm_aux Path.Homotopy.continuous_reflTransSymmAux theorem reflTransSymmAux_mem_I (x : I × I) : reflTransSymmAux x ∈ I := by dsimp only [reflTransSymmAux] split_ifs · constructor · apply mul_nonneg · apply mul_nonneg · unit_interval · norm_num · unit_interval · rw [mul_assoc] apply mul_le_one · unit_interval · apply mul_nonneg · norm_num · unit_interval · linarith · constructor · apply mul_nonneg · unit_interval linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2] · apply mul_le_one · unit_interval · linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2] · linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2] set_option linter.uppercaseLean3 false in #align path.homotopy.refl_trans_symm_aux_mem_I Path.Homotopy.reflTransSymmAux_mem_I def reflTransSymm (p : Path x₀ x₁) : Homotopy (Path.refl x₀) (p.trans p.symm) where toFun x := p ⟨reflTransSymmAux x, reflTransSymmAux_mem_I x⟩ continuous_toFun := by continuity map_zero_left := by simp [reflTransSymmAux] map_one_left x := by dsimp only [reflTransSymmAux, Path.coe_toContinuousMap, Path.trans] change _ = ite _ _ _ split_ifs with h · rw [Path.extend, Set.IccExtend_of_mem] · norm_num · rw [unitInterval.mul_pos_mem_iff zero_lt_two] exact ⟨unitInterval.nonneg x, h⟩ · rw [Path.symm, Path.extend, Set.IccExtend_of_mem] · simp only [Set.Icc.coe_one, one_mul, coe_mk_mk, Function.comp_apply] congr 1 ext norm_num [sub_sub_eq_add_sub] · rw [unitInterval.two_mul_sub_one_mem_iff] exact ⟨(not_le.1 h).le, unitInterval.le_one x⟩ prop' t x hx := by simp only [Set.mem_singleton_iff, Set.mem_insert_iff] at hx simp only [ContinuousMap.coe_mk, coe_toContinuousMap, Path.refl_apply] cases hx with | inl hx | inr hx => set_option tactic.skipAssignedInstances false in rw [hx] norm_num [reflTransSymmAux] #align path.homotopy.refl_trans_symm Path.Homotopy.reflTransSymm def reflSymmTrans (p : Path x₀ x₁) : Homotopy (Path.refl x₁) (p.symm.trans p) := (reflTransSymm p.symm).cast rfl <| congr_arg _ (Path.symm_symm _) #align path.homotopy.refl_symm_trans Path.Homotopy.reflSymmTrans end section TransRefl def transReflReparamAux (t : I) : ℝ := if (t : ℝ) ≤ 1 / 2 then 2 * t else 1 #align path.homotopy.trans_refl_reparam_aux Path.Homotopy.transReflReparamAux @[continuity] theorem continuous_transReflReparamAux : Continuous transReflReparamAux := by refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_ <;> [continuity; continuity; continuity; continuity; skip] intro x hx simp [hx] #align path.homotopy.continuous_trans_refl_reparam_aux Path.Homotopy.continuous_transReflReparamAux theorem transReflReparamAux_mem_I (t : I) : transReflReparamAux t ∈ I := by unfold transReflReparamAux split_ifs <;> constructor <;> linarith [unitInterval.le_one t, unitInterval.nonneg t] set_option linter.uppercaseLean3 false in #align path.homotopy.trans_refl_reparam_aux_mem_I Path.Homotopy.transReflReparamAux_mem_I
Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean
144
145
theorem transReflReparamAux_zero : transReflReparamAux 0 = 0 := by
set_option tactic.skipAssignedInstances false in norm_num [transReflReparamAux]
[ " Continuous reflTransSymmAux", " Continuous fun x => ↑x.2", " Continuous fun x => 1 / 2", " Continuous fun x => ↑x.1 * 2 * ↑x.2", " Continuous fun x => ↑x.1 * (2 - 2 * ↑x.2)", " ∀ (x : ↑I × ↑I), ↑x.2 = 1 / 2 → ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)", " ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)", " ref...
[ " Continuous reflTransSymmAux", " Continuous fun x => ↑x.2", " Continuous fun x => 1 / 2", " Continuous fun x => ↑x.1 * 2 * ↑x.2", " Continuous fun x => ↑x.1 * (2 - 2 * ↑x.2)", " ∀ (x : ↑I × ↑I), ↑x.2 = 1 / 2 → ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)", " ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)", " ref...
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def χ₄ : MulChar (ZMod 4) ℤ where toFun := (![0, 1, 0, -1] : ZMod 4 → ℤ) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.χ₄ ZMod.χ₄ theorem isQuadratic_χ₄ : χ₄.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_χ₄ ZMod.isQuadratic_χ₄ theorem χ₄_nat_mod_four (n : ℕ) : χ₄ n = χ₄ (n % 4 : ℕ) := by rw [← ZMod.natCast_mod n 4] #align zmod.χ₄_nat_mod_four ZMod.χ₄_nat_mod_four theorem χ₄_int_mod_four (n : ℤ) : χ₄ n = χ₄ (n % 4 : ℤ) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.χ₄_int_mod_four ZMod.χ₄_int_mod_four theorem χ₄_int_eq_if_mod_four (n : ℤ) : χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : ∀ m : ℤ, 0 ≤ m → m < 4 → χ₄ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : ℤ) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.χ₄_int_eq_if_mod_four ZMod.χ₄_int_eq_if_mod_four theorem χ₄_nat_eq_if_mod_four (n : ℕ) : χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast χ₄_int_eq_if_mod_four n #align zmod.χ₄_nat_eq_if_mod_four ZMod.χ₄_nat_eq_if_mod_four theorem χ₄_eq_neg_one_pow {n : ℕ} (hn : n % 2 = 1) : χ₄ n = (-1) ^ (n / 2) := by rw [χ₄_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : ∀ m : ℕ, m < 4 → m % 2 = 1 → ite (m = 1) (1 : ℤ) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.χ₄_eq_neg_one_pow ZMod.χ₄_eq_neg_one_pow
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
95
97
theorem χ₄_nat_one_mod_four {n : ℕ} (hn : n % 4 = 1) : χ₄ n = 1 := by
rw [χ₄_nat_mod_four, hn] rfl
[ " ∀ (x y : ZMod 4),\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun (x * y) =\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun x * { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun y", " ∀ (a : ZMod 4), ¬IsUnit a → (↑{ toFun := ![0, 1, 0, -1], map_one' := ⋯, map_mul' := ⋯ }).toFun a = 0", " χ₄.IsQua...
[ " ∀ (x y : ZMod 4),\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun (x * y) =\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun x * { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun y", " ∀ (a : ZMod 4), ¬IsUnit a → (↑{ toFun := ![0, 1, 0, -1], map_one' := ⋯, map_mul' := ⋯ }).toFun a = 0", " χ₄.IsQua...
import Mathlib.Data.Stream.Init import Mathlib.Tactic.Common #align_import data.seq.computation from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" open Function universe u v w def Computation (α : Type u) : Type u := { f : Stream' (Option α) // ∀ ⦃n a⦄, f n = some a → f (n + 1) = some a } #align computation Computation namespace Computation variable {α : Type u} {β : Type v} {γ : Type w} -- constructors -- Porting note: `return` is reserved, so changed to `pure` def pure (a : α) : Computation α := ⟨Stream'.const (some a), fun _ _ => id⟩ #align computation.return Computation.pure instance : CoeTC α (Computation α) := ⟨pure⟩ -- note [use has_coe_t] def think (c : Computation α) : Computation α := ⟨Stream'.cons none c.1, fun n a h => by cases' n with n · contradiction · exact c.2 h⟩ #align computation.think Computation.think def thinkN (c : Computation α) : ℕ → Computation α | 0 => c | n + 1 => think (thinkN c n) set_option linter.uppercaseLean3 false in #align computation.thinkN Computation.thinkN -- check for immediate result def head (c : Computation α) : Option α := c.1.head #align computation.head Computation.head -- one step of computation def tail (c : Computation α) : Computation α := ⟨c.1.tail, fun _ _ h => c.2 h⟩ #align computation.tail Computation.tail def empty (α) : Computation α := ⟨Stream'.const none, fun _ _ => id⟩ #align computation.empty Computation.empty instance : Inhabited (Computation α) := ⟨empty _⟩ def runFor : Computation α → ℕ → Option α := Subtype.val #align computation.run_for Computation.runFor def destruct (c : Computation α) : Sum α (Computation α) := match c.1 0 with | none => Sum.inr (tail c) | some a => Sum.inl a #align computation.destruct Computation.destruct unsafe def run : Computation α → α | c => match destruct c with | Sum.inl a => a | Sum.inr ca => run ca #align computation.run Computation.run theorem destruct_eq_pure {s : Computation α} {a : α} : destruct s = Sum.inl a → s = pure a := by dsimp [destruct] induction' f0 : s.1 0 with _ <;> intro h · contradiction · apply Subtype.eq funext n induction' n with n IH · injection h with h' rwa [h'] at f0 · exact s.2 IH #align computation.destruct_eq_ret Computation.destruct_eq_pure theorem destruct_eq_think {s : Computation α} {s'} : destruct s = Sum.inr s' → s = think s' := by dsimp [destruct] induction' f0 : s.1 0 with a' <;> intro h · injection h with h' rw [← h'] cases' s with f al apply Subtype.eq dsimp [think, tail] rw [← f0] exact (Stream'.eta f).symm · contradiction #align computation.destruct_eq_think Computation.destruct_eq_think @[simp] theorem destruct_pure (a : α) : destruct (pure a) = Sum.inl a := rfl #align computation.destruct_ret Computation.destruct_pure @[simp] theorem destruct_think : ∀ s : Computation α, destruct (think s) = Sum.inr s | ⟨_, _⟩ => rfl #align computation.destruct_think Computation.destruct_think @[simp] theorem destruct_empty : destruct (empty α) = Sum.inr (empty α) := rfl #align computation.destruct_empty Computation.destruct_empty @[simp] theorem head_pure (a : α) : head (pure a) = some a := rfl #align computation.head_ret Computation.head_pure @[simp] theorem head_think (s : Computation α) : head (think s) = none := rfl #align computation.head_think Computation.head_think @[simp] theorem head_empty : head (empty α) = none := rfl #align computation.head_empty Computation.head_empty @[simp] theorem tail_pure (a : α) : tail (pure a) = pure a := rfl #align computation.tail_ret Computation.tail_pure @[simp]
Mathlib/Data/Seq/Computation.lean
175
176
theorem tail_think (s : Computation α) : tail (think s) = s := by
cases' s with f al; apply Subtype.eq; dsimp [tail, think]
[ " Stream'.cons none (↑c) (n + 1) = some a", " Stream'.cons none (↑c) (0 + 1) = some a", " Stream'.cons none (↑c) (n + 1 + 1) = some a", " s.destruct = Sum.inl a → s = pure a", " (match ↑s 0 with\n | none => Sum.inr s.tail\n | some a => Sum.inl a) =\n Sum.inl a →\n s = pure a", " (match n...
[ " Stream'.cons none (↑c) (n + 1) = some a", " Stream'.cons none (↑c) (0 + 1) = some a", " Stream'.cons none (↑c) (n + 1 + 1) = some a", " s.destruct = Sum.inl a → s = pure a", " (match ↑s 0 with\n | none => Sum.inr s.tail\n | some a => Sum.inl a) =\n Sum.inl a →\n s = pure a", " (match n...
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : ℕ) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : ℕ) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : ℕ) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : ℕ} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≤ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≤ n := tsub_eq_zero_iff_le.mp this le_antisymm ‹n ≤ m› ‹m ≤ n› #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : ℕ} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : ℕ} (h : n ≤ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : ℕ} (h : m ≤ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : ℕ) : m ≤ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : ℕ) : m ≤ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right
Mathlib/Data/Nat/Dist.lean
60
60
theorem dist_tri_left' (n m : ℕ) : n ≤ dist n m + m := by
rw [dist_comm]; apply dist_tri_left
[ " n.dist m = m.dist n", " n.dist n = 0", " n.dist m = 0", " n.dist m = m - n", " n.dist m = n - m", " m.dist n = n - m", " m ≤ n + n.dist m", " m ≤ n.dist m + n", " n ≤ n.dist m + m", " n ≤ m.dist n + m" ]
[ " n.dist m = m.dist n", " n.dist n = 0", " n.dist m = 0", " n.dist m = m - n", " n.dist m = n - m", " m.dist n = n - m", " m ≤ n + n.dist m", " m ≤ n.dist m + n" ]
import Mathlib.NumberTheory.BernoulliPolynomials import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Analysis.Fourier.AddCircle import Mathlib.Analysis.PSeries #align_import number_theory.zeta_values from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open scoped Nat Real Interval open Complex MeasureTheory Set intervalIntegral local notation "𝕌" => UnitAddCircle section BernoulliFunProps def bernoulliFun (k : ℕ) (x : ℝ) : ℝ := (Polynomial.map (algebraMap ℚ ℝ) (Polynomial.bernoulli k)).eval x #align bernoulli_fun bernoulliFun theorem bernoulliFun_eval_zero (k : ℕ) : bernoulliFun k 0 = bernoulli k := by rw [bernoulliFun, Polynomial.eval_zero_map, Polynomial.bernoulli_eval_zero, eq_ratCast] #align bernoulli_fun_eval_zero bernoulliFun_eval_zero theorem bernoulliFun_endpoints_eq_of_ne_one {k : ℕ} (hk : k ≠ 1) : bernoulliFun k 1 = bernoulliFun k 0 := by rw [bernoulliFun_eval_zero, bernoulliFun, Polynomial.eval_one_map, Polynomial.bernoulli_eval_one, bernoulli_eq_bernoulli'_of_ne_one hk, eq_ratCast] #align bernoulli_fun_endpoints_eq_of_ne_one bernoulliFun_endpoints_eq_of_ne_one theorem bernoulliFun_eval_one (k : ℕ) : bernoulliFun k 1 = bernoulliFun k 0 + ite (k = 1) 1 0 := by rw [bernoulliFun, bernoulliFun_eval_zero, Polynomial.eval_one_map, Polynomial.bernoulli_eval_one] split_ifs with h · rw [h, bernoulli_one, bernoulli'_one, eq_ratCast] push_cast; ring · rw [bernoulli_eq_bernoulli'_of_ne_one h, add_zero, eq_ratCast] #align bernoulli_fun_eval_one bernoulliFun_eval_one theorem hasDerivAt_bernoulliFun (k : ℕ) (x : ℝ) : HasDerivAt (bernoulliFun k) (k * bernoulliFun (k - 1) x) x := by convert ((Polynomial.bernoulli k).map <| algebraMap ℚ ℝ).hasDerivAt x using 1 simp only [bernoulliFun, Polynomial.derivative_map, Polynomial.derivative_bernoulli k, Polynomial.map_mul, Polynomial.map_natCast, Polynomial.eval_mul, Polynomial.eval_natCast] #align has_deriv_at_bernoulli_fun hasDerivAt_bernoulliFun
Mathlib/NumberTheory/ZetaValues.lean
74
77
theorem antideriv_bernoulliFun (k : ℕ) (x : ℝ) : HasDerivAt (fun x => bernoulliFun (k + 1) x / (k + 1)) (bernoulliFun k x) x := by
convert (hasDerivAt_bernoulliFun (k + 1) x).div_const _ using 1 field_simp [Nat.cast_add_one_ne_zero k]
[ " bernoulliFun k 0 = ↑(bernoulli k)", " bernoulliFun k 1 = bernoulliFun k 0", " bernoulliFun k 1 = bernoulliFun k 0 + if k = 1 then 1 else 0", " (algebraMap ℚ ℝ) (bernoulli' k) = ↑(bernoulli k) + if k = 1 then 1 else 0", " (algebraMap ℚ ℝ) (bernoulli' k) = ↑(bernoulli k) + 1", " ↑(1 / 2) = ↑(-1 / 2) + 1",...
[ " bernoulliFun k 0 = ↑(bernoulli k)", " bernoulliFun k 1 = bernoulliFun k 0", " bernoulliFun k 1 = bernoulliFun k 0 + if k = 1 then 1 else 0", " (algebraMap ℚ ℝ) (bernoulli' k) = ↑(bernoulli k) + if k = 1 then 1 else 0", " (algebraMap ℚ ℝ) (bernoulli' k) = ↑(bernoulli k) + 1", " ↑(1 / 2) = ↑(-1 / 2) + 1",...
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} #align list.length_enum_from List.enumFrom_length #align list.length_enum List.enum_length @[simp] theorem get?_enumFrom : ∀ n (l : List α) m, get? (enumFrom n l) m = (get? l m).map fun a => (n + m, a) | n, [], m => rfl | n, a :: l, 0 => rfl | n, a :: l, m + 1 => (get?_enumFrom (n + 1) l m).trans <| by rw [Nat.add_right_comm]; rfl #align list.enum_from_nth List.get?_enumFrom @[deprecated (since := "2024-04-06")] alias enumFrom_get? := get?_enumFrom @[simp] theorem get?_enum (l : List α) (n) : get? (enum l) n = (get? l n).map fun a => (n, a) := by rw [enum, get?_enumFrom, Nat.zero_add] #align list.enum_nth List.get?_enum @[deprecated (since := "2024-04-06")] alias enum_get? := get?_enum @[simp] theorem enumFrom_map_snd : ∀ (n) (l : List α), map Prod.snd (enumFrom n l) = l | _, [] => rfl | _, _ :: _ => congr_arg (cons _) (enumFrom_map_snd _ _) #align list.enum_from_map_snd List.enumFrom_map_snd @[simp] theorem enum_map_snd (l : List α) : map Prod.snd (enum l) = l := enumFrom_map_snd _ _ #align list.enum_map_snd List.enum_map_snd @[simp] theorem get_enumFrom (l : List α) (n) (i : Fin (l.enumFrom n).length) : (l.enumFrom n).get i = (n + i, l.get (i.cast enumFrom_length)) := by simp [get_eq_get?] #align list.nth_le_enum_from List.get_enumFrom @[simp] theorem get_enum (l : List α) (i : Fin l.enum.length) : l.enum.get i = (i.1, l.get (i.cast enum_length)) := by simp [enum] #align list.nth_le_enum List.get_enum theorem mk_add_mem_enumFrom_iff_get? {n i : ℕ} {x : α} {l : List α} : (n + i, x) ∈ enumFrom n l ↔ l.get? i = x := by simp [mem_iff_get?]
Mathlib/Data/List/Enum.lean
63
70
theorem mk_mem_enumFrom_iff_le_and_get?_sub {n i : ℕ} {x : α} {l : List α} : (i, x) ∈ enumFrom n l ↔ n ≤ i ∧ l.get? (i - n) = x := by
if h : n ≤ i then rcases Nat.exists_eq_add_of_le h with ⟨i, rfl⟩ simp [mk_add_mem_enumFrom_iff_get?, Nat.add_sub_cancel_left] else have : ∀ k, n + k ≠ i := by rintro k rfl; simp at h simp [h, mem_iff_get?, this]
[ " Option.map (fun a => (n + 1 + m, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " Option.map (fun a => (n + m + 1, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " l.enum.get? n = Option.map (fun a => (n, a)) (l.get? n)", " (enumFrom n l)...
[ " Option.map (fun a => (n + 1 + m, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " Option.map (fun a => (n + m + 1, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " l.enum.get? n = Option.map (fun a => (n, a)) (l.get? n)", " (enumFrom n l)...
import Mathlib.Init.Algebra.Classes import Mathlib.Logic.Nontrivial.Basic import Mathlib.Order.BoundedOrder import Mathlib.Data.Option.NAry import Mathlib.Tactic.Lift import Mathlib.Data.Option.Basic #align_import order.with_bot from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" variable {α β γ δ : Type*} def WithBot (α : Type*) := Option α #align with_bot WithBot namespace WithBot variable {a b : α} instance [Repr α] : Repr (WithBot α) := ⟨fun o _ => match o with | none => "⊥" | some a => "↑" ++ repr a⟩ @[coe, match_pattern] def some : α → WithBot α := Option.some -- Porting note: changed this from `CoeTC` to `Coe` but I am not 100% confident that's correct. instance coe : Coe α (WithBot α) := ⟨some⟩ instance bot : Bot (WithBot α) := ⟨none⟩ instance inhabited : Inhabited (WithBot α) := ⟨⊥⟩ instance nontrivial [Nonempty α] : Nontrivial (WithBot α) := Option.nontrivial open Function theorem coe_injective : Injective ((↑) : α → WithBot α) := Option.some_injective _ #align with_bot.coe_injective WithBot.coe_injective @[simp, norm_cast] theorem coe_inj : (a : WithBot α) = b ↔ a = b := Option.some_inj #align with_bot.coe_inj WithBot.coe_inj protected theorem «forall» {p : WithBot α → Prop} : (∀ x, p x) ↔ p ⊥ ∧ ∀ x : α, p x := Option.forall #align with_bot.forall WithBot.forall protected theorem «exists» {p : WithBot α → Prop} : (∃ x, p x) ↔ p ⊥ ∨ ∃ x : α, p x := Option.exists #align with_bot.exists WithBot.exists theorem none_eq_bot : (none : WithBot α) = (⊥ : WithBot α) := rfl #align with_bot.none_eq_bot WithBot.none_eq_bot theorem some_eq_coe (a : α) : (Option.some a : WithBot α) = (↑a : WithBot α) := rfl #align with_bot.some_eq_coe WithBot.some_eq_coe @[simp] theorem bot_ne_coe : ⊥ ≠ (a : WithBot α) := nofun #align with_bot.bot_ne_coe WithBot.bot_ne_coe @[simp] theorem coe_ne_bot : (a : WithBot α) ≠ ⊥ := nofun #align with_bot.coe_ne_bot WithBot.coe_ne_bot @[elab_as_elim, induction_eliminator, cases_eliminator] def recBotCoe {C : WithBot α → Sort*} (bot : C ⊥) (coe : ∀ a : α, C a) : ∀ n : WithBot α, C n | ⊥ => bot | (a : α) => coe a #align with_bot.rec_bot_coe WithBot.recBotCoe @[simp] theorem recBotCoe_bot {C : WithBot α → Sort*} (d : C ⊥) (f : ∀ a : α, C a) : @recBotCoe _ C d f ⊥ = d := rfl #align with_bot.rec_bot_coe_bot WithBot.recBotCoe_bot @[simp] theorem recBotCoe_coe {C : WithBot α → Sort*} (d : C ⊥) (f : ∀ a : α, C a) (x : α) : @recBotCoe _ C d f ↑x = f x := rfl #align with_bot.rec_bot_coe_coe WithBot.recBotCoe_coe def unbot' (d : α) (x : WithBot α) : α := recBotCoe d id x #align with_bot.unbot' WithBot.unbot' @[simp] theorem unbot'_bot {α} (d : α) : unbot' d ⊥ = d := rfl #align with_bot.unbot'_bot WithBot.unbot'_bot @[simp] theorem unbot'_coe {α} (d x : α) : unbot' d x = x := rfl #align with_bot.unbot'_coe WithBot.unbot'_coe theorem coe_eq_coe : (a : WithBot α) = b ↔ a = b := coe_inj #align with_bot.coe_eq_coe WithBot.coe_eq_coe
Mathlib/Order/WithBot.lean
135
136
theorem unbot'_eq_iff {d y : α} {x : WithBot α} : unbot' d x = y ↔ x = y ∨ x = ⊥ ∧ y = d := by
induction x <;> simp [@eq_comm _ d]
[ " unbot' d x = y ↔ x = ↑y ∨ x = ⊥ ∧ y = d", " unbot' d ⊥ = y ↔ ⊥ = ↑y ∨ ⊥ = ⊥ ∧ y = d", " unbot' d ↑a✝ = y ↔ ↑a✝ = ↑y ∨ ↑a✝ = ⊥ ∧ y = d" ]
[]
import Mathlib.Algebra.Algebra.Tower import Mathlib.Algebra.Polynomial.AlgebraMap #align_import ring_theory.polynomial.tower from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" open Polynomial variable (R A B : Type*) namespace Polynomial section CommSemiring variable [CommSemiring R] [CommSemiring A] [Semiring B] variable [Algebra R A] [Algebra A B] [Algebra R B] [IsScalarTower R A B] variable {R A}
Mathlib/RingTheory/Polynomial/Tower.lean
54
56
theorem aeval_algebraMap_apply (x : A) (p : R[X]) : aeval (algebraMap A B x) p = algebraMap A B (aeval x p) := by
rw [aeval_def, aeval_def, hom_eval₂, ← IsScalarTower.algebraMap_eq]
[ " (aeval ((algebraMap A B) x)) p = (algebraMap A B) ((aeval x) p)" ]
[]
import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.Tactic.FieldSimp #align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open AffineMap variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE] def slope (f : k → PE) (a b : k) : E := (b - a)⁻¹ • (f b -ᵥ f a) #align slope slope theorem slope_fun_def (f : k → PE) : slope f = fun a b => (b - a)⁻¹ • (f b -ᵥ f a) := rfl #align slope_fun_def slope_fun_def theorem slope_def_field (f : k → k) (a b : k) : slope f a b = (f b - f a) / (b - a) := (div_eq_inv_mul _ _).symm #align slope_def_field slope_def_field theorem slope_fun_def_field (f : k → k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) := (div_eq_inv_mul _ _).symm #align slope_fun_def_field slope_fun_def_field @[simp] theorem slope_same (f : k → PE) (a : k) : (slope f a a : E) = 0 := by rw [slope, sub_self, inv_zero, zero_smul] #align slope_same slope_same theorem slope_def_module (f : k → E) (a b : k) : slope f a b = (b - a)⁻¹ • (f b - f a) := rfl #align slope_def_module slope_def_module @[simp] theorem sub_smul_slope (f : k → PE) (a b : k) : (b - a) • slope f a b = f b -ᵥ f a := by rcases eq_or_ne a b with (rfl | hne) · rw [sub_self, zero_smul, vsub_self] · rw [slope, smul_inv_smul₀ (sub_ne_zero.2 hne.symm)] #align sub_smul_slope sub_smul_slope theorem sub_smul_slope_vadd (f : k → PE) (a b : k) : (b - a) • slope f a b +ᵥ f a = f b := by rw [sub_smul_slope, vsub_vadd] #align sub_smul_slope_vadd sub_smul_slope_vadd @[simp] theorem slope_vadd_const (f : k → E) (c : PE) : (slope fun x => f x +ᵥ c) = slope f := by ext a b simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub] #align slope_vadd_const slope_vadd_const @[simp] theorem slope_sub_smul (f : k → E) {a b : k} (h : a ≠ b) : slope (fun x => (x - a) • f x) a b = f b := by simp [slope, inv_smul_smul₀ (sub_ne_zero.2 h.symm)] #align slope_sub_smul slope_sub_smul theorem eq_of_slope_eq_zero {f : k → PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by rw [← sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd] #align eq_of_slope_eq_zero eq_of_slope_eq_zero theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF] (f : PE →ᵃ[k] PF) (g : k → PE) (a b : k) : slope (f ∘ g) a b = f.linear (slope g a b) := by simp only [slope, (· ∘ ·), f.linear.map_smul, f.linearMap_vsub] #align affine_map.slope_comp AffineMap.slope_comp theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E →ₗ[k] F) (g : k → E) (a b : k) : slope (f ∘ g) a b = f (slope g a b) := f.toAffineMap.slope_comp g a b #align linear_map.slope_comp LinearMap.slope_comp
Mathlib/LinearAlgebra/AffineSpace/Slope.lean
92
93
theorem slope_comm (f : k → PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, ← neg_vsub_eq_vsub_rev, smul_neg, ← neg_smul, neg_inv, neg_sub]
[ " slope f a a = 0", " (b - a) • slope f a b = f b -ᵥ f a", " (a - a) • slope f a a = f a -ᵥ f a", " (b - a) • slope f a b +ᵥ f a = f b", " (slope fun x => f x +ᵥ c) = slope f", " slope (fun x => f x +ᵥ c) a b = slope f a b", " slope (fun x => (x - a) • f x) a b = f b", " f a = f b", " slope (⇑f ∘ g)...
[ " slope f a a = 0", " (b - a) • slope f a b = f b -ᵥ f a", " (a - a) • slope f a a = f a -ᵥ f a", " (b - a) • slope f a b +ᵥ f a = f b", " (slope fun x => f x +ᵥ c) = slope f", " slope (fun x => f x +ᵥ c) a b = slope f a b", " slope (fun x => (x - a) • f x) a b = f b", " f a = f b", " slope (⇑f ∘ g)...
import Mathlib.Data.Set.Image import Mathlib.Order.Interval.Set.Basic #align_import data.set.intervals.with_bot_top from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" open Set variable {α : Type*} namespace WithTop @[simp] theorem preimage_coe_top : (some : α → WithTop α) ⁻¹' {⊤} = (∅ : Set α) := eq_empty_of_subset_empty fun _ => coe_ne_top #align with_top.preimage_coe_top WithTop.preimage_coe_top variable [Preorder α] {a b : α} theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by ext x rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists] #align with_top.range_coe WithTop.range_coe @[simp] theorem preimage_coe_Ioi : (some : α → WithTop α) ⁻¹' Ioi a = Ioi a := ext fun _ => coe_lt_coe #align with_top.preimage_coe_Ioi WithTop.preimage_coe_Ioi @[simp] theorem preimage_coe_Ici : (some : α → WithTop α) ⁻¹' Ici a = Ici a := ext fun _ => coe_le_coe #align with_top.preimage_coe_Ici WithTop.preimage_coe_Ici @[simp] theorem preimage_coe_Iio : (some : α → WithTop α) ⁻¹' Iio a = Iio a := ext fun _ => coe_lt_coe #align with_top.preimage_coe_Iio WithTop.preimage_coe_Iio @[simp] theorem preimage_coe_Iic : (some : α → WithTop α) ⁻¹' Iic a = Iic a := ext fun _ => coe_le_coe #align with_top.preimage_coe_Iic WithTop.preimage_coe_Iic @[simp] theorem preimage_coe_Icc : (some : α → WithTop α) ⁻¹' Icc a b = Icc a b := by simp [← Ici_inter_Iic] #align with_top.preimage_coe_Icc WithTop.preimage_coe_Icc @[simp] theorem preimage_coe_Ico : (some : α → WithTop α) ⁻¹' Ico a b = Ico a b := by simp [← Ici_inter_Iio] #align with_top.preimage_coe_Ico WithTop.preimage_coe_Ico @[simp] theorem preimage_coe_Ioc : (some : α → WithTop α) ⁻¹' Ioc a b = Ioc a b := by simp [← Ioi_inter_Iic] #align with_top.preimage_coe_Ioc WithTop.preimage_coe_Ioc @[simp] theorem preimage_coe_Ioo : (some : α → WithTop α) ⁻¹' Ioo a b = Ioo a b := by simp [← Ioi_inter_Iio] #align with_top.preimage_coe_Ioo WithTop.preimage_coe_Ioo @[simp] theorem preimage_coe_Iio_top : (some : α → WithTop α) ⁻¹' Iio ⊤ = univ := by rw [← range_coe, preimage_range] #align with_top.preimage_coe_Iio_top WithTop.preimage_coe_Iio_top @[simp] theorem preimage_coe_Ico_top : (some : α → WithTop α) ⁻¹' Ico a ⊤ = Ici a := by simp [← Ici_inter_Iio] #align with_top.preimage_coe_Ico_top WithTop.preimage_coe_Ico_top @[simp] theorem preimage_coe_Ioo_top : (some : α → WithTop α) ⁻¹' Ioo a ⊤ = Ioi a := by simp [← Ioi_inter_Iio] #align with_top.preimage_coe_Ioo_top WithTop.preimage_coe_Ioo_top theorem image_coe_Ioi : (some : α → WithTop α) '' Ioi a = Ioo (a : WithTop α) ⊤ := by rw [← preimage_coe_Ioi, image_preimage_eq_inter_range, range_coe, Ioi_inter_Iio] #align with_top.image_coe_Ioi WithTop.image_coe_Ioi
Mathlib/Order/Interval/Set/WithBotTop.lean
93
94
theorem image_coe_Ici : (some : α → WithTop α) '' Ici a = Ico (a : WithTop α) ⊤ := by
rw [← preimage_coe_Ici, image_preimage_eq_inter_range, range_coe, Ici_inter_Iio]
[ " range some = Iio ⊤", " x ∈ range some ↔ x ∈ Iio ⊤", " some ⁻¹' Icc ↑a ↑b = Icc a b", " some ⁻¹' Ico ↑a ↑b = Ico a b", " some ⁻¹' Ioc ↑a ↑b = Ioc a b", " some ⁻¹' Ioo ↑a ↑b = Ioo a b", " some ⁻¹' Iio ⊤ = univ", " some ⁻¹' Ico ↑a ⊤ = Ici a", " some ⁻¹' Ioo ↑a ⊤ = Ioi a", " some '' Ioi a = Ioo ↑a ⊤...
[ " range some = Iio ⊤", " x ∈ range some ↔ x ∈ Iio ⊤", " some ⁻¹' Icc ↑a ↑b = Icc a b", " some ⁻¹' Ico ↑a ↑b = Ico a b", " some ⁻¹' Ioc ↑a ↑b = Ioc a b", " some ⁻¹' Ioo ↑a ↑b = Ioo a b", " some ⁻¹' Iio ⊤ = univ", " some ⁻¹' Ico ↑a ⊤ = Ici a", " some ⁻¹' Ioo ↑a ⊤ = Ioi a", " some '' Ioi a = Ioo ↑a ⊤...
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Algebra.Ring.NegOnePow namespace Matrix variable {R : Type*} [CommRing R]
Mathlib/LinearAlgebra/Matrix/Determinant/Misc.lean
21
47
theorem submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det {n : ℕ} (M : Matrix (Fin (n + 1)) (Fin n) R) (hv : ∑ j, M j = 0) (j₁ j₂ : Fin (n + 1)) : (M.submatrix (Fin.succAbove j₁) id).det = Int.negOnePow (j₁ - j₂) • (M.submatrix (Fin.succAbove j₂) id).det := by
suffices ∀ j, (M.submatrix (Fin.succAbove j) id).det = Int.negOnePow j • (M.submatrix (Fin.succAbove 0) id).det by rw [this j₁, this j₂, smul_smul, ← Int.negOnePow_add, sub_add_cancel] intro j induction j using Fin.induction with | zero => rw [Fin.val_zero, Nat.cast_zero, Int.negOnePow_zero, one_smul] | succ i h_ind => rw [Fin.val_succ, Nat.cast_add, Nat.cast_one, Int.negOnePow_succ, Units.neg_smul, ← neg_eq_iff_eq_neg, ← neg_one_smul R, ← det_updateRow_sum (M.submatrix i.succ.succAbove id) i (fun _ ↦ -1), ← Fin.coe_castSucc i, ← h_ind] congr ext a b simp_rw [neg_one_smul, updateRow_apply, Finset.sum_neg_distrib, Pi.neg_apply, Finset.sum_apply, submatrix_apply, id_eq] split_ifs with h · replace hv := congr_fun hv b rw [Fin.sum_univ_succAbove _ i.succ, Pi.add_apply, Finset.sum_apply] at hv rwa [h, Fin.succAbove_castSucc_self, neg_eq_iff_add_eq_zero, add_comm] · obtain h|h := ne_iff_lt_or_gt.mp h · rw [Fin.succAbove_castSucc_of_lt _ _ h, Fin.succAbove_of_succ_le _ _ (Fin.succ_lt_succ_iff.mpr h).le] · rw [Fin.succAbove_succ_of_lt _ _ h, Fin.succAbove_castSucc_of_le _ _ h.le]
[ " (M.submatrix j₁.succAbove id).det = (↑↑j₁ - ↑↑j₂).negOnePow • (M.submatrix j₂.succAbove id).det", " ∀ (j : Fin (n + 1)), (M.submatrix j.succAbove id).det = (↑↑j).negOnePow • (M.submatrix (Fin.succAbove 0) id).det", " (M.submatrix j.succAbove id).det = (↑↑j).negOnePow • (M.submatrix (Fin.succAbove 0) id).det",...
[]
import Mathlib.Probability.Variance import Mathlib.MeasureTheory.Function.UniformIntegrable #align_import probability.ident_distrib from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open MeasureTheory Filter Finset noncomputable section open scoped Topology MeasureTheory ENNReal NNReal variable {α β γ δ : Type*} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] [MeasurableSpace δ] namespace ProbabilityTheory structure IdentDistrib (f : α → γ) (g : β → γ) (μ : Measure α := by volume_tac) (ν : Measure β := by volume_tac) : Prop where aemeasurable_fst : AEMeasurable f μ aemeasurable_snd : AEMeasurable g ν map_eq : Measure.map f μ = Measure.map g ν #align probability_theory.ident_distrib ProbabilityTheory.IdentDistrib namespace IdentDistrib open TopologicalSpace variable {μ : Measure α} {ν : Measure β} {f : α → γ} {g : β → γ} protected theorem refl (hf : AEMeasurable f μ) : IdentDistrib f f μ μ := { aemeasurable_fst := hf aemeasurable_snd := hf map_eq := rfl } #align probability_theory.ident_distrib.refl ProbabilityTheory.IdentDistrib.refl protected theorem symm (h : IdentDistrib f g μ ν) : IdentDistrib g f ν μ := { aemeasurable_fst := h.aemeasurable_snd aemeasurable_snd := h.aemeasurable_fst map_eq := h.map_eq.symm } #align probability_theory.ident_distrib.symm ProbabilityTheory.IdentDistrib.symm protected theorem trans {ρ : Measure δ} {h : δ → γ} (h₁ : IdentDistrib f g μ ν) (h₂ : IdentDistrib g h ν ρ) : IdentDistrib f h μ ρ := { aemeasurable_fst := h₁.aemeasurable_fst aemeasurable_snd := h₂.aemeasurable_snd map_eq := h₁.map_eq.trans h₂.map_eq } #align probability_theory.ident_distrib.trans ProbabilityTheory.IdentDistrib.trans protected theorem comp_of_aemeasurable {u : γ → δ} (h : IdentDistrib f g μ ν) (hu : AEMeasurable u (Measure.map f μ)) : IdentDistrib (u ∘ f) (u ∘ g) μ ν := { aemeasurable_fst := hu.comp_aemeasurable h.aemeasurable_fst aemeasurable_snd := by rw [h.map_eq] at hu; exact hu.comp_aemeasurable h.aemeasurable_snd map_eq := by rw [← AEMeasurable.map_map_of_aemeasurable hu h.aemeasurable_fst, ← AEMeasurable.map_map_of_aemeasurable _ h.aemeasurable_snd, h.map_eq] rwa [← h.map_eq] } #align probability_theory.ident_distrib.comp_of_ae_measurable ProbabilityTheory.IdentDistrib.comp_of_aemeasurable protected theorem comp {u : γ → δ} (h : IdentDistrib f g μ ν) (hu : Measurable u) : IdentDistrib (u ∘ f) (u ∘ g) μ ν := h.comp_of_aemeasurable hu.aemeasurable #align probability_theory.ident_distrib.comp ProbabilityTheory.IdentDistrib.comp protected theorem of_ae_eq {g : α → γ} (hf : AEMeasurable f μ) (heq : f =ᵐ[μ] g) : IdentDistrib f g μ μ := { aemeasurable_fst := hf aemeasurable_snd := hf.congr heq map_eq := Measure.map_congr heq } #align probability_theory.ident_distrib.of_ae_eq ProbabilityTheory.IdentDistrib.of_ae_eq lemma _root_.MeasureTheory.AEMeasurable.identDistrib_mk (hf : AEMeasurable f μ) : IdentDistrib f (hf.mk f) μ μ := IdentDistrib.of_ae_eq hf hf.ae_eq_mk lemma _root_.MeasureTheory.AEStronglyMeasurable.identDistrib_mk [TopologicalSpace γ] [PseudoMetrizableSpace γ] [BorelSpace γ] (hf : AEStronglyMeasurable f μ) : IdentDistrib f (hf.mk f) μ μ := IdentDistrib.of_ae_eq hf.aemeasurable hf.ae_eq_mk theorem measure_mem_eq (h : IdentDistrib f g μ ν) {s : Set γ} (hs : MeasurableSet s) : μ (f ⁻¹' s) = ν (g ⁻¹' s) := by rw [← Measure.map_apply_of_aemeasurable h.aemeasurable_fst hs, ← Measure.map_apply_of_aemeasurable h.aemeasurable_snd hs, h.map_eq] #align probability_theory.ident_distrib.measure_mem_eq ProbabilityTheory.IdentDistrib.measure_mem_eq alias measure_preimage_eq := measure_mem_eq #align probability_theory.ident_distrib.measure_preimage_eq ProbabilityTheory.IdentDistrib.measure_preimage_eq theorem ae_snd (h : IdentDistrib f g μ ν) {p : γ → Prop} (pmeas : MeasurableSet {x | p x}) (hp : ∀ᵐ x ∂μ, p (f x)) : ∀ᵐ x ∂ν, p (g x) := by apply (ae_map_iff h.aemeasurable_snd pmeas).1 rw [← h.map_eq] exact (ae_map_iff h.aemeasurable_fst pmeas).2 hp #align probability_theory.ident_distrib.ae_snd ProbabilityTheory.IdentDistrib.ae_snd theorem ae_mem_snd (h : IdentDistrib f g μ ν) {t : Set γ} (tmeas : MeasurableSet t) (ht : ∀ᵐ x ∂μ, f x ∈ t) : ∀ᵐ x ∂ν, g x ∈ t := h.ae_snd tmeas ht #align probability_theory.ident_distrib.ae_mem_snd ProbabilityTheory.IdentDistrib.ae_mem_snd theorem aestronglyMeasurable_fst [TopologicalSpace γ] [MetrizableSpace γ] [OpensMeasurableSpace γ] [SecondCountableTopology γ] (h : IdentDistrib f g μ ν) : AEStronglyMeasurable f μ := h.aemeasurable_fst.aestronglyMeasurable #align probability_theory.ident_distrib.ae_strongly_measurable_fst ProbabilityTheory.IdentDistrib.aestronglyMeasurable_fst
Mathlib/Probability/IdentDistrib.lean
162
168
theorem aestronglyMeasurable_snd [TopologicalSpace γ] [MetrizableSpace γ] [BorelSpace γ] (h : IdentDistrib f g μ ν) (hf : AEStronglyMeasurable f μ) : AEStronglyMeasurable g ν := by
refine aestronglyMeasurable_iff_aemeasurable_separable.2 ⟨h.aemeasurable_snd, ?_⟩ rcases (aestronglyMeasurable_iff_aemeasurable_separable.1 hf).2 with ⟨t, t_sep, ht⟩ refine ⟨closure t, t_sep.closure, ?_⟩ apply h.ae_mem_snd isClosed_closure.measurableSet filter_upwards [ht] with x hx using subset_closure hx
[ " AEMeasurable (u ∘ g) ν", " Measure.map (u ∘ f) μ = Measure.map (u ∘ g) ν", " AEMeasurable u (Measure.map g ν)", " μ (f ⁻¹' s) = ν (g ⁻¹' s)", " ∀ᵐ (x : β) ∂ν, p (g x)", " ∀ᵐ (y : γ) ∂Measure.map g ν, p y", " ∀ᵐ (y : γ) ∂Measure.map f μ, p y", " AEStronglyMeasurable g ν", " ∃ t, IsSeparable t ∧ ∀ᵐ ...
[ " AEMeasurable (u ∘ g) ν", " Measure.map (u ∘ f) μ = Measure.map (u ∘ g) ν", " AEMeasurable u (Measure.map g ν)", " μ (f ⁻¹' s) = ν (g ⁻¹' s)", " ∀ᵐ (x : β) ∂ν, p (g x)", " ∀ᵐ (y : γ) ∂Measure.map g ν, p y", " ∀ᵐ (y : γ) ∂Measure.map f μ, p y" ]
import Mathlib.Algebra.Order.GroupWithZero.Synonym import Mathlib.Algebra.Order.Monoid.WithTop import Mathlib.Algebra.Order.Ring.Canonical import Mathlib.Algebra.Ring.Hom.Defs #align_import algebra.order.ring.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" variable {α : Type*} namespace WithTop variable [DecidableEq α] section MulZeroClass variable [MulZeroClass α] {a b : WithTop α} instance instMulZeroClass : MulZeroClass (WithTop α) where zero := 0 mul a b := match a, b with | (a : α), (b : α) => ↑(a * b) | (a : α), ⊤ => if a = 0 then 0 else ⊤ | ⊤, (b : α) => if b = 0 then 0 else ⊤ | ⊤, ⊤ => ⊤ mul_zero a := match a with | (a : α) => congr_arg some $ mul_zero _ | ⊤ => if_pos rfl zero_mul b := match b with | (b : α) => congr_arg some $ zero_mul _ | ⊤ => if_pos rfl @[simp, norm_cast] lemma coe_mul (a b : α) : (↑(a * b) : WithTop α) = a * b := rfl #align with_top.coe_mul WithTop.coe_mul lemma mul_top' : ∀ (a : WithTop α), a * ⊤ = if a = 0 then 0 else ⊤ | (a : α) => if_congr coe_eq_zero.symm rfl rfl | ⊤ => (if_neg top_ne_zero).symm #align with_top.mul_top' WithTop.mul_top' @[simp] lemma mul_top (h : a ≠ 0) : a * ⊤ = ⊤ := by rw [mul_top', if_neg h] #align with_top.mul_top WithTop.mul_top lemma top_mul' : ∀ (b : WithTop α), ⊤ * b = if b = 0 then 0 else ⊤ | (b : α) => if_congr coe_eq_zero.symm rfl rfl | ⊤ => (if_neg top_ne_zero).symm #align with_top.top_mul' WithTop.top_mul' @[simp] lemma top_mul (hb : b ≠ 0) : ⊤ * b = ⊤ := by rw [top_mul', if_neg hb] #align with_top.top_mul WithTop.top_mul -- eligible for dsimp @[simp, nolint simpNF] lemma top_mul_top : (⊤ * ⊤ : WithTop α) = ⊤ := rfl #align with_top.top_mul_top WithTop.top_mul_top lemma mul_def (a b : WithTop α) : a * b = if a = 0 ∨ b = 0 then 0 else WithTop.map₂ (· * ·) a b := by cases a <;> cases b <;> aesop #align with_top.mul_def WithTop.mul_def lemma mul_eq_top_iff : a * b = ⊤ ↔ a ≠ 0 ∧ b = ⊤ ∨ a = ⊤ ∧ b ≠ 0 := by rw [mul_def]; aesop #align with_top.mul_eq_top_iff WithTop.mul_eq_top_iff lemma mul_coe_eq_bind {b : α} (hb : b ≠ 0) : ∀ a, (a * b : WithTop α) = a.bind fun a ↦ ↑(a * b) | ⊤ => by simp [top_mul, hb]; rfl | (a : α) => rfl #align with_top.mul_coe WithTop.mul_coe_eq_bind lemma coe_mul_eq_bind {a : α} (ha : a ≠ 0) : ∀ b, (a * b : WithTop α) = b.bind fun b ↦ ↑(a * b) | ⊤ => by simp [top_mul, ha]; rfl | (b : α) => rfl @[simp] lemma untop'_zero_mul (a b : WithTop α) : (a * b).untop' 0 = a.untop' 0 * b.untop' 0 := by by_cases ha : a = 0; · rw [ha, zero_mul, ← coe_zero, untop'_coe, zero_mul] by_cases hb : b = 0; · rw [hb, mul_zero, ← coe_zero, untop'_coe, mul_zero] induction a; · rw [top_mul hb, untop'_top, zero_mul] induction b; · rw [mul_top ha, untop'_top, mul_zero] rw [← coe_mul, untop'_coe, untop'_coe, untop'_coe] #align with_top.untop'_zero_mul WithTop.untop'_zero_mul
Mathlib/Algebra/Order/Ring/WithTop.lean
89
91
theorem mul_lt_top' [LT α] {a b : WithTop α} (ha : a < ⊤) (hb : b < ⊤) : a * b < ⊤ := by
rw [WithTop.lt_top_iff_ne_top] at * simp only [Ne, mul_eq_top_iff, *, and_false, false_and, or_self, not_false_eq_true]
[ " a * ⊤ = ⊤", " ⊤ * b = ⊤", " a * b = if a = 0 ∨ b = 0 then 0 else map₂ (fun x x_1 => x * x_1) a b", " ⊤ * b = if ⊤ = 0 ∨ b = 0 then 0 else map₂ (fun x x_1 => x * x_1) ⊤ b", " ↑a✝ * b = if ↑a✝ = 0 ∨ b = 0 then 0 else map₂ (fun x x_1 => x * x_1) (↑a✝) b", " ⊤ * ⊤ = if ⊤ = 0 ∨ ⊤ = 0 then 0 else map₂ (fun x ...
[ " a * ⊤ = ⊤", " ⊤ * b = ⊤", " a * b = if a = 0 ∨ b = 0 then 0 else map₂ (fun x x_1 => x * x_1) a b", " ⊤ * b = if ⊤ = 0 ∨ b = 0 then 0 else map₂ (fun x x_1 => x * x_1) ⊤ b", " ↑a✝ * b = if ↑a✝ = 0 ∨ b = 0 then 0 else map₂ (fun x x_1 => x * x_1) (↑a✝) b", " ⊤ * ⊤ = if ⊤ = 0 ∨ ⊤ = 0 then 0 else map₂ (fun x ...
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Tactic.NthRewrite #align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" namespace Nat theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) : d = a.gcd b := (dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm #align nat.gcd_greatest Nat.gcd_greatest @[simp] theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by simp [gcd_rec m (n + k * m), gcd_rec m n] #align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right @[simp] theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by simp [gcd_rec m (n + m * k), gcd_rec m n] #align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right @[simp] theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right @[simp] theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right @[simp] theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by rw [gcd_comm, gcd_add_mul_right_right, gcd_comm] #align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left @[simp] theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by rw [gcd_comm, gcd_add_mul_left_right, gcd_comm] #align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left @[simp] theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by rw [gcd_comm, gcd_mul_right_add_right, gcd_comm] #align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left @[simp] theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by rw [gcd_comm, gcd_mul_left_add_right, gcd_comm] #align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left @[simp] theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n := Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1) #align nat.gcd_add_self_right Nat.gcd_add_self_right @[simp] theorem gcd_add_self_left (m n : ℕ) : gcd (m + n) n = gcd m n := by rw [gcd_comm, gcd_add_self_right, gcd_comm] #align nat.gcd_add_self_left Nat.gcd_add_self_left @[simp]
Mathlib/Data/Nat/GCD/Basic.lean
85
85
theorem gcd_self_add_left (m n : ℕ) : gcd (m + n) m = gcd n m := by
rw [add_comm, gcd_add_self_left]
[ " m.gcd (n + k * m) = m.gcd n", " m.gcd (n + m * k) = m.gcd n", " m.gcd (k * m + n) = m.gcd n", " m.gcd (m * k + n) = m.gcd n", " (m + k * n).gcd n = m.gcd n", " (m + n * k).gcd n = m.gcd n", " (k * n + m).gcd n = m.gcd n", " (n * k + m).gcd n = m.gcd n", " m.gcd (n + m) = m.gcd (n + 1 * m)", " (m...
[ " m.gcd (n + k * m) = m.gcd n", " m.gcd (n + m * k) = m.gcd n", " m.gcd (k * m + n) = m.gcd n", " m.gcd (m * k + n) = m.gcd n", " (m + k * n).gcd n = m.gcd n", " (m + n * k).gcd n = m.gcd n", " (k * n + m).gcd n = m.gcd n", " (n * k + m).gcd n = m.gcd n", " m.gcd (n + m) = m.gcd (n + 1 * m)", " (m...
import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.RingTheory.HahnSeries.Basic #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical noncomputable section variable {Γ R : Type*} namespace HahnSeries section Addition variable [PartialOrder Γ] section AddMonoid variable [AddMonoid R] instance : Add (HahnSeries Γ R) where add x y := { coeff := x.coeff + y.coeff isPWO_support' := (x.isPWO_support.union y.isPWO_support).mono (Function.support_add _ _) } instance : AddMonoid (HahnSeries Γ R) where zero := 0 add := (· + ·) nsmul := nsmulRec add_assoc x y z := by ext apply add_assoc zero_add x := by ext apply zero_add add_zero x := by ext apply add_zero @[simp] theorem add_coeff' {x y : HahnSeries Γ R} : (x + y).coeff = x.coeff + y.coeff := rfl #align hahn_series.add_coeff' HahnSeries.add_coeff' theorem add_coeff {x y : HahnSeries Γ R} {a : Γ} : (x + y).coeff a = x.coeff a + y.coeff a := rfl #align hahn_series.add_coeff HahnSeries.add_coeff theorem support_add_subset {x y : HahnSeries Γ R} : support (x + y) ⊆ support x ∪ support y := fun a ha => by rw [mem_support, add_coeff] at ha rw [Set.mem_union, mem_support, mem_support] contrapose! ha rw [ha.1, ha.2, add_zero] #align hahn_series.support_add_subset HahnSeries.support_add_subset
Mathlib/RingTheory/HahnSeries/Addition.lean
81
89
theorem min_order_le_order_add {Γ} [Zero Γ] [LinearOrder Γ] {x y : HahnSeries Γ R} (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
by_cases hx : x = 0; · simp [hx] by_cases hy : y = 0; · simp [hy] rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy] apply le_of_eq_of_le _ (Set.IsWF.min_le_min_of_subset (support_add_subset (x := x) (y := y))) · simp · simp [hy] · exact (Set.IsWF.min_union _ _ _ _).symm
[ " x + y + z = x + (y + z)", " (x + y + z).coeff x✝ = (x + (y + z)).coeff x✝", " 0 + x = x", " (0 + x).coeff x✝ = x.coeff x✝", " x + 0 = x", " (x + 0).coeff x✝ = x.coeff x✝", " a ∈ x.support ∪ y.support", " x.coeff a ≠ 0 ∨ y.coeff a ≠ 0", " x.coeff a + y.coeff a = 0", " min x.order y.order ≤ (x + y...
[ " x + y + z = x + (y + z)", " (x + y + z).coeff x✝ = (x + (y + z)).coeff x✝", " 0 + x = x", " (0 + x).coeff x✝ = x.coeff x✝", " x + 0 = x", " (x + 0).coeff x✝ = x.coeff x✝", " a ∈ x.support ∪ y.support", " x.coeff a ≠ 0 ∨ y.coeff a ≠ 0", " x.coeff a + y.coeff a = 0" ]
import Mathlib.Data.Fintype.BigOperators import Mathlib.Logic.Equiv.Embedding #align_import data.fintype.card_embedding from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" local notation "|" x "|" => Finset.card x local notation "‖" x "‖" => Fintype.card x open Function open Nat namespace Fintype theorem card_embedding_eq_of_unique {α β : Type*} [Unique α] [Fintype β] [Fintype (α ↪ β)] : ‖α ↪ β‖ = ‖β‖ := card_congr Equiv.uniqueEmbeddingEquivResult #align fintype.card_embedding_eq_of_unique Fintype.card_embedding_eq_of_unique -- Establishes the cardinality of the type of all injections between two finite types. -- Porting note: `induction'` is broken so instead we make an ugly refine and `dsimp` a lot. @[simp]
Mathlib/Data/Fintype/CardEmbedding.lean
36
50
theorem card_embedding_eq {α β : Type*} [Fintype α] [Fintype β] [emb : Fintype (α ↪ β)] : ‖α ↪ β‖ = ‖β‖.descFactorial ‖α‖ := by
rw [Subsingleton.elim emb Embedding.fintype] refine Fintype.induction_empty_option (P := fun t ↦ ‖t ↪ β‖ = ‖β‖.descFactorial ‖t‖) (fun α₁ α₂ h₂ e ih ↦ ?_) (?_) (fun γ h ih ↦ ?_) α <;> dsimp only <;> clear! α · letI := Fintype.ofEquiv _ e.symm rw [← card_congr (Equiv.embeddingCongr e (Equiv.refl β)), ih, card_congr e] · rw [card_pempty, Nat.descFactorial_zero, card_eq_one_iff] exact ⟨Embedding.ofIsEmpty, fun x ↦ DFunLike.ext _ _ isEmptyElim⟩ · classical dsimp only at ih rw [card_option, Nat.descFactorial_succ, card_congr (Embedding.optionEmbeddingEquiv γ β), card_sigma, ← ih] simp only [Fintype.card_compl_set, Fintype.card_range, Finset.sum_const, Finset.card_univ, Nat.nsmul_eq_mul, mul_comm]
[ " ‖α ↪ β‖ = ‖β‖.descFactorial ‖α‖", " (fun t [Fintype t] => ‖t ↪ β‖ = ‖β‖.descFactorial ‖t‖) α₂", " (fun t [Fintype t] => ‖t ↪ β‖ = ‖β‖.descFactorial ‖t‖) PEmpty.{u_1 + 1}", " (fun t [Fintype t] => ‖t ↪ β‖ = ‖β‖.descFactorial ‖t‖) (Option γ)", " ‖α₂ ↪ β‖ = ‖β‖.descFactorial ‖α₂‖", " ‖PEmpty.{u_1 + 1} ↪ β‖...
[]
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.pi_nat from "leanprover-community/mathlib"@"49b7f94aab3a3bdca1f9f34c5d818afb253b3993" noncomputable section open scoped Classical open Topology Filter open TopologicalSpace Set Metric Filter Function attribute [local simp] pow_le_pow_iff_right one_lt_two inv_le_inv zero_le_two zero_lt_two variable {E : ℕ → Type*} namespace PiNat irreducible_def firstDiff (x y : ∀ n, E n) : ℕ := if h : x ≠ y then Nat.find (ne_iff.1 h) else 0 #align pi_nat.first_diff PiNat.firstDiff theorem apply_firstDiff_ne {x y : ∀ n, E n} (h : x ≠ y) : x (firstDiff x y) ≠ y (firstDiff x y) := by rw [firstDiff_def, dif_pos h] exact Nat.find_spec (ne_iff.1 h) #align pi_nat.apply_first_diff_ne PiNat.apply_firstDiff_ne theorem apply_eq_of_lt_firstDiff {x y : ∀ n, E n} {n : ℕ} (hn : n < firstDiff x y) : x n = y n := by rw [firstDiff_def] at hn split_ifs at hn with h · convert Nat.find_min (ne_iff.1 h) hn simp · exact (not_lt_zero' hn).elim #align pi_nat.apply_eq_of_lt_first_diff PiNat.apply_eq_of_lt_firstDiff theorem firstDiff_comm (x y : ∀ n, E n) : firstDiff x y = firstDiff y x := by simp only [firstDiff_def, ne_comm] #align pi_nat.first_diff_comm PiNat.firstDiff_comm theorem min_firstDiff_le (x y z : ∀ n, E n) (h : x ≠ z) : min (firstDiff x y) (firstDiff y z) ≤ firstDiff x z := by by_contra! H rw [lt_min_iff] at H refine apply_firstDiff_ne h ?_ calc x (firstDiff x z) = y (firstDiff x z) := apply_eq_of_lt_firstDiff H.1 _ = z (firstDiff x z) := apply_eq_of_lt_firstDiff H.2 #align pi_nat.min_first_diff_le PiNat.min_firstDiff_le def cylinder (x : ∀ n, E n) (n : ℕ) : Set (∀ n, E n) := { y | ∀ i, i < n → y i = x i } #align pi_nat.cylinder PiNat.cylinder theorem cylinder_eq_pi (x : ∀ n, E n) (n : ℕ) : cylinder x n = Set.pi (Finset.range n : Set ℕ) fun i : ℕ => {x i} := by ext y simp [cylinder] #align pi_nat.cylinder_eq_pi PiNat.cylinder_eq_pi @[simp]
Mathlib/Topology/MetricSpace/PiNat.lean
119
119
theorem cylinder_zero (x : ∀ n, E n) : cylinder x 0 = univ := by
simp [cylinder_eq_pi]
[ " x (firstDiff x y) ≠ y (firstDiff x y)", " x (Nat.find ⋯) ≠ y (Nat.find ⋯)", " x n = y n", " x n = y n ↔ ¬x n ≠ y n", " firstDiff x y = firstDiff y x", " min (firstDiff x y) (firstDiff y z) ≤ firstDiff x z", " False", " x (firstDiff x z) = z (firstDiff x z)", " cylinder x n = (↑(Finset.range n)).pi...
[ " x (firstDiff x y) ≠ y (firstDiff x y)", " x (Nat.find ⋯) ≠ y (Nat.find ⋯)", " x n = y n", " x n = y n ↔ ¬x n ≠ y n", " firstDiff x y = firstDiff y x", " min (firstDiff x y) (firstDiff y z) ≤ firstDiff x z", " False", " x (firstDiff x z) = z (firstDiff x z)", " cylinder x n = (↑(Finset.range n)).pi...
import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Data.ZMod.Quotient #align_import measure_theory.group.add_circle from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter MeasureTheory MeasureTheory.Measure Metric open scoped MeasureTheory Pointwise Topology ENNReal namespace AddCircle variable {T : ℝ} [hT : Fact (0 < T)]
Mathlib/MeasureTheory/Group/AddCircle.lean
34
48
theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε =ᵐ[volume] ball x ε := by
rcases le_or_lt ε 0 with hε | hε · rw [ball_eq_empty.mpr hε, ae_eq_empty, volume_closedBall, min_eq_right (by linarith [hT.out] : 2 * ε ≤ T), ENNReal.ofReal_eq_zero] exact mul_nonpos_of_nonneg_of_nonpos zero_le_two hε · suffices volume (closedBall x ε) ≤ volume (ball x ε) by exact (ae_eq_of_subset_of_measure_ge ball_subset_closedBall this measurableSet_ball (measure_ne_top _ _)).symm have : Tendsto (fun δ => volume (closedBall x δ)) (𝓝[<] ε) (𝓝 <| volume (closedBall x ε)) := by simp_rw [volume_closedBall] refine ENNReal.tendsto_ofReal (Tendsto.min tendsto_const_nhds <| Tendsto.const_mul _ ?_) convert (@monotone_id ℝ _).tendsto_nhdsWithin_Iio ε simp refine le_of_tendsto this (mem_nhdsWithin_Iio_iff_exists_Ioo_subset.mpr ⟨0, hε, fun r hr => ?_⟩) exact measure_mono (closedBall_subset_ball hr.2)
[ " closedBall x ε =ᶠ[ae volume] ball x ε", " 2 * ε ≤ T", " 2 * ε ≤ 0", " volume (closedBall x ε) ≤ volume (ball x ε)", " Tendsto (fun δ => volume (closedBall x δ)) (𝓝[<] ε) (𝓝 (volume (closedBall x ε)))", " Tendsto (fun δ => ENNReal.ofReal (min T (2 * δ))) (𝓝[<] ε) (𝓝 (ENNReal.ofReal (min T (2 * ε))))"...
[]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.MvPowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def PowerSeries (R : Type*) := MvPowerSeries Unit R #align power_series PowerSeries namespace PowerSeries open Finsupp (single) variable {R : Type*} section -- Porting note: not available in Lean 4 -- local reducible PowerSeries scoped notation:9000 R "⟦X⟧" => PowerSeries R instance [Inhabited R] : Inhabited R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Zero R] : Zero R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddMonoid R] : AddMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddGroup R] : AddGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Semiring R] : Semiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommSemiring R] : CommSemiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Ring R] : Ring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommRing R] : CommRing R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Nontrivial R] : Nontrivial R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S] [IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ := Pi.isScalarTower instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance end section Semiring variable (R) [Semiring R] def coeff (n : ℕ) : R⟦X⟧ →ₗ[R] R := MvPowerSeries.coeff R (single () n) #align power_series.coeff PowerSeries.coeff def monomial (n : ℕ) : R →ₗ[R] R⟦X⟧ := MvPowerSeries.monomial R (single () n) #align power_series.monomial PowerSeries.monomial variable {R} theorem coeff_def {s : Unit →₀ ℕ} {n : ℕ} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by erw [coeff, ← h, ← Finsupp.unique_single s] #align power_series.coeff_def PowerSeries.coeff_def @[ext] theorem ext {φ ψ : R⟦X⟧} (h : ∀ n, coeff R n φ = coeff R n ψ) : φ = ψ := MvPowerSeries.ext fun n => by rw [← coeff_def] · apply h rfl #align power_series.ext PowerSeries.ext theorem ext_iff {φ ψ : R⟦X⟧} : φ = ψ ↔ ∀ n, coeff R n φ = coeff R n ψ := ⟨fun h n => congr_arg (coeff R n) h, ext⟩ #align power_series.ext_iff PowerSeries.ext_iff instance [Subsingleton R] : Subsingleton R⟦X⟧ := by simp only [subsingleton_iff, ext_iff] exact fun _ _ _ ↦ (subsingleton_iff).mp (by infer_instance) _ _ def mk {R} (f : ℕ → R) : R⟦X⟧ := fun s => f (s ()) #align power_series.mk PowerSeries.mk @[simp] theorem coeff_mk (n : ℕ) (f : ℕ → R) : coeff R n (mk f) = f n := congr_arg f Finsupp.single_eq_same #align power_series.coeff_mk PowerSeries.coeff_mk
Mathlib/RingTheory/PowerSeries/Basic.lean
181
184
theorem coeff_monomial (m n : ℕ) (a : R) : coeff R m (monomial R n a) = if m = n then a else 0 := calc coeff R m (monomial R n a) = _ := MvPowerSeries.coeff_monomial _ _ _ _ = if m = n then a else 0 := by
simp only [Finsupp.unique_single_eq_iff]
[ " Inhabited R⟦X⟧", " Inhabited (MvPowerSeries Unit R)", " Zero R⟦X⟧", " Zero (MvPowerSeries Unit R)", " AddMonoid R⟦X⟧", " AddMonoid (MvPowerSeries Unit R)", " AddGroup R⟦X⟧", " AddGroup (MvPowerSeries Unit R)", " AddCommMonoid R⟦X⟧", " AddCommMonoid (MvPowerSeries Unit R)", " AddCommGroup R⟦X⟧"...
[ " Inhabited R⟦X⟧", " Inhabited (MvPowerSeries Unit R)", " Zero R⟦X⟧", " Zero (MvPowerSeries Unit R)", " AddMonoid R⟦X⟧", " AddMonoid (MvPowerSeries Unit R)", " AddGroup R⟦X⟧", " AddGroup (MvPowerSeries Unit R)", " AddCommMonoid R⟦X⟧", " AddCommMonoid (MvPowerSeries Unit R)", " AddCommGroup R⟦X⟧"...
import Batteries.Data.RBMap.Basic import Batteries.Tactic.SeqFocus namespace Batteries namespace RBNode open RBColor attribute [simp] All theorem All.trivial (H : ∀ {x : α}, p x) : ∀ {t : RBNode α}, t.All p | nil => _root_.trivial | node .. => ⟨H, All.trivial H, All.trivial H⟩ theorem All_and {t : RBNode α} : t.All (fun a => p a ∧ q a) ↔ t.All p ∧ t.All q := by induction t <;> simp [*, and_assoc, and_left_comm] protected theorem cmpLT.flip (h₁ : cmpLT cmp x y) : cmpLT (flip cmp) y x := ⟨have : TransCmp cmp := inferInstanceAs (TransCmp (flip (flip cmp))); h₁.1⟩ theorem cmpLT.trans (h₁ : cmpLT cmp x y) (h₂ : cmpLT cmp y z) : cmpLT cmp x z := ⟨TransCmp.lt_trans h₁.1 h₂.1⟩ theorem cmpLT.trans_l {cmp x y} (H : cmpLT cmp x y) {t : RBNode α} (h : t.All (cmpLT cmp y ·)) : t.All (cmpLT cmp x ·) := h.imp fun h => H.trans h theorem cmpLT.trans_r {cmp x y} (H : cmpLT cmp x y) {a : RBNode α} (h : a.All (cmpLT cmp · x)) : a.All (cmpLT cmp · y) := h.imp fun h => h.trans H theorem cmpEq.lt_congr_left (H : cmpEq cmp x y) : cmpLT cmp x z ↔ cmpLT cmp y z := ⟨fun ⟨h⟩ => ⟨TransCmp.cmp_congr_left H.1 ▸ h⟩, fun ⟨h⟩ => ⟨TransCmp.cmp_congr_left H.1 ▸ h⟩⟩ theorem cmpEq.lt_congr_right (H : cmpEq cmp y z) : cmpLT cmp x y ↔ cmpLT cmp x z := ⟨fun ⟨h⟩ => ⟨TransCmp.cmp_congr_right H.1 ▸ h⟩, fun ⟨h⟩ => ⟨TransCmp.cmp_congr_right H.1 ▸ h⟩⟩ @[simp] theorem reverse_reverse (t : RBNode α) : t.reverse.reverse = t := by induction t <;> simp [*]
.lake/packages/batteries/Batteries/Data/RBMap/WF.lean
51
52
theorem reverse_eq_iff {t t' : RBNode α} : t.reverse = t' ↔ t = t'.reverse := by
constructor <;> rintro rfl <;> simp
[ " All (fun a => p a ∧ q a) t ↔ All p t ∧ All q t", " All (fun a => p a ∧ q a) nil ↔ All p nil ∧ All q nil", " All (fun a => p a ∧ q a) (node c✝ l✝ v✝ r✝) ↔ All p (node c✝ l✝ v✝ r✝) ∧ All q (node c✝ l✝ v✝ r✝)", " t.reverse.reverse = t", " nil.reverse.reverse = nil", " (node c✝ l✝ v✝ r✝).reverse.reverse = n...
[ " All (fun a => p a ∧ q a) t ↔ All p t ∧ All q t", " All (fun a => p a ∧ q a) nil ↔ All p nil ∧ All q nil", " All (fun a => p a ∧ q a) (node c✝ l✝ v✝ r✝) ↔ All p (node c✝ l✝ v✝ r✝) ∧ All q (node c✝ l✝ v✝ r✝)", " t.reverse.reverse = t", " nil.reverse.reverse = nil", " (node c✝ l✝ v✝ r✝).reverse.reverse = n...
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -φ := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : φ * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * φ = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : φ + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - φ = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = φ := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : φ - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj
Mathlib/Data/Real/GoldenRatio.lean
87
88
theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2) - φ ^ (n + 1) = φ ^ n := by
rw [goldenRatio]; ring_nf; norm_num; ring
[ " φ⁻¹ = -ψ", " 0 < 1", " 0 < 5", " 2 * 2 = 5 - 1", " ψ⁻¹ = -φ", " -ψ = φ⁻¹", " φ * ψ = -1", " (1 + √5) * (1 - √5) = -(2 * 2)", " 1 ^ 2 - √5 ^ 2 = -(2 * 2)", " ψ * φ = -1", " φ + ψ = 1", " (1 + √5) / 2 + (1 - √5) / 2 = 1", " 1 - φ = ψ", " 1 - ψ = φ", " φ - ψ = √5", " φ ^ (n + 2) - φ ^ (...
[ " φ⁻¹ = -ψ", " 0 < 1", " 0 < 5", " 2 * 2 = 5 - 1", " ψ⁻¹ = -φ", " -ψ = φ⁻¹", " φ * ψ = -1", " (1 + √5) * (1 - √5) = -(2 * 2)", " 1 ^ 2 - √5 ^ 2 = -(2 * 2)", " ψ * φ = -1", " φ + ψ = 1", " (1 + √5) / 2 + (1 - √5) / 2 = 1", " 1 - φ = ψ", " 1 - ψ = φ", " φ - ψ = √5" ]
import Mathlib.LinearAlgebra.Dimension.Free import Mathlib.Algebra.Module.Torsion #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v v' u₁' w w' variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v} variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*} open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁] variable [Module R M] [Module R M'] [Module R M₁] section Finsupp variable (R M M') variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M'] open Module.Free @[simp] theorem rank_finsupp (ι : Type w) : Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M) rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma, Cardinal.sum_const] #align rank_finsupp rank_finsupp theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by simp [rank_finsupp] #align rank_finsupp' rank_finsupp' -- Porting note, this should not be `@[simp]`, as simp can prove it. -- @[simp] theorem rank_finsupp_self (ι : Type w) : Module.rank R (ι →₀ R) = Cardinal.lift.{u} #ι := by simp [rank_finsupp] #align rank_finsupp_self rank_finsupp_self theorem rank_finsupp_self' {ι : Type u} : Module.rank R (ι →₀ R) = #ι := by simp #align rank_finsupp_self' rank_finsupp_self' @[simp] theorem rank_directSum {ι : Type v} (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)] [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.rank R (⨁ i, M i) = Cardinal.sum fun i => Module.rank R (M i) := by let B i := chooseBasis R (M i) let b : Basis _ R (⨁ i, M i) := DFinsupp.basis fun i => B i simp [← b.mk_eq_rank'', fun i => (B i).mk_eq_rank''] #align rank_direct_sum rank_directSum @[simp] theorem rank_matrix (m : Type v) (n : Type w) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = Cardinal.lift.{max v w u, v} #m * Cardinal.lift.{max v w u, w} #n := by cases nonempty_fintype m cases nonempty_fintype n have h := (Matrix.stdBasis R m n).mk_eq_rank rw [← lift_lift.{max v w u, max v w}, lift_inj] at h simpa using h.symm #align rank_matrix rank_matrix @[simp high] theorem rank_matrix' (m n : Type v) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = Cardinal.lift.{u} (#m * #n) := by rw [rank_matrix, lift_mul, lift_umax.{v, u}] #align rank_matrix' rank_matrix' -- @[simp] -- Porting note (#10618): simp can prove this theorem rank_matrix'' (m n : Type u) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = #m * #n := by simp #align rank_matrix'' rank_matrix'' variable [Module.Finite R M] [Module.Finite R M'] open Fintype namespace FiniteDimensional @[simp] theorem finrank_finsupp {ι : Type v} [Fintype ι] : finrank R (ι →₀ M) = card ι * finrank R M := by rw [finrank, finrank, rank_finsupp, ← mk_toNat_eq_card, toNat_mul, toNat_lift, toNat_lift] @[simp] theorem finrank_finsupp_self {ι : Type v} [Fintype ι] : finrank R (ι →₀ R) = card ι := by rw [finrank, rank_finsupp_self, ← mk_toNat_eq_card, toNat_lift] #align finite_dimensional.finrank_finsupp FiniteDimensional.finrank_finsupp_self @[simp] theorem finrank_directSum {ι : Type v} [Fintype ι] (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)] [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] [∀ i : ι, Module.Finite R (M i)] : finrank R (⨁ i, M i) = ∑ i, finrank R (M i) := by letI := nontrivial_of_invariantBasisNumber R simp only [finrank, fun i => rank_eq_card_chooseBasisIndex R (M i), rank_directSum, ← mk_sigma, mk_toNat_eq_card, card_sigma] #align finite_dimensional.finrank_direct_sum FiniteDimensional.finrank_directSum
Mathlib/LinearAlgebra/Dimension/Constructions.lean
251
252
theorem finrank_matrix (m n : Type*) [Fintype m] [Fintype n] : finrank R (Matrix m n R) = card m * card n := by
simp [finrank]
[ " Module.rank R (ι →₀ M) = lift.{v, w} #ι * lift.{w, v} (Module.rank R M)", " Module.rank R (ι →₀ M) = #ι * Module.rank R M", " Module.rank R (ι →₀ R) = lift.{u, w} #ι", " Module.rank R (ι →₀ R) = #ι", " Module.rank R (⨁ (i : ι), M i) = sum fun i => Module.rank R (M i)", " Module.rank R (Matrix m n R) = l...
[ " Module.rank R (ι →₀ M) = lift.{v, w} #ι * lift.{w, v} (Module.rank R M)", " Module.rank R (ι →₀ M) = #ι * Module.rank R M", " Module.rank R (ι →₀ R) = lift.{u, w} #ι", " Module.rank R (ι →₀ R) = #ι", " Module.rank R (⨁ (i : ι), M i) = sum fun i => Module.rank R (M i)", " Module.rank R (Matrix m n R) = l...
import Mathlib.AlgebraicTopology.DoldKan.FunctorGamma import Mathlib.AlgebraicTopology.DoldKan.SplitSimplicialObject import Mathlib.CategoryTheory.Idempotents.HomologicalComplex #align_import algebraic_topology.dold_kan.gamma_comp_n from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Idempotents Opposite SimplicialObject Simplicial namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] [HasFiniteCoproducts C] @[simps!] def Γ₀NondegComplexIso (K : ChainComplex C ℕ) : (Γ₀.splitting K).nondegComplex ≅ K := HomologicalComplex.Hom.isoOfComponents (fun n => Iso.refl _) (by rintro _ n (rfl : n + 1 = _) dsimp simp only [id_comp, comp_id, AlternatingFaceMapComplex.obj_d_eq, Preadditive.sum_comp, Preadditive.comp_sum] rw [Fintype.sum_eq_single (0 : Fin (n + 2))] · simp only [Fin.val_zero, pow_zero, one_zsmul] erw [Γ₀.Obj.mapMono_on_summand_id_assoc, Γ₀.Obj.Termwise.mapMono_δ₀, Splitting.cofan_inj_πSummand_eq_id, comp_id] · intro i hi dsimp simp only [Preadditive.zsmul_comp, Preadditive.comp_zsmul, assoc] erw [Γ₀.Obj.mapMono_on_summand_id_assoc, Γ₀.Obj.Termwise.mapMono_eq_zero, zero_comp, zsmul_zero] · intro h replace h := congr_arg SimplexCategory.len h change n + 1 = n at h omega · simpa only [Isδ₀.iff] using hi) #align algebraic_topology.dold_kan.Γ₀_nondeg_complex_iso AlgebraicTopology.DoldKan.Γ₀NondegComplexIso def Γ₀'CompNondegComplexFunctor : Γ₀' ⋙ Split.nondegComplexFunctor ≅ 𝟭 (ChainComplex C ℕ) := NatIso.ofComponents Γ₀NondegComplexIso #align algebraic_topology.dold_kan.Γ₀'_comp_nondeg_complex_functor AlgebraicTopology.DoldKan.Γ₀'CompNondegComplexFunctor def N₁Γ₀ : Γ₀ ⋙ N₁ ≅ toKaroubi (ChainComplex C ℕ) := calc Γ₀ ⋙ N₁ ≅ Γ₀' ⋙ Split.forget C ⋙ N₁ := Functor.associator _ _ _ _ ≅ Γ₀' ⋙ Split.nondegComplexFunctor ⋙ toKaroubi _ := (isoWhiskerLeft Γ₀' Split.toKaroubiNondegComplexFunctorIsoN₁.symm) _ ≅ (Γ₀' ⋙ Split.nondegComplexFunctor) ⋙ toKaroubi _ := (Functor.associator _ _ _).symm _ ≅ 𝟭 _ ⋙ toKaroubi (ChainComplex C ℕ) := isoWhiskerRight Γ₀'CompNondegComplexFunctor _ _ ≅ toKaroubi (ChainComplex C ℕ) := Functor.leftUnitor _ set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.N₁Γ₀ AlgebraicTopology.DoldKan.N₁Γ₀ theorem N₁Γ₀_app (K : ChainComplex C ℕ) : N₁Γ₀.app K = (Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.symm ≪≫ (toKaroubi _).mapIso (Γ₀NondegComplexIso K) := by ext1 dsimp [N₁Γ₀] erw [id_comp, comp_id, comp_id] rfl set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.N₁Γ₀_app AlgebraicTopology.DoldKan.N₁Γ₀_app theorem N₁Γ₀_hom_app (K : ChainComplex C ℕ) : N₁Γ₀.hom.app K = (Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.inv ≫ (toKaroubi _).map (Γ₀NondegComplexIso K).hom := by change (N₁Γ₀.app K).hom = _ simp only [N₁Γ₀_app] rfl set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.N₁Γ₀_hom_app AlgebraicTopology.DoldKan.N₁Γ₀_hom_app
Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean
95
100
theorem N₁Γ₀_inv_app (K : ChainComplex C ℕ) : N₁Γ₀.inv.app K = (toKaroubi _).map (Γ₀NondegComplexIso K).inv ≫ (Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.hom := by
change (N₁Γ₀.app K).inv = _ simp only [N₁Γ₀_app] rfl
[ " ∀ (i j : ℕ),\n (ComplexShape.down ℕ).Rel i j →\n ((fun n => Iso.refl ((Γ₀.splitting K).nondegComplex.X n)) i).hom ≫ K.d i j =\n (Γ₀.splitting K).nondegComplex.d i j ≫ ((fun n => Iso.refl ((Γ₀.splitting K).nondegComplex.X n)) j).hom", " ((fun n => Iso.refl ((Γ₀.splitting K).nondegComplex.X n)) (n ...
[ " ∀ (i j : ℕ),\n (ComplexShape.down ℕ).Rel i j →\n ((fun n => Iso.refl ((Γ₀.splitting K).nondegComplex.X n)) i).hom ≫ K.d i j =\n (Γ₀.splitting K).nondegComplex.d i j ≫ ((fun n => Iso.refl ((Γ₀.splitting K).nondegComplex.X n)) j).hom", " ((fun n => Iso.refl ((Γ₀.splitting K).nondegComplex.X n)) (n ...
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec
Mathlib/NumberTheory/Bernoulli.lean
91
95
theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by
refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub]
[ " bernoulli' n = 1 - ∑ k ∈ range n, ↑(n.choose k) / (↑n - ↑k + 1) * bernoulli' k", " ∑ k ∈ range n.succ, ↑(n.choose (n - k)) / (↑n - ↑k + 1) * bernoulli' k = 1", " ∑ x ∈ range n, (↑(n.choose x) / (↑n - ↑x + 1) * bernoulli' x - ↑(n.choose (n - x)) / (↑n - ↑x + 1) * bernoulli' x) = 0", " ↑(n.choose x) / (↑n - ↑...
[ " bernoulli' n = 1 - ∑ k ∈ range n, ↑(n.choose k) / (↑n - ↑k + 1) * bernoulli' k", " ∑ k ∈ range n.succ, ↑(n.choose (n - k)) / (↑n - ↑k + 1) * bernoulli' k = 1", " ∑ x ∈ range n, (↑(n.choose x) / (↑n - ↑x + 1) * bernoulli' x - ↑(n.choose (n - x)) / (↑n - ↑x + 1) * bernoulli' x) = 0", " ↑(n.choose x) / (↑n - ↑...
import Mathlib.Data.Finset.Lattice #align_import combinatorics.set_family.compression.down from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" variable {α : Type*} [DecidableEq α] {𝒜 ℬ : Finset (Finset α)} {s : Finset α} {a : α} namespace Finset def nonMemberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) := 𝒜.filter fun s => a ∉ s #align finset.non_member_subfamily Finset.nonMemberSubfamily def memberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) := (𝒜.filter fun s => a ∈ s).image fun s => erase s a #align finset.member_subfamily Finset.memberSubfamily @[simp] theorem mem_nonMemberSubfamily : s ∈ 𝒜.nonMemberSubfamily a ↔ s ∈ 𝒜 ∧ a ∉ s := by simp [nonMemberSubfamily] #align finset.mem_non_member_subfamily Finset.mem_nonMemberSubfamily @[simp] theorem mem_memberSubfamily : s ∈ 𝒜.memberSubfamily a ↔ insert a s ∈ 𝒜 ∧ a ∉ s := by simp_rw [memberSubfamily, mem_image, mem_filter] refine ⟨?_, fun h => ⟨insert a s, ⟨h.1, by simp⟩, erase_insert h.2⟩⟩ rintro ⟨s, ⟨hs1, hs2⟩, rfl⟩ rw [insert_erase hs2] exact ⟨hs1, not_mem_erase _ _⟩ #align finset.mem_member_subfamily Finset.mem_memberSubfamily theorem nonMemberSubfamily_inter (a : α) (𝒜 ℬ : Finset (Finset α)) : (𝒜 ∩ ℬ).nonMemberSubfamily a = 𝒜.nonMemberSubfamily a ∩ ℬ.nonMemberSubfamily a := filter_inter_distrib _ _ _ #align finset.non_member_subfamily_inter Finset.nonMemberSubfamily_inter
Mathlib/Combinatorics/SetFamily/Compression/Down.lean
74
78
theorem memberSubfamily_inter (a : α) (𝒜 ℬ : Finset (Finset α)) : (𝒜 ∩ ℬ).memberSubfamily a = 𝒜.memberSubfamily a ∩ ℬ.memberSubfamily a := by
unfold memberSubfamily rw [filter_inter_distrib, image_inter_of_injOn _ _ ((erase_injOn' _).mono _)] simp
[ " s ∈ nonMemberSubfamily a 𝒜 ↔ s ∈ 𝒜 ∧ a ∉ s", " s ∈ memberSubfamily a 𝒜 ↔ insert a s ∈ 𝒜 ∧ a ∉ s", " (∃ a_1, (a_1 ∈ 𝒜 ∧ a ∈ a_1) ∧ a_1.erase a = s) ↔ insert a s ∈ 𝒜 ∧ a ∉ s", " a ∈ insert a s", " (∃ a_1, (a_1 ∈ 𝒜 ∧ a ∈ a_1) ∧ a_1.erase a = s) → insert a s ∈ 𝒜 ∧ a ∉ s", " insert a (s.erase a) ∈ 𝒜...
[ " s ∈ nonMemberSubfamily a 𝒜 ↔ s ∈ 𝒜 ∧ a ∉ s", " s ∈ memberSubfamily a 𝒜 ↔ insert a s ∈ 𝒜 ∧ a ∉ s", " (∃ a_1, (a_1 ∈ 𝒜 ∧ a ∈ a_1) ∧ a_1.erase a = s) ↔ insert a s ∈ 𝒜 ∧ a ∉ s", " a ∈ insert a s", " (∃ a_1, (a_1 ∈ 𝒜 ∧ a ∈ a_1) ∧ a_1.erase a = s) → insert a s ∈ 𝒜 ∧ a ∉ s", " insert a (s.erase a) ∈ 𝒜...
import Mathlib.Algebra.Algebra.Basic import Mathlib.Algebra.Periodic import Mathlib.Topology.Algebra.Order.Field import Mathlib.Topology.Algebra.UniformMulAction import Mathlib.Topology.Algebra.Star import Mathlib.Topology.Instances.Int import Mathlib.Topology.Order.Bornology #align_import topology.instances.real from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" noncomputable section open scoped Classical open Filter Int Metric Set TopologicalSpace Bornology open scoped Topology Uniformity Interval universe u v w variable {α : Type u} {β : Type v} {γ : Type w} instance : NoncompactSpace ℝ := Int.closedEmbedding_coe_real.noncompactSpace theorem Real.uniformContinuous_add : UniformContinuous fun p : ℝ × ℝ => p.1 + p.2 := Metric.uniformContinuous_iff.2 fun _ε ε0 => let ⟨δ, δ0, Hδ⟩ := rat_add_continuous_lemma abs ε0 ⟨δ, δ0, fun h => let ⟨h₁, h₂⟩ := max_lt_iff.1 h Hδ h₁ h₂⟩ #align real.uniform_continuous_add Real.uniformContinuous_add theorem Real.uniformContinuous_neg : UniformContinuous (@Neg.neg ℝ _) := Metric.uniformContinuous_iff.2 fun ε ε0 => ⟨_, ε0, fun h => by rw [dist_comm] at h; simpa only [Real.dist_eq, neg_sub_neg] using h⟩ #align real.uniform_continuous_neg Real.uniformContinuous_neg instance : ContinuousStar ℝ := ⟨continuous_id⟩ instance : UniformAddGroup ℝ := UniformAddGroup.mk' Real.uniformContinuous_add Real.uniformContinuous_neg -- short-circuit type class inference instance : TopologicalAddGroup ℝ := by infer_instance instance : TopologicalRing ℝ := inferInstance instance : TopologicalDivisionRing ℝ := inferInstance instance : ProperSpace ℝ where isCompact_closedBall x r := by rw [Real.closedBall_eq_Icc] apply isCompact_Icc instance : SecondCountableTopology ℝ := secondCountable_of_proper theorem Real.isTopologicalBasis_Ioo_rat : @IsTopologicalBasis ℝ _ (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) b}) := isTopologicalBasis_of_isOpen_of_nhds (by simp (config := { contextual := true }) [isOpen_Ioo]) fun a v hav hv => let ⟨l, u, ⟨hl, hu⟩, h⟩ := mem_nhds_iff_exists_Ioo_subset.mp (IsOpen.mem_nhds hv hav) let ⟨q, hlq, hqa⟩ := exists_rat_btwn hl let ⟨p, hap, hpu⟩ := exists_rat_btwn hu ⟨Ioo q p, by simp only [mem_iUnion] exact ⟨q, p, Rat.cast_lt.1 <| hqa.trans hap, rfl⟩, ⟨hqa, hap⟩, fun a' ⟨hqa', ha'p⟩ => h ⟨hlq.trans hqa', ha'p.trans hpu⟩⟩ #align real.is_topological_basis_Ioo_rat Real.isTopologicalBasis_Ioo_rat @[simp]
Mathlib/Topology/Instances/Real.lean
77
78
theorem Real.cobounded_eq : cobounded ℝ = atBot ⊔ atTop := by
simp only [← comap_dist_right_atTop (0 : ℝ), Real.dist_eq, sub_zero, comap_abs_atTop]
[ " dist (-a✝) (-b✝) < ε", " TopologicalAddGroup ℝ", " IsCompact (closedBall x r)", " IsCompact (Icc (x - r) (x + r))", " ∀ u ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}, IsOpen u", " Ioo ↑q ↑p ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}", " ∃ i i_1, ∃ (_ : i < i_1), Ioo ↑q ↑p ∈ {Ioo ↑i ↑i_1}", " cobounded ℝ = at...
[ " dist (-a✝) (-b✝) < ε", " TopologicalAddGroup ℝ", " IsCompact (closedBall x r)", " IsCompact (Icc (x - r) (x + r))", " ∀ u ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}, IsOpen u", " Ioo ↑q ↑p ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}", " ∃ i i_1, ∃ (_ : i < i_1), Ioo ↑q ↑p ∈ {Ioo ↑i ↑i_1}" ]
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type w} {ι' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section StrongRankCondition variable [StrongRankCondition R] open Submodule -- An auxiliary lemma for `linearIndependent_le_span'`, -- with the additional assumption that the linearly independent family is finite. theorem linearIndependent_le_span_aux' {ι : Type*} [Fintype ι] (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Fintype w] (s : range v ≤ span R w) : Fintype.card ι ≤ Fintype.card w := by -- We construct an injective linear map `(ι → R) →ₗ[R] (w → R)`, -- by thinking of `f : ι → R` as a linear combination of the finite family `v`, -- and expressing that (using the axiom of choice) as a linear combination over `w`. -- We can do this linearly by constructing the map on a basis. fapply card_le_of_injective' R · apply Finsupp.total exact fun i => Span.repr R w ⟨v i, s (mem_range_self i)⟩ · intro f g h apply_fun Finsupp.total w M R (↑) at h simp only [Finsupp.total_total, Submodule.coe_mk, Span.finsupp_total_repr] at h rw [← sub_eq_zero, ← LinearMap.map_sub] at h exact sub_eq_zero.mp (linearIndependent_iff.mp i _ h) #align linear_independent_le_span_aux' linearIndependent_le_span_aux' lemma LinearIndependent.finite_of_le_span_finite {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Finite w] (s : range v ≤ span R w) : Finite ι := letI := Fintype.ofFinite w Fintype.finite <| fintypeOfFinsetCardLe (Fintype.card w) fun t => by let v' := fun x : (t : Set ι) => v x have i' : LinearIndependent R v' := i.comp _ Subtype.val_injective have s' : range v' ≤ span R w := (range_comp_subset_range _ _).trans s simpa using linearIndependent_le_span_aux' v' i' w s' #align linear_independent_fintype_of_le_span_fintype LinearIndependent.finite_of_le_span_finite theorem linearIndependent_le_span' {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Fintype w] (s : range v ≤ span R w) : #ι ≤ Fintype.card w := by haveI : Finite ι := i.finite_of_le_span_finite v w s letI := Fintype.ofFinite ι rw [Cardinal.mk_fintype] simp only [Cardinal.natCast_le] exact linearIndependent_le_span_aux' v i w s #align linear_independent_le_span' linearIndependent_le_span' theorem linearIndependent_le_span {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Fintype w] (s : span R w = ⊤) : #ι ≤ Fintype.card w := by apply linearIndependent_le_span' v i w rw [s] exact le_top #align linear_independent_le_span linearIndependent_le_span
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
236
238
theorem linearIndependent_le_span_finset {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Finset M) (s : span R (w : Set M) = ⊤) : #ι ≤ w.card := by
simpa only [Finset.coe_sort_coe, Fintype.card_coe] using linearIndependent_le_span v i w s
[ " Fintype.card ι ≤ Fintype.card ↑w", " (ι →₀ R) →ₗ[R] ↑w →₀ R", " ι → ↑w →₀ R", " Injective ⇑(Finsupp.total ι (↑w →₀ R) R fun i => Span.repr R w ⟨v i, ⋯⟩)", " f = g", " t.card ≤ Fintype.card ↑w", " #ι ≤ ↑(Fintype.card ↑w)", " ↑(Fintype.card ι) ≤ ↑(Fintype.card ↑w)", " range v ≤ ↑(span R w)", " ran...
[ " Fintype.card ι ≤ Fintype.card ↑w", " (ι →₀ R) →ₗ[R] ↑w →₀ R", " ι → ↑w →₀ R", " Injective ⇑(Finsupp.total ι (↑w →₀ R) R fun i => Span.repr R w ⟨v i, ⋯⟩)", " f = g", " t.card ≤ Fintype.card ↑w", " #ι ≤ ↑(Fintype.card ↑w)", " ↑(Fintype.card ι) ≤ ↑(Fintype.card ↑w)", " range v ≤ ↑(span R w)", " ran...
import Mathlib.Algebra.Polynomial.Eval import Mathlib.RingTheory.Ideal.Quotient #align_import linear_algebra.smodeq from "leanprover-community/mathlib"@"146d3d1fa59c091fedaad8a4afa09d6802886d24" open Submodule open Polynomial variable {R : Type*} [Ring R] variable {A : Type*} [CommRing A] variable {M : Type*} [AddCommGroup M] [Module R M] (U U₁ U₂ : Submodule R M) variable {x x₁ x₂ y y₁ y₂ z z₁ z₂ : M} variable {N : Type*} [AddCommGroup N] [Module R N] (V V₁ V₂ : Submodule R N) set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 def SModEq (x y : M) : Prop := (Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y #align smodeq SModEq notation:50 x " ≡ " y " [SMOD " N "]" => SModEq N x y variable {U U₁ U₂} set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 protected theorem SModEq.def : x ≡ y [SMOD U] ↔ (Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y := Iff.rfl #align smodeq.def SModEq.def namespace SModEq theorem sub_mem : x ≡ y [SMOD U] ↔ x - y ∈ U := by rw [SModEq.def, Submodule.Quotient.eq] #align smodeq.sub_mem SModEq.sub_mem @[simp] theorem top : x ≡ y [SMOD (⊤ : Submodule R M)] := (Submodule.Quotient.eq ⊤).2 mem_top #align smodeq.top SModEq.top @[simp] theorem bot : x ≡ y [SMOD (⊥ : Submodule R M)] ↔ x = y := by rw [SModEq.def, Submodule.Quotient.eq, mem_bot, sub_eq_zero] #align smodeq.bot SModEq.bot @[mono] theorem mono (HU : U₁ ≤ U₂) (hxy : x ≡ y [SMOD U₁]) : x ≡ y [SMOD U₂] := (Submodule.Quotient.eq U₂).2 <| HU <| (Submodule.Quotient.eq U₁).1 hxy #align smodeq.mono SModEq.mono @[refl] protected theorem refl (x : M) : x ≡ x [SMOD U] := @rfl _ _ #align smodeq.refl SModEq.refl protected theorem rfl : x ≡ x [SMOD U] := SModEq.refl _ #align smodeq.rfl SModEq.rfl instance : IsRefl _ (SModEq U) := ⟨SModEq.refl⟩ @[symm] nonrec theorem symm (hxy : x ≡ y [SMOD U]) : y ≡ x [SMOD U] := hxy.symm #align smodeq.symm SModEq.symm @[trans] nonrec theorem trans (hxy : x ≡ y [SMOD U]) (hyz : y ≡ z [SMOD U]) : x ≡ z [SMOD U] := hxy.trans hyz #align smodeq.trans SModEq.trans instance instTrans : Trans (SModEq U) (SModEq U) (SModEq U) where trans := trans
Mathlib/LinearAlgebra/SModEq.lean
87
89
theorem add (hxy₁ : x₁ ≡ y₁ [SMOD U]) (hxy₂ : x₂ ≡ y₂ [SMOD U]) : x₁ + x₂ ≡ y₁ + y₂ [SMOD U] := by
rw [SModEq.def] at hxy₁ hxy₂ ⊢ simp_rw [Quotient.mk_add, hxy₁, hxy₂]
[ " x ≡ y [SMOD U] ↔ x - y ∈ U", " x ≡ y [SMOD ⊥] ↔ x = y", " x₁ + x₂ ≡ y₁ + y₂ [SMOD U]", " Submodule.Quotient.mk (x₁ + x₂) = Submodule.Quotient.mk (y₁ + y₂)" ]
[ " x ≡ y [SMOD U] ↔ x - y ∈ U", " x ≡ y [SMOD ⊥] ↔ x = y" ]
import Mathlib.Order.Interval.Set.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic import Mathlib.Tactic.AdaptationNote #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime
Mathlib/Probability/Martingale/Upcrossing.lean
206
209
theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by
rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω
[ " upperCrossingTime a b f N (n + 1) ω =\n hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω", " upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω", " hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N...
[ " upperCrossingTime a b f N (n + 1) ω =\n hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω", " upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω", " hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N...
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by -- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem #align continuous_map.comp_attach_bound_mem_closure ContinuousMap.comp_attachBound_mem_closure theorem abs_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) : |(f : C(X, ℝ))| ∈ A.topologicalClosure := by let f' := attachBound (f : C(X, ℝ)) let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| } change abs.comp f' ∈ A.topologicalClosure apply comp_attachBound_mem_closure #align continuous_map.abs_mem_subalgebra_closure ContinuousMap.abs_mem_subalgebra_closure
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
124
134
theorem inf_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A.topologicalClosure := by
rw [inf_eq_half_smul_add_sub_abs_sub' ℝ] refine A.topologicalClosure.smul_mem (A.topologicalClosure.sub_mem (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) ?_) _ exact mod_cast abs_mem_subalgebra_closure A _
[ " (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound = ↑((Polynomial.aeval f) g)", " ((g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound) a✝ = ↑((Polynomial.aeval f) g) a✝", " Polynomial.eval (↑((↑f).attachBound a✝)) g = Polynomial.eval (↑f a✝) g", " (g.toContinuousMapOn (Set.Icc (...
[ " (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound = ↑((Polynomial.aeval f) g)", " ((g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound) a✝ = ↑((Polynomial.aeval f) g) a✝", " Polynomial.eval (↑((↑f).attachBound a✝)) g = Polynomial.eval (↑f a✝) g", " (g.toContinuousMapOn (Set.Icc (...
import Mathlib.MeasureTheory.Measure.MeasureSpace open scoped ENNReal NNReal Topology open Set MeasureTheory Measure Filter MeasurableSpace ENNReal Function variable {R α β δ γ ι : Type*} namespace MeasureTheory variable {m0 : MeasurableSpace α} [MeasurableSpace β] [MeasurableSpace γ] variable {μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α} {s s' t : Set α} namespace Measure noncomputable def restrictₗ {m0 : MeasurableSpace α} (s : Set α) : Measure α →ₗ[ℝ≥0∞] Measure α := liftLinear (OuterMeasure.restrict s) fun μ s' hs' t => by suffices μ (s ∩ t) = μ (s ∩ t ∩ s') + μ ((s ∩ t) \ s') by simpa [← Set.inter_assoc, Set.inter_comm _ s, ← inter_diff_assoc] exact le_toOuterMeasure_caratheodory _ _ hs' _ #align measure_theory.measure.restrictₗ MeasureTheory.Measure.restrictₗ noncomputable def restrict {_m0 : MeasurableSpace α} (μ : Measure α) (s : Set α) : Measure α := restrictₗ s μ #align measure_theory.measure.restrict MeasureTheory.Measure.restrict @[simp] theorem restrictₗ_apply {_m0 : MeasurableSpace α} (s : Set α) (μ : Measure α) : restrictₗ s μ = μ.restrict s := rfl #align measure_theory.measure.restrictₗ_apply MeasureTheory.Measure.restrictₗ_apply
Mathlib/MeasureTheory/Measure/Restrict.lean
56
59
theorem restrict_toOuterMeasure_eq_toOuterMeasure_restrict (h : MeasurableSet s) : (μ.restrict s).toOuterMeasure = OuterMeasure.restrict s μ.toOuterMeasure := by
simp_rw [restrict, restrictₗ, liftLinear, LinearMap.coe_mk, AddHom.coe_mk, toMeasure_toOuterMeasure, OuterMeasure.restrict_trim h, μ.trimmed]
[ " ((OuterMeasure.restrict s) μ.toOuterMeasure) t =\n ((OuterMeasure.restrict s) μ.toOuterMeasure) (t ∩ s') + ((OuterMeasure.restrict s) μ.toOuterMeasure) (t \\ s')", " μ (s ∩ t) = μ (s ∩ t ∩ s') + μ ((s ∩ t) \\ s')", " (μ.restrict s).toOuterMeasure = (OuterMeasure.restrict s) μ.toOuterMeasure" ]
[ " ((OuterMeasure.restrict s) μ.toOuterMeasure) t =\n ((OuterMeasure.restrict s) μ.toOuterMeasure) (t ∩ s') + ((OuterMeasure.restrict s) μ.toOuterMeasure) (t \\ s')", " μ (s ∩ t) = μ (s ∩ t ∩ s') + μ ((s ∩ t) \\ s')" ]
import Mathlib.Dynamics.Ergodic.Ergodic import Mathlib.MeasureTheory.Function.AEEqFun open Function Set Filter MeasureTheory Topology TopologicalSpace variable {α X : Type*} [MeasurableSpace α] {μ : MeasureTheory.Measure α}
Mathlib/Dynamics/Ergodic/Function.lean
27
35
theorem QuasiErgodic.ae_eq_const_of_ae_eq_comp_of_ae_range₀ [Nonempty X] [MeasurableSpace X] {s : Set X} [MeasurableSpace.CountablySeparated s] {f : α → α} {g : α → X} (h : QuasiErgodic f μ) (hs : ∀ᵐ x ∂μ, g x ∈ s) (hgm : NullMeasurable g μ) (hg_eq : g ∘ f =ᵐ[μ] g) : ∃ c, g =ᵐ[μ] const α c := by
refine exists_eventuallyEq_const_of_eventually_mem_of_forall_separating MeasurableSet hs ?_ refine fun U hU ↦ h.ae_mem_or_ae_nmem₀ (s := g ⁻¹' U) (hgm hU) ?_b refine (hg_eq.mono fun x hx ↦ ?_).set_eq rw [← preimage_comp, mem_preimage, mem_preimage, hx]
[ " ∃ c, g =ᶠ[ae μ] const α c", " ∀ (U : Set X), MeasurableSet U → (∀ᵐ (x : α) ∂μ, g x ∈ U) ∨ ∀ᵐ (x : α) ∂μ, g x ∉ U", " f ⁻¹' (g ⁻¹' U) =ᶠ[ae μ] g ⁻¹' U", " x ∈ f ⁻¹' (g ⁻¹' U) ↔ x ∈ g ⁻¹' U" ]
[]
import Mathlib.Tactic.CategoryTheory.Reassoc #align_import category_theory.isomorphism from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" universe v u -- morphism levels before object levels. See note [CategoryTheory universes]. namespace CategoryTheory open Category structure Iso {C : Type u} [Category.{v} C] (X Y : C) where hom : X ⟶ Y inv : Y ⟶ X hom_inv_id : hom ≫ inv = 𝟙 X := by aesop_cat inv_hom_id : inv ≫ hom = 𝟙 Y := by aesop_cat #align category_theory.iso CategoryTheory.Iso #align category_theory.iso.hom CategoryTheory.Iso.hom #align category_theory.iso.inv CategoryTheory.Iso.inv #align category_theory.iso.inv_hom_id CategoryTheory.Iso.inv_hom_id #align category_theory.iso.hom_inv_id CategoryTheory.Iso.hom_inv_id attribute [reassoc (attr := simp)] Iso.hom_inv_id Iso.inv_hom_id #align category_theory.iso.hom_inv_id_assoc CategoryTheory.Iso.hom_inv_id_assoc #align category_theory.iso.inv_hom_id_assoc CategoryTheory.Iso.inv_hom_id_assoc infixr:10 " ≅ " => Iso -- type as \cong or \iso variable {C : Type u} [Category.{v} C] {X Y Z : C} class IsIso (f : X ⟶ Y) : Prop where out : ∃ inv : Y ⟶ X, f ≫ inv = 𝟙 X ∧ inv ≫ f = 𝟙 Y #align category_theory.is_iso CategoryTheory.IsIso noncomputable def inv (f : X ⟶ Y) [I : IsIso f] : Y ⟶ X := Classical.choose I.1 #align category_theory.inv CategoryTheory.inv namespace IsIso @[simp] theorem hom_inv_id (f : X ⟶ Y) [I : IsIso f] : f ≫ inv f = 𝟙 X := (Classical.choose_spec I.1).left #align category_theory.is_iso.hom_inv_id CategoryTheory.IsIso.hom_inv_id @[simp] theorem inv_hom_id (f : X ⟶ Y) [I : IsIso f] : inv f ≫ f = 𝟙 Y := (Classical.choose_spec I.1).right #align category_theory.is_iso.inv_hom_id CategoryTheory.IsIso.inv_hom_id -- FIXME putting @[reassoc] on the `hom_inv_id` above somehow unfolds `inv` -- This happens even if we make `inv` irreducible! -- I don't understand how this is happening: it is likely a bug. -- attribute [reassoc] hom_inv_id inv_hom_id -- #print hom_inv_id_assoc -- theorem CategoryTheory.IsIso.hom_inv_id_assoc {X Y : C} (f : X ⟶ Y) [I : IsIso f] -- {Z : C} (h : X ⟶ Z), -- f ≫ Classical.choose (_ : Exists fun inv ↦ f ≫ inv = 𝟙 X ∧ inv ≫ f = 𝟙 Y) ≫ h = h := ... @[simp] theorem hom_inv_id_assoc (f : X ⟶ Y) [I : IsIso f] {Z} (g : X ⟶ Z) : f ≫ inv f ≫ g = g := by simp [← Category.assoc] #align category_theory.is_iso.hom_inv_id_assoc CategoryTheory.IsIso.hom_inv_id_assoc @[simp]
Mathlib/CategoryTheory/Iso.lean
295
296
theorem inv_hom_id_assoc (f : X ⟶ Y) [I : IsIso f] {Z} (g : Y ⟶ Z) : inv f ≫ f ≫ g = g := by
simp [← Category.assoc]
[ " f ≫ inv f ≫ g = g", " inv f ≫ f ≫ g = g" ]
[ " f ≫ inv f ≫ g = g" ]
import Mathlib.Analysis.Convex.Topology import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.Seminorm import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Analysis.RCLike.Basic #align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d" open NormedField Set open scoped Pointwise Topology NNReal noncomputable section variable {𝕜 E F : Type*} section AddCommGroup variable [AddCommGroup E] [Module ℝ E] def gauge (s : Set E) (x : E) : ℝ := sInf { r : ℝ | 0 < r ∧ x ∈ r • s } #align gauge gauge variable {s t : Set E} {x : E} {a : ℝ} theorem gauge_def : gauge s x = sInf ({ r ∈ Set.Ioi (0 : ℝ) | x ∈ r • s }) := rfl #align gauge_def gauge_def theorem gauge_def' : gauge s x = sInf {r ∈ Set.Ioi (0 : ℝ) | r⁻¹ • x ∈ s} := by congrm sInf {r | ?_} exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_mem₀ hr.ne' _ _ #align gauge_def' gauge_def' private theorem gauge_set_bddBelow : BddBelow { r : ℝ | 0 < r ∧ x ∈ r • s } := ⟨0, fun _ hr => hr.1.le⟩ theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent ℝ s) : { r : ℝ | 0 < r ∧ x ∈ r • s }.Nonempty := let ⟨r, hr₁, hr₂⟩ := (absorbs x).exists_pos ⟨r, hr₁, hr₂ r (Real.norm_of_nonneg hr₁.le).ge rfl⟩ #align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty theorem gauge_mono (hs : Absorbent ℝ s) (h : s ⊆ t) : gauge t ≤ gauge s := fun _ => csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => ⟨hr.1, smul_set_mono h hr.2⟩ #align gauge_mono gauge_mono theorem exists_lt_of_gauge_lt (absorbs : Absorbent ℝ s) (h : gauge s x < a) : ∃ b, 0 < b ∧ b < a ∧ x ∈ b • s := by obtain ⟨b, ⟨hb, hx⟩, hba⟩ := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h exact ⟨b, hb, hba, hx⟩ #align exists_lt_of_gauge_lt exists_lt_of_gauge_lt @[simp] theorem gauge_zero : gauge s 0 = 0 := by rw [gauge_def'] by_cases h : (0 : E) ∈ s · simp only [smul_zero, sep_true, h, csInf_Ioi] · simp only [smul_zero, sep_false, h, Real.sInf_empty] #align gauge_zero gauge_zero @[simp] theorem gauge_zero' : gauge (0 : Set E) = 0 := by ext x rw [gauge_def'] obtain rfl | hx := eq_or_ne x 0 · simp only [csInf_Ioi, mem_zero, Pi.zero_apply, eq_self_iff_true, sep_true, smul_zero] · simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero] convert Real.sInf_empty exact eq_empty_iff_forall_not_mem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx #align gauge_zero' gauge_zero' @[simp] theorem gauge_empty : gauge (∅ : Set E) = 0 := by ext simp only [gauge_def', Real.sInf_empty, mem_empty_iff_false, Pi.zero_apply, sep_false] #align gauge_empty gauge_empty theorem gauge_of_subset_zero (h : s ⊆ 0) : gauge s = 0 := by obtain rfl | rfl := subset_singleton_iff_eq.1 h exacts [gauge_empty, gauge_zero'] #align gauge_of_subset_zero gauge_of_subset_zero theorem gauge_nonneg (x : E) : 0 ≤ gauge s x := Real.sInf_nonneg _ fun _ hx => hx.1.le #align gauge_nonneg gauge_nonneg theorem gauge_neg (symmetric : ∀ x ∈ s, -x ∈ s) (x : E) : gauge s (-x) = gauge s x := by have : ∀ x, -x ∈ s ↔ x ∈ s := fun x => ⟨fun h => by simpa using symmetric _ h, symmetric x⟩ simp_rw [gauge_def', smul_neg, this] #align gauge_neg gauge_neg theorem gauge_neg_set_neg (x : E) : gauge (-s) (-x) = gauge s x := by simp_rw [gauge_def', smul_neg, neg_mem_neg] #align gauge_neg_set_neg gauge_neg_set_neg theorem gauge_neg_set_eq_gauge_neg (x : E) : gauge (-s) x = gauge s (-x) := by rw [← gauge_neg_set_neg, neg_neg] #align gauge_neg_set_eq_gauge_neg gauge_neg_set_eq_gauge_neg theorem gauge_le_of_mem (ha : 0 ≤ a) (hx : x ∈ a • s) : gauge s x ≤ a := by obtain rfl | ha' := ha.eq_or_lt · rw [mem_singleton_iff.1 (zero_smul_set_subset _ hx), gauge_zero] · exact csInf_le gauge_set_bddBelow ⟨ha', hx⟩ #align gauge_le_of_mem gauge_le_of_mem
Mathlib/Analysis/Convex/Gauge.lean
148
163
theorem gauge_le_eq (hs₁ : Convex ℝ s) (hs₀ : (0 : E) ∈ s) (hs₂ : Absorbent ℝ s) (ha : 0 ≤ a) : { x | gauge s x ≤ a } = ⋂ (r : ℝ) (_ : a < r), r • s := by
ext x simp_rw [Set.mem_iInter, Set.mem_setOf_eq] refine ⟨fun h r hr => ?_, fun h => le_of_forall_pos_lt_add fun ε hε => ?_⟩ · have hr' := ha.trans_lt hr rw [mem_smul_set_iff_inv_smul_mem₀ hr'.ne'] obtain ⟨δ, δ_pos, hδr, hδ⟩ := exists_lt_of_gauge_lt hs₂ (h.trans_lt hr) suffices (r⁻¹ * δ) • δ⁻¹ • x ∈ s by rwa [smul_smul, mul_inv_cancel_right₀ δ_pos.ne'] at this rw [mem_smul_set_iff_inv_smul_mem₀ δ_pos.ne'] at hδ refine hs₁.smul_mem_of_zero_mem hs₀ hδ ⟨by positivity, ?_⟩ rw [inv_mul_le_iff hr', mul_one] exact hδr.le · have hε' := (lt_add_iff_pos_right a).2 (half_pos hε) exact (gauge_le_of_mem (ha.trans hε'.le) <| h _ hε').trans_lt (add_lt_add_left (half_lt_self hε) _)
[ " gauge s x = sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s}", " 0 < r ∧ x ∈ r • s ↔ r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s", " ∃ b, 0 < b ∧ b < a ∧ x ∈ b • s", " gauge s 0 = 0", " sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • 0 ∈ s} = 0", " gauge 0 = 0", " gauge 0 x = 0 x", " sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ 0} = 0 x", " sInf {r | r ∈ Ioi 0 ∧ ...
[ " gauge s x = sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s}", " 0 < r ∧ x ∈ r • s ↔ r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s", " ∃ b, 0 < b ∧ b < a ∧ x ∈ b • s", " gauge s 0 = 0", " sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • 0 ∈ s} = 0", " gauge 0 = 0", " gauge 0 x = 0 x", " sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ 0} = 0 x", " sInf {r | r ∈ Ioi 0 ∧ ...
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section Ring variable {R : Type u} [Ring R] {S : Type v} [Ring S] (f : R →+* S) def liftsRing (f : R →+* S) : Subring S[X] := RingHom.range (mapRingHom f) #align polynomial.lifts_ring Polynomial.liftsRing
Mathlib/Algebra/Polynomial/Lifts.lean
257
258
theorem lifts_iff_liftsRing (p : S[X]) : p ∈ lifts f ↔ p ∈ liftsRing f := by
simp only [lifts, liftsRing, RingHom.mem_range, RingHom.mem_rangeS]
[ " p ∈ lifts f ↔ ∃ q, map f q = p", " p ∈ lifts f ↔ p ∈ Set.range (map f)", " p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS", " p ∈ lifts f ↔ ∀ (n : ℕ), p.coeff n ∈ Set.range ⇑f", " (∀ (n : ℕ), p.coeff n ∈ f.rangeS) ↔ ∀ (n : ℕ), p.coeff n ∈ Set.range ⇑f", " (mapRingHom f) (C r) = C (f r)", " C s ∈ lifts f", ...
[ " p ∈ lifts f ↔ ∃ q, map f q = p", " p ∈ lifts f ↔ p ∈ Set.range (map f)", " p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS", " p ∈ lifts f ↔ ∀ (n : ℕ), p.coeff n ∈ Set.range ⇑f", " (∀ (n : ℕ), p.coeff n ∈ f.rangeS) ↔ ∀ (n : ℕ), p.coeff n ∈ Set.range ⇑f", " (mapRingHom f) (C r) = C (f r)", " C s ∈ lifts f", ...
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
88
91
theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by
rw [polynomial_comp_attachBound] apply SetLike.coe_mem
[ " (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound = ↑((Polynomial.aeval f) g)", " ((g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound) a✝ = ↑((Polynomial.aeval f) g) a✝", " Polynomial.eval (↑((↑f).attachBound a✝)) g = Polynomial.eval (↑f a✝) g", " (g.toContinuousMapOn (Set.Icc (...
[ " (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound = ↑((Polynomial.aeval f) g)", " ((g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (↑f).attachBound) a✝ = ↑((Polynomial.aeval f) g) a✝", " Polynomial.eval (↑((↑f).attachBound a✝)) g = Polynomial.eval (↑f a✝) g" ]
import Mathlib.Data.Vector.Basic #align_import data.vector.mem from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" namespace Vector variable {α β : Type*} {n : ℕ} (a a' : α) @[simp] theorem get_mem (i : Fin n) (v : Vector α n) : v.get i ∈ v.toList := by rw [get_eq_get] exact List.get_mem _ _ _ #align vector.nth_mem Vector.get_mem theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get] exact ⟨fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length] at hi, h⟩, fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length], h⟩⟩ #align vector.mem_iff_nth Vector.mem_iff_get theorem not_mem_nil : a ∉ (Vector.nil : Vector α 0).toList := by unfold Vector.nil dsimp simp #align vector.not_mem_nil Vector.not_mem_nil theorem not_mem_zero (v : Vector α 0) : a ∉ v.toList := (Vector.eq_nil v).symm ▸ not_mem_nil a #align vector.not_mem_zero Vector.not_mem_zero
Mathlib/Data/Vector/Mem.lean
48
49
theorem mem_cons_iff (v : Vector α n) : a' ∈ (a ::ᵥ v).toList ↔ a' = a ∨ a' ∈ v.toList := by
rw [Vector.toList_cons, List.mem_cons]
[ " v.get i ∈ v.toList", " v.toList.get (Fin.cast ⋯ i) ∈ v.toList", " a ∈ v.toList ↔ ∃ i, v.get i = a", " (∃ i, ∃ (h : i < v.toList.length), v.toList.get ⟨i, h⟩ = a) ↔ ∃ i, ∃ (h : i < n), v.toList.get (Fin.cast ⋯ ⟨i, h⟩) = a", " i < n", " i < v.toList.length", " a ∉ nil.toList", " a ∉ toList ⟨[], ⋯⟩", ...
[ " v.get i ∈ v.toList", " v.toList.get (Fin.cast ⋯ i) ∈ v.toList", " a ∈ v.toList ↔ ∃ i, v.get i = a", " (∃ i, ∃ (h : i < v.toList.length), v.toList.get ⟨i, h⟩ = a) ↔ ∃ i, ∃ (h : i < n), v.toList.get (Fin.cast ⋯ ⟨i, h⟩) = a", " i < n", " i < v.toList.length", " a ∉ nil.toList", " a ∉ toList ⟨[], ⋯⟩", ...
import Mathlib.Algebra.Group.Semiconj.Defs import Mathlib.Algebra.Ring.Defs #align_import algebra.ring.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x} open Function namespace SemiconjBy @[simp] theorem add_right [Distrib R] {a x y x' y' : R} (h : SemiconjBy a x y) (h' : SemiconjBy a x' y') : SemiconjBy a (x + x') (y + y') := by simp only [SemiconjBy, left_distrib, right_distrib, h.eq, h'.eq] #align semiconj_by.add_right SemiconjBy.add_right @[simp] theorem add_left [Distrib R] {a b x y : R} (ha : SemiconjBy a x y) (hb : SemiconjBy b x y) : SemiconjBy (a + b) x y := by simp only [SemiconjBy, left_distrib, right_distrib, ha.eq, hb.eq] #align semiconj_by.add_left SemiconjBy.add_left section variable [Mul R] [HasDistribNeg R] {a x y : R}
Mathlib/Algebra/Ring/Semiconj.lean
48
49
theorem neg_right (h : SemiconjBy a x y) : SemiconjBy a (-x) (-y) := by
simp only [SemiconjBy, h.eq, neg_mul, mul_neg]
[ " SemiconjBy a (x + x') (y + y')", " SemiconjBy (a + b) x y", " SemiconjBy a (-x) (-y)" ]
[ " SemiconjBy a (x + x') (y + y')", " SemiconjBy (a + b) x y" ]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section CommSemiring variable [CommSemiring R] theorem Monic.C_dvd_iff_isUnit {p : R[X]} (hp : Monic p) {a : R} : C a ∣ p ↔ IsUnit a := ⟨fun h => isUnit_iff_dvd_one.mpr <| hp.coeff_natDegree ▸ (C_dvd_iff_dvd_coeff _ _).mp h p.natDegree, fun ha => (ha.map C).dvd⟩ theorem degree_pos_of_not_isUnit_of_dvd_monic {a p : R[X]} (ha : ¬ IsUnit a) (hap : a ∣ p) (hp : Monic p) : 0 < degree a := lt_of_not_ge <| fun h => ha <| by rw [Polynomial.eq_C_of_degree_le_zero h] at hap ⊢ simpa [hp.C_dvd_iff_isUnit, isUnit_C] using hap theorem natDegree_pos_of_not_isUnit_of_dvd_monic {a p : R[X]} (ha : ¬ IsUnit a) (hap : a ∣ p) (hp : Monic p) : 0 < natDegree a := natDegree_pos_iff_degree_pos.mpr <| degree_pos_of_not_isUnit_of_dvd_monic ha hap hp theorem degree_pos_of_monic_of_not_isUnit {a : R[X]} (hu : ¬ IsUnit a) (ha : Monic a) : 0 < degree a := degree_pos_of_not_isUnit_of_dvd_monic hu dvd_rfl ha theorem natDegree_pos_of_monic_of_not_isUnit {a : R[X]} (hu : ¬ IsUnit a) (ha : Monic a) : 0 < natDegree a := natDegree_pos_iff_degree_pos.mpr <| degree_pos_of_monic_of_not_isUnit hu ha
Mathlib/Algebra/Polynomial/RingDivision.lean
368
396
theorem eq_zero_of_mul_eq_zero_of_smul (P : R[X]) (h : ∀ r : R, r • P = 0 → r = 0) : ∀ (Q : R[X]), P * Q = 0 → Q = 0 := by
intro Q hQ suffices ∀ i, P.coeff i • Q = 0 by rw [← leadingCoeff_eq_zero] apply h simpa [ext_iff, mul_comm Q.leadingCoeff] using fun i ↦ congr_arg (·.coeff Q.natDegree) (this i) apply Nat.strong_decreasing_induction · use P.natDegree intro i hi rw [coeff_eq_zero_of_natDegree_lt hi, zero_smul] intro l IH obtain _|hl := (natDegree_smul_le (P.coeff l) Q).lt_or_eq · apply eq_zero_of_mul_eq_zero_of_smul _ h (P.coeff l • Q) rw [smul_eq_C_mul, mul_left_comm, hQ, mul_zero] suffices P.coeff l * Q.leadingCoeff = 0 by rwa [← leadingCoeff_eq_zero, ← coeff_natDegree, coeff_smul, hl, coeff_natDegree, smul_eq_mul] let m := Q.natDegree suffices (P * Q).coeff (l + m) = P.coeff l * Q.leadingCoeff by rw [← this, hQ, coeff_zero] rw [coeff_mul] apply Finset.sum_eq_single (l, m) _ (by simp) simp only [Finset.mem_antidiagonal, ne_eq, Prod.forall, Prod.mk.injEq, not_and] intro i j hij H obtain hi|rfl|hi := lt_trichotomy i l · have hj : m < j := by omega rw [coeff_eq_zero_of_natDegree_lt hj, mul_zero] · omega · rw [← coeff_C_mul, ← smul_eq_C_mul, IH _ hi, coeff_zero] termination_by Q => Q.natDegree
[ " IsUnit a", " IsUnit (C (a.coeff 0))", " ∀ (Q : R[X]), P * Q = 0 → Q = 0", " Q = 0", " Q.leadingCoeff = 0", " Q.leadingCoeff • P = 0", " ∀ (i : ℕ), P.coeff i • Q = 0", " ∃ n, ∀ m > n, P.coeff m • Q = 0", " ∀ m > P.natDegree, P.coeff m • Q = 0", " P.coeff i • Q = 0", " ∀ (n : ℕ), (∀ m > n, P.coe...
[ " IsUnit a", " IsUnit (C (a.coeff 0))" ]
import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Localization.Integer import Mathlib.RingTheory.UniqueFactorizationDomain #align_import ring_theory.localization.num_denom from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" variable {R : Type*} [CommRing R] (M : Submonoid R) {S : Type*} [CommRing S] variable [Algebra R S] {P : Type*} [CommRing P] namespace IsFractionRing open IsLocalization section NumDen variable (A : Type*) [CommRing A] [IsDomain A] [UniqueFactorizationMonoid A] variable {K : Type*} [Field K] [Algebra A K] [IsFractionRing A K] theorem exists_reduced_fraction (x : K) : ∃ (a : A) (b : nonZeroDivisors A), IsRelPrime a b ∧ mk' K a b = x := by obtain ⟨⟨b, b_nonzero⟩, a, hab⟩ := exists_integer_multiple (nonZeroDivisors A) x obtain ⟨a', b', c', no_factor, rfl, rfl⟩ := UniqueFactorizationMonoid.exists_reduced_factors' a b (mem_nonZeroDivisors_iff_ne_zero.mp b_nonzero) obtain ⟨_, b'_nonzero⟩ := mul_mem_nonZeroDivisors.mp b_nonzero refine ⟨a', ⟨b', b'_nonzero⟩, no_factor, ?_⟩ refine mul_left_cancel₀ (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors b_nonzero) ?_ simp only [Subtype.coe_mk, RingHom.map_mul, Algebra.smul_def] at * erw [← hab, mul_assoc, mk'_spec' _ a' ⟨b', b'_nonzero⟩] #align is_fraction_ring.exists_reduced_fraction IsFractionRing.exists_reduced_fraction noncomputable def num (x : K) : A := Classical.choose (exists_reduced_fraction A x) #align is_fraction_ring.num IsFractionRing.num noncomputable def den (x : K) : nonZeroDivisors A := Classical.choose (Classical.choose_spec (exists_reduced_fraction A x)) #align is_fraction_ring.denom IsFractionRing.den theorem num_den_reduced (x : K) : IsRelPrime (num A x) (den A x) := (Classical.choose_spec (Classical.choose_spec (exists_reduced_fraction A x))).1 #align is_fraction_ring.num_denom_reduced IsFractionRing.num_den_reduced -- @[simp] -- Porting note: LHS reduces to give the simp lemma below theorem mk'_num_den (x : K) : mk' K (num A x) (den A x) = x := (Classical.choose_spec (Classical.choose_spec (exists_reduced_fraction A x))).2 #align is_fraction_ring.mk'_num_denom IsFractionRing.mk'_num_den @[simp] theorem mk'_num_den' (x : K) : algebraMap A K (num A x) / algebraMap A K (den A x) = x := by rw [← mk'_eq_div] apply mk'_num_den variable {A} theorem num_mul_den_eq_num_iff_eq {x y : K} : x * algebraMap A K (den A y) = algebraMap A K (num A y) ↔ x = y := ⟨fun h => by simpa only [mk'_num_den] using eq_mk'_iff_mul_eq.mpr h, fun h ↦ eq_mk'_iff_mul_eq.mp (by rw [h, mk'_num_den])⟩ #align is_fraction_ring.num_mul_denom_eq_num_iff_eq IsFractionRing.num_mul_den_eq_num_iff_eq theorem num_mul_den_eq_num_iff_eq' {x y : K} : y * algebraMap A K (den A x) = algebraMap A K (num A x) ↔ x = y := ⟨fun h ↦ by simpa only [eq_comm, mk'_num_den] using eq_mk'_iff_mul_eq.mpr h, fun h ↦ eq_mk'_iff_mul_eq.mp (by rw [h, mk'_num_den])⟩ #align is_fraction_ring.num_mul_denom_eq_num_iff_eq' IsFractionRing.num_mul_den_eq_num_iff_eq' theorem num_mul_den_eq_num_mul_den_iff_eq {x y : K} : num A y * den A x = num A x * den A y ↔ x = y := ⟨fun h ↦ by simpa only [mk'_num_den] using mk'_eq_of_eq' (S := K) h, fun h ↦ by rw [h]⟩ #align is_fraction_ring.num_mul_denom_eq_num_mul_denom_iff_eq IsFractionRing.num_mul_den_eq_num_mul_den_iff_eq theorem eq_zero_of_num_eq_zero {x : K} (h : num A x = 0) : x = 0 := num_mul_den_eq_num_iff_eq'.mp (by rw [zero_mul, h, RingHom.map_zero]) #align is_fraction_ring.eq_zero_of_num_eq_zero IsFractionRing.eq_zero_of_num_eq_zero
Mathlib/RingTheory/Localization/NumDen.lean
97
105
theorem isInteger_of_isUnit_den {x : K} (h : IsUnit (den A x : A)) : IsInteger A x := by
cases' h with d hd have d_ne_zero : algebraMap A K (den A x) ≠ 0 := IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors (den A x).2 use ↑d⁻¹ * num A x refine _root_.trans ?_ (mk'_num_den A x) rw [map_mul, map_units_inv, hd] apply mul_left_cancel₀ d_ne_zero rw [← mul_assoc, mul_inv_cancel d_ne_zero, one_mul, mk'_spec']
[ " ∃ a b, IsRelPrime a ↑b ∧ mk' K a b = x", " mk' K a' ⟨b', b'_nonzero⟩ = x", " (algebraMap A K) (c' * b') * mk' K a' ⟨b', b'_nonzero⟩ = (algebraMap A K) (c' * b') * x", " (algebraMap A K) c' * (algebraMap A K) b' * mk' K a' ⟨b', b'_nonzero⟩ = (algebraMap A K) c' * (algebraMap A K) b' * x", " (algebraMap A K...
[ " ∃ a b, IsRelPrime a ↑b ∧ mk' K a b = x", " mk' K a' ⟨b', b'_nonzero⟩ = x", " (algebraMap A K) (c' * b') * mk' K a' ⟨b', b'_nonzero⟩ = (algebraMap A K) (c' * b') * x", " (algebraMap A K) c' * (algebraMap A K) b' * mk' K a' ⟨b', b'_nonzero⟩ = (algebraMap A K) c' * (algebraMap A K) b' * x", " (algebraMap A K...
import Mathlib.Topology.MetricSpace.Antilipschitz #align_import topology.metric_space.isometry from "leanprover-community/mathlib"@"b1859b6d4636fdbb78c5d5cefd24530653cfd3eb" noncomputable section universe u v w variable {ι : Type*} {α : Type u} {β : Type v} {γ : Type w} open Function Set open scoped Topology ENNReal def Isometry [PseudoEMetricSpace α] [PseudoEMetricSpace β] (f : α → β) : Prop := ∀ x1 x2 : α, edist (f x1) (f x2) = edist x1 x2 #align isometry Isometry
Mathlib/Topology/MetricSpace/Isometry.lean
40
42
theorem isometry_iff_nndist_eq [PseudoMetricSpace α] [PseudoMetricSpace β] {f : α → β} : Isometry f ↔ ∀ x y, nndist (f x) (f y) = nndist x y := by
simp only [Isometry, edist_nndist, ENNReal.coe_inj]
[ " Isometry f ↔ ∀ (x y : α), nndist (f x) (f y) = nndist x y" ]
[]
import Mathlib.Data.Finset.Basic import Mathlib.ModelTheory.Syntax import Mathlib.Data.List.ProdSigma #align_import model_theory.semantics from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} {L' : Language} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} {γ : Type*} open FirstOrder Cardinal open Structure Cardinal Fin namespace Term -- Porting note: universes in different order def realize (v : α → M) : ∀ _t : L.Term α, M | var k => v k | func f ts => funMap f fun i => (ts i).realize v #align first_order.language.term.realize FirstOrder.Language.Term.realize @[simp] theorem realize_var (v : α → M) (k) : realize v (var k : L.Term α) = v k := rfl @[simp] theorem realize_func (v : α → M) {n} (f : L.Functions n) (ts) : realize v (func f ts : L.Term α) = funMap f fun i => (ts i).realize v := rfl @[simp]
Mathlib/ModelTheory/Semantics.lean
88
92
theorem realize_relabel {t : L.Term α} {g : α → β} {v : β → M} : (t.relabel g).realize v = t.realize (v ∘ g) := by
induction' t with _ n f ts ih · rfl · simp [ih]
[ " realize v (relabel g t) = realize (v ∘ g) t", " realize v (relabel g (var a✝)) = realize (v ∘ g) (var a✝)", " realize v (relabel g (func f ts)) = realize (v ∘ g) (func f ts)" ]
[]
import Mathlib.Analysis.Complex.Circle import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup #align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" noncomputable section open Complex open ComplexConjugate local notation "|" x "|" => Complex.abs x def rotation : circle →* ℂ ≃ₗᵢ[ℝ] ℂ where toFun a := { DistribMulAction.toLinearEquiv ℝ ℂ a with norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] } map_one' := LinearIsometryEquiv.ext <| one_smul circle map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b #align rotation rotation @[simp] theorem rotation_apply (a : circle) (z : ℂ) : rotation a z = a * z := rfl #align rotation_apply rotation_apply @[simp] theorem rotation_symm (a : circle) : (rotation a).symm = rotation a⁻¹ := LinearIsometryEquiv.ext fun _ => rfl #align rotation_symm rotation_symm @[simp] theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by ext1 simp #align rotation_trans rotation_trans theorem rotation_ne_conjLIE (a : circle) : rotation a ≠ conjLIE := by intro h have h1 : rotation a 1 = conj 1 := LinearIsometryEquiv.congr_fun h 1 have hI : rotation a I = conj I := LinearIsometryEquiv.congr_fun h I rw [rotation_apply, RingHom.map_one, mul_one] at h1 rw [rotation_apply, conj_I, ← neg_one_mul, mul_left_inj' I_ne_zero, h1, eq_neg_self_iff] at hI exact one_ne_zero hI #align rotation_ne_conj_lie rotation_ne_conjLIE @[simps] def rotationOf (e : ℂ ≃ₗᵢ[ℝ] ℂ) : circle := ⟨e 1 / Complex.abs (e 1), by simp⟩ #align rotation_of rotationOf @[simp] theorem rotationOf_rotation (a : circle) : rotationOf (rotation a) = a := Subtype.ext <| by simp #align rotation_of_rotation rotationOf_rotation theorem rotation_injective : Function.Injective rotation := Function.LeftInverse.injective rotationOf_rotation #align rotation_injective rotation_injective theorem LinearIsometry.re_apply_eq_re_of_add_conj_eq (f : ℂ →ₗᵢ[ℝ] ℂ) (h₃ : ∀ z, z + conj z = f z + conj (f z)) (z : ℂ) : (f z).re = z.re := by simpa [ext_iff, add_re, add_im, conj_re, conj_im, ← two_mul, show (2 : ℝ) ≠ 0 by simp [two_ne_zero]] using (h₃ z).symm #align linear_isometry.re_apply_eq_re_of_add_conj_eq LinearIsometry.re_apply_eq_re_of_add_conj_eq theorem LinearIsometry.im_apply_eq_im_or_neg_of_re_apply_eq_re {f : ℂ →ₗᵢ[ℝ] ℂ} (h₂ : ∀ z, (f z).re = z.re) (z : ℂ) : (f z).im = z.im ∨ (f z).im = -z.im := by have h₁ := f.norm_map z simp only [Complex.abs_def, norm_eq_abs] at h₁ rwa [Real.sqrt_inj (normSq_nonneg _) (normSq_nonneg _), normSq_apply (f z), normSq_apply z, h₂, add_left_cancel_iff, mul_self_eq_mul_self_iff] at h₁ #align linear_isometry.im_apply_eq_im_or_neg_of_re_apply_eq_re LinearIsometry.im_apply_eq_im_or_neg_of_re_apply_eq_re theorem LinearIsometry.im_apply_eq_im {f : ℂ →ₗᵢ[ℝ] ℂ} (h : f 1 = 1) (z : ℂ) : z + conj z = f z + conj (f z) := by have : ‖f z - 1‖ = ‖z - 1‖ := by rw [← f.norm_map (z - 1), f.map_sub, h] apply_fun fun x => x ^ 2 at this simp only [norm_eq_abs, ← normSq_eq_abs] at this rw [← ofReal_inj, ← mul_conj, ← mul_conj] at this rw [RingHom.map_sub, RingHom.map_sub] at this simp only [sub_mul, mul_sub, one_mul, mul_one] at this rw [mul_conj, normSq_eq_abs, ← norm_eq_abs, LinearIsometry.norm_map] at this rw [mul_conj, normSq_eq_abs, ← norm_eq_abs] at this simp only [sub_sub, sub_right_inj, mul_one, ofReal_pow, RingHom.map_one, norm_eq_abs] at this simp only [add_sub, sub_left_inj] at this rw [add_comm, ← this, add_comm] #align linear_isometry.im_apply_eq_im LinearIsometry.im_apply_eq_im theorem LinearIsometry.re_apply_eq_re {f : ℂ →ₗᵢ[ℝ] ℂ} (h : f 1 = 1) (z : ℂ) : (f z).re = z.re := by apply LinearIsometry.re_apply_eq_re_of_add_conj_eq intro z apply LinearIsometry.im_apply_eq_im h #align linear_isometry.re_apply_eq_re LinearIsometry.re_apply_eq_re
Mathlib/Analysis/Complex/Isometry.lean
125
139
theorem linear_isometry_complex_aux {f : ℂ ≃ₗᵢ[ℝ] ℂ} (h : f 1 = 1) : f = LinearIsometryEquiv.refl ℝ ℂ ∨ f = conjLIE := by
have h0 : f I = I ∨ f I = -I := by simp only [ext_iff, ← and_or_left, neg_re, I_re, neg_im, neg_zero] constructor · rw [← I_re] exact @LinearIsometry.re_apply_eq_re f.toLinearIsometry h I · apply @LinearIsometry.im_apply_eq_im_or_neg_of_re_apply_eq_re f.toLinearIsometry intro z rw [@LinearIsometry.re_apply_eq_re f.toLinearIsometry h] refine h0.imp (fun h' : f I = I => ?_) fun h' : f I = -I => ?_ <;> · apply LinearIsometryEquiv.toLinearEquiv_injective apply Complex.basisOneI.ext' intro i fin_cases i <;> simp [h, h']
[ " Complex.abs (↑a * x) = Complex.abs x", " (rotation a).trans (rotation b) = rotation (b * a)", " ((rotation a).trans (rotation b)) x✝ = (rotation (b * a)) x✝", " rotation a ≠ conjLIE", " False", " e 1 / ↑(Complex.abs (e 1)) ∈ circle", " ↑(rotationOf (rotation a)) = ↑a", " (f z).re = z.re", " 2 ≠ 0"...
[ " Complex.abs (↑a * x) = Complex.abs x", " (rotation a).trans (rotation b) = rotation (b * a)", " ((rotation a).trans (rotation b)) x✝ = (rotation (b * a)) x✝", " rotation a ≠ conjLIE", " False", " e 1 / ↑(Complex.abs (e 1)) ∈ circle", " ↑(rotationOf (rotation a)) = ↑a", " (f z).re = z.re", " 2 ≠ 0"...
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation #align_import linear_algebra.clifford_algebra.star from "leanprover-community/mathlib"@"4d66277cfec381260ba05c68f9ae6ce2a118031d" variable {R : Type*} [CommRing R] variable {M : Type*} [AddCommGroup M] [Module R M] variable {Q : QuadraticForm R M} namespace CliffordAlgebra instance instStarRing : StarRing (CliffordAlgebra Q) where star x := reverse (involute x) star_involutive x := by simp only [reverse_involute_commute.eq, reverse_reverse, involute_involute] star_mul x y := by simp only [map_mul, reverse.map_mul] star_add x y := by simp only [map_add] theorem star_def (x : CliffordAlgebra Q) : star x = reverse (involute x) := rfl #align clifford_algebra.star_def CliffordAlgebra.star_def theorem star_def' (x : CliffordAlgebra Q) : star x = involute (reverse x) := reverse_involute _ #align clifford_algebra.star_def' CliffordAlgebra.star_def' @[simp] theorem star_ι (m : M) : star (ι Q m) = -ι Q m := by rw [star_def, involute_ι, map_neg, reverse_ι] #align clifford_algebra.star_ι CliffordAlgebra.star_ι @[simp] theorem star_smul (r : R) (x : CliffordAlgebra Q) : star (r • x) = r • star x := by rw [star_def, star_def, map_smul, map_smul] #align clifford_algebra.star_smul CliffordAlgebra.star_smul @[simp]
Mathlib/LinearAlgebra/CliffordAlgebra/Star.lean
62
64
theorem star_algebraMap (r : R) : star (algebraMap R (CliffordAlgebra Q) r) = algebraMap R (CliffordAlgebra Q) r := by
rw [star_def, involute.commutes, reverse.commutes]
[ " star (star x) = x", " star (x * y) = star y * star x", " star (x + y) = star x + star y", " star ((ι Q) m) = -(ι Q) m", " star (r • x) = r • star x", " star ((algebraMap R (CliffordAlgebra Q)) r) = (algebraMap R (CliffordAlgebra Q)) r" ]
[ " star (star x) = x", " star (x * y) = star y * star x", " star (x + y) = star x + star y", " star ((ι Q) m) = -(ι Q) m", " star (r • x) = r • star x" ]
import Mathlib.RingTheory.AdjoinRoot import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.Polynomial.GaussLemma #align_import field_theory.minpoly.is_integrally_closed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Classical Polynomial open Polynomial Set Function minpoly namespace minpoly variable {R S : Type*} [CommRing R] [CommRing S] [IsDomain R] [Algebra R S] section variable (K L : Type*) [Field K] [Algebra R K] [IsFractionRing R K] [CommRing L] [Nontrivial L] [Algebra R L] [Algebra S L] [Algebra K L] [IsScalarTower R K L] [IsScalarTower R S L] variable [IsIntegrallyClosed R] theorem isIntegrallyClosed_eq_field_fractions [IsDomain S] {s : S} (hs : IsIntegral R s) : minpoly K (algebraMap S L s) = (minpoly R s).map (algebraMap R K) := by refine (eq_of_irreducible_of_monic ?_ ?_ ?_).symm · exact ((monic hs).irreducible_iff_irreducible_map_fraction_map).1 (irreducible hs) · rw [aeval_map_algebraMap, aeval_algebraMap_apply, aeval, map_zero] · exact (monic hs).map _ #align minpoly.is_integrally_closed_eq_field_fractions minpoly.isIntegrallyClosed_eq_field_fractions theorem isIntegrallyClosed_eq_field_fractions' [IsDomain S] [Algebra K S] [IsScalarTower R K S] {s : S} (hs : IsIntegral R s) : minpoly K s = (minpoly R s).map (algebraMap R K) := by let L := FractionRing S rw [← isIntegrallyClosed_eq_field_fractions K L hs, algebraMap_eq (IsFractionRing.injective S L)] #align minpoly.is_integrally_closed_eq_field_fractions' minpoly.isIntegrallyClosed_eq_field_fractions' end variable [IsDomain S] [NoZeroSMulDivisors R S] variable [IsIntegrallyClosed R] theorem isIntegrallyClosed_dvd {s : S} (hs : IsIntegral R s) {p : R[X]} (hp : Polynomial.aeval s p = 0) : minpoly R s ∣ p := by let K := FractionRing R let L := FractionRing S let _ : Algebra K L := FractionRing.liftAlgebra R L have := FractionRing.isScalarTower_liftAlgebra R L have : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (p %ₘ minpoly R s) := by rw [map_modByMonic _ (minpoly.monic hs), modByMonic_eq_sub_mul_div] · refine dvd_sub (minpoly.dvd K (algebraMap S L s) ?_) ?_ · rw [← map_aeval_eq_aeval_map, hp, map_zero] rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq] apply dvd_mul_of_dvd_left rw [isIntegrallyClosed_eq_field_fractions K L hs] exact Monic.map _ (minpoly.monic hs) rw [isIntegrallyClosed_eq_field_fractions _ _ hs, map_dvd_map (algebraMap R K) (IsFractionRing.injective R K) (minpoly.monic hs)] at this rw [← modByMonic_eq_zero_iff_dvd (minpoly.monic hs)] exact Polynomial.eq_zero_of_dvd_of_degree_lt this (degree_modByMonic_lt p <| minpoly.monic hs) #align minpoly.is_integrally_closed_dvd minpoly.isIntegrallyClosed_dvd theorem isIntegrallyClosed_dvd_iff {s : S} (hs : IsIntegral R s) (p : R[X]) : Polynomial.aeval s p = 0 ↔ minpoly R s ∣ p := ⟨fun hp => isIntegrallyClosed_dvd hs hp, fun hp => by simpa only [RingHom.mem_ker, RingHom.coe_comp, coe_evalRingHom, coe_mapRingHom, Function.comp_apply, eval_map, ← aeval_def] using aeval_eq_zero_of_dvd_aeval_eq_zero hp (minpoly.aeval R s)⟩ #align minpoly.is_integrally_closed_dvd_iff minpoly.isIntegrallyClosed_dvd_iff theorem ker_eval {s : S} (hs : IsIntegral R s) : RingHom.ker ((Polynomial.aeval s).toRingHom : R[X] →+* S) = Ideal.span ({minpoly R s} : Set R[X]) := by ext p simp_rw [RingHom.mem_ker, AlgHom.toRingHom_eq_coe, AlgHom.coe_toRingHom, isIntegrallyClosed_dvd_iff hs, ← Ideal.mem_span_singleton] #align minpoly.ker_eval minpoly.ker_eval theorem IsIntegrallyClosed.degree_le_of_ne_zero {s : S} (hs : IsIntegral R s) {p : R[X]} (hp0 : p ≠ 0) (hp : Polynomial.aeval s p = 0) : degree (minpoly R s) ≤ degree p := by rw [degree_eq_natDegree (minpoly.ne_zero hs), degree_eq_natDegree hp0] norm_cast exact natDegree_le_of_dvd ((isIntegrallyClosed_dvd_iff hs _).mp hp) hp0 #align minpoly.is_integrally_closed.degree_le_of_ne_zero minpoly.IsIntegrallyClosed.degree_le_of_ne_zero theorem _root_.IsIntegrallyClosed.minpoly.unique {s : S} {P : R[X]} (hmo : P.Monic) (hP : Polynomial.aeval s P = 0) (Pmin : ∀ Q : R[X], Q.Monic → Polynomial.aeval s Q = 0 → degree P ≤ degree Q) : P = minpoly R s := by have hs : IsIntegral R s := ⟨P, hmo, hP⟩ symm; apply eq_of_sub_eq_zero by_contra hnz refine IsIntegrallyClosed.degree_le_of_ne_zero hs hnz (by simp [hP]) |>.not_lt ?_ refine degree_sub_lt ?_ (ne_zero hs) ?_ · exact le_antisymm (min R s hmo hP) (Pmin (minpoly R s) (monic hs) (aeval R s)) · rw [(monic hs).leadingCoeff, hmo.leadingCoeff] #align minpoly.is_integrally_closed.minpoly.unique IsIntegrallyClosed.minpoly.unique
Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean
138
145
theorem prime_of_isIntegrallyClosed {x : S} (hx : IsIntegral R x) : Prime (minpoly R x) := by
refine ⟨(minpoly.monic hx).ne_zero, ⟨fun h_contra => (ne_of_lt (minpoly.degree_pos hx)) (degree_eq_zero_of_isUnit h_contra).symm, fun a b h => or_iff_not_imp_left.mpr fun h' => ?_⟩⟩ rw [← minpoly.isIntegrallyClosed_dvd_iff hx] at h' h ⊢ rw [aeval_mul] at h exact eq_zero_of_ne_zero_of_mul_left_eq_zero h' h
[ " minpoly K ((algebraMap S L) s) = map (algebraMap R K) (minpoly R s)", " Irreducible (map (algebraMap R K) (minpoly R s))", " (Polynomial.aeval ((algebraMap S L) s)) (map (algebraMap R K) (minpoly R s)) = 0", " (map (algebraMap R K) (minpoly R s)).Monic", " minpoly K s = map (algebraMap R K) (minpoly R s)"...
[ " minpoly K ((algebraMap S L) s) = map (algebraMap R K) (minpoly R s)", " Irreducible (map (algebraMap R K) (minpoly R s))", " (Polynomial.aeval ((algebraMap S L) s)) (map (algebraMap R K) (minpoly R s)) = 0", " (map (algebraMap R K) (minpoly R s)).Monic", " minpoly K s = map (algebraMap R K) (minpoly R s)"...
import Mathlib.Data.Matrix.Block import Mathlib.Data.Matrix.Notation import Mathlib.Data.Matrix.RowCol import Mathlib.GroupTheory.GroupAction.Ring import Mathlib.GroupTheory.Perm.Fin import Mathlib.LinearAlgebra.Alternating.Basic #align_import linear_algebra.matrix.determinant from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" universe u v w z open Equiv Equiv.Perm Finset Function namespace Matrix open Matrix variable {m n : Type*} [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m] variable {R : Type v} [CommRing R] local notation "ε " σ:arg => ((sign σ : ℤ) : R) def detRowAlternating : (n → R) [⋀^n]→ₗ[R] R := MultilinearMap.alternatization ((MultilinearMap.mkPiAlgebra R n R).compLinearMap LinearMap.proj) #align matrix.det_row_alternating Matrix.detRowAlternating abbrev det (M : Matrix n n R) : R := detRowAlternating M #align matrix.det Matrix.det theorem det_apply (M : Matrix n n R) : M.det = ∑ σ : Perm n, Equiv.Perm.sign σ • ∏ i, M (σ i) i := MultilinearMap.alternatization_apply _ M #align matrix.det_apply Matrix.det_apply -- This is what the old definition was. We use it to avoid having to change the old proofs below theorem det_apply' (M : Matrix n n R) : M.det = ∑ σ : Perm n, ε σ * ∏ i, M (σ i) i := by simp [det_apply, Units.smul_def] #align matrix.det_apply' Matrix.det_apply' @[simp] theorem det_diagonal {d : n → R} : det (diagonal d) = ∏ i, d i := by rw [det_apply'] refine (Finset.sum_eq_single 1 ?_ ?_).trans ?_ · rintro σ - h2 cases' not_forall.1 (mt Equiv.ext h2) with x h3 convert mul_zero (ε σ) apply Finset.prod_eq_zero (mem_univ x) exact if_neg h3 · simp · simp #align matrix.det_diagonal Matrix.det_diagonal -- @[simp] -- Porting note (#10618): simp can prove this theorem det_zero (_ : Nonempty n) : det (0 : Matrix n n R) = 0 := (detRowAlternating : (n → R) [⋀^n]→ₗ[R] R).map_zero #align matrix.det_zero Matrix.det_zero @[simp] theorem det_one : det (1 : Matrix n n R) = 1 := by rw [← diagonal_one]; simp [-diagonal_one] #align matrix.det_one Matrix.det_one theorem det_isEmpty [IsEmpty n] {A : Matrix n n R} : det A = 1 := by simp [det_apply] #align matrix.det_is_empty Matrix.det_isEmpty @[simp] theorem coe_det_isEmpty [IsEmpty n] : (det : Matrix n n R → R) = Function.const _ 1 := by ext exact det_isEmpty #align matrix.coe_det_is_empty Matrix.coe_det_isEmpty theorem det_eq_one_of_card_eq_zero {A : Matrix n n R} (h : Fintype.card n = 0) : det A = 1 := haveI : IsEmpty n := Fintype.card_eq_zero_iff.mp h det_isEmpty #align matrix.det_eq_one_of_card_eq_zero Matrix.det_eq_one_of_card_eq_zero @[simp] theorem det_unique {n : Type*} [Unique n] [DecidableEq n] [Fintype n] (A : Matrix n n R) : det A = A default default := by simp [det_apply, univ_unique] #align matrix.det_unique Matrix.det_unique theorem det_eq_elem_of_subsingleton [Subsingleton n] (A : Matrix n n R) (k : n) : det A = A k k := by have := uniqueOfSubsingleton k convert det_unique A #align matrix.det_eq_elem_of_subsingleton Matrix.det_eq_elem_of_subsingleton theorem det_eq_elem_of_card_eq_one {A : Matrix n n R} (h : Fintype.card n = 1) (k : n) : det A = A k k := haveI : Subsingleton n := Fintype.card_le_one_iff_subsingleton.mp h.le det_eq_elem_of_subsingleton _ _ #align matrix.det_eq_elem_of_card_eq_one Matrix.det_eq_elem_of_card_eq_one
Mathlib/LinearAlgebra/Matrix/Determinant/Basic.lean
128
141
theorem det_mul_aux {M N : Matrix n n R} {p : n → n} (H : ¬Bijective p) : (∑ σ : Perm n, ε σ * ∏ x, M (σ x) (p x) * N (p x) x) = 0 := by
obtain ⟨i, j, hpij, hij⟩ : ∃ i j, p i = p j ∧ i ≠ j := by rw [← Finite.injective_iff_bijective, Injective] at H push_neg at H exact H exact sum_involution (fun σ _ => σ * Equiv.swap i j) (fun σ _ => by have : (∏ x, M (σ x) (p x)) = ∏ x, M ((σ * Equiv.swap i j) x) (p x) := Fintype.prod_equiv (swap i j) _ _ (by simp [apply_swap_eq_self hpij]) simp [this, sign_swap hij, -sign_swap', prod_mul_distrib]) (fun σ _ _ => (not_congr mul_swap_eq_iff).mpr hij) (fun _ _ => mem_univ _) fun σ _ => mul_swap_involutive i j σ
[ " M.det = ∑ σ : Perm n, ↑↑(sign σ) * ∏ i : n, M (σ i) i", " (diagonal d).det = ∏ i : n, d i", " ∑ σ : Perm n, ↑↑(sign σ) * ∏ i : n, diagonal d (σ i) i = ∏ i : n, d i", " ∀ b ∈ univ, b ≠ 1 → ↑↑(sign b) * ∏ i : n, diagonal d (b i) i = 0", " ↑↑(sign σ) * ∏ i : n, diagonal d (σ i) i = 0", " ∏ i : n, diagonal ...
[ " M.det = ∑ σ : Perm n, ↑↑(sign σ) * ∏ i : n, M (σ i) i", " (diagonal d).det = ∏ i : n, d i", " ∑ σ : Perm n, ↑↑(sign σ) * ∏ i : n, diagonal d (σ i) i = ∏ i : n, d i", " ∀ b ∈ univ, b ≠ 1 → ↑↑(sign b) * ∏ i : n, diagonal d (b i) i = 0", " ↑↑(sign σ) * ∏ i : n, diagonal d (σ i) i = 0", " ∏ i : n, diagonal ...
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def χ₄ : MulChar (ZMod 4) ℤ where toFun := (![0, 1, 0, -1] : ZMod 4 → ℤ) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.χ₄ ZMod.χ₄ theorem isQuadratic_χ₄ : χ₄.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_χ₄ ZMod.isQuadratic_χ₄ theorem χ₄_nat_mod_four (n : ℕ) : χ₄ n = χ₄ (n % 4 : ℕ) := by rw [← ZMod.natCast_mod n 4] #align zmod.χ₄_nat_mod_four ZMod.χ₄_nat_mod_four theorem χ₄_int_mod_four (n : ℤ) : χ₄ n = χ₄ (n % 4 : ℤ) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.χ₄_int_mod_four ZMod.χ₄_int_mod_four theorem χ₄_int_eq_if_mod_four (n : ℤ) : χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : ∀ m : ℤ, 0 ≤ m → m < 4 → χ₄ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : ℤ) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.χ₄_int_eq_if_mod_four ZMod.χ₄_int_eq_if_mod_four theorem χ₄_nat_eq_if_mod_four (n : ℕ) : χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast χ₄_int_eq_if_mod_four n #align zmod.χ₄_nat_eq_if_mod_four ZMod.χ₄_nat_eq_if_mod_four theorem χ₄_eq_neg_one_pow {n : ℕ} (hn : n % 2 = 1) : χ₄ n = (-1) ^ (n / 2) := by rw [χ₄_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : ∀ m : ℕ, m < 4 → m % 2 = 1 → ite (m = 1) (1 : ℤ) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.χ₄_eq_neg_one_pow ZMod.χ₄_eq_neg_one_pow theorem χ₄_nat_one_mod_four {n : ℕ} (hn : n % 4 = 1) : χ₄ n = 1 := by rw [χ₄_nat_mod_four, hn] rfl #align zmod.χ₄_nat_one_mod_four ZMod.χ₄_nat_one_mod_four theorem χ₄_nat_three_mod_four {n : ℕ} (hn : n % 4 = 3) : χ₄ n = -1 := by rw [χ₄_nat_mod_four, hn] rfl #align zmod.χ₄_nat_three_mod_four ZMod.χ₄_nat_three_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
107
109
theorem χ₄_int_one_mod_four {n : ℤ} (hn : n % 4 = 1) : χ₄ n = 1 := by
rw [χ₄_int_mod_four, hn] rfl
[ " ∀ (x y : ZMod 4),\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun (x * y) =\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun x * { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun y", " ∀ (a : ZMod 4), ¬IsUnit a → (↑{ toFun := ![0, 1, 0, -1], map_one' := ⋯, map_mul' := ⋯ }).toFun a = 0", " χ₄.IsQua...
[ " ∀ (x y : ZMod 4),\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun (x * y) =\n { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun x * { toFun := ![0, 1, 0, -1], map_one' := ⋯ }.toFun y", " ∀ (a : ZMod 4), ¬IsUnit a → (↑{ toFun := ![0, 1, 0, -1], map_one' := ⋯, map_mul' := ⋯ }).toFun a = 0", " χ₄.IsQua...
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.Topology.Spectral.Hom import Mathlib.AlgebraicGeometry.Limits #align_import algebraic_geometry.morphisms.quasi_compact from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe u open scoped AlgebraicGeometry namespace AlgebraicGeometry variable {X Y : Scheme.{u}} (f : X ⟶ Y) @[mk_iff] class QuasiCompact (f : X ⟶ Y) : Prop where isCompact_preimage : ∀ U : Set Y.carrier, IsOpen U → IsCompact U → IsCompact (f.1.base ⁻¹' U) #align algebraic_geometry.quasi_compact AlgebraicGeometry.QuasiCompact theorem quasiCompact_iff_spectral : QuasiCompact f ↔ IsSpectralMap f.1.base := ⟨fun ⟨h⟩ => ⟨by continuity, h⟩, fun h => ⟨h.2⟩⟩ #align algebraic_geometry.quasi_compact_iff_spectral AlgebraicGeometry.quasiCompact_iff_spectral def QuasiCompact.affineProperty : AffineTargetMorphismProperty := fun X _ _ _ => CompactSpace X.carrier #align algebraic_geometry.quasi_compact.affine_property AlgebraicGeometry.QuasiCompact.affineProperty instance (priority := 900) quasiCompactOfIsIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] : QuasiCompact f := by constructor intro U _ hU' convert hU'.image (inv f.1.base).continuous_toFun using 1 rw [Set.image_eq_preimage_of_inverse] · delta Function.LeftInverse exact IsIso.inv_hom_id_apply f.1.base · exact IsIso.hom_inv_id_apply f.1.base #align algebraic_geometry.quasi_compact_of_is_iso AlgebraicGeometry.quasiCompactOfIsIso instance quasiCompactComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [QuasiCompact f] [QuasiCompact g] : QuasiCompact (f ≫ g) := by constructor intro U hU hU' rw [Scheme.comp_val_base, TopCat.coe_comp, Set.preimage_comp] apply QuasiCompact.isCompact_preimage · exact Continuous.isOpen_preimage (by -- Porting note: `continuity` failed -- see https://github.com/leanprover-community/mathlib4/issues/5030 exact Scheme.Hom.continuous g) _ hU apply QuasiCompact.isCompact_preimage <;> assumption #align algebraic_geometry.quasi_compact_comp AlgebraicGeometry.quasiCompactComp theorem isCompact_open_iff_eq_finset_affine_union {X : Scheme} (U : Set X.carrier) : IsCompact U ∧ IsOpen U ↔ ∃ s : Set X.affineOpens, s.Finite ∧ U = ⋃ (i : X.affineOpens) (_ : i ∈ s), i := by apply Opens.IsBasis.isCompact_open_iff_eq_finite_iUnion (fun (U : X.affineOpens) => (U : Opens X.carrier)) · rw [Subtype.range_coe]; exact isBasis_affine_open X · exact fun i => i.2.isCompact #align algebraic_geometry.is_compact_open_iff_eq_finset_affine_union AlgebraicGeometry.isCompact_open_iff_eq_finset_affine_union theorem isCompact_open_iff_eq_basicOpen_union {X : Scheme} [IsAffine X] (U : Set X.carrier) : IsCompact U ∧ IsOpen U ↔ ∃ s : Set (X.presheaf.obj (op ⊤)), s.Finite ∧ U = ⋃ (i : X.presheaf.obj (op ⊤)) (_ : i ∈ s), X.basicOpen i := (isBasis_basicOpen X).isCompact_open_iff_eq_finite_iUnion _ (fun _ => ((topIsAffineOpen _).basicOpenIsAffine _).isCompact) _ #align algebraic_geometry.is_compact_open_iff_eq_basic_open_union AlgebraicGeometry.isCompact_open_iff_eq_basicOpen_union theorem quasiCompact_iff_forall_affine : QuasiCompact f ↔ ∀ U : Opens Y.carrier, IsAffineOpen U → IsCompact (f.1.base ⁻¹' (U : Set Y.carrier)) := by rw [quasiCompact_iff] refine ⟨fun H U hU => H U U.isOpen hU.isCompact, ?_⟩ intro H U hU hU' obtain ⟨S, hS, rfl⟩ := (isCompact_open_iff_eq_finset_affine_union U).mp ⟨hU', hU⟩ simp only [Set.preimage_iUnion] exact Set.Finite.isCompact_biUnion hS (fun i _ => H i i.prop) #align algebraic_geometry.quasi_compact_iff_forall_affine AlgebraicGeometry.quasiCompact_iff_forall_affine @[simp] theorem QuasiCompact.affineProperty_toProperty {X Y : Scheme} (f : X ⟶ Y) : (QuasiCompact.affineProperty : _).toProperty f ↔ IsAffine Y ∧ CompactSpace X.carrier := by delta AffineTargetMorphismProperty.toProperty QuasiCompact.affineProperty; simp #align algebraic_geometry.quasi_compact.affine_property_to_property AlgebraicGeometry.QuasiCompact.affineProperty_toProperty theorem quasiCompact_iff_affineProperty : QuasiCompact f ↔ targetAffineLocally QuasiCompact.affineProperty f := by rw [quasiCompact_iff_forall_affine] trans ∀ U : Y.affineOpens, IsCompact (f.1.base ⁻¹' (U : Set Y.carrier)) · exact ⟨fun h U => h U U.prop, fun h U hU => h ⟨U, hU⟩⟩ apply forall_congr' exact fun _ => isCompact_iff_compactSpace #align algebraic_geometry.quasi_compact_iff_affine_property AlgebraicGeometry.quasiCompact_iff_affineProperty theorem quasiCompact_eq_affineProperty : @QuasiCompact = targetAffineLocally QuasiCompact.affineProperty := by ext exact quasiCompact_iff_affineProperty _ #align algebraic_geometry.quasi_compact_eq_affine_property AlgebraicGeometry.quasiCompact_eq_affineProperty
Mathlib/AlgebraicGeometry/Morphisms/QuasiCompact.lean
129
158
theorem isCompact_basicOpen (X : Scheme) {U : Opens X.carrier} (hU : IsCompact (U : Set X.carrier)) (f : X.presheaf.obj (op U)) : IsCompact (X.basicOpen f : Set X.carrier) := by
classical refine ((isCompact_open_iff_eq_finset_affine_union _).mpr ?_).1 obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union _).mp ⟨hU, U.isOpen⟩ let g : s → X.affineOpens := by intro V use V.1 ⊓ X.basicOpen f have : V.1.1 ⟶ U := by apply homOfLE; change _ ⊆ (U : Set X.carrier); rw [e] convert Set.subset_iUnion₂ (s := fun (U : X.affineOpens) (_ : U ∈ s) => (U : Set X.carrier)) V V.prop using 1 erw [← X.toLocallyRingedSpace.toRingedSpace.basicOpen_res this.op] exact IsAffineOpen.basicOpenIsAffine V.1.prop _ haveI : Finite s := hs.to_subtype refine ⟨Set.range g, Set.finite_range g, ?_⟩ refine (Set.inter_eq_right.mpr (SetLike.coe_subset_coe.2 <| RingedSpace.basicOpen_le _ _)).symm.trans ?_ rw [e, Set.iUnion₂_inter] apply le_antisymm <;> apply Set.iUnion₂_subset · intro i hi -- Porting note: had to make explicit the first given parameter to `Set.subset_iUnion₂` exact Set.Subset.trans (Set.Subset.rfl : _ ≤ g ⟨i, hi⟩) (@Set.subset_iUnion₂ _ _ _ (fun (i : Scheme.affineOpens X) (_ : i ∈ Set.range g) => (i : Set X.toPresheafedSpace)) _ (Set.mem_range_self ⟨i, hi⟩)) · rintro ⟨i, hi⟩ ⟨⟨j, hj⟩, hj'⟩ rw [← hj'] refine Set.Subset.trans ?_ (Set.subset_iUnion₂ j hj) exact Set.Subset.rfl
[ " Continuous ⇑f.val.base", " QuasiCompact f", " ∀ (U : Set ↑↑Y.toPresheafedSpace), IsOpen U → IsCompact U → IsCompact (⇑f.val.base ⁻¹' U)", " IsCompact (⇑f.val.base ⁻¹' U)", " ⇑f.val.base ⁻¹' U = (inv f.val.base).toFun '' U", " Function.LeftInverse (⇑f.val.base) (inv f.val.base).toFun", " ∀ (x : ↑↑Y.toP...
[ " Continuous ⇑f.val.base", " QuasiCompact f", " ∀ (U : Set ↑↑Y.toPresheafedSpace), IsOpen U → IsCompact U → IsCompact (⇑f.val.base ⁻¹' U)", " IsCompact (⇑f.val.base ⁻¹' U)", " ⇑f.val.base ⁻¹' U = (inv f.val.base).toFun '' U", " Function.LeftInverse (⇑f.val.base) (inv f.val.base).toFun", " ∀ (x : ↑↑Y.toP...
import Batteries.Data.RBMap.Alter import Batteries.Data.List.Lemmas namespace Batteries namespace RBNode open RBColor attribute [simp] fold foldl foldr Any forM foldlM Ordered @[simp] theorem min?_reverse (t : RBNode α) : t.reverse.min? = t.max? := by unfold RBNode.max?; split <;> simp [RBNode.min?] unfold RBNode.min?; rw [min?.match_1.eq_3] · apply min?_reverse · simpa [reverse_eq_iff] @[simp] theorem max?_reverse (t : RBNode α) : t.reverse.max? = t.min? := by rw [← min?_reverse, reverse_reverse] @[simp] theorem mem_nil {x} : ¬x ∈ (.nil : RBNode α) := by simp [(·∈·), EMem] @[simp] theorem mem_node {y c a x b} : y ∈ (.node c a x b : RBNode α) ↔ y = x ∨ y ∈ a ∨ y ∈ b := by simp [(·∈·), EMem] theorem All_def {t : RBNode α} : t.All p ↔ ∀ x ∈ t, p x := by induction t <;> simp [or_imp, forall_and, *] theorem Any_def {t : RBNode α} : t.Any p ↔ ∃ x ∈ t, p x := by induction t <;> simp [or_and_right, exists_or, *] theorem memP_def : MemP cut t ↔ ∃ x ∈ t, cut x = .eq := Any_def theorem mem_def : Mem cmp x t ↔ ∃ y ∈ t, cmp x y = .eq := Any_def theorem mem_congr [@TransCmp α cmp] {t : RBNode α} (h : cmp x y = .eq) : Mem cmp x t ↔ Mem cmp y t := by simp [Mem, TransCmp.cmp_congr_left' h]
.lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean
45
65
theorem isOrdered_iff' [@TransCmp α cmp] {t : RBNode α} : isOrdered cmp t L R ↔ (∀ a ∈ L, t.All (cmpLT cmp a ·)) ∧ (∀ a ∈ R, t.All (cmpLT cmp · a)) ∧ (∀ a ∈ L, ∀ b ∈ R, cmpLT cmp a b) ∧ Ordered cmp t := by
induction t generalizing L R with | nil => simp [isOrdered]; split <;> simp [cmpLT_iff] next h => intro _ ha _ hb; cases h _ _ ha hb | node _ l v r => simp [isOrdered, *] exact ⟨ fun ⟨⟨Ll, lv, Lv, ol⟩, ⟨vr, rR, vR, or⟩⟩ => ⟨ fun _ h => ⟨Lv _ h, Ll _ h, (Lv _ h).trans_l vr⟩, fun _ h => ⟨vR _ h, (vR _ h).trans_r lv, rR _ h⟩, fun _ hL _ hR => (Lv _ hL).trans (vR _ hR), lv, vr, ol, or⟩, fun ⟨hL, hR, _, lv, vr, ol, or⟩ => ⟨ ⟨fun _ h => (hL _ h).2.1, lv, fun _ h => (hL _ h).1, ol⟩, ⟨vr, fun _ h => (hR _ h).2.2, fun _ h => (hR _ h).1, or⟩⟩⟩
[ " t.reverse.min? = t.max?", " t.reverse.min? =\n match t with\n | nil => none\n | node c l v nil => some v\n | node c l v r => r.max?", " nil.reverse.min? = none", " (node c✝ l✝ v✝ nil).reverse.min? = some v✝", " (node c✝ l✝ v✝ r✝).reverse.min? = r✝.max?", " (node c✝ r✝.reverse v✝ l✝.reverse)....
[ " t.reverse.min? = t.max?", " t.reverse.min? =\n match t with\n | nil => none\n | node c l v nil => some v\n | node c l v r => r.max?", " nil.reverse.min? = none", " (node c✝ l✝ v✝ nil).reverse.min? = some v✝", " (node c✝ l✝ v✝ r✝).reverse.min? = r✝.max?", " (node c✝ r✝.reverse v✝ l✝.reverse)....
import Mathlib.Order.UpperLower.Basic import Mathlib.Data.Finset.Preimage #align_import combinatorics.young.young_diagram from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Function @[ext] structure YoungDiagram where cells : Finset (ℕ × ℕ) isLowerSet : IsLowerSet (cells : Set (ℕ × ℕ)) #align young_diagram YoungDiagram namespace YoungDiagram instance : SetLike YoungDiagram (ℕ × ℕ) where -- Porting note (#11215): TODO: figure out how to do this correctly coe := fun y => y.cells coe_injective' μ ν h := by rwa [YoungDiagram.ext_iff, ← Finset.coe_inj] @[simp] theorem mem_cells {μ : YoungDiagram} (c : ℕ × ℕ) : c ∈ μ.cells ↔ c ∈ μ := Iff.rfl #align young_diagram.mem_cells YoungDiagram.mem_cells @[simp] theorem mem_mk (c : ℕ × ℕ) (cells) (isLowerSet) : c ∈ YoungDiagram.mk cells isLowerSet ↔ c ∈ cells := Iff.rfl #align young_diagram.mem_mk YoungDiagram.mem_mk instance decidableMem (μ : YoungDiagram) : DecidablePred (· ∈ μ) := inferInstanceAs (DecidablePred (· ∈ μ.cells)) #align young_diagram.decidable_mem YoungDiagram.decidableMem theorem up_left_mem (μ : YoungDiagram) {i1 i2 j1 j2 : ℕ} (hi : i1 ≤ i2) (hj : j1 ≤ j2) (hcell : (i2, j2) ∈ μ) : (i1, j1) ∈ μ := μ.isLowerSet (Prod.mk_le_mk.mpr ⟨hi, hj⟩) hcell #align young_diagram.up_left_mem YoungDiagram.up_left_mem protected abbrev card (μ : YoungDiagram) : ℕ := μ.cells.card #align young_diagram.card YoungDiagram.card section Columns def col (μ : YoungDiagram) (j : ℕ) : Finset (ℕ × ℕ) := μ.cells.filter fun c => c.snd = j #align young_diagram.col YoungDiagram.col
Mathlib/Combinatorics/Young/YoungDiagram.lean
347
348
theorem mem_col_iff {μ : YoungDiagram} {j : ℕ} {c : ℕ × ℕ} : c ∈ μ.col j ↔ c ∈ μ ∧ c.snd = j := by
simp [col]
[ " μ = ν", " c ∈ μ.col j ↔ c ∈ μ ∧ c.2 = j" ]
[ " μ = ν" ]
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp]
Mathlib/SetTheory/Cardinal/Divisibility.lean
76
89
theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by
refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc
[ " IsUnit a ↔ a = 1", " a = 1 → IsUnit a", " IsUnit 1", " a = 1", " 0 = 1", " 1 ≤ a", " 1 ≤ t", " t ≠ 0", " False", " a ≤ x", " x = 0", " Prime a", " ¬IsUnit a", " ¬a = 1", " a ∣ b ∨ a ∣ c", " a ∣ 0 ∨ a ∣ c", " a ∣ b ∨ a ∣ 0", " a ∣ c ∨ a ∣ b", " b ≤ c", " c * b ≠ 0", " a ∣ c ...
[ " IsUnit a ↔ a = 1", " a = 1 → IsUnit a", " IsUnit 1", " a = 1", " 0 = 1", " 1 ≤ a", " 1 ≤ t", " t ≠ 0", " False", " a ≤ x", " x = 0" ]
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] 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] #align finsupp.to_dfinsupp_single Finsupp.toDFinsupp_single variable [∀ m : M, Decidable (m ≠ 0)] @[simp] theorem toDFinsupp_support (f : ι →₀ M) : f.toDFinsupp.support = f.support := by ext simp #align to_dfinsupp_support toDFinsupp_support def DFinsupp.toFinsupp (f : Π₀ _ : ι, M) : ι →₀ M := ⟨f.support, f, fun i => by simp only [DFinsupp.mem_support_iff]⟩ #align dfinsupp.to_finsupp DFinsupp.toFinsupp @[simp] theorem DFinsupp.toFinsupp_coe (f : Π₀ _ : ι, M) : ⇑f.toFinsupp = f := rfl #align dfinsupp.to_finsupp_coe DFinsupp.toFinsupp_coe @[simp]
Mathlib/Data/Finsupp/ToDFinsupp.lean
117
119
theorem DFinsupp.toFinsupp_support (f : Π₀ _ : ι, M) : f.toFinsupp.support = f.support := by
ext simp
[ " (single i m).toDFinsupp = DFinsupp.single i m", " (single i m).toDFinsupp i✝ = (DFinsupp.single i m) i✝", " f.toDFinsupp.support = f.support", " a✝ ∈ f.toDFinsupp.support ↔ a✝ ∈ f.support", " i ∈ f.support ↔ f i ≠ 0", " f.toFinsupp.support = f.support", " a✝ ∈ f.toFinsupp.support ↔ a✝ ∈ f.support" ]
[ " (single i m).toDFinsupp = DFinsupp.single i m", " (single i m).toDFinsupp i✝ = (DFinsupp.single i m) i✝", " f.toDFinsupp.support = f.support", " a✝ ∈ f.toDFinsupp.support ↔ a✝ ∈ f.support", " i ∈ f.support ↔ f i ≠ 0" ]
import Mathlib.MeasureTheory.Measure.Restrict #align_import measure_theory.measure.mutually_singular from "leanprover-community/mathlib"@"70a4f2197832bceab57d7f41379b2592d1110570" open Set open MeasureTheory NNReal ENNReal namespace MeasureTheory namespace Measure variable {α : Type*} {m0 : MeasurableSpace α} {μ μ₁ μ₂ ν ν₁ ν₂ : Measure α} def MutuallySingular {_ : MeasurableSpace α} (μ ν : Measure α) : Prop := ∃ s : Set α, MeasurableSet s ∧ μ s = 0 ∧ ν sᶜ = 0 #align measure_theory.measure.mutually_singular MeasureTheory.Measure.MutuallySingular @[inherit_doc MeasureTheory.Measure.MutuallySingular] scoped[MeasureTheory] infixl:60 " ⟂ₘ " => MeasureTheory.Measure.MutuallySingular namespace MutuallySingular theorem mk {s t : Set α} (hs : μ s = 0) (ht : ν t = 0) (hst : univ ⊆ s ∪ t) : MutuallySingular μ ν := by use toMeasurable μ s, measurableSet_toMeasurable _ _, (measure_toMeasurable _).trans hs refine measure_mono_null (fun x hx => (hst trivial).resolve_left fun hxs => hx ?_) ht exact subset_toMeasurable _ _ hxs #align measure_theory.measure.mutually_singular.mk MeasureTheory.Measure.MutuallySingular.mk def nullSet (h : μ ⟂ₘ ν) : Set α := h.choose lemma measurableSet_nullSet (h : μ ⟂ₘ ν) : MeasurableSet h.nullSet := h.choose_spec.1 @[simp] lemma measure_nullSet (h : μ ⟂ₘ ν) : μ h.nullSet = 0 := h.choose_spec.2.1 @[simp] lemma measure_compl_nullSet (h : μ ⟂ₘ ν) : ν h.nullSetᶜ = 0 := h.choose_spec.2.2 -- TODO: this is proved by simp, but is not simplified in other contexts without the @[simp] -- attribute. Also, the linter does not complain about that attribute. @[simp] lemma restrict_nullSet (h : μ ⟂ₘ ν) : μ.restrict h.nullSet = 0 := by simp -- TODO: this is proved by simp, but is not simplified in other contexts without the @[simp] -- attribute. Also, the linter does not complain about that attribute. @[simp] lemma restrict_compl_nullSet (h : μ ⟂ₘ ν) : ν.restrict h.nullSetᶜ = 0 := by simp @[simp] theorem zero_right : μ ⟂ₘ 0 := ⟨∅, MeasurableSet.empty, measure_empty, rfl⟩ #align measure_theory.measure.mutually_singular.zero_right MeasureTheory.Measure.MutuallySingular.zero_right @[symm] theorem symm (h : ν ⟂ₘ μ) : μ ⟂ₘ ν := let ⟨i, hi, his, hit⟩ := h ⟨iᶜ, hi.compl, hit, (compl_compl i).symm ▸ his⟩ #align measure_theory.measure.mutually_singular.symm MeasureTheory.Measure.MutuallySingular.symm theorem comm : μ ⟂ₘ ν ↔ ν ⟂ₘ μ := ⟨fun h => h.symm, fun h => h.symm⟩ #align measure_theory.measure.mutually_singular.comm MeasureTheory.Measure.MutuallySingular.comm @[simp] theorem zero_left : 0 ⟂ₘ μ := zero_right.symm #align measure_theory.measure.mutually_singular.zero_left MeasureTheory.Measure.MutuallySingular.zero_left theorem mono_ac (h : μ₁ ⟂ₘ ν₁) (hμ : μ₂ ≪ μ₁) (hν : ν₂ ≪ ν₁) : μ₂ ⟂ₘ ν₂ := let ⟨s, hs, h₁, h₂⟩ := h ⟨s, hs, hμ h₁, hν h₂⟩ #align measure_theory.measure.mutually_singular.mono_ac MeasureTheory.Measure.MutuallySingular.mono_ac theorem mono (h : μ₁ ⟂ₘ ν₁) (hμ : μ₂ ≤ μ₁) (hν : ν₂ ≤ ν₁) : μ₂ ⟂ₘ ν₂ := h.mono_ac hμ.absolutelyContinuous hν.absolutelyContinuous #align measure_theory.measure.mutually_singular.mono MeasureTheory.Measure.MutuallySingular.mono @[simp] lemma self_iff (μ : Measure α) : μ ⟂ₘ μ ↔ μ = 0 := by refine ⟨?_, fun h ↦ by (rw [h]; exact zero_left)⟩ rintro ⟨s, hs, hμs, hμs_compl⟩ suffices μ Set.univ = 0 by rwa [measure_univ_eq_zero] at this rw [← Set.union_compl_self s, measure_union disjoint_compl_right hs.compl, hμs, hμs_compl, add_zero] @[simp] theorem sum_left {ι : Type*} [Countable ι] {μ : ι → Measure α} : sum μ ⟂ₘ ν ↔ ∀ i, μ i ⟂ₘ ν := by refine ⟨fun h i => h.mono (le_sum _ _) le_rfl, fun H => ?_⟩ choose s hsm hsμ hsν using H refine ⟨⋂ i, s i, MeasurableSet.iInter hsm, ?_, ?_⟩ · rw [sum_apply _ (MeasurableSet.iInter hsm), ENNReal.tsum_eq_zero] exact fun i => measure_mono_null (iInter_subset _ _) (hsμ i) · rwa [compl_iInter, measure_iUnion_null_iff] #align measure_theory.measure.mutually_singular.sum_left MeasureTheory.Measure.MutuallySingular.sum_left @[simp] theorem sum_right {ι : Type*} [Countable ι] {ν : ι → Measure α} : μ ⟂ₘ sum ν ↔ ∀ i, μ ⟂ₘ ν i := comm.trans <| sum_left.trans <| forall_congr' fun _ => comm #align measure_theory.measure.mutually_singular.sum_right MeasureTheory.Measure.MutuallySingular.sum_right @[simp]
Mathlib/MeasureTheory/Measure/MutuallySingular.lean
129
130
theorem add_left_iff : μ₁ + μ₂ ⟂ₘ ν ↔ μ₁ ⟂ₘ ν ∧ μ₂ ⟂ₘ ν := by
rw [← sum_cond, sum_left, Bool.forall_bool, cond, cond, and_comm]
[ " μ ⟂ₘ ν", " ν (toMeasurable μ s)ᶜ = 0", " x ∈ toMeasurable μ s", " μ.restrict h.nullSet = 0", " ν.restrict h.nullSetᶜ = 0", " μ ⟂ₘ μ ↔ μ = 0", " μ ⟂ₘ μ", " 0 ⟂ₘ 0", " μ ⟂ₘ μ → μ = 0", " μ = 0", " μ univ = 0", " sum μ ⟂ₘ ν ↔ ∀ (i : ι), μ i ⟂ₘ ν", " sum μ ⟂ₘ ν", " (sum μ) (⋂ i, s i) = 0", ...
[ " μ ⟂ₘ ν", " ν (toMeasurable μ s)ᶜ = 0", " x ∈ toMeasurable μ s", " μ.restrict h.nullSet = 0", " ν.restrict h.nullSetᶜ = 0", " μ ⟂ₘ μ ↔ μ = 0", " μ ⟂ₘ μ", " 0 ⟂ₘ 0", " μ ⟂ₘ μ → μ = 0", " μ = 0", " μ univ = 0", " sum μ ⟂ₘ ν ↔ ∀ (i : ι), μ i ⟂ₘ ν", " sum μ ⟂ₘ ν", " (sum μ) (⋂ i, s i) = 0", ...
import Mathlib.Topology.PartialHomeomorph import Mathlib.Topology.SeparatedMap #align_import topology.is_locally_homeomorph from "leanprover-community/mathlib"@"e97cf15cd1aec9bd5c193b2ffac5a6dc9118912b" open Topology variable {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] (g : Y → Z) (f : X → Y) (s : Set X) (t : Set Y) def IsLocalHomeomorphOn := ∀ x ∈ s, ∃ e : PartialHomeomorph X Y, x ∈ e.source ∧ f = e #align is_locally_homeomorph_on IsLocalHomeomorphOn
Mathlib/Topology/IsLocalHomeomorph.lean
45
59
theorem isLocalHomeomorphOn_iff_openEmbedding_restrict {f : X → Y} : IsLocalHomeomorphOn f s ↔ ∀ x ∈ s, ∃ U ∈ 𝓝 x, OpenEmbedding (U.restrict f) := by
refine ⟨fun h x hx ↦ ?_, fun h x hx ↦ ?_⟩ · obtain ⟨e, hxe, rfl⟩ := h x hx exact ⟨e.source, e.open_source.mem_nhds hxe, e.openEmbedding_restrict⟩ · obtain ⟨U, hU, emb⟩ := h x hx have : OpenEmbedding ((interior U).restrict f) := by refine emb.comp ⟨embedding_inclusion interior_subset, ?_⟩ rw [Set.range_inclusion]; exact isOpen_induced isOpen_interior obtain ⟨cont, inj, openMap⟩ := openEmbedding_iff_continuous_injective_open.mp this haveI : Nonempty X := ⟨x⟩ exact ⟨PartialHomeomorph.ofContinuousOpenRestrict (Set.injOn_iff_injective.mpr inj).toPartialEquiv (continuousOn_iff_continuous_restrict.mpr cont) openMap isOpen_interior, mem_interior_iff_mem_nhds.mpr hU, rfl⟩
[ " IsLocalHomeomorphOn f s ↔ ∀ x ∈ s, ∃ U ∈ 𝓝 x, OpenEmbedding (U.restrict f)", " ∃ U ∈ 𝓝 x, OpenEmbedding (U.restrict f)", " ∃ U ∈ 𝓝 x, OpenEmbedding (U.restrict ↑e)", " ∃ e, x ∈ e.source ∧ f = ↑e", " OpenEmbedding ((interior U).restrict f)", " IsOpen (Set.range (Set.inclusion ⋯))", " IsOpen {x | ↑x ...
[]
import Mathlib.Algebra.Algebra.Bilinear import Mathlib.RingTheory.Localization.Basic #align_import algebra.module.localized_module from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" namespace LocalizedModule universe u v variable {R : Type u} [CommSemiring R] (S : Submonoid R) variable (M : Type v) [AddCommMonoid M] [Module R M] variable (T : Type*) [CommSemiring T] [Algebra R T] [IsLocalization S T] def r (a b : M × S) : Prop := ∃ u : S, u • b.2 • a.1 = u • a.2 • b.1 #align localized_module.r LocalizedModule.r theorem r.isEquiv : IsEquiv _ (r S M) := { refl := fun ⟨m, s⟩ => ⟨1, by rw [one_smul]⟩ trans := fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨m3, s3⟩ ⟨u1, hu1⟩ ⟨u2, hu2⟩ => by use u1 * u2 * s2 -- Put everything in the same shape, sorting the terms using `simp` have hu1' := congr_arg ((u2 * s3) • ·) hu1.symm have hu2' := congr_arg ((u1 * s1) • ·) hu2.symm simp only [← mul_smul, smul_assoc, mul_assoc, mul_comm, mul_left_comm] at hu1' hu2' ⊢ rw [hu2', hu1'] symm := fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => ⟨u, hu.symm⟩ } #align localized_module.r.is_equiv LocalizedModule.r.isEquiv instance r.setoid : Setoid (M × S) where r := r S M iseqv := ⟨(r.isEquiv S M).refl, (r.isEquiv S M).symm _ _, (r.isEquiv S M).trans _ _ _⟩ #align localized_module.r.setoid LocalizedModule.r.setoid -- TODO: change `Localization` to use `r'` instead of `r` so that the two types are also defeq, -- `Localization S = LocalizedModule S R`. example {R} [CommSemiring R] (S : Submonoid R) : ⇑(Localization.r' S) = LocalizedModule.r S R := rfl -- Porting note(#5171): @[nolint has_nonempty_instance] def _root_.LocalizedModule : Type max u v := Quotient (r.setoid S M) #align localized_module LocalizedModule section variable {M S} def mk (m : M) (s : S) : LocalizedModule S M := Quotient.mk' ⟨m, s⟩ #align localized_module.mk LocalizedModule.mk theorem mk_eq {m m' : M} {s s' : S} : mk m s = mk m' s' ↔ ∃ u : S, u • s' • m = u • s • m' := Quotient.eq' #align localized_module.mk_eq LocalizedModule.mk_eq @[elab_as_elim] theorem induction_on {β : LocalizedModule S M → Prop} (h : ∀ (m : M) (s : S), β (mk m s)) : ∀ x : LocalizedModule S M, β x := by rintro ⟨⟨m, s⟩⟩ exact h m s #align localized_module.induction_on LocalizedModule.induction_on @[elab_as_elim]
Mathlib/Algebra/Module/LocalizedModule.lean
106
109
theorem induction_on₂ {β : LocalizedModule S M → LocalizedModule S M → Prop} (h : ∀ (m m' : M) (s s' : S), β (mk m s) (mk m' s')) : ∀ x y, β x y := by
rintro ⟨⟨m, s⟩⟩ ⟨⟨m', s'⟩⟩ exact h m m' s s'
[ " 1 • (m, s).2 • (m, s).1 = 1 • (m, s).2 • (m, s).1", " r S M (m1, s1) (m3, s3)", " (u1 * u2 * s2) • (m3, s3).2 • (m1, s1).1 = (u1 * u2 * s2) • (m1, s1).2 • (m3, s3).1", " (s2 * (s3 * (u1 * u2))) • m1 = (s1 * (s2 * (u1 * u2))) • m3", " ∀ (x : LocalizedModule S M), β x", " β (Quot.mk Setoid.r (m, s))", "...
[ " 1 • (m, s).2 • (m, s).1 = 1 • (m, s).2 • (m, s).1", " r S M (m1, s1) (m3, s3)", " (u1 * u2 * s2) • (m3, s3).2 • (m1, s1).1 = (u1 * u2 * s2) • (m1, s1).2 • (m3, s3).1", " (s2 * (s3 * (u1 * u2))) • m1 = (s1 * (s2 * (u1 * u2))) • m3", " ∀ (x : LocalizedModule S M), β x", " β (Quot.mk Setoid.r (m, s))" ]
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 TransvectionStruct variable {R n} def toMatrix (t : TransvectionStruct n R) : Matrix n n R := transvection t.i t.j t.c #align matrix.transvection_struct.to_matrix Matrix.TransvectionStruct.toMatrix @[simp] theorem toMatrix_mk (i j : n) (hij : i ≠ j) (c : R) : TransvectionStruct.toMatrix ⟨i, j, hij, c⟩ = transvection i j c := rfl #align matrix.transvection_struct.to_matrix_mk Matrix.TransvectionStruct.toMatrix_mk @[simp] protected theorem det [Fintype n] (t : TransvectionStruct n R) : det t.toMatrix = 1 := det_transvection_of_ne _ _ t.hij _ #align matrix.transvection_struct.det Matrix.TransvectionStruct.det @[simp]
Mathlib/LinearAlgebra/Matrix/Transvection.lean
184
188
theorem det_toMatrix_prod [Fintype n] (L : List (TransvectionStruct n 𝕜)) : det (L.map toMatrix).prod = 1 := by
induction' L with t L IH · simp · simp [IH]
[ " 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 Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {φ : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (∃ n : ℕ, coeff R n φ ≠ 0) ↔ φ ≠ 0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (φ : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : φ = 0 then ⊤ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊤ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order φ).Dom ↔ φ ≠ 0 := by simp only [order] constructor · split_ifs with h <;> intro H · simp only [PartENat.top_eq_none, Part.not_none_dom] at H · exact h · intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order φ).Dom) : coeff R (φ.order.get h) φ ≠ 0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order theorem order_le (n : ℕ) (h : coeff R n φ ≠ 0) : order φ ≤ n := by classical rw [order, dif_neg] · simp only [PartENat.coe_le_coe] exact Nat.find_le h · exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩ #align power_series.order_le PowerSeries.order_le theorem coeff_of_lt_order (n : ℕ) (h : ↑n < order φ) : coeff R n φ = 0 := by contrapose! h exact order_le _ h #align power_series.coeff_of_lt_order PowerSeries.coeff_of_lt_order @[simp] theorem order_eq_top {φ : R⟦X⟧} : φ.order = ⊤ ↔ φ = 0 := PartENat.not_dom_iff_eq_top.symm.trans order_finite_iff_ne_zero.not_left #align power_series.order_eq_top PowerSeries.order_eq_top theorem nat_le_order (φ : R⟦X⟧) (n : ℕ) (h : ∀ i < n, coeff R i φ = 0) : ↑n ≤ order φ := by by_contra H; rw [not_le] at H have : (order φ).Dom := PartENat.dom_of_le_natCast H.le rw [← PartENat.natCast_get this, PartENat.coe_lt_coe] at H exact coeff_order this (h _ H) #align power_series.nat_le_order PowerSeries.nat_le_order theorem le_order (φ : R⟦X⟧) (n : PartENat) (h : ∀ i : ℕ, ↑i < n → coeff R i φ = 0) : n ≤ order φ := by induction n using PartENat.casesOn · show _ ≤ _ rw [top_le_iff, order_eq_top] ext i exact h _ (PartENat.natCast_lt_top i) · apply nat_le_order simpa only [PartENat.coe_lt_coe] using h #align power_series.le_order PowerSeries.le_order theorem order_eq_nat {φ : R⟦X⟧} {n : ℕ} : order φ = n ↔ coeff R n φ ≠ 0 ∧ ∀ i, i < n → coeff R i φ = 0 := by classical rcases eq_or_ne φ 0 with (rfl | hφ) · simpa [(coeff R _).map_zero] using (PartENat.natCast_ne_top _).symm simp [order, dif_neg hφ, Nat.find_eq_iff] #align power_series.order_eq_nat PowerSeries.order_eq_nat theorem order_eq {φ : R⟦X⟧} {n : PartENat} : order φ = n ↔ (∀ i : ℕ, ↑i = n → coeff R i φ ≠ 0) ∧ ∀ i : ℕ, ↑i < n → coeff R i φ = 0 := by induction n using PartENat.casesOn · rw [order_eq_top] constructor · rintro rfl constructor <;> intros · exfalso exact PartENat.natCast_ne_top ‹_› ‹_› · exact (coeff _ _).map_zero · rintro ⟨_h₁, h₂⟩ ext i exact h₂ i (PartENat.natCast_lt_top i) · simpa [PartENat.natCast_inj] using order_eq_nat #align power_series.order_eq PowerSeries.order_eq
Mathlib/RingTheory/PowerSeries/Order.lean
162
164
theorem le_order_add (φ ψ : R⟦X⟧) : min (order φ) (order ψ) ≤ order (φ + ψ) := by
refine le_order _ _ ?_ simp (config := { contextual := true }) [coeff_of_lt_order]
[ " (∃ n, (coeff R n) φ ≠ 0) ↔ φ ≠ 0", " (¬∃ n, (coeff R n) φ ≠ 0) ↔ ¬φ ≠ 0", " (∀ (n : ℕ), (coeff R n) φ = 0) ↔ φ = 0", " φ.order.Dom ↔ φ ≠ 0", " (if h : φ = 0 then ⊤ else ↑(Nat.find ⋯)).Dom ↔ φ ≠ 0", " (if h : φ = 0 then ⊤ else ↑(Nat.find ⋯)).Dom → φ ≠ 0", " ⊤.Dom → φ ≠ 0", " (↑(Nat.find ⋯)).Dom → φ ≠...
[ " (∃ n, (coeff R n) φ ≠ 0) ↔ φ ≠ 0", " (¬∃ n, (coeff R n) φ ≠ 0) ↔ ¬φ ≠ 0", " (∀ (n : ℕ), (coeff R n) φ = 0) ↔ φ = 0", " φ.order.Dom ↔ φ ≠ 0", " (if h : φ = 0 then ⊤ else ↑(Nat.find ⋯)).Dom ↔ φ ≠ 0", " (if h : φ = 0 then ⊤ else ↑(Nat.find ⋯)).Dom → φ ≠ 0", " ⊤.Dom → φ ≠ 0", " (↑(Nat.find ⋯)).Dom → φ ≠...
import Mathlib.Algebra.Order.Group.Abs import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax #align_import algebra.order.group.min_max from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" section variable {α : Type*} [Group α] [LinearOrder α] [CovariantClass α α (· * ·) (· ≤ ·)] -- TODO: This duplicates `oneLePart_div_leOnePart` @[to_additive (attr := simp)]
Mathlib/Algebra/Order/Group/MinMax.lean
22
23
theorem max_one_div_max_inv_one_eq_self (a : α) : max a 1 / max a⁻¹ 1 = a := by
rcases le_total a 1 with (h | h) <;> simp [h]
[ " max a 1 / max a⁻¹ 1 = a" ]
[]
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := ∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
37
39
theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by
simp (config := { contextual := true }) [scaleRoots, coeff_monomial]
[ " (p.scaleRoots s).coeff i = p.coeff i * s ^ (p.natDegree - i)" ]
[]
import Mathlib.Algebra.Lie.Nilpotent import Mathlib.Algebra.Lie.Normalizer #align_import algebra.lie.cartan_subalgebra from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102" universe u v w w₁ w₂ variable {R : Type u} {L : Type v} variable [CommRing R] [LieRing L] [LieAlgebra R L] (H : LieSubalgebra R L) def LieSubmodule.IsUcsLimit {M : Type*} [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] (N : LieSubmodule R L M) : Prop := ∃ k, ∀ l, k ≤ l → (⊥ : LieSubmodule R L M).ucs l = N #align lie_submodule.is_ucs_limit LieSubmodule.IsUcsLimit namespace LieSubalgebra class IsCartanSubalgebra : Prop where nilpotent : LieAlgebra.IsNilpotent R H self_normalizing : H.normalizer = H #align lie_subalgebra.is_cartan_subalgebra LieSubalgebra.IsCartanSubalgebra instance [H.IsCartanSubalgebra] : LieAlgebra.IsNilpotent R H := IsCartanSubalgebra.nilpotent @[simp]
Mathlib/Algebra/Lie/CartanSubalgebra.lean
58
61
theorem normalizer_eq_self_of_isCartanSubalgebra (H : LieSubalgebra R L) [H.IsCartanSubalgebra] : H.toLieSubmodule.normalizer = H.toLieSubmodule := by
rw [← LieSubmodule.coe_toSubmodule_eq_iff, coe_normalizer_eq_normalizer, IsCartanSubalgebra.self_normalizing, coe_toLieSubmodule]
[ " H.toLieSubmodule.normalizer = H.toLieSubmodule" ]
[]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 · rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 · rw [hq, mul_zero, trailingDegree_zero, add_top] · rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : ℕ) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 · obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q ≠ 0) : degree p ≤ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q ≠ 0) : p.natDegree ≤ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q ≠ 0) : degree p ≤ degree q := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2 #align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (h₂ : degree q < degree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp h₂ (degree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_degree_lt Polynomial.eq_zero_of_dvd_of_degree_lt theorem eq_zero_of_dvd_of_natDegree_lt {p q : R[X]} (h₁ : p ∣ q) (h₂ : natDegree q < natDegree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp h₂ (natDegree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_nat_degree_lt Polynomial.eq_zero_of_dvd_of_natDegree_lt
Mathlib/Algebra/Polynomial/RingDivision.lean
178
180
theorem not_dvd_of_degree_lt {p q : R[X]} (h0 : q ≠ 0) (hl : q.degree < p.degree) : ¬p ∣ q := by
by_contra hcontra exact h0 (eq_zero_of_dvd_of_degree_lt hcontra hl)
[ " a✝ = 0 ∨ b✝ = 0", " a✝.leadingCoeff = 0 ∨ b✝.leadingCoeff = 0", " a✝.leadingCoeff * b✝.leadingCoeff = 0", " (p * q).natDegree = p.natDegree + q.natDegree", " (p * q).trailingDegree = p.trailingDegree + q.trailingDegree", " ↑(p.natTrailingDegree + q.natTrailingDegree) = ↑p.natTrailingDegree + ↑q.natTrail...
[ " a✝ = 0 ∨ b✝ = 0", " a✝.leadingCoeff = 0 ∨ b✝.leadingCoeff = 0", " a✝.leadingCoeff * b✝.leadingCoeff = 0", " (p * q).natDegree = p.natDegree + q.natDegree", " (p * q).trailingDegree = p.trailingDegree + q.trailingDegree", " ↑(p.natTrailingDegree + q.natTrailingDegree) = ↑p.natTrailingDegree + ↑q.natTrail...
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 𝕜} section Mul variable {𝕜' 𝔸 : Type*} [NormedField 𝕜'] [NormedRing 𝔸] [NormedAlgebra 𝕜 𝕜'] [NormedAlgebra 𝕜 𝔸] {c d : 𝕜 → 𝔸} {c' d' : 𝔸} {u v : 𝕜 → 𝕜'} theorem HasDerivWithinAt.mul (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x) : HasDerivWithinAt (fun y => c y * d y) (c' * d x + c x * d') s x := by have := (HasFDerivWithinAt.mul' hc hd).hasDerivWithinAt rwa [ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, one_smul, one_smul, add_comm] at this #align has_deriv_within_at.mul HasDerivWithinAt.mul
Mathlib/Analysis/Calculus/Deriv/Mul.lean
215
218
theorem HasDerivAt.mul (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) : HasDerivAt (fun y => c y * d y) (c' * d x + c x * d') x := by
rw [← hasDerivWithinAt_univ] at * exact hc.mul hd
[ " HasDerivWithinAt (fun y => c y * d y) (c' * d x + c x * d') s x", " HasDerivAt (fun y => c y * d y) (c' * d x + c x * d') x", " HasDerivWithinAt (fun y => c y * d y) (c' * d x + c x * d') univ x" ]
[ " HasDerivWithinAt (fun y => c y * d y) (c' * d x + c x * d') s x" ]
import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Nat.Factors import Mathlib.Order.Interval.Finset.Nat #align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open scoped Classical open Finset namespace Nat variable (n : ℕ) def divisors : Finset ℕ := Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 (n + 1)) #align nat.divisors Nat.divisors def properDivisors : Finset ℕ := Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 n) #align nat.proper_divisors Nat.properDivisors def divisorsAntidiagonal : Finset (ℕ × ℕ) := Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ×ˢ Ico 1 (n + 1)) #align nat.divisors_antidiagonal Nat.divisorsAntidiagonal variable {n} @[simp] theorem filter_dvd_eq_divisors (h : n ≠ 0) : (Finset.range n.succ).filter (· ∣ n) = n.divisors := by ext simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self] exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt) #align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors @[simp] theorem filter_dvd_eq_properDivisors (h : n ≠ 0) : (Finset.range n).filter (· ∣ n) = n.properDivisors := by ext simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self] exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt) #align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors theorem properDivisors.not_self_mem : ¬n ∈ properDivisors n := by simp [properDivisors] #align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem @[simp] theorem mem_properDivisors {m : ℕ} : n ∈ properDivisors m ↔ n ∣ m ∧ n < m := by rcases eq_or_ne m 0 with (rfl | hm); · simp [properDivisors] simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range] #align nat.mem_proper_divisors Nat.mem_properDivisors theorem insert_self_properDivisors (h : n ≠ 0) : insert n (properDivisors n) = divisors n := by rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h), Finset.filter_insert, if_pos (dvd_refl n)] #align nat.insert_self_proper_divisors Nat.insert_self_properDivisors theorem cons_self_properDivisors (h : n ≠ 0) : cons n (properDivisors n) properDivisors.not_self_mem = divisors n := by rw [cons_eq_insert, insert_self_properDivisors h] #align nat.cons_self_proper_divisors Nat.cons_self_properDivisors @[simp] theorem mem_divisors {m : ℕ} : n ∈ divisors m ↔ n ∣ m ∧ m ≠ 0 := by rcases eq_or_ne m 0 with (rfl | hm); · simp [divisors] simp only [hm, Ne, not_false_iff, and_true_iff, ← filter_dvd_eq_divisors hm, mem_filter, mem_range, and_iff_right_iff_imp, Nat.lt_succ_iff] exact le_of_dvd hm.bot_lt #align nat.mem_divisors Nat.mem_divisors theorem one_mem_divisors : 1 ∈ divisors n ↔ n ≠ 0 := by simp #align nat.one_mem_divisors Nat.one_mem_divisors theorem mem_divisors_self (n : ℕ) (h : n ≠ 0) : n ∈ n.divisors := mem_divisors.2 ⟨dvd_rfl, h⟩ #align nat.mem_divisors_self Nat.mem_divisors_self theorem dvd_of_mem_divisors {m : ℕ} (h : n ∈ divisors m) : n ∣ m := by cases m · apply dvd_zero · simp [mem_divisors.1 h] #align nat.dvd_of_mem_divisors Nat.dvd_of_mem_divisors @[simp] theorem mem_divisorsAntidiagonal {x : ℕ × ℕ} : x ∈ divisorsAntidiagonal n ↔ x.fst * x.snd = n ∧ n ≠ 0 := by simp only [divisorsAntidiagonal, Finset.mem_Ico, Ne, Finset.mem_filter, Finset.mem_product] rw [and_comm] apply and_congr_right rintro rfl constructor <;> intro h · contrapose! h simp [h] · rw [Nat.lt_add_one_iff, Nat.lt_add_one_iff] rw [mul_eq_zero, not_or] at h simp only [succ_le_of_lt (Nat.pos_of_ne_zero h.1), succ_le_of_lt (Nat.pos_of_ne_zero h.2), true_and_iff] exact ⟨Nat.le_mul_of_pos_right _ (Nat.pos_of_ne_zero h.2), Nat.le_mul_of_pos_left _ (Nat.pos_of_ne_zero h.1)⟩ #align nat.mem_divisors_antidiagonal Nat.mem_divisorsAntidiagonal lemma ne_zero_of_mem_divisorsAntidiagonal {p : ℕ × ℕ} (hp : p ∈ n.divisorsAntidiagonal) : p.1 ≠ 0 ∧ p.2 ≠ 0 := by obtain ⟨hp₁, hp₂⟩ := Nat.mem_divisorsAntidiagonal.mp hp exact mul_ne_zero_iff.mp (hp₁.symm ▸ hp₂) lemma left_ne_zero_of_mem_divisorsAntidiagonal {p : ℕ × ℕ} (hp : p ∈ n.divisorsAntidiagonal) : p.1 ≠ 0 := (ne_zero_of_mem_divisorsAntidiagonal hp).1 lemma right_ne_zero_of_mem_divisorsAntidiagonal {p : ℕ × ℕ} (hp : p ∈ n.divisorsAntidiagonal) : p.2 ≠ 0 := (ne_zero_of_mem_divisorsAntidiagonal hp).2
Mathlib/NumberTheory/Divisors.lean
147
151
theorem divisor_le {m : ℕ} : n ∈ divisors m → n ≤ m := by
cases' m with m · simp · simp only [mem_divisors, Nat.succ_ne_zero m, and_true_iff, Ne, not_false_iff] exact Nat.le_of_dvd (Nat.succ_pos m)
[ " filter (fun x => x ∣ n) (range n.succ) = n.divisors", " a✝ ∈ filter (fun x => x ∣ n) (range n.succ) ↔ a✝ ∈ n.divisors", " a✝ ∣ n → a✝ < n.succ → 1 ≤ a✝", " filter (fun x => x ∣ n) (range n) = n.properDivisors", " a✝ ∈ filter (fun x => x ∣ n) (range n) ↔ a✝ ∈ n.properDivisors", " a✝ ∣ n → a✝ < n → 1 ≤ a✝...
[ " filter (fun x => x ∣ n) (range n.succ) = n.divisors", " a✝ ∈ filter (fun x => x ∣ n) (range n.succ) ↔ a✝ ∈ n.divisors", " a✝ ∣ n → a✝ < n.succ → 1 ≤ a✝", " filter (fun x => x ∣ n) (range n) = n.properDivisors", " a✝ ∈ filter (fun x => x ∣ n) (range n) ↔ a✝ ∈ n.properDivisors", " a✝ ∣ n → a✝ < n → 1 ≤ a✝...
import Mathlib.Analysis.SpecialFunctions.PolarCoord import Mathlib.Analysis.SpecialFunctions.Gamma.Basic open Real Set MeasureTheory MeasureTheory.Measure section real theorem integral_rpow_mul_exp_neg_rpow {p q : ℝ} (hp : 0 < p) (hq : - 1 < q) : ∫ x in Ioi (0:ℝ), x ^ q * exp (- x ^ p) = (1 / p) * Gamma ((q + 1) / p) := by calc _ = ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * exp (-x)) := by rw [← integral_comp_rpow_Ioi _ (one_div_ne_zero (ne_of_gt hp)), abs_eq_self.mpr (le_of_lt (one_div_pos.mpr hp))] refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_) rw [← rpow_mul (le_of_lt hx) _ p, one_div_mul_cancel (ne_of_gt hp), rpow_one] _ = ∫ (x : ℝ) in Ioi 0, 1 / p * exp (-x) * x ^ (1 / p - 1 + q / p) := by simp_rw [smul_eq_mul, mul_assoc] refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_) rw [← rpow_mul (le_of_lt hx), div_mul_eq_mul_div, one_mul, rpow_add hx] ring_nf _ = (1 / p) * Gamma ((q + 1) / p) := by rw [Gamma_eq_integral (div_pos (neg_lt_iff_pos_add.mp hq) hp)] simp_rw [show 1 / p - 1 + q / p = (q + 1) / p - 1 by field_simp; ring, ← integral_mul_left, ← mul_assoc]
Mathlib/MeasureTheory/Integral/Gamma.lean
39
57
theorem integral_rpow_mul_exp_neg_mul_rpow {p q b : ℝ} (hp : 0 < p) (hq : - 1 < q) (hb : 0 < b) : ∫ x in Ioi (0:ℝ), x ^ q * exp (- b * x ^ p) = b ^ (-(q + 1) / p) * (1 / p) * Gamma ((q + 1) / p) := by
calc _ = ∫ x in Ioi (0:ℝ), b ^ (-p⁻¹ * q) * ((b ^ p⁻¹ * x) ^ q * rexp (-(b ^ p⁻¹ * x) ^ p)) := by refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_) rw [mul_rpow _ (le_of_lt hx), mul_rpow _ (le_of_lt hx), ← rpow_mul, ← rpow_mul, inv_mul_cancel, rpow_one, mul_assoc, ← mul_assoc, ← rpow_add, neg_mul p⁻¹, add_left_neg, rpow_zero, one_mul, neg_mul] all_goals positivity _ = (b ^ p⁻¹)⁻¹ * ∫ x in Ioi (0:ℝ), b ^ (-p⁻¹ * q) * (x ^ q * rexp (-x ^ p)) := by rw [integral_comp_mul_left_Ioi (fun x => b ^ (-p⁻¹ * q) * (x ^ q * exp (- x ^ p))) 0, mul_zero, smul_eq_mul] all_goals positivity _ = b ^ (-(q + 1) / p) * (1 / p) * Gamma ((q + 1) / p) := by rw [integral_mul_left, integral_rpow_mul_exp_neg_rpow _ hq, mul_assoc, ← mul_assoc, ← rpow_neg_one, ← rpow_mul, ← rpow_add] · congr; ring all_goals positivity
[ " ∫ (x : ℝ) in Ioi 0, x ^ q * rexp (-x ^ p) = 1 / p * ((q + 1) / p).Gamma", " ∫ (x : ℝ) in Ioi 0, x ^ q * rexp (-x ^ p) =\n ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * rexp (-x))", " ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * rexp (-(x ^ (1 / p)) ^ p)) =\n ...
[ " ∫ (x : ℝ) in Ioi 0, x ^ q * rexp (-x ^ p) = 1 / p * ((q + 1) / p).Gamma", " ∫ (x : ℝ) in Ioi 0, x ^ q * rexp (-x ^ p) =\n ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * rexp (-x))", " ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * rexp (-(x ^ (1 / p)) ^ p)) =\n ...
import Mathlib.Data.List.Sublists import Mathlib.Data.Multiset.Bind #align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {α : Type*} -- Porting note (#11215): TODO: Write a more efficient version def powersetAux (l : List α) : List (Multiset α) := (sublists l).map (↑) #align multiset.powerset_aux Multiset.powersetAux theorem powersetAux_eq_map_coe {l : List α} : powersetAux l = (sublists l).map (↑) := rfl #align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe @[simp] theorem mem_powersetAux {l : List α} {s} : s ∈ powersetAux l ↔ s ≤ ↑l := Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm] #align multiset.mem_powerset_aux Multiset.mem_powersetAux def powersetAux' (l : List α) : List (Multiset α) := (sublists' l).map (↑) #align multiset.powerset_aux' Multiset.powersetAux' theorem powersetAux_perm_powersetAux' {l : List α} : powersetAux l ~ powersetAux' l := by rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _ #align multiset.powerset_aux_perm_powerset_aux' Multiset.powersetAux_perm_powersetAux' @[simp] theorem powersetAux'_nil : powersetAux' (@nil α) = [0] := rfl #align multiset.powerset_aux'_nil Multiset.powersetAux'_nil @[simp] theorem powersetAux'_cons (a : α) (l : List α) : powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l) := by simp only [powersetAux', sublists'_cons, map_append, List.map_map, append_cancel_left_eq]; rfl #align multiset.powerset_aux'_cons Multiset.powersetAux'_cons theorem powerset_aux'_perm {l₁ l₂ : List α} (p : l₁ ~ l₂) : powersetAux' l₁ ~ powersetAux' l₂ := by induction' p with a l₁ l₂ p IH a b l l₁ l₂ l₃ _ _ IH₁ IH₂ · simp · simp only [powersetAux'_cons] exact IH.append (IH.map _) · simp only [powersetAux'_cons, map_append, List.map_map, append_assoc] apply Perm.append_left rw [← append_assoc, ← append_assoc, (by funext s; simp [cons_swap] : cons b ∘ cons a = cons a ∘ cons b)] exact perm_append_comm.append_right _ · exact IH₁.trans IH₂ #align multiset.powerset_aux'_perm Multiset.powerset_aux'_perm theorem powersetAux_perm {l₁ l₂ : List α} (p : l₁ ~ l₂) : powersetAux l₁ ~ powersetAux l₂ := powersetAux_perm_powersetAux'.trans <| (powerset_aux'_perm p).trans powersetAux_perm_powersetAux'.symm #align multiset.powerset_aux_perm Multiset.powersetAux_perm --Porting note (#11083): slightly slower implementation due to `map ofList` def powerset (s : Multiset α) : Multiset (Multiset α) := Quot.liftOn s (fun l => (powersetAux l : Multiset (Multiset α))) (fun _ _ h => Quot.sound (powersetAux_perm h)) #align multiset.powerset Multiset.powerset theorem powerset_coe (l : List α) : @powerset α l = ((sublists l).map (↑) : List (Multiset α)) := congr_arg ((↑) : List (Multiset α) → Multiset (Multiset α)) powersetAux_eq_map_coe #align multiset.powerset_coe Multiset.powerset_coe @[simp] theorem powerset_coe' (l : List α) : @powerset α l = ((sublists' l).map (↑) : List (Multiset α)) := Quot.sound powersetAux_perm_powersetAux' #align multiset.powerset_coe' Multiset.powerset_coe' @[simp] theorem powerset_zero : @powerset α 0 = {0} := rfl #align multiset.powerset_zero Multiset.powerset_zero @[simp] theorem powerset_cons (a : α) (s) : powerset (a ::ₘ s) = powerset s + map (cons a) (powerset s) := Quotient.inductionOn s fun l => by simp only [quot_mk_to_coe, cons_coe, powerset_coe', sublists'_cons, map_append, List.map_map, map_coe, coe_add, coe_eq_coe]; rfl #align multiset.powerset_cons Multiset.powerset_cons @[simp] theorem mem_powerset {s t : Multiset α} : s ∈ powerset t ↔ s ≤ t := Quotient.inductionOn₂ s t <| by simp [Subperm, and_comm] #align multiset.mem_powerset Multiset.mem_powerset theorem map_single_le_powerset (s : Multiset α) : s.map singleton ≤ powerset s := Quotient.inductionOn s fun l => by simp only [powerset_coe, quot_mk_to_coe, coe_le, map_coe] show l.map (((↑) : List α → Multiset α) ∘ pure) <+~ (sublists l).map (↑) rw [← List.map_map] exact ((map_pure_sublist_sublists _).map _).subperm #align multiset.map_single_le_powerset Multiset.map_single_le_powerset @[simp] theorem card_powerset (s : Multiset α) : card (powerset s) = 2 ^ card s := Quotient.inductionOn s <| by simp #align multiset.card_powerset Multiset.card_powerset theorem revzip_powersetAux {l : List α} ⦃x⦄ (h : x ∈ revzip (powersetAux l)) : x.1 + x.2 = ↑l := by rw [revzip, powersetAux_eq_map_coe, ← map_reverse, zip_map, ← revzip, List.mem_map] at h simp only [Prod.map_apply, Prod.exists] at h rcases h with ⟨l₁, l₂, h, rfl, rfl⟩ exact Quot.sound (revzip_sublists _ _ _ h) #align multiset.revzip_powerset_aux Multiset.revzip_powersetAux
Mathlib/Data/Multiset/Powerset.lean
132
137
theorem revzip_powersetAux' {l : List α} ⦃x⦄ (h : x ∈ revzip (powersetAux' l)) : x.1 + x.2 = ↑l := by
rw [revzip, powersetAux', ← map_reverse, zip_map, ← revzip, List.mem_map] at h simp only [Prod.map_apply, Prod.exists] at h rcases h with ⟨l₁, l₂, h, rfl, rfl⟩ exact Quot.sound (revzip_sublists' _ _ _ h)
[ " ∀ (a : List α), ⟦a⟧ ∈ powersetAux l ↔ ⟦a⟧ ≤ ↑l", " powersetAux l ~ powersetAux' l", " List.map ofList l.sublists ~ powersetAux' l", " powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l)", " List.map (ofList ∘ List.cons a) l.sublists' = List.map (cons a ∘ ofList) l.sublists'", " ...
[ " ∀ (a : List α), ⟦a⟧ ∈ powersetAux l ↔ ⟦a⟧ ≤ ↑l", " powersetAux l ~ powersetAux' l", " List.map ofList l.sublists ~ powersetAux' l", " powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l)", " List.map (ofList ∘ List.cons a) l.sublists' = List.map (cons a ∘ ofList) l.sublists'", " ...
import Mathlib.AlgebraicGeometry.Restrict import Mathlib.CategoryTheory.Adjunction.Limits import Mathlib.CategoryTheory.Adjunction.Reflective #align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 set_option linter.uppercaseLean3 false noncomputable section universe u open PrimeSpectrum namespace AlgebraicGeometry open Opposite open CategoryTheory open StructureSheaf open Spec (structureSheaf) open TopologicalSpace open AlgebraicGeometry.LocallyRingedSpace open TopCat.Presheaf open TopCat.Presheaf.SheafCondition namespace LocallyRingedSpace variable (X : LocallyRingedSpace.{u}) def ΓToStalk (x : X) : Γ.obj (op X) ⟶ X.presheaf.stalk x := X.presheaf.germ (⟨x, trivial⟩ : (⊤ : Opens X)) #align algebraic_geometry.LocallyRingedSpace.Γ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΓToStalk def toΓSpecFun : X → PrimeSpectrum (Γ.obj (op X)) := fun x => comap (X.ΓToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x)) #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΓSpecFun theorem not_mem_prime_iff_unit_in_stalk (r : Γ.obj (op X)) (x : X) : r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit (X.ΓToStalk x r) := by erw [LocalRing.mem_maximalIdeal, Classical.not_not] #align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk
Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean
84
87
theorem toΓSpec_preim_basicOpen_eq (r : Γ.obj (op X)) : X.toΓSpecFun ⁻¹' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by
ext erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk
[ " r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit ((X.ΓToStalk x) r)", " X.toΓSpecFun ⁻¹' (basicOpen r).carrier = (X.toRingedSpace.basicOpen r).carrier", " x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ x✝ ∈ (X.toRingedSpace.basicOpen r).carrier", " x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ IsUnit ((X.toRingedSpace....
[ " r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit ((X.ΓToStalk x) r)" ]
import Mathlib.Combinatorics.Quiver.Cast import Mathlib.Combinatorics.Quiver.Symmetric #align_import combinatorics.quiver.single_obj from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" namespace Quiver -- Porting note: Removed `deriving Unique`. @[nolint unusedArguments] def SingleObj (_ : Type*) : Type := Unit #align quiver.single_obj Quiver.SingleObj -- Porting note: `deriving` from above has been moved to below. instance {α : Type*} : Unique (SingleObj α) where default := ⟨⟩ uniq := fun _ => rfl namespace SingleObj variable (α β γ : Type*) instance : Quiver (SingleObj α) := ⟨fun _ _ => α⟩ def star : SingleObj α := Unit.unit #align quiver.single_obj.star Quiver.SingleObj.star instance : Inhabited (SingleObj α) := ⟨star α⟩ variable {α β γ} lemma ext {x y : SingleObj α} : x = y := Unit.ext x y -- See note [reducible non-instances] abbrev hasReverse (rev : α → α) : HasReverse (SingleObj α) := ⟨rev⟩ #align quiver.single_obj.has_reverse Quiver.SingleObj.hasReverse -- See note [reducible non-instances] abbrev hasInvolutiveReverse (rev : α → α) (h : Function.Involutive rev) : HasInvolutiveReverse (SingleObj α) where toHasReverse := hasReverse rev inv' := h #align quiver.single_obj.has_involutive_reverse Quiver.SingleObj.hasInvolutiveReverse @[simps!] def toHom : α ≃ (star α ⟶ star α) := Equiv.refl _ #align quiver.single_obj.to_hom Quiver.SingleObj.toHom #align quiver.single_obj.to_hom_apply Quiver.SingleObj.toHom_apply #align quiver.single_obj.to_hom_symm_apply Quiver.SingleObj.toHom_symm_apply @[simps] def toPrefunctor : (α → β) ≃ SingleObj α ⥤q SingleObj β where toFun f := ⟨id, f⟩ invFun f a := f.map (toHom a) left_inv _ := rfl right_inv _ := rfl #align quiver.single_obj.to_prefunctor_symm_apply Quiver.SingleObj.toPrefunctor_symm_apply #align quiver.single_obj.to_prefunctor_apply_map Quiver.SingleObj.toPrefunctor_apply_map #align quiver.single_obj.to_prefunctor_apply_obj Quiver.SingleObj.toPrefunctor_apply_obj #align quiver.single_obj.to_prefunctor Quiver.SingleObj.toPrefunctor theorem toPrefunctor_id : toPrefunctor id = 𝟭q (SingleObj α) := rfl #align quiver.single_obj.to_prefunctor_id Quiver.SingleObj.toPrefunctor_id @[simp] theorem toPrefunctor_symm_id : toPrefunctor.symm (𝟭q (SingleObj α)) = id := rfl #align quiver.single_obj.to_prefunctor_symm_id Quiver.SingleObj.toPrefunctor_symm_id theorem toPrefunctor_comp (f : α → β) (g : β → γ) : toPrefunctor (g ∘ f) = toPrefunctor f ⋙q toPrefunctor g := rfl #align quiver.single_obj.to_prefunctor_comp Quiver.SingleObj.toPrefunctor_comp @[simp] theorem toPrefunctor_symm_comp (f : SingleObj α ⥤q SingleObj β) (g : SingleObj β ⥤q SingleObj γ) : toPrefunctor.symm (f ⋙q g) = toPrefunctor.symm g ∘ toPrefunctor.symm f := by simp only [Equiv.symm_apply_eq, toPrefunctor_comp, Equiv.apply_symm_apply] #align quiver.single_obj.to_prefunctor_symm_comp Quiver.SingleObj.toPrefunctor_symm_comp def pathToList : ∀ {x : SingleObj α}, Path (star α) x → List α | _, Path.nil => [] | _, Path.cons p a => a :: pathToList p #align quiver.single_obj.path_to_list Quiver.SingleObj.pathToList @[simp] def listToPath : List α → Path (star α) (star α) | [] => Path.nil | a :: l => (listToPath l).cons a #align quiver.single_obj.list_to_path Quiver.SingleObj.listToPath
Mathlib/Combinatorics/Quiver/SingleObj.lean
132
136
theorem listToPath_pathToList {x : SingleObj α} (p : Path (star α) x) : listToPath (pathToList p) = p.cast rfl ext := by
induction' p with y z p a ih · rfl · dsimp at *; rw [ih]
[ " toPrefunctor.symm (f ⋙q g) = toPrefunctor.symm g ∘ toPrefunctor.symm f", " listToPath (pathToList p) = Path.cast ⋯ ⋯ p", " listToPath (pathToList Path.nil) = Path.cast ⋯ ⋯ Path.nil", " listToPath (pathToList (p.cons a)) = Path.cast ⋯ ⋯ (p.cons a)", " (listToPath (pathToList p)).cons a = p.cons a" ]
[ " toPrefunctor.symm (f ⋙q g) = toPrefunctor.symm g ∘ toPrefunctor.symm f" ]
import Mathlib.Data.Matrix.Kronecker import Mathlib.LinearAlgebra.Matrix.ToLin import Mathlib.LinearAlgebra.TensorProduct.Basis #align_import linear_algebra.tensor_product.matrix from "leanprover-community/mathlib"@"f784cc6142443d9ee623a20788c282112c322081" variable {R : Type*} {M N P M' N' : Type*} {ι κ τ ι' κ' : Type*} variable [DecidableEq ι] [DecidableEq κ] [DecidableEq τ] variable [Fintype ι] [Fintype κ] [Fintype τ] [Finite ι'] [Finite κ'] variable [CommRing R] variable [AddCommGroup M] [AddCommGroup N] [AddCommGroup P] variable [AddCommGroup M'] [AddCommGroup N'] variable [Module R M] [Module R N] [Module R P] [Module R M'] [Module R N'] variable (bM : Basis ι R M) (bN : Basis κ R N) (bP : Basis τ R P) variable (bM' : Basis ι' R M') (bN' : Basis κ' R N') open Kronecker open Matrix LinearMap theorem TensorProduct.toMatrix_map (f : M →ₗ[R] M') (g : N →ₗ[R] N') : toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN') (TensorProduct.map f g) = toMatrix bM bM' f ⊗ₖ toMatrix bN bN' g := by ext ⟨i, j⟩ ⟨i', j'⟩ simp_rw [Matrix.kroneckerMap_apply, toMatrix_apply, Basis.tensorProduct_apply, TensorProduct.map_tmul, Basis.tensorProduct_repr_tmul_apply] #align tensor_product.to_matrix_map TensorProduct.toMatrix_map theorem Matrix.toLin_kronecker (A : Matrix ι' ι R) (B : Matrix κ' κ R) : toLin (bM.tensorProduct bN) (bM'.tensorProduct bN') (A ⊗ₖ B) = TensorProduct.map (toLin bM bM' A) (toLin bN bN' B) := by rw [← LinearEquiv.eq_symm_apply, toLin_symm, TensorProduct.toMatrix_map, toMatrix_toLin, toMatrix_toLin] #align matrix.to_lin_kronecker Matrix.toLin_kronecker theorem TensorProduct.toMatrix_comm : toMatrix (bM.tensorProduct bN) (bN.tensorProduct bM) (TensorProduct.comm R M N) = (1 : Matrix (ι × κ) (ι × κ) R).submatrix Prod.swap _root_.id := by ext ⟨i, j⟩ ⟨i', j'⟩ simp_rw [toMatrix_apply, Basis.tensorProduct_apply, LinearEquiv.coe_coe, TensorProduct.comm_tmul, Basis.tensorProduct_repr_tmul_apply, Matrix.submatrix_apply, Prod.swap_prod_mk, _root_.id, Basis.repr_self_apply, Matrix.one_apply, Prod.ext_iff, ite_and, @eq_comm _ i', @eq_comm _ j'] split_ifs <;> simp #align tensor_product.to_matrix_comm TensorProduct.toMatrix_comm
Mathlib/LinearAlgebra/TensorProduct/Matrix.lean
68
77
theorem TensorProduct.toMatrix_assoc : toMatrix ((bM.tensorProduct bN).tensorProduct bP) (bM.tensorProduct (bN.tensorProduct bP)) (TensorProduct.assoc R M N P) = (1 : Matrix (ι × κ × τ) (ι × κ × τ) R).submatrix _root_.id (Equiv.prodAssoc _ _ _) := by
ext ⟨i, j, k⟩ ⟨⟨i', j'⟩, k'⟩ simp_rw [toMatrix_apply, Basis.tensorProduct_apply, LinearEquiv.coe_coe, TensorProduct.assoc_tmul, Basis.tensorProduct_repr_tmul_apply, Matrix.submatrix_apply, Equiv.prodAssoc_apply, _root_.id, Basis.repr_self_apply, Matrix.one_apply, Prod.ext_iff, ite_and, @eq_comm _ i', @eq_comm _ j', @eq_comm _ k'] split_ifs <;> simp
[ " (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMatrix bN bN') g)", " (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) (i, j) (i', j') =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMa...
[ " (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMatrix bN bN') g)", " (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) (i, j) (i', j') =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMa...
import Mathlib.Algebra.Polynomial.Mirror import Mathlib.Analysis.Complex.Polynomial #align_import data.polynomial.unit_trinomial from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836" namespace Polynomial open scoped Polynomial open Finset section Semiring variable {R : Type*} [Semiring R] (k m n : ℕ) (u v w : R) noncomputable def trinomial := C u * X ^ k + C v * X ^ m + C w * X ^ n #align polynomial.trinomial Polynomial.trinomial theorem trinomial_def : trinomial k m n u v w = C u * X ^ k + C v * X ^ m + C w * X ^ n := rfl #align polynomial.trinomial_def Polynomial.trinomial_def variable {k m n u v w} theorem trinomial_leading_coeff' (hkm : k < m) (hmn : m < n) : (trinomial k m n u v w).coeff n = w := by rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow, if_neg (hkm.trans hmn).ne', if_neg hmn.ne', if_pos rfl, zero_add, zero_add] #align polynomial.trinomial_leading_coeff' Polynomial.trinomial_leading_coeff'
Mathlib/Algebra/Polynomial/UnitTrinomial.lean
55
58
theorem trinomial_middle_coeff (hkm : k < m) (hmn : m < n) : (trinomial k m n u v w).coeff m = v := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow, if_neg hkm.ne', if_pos rfl, if_neg hmn.ne, zero_add, add_zero]
[ " (trinomial k m n u v w).coeff n = w", " (trinomial k m n u v w).coeff m = v" ]
[ " (trinomial k m n u v w).coeff n = w" ]
import Batteries.Data.Sum.Basic import Batteries.Logic open Function namespace Sum @[simp] protected theorem «forall» {p : α ⊕ β → Prop} : (∀ x, p x) ↔ (∀ a, p (inl a)) ∧ ∀ b, p (inr b) := ⟨fun h => ⟨fun _ => h _, fun _ => h _⟩, fun ⟨h₁, h₂⟩ => Sum.rec h₁ h₂⟩ @[simp] protected theorem «exists» {p : α ⊕ β → Prop} : (∃ x, p x) ↔ (∃ a, p (inl a)) ∨ ∃ b, p (inr b) := ⟨ fun | ⟨inl a, h⟩ => Or.inl ⟨a, h⟩ | ⟨inr b, h⟩ => Or.inr ⟨b, h⟩, fun | Or.inl ⟨a, h⟩ => ⟨inl a, h⟩ | Or.inr ⟨b, h⟩ => ⟨inr b, h⟩⟩ theorem forall_sum {γ : α ⊕ β → Sort _} (p : (∀ ab, γ ab) → Prop) : (∀ fab, p fab) ↔ (∀ fa fb, p (Sum.rec fa fb)) := by refine ⟨fun h fa fb => h _, fun h fab => ?_⟩ have h1 : fab = Sum.rec (fun a => fab (Sum.inl a)) (fun b => fab (Sum.inr b)) := by ext ab; cases ab <;> rfl rw [h1]; exact h _ _ theorem inl.inj_iff : (inl a : α ⊕ β) = inl b ↔ a = b := ⟨inl.inj, congrArg _⟩ theorem inr.inj_iff : (inr a : α ⊕ β) = inr b ↔ a = b := ⟨inr.inj, congrArg _⟩ theorem inl_ne_inr : inl a ≠ inr b := nofun theorem inr_ne_inl : inr b ≠ inl a := nofun @[simp] theorem elim_comp_inl (f : α → γ) (g : β → γ) : Sum.elim f g ∘ inl = f := rfl @[simp] theorem elim_comp_inr (f : α → γ) (g : β → γ) : Sum.elim f g ∘ inr = g := rfl @[simp] theorem elim_inl_inr : @Sum.elim α β _ inl inr = id := funext fun x => Sum.casesOn x (fun _ => rfl) fun _ => rfl theorem comp_elim (f : γ → δ) (g : α → γ) (h : β → γ) : f ∘ Sum.elim g h = Sum.elim (f ∘ g) (f ∘ h) := funext fun x => Sum.casesOn x (fun _ => rfl) fun _ => rfl @[simp] theorem elim_comp_inl_inr (f : α ⊕ β → γ) : Sum.elim (f ∘ inl) (f ∘ inr) = f := funext fun x => Sum.casesOn x (fun _ => rfl) fun _ => rfl theorem elim_eq_iff {u u' : α → γ} {v v' : β → γ} : Sum.elim u v = Sum.elim u' v' ↔ u = u' ∧ v = v' := by simp [funext_iff] @[simp] theorem map_map (f' : α' → α'') (g' : β' → β'') (f : α → α') (g : β → β') : ∀ x : Sum α β, (x.map f g).map f' g' = x.map (f' ∘ f) (g' ∘ g) | inl _ => rfl | inr _ => rfl @[simp] theorem map_comp_map (f' : α' → α'') (g' : β' → β'') (f : α → α') (g : β → β') : Sum.map f' g' ∘ Sum.map f g = Sum.map (f' ∘ f) (g' ∘ g) := funext <| map_map f' g' f g @[simp] theorem map_id_id : Sum.map (@id α) (@id β) = id := funext fun x => Sum.recOn x (fun _ => rfl) fun _ => rfl
.lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean
134
136
theorem elim_map {f₁ : α → β} {f₂ : β → ε} {g₁ : γ → δ} {g₂ : δ → ε} {x} : Sum.elim f₂ g₂ (Sum.map f₁ g₁ x) = Sum.elim (f₂ ∘ f₁) (g₂ ∘ g₁) x := by
cases x <;> rfl
[ " (∀ (fab : (ab : α ⊕ β) → γ ab), p fab) ↔\n ∀ (fa : (val : α) → γ (inl val)) (fb : (val : β) → γ (inr val)), p fun t => rec fa fb t", " p fab", " fab = fun t => rec (fun a => fab (inl a)) (fun b => fab (inr b)) t", " fab ab = rec (fun a => fab (inl a)) (fun b => fab (inr b)) ab", " fab (inl val✝) = rec ...
[ " (∀ (fab : (ab : α ⊕ β) → γ ab), p fab) ↔\n ∀ (fa : (val : α) → γ (inl val)) (fb : (val : β) → γ (inr val)), p fun t => rec fa fb t", " p fab", " fab = fun t => rec (fun a => fab (inl a)) (fun b => fab (inr b)) t", " fab ab = rec (fun a => fab (inl a)) (fun b => fab (inr b)) ab", " fab (inl val✝) = rec ...
import Mathlib.Analysis.Seminorm import Mathlib.Topology.Algebra.Equicontinuity import Mathlib.Topology.MetricSpace.Equicontinuity import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.Module.LocallyConvex #align_import analysis.locally_convex.with_seminorms from "leanprover-community/mathlib"@"b31173ee05c911d61ad6a05bd2196835c932e0ec" open NormedField Set Seminorm TopologicalSpace Filter List open NNReal Pointwise Topology Uniformity variable {𝕜 𝕜₂ 𝕝 𝕝₂ E F G ι ι' : Type*} section FilterBasis variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable (𝕜 E ι) abbrev SeminormFamily := ι → Seminorm 𝕜 E #align seminorm_family SeminormFamily variable {𝕜 E ι} namespace SeminormFamily def basisSets (p : SeminormFamily 𝕜 E ι) : Set (Set E) := ⋃ (s : Finset ι) (r) (_ : 0 < r), singleton (ball (s.sup p) (0 : E) r) #align seminorm_family.basis_sets SeminormFamily.basisSets variable (p : SeminormFamily 𝕜 E ι) theorem basisSets_iff {U : Set E} : U ∈ p.basisSets ↔ ∃ (i : Finset ι) (r : ℝ), 0 < r ∧ U = ball (i.sup p) 0 r := by simp only [basisSets, mem_iUnion, exists_prop, mem_singleton_iff] #align seminorm_family.basis_sets_iff SeminormFamily.basisSets_iff theorem basisSets_mem (i : Finset ι) {r : ℝ} (hr : 0 < r) : (i.sup p).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨i, _, hr, rfl⟩ #align seminorm_family.basis_sets_mem SeminormFamily.basisSets_mem theorem basisSets_singleton_mem (i : ι) {r : ℝ} (hr : 0 < r) : (p i).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨{i}, _, hr, by rw [Finset.sup_singleton]⟩ #align seminorm_family.basis_sets_singleton_mem SeminormFamily.basisSets_singleton_mem theorem basisSets_nonempty [Nonempty ι] : p.basisSets.Nonempty := by let i := Classical.arbitrary ι refine nonempty_def.mpr ⟨(p i).ball 0 1, ?_⟩ exact p.basisSets_singleton_mem i zero_lt_one #align seminorm_family.basis_sets_nonempty SeminormFamily.basisSets_nonempty theorem basisSets_intersect (U V : Set E) (hU : U ∈ p.basisSets) (hV : V ∈ p.basisSets) : ∃ z ∈ p.basisSets, z ⊆ U ∩ V := by classical rcases p.basisSets_iff.mp hU with ⟨s, r₁, hr₁, hU⟩ rcases p.basisSets_iff.mp hV with ⟨t, r₂, hr₂, hV⟩ use ((s ∪ t).sup p).ball 0 (min r₁ r₂) refine ⟨p.basisSets_mem (s ∪ t) (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ?_⟩ rw [hU, hV, ball_finset_sup_eq_iInter _ _ _ (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ball_finset_sup_eq_iInter _ _ _ hr₁, ball_finset_sup_eq_iInter _ _ _ hr₂] exact Set.subset_inter (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_left hi, ball_mono <| min_le_left _ _⟩) (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_right hi, ball_mono <| min_le_right _ _⟩) #align seminorm_family.basis_sets_intersect SeminormFamily.basisSets_intersect
Mathlib/Analysis/LocallyConvex/WithSeminorms.lean
115
118
theorem basisSets_zero (U) (hU : U ∈ p.basisSets) : (0 : E) ∈ U := by
rcases p.basisSets_iff.mp hU with ⟨ι', r, hr, hU⟩ rw [hU, mem_ball_zero, map_zero] exact hr
[ " U ∈ p.basisSets ↔ ∃ i r, 0 < r ∧ U = (i.sup p).ball 0 r", " (p i).ball 0 r = ({i}.sup p).ball 0 r", " p.basisSets.Nonempty", " (p i).ball 0 1 ∈ p.basisSets", " ∃ z ∈ p.basisSets, z ⊆ U ∩ V", " ((s ∪ t).sup p).ball 0 (min r₁ r₂) ∈ p.basisSets ∧ ((s ∪ t).sup p).ball 0 (min r₁ r₂) ⊆ U ∩ V", " ((s ∪ t).su...
[ " U ∈ p.basisSets ↔ ∃ i r, 0 < r ∧ U = (i.sup p).ball 0 r", " (p i).ball 0 r = ({i}.sup p).ball 0 r", " p.basisSets.Nonempty", " (p i).ball 0 1 ∈ p.basisSets", " ∃ z ∈ p.basisSets, z ⊆ U ∩ V", " ((s ∪ t).sup p).ball 0 (min r₁ r₂) ∈ p.basisSets ∧ ((s ∪ t).sup p).ball 0 (min r₁ r₂) ⊆ U ∩ V", " ((s ∪ t).su...
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.GCD.Basic import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Logic.Function.Iterate import Mathlib.Tactic.Ring import Mathlib.Tactic.Zify #align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" namespace Nat -- Porting note: Lean cannot find pp_nodot at the time of this port. -- @[pp_nodot] def fib (n : ℕ) : ℕ := ((fun p : ℕ × ℕ => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst #align nat.fib Nat.fib @[simp] theorem fib_zero : fib 0 = 0 := rfl #align nat.fib_zero Nat.fib_zero @[simp] theorem fib_one : fib 1 = 1 := rfl #align nat.fib_one Nat.fib_one @[simp] theorem fib_two : fib 2 = 1 := rfl #align nat.fib_two Nat.fib_two theorem fib_add_two {n : ℕ} : fib (n + 2) = fib n + fib (n + 1) := by simp [fib, Function.iterate_succ_apply'] #align nat.fib_add_two Nat.fib_add_two lemma fib_add_one : ∀ {n}, n ≠ 0 → fib (n + 1) = fib (n - 1) + fib n | _n + 1, _ => fib_add_two theorem fib_le_fib_succ {n : ℕ} : fib n ≤ fib (n + 1) := by cases n <;> simp [fib_add_two] #align nat.fib_le_fib_succ Nat.fib_le_fib_succ @[mono] theorem fib_mono : Monotone fib := monotone_nat_of_le_succ fun _ => fib_le_fib_succ #align nat.fib_mono Nat.fib_mono @[simp] lemma fib_eq_zero : ∀ {n}, fib n = 0 ↔ n = 0 | 0 => Iff.rfl | 1 => Iff.rfl | n + 2 => by simp [fib_add_two, fib_eq_zero] @[simp] lemma fib_pos {n : ℕ} : 0 < fib n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.fib_pos Nat.fib_pos theorem fib_add_two_sub_fib_add_one {n : ℕ} : fib (n + 2) - fib (n + 1) = fib n := by rw [fib_add_two, add_tsub_cancel_right] #align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one theorem fib_lt_fib_succ {n : ℕ} (hn : 2 ≤ n) : fib n < fib (n + 1) := by rcases exists_add_of_le hn with ⟨n, rfl⟩ rw [← tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos] exact succ_pos n #align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by refine strictMono_nat_of_lt_succ fun n => ?_ rw [add_right_comm] exact fib_lt_fib_succ (self_le_add_left _ _) #align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2) | _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn lemma fib_lt_fib {m : ℕ} (hm : 2 ≤ m) : ∀ {n}, fib m < fib n ↔ m < n | 0 => by simp [hm] | 1 => by simp [hm] | n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp theorem le_fib_self {n : ℕ} (five_le_n : 5 ≤ n) : n ≤ fib n := by induction' five_le_n with n five_le_n IH ·-- 5 ≤ fib 5 rfl · -- n + 1 ≤ fib (n + 1) for 5 ≤ n rw [succ_le_iff] calc n ≤ fib n := IH _ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n) #align nat.le_fib_self Nat.le_fib_self lemma le_fib_add_one : ∀ n, n ≤ fib n + 1 | 0 => zero_le_one | 1 => one_le_two | 2 => le_rfl | 3 => le_rfl | 4 => le_rfl | _n + 5 => (le_fib_self le_add_self).trans <| le_succ _
Mathlib/Data/Nat/Fib/Basic.lean
156
161
theorem fib_coprime_fib_succ (n : ℕ) : Nat.Coprime (fib n) (fib (n + 1)) := by
induction' n with n ih · simp · rw [fib_add_two] simp only [coprime_add_self_right] simp [Coprime, ih.symm]
[ " (n + 2).fib = n.fib + (n + 1).fib", " n.fib ≤ (n + 1).fib", " fib 0 ≤ (0 + 1).fib", " (n✝ + 1).fib ≤ (n✝ + 1 + 1).fib", " (n + 2).fib = 0 ↔ n + 2 = 0", " 0 < n.fib ↔ 0 < n", " (n + 2).fib - (n + 1).fib = n.fib", " n.fib < (n + 1).fib", " (2 + n).fib < (2 + n + 1).fib", " 0 < n + 1", " StrictMo...
[ " (n + 2).fib = n.fib + (n + 1).fib", " n.fib ≤ (n + 1).fib", " fib 0 ≤ (0 + 1).fib", " (n✝ + 1).fib ≤ (n✝ + 1 + 1).fib", " (n + 2).fib = 0 ↔ n + 2 = 0", " 0 < n.fib ↔ 0 < n", " (n + 2).fib - (n + 1).fib = n.fib", " n.fib < (n + 1).fib", " (2 + n).fib < (2 + n + 1).fib", " 0 < n + 1", " StrictMo...
import Mathlib.Data.Finset.Sort import Mathlib.Data.List.FinRange import Mathlib.Data.Prod.Lex import Mathlib.GroupTheory.Perm.Basic import Mathlib.Order.Interval.Finset.Fin #align_import data.fin.tuple.sort from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" namespace Tuple variable {n : ℕ} variable {α : Type*} [LinearOrder α] def graph (f : Fin n → α) : Finset (α ×ₗ Fin n) := Finset.univ.image fun i => (f i, i) #align tuple.graph Tuple.graph def graph.proj {f : Fin n → α} : graph f → α := fun p => p.1.1 #align tuple.graph.proj Tuple.graph.proj @[simp] theorem graph.card (f : Fin n → α) : (graph f).card = n := by rw [graph, Finset.card_image_of_injective] · exact Finset.card_fin _ · intro _ _ -- porting note (#10745): was `simp` dsimp only rw [Prod.ext_iff] simp #align tuple.graph.card Tuple.graph.card def graphEquiv₁ (f : Fin n → α) : Fin n ≃ graph f where toFun i := ⟨(f i, i), by simp [graph]⟩ invFun p := p.1.2 left_inv i := by simp right_inv := fun ⟨⟨x, i⟩, h⟩ => by -- Porting note: was `simpa [graph] using h` simp only [graph, Finset.mem_image, Finset.mem_univ, true_and] at h obtain ⟨i', hi'⟩ := h obtain ⟨-, rfl⟩ := Prod.mk.inj_iff.mp hi' simpa #align tuple.graph_equiv₁ Tuple.graphEquiv₁ @[simp] theorem proj_equiv₁' (f : Fin n → α) : graph.proj ∘ graphEquiv₁ f = f := rfl #align tuple.proj_equiv₁' Tuple.proj_equiv₁' def graphEquiv₂ (f : Fin n → α) : Fin n ≃o graph f := Finset.orderIsoOfFin _ (by simp) #align tuple.graph_equiv₂ Tuple.graphEquiv₂ def sort (f : Fin n → α) : Equiv.Perm (Fin n) := (graphEquiv₂ f).toEquiv.trans (graphEquiv₁ f).symm #align tuple.sort Tuple.sort theorem graphEquiv₂_apply (f : Fin n → α) (i : Fin n) : graphEquiv₂ f i = graphEquiv₁ f (sort f i) := ((graphEquiv₁ f).apply_symm_apply _).symm #align tuple.graph_equiv₂_apply Tuple.graphEquiv₂_apply theorem self_comp_sort (f : Fin n → α) : f ∘ sort f = graph.proj ∘ graphEquiv₂ f := show graph.proj ∘ (graphEquiv₁ f ∘ (graphEquiv₁ f).symm) ∘ (graphEquiv₂ f).toEquiv = _ by simp #align tuple.self_comp_sort Tuple.self_comp_sort
Mathlib/Data/Fin/Tuple/Sort.lean
99
102
theorem monotone_proj (f : Fin n → α) : Monotone (graph.proj : graph f → α) := by
rintro ⟨⟨x, i⟩, hx⟩ ⟨⟨y, j⟩, hy⟩ (_ | h) · exact le_of_lt ‹_› · simp [graph.proj]
[ " (graph f).card = n", " Finset.univ.card = n", " Function.Injective fun i => (f i, i)", " (fun i => (f i, i)) a₁✝ = (fun i => (f i, i)) a₂✝ → a₁✝ = a₂✝", " (f a₁✝, a₁✝) = (f a₂✝, a₂✝) → a₁✝ = a₂✝", " (f a₁✝, a₁✝).1 = (f a₂✝, a₂✝).1 ∧ (f a₁✝, a₁✝).2 = (f a₂✝, a₂✝).2 → a₁✝ = a₂✝", " (f i, i) ∈ graph f", ...
[ " (graph f).card = n", " Finset.univ.card = n", " Function.Injective fun i => (f i, i)", " (fun i => (f i, i)) a₁✝ = (fun i => (f i, i)) a₂✝ → a₁✝ = a₂✝", " (f a₁✝, a₁✝) = (f a₂✝, a₂✝) → a₁✝ = a₂✝", " (f a₁✝, a₁✝).1 = (f a₂✝, a₂✝).1 ∧ (f a₁✝, a₁✝).2 = (f a₂✝, a₂✝).2 → a₁✝ = a₂✝", " (f i, i) ∈ graph f", ...
import Mathlib.RingTheory.LocalProperties #align_import ring_theory.ring_hom.surjective from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" namespace RingHom open scoped TensorProduct open TensorProduct Algebra.TensorProduct local notation "surjective" => fun {X Y : Type _} [CommRing X] [CommRing Y] => fun f : X →+* Y => Function.Surjective f theorem surjective_stableUnderComposition : StableUnderComposition surjective := by introv R hf hg; exact hg.comp hf #align ring_hom.surjective_stable_under_composition RingHom.surjective_stableUnderComposition
Mathlib/RingTheory/RingHom/Surjective.lean
30
33
theorem surjective_respectsIso : RespectsIso surjective := by
apply surjective_stableUnderComposition.respectsIso intros _ _ _ _ e exact e.surjective
[ " StableUnderComposition fun {X Y} [CommRing X] [CommRing Y] f => Function.Surjective ⇑f", " Function.Surjective ⇑(g.comp f)", " RespectsIso fun {X Y} [CommRing X] [CommRing Y] f => Function.Surjective ⇑f", " ∀ {R S : Type u_1} [inst : CommRing R] [inst_1 : CommRing S] (e : R ≃+* S), Function.Surjective ⇑e.to...
[ " StableUnderComposition fun {X Y} [CommRing X] [CommRing Y] f => Function.Surjective ⇑f", " Function.Surjective ⇑(g.comp f)" ]
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Nat.Choose.Sum import Mathlib.Data.Nat.Factorial.BigOperators import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Finset.Sym import Mathlib.Data.Finsupp.Multiset #align_import data.nat.choose.multinomial from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d" open Finset open scoped Nat namespace Nat variable {α : Type*} (s : Finset α) (f : α → ℕ) {a b : α} (n : ℕ) def multinomial : ℕ := (∑ i ∈ s, f i)! / ∏ i ∈ s, (f i)! #align nat.multinomial Nat.multinomial theorem multinomial_pos : 0 < multinomial s f := Nat.div_pos (le_of_dvd (factorial_pos _) (prod_factorial_dvd_factorial_sum s f)) (prod_factorial_pos s f) #align nat.multinomial_pos Nat.multinomial_pos theorem multinomial_spec : (∏ i ∈ s, (f i)!) * multinomial s f = (∑ i ∈ s, f i)! := Nat.mul_div_cancel' (prod_factorial_dvd_factorial_sum s f) #align nat.multinomial_spec Nat.multinomial_spec @[simp] lemma multinomial_empty : multinomial ∅ f = 1 := by simp [multinomial] #align nat.multinomial_nil Nat.multinomial_empty @[deprecated (since := "2024-06-01")] alias multinomial_nil := multinomial_empty variable {s f} lemma multinomial_cons (ha : a ∉ s) (f : α → ℕ) : multinomial (s.cons a ha) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by rw [multinomial, Nat.div_eq_iff_eq_mul_left _ (prod_factorial_dvd_factorial_sum _ _), prod_cons, multinomial, mul_assoc, mul_left_comm _ (f a)!, Nat.div_mul_cancel (prod_factorial_dvd_factorial_sum _ _), ← mul_assoc, Nat.choose_symm_add, Nat.add_choose_mul_factorial_mul_factorial, Finset.sum_cons] positivity lemma multinomial_insert [DecidableEq α] (ha : a ∉ s) (f : α → ℕ) : multinomial (insert a s) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by rw [← cons_eq_insert _ _ ha, multinomial_cons] #align nat.multinomial_insert Nat.multinomial_insert @[simp] lemma multinomial_singleton (a : α) (f : α → ℕ) : multinomial {a} f = 1 := by rw [← cons_empty, multinomial_cons]; simp #align nat.multinomial_singleton Nat.multinomial_singleton @[simp] theorem multinomial_insert_one [DecidableEq α] (h : a ∉ s) (h₁ : f a = 1) : multinomial (insert a s) f = (s.sum f).succ * multinomial s f := by simp only [multinomial, one_mul, factorial] rw [Finset.sum_insert h, Finset.prod_insert h, h₁, add_comm, ← succ_eq_add_one, factorial_succ] simp only [factorial_one, one_mul, Function.comp_apply, factorial, mul_one, ← one_eq_succ_zero] rw [Nat.mul_div_assoc _ (prod_factorial_dvd_factorial_sum _ _)] #align nat.multinomial_insert_one Nat.multinomial_insert_one theorem multinomial_congr {f g : α → ℕ} (h : ∀ a ∈ s, f a = g a) : multinomial s f = multinomial s g := by simp only [multinomial]; congr 1 · rw [Finset.sum_congr rfl h] · exact Finset.prod_congr rfl fun a ha => by rw [h a ha] #align nat.multinomial_congr Nat.multinomial_congr theorem binomial_eq [DecidableEq α] (h : a ≠ b) : multinomial {a, b} f = (f a + f b)! / ((f a)! * (f b)!) := by simp [multinomial, Finset.sum_pair h, Finset.prod_pair h] #align nat.binomial_eq Nat.binomial_eq
Mathlib/Data/Nat/Choose/Multinomial.lean
107
109
theorem binomial_eq_choose [DecidableEq α] (h : a ≠ b) : multinomial {a, b} f = (f a + f b).choose (f a) := by
simp [binomial_eq h, choose_eq_factorial_div_factorial (Nat.le_add_right _ _)]
[ " multinomial ∅ f = 1", " multinomial (cons a s ha) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f", " 0 < ∏ i ∈ cons a s ha, (f i)!", " multinomial (insert a s) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f", " multinomial {a} f = 1", " (f a + ∑ i ∈ ∅, f i).choose (f a) * multinomial ∅...
[ " multinomial ∅ f = 1", " multinomial (cons a s ha) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f", " 0 < ∏ i ∈ cons a s ha, (f i)!", " multinomial (insert a s) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f", " multinomial {a} f = 1", " (f a + ∑ i ∈ ∅, f i).choose (f a) * multinomial ∅...
import Mathlib.Analysis.Analytic.Constructions import Mathlib.Analysis.Calculus.Dslope import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Analytic.Uniqueness #align_import analysis.analytic.isolated_zeros from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" open scoped Classical open Filter Function Nat FormalMultilinearSeries EMetric Set open scoped Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {s : E} {p q : FormalMultilinearSeries 𝕜 𝕜 E} {f g : 𝕜 → E} {n : ℕ} {z z₀ : 𝕜} namespace HasSum variable {a : ℕ → E}
Mathlib/Analysis/Analytic/IsolatedZeros.lean
44
45
theorem hasSum_at_zero (a : ℕ → E) : HasSum (fun n => (0 : 𝕜) ^ n • a n) (a 0) := by
convert hasSum_single (α := E) 0 fun b h ↦ _ <;> simp [*]
[ " HasSum (fun n => 0 ^ n • a n) (a 0)", " a 0 = 0 ^ 0 • a 0", " 0 ^ b • a b = 0" ]
[]
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.ConcreteCategory import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer import Mathlib.CategoryTheory.Limits.Shapes.Kernels universe w v u t r namespace CategoryTheory.Limits.Concrete attribute [local instance] ConcreteCategory.instFunLike ConcreteCategory.hasCoeToSort variable {C : Type u} [Category.{v} C] section Products section WidePushout open WidePushout open WidePushoutShape variable [ConcreteCategory.{v} C]
Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean
324
333
theorem widePushout_exists_rep {B : C} {α : Type _} {X : α → C} (f : ∀ j : α, B ⟶ X j) [HasWidePushout.{v} B X f] [PreservesColimit (wideSpan B X f) (forget C)] (x : ↑(widePushout B X f)) : (∃ y : B, head f y = x) ∨ ∃ (i : α) (y : X i), ι f i y = x := by
obtain ⟨_ | j, y, rfl⟩ := Concrete.colimit_exists_rep _ x · left use y rfl · right use j, y rfl
[ " (∃ y, (head f) y = x) ∨ ∃ i y, (ι f i) y = x", " (∃ y_1, (head f) y_1 = (colimit.ι (wideSpan B X f) none) y) ∨\n ∃ i y_1, (ι f i) y_1 = (colimit.ι (wideSpan B X f) none) y", " ∃ y_1, (head f) y_1 = (colimit.ι (wideSpan B X f) none) y", " (head f) y = (colimit.ι (wideSpan B X f) none) y", " (∃ y_1, (hea...
[]
import Mathlib.Data.Finsupp.Basic import Mathlib.Data.Finsupp.Order #align_import data.finsupp.multiset from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Finset variable {α β ι : Type*} namespace Finsupp def toMultiset : (α →₀ ℕ) →+ Multiset α where toFun f := Finsupp.sum f fun a n => n • {a} -- Porting note: times out if h is not specified map_add' _f _g := sum_add_index' (h := fun a n => n • ({a} : Multiset α)) (fun _ ↦ zero_nsmul _) (fun _ ↦ add_nsmul _) map_zero' := sum_zero_index theorem toMultiset_zero : toMultiset (0 : α →₀ ℕ) = 0 := rfl #align finsupp.to_multiset_zero Finsupp.toMultiset_zero theorem toMultiset_add (m n : α →₀ ℕ) : toMultiset (m + n) = toMultiset m + toMultiset n := toMultiset.map_add m n #align finsupp.to_multiset_add Finsupp.toMultiset_add theorem toMultiset_apply (f : α →₀ ℕ) : toMultiset f = f.sum fun a n => n • {a} := rfl #align finsupp.to_multiset_apply Finsupp.toMultiset_apply @[simp] theorem toMultiset_single (a : α) (n : ℕ) : toMultiset (single a n) = n • {a} := by rw [toMultiset_apply, sum_single_index]; apply zero_nsmul #align finsupp.to_multiset_single Finsupp.toMultiset_single theorem toMultiset_sum {f : ι → α →₀ ℕ} (s : Finset ι) : Finsupp.toMultiset (∑ i ∈ s, f i) = ∑ i ∈ s, Finsupp.toMultiset (f i) := map_sum Finsupp.toMultiset _ _ #align finsupp.to_multiset_sum Finsupp.toMultiset_sum theorem toMultiset_sum_single (s : Finset ι) (n : ℕ) : Finsupp.toMultiset (∑ i ∈ s, single i n) = n • s.val := by simp_rw [toMultiset_sum, Finsupp.toMultiset_single, sum_nsmul, sum_multiset_singleton] #align finsupp.to_multiset_sum_single Finsupp.toMultiset_sum_single @[simp] theorem card_toMultiset (f : α →₀ ℕ) : Multiset.card (toMultiset f) = f.sum fun _ => id := by simp [toMultiset_apply, map_finsupp_sum, Function.id_def] #align finsupp.card_to_multiset Finsupp.card_toMultiset theorem toMultiset_map (f : α →₀ ℕ) (g : α → β) : f.toMultiset.map g = toMultiset (f.mapDomain g) := by refine f.induction ?_ ?_ · rw [toMultiset_zero, Multiset.map_zero, mapDomain_zero, toMultiset_zero] · intro a n f _ _ ih rw [toMultiset_add, Multiset.map_add, ih, mapDomain_add, mapDomain_single, toMultiset_single, toMultiset_add, toMultiset_single, ← Multiset.coe_mapAddMonoidHom, (Multiset.mapAddMonoidHom g).map_nsmul] rfl #align finsupp.to_multiset_map Finsupp.toMultiset_map @[to_additive (attr := simp)] theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) : f.toMultiset.prod = f.prod fun a n => a ^ n := by refine f.induction ?_ ?_ · rw [toMultiset_zero, Multiset.prod_zero, Finsupp.prod_zero_index] · intro a n f _ _ ih rw [toMultiset_add, Multiset.prod_add, ih, toMultiset_single, Multiset.prod_nsmul, Finsupp.prod_add_index' pow_zero pow_add, Finsupp.prod_single_index, Multiset.prod_singleton] exact pow_zero a #align finsupp.prod_to_multiset Finsupp.prod_toMultiset @[simp] theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by refine f.induction ?_ ?_ · rw [toMultiset_zero, Multiset.toFinset_zero, support_zero] · intro a n f ha hn ih rw [toMultiset_add, Multiset.toFinset_add, ih, toMultiset_single, support_add_eq, support_single_ne_zero _ hn, Multiset.toFinset_nsmul _ _ hn, Multiset.toFinset_singleton] refine Disjoint.mono_left support_single_subset ?_ rwa [Finset.disjoint_singleton_left] #align finsupp.to_finset_to_multiset Finsupp.toFinset_toMultiset @[simp] theorem count_toMultiset [DecidableEq α] (f : α →₀ ℕ) (a : α) : (toMultiset f).count a = f a := calc (toMultiset f).count a = Finsupp.sum f (fun x n => (n • {x} : Multiset α).count a) := by rw [toMultiset_apply]; exact map_sum (Multiset.countAddMonoidHom a) _ f.support _ = f.sum fun x n => n * ({x} : Multiset α).count a := by simp only [Multiset.count_nsmul] _ = f a * ({a} : Multiset α).count a := sum_eq_single _ (fun a' _ H => by simp only [Multiset.count_singleton, if_false, H.symm, mul_zero]) (fun _ => zero_mul _) _ = f a := by rw [Multiset.count_singleton_self, mul_one] #align finsupp.count_to_multiset Finsupp.count_toMultiset theorem toMultiset_sup [DecidableEq α] (f g : α →₀ ℕ) : toMultiset (f ⊔ g) = toMultiset f ∪ toMultiset g := by ext simp_rw [Multiset.count_union, Finsupp.count_toMultiset, Finsupp.sup_apply, sup_eq_max]
Mathlib/Data/Finsupp/Multiset.lean
122
125
theorem toMultiset_inf [DecidableEq α] (f g : α →₀ ℕ) : toMultiset (f ⊓ g) = toMultiset f ∩ toMultiset g := by
ext simp_rw [Multiset.count_inter, Finsupp.count_toMultiset, Finsupp.inf_apply, inf_eq_min]
[ " toMultiset (single a n) = n • {a}", " 0 • {a} = 0", " toMultiset (∑ i ∈ s, single i n) = n • s.val", " Multiset.card (toMultiset f) = f.sum fun x => id", " Multiset.map g (toMultiset f) = toMultiset (mapDomain g f)", " Multiset.map g (toMultiset 0) = toMultiset (mapDomain g 0)", " ∀ (a : α) (b : ℕ) (f...
[ " toMultiset (single a n) = n • {a}", " 0 • {a} = 0", " toMultiset (∑ i ∈ s, single i n) = n • s.val", " Multiset.card (toMultiset f) = f.sum fun x => id", " Multiset.map g (toMultiset f) = toMultiset (mapDomain g f)", " Multiset.map g (toMultiset 0) = toMultiset (mapDomain g 0)", " ∀ (a : α) (b : ℕ) (f...
import Mathlib.Algebra.BigOperators.Fin import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.Prod import Mathlib.SetTheory.Cardinal.Basic import Mathlib.Tactic.FinCases import Mathlib.Tactic.LinearCombination import Mathlib.Lean.Expr.ExtraRecognizers import Mathlib.Data.Set.Subsingleton #align_import linear_algebra.linear_independent from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" noncomputable section open Function Set Submodule open Cardinal universe u' u variable {ι : Type u'} {ι' : Type*} {R : Type*} {K : Type*} variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*} section Module variable {v : ι → M} variable [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M''] variable [Module R M] [Module R M'] [Module R M''] variable {a b : R} {x y : M} variable (R) (v) def LinearIndependent : Prop := LinearMap.ker (Finsupp.total ι M R v) = ⊥ #align linear_independent LinearIndependent open Lean PrettyPrinter.Delaborator SubExpr in @[delab app.LinearIndependent] def delabLinearIndependent : Delab := whenPPOption getPPNotation <| whenNotPPOption getPPAnalysisSkip <| withOptionAtCurrPos `pp.analysis.skip true do let e ← getExpr guard <| e.isAppOfArity ``LinearIndependent 7 let some _ := (e.getArg! 0).coeTypeSet? | failure let optionsPerPos ← if (e.getArg! 3).isLambda then withNaryArg 3 do return (← read).optionsPerPos.setBool (← getPos) pp.funBinderTypes.name true else withNaryArg 0 do return (← read).optionsPerPos.setBool (← getPos) `pp.analysis.namedArg true withTheReader Context ({· with optionsPerPos}) delab variable {R} {v}
Mathlib/LinearAlgebra/LinearIndependent.lean
126
128
theorem linearIndependent_iff : LinearIndependent R v ↔ ∀ l, Finsupp.total ι M R v l = 0 → l = 0 := by
simp [LinearIndependent, LinearMap.ker_eq_bot']
[ " LinearIndependent R v ↔ ∀ (l : ι →₀ R), (Finsupp.total ι M R v) l = 0 → l = 0" ]
[]
import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Ring.Action.Basic import Mathlib.Algebra.Ring.Equiv import Mathlib.Algebra.Group.Hom.CompTypeclasses #align_import algebra.hom.group_action from "leanprover-community/mathlib"@"e7bab9a85e92cf46c02cb4725a7be2f04691e3a7" assert_not_exists Submonoid section MulActionHom variable {M' : Type*} variable {M : Type*} {N : Type*} {P : Type*} variable (φ : M → N) (ψ : N → P) (χ : M → P) variable (X : Type*) [SMul M X] [SMul M' X] variable (Y : Type*) [SMul N Y] [SMul M' Y] variable (Z : Type*) [SMul P Z] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure MulActionHom where protected toFun : X → Y protected map_smul' : ∀ (m : M) (x : X), toFun (m • x) = (φ m) • toFun x notation:25 (name := «MulActionHomLocal≺») X " →ₑ[" φ:25 "] " Y:0 => MulActionHom φ X Y notation:25 (name := «MulActionHomIdLocal≺») X " →[" M:25 "] " Y:0 => MulActionHom (@id M) X Y class MulActionSemiHomClass (F : Type*) {M N : outParam Type*} (φ : outParam (M → N)) (X Y : outParam Type*) [SMul M X] [SMul N Y] [FunLike F X Y] : Prop where map_smulₛₗ : ∀ (f : F) (c : M) (x : X), f (c • x) = (φ c) • (f x) #align smul_hom_class MulActionSemiHomClass export MulActionSemiHomClass (map_smulₛₗ) abbrev MulActionHomClass (F : Type*) (M : outParam Type*) (X Y : outParam Type*) [SMul M X] [SMul M Y] [FunLike F X Y] := MulActionSemiHomClass F (@id M) X Y instance : FunLike (MulActionHom φ X Y) X Y where coe := MulActionHom.toFun coe_injective' f g h := by cases f; cases g; congr @[simp] theorem map_smul {F M X Y : Type*} [SMul M X] [SMul M Y] [FunLike F X Y] [MulActionHomClass F M X Y] (f : F) (c : M) (x : X) : f (c • x) = c • f x := map_smulₛₗ f c x -- attribute [simp] map_smulₛₗ -- Porting note: removed has_coe_to_fun instance, coercions handled differently now #noalign mul_action_hom.has_coe_to_fun instance : MulActionSemiHomClass (X →ₑ[φ] Y) φ X Y where map_smulₛₗ := MulActionHom.map_smul' initialize_simps_projections MulActionHom (toFun → apply) namespace MulActionHom variable {φ X Y} variable {F : Type*} [FunLike F X Y] @[coe] def _root_.MulActionSemiHomClass.toMulActionHom [MulActionSemiHomClass F φ X Y] (f : F) : X →ₑ[φ] Y where toFun := DFunLike.coe f map_smul' := map_smulₛₗ f instance [MulActionSemiHomClass F φ X Y] : CoeTC F (X →ₑ[φ] Y) := ⟨MulActionSemiHomClass.toMulActionHom⟩ variable (M' X Y F) in
Mathlib/GroupTheory/GroupAction/Hom.lean
150
154
theorem _root_.IsScalarTower.smulHomClass [MulOneClass X] [SMul X Y] [IsScalarTower M' X Y] [MulActionHomClass F X X Y] : MulActionHomClass F M' X Y where map_smulₛₗ f m x := by
rw [← mul_one (m • x), ← smul_eq_mul, map_smul, smul_assoc, ← map_smul, smul_eq_mul, mul_one, id_eq]
[ " f = g", " { toFun := toFun✝, map_smul' := map_smul'✝ } = g", " { toFun := toFun✝¹, map_smul' := map_smul'✝¹ } = { toFun := toFun✝, map_smul' := map_smul'✝ }", " f (m • x) = id m • f x" ]
[ " f = g", " { toFun := toFun✝, map_smul' := map_smul'✝ } = g", " { toFun := toFun✝¹, map_smul' := map_smul'✝¹ } = { toFun := toFun✝, map_smul' := map_smul'✝ }" ]
import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Covering.Vitali import Mathlib.MeasureTheory.Covering.Differentiation #align_import measure_theory.covering.density_theorem from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655" noncomputable section open Set Filter Metric MeasureTheory TopologicalSpace open scoped NNReal Topology namespace IsUnifLocDoublingMeasure variable {α : Type*} [MetricSpace α] [MeasurableSpace α] (μ : Measure α) [IsUnifLocDoublingMeasure μ] section variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] open scoped Topology irreducible_def vitaliFamily (K : ℝ) : VitaliFamily μ := by let R := scalingScaleOf μ (max (4 * K + 3) 3) have Rpos : 0 < R := scalingScaleOf_pos _ _ have A : ∀ x : α, ∃ᶠ r in 𝓝[>] (0 : ℝ), μ (closedBall x (3 * r)) ≤ scalingConstantOf μ (max (4 * K + 3) 3) * μ (closedBall x r) := by intro x apply frequently_iff.2 fun {U} hU => ?_ obtain ⟨ε, εpos, hε⟩ := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hU refine ⟨min ε R, hε ⟨lt_min εpos Rpos, min_le_left _ _⟩, ?_⟩ exact measure_mul_le_scalingConstantOf_mul μ ⟨zero_lt_three, le_max_right _ _⟩ (min_le_right _ _) exact (Vitali.vitaliFamily μ (scalingConstantOf μ (max (4 * K + 3) 3)) A).enlarge (R / 4) (by linarith) #align is_unif_loc_doubling_measure.vitali_family IsUnifLocDoublingMeasure.vitaliFamily theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : ℝ} {x y : α} {r : ℝ} (h : dist x y ≤ K * r) (rpos : 0 < r) : closedBall y r ∈ (vitaliFamily μ K).setsAt x := by let R := scalingScaleOf μ (max (4 * K + 3) 3) simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq, isClosed_ball, true_and_iff, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall, measurableSet_closedBall] by_cases H : closedBall y r ⊆ closedBall x (R / 4) swap; · exact Or.inr H left rcases le_or_lt r R with (hr | hr) · refine ⟨(K + 1) * r, ?_⟩ constructor · apply closedBall_subset_closedBall' rw [dist_comm] linarith · have I1 : closedBall x (3 * ((K + 1) * r)) ⊆ closedBall y ((4 * K + 3) * r) := by apply closedBall_subset_closedBall' linarith have I2 : closedBall y ((4 * K + 3) * r) ⊆ closedBall y (max (4 * K + 3) 3 * r) := by apply closedBall_subset_closedBall exact mul_le_mul_of_nonneg_right (le_max_left _ _) rpos.le apply (measure_mono (I1.trans I2)).trans exact measure_mul_le_scalingConstantOf_mul _ ⟨zero_lt_three.trans_le (le_max_right _ _), le_rfl⟩ hr · refine ⟨R / 4, H, ?_⟩ have : closedBall x (3 * (R / 4)) ⊆ closedBall y r := by apply closedBall_subset_closedBall' have A : y ∈ closedBall y r := mem_closedBall_self rpos.le have B := mem_closedBall'.1 (H A) linarith apply (measure_mono this).trans _ refine le_mul_of_one_le_left (zero_le _) ?_ exact ENNReal.one_le_coe_iff.2 (le_max_right _ _) #align is_unif_loc_doubling_measure.closed_ball_mem_vitali_family_of_dist_le_mul IsUnifLocDoublingMeasure.closedBall_mem_vitaliFamily_of_dist_le_mul
Mathlib/MeasureTheory/Covering/DensityTheorem.lean
112
132
theorem tendsto_closedBall_filterAt {K : ℝ} {x : α} {ι : Type*} {l : Filter ι} (w : ι → α) (δ : ι → ℝ) (δlim : Tendsto δ l (𝓝[>] 0)) (xmem : ∀ᶠ j in l, x ∈ closedBall (w j) (K * δ j)) : Tendsto (fun j => closedBall (w j) (δ j)) l ((vitaliFamily μ K).filterAt x) := by
refine (vitaliFamily μ K).tendsto_filterAt_iff.mpr ⟨?_, fun ε hε => ?_⟩ · filter_upwards [xmem, δlim self_mem_nhdsWithin] with j hj h'j exact closedBall_mem_vitaliFamily_of_dist_le_mul μ hj h'j · rcases l.eq_or_neBot with rfl | h · simp have hK : 0 ≤ K := by rcases (xmem.and (δlim self_mem_nhdsWithin)).exists with ⟨j, hj, h'j⟩ have : 0 ≤ K * δ j := nonempty_closedBall.1 ⟨x, hj⟩ exact (mul_nonneg_iff_left_nonneg_of_pos (mem_Ioi.1 h'j)).1 this have δpos := eventually_mem_of_tendsto_nhdsWithin δlim replace δlim := tendsto_nhds_of_tendsto_nhdsWithin δlim replace hK : 0 < K + 1 := by linarith apply (((Metric.tendsto_nhds.mp δlim _ (div_pos hε hK)).and δpos).and xmem).mono rintro j ⟨⟨hjε, hj₀ : 0 < δ j⟩, hx⟩ y hy replace hjε : (K + 1) * δ j < ε := by simpa [abs_eq_self.mpr hj₀.le] using (lt_div_iff' hK).mp hjε simp only [mem_closedBall] at hx hy ⊢ linarith [dist_triangle_right y x (w j)]
[ " VitaliFamily μ", " ∀ (x : α),\n ∃ᶠ (r : ℝ) in 𝓝[>] 0, μ (closedBall x (3 * r)) ≤ ↑(scalingConstantOf μ (max (4 * K + 3) 3)) * μ (closedBall x r)", " ∃ᶠ (r : ℝ) in 𝓝[>] 0, μ (closedBall x (3 * r)) ≤ ↑(scalingConstantOf μ (max (4 * K + 3) 3)) * μ (closedBall x r)", " ∃ x_1 ∈ U, μ (closedBall x (3 * x_1))...
[ " VitaliFamily μ", " ∀ (x : α),\n ∃ᶠ (r : ℝ) in 𝓝[>] 0, μ (closedBall x (3 * r)) ≤ ↑(scalingConstantOf μ (max (4 * K + 3) 3)) * μ (closedBall x r)", " ∃ᶠ (r : ℝ) in 𝓝[>] 0, μ (closedBall x (3 * r)) ≤ ↑(scalingConstantOf μ (max (4 * K + 3) 3)) * μ (closedBall x r)", " ∃ x_1 ∈ U, μ (closedBall x (3 * x_1))...
import Mathlib.Order.Filter.SmallSets import Mathlib.Tactic.Monotonicity import Mathlib.Topology.Compactness.Compact import Mathlib.Topology.NhdsSet import Mathlib.Algebra.Group.Defs #align_import topology.uniform_space.basic from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c" open Set Filter Topology universe u v ua ub uc ud variable {α : Type ua} {β : Type ub} {γ : Type uc} {δ : Type ud} {ι : Sort*} def idRel {α : Type*} := { p : α × α | p.1 = p.2 } #align id_rel idRel @[simp] theorem mem_idRel {a b : α} : (a, b) ∈ @idRel α ↔ a = b := Iff.rfl #align mem_id_rel mem_idRel @[simp] theorem idRel_subset {s : Set (α × α)} : idRel ⊆ s ↔ ∀ a, (a, a) ∈ s := by simp [subset_def] #align id_rel_subset idRel_subset def compRel (r₁ r₂ : Set (α × α)) := { p : α × α | ∃ z : α, (p.1, z) ∈ r₁ ∧ (z, p.2) ∈ r₂ } #align comp_rel compRel @[inherit_doc] scoped[Uniformity] infixl:62 " ○ " => compRel open Uniformity @[simp] theorem mem_compRel {α : Type u} {r₁ r₂ : Set (α × α)} {x y : α} : (x, y) ∈ r₁ ○ r₂ ↔ ∃ z, (x, z) ∈ r₁ ∧ (z, y) ∈ r₂ := Iff.rfl #align mem_comp_rel mem_compRel @[simp] theorem swap_idRel : Prod.swap '' idRel = @idRel α := Set.ext fun ⟨a, b⟩ => by simpa [image_swap_eq_preimage_swap] using eq_comm #align swap_id_rel swap_idRel theorem Monotone.compRel [Preorder β] {f g : β → Set (α × α)} (hf : Monotone f) (hg : Monotone g) : Monotone fun x => f x ○ g x := fun _ _ h _ ⟨z, h₁, h₂⟩ => ⟨z, hf h h₁, hg h h₂⟩ #align monotone.comp_rel Monotone.compRel @[mono] theorem compRel_mono {f g h k : Set (α × α)} (h₁ : f ⊆ h) (h₂ : g ⊆ k) : f ○ g ⊆ h ○ k := fun _ ⟨z, h, h'⟩ => ⟨z, h₁ h, h₂ h'⟩ #align comp_rel_mono compRel_mono theorem prod_mk_mem_compRel {a b c : α} {s t : Set (α × α)} (h₁ : (a, c) ∈ s) (h₂ : (c, b) ∈ t) : (a, b) ∈ s ○ t := ⟨c, h₁, h₂⟩ #align prod_mk_mem_comp_rel prod_mk_mem_compRel @[simp] theorem id_compRel {r : Set (α × α)} : idRel ○ r = r := Set.ext fun ⟨a, b⟩ => by simp #align id_comp_rel id_compRel theorem compRel_assoc {r s t : Set (α × α)} : r ○ s ○ t = r ○ (s ○ t) := by ext ⟨a, b⟩; simp only [mem_compRel]; tauto #align comp_rel_assoc compRel_assoc theorem left_subset_compRel {s t : Set (α × α)} (h : idRel ⊆ t) : s ⊆ s ○ t := fun ⟨_x, y⟩ xy_in => ⟨y, xy_in, h <| rfl⟩ #align left_subset_comp_rel left_subset_compRel theorem right_subset_compRel {s t : Set (α × α)} (h : idRel ⊆ s) : t ⊆ s ○ t := fun ⟨x, _y⟩ xy_in => ⟨x, h <| rfl, xy_in⟩ #align right_subset_comp_rel right_subset_compRel theorem subset_comp_self {s : Set (α × α)} (h : idRel ⊆ s) : s ⊆ s ○ s := left_subset_compRel h #align subset_comp_self subset_comp_self
Mathlib/Topology/UniformSpace/Basic.lean
199
202
theorem subset_iterate_compRel {s t : Set (α × α)} (h : idRel ⊆ s) (n : ℕ) : t ⊆ (s ○ ·)^[n] t := by
induction' n with n ihn generalizing t exacts [Subset.rfl, (right_subset_compRel h).trans ihn]
[ " idRel ⊆ s ↔ ∀ (a : α), (a, a) ∈ s", " (a, b) ∈ Prod.swap '' idRel ↔ (a, b) ∈ idRel", " (a, b) ∈ idRel ○ r ↔ (a, b) ∈ r", " r ○ s ○ t = r ○ (s ○ t)", " (a, b) ∈ r ○ s ○ t ↔ (a, b) ∈ r ○ (s ○ t)", " (∃ z, (∃ z_1, (a, z_1) ∈ r ∧ (z_1, z) ∈ s) ∧ (z, b) ∈ t) ↔ ∃ z, (a, z) ∈ r ∧ ∃ z_1, (z, z_1) ∈ s ∧ (z_1, b)...
[ " idRel ⊆ s ↔ ∀ (a : α), (a, a) ∈ s", " (a, b) ∈ Prod.swap '' idRel ↔ (a, b) ∈ idRel", " (a, b) ∈ idRel ○ r ↔ (a, b) ∈ r", " r ○ s ○ t = r ○ (s ○ t)", " (a, b) ∈ r ○ s ○ t ↔ (a, b) ∈ r ○ (s ○ t)", " (∃ z, (∃ z_1, (a, z_1) ∈ r ∧ (z_1, z) ∈ s) ∧ (z, b) ∈ t) ↔ ∃ z, (a, z) ∈ r ∧ ∃ z_1, (z, z_1) ∈ s ∧ (z_1, b)...
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Matrix.CharP #align_import linear_algebra.matrix.charpoly.finite_field from "leanprover-community/mathlib"@"b95b8c7a484a298228805c72c142f6b062eb0d70" noncomputable section open Polynomial Matrix open scoped Polynomial variable {n : Type*} [DecidableEq n] [Fintype n] @[simp] theorem FiniteField.Matrix.charpoly_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) : (M ^ Fintype.card K).charpoly = M.charpoly := by cases (isEmpty_or_nonempty n).symm · cases' CharP.exists K with p hp; letI := hp rcases FiniteField.card K p with ⟨⟨k, kpos⟩, ⟨hp, hk⟩⟩ haveI : Fact p.Prime := ⟨hp⟩ dsimp at hk; rw [hk] apply (frobenius_inj K[X] p).iterate k repeat' rw [iterate_frobenius (R := K[X])]; rw [← hk] rw [← FiniteField.expand_card] unfold charpoly rw [AlgHom.map_det, ← coe_detMonoidHom, ← (detMonoidHom : Matrix n n K[X] →* K[X]).map_pow] apply congr_arg det refine matPolyEquiv.injective ?_ rw [AlgEquiv.map_pow, matPolyEquiv_charmatrix, hk, sub_pow_char_pow_of_commute, ← C_pow] · exact (id (matPolyEquiv_eq_X_pow_sub_C (p ^ k) M) : _) · exact (C M).commute_X · exact congr_arg _ (Subsingleton.elim _ _) #align finite_field.matrix.charpoly_pow_card FiniteField.Matrix.charpoly_pow_card @[simp]
Mathlib/LinearAlgebra/Matrix/Charpoly/FiniteField.lean
47
50
theorem ZMod.charpoly_pow_card {p : ℕ} [Fact p.Prime] (M : Matrix n n (ZMod p)) : (M ^ p).charpoly = M.charpoly := by
have h := FiniteField.Matrix.charpoly_pow_card M rwa [ZMod.card] at h
[ " (M ^ Fintype.card K).charpoly = M.charpoly", " (M ^ p ^ k).charpoly = M.charpoly", " (⇑(frobenius K[X] p))^[k] (M ^ p ^ k).charpoly = (⇑(frobenius K[X] p))^[k] M.charpoly", " (M ^ p ^ k).charpoly ^ p ^ k = (⇑(frobenius K[X] p))^[k] M.charpoly", " (M ^ Fintype.card K).charpoly ^ Fintype.card K = (⇑(frobeni...
[ " (M ^ Fintype.card K).charpoly = M.charpoly", " (M ^ p ^ k).charpoly = M.charpoly", " (⇑(frobenius K[X] p))^[k] (M ^ p ^ k).charpoly = (⇑(frobenius K[X] p))^[k] M.charpoly", " (M ^ p ^ k).charpoly ^ p ^ k = (⇑(frobenius K[X] p))^[k] M.charpoly", " (M ^ Fintype.card K).charpoly ^ Fintype.card K = (⇑(frobeni...