Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
eval_complexity
float64
0
1
import Mathlib.Analysis.SpecialFunctions.Pow.Real #align_import analysis.special_functions.log.monotone from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Set Filter Function open Topology noncomputable section namespace Real variable {x y : ℝ} theorem log_mul_self_monotoneOn : MonotoneOn (fun x : ℝ => log x * x) { x | 1 ≤ x } := by -- TODO: can be strengthened to exp (-1) ≤ x simp only [MonotoneOn, mem_setOf_eq] intro x hex y hey hxy have y_pos : 0 < y := lt_of_lt_of_le zero_lt_one hey gcongr rwa [le_log_iff_exp_le y_pos, Real.exp_zero] #align real.log_mul_self_monotone_on Real.log_mul_self_monotoneOn theorem log_div_self_antitoneOn : AntitoneOn (fun x : ℝ => log x / x) { x | exp 1 ≤ x } := by simp only [AntitoneOn, mem_setOf_eq] intro x hex y hey hxy have x_pos : 0 < x := (exp_pos 1).trans_le hex have y_pos : 0 < y := (exp_pos 1).trans_le hey have hlogx : 1 ≤ log x := by rwa [le_log_iff_exp_le x_pos] have hyx : 0 ≤ y / x - 1 := by rwa [le_sub_iff_add_le, le_div_iff x_pos, zero_add, one_mul] rw [div_le_iff y_pos, ← sub_le_sub_iff_right (log x)] calc log y - log x = log (y / x) := by rw [log_div y_pos.ne' x_pos.ne'] _ ≤ y / x - 1 := log_le_sub_one_of_pos (div_pos y_pos x_pos) _ ≤ log x * (y / x - 1) := le_mul_of_one_le_left hyx hlogx _ = log x / x * y - log x := by ring #align real.log_div_self_antitone_on Real.log_div_self_antitoneOn
Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean
56
82
theorem log_div_self_rpow_antitoneOn {a : ℝ} (ha : 0 < a) : AntitoneOn (fun x : ℝ => log x / x ^ a) { x | exp (1 / a) ≤ x } := by
simp only [AntitoneOn, mem_setOf_eq] intro x hex y _ hxy have x_pos : 0 < x := lt_of_lt_of_le (exp_pos (1 / a)) hex have y_pos : 0 < y := by linarith have x_nonneg : 0 ≤ x := le_trans (le_of_lt (exp_pos (1 / a))) hex have y_nonneg : 0 ≤ y := by linarith nth_rw 1 [← rpow_one y] nth_rw 1 [← rpow_one x] rw [← div_self (ne_of_lt ha).symm, div_eq_mul_one_div a a, rpow_mul y_nonneg, rpow_mul x_nonneg, log_rpow (rpow_pos_of_pos y_pos a), log_rpow (rpow_pos_of_pos x_pos a), mul_div_assoc, mul_div_assoc, mul_le_mul_left (one_div_pos.mpr ha)] refine log_div_self_antitoneOn ?_ ?_ ?_ · simp only [Set.mem_setOf_eq] convert rpow_le_rpow _ hex (le_of_lt ha) using 1 · rw [← exp_mul] simp only [Real.exp_eq_exp] field_simp [(ne_of_lt ha).symm] exact le_of_lt (exp_pos (1 / a)) · simp only [Set.mem_setOf_eq] convert rpow_le_rpow _ (_root_.trans hex hxy) (le_of_lt ha) using 1 · rw [← exp_mul] simp only [Real.exp_eq_exp] field_simp [(ne_of_lt ha).symm] exact le_of_lt (exp_pos (1 / a)) gcongr
0
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.Nat.Factorial.Cast #align_import data.nat.choose.cast from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" open Nat variable (K : Type*) [DivisionRing K] [CharZero K] namespace Nat theorem cast_choose {a b : ℕ} (h : a ≤ b) : (b.choose a : K) = b ! / (a ! * (b - a)!) := by have : ∀ {n : ℕ}, (n ! : K) ≠ 0 := Nat.cast_ne_zero.2 (factorial_ne_zero _) rw [eq_div_iff_mul_eq (mul_ne_zero this this)] rw_mod_cast [← mul_assoc, choose_mul_factorial_mul_factorial h] #align nat.cast_choose Nat.cast_choose theorem cast_add_choose {a b : ℕ} : ((a + b).choose a : K) = (a + b)! / (a ! * b !) := by rw [cast_choose K (_root_.le_add_right le_rfl), add_tsub_cancel_left] #align nat.cast_add_choose Nat.cast_add_choose
Mathlib/Data/Nat/Choose/Cast.lean
35
38
theorem cast_choose_eq_ascPochhammer_div (a b : ℕ) : (a.choose b : K) = (ascPochhammer K b).eval ↑(a - (b - 1)) / b ! := by
rw [eq_div_iff_mul_eq (cast_ne_zero.2 b.factorial_ne_zero : (b ! : K) ≠ 0), ← cast_mul, mul_comm, ← descFactorial_eq_factorial_mul_choose, ← cast_descFactorial]
0
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator import Mathlib.MeasureTheory.Function.UniformIntegrable import Mathlib.MeasureTheory.Decomposition.RadonNikodym #align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α} theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ} (hf : Integrable f μ) : SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_ · exact fun _ _ _ => (integrable_of_integrable_trim hm (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn · intro s hs _ conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs, ← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm) (hf.withDensityᵥ_trim_absolutelyContinuous hm)] rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs, ← setIntegral_trim hm _ hs] exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable · exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable' #align measure_theory.rn_deriv_ae_eq_condexp MeasureTheory.rnDeriv_ae_eq_condexp -- TODO: the following couple of lemmas should be generalized and proved using Jensen's inequality -- for the conditional expectation (not in mathlib yet) .
Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean
59
89
theorem snorm_one_condexp_le_snorm (f : α → ℝ) : snorm (μ[f|m]) 1 μ ≤ snorm f 1 μ := by
by_cases hf : Integrable f μ swap; · rw [condexp_undef hf, snorm_zero]; exact zero_le _ by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm, snorm_zero]; exact zero_le _ by_cases hsig : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hsig, snorm_zero]; exact zero_le _ calc snorm (μ[f|m]) 1 μ ≤ snorm (μ[(|f|)|m]) 1 μ := by refine snorm_mono_ae ?_ filter_upwards [condexp_mono hf hf.abs (ae_of_all μ (fun x => le_abs_self (f x) : ∀ x, f x ≤ |f x|)), EventuallyLE.trans (condexp_neg f).symm.le (condexp_mono hf.neg hf.abs (ae_of_all μ (fun x => neg_le_abs (f x): ∀ x, -f x ≤ |f x|)))] with x hx₁ hx₂ exact abs_le_abs hx₁ hx₂ _ = snorm f 1 μ := by rw [snorm_one_eq_lintegral_nnnorm, snorm_one_eq_lintegral_nnnorm, ← ENNReal.toReal_eq_toReal (ne_of_lt integrable_condexp.2) (ne_of_lt hf.2), ← integral_norm_eq_lintegral_nnnorm (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable, ← integral_norm_eq_lintegral_nnnorm hf.1] simp_rw [Real.norm_eq_abs] rw [← integral_condexp hm hf.abs] refine integral_congr_ae ?_ have : 0 ≤ᵐ[μ] μ[(|f|)|m] := by rw [← condexp_zero] exact condexp_mono (integrable_zero _ _ _) hf.abs (ae_of_all μ (fun x => abs_nonneg (f x) : ∀ x, 0 ≤ |f x|)) filter_upwards [this] with x hx exact abs_eq_self.2 hx
0
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Perm.Fin import Mathlib.GroupTheory.Subgroup.Simple import Mathlib.Tactic.IntervalCases #align_import group_theory.specific_groups.alternating from "leanprover-community/mathlib"@"0f6670b8af2dff699de1c0b4b49039b31bc13c46" -- 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) open Equiv Equiv.Perm Subgroup Fintype variable (α : Type*) [Fintype α] [DecidableEq α] def alternatingGroup : Subgroup (Perm α) := sign.ker #align alternating_group alternatingGroup -- Porting note (#10754): manually added instance instance fta : Fintype (alternatingGroup α) := @Subtype.fintype _ _ sign.decidableMemKer _ instance [Subsingleton α] : Unique (alternatingGroup α) := ⟨⟨1⟩, fun ⟨p, _⟩ => Subtype.eq (Subsingleton.elim p _)⟩ variable {α} theorem alternatingGroup_eq_sign_ker : alternatingGroup α = sign.ker := rfl #align alternating_group_eq_sign_ker alternatingGroup_eq_sign_ker namespace Equiv.Perm @[simp] theorem mem_alternatingGroup {f : Perm α} : f ∈ alternatingGroup α ↔ sign f = 1 := sign.mem_ker #align equiv.perm.mem_alternating_group Equiv.Perm.mem_alternatingGroup theorem prod_list_swap_mem_alternatingGroup_iff_even_length {l : List (Perm α)} (hl : ∀ g ∈ l, IsSwap g) : l.prod ∈ alternatingGroup α ↔ Even l.length := by rw [mem_alternatingGroup, sign_prod_list_swap hl, neg_one_pow_eq_one_iff_even] decide #align equiv.perm.prod_list_swap_mem_alternating_group_iff_even_length Equiv.Perm.prod_list_swap_mem_alternatingGroup_iff_even_length theorem IsThreeCycle.mem_alternatingGroup {f : Perm α} (h : IsThreeCycle f) : f ∈ alternatingGroup α := mem_alternatingGroup.mpr h.sign #align equiv.perm.is_three_cycle.mem_alternating_group Equiv.Perm.IsThreeCycle.mem_alternatingGroup set_option linter.deprecated false in
Mathlib/GroupTheory/SpecificGroups/Alternating.lean
89
91
theorem finRotate_bit1_mem_alternatingGroup {n : ℕ} : finRotate (bit1 n) ∈ alternatingGroup (Fin (bit1 n)) := by
rw [mem_alternatingGroup, bit1, sign_finRotate, pow_bit0', Int.units_mul_self, one_pow]
0
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
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
42
54
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
0
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
100
111
theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by
constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h
0
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Fin.VecNotation import Mathlib.Logic.Equiv.Fin #align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" namespace List.Nat def antidiagonalTuple : ∀ k, ℕ → List (Fin k → ℕ) | 0, 0 => [![]] | 0, _ + 1 => [] | k + 1, n => (List.Nat.antidiagonal n).bind fun ni => (antidiagonalTuple k ni.2).map fun x => Fin.cons ni.1 x #align list.nat.antidiagonal_tuple List.Nat.antidiagonalTuple @[simp] theorem antidiagonalTuple_zero_zero : antidiagonalTuple 0 0 = [![]] := rfl #align list.nat.antidiagonal_tuple_zero_zero List.Nat.antidiagonalTuple_zero_zero @[simp] theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 (n + 1) = [] := rfl #align list.nat.antidiagonal_tuple_zero_succ List.Nat.antidiagonalTuple_zero_succ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} : x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n := by induction x using Fin.consInduction generalizing n with | h0 => cases n · decide · simp [eq_comm] | h x₀ x ih => simp_rw [Fin.sum_cons] rw [antidiagonalTuple] -- Porting note: simp_rw doesn't use the equation lemma properly simp_rw [List.mem_bind, List.mem_map, List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih, @eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _), ← Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right] #align list.nat.mem_antidiagonal_tuple List.Nat.mem_antidiagonalTuple theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n) := by induction' k with k ih generalizing n · cases n · simp · simp [eq_comm] simp_rw [antidiagonalTuple, List.nodup_bind] constructor · intro i _ exact (ih i.snd).map (Fin.cons_right_injective (α := fun _ => ℕ) i.fst) induction' n with n n_ih · exact List.pairwise_singleton _ _ · rw [List.Nat.antidiagonal_succ] refine List.Pairwise.cons (fun a ha x hx₁ hx₂ => ?_) (n_ih.map _ fun a b h x hx₁ hx₂ => ?_) · rw [List.mem_map] at hx₁ hx₂ ha obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂ rw [Fin.cons_eq_cons] at h injection h.1 · rw [List.mem_map] at hx₁ hx₂ obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂ dsimp at h₁₂ rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂ obtain ⟨h₁₂, rfl⟩ := h₁₂ rw [h₁₂] at h exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂) #align list.nat.nodup_antidiagonal_tuple List.Nat.nodup_antidiagonalTuple theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0] | 0 => (congr_arg fun x => [x]) <| Subsingleton.elim _ _ | k + 1 => by rw [antidiagonalTuple, antidiagonal_zero, List.bind_singleton, antidiagonalTuple_zero_right k, List.map_singleton] exact congr_arg (fun x => [x]) Matrix.cons_zero_zero #align list.nat.antidiagonal_tuple_zero_right List.Nat.antidiagonalTuple_zero_right @[simp]
Mathlib/Data/Fin/Tuple/NatAntidiagonal.lean
131
139
theorem antidiagonalTuple_one (n : ℕ) : antidiagonalTuple 1 n = [![n]] := by
simp_rw [antidiagonalTuple, antidiagonal, List.range_succ, List.map_append, List.map_singleton, tsub_self, List.append_bind, List.bind_singleton, List.map_bind] conv_rhs => rw [← List.nil_append [![n]]] congr 1 simp_rw [List.bind_eq_nil, List.mem_range, List.map_eq_nil] intro x hx obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_lt hx rw [add_assoc, add_tsub_cancel_left, antidiagonalTuple_zero_succ]
0
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Field.Defs import Mathlib.Data.Tree.Basic import Mathlib.Logic.Basic import Mathlib.Tactic.NormNum.Core import Mathlib.Util.SynthesizeUsing import Mathlib.Util.Qq open Lean Parser Tactic Mathlib Meta NormNum Qq initialize registerTraceClass `CancelDenoms namespace CancelDenoms theorem mul_subst {α} [CommRing α] {n1 n2 k e1 e2 t1 t2 : α} (h1 : n1 * e1 = t1) (h2 : n2 * e2 = t2) (h3 : n1 * n2 = k) : k * (e1 * e2) = t1 * t2 := by rw [← h3, mul_comm n1, mul_assoc n2, ← mul_assoc n1, h1, ← mul_assoc n2, mul_comm n2, mul_assoc, h2] #align cancel_factors.mul_subst CancelDenoms.mul_subst theorem div_subst {α} [Field α] {n1 n2 k e1 e2 t1 : α} (h1 : n1 * e1 = t1) (h2 : n2 / e2 = 1) (h3 : n1 * n2 = k) : k * (e1 / e2) = t1 := by rw [← h3, mul_assoc, mul_div_left_comm, h2, ← mul_assoc, h1, mul_comm, one_mul] #align cancel_factors.div_subst CancelDenoms.div_subst theorem cancel_factors_eq_div {α} [Field α] {n e e' : α} (h : n * e = e') (h2 : n ≠ 0) : e = e' / n := eq_div_of_mul_eq h2 <| by rwa [mul_comm] at h #align cancel_factors.cancel_factors_eq_div CancelDenoms.cancel_factors_eq_div theorem add_subst {α} [Ring α] {n e1 e2 t1 t2 : α} (h1 : n * e1 = t1) (h2 : n * e2 = t2) : n * (e1 + e2) = t1 + t2 := by simp [left_distrib, *] #align cancel_factors.add_subst CancelDenoms.add_subst theorem sub_subst {α} [Ring α] {n e1 e2 t1 t2 : α} (h1 : n * e1 = t1) (h2 : n * e2 = t2) : n * (e1 - e2) = t1 - t2 := by simp [left_distrib, *, sub_eq_add_neg] #align cancel_factors.sub_subst CancelDenoms.sub_subst theorem neg_subst {α} [Ring α] {n e t : α} (h1 : n * e = t) : n * -e = -t := by simp [*] #align cancel_factors.neg_subst CancelDenoms.neg_subst theorem pow_subst {α} [CommRing α] {n e1 t1 k l : α} {e2 : ℕ} (h1 : n * e1 = t1) (h2 : l * n ^ e2 = k) : k * (e1 ^ e2) = l * t1 ^ e2 := by rw [← h2, ← h1, mul_pow, mul_assoc] theorem inv_subst {α} [Field α] {n k e : α} (h2 : e ≠ 0) (h3 : n * e = k) : k * (e ⁻¹) = n := by rw [← div_eq_mul_inv, ← h3, mul_div_cancel_right₀ _ h2]
Mathlib/Tactic/CancelDenoms/Core.lean
73
78
theorem cancel_factors_lt {α} [LinearOrderedField α] {a b ad bd a' b' gcd : α} (ha : ad * a = a') (hb : bd * b = b') (had : 0 < ad) (hbd : 0 < bd) (hgcd : 0 < gcd) : (a < b) = (1 / gcd * (bd * a') < 1 / gcd * (ad * b')) := by
rw [mul_lt_mul_left, ← ha, ← hb, ← mul_assoc, ← mul_assoc, mul_comm bd, mul_lt_mul_left] · exact mul_pos had hbd · exact one_div_pos.2 hgcd
0
import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.Bicategory.Coherence namespace CategoryTheory namespace Bicategory open Category open scoped Bicategory open Mathlib.Tactic.BicategoryCoherence (bicategoricalComp bicategoricalIsoComp) universe w v u variable {B : Type u} [Bicategory.{w, v} B] {a b c : B} {f : a ⟶ b} {g : b ⟶ a} def leftZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := η ▷ f ⊗≫ f ◁ ε def rightZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := g ◁ η ⊗≫ ε ▷ g theorem rightZigzag_idempotent_of_left_triangle (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) (h : leftZigzag η ε = (λ_ _).hom ≫ (ρ_ _).inv) : rightZigzag η ε ⊗≫ rightZigzag η ε = rightZigzag η ε := by dsimp only [rightZigzag] calc _ = g ◁ η ⊗≫ ((ε ▷ g ▷ 𝟙 a) ≫ (𝟙 b ≫ g) ◁ η) ⊗≫ ε ▷ g := by simp [bicategoricalComp]; coherence _ = 𝟙 _ ⊗≫ g ◁ (η ▷ 𝟙 a ≫ (f ≫ g) ◁ η) ⊗≫ (ε ▷ (g ≫ f) ≫ 𝟙 b ◁ ε) ▷ g ⊗≫ 𝟙 _ := by rw [← whisker_exchange]; simp [bicategoricalComp]; coherence _ = g ◁ η ⊗≫ g ◁ leftZigzag η ε ▷ g ⊗≫ ε ▷ g := by rw [← whisker_exchange, ← whisker_exchange]; simp [leftZigzag, bicategoricalComp]; coherence _ = g ◁ η ⊗≫ ε ▷ g := by rw [h]; simp [bicategoricalComp]; coherence structure Adjunction (f : a ⟶ b) (g : b ⟶ a) where unit : 𝟙 a ⟶ f ≫ g counit : g ≫ f ⟶ 𝟙 b left_triangle : leftZigzag unit counit = (λ_ _).hom ≫ (ρ_ _).inv := by aesop_cat right_triangle : rightZigzag unit counit = (ρ_ _).hom ≫ (λ_ _).inv := by aesop_cat @[inherit_doc] scoped infixr:15 " ⊣ " => Bicategory.Adjunction namespace Adjunction attribute [simp] left_triangle right_triangle attribute [local simp] leftZigzag rightZigzag def id (a : B) : 𝟙 a ⊣ 𝟙 a where unit := (ρ_ _).inv counit := (ρ_ _).hom left_triangle := by dsimp; coherence right_triangle := by dsimp; coherence instance : Inhabited (Adjunction (𝟙 a) (𝟙 a)) := ⟨id a⟩ noncomputable section variable (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) def leftZigzagIso (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) := whiskerRightIso η f ≪⊗≫ whiskerLeftIso f ε def rightZigzagIso (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) := whiskerLeftIso g η ≪⊗≫ whiskerRightIso ε g attribute [local simp] leftZigzagIso rightZigzagIso leftZigzag rightZigzag @[simp] theorem leftZigzagIso_hom : (leftZigzagIso η ε).hom = leftZigzag η.hom ε.hom := rfl @[simp] theorem rightZigzagIso_hom : (rightZigzagIso η ε).hom = rightZigzag η.hom ε.hom := rfl @[simp]
Mathlib/CategoryTheory/Bicategory/Adjunction.lean
201
202
theorem leftZigzagIso_inv : (leftZigzagIso η ε).inv = rightZigzag ε.inv η.inv := by
simp [bicategoricalComp, bicategoricalIsoComp]
0
import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.UniformGroup #align_import topology.algebra.uniform_filter_basis from "leanprover-community/mathlib"@"531db2ef0fdddf8b3c8dcdcd87138fe969e1a81a" open uniformity Filter open Filter namespace AddGroupFilterBasis variable {G : Type*} [AddCommGroup G] (B : AddGroupFilterBasis G) protected def uniformSpace : UniformSpace G := @TopologicalAddGroup.toUniformSpace G _ B.topology B.isTopologicalAddGroup #align add_group_filter_basis.uniform_space AddGroupFilterBasis.uniformSpace protected theorem uniformAddGroup : @UniformAddGroup G B.uniformSpace _ := @comm_topologicalAddGroup_is_uniform G _ B.topology B.isTopologicalAddGroup #align add_group_filter_basis.uniform_add_group AddGroupFilterBasis.uniformAddGroup
Mathlib/Topology/Algebra/UniformFilterBasis.lean
42
51
theorem cauchy_iff {F : Filter G} : @Cauchy G B.uniformSpace F ↔ F.NeBot ∧ ∀ U ∈ B, ∃ M ∈ F, ∀ᵉ (x ∈ M) (y ∈ M), y - x ∈ U := by
letI := B.uniformSpace haveI := B.uniformAddGroup suffices F ×ˢ F ≤ uniformity G ↔ ∀ U ∈ B, ∃ M ∈ F, ∀ᵉ (x ∈ M) (y ∈ M), y - x ∈ U by constructor <;> rintro ⟨h', h⟩ <;> refine ⟨h', ?_⟩ <;> [rwa [← this]; rwa [this]] rw [uniformity_eq_comap_nhds_zero G, ← map_le_iff_le_comap] change Tendsto _ _ _ ↔ _ simp [(basis_sets F).prod_self.tendsto_iff B.nhds_zero_hasBasis, @forall_swap (_ ∈ _) G]
0
import Mathlib.Analysis.InnerProductSpace.Dual #align_import analysis.inner_product_space.lax_milgram from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open RCLike LinearMap ContinuousLinearMap InnerProductSpace open LinearMap (ker range) open RealInnerProductSpace NNReal universe u namespace IsCoercive variable {V : Type u} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [CompleteSpace V] variable {B : V →L[ℝ] V →L[ℝ] ℝ} local postfix:1024 "♯" => @continuousLinearMapOfBilin ℝ V _ _ _ _ theorem bounded_below (coercive : IsCoercive B) : ∃ C, 0 < C ∧ ∀ v, C * ‖v‖ ≤ ‖B♯ v‖ := by rcases coercive with ⟨C, C_ge_0, coercivity⟩ refine ⟨C, C_ge_0, ?_⟩ intro v by_cases h : 0 < ‖v‖ · refine (mul_le_mul_right h).mp ?_ calc C * ‖v‖ * ‖v‖ ≤ B v v := coercivity v _ = ⟪B♯ v, v⟫_ℝ := (continuousLinearMapOfBilin_apply B v v).symm _ ≤ ‖B♯ v‖ * ‖v‖ := real_inner_le_norm (B♯ v) v · have : v = 0 := by simpa using h simp [this] #align is_coercive.bounded_below IsCoercive.bounded_below theorem antilipschitz (coercive : IsCoercive B) : ∃ C : ℝ≥0, 0 < C ∧ AntilipschitzWith C B♯ := by rcases coercive.bounded_below with ⟨C, C_pos, below_bound⟩ refine ⟨C⁻¹.toNNReal, Real.toNNReal_pos.mpr (inv_pos.mpr C_pos), ?_⟩ refine ContinuousLinearMap.antilipschitz_of_bound B♯ ?_ simp_rw [Real.coe_toNNReal', max_eq_left_of_lt (inv_pos.mpr C_pos), ← inv_mul_le_iff (inv_pos.mpr C_pos)] simpa using below_bound #align is_coercive.antilipschitz IsCoercive.antilipschitz theorem ker_eq_bot (coercive : IsCoercive B) : ker B♯ = ⊥ := by rw [LinearMapClass.ker_eq_bot] rcases coercive.antilipschitz with ⟨_, _, antilipschitz⟩ exact antilipschitz.injective #align is_coercive.ker_eq_bot IsCoercive.ker_eq_bot
Mathlib/Analysis/InnerProductSpace/LaxMilgram.lean
80
82
theorem isClosed_range (coercive : IsCoercive B) : IsClosed (range B♯ : Set V) := by
rcases coercive.antilipschitz with ⟨_, _, antilipschitz⟩ exact antilipschitz.isClosed_range B♯.uniformContinuous
0
import Mathlib.Algebra.Associated import Mathlib.Algebra.GeomSum import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.Choose.Sum import Mathlib.Data.Nat.Lattice import Mathlib.RingTheory.Nilpotent.Defs #align_import ring_theory.nilpotent from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" universe u v open Function Set variable {R S : Type*} {x y : R} theorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by obtain ⟨n, hn⟩ := h use n rw [neg_pow, hn, mul_zero] #align is_nilpotent.neg IsNilpotent.neg @[simp] theorem isNilpotent_neg_iff [Ring R] : IsNilpotent (-x) ↔ IsNilpotent x := ⟨fun h => neg_neg x ▸ h.neg, fun h => h.neg⟩ #align is_nilpotent_neg_iff isNilpotent_neg_iff lemma IsNilpotent.smul [MonoidWithZero R] [MonoidWithZero S] [MulActionWithZero R S] [SMulCommClass R S S] [IsScalarTower R S S] {a : S} (ha : IsNilpotent a) (t : R) : IsNilpotent (t • a) := by obtain ⟨k, ha⟩ := ha use k rw [smul_pow, ha, smul_zero] theorem IsNilpotent.isUnit_sub_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r - 1) := by obtain ⟨n, hn⟩ := hnil refine ⟨⟨r - 1, -∑ i ∈ Finset.range n, r ^ i, ?_, ?_⟩, rfl⟩ · simp [mul_geom_sum, hn] · simp [geom_sum_mul, hn] theorem IsNilpotent.isUnit_one_sub [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 - r) := by rw [← IsUnit.neg_iff, neg_sub] exact isUnit_sub_one hnil theorem IsNilpotent.isUnit_add_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r + 1) := by rw [← IsUnit.neg_iff, neg_add'] exact isUnit_sub_one hnil.neg theorem IsNilpotent.isUnit_one_add [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 + r) := add_comm r 1 ▸ isUnit_add_one hnil theorem IsNilpotent.isUnit_add_left_of_commute [Ring R] {r u : R} (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) : IsUnit (u + r) := by rw [← Units.isUnit_mul_units _ hu.unit⁻¹, add_mul, IsUnit.mul_val_inv] replace h_comm : Commute r (↑hu.unit⁻¹) := Commute.units_inv_right h_comm refine IsNilpotent.isUnit_one_add ?_ exact (hu.unit⁻¹.isUnit.isNilpotent_mul_unit_of_commute_iff h_comm).mpr hnil theorem IsNilpotent.isUnit_add_right_of_commute [Ring R] {r u : R} (hnil : IsNilpotent r) (hu : IsUnit u) (h_comm : Commute r u) : IsUnit (r + u) := add_comm r u ▸ hnil.isUnit_add_left_of_commute hu h_comm instance [Zero R] [Pow R ℕ] [Zero S] [Pow S ℕ] [IsReduced R] [IsReduced S] : IsReduced (R × S) where eq_zero _ := fun ⟨n, hn⟩ ↦ have hn := Prod.ext_iff.1 hn Prod.ext (IsReduced.eq_zero _ ⟨n, hn.1⟩) (IsReduced.eq_zero _ ⟨n, hn.2⟩) theorem Prime.isRadical [CommMonoidWithZero R] {y : R} (hy : Prime y) : IsRadical y := fun _ _ ↦ hy.dvd_of_dvd_pow
Mathlib/RingTheory/Nilpotent/Basic.lean
95
97
theorem zero_isRadical_iff [MonoidWithZero R] : IsRadical (0 : R) ↔ IsReduced R := by
simp_rw [isReduced_iff, IsNilpotent, exists_imp, ← zero_dvd_iff] exact forall_swap
0
import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Metric Set open Pointwise Topology variable {𝕜 E : Type*} variable [NormedField 𝕜] section SeminormedAddCommGroup variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀] #align smul_ball smul_ball theorem smul_unitBall {c : 𝕜} (hc : c ≠ 0) : c • ball (0 : E) (1 : ℝ) = ball (0 : E) ‖c‖ := by rw [_root_.smul_ball hc, smul_zero, mul_one] #align smul_unit_ball smul_unitBall theorem smul_sphere' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • sphere x r = sphere (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r] #align smul_sphere' smul_sphere' theorem smul_closedBall' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • closedBall x r = closedBall (c • x) (‖c‖ * r) := by simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc] #align smul_closed_ball' smul_closedBall' theorem set_smul_sphere_zero {s : Set 𝕜} (hs : 0 ∉ s) (r : ℝ) : s • sphere (0 : E) r = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := calc s • sphere (0 : E) r = ⋃ c ∈ s, c • sphere (0 : E) r := iUnion_smul_left_image.symm _ = ⋃ c ∈ s, sphere (0 : E) (‖c‖ * r) := iUnion₂_congr fun c hc ↦ by rw [smul_sphere' (ne_of_mem_of_not_mem hc hs), smul_zero] _ = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := by ext; simp [eq_comm] theorem Bornology.IsBounded.smul₀ {s : Set E} (hs : IsBounded s) (c : 𝕜) : IsBounded (c • s) := (lipschitzWith_smul c).isBounded_image hs #align metric.bounded.smul Bornology.IsBounded.smul₀ theorem eventually_singleton_add_smul_subset {x : E} {s : Set E} (hs : Bornology.IsBounded s) {u : Set E} (hu : u ∈ 𝓝 x) : ∀ᶠ r in 𝓝 (0 : 𝕜), {x} + r • s ⊆ u := by obtain ⟨ε, εpos, hε⟩ : ∃ ε : ℝ, 0 < ε ∧ closedBall x ε ⊆ u := nhds_basis_closedBall.mem_iff.1 hu obtain ⟨R, Rpos, hR⟩ : ∃ R : ℝ, 0 < R ∧ s ⊆ closedBall 0 R := hs.subset_closedBall_lt 0 0 have : Metric.closedBall (0 : 𝕜) (ε / R) ∈ 𝓝 (0 : 𝕜) := closedBall_mem_nhds _ (div_pos εpos Rpos) filter_upwards [this] with r hr simp only [image_add_left, singleton_add] intro y hy obtain ⟨z, zs, hz⟩ : ∃ z : E, z ∈ s ∧ r • z = -x + y := by simpa [mem_smul_set] using hy have I : ‖r • z‖ ≤ ε := calc ‖r • z‖ = ‖r‖ * ‖z‖ := norm_smul _ _ _ ≤ ε / R * R := (mul_le_mul (mem_closedBall_zero_iff.1 hr) (mem_closedBall_zero_iff.1 (hR zs)) (norm_nonneg _) (div_pos εpos Rpos).le) _ = ε := by field_simp have : y = x + r • z := by simp only [hz, add_neg_cancel_left] apply hε simpa only [this, dist_eq_norm, add_sub_cancel_left, mem_closedBall] using I #align eventually_singleton_add_smul_subset eventually_singleton_add_smul_subset variable [NormedSpace ℝ E] {x y z : E} {δ ε : ℝ} theorem smul_unitBall_of_pos {r : ℝ} (hr : 0 < r) : r • ball (0 : E) 1 = ball (0 : E) r := by rw [smul_unitBall hr.ne', Real.norm_of_nonneg hr.le] #align smul_unit_ball_of_pos smul_unitBall_of_pos lemma Ioo_smul_sphere_zero {a b r : ℝ} (ha : 0 ≤ a) (hr : 0 < r) : Ioo a b • sphere (0 : E) r = ball 0 (b * r) \ closedBall 0 (a * r) := by have : EqOn (‖·‖) id (Ioo a b) := fun x hx ↦ abs_of_pos (ha.trans_lt hx.1) rw [set_smul_sphere_zero (by simp [ha.not_lt]), ← image_image (· * r), this.image_eq, image_id, image_mul_right_Ioo _ _ hr] ext x; simp [and_comm] -- This is also true for `ℚ`-normed spaces
Mathlib/Analysis/NormedSpace/Pointwise.lean
162
167
theorem exists_dist_eq (x z : E) {a b : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) : ∃ y, dist x y = b * dist x z ∧ dist y z = a * dist x z := by
use a • x + b • z nth_rw 1 [← one_smul ℝ x] nth_rw 4 [← one_smul ℝ z] simp [dist_eq_norm, ← hab, add_smul, ← smul_sub, norm_smul_of_nonneg, ha, hb]
0
import Mathlib.Data.Finset.Lattice #align_import combinatorics.set_family.compression.down from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" variable {α : Type*} [DecidableEq α] {𝒜 ℬ : Finset (Finset α)} {s : Finset α} {a : α} open Finset -- The namespace is here to distinguish from other compressions. namespace Down def compression (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) := (𝒜.filter fun s => erase s a ∈ 𝒜).disjUnion ((𝒜.image fun s => erase s a).filter fun s => s ∉ 𝒜) <| disjoint_left.2 fun s h₁ h₂ => by have := (mem_filter.1 h₂).2 exact this (mem_filter.1 h₁).1 #align down.compression Down.compression @[inherit_doc] scoped[FinsetFamily] notation "𝓓 " => Down.compression -- Porting note: had to open this open FinsetFamily theorem mem_compression : s ∈ 𝓓 a 𝒜 ↔ s ∈ 𝒜 ∧ s.erase a ∈ 𝒜 ∨ s ∉ 𝒜 ∧ insert a s ∈ 𝒜 := by simp_rw [compression, mem_disjUnion, mem_filter, mem_image, and_comm (a := (¬ s ∈ 𝒜))] refine or_congr_right (and_congr_left fun hs => ⟨?_, fun h => ⟨_, h, erase_insert <| insert_ne_self.1 <| ne_of_mem_of_not_mem h hs⟩⟩) rintro ⟨t, ht, rfl⟩ rwa [insert_erase (erase_ne_self.1 (ne_of_mem_of_not_mem ht hs).symm)] #align down.mem_compression Down.mem_compression theorem erase_mem_compression (hs : s ∈ 𝒜) : s.erase a ∈ 𝓓 a 𝒜 := by simp_rw [mem_compression, erase_idem, and_self_iff] refine (em _).imp_right fun h => ⟨h, ?_⟩ rwa [insert_erase (erase_ne_self.1 (ne_of_mem_of_not_mem hs h).symm)] #align down.erase_mem_compression Down.erase_mem_compression -- This is a special case of `erase_mem_compression` once we have `compression_idem`. theorem erase_mem_compression_of_mem_compression : s ∈ 𝓓 a 𝒜 → s.erase a ∈ 𝓓 a 𝒜 := by simp_rw [mem_compression, erase_idem] refine Or.imp (fun h => ⟨h.2, h.2⟩) fun h => ?_ rwa [erase_eq_of_not_mem (insert_ne_self.1 <| ne_of_mem_of_not_mem h.2 h.1)] #align down.erase_mem_compression_of_mem_compression Down.erase_mem_compression_of_mem_compression
Mathlib/Combinatorics/SetFamily/Compression/Down.lean
264
268
theorem mem_compression_of_insert_mem_compression (h : insert a s ∈ 𝓓 a 𝒜) : s ∈ 𝓓 a 𝒜 := by
by_cases ha : a ∈ s · rwa [insert_eq_of_mem ha] at h · rw [← erase_insert ha] exact erase_mem_compression_of_mem_compression h
0
import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.NormedSpace.Dual import Mathlib.MeasureTheory.Function.StronglyMeasurable.Lp import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.function.ae_eq_of_integral from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4" open MeasureTheory TopologicalSpace NormedSpace Filter open scoped ENNReal NNReal MeasureTheory Topology namespace MeasureTheory section AeEqOfForall variable {α E 𝕜 : Type*} {m : MeasurableSpace α} {μ : Measure α} [RCLike 𝕜]
Mathlib/MeasureTheory/Function/AEEqOfIntegral.lean
57
67
theorem ae_eq_zero_of_forall_inner [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [SecondCountableTopology E] {f : α → E} (hf : ∀ c : E, (fun x => (inner c (f x) : 𝕜)) =ᵐ[μ] 0) : f =ᵐ[μ] 0 := by
let s := denseSeq E have hs : DenseRange s := denseRange_denseSeq E have hf' : ∀ᵐ x ∂μ, ∀ n : ℕ, inner (s n) (f x) = (0 : 𝕜) := ae_all_iff.mpr fun n => hf (s n) refine hf'.mono fun x hx => ?_ rw [Pi.zero_apply, ← @inner_self_eq_zero 𝕜] have h_closed : IsClosed {c : E | inner c (f x) = (0 : 𝕜)} := isClosed_eq (continuous_id.inner continuous_const) continuous_const exact @isClosed_property ℕ E _ s (fun c => inner c (f x) = (0 : 𝕜)) hs h_closed (fun n => hx n) _
0
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} @[simp] theorem reduceOption_cons_of_some (x : α) (l : List (Option α)) : reduceOption (some x :: l) = x :: l.reduceOption := by simp only [reduceOption, filterMap, id, eq_self_iff_true, and_self_iff] #align list.reduce_option_cons_of_some List.reduceOption_cons_of_some @[simp] theorem reduceOption_cons_of_none (l : List (Option α)) : reduceOption (none :: l) = l.reduceOption := by simp only [reduceOption, filterMap, id] #align list.reduce_option_cons_of_none List.reduceOption_cons_of_none @[simp] theorem reduceOption_nil : @reduceOption α [] = [] := rfl #align list.reduce_option_nil List.reduceOption_nil @[simp] theorem reduceOption_map {l : List (Option α)} {f : α → β} : reduceOption (map (Option.map f) l) = map f (reduceOption l) := by induction' l with hd tl hl · simp only [reduceOption_nil, map_nil] · cases hd <;> simpa [true_and_iff, Option.map_some', map, eq_self_iff_true, reduceOption_cons_of_some] using hl #align list.reduce_option_map List.reduceOption_map theorem reduceOption_append (l l' : List (Option α)) : (l ++ l').reduceOption = l.reduceOption ++ l'.reduceOption := filterMap_append l l' id #align list.reduce_option_append List.reduceOption_append theorem reduceOption_length_eq {l : List (Option α)} : l.reduceOption.length = (l.filter Option.isSome).length := by induction' l with hd tl hl · simp_rw [reduceOption_nil, filter_nil, length] · cases hd <;> simp [hl] theorem length_eq_reduceOption_length_add_filter_none {l : List (Option α)} : l.length = l.reduceOption.length + (l.filter Option.isNone).length := by simp_rw [reduceOption_length_eq, l.length_eq_length_filter_add Option.isSome, Option.bnot_isSome] theorem reduceOption_length_le (l : List (Option α)) : l.reduceOption.length ≤ l.length := by rw [length_eq_reduceOption_length_add_filter_none] apply Nat.le_add_right #align list.reduce_option_length_le List.reduceOption_length_le theorem reduceOption_length_eq_iff {l : List (Option α)} : l.reduceOption.length = l.length ↔ ∀ x ∈ l, Option.isSome x := by rw [reduceOption_length_eq, List.filter_length_eq_length] #align list.reduce_option_length_eq_iff List.reduceOption_length_eq_iff theorem reduceOption_length_lt_iff {l : List (Option α)} : l.reduceOption.length < l.length ↔ none ∈ l := by rw [Nat.lt_iff_le_and_ne, and_iff_right (reduceOption_length_le l), Ne, reduceOption_length_eq_iff] induction l <;> simp [*] rw [@eq_comm _ none, ← Option.not_isSome_iff_eq_none, Decidable.imp_iff_not_or] #align list.reduce_option_length_lt_iff List.reduceOption_length_lt_iff theorem reduceOption_singleton (x : Option α) : [x].reduceOption = x.toList := by cases x <;> rfl #align list.reduce_option_singleton List.reduceOption_singleton theorem reduceOption_concat (l : List (Option α)) (x : Option α) : (l.concat x).reduceOption = l.reduceOption ++ x.toList := by induction' l with hd tl hl generalizing x · cases x <;> simp [Option.toList] · simp only [concat_eq_append, reduceOption_append] at hl cases hd <;> simp [hl, reduceOption_append] #align list.reduce_option_concat List.reduceOption_concat theorem reduceOption_concat_of_some (l : List (Option α)) (x : α) : (l.concat (some x)).reduceOption = l.reduceOption.concat x := by simp only [reduceOption_nil, concat_eq_append, reduceOption_append, reduceOption_cons_of_some] #align list.reduce_option_concat_of_some List.reduceOption_concat_of_some theorem reduceOption_mem_iff {l : List (Option α)} {x : α} : x ∈ l.reduceOption ↔ some x ∈ l := by simp only [reduceOption, id, mem_filterMap, exists_eq_right] #align list.reduce_option_mem_iff List.reduceOption_mem_iff
Mathlib/Data/List/ReduceOption.lean
97
99
theorem reduceOption_get?_iff {l : List (Option α)} {x : α} : (∃ i, l.get? i = some (some x)) ↔ ∃ i, l.reduceOption.get? i = some x := by
rw [← mem_iff_get?, ← mem_iff_get?, reduceOption_mem_iff]
0
import Mathlib.Algebra.Polynomial.Cardinal import Mathlib.Algebra.MvPolynomial.Cardinal import Mathlib.Data.ZMod.Algebra import Mathlib.FieldTheory.IsAlgClosed.Basic import Mathlib.RingTheory.AlgebraicIndependent #align_import field_theory.is_alg_closed.classification from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" universe u open scoped Cardinal Polynomial open Cardinal section AlgebraicClosure namespace Algebra.IsAlgebraic variable (R L : Type u) [CommRing R] [CommRing L] [IsDomain L] [Algebra R L] variable [NoZeroSMulDivisors R L] [Algebra.IsAlgebraic R L] theorem cardinal_mk_le_sigma_polynomial : #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) := @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L}) (fun x : L => let p := Classical.indefiniteDescription _ (Algebra.IsAlgebraic.isAlgebraic x) ⟨p.1, x, by dsimp have h : p.1.map (algebraMap R L) ≠ 0 := by rw [Ne, ← Polynomial.degree_eq_bot, Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L), Polynomial.degree_eq_bot] exact p.2.1 erw [Polynomial.mem_roots h, Polynomial.IsRoot, Polynomial.eval_map, ← Polynomial.aeval_def, p.2.2]⟩) fun x y => by intro h simp? at h says simp only [Set.coe_setOf, ne_eq, Set.mem_setOf_eq, Sigma.mk.inj_iff] at h refine (Subtype.heq_iff_coe_eq ?_).1 h.2 simp only [h.1, iff_self_iff, forall_true_iff] #align algebra.is_algebraic.cardinal_mk_le_sigma_polynomial Algebra.IsAlgebraic.cardinal_mk_le_sigma_polynomial
Mathlib/FieldTheory/IsAlgClosed/Classification.lean
64
76
theorem cardinal_mk_le_max : #L ≤ max #R ℵ₀ := calc #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) := cardinal_mk_le_sigma_polynomial R L _ = Cardinal.sum fun p : R[X] => #{x : L | x ∈ p.aroots L} := by
rw [← mk_sigma]; rfl _ ≤ Cardinal.sum.{u, u} fun _ : R[X] => ℵ₀ := (sum_le_sum _ _ fun p => (Multiset.finite_toSet _).lt_aleph0.le) _ = #(R[X]) * ℵ₀ := sum_const' _ _ _ ≤ max (max #(R[X]) ℵ₀) ℵ₀ := mul_le_max _ _ _ ≤ max (max (max #R ℵ₀) ℵ₀) ℵ₀ := (max_le_max (max_le_max Polynomial.cardinal_mk_le_max le_rfl) le_rfl) _ = max #R ℵ₀ := by simp only [max_assoc, max_comm ℵ₀, max_left_comm ℵ₀, max_self]
0
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 theorem nonneg (x : ℝ) : 0 ≤ expNegInvGlue x := by 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) #align exp_neg_inv_glue.nonneg expNegInvGlue.nonneg -- Porting note (#10756): new lemma @[simp] theorem zero_iff_nonpos {x : ℝ} : expNegInvGlue x = 0 ↔ x ≤ 0 := ⟨fun h ↦ not_lt.mp fun h' ↦ (pos_of_pos h').ne' h, zero_of_nonpos⟩ #noalign exp_neg_inv_glue.P_aux #noalign exp_neg_inv_glue.f_aux #noalign exp_neg_inv_glue.f_aux_zero_eq #noalign exp_neg_inv_glue.f_aux_deriv #noalign exp_neg_inv_glue.f_aux_deriv_pos #noalign exp_neg_inv_glue.f_aux_limit #noalign exp_neg_inv_glue.f_aux_deriv_zero #noalign exp_neg_inv_glue.f_aux_has_deriv_at
Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean
91
99
theorem tendsto_polynomial_inv_mul_zero (p : ℝ[X]) : Tendsto (fun x ↦ p.eval x⁻¹ * expNegInvGlue x) (𝓝 0) (𝓝 0) := by
simp only [expNegInvGlue, mul_ite, mul_zero] refine tendsto_const_nhds.if ?_ simp only [not_le] have : Tendsto (fun x ↦ p.eval x⁻¹ / exp x⁻¹) (𝓝[>] 0) (𝓝 0) := p.tendsto_div_exp_atTop.comp tendsto_inv_zero_atTop refine this.congr' <| mem_of_superset self_mem_nhdsWithin fun x hx ↦ ?_ simp [expNegInvGlue, hx.out.not_le, exp_neg, div_eq_mul_inv]
0
import Mathlib.AlgebraicTopology.SplitSimplicialObject import Mathlib.AlgebraicTopology.DoldKan.Degeneracies import Mathlib.AlgebraicTopology.DoldKan.FunctorN #align_import algebraic_topology.dold_kan.split_simplicial_object from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Limits CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Idempotents Opposite AlgebraicTopology AlgebraicTopology.DoldKan Simplicial DoldKan namespace SimplicialObject namespace Splitting variable {C : Type*} [Category C] {X : SimplicialObject C} (s : Splitting X) noncomputable def πSummand [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ) : X.obj Δ ⟶ s.N A.1.unop.len := s.desc Δ (fun B => by by_cases h : B = A · exact eqToHom (by subst h; rfl) · exact 0) #align simplicial_object.splitting.π_summand SimplicialObject.Splitting.πSummand @[reassoc (attr := simp)] theorem cofan_inj_πSummand_eq_id [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ) : (s.cofan Δ).inj A ≫ s.πSummand A = 𝟙 _ := by simp [πSummand] #align simplicial_object.splitting.ι_π_summand_eq_id SimplicialObject.Splitting.cofan_inj_πSummand_eq_id @[reassoc (attr := simp)] theorem cofan_inj_πSummand_eq_zero [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A B : IndexSet Δ) (h : B ≠ A) : (s.cofan Δ).inj A ≫ s.πSummand B = 0 := by dsimp [πSummand] rw [ι_desc, dif_neg h.symm] #align simplicial_object.splitting.ι_π_summand_eq_zero SimplicialObject.Splitting.cofan_inj_πSummand_eq_zero variable [Preadditive C]
Mathlib/AlgebraicTopology/DoldKan/SplitSimplicialObject.lean
61
69
theorem decomposition_id (Δ : SimplexCategoryᵒᵖ) : 𝟙 (X.obj Δ) = ∑ A : IndexSet Δ, s.πSummand A ≫ (s.cofan Δ).inj A := by
apply s.hom_ext' intro A dsimp erw [comp_id, comp_sum, Finset.sum_eq_single A, cofan_inj_πSummand_eq_id_assoc] · intro B _ h₂ rw [s.cofan_inj_πSummand_eq_zero_assoc _ _ h₂, zero_comp] · simp
0
import Batteries.Tactic.SeqFocus import Batteries.Data.List.Lemmas import Batteries.Data.List.Init.Attach namespace Std.Range def numElems (r : Range) : Nat := if r.step = 0 then -- This is a very weird choice, but it is chosen to coincide with the `forIn` impl if r.stop ≤ r.start then 0 else r.stop else (r.stop - r.start + r.step - 1) / r.step theorem numElems_stop_le_start : ∀ r : Range, r.stop ≤ r.start → r.numElems = 0 | ⟨start, stop, step⟩, h => by simp [numElems]; split <;> simp_all apply Nat.div_eq_of_lt; simp [Nat.sub_eq_zero_of_le h] exact Nat.pred_lt ‹_› theorem numElems_step_1 (start stop) : numElems ⟨start, stop, 1⟩ = stop - start := by simp [numElems] private theorem numElems_le_iff {start stop step i} (hstep : 0 < step) : (stop - start + step - 1) / step ≤ i ↔ stop ≤ start + step * i := calc (stop - start + step - 1) / step ≤ i _ ↔ stop - start + step - 1 < step * i + step := by rw [← Nat.lt_succ (n := i), Nat.div_lt_iff_lt_mul hstep, Nat.mul_comm, ← Nat.mul_succ] _ ↔ stop - start + step - 1 < step * i + 1 + (step - 1) := by rw [Nat.add_right_comm, Nat.add_assoc, Nat.sub_add_cancel hstep] _ ↔ stop ≤ start + step * i := by rw [Nat.add_sub_assoc hstep, Nat.add_lt_add_iff_right, Nat.lt_succ, Nat.sub_le_iff_le_add'] theorem mem_range'_elems (r : Range) (h : x ∈ List.range' r.start r.numElems r.step) : x ∈ r := by obtain ⟨i, h', rfl⟩ := List.mem_range'.1 h refine ⟨Nat.le_add_right .., ?_⟩ unfold numElems at h'; split at h' · split at h' <;> [cases h'; simp_all] · next step0 => refine Nat.not_le.1 fun h => Nat.not_le.2 h' <| (numElems_le_iff (Nat.pos_of_ne_zero step0)).2 h
.lake/packages/batteries/Batteries/Data/Range/Lemmas.lean
49
92
theorem forIn'_eq_forIn_range' [Monad m] (r : Std.Range) (init : β) (f : (a : Nat) → a ∈ r → β → m (ForInStep β)) : forIn' r init f = forIn ((List.range' r.start r.numElems r.step).pmap Subtype.mk fun _ => mem_range'_elems r) init (fun ⟨a, h⟩ => f a h) := by
let ⟨start, stop, step⟩ := r let L := List.range' start (numElems ⟨start, stop, step⟩) step let f' : { a // start ≤ a ∧ a < stop } → _ := fun ⟨a, h⟩ => f a h suffices ∀ H, forIn' [start:stop:step] init f = forIn (L.pmap Subtype.mk H) init f' from this _ intro H; dsimp only [forIn', Range.forIn'] if h : start < stop then simp [numElems, Nat.not_le.2 h, L]; split · subst step suffices ∀ n H init, forIn'.loop start stop 0 f n start (Nat.le_refl _) init = forIn ((List.range' start n 0).pmap Subtype.mk H) init f' from this _ .. intro n; induction n with (intro H init; unfold forIn'.loop; simp [*]) | succ n ih => simp [ih (List.forall_mem_cons.1 H).2]; rfl · next step0 => have hstep := Nat.pos_of_ne_zero step0 suffices ∀ fuel l i hle H, l ≤ fuel → (∀ j, stop ≤ i + step * j ↔ l ≤ j) → ∀ init, forIn'.loop start stop step f fuel i hle init = List.forIn ((List.range' i l step).pmap Subtype.mk H) init f' by refine this _ _ _ _ _ ((numElems_le_iff hstep).2 (Nat.le_trans ?_ (Nat.le_add_left ..))) (fun _ => (numElems_le_iff hstep).symm) _ conv => lhs; rw [← Nat.one_mul stop] exact Nat.mul_le_mul_right stop hstep intro fuel; induction fuel with intro l i hle H h1 h2 init | zero => simp [forIn'.loop, Nat.le_zero.1 h1] | succ fuel ih => cases l with | zero => rw [forIn'.loop]; simp [Nat.not_lt.2 <| by simpa using (h2 0).2 (Nat.le_refl _)] | succ l => have ih := ih _ _ (Nat.le_trans hle (Nat.le_add_right ..)) (List.forall_mem_cons.1 H).2 (Nat.le_of_succ_le_succ h1) fun i => by rw [Nat.add_right_comm, Nat.add_assoc, ← Nat.mul_succ, h2, Nat.succ_le_succ_iff] have := h2 0; simp at this rw [forIn'.loop]; simp [List.forIn, this, ih]; rfl else simp [List.range', h, numElems_stop_le_start ⟨start, stop, step⟩ (Nat.not_lt.1 h), L] cases stop <;> unfold forIn'.loop <;> simp [List.forIn', h]
0
import Mathlib.GroupTheory.QuotientGroup #align_import algebra.char_zero.quotient from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46" variable {R : Type*} [DivisionRing R] [CharZero R] {p : R} namespace AddSubgroup
Mathlib/Algebra/CharZero/Quotient.lean
20
39
theorem zsmul_mem_zmultiples_iff_exists_sub_div {r : R} {z : ℤ} (hz : z ≠ 0) : z • r ∈ AddSubgroup.zmultiples p ↔ ∃ k : Fin z.natAbs, r - (k : ℕ) • (p / z : R) ∈ AddSubgroup.zmultiples p := by
rw [AddSubgroup.mem_zmultiples_iff] simp_rw [AddSubgroup.mem_zmultiples_iff, div_eq_mul_inv, ← smul_mul_assoc, eq_sub_iff_add_eq] have hz' : (z : R) ≠ 0 := Int.cast_ne_zero.mpr hz conv_rhs => simp (config := { singlePass := true }) only [← (mul_right_injective₀ hz').eq_iff] simp_rw [← zsmul_eq_mul, smul_add, ← mul_smul_comm, zsmul_eq_mul (z : R)⁻¹, mul_inv_cancel hz', mul_one, ← natCast_zsmul, smul_smul, ← add_smul] constructor · rintro ⟨k, h⟩ simp_rw [← h] refine ⟨⟨(k % z).toNat, ?_⟩, k / z, ?_⟩ · rw [← Int.ofNat_lt, Int.toNat_of_nonneg (Int.emod_nonneg _ hz)] exact (Int.emod_lt _ hz).trans_eq (Int.abs_eq_natAbs _) rw [Fin.val_mk, Int.toNat_of_nonneg (Int.emod_nonneg _ hz)] nth_rewrite 3 [← Int.ediv_add_emod k z] rfl · rintro ⟨k, n, h⟩ exact ⟨_, h⟩
0
import Mathlib.Analysis.InnerProductSpace.Dual #align_import analysis.inner_product_space.lax_milgram from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open RCLike LinearMap ContinuousLinearMap InnerProductSpace open LinearMap (ker range) open RealInnerProductSpace NNReal universe u namespace IsCoercive variable {V : Type u} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [CompleteSpace V] variable {B : V →L[ℝ] V →L[ℝ] ℝ} local postfix:1024 "♯" => @continuousLinearMapOfBilin ℝ V _ _ _ _ theorem bounded_below (coercive : IsCoercive B) : ∃ C, 0 < C ∧ ∀ v, C * ‖v‖ ≤ ‖B♯ v‖ := by rcases coercive with ⟨C, C_ge_0, coercivity⟩ refine ⟨C, C_ge_0, ?_⟩ intro v by_cases h : 0 < ‖v‖ · refine (mul_le_mul_right h).mp ?_ calc C * ‖v‖ * ‖v‖ ≤ B v v := coercivity v _ = ⟪B♯ v, v⟫_ℝ := (continuousLinearMapOfBilin_apply B v v).symm _ ≤ ‖B♯ v‖ * ‖v‖ := real_inner_le_norm (B♯ v) v · have : v = 0 := by simpa using h simp [this] #align is_coercive.bounded_below IsCoercive.bounded_below theorem antilipschitz (coercive : IsCoercive B) : ∃ C : ℝ≥0, 0 < C ∧ AntilipschitzWith C B♯ := by rcases coercive.bounded_below with ⟨C, C_pos, below_bound⟩ refine ⟨C⁻¹.toNNReal, Real.toNNReal_pos.mpr (inv_pos.mpr C_pos), ?_⟩ refine ContinuousLinearMap.antilipschitz_of_bound B♯ ?_ simp_rw [Real.coe_toNNReal', max_eq_left_of_lt (inv_pos.mpr C_pos), ← inv_mul_le_iff (inv_pos.mpr C_pos)] simpa using below_bound #align is_coercive.antilipschitz IsCoercive.antilipschitz theorem ker_eq_bot (coercive : IsCoercive B) : ker B♯ = ⊥ := by rw [LinearMapClass.ker_eq_bot] rcases coercive.antilipschitz with ⟨_, _, antilipschitz⟩ exact antilipschitz.injective #align is_coercive.ker_eq_bot IsCoercive.ker_eq_bot theorem isClosed_range (coercive : IsCoercive B) : IsClosed (range B♯ : Set V) := by rcases coercive.antilipschitz with ⟨_, _, antilipschitz⟩ exact antilipschitz.isClosed_range B♯.uniformContinuous #align is_coercive.closed_range IsCoercive.isClosed_range @[deprecated (since := "2024-03-19")] alias closed_range := isClosed_range
Mathlib/Analysis/InnerProductSpace/LaxMilgram.lean
87
102
theorem range_eq_top (coercive : IsCoercive B) : range B♯ = ⊤ := by
haveI := coercive.isClosed_range.completeSpace_coe rw [← (range B♯).orthogonal_orthogonal] rw [Submodule.eq_top_iff'] intro v w mem_w_orthogonal rcases coercive with ⟨C, C_pos, coercivity⟩ obtain rfl : w = 0 := by rw [← norm_eq_zero, ← mul_self_eq_zero, ← mul_right_inj' C_pos.ne', mul_zero, ← mul_assoc] apply le_antisymm · calc C * ‖w‖ * ‖w‖ ≤ B w w := coercivity w _ = ⟪B♯ w, w⟫_ℝ := (continuousLinearMapOfBilin_apply B w w).symm _ = 0 := mem_w_orthogonal _ ⟨w, rfl⟩ · positivity exact inner_zero_left _
0
import Mathlib.Topology.Algebra.Algebra import Mathlib.Analysis.InnerProductSpace.Basic #align_import analysis.inner_product_space.of_norm from "leanprover-community/mathlib"@"baa88307f3e699fa7054ef04ec79fa4f056169cb" open RCLike open scoped ComplexConjugate variable {𝕜 : Type*} [RCLike 𝕜] (E : Type*) [NormedAddCommGroup E] class InnerProductSpaceable : Prop where parallelogram_identity : ∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) #align inner_product_spaceable InnerProductSpaceable variable (𝕜) {E} theorem InnerProductSpace.toInnerProductSpaceable [InnerProductSpace 𝕜 E] : InnerProductSpaceable E := ⟨parallelogram_law_with_norm 𝕜⟩ #align inner_product_space.to_inner_product_spaceable InnerProductSpace.toInnerProductSpaceable -- See note [lower instance priority] instance (priority := 100) InnerProductSpace.toInnerProductSpaceable_ofReal [InnerProductSpace ℝ E] : InnerProductSpaceable E := ⟨parallelogram_law_with_norm ℝ⟩ #align inner_product_space.to_inner_product_spaceable_of_real InnerProductSpace.toInnerProductSpaceable_ofReal variable [NormedSpace 𝕜 E] local notation "𝓚" => algebraMap ℝ 𝕜 private noncomputable def inner_ (x y : E) : 𝕜 := 4⁻¹ * (𝓚 ‖x + y‖ * 𝓚 ‖x + y‖ - 𝓚 ‖x - y‖ * 𝓚 ‖x - y‖ + (I : 𝕜) * 𝓚 ‖(I : 𝕜) • x + y‖ * 𝓚 ‖(I : 𝕜) • x + y‖ - (I : 𝕜) * 𝓚 ‖(I : 𝕜) • x - y‖ * 𝓚 ‖(I : 𝕜) • x - y‖) namespace InnerProductSpaceable variable {𝕜} (E) -- Porting note: prime added to avoid clashing with public `innerProp` private def innerProp' (r : 𝕜) : Prop := ∀ x y : E, inner_ 𝕜 (r • x) y = conj r * inner_ 𝕜 x y variable {E} theorem innerProp_neg_one : innerProp' E ((-1 : ℤ) : 𝕜) := by intro x y simp only [inner_, neg_mul_eq_neg_mul, one_mul, Int.cast_one, one_smul, RingHom.map_one, map_neg, Int.cast_neg, neg_smul, neg_one_mul] rw [neg_mul_comm] congr 1 have h₁ : ‖-x - y‖ = ‖x + y‖ := by rw [← neg_add', norm_neg] have h₂ : ‖-x + y‖ = ‖x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add] have h₃ : ‖(I : 𝕜) • -x + y‖ = ‖(I : 𝕜) • x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add, ← smul_neg] have h₄ : ‖(I : 𝕜) • -x - y‖ = ‖(I : 𝕜) • x + y‖ := by rw [smul_neg, ← neg_add', norm_neg] rw [h₁, h₂, h₃, h₄] ring #align inner_product_spaceable.inner_prop_neg_one InnerProductSpaceable.innerProp_neg_one theorem _root_.Continuous.inner_ {f g : ℝ → E} (hf : Continuous f) (hg : Continuous g) : Continuous fun x => inner_ 𝕜 (f x) (g x) := by unfold inner_ have := Continuous.const_smul (M := 𝕜) hf I continuity #align inner_product_spaceable.continuous.inner_ Continuous.inner_ theorem inner_.norm_sq (x : E) : ‖x‖ ^ 2 = re (inner_ 𝕜 x x) := by simp only [inner_] have h₁ : RCLike.normSq (4 : 𝕜) = 16 := by have : ((4 : ℝ) : 𝕜) = (4 : 𝕜) := by norm_cast rw [← this, normSq_eq_def', RCLike.norm_of_nonneg (by norm_num : (0 : ℝ) ≤ 4)] norm_num have h₂ : ‖x + x‖ = 2 * ‖x‖ := by rw [← two_smul 𝕜, norm_smul, RCLike.norm_two] simp only [h₁, h₂, algebraMap_eq_ofReal, sub_self, norm_zero, mul_re, inv_re, ofNat_re, map_sub, map_add, ofReal_re, ofNat_im, ofReal_im, mul_im, I_re, inv_im] ring #align inner_product_spaceable.inner_.norm_sq InnerProductSpaceable.inner_.norm_sq
Mathlib/Analysis/InnerProductSpace/OfNorm.lean
139
161
theorem inner_.conj_symm (x y : E) : conj (inner_ 𝕜 y x) = inner_ 𝕜 x y := by
simp only [inner_] have h4 : conj (4⁻¹ : 𝕜) = 4⁻¹ := by norm_num rw [map_mul, h4] congr 1 simp only [map_sub, map_add, algebraMap_eq_ofReal, ← ofReal_mul, conj_ofReal, map_mul, conj_I] rw [add_comm y x, norm_sub_rev] by_cases hI : (I : 𝕜) = 0 · simp only [hI, neg_zero, zero_mul] -- Porting note: this replaces `norm_I_of_ne_zero` which does not exist in Lean 4 have : ‖(I : 𝕜)‖ = 1 := by rw [← mul_self_inj_of_nonneg (norm_nonneg I) zero_le_one, one_mul, ← norm_mul, I_mul_I_of_nonzero hI, norm_neg, norm_one] have h₁ : ‖(I : 𝕜) • y - x‖ = ‖(I : 𝕜) • x + y‖ := by trans ‖(I : 𝕜) • ((I : 𝕜) • y - x)‖ · rw [norm_smul, this, one_mul] · rw [smul_sub, smul_smul, I_mul_I_of_nonzero hI, neg_one_smul, ← neg_add', add_comm, norm_neg] have h₂ : ‖(I : 𝕜) • y + x‖ = ‖(I : 𝕜) • x - y‖ := by trans ‖(I : 𝕜) • ((I : 𝕜) • y + x)‖ · rw [norm_smul, this, one_mul] · rw [smul_add, smul_smul, I_mul_I_of_nonzero hI, neg_one_smul, ← neg_add_eq_sub] rw [h₁, h₂, ← sub_add_eq_add_sub] simp only [neg_mul, sub_eq_add_neg, neg_neg]
0
import Mathlib.LinearAlgebra.Dimension.Free import Mathlib.Algebra.Module.Torsion #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v v' u₁' w w' variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v} variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*} open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁] variable [Module R M] [Module R M'] [Module R M₁] section Finsupp variable (R M M') variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M'] open Module.Free @[simp] theorem rank_finsupp (ι : Type w) : Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M) rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma, Cardinal.sum_const] #align rank_finsupp rank_finsupp theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by simp [rank_finsupp] #align rank_finsupp' rank_finsupp' -- Porting note, this should not be `@[simp]`, as simp can prove it. -- @[simp] theorem rank_finsupp_self (ι : Type w) : Module.rank R (ι →₀ R) = Cardinal.lift.{u} #ι := by simp [rank_finsupp] #align rank_finsupp_self rank_finsupp_self theorem rank_finsupp_self' {ι : Type u} : Module.rank R (ι →₀ R) = #ι := by simp #align rank_finsupp_self' rank_finsupp_self' @[simp] theorem rank_directSum {ι : Type v} (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)] [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.rank R (⨁ i, M i) = Cardinal.sum fun i => Module.rank R (M i) := by let B i := chooseBasis R (M i) let b : Basis _ R (⨁ i, M i) := DFinsupp.basis fun i => B i simp [← b.mk_eq_rank'', fun i => (B i).mk_eq_rank''] #align rank_direct_sum rank_directSum @[simp] theorem rank_matrix (m : Type v) (n : Type w) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = Cardinal.lift.{max v w u, v} #m * Cardinal.lift.{max v w u, w} #n := by cases nonempty_fintype m cases nonempty_fintype n have h := (Matrix.stdBasis R m n).mk_eq_rank rw [← lift_lift.{max v w u, max v w}, lift_inj] at h simpa using h.symm #align rank_matrix rank_matrix @[simp high] theorem rank_matrix' (m n : Type v) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = Cardinal.lift.{u} (#m * #n) := by rw [rank_matrix, lift_mul, lift_umax.{v, u}] #align rank_matrix' rank_matrix' -- @[simp] -- Porting note (#10618): simp can prove this theorem rank_matrix'' (m n : Type u) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = #m * #n := by simp #align rank_matrix'' rank_matrix'' variable [Module.Finite R M] [Module.Finite R M'] open Fintype namespace FiniteDimensional @[simp] theorem finrank_finsupp {ι : Type v} [Fintype ι] : finrank R (ι →₀ M) = card ι * finrank R M := by rw [finrank, finrank, rank_finsupp, ← mk_toNat_eq_card, toNat_mul, toNat_lift, toNat_lift] @[simp] theorem finrank_finsupp_self {ι : Type v} [Fintype ι] : finrank R (ι →₀ R) = card ι := by rw [finrank, rank_finsupp_self, ← mk_toNat_eq_card, toNat_lift] #align finite_dimensional.finrank_finsupp FiniteDimensional.finrank_finsupp_self @[simp]
Mathlib/LinearAlgebra/Dimension/Constructions.lean
241
246
theorem finrank_directSum {ι : Type v} [Fintype ι] (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)] [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] [∀ i : ι, Module.Finite R (M i)] : finrank R (⨁ i, M i) = ∑ i, finrank R (M i) := by
letI := nontrivial_of_invariantBasisNumber R simp only [finrank, fun i => rank_eq_card_chooseBasisIndex R (M i), rank_directSum, ← mk_sigma, mk_toNat_eq_card, card_sigma]
0
import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Polynomial.Eval import Mathlib.GroupTheory.GroupAction.Ring #align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821" noncomputable section open Finset open Polynomial namespace Polynomial universe u v w y z variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ} section Derivative section Semiring variable [Semiring R] def derivative : R[X] →ₗ[R] R[X] where toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1) map_add' p q := by dsimp only rw [sum_add_index] <;> simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul, RingHom.map_zero] map_smul' a p := by dsimp; rw [sum_smul_index] <;> simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul, RingHom.map_zero, sum] #align polynomial.derivative Polynomial.derivative theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) := rfl #align polynomial.derivative_apply Polynomial.derivative_apply theorem coeff_derivative (p : R[X]) (n : ℕ) : coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by rw [derivative_apply] simp only [coeff_X_pow, coeff_sum, coeff_C_mul] rw [sum, Finset.sum_eq_single (n + 1)] · simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast · intro b cases b · intros rw [Nat.cast_zero, mul_zero, zero_mul] · intro _ H rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero] · rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one, mem_support_iff] intro h push_neg at h simp [h] #align polynomial.coeff_derivative Polynomial.coeff_derivative -- Porting note (#10618): removed `simp`: `simp` can prove it. theorem derivative_zero : derivative (0 : R[X]) = 0 := derivative.map_zero #align polynomial.derivative_zero Polynomial.derivative_zero theorem iterate_derivative_zero {k : ℕ} : derivative^[k] (0 : R[X]) = 0 := iterate_map_zero derivative k #align polynomial.iterate_derivative_zero Polynomial.iterate_derivative_zero @[simp] theorem derivative_monomial (a : R) (n : ℕ) : derivative (monomial n a) = monomial (n - 1) (a * n) := by rw [derivative_apply, sum_monomial_index, C_mul_X_pow_eq_monomial] simp #align polynomial.derivative_monomial Polynomial.derivative_monomial theorem derivative_C_mul_X (a : R) : derivative (C a * X) = C a := by simp [C_mul_X_eq_monomial, derivative_monomial, Nat.cast_one, mul_one] set_option linter.uppercaseLean3 false in #align polynomial.derivative_C_mul_X Polynomial.derivative_C_mul_X
Mathlib/Algebra/Polynomial/Derivative.lean
97
99
theorem derivative_C_mul_X_pow (a : R) (n : ℕ) : derivative (C a * X ^ n) = C (a * n) * X ^ (n - 1) := by
rw [C_mul_X_pow_eq_monomial, C_mul_X_pow_eq_monomial, derivative_monomial]
0
import Mathlib.CategoryTheory.EqToHom import Mathlib.CategoryTheory.Functor.Const import Mathlib.CategoryTheory.Opposites import Mathlib.Data.Prod.Basic #align_import category_theory.products.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace CategoryTheory -- declare the `v`'s first; see `CategoryTheory.Category` for an explanation universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄ section variable (C : Type u₁) [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D] -- the generates simp lemmas like `id_fst` and `comp_snd` @[simps (config := { notRecursive := [] }) Hom id_fst id_snd comp_fst comp_snd] instance prod : Category.{max v₁ v₂} (C × D) where Hom X Y := (X.1 ⟶ Y.1) × (X.2 ⟶ Y.2) id X := ⟨𝟙 X.1, 𝟙 X.2⟩ comp f g := (f.1 ≫ g.1, f.2 ≫ g.2) #align category_theory.prod CategoryTheory.prod @[simp] theorem prod_id (X : C) (Y : D) : 𝟙 (X, Y) = (𝟙 X, 𝟙 Y) := rfl #align category_theory.prod_id CategoryTheory.prod_id @[simp] theorem prod_comp {P Q R : C} {S T U : D} (f : (P, S) ⟶ (Q, T)) (g : (Q, T) ⟶ (R, U)) : f ≫ g = (f.1 ≫ g.1, f.2 ≫ g.2) := rfl #align category_theory.prod_comp CategoryTheory.prod_comp
Mathlib/CategoryTheory/Products/Basic.lean
64
75
theorem isIso_prod_iff {P Q : C} {S T : D} {f : (P, S) ⟶ (Q, T)} : IsIso f ↔ IsIso f.1 ∧ IsIso f.2 := by
constructor · rintro ⟨g, hfg, hgf⟩ simp? at hfg hgf says simp only [prod_Hom, prod_comp, prod_id, Prod.mk.injEq] at hfg hgf rcases hfg with ⟨hfg₁, hfg₂⟩ rcases hgf with ⟨hgf₁, hgf₂⟩ exact ⟨⟨⟨g.1, hfg₁, hgf₁⟩⟩, ⟨⟨g.2, hfg₂, hgf₂⟩⟩⟩ · rintro ⟨⟨g₁, hfg₁, hgf₁⟩, ⟨g₂, hfg₂, hgf₂⟩⟩ dsimp at hfg₁ hgf₁ hfg₂ hgf₂ refine ⟨⟨(g₁, g₂), ?_, ?_⟩⟩ repeat { simp; constructor; assumption; assumption }
0
import Mathlib.Analysis.Calculus.FDeriv.Measurable import Mathlib.Analysis.Calculus.Deriv.Comp import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.Calculus.Deriv.Mul import Mathlib.Analysis.NormedSpace.Dual import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.MeasureTheory.Integral.VitaliCaratheodory #align_import measure_theory.integral.fund_thm_calculus from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" set_option autoImplicit true noncomputable section open scoped Classical open MeasureTheory Set Filter Function open scoped Classical Topology Filter ENNReal Interval NNReal variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] namespace intervalIntegral section FTC1 class FTCFilter (a : outParam ℝ) (outer : Filter ℝ) (inner : outParam <| Filter ℝ) extends TendstoIxxClass Ioc outer inner : Prop where pure_le : pure a ≤ outer le_nhds : inner ≤ 𝓝 a [meas_gen : IsMeasurablyGenerated inner] set_option linter.uppercaseLean3 false in #align interval_integral.FTC_filter intervalIntegral.FTCFilter open Asymptotics section variable {f : ℝ → E} {a b : ℝ} {c ca cb : E} {l l' la la' lb lb' : Filter ℝ} {lt : Filter ι} {μ : Measure ℝ} {u v ua va ub vb : ι → ℝ}
Mathlib/MeasureTheory/Integral/FundThmCalculus.lean
273
288
theorem measure_integral_sub_linear_isLittleO_of_tendsto_ae' [IsMeasurablyGenerated l'] [TendstoIxxClass Ioc l l'] (hfm : StronglyMeasurableAtFilter f l' μ) (hf : Tendsto f (l' ⊓ ae μ) (𝓝 c)) (hl : μ.FiniteAtFilter l') (hu : Tendsto u lt l) (hv : Tendsto v lt l) : (fun t => (∫ x in u t..v t, f x ∂μ) - ∫ _ in u t..v t, c ∂μ) =o[lt] fun t => ∫ _ in u t..v t, (1 : ℝ) ∂μ := by
by_cases hE : CompleteSpace E; swap · simp [intervalIntegral, integral, hE] have A := hf.integral_sub_linear_isLittleO_ae hfm hl (hu.Ioc hv) have B := hf.integral_sub_linear_isLittleO_ae hfm hl (hv.Ioc hu) simp_rw [integral_const', sub_smul] refine ((A.trans_le fun t ↦ ?_).sub (B.trans_le fun t ↦ ?_)).congr_left fun t ↦ ?_ · cases le_total (u t) (v t) <;> simp [*] · cases le_total (u t) (v t) <;> simp [*] · simp_rw [intervalIntegral] abel
0
import Mathlib.Computability.Encoding import Mathlib.Logic.Small.List import Mathlib.ModelTheory.Syntax import Mathlib.SetTheory.Cardinal.Ordinal #align_import model_theory.encoding from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} open FirstOrder Cardinal open Computability List Structure Cardinal Fin namespace BoundedFormula def listEncode : ∀ {n : ℕ}, L.BoundedFormula α n → List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)) | n, falsum => [Sum.inr (Sum.inr (n + 2))] | _, equal t₁ t₂ => [Sum.inl ⟨_, t₁⟩, Sum.inl ⟨_, t₂⟩] | n, rel R ts => [Sum.inr (Sum.inl ⟨_, R⟩), Sum.inr (Sum.inr n)] ++ (List.finRange _).map fun i => Sum.inl ⟨n, ts i⟩ | _, imp φ₁ φ₂ => (Sum.inr (Sum.inr 0)::φ₁.listEncode) ++ φ₂.listEncode | _, all φ => Sum.inr (Sum.inr 1)::φ.listEncode #align first_order.language.bounded_formula.list_encode FirstOrder.Language.BoundedFormula.listEncode def sigmaAll : (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n | ⟨n + 1, φ⟩ => ⟨n, φ.all⟩ | _ => default #align first_order.language.bounded_formula.sigma_all FirstOrder.Language.BoundedFormula.sigmaAll def sigmaImp : (Σn, L.BoundedFormula α n) → (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n | ⟨m, φ⟩, ⟨n, ψ⟩ => if h : m = n then ⟨m, φ.imp (Eq.mp (by rw [h]) ψ)⟩ else default #align first_order.language.bounded_formula.sigma_imp FirstOrder.Language.BoundedFormula.sigmaImp @[simp] def listDecode : ∀ l : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)), (Σn, L.BoundedFormula α n) × { l' : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)) // SizeOf.sizeOf l' ≤ max 1 (SizeOf.sizeOf l) } | Sum.inr (Sum.inr (n + 2))::l => ⟨⟨n, falsum⟩, l, le_max_of_le_right le_add_self⟩ | Sum.inl ⟨n₁, t₁⟩::Sum.inl ⟨n₂, t₂⟩::l => ⟨if h : n₁ = n₂ then ⟨n₁, equal t₁ (Eq.mp (by rw [h]) t₂)⟩ else default, l, by simp only [SizeOf.sizeOf, List._sizeOf_1, ← add_assoc] exact le_max_of_le_right le_add_self⟩ | Sum.inr (Sum.inl ⟨n, R⟩)::Sum.inr (Sum.inr k)::l => ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft?).get? i).join.isSome then if h' : ∀ i, (Option.get _ (h i)).1 = k then ⟨k, BoundedFormula.rel R fun i => Eq.mp (by rw [h' i]) (Option.get _ (h i)).2⟩ else default else default, l.drop n, le_max_of_le_right (le_add_left (le_add_left (List.drop_sizeOf_le _ _)))⟩ | Sum.inr (Sum.inr 0)::l => have : SizeOf.sizeOf (↑(listDecode l).2 : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ))) < 1 + (1 + 1) + SizeOf.sizeOf l := by refine lt_of_le_of_lt (listDecode l).2.2 (max_lt ?_ (Nat.lt_add_of_pos_left (by decide))) rw [add_assoc, lt_add_iff_pos_right, add_pos_iff] exact Or.inl zero_lt_two ⟨sigmaImp (listDecode l).1 (listDecode (listDecode l).2).1, (listDecode (listDecode l).2).2, le_max_of_le_right (_root_.trans (listDecode _).2.2 (max_le (le_add_right le_self_add) (_root_.trans (listDecode _).2.2 (max_le (le_add_right le_self_add) le_add_self))))⟩ | Sum.inr (Sum.inr 1)::l => ⟨sigmaAll (listDecode l).1, (listDecode l).2, (listDecode l).2.2.trans (max_le_max le_rfl le_add_self)⟩ | _ => ⟨default, [], le_max_left _ _⟩ #align first_order.language.bounded_formula.list_decode FirstOrder.Language.BoundedFormula.listDecode @[simp]
Mathlib/ModelTheory/Encoding.lean
235
287
theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) : (listDecode (l.bind fun φ => φ.2.listEncode)).1 = l.headI := by
suffices h : ∀ (φ : Σn, L.BoundedFormula α n) (l), (listDecode (listEncode φ.2 ++ l)).1 = φ ∧ (listDecode (listEncode φ.2 ++ l)).2.1 = l by induction' l with φ l _ · rw [List.nil_bind] simp [listDecode] · rw [cons_bind, (h φ _).1, headI_cons] rintro ⟨n, φ⟩ induction' φ with _ _ _ _ φ_n φ_l φ_R ts _ _ _ ih1 ih2 _ _ ih <;> intro l · rw [listEncode, singleton_append, listDecode] simp only [eq_self_iff_true, heq_iff_eq, and_self_iff] · rw [listEncode, cons_append, cons_append, listDecode, dif_pos] · simp only [eq_mp_eq_cast, cast_eq, eq_self_iff_true, heq_iff_eq, and_self_iff, nil_append] · simp only [eq_self_iff_true, heq_iff_eq, and_self_iff] · rw [listEncode, cons_append, cons_append, singleton_append, cons_append, listDecode] have h : ∀ i : Fin φ_l, ((List.map Sum.getLeft? (List.map (fun i : Fin φ_l => Sum.inl (⟨(⟨φ_n, rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ : Σn, L.Term (Sum α (Fin n)))) (finRange φ_l) ++ l)).get? ↑i).join = some ⟨_, ts i⟩ := by intro i simp only [Option.join, map_append, map_map, Option.bind_eq_some, id, exists_eq_right, get?_eq_some, length_append, length_map, length_finRange] refine ⟨lt_of_lt_of_le i.2 le_self_add, ?_⟩ rw [get_append, get_map] · simp only [Sum.getLeft?, get_finRange, Fin.eta, Function.comp_apply, eq_self_iff_true, heq_iff_eq, and_self_iff] · simp only [length_map, length_finRange, is_lt] rw [dif_pos] swap · exact fun i => Option.isSome_iff_exists.2 ⟨⟨_, ts i⟩, h i⟩ rw [dif_pos] swap · intro i obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i) rw [h2] simp only [Sigma.mk.inj_iff, heq_eq_eq, rel.injEq, true_and] refine ⟨funext fun i => ?_, ?_⟩ · obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i) rw [eq_mp_eq_cast, cast_eq_iff_heq] exact (Sigma.ext_iff.1 ((Sigma.eta (Option.get _ h1)).trans h2)).2 rw [List.drop_append_eq_append_drop, length_map, length_finRange, Nat.sub_self, drop, drop_eq_nil_of_le, nil_append] rw [length_map, length_finRange] · rw [listEncode, List.append_assoc, cons_append, listDecode] simp only [] at * rw [(ih1 _).1, (ih1 _).2, (ih2 _).1, (ih2 _).2, sigmaImp] simp only [dite_true] exact ⟨rfl, trivial⟩ · rw [listEncode, cons_append, listDecode] simp only simp only [] at * rw [(ih _).1, (ih _).2, sigmaAll] exact ⟨rfl, rfl⟩
0
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Nat.Choose.Basic import Mathlib.Tactic.Linarith import Mathlib.Tactic.Ring #align_import data.nat.choose.sum from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Nat open Finset variable {R : Type*} namespace Commute variable [Semiring R] {x y : R} theorem add_pow (h : Commute x y) (n : ℕ) : (x + y) ^ n = ∑ m ∈ range (n + 1), x ^ m * y ^ (n - m) * choose n m := by let t : ℕ → ℕ → R := fun n m ↦ x ^ m * y ^ (n - m) * choose n m change (x + y) ^ n = ∑ m ∈ range (n + 1), t n m have h_first : ∀ n, t n 0 = y ^ n := fun n ↦ by simp only [t, choose_zero_right, _root_.pow_zero, Nat.cast_one, mul_one, one_mul, tsub_zero] have h_last : ∀ n, t n n.succ = 0 := fun n ↦ by simp only [t, ge_iff_le, choose_succ_self, cast_zero, mul_zero] have h_middle : ∀ n i : ℕ, i ∈ range n.succ → (t n.succ ∘ Nat.succ) i = x * t n i + y * t n i.succ := by intro n i h_mem have h_le : i ≤ n := Nat.le_of_lt_succ (mem_range.mp h_mem) dsimp only [t] rw [Function.comp_apply, choose_succ_succ, Nat.cast_add, mul_add] congr 1 · rw [pow_succ' x, succ_sub_succ, mul_assoc, mul_assoc, mul_assoc] · rw [← mul_assoc y, ← mul_assoc y, (h.symm.pow_right i.succ).eq] by_cases h_eq : i = n · rw [h_eq, choose_succ_self, Nat.cast_zero, mul_zero, mul_zero] · rw [succ_sub (lt_of_le_of_ne h_le h_eq)] rw [pow_succ' y, mul_assoc, mul_assoc, mul_assoc, mul_assoc] induction' n with n ih · rw [_root_.pow_zero, sum_range_succ, range_zero, sum_empty, zero_add] dsimp only [t] rw [_root_.pow_zero, _root_.pow_zero, choose_self, Nat.cast_one, mul_one, mul_one] · rw [sum_range_succ', h_first] erw [sum_congr rfl (h_middle n), sum_add_distrib, add_assoc] rw [pow_succ' (x + y), ih, add_mul, mul_sum, mul_sum] congr 1 rw [sum_range_succ', sum_range_succ, h_first, h_last, mul_zero, add_zero, _root_.pow_succ'] #align commute.add_pow Commute.add_pow
Mathlib/Data/Nat/Choose/Sum.lean
72
75
theorem add_pow' (h : Commute x y) (n : ℕ) : (x + y) ^ n = ∑ m ∈ antidiagonal n, choose n m.fst • (x ^ m.fst * y ^ m.snd) := by
simp_rw [Finset.Nat.sum_antidiagonal_eq_sum_range_succ fun m p ↦ choose n m • (x ^ m * y ^ p), _root_.nsmul_eq_mul, cast_comm, h.add_pow]
0
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv #align_import analysis.special_functions.trigonometric.bounds from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Set namespace Real variable {x : ℝ}
Mathlib/Analysis/SpecialFunctions/Trigonometric/Bounds.lean
39
49
theorem sin_lt (h : 0 < x) : sin x < x := by
cases' lt_or_le 1 x with h' h' · exact (sin_le_one x).trans_lt h' have hx : |x| = x := abs_of_nonneg h.le have := le_of_abs_le (sin_bound <| show |x| ≤ 1 by rwa [hx]) rw [sub_le_iff_le_add', hx] at this apply this.trans_lt rw [sub_add, sub_lt_self_iff, sub_pos, div_eq_mul_inv (x ^ 3)] refine mul_lt_mul' ?_ (by norm_num) (by norm_num) (pow_pos h 3) apply pow_le_pow_of_le_one h.le h' norm_num
0
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 Disjoint def Disjoint (f g : Perm α) := ∀ x, f x = x ∨ g x = x #align equiv.perm.disjoint Equiv.Perm.Disjoint variable {f g h : Perm α} @[symm] theorem Disjoint.symm : Disjoint f g → Disjoint g f := by simp only [Disjoint, or_comm, imp_self] #align equiv.perm.disjoint.symm Equiv.Perm.Disjoint.symm theorem Disjoint.symmetric : Symmetric (@Disjoint α) := fun _ _ => Disjoint.symm #align equiv.perm.disjoint.symmetric Equiv.Perm.Disjoint.symmetric instance : IsSymm (Perm α) Disjoint := ⟨Disjoint.symmetric⟩ theorem disjoint_comm : Disjoint f g ↔ Disjoint g f := ⟨Disjoint.symm, Disjoint.symm⟩ #align equiv.perm.disjoint_comm Equiv.Perm.disjoint_comm theorem Disjoint.commute (h : Disjoint f g) : Commute f g := Equiv.ext fun x => (h x).elim (fun hf => (h (g x)).elim (fun hg => by simp [mul_apply, hf, hg]) fun hg => by simp [mul_apply, hf, g.injective hg]) fun hg => (h (f x)).elim (fun hf => by simp [mul_apply, f.injective hf, hg]) fun hf => by simp [mul_apply, hf, hg] #align equiv.perm.disjoint.commute Equiv.Perm.Disjoint.commute @[simp] theorem disjoint_one_left (f : Perm α) : Disjoint 1 f := fun _ => Or.inl rfl #align equiv.perm.disjoint_one_left Equiv.Perm.disjoint_one_left @[simp] theorem disjoint_one_right (f : Perm α) : Disjoint f 1 := fun _ => Or.inr rfl #align equiv.perm.disjoint_one_right Equiv.Perm.disjoint_one_right theorem disjoint_iff_eq_or_eq : Disjoint f g ↔ ∀ x : α, f x = x ∨ g x = x := Iff.rfl #align equiv.perm.disjoint_iff_eq_or_eq Equiv.Perm.disjoint_iff_eq_or_eq @[simp]
Mathlib/GroupTheory/Perm/Support.lean
87
90
theorem disjoint_refl_iff : Disjoint f f ↔ f = 1 := by
refine ⟨fun h => ?_, fun h => h.symm ▸ disjoint_one_left 1⟩ ext x cases' h x with hx hx <;> simp [hx]
0
import Mathlib.MeasureTheory.Measure.MeasureSpace import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic #align_import measure_theory.measure.open_pos from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology ENNReal MeasureTheory open Set Function Filter namespace MeasureTheory namespace Measure section Basic variable {X Y : Type*} [TopologicalSpace X] {m : MeasurableSpace X} [TopologicalSpace Y] [T2Space Y] (μ ν : Measure X) class IsOpenPosMeasure : Prop where open_pos : ∀ U : Set X, IsOpen U → U.Nonempty → μ U ≠ 0 #align measure_theory.measure.is_open_pos_measure MeasureTheory.Measure.IsOpenPosMeasure variable [IsOpenPosMeasure μ] {s U F : Set X} {x : X} theorem _root_.IsOpen.measure_ne_zero (hU : IsOpen U) (hne : U.Nonempty) : μ U ≠ 0 := IsOpenPosMeasure.open_pos U hU hne #align is_open.measure_ne_zero IsOpen.measure_ne_zero theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < μ U := (hU.measure_ne_zero μ hne).bot_lt #align is_open.measure_pos IsOpen.measure_pos instance (priority := 100) [Nonempty X] : NeZero μ := ⟨measure_univ_pos.mp <| isOpen_univ.measure_pos μ univ_nonempty⟩ theorem _root_.IsOpen.measure_pos_iff (hU : IsOpen U) : 0 < μ U ↔ U.Nonempty := ⟨fun h => nonempty_iff_ne_empty.2 fun he => h.ne' <| he.symm ▸ measure_empty, hU.measure_pos μ⟩ #align is_open.measure_pos_iff IsOpen.measure_pos_iff theorem _root_.IsOpen.measure_eq_zero_iff (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := by simpa only [not_lt, nonpos_iff_eq_zero, not_nonempty_iff_eq_empty] using not_congr (hU.measure_pos_iff μ) #align is_open.measure_eq_zero_iff IsOpen.measure_eq_zero_iff theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < μ s := (isOpen_interior.measure_pos μ h).trans_le (measure_mono interior_subset) #align measure_theory.measure.measure_pos_of_nonempty_interior MeasureTheory.Measure.measure_pos_of_nonempty_interior theorem measure_pos_of_mem_nhds (h : s ∈ 𝓝 x) : 0 < μ s := measure_pos_of_nonempty_interior _ ⟨x, mem_interior_iff_mem_nhds.2 h⟩ #align measure_theory.measure.measure_pos_of_mem_nhds MeasureTheory.Measure.measure_pos_of_mem_nhds theorem isOpenPosMeasure_smul {c : ℝ≥0∞} (h : c ≠ 0) : IsOpenPosMeasure (c • μ) := ⟨fun _U Uo Une => mul_ne_zero h (Uo.measure_ne_zero μ Une)⟩ #align measure_theory.measure.is_open_pos_measure_smul MeasureTheory.Measure.isOpenPosMeasure_smul variable {μ ν} protected theorem AbsolutelyContinuous.isOpenPosMeasure (h : μ ≪ ν) : IsOpenPosMeasure ν := ⟨fun _U ho hne h₀ => ho.measure_ne_zero μ hne (h h₀)⟩ #align measure_theory.measure.absolutely_continuous.is_open_pos_measure MeasureTheory.Measure.AbsolutelyContinuous.isOpenPosMeasure theorem _root_.LE.le.isOpenPosMeasure (h : μ ≤ ν) : IsOpenPosMeasure ν := h.absolutelyContinuous.isOpenPosMeasure #align has_le.le.is_open_pos_measure LE.le.isOpenPosMeasure theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := ⟨fun h ↦ (hU.measure_eq_zero_iff μ).mp h, fun h ↦ by simp [h]⟩ theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) : U =ᵐ[μ] (∅ : Set X) ↔ U = ∅ := by rw [ae_eq_empty, hU.measure_zero_iff_eq_empty] theorem _root_.IsOpen.eq_empty_of_measure_zero (hU : IsOpen U) (h₀ : μ U = 0) : U = ∅ := (hU.measure_eq_zero_iff μ).mp h₀ #align is_open.eq_empty_of_measure_zero IsOpen.eq_empty_of_measure_zero theorem _root_.IsClosed.ae_eq_univ_iff_eq (hF : IsClosed F) : F =ᵐ[μ] univ ↔ F = univ := by refine ⟨fun h ↦ ?_, fun h ↦ by rw [h]⟩ rwa [ae_eq_univ, hF.isOpen_compl.measure_eq_zero_iff μ, compl_empty_iff] at h theorem _root_.IsClosed.measure_eq_univ_iff_eq [OpensMeasurableSpace X] [IsFiniteMeasure μ] (hF : IsClosed F) : μ F = μ univ ↔ F = univ := by rw [← ae_eq_univ_iff_measure_eq hF.measurableSet.nullMeasurableSet, hF.ae_eq_univ_iff_eq] theorem _root_.IsClosed.measure_eq_one_iff_eq_univ [OpensMeasurableSpace X] [IsProbabilityMeasure μ] (hF : IsClosed F) : μ F = 1 ↔ F = univ := by rw [← measure_univ (μ := μ), hF.measure_eq_univ_iff_eq] theorem interior_eq_empty_of_null (hs : μ s = 0) : interior s = ∅ := isOpen_interior.eq_empty_of_measure_zero <| measure_mono_null interior_subset hs #align measure_theory.measure.interior_eq_empty_of_null MeasureTheory.Measure.interior_eq_empty_of_null
Mathlib/MeasureTheory/Measure/OpenPos.lean
119
130
theorem eqOn_open_of_ae_eq {f g : X → Y} (h : f =ᵐ[μ.restrict U] g) (hU : IsOpen U) (hf : ContinuousOn f U) (hg : ContinuousOn g U) : EqOn f g U := by
replace h := ae_imp_of_ae_restrict h simp only [EventuallyEq, ae_iff, Classical.not_imp] at h have : IsOpen (U ∩ { a | f a ≠ g a }) := by refine isOpen_iff_mem_nhds.mpr fun a ha => inter_mem (hU.mem_nhds ha.1) ?_ rcases ha with ⟨ha : a ∈ U, ha' : (f a, g a) ∈ (diagonal Y)ᶜ⟩ exact (hf.continuousAt (hU.mem_nhds ha)).prod_mk_nhds (hg.continuousAt (hU.mem_nhds ha)) (isClosed_diagonal.isOpen_compl.mem_nhds ha') replace := (this.eq_empty_of_measure_zero h).le exact fun x hx => Classical.not_not.1 fun h => this ⟨hx, h⟩
0
import Mathlib.Topology.Category.TopCat.EpiMono import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Limits.ConcreteCategory import Mathlib.Data.Set.Subsingleton import Mathlib.Tactic.CategoryTheory.Elementwise #align_import topology.category.Top.limits.products 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] abbrev piπ {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : TopCat.of (∀ i, α i) ⟶ α i := ⟨fun f => f i, continuous_apply i⟩ #align Top.pi_π TopCat.piπ @[simps! pt π_app] def piFan {ι : Type v} (α : ι → TopCat.{max v u}) : Fan α := Fan.mk (TopCat.of (∀ i, α i)) (piπ.{v,u} α) #align Top.pi_fan TopCat.piFan def piFanIsLimit {ι : Type v} (α : ι → TopCat.{max v u}) : IsLimit (piFan α) where lift S := { toFun := fun s i => S.π.app ⟨i⟩ s continuous_toFun := continuous_pi (fun i => (S.π.app ⟨i⟩).2) } uniq := by intro S m h apply ContinuousMap.ext; intro x funext i set_option tactic.skipAssignedInstances false in dsimp rw [ContinuousMap.coe_mk, ← h ⟨i⟩] rfl fac s j := rfl #align Top.pi_fan_is_limit TopCat.piFanIsLimit def piIsoPi {ι : Type v} (α : ι → TopCat.{max v u}) : ∏ᶜ α ≅ TopCat.of (∀ i, α i) := (limit.isLimit _).conePointUniqueUpToIso (piFanIsLimit.{v, u} α) -- Specifying the universes in `piFanIsLimit` wasn't necessary when we had `TopCatMax`  #align Top.pi_iso_pi TopCat.piIsoPi @[reassoc (attr := simp)] theorem piIsoPi_inv_π {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : (piIsoPi α).inv ≫ Pi.π α i = piπ α i := by simp [piIsoPi] #align Top.pi_iso_pi_inv_π TopCat.piIsoPi_inv_π theorem piIsoPi_inv_π_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : ∀ i, α i) : (Pi.π α i : _) ((piIsoPi α).inv x) = x i := ConcreteCategory.congr_hom (piIsoPi_inv_π α i) x #align Top.pi_iso_pi_inv_π_apply TopCat.piIsoPi_inv_π_apply -- Porting note: needing the type ascription on `∏ᶜ α : TopCat.{max v u}` is unfortunate. theorem piIsoPi_hom_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : (∏ᶜ α : TopCat.{max v u})) : (piIsoPi α).hom x i = (Pi.π α i : _) x := by have := piIsoPi_inv_π α i rw [Iso.inv_comp_eq] at this exact ConcreteCategory.congr_hom this x #align Top.pi_iso_pi_hom_apply TopCat.piIsoPi_hom_apply -- Porting note: Lean doesn't automatically reduce TopCat.of X|>.α to X now abbrev sigmaι {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : α i ⟶ TopCat.of (Σi, α i) := by refine ContinuousMap.mk ?_ ?_ · dsimp apply Sigma.mk i · dsimp; continuity #align Top.sigma_ι TopCat.sigmaι @[simps! pt ι_app] def sigmaCofan {ι : Type v} (α : ι → TopCat.{max v u}) : Cofan α := Cofan.mk (TopCat.of (Σi, α i)) (sigmaι α) #align Top.sigma_cofan TopCat.sigmaCofan def sigmaCofanIsColimit {ι : Type v} (β : ι → TopCat.{max v u}) : IsColimit (sigmaCofan β) where desc S := { toFun := fun (s : of (Σ i, β i)) => S.ι.app ⟨s.1⟩ s.2 continuous_toFun := continuous_sigma fun i => (S.ι.app ⟨i⟩).continuous_toFun } uniq := by intro S m h ext ⟨i, x⟩ simp only [hom_apply, ← h] congr fac s j := by cases j aesop_cat #align Top.sigma_cofan_is_colimit TopCat.sigmaCofanIsColimit def sigmaIsoSigma {ι : Type v} (α : ι → TopCat.{max v u}) : ∐ α ≅ TopCat.of (Σi, α i) := (colimit.isColimit _).coconePointUniqueUpToIso (sigmaCofanIsColimit.{v, u} α) -- Specifying the universes in `sigmaCofanIsColimit` wasn't necessary when we had `TopCatMax`  #align Top.sigma_iso_sigma TopCat.sigmaIsoSigma @[reassoc (attr := simp)] theorem sigmaIsoSigma_hom_ι {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : Sigma.ι α i ≫ (sigmaIsoSigma α).hom = sigmaι α i := by simp [sigmaIsoSigma] #align Top.sigma_iso_sigma_hom_ι TopCat.sigmaIsoSigma_hom_ι theorem sigmaIsoSigma_hom_ι_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : α i) : (sigmaIsoSigma α).hom ((Sigma.ι α i : _) x) = Sigma.mk i x := ConcreteCategory.congr_hom (sigmaIsoSigma_hom_ι α i) x #align Top.sigma_iso_sigma_hom_ι_apply TopCat.sigmaIsoSigma_hom_ι_apply
Mathlib/Topology/Category/TopCat/Limits/Products.lean
136
139
theorem sigmaIsoSigma_inv_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : α i) : (sigmaIsoSigma α).inv ⟨i, x⟩ = (Sigma.ι α i : _) x := by
rw [← sigmaIsoSigma_hom_ι_apply, ← comp_app, ← comp_app, Iso.hom_inv_id, Category.comp_id]
0
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Topology.Instances.NNReal #align_import analysis.normed.group.infinite_sum from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" open Topology NNReal open Finset Filter Metric variable {ι α E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] theorem cauchySeq_finset_iff_vanishing_norm {f : ι → E} : (CauchySeq fun s : Finset ι => ∑ i ∈ s, f i) ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by rw [cauchySeq_finset_iff_sum_vanishing, nhds_basis_ball.forall_iff] · simp only [ball_zero_eq, Set.mem_setOf_eq] · rintro s t hst ⟨s', hs'⟩ exact ⟨s', fun t' ht' => hst <| hs' _ ht'⟩ #align cauchy_seq_finset_iff_vanishing_norm cauchySeq_finset_iff_vanishing_norm theorem summable_iff_vanishing_norm [CompleteSpace E] {f : ι → E} : Summable f ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_vanishing_norm] #align summable_iff_vanishing_norm summable_iff_vanishing_norm
Mathlib/Analysis/Normed/Group/InfiniteSum.lean
54
68
theorem cauchySeq_finset_of_norm_bounded_eventually {f : ι → E} {g : ι → ℝ} (hg : Summable g) (h : ∀ᶠ i in cofinite, ‖f i‖ ≤ g i) : CauchySeq fun s => ∑ i ∈ s, f i := by
refine cauchySeq_finset_iff_vanishing_norm.2 fun ε hε => ?_ rcases summable_iff_vanishing_norm.1 hg ε hε with ⟨s, hs⟩ classical refine ⟨s ∪ h.toFinset, fun t ht => ?_⟩ have : ∀ i ∈ t, ‖f i‖ ≤ g i := by intro i hi simp only [disjoint_left, mem_union, not_or, h.mem_toFinset, Set.mem_compl_iff, Classical.not_not] at ht exact (ht hi).2 calc ‖∑ i ∈ t, f i‖ ≤ ∑ i ∈ t, g i := norm_sum_le_of_le _ this _ ≤ ‖∑ i ∈ t, g i‖ := le_abs_self _ _ < ε := hs _ (ht.mono_right le_sup_left)
0
import Mathlib.Data.Finset.Order import Mathlib.Algebra.DirectSum.Module import Mathlib.RingTheory.FreeCommRing import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.SuppressCompilation #align_import algebra.direct_limit from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" suppress_compilation universe u v v' v'' w u₁ open Submodule variable {R : Type u} [Ring R] variable {ι : Type v} variable [Preorder ι] variable (G : ι → Type w) class DirectedSystem (f : ∀ i j, i ≤ j → G i → G j) : Prop where map_self' : ∀ i x h, f i i h x = x map_map' : ∀ {i j k} (hij hjk x), f j k hjk (f i j hij x) = f i k (le_trans hij hjk) x #align directed_system DirectedSystem section variable {G} (f : ∀ i j, i ≤ j → G i → G j) [DirectedSystem G fun i j h => f i j h] theorem DirectedSystem.map_self i x h : f i i h x = x := DirectedSystem.map_self' i x h theorem DirectedSystem.map_map {i j k} (hij hjk x) : f j k hjk (f i j hij x) = f i k (le_trans hij hjk) x := DirectedSystem.map_map' hij hjk x end namespace Module variable [∀ i, AddCommGroup (G i)] [∀ i, Module R (G i)] variable {G} (f : ∀ i j, i ≤ j → G i →ₗ[R] G j) nonrec theorem DirectedSystem.map_self [DirectedSystem G fun i j h => f i j h] (i x h) : f i i h x = x := DirectedSystem.map_self (fun i j h => f i j h) i x h #align module.directed_system.map_self Module.DirectedSystem.map_self nonrec theorem DirectedSystem.map_map [DirectedSystem G fun i j h => f i j h] {i j k} (hij hjk x) : f j k hjk (f i j hij x) = f i k (le_trans hij hjk) x := DirectedSystem.map_map (fun i j h => f i j h) hij hjk x #align module.directed_system.map_map Module.DirectedSystem.map_map variable (G) variable [DecidableEq ι] def DirectLimit : Type max v w := DirectSum ι G ⧸ (span R <| { a | ∃ (i j : _) (H : i ≤ j) (x : _), DirectSum.lof R ι G i x - DirectSum.lof R ι G j (f i j H x) = a }) #align module.direct_limit Module.DirectLimit namespace DirectLimit instance addCommGroup : AddCommGroup (DirectLimit G f) := Quotient.addCommGroup _ instance module : Module R (DirectLimit G f) := Quotient.module _ instance inhabited : Inhabited (DirectLimit G f) := ⟨0⟩ instance unique [IsEmpty ι] : Unique (DirectLimit G f) := inferInstanceAs <| Unique (Quotient _) variable (R ι) def of (i) : G i →ₗ[R] DirectLimit G f := (mkQ _).comp <| DirectSum.lof R ι G i #align module.direct_limit.of Module.DirectLimit.of variable {R ι G f} @[simp] theorem of_f {i j hij x} : of R ι G f j (f i j hij x) = of R ι G f i x := Eq.symm <| (Submodule.Quotient.eq _).2 <| subset_span ⟨i, j, hij, x, rfl⟩ #align module.direct_limit.of_f Module.DirectLimit.of_f theorem exists_of [Nonempty ι] [IsDirected ι (· ≤ ·)] (z : DirectLimit G f) : ∃ i x, of R ι G f i x = z := Nonempty.elim (by infer_instance) fun ind : ι => Quotient.inductionOn' z fun z => DirectSum.induction_on z ⟨ind, 0, LinearMap.map_zero _⟩ (fun i x => ⟨i, x, rfl⟩) fun p q ⟨i, x, ihx⟩ ⟨j, y, ihy⟩ => let ⟨k, hik, hjk⟩ := exists_ge_ge i j ⟨k, f i k hik x + f j k hjk y, by rw [LinearMap.map_add, of_f, of_f, ihx, ihy] rfl ⟩ #align module.direct_limit.exists_of Module.DirectLimit.exists_of @[elab_as_elim] protected theorem induction_on [Nonempty ι] [IsDirected ι (· ≤ ·)] {C : DirectLimit G f → Prop} (z : DirectLimit G f) (ih : ∀ i x, C (of R ι G f i x)) : C z := let ⟨i, x, h⟩ := exists_of z h ▸ ih i x #align module.direct_limit.induction_on Module.DirectLimit.induction_on variable {P : Type u₁} [AddCommGroup P] [Module R P] (g : ∀ i, G i →ₗ[R] P) variable (Hg : ∀ i j hij x, g j (f i j hij x) = g i x) variable (R ι G f) def lift : DirectLimit G f →ₗ[R] P := liftQ _ (DirectSum.toModule R ι P g) (span_le.2 fun a ⟨i, j, hij, x, hx⟩ => by rw [← hx, SetLike.mem_coe, LinearMap.sub_mem_ker_iff, DirectSum.toModule_lof, DirectSum.toModule_lof, Hg]) #align module.direct_limit.lift Module.DirectLimit.lift variable {R ι G f} theorem lift_of {i} (x) : lift R ι G f g Hg (of R ι G f i x) = g i x := DirectSum.toModule_lof R _ _ #align module.direct_limit.lift_of Module.DirectLimit.lift_of
Mathlib/Algebra/DirectLimit.lean
164
170
theorem lift_unique [IsDirected ι (· ≤ ·)] (F : DirectLimit G f →ₗ[R] P) (x) : F x = lift R ι G f (fun i => F.comp <| of R ι G f i) (fun i j hij x => by rw [LinearMap.comp_apply, of_f]; rfl) x := by
cases isEmpty_or_nonempty ι · simp_rw [Subsingleton.elim x 0, _root_.map_zero] · exact DirectLimit.induction_on x fun i x => by rw [lift_of]; rfl
0
import Mathlib.Algebra.CharP.Invertible import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.Topology.Instances.RealVectorSpace #align_import analysis.normed_space.add_torsor from "leanprover-community/mathlib"@"837f72de63ad6cd96519cde5f1ffd5ed8d280ad0" noncomputable section open NNReal Topology open Filter variable {α V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P] [NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q] section NormedSpace variable {𝕜 : Type*} [NormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W] open AffineMap theorem AffineSubspace.isClosed_direction_iff (s : AffineSubspace 𝕜 Q) : IsClosed (s.direction : Set W) ↔ IsClosed (s : Set Q) := by rcases s.eq_bot_or_nonempty with (rfl | ⟨x, hx⟩); · simp [isClosed_singleton] rw [← (IsometryEquiv.vaddConst x).toHomeomorph.symm.isClosed_image, AffineSubspace.coe_direction_eq_vsub_set_right hx] rfl #align affine_subspace.is_closed_direction_iff AffineSubspace.isClosed_direction_iff @[simp] theorem dist_center_homothety (p₁ p₂ : P) (c : 𝕜) : dist p₁ (homothety p₁ c p₂) = ‖c‖ * dist p₁ p₂ := by simp [homothety_def, norm_smul, ← dist_eq_norm_vsub, dist_comm] #align dist_center_homothety dist_center_homothety @[simp] theorem nndist_center_homothety (p₁ p₂ : P) (c : 𝕜) : nndist p₁ (homothety p₁ c p₂) = ‖c‖₊ * nndist p₁ p₂ := NNReal.eq <| dist_center_homothety _ _ _ #align nndist_center_homothety nndist_center_homothety @[simp] theorem dist_homothety_center (p₁ p₂ : P) (c : 𝕜) : dist (homothety p₁ c p₂) p₁ = ‖c‖ * dist p₁ p₂ := by rw [dist_comm, dist_center_homothety] #align dist_homothety_center dist_homothety_center @[simp] theorem nndist_homothety_center (p₁ p₂ : P) (c : 𝕜) : nndist (homothety p₁ c p₂) p₁ = ‖c‖₊ * nndist p₁ p₂ := NNReal.eq <| dist_homothety_center _ _ _ #align nndist_homothety_center nndist_homothety_center @[simp]
Mathlib/Analysis/NormedSpace/AddTorsor.lean
68
72
theorem dist_lineMap_lineMap (p₁ p₂ : P) (c₁ c₂ : 𝕜) : dist (lineMap p₁ p₂ c₁) (lineMap p₁ p₂ c₂) = dist c₁ c₂ * dist p₁ p₂ := by
rw [dist_comm p₁ p₂] simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right, ← sub_smul, norm_smul, vsub_eq_sub]
0
import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.Complex.Circle import Mathlib.Analysis.InnerProductSpace.l2Space import Mathlib.MeasureTheory.Function.ContinuousMapDense import Mathlib.MeasureTheory.Function.L2Space import Mathlib.MeasureTheory.Group.Integral import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Topology.ContinuousFunction.StoneWeierstrass import Mathlib.MeasureTheory.Integral.FundThmCalculus #align_import analysis.fourier.add_circle from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section open scoped ENNReal ComplexConjugate Real open TopologicalSpace ContinuousMap MeasureTheory MeasureTheory.Measure Algebra Submodule Set variable {T : ℝ} open AddCircle section Monomials def fourier (n : ℤ) : C(AddCircle T, ℂ) where toFun x := toCircle (n • x :) continuous_toFun := continuous_induced_dom.comp <| continuous_toCircle.comp <| continuous_zsmul _ #align fourier fourier @[simp] theorem fourier_apply {n : ℤ} {x : AddCircle T} : fourier n x = toCircle (n • x :) := rfl #align fourier_apply fourier_apply -- @[simp] -- Porting note: simp normal form is `fourier_coe_apply'` theorem fourier_coe_apply {n : ℤ} {x : ℝ} : fourier n (x : AddCircle T) = Complex.exp (2 * π * Complex.I * n * x / T) := by rw [fourier_apply, ← QuotientAddGroup.mk_zsmul, toCircle, Function.Periodic.lift_coe, expMapCircle_apply, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_mul, zsmul_eq_mul, Complex.ofReal_mul, Complex.ofReal_intCast] norm_num congr 1; ring #align fourier_coe_apply fourier_coe_apply @[simp] theorem fourier_coe_apply' {n : ℤ} {x : ℝ} : toCircle (n • (x : AddCircle T) :) = Complex.exp (2 * π * Complex.I * n * x / T) := by rw [← fourier_apply]; exact fourier_coe_apply -- @[simp] -- Porting note: simp normal form is `fourier_zero'` theorem fourier_zero {x : AddCircle T} : fourier 0 x = 1 := by induction x using QuotientAddGroup.induction_on' simp only [fourier_coe_apply] norm_num #align fourier_zero fourier_zero @[simp] theorem fourier_zero' {x : AddCircle T} : @toCircle T 0 = (1 : ℂ) := by have : fourier 0 x = @toCircle T 0 := by rw [fourier_apply, zero_smul] rw [← this]; exact fourier_zero -- @[simp] -- Porting note: simp normal form is *also* `fourier_zero'` theorem fourier_eval_zero (n : ℤ) : fourier n (0 : AddCircle T) = 1 := by rw [← QuotientAddGroup.mk_zero, fourier_coe_apply, Complex.ofReal_zero, mul_zero, zero_div, Complex.exp_zero] #align fourier_eval_zero fourier_eval_zero -- @[simp] -- Porting note (#10618): simp can prove this theorem fourier_one {x : AddCircle T} : fourier 1 x = toCircle x := by rw [fourier_apply, one_zsmul] #align fourier_one fourier_one -- @[simp] -- Porting note: simp normal form is `fourier_neg'` theorem fourier_neg {n : ℤ} {x : AddCircle T} : fourier (-n) x = conj (fourier n x) := by induction x using QuotientAddGroup.induction_on' simp_rw [fourier_apply, toCircle] rw [← QuotientAddGroup.mk_zsmul, ← QuotientAddGroup.mk_zsmul] simp_rw [Function.Periodic.lift_coe, ← coe_inv_circle_eq_conj, ← expMapCircle_neg, neg_smul, mul_neg] #align fourier_neg fourier_neg @[simp]
Mathlib/Analysis/Fourier/AddCircle.lean
163
164
theorem fourier_neg' {n : ℤ} {x : AddCircle T} : @toCircle T (-(n • x)) = conj (fourier n x) := by
rw [← neg_smul, ← fourier_apply]; exact fourier_neg
0
import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.Calculus.Deriv.Inv #align_import analysis.calculus.dslope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped Classical Topology Filter open Function Set Filter variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] noncomputable def dslope (f : 𝕜 → E) (a : 𝕜) : 𝕜 → E := update (slope f a) a (deriv f a) #align dslope dslope @[simp] theorem dslope_same (f : 𝕜 → E) (a : 𝕜) : dslope f a a = deriv f a := update_same _ _ _ #align dslope_same dslope_same variable {f : 𝕜 → E} {a b : 𝕜} {s : Set 𝕜} theorem dslope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a b = slope f a b := update_noteq h _ _ #align dslope_of_ne dslope_of_ne theorem ContinuousLinearMap.dslope_comp {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E →L[𝕜] F) (g : 𝕜 → E) (a b : 𝕜) (H : a = b → DifferentiableAt 𝕜 g a) : dslope (f ∘ g) a b = f (dslope g a b) := by rcases eq_or_ne b a with (rfl | hne) · simp only [dslope_same] exact (f.hasFDerivAt.comp_hasDerivAt b (H rfl).hasDerivAt).deriv · simpa only [dslope_of_ne _ hne] using f.toLinearMap.slope_comp g a b #align continuous_linear_map.dslope_comp ContinuousLinearMap.dslope_comp theorem eqOn_dslope_slope (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope f a) (slope f a) {a}ᶜ := fun _ => dslope_of_ne f #align eq_on_dslope_slope eqOn_dslope_slope theorem dslope_eventuallyEq_slope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a =ᶠ[𝓝 b] slope f a := (eqOn_dslope_slope f a).eventuallyEq_of_mem (isOpen_ne.mem_nhds h) #align dslope_eventually_eq_slope_of_ne dslope_eventuallyEq_slope_of_ne theorem dslope_eventuallyEq_slope_punctured_nhds (f : 𝕜 → E) : dslope f a =ᶠ[𝓝[≠] a] slope f a := (eqOn_dslope_slope f a).eventuallyEq_of_mem self_mem_nhdsWithin #align dslope_eventually_eq_slope_punctured_nhds dslope_eventuallyEq_slope_punctured_nhds @[simp] theorem sub_smul_dslope (f : 𝕜 → E) (a b : 𝕜) : (b - a) • dslope f a b = f b - f a := by rcases eq_or_ne b a with (rfl | hne) <;> simp [dslope_of_ne, *] #align sub_smul_dslope sub_smul_dslope theorem dslope_sub_smul_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope (fun x => (x - a) • f x) a b = f b := by rw [dslope_of_ne _ h, slope_sub_smul _ h.symm] #align dslope_sub_smul_of_ne dslope_sub_smul_of_ne theorem eqOn_dslope_sub_smul (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope (fun x => (x - a) • f x) a) f {a}ᶜ := fun _ => dslope_sub_smul_of_ne f #align eq_on_dslope_sub_smul eqOn_dslope_sub_smul theorem dslope_sub_smul [DecidableEq 𝕜] (f : 𝕜 → E) (a : 𝕜) : dslope (fun x => (x - a) • f x) a = update f a (deriv (fun x => (x - a) • f x) a) := eq_update_iff.2 ⟨dslope_same _ _, eqOn_dslope_sub_smul f a⟩ #align dslope_sub_smul dslope_sub_smul @[simp] theorem continuousAt_dslope_same : ContinuousAt (dslope f a) a ↔ DifferentiableAt 𝕜 f a := by simp only [dslope, continuousAt_update_same, ← hasDerivAt_deriv_iff, hasDerivAt_iff_tendsto_slope] #align continuous_at_dslope_same continuousAt_dslope_same theorem ContinuousWithinAt.of_dslope (h : ContinuousWithinAt (dslope f a) s b) : ContinuousWithinAt f s b := by have : ContinuousWithinAt (fun x => (x - a) • dslope f a x + f a) s b := ((continuousWithinAt_id.sub continuousWithinAt_const).smul h).add continuousWithinAt_const simpa only [sub_smul_dslope, sub_add_cancel] using this #align continuous_within_at.of_dslope ContinuousWithinAt.of_dslope theorem ContinuousAt.of_dslope (h : ContinuousAt (dslope f a) b) : ContinuousAt f b := (continuousWithinAt_univ _ _).1 h.continuousWithinAt.of_dslope #align continuous_at.of_dslope ContinuousAt.of_dslope theorem ContinuousOn.of_dslope (h : ContinuousOn (dslope f a) s) : ContinuousOn f s := fun x hx => (h x hx).of_dslope #align continuous_on.of_dslope ContinuousOn.of_dslope theorem continuousWithinAt_dslope_of_ne (h : b ≠ a) : ContinuousWithinAt (dslope f a) s b ↔ ContinuousWithinAt f s b := by refine ⟨ContinuousWithinAt.of_dslope, fun hc => ?_⟩ simp only [dslope, continuousWithinAt_update_of_ne h] exact ((continuousWithinAt_id.sub continuousWithinAt_const).inv₀ (sub_ne_zero.2 h)).smul (hc.sub continuousWithinAt_const) #align continuous_within_at_dslope_of_ne continuousWithinAt_dslope_of_ne theorem continuousAt_dslope_of_ne (h : b ≠ a) : ContinuousAt (dslope f a) b ↔ ContinuousAt f b := by simp only [← continuousWithinAt_univ, continuousWithinAt_dslope_of_ne h] #align continuous_at_dslope_of_ne continuousAt_dslope_of_ne
Mathlib/Analysis/Calculus/Dslope.lean
118
124
theorem continuousOn_dslope (h : s ∈ 𝓝 a) : ContinuousOn (dslope f a) s ↔ ContinuousOn f s ∧ DifferentiableAt 𝕜 f a := by
refine ⟨fun hc => ⟨hc.of_dslope, continuousAt_dslope_same.1 <| hc.continuousAt h⟩, ?_⟩ rintro ⟨hc, hd⟩ x hx rcases eq_or_ne x a with (rfl | hne) exacts [(continuousAt_dslope_same.2 hd).continuousWithinAt, (continuousWithinAt_dslope_of_ne hne).2 (hc x hx)]
0
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Inductions import Mathlib.Algebra.Polynomial.Splits import Mathlib.Analysis.Normed.Field.Basic import Mathlib.RingTheory.Polynomial.Vieta #align_import topology.algebra.polynomial from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" open IsAbsoluteValue Filter namespace Polynomial open Polynomial
Mathlib/Topology/Algebra/Polynomial.lean
105
120
theorem tendsto_abv_eval₂_atTop {R S k α : Type*} [Semiring R] [Ring S] [LinearOrderedField k] (f : R →+* S) (abv : S → k) [IsAbsoluteValue abv] (p : R[X]) (hd : 0 < degree p) (hf : f p.leadingCoeff ≠ 0) {l : Filter α} {z : α → S} (hz : Tendsto (abv ∘ z) l atTop) : Tendsto (fun x => abv (p.eval₂ f (z x))) l atTop := by
revert hf; refine degree_pos_induction_on p hd ?_ ?_ ?_ <;> clear hd p · rintro _ - hc rw [leadingCoeff_mul_X, leadingCoeff_C] at hc simpa [abv_mul abv] using hz.const_mul_atTop ((abv_pos abv).2 hc) · intro _ _ ihp hf rw [leadingCoeff_mul_X] at hf simpa [abv_mul abv] using (ihp hf).atTop_mul_atTop hz · intro _ a hd ihp hf rw [add_comm, leadingCoeff_add_of_degree_lt (degree_C_le.trans_lt hd)] at hf refine tendsto_atTop_of_add_const_right (abv (-f a)) ?_ refine tendsto_atTop_mono (fun _ => abv_add abv _ _) ?_ simpa using ihp hf
0
import Mathlib.CategoryTheory.Monoidal.Free.Coherence import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.NaturalTransformation import Mathlib.CategoryTheory.Monoidal.Opposite import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.CommSq #align_import category_theory.monoidal.braided from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" open CategoryTheory MonoidalCategory universe v v₁ v₂ v₃ u u₁ u₂ u₃ namespace CategoryTheory class BraidedCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where braiding : ∀ X Y : C, X ⊗ Y ≅ Y ⊗ X braiding_naturality_right : ∀ (X : C) {Y Z : C} (f : Y ⟶ Z), X ◁ f ≫ (braiding X Z).hom = (braiding X Y).hom ≫ f ▷ X := by aesop_cat braiding_naturality_left : ∀ {X Y : C} (f : X ⟶ Y) (Z : C), f ▷ Z ≫ (braiding Y Z).hom = (braiding X Z).hom ≫ Z ◁ f := by aesop_cat hexagon_forward : ∀ X Y Z : C, (α_ X Y Z).hom ≫ (braiding X (Y ⊗ Z)).hom ≫ (α_ Y Z X).hom = ((braiding X Y).hom ▷ Z) ≫ (α_ Y X Z).hom ≫ (Y ◁ (braiding X Z).hom) := by aesop_cat hexagon_reverse : ∀ X Y Z : C, (α_ X Y Z).inv ≫ (braiding (X ⊗ Y) Z).hom ≫ (α_ Z X Y).inv = (X ◁ (braiding Y Z).hom) ≫ (α_ X Z Y).inv ≫ ((braiding X Z).hom ▷ Y) := by aesop_cat #align category_theory.braided_category CategoryTheory.BraidedCategory attribute [reassoc (attr := simp)] BraidedCategory.braiding_naturality_left BraidedCategory.braiding_naturality_right attribute [reassoc] BraidedCategory.hexagon_forward BraidedCategory.hexagon_reverse open Category open MonoidalCategory open BraidedCategory @[inherit_doc] notation "β_" => BraidedCategory.braiding namespace BraidedCategory variable {C : Type u} [Category.{v} C] [MonoidalCategory.{v} C] [BraidedCategory.{v} C] @[simp, reassoc] theorem braiding_tensor_left (X Y Z : C) : (β_ (X ⊗ Y) Z).hom = (α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom := by apply (cancel_epi (α_ X Y Z).inv).1 apply (cancel_mono (α_ Z X Y).inv).1 simp [hexagon_reverse] @[simp, reassoc] theorem braiding_tensor_right (X Y Z : C) : (β_ X (Y ⊗ Z)).hom = (α_ X Y Z).inv ≫ (β_ X Y).hom ▷ Z ≫ (α_ Y X Z).hom ≫ Y ◁ (β_ X Z).hom ≫ (α_ Y Z X).inv := by apply (cancel_epi (α_ X Y Z).hom).1 apply (cancel_mono (α_ Y Z X).hom).1 simp [hexagon_forward] @[simp, reassoc] theorem braiding_inv_tensor_left (X Y Z : C) : (β_ (X ⊗ Y) Z).inv = (α_ Z X Y).inv ≫ (β_ X Z).inv ▷ Y ≫ (α_ X Z Y).hom ≫ X ◁ (β_ Y Z).inv ≫ (α_ X Y Z).inv := eq_of_inv_eq_inv (by simp) @[simp, reassoc] theorem braiding_inv_tensor_right (X Y Z : C) : (β_ X (Y ⊗ Z)).inv = (α_ Y Z X).hom ≫ Y ◁ (β_ X Z).inv ≫ (α_ Y X Z).inv ≫ (β_ X Y).inv ▷ Z ≫ (α_ X Y Z).hom := eq_of_inv_eq_inv (by simp) @[reassoc (attr := simp)] theorem braiding_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') : (f ⊗ g) ≫ (braiding Y Y').hom = (braiding X X').hom ≫ (g ⊗ f) := by rw [tensorHom_def' f g, tensorHom_def g f] simp_rw [Category.assoc, braiding_naturality_left, braiding_naturality_right_assoc] @[reassoc (attr := simp)] theorem braiding_inv_naturality_right (X : C) {Y Z : C} (f : Y ⟶ Z) : X ◁ f ≫ (β_ Z X).inv = (β_ Y X).inv ≫ f ▷ X := CommSq.w <| .vert_inv <| .mk <| braiding_naturality_left f X @[reassoc (attr := simp)] theorem braiding_inv_naturality_left {X Y : C} (f : X ⟶ Y) (Z : C) : f ▷ Z ≫ (β_ Z Y).inv = (β_ Z X).inv ≫ Z ◁ f := CommSq.w <| .vert_inv <| .mk <| braiding_naturality_right Z f @[reassoc (attr := simp)] theorem braiding_inv_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') : (f ⊗ g) ≫ (β_ Y' Y).inv = (β_ X' X).inv ≫ (g ⊗ f) := CommSq.w <| .vert_inv <| .mk <| braiding_naturality g f @[reassoc]
Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean
146
153
theorem yang_baxter (X Y Z : C) : (α_ X Y Z).inv ≫ (β_ X Y).hom ▷ Z ≫ (α_ Y X Z).hom ≫ Y ◁ (β_ X Z).hom ≫ (α_ Y Z X).inv ≫ (β_ Y Z).hom ▷ X ≫ (α_ Z Y X).hom = X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom ≫ Z ◁ (β_ X Y).hom := by
rw [← braiding_tensor_right_assoc X Y Z, ← cancel_mono (α_ Z Y X).inv] repeat rw [assoc] rw [Iso.hom_inv_id, comp_id, ← braiding_naturality_right, braiding_tensor_right]
0
import Mathlib.Algebra.Module.Torsion import Mathlib.RingTheory.DedekindDomain.Ideal #align_import algebra.module.dedekind_domain from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8" universe u v variable {R : Type u} [CommRing R] [IsDomain R] {M : Type v} [AddCommGroup M] [Module R M] open scoped DirectSum namespace Submodule variable [IsDedekindDomain R] open UniqueFactorizationMonoid open scoped Classical
Mathlib/Algebra/Module/DedekindDomain.lean
37
59
theorem isInternal_prime_power_torsion_of_is_torsion_by_ideal {I : Ideal R} (hI : I ≠ ⊥) (hM : Module.IsTorsionBySet R M I) : DirectSum.IsInternal fun p : (factors I).toFinset => torsionBySet R M (p ^ (factors I).count ↑p : Ideal R) := by
let P := factors I have prime_of_mem := fun p (hp : p ∈ P.toFinset) => prime_of_factor p (Multiset.mem_toFinset.mp hp) apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _ · convert hM rw [← Finset.inf_eq_iInf, IsDedekindDomain.inf_prime_pow_eq_prod, ← Finset.prod_multiset_count, ← associated_iff_eq] · exact factors_prod hI · exact prime_of_mem · exact fun _ _ _ _ ij => ij · intro p hp q hq pq; dsimp rw [irreducible_pow_sup] · suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top] rw [Multiset.count_eq_zero, normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible, Multiset.mem_replicate] exact fun H => pq <| H.2.trans <| normalize_eq q · rw [← Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero · exact (prime_of_mem p hp).irreducible
0
import Mathlib.Algebra.IsPrimePow import Mathlib.NumberTheory.ArithmeticFunction import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import number_theory.von_mangoldt from "leanprover-community/mathlib"@"c946d6097a6925ad16d7ec55677bbc977f9846de" namespace ArithmeticFunction open Finset Nat open scoped ArithmeticFunction noncomputable def log : ArithmeticFunction ℝ := ⟨fun n => Real.log n, by simp⟩ #align nat.arithmetic_function.log ArithmeticFunction.log @[simp] theorem log_apply {n : ℕ} : log n = Real.log n := rfl #align nat.arithmetic_function.log_apply ArithmeticFunction.log_apply noncomputable def vonMangoldt : ArithmeticFunction ℝ := ⟨fun n => if IsPrimePow n then Real.log (minFac n) else 0, if_neg not_isPrimePow_zero⟩ #align nat.arithmetic_function.von_mangoldt ArithmeticFunction.vonMangoldt @[inherit_doc] scoped[ArithmeticFunction] notation "Λ" => ArithmeticFunction.vonMangoldt @[inherit_doc] scoped[ArithmeticFunction.vonMangoldt] notation "Λ" => ArithmeticFunction.vonMangoldt theorem vonMangoldt_apply {n : ℕ} : Λ n = if IsPrimePow n then Real.log (minFac n) else 0 := rfl #align nat.arithmetic_function.von_mangoldt_apply ArithmeticFunction.vonMangoldt_apply @[simp] theorem vonMangoldt_apply_one : Λ 1 = 0 := by simp [vonMangoldt_apply] #align nat.arithmetic_function.von_mangoldt_apply_one ArithmeticFunction.vonMangoldt_apply_one @[simp] theorem vonMangoldt_nonneg {n : ℕ} : 0 ≤ Λ n := by rw [vonMangoldt_apply] split_ifs · exact Real.log_nonneg (one_le_cast.2 (Nat.minFac_pos n)) rfl #align nat.arithmetic_function.von_mangoldt_nonneg ArithmeticFunction.vonMangoldt_nonneg theorem vonMangoldt_apply_pow {n k : ℕ} (hk : k ≠ 0) : Λ (n ^ k) = Λ n := by simp only [vonMangoldt_apply, isPrimePow_pow_iff hk, pow_minFac hk] #align nat.arithmetic_function.von_mangoldt_apply_pow ArithmeticFunction.vonMangoldt_apply_pow theorem vonMangoldt_apply_prime {p : ℕ} (hp : p.Prime) : Λ p = Real.log p := by rw [vonMangoldt_apply, Prime.minFac_eq hp, if_pos hp.prime.isPrimePow] #align nat.arithmetic_function.von_mangoldt_apply_prime ArithmeticFunction.vonMangoldt_apply_prime theorem vonMangoldt_ne_zero_iff {n : ℕ} : Λ n ≠ 0 ↔ IsPrimePow n := by rcases eq_or_ne n 1 with (rfl | hn); · simp [not_isPrimePow_one] exact (Real.log_pos (one_lt_cast.2 (minFac_prime hn).one_lt)).ne'.ite_ne_right_iff #align nat.arithmetic_function.von_mangoldt_ne_zero_iff ArithmeticFunction.vonMangoldt_ne_zero_iff theorem vonMangoldt_pos_iff {n : ℕ} : 0 < Λ n ↔ IsPrimePow n := vonMangoldt_nonneg.lt_iff_ne.trans (ne_comm.trans vonMangoldt_ne_zero_iff) #align nat.arithmetic_function.von_mangoldt_pos_iff ArithmeticFunction.vonMangoldt_pos_iff theorem vonMangoldt_eq_zero_iff {n : ℕ} : Λ n = 0 ↔ ¬IsPrimePow n := vonMangoldt_ne_zero_iff.not_right #align nat.arithmetic_function.von_mangoldt_eq_zero_iff ArithmeticFunction.vonMangoldt_eq_zero_iff theorem vonMangoldt_sum {n : ℕ} : ∑ i ∈ n.divisors, Λ i = Real.log n := by refine recOnPrimeCoprime ?_ ?_ ?_ n · simp · intro p k hp rw [sum_divisors_prime_pow hp, cast_pow, Real.log_pow, Finset.sum_range_succ', Nat.pow_zero, vonMangoldt_apply_one] simp [vonMangoldt_apply_pow (Nat.succ_ne_zero _), vonMangoldt_apply_prime hp] intro a b ha' hb' hab ha hb simp only [vonMangoldt_apply, ← sum_filter] at ha hb ⊢ rw [mul_divisors_filter_prime_pow hab, filter_union, sum_union (disjoint_divisors_filter_isPrimePow hab), ha, hb, Nat.cast_mul, Real.log_mul (cast_ne_zero.2 (pos_of_gt ha').ne') (cast_ne_zero.2 (pos_of_gt hb').ne')] #align nat.arithmetic_function.von_mangoldt_sum ArithmeticFunction.vonMangoldt_sum @[simp] theorem vonMangoldt_mul_zeta : Λ * ζ = log := by ext n; rw [coe_mul_zeta_apply, vonMangoldt_sum]; rfl #align nat.arithmetic_function.von_mangoldt_mul_zeta ArithmeticFunction.vonMangoldt_mul_zeta @[simp] theorem zeta_mul_vonMangoldt : (ζ : ArithmeticFunction ℝ) * Λ = log := by rw [mul_comm]; simp #align nat.arithmetic_function.zeta_mul_von_mangoldt ArithmeticFunction.zeta_mul_vonMangoldt @[simp]
Mathlib/NumberTheory/VonMangoldt.lean
135
136
theorem log_mul_moebius_eq_vonMangoldt : log * μ = Λ := by
rw [← vonMangoldt_mul_zeta, mul_assoc, coe_zeta_mul_coe_moebius, mul_one]
0
import Mathlib.Algebra.Field.ULift import Mathlib.Algebra.MvPolynomial.Cardinal import Mathlib.Data.Nat.Factorization.PrimePow import Mathlib.Data.Rat.Denumerable import Mathlib.FieldTheory.Finite.GaloisField import Mathlib.Logic.Equiv.TransferInstance import Mathlib.RingTheory.Localization.Cardinality import Mathlib.SetTheory.Cardinal.Divisibility #align_import field_theory.cardinality from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" local notation "‖" x "‖" => Fintype.card x open scoped Cardinal nonZeroDivisors universe u
Mathlib/FieldTheory/Cardinality.lean
40
49
theorem Fintype.isPrimePow_card_of_field {α} [Fintype α] [Field α] : IsPrimePow ‖α‖ := by
-- TODO: `Algebra` version of `CharP.exists`, of type `∀ p, Algebra (ZMod p) α` cases' CharP.exists α with p _ haveI hp := Fact.mk (CharP.char_is_prime α p) letI : Algebra (ZMod p) α := ZMod.algebra _ _ let b := IsNoetherian.finsetBasis (ZMod p) α rw [Module.card_fintype b, ZMod.card, isPrimePow_pow_iff] · exact hp.1.isPrimePow rw [← FiniteDimensional.finrank_eq_card_basis b] exact FiniteDimensional.finrank_pos.ne'
0
import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.FieldTheory.Finite.Basic import Mathlib.RingTheory.MvPolynomial.Basic #align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"5aa3c1de9f3c642eac76e11071c852766f220fd0" namespace MvPolynomial variable {σ : Type*} theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) : C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 := C_dvd_iff_map_hom_eq_zero _ _ (CharP.intCast_eq_zero_iff (ZMod n) n) _ set_option linter.uppercaseLean3 false in #align mv_polynomial.C_dvd_iff_zmod MvPolynomial.C_dvd_iff_zmod section frobenius variable {p : ℕ} [Fact p.Prime]
Mathlib/FieldTheory/Finite/Polynomial.lean
33
38
theorem frobenius_zmod (f : MvPolynomial σ (ZMod p)) : frobenius _ p f = expand p f := by
apply induction_on f · intro a; rw [expand_C, frobenius_def, ← C_pow, ZMod.pow_card] · simp only [AlgHom.map_add, RingHom.map_add]; intro _ _ hf hg; rw [hf, hg] · simp only [expand_X, RingHom.map_mul, AlgHom.map_mul] intro _ _ hf; rw [hf, frobenius_def]
0
import Mathlib.AlgebraicTopology.DoldKan.Homotopies import Mathlib.Tactic.Ring #align_import algebraic_topology.dold_kan.faces from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Limits CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.SimplicialObject Simplicial namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] variable {X : SimplicialObject C} def HigherFacesVanish {Y : C} {n : ℕ} (q : ℕ) (φ : Y ⟶ X _[n + 1]) : Prop := ∀ j : Fin (n + 1), n + 1 ≤ (j : ℕ) + q → φ ≫ X.δ j.succ = 0 #align algebraic_topology.dold_kan.higher_faces_vanish AlgebraicTopology.DoldKan.HigherFacesVanish namespace HigherFacesVanish @[reassoc]
Mathlib/AlgebraicTopology/DoldKan/Faces.lean
53
58
theorem comp_δ_eq_zero {Y : C} {n : ℕ} {q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (j : Fin (n + 2)) (hj₁ : j ≠ 0) (hj₂ : n + 2 ≤ (j : ℕ) + q) : φ ≫ X.δ j = 0 := by
obtain ⟨i, rfl⟩ := Fin.eq_succ_of_ne_zero hj₁ apply v i simp only [Fin.val_succ] at hj₂ omega
0
import Mathlib.FieldTheory.Finite.Polynomial import Mathlib.NumberTheory.Basic import Mathlib.RingTheory.WittVector.WittPolynomial #align_import ring_theory.witt_vector.structure_polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open MvPolynomial Set open Finset (range) open Finsupp (single) -- This lemma reduces a bundled morphism to a "mere" function, -- and consequently the simplifier cannot use a lot of powerful simp-lemmas. -- We disable this locally, and probably it should be disabled globally in mathlib. attribute [-simp] coe_eval₂Hom variable {p : ℕ} {R : Type*} {idx : Type*} [CommRing R] open scoped Witt section PPrime variable (p) [hp : Fact p.Prime] -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ noncomputable def wittStructureRat (Φ : MvPolynomial idx ℚ) (n : ℕ) : MvPolynomial (idx × ℕ) ℚ := bind₁ (fun k => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) (xInTermsOfW p ℚ n) #align witt_structure_rat wittStructureRat theorem wittStructureRat_prop (Φ : MvPolynomial idx ℚ) (n : ℕ) : bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := calc bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun k => bind₁ (fun i => (rename (Prod.mk i)) (W_ ℚ k)) Φ) (bind₁ (xInTermsOfW p ℚ) (W_ ℚ n)) := by rw [bind₁_bind₁]; exact eval₂Hom_congr (RingHom.ext_rat _ _) rfl rfl _ = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by rw [bind₁_xInTermsOfW_wittPolynomial p _ n, bind₁_X_right] #align witt_structure_rat_prop wittStructureRat_prop
Mathlib/RingTheory/WittVector/StructurePolynomial.lean
151
161
theorem wittStructureRat_existsUnique (Φ : MvPolynomial idx ℚ) : ∃! φ : ℕ → MvPolynomial (idx × ℕ) ℚ, ∀ n : ℕ, bind₁ φ (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by
refine ⟨wittStructureRat p Φ, ?_, ?_⟩ · intro n; apply wittStructureRat_prop · intro φ H funext n rw [show φ n = bind₁ φ (bind₁ (W_ ℚ) (xInTermsOfW p ℚ n)) by rw [bind₁_wittPolynomial_xInTermsOfW p, bind₁_X_right]] rw [bind₁_bind₁] exact eval₂Hom_congr (RingHom.ext_rat _ _) (funext H) rfl
0
import Mathlib.Topology.Order.LeftRight import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.left_right_lim from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" open Set Filter open Topology section variable {α β : Type*} [LinearOrder α] [TopologicalSpace β] noncomputable def Function.leftLim (f : α → β) (a : α) : β := by classical haveI : Nonempty β := ⟨f a⟩ letI : TopologicalSpace α := Preorder.topology α exact if 𝓝[<] a = ⊥ ∨ ¬∃ y, Tendsto f (𝓝[<] a) (𝓝 y) then f a else limUnder (𝓝[<] a) f #align function.left_lim Function.leftLim noncomputable def Function.rightLim (f : α → β) (a : α) : β := @Function.leftLim αᵒᵈ β _ _ f a #align function.right_lim Function.rightLim open Function theorem leftLim_eq_of_tendsto [hα : TopologicalSpace α] [h'α : OrderTopology α] [T2Space β] {f : α → β} {a : α} {y : β} (h : 𝓝[<] a ≠ ⊥) (h' : Tendsto f (𝓝[<] a) (𝓝 y)) : leftLim f a = y := by have h'' : ∃ y, Tendsto f (𝓝[<] a) (𝓝 y) := ⟨y, h'⟩ rw [h'α.topology_eq_generate_intervals] at h h' h'' simp only [leftLim, h, h'', not_true, or_self_iff, if_false] haveI := neBot_iff.2 h exact lim_eq h' #align left_lim_eq_of_tendsto leftLim_eq_of_tendsto theorem leftLim_eq_of_eq_bot [hα : TopologicalSpace α] [h'α : OrderTopology α] (f : α → β) {a : α} (h : 𝓝[<] a = ⊥) : leftLim f a = f a := by rw [h'α.topology_eq_generate_intervals] at h simp [leftLim, ite_eq_left_iff, h] #align left_lim_eq_of_eq_bot leftLim_eq_of_eq_bot theorem rightLim_eq_of_tendsto [TopologicalSpace α] [OrderTopology α] [T2Space β] {f : α → β} {a : α} {y : β} (h : 𝓝[>] a ≠ ⊥) (h' : Tendsto f (𝓝[>] a) (𝓝 y)) : Function.rightLim f a = y := @leftLim_eq_of_tendsto αᵒᵈ _ _ _ _ _ _ f a y h h' #align right_lim_eq_of_tendsto rightLim_eq_of_tendsto theorem rightLim_eq_of_eq_bot [TopologicalSpace α] [OrderTopology α] (f : α → β) {a : α} (h : 𝓝[>] a = ⊥) : rightLim f a = f a := @leftLim_eq_of_eq_bot αᵒᵈ _ _ _ _ _ f a h end open Function namespace Monotone variable {α β : Type*} [LinearOrder α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} (hf : Monotone f) {x y : α} theorem leftLim_eq_sSup [TopologicalSpace α] [OrderTopology α] (h : 𝓝[<] x ≠ ⊥) : leftLim f x = sSup (f '' Iio x) := leftLim_eq_of_tendsto h (hf.tendsto_nhdsWithin_Iio x) #align monotone.left_lim_eq_Sup Monotone.leftLim_eq_sSup theorem rightLim_eq_sInf [TopologicalSpace α] [OrderTopology α] (h : 𝓝[>] x ≠ ⊥) : rightLim f x = sInf (f '' Ioi x) := rightLim_eq_of_tendsto h (hf.tendsto_nhdsWithin_Ioi x) #align right_lim_eq_Inf Monotone.rightLim_eq_sInf theorem leftLim_le (h : x ≤ y) : leftLim f x ≤ f y := by letI : TopologicalSpace α := Preorder.topology α haveI : OrderTopology α := ⟨rfl⟩ rcases eq_or_ne (𝓝[<] x) ⊥ with (h' | h') · simpa [leftLim, h'] using hf h haveI A : NeBot (𝓝[<] x) := neBot_iff.2 h' rw [leftLim_eq_sSup hf h'] refine csSup_le ?_ ?_ · simp only [image_nonempty] exact (forall_mem_nonempty_iff_neBot.2 A) _ self_mem_nhdsWithin · simp only [mem_image, mem_Iio, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro z hz exact hf (hz.le.trans h) #align monotone.left_lim_le Monotone.leftLim_le
Mathlib/Topology/Order/LeftRightLim.lean
125
136
theorem le_leftLim (h : x < y) : f x ≤ leftLim f y := by
letI : TopologicalSpace α := Preorder.topology α haveI : OrderTopology α := ⟨rfl⟩ rcases eq_or_ne (𝓝[<] y) ⊥ with (h' | h') · rw [leftLim_eq_of_eq_bot _ h'] exact hf h.le rw [leftLim_eq_sSup hf h'] refine le_csSup ⟨f y, ?_⟩ (mem_image_of_mem _ h) simp only [upperBounds, mem_image, mem_Iio, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_setOf_eq] intro z hz exact hf hz.le
0
import Mathlib.MeasureTheory.Measure.Restrict open scoped ENNReal NNReal Topology open Set MeasureTheory Measure Filter Function MeasurableSpace ENNReal variable {α β δ ι : Type*} namespace MeasureTheory variable {m0 : MeasurableSpace α} [MeasurableSpace β] {μ ν ν₁ ν₂: Measure α} {s t : Set α}
Mathlib/MeasureTheory/Measure/Typeclasses.lean
491
498
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)] (hs_zero : μ s = 0) : (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by simp [(Set.mem_compl_iff _ _).mp hx] refine measure_mono_null ?_ hs_zero conv_rhs => rw [← compl_compl s] rwa [Set.compl_subset_compl]
0
import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Analysis.Matrix import Mathlib.Analysis.RCLike.Basic import Mathlib.LinearAlgebra.UnitaryGroup import Mathlib.Topology.UniformSpace.Matrix #align_import analysis.normed_space.star.matrix from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6" open scoped Matrix variable {𝕜 m n l E : Type*} section EntrywiseSupNorm variable [RCLike 𝕜] [Fintype n] [DecidableEq n] theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.unitaryGroup n 𝕜) (i j : n) : ‖U i j‖ ≤ 1 := by -- The norm squared of an entry is at most the L2 norm of its row. have norm_sum : ‖U i j‖ ^ 2 ≤ ∑ x, ‖U i x‖ ^ 2 := by apply Multiset.single_le_sum · intro x h_x rw [Multiset.mem_map] at h_x cases' h_x with a h_a rw [← h_a.2] apply sq_nonneg · rw [Multiset.mem_map] use j simp only [eq_self_iff_true, Finset.mem_univ_val, and_self_iff, sq_eq_sq] -- The L2 norm of a row is a diagonal entry of U * Uᴴ have diag_eq_norm_sum : (U * Uᴴ) i i = (∑ x : n, ‖U i x‖ ^ 2 : ℝ) := by simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, RCLike.mul_conj, RCLike.normSq_eq_def', RCLike.ofReal_pow]; norm_cast -- The L2 norm of a row is a diagonal entry of U * Uᴴ, real part have re_diag_eq_norm_sum : RCLike.re ((U * Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 := by rw [RCLike.ext_iff] at diag_eq_norm_sum rw [diag_eq_norm_sum.1] norm_cast -- Since U is unitary, the diagonal entries of U * Uᴴ are all 1 have mul_eq_one : U * Uᴴ = 1 := unitary.mul_star_self_of_mem hU have diag_eq_one : RCLike.re ((U * Uᴴ) i i) = 1 := by simp only [mul_eq_one, eq_self_iff_true, Matrix.one_apply_eq, RCLike.one_re] -- Putting it all together rw [← sq_le_one_iff (norm_nonneg (U i j)), ← diag_eq_one, re_diag_eq_norm_sum] exact norm_sum #align entry_norm_bound_of_unitary entry_norm_bound_of_unitary attribute [local instance] Matrix.normedAddCommGroup
Mathlib/Analysis/NormedSpace/Star/Matrix.lean
83
90
theorem entrywise_sup_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.unitaryGroup n 𝕜) : ‖U‖ ≤ 1 := by
conv => -- Porting note: was `simp_rw [pi_norm_le_iff_of_nonneg zero_le_one]` rw [pi_norm_le_iff_of_nonneg zero_le_one] intro rw [pi_norm_le_iff_of_nonneg zero_le_one] intros exact entry_norm_bound_of_unitary hU _ _
0
import Mathlib.FieldTheory.Finite.Basic import Mathlib.Order.Filter.Cofinite #align_import number_theory.fermat_psp from "leanprover-community/mathlib"@"c0439b4877c24a117bfdd9e32faf62eee9b115eb" namespace Nat def ProbablePrime (n b : ℕ) : Prop := n ∣ b ^ (n - 1) - 1 #align fermat_psp.probable_prime Nat.ProbablePrime def FermatPsp (n b : ℕ) : Prop := ProbablePrime n b ∧ ¬n.Prime ∧ 1 < n #align fermat_psp Nat.FermatPsp instance decidableProbablePrime (n b : ℕ) : Decidable (ProbablePrime n b) := Nat.decidable_dvd _ _ #align fermat_psp.decidable_probable_prime Nat.decidableProbablePrime instance decidablePsp (n b : ℕ) : Decidable (FermatPsp n b) := And.decidable #align fermat_psp.decidable_psp Nat.decidablePsp
Mathlib/NumberTheory/FermatPsp.lean
75
99
theorem coprime_of_probablePrime {n b : ℕ} (h : ProbablePrime n b) (h₁ : 1 ≤ n) (h₂ : 1 ≤ b) : Nat.Coprime n b := by
by_cases h₃ : 2 ≤ n · -- To prove that `n` is coprime with `b`, we need to show that for all prime factors of `n`, -- we can derive a contradiction if `n` divides `b`. apply Nat.coprime_of_dvd -- If `k` is a prime number that divides both `n` and `b`, then we know that `n = m * k` and -- `b = j * k` for some natural numbers `m` and `j`. We substitute these into the hypothesis. rintro k hk ⟨m, rfl⟩ ⟨j, rfl⟩ -- Because prime numbers do not divide 1, it suffices to show that `k ∣ 1` to prove a -- contradiction apply Nat.Prime.not_dvd_one hk -- Since `n` divides `b ^ (n - 1) - 1`, `k` also divides `b ^ (n - 1) - 1` replace h := dvd_of_mul_right_dvd h -- Because `k` divides `b ^ (n - 1) - 1`, if we can show that `k` also divides `b ^ (n - 1)`, -- then we know `k` divides 1. rw [Nat.dvd_add_iff_right h, Nat.sub_add_cancel (Nat.one_le_pow _ _ h₂)] -- Since `k` divides `b`, `k` also divides any power of `b` except `b ^ 0`. Therefore, it -- suffices to show that `n - 1` isn't zero. However, we know that `n - 1` isn't zero because we -- assumed `2 ≤ n` when doing `by_cases`. refine dvd_of_mul_right_dvd (dvd_pow_self (k * j) ?_) omega -- If `n = 1`, then it follows trivially that `n` is coprime with `b`. · rw [show n = 1 by omega] norm_num
0
import Mathlib.Data.Real.Basic import Mathlib.Combinatorics.Pigeonhole import Mathlib.Algebra.Order.EuclideanAbsoluteValue #align_import number_theory.class_number.admissible_absolute_value from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" local infixl:50 " ≺ " => EuclideanDomain.r namespace AbsoluteValue variable {R : Type*} [EuclideanDomain R] variable (abv : AbsoluteValue R ℤ) structure IsAdmissible extends IsEuclidean abv where protected card : ℝ → ℕ exists_partition' : ∀ (n : ℕ) {ε : ℝ} (_ : 0 < ε) {b : R} (_ : b ≠ 0) (A : Fin n → R), ∃ t : Fin n → Fin (card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε #align absolute_value.is_admissible AbsoluteValue.IsAdmissible -- Porting note: no docstrings for IsAdmissible attribute [nolint docBlame] IsAdmissible.card namespace IsAdmissible variable {abv} theorem exists_partition {ι : Type*} [Finite ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0) (A : ι → R) (h : abv.IsAdmissible) : ∃ t : ι → Fin (h.card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε := by rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩ obtain ⟨t, ht⟩ := h.exists_partition' n hε hb (A ∘ e.symm) refine ⟨t ∘ e, fun i₀ i₁ h ↦ ?_⟩ convert (config := {transparency := .default}) ht (e i₀) (e i₁) h <;> simp only [e.symm_apply_apply] #align absolute_value.is_admissible.exists_partition AbsoluteValue.IsAdmissible.exists_partition
Mathlib/NumberTheory/ClassNumber/AdmissibleAbsoluteValue.lean
73
112
theorem exists_approx_aux (n : ℕ) (h : abv.IsAdmissible) : ∀ {ε : ℝ} (_hε : 0 < ε) {b : R} (_hb : b ≠ 0) (A : Fin (h.card ε ^ n).succ → Fin n → R), ∃ i₀ i₁, i₀ ≠ i₁ ∧ ∀ k, (abv (A i₁ k % b - A i₀ k % b) : ℝ) < abv b • ε := by
haveI := Classical.decEq R induction' n with n ih · intro ε _hε b _hb A refine ⟨0, 1, ?_, ?_⟩ · simp rintro ⟨i, ⟨⟩⟩ intro ε hε b hb A let M := h.card ε -- By the "nicer" pigeonhole principle, we can find a collection `s` -- of more than `M^n` remainders where the first components lie close together: obtain ⟨s, s_inj, hs⟩ : ∃ s : Fin (M ^ n).succ → Fin (M ^ n.succ).succ, Function.Injective s ∧ ∀ i₀ i₁, (abv (A (s i₁) 0 % b - A (s i₀) 0 % b) : ℝ) < abv b • ε := by -- We can partition the `A`s into `M` subsets where -- the first components lie close together: obtain ⟨t, ht⟩ : ∃ t : Fin (M ^ n.succ).succ → Fin M, ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ 0 % b - A i₀ 0 % b) : ℝ) < abv b • ε := h.exists_partition hε hb fun x ↦ A x 0 -- Since the `M` subsets contain more than `M * M^n` elements total, -- there must be a subset that contains more than `M^n` elements. obtain ⟨s, hs⟩ := Fintype.exists_lt_card_fiber_of_mul_lt_card (f := t) (by simpa only [Fintype.card_fin, pow_succ'] using Nat.lt_succ_self (M ^ n.succ)) refine ⟨fun i ↦ (Finset.univ.filter fun x ↦ t x = s).toList.get <| i.castLE ?_, fun i j h ↦ ?_, fun i₀ i₁ ↦ ht _ _ ?_⟩ · rwa [Finset.length_toList] · simpa [(Finset.nodup_toList _).get_inj_iff] using h · have : ∀ i, t ((Finset.univ.filter fun x ↦ t x = s).toList.get i) = s := fun i ↦ (Finset.mem_filter.mp (Finset.mem_toList.mp (List.get_mem _ i i.2))).2 simp [this] -- Since `s` is large enough, there are two elements of `A ∘ s` -- where the second components lie close together. obtain ⟨k₀, k₁, hk, h⟩ := ih hε hb fun x ↦ Fin.tail (A (s x)) refine ⟨s k₀, s k₁, fun h ↦ hk (s_inj h), fun i ↦ Fin.cases ?_ (fun i ↦ ?_) i⟩ · exact hs k₀ k₁ · exact h i
0
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Tactic.NthRewrite #align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" namespace Nat theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) : d = a.gcd b := (dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm #align nat.gcd_greatest Nat.gcd_greatest @[simp] theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by simp [gcd_rec m (n + k * m), gcd_rec m n] #align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right @[simp] theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by simp [gcd_rec m (n + m * k), gcd_rec m n] #align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right @[simp] theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right @[simp] theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right @[simp] theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by rw [gcd_comm, gcd_add_mul_right_right, gcd_comm] #align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left @[simp] theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by rw [gcd_comm, gcd_add_mul_left_right, gcd_comm] #align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left @[simp] theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by rw [gcd_comm, gcd_mul_right_add_right, gcd_comm] #align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left @[simp] theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by rw [gcd_comm, gcd_mul_left_add_right, gcd_comm] #align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left @[simp] theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n := Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1) #align nat.gcd_add_self_right Nat.gcd_add_self_right @[simp] theorem gcd_add_self_left (m n : ℕ) : gcd (m + n) n = gcd m n := by rw [gcd_comm, gcd_add_self_right, gcd_comm] #align nat.gcd_add_self_left Nat.gcd_add_self_left @[simp] theorem gcd_self_add_left (m n : ℕ) : gcd (m + n) m = gcd n m := by rw [add_comm, gcd_add_self_left] #align nat.gcd_self_add_left Nat.gcd_self_add_left @[simp] theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by rw [add_comm, gcd_add_self_right] #align nat.gcd_self_add_right Nat.gcd_self_add_right @[simp] theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by calc gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m] _ = gcd n m := by rw [Nat.sub_add_cancel h] @[simp] theorem gcd_sub_self_right {m n : ℕ} (h : m ≤ n) : gcd m (n - m) = gcd m n := by rw [gcd_comm, gcd_sub_self_left h, gcd_comm] @[simp] theorem gcd_self_sub_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) n = gcd m n := by have := Nat.sub_add_cancel h rw [gcd_comm m n, ← this, gcd_add_self_left (n - m) m] have : gcd (n - m) n = gcd (n - m) m := by nth_rw 2 [← Nat.add_sub_cancel' h] rw [gcd_add_self_right, gcd_comm] convert this @[simp] theorem gcd_self_sub_right {m n : ℕ} (h : m ≤ n) : gcd n (n - m) = gcd n m := by rw [gcd_comm, gcd_self_sub_left h, gcd_comm] theorem lcm_dvd_mul (m n : ℕ) : lcm m n ∣ m * n := lcm_dvd (dvd_mul_right _ _) (dvd_mul_left _ _) #align nat.lcm_dvd_mul Nat.lcm_dvd_mul theorem lcm_dvd_iff {m n k : ℕ} : lcm m n ∣ k ↔ m ∣ k ∧ n ∣ k := ⟨fun h => ⟨(dvd_lcm_left _ _).trans h, (dvd_lcm_right _ _).trans h⟩, and_imp.2 lcm_dvd⟩ #align nat.lcm_dvd_iff Nat.lcm_dvd_iff theorem lcm_pos {m n : ℕ} : 0 < m → 0 < n → 0 < m.lcm n := by simp_rw [pos_iff_ne_zero] exact lcm_ne_zero #align nat.lcm_pos Nat.lcm_pos
Mathlib/Data/Nat/GCD/Basic.lean
133
137
theorem lcm_mul_left {m n k : ℕ} : (m * n).lcm (m * k) = m * n.lcm k := by
apply dvd_antisymm · exact lcm_dvd (mul_dvd_mul_left m (dvd_lcm_left n k)) (mul_dvd_mul_left m (dvd_lcm_right n k)) · have h : m ∣ lcm (m * n) (m * k) := (dvd_mul_right m n).trans (dvd_lcm_left (m * n) (m * k)) rw [← dvd_div_iff h, lcm_dvd_iff, dvd_div_iff h, dvd_div_iff h, ← lcm_dvd_iff]
0
import Mathlib.Data.Set.Finite import Mathlib.GroupTheory.GroupAction.FixedPoints import Mathlib.GroupTheory.Perm.Support open Equiv List MulAction Pointwise Set Subgroup variable {G α : Type*} [Group G] [MulAction G α] [DecidableEq α] theorem finite_compl_fixedBy_closure_iff {S : Set G} : (∀ g ∈ closure S, (fixedBy α g)ᶜ.Finite) ↔ ∀ g ∈ S, (fixedBy α g)ᶜ.Finite := ⟨fun h g hg ↦ h g (subset_closure hg), fun h g hg ↦ by refine closure_induction hg h (by simp) (fun g g' hg hg' ↦ (hg.union hg').subset ?_) (by simp) simp_rw [← compl_inter, compl_subset_compl, fixedBy_mul]⟩ theorem finite_compl_fixedBy_swap {x y : α} : (fixedBy α (swap x y))ᶜ.Finite := Set.Finite.subset (s := {x, y}) (by simp) (compl_subset_comm.mp fun z h ↦ by apply swap_apply_of_ne_of_ne <;> rintro rfl <;> simp at h) theorem Equiv.Perm.IsSwap.finite_compl_fixedBy {σ : Perm α} (h : σ.IsSwap) : (fixedBy α σ)ᶜ.Finite := by obtain ⟨x, y, -, rfl⟩ := h exact finite_compl_fixedBy_swap -- this result cannot be moved to Perm/Basic since Perm/Basic is not allowed to import Submonoid theorem SubmonoidClass.swap_mem_trans {a b c : α} {C} [SetLike C (Perm α)] [SubmonoidClass C (Perm α)] (M : C) (hab : swap a b ∈ M) (hbc : swap b c ∈ M) : swap a c ∈ M := by obtain rfl | hab' := eq_or_ne a b · exact hbc obtain rfl | hac := eq_or_ne a c · exact swap_self a ▸ one_mem M rw [swap_comm, ← swap_mul_swap_mul_swap hab' hac] exact mul_mem (mul_mem hbc hab) hbc
Mathlib/GroupTheory/Perm/ClosureSwap.lean
59
70
theorem exists_smul_not_mem_of_subset_orbit_closure (S : Set G) (T : Set α) {a : α} (hS : ∀ g ∈ S, g⁻¹ ∈ S) (subset : T ⊆ orbit (closure S) a) (not_mem : a ∉ T) (nonempty : T.Nonempty) : ∃ σ ∈ S, ∃ a ∈ T, σ • a ∉ T := by
have key0 : ¬ closure S ≤ stabilizer G T := by have ⟨b, hb⟩ := nonempty obtain ⟨σ, rfl⟩ := subset hb contrapose! not_mem with h exact smul_mem_smul_set_iff.mp ((h σ.2).symm ▸ hb) contrapose! key0 refine (closure_le _).mpr fun σ hσ ↦ ?_ simp_rw [SetLike.mem_coe, mem_stabilizer_iff, Set.ext_iff, mem_smul_set_iff_inv_smul_mem] exact fun a ↦ ⟨fun h ↦ smul_inv_smul σ a ▸ key0 σ hσ (σ⁻¹ • a) h, key0 σ⁻¹ (hS σ hσ) a⟩
0
import Mathlib.CategoryTheory.Sites.Sieves import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer import Mathlib.CategoryTheory.Category.Preorder import Mathlib.Order.Copy import Mathlib.Data.Set.Subsingleton #align_import category_theory.sites.grothendieck from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7" universe v₁ u₁ v u namespace CategoryTheory open CategoryTheory Category variable (C : Type u) [Category.{v} C] structure GrothendieckTopology where sieves : ∀ X : C, Set (Sieve X) top_mem' : ∀ X, ⊤ ∈ sieves X pullback_stable' : ∀ ⦃X Y : C⦄ ⦃S : Sieve X⦄ (f : Y ⟶ X), S ∈ sieves X → S.pullback f ∈ sieves Y transitive' : ∀ ⦃X⦄ ⦃S : Sieve X⦄ (_ : S ∈ sieves X) (R : Sieve X), (∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, S f → R.pullback f ∈ sieves Y) → R ∈ sieves X #align category_theory.grothendieck_topology CategoryTheory.GrothendieckTopology namespace GrothendieckTopology instance : CoeFun (GrothendieckTopology C) fun _ => ∀ X : C, Set (Sieve X) := ⟨sieves⟩ variable {C} variable {X Y : C} {S R : Sieve X} variable (J : GrothendieckTopology C) @[ext] theorem ext {J₁ J₂ : GrothendieckTopology C} (h : (J₁ : ∀ X : C, Set (Sieve X)) = J₂) : J₁ = J₂ := by cases J₁ cases J₂ congr #align category_theory.grothendieck_topology.ext CategoryTheory.GrothendieckTopology.ext @[simp] theorem top_mem (X : C) : ⊤ ∈ J X := J.top_mem' X #align category_theory.grothendieck_topology.top_mem CategoryTheory.GrothendieckTopology.top_mem @[simp] theorem pullback_stable (f : Y ⟶ X) (hS : S ∈ J X) : S.pullback f ∈ J Y := J.pullback_stable' f hS #align category_theory.grothendieck_topology.pullback_stable CategoryTheory.GrothendieckTopology.pullback_stable theorem transitive (hS : S ∈ J X) (R : Sieve X) (h : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, S f → R.pullback f ∈ J Y) : R ∈ J X := J.transitive' hS R h #align category_theory.grothendieck_topology.transitive CategoryTheory.GrothendieckTopology.transitive theorem covering_of_eq_top : S = ⊤ → S ∈ J X := fun h => h.symm ▸ J.top_mem X #align category_theory.grothendieck_topology.covering_of_eq_top CategoryTheory.GrothendieckTopology.covering_of_eq_top
Mathlib/CategoryTheory/Sites/Grothendieck.lean
145
150
theorem superset_covering (Hss : S ≤ R) (sjx : S ∈ J X) : R ∈ J X := by
apply J.transitive sjx R fun Y f hf => _ intros Y f hf apply covering_of_eq_top rw [← top_le_iff, ← S.pullback_eq_top_of_mem hf] apply Sieve.pullback_monotone _ Hss
0
import Mathlib.Algebra.Quaternion import Mathlib.Tactic.Ring #align_import algebra.quaternion_basis from "leanprover-community/mathlib"@"3aa5b8a9ed7a7cabd36e6e1d022c9858ab8a8c2d" open Quaternion namespace QuaternionAlgebra structure Basis {R : Type*} (A : Type*) [CommRing R] [Ring A] [Algebra R A] (c₁ c₂ : R) where (i j k : A) i_mul_i : i * i = c₁ • (1 : A) j_mul_j : j * j = c₂ • (1 : A) i_mul_j : i * j = k j_mul_i : j * i = -k #align quaternion_algebra.basis QuaternionAlgebra.Basis variable {R : Type*} {A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B] variable {c₁ c₂ : R} namespace Basis @[ext] protected theorem ext ⦃q₁ q₂ : Basis A c₁ c₂⦄ (hi : q₁.i = q₂.i) (hj : q₁.j = q₂.j) : q₁ = q₂ := by cases q₁; rename_i q₁_i_mul_j _ cases q₂; rename_i q₂_i_mul_j _ congr rw [← q₁_i_mul_j, ← q₂_i_mul_j] congr #align quaternion_algebra.basis.ext QuaternionAlgebra.Basis.ext variable (R) @[simps i j k] protected def self : Basis ℍ[R,c₁,c₂] c₁ c₂ where i := ⟨0, 1, 0, 0⟩ i_mul_i := by ext <;> simp j := ⟨0, 0, 1, 0⟩ j_mul_j := by ext <;> simp k := ⟨0, 0, 0, 1⟩ i_mul_j := by ext <;> simp j_mul_i := by ext <;> simp #align quaternion_algebra.basis.self QuaternionAlgebra.Basis.self variable {R} instance : Inhabited (Basis ℍ[R,c₁,c₂] c₁ c₂) := ⟨Basis.self R⟩ variable (q : Basis A c₁ c₂) attribute [simp] i_mul_i j_mul_j i_mul_j j_mul_i @[simp] theorem i_mul_k : q.i * q.k = c₁ • q.j := by rw [← i_mul_j, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul] #align quaternion_algebra.basis.i_mul_k QuaternionAlgebra.Basis.i_mul_k @[simp] theorem k_mul_i : q.k * q.i = -c₁ • q.j := by rw [← i_mul_j, mul_assoc, j_mul_i, mul_neg, i_mul_k, neg_smul] #align quaternion_algebra.basis.k_mul_i QuaternionAlgebra.Basis.k_mul_i @[simp] theorem k_mul_j : q.k * q.j = c₂ • q.i := by rw [← i_mul_j, mul_assoc, j_mul_j, mul_smul_comm, mul_one] #align quaternion_algebra.basis.k_mul_j QuaternionAlgebra.Basis.k_mul_j @[simp] theorem j_mul_k : q.j * q.k = -c₂ • q.i := by rw [← i_mul_j, ← mul_assoc, j_mul_i, neg_mul, k_mul_j, neg_smul] #align quaternion_algebra.basis.j_mul_k QuaternionAlgebra.Basis.j_mul_k @[simp] theorem k_mul_k : q.k * q.k = -((c₁ * c₂) • (1 : A)) := by rw [← i_mul_j, mul_assoc, ← mul_assoc q.j _ _, j_mul_i, ← i_mul_j, ← mul_assoc, mul_neg, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul, neg_mul, smul_mul_assoc, j_mul_j, smul_smul] #align quaternion_algebra.basis.k_mul_k QuaternionAlgebra.Basis.k_mul_k def lift (x : ℍ[R,c₁,c₂]) : A := algebraMap R _ x.re + x.imI • q.i + x.imJ • q.j + x.imK • q.k #align quaternion_algebra.basis.lift QuaternionAlgebra.Basis.lift theorem lift_zero : q.lift (0 : ℍ[R,c₁,c₂]) = 0 := by simp [lift] #align quaternion_algebra.basis.lift_zero QuaternionAlgebra.Basis.lift_zero theorem lift_one : q.lift (1 : ℍ[R,c₁,c₂]) = 1 := by simp [lift] #align quaternion_algebra.basis.lift_one QuaternionAlgebra.Basis.lift_one theorem lift_add (x y : ℍ[R,c₁,c₂]) : q.lift (x + y) = q.lift x + q.lift y := by simp only [lift, add_re, map_add, add_imI, add_smul, add_imJ, add_imK] abel #align quaternion_algebra.basis.lift_add QuaternionAlgebra.Basis.lift_add
Mathlib/Algebra/QuaternionBasis.lean
125
135
theorem lift_mul (x y : ℍ[R,c₁,c₂]) : q.lift (x * y) = q.lift x * q.lift y := by
simp only [lift, Algebra.algebraMap_eq_smul_one] simp_rw [add_mul, mul_add, smul_mul_assoc, mul_smul_comm, one_mul, mul_one, smul_smul] simp only [i_mul_i, j_mul_j, i_mul_j, j_mul_i, i_mul_k, k_mul_i, k_mul_j, j_mul_k, k_mul_k] simp only [smul_smul, smul_neg, sub_eq_add_neg, add_smul, ← add_assoc, mul_neg, neg_smul] simp only [mul_right_comm _ _ (c₁ * c₂), mul_comm _ (c₁ * c₂)] simp only [mul_comm _ c₁, mul_right_comm _ _ c₁] simp only [mul_comm _ c₂, mul_right_comm _ _ c₂] simp only [← mul_comm c₁ c₂, ← mul_assoc] simp only [mul_re, sub_eq_add_neg, add_smul, neg_smul, mul_imI, ← add_assoc, mul_imJ, mul_imK] abel
0
import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open FiniteDimensional MeasureTheory MeasureTheory.Measure Set variable {ι E F : Type*} variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] section variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)] theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n)) (b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by have e : ι ≃ Fin n := by refine Fintype.equivFinOfCardEq ?_ rw [← _i.out, finrank_eq_card_basis b.toBasis] have A : ⇑b = b.reindex e ∘ e := by ext x simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply] rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped, o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one] #align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) : o.volumeForm.measure = volume := by have A : o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = 1 := Orientation.measure_orthonormalBasis o (stdOrthonormalBasis ℝ F) rw [addHaarMeasure_unique o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped, A, one_smul] simp only [volume, Basis.addHaar] #align orientation.measure_eq_volume Orientation.measure_eq_volume end theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) : volume (parallelepiped b) = 1 := by haveI : Fact (finrank ℝ F = finrank ℝ F) := ⟨rfl⟩ let o := (stdOrthonormalBasis ℝ F).toBasis.orientation rw [← o.measure_eq_volume] exact o.measure_orthonormalBasis b #align orthonormal_basis.volume_parallelepiped OrthonormalBasis.volume_parallelepiped theorem OrthonormalBasis.addHaar_eq_volume {ι F : Type*} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] (b : OrthonormalBasis ι ℝ F) : b.toBasis.addHaar = volume := by rw [Basis.addHaar_eq_iff] exact b.volume_parallelepiped noncomputable def OrthonormalBasis.measurableEquiv (b : OrthonormalBasis ι ℝ F) : F ≃ᵐ EuclideanSpace ℝ ι := b.repr.toHomeomorph.toMeasurableEquiv theorem OrthonormalBasis.measurePreserving_measurableEquiv (b : OrthonormalBasis ι ℝ F) : MeasurePreserving b.measurableEquiv volume volume := by convert (b.measurableEquiv.symm.measurable.measurePreserving _).symm rw [← (EuclideanSpace.basisFun ι ℝ).addHaar_eq_volume] erw [MeasurableEquiv.coe_toEquiv_symm, Basis.map_addHaar _ b.repr.symm.toContinuousLinearEquiv] exact b.addHaar_eq_volume.symm theorem OrthonormalBasis.measurePreserving_repr (b : OrthonormalBasis ι ℝ F) : MeasurePreserving b.repr volume volume := b.measurePreserving_measurableEquiv theorem OrthonormalBasis.measurePreserving_repr_symm (b : OrthonormalBasis ι ℝ F) : MeasurePreserving b.repr.symm volume volume := b.measurePreserving_measurableEquiv.symm section PiLp variable (ι : Type*) [Fintype ι]
Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean
102
108
theorem EuclideanSpace.volume_preserving_measurableEquiv : MeasurePreserving (EuclideanSpace.measurableEquiv ι) := by
suffices volume = map (EuclideanSpace.measurableEquiv ι).symm volume by convert ((EuclideanSpace.measurableEquiv ι).symm.measurable.measurePreserving _).symm rw [← addHaarMeasure_eq_volume_pi, ← Basis.parallelepiped_basisFun, ← Basis.addHaar_def, coe_measurableEquiv_symm, ← PiLp.continuousLinearEquiv_symm_apply 2 ℝ, Basis.map_addHaar] exact (EuclideanSpace.basisFun _ _).addHaar_eq_volume.symm
0
import Mathlib.Analysis.Quaternion import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series #align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm #align quaternion.exp_coe Quaternion.exp_coe theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf theorem expSeries_odd_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n + 1) (fun _ => q) = (((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) / ‖q‖) • q := by rw [expSeries_apply_eq] obtain rfl | hq0 := eq_or_ne q 0 · simp have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq have hqn := norm_ne_zero_iff.mpr hq0 let k : ℝ := ↑(2 * n + 1)! calc k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2] _ = k⁻¹ • ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) • q := ?_ _ = ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, ← coe_mul_eq_smul] norm_cast · rw [smul_smul] congr 1 simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn] ring
Mathlib/Analysis/NormedSpace/QuaternionExponential.lean
82
94
theorem hasSum_expSeries_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) {c s : ℝ} (hc : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) c) (hs : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) s) : HasSum (fun n => expSeries ℝ (Quaternion ℝ) n fun _ => q) (↑c + (s / ‖q‖) • q) := by
replace hc := hasSum_coe.mpr hc replace hs := (hs.div_const ‖q‖).smul_const q refine HasSum.even_add_odd ?_ ?_ · convert hc using 1 ext n : 1 rw [expSeries_even_of_imaginary hq] · convert hs using 1 ext n : 1 rw [expSeries_odd_of_imaginary hq]
0
import Mathlib.ModelTheory.Ultraproducts import Mathlib.ModelTheory.Bundled import Mathlib.ModelTheory.Skolem #align_import model_theory.satisfiability from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728" set_option linter.uppercaseLean3 false universe u v w w' open Cardinal CategoryTheory open Cardinal FirstOrder namespace FirstOrder namespace Language variable {L : Language.{u, v}} {T : L.Theory} {α : Type w} {n : ℕ} namespace Theory variable (T) def IsSatisfiable : Prop := Nonempty (ModelType.{u, v, max u v} T) #align first_order.language.Theory.is_satisfiable FirstOrder.Language.Theory.IsSatisfiable def IsFinitelySatisfiable : Prop := ∀ T0 : Finset L.Sentence, (T0 : L.Theory) ⊆ T → IsSatisfiable (T0 : L.Theory) #align first_order.language.Theory.is_finitely_satisfiable FirstOrder.Language.Theory.IsFinitelySatisfiable variable {T} {T' : L.Theory} theorem Model.isSatisfiable (M : Type w) [Nonempty M] [L.Structure M] [M ⊨ T] : T.IsSatisfiable := ⟨((⊥ : Substructure _ (ModelType.of T M)).elementarySkolem₁Reduct.toModel T).shrink⟩ #align first_order.language.Theory.model.is_satisfiable FirstOrder.Language.Theory.Model.isSatisfiable theorem IsSatisfiable.mono (h : T'.IsSatisfiable) (hs : T ⊆ T') : T.IsSatisfiable := ⟨(Theory.Model.mono (ModelType.is_model h.some) hs).bundled⟩ #align first_order.language.Theory.is_satisfiable.mono FirstOrder.Language.Theory.IsSatisfiable.mono theorem isSatisfiable_empty (L : Language.{u, v}) : IsSatisfiable (∅ : L.Theory) := ⟨default⟩ #align first_order.language.Theory.is_satisfiable_empty FirstOrder.Language.Theory.isSatisfiable_empty theorem isSatisfiable_of_isSatisfiable_onTheory {L' : Language.{w, w'}} (φ : L →ᴸ L') (h : (φ.onTheory T).IsSatisfiable) : T.IsSatisfiable := Model.isSatisfiable (h.some.reduct φ) #align first_order.language.Theory.is_satisfiable_of_is_satisfiable_on_Theory FirstOrder.Language.Theory.isSatisfiable_of_isSatisfiable_onTheory theorem isSatisfiable_onTheory_iff {L' : Language.{w, w'}} {φ : L →ᴸ L'} (h : φ.Injective) : (φ.onTheory T).IsSatisfiable ↔ T.IsSatisfiable := by classical refine ⟨isSatisfiable_of_isSatisfiable_onTheory φ, fun h' => ?_⟩ haveI : Inhabited h'.some := Classical.inhabited_of_nonempty' exact Model.isSatisfiable (h'.some.defaultExpansion h) #align first_order.language.Theory.is_satisfiable_on_Theory_iff FirstOrder.Language.Theory.isSatisfiable_onTheory_iff theorem IsSatisfiable.isFinitelySatisfiable (h : T.IsSatisfiable) : T.IsFinitelySatisfiable := fun _ => h.mono #align first_order.language.Theory.is_satisfiable.is_finitely_satisfiable FirstOrder.Language.Theory.IsSatisfiable.isFinitelySatisfiable theorem isSatisfiable_iff_isFinitelySatisfiable {T : L.Theory} : T.IsSatisfiable ↔ T.IsFinitelySatisfiable := ⟨Theory.IsSatisfiable.isFinitelySatisfiable, fun h => by classical set M : Finset T → Type max u v := fun T0 : Finset T => (h (T0.map (Function.Embedding.subtype fun x => x ∈ T)) T0.map_subtype_subset).some.Carrier let M' := Filter.Product (Ultrafilter.of (Filter.atTop : Filter (Finset T))) M have h' : M' ⊨ T := by refine ⟨fun φ hφ => ?_⟩ rw [Ultraproduct.sentence_realize] refine Filter.Eventually.filter_mono (Ultrafilter.of_le _) (Filter.eventually_atTop.2 ⟨{⟨φ, hφ⟩}, fun s h' => Theory.realize_sentence_of_mem (s.map (Function.Embedding.subtype fun x => x ∈ T)) ?_⟩) simp only [Finset.coe_map, Function.Embedding.coe_subtype, Set.mem_image, Finset.mem_coe, Subtype.exists, Subtype.coe_mk, exists_and_right, exists_eq_right] exact ⟨hφ, h' (Finset.mem_singleton_self _)⟩ exact ⟨ModelType.of T M'⟩⟩ #align first_order.language.Theory.is_satisfiable_iff_is_finitely_satisfiable FirstOrder.Language.Theory.isSatisfiable_iff_isFinitelySatisfiable theorem isSatisfiable_directed_union_iff {ι : Type*} [Nonempty ι] {T : ι → L.Theory} (h : Directed (· ⊆ ·) T) : Theory.IsSatisfiable (⋃ i, T i) ↔ ∀ i, (T i).IsSatisfiable := by refine ⟨fun h' i => h'.mono (Set.subset_iUnion _ _), fun h' => ?_⟩ rw [isSatisfiable_iff_isFinitelySatisfiable, IsFinitelySatisfiable] intro T0 hT0 obtain ⟨i, hi⟩ := h.exists_mem_subset_of_finset_subset_biUnion hT0 exact (h' i).mono hi #align first_order.language.Theory.is_satisfiable_directed_union_iff FirstOrder.Language.Theory.isSatisfiable_directed_union_iff
Mathlib/ModelTheory/Satisfiability.lean
138
154
theorem isSatisfiable_union_distinctConstantsTheory_of_card_le (T : L.Theory) (s : Set α) (M : Type w') [Nonempty M] [L.Structure M] [M ⊨ T] (h : Cardinal.lift.{w'} #s ≤ Cardinal.lift.{w} #M) : ((L.lhomWithConstants α).onTheory T ∪ L.distinctConstantsTheory s).IsSatisfiable := by
haveI : Inhabited M := Classical.inhabited_of_nonempty inferInstance rw [Cardinal.lift_mk_le'] at h letI : (constantsOn α).Structure M := constantsOn.structure (Function.extend (↑) h.some default) have : M ⊨ (L.lhomWithConstants α).onTheory T ∪ L.distinctConstantsTheory s := by refine ((LHom.onTheory_model _ _).2 inferInstance).union ?_ rw [model_distinctConstantsTheory] refine fun a as b bs ab => ?_ rw [← Subtype.coe_mk a as, ← Subtype.coe_mk b bs, ← Subtype.ext_iff] exact h.some.injective ((Subtype.coe_injective.extend_apply h.some default ⟨a, as⟩).symm.trans (ab.trans (Subtype.coe_injective.extend_apply h.some default ⟨b, bs⟩))) exact Model.isSatisfiable M
0
import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.SpecificLimits.Normed open Filter Finset open scoped Topology namespace Complex section StolzSet open Real def stolzSet (M : ℝ) : Set ℂ := {z | ‖z‖ < 1 ∧ ‖1 - z‖ < M * (1 - ‖z‖)} def stolzCone (s : ℝ) : Set ℂ := {z | |z.im| < s * (1 - z.re)} theorem stolzSet_empty {M : ℝ} (hM : M ≤ 1) : stolzSet M = ∅ := by ext z rw [stolzSet, Set.mem_setOf, Set.mem_empty_iff_false, iff_false, not_and, not_lt, ← sub_pos] intro zn calc _ ≤ 1 * (1 - ‖z‖) := mul_le_mul_of_nonneg_right hM zn.le _ = ‖(1 : ℂ)‖ - ‖z‖ := by rw [one_mul, norm_one] _ ≤ _ := norm_sub_norm_le _ _
Mathlib/Analysis/Complex/AbelLimit.lean
56
66
theorem nhdsWithin_lt_le_nhdsWithin_stolzSet {M : ℝ} (hM : 1 < M) : (𝓝[<] 1).map ofReal' ≤ 𝓝[stolzSet M] 1 := by
rw [← tendsto_id'] refine tendsto_map' <| tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within ofReal' (tendsto_nhdsWithin_of_tendsto_nhds <| ofRealCLM.continuous.tendsto' 1 1 rfl) ?_ simp only [eventually_iff, norm_eq_abs, abs_ofReal, abs_lt, mem_nhdsWithin] refine ⟨Set.Ioo 0 2, isOpen_Ioo, by norm_num, fun x hx ↦ ?_⟩ simp only [Set.mem_inter_iff, Set.mem_Ioo, Set.mem_Iio] at hx simp only [Set.mem_setOf_eq, stolzSet, ← ofReal_one, ← ofReal_sub, norm_eq_abs, abs_ofReal, abs_of_pos hx.1.1, abs_of_pos <| sub_pos.mpr hx.2] exact ⟨hx.2, lt_mul_left (sub_pos.mpr hx.2) hM⟩
0
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Linear import Mathlib.Analysis.Complex.Conformal import Mathlib.Analysis.Calculus.Conformal.NormedSpace #align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" section Conformality open Complex ContinuousLinearMap open scoped ComplexConjugate variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {z : ℂ} {f : ℂ → E}
Mathlib/Analysis/Complex/RealDeriv.lean
162
166
theorem DifferentiableAt.conformalAt (h : DifferentiableAt ℂ f z) (hf' : deriv f z ≠ 0) : ConformalAt f z := by
rw [conformalAt_iff_isConformalMap_fderiv, (h.hasFDerivAt.restrictScalars ℝ).fderiv] apply isConformalMap_complex_linear simpa only [Ne, ext_ring_iff]
0
import Mathlib.Analysis.Convolution import Mathlib.Analysis.Calculus.BumpFunction.Normed import Mathlib.MeasureTheory.Integral.Average import Mathlib.MeasureTheory.Covering.Differentiation import Mathlib.MeasureTheory.Covering.BesicovitchVectorSpace import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import analysis.convolution from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95" universe uG uE' open ContinuousLinearMap Metric MeasureTheory Filter Function Measure Set open scoped Convolution Topology namespace ContDiffBump variable {G : Type uG} {E' : Type uE'} [NormedAddCommGroup E'] {g : G → E'} [MeasurableSpace G] {μ : MeasureTheory.Measure G} [NormedSpace ℝ E'] [NormedAddCommGroup G] [NormedSpace ℝ G] [HasContDiffBump G] [CompleteSpace E'] {φ : ContDiffBump (0 : G)} {x₀ : G}
Mathlib/Analysis/Calculus/BumpFunction/Convolution.lean
54
56
theorem convolution_eq_right {x₀ : G} (hg : ∀ x ∈ ball x₀ φ.rOut, g x = g x₀) : (φ ⋆[lsmul ℝ ℝ, μ] g : G → E') x₀ = integral μ φ • g x₀ := by
simp_rw [convolution_eq_right' _ φ.support_eq.subset hg, lsmul_apply, integral_smul_const]
0
import Mathlib.Data.Fintype.Card import Mathlib.Data.Finset.Sum import Mathlib.Logic.Embedding.Set #align_import data.fintype.sum from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1" universe u v variable {α β : Type*} open Finset instance (α : Type u) (β : Type v) [Fintype α] [Fintype β] : Fintype (Sum α β) where elems := univ.disjSum univ complete := by rintro (_ | _) <;> simp @[simp] theorem Finset.univ_disjSum_univ {α β : Type*} [Fintype α] [Fintype β] : univ.disjSum univ = (univ : Finset (Sum α β)) := rfl #align finset.univ_disj_sum_univ Finset.univ_disjSum_univ @[simp] theorem Fintype.card_sum [Fintype α] [Fintype β] : Fintype.card (Sum α β) = Fintype.card α + Fintype.card β := card_disjSum _ _ #align fintype.card_sum Fintype.card_sum def fintypeOfFintypeNe (a : α) (h : Fintype { b // b ≠ a }) : Fintype α := Fintype.ofBijective (Sum.elim ((↑) : { b // b = a } → α) ((↑) : { b // b ≠ a } → α)) <| by classical exact (Equiv.sumCompl (· = a)).bijective #align fintype_of_fintype_ne fintypeOfFintypeNe theorem image_subtype_ne_univ_eq_image_erase [Fintype α] [DecidableEq β] (k : β) (b : α → β) : image (fun i : { a // b a ≠ k } => b ↑i) univ = (image b univ).erase k := by apply subset_antisymm · rw [image_subset_iff] intro i _ apply mem_erase_of_ne_of_mem i.2 (mem_image_of_mem _ (mem_univ _)) · intro i hi rw [mem_image] rcases mem_image.1 (erase_subset _ _ hi) with ⟨a, _, ha⟩ subst ha exact ⟨⟨a, ne_of_mem_erase hi⟩, mem_univ _, rfl⟩ #align image_subtype_ne_univ_eq_image_erase image_subtype_ne_univ_eq_image_erase theorem image_subtype_univ_ssubset_image_univ [Fintype α] [DecidableEq β] (k : β) (b : α → β) (hk : k ∈ Finset.image b univ) (p : β → Prop) [DecidablePred p] (hp : ¬p k) : image (fun i : { a // p (b a) } => b ↑i) univ ⊂ image b univ := by constructor · intro x hx rcases mem_image.1 hx with ⟨y, _, hy⟩ exact hy ▸ mem_image_of_mem b (mem_univ (y : α)) · intro h rw [mem_image] at hk rcases hk with ⟨k', _, hk'⟩ subst hk' have := h (mem_image_of_mem b (mem_univ k')) rw [mem_image] at this rcases this with ⟨j, _, hj'⟩ exact hp (hj' ▸ j.2) #align image_subtype_univ_ssubset_image_univ image_subtype_univ_ssubset_image_univ theorem Finset.exists_equiv_extend_of_card_eq [Fintype α] [DecidableEq β] {t : Finset β} (hαt : Fintype.card α = t.card) {s : Finset α} {f : α → β} (hfst : Finset.image f s ⊆ t) (hfs : Set.InjOn f s) : ∃ g : α ≃ t, ∀ i ∈ s, (g i : β) = f i := by classical induction' s using Finset.induction with a s has H generalizing f · obtain ⟨e⟩ : Nonempty (α ≃ ↥t) := by rwa [← Fintype.card_eq, Fintype.card_coe] use e simp have hfst' : Finset.image f s ⊆ t := (Finset.image_mono _ (s.subset_insert a)).trans hfst have hfs' : Set.InjOn f s := hfs.mono (s.subset_insert a) obtain ⟨g', hg'⟩ := H hfst' hfs' have hfat : f a ∈ t := hfst (mem_image_of_mem _ (s.mem_insert_self a)) use g'.trans (Equiv.swap (⟨f a, hfat⟩ : t) (g' a)) simp_rw [mem_insert] rintro i (rfl | hi) · simp rw [Equiv.trans_apply, Equiv.swap_apply_of_ne_of_ne, hg' _ hi] · exact ne_of_apply_ne Subtype.val (ne_of_eq_of_ne (hg' _ hi) <| hfs.ne (subset_insert _ _ hi) (mem_insert_self _ _) <| ne_of_mem_of_not_mem hi has) · exact g'.injective.ne (ne_of_mem_of_not_mem hi has) #align finset.exists_equiv_extend_of_card_eq Finset.exists_equiv_extend_of_card_eq theorem Set.MapsTo.exists_equiv_extend_of_card_eq [Fintype α] {t : Finset β} (hαt : Fintype.card α = t.card) {s : Set α} {f : α → β} (hfst : s.MapsTo f t) (hfs : Set.InjOn f s) : ∃ g : α ≃ t, ∀ i ∈ s, (g i : β) = f i := by classical let s' : Finset α := s.toFinset have hfst' : s'.image f ⊆ t := by simpa [s', ← Finset.coe_subset] using hfst have hfs' : Set.InjOn f s' := by simpa [s'] using hfs obtain ⟨g, hg⟩ := Finset.exists_equiv_extend_of_card_eq hαt hfst' hfs' refine ⟨g, fun i hi => ?_⟩ apply hg simpa [s'] using hi #align set.maps_to.exists_equiv_extend_of_card_eq Set.MapsTo.exists_equiv_extend_of_card_eq
Mathlib/Data/Fintype/Sum.lean
118
123
theorem Fintype.card_subtype_or (p q : α → Prop) [Fintype { x // p x }] [Fintype { x // q x }] [Fintype { x // p x ∨ q x }] : Fintype.card { x // p x ∨ q x } ≤ Fintype.card { x // p x } + Fintype.card { x // q x } := by
classical convert Fintype.card_le_of_embedding (subtypeOrLeftEmbedding p q) rw [Fintype.card_sum]
0
import Mathlib.Analysis.InnerProductSpace.Rayleigh import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Algebra.DirectSum.Decomposition import Mathlib.LinearAlgebra.Eigenspace.Minpoly #align_import analysis.inner_product_space.spectrum from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y open scoped ComplexConjugate open Module.End namespace LinearMap namespace IsSymmetric variable {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric)
Mathlib/Analysis/InnerProductSpace/Spectrum.lean
68
72
theorem invariant_orthogonalComplement_eigenspace (μ : 𝕜) (v : E) (hv : v ∈ (eigenspace T μ)ᗮ) : T v ∈ (eigenspace T μ)ᗮ := by
intro w hw have : T w = (μ : 𝕜) • w := by rwa [mem_eigenspace_iff] at hw simp [← hT w, this, inner_smul_left, hv w hw]
0
import Mathlib.Dynamics.Flow import Mathlib.Tactic.Monotonicity #align_import dynamics.omega_limit from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter Topology section omegaLimit variable {τ : Type*} {α : Type*} {β : Type*} {ι : Type*} def omegaLimit [TopologicalSpace β] (f : Filter τ) (ϕ : τ → α → β) (s : Set α) : Set β := ⋂ u ∈ f, closure (image2 ϕ u s) #align omega_limit omegaLimit @[inherit_doc] scoped[omegaLimit] notation "ω" => omegaLimit scoped[omegaLimit] notation "ω⁺" => omegaLimit Filter.atTop scoped[omegaLimit] notation "ω⁻" => omegaLimit Filter.atBot variable [TopologicalSpace β] variable (f : Filter τ) (ϕ : τ → α → β) (s s₁ s₂ : Set α) open omegaLimit theorem omegaLimit_def : ω f ϕ s = ⋂ u ∈ f, closure (image2 ϕ u s) := rfl #align omega_limit_def omegaLimit_def theorem omegaLimit_subset_of_tendsto {m : τ → τ} {f₁ f₂ : Filter τ} (hf : Tendsto m f₁ f₂) : ω f₁ (fun t x ↦ ϕ (m t) x) s ⊆ ω f₂ ϕ s := by refine iInter₂_mono' fun u hu ↦ ⟨m ⁻¹' u, tendsto_def.mp hf _ hu, ?_⟩ rw [← image2_image_left] exact closure_mono (image2_subset (image_preimage_subset _ _) Subset.rfl) #align omega_limit_subset_of_tendsto omegaLimit_subset_of_tendsto theorem omegaLimit_mono_left {f₁ f₂ : Filter τ} (hf : f₁ ≤ f₂) : ω f₁ ϕ s ⊆ ω f₂ ϕ s := omegaLimit_subset_of_tendsto ϕ s (tendsto_id'.2 hf) #align omega_limit_mono_left omegaLimit_mono_left theorem omegaLimit_mono_right {s₁ s₂ : Set α} (hs : s₁ ⊆ s₂) : ω f ϕ s₁ ⊆ ω f ϕ s₂ := iInter₂_mono fun _u _hu ↦ closure_mono (image2_subset Subset.rfl hs) #align omega_limit_mono_right omegaLimit_mono_right theorem isClosed_omegaLimit : IsClosed (ω f ϕ s) := isClosed_iInter fun _u ↦ isClosed_iInter fun _hu ↦ isClosed_closure #align is_closed_omega_limit isClosed_omegaLimit theorem mapsTo_omegaLimit' {α' β' : Type*} [TopologicalSpace β'] {f : Filter τ} {ϕ : τ → α → β} {ϕ' : τ → α' → β'} {ga : α → α'} {s' : Set α'} (hs : MapsTo ga s s') {gb : β → β'} (hg : ∀ᶠ t in f, EqOn (gb ∘ ϕ t) (ϕ' t ∘ ga) s) (hgc : Continuous gb) : MapsTo gb (ω f ϕ s) (ω f ϕ' s') := by simp only [omegaLimit_def, mem_iInter, MapsTo] intro y hy u hu refine map_mem_closure hgc (hy _ (inter_mem hu hg)) (forall_image2_iff.2 fun t ht x hx ↦ ?_) calc gb (ϕ t x) = ϕ' t (ga x) := ht.2 hx _ ∈ image2 ϕ' u s' := mem_image2_of_mem ht.1 (hs hx) #align maps_to_omega_limit' mapsTo_omegaLimit' theorem mapsTo_omegaLimit {α' β' : Type*} [TopologicalSpace β'] {f : Filter τ} {ϕ : τ → α → β} {ϕ' : τ → α' → β'} {ga : α → α'} {s' : Set α'} (hs : MapsTo ga s s') {gb : β → β'} (hg : ∀ t x, gb (ϕ t x) = ϕ' t (ga x)) (hgc : Continuous gb) : MapsTo gb (ω f ϕ s) (ω f ϕ' s') := mapsTo_omegaLimit' _ hs (eventually_of_forall fun t x _hx ↦ hg t x) hgc #align maps_to_omega_limit mapsTo_omegaLimit theorem omegaLimit_image_eq {α' : Type*} (ϕ : τ → α' → β) (f : Filter τ) (g : α → α') : ω f ϕ (g '' s) = ω f (fun t x ↦ ϕ t (g x)) s := by simp only [omegaLimit, image2_image_right] #align omega_limit_image_eq omegaLimit_image_eq theorem omegaLimit_preimage_subset {α' : Type*} (ϕ : τ → α' → β) (s : Set α') (f : Filter τ) (g : α → α') : ω f (fun t x ↦ ϕ t (g x)) (g ⁻¹' s) ⊆ ω f ϕ s := mapsTo_omegaLimit _ (mapsTo_preimage _ _) (fun _t _x ↦ rfl) continuous_id #align omega_limit_preimage_subset omegaLimit_preimage_subset
Mathlib/Dynamics/OmegaLimit.lean
127
136
theorem mem_omegaLimit_iff_frequently (y : β) : y ∈ ω f ϕ s ↔ ∀ n ∈ 𝓝 y, ∃ᶠ t in f, (s ∩ ϕ t ⁻¹' n).Nonempty := by
simp_rw [frequently_iff, omegaLimit_def, mem_iInter, mem_closure_iff_nhds] constructor · intro h _ hn _ hu rcases h _ hu _ hn with ⟨_, _, _, ht, _, hx, rfl⟩ exact ⟨_, ht, _, hx, by rwa [mem_preimage]⟩ · intro h _ hu _ hn rcases h _ hn hu with ⟨_, ht, _, hx, hϕtx⟩ exact ⟨_, hϕtx, _, ht, _, hx, rfl⟩
0
import Mathlib.MeasureTheory.Measure.VectorMeasure #align_import measure_theory.measure.complex from "leanprover-community/mathlib"@"17b3357baa47f48697ca9c243e300eb8cdd16a15" noncomputable section open scoped Classical MeasureTheory ENNReal NNReal variable {α β : Type*} {m : MeasurableSpace α} namespace MeasureTheory open VectorMeasure namespace ComplexMeasure @[simps! apply] def re : ComplexMeasure α →ₗ[ℝ] SignedMeasure α := mapRangeₗ Complex.reCLM Complex.continuous_re #align measure_theory.complex_measure.re MeasureTheory.ComplexMeasure.re @[simps! apply] def im : ComplexMeasure α →ₗ[ℝ] SignedMeasure α := mapRangeₗ Complex.imCLM Complex.continuous_im #align measure_theory.complex_measure.im MeasureTheory.ComplexMeasure.im @[simps!] def _root_.MeasureTheory.SignedMeasure.toComplexMeasure (s t : SignedMeasure α) : ComplexMeasure α where measureOf' i := ⟨s i, t i⟩ empty' := by dsimp only; rw [s.empty, t.empty]; rfl not_measurable' i hi := by dsimp only; rw [s.not_measurable hi, t.not_measurable hi]; rfl m_iUnion' f hf hfdisj := (Complex.hasSum_iff _ _).2 ⟨s.m_iUnion hf hfdisj, t.m_iUnion hf hfdisj⟩ #align measure_theory.signed_measure.to_complex_measure MeasureTheory.SignedMeasure.toComplexMeasure theorem _root_.MeasureTheory.SignedMeasure.toComplexMeasure_apply {s t : SignedMeasure α} {i : Set α} : s.toComplexMeasure t i = ⟨s i, t i⟩ := rfl #align measure_theory.signed_measure.to_complex_measure_apply MeasureTheory.SignedMeasure.toComplexMeasure_apply theorem toComplexMeasure_to_signedMeasure (c : ComplexMeasure α) : SignedMeasure.toComplexMeasure (ComplexMeasure.re c) (ComplexMeasure.im c) = c := rfl #align measure_theory.complex_measure.to_complex_measure_to_signed_measure MeasureTheory.ComplexMeasure.toComplexMeasure_to_signedMeasure theorem _root_.MeasureTheory.SignedMeasure.re_toComplexMeasure (s t : SignedMeasure α) : ComplexMeasure.re (SignedMeasure.toComplexMeasure s t) = s := rfl #align measure_theory.signed_measure.re_to_complex_measure MeasureTheory.SignedMeasure.re_toComplexMeasure theorem _root_.MeasureTheory.SignedMeasure.im_toComplexMeasure (s t : SignedMeasure α) : ComplexMeasure.im (SignedMeasure.toComplexMeasure s t) = t := rfl #align measure_theory.signed_measure.im_to_complex_measure MeasureTheory.SignedMeasure.im_toComplexMeasure @[simps] def equivSignedMeasure : ComplexMeasure α ≃ SignedMeasure α × SignedMeasure α where toFun c := ⟨ComplexMeasure.re c, ComplexMeasure.im c⟩ invFun := fun ⟨s, t⟩ => s.toComplexMeasure t left_inv c := c.toComplexMeasure_to_signedMeasure right_inv := fun ⟨s, t⟩ => Prod.mk.inj_iff.2 ⟨s.re_toComplexMeasure t, s.im_toComplexMeasure t⟩ #align measure_theory.complex_measure.equiv_signed_measure MeasureTheory.ComplexMeasure.equivSignedMeasure section variable {R : Type*} [Semiring R] [Module R ℝ] variable [ContinuousConstSMul R ℝ] [ContinuousConstSMul R ℂ] @[simps] def equivSignedMeasureₗ : ComplexMeasure α ≃ₗ[R] SignedMeasure α × SignedMeasure α := { equivSignedMeasure with map_add' := fun c d => by rfl map_smul' := by intro r c dsimp ext · simp [Complex.smul_re] · simp [Complex.smul_im] } #align measure_theory.complex_measure.equiv_signed_measureₗ MeasureTheory.ComplexMeasure.equivSignedMeasureₗ end
Mathlib/MeasureTheory/Measure/Complex.lean
116
122
theorem absolutelyContinuous_ennreal_iff (c : ComplexMeasure α) (μ : VectorMeasure α ℝ≥0∞) : c ≪ᵥ μ ↔ ComplexMeasure.re c ≪ᵥ μ ∧ ComplexMeasure.im c ≪ᵥ μ := by
constructor <;> intro h · constructor <;> · intro i hi; simp [h hi] · intro i hi rw [← Complex.re_add_im (c i), (_ : (c i).re = 0), (_ : (c i).im = 0)] exacts [by simp, h.2 hi, h.1 hi]
0
import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" open Polynomial namespace Multiset open Polynomial section Ring variable {R : Type*} [CommRing R]
Mathlib/RingTheory/Polynomial/Vieta.lean
94
101
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by
rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr rfl] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr rfl, Function.comp_apply] exact fun z _ => neg_one_mul z
0
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.Order.Invertible import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Group.Instances import Mathlib.LinearAlgebra.AffineSpace.Slope import Mathlib.LinearAlgebra.AffineSpace.Midpoint import Mathlib.Tactic.FieldSimp #align_import linear_algebra.affine_space.ordered from "leanprover-community/mathlib"@"78261225eb5cedc61c5c74ecb44e5b385d13b733" open AffineMap variable {k E PE : Type*} section LinearOrderedField variable [LinearOrderedField k] [OrderedAddCommGroup E] variable [Module k E] [OrderedSMul k E] section variable {a b : E} {r r' : k} theorem lineMap_le_lineMap_iff_of_lt (h : r < r') : lineMap a b r ≤ lineMap a b r' ↔ a ≤ b := by simp only [lineMap_apply_module] rw [← le_sub_iff_add_le, add_sub_assoc, ← sub_le_iff_le_add', ← sub_smul, ← sub_smul, sub_sub_sub_cancel_left, smul_le_smul_iff_of_pos_left (sub_pos.2 h)] #align line_map_le_line_map_iff_of_lt lineMap_le_lineMap_iff_of_lt theorem left_le_lineMap_iff_le (h : 0 < r) : a ≤ lineMap a b r ↔ a ≤ b := Iff.trans (by rw [lineMap_apply_zero]) (lineMap_le_lineMap_iff_of_lt h) #align left_le_line_map_iff_le left_le_lineMap_iff_le @[simp] theorem left_le_midpoint : a ≤ midpoint k a b ↔ a ≤ b := left_le_lineMap_iff_le <| inv_pos.2 zero_lt_two #align left_le_midpoint left_le_midpoint theorem lineMap_le_left_iff_le (h : 0 < r) : lineMap a b r ≤ a ↔ b ≤ a := left_le_lineMap_iff_le (E := Eᵒᵈ) h #align line_map_le_left_iff_le lineMap_le_left_iff_le @[simp] theorem midpoint_le_left : midpoint k a b ≤ a ↔ b ≤ a := lineMap_le_left_iff_le <| inv_pos.2 zero_lt_two #align midpoint_le_left midpoint_le_left theorem lineMap_le_right_iff_le (h : r < 1) : lineMap a b r ≤ b ↔ a ≤ b := Iff.trans (by rw [lineMap_apply_one]) (lineMap_le_lineMap_iff_of_lt h) #align line_map_le_right_iff_le lineMap_le_right_iff_le @[simp] theorem midpoint_le_right : midpoint k a b ≤ b ↔ a ≤ b := lineMap_le_right_iff_le <| inv_lt_one one_lt_two #align midpoint_le_right midpoint_le_right theorem right_le_lineMap_iff_le (h : r < 1) : b ≤ lineMap a b r ↔ b ≤ a := lineMap_le_right_iff_le (E := Eᵒᵈ) h #align right_le_line_map_iff_le right_le_lineMap_iff_le @[simp] theorem right_le_midpoint : b ≤ midpoint k a b ↔ b ≤ a := right_le_lineMap_iff_le <| inv_lt_one one_lt_two #align right_le_midpoint right_le_midpoint end variable {f : k → E} {a b r : k} local notation "c" => lineMap a b r
Mathlib/LinearAlgebra/AffineSpace/Ordered.lean
206
213
theorem map_le_lineMap_iff_slope_le_slope_left (h : 0 < r * (b - a)) : f c ≤ lineMap (f a) (f b) r ↔ slope f a c ≤ slope f a b := by
rw [lineMap_apply, lineMap_apply, slope, slope, vsub_eq_sub, vsub_eq_sub, vsub_eq_sub, vadd_eq_add, vadd_eq_add, smul_eq_mul, add_sub_cancel_right, smul_sub, smul_sub, smul_sub, sub_le_iff_le_add, mul_inv_rev, mul_smul, mul_smul, ← smul_sub, ← smul_sub, ← smul_add, smul_smul, ← mul_inv_rev, inv_smul_le_iff_of_pos h, smul_smul, mul_inv_cancel_right₀ (right_ne_zero_of_mul h.ne'), smul_add, smul_inv_smul₀ (left_ne_zero_of_mul h.ne')]
0
import Mathlib.Data.List.Range import Mathlib.Algebra.Order.Ring.Nat variable {α : Type*} namespace List @[simp] theorem length_iterate (f : α → α) (a : α) (n : ℕ) : length (iterate f a n) = n := by induction n generalizing a <;> simp [*] @[simp] theorem iterate_eq_nil {f : α → α} {a : α} {n : ℕ} : iterate f a n = [] ↔ n = 0 := by rw [← length_eq_zero, length_iterate] theorem get?_iterate (f : α → α) (a : α) : ∀ (n i : ℕ), i < n → get? (iterate f a n) i = f^[i] a | n + 1, 0 , _ => rfl | n + 1, i + 1, h => by simp [get?_iterate f (f a) n i (by simpa using h)] @[simp] theorem get_iterate (f : α → α) (a : α) (n : ℕ) (i : Fin (iterate f a n).length) : get (iterate f a n) i = f^[↑i] a := (get?_eq_some.1 <| get?_iterate f a n i.1 (by simpa using i.2)).2 @[simp] theorem mem_iterate {f : α → α} {a : α} {n : ℕ} {b : α} : b ∈ iterate f a n ↔ ∃ m < n, b = f^[m] a := by simp [List.mem_iff_get, Fin.exists_iff, eq_comm (b := b)] @[simp] theorem range_map_iterate (n : ℕ) (f : α → α) (a : α) : (List.range n).map (f^[·] a) = List.iterate f a n := by apply List.ext_get <;> simp
Mathlib/Data/List/Iterate.lean
48
52
theorem iterate_add (f : α → α) (a : α) (m n : ℕ) : iterate f a (m + n) = iterate f a m ++ iterate f (f^[m] a) n := by
induction m generalizing a with | zero => simp | succ n ih => rw [iterate, add_right_comm, iterate, ih, Nat.iterate, cons_append]
0
import Mathlib.Control.Bitraversable.Basic #align_import control.bitraversable.lemmas from "leanprover-community/mathlib"@"58581d0fe523063f5651df0619be2bf65012a94a" universe u variable {t : Type u → Type u → Type u} [Bitraversable t] variable {β : Type u} namespace Bitraversable open Functor LawfulApplicative variable {F G : Type u → Type u} [Applicative F] [Applicative G] abbrev tfst {α α'} (f : α → F α') : t α β → F (t α' β) := bitraverse f pure #align bitraversable.tfst Bitraversable.tfst abbrev tsnd {α α'} (f : α → F α') : t β α → F (t β α') := bitraverse pure f #align bitraversable.tsnd Bitraversable.tsnd variable [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] @[higher_order tfst_id] theorem id_tfst : ∀ {α β} (x : t α β), tfst (F := Id) pure x = pure x := id_bitraverse #align bitraversable.id_tfst Bitraversable.id_tfst @[higher_order tsnd_id] theorem id_tsnd : ∀ {α β} (x : t α β), tsnd (F := Id) pure x = pure x := id_bitraverse #align bitraversable.id_tsnd Bitraversable.id_tsnd @[higher_order tfst_comp_tfst] theorem comp_tfst {α₀ α₁ α₂ β} (f : α₀ → F α₁) (f' : α₁ → G α₂) (x : t α₀ β) : Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x := by rw [← comp_bitraverse] simp only [Function.comp, tfst, map_pure, Pure.pure] #align bitraversable.comp_tfst Bitraversable.comp_tfst @[higher_order tfst_comp_tsnd] theorem tfst_tsnd {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) : Comp.mk (tfst f <$> tsnd f' x) = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x := by rw [← comp_bitraverse] simp only [Function.comp, map_pure] #align bitraversable.tfst_tsnd Bitraversable.tfst_tsnd @[higher_order tsnd_comp_tfst] theorem tsnd_tfst {α₀ α₁ β₀ β₁} (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀) : Comp.mk (tsnd f' <$> tfst f x) = bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ pure ∘ f') x := by rw [← comp_bitraverse] simp only [Function.comp, map_pure] #align bitraversable.tsnd_tfst Bitraversable.tsnd_tfst @[higher_order tsnd_comp_tsnd] theorem comp_tsnd {α β₀ β₁ β₂} (g : β₀ → F β₁) (g' : β₁ → G β₂) (x : t α β₀) : Comp.mk (tsnd g' <$> tsnd g x) = tsnd (Comp.mk ∘ map g' ∘ g) x := by rw [← comp_bitraverse] simp only [Function.comp, map_pure] rfl #align bitraversable.comp_tsnd Bitraversable.comp_tsnd open Bifunctor -- Porting note: This private theorem wasn't needed -- private theorem pure_eq_id_mk_comp_id {α} : pure = id.mk ∘ @id α := rfl open Function @[higher_order]
Mathlib/Control/Bitraversable/Lemmas.lean
110
112
theorem tfst_eq_fst_id {α α' β} (f : α → α') (x : t α β) : tfst (F := Id) (pure ∘ f) x = pure (fst f x) := by
apply bitraverse_eq_bimap_id
0
import Mathlib.Geometry.Euclidean.Inversion.Basic import Mathlib.Geometry.Euclidean.PerpBisector open Metric Function AffineMap Set AffineSubspace open scoped Topology variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] {c x y : P} {R : ℝ} namespace EuclideanGeometry theorem inversion_mem_perpBisector_inversion_iff (hR : R ≠ 0) (hx : x ≠ c) (hy : y ≠ c) : inversion c R x ∈ perpBisector c (inversion c R y) ↔ dist x y = dist y c := by rw [mem_perpBisector_iff_dist_eq, dist_inversion_inversion hx hy, dist_inversion_center] have hx' := dist_ne_zero.2 hx have hy' := dist_ne_zero.2 hy field_simp [mul_assoc, mul_comm, hx, hx.symm, eq_comm] theorem inversion_mem_perpBisector_inversion_iff' (hR : R ≠ 0) (hy : y ≠ c) : inversion c R x ∈ perpBisector c (inversion c R y) ↔ dist x y = dist y c ∧ x ≠ c := by rcases eq_or_ne x c with rfl | hx · simp [*] · simp [inversion_mem_perpBisector_inversion_iff hR hx hy, hx] theorem preimage_inversion_perpBisector_inversion (hR : R ≠ 0) (hy : y ≠ c) : inversion c R ⁻¹' perpBisector c (inversion c R y) = sphere y (dist y c) \ {c} := Set.ext fun _ ↦ inversion_mem_perpBisector_inversion_iff' hR hy theorem preimage_inversion_perpBisector (hR : R ≠ 0) (hy : y ≠ c) : inversion c R ⁻¹' perpBisector c y = sphere (inversion c R y) (R ^ 2 / dist y c) \ {c} := by rw [← dist_inversion_center, ← preimage_inversion_perpBisector_inversion hR, inversion_inversion] <;> simp [*] theorem image_inversion_perpBisector (hR : R ≠ 0) (hy : y ≠ c) : inversion c R '' perpBisector c y = sphere (inversion c R y) (R ^ 2 / dist y c) \ {c} := by rw [image_eq_preimage_of_inverse (inversion_involutive _ hR) (inversion_involutive _ hR), preimage_inversion_perpBisector hR hy]
Mathlib/Geometry/Euclidean/Inversion/ImageHyperplane.lean
66
71
theorem preimage_inversion_sphere_dist_center (hR : R ≠ 0) (hy : y ≠ c) : inversion c R ⁻¹' sphere y (dist y c) = insert c (perpBisector c (inversion c R y) : Set P) := by
ext x rcases eq_or_ne x c with rfl | hx; · simp [dist_comm] rw [mem_preimage, mem_sphere, ← inversion_mem_perpBisector_inversion_iff hR] <;> simp [*]
0
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.Dynamics.PeriodicPts import Mathlib.Data.Set.Pointwise.SMul namespace MulAction open Pointwise variable {α : Type*} variable {G : Type*} [Group G] [MulAction G α] variable {M : Type*} [Monoid M] [MulAction M α] section Faithful variable [FaithfulSMul G α] variable [FaithfulSMul M α] @[to_additive "If the additive action of `M` on `α` is faithful, then `fixedBy α m = Set.univ` implies that `m = 1`."]
Mathlib/GroupTheory/GroupAction/FixedPoints.lean
238
240
theorem fixedBy_eq_univ_iff_eq_one {m : M} : fixedBy α m = Set.univ ↔ m = 1 := by
rw [← (smul_left_injective' (M := M) (α := α)).eq_iff, Set.eq_univ_iff_forall] simp_rw [Function.funext_iff, one_smul, mem_fixedBy]
0
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type w} {ι' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section RankCondition variable [RankCondition R] theorem Basis.le_span'' {ι : Type*} [Fintype ι] (b : Basis ι R M) {w : Set M} [Fintype w] (s : span R w = ⊤) : Fintype.card ι ≤ Fintype.card w := by -- We construct a surjective linear map `(w → R) →ₗ[R] (ι → R)`, -- by expressing a linear combination in `w` as a linear combination in `ι`. fapply card_le_of_surjective' R · exact b.repr.toLinearMap.comp (Finsupp.total w M R (↑)) · apply Surjective.comp (g := b.repr.toLinearMap) · apply LinearEquiv.surjective rw [← LinearMap.range_eq_top, Finsupp.range_total] simpa using s #align basis.le_span'' Basis.le_span'' theorem basis_le_span' {ι : Type*} (b : Basis ι R M) {w : Set M} [Fintype w] (s : span R w = ⊤) : #ι ≤ Fintype.card w := by haveI := nontrivial_of_invariantBasisNumber R haveI := basis_finite_of_finite_spans w (toFinite _) s b cases nonempty_fintype ι rw [Cardinal.mk_fintype ι] simp only [Cardinal.natCast_le] exact Basis.le_span'' b s #align basis_le_span' basis_le_span' -- Note that if `R` satisfies the strong rank condition, -- this also follows from `linearIndependent_le_span` below.
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
140
164
theorem Basis.le_span {J : Set M} (v : Basis ι R M) (hJ : span R J = ⊤) : #(range v) ≤ #J := by
haveI := nontrivial_of_invariantBasisNumber R cases fintypeOrInfinite J · rw [← Cardinal.lift_le, Cardinal.mk_range_eq_of_injective v.injective, Cardinal.mk_fintype J] convert Cardinal.lift_le.{v}.2 (basis_le_span' v hJ) simp · let S : J → Set ι := fun j => ↑(v.repr j).support let S' : J → Set M := fun j => v '' S j have hs : range v ⊆ ⋃ j, S' j := by intro b hb rcases mem_range.1 hb with ⟨i, hi⟩ have : span R J ≤ comap v.repr.toLinearMap (Finsupp.supported R R (⋃ j, S j)) := span_le.2 fun j hj x hx => ⟨_, ⟨⟨j, hj⟩, rfl⟩, hx⟩ rw [hJ] at this replace : v.repr (v i) ∈ Finsupp.supported R R (⋃ j, S j) := this trivial rw [v.repr_self, Finsupp.mem_supported, Finsupp.support_single_ne_zero _ one_ne_zero] at this · subst b rcases mem_iUnion.1 (this (Finset.mem_singleton_self _)) with ⟨j, hj⟩ exact mem_iUnion.2 ⟨j, (mem_image _ _ _).2 ⟨i, hj, rfl⟩⟩ refine le_of_not_lt fun IJ => ?_ suffices #(⋃ j, S' j) < #(range v) by exact not_le_of_lt this ⟨Set.embeddingOfSubset _ _ hs⟩ refine lt_of_le_of_lt (le_trans Cardinal.mk_iUnion_le_sum_mk (Cardinal.sum_le_sum _ (fun _ => ℵ₀) ?_)) ?_ · exact fun j => (Cardinal.lt_aleph0_of_finite _).le · simpa
0
import Mathlib.Algebra.Algebra.Tower import Mathlib.Analysis.LocallyConvex.WithSeminorms import Mathlib.Topology.Algebra.Module.StrongTopology import Mathlib.Analysis.NormedSpace.LinearIsometry import Mathlib.Analysis.NormedSpace.ContinuousLinearMap import Mathlib.Tactic.SuppressCompilation #align_import analysis.normed_space.operator_norm from "leanprover-community/mathlib"@"f7ebde7ee0d1505dfccac8644ae12371aa3c1c9f" 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] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] variable [FunLike 𝓕 E F]
Mathlib/Analysis/NormedSpace/OperatorNorm/Basic.lean
54
57
theorem norm_image_of_norm_zero [SemilinearMapClass 𝓕 σ₁₂ E F] (f : 𝓕) (hf : Continuous f) {x : E} (hx : ‖x‖ = 0) : ‖f x‖ = 0 := by
rw [← mem_closure_zero_iff_norm, ← specializes_iff_mem_closure, ← map_zero f] at * exact hx.map hf
0
import Mathlib.LinearAlgebra.Quotient #align_import linear_algebra.isomorphisms from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d" universe u v variable {R M M₂ M₃ : Type*} variable [Ring R] [AddCommGroup M] [AddCommGroup M₂] [AddCommGroup M₃] variable [Module R M] [Module R M₂] [Module R M₃] variable (f : M →ₗ[R] M₂) namespace LinearMap open Submodule section IsomorphismLaws noncomputable def quotKerEquivRange : (M ⧸ LinearMap.ker f) ≃ₗ[R] LinearMap.range f := (LinearEquiv.ofInjective (f.ker.liftQ f <| le_rfl) <| ker_eq_bot.mp <| Submodule.ker_liftQ_eq_bot _ _ _ (le_refl (LinearMap.ker f))).trans (LinearEquiv.ofEq _ _ <| Submodule.range_liftQ _ _ _) #align linear_map.quot_ker_equiv_range LinearMap.quotKerEquivRange noncomputable def quotKerEquivOfSurjective (f : M →ₗ[R] M₂) (hf : Function.Surjective f) : (M ⧸ LinearMap.ker f) ≃ₗ[R] M₂ := f.quotKerEquivRange.trans (LinearEquiv.ofTop (LinearMap.range f) (LinearMap.range_eq_top.2 hf)) #align linear_map.quot_ker_equiv_of_surjective LinearMap.quotKerEquivOfSurjective @[simp] theorem quotKerEquivRange_apply_mk (x : M) : (f.quotKerEquivRange (Submodule.Quotient.mk x) : M₂) = f x := rfl #align linear_map.quot_ker_equiv_range_apply_mk LinearMap.quotKerEquivRange_apply_mk @[simp] theorem quotKerEquivRange_symm_apply_image (x : M) (h : f x ∈ LinearMap.range f) : f.quotKerEquivRange.symm ⟨f x, h⟩ = f.ker.mkQ x := f.quotKerEquivRange.symm_apply_apply (f.ker.mkQ x) #align linear_map.quot_ker_equiv_range_symm_apply_image LinearMap.quotKerEquivRange_symm_apply_image -- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out abbrev subToSupQuotient (p p' : Submodule R M) : { x // x ∈ p } →ₗ[R] { x // x ∈ p ⊔ p' } ⧸ comap (Submodule.subtype (p ⊔ p')) p' := (comap (p ⊔ p').subtype p').mkQ.comp (Submodule.inclusion le_sup_left) -- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out theorem comap_leq_ker_subToSupQuotient (p p' : Submodule R M) : comap (Submodule.subtype p) (p ⊓ p') ≤ ker (subToSupQuotient p p') := by rw [LinearMap.ker_comp, Submodule.inclusion, comap_codRestrict, ker_mkQ, map_comap_subtype] exact comap_mono (inf_le_inf_right _ le_sup_left) def quotientInfToSupQuotient (p p' : Submodule R M) : (↥p) ⧸ (comap p.subtype (p ⊓ p')) →ₗ[R] (↥(p ⊔ p')) ⧸ (comap (p ⊔ p').subtype p') := (comap p.subtype (p ⊓ p')).liftQ (subToSupQuotient p p') (comap_leq_ker_subToSupQuotient p p') #align linear_map.quotient_inf_to_sup_quotient LinearMap.quotientInfToSupQuotient -- Porting note: breaking up original definition of quotientInfEquivSupQuotient to avoid timing out theorem quotientInfEquivSupQuotient_injective (p p' : Submodule R M) : Function.Injective (quotientInfToSupQuotient p p') := by rw [← ker_eq_bot, quotientInfToSupQuotient, ker_liftQ_eq_bot] rw [ker_comp, ker_mkQ] exact fun ⟨x, hx1⟩ hx2 => ⟨hx1, hx2⟩ -- Porting note: breaking up original definition of quotientInfEquivSupQuotient to avoid timing out
Mathlib/LinearAlgebra/Isomorphisms.lean
88
93
theorem quotientInfEquivSupQuotient_surjective (p p' : Submodule R M) : Function.Surjective (quotientInfToSupQuotient p p') := by
rw [← range_eq_top, quotientInfToSupQuotient, range_liftQ, eq_top_iff'] rintro ⟨x, hx⟩; rcases mem_sup.1 hx with ⟨y, hy, z, hz, rfl⟩ use ⟨y, hy⟩; apply (Submodule.Quotient.eq _).2 simp only [mem_comap, map_sub, coeSubtype, coe_inclusion, sub_add_cancel_left, neg_mem_iff, hz]
0
import Mathlib.Analysis.SpecialFunctions.Gamma.Beta import Mathlib.NumberTheory.LSeries.HurwitzZeta import Mathlib.Analysis.Complex.RemovableSingularity import Mathlib.Analysis.PSeriesComplex #align_import number_theory.zeta_function from "leanprover-community/mathlib"@"57f9349f2fe19d2de7207e99b0341808d977cdcf" open MeasureTheory Set Filter Asymptotics TopologicalSpace Real Asymptotics Classical HurwitzZeta open Complex hiding exp norm_eq_abs abs_of_nonneg abs_two continuous_exp open scoped Topology Real Nat noncomputable section def completedRiemannZeta₀ (s : ℂ) : ℂ := completedHurwitzZetaEven₀ 0 s #align riemann_completed_zeta₀ completedRiemannZeta₀ def completedRiemannZeta (s : ℂ) : ℂ := completedHurwitzZetaEven 0 s #align riemann_completed_zeta completedRiemannZeta lemma HurwitzZeta.completedHurwitzZetaEven_zero (s : ℂ) : completedHurwitzZetaEven 0 s = completedRiemannZeta s := rfl lemma HurwitzZeta.completedHurwitzZetaEven₀_zero (s : ℂ) : completedHurwitzZetaEven₀ 0 s = completedRiemannZeta₀ s := rfl lemma HurwitzZeta.completedCosZeta_zero (s : ℂ) : completedCosZeta 0 s = completedRiemannZeta s := by rw [completedRiemannZeta, completedHurwitzZetaEven, completedCosZeta, hurwitzEvenFEPair_zero_symm] lemma HurwitzZeta.completedCosZeta₀_zero (s : ℂ) : completedCosZeta₀ 0 s = completedRiemannZeta₀ s := by rw [completedRiemannZeta₀, completedHurwitzZetaEven₀, completedCosZeta₀, hurwitzEvenFEPair_zero_symm] lemma completedRiemannZeta_eq (s : ℂ) : completedRiemannZeta s = completedRiemannZeta₀ s - 1 / s - 1 / (1 - s) := by simp_rw [completedRiemannZeta, completedRiemannZeta₀, completedHurwitzZetaEven_eq, if_true] theorem differentiable_completedZeta₀ : Differentiable ℂ completedRiemannZeta₀ := differentiable_completedHurwitzZetaEven₀ 0 #align differentiable_completed_zeta₀ differentiable_completedZeta₀ theorem differentiableAt_completedZeta {s : ℂ} (hs : s ≠ 0) (hs' : s ≠ 1) : DifferentiableAt ℂ completedRiemannZeta s := differentiableAt_completedHurwitzZetaEven 0 (Or.inl hs) hs'
Mathlib/NumberTheory/LSeries/RiemannZeta.lean
103
105
theorem completedRiemannZeta₀_one_sub (s : ℂ) : completedRiemannZeta₀ (1 - s) = completedRiemannZeta₀ s := by
rw [← completedHurwitzZetaEven₀_zero, ← completedCosZeta₀_zero, completedHurwitzZetaEven₀_one_sub]
0
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat def totient (n : ℕ) : ℕ := ((range n).filter n.Coprime).card #align nat.totient Nat.totient @[inherit_doc] scoped notation "φ" => Nat.totient @[simp] theorem totient_zero : φ 0 = 0 := rfl #align nat.totient_zero Nat.totient_zero @[simp] theorem totient_one : φ 1 = 1 := rfl #align nat.totient_one Nat.totient_one theorem totient_eq_card_coprime (n : ℕ) : φ n = ((range n).filter n.Coprime).card := rfl #align nat.totient_eq_card_coprime Nat.totient_eq_card_coprime theorem totient_eq_card_lt_and_coprime (n : ℕ) : φ n = Nat.card { m | m < n ∧ n.Coprime m } := by let e : { m | m < n ∧ n.Coprime m } ≃ Finset.filter n.Coprime (Finset.range n) := { toFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ invFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ left_inv := fun m => by simp only [Subtype.coe_mk, Subtype.coe_eta] right_inv := fun m => by simp only [Subtype.coe_mk, Subtype.coe_eta] } rw [totient_eq_card_coprime, card_congr e, card_eq_fintype_card, Fintype.card_coe] #align nat.totient_eq_card_lt_and_coprime Nat.totient_eq_card_lt_and_coprime theorem totient_le (n : ℕ) : φ n ≤ n := ((range n).card_filter_le _).trans_eq (card_range n) #align nat.totient_le Nat.totient_le theorem totient_lt (n : ℕ) (hn : 1 < n) : φ n < n := (card_lt_card (filter_ssubset.2 ⟨0, by simp [hn.ne', pos_of_gt hn]⟩)).trans_eq (card_range n) #align nat.totient_lt Nat.totient_lt @[simp] theorem totient_eq_zero : ∀ {n : ℕ}, φ n = 0 ↔ n = 0 | 0 => by decide | n + 1 => suffices ∃ x < n + 1, (n + 1).gcd x = 1 by simpa [totient, filter_eq_empty_iff] ⟨1 % (n + 1), mod_lt _ n.succ_pos, by rw [gcd_comm, ← gcd_rec, gcd_one_right]⟩ @[simp] theorem totient_pos {n : ℕ} : 0 < φ n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.totient_pos Nat.totient_pos theorem filter_coprime_Ico_eq_totient (a n : ℕ) : ((Ico n (n + a)).filter (Coprime a)).card = totient a := by rw [totient, filter_Ico_card_eq_of_periodic, count_eq_card_filter_range] exact periodic_coprime a #align nat.filter_coprime_Ico_eq_totient Nat.filter_coprime_Ico_eq_totient theorem Ico_filter_coprime_le {a : ℕ} (k n : ℕ) (a_pos : 0 < a) : ((Ico k (k + n)).filter (Coprime a)).card ≤ totient a * (n / a + 1) := by conv_lhs => rw [← Nat.mod_add_div n a] induction' n / a with i ih · rw [← filter_coprime_Ico_eq_totient a k] simp only [add_zero, mul_one, mul_zero, le_of_lt (mod_lt n a_pos), Nat.zero_eq, zero_add] -- Porting note: below line was `mono` refine Finset.card_mono ?_ refine monotone_filter_left a.Coprime ?_ simp only [Finset.le_eq_subset] exact Ico_subset_Ico rfl.le (add_le_add_left (le_of_lt (mod_lt n a_pos)) k) simp only [mul_succ] simp_rw [← add_assoc] at ih ⊢ calc (filter a.Coprime (Ico k (k + n % a + a * i + a))).card = (filter a.Coprime (Ico k (k + n % a + a * i) ∪ Ico (k + n % a + a * i) (k + n % a + a * i + a))).card := by congr rw [Ico_union_Ico_eq_Ico] · rw [add_assoc] exact le_self_add exact le_self_add _ ≤ (filter a.Coprime (Ico k (k + n % a + a * i))).card + a.totient := by rw [filter_union, ← filter_coprime_Ico_eq_totient a (k + n % a + a * i)] apply card_union_le _ ≤ a.totient * i + a.totient + a.totient := add_le_add_right ih (totient a) #align nat.Ico_filter_coprime_le Nat.Ico_filter_coprime_le open ZMod @[simp] theorem _root_.ZMod.card_units_eq_totient (n : ℕ) [NeZero n] [Fintype (ZMod n)ˣ] : Fintype.card (ZMod n)ˣ = φ n := calc Fintype.card (ZMod n)ˣ = Fintype.card { x : ZMod n // x.val.Coprime n } := Fintype.card_congr ZMod.unitsEquivCoprime _ = φ n := by obtain ⟨m, rfl⟩ : ∃ m, n = m + 1 := exists_eq_succ_of_ne_zero NeZero.out simp only [totient, Finset.card_eq_sum_ones, Fintype.card_subtype, Finset.sum_filter, ← Fin.sum_univ_eq_sum_range, @Nat.coprime_comm (m + 1)] rfl #align zmod.card_units_eq_totient ZMod.card_units_eq_totient
Mathlib/Data/Nat/Totient.lean
129
135
theorem totient_even {n : ℕ} (hn : 2 < n) : Even n.totient := by
haveI : Fact (1 < n) := ⟨one_lt_two.trans hn⟩ haveI : NeZero n := NeZero.of_gt hn suffices 2 = orderOf (-1 : (ZMod n)ˣ) by rw [← ZMod.card_units_eq_totient, even_iff_two_dvd, this] exact orderOf_dvd_card rw [← orderOf_units, Units.coe_neg_one, orderOf_neg_one, ringChar.eq (ZMod n) n, if_neg hn.ne']
0
import Mathlib.Combinatorics.SimpleGraph.Connectivity import Mathlib.Tactic.Linarith #align_import combinatorics.simple_graph.acyclic from "leanprover-community/mathlib"@"b07688016d62f81d14508ff339ea3415558d6353" universe u v namespace SimpleGraph open Walk variable {V : Type u} (G : SimpleGraph V) def IsAcyclic : Prop := ∀ ⦃v : V⦄ (c : G.Walk v v), ¬c.IsCycle #align simple_graph.is_acyclic SimpleGraph.IsAcyclic @[mk_iff] structure IsTree : Prop where protected isConnected : G.Connected protected IsAcyclic : G.IsAcyclic #align simple_graph.is_tree SimpleGraph.IsTree variable {G} @[simp] lemma isAcyclic_bot : IsAcyclic (⊥ : SimpleGraph V) := fun _a _w hw ↦ hw.ne_bot rfl theorem isAcyclic_iff_forall_adj_isBridge : G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.IsBridge s(v, w) := by simp_rw [isBridge_iff_adj_and_forall_cycle_not_mem] constructor · intro ha v w hvw apply And.intro hvw intro u p hp cases ha p hp · rintro hb v (_ | ⟨ha, p⟩) hp · exact hp.not_of_nil · apply (hb ha).2 _ hp rw [Walk.edges_cons] apply List.mem_cons_self #align simple_graph.is_acyclic_iff_forall_adj_is_bridge SimpleGraph.isAcyclic_iff_forall_adj_isBridge theorem isAcyclic_iff_forall_edge_isBridge : G.IsAcyclic ↔ ∀ ⦃e⦄, e ∈ (G.edgeSet) → G.IsBridge e := by simp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall] #align simple_graph.is_acyclic_iff_forall_edge_is_bridge SimpleGraph.isAcyclic_iff_forall_edge_isBridge theorem IsAcyclic.path_unique {G : SimpleGraph V} (h : G.IsAcyclic) {v w : V} (p q : G.Path v w) : p = q := by obtain ⟨p, hp⟩ := p obtain ⟨q, hq⟩ := q rw [Subtype.mk.injEq] induction p with | nil => cases (Walk.isPath_iff_eq_nil _).mp hq rfl | cons ph p ih => rw [isAcyclic_iff_forall_adj_isBridge] at h specialize h ph rw [isBridge_iff_adj_and_forall_walk_mem_edges] at h replace h := h.2 (q.append p.reverse) simp only [Walk.edges_append, Walk.edges_reverse, List.mem_append, List.mem_reverse] at h cases' h with h h · cases q with | nil => simp [Walk.isPath_def] at hp | cons _ q => rw [Walk.cons_isPath_iff] at hp hq simp only [Walk.edges_cons, List.mem_cons, Sym2.eq_iff, true_and] at h rcases h with (⟨h, rfl⟩ | ⟨rfl, rfl⟩) | h · cases ih hp.1 q hq.1 rfl · simp at hq · exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hq.2 · rw [Walk.cons_isPath_iff] at hp exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hp.2 #align simple_graph.is_acyclic.path_unique SimpleGraph.IsAcyclic.path_unique theorem isAcyclic_of_path_unique (h : ∀ (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by intro v c hc simp only [Walk.isCycle_def, Ne] at hc cases c with | nil => cases hc.2.1 rfl | cons ha c' => simp only [Walk.cons_isTrail_iff, Walk.support_cons, List.tail_cons, true_and_iff] at hc specialize h _ _ ⟨c', by simp only [Walk.isPath_def, hc.2]⟩ (Path.singleton ha.symm) rw [Path.singleton, Subtype.mk.injEq] at h simp [h] at hc #align simple_graph.is_acyclic_of_path_unique SimpleGraph.isAcyclic_of_path_unique theorem isAcyclic_iff_path_unique : G.IsAcyclic ↔ ∀ ⦃v w : V⦄ (p q : G.Path v w), p = q := ⟨IsAcyclic.path_unique, isAcyclic_of_path_unique⟩ #align simple_graph.is_acyclic_iff_path_unique SimpleGraph.isAcyclic_iff_path_unique
Mathlib/Combinatorics/SimpleGraph/Acyclic.lean
134
154
theorem isTree_iff_existsUnique_path : G.IsTree ↔ Nonempty V ∧ ∀ v w : V, ∃! p : G.Walk v w, p.IsPath := by
classical rw [isTree_iff, isAcyclic_iff_path_unique] constructor · rintro ⟨hc, hu⟩ refine ⟨hc.nonempty, ?_⟩ intro v w let q := (hc v w).some.toPath use q simp only [true_and_iff, Path.isPath] intro p hp specialize hu ⟨p, hp⟩ q exact Subtype.ext_iff.mp hu · rintro ⟨hV, h⟩ refine ⟨Connected.mk ?_, ?_⟩ · intro v w obtain ⟨p, _⟩ := h v w exact p.reachable · rintro v w ⟨p, hp⟩ ⟨q, hq⟩ simp only [ExistsUnique.unique (h v w) hp hq]
0
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : ℕ) : Type | r : ZMod n → DihedralGroup n | sr : ZMod n → DihedralGroup n deriving DecidableEq #align dihedral_group DihedralGroup namespace DihedralGroup variable {n : ℕ} private def mul : DihedralGroup n → DihedralGroup n → DihedralGroup n | r i, r j => r (i + j) | r i, sr j => sr (j - i) | sr i, r j => sr (i + j) | sr i, sr j => r (j - i) private def one : DihedralGroup n := r 0 instance : Inhabited (DihedralGroup n) := ⟨one⟩ private def inv : DihedralGroup n → DihedralGroup n | r i => r (-i) | sr i => sr i instance : Group (DihedralGroup n) where mul := mul mul_assoc := by rintro (a | a) (b | b) (c | c) <;> simp only [(· * ·), mul] <;> ring_nf one := one one_mul := by rintro (a | a) · exact congr_arg r (zero_add a) · exact congr_arg sr (sub_zero a) mul_one := by rintro (a | a) · exact congr_arg r (add_zero a) · exact congr_arg sr (add_zero a) inv := inv mul_left_inv := by rintro (a | a) · exact congr_arg r (neg_add_self a) · exact congr_arg r (sub_self a) @[simp] theorem r_mul_r (i j : ZMod n) : r i * r j = r (i + j) := rfl #align dihedral_group.r_mul_r DihedralGroup.r_mul_r @[simp] theorem r_mul_sr (i j : ZMod n) : r i * sr j = sr (j - i) := rfl #align dihedral_group.r_mul_sr DihedralGroup.r_mul_sr @[simp] theorem sr_mul_r (i j : ZMod n) : sr i * r j = sr (i + j) := rfl #align dihedral_group.sr_mul_r DihedralGroup.sr_mul_r @[simp] theorem sr_mul_sr (i j : ZMod n) : sr i * sr j = r (j - i) := rfl #align dihedral_group.sr_mul_sr DihedralGroup.sr_mul_sr theorem one_def : (1 : DihedralGroup n) = r 0 := rfl #align dihedral_group.one_def DihedralGroup.one_def private def fintypeHelper : Sum (ZMod n) (ZMod n) ≃ DihedralGroup n where invFun i := match i with | r j => Sum.inl j | sr j => Sum.inr j toFun i := match i with | Sum.inl j => r j | Sum.inr j => sr j left_inv := by rintro (x | x) <;> rfl right_inv := by rintro (x | x) <;> rfl instance [NeZero n] : Fintype (DihedralGroup n) := Fintype.ofEquiv _ fintypeHelper instance : Infinite (DihedralGroup 0) := DihedralGroup.fintypeHelper.infinite_iff.mp inferInstance instance : Nontrivial (DihedralGroup n) := ⟨⟨r 0, sr 0, by simp_rw [ne_eq, not_false_eq_true]⟩⟩ theorem card [NeZero n] : Fintype.card (DihedralGroup n) = 2 * n := by rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul] #align dihedral_group.card DihedralGroup.card theorem nat_card : Nat.card (DihedralGroup n) = 2 * n := by cases n · rw [Nat.card_eq_zero_of_infinite] · rw [Nat.card_eq_fintype_card, card] @[simp] theorem r_one_pow (k : ℕ) : (r 1 : DihedralGroup n) ^ k = r k := by induction' k with k IH · rw [Nat.cast_zero] rfl · rw [pow_succ', IH, r_mul_r] congr 1 norm_cast rw [Nat.one_add] #align dihedral_group.r_one_pow DihedralGroup.r_one_pow -- @[simp] -- Porting note: simp changes the goal to `r 0 = 1`. `r_one_pow_n` is no longer useful. theorem r_one_pow_n : r (1 : ZMod n) ^ n = 1 := by rw [r_one_pow, one_def] congr 1 exact ZMod.natCast_self _ #align dihedral_group.r_one_pow_n DihedralGroup.r_one_pow_n -- @[simp] -- Porting note: simp changes the goal to `r 0 = 1`. `sr_mul_self` is no longer useful. theorem sr_mul_self (i : ZMod n) : sr i * sr i = 1 := by rw [sr_mul_sr, sub_self, one_def] #align dihedral_group.sr_mul_self DihedralGroup.sr_mul_self @[simp] theorem orderOf_sr (i : ZMod n) : orderOf (sr i) = 2 := by apply orderOf_eq_prime · rw [sq, sr_mul_self] · -- Porting note: Previous proof was `decide` revert n simp_rw [one_def, ne_eq, forall_const, not_false_eq_true] #align dihedral_group.order_of_sr DihedralGroup.orderOf_sr @[simp]
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
170
184
theorem orderOf_r_one : orderOf (r 1 : DihedralGroup n) = n := by
rcases eq_zero_or_neZero n with (rfl | hn) · rw [orderOf_eq_zero_iff'] intro n hn rw [r_one_pow, one_def] apply mt r.inj simpa using hn.ne' · apply (Nat.le_of_dvd (NeZero.pos n) <| orderOf_dvd_of_pow_eq_one <| @r_one_pow_n n).lt_or_eq.resolve_left intro h have h1 : (r 1 : DihedralGroup n) ^ orderOf (r 1) = 1 := pow_orderOf_eq_one _ rw [r_one_pow] at h1 injection h1 with h2 rw [← ZMod.val_eq_zero, ZMod.val_natCast, Nat.mod_eq_of_lt h] at h2 exact absurd h2.symm (orderOf_pos _).ne
0
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.SpecificLimits.Normed #align_import analysis.normed.group.controlled_closure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset open Topology variable {G : Type*} [NormedAddCommGroup G] [CompleteSpace G] variable {H : Type*} [NormedAddCommGroup H] theorem controlled_closure_of_complete {f : NormedAddGroupHom G H} {K : AddSubgroup H} {C ε : ℝ} (hC : 0 < C) (hε : 0 < ε) (hyp : f.SurjectiveOnWith K C) : f.SurjectiveOnWith K.topologicalClosure (C + ε) := by rintro (h : H) (h_in : h ∈ K.topologicalClosure) -- We first get rid of the easy case where `h = 0`. by_cases hyp_h : h = 0 · rw [hyp_h] use 0 simp set b : ℕ → ℝ := fun i => (1 / 2) ^ i * (ε * ‖h‖ / 2) / C have b_pos (i) : 0 < b i := by field_simp [b, hC, hyp_h] obtain ⟨v : ℕ → H, lim_v : Tendsto (fun n : ℕ => ∑ k ∈ range (n + 1), v k) atTop (𝓝 h), v_in : ∀ n, v n ∈ K, hv₀ : ‖v 0 - h‖ < b 0, hv : ∀ n > 0, ‖v n‖ < b n⟩ := controlled_sum_of_mem_closure h_in b_pos have : ∀ n, ∃ m' : G, f m' = v n ∧ ‖m'‖ ≤ C * ‖v n‖ := fun n : ℕ => hyp (v n) (v_in n) choose u hu hnorm_u using this set s : ℕ → G := fun n => ∑ k ∈ range (n + 1), u k have : CauchySeq s := by apply NormedAddCommGroup.cauchy_series_of_le_geometric'' (by norm_num) one_half_lt_one · rintro n (hn : n ≥ 1) calc ‖u n‖ ≤ C * ‖v n‖ := hnorm_u n _ ≤ C * b n := by gcongr; exact (hv _ <| Nat.succ_le_iff.mp hn).le _ = (1 / 2) ^ n * (ε * ‖h‖ / 2) := by simp [mul_div_cancel₀ _ hC.ne.symm] _ = ε * ‖h‖ / 2 * (1 / 2) ^ n := mul_comm _ _ -- We now show that the limit `g` of `s` is the desired preimage. obtain ⟨g : G, hg⟩ := cauchySeq_tendsto_of_complete this refine ⟨g, ?_, ?_⟩ · -- We indeed get a preimage. First note: have : f ∘ s = fun n => ∑ k ∈ range (n + 1), v k := by ext n simp [s, map_sum, hu] rw [← this] at lim_v exact tendsto_nhds_unique ((f.continuous.tendsto g).comp hg) lim_v · -- Then we need to estimate the norm of `g`, using our careful choice of `b`. suffices ∀ n, ‖s n‖ ≤ (C + ε) * ‖h‖ from le_of_tendsto' (continuous_norm.continuousAt.tendsto.comp hg) this intro n have hnorm₀ : ‖u 0‖ ≤ C * b 0 + C * ‖h‖ := by have := calc ‖v 0‖ ≤ ‖h‖ + ‖v 0 - h‖ := norm_le_insert' _ _ _ ≤ ‖h‖ + b 0 := by gcongr calc ‖u 0‖ ≤ C * ‖v 0‖ := hnorm_u 0 _ ≤ C * (‖h‖ + b 0) := by gcongr _ = C * b 0 + C * ‖h‖ := by rw [add_comm, mul_add] have : (∑ k ∈ range (n + 1), C * b k) ≤ ε * ‖h‖ := calc (∑ k ∈ range (n + 1), C * b k) _ = (∑ k ∈ range (n + 1), (1 / 2 : ℝ) ^ k) * (ε * ‖h‖ / 2) := by simp only [mul_div_cancel₀ _ hC.ne.symm, ← sum_mul] _ ≤ 2 * (ε * ‖h‖ / 2) := by gcongr; apply sum_geometric_two_le _ = ε * ‖h‖ := mul_div_cancel₀ _ two_ne_zero calc ‖s n‖ ≤ ∑ k ∈ range (n + 1), ‖u k‖ := norm_sum_le _ _ _ = (∑ k ∈ range n, ‖u (k + 1)‖) + ‖u 0‖ := sum_range_succ' _ _ _ ≤ (∑ k ∈ range n, C * ‖v (k + 1)‖) + ‖u 0‖ := by gcongr; apply hnorm_u _ ≤ (∑ k ∈ range n, C * b (k + 1)) + (C * b 0 + C * ‖h‖) := by gcongr with k; exact (hv _ k.succ_pos).le _ = (∑ k ∈ range (n + 1), C * b k) + C * ‖h‖ := by rw [← add_assoc, sum_range_succ'] _ ≤ (C + ε) * ‖h‖ := by rw [add_comm, add_mul] apply add_le_add_left this #align controlled_closure_of_complete controlled_closure_of_complete
Mathlib/Analysis/Normed/Group/ControlledClosure.lean
116
125
theorem controlled_closure_range_of_complete {f : NormedAddGroupHom G H} {K : Type*} [SeminormedAddCommGroup K] {j : NormedAddGroupHom K H} (hj : ∀ x, ‖j x‖ = ‖x‖) {C ε : ℝ} (hC : 0 < C) (hε : 0 < ε) (hyp : ∀ k, ∃ g, f g = j k ∧ ‖g‖ ≤ C * ‖k‖) : f.SurjectiveOnWith j.range.topologicalClosure (C + ε) := by
replace hyp : ∀ h ∈ j.range, ∃ g, f g = h ∧ ‖g‖ ≤ C * ‖h‖ := by intro h h_in rcases (j.mem_range _).mp h_in with ⟨k, rfl⟩ rw [hj] exact hyp k exact controlled_closure_of_complete hC hε hyp
0
import Mathlib.CategoryTheory.Adjunction.FullyFaithful import Mathlib.CategoryTheory.Conj import Mathlib.CategoryTheory.Functor.ReflectsIso #align_import category_theory.adjunction.reflective from "leanprover-community/mathlib"@"239d882c4fb58361ee8b3b39fb2091320edef10a" universe v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Category Adjunction variable {C : Type u₁} {D : Type u₂} {E : Type u₃} variable [Category.{v₁} C] [Category.{v₂} D] [Category.{v₃} E] class Reflective (R : D ⥤ C) extends R.Full, R.Faithful where L : C ⥤ D adj : L ⊣ R #align category_theory.reflective CategoryTheory.Reflective variable (i : D ⥤ C) def reflector [Reflective i] : C ⥤ D := Reflective.L (R := i) def reflectorAdjunction [Reflective i] : reflector i ⊣ i := Reflective.adj instance [Reflective i] : i.IsRightAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩ instance [Reflective i] : (reflector i).IsLeftAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩ def Functor.fullyFaithfulOfReflective [Reflective i] : i.FullyFaithful := (reflectorAdjunction i).fullyFaithfulROfIsIsoCounit -- TODO: This holds more generally for idempotent adjunctions, not just reflective adjunctions.
Mathlib/CategoryTheory/Adjunction/Reflective.lean
62
67
theorem unit_obj_eq_map_unit [Reflective i] (X : C) : (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) = i.map ((reflector i).map ((reflectorAdjunction i).unit.app X)) := by
rw [← cancel_mono (i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X))), ← i.map_comp] simp
0
import Mathlib.Init.Core import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots import Mathlib.NumberTheory.NumberField.Basic import Mathlib.FieldTheory.Galois #align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba" open Polynomial Algebra FiniteDimensional Set universe u v w z variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z) variable [CommRing A] [CommRing B] [Algebra A B] variable [Field K] [Field L] [Algebra K L] noncomputable section @[mk_iff] class IsCyclotomicExtension : Prop where exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} #align is_cyclotomic_extension IsCyclotomicExtension namespace IsCyclotomicExtension section Basic theorem iff_adjoin_eq_top : IsCyclotomicExtension S A B ↔ (∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ := ⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h => ⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩ #align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top theorem iff_singleton : IsCyclotomicExtension {n} A B ↔ (∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} := by simp [isCyclotomicExtension_iff] #align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by simpa [Algebra.eq_top_iff, isCyclotomicExtension_iff] using h #align is_cyclotomic_extension.empty IsCyclotomicExtension.empty theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ := Algebra.eq_top_iff.2 fun x => by simpa [adjoin_singleton_one] using ((isCyclotomicExtension_iff _ _ _).1 h).2 x #align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one variable {A B} theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) : IsCyclotomicExtension ∅ A B := by -- Porting note: Lean3 is able to infer `A`. refine (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => ?_⟩ rw [← h] at hx simpa using hx #align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top variable (A B) theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C] [hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C] (h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by refine ⟨fun hn => ?_, fun x => ?_⟩ · cases' hn with hn hn · obtain ⟨b, hb⟩ := ((isCyclotomicExtension_iff _ _ _).1 hS).1 hn refine ⟨algebraMap B C b, ?_⟩ exact hb.map_of_injective h · exact ((isCyclotomicExtension_iff _ _ _).1 hT).1 hn · refine adjoin_induction (((isCyclotomicExtension_iff T B _).1 hT).2 x) (fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => ?_) (fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy let f := IsScalarTower.toAlgHom A B C have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f := ⟨b, ((isCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩ rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb refine adjoin_mono (fun y hy => ?_) hb obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩ #align is_cyclotomic_extension.trans IsCyclotomicExtension.trans @[nontriviality]
Mathlib/NumberTheory/Cyclotomic/Basic.lean
154
168
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by
have : Subsingleton (Subalgebra A B) := inferInstance constructor · rintro ⟨hprim, -⟩ rw [← subset_singleton_iff_eq] intro t ht obtain ⟨ζ, hζ⟩ := hprim ht rw [mem_singleton_iff, ← PNat.coe_eq_one_iff] exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ) · rintro (rfl | rfl) -- Porting note: `R := A` was not needed. · exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩ · rw [iff_singleton] exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩
0
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
Mathlib/Data/List/Destutter.lean
92
98
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
0
import Mathlib.Algebra.ContinuedFractions.Computation.Approximations import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating import Mathlib.Data.Rat.Floor #align_import algebra.continued_fractions.computation.terminates_iff_rat from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction open GeneralizedContinuedFraction (of) variable {K : Type*} [LinearOrderedField K] [FloorRing K] attribute [local simp] Pair.map IntFractPair.mapFr section RatTranslation -- The lifting works for arbitrary linear ordered fields with a floor function. variable {v : K} {q : ℚ} (v_eq_q : v = (↑q : K)) (n : ℕ) section TerminatesOfRat namespace IntFractPair variable {q : ℚ} {n : ℕ} theorem of_inv_fr_num_lt_num_of_pos (q_pos : 0 < q) : (IntFractPair.of q⁻¹).fr.num < q.num := Rat.fract_inv_num_lt_num_of_pos q_pos #align generalized_continued_fraction.int_fract_pair.of_inv_fr_num_lt_num_of_pos GeneralizedContinuedFraction.IntFractPair.of_inv_fr_num_lt_num_of_pos theorem stream_succ_nth_fr_num_lt_nth_fr_num_rat {ifp_n ifp_succ_n : IntFractPair ℚ} (stream_nth_eq : IntFractPair.stream q n = some ifp_n) (stream_succ_nth_eq : IntFractPair.stream q (n + 1) = some ifp_succ_n) : ifp_succ_n.fr.num < ifp_n.fr.num := by obtain ⟨ifp_n', stream_nth_eq', ifp_n_fract_ne_zero, IntFractPair.of_eq_ifp_succ_n⟩ : ∃ ifp_n', IntFractPair.stream q n = some ifp_n' ∧ ifp_n'.fr ≠ 0 ∧ IntFractPair.of ifp_n'.fr⁻¹ = ifp_succ_n := succ_nth_stream_eq_some_iff.mp stream_succ_nth_eq have : ifp_n = ifp_n' := by injection Eq.trans stream_nth_eq.symm stream_nth_eq' cases this rw [← IntFractPair.of_eq_ifp_succ_n] cases' nth_stream_fr_nonneg_lt_one stream_nth_eq with zero_le_ifp_n_fract ifp_n_fract_lt_one have : 0 < ifp_n.fr := lt_of_le_of_ne zero_le_ifp_n_fract <| ifp_n_fract_ne_zero.symm exact of_inv_fr_num_lt_num_of_pos this #align generalized_continued_fraction.int_fract_pair.stream_succ_nth_fr_num_lt_nth_fr_num_rat GeneralizedContinuedFraction.IntFractPair.stream_succ_nth_fr_num_lt_nth_fr_num_rat theorem stream_nth_fr_num_le_fr_num_sub_n_rat : ∀ {ifp_n : IntFractPair ℚ}, IntFractPair.stream q n = some ifp_n → ifp_n.fr.num ≤ (IntFractPair.of q).fr.num - n := by induction n with | zero => intro ifp_zero stream_zero_eq have : IntFractPair.of q = ifp_zero := by injection stream_zero_eq simp [le_refl, this.symm] | succ n IH => intro ifp_succ_n stream_succ_nth_eq suffices ifp_succ_n.fr.num + 1 ≤ (IntFractPair.of q).fr.num - n by rw [Int.ofNat_succ, sub_add_eq_sub_sub] solve_by_elim [le_sub_right_of_add_le] rcases succ_nth_stream_eq_some_iff.mp stream_succ_nth_eq with ⟨ifp_n, stream_nth_eq, -⟩ have : ifp_succ_n.fr.num < ifp_n.fr.num := stream_succ_nth_fr_num_lt_nth_fr_num_rat stream_nth_eq stream_succ_nth_eq have : ifp_succ_n.fr.num + 1 ≤ ifp_n.fr.num := Int.add_one_le_of_lt this exact le_trans this (IH stream_nth_eq) #align generalized_continued_fraction.int_fract_pair.stream_nth_fr_num_le_fr_num_sub_n_rat GeneralizedContinuedFraction.IntFractPair.stream_nth_fr_num_le_fr_num_sub_n_rat
Mathlib/Algebra/ContinuedFractions/Computation/TerminatesIffRat.lean
315
331
theorem exists_nth_stream_eq_none_of_rat (q : ℚ) : ∃ n : ℕ, IntFractPair.stream q n = none := by
let fract_q_num := (Int.fract q).num; let n := fract_q_num.natAbs + 1 cases' stream_nth_eq : IntFractPair.stream q n with ifp · use n, stream_nth_eq · -- arrive at a contradiction since the numerator decreased num + 1 times but every fractional -- value is nonnegative. have ifp_fr_num_le_q_fr_num_sub_n : ifp.fr.num ≤ fract_q_num - n := stream_nth_fr_num_le_fr_num_sub_n_rat stream_nth_eq have : fract_q_num - n = -1 := by have : 0 ≤ fract_q_num := Rat.num_nonneg.mpr (Int.fract_nonneg q) -- Porting note: was -- simp [Int.natAbs_of_nonneg this, sub_add_eq_sub_sub_swap, sub_right_comm] simp only [n, Nat.cast_add, Int.natAbs_of_nonneg this, Nat.cast_one, sub_add_eq_sub_sub_swap, sub_right_comm, sub_self, zero_sub] have : 0 ≤ ifp.fr := (nth_stream_fr_nonneg_lt_one stream_nth_eq).left have : 0 ≤ ifp.fr.num := Rat.num_nonneg.mpr this omega
0
import Mathlib.Algebra.Polynomial.Mirror import Mathlib.Analysis.Complex.Polynomial #align_import data.polynomial.unit_trinomial from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836" namespace Polynomial open scoped Polynomial open Finset section Semiring variable {R : Type*} [Semiring R] (k m n : ℕ) (u v w : R) noncomputable def trinomial := C u * X ^ k + C v * X ^ m + C w * X ^ n #align polynomial.trinomial Polynomial.trinomial theorem trinomial_def : trinomial k m n u v w = C u * X ^ k + C v * X ^ m + C w * X ^ n := rfl #align polynomial.trinomial_def Polynomial.trinomial_def variable {k m n u v w} theorem trinomial_leading_coeff' (hkm : k < m) (hmn : m < n) : (trinomial k m n u v w).coeff n = w := by rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow, if_neg (hkm.trans hmn).ne', if_neg hmn.ne', if_pos rfl, zero_add, zero_add] #align polynomial.trinomial_leading_coeff' Polynomial.trinomial_leading_coeff' theorem trinomial_middle_coeff (hkm : k < m) (hmn : m < n) : (trinomial k m n u v w).coeff m = v := by rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow, if_neg hkm.ne', if_pos rfl, if_neg hmn.ne, zero_add, add_zero] #align polynomial.trinomial_middle_coeff Polynomial.trinomial_middle_coeff theorem trinomial_trailing_coeff' (hkm : k < m) (hmn : m < n) : (trinomial k m n u v w).coeff k = u := by rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow, if_pos rfl, if_neg hkm.ne, if_neg (hkm.trans hmn).ne, add_zero, add_zero] #align polynomial.trinomial_trailing_coeff' Polynomial.trinomial_trailing_coeff' theorem trinomial_natDegree (hkm : k < m) (hmn : m < n) (hw : w ≠ 0) : (trinomial k m n u v w).natDegree = n := by refine natDegree_eq_of_degree_eq_some ((Finset.sup_le fun i h => ?_).antisymm <| le_degree_of_ne_zero <| by rwa [trinomial_leading_coeff' hkm hmn]) replace h := support_trinomial' k m n u v w h rw [mem_insert, mem_insert, mem_singleton] at h rcases h with (rfl | rfl | rfl) · exact WithBot.coe_le_coe.mpr (hkm.trans hmn).le · exact WithBot.coe_le_coe.mpr hmn.le · exact le_rfl #align polynomial.trinomial_nat_degree Polynomial.trinomial_natDegree theorem trinomial_natTrailingDegree (hkm : k < m) (hmn : m < n) (hu : u ≠ 0) : (trinomial k m n u v w).natTrailingDegree = k := by refine natTrailingDegree_eq_of_trailingDegree_eq_some ((Finset.le_inf fun i h => ?_).antisymm <| trailingDegree_le_of_ne_zero <| by rwa [trinomial_trailing_coeff' hkm hmn]).symm replace h := support_trinomial' k m n u v w h rw [mem_insert, mem_insert, mem_singleton] at h rcases h with (rfl | rfl | rfl) · exact le_rfl · exact WithTop.coe_le_coe.mpr hkm.le · exact WithTop.coe_le_coe.mpr (hkm.trans hmn).le #align polynomial.trinomial_nat_trailing_degree Polynomial.trinomial_natTrailingDegree theorem trinomial_leadingCoeff (hkm : k < m) (hmn : m < n) (hw : w ≠ 0) : (trinomial k m n u v w).leadingCoeff = w := by rw [leadingCoeff, trinomial_natDegree hkm hmn hw, trinomial_leading_coeff' hkm hmn] #align polynomial.trinomial_leading_coeff Polynomial.trinomial_leadingCoeff theorem trinomial_trailingCoeff (hkm : k < m) (hmn : m < n) (hu : u ≠ 0) : (trinomial k m n u v w).trailingCoeff = u := by rw [trailingCoeff, trinomial_natTrailingDegree hkm hmn hu, trinomial_trailing_coeff' hkm hmn] #align polynomial.trinomial_trailing_coeff Polynomial.trinomial_trailingCoeff theorem trinomial_monic (hkm : k < m) (hmn : m < n) : (trinomial k m n u v 1).Monic := by nontriviality R exact trinomial_leadingCoeff hkm hmn one_ne_zero #align polynomial.trinomial_monic Polynomial.trinomial_monic
Mathlib/Algebra/Polynomial/UnitTrinomial.lean
110
117
theorem trinomial_mirror (hkm : k < m) (hmn : m < n) (hu : u ≠ 0) (hw : w ≠ 0) : (trinomial k m n u v w).mirror = trinomial k (n - m + k) n w v u := by
rw [mirror, trinomial_natTrailingDegree hkm hmn hu, reverse, trinomial_natDegree hkm hmn hw, trinomial_def, reflect_add, reflect_add, reflect_C_mul_X_pow, reflect_C_mul_X_pow, reflect_C_mul_X_pow, revAt_le (hkm.trans hmn).le, revAt_le hmn.le, revAt_le le_rfl, add_mul, add_mul, mul_assoc, mul_assoc, mul_assoc, ← pow_add, ← pow_add, ← pow_add, Nat.sub_add_cancel (hkm.trans hmn).le, Nat.sub_self, zero_add, add_comm, add_comm (C u * X ^ n), ← add_assoc, ← trinomial_def]
0
import Mathlib.AlgebraicGeometry.AffineScheme import Mathlib.RingTheory.Nilpotent.Lemmas import Mathlib.Topology.Sheaves.SheafCondition.Sites import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.properties from "leanprover-community/mathlib"@"88474d1b5af6d37c2ab728b757771bced7f5194c" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open TopologicalSpace Opposite CategoryTheory CategoryTheory.Limits TopCat namespace AlgebraicGeometry variable (X : Scheme) instance : T0Space X.carrier := by refine T0Space.of_open_cover fun x => ?_ obtain ⟨U, R, ⟨e⟩⟩ := X.local_affine x let e' : U.1 ≃ₜ PrimeSpectrum R := homeoOfIso ((LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forget _).mapIso e) exact ⟨U.1.1, U.2, U.1.2, e'.embedding.t0Space⟩ instance : QuasiSober X.carrier := by apply (config := { allowSynthFailures := true }) quasiSober_of_open_cover (Set.range fun x => Set.range <| (X.affineCover.map x).1.base) · rintro ⟨_, i, rfl⟩; exact (X.affineCover.IsOpen i).base_open.isOpen_range · rintro ⟨_, i, rfl⟩ exact @OpenEmbedding.quasiSober _ _ _ _ _ (Homeomorph.ofEmbedding _ (X.affineCover.IsOpen i).base_open.toEmbedding).symm.openEmbedding PrimeSpectrum.quasiSober · rw [Set.top_eq_univ, Set.sUnion_range, Set.eq_univ_iff_forall] intro x; exact ⟨_, ⟨_, rfl⟩, X.affineCover.Covers x⟩ class IsReduced : Prop where component_reduced : ∀ U, IsReduced (X.presheaf.obj (op U)) := by infer_instance #align algebraic_geometry.is_reduced AlgebraicGeometry.IsReduced attribute [instance] IsReduced.component_reduced
Mathlib/AlgebraicGeometry/Properties.lean
61
68
theorem isReducedOfStalkIsReduced [∀ x : X.carrier, _root_.IsReduced (X.presheaf.stalk x)] : IsReduced X := by
refine ⟨fun U => ⟨fun s hs => ?_⟩⟩ apply Presheaf.section_ext X.sheaf U s 0 intro x rw [RingHom.map_zero] change X.presheaf.germ x s = 0 exact (hs.map _).eq_zero
0
import Mathlib.RingTheory.Flat.Basic import Mathlib.LinearAlgebra.TensorProduct.Vanishing import Mathlib.Algebra.Module.FinitePresentation universe u variable {R M : Type u} [CommRing R] [AddCommGroup M] [Module R M] open Classical DirectSum LinearMap TensorProduct Finsupp open scoped BigOperators namespace Module variable {ι : Type u} [Fintype ι] (f : ι → R) (x : ι → M) abbrev IsTrivialRelation : Prop := ∃ (κ : Type u) (_ : Fintype κ) (a : ι → κ → R) (y : κ → M), (∀ i, x i = ∑ j, a i j • y j) ∧ ∀ j, ∑ i, f i * a i j = 0 variable {f x} theorem isTrivialRelation_iff_vanishesTrivially : IsTrivialRelation f x ↔ VanishesTrivially R f x := by simp only [IsTrivialRelation, VanishesTrivially, smul_eq_mul, mul_comm]
Mathlib/RingTheory/Flat/EquationalCriterion.lean
88
92
theorem sum_smul_eq_zero_of_isTrivialRelation (h : IsTrivialRelation f x) : ∑ i, f i • x i = 0 := by
simpa using congr_arg (TensorProduct.lid R M) <| sum_tmul_eq_zero_of_vanishesTrivially R (isTrivialRelation_iff_vanishesTrivially.mp h)
0
import Mathlib.GroupTheory.Sylow import Mathlib.GroupTheory.Transfer #align_import group_theory.schur_zassenhaus from "leanprover-community/mathlib"@"d57133e49cf06508700ef69030cd099917e0f0de" namespace Subgroup section SchurZassenhausAbelian open MulOpposite MulAction Subgroup.leftTransversals MemLeftTransversals variable {G : Type*} [Group G] (H : Subgroup G) [IsCommutative H] [FiniteIndex H] (α β : leftTransversals (H : Set G)) def QuotientDiff := Quotient (Setoid.mk (fun α β => diff (MonoidHom.id H) α β = 1) ⟨fun α => diff_self (MonoidHom.id H) α, fun h => by rw [← diff_inv, h, inv_one], fun h h' => by rw [← diff_mul_diff, h, h', one_mul]⟩) #align subgroup.quotient_diff Subgroup.QuotientDiff instance : Inhabited H.QuotientDiff := by dsimp [QuotientDiff] -- Porting note: Added `dsimp` infer_instance theorem smul_diff_smul' [hH : Normal H] (g : Gᵐᵒᵖ) : diff (MonoidHom.id H) (g • α) (g • β) = ⟨g.unop⁻¹ * (diff (MonoidHom.id H) α β : H) * g.unop, hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩ := by letI := H.fintypeQuotientOfFiniteIndex let ϕ : H →* H := { toFun := fun h => ⟨g.unop⁻¹ * h * g.unop, hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩ map_one' := by rw [Subtype.ext_iff, coe_mk, coe_one, mul_one, inv_mul_self] map_mul' := fun h₁ h₂ => by simp only [Subtype.ext_iff, coe_mk, coe_mul, mul_assoc, mul_inv_cancel_left] } refine (Fintype.prod_equiv (MulAction.toPerm g).symm _ _ fun x ↦ ?_).trans (map_prod ϕ _ _).symm simp only [ϕ, smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, mul_inv_rev, mul_assoc, MonoidHom.id_apply, toPerm_symm_apply, MonoidHom.coe_mk, OneHom.coe_mk] #align subgroup.smul_diff_smul' Subgroup.smul_diff_smul' variable {H} [Normal H] noncomputable instance : MulAction G H.QuotientDiff where smul g := Quotient.map' (fun α => op g⁻¹ • α) fun α β h => Subtype.ext (by rwa [smul_diff_smul', coe_mk, coe_one, mul_eq_one_iff_eq_inv, mul_right_eq_self, ← coe_one, ← Subtype.ext_iff]) mul_smul g₁ g₂ q := Quotient.inductionOn' q fun T => congr_arg Quotient.mk'' (by rw [mul_inv_rev]; exact mul_smul (op g₁⁻¹) (op g₂⁻¹) T) one_smul q := Quotient.inductionOn' q fun T => congr_arg Quotient.mk'' (by rw [inv_one]; apply one_smul Gᵐᵒᵖ T) theorem smul_diff' (h : H) : diff (MonoidHom.id H) α (op (h : G) • β) = diff (MonoidHom.id H) α β * h ^ H.index := by letI := H.fintypeQuotientOfFiniteIndex rw [diff, diff, index_eq_card, ← Finset.card_univ, ← Finset.prod_const, ← Finset.prod_mul_distrib] refine Finset.prod_congr rfl fun q _ => ?_ simp_rw [Subtype.ext_iff, MonoidHom.id_apply, coe_mul, mul_assoc, mul_right_inj] rw [smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, MulOpposite.unop_op, mul_left_inj, ← Subtype.ext_iff, Equiv.apply_eq_iff_eq, inv_smul_eq_iff] exact self_eq_mul_right.mpr ((QuotientGroup.eq_one_iff _).mpr h.2) #align subgroup.smul_diff' Subgroup.smul_diff'
Mathlib/GroupTheory/SchurZassenhaus.lean
92
99
theorem eq_one_of_smul_eq_one (hH : Nat.Coprime (Nat.card H) H.index) (α : H.QuotientDiff) (h : H) : h • α = α → h = 1 := Quotient.inductionOn' α fun α hα => (powCoprime hH).injective <| calc h ^ H.index = diff (MonoidHom.id H) (op ((h⁻¹ : H) : G) • α) α := by
rw [← diff_inv, smul_diff', diff_self, one_mul, inv_pow, inv_inv] _ = 1 ^ H.index := (Quotient.exact' hα).trans (one_pow H.index).symm
0
import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.Algebra.Module.ULift #align_import ring_theory.is_tensor_product from "leanprover-community/mathlib"@"c4926d76bb9c5a4a62ed2f03d998081786132105" universe u v₁ v₂ v₃ v₄ open TensorProduct section IsTensorProduct variable {R : Type*} [CommSemiring R] variable {M₁ M₂ M M' : Type*} variable [AddCommMonoid M₁] [AddCommMonoid M₂] [AddCommMonoid M] [AddCommMonoid M'] variable [Module R M₁] [Module R M₂] [Module R M] [Module R M'] variable (f : M₁ →ₗ[R] M₂ →ₗ[R] M) variable {N₁ N₂ N : Type*} [AddCommMonoid N₁] [AddCommMonoid N₂] [AddCommMonoid N] variable [Module R N₁] [Module R N₂] [Module R N] variable {g : N₁ →ₗ[R] N₂ →ₗ[R] N} def IsTensorProduct : Prop := Function.Bijective (TensorProduct.lift f) #align is_tensor_product IsTensorProduct variable (R M N) {f} theorem TensorProduct.isTensorProduct : IsTensorProduct (TensorProduct.mk R M N) := by delta IsTensorProduct convert_to Function.Bijective (LinearMap.id : M ⊗[R] N →ₗ[R] M ⊗[R] N) using 2 · apply TensorProduct.ext' simp · exact Function.bijective_id #align tensor_product.is_tensor_product TensorProduct.isTensorProduct variable {R M N} @[simps! apply] noncomputable def IsTensorProduct.equiv (h : IsTensorProduct f) : M₁ ⊗[R] M₂ ≃ₗ[R] M := LinearEquiv.ofBijective _ h #align is_tensor_product.equiv IsTensorProduct.equiv @[simp] theorem IsTensorProduct.equiv_toLinearMap (h : IsTensorProduct f) : h.equiv.toLinearMap = TensorProduct.lift f := rfl #align is_tensor_product.equiv_to_linear_map IsTensorProduct.equiv_toLinearMap @[simp] theorem IsTensorProduct.equiv_symm_apply (h : IsTensorProduct f) (x₁ : M₁) (x₂ : M₂) : h.equiv.symm (f x₁ x₂) = x₁ ⊗ₜ x₂ := by apply h.equiv.injective refine (h.equiv.apply_symm_apply _).trans ?_ simp #align is_tensor_product.equiv_symm_apply IsTensorProduct.equiv_symm_apply noncomputable def IsTensorProduct.lift (h : IsTensorProduct f) (f' : M₁ →ₗ[R] M₂ →ₗ[R] M') : M →ₗ[R] M' := (TensorProduct.lift f').comp h.equiv.symm.toLinearMap #align is_tensor_product.lift IsTensorProduct.lift theorem IsTensorProduct.lift_eq (h : IsTensorProduct f) (f' : M₁ →ₗ[R] M₂ →ₗ[R] M') (x₁ : M₁) (x₂ : M₂) : h.lift f' (f x₁ x₂) = f' x₁ x₂ := by delta IsTensorProduct.lift simp #align is_tensor_product.lift_eq IsTensorProduct.lift_eq noncomputable def IsTensorProduct.map (hf : IsTensorProduct f) (hg : IsTensorProduct g) (i₁ : M₁ →ₗ[R] N₁) (i₂ : M₂ →ₗ[R] N₂) : M →ₗ[R] N := hg.equiv.toLinearMap.comp ((TensorProduct.map i₁ i₂).comp hf.equiv.symm.toLinearMap) #align is_tensor_product.map IsTensorProduct.map theorem IsTensorProduct.map_eq (hf : IsTensorProduct f) (hg : IsTensorProduct g) (i₁ : M₁ →ₗ[R] N₁) (i₂ : M₂ →ₗ[R] N₂) (x₁ : M₁) (x₂ : M₂) : hf.map hg i₁ i₂ (f x₁ x₂) = g (i₁ x₁) (i₂ x₂) := by delta IsTensorProduct.map simp #align is_tensor_product.map_eq IsTensorProduct.map_eq
Mathlib/RingTheory/IsTensorProduct.lean
115
127
theorem IsTensorProduct.inductionOn (h : IsTensorProduct f) {C : M → Prop} (m : M) (h0 : C 0) (htmul : ∀ x y, C (f x y)) (hadd : ∀ x y, C x → C y → C (x + y)) : C m := by
rw [← h.equiv.right_inv m] generalize h.equiv.invFun m = y change C (TensorProduct.lift f y) induction y using TensorProduct.induction_on with | zero => rwa [map_zero] | tmul _ _ => rw [TensorProduct.lift.tmul] apply htmul | add _ _ _ _ => rw [map_add] apply hadd <;> assumption
0
import Mathlib.Data.Multiset.Powerset #align_import data.multiset.antidiagonal from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" assert_not_exists Ring universe u namespace Multiset open List variable {α β : Type*} def antidiagonal (s : Multiset α) : Multiset (Multiset α × Multiset α) := Quot.liftOn s (fun l ↦ (revzip (powersetAux l) : Multiset (Multiset α × Multiset α))) fun _ _ h ↦ Quot.sound (revzip_powersetAux_perm h) #align multiset.antidiagonal Multiset.antidiagonal theorem antidiagonal_coe (l : List α) : @antidiagonal α l = revzip (powersetAux l) := rfl #align multiset.antidiagonal_coe Multiset.antidiagonal_coe @[simp] theorem antidiagonal_coe' (l : List α) : @antidiagonal α l = revzip (powersetAux' l) := Quot.sound revzip_powersetAux_perm_aux' #align multiset.antidiagonal_coe' Multiset.antidiagonal_coe' @[simp] theorem mem_antidiagonal {s : Multiset α} {x : Multiset α × Multiset α} : x ∈ antidiagonal s ↔ x.1 + x.2 = s := Quotient.inductionOn s fun l ↦ by dsimp only [quot_mk_to_coe, antidiagonal_coe] refine ⟨fun h => revzip_powersetAux h, fun h ↦ ?_⟩ haveI := Classical.decEq α simp only [revzip_powersetAux_lemma l revzip_powersetAux, h.symm, ge_iff_le, mem_coe, List.mem_map, mem_powersetAux] cases' x with x₁ x₂ exact ⟨x₁, le_add_right _ _, by rw [add_tsub_cancel_left x₁ x₂]⟩ #align multiset.mem_antidiagonal Multiset.mem_antidiagonal @[simp] theorem antidiagonal_map_fst (s : Multiset α) : (antidiagonal s).map Prod.fst = powerset s := Quotient.inductionOn s fun l ↦ by simp [powersetAux']; #align multiset.antidiagonal_map_fst Multiset.antidiagonal_map_fst @[simp] theorem antidiagonal_map_snd (s : Multiset α) : (antidiagonal s).map Prod.snd = powerset s := Quotient.inductionOn s fun l ↦ by simp [powersetAux'] #align multiset.antidiagonal_map_snd Multiset.antidiagonal_map_snd @[simp] theorem antidiagonal_zero : @antidiagonal α 0 = {(0, 0)} := rfl #align multiset.antidiagonal_zero Multiset.antidiagonal_zero @[simp] theorem antidiagonal_cons (a : α) (s) : antidiagonal (a ::ₘ s) = map (Prod.map id (cons a)) (antidiagonal s) + map (Prod.map (cons a) id) (antidiagonal s) := Quotient.inductionOn s fun l ↦ by simp only [revzip, reverse_append, quot_mk_to_coe, coe_eq_coe, powersetAux'_cons, cons_coe, map_coe, antidiagonal_coe', coe_add] rw [← zip_map, ← zip_map, zip_append, (_ : _ ++ _ = _)] · congr · simp only [List.map_id] · rw [map_reverse] · simp · simp #align multiset.antidiagonal_cons Multiset.antidiagonal_cons theorem antidiagonal_eq_map_powerset [DecidableEq α] (s : Multiset α) : s.antidiagonal = s.powerset.map fun t ↦ (s - t, t) := by induction' s using Multiset.induction_on with a s hs · simp only [antidiagonal_zero, powerset_zero, zero_tsub, map_singleton] · simp_rw [antidiagonal_cons, powerset_cons, map_add, hs, map_map, Function.comp, Prod.map_mk, id, sub_cons, erase_cons_head] rw [add_comm] congr 1 refine Multiset.map_congr rfl fun x hx ↦ ?_ rw [cons_sub_of_le _ (mem_powerset.mp hx)] #align multiset.antidiagonal_eq_map_powerset Multiset.antidiagonal_eq_map_powerset @[simp]
Mathlib/Data/Multiset/Antidiagonal.lean
103
105
theorem card_antidiagonal (s : Multiset α) : card (antidiagonal s) = 2 ^ card s := by
have := card_powerset s rwa [← antidiagonal_map_fst, card_map] at this
0
import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Combinatorics.Hall.Basic import Mathlib.Data.Fintype.BigOperators import Mathlib.SetTheory.Cardinal.Finite #align_import combinatorics.configuration from "leanprover-community/mathlib"@"d2d8742b0c21426362a9dacebc6005db895ca963" open Finset namespace Configuration variable (P L : Type*) [Membership P L] def Dual := P #align configuration.dual Configuration.Dual -- Porting note: was `this` instead of `h` instance [h : Inhabited P] : Inhabited (Dual P) := h instance [Finite P] : Finite (Dual P) := ‹Finite P› -- Porting note: was `this` instead of `h` instance [h : Fintype P] : Fintype (Dual P) := h -- Porting note (#11215): TODO: figure out if this is needed. set_option synthInstance.checkSynthOrder false in instance : Membership (Dual L) (Dual P) := ⟨Function.swap (Membership.mem : P → L → Prop)⟩ class Nondegenerate : Prop where exists_point : ∀ l : L, ∃ p, p ∉ l exists_line : ∀ p, ∃ l : L, p ∉ l eq_or_eq : ∀ {p₁ p₂ : P} {l₁ l₂ : L}, p₁ ∈ l₁ → p₂ ∈ l₁ → p₁ ∈ l₂ → p₂ ∈ l₂ → p₁ = p₂ ∨ l₁ = l₂ #align configuration.nondegenerate Configuration.Nondegenerate class HasPoints extends Nondegenerate P L where mkPoint : ∀ {l₁ l₂ : L}, l₁ ≠ l₂ → P mkPoint_ax : ∀ {l₁ l₂ : L} (h : l₁ ≠ l₂), mkPoint h ∈ l₁ ∧ mkPoint h ∈ l₂ #align configuration.has_points Configuration.HasPoints class HasLines extends Nondegenerate P L where mkLine : ∀ {p₁ p₂ : P}, p₁ ≠ p₂ → L mkLine_ax : ∀ {p₁ p₂ : P} (h : p₁ ≠ p₂), p₁ ∈ mkLine h ∧ p₂ ∈ mkLine h #align configuration.has_lines Configuration.HasLines open Nondegenerate open HasPoints (mkPoint mkPoint_ax) open HasLines (mkLine mkLine_ax) instance Dual.Nondegenerate [Nondegenerate P L] : Nondegenerate (Dual L) (Dual P) where exists_point := @exists_line P L _ _ exists_line := @exists_point P L _ _ eq_or_eq := @fun l₁ l₂ p₁ p₂ h₁ h₂ h₃ h₄ => (@eq_or_eq P L _ _ p₁ p₂ l₁ l₂ h₁ h₃ h₂ h₄).symm instance Dual.hasLines [HasPoints P L] : HasLines (Dual L) (Dual P) := { Dual.Nondegenerate _ _ with mkLine := @mkPoint P L _ _ mkLine_ax := @mkPoint_ax P L _ _ } instance Dual.hasPoints [HasLines P L] : HasPoints (Dual L) (Dual P) := { Dual.Nondegenerate _ _ with mkPoint := @mkLine P L _ _ mkPoint_ax := @mkLine_ax P L _ _ } theorem HasPoints.existsUnique_point [HasPoints P L] (l₁ l₂ : L) (hl : l₁ ≠ l₂) : ∃! p, p ∈ l₁ ∧ p ∈ l₂ := ⟨mkPoint hl, mkPoint_ax hl, fun _ hp => (eq_or_eq hp.1 (mkPoint_ax hl).1 hp.2 (mkPoint_ax hl).2).resolve_right hl⟩ #align configuration.has_points.exists_unique_point Configuration.HasPoints.existsUnique_point theorem HasLines.existsUnique_line [HasLines P L] (p₁ p₂ : P) (hp : p₁ ≠ p₂) : ∃! l : L, p₁ ∈ l ∧ p₂ ∈ l := HasPoints.existsUnique_point (Dual L) (Dual P) p₁ p₂ hp #align configuration.has_lines.exists_unique_line Configuration.HasLines.existsUnique_line variable {P L}
Mathlib/Combinatorics/Configuration.lean
125
166
theorem Nondegenerate.exists_injective_of_card_le [Nondegenerate P L] [Fintype P] [Fintype L] (h : Fintype.card L ≤ Fintype.card P) : ∃ f : L → P, Function.Injective f ∧ ∀ l, f l ∉ l := by
classical let t : L → Finset P := fun l => Set.toFinset { p | p ∉ l } suffices ∀ s : Finset L, s.card ≤ (s.biUnion t).card by -- Hall's marriage theorem obtain ⟨f, hf1, hf2⟩ := (Finset.all_card_le_biUnion_card_iff_exists_injective t).mp this exact ⟨f, hf1, fun l => Set.mem_toFinset.mp (hf2 l)⟩ intro s by_cases hs₀ : s.card = 0 -- If `s = ∅`, then `s.card = 0 ≤ (s.bUnion t).card` · simp_rw [hs₀, zero_le] by_cases hs₁ : s.card = 1 -- If `s = {l}`, then pick a point `p ∉ l` · obtain ⟨l, rfl⟩ := Finset.card_eq_one.mp hs₁ obtain ⟨p, hl⟩ := exists_point l rw [Finset.card_singleton, Finset.singleton_biUnion, Nat.one_le_iff_ne_zero] exact Finset.card_ne_zero_of_mem (Set.mem_toFinset.mpr hl) suffices (s.biUnion t)ᶜ.card ≤ sᶜ.card by -- Rephrase in terms of complements (uses `h`) rw [Finset.card_compl, Finset.card_compl, tsub_le_iff_left] at this replace := h.trans this rwa [← add_tsub_assoc_of_le s.card_le_univ, le_tsub_iff_left (le_add_left s.card_le_univ), add_le_add_iff_right] at this have hs₂ : (s.biUnion t)ᶜ.card ≤ 1 := by -- At most one line through two points of `s` refine Finset.card_le_one_iff.mpr @fun p₁ p₂ hp₁ hp₂ => ?_ simp_rw [t, Finset.mem_compl, Finset.mem_biUnion, not_exists, not_and, Set.mem_toFinset, Set.mem_setOf_eq, Classical.not_not] at hp₁ hp₂ obtain ⟨l₁, l₂, hl₁, hl₂, hl₃⟩ := Finset.one_lt_card_iff.mp (Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hs₀, hs₁⟩) exact (eq_or_eq (hp₁ l₁ hl₁) (hp₂ l₁ hl₁) (hp₁ l₂ hl₂) (hp₂ l₂ hl₂)).resolve_right hl₃ by_cases hs₃ : sᶜ.card = 0 · rw [hs₃, Nat.le_zero] rw [Finset.card_compl, tsub_eq_zero_iff_le, LE.le.le_iff_eq (Finset.card_le_univ _), eq_comm, Finset.card_eq_iff_eq_univ] at hs₃ ⊢ rw [hs₃] rw [Finset.eq_univ_iff_forall] at hs₃ ⊢ exact fun p => Exists.elim (exists_line p)-- If `s = univ`, then show `s.bUnion t = univ` fun l hl => Finset.mem_biUnion.mpr ⟨l, Finset.mem_univ l, Set.mem_toFinset.mpr hl⟩ · exact hs₂.trans (Nat.one_le_iff_ne_zero.mpr hs₃)
0
import Mathlib.Algebra.BigOperators.Associated import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.Data.Nat.Choose.Dvd import Mathlib.Data.Nat.Prime #align_import number_theory.primorial from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" open Finset open Nat open Nat def primorial (n : ℕ) : ℕ := ∏ p ∈ filter Nat.Prime (range (n + 1)), p #align primorial primorial local notation x "#" => primorial x theorem primorial_pos (n : ℕ) : 0 < n# := prod_pos fun _p hp ↦ (mem_filter.1 hp).2.pos #align primorial_pos primorial_pos theorem primorial_succ {n : ℕ} (hn1 : n ≠ 1) (hn : Odd n) : (n + 1)# = n# := by refine prod_congr ?_ fun _ _ ↦ rfl rw [range_succ, filter_insert, if_neg fun h ↦ odd_iff_not_even.mp hn _] exact fun h ↦ h.even_sub_one <| mt succ.inj hn1 #align primorial_succ primorial_succ theorem primorial_add (m n : ℕ) : (m + n)# = m# * ∏ p ∈ filter Nat.Prime (Ico (m + 1) (m + n + 1)), p := by rw [primorial, primorial, ← Ico_zero_eq_range, ← prod_union, ← filter_union, Ico_union_Ico_eq_Ico] exacts [Nat.zero_le _, add_le_add_right (Nat.le_add_right _ _) _, disjoint_filter_filter <| Ico_disjoint_Ico_consecutive _ _ _] #align primorial_add primorial_add theorem primorial_add_dvd {m n : ℕ} (h : n ≤ m) : (m + n)# ∣ m# * choose (m + n) m := calc (m + n)# = m# * ∏ p ∈ filter Nat.Prime (Ico (m + 1) (m + n + 1)), p := primorial_add _ _ _ ∣ m# * choose (m + n) m := mul_dvd_mul_left _ <| prod_primes_dvd _ (fun k hk ↦ (mem_filter.1 hk).2.prime) fun p hp ↦ by rw [mem_filter, mem_Ico] at hp exact hp.2.dvd_choose_add hp.1.1 (h.trans_lt (m.lt_succ_self.trans_le hp.1.1)) (Nat.lt_succ_iff.1 hp.1.2) #align primorial_add_dvd primorial_add_dvd theorem primorial_add_le {m n : ℕ} (h : n ≤ m) : (m + n)# ≤ m# * choose (m + n) m := le_of_dvd (mul_pos (primorial_pos _) (choose_pos <| Nat.le_add_right _ _)) (primorial_add_dvd h) #align primorial_add_le primorial_add_le
Mathlib/NumberTheory/Primorial.lean
73
91
theorem primorial_le_4_pow (n : ℕ) : n# ≤ 4 ^ n := by
induction' n using Nat.strong_induction_on with n ihn cases' n with n; · rfl rcases n.even_or_odd with (⟨m, rfl⟩ | ho) · rcases m.eq_zero_or_pos with (rfl | hm) · decide calc (m + m + 1)# = (m + 1 + m)# := by rw [add_right_comm] _ ≤ (m + 1)# * choose (m + 1 + m) (m + 1) := primorial_add_le m.le_succ _ = (m + 1)# * choose (2 * m + 1) m := by rw [choose_symm_add, two_mul, add_right_comm] _ ≤ 4 ^ (m + 1) * 4 ^ m := mul_le_mul' (ihn _ <| succ_lt_succ <| (lt_add_iff_pos_left _).2 hm) (choose_middle_le_pow _) _ ≤ 4 ^ (m + m + 1) := by rw [← pow_add, add_right_comm] · rcases Decidable.eq_or_ne n 1 with (rfl | hn) · decide · calc (n + 1)# = n# := primorial_succ hn ho _ ≤ 4 ^ n := ihn n n.lt_succ_self _ ≤ 4 ^ (n + 1) := pow_le_pow_of_le_right four_pos n.le_succ
0
import Mathlib.Order.CompleteLattice import Mathlib.Order.GaloisConnection import Mathlib.Data.Set.Lattice import Mathlib.Tactic.AdaptationNote #align_import data.rel from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2" variable {α β γ : Type*} def Rel (α β : Type*) := α → β → Prop -- deriving CompleteLattice, Inhabited #align rel Rel -- Porting note: `deriving` above doesn't work. instance : CompleteLattice (Rel α β) := show CompleteLattice (α → β → Prop) from inferInstance instance : Inhabited (Rel α β) := show Inhabited (α → β → Prop) from inferInstance namespace Rel variable (r : Rel α β) -- Porting note: required for later theorems. @[ext] theorem ext {r s : Rel α β} : (∀ a, r a = s a) → r = s := funext def inv : Rel β α := flip r #align rel.inv Rel.inv theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y := Iff.rfl #align rel.inv_def Rel.inv_def theorem inv_inv : inv (inv r) = r := by ext x y rfl #align rel.inv_inv Rel.inv_inv def dom := { x | ∃ y, r x y } #align rel.dom Rel.dom theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s := fun a ⟨b, hx⟩ => ⟨b, h a b hx⟩ #align rel.dom_mono Rel.dom_mono def codom := { y | ∃ x, r x y } #align rel.codom Rel.codom theorem codom_inv : r.inv.codom = r.dom := by ext x rfl #align rel.codom_inv Rel.codom_inv theorem dom_inv : r.inv.dom = r.codom := by ext x rfl #align rel.dom_inv Rel.dom_inv def comp (r : Rel α β) (s : Rel β γ) : Rel α γ := fun x z => ∃ y, r x y ∧ s y z #align rel.comp Rel.comp -- Porting note: the original `∘` syntax can't be overloaded here, lean considers it ambiguous. local infixr:90 " • " => Rel.comp theorem comp_assoc {δ : Type*} (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) : (r • s) • t = r • (s • t) := by unfold comp; ext (x w); constructor · rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩; exact ⟨y, rxy, z, syz, tzw⟩ · rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩ #align rel.comp_assoc Rel.comp_assoc @[simp] theorem comp_right_id (r : Rel α β) : r • @Eq β = r := by unfold comp ext y simp #align rel.comp_right_id Rel.comp_right_id @[simp] theorem comp_left_id (r : Rel α β) : @Eq α • r = r := by unfold comp ext x simp #align rel.comp_left_id Rel.comp_left_id @[simp]
Mathlib/Data/Rel.lean
126
128
theorem comp_right_bot (r : Rel α β) : r • (⊥ : Rel β γ) = ⊥ := by
ext x y simp [comp, Bot.bot]
0
import Mathlib.RingTheory.LocalProperties import Mathlib.RingTheory.Localization.InvSubmonoid #align_import ring_theory.ring_hom.finite_type from "leanprover-community/mathlib"@"64fc7238fb41b1a4f12ff05e3d5edfa360dd768c" namespace RingHom open scoped Pointwise theorem finiteType_stableUnderComposition : StableUnderComposition @FiniteType := by introv R hf hg exact hg.comp hf #align ring_hom.finite_type_stable_under_composition RingHom.finiteType_stableUnderComposition
Mathlib/RingTheory/RingHom/FiniteType.lean
29
35
theorem finiteType_holdsForLocalizationAway : HoldsForLocalizationAway @FiniteType := by
introv R _ suffices Algebra.FiniteType R S by rw [RingHom.FiniteType] convert this; ext; rw [Algebra.smul_def]; rfl exact IsLocalization.finiteType_of_monoid_fg (Submonoid.powers r) S
0
import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import measure_theory.measure.lebesgue.integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
Mathlib/MeasureTheory/Measure/Lebesgue/Integral.lean
85
91
theorem integral_comp_neg_Iic {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (c : ℝ) (f : ℝ → E) : (∫ x in Iic c, f (-x)) = ∫ x in Ioi (-c), f x := by
have A : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).closedEmbedding.measurableEmbedding have := MeasurableEmbedding.setIntegral_map (μ := volume) A f (Ici (-c)) rw [Measure.map_neg_eq_self (volume : Measure ℝ)] at this simp_rw [← integral_Ici_eq_integral_Ioi, this, neg_preimage, preimage_neg_Ici, neg_neg]
0
import Mathlib.Data.PFunctor.Univariate.Basic #align_import data.pfunctor.univariate.M from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" universe u v w open Nat Function open List variable (F : PFunctor.{u}) -- Porting note: the ♯ tactic is never used -- local prefix:0 "♯" => cast (by first |simp [*]|cc|solve_by_elim) namespace PFunctor namespace Approx inductive CofixA : ℕ → Type u | continue : CofixA 0 | intro {n} : ∀ a, (F.B a → CofixA n) → CofixA (succ n) #align pfunctor.approx.cofix_a PFunctor.Approx.CofixA protected def CofixA.default [Inhabited F.A] : ∀ n, CofixA F n | 0 => CofixA.continue | succ n => CofixA.intro default fun _ => CofixA.default n #align pfunctor.approx.cofix_a.default PFunctor.Approx.CofixA.default instance [Inhabited F.A] {n} : Inhabited (CofixA F n) := ⟨CofixA.default F n⟩ theorem cofixA_eq_zero : ∀ x y : CofixA F 0, x = y | CofixA.continue, CofixA.continue => rfl #align pfunctor.approx.cofix_a_eq_zero PFunctor.Approx.cofixA_eq_zero variable {F} def head' : ∀ {n}, CofixA F (succ n) → F.A | _, CofixA.intro i _ => i #align pfunctor.approx.head' PFunctor.Approx.head' def children' : ∀ {n} (x : CofixA F (succ n)), F.B (head' x) → CofixA F n | _, CofixA.intro _ f => f #align pfunctor.approx.children' PFunctor.Approx.children' theorem approx_eta {n : ℕ} (x : CofixA F (n + 1)) : x = CofixA.intro (head' x) (children' x) := by cases x; rfl #align pfunctor.approx.approx_eta PFunctor.Approx.approx_eta inductive Agree : ∀ {n : ℕ}, CofixA F n → CofixA F (n + 1) → Prop | continu (x : CofixA F 0) (y : CofixA F 1) : Agree x y | intro {n} {a} (x : F.B a → CofixA F n) (x' : F.B a → CofixA F (n + 1)) : (∀ i : F.B a, Agree (x i) (x' i)) → Agree (CofixA.intro a x) (CofixA.intro a x') #align pfunctor.approx.agree PFunctor.Approx.Agree def AllAgree (x : ∀ n, CofixA F n) := ∀ n, Agree (x n) (x (succ n)) #align pfunctor.approx.all_agree PFunctor.Approx.AllAgree @[simp] theorem agree_trival {x : CofixA F 0} {y : CofixA F 1} : Agree x y := by constructor #align pfunctor.approx.agree_trival PFunctor.Approx.agree_trival theorem agree_children {n : ℕ} (x : CofixA F (succ n)) (y : CofixA F (succ n + 1)) {i j} (h₀ : HEq i j) (h₁ : Agree x y) : Agree (children' x i) (children' y j) := by cases' h₁ with _ _ _ _ _ _ hagree; cases h₀ apply hagree #align pfunctor.approx.agree_children PFunctor.Approx.agree_children def truncate : ∀ {n : ℕ}, CofixA F (n + 1) → CofixA F n | 0, CofixA.intro _ _ => CofixA.continue | succ _, CofixA.intro i f => CofixA.intro i <| truncate ∘ f #align pfunctor.approx.truncate PFunctor.Approx.truncate
Mathlib/Data/PFunctor/Univariate/M.lean
101
115
theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n)) (h : Agree x y) : truncate y = x := by
induction n <;> cases x <;> cases y · rfl · -- cases' h with _ _ _ _ _ h₀ h₁ cases h simp only [truncate, Function.comp, true_and_iff, eq_self_iff_true, heq_iff_eq] -- Porting note: used to be `ext y` rename_i n_ih a f y h₁ suffices (fun x => truncate (y x)) = f by simp [this] funext y apply n_ih apply h₁
0
import Mathlib.CategoryTheory.Generator import Mathlib.CategoryTheory.Limits.ConeCategory import Mathlib.CategoryTheory.Limits.Constructions.WeaklyInitial import Mathlib.CategoryTheory.Limits.FunctorCategory import Mathlib.CategoryTheory.Subobject.Comma #align_import category_theory.adjunction.adjoint_functor_theorems from "leanprover-community/mathlib"@"361aa777b4d262212c31d7c4a245ccb23645c156" universe v u u' namespace CategoryTheory open Limits variable {J : Type v} variable {C : Type u} [Category.{v} C] def SolutionSetCondition {D : Type u} [Category.{v} D] (G : D ⥤ C) : Prop := ∀ A : C, ∃ (ι : Type v) (B : ι → D) (f : ∀ i : ι, A ⟶ G.obj (B i)), ∀ (X) (h : A ⟶ G.obj X), ∃ (i : ι) (g : B i ⟶ X), f i ≫ G.map g = h #align category_theory.solution_set_condition CategoryTheory.SolutionSetCondition section GeneralAdjointFunctorTheorem variable {D : Type u} [Category.{v} D] variable (G : D ⥤ C)
Mathlib/CategoryTheory/Adjunction/AdjointFunctorTheorems.lean
69
75
theorem solutionSetCondition_of_isRightAdjoint [G.IsRightAdjoint] : SolutionSetCondition G := by
intro A refine ⟨PUnit, fun _ => G.leftAdjoint.obj A, fun _ => (Adjunction.ofIsRightAdjoint G).unit.app A, ?_⟩ intro B h refine ⟨PUnit.unit, ((Adjunction.ofIsRightAdjoint G).homEquiv _ _).symm h, ?_⟩ rw [← Adjunction.homEquiv_unit, Equiv.apply_symm_apply]
0
import Mathlib.Order.Ideal import Mathlib.Data.Finset.Lattice #align_import order.countable_dense_linear_order from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9" noncomputable section open scoped Classical namespace Order theorem exists_between_finsets {α : Type*} [LinearOrder α] [DenselyOrdered α] [NoMinOrder α] [NoMaxOrder α] [nonem : Nonempty α] (lo hi : Finset α) (lo_lt_hi : ∀ x ∈ lo, ∀ y ∈ hi, x < y) : ∃ m : α, (∀ x ∈ lo, x < m) ∧ ∀ y ∈ hi, m < y := if nlo : lo.Nonempty then if nhi : hi.Nonempty then -- both sets are nonempty, use `DenselyOrdered` Exists.elim (exists_between (lo_lt_hi _ (Finset.max'_mem _ nlo) _ (Finset.min'_mem _ nhi))) fun m hm ↦ ⟨m, fun x hx ↦ lt_of_le_of_lt (Finset.le_max' lo x hx) hm.1, fun y hy ↦ lt_of_lt_of_le hm.2 (Finset.min'_le hi y hy)⟩ else-- upper set is empty, use `NoMaxOrder` Exists.elim (exists_gt (Finset.max' lo nlo)) fun m hm ↦ ⟨m, fun x hx ↦ lt_of_le_of_lt (Finset.le_max' lo x hx) hm, fun y hy ↦ (nhi ⟨y, hy⟩).elim⟩ else if nhi : hi.Nonempty then -- lower set is empty, use `NoMinOrder` Exists.elim (exists_lt (Finset.min' hi nhi)) fun m hm ↦ ⟨m, fun x hx ↦ (nlo ⟨x, hx⟩).elim, fun y hy ↦ lt_of_lt_of_le hm (Finset.min'_le hi y hy)⟩ else -- both sets are empty, use `Nonempty` nonem.elim fun m ↦ ⟨m, fun x hx ↦ (nlo ⟨x, hx⟩).elim, fun y hy ↦ (nhi ⟨y, hy⟩).elim⟩ #align order.exists_between_finsets Order.exists_between_finsets variable (α β : Type*) [LinearOrder α] [LinearOrder β] -- Porting note: Mathport warning: expanding binder collection (p q «expr ∈ » f) def PartialIso : Type _ := { f : Finset (α × β) // ∀ p ∈ f, ∀ q ∈ f, cmp (Prod.fst p) (Prod.fst q) = cmp (Prod.snd p) (Prod.snd q) } #align order.partial_iso Order.PartialIso namespace PartialIso instance : Inhabited (PartialIso α β) := ⟨⟨∅, fun _p h _q ↦ (Finset.not_mem_empty _ h).elim⟩⟩ instance : Preorder (PartialIso α β) := Subtype.preorder _ variable {α β}
Mathlib/Order/CountableDenseLinearOrder.lean
94
122
theorem exists_across [DenselyOrdered β] [NoMinOrder β] [NoMaxOrder β] [Nonempty β] (f : PartialIso α β) (a : α) : ∃ b : β, ∀ p ∈ f.val, cmp (Prod.fst p) a = cmp (Prod.snd p) b := by
by_cases h : ∃ b, (a, b) ∈ f.val · cases' h with b hb exact ⟨b, fun p hp ↦ f.prop _ hp _ hb⟩ have : ∀ x ∈ (f.val.filter fun p : α × β ↦ p.fst < a).image Prod.snd, ∀ y ∈ (f.val.filter fun p : α × β ↦ a < p.fst).image Prod.snd, x < y := by intro x hx y hy rw [Finset.mem_image] at hx hy rcases hx with ⟨p, hp1, rfl⟩ rcases hy with ⟨q, hq1, rfl⟩ rw [Finset.mem_filter] at hp1 hq1 rw [← lt_iff_lt_of_cmp_eq_cmp (f.prop _ hp1.1 _ hq1.1)] exact lt_trans hp1.right hq1.right cases' exists_between_finsets _ _ this with b hb use b rintro ⟨p1, p2⟩ hp have : p1 ≠ a := fun he ↦ h ⟨p2, he ▸ hp⟩ cases' lt_or_gt_of_ne this with hl hr · have : p1 < a ∧ p2 < b := ⟨hl, hb.1 _ (Finset.mem_image.mpr ⟨(p1, p2), Finset.mem_filter.mpr ⟨hp, hl⟩, rfl⟩)⟩ rw [← cmp_eq_lt_iff, ← cmp_eq_lt_iff] at this exact this.1.trans this.2.symm · have : a < p1 ∧ b < p2 := ⟨hr, hb.2 _ (Finset.mem_image.mpr ⟨(p1, p2), Finset.mem_filter.mpr ⟨hp, hr⟩, rfl⟩)⟩ rw [← cmp_eq_gt_iff, ← cmp_eq_gt_iff] at this exact this.1.trans this.2.symm
0
import Batteries.Data.Fin.Basic namespace Fin attribute [norm_cast] val_last protected theorem le_antisymm_iff {x y : Fin n} : x = y ↔ x ≤ y ∧ y ≤ x := Fin.ext_iff.trans Nat.le_antisymm_iff protected theorem le_antisymm {x y : Fin n} (h1 : x ≤ y) (h2 : y ≤ x) : x = y := Fin.le_antisymm_iff.2 ⟨h1, h2⟩ @[simp] theorem coe_clamp (n m : Nat) : (clamp n m : Nat) = min n m := rfl @[simp] theorem size_enum (n) : (enum n).size = n := Array.size_ofFn .. @[simp] theorem enum_zero : (enum 0) = #[] := by simp [enum, Array.ofFn, Array.ofFn.go] @[simp] theorem getElem_enum (i) (h : i < (enum n).size) : (enum n)[i] = ⟨i, size_enum n ▸ h⟩ := Array.getElem_ofFn .. @[simp] theorem length_list (n) : (list n).length = n := by simp [list] @[simp] theorem get_list (i : Fin (list n).length) : (list n).get i = i.cast (length_list n) := by cases i; simp only [list]; rw [← Array.getElem_eq_data_get, getElem_enum, cast_mk] @[simp] theorem list_zero : list 0 = [] := by simp [list] theorem list_succ (n) : list (n+1) = 0 :: (list n).map Fin.succ := by apply List.ext_get; simp; intro i; cases i <;> simp theorem list_succ_last (n) : list (n+1) = (list n).map castSucc ++ [last n] := by rw [list_succ] induction n with | zero => rfl | succ n ih => rw [list_succ, List.map_cons castSucc, ih] simp [Function.comp_def, succ_castSucc] theorem list_reverse (n) : (list n).reverse = (list n).map rev := by induction n with | zero => rfl | succ n ih => conv => lhs; rw [list_succ_last] conv => rhs; rw [list_succ] simp [List.reverse_map, ih, Function.comp_def, rev_succ]
.lake/packages/batteries/Batteries/Data/Fin/Lemmas.lean
59
61
theorem foldl_loop_lt (f : α → Fin n → α) (x) (h : m < n) : foldl.loop n f x m = foldl.loop n f (f x ⟨m, h⟩) (m+1) := by
rw [foldl.loop, dif_pos h]
0
import Mathlib.RingTheory.Nilpotent.Basic import Mathlib.RingTheory.UniqueFactorizationDomain #align_import algebra.squarefree from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1" variable {R : Type*} def Squarefree [Monoid R] (r : R) : Prop := ∀ x : R, x * x ∣ r → IsUnit x #align squarefree Squarefree theorem IsRelPrime.of_squarefree_mul [CommMonoid R] {m n : R} (h : Squarefree (m * n)) : IsRelPrime m n := fun c hca hcb ↦ h c (mul_dvd_mul hca hcb) @[simp] theorem IsUnit.squarefree [CommMonoid R] {x : R} (h : IsUnit x) : Squarefree x := fun _ hdvd => isUnit_of_mul_isUnit_left (isUnit_of_dvd_unit hdvd h) #align is_unit.squarefree IsUnit.squarefree -- @[simp] -- Porting note (#10618): simp can prove this theorem squarefree_one [CommMonoid R] : Squarefree (1 : R) := isUnit_one.squarefree #align squarefree_one squarefree_one @[simp] theorem not_squarefree_zero [MonoidWithZero R] [Nontrivial R] : ¬Squarefree (0 : R) := by erw [not_forall] exact ⟨0, by simp⟩ #align not_squarefree_zero not_squarefree_zero theorem Squarefree.ne_zero [MonoidWithZero R] [Nontrivial R] {m : R} (hm : Squarefree (m : R)) : m ≠ 0 := by rintro rfl exact not_squarefree_zero hm #align squarefree.ne_zero Squarefree.ne_zero @[simp] theorem Irreducible.squarefree [CommMonoid R] {x : R} (h : Irreducible x) : Squarefree x := by rintro y ⟨z, hz⟩ rw [mul_assoc] at hz rcases h.isUnit_or_isUnit hz with (hu | hu) · exact hu · apply isUnit_of_mul_isUnit_left hu #align irreducible.squarefree Irreducible.squarefree @[simp] theorem Prime.squarefree [CancelCommMonoidWithZero R] {x : R} (h : Prime x) : Squarefree x := h.irreducible.squarefree #align prime.squarefree Prime.squarefree theorem Squarefree.of_mul_left [CommMonoid R] {m n : R} (hmn : Squarefree (m * n)) : Squarefree m := fun p hp => hmn p (dvd_mul_of_dvd_left hp n) #align squarefree.of_mul_left Squarefree.of_mul_left theorem Squarefree.of_mul_right [CommMonoid R] {m n : R} (hmn : Squarefree (m * n)) : Squarefree n := fun p hp => hmn p (dvd_mul_of_dvd_right hp m) #align squarefree.of_mul_right Squarefree.of_mul_right theorem Squarefree.squarefree_of_dvd [CommMonoid R] {x y : R} (hdvd : x ∣ y) (hsq : Squarefree y) : Squarefree x := fun _ h => hsq _ (h.trans hdvd) #align squarefree.squarefree_of_dvd Squarefree.squarefree_of_dvd theorem Squarefree.eq_zero_or_one_of_pow_of_not_isUnit [CommMonoid R] {x : R} {n : ℕ} (h : Squarefree (x ^ n)) (h' : ¬ IsUnit x) : n = 0 ∨ n = 1 := by contrapose! h' replace h' : 2 ≤ n := by omega have : x * x ∣ x ^ n := by rw [← sq]; exact pow_dvd_pow x h' exact h.squarefree_of_dvd this x (refl _) namespace multiplicity section CommMonoid variable [CommMonoid R] [DecidableRel (Dvd.dvd : R → R → Prop)]
Mathlib/Algebra/Squarefree/Basic.lean
120
126
theorem squarefree_iff_multiplicity_le_one (r : R) : Squarefree r ↔ ∀ x : R, multiplicity x r ≤ 1 ∨ IsUnit x := by
refine forall_congr' fun a => ?_ rw [← sq, pow_dvd_iff_le_multiplicity, or_iff_not_imp_left, not_le, imp_congr _ Iff.rfl] norm_cast rw [← one_add_one_eq_two] simpa using PartENat.add_one_le_iff_lt (PartENat.natCast_ne_top 1)
0
import Mathlib.Tactic.Ring import Mathlib.Data.PNat.Prime #align_import data.pnat.xgcd from "leanprover-community/mathlib"@"6afc9b06856ad973f6a2619e3e8a0a8d537a58f2" open Nat namespace PNat structure XgcdType where wp : ℕ x : ℕ y : ℕ zp : ℕ ap : ℕ bp : ℕ deriving Inhabited #align pnat.xgcd_type PNat.XgcdType namespace XgcdType variable (u : XgcdType) instance : SizeOf XgcdType := ⟨fun u => u.bp⟩ instance : Repr XgcdType where reprPrec | g, _ => s!"[[[{repr (g.wp + 1)}, {repr g.x}], \ [{repr g.y}, {repr (g.zp + 1)}]], \ [{repr (g.ap + 1)}, {repr (g.bp + 1)}]]" def mk' (w : ℕ+) (x : ℕ) (y : ℕ) (z : ℕ+) (a : ℕ+) (b : ℕ+) : XgcdType := mk w.val.pred x y z.val.pred a.val.pred b.val.pred #align pnat.xgcd_type.mk' PNat.XgcdType.mk' def w : ℕ+ := succPNat u.wp #align pnat.xgcd_type.w PNat.XgcdType.w def z : ℕ+ := succPNat u.zp #align pnat.xgcd_type.z PNat.XgcdType.z def a : ℕ+ := succPNat u.ap #align pnat.xgcd_type.a PNat.XgcdType.a def b : ℕ+ := succPNat u.bp #align pnat.xgcd_type.b PNat.XgcdType.b def r : ℕ := (u.ap + 1) % (u.bp + 1) #align pnat.xgcd_type.r PNat.XgcdType.r def q : ℕ := (u.ap + 1) / (u.bp + 1) #align pnat.xgcd_type.q PNat.XgcdType.q def qp : ℕ := u.q - 1 #align pnat.xgcd_type.qp PNat.XgcdType.qp def vp : ℕ × ℕ := ⟨u.wp + u.x + u.ap + u.wp * u.ap + u.x * u.bp, u.y + u.zp + u.bp + u.y * u.ap + u.zp * u.bp⟩ #align pnat.xgcd_type.vp PNat.XgcdType.vp def v : ℕ × ℕ := ⟨u.w * u.a + u.x * u.b, u.y * u.a + u.z * u.b⟩ #align pnat.xgcd_type.v PNat.XgcdType.v def succ₂ (t : ℕ × ℕ) : ℕ × ℕ := ⟨t.1.succ, t.2.succ⟩ #align pnat.xgcd_type.succ₂ PNat.XgcdType.succ₂ theorem v_eq_succ_vp : u.v = succ₂ u.vp := by ext <;> dsimp [v, vp, w, z, a, b, succ₂] <;> ring_nf #align pnat.xgcd_type.v_eq_succ_vp PNat.XgcdType.v_eq_succ_vp def IsSpecial : Prop := u.wp + u.zp + u.wp * u.zp = u.x * u.y #align pnat.xgcd_type.is_special PNat.XgcdType.IsSpecial def IsSpecial' : Prop := u.w * u.z = succPNat (u.x * u.y) #align pnat.xgcd_type.is_special' PNat.XgcdType.IsSpecial' theorem isSpecial_iff : u.IsSpecial ↔ u.IsSpecial' := by dsimp [IsSpecial, IsSpecial'] let ⟨wp, x, y, zp, ap, bp⟩ := u constructor <;> intro h <;> simp [w, z, succPNat] at * <;> simp only [← coe_inj, mul_coe, mk_coe] at * · simp_all [← h, Nat.mul, Nat.succ_eq_add_one]; ring · simp [Nat.succ_eq_add_one, Nat.mul_add, Nat.add_mul, ← Nat.add_assoc] at h; rw [← h]; ring -- Porting note: Old code has been removed as it was much more longer. #align pnat.xgcd_type.is_special_iff PNat.XgcdType.isSpecial_iff def IsReduced : Prop := u.ap = u.bp #align pnat.xgcd_type.is_reduced PNat.XgcdType.IsReduced def IsReduced' : Prop := u.a = u.b #align pnat.xgcd_type.is_reduced' PNat.XgcdType.IsReduced' theorem isReduced_iff : u.IsReduced ↔ u.IsReduced' := succPNat_inj.symm #align pnat.xgcd_type.is_reduced_iff PNat.XgcdType.isReduced_iff def flip : XgcdType where wp := u.zp x := u.y y := u.x zp := u.wp ap := u.bp bp := u.ap #align pnat.xgcd_type.flip PNat.XgcdType.flip @[simp] theorem flip_w : (flip u).w = u.z := rfl #align pnat.xgcd_type.flip_w PNat.XgcdType.flip_w @[simp] theorem flip_x : (flip u).x = u.y := rfl #align pnat.xgcd_type.flip_x PNat.XgcdType.flip_x @[simp] theorem flip_y : (flip u).y = u.x := rfl #align pnat.xgcd_type.flip_y PNat.XgcdType.flip_y @[simp] theorem flip_z : (flip u).z = u.w := rfl #align pnat.xgcd_type.flip_z PNat.XgcdType.flip_z @[simp] theorem flip_a : (flip u).a = u.b := rfl #align pnat.xgcd_type.flip_a PNat.XgcdType.flip_a @[simp] theorem flip_b : (flip u).b = u.a := rfl #align pnat.xgcd_type.flip_b PNat.XgcdType.flip_b theorem flip_isReduced : (flip u).IsReduced ↔ u.IsReduced := by dsimp [IsReduced, flip] constructor <;> intro h <;> exact h.symm #align pnat.xgcd_type.flip_is_reduced PNat.XgcdType.flip_isReduced
Mathlib/Data/PNat/Xgcd.lean
222
224
theorem flip_isSpecial : (flip u).IsSpecial ↔ u.IsSpecial := by
dsimp [IsSpecial, flip] rw [mul_comm u.x, mul_comm u.zp, add_comm u.zp]
0