Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.57k
proof
stringlengths
5
7.36k
hint
bool
2 classes
import Mathlib.Data.List.Chain #align_import data.list.destutter from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213" variable {Ξ± : Type*} (l : List Ξ±) (R : Ξ± β†’ Ξ± β†’ Prop) [DecidableRel R] {a b : Ξ±} namespace List @[simp] theorem destutter'_nil : destutter' R a [] = [a] := rfl #align list.destutter'_nil List.destutter'_nil theorem destutter'_cons : (b :: l).destutter' R a = if R a b then a :: destutter' R b l else destutter' R a l := rfl #align list.destutter'_cons List.destutter'_cons variable {R} @[simp] theorem destutter'_cons_pos (h : R b a) : (a :: l).destutter' R b = b :: l.destutter' R a := by rw [destutter', if_pos h] #align list.destutter'_cons_pos List.destutter'_cons_pos @[simp] theorem destutter'_cons_neg (h : Β¬R b a) : (a :: l).destutter' R b = l.destutter' R b := by rw [destutter', if_neg h] #align list.destutter'_cons_neg List.destutter'_cons_neg variable (R) @[simp] theorem destutter'_singleton : [b].destutter' R a = if R a b then [a, b] else [a] := by split_ifs with h <;> simp! [h] #align list.destutter'_singleton List.destutter'_singleton theorem destutter'_sublist (a) : l.destutter' R a <+ a :: l := by induction' l with b l hl generalizing a Β· simp rw [destutter'] split_ifs Β· exact Sublist.consβ‚‚ a (hl b) Β· exact (hl a).trans ((l.sublist_cons b).cons_cons a) #align list.destutter'_sublist List.destutter'_sublist theorem mem_destutter' (a) : a ∈ l.destutter' R a := by induction' l with b l hl Β· simp rw [destutter'] split_ifs Β· simp Β· assumption #align list.mem_destutter' List.mem_destutter' theorem destutter'_is_chain : βˆ€ l : List Ξ±, βˆ€ {a b}, R a b β†’ (l.destutter' R b).Chain R a | [], a, b, h => chain_singleton.mpr h | c :: l, a, b, h => by rw [destutter'] split_ifs with hbc Β· rw [chain_cons] exact ⟨h, destutter'_is_chain l hbc⟩ Β· exact destutter'_is_chain l h #align list.destutter'_is_chain List.destutter'_is_chain theorem destutter'_is_chain' (a) : (l.destutter' R a).Chain' R := by induction' l with b l hl generalizing a Β· simp rw [destutter'] split_ifs with h Β· exact destutter'_is_chain R l h Β· exact hl a #align list.destutter'_is_chain' List.destutter'_is_chain'
Mathlib/Data/List/Destutter.lean
101
105
theorem destutter'_of_chain (h : l.Chain R a) : l.destutter' R a = a :: l := by induction' l with b l hb generalizing a
induction' l with b l hb generalizing a · simp obtain ⟨h, hc⟩ := chain_cons.mp h rw [l.destutter'_cons_pos h, hb hc]
true
import Mathlib.Data.List.Basic #align_import data.list.join from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" -- Make sure we don't import algebra assert_not_exists Monoid variable {Ξ± Ξ² : Type*} namespace List attribute [simp] join -- Porting note (#10618): simp can prove this -- @[simp] theorem join_singleton (l : List Ξ±) : [l].join = l := by rw [join, join, append_nil] #align list.join_singleton List.join_singleton @[simp] theorem join_eq_nil : βˆ€ {L : List (List Ξ±)}, join L = [] ↔ βˆ€ l ∈ L, l = [] | [] => iff_of_true rfl (forall_mem_nil _) | l :: L => by simp only [join, append_eq_nil, join_eq_nil, forall_mem_cons] #align list.join_eq_nil List.join_eq_nil @[simp] theorem join_append (L₁ Lβ‚‚ : List (List Ξ±)) : join (L₁ ++ Lβ‚‚) = join L₁ ++ join Lβ‚‚ := by induction L₁ Β· rfl Β· simp [*] #align list.join_append List.join_append
Mathlib/Data/List/Join.lean
44
44
theorem join_concat (L : List (List Ξ±)) (l : List Ξ±) : join (L.concat l) = join L ++ l := by
simp
true
set_option autoImplicit true namespace Array @[simp] theorem extract_eq_nil_of_start_eq_end {a : Array Ξ±} : a.extract i i = #[] := by refine extract_empty_of_stop_le_start a ?h exact Nat.le_refl i theorem extract_append_left {a b : Array Ξ±} {i j : Nat} (h : j ≀ a.size) : (a ++ b).extract i j = a.extract i j := by apply ext Β· simp only [size_extract, size_append] omega Β· intro h1 h2 h3 rw [get_extract, get_append_left, get_extract] theorem extract_append_right {a b : Array Ξ±} {i j : Nat} (h : a.size ≀ i) : (a ++ b).extract i j = b.extract (i - a.size) (j - a.size) := by apply ext Β· rw [size_extract, size_extract, size_append] omega Β· intro k hi h2 rw [get_extract, get_extract, get_append_right (show size a ≀ i + k by omega)] congr omega theorem extract_eq_of_size_le_end {a : Array Ξ±} (h : a.size ≀ l) : a.extract p l = a.extract p a.size := by simp only [extract, Nat.min_eq_right h, Nat.sub_eq, mkEmpty_eq, Nat.min_self]
Mathlib/Data/Array/ExtractLemmas.lean
44
50
theorem extract_extract {a : Array Ξ±} (h : s1 + e2 ≀ e1) : (a.extract s1 e1).extract s2 e2 = a.extract (s1 + s2) (s1 + e2) := by apply ext
apply ext Β· simp only [size_extract] omega Β· intro i h1 h2 simp only [get_extract, Nat.add_assoc]
true
import Mathlib.Algebra.Module.Card import Mathlib.SetTheory.Cardinal.CountableCover import Mathlib.SetTheory.Cardinal.Continuum import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Topology.MetricSpace.Perfect universe u v open Filter Pointwise Set Function Cardinal open scoped Cardinal Topology theorem continuum_le_cardinal_of_nontriviallyNormedField (π•œ : Type*) [NontriviallyNormedField π•œ] [CompleteSpace π•œ] : 𝔠 ≀ #π•œ := by suffices βˆƒ f : (β„• β†’ Bool) β†’ π•œ, range f βŠ† univ ∧ Continuous f ∧ Injective f by rcases this with ⟨f, -, -, f_inj⟩ simpa using lift_mk_le_lift_mk_of_injective f_inj apply Perfect.exists_nat_bool_injection _ univ_nonempty refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩ rcases NormedField.exists_norm_lt_one π•œ with ⟨c, c_pos, hc⟩ have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) := tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc) rw [add_zero] at A have B : βˆ€αΆ  n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU rcases B.exists with ⟨n, hn⟩ refine ⟨x + c^n, by simpa using hn, ?_⟩ simp only [ne_eq, add_right_eq_self] apply pow_ne_zero simpa using c_pos theorem continuum_le_cardinal_of_module (π•œ : Type u) (E : Type v) [NontriviallyNormedField π•œ] [CompleteSpace π•œ] [AddCommGroup E] [Module π•œ E] [Nontrivial E] : 𝔠 ≀ #E := by have A : lift.{v} (𝔠 : Cardinal.{u}) ≀ lift.{v} (#π•œ) := by simpa using continuum_le_cardinal_of_nontriviallyNormedField π•œ simpa using A.trans (Cardinal.mk_le_of_module π•œ E) lemma cardinal_eq_of_mem_nhds_zero {E : Type*} (π•œ : Type*) [NontriviallyNormedField π•œ] [AddCommGroup E] [Module π•œ E] [TopologicalSpace E] [ContinuousSMul π•œ E] {s : Set E} (hs : s ∈ 𝓝 (0 : E)) : #s = #E := by obtain ⟨c, hc⟩ : βˆƒ x : π•œ , 1 < β€–xβ€– := NormedField.exists_lt_norm π•œ 1 have cn_ne : βˆ€ n, c^n β‰  0 := by intro n apply pow_ne_zero rintro rfl simp only [norm_zero] at hc exact lt_irrefl _ (hc.trans zero_lt_one) have A : βˆ€ (x : E), βˆ€αΆ  n in (atTop : Filter β„•), x ∈ c^n β€’ s := by intro x have : Tendsto (fun n ↦ (c^n) ⁻¹ β€’ x) atTop (𝓝 ((0 : π•œ) β€’ x)) := by have : Tendsto (fun n ↦ (c^n)⁻¹) atTop (𝓝 0) := by simp_rw [← inv_pow] apply tendsto_pow_atTop_nhds_zero_of_norm_lt_one rw [norm_inv] exact inv_lt_one hc exact Tendsto.smul_const this x rw [zero_smul] at this filter_upwards [this hs] with n (hn : (c ^ n)⁻¹ β€’ x ∈ s) exact (mem_smul_set_iff_inv_smul_memβ‚€ (cn_ne n) _ _).2 hn have B : βˆ€ n, #(c^n β€’ s :) = #s := by intro n have : (c^n β€’ s :) ≃ s := { toFun := fun x ↦ ⟨(c^n)⁻¹ β€’ x.1, (mem_smul_set_iff_inv_smul_memβ‚€ (cn_ne n) _ _).1 x.2⟩ invFun := fun x ↦ ⟨(c^n) β€’ x.1, smul_mem_smul_set x.2⟩ left_inv := fun x ↦ by simp [smul_smul, mul_inv_cancel (cn_ne n)] right_inv := fun x ↦ by simp [smul_smul, inv_mul_cancel (cn_ne n)] } exact Cardinal.mk_congr this apply (Cardinal.mk_of_countable_eventually_mem A B).symm
Mathlib/Topology/Algebra/Module/Cardinality.lean
97
106
theorem cardinal_eq_of_mem_nhds {E : Type*} (π•œ : Type*) [NontriviallyNormedField π•œ] [AddCommGroup E] [Module π•œ E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul π•œ E] {s : Set E} {x : E} (hs : s ∈ 𝓝 x) : #s = #E := by let g := Homeomorph.addLeft x
let g := Homeomorph.addLeft x let t := g ⁻¹' s have : t ∈ 𝓝 0 := g.continuous.continuousAt.preimage_mem_nhds (by simpa [g] using hs) have A : #t = #E := cardinal_eq_of_mem_nhds_zero π•œ this have B : #t = #s := Cardinal.mk_subtype_of_equiv s g.toEquiv rwa [B] at A
true
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Data.Nat.Fib.Basic import Mathlib.Tactic.Monotonicity #align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction open GeneralizedContinuedFraction (of) open Int variable {K : Type*} {v : K} {n : β„•} [LinearOrderedField K] [FloorRing K] namespace IntFractPair theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≀ ifp_n.fr ∧ ifp_n.fr < 1 := by cases n with | zero => have : IntFractPair.of v = ifp_n := by injection nth_stream_eq rw [← this, IntFractPair.of] exact ⟨fract_nonneg _, fract_lt_one _⟩ | succ => rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩ rw [← ifp_of_eq_ifp_n, IntFractPair.of] exact ⟨fract_nonneg _, fract_lt_one _⟩ #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg_lt_one theorem nth_stream_fr_nonneg {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≀ ifp_n.fr := (nth_stream_fr_nonneg_lt_one nth_stream_eq).left #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg theorem nth_stream_fr_lt_one {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : ifp_n.fr < 1 := (nth_stream_fr_nonneg_lt_one nth_stream_eq).right #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_lt_one
Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean
96
107
theorem one_le_succ_nth_stream_b {ifp_succ_n : IntFractPair K} (succ_nth_stream_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n) : 1 ≀ ifp_succ_n.b := by obtain ⟨ifp_n, nth_stream_eq, stream_nth_fr_ne_zero, ⟨-⟩⟩ :
obtain ⟨ifp_n, nth_stream_eq, stream_nth_fr_ne_zero, ⟨-⟩⟩ : βˆƒ ifp_n, IntFractPair.stream v n = some ifp_n ∧ ifp_n.fr β‰  0 ∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n := succ_nth_stream_eq_some_iff.1 succ_nth_stream_eq suffices 1 ≀ ifp_n.fr⁻¹ by rwa [IntFractPair.of, le_floor, cast_one] suffices ifp_n.fr ≀ 1 by have h : 0 < ifp_n.fr := lt_of_le_of_ne (nth_stream_fr_nonneg nth_stream_eq) stream_nth_fr_ne_zero.symm apply one_le_inv h this simp only [le_of_lt (nth_stream_fr_lt_one nth_stream_eq)]
true
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.GroupTheory.FreeAbelianGroup import Mathlib.GroupTheory.FreeGroup.IsFreeGroup import Mathlib.LinearAlgebra.Dimension.StrongRankCondition #align_import group_theory.free_abelian_group_finsupp from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" noncomputable section variable {X : Type*} def FreeAbelianGroup.toFinsupp : FreeAbelianGroup X β†’+ X β†’β‚€ β„€ := FreeAbelianGroup.lift fun x => Finsupp.single x (1 : β„€) #align free_abelian_group.to_finsupp FreeAbelianGroup.toFinsupp def Finsupp.toFreeAbelianGroup : (X β†’β‚€ β„€) β†’+ FreeAbelianGroup X := Finsupp.liftAddHom fun x => (smulAddHom β„€ (FreeAbelianGroup X)).flip (FreeAbelianGroup.of x) #align finsupp.to_free_abelian_group Finsupp.toFreeAbelianGroup open Finsupp FreeAbelianGroup @[simp]
Mathlib/GroupTheory/FreeAbelianGroupFinsupp.lean
45
50
theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) : Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) = (smulAddHom β„€ (FreeAbelianGroup X)).flip (of x) := by ext
ext simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul, toFreeAbelianGroup, Finsupp.liftAddHom_apply_single]
true
import Mathlib.Analysis.SpecialFunctions.Complex.Arg import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section namespace Complex open Set Filter Bornology open scoped Real Topology ComplexConjugate -- Porting note: @[pp_nodot] does not exist in mathlib4 noncomputable def log (x : β„‚) : β„‚ := x.abs.log + arg x * I #align complex.log Complex.log theorem log_re (x : β„‚) : x.log.re = x.abs.log := by simp [log] #align complex.log_re Complex.log_re theorem log_im (x : β„‚) : x.log.im = x.arg := by simp [log] #align complex.log_im Complex.log_im theorem neg_pi_lt_log_im (x : β„‚) : -Ο€ < (log x).im := by simp only [log_im, neg_pi_lt_arg] #align complex.neg_pi_lt_log_im Complex.neg_pi_lt_log_im theorem log_im_le_pi (x : β„‚) : (log x).im ≀ Ο€ := by simp only [log_im, arg_le_pi] #align complex.log_im_le_pi Complex.log_im_le_pi theorem exp_log {x : β„‚} (hx : x β‰  0) : exp (log x) = x := by rw [log, exp_add_mul_I, ← ofReal_sin, sin_arg, ← ofReal_cos, cos_arg hx, ← ofReal_exp, Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div, mul_div_cancelβ‚€ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), ← mul_assoc, mul_div_cancelβ‚€ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im] #align complex.exp_log Complex.exp_log @[simp] theorem range_exp : Set.range exp = {0}ᢜ := Set.ext fun x => ⟨by rintro ⟨x, rfl⟩ exact exp_ne_zero x, fun hx => ⟨log x, exp_log hx⟩⟩ #align complex.range_exp Complex.range_exp theorem log_exp {x : β„‚} (hx₁ : -Ο€ < x.im) (hxβ‚‚ : x.im ≀ Ο€) : log (exp x) = x := by rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, ← ofReal_exp, arg_mul_cos_add_sin_mul_I (Real.exp_pos _) ⟨hx₁, hxβ‚‚βŸ©, re_add_im] #align complex.log_exp Complex.log_exp theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : β„‚} (hx₁ : -Ο€ < x.im) (hxβ‚‚ : x.im ≀ Ο€) (hy₁ : -Ο€ < y.im) (hyβ‚‚ : y.im ≀ Ο€) (hxy : exp x = exp y) : x = y := by rw [← log_exp hx₁ hxβ‚‚, ← log_exp hy₁ hyβ‚‚, hxy] #align complex.exp_inj_of_neg_pi_lt_of_le_pi Complex.exp_inj_of_neg_pi_lt_of_le_pi theorem ofReal_log {x : ℝ} (hx : 0 ≀ x) : (x.log : β„‚) = log x := Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx]) (by rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx]) #align complex.of_real_log Complex.ofReal_log @[simp, norm_cast] lemma natCast_log {n : β„•} : Real.log n = log n := ofReal_natCast n β–Έ ofReal_log n.cast_nonneg @[simp] lemma ofNat_log {n : β„•} [n.AtLeastTwo] : Real.log (no_index (OfNat.ofNat n)) = log (OfNat.ofNat n) := natCast_log theorem log_ofReal_re (x : ℝ) : (log (x : β„‚)).re = Real.log x := by simp [log_re] #align complex.log_of_real_re Complex.log_ofReal_re theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : β„‚} (hx : x β‰  0) : log (r * x) = Real.log r + log x := by replace hx := Complex.abs.ne_zero_iff.mpr hx simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx, ofReal_add, add_assoc] #align complex.log_of_real_mul Complex.log_ofReal_mul
Mathlib/Analysis/SpecialFunctions/Complex/Log.lean
93
94
theorem log_mul_ofReal (r : ℝ) (hr : 0 < r) (x : β„‚) (hx : x β‰  0) : log (x * r) = Real.log r + log x := by
rw [mul_comm, log_ofReal_mul hr hx]
true
import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Tactic.ComputeDegree #align_import linear_algebra.matrix.polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" set_option linter.uppercaseLean3 false open Matrix Polynomial variable {n Ξ± : Type*} [DecidableEq n] [Fintype n] [CommRing Ξ±] open Polynomial Matrix Equiv.Perm namespace Polynomial theorem natDegree_det_X_add_C_le (A B : Matrix n n Ξ±) : natDegree (det ((X : Ξ±[X]) β€’ A.map C + B.map C : Matrix n n Ξ±[X])) ≀ Fintype.card n := by rw [det_apply] refine (natDegree_sum_le _ _).trans ?_ refine Multiset.max_le_of_forall_le _ _ ?_ simp only [forall_apply_eq_imp_iff, true_and_iff, Function.comp_apply, Multiset.map_map, Multiset.mem_map, exists_imp, Finset.mem_univ_val] intro g calc natDegree (sign g β€’ ∏ i : n, (X β€’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i) ≀ natDegree (∏ i : n, (X β€’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i) := by cases' Int.units_eq_one_or (sign g) with sg sg Β· rw [sg, one_smul] Β· rw [sg, Units.neg_smul, one_smul, natDegree_neg] _ ≀ βˆ‘ i : n, natDegree (((X : Ξ±[X]) β€’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i) := (natDegree_prod_le (Finset.univ : Finset n) fun i : n => (X β€’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i) _ ≀ Finset.univ.card β€’ 1 := (Finset.sum_le_card_nsmul _ _ 1 fun (i : n) _ => ?_) _ ≀ Fintype.card n := by simp [mul_one, Algebra.id.smul_eq_mul, Finset.card_univ] dsimp only [add_apply, smul_apply, map_apply, smul_eq_mul] compute_degree #align polynomial.nat_degree_det_X_add_C_le Polynomial.natDegree_det_X_add_C_le
Mathlib/LinearAlgebra/Matrix/Polynomial.lean
62
70
theorem coeff_det_X_add_C_zero (A B : Matrix n n Ξ±) : coeff (det ((X : Ξ±[X]) β€’ A.map C + B.map C)) 0 = det B := by rw [det_apply, finset_sum_coeff, det_apply]
rw [det_apply, finset_sum_coeff, det_apply] refine Finset.sum_congr rfl ?_ rintro g - convert coeff_smul (R := Ξ±) (sign g) _ 0 rw [coeff_zero_prod] refine Finset.prod_congr rfl ?_ simp
true
import Mathlib.CategoryTheory.Abelian.Basic import Mathlib.CategoryTheory.Preadditive.Opposite import Mathlib.CategoryTheory.Limits.Opposites #align_import category_theory.abelian.opposite from "leanprover-community/mathlib"@"a5ff45a1c92c278b03b52459a620cfd9c49ebc80" noncomputable section namespace CategoryTheory open CategoryTheory.Limits variable (C : Type*) [Category C] [Abelian C] -- Porting note: these local instances do not seem to be necessary --attribute [local instance] -- hasFiniteLimits_of_hasEqualizers_and_finite_products -- hasFiniteColimits_of_hasCoequalizers_and_finite_coproducts -- Abelian.hasFiniteBiproducts instance : Abelian Cα΅’α΅– := by -- Porting note: priorities of `Abelian.has_kernels` and `Abelian.has_cokernels` have -- been set to 90 in `Abelian.Basic` in order to prevent a timeout here exact { normalMonoOfMono := fun f => normalMonoOfNormalEpiUnop _ (normalEpiOfEpi f.unop) normalEpiOfEpi := fun f => normalEpiOfNormalMonoUnop _ (normalMonoOfMono f.unop) } section variable {C} variable {X Y : C} (f : X ⟢ Y) {A B : Cα΅’α΅–} (g : A ⟢ B) -- TODO: Generalize (this will work whenever f has a cokernel) -- (The abelian case is probably sufficient for most applications.) @[simps] def kernelOpUnop : (kernel f.op).unop β‰… cokernel f where hom := (kernel.lift f.op (cokernel.Ο€ f).op <| by simp [← op_comp]).unop inv := cokernel.desc f (kernel.ΞΉ f.op).unop <| by rw [← f.unop_op, ← unop_comp, f.unop_op] simp hom_inv_id := by rw [← unop_id, ← (cokernel.desc f _ _).unop_op, ← unop_comp] congr 1 ext simp [← op_comp] inv_hom_id := by ext simp [← unop_comp] #align category_theory.kernel_op_unop CategoryTheory.kernelOpUnop -- TODO: Generalize (this will work whenever f has a kernel) -- (The abelian case is probably sufficient for most applications.) @[simps] def cokernelOpUnop : (cokernel f.op).unop β‰… kernel f where hom := kernel.lift f (cokernel.Ο€ f.op).unop <| by rw [← f.unop_op, ← unop_comp, f.unop_op] simp inv := (cokernel.desc f.op (kernel.ΞΉ f).op <| by simp [← op_comp]).unop hom_inv_id := by rw [← unop_id, ← (kernel.lift f _ _).unop_op, ← unop_comp] congr 1 ext simp [← op_comp] inv_hom_id := by ext simp [← unop_comp] #align category_theory.cokernel_op_unop CategoryTheory.cokernelOpUnop @[simps!] def kernelUnopOp : Opposite.op (kernel g.unop) β‰… cokernel g := (cokernelOpUnop g.unop).op #align category_theory.kernel_unop_op CategoryTheory.kernelUnopOp @[simps!] def cokernelUnopOp : Opposite.op (cokernel g.unop) β‰… kernel g := (kernelOpUnop g.unop).op #align category_theory.cokernel_unop_op CategoryTheory.cokernelUnopOp theorem cokernel.Ο€_op : (cokernel.Ο€ f.op).unop = (cokernelOpUnop f).hom ≫ kernel.ΞΉ f ≫ eqToHom (Opposite.unop_op _).symm := by simp [cokernelOpUnop] #align category_theory.cokernel.Ο€_op CategoryTheory.cokernel.Ο€_op
Mathlib/CategoryTheory/Abelian/Opposite.lean
101
103
theorem kernel.ΞΉ_op : (kernel.ΞΉ f.op).unop = eqToHom (Opposite.unop_op _) ≫ cokernel.Ο€ f ≫ (kernelOpUnop f).inv := by
simp [kernelOpUnop]
true
import Mathlib.Analysis.Calculus.FormalMultilinearSeries import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Logic.Equiv.Fin import Mathlib.Topology.Algebra.InfiniteSum.Module #align_import analysis.analytic.basic from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" noncomputable section variable {π•œ E F G : Type*} open scoped Classical open Topology NNReal Filter ENNReal open Set Filter Asymptotics variable [NontriviallyNormedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] [NormedAddCommGroup F] [NormedSpace π•œ F] [NormedAddCommGroup G] [NormedSpace π•œ G] namespace FormalMultilinearSeries variable (p : FormalMultilinearSeries π•œ E F) {r : ℝβ‰₯0} def radius (p : FormalMultilinearSeries π•œ E F) : ℝβ‰₯0∞ := ⨆ (r : ℝβ‰₯0) (C : ℝ) (_ : βˆ€ n, β€–p nβ€– * (r : ℝ) ^ n ≀ C), (r : ℝβ‰₯0∞) #align formal_multilinear_series.radius FormalMultilinearSeries.radius theorem le_radius_of_bound (C : ℝ) {r : ℝβ‰₯0} (h : βˆ€ n : β„•, β€–p nβ€– * (r : ℝ) ^ n ≀ C) : (r : ℝβ‰₯0∞) ≀ p.radius := le_iSup_of_le r <| le_iSup_of_le C <| le_iSup (fun _ => (r : ℝβ‰₯0∞)) h #align formal_multilinear_series.le_radius_of_bound FormalMultilinearSeries.le_radius_of_bound theorem le_radius_of_bound_nnreal (C : ℝβ‰₯0) {r : ℝβ‰₯0} (h : βˆ€ n : β„•, β€–p nβ€–β‚Š * r ^ n ≀ C) : (r : ℝβ‰₯0∞) ≀ p.radius := p.le_radius_of_bound C fun n => mod_cast h n #align formal_multilinear_series.le_radius_of_bound_nnreal FormalMultilinearSeries.le_radius_of_bound_nnreal theorem le_radius_of_isBigO (h : (fun n => β€–p nβ€– * (r : ℝ) ^ n) =O[atTop] fun _ => (1 : ℝ)) : ↑r ≀ p.radius := Exists.elim (isBigO_one_nat_atTop_iff.1 h) fun C hC => p.le_radius_of_bound C fun n => (le_abs_self _).trans (hC n) set_option linter.uppercaseLean3 false in #align formal_multilinear_series.le_radius_of_is_O FormalMultilinearSeries.le_radius_of_isBigO theorem le_radius_of_eventually_le (C) (h : βˆ€αΆ  n in atTop, β€–p nβ€– * (r : ℝ) ^ n ≀ C) : ↑r ≀ p.radius := p.le_radius_of_isBigO <| IsBigO.of_bound C <| h.mono fun n hn => by simpa #align formal_multilinear_series.le_radius_of_eventually_le FormalMultilinearSeries.le_radius_of_eventually_le theorem le_radius_of_summable_nnnorm (h : Summable fun n => β€–p nβ€–β‚Š * r ^ n) : ↑r ≀ p.radius := p.le_radius_of_bound_nnreal (βˆ‘' n, β€–p nβ€–β‚Š * r ^ n) fun _ => le_tsum' h _ #align formal_multilinear_series.le_radius_of_summable_nnnorm FormalMultilinearSeries.le_radius_of_summable_nnnorm theorem le_radius_of_summable (h : Summable fun n => β€–p nβ€– * (r : ℝ) ^ n) : ↑r ≀ p.radius := p.le_radius_of_summable_nnnorm <| by simp only [← coe_nnnorm] at h exact mod_cast h #align formal_multilinear_series.le_radius_of_summable FormalMultilinearSeries.le_radius_of_summable theorem radius_eq_top_of_forall_nnreal_isBigO (h : βˆ€ r : ℝβ‰₯0, (fun n => β€–p nβ€– * (r : ℝ) ^ n) =O[atTop] fun _ => (1 : ℝ)) : p.radius = ∞ := ENNReal.eq_top_of_forall_nnreal_le fun r => p.le_radius_of_isBigO (h r) set_option linter.uppercaseLean3 false in #align formal_multilinear_series.radius_eq_top_of_forall_nnreal_is_O FormalMultilinearSeries.radius_eq_top_of_forall_nnreal_isBigO theorem radius_eq_top_of_eventually_eq_zero (h : βˆ€αΆ  n in atTop, p n = 0) : p.radius = ∞ := p.radius_eq_top_of_forall_nnreal_isBigO fun r => (isBigO_zero _ _).congr' (h.mono fun n hn => by simp [hn]) EventuallyEq.rfl #align formal_multilinear_series.radius_eq_top_of_eventually_eq_zero FormalMultilinearSeries.radius_eq_top_of_eventually_eq_zero theorem radius_eq_top_of_forall_image_add_eq_zero (n : β„•) (hn : βˆ€ m, p (m + n) = 0) : p.radius = ∞ := p.radius_eq_top_of_eventually_eq_zero <| mem_atTop_sets.2 ⟨n, fun _ hk => tsub_add_cancel_of_le hk β–Έ hn _⟩ #align formal_multilinear_series.radius_eq_top_of_forall_image_add_eq_zero FormalMultilinearSeries.radius_eq_top_of_forall_image_add_eq_zero @[simp] theorem constFormalMultilinearSeries_radius {v : F} : (constFormalMultilinearSeries π•œ E v).radius = ⊀ := (constFormalMultilinearSeries π•œ E v).radius_eq_top_of_forall_image_add_eq_zero 1 (by simp [constFormalMultilinearSeries]) #align formal_multilinear_series.const_formal_multilinear_series_radius FormalMultilinearSeries.constFormalMultilinearSeries_radius
Mathlib/Analysis/Analytic/Basic.lean
187
202
theorem isLittleO_of_lt_radius (h : ↑r < p.radius) : βˆƒ a ∈ Ioo (0 : ℝ) 1, (fun n => β€–p nβ€– * (r : ℝ) ^ n) =o[atTop] (a ^ Β·) := by have := (TFAE_exists_lt_isLittleO_pow (fun n => β€–p nβ€– * (r : ℝ) ^ n) 1).out 1 4
have := (TFAE_exists_lt_isLittleO_pow (fun n => β€–p nβ€– * (r : ℝ) ^ n) 1).out 1 4 rw [this] -- Porting note: was -- rw [(TFAE_exists_lt_isLittleO_pow (fun n => β€–p nβ€– * (r : ℝ) ^ n) 1).out 1 4] simp only [radius, lt_iSup_iff] at h rcases h with ⟨t, C, hC, rt⟩ rw [ENNReal.coe_lt_coe, ← NNReal.coe_lt_coe] at rt have : 0 < (t : ℝ) := r.coe_nonneg.trans_lt rt rw [← div_lt_one this] at rt refine ⟨_, rt, C, Or.inr zero_lt_one, fun n => ?_⟩ calc |β€–p nβ€– * (r : ℝ) ^ n| = β€–p nβ€– * (t : ℝ) ^ n * (r / t : ℝ) ^ n := by field_simp [mul_right_comm, abs_mul] _ ≀ C * (r / t : ℝ) ^ n := by gcongr; apply hC
true
import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Data.Finset.PiAntidiagonal import Mathlib.LinearAlgebra.StdBasis import Mathlib.Tactic.Linarith #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def MvPowerSeries (Οƒ : Type*) (R : Type*) := (Οƒ β†’β‚€ β„•) β†’ R #align mv_power_series MvPowerSeries namespace MvPowerSeries open Finsupp variable {Οƒ R : Type*} instance [Inhabited R] : Inhabited (MvPowerSeries Οƒ R) := ⟨fun _ => default⟩ instance [Zero R] : Zero (MvPowerSeries Οƒ R) := Pi.instZero instance [AddMonoid R] : AddMonoid (MvPowerSeries Οƒ R) := Pi.addMonoid instance [AddGroup R] : AddGroup (MvPowerSeries Οƒ R) := Pi.addGroup instance [AddCommMonoid R] : AddCommMonoid (MvPowerSeries Οƒ R) := Pi.addCommMonoid instance [AddCommGroup R] : AddCommGroup (MvPowerSeries Οƒ R) := Pi.addCommGroup instance [Nontrivial R] : Nontrivial (MvPowerSeries Οƒ R) := Function.nontrivial instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R (MvPowerSeries Οƒ A) := Pi.module _ _ _ 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 (MvPowerSeries Οƒ A) := Pi.isScalarTower section Semiring variable (R) [Semiring R] def monomial (n : Οƒ β†’β‚€ β„•) : R β†’β‚—[R] MvPowerSeries Οƒ R := letI := Classical.decEq Οƒ LinearMap.stdBasis R (fun _ ↦ R) n #align mv_power_series.monomial MvPowerSeries.monomial def coeff (n : Οƒ β†’β‚€ β„•) : MvPowerSeries Οƒ R β†’β‚—[R] R := LinearMap.proj n #align mv_power_series.coeff MvPowerSeries.coeff variable {R} @[ext] theorem ext {Ο† ψ} (h : βˆ€ n : Οƒ β†’β‚€ β„•, coeff R n Ο† = coeff R n ψ) : Ο† = ψ := funext h #align mv_power_series.ext MvPowerSeries.ext theorem ext_iff {Ο† ψ : MvPowerSeries Οƒ R} : Ο† = ψ ↔ βˆ€ n : Οƒ β†’β‚€ β„•, coeff R n Ο† = coeff R n ψ := Function.funext_iff #align mv_power_series.ext_iff MvPowerSeries.ext_iff
Mathlib/RingTheory/MvPowerSeries/Basic.lean
127
131
theorem monomial_def [DecidableEq Οƒ] (n : Οƒ β†’β‚€ β„•) : (monomial R n) = LinearMap.stdBasis R (fun _ ↦ R) n := by rw [monomial]
rw [monomial] -- unify the `Decidable` arguments convert rfl
true
import Mathlib.Algebra.Algebra.Tower import Mathlib.Algebra.MvPolynomial.Basic #align_import ring_theory.mv_polynomial.tower from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" variable (R A B : Type*) {Οƒ : Type*} namespace MvPolynomial section CommSemiring variable [CommSemiring R] [CommSemiring A] [CommSemiring B] variable [Algebra R A] [Algebra A B] [Algebra R B] [IsScalarTower R A B] variable {R A} theorem aeval_algebraMap_apply (x : Οƒ β†’ A) (p : MvPolynomial Οƒ R) : aeval (algebraMap A B ∘ x) p = algebraMap A B (MvPolynomial.aeval x p) := by rw [aeval_def, aeval_def, ← coe_evalβ‚‚Hom, ← coe_evalβ‚‚Hom, map_evalβ‚‚Hom, ← IsScalarTower.algebraMap_eq] -- Porting note: added simp only [Function.comp] #align mv_polynomial.aeval_algebra_map_apply MvPolynomial.aeval_algebraMap_apply theorem aeval_algebraMap_eq_zero_iff [NoZeroSMulDivisors A B] [Nontrivial B] (x : Οƒ β†’ A) (p : MvPolynomial Οƒ R) : aeval (algebraMap A B ∘ x) p = 0 ↔ aeval x p = 0 := by rw [aeval_algebraMap_apply, Algebra.algebraMap_eq_smul_one, smul_eq_zero, iff_false_intro (one_ne_zero' B), or_false_iff] #align mv_polynomial.aeval_algebra_map_eq_zero_iff MvPolynomial.aeval_algebraMap_eq_zero_iff
Mathlib/RingTheory/MvPolynomial/Tower.lean
62
65
theorem aeval_algebraMap_eq_zero_iff_of_injective {x : Οƒ β†’ A} {p : MvPolynomial Οƒ R} (h : Function.Injective (algebraMap A B)) : aeval (algebraMap A B ∘ x) p = 0 ↔ aeval x p = 0 := by
rw [aeval_algebraMap_apply, ← (algebraMap A B).map_zero, h.eq_iff]
true
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.integral_normalization from "leanprover-community/mathlib"@"6f401acf4faec3ab9ab13a42789c4f68064a61cd" open Polynomial namespace Polynomial universe u v y variable {R : Type u} {S : Type v} {a b : R} {m n : β„•} {ΞΉ : Type y} section IntegralNormalization section Semiring variable [Semiring R] noncomputable def integralNormalization (f : R[X]) : R[X] := βˆ‘ i ∈ f.support, monomial i (if f.degree = i then 1 else coeff f i * f.leadingCoeff ^ (f.natDegree - 1 - i)) #align polynomial.integral_normalization Polynomial.integralNormalization @[simp] theorem integralNormalization_zero : integralNormalization (0 : R[X]) = 0 := by simp [integralNormalization] #align polynomial.integral_normalization_zero Polynomial.integralNormalization_zero theorem integralNormalization_coeff {f : R[X]} {i : β„•} : (integralNormalization f).coeff i = if f.degree = i then 1 else coeff f i * f.leadingCoeff ^ (f.natDegree - 1 - i) := by have : f.coeff i = 0 β†’ f.degree β‰  i := fun hc hd => coeff_ne_zero_of_eq_degree hd hc simp (config := { contextual := true }) [integralNormalization, coeff_monomial, this, mem_support_iff] #align polynomial.integral_normalization_coeff Polynomial.integralNormalization_coeff
Mathlib/RingTheory/Polynomial/IntegralNormalization.lean
56
59
theorem integralNormalization_support {f : R[X]} : (integralNormalization f).support βŠ† f.support := by intro
intro simp (config := { contextual := true }) [integralNormalization, coeff_monomial, mem_support_iff]
true
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra β„š A] def bernoulli' : β„• β†’ β„š := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - βˆ‘ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : β„•) : bernoulli' n = 1 - βˆ‘ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : β„•) : bernoulli' n = 1 - βˆ‘ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : β„•) : (βˆ‘ k ∈ range n.succ, (n.choose (n - k) : β„š) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : β„•) : (βˆ‘ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : β„š) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' @[simp] theorem sum_bernoulli' (n : β„•) : (βˆ‘ k ∈ range n, (n.choose k : β„š) * bernoulli' k) = n := by cases' n with n Β· simp suffices ((n + 1 : β„š) * βˆ‘ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) = βˆ‘ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right] ring simp_rw [mul_sum, ← mul_assoc] refine sum_congr rfl fun k hk => ?_ congr have : ((n - k : β„•) : β„š) + 1 β‰  0 := by norm_cast field_simp [← cast_sub (mem_range.1 hk).le, mul_comm] rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq] #align sum_bernoulli' sum_bernoulli' def bernoulli'PowerSeries := mk fun n => algebraMap β„š A (bernoulli' n / n !) #align bernoulli'_power_series bernoulli'PowerSeries theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A := by ext n -- constant coefficient is a special case cases' n with n Β· simp rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ'] suffices (βˆ‘ p ∈ antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2! : β„š)⁻¹) = (n ! : β„š)⁻¹ by simpa [map_sum, Nat.factorial] using congr_arg (algebraMap β„š A) this apply eq_inv_of_mul_eq_one_left rw [sum_mul] convert bernoulli'_spec' n using 1 apply sum_congr rfl simp_rw [mem_antidiagonal] rintro ⟨i, j⟩ rfl have := factorial_mul_factorial_dvd_factorial_add i j field_simp [mul_comm _ (bernoulli' i), mul_assoc, add_choose] norm_cast simp [mul_comm (j + 1)] #align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_one
Mathlib/NumberTheory/Bernoulli.lean
181
196
theorem bernoulli'_odd_eq_zero {n : β„•} (h_odd : Odd n) (hlt : 1 < n) : bernoulli' n = 0 := by let B := mk fun n => bernoulli' n / (n ! : β„š)
let B := mk fun n => bernoulli' n / (n ! : β„š) suffices (B - evalNegHom B) * (exp β„š - 1) = X * (exp β„š - 1) by cases' mul_eq_mul_right_iff.mp this with h h <;> simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h Β· apply eq_zero_of_neg_eq specialize h n split_ifs at h <;> simp_all [B, h_odd.neg_one_pow, factorial_ne_zero] Β· simpa (config := {decide := true}) [Nat.factorial] using h 1 have h : B * (exp β„š - 1) = X * exp β„š := by simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one β„š rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg] suffices evalNegHom (B * (exp β„š - 1)) * exp β„š = evalNegHom (X * exp β„š) * exp β„š by rw [map_mul, map_mul] at this -- Porting note: Why doesn't simp do this? simpa [mul_assoc, sub_mul, mul_comm (evalNegHom (exp β„š)), exp_mul_exp_neg_eq_one] congr
true
import Mathlib.Combinatorics.Quiver.Basic import Mathlib.Combinatorics.Quiver.Path #align_import combinatorics.quiver.cast from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e" universe v v₁ vβ‚‚ u u₁ uβ‚‚ variable {U : Type*} [Quiver.{u + 1} U] namespace Quiver def Hom.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟢ v) : u' ⟢ v' := Eq.ndrec (motive := (Β· ⟢ v')) (Eq.ndrec e hv) hu #align quiver.hom.cast Quiver.Hom.cast theorem Hom.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟢ v) : e.cast hu hv = _root_.cast (by {rw [hu, hv]}) e := by subst_vars rfl #align quiver.hom.cast_eq_cast Quiver.Hom.cast_eq_cast @[simp] theorem Hom.cast_rfl_rfl {u v : U} (e : u ⟢ v) : e.cast rfl rfl = e := rfl #align quiver.hom.cast_rfl_rfl Quiver.Hom.cast_rfl_rfl @[simp] theorem Hom.cast_cast {u v u' v' u'' v'' : U} (e : u ⟢ v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (e.cast hu hv).cast hu' hv' = e.cast (hu.trans hu') (hv.trans hv') := by subst_vars rfl #align quiver.hom.cast_cast Quiver.Hom.cast_cast theorem Hom.cast_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟢ v) : HEq (e.cast hu hv) e := by subst_vars rfl #align quiver.hom.cast_heq Quiver.Hom.cast_heq theorem Hom.cast_eq_iff_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟢ v) (e' : u' ⟢ v') : e.cast hu hv = e' ↔ HEq e e' := by rw [Hom.cast_eq_cast] exact _root_.cast_eq_iff_heq #align quiver.hom.cast_eq_iff_heq Quiver.Hom.cast_eq_iff_heq theorem Hom.eq_cast_iff_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟢ v) (e' : u' ⟢ v') : e' = e.cast hu hv ↔ HEq e' e := by rw [eq_comm, Hom.cast_eq_iff_heq] exact ⟨HEq.symm, HEq.symm⟩ #align quiver.hom.eq_cast_iff_heq Quiver.Hom.eq_cast_iff_heq open Path def Path.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (p : Path u v) : Path u' v' := Eq.ndrec (motive := (Path Β· v')) (Eq.ndrec p hv) hu #align quiver.path.cast Quiver.Path.cast theorem Path.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (p : Path u v) : p.cast hu hv = _root_.cast (by rw [hu, hv]) p := by subst_vars rfl #align quiver.path.cast_eq_cast Quiver.Path.cast_eq_cast @[simp] theorem Path.cast_rfl_rfl {u v : U} (p : Path u v) : p.cast rfl rfl = p := rfl #align quiver.path.cast_rfl_rfl Quiver.Path.cast_rfl_rfl @[simp]
Mathlib/Combinatorics/Quiver/Cast.lean
99
103
theorem Path.cast_cast {u v u' v' u'' v'' : U} (p : Path u v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (p.cast hu hv).cast hu' hv' = p.cast (hu.trans hu') (hv.trans hv') := by subst_vars
subst_vars rfl
true
import Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing import Mathlib.AlgebraicGeometry.OpenImmersion #align_import algebraic_geometry.gluing from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false noncomputable section universe u open TopologicalSpace CategoryTheory Opposite open CategoryTheory.Limits AlgebraicGeometry.PresheafedSpace open CategoryTheory.GlueData namespace AlgebraicGeometry namespace Scheme -- Porting note(#5171): @[nolint has_nonempty_instance]; linter not ported yet structure GlueData extends CategoryTheory.GlueData Scheme where f_open : βˆ€ i j, IsOpenImmersion (f i j) #align algebraic_geometry.Scheme.glue_data AlgebraicGeometry.Scheme.GlueData attribute [instance] GlueData.f_open namespace OpenCover variable {X : Scheme.{u}} (𝒰 : OpenCover.{u} X) def gluedCoverT' (x y z : 𝒰.J) : pullback (pullback.fst : pullback (𝒰.map x) (𝒰.map y) ⟢ _) (pullback.fst : pullback (𝒰.map x) (𝒰.map z) ⟢ _) ⟢ pullback (pullback.fst : pullback (𝒰.map y) (𝒰.map z) ⟢ _) (pullback.fst : pullback (𝒰.map y) (𝒰.map x) ⟢ _) := by refine (pullbackRightPullbackFstIso _ _ _).hom ≫ ?_ refine ?_ ≫ (pullbackSymmetry _ _).hom refine ?_ ≫ (pullbackRightPullbackFstIso _ _ _).inv refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (πŸ™ _) (πŸ™ _) ?_ ?_ Β· simp [pullback.condition] Β· simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t' AlgebraicGeometry.Scheme.OpenCover.gluedCoverT' @[simp, reassoc] theorem gluedCoverT'_fst_fst (x y z : 𝒰.J) : 𝒰.gluedCoverT' x y z ≫ pullback.fst ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_fst @[simp, reassoc] theorem gluedCoverT'_fst_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.fst ≫ pullback.snd = pullback.snd ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_snd AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_snd @[simp, reassoc] theorem gluedCoverT'_snd_fst (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_snd_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_snd_fst @[simp, reassoc] theorem gluedCoverT'_snd_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.snd = pullback.fst ≫ pullback.fst := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_snd_snd AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_snd_snd
Mathlib/AlgebraicGeometry/Gluing.lean
319
322
theorem glued_cover_cocycle_fst (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ gluedCoverT' 𝒰 y z x ≫ gluedCoverT' 𝒰 z x y ≫ pullback.fst = pullback.fst := by
apply pullback.hom_ext <;> simp
true
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
Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean
114
118
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]
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
true
import Mathlib.LinearAlgebra.LinearPMap import Mathlib.Topology.Algebra.Module.Basic #align_import topology.algebra.module.linear_pmap from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology variable {R E F : Type*} variable [CommRing R] [AddCommGroup E] [AddCommGroup F] variable [Module R E] [Module R F] variable [TopologicalSpace E] [TopologicalSpace F] namespace LinearPMap def IsClosed (f : E β†’β‚—.[R] F) : Prop := _root_.IsClosed (f.graph : Set (E Γ— F)) #align linear_pmap.is_closed LinearPMap.IsClosed variable [ContinuousAdd E] [ContinuousAdd F] variable [TopologicalSpace R] [ContinuousSMul R E] [ContinuousSMul R F] def IsClosable (f : E β†’β‚—.[R] F) : Prop := βˆƒ f' : LinearPMap R E F, f.graph.topologicalClosure = f'.graph #align linear_pmap.is_closable LinearPMap.IsClosable theorem IsClosed.isClosable {f : E β†’β‚—.[R] F} (hf : f.IsClosed) : f.IsClosable := ⟨f, hf.submodule_topologicalClosure_eq⟩ #align linear_pmap.is_closed.is_closable LinearPMap.IsClosed.isClosable theorem IsClosable.leIsClosable {f g : E β†’β‚—.[R] F} (hf : f.IsClosable) (hfg : g ≀ f) : g.IsClosable := by cases' hf with f' hf have : g.graph.topologicalClosure ≀ f'.graph := by rw [← hf] exact Submodule.topologicalClosure_mono (le_graph_of_le hfg) use g.graph.topologicalClosure.toLinearPMap rw [Submodule.toLinearPMap_graph_eq] exact fun _ hx hx' => f'.graph_fst_eq_zero_snd (this hx) hx' #align linear_pmap.is_closable.le_is_closable LinearPMap.IsClosable.leIsClosable theorem IsClosable.existsUnique {f : E β†’β‚—.[R] F} (hf : f.IsClosable) : βˆƒ! f' : E β†’β‚—.[R] F, f.graph.topologicalClosure = f'.graph := by refine exists_unique_of_exists_of_unique hf fun _ _ hy₁ hyβ‚‚ => eq_of_eq_graph ?_ rw [← hy₁, ← hyβ‚‚] #align linear_pmap.is_closable.exists_unique LinearPMap.IsClosable.existsUnique open scoped Classical noncomputable def closure (f : E β†’β‚—.[R] F) : E β†’β‚—.[R] F := if hf : f.IsClosable then hf.choose else f #align linear_pmap.closure LinearPMap.closure theorem closure_def {f : E β†’β‚—.[R] F} (hf : f.IsClosable) : f.closure = hf.choose := by simp [closure, hf] #align linear_pmap.closure_def LinearPMap.closure_def theorem closure_def' {f : E β†’β‚—.[R] F} (hf : Β¬f.IsClosable) : f.closure = f := by simp [closure, hf] #align linear_pmap.closure_def' LinearPMap.closure_def' theorem IsClosable.graph_closure_eq_closure_graph {f : E β†’β‚—.[R] F} (hf : f.IsClosable) : f.graph.topologicalClosure = f.closure.graph := by rw [closure_def hf] exact hf.choose_spec #align linear_pmap.is_closable.graph_closure_eq_closure_graph LinearPMap.IsClosable.graph_closure_eq_closure_graph
Mathlib/Topology/Algebra/Module/LinearPMap.lean
119
124
theorem le_closure (f : E β†’β‚—.[R] F) : f ≀ f.closure := by by_cases hf : f.IsClosable
by_cases hf : f.IsClosable Β· refine le_of_le_graph ?_ rw [← hf.graph_closure_eq_closure_graph] exact (graph f).le_topologicalClosure rw [closure_def' hf]
true
import Mathlib.Algebra.CharZero.Defs import Mathlib.Algebra.Group.Hom.Defs import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.Order.Monoid.OrderDual import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Defs import Mathlib.Order.WithBot #align_import algebra.order.monoid.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" universe u v variable {Ξ± : Type u} {Ξ² : Type v} open Function namespace WithTop section Add variable [Add Ξ±] {a b c d : WithTop Ξ±} {x y : Ξ±} instance add : Add (WithTop Ξ±) := ⟨Option.mapβ‚‚ (Β· + Β·)⟩ #align with_top.has_add WithTop.add @[simp, norm_cast] lemma coe_add (a b : Ξ±) : ↑(a + b) = (a + b : WithTop Ξ±) := rfl #align with_top.coe_add WithTop.coe_add #noalign with_top.coe_bit0 #noalign with_top.coe_bit1 @[simp] theorem top_add (a : WithTop Ξ±) : ⊀ + a = ⊀ := rfl #align with_top.top_add WithTop.top_add @[simp] theorem add_top (a : WithTop Ξ±) : a + ⊀ = ⊀ := by cases a <;> rfl #align with_top.add_top WithTop.add_top @[simp] theorem add_eq_top : a + b = ⊀ ↔ a = ⊀ ∨ b = ⊀ := by match a, b with | ⊀, _ => simp | _, ⊀ => simp | (a : Ξ±), (b : Ξ±) => simp only [← coe_add, coe_ne_top, or_false] #align with_top.add_eq_top WithTop.add_eq_top theorem add_ne_top : a + b β‰  ⊀ ↔ a β‰  ⊀ ∧ b β‰  ⊀ := add_eq_top.not.trans not_or #align with_top.add_ne_top WithTop.add_ne_top
Mathlib/Algebra/Order/Monoid/WithTop.lean
143
144
theorem add_lt_top [LT Ξ±] {a b : WithTop Ξ±} : a + b < ⊀ ↔ a < ⊀ ∧ b < ⊀ := by
simp_rw [WithTop.lt_top_iff_ne_top, add_ne_top]
true
import Mathlib.MeasureTheory.PiSystem import Mathlib.Order.OmegaCompletePartialOrder import Mathlib.Topology.Constructions import Mathlib.MeasureTheory.MeasurableSpace.Basic open Set namespace MeasureTheory variable {ΞΉ : Type _} {Ξ± : ΞΉ β†’ Type _} section squareCylinders def squareCylinders (C : βˆ€ i, Set (Set (Ξ± i))) : Set (Set (βˆ€ i, Ξ± i)) := {S | βˆƒ s : Finset ΞΉ, βˆƒ t ∈ univ.pi C, S = (s : Set ΞΉ).pi t} theorem squareCylinders_eq_iUnion_image (C : βˆ€ i, Set (Set (Ξ± i))) : squareCylinders C = ⋃ s : Finset ΞΉ, (fun t ↦ (s : Set ΞΉ).pi t) '' univ.pi C := by ext1 f simp only [squareCylinders, mem_iUnion, mem_image, mem_univ_pi, exists_prop, mem_setOf_eq, eq_comm (a := f)] theorem isPiSystem_squareCylinders {C : βˆ€ i, Set (Set (Ξ± i))} (hC : βˆ€ i, IsPiSystem (C i)) (hC_univ : βˆ€ i, univ ∈ C i) : IsPiSystem (squareCylinders C) := by rintro S₁ ⟨s₁, t₁, h₁, rfl⟩ Sβ‚‚ ⟨sβ‚‚, tβ‚‚, hβ‚‚, rfl⟩ hst_nonempty classical let t₁' := s₁.piecewise t₁ (fun i ↦ univ) let tβ‚‚' := sβ‚‚.piecewise tβ‚‚ (fun i ↦ univ) have h1 : βˆ€ i ∈ (s₁ : Set ΞΉ), t₁ i = t₁' i := fun i hi ↦ (Finset.piecewise_eq_of_mem _ _ _ hi).symm have h1' : βˆ€ i βˆ‰ (s₁ : Set ΞΉ), t₁' i = univ := fun i hi ↦ Finset.piecewise_eq_of_not_mem _ _ _ hi have h2 : βˆ€ i ∈ (sβ‚‚ : Set ΞΉ), tβ‚‚ i = tβ‚‚' i := fun i hi ↦ (Finset.piecewise_eq_of_mem _ _ _ hi).symm have h2' : βˆ€ i βˆ‰ (sβ‚‚ : Set ΞΉ), tβ‚‚' i = univ := fun i hi ↦ Finset.piecewise_eq_of_not_mem _ _ _ hi rw [Set.pi_congr rfl h1, Set.pi_congr rfl h2, ← union_pi_inter h1' h2'] refine ⟨s₁ βˆͺ sβ‚‚, fun i ↦ t₁' i ∩ tβ‚‚' i, ?_, ?_⟩ Β· rw [mem_univ_pi] intro i have : (t₁' i ∩ tβ‚‚' i).Nonempty := by obtain ⟨f, hf⟩ := hst_nonempty rw [Set.pi_congr rfl h1, Set.pi_congr rfl h2, mem_inter_iff, mem_pi, mem_pi] at hf refine ⟨f i, ⟨?_, ?_⟩⟩ Β· by_cases hi₁ : i ∈ s₁ Β· exact hf.1 i hi₁ Β· rw [h1' i hi₁] exact mem_univ _ Β· by_cases hiβ‚‚ : i ∈ sβ‚‚ Β· exact hf.2 i hiβ‚‚ Β· rw [h2' i hiβ‚‚] exact mem_univ _ refine hC i _ ?_ _ ?_ this Β· by_cases hi₁ : i ∈ s₁ Β· rw [← h1 i hi₁] exact h₁ i (mem_univ _) Β· rw [h1' i hi₁] exact hC_univ i Β· by_cases hiβ‚‚ : i ∈ sβ‚‚ Β· rw [← h2 i hiβ‚‚] exact hβ‚‚ i (mem_univ _) Β· rw [h2' i hiβ‚‚] exact hC_univ i Β· rw [Finset.coe_union] theorem comap_eval_le_generateFrom_squareCylinders_singleton (Ξ± : ΞΉ β†’ Type*) [m : βˆ€ i, MeasurableSpace (Ξ± i)] (i : ΞΉ) : MeasurableSpace.comap (Function.eval i) (m i) ≀ MeasurableSpace.generateFrom ((fun t ↦ ({i} : Set ΞΉ).pi t) '' univ.pi fun i ↦ {s : Set (Ξ± i) | MeasurableSet s}) := by simp only [Function.eval, singleton_pi, ge_iff_le] rw [MeasurableSpace.comap_eq_generateFrom] refine MeasurableSpace.generateFrom_mono fun S ↦ ?_ simp only [mem_setOf_eq, mem_image, mem_univ_pi, forall_exists_index, and_imp] intro t ht h classical refine ⟨fun j ↦ if hji : j = i then by convert t else univ, fun j ↦ ?_, ?_⟩ Β· by_cases hji : j = i Β· simp only [hji, eq_self_iff_true, eq_mpr_eq_cast, dif_pos] convert ht simp only [id_eq, cast_heq] Β· simp only [hji, not_false_iff, dif_neg, MeasurableSet.univ] Β· simp only [id_eq, eq_mpr_eq_cast, ← h] ext1 x simp only [singleton_pi, Function.eval, cast_eq, dite_eq_ite, ite_true, mem_preimage]
Mathlib/MeasureTheory/Constructions/Cylinders.lean
129
144
theorem generateFrom_squareCylinders [βˆ€ i, MeasurableSpace (Ξ± i)] : MeasurableSpace.generateFrom (squareCylinders fun i ↦ {s : Set (Ξ± i) | MeasurableSet s}) = MeasurableSpace.pi := by apply le_antisymm
apply le_antisymm Β· rw [MeasurableSpace.generateFrom_le_iff] rintro S ⟨s, t, h, rfl⟩ simp only [mem_univ_pi, mem_setOf_eq] at h exact MeasurableSet.pi (Finset.countable_toSet _) (fun i _ ↦ h i) Β· refine iSup_le fun i ↦ ?_ refine (comap_eval_le_generateFrom_squareCylinders_singleton Ξ± i).trans ?_ refine MeasurableSpace.generateFrom_mono ?_ rw [← Finset.coe_singleton, squareCylinders_eq_iUnion_image] exact subset_iUnion (fun (s : Finset ΞΉ) ↦ (fun t : βˆ€ i, Set (Ξ± i) ↦ (s : Set ΞΉ).pi t) '' univ.pi (fun i ↦ setOf MeasurableSet)) ({i} : Finset ΞΉ)
true
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 Prod section HasDeriv variable {ΞΉ : Type*} [DecidableEq ΞΉ] {𝔸' : Type*} [NormedCommRing 𝔸'] [NormedAlgebra π•œ 𝔸'] {u : Finset ΞΉ} {f : ΞΉ β†’ π•œ β†’ 𝔸'} {f' : ΞΉ β†’ 𝔸'} theorem HasDerivAt.finset_prod (hf : βˆ€ i ∈ u, HasDerivAt (f i) (f' i) x) : HasDerivAt (∏ i ∈ u, f i Β·) (βˆ‘ i ∈ u, (∏ j ∈ u.erase i, f j x) β€’ f' i) x := by simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using (HasFDerivAt.finset_prod (fun i hi ↦ (hf i hi).hasFDerivAt)).hasDerivAt theorem HasDerivWithinAt.finset_prod (hf : βˆ€ i ∈ u, HasDerivWithinAt (f i) (f' i) s x) : HasDerivWithinAt (∏ i ∈ u, f i Β·) (βˆ‘ i ∈ u, (∏ j ∈ u.erase i, f j x) β€’ f' i) s x := by simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using (HasFDerivWithinAt.finset_prod (fun i hi ↦ (hf i hi).hasFDerivWithinAt)).hasDerivWithinAt
Mathlib/Analysis/Calculus/Deriv/Mul.lean
346
349
theorem HasStrictDerivAt.finset_prod (hf : βˆ€ i ∈ u, HasStrictDerivAt (f i) (f' i) x) : HasStrictDerivAt (∏ i ∈ u, f i Β·) (βˆ‘ i ∈ u, (∏ j ∈ u.erase i, f j x) β€’ f' i) x := by simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using (HasStrictFDerivAt.finset_prod (fun i hi ↦ (hf i hi).hasStrictFDerivAt)).hasStrictDerivAt
true
import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Algebra.Order.Monoid.WithTop #align_import algebra.order.sub.with_top from "leanprover-community/mathlib"@"afdb4fa3b32d41106a4a09b371ce549ad7958abd" variable {Ξ± Ξ² : Type*} namespace WithTop section variable [Sub Ξ±] [Bot Ξ±] protected def sub : βˆ€ _ _ : WithTop Ξ±, WithTop Ξ± | _, ⊀ => (βŠ₯ : Ξ±) | ⊀, (x : Ξ±) => ⊀ | (x : Ξ±), (y : Ξ±) => (x - y : Ξ±) #align with_top.sub WithTop.sub instance : Sub (WithTop Ξ±) := ⟨WithTop.sub⟩ @[simp, norm_cast] theorem coe_sub {a b : Ξ±} : (↑(a - b) : WithTop Ξ±) = ↑a - ↑b := rfl #align with_top.coe_sub WithTop.coe_sub @[simp] theorem top_sub_coe {a : Ξ±} : (⊀ : WithTop Ξ±) - a = ⊀ := rfl #align with_top.top_sub_coe WithTop.top_sub_coe @[simp]
Mathlib/Algebra/Order/Sub/WithTop.lean
55
55
theorem sub_top {a : WithTop Ξ±} : a - ⊀ = (βŠ₯ : Ξ±) := by
cases a <;> rfl
true
import Mathlib.Computability.Halting import Mathlib.Computability.TuringMachine import Mathlib.Data.Num.Lemmas import Mathlib.Tactic.DeriveFintype #align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" open Function (update) open Relation namespace Turing namespace ToPartrec inductive Code | zero' | succ | tail | cons : Code β†’ Code β†’ Code | comp : Code β†’ Code β†’ Code | case : Code β†’ Code β†’ Code | fix : Code β†’ Code deriving DecidableEq, Inhabited #align turing.to_partrec.code Turing.ToPartrec.Code #align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero' #align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ #align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail #align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons #align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp #align turing.to_partrec.code.case Turing.ToPartrec.Code.case #align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix def Code.eval : Code β†’ List β„• β†’. List β„• | Code.zero' => fun v => pure (0 :: v) | Code.succ => fun v => pure [v.headI.succ] | Code.tail => fun v => pure v.tail | Code.cons f fs => fun v => do let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) | Code.comp f g => fun v => g.eval v >>= f.eval | Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) | Code.fix f => PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail #align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval namespace Code @[simp] theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval] @[simp] theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by simp [eval] @[simp] theorem tail_eval : tail.eval = fun v => pure v.tail := by simp [eval] @[simp] theorem cons_eval (f fs) : (cons f fs).eval = fun v => do { let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) } := by simp [eval] @[simp] theorem comp_eval (f g) : (comp f g).eval = fun v => g.eval v >>= f.eval := by simp [eval] @[simp] theorem case_eval (f g) : (case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) := by simp [eval] @[simp] theorem fix_eval (f) : (fix f).eval = PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail := by simp [eval] def nil : Code := tail.comp succ #align turing.to_partrec.code.nil Turing.ToPartrec.Code.nil @[simp] theorem nil_eval (v) : nil.eval v = pure [] := by simp [nil] #align turing.to_partrec.code.nil_eval Turing.ToPartrec.Code.nil_eval def id : Code := tail.comp zero' #align turing.to_partrec.code.id Turing.ToPartrec.Code.id @[simp] theorem id_eval (v) : id.eval v = pure v := by simp [id] #align turing.to_partrec.code.id_eval Turing.ToPartrec.Code.id_eval def head : Code := cons id nil #align turing.to_partrec.code.head Turing.ToPartrec.Code.head @[simp] theorem head_eval (v) : head.eval v = pure [v.headI] := by simp [head] #align turing.to_partrec.code.head_eval Turing.ToPartrec.Code.head_eval def zero : Code := cons zero' nil #align turing.to_partrec.code.zero Turing.ToPartrec.Code.zero @[simp] theorem zero_eval (v) : zero.eval v = pure [0] := by simp [zero] #align turing.to_partrec.code.zero_eval Turing.ToPartrec.Code.zero_eval def pred : Code := case zero head #align turing.to_partrec.code.pred Turing.ToPartrec.Code.pred @[simp] theorem pred_eval (v) : pred.eval v = pure [v.headI.pred] := by simp [pred]; cases v.headI <;> simp #align turing.to_partrec.code.pred_eval Turing.ToPartrec.Code.pred_eval def rfind (f : Code) : Code := comp pred <| comp (fix <| cons f <| cons succ tail) zero' #align turing.to_partrec.code.rfind Turing.ToPartrec.Code.rfind def prec (f g : Code) : Code := let G := cons tail <| cons succ <| cons (comp pred tail) <| cons (comp g <| cons id <| comp tail tail) <| comp tail <| comp tail tail let F := case id <| comp (comp (comp tail tail) (fix G)) zero' cons (comp F (cons head <| cons (comp f tail) tail)) nil #align turing.to_partrec.code.prec Turing.ToPartrec.Code.prec attribute [-simp] Part.bind_eq_bind Part.map_eq_map Part.pure_eq_some
Mathlib/Computability/TMToPartrec.lean
264
282
theorem exists_code.comp {m n} {f : Vector β„• n β†’. β„•} {g : Fin n β†’ Vector β„• m β†’. β„•} (hf : βˆƒ c : Code, βˆ€ v : Vector β„• n, c.eval v.1 = pure <$> f v) (hg : βˆ€ i, βˆƒ c : Code, βˆ€ v : Vector β„• m, c.eval v.1 = pure <$> g i v) : βˆƒ c : Code, βˆ€ v : Vector β„• m, c.eval v.1 = pure <$> ((Vector.mOfFn fun i => g i v) >>= f) := by rsuffices ⟨cg, hg⟩ :
rsuffices ⟨cg, hg⟩ : βˆƒ c : Code, βˆ€ v : Vector β„• m, c.eval v.1 = Subtype.val <$> Vector.mOfFn fun i => g i v Β· obtain ⟨cf, hf⟩ := hf exact ⟨cf.comp cg, fun v => by simp [hg, hf, map_bind, seq_bind_eq, Function.comp] rfl⟩ clear hf f; induction' n with n IH Β· exact ⟨nil, fun v => by simp [Vector.mOfFn, Bind.bind]; rfl⟩ Β· obtain ⟨cg, hgβ‚βŸ© := hg 0 obtain ⟨cl, hl⟩ := IH fun i => hg i.succ exact ⟨cons cg cl, fun v => by simp [Vector.mOfFn, hg₁, map_bind, seq_bind_eq, bind_assoc, (Β· ∘ Β·), hl] rfl⟩
true
import Mathlib.Data.DFinsupp.Basic import Mathlib.Data.Finset.Pointwise import Mathlib.LinearAlgebra.Basis.VectorSpace #align_import algebra.group.unique_prods from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" @[to_additive "Let `G` be a Type with addition, let `A B : Finset G` be finite subsets and let `a0 b0 : G` be two elements. `UniqueAdd A B a0 b0` asserts `a0 + b0` can be written in at most one way as a sum of an element from `A` and an element from `B`."] def UniqueMul {G} [Mul G] (A B : Finset G) (a0 b0 : G) : Prop := βˆ€ ⦃a b⦄, a ∈ A β†’ b ∈ B β†’ a * b = a0 * b0 β†’ a = a0 ∧ b = b0 #align unique_mul UniqueMul #align unique_add UniqueAdd namespace UniqueMul variable {G H : Type*} [Mul G] [Mul H] {A B : Finset G} {a0 b0 : G} @[to_additive (attr := nontriviality, simp)] theorem of_subsingleton [Subsingleton G] : UniqueMul A B a0 b0 := by simp [UniqueMul, eq_iff_true_of_subsingleton] @[to_additive] theorem of_card_le_one (hA : A.Nonempty) (hB : B.Nonempty) (hA1 : A.card ≀ 1) (hB1 : B.card ≀ 1) : βˆƒ a ∈ A, βˆƒ b ∈ B, UniqueMul A B a b := by rw [Finset.card_le_one_iff] at hA1 hB1 obtain ⟨a, ha⟩ := hA; obtain ⟨b, hb⟩ := hB exact ⟨a, ha, b, hb, fun _ _ ha' hb' _ ↦ ⟨hA1 ha' ha, hB1 hb' hb⟩⟩ @[to_additive] theorem mt (h : UniqueMul A B a0 b0) : βˆ€ ⦃a b⦄, a ∈ A β†’ b ∈ B β†’ a β‰  a0 ∨ b β‰  b0 β†’ a * b β‰  a0 * b0 := fun _ _ ha hb k ↦ by contrapose! k exact h ha hb k #align unique_mul.mt UniqueMul.mt @[to_additive] theorem subsingleton (h : UniqueMul A B a0 b0) : Subsingleton { ab : G Γ— G // ab.1 ∈ A ∧ ab.2 ∈ B ∧ ab.1 * ab.2 = a0 * b0 } := ⟨fun ⟨⟨_a, _b⟩, ha, hb, ab⟩ ⟨⟨_a', _b'⟩, ha', hb', ab'⟩ ↦ Subtype.ext <| Prod.ext ((h ha hb ab).1.trans (h ha' hb' ab').1.symm) <| (h ha hb ab).2.trans (h ha' hb' ab').2.symm⟩ #align unique_mul.subsingleton UniqueMul.subsingleton #align unique_add.subsingleton UniqueAdd.subsingleton @[to_additive]
Mathlib/Algebra/Group/UniqueProds.lean
95
101
theorem set_subsingleton (h : UniqueMul A B a0 b0) : Set.Subsingleton { ab : G Γ— G | ab.1 ∈ A ∧ ab.2 ∈ B ∧ ab.1 * ab.2 = a0 * b0 } := by rintro ⟨x1, y1⟩ (hx : x1 ∈ A ∧ y1 ∈ B ∧ x1 * y1 = a0 * b0) ⟨x2, y2⟩
rintro ⟨x1, y1⟩ (hx : x1 ∈ A ∧ y1 ∈ B ∧ x1 * y1 = a0 * b0) ⟨x2, y2⟩ (hy : x2 ∈ A ∧ y2 ∈ B ∧ x2 * y2 = a0 * b0) rcases h hx.1 hx.2.1 hx.2.2 with ⟨rfl, rfl⟩ rcases h hy.1 hy.2.1 hy.2.2 with ⟨rfl, rfl⟩ rfl
true
import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Group.Units import Mathlib.Algebra.Regular.Basic import Mathlib.GroupTheory.Congruence.Basic import Mathlib.Init.Data.Prod import Mathlib.RingTheory.OreLocalization.Basic #align_import group_theory.monoid_localization from "leanprover-community/mathlib"@"10ee941346c27bdb5e87bb3535100c0b1f08ac41" open Function section CommMonoid variable {M : Type*} [CommMonoid M] (S : Submonoid M) (N : Type*) [CommMonoid N] {P : Type*} [CommMonoid P] namespace Localization -- Porting note: this does not work so it is done explicitly instead -- run_cmd to_additive.map_namespace `Localization `AddLocalization -- run_cmd Elab.Command.liftCoreM <| ToAdditive.insertTranslation `Localization `AddLocalization @[to_additive AddLocalization.r "The congruence relation on `M Γ— S`, `M` an `AddCommMonoid` and `S` an `AddSubmonoid` of `M`, whose quotient is the localization of `M` at `S`, defined as the unique congruence relation on `M Γ— S` such that for any other congruence relation `s` on `M Γ— S` where for all `y ∈ S`, `(0, 0) ∼ (y, y)` under `s`, we have that `(x₁, y₁) ∼ (xβ‚‚, yβ‚‚)` by `r` implies `(x₁, y₁) ∼ (xβ‚‚, yβ‚‚)` by `s`."] def r (S : Submonoid M) : Con (M Γ— S) := sInf { c | βˆ€ y : S, c 1 (y, y) } #align localization.r Localization.r #align add_localization.r AddLocalization.r @[to_additive AddLocalization.r' "An alternate form of the congruence relation on `M Γ— S`, `M` a `CommMonoid` and `S` a submonoid of `M`, whose quotient is the localization of `M` at `S`."] def r' : Con (M Γ— S) := by -- note we multiply by `c` on the left so that we can later generalize to `β€’` refine { r := fun a b : M Γ— S ↦ βˆƒ c : S, ↑c * (↑b.2 * a.1) = c * (a.2 * b.1) iseqv := ⟨fun a ↦ ⟨1, rfl⟩, fun ⟨c, hc⟩ ↦ ⟨c, hc.symm⟩, ?_⟩ mul' := ?_ } Β· rintro a b c ⟨t₁, htβ‚βŸ© ⟨tβ‚‚, htβ‚‚βŸ© use tβ‚‚ * t₁ * b.2 simp only [Submonoid.coe_mul] calc (tβ‚‚ * t₁ * b.2 : M) * (c.2 * a.1) = tβ‚‚ * c.2 * (t₁ * (b.2 * a.1)) := by ac_rfl _ = t₁ * a.2 * (tβ‚‚ * (c.2 * b.1)) := by rw [ht₁]; ac_rfl _ = tβ‚‚ * t₁ * b.2 * (a.2 * c.1) := by rw [htβ‚‚]; ac_rfl Β· rintro a b c d ⟨t₁, htβ‚βŸ© ⟨tβ‚‚, htβ‚‚βŸ© use tβ‚‚ * t₁ calc (tβ‚‚ * t₁ : M) * (b.2 * d.2 * (a.1 * c.1)) = tβ‚‚ * (d.2 * c.1) * (t₁ * (b.2 * a.1)) := by ac_rfl _ = (tβ‚‚ * t₁ : M) * (a.2 * c.2 * (b.1 * d.1)) := by rw [ht₁, htβ‚‚]; ac_rfl #align localization.r' Localization.r' #align add_localization.r' AddLocalization.r' @[to_additive AddLocalization.r_eq_r' "The additive congruence relation used to localize an `AddCommMonoid` at a submonoid can be expressed equivalently as an infimum (see `AddLocalization.r`) or explicitly (see `AddLocalization.r'`)."] theorem r_eq_r' : r S = r' S := le_antisymm (sInf_le fun _ ↦ ⟨1, by simp⟩) <| le_sInf fun b H ⟨p, q⟩ ⟨x, y⟩ ⟨t, ht⟩ ↦ by rw [← one_mul (p, q), ← one_mul (x, y)] refine b.trans (b.mul (H (t * y)) (b.refl _)) ?_ convert b.symm (b.mul (H (t * q)) (b.refl (x, y))) using 1 dsimp only [Prod.mk_mul_mk, Submonoid.coe_mul] at ht ⊒ simp_rw [mul_assoc, ht, mul_comm y q] #align localization.r_eq_r' Localization.r_eq_r' #align add_localization.r_eq_r' AddLocalization.r_eq_r' variable {S} @[to_additive AddLocalization.r_iff_exists]
Mathlib/GroupTheory/MonoidLocalization.lean
206
207
theorem r_iff_exists {x y : M Γ— S} : r S x y ↔ βˆƒ c : S, ↑c * (↑y.2 * x.1) = c * (x.2 * y.1) := by
rw [r_eq_r' S]; rfl
true
import Mathlib.SetTheory.Ordinal.Arithmetic namespace OrdinalApprox universe u variable {Ξ± : Type u} variable [CompleteLattice Ξ±] (f : Ξ± β†’o Ξ±) (x : Ξ±) open Function fixedPoints Cardinal Order OrderHom set_option linter.unusedVariables false in def lfpApprox (a : Ordinal.{u}) : Ξ± := sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } βˆͺ {x}) termination_by a decreasing_by exact h theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by unfold Monotone; intros a b h; unfold lfpApprox refine sSup_le_sSup ?h apply sup_le_sup_right simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ‚‚] intros a' h' use a' exact ⟨lt_of_lt_of_le h' h, rfl⟩ theorem le_lfpApprox {a : Ordinal} : x ≀ lfpApprox f x a := by unfold lfpApprox apply le_sSup simp only [exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq, true_or]
Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean
92
112
theorem lfpApprox_add_one (h : x ≀ f x) (a : Ordinal) : lfpApprox f x (a+1) = f (lfpApprox f x a) := by apply le_antisymm
apply le_antisymm Β· conv => left; unfold lfpApprox apply sSup_le simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq, forall_eq_or_imp, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ‚‚] apply And.intro Β· apply le_trans h apply Monotone.imp f.monotone exact le_lfpApprox f x Β· intros a' h apply f.2; apply lfpApprox_monotone; exact h Β· conv => right; unfold lfpApprox apply le_sSup simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop] rw [Set.mem_union] apply Or.inl simp only [Set.mem_setOf_eq] use a
true
import Mathlib.Data.TypeMax import Mathlib.Logic.UnivLE import Mathlib.CategoryTheory.Limits.Shapes.Images #align_import category_theory.limits.types from "leanprover-community/mathlib"@"4aa2a2e17940311e47007f087c9df229e7f12942" open CategoryTheory CategoryTheory.Limits universe v u w namespace CategoryTheory.Limits namespace Types section limit_characterization variable {J : Type v} [Category.{w} J] {F : J β₯€ Type u} def coneOfSection {s} (hs : s ∈ F.sections) : Cone F where pt := PUnit Ο€ := { app := fun j _ ↦ s j, naturality := fun i j f ↦ by ext; exact (hs f).symm } def sectionOfCone (c : Cone F) (x : c.pt) : F.sections := ⟨fun j ↦ c.Ο€.app j x, fun f ↦ congr_fun (c.Ο€.naturality f).symm x⟩ theorem isLimit_iff (c : Cone F) : Nonempty (IsLimit c) ↔ βˆ€ s ∈ F.sections, βˆƒ! x : c.pt, βˆ€ j, c.Ο€.app j x = s j := by refine ⟨fun ⟨t⟩ s hs ↦ ?_, fun h ↦ ⟨?_⟩⟩ Β· let cs := coneOfSection hs exact ⟨t.lift cs ⟨⟩, fun j ↦ congr_fun (t.fac cs j) ⟨⟩, fun x hx ↦ congr_fun (t.uniq cs (fun _ ↦ x) fun j ↦ funext fun _ ↦ hx j) ⟨⟩⟩ Β· choose x hx using fun c y ↦ h _ (sectionOfCone c y).2 exact ⟨x, fun c j ↦ funext fun y ↦ (hx c y).1 j, fun c f hf ↦ funext fun y ↦ (hx c y).2 (f y) (fun j ↦ congr_fun (hf j) y)⟩ theorem isLimit_iff_bijective_sectionOfCone (c : Cone F) : Nonempty (IsLimit c) ↔ (Types.sectionOfCone c).Bijective := by simp_rw [isLimit_iff, Function.bijective_iff_existsUnique, Subtype.forall, F.sections_ext_iff, sectionOfCone] noncomputable def isLimitEquivSections {c : Cone F} (t : IsLimit c) : c.pt ≃ F.sections where toFun := sectionOfCone c invFun s := t.lift (coneOfSection s.2) ⟨⟩ left_inv x := (congr_fun (t.uniq (coneOfSection _) (fun _ ↦ x) fun _ ↦ rfl) ⟨⟩).symm right_inv s := Subtype.ext (funext fun j ↦ congr_fun (t.fac (coneOfSection s.2) j) ⟨⟩) #align category_theory.limits.types.is_limit_equiv_sections CategoryTheory.Limits.Types.isLimitEquivSections @[simp] theorem isLimitEquivSections_apply {c : Cone F} (t : IsLimit c) (j : J) (x : c.pt) : (isLimitEquivSections t x : βˆ€ j, F.obj j) j = c.Ο€.app j x := rfl #align category_theory.limits.types.is_limit_equiv_sections_apply CategoryTheory.Limits.Types.isLimitEquivSections_apply @[simp]
Mathlib/CategoryTheory/Limits/Types.lean
83
87
theorem isLimitEquivSections_symm_apply {c : Cone F} (t : IsLimit c) (x : F.sections) (j : J) : c.Ο€.app j ((isLimitEquivSections t).symm x) = (x : βˆ€ j, F.obj j) j := by conv_rhs => rw [← (isLimitEquivSections t).right_inv x]
conv_rhs => rw [← (isLimitEquivSections t).right_inv x] rfl
true
import Mathlib.Topology.Category.Profinite.Basic universe u namespace Profinite variable {ΞΉ : Type u} {X : ΞΉ β†’ Type} [βˆ€ i, TopologicalSpace (X i)] (C : Set ((i : ΞΉ) β†’ X i)) (J K : ΞΉ β†’ Prop) namespace IndexFunctor open ContinuousMap def obj : Set ((i : {i : ΞΉ // J i}) β†’ X i) := ContinuousMap.precomp (Subtype.val (p := J)) '' C def Ο€_app : C(C, obj C J) := ⟨Set.MapsTo.restrict (precomp (Subtype.val (p := J))) _ _ (Set.mapsTo_image _ _), Continuous.restrict _ (Pi.continuous_precomp' _)⟩ variable {J K} def map (h : βˆ€ i, J i β†’ K i) : C(obj C K, obj C J) := ⟨Set.MapsTo.restrict (precomp (Set.inclusion h)) _ _ (fun _ hx ↦ by obtain ⟨y, hy⟩ := hx rw [← hy.2] exact ⟨y, hy.1, rfl⟩), Continuous.restrict _ (Pi.continuous_precomp' _)⟩
Mathlib/Topology/Category/Profinite/Product.lean
58
62
theorem surjective_Ο€_app : Function.Surjective (Ο€_app C J) := by intro x
intro x obtain ⟨y, hy⟩ := x.prop exact ⟨⟨y, hy.1⟩, Subtype.ext hy.2⟩
true
import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Metric Set open Pointwise Topology variable {π•œ E : Type*} variable [NormedField π•œ] section SeminormedAddCommGroup variable [SeminormedAddCommGroup E] [NormedSpace π•œ E] theorem smul_ball {c : π•œ} (hc : c β‰  0) (x : E) (r : ℝ) : c β€’ ball x r = ball (c β€’ x) (β€–cβ€– * r) := by ext y rw [mem_smul_set_iff_inv_smul_memβ‚€ hc] conv_lhs => rw [← inv_smul_smulβ‚€ hc x] simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smulβ‚€] #align smul_ball smul_ball theorem smul_unitBall {c : π•œ} (hc : c β‰  0) : c β€’ ball (0 : E) (1 : ℝ) = ball (0 : E) β€–cβ€– := by rw [_root_.smul_ball hc, smul_zero, mul_one] #align smul_unit_ball smul_unitBall
Mathlib/Analysis/NormedSpace/Pointwise.lean
95
101
theorem smul_sphere' {c : π•œ} (hc : c β‰  0) (x : E) (r : ℝ) : c β€’ sphere x r = sphere (c β€’ x) (β€–cβ€– * r) := by ext y
ext y rw [mem_smul_set_iff_inv_smul_memβ‚€ hc] conv_lhs => rw [← inv_smul_smulβ‚€ hc x] simp only [mem_sphere, dist_smulβ‚€, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r]
true
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic suppress_compilation open Bornology open Filter hiding map_smul open scoped Classical NNReal Topology Uniformity -- the `β‚—` subscript variables are for special cases about linear (as opposed to semilinear) maps variable {π•œ π•œβ‚‚ π•œβ‚ƒ E Eβ‚— F Fβ‚— G Gβ‚— 𝓕 : Type*} section SemiNormed open Metric ContinuousLinearMap variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup Eβ‚—] [SeminormedAddCommGroup F] [SeminormedAddCommGroup Fβ‚—] [SeminormedAddCommGroup G] [SeminormedAddCommGroup Gβ‚—] variable [NontriviallyNormedField π•œ] [NontriviallyNormedField π•œβ‚‚] [NontriviallyNormedField π•œβ‚ƒ] [NormedSpace π•œ E] [NormedSpace π•œ Eβ‚—] [NormedSpace π•œβ‚‚ F] [NormedSpace π•œ Fβ‚—] [NormedSpace π•œβ‚ƒ G] [NormedSpace π•œ Gβ‚—] {σ₁₂ : π•œ β†’+* π•œβ‚‚} {σ₂₃ : π•œβ‚‚ β†’+* π•œβ‚ƒ} {σ₁₃ : π•œ β†’+* π•œβ‚ƒ} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] variable [FunLike 𝓕 E F] namespace ContinuousLinearMap section OpNorm open Set Real section variable [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₃] (f g : E β†’SL[σ₁₂] F) (h : F β†’SL[σ₂₃] G) (x : E)
Mathlib/Analysis/NormedSpace/OperatorNorm/NNNorm.lean
49
53
theorem nnnorm_def (f : E β†’SL[σ₁₂] F) : β€–fβ€–β‚Š = sInf { c | βˆ€ x, β€–f xβ€–β‚Š ≀ c * β€–xβ€–β‚Š } := by ext
ext rw [NNReal.coe_sInf, coe_nnnorm, norm_def, NNReal.coe_image] simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_setOf_eq, NNReal.coe_mk, exists_prop]
true
import Mathlib.Analysis.Calculus.BumpFunction.Basic import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Function Filter Set Metric MeasureTheory FiniteDimensional Measure open scoped Topology namespace ContDiffBump variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HasContDiffBump E] [MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : β„•βˆž} {ΞΌ : Measure E} protected def normed (ΞΌ : Measure E) : E β†’ ℝ := fun x => f x / ∫ x, f x βˆ‚ΞΌ #align cont_diff_bump.normed ContDiffBump.normed theorem normed_def {ΞΌ : Measure E} (x : E) : f.normed ΞΌ x = f x / ∫ x, f x βˆ‚ΞΌ := rfl #align cont_diff_bump.normed_def ContDiffBump.normed_def theorem nonneg_normed (x : E) : 0 ≀ f.normed ΞΌ x := div_nonneg f.nonneg <| integral_nonneg f.nonneg' #align cont_diff_bump.nonneg_normed ContDiffBump.nonneg_normed theorem contDiff_normed {n : β„•βˆž} : ContDiff ℝ n (f.normed ΞΌ) := f.contDiff.div_const _ #align cont_diff_bump.cont_diff_normed ContDiffBump.contDiff_normed theorem continuous_normed : Continuous (f.normed ΞΌ) := f.continuous.div_const _ #align cont_diff_bump.continuous_normed ContDiffBump.continuous_normed
Mathlib/Analysis/Calculus/BumpFunction/Normed.lean
49
50
theorem normed_sub (x : E) : f.normed ΞΌ (c - x) = f.normed ΞΌ (c + x) := by
simp_rw [f.normed_def, f.sub]
true
import Mathlib.Algebra.Order.Floor import Mathlib.Algebra.Order.Field.Power import Mathlib.Data.Nat.Log #align_import data.int.log from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" variable {R : Type*} [LinearOrderedSemifield R] [FloorSemiring R] namespace Int def log (b : β„•) (r : R) : β„€ := if 1 ≀ r then Nat.log b ⌊rβŒ‹β‚Š else -Nat.clog b ⌈rβ»ΒΉβŒ‰β‚Š #align int.log Int.log theorem log_of_one_le_right (b : β„•) {r : R} (hr : 1 ≀ r) : log b r = Nat.log b ⌊rβŒ‹β‚Š := if_pos hr #align int.log_of_one_le_right Int.log_of_one_le_right theorem log_of_right_le_one (b : β„•) {r : R} (hr : r ≀ 1) : log b r = -Nat.clog b ⌈rβ»ΒΉβŒ‰β‚Š := by obtain rfl | hr := hr.eq_or_lt Β· rw [log, if_pos hr, inv_one, Nat.ceil_one, Nat.floor_one, Nat.log_one_right, Nat.clog_one_right, Int.ofNat_zero, neg_zero] Β· exact if_neg hr.not_le #align int.log_of_right_le_one Int.log_of_right_le_one @[simp, norm_cast] theorem log_natCast (b : β„•) (n : β„•) : log b (n : R) = Nat.log b n := by cases n Β· simp [log_of_right_le_one] Β· rw [log_of_one_le_right, Nat.floor_natCast] simp #align int.log_nat_cast Int.log_natCast -- See note [no_index around OfNat.ofNat] @[simp] theorem log_ofNat (b : β„•) (n : β„•) [n.AtLeastTwo] : log b (no_index (OfNat.ofNat n : R)) = Nat.log b (OfNat.ofNat n) := log_natCast b n
Mathlib/Data/Int/Log.lean
87
90
theorem log_of_left_le_one {b : β„•} (hb : b ≀ 1) (r : R) : log b r = 0 := by rcases le_total 1 r with h | h
rcases le_total 1 r with h | h Β· rw [log_of_one_le_right _ h, Nat.log_of_left_le_one hb, Int.ofNat_zero] Β· rw [log_of_right_le_one _ h, Nat.clog_of_left_le_one hb, Int.ofNat_zero, neg_zero]
true
import Mathlib.CategoryTheory.ConcreteCategory.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Limits.TypesFiltered import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.Tactic.ApplyFun #align_import category_theory.limits.concrete_category from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" universe t w v u r open CategoryTheory namespace CategoryTheory.Limits attribute [local instance] ConcreteCategory.instFunLike ConcreteCategory.hasCoeToSort section Colimits section variable {C : Type u} [Category.{v} C] [ConcreteCategory.{t} C] {J : Type w} [Category.{r} J] (F : J β₯€ C) [PreservesColimit F (forget C)] theorem Concrete.from_union_surjective_of_isColimit {D : Cocone F} (hD : IsColimit D) : let ff : (Ξ£j : J, F.obj j) β†’ D.pt := fun a => D.ΞΉ.app a.1 a.2 Function.Surjective ff := by intro ff x let E : Cocone (F β‹™ forget C) := (forget C).mapCocone D let hE : IsColimit E := isColimitOfPreserves (forget C) hD obtain ⟨j, y, hy⟩ := Types.jointly_surjective_of_isColimit hE x exact ⟨⟨j, y⟩, hy⟩ #align category_theory.limits.concrete.from_union_surjective_of_is_colimit CategoryTheory.Limits.Concrete.from_union_surjective_of_isColimit theorem Concrete.isColimit_exists_rep {D : Cocone F} (hD : IsColimit D) (x : D.pt) : βˆƒ (j : J) (y : F.obj j), D.ΞΉ.app j y = x := by obtain ⟨a, rfl⟩ := Concrete.from_union_surjective_of_isColimit F hD x exact ⟨a.1, a.2, rfl⟩ #align category_theory.limits.concrete.is_colimit_exists_rep CategoryTheory.Limits.Concrete.isColimit_exists_rep theorem Concrete.colimit_exists_rep [HasColimit F] (x : ↑(colimit F)) : βˆƒ (j : J) (y : F.obj j), colimit.ΞΉ F j y = x := Concrete.isColimit_exists_rep F (colimit.isColimit _) x #align category_theory.limits.concrete.colimit_exists_rep CategoryTheory.Limits.Concrete.colimit_exists_rep theorem Concrete.isColimit_rep_eq_of_exists {D : Cocone F} {i j : J} (x : F.obj i) (y : F.obj j) (h : βˆƒ (k : _) (f : i ⟢ k) (g : j ⟢ k), F.map f x = F.map g y) : D.ΞΉ.app i x = D.ΞΉ.app j y := by let E := (forget C).mapCocone D obtain ⟨k, f, g, (hfg : (F β‹™ forget C).map f x = F.map g y)⟩ := h let h1 : (F β‹™ forget C).map f ≫ E.ΞΉ.app k = E.ΞΉ.app i := E.ΞΉ.naturality f let h2 : (F β‹™ forget C).map g ≫ E.ΞΉ.app k = E.ΞΉ.app j := E.ΞΉ.naturality g show E.ΞΉ.app i x = E.ΞΉ.app j y rw [← h1, types_comp_apply, hfg] exact congrFun h2 y #align category_theory.limits.concrete.is_colimit_rep_eq_of_exists CategoryTheory.Limits.Concrete.isColimit_rep_eq_of_exists theorem Concrete.colimit_rep_eq_of_exists [HasColimit F] {i j : J} (x : F.obj i) (y : F.obj j) (h : βˆƒ (k : _) (f : i ⟢ k) (g : j ⟢ k), F.map f x = F.map g y) : colimit.ΞΉ F i x = colimit.ΞΉ F j y := Concrete.isColimit_rep_eq_of_exists F x y h #align category_theory.limits.concrete.colimit_rep_eq_of_exists CategoryTheory.Limits.Concrete.colimit_rep_eq_of_exists end section FilteredColimits variable {C : Type u} [Category.{v} C] [ConcreteCategory.{max t w} C] {J : Type w} [Category.{r} J] (F : J β₯€ C) [PreservesColimit F (forget C)] [IsFiltered J]
Mathlib/CategoryTheory/Limits/ConcreteCategory.lean
122
127
theorem Concrete.isColimit_exists_of_rep_eq {D : Cocone F} {i j : J} (hD : IsColimit D) (x : F.obj i) (y : F.obj j) (h : D.ΞΉ.app _ x = D.ΞΉ.app _ y) : βˆƒ (k : _) (f : i ⟢ k) (g : j ⟢ k), F.map f x = F.map g y := by let E := (forget C).mapCocone D
let E := (forget C).mapCocone D let hE : IsColimit E := isColimitOfPreserves _ hD exact (Types.FilteredColimit.isColimit_eq_iff (F β‹™ forget C) hE).mp h
true
import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.Size #align_import data.int.bitwise from "leanprover-community/mathlib"@"0743cc5d9d86bcd1bba10f480e948a257d65056f" #align_import init.data.int.bitwise from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd" namespace Int def div2 : β„€ β†’ β„€ | (n : β„•) => n.div2 | -[n +1] => negSucc n.div2 #align int.div2 Int.div2 def bodd : β„€ β†’ Bool | (n : β„•) => n.bodd | -[n +1] => not (n.bodd) #align int.bodd Int.bodd -- Porting note: `bit0, bit1` deprecated, do we need to adapt `bit`? set_option linter.deprecated false in def bit (b : Bool) : β„€ β†’ β„€ := cond b bit1 bit0 #align int.bit Int.bit def testBit : β„€ β†’ β„• β†’ Bool | (m : β„•), n => Nat.testBit m n | -[m +1], n => !(Nat.testBit m n) #align int.test_bit Int.testBit def natBitwise (f : Bool β†’ Bool β†’ Bool) (m n : β„•) : β„€ := cond (f false false) -[ Nat.bitwise (fun x y => not (f x y)) m n +1] (Nat.bitwise f m n) #align int.nat_bitwise Int.natBitwise def bitwise (f : Bool β†’ Bool β†’ Bool) : β„€ β†’ β„€ β†’ β„€ | (m : β„•), (n : β„•) => natBitwise f m n | (m : β„•), -[n +1] => natBitwise (fun x y => f x (not y)) m n | -[m +1], (n : β„•) => natBitwise (fun x y => f (not x) y) m n | -[m +1], -[n +1] => natBitwise (fun x y => f (not x) (not y)) m n #align int.bitwise Int.bitwise def lnot : β„€ β†’ β„€ | (m : β„•) => -[m +1] | -[m +1] => m #align int.lnot Int.lnot def lor : β„€ β†’ β„€ β†’ β„€ | (m : β„•), (n : β„•) => m ||| n | (m : β„•), -[n +1] => -[Nat.ldiff n m +1] | -[m +1], (n : β„•) => -[Nat.ldiff m n +1] | -[m +1], -[n +1] => -[m &&& n +1] #align int.lor Int.lor def land : β„€ β†’ β„€ β†’ β„€ | (m : β„•), (n : β„•) => m &&& n | (m : β„•), -[n +1] => Nat.ldiff m n | -[m +1], (n : β„•) => Nat.ldiff n m | -[m +1], -[n +1] => -[m ||| n +1] #align int.land Int.land -- Porting note: I don't know why `Nat.ldiff` got the prime, but I'm matching this change here def ldiff : β„€ β†’ β„€ β†’ β„€ | (m : β„•), (n : β„•) => Nat.ldiff m n | (m : β„•), -[n +1] => m &&& n | -[m +1], (n : β„•) => -[m ||| n +1] | -[m +1], -[n +1] => Nat.ldiff n m #align int.ldiff Int.ldiff -- Porting note: I don't know why `Nat.xor'` got the prime, but I'm matching this change here protected def xor : β„€ β†’ β„€ β†’ β„€ | (m : β„•), (n : β„•) => (m ^^^ n) | (m : β„•), -[n +1] => -[(m ^^^ n) +1] | -[m +1], (n : β„•) => -[(m ^^^ n) +1] | -[m +1], -[n +1] => (m ^^^ n) #align int.lxor Int.xor instance : ShiftLeft β„€ where shiftLeft | (m : β„•), (n : β„•) => Nat.shiftLeft' false m n | (m : β„•), -[n +1] => m >>> (Nat.succ n) | -[m +1], (n : β„•) => -[Nat.shiftLeft' true m n +1] | -[m +1], -[n +1] => -[m >>> (Nat.succ n) +1] #align int.shiftl ShiftLeft.shiftLeft instance : ShiftRight β„€ where shiftRight m n := m <<< (-n) #align int.shiftr ShiftRight.shiftRight @[simp] theorem bodd_zero : bodd 0 = false := rfl #align int.bodd_zero Int.bodd_zero @[simp] theorem bodd_one : bodd 1 = true := rfl #align int.bodd_one Int.bodd_one theorem bodd_two : bodd 2 = false := rfl #align int.bodd_two Int.bodd_two @[simp, norm_cast] theorem bodd_coe (n : β„•) : Int.bodd n = Nat.bodd n := rfl #align int.bodd_coe Int.bodd_coe @[simp]
Mathlib/Data/Int/Bitwise.lean
145
149
theorem bodd_subNatNat (m n : β„•) : bodd (subNatNat m n) = xor m.bodd n.bodd := by apply subNatNat_elim m n fun m n i => bodd i = xor m.bodd n.bodd <;>
apply subNatNat_elim m n fun m n i => bodd i = xor m.bodd n.bodd <;> intros i j <;> simp only [Int.bodd, Int.bodd_coe, Nat.bodd_add] <;> cases Nat.bodd i <;> simp
true
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} theorem linearIndependent_iff : LinearIndependent R v ↔ βˆ€ l, Finsupp.total ΞΉ M R v l = 0 β†’ l = 0 := by simp [LinearIndependent, LinearMap.ker_eq_bot'] #align linear_independent_iff linearIndependent_iff theorem linearIndependent_iff' : LinearIndependent R v ↔ βˆ€ s : Finset ΞΉ, βˆ€ g : ΞΉ β†’ R, βˆ‘ i ∈ s, g i β€’ v i = 0 β†’ βˆ€ i ∈ s, g i = 0 := linearIndependent_iff.trans ⟨fun hf s g hg i his => have h := hf (βˆ‘ i ∈ s, Finsupp.single i (g i)) <| by simpa only [map_sum, Finsupp.total_single] using hg calc g i = (Finsupp.lapply i : (ΞΉ β†’β‚€ R) β†’β‚—[R] R) (Finsupp.single i (g i)) := by { rw [Finsupp.lapply_apply, Finsupp.single_eq_same] } _ = βˆ‘ j ∈ s, (Finsupp.lapply i : (ΞΉ β†’β‚€ R) β†’β‚—[R] R) (Finsupp.single j (g j)) := Eq.symm <| Finset.sum_eq_single i (fun j _hjs hji => by rw [Finsupp.lapply_apply, Finsupp.single_eq_of_ne hji]) fun hnis => hnis.elim his _ = (βˆ‘ j ∈ s, Finsupp.single j (g j)) i := (map_sum ..).symm _ = 0 := DFunLike.ext_iff.1 h i, fun hf l hl => Finsupp.ext fun i => _root_.by_contradiction fun hni => hni <| hf _ _ hl _ <| Finsupp.mem_support_iff.2 hni⟩ #align linear_independent_iff' linearIndependent_iff' theorem linearIndependent_iff'' : LinearIndependent R v ↔ βˆ€ (s : Finset ΞΉ) (g : ΞΉ β†’ R), (βˆ€ i βˆ‰ s, g i = 0) β†’ βˆ‘ i ∈ s, g i β€’ v i = 0 β†’ βˆ€ i, g i = 0 := by classical exact linearIndependent_iff'.trans ⟨fun H s g hg hv i => if his : i ∈ s then H s g hv i his else hg i his, fun H s g hg i hi => by convert H s (fun j => if j ∈ s then g j else 0) (fun j hj => if_neg hj) (by simp_rw [ite_smul, zero_smul, Finset.sum_extend_by_zero, hg]) i exact (if_pos hi).symm⟩ #align linear_independent_iff'' linearIndependent_iff'' theorem not_linearIndependent_iff : Β¬LinearIndependent R v ↔ βˆƒ s : Finset ΞΉ, βˆƒ g : ΞΉ β†’ R, βˆ‘ i ∈ s, g i β€’ v i = 0 ∧ βˆƒ i ∈ s, g i β‰  0 := by rw [linearIndependent_iff'] simp only [exists_prop, not_forall] #align not_linear_independent_iff not_linearIndependent_iff theorem Fintype.linearIndependent_iff [Fintype ΞΉ] : LinearIndependent R v ↔ βˆ€ g : ΞΉ β†’ R, βˆ‘ i, g i β€’ v i = 0 β†’ βˆ€ i, g i = 0 := by refine ⟨fun H g => by simpa using linearIndependent_iff'.1 H Finset.univ g, fun H => linearIndependent_iff''.2 fun s g hg hs i => H _ ?_ _⟩ rw [← hs] refine (Finset.sum_subset (Finset.subset_univ _) fun i _ hi => ?_).symm rw [hg i hi, zero_smul] #align fintype.linear_independent_iff Fintype.linearIndependent_iff
Mathlib/LinearAlgebra/LinearIndependent.lean
186
189
theorem Fintype.linearIndependent_iff' [Fintype ΞΉ] [DecidableEq ΞΉ] : LinearIndependent R v ↔ LinearMap.ker (LinearMap.lsum R (fun _ ↦ R) β„• fun i ↦ LinearMap.id.smulRight (v i)) = βŠ₯ := by
simp [Fintype.linearIndependent_iff, LinearMap.ker_eq_bot', funext_iff]
true
import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Finset.Fin import Mathlib.Data.Finset.Sort import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fin import Mathlib.Tactic.NormNum.Ineq #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} [DecidableEq Ξ±] {Ξ² : Type v} namespace Equiv.Perm def modSwap (i j : Ξ±) : Setoid (Perm Ξ±) := ⟨fun Οƒ Ο„ => Οƒ = Ο„ ∨ Οƒ = swap i j * Ο„, fun Οƒ => Or.inl (refl Οƒ), fun {Οƒ Ο„} h => Or.casesOn h (fun h => Or.inl h.symm) fun h => Or.inr (by rw [h, swap_mul_self_mul]), fun {Οƒ Ο„ Ο…} hστ hτυ => by cases' hστ with hστ hστ <;> cases' hτυ with hτυ hτυ <;> try rw [hστ, hτυ, swap_mul_self_mul] <;> simp [hστ, hτυ] -- Porting note: should close goals, but doesn't Β· simp [hστ, hτυ] Β· simp [hστ, hτυ] Β· simp [hστ, hτυ]⟩ #align equiv.perm.mod_swap Equiv.Perm.modSwap noncomputable instance {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±] (i j : Ξ±) : DecidableRel (modSwap i j).r := fun _ _ => Or.decidable def swapFactorsAux : βˆ€ (l : List Ξ±) (f : Perm Ξ±), (βˆ€ {x}, f x β‰  x β†’ x ∈ l) β†’ { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } | [] => fun f h => ⟨[], Equiv.ext fun x => by rw [List.prod_nil] exact (Classical.not_not.1 (mt h (List.not_mem_nil _))).symm, by simp⟩ | x::l => fun f h => if hfx : x = f x then swapFactorsAux l f fun {y} hy => List.mem_of_ne_of_mem (fun h : y = x => by simp [h, hfx.symm] at hy) (h hy) else let m := swapFactorsAux l (swap x (f x) * f) fun {y} hy => have : f y β‰  y ∧ y β‰  x := ne_and_ne_of_swap_mul_apply_ne_self hy List.mem_of_ne_of_mem this.2 (h this.1) ⟨swap x (f x)::m.1, by rw [List.prod_cons, m.2.1, ← mul_assoc, mul_def (swap x (f x)), swap_swap, ← one_def, one_mul], fun {g} hg => ((List.mem_cons).1 hg).elim (fun h => ⟨x, f x, hfx, h⟩) (m.2.2 _)⟩ #align equiv.perm.swap_factors_aux Equiv.Perm.swapFactorsAux def swapFactors [Fintype Ξ±] [LinearOrder Ξ±] (f : Perm Ξ±) : { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } := swapFactorsAux ((@univ Ξ± _).sort (Β· ≀ Β·)) f fun {_ _} => (mem_sort _).2 (mem_univ _) #align equiv.perm.swap_factors Equiv.Perm.swapFactors def truncSwapFactors [Fintype Ξ±] (f : Perm Ξ±) : Trunc { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } := Quotient.recOnSubsingleton (@univ Ξ± _).1 (fun l h => Trunc.mk (swapFactorsAux l f (h _))) (show βˆ€ x, f x β‰  x β†’ x ∈ (@univ Ξ± _).1 from fun _ _ => mem_univ _) #align equiv.perm.trunc_swap_factors Equiv.Perm.truncSwapFactors @[elab_as_elim]
Mathlib/GroupTheory/Perm/Sign.lean
99
110
theorem swap_induction_on [Finite Ξ±] {P : Perm Ξ± β†’ Prop} (f : Perm Ξ±) : P 1 β†’ (βˆ€ f x y, x β‰  y β†’ P f β†’ P (swap x y * f)) β†’ P f := by cases nonempty_fintype Ξ±
cases nonempty_fintype Ξ± cases' (truncSwapFactors f).out with l hl induction' l with g l ih generalizing f Β· simp (config := { contextual := true }) only [hl.left.symm, List.prod_nil, forall_true_iff] Β· intro h1 hmul_swap rcases hl.2 g (by simp) with ⟨x, y, hxy⟩ rw [← hl.1, List.prod_cons, hxy.2] exact hmul_swap _ _ _ hxy.1 (ih _ ⟨rfl, fun v hv => hl.2 _ (List.mem_cons_of_mem _ hv)⟩ h1 hmul_swap)
true
def SatisfiesM {m : Type u β†’ Type v} [Functor m] (p : Ξ± β†’ Prop) (x : m Ξ±) : Prop := βˆƒ x' : m {a // p a}, Subtype.val <$> x' = x @[simp] theorem SatisfiesM_Id_eq : SatisfiesM (m := Id) p x ↔ p x := ⟨fun ⟨y, eq⟩ => eq β–Έ y.2, fun h => ⟨⟨_, h⟩, rfl⟩⟩ @[simp] theorem SatisfiesM_Option_eq : SatisfiesM (m := Option) p x ↔ βˆ€ a, x = some a β†’ p a := ⟨by revert x; intro | some _, ⟨some ⟨_, h⟩, rfl⟩, _, rfl => exact h, fun h => match x with | some a => ⟨some ⟨a, h _ rfl⟩, rfl⟩ | none => ⟨none, rfl⟩⟩ @[simp] theorem SatisfiesM_Except_eq : SatisfiesM (m := Except Ξ΅) p x ↔ βˆ€ a, x = .ok a β†’ p a := ⟨by revert x; intro | .ok _, ⟨.ok ⟨_, h⟩, rfl⟩, _, rfl => exact h, fun h => match x with | .ok a => ⟨.ok ⟨a, h _ rfl⟩, rfl⟩ | .error e => ⟨.error e, rfl⟩⟩ @[simp] theorem SatisfiesM_ReaderT_eq [Monad m] : SatisfiesM (m := ReaderT ρ m) p x ↔ βˆ€ s, SatisfiesM p (x s) := (exists_congr fun a => by exact ⟨fun eq _ => eq β–Έ rfl, funext⟩).trans Classical.skolem.symm
.lake/packages/batteries/Batteries/Classes/SatisfiesM.lean
165
166
theorem SatisfiesM_StateRefT_eq [Monad m] : SatisfiesM (m := StateRefT' Ο‰ Οƒ m) p x ↔ βˆ€ s, SatisfiesM p (x s) := by
simp
true
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" namespace MeasureTheory open Filter open scoped ENNReal variable {Ξ± E : Type*} {m m0 : MeasurableSpace Ξ±} {p : ℝβ‰₯0∞} {q : ℝ} {ΞΌ : Measure Ξ±} [NormedAddCommGroup E] theorem snorm'_trim (hm : m ≀ m0) {f : Ξ± β†’ E} (hf : StronglyMeasurable[m] f) : snorm' f q (ΞΌ.trim hm) = snorm' f q ΞΌ := by simp_rw [snorm'] congr 1 refine lintegral_trim hm ?_ refine @Measurable.pow_const _ _ _ _ _ _ _ m _ (@Measurable.coe_nnreal_ennreal _ m _ ?_) q apply @StronglyMeasurable.measurable exact @StronglyMeasurable.nnnorm Ξ± m _ _ _ hf #align measure_theory.snorm'_trim MeasureTheory.snorm'_trim theorem limsup_trim (hm : m ≀ m0) {f : Ξ± β†’ ℝβ‰₯0∞} (hf : Measurable[m] f) : limsup f (ae (ΞΌ.trim hm)) = limsup f (ae ΞΌ) := by simp_rw [limsup_eq] suffices h_set_eq : { a : ℝβ‰₯0∞ | βˆ€α΅ n βˆ‚ΞΌ.trim hm, f n ≀ a } = { a : ℝβ‰₯0∞ | βˆ€α΅ n βˆ‚ΞΌ, f n ≀ a } by rw [h_set_eq] ext1 a suffices h_meas_eq : ΞΌ { x | Β¬f x ≀ a } = ΞΌ.trim hm { x | Β¬f x ≀ a } by simp_rw [Set.mem_setOf_eq, ae_iff, h_meas_eq] refine (trim_measurableSet_eq hm ?_).symm refine @MeasurableSet.compl _ _ m (@measurableSet_le ℝβ‰₯0∞ _ _ _ _ m _ _ _ _ _ hf ?_) exact @measurable_const _ _ _ m _ #align measure_theory.limsup_trim MeasureTheory.limsup_trim
Mathlib/MeasureTheory/Function/LpSeminorm/Trim.lean
48
51
theorem essSup_trim (hm : m ≀ m0) {f : Ξ± β†’ ℝβ‰₯0∞} (hf : Measurable[m] f) : essSup f (ΞΌ.trim hm) = essSup f ΞΌ := by simp_rw [essSup]
simp_rw [essSup] exact limsup_trim hm hf
true
import Mathlib.Data.Int.Bitwise import Mathlib.Data.Int.Order.Lemmas import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.Basic #align_import data.int.lemmas from "leanprover-community/mathlib"@"09597669f02422ed388036273d8848119699c22f" open Nat namespace Int theorem le_natCast_sub (m n : β„•) : (m - n : β„€) ≀ ↑(m - n : β„•) := by by_cases h : m β‰₯ n Β· exact le_of_eq (Int.ofNat_sub h).symm Β· simp [le_of_not_ge h, ofNat_le] #align int.le_coe_nat_sub Int.le_natCast_sub -- Porting note (#10618): simp can prove this @[simp] theorem succ_natCast_pos (n : β„•) : 0 < (n : β„€) + 1 := lt_add_one_iff.mpr (by simp) #align int.succ_coe_nat_pos Int.succ_natCast_pos variable {a b : β„€} {n : β„•} theorem natAbs_eq_iff_sq_eq {a b : β„€} : a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2 := by rw [sq, sq] exact natAbs_eq_iff_mul_self_eq #align int.nat_abs_eq_iff_sq_eq Int.natAbs_eq_iff_sq_eq theorem natAbs_lt_iff_sq_lt {a b : β„€} : a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2 := by rw [sq, sq] exact natAbs_lt_iff_mul_self_lt #align int.nat_abs_lt_iff_sq_lt Int.natAbs_lt_iff_sq_lt theorem natAbs_le_iff_sq_le {a b : β„€} : a.natAbs ≀ b.natAbs ↔ a ^ 2 ≀ b ^ 2 := by rw [sq, sq] exact natAbs_le_iff_mul_self_le #align int.nat_abs_le_iff_sq_le Int.natAbs_le_iff_sq_le theorem natAbs_inj_of_nonneg_of_nonneg {a b : β„€} (ha : 0 ≀ a) (hb : 0 ≀ b) : natAbs a = natAbs b ↔ a = b := by rw [← sq_eq_sq ha hb, ← natAbs_eq_iff_sq_eq] #align int.nat_abs_inj_of_nonneg_of_nonneg Int.natAbs_inj_of_nonneg_of_nonneg theorem natAbs_inj_of_nonpos_of_nonpos {a b : β„€} (ha : a ≀ 0) (hb : b ≀ 0) : natAbs a = natAbs b ↔ a = b := by simpa only [Int.natAbs_neg, neg_inj] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) (neg_nonneg_of_nonpos hb) #align int.nat_abs_inj_of_nonpos_of_nonpos Int.natAbs_inj_of_nonpos_of_nonpos theorem natAbs_inj_of_nonneg_of_nonpos {a b : β„€} (ha : 0 ≀ a) (hb : b ≀ 0) : natAbs a = natAbs b ↔ a = -b := by simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg ha (neg_nonneg_of_nonpos hb) #align int.nat_abs_inj_of_nonneg_of_nonpos Int.natAbs_inj_of_nonneg_of_nonpos
Mathlib/Data/Int/Lemmas.lean
75
77
theorem natAbs_inj_of_nonpos_of_nonneg {a b : β„€} (ha : a ≀ 0) (hb : 0 ≀ b) : natAbs a = natAbs b ↔ -a = b := by
simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) hb
true
import Mathlib.Data.Nat.Totient import Mathlib.Data.Nat.Nth import Mathlib.NumberTheory.SmoothNumbers #align_import number_theory.prime_counting from "leanprover-community/mathlib"@"7fdd4f3746cb059edfdb5d52cba98f66fce418c0" namespace Nat open Finset def primeCounting' : β„• β†’ β„• := Nat.count Prime #align nat.prime_counting' Nat.primeCounting' def primeCounting (n : β„•) : β„• := primeCounting' (n + 1) #align nat.prime_counting Nat.primeCounting @[inherit_doc] scoped notation "Ο€" => Nat.primeCounting @[inherit_doc] scoped notation "Ο€'" => Nat.primeCounting' theorem monotone_primeCounting' : Monotone primeCounting' := count_monotone Prime #align nat.monotone_prime_counting' Nat.monotone_primeCounting' theorem monotone_primeCounting : Monotone primeCounting := monotone_primeCounting'.comp (monotone_id.add_const _) #align nat.monotone_prime_counting Nat.monotone_primeCounting @[simp] theorem primeCounting'_nth_eq (n : β„•) : Ο€' (nth Prime n) = n := count_nth_of_infinite infinite_setOf_prime _ #align nat.prime_counting'_nth_eq Nat.primeCounting'_nth_eq @[simp] theorem prime_nth_prime (n : β„•) : Prime (nth Prime n) := nth_mem_of_infinite infinite_setOf_prime _ #align nat.prime_nth_prime Nat.prime_nth_prime lemma primesBelow_card_eq_primeCounting' (n : β„•) : n.primesBelow.card = primeCounting' n := by simp only [primesBelow, primeCounting'] exact (count_eq_card_filter_range Prime n).symm
Mathlib/NumberTheory/PrimeCounting.lean
83
102
theorem primeCounting'_add_le {a k : β„•} (h0 : 0 < a) (h1 : a < k) (n : β„•) : Ο€' (k + n) ≀ Ο€' k + Nat.totient a * (n / a + 1) := calc Ο€' (k + n) ≀ ((range k).filter Prime).card + ((Ico k (k + n)).filter Prime).card := by rw [primeCounting', count_eq_card_filter_range, range_eq_Ico, ←
rw [primeCounting', count_eq_card_filter_range, range_eq_Ico, ← Ico_union_Ico_eq_Ico (zero_le k) le_self_add, filter_union] apply card_union_le _ ≀ Ο€' k + ((Ico k (k + n)).filter Prime).card := by rw [primeCounting', count_eq_card_filter_range] _ ≀ Ο€' k + ((Ico k (k + n)).filter (Coprime a)).card := by refine add_le_add_left (card_le_card ?_) k.primeCounting' simp only [subset_iff, and_imp, mem_filter, mem_Ico] intro p succ_k_le_p p_lt_n p_prime constructor Β· exact ⟨succ_k_le_p, p_lt_n⟩ Β· rw [coprime_comm] exact coprime_of_lt_prime h0 (gt_of_ge_of_gt succ_k_le_p h1) p_prime _ ≀ Ο€' k + totient a * (n / a + 1) := by rw [add_le_add_iff_left] exact Ico_filter_coprime_le k n h0
true
import Mathlib.Data.Set.Pointwise.Basic import Mathlib.Data.Set.MulAntidiagonal #align_import data.finset.mul_antidiagonal from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace Finset open Pointwise variable {Ξ± : Type*} variable [OrderedCancelCommMonoid Ξ±] {s t : Set Ξ±} (hs : s.IsPWO) (ht : t.IsPWO) (a : Ξ±) @[to_additive "`Finset.addAntidiagonal hs ht a` is the set of all pairs of an element in `s` and an element in `t` that add to `a`, but its construction requires proofs that `s` and `t` are well-ordered."] noncomputable def mulAntidiagonal : Finset (Ξ± Γ— Ξ±) := (Set.MulAntidiagonal.finite_of_isPWO hs ht a).toFinset #align finset.mul_antidiagonal Finset.mulAntidiagonal #align finset.add_antidiagonal Finset.addAntidiagonal variable {hs ht a} {u : Set Ξ±} {hu : u.IsPWO} {x : Ξ± Γ— Ξ±} @[to_additive (attr := simp)]
Mathlib/Data/Finset/MulAntidiagonal.lean
72
73
theorem mem_mulAntidiagonal : x ∈ mulAntidiagonal hs ht a ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ x.1 * x.2 = a := by
simp only [mulAntidiagonal, Set.Finite.mem_toFinset, Set.mem_mulAntidiagonal]
true
import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals import Mathlib.Analysis.Calculus.ParametricIntegral import Mathlib.MeasureTheory.Measure.Haar.NormedSpace #align_import analysis.mellin_transform from "leanprover-community/mathlib"@"917c3c072e487b3cccdbfeff17e75b40e45f66cb" open MeasureTheory Set Filter Asymptotics TopologicalSpace open Real open Complex hiding exp log abs_of_nonneg open scoped Topology noncomputable section section Defs variable {E : Type*} [NormedAddCommGroup E] [NormedSpace β„‚ E] def MellinConvergent (f : ℝ β†’ E) (s : β„‚) : Prop := IntegrableOn (fun t : ℝ => (t : β„‚) ^ (s - 1) β€’ f t) (Ioi 0) #align mellin_convergent MellinConvergent theorem MellinConvergent.const_smul {f : ℝ β†’ E} {s : β„‚} (hf : MellinConvergent f s) {π•œ : Type*} [NontriviallyNormedField π•œ] [NormedSpace π•œ E] [SMulCommClass β„‚ π•œ E] (c : π•œ) : MellinConvergent (fun t => c β€’ f t) s := by simpa only [MellinConvergent, smul_comm] using hf.smul c #align mellin_convergent.const_smul MellinConvergent.const_smul theorem MellinConvergent.cpow_smul {f : ℝ β†’ E} {s a : β„‚} : MellinConvergent (fun t => (t : β„‚) ^ a β€’ f t) s ↔ MellinConvergent f (s + a) := by refine integrableOn_congr_fun (fun t ht => ?_) measurableSet_Ioi simp_rw [← sub_add_eq_add_sub, cpow_add _ _ (ofReal_ne_zero.2 <| ne_of_gt ht), mul_smul] #align mellin_convergent.cpow_smul MellinConvergent.cpow_smul nonrec theorem MellinConvergent.div_const {f : ℝ β†’ β„‚} {s : β„‚} (hf : MellinConvergent f s) (a : β„‚) : MellinConvergent (fun t => f t / a) s := by simpa only [MellinConvergent, smul_eq_mul, ← mul_div_assoc] using hf.div_const a #align mellin_convergent.div_const MellinConvergent.div_const
Mathlib/Analysis/MellinTransform.lean
64
75
theorem MellinConvergent.comp_mul_left {f : ℝ β†’ E} {s : β„‚} {a : ℝ} (ha : 0 < a) : MellinConvergent (fun t => f (a * t)) s ↔ MellinConvergent f s := by have := integrableOn_Ioi_comp_mul_left_iff (fun t : ℝ => (t : β„‚) ^ (s - 1) β€’ f t) 0 ha
have := integrableOn_Ioi_comp_mul_left_iff (fun t : ℝ => (t : β„‚) ^ (s - 1) β€’ f t) 0 ha rw [mul_zero] at this have h1 : EqOn (fun t : ℝ => (↑(a * t) : β„‚) ^ (s - 1) β€’ f (a * t)) ((a : β„‚) ^ (s - 1) β€’ fun t : ℝ => (t : β„‚) ^ (s - 1) β€’ f (a * t)) (Ioi 0) := fun t ht ↦ by simp only [ofReal_mul, mul_cpow_ofReal_nonneg ha.le (le_of_lt ht), mul_smul, Pi.smul_apply] have h2 : (a : β„‚) ^ (s - 1) β‰  0 := by rw [Ne, cpow_eq_zero_iff, not_and_or, ofReal_eq_zero] exact Or.inl ha.ne' rw [MellinConvergent, MellinConvergent, ← this, integrableOn_congr_fun h1 measurableSet_Ioi, IntegrableOn, IntegrableOn, integrable_smul_iff h2]
true
import Mathlib.RingTheory.HahnSeries.Multiplication import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.Data.Finsupp.PWO #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical open Pointwise Polynomial noncomputable section variable {Ξ“ : Type*} {R : Type*} namespace HahnSeries section Semiring variable [Semiring R] @[simps] def toPowerSeries : HahnSeries β„• R ≃+* PowerSeries R where toFun f := PowerSeries.mk f.coeff invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩ left_inv f := by ext simp right_inv f := by ext simp map_add' f g := by ext simp map_mul' f g := by ext n simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support] classical refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <| sum_filter_ne_zero _ ext m simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter, mem_support] rintro h rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)] #align hahn_series.to_power_series HahnSeries.toPowerSeries theorem coeff_toPowerSeries {f : HahnSeries β„• R} {n : β„•} : PowerSeries.coeff R n (toPowerSeries f) = f.coeff n := PowerSeries.coeff_mk _ _ #align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : β„•} : (HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f := rfl #align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm variable (Ξ“ R) [StrictOrderedSemiring Ξ“] def ofPowerSeries : PowerSeries R β†’+* HahnSeries Ξ“ R := (HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Ξ“) Nat.strictMono_cast.injective fun _ _ => Nat.cast_le).comp (RingEquiv.toRingHom toPowerSeries.symm) #align hahn_series.of_power_series HahnSeries.ofPowerSeries variable {Ξ“} {R} theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Ξ“ R) := embDomain_injective.comp toPowerSeries.symm.injective #align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective theorem ofPowerSeries_apply (x : PowerSeries R) : ofPowerSeries Ξ“ R x = HahnSeries.embDomain ⟨⟨((↑) : β„• β†’ Ξ“), Nat.strictMono_cast.injective⟩, by simp only [Function.Embedding.coeFn_mk] exact Nat.cast_le⟩ (toPowerSeries.symm x) := rfl #align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : β„•) : (ofPowerSeries Ξ“ R x).coeff n = PowerSeries.coeff R n x := by simp [ofPowerSeries_apply] #align hahn_series.of_power_series_apply_coeff HahnSeries.ofPowerSeries_apply_coeff @[simp] theorem ofPowerSeries_C (r : R) : ofPowerSeries Ξ“ R (PowerSeries.C R r) = HahnSeries.C r := by ext n simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq, single_coeff] split_ifs with hn Β· subst hn convert @embDomain_coeff β„• R _ _ Ξ“ _ _ _ 0 <;> simp Β· rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_C] intro simp (config := { contextual := true }) [Ne.symm hn] #align hahn_series.of_power_series_C HahnSeries.ofPowerSeries_C @[simp]
Mathlib/RingTheory/HahnSeries/PowerSeries.lean
132
142
theorem ofPowerSeries_X : ofPowerSeries Ξ“ R PowerSeries.X = single 1 1 := by ext n
ext n simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk] split_ifs with hn Β· rw [hn] convert @embDomain_coeff β„• R _ _ Ξ“ _ _ _ 1 <;> simp Β· rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_X] intro simp (config := { contextual := true }) [Ne.symm hn]
true
import Mathlib.Analysis.Complex.Basic import Mathlib.FieldTheory.IntermediateField import Mathlib.Topology.Algebra.Field import Mathlib.Topology.Algebra.UniformRing #align_import topology.instances.complex from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" section ComplexSubfield open Complex Set open ComplexConjugate theorem Complex.subfield_eq_of_closed {K : Subfield β„‚} (hc : IsClosed (K : Set β„‚)) : K = ofReal.fieldRange ∨ K = ⊀ := by suffices range (ofReal' : ℝ β†’ β„‚) βŠ† K by rw [range_subset_iff, ← coe_algebraMap] at this have := (Subalgebra.isSimpleOrder_of_finrank finrank_real_complex).eq_bot_or_eq_top (Subfield.toIntermediateField K this).toSubalgebra simp_rw [← SetLike.coe_set_eq, IntermediateField.coe_toSubalgebra] at this ⊒ exact this suffices range (ofReal' : ℝ β†’ β„‚) βŠ† closure (Set.range ((ofReal' : ℝ β†’ β„‚) ∘ ((↑) : β„š β†’ ℝ))) by refine subset_trans this ?_ rw [← IsClosed.closure_eq hc] apply closure_mono rintro _ ⟨_, rfl⟩ simp only [Function.comp_apply, ofReal_ratCast, SetLike.mem_coe, SubfieldClass.ratCast_mem] nth_rw 1 [range_comp] refine subset_trans ?_ (image_closure_subset_closure_image continuous_ofReal) rw [DenseRange.closure_range Rat.denseEmbedding_coe_real.dense] simp only [image_univ] rfl #align complex.subfield_eq_of_closed Complex.subfield_eq_of_closed
Mathlib/Topology/Instances/Complex.lean
50
116
theorem Complex.uniformContinuous_ringHom_eq_id_or_conj (K : Subfield β„‚) {ψ : K β†’+* β„‚} (hc : UniformContinuous ψ) : ψ.toFun = K.subtype ∨ ψ.toFun = conj ∘ K.subtype := by letI : TopologicalDivisionRing β„‚ := TopologicalDivisionRing.mk
letI : TopologicalDivisionRing β„‚ := TopologicalDivisionRing.mk letI : TopologicalRing K.topologicalClosure := Subring.instTopologicalRing K.topologicalClosure.toSubring set ΞΉ : K β†’ K.topologicalClosure := ⇑(Subfield.inclusion K.le_topologicalClosure) have ui : UniformInducing ΞΉ := ⟨by erw [uniformity_subtype, uniformity_subtype, Filter.comap_comap] congr ⟩ let di := ui.denseInducing (?_ : DenseRange ΞΉ) Β· -- extψ : closure(K) β†’+* β„‚ is the extension of ψ : K β†’+* β„‚ let extψ := DenseInducing.extendRingHom ui di.dense hc haveI hψ := (uniformContinuous_uniformly_extend ui di.dense hc).continuous cases' Complex.subfield_eq_of_closed (Subfield.isClosed_topologicalClosure K) with h h Β· left let j := RingEquiv.subfieldCongr h -- Οˆβ‚ is the continuous ring hom `ℝ β†’+* β„‚` constructed from `j : closure (K) ≃+* ℝ` -- and `extψ : closure (K) β†’+* β„‚` let Οˆβ‚ := RingHom.comp extψ (RingHom.comp j.symm.toRingHom ofReal.rangeRestrict) -- Porting note: was `by continuity!` and was used inline have hΟˆβ‚ : Continuous Οˆβ‚ := by simpa only [RingHom.coe_comp] using hψ.comp ((continuous_algebraMap ℝ β„‚).subtype_mk _) ext1 x rsuffices ⟨r, hr⟩ : βˆƒ r : ℝ, ofReal.rangeRestrict r = j (ΞΉ x) Β· have := RingHom.congr_fun (ringHom_eq_ofReal_of_continuous hΟˆβ‚) r -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [RingHom.comp_apply, RingHom.comp_apply, hr, RingEquiv.toRingHom_eq_coe] at this convert this using 1 Β· exact (DenseInducing.extend_eq di hc.continuous _).symm Β· rw [← ofReal.coe_rangeRestrict, hr] rfl obtain ⟨r, hr⟩ := SetLike.coe_mem (j (ΞΉ x)) exact ⟨r, Subtype.ext hr⟩ Β· -- Οˆβ‚ is the continuous ring hom `β„‚ β†’+* β„‚` constructed from `closure (K) ≃+* β„‚` -- and `extψ : closure (K) β†’+* β„‚` let Οˆβ‚ := RingHom.comp extψ (RingHom.comp (RingEquiv.subfieldCongr h).symm.toRingHom (@Subfield.topEquiv β„‚ _).symm.toRingHom) -- Porting note: was `by continuity!` and was used inline have hΟˆβ‚ : Continuous Οˆβ‚ := by simpa only [RingHom.coe_comp] using hψ.comp (continuous_id.subtype_mk _) cases' ringHom_eq_id_or_conj_of_continuous hΟˆβ‚ with h h Β· left ext1 z convert RingHom.congr_fun h z using 1 exact (DenseInducing.extend_eq di hc.continuous z).symm Β· right ext1 z convert RingHom.congr_fun h z using 1 exact (DenseInducing.extend_eq di hc.continuous z).symm Β· let j : { x // x ∈ closure (id '' { x | (K : Set β„‚) x }) } β†’ (K.topologicalClosure : Set β„‚) := fun x => ⟨x, by convert x.prop simp only [id, Set.image_id'] rfl ⟩ convert DenseRange.comp (Function.Surjective.denseRange _) (DenseEmbedding.subtype denseEmbedding_id (K : Set β„‚)).dense (by continuity : Continuous j) rintro ⟨y, hy⟩ use ⟨y, by convert hy simp only [id, Set.image_id'] rfl ⟩
true
import Mathlib.Analysis.Convex.Side import Mathlib.Geometry.Euclidean.Angle.Oriented.Rotation import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine #align_import geometry.euclidean.angle.oriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open FiniteDimensional Complex open scoped Affine EuclideanGeometry Real RealInnerProductSpace ComplexConjugate namespace EuclideanGeometry variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)] abbrev o := @Module.Oriented.positiveOrientation def oangle (p₁ pβ‚‚ p₃ : P) : Real.Angle := o.oangle (p₁ -α΅₯ pβ‚‚) (p₃ -α΅₯ pβ‚‚) #align euclidean_geometry.oangle EuclideanGeometry.oangle @[inherit_doc] scoped notation "∑" => EuclideanGeometry.oangle theorem continuousAt_oangle {x : P Γ— P Γ— P} (hx12 : x.1 β‰  x.2.1) (hx32 : x.2.2 β‰  x.2.1) : ContinuousAt (fun y : P Γ— P Γ— P => ∑ y.1 y.2.1 y.2.2) x := by let f : P Γ— P Γ— P β†’ V Γ— V := fun y => (y.1 -α΅₯ y.2.1, y.2.2 -α΅₯ y.2.1) have hf1 : (f x).1 β‰  0 := by simp [hx12] have hf2 : (f x).2 β‰  0 := by simp [hx32] exact (o.continuousAt_oangle hf1 hf2).comp ((continuous_fst.vsub continuous_snd.fst).prod_mk (continuous_snd.snd.vsub continuous_snd.fst)).continuousAt #align euclidean_geometry.continuous_at_oangle EuclideanGeometry.continuousAt_oangle @[simp] theorem oangle_self_left (p₁ pβ‚‚ : P) : ∑ p₁ p₁ pβ‚‚ = 0 := by simp [oangle] #align euclidean_geometry.oangle_self_left EuclideanGeometry.oangle_self_left @[simp]
Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean
65
65
theorem oangle_self_right (p₁ pβ‚‚ : P) : ∑ p₁ pβ‚‚ pβ‚‚ = 0 := by
simp [oangle]
true
import Mathlib.Algebra.MvPolynomial.Derivation import Mathlib.Algebra.MvPolynomial.Variables #align_import data.mv_polynomial.pderiv from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section universe u v namespace MvPolynomial open Set Function Finsupp variable {R : Type u} {Οƒ : Type v} {a a' a₁ aβ‚‚ : R} {s : Οƒ β†’β‚€ β„•} section PDeriv variable [CommSemiring R] def pderiv (i : Οƒ) : Derivation R (MvPolynomial Οƒ R) (MvPolynomial Οƒ R) := letI := Classical.decEq Οƒ mkDerivation R <| Pi.single i 1 #align mv_polynomial.pderiv MvPolynomial.pderiv theorem pderiv_def [DecidableEq Οƒ] (i : Οƒ) : pderiv i = mkDerivation R (Pi.single i 1) := by unfold pderiv; congr! #align mv_polynomial.pderiv_def MvPolynomial.pderiv_def @[simp] theorem pderiv_monomial {i : Οƒ} : pderiv i (monomial s a) = monomial (s - single i 1) (a * s i) := by classical simp only [pderiv_def, mkDerivation_monomial, Finsupp.smul_sum, smul_eq_mul, ← smul_mul_assoc, ← (monomial _).map_smul] refine (Finset.sum_eq_single i (fun j _ hne => ?_) fun hi => ?_).trans ?_ Β· simp [Pi.single_eq_of_ne hne] Β· rw [Finsupp.not_mem_support_iff] at hi; simp [hi] Β· simp #align mv_polynomial.pderiv_monomial MvPolynomial.pderiv_monomial theorem pderiv_C {i : Οƒ} : pderiv i (C a) = 0 := derivation_C _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.pderiv_C MvPolynomial.pderiv_C theorem pderiv_one {i : Οƒ} : pderiv i (1 : MvPolynomial Οƒ R) = 0 := pderiv_C #align mv_polynomial.pderiv_one MvPolynomial.pderiv_one @[simp] theorem pderiv_X [DecidableEq Οƒ] (i j : Οƒ) : pderiv i (X j : MvPolynomial Οƒ R) = Pi.single (f := fun j => _) i 1 j := by rw [pderiv_def, mkDerivation_X] set_option linter.uppercaseLean3 false in #align mv_polynomial.pderiv_X MvPolynomial.pderiv_X @[simp] theorem pderiv_X_self (i : Οƒ) : pderiv i (X i : MvPolynomial Οƒ R) = 1 := by classical simp set_option linter.uppercaseLean3 false in #align mv_polynomial.pderiv_X_self MvPolynomial.pderiv_X_self @[simp] theorem pderiv_X_of_ne {i j : Οƒ} (h : j β‰  i) : pderiv i (X j : MvPolynomial Οƒ R) = 0 := by classical simp [h] set_option linter.uppercaseLean3 false in #align mv_polynomial.pderiv_X_of_ne MvPolynomial.pderiv_X_of_ne theorem pderiv_eq_zero_of_not_mem_vars {i : Οƒ} {f : MvPolynomial Οƒ R} (h : i βˆ‰ f.vars) : pderiv i f = 0 := derivation_eq_zero_of_forall_mem_vars fun _ hj => pderiv_X_of_ne <| ne_of_mem_of_not_mem hj h #align mv_polynomial.pderiv_eq_zero_of_not_mem_vars MvPolynomial.pderiv_eq_zero_of_not_mem_vars
Mathlib/Algebra/MvPolynomial/PDeriv.lean
111
112
theorem pderiv_monomial_single {i : Οƒ} {n : β„•} : pderiv i (monomial (single i n) a) = monomial (single i (n - 1)) (a * n) := by
simp
true
import Mathlib.Data.Set.Prod import Mathlib.Logic.Function.Conjugate #align_import data.set.function from "leanprover-community/mathlib"@"996b0ff959da753a555053a480f36e5f264d4207" variable {Ξ± Ξ² Ξ³ : Type*} {ΞΉ : Sort*} {Ο€ : Ξ± β†’ Type*} open Equiv Equiv.Perm Function namespace Set section Order variable {s : Set Ξ±} {f₁ fβ‚‚ : Ξ± β†’ Ξ²} [Preorder Ξ±] [Preorder Ξ²]
Mathlib/Data/Set/Function.lean
264
267
theorem _root_.MonotoneOn.congr (h₁ : MonotoneOn f₁ s) (h : s.EqOn f₁ fβ‚‚) : MonotoneOn fβ‚‚ s := by intro a ha b hb hab
intro a ha b hb hab rw [← h ha, ← h hb] exact h₁ ha hb hab
true
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} {Ξ² : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : β„€Λ£) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm theorem perm_inv_on_of_perm_on_finset {s : Finset Ξ±} {f : Perm Ξ±} (h : βˆ€ x ∈ s, f x ∈ s) {y : Ξ±} (hy : y ∈ s) : f⁻¹ y ∈ s := by have h0 : βˆ€ y ∈ s, βˆƒ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ aβ‚‚ ha₁ haβ‚‚ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self] #align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset theorem perm_inv_mapsTo_of_mapsTo (f : Perm Ξ±) {s : Set Ξ±} [Finite s] (h : Set.MapsTo f s s) : Set.MapsTo (f⁻¹ : _) s s := by cases nonempty_fintype s exact fun x hx => Set.mem_toFinset.mp <| perm_inv_on_of_perm_on_finset (fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha))) (Set.mem_toFinset.mpr hx) #align equiv.perm.perm_inv_maps_to_of_maps_to Equiv.Perm.perm_inv_mapsTo_of_mapsTo @[simp] theorem perm_inv_mapsTo_iff_mapsTo {f : Perm Ξ±} {s : Set Ξ±} [Finite s] : Set.MapsTo (f⁻¹ : _) s s ↔ Set.MapsTo f s s := ⟨perm_inv_mapsTo_of_mapsTo f⁻¹, perm_inv_mapsTo_of_mapsTo f⟩ #align equiv.perm.perm_inv_maps_to_iff_maps_to Equiv.Perm.perm_inv_mapsTo_iff_mapsTo theorem perm_inv_on_of_perm_on_finite {f : Perm Ξ±} {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) {x : Ξ±} (hx : p x) : p (f⁻¹ x) := -- Porting note: relies heavily on the definitions of `Subtype` and `setOf` unfolding to their -- underlying predicate. have : Finite { x | p x } := β€Ή_β€Ί perm_inv_mapsTo_of_mapsTo (s := {x | p x}) f h hx #align equiv.perm.perm_inv_on_of_perm_on_finite Equiv.Perm.perm_inv_on_of_perm_on_finite abbrev subtypePermOfFintype (f : Perm Ξ±) {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) : Perm { x // p x } := f.subtypePerm fun x => ⟨h x, fun hβ‚‚ => f.inv_apply_self x β–Έ perm_inv_on_of_perm_on_finite h hβ‚‚βŸ© #align equiv.perm.subtype_perm_of_fintype Equiv.Perm.subtypePermOfFintype @[simp] theorem subtypePermOfFintype_apply (f : Perm Ξ±) {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) (x : { x // p x }) : subtypePermOfFintype f h x = ⟨f x, h x x.2⟩ := rfl #align equiv.perm.subtype_perm_of_fintype_apply Equiv.Perm.subtypePermOfFintype_apply theorem subtypePermOfFintype_one (p : Ξ± β†’ Prop) [Finite { x // p x }] (h : βˆ€ x, p x β†’ p ((1 : Perm Ξ±) x)) : @subtypePermOfFintype Ξ± 1 p _ h = 1 := rfl #align equiv.perm.subtype_perm_of_fintype_one Equiv.Perm.subtypePermOfFintype_one
Mathlib/GroupTheory/Perm/Finite.lean
111
129
theorem perm_mapsTo_inl_iff_mapsTo_inr {m n : Type*} [Finite m] [Finite n] (Οƒ : Perm (Sum m n)) : Set.MapsTo Οƒ (Set.range Sum.inl) (Set.range Sum.inl) ↔ Set.MapsTo Οƒ (Set.range Sum.inr) (Set.range Sum.inr) := by constructor <;>
constructor <;> ( intro h classical rw [← perm_inv_mapsTo_iff_mapsTo] at h intro x cases' hx : Οƒ x with l r) Β· rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨l, rfl⟩ rw [← hx, Οƒ.inv_apply_self] at hy exact absurd hy Sum.inl_ne_inr Β· rintro _; exact ⟨r, rfl⟩ Β· rintro _; exact ⟨l, rfl⟩ Β· rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨r, rfl⟩ rw [← hx, Οƒ.inv_apply_self] at hy exact absurd hy Sum.inr_ne_inl
true
import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Geometry.Euclidean.PerpBisector import Mathlib.Algebra.QuadraticDiscriminant #align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open scoped Classical open RealInnerProductSpace namespace EuclideanGeometry variable {V : Type*} {P : Type*} variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] variable [NormedAddTorsor V P] theorem dist_left_midpoint_eq_dist_right_midpoint (p1 p2 : P) : dist p1 (midpoint ℝ p1 p2) = dist p2 (midpoint ℝ p1 p2) := by rw [dist_left_midpoint (π•œ := ℝ) p1 p2, dist_right_midpoint (π•œ := ℝ) p1 p2] #align euclidean_geometry.dist_left_midpoint_eq_dist_right_midpoint EuclideanGeometry.dist_left_midpoint_eq_dist_right_midpoint theorem inner_weightedVSub {ι₁ : Type*} {s₁ : Finset ι₁} {w₁ : ι₁ β†’ ℝ} (p₁ : ι₁ β†’ P) (h₁ : βˆ‘ i ∈ s₁, w₁ i = 0) {ΞΉβ‚‚ : Type*} {sβ‚‚ : Finset ΞΉβ‚‚} {wβ‚‚ : ΞΉβ‚‚ β†’ ℝ} (pβ‚‚ : ΞΉβ‚‚ β†’ P) (hβ‚‚ : βˆ‘ i ∈ sβ‚‚, wβ‚‚ i = 0) : βŸͺs₁.weightedVSub p₁ w₁, sβ‚‚.weightedVSub pβ‚‚ wβ‚‚βŸ« = (-βˆ‘ i₁ ∈ s₁, βˆ‘ iβ‚‚ ∈ sβ‚‚, w₁ i₁ * wβ‚‚ iβ‚‚ * (dist (p₁ i₁) (pβ‚‚ iβ‚‚) * dist (p₁ i₁) (pβ‚‚ iβ‚‚))) / 2 := by rw [Finset.weightedVSub_apply, Finset.weightedVSub_apply, inner_sum_smul_sum_smul_of_sum_eq_zero _ h₁ _ hβ‚‚] simp_rw [vsub_sub_vsub_cancel_right] rcongr (i₁ iβ‚‚) <;> rw [dist_eq_norm_vsub V (p₁ i₁) (pβ‚‚ iβ‚‚)] #align euclidean_geometry.inner_weighted_vsub EuclideanGeometry.inner_weightedVSub theorem dist_affineCombination {ΞΉ : Type*} {s : Finset ΞΉ} {w₁ wβ‚‚ : ΞΉ β†’ ℝ} (p : ΞΉ β†’ P) (h₁ : βˆ‘ i ∈ s, w₁ i = 1) (hβ‚‚ : βˆ‘ i ∈ s, wβ‚‚ i = 1) : by have a₁ := s.affineCombination ℝ p w₁ have aβ‚‚ := s.affineCombination ℝ p wβ‚‚ exact dist a₁ aβ‚‚ * dist a₁ aβ‚‚ = (-βˆ‘ i₁ ∈ s, βˆ‘ iβ‚‚ ∈ s, (w₁ - wβ‚‚) i₁ * (w₁ - wβ‚‚) iβ‚‚ * (dist (p i₁) (p iβ‚‚) * dist (p i₁) (p iβ‚‚))) / 2 := by dsimp only rw [dist_eq_norm_vsub V (s.affineCombination ℝ p w₁) (s.affineCombination ℝ p wβ‚‚), ← @inner_self_eq_norm_mul_norm ℝ, Finset.affineCombination_vsub] have h : (βˆ‘ i ∈ s, (w₁ - wβ‚‚) i) = 0 := by simp_rw [Pi.sub_apply, Finset.sum_sub_distrib, h₁, hβ‚‚, sub_self] exact inner_weightedVSub p h p h #align euclidean_geometry.dist_affine_combination EuclideanGeometry.dist_affineCombination -- Porting note: `inner_vsub_vsub_of_dist_eq_of_dist_eq` moved to `PerpendicularBisector` theorem dist_smul_vadd_sq (r : ℝ) (v : V) (p₁ pβ‚‚ : P) : dist (r β€’ v +α΅₯ p₁) pβ‚‚ * dist (r β€’ v +α΅₯ p₁) pβ‚‚ = βŸͺv, v⟫ * r * r + 2 * βŸͺv, p₁ -α΅₯ pβ‚‚βŸ« * r + βŸͺp₁ -α΅₯ pβ‚‚, p₁ -α΅₯ pβ‚‚βŸ« := by rw [dist_eq_norm_vsub V _ pβ‚‚, ← real_inner_self_eq_norm_mul_norm, vadd_vsub_assoc, real_inner_add_add_self, real_inner_smul_left, real_inner_smul_left, real_inner_smul_right] ring #align euclidean_geometry.dist_smul_vadd_sq EuclideanGeometry.dist_smul_vadd_sq
Mathlib/Geometry/Euclidean/Basic.lean
122
134
theorem dist_smul_vadd_eq_dist {v : V} (p₁ pβ‚‚ : P) (hv : v β‰  0) (r : ℝ) : dist (r β€’ v +α΅₯ p₁) pβ‚‚ = dist p₁ pβ‚‚ ↔ r = 0 ∨ r = -2 * βŸͺv, p₁ -α΅₯ pβ‚‚βŸ« / βŸͺv, v⟫ := by conv_lhs =>
conv_lhs => rw [← mul_self_inj_of_nonneg dist_nonneg dist_nonneg, dist_smul_vadd_sq, ← sub_eq_zero, add_sub_assoc, dist_eq_norm_vsub V p₁ pβ‚‚, ← real_inner_self_eq_norm_mul_norm, sub_self] have hvi : βŸͺv, v⟫ β‰  0 := by simpa using hv have hd : discrim βŸͺv, v⟫ (2 * βŸͺv, p₁ -α΅₯ pβ‚‚βŸ«) 0 = 2 * βŸͺv, p₁ -α΅₯ pβ‚‚βŸ« * (2 * βŸͺv, p₁ -α΅₯ pβ‚‚βŸ«) := by rw [discrim] ring rw [quadratic_eq_zero_iff hvi hd, add_left_neg, zero_div, neg_mul_eq_neg_mul, ← mul_sub_right_distrib, sub_eq_add_neg, ← mul_two, mul_assoc, mul_div_assoc, mul_div_mul_left, mul_div_assoc] norm_num
true
import Mathlib.Analysis.Calculus.Deriv.Inv import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.PolynomialExp #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Polynomial Real Filter Set Function open scoped Polynomial def expNegInvGlue (x : ℝ) : ℝ := if x ≀ 0 then 0 else exp (-x⁻¹) #align exp_neg_inv_glue expNegInvGlue namespace expNegInvGlue theorem zero_of_nonpos {x : ℝ} (hx : x ≀ 0) : expNegInvGlue x = 0 := by simp [expNegInvGlue, hx] #align exp_neg_inv_glue.zero_of_nonpos expNegInvGlue.zero_of_nonpos @[simp] -- Porting note (#10756): new lemma protected theorem zero : expNegInvGlue 0 = 0 := zero_of_nonpos le_rfl theorem pos_of_pos {x : ℝ} (hx : 0 < x) : 0 < expNegInvGlue x := by simp [expNegInvGlue, not_le.2 hx, exp_pos] #align exp_neg_inv_glue.pos_of_pos expNegInvGlue.pos_of_pos
Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean
58
61
theorem nonneg (x : ℝ) : 0 ≀ expNegInvGlue x := by cases le_or_gt x 0 with
cases le_or_gt x 0 with | inl h => exact ge_of_eq (zero_of_nonpos h) | inr h => exact le_of_lt (pos_of_pos h)
true
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.Data.Complex.Orientation import Mathlib.Tactic.LinearCombination #align_import analysis.inner_product_space.two_dim from "leanprover-community/mathlib"@"cd8fafa2fac98e1a67097e8a91ad9901cfde48af" noncomputable section open scoped RealInnerProductSpace ComplexConjugate open FiniteDimensional lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V := .of_fact_finrank_eq_succ 1 attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two @[deprecated (since := "2024-02-02")] alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two := FiniteDimensional.of_fact_finrank_eq_two variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)] (o : Orientation ℝ E (Fin 2)) namespace Orientation irreducible_def areaForm : E β†’β‚—[ℝ] E β†’β‚—[ℝ] ℝ := by let z : E [β‹€^Fin 0]β†’β‚—[ℝ] ℝ ≃ₗ[ℝ] ℝ := AlternatingMap.constLinearEquivOfIsEmpty.symm let y : E [β‹€^Fin 1]β†’β‚—[ℝ] ℝ β†’β‚—[ℝ] E β†’β‚—[ℝ] ℝ := LinearMap.llcomp ℝ E (E [β‹€^Fin 0]β†’β‚—[ℝ] ℝ) ℝ z βˆ˜β‚— AlternatingMap.curryLeftLinearMap exact y βˆ˜β‚— AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm #align orientation.area_form Orientation.areaForm local notation "Ο‰" => o.areaForm
Mathlib/Analysis/InnerProductSpace/TwoDim.lean
105
105
theorem areaForm_to_volumeForm (x y : E) : Ο‰ x y = o.volumeForm ![x, y] := by
simp [areaForm]
true
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {π•œ : Type*} [NormedLinearOrderedField π•œ] (P Q : π•œ[X]) theorem eventually_no_roots (hP : P β‰  0) : βˆ€αΆ  x in atTop, Β¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology π•œ] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 Β· simp [h, IsEquivalent.refl] Β· simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≀ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≀ P.leadingCoeff := by refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩ #align polynomial.tendsto_at_top_iff_leading_coeff_nonneg Polynomial.tendsto_atTop_iff_leadingCoeff_nonneg theorem tendsto_atBot_iff_leadingCoeff_nonpos : Tendsto (fun x => eval x P) atTop atBot ↔ 0 < P.degree ∧ P.leadingCoeff ≀ 0 := by simp only [← tendsto_neg_atTop_iff, ← eval_neg, tendsto_atTop_iff_leadingCoeff_nonneg, degree_neg, leadingCoeff_neg, neg_nonneg] #align polynomial.tendsto_at_bot_iff_leading_coeff_nonpos Polynomial.tendsto_atBot_iff_leadingCoeff_nonpos theorem tendsto_atBot_of_leadingCoeff_nonpos (hdeg : 0 < P.degree) (hnps : P.leadingCoeff ≀ 0) : Tendsto (fun x => eval x P) atTop atBot := P.tendsto_atBot_iff_leadingCoeff_nonpos.2 ⟨hdeg, hnps⟩ #align polynomial.tendsto_at_bot_of_leading_coeff_nonpos Polynomial.tendsto_atBot_of_leadingCoeff_nonpos
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
84
88
theorem abs_tendsto_atTop (hdeg : 0 < P.degree) : Tendsto (fun x => abs <| eval x P) atTop atTop := by rcases le_total 0 P.leadingCoeff with hP | hP
rcases le_total 0 P.leadingCoeff with hP | hP Β· exact tendsto_abs_atTop_atTop.comp (P.tendsto_atTop_of_leadingCoeff_nonneg hdeg hP) Β· exact tendsto_abs_atBot_atTop.comp (P.tendsto_atBot_of_leadingCoeff_nonpos hdeg hP)
true
import Mathlib.RingTheory.Valuation.Basic import Mathlib.NumberTheory.Padics.PadicNorm import Mathlib.Analysis.Normed.Field.Basic #align_import number_theory.padics.padic_numbers from "leanprover-community/mathlib"@"b9b2114f7711fec1c1e055d507f082f8ceb2c3b7" noncomputable section open scoped Classical open Nat multiplicity padicNorm CauSeq CauSeq.Completion Metric abbrev PadicSeq (p : β„•) := CauSeq _ (padicNorm p) #align padic_seq PadicSeq namespace PadicSeq section variable {p : β„•} [Fact p.Prime] theorem stationary {f : CauSeq β„š (padicNorm p)} (hf : Β¬f β‰ˆ 0) : βˆƒ N, βˆ€ m n, N ≀ m β†’ N ≀ n β†’ padicNorm p (f n) = padicNorm p (f m) := have : βˆƒ Ξ΅ > 0, βˆƒ N1, βˆ€ j β‰₯ N1, Ξ΅ ≀ padicNorm p (f j) := CauSeq.abv_pos_of_not_limZero <| not_limZero_of_not_congr_zero hf let ⟨Ρ, hΞ΅, N1, hN1⟩ := this let ⟨N2, hN2⟩ := CauSeq.cauchyβ‚‚ f hΞ΅ ⟨max N1 N2, fun n m hn hm ↦ by have : padicNorm p (f n - f m) < Ξ΅ := hN2 _ (max_le_iff.1 hn).2 _ (max_le_iff.1 hm).2 have : padicNorm p (f n - f m) < padicNorm p (f n) := lt_of_lt_of_le this <| hN1 _ (max_le_iff.1 hn).1 have : padicNorm p (f n - f m) < max (padicNorm p (f n)) (padicNorm p (f m)) := lt_max_iff.2 (Or.inl this) by_contra hne rw [← padicNorm.neg (f m)] at hne have hnam := add_eq_max_of_ne hne rw [padicNorm.neg, max_comm] at hnam rw [← hnam, sub_eq_add_neg, add_comm] at this apply _root_.lt_irrefl _ this⟩ #align padic_seq.stationary PadicSeq.stationary def stationaryPoint {f : PadicSeq p} (hf : Β¬f β‰ˆ 0) : β„• := Classical.choose <| stationary hf #align padic_seq.stationary_point PadicSeq.stationaryPoint theorem stationaryPoint_spec {f : PadicSeq p} (hf : Β¬f β‰ˆ 0) : βˆ€ {m n}, stationaryPoint hf ≀ m β†’ stationaryPoint hf ≀ n β†’ padicNorm p (f n) = padicNorm p (f m) := @(Classical.choose_spec <| stationary hf) #align padic_seq.stationary_point_spec PadicSeq.stationaryPoint_spec def norm (f : PadicSeq p) : β„š := if hf : f β‰ˆ 0 then 0 else padicNorm p (f (stationaryPoint hf)) #align padic_seq.norm PadicSeq.norm theorem norm_zero_iff (f : PadicSeq p) : f.norm = 0 ↔ f β‰ˆ 0 := by constructor Β· intro h by_contra hf unfold norm at h split_ifs at h Β· contradiction apply hf intro Ξ΅ hΞ΅ exists stationaryPoint hf intro j hj have heq := stationaryPoint_spec hf le_rfl hj simpa [h, heq] Β· intro h simp [norm, h] #align padic_seq.norm_zero_iff PadicSeq.norm_zero_iff end section Embedding open CauSeq variable {p : β„•} [Fact p.Prime] theorem equiv_zero_of_val_eq_of_equiv_zero {f g : PadicSeq p} (h : βˆ€ k, padicNorm p (f k) = padicNorm p (g k)) (hf : f β‰ˆ 0) : g β‰ˆ 0 := fun Ξ΅ hΞ΅ ↦ let ⟨i, hi⟩ := hf _ hΞ΅ ⟨i, fun j hj ↦ by simpa [h] using hi _ hj⟩ #align padic_seq.equiv_zero_of_val_eq_of_equiv_zero PadicSeq.equiv_zero_of_val_eq_of_equiv_zero theorem norm_nonzero_of_not_equiv_zero {f : PadicSeq p} (hf : Β¬f β‰ˆ 0) : f.norm β‰  0 := hf ∘ f.norm_zero_iff.1 #align padic_seq.norm_nonzero_of_not_equiv_zero PadicSeq.norm_nonzero_of_not_equiv_zero theorem norm_eq_norm_app_of_nonzero {f : PadicSeq p} (hf : Β¬f β‰ˆ 0) : βˆƒ k, f.norm = padicNorm p k ∧ k β‰  0 := have heq : f.norm = padicNorm p (f <| stationaryPoint hf) := by simp [norm, hf] ⟨f <| stationaryPoint hf, heq, fun h ↦ norm_nonzero_of_not_equiv_zero hf (by simpa [h] using heq)⟩ #align padic_seq.norm_eq_norm_app_of_nonzero PadicSeq.norm_eq_norm_app_of_nonzero theorem not_limZero_const_of_nonzero {q : β„š} (hq : q β‰  0) : Β¬LimZero (const (padicNorm p) q) := fun h' ↦ hq <| const_limZero.1 h' #align padic_seq.not_lim_zero_const_of_nonzero PadicSeq.not_limZero_const_of_nonzero theorem not_equiv_zero_const_of_nonzero {q : β„š} (hq : q β‰  0) : Β¬const (padicNorm p) q β‰ˆ 0 := fun h : LimZero (const (padicNorm p) q - 0) ↦ not_limZero_const_of_nonzero hq <| by simpa using h #align padic_seq.not_equiv_zero_const_of_nonzero PadicSeq.not_equiv_zero_const_of_nonzero theorem norm_nonneg (f : PadicSeq p) : 0 ≀ f.norm := if hf : f β‰ˆ 0 then by simp [hf, norm] else by simp [norm, hf, padicNorm.nonneg] #align padic_seq.norm_nonneg PadicSeq.norm_nonneg
Mathlib/NumberTheory/Padics/PadicNumbers.lean
176
181
theorem lift_index_left_left {f : PadicSeq p} (hf : Β¬f β‰ˆ 0) (v2 v3 : β„•) : padicNorm p (f (stationaryPoint hf)) = padicNorm p (f (max (stationaryPoint hf) (max v2 v3))) := by apply stationaryPoint_spec hf
apply stationaryPoint_spec hf Β· apply le_max_left Β· exact le_rfl
true
import Mathlib.Algebra.Order.Floor import Mathlib.Algebra.Order.Field.Power import Mathlib.Data.Nat.Log #align_import data.int.log from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" variable {R : Type*} [LinearOrderedSemifield R] [FloorSemiring R] namespace Int def log (b : β„•) (r : R) : β„€ := if 1 ≀ r then Nat.log b ⌊rβŒ‹β‚Š else -Nat.clog b ⌈rβ»ΒΉβŒ‰β‚Š #align int.log Int.log theorem log_of_one_le_right (b : β„•) {r : R} (hr : 1 ≀ r) : log b r = Nat.log b ⌊rβŒ‹β‚Š := if_pos hr #align int.log_of_one_le_right Int.log_of_one_le_right theorem log_of_right_le_one (b : β„•) {r : R} (hr : r ≀ 1) : log b r = -Nat.clog b ⌈rβ»ΒΉβŒ‰β‚Š := by obtain rfl | hr := hr.eq_or_lt Β· rw [log, if_pos hr, inv_one, Nat.ceil_one, Nat.floor_one, Nat.log_one_right, Nat.clog_one_right, Int.ofNat_zero, neg_zero] Β· exact if_neg hr.not_le #align int.log_of_right_le_one Int.log_of_right_le_one @[simp, norm_cast] theorem log_natCast (b : β„•) (n : β„•) : log b (n : R) = Nat.log b n := by cases n Β· simp [log_of_right_le_one] Β· rw [log_of_one_le_right, Nat.floor_natCast] simp #align int.log_nat_cast Int.log_natCast -- See note [no_index around OfNat.ofNat] @[simp] theorem log_ofNat (b : β„•) (n : β„•) [n.AtLeastTwo] : log b (no_index (OfNat.ofNat n : R)) = Nat.log b (OfNat.ofNat n) := log_natCast b n theorem log_of_left_le_one {b : β„•} (hb : b ≀ 1) (r : R) : log b r = 0 := by rcases le_total 1 r with h | h Β· rw [log_of_one_le_right _ h, Nat.log_of_left_le_one hb, Int.ofNat_zero] Β· rw [log_of_right_le_one _ h, Nat.clog_of_left_le_one hb, Int.ofNat_zero, neg_zero] #align int.log_of_left_le_one Int.log_of_left_le_one theorem log_of_right_le_zero (b : β„•) {r : R} (hr : r ≀ 0) : log b r = 0 := by rw [log_of_right_le_one _ (hr.trans zero_le_one), Nat.clog_of_right_le_one ((Nat.ceil_eq_zero.mpr <| inv_nonpos.2 hr).trans_le zero_le_one), Int.ofNat_zero, neg_zero] #align int.log_of_right_le_zero Int.log_of_right_le_zero theorem zpow_log_le_self {b : β„•} {r : R} (hb : 1 < b) (hr : 0 < r) : (b : R) ^ log b r ≀ r := by rcases le_total 1 r with hr1 | hr1 Β· rw [log_of_one_le_right _ hr1] rw [zpow_natCast, ← Nat.cast_pow, ← Nat.le_floor_iff hr.le] exact Nat.pow_log_le_self b (Nat.floor_pos.mpr hr1).ne' Β· rw [log_of_right_le_one _ hr1, zpow_neg, zpow_natCast, ← Nat.cast_pow] exact inv_le_of_inv_le hr (Nat.ceil_le.1 <| Nat.le_pow_clog hb _) #align int.zpow_log_le_self Int.zpow_log_le_self theorem lt_zpow_succ_log_self {b : β„•} (hb : 1 < b) (r : R) : r < (b : R) ^ (log b r + 1) := by rcases le_or_lt r 0 with hr | hr Β· rw [log_of_right_le_zero _ hr, zero_add, zpow_one] exact hr.trans_lt (zero_lt_one.trans_le <| mod_cast hb.le) rcases le_or_lt 1 r with hr1 | hr1 Β· rw [log_of_one_le_right _ hr1] rw [Int.ofNat_add_one_out, zpow_natCast, ← Nat.cast_pow] apply Nat.lt_of_floor_lt exact Nat.lt_pow_succ_log_self hb _ Β· rw [log_of_right_le_one _ hr1.le] have hcri : 1 < r⁻¹ := one_lt_inv hr hr1 have : 1 ≀ Nat.clog b ⌈rβ»ΒΉβŒ‰β‚Š := Nat.succ_le_of_lt (Nat.clog_pos hb <| Nat.one_lt_cast.1 <| hcri.trans_le (Nat.le_ceil _)) rw [neg_add_eq_sub, ← neg_sub, ← Int.ofNat_one, ← Int.ofNat_sub this, zpow_neg, zpow_natCast, lt_inv hr (pow_pos (Nat.cast_pos.mpr <| zero_lt_one.trans hb) _), ← Nat.cast_pow] refine Nat.lt_ceil.1 ?_ exact Nat.pow_pred_clog_lt_self hb <| Nat.one_lt_cast.1 <| hcri.trans_le <| Nat.le_ceil _ #align int.lt_zpow_succ_log_self Int.lt_zpow_succ_log_self @[simp] theorem log_zero_right (b : β„•) : log b (0 : R) = 0 := log_of_right_le_zero b le_rfl #align int.log_zero_right Int.log_zero_right @[simp] theorem log_one_right (b : β„•) : log b (1 : R) = 0 := by rw [log_of_one_le_right _ le_rfl, Nat.floor_one, Nat.log_one_right, Int.ofNat_zero] #align int.log_one_right Int.log_one_right -- Porting note: needed to replace b ^ z with (b : R) ^ z in the below
Mathlib/Data/Int/Log.lean
138
145
theorem log_zpow {b : β„•} (hb : 1 < b) (z : β„€) : log b ((b : R) ^ z : R) = z := by obtain ⟨n, rfl | rfl⟩ := Int.eq_nat_or_neg z
obtain ⟨n, rfl | rfl⟩ := Int.eq_nat_or_neg z Β· rw [log_of_one_le_right _ (one_le_zpow_of_nonneg _ <| Int.natCast_nonneg _), zpow_natCast, ← Nat.cast_pow, Nat.floor_natCast, Nat.log_pow hb] exact mod_cast hb.le Β· rw [log_of_right_le_one _ (zpow_le_one_of_nonpos _ <| neg_nonpos.mpr (Int.natCast_nonneg _)), zpow_neg, inv_inv, zpow_natCast, ← Nat.cast_pow, Nat.ceil_natCast, Nat.clog_pow _ _ hb] exact mod_cast hb.le
true
import Mathlib.NumberTheory.NumberField.Basic import Mathlib.RingTheory.FractionalIdeal.Norm import Mathlib.RingTheory.FractionalIdeal.Operations variable (K : Type*) [Field K] [NumberField K] namespace NumberField open scoped nonZeroDivisors section Basis open Module -- This is necessary to avoid several timeouts attribute [local instance 2000] Submodule.module instance (I : FractionalIdeal (π“ž K)⁰ K) : Module.Free β„€ I := by refine Free.of_equiv (LinearEquiv.restrictScalars β„€ (I.equivNum ?_)).symm exact nonZeroDivisors.coe_ne_zero I.den instance (I : FractionalIdeal (π“ž K)⁰ K) : Module.Finite β„€ I := by refine Module.Finite.of_surjective (LinearEquiv.restrictScalars β„€ (I.equivNum ?_)).symm.toLinearMap (LinearEquiv.surjective _) exact nonZeroDivisors.coe_ne_zero I.den instance (I : (FractionalIdeal (π“ž K)⁰ K)Λ£) : IsLocalizedModule ℀⁰ ((Submodule.subtype (I : Submodule (π“ž K) K)).restrictScalars β„€) where map_units x := by rw [← (Algebra.lmul _ _).commutes, Algebra.lmul_isUnit_iff, isUnit_iff_ne_zero, eq_intCast, Int.cast_ne_zero] exact nonZeroDivisors.coe_ne_zero x surj' x := by obtain ⟨⟨a, _, d, hd, rfl⟩, h⟩ := IsLocalization.surj (Algebra.algebraMapSubmonoid (π“ž K) ℀⁰) x refine ⟨⟨⟨Ideal.absNorm I.1.num * (algebraMap _ K a), I.1.num_le ?_⟩, d * Ideal.absNorm I.1.num, ?_⟩ , ?_⟩ Β· simp_rw [FractionalIdeal.val_eq_coe, FractionalIdeal.coe_coeIdeal] refine (IsLocalization.mem_coeSubmodule _ _).mpr ⟨Ideal.absNorm I.1.num * a, ?_, ?_⟩ Β· exact Ideal.mul_mem_right _ _ I.1.num.absNorm_mem Β· rw [map_mul, map_natCast] Β· refine Submonoid.mul_mem _ hd (mem_nonZeroDivisors_of_ne_zero ?_) rw [Nat.cast_ne_zero, ne_eq, Ideal.absNorm_eq_zero_iff] exact FractionalIdeal.num_eq_zero_iff.not.mpr <| Units.ne_zero I Β· simp_rw [LinearMap.coe_restrictScalars, Submodule.coeSubtype] at h ⊒ rw [← h] simp only [Submonoid.mk_smul, zsmul_eq_mul, Int.cast_mul, Int.cast_natCast, algebraMap_int_eq, eq_intCast, map_intCast] ring exists_of_eq h := ⟨1, by rwa [one_smul, one_smul, ← (Submodule.injective_subtype I.1.coeToSubmodule).eq_iff]⟩ noncomputable def fractionalIdealBasis (I : FractionalIdeal (π“ž K)⁰ K) : Basis (Free.ChooseBasisIndex β„€ I) β„€ I := Free.chooseBasis β„€ I noncomputable def basisOfFractionalIdeal (I : (FractionalIdeal (π“ž K)⁰ K)Λ£) : Basis (Free.ChooseBasisIndex β„€ I) β„š K := (fractionalIdealBasis K I.1).ofIsLocalizedModule β„š ℀⁰ ((Submodule.subtype (I : Submodule (π“ž K) K)).restrictScalars β„€) theorem basisOfFractionalIdeal_apply (I : (FractionalIdeal (π“ž K)⁰ K)Λ£) (i : Free.ChooseBasisIndex β„€ I) : basisOfFractionalIdeal K I i = fractionalIdealBasis K I.1 i := (fractionalIdealBasis K I.1).ofIsLocalizedModule_apply β„š ℀⁰ _ i
Mathlib/NumberTheory/NumberField/FractionalIdeal.lean
87
90
theorem mem_span_basisOfFractionalIdeal {I : (FractionalIdeal (π“ž K)⁰ K)Λ£} {x : K} : x ∈ Submodule.span β„€ (Set.range (basisOfFractionalIdeal K I)) ↔ x ∈ (I : Set K) := by rw [basisOfFractionalIdeal, (fractionalIdealBasis K I.1).ofIsLocalizedModule_span β„š ℀⁰ _]
rw [basisOfFractionalIdeal, (fractionalIdealBasis K I.1).ofIsLocalizedModule_span β„š ℀⁰ _] simp
true
import Mathlib.Algebra.Homology.ComplexShape import Mathlib.CategoryTheory.Subobject.Limits import Mathlib.CategoryTheory.GradedObject import Mathlib.Algebra.Homology.ShortComplex.Basic #align_import algebra.homology.homological_complex from "leanprover-community/mathlib"@"88bca0ce5d22ebfd9e73e682e51d60ea13b48347" universe v u open CategoryTheory CategoryTheory.Category CategoryTheory.Limits variable {ΞΉ : Type*} variable (V : Type u) [Category.{v} V] [HasZeroMorphisms V] structure HomologicalComplex (c : ComplexShape ΞΉ) where X : ΞΉ β†’ V d : βˆ€ i j, X i ⟢ X j shape : βˆ€ i j, Β¬c.Rel i j β†’ d i j = 0 := by aesop_cat d_comp_d' : βˆ€ i j k, c.Rel i j β†’ c.Rel j k β†’ d i j ≫ d j k = 0 := by aesop_cat #align homological_complex HomologicalComplex abbrev ChainComplex (Ξ± : Type*) [AddRightCancelSemigroup Ξ±] [One Ξ±] : Type _ := HomologicalComplex V (ComplexShape.down Ξ±) #align chain_complex ChainComplex abbrev CochainComplex (Ξ± : Type*) [AddRightCancelSemigroup Ξ±] [One Ξ±] : Type _ := HomologicalComplex V (ComplexShape.up Ξ±) #align cochain_complex CochainComplex namespace CochainComplex @[simp] theorem prev (Ξ± : Type*) [AddGroup Ξ±] [One Ξ±] (i : Ξ±) : (ComplexShape.up Ξ±).prev i = i - 1 := (ComplexShape.up Ξ±).prev_eq' <| sub_add_cancel _ _ #align cochain_complex.prev CochainComplex.prev @[simp] theorem next (Ξ± : Type*) [AddRightCancelSemigroup Ξ±] [One Ξ±] (i : Ξ±) : (ComplexShape.up Ξ±).next i = i + 1 := (ComplexShape.up Ξ±).next_eq' rfl #align cochain_complex.next CochainComplex.next @[simp]
Mathlib/Algebra/Homology/HomologicalComplex.lean
206
211
theorem prev_nat_zero : (ComplexShape.up β„•).prev 0 = 0 := by classical
classical refine dif_neg ?_ push_neg intro apply Nat.noConfusion
true
import Mathlib.LinearAlgebra.Contraction #align_import linear_algebra.coevaluation from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31" noncomputable section section coevaluation open TensorProduct FiniteDimensional open TensorProduct universe u v variable (K : Type u) [Field K] variable (V : Type v) [AddCommGroup V] [Module K V] [FiniteDimensional K V] def coevaluation : K β†’β‚—[K] V βŠ—[K] Module.Dual K V := let bV := Basis.ofVectorSpace K V (Basis.singleton Unit K).constr K fun _ => βˆ‘ i : Basis.ofVectorSpaceIndex K V, bV i βŠ—β‚œ[K] bV.coord i #align coevaluation coevaluation
Mathlib/LinearAlgebra/Coevaluation.lean
47
54
theorem coevaluation_apply_one : (coevaluation K V) (1 : K) = let bV := Basis.ofVectorSpace K V βˆ‘ i : Basis.ofVectorSpaceIndex K V, bV i βŠ—β‚œ[K] bV.coord i := by simp only [coevaluation, id]
simp only [coevaluation, id] rw [(Basis.singleton Unit K).constr_apply_fintype K] simp only [Fintype.univ_punit, Finset.sum_const, one_smul, Basis.singleton_repr, Basis.equivFun_apply, Basis.coe_ofVectorSpace, one_nsmul, Finset.card_singleton]
true
import Mathlib.Order.Cover import Mathlib.Order.Interval.Finset.Defs #align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d" assert_not_exists MonoidWithZero assert_not_exists Finset.sum open Function OrderDual open FinsetInterval variable {ΞΉ Ξ± : Type*} namespace Finset section Preorder variable [Preorder Ξ±] section LocallyFiniteOrder variable [LocallyFiniteOrder Ξ±] {a a₁ aβ‚‚ b b₁ bβ‚‚ c x : Ξ±} @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≀ b := by rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc] #align finset.nonempty_Icc Finset.nonempty_Icc @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico] #align finset.nonempty_Ico Finset.nonempty_Ico @[simp, aesop safe apply (rule_sets := [finsetNonempty])]
Mathlib/Order/Interval/Finset/Basic.lean
67
68
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc]
true
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec" noncomputable section open AddCommGroup Set Function AddSubgroup TopologicalSpace open Topology variable {π•œ B : Type*} @[nolint unusedArguments] abbrev AddCircle [LinearOrderedAddCommGroup π•œ] [TopologicalSpace π•œ] [OrderTopology π•œ] (p : π•œ) := π•œ β§Έ zmultiples p #align add_circle AddCircle namespace AddCircle section LinearOrderedAddCommGroup variable [LinearOrderedAddCommGroup π•œ] [TopologicalSpace π•œ] [OrderTopology π•œ] (p : π•œ) theorem coe_nsmul {n : β„•} {x : π•œ} : (↑(n β€’ x) : AddCircle p) = n β€’ (x : AddCircle p) := rfl #align add_circle.coe_nsmul AddCircle.coe_nsmul theorem coe_zsmul {n : β„€} {x : π•œ} : (↑(n β€’ x) : AddCircle p) = n β€’ (x : AddCircle p) := rfl #align add_circle.coe_zsmul AddCircle.coe_zsmul theorem coe_add (x y : π•œ) : (↑(x + y) : AddCircle p) = (x : AddCircle p) + (y : AddCircle p) := rfl #align add_circle.coe_add AddCircle.coe_add theorem coe_sub (x y : π•œ) : (↑(x - y) : AddCircle p) = (x : AddCircle p) - (y : AddCircle p) := rfl #align add_circle.coe_sub AddCircle.coe_sub theorem coe_neg {x : π•œ} : (↑(-x) : AddCircle p) = -(x : AddCircle p) := rfl #align add_circle.coe_neg AddCircle.coe_neg
Mathlib/Topology/Instances/AddCircle.lean
152
153
theorem coe_eq_zero_iff {x : π•œ} : (x : AddCircle p) = 0 ↔ βˆƒ n : β„€, n β€’ p = x := by
simp [AddSubgroup.mem_zmultiples_iff]
true
import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals import Mathlib.Analysis.Calculus.ParametricIntegral import Mathlib.MeasureTheory.Measure.Haar.NormedSpace #align_import analysis.mellin_transform from "leanprover-community/mathlib"@"917c3c072e487b3cccdbfeff17e75b40e45f66cb" open MeasureTheory Set Filter Asymptotics TopologicalSpace open Real open Complex hiding exp log abs_of_nonneg open scoped Topology noncomputable section variable {E : Type*} [NormedAddCommGroup E] section MellinConvergent theorem mellin_convergent_iff_norm [NormedSpace β„‚ E] {f : ℝ β†’ E} {T : Set ℝ} (hT : T βŠ† Ioi 0) (hT' : MeasurableSet T) (hfc : AEStronglyMeasurable f <| volume.restrict <| Ioi 0) {s : β„‚} : IntegrableOn (fun t : ℝ => (t : β„‚) ^ (s - 1) β€’ f t) T ↔ IntegrableOn (fun t : ℝ => t ^ (s.re - 1) * β€–f tβ€–) T := by have : AEStronglyMeasurable (fun t : ℝ => (t : β„‚) ^ (s - 1) β€’ f t) (volume.restrict T) := by refine ((ContinuousAt.continuousOn ?_).aestronglyMeasurable hT').smul (hfc.mono_set hT) exact fun t ht => continuousAt_ofReal_cpow_const _ _ (Or.inr <| ne_of_gt (hT ht)) rw [IntegrableOn, ← integrable_norm_iff this, ← IntegrableOn] refine integrableOn_congr_fun (fun t ht => ?_) hT' simp_rw [norm_smul, Complex.norm_eq_abs, abs_cpow_eq_rpow_re_of_pos (hT ht), sub_re, one_re] #align mellin_convergent_iff_norm mellin_convergent_iff_norm theorem mellin_convergent_top_of_isBigO {f : ℝ β†’ ℝ} (hfc : AEStronglyMeasurable f <| volume.restrict (Ioi 0)) {a s : ℝ} (hf : f =O[atTop] (Β· ^ (-a))) (hs : s < a) : βˆƒ c : ℝ, 0 < c ∧ IntegrableOn (fun t : ℝ => t ^ (s - 1) * f t) (Ioi c) := by obtain ⟨d, hd'⟩ := hf.isBigOWith simp_rw [IsBigOWith, eventually_atTop] at hd' obtain ⟨e, he⟩ := hd' have he' : 0 < max e 1 := zero_lt_one.trans_le (le_max_right _ _) refine ⟨max e 1, he', ?_, ?_⟩ Β· refine AEStronglyMeasurable.mul ?_ (hfc.mono_set (Ioi_subset_Ioi he'.le)) refine (ContinuousAt.continuousOn fun t ht => ?_).aestronglyMeasurable measurableSet_Ioi exact continuousAt_rpow_const _ _ (Or.inl <| (he'.trans ht).ne') Β· have : βˆ€α΅ t : ℝ βˆ‚volume.restrict (Ioi <| max e 1), β€–t ^ (s - 1) * f tβ€– ≀ t ^ (s - 1 + -a) * d := by refine (ae_restrict_mem measurableSet_Ioi).mono fun t ht => ?_ have ht' : 0 < t := he'.trans ht rw [norm_mul, rpow_add ht', ← norm_of_nonneg (rpow_nonneg ht'.le (-a)), mul_assoc, mul_comm _ d, norm_of_nonneg (rpow_nonneg ht'.le _)] gcongr exact he t ((le_max_left e 1).trans_lt ht).le refine (HasFiniteIntegral.mul_const ?_ _).mono' this exact (integrableOn_Ioi_rpow_of_lt (by linarith) he').hasFiniteIntegral set_option linter.uppercaseLean3 false in #align mellin_convergent_top_of_is_O mellin_convergent_top_of_isBigO
Mathlib/Analysis/MellinTransform.lean
237
264
theorem mellin_convergent_zero_of_isBigO {b : ℝ} {f : ℝ β†’ ℝ} (hfc : AEStronglyMeasurable f <| volume.restrict (Ioi 0)) (hf : f =O[𝓝[>] 0] (Β· ^ (-b))) {s : ℝ} (hs : b < s) : βˆƒ c : ℝ, 0 < c ∧ IntegrableOn (fun t : ℝ => t ^ (s - 1) * f t) (Ioc 0 c) := by obtain ⟨d, _, hd'⟩ := hf.exists_pos
obtain ⟨d, _, hd'⟩ := hf.exists_pos simp_rw [IsBigOWith, eventually_nhdsWithin_iff, Metric.eventually_nhds_iff, gt_iff_lt] at hd' obtain ⟨Ρ, hΞ΅, hΞ΅'⟩ := hd' refine ⟨Ρ, hΞ΅, integrableOn_Ioc_iff_integrableOn_Ioo.mpr ⟨?_, ?_⟩⟩ Β· refine AEStronglyMeasurable.mul ?_ (hfc.mono_set Ioo_subset_Ioi_self) refine (ContinuousAt.continuousOn fun t ht => ?_).aestronglyMeasurable measurableSet_Ioo exact continuousAt_rpow_const _ _ (Or.inl ht.1.ne') Β· apply HasFiniteIntegral.mono' Β· show HasFiniteIntegral (fun t => d * t ^ (s - b - 1)) _ refine (Integrable.hasFiniteIntegral ?_).const_mul _ rw [← IntegrableOn, ← integrableOn_Ioc_iff_integrableOn_Ioo, ← intervalIntegrable_iff_integrableOn_Ioc_of_le hΞ΅.le] exact intervalIntegral.intervalIntegrable_rpow' (by linarith) Β· refine (ae_restrict_iff' measurableSet_Ioo).mpr (eventually_of_forall fun t ht => ?_) rw [mul_comm, norm_mul] specialize hΞ΅' _ ht.1 Β· rw [dist_eq_norm, sub_zero, norm_of_nonneg (le_of_lt ht.1)] exact ht.2 Β· calc _ ≀ d * β€–t ^ (-b)β€– * β€–t ^ (s - 1)β€– := by gcongr _ = d * t ^ (s - b - 1) := ?_ simp_rw [norm_of_nonneg (rpow_nonneg (le_of_lt ht.1) _), mul_assoc] rw [← rpow_add ht.1] congr 2 abel
true
import Mathlib.Probability.Kernel.MeasurableIntegral #align_import probability.kernel.composition from "leanprover-community/mathlib"@"3b92d54a05ee592aa2c6181a4e76b1bb7cc45d0b" open MeasureTheory open scoped ENNReal namespace ProbabilityTheory namespace kernel variable {Ξ± Ξ² ΞΉ : Type*} {mΞ± : MeasurableSpace Ξ±} {mΞ² : MeasurableSpace Ξ²} section CompositionProduct variable {Ξ³ : Type*} {mΞ³ : MeasurableSpace Ξ³} {s : Set (Ξ² Γ— Ξ³)} noncomputable def compProdFun (ΞΊ : kernel Ξ± Ξ²) (Ξ· : kernel (Ξ± Γ— Ξ²) Ξ³) (a : Ξ±) (s : Set (Ξ² Γ— Ξ³)) : ℝβ‰₯0∞ := ∫⁻ b, Ξ· (a, b) {c | (b, c) ∈ s} βˆ‚ΞΊ a #align probability_theory.kernel.comp_prod_fun ProbabilityTheory.kernel.compProdFun
Mathlib/Probability/Kernel/Composition.lean
93
96
theorem compProdFun_empty (ΞΊ : kernel Ξ± Ξ²) (Ξ· : kernel (Ξ± Γ— Ξ²) Ξ³) (a : Ξ±) : compProdFun ΞΊ Ξ· a βˆ… = 0 := by simp only [compProdFun, Set.mem_empty_iff_false, Set.setOf_false, measure_empty,
simp only [compProdFun, Set.mem_empty_iff_false, Set.setOf_false, measure_empty, MeasureTheory.lintegral_const, zero_mul]
true
import Mathlib.Algebra.CharZero.Defs import Mathlib.Algebra.Group.Hom.Defs import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.Order.Monoid.OrderDual import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Defs import Mathlib.Order.WithBot #align_import algebra.order.monoid.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" universe u v variable {Ξ± : Type u} {Ξ² : Type v} open Function namespace WithTop section Add variable [Add Ξ±] {a b c d : WithTop Ξ±} {x y : Ξ±} instance add : Add (WithTop Ξ±) := ⟨Option.mapβ‚‚ (Β· + Β·)⟩ #align with_top.has_add WithTop.add @[simp, norm_cast] lemma coe_add (a b : Ξ±) : ↑(a + b) = (a + b : WithTop Ξ±) := rfl #align with_top.coe_add WithTop.coe_add #noalign with_top.coe_bit0 #noalign with_top.coe_bit1 @[simp] theorem top_add (a : WithTop Ξ±) : ⊀ + a = ⊀ := rfl #align with_top.top_add WithTop.top_add @[simp] theorem add_top (a : WithTop Ξ±) : a + ⊀ = ⊀ := by cases a <;> rfl #align with_top.add_top WithTop.add_top @[simp] theorem add_eq_top : a + b = ⊀ ↔ a = ⊀ ∨ b = ⊀ := by match a, b with | ⊀, _ => simp | _, ⊀ => simp | (a : Ξ±), (b : Ξ±) => simp only [← coe_add, coe_ne_top, or_false] #align with_top.add_eq_top WithTop.add_eq_top theorem add_ne_top : a + b β‰  ⊀ ↔ a β‰  ⊀ ∧ b β‰  ⊀ := add_eq_top.not.trans not_or #align with_top.add_ne_top WithTop.add_ne_top theorem add_lt_top [LT Ξ±] {a b : WithTop Ξ±} : a + b < ⊀ ↔ a < ⊀ ∧ b < ⊀ := by simp_rw [WithTop.lt_top_iff_ne_top, add_ne_top] #align with_top.add_lt_top WithTop.add_lt_top theorem add_eq_coe : βˆ€ {a b : WithTop Ξ±} {c : Ξ±}, a + b = c ↔ βˆƒ a' b' : Ξ±, ↑a' = a ∧ ↑b' = b ∧ a' + b' = c | ⊀, b, c => by simp | some a, ⊀, c => by simp | some a, some b, c => by norm_cast; simp #align with_top.add_eq_coe WithTop.add_eq_coe -- Porting note (#10618): simp can already prove this. -- @[simp]
Mathlib/Algebra/Order/Monoid/WithTop.lean
156
156
theorem add_coe_eq_top_iff {x : WithTop Ξ±} {y : Ξ±} : x + y = ⊀ ↔ x = ⊀ := by
simp
true
import Mathlib.CategoryTheory.Sites.Grothendieck import Mathlib.CategoryTheory.Sites.Pretopology import Mathlib.CategoryTheory.Limits.Lattice import Mathlib.Topology.Sets.Opens #align_import category_theory.sites.spaces from "leanprover-community/mathlib"@"b6fa3beb29f035598cf0434d919694c5e98091eb" universe u namespace Opens variable (T : Type u) [TopologicalSpace T] open CategoryTheory TopologicalSpace CategoryTheory.Limits def grothendieckTopology : GrothendieckTopology (Opens T) where sieves X S := βˆ€ x ∈ X, βˆƒ (U : _) (f : U ⟢ X), S f ∧ x ∈ U top_mem' X x hx := ⟨_, πŸ™ _, trivial, hx⟩ pullback_stable' X Y S f hf y hy := by rcases hf y (f.le hy) with ⟨U, g, hg, hU⟩ refine ⟨U βŠ“ Y, homOfLE inf_le_right, ?_, hU, hy⟩ apply S.downward_closed hg (homOfLE inf_le_left) transitive' X S hS R hR x hx := by rcases hS x hx with ⟨U, f, hf, hU⟩ rcases hR hf _ hU with ⟨V, g, hg, hV⟩ exact ⟨_, g ≫ f, hg, hV⟩ #align opens.grothendieck_topology Opens.grothendieckTopology def pretopology : Pretopology (Opens T) where coverings X R := βˆ€ x ∈ X, βˆƒ (U : _) (f : U ⟢ X), R f ∧ x ∈ U has_isos X Y f i x hx := ⟨_, _, Presieve.singleton_self _, (inv f).le hx⟩ pullbacks X Y f S hS x hx := by rcases hS _ (f.le hx) with ⟨U, g, hg, hU⟩ refine ⟨_, _, Presieve.pullbackArrows.mk _ _ hg, ?_⟩ have : U βŠ“ Y ≀ pullback g f := leOfHom (pullback.lift (homOfLE inf_le_left) (homOfLE inf_le_right) rfl) apply this ⟨hU, hx⟩ transitive X S Ti hS hTi x hx := by rcases hS x hx with ⟨U, f, hf, hU⟩ rcases hTi f hf x hU with ⟨V, g, hg, hV⟩ exact ⟨_, _, ⟨_, g, f, hf, hg, rfl⟩, hV⟩ #align opens.pretopology Opens.pretopology @[simp] theorem pretopology_ofGrothendieck : Pretopology.ofGrothendieck _ (Opens.grothendieckTopology T) = Opens.pretopology T := by apply le_antisymm Β· intro X R hR x hx rcases hR x hx with ⟨U, f, ⟨V, g₁, gβ‚‚, hgβ‚‚, _⟩, hU⟩ exact ⟨V, gβ‚‚, hgβ‚‚, g₁.le hU⟩ Β· intro X R hR x hx rcases hR x hx with ⟨U, f, hf, hU⟩ exact ⟨U, f, Sieve.le_generate R U hf, hU⟩ #align opens.pretopology_of_grothendieck Opens.pretopology_ofGrothendieck @[simp]
Mathlib/CategoryTheory/Sites/Spaces.lean
92
95
theorem pretopology_toGrothendieck : Pretopology.toGrothendieck _ (Opens.pretopology T) = Opens.grothendieckTopology T := by rw [← pretopology_ofGrothendieck]
rw [← pretopology_ofGrothendieck] apply (Pretopology.gi (Opens T)).l_u_eq
true
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 : Ξ±}
Mathlib/Order/Interval/Set/WithBotTop.lean
33
35
theorem range_coe : range (some : Ξ± β†’ WithTop Ξ±) = Iio ⊀ := by ext x
ext x rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists]
true
import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.degree.lemmas from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f" noncomputable section open Polynomial open Finsupp Finset namespace Polynomial universe u v w variable {R : Type u} {S : Type v} {ΞΉ : Type w} {a b : R} {m n : β„•} section Semiring variable [Semiring R] {p q r : R[X]} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} {a : R} theorem degree_mul_C (a0 : a β‰  0) : (p * C a).degree = p.degree := by rw [degree_mul, degree_C a0, add_zero] set_option linter.uppercaseLean3 false in #align polynomial.degree_mul_C Polynomial.degree_mul_C theorem degree_C_mul (a0 : a β‰  0) : (C a * p).degree = p.degree := by rw [degree_mul, degree_C a0, zero_add] set_option linter.uppercaseLean3 false in #align polynomial.degree_C_mul Polynomial.degree_C_mul
Mathlib/Algebra/Polynomial/Degree/Lemmas.lean
366
367
theorem natDegree_mul_C (a0 : a β‰  0) : (p * C a).natDegree = p.natDegree := by
simp only [natDegree, degree_mul_C a0]
true
import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92" universe u v w namespace Module namespace End open Polynomial FiniteDimensional open scoped Polynomial variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V] theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) : eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) := calc eigenspace f (-q.coeff 0 / q.leadingCoeff) _ = LinearMap.ker (q.leadingCoeff β€’ f - algebraMap K (End K V) (-q.coeff 0)) := by rw [eigenspace_div] intro h rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq cases hq _ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom] _ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one] #align module.End.eigenspace_aeval_polynomial_degree_1 Module.End.eigenspace_aeval_polynomial_degree_1
Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean
46
51
theorem ker_aeval_ring_hom'_unit_polynomial (f : End K V) (c : K[X]Λ£) : LinearMap.ker (aeval f (c : K[X])) = βŠ₯ := by rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)]
rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)] simp only [aeval_def, evalβ‚‚_C] apply ker_algebraMap_end apply coeff_coe_units_zero_ne_zero c
true
import Mathlib.Algebra.Group.Hom.Defs import Mathlib.Algebra.Group.Units #align_import algebra.hom.units from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered open Function universe u v w namespace Units variable {Ξ± : Type*} {M : Type u} {N : Type v} {P : Type w} [Monoid M] [Monoid N] [Monoid P] @[to_additive "The additive homomorphism on `AddUnit`s induced by an `AddMonoidHom`."] def map (f : M β†’* N) : MΛ£ β†’* NΛ£ := MonoidHom.mk' (fun u => ⟨f u.val, f u.inv, by rw [← f.map_mul, u.val_inv, f.map_one], by rw [← f.map_mul, u.inv_val, f.map_one]⟩) fun x y => ext (f.map_mul x y) #align units.map Units.map #align add_units.map AddUnits.map @[to_additive (attr := simp)] theorem coe_map (f : M β†’* N) (x : MΛ£) : ↑(map f x) = f x := rfl #align units.coe_map Units.coe_map #align add_units.coe_map AddUnits.coe_map @[to_additive (attr := simp)] theorem coe_map_inv (f : M β†’* N) (u : MΛ£) : ↑(map f u)⁻¹ = f ↑u⁻¹ := rfl #align units.coe_map_inv Units.coe_map_inv #align add_units.coe_map_neg AddUnits.coe_map_neg @[to_additive (attr := simp)] theorem map_comp (f : M β†’* N) (g : N β†’* P) : map (g.comp f) = (map g).comp (map f) := rfl #align units.map_comp Units.map_comp #align add_units.map_comp AddUnits.map_comp @[to_additive] lemma map_injective {f : M β†’* N} (hf : Function.Injective f) : Function.Injective (map f) := fun _ _ e => ext (hf (congr_arg val e)) variable (M) @[to_additive (attr := simp)]
Mathlib/Algebra/Group/Units/Hom.lean
94
94
theorem map_id : map (MonoidHom.id M) = MonoidHom.id MΛ£ := by
ext; rfl
true
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import measure_theory.function.egorov from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open MeasureTheory NNReal ENNReal Topology namespace MeasureTheory open Set Filter TopologicalSpace variable {Ξ± Ξ² ΞΉ : Type*} {m : MeasurableSpace Ξ±} [MetricSpace Ξ²] {ΞΌ : Measure Ξ±} namespace Egorov def notConvergentSeq [Preorder ΞΉ] (f : ΞΉ β†’ Ξ± β†’ Ξ²) (g : Ξ± β†’ Ξ²) (n : β„•) (j : ΞΉ) : Set Ξ± := ⋃ (k) (_ : j ≀ k), { x | 1 / (n + 1 : ℝ) < dist (f k x) (g x) } #align measure_theory.egorov.not_convergent_seq MeasureTheory.Egorov.notConvergentSeq variable {n : β„•} {i j : ΞΉ} {s : Set Ξ±} {Ξ΅ : ℝ} {f : ΞΉ β†’ Ξ± β†’ Ξ²} {g : Ξ± β†’ Ξ²}
Mathlib/MeasureTheory/Function/Egorov.lean
50
52
theorem mem_notConvergentSeq_iff [Preorder ΞΉ] {x : Ξ±} : x ∈ notConvergentSeq f g n j ↔ βˆƒ k β‰₯ j, 1 / (n + 1 : ℝ) < dist (f k x) (g x) := by
simp_rw [notConvergentSeq, Set.mem_iUnion, exists_prop, mem_setOf]
true
import Mathlib.MeasureTheory.Integral.SetToL1 #align_import measure_theory.integral.bochner from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" assert_not_exists Differentiable noncomputable section open scoped Topology NNReal ENNReal MeasureTheory open Set Filter TopologicalSpace ENNReal EMetric namespace MeasureTheory variable {Ξ± E F π•œ : Type*} section WeightedSMul open ContinuousLinearMap variable [NormedAddCommGroup F] [NormedSpace ℝ F] {m : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±} def weightedSMul {_ : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (s : Set Ξ±) : F β†’L[ℝ] F := (ΞΌ s).toReal β€’ ContinuousLinearMap.id ℝ F #align measure_theory.weighted_smul MeasureTheory.weightedSMul theorem weightedSMul_apply {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (s : Set Ξ±) (x : F) : weightedSMul ΞΌ s x = (ΞΌ s).toReal β€’ x := by simp [weightedSMul] #align measure_theory.weighted_smul_apply MeasureTheory.weightedSMul_apply @[simp] theorem weightedSMul_zero_measure {m : MeasurableSpace Ξ±} : weightedSMul (0 : Measure Ξ±) = (0 : Set Ξ± β†’ F β†’L[ℝ] F) := by ext1; simp [weightedSMul] #align measure_theory.weighted_smul_zero_measure MeasureTheory.weightedSMul_zero_measure @[simp]
Mathlib/MeasureTheory/Integral/Bochner.lean
181
182
theorem weightedSMul_empty {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) : weightedSMul ΞΌ βˆ… = (0 : F β†’L[ℝ] F) := by
ext1 x; rw [weightedSMul_apply]; simp
true
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.Data.Fintype.Card import Mathlib.GroupTheory.Perm.Basic #align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Equiv Finset namespace Equiv.Perm variable {Ξ± : Type*} section IsSwap variable [DecidableEq Ξ±] def IsSwap (f : Perm Ξ±) : Prop := βˆƒ x y, x β‰  y ∧ f = swap x y #align equiv.perm.is_swap Equiv.Perm.IsSwap @[simp] theorem ofSubtype_swap_eq {p : Ξ± β†’ Prop} [DecidablePred p] (x y : Subtype p) : ofSubtype (Equiv.swap x y) = Equiv.swap ↑x ↑y := Equiv.ext fun z => by by_cases hz : p z Β· rw [swap_apply_def, ofSubtype_apply_of_mem _ hz] split_ifs with hzx hzy Β· simp_rw [hzx, Subtype.coe_eta, swap_apply_left] Β· simp_rw [hzy, Subtype.coe_eta, swap_apply_right] Β· rw [swap_apply_of_ne_of_ne] <;> simp [Subtype.ext_iff, *] Β· rw [ofSubtype_apply_of_not_mem _ hz, swap_apply_of_ne_of_ne] Β· intro h apply hz rw [h] exact Subtype.prop x intro h apply hz rw [h] exact Subtype.prop y #align equiv.perm.of_subtype_swap_eq Equiv.Perm.ofSubtype_swap_eq theorem IsSwap.of_subtype_isSwap {p : Ξ± β†’ Prop} [DecidablePred p] {f : Perm (Subtype p)} (h : f.IsSwap) : (ofSubtype f).IsSwap := let ⟨⟨x, hx⟩, ⟨y, hy⟩, hxy⟩ := h ⟨x, y, by simp only [Ne, Subtype.ext_iff] at hxy exact hxy.1, by rw [hxy.2, ofSubtype_swap_eq]⟩ #align equiv.perm.is_swap.of_subtype_is_swap Equiv.Perm.IsSwap.of_subtype_isSwap
Mathlib/GroupTheory/Perm/Support.lean
248
253
theorem ne_and_ne_of_swap_mul_apply_ne_self {f : Perm Ξ±} {x y : Ξ±} (hy : (swap x (f x) * f) y β‰  y) : f y β‰  y ∧ y β‰  x := by simp only [swap_apply_def, mul_apply, f.injective.eq_iff] at *
simp only [swap_apply_def, mul_apply, f.injective.eq_iff] at * by_cases h : f y = x Β· constructor <;> intro <;> simp_all only [if_true, eq_self_iff_true, not_true, Ne] Β· split_ifs at hy with h h <;> try { simp [*] at * }
true
import Mathlib.Data.Rat.Cast.Defs import Mathlib.Algebra.Field.Basic #align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441" namespace Rat variable {Ξ± : Type*} [DivisionRing Ξ±] -- Porting note: rewrote proof @[simp] theorem cast_inv_nat (n : β„•) : ((n⁻¹ : β„š) : Ξ±) = (n : Ξ±)⁻¹ := by cases' n with n Β· simp rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero, Int.sign_eq_one_of_pos (Nat.cast_pos.mpr n.succ_pos), Int.cast_one, one_div] #align rat.cast_inv_nat Rat.cast_inv_nat -- Porting note: proof got a lot easier - is this still the intended statement? @[simp] theorem cast_inv_int (n : β„€) : ((n⁻¹ : β„š) : Ξ±) = (n : Ξ±)⁻¹ := by cases' n with n n Β· simp [ofInt_eq_cast, cast_inv_nat] Β· simp only [ofInt_eq_cast, Int.cast_negSucc, ← Nat.cast_succ, cast_neg, inv_neg, cast_inv_nat] #align rat.cast_inv_int Rat.cast_inv_int @[simp, norm_cast] theorem cast_nnratCast {K} [DivisionRing K] (q : β„šβ‰₯0) : ((q : β„š) : K) = (q : K) := by rw [Rat.cast_def, NNRat.cast_def, NNRat.cast_def] have hn := @num_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den on_goal 1 => have hd := @den_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den case hdp => simpa only [Nat.cast_pos] using q.den_pos simp only [Int.cast_natCast, Nat.cast_inj] at hn hd rw [hn, hd, Int.cast_natCast] @[simp, norm_cast]
Mathlib/Data/Rat/Cast/Lemmas.lean
55
57
theorem cast_ofScientific {K} [DivisionRing K] (m : β„•) (s : Bool) (e : β„•) : (OfScientific.ofScientific m s e : β„š) = (OfScientific.ofScientific m s e : K) := by
rw [← NNRat.cast_ofScientific (K := K), ← NNRat.cast_ofScientific, cast_nnratCast]
true
import Mathlib.Analysis.Calculus.BumpFunction.Basic import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Function Filter Set Metric MeasureTheory FiniteDimensional Measure open scoped Topology namespace ContDiffBump variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HasContDiffBump E] [MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : β„•βˆž} {ΞΌ : Measure E} protected def normed (ΞΌ : Measure E) : E β†’ ℝ := fun x => f x / ∫ x, f x βˆ‚ΞΌ #align cont_diff_bump.normed ContDiffBump.normed theorem normed_def {ΞΌ : Measure E} (x : E) : f.normed ΞΌ x = f x / ∫ x, f x βˆ‚ΞΌ := rfl #align cont_diff_bump.normed_def ContDiffBump.normed_def theorem nonneg_normed (x : E) : 0 ≀ f.normed ΞΌ x := div_nonneg f.nonneg <| integral_nonneg f.nonneg' #align cont_diff_bump.nonneg_normed ContDiffBump.nonneg_normed theorem contDiff_normed {n : β„•βˆž} : ContDiff ℝ n (f.normed ΞΌ) := f.contDiff.div_const _ #align cont_diff_bump.cont_diff_normed ContDiffBump.contDiff_normed theorem continuous_normed : Continuous (f.normed ΞΌ) := f.continuous.div_const _ #align cont_diff_bump.continuous_normed ContDiffBump.continuous_normed theorem normed_sub (x : E) : f.normed ΞΌ (c - x) = f.normed ΞΌ (c + x) := by simp_rw [f.normed_def, f.sub] #align cont_diff_bump.normed_sub ContDiffBump.normed_sub theorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed ΞΌ (-x) = f.normed ΞΌ x := by simp_rw [f.normed_def, f.neg] #align cont_diff_bump.normed_neg ContDiffBump.normed_neg variable [BorelSpace E] [FiniteDimensional ℝ E] [IsLocallyFiniteMeasure ΞΌ] protected theorem integrable : Integrable f ΞΌ := f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport #align cont_diff_bump.integrable ContDiffBump.integrable protected theorem integrable_normed : Integrable (f.normed ΞΌ) ΞΌ := f.integrable.div_const _ #align cont_diff_bump.integrable_normed ContDiffBump.integrable_normed variable [ΞΌ.IsOpenPosMeasure] theorem integral_pos : 0 < ∫ x, f x βˆ‚ΞΌ := by refine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_ rw [f.support_eq] exact measure_ball_pos ΞΌ c f.rOut_pos #align cont_diff_bump.integral_pos ContDiffBump.integral_pos theorem integral_normed : ∫ x, f.normed ΞΌ x βˆ‚ΞΌ = 1 := by simp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), ← smul_eq_mul, integral_smul] exact inv_mul_cancel f.integral_pos.ne' #align cont_diff_bump.integral_normed ContDiffBump.integral_normed theorem support_normed_eq : Function.support (f.normed ΞΌ) = Metric.ball c f.rOut := by unfold ContDiffBump.normed rw [support_div, f.support_eq, support_const f.integral_pos.ne', inter_univ] #align cont_diff_bump.support_normed_eq ContDiffBump.support_normed_eq theorem tsupport_normed_eq : tsupport (f.normed ΞΌ) = Metric.closedBall c f.rOut := by rw [tsupport, f.support_normed_eq, closure_ball _ f.rOut_pos.ne'] #align cont_diff_bump.tsupport_normed_eq ContDiffBump.tsupport_normed_eq theorem hasCompactSupport_normed : HasCompactSupport (f.normed ΞΌ) := by simp only [HasCompactSupport, f.tsupport_normed_eq (ΞΌ := ΞΌ), isCompact_closedBall] #align cont_diff_bump.has_compact_support_normed ContDiffBump.hasCompactSupport_normed theorem tendsto_support_normed_smallSets {ΞΉ} {Ο† : ΞΉ β†’ ContDiffBump c} {l : Filter ΞΉ} (hΟ† : Tendsto (fun i => (Ο† i).rOut) l (𝓝 0)) : Tendsto (fun i => Function.support fun x => (Ο† i).normed ΞΌ x) l (𝓝 c).smallSets := by simp_rw [NormedAddCommGroup.tendsto_nhds_zero, Real.norm_eq_abs, abs_eq_self.mpr (Ο† _).rOut_pos.le] at hΟ† rw [nhds_basis_ball.smallSets.tendsto_right_iff] refine fun Ξ΅ hΞ΅ ↦ (hΟ† Ξ΅ hΞ΅).mono fun i hi ↦ ?_ rw [(Ο† i).support_normed_eq] exact ball_subset_ball hi.le #align cont_diff_bump.tendsto_support_normed_small_sets ContDiffBump.tendsto_support_normed_smallSets variable (ΞΌ) theorem integral_normed_smul {X} [NormedAddCommGroup X] [NormedSpace ℝ X] [CompleteSpace X] (z : X) : ∫ x, f.normed ΞΌ x β€’ z βˆ‚ΞΌ = z := by simp_rw [integral_smul_const, f.integral_normed (ΞΌ := ΞΌ), one_smul] #align cont_diff_bump.integral_normed_smul ContDiffBump.integral_normed_smul theorem measure_closedBall_le_integral : (ΞΌ (closedBall c f.rIn)).toReal ≀ ∫ x, f x βˆ‚ΞΌ := by calc (ΞΌ (closedBall c f.rIn)).toReal = ∫ x in closedBall c f.rIn, 1 βˆ‚ΞΌ := by simp _ = ∫ x in closedBall c f.rIn, f x βˆ‚ΞΌ := setIntegral_congr measurableSet_closedBall (fun x hx ↦ (one_of_mem_closedBall f hx).symm) _ ≀ ∫ x, f x βˆ‚ΞΌ := setIntegral_le_integral f.integrable (eventually_of_forall (fun x ↦ f.nonneg))
Mathlib/Analysis/Calculus/BumpFunction/Normed.lean
117
123
theorem normed_le_div_measure_closedBall_rIn (x : E) : f.normed ΞΌ x ≀ 1 / (ΞΌ (closedBall c f.rIn)).toReal := by rw [normed_def]
rw [normed_def] gcongr Β· exact ENNReal.toReal_pos (measure_closedBall_pos _ _ f.rIn_pos).ne' measure_closedBall_lt_top.ne Β· exact f.le_one Β· exact f.measure_closedBall_le_integral ΞΌ
true
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Prod import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Option #align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open Equiv @[simp] theorem Equiv.optionCongr_one {Ξ± : Type*} : (1 : Perm Ξ±).optionCongr = 1 := Equiv.optionCongr_refl #align equiv.option_congr_one Equiv.optionCongr_one @[simp] theorem Equiv.optionCongr_swap {Ξ± : Type*} [DecidableEq Ξ±] (x y : Ξ±) : optionCongr (swap x y) = swap (some x) (some y) := by ext (_ | i) Β· simp [swap_apply_of_ne_of_ne] Β· by_cases hx : i = x Β· simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def, Option.some.injEq] by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne] #align equiv.option_congr_swap Equiv.optionCongr_swap @[simp] theorem Equiv.optionCongr_sign {Ξ± : Type*} [DecidableEq Ξ±] [Fintype Ξ±] (e : Perm Ξ±) : Perm.sign e.optionCongr = Perm.sign e := by refine Perm.swap_induction_on e ?_ ?_ Β· simp [Perm.one_def] Β· intro f x y hne h simp [h, hne, Perm.mul_def, ← Equiv.optionCongr_trans] #align equiv.option_congr_sign Equiv.optionCongr_sign @[simp] theorem map_equiv_removeNone {Ξ± : Type*} [DecidableEq Ξ±] (Οƒ : Perm (Option Ξ±)) : (removeNone Οƒ).optionCongr = swap none (Οƒ none) * Οƒ := by ext1 x have : Option.map (⇑(removeNone Οƒ)) x = (swap none (Οƒ none)) (Οƒ x) := by cases' x with x Β· simp Β· cases h : Οƒ (some _) Β· simp [removeNone_none _ h] Β· have hn : Οƒ (some x) β‰  none := by simp [h] have hΟƒn : Οƒ (some x) β‰  Οƒ none := Οƒ.injective.ne (by simp) simp [removeNone_some _ ⟨_, h⟩, ← h, swap_apply_of_ne_of_ne hn hΟƒn] simpa using this #align map_equiv_remove_none map_equiv_removeNone @[simps] def Equiv.Perm.decomposeOption {Ξ± : Type*} [DecidableEq Ξ±] : Perm (Option Ξ±) ≃ Option Ξ± Γ— Perm Ξ± where toFun Οƒ := (Οƒ none, removeNone Οƒ) invFun i := swap none i.1 * i.2.optionCongr left_inv Οƒ := by simp right_inv := fun ⟨x, ΟƒβŸ© => by have : removeNone (swap none x * Οƒ.optionCongr) = Οƒ := Equiv.optionCongr_injective (by simp [← mul_assoc]) simp [← Perm.eq_inv_iff_eq, this] #align equiv.perm.decompose_option Equiv.Perm.decomposeOption
Mathlib/GroupTheory/Perm/Option.lean
76
77
theorem Equiv.Perm.decomposeOption_symm_of_none_apply {Ξ± : Type*} [DecidableEq Ξ±] (e : Perm Ξ±) (i : Option Ξ±) : Equiv.Perm.decomposeOption.symm (none, e) i = i.map e := by
simp
true
import Mathlib.Topology.Category.TopCat.Limits.Products #align_import topology.category.Top.limits.pullbacks from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace open CategoryTheory open CategoryTheory.Limits universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] section Pullback variable {X Y Z : TopCat.{u}} abbrev pullbackFst (f : X ⟢ Z) (g : Y ⟢ Z) : TopCat.of { p : X Γ— Y // f p.1 = g p.2 } ⟢ X := ⟨Prod.fst ∘ Subtype.val, by apply Continuous.comp <;> set_option tactic.skipAssignedInstances false in continuity⟩ #align Top.pullback_fst TopCat.pullbackFst lemma pullbackFst_apply (f : X ⟢ Z) (g : Y ⟢ Z) (x) : pullbackFst f g x = x.1.1 := rfl abbrev pullbackSnd (f : X ⟢ Z) (g : Y ⟢ Z) : TopCat.of { p : X Γ— Y // f p.1 = g p.2 } ⟢ Y := ⟨Prod.snd ∘ Subtype.val, by apply Continuous.comp <;> set_option tactic.skipAssignedInstances false in continuity⟩ #align Top.pullback_snd TopCat.pullbackSnd lemma pullbackSnd_apply (f : X ⟢ Z) (g : Y ⟢ Z) (x) : pullbackSnd f g x = x.1.2 := rfl def pullbackCone (f : X ⟢ Z) (g : Y ⟢ Z) : PullbackCone f g := PullbackCone.mk (pullbackFst f g) (pullbackSnd f g) (by dsimp [pullbackFst, pullbackSnd, Function.comp_def] ext ⟨x, h⟩ -- Next 2 lines were -- `rw [comp_apply, ContinuousMap.coe_mk, comp_apply, ContinuousMap.coe_mk]` -- `exact h` before leanprover/lean4#2644 rw [comp_apply, comp_apply] congr!) #align Top.pullback_cone TopCat.pullbackCone def pullbackConeIsLimit (f : X ⟢ Z) (g : Y ⟢ Z) : IsLimit (pullbackCone f g) := PullbackCone.isLimitAux' _ (by intro S constructor; swap Β· exact { toFun := fun x => ⟨⟨S.fst x, S.snd x⟩, by simpa using ConcreteCategory.congr_hom S.condition x⟩ continuous_toFun := by apply Continuous.subtype_mk <| Continuous.prod_mk ?_ ?_ Β· exact (PullbackCone.fst S)|>.continuous_toFun Β· exact (PullbackCone.snd S)|>.continuous_toFun } refine ⟨?_, ?_, ?_⟩ Β· delta pullbackCone ext a -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp_apply, ContinuousMap.coe_mk] Β· delta pullbackCone ext a -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp_apply, ContinuousMap.coe_mk] Β· intro m h₁ hβ‚‚ -- Porting note: used to be ext x apply ContinuousMap.ext; intro x apply Subtype.ext apply Prod.ext Β· simpa using ConcreteCategory.congr_hom h₁ x Β· simpa using ConcreteCategory.congr_hom hβ‚‚ x) #align Top.pullback_cone_is_limit TopCat.pullbackConeIsLimit def pullbackIsoProdSubtype (f : X ⟢ Z) (g : Y ⟢ Z) : pullback f g β‰… TopCat.of { p : X Γ— Y // f p.1 = g p.2 } := (limit.isLimit _).conePointUniqueUpToIso (pullbackConeIsLimit f g) #align Top.pullback_iso_prod_subtype TopCat.pullbackIsoProdSubtype @[reassoc (attr := simp)]
Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean
103
105
theorem pullbackIsoProdSubtype_inv_fst (f : X ⟢ Z) (g : Y ⟢ Z) : (pullbackIsoProdSubtype f g).inv ≫ pullback.fst = pullbackFst f g := by
simp [pullbackCone, pullbackIsoProdSubtype]
true
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
Mathlib/Data/Finsupp/Multiset.lean
71
79
theorem toMultiset_map (f : Ξ± β†’β‚€ β„•) (g : Ξ± β†’ Ξ²) : f.toMultiset.map g = toMultiset (f.mapDomain g) := by refine f.induction ?_ ?_
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
true
import Mathlib.Data.Real.NNReal import Mathlib.Tactic.GCongr.Core #align_import analysis.normed.group.seminorm from "leanprover-community/mathlib"@"09079525fd01b3dda35e96adaa08d2f943e1648c" open Set open NNReal variable {ΞΉ R R' E F G : Type*} structure AddGroupSeminorm (G : Type*) [AddGroup G] where -- Porting note: can't extend `ZeroHom G ℝ` because otherwise `to_additive` won't work since -- we aren't using old structures protected toFun : G β†’ ℝ protected map_zero' : toFun 0 = 0 protected add_le' : βˆ€ r s, toFun (r + s) ≀ toFun r + toFun s protected neg' : βˆ€ r, toFun (-r) = toFun r #align add_group_seminorm AddGroupSeminorm @[to_additive] structure GroupSeminorm (G : Type*) [Group G] where protected toFun : G β†’ ℝ protected map_one' : toFun 1 = 0 protected mul_le' : βˆ€ x y, toFun (x * y) ≀ toFun x + toFun y protected inv' : βˆ€ x, toFun x⁻¹ = toFun x #align group_seminorm GroupSeminorm structure NonarchAddGroupSeminorm (G : Type*) [AddGroup G] extends ZeroHom G ℝ where protected add_le_max' : βˆ€ r s, toFun (r + s) ≀ max (toFun r) (toFun s) protected neg' : βˆ€ r, toFun (-r) = toFun r #align nonarch_add_group_seminorm NonarchAddGroupSeminorm structure AddGroupNorm (G : Type*) [AddGroup G] extends AddGroupSeminorm G where protected eq_zero_of_map_eq_zero' : βˆ€ x, toFun x = 0 β†’ x = 0 #align add_group_norm AddGroupNorm @[to_additive] structure GroupNorm (G : Type*) [Group G] extends GroupSeminorm G where protected eq_one_of_map_eq_zero' : βˆ€ x, toFun x = 0 β†’ x = 1 #align group_norm GroupNorm structure NonarchAddGroupNorm (G : Type*) [AddGroup G] extends NonarchAddGroupSeminorm G where protected eq_zero_of_map_eq_zero' : βˆ€ x, toFun x = 0 β†’ x = 0 #align nonarch_add_group_norm NonarchAddGroupNorm class NonarchAddGroupSeminormClass (F : Type*) (Ξ± : outParam Type*) [AddGroup Ξ±] [FunLike F Ξ± ℝ] extends NonarchimedeanHomClass F Ξ± ℝ : Prop where protected map_zero (f : F) : f 0 = 0 protected map_neg_eq_map' (f : F) (a : Ξ±) : f (-a) = f a #align nonarch_add_group_seminorm_class NonarchAddGroupSeminormClass class NonarchAddGroupNormClass (F : Type*) (Ξ± : outParam Type*) [AddGroup Ξ±] [FunLike F Ξ± ℝ] extends NonarchAddGroupSeminormClass F Ξ± : Prop where protected eq_zero_of_map_eq_zero (f : F) {a : Ξ±} : f a = 0 β†’ a = 0 #align nonarch_add_group_norm_class NonarchAddGroupNormClass section NonarchAddGroupSeminormClass variable [AddGroup E] [FunLike F E ℝ] [NonarchAddGroupSeminormClass F E] (f : F) (x y : E)
Mathlib/Analysis/Normed/Group/Seminorm.lean
148
150
theorem map_sub_le_max : f (x - y) ≀ max (f x) (f y) := by rw [sub_eq_add_neg, ← NonarchAddGroupSeminormClass.map_neg_eq_map' f y]
rw [sub_eq_add_neg, ← NonarchAddGroupSeminormClass.map_neg_eq_map' f y] exact map_add_le_max _ _ _
true
import Mathlib.Data.Complex.Module import Mathlib.LinearAlgebra.Determinant #align_import data.complex.determinant from "leanprover-community/mathlib"@"65ec59902eb17e4ab7da8d7e3d0bd9774d1b8b99" namespace Complex @[simp]
Mathlib/Data/Complex/Determinant.lean
24
26
theorem det_conjAe : LinearMap.det conjAe.toLinearMap = -1 := by rw [← LinearMap.det_toMatrix basisOneI, toMatrix_conjAe, Matrix.det_fin_two_of]
rw [← LinearMap.det_toMatrix basisOneI, toMatrix_conjAe, Matrix.det_fin_two_of] simp
true
import Mathlib.Algebra.Associated import Mathlib.Algebra.Order.Monoid.Unbundled.Pow import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Factorial.Basic import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.nat.prime from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" open Bool Subtype open Nat namespace Nat variable {n : β„•} -- Porting note (#11180): removed @[pp_nodot] def Prime (p : β„•) := Irreducible p #align nat.prime Nat.Prime theorem irreducible_iff_nat_prime (a : β„•) : Irreducible a ↔ Nat.Prime a := Iff.rfl #align irreducible_iff_nat_prime Nat.irreducible_iff_nat_prime @[aesop safe destruct] theorem not_prime_zero : Β¬Prime 0 | h => h.ne_zero rfl #align nat.not_prime_zero Nat.not_prime_zero @[aesop safe destruct] theorem not_prime_one : Β¬Prime 1 | h => h.ne_one rfl #align nat.not_prime_one Nat.not_prime_one theorem Prime.ne_zero {n : β„•} (h : Prime n) : n β‰  0 := Irreducible.ne_zero h #align nat.prime.ne_zero Nat.Prime.ne_zero theorem Prime.pos {p : β„•} (pp : Prime p) : 0 < p := Nat.pos_of_ne_zero pp.ne_zero #align nat.prime.pos Nat.Prime.pos theorem Prime.two_le : βˆ€ {p : β„•}, Prime p β†’ 2 ≀ p | 0, h => (not_prime_zero h).elim | 1, h => (not_prime_one h).elim | _ + 2, _ => le_add_self #align nat.prime.two_le Nat.Prime.two_le theorem Prime.one_lt {p : β„•} : Prime p β†’ 1 < p := Prime.two_le #align nat.prime.one_lt Nat.Prime.one_lt lemma Prime.one_le {p : β„•} (hp : p.Prime) : 1 ≀ p := hp.one_lt.le instance Prime.one_lt' (p : β„•) [hp : Fact p.Prime] : Fact (1 < p) := ⟨hp.1.one_lt⟩ #align nat.prime.one_lt' Nat.Prime.one_lt' theorem Prime.ne_one {p : β„•} (hp : p.Prime) : p β‰  1 := hp.one_lt.ne' #align nat.prime.ne_one Nat.Prime.ne_one theorem Prime.eq_one_or_self_of_dvd {p : β„•} (pp : p.Prime) (m : β„•) (hm : m ∣ p) : m = 1 ∨ m = p := by obtain ⟨n, hn⟩ := hm have := pp.isUnit_or_isUnit hn rw [Nat.isUnit_iff, Nat.isUnit_iff] at this apply Or.imp_right _ this rintro rfl rw [hn, mul_one] #align nat.prime.eq_one_or_self_of_dvd Nat.Prime.eq_one_or_self_of_dvd theorem prime_def_lt'' {p : β„•} : Prime p ↔ 2 ≀ p ∧ βˆ€ m, m ∣ p β†’ m = 1 ∨ m = p := by refine ⟨fun h => ⟨h.two_le, h.eq_one_or_self_of_dvd⟩, fun h => ?_⟩ -- Porting note: needed to make β„• explicit have h1 := (@one_lt_two β„• ..).trans_le h.1 refine ⟨mt Nat.isUnit_iff.mp h1.ne', fun a b hab => ?_⟩ simp only [Nat.isUnit_iff] apply Or.imp_right _ (h.2 a _) Β· rintro rfl rw [← mul_right_inj' (pos_of_gt h1).ne', ← hab, mul_one] Β· rw [hab] exact dvd_mul_right _ _ #align nat.prime_def_lt'' Nat.prime_def_lt'' theorem prime_def_lt {p : β„•} : Prime p ↔ 2 ≀ p ∧ βˆ€ m < p, m ∣ p β†’ m = 1 := prime_def_lt''.trans <| and_congr_right fun p2 => forall_congr' fun _ => ⟨fun h l d => (h d).resolve_right (ne_of_lt l), fun h d => (le_of_dvd (le_of_succ_le p2) d).lt_or_eq_dec.imp_left fun l => h l d⟩ #align nat.prime_def_lt Nat.prime_def_lt theorem prime_def_lt' {p : β„•} : Prime p ↔ 2 ≀ p ∧ βˆ€ m, 2 ≀ m β†’ m < p β†’ Β¬m ∣ p := prime_def_lt.trans <| and_congr_right fun p2 => forall_congr' fun m => ⟨fun h m2 l d => not_lt_of_ge m2 ((h l d).symm β–Έ by decide), fun h l d => by rcases m with (_ | _ | m) Β· rw [eq_zero_of_zero_dvd d] at p2 revert p2 decide Β· rfl Β· exact (h le_add_self l).elim d⟩ #align nat.prime_def_lt' Nat.prime_def_lt' theorem prime_def_le_sqrt {p : β„•} : Prime p ↔ 2 ≀ p ∧ βˆ€ m, 2 ≀ m β†’ m ≀ sqrt p β†’ Β¬m ∣ p := prime_def_lt'.trans <| and_congr_right fun p2 => ⟨fun a m m2 l => a m m2 <| lt_of_le_of_lt l <| sqrt_lt_self p2, fun a => have : βˆ€ {m k : β„•}, m ≀ k β†’ 1 < m β†’ p β‰  m * k := fun {m k} mk m1 e => a m m1 (le_sqrt.2 (e.symm β–Έ Nat.mul_le_mul_left m mk)) ⟨k, e⟩ fun m m2 l ⟨k, e⟩ => by rcases le_total m k with mk | km Β· exact this mk m2 e Β· rw [mul_comm] at e refine this km (lt_of_mul_lt_mul_right ?_ (zero_le m)) e rwa [one_mul, ← e]⟩ #align nat.prime_def_le_sqrt Nat.prime_def_le_sqrt
Mathlib/Data/Nat/Prime.lean
147
153
theorem prime_of_coprime (n : β„•) (h1 : 1 < n) (h : βˆ€ m < n, m β‰  0 β†’ n.Coprime m) : Prime n := by refine prime_def_lt.mpr ⟨h1, fun m mlt mdvd => ?_⟩
refine prime_def_lt.mpr ⟨h1, fun m mlt mdvd => ?_⟩ have hm : m β‰  0 := by rintro rfl rw [zero_dvd_iff] at mdvd exact mlt.ne' mdvd exact (h m mlt hm).symm.eq_one_of_dvd mdvd
true
import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Normed.Field.InfiniteSum import Mathlib.Data.Nat.Choose.Cast import Mathlib.Data.Finset.NoncommProd import Mathlib.Topology.Algebra.Algebra #align_import analysis.normed_space.exponential from "leanprover-community/mathlib"@"62748956a1ece9b26b33243e2e3a2852176666f5" namespace NormedSpace open Filter RCLike ContinuousMultilinearMap NormedField Asymptotics open scoped Nat Topology ENNReal section TopologicalAlgebra variable (𝕂 𝔸 : Type*) [Field 𝕂] [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] def expSeries : FormalMultilinearSeries 𝕂 𝔸 𝔸 := fun n => (n !⁻¹ : 𝕂) β€’ ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸 #align exp_series NormedSpace.expSeries variable {𝔸} noncomputable def exp (x : 𝔸) : 𝔸 := (expSeries 𝕂 𝔸).sum x #align exp NormedSpace.exp variable {𝕂} theorem expSeries_apply_eq (x : 𝔸) (n : β„•) : (expSeries 𝕂 𝔸 n fun _ => x) = (n !⁻¹ : 𝕂) β€’ x ^ n := by simp [expSeries] #align exp_series_apply_eq NormedSpace.expSeries_apply_eq theorem expSeries_apply_eq' (x : 𝔸) : (fun n => expSeries 𝕂 𝔸 n fun _ => x) = fun n => (n !⁻¹ : 𝕂) β€’ x ^ n := funext (expSeries_apply_eq x) #align exp_series_apply_eq' NormedSpace.expSeries_apply_eq' theorem expSeries_sum_eq (x : 𝔸) : (expSeries 𝕂 𝔸).sum x = βˆ‘' n : β„•, (n !⁻¹ : 𝕂) β€’ x ^ n := tsum_congr fun n => expSeries_apply_eq x n #align exp_series_sum_eq NormedSpace.expSeries_sum_eq theorem exp_eq_tsum : exp 𝕂 = fun x : 𝔸 => βˆ‘' n : β„•, (n !⁻¹ : 𝕂) β€’ x ^ n := funext expSeries_sum_eq #align exp_eq_tsum NormedSpace.exp_eq_tsum theorem expSeries_apply_zero (n : β„•) : (expSeries 𝕂 𝔸 n fun _ => (0 : 𝔸)) = Pi.single (f := fun _ => 𝔸) 0 1 n := by rw [expSeries_apply_eq] cases' n with n Β· rw [pow_zero, Nat.factorial_zero, Nat.cast_one, inv_one, one_smul, Pi.single_eq_same] Β· rw [zero_pow (Nat.succ_ne_zero _), smul_zero, Pi.single_eq_of_ne n.succ_ne_zero] #align exp_series_apply_zero NormedSpace.expSeries_apply_zero @[simp] theorem exp_zero : exp 𝕂 (0 : 𝔸) = 1 := by simp_rw [exp_eq_tsum, ← expSeries_apply_eq, expSeries_apply_zero, tsum_pi_single] #align exp_zero NormedSpace.exp_zero @[simp] theorem exp_op [T2Space 𝔸] (x : 𝔸) : exp 𝕂 (MulOpposite.op x) = MulOpposite.op (exp 𝕂 x) := by simp_rw [exp, expSeries_sum_eq, ← MulOpposite.op_pow, ← MulOpposite.op_smul, tsum_op] #align exp_op NormedSpace.exp_op @[simp]
Mathlib/Analysis/NormedSpace/Exponential.lean
155
157
theorem exp_unop [T2Space 𝔸] (x : 𝔸ᡐᡒᡖ) : exp 𝕂 (MulOpposite.unop x) = MulOpposite.unop (exp 𝕂 x) := by
simp_rw [exp, expSeries_sum_eq, ← MulOpposite.unop_pow, ← MulOpposite.unop_smul, tsum_unop]
true
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ Mβ‚‚ : Submodule R M} {N₁ Nβ‚‚ : Submodule R N} namespace TensorProduct
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
52
60
theorem exists_multiset (x : M βŠ—[R] N) : βˆƒ S : Multiset (M Γ— N), x = (S.map fun i ↦ i.1 βŠ—β‚œ[R] i.2).sum := by induction x using TensorProduct.induction_on with
induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩
true
import Mathlib.Topology.Separation open Topology Filter Set TopologicalSpace section Basic variable {Ξ± : Type*} [TopologicalSpace Ξ±] {C : Set Ξ±} theorem AccPt.nhds_inter {x : Ξ±} {U : Set Ξ±} (h_acc : AccPt x (π“Ÿ C)) (hU : U ∈ 𝓝 x) : AccPt x (π“Ÿ (U ∩ C)) := by have : 𝓝[β‰ ] x ≀ π“Ÿ U := by rw [le_principal_iff] exact mem_nhdsWithin_of_mem_nhds hU rw [AccPt, ← inf_principal, ← inf_assoc, inf_of_le_left this] exact h_acc #align acc_pt.nhds_inter AccPt.nhds_inter def Preperfect (C : Set Ξ±) : Prop := βˆ€ x ∈ C, AccPt x (π“Ÿ C) #align preperfect Preperfect @[mk_iff perfect_def] structure Perfect (C : Set Ξ±) : Prop where closed : IsClosed C acc : Preperfect C #align perfect Perfect theorem preperfect_iff_nhds : Preperfect C ↔ βˆ€ x ∈ C, βˆ€ U ∈ 𝓝 x, βˆƒ y ∈ U ∩ C, y β‰  x := by simp only [Preperfect, accPt_iff_nhds] #align preperfect_iff_nhds preperfect_iff_nhds section Preperfect theorem Preperfect.open_inter {U : Set Ξ±} (hC : Preperfect C) (hU : IsOpen U) : Preperfect (U ∩ C) := by rintro x ⟨xU, xC⟩ apply (hC _ xC).nhds_inter exact hU.mem_nhds xU #align preperfect.open_inter Preperfect.open_inter theorem Preperfect.perfect_closure (hC : Preperfect C) : Perfect (closure C) := by constructor; Β· exact isClosed_closure intro x hx by_cases h : x ∈ C <;> apply AccPt.mono _ (principal_mono.mpr subset_closure) Β· exact hC _ h have : {x}ᢜ ∩ C = C := by simp [h] rw [AccPt, nhdsWithin, inf_assoc, inf_principal, this] rw [closure_eq_cluster_pts] at hx exact hx #align preperfect.perfect_closure Preperfect.perfect_closure
Mathlib/Topology/Perfect.lean
132
144
theorem preperfect_iff_perfect_closure [T1Space Ξ±] : Preperfect C ↔ Perfect (closure C) := by constructor <;> intro h
constructor <;> intro h Β· exact h.perfect_closure intro x xC have H : AccPt x (π“Ÿ (closure C)) := h.acc _ (subset_closure xC) rw [accPt_iff_frequently] at * have : βˆ€ y, y β‰  x ∧ y ∈ closure C β†’ βˆƒαΆ  z in 𝓝 y, z β‰  x ∧ z ∈ C := by rintro y ⟨hyx, yC⟩ simp only [← mem_compl_singleton_iff, and_comm, ← frequently_nhdsWithin_iff, hyx.nhdsWithin_compl_singleton, ← mem_closure_iff_frequently] exact yC rw [← frequently_frequently_nhds] exact H.mono this
true
import Mathlib.Algebra.Polynomial.Degree.Lemmas open Polynomial namespace Mathlib.Tactic.ComputeDegree section recursion_lemmas variable {R : Type*} section semiring variable [Semiring R] theorem natDegree_C_le (a : R) : natDegree (C a) ≀ 0 := (natDegree_C a).le theorem natDegree_natCast_le (n : β„•) : natDegree (n : R[X]) ≀ 0 := (natDegree_natCast _).le theorem natDegree_zero_le : natDegree (0 : R[X]) ≀ 0 := natDegree_zero.le theorem natDegree_one_le : natDegree (1 : R[X]) ≀ 0 := natDegree_one.le @[deprecated (since := "2024-04-17")] alias natDegree_nat_cast_le := natDegree_natCast_le
Mathlib/Tactic/ComputeDegree.lean
101
103
theorem coeff_add_of_eq {n : β„•} {a b : R} {f g : R[X]} (h_add_left : f.coeff n = a) (h_add_right : g.coeff n = b) : (f + g).coeff n = a + b := by
subst β€Ή_β€Ί β€Ή_β€Ί; apply coeff_add
true
import Mathlib.MeasureTheory.Constructions.Pi import Mathlib.MeasureTheory.Constructions.Prod.Integral open Fintype MeasureTheory MeasureTheory.Measure variable {π•œ : Type*} [RCLike π•œ] namespace MeasureTheory theorem Integrable.fin_nat_prod {n : β„•} {E : Fin n β†’ Type*} [βˆ€ i, MeasureSpace (E i)] [βˆ€ i, SigmaFinite (volume : Measure (E i))] {f : (i : Fin n) β†’ E i β†’ π•œ} (hf : βˆ€ i, Integrable (f i)) : Integrable (fun (x : (i : Fin n) β†’ E i) ↦ ∏ i, f i (x i)) := by induction n with | zero => simp only [Nat.zero_eq, Finset.univ_eq_empty, Finset.prod_empty, volume_pi, integrable_const_iff, one_ne_zero, pi_empty_univ, ENNReal.one_lt_top, or_true] | succ n n_ih => have := ((measurePreserving_piFinSuccAbove (fun i => (volume : Measure (E i))) 0).symm) rw [volume_pi, ← this.integrable_comp_emb (MeasurableEquiv.measurableEmbedding _)] simp_rw [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.prod_univ_succ, Fin.insertNth_zero] simp only [Fin.zero_succAbove, cast_eq, Function.comp_def, Fin.cons_zero, Fin.cons_succ] have : Integrable (fun (x : (j : Fin n) β†’ E (Fin.succ j)) ↦ ∏ j, f (Fin.succ j) (x j)) := n_ih (fun i ↦ hf _) exact Integrable.prod_mul (hf 0) this theorem Integrable.fintype_prod_dep {ΞΉ : Type*} [Fintype ΞΉ] {E : ΞΉ β†’ Type*} {f : (i : ΞΉ) β†’ E i β†’ π•œ} [βˆ€ i, MeasureSpace (E i)] [βˆ€ i, SigmaFinite (volume : Measure (E i))] (hf : βˆ€ i, Integrable (f i)) : Integrable (fun (x : (i : ΞΉ) β†’ E i) ↦ ∏ i, f i (x i)) := by let e := (equivFin ΞΉ).symm simp_rw [← (volume_measurePreserving_piCongrLeft _ e).integrable_comp_emb (MeasurableEquiv.measurableEmbedding _), ← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, Function.comp_def, Equiv.piCongrLeft_apply_apply] exact .fin_nat_prod (fun i ↦ hf _) theorem Integrable.fintype_prod {ΞΉ : Type*} [Fintype ΞΉ] {E : Type*} {f : ΞΉ β†’ E β†’ π•œ} [MeasureSpace E] [SigmaFinite (volume : Measure E)] (hf : βˆ€ i, Integrable (f i)) : Integrable (fun (x : ΞΉ β†’ E) ↦ ∏ i, f i (x i)) := Integrable.fintype_prod_dep hf theorem integral_fin_nat_prod_eq_prod {n : β„•} {E : Fin n β†’ Type*} [βˆ€ i, MeasureSpace (E i)] [βˆ€ i, SigmaFinite (volume : Measure (E i))] (f : (i : Fin n) β†’ E i β†’ π•œ) : ∫ x : (i : Fin n) β†’ E i, ∏ i, f i (x i) = ∏ i, ∫ x, f i x := by induction n with | zero => simp only [Nat.zero_eq, volume_pi, Finset.univ_eq_empty, Finset.prod_empty, integral_const, pi_empty_univ, ENNReal.one_toReal, smul_eq_mul, mul_one, pow_zero, one_smul] | succ n n_ih => calc _ = ∫ x : E 0 Γ— ((i : Fin n) β†’ E (Fin.succ i)), f 0 x.1 * ∏ i : Fin n, f (Fin.succ i) (x.2 i) := by rw [volume_pi, ← ((measurePreserving_piFinSuccAbove (fun i => (volume : Measure (E i))) 0).symm).integral_comp'] simp_rw [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.prod_univ_succ, Fin.insertNth_zero, Fin.cons_succ, volume_eq_prod, volume_pi, Fin.zero_succAbove, cast_eq, Fin.cons_zero] _ = (∫ x, f 0 x) * ∏ i : Fin n, ∫ (x : E (Fin.succ i)), f (Fin.succ i) x := by rw [← n_ih, ← integral_prod_mul, volume_eq_prod] _ = ∏ i, ∫ x, f i x := by rw [Fin.prod_univ_succ] theorem integral_fintype_prod_eq_prod (ΞΉ : Type*) [Fintype ΞΉ] {E : ΞΉ β†’ Type*} (f : (i : ΞΉ) β†’ E i β†’ π•œ) [βˆ€ i, MeasureSpace (E i)] [βˆ€ i, SigmaFinite (volume : Measure (E i))] : ∫ x : (i : ΞΉ) β†’ E i, ∏ i, f i (x i) = ∏ i, ∫ x, f i x := by let e := (equivFin ΞΉ).symm rw [← (volume_measurePreserving_piCongrLeft _ e).integral_comp'] simp_rw [← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft_apply_apply, MeasureTheory.integral_fin_nat_prod_eq_prod]
Mathlib/MeasureTheory/Integral/Pi.lean
95
98
theorem integral_fintype_prod_eq_pow {E : Type*} (ΞΉ : Type*) [Fintype ΞΉ] (f : E β†’ π•œ) [MeasureSpace E] [SigmaFinite (volume : Measure E)] : ∫ x : ΞΉ β†’ E, ∏ i, f (x i) = (∫ x, f x) ^ (card ΞΉ) := by
rw [integral_fintype_prod_eq_prod, Finset.prod_const, card]
true
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.MeasureTheory.Constructions.BorelSpace.ContinuousLinearMap import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import analysis.calculus.fderiv_measurable from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" set_option linter.uppercaseLean3 false -- A B D noncomputable section open Set Metric Asymptotics Filter ContinuousLinearMap MeasureTheory TopologicalSpace open scoped Topology section fderiv variable {π•œ : Type*} [NontriviallyNormedField π•œ] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π•œ E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π•œ F] variable {f : E β†’ F} (K : Set (E β†’L[π•œ] F)) namespace FDerivMeasurableAux def A (f : E β†’ F) (L : E β†’L[π•œ] F) (r Ξ΅ : ℝ) : Set E := { x | βˆƒ r' ∈ Ioc (r / 2) r, βˆ€ y ∈ ball x r', βˆ€ z ∈ ball x r', β€–f z - f y - L (z - y)β€– < Ξ΅ * r } #align fderiv_measurable_aux.A FDerivMeasurableAux.A def B (f : E β†’ F) (K : Set (E β†’L[π•œ] F)) (r s Ξ΅ : ℝ) : Set E := ⋃ L ∈ K, A f L r Ξ΅ ∩ A f L s Ξ΅ #align fderiv_measurable_aux.B FDerivMeasurableAux.B def D (f : E β†’ F) (K : Set (E β†’L[π•œ] F)) : Set E := β‹‚ e : β„•, ⋃ n : β„•, β‹‚ (p β‰₯ n) (q β‰₯ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e) #align fderiv_measurable_aux.D FDerivMeasurableAux.D theorem isOpen_A (L : E β†’L[π•œ] F) (r Ξ΅ : ℝ) : IsOpen (A f L r Ξ΅) := by rw [Metric.isOpen_iff] rintro x ⟨r', r'_mem, hr'⟩ obtain ⟨s, s_gt, s_lt⟩ : βˆƒ s : ℝ, r / 2 < s ∧ s < r' := exists_between r'_mem.1 have : s ∈ Ioc (r / 2) r := ⟨s_gt, le_of_lt (s_lt.trans_le r'_mem.2)⟩ refine ⟨r' - s, by linarith, fun x' hx' => ⟨s, this, ?_⟩⟩ have B : ball x' s βŠ† ball x r' := ball_subset (le_of_lt hx') intro y hy z hz exact hr' y (B hy) z (B hz) #align fderiv_measurable_aux.is_open_A FDerivMeasurableAux.isOpen_A
Mathlib/Analysis/Calculus/FDeriv/Measurable.lean
144
145
theorem isOpen_B {K : Set (E β†’L[π•œ] F)} {r s Ξ΅ : ℝ} : IsOpen (B f K r s Ξ΅) := by
simp [B, isOpen_biUnion, IsOpen.inter, isOpen_A]
true
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : β„• β†’ R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp] theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer] theorem descPochhammer_succ_left (n : β„•) : descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by rw [descPochhammer] theorem monic_descPochhammer (n : β„•) [Nontrivial R] [NoZeroDivisors R] : Monic <| descPochhammer R n := by induction' n with n hn Β· simp Β· have h : leadingCoeff (X - 1 : R[X]) = 1 := leadingCoeff_X_sub_C 1 have : natDegree (X - (1 : R[X])) β‰  0 := ne_zero_of_eq_one <| natDegree_X_sub_C (1 : R) rw [descPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp this, hn, monic_X, one_mul, one_mul, h, one_pow] section variable {R} {T : Type v} [Ring T] @[simp] theorem descPochhammer_map (f : R β†’+* T) (n : β„•) : (descPochhammer R n).map f = descPochhammer T n := by induction' n with n ih Β· simp Β· simp [ih, descPochhammer_succ_left, map_comp] end @[simp, norm_cast] theorem descPochhammer_eval_cast (n : β„•) (k : β„€) : (((descPochhammer β„€ n).eval k : β„€) : R) = ((descPochhammer R n).eval k : R) := by rw [← descPochhammer_map (algebraMap β„€ R), eval_map, ← eq_intCast (algebraMap β„€ R)] simp only [algebraMap_int_eq, eq_intCast, evalβ‚‚_at_intCast, Nat.cast_id, eq_natCast, Int.cast_id] theorem descPochhammer_eval_zero {n : β„•} : (descPochhammer R n).eval 0 = if n = 0 then 1 else 0 := by cases n Β· simp Β· simp [X_mul, Nat.succ_ne_zero, descPochhammer_succ_left] theorem descPochhammer_zero_eval_zero : (descPochhammer R 0).eval 0 = 1 := by simp @[simp] theorem descPochhammer_ne_zero_eval_zero {n : β„•} (h : n β‰  0) : (descPochhammer R n).eval 0 = 0 := by simp [descPochhammer_eval_zero, h] theorem descPochhammer_succ_right (n : β„•) : descPochhammer R (n + 1) = descPochhammer R n * (X - (n : R[X])) := by suffices h : descPochhammer β„€ (n + 1) = descPochhammer β„€ n * (X - (n : β„€[X])) by apply_fun Polynomial.map (algebraMap β„€ R) at h simpa [descPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X, Polynomial.map_intCast] using h induction' n with n ih Β· simp [descPochhammer] Β· conv_lhs => rw [descPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← descPochhammer_succ_left, sub_comp, X_comp, natCast_comp] rw [Nat.cast_add, Nat.cast_one, sub_add_eq_sub_sub_swap] @[simp] theorem descPochhammer_natDegree (n : β„•) [NoZeroDivisors R] [Nontrivial R] : (descPochhammer R n).natDegree = n := by induction' n with n hn Β· simp Β· have : natDegree (X - (n : R[X])) = 1 := natDegree_X_sub_C (n : R) rw [descPochhammer_succ_right, natDegree_mul _ (ne_zero_of_natDegree_gt <| this.symm β–Έ Nat.zero_lt_one), hn, this] cases n Β· simp Β· refine ne_zero_of_natDegree_gt <| hn.symm β–Έ Nat.add_one_pos _
Mathlib/RingTheory/Polynomial/Pochhammer.lean
326
329
theorem descPochhammer_succ_eval {S : Type*} [Ring S] (n : β„•) (k : S) : (descPochhammer S (n + 1)).eval k = (descPochhammer S n).eval k * (k - n) := by rw [descPochhammer_succ_right, mul_sub, eval_sub, eval_mul_X, ← Nat.cast_comm, ← C_eq_natCast,
rw [descPochhammer_succ_right, mul_sub, eval_sub, eval_mul_X, ← Nat.cast_comm, ← C_eq_natCast, eval_C_mul, Nat.cast_comm, ← mul_sub]
true
import Mathlib.Data.Fintype.Basic import Mathlib.Data.Finset.Card import Mathlib.Data.List.NodupEquivFin import Mathlib.Data.Set.Image #align_import data.fintype.card from "leanprover-community/mathlib"@"bf2428c9486c407ca38b5b3fb10b87dad0bc99fa" assert_not_exists MonoidWithZero assert_not_exists MulAction open Function open Nat universe u v variable {Ξ± Ξ² Ξ³ : Type*} open Finset Function namespace Fintype def card (Ξ±) [Fintype Ξ±] : β„• := (@univ Ξ± _).card #align fintype.card Fintype.card def truncEquivFin (Ξ±) [DecidableEq Ξ±] [Fintype Ξ±] : Trunc (Ξ± ≃ Fin (card Ξ±)) := by unfold card Finset.card exact Quot.recOnSubsingleton' (motive := fun s : Multiset Ξ± => (βˆ€ x : Ξ±, x ∈ s) β†’ s.Nodup β†’ Trunc (Ξ± ≃ Fin (Multiset.card s))) univ.val (fun l (h : βˆ€ x : Ξ±, x ∈ l) (nd : l.Nodup) => Trunc.mk (nd.getEquivOfForallMemList _ h).symm) mem_univ_val univ.2 #align fintype.trunc_equiv_fin Fintype.truncEquivFin noncomputable def equivFin (Ξ±) [Fintype Ξ±] : Ξ± ≃ Fin (card Ξ±) := letI := Classical.decEq Ξ± (truncEquivFin Ξ±).out #align fintype.equiv_fin Fintype.equivFin def truncFinBijection (Ξ±) [Fintype Ξ±] : Trunc { f : Fin (card Ξ±) β†’ Ξ± // Bijective f } := by unfold card Finset.card refine Quot.recOnSubsingleton' (motive := fun s : Multiset Ξ± => (βˆ€ x : Ξ±, x ∈ s) β†’ s.Nodup β†’ Trunc {f : Fin (Multiset.card s) β†’ Ξ± // Bijective f}) univ.val (fun l (h : βˆ€ x : Ξ±, x ∈ l) (nd : l.Nodup) => Trunc.mk (nd.getBijectionOfForallMemList _ h)) mem_univ_val univ.2 #align fintype.trunc_fin_bijection Fintype.truncFinBijection theorem subtype_card {p : Ξ± β†’ Prop} (s : Finset Ξ±) (H : βˆ€ x : Ξ±, x ∈ s ↔ p x) : @card { x // p x } (Fintype.subtype s H) = s.card := Multiset.card_pmap _ _ _ #align fintype.subtype_card Fintype.subtype_card
Mathlib/Data/Fintype/Card.lean
126
130
theorem card_of_subtype {p : Ξ± β†’ Prop} (s : Finset Ξ±) (H : βˆ€ x : Ξ±, x ∈ s ↔ p x) [Fintype { x // p x }] : card { x // p x } = s.card := by rw [← subtype_card s H]
rw [← subtype_card s H] congr apply Subsingleton.elim
true
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic import Mathlib.NumberTheory.GaussSum #align_import number_theory.legendre_symbol.quadratic_char.gauss_sum from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section SpecialValues open ZMod MulChar variable {F : Type*} [Field F] [Fintype F] theorem quadraticChar_two [DecidableEq F] (hF : ringChar F β‰  2) : quadraticChar F 2 = Ο‡β‚ˆ (Fintype.card F) := IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F) isQuadratic_Ο‡β‚ˆ hF ((quadraticChar_eq_pow_of_char_ne_two' hF 2).trans (FiniteField.two_pow_card hF)) #align quadratic_char_two quadraticChar_two theorem FiniteField.isSquare_two_iff : IsSquare (2 : F) ↔ Fintype.card F % 8 β‰  3 ∧ Fintype.card F % 8 β‰  5 := by classical by_cases hF : ringChar F = 2 focus have h := FiniteField.even_card_of_char_two hF simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff] rotate_left focus have h := FiniteField.odd_card_of_char_ne_two hF rw [← quadraticChar_one_iff_isSquare (Ring.two_ne_zero hF), quadraticChar_two hF, Ο‡β‚ˆ_nat_eq_if_mod_eight] simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : β„€) β‰  1), imp_false, Classical.not_not] all_goals rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8) revert h₁ h generalize Fintype.card F % 8 = n intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!` #align finite_field.is_square_two_iff FiniteField.isSquare_two_iff theorem quadraticChar_neg_two [DecidableEq F] (hF : ringChar F β‰  2) : quadraticChar F (-2) = Ο‡β‚ˆ' (Fintype.card F) := by rw [(by norm_num : (-2 : F) = -1 * 2), map_mul, Ο‡β‚ˆ'_eq_Ο‡β‚„_mul_Ο‡β‚ˆ, quadraticChar_neg_one hF, quadraticChar_two hF, @cast_natCast _ (ZMod 4) _ _ _ (by decide : 4 ∣ 8)] #align quadratic_char_neg_two quadraticChar_neg_two theorem FiniteField.isSquare_neg_two_iff : IsSquare (-2 : F) ↔ Fintype.card F % 8 β‰  5 ∧ Fintype.card F % 8 β‰  7 := by classical by_cases hF : ringChar F = 2 focus have h := FiniteField.even_card_of_char_two hF simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff] rotate_left focus have h := FiniteField.odd_card_of_char_ne_two hF rw [← quadraticChar_one_iff_isSquare (neg_ne_zero.mpr (Ring.two_ne_zero hF)), quadraticChar_neg_two hF, Ο‡β‚ˆ'_nat_eq_if_mod_eight] simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : β„€) β‰  1), imp_false, Classical.not_not] all_goals rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8) revert h₁ h generalize Fintype.card F % 8 = n intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!` #align finite_field.is_square_neg_two_iff FiniteField.isSquare_neg_two_iff theorem quadraticChar_card_card [DecidableEq F] (hF : ringChar F β‰  2) {F' : Type*} [Field F'] [Fintype F'] [DecidableEq F'] (hF' : ringChar F' β‰  2) (h : ringChar F' β‰  ringChar F) : quadraticChar F (Fintype.card F') = quadraticChar F' (quadraticChar F (-1) * Fintype.card F) := by let Ο‡ := (quadraticChar F).ringHomComp (algebraMap β„€ F') have hχ₁ : Ο‡.IsNontrivial := by obtain ⟨a, ha⟩ := quadraticChar_exists_neg_one hF have hu : IsUnit a := by contrapose ha exact ne_of_eq_of_ne (map_nonunit (quadraticChar F) ha) (mt zero_eq_neg.mp one_ne_zero) use hu.unit simp only [Ο‡, IsUnit.unit_spec, ringHomComp_apply, eq_intCast, Ne, ha] rw [Int.cast_neg, Int.cast_one] exact Ring.neg_one_ne_one_of_char_ne_two hF' have hΟ‡β‚‚ : Ο‡.IsQuadratic := IsQuadratic.comp (quadraticChar_isQuadratic F) _ have h := Char.card_pow_card hχ₁ hΟ‡β‚‚ h hF' rw [← quadraticChar_eq_pow_of_char_ne_two' hF'] at h exact (IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F') (quadraticChar_isQuadratic F) hF' h).symm #align quadratic_char_card_card quadraticChar_card_card
Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/GaussSum.lean
119
125
theorem quadraticChar_odd_prime [DecidableEq F] (hF : ringChar F β‰  2) {p : β„•} [Fact p.Prime] (hp₁ : p β‰  2) (hpβ‚‚ : ringChar F β‰  p) : quadraticChar F p = quadraticChar (ZMod p) (Ο‡β‚„ (Fintype.card F) * Fintype.card F) := by rw [← quadraticChar_neg_one hF]
rw [← quadraticChar_neg_one hF] have h := quadraticChar_card_card hF (ne_of_eq_of_ne (ringChar_zmod_n p) hp₁) (ne_of_eq_of_ne (ringChar_zmod_n p) hpβ‚‚.symm) rwa [card p] at h
true
import Mathlib.MeasureTheory.Integral.Lebesgue import Mathlib.Topology.MetricSpace.ThickenedIndicator open MeasureTheory Topology Metric Filter Set ENNReal NNReal open scoped Topology ENNReal NNReal BoundedContinuousFunction section auxiliary namespace MeasureTheory variable {Ξ© : Type*} [TopologicalSpace Ξ©] [MeasurableSpace Ξ©] [OpensMeasurableSpace Ξ©] theorem tendsto_lintegral_nn_filter_of_le_const {ΞΉ : Type*} {L : Filter ΞΉ} [L.IsCountablyGenerated] (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ] {fs : ΞΉ β†’ Ξ© →ᡇ ℝβ‰₯0} {c : ℝβ‰₯0} (fs_le_const : βˆ€αΆ  i in L, βˆ€α΅ Ο‰ : Ξ© βˆ‚ΞΌ, fs i Ο‰ ≀ c) {f : Ξ© β†’ ℝβ‰₯0} (fs_lim : βˆ€α΅ Ο‰ : Ξ© βˆ‚ΞΌ, Tendsto (fun i ↦ fs i Ο‰) L (𝓝 (f Ο‰))) : Tendsto (fun i ↦ ∫⁻ Ο‰, fs i Ο‰ βˆ‚ΞΌ) L (𝓝 (∫⁻ Ο‰, f Ο‰ βˆ‚ΞΌ)) := by refine tendsto_lintegral_filter_of_dominated_convergence (fun _ ↦ c) (eventually_of_forall fun i ↦ (ENNReal.continuous_coe.comp (fs i).continuous).measurable) ?_ (@lintegral_const_lt_top _ _ ΞΌ _ _ (@ENNReal.coe_ne_top c)).ne ?_ Β· simpa only [Function.comp_apply, ENNReal.coe_le_coe] using fs_le_const Β· simpa only [Function.comp_apply, ENNReal.tendsto_coe] using fs_lim #align measure_theory.finite_measure.tendsto_lintegral_nn_filter_of_le_const MeasureTheory.tendsto_lintegral_nn_filter_of_le_const theorem measure_of_cont_bdd_of_tendsto_filter_indicator {ΞΉ : Type*} {L : Filter ΞΉ} [L.IsCountablyGenerated] [TopologicalSpace Ξ©] [OpensMeasurableSpace Ξ©] (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ] {c : ℝβ‰₯0} {E : Set Ξ©} (E_mble : MeasurableSet E) (fs : ΞΉ β†’ Ξ© →ᡇ ℝβ‰₯0) (fs_bdd : βˆ€αΆ  i in L, βˆ€α΅ Ο‰ : Ξ© βˆ‚ΞΌ, fs i Ο‰ ≀ c) (fs_lim : βˆ€α΅ Ο‰ βˆ‚ΞΌ, Tendsto (fun i ↦ fs i Ο‰) L (𝓝 (indicator E (fun _ ↦ (1 : ℝβ‰₯0)) Ο‰))) : Tendsto (fun n ↦ lintegral ΞΌ fun Ο‰ ↦ fs n Ο‰) L (𝓝 (ΞΌ E)) := by convert tendsto_lintegral_nn_filter_of_le_const ΞΌ fs_bdd fs_lim have aux : βˆ€ Ο‰, indicator E (fun _ ↦ (1 : ℝβ‰₯0∞)) Ο‰ = ↑(indicator E (fun _ ↦ (1 : ℝβ‰₯0)) Ο‰) := fun Ο‰ ↦ by simp only [ENNReal.coe_indicator, ENNReal.coe_one] simp_rw [← aux, lintegral_indicator _ E_mble] simp only [lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter] #align measure_theory.measure_of_cont_bdd_of_tendsto_filter_indicator MeasureTheory.measure_of_cont_bdd_of_tendsto_filter_indicator
Mathlib/MeasureTheory/Measure/HasOuterApproxClosed.lean
95
105
theorem measure_of_cont_bdd_of_tendsto_indicator [OpensMeasurableSpace Ξ©] (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ] {c : ℝβ‰₯0} {E : Set Ξ©} (E_mble : MeasurableSet E) (fs : β„• β†’ Ξ© →ᡇ ℝβ‰₯0) (fs_bdd : βˆ€ n Ο‰, fs n Ο‰ ≀ c) (fs_lim : Tendsto (fun n Ο‰ ↦ fs n Ο‰) atTop (𝓝 (indicator E fun _ ↦ (1 : ℝβ‰₯0)))) : Tendsto (fun n ↦ lintegral ΞΌ fun Ο‰ ↦ fs n Ο‰) atTop (𝓝 (ΞΌ E)) := by have fs_lim' :
have fs_lim' : βˆ€ Ο‰, Tendsto (fun n : β„• ↦ (fs n Ο‰ : ℝβ‰₯0)) atTop (𝓝 (indicator E (fun _ ↦ (1 : ℝβ‰₯0)) Ο‰)) := by rw [tendsto_pi_nhds] at fs_lim exact fun Ο‰ ↦ fs_lim Ο‰ apply measure_of_cont_bdd_of_tendsto_filter_indicator ΞΌ E_mble fs (eventually_of_forall fun n ↦ eventually_of_forall (fs_bdd n)) (eventually_of_forall fs_lim')
true
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioc PNat.card_Ioc @[simp]
Mathlib/Data/PNat/Interval.lean
94
99
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo]
rw [← Nat.card_Ioo] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map]
true
import Mathlib.RepresentationTheory.Action.Limits import Mathlib.RepresentationTheory.Action.Concrete import Mathlib.CategoryTheory.Monoidal.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Transport import Mathlib.CategoryTheory.Monoidal.Rigid.OfEquivalence import Mathlib.CategoryTheory.Monoidal.Rigid.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Linear import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.Types.Basic universe u v open CategoryTheory Limits variable {V : Type (u + 1)} [LargeCategory V] {G : MonCat.{u}} namespace Action section Monoidal open MonoidalCategory variable [MonoidalCategory V] instance instMonoidalCategory : MonoidalCategory (Action V G) := Monoidal.transport (Action.functorCategoryEquivalence _ _).symm @[simp] theorem tensorUnit_v : (πŸ™_ (Action V G)).V = πŸ™_ V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_V Action.tensorUnit_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensorUnit_rho {g : G} : (πŸ™_ (Action V G)).ρ g = πŸ™ (πŸ™_ V) := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_rho Action.tensorUnit_rho @[simp] theorem tensor_v {X Y : Action V G} : (X βŠ— Y).V = X.V βŠ— Y.V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_V Action.tensor_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensor_rho {X Y : Action V G} {g : G} : (X βŠ— Y).ρ g = X.ρ g βŠ— Y.ρ g := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_rho Action.tensor_rho @[simp] theorem tensor_hom {W X Y Z : Action V G} (f : W ⟢ X) (g : Y ⟢ Z) : (f βŠ— g).hom = f.hom βŠ— g.hom := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_hom Action.tensor_hom @[simp] theorem whiskerLeft_hom (X : Action V G) {Y Z : Action V G} (f : Y ⟢ Z) : (X ◁ f).hom = X.V ◁ f.hom := rfl @[simp] theorem whiskerRight_hom {X Y : Action V G} (f : X ⟢ Y) (Z : Action V G) : (f β–· Z).hom = f.hom β–· Z.V := rfl -- Porting note: removed @[simp] as the simpNF linter complains
Mathlib/RepresentationTheory/Action/Monoidal.lean
82
85
theorem associator_hom_hom {X Y Z : Action V G} : Hom.hom (Ξ±_ X Y Z).hom = (Ξ±_ X.V Y.V Z.V).hom := by dsimp
dsimp simp
true
import Mathlib.Data.Bundle import Mathlib.Data.Set.Image import Mathlib.Topology.PartialHomeomorph import Mathlib.Topology.Order.Basic #align_import topology.fiber_bundle.trivialization from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" open TopologicalSpace Filter Set Bundle Function open scoped Topology Classical Bundle variable {ΞΉ : Type*} {B : Type*} {F : Type*} {E : B β†’ Type*} variable (F) {Z : Type*} [TopologicalSpace B] [TopologicalSpace F] {proj : Z β†’ B} structure Pretrivialization (proj : Z β†’ B) extends PartialEquiv Z (B Γ— F) where open_target : IsOpen target baseSet : Set B open_baseSet : IsOpen baseSet source_eq : source = proj ⁻¹' baseSet target_eq : target = baseSet Γ—Λ’ univ proj_toFun : βˆ€ p ∈ source, (toFun p).1 = proj p #align pretrivialization Pretrivialization namespace Pretrivialization variable {F} variable (e : Pretrivialization F proj) {x : Z} @[coe] def toFun' : Z β†’ (B Γ— F) := e.toFun instance : CoeFun (Pretrivialization F proj) fun _ => Z β†’ B Γ— F := ⟨toFun'⟩ @[ext] lemma ext' (e e' : Pretrivialization F proj) (h₁ : e.toPartialEquiv = e'.toPartialEquiv) (hβ‚‚ : e.baseSet = e'.baseSet) : e = e' := by cases e; cases e'; congr #align pretrivialization.ext Pretrivialization.ext' -- Porting note (#11215): TODO: move `ext` here? lemma ext {e e' : Pretrivialization F proj} (h₁ : βˆ€ x, e x = e' x) (hβ‚‚ : βˆ€ x, e.toPartialEquiv.symm x = e'.toPartialEquiv.symm x) (h₃ : e.baseSet = e'.baseSet) : e = e' := by ext1 <;> [ext1; exact h₃] Β· apply h₁ Β· apply hβ‚‚ Β· rw [e.source_eq, e'.source_eq, h₃] lemma toPartialEquiv_injective [Nonempty F] : Injective (toPartialEquiv : Pretrivialization F proj β†’ PartialEquiv Z (B Γ— F)) := by refine fun e e' h ↦ ext' _ _ h ?_ simpa only [fst_image_prod, univ_nonempty, target_eq] using congr_arg (Prod.fst '' PartialEquiv.target Β·) h @[simp, mfld_simps] theorem coe_coe : ⇑e.toPartialEquiv = e := rfl #align pretrivialization.coe_coe Pretrivialization.coe_coe @[simp, mfld_simps] theorem coe_fst (ex : x ∈ e.source) : (e x).1 = proj x := e.proj_toFun x ex #align pretrivialization.coe_fst Pretrivialization.coe_fst theorem mem_source : x ∈ e.source ↔ proj x ∈ e.baseSet := by rw [e.source_eq, mem_preimage] #align pretrivialization.mem_source Pretrivialization.mem_source theorem coe_fst' (ex : proj x ∈ e.baseSet) : (e x).1 = proj x := e.coe_fst (e.mem_source.2 ex) #align pretrivialization.coe_fst' Pretrivialization.coe_fst' protected theorem eqOn : EqOn (Prod.fst ∘ e) proj e.source := fun _ hx => e.coe_fst hx #align pretrivialization.eq_on Pretrivialization.eqOn theorem mk_proj_snd (ex : x ∈ e.source) : (proj x, (e x).2) = e x := Prod.ext (e.coe_fst ex).symm rfl #align pretrivialization.mk_proj_snd Pretrivialization.mk_proj_snd theorem mk_proj_snd' (ex : proj x ∈ e.baseSet) : (proj x, (e x).2) = e x := Prod.ext (e.coe_fst' ex).symm rfl #align pretrivialization.mk_proj_snd' Pretrivialization.mk_proj_snd' def setSymm : e.target β†’ Z := e.target.restrict e.toPartialEquiv.symm #align pretrivialization.set_symm Pretrivialization.setSymm
Mathlib/Topology/FiberBundle/Trivialization.lean
141
142
theorem mem_target {x : B Γ— F} : x ∈ e.target ↔ x.1 ∈ e.baseSet := by
rw [e.target_eq, prod_univ, mem_preimage]
true
import Mathlib.Algebra.Polynomial.Splits #align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222" noncomputable section @[ext] structure Cubic (R : Type*) where (a b c d : R) #align cubic Cubic namespace Cubic open Cubic Polynomial open Polynomial variable {R S F K : Type*} instance [Inhabited R] : Inhabited (Cubic R) := ⟨⟨default, default, default, default⟩⟩ instance [Zero R] : Zero (Cubic R) := ⟨⟨0, 0, 0, 0⟩⟩ section Basic variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R] def toPoly (P : Cubic R) : R[X] := C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d #align cubic.to_poly Cubic.toPoly theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} : C w * (X - C x) * (X - C y) * (X - C z) = toPoly ⟨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)⟩ := by simp only [toPoly, C_neg, C_add, C_mul] ring1 set_option linter.uppercaseLean3 false in #align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq theorem prod_X_sub_C_eq [CommRing S] {x y z : S} : (X - C x) * (X - C y) * (X - C z) = toPoly ⟨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)⟩ := by rw [← one_mul <| X - C x, ← C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul] set_option linter.uppercaseLean3 false in #align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq section Map variable [Semiring S] {Ο† : R β†’+* S} def map (Ο† : R β†’+* S) (P : Cubic R) : Cubic S := βŸ¨Ο† P.a, Ο† P.b, Ο† P.c, Ο† P.d⟩ #align cubic.map Cubic.map
Mathlib/Algebra/CubicDiscriminant.lean
458
459
theorem map_toPoly : (map Ο† P).toPoly = Polynomial.map Ο† P.toPoly := by
simp only [map, toPoly, map_C, map_X, Polynomial.map_add, Polynomial.map_mul, Polynomial.map_pow]
true
import Mathlib.Algebra.Algebra.Spectrum import Mathlib.LinearAlgebra.GeneralLinearGroup import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.RingTheory.Nilpotent.Basic #align_import linear_algebra.eigenspace.basic from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" universe u v w namespace Module namespace End open FiniteDimensional Set variable {K R : Type v} {V M : Type w} [CommRing R] [AddCommGroup M] [Module R M] [Field K] [AddCommGroup V] [Module K V] def eigenspace (f : End R M) (ΞΌ : R) : Submodule R M := LinearMap.ker (f - algebraMap R (End R M) ΞΌ) #align module.End.eigenspace Module.End.eigenspace @[simp]
Mathlib/LinearAlgebra/Eigenspace/Basic.lean
69
69
theorem eigenspace_zero (f : End R M) : f.eigenspace 0 = LinearMap.ker f := by
simp [eigenspace]
true
import Mathlib.Algebra.Polynomial.Monic #align_import algebra.polynomial.big_operators from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722" open Finset open Multiset open Polynomial universe u w variable {R : Type u} {ΞΉ : Type w} namespace Polynomial variable (s : Finset ΞΉ) section Semiring variable {S : Type*} [Semiring S] set_option backward.isDefEq.lazyProjDelta false in -- See https://github.com/leanprover-community/mathlib4/issues/12535 theorem natDegree_list_sum_le (l : List S[X]) : natDegree l.sum ≀ (l.map natDegree).foldr max 0 := List.sum_le_foldr_max natDegree (by simp) natDegree_add_le _ #align polynomial.nat_degree_list_sum_le Polynomial.natDegree_list_sum_le theorem natDegree_multiset_sum_le (l : Multiset S[X]) : natDegree l.sum ≀ (l.map natDegree).foldr max max_left_comm 0 := Quotient.inductionOn l (by simpa using natDegree_list_sum_le) #align polynomial.nat_degree_multiset_sum_le Polynomial.natDegree_multiset_sum_le theorem natDegree_sum_le (f : ΞΉ β†’ S[X]) : natDegree (βˆ‘ i ∈ s, f i) ≀ s.fold max 0 (natDegree ∘ f) := by simpa using natDegree_multiset_sum_le (s.val.map f) #align polynomial.nat_degree_sum_le Polynomial.natDegree_sum_le lemma natDegree_sum_le_of_forall_le {n : β„•} (f : ΞΉ β†’ S[X]) (h : βˆ€ i ∈ s, natDegree (f i) ≀ n) : natDegree (βˆ‘ i ∈ s, f i) ≀ n := le_trans (natDegree_sum_le s f) <| (Finset.fold_max_le n).mpr <| by simpa theorem degree_list_sum_le (l : List S[X]) : degree l.sum ≀ (l.map natDegree).maximum := by by_cases h : l.sum = 0 Β· simp [h] Β· rw [degree_eq_natDegree h] suffices (l.map natDegree).maximum = ((l.map natDegree).foldr max 0 : β„•) by rw [this] simpa using natDegree_list_sum_le l rw [← List.foldr_max_of_ne_nil] Β· congr contrapose! h rw [List.map_eq_nil] at h simp [h] #align polynomial.degree_list_sum_le Polynomial.degree_list_sum_le theorem natDegree_list_prod_le (l : List S[X]) : natDegree l.prod ≀ (l.map natDegree).sum := by induction' l with hd tl IH Β· simp Β· simpa using natDegree_mul_le.trans (add_le_add_left IH _) #align polynomial.nat_degree_list_prod_le Polynomial.natDegree_list_prod_le theorem degree_list_prod_le (l : List S[X]) : degree l.prod ≀ (l.map degree).sum := by induction' l with hd tl IH Β· simp Β· simpa using (degree_mul_le _ _).trans (add_le_add_left IH _) #align polynomial.degree_list_prod_le Polynomial.degree_list_prod_le
Mathlib/Algebra/Polynomial/BigOperators.lean
92
111
theorem coeff_list_prod_of_natDegree_le (l : List S[X]) (n : β„•) (hl : βˆ€ p ∈ l, natDegree p ≀ n) : coeff (List.prod l) (l.length * n) = (l.map fun p => coeff p n).prod := by induction' l with hd tl IH
induction' l with hd tl IH Β· simp Β· have hl' : βˆ€ p ∈ tl, natDegree p ≀ n := fun p hp => hl p (List.mem_cons_of_mem _ hp) simp only [List.prod_cons, List.map, List.length] rw [add_mul, one_mul, add_comm, ← IH hl', mul_comm tl.length] have h : natDegree tl.prod ≀ n * tl.length := by refine (natDegree_list_prod_le _).trans ?_ rw [← tl.length_map natDegree, mul_comm] refine List.sum_le_card_nsmul _ _ ?_ simpa using hl' have hdn : natDegree hd ≀ n := hl _ (List.mem_cons_self _ _) rcases hdn.eq_or_lt with (rfl | hdn') Β· rcases h.eq_or_lt with h' | h' Β· rw [← h', coeff_mul_degree_add_degree, leadingCoeff, leadingCoeff] Β· rw [coeff_eq_zero_of_natDegree_lt, coeff_eq_zero_of_natDegree_lt h', mul_zero] exact natDegree_mul_le.trans_lt (add_lt_add_left h' _) Β· rw [coeff_eq_zero_of_natDegree_lt hdn', coeff_eq_zero_of_natDegree_lt, zero_mul] exact natDegree_mul_le.trans_lt (add_lt_add_of_lt_of_le hdn' h)
true
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Finset.Sort import Mathlib.Data.Set.Subsingleton #align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open List variable {n : β„•} @[ext] structure Composition (n : β„•) where blocks : List β„• blocks_pos : βˆ€ {i}, i ∈ blocks β†’ 0 < i blocks_sum : blocks.sum = n #align composition Composition @[ext] structure CompositionAsSet (n : β„•) where boundaries : Finset (Fin n.succ) zero_mem : (0 : Fin n.succ) ∈ boundaries getLast_mem : Fin.last n ∈ boundaries #align composition_as_set CompositionAsSet instance {n : β„•} : Inhabited (CompositionAsSet n) := ⟨⟨Finset.univ, Finset.mem_univ _, Finset.mem_univ _⟩⟩ namespace Composition variable (c : Composition n) instance (n : β„•) : ToString (Composition n) := ⟨fun c => toString c.blocks⟩ abbrev length : β„• := c.blocks.length #align composition.length Composition.length theorem blocks_length : c.blocks.length = c.length := rfl #align composition.blocks_length Composition.blocks_length def blocksFun : Fin c.length β†’ β„• := c.blocks.get #align composition.blocks_fun Composition.blocksFun theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks := ofFn_get _ #align composition.of_fn_blocks_fun Composition.ofFn_blocksFun theorem sum_blocksFun : βˆ‘ i, c.blocksFun i = n := by conv_rhs => rw [← c.blocks_sum, ← ofFn_blocksFun, sum_ofFn] #align composition.sum_blocks_fun Composition.sum_blocksFun theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i ∈ c.blocks := get_mem _ _ _ #align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks @[simp] theorem one_le_blocks {i : β„•} (h : i ∈ c.blocks) : 1 ≀ i := c.blocks_pos h #align composition.one_le_blocks Composition.one_le_blocks @[simp] theorem one_le_blocks' {i : β„•} (h : i < c.length) : 1 ≀ c.blocks.get ⟨i, h⟩ := c.one_le_blocks (get_mem (blocks c) i h) #align composition.one_le_blocks' Composition.one_le_blocks' @[simp] theorem blocks_pos' (i : β„•) (h : i < c.length) : 0 < c.blocks.get ⟨i, h⟩ := c.one_le_blocks' h #align composition.blocks_pos' Composition.blocks_pos' theorem one_le_blocksFun (i : Fin c.length) : 1 ≀ c.blocksFun i := c.one_le_blocks (c.blocksFun_mem_blocks i) #align composition.one_le_blocks_fun Composition.one_le_blocksFun theorem length_le : c.length ≀ n := by conv_rhs => rw [← c.blocks_sum] exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi #align composition.length_le Composition.length_le theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by apply length_pos_of_sum_pos convert h exact c.blocks_sum #align composition.length_pos_of_pos Composition.length_pos_of_pos def sizeUpTo (i : β„•) : β„• := (c.blocks.take i).sum #align composition.size_up_to Composition.sizeUpTo @[simp] theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo] #align composition.size_up_to_zero Composition.sizeUpTo_zero theorem sizeUpTo_ofLength_le (i : β„•) (h : c.length ≀ i) : c.sizeUpTo i = n := by dsimp [sizeUpTo] convert c.blocks_sum exact take_all_of_le h #align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le @[simp] theorem sizeUpTo_length : c.sizeUpTo c.length = n := c.sizeUpTo_ofLength_le c.length le_rfl #align composition.size_up_to_length Composition.sizeUpTo_length theorem sizeUpTo_le (i : β„•) : c.sizeUpTo i ≀ n := by conv_rhs => rw [← c.blocks_sum, ← sum_take_add_sum_drop _ i] exact Nat.le_add_right _ _ #align composition.size_up_to_le Composition.sizeUpTo_le theorem sizeUpTo_succ {i : β„•} (h : i < c.length) : c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get ⟨i, h⟩ := by simp only [sizeUpTo] rw [sum_take_succ _ _ h] #align composition.size_up_to_succ Composition.sizeUpTo_succ theorem sizeUpTo_succ' (i : Fin c.length) : c.sizeUpTo ((i : β„•) + 1) = c.sizeUpTo i + c.blocksFun i := c.sizeUpTo_succ i.2 #align composition.size_up_to_succ' Composition.sizeUpTo_succ' theorem sizeUpTo_strict_mono {i : β„•} (h : i < c.length) : c.sizeUpTo i < c.sizeUpTo (i + 1) := by rw [c.sizeUpTo_succ h] simp #align composition.size_up_to_strict_mono Composition.sizeUpTo_strict_mono theorem monotone_sizeUpTo : Monotone c.sizeUpTo := monotone_sum_take _ #align composition.monotone_size_up_to Composition.monotone_sizeUpTo def boundary : Fin (c.length + 1) β†ͺo Fin (n + 1) := (OrderEmbedding.ofStrictMono fun i => ⟨c.sizeUpTo i, Nat.lt_succ_of_le (c.sizeUpTo_le i)⟩) <| Fin.strictMono_iff_lt_succ.2 fun ⟨_, hi⟩ => c.sizeUpTo_strict_mono hi #align composition.boundary Composition.boundary @[simp]
Mathlib/Combinatorics/Enumerative/Composition.lean
252
252
theorem boundary_zero : c.boundary 0 = 0 := by
simp [boundary, Fin.ext_iff]
true
import Mathlib.Algebra.Polynomial.Degree.Definitions #align_import ring_theory.polynomial.opposites from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial open Polynomial MulOpposite variable {R : Type*} [Semiring R] noncomputable section namespace Polynomial def opRingEquiv (R : Type*) [Semiring R] : R[X]ᡐᡒᡖ ≃+* Rᡐᡒᡖ[X] := ((toFinsuppIso R).op.trans AddMonoidAlgebra.opRingEquiv).trans (toFinsuppIso _).symm #align polynomial.op_ring_equiv Polynomial.opRingEquiv @[simp] theorem opRingEquiv_op_monomial (n : β„•) (r : R) : opRingEquiv R (op (monomial n r : R[X])) = monomial n (op r) := by simp only [opRingEquiv, RingEquiv.coe_trans, Function.comp_apply, AddMonoidAlgebra.opRingEquiv_apply, RingEquiv.op_apply_apply, toFinsuppIso_apply, unop_op, toFinsupp_monomial, Finsupp.mapRange_single, toFinsuppIso_symm_apply, ofFinsupp_single] #align polynomial.op_ring_equiv_op_monomial Polynomial.opRingEquiv_op_monomial @[simp] theorem opRingEquiv_op_C (a : R) : opRingEquiv R (op (C a)) = C (op a) := opRingEquiv_op_monomial 0 a set_option linter.uppercaseLean3 false in #align polynomial.op_ring_equiv_op_C Polynomial.opRingEquiv_op_C @[simp] theorem opRingEquiv_op_X : opRingEquiv R (op (X : R[X])) = X := opRingEquiv_op_monomial 1 1 set_option linter.uppercaseLean3 false in #align polynomial.op_ring_equiv_op_X Polynomial.opRingEquiv_op_X
Mathlib/RingTheory/Polynomial/Opposites.lean
57
59
theorem opRingEquiv_op_C_mul_X_pow (r : R) (n : β„•) : opRingEquiv R (op (C r * X ^ n : R[X])) = C (op r) * X ^ n := by
simp only [X_pow_mul, op_mul, op_pow, map_mul, map_pow, opRingEquiv_op_X, opRingEquiv_op_C]
true
import Mathlib.Analysis.Analytic.Basic import Mathlib.Combinatorics.Enumerative.Composition #align_import analysis.analytic.composition from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a" noncomputable section variable {π•œ : Type*} {E F G H : Type*} open Filter List open scoped Topology Classical NNReal ENNReal section Topological variable [CommRing π•œ] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G] variable [Module π•œ E] [Module π•œ F] [Module π•œ G] variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G] namespace FormalMultilinearSeries variable [TopologicalAddGroup E] [ContinuousConstSMul π•œ E] variable [TopologicalAddGroup F] [ContinuousConstSMul π•œ F] variable [TopologicalAddGroup G] [ContinuousConstSMul π•œ G] def applyComposition (p : FormalMultilinearSeries π•œ E F) {n : β„•} (c : Composition n) : (Fin n β†’ E) β†’ Fin c.length β†’ F := fun v i => p (c.blocksFun i) (v ∘ c.embedding i) #align formal_multilinear_series.apply_composition FormalMultilinearSeries.applyComposition theorem applyComposition_ones (p : FormalMultilinearSeries π•œ E F) (n : β„•) : p.applyComposition (Composition.ones n) = fun v i => p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by funext v i apply p.congr (Composition.ones_blocksFun _ _) intro j hjn hj1 obtain rfl : j = 0 := by omega refine congr_arg v ?_ rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk] #align formal_multilinear_series.apply_composition_ones FormalMultilinearSeries.applyComposition_ones theorem applyComposition_single (p : FormalMultilinearSeries π•œ E F) {n : β„•} (hn : 0 < n) (v : Fin n β†’ E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by ext j refine p.congr (by simp) fun i hi1 hi2 => ?_ dsimp congr 1 convert Composition.single_embedding hn ⟨i, hi2⟩ using 1 cases' j with j_val j_property have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property) congr! simp #align formal_multilinear_series.apply_composition_single FormalMultilinearSeries.applyComposition_single @[simp]
Mathlib/Analysis/Analytic/Composition.lean
131
134
theorem removeZero_applyComposition (p : FormalMultilinearSeries π•œ E F) {n : β„•} (c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by ext v i
ext v i simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]
true
import Mathlib.CategoryTheory.Sites.Sheaf #align_import category_theory.sites.canonical from "leanprover-community/mathlib"@"9e7c80f638149bfb3504ba8ff48dfdbfc949fb1a" universe v u namespace CategoryTheory open scoped Classical open CategoryTheory Category Limits Sieve variable {C : Type u} [Category.{v} C] namespace Sheaf variable {P : Cα΅’α΅– β₯€ Type v} variable {X Y : C} {S : Sieve X} {R : Presieve X} variable (J Jβ‚‚ : GrothendieckTopology C) theorem isSheafFor_bind (P : Cα΅’α΅– β₯€ Type v) (U : Sieve X) (B : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄, U f β†’ Sieve Y) (hU : Presieve.IsSheafFor P (U : Presieve X)) (hB : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄ (hf : U f), Presieve.IsSheafFor P (B hf : Presieve Y)) (hB' : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄ (h : U f) ⦃Z⦄ (g : Z ⟢ Y), Presieve.IsSeparatedFor P (((B h).pullback g) : Presieve Z)) : Presieve.IsSheafFor P (Sieve.bind (U : Presieve X) B : Presieve X) := by intro s hs let y : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄ (hf : U f), Presieve.FamilyOfElements P (B hf : Presieve Y) := fun Y f hf Z g hg => s _ (Presieve.bind_comp _ _ hg) have hy : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄ (hf : U f), (y hf).Compatible := by intro Y f H Y₁ Yβ‚‚ Z g₁ gβ‚‚ f₁ fβ‚‚ hf₁ hfβ‚‚ comm apply hs apply reassoc_of% comm let t : Presieve.FamilyOfElements P (U : Presieve X) := fun Y f hf => (hB hf).amalgamate (y hf) (hy hf) have ht : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄ (hf : U f), (y hf).IsAmalgamation (t f hf) := fun Y f hf => (hB hf).isAmalgamation _ have hT : t.Compatible := by rw [Presieve.compatible_iff_sieveCompatible] intro Z W f h hf apply (hB (U.downward_closed hf h)).isSeparatedFor.ext intro Y l hl apply (hB' hf (l ≫ h)).ext intro M m hm have : bind U B (m ≫ l ≫ h ≫ f) := by -- Porting note: had to make explicit the parameter `((m ≫ l ≫ h) ≫ f)` and -- using `by exact` have : bind U B ((m ≫ l ≫ h) ≫ f) := by exact Presieve.bind_comp f hf hm simpa using this trans s (m ≫ l ≫ h ≫ f) this Β· have := ht (U.downward_closed hf h) _ ((B _).downward_closed hl m) rw [op_comp, FunctorToTypes.map_comp_apply] at this rw [this] change s _ _ = s _ _ -- Porting note: the proof was `by simp` congr 1 simp only [assoc] Β· have h : s _ _ = _ := (ht hf _ hm).symm -- Porting note: this was done by `simp only [assoc] at` conv_lhs at h => congr; rw [assoc, assoc] rw [h] simp only [op_comp, assoc, FunctorToTypes.map_comp_apply] refine ⟨hU.amalgamate t hT, ?_, ?_⟩ Β· rintro Z _ ⟨Y, f, g, hg, hf, rfl⟩ rw [op_comp, FunctorToTypes.map_comp_apply, Presieve.IsSheafFor.valid_glue _ _ _ hg] apply ht hg _ hf Β· intro y hy apply hU.isSeparatedFor.ext intro Y f hf apply (hB hf).isSeparatedFor.ext intro Z g hg rw [← FunctorToTypes.map_comp_apply, ← op_comp, hy _ (Presieve.bind_comp _ _ hg), hU.valid_glue _ _ hf, ht hf _ hg] #align category_theory.sheaf.is_sheaf_for_bind CategoryTheory.Sheaf.isSheafFor_bind
Mathlib/CategoryTheory/Sites/Canonical.lean
125
150
theorem isSheafFor_trans (P : Cα΅’α΅– β₯€ Type v) (R S : Sieve X) (hR : Presieve.IsSheafFor P (R : Presieve X)) (hR' : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄ (_ : S f), Presieve.IsSeparatedFor P (R.pullback f : Presieve Y)) (hS : βˆ€ ⦃Y⦄ ⦃f : Y ⟢ X⦄ (_ : R f), Presieve.IsSheafFor P (S.pullback f : Presieve Y)) : Presieve.IsSheafFor P (S : Presieve X) := by have : (bind R fun Y f _ => S.pullback f : Presieve X) ≀ S := by
have : (bind R fun Y f _ => S.pullback f : Presieve X) ≀ S := by rintro Z f ⟨W, f, g, hg, hf : S _, rfl⟩ apply hf apply Presieve.isSheafFor_subsieve_aux P this Β· apply isSheafFor_bind _ _ _ hR hS intro Y f hf Z g rw [← pullback_comp] apply (hS (R.downward_closed hf _)).isSeparatedFor Β· intro Y f hf have : Sieve.pullback f (bind R fun T (k : T ⟢ X) (_ : R k) => pullback k S) = R.pullback f := by ext Z g constructor Β· rintro ⟨W, k, l, hl, _, comm⟩ rw [pullback_apply, ← comm] simp [hl] Β· intro a refine ⟨Z, πŸ™ Z, _, a, ?_⟩ simp [hf] rw [this] apply hR' hf
true
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs] theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c β€’ 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one] theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K): normAtPlace w x = β€–x.1 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
290
293
theorem normAtPlace_apply_isComplex {w : InfinitePlace K} (hw : IsComplex w) (x : E K) : normAtPlace w x = β€–x.2 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk,
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_neg (not_isReal_iff_isComplex.mpr hw)]
true
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
Mathlib/Data/Nat/Fib/Basic.lean
121
124
theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by refine strictMono_nat_of_lt_succ fun n => ?_
refine strictMono_nat_of_lt_succ fun n => ?_ rw [add_right_comm] exact fib_lt_fib_succ (self_le_add_left _ _)
true