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 | num_lines int64 1 150 |
|---|---|---|---|---|---|---|
import Mathlib.MeasureTheory.Function.SimpleFunc
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metrizable
#align_import measure_theory.function.simple_func_dense from "leanprover-community/mathlib"@"7317149f12f55affbc900fc873d0d422485122b9"
open Set Function Filter TopologicalSpace ENNReal EMetric Finset
open scoped Classical
open Topology ENNReal MeasureTheory
variable {α β ι E F 𝕜 : Type*}
noncomputable section
namespace MeasureTheory
local infixr:25 " →ₛ " => SimpleFunc
namespace SimpleFunc
variable [MeasurableSpace α] [PseudoEMetricSpace α] [OpensMeasurableSpace α]
noncomputable def nearestPtInd (e : ℕ → α) : ℕ → α →ₛ ℕ
| 0 => const α 0
| N + 1 =>
piecewise (⋂ k ≤ N, { x | edist (e (N + 1)) x < edist (e k) x })
(MeasurableSet.iInter fun _ =>
MeasurableSet.iInter fun _ =>
measurableSet_lt measurable_edist_right measurable_edist_right)
(const α <| N + 1) (nearestPtInd e N)
#align measure_theory.simple_func.nearest_pt_ind MeasureTheory.SimpleFunc.nearestPtInd
noncomputable def nearestPt (e : ℕ → α) (N : ℕ) : α →ₛ α :=
(nearestPtInd e N).map e
#align measure_theory.simple_func.nearest_pt MeasureTheory.SimpleFunc.nearestPt
@[simp]
theorem nearestPtInd_zero (e : ℕ → α) : nearestPtInd e 0 = const α 0 :=
rfl
#align measure_theory.simple_func.nearest_pt_ind_zero MeasureTheory.SimpleFunc.nearestPtInd_zero
@[simp]
theorem nearestPt_zero (e : ℕ → α) : nearestPt e 0 = const α (e 0) :=
rfl
#align measure_theory.simple_func.nearest_pt_zero MeasureTheory.SimpleFunc.nearestPt_zero
theorem nearestPtInd_succ (e : ℕ → α) (N : ℕ) (x : α) :
nearestPtInd e (N + 1) x =
if ∀ k ≤ N, edist (e (N + 1)) x < edist (e k) x then N + 1 else nearestPtInd e N x := by
simp only [nearestPtInd, coe_piecewise, Set.piecewise]
congr
simp
#align measure_theory.simple_func.nearest_pt_ind_succ MeasureTheory.SimpleFunc.nearestPtInd_succ
theorem nearestPtInd_le (e : ℕ → α) (N : ℕ) (x : α) : nearestPtInd e N x ≤ N := by
induction' N with N ihN; · simp
simp only [nearestPtInd_succ]
split_ifs
exacts [le_rfl, ihN.trans N.le_succ]
#align measure_theory.simple_func.nearest_pt_ind_le MeasureTheory.SimpleFunc.nearestPtInd_le
| Mathlib/MeasureTheory/Function/SimpleFuncDense.lean | 102 | 113 | theorem edist_nearestPt_le (e : ℕ → α) (x : α) {k N : ℕ} (hk : k ≤ N) :
edist (nearestPt e N x) x ≤ edist (e k) x := by |
induction' N with N ihN generalizing k
· simp [nonpos_iff_eq_zero.1 hk, le_refl]
· simp only [nearestPt, nearestPtInd_succ, map_apply]
split_ifs with h
· rcases hk.eq_or_lt with (rfl | hk)
exacts [le_rfl, (h k (Nat.lt_succ_iff.1 hk)).le]
· push_neg at h
rcases h with ⟨l, hlN, hxl⟩
rcases hk.eq_or_lt with (rfl | hk)
exacts [(ihN hlN).trans hxl, ihN (Nat.lt_succ_iff.1 hk)]
| 10 |
import Mathlib.NumberTheory.Padics.PadicIntegers
import Mathlib.RingTheory.ZMod
#align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950"
noncomputable section
open scoped Classical
open Nat LocalRing Padic
namespace PadicInt
variable {p : ℕ} [hp_prime : Fact p.Prime]
section RingHoms
variable (p) (r : ℚ)
def modPart : ℤ :=
r.num * gcdA r.den p % p
#align padic_int.mod_part PadicInt.modPart
variable {p}
theorem modPart_lt_p : modPart p r < p := by
convert Int.emod_lt _ _
· simp
· exact mod_cast hp_prime.1.ne_zero
#align padic_int.mod_part_lt_p PadicInt.modPart_lt_p
theorem modPart_nonneg : 0 ≤ modPart p r :=
Int.emod_nonneg _ <| mod_cast hp_prime.1.ne_zero
#align padic_int.mod_part_nonneg PadicInt.modPart_nonneg
theorem isUnit_den (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : IsUnit (r.den : ℤ_[p]) := by
rw [isUnit_iff]
apply le_antisymm (r.den : ℤ_[p]).2
rw [← not_lt, coe_natCast]
intro norm_denom_lt
have hr : ‖(r * r.den : ℚ_[p])‖ = ‖(r.num : ℚ_[p])‖ := by
congr
rw_mod_cast [@Rat.mul_den_eq_num r]
rw [padicNormE.mul] at hr
have key : ‖(r.num : ℚ_[p])‖ < 1 := by
calc
_ = _ := hr.symm
_ < 1 * 1 := mul_lt_mul' h norm_denom_lt (norm_nonneg _) zero_lt_one
_ = 1 := mul_one 1
have : ↑p ∣ r.num ∧ (p : ℤ) ∣ r.den := by
simp only [← norm_int_lt_one_iff_dvd, ← padic_norm_e_of_padicInt]
exact ⟨key, norm_denom_lt⟩
apply hp_prime.1.not_dvd_one
rwa [← r.reduced.gcd_eq_one, Nat.dvd_gcd_iff, ← Int.natCast_dvd, ← Int.natCast_dvd_natCast]
#align padic_int.is_unit_denom PadicInt.isUnit_den
theorem norm_sub_modPart_aux (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) :
↑p ∣ r.num - r.num * r.den.gcdA p % p * ↑r.den := by
rw [← ZMod.intCast_zmod_eq_zero_iff_dvd]
simp only [Int.cast_natCast, ZMod.natCast_mod, Int.cast_mul, Int.cast_sub]
have := congr_arg (fun x => x % p : ℤ → ZMod p) (gcd_eq_gcd_ab r.den p)
simp only [Int.cast_natCast, CharP.cast_eq_zero, EuclideanDomain.mod_zero, Int.cast_add,
Int.cast_mul, zero_mul, add_zero] at this
push_cast
rw [mul_right_comm, mul_assoc, ← this]
suffices rdcp : r.den.Coprime p by
rw [rdcp.gcd_eq_one]
simp only [mul_one, cast_one, sub_self]
apply Coprime.symm
apply (coprime_or_dvd_of_prime hp_prime.1 _).resolve_right
rw [← Int.natCast_dvd_natCast, ← norm_int_lt_one_iff_dvd, not_lt]
apply ge_of_eq
rw [← isUnit_iff]
exact isUnit_den r h
#align padic_int.norm_sub_mod_part_aux PadicInt.norm_sub_modPart_aux
| Mathlib/NumberTheory/Padics/RingHoms.lean | 124 | 134 | theorem norm_sub_modPart (h : ‖(r : ℚ_[p])‖ ≤ 1) : ‖(⟨r, h⟩ - modPart p r : ℤ_[p])‖ < 1 := by |
let n := modPart p r
rw [norm_lt_one_iff_dvd, ← (isUnit_den r h).dvd_mul_right]
suffices ↑p ∣ r.num - n * r.den by
convert (Int.castRingHom ℤ_[p]).map_dvd this
simp only [sub_mul, Int.cast_natCast, eq_intCast, Int.cast_mul, sub_left_inj, Int.cast_sub]
apply Subtype.coe_injective
simp only [coe_mul, Subtype.coe_mk, coe_natCast]
rw_mod_cast [@Rat.mul_den_eq_num r]
rfl
exact norm_sub_modPart_aux r h
| 10 |
import Mathlib.Topology.MetricSpace.HausdorffDistance
#align_import topology.metric_space.pi_nat from "leanprover-community/mathlib"@"49b7f94aab3a3bdca1f9f34c5d818afb253b3993"
noncomputable section
open scoped Classical
open Topology Filter
open TopologicalSpace Set Metric Filter Function
attribute [local simp] pow_le_pow_iff_right one_lt_two inv_le_inv zero_le_two zero_lt_two
variable {E : ℕ → Type*}
namespace PiNat
irreducible_def firstDiff (x y : ∀ n, E n) : ℕ :=
if h : x ≠ y then Nat.find (ne_iff.1 h) else 0
#align pi_nat.first_diff PiNat.firstDiff
theorem apply_firstDiff_ne {x y : ∀ n, E n} (h : x ≠ y) :
x (firstDiff x y) ≠ y (firstDiff x y) := by
rw [firstDiff_def, dif_pos h]
exact Nat.find_spec (ne_iff.1 h)
#align pi_nat.apply_first_diff_ne PiNat.apply_firstDiff_ne
theorem apply_eq_of_lt_firstDiff {x y : ∀ n, E n} {n : ℕ} (hn : n < firstDiff x y) : x n = y n := by
rw [firstDiff_def] at hn
split_ifs at hn with h
· convert Nat.find_min (ne_iff.1 h) hn
simp
· exact (not_lt_zero' hn).elim
#align pi_nat.apply_eq_of_lt_first_diff PiNat.apply_eq_of_lt_firstDiff
theorem firstDiff_comm (x y : ∀ n, E n) : firstDiff x y = firstDiff y x := by
simp only [firstDiff_def, ne_comm]
#align pi_nat.first_diff_comm PiNat.firstDiff_comm
theorem min_firstDiff_le (x y z : ∀ n, E n) (h : x ≠ z) :
min (firstDiff x y) (firstDiff y z) ≤ firstDiff x z := by
by_contra! H
rw [lt_min_iff] at H
refine apply_firstDiff_ne h ?_
calc
x (firstDiff x z) = y (firstDiff x z) := apply_eq_of_lt_firstDiff H.1
_ = z (firstDiff x z) := apply_eq_of_lt_firstDiff H.2
#align pi_nat.min_first_diff_le PiNat.min_firstDiff_le
def cylinder (x : ∀ n, E n) (n : ℕ) : Set (∀ n, E n) :=
{ y | ∀ i, i < n → y i = x i }
#align pi_nat.cylinder PiNat.cylinder
theorem cylinder_eq_pi (x : ∀ n, E n) (n : ℕ) :
cylinder x n = Set.pi (Finset.range n : Set ℕ) fun i : ℕ => {x i} := by
ext y
simp [cylinder]
#align pi_nat.cylinder_eq_pi PiNat.cylinder_eq_pi
@[simp]
theorem cylinder_zero (x : ∀ n, E n) : cylinder x 0 = univ := by simp [cylinder_eq_pi]
#align pi_nat.cylinder_zero PiNat.cylinder_zero
theorem cylinder_anti (x : ∀ n, E n) {m n : ℕ} (h : m ≤ n) : cylinder x n ⊆ cylinder x m :=
fun _y hy i hi => hy i (hi.trans_le h)
#align pi_nat.cylinder_anti PiNat.cylinder_anti
@[simp]
theorem mem_cylinder_iff {x y : ∀ n, E n} {n : ℕ} : y ∈ cylinder x n ↔ ∀ i < n, y i = x i :=
Iff.rfl
#align pi_nat.mem_cylinder_iff PiNat.mem_cylinder_iff
theorem self_mem_cylinder (x : ∀ n, E n) (n : ℕ) : x ∈ cylinder x n := by simp
#align pi_nat.self_mem_cylinder PiNat.self_mem_cylinder
theorem mem_cylinder_iff_eq {x y : ∀ n, E n} {n : ℕ} :
y ∈ cylinder x n ↔ cylinder y n = cylinder x n := by
constructor
· intro hy
apply Subset.antisymm
· intro z hz i hi
rw [← hy i hi]
exact hz i hi
· intro z hz i hi
rw [hy i hi]
exact hz i hi
· intro h
rw [← h]
exact self_mem_cylinder _ _
#align pi_nat.mem_cylinder_iff_eq PiNat.mem_cylinder_iff_eq
theorem mem_cylinder_comm (x y : ∀ n, E n) (n : ℕ) : y ∈ cylinder x n ↔ x ∈ cylinder y n := by
simp [mem_cylinder_iff_eq, eq_comm]
#align pi_nat.mem_cylinder_comm PiNat.mem_cylinder_comm
theorem mem_cylinder_iff_le_firstDiff {x y : ∀ n, E n} (hne : x ≠ y) (i : ℕ) :
x ∈ cylinder y i ↔ i ≤ firstDiff x y := by
constructor
· intro h
by_contra!
exact apply_firstDiff_ne hne (h _ this)
· intro hi j hj
exact apply_eq_of_lt_firstDiff (hj.trans_le hi)
#align pi_nat.mem_cylinder_iff_le_first_diff PiNat.mem_cylinder_iff_le_firstDiff
theorem mem_cylinder_firstDiff (x y : ∀ n, E n) : x ∈ cylinder y (firstDiff x y) := fun _i hi =>
apply_eq_of_lt_firstDiff hi
#align pi_nat.mem_cylinder_first_diff PiNat.mem_cylinder_firstDiff
theorem cylinder_eq_cylinder_of_le_firstDiff (x y : ∀ n, E n) {n : ℕ} (hn : n ≤ firstDiff x y) :
cylinder x n = cylinder y n := by
rw [← mem_cylinder_iff_eq]
intro i hi
exact apply_eq_of_lt_firstDiff (hi.trans_le hn)
#align pi_nat.cylinder_eq_cylinder_of_le_first_diff PiNat.cylinder_eq_cylinder_of_le_firstDiff
| Mathlib/Topology/MetricSpace/PiNat.lean | 175 | 186 | theorem iUnion_cylinder_update (x : ∀ n, E n) (n : ℕ) :
⋃ k, cylinder (update x n k) (n + 1) = cylinder x n := by |
ext y
simp only [mem_cylinder_iff, mem_iUnion]
constructor
· rintro ⟨k, hk⟩ i hi
simpa [hi.ne] using hk i (Nat.lt_succ_of_lt hi)
· intro H
refine ⟨y n, fun i hi => ?_⟩
rcases Nat.lt_succ_iff_lt_or_eq.1 hi with (h'i | rfl)
· simp [H i h'i, h'i.ne]
· simp
| 10 |
import Mathlib.Algebra.Group.Equiv.TypeTags
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Module.LinearMap.Basic
import Mathlib.Algebra.MonoidAlgebra.Basic
import Mathlib.LinearAlgebra.Dual
import Mathlib.LinearAlgebra.Contraction
import Mathlib.RingTheory.TensorProduct.Basic
#align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac"
open MonoidAlgebra (lift of)
open LinearMap
section
variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V]
abbrev Representation :=
G →* V →ₗ[k] V
#align representation Representation
end
namespace Representation
section MonoidAlgebra
variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V]
variable (ρ : Representation k G V)
noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V :=
(lift k G _) ρ
#align representation.as_algebra_hom Representation.asAlgebraHom
theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ :=
rfl
#align representation.as_algebra_hom_def Representation.asAlgebraHom_def
@[simp]
theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by
simp only [asAlgebraHom_def, MonoidAlgebra.lift_single]
#align representation.as_algebra_hom_single Representation.asAlgebraHom_single
theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by simp
#align representation.as_algebra_hom_single_one Representation.asAlgebraHom_single_one
theorem asAlgebraHom_of (g : G) : asAlgebraHom ρ (of k G g) = ρ g := by
simp only [MonoidAlgebra.of_apply, asAlgebraHom_single, one_smul]
#align representation.as_algebra_hom_of Representation.asAlgebraHom_of
@[nolint unusedArguments]
def asModule (_ : Representation k G V) :=
V
#align representation.as_module Representation.asModule
-- Porting note: no derive handler
instance : AddCommMonoid (ρ.asModule) := inferInstanceAs <| AddCommMonoid V
instance : Inhabited ρ.asModule where
default := 0
noncomputable instance asModuleModule : Module (MonoidAlgebra k G) ρ.asModule :=
Module.compHom V (asAlgebraHom ρ).toRingHom
#align representation.as_module_module Representation.asModuleModule
-- Porting note: ρ.asModule doesn't unfold now
instance : Module k ρ.asModule := inferInstanceAs <| Module k V
def asModuleEquiv : ρ.asModule ≃+ V :=
AddEquiv.refl _
#align representation.as_module_equiv Representation.asModuleEquiv
@[simp]
theorem asModuleEquiv_map_smul (r : MonoidAlgebra k G) (x : ρ.asModule) :
ρ.asModuleEquiv (r • x) = ρ.asAlgebraHom r (ρ.asModuleEquiv x) :=
rfl
#align representation.as_module_equiv_map_smul Representation.asModuleEquiv_map_smul
@[simp]
theorem asModuleEquiv_symm_map_smul (r : k) (x : V) :
ρ.asModuleEquiv.symm (r • x) = algebraMap k (MonoidAlgebra k G) r • ρ.asModuleEquiv.symm x := by
apply_fun ρ.asModuleEquiv
simp
#align representation.as_module_equiv_symm_map_smul Representation.asModuleEquiv_symm_map_smul
@[simp]
theorem asModuleEquiv_symm_map_rho (g : G) (x : V) :
ρ.asModuleEquiv.symm (ρ g x) = MonoidAlgebra.of k G g • ρ.asModuleEquiv.symm x := by
apply_fun ρ.asModuleEquiv
simp
#align representation.as_module_equiv_symm_map_rho Representation.asModuleEquiv_symm_map_rho
noncomputable def ofModule' (M : Type*) [AddCommMonoid M] [Module k M]
[Module (MonoidAlgebra k G) M] [IsScalarTower k (MonoidAlgebra k G) M] : Representation k G M :=
(MonoidAlgebra.lift k G (M →ₗ[k] M)).symm (Algebra.lsmul k k M)
#align representation.of_module' Representation.ofModule'
section
variable (M : Type*) [AddCommMonoid M] [Module (MonoidAlgebra k G) M]
noncomputable def ofModule : Representation k G (RestrictScalars k (MonoidAlgebra k G) M) :=
(MonoidAlgebra.lift k G
(RestrictScalars k (MonoidAlgebra k G) M →ₗ[k]
RestrictScalars k (MonoidAlgebra k G) M)).symm
(RestrictScalars.lsmul k (MonoidAlgebra k G) M)
#align representation.of_module Representation.ofModule
@[simp]
| Mathlib/RepresentationTheory/Basic.lean | 221 | 234 | theorem ofModule_asAlgebraHom_apply_apply (r : MonoidAlgebra k G)
(m : RestrictScalars k (MonoidAlgebra k G) M) :
((ofModule M).asAlgebraHom r) m =
(RestrictScalars.addEquiv _ _ _).symm (r • RestrictScalars.addEquiv _ _ _ m) := by |
apply MonoidAlgebra.induction_on r
· intro g
simp only [one_smul, MonoidAlgebra.lift_symm_apply, MonoidAlgebra.of_apply,
Representation.asAlgebraHom_single, Representation.ofModule, AddEquiv.apply_eq_iff_eq,
RestrictScalars.lsmul_apply_apply]
· intro f g fw gw
simp only [fw, gw, map_add, add_smul, LinearMap.add_apply]
· intro r f w
simp only [w, AlgHom.map_smul, LinearMap.smul_apply,
RestrictScalars.addEquiv_symm_map_smul_smul]
| 10 |
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
#align_import analysis.special_functions.pow.asymptotics from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
set_option linter.uppercaseLean3 false
noncomputable section
open scoped Classical
open Real Topology NNReal ENNReal Filter ComplexConjugate Finset Set
section Limits
open Real Filter
| Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean | 36 | 46 | theorem tendsto_rpow_atTop {y : ℝ} (hy : 0 < y) : Tendsto (fun x : ℝ => x ^ y) atTop atTop := by |
rw [tendsto_atTop_atTop]
intro b
use max b 0 ^ (1 / y)
intro x hx
exact
le_of_max_le_left
(by
convert rpow_le_rpow (rpow_nonneg (le_max_right b 0) (1 / y)) hx (le_of_lt hy)
using 1
rw [← rpow_mul (le_max_right b 0), (eq_div_iff (ne_of_gt hy)).mp rfl, Real.rpow_one])
| 10 |
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.NormedSpace.Complemented
#align_import analysis.calculus.implicit from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Topology
open Filter
open ContinuousLinearMap (fst snd smulRight ker_prod)
open ContinuousLinearEquiv (ofBijective)
open LinearMap (ker range)
-- Porting note(#5171): linter not yet ported @[nolint has_nonempty_instance]
structure ImplicitFunctionData (𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : Type*)
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [CompleteSpace E] (F : Type*) [NormedAddCommGroup F]
[NormedSpace 𝕜 F] [CompleteSpace F] (G : Type*) [NormedAddCommGroup G] [NormedSpace 𝕜 G]
[CompleteSpace G] where
leftFun : E → F
leftDeriv : E →L[𝕜] F
rightFun : E → G
rightDeriv : E →L[𝕜] G
pt : E
left_has_deriv : HasStrictFDerivAt leftFun leftDeriv pt
right_has_deriv : HasStrictFDerivAt rightFun rightDeriv pt
left_range : range leftDeriv = ⊤
right_range : range rightDeriv = ⊤
isCompl_ker : IsCompl (ker leftDeriv) (ker rightDeriv)
#align implicit_function_data ImplicitFunctionData
namespace ImplicitFunctionData
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] [CompleteSpace E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
[CompleteSpace F] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] [CompleteSpace G]
(φ : ImplicitFunctionData 𝕜 E F G)
def prodFun (x : E) : F × G :=
(φ.leftFun x, φ.rightFun x)
#align implicit_function_data.prod_fun ImplicitFunctionData.prodFun
@[simp]
theorem prodFun_apply (x : E) : φ.prodFun x = (φ.leftFun x, φ.rightFun x) :=
rfl
#align implicit_function_data.prod_fun_apply ImplicitFunctionData.prodFun_apply
protected theorem hasStrictFDerivAt :
HasStrictFDerivAt φ.prodFun
(φ.leftDeriv.equivProdOfSurjectiveOfIsCompl φ.rightDeriv φ.left_range φ.right_range
φ.isCompl_ker :
E →L[𝕜] F × G)
φ.pt :=
φ.left_has_deriv.prod φ.right_has_deriv
#align implicit_function_data.has_strict_fderiv_at ImplicitFunctionData.hasStrictFDerivAt
def toPartialHomeomorph : PartialHomeomorph E (F × G) :=
φ.hasStrictFDerivAt.toPartialHomeomorph _
#align implicit_function_data.to_local_homeomorph ImplicitFunctionData.toPartialHomeomorph
def implicitFunction : F → G → E :=
Function.curry <| φ.toPartialHomeomorph.symm
#align implicit_function_data.implicit_function ImplicitFunctionData.implicitFunction
@[simp]
theorem toPartialHomeomorph_coe : ⇑φ.toPartialHomeomorph = φ.prodFun :=
rfl
#align implicit_function_data.to_local_homeomorph_coe ImplicitFunctionData.toPartialHomeomorph_coe
theorem toPartialHomeomorph_apply (x : E) : φ.toPartialHomeomorph x = (φ.leftFun x, φ.rightFun x) :=
rfl
#align implicit_function_data.to_local_homeomorph_apply ImplicitFunctionData.toPartialHomeomorph_apply
theorem pt_mem_toPartialHomeomorph_source : φ.pt ∈ φ.toPartialHomeomorph.source :=
φ.hasStrictFDerivAt.mem_toPartialHomeomorph_source
#align implicit_function_data.pt_mem_to_local_homeomorph_source ImplicitFunctionData.pt_mem_toPartialHomeomorph_source
theorem map_pt_mem_toPartialHomeomorph_target :
(φ.leftFun φ.pt, φ.rightFun φ.pt) ∈ φ.toPartialHomeomorph.target :=
φ.toPartialHomeomorph.map_source <| φ.pt_mem_toPartialHomeomorph_source
#align implicit_function_data.map_pt_mem_to_local_homeomorph_target ImplicitFunctionData.map_pt_mem_toPartialHomeomorph_target
theorem prod_map_implicitFunction :
∀ᶠ p : F × G in 𝓝 (φ.prodFun φ.pt), φ.prodFun (φ.implicitFunction p.1 p.2) = p :=
φ.hasStrictFDerivAt.eventually_right_inverse.mono fun ⟨_, _⟩ h => h
#align implicit_function_data.prod_map_implicit_function ImplicitFunctionData.prod_map_implicitFunction
theorem left_map_implicitFunction :
∀ᶠ p : F × G in 𝓝 (φ.prodFun φ.pt), φ.leftFun (φ.implicitFunction p.1 p.2) = p.1 :=
φ.prod_map_implicitFunction.mono fun _ => congr_arg Prod.fst
#align implicit_function_data.left_map_implicit_function ImplicitFunctionData.left_map_implicitFunction
theorem right_map_implicitFunction :
∀ᶠ p : F × G in 𝓝 (φ.prodFun φ.pt), φ.rightFun (φ.implicitFunction p.1 p.2) = p.2 :=
φ.prod_map_implicitFunction.mono fun _ => congr_arg Prod.snd
#align implicit_function_data.right_map_implicit_function ImplicitFunctionData.right_map_implicitFunction
theorem implicitFunction_apply_image :
∀ᶠ x in 𝓝 φ.pt, φ.implicitFunction (φ.leftFun x) (φ.rightFun x) = x :=
φ.hasStrictFDerivAt.eventually_left_inverse
#align implicit_function_data.implicit_function_apply_image ImplicitFunctionData.implicitFunction_apply_image
theorem map_nhds_eq : map φ.leftFun (𝓝 φ.pt) = 𝓝 (φ.leftFun φ.pt) :=
show map (Prod.fst ∘ φ.prodFun) (𝓝 φ.pt) = 𝓝 (φ.prodFun φ.pt).1 by
rw [← map_map, φ.hasStrictFDerivAt.map_nhds_eq_of_equiv, map_fst_nhds]
#align implicit_function_data.map_nhds_eq ImplicitFunctionData.map_nhds_eq
| Mathlib/Analysis/Calculus/Implicit.lean | 201 | 214 | theorem implicitFunction_hasStrictFDerivAt (g'inv : G →L[𝕜] E)
(hg'inv : φ.rightDeriv.comp g'inv = ContinuousLinearMap.id 𝕜 G)
(hg'invf : φ.leftDeriv.comp g'inv = 0) :
HasStrictFDerivAt (φ.implicitFunction (φ.leftFun φ.pt)) g'inv (φ.rightFun φ.pt) := by |
have := φ.hasStrictFDerivAt.to_localInverse
simp only [prodFun] at this
convert this.comp (φ.rightFun φ.pt) ((hasStrictFDerivAt_const _ _).prod (hasStrictFDerivAt_id _))
-- Porting note: added parentheses to help `simp`
simp only [ContinuousLinearMap.ext_iff, (ContinuousLinearMap.comp_apply)] at hg'inv hg'invf ⊢
-- porting note (#10745): was `simp [ContinuousLinearEquiv.eq_symm_apply]`;
-- both `simp` and `rw` fail here, `erw` works
intro x
erw [ContinuousLinearEquiv.eq_symm_apply]
simp [*]
| 10 |
import Mathlib.Algebra.Exact
import Mathlib.RingTheory.TensorProduct.Basic
section Modules
open TensorProduct LinearMap
section Semiring
variable {R : Type*} [CommSemiring R] {M N P Q: Type*}
[AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q]
[Module R M] [Module R N] [Module R P] [Module R Q]
{f : M →ₗ[R] N} (g : N →ₗ[R] P)
lemma le_comap_range_lTensor (q : Q) :
LinearMap.range g ≤ (LinearMap.range (lTensor Q g)).comap (TensorProduct.mk R Q P q) := by
rintro x ⟨n, rfl⟩
exact ⟨q ⊗ₜ[R] n, rfl⟩
lemma le_comap_range_rTensor (q : Q) :
LinearMap.range g ≤ (LinearMap.range (rTensor Q g)).comap
((TensorProduct.mk R P Q).flip q) := by
rintro x ⟨n, rfl⟩
exact ⟨n ⊗ₜ[R] q, rfl⟩
variable (Q) {g}
| Mathlib/LinearAlgebra/TensorProduct/RightExactness.lean | 111 | 122 | theorem LinearMap.lTensor_surjective (hg : Function.Surjective g) :
Function.Surjective (lTensor Q g) := by |
intro z
induction z using TensorProduct.induction_on with
| zero => exact ⟨0, map_zero _⟩
| tmul q p =>
obtain ⟨n, rfl⟩ := hg p
exact ⟨q ⊗ₜ[R] n, rfl⟩
| add x y hx hy =>
obtain ⟨x, rfl⟩ := hx
obtain ⟨y, rfl⟩ := hy
exact ⟨x + y, map_add _ _ _⟩
| 10 |
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 Semiring
variable {R : Type*} [CommSemiring R]
theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) :
(s.map fun r => X + C r).prod =
∑ j ∈ Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by
classical
rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len,
map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
intro _ _
rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
intro s ht
rw [mem_powersetCard] at ht
dsimp
rw [prod_hom' s (Polynomial.C : R →+* R[X])]
simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub]
set_option linter.uppercaseLean3 false in
#align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm
| Mathlib/RingTheory/Polynomial/Vieta.lean | 59 | 71 | theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) :
(s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by |
convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1
simp_rw [finset_sum_coeff, coeff_C_mul_X_pow]
rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _]
· rw [if_pos (Nat.sub_sub_self h).symm]
· intro j hj1 hj2
suffices k ≠ card s - j by rw [if_neg this]
intro hn
rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2
exact Ne.irrefl hj2
· rw [Finset.mem_range]
exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k)
| 11 |
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Group.OrderIso
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Logic.Pairwise
#align_import data.set.intervals.group from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
variable {α : Type*}
namespace Set
section PairwiseDisjoint
section OrderedCommGroup
variable [OrderedCommGroup α] (a b : α)
@[to_additive]
theorem pairwise_disjoint_Ioc_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioc (a * b ^ n) (a * b ^ (n + 1))) := by
simp (config := { unfoldPartialApp := true }) only [Function.onFun]
simp_rw [Set.disjoint_iff]
intro m n hmn x hx
apply hmn
have hb : 1 < b := by
have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_le hx.1.2
rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this
have i1 := hx.1.1.trans_le hx.2.2
have i2 := hx.2.1.trans_le hx.1.2
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2
exact le_antisymm i1 i2
#align set.pairwise_disjoint_Ioc_mul_zpow Set.pairwise_disjoint_Ioc_mul_zpow
#align set.pairwise_disjoint_Ioc_add_zsmul Set.pairwise_disjoint_Ioc_add_zsmul
@[to_additive]
| Mathlib/Algebra/Order/Interval/Set/Group.lean | 188 | 200 | theorem pairwise_disjoint_Ico_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ico (a * b ^ n) (a * b ^ (n + 1))) := by |
simp (config := { unfoldPartialApp := true }) only [Function.onFun]
simp_rw [Set.disjoint_iff]
intro m n hmn x hx
apply hmn
have hb : 1 < b := by
have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_lt hx.1.2
rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this
have i1 := hx.1.1.trans_lt hx.2.2
have i2 := hx.2.1.trans_lt hx.1.2
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2
exact le_antisymm i1 i2
| 11 |
import Mathlib.Algebra.Lie.Nilpotent
import Mathlib.Algebra.Lie.Normalizer
#align_import algebra.lie.engel from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
universe u₁ u₂ u₃ u₄
variable {R : Type u₁} {L : Type u₂} {L₂ : Type u₃} {M : Type u₄}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L₂] [LieAlgebra R L₂]
variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]
namespace LieSubmodule
open LieModule
variable {I : LieIdeal R L} {x : L} (hxI : (R ∙ x) ⊔ I = ⊤)
theorem exists_smul_add_of_span_sup_eq_top (y : L) : ∃ t : R, ∃ z ∈ I, y = t • x + z := by
have hy : y ∈ (⊤ : Submodule R L) := Submodule.mem_top
simp only [← hxI, Submodule.mem_sup, Submodule.mem_span_singleton] at hy
obtain ⟨-, ⟨t, rfl⟩, z, hz, rfl⟩ := hy
exact ⟨t, z, hz, rfl⟩
#align lie_submodule.exists_smul_add_of_span_sup_eq_top LieSubmodule.exists_smul_add_of_span_sup_eq_top
| Mathlib/Algebra/Lie/Engel.lean | 89 | 102 | theorem lie_top_eq_of_span_sup_eq_top (N : LieSubmodule R L M) :
(↑⁅(⊤ : LieIdeal R L), N⁆ : Submodule R M) =
(N : Submodule R M).map (toEnd R L M x) ⊔ (↑⁅I, N⁆ : Submodule R M) := by |
simp only [lieIdeal_oper_eq_linear_span', Submodule.sup_span, mem_top, exists_prop,
true_and, Submodule.map_coe, toEnd_apply_apply]
refine le_antisymm (Submodule.span_le.mpr ?_) (Submodule.span_mono fun z hz => ?_)
· rintro z ⟨y, n, hn : n ∈ N, rfl⟩
obtain ⟨t, z, hz, rfl⟩ := exists_smul_add_of_span_sup_eq_top hxI y
simp only [SetLike.mem_coe, Submodule.span_union, Submodule.mem_sup]
exact
⟨t • ⁅x, n⁆, Submodule.subset_span ⟨t • n, N.smul_mem' t hn, lie_smul t x n⟩, ⁅z, n⁆,
Submodule.subset_span ⟨z, hz, n, hn, rfl⟩, by simp⟩
· rcases hz with (⟨m, hm, rfl⟩ | ⟨y, -, m, hm, rfl⟩)
exacts [⟨x, m, hm, rfl⟩, ⟨y, m, hm, rfl⟩]
| 11 |
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.List.Perm
import Mathlib.Data.List.Range
#align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6"
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
open Nat
namespace List
@[simp]
theorem sublists'_nil : sublists' (@nil α) = [[]] :=
rfl
#align list.sublists'_nil List.sublists'_nil
@[simp]
theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
rfl
#align list.sublists'_singleton List.sublists'_singleton
#noalign list.map_sublists'_aux
#noalign list.sublists'_aux_append
#noalign list.sublists'_aux_eq_sublists'
-- Porting note: Not the same as `sublists'_aux` from Lean3
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) :=
r₁.foldl (init := r₂) fun r l => r ++ [a :: l]
#align list.sublists'_aux List.sublists'Aux
theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)),
sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray)
(fun r l => r.push (a :: l))).toList := by
intro r₁ r₂
rw [sublists'Aux, Array.foldl_eq_foldl_data]
have := List.foldl_hom Array.toList (fun r l => r.push (a :: l))
(fun r l => r ++ [a :: l]) r₁ r₂.toArray (by simp)
simpa using this
theorem sublists'_eq_sublists'Aux (l : List α) :
sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] := by
simp only [sublists', sublists'Aux_eq_array_foldl]
rw [← List.foldr_hom Array.toList]
· rfl
· intros _ _; congr <;> simp
theorem sublists'Aux_eq_map (a : α) (r₁ : List (List α)) : ∀ (r₂ : List (List α)),
sublists'Aux a r₁ r₂ = r₂ ++ map (cons a) r₁ :=
List.reverseRecOn r₁ (fun _ => by simp [sublists'Aux]) fun r₁ l ih r₂ => by
rw [map_append, map_singleton, ← append_assoc, ← ih, sublists'Aux, foldl_append, foldl]
simp [sublists'Aux]
-- Porting note: simp can prove `sublists'_singleton`
@[simp 900]
theorem sublists'_cons (a : α) (l : List α) :
sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l) := by
simp [sublists'_eq_sublists'Aux, foldr_cons, sublists'Aux_eq_map]
#align list.sublists'_cons List.sublists'_cons
@[simp]
| Mathlib/Data/List/Sublists.lean | 82 | 93 | theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t := by |
induction' t with a t IH generalizing s
· simp only [sublists'_nil, mem_singleton]
exact ⟨fun h => by rw [h], eq_nil_of_sublist_nil⟩
simp only [sublists'_cons, mem_append, IH, mem_map]
constructor <;> intro h
· rcases h with (h | ⟨s, h, rfl⟩)
· exact sublist_cons_of_sublist _ h
· exact h.cons_cons _
· cases' h with _ _ _ h s _ _ h
· exact Or.inl h
· exact Or.inr ⟨s, h, rfl⟩
| 11 |
import Mathlib.Data.Finsupp.Lex
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Order.GameAdd
#align_import logic.hydra from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
namespace Relation
open Multiset Prod
variable {α : Type*}
def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
∃ (t : Multiset α) (a : α), (∀ a' ∈ t, r a' a) ∧ s' + {a} = s + t
#align relation.cut_expand Relation.CutExpand
variable {r : α → α → Prop}
theorem cutExpand_le_invImage_lex [DecidableEq α] [IsIrrefl α r] :
CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp := by
rintro s t ⟨u, a, hr, he⟩
replace hr := fun a' ↦ mt (hr a')
classical
refine ⟨a, fun b h ↦ ?_, ?_⟩ <;> simp_rw [toFinsupp_apply]
· apply_fun count b at he
simpa only [count_add, count_singleton, if_neg h.2, add_zero, count_eq_zero.2 (hr b h.1)]
using he
· apply_fun count a at he
simp only [count_add, count_singleton_self, count_eq_zero.2 (hr _ (irrefl_of r a)),
add_zero] at he
exact he ▸ Nat.lt_succ_self _
#align relation.cut_expand_le_inv_image_lex Relation.cutExpand_le_invImage_lex
theorem cutExpand_singleton {s x} (h : ∀ x' ∈ s, r x' x) : CutExpand r s {x} :=
⟨s, x, h, add_comm s _⟩
#align relation.cut_expand_singleton Relation.cutExpand_singleton
theorem cutExpand_singleton_singleton {x' x} (h : r x' x) : CutExpand r {x'} {x} :=
cutExpand_singleton fun a h ↦ by rwa [mem_singleton.1 h]
#align relation.cut_expand_singleton_singleton Relation.cutExpand_singleton_singleton
theorem cutExpand_add_left {t u} (s) : CutExpand r (s + t) (s + u) ↔ CutExpand r t u :=
exists₂_congr fun _ _ ↦ and_congr Iff.rfl <| by rw [add_assoc, add_assoc, add_left_cancel_iff]
#align relation.cut_expand_add_left Relation.cutExpand_add_left
theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
CutExpand r s' s ↔
∃ (t : Multiset α) (a : α), (∀ a' ∈ t, r a' a) ∧ a ∈ s ∧ s' = s.erase a + t := by
simp_rw [CutExpand, add_singleton_eq_iff]
refine exists₂_congr fun t a ↦ ⟨?_, ?_⟩
· rintro ⟨ht, ha, rfl⟩
obtain h | h := mem_add.1 ha
exacts [⟨ht, h, erase_add_left_pos t h⟩, (@irrefl α r _ a (ht a h)).elim]
· rintro ⟨ht, h, rfl⟩
exact ⟨ht, mem_add.2 (Or.inl h), (erase_add_left_pos t h).symm⟩
#align relation.cut_expand_iff Relation.cutExpand_iff
theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 := by
classical
rw [cutExpand_iff]
rintro ⟨_, _, _, ⟨⟩, _⟩
#align relation.not_cut_expand_zero Relation.not_cutExpand_zero
| Mathlib/Logic/Hydra.lean | 109 | 121 | theorem cutExpand_fibration (r : α → α → Prop) :
Fibration (GameAdd (CutExpand r) (CutExpand r)) (CutExpand r) fun s ↦ s.1 + s.2 := by |
rintro ⟨s₁, s₂⟩ s ⟨t, a, hr, he⟩; dsimp at he ⊢
classical
obtain ⟨ha, rfl⟩ := add_singleton_eq_iff.1 he
rw [add_assoc, mem_add] at ha
obtain h | h := ha
· refine ⟨(s₁.erase a + t, s₂), GameAdd.fst ⟨t, a, hr, ?_⟩, ?_⟩
· rw [add_comm, ← add_assoc, singleton_add, cons_erase h]
· rw [add_assoc s₁, erase_add_left_pos _ h, add_right_comm, add_assoc]
· refine ⟨(s₁, (s₂ + t).erase a), GameAdd.snd ⟨t, a, hr, ?_⟩, ?_⟩
· rw [add_comm, singleton_add, cons_erase h]
· rw [add_assoc, erase_add_right_pos _ h]
| 11 |
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Nat.GCD.BigOperators
import Mathlib.Order.SupIndep
#align_import group_theory.noncomm_pi_coprod from "leanprover-community/mathlib"@"6f9f36364eae3f42368b04858fd66d6d9ae730d8"
section FamilyOfMonoids
variable {M : Type*} [Monoid M]
-- We have a family of monoids
-- The fintype assumption is not always used, but declared here, to keep things in order
variable {ι : Type*} [DecidableEq ι] [Fintype ι]
variable {N : ι → Type*} [∀ i, Monoid (N i)]
-- And morphisms ϕ into G
variable (ϕ : ∀ i : ι, N i →* M)
-- We assume that the elements of different morphism commute
variable (hcomm : Pairwise fun i j => ∀ x y, Commute (ϕ i x) (ϕ j y))
-- We use `f` and `g` to denote elements of `Π (i : ι), N i`
variable (f g : ∀ i : ι, N i)
namespace MonoidHom
@[to_additive "The canonical homomorphism from a family of additive monoids. See also
`LinearMap.lsum` for a linear version without the commutativity assumption."]
def noncommPiCoprod : (∀ i : ι, N i) →* M where
toFun f := Finset.univ.noncommProd (fun i => ϕ i (f i)) fun i _ j _ h => hcomm h _ _
map_one' := by
apply (Finset.noncommProd_eq_pow_card _ _ _ _ _).trans (one_pow _)
simp
map_mul' f g := by
classical
simp only
convert @Finset.noncommProd_mul_distrib _ _ _ _ (fun i => ϕ i (f i)) (fun i => ϕ i (g i)) _ _ _
· exact map_mul _ _ _
· rintro i - j - h
exact hcomm h _ _
#align monoid_hom.noncomm_pi_coprod MonoidHom.noncommPiCoprod
#align add_monoid_hom.noncomm_pi_coprod AddMonoidHom.noncommPiCoprod
variable {hcomm}
@[to_additive (attr := simp)]
| Mathlib/GroupTheory/NoncommPiCoprod.lean | 125 | 137 | theorem noncommPiCoprod_mulSingle (i : ι) (y : N i) :
noncommPiCoprod ϕ hcomm (Pi.mulSingle i y) = ϕ i y := by |
change Finset.univ.noncommProd (fun j => ϕ j (Pi.mulSingle i y j)) (fun _ _ _ _ h => hcomm h _ _)
= ϕ i y
rw [← Finset.insert_erase (Finset.mem_univ i)]
rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ (Finset.not_mem_erase i _)]
rw [Pi.mulSingle_eq_same]
rw [Finset.noncommProd_eq_pow_card]
· rw [one_pow]
exact mul_one _
· intro j hj
simp only [Finset.mem_erase] at hj
simp [hj]
| 11 |
import Mathlib.Algebra.Polynomial.Module.AEval
#align_import data.polynomial.module from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
universe u v
open Polynomial BigOperators
@[nolint unusedArguments]
def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] := ℕ →₀ M
#align polynomial_module PolynomialModule
variable (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R)
-- Porting note: stated instead of deriving
noncomputable instance : Inhabited (PolynomialModule R M) := Finsupp.instInhabited
noncomputable instance : AddCommGroup (PolynomialModule R M) := Finsupp.instAddCommGroup
variable {M}
variable {S : Type*} [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M]
namespace PolynomialModule
@[nolint unusedArguments]
noncomputable instance : Module S (PolynomialModule R M) :=
Finsupp.module ℕ M
instance instFunLike : FunLike (PolynomialModule R M) ℕ M :=
Finsupp.instFunLike
instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M :=
Finsupp.instCoeFun
theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 :=
Finsupp.zero_apply
theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a :=
Finsupp.add_apply g₁ g₂ a
noncomputable def single (i : ℕ) : M →+ PolynomialModule R M :=
Finsupp.singleAddHom i
#align polynomial_module.single PolynomialModule.single
theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.single_apply PolynomialModule.single_apply
noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M :=
Finsupp.lsingle i
#align polynomial_module.lsingle PolynomialModule.lsingle
theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.lsingle_apply PolynomialModule.lsingle_apply
theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m :=
(lsingle R i).map_smul r m
#align polynomial_module.single_smul PolynomialModule.single_smul
variable {R}
theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0)
(hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f :=
Finsupp.induction_linear f h0 hadd hsingle
#align polynomial_module.induction_linear PolynomialModule.induction_linear
noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) :=
inferInstanceAs (Module R[X] (Module.AEval' (Finsupp.lmapDomain M R Nat.succ)))
#align polynomial_module.polynomial_module PolynomialModule.polynomialModule
lemma smul_def (f : R[X]) (m : PolynomialModule R M) :
f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m := by
rfl
instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] :
IsScalarTower S R (PolynomialModule R M) :=
Finsupp.isScalarTower _ _
instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M]
[IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) := by
haveI : IsScalarTower R R[X] (PolynomialModule R M) :=
inferInstanceAs <| IsScalarTower R R[X] <| Module.AEval' <| Finsupp.lmapDomain M R Nat.succ
constructor
intro x y z
rw [← @IsScalarTower.algebraMap_smul S R, ← @IsScalarTower.algebraMap_smul S R, smul_assoc]
#align polynomial_module.is_scalar_tower' PolynomialModule.isScalarTower'
@[simp]
| Mathlib/Algebra/Polynomial/Module/Basic.lean | 123 | 135 | theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) :
monomial i r • single R j m = single R (i + j) (r • m) := by |
simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply,
Module.algebraMap_end_apply, smul_def]
induction i generalizing r j m with
| zero =>
rw [Function.iterate_zero, zero_add]
exact Finsupp.smul_single r j m
| succ n hn =>
rw [Function.iterate_succ, Function.comp_apply, add_assoc, ← hn]
congr 2
rw [Nat.one_add]
exact Finsupp.mapDomain_single
| 11 |
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 _ _ _ _
| Mathlib/Analysis/InnerProductSpace/LaxMilgram.lean | 51 | 62 | 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]
| 11 |
import Mathlib.Data.Finsupp.Lex
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Order.GameAdd
#align_import logic.hydra from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
namespace Relation
open Multiset Prod
variable {α : Type*}
def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
∃ (t : Multiset α) (a : α), (∀ a' ∈ t, r a' a) ∧ s' + {a} = s + t
#align relation.cut_expand Relation.CutExpand
variable {r : α → α → Prop}
| Mathlib/Logic/Hydra.lean | 62 | 74 | theorem cutExpand_le_invImage_lex [DecidableEq α] [IsIrrefl α r] :
CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp := by |
rintro s t ⟨u, a, hr, he⟩
replace hr := fun a' ↦ mt (hr a')
classical
refine ⟨a, fun b h ↦ ?_, ?_⟩ <;> simp_rw [toFinsupp_apply]
· apply_fun count b at he
simpa only [count_add, count_singleton, if_neg h.2, add_zero, count_eq_zero.2 (hr b h.1)]
using he
· apply_fun count a at he
simp only [count_add, count_singleton_self, count_eq_zero.2 (hr _ (irrefl_of r a)),
add_zero] at he
exact he ▸ Nat.lt_succ_self _
| 11 |
import Mathlib.RingTheory.DedekindDomain.Ideal
#align_import ring_theory.dedekind_domain.factorization from "leanprover-community/mathlib"@"2f588be38bb5bec02f218ba14f82fc82eb663f87"
noncomputable section
open scoped Classical nonZeroDivisors
open Set Function UniqueFactorizationMonoid IsDedekindDomain IsDedekindDomain.HeightOneSpectrum
Classical
variable {R : Type*} [CommRing R] {K : Type*} [Field K] [Algebra R K] [IsFractionRing R K]
variable [IsDedekindDomain R] (v : HeightOneSpectrum R)
def IsDedekindDomain.HeightOneSpectrum.maxPowDividing (I : Ideal R) : Ideal R :=
v.asIdeal ^ (Associates.mk v.asIdeal).count (Associates.mk I).factors
#align is_dedekind_domain.height_one_spectrum.max_pow_dividing IsDedekindDomain.HeightOneSpectrum.maxPowDividing
theorem Ideal.finite_factors {I : Ideal R} (hI : I ≠ 0) :
{v : HeightOneSpectrum R | v.asIdeal ∣ I}.Finite := by
rw [← Set.finite_coe_iff, Set.coe_setOf]
haveI h_fin := fintypeSubtypeDvd I hI
refine
Finite.of_injective (fun v => (⟨(v : HeightOneSpectrum R).asIdeal, v.2⟩ : { x // x ∣ I })) ?_
intro v w hvw
simp? at hvw says simp only [Subtype.mk.injEq] at hvw
exact Subtype.coe_injective ((HeightOneSpectrum.ext_iff (R := R) ↑v ↑w).mpr hvw)
#align ideal.finite_factors Ideal.finite_factors
theorem Associates.finite_factors {I : Ideal R} (hI : I ≠ 0) :
∀ᶠ v : HeightOneSpectrum R in Filter.cofinite,
((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ) = 0 := by
have h_supp : {v : HeightOneSpectrum R | ¬((Associates.mk v.asIdeal).count
(Associates.mk I).factors : ℤ) = 0} = {v : HeightOneSpectrum R | v.asIdeal ∣ I} := by
ext v
simp_rw [Int.natCast_eq_zero]
exact Associates.count_ne_zero_iff_dvd hI v.irreducible
rw [Filter.eventually_cofinite, h_supp]
exact Ideal.finite_factors hI
#align associates.finite_factors Associates.finite_factors
namespace Ideal
theorem finite_mulSupport {I : Ideal R} (hI : I ≠ 0) :
(mulSupport fun v : HeightOneSpectrum R => v.maxPowDividing I).Finite :=
haveI h_subset : {v : HeightOneSpectrum R | v.maxPowDividing I ≠ 1} ⊆
{v : HeightOneSpectrum R |
((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ) ≠ 0} := by
intro v hv h_zero
have hv' : v.maxPowDividing I = 1 := by
rw [IsDedekindDomain.HeightOneSpectrum.maxPowDividing, Int.natCast_eq_zero.mp h_zero,
pow_zero _]
exact hv hv'
Finite.subset (Filter.eventually_cofinite.mp (Associates.finite_factors hI)) h_subset
#align ideal.finite_mul_support Ideal.finite_mulSupport
theorem finite_mulSupport_coe {I : Ideal R} (hI : I ≠ 0) :
(mulSupport fun v : HeightOneSpectrum R => (v.asIdeal : FractionalIdeal R⁰ K) ^
((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ)).Finite := by
rw [mulSupport]
simp_rw [Ne, zpow_natCast, ← FractionalIdeal.coeIdeal_pow, FractionalIdeal.coeIdeal_eq_one]
exact finite_mulSupport hI
#align ideal.finite_mul_support_coe Ideal.finite_mulSupport_coe
theorem finite_mulSupport_inv {I : Ideal R} (hI : I ≠ 0) :
(mulSupport fun v : HeightOneSpectrum R => (v.asIdeal : FractionalIdeal R⁰ K) ^
(-((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ))).Finite := by
rw [mulSupport]
simp_rw [zpow_neg, Ne, inv_eq_one]
exact finite_mulSupport_coe hI
#align ideal.finite_mul_support_inv Ideal.finite_mulSupport_inv
| Mathlib/RingTheory/DedekindDomain/Factorization.lean | 131 | 144 | theorem finprod_not_dvd (I : Ideal R) (hI : I ≠ 0) :
¬v.asIdeal ^ ((Associates.mk v.asIdeal).count (Associates.mk I).factors + 1) ∣
∏ᶠ v : HeightOneSpectrum R, v.maxPowDividing I := by |
have hf := finite_mulSupport hI
have h_ne_zero : v.maxPowDividing I ≠ 0 := pow_ne_zero _ v.ne_bot
rw [← mul_finprod_cond_ne v hf, pow_add, pow_one, finprod_cond_ne _ _ hf]
intro h_contr
have hv_prime : Prime v.asIdeal := Ideal.prime_of_isPrime v.ne_bot v.isPrime
obtain ⟨w, hw, hvw'⟩ :=
Prime.exists_mem_finset_dvd hv_prime ((mul_dvd_mul_iff_left h_ne_zero).mp h_contr)
have hw_prime : Prime w.asIdeal := Ideal.prime_of_isPrime w.ne_bot w.isPrime
have hvw := Prime.dvd_of_dvd_pow hv_prime hvw'
rw [Prime.dvd_prime_iff_associated hv_prime hw_prime, associated_iff_eq] at hvw
exact (Finset.mem_erase.mp hw).1 (HeightOneSpectrum.ext w v (Eq.symm hvw))
| 11 |
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Fintype.Vector
import Mathlib.Data.Multiset.Sym
#align_import data.finset.sym from "leanprover-community/mathlib"@"02ba8949f486ebecf93fe7460f1ed0564b5e442c"
namespace Finset
variable {α : Type*}
@[simps]
protected def sym2 (s : Finset α) : Finset (Sym2 α) := ⟨s.1.sym2, s.2.sym2⟩
#align finset.sym2 Finset.sym2
section
variable {s t : Finset α} {a b : α}
theorem mk_mem_sym2_iff : s(a, b) ∈ s.sym2 ↔ a ∈ s ∧ b ∈ s := by
rw [mem_mk, sym2_val, Multiset.mk_mem_sym2_iff, mem_mk, mem_mk]
#align finset.mk_mem_sym2_iff Finset.mk_mem_sym2_iff
@[simp]
theorem mem_sym2_iff {m : Sym2 α} : m ∈ s.sym2 ↔ ∀ a ∈ m, a ∈ s := by
rw [mem_mk, sym2_val, Multiset.mem_sym2_iff]
simp only [mem_val]
#align finset.mem_sym2_iff Finset.mem_sym2_iff
instance _root_.Sym2.instFintype [Fintype α] : Fintype (Sym2 α) where
elems := Finset.univ.sym2
complete := fun x ↦ by rw [mem_sym2_iff]; exact (fun a _ ↦ mem_univ a)
-- Note(kmill): Using a default argument to make this simp lemma more general.
@[simp]
theorem sym2_univ [Fintype α] (inst : Fintype (Sym2 α) := Sym2.instFintype) :
(univ : Finset α).sym2 = univ := by
ext
simp only [mem_sym2_iff, mem_univ, implies_true]
#align finset.sym2_univ Finset.sym2_univ
@[simp, mono]
theorem sym2_mono (h : s ⊆ t) : s.sym2 ⊆ t.sym2 := by
rw [← val_le_iff, sym2_val, sym2_val]
apply Multiset.sym2_mono
rwa [val_le_iff]
#align finset.sym2_mono Finset.sym2_mono
theorem monotone_sym2 : Monotone (Finset.sym2 : Finset α → _) := fun _ _ => sym2_mono
theorem injective_sym2 : Function.Injective (Finset.sym2 : Finset α → _) := by
intro s t h
ext x
simpa using congr(s(x, x) ∈ $h)
theorem strictMono_sym2 : StrictMono (Finset.sym2 : Finset α → _) :=
monotone_sym2.strictMono_of_injective injective_sym2
theorem sym2_toFinset [DecidableEq α] (m : Multiset α) :
m.toFinset.sym2 = m.sym2.toFinset := by
ext z
refine z.ind fun x y ↦ ?_
simp only [mk_mem_sym2_iff, Multiset.mem_toFinset, Multiset.mk_mem_sym2_iff]
@[simp]
theorem sym2_empty : (∅ : Finset α).sym2 = ∅ := rfl
#align finset.sym2_empty Finset.sym2_empty
@[simp]
theorem sym2_eq_empty : s.sym2 = ∅ ↔ s = ∅ := by
rw [← val_eq_zero, sym2_val, Multiset.sym2_eq_zero_iff, val_eq_zero]
#align finset.sym2_eq_empty Finset.sym2_eq_empty
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem sym2_nonempty : s.sym2.Nonempty ↔ s.Nonempty := by
rw [← not_iff_not]
simp_rw [not_nonempty_iff_eq_empty, sym2_eq_empty]
#align finset.sym2_nonempty Finset.sym2_nonempty
protected alias ⟨_, Nonempty.sym2⟩ := sym2_nonempty
#align finset.nonempty.sym2 Finset.Nonempty.sym2
@[simp]
theorem sym2_singleton (a : α) : ({a} : Finset α).sym2 = {Sym2.diag a} := rfl
#align finset.sym2_singleton Finset.sym2_singleton
theorem card_sym2 (s : Finset α) : s.sym2.card = Nat.choose (s.card + 1) 2 := by
rw [card_def, sym2_val, Multiset.card_sym2, ← card_def]
#align finset.card_sym2 Finset.card_sym2
end
variable [DecidableEq α] {s t : Finset α} {a b : α}
| Mathlib/Data/Finset/Sym.lean | 122 | 133 | theorem sym2_eq_image : s.sym2 = (s ×ˢ s).image Sym2.mk := by |
ext z
refine z.ind fun x y ↦ ?_
rw [mk_mem_sym2_iff, mem_image]
constructor
· intro h
use (x, y)
simp only [mem_product, h, and_self, true_and]
· rintro ⟨⟨a, b⟩, h⟩
simp only [mem_product, Sym2.eq_iff] at h
obtain ⟨h, (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩)⟩ := h
<;> simp [h]
| 11 |
import Mathlib.NumberTheory.Padics.PadicIntegers
import Mathlib.RingTheory.ZMod
#align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950"
noncomputable section
open scoped Classical
open Nat LocalRing Padic
namespace PadicInt
variable {p : ℕ} [hp_prime : Fact p.Prime]
section lift
open CauSeq PadicSeq
variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k))
(f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1)
def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val
#align padic_int.nth_hom PadicInt.nthHom
@[simp]
theorem nthHom_zero : nthHom f 0 = 0 := by
simp (config := { unfoldPartialApp := true }) [nthHom]
rfl
#align padic_int.nth_hom_zero PadicInt.nthHom_zero
variable {f}
theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) :
(p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by
specialize f_compat i j h
rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub]
dsimp [nthHom]
rw [← f_compat, RingHom.comp_apply]
simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast]
#align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub
| Mathlib/NumberTheory/Padics/RingHoms.lean | 514 | 525 | theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by |
intro ε hε
obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε
use k
intro j hj
refine lt_of_le_of_lt ?_ hk
-- Need to do beta reduction first, as `norm_cast` doesn't.
-- Added to adapt to leanprover/lean4#2734.
beta_reduce
norm_cast
rw [← padicNorm.dvd_iff_norm_le]
exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj
| 11 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
#align_import analysis.special_functions.sqrt from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set
open scoped Topology
namespace Real
noncomputable def sqPartialHomeomorph : PartialHomeomorph ℝ ℝ where
toFun x := x ^ 2
invFun := (√·)
source := Ioi 0
target := Ioi 0
map_source' _ h := mem_Ioi.2 (pow_pos (mem_Ioi.1 h) _)
map_target' _ h := mem_Ioi.2 (sqrt_pos.2 h)
left_inv' _ h := sqrt_sq (le_of_lt h)
right_inv' _ h := sq_sqrt (le_of_lt h)
open_source := isOpen_Ioi
open_target := isOpen_Ioi
continuousOn_toFun := (continuous_pow 2).continuousOn
continuousOn_invFun := continuousOn_id.sqrt
#align real.sq_local_homeomorph Real.sqPartialHomeomorph
| Mathlib/Analysis/SpecialFunctions/Sqrt.lean | 46 | 58 | theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
HasStrictDerivAt (√·) (1 / (2 * √x)) x ∧ ∀ n, ContDiffAt ℝ n (√·) x := by |
cases' hx.lt_or_lt with hx hx
· rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
have : (√·) =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
exact
⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
contDiffAt_const.congr_of_eventuallyEq this⟩
· have : ↑2 * √x ^ (2 - 1) ≠ 0 := by simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ]
constructor
· simpa using sqPartialHomeomorph.hasStrictDerivAt_symm hx this (hasStrictDerivAt_pow 2 _)
· exact fun n => sqPartialHomeomorph.contDiffAt_symm_deriv this hx (hasDerivAt_pow 2 (√x))
(contDiffAt_id.pow 2)
| 11 |
import Mathlib.Topology.StoneCech
import Mathlib.Topology.Algebra.Semigroup
import Mathlib.Data.Stream.Init
#align_import combinatorics.hindman from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Filter
@[to_additive
"Addition of ultrafilters given by `∀ᶠ m in U+V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m+m')`."]
def Ultrafilter.mul {M} [Mul M] : Mul (Ultrafilter M) where mul U V := (· * ·) <$> U <*> V
#align ultrafilter.has_mul Ultrafilter.mul
#align ultrafilter.has_add Ultrafilter.add
attribute [local instance] Ultrafilter.mul Ultrafilter.add
@[to_additive]
theorem Ultrafilter.eventually_mul {M} [Mul M] (U V : Ultrafilter M) (p : M → Prop) :
(∀ᶠ m in ↑(U * V), p m) ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m * m') :=
Iff.rfl
#align ultrafilter.eventually_mul Ultrafilter.eventually_mul
#align ultrafilter.eventually_add Ultrafilter.eventually_add
@[to_additive
"Additive semigroup structure on `Ultrafilter M` induced by an additive semigroup
structure on `M`."]
def Ultrafilter.semigroup {M} [Semigroup M] : Semigroup (Ultrafilter M) :=
{ Ultrafilter.mul with
mul_assoc := fun U V W =>
Ultrafilter.coe_inj.mp <|
-- porting note (#11083): `simp` was slow to typecheck, replaced by `simp_rw`
Filter.ext' fun p => by simp_rw [Ultrafilter.eventually_mul, mul_assoc] }
#align ultrafilter.semigroup Ultrafilter.semigroup
#align ultrafilter.add_semigroup Ultrafilter.addSemigroup
attribute [local instance] Ultrafilter.semigroup Ultrafilter.addSemigroup
-- We don't prove `continuous_mul_right`, because in general it is false!
@[to_additive]
theorem Ultrafilter.continuous_mul_left {M} [Semigroup M] (V : Ultrafilter M) :
Continuous (· * V) :=
ultrafilterBasis_is_basis.continuous_iff.2 <| Set.forall_mem_range.mpr fun s ↦
ultrafilter_isOpen_basic { m : M | ∀ᶠ m' in V, m * m' ∈ s }
#align ultrafilter.continuous_mul_left Ultrafilter.continuous_mul_left
#align ultrafilter.continuous_add_left Ultrafilter.continuous_add_left
namespace Hindman
-- Porting note: mathport wants these names to be `fS`, `fP`, etc, but this does violence to
-- mathematical naming conventions, as does `fs`, `fp`, so we just followed `mathlib` 3 here
inductive FS {M} [AddSemigroup M] : Stream' M → Set M
| head (a : Stream' M) : FS a a.head
| tail (a : Stream' M) (m : M) (h : FS a.tail m) : FS a m
| cons (a : Stream' M) (m : M) (h : FS a.tail m) : FS a (a.head + m)
set_option linter.uppercaseLean3 false in
#align hindman.FS Hindman.FS
@[to_additive FS]
inductive FP {M} [Semigroup M] : Stream' M → Set M
| head (a : Stream' M) : FP a a.head
| tail (a : Stream' M) (m : M) (h : FP a.tail m) : FP a m
| cons (a : Stream' M) (m : M) (h : FP a.tail m) : FP a (a.head * m)
set_option linter.uppercaseLean3 false in
#align hindman.FP Hindman.FP
@[to_additive
"If `m` and `m'` are finite sums in `M`, then so is `m + m'`, provided that `m'`
is obtained from a subsequence of `M` starting sufficiently late."]
| Mathlib/Combinatorics/Hindman.lean | 119 | 131 | theorem FP.mul {M} [Semigroup M] {a : Stream' M} {m : M} (hm : m ∈ FP a) :
∃ n, ∀ m' ∈ FP (a.drop n), m * m' ∈ FP a := by |
induction' hm with a a m hm ih a m hm ih
· exact ⟨1, fun m hm => FP.cons a m hm⟩
· cases' ih with n hn
use n + 1
intro m' hm'
exact FP.tail _ _ (hn _ hm')
· cases' ih with n hn
use n + 1
intro m' hm'
rw [mul_assoc]
exact FP.cons _ _ (hn _ hm')
| 11 |
import Mathlib.Algebra.Polynomial.Roots
import Mathlib.Tactic.IntervalCases
namespace Polynomial
section IsDomain
variable {R : Type*} [CommRing R] [IsDomain R]
| Mathlib/Algebra/Polynomial/SpecificDegree.lean | 22 | 34 | theorem Monic.irreducible_iff_roots_eq_zero_of_degree_le_three {p : R[X]} (hp : p.Monic)
(hp2 : 2 ≤ p.natDegree) (hp3 : p.natDegree ≤ 3) : Irreducible p ↔ p.roots = 0 := by |
have hp0 : p ≠ 0 := hp.ne_zero
have hp1 : p ≠ 1 := by rintro rfl; rw [natDegree_one] at hp2; cases hp2
rw [hp.irreducible_iff_lt_natDegree_lt hp1]
simp_rw [show p.natDegree / 2 = 1 from
(Nat.div_le_div_right hp3).antisymm
(by apply Nat.div_le_div_right (c := 2) hp2),
show Finset.Ioc 0 1 = {1} from rfl,
Finset.mem_singleton, Multiset.eq_zero_iff_forall_not_mem, mem_roots hp0, ← dvd_iff_isRoot]
refine ⟨fun h r ↦ h _ (monic_X_sub_C r) (natDegree_X_sub_C r), fun h q hq hq1 ↦ ?_⟩
rw [hq.eq_X_add_C hq1, ← sub_neg_eq_add, ← C_neg]
apply h
| 11 |
import Mathlib.Analysis.Calculus.ContDiff.Bounds
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.LocallyConvex.WithSeminorms
import Mathlib.Analysis.Normed.Group.ZeroAtInfty
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Analysis.SpecialFunctions.JapaneseBracket
import Mathlib.Topology.Algebra.UniformFilterBasis
import Mathlib.Tactic.MoveAdd
#align_import analysis.schwartz_space from "leanprover-community/mathlib"@"e137999b2c6f2be388f4cd3bbf8523de1910cd2b"
noncomputable section
open scoped Nat NNReal
variable {𝕜 𝕜' D E F G V : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
variable [NormedAddCommGroup F] [NormedSpace ℝ F]
variable (E F)
structure SchwartzMap where
toFun : E → F
smooth' : ContDiff ℝ ⊤ toFun
decay' : ∀ k n : ℕ, ∃ C : ℝ, ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n toFun x‖ ≤ C
#align schwartz_map SchwartzMap
scoped[SchwartzMap] notation "𝓢(" E ", " F ")" => SchwartzMap E F
variable {E F}
namespace SchwartzMap
-- Porting note: removed
-- instance : Coe 𝓢(E, F) (E → F) := ⟨toFun⟩
instance instFunLike : FunLike 𝓢(E, F) E F where
coe f := f.toFun
coe_injective' f g h := by cases f; cases g; congr
#align schwartz_map.fun_like SchwartzMap.instFunLike
instance instCoeFun : CoeFun 𝓢(E, F) fun _ => E → F :=
DFunLike.hasCoeToFun
#align schwartz_map.has_coe_to_fun SchwartzMap.instCoeFun
theorem decay (f : 𝓢(E, F)) (k n : ℕ) :
∃ C : ℝ, 0 < C ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ C := by
rcases f.decay' k n with ⟨C, hC⟩
exact ⟨max C 1, by positivity, fun x => (hC x).trans (le_max_left _ _)⟩
#align schwartz_map.decay SchwartzMap.decay
theorem smooth (f : 𝓢(E, F)) (n : ℕ∞) : ContDiff ℝ n f :=
f.smooth'.of_le le_top
#align schwartz_map.smooth SchwartzMap.smooth
@[continuity]
protected theorem continuous (f : 𝓢(E, F)) : Continuous f :=
(f.smooth 0).continuous
#align schwartz_map.continuous SchwartzMap.continuous
instance instContinuousMapClass : ContinuousMapClass 𝓢(E, F) E F where
map_continuous := SchwartzMap.continuous
protected theorem differentiable (f : 𝓢(E, F)) : Differentiable ℝ f :=
(f.smooth 1).differentiable rfl.le
#align schwartz_map.differentiable SchwartzMap.differentiable
protected theorem differentiableAt (f : 𝓢(E, F)) {x : E} : DifferentiableAt ℝ f x :=
f.differentiable.differentiableAt
#align schwartz_map.differentiable_at SchwartzMap.differentiableAt
@[ext]
theorem ext {f g : 𝓢(E, F)} (h : ∀ x, (f : E → F) x = g x) : f = g :=
DFunLike.ext f g h
#align schwartz_map.ext SchwartzMap.ext
section IsBigO
open Asymptotics Filter
variable (f : 𝓢(E, F))
theorem isBigO_cocompact_zpow_neg_nat (k : ℕ) :
f =O[cocompact E] fun x => ‖x‖ ^ (-k : ℤ) := by
obtain ⟨d, _, hd'⟩ := f.decay k 0
simp only [norm_iteratedFDeriv_zero] at hd'
simp_rw [Asymptotics.IsBigO, Asymptotics.IsBigOWith]
refine ⟨d, Filter.Eventually.filter_mono Filter.cocompact_le_cofinite ?_⟩
refine (Filter.eventually_cofinite_ne 0).mono fun x hx => ?_
rw [Real.norm_of_nonneg (zpow_nonneg (norm_nonneg _) _), zpow_neg, ← div_eq_mul_inv, le_div_iff']
exacts [hd' x, zpow_pos_of_pos (norm_pos_iff.mpr hx) _]
set_option linter.uppercaseLean3 false in
#align schwartz_map.is_O_cocompact_zpow_neg_nat SchwartzMap.isBigO_cocompact_zpow_neg_nat
| Mathlib/Analysis/Distribution/SchwartzSpace.lean | 157 | 169 | theorem isBigO_cocompact_rpow [ProperSpace E] (s : ℝ) :
f =O[cocompact E] fun x => ‖x‖ ^ s := by |
let k := ⌈-s⌉₊
have hk : -(k : ℝ) ≤ s := neg_le.mp (Nat.le_ceil (-s))
refine (isBigO_cocompact_zpow_neg_nat f k).trans ?_
suffices (fun x : ℝ => x ^ (-k : ℤ)) =O[atTop] fun x : ℝ => x ^ s
from this.comp_tendsto tendsto_norm_cocompact_atTop
simp_rw [Asymptotics.IsBigO, Asymptotics.IsBigOWith]
refine ⟨1, (Filter.eventually_ge_atTop 1).mono fun x hx => ?_⟩
rw [one_mul, Real.norm_of_nonneg (Real.rpow_nonneg (zero_le_one.trans hx) _),
Real.norm_of_nonneg (zpow_nonneg (zero_le_one.trans hx) _), ← Real.rpow_intCast, Int.cast_neg,
Int.cast_natCast]
exact Real.rpow_le_rpow_of_exponent_le hx hk
| 11 |
import Mathlib.LinearAlgebra.Contraction
#align_import linear_algebra.coevaluation from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31"
noncomputable section
section coevaluation
open TensorProduct FiniteDimensional
open TensorProduct
universe u v
variable (K : Type u) [Field K]
variable (V : Type v) [AddCommGroup V] [Module K V] [FiniteDimensional K V]
def coevaluation : K →ₗ[K] V ⊗[K] Module.Dual K V :=
let bV := Basis.ofVectorSpace K V
(Basis.singleton Unit K).constr K fun _ =>
∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i
#align coevaluation coevaluation
theorem coevaluation_apply_one :
(coevaluation K V) (1 : K) =
let bV := Basis.ofVectorSpace K V
∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i := by
simp only [coevaluation, id]
rw [(Basis.singleton Unit K).constr_apply_fintype K]
simp only [Fintype.univ_punit, Finset.sum_const, one_smul, Basis.singleton_repr,
Basis.equivFun_apply, Basis.coe_ofVectorSpace, one_nsmul, Finset.card_singleton]
#align coevaluation_apply_one coevaluation_apply_one
open TensorProduct
theorem contractLeft_assoc_coevaluation :
(contractLeft K V).rTensor _ ∘ₗ
(TensorProduct.assoc K _ _ _).symm.toLinearMap ∘ₗ
(coevaluation K V).lTensor (Module.Dual K V) =
(TensorProduct.lid K _).symm.toLinearMap ∘ₗ (TensorProduct.rid K _).toLinearMap := by
letI := Classical.decEq (Basis.ofVectorSpaceIndex K V)
apply TensorProduct.ext
apply (Basis.ofVectorSpace K V).dualBasis.ext; intro j; apply LinearMap.ext_ring
rw [LinearMap.compr₂_apply, LinearMap.compr₂_apply, TensorProduct.mk_apply]
simp only [LinearMap.coe_comp, Function.comp_apply, LinearEquiv.coe_toLinearMap]
rw [rid_tmul, one_smul, lid_symm_apply]
simp only [LinearEquiv.coe_toLinearMap, LinearMap.lTensor_tmul, coevaluation_apply_one]
rw [TensorProduct.tmul_sum, map_sum]; simp only [assoc_symm_tmul]
rw [map_sum]; simp only [LinearMap.rTensor_tmul, contractLeft_apply]
simp only [Basis.coe_dualBasis, Basis.coord_apply, Basis.repr_self_apply, TensorProduct.ite_tmul]
rw [Finset.sum_ite_eq']; simp only [Finset.mem_univ, if_true]
#align contract_left_assoc_coevaluation contractLeft_assoc_coevaluation
| Mathlib/LinearAlgebra/Coevaluation.lean | 81 | 95 | theorem contractLeft_assoc_coevaluation' :
(contractLeft K V).lTensor _ ∘ₗ
(TensorProduct.assoc K _ _ _).toLinearMap ∘ₗ (coevaluation K V).rTensor V =
(TensorProduct.rid K _).symm.toLinearMap ∘ₗ (TensorProduct.lid K _).toLinearMap := by |
letI := Classical.decEq (Basis.ofVectorSpaceIndex K V)
apply TensorProduct.ext
apply LinearMap.ext_ring; apply (Basis.ofVectorSpace K V).ext; intro j
rw [LinearMap.compr₂_apply, LinearMap.compr₂_apply, TensorProduct.mk_apply]
simp only [LinearMap.coe_comp, Function.comp_apply, LinearEquiv.coe_toLinearMap]
rw [lid_tmul, one_smul, rid_symm_apply]
simp only [LinearEquiv.coe_toLinearMap, LinearMap.rTensor_tmul, coevaluation_apply_one]
rw [TensorProduct.sum_tmul, map_sum]; simp only [assoc_tmul]
rw [map_sum]; simp only [LinearMap.lTensor_tmul, contractLeft_apply]
simp only [Basis.coord_apply, Basis.repr_self_apply, TensorProduct.tmul_ite]
rw [Finset.sum_ite_eq]; simp only [Finset.mem_univ, if_true]
| 11 |
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.SimpleGraph.AdjMatrix
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Set.Finite
#align_import combinatorics.simple_graph.strongly_regular from "leanprover-community/mathlib"@"2b35fc7bea4640cb75e477e83f32fbd538920822"
open Finset
universe u
namespace SimpleGraph
variable {V : Type u} [Fintype V] [DecidableEq V]
variable (G : SimpleGraph V) [DecidableRel G.Adj]
structure IsSRGWith (n k ℓ μ : ℕ) : Prop where
card : Fintype.card V = n
regular : G.IsRegularOfDegree k
of_adj : ∀ v w : V, G.Adj v w → Fintype.card (G.commonNeighbors v w) = ℓ
of_not_adj : Pairwise fun v w => ¬G.Adj v w → Fintype.card (G.commonNeighbors v w) = μ
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with SimpleGraph.IsSRGWith
variable {G} {n k ℓ μ : ℕ}
theorem bot_strongly_regular : (⊥ : SimpleGraph V).IsSRGWith (Fintype.card V) 0 ℓ 0 where
card := rfl
regular := bot_degree
of_adj := fun v w h => h.elim
of_not_adj := fun v w _h => by
simp only [card_eq_zero, Fintype.card_ofFinset, forall_true_left, not_false_iff, bot_adj]
ext
simp [mem_commonNeighbors]
#align simple_graph.bot_strongly_regular SimpleGraph.bot_strongly_regular
theorem IsSRGWith.top :
(⊤ : SimpleGraph V).IsSRGWith (Fintype.card V) (Fintype.card V - 1) (Fintype.card V - 2) μ where
card := rfl
regular := IsRegularOfDegree.top
of_adj := fun v w h => by
rw [card_commonNeighbors_top]
exact h
of_not_adj := fun v w h h' => False.elim (h' ((top_adj v w).2 h))
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.top SimpleGraph.IsSRGWith.top
theorem IsSRGWith.card_neighborFinset_union_eq {v w : V} (h : G.IsSRGWith n k ℓ μ) :
(G.neighborFinset v ∪ G.neighborFinset w).card =
2 * k - Fintype.card (G.commonNeighbors v w) := by
apply Nat.add_right_cancel (m := Fintype.card (G.commonNeighbors v w))
rw [Nat.sub_add_cancel, ← Set.toFinset_card]
-- Porting note: Set.toFinset_inter needs workaround to use unification to solve for one of the
-- instance arguments:
· simp [commonNeighbors, @Set.toFinset_inter _ _ _ _ _ _ (_),
← neighborFinset_def, Finset.card_union_add_card_inter, card_neighborFinset_eq_degree,
h.regular.degree_eq, two_mul]
· apply le_trans (card_commonNeighbors_le_degree_left _ _ _)
simp [h.regular.degree_eq, two_mul]
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_eq SimpleGraph.IsSRGWith.card_neighborFinset_union_eq
theorem IsSRGWith.card_neighborFinset_union_of_not_adj {v w : V} (h : G.IsSRGWith n k ℓ μ)
(hne : v ≠ w) (ha : ¬G.Adj v w) :
(G.neighborFinset v ∪ G.neighborFinset w).card = 2 * k - μ := by
rw [← h.of_not_adj hne ha]
apply h.card_neighborFinset_union_eq
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_of_not_adj SimpleGraph.IsSRGWith.card_neighborFinset_union_of_not_adj
theorem IsSRGWith.card_neighborFinset_union_of_adj {v w : V} (h : G.IsSRGWith n k ℓ μ)
(ha : G.Adj v w) : (G.neighborFinset v ∪ G.neighborFinset w).card = 2 * k - ℓ := by
rw [← h.of_adj v w ha]
apply h.card_neighborFinset_union_eq
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_of_adj SimpleGraph.IsSRGWith.card_neighborFinset_union_of_adj
theorem compl_neighborFinset_sdiff_inter_eq {v w : V} :
(G.neighborFinset v)ᶜ \ {v} ∩ ((G.neighborFinset w)ᶜ \ {w}) =
((G.neighborFinset v)ᶜ ∩ (G.neighborFinset w)ᶜ) \ ({w} ∪ {v}) := by
ext
rw [← not_iff_not]
simp [imp_iff_not_or, or_assoc, or_comm, or_left_comm]
#align simple_graph.compl_neighbor_finset_sdiff_inter_eq SimpleGraph.compl_neighborFinset_sdiff_inter_eq
theorem sdiff_compl_neighborFinset_inter_eq {v w : V} (h : G.Adj v w) :
((G.neighborFinset v)ᶜ ∩ (G.neighborFinset w)ᶜ) \ ({w} ∪ {v}) =
(G.neighborFinset v)ᶜ ∩ (G.neighborFinset w)ᶜ := by
ext
simp only [and_imp, mem_union, mem_sdiff, mem_compl, and_iff_left_iff_imp, mem_neighborFinset,
mem_inter, mem_singleton]
rintro hnv hnw (rfl | rfl)
· exact hnv h
· apply hnw
rwa [adj_comm]
#align simple_graph.sdiff_compl_neighbor_finset_inter_eq SimpleGraph.sdiff_compl_neighborFinset_inter_eq
theorem IsSRGWith.compl_is_regular (h : G.IsSRGWith n k ℓ μ) :
Gᶜ.IsRegularOfDegree (n - k - 1) := by
rw [← h.card, Nat.sub_sub, add_comm, ← Nat.sub_sub]
exact h.regular.compl
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.compl_is_regular SimpleGraph.IsSRGWith.compl_is_regular
| Mathlib/Combinatorics/SimpleGraph/StronglyRegular.lean | 144 | 156 | theorem IsSRGWith.card_commonNeighbors_eq_of_adj_compl (h : G.IsSRGWith n k ℓ μ) {v w : V}
(ha : Gᶜ.Adj v w) : Fintype.card (Gᶜ.commonNeighbors v w) = n - (2 * k - μ) - 2 := by |
simp only [← Set.toFinset_card, commonNeighbors, Set.toFinset_inter, neighborSet_compl,
Set.toFinset_diff, Set.toFinset_singleton, Set.toFinset_compl, ← neighborFinset_def]
simp_rw [compl_neighborFinset_sdiff_inter_eq]
have hne : v ≠ w := ne_of_adj _ ha
rw [compl_adj] at ha
rw [card_sdiff, ← insert_eq, card_insert_of_not_mem, card_singleton, ← Finset.compl_union]
· rw [card_compl, h.card_neighborFinset_union_of_not_adj hne ha.2, ← h.card]
· simp only [hne.symm, not_false_iff, mem_singleton]
· intro u
simp only [mem_union, mem_compl, mem_neighborFinset, mem_inter, mem_singleton]
rintro (rfl | rfl) <;> simpa [adj_comm] using ha.2
| 11 |
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
import Mathlib.Analysis.Complex.CauchyIntegral
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology Real
section BetaIntegral
namespace Complex
noncomputable def betaIntegral (u v : ℂ) : ℂ :=
∫ x : ℝ in (0)..1, (x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
| Mathlib/Analysis/SpecialFunctions/Gamma/Beta.lean | 63 | 76 | theorem betaIntegral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) :
IntervalIntegrable (fun x =>
(x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1) : ℝ → ℂ) volume 0 (1 / 2) := by |
apply IntervalIntegrable.mul_continuousOn
· refine intervalIntegral.intervalIntegrable_cpow' ?_
rwa [sub_re, one_re, ← zero_sub, sub_lt_sub_iff_right]
· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : ℝ) ≤ 1 / 2)] at hx
apply ContinuousAt.cpow
· exact (continuous_const.sub continuous_ofReal).continuousAt
· exact continuousAt_const
· norm_cast
exact ofReal_mem_slitPlane.2 <| by linarith only [hx.2]
| 11 |
import Mathlib.CategoryTheory.Sites.Coherent.ReflectsPreregular
import Mathlib.Topology.Category.CompHaus.EffectiveEpi
import Mathlib.Topology.Category.Stonean.Limits
import Mathlib.Topology.Category.CompHaus.EffectiveEpi
universe u
open CategoryTheory Limits
namespace Stonean
noncomputable
def struct {B X : Stonean.{u}} (π : X ⟶ B) (hπ : Function.Surjective π) : EffectiveEpiStruct π where
desc e h := (QuotientMap.of_surjective_continuous hπ π.continuous).lift e fun a b hab ↦
DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩
(by ext; exact hab)) a
fac e h := ((QuotientMap.of_surjective_continuous hπ π.continuous).lift_comp e
fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩
(by ext; exact hab)) a)
uniq e h g hm := by
suffices g = (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv ⟨e,
fun a b hab ↦ DFunLike.congr_fun
(h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab))
a⟩ by assumption
rw [← Equiv.symm_apply_eq (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv]
ext
simp only [QuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm]
rfl
open List in
theorem effectiveEpi_tfae
{B X : Stonean.{u}} (π : X ⟶ B) :
TFAE
[ EffectiveEpi π
, Epi π
, Function.Surjective π
] := by
tfae_have 1 → 2
· intro; infer_instance
tfae_have 2 ↔ 3
· exact epi_iff_surjective π
tfae_have 3 → 1
· exact fun hπ ↦ ⟨⟨struct π hπ⟩⟩
tfae_finish
instance : Stonean.toCompHaus.PreservesEffectiveEpis where
preserves f h :=
((CompHaus.effectiveEpi_tfae f).out 0 2).mpr (((Stonean.effectiveEpi_tfae f).out 0 2).mp h)
instance : Stonean.toCompHaus.ReflectsEffectiveEpis where
reflects f h :=
((Stonean.effectiveEpi_tfae f).out 0 2).mpr (((CompHaus.effectiveEpi_tfae f).out 0 2).mp h)
noncomputable def stoneanToCompHausEffectivePresentation (X : CompHaus) :
Stonean.toCompHaus.EffectivePresentation X where
p := X.presentation
f := CompHaus.presentation.π X
effectiveEpi := ((CompHaus.effectiveEpi_tfae _).out 0 1).mpr (inferInstance : Epi _)
instance : Stonean.toCompHaus.EffectivelyEnough where
presentation X := ⟨stoneanToCompHausEffectivePresentation X⟩
instance : Preregular Stonean := Stonean.toCompHaus.reflects_preregular
example : Precoherent Stonean.{u} := inferInstance
-- TODO: prove this for `Type*`
open List in
| Mathlib/Topology/Category/Stonean/EffectiveEpi.lean | 103 | 121 | theorem effectiveEpiFamily_tfae
{α : Type} [Finite α] {B : Stonean.{u}}
(X : α → Stonean.{u}) (π : (a : α) → (X a ⟶ B)) :
TFAE
[ EffectiveEpiFamily X π
, Epi (Sigma.desc π)
, ∀ b : B, ∃ (a : α) (x : X a), π a x = b
] := by |
tfae_have 2 → 1
· intro
simpa [← effectiveEpi_desc_iff_effectiveEpiFamily, (effectiveEpi_tfae (Sigma.desc π)).out 0 1]
tfae_have 1 → 2
· intro; infer_instance
tfae_have 3 ↔ 1
· erw [((CompHaus.effectiveEpiFamily_tfae
(fun a ↦ Stonean.toCompHaus.obj (X a)) (fun a ↦ Stonean.toCompHaus.map (π a))).out 2 0 : )]
exact ⟨fun h ↦ Stonean.toCompHaus.finite_effectiveEpiFamily_of_map _ _ h,
fun _ ↦ inferInstance⟩
tfae_finish
| 11 |
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.FieldTheory.Galois
universe u v w
open scoped Classical Polynomial
open Polynomial
variable (k : Type u) [Field k] (K : Type v) [Field K]
class IsSepClosed : Prop where
splits_of_separable : ∀ p : k[X], p.Separable → (p.Splits <| RingHom.id k)
instance IsSepClosed.of_isAlgClosed [IsAlgClosed k] : IsSepClosed k :=
⟨fun p _ ↦ IsAlgClosed.splits p⟩
variable {k} {K}
theorem IsSepClosed.splits_codomain [IsSepClosed K] {f : k →+* K}
(p : k[X]) (h : p.Separable) : p.Splits f := by
convert IsSepClosed.splits_of_separable (p.map f) (Separable.map h); simp [splits_map_iff]
theorem IsSepClosed.splits_domain [IsSepClosed k] {f : k →+* K}
(p : k[X]) (h : p.Separable) : p.Splits f :=
Polynomial.splits_of_splits_id _ <| IsSepClosed.splits_of_separable _ h
namespace IsSepClosed
theorem exists_root [IsSepClosed k] (p : k[X]) (hp : p.degree ≠ 0) (hsep : p.Separable) :
∃ x, IsRoot p x :=
exists_root_of_splits _ (IsSepClosed.splits_of_separable p hsep) hp
variable (k) in
instance (priority := 100) isAlgClosed_of_perfectField [IsSepClosed k] [PerfectField k] :
IsAlgClosed k :=
IsAlgClosed.of_exists_root k fun p _ h ↦ exists_root p ((degree_pos_of_irreducible h).ne')
(PerfectField.separable_of_irreducible h)
| Mathlib/FieldTheory/IsSepClosed.lean | 104 | 116 | theorem exists_pow_nat_eq [IsSepClosed k] (x : k) (n : ℕ) [hn : NeZero (n : k)] :
∃ z, z ^ n = x := by |
have hn' : 0 < n := Nat.pos_of_ne_zero fun h => by
rw [h, Nat.cast_zero] at hn
exact hn.out rfl
have : degree (X ^ n - C x) ≠ 0 := by
rw [degree_X_pow_sub_C hn' x]
exact (WithBot.coe_lt_coe.2 hn').ne'
by_cases hx : x = 0
· exact ⟨0, by rw [hx, pow_eq_zero_iff hn'.ne']⟩
· obtain ⟨z, hz⟩ := exists_root _ this <| separable_X_pow_sub_C x hn.out hx
use z
simpa [eval_C, eval_X, eval_pow, eval_sub, IsRoot.def, sub_eq_zero] using hz
| 11 |
import Mathlib.Data.Finset.Fold
import Mathlib.Algebra.GCDMonoid.Multiset
#align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
#align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d"
variable {ι α β γ : Type*}
namespace Finset
open Multiset
variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α]
section gcd
def gcd (s : Finset β) (f : β → α) : α :=
s.fold GCDMonoid.gcd 0 f
#align finset.gcd Finset.gcd
variable {s s₁ s₂ : Finset β} {f : β → α}
theorem gcd_def : s.gcd f = (s.1.map f).gcd :=
rfl
#align finset.gcd_def Finset.gcd_def
@[simp]
theorem gcd_empty : (∅ : Finset β).gcd f = 0 :=
fold_empty
#align finset.gcd_empty Finset.gcd_empty
theorem dvd_gcd_iff {a : α} : a ∣ s.gcd f ↔ ∀ b ∈ s, a ∣ f b := by
apply Iff.trans Multiset.dvd_gcd
simp only [Multiset.mem_map, and_imp, exists_imp]
exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩
#align finset.dvd_gcd_iff Finset.dvd_gcd_iff
theorem gcd_dvd {b : β} (hb : b ∈ s) : s.gcd f ∣ f b :=
dvd_gcd_iff.1 dvd_rfl _ hb
#align finset.gcd_dvd Finset.gcd_dvd
theorem dvd_gcd {a : α} : (∀ b ∈ s, a ∣ f b) → a ∣ s.gcd f :=
dvd_gcd_iff.2
#align finset.dvd_gcd Finset.dvd_gcd
@[simp]
theorem gcd_insert [DecidableEq β] {b : β} :
(insert b s : Finset β).gcd f = GCDMonoid.gcd (f b) (s.gcd f) := by
by_cases h : b ∈ s
· rw [insert_eq_of_mem h,
(gcd_eq_right_iff (f b) (s.gcd f) (Multiset.normalize_gcd (s.1.map f))).2 (gcd_dvd h)]
apply fold_insert h
#align finset.gcd_insert Finset.gcd_insert
@[simp]
theorem gcd_singleton {b : β} : ({b} : Finset β).gcd f = normalize (f b) :=
Multiset.gcd_singleton
#align finset.gcd_singleton Finset.gcd_singleton
-- Porting note: Priority changed for `simpNF`
@[simp 1100]
theorem normalize_gcd : normalize (s.gcd f) = s.gcd f := by simp [gcd_def]
#align finset.normalize_gcd Finset.normalize_gcd
theorem gcd_union [DecidableEq β] : (s₁ ∪ s₂).gcd f = GCDMonoid.gcd (s₁.gcd f) (s₂.gcd f) :=
Finset.induction_on s₁ (by rw [empty_union, gcd_empty, gcd_zero_left, normalize_gcd])
fun a s _ ih ↦ by rw [insert_union, gcd_insert, gcd_insert, ih, gcd_assoc]
#align finset.gcd_union Finset.gcd_union
theorem gcd_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀ a ∈ s₂, f a = g a) :
s₁.gcd f = s₂.gcd g := by
subst hs
exact Finset.fold_congr hfg
#align finset.gcd_congr Finset.gcd_congr
theorem gcd_mono_fun {g : β → α} (h : ∀ b ∈ s, f b ∣ g b) : s.gcd f ∣ s.gcd g :=
dvd_gcd fun b hb ↦ (gcd_dvd hb).trans (h b hb)
#align finset.gcd_mono_fun Finset.gcd_mono_fun
theorem gcd_mono (h : s₁ ⊆ s₂) : s₂.gcd f ∣ s₁.gcd f :=
dvd_gcd fun _ hb ↦ gcd_dvd (h hb)
#align finset.gcd_mono Finset.gcd_mono
theorem gcd_image [DecidableEq β] {g : γ → β} (s : Finset γ) :
(s.image g).gcd f = s.gcd (f ∘ g) := by
classical induction' s using Finset.induction with c s _ ih <;> simp [*]
#align finset.gcd_image Finset.gcd_image
theorem gcd_eq_gcd_image [DecidableEq α] : s.gcd f = (s.image f).gcd id :=
Eq.symm <| gcd_image _
#align finset.gcd_eq_gcd_image Finset.gcd_eq_gcd_image
| Mathlib/Algebra/GCDMonoid/Finset.lean | 212 | 223 | theorem gcd_eq_zero_iff : s.gcd f = 0 ↔ ∀ x : β, x ∈ s → f x = 0 := by |
rw [gcd_def, Multiset.gcd_eq_zero_iff]
constructor <;> intro h
· intro b bs
apply h (f b)
simp only [Multiset.mem_map, mem_def.1 bs]
use b
simp only [mem_def.1 bs, eq_self_iff_true, and_self]
· intro a as
rw [Multiset.mem_map] at as
rcases as with ⟨b, ⟨bs, rfl⟩⟩
apply h b (mem_def.1 bs)
| 11 |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace List
variable [DecidableEq α] {l l' : List α}
theorem formPerm_disjoint_iff (hl : Nodup l) (hl' : Nodup l') (hn : 2 ≤ l.length)
(hn' : 2 ≤ l'.length) : Perm.Disjoint (formPerm l) (formPerm l') ↔ l.Disjoint l' := by
rw [disjoint_iff_eq_or_eq, List.Disjoint]
constructor
· rintro h x hx hx'
specialize h x
rw [formPerm_apply_mem_eq_self_iff _ hl _ hx, formPerm_apply_mem_eq_self_iff _ hl' _ hx'] at h
omega
· intro h x
by_cases hx : x ∈ l
on_goal 1 => by_cases hx' : x ∈ l'
· exact (h hx hx').elim
all_goals have := formPerm_eq_self_of_not_mem _ _ ‹_›; tauto
#align list.form_perm_disjoint_iff List.formPerm_disjoint_iff
theorem isCycle_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) : IsCycle (formPerm l) := by
cases' l with x l
· set_option tactic.skipAssignedInstances false in norm_num at hn
induction' l with y l generalizing x
· set_option tactic.skipAssignedInstances false in norm_num at hn
· use x
constructor
· rwa [formPerm_apply_mem_ne_self_iff _ hl _ (mem_cons_self _ _)]
· intro w hw
have : w ∈ x::y::l := mem_of_formPerm_ne_self _ _ hw
obtain ⟨k, hk⟩ := get_of_mem this
use k
rw [← hk]
simp only [zpow_natCast, formPerm_pow_apply_head _ _ hl k, Nat.mod_eq_of_lt k.isLt]
#align list.is_cycle_form_perm List.isCycle_formPerm
theorem pairwise_sameCycle_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
Pairwise l.formPerm.SameCycle l :=
Pairwise.imp_mem.mpr
(pairwise_of_forall fun _ _ hx hy =>
(isCycle_formPerm hl hn).sameCycle ((formPerm_apply_mem_ne_self_iff _ hl _ hx).mpr hn)
((formPerm_apply_mem_ne_self_iff _ hl _ hy).mpr hn))
#align list.pairwise_same_cycle_form_perm List.pairwise_sameCycle_formPerm
theorem cycleOf_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) (x) :
cycleOf l.attach.formPerm x = l.attach.formPerm :=
have hn : 2 ≤ l.attach.length := by rwa [← length_attach] at hn
have hl : l.attach.Nodup := by rwa [← nodup_attach] at hl
(isCycle_formPerm hl hn).cycleOf_eq
((formPerm_apply_mem_ne_self_iff _ hl _ (mem_attach _ _)).mpr hn)
#align list.cycle_of_form_perm List.cycleOf_formPerm
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 105 | 117 | theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
cycleType l.attach.formPerm = {l.length} := by |
rw [← length_attach] at hn
rw [← nodup_attach] at hl
rw [cycleType_eq [l.attach.formPerm]]
· simp only [map, Function.comp_apply]
rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
· simp
· intro x h
simp [h, Nat.succ_le_succ_iff] at hn
· simp
· simpa using isCycle_formPerm hl hn
· simp
| 11 |
import Mathlib.Data.PFunctor.Multivariate.W
import Mathlib.Data.QPF.Multivariate.Basic
#align_import data.qpf.multivariate.constructions.fix from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33"
universe u v
namespace MvQPF
open TypeVec
open MvFunctor (LiftP LiftR)
open MvFunctor
variable {n : ℕ} {F : TypeVec.{u} (n + 1) → Type u} [MvFunctor F] [q : MvQPF F]
def recF {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) : q.P.W α → β :=
q.P.wRec fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩)
set_option linter.uppercaseLean3 false in
#align mvqpf.recF MvQPF.recF
theorem recF_eq {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (a : q.P.A)
(f' : q.P.drop.B a ⟹ α) (f : q.P.last.B a → q.P.W α) :
recF g (q.P.wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩) := by
rw [recF, MvPFunctor.wRec_eq]; rfl
set_option linter.uppercaseLean3 false in
#align mvqpf.recF_eq MvQPF.recF_eq
theorem recF_eq' {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (x : q.P.W α) :
recF g x = g (abs (appendFun id (recF g) <$$> q.P.wDest' x)) := by
apply q.P.w_cases _ x
intro a f' f
rw [recF_eq, q.P.wDest'_wMk, MvPFunctor.map_eq, appendFun_comp_splitFun, TypeVec.id_comp]
set_option linter.uppercaseLean3 false in
#align mvqpf.recF_eq' MvQPF.recF_eq'
inductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop
| ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :
(∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)
| abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)
(f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :
abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →
WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)
| trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w
set_option linter.uppercaseLean3 false in
#align mvqpf.Wequiv MvQPF.WEquiv
| Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean | 92 | 104 | theorem recF_eq_of_wEquiv (α : TypeVec n) {β : Type u} (u : F (α.append1 β) → β) (x y : q.P.W α) :
WEquiv x y → recF u x = recF u y := by |
apply q.P.w_cases _ x
intro a₀ f'₀ f₀
apply q.P.w_cases _ y
intro a₁ f'₁ f₁
intro h
-- Porting note: induction on h doesn't work.
refine @WEquiv.recOn _ _ _ _ _ (fun a a' _ ↦ recF u a = recF u a') _ _ h ?_ ?_ ?_
· intros a f' f₀ f₁ _h ih; simp only [recF_eq, Function.comp]
congr; funext; congr; funext; apply ih
· intros a₀ f'₀ f₀ a₁ f'₁ f₁ h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h]
· intros x y z _e₁ _e₂ ih₁ ih₂; exact Eq.trans ih₁ ih₂
| 11 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Div
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section CommRing
variable [CommRing R] {p q : R[X]}
section
variable [Semiring S]
theorem natDegree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p ≠ 0) {z : S}
(hz : aeval z p = 0) (inj : ∀ x : R, algebraMap R S x = 0 → x = 0) : 0 < p.natDegree :=
natDegree_pos_of_eval₂_root hp (algebraMap R S) hz inj
#align polynomial.nat_degree_pos_of_aeval_root Polynomial.natDegree_pos_of_aeval_root
theorem degree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p ≠ 0) {z : S} (hz : aeval z p = 0)
(inj : ∀ x : R, algebraMap R S x = 0 → x = 0) : 0 < p.degree :=
natDegree_pos_iff_degree_pos.mp (natDegree_pos_of_aeval_root hp hz inj)
#align polynomial.degree_pos_of_aeval_root Polynomial.degree_pos_of_aeval_root
theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ p₂ : R[X]} (h : q ∣ p₁ - p₂) :
p₁ %ₘ q = p₂ %ₘ q := by
nontriviality R
obtain ⟨f, sub_eq⟩ := h
refine (div_modByMonic_unique (p₂ /ₘ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2
rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm]
#align polynomial.mod_by_monic_eq_of_dvd_sub Polynomial.modByMonic_eq_of_dvd_sub
| Mathlib/Algebra/Polynomial/RingDivision.lean | 58 | 69 | theorem add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q + p₂ %ₘ q := by |
by_cases hq : q.Monic
· cases' subsingleton_or_nontrivial R with hR hR
· simp only [eq_iff_true_of_subsingleton]
· exact
(div_modByMonic_unique (p₁ /ₘ q + p₂ /ₘ q) _ hq
⟨by
rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div _ hq, ← add_assoc,
add_comm (q * _), modByMonic_add_div _ hq],
(degree_add_le _ _).trans_lt
(max_lt (degree_modByMonic_lt _ hq) (degree_modByMonic_lt _ hq))⟩).2
· simp_rw [modByMonic_eq_of_not_monic _ hq]
| 11 |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af"
variable {l m n α : Type*}
namespace Matrix
open scoped Matrix
section CommRing
variable [Fintype l] [Fintype m] [Fintype n]
variable [DecidableEq l] [DecidableEq m] [DecidableEq n]
variable [CommRing α]
theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix l m α)
(D : Matrix l n α) [Invertible A] :
fromBlocks A B C D =
fromBlocks 1 0 (C * ⅟ A) 1 * fromBlocks A 0 0 (D - C * ⅟ A * B) *
fromBlocks 1 (⅟ A * B) 0 1 := by
simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add,
Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc,
Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel]
#align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁
theorem fromBlocks_eq_of_invertible₂₂ (A : Matrix l m α) (B : Matrix l n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
fromBlocks A B C D =
fromBlocks 1 (B * ⅟ D) 0 1 * fromBlocks (A - B * ⅟ D * C) 0 0 D *
fromBlocks 1 0 (⅟ D * C) 1 :=
(Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by
simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ←
submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply,
fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A
#align matrix.from_blocks_eq_of_invertible₂₂ Matrix.fromBlocks_eq_of_invertible₂₂
section StarOrderedRing
variable {𝕜 : Type*} [CommRing 𝕜] [PartialOrder 𝕜] [StarRing 𝕜] [StarOrderedRing 𝕜]
scoped infixl:65 " ⊕ᵥ " => Sum.elim
theorem schur_complement_eq₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m 𝕜}
(B : Matrix m n 𝕜) (D : Matrix n n 𝕜) (x : m → 𝕜) (y : n → 𝕜) [Invertible A]
(hA : A.IsHermitian) :
(star (x ⊕ᵥ y)) ᵥ* (fromBlocks A B Bᴴ D) ⬝ᵥ (x ⊕ᵥ y) =
(star (x + (A⁻¹ * B) *ᵥ y)) ᵥ* A ⬝ᵥ (x + (A⁻¹ * B) *ᵥ y) +
(star y) ᵥ* (D - Bᴴ * A⁻¹ * B) ⬝ᵥ y := by
simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul,
dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hA.eq,
conjTranspose_nonsing_inv, star_mulVec]
abel
#align matrix.schur_complement_eq₁₁ Matrix.schur_complement_eq₁₁
theorem schur_complement_eq₂₂ [Fintype m] [Fintype n] [DecidableEq n] (A : Matrix m m 𝕜)
(B : Matrix m n 𝕜) {D : Matrix n n 𝕜} (x : m → 𝕜) (y : n → 𝕜) [Invertible D]
(hD : D.IsHermitian) :
(star (x ⊕ᵥ y)) ᵥ* (fromBlocks A B Bᴴ D) ⬝ᵥ (x ⊕ᵥ y) =
(star ((D⁻¹ * Bᴴ) *ᵥ x + y)) ᵥ* D ⬝ᵥ ((D⁻¹ * Bᴴ) *ᵥ x + y) +
(star x) ᵥ* (A - B * D⁻¹ * Bᴴ) ⬝ᵥ x := by
simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul,
dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hD.eq,
conjTranspose_nonsing_inv, star_mulVec]
abel
#align matrix.schur_complement_eq₂₂ Matrix.schur_complement_eq₂₂
| Mathlib/LinearAlgebra/Matrix/SchurComplement.lean | 506 | 519 | theorem IsHermitian.fromBlocks₁₁ [Fintype m] [DecidableEq m] {A : Matrix m m 𝕜} (B : Matrix m n 𝕜)
(D : Matrix n n 𝕜) (hA : A.IsHermitian) :
(Matrix.fromBlocks A B Bᴴ D).IsHermitian ↔ (D - Bᴴ * A⁻¹ * B).IsHermitian := by |
have hBAB : (Bᴴ * A⁻¹ * B).IsHermitian := by
apply isHermitian_conjTranspose_mul_mul
apply hA.inv
rw [isHermitian_fromBlocks_iff]
constructor
· intro h
apply IsHermitian.sub h.2.2.2 hBAB
· intro h
refine ⟨hA, rfl, conjTranspose_conjTranspose B, ?_⟩
rw [← sub_add_cancel D]
apply IsHermitian.add h hBAB
| 11 |
import Mathlib.Algebra.Algebra.Tower
import Mathlib.Algebra.Module.BigOperators
import Mathlib.LinearAlgebra.Basis
#align_import ring_theory.algebra_tower from "leanprover-community/mathlib"@"94825b2b0b982306be14d891c4f063a1eca4f370"
open Pointwise
universe u v w u₁
variable (R : Type u) (S : Type v) (A : Type w) (B : Type u₁)
namespace IsScalarTower
section Semiring
open Finsupp
open scoped Classical
universe v₁ w₁
variable {R S A}
variable [Semiring R] [Semiring S] [AddCommMonoid A]
variable [Module R S] [Module S A] [Module R A] [IsScalarTower R S A]
| Mathlib/RingTheory/AlgebraTower.lean | 108 | 121 | theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
(hb : LinearIndependent R b) (hc : LinearIndependent S c) :
LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by |
rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
by_cases hik : (i, k) ∈ s
· have h1 : ∑ i ∈ s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
rw [← hsg]
exact
(Finset.sum_subset Finset.subset_product fun p _ hp =>
show g p • b p.1 • c p.2 = 0 by rw [hg p hp, zero_smul]).symm
rw [Finset.sum_product_right] at h1
simp_rw [← smul_assoc, ← Finset.sum_smul] at h1
exact hb _ _ (hc _ _ h1 k (Finset.mem_image_of_mem _ hik)) i (Finset.mem_image_of_mem _ hik)
exact hg _ hik
| 11 |
import Mathlib.Geometry.RingedSpace.PresheafedSpace
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.Topology.Sheaves.Stalks
#align_import algebraic_geometry.stalks from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
noncomputable section
universe v u v' u'
open Opposite CategoryTheory CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits
AlgebraicGeometry TopologicalSpace
variable {C : Type u} [Category.{v} C] [HasColimits C]
-- Porting note: no tidy tactic
-- attribute [local tidy] tactic.auto_cases_opens
-- this could be replaced by
-- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens
-- but it doesn't appear to be needed here.
open TopCat.Presheaf
namespace AlgebraicGeometry.PresheafedSpace
abbrev stalk (X : PresheafedSpace C) (x : X) : C :=
X.presheaf.stalk x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk AlgebraicGeometry.PresheafedSpace.stalk
def stalkMap {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (x : X) :
Y.stalk (α.base x) ⟶ X.stalk x :=
(stalkFunctor C (α.base x)).map α.c ≫ X.presheaf.stalkPushforward C α.base x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map AlgebraicGeometry.PresheafedSpace.stalkMap
@[elementwise, reassoc]
theorem stalkMap_germ {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (U : Opens Y)
(x : (Opens.map α.base).obj U) :
Y.presheaf.germ ⟨α.base x.1, x.2⟩ ≫ stalkMap α ↑x = α.c.app (op U) ≫ X.presheaf.germ x := by
rw [stalkMap, stalkFunctor_map_germ_assoc, stalkPushforward_germ]
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map_germ AlgebraicGeometry.PresheafedSpace.stalkMap_germ
@[simp, elementwise, reassoc]
theorem stalkMap_germ' {X Y : PresheafedSpace.{_, _, v} C}
(α : X ⟶ Y) (U : Opens Y) (x : X) (hx : α.base x ∈ U) :
Y.presheaf.germ ⟨α.base x, hx⟩ ≫ stalkMap α x = α.c.app (op U) ≫
X.presheaf.germ (U := (Opens.map α.base).obj U) ⟨x, hx⟩ :=
PresheafedSpace.stalkMap_germ α U ⟨x, hx⟩
section Restrict
def restrictStalkIso {U : TopCat} (X : PresheafedSpace.{_, _, v} C) {f : U ⟶ (X : TopCat.{v})}
(h : OpenEmbedding f) (x : U) : (X.restrict h).stalk x ≅ X.stalk (f x) :=
haveI := initial_of_adjunction (h.isOpenMap.adjunctionNhds x)
Final.colimitIso (h.isOpenMap.functorNhds x).op ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf)
-- As a left adjoint, the functor `h.is_open_map.functor_nhds x` is initial.
-- Typeclass resolution knows that the opposite of an initial functor is final. The result
-- follows from the general fact that postcomposing with a final functor doesn't change colimits.
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.restrict_stalk_iso AlgebraicGeometry.PresheafedSpace.restrictStalkIso
-- Porting note (#11119): removed `simp` attribute, for left hand side is not in simple normal form.
@[elementwise, reassoc]
theorem restrictStalkIso_hom_eq_germ {U : TopCat} (X : PresheafedSpace.{_, _, v} C)
{f : U ⟶ (X : TopCat.{v})} (h : OpenEmbedding f) (V : Opens U) (x : U) (hx : x ∈ V) :
(X.restrict h).presheaf.germ ⟨x, hx⟩ ≫ (restrictStalkIso X h x).hom =
X.presheaf.germ ⟨f x, show f x ∈ h.isOpenMap.functor.obj V from ⟨x, hx, rfl⟩⟩ :=
colimit.ι_pre ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf) (h.isOpenMap.functorNhds x).op
(op ⟨V, hx⟩)
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.restrict_stalk_iso_hom_eq_germ AlgebraicGeometry.PresheafedSpace.restrictStalkIso_hom_eq_germ
-- We intentionally leave `simp` off the lemmas generated by `elementwise` and `reassoc`,
-- as the simpNF linter claims they never apply.
@[simp, elementwise, reassoc]
theorem restrictStalkIso_inv_eq_germ {U : TopCat} (X : PresheafedSpace.{_, _, v} C)
{f : U ⟶ (X : TopCat.{v})} (h : OpenEmbedding f) (V : Opens U) (x : U) (hx : x ∈ V) :
X.presheaf.germ ⟨f x, show f x ∈ h.isOpenMap.functor.obj V from ⟨x, hx, rfl⟩⟩ ≫
(restrictStalkIso X h x).inv =
(X.restrict h).presheaf.germ ⟨x, hx⟩ := by
rw [← restrictStalkIso_hom_eq_germ, Category.assoc, Iso.hom_inv_id, Category.comp_id]
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.restrict_stalk_iso_inv_eq_germ AlgebraicGeometry.PresheafedSpace.restrictStalkIso_inv_eq_germ
| Mathlib/Geometry/RingedSpace/Stalks.lean | 108 | 121 | theorem restrictStalkIso_inv_eq_ofRestrict {U : TopCat} (X : PresheafedSpace.{_, _, v} C)
{f : U ⟶ (X : TopCat.{v})} (h : OpenEmbedding f) (x : U) :
(X.restrictStalkIso h x).inv = stalkMap (X.ofRestrict h) x := by |
-- We can't use `ext` here due to https://github.com/leanprover/std4/pull/159
refine colimit.hom_ext fun V => ?_
induction V with | h V => ?_
let i : (h.isOpenMap.functorNhds x).obj ((OpenNhds.map f x).obj V) ⟶ V :=
homOfLE (Set.image_preimage_subset f _)
erw [Iso.comp_inv_eq, colimit.ι_map_assoc, colimit.ι_map_assoc, colimit.ι_pre]
simp_rw [Category.assoc]
erw [colimit.ι_pre ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf)
(h.isOpenMap.functorNhds x).op]
erw [← X.presheaf.map_comp_assoc]
exact (colimit.w ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf) i.op).symm
| 11 |
import Mathlib.Algebra.Bounds
import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Function Set
open Pointwise
variable {α : Type*}
-- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice`
-- due to simpNF problem between `sSup_xx` `csSup_xx`.
section CompleteLattice
variable [CompleteLattice α]
namespace LinearOrderedField
variable {K : Type*} [LinearOrderedField K] {a b r : K} (hr : 0 < r)
open Set
| Mathlib/Algebra/Order/Pointwise.lean | 183 | 194 | theorem smul_Ioo : r • Ioo a b = Ioo (r • a) (r • b) := by |
ext x
simp only [mem_smul_set, smul_eq_mul, mem_Ioo]
constructor
· rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩
constructor
· exact (mul_lt_mul_left hr).mpr a_h_left_left
· exact (mul_lt_mul_left hr).mpr a_h_left_right
· rintro ⟨a_left, a_right⟩
use x / r
refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩
rw [mul_div_cancel₀ _ (ne_of_gt hr)]
| 11 |
import Mathlib.Algebra.Module.Submodule.Ker
open Function Submodule
namespace LinearMap
variable {R N M : Type*} [Semiring R] [AddCommMonoid N] [Module R N]
[AddCommMonoid M] [Module R M] (f i : N →ₗ[R] M)
def iterateMapComap (n : ℕ) := (fun K : Submodule R N ↦ (K.map i).comap f)^[n]
theorem iterateMapComap_le_succ (K : Submodule R N) (h : K.map f ≤ K.map i) (n : ℕ) :
f.iterateMapComap i n K ≤ f.iterateMapComap i (n + 1) K := by
nth_rw 2 [iterateMapComap]
rw [iterate_succ', Function.comp_apply, ← iterateMapComap, ← map_le_iff_le_comap]
induction n with
| zero => exact h
| succ n ih =>
simp_rw [iterateMapComap, iterate_succ', Function.comp_apply]
calc
_ ≤ (f.iterateMapComap i n K).map i := map_comap_le _ _
_ ≤ (((f.iterateMapComap i n K).map f).comap f).map i := map_mono (le_comap_map _ _)
_ ≤ _ := map_mono (comap_mono ih)
| Mathlib/Algebra/Module/Submodule/IterateMapComap.lean | 65 | 79 | theorem iterateMapComap_eq_succ (K : Submodule R N)
(m : ℕ) (heq : f.iterateMapComap i m K = f.iterateMapComap i (m + 1) K)
(hf : Surjective f) (hi : Injective i) (n : ℕ) :
f.iterateMapComap i n K = f.iterateMapComap i (n + 1) K := by |
induction n with
| zero =>
contrapose! heq
induction m with
| zero => exact heq
| succ m ih =>
rw [iterateMapComap, iterateMapComap, iterate_succ', iterate_succ']
exact fun H ↦ ih (map_injective_of_injective hi (comap_injective_of_surjective hf H))
| succ n ih =>
rw [iterateMapComap, iterateMapComap, iterate_succ', iterate_succ',
Function.comp_apply, Function.comp_apply, ← iterateMapComap, ← iterateMapComap, ih]
| 11 |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace List
variable [DecidableEq α] {l l' : List α}
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 58 | 70 | theorem formPerm_disjoint_iff (hl : Nodup l) (hl' : Nodup l') (hn : 2 ≤ l.length)
(hn' : 2 ≤ l'.length) : Perm.Disjoint (formPerm l) (formPerm l') ↔ l.Disjoint l' := by |
rw [disjoint_iff_eq_or_eq, List.Disjoint]
constructor
· rintro h x hx hx'
specialize h x
rw [formPerm_apply_mem_eq_self_iff _ hl _ hx, formPerm_apply_mem_eq_self_iff _ hl' _ hx'] at h
omega
· intro h x
by_cases hx : x ∈ l
on_goal 1 => by_cases hx' : x ∈ l'
· exact (h hx hx').elim
all_goals have := formPerm_eq_self_of_not_mem _ _ ‹_›; tauto
| 11 |
import Mathlib.MeasureTheory.SetSemiring
open MeasurableSpace Set
namespace MeasureTheory
variable {α : Type*} {𝒜 : Set (Set α)} {s t : Set α}
structure IsSetAlgebra (𝒜 : Set (Set α)) : Prop where
empty_mem : ∅ ∈ 𝒜
compl_mem : ∀ ⦃s⦄, s ∈ 𝒜 → sᶜ ∈ 𝒜
union_mem : ∀ ⦃s t⦄, s ∈ 𝒜 → t ∈ 𝒜 → s ∪ t ∈ 𝒜
section generateSetAlgebra
inductive generateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set (Set α)
| base (s : Set α) (s_mem : s ∈ 𝒜) : generateSetAlgebra 𝒜 s
| empty : generateSetAlgebra 𝒜 ∅
| compl (s : Set α) (hs : generateSetAlgebra 𝒜 s) : generateSetAlgebra 𝒜 sᶜ
| union (s t : Set α) (hs : generateSetAlgebra 𝒜 s) (ht : generateSetAlgebra 𝒜 t) :
generateSetAlgebra 𝒜 (s ∪ t)
theorem isSetAlgebra_generateSetAlgebra :
IsSetAlgebra (generateSetAlgebra 𝒜) where
empty_mem := generateSetAlgebra.empty
compl_mem := fun _ hs ↦ generateSetAlgebra.compl _ hs
union_mem := fun _ _ hs ht ↦ generateSetAlgebra.union _ _ hs ht
theorem self_subset_generateSetAlgebra : 𝒜 ⊆ generateSetAlgebra 𝒜 :=
fun _ ↦ generateSetAlgebra.base _
@[simp]
| Mathlib/MeasureTheory/SetAlgebra.lean | 122 | 134 | theorem generateFrom_generateSetAlgebra_eq :
generateFrom (generateSetAlgebra 𝒜) = generateFrom 𝒜 := by |
refine le_antisymm (fun s ms ↦ ?_) (generateFrom_mono self_subset_generateSetAlgebra)
refine @generateFrom_induction _ _ (generateSetAlgebra 𝒜) (fun t ht ↦ ?_)
(@MeasurableSet.empty _ (generateFrom 𝒜))
(fun t ↦ MeasurableSet.compl)
(fun f hf ↦ MeasurableSet.iUnion hf)
s ms
induction ht with
| base u u_mem => exact measurableSet_generateFrom u_mem
| empty => exact @MeasurableSet.empty _ (generateFrom 𝒜)
| compl u _ mu => exact mu.compl
| union u v _ _ mu mv => exact MeasurableSet.union mu mv
| 11 |
import Mathlib.RingTheory.HahnSeries.Multiplication
import Mathlib.RingTheory.PowerSeries.Basic
import Mathlib.Data.Finsupp.PWO
#align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965"
set_option linter.uppercaseLean3 false
open Finset Function
open scoped Classical
open Pointwise Polynomial
noncomputable section
variable {Γ : Type*} {R : Type*}
namespace HahnSeries
section Semiring
variable [Semiring R]
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
toFun f := PowerSeries.mk f.coeff
invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩
left_inv f := by
ext
simp
right_inv f := by
ext
simp
map_add' f g := by
ext
simp
map_mul' f g := by
ext n
simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support]
classical
refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <|
sum_filter_ne_zero _
ext m
simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter,
mem_support]
rintro h
rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)]
#align hahn_series.to_power_series HahnSeries.toPowerSeries
theorem coeff_toPowerSeries {f : HahnSeries ℕ R} {n : ℕ} :
PowerSeries.coeff R n (toPowerSeries f) = f.coeff n :=
PowerSeries.coeff_mk _ _
#align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries
theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : ℕ} :
(HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f :=
rfl
#align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm
variable (Γ R) [StrictOrderedSemiring Γ]
def ofPowerSeries : PowerSeries R →+* HahnSeries Γ R :=
(HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Γ) Nat.strictMono_cast.injective fun _ _ =>
Nat.cast_le).comp
(RingEquiv.toRingHom toPowerSeries.symm)
#align hahn_series.of_power_series HahnSeries.ofPowerSeries
variable {Γ} {R}
theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Γ R) :=
embDomain_injective.comp toPowerSeries.symm.injective
#align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective
theorem ofPowerSeries_apply (x : PowerSeries R) :
ofPowerSeries Γ R x =
HahnSeries.embDomain
⟨⟨((↑) : ℕ → Γ), Nat.strictMono_cast.injective⟩, by
simp only [Function.Embedding.coeFn_mk]
exact Nat.cast_le⟩
(toPowerSeries.symm x) :=
rfl
#align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply
theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : ℕ) :
(ofPowerSeries Γ R x).coeff n = PowerSeries.coeff R n x := by simp [ofPowerSeries_apply]
#align hahn_series.of_power_series_apply_coeff HahnSeries.ofPowerSeries_apply_coeff
@[simp]
| Mathlib/RingTheory/HahnSeries/PowerSeries.lean | 117 | 128 | theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by |
ext n
simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
single_coeff]
split_ifs with hn
· subst hn
convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> simp
· rw [embDomain_notin_image_support]
simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support,
PowerSeries.coeff_C]
intro
simp (config := { contextual := true }) [Ne.symm hn]
| 11 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : ∀ n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : ∀ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : ∀ {n}, (n ≠ 0) → shiftLeft' true m n ≠ 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n ≠ 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n ≠ 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
| Mathlib/Data/Nat/Size.lean | 85 | 97 | theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n ≠ 0) :
size (shiftLeft' b m n) = size m + n := by |
induction' n with n IH <;> simp [shiftLeft'] at h ⊢
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h ⊢
cases b; · exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
| 11 |
import Mathlib.CategoryTheory.GlueData
import Mathlib.Topology.Category.TopCat.Limits.Pullbacks
import Mathlib.Topology.Category.TopCat.Opens
import Mathlib.Tactic.Generalize
import Mathlib.CategoryTheory.Elementwise
#align_import topology.gluing from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1"
noncomputable section
open TopologicalSpace CategoryTheory
universe v u
open CategoryTheory.Limits
namespace TopCat
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure GlueData extends GlueData TopCat where
f_open : ∀ i j, OpenEmbedding (f i j)
f_mono := fun i j => (TopCat.mono_iff_injective _).mpr (f_open i j).toEmbedding.inj
set_option linter.uppercaseLean3 false in
#align Top.glue_data TopCat.GlueData
namespace GlueData
variable (D : GlueData.{u})
local notation "𝖣" => D.toGlueData
theorem π_surjective : Function.Surjective 𝖣.π :=
(TopCat.epi_iff_surjective 𝖣.π).mp inferInstance
set_option linter.uppercaseLean3 false in
#align Top.glue_data.π_surjective TopCat.GlueData.π_surjective
| Mathlib/Topology/Gluing.lean | 104 | 115 | theorem isOpen_iff (U : Set 𝖣.glued) : IsOpen U ↔ ∀ i, IsOpen (𝖣.ι i ⁻¹' U) := by |
delta CategoryTheory.GlueData.ι
simp_rw [← Multicoequalizer.ι_sigmaπ 𝖣.diagram]
rw [← (homeoOfIso (Multicoequalizer.isoCoequalizer 𝖣.diagram).symm).isOpen_preimage]
rw [coequalizer_isOpen_iff]
dsimp only [GlueData.diagram_l, GlueData.diagram_left, GlueData.diagram_r, GlueData.diagram_right,
parallelPair_obj_one]
rw [colimit_isOpen_iff.{_,u}] -- Porting note: changed `.{u}` to `.{_,u}`. fun fact: the proof
-- breaks down if this `rw` is merged with the `rw` above.
constructor
· intro h j; exact h ⟨j⟩
· intro h j; cases j; apply h
| 11 |
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.Algebra.Group.Int
import Mathlib.Data.Int.Lemmas
import Mathlib.Data.Set.Subsingleton
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Order.GaloisConnection
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Positivity
#align_import algebra.order.floor from "leanprover-community/mathlib"@"afdb43429311b885a7988ea15d0bac2aac80f69c"
open Set
variable {F α β : Type*}
class FloorSemiring (α) [OrderedSemiring α] where
floor : α → ℕ
ceil : α → ℕ
floor_of_neg {a : α} (ha : a < 0) : floor a = 0
gc_floor {a : α} {n : ℕ} (ha : 0 ≤ a) : n ≤ floor a ↔ (n : α) ≤ a
gc_ceil : GaloisConnection ceil (↑)
#align floor_semiring FloorSemiring
instance : FloorSemiring ℕ where
floor := id
ceil := id
floor_of_neg ha := (Nat.not_lt_zero _ ha).elim
gc_floor _ := by
rw [Nat.cast_id]
rfl
gc_ceil n a := by
rw [Nat.cast_id]
rfl
namespace Nat
| Mathlib/Algebra/Order/Floor.lean | 577 | 589 | theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
Subsingleton (FloorSemiring α) := by |
refine ⟨fun H₁ H₂ => ?_⟩
have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
have : H₁.floor = H₂.floor := by
ext a
cases' lt_or_le a 0 with h h
· rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
· refine eq_of_forall_le_iff fun n => ?_
rw [H₁.gc_floor, H₂.gc_floor] <;> exact h
cases H₁
cases H₂
congr
| 11 |
import Mathlib.AlgebraicGeometry.Morphisms.Basic
import Mathlib.RingTheory.LocalProperties
#align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
universe u
open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry
variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop)
namespace RingHom
variable {P}
theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y]
(f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔
P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _
(Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _
(X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _
(Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by
rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso,
← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r)))
(X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff]
congr
delta IsLocalization.Away.map
refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_
generalize_proofs
haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)
-- Porting note: needs to be very explicit here
convert
(@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r))
_ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1
change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _
rw [f.val.c.naturality_assoc]
simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp]
congr 1
#align ring_hom.respects_iso.basic_open_iff RingHom.RespectsIso.basicOpen_iff
theorem RespectsIso.basicOpen_iff_localization (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X]
[IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map f.op) r) := by
refine (hP.basicOpen_iff _ _).trans ?_
-- Porting note: was a one line term mode proof, but this `dsimp` is vital so the term mode
-- one liner is not possible
dsimp
rw [← hP.is_localization_away_iff]
#align ring_hom.respects_iso.basic_open_iff_localization RingHom.RespectsIso.basicOpen_iff_localization
@[deprecated (since := "2024-03-02")] alias
RespectsIso.ofRestrict_morphismRestrict_iff_of_isAffine := RespectsIso.basicOpen_iff_localization
| Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean | 86 | 102 | theorem RespectsIso.ofRestrict_morphismRestrict_iff (hP : RingHom.RespectsIso @P) {X Y : Scheme.{u}}
[IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) (U : Opens X.carrier)
(hU : IsAffineOpen U) {V : Opens _}
(e : V = (Scheme.ιOpens <| f ⁻¹ᵁ Y.basicOpen r) ⁻¹ᵁ U) :
P (Scheme.Γ.map (Scheme.ιOpens V ≫ f ∣_ Y.basicOpen r).op) ↔
P (Localization.awayMap (Scheme.Γ.map (Scheme.ιOpens U ≫ f).op) r) := by |
subst e
refine (hP.cancel_right_isIso _
(Scheme.Γ.mapIso (Scheme.restrictRestrictComm _ _ _).op).inv).symm.trans ?_
haveI : IsAffine _ := hU
rw [← hP.basicOpen_iff_localization, iff_iff_eq]
congr 1
simp only [Functor.mapIso_inv, Iso.op_inv, ← Functor.map_comp, ← op_comp, morphismRestrict_comp]
rw [← Category.assoc]
congr 3
rw [← cancel_mono (Scheme.ιOpens _), Category.assoc, Scheme.restrictRestrictComm,
IsOpenImmersion.isoOfRangeEq_inv_fac, morphismRestrict_ι]
| 11 |
import Mathlib.CategoryTheory.Sites.Coherent.ReflectsPreregular
import Mathlib.Topology.Category.CompHaus.EffectiveEpi
import Mathlib.Topology.Category.Profinite.Limits
import Mathlib.Topology.Category.Stonean.Basic
universe u
attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike
open CategoryTheory Limits
namespace Profinite
noncomputable
def struct {B X : Profinite.{u}} (π : X ⟶ B) (hπ : Function.Surjective π) :
EffectiveEpiStruct π where
desc e h := (QuotientMap.of_surjective_continuous hπ π.continuous).lift e fun a b hab ↦
DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩
(by ext; exact hab)) a
fac e h := ((QuotientMap.of_surjective_continuous hπ π.continuous).lift_comp e
fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩
(by ext; exact hab)) a)
uniq e h g hm := by
suffices g = (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv ⟨e,
fun a b hab ↦ DFunLike.congr_fun
(h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab))
a⟩ by assumption
rw [← Equiv.symm_apply_eq (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv]
ext
simp only [QuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm]
rfl
open List in
theorem effectiveEpi_tfae
{B X : Profinite.{u}} (π : X ⟶ B) :
TFAE
[ EffectiveEpi π
, Epi π
, Function.Surjective π
] := by
tfae_have 1 → 2
· intro; infer_instance
tfae_have 2 ↔ 3
· exact epi_iff_surjective π
tfae_have 3 → 1
· exact fun hπ ↦ ⟨⟨struct π hπ⟩⟩
tfae_finish
instance : profiniteToCompHaus.PreservesEffectiveEpis where
preserves f h :=
((CompHaus.effectiveEpi_tfae _).out 0 2).mpr (((Profinite.effectiveEpi_tfae _).out 0 2).mp h)
instance : profiniteToCompHaus.ReflectsEffectiveEpis where
reflects f h :=
((Profinite.effectiveEpi_tfae f).out 0 2).mpr (((CompHaus.effectiveEpi_tfae _).out 0 2).mp h)
noncomputable def profiniteToCompHausEffectivePresentation (X : CompHaus) :
profiniteToCompHaus.EffectivePresentation X where
p := Stonean.toProfinite.obj X.presentation
f := CompHaus.presentation.π X
effectiveEpi := ((CompHaus.effectiveEpi_tfae _).out 0 1).mpr (inferInstance : Epi _)
instance : profiniteToCompHaus.EffectivelyEnough where
presentation X := ⟨profiniteToCompHausEffectivePresentation X⟩
instance : Preregular Profinite.{u} := profiniteToCompHaus.reflects_preregular
example : Precoherent Profinite.{u} := inferInstance
-- TODO: prove this for `Type*`
open List in
| Mathlib/Topology/Category/Profinite/EffectiveEpi.lean | 110 | 128 | theorem effectiveEpiFamily_tfae
{α : Type} [Finite α] {B : Profinite.{u}}
(X : α → Profinite.{u}) (π : (a : α) → (X a ⟶ B)) :
TFAE
[ EffectiveEpiFamily X π
, Epi (Sigma.desc π)
, ∀ b : B, ∃ (a : α) (x : X a), π a x = b
] := by |
tfae_have 2 → 1
· intro
simpa [← effectiveEpi_desc_iff_effectiveEpiFamily, (effectiveEpi_tfae (Sigma.desc π)).out 0 1]
tfae_have 1 → 2
· intro; infer_instance
tfae_have 3 ↔ 1
· erw [((CompHaus.effectiveEpiFamily_tfae
(fun a ↦ profiniteToCompHaus.obj (X a)) (fun a ↦ profiniteToCompHaus.map (π a))).out 2 0 : )]
exact ⟨fun h ↦ profiniteToCompHaus.finite_effectiveEpiFamily_of_map _ _ h,
fun _ ↦ inferInstance⟩
tfae_finish
| 11 |
import Mathlib.Analysis.Complex.AbsMax
import Mathlib.Analysis.Asymptotics.SuperpolynomialDecay
#align_import analysis.complex.phragmen_lindelof from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Function Filter Asymptotics Metric Complex Bornology
open scoped Topology Filter Real
local notation "expR" => Real.exp
namespace PhragmenLindelof
variable {E : Type*} [NormedAddCommGroup E]
theorem isBigO_sub_exp_exp {a : ℝ} {f g : ℂ → E} {l : Filter ℂ} {u : ℂ → ℝ}
(hBf : ∃ c < a, ∃ B, f =O[l] fun z => expR (B * expR (c * |u z|)))
(hBg : ∃ c < a, ∃ B, g =O[l] fun z => expR (B * expR (c * |u z|))) :
∃ c < a, ∃ B, (f - g) =O[l] fun z => expR (B * expR (c * |u z|)) := by
have : ∀ {c₁ c₂ B₁ B₂}, c₁ ≤ c₂ → 0 ≤ B₂ → B₁ ≤ B₂ → ∀ z,
‖expR (B₁ * expR (c₁ * |u z|))‖ ≤ ‖expR (B₂ * expR (c₂ * |u z|))‖ := fun hc hB₀ hB z ↦ by
simp only [Real.norm_eq_abs, Real.abs_exp]; gcongr
rcases hBf with ⟨cf, hcf, Bf, hOf⟩; rcases hBg with ⟨cg, hcg, Bg, hOg⟩
refine ⟨max cf cg, max_lt hcf hcg, max 0 (max Bf Bg), ?_⟩
refine (hOf.trans_le <| this ?_ ?_ ?_).sub (hOg.trans_le <| this ?_ ?_ ?_)
exacts [le_max_left _ _, le_max_left _ _, (le_max_left _ _).trans (le_max_right _ _),
le_max_right _ _, le_max_left _ _, (le_max_right _ _).trans (le_max_right _ _)]
set_option linter.uppercaseLean3 false in
#align phragmen_lindelof.is_O_sub_exp_exp PhragmenLindelof.isBigO_sub_exp_exp
| Mathlib/Analysis/Complex/PhragmenLindelof.lean | 80 | 94 | theorem isBigO_sub_exp_rpow {a : ℝ} {f g : ℂ → E} {l : Filter ℂ}
(hBf : ∃ c < a, ∃ B, f =O[cobounded ℂ ⊓ l] fun z => expR (B * abs z ^ c))
(hBg : ∃ c < a, ∃ B, g =O[cobounded ℂ ⊓ l] fun z => expR (B * abs z ^ c)) :
∃ c < a, ∃ B, (f - g) =O[cobounded ℂ ⊓ l] fun z => expR (B * abs z ^ c) := by |
have : ∀ {c₁ c₂ B₁ B₂ : ℝ}, c₁ ≤ c₂ → 0 ≤ B₂ → B₁ ≤ B₂ →
(fun z : ℂ => expR (B₁ * abs z ^ c₁)) =O[cobounded ℂ ⊓ l]
fun z => expR (B₂ * abs z ^ c₂) := fun hc hB₀ hB ↦ .of_bound 1 <| by
filter_upwards [(eventually_cobounded_le_norm 1).filter_mono inf_le_left] with z hz
simp only [one_mul, Real.norm_eq_abs, Real.abs_exp]
gcongr; assumption
rcases hBf with ⟨cf, hcf, Bf, hOf⟩; rcases hBg with ⟨cg, hcg, Bg, hOg⟩
refine ⟨max cf cg, max_lt hcf hcg, max 0 (max Bf Bg), ?_⟩
refine (hOf.trans <| this ?_ ?_ ?_).sub (hOg.trans <| this ?_ ?_ ?_)
exacts [le_max_left _ _, le_max_left _ _, (le_max_left _ _).trans (le_max_right _ _),
le_max_right _ _, le_max_left _ _, (le_max_right _ _).trans (le_max_right _ _)]
| 11 |
import Mathlib.Analysis.NormedSpace.AffineIsometry
import Mathlib.Topology.Algebra.ContinuousAffineMap
import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace
#align_import analysis.normed_space.continuous_affine_map from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
namespace ContinuousAffineMap
variable {𝕜 R V W W₂ P Q Q₂ : Type*}
variable [NormedAddCommGroup V] [MetricSpace P] [NormedAddTorsor V P]
variable [NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q]
variable [NormedAddCommGroup W₂] [MetricSpace Q₂] [NormedAddTorsor W₂ Q₂]
variable [NormedField R] [NormedSpace R V] [NormedSpace R W] [NormedSpace R W₂]
variable [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W] [NormedSpace 𝕜 W₂]
def contLinear (f : P →ᴬ[R] Q) : V →L[R] W :=
{ f.linear with
toFun := f.linear
cont := by rw [AffineMap.continuous_linear_iff]; exact f.cont }
#align continuous_affine_map.cont_linear ContinuousAffineMap.contLinear
@[simp]
theorem coe_contLinear (f : P →ᴬ[R] Q) : (f.contLinear : V → W) = f.linear :=
rfl
#align continuous_affine_map.coe_cont_linear ContinuousAffineMap.coe_contLinear
@[simp]
theorem coe_contLinear_eq_linear (f : P →ᴬ[R] Q) :
(f.contLinear : V →ₗ[R] W) = (f : P →ᵃ[R] Q).linear := by ext; rfl
#align continuous_affine_map.coe_cont_linear_eq_linear ContinuousAffineMap.coe_contLinear_eq_linear
@[simp]
theorem coe_mk_const_linear_eq_linear (f : P →ᵃ[R] Q) (h) :
((⟨f, h⟩ : P →ᴬ[R] Q).contLinear : V → W) = f.linear :=
rfl
#align continuous_affine_map.coe_mk_const_linear_eq_linear ContinuousAffineMap.coe_mk_const_linear_eq_linear
theorem coe_linear_eq_coe_contLinear (f : P →ᴬ[R] Q) :
((f : P →ᵃ[R] Q).linear : V → W) = (⇑f.contLinear : V → W) :=
rfl
#align continuous_affine_map.coe_linear_eq_coe_cont_linear ContinuousAffineMap.coe_linear_eq_coe_contLinear
@[simp]
theorem comp_contLinear (f : P →ᴬ[R] Q) (g : Q →ᴬ[R] Q₂) :
(g.comp f).contLinear = g.contLinear.comp f.contLinear :=
rfl
#align continuous_affine_map.comp_cont_linear ContinuousAffineMap.comp_contLinear
@[simp]
theorem map_vadd (f : P →ᴬ[R] Q) (p : P) (v : V) : f (v +ᵥ p) = f.contLinear v +ᵥ f p :=
f.map_vadd' p v
#align continuous_affine_map.map_vadd ContinuousAffineMap.map_vadd
@[simp]
theorem contLinear_map_vsub (f : P →ᴬ[R] Q) (p₁ p₂ : P) : f.contLinear (p₁ -ᵥ p₂) = f p₁ -ᵥ f p₂ :=
f.toAffineMap.linearMap_vsub p₁ p₂
#align continuous_affine_map.cont_linear_map_vsub ContinuousAffineMap.contLinear_map_vsub
@[simp]
theorem const_contLinear (q : Q) : (const R P q).contLinear = 0 :=
rfl
#align continuous_affine_map.const_cont_linear ContinuousAffineMap.const_contLinear
| Mathlib/Analysis/NormedSpace/ContinuousAffineMap.lean | 102 | 114 | theorem contLinear_eq_zero_iff_exists_const (f : P →ᴬ[R] Q) :
f.contLinear = 0 ↔ ∃ q, f = const R P q := by |
have h₁ : f.contLinear = 0 ↔ (f : P →ᵃ[R] Q).linear = 0 := by
refine ⟨fun h => ?_, fun h => ?_⟩ <;> ext
· rw [← coe_contLinear_eq_linear, h]; rfl
· rw [← coe_linear_eq_coe_contLinear, h]; rfl
have h₂ : ∀ q : Q, f = const R P q ↔ (f : P →ᵃ[R] Q) = AffineMap.const R P q := by
intro q
refine ⟨fun h => ?_, fun h => ?_⟩ <;> ext
· rw [h]; rfl
· rw [← coe_to_affineMap, h]; rfl
simp_rw [h₁, h₂]
exact (f : P →ᵃ[R] Q).linear_eq_zero_iff_exists_const
| 11 |
import Mathlib.Algebra.Order.AbsoluteValue
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
import Mathlib.Algebra.Ring.Pi
import Mathlib.GroupTheory.GroupAction.Pi
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.Init.Align
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Ring
#align_import data.real.cau_seq from "leanprover-community/mathlib"@"9116dd6709f303dcf781632e15fdef382b0fc579"
assert_not_exists Finset
assert_not_exists Module
assert_not_exists Submonoid
assert_not_exists FloorRing
variable {α β : Type*}
open IsAbsoluteValue
section
variable [LinearOrderedField α] [Ring β] (abv : β → α) [IsAbsoluteValue abv]
theorem rat_add_continuous_lemma {ε : α} (ε0 : 0 < ε) :
∃ δ > 0, ∀ {a₁ a₂ b₁ b₂ : β}, abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ →
abv (a₁ + a₂ - (b₁ + b₂)) < ε :=
⟨ε / 2, half_pos ε0, fun {a₁ a₂ b₁ b₂} h₁ h₂ => by
simpa [add_halves, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using
lt_of_le_of_lt (abv_add abv _ _) (add_lt_add h₁ h₂)⟩
#align rat_add_continuous_lemma rat_add_continuous_lemma
| Mathlib/Algebra/Order/CauSeq/Basic.lean | 58 | 71 | theorem rat_mul_continuous_lemma {ε K₁ K₂ : α} (ε0 : 0 < ε) :
∃ δ > 0, ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ →
abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε := by |
have K0 : (0 : α) < max 1 (max K₁ K₂) := lt_of_lt_of_le zero_lt_one (le_max_left _ _)
have εK := div_pos (half_pos ε0) K0
refine ⟨_, εK, fun {a₁ a₂ b₁ b₂} ha₁ hb₂ h₁ h₂ => ?_⟩
replace ha₁ := lt_of_lt_of_le ha₁ (le_trans (le_max_left _ K₂) (le_max_right 1 _))
replace hb₂ := lt_of_lt_of_le hb₂ (le_trans (le_max_right K₁ _) (le_max_right 1 _))
set M := max 1 (max K₁ K₂)
have : abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M := by
gcongr
rw [← abv_mul abv, mul_comm, div_mul_cancel₀ _ (ne_of_gt K0), ← abv_mul abv, add_halves] at this
simpa [sub_eq_add_neg, mul_add, add_mul, add_left_comm] using
lt_of_le_of_lt (abv_add abv _ _) this
| 11 |
import Mathlib.Analysis.Complex.Circle
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
#align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
noncomputable section
open Complex
open ComplexConjugate
local notation "|" x "|" => Complex.abs x
def rotation : circle →* ℂ ≃ₗᵢ[ℝ] ℂ where
toFun a :=
{ DistribMulAction.toLinearEquiv ℝ ℂ a with
norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] }
map_one' := LinearIsometryEquiv.ext <| one_smul circle
map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b
#align rotation rotation
@[simp]
theorem rotation_apply (a : circle) (z : ℂ) : rotation a z = a * z :=
rfl
#align rotation_apply rotation_apply
@[simp]
theorem rotation_symm (a : circle) : (rotation a).symm = rotation a⁻¹ :=
LinearIsometryEquiv.ext fun _ => rfl
#align rotation_symm rotation_symm
@[simp]
theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by
ext1
simp
#align rotation_trans rotation_trans
theorem rotation_ne_conjLIE (a : circle) : rotation a ≠ conjLIE := by
intro h
have h1 : rotation a 1 = conj 1 := LinearIsometryEquiv.congr_fun h 1
have hI : rotation a I = conj I := LinearIsometryEquiv.congr_fun h I
rw [rotation_apply, RingHom.map_one, mul_one] at h1
rw [rotation_apply, conj_I, ← neg_one_mul, mul_left_inj' I_ne_zero, h1, eq_neg_self_iff] at hI
exact one_ne_zero hI
#align rotation_ne_conj_lie rotation_ne_conjLIE
@[simps]
def rotationOf (e : ℂ ≃ₗᵢ[ℝ] ℂ) : circle :=
⟨e 1 / Complex.abs (e 1), by simp⟩
#align rotation_of rotationOf
@[simp]
theorem rotationOf_rotation (a : circle) : rotationOf (rotation a) = a :=
Subtype.ext <| by simp
#align rotation_of_rotation rotationOf_rotation
theorem rotation_injective : Function.Injective rotation :=
Function.LeftInverse.injective rotationOf_rotation
#align rotation_injective rotation_injective
theorem LinearIsometry.re_apply_eq_re_of_add_conj_eq (f : ℂ →ₗᵢ[ℝ] ℂ)
(h₃ : ∀ z, z + conj z = f z + conj (f z)) (z : ℂ) : (f z).re = z.re := by
simpa [ext_iff, add_re, add_im, conj_re, conj_im, ← two_mul,
show (2 : ℝ) ≠ 0 by simp [two_ne_zero]] using (h₃ z).symm
#align linear_isometry.re_apply_eq_re_of_add_conj_eq LinearIsometry.re_apply_eq_re_of_add_conj_eq
theorem LinearIsometry.im_apply_eq_im_or_neg_of_re_apply_eq_re {f : ℂ →ₗᵢ[ℝ] ℂ}
(h₂ : ∀ z, (f z).re = z.re) (z : ℂ) : (f z).im = z.im ∨ (f z).im = -z.im := by
have h₁ := f.norm_map z
simp only [Complex.abs_def, norm_eq_abs] at h₁
rwa [Real.sqrt_inj (normSq_nonneg _) (normSq_nonneg _), normSq_apply (f z), normSq_apply z,
h₂, add_left_cancel_iff, mul_self_eq_mul_self_iff] at h₁
#align linear_isometry.im_apply_eq_im_or_neg_of_re_apply_eq_re LinearIsometry.im_apply_eq_im_or_neg_of_re_apply_eq_re
| Mathlib/Analysis/Complex/Isometry.lean | 104 | 116 | theorem LinearIsometry.im_apply_eq_im {f : ℂ →ₗᵢ[ℝ] ℂ} (h : f 1 = 1) (z : ℂ) :
z + conj z = f z + conj (f z) := by |
have : ‖f z - 1‖ = ‖z - 1‖ := by rw [← f.norm_map (z - 1), f.map_sub, h]
apply_fun fun x => x ^ 2 at this
simp only [norm_eq_abs, ← normSq_eq_abs] at this
rw [← ofReal_inj, ← mul_conj, ← mul_conj] at this
rw [RingHom.map_sub, RingHom.map_sub] at this
simp only [sub_mul, mul_sub, one_mul, mul_one] at this
rw [mul_conj, normSq_eq_abs, ← norm_eq_abs, LinearIsometry.norm_map] at this
rw [mul_conj, normSq_eq_abs, ← norm_eq_abs] at this
simp only [sub_sub, sub_right_inj, mul_one, ofReal_pow, RingHom.map_one, norm_eq_abs] at this
simp only [add_sub, sub_left_inj] at this
rw [add_comm, ← this, add_comm]
| 11 |
import Mathlib.Init.Algebra.Classes
import Mathlib.Data.FunLike.Basic
import Mathlib.Logic.Embedding.Basic
import Mathlib.Order.RelClasses
#align_import order.rel_iso.basic from "leanprover-community/mathlib"@"f29120f82f6e24a6f6579896dfa2de6769fec962"
set_option autoImplicit true
open Function
universe u v w
variable {α β γ δ : Type*} {r : α → α → Prop} {s : β → β → Prop}
{t : γ → γ → Prop} {u : δ → δ → Prop}
structure RelHom {α β : Type*} (r : α → α → Prop) (s : β → β → Prop) where
toFun : α → β
map_rel' : ∀ {a b}, r a b → s (toFun a) (toFun b)
#align rel_hom RelHom
infixl:25 " →r " => RelHom
section
class RelHomClass (F : Type*) {α β : Type*} (r : outParam <| α → α → Prop)
(s : outParam <| β → β → Prop) [FunLike F α β] : Prop where
map_rel : ∀ (f : F) {a b}, r a b → s (f a) (f b)
#align rel_hom_class RelHomClass
export RelHomClass (map_rel)
end
| Mathlib/Order/RelIso/Basic.lean | 168 | 180 | theorem injective_of_increasing (r : α → α → Prop) (s : β → β → Prop) [IsTrichotomous α r]
[IsIrrefl β s] (f : α → β) (hf : ∀ {x y}, r x y → s (f x) (f y)) : Injective f := by |
intro x y hxy
rcases trichotomous_of r x y with (h | h | h)
· have := hf h
rw [hxy] at this
exfalso
exact irrefl_of s (f y) this
· exact h
· have := hf h
rw [hxy] at this
exfalso
exact irrefl_of s (f y) this
| 11 |
import Mathlib.Order.Chain
#align_import order.zorn from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb"
open scoped Classical
open Set
variable {α β : Type*} {r : α → α → Prop} {c : Set α}
local infixl:50 " ≺ " => r
theorem exists_maximal_of_chains_bounded (h : ∀ c, IsChain r c → ∃ ub, ∀ a ∈ c, a ≺ ub)
(trans : ∀ {a b c}, a ≺ b → b ≺ c → a ≺ c) : ∃ m, ∀ a, m ≺ a → a ≺ m :=
have : ∃ ub, ∀ a ∈ maxChain r, a ≺ ub := h _ <| maxChain_spec.left
let ⟨ub, (hub : ∀ a ∈ maxChain r, a ≺ ub)⟩ := this
⟨ub, fun a ha =>
have : IsChain r (insert a <| maxChain r) :=
maxChain_spec.1.insert fun b hb _ => Or.inr <| trans (hub b hb) ha
hub a <| by
rw [maxChain_spec.right this (subset_insert _ _)]
exact mem_insert _ _⟩
#align exists_maximal_of_chains_bounded exists_maximal_of_chains_bounded
theorem exists_maximal_of_nonempty_chains_bounded [Nonempty α]
(h : ∀ c, IsChain r c → c.Nonempty → ∃ ub, ∀ a ∈ c, a ≺ ub)
(trans : ∀ {a b c}, a ≺ b → b ≺ c → a ≺ c) : ∃ m, ∀ a, m ≺ a → a ≺ m :=
exists_maximal_of_chains_bounded
(fun c hc =>
(eq_empty_or_nonempty c).elim
(fun h => ⟨Classical.arbitrary α, fun x hx => (h ▸ hx : x ∈ (∅ : Set α)).elim⟩) (h c hc))
trans
#align exists_maximal_of_nonempty_chains_bounded exists_maximal_of_nonempty_chains_bounded
section Preorder
variable [Preorder α]
theorem zorn_preorder (h : ∀ c : Set α, IsChain (· ≤ ·) c → BddAbove c) :
∃ m : α, ∀ a, m ≤ a → a ≤ m :=
exists_maximal_of_chains_bounded h le_trans
#align zorn_preorder zorn_preorder
theorem zorn_nonempty_preorder [Nonempty α]
(h : ∀ c : Set α, IsChain (· ≤ ·) c → c.Nonempty → BddAbove c) : ∃ m : α, ∀ a, m ≤ a → a ≤ m :=
exists_maximal_of_nonempty_chains_bounded h le_trans
#align zorn_nonempty_preorder zorn_nonempty_preorder
theorem zorn_preorder₀ (s : Set α)
(ih : ∀ c ⊆ s, IsChain (· ≤ ·) c → ∃ ub ∈ s, ∀ z ∈ c, z ≤ ub) :
∃ m ∈ s, ∀ z ∈ s, m ≤ z → z ≤ m :=
let ⟨⟨m, hms⟩, h⟩ :=
@zorn_preorder s _ fun c hc =>
let ⟨ub, hubs, hub⟩ :=
ih (Subtype.val '' c) (fun _ ⟨⟨_, hx⟩, _, h⟩ => h ▸ hx)
(by
rintro _ ⟨p, hpc, rfl⟩ _ ⟨q, hqc, rfl⟩ hpq
exact hc hpc hqc fun t => hpq (Subtype.ext_iff.1 t))
⟨⟨ub, hubs⟩, fun ⟨y, hy⟩ hc => hub _ ⟨_, hc, rfl⟩⟩
⟨m, hms, fun z hzs hmz => h ⟨z, hzs⟩ hmz⟩
#align zorn_preorder₀ zorn_preorder₀
| Mathlib/Order/Zorn.lean | 128 | 141 | theorem zorn_nonempty_preorder₀ (s : Set α)
(ih : ∀ c ⊆ s, IsChain (· ≤ ·) c → ∀ y ∈ c, ∃ ub ∈ s, ∀ z ∈ c, z ≤ ub) (x : α)
(hxs : x ∈ s) : ∃ m ∈ s, x ≤ m ∧ ∀ z ∈ s, m ≤ z → z ≤ m := by |
-- Porting note: the first three lines replace the following two lines in mathlib3.
-- The mathlib3 `rcases` supports holes for proof obligations, this is not yet implemented in 4.
-- rcases zorn_preorder₀ ({ y ∈ s | x ≤ y }) fun c hcs hc => ?_ with ⟨m, ⟨hms, hxm⟩, hm⟩
-- · exact ⟨m, hms, hxm, fun z hzs hmz => hm _ ⟨hzs, hxm.trans hmz⟩ hmz⟩
have H := zorn_preorder₀ ({ y ∈ s | x ≤ y }) fun c hcs hc => ?_
· rcases H with ⟨m, ⟨hms, hxm⟩, hm⟩
exact ⟨m, hms, hxm, fun z hzs hmz => hm _ ⟨hzs, hxm.trans hmz⟩ hmz⟩
· rcases c.eq_empty_or_nonempty with (rfl | ⟨y, hy⟩)
· exact ⟨x, ⟨hxs, le_rfl⟩, fun z => False.elim⟩
· rcases ih c (fun z hz => (hcs hz).1) hc y hy with ⟨z, hzs, hz⟩
exact ⟨z, ⟨hzs, (hcs hy).2.trans <| hz _ hy⟩, hz⟩
| 11 |
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
| 11 |
import Mathlib.LinearAlgebra.Basis.VectorSpace
import Mathlib.LinearAlgebra.Dimension.Constructions
import Mathlib.LinearAlgebra.Dimension.Finite
#align_import field_theory.finiteness from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f"
universe u v
open scoped Classical
open Cardinal
open Cardinal Submodule Module Function
namespace IsNoetherian
variable {K : Type u} {V : Type v} [DivisionRing K] [AddCommGroup V] [Module K V]
| Mathlib/FieldTheory/Finiteness.lean | 32 | 43 | theorem iff_rank_lt_aleph0 : IsNoetherian K V ↔ Module.rank K V < ℵ₀ := by |
let b := Basis.ofVectorSpace K V
rw [← b.mk_eq_rank'', lt_aleph0_iff_set_finite]
constructor
· intro
exact (Basis.ofVectorSpaceIndex.linearIndependent K V).set_finite_of_isNoetherian
· intro hbfinite
refine
@isNoetherian_of_linearEquiv K (⊤ : Submodule K V) V _ _ _ _ _ (LinearEquiv.ofTop _ rfl)
(id ?_)
refine isNoetherian_of_fg_of_noetherian _ ⟨Set.Finite.toFinset hbfinite, ?_⟩
rw [Set.Finite.coe_toFinset, ← b.span_eq, Basis.coe_ofVectorSpace, Subtype.range_coe]
| 11 |
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
| 11 |
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
| 11 |
import Mathlib.ModelTheory.ElementarySubstructures
#align_import model_theory.skolem from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042"
universe u v w w'
namespace FirstOrder
namespace Language
open Structure Cardinal
open Cardinal
variable (L : Language.{u, v}) {M : Type w} [Nonempty M] [L.Structure M]
@[simps]
def skolem₁ : Language :=
⟨fun n => L.BoundedFormula Empty (n + 1), fun _ => Empty⟩
#align first_order.language.skolem₁ FirstOrder.Language.skolem₁
#align first_order.language.skolem₁_functions FirstOrder.Language.skolem₁_Functions
variable {L}
| Mathlib/ModelTheory/Skolem.lean | 50 | 62 | theorem card_functions_sum_skolem₁ :
#(Σ n, (L.sum L.skolem₁).Functions n) = #(Σ n, L.BoundedFormula Empty (n + 1)) := by |
simp only [card_functions_sum, skolem₁_Functions, mk_sigma, sum_add_distrib']
conv_lhs => enter [2, 1, i]; rw [lift_id'.{u, v}]
rw [add_comm, add_eq_max, max_eq_left]
· refine sum_le_sum _ _ fun n => ?_
rw [← lift_le.{_, max u v}, lift_lift, lift_mk_le.{v}]
refine ⟨⟨fun f => (func f default).bdEqual (func f default), fun f g h => ?_⟩⟩
rcases h with ⟨rfl, ⟨rfl⟩⟩
rfl
· rw [← mk_sigma]
exact infinite_iff.1 (Infinite.of_injective (fun n => ⟨n, ⊥⟩) fun x y xy =>
(Sigma.mk.inj_iff.1 xy).1)
| 11 |
import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Algebra.Group.Basic
open scoped Topology Pointwise
open MulAction Set Function
variable {G X : Type*} [TopologicalSpace G] [TopologicalSpace X]
[Group G] [TopologicalGroup G] [MulAction G X]
[SigmaCompactSpace G] [BaireSpace X] [T2Space X]
[ContinuousSMul G X] [IsPretransitive G X]
@[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a
Baire space. Then the orbit map is open around zero. It follows in
`isOpenMap_vadd_of_sigmaCompact` that it is open around any point."]
theorem smul_singleton_mem_nhds_of_sigmaCompact
{U : Set G} (hU : U ∈ 𝓝 1) (x : X) : U • {x} ∈ 𝓝 x := by
obtain ⟨V, V_mem, V_closed, V_symm, VU⟩ : ∃ V ∈ 𝓝 (1 : G), IsClosed V ∧ V⁻¹ = V ∧ V * V ⊆ U :=
exists_closed_nhds_one_inv_eq_mul_subset hU
obtain ⟨s, s_count, hs⟩ : ∃ (s : Set G), s.Countable ∧ ⋃ g ∈ s, g • V = univ := by
apply countable_cover_nhds_of_sigma_compact (fun g ↦ ?_)
convert smul_mem_nhds g V_mem
simp only [smul_eq_mul, mul_one]
let K : ℕ → Set G := compactCovering G
let F : ℕ × s → Set X := fun p ↦ (K p.1 ∩ (p.2 : G) • V) • ({x} : Set X)
obtain ⟨⟨n, ⟨g, hg⟩⟩, hi⟩ : ∃ i, (interior (F i)).Nonempty := by
have : Nonempty X := ⟨x⟩
have : Encodable s := Countable.toEncodable s_count
apply nonempty_interior_of_iUnion_of_closed
· rintro ⟨n, ⟨g, hg⟩⟩
apply IsCompact.isClosed
suffices H : IsCompact ((fun (g : G) ↦ g • x) '' (K n ∩ g • V)) by
simpa only [F, smul_singleton] using H
apply IsCompact.image
· exact (isCompact_compactCovering G n).inter_right (V_closed.smul g)
· exact continuous_id.smul continuous_const
· apply eq_univ_iff_forall.2 (fun y ↦ ?_)
obtain ⟨h, rfl⟩ : ∃ h, h • x = y := exists_smul_eq G x y
obtain ⟨n, hn⟩ : ∃ n, h ∈ K n := exists_mem_compactCovering h
obtain ⟨g, gs, hg⟩ : ∃ g ∈ s, h ∈ g • V := exists_set_mem_of_union_eq_top s _ hs _
simp only [F, smul_singleton, mem_iUnion, mem_image, mem_inter_iff, Prod.exists,
Subtype.exists, exists_prop]
exact ⟨n, g, gs, h, ⟨hn, hg⟩, rfl⟩
have I : (interior ((g • V) • {x})).Nonempty := by
apply hi.mono
apply interior_mono
exact smul_subset_smul_right inter_subset_right
obtain ⟨y, hy⟩ : (interior (V • ({x} : Set X))).Nonempty := by
rw [smul_assoc, interior_smul] at I
exact smul_set_nonempty.1 I
obtain ⟨g', hg', rfl⟩ : ∃ g' ∈ V, g' • x = y := by simpa using interior_subset hy
have J : (g' ⁻¹ • V) • {x} ∈ 𝓝 x := by
apply mem_interior_iff_mem_nhds.1
rwa [smul_assoc, interior_smul, mem_inv_smul_set_iff]
have : (g'⁻¹ • V) • {x} ⊆ U • ({x} : Set X) := by
apply smul_subset_smul_right
apply Subset.trans (smul_set_subset_smul (inv_mem_inv.2 hg')) ?_
rw [V_symm]
exact VU
exact Filter.mem_of_superset J this
@[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a
Baire space. Then the orbit map is open. This is a version of the open mapping theorem, valid
notably for the action of a sigma-compact locally compact group on a locally compact space."]
| Mathlib/Topology/Algebra/Group/OpenMapping.lean | 96 | 107 | theorem isOpenMap_smul_of_sigmaCompact (x : X) : IsOpenMap (fun (g : G) ↦ g • x) := by |
/- We have already proved the theorem around the basepoint of the orbit, in
`smul_singleton_mem_nhds_of_sigmaCompact`. The general statement follows around an arbitrary
point by changing basepoints. -/
simp_rw [isOpenMap_iff_nhds_le, Filter.le_map_iff]
intro g U hU
have : (· • x) = (· • (g • x)) ∘ (· * g⁻¹) := by
ext g
simp [smul_smul]
rw [this, image_comp, ← smul_singleton]
apply smul_singleton_mem_nhds_of_sigmaCompact
simpa using isOpenMap_mul_right g⁻¹ |>.image_mem_nhds hU
| 11 |
import Mathlib.Data.ZMod.Basic
import Mathlib.Algebra.Group.Nat
import Mathlib.Tactic.IntervalCases
import Mathlib.GroupTheory.SpecificGroups.Dihedral
import Mathlib.GroupTheory.SpecificGroups.Cyclic
#align_import group_theory.specific_groups.quaternion from "leanprover-community/mathlib"@"879155bff5af618b9062cbb2915347dafd749ad6"
inductive QuaternionGroup (n : ℕ) : Type
| a : ZMod (2 * n) → QuaternionGroup n
| xa : ZMod (2 * n) → QuaternionGroup n
deriving DecidableEq
#align quaternion_group QuaternionGroup
namespace QuaternionGroup
variable {n : ℕ}
private def mul : QuaternionGroup n → QuaternionGroup n → QuaternionGroup n
| a i, a j => a (i + j)
| a i, xa j => xa (j - i)
| xa i, a j => xa (i + j)
| xa i, xa j => a (n + j - i)
private def one : QuaternionGroup n :=
a 0
instance : Inhabited (QuaternionGroup n) :=
⟨one⟩
private def inv : QuaternionGroup n → QuaternionGroup n
| a i => a (-i)
| xa i => xa (n + i)
instance : Group (QuaternionGroup n) where
mul := mul
mul_assoc := by
rintro (i | i) (j | j) (k | k) <;> simp only [(· * ·), mul] <;> ring_nf
congr
calc
-(n : ZMod (2 * n)) = 0 - n := by rw [zero_sub]
_ = 2 * n - n := by norm_cast; simp
_ = n := by ring
one := one
one_mul := by
rintro (i | i)
· exact congr_arg a (zero_add i)
· exact congr_arg xa (sub_zero i)
mul_one := by
rintro (i | i)
· exact congr_arg a (add_zero i)
· exact congr_arg xa (add_zero i)
inv := inv
mul_left_inv := by
rintro (i | i)
· exact congr_arg a (neg_add_self i)
· exact congr_arg a (sub_self (n + i))
@[simp]
theorem a_mul_a (i j : ZMod (2 * n)) : a i * a j = a (i + j) :=
rfl
#align quaternion_group.a_mul_a QuaternionGroup.a_mul_a
@[simp]
theorem a_mul_xa (i j : ZMod (2 * n)) : a i * xa j = xa (j - i) :=
rfl
#align quaternion_group.a_mul_xa QuaternionGroup.a_mul_xa
@[simp]
theorem xa_mul_a (i j : ZMod (2 * n)) : xa i * a j = xa (i + j) :=
rfl
#align quaternion_group.xa_mul_a QuaternionGroup.xa_mul_a
@[simp]
theorem xa_mul_xa (i j : ZMod (2 * n)) : xa i * xa j = a ((n : ZMod (2 * n)) + j - i) :=
rfl
#align quaternion_group.xa_mul_xa QuaternionGroup.xa_mul_xa
theorem one_def : (1 : QuaternionGroup n) = a 0 :=
rfl
#align quaternion_group.one_def QuaternionGroup.one_def
private def fintypeHelper : Sum (ZMod (2 * n)) (ZMod (2 * n)) ≃ QuaternionGroup n where
invFun i :=
match i with
| a j => Sum.inl j
| xa j => Sum.inr j
toFun i :=
match i with
| Sum.inl j => a j
| Sum.inr j => xa j
left_inv := by rintro (x | x) <;> rfl
right_inv := by rintro (x | x) <;> rfl
def quaternionGroupZeroEquivDihedralGroupZero : QuaternionGroup 0 ≃* DihedralGroup 0 where
toFun i :=
-- Porting note: Originally `QuaternionGroup.recOn i DihedralGroup.r DihedralGroup.sr`
match i with
| a j => DihedralGroup.r j
| xa j => DihedralGroup.sr j
invFun i :=
match i with
| DihedralGroup.r j => a j
| DihedralGroup.sr j => xa j
left_inv := by rintro (k | k) <;> rfl
right_inv := by rintro (k | k) <;> rfl
map_mul' := by rintro (k | k) (l | l) <;> simp
#align quaternion_group.quaternion_group_zero_equiv_dihedral_group_zero QuaternionGroup.quaternionGroupZeroEquivDihedralGroupZero
instance [NeZero n] : Fintype (QuaternionGroup n) :=
Fintype.ofEquiv _ fintypeHelper
instance : Nontrivial (QuaternionGroup n) :=
⟨⟨a 0, xa 0, by revert n; simp⟩⟩ -- Porting note: `revert n; simp` was `decide`
theorem card [NeZero n] : Fintype.card (QuaternionGroup n) = 4 * n := by
rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul]
ring
#align quaternion_group.card QuaternionGroup.card
@[simp]
theorem a_one_pow (k : ℕ) : (a 1 : QuaternionGroup n) ^ k = a k := by
induction' k with k IH
· rw [Nat.cast_zero]; rfl
· rw [pow_succ, IH, a_mul_a]
congr 1
norm_cast
#align quaternion_group.a_one_pow QuaternionGroup.a_one_pow
-- @[simp] -- Porting note: simp changes this to `a 0 = 1`, so this is no longer a good simp lemma.
theorem a_one_pow_n : (a 1 : QuaternionGroup n) ^ (2 * n) = 1 := by
rw [a_one_pow, one_def]
congr 1
exact ZMod.natCast_self _
#align quaternion_group.a_one_pow_n QuaternionGroup.a_one_pow_n
@[simp]
theorem xa_sq (i : ZMod (2 * n)) : xa i ^ 2 = a n := by simp [sq]
#align quaternion_group.xa_sq QuaternionGroup.xa_sq
@[simp]
theorem xa_pow_four (i : ZMod (2 * n)) : xa i ^ 4 = 1 := by
rw [pow_succ, pow_succ, sq, xa_mul_xa, a_mul_xa, xa_mul_xa,
add_sub_cancel_right, add_sub_assoc, sub_sub_cancel]
norm_cast
rw [← two_mul]
simp [one_def]
#align quaternion_group.xa_pow_four QuaternionGroup.xa_pow_four
@[simp]
| Mathlib/GroupTheory/SpecificGroups/Quaternion.lean | 211 | 222 | theorem orderOf_xa [NeZero n] (i : ZMod (2 * n)) : orderOf (xa i) = 4 := by |
change _ = 2 ^ 2
haveI : Fact (Nat.Prime 2) := Fact.mk Nat.prime_two
apply orderOf_eq_prime_pow
· intro h
simp only [pow_one, xa_sq] at h
injection h with h'
apply_fun ZMod.val at h'
apply_fun (· / n) at h'
simp only [ZMod.val_natCast, ZMod.val_zero, Nat.zero_div, Nat.mod_mul_left_div_self,
Nat.div_self (NeZero.pos n)] at h'
· norm_num
| 11 |
import Mathlib.SetTheory.Game.Ordinal
import Mathlib.SetTheory.Ordinal.NaturalOps
#align_import set_theory.game.birthday from "leanprover-community/mathlib"@"a347076985674932c0e91da09b9961ed0a79508c"
universe u
open Ordinal
namespace SetTheory
open scoped NaturalOps PGame
namespace PGame
noncomputable def birthday : PGame.{u} → Ordinal.{u}
| ⟨_, _, xL, xR⟩ =>
max (lsub.{u, u} fun i => birthday (xL i)) (lsub.{u, u} fun i => birthday (xR i))
#align pgame.birthday SetTheory.PGame.birthday
theorem birthday_def (x : PGame) :
birthday x =
max (lsub.{u, u} fun i => birthday (x.moveLeft i))
(lsub.{u, u} fun i => birthday (x.moveRight i)) := by
cases x; rw [birthday]; rfl
#align pgame.birthday_def SetTheory.PGame.birthday_def
theorem birthday_moveLeft_lt {x : PGame} (i : x.LeftMoves) :
(x.moveLeft i).birthday < x.birthday := by
cases x; rw [birthday]; exact lt_max_of_lt_left (lt_lsub _ i)
#align pgame.birthday_move_left_lt SetTheory.PGame.birthday_moveLeft_lt
theorem birthday_moveRight_lt {x : PGame} (i : x.RightMoves) :
(x.moveRight i).birthday < x.birthday := by
cases x; rw [birthday]; exact lt_max_of_lt_right (lt_lsub _ i)
#align pgame.birthday_move_right_lt SetTheory.PGame.birthday_moveRight_lt
| Mathlib/SetTheory/Game/Birthday.lean | 64 | 78 | theorem lt_birthday_iff {x : PGame} {o : Ordinal} :
o < x.birthday ↔
(∃ i : x.LeftMoves, o ≤ (x.moveLeft i).birthday) ∨
∃ i : x.RightMoves, o ≤ (x.moveRight i).birthday := by |
constructor
· rw [birthday_def]
intro h
cases' lt_max_iff.1 h with h' h'
· left
rwa [lt_lsub_iff] at h'
· right
rwa [lt_lsub_iff] at h'
· rintro (⟨i, hi⟩ | ⟨i, hi⟩)
· exact hi.trans_lt (birthday_moveLeft_lt i)
· exact hi.trans_lt (birthday_moveRight_lt i)
| 11 |
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Limits.Shapes.Kernels
import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.Subobject.Lattice
import Mathlib.Order.Atoms
#align_import category_theory.simple from "leanprover-community/mathlib"@"4ed0bcaef698011b0692b93a042a2282f490f6b6"
noncomputable section
open CategoryTheory.Limits
namespace CategoryTheory
universe v u
variable {C : Type u} [Category.{v} C]
section
variable [HasZeroMorphisms C]
class Simple (X : C) : Prop where
mono_isIso_iff_nonzero : ∀ {Y : C} (f : Y ⟶ X) [Mono f], IsIso f ↔ f ≠ 0
#align category_theory.simple CategoryTheory.Simple
theorem isIso_of_mono_of_nonzero {X Y : C} [Simple Y] {f : X ⟶ Y} [Mono f] (w : f ≠ 0) : IsIso f :=
(Simple.mono_isIso_iff_nonzero f).mpr w
#align category_theory.is_iso_of_mono_of_nonzero CategoryTheory.isIso_of_mono_of_nonzero
theorem Simple.of_iso {X Y : C} [Simple Y] (i : X ≅ Y) : Simple X :=
{ mono_isIso_iff_nonzero := fun f m => by
haveI : Mono (f ≫ i.hom) := mono_comp _ _
constructor
· intro h w
have j : IsIso (f ≫ i.hom) := by infer_instance
rw [Simple.mono_isIso_iff_nonzero] at j
subst w
simp at j
· intro h
have j : IsIso (f ≫ i.hom) := by
apply isIso_of_mono_of_nonzero
intro w
apply h
simpa using (cancel_mono i.inv).2 w
rw [← Category.comp_id f, ← i.hom_inv_id, ← Category.assoc]
infer_instance }
#align category_theory.simple.of_iso CategoryTheory.Simple.of_iso
theorem Simple.iff_of_iso {X Y : C} (i : X ≅ Y) : Simple X ↔ Simple Y :=
⟨fun _ => Simple.of_iso i.symm, fun _ => Simple.of_iso i⟩
#align category_theory.simple.iff_of_iso CategoryTheory.Simple.iff_of_iso
theorem kernel_zero_of_nonzero_from_simple {X Y : C} [Simple X] {f : X ⟶ Y} [HasKernel f]
(w : f ≠ 0) : kernel.ι f = 0 := by
classical
by_contra h
haveI := isIso_of_mono_of_nonzero h
exact w (eq_zero_of_epi_kernel f)
#align category_theory.kernel_zero_of_nonzero_from_simple CategoryTheory.kernel_zero_of_nonzero_from_simple
-- See also `mono_of_nonzero_from_simple`, which requires `Preadditive C`.
theorem epi_of_nonzero_to_simple [HasEqualizers C] {X Y : C} [Simple Y] {f : X ⟶ Y} [HasImage f]
(w : f ≠ 0) : Epi f := by
rw [← image.fac f]
haveI : IsIso (image.ι f) := isIso_of_mono_of_nonzero fun h => w (eq_zero_of_image_eq_zero h)
apply epi_comp
#align category_theory.epi_of_nonzero_to_simple CategoryTheory.epi_of_nonzero_to_simple
theorem mono_to_simple_zero_of_not_iso {X Y : C} [Simple Y] {f : X ⟶ Y} [Mono f]
(w : IsIso f → False) : f = 0 := by
classical
by_contra h
exact w (isIso_of_mono_of_nonzero h)
#align category_theory.mono_to_simple_zero_of_not_iso CategoryTheory.mono_to_simple_zero_of_not_iso
theorem id_nonzero (X : C) [Simple.{v} X] : 𝟙 X ≠ 0 :=
(Simple.mono_isIso_iff_nonzero (𝟙 X)).mp (by infer_instance)
#align category_theory.id_nonzero CategoryTheory.id_nonzero
instance (X : C) [Simple.{v} X] : Nontrivial (End X) :=
nontrivial_of_ne 1 _ (id_nonzero X)
section
theorem Simple.not_isZero (X : C) [Simple X] : ¬IsZero X := by
simpa [Limits.IsZero.iff_id_eq_zero] using id_nonzero X
#align category_theory.simple.not_is_zero CategoryTheory.Simple.not_isZero
variable [HasZeroObject C]
open ZeroObject
variable (C)
theorem zero_not_simple [Simple (0 : C)] : False :=
(Simple.mono_isIso_iff_nonzero (0 : (0 : C) ⟶ (0 : C))).mp ⟨⟨0, by aesop_cat⟩⟩ rfl
#align category_theory.zero_not_simple CategoryTheory.zero_not_simple
end
end
-- We next make the dual arguments, but for this we must be in an abelian category.
section Subobject
variable [HasZeroMorphisms C] [HasZeroObject C]
open ZeroObject
open Subobject
instance {X : C} [Simple X] : Nontrivial (Subobject X) :=
nontrivial_of_not_isZero (Simple.not_isZero X)
instance {X : C} [Simple X] : IsSimpleOrder (Subobject X) where
eq_bot_or_eq_top := by
rintro ⟨⟨⟨Y : C, ⟨⟨⟩⟩, f : Y ⟶ X⟩, m : Mono f⟩⟩
change mk f = ⊥ ∨ mk f = ⊤
by_cases h : f = 0
· exact Or.inl (mk_eq_bot_iff_zero.mpr h)
· refine Or.inr ((isIso_iff_mk_eq_top _).mp ((Simple.mono_isIso_iff_nonzero f).mpr h))
| Mathlib/CategoryTheory/Simple.lean | 237 | 248 | theorem simple_of_isSimpleOrder_subobject (X : C) [IsSimpleOrder (Subobject X)] : Simple X := by |
constructor; intros Y f hf; constructor
· intro i
rw [Subobject.isIso_iff_mk_eq_top] at i
intro w
rw [← Subobject.mk_eq_bot_iff_zero] at w
exact IsSimpleOrder.bot_ne_top (w.symm.trans i)
· intro i
rcases IsSimpleOrder.eq_bot_or_eq_top (Subobject.mk f) with (h | h)
· rw [Subobject.mk_eq_bot_iff_zero] at h
exact False.elim (i h)
· exact (Subobject.isIso_iff_mk_eq_top _).mpr h
| 11 |
import Mathlib.Algebra.Homology.HomologicalComplex
import Mathlib.AlgebraicTopology.SimplicialObject
import Mathlib.CategoryTheory.Abelian.Basic
#align_import algebraic_topology.Moore_complex from "leanprover-community/mathlib"@"0bd2ea37bcba5769e14866170f251c9bc64e35d7"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Limits
open Opposite
namespace AlgebraicTopology
variable {C : Type*} [Category C] [Abelian C]
attribute [local instance] Abelian.hasPullbacks
namespace NormalizedMooreComplex
open CategoryTheory.Subobject
variable (X : SimplicialObject C)
def objX : ∀ n : ℕ, Subobject (X.obj (op (SimplexCategory.mk n)))
| 0 => ⊤
| n + 1 => Finset.univ.inf fun k : Fin (n + 1) => kernelSubobject (X.δ k.succ)
set_option linter.uppercaseLean3 false in
#align algebraic_topology.normalized_Moore_complex.obj_X AlgebraicTopology.NormalizedMooreComplex.objX
theorem objX_zero : objX X 0 = ⊤ :=
rfl
theorem objX_add_one (n) :
objX X (n + 1) = Finset.univ.inf fun k : Fin (n + 1) => kernelSubobject (X.δ k.succ) :=
rfl
attribute [eqns objX_zero objX_add_one] objX
attribute [simp] objX
@[simp]
def objD : ∀ n : ℕ, (objX X (n + 1) : C) ⟶ (objX X n : C)
| 0 => Subobject.arrow _ ≫ X.δ (0 : Fin 2) ≫ inv (⊤ : Subobject _).arrow
| n + 1 => by
-- The differential is `Subobject.arrow _ ≫ X.δ (0 : Fin (n+3))`,
-- factored through the intersection of the kernels.
refine factorThru _ (arrow _ ≫ X.δ (0 : Fin (n + 3))) ?_
-- We now need to show that it factors!
-- A morphism factors through an intersection of subobjects if it factors through each.
refine (finset_inf_factors _).mpr fun i _ => ?_
-- A morphism `f` factors through the kernel of `g` exactly if `f ≫ g = 0`.
apply kernelSubobject_factors
dsimp [objX]
-- Use a simplicial identity
erw [Category.assoc, ← X.δ_comp_δ (Fin.zero_le i.succ)]
-- We can rewrite the arrow out of the intersection of all the kernels as a composition
-- of a morphism we don't care about with the arrow out of the kernel of `X.δ i.succ.succ`.
rw [← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ i.succ (by simp)),
Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.normalized_Moore_complex.obj_d AlgebraicTopology.NormalizedMooreComplex.objD
| Mathlib/AlgebraicTopology/MooreComplex.lean | 100 | 111 | theorem d_squared (n : ℕ) : objD X (n + 1) ≫ objD X n = 0 := by |
-- It's a pity we need to do a case split here;
-- after the first erw the proofs are almost identical
rcases n with _ | n <;> dsimp [objD]
· erw [Subobject.factorThru_arrow_assoc, Category.assoc,
← X.δ_comp_δ_assoc (Fin.zero_le (0 : Fin 2)),
← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ (0 : Fin 2) (by simp)),
Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero]
· erw [factorThru_right, factorThru_eq_zero, factorThru_arrow_assoc, Category.assoc,
← X.δ_comp_δ (Fin.zero_le (0 : Fin (n + 3))),
← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ (0 : Fin (n + 3)) (by simp)),
Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero]
| 11 |
import Mathlib.NumberTheory.NumberField.ClassNumber
import Mathlib.NumberTheory.Cyclotomic.Rat
import Mathlib.NumberTheory.Cyclotomic.Embeddings
universe u
namespace IsCyclotomicExtension.Rat
open NumberField Polynomial InfinitePlace Nat Real cyclotomic
variable (K : Type u) [Field K] [NumberField K]
| Mathlib/NumberTheory/Cyclotomic/PID.lean | 30 | 41 | theorem three_pid [IsCyclotomicExtension {3} ℚ K] : IsPrincipalIdealRing (𝓞 K) := by |
apply RingOfIntegers.isPrincipalIdealRing_of_abs_discr_lt
rw [absdiscr_prime 3 K, IsCyclotomicExtension.finrank (n := 3) K
(irreducible_rat (by norm_num)), nrComplexPlaces_eq_totient_div_two 3, totient_prime
PNat.prime_three]
simp only [Int.reduceNeg, PNat.val_ofNat, succ_sub_succ_eq_sub, tsub_zero, zero_lt_two,
Nat.div_self, pow_one, cast_ofNat, neg_mul, one_mul, abs_neg, Int.cast_abs, Int.cast_ofNat,
factorial_two, gt_iff_lt, abs_of_pos (show (0 : ℝ) < 3 by norm_num)]
suffices (2 * (3 / 4) * (2 ^ 2 / 2)) ^ 2 < (2 * (π / 4) * (2 ^ 2 / 2)) ^ 2 from
lt_trans (by norm_num) this
gcongr
exact pi_gt_three
| 11 |
import Mathlib.Algebra.Group.Prod
import Mathlib.Data.Set.Lattice
#align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
assert_not_exists MonoidWithZero
open Prod Decidable Function
namespace Nat
-- Porting note: no pp_nodot
--@[pp_nodot]
def pair (a b : ℕ) : ℕ :=
if a < b then b * b + a else a * a + a + b
#align nat.mkpair Nat.pair
-- Porting note: no pp_nodot
--@[pp_nodot]
def unpair (n : ℕ) : ℕ × ℕ :=
let s := sqrt n
if n - s * s < s then (n - s * s, s) else (s, n - s * s - s)
#align nat.unpair Nat.unpair
@[simp]
theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by
dsimp only [unpair]; let s := sqrt n
have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _)
split_ifs with h
· simp [pair, h, sm]
· have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2
(Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add)
simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm]
#align nat.mkpair_unpair Nat.pair_unpair
theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by
simpa [H] using pair_unpair n
#align nat.mkpair_unpair' Nat.pair_unpair'
@[simp]
theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by
dsimp only [pair]; split_ifs with h
· show unpair (b * b + a) = (a, b)
have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _))
simp [unpair, be, Nat.add_sub_cancel_left, h]
· show unpair (a * a + a + b) = (a, b)
have ae : sqrt (a * a + (a + b)) = a := by
rw [sqrt_add_eq]
exact Nat.add_le_add_left (le_of_not_gt h) _
simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left]
#align nat.unpair_mkpair Nat.unpair_pair
@[simps (config := .asFn)]
def pairEquiv : ℕ × ℕ ≃ ℕ :=
⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩
#align nat.mkpair_equiv Nat.pairEquiv
#align nat.mkpair_equiv_apply Nat.pairEquiv_apply
#align nat.mkpair_equiv_symm_apply Nat.pairEquiv_symm_apply
theorem surjective_unpair : Surjective unpair :=
pairEquiv.symm.surjective
#align nat.surjective_unpair Nat.surjective_unpair
@[simp]
theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d :=
pairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d))
#align nat.mkpair_eq_mkpair Nat.pair_eq_pair
theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by
let s := sqrt n
simp only [unpair, ge_iff_le, Nat.sub_le_iff_le_add]
by_cases h : n - s * s < s <;> simp [h]
· exact lt_of_lt_of_le h (sqrt_le_self _)
· simp at h
have s0 : 0 < s := sqrt_pos.2 n1
exact lt_of_le_of_lt h (Nat.sub_lt n1 (Nat.mul_pos s0 s0))
#align nat.unpair_lt Nat.unpair_lt
@[simp]
theorem unpair_zero : unpair 0 = 0 := by
rw [unpair]
simp
#align nat.unpair_zero Nat.unpair_zero
theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n
| 0 => by simp
| n + 1 => le_of_lt (unpair_lt (Nat.succ_pos _))
#align nat.unpair_left_le Nat.unpair_left_le
theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (pair a b)
#align nat.left_le_mkpair Nat.left_le_pair
theorem right_le_pair (a b : ℕ) : b ≤ pair a b := by
by_cases h : a < b <;> simp [pair, h]
exact le_trans (le_mul_self _) (Nat.le_add_right _ _)
#align nat.right_le_mkpair Nat.right_le_pair
theorem unpair_right_le (n : ℕ) : (unpair n).2 ≤ n := by
simpa using right_le_pair n.unpair.1 n.unpair.2
#align nat.unpair_right_le Nat.unpair_right_le
| Mathlib/Data/Nat/Pairing.lean | 126 | 137 | theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair a₂ b := by |
by_cases h₁ : a₁ < b <;> simp [pair, h₁, Nat.add_assoc]
· by_cases h₂ : a₂ < b <;> simp [pair, h₂, h]
simp? at h₂ says simp only [not_lt] at h₂
apply Nat.add_lt_add_of_le_of_lt
· exact Nat.mul_self_le_mul_self h₂
· exact Nat.lt_add_right _ h
· simp at h₁
simp only [not_lt_of_gt (lt_of_le_of_lt h₁ h), ite_false]
apply add_lt_add
· exact Nat.mul_self_lt_mul_self h
· apply Nat.add_lt_add_right; assumption
| 11 |
import Mathlib.Topology.GDelta
#align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a"
noncomputable section
open scoped Topology
open Filter Set TopologicalSpace
variable {X α : Type*} {ι : Sort*}
section BaireTheorem
variable [TopologicalSpace X] [BaireSpace X]
theorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n))
(hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) :=
BaireSpace.baire_property f ho hd
#align dense_Inter_of_open_nat dense_iInter_of_isOpen_nat
theorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
(hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by
rcases S.eq_empty_or_nonempty with h | h
· simp [h]
· rcases hS.exists_eq_range h with ⟨f, rfl⟩
exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd)
#align dense_sInter_of_open dense_sInter_of_isOpen
theorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s))
(hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by
rw [← sInter_image]
refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image]
#align dense_bInter_of_open dense_biInter_of_isOpen
theorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i))
(hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) :=
dense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd)
#align dense_Inter_of_open dense_iInter_of_isOpen
theorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by
constructor
· rw [mem_residual_iff]
rintro ⟨S, hSo, hSd, Sct, Ss⟩
refine ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, ?_⟩
exact dense_sInter_of_isOpen hSo Sct hSd
rintro ⟨t, ts, ho, hd⟩
exact mem_of_superset (residual_of_dense_Gδ ho hd) ts
#align mem_residual mem_residual
theorem eventually_residual {p : X → Prop} :
(∀ᶠ x in residual X, p x) ↔ ∃ t : Set X, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x := by
simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]
tauto
#align eventually_residual eventually_residual
theorem dense_of_mem_residual {s : Set X} (hs : s ∈ residual X) : Dense s :=
let ⟨_, hts, _, hd⟩ := mem_residual.1 hs
hd.mono hts
#align dense_of_mem_residual dense_of_mem_residual
theorem dense_sInter_of_Gδ {S : Set (Set X)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
(hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
dense_of_mem_residual ((countable_sInter_mem hS).mpr
(fun _ hs => residual_of_dense_Gδ (ho _ hs) (hd _ hs)))
set_option linter.uppercaseLean3 false in
#align dense_sInter_of_Gδ dense_sInter_of_Gδ
theorem dense_iInter_of_Gδ [Countable ι] {f : ι → Set X} (ho : ∀ s, IsGδ (f s))
(hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) :=
dense_sInter_of_Gδ (forall_mem_range.2 ‹_›) (countable_range _) (forall_mem_range.2 ‹_›)
set_option linter.uppercaseLean3 false in
#align dense_Inter_of_Gδ dense_iInter_of_Gδ
theorem dense_biInter_of_Gδ {S : Set α} {f : ∀ x ∈ S, Set X} (ho : ∀ s (H : s ∈ S), IsGδ (f s H))
(hS : S.Countable) (hd : ∀ s (H : s ∈ S), Dense (f s H)) : Dense (⋂ s ∈ S, f s ‹_›) := by
rw [biInter_eq_iInter]
haveI := hS.to_subtype
exact dense_iInter_of_Gδ (fun s => ho s s.2) fun s => hd s s.2
set_option linter.uppercaseLean3 false in
#align dense_bInter_of_Gδ dense_biInter_of_Gδ
theorem Dense.inter_of_Gδ {s t : Set X} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
(htc : Dense t) : Dense (s ∩ t) := by
rw [inter_eq_iInter]
apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *]
set_option linter.uppercaseLean3 false in
#align dense.inter_of_Gδ Dense.inter_of_Gδ
| Mathlib/Topology/Baire/Lemmas.lean | 132 | 145 | theorem IsGδ.dense_iUnion_interior_of_closed [Countable ι] {s : Set X} (hs : IsGδ s) (hd : Dense s)
{f : ι → Set X} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) :
Dense (⋃ i, interior (f i)) := by |
let g i := (frontier (f i))ᶜ
have hgo : ∀ i, IsOpen (g i) := fun i => isClosed_frontier.isOpen_compl
have hgd : Dense (⋂ i, g i) := by
refine dense_iInter_of_isOpen hgo fun i x => ?_
rw [closure_compl, interior_frontier (hc _)]
exact id
refine (hd.inter_of_Gδ hs (.iInter_of_isOpen fun i => (hgo i)) hgd).mono ?_
rintro x ⟨hxs, hxg⟩
rw [mem_iInter] at hxg
rcases mem_iUnion.1 (hU hxs) with ⟨i, hi⟩
exact mem_iUnion.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
| 11 |
import Mathlib.NumberTheory.FLT.Basic
import Mathlib.NumberTheory.PythagoreanTriples
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
#align_import number_theory.fermat4 from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
noncomputable section
open scoped Classical
def Fermat42 (a b c : ℤ) : Prop :=
a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2
#align fermat_42 Fermat42
namespace Fermat42
theorem comm {a b c : ℤ} : Fermat42 a b c ↔ Fermat42 b a c := by
delta Fermat42
rw [add_comm]
tauto
#align fermat_42.comm Fermat42.comm
theorem mul {a b c k : ℤ} (hk0 : k ≠ 0) :
Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c) := by
delta Fermat42
constructor
· intro f42
constructor
· exact mul_ne_zero hk0 f42.1
constructor
· exact mul_ne_zero hk0 f42.2.1
· have H : a ^ 4 + b ^ 4 = c ^ 2 := f42.2.2
linear_combination k ^ 4 * H
· intro f42
constructor
· exact right_ne_zero_of_mul f42.1
constructor
· exact right_ne_zero_of_mul f42.2.1
apply (mul_right_inj' (pow_ne_zero 4 hk0)).mp
linear_combination f42.2.2
#align fermat_42.mul Fermat42.mul
theorem ne_zero {a b c : ℤ} (h : Fermat42 a b c) : c ≠ 0 := by
apply ne_zero_pow two_ne_zero _; apply ne_of_gt
rw [← h.2.2, (by ring : a ^ 4 + b ^ 4 = (a ^ 2) ^ 2 + (b ^ 2) ^ 2)]
exact
add_pos (sq_pos_of_ne_zero (pow_ne_zero 2 h.1)) (sq_pos_of_ne_zero (pow_ne_zero 2 h.2.1))
#align fermat_42.ne_zero Fermat42.ne_zero
def Minimal (a b c : ℤ) : Prop :=
Fermat42 a b c ∧ ∀ a1 b1 c1 : ℤ, Fermat42 a1 b1 c1 → Int.natAbs c ≤ Int.natAbs c1
#align fermat_42.minimal Fermat42.Minimal
theorem exists_minimal {a b c : ℤ} (h : Fermat42 a b c) : ∃ a0 b0 c0, Minimal a0 b0 c0 := by
let S : Set ℕ := { n | ∃ s : ℤ × ℤ × ℤ, Fermat42 s.1 s.2.1 s.2.2 ∧ n = Int.natAbs s.2.2 }
have S_nonempty : S.Nonempty := by
use Int.natAbs c
rw [Set.mem_setOf_eq]
use ⟨a, ⟨b, c⟩⟩
let m : ℕ := Nat.find S_nonempty
have m_mem : m ∈ S := Nat.find_spec S_nonempty
rcases m_mem with ⟨s0, hs0, hs1⟩
use s0.1, s0.2.1, s0.2.2, hs0
intro a1 b1 c1 h1
rw [← hs1]
apply Nat.find_min'
use ⟨a1, ⟨b1, c1⟩⟩
#align fermat_42.exists_minimal Fermat42.exists_minimal
theorem coprime_of_minimal {a b c : ℤ} (h : Minimal a b c) : IsCoprime a b := by
apply Int.gcd_eq_one_iff_coprime.mp
by_contra hab
obtain ⟨p, hp, hpa, hpb⟩ := Nat.Prime.not_coprime_iff_dvd.mp hab
obtain ⟨a1, rfl⟩ := Int.natCast_dvd.mpr hpa
obtain ⟨b1, rfl⟩ := Int.natCast_dvd.mpr hpb
have hpc : (p : ℤ) ^ 2 ∣ c := by
rw [← Int.pow_dvd_pow_iff two_ne_zero, ← h.1.2.2]
apply Dvd.intro (a1 ^ 4 + b1 ^ 4)
ring
obtain ⟨c1, rfl⟩ := hpc
have hf : Fermat42 a1 b1 c1 :=
(Fermat42.mul (Int.natCast_ne_zero.mpr (Nat.Prime.ne_zero hp))).mpr h.1
apply Nat.le_lt_asymm (h.2 _ _ _ hf)
rw [Int.natAbs_mul, lt_mul_iff_one_lt_left, Int.natAbs_pow, Int.natAbs_ofNat]
· exact Nat.one_lt_pow two_ne_zero (Nat.Prime.one_lt hp)
· exact Nat.pos_of_ne_zero (Int.natAbs_ne_zero.2 (ne_zero hf))
#align fermat_42.coprime_of_minimal Fermat42.coprime_of_minimal
theorem minimal_comm {a b c : ℤ} : Minimal a b c → Minimal b a c := fun ⟨h1, h2⟩ =>
⟨Fermat42.comm.mp h1, h2⟩
#align fermat_42.minimal_comm Fermat42.minimal_comm
theorem neg_of_minimal {a b c : ℤ} : Minimal a b c → Minimal a b (-c) := by
rintro ⟨⟨ha, hb, heq⟩, h2⟩
constructor
· apply And.intro ha (And.intro hb _)
rw [heq]
exact (neg_sq c).symm
rwa [Int.natAbs_neg c]
#align fermat_42.neg_of_minimal Fermat42.neg_of_minimal
| Mathlib/NumberTheory/FLT/Four.lean | 124 | 136 | theorem exists_odd_minimal {a b c : ℤ} (h : Fermat42 a b c) :
∃ a0 b0 c0, Minimal a0 b0 c0 ∧ a0 % 2 = 1 := by |
obtain ⟨a0, b0, c0, hf⟩ := exists_minimal h
cases' Int.emod_two_eq_zero_or_one a0 with hap hap
· cases' Int.emod_two_eq_zero_or_one b0 with hbp hbp
· exfalso
have h1 : 2 ∣ (Int.gcd a0 b0 : ℤ) :=
Int.dvd_gcd (Int.dvd_of_emod_eq_zero hap) (Int.dvd_of_emod_eq_zero hbp)
rw [Int.gcd_eq_one_iff_coprime.mpr (coprime_of_minimal hf)] at h1
revert h1
decide
· exact ⟨b0, ⟨a0, ⟨c0, minimal_comm hf, hbp⟩⟩⟩
exact ⟨a0, ⟨b0, ⟨c0, hf, hap⟩⟩⟩
| 11 |
import Mathlib.Algebra.Lie.Nilpotent
import Mathlib.Algebra.Lie.Normalizer
#align_import algebra.lie.engel from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
universe u₁ u₂ u₃ u₄
variable {R : Type u₁} {L : Type u₂} {L₂ : Type u₃} {M : Type u₄}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L₂] [LieAlgebra R L₂]
variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]
namespace LieSubmodule
open LieModule
variable {I : LieIdeal R L} {x : L} (hxI : (R ∙ x) ⊔ I = ⊤)
theorem exists_smul_add_of_span_sup_eq_top (y : L) : ∃ t : R, ∃ z ∈ I, y = t • x + z := by
have hy : y ∈ (⊤ : Submodule R L) := Submodule.mem_top
simp only [← hxI, Submodule.mem_sup, Submodule.mem_span_singleton] at hy
obtain ⟨-, ⟨t, rfl⟩, z, hz, rfl⟩ := hy
exact ⟨t, z, hz, rfl⟩
#align lie_submodule.exists_smul_add_of_span_sup_eq_top LieSubmodule.exists_smul_add_of_span_sup_eq_top
theorem lie_top_eq_of_span_sup_eq_top (N : LieSubmodule R L M) :
(↑⁅(⊤ : LieIdeal R L), N⁆ : Submodule R M) =
(N : Submodule R M).map (toEnd R L M x) ⊔ (↑⁅I, N⁆ : Submodule R M) := by
simp only [lieIdeal_oper_eq_linear_span', Submodule.sup_span, mem_top, exists_prop,
true_and, Submodule.map_coe, toEnd_apply_apply]
refine le_antisymm (Submodule.span_le.mpr ?_) (Submodule.span_mono fun z hz => ?_)
· rintro z ⟨y, n, hn : n ∈ N, rfl⟩
obtain ⟨t, z, hz, rfl⟩ := exists_smul_add_of_span_sup_eq_top hxI y
simp only [SetLike.mem_coe, Submodule.span_union, Submodule.mem_sup]
exact
⟨t • ⁅x, n⁆, Submodule.subset_span ⟨t • n, N.smul_mem' t hn, lie_smul t x n⟩, ⁅z, n⁆,
Submodule.subset_span ⟨z, hz, n, hn, rfl⟩, by simp⟩
· rcases hz with (⟨m, hm, rfl⟩ | ⟨y, -, m, hm, rfl⟩)
exacts [⟨x, m, hm, rfl⟩, ⟨y, m, hm, rfl⟩]
#align lie_submodule.lie_top_eq_of_span_sup_eq_top LieSubmodule.lie_top_eq_of_span_sup_eq_top
theorem lcs_le_lcs_of_is_nilpotent_span_sup_eq_top {n i j : ℕ}
(hxn : toEnd R L M x ^ n = 0) (hIM : lowerCentralSeries R L M i ≤ I.lcs M j) :
lowerCentralSeries R L M (i + n) ≤ I.lcs M (j + 1) := by
suffices
∀ l,
((⊤ : LieIdeal R L).lcs M (i + l) : Submodule R M) ≤
(I.lcs M j : Submodule R M).map (toEnd R L M x ^ l) ⊔
(I.lcs M (j + 1) : Submodule R M)
by simpa only [bot_sup_eq, LieIdeal.incl_coe, Submodule.map_zero, hxn] using this n
intro l
induction' l with l ih
· simp only [Nat.zero_eq, add_zero, LieIdeal.lcs_succ, pow_zero, LinearMap.one_eq_id,
Submodule.map_id]
exact le_sup_of_le_left hIM
· simp only [LieIdeal.lcs_succ, i.add_succ l, lie_top_eq_of_span_sup_eq_top hxI, sup_le_iff]
refine ⟨(Submodule.map_mono ih).trans ?_, le_sup_of_le_right ?_⟩
· rw [Submodule.map_sup, ← Submodule.map_comp, ← LinearMap.mul_eq_comp, ← pow_succ', ←
I.lcs_succ]
exact sup_le_sup_left coe_map_toEnd_le _
· refine le_trans (mono_lie_right _ _ I ?_) (mono_lie_right _ _ I hIM)
exact antitone_lowerCentralSeries R L M le_self_add
#align lie_submodule.lcs_le_lcs_of_is_nilpotent_span_sup_eq_top LieSubmodule.lcs_le_lcs_of_is_nilpotent_span_sup_eq_top
| Mathlib/Algebra/Lie/Engel.lean | 128 | 140 | theorem isNilpotentOfIsNilpotentSpanSupEqTop (hnp : IsNilpotent <| toEnd R L M x)
(hIM : IsNilpotent R I M) : IsNilpotent R L M := by |
obtain ⟨n, hn⟩ := hnp
obtain ⟨k, hk⟩ := hIM
have hk' : I.lcs M k = ⊥ := by
simp only [← coe_toSubmodule_eq_iff, I.coe_lcs_eq, hk, bot_coeSubmodule]
suffices ∀ l, lowerCentralSeries R L M (l * n) ≤ I.lcs M l by
use k * n
simpa [hk'] using this k
intro l
induction' l with l ih
· simp
· exact (l.succ_mul n).symm ▸ lcs_le_lcs_of_is_nilpotent_span_sup_eq_top hxI hn ih
| 11 |
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]
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
#align simplicial_object.splitting.decomposition_id SimplicialObject.Splitting.decomposition_id
@[reassoc (attr := simp)]
| Mathlib/AlgebraicTopology/DoldKan/SplitSimplicialObject.lean | 73 | 85 | theorem σ_comp_πSummand_id_eq_zero {n : ℕ} (i : Fin (n + 1)) :
X.σ i ≫ s.πSummand (IndexSet.id (op [n + 1])) = 0 := by |
apply s.hom_ext'
intro A
dsimp only [SimplicialObject.σ]
rw [comp_zero, s.cofan_inj_epi_naturality_assoc A (SimplexCategory.σ i).op,
cofan_inj_πSummand_eq_zero]
rw [ne_comm]
change ¬(A.epiComp (SimplexCategory.σ i).op).EqId
rw [IndexSet.eqId_iff_len_eq]
have h := SimplexCategory.len_le_of_epi (inferInstance : Epi A.e)
dsimp at h ⊢
omega
| 11 |
import Mathlib.Algebra.Polynomial.Monic
#align_import algebra.polynomial.big_operators from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
open Finset
open Multiset
open Polynomial
universe u w
variable {R : Type u} {ι : Type w}
namespace Polynomial
variable (s : Finset ι)
section Semiring
variable {S : Type*} [Semiring S]
set_option backward.isDefEq.lazyProjDelta false in -- See https://github.com/leanprover-community/mathlib4/issues/12535
theorem natDegree_list_sum_le (l : List S[X]) : natDegree l.sum ≤ (l.map natDegree).foldr max 0 :=
List.sum_le_foldr_max natDegree (by simp) natDegree_add_le _
#align polynomial.nat_degree_list_sum_le Polynomial.natDegree_list_sum_le
theorem natDegree_multiset_sum_le (l : Multiset S[X]) :
natDegree l.sum ≤ (l.map natDegree).foldr max max_left_comm 0 :=
Quotient.inductionOn l (by simpa using natDegree_list_sum_le)
#align polynomial.nat_degree_multiset_sum_le Polynomial.natDegree_multiset_sum_le
theorem natDegree_sum_le (f : ι → S[X]) :
natDegree (∑ i ∈ s, f i) ≤ s.fold max 0 (natDegree ∘ f) := by
simpa using natDegree_multiset_sum_le (s.val.map f)
#align polynomial.nat_degree_sum_le Polynomial.natDegree_sum_le
lemma natDegree_sum_le_of_forall_le {n : ℕ} (f : ι → S[X]) (h : ∀ i ∈ s, natDegree (f i) ≤ n) :
natDegree (∑ i ∈ s, f i) ≤ n :=
le_trans (natDegree_sum_le s f) <| (Finset.fold_max_le n).mpr <| by simpa
| Mathlib/Algebra/Polynomial/BigOperators.lean | 66 | 77 | theorem degree_list_sum_le (l : List S[X]) : degree l.sum ≤ (l.map natDegree).maximum := by |
by_cases h : l.sum = 0
· simp [h]
· rw [degree_eq_natDegree h]
suffices (l.map natDegree).maximum = ((l.map natDegree).foldr max 0 : ℕ) by
rw [this]
simpa using natDegree_list_sum_le l
rw [← List.foldr_max_of_ne_nil]
· congr
contrapose! h
rw [List.map_eq_nil] at h
simp [h]
| 11 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.Prod
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.FinCases
import Mathlib.Tactic.LinearCombination
import Mathlib.Lean.Expr.ExtraRecognizers
import Mathlib.Data.Set.Subsingleton
#align_import linear_algebra.linear_independent from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
noncomputable section
open Function Set Submodule
open Cardinal
universe u' u
variable {ι : Type u'} {ι' : Type*} {R : Type*} {K : Type*}
variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*}
section Module
variable {v : ι → M}
variable [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M'']
variable [Module R M] [Module R M'] [Module R M'']
variable {a b : R} {x y : M}
variable (R) (v)
def LinearIndependent : Prop :=
LinearMap.ker (Finsupp.total ι M R v) = ⊥
#align linear_independent LinearIndependent
open Lean PrettyPrinter.Delaborator SubExpr in
@[delab app.LinearIndependent]
def delabLinearIndependent : Delab :=
whenPPOption getPPNotation <|
whenNotPPOption getPPAnalysisSkip <|
withOptionAtCurrPos `pp.analysis.skip true do
let e ← getExpr
guard <| e.isAppOfArity ``LinearIndependent 7
let some _ := (e.getArg! 0).coeTypeSet? | failure
let optionsPerPos ← if (e.getArg! 3).isLambda then
withNaryArg 3 do return (← read).optionsPerPos.setBool (← getPos) pp.funBinderTypes.name true
else
withNaryArg 0 do return (← read).optionsPerPos.setBool (← getPos) `pp.analysis.namedArg true
withTheReader Context ({· with optionsPerPos}) delab
variable {R} {v}
theorem linearIndependent_iff :
LinearIndependent R v ↔ ∀ l, Finsupp.total ι M R v l = 0 → l = 0 := by
simp [LinearIndependent, LinearMap.ker_eq_bot']
#align linear_independent_iff linearIndependent_iff
| Mathlib/LinearAlgebra/LinearIndependent.lean | 131 | 151 | theorem linearIndependent_iff' :
LinearIndependent R v ↔
∀ s : Finset ι, ∀ g : ι → R, ∑ i ∈ s, g i • v i = 0 → ∀ i ∈ s, g i = 0 :=
linearIndependent_iff.trans
⟨fun hf s g hg i his =>
have h :=
hf (∑ i ∈ s, Finsupp.single i (g i)) <| by
simpa only [map_sum, Finsupp.total_single] using hg
calc
g i = (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single i (g i)) := by |
{ rw [Finsupp.lapply_apply, Finsupp.single_eq_same] }
_ = ∑ j ∈ s, (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single j (g j)) :=
Eq.symm <|
Finset.sum_eq_single i
(fun j _hjs hji => by rw [Finsupp.lapply_apply, Finsupp.single_eq_of_ne hji])
fun hnis => hnis.elim his
_ = (∑ j ∈ s, Finsupp.single j (g j)) i := (map_sum ..).symm
_ = 0 := DFunLike.ext_iff.1 h i,
fun hf l hl =>
Finsupp.ext fun i =>
_root_.by_contradiction fun hni => hni <| hf _ _ hl _ <| Finsupp.mem_support_iff.2 hni⟩
| 11 |
import Mathlib.Algebra.Module.BigOperators
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Tactic.FinCases
#align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open Affine
namespace Finset
theorem univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := by
ext x
fin_cases x <;> simp
#align finset.univ_fin2 Finset.univ_fin2
variable {k : Type*} {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V]
variable [S : AffineSpace V P]
variable {ι : Type*} (s : Finset ι)
variable {ι₂ : Type*} (s₂ : Finset ι₂)
def weightedVSubOfPoint (p : ι → P) (b : P) : (ι → k) →ₗ[k] V :=
∑ i ∈ s, (LinearMap.proj i : (ι → k) →ₗ[k] k).smulRight (p i -ᵥ b)
#align finset.weighted_vsub_of_point Finset.weightedVSubOfPoint
@[simp]
theorem weightedVSubOfPoint_apply (w : ι → k) (p : ι → P) (b : P) :
s.weightedVSubOfPoint p b w = ∑ i ∈ s, w i • (p i -ᵥ b) := by
simp [weightedVSubOfPoint, LinearMap.sum_apply]
#align finset.weighted_vsub_of_point_apply Finset.weightedVSubOfPoint_apply
@[simp (high)]
theorem weightedVSubOfPoint_apply_const (w : ι → k) (p : P) (b : P) :
s.weightedVSubOfPoint (fun _ => p) b w = (∑ i ∈ s, w i) • (p -ᵥ b) := by
rw [weightedVSubOfPoint_apply, sum_smul]
#align finset.weighted_vsub_of_point_apply_const Finset.weightedVSubOfPoint_apply_const
theorem weightedVSubOfPoint_congr {w₁ w₂ : ι → k} (hw : ∀ i ∈ s, w₁ i = w₂ i) {p₁ p₂ : ι → P}
(hp : ∀ i ∈ s, p₁ i = p₂ i) (b : P) :
s.weightedVSubOfPoint p₁ b w₁ = s.weightedVSubOfPoint p₂ b w₂ := by
simp_rw [weightedVSubOfPoint_apply]
refine sum_congr rfl fun i hi => ?_
rw [hw i hi, hp i hi]
#align finset.weighted_vsub_of_point_congr Finset.weightedVSubOfPoint_congr
theorem weightedVSubOfPoint_eq_of_weights_eq (p : ι → P) (j : ι) (w₁ w₂ : ι → k)
(hw : ∀ i, i ≠ j → w₁ i = w₂ i) :
s.weightedVSubOfPoint p (p j) w₁ = s.weightedVSubOfPoint p (p j) w₂ := by
simp only [Finset.weightedVSubOfPoint_apply]
congr
ext i
rcases eq_or_ne i j with h | h
· simp [h]
· simp [hw i h]
#align finset.weighted_vsub_of_point_eq_of_weights_eq Finset.weightedVSubOfPoint_eq_of_weights_eq
theorem weightedVSubOfPoint_eq_of_sum_eq_zero (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 0)
(b₁ b₂ : P) : s.weightedVSubOfPoint p b₁ w = s.weightedVSubOfPoint p b₂ w := by
apply eq_of_sub_eq_zero
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← sum_sub_distrib]
conv_lhs =>
congr
· skip
· ext
rw [← smul_sub, vsub_sub_vsub_cancel_left]
rw [← sum_smul, h, zero_smul]
#align finset.weighted_vsub_of_point_eq_of_sum_eq_zero Finset.weightedVSubOfPoint_eq_of_sum_eq_zero
| Mathlib/LinearAlgebra/AffineSpace/Combination.lean | 123 | 135 | theorem weightedVSubOfPoint_vadd_eq_of_sum_eq_one (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 1)
(b₁ b₂ : P) : s.weightedVSubOfPoint p b₁ w +ᵥ b₁ = s.weightedVSubOfPoint p b₂ w +ᵥ b₂ := by |
erw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← @vsub_eq_zero_iff_eq V,
vadd_vsub_assoc, vsub_vadd_eq_vsub_sub, ← add_sub_assoc, add_comm, add_sub_assoc, ←
sum_sub_distrib]
conv_lhs =>
congr
· skip
· congr
· skip
· ext
rw [← smul_sub, vsub_sub_vsub_cancel_left]
rw [← sum_smul, h, one_smul, vsub_add_vsub_cancel, vsub_self]
| 11 |
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.Sym.Sym2
namespace List
variable {α : Type*}
section Sym2
protected def sym2 : List α → List (Sym2 α)
| [] => []
| x :: xs => (x :: xs).map (fun y => s(x, y)) ++ xs.sym2
theorem mem_sym2_cons_iff {x : α} {xs : List α} {z : Sym2 α} :
z ∈ (x :: xs).sym2 ↔ z = s(x, x) ∨ (∃ y, y ∈ xs ∧ z = s(x, y)) ∨ z ∈ xs.sym2 := by
simp only [List.sym2, map_cons, cons_append, mem_cons, mem_append, mem_map]
simp only [eq_comm]
@[simp]
theorem sym2_eq_nil_iff {xs : List α} : xs.sym2 = [] ↔ xs = [] := by
cases xs <;> simp [List.sym2]
| Mathlib/Data/List/Sym.lean | 49 | 61 | theorem left_mem_of_mk_mem_sym2 {xs : List α} {a b : α}
(h : s(a, b) ∈ xs.sym2) : a ∈ xs := by |
induction xs with
| nil => exact (not_mem_nil _ h).elim
| cons x xs ih =>
rw [mem_cons]
rw [mem_sym2_cons_iff] at h
obtain (h | ⟨c, hc, h⟩ | h) := h
· rw [Sym2.eq_iff, ← and_or_left] at h
exact .inl h.1
· rw [Sym2.eq_iff] at h
obtain (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) := h <;> simp [hc]
· exact .inr <| ih h
| 11 |
import Mathlib.FieldTheory.Minpoly.Field
#align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f"
open Polynomial
open Polynomial
variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S]
variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B]
variable {K : Type*} [Field K]
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where
gen : S
dim : ℕ
basis : Basis (Fin dim) R S
basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ)
#align power_basis PowerBasis
-- this is usually not needed because of `basis_eq_pow` but can be needed in some cases;
-- in such circumstances, add it manually using `@[simps dim gen basis]`.
initialize_simps_projections PowerBasis (-basis)
namespace PowerBasis
@[simp]
theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) :=
funext pb.basis_eq_pow
#align power_basis.coe_basis PowerBasis.coe_basis
theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis
#align power_basis.finite_dimensional PowerBasis.finite
@[deprecated] alias finiteDimensional := PowerBasis.finite
theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) :
FiniteDimensional.finrank R S = pb.dim := by
rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin]
#align power_basis.finrank PowerBasis.finrank
| Mathlib/RingTheory/PowerBasis.lean | 89 | 102 | theorem mem_span_pow' {x y : S} {d : ℕ} :
y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔
∃ f : R[X], f.degree < d ∧ y = aeval x f := by |
have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by
ext n
simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range]
exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩
simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support,
exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum,
Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop,
LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight,
Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe]
simp_rw [@eq_comm _ y]
exact Iff.rfl
| 11 |
import Mathlib.Analysis.InnerProductSpace.Projection
import Mathlib.Geometry.Euclidean.PerpBisector
import Mathlib.Algebra.QuadraticDiscriminant
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open scoped Classical
open RealInnerProductSpace
namespace EuclideanGeometry
variable {V : Type*} {P : Type*}
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
theorem dist_left_midpoint_eq_dist_right_midpoint (p1 p2 : P) :
dist p1 (midpoint ℝ p1 p2) = dist p2 (midpoint ℝ p1 p2) := by
rw [dist_left_midpoint (𝕜 := ℝ) p1 p2, dist_right_midpoint (𝕜 := ℝ) p1 p2]
#align euclidean_geometry.dist_left_midpoint_eq_dist_right_midpoint EuclideanGeometry.dist_left_midpoint_eq_dist_right_midpoint
theorem inner_weightedVSub {ι₁ : Type*} {s₁ : Finset ι₁} {w₁ : ι₁ → ℝ} (p₁ : ι₁ → P)
(h₁ : ∑ i ∈ s₁, w₁ i = 0) {ι₂ : Type*} {s₂ : Finset ι₂} {w₂ : ι₂ → ℝ} (p₂ : ι₂ → P)
(h₂ : ∑ i ∈ s₂, w₂ i = 0) :
⟪s₁.weightedVSub p₁ w₁, s₂.weightedVSub p₂ w₂⟫ =
(-∑ i₁ ∈ s₁, ∑ i₂ ∈ s₂, w₁ i₁ * w₂ i₂ * (dist (p₁ i₁) (p₂ i₂) * dist (p₁ i₁) (p₂ i₂))) /
2 := by
rw [Finset.weightedVSub_apply, Finset.weightedVSub_apply,
inner_sum_smul_sum_smul_of_sum_eq_zero _ h₁ _ h₂]
simp_rw [vsub_sub_vsub_cancel_right]
rcongr (i₁ i₂) <;> rw [dist_eq_norm_vsub V (p₁ i₁) (p₂ i₂)]
#align euclidean_geometry.inner_weighted_vsub EuclideanGeometry.inner_weightedVSub
theorem dist_affineCombination {ι : Type*} {s : Finset ι} {w₁ w₂ : ι → ℝ} (p : ι → P)
(h₁ : ∑ i ∈ s, w₁ i = 1) (h₂ : ∑ i ∈ s, w₂ i = 1) : by
have a₁ := s.affineCombination ℝ p w₁
have a₂ := s.affineCombination ℝ p w₂
exact dist a₁ a₂ * dist a₁ a₂ = (-∑ i₁ ∈ s, ∑ i₂ ∈ s,
(w₁ - w₂) i₁ * (w₁ - w₂) i₂ * (dist (p i₁) (p i₂) * dist (p i₁) (p i₂))) / 2 := by
dsimp only
rw [dist_eq_norm_vsub V (s.affineCombination ℝ p w₁) (s.affineCombination ℝ p w₂), ←
@inner_self_eq_norm_mul_norm ℝ, Finset.affineCombination_vsub]
have h : (∑ i ∈ s, (w₁ - w₂) i) = 0 := by
simp_rw [Pi.sub_apply, Finset.sum_sub_distrib, h₁, h₂, sub_self]
exact inner_weightedVSub p h p h
#align euclidean_geometry.dist_affine_combination EuclideanGeometry.dist_affineCombination
-- Porting note: `inner_vsub_vsub_of_dist_eq_of_dist_eq` moved to `PerpendicularBisector`
theorem dist_smul_vadd_sq (r : ℝ) (v : V) (p₁ p₂ : P) :
dist (r • v +ᵥ p₁) p₂ * dist (r • v +ᵥ p₁) p₂ =
⟪v, v⟫ * r * r + 2 * ⟪v, p₁ -ᵥ p₂⟫ * r + ⟪p₁ -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [dist_eq_norm_vsub V _ p₂, ← real_inner_self_eq_norm_mul_norm, vadd_vsub_assoc,
real_inner_add_add_self, real_inner_smul_left, real_inner_smul_left, real_inner_smul_right]
ring
#align euclidean_geometry.dist_smul_vadd_sq EuclideanGeometry.dist_smul_vadd_sq
| Mathlib/Geometry/Euclidean/Basic.lean | 122 | 134 | theorem dist_smul_vadd_eq_dist {v : V} (p₁ p₂ : P) (hv : v ≠ 0) (r : ℝ) :
dist (r • v +ᵥ p₁) p₂ = dist p₁ p₂ ↔ r = 0 ∨ r = -2 * ⟪v, p₁ -ᵥ p₂⟫ / ⟪v, v⟫ := by |
conv_lhs =>
rw [← mul_self_inj_of_nonneg dist_nonneg dist_nonneg, dist_smul_vadd_sq, ← sub_eq_zero,
add_sub_assoc, dist_eq_norm_vsub V p₁ p₂, ← real_inner_self_eq_norm_mul_norm, sub_self]
have hvi : ⟪v, v⟫ ≠ 0 := by simpa using hv
have hd : discrim ⟪v, v⟫ (2 * ⟪v, p₁ -ᵥ p₂⟫) 0 = 2 * ⟪v, p₁ -ᵥ p₂⟫ * (2 * ⟪v, p₁ -ᵥ p₂⟫) := by
rw [discrim]
ring
rw [quadratic_eq_zero_iff hvi hd, add_left_neg, zero_div, neg_mul_eq_neg_mul, ←
mul_sub_right_distrib, sub_eq_add_neg, ← mul_two, mul_assoc, mul_div_assoc, mul_div_mul_left,
mul_div_assoc]
norm_num
| 11 |
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.LinearAlgebra.Dual
#align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Topology Filter
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E}
{f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ}
theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by
intro htop
set fφ := fun x => (f x, φ x)
have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by
change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀)
rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop]
exact map_snd_nhdsWithin _
exact hextr.not_nhds_le_map A.ge
#align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) :
∃ (Λ : Module.Dual ℝ F) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ ∀ x, Λ (f' x) + Λ₀ • φ' x = 0 := by
rcases Submodule.exists_le_ker_of_lt_top _
(lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hφ') with
⟨Λ', h0, hΛ'⟩
set e : ((F →ₗ[ℝ] ℝ) × ℝ) ≃ₗ[ℝ] F × ℝ →ₗ[ℝ] ℝ :=
((LinearEquiv.refl ℝ (F →ₗ[ℝ] ℝ)).prod (LinearMap.ringLmapEquivSelf ℝ ℝ ℝ).symm).trans
(LinearMap.coprodEquiv ℝ)
rcases e.surjective Λ' with ⟨⟨Λ, Λ₀⟩, rfl⟩
refine ⟨Λ, Λ₀, e.map_ne_zero_iff.1 h0, fun x => ?_⟩
convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΛ') x using 1
-- squeezed `simp [mul_comm]` to speed up elaboration
simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply,
LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply,
ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply,
LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight,
LinearMap.one_apply, mul_comm]
#align is_local_extr_on.exists_linear_map_of_has_strict_fderiv_at IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
| Mathlib/Analysis/Calculus/LagrangeMultipliers.lean | 84 | 97 | theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d {f : E → ℝ} {f' : E →L[ℝ] ℝ}
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • f' + b • φ' = 0 := by |
obtain ⟨Λ, Λ₀, hΛ, hfΛ⟩ := hextr.exists_linear_map_of_hasStrictFDerivAt hf' hφ'
refine ⟨Λ 1, Λ₀, ?_, ?_⟩
· contrapose! hΛ
simp only [Prod.mk_eq_zero] at hΛ ⊢
refine ⟨LinearMap.ext fun x => ?_, hΛ.2⟩
simpa [hΛ.1] using Λ.map_smul x 1
· ext x
have H₁ : Λ (f' x) = f' x * Λ 1 := by
simpa only [mul_one, Algebra.id.smul_eq_mul] using Λ.map_smul (f' x) 1
have H₂ : f' x * Λ 1 + Λ₀ * φ' x = 0 := by simpa only [Algebra.id.smul_eq_mul, H₁] using hfΛ x
simpa [mul_comm] using H₂
| 11 |
import Mathlib.RingTheory.Localization.Basic
#align_import ring_theory.localization.integer from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
variable {R : Type*} [CommSemiring R] {M : Submonoid R} {S : Type*} [CommSemiring S]
variable [Algebra R S] {P : Type*} [CommSemiring P]
open Function
namespace IsLocalization
section
variable (R)
-- TODO: define a subalgebra of `IsInteger`s
def IsInteger (a : S) : Prop :=
a ∈ (algebraMap R S).rangeS
#align is_localization.is_integer IsLocalization.IsInteger
end
theorem isInteger_zero : IsInteger R (0 : S) :=
Subsemiring.zero_mem _
#align is_localization.is_integer_zero IsLocalization.isInteger_zero
theorem isInteger_one : IsInteger R (1 : S) :=
Subsemiring.one_mem _
#align is_localization.is_integer_one IsLocalization.isInteger_one
theorem isInteger_add {a b : S} (ha : IsInteger R a) (hb : IsInteger R b) : IsInteger R (a + b) :=
Subsemiring.add_mem _ ha hb
#align is_localization.is_integer_add IsLocalization.isInteger_add
theorem isInteger_mul {a b : S} (ha : IsInteger R a) (hb : IsInteger R b) : IsInteger R (a * b) :=
Subsemiring.mul_mem _ ha hb
#align is_localization.is_integer_mul IsLocalization.isInteger_mul
theorem isInteger_smul {a : R} {b : S} (hb : IsInteger R b) : IsInteger R (a • b) := by
rcases hb with ⟨b', hb⟩
use a * b'
rw [← hb, (algebraMap R S).map_mul, Algebra.smul_def]
#align is_localization.is_integer_smul IsLocalization.isInteger_smul
variable (M)
variable [IsLocalization M S]
theorem exists_integer_multiple' (a : S) : ∃ b : M, IsInteger R (a * algebraMap R S b) :=
let ⟨⟨Num, denom⟩, h⟩ := IsLocalization.surj _ a
⟨denom, Set.mem_range.mpr ⟨Num, h.symm⟩⟩
#align is_localization.exists_integer_multiple' IsLocalization.exists_integer_multiple'
theorem exists_integer_multiple (a : S) : ∃ b : M, IsInteger R ((b : R) • a) := by
simp_rw [Algebra.smul_def, mul_comm _ a]
apply exists_integer_multiple'
#align is_localization.exists_integer_multiple IsLocalization.exists_integer_multiple
| Mathlib/RingTheory/Localization/Integer.lean | 91 | 103 | theorem exist_integer_multiples {ι : Type*} (s : Finset ι) (f : ι → S) :
∃ b : M, ∀ i ∈ s, IsLocalization.IsInteger R ((b : R) • f i) := by |
haveI := Classical.propDecidable
refine ⟨∏ i ∈ s, (sec M (f i)).2, fun i hi => ⟨?_, ?_⟩⟩
· exact (∏ j ∈ s.erase i, (sec M (f j)).2) * (sec M (f i)).1
rw [RingHom.map_mul, sec_spec', ← mul_assoc, ← (algebraMap R S).map_mul, ← Algebra.smul_def]
congr 2
refine _root_.trans ?_ (map_prod (Submonoid.subtype M) _ _).symm
rw [mul_comm,Submonoid.coe_finset_prod,
-- Porting note: explicitly supplied `f`
← Finset.prod_insert (f := fun i => ((sec M (f i)).snd : R)) (s.not_mem_erase i),
Finset.insert_erase hi]
rfl
| 11 |
import Mathlib.Data.PFunctor.Multivariate.Basic
#align_import data.qpf.multivariate.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u
open MvFunctor
class MvQPF {n : ℕ} (F : TypeVec.{u} n → Type*) [MvFunctor F] where
P : MvPFunctor.{u} n
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α ⟹ β) (p : P α), abs (f <$$> p) = f <$$> abs p
#align mvqpf MvQPF
namespace MvQPF
variable {n : ℕ} {F : TypeVec.{u} n → Type*} [MvFunctor F] [q : MvQPF F]
open MvFunctor (LiftP LiftR)
protected theorem id_map {α : TypeVec n} (x : F α) : TypeVec.id <$$> x = x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map]
rfl
#align mvqpf.id_map MvQPF.id_map
@[simp]
theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) (x : F α) :
(g ⊚ f) <$$> x = g <$$> f <$$> x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map, ← abs_map, ← abs_map]
rfl
#align mvqpf.comp_map MvQPF.comp_map
instance (priority := 100) lawfulMvFunctor : LawfulMvFunctor F where
id_map := @MvQPF.id_map n F _ _
comp_map := @comp_map n F _ _
#align mvqpf.is_lawful_mvfunctor MvQPF.lawfulMvFunctor
-- Lifting predicates and relations
| Mathlib/Data/QPF/Multivariate/Basic.lean | 126 | 138 | theorem liftP_iff {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (x : F α) :
LiftP p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i j, p (f i j) := by |
constructor
· rintro ⟨y, hy⟩
cases' h : repr y with a f
use a, fun i j => (f i j).val
constructor
· rw [← hy, ← abs_repr y, h, ← abs_map]; rfl
intro i j
apply (f i j).property
rintro ⟨a, f, h₀, h₁⟩
use abs ⟨a, fun i j => ⟨f i j, h₁ i j⟩⟩
rw [← abs_map, h₀]; rfl
| 11 |
import Mathlib.Algebra.DirectSum.Module
import Mathlib.Algebra.Module.BigOperators
import Mathlib.LinearAlgebra.Isomorphisms
import Mathlib.GroupTheory.Torsion
import Mathlib.RingTheory.Coprime.Ideal
import Mathlib.RingTheory.Finiteness
import Mathlib.Data.Set.Lattice
#align_import algebra.module.torsion from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8"
namespace Ideal
section TorsionOf
variable (R M : Type*) [Semiring R] [AddCommMonoid M] [Module R M]
@[simps!]
def torsionOf (x : M) : Ideal R :=
-- Porting note (#11036): broken dot notation on LinearMap.ker Lean4#1910
LinearMap.ker (LinearMap.toSpanSingleton R M x)
#align ideal.torsion_of Ideal.torsionOf
@[simp]
theorem torsionOf_zero : torsionOf R M (0 : M) = ⊤ := by simp [torsionOf]
#align ideal.torsion_of_zero Ideal.torsionOf_zero
variable {R M}
@[simp]
theorem mem_torsionOf_iff (x : M) (a : R) : a ∈ torsionOf R M x ↔ a • x = 0 :=
Iff.rfl
#align ideal.mem_torsion_of_iff Ideal.mem_torsionOf_iff
variable (R)
@[simp]
theorem torsionOf_eq_top_iff (m : M) : torsionOf R M m = ⊤ ↔ m = 0 := by
refine ⟨fun h => ?_, fun h => by simp [h]⟩
rw [← one_smul R m, ← mem_torsionOf_iff m (1 : R), h]
exact Submodule.mem_top
#align ideal.torsion_of_eq_top_iff Ideal.torsionOf_eq_top_iff
@[simp]
theorem torsionOf_eq_bot_iff_of_noZeroSMulDivisors [Nontrivial R] [NoZeroSMulDivisors R M] (m : M) :
torsionOf R M m = ⊥ ↔ m ≠ 0 := by
refine ⟨fun h contra => ?_, fun h => (Submodule.eq_bot_iff _).mpr fun r hr => ?_⟩
· rw [contra, torsionOf_zero] at h
exact bot_ne_top.symm h
· rw [mem_torsionOf_iff, smul_eq_zero] at hr
tauto
#align ideal.torsion_of_eq_bot_iff_of_no_zero_smul_divisors Ideal.torsionOf_eq_bot_iff_of_noZeroSMulDivisors
| Mathlib/Algebra/Module/Torsion.lean | 110 | 123 | theorem CompleteLattice.Independent.linear_independent' {ι R M : Type*} {v : ι → M} [Ring R]
[AddCommGroup M] [Module R M] (hv : CompleteLattice.Independent fun i => R ∙ v i)
(h_ne_zero : ∀ i, Ideal.torsionOf R M (v i) = ⊥) : LinearIndependent R v := by |
refine linearIndependent_iff_not_smul_mem_span.mpr fun i r hi => ?_
replace hv := CompleteLattice.independent_def.mp hv i
simp only [iSup_subtype', ← Submodule.span_range_eq_iSup (ι := Subtype _), disjoint_iff] at hv
have : r • v i ∈ (⊥ : Submodule R M) := by
rw [← hv, Submodule.mem_inf]
refine ⟨Submodule.mem_span_singleton.mpr ⟨r, rfl⟩, ?_⟩
convert hi
ext
simp
rw [← Submodule.mem_bot R, ← h_ne_zero i]
simpa using this
| 11 |
import Mathlib.Analysis.NormedSpace.OperatorNorm.Bilinear
import Mathlib.Analysis.NormedSpace.OperatorNorm.NNNorm
import Mathlib.Analysis.NormedSpace.Span
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 Normed
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
[NormedAddCommGroup Fₗ]
open Metric ContinuousLinearMap
section
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ] (c : 𝕜)
{σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} (f g : E →SL[σ₁₂] F) (x y z : E)
namespace LinearMap
theorem bound_of_shell [RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F) {ε C : ℝ} (ε_pos : 0 < ε) {c : 𝕜}
(hc : 1 < ‖c‖) (hf : ∀ x, ε / ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) (x : E) :
‖f x‖ ≤ C * ‖x‖ := by
by_cases hx : x = 0; · simp [hx]
exact SemilinearMapClass.bound_of_shell_semi_normed f ε_pos hc hf (norm_ne_zero_iff.2 hx)
#align linear_map.bound_of_shell LinearMap.bound_of_shell
| Mathlib/Analysis/NormedSpace/OperatorNorm/NormedSpace.lean | 52 | 64 | theorem bound_of_ball_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E →ₗ[𝕜] Fₗ)
(h : ∀ z ∈ Metric.ball (0 : E) r, ‖f z‖ ≤ c) : ∃ C, ∀ z : E, ‖f z‖ ≤ C * ‖z‖ := by |
cases' @NontriviallyNormedField.non_trivial 𝕜 _ with k hk
use c * (‖k‖ / r)
intro z
refine bound_of_shell _ r_pos hk (fun x hko hxo => ?_) _
calc
‖f x‖ ≤ c := h _ (mem_ball_zero_iff.mpr hxo)
_ ≤ c * (‖x‖ * ‖k‖ / r) := le_mul_of_one_le_right ?_ ?_
_ = _ := by ring
· exact le_trans (norm_nonneg _) (h 0 (by simp [r_pos]))
· rw [div_le_iff (zero_lt_one.trans hk)] at hko
exact (one_le_div r_pos).mpr hko
| 11 |
import Mathlib.Analysis.SpecialFunctions.Gamma.Basic
import Mathlib.Analysis.SpecialFunctions.PolarCoord
import Mathlib.Analysis.Convex.Complex
#align_import analysis.special_functions.gaussian from "leanprover-community/mathlib"@"7982767093ae38cba236487f9c9dd9cd99f63c16"
noncomputable section
open Real Set MeasureTheory Filter Asymptotics
open scoped Real Topology
open Complex hiding exp abs_of_nonneg
| Mathlib/Analysis/SpecialFunctions/Gaussian/GaussianIntegral.lean | 31 | 43 | theorem exp_neg_mul_rpow_isLittleO_exp_neg {p b : ℝ} (hb : 0 < b) (hp : 1 < p) :
(fun x : ℝ => exp (- b * x ^ p)) =o[atTop] fun x : ℝ => exp (-x) := by |
rw [isLittleO_exp_comp_exp_comp]
suffices Tendsto (fun x => x * (b * x ^ (p - 1) + -1)) atTop atTop by
refine Tendsto.congr' ?_ this
refine eventuallyEq_of_mem (Ioi_mem_atTop (0 : ℝ)) (fun x hx => ?_)
rw [mem_Ioi] at hx
rw [rpow_sub_one hx.ne']
field_simp [hx.ne']
ring
apply Tendsto.atTop_mul_atTop tendsto_id
refine tendsto_atTop_add_const_right atTop (-1 : ℝ) ?_
exact Tendsto.const_mul_atTop hb (tendsto_rpow_atTop (by linarith))
| 11 |
import Mathlib.RingTheory.JacobsonIdeal
#align_import ring_theory.nakayama from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
open Ideal
namespace Submodule
theorem eq_smul_of_le_smul_of_le_jacobson {I J : Ideal R} {N : Submodule R M} (hN : N.FG)
(hIN : N ≤ I • N) (hIjac : I ≤ jacobson J) : N = J • N := by
refine le_antisymm ?_ (Submodule.smul_le.2 fun _ _ _ => Submodule.smul_mem _ _)
intro n hn
cases' Submodule.exists_sub_one_mem_and_smul_eq_zero_of_fg_of_le_smul I N hN hIN with r hr
cases' exists_mul_sub_mem_of_sub_one_mem_jacobson r (hIjac hr.1) with s hs
have : n = -(s * r - 1) • n := by
rw [neg_sub, sub_smul, mul_smul, hr.2 n hn, one_smul, smul_zero, sub_zero]
rw [this]
exact Submodule.smul_mem_smul (Submodule.neg_mem _ hs) hn
#align submodule.eq_smul_of_le_smul_of_le_jacobson Submodule.eq_smul_of_le_smul_of_le_jacobson
lemma eq_bot_of_eq_ideal_smul_of_le_jacobson_annihilator {I : Ideal R}
{N : Submodule R M} (hN : FG N) (hIN : N = I • N)
(hIjac : I ≤ N.annihilator.jacobson) : N = ⊥ :=
(eq_smul_of_le_smul_of_le_jacobson hN hIN.le hIjac).trans N.annihilator_smul
open Pointwise in
lemma eq_bot_of_eq_pointwise_smul_of_mem_jacobson_annihilator {r : R}
{N : Submodule R M} (hN : FG N) (hrN : N = r • N)
(hrJac : r ∈ N.annihilator.jacobson) : N = ⊥ :=
eq_bot_of_eq_ideal_smul_of_le_jacobson_annihilator hN
(Eq.trans hrN (ideal_span_singleton_smul r N).symm)
((span_singleton_le_iff_mem r _).mpr hrJac)
open Pointwise in
lemma eq_bot_of_set_smul_eq_of_subset_jacobson_annihilator {s : Set R}
{N : Submodule R M} (hN : FG N) (hsN : N = s • N)
(hsJac : s ⊆ N.annihilator.jacobson) : N = ⊥ :=
eq_bot_of_eq_ideal_smul_of_le_jacobson_annihilator hN
(Eq.trans hsN (span_smul_eq s N).symm) (span_le.mpr hsJac)
lemma top_ne_ideal_smul_of_le_jacobson_annihilator [Nontrivial M]
[Module.Finite R M] {I} (h : I ≤ (Module.annihilator R M).jacobson) :
(⊤ : Submodule R M) ≠ I • ⊤ := fun H => top_ne_bot <|
eq_bot_of_eq_ideal_smul_of_le_jacobson_annihilator Module.Finite.out H <|
(congrArg (I ≤ Ideal.jacobson ·) annihilator_top).mpr h
open Pointwise in
lemma top_ne_set_smul_of_subset_jacobson_annihilator [Nontrivial M]
[Module.Finite R M] {s : Set R}
(h : s ⊆ (Module.annihilator R M).jacobson) :
(⊤ : Submodule R M) ≠ s • ⊤ :=
ne_of_ne_of_eq (top_ne_ideal_smul_of_le_jacobson_annihilator (span_le.mpr h))
(span_smul_eq _ _)
open Pointwise in
lemma top_ne_pointwise_smul_of_mem_jacobson_annihilator [Nontrivial M]
[Module.Finite R M] {r} (h : r ∈ (Module.annihilator R M).jacobson) :
(⊤ : Submodule R M) ≠ r • ⊤ :=
ne_of_ne_of_eq (top_ne_set_smul_of_subset_jacobson_annihilator <|
Set.singleton_subset_iff.mpr h) (singleton_set_smul ⊤ r)
theorem eq_bot_of_le_smul_of_le_jacobson_bot (I : Ideal R) (N : Submodule R M) (hN : N.FG)
(hIN : N ≤ I • N) (hIjac : I ≤ jacobson ⊥) : N = ⊥ := by
rw [eq_smul_of_le_smul_of_le_jacobson hN hIN hIjac, Submodule.bot_smul]
#align submodule.eq_bot_of_le_smul_of_le_jacobson_bot Submodule.eq_bot_of_le_smul_of_le_jacobson_bot
| Mathlib/RingTheory/Nakayama.lean | 114 | 126 | theorem sup_eq_sup_smul_of_le_smul_of_le_jacobson {I J : Ideal R} {N N' : Submodule R M}
(hN' : N'.FG) (hIJ : I ≤ jacobson J) (hNN : N' ≤ N ⊔ I • N') : N ⊔ N' = N ⊔ J • N' := by |
have hNN' : N ⊔ N' = N ⊔ I • N' :=
le_antisymm (sup_le le_sup_left hNN)
(sup_le_sup_left (Submodule.smul_le.2 fun _ _ _ => Submodule.smul_mem _ _) _)
have h_comap := Submodule.comap_injective_of_surjective (LinearMap.range_eq_top.1 N.range_mkQ)
have : (I • N').map N.mkQ = N'.map N.mkQ := by
simpa only [← h_comap.eq_iff, comap_map_mkQ, sup_comm, eq_comm] using hNN'
have :=
@Submodule.eq_smul_of_le_smul_of_le_jacobson _ _ _ _ _ I J (N'.map N.mkQ) (hN'.map _)
(by rw [← map_smul'', this]) hIJ
rwa [← map_smul'', ← h_comap.eq_iff, comap_map_eq, comap_map_eq, Submodule.ker_mkQ, sup_comm,
sup_comm (b := N)] at this
| 11 |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Expand
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.ZMod.Basic
#align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
open MvPolynomial
open Finset hiding map
open Finsupp (single)
--attribute [-simp] coe_eval₂_hom
variable (p : ℕ)
variable (R : Type*) [CommRing R] [DecidableEq R]
noncomputable def wittPolynomial (n : ℕ) : MvPolynomial ℕ R :=
∑ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i)
#align witt_polynomial wittPolynomial
theorem wittPolynomial_eq_sum_C_mul_X_pow (n : ℕ) :
wittPolynomial p R n = ∑ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by
apply sum_congr rfl
rintro i -
rw [monomial_eq, Finsupp.prod_single_index]
rw [pow_zero]
set_option linter.uppercaseLean3 false in
#align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow
-- 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 _
open Witt
open MvPolynomial
section
variable {R} {S : Type*} [CommRing S]
@[simp]
theorem map_wittPolynomial (f : R →+* S) (n : ℕ) : map f (W n) = W n := by
rw [wittPolynomial, map_sum, wittPolynomial]
refine sum_congr rfl fun i _ => ?_
rw [map_monomial, RingHom.map_pow, map_natCast]
#align map_witt_polynomial map_wittPolynomial
variable (R)
@[simp]
theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : ℕ) :
constantCoeff (wittPolynomial p R n) = 0 := by
simp only [wittPolynomial, map_sum, constantCoeff_monomial]
rw [sum_eq_zero]
rintro i _
rw [if_neg]
rw [Finsupp.single_eq_zero]
exact ne_of_gt (pow_pos hp.1.pos _)
#align constant_coeff_witt_polynomial constantCoeff_wittPolynomial
@[simp]
theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by
simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self]
#align witt_polynomial_zero wittPolynomial_zero
@[simp]
theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton,
one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero]
#align witt_polynomial_one wittPolynomial_one
theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : ℕ → A) (n : ℕ) :
aeval f (W_ R n) = ∑ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by
simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index]
#align aeval_witt_polynomial aeval_wittPolynomial
@[simp]
theorem wittPolynomial_zmod_self (n : ℕ) :
W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow]
rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0,
zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl]
intro k hk
rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ']
congr
rw [mem_range] at hk
rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm]
#align witt_polynomial_zmod_self wittPolynomial_zmod_self
section PPrime
variable [hp : NeZero p]
| Mathlib/RingTheory/WittVector/WittPolynomial.lean | 170 | 181 | theorem wittPolynomial_vars [CharZero R] (n : ℕ) : (wittPolynomial p R n).vars = range (n + 1) := by |
have : ∀ i, (monomial (Finsupp.single i (p ^ (n - i))) ((p : R) ^ i)).vars = {i} := by
intro i
refine vars_monomial_single i (pow_ne_zero _ hp.1) ?_
rw [← Nat.cast_pow, Nat.cast_ne_zero]
exact pow_ne_zero i hp.1
rw [wittPolynomial, vars_sum_of_disjoint]
· simp only [this, biUnion_singleton_eq_self]
· simp only [this]
intro a b h
apply disjoint_singleton_left.mpr
rwa [mem_singleton]
| 11 |
import Mathlib.Analysis.Complex.Liouville
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.FieldTheory.PolynomialGaloisGroup
import Mathlib.Topology.Algebra.Polynomial
#align_import analysis.complex.polynomial from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
open Polynomial Bornology Complex
open scoped ComplexConjugate
namespace Complex
| Mathlib/Analysis/Complex/Polynomial.lean | 34 | 45 | theorem exists_root {f : ℂ[X]} (hf : 0 < degree f) : ∃ z : ℂ, IsRoot f z := by |
by_contra! hf'
/- Since `f` has no roots, `f⁻¹` is differentiable. And since `f` is a polynomial, it tends to
infinity at infinity, thus `f⁻¹` tends to zero at infinity. By Liouville's theorem, `f⁻¹ = 0`. -/
have (z : ℂ) : (f.eval z)⁻¹ = 0 :=
(f.differentiable.inv hf').apply_eq_of_tendsto_cocompact z <|
Metric.cobounded_eq_cocompact (α := ℂ) ▸ (Filter.tendsto_inv₀_cobounded.comp <| by
simpa only [tendsto_norm_atTop_iff_cobounded]
using f.tendsto_norm_atTop hf tendsto_norm_cobounded_atTop)
-- Thus `f = 0`, contradicting the fact that `0 < degree f`.
obtain rfl : f = C 0 := Polynomial.funext fun z ↦ inv_injective <| by simp [this]
simp at hf
| 11 |
import Mathlib.Topology.Algebra.GroupCompletion
import Mathlib.Topology.Algebra.InfiniteSum.Group
open UniformSpace.Completion
variable {α β : Type*} [AddCommGroup α] [UniformSpace α] [UniformAddGroup α]
theorem hasSum_iff_hasSum_compl (f : β → α) (a : α):
HasSum (toCompl ∘ f) a ↔ HasSum f a := (denseInducing_toCompl α).hasSum_iff f a
theorem summable_iff_summable_compl_and_tsum_mem (f : β → α) :
Summable f ↔ Summable (toCompl ∘ f) ∧ ∑' i, toCompl (f i) ∈ Set.range toCompl :=
(denseInducing_toCompl α).summable_iff_tsum_comp_mem_range f
| Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean | 32 | 45 | theorem summable_iff_cauchySeq_finset_and_tsum_mem (f : β → α) :
Summable f ↔ CauchySeq (fun s : Finset β ↦ ∑ b in s, f b) ∧
∑' i, toCompl (f i) ∈ Set.range toCompl := by |
classical
constructor
· rintro ⟨a, ha⟩
exact ⟨ha.cauchySeq, ((summable_iff_summable_compl_and_tsum_mem f).mp ⟨a, ha⟩).2⟩
· rintro ⟨h_cauchy, h_tsum⟩
apply (summable_iff_summable_compl_and_tsum_mem f).mpr
constructor
· apply summable_iff_cauchySeq_finset.mpr
simp_rw [Function.comp_apply, ← map_sum]
exact h_cauchy.map (uniformContinuous_coe α)
· exact h_tsum
| 11 |
import Mathlib.CategoryTheory.Sites.Whiskering
import Mathlib.CategoryTheory.Sites.Plus
#align_import category_theory.sites.compatible_plus from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace CategoryTheory.GrothendieckTopology
open CategoryTheory Limits Opposite
universe w₁ w₂ v u
variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C)
variable {D : Type w₁} [Category.{max v u} D]
variable {E : Type w₂} [Category.{max v u} E]
variable (F : D ⥤ E)
variable [∀ (α β : Type max v u) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) D]
variable [∀ (α β : Type max v u) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) E]
variable [∀ (X : C) (W : J.Cover X) (P : Cᵒᵖ ⥤ D), PreservesLimit (W.index P).multicospan F]
variable (P : Cᵒᵖ ⥤ D)
def diagramCompIso (X : C) : J.diagram P X ⋙ F ≅ J.diagram (P ⋙ F) X :=
NatIso.ofComponents
(fun W => by
refine ?_ ≪≫ HasLimit.isoOfNatIso (W.unop.multicospanComp _ _).symm
refine
(isLimitOfPreserves F (limit.isLimit _)).conePointUniqueUpToIso (limit.isLimit _))
(by
intro A B f
-- Porting note: this used to work with `ext`
-- See https://github.com/leanprover-community/mathlib4/issues/5229
apply Multiequalizer.hom_ext
dsimp
simp only [Functor.mapCone_π_app, Multiequalizer.multifork_π_app_left, Iso.symm_hom,
Multiequalizer.lift_ι, eqToHom_refl, Category.comp_id,
limit.conePointUniqueUpToIso_hom_comp,
GrothendieckTopology.Cover.multicospanComp_hom_inv_left, HasLimit.isoOfNatIso_hom_π,
Category.assoc]
simp only [← F.map_comp, limit.lift_π, Multifork.ofι_π_app, implies_true])
#align category_theory.grothendieck_topology.diagram_comp_iso CategoryTheory.GrothendieckTopology.diagramCompIso
@[reassoc (attr := simp)]
theorem diagramCompIso_hom_ι (X : C) (W : (J.Cover X)ᵒᵖ) (i : W.unop.Arrow) :
(J.diagramCompIso F P X).hom.app W ≫ Multiequalizer.ι ((unop W).index (P ⋙ F)) i =
F.map (Multiequalizer.ι _ _) := by
delta diagramCompIso
dsimp
simp
#align category_theory.grothendieck_topology.diagram_comp_iso_hom_ι CategoryTheory.GrothendieckTopology.diagramCompIso_hom_ι
variable [∀ X : C, HasColimitsOfShape (J.Cover X)ᵒᵖ D]
variable [∀ X : C, HasColimitsOfShape (J.Cover X)ᵒᵖ E]
variable [∀ X : C, PreservesColimitsOfShape (J.Cover X)ᵒᵖ F]
def plusCompIso : J.plusObj P ⋙ F ≅ J.plusObj (P ⋙ F) :=
NatIso.ofComponents
(fun X => by
refine ?_ ≪≫ HasColimit.isoOfNatIso (J.diagramCompIso F P X.unop)
refine
(isColimitOfPreserves F
(colimit.isColimit (J.diagram P (unop X)))).coconePointUniqueUpToIso
(colimit.isColimit _))
(by
intro X Y f
apply (isColimitOfPreserves F (colimit.isColimit (J.diagram P X.unop))).hom_ext
intro W
dsimp [plusObj, plusMap]
simp only [Functor.map_comp, Category.assoc]
slice_rhs 1 2 =>
erw [(isColimitOfPreserves F (colimit.isColimit (J.diagram P X.unop))).fac]
slice_lhs 1 3 =>
simp only [← F.map_comp]
dsimp [colimMap, IsColimit.map, colimit.pre]
simp only [colimit.ι_desc_assoc, colimit.ι_desc]
dsimp [Cocones.precompose]
simp only [Category.assoc, colimit.ι_desc]
dsimp [Cocone.whisker]
rw [F.map_comp]
simp only [Category.assoc]
slice_lhs 2 3 =>
erw [(isColimitOfPreserves F (colimit.isColimit (J.diagram P Y.unop))).fac]
dsimp
simp only [HasColimit.isoOfNatIso_ι_hom_assoc, GrothendieckTopology.diagramPullback_app,
colimit.ι_pre, HasColimit.isoOfNatIso_ι_hom, ι_colimMap_assoc]
simp only [← Category.assoc]
dsimp
congr 1
ext
dsimp
simp only [Category.assoc]
erw [Multiequalizer.lift_ι, diagramCompIso_hom_ι, diagramCompIso_hom_ι, ← F.map_comp,
Multiequalizer.lift_ι])
#align category_theory.grothendieck_topology.plus_comp_iso CategoryTheory.GrothendieckTopology.plusCompIso
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Sites/CompatiblePlus.lean | 115 | 128 | theorem ι_plusCompIso_hom (X) (W) :
F.map (colimit.ι _ W) ≫ (J.plusCompIso F P).hom.app X =
(J.diagramCompIso F P X.unop).hom.app W ≫ colimit.ι _ W := by |
delta diagramCompIso plusCompIso
simp only [IsColimit.descCoconeMorphism_hom, IsColimit.uniqueUpToIso_hom,
Cocones.forget_map, Iso.trans_hom, NatIso.ofComponents_hom_app, Functor.mapIso_hom, ←
Category.assoc]
erw [(isColimitOfPreserves F (colimit.isColimit (J.diagram P (unop X)))).fac]
simp only [Category.assoc, HasLimit.isoOfNatIso_hom_π, Iso.symm_hom,
Cover.multicospanComp_hom_inv_left, eqToHom_refl, Category.comp_id,
limit.conePointUniqueUpToIso_hom_comp, Functor.mapCone_π_app,
Multiequalizer.multifork_π_app_left, Multiequalizer.lift_ι, Functor.map_comp, eq_self_iff_true,
Category.assoc, Iso.trans_hom, Iso.cancel_iso_hom_left, NatIso.ofComponents_hom_app,
colimit.cocone_ι, Category.assoc, HasColimit.isoOfNatIso_ι_hom]
| 11 |
import Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv
#align_import linear_algebra.quadratic_form.prod from "leanprover-community/mathlib"@"9b2755b951bc323c962bd072cd447b375cf58101"
universe u v w
variable {ι : Type*} {R : Type*} {M₁ M₂ N₁ N₂ : Type*} {Mᵢ Nᵢ : ι → Type*}
namespace QuadraticForm
section Prod
section Pi
section Semiring
variable [CommSemiring R]
variable [∀ i, AddCommMonoid (Mᵢ i)] [∀ i, AddCommMonoid (Nᵢ i)]
variable [∀ i, Module R (Mᵢ i)] [∀ i, Module R (Nᵢ i)]
def pi [Fintype ι] (Q : ∀ i, QuadraticForm R (Mᵢ i)) : QuadraticForm R (∀ i, Mᵢ i) :=
∑ i, (Q i).comp (LinearMap.proj i : _ →ₗ[R] Mᵢ i)
#align quadratic_form.pi QuadraticForm.pi
@[simp]
theorem pi_apply [Fintype ι] (Q : ∀ i, QuadraticForm R (Mᵢ i)) (x : ∀ i, Mᵢ i) :
pi Q x = ∑ i, Q i (x i) :=
sum_apply _ _ _
#align quadratic_form.pi_apply QuadraticForm.pi_apply
theorem pi_apply_single [Fintype ι] [DecidableEq ι]
(Q : ∀ i, QuadraticForm R (Mᵢ i)) (i : ι) (m : Mᵢ i) :
pi Q (Pi.single i m) = Q i m := by
rw [pi_apply, Fintype.sum_eq_single i fun j hj => ?_, Pi.single_eq_same]
rw [Pi.single_eq_of_ne hj, map_zero]
@[simps toLinearEquiv]
def IsometryEquiv.pi [Fintype ι]
{Q : ∀ i, QuadraticForm R (Mᵢ i)} {Q' : ∀ i, QuadraticForm R (Nᵢ i)}
(e : ∀ i, (Q i).IsometryEquiv (Q' i)) : (pi Q).IsometryEquiv (pi Q') where
map_app' x := by
simp only [pi_apply, LinearEquiv.piCongrRight, LinearEquiv.toFun_eq_coe,
IsometryEquiv.coe_toLinearEquiv, IsometryEquiv.map_app]
toLinearEquiv := LinearEquiv.piCongrRight fun i => (e i : Mᵢ i ≃ₗ[R] Nᵢ i)
#align quadratic_form.isometry.pi QuadraticForm.IsometryEquiv.pi
@[simps!]
def Isometry.single [Fintype ι] [DecidableEq ι] (Q : ∀ i, QuadraticForm R (Mᵢ i)) (i : ι) :
Q i →qᵢ pi Q where
toLinearMap := LinearMap.single i
map_app' := pi_apply_single _ _
@[simps!]
def Isometry.proj [Fintype ι] [DecidableEq ι] (i : ι) (Q : QuadraticForm R (Mᵢ i)) :
pi (Pi.single i Q) →qᵢ Q where
toLinearMap := LinearMap.proj i
map_app' m := by
dsimp
rw [pi_apply, Fintype.sum_eq_single i (fun j hij => ?_), Pi.single_eq_same]
rw [Pi.single_eq_of_ne hij, zero_apply]
@[simp, nolint simpNF] -- ignore the bogus "Left-hand side does not simplify" lint error
theorem Isometry.proj_comp_single_of_same [Fintype ι] [DecidableEq ι]
(i : ι) (Q : QuadraticForm R (Mᵢ i)) :
(proj i Q).comp (single _ i) = .ofEq (Pi.single_eq_same _ _) :=
ext fun _ => Pi.single_eq_same _ _
@[simp]
theorem Isometry.proj_comp_single_of_ne [Fintype ι] [DecidableEq ι]
{i j : ι} (h : i ≠ j) (Q : QuadraticForm R (Mᵢ i)) :
(proj i Q).comp (single _ j) = (0 : 0 →qᵢ Q).comp (ofEq (Pi.single_eq_of_ne h.symm _)) :=
ext fun _ => Pi.single_eq_of_ne h _
theorem Equivalent.pi [Fintype ι] {Q : ∀ i, QuadraticForm R (Mᵢ i)}
{Q' : ∀ i, QuadraticForm R (Nᵢ i)} (e : ∀ i, (Q i).Equivalent (Q' i)) :
(pi Q).Equivalent (pi Q') :=
⟨IsometryEquiv.pi fun i => Classical.choice (e i)⟩
#align quadratic_form.equivalent.pi QuadraticForm.Equivalent.pi
| Mathlib/LinearAlgebra/QuadraticForm/Prod.lean | 313 | 325 | theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
{Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by |
simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
intro i x hx
classical
have := h (Pi.single i x) ?_ i
· rw [Pi.single_eq_same] at this
exact this
apply Finset.sum_eq_zero
intro j _
by_cases hji : j = i
· subst hji; rw [Pi.single_eq_same, hx]
· rw [Pi.single_eq_of_ne hji, map_zero]
| 11 |
import Mathlib.NumberTheory.Padics.PadicIntegers
import Mathlib.RingTheory.ZMod
#align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950"
noncomputable section
open scoped Classical
open Nat LocalRing Padic
namespace PadicInt
variable {p : ℕ} [hp_prime : Fact p.Prime]
section lift
open CauSeq PadicSeq
variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k))
(f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1)
def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val
#align padic_int.nth_hom PadicInt.nthHom
@[simp]
theorem nthHom_zero : nthHom f 0 = 0 := by
simp (config := { unfoldPartialApp := true }) [nthHom]
rfl
#align padic_int.nth_hom_zero PadicInt.nthHom_zero
variable {f}
theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) :
(p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by
specialize f_compat i j h
rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub]
dsimp [nthHom]
rw [← f_compat, RingHom.comp_apply]
simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast]
#align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub
theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by
intro ε hε
obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε
use k
intro j hj
refine lt_of_le_of_lt ?_ hk
-- Need to do beta reduction first, as `norm_cast` doesn't.
-- Added to adapt to leanprover/lean4#2734.
beta_reduce
norm_cast
rw [← padicNorm.dvd_iff_norm_le]
exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj
#align padic_int.is_cau_seq_nth_hom PadicInt.isCauSeq_nthHom
def nthHomSeq (r : R) : PadicSeq p :=
⟨fun n => nthHom f r n, isCauSeq_nthHom f_compat r⟩
#align padic_int.nth_hom_seq PadicInt.nthHomSeq
-- this lemma ran into issues after changing to `NeZero` and I'm not sure why.
theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 := by
intro ε hε
change _ < _ at hε
use 1
intro j hj
haveI : Fact (1 < p ^ j) := ⟨Nat.one_lt_pow (by omega) hp_prime.1.one_lt⟩
suffices (ZMod.cast (1 : ZMod (p ^ j)) : ℚ) = 1 by simp [nthHomSeq, nthHom, this, hε]
rw [ZMod.cast_eq_val, ZMod.val_one, Nat.cast_one]
#align padic_int.nth_hom_seq_one PadicInt.nthHomSeq_one
theorem nthHomSeq_add (r s : R) :
nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s := by
intro ε hε
obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε
use n
intro j hj
dsimp [nthHomSeq]
apply lt_of_le_of_lt _ hn
rw [← Int.cast_add, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ←
ZMod.intCast_zmod_eq_zero_iff_dvd]
dsimp [nthHom]
simp only [ZMod.natCast_val, RingHom.map_add, Int.cast_sub, ZMod.intCast_cast, Int.cast_add]
rw [ZMod.cast_add (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj)]
simp only [cast_add, ZMod.natCast_val, Int.cast_add, ZMod.intCast_cast, sub_self]
#align padic_int.nth_hom_seq_add PadicInt.nthHomSeq_add
| Mathlib/NumberTheory/Padics/RingHoms.lean | 563 | 575 | theorem nthHomSeq_mul (r s : R) :
nthHomSeq f_compat (r * s) ≈ nthHomSeq f_compat r * nthHomSeq f_compat s := by |
intro ε hε
obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε
use n
intro j hj
dsimp [nthHomSeq]
apply lt_of_le_of_lt _ hn
rw [← Int.cast_mul, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ←
ZMod.intCast_zmod_eq_zero_iff_dvd]
dsimp [nthHom]
simp only [ZMod.natCast_val, RingHom.map_mul, Int.cast_sub, ZMod.intCast_cast, Int.cast_mul]
rw [ZMod.cast_mul (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj), sub_self]
| 11 |
import Mathlib.Probability.Kernel.MeasurableIntegral
#align_import probability.kernel.composition from "leanprover-community/mathlib"@"3b92d54a05ee592aa2c6181a4e76b1bb7cc45d0b"
open MeasureTheory
open scoped ENNReal
namespace ProbabilityTheory
namespace kernel
variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
section CompositionProduct
variable {γ : Type*} {mγ : MeasurableSpace γ} {s : Set (β × γ)}
noncomputable def compProdFun (κ : kernel α β) (η : kernel (α × β) γ) (a : α) (s : Set (β × γ)) :
ℝ≥0∞ :=
∫⁻ b, η (a, b) {c | (b, c) ∈ s} ∂κ a
#align probability_theory.kernel.comp_prod_fun ProbabilityTheory.kernel.compProdFun
theorem compProdFun_empty (κ : kernel α β) (η : kernel (α × β) γ) (a : α) :
compProdFun κ η a ∅ = 0 := by
simp only [compProdFun, Set.mem_empty_iff_false, Set.setOf_false, measure_empty,
MeasureTheory.lintegral_const, zero_mul]
#align probability_theory.kernel.comp_prod_fun_empty ProbabilityTheory.kernel.compProdFun_empty
theorem compProdFun_iUnion (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α)
(f : ℕ → Set (β × γ)) (hf_meas : ∀ i, MeasurableSet (f i))
(hf_disj : Pairwise (Disjoint on f)) :
compProdFun κ η a (⋃ i, f i) = ∑' i, compProdFun κ η a (f i) := by
have h_Union :
(fun b => η (a, b) {c : γ | (b, c) ∈ ⋃ i, f i}) = fun b =>
η (a, b) (⋃ i, {c : γ | (b, c) ∈ f i}) := by
ext1 b
congr with c
simp only [Set.mem_iUnion, Set.iSup_eq_iUnion, Set.mem_setOf_eq]
rw [compProdFun, h_Union]
have h_tsum :
(fun b => η (a, b) (⋃ i, {c : γ | (b, c) ∈ f i})) = fun b =>
∑' i, η (a, b) {c : γ | (b, c) ∈ f i} := by
ext1 b
rw [measure_iUnion]
· intro i j hij s hsi hsj c hcs
have hbci : {(b, c)} ⊆ f i := by rw [Set.singleton_subset_iff]; exact hsi hcs
have hbcj : {(b, c)} ⊆ f j := by rw [Set.singleton_subset_iff]; exact hsj hcs
simpa only [Set.bot_eq_empty, Set.le_eq_subset, Set.singleton_subset_iff,
Set.mem_empty_iff_false] using hf_disj hij hbci hbcj
· -- Porting note: behavior of `@` changed relative to lean 3, was
-- exact fun i => (@measurable_prod_mk_left β γ _ _ b) _ (hf_meas i)
exact fun i => (@measurable_prod_mk_left β γ _ _ b) (hf_meas i)
rw [h_tsum, lintegral_tsum]
· rfl
· intro i
have hm : MeasurableSet {p : (α × β) × γ | (p.1.2, p.2) ∈ f i} :=
measurable_fst.snd.prod_mk measurable_snd (hf_meas i)
exact ((measurable_kernel_prod_mk_left hm).comp measurable_prod_mk_left).aemeasurable
#align probability_theory.kernel.comp_prod_fun_Union ProbabilityTheory.kernel.compProdFun_iUnion
| Mathlib/Probability/Kernel/Composition.lean | 131 | 143 | theorem compProdFun_tsum_right (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α)
(hs : MeasurableSet s) : compProdFun κ η a s = ∑' n, compProdFun κ (seq η n) a s := by |
simp_rw [compProdFun, (measure_sum_seq η _).symm]
have :
∫⁻ b, Measure.sum (fun n => seq η n (a, b)) {c : γ | (b, c) ∈ s} ∂κ a =
∫⁻ b, ∑' n, seq η n (a, b) {c : γ | (b, c) ∈ s} ∂κ a := by
congr
ext1 b
rw [Measure.sum_apply]
exact measurable_prod_mk_left hs
rw [this, lintegral_tsum]
exact fun n => ((measurable_kernel_prod_mk_left (κ := (seq η n))
((measurable_fst.snd.prod_mk measurable_snd) hs)).comp measurable_prod_mk_left).aemeasurable
| 11 |
import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.Index
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.GroupAction.Quotient
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.SpecificGroups.Cyclic
import Mathlib.Tactic.IntervalCases
#align_import group_theory.p_group from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open Fintype MulAction
variable (p : ℕ) (G : Type*) [Group G]
def IsPGroup : Prop :=
∀ g : G, ∃ k : ℕ, g ^ p ^ k = 1
#align is_p_group IsPGroup
variable {p} {G}
namespace IsPGroup
theorem iff_orderOf [hp : Fact p.Prime] : IsPGroup p G ↔ ∀ g : G, ∃ k : ℕ, orderOf g = p ^ k :=
forall_congr' fun g =>
⟨fun ⟨k, hk⟩ =>
Exists.imp (fun _ h => h.right)
((Nat.dvd_prime_pow hp.out).mp (orderOf_dvd_of_pow_eq_one hk)),
Exists.imp fun k hk => by rw [← hk, pow_orderOf_eq_one]⟩
#align is_p_group.iff_order_of IsPGroup.iff_orderOf
theorem of_card [Fintype G] {n : ℕ} (hG : card G = p ^ n) : IsPGroup p G := fun g =>
⟨n, by rw [← hG, pow_card_eq_one]⟩
#align is_p_group.of_card IsPGroup.of_card
theorem of_bot : IsPGroup p (⊥ : Subgroup G) :=
of_card (by rw [← Nat.card_eq_fintype_card, Subgroup.card_bot, pow_zero])
#align is_p_group.of_bot IsPGroup.of_bot
| Mathlib/GroupTheory/PGroup.lean | 54 | 65 | theorem iff_card [Fact p.Prime] [Fintype G] : IsPGroup p G ↔ ∃ n : ℕ, card G = p ^ n := by |
have hG : card G ≠ 0 := card_ne_zero
refine ⟨fun h => ?_, fun ⟨n, hn⟩ => of_card hn⟩
suffices ∀ q ∈ Nat.factors (card G), q = p by
use (card G).factors.length
rw [← List.prod_replicate, ← List.eq_replicate_of_mem this, Nat.prod_factors hG]
intro q hq
obtain ⟨hq1, hq2⟩ := (Nat.mem_factors hG).mp hq
haveI : Fact q.Prime := ⟨hq1⟩
obtain ⟨g, hg⟩ := exists_prime_orderOf_dvd_card q hq2
obtain ⟨k, hk⟩ := (iff_orderOf.mp h) g
exact (hq1.pow_eq_iff.mp (hg.symm.trans hk).symm).1.symm
| 11 |
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric
import Mathlib.Topology.Metrizable.Basic
import Mathlib.Topology.IndicatorConstPointwise
#align_import measure_theory.constructions.borel_space.metrizable from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
open Filter MeasureTheory TopologicalSpace
open scoped Classical
open Topology NNReal ENNReal MeasureTheory
variable {α β : Type*} [MeasurableSpace α]
section Limits
variable [TopologicalSpace β] [PseudoMetrizableSpace β] [MeasurableSpace β] [BorelSpace β]
open Metric
theorem measurable_of_tendsto_metrizable' {ι} {f : ι → α → β} {g : α → β} (u : Filter ι) [NeBot u]
[IsCountablyGenerated u] (hf : ∀ i, Measurable (f i)) (lim : Tendsto f u (𝓝 g)) :
Measurable g := by
letI : PseudoMetricSpace β := pseudoMetrizableSpacePseudoMetric β
apply measurable_of_isClosed'
intro s h1s h2s h3s
have : Measurable fun x => infNndist (g x) s := by
suffices Tendsto (fun i x => infNndist (f i x) s) u (𝓝 fun x => infNndist (g x) s) from
NNReal.measurable_of_tendsto' u (fun i => (hf i).infNndist) this
rw [tendsto_pi_nhds] at lim ⊢
intro x
exact ((continuous_infNndist_pt s).tendsto (g x)).comp (lim x)
have h4s : g ⁻¹' s = (fun x => infNndist (g x) s) ⁻¹' {0} := by
ext x
simp [h1s, ← h1s.mem_iff_infDist_zero h2s, ← NNReal.coe_eq_zero]
rw [h4s]
exact this (measurableSet_singleton 0)
#align measurable_of_tendsto_metrizable' measurable_of_tendsto_metrizable'
theorem measurable_of_tendsto_metrizable {f : ℕ → α → β} {g : α → β} (hf : ∀ i, Measurable (f i))
(lim : Tendsto f atTop (𝓝 g)) : Measurable g :=
measurable_of_tendsto_metrizable' atTop hf lim
#align measurable_of_tendsto_metrizable measurable_of_tendsto_metrizable
theorem aemeasurable_of_tendsto_metrizable_ae {ι} {μ : Measure α} {f : ι → α → β} {g : α → β}
(u : Filter ι) [hu : NeBot u] [IsCountablyGenerated u] (hf : ∀ n, AEMeasurable (f n) μ)
(h_tendsto : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))) : AEMeasurable g μ := by
rcases u.exists_seq_tendsto with ⟨v, hv⟩
have h'f : ∀ n, AEMeasurable (f (v n)) μ := fun n => hf (v n)
set p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
have hp : ∀ᵐ x ∂μ, p x fun n => f (v n) x := by
filter_upwards [h_tendsto] with x hx using hx.comp hv
set aeSeqLim := fun x => ite (x ∈ aeSeqSet h'f p) (g x) (⟨f (v 0) x⟩ : Nonempty β).some
refine
⟨aeSeqLim,
measurable_of_tendsto_metrizable' atTop (aeSeq.measurable h'f p)
(tendsto_pi_nhds.mpr fun x => ?_),
?_⟩
· simp_rw [aeSeqLim, aeSeq]
split_ifs with hx
· simp_rw [aeSeq.mk_eq_fun_of_mem_aeSeqSet h'f hx]
exact @aeSeq.fun_prop_of_mem_aeSeqSet _ α β _ _ _ _ _ h'f x hx
· exact tendsto_const_nhds
· exact
(ite_ae_eq_of_measure_compl_zero g (fun x => (⟨f (v 0) x⟩ : Nonempty β).some) (aeSeqSet h'f p)
(aeSeq.measure_compl_aeSeqSet_eq_zero h'f hp)).symm
#align ae_measurable_of_tendsto_metrizable_ae aemeasurable_of_tendsto_metrizable_ae
theorem aemeasurable_of_tendsto_metrizable_ae' {μ : Measure α} {f : ℕ → α → β} {g : α → β}
(hf : ∀ n, AEMeasurable (f n) μ)
(h_ae_tendsto : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) atTop (𝓝 (g x))) : AEMeasurable g μ :=
aemeasurable_of_tendsto_metrizable_ae atTop hf h_ae_tendsto
#align ae_measurable_of_tendsto_metrizable_ae' aemeasurable_of_tendsto_metrizable_ae'
| Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean | 87 | 101 | theorem aemeasurable_of_unif_approx {β} [MeasurableSpace β] [PseudoMetricSpace β] [BorelSpace β]
{μ : Measure α} {g : α → β}
(hf : ∀ ε > (0 : ℝ), ∃ f : α → β, AEMeasurable f μ ∧ ∀ᵐ x ∂μ, dist (f x) (g x) ≤ ε) :
AEMeasurable g μ := by |
obtain ⟨u, -, u_pos, u_lim⟩ :
∃ u : ℕ → ℝ, StrictAnti u ∧ (∀ n : ℕ, 0 < u n) ∧ Tendsto u atTop (𝓝 0) :=
exists_seq_strictAnti_tendsto (0 : ℝ)
choose f Hf using fun n : ℕ => hf (u n) (u_pos n)
have : ∀ᵐ x ∂μ, Tendsto (fun n => f n x) atTop (𝓝 (g x)) := by
have : ∀ᵐ x ∂μ, ∀ n, dist (f n x) (g x) ≤ u n := ae_all_iff.2 fun n => (Hf n).2
filter_upwards [this]
intro x hx
rw [tendsto_iff_dist_tendsto_zero]
exact squeeze_zero (fun n => dist_nonneg) hx u_lim
exact aemeasurable_of_tendsto_metrizable_ae' (fun n => (Hf n).1) this
| 11 |
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
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]
| .lake/packages/batteries/Batteries/Data/Range/Lemmas.lean | 94 | 107 | theorem forIn_eq_forIn_range' [Monad m] (r : Std.Range)
(init : β) (f : Nat → β → m (ForInStep β)) :
forIn r init f = forIn (List.range' r.start r.numElems r.step) init f := by |
refine Eq.trans ?_ <| (forIn'_eq_forIn_range' r init (fun x _ => f x)).trans ?_
· simp [forIn, forIn', Range.forIn, Range.forIn']
suffices ∀ fuel i hl b, forIn'.loop r.start r.stop r.step (fun x _ => f x) fuel i hl b =
forIn.loop f fuel i r.stop r.step b from (this _ ..).symm
intro fuel; induction fuel <;> intro i hl b <;>
unfold forIn.loop forIn'.loop <;> simp [*]
split
· simp [if_neg (Nat.not_le.2 ‹_›)]
· simp [if_pos (Nat.not_lt.1 ‹_›)]
· suffices ∀ L H, forIn (List.pmap Subtype.mk L H) init (f ·.1) = forIn L init f from this _ ..
intro L; induction L generalizing init <;> intro H <;> simp [*]
| 11 |
import Mathlib.Data.Finsupp.Defs
#align_import data.list.to_finsupp from "leanprover-community/mathlib"@"06a655b5fcfbda03502f9158bbf6c0f1400886f9"
namespace List
variable {M : Type*} [Zero M] (l : List M) [DecidablePred (getD l · 0 ≠ 0)] (n : ℕ)
def toFinsupp : ℕ →₀ M where
toFun i := getD l i 0
support := (Finset.range l.length).filter fun i => getD l i 0 ≠ 0
mem_support_toFun n := by
simp only [Ne, Finset.mem_filter, Finset.mem_range, and_iff_right_iff_imp]
contrapose!
exact getD_eq_default _ _
#align list.to_finsupp List.toFinsupp
@[norm_cast]
theorem coe_toFinsupp : (l.toFinsupp : ℕ → M) = (l.getD · 0) :=
rfl
#align list.coe_to_finsupp List.coe_toFinsupp
@[simp, norm_cast]
theorem toFinsupp_apply (i : ℕ) : (l.toFinsupp : ℕ → M) i = l.getD i 0 :=
rfl
#align list.to_finsupp_apply List.toFinsupp_apply
theorem toFinsupp_support :
l.toFinsupp.support = (Finset.range l.length).filter (getD l · 0 ≠ 0) :=
rfl
#align list.to_finsupp_support List.toFinsupp_support
theorem toFinsupp_apply_lt (hn : n < l.length) : l.toFinsupp n = l.get ⟨n, hn⟩ :=
getD_eq_get _ _ _
theorem toFinsupp_apply_fin (n : Fin l.length) : l.toFinsupp n = l.get n :=
getD_eq_get _ _ _
set_option linter.deprecated false in
@[deprecated (since := "2023-04-10")]
theorem toFinsupp_apply_lt' (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn :=
getD_eq_get _ _ _
#align list.to_finsupp_apply_lt List.toFinsupp_apply_lt'
theorem toFinsupp_apply_le (hn : l.length ≤ n) : l.toFinsupp n = 0 :=
getD_eq_default _ _ hn
#align list.to_finsupp_apply_le List.toFinsupp_apply_le
@[simp]
theorem toFinsupp_nil [DecidablePred fun i => getD ([] : List M) i 0 ≠ 0] :
toFinsupp ([] : List M) = 0 := by
ext
simp
#align list.to_finsupp_nil List.toFinsupp_nil
theorem toFinsupp_singleton (x : M) [DecidablePred (getD [x] · 0 ≠ 0)] :
toFinsupp [x] = Finsupp.single 0 x := by
ext ⟨_ | i⟩ <;> simp [Finsupp.single_apply, (Nat.zero_lt_succ _).ne]
#align list.to_finsupp_singleton List.toFinsupp_singleton
@[simp]
theorem toFinsupp_cons_apply_zero (x : M) (xs : List M)
[DecidablePred (getD (x::xs) · 0 ≠ 0)] : (x::xs).toFinsupp 0 = x :=
rfl
#align list.to_finsupp_cons_apply_zero List.toFinsupp_cons_apply_zero
@[simp]
theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
[DecidablePred (getD (x::xs) · 0 ≠ 0)] [DecidablePred (getD xs · 0 ≠ 0)] :
(x::xs).toFinsupp n.succ = xs.toFinsupp n :=
rfl
#align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ
-- Porting note (#10756): new theorem
| Mathlib/Data/List/ToFinsupp.lean | 111 | 126 | theorem toFinsupp_append {R : Type*} [AddZeroClass R] (l₁ l₂ : List R)
[DecidablePred (getD (l₁ ++ l₂) · 0 ≠ 0)] [DecidablePred (getD l₁ · 0 ≠ 0)]
[DecidablePred (getD l₂ · 0 ≠ 0)] :
toFinsupp (l₁ ++ l₂) =
toFinsupp l₁ + (toFinsupp l₂).embDomain (addLeftEmbedding l₁.length) := by |
ext n
simp only [toFinsupp_apply, Finsupp.add_apply]
cases lt_or_le n l₁.length with
| inl h =>
rw [getD_append _ _ _ _ h, Finsupp.embDomain_notin_range, add_zero]
rintro ⟨k, rfl : length l₁ + k = n⟩
omega
| inr h =>
rcases Nat.exists_eq_add_of_le h with ⟨k, rfl⟩
rw [getD_append_right _ _ _ _ h, Nat.add_sub_cancel_left, getD_eq_default _ _ h, zero_add]
exact Eq.symm (Finsupp.embDomain_apply _ _ _)
| 11 |
import Mathlib.Algebra.Bounds
import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Function Set
open Pointwise
variable {α : Type*}
-- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice`
-- due to simpNF problem between `sSup_xx` `csSup_xx`.
section CompleteLattice
variable [CompleteLattice α]
namespace LinearOrderedField
variable {K : Type*} [LinearOrderedField K] {a b r : K} (hr : 0 < r)
open Set
theorem smul_Ioo : r • Ioo a b = Ioo (r • a) (r • b) := by
ext x
simp only [mem_smul_set, smul_eq_mul, mem_Ioo]
constructor
· rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩
constructor
· exact (mul_lt_mul_left hr).mpr a_h_left_left
· exact (mul_lt_mul_left hr).mpr a_h_left_right
· rintro ⟨a_left, a_right⟩
use x / r
refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩
rw [mul_div_cancel₀ _ (ne_of_gt hr)]
#align linear_ordered_field.smul_Ioo LinearOrderedField.smul_Ioo
| Mathlib/Algebra/Order/Pointwise.lean | 197 | 208 | theorem smul_Icc : r • Icc a b = Icc (r • a) (r • b) := by |
ext x
simp only [mem_smul_set, smul_eq_mul, mem_Icc]
constructor
· rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩
constructor
· exact (mul_le_mul_left hr).mpr a_h_left_left
· exact (mul_le_mul_left hr).mpr a_h_left_right
· rintro ⟨a_left, a_right⟩
use x / r
refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩
rw [mul_div_cancel₀ _ (ne_of_gt hr)]
| 11 |
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]
| Mathlib/FieldTheory/IsAlgClosed/Classification.lean | 41 | 59 | 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]
| 11 |
import Mathlib.Order.Filter.Basic
import Mathlib.Topology.Bases
import Mathlib.Data.Set.Accumulate
import Mathlib.Topology.Bornology.Basic
import Mathlib.Topology.LocallyFinite
open Set Filter Topology TopologicalSpace Classical Function
universe u v
variable {X : Type u} {Y : Type v} {ι : Type*}
variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X}
-- compact sets
section Compact
lemma IsCompact.exists_clusterPt (hs : IsCompact s) {f : Filter X} [NeBot f] (hf : f ≤ 𝓟 s) :
∃ x ∈ s, ClusterPt x f := hs hf
lemma IsCompact.exists_mapClusterPt {ι : Type*} (hs : IsCompact s) {f : Filter ι} [NeBot f]
{u : ι → X} (hf : Filter.map u f ≤ 𝓟 s) :
∃ x ∈ s, MapClusterPt x f u := hs hf
theorem IsCompact.compl_mem_sets (hs : IsCompact s) {f : Filter X} (hf : ∀ x ∈ s, sᶜ ∈ 𝓝 x ⊓ f) :
sᶜ ∈ f := by
contrapose! hf
simp only [not_mem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf ⊢
exact @hs _ hf inf_le_right
#align is_compact.compl_mem_sets IsCompact.compl_mem_sets
theorem IsCompact.compl_mem_sets_of_nhdsWithin (hs : IsCompact s) {f : Filter X}
(hf : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, tᶜ ∈ f) : sᶜ ∈ f := by
refine hs.compl_mem_sets fun x hx => ?_
rcases hf x hx with ⟨t, ht, hst⟩
replace ht := mem_inf_principal.1 ht
apply mem_inf_of_inter ht hst
rintro x ⟨h₁, h₂⟩ hs
exact h₂ (h₁ hs)
#align is_compact.compl_mem_sets_of_nhds_within IsCompact.compl_mem_sets_of_nhdsWithin
@[elab_as_elim]
theorem IsCompact.induction_on (hs : IsCompact s) {p : Set X → Prop} (he : p ∅)
(hmono : ∀ ⦃s t⦄, s ⊆ t → p t → p s) (hunion : ∀ ⦃s t⦄, p s → p t → p (s ∪ t))
(hnhds : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, p t) : p s := by
let f : Filter X := comk p he (fun _t ht _s hsub ↦ hmono hsub ht) (fun _s hs _t ht ↦ hunion hs ht)
have : sᶜ ∈ f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds)
rwa [← compl_compl s]
#align is_compact.induction_on IsCompact.induction_on
theorem IsCompact.inter_right (hs : IsCompact s) (ht : IsClosed t) : IsCompact (s ∩ t) := by
intro f hnf hstf
obtain ⟨x, hsx, hx⟩ : ∃ x ∈ s, ClusterPt x f :=
hs (le_trans hstf (le_principal_iff.2 inter_subset_left))
have : x ∈ t := ht.mem_of_nhdsWithin_neBot <|
hx.mono <| le_trans hstf (le_principal_iff.2 inter_subset_right)
exact ⟨x, ⟨hsx, this⟩, hx⟩
#align is_compact.inter_right IsCompact.inter_right
theorem IsCompact.inter_left (ht : IsCompact t) (hs : IsClosed s) : IsCompact (s ∩ t) :=
inter_comm t s ▸ ht.inter_right hs
#align is_compact.inter_left IsCompact.inter_left
theorem IsCompact.diff (hs : IsCompact s) (ht : IsOpen t) : IsCompact (s \ t) :=
hs.inter_right (isClosed_compl_iff.mpr ht)
#align is_compact.diff IsCompact.diff
theorem IsCompact.of_isClosed_subset (hs : IsCompact s) (ht : IsClosed t) (h : t ⊆ s) :
IsCompact t :=
inter_eq_self_of_subset_right h ▸ hs.inter_right ht
#align is_compact_of_is_closed_subset IsCompact.of_isClosed_subset
| Mathlib/Topology/Compactness/Compact.lean | 104 | 116 | theorem IsCompact.image_of_continuousOn {f : X → Y} (hs : IsCompact s) (hf : ContinuousOn f s) :
IsCompact (f '' s) := by |
intro l lne ls
have : NeBot (l.comap f ⊓ 𝓟 s) :=
comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls)
obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, ClusterPt x (l.comap f ⊓ 𝓟 s) := @hs _ this inf_le_right
haveI := hx.neBot
use f x, mem_image_of_mem f hxs
have : Tendsto f (𝓝 x ⊓ (comap f l ⊓ 𝓟 s)) (𝓝 (f x) ⊓ l) := by
convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1
rw [nhdsWithin]
ac_rfl
exact this.neBot
| 11 |
import Mathlib.Algebra.Polynomial.UnitTrinomial
import Mathlib.RingTheory.Polynomial.GaussLemma
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.selmer from "leanprover-community/mathlib"@"3e00d81bdcbf77c8188bbd18f5524ddc3ed8cac6"
namespace Polynomial
open scoped Polynomial
variable {n : ℕ}
theorem X_pow_sub_X_sub_one_irreducible_aux (z : ℂ) : ¬(z ^ n = z + 1 ∧ z ^ n + z ^ 2 = 0) := by
rintro ⟨h1, h2⟩
replace h3 : z ^ 3 = 1 := by
linear_combination (1 - z - z ^ 2 - z ^ n) * h1 + (z ^ n - 2) * h2
have key : z ^ n = 1 ∨ z ^ n = z ∨ z ^ n = z ^ 2 := by
rw [← Nat.mod_add_div n 3, pow_add, pow_mul, h3, one_pow, mul_one]
have : n % 3 < 3 := Nat.mod_lt n zero_lt_three
interval_cases n % 3 <;>
simp only [this, pow_zero, pow_one, eq_self_iff_true, or_true_iff, true_or_iff]
have z_ne_zero : z ≠ 0 := fun h =>
zero_ne_one ((zero_pow three_ne_zero).symm.trans (show (0 : ℂ) ^ 3 = 1 from h ▸ h3))
rcases key with (key | key | key)
· exact z_ne_zero (by rwa [key, self_eq_add_left] at h1)
· exact one_ne_zero (by rwa [key, self_eq_add_right] at h1)
· exact z_ne_zero (pow_eq_zero (by rwa [key, add_self_eq_zero] at h2))
set_option linter.uppercaseLean3 false in
#align polynomial.X_pow_sub_X_sub_one_irreducible_aux Polynomial.X_pow_sub_X_sub_one_irreducible_aux
theorem X_pow_sub_X_sub_one_irreducible (hn1 : n ≠ 1) : Irreducible (X ^ n - X - 1 : ℤ[X]) := by
by_cases hn0 : n = 0
· rw [hn0, pow_zero, sub_sub, add_comm, ← sub_sub, sub_self, zero_sub]
exact Associated.irreducible ⟨-1, mul_neg_one X⟩ irreducible_X
have hn : 1 < n := Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hn0, hn1⟩
have hp : (X ^ n - X - 1 : ℤ[X]) = trinomial 0 1 n (-1) (-1) 1 := by
simp only [trinomial, C_neg, C_1]; ring
rw [hp]
apply IsUnitTrinomial.irreducible_of_coprime' ⟨0, 1, n, zero_lt_one, hn, -1, -1, 1, rfl⟩
rintro z ⟨h1, h2⟩
apply X_pow_sub_X_sub_one_irreducible_aux (n := n) z
rw [trinomial_mirror zero_lt_one hn (-1 : ℤˣ).ne_zero (1 : ℤˣ).ne_zero] at h2
simp_rw [trinomial, aeval_add, aeval_mul, aeval_X_pow, aeval_C,
Units.val_neg, Units.val_one, map_neg, map_one] at h1 h2
replace h1 : z ^ n = z + 1 := by linear_combination h1
replace h2 := mul_eq_zero_of_left h2 z
rw [add_mul, add_mul, add_zero, mul_assoc (-1 : ℂ), ← pow_succ, Nat.sub_add_cancel hn.le] at h2
rw [h1] at h2 ⊢
exact ⟨rfl, by linear_combination -h2⟩
set_option linter.uppercaseLean3 false in
#align polynomial.X_pow_sub_X_sub_one_irreducible Polynomial.X_pow_sub_X_sub_one_irreducible
| Mathlib/RingTheory/Polynomial/Selmer.lean | 71 | 82 | theorem X_pow_sub_X_sub_one_irreducible_rat (hn1 : n ≠ 1) : Irreducible (X ^ n - X - 1 : ℚ[X]) := by |
by_cases hn0 : n = 0
· rw [hn0, pow_zero, sub_sub, add_comm, ← sub_sub, sub_self, zero_sub]
exact Associated.irreducible ⟨-1, mul_neg_one X⟩ irreducible_X
have hp : (X ^ n - X - 1 : ℤ[X]) = trinomial 0 1 n (-1) (-1) 1 := by
simp only [trinomial, C_neg, C_1]; ring
have hn : 1 < n := Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hn0, hn1⟩
have h := (IsPrimitive.Int.irreducible_iff_irreducible_map_cast ?_).mp
(X_pow_sub_X_sub_one_irreducible hn1)
· rwa [Polynomial.map_sub, Polynomial.map_sub, Polynomial.map_pow, Polynomial.map_one,
Polynomial.map_X] at h
· exact hp.symm ▸ (trinomial_monic zero_lt_one hn).isPrimitive
| 11 |
import Mathlib.MeasureTheory.Integral.Lebesgue
import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.MeanInequalitiesPow
import Mathlib.MeasureTheory.Function.SpecialFunctions.Basic
#align_import measure_theory.integral.mean_inequalities from "leanprover-community/mathlib"@"13bf7613c96a9fd66a81b9020a82cad9a6ea1fcf"
section LIntegral
noncomputable section
open scoped Classical
open NNReal ENNReal MeasureTheory Finset
set_option linter.uppercaseLean3 false
variable {α : Type*} [MeasurableSpace α] {μ : Measure α}
namespace ENNReal
| Mathlib/MeasureTheory/Integral/MeanInequalities.lean | 66 | 79 | theorem lintegral_mul_le_one_of_lintegral_rpow_eq_one {p q : ℝ} (hpq : p.IsConjExponent q)
{f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hf_norm : ∫⁻ a, f a ^ p ∂μ = 1)
(hg_norm : ∫⁻ a, g a ^ q ∂μ = 1) : (∫⁻ a, (f * g) a ∂μ) ≤ 1 := by |
calc
(∫⁻ a : α, (f * g) a ∂μ) ≤
∫⁻ a : α, f a ^ p / ENNReal.ofReal p + g a ^ q / ENNReal.ofReal q ∂μ :=
lintegral_mono fun a => young_inequality (f a) (g a) hpq
_ = 1 := by
simp only [div_eq_mul_inv]
rw [lintegral_add_left']
· rw [lintegral_mul_const'' _ (hf.pow_const p), lintegral_mul_const', hf_norm, hg_norm,
one_mul, one_mul, hpq.inv_add_inv_conj_ennreal]
simp [hpq.symm.pos]
· exact (hf.pow_const _).mul_const _
| 11 |
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
| Mathlib/GroupTheory/SchurZassenhaus.lean | 48 | 62 | 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]
| 11 |
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.Combinatorics.SimpleGraph.Operations
import Mathlib.Data.Finset.Pairwise
#align_import combinatorics.simple_graph.clique from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
open Finset Fintype Function SimpleGraph.Walk
namespace SimpleGraph
variable {α β : Type*} (G H : SimpleGraph α)
section Clique
variable {s t : Set α}
abbrev IsClique (s : Set α) : Prop :=
s.Pairwise G.Adj
#align simple_graph.is_clique SimpleGraph.IsClique
theorem isClique_iff : G.IsClique s ↔ s.Pairwise G.Adj :=
Iff.rfl
#align simple_graph.is_clique_iff SimpleGraph.isClique_iff
| Mathlib/Combinatorics/SimpleGraph/Clique.lean | 55 | 66 | theorem isClique_iff_induce_eq : G.IsClique s ↔ G.induce s = ⊤ := by |
rw [isClique_iff]
constructor
· intro h
ext ⟨v, hv⟩ ⟨w, hw⟩
simp only [comap_adj, Subtype.coe_mk, top_adj, Ne, Subtype.mk_eq_mk]
exact ⟨Adj.ne, h hv hw⟩
· intro h v hv w hw hne
have h2 : (G.induce s).Adj ⟨v, hv⟩ ⟨w, hw⟩ = _ := rfl
conv_lhs at h2 => rw [h]
simp only [top_adj, ne_eq, Subtype.mk.injEq, eq_iff_iff] at h2
exact h2.1 hne
| 11 |
import Mathlib.Init.Core
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
open Polynomial Algebra FiniteDimensional Set
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
@[mk_iff]
class IsCyclotomicExtension : Prop where
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section
variable {A B}
theorem adjoin_roots_cyclotomic_eq_adjoin_nth_roots [IsDomain B] {ζ : B} {n : ℕ+}
(hζ : IsPrimitiveRoot ζ n) :
adjoin A ((cyclotomic n A).rootSet B) =
adjoin A {b : B | ∃ a : ℕ+, a ∈ ({n} : Set ℕ+) ∧ b ^ (a : ℕ) = 1} := by
simp only [mem_singleton_iff, exists_eq_left, map_cyclotomic]
refine le_antisymm (adjoin_mono fun x hx => ?_) (adjoin_le fun x hx => ?_)
· rw [mem_rootSet'] at hx
simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq]
rw [isRoot_of_unity_iff n.pos]
refine ⟨n, Nat.mem_divisors_self n n.ne_zero, ?_⟩
rw [IsRoot.def, ← map_cyclotomic n (algebraMap A B), eval_map, ← aeval_def]
exact hx.2
· simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] at hx
obtain ⟨i, _, rfl⟩ := hζ.eq_pow_of_pow_eq_one hx n.pos
refine SetLike.mem_coe.2 (Subalgebra.pow_mem _ (subset_adjoin ?_) _)
rw [mem_rootSet', map_cyclotomic, aeval_def, ← eval_map, map_cyclotomic, ← IsRoot]
exact ⟨cyclotomic_ne_zero n B, hζ.isRoot_cyclotomic n.pos⟩
#align is_cyclotomic_extension.adjoin_roots_cyclotomic_eq_adjoin_nth_roots IsCyclotomicExtension.adjoin_roots_cyclotomic_eq_adjoin_nth_roots
| Mathlib/NumberTheory/Cyclotomic/Basic.lean | 387 | 399 | theorem adjoin_roots_cyclotomic_eq_adjoin_root_cyclotomic {n : ℕ+} [IsDomain B] {ζ : B}
(hζ : IsPrimitiveRoot ζ n) : adjoin A ((cyclotomic n A).rootSet B) = adjoin A {ζ} := by |
refine le_antisymm (adjoin_le fun x hx => ?_) (adjoin_mono fun x hx => ?_)
· suffices hx : x ^ n.1 = 1 by
obtain ⟨i, _, rfl⟩ := hζ.eq_pow_of_pow_eq_one hx n.pos
exact SetLike.mem_coe.2 (Subalgebra.pow_mem _ (subset_adjoin <| mem_singleton ζ) _)
refine (isRoot_of_unity_iff n.pos B).2 ?_
refine ⟨n, Nat.mem_divisors_self n n.ne_zero, ?_⟩
rw [mem_rootSet', aeval_def, ← eval_map, map_cyclotomic, ← IsRoot] at hx
exact hx.2
· simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] at hx
simpa only [hx, mem_rootSet', map_cyclotomic, aeval_def, ← eval_map, IsRoot] using
And.intro (cyclotomic_ne_zero n B) (hζ.isRoot_cyclotomic n.pos)
| 11 |
import Mathlib.CategoryTheory.Monad.Types
import Mathlib.CategoryTheory.Monad.Limits
import Mathlib.CategoryTheory.Equivalence
import Mathlib.Topology.Category.CompHaus.Basic
import Mathlib.Topology.Category.Profinite.Basic
import Mathlib.Data.Set.Constructions
#align_import topology.category.Compactum from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
-- Porting note: "Compactum" is already upper case
set_option linter.uppercaseLean3 false
universe u
open CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter
open scoped Classical
open Topology
local notation "β" => ofTypeMonad Ultrafilter
def Compactum :=
Monad.Algebra β deriving Category, Inhabited
#align Compactum Compactum
namespace Compactum
def forget : Compactum ⥤ Type* :=
Monad.forget _ --deriving CreatesLimits, Faithful
-- Porting note: deriving fails, adding manually. Note `CreatesLimits` now noncomputable
#align Compactum.forget Compactum.forget
instance : forget.Faithful :=
show (Monad.forget _).Faithful from inferInstance
noncomputable instance : CreatesLimits forget :=
show CreatesLimits <| Monad.forget _ from inferInstance
def free : Type* ⥤ Compactum :=
Monad.free _
#align Compactum.free Compactum.free
def adj : free ⊣ forget :=
Monad.adj _
#align Compactum.adj Compactum.adj
-- Basic instances
instance : ConcreteCategory Compactum where forget := forget
-- Porting note: changed from forget to X.A
instance : CoeSort Compactum Type* :=
⟨fun X => X.A⟩
instance {X Y : Compactum} : CoeFun (X ⟶ Y) fun _ => X → Y :=
⟨fun f => f.f⟩
instance : HasLimits Compactum :=
hasLimits_of_hasLimits_createsLimits forget
def str (X : Compactum) : Ultrafilter X → X :=
X.a
#align Compactum.str Compactum.str
def join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X :=
(β ).μ.app _
#align Compactum.join Compactum.join
def incl (X : Compactum) : X → Ultrafilter X :=
(β ).η.app _
#align Compactum.incl Compactum.incl
@[simp]
theorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by
change ((β ).η.app _ ≫ X.a) _ = _
rw [Monad.Algebra.unit]
rfl
#align Compactum.str_incl Compactum.str_incl
@[simp]
theorem str_hom_commute (X Y : Compactum) (f : X ⟶ Y) (xs : Ultrafilter X) :
f (X.str xs) = Y.str (map f xs) := by
change (X.a ≫ f.f) _ = _
rw [← f.h]
rfl
#align Compactum.str_hom_commute Compactum.str_hom_commute
@[simp]
theorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) :
X.str (X.join uux) = X.str (map X.str uux) := by
change ((β ).μ.app _ ≫ X.a) _ = _
rw [Monad.Algebra.assoc]
rfl
#align Compactum.join_distrib Compactum.join_distrib
-- Porting note: changes to X.A from X since Lean can't see through X to X.A below
instance {X : Compactum} : TopologicalSpace X.A where
IsOpen U := ∀ F : Ultrafilter X, X.str F ∈ U → U ∈ F
isOpen_univ _ _ := Filter.univ_sets _
isOpen_inter _ _ h3 h4 _ h6 := Filter.inter_sets _ (h3 _ h6.1) (h4 _ h6.2)
isOpen_sUnion := fun _ h1 _ ⟨T, hT, h2⟩ =>
mem_of_superset (h1 T hT _ h2) (Set.subset_sUnion_of_mem hT)
| Mathlib/Topology/Category/Compactum.lean | 173 | 185 | theorem isClosed_iff {X : Compactum} (S : Set X) :
IsClosed S ↔ ∀ F : Ultrafilter X, S ∈ F → X.str F ∈ S := by |
rw [← isOpen_compl_iff]
constructor
· intro cond F h
by_contra c
specialize cond F c
rw [compl_mem_iff_not_mem] at cond
contradiction
· intro h1 F h2
specialize h1 F
cases' F.mem_or_compl_mem S with h h
exacts [absurd (h1 h) h2, h]
| 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.