Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | eval_complexity float64 0 1 |
|---|---|---|---|---|---|---|
import Mathlib.Order.Bounds.Basic
import Mathlib.Order.WellFounded
import Mathlib.Data.Set.Image
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Data.Set.Lattice
#align_import order.conditionally_complete_lattice.basic from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1"
open Function OrderDual Set
variable {α β γ : Type*} {ι : Sort*}
section
variable [Preorder α]
open scoped Classical
noncomputable instance WithTop.instSupSet [SupSet α] :
SupSet (WithTop α) :=
⟨fun S =>
if ⊤ ∈ S then ⊤ else if BddAbove ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α) then
↑(sSup ((fun (a : α) ↦ (a : WithTop α)) ⁻¹' S : Set α)) else ⊤⟩
noncomputable instance WithTop.instInfSet [InfSet α] : InfSet (WithTop α) :=
⟨fun S => if S ⊆ {⊤} ∨ ¬BddBelow S then ⊤ else ↑(sInf ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α))⟩
noncomputable instance WithBot.instSupSet [SupSet α] : SupSet (WithBot α) :=
⟨(WithTop.instInfSet (α := αᵒᵈ)).sInf⟩
noncomputable instance WithBot.instInfSet [InfSet α] :
InfSet (WithBot α) :=
⟨(WithTop.instSupSet (α := αᵒᵈ)).sSup⟩
theorem WithTop.sSup_eq [SupSet α] {s : Set (WithTop α)} (hs : ⊤ ∉ s)
(hs' : BddAbove ((↑) ⁻¹' s : Set α)) : sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
(if_neg hs).trans <| if_pos hs'
#align with_top.Sup_eq WithTop.sSup_eq
theorem WithTop.sInf_eq [InfSet α] {s : Set (WithTop α)} (hs : ¬s ⊆ {⊤}) (h's : BddBelow s) :
sInf s = ↑(sInf ((↑) ⁻¹' s) : α) :=
if_neg <| by simp [hs, h's]
#align with_top.Inf_eq WithTop.sInf_eq
theorem WithBot.sInf_eq [InfSet α] {s : Set (WithBot α)} (hs : ⊥ ∉ s)
(hs' : BddBelow ((↑) ⁻¹' s : Set α)) : sInf s = ↑(sInf ((↑) ⁻¹' s) : α) :=
(if_neg hs).trans <| if_pos hs'
#align with_bot.Inf_eq WithBot.sInf_eq
theorem WithBot.sSup_eq [SupSet α] {s : Set (WithBot α)} (hs : ¬s ⊆ {⊥}) (h's : BddAbove s) :
sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
WithTop.sInf_eq (α := αᵒᵈ) hs h's
#align with_bot.Sup_eq WithBot.sSup_eq
@[simp]
theorem WithTop.sInf_empty [InfSet α] : sInf (∅ : Set (WithTop α)) = ⊤ :=
if_pos <| by simp
#align with_top.cInf_empty WithTop.sInf_empty
@[simp]
theorem WithTop.iInf_empty [IsEmpty ι] [InfSet α] (f : ι → WithTop α) :
⨅ i, f i = ⊤ := by rw [iInf, range_eq_empty, WithTop.sInf_empty]
#align with_top.cinfi_empty WithTop.iInf_empty
| Mathlib/Order/ConditionallyCompleteLattice/Basic.lean | 95 | 104 | theorem WithTop.coe_sInf' [InfSet α] {s : Set α} (hs : s.Nonempty) (h's : BddBelow s) :
↑(sInf s) = (sInf ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by |
obtain ⟨x, hx⟩ := hs
change _ = ite _ _ _
split_ifs with h
· rcases h with h1 | h2
· cases h1 (mem_image_of_mem _ hx)
· exact (h2 (Monotone.map_bddBelow coe_mono h's)).elim
· rw [preimage_image_eq]
exact Option.some_injective _
| 0 |
import Mathlib.Order.Bounds.Basic
import Mathlib.Order.Hom.Set
#align_import order.bounds.order_iso from "leanprover-community/mathlib"@"a59dad53320b73ef180174aae867addd707ef00e"
set_option autoImplicit true
open Set
namespace OrderIso
variable [Preorder α] [Preorder β] (f : α ≃o β)
theorem upperBounds_image {s : Set α} : upperBounds (f '' s) = f '' upperBounds s :=
Subset.antisymm
(fun x hx =>
⟨f.symm x, fun _ hy => f.le_symm_apply.2 (hx <| mem_image_of_mem _ hy), f.apply_symm_apply x⟩)
f.monotone.image_upperBounds_subset_upperBounds_image
#align order_iso.upper_bounds_image OrderIso.upperBounds_image
theorem lowerBounds_image {s : Set α} : lowerBounds (f '' s) = f '' lowerBounds s :=
@upperBounds_image αᵒᵈ βᵒᵈ _ _ f.dual _
#align order_iso.lower_bounds_image OrderIso.lowerBounds_image
-- Porting note: by simps were `fun _ _ => f.le_iff_le` and `fun _ _ => f.symm.le_iff_le`
@[simp]
theorem isLUB_image {s : Set α} {x : β} : IsLUB (f '' s) x ↔ IsLUB s (f.symm x) :=
⟨fun h => IsLUB.of_image (by simp) ((f.apply_symm_apply x).symm ▸ h), fun h =>
(IsLUB.of_image (by simp)) <| (f.symm_image_image s).symm ▸ h⟩
#align order_iso.is_lub_image OrderIso.isLUB_image
theorem isLUB_image' {s : Set α} {x : α} : IsLUB (f '' s) (f x) ↔ IsLUB s x := by
rw [isLUB_image, f.symm_apply_apply]
#align order_iso.is_lub_image' OrderIso.isLUB_image'
@[simp]
theorem isGLB_image {s : Set α} {x : β} : IsGLB (f '' s) x ↔ IsGLB s (f.symm x) :=
f.dual.isLUB_image
#align order_iso.is_glb_image OrderIso.isGLB_image
theorem isGLB_image' {s : Set α} {x : α} : IsGLB (f '' s) (f x) ↔ IsGLB s x :=
f.dual.isLUB_image'
#align order_iso.is_glb_image' OrderIso.isGLB_image'
@[simp]
| Mathlib/Order/Bounds/OrderIso.lean | 55 | 56 | theorem isLUB_preimage {s : Set β} {x : α} : IsLUB (f ⁻¹' s) x ↔ IsLUB s (f x) := by |
rw [← f.symm_symm, ← image_eq_preimage, isLUB_image]
| 0 |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic
import Mathlib.NumberTheory.GaussSum
#align_import number_theory.legendre_symbol.quadratic_char.gauss_sum from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
section SpecialValues
open ZMod MulChar
variable {F : Type*} [Field F] [Fintype F]
theorem quadraticChar_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F 2 = χ₈ (Fintype.card F) :=
IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F) isQuadratic_χ₈ hF
((quadraticChar_eq_pow_of_char_ne_two' hF 2).trans (FiniteField.two_pow_card hF))
#align quadratic_char_two quadraticChar_two
theorem FiniteField.isSquare_two_iff :
IsSquare (2 : F) ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5 := by
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (Ring.two_ne_zero hF), quadraticChar_two hF,
χ₈_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
#align finite_field.is_square_two_iff FiniteField.isSquare_two_iff
theorem quadraticChar_neg_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F (-2) = χ₈' (Fintype.card F) := by
rw [(by norm_num : (-2 : F) = -1 * 2), map_mul, χ₈'_eq_χ₄_mul_χ₈, quadraticChar_neg_one hF,
quadraticChar_two hF, @cast_natCast _ (ZMod 4) _ _ _ (by decide : 4 ∣ 8)]
#align quadratic_char_neg_two quadraticChar_neg_two
theorem FiniteField.isSquare_neg_two_iff :
IsSquare (-2 : F) ↔ Fintype.card F % 8 ≠ 5 ∧ Fintype.card F % 8 ≠ 7 := by
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (neg_ne_zero.mpr (Ring.two_ne_zero hF)),
quadraticChar_neg_two hF, χ₈'_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
#align finite_field.is_square_neg_two_iff FiniteField.isSquare_neg_two_iff
theorem quadraticChar_card_card [DecidableEq F] (hF : ringChar F ≠ 2) {F' : Type*} [Field F']
[Fintype F'] [DecidableEq F'] (hF' : ringChar F' ≠ 2) (h : ringChar F' ≠ ringChar F) :
quadraticChar F (Fintype.card F') =
quadraticChar F' (quadraticChar F (-1) * Fintype.card F) := by
let χ := (quadraticChar F).ringHomComp (algebraMap ℤ F')
have hχ₁ : χ.IsNontrivial := by
obtain ⟨a, ha⟩ := quadraticChar_exists_neg_one hF
have hu : IsUnit a := by
contrapose ha
exact ne_of_eq_of_ne (map_nonunit (quadraticChar F) ha) (mt zero_eq_neg.mp one_ne_zero)
use hu.unit
simp only [χ, IsUnit.unit_spec, ringHomComp_apply, eq_intCast, Ne, ha]
rw [Int.cast_neg, Int.cast_one]
exact Ring.neg_one_ne_one_of_char_ne_two hF'
have hχ₂ : χ.IsQuadratic := IsQuadratic.comp (quadraticChar_isQuadratic F) _
have h := Char.card_pow_card hχ₁ hχ₂ h hF'
rw [← quadraticChar_eq_pow_of_char_ne_two' hF'] at h
exact (IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F')
(quadraticChar_isQuadratic F) hF' h).symm
#align quadratic_char_card_card quadraticChar_card_card
theorem quadraticChar_odd_prime [DecidableEq F] (hF : ringChar F ≠ 2) {p : ℕ} [Fact p.Prime]
(hp₁ : p ≠ 2) (hp₂ : ringChar F ≠ p) :
quadraticChar F p = quadraticChar (ZMod p) (χ₄ (Fintype.card F) * Fintype.card F) := by
rw [← quadraticChar_neg_one hF]
have h := quadraticChar_card_card hF (ne_of_eq_of_ne (ringChar_zmod_n p) hp₁)
(ne_of_eq_of_ne (ringChar_zmod_n p) hp₂.symm)
rwa [card p] at h
#align quadratic_char_odd_prime quadraticChar_odd_prime
| Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/GaussSum.lean | 130 | 143 | theorem FiniteField.isSquare_odd_prime_iff (hF : ringChar F ≠ 2) {p : ℕ} [Fact p.Prime]
(hp : p ≠ 2) :
IsSquare (p : F) ↔ quadraticChar (ZMod p) (χ₄ (Fintype.card F) * Fintype.card F) ≠ -1 := by |
classical
by_cases hFp : ringChar F = p
· rw [show (p : F) = 0 by rw [← hFp]; exact ringChar.Nat.cast_ringChar]
simp only [isSquare_zero, Ne, true_iff_iff, map_mul]
obtain ⟨n, _, hc⟩ := FiniteField.card F (ringChar F)
have hchar : ringChar F = ringChar (ZMod p) := by rw [hFp]; exact (ringChar_zmod_n p).symm
conv => enter [1, 1, 2]; rw [hc, Nat.cast_pow, map_pow, hchar, map_ringChar]
simp only [zero_pow n.ne_zero, mul_zero, zero_eq_neg, one_ne_zero, not_false_iff]
· rw [← Iff.not_left (@quadraticChar_neg_one_iff_not_isSquare F _ _ _ _),
quadraticChar_odd_prime hF hp]
exact hFp
| 0 |
import Mathlib.GroupTheory.Perm.Cycle.Basic
#align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open Equiv Function Finset
variable {ι α β : Type*}
namespace Equiv.Perm
section Generation
variable [Finite β]
open Subgroup
theorem closure_isCycle : closure { σ : Perm β | IsCycle σ } = ⊤ := by
classical
cases nonempty_fintype β
exact
top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle))
#align equiv.perm.closure_is_cycle Equiv.Perm.closure_isCycle
variable [DecidableEq α] [Fintype α]
theorem closure_cycle_adjacent_swap {σ : Perm α} (h1 : IsCycle σ) (h2 : σ.support = ⊤) (x : α) :
closure ({σ, swap x (σ x)} : Set (Perm α)) = ⊤ := by
let H := closure ({σ, swap x (σ x)} : Set (Perm α))
have h3 : σ ∈ H := subset_closure (Set.mem_insert σ _)
have h4 : swap x (σ x) ∈ H := subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _))
have step1 : ∀ n : ℕ, swap ((σ ^ n) x) ((σ ^ (n + 1) : Perm α) x) ∈ H := by
intro n
induction' n with n ih
· exact subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _))
· convert H.mul_mem (H.mul_mem h3 ih) (H.inv_mem h3)
simp_rw [mul_swap_eq_swap_mul, mul_inv_cancel_right, pow_succ']
rfl
have step2 : ∀ n : ℕ, swap x ((σ ^ n) x) ∈ H := by
intro n
induction' n with n ih
· simp only [Nat.zero_eq, pow_zero, coe_one, id_eq, swap_self, Set.mem_singleton_iff]
convert H.one_mem
· by_cases h5 : x = (σ ^ n) x
· rw [pow_succ', mul_apply, ← h5]
exact h4
by_cases h6 : x = (σ ^ (n + 1) : Perm α) x
· rw [← h6, swap_self]
exact H.one_mem
rw [swap_comm, ← swap_mul_swap_mul_swap h5 h6]
exact H.mul_mem (H.mul_mem (step1 n) ih) (step1 n)
have step3 : ∀ y : α, swap x y ∈ H := by
intro y
have hx : x ∈ (⊤ : Finset α) := Finset.mem_univ x
rw [← h2, mem_support] at hx
have hy : y ∈ (⊤ : Finset α) := Finset.mem_univ y
rw [← h2, mem_support] at hy
cases' IsCycle.exists_pow_eq h1 hx hy with n hn
rw [← hn]
exact step2 n
have step4 : ∀ y z : α, swap y z ∈ H := by
intro y z
by_cases h5 : z = x
· rw [h5, swap_comm]
exact step3 y
by_cases h6 : z = y
· rw [h6, swap_self]
exact H.one_mem
rw [← swap_mul_swap_mul_swap h5 h6, swap_comm z x]
exact H.mul_mem (H.mul_mem (step3 y) (step3 z)) (step3 y)
rw [eq_top_iff, ← closure_isSwap, closure_le]
rintro τ ⟨y, z, _, h6⟩
rw [h6]
exact step4 y z
#align equiv.perm.closure_cycle_adjacent_swap Equiv.Perm.closure_cycle_adjacent_swap
| Mathlib/GroupTheory/Perm/Closure.lean | 96 | 108 | theorem closure_cycle_coprime_swap {n : ℕ} {σ : Perm α} (h0 : Nat.Coprime n (Fintype.card α))
(h1 : IsCycle σ) (h2 : σ.support = Finset.univ) (x : α) :
closure ({σ, swap x ((σ ^ n) x)} : Set (Perm α)) = ⊤ := by |
rw [← Finset.card_univ, ← h2, ← h1.orderOf] at h0
cases' exists_pow_eq_self_of_coprime h0 with m hm
have h2' : (σ ^ n).support = ⊤ := Eq.trans (support_pow_coprime h0) h2
have h1' : IsCycle ((σ ^ n) ^ (m : ℤ)) := by rwa [← hm] at h1
replace h1' : IsCycle (σ ^ n) :=
h1'.of_pow (le_trans (support_pow_le σ n) (ge_of_eq (congr_arg support hm)))
rw [eq_top_iff, ← closure_cycle_adjacent_swap h1' h2' x, closure_le, Set.insert_subset_iff]
exact
⟨Subgroup.pow_mem (closure _) (subset_closure (Set.mem_insert σ _)) n,
Set.singleton_subset_iff.mpr (subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)))⟩
| 0 |
import Mathlib.Data.Set.Function
import Mathlib.Analysis.BoundedVariation
#align_import analysis.constant_speed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped NNReal ENNReal
open Set MeasureTheory Classical
variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E]
variable (f : ℝ → E) (s : Set ℝ) (l : ℝ≥0)
def HasConstantSpeedOnWith :=
∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (l * (y - x))
#align has_constant_speed_on_with HasConstantSpeedOnWith
variable {f s l}
theorem HasConstantSpeedOnWith.hasLocallyBoundedVariationOn (h : HasConstantSpeedOnWith f s l) :
LocallyBoundedVariationOn f s := fun x y hx hy => by
simp only [BoundedVariationOn, h hx hy, Ne, ENNReal.ofReal_ne_top, not_false_iff]
#align has_constant_speed_on_with.has_locally_bounded_variation_on HasConstantSpeedOnWith.hasLocallyBoundedVariationOn
theorem hasConstantSpeedOnWith_of_subsingleton (f : ℝ → E) {s : Set ℝ} (hs : s.Subsingleton)
(l : ℝ≥0) : HasConstantSpeedOnWith f s l := by
rintro x hx y hy; cases hs hx hy
rw [eVariationOn.subsingleton f (fun y hy z hz => hs hy.1 hz.1 : (s ∩ Icc x x).Subsingleton)]
simp only [sub_self, mul_zero, ENNReal.ofReal_zero]
#align has_constant_speed_on_with_of_subsingleton hasConstantSpeedOnWith_of_subsingleton
theorem hasConstantSpeedOnWith_iff_ordered :
HasConstantSpeedOnWith f s l ↔ ∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s),
x ≤ y → eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (l * (y - x)) := by
refine ⟨fun h x xs y ys _ => h xs ys, fun h x xs y ys => ?_⟩
rcases le_total x y with (xy | yx)
· exact h xs ys xy
· rw [eVariationOn.subsingleton, ENNReal.ofReal_of_nonpos]
· exact mul_nonpos_of_nonneg_of_nonpos l.prop (sub_nonpos_of_le yx)
· rintro z ⟨zs, xz, zy⟩ w ⟨ws, xw, wy⟩
cases le_antisymm (zy.trans yx) xz
cases le_antisymm (wy.trans yx) xw
rfl
#align has_constant_speed_on_with_iff_ordered hasConstantSpeedOnWith_iff_ordered
theorem hasConstantSpeedOnWith_iff_variationOnFromTo_eq :
HasConstantSpeedOnWith f s l ↔ LocallyBoundedVariationOn f s ∧
∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), variationOnFromTo f s x y = l * (y - x) := by
constructor
· rintro h; refine ⟨h.hasLocallyBoundedVariationOn, fun x xs y ys => ?_⟩
rw [hasConstantSpeedOnWith_iff_ordered] at h
rcases le_total x y with (xy | yx)
· rw [variationOnFromTo.eq_of_le f s xy, h xs ys xy]
exact ENNReal.toReal_ofReal (mul_nonneg l.prop (sub_nonneg.mpr xy))
· rw [variationOnFromTo.eq_of_ge f s yx, h ys xs yx]
have := ENNReal.toReal_ofReal (mul_nonneg l.prop (sub_nonneg.mpr yx))
simp_all only [NNReal.val_eq_coe]; ring
· rw [hasConstantSpeedOnWith_iff_ordered]
rintro h x xs y ys xy
rw [← h.2 xs ys, variationOnFromTo.eq_of_le f s xy, ENNReal.ofReal_toReal (h.1 x y xs ys)]
#align has_constant_speed_on_with_iff_variation_on_from_to_eq hasConstantSpeedOnWith_iff_variationOnFromTo_eq
| Mathlib/Analysis/ConstantSpeed.lean | 102 | 137 | theorem HasConstantSpeedOnWith.union {t : Set ℝ} (hfs : HasConstantSpeedOnWith f s l)
(hft : HasConstantSpeedOnWith f t l) {x : ℝ} (hs : IsGreatest s x) (ht : IsLeast t x) :
HasConstantSpeedOnWith f (s ∪ t) l := by |
rw [hasConstantSpeedOnWith_iff_ordered] at hfs hft ⊢
rintro z (zs | zt) y (ys | yt) zy
· have : (s ∪ t) ∩ Icc z y = s ∩ Icc z y := by
ext w; constructor
· rintro ⟨ws | wt, zw, wy⟩
· exact ⟨ws, zw, wy⟩
· exact ⟨(le_antisymm (wy.trans (hs.2 ys)) (ht.2 wt)).symm ▸ hs.1, zw, wy⟩
· rintro ⟨ws, zwy⟩; exact ⟨Or.inl ws, zwy⟩
rw [this, hfs zs ys zy]
· have : (s ∪ t) ∩ Icc z y = s ∩ Icc z x ∪ t ∩ Icc x y := by
ext w; constructor
· rintro ⟨ws | wt, zw, wy⟩
exacts [Or.inl ⟨ws, zw, hs.2 ws⟩, Or.inr ⟨wt, ht.2 wt, wy⟩]
· rintro (⟨ws, zw, wx⟩ | ⟨wt, xw, wy⟩)
exacts [⟨Or.inl ws, zw, wx.trans (ht.2 yt)⟩, ⟨Or.inr wt, (hs.2 zs).trans xw, wy⟩]
rw [this, @eVariationOn.union _ _ _ _ f _ _ x, hfs zs hs.1 (hs.2 zs), hft ht.1 yt (ht.2 yt)]
· have q := ENNReal.ofReal_add (mul_nonneg l.prop (sub_nonneg.mpr (hs.2 zs)))
(mul_nonneg l.prop (sub_nonneg.mpr (ht.2 yt)))
simp only [NNReal.val_eq_coe] at q
rw [← q]
ring_nf
exacts [⟨⟨hs.1, hs.2 zs, le_rfl⟩, fun w ⟨_, _, wx⟩ => wx⟩,
⟨⟨ht.1, le_rfl, ht.2 yt⟩, fun w ⟨_, xw, _⟩ => xw⟩]
· cases le_antisymm zy ((hs.2 ys).trans (ht.2 zt))
simp only [Icc_self, sub_self, mul_zero, ENNReal.ofReal_zero]
exact eVariationOn.subsingleton _ fun _ ⟨_, uz⟩ _ ⟨_, vz⟩ => uz.trans vz.symm
· have : (s ∪ t) ∩ Icc z y = t ∩ Icc z y := by
ext w; constructor
· rintro ⟨ws | wt, zw, wy⟩
· exact ⟨le_antisymm ((ht.2 zt).trans zw) (hs.2 ws) ▸ ht.1, zw, wy⟩
· exact ⟨wt, zw, wy⟩
· rintro ⟨wt, zwy⟩; exact ⟨Or.inr wt, zwy⟩
rw [this, hft zt yt zy]
| 0 |
import Mathlib.Analysis.LocallyConvex.WithSeminorms
import Mathlib.Topology.Semicontinuous
import Mathlib.Topology.Baire.Lemmas
open Filter Topology Set ContinuousLinearMap
section defs
class BarrelledSpace (𝕜 E : Type*) [SeminormedRing 𝕜] [AddGroup E] [SMul 𝕜 E]
[TopologicalSpace E] : Prop where
continuous_of_lowerSemicontinuous : ∀ p : Seminorm 𝕜 E, LowerSemicontinuous p → Continuous p
theorem Seminorm.continuous_of_lowerSemicontinuous {𝕜 E : Type*} [AddGroup E] [SMul 𝕜 E]
[SeminormedRing 𝕜] [TopologicalSpace E] [BarrelledSpace 𝕜 E] (p : Seminorm 𝕜 E)
(hp : LowerSemicontinuous p) : Continuous p :=
BarrelledSpace.continuous_of_lowerSemicontinuous p hp
| Mathlib/Analysis/LocallyConvex/Barrelled.lean | 93 | 103 | theorem Seminorm.continuous_iSup
{ι : Sort*} {𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [BarrelledSpace 𝕜 E] (p : ι → Seminorm 𝕜 E)
(hp : ∀ i, Continuous (p i)) (bdd : BddAbove (range p)) :
Continuous (⨆ i, p i) := by |
rw [← Seminorm.coe_iSup_eq bdd]
refine Seminorm.continuous_of_lowerSemicontinuous _ ?_
rw [Seminorm.coe_iSup_eq bdd]
rw [Seminorm.bddAbove_range_iff] at bdd
convert lowerSemicontinuous_ciSup (f := fun i x ↦ p i x) bdd (fun i ↦ (hp i).lowerSemicontinuous)
exact iSup_apply
| 0 |
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv
import Mathlib.Analysis.Calculus.FDeriv.Extend
import Mathlib.Analysis.Calculus.Deriv.Prod
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.pow.deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Real Topology NNReal ENNReal Filter
open Filter
namespace Real
variable {x y z : ℝ}
| Mathlib/Analysis/SpecialFunctions/Pow/Deriv.lean | 276 | 285 | theorem hasStrictFDerivAt_rpow_of_pos (p : ℝ × ℝ) (hp : 0 < p.1) :
HasStrictFDerivAt (fun x : ℝ × ℝ => x.1 ^ x.2)
((p.2 * p.1 ^ (p.2 - 1)) • ContinuousLinearMap.fst ℝ ℝ ℝ +
(p.1 ^ p.2 * log p.1) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by |
have : (fun x : ℝ × ℝ => x.1 ^ x.2) =ᶠ[𝓝 p] fun x => exp (log x.1 * x.2) :=
(continuousAt_fst.eventually (lt_mem_nhds hp)).mono fun p hp => rpow_def_of_pos hp _
refine HasStrictFDerivAt.congr_of_eventuallyEq ?_ this.symm
convert ((hasStrictFDerivAt_fst.log hp.ne').mul hasStrictFDerivAt_snd).exp using 1
rw [rpow_sub_one hp.ne', ← rpow_def_of_pos hp, smul_add, smul_smul, mul_div_left_comm,
div_eq_mul_inv, smul_smul, smul_smul, mul_assoc, add_comm]
| 0 |
import Mathlib.RingTheory.RootsOfUnity.Basic
universe u
variable {L : Type u} [CommRing L] [IsDomain L]
variable (n : ℕ+)
theorem rootsOfUnity.integer_power_of_ringEquiv (g : L ≃+* L) :
∃ m : ℤ, ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by
obtain ⟨m, hm⟩ := MonoidHom.map_cyclic ((g : L ≃* L).restrictRootsOfUnity n).toMonoidHom
exact ⟨m, fun t ↦ Units.ext_iff.1 <| SetCoe.ext_iff.2 <| hm t⟩
theorem rootsOfUnity.integer_power_of_ringEquiv' (g : L ≃+* L) :
∃ m : ℤ, ∀ t ∈ rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by
simpa using rootsOfUnity.integer_power_of_ringEquiv n g
noncomputable def ModularCyclotomicCharacter_aux (g : L ≃+* L) (n : ℕ+) : ℤ :=
(rootsOfUnity.integer_power_of_ringEquiv n g).choose
-- the only thing we know about `ModularCyclotomicCharacter_aux g n`
theorem ModularCyclotomicCharacter_aux_spec (g : L ≃+* L) (n : ℕ+) :
∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ (ModularCyclotomicCharacter_aux g n) : Lˣ) :=
(rootsOfUnity.integer_power_of_ringEquiv n g).choose_spec
noncomputable def ModularCyclotomicCharacter.toFun (n : ℕ+) (g : L ≃+* L) :
ZMod (Fintype.card (rootsOfUnity n L)) :=
ModularCyclotomicCharacter_aux g n
namespace ModularCyclotomicCharacter
local notation "χ₀" => ModularCyclotomicCharacter.toFun
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
theorem toFun_spec (g : L ≃+* L) {n : ℕ+} (t : rootsOfUnity n L) :
g (t : Lˣ) = (t ^ (χ₀ n g).val : Lˣ) := by
rw [ModularCyclotomicCharacter_aux_spec g n t, ← zpow_natCast, ModularCyclotomicCharacter.toFun,
ZMod.val_intCast, ← Subgroup.coe_zpow]
exact Units.ext_iff.1 <| SetCoe.ext_iff.2 <| zpow_eq_zpow_emod _ pow_card_eq_one
theorem toFun_spec' (g : L ≃+* L) {n : ℕ+} {t : Lˣ} (ht : t ∈ rootsOfUnity n L) :
g t = t ^ (χ₀ n g).val :=
toFun_spec g ⟨t, ht⟩
theorem toFun_spec'' (g : L ≃+* L) {n : ℕ+} {t : L} (ht : IsPrimitiveRoot t n) :
g t = t ^ (χ₀ n g).val :=
toFun_spec' g (SetLike.coe_mem ht.toRootsOfUnity)
| Mathlib/NumberTheory/Cyclotomic/CyclotomicCharacter.lean | 120 | 125 | theorem toFun_unique (g : L ≃+* L) (c : ZMod (Fintype.card (rootsOfUnity n L)))
(hc : ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ c.val : Lˣ)) : c = χ₀ n g := by |
apply IsCyclic.ext rfl (fun ζ ↦ ?_)
specialize hc ζ
suffices ((ζ ^ c.val : Lˣ) : L) = (ζ ^ (χ₀ n g).val : Lˣ) by exact_mod_cast this
rw [← toFun_spec g ζ, hc]
| 0 |
import Mathlib.MeasureTheory.Group.GeometryOfNumbers
import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls
import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional
local notation "E" K =>
({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ)
section convexBodySum
open ENNReal MeasureTheory Fintype
open scoped Real Classical NNReal
variable [NumberField K] (B : ℝ)
variable {K}
noncomputable abbrev convexBodySumFun (x : E K) : ℝ := ∑ w, mult w * normAtPlace w x
theorem convexBodySumFun_apply (x : E K) :
convexBodySumFun x = ∑ w, mult w * normAtPlace w x := rfl
theorem convexBodySumFun_apply' (x : E K) :
convexBodySumFun x = ∑ w, ‖x.1 w‖ + 2 * ∑ w, ‖x.2 w‖ := by
simp_rw [convexBodySumFun_apply, ← Finset.sum_add_sum_compl {w | IsReal w}.toFinset,
Set.toFinset_setOf, Finset.compl_filter, not_isReal_iff_isComplex, ← Finset.subtype_univ,
← Finset.univ.sum_subtype_eq_sum_filter, Finset.mul_sum]
congr
· ext w
rw [mult, if_pos w.prop, normAtPlace_apply_isReal, Nat.cast_one, one_mul]
· ext w
rw [mult, if_neg (not_isReal_iff_isComplex.mpr w.prop), normAtPlace_apply_isComplex,
Nat.cast_ofNat]
theorem convexBodySumFun_nonneg (x : E K) :
0 ≤ convexBodySumFun x :=
Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _))
theorem convexBodySumFun_neg (x : E K) :
convexBodySumFun (- x) = convexBodySumFun x := by
simp_rw [convexBodySumFun, normAtPlace_neg]
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean | 306 | 310 | theorem convexBodySumFun_add_le (x y : E K) :
convexBodySumFun (x + y) ≤ convexBodySumFun x + convexBodySumFun y := by |
simp_rw [convexBodySumFun, ← Finset.sum_add_distrib, ← mul_add]
exact Finset.sum_le_sum
fun _ _ ↦ mul_le_mul_of_nonneg_left (normAtPlace_add_le _ x y) (Nat.cast_pos.mpr mult_pos).le
| 0 |
import Mathlib.Order.Filter.Bases
import Mathlib.Order.ConditionallyCompleteLattice.Basic
#align_import order.filter.lift from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
open Set Classical Filter Function
namespace Filter
variable {α β γ : Type*} {ι : Sort*}
section lift
protected def lift (f : Filter α) (g : Set α → Filter β) :=
⨅ s ∈ f, g s
#align filter.lift Filter.lift
variable {f f₁ f₂ : Filter α} {g g₁ g₂ : Set α → Filter β}
@[simp]
theorem lift_top (g : Set α → Filter β) : (⊤ : Filter α).lift g = g univ := by simp [Filter.lift]
#align filter.lift_top Filter.lift_top
-- Porting note: use `∃ i, p i ∧ _` instead of `∃ i (hi : p i), _`
| Mathlib/Order/Filter/Lift.lean | 45 | 53 | theorem HasBasis.mem_lift_iff {ι} {p : ι → Prop} {s : ι → Set α} {f : Filter α}
(hf : f.HasBasis p s) {β : ι → Type*} {pg : ∀ i, β i → Prop} {sg : ∀ i, β i → Set γ}
{g : Set α → Filter γ} (hg : ∀ i, (g <| s i).HasBasis (pg i) (sg i)) (gm : Monotone g)
{s : Set γ} : s ∈ f.lift g ↔ ∃ i, p i ∧ ∃ x, pg i x ∧ sg i x ⊆ s := by |
refine (mem_biInf_of_directed ?_ ⟨univ, univ_sets _⟩).trans ?_
· intro t₁ ht₁ t₂ ht₂
exact ⟨t₁ ∩ t₂, inter_mem ht₁ ht₂, gm inter_subset_left, gm inter_subset_right⟩
· simp only [← (hg _).mem_iff]
exact hf.exists_iff fun t₁ t₂ ht H => gm ht H
| 0 |
import Mathlib.Algebra.Group.Subgroup.MulOpposite
import Mathlib.Algebra.Group.Submonoid.Pointwise
import Mathlib.GroupTheory.GroupAction.ConjAct
#align_import group_theory.subgroup.pointwise from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
open Set
open Pointwise
variable {α G A S : Type*}
@[to_additive (attr := simp, norm_cast)]
theorem inv_coe_set [InvolutiveInv G] [SetLike S G] [InvMemClass S G] {H : S} : (H : Set G)⁻¹ = H :=
Set.ext fun _ => inv_mem_iff
#align inv_coe_set inv_coe_set
#align neg_coe_set neg_coe_set
@[to_additive (attr := simp)]
lemma smul_coe_set [Group G] [SetLike S G] [SubgroupClass S G] {s : S} {a : G} (ha : a ∈ s) :
a • (s : Set G) = s := by
ext; simp [Set.mem_smul_set_iff_inv_smul_mem, mul_mem_cancel_left, ha]
@[to_additive (attr := simp)]
lemma op_smul_coe_set [Group G] [SetLike S G] [SubgroupClass S G] {s : S} {a : G} (ha : a ∈ s) :
MulOpposite.op a • (s : Set G) = s := by
ext; simp [Set.mem_smul_set_iff_inv_smul_mem, mul_mem_cancel_right, ha]
@[to_additive (attr := simp, norm_cast)]
lemma coe_mul_coe [SetLike S G] [DivInvMonoid G] [SubgroupClass S G] (H : S) :
H * H = (H : Set G) := by aesop (add simp mem_mul)
@[to_additive (attr := simp, norm_cast)]
lemma coe_div_coe [SetLike S G] [DivisionMonoid G] [SubgroupClass S G] (H : S) :
H / H = (H : Set G) := by simp [div_eq_mul_inv]
variable [Group G] [AddGroup A] {s : Set G}
namespace Subgroup
@[to_additive (attr := simp)]
theorem inv_subset_closure (S : Set G) : S⁻¹ ⊆ closure S := fun s hs => by
rw [SetLike.mem_coe, ← Subgroup.inv_mem_iff]
exact subset_closure (mem_inv.mp hs)
#align subgroup.inv_subset_closure Subgroup.inv_subset_closure
#align add_subgroup.neg_subset_closure AddSubgroup.neg_subset_closure
@[to_additive]
theorem closure_toSubmonoid (S : Set G) :
(closure S).toSubmonoid = Submonoid.closure (S ∪ S⁻¹) := by
refine le_antisymm (fun x hx => ?_) (Submonoid.closure_le.2 ?_)
· refine
closure_induction hx
(fun x hx => Submonoid.closure_mono subset_union_left (Submonoid.subset_closure hx))
(Submonoid.one_mem _) (fun x y hx hy => Submonoid.mul_mem _ hx hy) fun x hx => ?_
rwa [← Submonoid.mem_closure_inv, Set.union_inv, inv_inv, Set.union_comm]
· simp only [true_and_iff, coe_toSubmonoid, union_subset_iff, subset_closure, inv_subset_closure]
#align subgroup.closure_to_submonoid Subgroup.closure_toSubmonoid
#align add_subgroup.closure_to_add_submonoid AddSubgroup.closure_toAddSubmonoid
@[to_additive (attr := elab_as_elim)
"For additive subgroups generated by a single element, see the simpler
`zsmul_induction_left`."]
| Mathlib/Algebra/Group/Subgroup/Pointwise.lean | 89 | 102 | theorem closure_induction_left {p : (x : G) → x ∈ closure s → Prop} (one : p 1 (one_mem _))
(mul_left : ∀ x (hx : x ∈ s), ∀ (y) hy, p y hy → p (x * y) (mul_mem (subset_closure hx) hy))
(mul_left_inv : ∀ x (hx : x ∈ s), ∀ (y) hy, p y hy →
p (x⁻¹ * y) (mul_mem (inv_mem (subset_closure hx)) hy))
{x : G} (h : x ∈ closure s) : p x h := by |
revert h
simp_rw [← mem_toSubmonoid, closure_toSubmonoid] at *
intro h
induction h using Submonoid.closure_induction_left with
| one => exact one
| mul_left x hx y hy ih =>
cases hx with
| inl hx => exact mul_left _ hx _ hy ih
| inr hx => simpa only [inv_inv] using mul_left_inv _ hx _ hy ih
| 0 |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn
#align_import analysis.calculus.inverse from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Function Set Filter Metric
open scoped Topology Classical NNReal
noncomputable section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
variable {ε : ℝ}
open Asymptotics Filter Metric Set
open ContinuousLinearMap (id)
namespace HasStrictFDerivAt
| Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean | 74 | 83 | theorem approximates_deriv_on_nhds {f : E → F} {f' : E →L[𝕜] F} {a : E}
(hf : HasStrictFDerivAt f f' a) {c : ℝ≥0} (hc : Subsingleton E ∨ 0 < c) :
∃ s ∈ 𝓝 a, ApproximatesLinearOn f f' s c := by |
cases' hc with hE hc
· refine ⟨univ, IsOpen.mem_nhds isOpen_univ trivial, fun x _ y _ => ?_⟩
simp [@Subsingleton.elim E hE x y]
have := hf.def hc
rw [nhds_prod_eq, Filter.Eventually, mem_prod_same_iff] at this
rcases this with ⟨s, has, hs⟩
exact ⟨s, has, fun x hx y hy => hs (mk_mem_prod hx hy)⟩
| 0 |
import Mathlib.AlgebraicGeometry.Morphisms.Basic
import Mathlib.Topology.LocalAtTarget
#align_import algebraic_geometry.morphisms.universally_closed from "leanprover-community/mathlib"@"a8ae1b3f7979249a0af6bc7cf20c1f6bf656ca73"
noncomputable section
open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace
universe v u
namespace AlgebraicGeometry
variable {X Y : Scheme.{u}} (f : X ⟶ Y)
open CategoryTheory.MorphismProperty
open AlgebraicGeometry.MorphismProperty (topologically)
@[mk_iff]
class UniversallyClosed (f : X ⟶ Y) : Prop where
out : universally (topologically @IsClosedMap) f
#align algebraic_geometry.universally_closed AlgebraicGeometry.UniversallyClosed
theorem universallyClosed_eq : @UniversallyClosed = universally (topologically @IsClosedMap) := by
ext X Y f; rw [universallyClosed_iff]
#align algebraic_geometry.universally_closed_eq AlgebraicGeometry.universallyClosed_eq
theorem universallyClosed_respectsIso : RespectsIso @UniversallyClosed :=
universallyClosed_eq.symm ▸ universally_respectsIso (topologically @IsClosedMap)
#align algebraic_geometry.universally_closed_respects_iso AlgebraicGeometry.universallyClosed_respectsIso
theorem universallyClosed_stableUnderBaseChange : StableUnderBaseChange @UniversallyClosed :=
universallyClosed_eq.symm ▸ universally_stableUnderBaseChange (topologically @IsClosedMap)
#align algebraic_geometry.universally_closed_stable_under_base_change AlgebraicGeometry.universallyClosed_stableUnderBaseChange
instance isClosedMap_isStableUnderComposition :
IsStableUnderComposition (topologically @IsClosedMap) where
comp_mem f g hf hg := IsClosedMap.comp (f := f.1.base) (g := g.1.base) hg hf
instance universallyClosed_isStableUnderComposition :
IsStableUnderComposition @UniversallyClosed := by
rw [universallyClosed_eq]
infer_instance
#align algebraic_geometry.universally_closed_stable_under_composition AlgebraicGeometry.universallyClosed_isStableUnderComposition
instance universallyClosedTypeComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z)
[hf : UniversallyClosed f] [hg : UniversallyClosed g] : UniversallyClosed (f ≫ g) :=
comp_mem _ _ _ hf hg
#align algebraic_geometry.universally_closed_type_comp AlgebraicGeometry.universallyClosedTypeComp
theorem topologically_isClosedMap_respectsIso : RespectsIso (topologically @IsClosedMap) := by
apply MorphismProperty.respectsIso_of_isStableUnderComposition
intro _ _ f hf
have : IsIso f := hf
exact (TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (asIso f))).isClosedMap
instance universallyClosedFst {X Y Z : Scheme} (f : X ⟶ Z) (g : Y ⟶ Z) [hg : UniversallyClosed g] :
UniversallyClosed (pullback.fst : pullback f g ⟶ _) :=
universallyClosed_stableUnderBaseChange.fst f g hg
#align algebraic_geometry.universally_closed_fst AlgebraicGeometry.universallyClosedFst
instance universallyClosedSnd {X Y Z : Scheme} (f : X ⟶ Z) (g : Y ⟶ Z) [hf : UniversallyClosed f] :
UniversallyClosed (pullback.snd : pullback f g ⟶ _) :=
universallyClosed_stableUnderBaseChange.snd f g hf
#align algebraic_geometry.universally_closed_snd AlgebraicGeometry.universallyClosedSnd
| Mathlib/AlgebraicGeometry/Morphisms/UniversallyClosed.lean | 88 | 94 | theorem universallyClosed_is_local_at_target : PropertyIsLocalAtTarget @UniversallyClosed := by |
rw [universallyClosed_eq]
apply universallyIsLocalAtTargetOfMorphismRestrict
· exact topologically_isClosedMap_respectsIso
· intro X Y f ι U hU H
simp_rw [topologically, morphismRestrict_base] at H
exact (isClosedMap_iff_isClosedMap_of_iSup_eq_top hU).mpr H
| 0 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.NormedSpace.FiniteDimension
#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
universe uD uE uF uG
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {D : Type uD} [NormedAddCommGroup D]
[NormedSpace 𝕜 D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type uF}
[NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
section FiniteDimensional
open Function FiniteDimensional
variable [CompleteSpace 𝕜]
| Mathlib/Analysis/Calculus/ContDiff/FiniteDimension.lean | 35 | 43 | theorem contDiffOn_clm_apply {n : ℕ∞} {f : E → F →L[𝕜] G} {s : Set E} [FiniteDimensional 𝕜 F] :
ContDiffOn 𝕜 n f s ↔ ∀ y, ContDiffOn 𝕜 n (fun x => f x y) s := by |
refine ⟨fun h y => h.clm_apply contDiffOn_const, fun h => ?_⟩
let d := finrank 𝕜 F
have hd : d = finrank 𝕜 (Fin d → 𝕜) := (finrank_fin_fun 𝕜).symm
let e₁ := ContinuousLinearEquiv.ofFinrankEq hd
let e₂ := (e₁.arrowCongr (1 : G ≃L[𝕜] G)).trans (ContinuousLinearEquiv.piRing (Fin d))
rw [← id_comp f, ← e₂.symm_comp_self]
exact e₂.symm.contDiff.comp_contDiffOn (contDiffOn_pi.mpr fun i => h _)
| 0 |
import Mathlib.Algebra.Ring.Regular
import Mathlib.Data.Int.GCD
import Mathlib.Data.Int.Order.Lemmas
import Mathlib.Tactic.NormNum.Basic
#align_import data.nat.modeq from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47"
assert_not_exists Function.support
namespace Nat
def ModEq (n a b : ℕ) :=
a % n = b % n
#align nat.modeq Nat.ModEq
@[inherit_doc]
notation:50 a " ≡ " b " [MOD " n "]" => ModEq n a b
variable {m n a b c d : ℕ}
-- Porting note: This instance should be derivable automatically
instance : Decidable (ModEq n a b) := decEq (a % n) (b % n)
theorem modEq_zero_iff_dvd : a ≡ 0 [MOD n] ↔ n ∣ a := by rw [ModEq, zero_mod, dvd_iff_mod_eq_zero]
#align nat.modeq_zero_iff_dvd Nat.modEq_zero_iff_dvd
theorem _root_.Dvd.dvd.modEq_zero_nat (h : n ∣ a) : a ≡ 0 [MOD n] :=
modEq_zero_iff_dvd.2 h
#align has_dvd.dvd.modeq_zero_nat Dvd.dvd.modEq_zero_nat
theorem _root_.Dvd.dvd.zero_modEq_nat (h : n ∣ a) : 0 ≡ a [MOD n] :=
h.modEq_zero_nat.symm
#align has_dvd.dvd.zero_modeq_nat Dvd.dvd.zero_modEq_nat
| Mathlib/Data/Nat/ModEq.lean | 89 | 91 | theorem modEq_iff_dvd : a ≡ b [MOD n] ↔ (n : ℤ) ∣ b - a := by |
rw [ModEq, eq_comm, ← Int.natCast_inj, Int.natCast_mod, Int.natCast_mod,
Int.emod_eq_emod_iff_emod_sub_eq_zero, Int.dvd_iff_emod_eq_zero]
| 0 |
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Data.Set.Lattice
#align_import group_theory.archimedean from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6"
open Set
variable {G : Type*} [LinearOrderedAddCommGroup G] [Archimedean G]
theorem AddSubgroup.cyclic_of_min {H : AddSubgroup G} {a : G}
(ha : IsLeast { g : G | g ∈ H ∧ 0 < g } a) : H = AddSubgroup.closure {a} := by
obtain ⟨⟨a_in, a_pos⟩, a_min⟩ := ha
refine le_antisymm ?_ (H.closure_le.mpr <| by simp [a_in])
intro g g_in
obtain ⟨k, ⟨nonneg, lt⟩, _⟩ := existsUnique_zsmul_near_of_pos' a_pos g
have h_zero : g - k • a = 0 := by
by_contra h
have h : a ≤ g - k • a := by
refine a_min ⟨?_, ?_⟩
· exact AddSubgroup.sub_mem H g_in (AddSubgroup.zsmul_mem H a_in k)
· exact lt_of_le_of_ne nonneg (Ne.symm h)
have h' : ¬a ≤ g - k • a := not_le.mpr lt
contradiction
simp [sub_eq_zero.mp h_zero, AddSubgroup.mem_closure_singleton]
#align add_subgroup.cyclic_of_min AddSubgroup.cyclic_of_min
theorem AddSubgroup.exists_isLeast_pos {H : AddSubgroup G} (hbot : H ≠ ⊥) {a : G} (h₀ : 0 < a)
(hd : Disjoint (H : Set G) (Ioo 0 a)) : ∃ b, IsLeast { g : G | g ∈ H ∧ 0 < g } b := by
-- todo: move to a lemma?
have hex : ∀ g > 0, ∃ n : ℕ, g ∈ Ioc (n • a) ((n + 1) • a) := fun g hg => by
rcases existsUnique_add_zsmul_mem_Ico h₀ 0 (g - a) with ⟨m, ⟨hm, hm'⟩, -⟩
simp only [zero_add, sub_le_iff_le_add, sub_add_cancel, ← add_one_zsmul] at hm hm'
lift m to ℕ
· rw [← Int.lt_add_one_iff, ← zsmul_lt_zsmul_iff h₀, zero_zsmul]
exact hg.trans_le hm
· simp only [← Nat.cast_succ, natCast_zsmul] at hm hm'
exact ⟨m, hm', hm⟩
have : ∃ n : ℕ, Set.Nonempty (H ∩ Ioc (n • a) ((n + 1) • a)) := by
rcases (bot_or_exists_ne_zero H).resolve_left hbot with ⟨g, hgH, hg₀⟩
rcases hex |g| (abs_pos.2 hg₀) with ⟨n, hn⟩
exact ⟨n, _, (@abs_mem_iff (AddSubgroup G) G _ _).2 hgH, hn⟩
classical rcases Nat.findX this with ⟨n, ⟨x, hxH, hnx, hxn⟩, hmin⟩
by_contra hxmin
simp only [IsLeast, not_and, mem_setOf_eq, mem_lowerBounds, not_exists, not_forall,
not_le] at hxmin
rcases hxmin x ⟨hxH, (nsmul_nonneg h₀.le _).trans_lt hnx⟩ with ⟨y, ⟨hyH, hy₀⟩, hxy⟩
rcases hex y hy₀ with ⟨m, hm⟩
cases' lt_or_le m n with hmn hnm
· exact hmin m hmn ⟨y, hyH, hm⟩
· refine disjoint_left.1 hd (sub_mem hxH hyH) ⟨sub_pos.2 hxy, sub_lt_iff_lt_add'.2 ?_⟩
calc x ≤ (n + 1) • a := hxn
_ ≤ (m + 1) • a := nsmul_le_nsmul_left h₀.le (add_le_add_right hnm _)
_ = m • a + a := succ_nsmul _ _
_ < y + a := add_lt_add_right hm.1 _
| Mathlib/GroupTheory/Archimedean.lean | 91 | 95 | theorem AddSubgroup.cyclic_of_isolated_zero {H : AddSubgroup G} {a : G} (h₀ : 0 < a)
(hd : Disjoint (H : Set G) (Ioo 0 a)) : ∃ b, H = closure {b} := by |
rcases eq_or_ne H ⊥ with rfl | hbot
· exact ⟨0, closure_singleton_zero.symm⟩
· exact (exists_isLeast_pos hbot h₀ hd).imp fun _ => cyclic_of_min
| 0 |
import Mathlib.Algebra.MonoidAlgebra.Basic
import Mathlib.Data.Finset.Pointwise
#align_import algebra.monoid_algebra.support from "leanprover-community/mathlib"@"16749fc4661828cba18cd0f4e3c5eb66a8e80598"
open scoped Pointwise
universe u₁ u₂ u₃
namespace MonoidAlgebra
open Finset Finsupp
variable {k : Type u₁} {G : Type u₂} [Semiring k]
theorem support_mul [Mul G] [DecidableEq G] (a b : MonoidAlgebra k G) :
(a * b).support ⊆ a.support * b.support := by
rw [MonoidAlgebra.mul_def]
exact support_sum.trans <| biUnion_subset.2 fun _x hx ↦
support_sum.trans <| biUnion_subset.2 fun _y hy ↦
support_single_subset.trans <| singleton_subset_iff.2 <| mem_image₂_of_mem hx hy
#align monoid_algebra.support_mul MonoidAlgebra.support_mul
theorem support_single_mul_subset [DecidableEq G] [Mul G] (f : MonoidAlgebra k G) (r : k) (a : G) :
(single a r * f : MonoidAlgebra k G).support ⊆ Finset.image (a * ·) f.support :=
(support_mul _ _).trans <| (Finset.image₂_subset_right support_single_subset).trans <| by
rw [Finset.image₂_singleton_left]
#align monoid_algebra.support_single_mul_subset MonoidAlgebra.support_single_mul_subset
theorem support_mul_single_subset [DecidableEq G] [Mul G] (f : MonoidAlgebra k G) (r : k) (a : G) :
(f * single a r).support ⊆ Finset.image (· * a) f.support :=
(support_mul _ _).trans <| (Finset.image₂_subset_left support_single_subset).trans <| by
rw [Finset.image₂_singleton_right]
#align monoid_algebra.support_mul_single_subset MonoidAlgebra.support_mul_single_subset
theorem support_single_mul_eq_image [DecidableEq G] [Mul G] (f : MonoidAlgebra k G) {r : k}
(hr : ∀ y, r * y = 0 ↔ y = 0) {x : G} (lx : IsLeftRegular x) :
(single x r * f : MonoidAlgebra k G).support = Finset.image (x * ·) f.support := by
refine subset_antisymm (support_single_mul_subset f _ _) fun y hy => ?_
obtain ⟨y, yf, rfl⟩ : ∃ a : G, a ∈ f.support ∧ x * a = y := by
simpa only [Finset.mem_image, exists_prop] using hy
simp only [mul_apply, mem_support_iff.mp yf, hr, mem_support_iff, sum_single_index,
Finsupp.sum_ite_eq', Ne, not_false_iff, if_true, zero_mul, ite_self, sum_zero, lx.eq_iff]
#align monoid_algebra.support_single_mul_eq_image MonoidAlgebra.support_single_mul_eq_image
theorem support_mul_single_eq_image [DecidableEq G] [Mul G] (f : MonoidAlgebra k G) {r : k}
(hr : ∀ y, y * r = 0 ↔ y = 0) {x : G} (rx : IsRightRegular x) :
(f * single x r).support = Finset.image (· * x) f.support := by
refine subset_antisymm (support_mul_single_subset f _ _) fun y hy => ?_
obtain ⟨y, yf, rfl⟩ : ∃ a : G, a ∈ f.support ∧ a * x = y := by
simpa only [Finset.mem_image, exists_prop] using hy
simp only [mul_apply, mem_support_iff.mp yf, hr, mem_support_iff, sum_single_index,
Finsupp.sum_ite_eq', Ne, not_false_iff, if_true, mul_zero, ite_self, sum_zero, rx.eq_iff]
#align monoid_algebra.support_mul_single_eq_image MonoidAlgebra.support_mul_single_eq_image
theorem support_mul_single [Mul G] [IsRightCancelMul G] (f : MonoidAlgebra k G) (r : k)
(hr : ∀ y, y * r = 0 ↔ y = 0) (x : G) :
(f * single x r).support = f.support.map (mulRightEmbedding x) := by
classical
ext
simp only [support_mul_single_eq_image f hr (IsRightRegular.all x),
mem_image, mem_map, mulRightEmbedding_apply]
#align monoid_algebra.support_mul_single MonoidAlgebra.support_mul_single
theorem support_single_mul [Mul G] [IsLeftCancelMul G] (f : MonoidAlgebra k G) (r : k)
(hr : ∀ y, r * y = 0 ↔ y = 0) (x : G) :
(single x r * f : MonoidAlgebra k G).support = f.support.map (mulLeftEmbedding x) := by
classical
ext
simp only [support_single_mul_eq_image f hr (IsLeftRegular.all x), mem_image,
mem_map, mulLeftEmbedding_apply]
#align monoid_algebra.support_single_mul MonoidAlgebra.support_single_mul
lemma support_one_subset [One G] : (1 : MonoidAlgebra k G).support ⊆ 1 :=
Finsupp.support_single_subset
@[simp]
lemma support_one [One G] [NeZero (1 : k)] : (1 : MonoidAlgebra k G).support = 1 :=
Finsupp.support_single_ne_zero _ one_ne_zero
section Span
variable [MulOneClass G]
| Mathlib/Algebra/MonoidAlgebra/Support.lean | 95 | 97 | theorem mem_span_support (f : MonoidAlgebra k G) :
f ∈ Submodule.span k (of k G '' (f.support : Set G)) := by |
erw [of, MonoidHom.coe_mk, ← supported_eq_span_single, Finsupp.mem_supported]
| 0 |
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic
import Mathlib.MeasureTheory.Integral.MeanInequalities
#align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
open Filter
open scoped ENNReal Topology
namespace MeasureTheory
section Bilinear
variable {α E F G : Type*} {m : MeasurableSpace α}
[NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] {μ : Measure α}
{f : α → E} {g : α → F}
| Mathlib/MeasureTheory/Function/LpSeminorm/CompareExp.lean | 158 | 196 | theorem snorm_le_snorm_top_mul_snorm (p : ℝ≥0∞) (f : α → E) {g : α → F}
(hg : AEStronglyMeasurable g μ) (b : E → F → G)
(h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) :
snorm (fun x => b (f x) (g x)) p μ ≤ snorm f ∞ μ * snorm g p μ := by |
by_cases hp_top : p = ∞
· simp_rw [hp_top, snorm_exponent_top]
refine le_trans (essSup_mono_ae <| h.mono fun a ha => ?_) (ENNReal.essSup_mul_le _ _)
simp_rw [Pi.mul_apply, ← ENNReal.coe_mul, ENNReal.coe_le_coe]
exact ha
by_cases hp_zero : p = 0
· simp only [hp_zero, snorm_exponent_zero, mul_zero, le_zero_iff]
simp_rw [snorm_eq_lintegral_rpow_nnnorm hp_zero hp_top, snorm_exponent_top, snormEssSup]
calc
(∫⁻ x, (‖b (f x) (g x)‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) ≤
(∫⁻ x, (‖f x‖₊ : ℝ≥0∞) ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by
gcongr ?_ ^ _
refine lintegral_mono_ae (h.mono fun a ha => ?_)
rw [← ENNReal.mul_rpow_of_nonneg _ _ ENNReal.toReal_nonneg]
refine ENNReal.rpow_le_rpow ?_ ENNReal.toReal_nonneg
rw [← ENNReal.coe_mul, ENNReal.coe_le_coe]
exact ha
_ ≤
(∫⁻ x, essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^
(1 / p.toReal) := by
gcongr ?_ ^ _
refine lintegral_mono_ae ?_
filter_upwards [@ENNReal.ae_le_essSup _ _ μ fun x => (‖f x‖₊ : ℝ≥0∞)] with x hx
gcongr
_ = essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ *
(∫⁻ x, (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by
rw [lintegral_const_mul'']
swap; · exact hg.nnnorm.aemeasurable.coe_nnreal_ennreal.pow aemeasurable_const
rw [ENNReal.mul_rpow_of_nonneg]
swap;
· rw [one_div_nonneg]
exact ENNReal.toReal_nonneg
rw [← ENNReal.rpow_mul, one_div, mul_inv_cancel, ENNReal.rpow_one]
rw [Ne, ENNReal.toReal_eq_zero_iff, not_or]
exact ⟨hp_zero, hp_top⟩
| 0 |
import Mathlib.Probability.Martingale.BorelCantelli
import Mathlib.Probability.ConditionalExpectation
import Mathlib.Probability.Independence.Basic
#align_import probability.borel_cantelli from "leanprover-community/mathlib"@"2f8347015b12b0864dfaf366ec4909eb70c78740"
open scoped MeasureTheory ProbabilityTheory ENNReal Topology
open MeasureTheory ProbabilityTheory MeasurableSpace TopologicalSpace
namespace ProbabilityTheory
variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ]
section BorelCantelli
variable {ι β : Type*} [LinearOrder ι] [mβ : MeasurableSpace β] [NormedAddCommGroup β]
[BorelSpace β] {f : ι → Ω → β} {i j : ι} {s : ι → Set Ω}
theorem iIndepFun.indep_comap_natural_of_lt (hf : ∀ i, StronglyMeasurable (f i))
(hfi : iIndepFun (fun _ => mβ) f μ) (hij : i < j) :
Indep (MeasurableSpace.comap (f j) mβ) (Filtration.natural f hf i) μ := by
suffices Indep (⨆ k ∈ ({j} : Set ι), MeasurableSpace.comap (f k) mβ)
(⨆ k ∈ {k | k ≤ i}, MeasurableSpace.comap (f k) mβ) μ by rwa [iSup_singleton] at this
exact indep_iSup_of_disjoint (fun k => (hf k).measurable.comap_le) hfi (by simpa)
set_option linter.uppercaseLean3 false in
#align probability_theory.Indep_fun.indep_comap_natural_of_lt ProbabilityTheory.iIndepFun.indep_comap_natural_of_lt
theorem iIndepFun.condexp_natural_ae_eq_of_lt [SecondCountableTopology β] [CompleteSpace β]
[NormedSpace ℝ β] (hf : ∀ i, StronglyMeasurable (f i)) (hfi : iIndepFun (fun _ => mβ) f μ)
(hij : i < j) : μ[f j|Filtration.natural f hf i] =ᵐ[μ] fun _ => μ[f j] :=
condexp_indep_eq (hf j).measurable.comap_le (Filtration.le _ _)
(comap_measurable <| f j).stronglyMeasurable (hfi.indep_comap_natural_of_lt hf hij)
set_option linter.uppercaseLean3 false in
#align probability_theory.Indep_fun.condexp_natural_ae_eq_of_lt ProbabilityTheory.iIndepFun.condexp_natural_ae_eq_of_lt
| Mathlib/Probability/BorelCantelli.lean | 60 | 66 | theorem iIndepSet.condexp_indicator_filtrationOfSet_ae_eq (hsm : ∀ n, MeasurableSet (s n))
(hs : iIndepSet s μ) (hij : i < j) :
μ[(s j).indicator (fun _ => 1 : Ω → ℝ)|filtrationOfSet hsm i] =ᵐ[μ]
fun _ => (μ (s j)).toReal := by |
rw [Filtration.filtrationOfSet_eq_natural (β := ℝ) hsm]
refine (iIndepFun.condexp_natural_ae_eq_of_lt _ hs.iIndepFun_indicator hij).trans ?_
simp only [integral_indicator_const _ (hsm _), Algebra.id.smul_eq_mul, mul_one]; rfl
| 0 |
import Mathlib.AlgebraicGeometry.GammaSpecAdjunction
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Limits.Opposites
import Mathlib.RingTheory.Localization.InvSubmonoid
#align_import algebraic_geometry.AffineScheme from "leanprover-community/mathlib"@"88474d1b5af6d37c2ab728b757771bced7f5194c"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace
universe u
namespace AlgebraicGeometry
open Spec (structureSheaf)
-- Porting note(#5171): linter not ported yet
-- @[nolint has_nonempty_instance]
def AffineScheme :=
Scheme.Spec.EssImageSubcategory
deriving Category
#align algebraic_geometry.AffineScheme AlgebraicGeometry.AffineScheme
class IsAffine (X : Scheme) : Prop where
affine : IsIso (ΓSpec.adjunction.unit.app X)
#align algebraic_geometry.is_affine AlgebraicGeometry.IsAffine
attribute [instance] IsAffine.affine
def Scheme.isoSpec (X : Scheme) [IsAffine X] : X ≅ Scheme.Spec.obj (op <| Scheme.Γ.obj <| op X) :=
asIso (ΓSpec.adjunction.unit.app X)
#align algebraic_geometry.Scheme.iso_Spec AlgebraicGeometry.Scheme.isoSpec
@[simps]
def AffineScheme.mk (X : Scheme) (_ : IsAffine X) : AffineScheme :=
⟨X, mem_essImage_of_unit_isIso (adj := ΓSpec.adjunction) _⟩
#align algebraic_geometry.AffineScheme.mk AlgebraicGeometry.AffineScheme.mk
def AffineScheme.of (X : Scheme) [h : IsAffine X] : AffineScheme :=
AffineScheme.mk X h
#align algebraic_geometry.AffineScheme.of AlgebraicGeometry.AffineScheme.of
def AffineScheme.ofHom {X Y : Scheme} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) :
AffineScheme.of X ⟶ AffineScheme.of Y :=
f
#align algebraic_geometry.AffineScheme.of_hom AlgebraicGeometry.AffineScheme.ofHom
theorem mem_Spec_essImage (X : Scheme) : X ∈ Scheme.Spec.essImage ↔ IsAffine X :=
⟨fun h => ⟨Functor.essImage.unit_isIso h⟩,
fun _ => mem_essImage_of_unit_isIso (adj := ΓSpec.adjunction) _⟩
#align algebraic_geometry.mem_Spec_ess_image AlgebraicGeometry.mem_Spec_essImage
instance isAffineAffineScheme (X : AffineScheme.{u}) : IsAffine X.obj :=
⟨Functor.essImage.unit_isIso X.property⟩
#align algebraic_geometry.is_affine_AffineScheme AlgebraicGeometry.isAffineAffineScheme
instance SpecIsAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.Spec.obj R) :=
AlgebraicGeometry.isAffineAffineScheme ⟨_, Scheme.Spec.obj_mem_essImage R⟩
#align algebraic_geometry.Spec_is_affine AlgebraicGeometry.SpecIsAffine
theorem isAffineOfIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X := by
rw [← mem_Spec_essImage] at h ⊢; exact Functor.essImage.ofIso (asIso f).symm h
#align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffineOfIso
def IsAffineOpen {X : Scheme} (U : Opens X) : Prop :=
IsAffine (X ∣_ᵤ U)
#align algebraic_geometry.is_affine_open AlgebraicGeometry.IsAffineOpen
def Scheme.affineOpens (X : Scheme) : Set (Opens X) :=
{U : Opens X | IsAffineOpen U}
#align algebraic_geometry.Scheme.affine_opens AlgebraicGeometry.Scheme.affineOpens
instance {Y : Scheme.{u}} (U : Y.affineOpens) :
IsAffine (Scheme.restrict Y <| Opens.openEmbedding U.val) :=
U.property
theorem rangeIsAffineOpenOfOpenImmersion {X Y : Scheme} [IsAffine X] (f : X ⟶ Y)
[H : IsOpenImmersion f] : IsAffineOpen (Scheme.Hom.opensRange f) := by
refine isAffineOfIso (IsOpenImmersion.isoOfRangeEq f (Y.ofRestrict _) ?_).inv
exact Subtype.range_val.symm
#align algebraic_geometry.range_is_affine_open_of_open_immersion AlgebraicGeometry.rangeIsAffineOpenOfOpenImmersion
theorem topIsAffineOpen (X : Scheme) [IsAffine X] : IsAffineOpen (⊤ : Opens X) := by
convert rangeIsAffineOpenOfOpenImmersion (𝟙 X)
ext1
exact Set.range_id.symm
#align algebraic_geometry.top_is_affine_open AlgebraicGeometry.topIsAffineOpen
instance Scheme.affineCoverIsAffine (X : Scheme) (i : X.affineCover.J) :
IsAffine (X.affineCover.obj i) :=
AlgebraicGeometry.SpecIsAffine _
#align algebraic_geometry.Scheme.affine_cover_is_affine AlgebraicGeometry.Scheme.affineCoverIsAffine
instance Scheme.affineBasisCoverIsAffine (X : Scheme) (i : X.affineBasisCover.J) :
IsAffine (X.affineBasisCover.obj i) :=
AlgebraicGeometry.SpecIsAffine _
#align algebraic_geometry.Scheme.affine_basis_cover_is_affine AlgebraicGeometry.Scheme.affineBasisCoverIsAffine
| Mathlib/AlgebraicGeometry/AffineScheme.lean | 209 | 215 | theorem isBasis_affine_open (X : Scheme) : Opens.IsBasis X.affineOpens := by |
rw [Opens.isBasis_iff_nbhd]
rintro U x (hU : x ∈ (U : Set X))
obtain ⟨S, hS, hxS, hSU⟩ := X.affineBasisCover_is_basis.exists_subset_of_mem_open hU U.isOpen
refine ⟨⟨S, X.affineBasisCover_is_basis.isOpen hS⟩, ?_, hxS, hSU⟩
rcases hS with ⟨i, rfl⟩
exact rangeIsAffineOpenOfOpenImmersion _
| 0 |
import Mathlib.Analysis.Normed.Field.Basic
#align_import analysis.normed_space.int from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8"
namespace Int
theorem nnnorm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖₊ = 1 := by
obtain rfl | rfl := units_eq_one_or e <;>
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
#align int.nnnorm_coe_units Int.nnnorm_coe_units
theorem norm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖ = 1 := by
rw [← coe_nnnorm, nnnorm_coe_units, NNReal.coe_one]
#align int.norm_coe_units Int.norm_coe_units
@[simp]
theorem nnnorm_natCast (n : ℕ) : ‖(n : ℤ)‖₊ = n :=
Real.nnnorm_natCast _
#align int.nnnorm_coe_nat Int.nnnorm_natCast
@[deprecated (since := "2024-04-05")] alias nnnorm_coe_nat := nnnorm_natCast
@[simp]
| Mathlib/Analysis/NormedSpace/Int.lean | 41 | 42 | theorem toNat_add_toNat_neg_eq_nnnorm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖₊ := by |
rw [← Nat.cast_add, toNat_add_toNat_neg_eq_natAbs, NNReal.natCast_natAbs]
| 0 |
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.QuotientNilpotent
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.RingTheory.FinitePresentation
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Localization.Away.AdjoinRoot
#align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166"
-- Porting note: added to make the syntax work below.
open scoped TensorProduct
universe u
namespace Algebra
section
variable (R : Type u) [CommSemiring R]
variable (A : Type u) [Semiring A] [Algebra R A]
@[mk_iff]
class FormallySmooth : Prop where
comp_surjective :
∀ ⦃B : Type u⦄ [CommRing B],
∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥),
Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
#align algebra.formally_smooth Algebra.FormallySmooth
end
namespace FormallySmooth
section
variable {R : Type u} [CommSemiring R]
variable {A : Type u} [Semiring A] [Algebra R A]
variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
theorem exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
[FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) :
∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by
revert g
change Function.Surjective (Ideal.Quotient.mkₐ R I).comp
revert _RB
apply Ideal.IsNilpotent.induction_on (R := B) I hI
· intro B _ I hI _; exact FormallySmooth.comp_surjective I hI
· intro B _ I J hIJ h₁ h₂ _ g
let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J :=
{
(DoubleQuot.quotQuotEquivQuotSup I J).trans
(Ideal.quotEquivOfEq (sup_eq_right.mpr hIJ)) with
commutes' := fun x => rfl }
obtain ⟨g', e⟩ := h₂ (this.symm.toAlgHom.comp g)
obtain ⟨g', rfl⟩ := h₁ g'
replace e := congr_arg this.toAlgHom.comp e
conv_rhs at e =>
rw [← AlgHom.comp_assoc, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.toAlgHom_eq_coe,
AlgEquiv.comp_symm, AlgHom.id_comp]
exact ⟨g', e⟩
#align algebra.formally_smooth.exists_lift Algebra.FormallySmooth.exists_lift
noncomputable def lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) : A →ₐ[R] B :=
(FormallySmooth.exists_lift I hI g).choose
#align algebra.formally_smooth.lift Algebra.FormallySmooth.lift
@[simp]
theorem comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) : (Ideal.Quotient.mkₐ R I).comp (FormallySmooth.lift I hI g) = g :=
(FormallySmooth.exists_lift I hI g).choose_spec
#align algebra.formally_smooth.comp_lift Algebra.FormallySmooth.comp_lift
@[simp]
theorem mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) (x : A) : Ideal.Quotient.mk I (FormallySmooth.lift I hI g x) = g x :=
AlgHom.congr_fun (FormallySmooth.comp_lift I hI g : _) x
#align algebra.formally_smooth.mk_lift Algebra.FormallySmooth.mk_lift
variable {C : Type u} [CommRing C] [Algebra R C]
noncomputable def liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C)
(g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) :
A →ₐ[R] B :=
FormallySmooth.lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)
#align algebra.formally_smooth.lift_of_surjective Algebra.FormallySmooth.liftOfSurjective
@[simp]
theorem liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
(hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) (x : A) :
g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by
apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective
change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [← FormallySmooth.mk_lift _ hg'
((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective
simp only [liftOfSurjective, AlgEquiv.apply_symm_apply, AlgEquiv.toAlgHom_eq_coe,
Ideal.quotientKerAlgEquivOfSurjective_apply, RingHom.kerLift_mk, RingHom.coe_coe]
#align algebra.formally_smooth.lift_of_surjective_apply Algebra.FormallySmooth.liftOfSurjective_apply
@[simp]
theorem comp_liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
(hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) :
g.comp (FormallySmooth.liftOfSurjective f g hg hg') = f :=
AlgHom.ext (FormallySmooth.liftOfSurjective_apply f g hg hg')
#align algebra.formally_smooth.comp_lift_of_surjective Algebra.FormallySmooth.comp_liftOfSurjective
end
section OfEquiv
variable {R : Type u} [CommSemiring R]
variable {A B : Type u} [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
| Mathlib/RingTheory/Smooth/Basic.lean | 148 | 153 | theorem of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : FormallySmooth R B := by |
constructor
intro C _ _ I hI f
use (FormallySmooth.lift I ⟨2, hI⟩ (f.comp e : A →ₐ[R] C ⧸ I)).comp e.symm
rw [← AlgHom.comp_assoc, FormallySmooth.comp_lift, AlgHom.comp_assoc, AlgEquiv.comp_symm,
AlgHom.comp_id]
| 0 |
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Finset.Sum
import Mathlib.Logic.Embedding.Set
#align_import data.fintype.sum from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
universe u v
variable {α β : Type*}
open Finset
instance (α : Type u) (β : Type v) [Fintype α] [Fintype β] : Fintype (Sum α β) where
elems := univ.disjSum univ
complete := by rintro (_ | _) <;> simp
@[simp]
theorem Finset.univ_disjSum_univ {α β : Type*} [Fintype α] [Fintype β] :
univ.disjSum univ = (univ : Finset (Sum α β)) :=
rfl
#align finset.univ_disj_sum_univ Finset.univ_disjSum_univ
@[simp]
theorem Fintype.card_sum [Fintype α] [Fintype β] :
Fintype.card (Sum α β) = Fintype.card α + Fintype.card β :=
card_disjSum _ _
#align fintype.card_sum Fintype.card_sum
def fintypeOfFintypeNe (a : α) (h : Fintype { b // b ≠ a }) : Fintype α :=
Fintype.ofBijective (Sum.elim ((↑) : { b // b = a } → α) ((↑) : { b // b ≠ a } → α)) <| by
classical exact (Equiv.sumCompl (· = a)).bijective
#align fintype_of_fintype_ne fintypeOfFintypeNe
| Mathlib/Data/Fintype/Sum.lean | 47 | 57 | theorem image_subtype_ne_univ_eq_image_erase [Fintype α] [DecidableEq β] (k : β) (b : α → β) :
image (fun i : { a // b a ≠ k } => b ↑i) univ = (image b univ).erase k := by |
apply subset_antisymm
· rw [image_subset_iff]
intro i _
apply mem_erase_of_ne_of_mem i.2 (mem_image_of_mem _ (mem_univ _))
· intro i hi
rw [mem_image]
rcases mem_image.1 (erase_subset _ _ hi) with ⟨a, _, ha⟩
subst ha
exact ⟨⟨a, ne_of_mem_erase hi⟩, mem_univ _, rfl⟩
| 0 |
import Mathlib.Algebra.Module.DedekindDomain
import Mathlib.LinearAlgebra.FreeModule.PID
import Mathlib.Algebra.Module.Projective
import Mathlib.Algebra.Category.ModuleCat.Biproducts
import Mathlib.RingTheory.SimpleModule
#align_import algebra.module.pid from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8"
universe u v
open scoped Classical
variable {R : Type u} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R]
variable {M : Type v} [AddCommGroup M] [Module R M]
variable {N : Type max u v} [AddCommGroup N] [Module R N]
open scoped DirectSum
open Submodule
open UniqueFactorizationMonoid
theorem Submodule.isSemisimple_torsionBy_of_irreducible {a : R} (h : Irreducible a) :
IsSemisimpleModule R (torsionBy R M a) :=
haveI := PrincipalIdealRing.isMaximal_of_irreducible h
letI := Ideal.Quotient.field (R ∙ a)
(submodule_torsionBy_orderIso a).complementedLattice
theorem Submodule.isInternal_prime_power_torsion_of_pid [Module.Finite R M]
(hM : Module.IsTorsion R M) :
DirectSum.IsInternal fun p : (factors (⊤ : Submodule R M).annihilator).toFinset =>
torsionBy R M
(IsPrincipal.generator (p : Ideal R) ^
(factors (⊤ : Submodule R M).annihilator).count ↑p) := by
convert isInternal_prime_power_torsion hM
ext p : 1
rw [← torsionBySet_span_singleton_eq, Ideal.submodule_span_eq, ← Ideal.span_singleton_pow,
Ideal.span_singleton_generator]
#align submodule.is_internal_prime_power_torsion_of_pid Submodule.isInternal_prime_power_torsion_of_pid
theorem Submodule.exists_isInternal_prime_power_torsion_of_pid [Module.Finite R M]
(hM : Module.IsTorsion R M) :
∃ (ι : Type u) (_ : Fintype ι) (_ : DecidableEq ι) (p : ι → R) (_ : ∀ i, Irreducible <| p i)
(e : ι → ℕ), DirectSum.IsInternal fun i => torsionBy R M <| p i ^ e i := by
refine ⟨_, ?_, _, _, ?_, _, Submodule.isInternal_prime_power_torsion_of_pid hM⟩
· exact Finset.fintypeCoeSort _
· rintro ⟨p, hp⟩
have hP := prime_of_factor p (Multiset.mem_toFinset.mp hp)
haveI := Ideal.isPrime_of_prime hP
exact (IsPrincipal.prime_generator_of_isPrime p hP.ne_zero).irreducible
#align submodule.exists_is_internal_prime_power_torsion_of_pid Submodule.exists_isInternal_prime_power_torsion_of_pid
namespace Module
section PTorsion
variable {p : R} (hp : Irreducible p) (hM : Module.IsTorsion' M (Submonoid.powers p))
variable [dec : ∀ x : M, Decidable (x = 0)]
open Ideal Submodule.IsPrincipal
theorem _root_.Ideal.torsionOf_eq_span_pow_pOrder (x : M) :
torsionOf R M x = span {p ^ pOrder hM x} := by
dsimp only [pOrder]
rw [← (torsionOf R M x).span_singleton_generator, Ideal.span_singleton_eq_span_singleton, ←
Associates.mk_eq_mk_iff_associated, Associates.mk_pow]
have prop :
(fun n : ℕ => p ^ n • x = 0) = fun n : ℕ =>
(Associates.mk <| generator <| torsionOf R M x) ∣ Associates.mk p ^ n := by
ext n; rw [← Associates.mk_pow, Associates.mk_dvd_mk, ← mem_iff_generator_dvd]; rfl
have := (isTorsion'_powers_iff p).mp hM x; rw [prop] at this
convert Associates.eq_pow_find_of_dvd_irreducible_pow (Associates.irreducible_mk.mpr hp)
this.choose_spec
#align ideal.torsion_of_eq_span_pow_p_order Ideal.torsionOf_eq_span_pow_pOrder
| Mathlib/Algebra/Module/PID.lean | 124 | 148 | theorem p_pow_smul_lift {x y : M} {k : ℕ} (hM' : Module.IsTorsionBy R M (p ^ pOrder hM y))
(h : p ^ k • x ∈ R ∙ y) : ∃ a : R, p ^ k • x = p ^ k • a • y := by |
-- Porting note: needed to make `smul_smul` work below.
letI : MulAction R M := MulActionWithZero.toMulAction
by_cases hk : k ≤ pOrder hM y
· let f :=
((R ∙ p ^ (pOrder hM y - k) * p ^ k).quotEquivOfEq _ ?_).trans
(quotTorsionOfEquivSpanSingleton R M y)
· have : f.symm ⟨p ^ k • x, h⟩ ∈
R ∙ Ideal.Quotient.mk (R ∙ p ^ (pOrder hM y - k) * p ^ k) (p ^ k) := by
rw [← Quotient.torsionBy_eq_span_singleton, mem_torsionBy_iff, ← f.symm.map_smul]
· convert f.symm.map_zero; ext
rw [coe_smul_of_tower, coe_mk, coe_zero, smul_smul, ← pow_add, Nat.sub_add_cancel hk,
@hM' x]
· exact mem_nonZeroDivisors_of_ne_zero (pow_ne_zero _ hp.ne_zero)
rw [Submodule.mem_span_singleton] at this; obtain ⟨a, ha⟩ := this; use a
rw [f.eq_symm_apply, ← Ideal.Quotient.mk_eq_mk, ← Quotient.mk_smul] at ha
dsimp only [smul_eq_mul, LinearEquiv.trans_apply, Submodule.quotEquivOfEq_mk,
quotTorsionOfEquivSpanSingleton_apply_mk] at ha
rw [smul_smul, mul_comm]; exact congr_arg ((↑) : _ → M) ha.symm
· symm; convert Ideal.torsionOf_eq_span_pow_pOrder hp hM y
rw [← pow_add, Nat.sub_add_cancel hk]
· use 0
rw [zero_smul, smul_zero, ← Nat.sub_add_cancel (le_of_not_le hk), pow_add, mul_smul, hM',
smul_zero]
| 0 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Algebra.Ring.Rat
import Mathlib.Data.PNat.Defs
#align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
namespace Rat
open Rat
theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by
cases' e : a /. b with n d h c
rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e
refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <|
c.dvd_of_dvd_mul_right ?_
have := congr_arg Int.natAbs e
simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
#align rat.num_dvd Rat.num_dvd
| Mathlib/Data/Rat/Lemmas.lean | 33 | 38 | theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b := by |
by_cases b0 : b = 0; · simp [b0]
cases' e : a /. b with n d h c
rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e
refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_
rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp
| 0 |
import Mathlib.Algebra.MvPolynomial.PDeriv
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.LinearIndependent
import Mathlib.RingTheory.Polynomial.Pochhammer
#align_import ring_theory.polynomial.bernstein from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
noncomputable section
open Nat (choose)
open Polynomial (X)
open scoped Polynomial
variable (R : Type*) [CommRing R]
def bernsteinPolynomial (n ν : ℕ) : R[X] :=
(choose n ν : R[X]) * X ^ ν * (1 - X) ^ (n - ν)
#align bernstein_polynomial bernsteinPolynomial
example : bernsteinPolynomial ℤ 3 2 = 3 * X ^ 2 - 3 * X ^ 3 := by
norm_num [bernsteinPolynomial, choose]
ring
namespace bernsteinPolynomial
theorem eq_zero_of_lt {n ν : ℕ} (h : n < ν) : bernsteinPolynomial R n ν = 0 := by
simp [bernsteinPolynomial, Nat.choose_eq_zero_of_lt h]
#align bernstein_polynomial.eq_zero_of_lt bernsteinPolynomial.eq_zero_of_lt
section
variable {R} {S : Type*} [CommRing S]
@[simp]
theorem map (f : R →+* S) (n ν : ℕ) :
(bernsteinPolynomial R n ν).map f = bernsteinPolynomial S n ν := by simp [bernsteinPolynomial]
#align bernstein_polynomial.map bernsteinPolynomial.map
end
theorem flip (n ν : ℕ) (h : ν ≤ n) :
(bernsteinPolynomial R n ν).comp (1 - X) = bernsteinPolynomial R n (n - ν) := by
simp [bernsteinPolynomial, h, tsub_tsub_assoc, mul_right_comm]
#align bernstein_polynomial.flip bernsteinPolynomial.flip
theorem flip' (n ν : ℕ) (h : ν ≤ n) :
bernsteinPolynomial R n ν = (bernsteinPolynomial R n (n - ν)).comp (1 - X) := by
simp [← flip _ _ _ h, Polynomial.comp_assoc]
#align bernstein_polynomial.flip' bernsteinPolynomial.flip'
theorem eval_at_0 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 0 = if ν = 0 then 1 else 0 := by
rw [bernsteinPolynomial]
split_ifs with h
· subst h; simp
· simp [zero_pow h]
#align bernstein_polynomial.eval_at_0 bernsteinPolynomial.eval_at_0
theorem eval_at_1 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 1 = if ν = n then 1 else 0 := by
rw [bernsteinPolynomial]
split_ifs with h
· subst h; simp
· obtain hνn | hnν := Ne.lt_or_lt h
· simp [zero_pow $ Nat.sub_ne_zero_of_lt hνn]
· simp [Nat.choose_eq_zero_of_lt hnν]
#align bernstein_polynomial.eval_at_1 bernsteinPolynomial.eval_at_1
theorem derivative_succ_aux (n ν : ℕ) :
Polynomial.derivative (bernsteinPolynomial R (n + 1) (ν + 1)) =
(n + 1) * (bernsteinPolynomial R n ν - bernsteinPolynomial R n (ν + 1)) := by
rw [bernsteinPolynomial]
suffices ((n + 1).choose (ν + 1) : R[X]) * ((↑(ν + 1 : ℕ) : R[X]) * X ^ ν) * (1 - X) ^ (n - ν) -
((n + 1).choose (ν + 1) : R[X]) * X ^ (ν + 1) * ((↑(n - ν) : R[X]) * (1 - X) ^ (n - ν - 1)) =
(↑(n + 1) : R[X]) * ((n.choose ν : R[X]) * X ^ ν * (1 - X) ^ (n - ν) -
(n.choose (ν + 1) : R[X]) * X ^ (ν + 1) * (1 - X) ^ (n - (ν + 1))) by
simpa [Polynomial.derivative_pow, ← sub_eq_add_neg, Nat.succ_sub_succ_eq_sub,
Polynomial.derivative_mul, Polynomial.derivative_natCast, zero_mul,
Nat.cast_add, algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add,
Polynomial.derivative_sub, Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero,
bernsteinPolynomial, map_add, map_natCast, Nat.cast_one]
conv_rhs => rw [mul_sub]
-- We'll prove the two terms match up separately.
refine congr (congr_arg Sub.sub ?_) ?_
· simp only [← mul_assoc]
apply congr (congr_arg (· * ·) (congr (congr_arg (· * ·) _) rfl)) rfl
-- Now it's just about binomial coefficients
exact mod_cast congr_arg (fun m : ℕ => (m : R[X])) (Nat.succ_mul_choose_eq n ν).symm
· rw [← tsub_add_eq_tsub_tsub, ← mul_assoc, ← mul_assoc]; congr 1
rw [mul_comm, ← mul_assoc, ← mul_assoc]; congr 1
norm_cast
congr 1
convert (Nat.choose_mul_succ_eq n (ν + 1)).symm using 1
· -- Porting note: was
-- convert mul_comm _ _ using 2
-- simp
rw [mul_comm, Nat.succ_sub_succ_eq_sub]
· apply mul_comm
#align bernstein_polynomial.derivative_succ_aux bernsteinPolynomial.derivative_succ_aux
theorem derivative_succ (n ν : ℕ) : Polynomial.derivative (bernsteinPolynomial R n (ν + 1)) =
n * (bernsteinPolynomial R (n - 1) ν - bernsteinPolynomial R (n - 1) (ν + 1)) := by
cases n
· simp [bernsteinPolynomial]
· rw [Nat.cast_succ]; apply derivative_succ_aux
#align bernstein_polynomial.derivative_succ bernsteinPolynomial.derivative_succ
theorem derivative_zero (n : ℕ) :
Polynomial.derivative (bernsteinPolynomial R n 0) = -n * bernsteinPolynomial R (n - 1) 0 := by
simp [bernsteinPolynomial, Polynomial.derivative_pow]
#align bernstein_polynomial.derivative_zero bernsteinPolynomial.derivative_zero
| Mathlib/RingTheory/Polynomial/Bernstein.lean | 146 | 161 | theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
k < ν → (Polynomial.derivative^[k] (bernsteinPolynomial R n ν)).eval 0 = 0 := by |
cases' ν with ν
· rintro ⟨⟩
· rw [Nat.lt_succ_iff]
induction' k with k ih generalizing n ν
· simp [eval_at_0]
· simp only [derivative_succ, Int.natCast_eq_zero, mul_eq_zero, Function.comp_apply,
Function.iterate_succ, Polynomial.iterate_derivative_sub,
Polynomial.iterate_derivative_natCast_mul, Polynomial.eval_mul, Polynomial.eval_natCast,
Polynomial.eval_sub]
intro h
apply mul_eq_zero_of_right
rw [ih _ _ (Nat.le_of_succ_le h), sub_zero]
convert ih _ _ (Nat.pred_le_pred h)
exact (Nat.succ_pred_eq_of_pos (k.succ_pos.trans_le h)).symm
| 0 |
import Mathlib.Topology.Sets.Opens
#align_import topology.local_at_target from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open TopologicalSpace Set Filter
open Topology Filter
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β}
variable {s : Set β} {ι : Type*} {U : ι → Opens β} (hU : iSup U = ⊤)
theorem Set.restrictPreimage_inducing (s : Set β) (h : Inducing f) :
Inducing (s.restrictPreimage f) := by
simp_rw [← inducing_subtype_val.of_comp_iff, inducing_iff_nhds, restrictPreimage,
MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊢
intro a
rw [← h, ← inducing_subtype_val.nhds_eq_comap]
#align set.restrict_preimage_inducing Set.restrictPreimage_inducing
alias Inducing.restrictPreimage := Set.restrictPreimage_inducing
#align inducing.restrict_preimage Inducing.restrictPreimage
theorem Set.restrictPreimage_embedding (s : Set β) (h : Embedding f) :
Embedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s, h.2.restrictPreimage s⟩
#align set.restrict_preimage_embedding Set.restrictPreimage_embedding
alias Embedding.restrictPreimage := Set.restrictPreimage_embedding
#align embedding.restrict_preimage Embedding.restrictPreimage
theorem Set.restrictPreimage_openEmbedding (s : Set β) (h : OpenEmbedding f) :
OpenEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ continuous_subtype_val.isOpen_preimage _ h.isOpen_range⟩
#align set.restrict_preimage_open_embedding Set.restrictPreimage_openEmbedding
alias OpenEmbedding.restrictPreimage := Set.restrictPreimage_openEmbedding
#align open_embedding.restrict_preimage OpenEmbedding.restrictPreimage
theorem Set.restrictPreimage_closedEmbedding (s : Set β) (h : ClosedEmbedding f) :
ClosedEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ inducing_subtype_val.isClosed_preimage _ h.isClosed_range⟩
#align set.restrict_preimage_closed_embedding Set.restrictPreimage_closedEmbedding
alias ClosedEmbedding.restrictPreimage := Set.restrictPreimage_closedEmbedding
#align closed_embedding.restrict_preimage ClosedEmbedding.restrictPreimage
theorem IsClosedMap.restrictPreimage (H : IsClosedMap f) (s : Set β) :
IsClosedMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsClosed u → Subtype.val ⁻¹' u = t →
∃ v, IsClosed v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isClosed_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
@[deprecated (since := "2024-04-02")]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
IsClosedMap (s.restrictPreimage f) := H.restrictPreimage s
theorem IsOpenMap.restrictPreimage (H : IsOpenMap f) (s : Set β) :
IsOpenMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsOpen u → Subtype.val ⁻¹' u = t →
∃ v, IsOpen v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isOpen_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
@[deprecated (since := "2024-04-02")]
theorem Set.restrictPreimage_isOpenMap (s : Set β) (H : IsOpenMap f) :
IsOpenMap (s.restrictPreimage f) := H.restrictPreimage s
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
constructor
· exact fun H i => H.inter (U i).2
· intro H
have : ⋃ i, (U i : Set β) = Set.univ := by
convert congr_arg (SetLike.coe) hU
simp
rw [← s.inter_univ, ← this, Set.inter_iUnion]
exact isOpen_iUnion H
#align is_open_iff_inter_of_supr_eq_top isOpen_iff_inter_of_iSup_eq_top
theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
-- Porting note: rewrote to avoid ´simp´ issues
rw [isOpen_iff_inter_of_iSup_eq_top hU s]
refine forall_congr' fun i => ?_
rw [(U _).2.openEmbedding_subtype_val.open_iff_image_open]
erw [Set.image_preimage_eq_inter_range]
rw [Subtype.range_coe, Opens.carrier_eq_coe]
#align is_open_iff_coe_preimage_of_supr_eq_top isOpen_iff_coe_preimage_of_iSup_eq_top
theorem isClosed_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
IsClosed s ↔ ∀ i, IsClosed ((↑) ⁻¹' s : Set (U i)) := by
simpa using isOpen_iff_coe_preimage_of_iSup_eq_top hU sᶜ
#align is_closed_iff_coe_preimage_of_supr_eq_top isClosed_iff_coe_preimage_of_iSup_eq_top
| Mathlib/Topology/LocalAtTarget.lean | 116 | 126 | theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by |
refine ⟨fun h i => h.restrictPreimage _, ?_⟩
rintro H s hs
rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU]
intro i
convert H i _ ⟨⟨_, hs.1, eq_compl_comm.mpr rfl⟩⟩
ext ⟨x, hx⟩
suffices (∃ y, y ∈ s ∧ f y = x) ↔ ∃ y, y ∈ s ∧ f y ∈ U i ∧ f y = x by
simpa [Set.restrictPreimage, ← Subtype.coe_inj]
exact ⟨fun ⟨a, b, c⟩ => ⟨a, b, c.symm ▸ hx, c⟩, fun ⟨a, b, _, c⟩ => ⟨a, b, c⟩⟩
| 0 |
import Mathlib.Algebra.Group.Commutator
import Mathlib.Algebra.Group.Subgroup.Finite
import Mathlib.Data.Bracket
import Mathlib.GroupTheory.Subgroup.Centralizer
import Mathlib.Tactic.Group
#align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G']
variable (f : F) {g₁ g₂ g₃ g : G}
theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * g₂ = g₂ * g₁ := by
rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul]
#align commutator_element_eq_one_iff_mul_comm commutatorElement_eq_one_iff_mul_comm
theorem commutatorElement_eq_one_iff_commute : ⁅g₁, g₂⁆ = 1 ↔ Commute g₁ g₂ :=
commutatorElement_eq_one_iff_mul_comm
#align commutator_element_eq_one_iff_commute commutatorElement_eq_one_iff_commute
theorem Commute.commutator_eq (h : Commute g₁ g₂) : ⁅g₁, g₂⁆ = 1 :=
commutatorElement_eq_one_iff_commute.mpr h
#align commute.commutator_eq Commute.commutator_eq
variable (g₁ g₂ g₃ g)
@[simp]
theorem commutatorElement_one_right : ⁅g, (1 : G)⁆ = 1 :=
(Commute.one_right g).commutator_eq
#align commutator_element_one_right commutatorElement_one_right
@[simp]
theorem commutatorElement_one_left : ⁅(1 : G), g⁆ = 1 :=
(Commute.one_left g).commutator_eq
#align commutator_element_one_left commutatorElement_one_left
@[simp]
theorem commutatorElement_self : ⁅g, g⁆ = 1 :=
(Commute.refl g).commutator_eq
#align commutator_element_self commutatorElement_self
@[simp]
theorem commutatorElement_inv : ⁅g₁, g₂⁆⁻¹ = ⁅g₂, g₁⁆ := by
simp_rw [commutatorElement_def, mul_inv_rev, inv_inv, mul_assoc]
#align commutator_element_inv commutatorElement_inv
theorem map_commutatorElement : (f ⁅g₁, g₂⁆ : G') = ⁅f g₁, f g₂⁆ := by
simp_rw [commutatorElement_def, map_mul f, map_inv f]
#align map_commutator_element map_commutatorElement
theorem conjugate_commutatorElement : g₃ * ⁅g₁, g₂⁆ * g₃⁻¹ = ⁅g₃ * g₁ * g₃⁻¹, g₃ * g₂ * g₃⁻¹⁆ :=
map_commutatorElement (MulAut.conj g₃).toMonoidHom g₁ g₂
#align conjugate_commutator_element conjugate_commutatorElement
namespace Subgroup
instance commutator : Bracket (Subgroup G) (Subgroup G) :=
⟨fun H₁ H₂ => closure { g | ∃ g₁ ∈ H₁, ∃ g₂ ∈ H₂, ⁅g₁, g₂⁆ = g }⟩
#align subgroup.commutator Subgroup.commutator
theorem commutator_def (H₁ H₂ : Subgroup G) :
⁅H₁, H₂⁆ = closure { g | ∃ g₁ ∈ H₁, ∃ g₂ ∈ H₂, ⁅g₁, g₂⁆ = g } :=
rfl
#align subgroup.commutator_def Subgroup.commutator_def
variable {g₁ g₂ g₃} {H₁ H₂ H₃ K₁ K₂ : Subgroup G}
theorem commutator_mem_commutator (h₁ : g₁ ∈ H₁) (h₂ : g₂ ∈ H₂) : ⁅g₁, g₂⁆ ∈ ⁅H₁, H₂⁆ :=
subset_closure ⟨g₁, h₁, g₂, h₂, rfl⟩
#align subgroup.commutator_mem_commutator Subgroup.commutator_mem_commutator
theorem commutator_le : ⁅H₁, H₂⁆ ≤ H₃ ↔ ∀ g₁ ∈ H₁, ∀ g₂ ∈ H₂, ⁅g₁, g₂⁆ ∈ H₃ :=
H₃.closure_le.trans
⟨fun h a b c d => h ⟨a, b, c, d, rfl⟩, fun h _g ⟨a, b, c, d, h_eq⟩ => h_eq ▸ h a b c d⟩
#align subgroup.commutator_le Subgroup.commutator_le
theorem commutator_mono (h₁ : H₁ ≤ K₁) (h₂ : H₂ ≤ K₂) : ⁅H₁, H₂⁆ ≤ ⁅K₁, K₂⁆ :=
commutator_le.mpr fun _g₁ hg₁ _g₂ hg₂ => commutator_mem_commutator (h₁ hg₁) (h₂ hg₂)
#align subgroup.commutator_mono Subgroup.commutator_mono
theorem commutator_eq_bot_iff_le_centralizer : ⁅H₁, H₂⁆ = ⊥ ↔ H₁ ≤ centralizer H₂ := by
rw [eq_bot_iff, commutator_le]
refine forall_congr' fun p =>
forall_congr' fun _hp => forall_congr' fun q => forall_congr' fun hq => ?_
rw [mem_bot, commutatorElement_eq_one_iff_mul_comm, eq_comm]
#align subgroup.commutator_eq_bot_iff_le_centralizer Subgroup.commutator_eq_bot_iff_le_centralizer
| Mathlib/GroupTheory/Commutator.lean | 108 | 116 | theorem commutator_commutator_eq_bot_of_rotate (h1 : ⁅⁅H₂, H₃⁆, H₁⁆ = ⊥) (h2 : ⁅⁅H₃, H₁⁆, H₂⁆ = ⊥) :
⁅⁅H₁, H₂⁆, H₃⁆ = ⊥ := by |
simp_rw [commutator_eq_bot_iff_le_centralizer, commutator_le,
mem_centralizer_iff_commutator_eq_one, ← commutatorElement_def] at h1 h2 ⊢
intro x hx y hy z hz
trans x * z * ⁅y, ⁅z⁻¹, x⁻¹⁆⁆⁻¹ * z⁻¹ * y * ⁅x⁻¹, ⁅y⁻¹, z⁆⁆⁻¹ * y⁻¹ * x⁻¹
· group
· rw [h1 _ (H₂.inv_mem hy) _ hz _ (H₁.inv_mem hx), h2 _ (H₃.inv_mem hz) _ (H₁.inv_mem hx) _ hy]
group
| 0 |
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
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
set_option linter.uppercaseLean3 false in
#align Top.glue_data.is_open_iff TopCat.GlueData.isOpen_iff
theorem ι_jointly_surjective (x : 𝖣.glued) : ∃ (i : _) (y : D.U i), 𝖣.ι i y = x :=
𝖣.ι_jointly_surjective (forget TopCat) x
set_option linter.uppercaseLean3 false in
#align Top.glue_data.ι_jointly_surjective TopCat.GlueData.ι_jointly_surjective
def Rel (a b : Σ i, ((D.U i : TopCat) : Type _)) : Prop :=
a = b ∨ ∃ x : D.V (a.1, b.1), D.f _ _ x = a.2 ∧ D.f _ _ (D.t _ _ x) = b.2
set_option linter.uppercaseLean3 false in
#align Top.glue_data.rel TopCat.GlueData.Rel
theorem rel_equiv : Equivalence D.Rel :=
⟨fun x => Or.inl (refl x), by
rintro a b (⟨⟨⟩⟩ | ⟨x, e₁, e₂⟩)
exacts [Or.inl rfl, Or.inr ⟨D.t _ _ x, e₂, by erw [← e₁, D.t_inv_apply]⟩], by
-- previous line now `erw` after #13170
rintro ⟨i, a⟩ ⟨j, b⟩ ⟨k, c⟩ (⟨⟨⟩⟩ | ⟨x, e₁, e₂⟩)
· exact id
rintro (⟨⟨⟩⟩ | ⟨y, e₃, e₄⟩)
· exact Or.inr ⟨x, e₁, e₂⟩
let z := (pullbackIsoProdSubtype (D.f j i) (D.f j k)).inv ⟨⟨_, _⟩, e₂.trans e₃.symm⟩
have eq₁ : (D.t j i) ((pullback.fst : _ ⟶ D.V (j, i)) z) = x := by
dsimp only [coe_of, z]
erw [pullbackIsoProdSubtype_inv_fst_apply, D.t_inv_apply]-- now `erw` after #13170
have eq₂ : (pullback.snd : _ ⟶ D.V _) z = y := pullbackIsoProdSubtype_inv_snd_apply _ _ _
clear_value z
right
use (pullback.fst : _ ⟶ D.V (i, k)) (D.t' _ _ _ z)
dsimp only at *
substs eq₁ eq₂ e₁ e₃ e₄
have h₁ : D.t' j i k ≫ pullback.fst ≫ D.f i k = pullback.fst ≫ D.t j i ≫ D.f i j := by
rw [← 𝖣.t_fac_assoc]; congr 1; exact pullback.condition
have h₂ : D.t' j i k ≫ pullback.fst ≫ D.t i k ≫ D.f k i = pullback.snd ≫ D.t j k ≫ D.f k j := by
rw [← 𝖣.t_fac_assoc]
apply @Epi.left_cancellation _ _ _ _ (D.t' k j i)
rw [𝖣.cocycle_assoc, 𝖣.t_fac_assoc, 𝖣.t_inv_assoc]
exact pullback.condition.symm
exact ⟨ContinuousMap.congr_fun h₁ z, ContinuousMap.congr_fun h₂ z⟩⟩
set_option linter.uppercaseLean3 false in
#align Top.glue_data.rel_equiv TopCat.GlueData.rel_equiv
open CategoryTheory.Limits.WalkingParallelPair
| Mathlib/Topology/Gluing.lean | 164 | 201 | theorem eqvGen_of_π_eq
-- Porting note: was `{x y : ∐ D.U} (h : 𝖣.π x = 𝖣.π y)`
{x y : sigmaObj (β := D.toGlueData.J) (C := TopCat) D.toGlueData.U}
(h : 𝖣.π x = 𝖣.π y) :
EqvGen
-- Porting note: was (Types.CoequalizerRel 𝖣.diagram.fstSigmaMap 𝖣.diagram.sndSigmaMap)
(Types.CoequalizerRel
(X := sigmaObj (β := D.toGlueData.diagram.L) (C := TopCat) (D.toGlueData.diagram).left)
(Y := sigmaObj (β := D.toGlueData.diagram.R) (C := TopCat) (D.toGlueData.diagram).right)
𝖣.diagram.fstSigmaMap 𝖣.diagram.sndSigmaMap)
x y := by |
delta GlueData.π Multicoequalizer.sigmaπ at h
-- Porting note: inlined `inferInstance` instead of leaving as a side goal.
replace h := (TopCat.mono_iff_injective (Multicoequalizer.isoCoequalizer 𝖣.diagram).inv).mp
inferInstance h
let diagram := parallelPair 𝖣.diagram.fstSigmaMap 𝖣.diagram.sndSigmaMap ⋙ forget _
have : colimit.ι diagram one x = colimit.ι diagram one y := by
dsimp only [coequalizer.π, ContinuousMap.toFun_eq_coe] at h
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [← ι_preservesColimitsIso_hom, forget_map_eq_coe, types_comp_apply, h]
simp
rfl
have :
(colimit.ι diagram _ ≫ colim.map _ ≫ (colimit.isoColimitCocone _).hom) _ =
(colimit.ι diagram _ ≫ colim.map _ ≫ (colimit.isoColimitCocone _).hom) _ :=
(congr_arg
(colim.map (diagramIsoParallelPair diagram).hom ≫
(colimit.isoColimitCocone (Types.coequalizerColimit _ _)).hom)
this :
_)
-- Porting note: was
-- simp only [eqToHom_refl, types_comp_apply, colimit.ι_map_assoc,
-- diagramIsoParallelPair_hom_app, colimit.isoColimitCocone_ι_hom, types_id_apply] at this
-- See https://github.com/leanprover-community/mathlib4/issues/5026
rw [colimit.ι_map_assoc, diagramIsoParallelPair_hom_app, eqToHom_refl,
colimit.isoColimitCocone_ι_hom, types_comp_apply, types_id_apply, types_comp_apply,
types_id_apply] at this
exact Quot.eq.1 this
| 0 |
import Mathlib.Data.Fin.Tuple.Basic
import Mathlib.Data.List.Join
#align_import data.list.of_fn from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b"
universe u
variable {α : Type u}
open Nat
namespace List
#noalign list.length_of_fn_aux
@[simp]
theorem length_ofFn_go {n} (f : Fin n → α) (i j h) : length (ofFn.go f i j h) = i := by
induction i generalizing j <;> simp_all [ofFn.go]
@[simp]
theorem length_ofFn {n} (f : Fin n → α) : length (ofFn f) = n := by
simp [ofFn, length_ofFn_go]
#align list.length_of_fn List.length_ofFn
#noalign list.nth_of_fn_aux
theorem get_ofFn_go {n} (f : Fin n → α) (i j h) (k) (hk) :
get (ofFn.go f i j h) ⟨k, hk⟩ = f ⟨j + k, by simp at hk; omega⟩ := by
let i+1 := i
cases k <;> simp [ofFn.go, get_ofFn_go (i := i)]
congr 2; omega
-- Porting note (#10756): new theorem
@[simp]
theorem get_ofFn {n} (f : Fin n → α) (i) : get (ofFn f) i = f (Fin.cast (by simp) i) := by
cases i; simp [ofFn, get_ofFn_go]
@[simp]
theorem get?_ofFn {n} (f : Fin n → α) (i) : get? (ofFn f) i = ofFnNthVal f i :=
if h : i < (ofFn f).length
then by
rw [get?_eq_get h, get_ofFn]
· simp only [length_ofFn] at h; simp [ofFnNthVal, h]
else by
rw [ofFnNthVal, dif_neg] <;>
simpa using h
#align list.nth_of_fn List.get?_ofFn
set_option linter.deprecated false in
@[deprecated get_ofFn (since := "2023-01-17")]
| Mathlib/Data/List/OfFn.lean | 75 | 77 | theorem nthLe_ofFn {n} (f : Fin n → α) (i : Fin n) :
nthLe (ofFn f) i ((length_ofFn f).symm ▸ i.2) = f i := by |
simp [nthLe]
| 0 |
import Mathlib.Data.ENNReal.Real
#align_import data.real.conjugate_exponents from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open scoped ENNReal
namespace Real
@[mk_iff]
structure IsConjExponent (p q : ℝ) : Prop where
one_lt : 1 < p
inv_add_inv_conj : p⁻¹ + q⁻¹ = 1
#align real.is_conjugate_exponent Real.IsConjExponent
def conjExponent (p : ℝ) : ℝ := p / (p - 1)
#align real.conjugate_exponent Real.conjExponent
variable {a b p q : ℝ} (h : p.IsConjExponent q)
namespace IsConjExponent
theorem pos : 0 < p := lt_trans zero_lt_one h.one_lt
#align real.is_conjugate_exponent.pos Real.IsConjExponent.pos
theorem nonneg : 0 ≤ p := le_of_lt h.pos
#align real.is_conjugate_exponent.nonneg Real.IsConjExponent.nonneg
theorem ne_zero : p ≠ 0 := ne_of_gt h.pos
#align real.is_conjugate_exponent.ne_zero Real.IsConjExponent.ne_zero
theorem sub_one_pos : 0 < p - 1 := sub_pos.2 h.one_lt
#align real.is_conjugate_exponent.sub_one_pos Real.IsConjExponent.sub_one_pos
theorem sub_one_ne_zero : p - 1 ≠ 0 := ne_of_gt h.sub_one_pos
#align real.is_conjugate_exponent.sub_one_ne_zero Real.IsConjExponent.sub_one_ne_zero
protected lemma inv_pos : 0 < p⁻¹ := inv_pos.2 h.pos
protected lemma inv_nonneg : 0 ≤ p⁻¹ := h.inv_pos.le
protected lemma inv_ne_zero : p⁻¹ ≠ 0 := h.inv_pos.ne'
theorem one_div_pos : 0 < 1 / p := _root_.one_div_pos.2 h.pos
#align real.is_conjugate_exponent.one_div_pos Real.IsConjExponent.one_div_pos
theorem one_div_nonneg : 0 ≤ 1 / p := le_of_lt h.one_div_pos
#align real.is_conjugate_exponent.one_div_nonneg Real.IsConjExponent.one_div_nonneg
theorem one_div_ne_zero : 1 / p ≠ 0 := ne_of_gt h.one_div_pos
#align real.is_conjugate_exponent.one_div_ne_zero Real.IsConjExponent.one_div_ne_zero
theorem conj_eq : q = p / (p - 1) := by
have := h.inv_add_inv_conj
rw [← eq_sub_iff_add_eq', inv_eq_iff_eq_inv] at this
field_simp [this, h.ne_zero]
#align real.is_conjugate_exponent.conj_eq Real.IsConjExponent.conj_eq
lemma conjExponent_eq : conjExponent p = q := h.conj_eq.symm
#align real.is_conjugate_exponent.conjugate_eq Real.IsConjExponent.conjExponent_eq
lemma one_sub_inv : 1 - p⁻¹ = q⁻¹ := sub_eq_of_eq_add' h.inv_add_inv_conj.symm
lemma inv_sub_one : p⁻¹ - 1 = -q⁻¹ := by rw [← h.inv_add_inv_conj, sub_add_cancel_left]
theorem sub_one_mul_conj : (p - 1) * q = p :=
mul_comm q (p - 1) ▸ (eq_div_iff h.sub_one_ne_zero).1 h.conj_eq
#align real.is_conjugate_exponent.sub_one_mul_conj Real.IsConjExponent.sub_one_mul_conj
theorem mul_eq_add : p * q = p + q := by
simpa only [sub_mul, sub_eq_iff_eq_add, one_mul] using h.sub_one_mul_conj
#align real.is_conjugate_exponent.mul_eq_add Real.IsConjExponent.mul_eq_add
@[symm] protected lemma symm : q.IsConjExponent p where
one_lt := by simpa only [h.conj_eq] using (one_lt_div h.sub_one_pos).mpr (sub_one_lt p)
inv_add_inv_conj := by simpa [add_comm] using h.inv_add_inv_conj
#align real.is_conjugate_exponent.symm Real.IsConjExponent.symm
| Mathlib/Data/Real/ConjExponents.lean | 110 | 112 | theorem div_conj_eq_sub_one : p / q = p - 1 := by |
field_simp [h.symm.ne_zero]
rw [h.sub_one_mul_conj]
| 0 |
import Mathlib.Analysis.SpecialFunctions.Exponential
import Mathlib.Combinatorics.Derangements.Finite
import Mathlib.Order.Filter.Basic
#align_import combinatorics.derangements.exponential from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter NormedSpace
open scoped Topology
| Mathlib/Combinatorics/Derangements/Exponential.lean | 24 | 52 | theorem numDerangements_tendsto_inv_e :
Tendsto (fun n => (numDerangements n : ℝ) / n.factorial) atTop (𝓝 (Real.exp (-1))) := by |
-- we show that d(n)/n! is the partial sum of exp(-1), but offset by 1.
-- this isn't entirely obvious, since we have to ensure that asc_factorial and
-- factorial interact in the right way, e.g., that k ≤ n always
let s : ℕ → ℝ := fun n => ∑ k ∈ Finset.range n, (-1 : ℝ) ^ k / k.factorial
suffices ∀ n : ℕ, (numDerangements n : ℝ) / n.factorial = s (n + 1) by
simp_rw [this]
-- shift the function by 1, and then use the fact that the partial sums
-- converge to the infinite sum
rw [tendsto_add_atTop_iff_nat
(f := fun n => ∑ k ∈ Finset.range n, (-1 : ℝ) ^ k / k.factorial) 1]
apply HasSum.tendsto_sum_nat
-- there's no specific lemma for ℝ that ∑ x^k/k! sums to exp(x), but it's
-- true in more general fields, so use that lemma
rw [Real.exp_eq_exp_ℝ]
exact expSeries_div_hasSum_exp ℝ (-1 : ℝ)
intro n
rw [← Int.cast_natCast, numDerangements_sum]
push_cast
rw [Finset.sum_div]
-- get down to individual terms
refine Finset.sum_congr (refl _) ?_
intro k hk
have h_le : k ≤ n := Finset.mem_range_succ_iff.mp hk
rw [Nat.ascFactorial_eq_div, add_tsub_cancel_of_le h_le]
push_cast [Nat.factorial_dvd_factorial h_le]
field_simp [Nat.factorial_ne_zero]
ring
| 0 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Infix
#align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open List.Perm
universe u
namespace List
section Sorted
variable {α : Type u} {r : α → α → Prop} {a : α} {l : List α}
def Sorted :=
@Pairwise
#align list.sorted List.Sorted
instance decidableSorted [DecidableRel r] (l : List α) : Decidable (Sorted r l) :=
List.instDecidablePairwise _
#align list.decidable_sorted List.decidableSorted
protected theorem Sorted.le_of_lt [Preorder α] {l : List α} (h : l.Sorted (· < ·)) :
l.Sorted (· ≤ ·) :=
h.imp le_of_lt
protected theorem Sorted.lt_of_le [PartialOrder α] {l : List α} (h₁ : l.Sorted (· ≤ ·))
(h₂ : l.Nodup) : l.Sorted (· < ·) :=
h₁.imp₂ (fun _ _ => lt_of_le_of_ne) h₂
protected theorem Sorted.ge_of_gt [Preorder α] {l : List α} (h : l.Sorted (· > ·)) :
l.Sorted (· ≥ ·) :=
h.imp le_of_lt
protected theorem Sorted.gt_of_ge [PartialOrder α] {l : List α} (h₁ : l.Sorted (· ≥ ·))
(h₂ : l.Nodup) : l.Sorted (· > ·) :=
h₁.imp₂ (fun _ _ => lt_of_le_of_ne) <| by simp_rw [ne_comm]; exact h₂
@[simp]
theorem sorted_nil : Sorted r [] :=
Pairwise.nil
#align list.sorted_nil List.sorted_nil
theorem Sorted.of_cons : Sorted r (a :: l) → Sorted r l :=
Pairwise.of_cons
#align list.sorted.of_cons List.Sorted.of_cons
theorem Sorted.tail {r : α → α → Prop} {l : List α} (h : Sorted r l) : Sorted r l.tail :=
Pairwise.tail h
#align list.sorted.tail List.Sorted.tail
theorem rel_of_sorted_cons {a : α} {l : List α} : Sorted r (a :: l) → ∀ b ∈ l, r a b :=
rel_of_pairwise_cons
#align list.rel_of_sorted_cons List.rel_of_sorted_cons
theorem Sorted.head!_le [Inhabited α] [Preorder α] {a : α} {l : List α} (h : Sorted (· < ·) l)
(ha : a ∈ l) : l.head! ≤ a := by
rw [← List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
· exact le_rfl
· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
theorem Sorted.le_head! [Inhabited α] [Preorder α] {a : α} {l : List α} (h : Sorted (· > ·) l)
(ha : a ∈ l) : a ≤ l.head! := by
rw [← List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
· exact le_rfl
· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
@[simp]
theorem sorted_cons {a : α} {l : List α} : Sorted r (a :: l) ↔ (∀ b ∈ l, r a b) ∧ Sorted r l :=
pairwise_cons
#align list.sorted_cons List.sorted_cons
protected theorem Sorted.nodup {r : α → α → Prop} [IsIrrefl α r] {l : List α} (h : Sorted r l) :
Nodup l :=
Pairwise.nodup h
#align list.sorted.nodup List.Sorted.nodup
| Mathlib/Data/List/Sort.lean | 104 | 120 | theorem eq_of_perm_of_sorted [IsAntisymm α r] {l₁ l₂ : List α} (hp : l₁ ~ l₂) (hs₁ : Sorted r l₁)
(hs₂ : Sorted r l₂) : l₁ = l₂ := by |
induction' hs₁ with a l₁ h₁ hs₁ IH generalizing l₂
· exact hp.nil_eq
· have : a ∈ l₂ := hp.subset (mem_cons_self _ _)
rcases append_of_mem this with ⟨u₂, v₂, rfl⟩
have hp' := (perm_cons a).1 (hp.trans perm_middle)
obtain rfl := IH hp' (hs₂.sublist <| by simp)
change a :: u₂ ++ v₂ = u₂ ++ ([a] ++ v₂)
rw [← append_assoc]
congr
have : ∀ x ∈ u₂, x = a := fun x m =>
antisymm ((pairwise_append.1 hs₂).2.2 _ m a (mem_cons_self _ _)) (h₁ _ (by simp [m]))
rw [(@eq_replicate _ a (length u₂ + 1) (a :: u₂)).2,
(@eq_replicate _ a (length u₂ + 1) (u₂ ++ [a])).2] <;>
constructor <;>
simp [iff_true_intro this, or_comm]
| 0 |
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.char_p.quotient from "leanprover-community/mathlib"@"85e3c05a94b27c84dc6f234cf88326d5e0096ec3"
universe u v
namespace CharP
theorem quotient (R : Type u) [CommRing R] (p : ℕ) [hp1 : Fact p.Prime] (hp2 : ↑p ∈ nonunits R) :
CharP (R ⧸ (Ideal.span ({(p : R)} : Set R) : Ideal R)) p :=
have hp0 : (p : R ⧸ (Ideal.span {(p : R)} : Ideal R)) = 0 :=
map_natCast (Ideal.Quotient.mk (Ideal.span {(p : R)} : Ideal R)) p ▸
Ideal.Quotient.eq_zero_iff_mem.2 (Ideal.subset_span <| Set.mem_singleton _)
ringChar.of_eq <|
Or.resolve_left ((Nat.dvd_prime hp1.1).1 <| ringChar.dvd hp0) fun h1 =>
hp2 <|
isUnit_iff_dvd_one.2 <|
Ideal.mem_span_singleton.1 <|
Ideal.Quotient.eq_zero_iff_mem.1 <|
@Subsingleton.elim _ (@CharOne.subsingleton _ _ (ringChar.of_eq h1)) _ _
#align char_p.quotient CharP.quotient
theorem quotient' {R : Type*} [CommRing R] (p : ℕ) [CharP R p] (I : Ideal R)
(h : ∀ x : ℕ, (x : R) ∈ I → (x : R) = 0) : CharP (R ⧸ I) p :=
⟨fun x => by
rw [← cast_eq_zero_iff R p x, ← map_natCast (Ideal.Quotient.mk I)]
refine Ideal.Quotient.eq.trans (?_ : ↑x - 0 ∈ I ↔ _)
rw [sub_zero]
exact ⟨h x, fun h' => h'.symm ▸ I.zero_mem⟩⟩
#align char_p.quotient' CharP.quotient'
| Mathlib/Algebra/CharP/Quotient.lean | 47 | 51 | theorem quotient_iff {R : Type*} [CommRing R] (n : ℕ) [CharP R n] (I : Ideal R) :
CharP (R ⧸ I) n ↔ ∀ x : ℕ, ↑x ∈ I → (x : R) = 0 := by |
refine ⟨fun _ x hx => ?_, CharP.quotient' n I⟩
rw [CharP.cast_eq_zero_iff R n, ← CharP.cast_eq_zero_iff (R ⧸ I) n _]
exact (Submodule.Quotient.mk_eq_zero I).mpr hx
| 0 |
import Mathlib.Order.Interval.Set.Monotone
import Mathlib.Topology.MetricSpace.Basic
import Mathlib.Topology.MetricSpace.Bounded
import Mathlib.Topology.Order.MonotoneConvergence
#align_import analysis.box_integral.box.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Function Metric Filter
noncomputable section
open scoped Classical
open NNReal Topology
namespace BoxIntegral
variable {ι : Type*}
structure Box (ι : Type*) where
(lower upper : ι → ℝ)
lower_lt_upper : ∀ i, lower i < upper i
#align box_integral.box BoxIntegral.Box
attribute [simp] Box.lower_lt_upper
namespace Box
variable (I J : Box ι) {x y : ι → ℝ}
instance : Inhabited (Box ι) :=
⟨⟨0, 1, fun _ ↦ zero_lt_one⟩⟩
theorem lower_le_upper : I.lower ≤ I.upper :=
fun i ↦ (I.lower_lt_upper i).le
#align box_integral.box.lower_le_upper BoxIntegral.Box.lower_le_upper
theorem lower_ne_upper (i) : I.lower i ≠ I.upper i :=
(I.lower_lt_upper i).ne
#align box_integral.box.lower_ne_upper BoxIntegral.Box.lower_ne_upper
instance : Membership (ι → ℝ) (Box ι) :=
⟨fun x I ↦ ∀ i, x i ∈ Ioc (I.lower i) (I.upper i)⟩
-- Porting note: added
@[coe]
def toSet (I : Box ι) : Set (ι → ℝ) := { x | x ∈ I }
instance : CoeTC (Box ι) (Set <| ι → ℝ) :=
⟨toSet⟩
@[simp]
theorem mem_mk {l u x : ι → ℝ} {H} : x ∈ mk l u H ↔ ∀ i, x i ∈ Ioc (l i) (u i) := Iff.rfl
#align box_integral.box.mem_mk BoxIntegral.Box.mem_mk
@[simp, norm_cast]
theorem mem_coe : x ∈ (I : Set (ι → ℝ)) ↔ x ∈ I := Iff.rfl
#align box_integral.box.mem_coe BoxIntegral.Box.mem_coe
theorem mem_def : x ∈ I ↔ ∀ i, x i ∈ Ioc (I.lower i) (I.upper i) := Iff.rfl
#align box_integral.box.mem_def BoxIntegral.Box.mem_def
theorem mem_univ_Ioc {I : Box ι} : (x ∈ pi univ fun i ↦ Ioc (I.lower i) (I.upper i)) ↔ x ∈ I :=
mem_univ_pi
#align box_integral.box.mem_univ_Ioc BoxIntegral.Box.mem_univ_Ioc
theorem coe_eq_pi : (I : Set (ι → ℝ)) = pi univ fun i ↦ Ioc (I.lower i) (I.upper i) :=
Set.ext fun _ ↦ mem_univ_Ioc.symm
#align box_integral.box.coe_eq_pi BoxIntegral.Box.coe_eq_pi
@[simp]
theorem upper_mem : I.upper ∈ I :=
fun i ↦ right_mem_Ioc.2 <| I.lower_lt_upper i
#align box_integral.box.upper_mem BoxIntegral.Box.upper_mem
theorem exists_mem : ∃ x, x ∈ I :=
⟨_, I.upper_mem⟩
#align box_integral.box.exists_mem BoxIntegral.Box.exists_mem
theorem nonempty_coe : Set.Nonempty (I : Set (ι → ℝ)) :=
I.exists_mem
#align box_integral.box.nonempty_coe BoxIntegral.Box.nonempty_coe
@[simp]
theorem coe_ne_empty : (I : Set (ι → ℝ)) ≠ ∅ :=
I.nonempty_coe.ne_empty
#align box_integral.box.coe_ne_empty BoxIntegral.Box.coe_ne_empty
@[simp]
theorem empty_ne_coe : ∅ ≠ (I : Set (ι → ℝ)) :=
I.coe_ne_empty.symm
#align box_integral.box.empty_ne_coe BoxIntegral.Box.empty_ne_coe
instance : LE (Box ι) :=
⟨fun I J ↦ ∀ ⦃x⦄, x ∈ I → x ∈ J⟩
theorem le_def : I ≤ J ↔ ∀ x ∈ I, x ∈ J := Iff.rfl
#align box_integral.box.le_def BoxIntegral.Box.le_def
theorem le_TFAE : List.TFAE [I ≤ J, (I : Set (ι → ℝ)) ⊆ J,
Icc I.lower I.upper ⊆ Icc J.lower J.upper, J.lower ≤ I.lower ∧ I.upper ≤ J.upper] := by
tfae_have 1 ↔ 2
· exact Iff.rfl
tfae_have 2 → 3
· intro h
simpa [coe_eq_pi, closure_pi_set, lower_ne_upper] using closure_mono h
tfae_have 3 ↔ 4
· exact Icc_subset_Icc_iff I.lower_le_upper
tfae_have 4 → 2
· exact fun h x hx i ↦ Ioc_subset_Ioc (h.1 i) (h.2 i) (hx i)
tfae_finish
#align box_integral.box.le_tfae BoxIntegral.Box.le_TFAE
variable {I J}
@[simp, norm_cast]
theorem coe_subset_coe : (I : Set (ι → ℝ)) ⊆ J ↔ I ≤ J := Iff.rfl
#align box_integral.box.coe_subset_coe BoxIntegral.Box.coe_subset_coe
theorem le_iff_bounds : I ≤ J ↔ J.lower ≤ I.lower ∧ I.upper ≤ J.upper :=
(le_TFAE I J).out 0 3
#align box_integral.box.le_iff_bounds BoxIntegral.Box.le_iff_bounds
| Mathlib/Analysis/BoxIntegral/Box/Basic.lean | 181 | 185 | theorem injective_coe : Injective ((↑) : Box ι → Set (ι → ℝ)) := by |
rintro ⟨l₁, u₁, h₁⟩ ⟨l₂, u₂, h₂⟩ h
simp only [Subset.antisymm_iff, coe_subset_coe, le_iff_bounds] at h
congr
exacts [le_antisymm h.2.1 h.1.1, le_antisymm h.1.2 h.2.2]
| 0 |
import Mathlib.RingTheory.DedekindDomain.Dvr
import Mathlib.RingTheory.DedekindDomain.Ideal
#align_import ring_theory.dedekind_domain.pid from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940"
variable {R : Type*} [CommRing R]
open Ideal
open UniqueFactorizationMonoid
open scoped nonZeroDivisors
open UniqueFactorizationMonoid
theorem Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne {P : Ideal R}
(hP : P.IsPrime) [IsDedekindDomain R] {x : R} (x_mem : x ∈ P) (hxP2 : x ∉ P ^ 2)
(hxQ : ∀ Q : Ideal R, IsPrime Q → Q ≠ P → x ∉ Q) : P = Ideal.span {x} := by
letI := Classical.decEq (Ideal R)
have hx0 : x ≠ 0 := by
rintro rfl
exact hxP2 (zero_mem _)
by_cases hP0 : P = ⊥
· subst hP0
-- Porting note: was `simpa using hxP2` but that hypothesis didn't even seem relevant in Lean 3
rwa [eq_comm, span_singleton_eq_bot, ← mem_bot]
have hspan0 : span ({x} : Set R) ≠ ⊥ := mt Ideal.span_singleton_eq_bot.mp hx0
have span_le := (Ideal.span_singleton_le_iff_mem _).mpr x_mem
refine
associated_iff_eq.mp
((associated_iff_normalizedFactors_eq_normalizedFactors hP0 hspan0).mpr
(le_antisymm ((dvd_iff_normalizedFactors_le_normalizedFactors hP0 hspan0).mp ?_) ?_))
· rwa [Ideal.dvd_iff_le, Ideal.span_singleton_le_iff_mem]
simp only [normalizedFactors_irreducible (Ideal.prime_of_isPrime hP0 hP).irreducible,
normalize_eq, Multiset.le_iff_count, Multiset.count_singleton]
intro Q
split_ifs with hQ
· subst hQ
refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;>
simp only [Ideal.span_singleton_le_iff_mem, pow_one] <;>
assumption
by_cases hQp : IsPrime Q
· refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;>
-- Porting note: included `zero_add` in the simp arguments
simp only [Ideal.span_singleton_le_iff_mem, zero_add, pow_one, pow_zero, one_eq_top,
Submodule.mem_top]
exact hxQ _ hQp hQ
· exact
(Multiset.count_eq_zero.mpr fun hQi =>
hQp
(isPrime_of_prime
(irreducible_iff_prime.mp (irreducible_of_normalized_factor _ hQi)))).le
#align ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne
-- Porting note: replaced three implicit coercions of `I` with explicit `(I : Submodule R A)`
theorem FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top {R A : Type*}
[CommRing R] [CommRing A] [Algebra R A] {S : Submonoid R} [IsLocalization S A]
(I : (FractionalIdeal S A)ˣ) {v : A} (hv : v ∈ (↑I⁻¹ : FractionalIdeal S A))
(h : Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v}) = ⊤) :
Submodule.IsPrincipal (I : Submodule R A) := by
have hinv := I.mul_inv
set J := Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v})
have hJ : IsLocalization.coeSubmodule A J = ↑I * Submodule.span R {v} := by
-- Porting note: had to insert `val_eq_coe` into this rewrite.
-- Arguably this is because `Subtype.ext_iff` is breaking the `FractionalIdeal` API.
rw [Subtype.ext_iff, val_eq_coe, coe_mul, val_eq_coe, coe_one] at hinv
apply Submodule.map_comap_eq_self
rw [← Submodule.one_eq_range, ← hinv]
exact Submodule.mul_le_mul_right ((Submodule.span_singleton_le_iff_mem _ _).2 hv)
have : (1 : A) ∈ ↑I * Submodule.span R {v} := by
rw [← hJ, h, IsLocalization.coeSubmodule_top, Submodule.mem_one]
exact ⟨1, (algebraMap R _).map_one⟩
obtain ⟨w, hw, hvw⟩ := Submodule.mem_mul_span_singleton.1 this
refine ⟨⟨w, ?_⟩⟩
rw [← FractionalIdeal.coe_spanSingleton S, ← inv_inv I, eq_comm]
refine congr_arg coeToSubmodule (Units.eq_inv_of_mul_eq_one_left (le_antisymm ?_ ?_))
· conv_rhs => rw [← hinv, mul_comm]
apply FractionalIdeal.mul_le_mul_left (FractionalIdeal.spanSingleton_le_iff_mem.mpr hw)
· rw [FractionalIdeal.one_le, ← hvw, mul_comm]
exact FractionalIdeal.mul_mem_mul hv (FractionalIdeal.mem_spanSingleton_self _ _)
#align fractional_ideal.is_principal_of_unit_of_comap_mul_span_singleton_eq_top FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top
| Mathlib/RingTheory/DedekindDomain/PID.lean | 109 | 168 | theorem FractionalIdeal.isPrincipal.of_finite_maximals_of_inv {A : Type*} [CommRing A]
[Algebra R A] {S : Submonoid R} [IsLocalization S A] (hS : S ≤ R⁰)
(hf : {I : Ideal R | I.IsMaximal}.Finite) (I I' : FractionalIdeal S A) (hinv : I * I' = 1) :
Submodule.IsPrincipal (I : Submodule R A) := by |
have hinv' := hinv
rw [Subtype.ext_iff, val_eq_coe, coe_mul] at hinv
let s := hf.toFinset
haveI := Classical.decEq (Ideal R)
have coprime : ∀ M ∈ s, ∀ M' ∈ s.erase M, M ⊔ M' = ⊤ := by
simp_rw [Finset.mem_erase, hf.mem_toFinset]
rintro M hM M' ⟨hne, hM'⟩
exact Ideal.IsMaximal.coprime_of_ne hM hM' hne.symm
have nle : ∀ M ∈ s, ¬⨅ M' ∈ s.erase M, M' ≤ M := fun M hM =>
left_lt_sup.1
((hf.mem_toFinset.1 hM).ne_top.lt_top.trans_eq (Ideal.sup_iInf_eq_top <| coprime M hM).symm)
have : ∀ M ∈ s, ∃ a ∈ I, ∃ b ∈ I', a * b ∉ IsLocalization.coeSubmodule A M := by
intro M hM; by_contra! h
obtain ⟨x, hx, hxM⟩ :=
SetLike.exists_of_lt
((IsLocalization.coeSubmodule_strictMono hS (hf.mem_toFinset.1 hM).ne_top.lt_top).trans_eq
hinv.symm)
exact hxM (Submodule.map₂_le.2 h hx)
choose! a ha b hb hm using this
choose! u hu hum using fun M hM => SetLike.not_le_iff_exists.1 (nle M hM)
let v := ∑ M ∈ s, u M • b M
have hv : v ∈ I' := Submodule.sum_mem _ fun M hM => Submodule.smul_mem _ _ <| hb M hM
refine
FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top
(Units.mkOfMulEqOne I I' hinv') hv (of_not_not fun h => ?_)
obtain ⟨M, hM, hJM⟩ := Ideal.exists_le_maximal _ h
replace hM := hf.mem_toFinset.2 hM
have : ∀ a ∈ I, ∀ b ∈ I', ∃ c, algebraMap R _ c = a * b := by
intro a ha b hb; have hi := hinv.le
obtain ⟨c, -, hc⟩ := hi (Submodule.mul_mem_mul ha hb)
exact ⟨c, hc⟩
have hmem : a M * v ∈ IsLocalization.coeSubmodule A M := by
obtain ⟨c, hc⟩ := this _ (ha M hM) v hv
refine IsLocalization.coeSubmodule_mono _ hJM ⟨c, ?_, hc⟩
have := Submodule.mul_mem_mul (ha M hM) (Submodule.mem_span_singleton_self v)
rwa [← hc] at this
simp_rw [v, Finset.mul_sum, mul_smul_comm] at hmem
rw [← s.add_sum_erase _ hM, Submodule.add_mem_iff_left] at hmem
· refine hm M hM ?_
obtain ⟨c, hc : algebraMap R A c = a M * b M⟩ := this _ (ha M hM) _ (hb M hM)
rw [← hc] at hmem ⊢
rw [Algebra.smul_def, ← _root_.map_mul] at hmem
obtain ⟨d, hdM, he⟩ := hmem
rw [IsLocalization.injective _ hS he] at hdM
-- Note: #8386 had to specify the value of `f`
exact Submodule.mem_map_of_mem (f := Algebra.linearMap _ _)
(((hf.mem_toFinset.1 hM).isPrime.mem_or_mem hdM).resolve_left <| hum M hM)
· refine Submodule.sum_mem _ fun M' hM' => ?_
rw [Finset.mem_erase] at hM'
obtain ⟨c, hc⟩ := this _ (ha M hM) _ (hb M' hM'.2)
rw [← hc, Algebra.smul_def, ← _root_.map_mul]
specialize hu M' hM'.2
simp_rw [Ideal.mem_iInf, Finset.mem_erase] at hu
-- Note: #8386 had to specify the value of `f`
exact Submodule.mem_map_of_mem (f := Algebra.linearMap _ _)
(M.mul_mem_right _ <| hu M ⟨hM'.1.symm, hM⟩)
| 0 |
import Mathlib.Algebra.Algebra.RestrictScalars
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic
import Mathlib.Analysis.RCLike.Basic
#align_import analysis.normed_space.extend from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open RCLike
open ComplexConjugate
variable {𝕜 : Type*} [RCLike 𝕜] {F : Type*} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F]
namespace LinearMap
variable [Module ℝ F] [IsScalarTower ℝ 𝕜 F]
noncomputable def extendTo𝕜' (fr : F →ₗ[ℝ] ℝ) : F →ₗ[𝕜] 𝕜 := by
let fc : F → 𝕜 := fun x => (fr x : 𝕜) - (I : 𝕜) * fr ((I : 𝕜) • x)
have add : ∀ x y : F, fc (x + y) = fc x + fc y := by
intro x y
simp only [fc, smul_add, LinearMap.map_add, ofReal_add]
rw [mul_add]
abel
have A : ∀ (c : ℝ) (x : F), (fr ((c : 𝕜) • x) : 𝕜) = (c : 𝕜) * (fr x : 𝕜) := by
intro c x
rw [← ofReal_mul]
congr 1
rw [RCLike.ofReal_alg, smul_assoc, fr.map_smul, Algebra.id.smul_eq_mul, one_smul]
have smul_ℝ : ∀ (c : ℝ) (x : F), fc ((c : 𝕜) • x) = (c : 𝕜) * fc x := by
intro c x
dsimp only [fc]
rw [A c x, smul_smul, mul_comm I (c : 𝕜), ← smul_smul, A, mul_sub]
ring
have smul_I : ∀ x : F, fc ((I : 𝕜) • x) = (I : 𝕜) * fc x := by
intro x
dsimp only [fc]
cases' @I_mul_I_ax 𝕜 _ with h h
· simp [h]
rw [mul_sub, ← mul_assoc, smul_smul, h]
simp only [neg_mul, LinearMap.map_neg, one_mul, one_smul, mul_neg, ofReal_neg, neg_smul,
sub_neg_eq_add, add_comm]
have smul_𝕜 : ∀ (c : 𝕜) (x : F), fc (c • x) = c • fc x := by
intro c x
rw [← re_add_im c, add_smul, add_smul, add, smul_ℝ, ← smul_smul, smul_ℝ, smul_I, ← mul_assoc]
rfl
exact
{ toFun := fc
map_add' := add
map_smul' := smul_𝕜 }
#align linear_map.extend_to_𝕜' LinearMap.extendTo𝕜'
theorem extendTo𝕜'_apply (fr : F →ₗ[ℝ] ℝ) (x : F) :
fr.extendTo𝕜' x = (fr x : 𝕜) - (I : 𝕜) * (fr ((I : 𝕜) • x) : 𝕜) := rfl
#align linear_map.extend_to_𝕜'_apply LinearMap.extendTo𝕜'_apply
@[simp]
theorem extendTo𝕜'_apply_re (fr : F →ₗ[ℝ] ℝ) (x : F) : re (fr.extendTo𝕜' x : 𝕜) = fr x := by
simp only [extendTo𝕜'_apply, map_sub, zero_mul, mul_zero, sub_zero,
rclike_simps]
#align linear_map.extend_to_𝕜'_apply_re LinearMap.extendTo𝕜'_apply_re
| Mathlib/Analysis/NormedSpace/Extend.lean | 93 | 99 | theorem norm_extendTo𝕜'_apply_sq (fr : F →ₗ[ℝ] ℝ) (x : F) :
‖(fr.extendTo𝕜' x : 𝕜)‖ ^ 2 = fr (conj (fr.extendTo𝕜' x : 𝕜) • x) :=
calc
‖(fr.extendTo𝕜' x : 𝕜)‖ ^ 2 = re (conj (fr.extendTo𝕜' x) * fr.extendTo𝕜' x : 𝕜) := by |
rw [RCLike.conj_mul, ← ofReal_pow, ofReal_re]
_ = fr (conj (fr.extendTo𝕜' x : 𝕜) • x) := by
rw [← smul_eq_mul, ← map_smul, extendTo𝕜'_apply_re]
| 0 |
import Mathlib.Data.Nat.Squarefree
import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity
import Mathlib.Tactic.LinearCombination
#align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
section NegOneSquare
-- This could be formulated for a general integer `a` in place of `-1`,
-- but it would not directly specialize to `-1`,
-- because `((-1 : ℤ) : ZMod n)` is not the same as `(-1 : ZMod n)`.
theorem ZMod.isSquare_neg_one_of_dvd {m n : ℕ} (hd : m ∣ n) (hs : IsSquare (-1 : ZMod n)) :
IsSquare (-1 : ZMod m) := by
let f : ZMod n →+* ZMod m := ZMod.castHom hd _
rw [← RingHom.map_one f, ← RingHom.map_neg]
exact hs.map f
#align zmod.is_square_neg_one_of_dvd ZMod.isSquare_neg_one_of_dvd
| Mathlib/NumberTheory/SumTwoSquares.lean | 86 | 94 | theorem ZMod.isSquare_neg_one_mul {m n : ℕ} (hc : m.Coprime n) (hm : IsSquare (-1 : ZMod m))
(hn : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod (m * n)) := by |
have : IsSquare (-1 : ZMod m × ZMod n) := by
rw [show (-1 : ZMod m × ZMod n) = ((-1 : ZMod m), (-1 : ZMod n)) from rfl]
obtain ⟨x, hx⟩ := hm
obtain ⟨y, hy⟩ := hn
rw [hx, hy]
exact ⟨(x, y), rfl⟩
simpa only [RingEquiv.map_neg_one] using this.map (ZMod.chineseRemainder hc).symm
| 0 |
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Algebra.LinearRecurrence
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.Prime
#align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open Polynomial
abbrev goldenRatio : ℝ := (1 + √5) / 2
#align golden_ratio goldenRatio
abbrev goldenConj : ℝ := (1 - √5) / 2
#align golden_conj goldenConj
@[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio
@[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj
open Real goldenRatio
theorem inv_gold : φ⁻¹ = -ψ := by
have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
field_simp [sub_mul, mul_add]
norm_num
#align inv_gold inv_gold
theorem inv_goldConj : ψ⁻¹ = -φ := by
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
exact inv_gold.symm
#align inv_gold_conj inv_goldConj
@[simp]
theorem gold_mul_goldConj : φ * ψ = -1 := by
field_simp
rw [← sq_sub_sq]
norm_num
#align gold_mul_gold_conj gold_mul_goldConj
@[simp]
theorem goldConj_mul_gold : ψ * φ = -1 := by
rw [mul_comm]
exact gold_mul_goldConj
#align gold_conj_mul_gold goldConj_mul_gold
@[simp]
theorem gold_add_goldConj : φ + ψ = 1 := by
rw [goldenRatio, goldenConj]
ring
#align gold_add_gold_conj gold_add_goldConj
theorem one_sub_goldConj : 1 - φ = ψ := by
linarith [gold_add_goldConj]
#align one_sub_gold_conj one_sub_goldConj
theorem one_sub_gold : 1 - ψ = φ := by
linarith [gold_add_goldConj]
#align one_sub_gold one_sub_gold
@[simp]
theorem gold_sub_goldConj : φ - ψ = √5 := by ring
#align gold_sub_gold_conj gold_sub_goldConj
theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2) - φ ^ (n + 1) = φ ^ n := by
rw [goldenRatio]; ring_nf; norm_num; ring
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
rw [goldenRatio, ← sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_sq gold_sq
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
rw [goldenConj, ← sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_conj_sq goldConj_sq
theorem gold_pos : 0 < φ :=
mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two
#align gold_pos gold_pos
theorem gold_ne_zero : φ ≠ 0 :=
ne_of_gt gold_pos
#align gold_ne_zero gold_ne_zero
theorem one_lt_gold : 1 < φ := by
refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos)
simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow`
#align one_lt_gold one_lt_gold
theorem gold_lt_two : φ < 2 := by calc
(1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num
_ = 2 := by norm_num
theorem goldConj_neg : ψ < 0 := by
linarith [one_sub_goldConj, one_lt_gold]
#align gold_conj_neg goldConj_neg
theorem goldConj_ne_zero : ψ ≠ 0 :=
ne_of_lt goldConj_neg
#align gold_conj_ne_zero goldConj_ne_zero
theorem neg_one_lt_goldConj : -1 < ψ := by
rw [neg_lt, ← inv_gold]
exact inv_lt_one one_lt_gold
#align neg_one_lt_gold_conj neg_one_lt_goldConj
theorem gold_irrational : Irrational φ := by
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
have := this.rat_add 1
have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
convert this
norm_num
field_simp
#align gold_irrational gold_irrational
theorem goldConj_irrational : Irrational ψ := by
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
have := this.rat_sub 1
have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
convert this
norm_num
field_simp
#align gold_conj_irrational goldConj_irrational
section Fibrec
variable {α : Type*} [CommSemiring α]
def fibRec : LinearRecurrence α where
order := 2
coeffs := ![1, 1]
#align fib_rec fibRec
| Mathlib/Data/Real/GoldenRatio.lean | 187 | 192 | theorem fib_isSol_fibRec : fibRec.IsSolution (fun x => x.fib : ℕ → α) := by |
rw [fibRec]
intro n
simp only
rw [Nat.fib_add_two, add_comm]
simp [Finset.sum_fin_eq_sum_range, Finset.sum_range_succ']
| 0 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Algebra.Ring.Rat
import Mathlib.Data.PNat.Defs
#align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
namespace Rat
open Rat
| Mathlib/Data/Rat/Lemmas.lean | 24 | 30 | theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by |
cases' e : a /. b with n d h c
rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e
refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <|
c.dvd_of_dvd_mul_right ?_
have := congr_arg Int.natAbs e
simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
| 0 |
import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.LocalExtr.Basic
#align_import analysis.calculus.darboux from "leanprover-community/mathlib"@"61b5e2755ccb464b68d05a9acf891ae04992d09d"
open Filter Set
open scoped Topology Classical
variable {a b : ℝ} {f f' : ℝ → ℝ}
| Mathlib/Analysis/Calculus/Darboux.lean | 28 | 60 | theorem exists_hasDerivWithinAt_eq_of_gt_of_lt (hab : a ≤ b)
(hf : ∀ x ∈ Icc a b, HasDerivWithinAt f (f' x) (Icc a b) x) {m : ℝ} (hma : f' a < m)
(hmb : m < f' b) : m ∈ f' '' Ioo a b := by |
rcases hab.eq_or_lt with (rfl | hab')
· exact (lt_asymm hma hmb).elim
set g : ℝ → ℝ := fun x => f x - m * x
have hg : ∀ x ∈ Icc a b, HasDerivWithinAt g (f' x - m) (Icc a b) x := by
intro x hx
simpa using (hf x hx).sub ((hasDerivWithinAt_id x _).const_mul m)
obtain ⟨c, cmem, hc⟩ : ∃ c ∈ Icc a b, IsMinOn g (Icc a b) c :=
isCompact_Icc.exists_isMinOn (nonempty_Icc.2 <| hab) fun x hx => (hg x hx).continuousWithinAt
have cmem' : c ∈ Ioo a b := by
rcases cmem.1.eq_or_lt with (rfl | hac)
-- Show that `c` can't be equal to `a`
· refine absurd (sub_nonneg.1 <| nonneg_of_mul_nonneg_right ?_ (sub_pos.2 hab'))
(not_le_of_lt hma)
have : b - a ∈ posTangentConeAt (Icc a b) a :=
mem_posTangentConeAt_of_segment_subset (segment_eq_Icc hab ▸ Subset.refl _)
simpa only [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply]
using hc.localize.hasFDerivWithinAt_nonneg (hg a (left_mem_Icc.2 hab)) this
rcases cmem.2.eq_or_gt with (rfl | hcb)
-- Show that `c` can't be equal to `b`
· refine absurd (sub_nonpos.1 <| nonpos_of_mul_nonneg_right ?_ (sub_lt_zero.2 hab'))
(not_le_of_lt hmb)
have : a - b ∈ posTangentConeAt (Icc a b) b :=
mem_posTangentConeAt_of_segment_subset (by rw [segment_symm, segment_eq_Icc hab])
simpa only [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply]
using hc.localize.hasFDerivWithinAt_nonneg (hg b (right_mem_Icc.2 hab)) this
exact ⟨hac, hcb⟩
use c, cmem'
rw [← sub_eq_zero]
have : Icc a b ∈ 𝓝 c := by rwa [← mem_interior_iff_mem_nhds, interior_Icc]
exact (hc.isLocalMin this).hasDerivAt_eq_zero ((hg c cmem).hasDerivAt this)
| 0 |
import Mathlib.NumberTheory.Divisors
import Mathlib.Data.Nat.Digits
import Mathlib.Data.Nat.MaxPowDiv
import Mathlib.Data.Nat.Multiplicity
import Mathlib.Tactic.IntervalCases
#align_import number_theory.padics.padic_val from "leanprover-community/mathlib"@"60fa54e778c9e85d930efae172435f42fb0d71f7"
universe u
open Nat
open Rat
open multiplicity
def padicValNat (p : ℕ) (n : ℕ) : ℕ :=
if h : p ≠ 1 ∧ 0 < n then (multiplicity p n).get (multiplicity.finite_nat_iff.2 h) else 0
#align padic_val_nat padicValNat
namespace padicValNat
open multiplicity
variable {p : ℕ}
@[simp]
protected theorem zero : padicValNat p 0 = 0 := by simp [padicValNat]
#align padic_val_nat.zero padicValNat.zero
@[simp]
protected theorem one : padicValNat p 1 = 0 := by
unfold padicValNat
split_ifs
· simp
· rfl
#align padic_val_nat.one padicValNat.one
@[simp]
| Mathlib/NumberTheory/Padics/PadicVal.lean | 101 | 104 | theorem self (hp : 1 < p) : padicValNat p p = 1 := by |
have neq_one : ¬p = 1 ↔ True := iff_of_true hp.ne' trivial
have eq_zero_false : p = 0 ↔ False := iff_false_intro (zero_lt_one.trans hp).ne'
simp [padicValNat, neq_one, eq_zero_false]
| 0 |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Field.Rat
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Field.Rat
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.SetFamily.Shadow
#align_import combinatorics.set_family.lym from "leanprover-community/mathlib"@"861a26926586cd46ff80264d121cdb6fa0e35cc1"
open Finset Nat
open FinsetFamily
variable {𝕜 α : Type*} [LinearOrderedField 𝕜]
namespace Finset
section LocalLYM
variable [DecidableEq α] [Fintype α]
{𝒜 : Finset (Finset α)} {r : ℕ}
theorem card_mul_le_card_shadow_mul (h𝒜 : (𝒜 : Set (Finset α)).Sized r) :
𝒜.card * r ≤ (∂ 𝒜).card * (Fintype.card α - r + 1) := by
let i : DecidableRel ((· ⊆ ·) : Finset α → Finset α → Prop) := fun _ _ => Classical.dec _
refine card_mul_le_card_mul' (· ⊆ ·) (fun s hs => ?_) (fun s hs => ?_)
· rw [← h𝒜 hs, ← card_image_of_injOn s.erase_injOn]
refine card_le_card ?_
simp_rw [image_subset_iff, mem_bipartiteBelow]
exact fun a ha => ⟨erase_mem_shadow hs ha, erase_subset _ _⟩
refine le_trans ?_ tsub_tsub_le_tsub_add
rw [← (Set.Sized.shadow h𝒜) hs, ← card_compl, ← card_image_of_injOn (insert_inj_on' _)]
refine card_le_card fun t ht => ?_
-- Porting note: commented out the following line
-- infer_instance
rw [mem_bipartiteAbove] at ht
have : ∅ ∉ 𝒜 := by
rw [← mem_coe, h𝒜.empty_mem_iff, coe_eq_singleton]
rintro rfl
rw [shadow_singleton_empty] at hs
exact not_mem_empty s hs
have h := exists_eq_insert_iff.2 ⟨ht.2, by
rw [(sized_shadow_iff this).1 (Set.Sized.shadow h𝒜) ht.1, (Set.Sized.shadow h𝒜) hs]⟩
rcases h with ⟨a, ha, rfl⟩
exact mem_image_of_mem _ (mem_compl.2 ha)
#align finset.card_mul_le_card_shadow_mul Finset.card_mul_le_card_shadow_mul
| Mathlib/Combinatorics/SetFamily/LYM.lean | 92 | 110 | theorem card_div_choose_le_card_shadow_div_choose (hr : r ≠ 0)
(h𝒜 : (𝒜 : Set (Finset α)).Sized r) : (𝒜.card : 𝕜) / (Fintype.card α).choose r
≤ (∂ 𝒜).card / (Fintype.card α).choose (r - 1) := by |
obtain hr' | hr' := lt_or_le (Fintype.card α) r
· rw [choose_eq_zero_of_lt hr', cast_zero, div_zero]
exact div_nonneg (cast_nonneg _) (cast_nonneg _)
replace h𝒜 := card_mul_le_card_shadow_mul h𝒜
rw [div_le_div_iff] <;> norm_cast
· cases' r with r
· exact (hr rfl).elim
rw [tsub_add_eq_add_tsub hr', add_tsub_add_eq_tsub_right] at h𝒜
apply le_of_mul_le_mul_right _ (pos_iff_ne_zero.2 hr)
convert Nat.mul_le_mul_right ((Fintype.card α).choose r) h𝒜 using 1
· simp [mul_assoc, Nat.choose_succ_right_eq]
exact Or.inl (mul_comm _ _)
· simp only [mul_assoc, choose_succ_right_eq, mul_eq_mul_left_iff]
exact Or.inl (mul_comm _ _)
· exact Nat.choose_pos hr'
· exact Nat.choose_pos (r.pred_le.trans hr')
| 0 |
import Mathlib.CategoryTheory.EffectiveEpi.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.Tactic.ApplyFun
namespace CategoryTheory
open Limits
variable {C : Type*} [Category C]
noncomputable
def effectiveEpiStructIsColimitDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C)
(c : Cofan X) (hc : IsColimit c) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π] :
EffectiveEpiStruct (hc.desc (Cofan.mk B π)) where
desc e h := EffectiveEpiFamily.desc X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e) (fun a₁ a₂ g₁ g₂ hg ↦ by
simp only [← Category.assoc]
exact h (g₁ ≫ c.ι.app ⟨a₁⟩) (g₂ ≫ c.ι.app ⟨a₂⟩) (by simpa))
fac e h := hc.hom_ext (fun ⟨j⟩ ↦ (by simp))
uniq e _ m hm := EffectiveEpiFamily.uniq X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e)
(fun _ _ _ _ hg ↦ (by simp [← hm, reassoc_of% hg])) m (fun _ ↦ (by simp [← hm]))
noncomputable
def effectiveEpiStructDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C)
(π : (a : α) → (X a ⟶ B)) [HasCoproduct X] [EffectiveEpiFamily X π] :
EffectiveEpiStruct (Sigma.desc π) := by
simpa [coproductIsCoproduct] using
effectiveEpiStructIsColimitDescOfEffectiveEpiFamily X _ (coproductIsCoproduct _) π
instance {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [HasCoproduct X]
[EffectiveEpiFamily X π] : EffectiveEpi (Sigma.desc π) :=
⟨⟨effectiveEpiStructDescOfEffectiveEpiFamily X π⟩⟩
example {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π]
[HasCoproduct X] : Epi (Sigma.desc π) := inferInstance
| Mathlib/CategoryTheory/EffectiveEpi/Coproduct.lean | 61 | 93 | theorem effectiveEpiFamilyStructOfEffectiveEpiDesc_aux {B : C} {α : Type*} {X : α → C}
{π : (a : α) → X a ⟶ B} [HasCoproduct X]
[∀ {Z : C} (g : Z ⟶ ∐ X) (a : α), HasPullback g (Sigma.ι X a)]
[∀ {Z : C} (g : Z ⟶ ∐ X), HasCoproduct fun a ↦ pullback g (Sigma.ι X a)]
[∀ {Z : C} (g : Z ⟶ ∐ X), Epi (Sigma.desc fun a ↦ pullback.fst (f := g) (g := (Sigma.ι X a)))]
{W : C} {e : (a : α) → X a ⟶ W} (h : ∀ {Z : C} (a₁ a₂ : α) (g₁ : Z ⟶ X a₁) (g₂ : Z ⟶ X a₂),
g₁ ≫ π a₁ = g₂ ≫ π a₂ → g₁ ≫ e a₁ = g₂ ≫ e a₂) {Z : C}
{g₁ g₂ : Z ⟶ ∐ fun b ↦ X b} (hg : g₁ ≫ Sigma.desc π = g₂ ≫ Sigma.desc π) :
g₁ ≫ Sigma.desc e = g₂ ≫ Sigma.desc e := by |
apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := g₁) (g := (Sigma.ι X a))) ≫ ·) using
(fun a b ↦ (cancel_epi _).mp)
ext a
simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app]
rw [← Category.assoc, pullback.condition]
simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ g₂)
(g := (Sigma.ι X a))) ≫ ·) using (fun a b ↦ (cancel_epi _).mp)
ext b
simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app]
simp only [← Category.assoc]
rw [(Category.assoc _ _ g₂), pullback.condition]
simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
rw [← Category.assoc]
apply h
apply_fun (pullback.fst (f := g₁) (g := (Sigma.ι X a)) ≫ ·) at hg
rw [← Category.assoc, pullback.condition] at hg
simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] at hg
apply_fun ((Sigma.ι (fun a ↦ pullback _ _) b) ≫ (Sigma.desc fun a ↦ pullback.fst
(f := pullback.fst ≫ g₂) (g := (Sigma.ι X a))) ≫ ·) at hg
simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] at hg
simp only [← Category.assoc] at hg
rw [(Category.assoc _ _ g₂), pullback.condition] at hg
simpa using hg
| 0 |
import Mathlib.Probability.Kernel.Composition
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import probability.kernel.integral_comp_prod from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113"
noncomputable section
open scoped Topology ENNReal MeasureTheory ProbabilityTheory
open Set Function Real ENNReal MeasureTheory Filter ProbabilityTheory ProbabilityTheory.kernel
variable {α β γ E : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{mγ : MeasurableSpace γ} [NormedAddCommGroup E] {κ : kernel α β} [IsSFiniteKernel κ]
{η : kernel (α × β) γ} [IsSFiniteKernel η] {a : α}
namespace ProbabilityTheory
theorem hasFiniteIntegral_prod_mk_left (a : α) {s : Set (β × γ)} (h2s : (κ ⊗ₖ η) a s ≠ ∞) :
HasFiniteIntegral (fun b => (η (a, b) (Prod.mk b ⁻¹' s)).toReal) (κ a) := by
let t := toMeasurable ((κ ⊗ₖ η) a) s
simp_rw [HasFiniteIntegral, ennnorm_eq_ofReal toReal_nonneg]
calc
∫⁻ b, ENNReal.ofReal (η (a, b) (Prod.mk b ⁻¹' s)).toReal ∂κ a
_ ≤ ∫⁻ b, η (a, b) (Prod.mk b ⁻¹' t) ∂κ a := by
refine lintegral_mono_ae ?_
filter_upwards [ae_kernel_lt_top a h2s] with b hb
rw [ofReal_toReal hb.ne]
exact measure_mono (preimage_mono (subset_toMeasurable _ _))
_ ≤ (κ ⊗ₖ η) a t := le_compProd_apply _ _ _ _
_ = (κ ⊗ₖ η) a s := measure_toMeasurable s
_ < ⊤ := h2s.lt_top
#align probability_theory.has_finite_integral_prod_mk_left ProbabilityTheory.hasFiniteIntegral_prod_mk_left
theorem integrable_kernel_prod_mk_left (a : α) {s : Set (β × γ)} (hs : MeasurableSet s)
(h2s : (κ ⊗ₖ η) a s ≠ ∞) : Integrable (fun b => (η (a, b) (Prod.mk b ⁻¹' s)).toReal) (κ a) := by
constructor
· exact (measurable_kernel_prod_mk_left' hs a).ennreal_toReal.aestronglyMeasurable
· exact hasFiniteIntegral_prod_mk_left a h2s
#align probability_theory.integrable_kernel_prod_mk_left ProbabilityTheory.integrable_kernel_prod_mk_left
theorem _root_.MeasureTheory.AEStronglyMeasurable.integral_kernel_compProd [NormedSpace ℝ E]
⦃f : β × γ → E⦄ (hf : AEStronglyMeasurable f ((κ ⊗ₖ η) a)) :
AEStronglyMeasurable (fun x => ∫ y, f (x, y) ∂η (a, x)) (κ a) :=
⟨fun x => ∫ y, hf.mk f (x, y) ∂η (a, x), hf.stronglyMeasurable_mk.integral_kernel_prod_right'', by
filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with _ hx using integral_congr_ae hx⟩
#align measure_theory.ae_strongly_measurable.integral_kernel_comp_prod MeasureTheory.AEStronglyMeasurable.integral_kernel_compProd
theorem _root_.MeasureTheory.AEStronglyMeasurable.compProd_mk_left {δ : Type*} [TopologicalSpace δ]
{f : β × γ → δ} (hf : AEStronglyMeasurable f ((κ ⊗ₖ η) a)) :
∀ᵐ x ∂κ a, AEStronglyMeasurable (fun y => f (x, y)) (η (a, x)) := by
filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with x hx using
⟨fun y => hf.mk f (x, y), hf.stronglyMeasurable_mk.comp_measurable measurable_prod_mk_left, hx⟩
#align measure_theory.ae_strongly_measurable.comp_prod_mk_left MeasureTheory.AEStronglyMeasurable.compProd_mk_left
| Mathlib/Probability/Kernel/IntegralCompProd.lean | 88 | 104 | theorem hasFiniteIntegral_compProd_iff ⦃f : β × γ → E⦄ (h1f : StronglyMeasurable f) :
HasFiniteIntegral f ((κ ⊗ₖ η) a) ↔
(∀ᵐ x ∂κ a, HasFiniteIntegral (fun y => f (x, y)) (η (a, x))) ∧
HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂η (a, x)) (κ a) := by |
simp only [HasFiniteIntegral]
rw [kernel.lintegral_compProd _ _ _ h1f.ennnorm]
have : ∀ x, ∀ᵐ y ∂η (a, x), 0 ≤ ‖f (x, y)‖ := fun x => eventually_of_forall fun y => norm_nonneg _
simp_rw [integral_eq_lintegral_of_nonneg_ae (this _)
(h1f.norm.comp_measurable measurable_prod_mk_left).aestronglyMeasurable,
ennnorm_eq_ofReal toReal_nonneg, ofReal_norm_eq_coe_nnnorm]
have : ∀ {p q r : Prop} (_ : r → p), (r ↔ p ∧ q) ↔ p → (r ↔ q) := fun {p q r} h1 => by
rw [← and_congr_right_iff, and_iff_right_of_imp h1]
rw [this]
· intro h2f; rw [lintegral_congr_ae]
filter_upwards [h2f] with x hx
rw [ofReal_toReal]; rw [← lt_top_iff_ne_top]; exact hx
· intro h2f; refine ae_lt_top ?_ h2f.ne; exact h1f.ennnorm.lintegral_kernel_prod_right''
| 0 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
open List
def Cycle (α : Type*) : Type _ :=
Quotient (IsRotated.setoid α)
#align cycle Cycle
namespace Cycle
variable {α : Type*}
-- Porting note (#11445): new definition
@[coe] def ofList : List α → Cycle α :=
Quot.mk _
instance : Coe (List α) (Cycle α) :=
⟨ofList⟩
@[simp]
theorem coe_eq_coe {l₁ l₂ : List α} : (l₁ : Cycle α) = (l₂ : Cycle α) ↔ l₁ ~r l₂ :=
@Quotient.eq _ (IsRotated.setoid _) _ _
#align cycle.coe_eq_coe Cycle.coe_eq_coe
@[simp]
theorem mk_eq_coe (l : List α) : Quot.mk _ l = (l : Cycle α) :=
rfl
#align cycle.mk_eq_coe Cycle.mk_eq_coe
@[simp]
theorem mk''_eq_coe (l : List α) : Quotient.mk'' l = (l : Cycle α) :=
rfl
#align cycle.mk'_eq_coe Cycle.mk''_eq_coe
theorem coe_cons_eq_coe_append (l : List α) (a : α) :
(↑(a :: l) : Cycle α) = (↑(l ++ [a]) : Cycle α) :=
Quot.sound ⟨1, by rw [rotate_cons_succ, rotate_zero]⟩
#align cycle.coe_cons_eq_coe_append Cycle.coe_cons_eq_coe_append
def nil : Cycle α :=
([] : List α)
#align cycle.nil Cycle.nil
@[simp]
theorem coe_nil : ↑([] : List α) = @nil α :=
rfl
#align cycle.coe_nil Cycle.coe_nil
@[simp]
theorem coe_eq_nil (l : List α) : (l : Cycle α) = nil ↔ l = [] :=
coe_eq_coe.trans isRotated_nil_iff
#align cycle.coe_eq_nil Cycle.coe_eq_nil
instance : EmptyCollection (Cycle α) :=
⟨nil⟩
@[simp]
theorem empty_eq : ∅ = @nil α :=
rfl
#align cycle.empty_eq Cycle.empty_eq
instance : Inhabited (Cycle α) :=
⟨nil⟩
@[elab_as_elim]
theorem induction_on {C : Cycle α → Prop} (s : Cycle α) (H0 : C nil)
(HI : ∀ (a) (l : List α), C ↑l → C ↑(a :: l)) : C s :=
Quotient.inductionOn' s fun l => by
refine List.recOn l ?_ ?_ <;> simp
assumption'
#align cycle.induction_on Cycle.induction_on
def Mem (a : α) (s : Cycle α) : Prop :=
Quot.liftOn s (fun l => a ∈ l) fun _ _ e => propext <| e.mem_iff
#align cycle.mem Cycle.Mem
instance : Membership α (Cycle α) :=
⟨Mem⟩
@[simp]
theorem mem_coe_iff {a : α} {l : List α} : a ∈ (↑l : Cycle α) ↔ a ∈ l :=
Iff.rfl
#align cycle.mem_coe_iff Cycle.mem_coe_iff
@[simp]
theorem not_mem_nil : ∀ a, a ∉ @nil α :=
List.not_mem_nil
#align cycle.not_mem_nil Cycle.not_mem_nil
instance [DecidableEq α] : DecidableEq (Cycle α) := fun s₁ s₂ =>
Quotient.recOnSubsingleton₂' s₁ s₂ fun _ _ => decidable_of_iff' _ Quotient.eq''
instance [DecidableEq α] (x : α) (s : Cycle α) : Decidable (x ∈ s) :=
Quotient.recOnSubsingleton' s fun l => show Decidable (x ∈ l) from inferInstance
nonrec def reverse (s : Cycle α) : Cycle α :=
Quot.map reverse (fun _ _ => IsRotated.reverse) s
#align cycle.reverse Cycle.reverse
@[simp]
theorem reverse_coe (l : List α) : (l : Cycle α).reverse = l.reverse :=
rfl
#align cycle.reverse_coe Cycle.reverse_coe
@[simp]
theorem mem_reverse_iff {a : α} {s : Cycle α} : a ∈ s.reverse ↔ a ∈ s :=
Quot.inductionOn s fun _ => mem_reverse
#align cycle.mem_reverse_iff Cycle.mem_reverse_iff
@[simp]
theorem reverse_reverse (s : Cycle α) : s.reverse.reverse = s :=
Quot.inductionOn s fun _ => by simp
#align cycle.reverse_reverse Cycle.reverse_reverse
@[simp]
theorem reverse_nil : nil.reverse = @nil α :=
rfl
#align cycle.reverse_nil Cycle.reverse_nil
def length (s : Cycle α) : ℕ :=
Quot.liftOn s List.length fun _ _ e => e.perm.length_eq
#align cycle.length Cycle.length
@[simp]
theorem length_coe (l : List α) : length (l : Cycle α) = l.length :=
rfl
#align cycle.length_coe Cycle.length_coe
@[simp]
theorem length_nil : length (@nil α) = 0 :=
rfl
#align cycle.length_nil Cycle.length_nil
@[simp]
theorem length_reverse (s : Cycle α) : s.reverse.length = s.length :=
Quot.inductionOn s List.length_reverse
#align cycle.length_reverse Cycle.length_reverse
def Subsingleton (s : Cycle α) : Prop :=
s.length ≤ 1
#align cycle.subsingleton Cycle.Subsingleton
theorem subsingleton_nil : Subsingleton (@nil α) := Nat.zero_le _
#align cycle.subsingleton_nil Cycle.subsingleton_nil
theorem length_subsingleton_iff {s : Cycle α} : Subsingleton s ↔ length s ≤ 1 :=
Iff.rfl
#align cycle.length_subsingleton_iff Cycle.length_subsingleton_iff
@[simp]
theorem subsingleton_reverse_iff {s : Cycle α} : s.reverse.Subsingleton ↔ s.Subsingleton := by
simp [length_subsingleton_iff]
#align cycle.subsingleton_reverse_iff Cycle.subsingleton_reverse_iff
| Mathlib/Data/List/Cycle.lean | 605 | 610 | theorem Subsingleton.congr {s : Cycle α} (h : Subsingleton s) :
∀ ⦃x⦄ (_hx : x ∈ s) ⦃y⦄ (_hy : y ∈ s), x = y := by |
induction' s using Quot.inductionOn with l
simp only [length_subsingleton_iff, length_coe, mk_eq_coe, le_iff_lt_or_eq, Nat.lt_add_one_iff,
length_eq_zero, length_eq_one, Nat.not_lt_zero, false_or_iff] at h
rcases h with (rfl | ⟨z, rfl⟩) <;> simp
| 0 |
import Mathlib.Data.Nat.Prime
import Mathlib.Tactic.NormNum.Basic
#align_import data.nat.prime_norm_num from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
open Nat Qq Lean Meta
namespace Mathlib.Meta.NormNum
theorem not_prime_mul_of_ble (a b n : ℕ) (h : a * b = n) (h₁ : a.ble 1 = false)
(h₂ : b.ble 1 = false) : ¬ n.Prime :=
not_prime_mul' h (ble_eq_false.mp h₁).ne' (ble_eq_false.mp h₂).ne'
def deriveNotPrime (n d : ℕ) (en : Q(ℕ)) : Q(¬ Nat.Prime $en) := Id.run <| do
let d' : ℕ := n / d
let prf : Q($d * $d' = $en) := (q(Eq.refl $en) : Expr)
let r : Q(Nat.ble $d 1 = false) := (q(Eq.refl false) : Expr)
let r' : Q(Nat.ble $d' 1 = false) := (q(Eq.refl false) : Expr)
return q(not_prime_mul_of_ble _ _ _ $prf $r $r')
def MinFacHelper (n k : ℕ) : Prop :=
2 < k ∧ k % 2 = 1 ∧ k ≤ minFac n
theorem MinFacHelper.one_lt {n k : ℕ} (h : MinFacHelper n k) : 1 < n := by
have : 2 < minFac n := h.1.trans_le h.2.2
obtain rfl | h := n.eq_zero_or_pos
· contradiction
rcases (succ_le_of_lt h).eq_or_lt with rfl|h
· simp_all
exact h
theorem minFacHelper_0 (n : ℕ)
(h1 : Nat.ble (nat_lit 2) n = true) (h2 : nat_lit 1 = n % (nat_lit 2)) :
MinFacHelper n (nat_lit 3) := by
refine ⟨by norm_num, by norm_num, ?_⟩
refine (le_minFac'.mpr λ p hp hpn ↦ ?_).resolve_left (Nat.ne_of_gt (Nat.le_of_ble_eq_true h1))
rcases hp.eq_or_lt with rfl|h
· simp [(Nat.dvd_iff_mod_eq_zero ..).1 hpn] at h2
· exact h
| Mathlib/Tactic/NormNum/Prime.lean | 67 | 82 | theorem minFacHelper_1 {n k k' : ℕ} (e : k + 2 = k') (h : MinFacHelper n k)
(np : minFac n ≠ k) : MinFacHelper n k' := by |
rw [← e]
refine ⟨Nat.lt_add_right _ h.1, ?_, ?_⟩
· rw [add_mod, mod_self, add_zero, mod_mod]
exact h.2.1
rcases h.2.2.eq_or_lt with rfl|h2
· exact (np rfl).elim
rcases (succ_le_of_lt h2).eq_or_lt with h2|h2
· refine ((h.1.trans_le h.2.2).ne ?_).elim
have h3 : 2 ∣ minFac n := by
rw [Nat.dvd_iff_mod_eq_zero, ← h2, succ_eq_add_one, add_mod, h.2.1]
rw [dvd_prime <| minFac_prime h.one_lt.ne'] at h3
norm_num at h3
exact h3
exact h2
| 0 |
import Mathlib.Geometry.Manifold.Diffeomorph
import Mathlib.Geometry.Manifold.Instances.Real
import Mathlib.Geometry.Manifold.PartitionOfUnity
#align_import geometry.manifold.whitney_embedding from "leanprover-community/mathlib"@"86c29aefdba50b3f33e86e52e3b2f51a0d8f0282"
universe uι uE uH uM
variable {ι : Type uι} {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E]
[FiniteDimensional ℝ E] {H : Type uH} [TopologicalSpace H] {I : ModelWithCorners ℝ E H}
{M : Type uM} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M]
open Function Filter FiniteDimensional Set
open scoped Topology Manifold Classical Filter
noncomputable section
namespace SmoothBumpCovering
variable [T2Space M] [hi : Fintype ι] {s : Set M} (f : SmoothBumpCovering ι I M s)
def embeddingPiTangent : C^∞⟮I, M; 𝓘(ℝ, ι → E × ℝ), ι → E × ℝ⟯ where
val x i := (f i x • extChartAt I (f.c i) x, f i x)
property :=
contMDiff_pi_space.2 fun i =>
((f i).smooth_smul contMDiffOn_extChartAt).prod_mk_space (f i).smooth
#align smooth_bump_covering.embedding_pi_tangent SmoothBumpCovering.embeddingPiTangent
@[local simp]
theorem embeddingPiTangent_coe :
⇑f.embeddingPiTangent = fun x i => (f i x • extChartAt I (f.c i) x, f i x) :=
rfl
#align smooth_bump_covering.embedding_pi_tangent_coe SmoothBumpCovering.embeddingPiTangent_coe
theorem embeddingPiTangent_injOn : InjOn f.embeddingPiTangent s := by
intro x hx y _ h
simp only [embeddingPiTangent_coe, funext_iff] at h
obtain ⟨h₁, h₂⟩ := Prod.mk.inj_iff.1 (h (f.ind x hx))
rw [f.apply_ind x hx] at h₂
rw [← h₂, f.apply_ind x hx, one_smul, one_smul] at h₁
have := f.mem_extChartAt_source_of_eq_one h₂.symm
exact (extChartAt I (f.c _)).injOn (f.mem_extChartAt_ind_source x hx) this h₁
#align smooth_bump_covering.embedding_pi_tangent_inj_on SmoothBumpCovering.embeddingPiTangent_injOn
theorem embeddingPiTangent_injective (f : SmoothBumpCovering ι I M) :
Injective f.embeddingPiTangent :=
injective_iff_injOn_univ.2 f.embeddingPiTangent_injOn
#align smooth_bump_covering.embedding_pi_tangent_injective SmoothBumpCovering.embeddingPiTangent_injective
theorem comp_embeddingPiTangent_mfderiv (x : M) (hx : x ∈ s) :
((ContinuousLinearMap.fst ℝ E ℝ).comp
(@ContinuousLinearMap.proj ℝ _ ι (fun _ => E × ℝ) _ _ (fun _ => inferInstance)
(f.ind x hx))).comp
(mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) =
mfderiv I I (chartAt H (f.c (f.ind x hx))) x := by
set L :=
(ContinuousLinearMap.fst ℝ E ℝ).comp
(@ContinuousLinearMap.proj ℝ _ ι (fun _ => E × ℝ) _ _ (fun _ => inferInstance) (f.ind x hx))
have := L.hasMFDerivAt.comp x f.embeddingPiTangent.smooth.mdifferentiableAt.hasMFDerivAt
convert hasMFDerivAt_unique this _
refine (hasMFDerivAt_extChartAt I (f.mem_chartAt_ind_source x hx)).congr_of_eventuallyEq ?_
refine (f.eventuallyEq_one x hx).mono fun y hy => ?_
simp only [L, embeddingPiTangent_coe, ContinuousLinearMap.coe_comp', (· ∘ ·),
ContinuousLinearMap.coe_fst', ContinuousLinearMap.proj_apply]
rw [hy, Pi.one_apply, one_smul]
#align smooth_bump_covering.comp_embedding_pi_tangent_mfderiv SmoothBumpCovering.comp_embeddingPiTangent_mfderiv
theorem embeddingPiTangent_ker_mfderiv (x : M) (hx : x ∈ s) :
LinearMap.ker (mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) = ⊥ := by
apply bot_unique
rw [← (mdifferentiable_chart I (f.c (f.ind x hx))).ker_mfderiv_eq_bot
(f.mem_chartAt_ind_source x hx),
← comp_embeddingPiTangent_mfderiv]
exact LinearMap.ker_le_ker_comp _ _
#align smooth_bump_covering.embedding_pi_tangent_ker_mfderiv SmoothBumpCovering.embeddingPiTangent_ker_mfderiv
theorem embeddingPiTangent_injective_mfderiv (x : M) (hx : x ∈ s) :
Injective (mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) :=
LinearMap.ker_eq_bot.1 (f.embeddingPiTangent_ker_mfderiv x hx)
#align smooth_bump_covering.embedding_pi_tangent_injective_mfderiv SmoothBumpCovering.embeddingPiTangent_injective_mfderiv
| Mathlib/Geometry/Manifold/WhitneyEmbedding.lean | 118 | 133 | theorem exists_immersion_euclidean [Finite ι] (f : SmoothBumpCovering ι I M) :
∃ (n : ℕ) (e : M → EuclideanSpace ℝ (Fin n)),
Smooth I (𝓡 n) e ∧ Injective e ∧ ∀ x : M, Injective (mfderiv I (𝓡 n) e x) := by |
cases nonempty_fintype ι
set F := EuclideanSpace ℝ (Fin <| finrank ℝ (ι → E × ℝ))
letI : IsNoetherian ℝ (E × ℝ) := IsNoetherian.iff_fg.2 inferInstance
letI : FiniteDimensional ℝ (ι → E × ℝ) := IsNoetherian.iff_fg.1 inferInstance
set eEF : (ι → E × ℝ) ≃L[ℝ] F :=
ContinuousLinearEquiv.ofFinrankEq finrank_euclideanSpace_fin.symm
refine ⟨_, eEF ∘ f.embeddingPiTangent,
eEF.toDiffeomorph.smooth.comp f.embeddingPiTangent.smooth,
eEF.injective.comp f.embeddingPiTangent_injective, fun x => ?_⟩
rw [mfderiv_comp _ eEF.differentiableAt.mdifferentiableAt
f.embeddingPiTangent.smooth.mdifferentiableAt,
eEF.mfderiv_eq]
exact eEF.injective.comp (f.embeddingPiTangent_injective_mfderiv _ trivial)
| 0 |
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Trace
import Mathlib.RingTheory.Norm
#align_import ring_theory.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
universe u v w z
open scoped Matrix
open Matrix FiniteDimensional Fintype Polynomial Finset IntermediateField
namespace Algebra
variable (A : Type u) {B : Type v} (C : Type z) {ι : Type w} [DecidableEq ι]
variable [CommRing A] [CommRing B] [Algebra A B] [CommRing C] [Algebra A C]
section Discr
-- Porting note: using `[DecidableEq ι]` instead of `by classical...` did not work in
-- mathlib3.
noncomputable def discr (A : Type u) {B : Type v} [CommRing A] [CommRing B] [Algebra A B]
[Fintype ι] (b : ι → B) := (traceMatrix A b).det
#align algebra.discr Algebra.discr
theorem discr_def [Fintype ι] (b : ι → B) : discr A b = (traceMatrix A b).det := rfl
variable {A C} in
theorem discr_eq_discr_of_algEquiv [Fintype ι] (b : ι → B) (f : B ≃ₐ[A] C) :
Algebra.discr A b = Algebra.discr A (f ∘ b) := by
rw [discr_def]; congr; ext
simp_rw [traceMatrix_apply, traceForm_apply, Function.comp, ← map_mul f, trace_eq_of_algEquiv]
#align algebra.discr_def Algebra.discr_def
variable {ι' : Type*} [Fintype ι'] [Fintype ι] [DecidableEq ι']
section Field
variable (K : Type u) {L : Type v} (E : Type z) [Field K] [Field L] [Field E]
variable [Algebra K L] [Algebra K E]
variable [Module.Finite K L] [IsAlgClosed E]
theorem discr_not_zero_of_basis [IsSeparable K L] (b : Basis ι K L) :
discr K b ≠ 0 := by
rw [discr_def, traceMatrix_of_basis, ← LinearMap.BilinForm.nondegenerate_iff_det_ne_zero]
exact traceForm_nondegenerate _ _
#align algebra.discr_not_zero_of_basis Algebra.discr_not_zero_of_basis
theorem discr_isUnit_of_basis [IsSeparable K L] (b : Basis ι K L) : IsUnit (discr K b) :=
IsUnit.mk0 _ (discr_not_zero_of_basis _ _)
#align algebra.discr_is_unit_of_basis Algebra.discr_isUnit_of_basis
variable (b : ι → L) (pb : PowerBasis K L)
| Mathlib/RingTheory/Discriminant.lean | 154 | 157 | theorem discr_eq_det_embeddingsMatrixReindex_pow_two [IsSeparable K L] (e : ι ≃ (L →ₐ[K] E)) :
algebraMap K E (discr K b) = (embeddingsMatrixReindex K E b e).det ^ 2 := by |
rw [discr_def, RingHom.map_det, RingHom.mapMatrix_apply,
traceMatrix_eq_embeddingsMatrixReindex_mul_trans, det_mul, det_transpose, pow_two]
| 0 |
import Mathlib.ModelTheory.Quotients
import Mathlib.Order.Filter.Germ
import Mathlib.Order.Filter.Ultrafilter
#align_import model_theory.ultraproducts from "leanprover-community/mathlib"@"f1ae620609496a37534c2ab3640b641d5be8b6f0"
universe u v
variable {α : Type*} (M : α → Type*) (u : Ultrafilter α)
open FirstOrder Filter
open Filter
namespace FirstOrder
namespace Language
open Structure
variable {L : Language.{u, v}} [∀ a, L.Structure (M a)]
namespace Ultraproduct
instance setoidPrestructure : L.Prestructure ((u : Filter α).productSetoid M) :=
{ (u : Filter α).productSetoid M with
toStructure :=
{ funMap := fun {n} f x a => funMap f fun i => x i a
RelMap := fun {n} r x => ∀ᶠ a : α in u, RelMap r fun i => x i a }
fun_equiv := fun {n} f x y xy => by
refine mem_of_superset (iInter_mem.2 xy) fun a ha => ?_
simp only [Set.mem_iInter, Set.mem_setOf_eq] at ha
simp only [Set.mem_setOf_eq, ha]
rel_equiv := fun {n} r x y xy => by
rw [← iff_eq_eq]
refine ⟨fun hx => ?_, fun hy => ?_⟩
· refine mem_of_superset (inter_mem hx (iInter_mem.2 xy)) ?_
rintro a ⟨ha1, ha2⟩
simp only [Set.mem_iInter, Set.mem_setOf_eq] at *
rw [← funext ha2]
exact ha1
· refine mem_of_superset (inter_mem hy (iInter_mem.2 xy)) ?_
rintro a ⟨ha1, ha2⟩
simp only [Set.mem_iInter, Set.mem_setOf_eq] at *
rw [funext ha2]
exact ha1 }
#align first_order.language.ultraproduct.setoid_prestructure FirstOrder.Language.Ultraproduct.setoidPrestructure
variable {M} {u}
instance «structure» : L.Structure ((u : Filter α).Product M) :=
Language.quotientStructure
set_option linter.uppercaseLean3 false in
#align first_order.language.ultraproduct.Structure FirstOrder.Language.Ultraproduct.structure
theorem funMap_cast {n : ℕ} (f : L.Functions n) (x : Fin n → ∀ a, M a) :
(funMap f fun i => (x i : (u : Filter α).Product M)) =
(fun a => funMap f fun i => x i a : (u : Filter α).Product M) := by
apply funMap_quotient_mk'
#align first_order.language.ultraproduct.fun_map_cast FirstOrder.Language.Ultraproduct.funMap_cast
| Mathlib/ModelTheory/Ultraproducts.lean | 83 | 91 | theorem term_realize_cast {β : Type*} (x : β → ∀ a, M a) (t : L.Term β) :
(t.realize fun i => (x i : (u : Filter α).Product M)) =
(fun a => t.realize fun i => x i a : (u : Filter α).Product M) := by |
convert @Term.realize_quotient_mk' L _ ((u : Filter α).productSetoid M)
(Ultraproduct.setoidPrestructure M u) _ t x using 2
ext a
induction t with
| var => rfl
| func _ _ t_ih => simp only [Term.realize, t_ih]; rfl
| 0 |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Order.Interval.Set.IsoIoo
import Mathlib.Topology.Order.MonotoneContinuity
import Mathlib.Topology.UrysohnsBounded
#align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
section TietzeExtensionClass
universe u u₁ u₂ v w
-- TODO: define *absolute retracts* and then prove they satisfy Tietze extension.
-- Then make instances of that instead and remove this class.
class TietzeExtension (Y : Type v) [TopologicalSpace Y] : Prop where
exists_restrict_eq' {X : Type u} [TopologicalSpace X] [NormalSpace X] (s : Set X)
(hs : IsClosed s) (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f
variable {X₁ : Type u₁} [TopologicalSpace X₁]
variable {X : Type u} [TopologicalSpace X] [NormalSpace X] {s : Set X} (hs : IsClosed s)
variable {e : X₁ → X} (he : ClosedEmbedding e)
variable {Y : Type v} [TopologicalSpace Y] [TietzeExtension.{u, v} Y]
theorem ContinuousMap.exists_restrict_eq (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f :=
TietzeExtension.exists_restrict_eq' s hs f
#align continuous_map.exists_restrict_eq_of_closed ContinuousMap.exists_restrict_eq
theorem ContinuousMap.exists_extension (f : C(X₁, Y)) :
∃ (g : C(X, Y)), g.comp ⟨e, he.continuous⟩ = f := by
let e' : X₁ ≃ₜ Set.range e := Homeomorph.ofEmbedding _ he.toEmbedding
obtain ⟨g, hg⟩ := (f.comp e'.symm).exists_restrict_eq he.isClosed_range
exact ⟨g, by ext x; simpa using congr($(hg) ⟨e' x, x, rfl⟩)⟩
theorem ContinuousMap.exists_extension' (f : C(X₁, Y)) : ∃ (g : C(X, Y)), g ∘ e = f :=
f.exists_extension he |>.imp fun g hg ↦ by ext x; congrm($(hg) x)
#align continuous_map.exists_extension_of_closed_embedding ContinuousMap.exists_extension'
| Mathlib/Topology/TietzeExtension.lean | 96 | 100 | theorem ContinuousMap.exists_forall_mem_restrict_eq {Y : Type v} [TopologicalSpace Y] (f : C(s, Y))
{t : Set Y} (hf : ∀ x, f x ∈ t) [ht : TietzeExtension.{u, v} t] :
∃ (g : C(X, Y)), (∀ x, g x ∈ t) ∧ g.restrict s = f := by |
obtain ⟨g, hg⟩ := mk _ (map_continuous f |>.codRestrict hf) |>.exists_restrict_eq hs
exact ⟨comp ⟨Subtype.val, by continuity⟩ g, by simp, by ext x; congrm(($(hg) x : Y))⟩
| 0 |
import Mathlib.Data.Rat.Cast.Defs
import Mathlib.Algebra.Field.Basic
#align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
namespace Rat
variable {α : Type*} [DivisionRing α]
-- Porting note: rewrote proof
@[simp]
theorem cast_inv_nat (n : ℕ) : ((n⁻¹ : ℚ) : α) = (n : α)⁻¹ := by
cases' n with n
· simp
rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero,
Int.sign_eq_one_of_pos (Nat.cast_pos.mpr n.succ_pos), Int.cast_one, one_div]
#align rat.cast_inv_nat Rat.cast_inv_nat
-- Porting note: proof got a lot easier - is this still the intended statement?
@[simp]
theorem cast_inv_int (n : ℤ) : ((n⁻¹ : ℚ) : α) = (n : α)⁻¹ := by
cases' n with n n
· simp [ofInt_eq_cast, cast_inv_nat]
· simp only [ofInt_eq_cast, Int.cast_negSucc, ← Nat.cast_succ, cast_neg, inv_neg, cast_inv_nat]
#align rat.cast_inv_int Rat.cast_inv_int
@[simp, norm_cast]
| Mathlib/Data/Rat/Cast/Lemmas.lean | 44 | 51 | theorem cast_nnratCast {K} [DivisionRing K] (q : ℚ≥0) :
((q : ℚ) : K) = (q : K) := by |
rw [Rat.cast_def, NNRat.cast_def, NNRat.cast_def]
have hn := @num_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den
on_goal 1 => have hd := @den_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den
case hdp => simpa only [Nat.cast_pos] using q.den_pos
simp only [Int.cast_natCast, Nat.cast_inj] at hn hd
rw [hn, hd, Int.cast_natCast]
| 0 |
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Order.Bounded
import Mathlib.SetTheory.Cardinal.PartENat
import Mathlib.SetTheory.Ordinal.Principal
import Mathlib.Tactic.Linarith
#align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f"
noncomputable section
open Function Set Cardinal Equiv Order Ordinal
open scoped Classical
universe u v w
namespace Cardinal
section UsingOrdinals
theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by
refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩
· rw [← Ordinal.le_zero, ord_le] at h
simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h
· rw [ord_le] at h ⊢
rwa [← @add_one_of_aleph0_le (card a), ← card_succ]
rw [← ord_le, ← le_succ_of_isLimit, ord_le]
· exact co.trans h
· rw [ord_aleph0]
exact omega_isLimit
#align cardinal.ord_is_limit Cardinal.ord_isLimit
theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α :=
Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2
section aleph
def alephIdx.initialSeg : @InitialSeg Cardinal Ordinal (· < ·) (· < ·) :=
@RelEmbedding.collapse Cardinal Ordinal (· < ·) (· < ·) _ Cardinal.ord.orderEmbedding.ltEmbedding
#align cardinal.aleph_idx.initial_seg Cardinal.alephIdx.initialSeg
def alephIdx : Cardinal → Ordinal :=
alephIdx.initialSeg
#align cardinal.aleph_idx Cardinal.alephIdx
@[simp]
theorem alephIdx.initialSeg_coe : (alephIdx.initialSeg : Cardinal → Ordinal) = alephIdx :=
rfl
#align cardinal.aleph_idx.initial_seg_coe Cardinal.alephIdx.initialSeg_coe
@[simp]
theorem alephIdx_lt {a b} : alephIdx a < alephIdx b ↔ a < b :=
alephIdx.initialSeg.toRelEmbedding.map_rel_iff
#align cardinal.aleph_idx_lt Cardinal.alephIdx_lt
@[simp]
theorem alephIdx_le {a b} : alephIdx a ≤ alephIdx b ↔ a ≤ b := by
rw [← not_lt, ← not_lt, alephIdx_lt]
#align cardinal.aleph_idx_le Cardinal.alephIdx_le
theorem alephIdx.init {a b} : b < alephIdx a → ∃ c, alephIdx c = b :=
alephIdx.initialSeg.init
#align cardinal.aleph_idx.init Cardinal.alephIdx.init
def alephIdx.relIso : @RelIso Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) :=
@RelIso.ofSurjective Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) alephIdx.initialSeg.{u} <|
(InitialSeg.eq_or_principal alephIdx.initialSeg.{u}).resolve_right fun ⟨o, e⟩ => by
have : ∀ c, alephIdx c < o := fun c => (e _).2 ⟨_, rfl⟩
refine Ordinal.inductionOn o ?_ this; intro α r _ h
let s := ⨆ a, invFun alephIdx (Ordinal.typein r a)
apply (lt_succ s).not_le
have I : Injective.{u+2, u+2} alephIdx := alephIdx.initialSeg.toEmbedding.injective
simpa only [typein_enum, leftInverse_invFun I (succ s)] using
le_ciSup
(Cardinal.bddAbove_range.{u, u} fun a : α => invFun alephIdx (Ordinal.typein r a))
(Ordinal.enum r _ (h (succ s)))
#align cardinal.aleph_idx.rel_iso Cardinal.alephIdx.relIso
@[simp]
theorem alephIdx.relIso_coe : (alephIdx.relIso : Cardinal → Ordinal) = alephIdx :=
rfl
#align cardinal.aleph_idx.rel_iso_coe Cardinal.alephIdx.relIso_coe
@[simp]
theorem type_cardinal : @type Cardinal (· < ·) _ = Ordinal.univ.{u, u + 1} := by
rw [Ordinal.univ_id]; exact Quotient.sound ⟨alephIdx.relIso⟩
#align cardinal.type_cardinal Cardinal.type_cardinal
@[simp]
theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by
simpa only [card_type, card_univ] using congr_arg card type_cardinal
#align cardinal.mk_cardinal Cardinal.mk_cardinal
def Aleph'.relIso :=
Cardinal.alephIdx.relIso.symm
#align cardinal.aleph'.rel_iso Cardinal.Aleph'.relIso
def aleph' : Ordinal → Cardinal :=
Aleph'.relIso
#align cardinal.aleph' Cardinal.aleph'
@[simp]
theorem aleph'.relIso_coe : (Aleph'.relIso : Ordinal → Cardinal) = aleph' :=
rfl
#align cardinal.aleph'.rel_iso_coe Cardinal.aleph'.relIso_coe
@[simp]
theorem aleph'_lt {o₁ o₂ : Ordinal} : aleph' o₁ < aleph' o₂ ↔ o₁ < o₂ :=
Aleph'.relIso.map_rel_iff
#align cardinal.aleph'_lt Cardinal.aleph'_lt
@[simp]
theorem aleph'_le {o₁ o₂ : Ordinal} : aleph' o₁ ≤ aleph' o₂ ↔ o₁ ≤ o₂ :=
le_iff_le_iff_lt_iff_lt.2 aleph'_lt
#align cardinal.aleph'_le Cardinal.aleph'_le
@[simp]
theorem aleph'_alephIdx (c : Cardinal) : aleph' c.alephIdx = c :=
Cardinal.alephIdx.relIso.toEquiv.symm_apply_apply c
#align cardinal.aleph'_aleph_idx Cardinal.aleph'_alephIdx
@[simp]
theorem alephIdx_aleph' (o : Ordinal) : (aleph' o).alephIdx = o :=
Cardinal.alephIdx.relIso.toEquiv.apply_symm_apply o
#align cardinal.aleph_idx_aleph' Cardinal.alephIdx_aleph'
@[simp]
| Mathlib/SetTheory/Cardinal/Ordinal.lean | 198 | 200 | theorem aleph'_zero : aleph' 0 = 0 := by |
rw [← nonpos_iff_eq_zero, ← aleph'_alephIdx 0, aleph'_le]
apply Ordinal.zero_le
| 0 |
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Algebra.GroupWithZero.Commute
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Pow
import Mathlib.Algebra.Ring.Int
#align_import algebra.order.field.power from "leanprover-community/mathlib"@"acb3d204d4ee883eb686f45d486a2a6811a01329"
variable {α : Type*}
open Function Int
section LinearOrderedField
variable [LinearOrderedField α] {a b c d : α} {n : ℤ}
#noalign zpow_bit0_nonneg
#noalign zpow_bit0_pos
#noalign zpow_bit0_pos_iff
#noalign zpow_bit1_neg_iff
#noalign zpow_bit1_nonneg_iff
#noalign zpow_bit1_nonpos_iff
#noalign zpow_bit1_pos_iff
protected theorem Even.zpow_nonneg (hn : Even n) (a : α) : 0 ≤ a ^ n := by
obtain ⟨k, rfl⟩ := hn; rw [zpow_add' (by simp [em'])]; exact mul_self_nonneg _
#align even.zpow_nonneg Even.zpow_nonneg
lemma zpow_two_nonneg (a : α) : 0 ≤ a ^ (2 : ℤ) := even_two.zpow_nonneg _
#align zpow_two_nonneg zpow_two_nonneg
lemma zpow_neg_two_nonneg (a : α) : 0 ≤ a ^ (-2 : ℤ) := even_neg_two.zpow_nonneg _
#align zpow_neg_two_nonneg zpow_neg_two_nonneg
protected lemma Even.zpow_pos (hn : Even n) (ha : a ≠ 0) : 0 < a ^ n :=
(hn.zpow_nonneg _).lt_of_ne' (zpow_ne_zero _ ha)
#align even.zpow_pos Even.zpow_pos
lemma zpow_two_pos_of_ne_zero (ha : a ≠ 0) : 0 < a ^ (2 : ℤ) := even_two.zpow_pos ha
#align zpow_two_pos_of_ne_zero zpow_two_pos_of_ne_zero
theorem Even.zpow_pos_iff (hn : Even n) (h : n ≠ 0) : 0 < a ^ n ↔ a ≠ 0 := by
obtain ⟨k, rfl⟩ := hn
rw [zpow_add' (by simp [em']), mul_self_pos, zpow_ne_zero_iff (by simpa using h)]
#align even.zpow_pos_iff Even.zpow_pos_iff
theorem Odd.zpow_neg_iff (hn : Odd n) : a ^ n < 0 ↔ a < 0 := by
refine ⟨lt_imp_lt_of_le_imp_le (zpow_nonneg · _), fun ha ↦ ?_⟩
obtain ⟨k, rfl⟩ := hn
rw [zpow_add_one₀ ha.ne]
exact mul_neg_of_pos_of_neg (Even.zpow_pos (even_two_mul _) ha.ne) ha
#align odd.zpow_neg_iff Odd.zpow_neg_iff
protected lemma Odd.zpow_nonneg_iff (hn : Odd n) : 0 ≤ a ^ n ↔ 0 ≤ a :=
le_iff_le_iff_lt_iff_lt.2 hn.zpow_neg_iff
#align odd.zpow_nonneg_iff Odd.zpow_nonneg_iff
theorem Odd.zpow_nonpos_iff (hn : Odd n) : a ^ n ≤ 0 ↔ a ≤ 0 := by
rw [le_iff_lt_or_eq, le_iff_lt_or_eq, hn.zpow_neg_iff, zpow_eq_zero_iff]
rintro rfl
exact Int.odd_iff_not_even.1 hn even_zero
#align odd.zpow_nonpos_iff Odd.zpow_nonpos_iff
lemma Odd.zpow_pos_iff (hn : Odd n) : 0 < a ^ n ↔ 0 < a := lt_iff_lt_of_le_iff_le hn.zpow_nonpos_iff
#align odd.zpow_pos_iff Odd.zpow_pos_iff
alias ⟨_, Odd.zpow_neg⟩ := Odd.zpow_neg_iff
#align odd.zpow_neg Odd.zpow_neg
alias ⟨_, Odd.zpow_nonpos⟩ := Odd.zpow_nonpos_iff
#align odd.zpow_nonpos Odd.zpow_nonpos
| Mathlib/Algebra/Order/Field/Power.lean | 181 | 182 | theorem Even.zpow_abs {p : ℤ} (hp : Even p) (a : α) : |a| ^ p = a ^ p := by |
cases' abs_choice a with h h <;> simp only [h, hp.neg_zpow _]
| 0 |
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.Normed.Order.Basic
import Mathlib.Topology.Algebra.Order.LiminfLimsup
#align_import analysis.asymptotics.superpolynomial_decay from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Asymptotics
open Topology Polynomial
open Filter
def SuperpolynomialDecay {α β : Type*} [TopologicalSpace β] [CommSemiring β] (l : Filter α)
(k : α → β) (f : α → β) :=
∀ n : ℕ, Tendsto (fun a : α => k a ^ n * f a) l (𝓝 0)
#align asymptotics.superpolynomial_decay Asymptotics.SuperpolynomialDecay
variable {α β : Type*} {l : Filter α} {k : α → β} {f g g' : α → β}
section LinearOrderedCommRing
variable [TopologicalSpace β] [LinearOrderedCommRing β] [OrderTopology β]
variable (l k f)
theorem superpolynomialDecay_iff_abs_tendsto_zero :
SuperpolynomialDecay l k f ↔ ∀ n : ℕ, Tendsto (fun a : α => |k a ^ n * f a|) l (𝓝 0) :=
⟨fun h z => (tendsto_zero_iff_abs_tendsto_zero _).1 (h z), fun h z =>
(tendsto_zero_iff_abs_tendsto_zero _).2 (h z)⟩
#align asymptotics.superpolynomial_decay_iff_abs_tendsto_zero Asymptotics.superpolynomialDecay_iff_abs_tendsto_zero
theorem superpolynomialDecay_iff_superpolynomialDecay_abs :
SuperpolynomialDecay l k f ↔ SuperpolynomialDecay l (fun a => |k a|) fun a => |f a| :=
(superpolynomialDecay_iff_abs_tendsto_zero l k f).trans
(by simp_rw [SuperpolynomialDecay, abs_mul, abs_pow])
#align asymptotics.superpolynomial_decay_iff_superpolynomial_decay_abs Asymptotics.superpolynomialDecay_iff_superpolynomialDecay_abs
variable {l k f}
| Mathlib/Analysis/Asymptotics/SuperpolynomialDecay.lean | 176 | 185 | theorem SuperpolynomialDecay.trans_eventually_abs_le (hf : SuperpolynomialDecay l k f)
(hfg : abs ∘ g ≤ᶠ[l] abs ∘ f) : SuperpolynomialDecay l k g := by |
rw [superpolynomialDecay_iff_abs_tendsto_zero] at hf ⊢
refine fun z =>
tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (hf z)
(eventually_of_forall fun x => abs_nonneg _) (hfg.mono fun x hx => ?_)
calc
|k x ^ z * g x| = |k x ^ z| * |g x| := abs_mul (k x ^ z) (g x)
_ ≤ |k x ^ z| * |f x| := by gcongr _ * ?_; exact hx
_ = |k x ^ z * f x| := (abs_mul (k x ^ z) (f x)).symm
| 0 |
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Conj
#align_import category_theory.adjunction.mates from "leanprover-community/mathlib"@"cea27692b3fdeb328a2ddba6aabf181754543184"
universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄
namespace CategoryTheory
open Category
variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D]
section Square
variable {E : Type u₃} {F : Type u₄} [Category.{v₃} E] [Category.{v₄} F]
variable {G : C ⥤ E} {H : D ⥤ F} {L₁ : C ⥤ D} {R₁ : D ⥤ C} {L₂ : E ⥤ F} {R₂ : F ⥤ E}
variable (adj₁ : L₁ ⊣ R₁) (adj₂ : L₂ ⊣ R₂)
def transferNatTrans : (G ⋙ L₂ ⟶ L₁ ⋙ H) ≃ (R₁ ⋙ G ⟶ H ⋙ R₂) where
toFun h :=
{ app := fun X => adj₂.unit.app _ ≫ R₂.map (h.app _ ≫ H.map (adj₁.counit.app _))
naturality := fun X Y f => by
dsimp
rw [assoc, ← R₂.map_comp, assoc, ← H.map_comp, ← adj₁.counit_naturality, H.map_comp, ←
Functor.comp_map L₁, ← h.naturality_assoc]
simp }
invFun h :=
{ app := fun X => L₂.map (G.map (adj₁.unit.app _) ≫ h.app _) ≫ adj₂.counit.app _
naturality := fun X Y f => by
dsimp
rw [← L₂.map_comp_assoc, ← G.map_comp_assoc, ← adj₁.unit_naturality, G.map_comp_assoc, ←
Functor.comp_map, h.naturality]
simp }
left_inv h := by
ext X
dsimp
simp only [L₂.map_comp, assoc, adj₂.counit_naturality, adj₂.left_triangle_components_assoc, ←
Functor.comp_map G L₂, h.naturality_assoc, Functor.comp_map L₁, ← H.map_comp,
adj₁.left_triangle_components]
dsimp
simp only [id_comp, ← Functor.comp_map, ← Functor.comp_obj, NatTrans.naturality_assoc]
simp only [Functor.comp_obj, Functor.comp_map, ← Functor.map_comp]
have : Prefunctor.map L₁.toPrefunctor (NatTrans.app adj₁.unit X) ≫
NatTrans.app adj₁.counit (Prefunctor.obj L₁.toPrefunctor X) = 𝟙 _ := by simp
simp [this]
-- See library note [dsimp, simp].
right_inv h := by
ext X
dsimp
simp [-Functor.comp_map, ← Functor.comp_map H, Functor.comp_map R₁, -NatTrans.naturality, ←
h.naturality, -Functor.map_comp, ← Functor.map_comp_assoc G, R₂.map_comp]
#align category_theory.transfer_nat_trans CategoryTheory.transferNatTrans
theorem transferNatTrans_counit (f : G ⋙ L₂ ⟶ L₁ ⋙ H) (Y : D) :
L₂.map ((transferNatTrans adj₁ adj₂ f).app _) ≫ adj₂.counit.app _ =
f.app _ ≫ H.map (adj₁.counit.app Y) := by
erw [Functor.map_comp]
simp
#align category_theory.transfer_nat_trans_counit CategoryTheory.transferNatTrans_counit
| Mathlib/CategoryTheory/Adjunction/Mates.lean | 118 | 124 | theorem unit_transferNatTrans (f : G ⋙ L₂ ⟶ L₁ ⋙ H) (X : C) :
G.map (adj₁.unit.app X) ≫ (transferNatTrans adj₁ adj₂ f).app _ =
adj₂.unit.app _ ≫ R₂.map (f.app _) := by |
dsimp [transferNatTrans]
rw [← adj₂.unit_naturality_assoc, ← R₂.map_comp, ← Functor.comp_map G L₂, f.naturality_assoc,
Functor.comp_map, ← H.map_comp]
dsimp; simp
| 0 |
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.GroupTheory.GroupAction.Basic
import Mathlib.Dynamics.PeriodicPts
import Mathlib.Data.Set.Pointwise.SMul
namespace MulAction
open Pointwise
variable {α : Type*}
variable {G : Type*} [Group G] [MulAction G α]
variable {M : Type*} [Monoid M] [MulAction M α]
section FixedPoints
variable (α) in
@[to_additive (attr := simp)
"In an additive group action, the points fixed by `g` are also fixed by `g⁻¹`"]
theorem fixedBy_inv (g : G) : fixedBy α g⁻¹ = fixedBy α g := by
ext
rw [mem_fixedBy, mem_fixedBy, inv_smul_eq_iff, eq_comm]
@[to_additive]
theorem smul_mem_fixedBy_iff_mem_fixedBy {a : α} {g : G} :
g • a ∈ fixedBy α g ↔ a ∈ fixedBy α g := by
rw [mem_fixedBy, smul_left_cancel_iff]
rfl
@[to_additive]
| Mathlib/GroupTheory/GroupAction/FixedPoints.lean | 71 | 73 | theorem smul_inv_mem_fixedBy_iff_mem_fixedBy {a : α} {g : G} :
g⁻¹ • a ∈ fixedBy α g ↔ a ∈ fixedBy α g := by |
rw [← fixedBy_inv, smul_mem_fixedBy_iff_mem_fixedBy, fixedBy_inv]
| 0 |
import Mathlib.Algebra.Category.ModuleCat.EpiMono
import Mathlib.Algebra.Category.ModuleCat.Kernels
import Mathlib.CategoryTheory.Subobject.WellPowered
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.category.Module.subobject from "leanprover-community/mathlib"@"6d584f1709bedbed9175bd9350df46599bdd7213"
open CategoryTheory
open CategoryTheory.Subobject
open CategoryTheory.Limits
open ModuleCat
universe v u
namespace ModuleCat
set_option linter.uppercaseLean3 false -- `Module`
variable {R : Type u} [Ring R] (M : ModuleCat.{v} R)
noncomputable def subobjectModule : Subobject M ≃o Submodule R M :=
OrderIso.symm
{ invFun := fun S => LinearMap.range S.arrow
toFun := fun N => Subobject.mk (↾N.subtype)
right_inv := fun S => Eq.symm (by
fapply eq_mk_of_comm
· apply LinearEquiv.toModuleIso'Left
apply LinearEquiv.ofBijective (LinearMap.codRestrict (LinearMap.range S.arrow) S.arrow _)
constructor
· simp [← LinearMap.ker_eq_bot, LinearMap.ker_codRestrict]
rw [ker_eq_bot_of_mono]
· rw [← LinearMap.range_eq_top, LinearMap.range_codRestrict, Submodule.comap_subtype_self]
exact LinearMap.mem_range_self _
· apply LinearMap.ext
intro x
rfl)
left_inv := fun N => by
-- Porting note: The type of `↾N.subtype` was ambiguous. Not entirely sure, I made the right
-- choice here
convert congr_arg LinearMap.range
(underlyingIso_arrow (↾N.subtype : of R { x // x ∈ N } ⟶ M)) using 1
· have :
-- Porting note: added the `.toLinearEquiv.toLinearMap`
(underlyingIso (↾N.subtype : of R _ ⟶ M)).inv =
(underlyingIso (↾N.subtype : of R _ ⟶ M)).symm.toLinearEquiv.toLinearMap := by
apply LinearMap.ext
intro x
rfl
rw [this, comp_def, LinearEquiv.range_comp]
· exact (Submodule.range_subtype _).symm
map_rel_iff' := fun {S T} => by
refine ⟨fun h => ?_, fun h => mk_le_mk_of_comm (↟(Submodule.inclusion h)) rfl⟩
convert LinearMap.range_comp_le_range (ofMkLEMk _ _ h) (↾T.subtype)
· simpa only [← comp_def, ofMkLEMk_comp] using (Submodule.range_subtype _).symm
· exact (Submodule.range_subtype _).symm }
#align Module.subobject_Module ModuleCat.subobjectModule
instance wellPowered_moduleCat : WellPowered (ModuleCat.{v} R) :=
⟨fun M => ⟨⟨_, ⟨(subobjectModule M).toEquiv⟩⟩⟩⟩
#align Module.well_powered_Module ModuleCat.wellPowered_moduleCat
attribute [local instance] hasKernels_moduleCat
noncomputable def toKernelSubobject {M N : ModuleCat.{v} R} {f : M ⟶ N} :
LinearMap.ker f →ₗ[R] kernelSubobject f :=
(kernelSubobjectIso f ≪≫ ModuleCat.kernelIsoKer f).inv
#align Module.to_kernel_subobject ModuleCat.toKernelSubobject
@[simp]
| Mathlib/Algebra/Category/ModuleCat/Subobject.lean | 89 | 96 | theorem toKernelSubobject_arrow {M N : ModuleCat R} {f : M ⟶ N} (x : LinearMap.ker f) :
(kernelSubobject f).arrow (toKernelSubobject x) = x.1 := by |
-- Porting note: The whole proof was just `simp [toKernelSubobject]`.
suffices ((arrow ((kernelSubobject f))) ∘ (kernelSubobjectIso f ≪≫ kernelIsoKer f).inv) x = x by
convert this
rw [Iso.trans_inv, ← coe_comp, Category.assoc]
simp only [Category.assoc, kernelSubobject_arrow', kernelIsoKer_inv_kernel_ι]
aesop_cat
| 0 |
import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.Coxeter.Basic
namespace CoxeterSystem
open List Matrix Function Classical
variable {B : Type*}
variable {W : Type*} [Group W]
variable {M : CoxeterMatrix B} (cs : CoxeterSystem M W)
local prefix:100 "s" => cs.simple
local prefix:100 "π" => cs.wordProd
private theorem exists_word_with_prod (w : W) : ∃ n ω, ω.length = n ∧ π ω = w := by
rcases cs.wordProd_surjective w with ⟨ω, rfl⟩
use ω.length, ω
noncomputable def length (w : W) : ℕ := Nat.find (cs.exists_word_with_prod w)
local prefix:100 "ℓ" => cs.length
theorem exists_reduced_word (w : W) : ∃ ω, ω.length = ℓ w ∧ w = π ω := by
have := Nat.find_spec (cs.exists_word_with_prod w)
tauto
theorem length_wordProd_le (ω : List B) : ℓ (π ω) ≤ ω.length :=
Nat.find_min' (cs.exists_word_with_prod (π ω)) ⟨ω, by tauto⟩
@[simp] theorem length_one : ℓ (1 : W) = 0 := Nat.eq_zero_of_le_zero (cs.length_wordProd_le [])
@[simp]
theorem length_eq_zero_iff {w : W} : ℓ w = 0 ↔ w = 1 := by
constructor
· intro h
rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩
have : ω = [] := eq_nil_of_length_eq_zero (hω.trans h)
rw [this, wordProd_nil]
· rintro rfl
exact cs.length_one
@[simp]
theorem length_inv (w : W) : ℓ (w⁻¹) = ℓ w := by
apply Nat.le_antisymm
· rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩
have := cs.length_wordProd_le (List.reverse ω)
rwa [wordProd_reverse, length_reverse, hω] at this
· rcases cs.exists_reduced_word w⁻¹ with ⟨ω, hω, h'ω⟩
have := cs.length_wordProd_le (List.reverse ω)
rwa [wordProd_reverse, length_reverse, ← h'ω, hω, inv_inv] at this
theorem length_mul_le (w₁ w₂ : W) :
ℓ (w₁ * w₂) ≤ ℓ w₁ + ℓ w₂ := by
rcases cs.exists_reduced_word w₁ with ⟨ω₁, hω₁, rfl⟩
rcases cs.exists_reduced_word w₂ with ⟨ω₂, hω₂, rfl⟩
have := cs.length_wordProd_le (ω₁ ++ ω₂)
simpa [hω₁, hω₂, wordProd_append] using this
theorem length_mul_ge_length_sub_length (w₁ w₂ : W) :
ℓ w₁ - ℓ w₂ ≤ ℓ (w₁ * w₂) := by
simpa [Nat.sub_le_of_le_add] using cs.length_mul_le (w₁ * w₂) w₂⁻¹
theorem length_mul_ge_length_sub_length' (w₁ w₂ : W) :
ℓ w₂ - ℓ w₁ ≤ ℓ (w₁ * w₂) := by
simpa [Nat.sub_le_of_le_add, add_comm] using cs.length_mul_le w₁⁻¹ (w₁ * w₂)
theorem length_mul_ge_max (w₁ w₂ : W) :
max (ℓ w₁ - ℓ w₂) (ℓ w₂ - ℓ w₁) ≤ ℓ (w₁ * w₂) :=
max_le_iff.mpr ⟨length_mul_ge_length_sub_length _ _ _, length_mul_ge_length_sub_length' _ _ _⟩
def lengthParity : W →* Multiplicative (ZMod 2) := cs.lift ⟨fun _ ↦ Multiplicative.ofAdd 1, by
simp_rw [CoxeterMatrix.IsLiftable, ← ofAdd_add, (by decide : (1 + 1 : ZMod 2) = 0)]
simp⟩
theorem lengthParity_simple (i : B):
cs.lengthParity (s i) = Multiplicative.ofAdd 1 := cs.lift_apply_simple _ _
theorem lengthParity_comp_simple :
cs.lengthParity ∘ cs.simple = fun _ ↦ Multiplicative.ofAdd 1 := funext cs.lengthParity_simple
theorem lengthParity_eq_ofAdd_length (w : W) :
cs.lengthParity w = Multiplicative.ofAdd (↑(ℓ w)) := by
rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩
rw [← hω, wordProd, map_list_prod, List.map_map, lengthParity_comp_simple, map_const',
prod_replicate, ← ofAdd_nsmul, nsmul_one]
theorem length_mul_mod_two (w₁ w₂ : W) : ℓ (w₁ * w₂) % 2 = (ℓ w₁ + ℓ w₂) % 2 := by
rw [← ZMod.natCast_eq_natCast_iff', Nat.cast_add]
simpa only [lengthParity_eq_ofAdd_length, ofAdd_add] using map_mul cs.lengthParity w₁ w₂
@[simp]
theorem length_simple (i : B) : ℓ (s i) = 1 := by
apply Nat.le_antisymm
· simpa using cs.length_wordProd_le [i]
· by_contra! length_lt_one
have : cs.lengthParity (s i) = Multiplicative.ofAdd 0 := by
rw [lengthParity_eq_ofAdd_length, Nat.lt_one_iff.mp length_lt_one, Nat.cast_zero]
have : Multiplicative.ofAdd (0 : ZMod 2) = Multiplicative.ofAdd 1 :=
this.symm.trans (cs.lengthParity_simple i)
contradiction
theorem length_eq_one_iff {w : W} : ℓ w = 1 ↔ ∃ i : B, w = s i := by
constructor
· intro h
rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩
rcases List.length_eq_one.mp (hω.trans h) with ⟨i, rfl⟩
exact ⟨i, cs.wordProd_singleton i⟩
· rintro ⟨i, rfl⟩
exact cs.length_simple i
| Mathlib/GroupTheory/Coxeter/Length.lean | 161 | 169 | theorem length_mul_simple_ne (w : W) (i : B) : ℓ (w * s i) ≠ ℓ w := by |
intro eq
have length_mod_two := cs.length_mul_mod_two w (s i)
rw [eq, length_simple] at length_mod_two
rcases Nat.mod_two_eq_zero_or_one (ℓ w) with even | odd
· rw [even, Nat.succ_mod_two_eq_one_iff.mpr even] at length_mod_two
contradiction
· rw [odd, Nat.succ_mod_two_eq_zero_iff.mpr odd] at length_mod_two
contradiction
| 0 |
import Mathlib.Logic.Encodable.Lattice
import Mathlib.MeasureTheory.MeasurableSpace.Defs
#align_import measure_theory.pi_system from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
open MeasurableSpace Set
open scoped Classical
open MeasureTheory
def IsPiSystem {α} (C : Set (Set α)) : Prop :=
∀ᵉ (s ∈ C) (t ∈ C), (s ∩ t : Set α).Nonempty → s ∩ t ∈ C
#align is_pi_system IsPiSystem
theorem IsPiSystem.singleton {α} (S : Set α) : IsPiSystem ({S} : Set (Set α)) := by
intro s h_s t h_t _
rw [Set.mem_singleton_iff.1 h_s, Set.mem_singleton_iff.1 h_t, Set.inter_self,
Set.mem_singleton_iff]
#align is_pi_system.singleton IsPiSystem.singleton
theorem IsPiSystem.insert_empty {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert ∅ S) := by
intro s hs t ht hst
cases' hs with hs hs
· simp [hs]
· cases' ht with ht ht
· simp [ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_empty IsPiSystem.insert_empty
theorem IsPiSystem.insert_univ {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert Set.univ S) := by
intro s hs t ht hst
cases' hs with hs hs
· cases' ht with ht ht <;> simp [hs, ht]
· cases' ht with ht ht
· simp [hs, ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_univ IsPiSystem.insert_univ
theorem IsPiSystem.comap {α β} {S : Set (Set β)} (h_pi : IsPiSystem S) (f : α → β) :
IsPiSystem { s : Set α | ∃ t ∈ S, f ⁻¹' t = s } := by
rintro _ ⟨s, hs_mem, rfl⟩ _ ⟨t, ht_mem, rfl⟩ hst
rw [← Set.preimage_inter] at hst ⊢
exact ⟨s ∩ t, h_pi s hs_mem t ht_mem (nonempty_of_nonempty_preimage hst), rfl⟩
#align is_pi_system.comap IsPiSystem.comap
theorem isPiSystem_iUnion_of_directed_le {α ι} (p : ι → Set (Set α))
(hp_pi : ∀ n, IsPiSystem (p n)) (hp_directed : Directed (· ≤ ·) p) :
IsPiSystem (⋃ n, p n) := by
intro t1 ht1 t2 ht2 h
rw [Set.mem_iUnion] at ht1 ht2 ⊢
cases' ht1 with n ht1
cases' ht2 with m ht2
obtain ⟨k, hpnk, hpmk⟩ : ∃ k, p n ≤ p k ∧ p m ≤ p k := hp_directed n m
exact ⟨k, hp_pi k t1 (hpnk ht1) t2 (hpmk ht2) h⟩
#align is_pi_system_Union_of_directed_le isPiSystem_iUnion_of_directed_le
theorem isPiSystem_iUnion_of_monotone {α ι} [SemilatticeSup ι] (p : ι → Set (Set α))
(hp_pi : ∀ n, IsPiSystem (p n)) (hp_mono : Monotone p) : IsPiSystem (⋃ n, p n) :=
isPiSystem_iUnion_of_directed_le p hp_pi (Monotone.directed_le hp_mono)
#align is_pi_system_Union_of_monotone isPiSystem_iUnion_of_monotone
section Order
variable {α : Type*} {ι ι' : Sort*} [LinearOrder α]
theorem isPiSystem_image_Iio (s : Set α) : IsPiSystem (Iio '' s) := by
rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ -
exact ⟨a ⊓ b, inf_ind a b ha hb, Iio_inter_Iio.symm⟩
#align is_pi_system_image_Iio isPiSystem_image_Iio
theorem isPiSystem_Iio : IsPiSystem (range Iio : Set (Set α)) :=
@image_univ α _ Iio ▸ isPiSystem_image_Iio univ
#align is_pi_system_Iio isPiSystem_Iio
theorem isPiSystem_image_Ioi (s : Set α) : IsPiSystem (Ioi '' s) :=
@isPiSystem_image_Iio αᵒᵈ _ s
#align is_pi_system_image_Ioi isPiSystem_image_Ioi
theorem isPiSystem_Ioi : IsPiSystem (range Ioi : Set (Set α)) :=
@image_univ α _ Ioi ▸ isPiSystem_image_Ioi univ
#align is_pi_system_Ioi isPiSystem_Ioi
theorem isPiSystem_image_Iic (s : Set α) : IsPiSystem (Iic '' s) := by
rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ -
exact ⟨a ⊓ b, inf_ind a b ha hb, Iic_inter_Iic.symm⟩
theorem isPiSystem_Iic : IsPiSystem (range Iic : Set (Set α)) :=
@image_univ α _ Iic ▸ isPiSystem_image_Iic univ
#align is_pi_system_Iic isPiSystem_Iic
theorem isPiSystem_image_Ici (s : Set α) : IsPiSystem (Ici '' s) :=
@isPiSystem_image_Iic αᵒᵈ _ s
theorem isPiSystem_Ici : IsPiSystem (range Ici : Set (Set α)) :=
@image_univ α _ Ici ▸ isPiSystem_image_Ici univ
#align is_pi_system_Ici isPiSystem_Ici
| Mathlib/MeasureTheory/PiSystem.lean | 164 | 170 | theorem isPiSystem_Ixx_mem {Ixx : α → α → Set α} {p : α → α → Prop}
(Hne : ∀ {a b}, (Ixx a b).Nonempty → p a b)
(Hi : ∀ {a₁ b₁ a₂ b₂}, Ixx a₁ b₁ ∩ Ixx a₂ b₂ = Ixx (max a₁ a₂) (min b₁ b₂)) (s t : Set α) :
IsPiSystem { S | ∃ᵉ (l ∈ s) (u ∈ t), p l u ∧ Ixx l u = S } := by |
rintro _ ⟨l₁, hls₁, u₁, hut₁, _, rfl⟩ _ ⟨l₂, hls₂, u₂, hut₂, _, rfl⟩
simp only [Hi]
exact fun H => ⟨l₁ ⊔ l₂, sup_ind l₁ l₂ hls₁ hls₂, u₁ ⊓ u₂, inf_ind u₁ u₂ hut₁ hut₂, Hne H, rfl⟩
| 0 |
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]
| Mathlib/Algebra/Order/Interval/Set/Group.lean | 171 | 183 | 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
| 0 |
import Mathlib.RingTheory.DedekindDomain.Ideal
import Mathlib.RingTheory.IsAdjoinRoot
#align_import number_theory.kummer_dedekind from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
variable (R : Type*) {S : Type*} [CommRing R] [CommRing S] [Algebra R S]
open Ideal Polynomial DoubleQuot UniqueFactorizationMonoid Algebra RingHom
local notation:max R "<" x:max ">" => adjoin R ({x} : Set S)
def conductor (x : S) : Ideal S where
carrier := {a | ∀ b : S, a * b ∈ R<x>}
zero_mem' b := by simpa only [zero_mul] using Subalgebra.zero_mem _
add_mem' ha hb c := by simpa only [add_mul] using Subalgebra.add_mem _ (ha c) (hb c)
smul_mem' c a ha b := by simpa only [smul_eq_mul, mul_left_comm, mul_assoc] using ha (c * b)
#align conductor conductor
variable {R} {x : S}
theorem conductor_eq_of_eq {y : S} (h : (R<x> : Set S) = R<y>) : conductor R x = conductor R y :=
Ideal.ext fun _ => forall_congr' fun _ => Set.ext_iff.mp h _
#align conductor_eq_of_eq conductor_eq_of_eq
theorem conductor_subset_adjoin : (conductor R x : Set S) ⊆ R<x> := fun y hy => by
simpa only [mul_one] using hy 1
#align conductor_subset_adjoin conductor_subset_adjoin
theorem mem_conductor_iff {y : S} : y ∈ conductor R x ↔ ∀ b : S, y * b ∈ R<x> :=
⟨fun h => h, fun h => h⟩
#align mem_conductor_iff mem_conductor_iff
theorem conductor_eq_top_of_adjoin_eq_top (h : R<x> = ⊤) : conductor R x = ⊤ := by
simp only [Ideal.eq_top_iff_one, mem_conductor_iff, h, mem_top, forall_const]
#align conductor_eq_top_of_adjoin_eq_top conductor_eq_top_of_adjoin_eq_top
theorem conductor_eq_top_of_powerBasis (pb : PowerBasis R S) : conductor R pb.gen = ⊤ :=
conductor_eq_top_of_adjoin_eq_top pb.adjoin_gen_eq_top
#align conductor_eq_top_of_power_basis conductor_eq_top_of_powerBasis
open IsLocalization in
lemma mem_coeSubmodule_conductor {L} [CommRing L] [Algebra S L] [Algebra R L]
[IsScalarTower R S L] [NoZeroSMulDivisors S L] {x : S} {y : L} :
y ∈ coeSubmodule L (conductor R x) ↔ ∀ z : S,
y * (algebraMap S L) z ∈ Algebra.adjoin R {algebraMap S L x} := by
cases subsingleton_or_nontrivial L
· rw [Subsingleton.elim (coeSubmodule L _) ⊤, Subsingleton.elim (Algebra.adjoin R _) ⊤]; simp
trans ∀ z, y * (algebraMap S L) z ∈ (Algebra.adjoin R {x}).map (IsScalarTower.toAlgHom R S L)
· simp only [coeSubmodule, Submodule.mem_map, Algebra.linearMap_apply, Subalgebra.mem_map,
IsScalarTower.coe_toAlgHom']
constructor
· rintro ⟨y, hy, rfl⟩ z
exact ⟨_, hy z, map_mul _ _ _⟩
· intro H
obtain ⟨y, _, e⟩ := H 1
rw [_root_.map_one, mul_one] at e
subst e
simp only [← _root_.map_mul, (NoZeroSMulDivisors.algebraMap_injective S L).eq_iff,
exists_eq_right] at H
exact ⟨_, H, rfl⟩
· rw [AlgHom.map_adjoin, Set.image_singleton]; rfl
variable {I : Ideal R}
theorem prod_mem_ideal_map_of_mem_conductor {p : R} {z : S}
(hp : p ∈ Ideal.comap (algebraMap R S) (conductor R x)) (hz' : z ∈ I.map (algebraMap R S)) :
algebraMap R S p * z ∈ algebraMap R<x> S '' ↑(I.map (algebraMap R R<x>)) := by
rw [Ideal.map, Ideal.span, Finsupp.mem_span_image_iff_total] at hz'
obtain ⟨l, H, H'⟩ := hz'
rw [Finsupp.total_apply] at H'
rw [← H', mul_comm, Finsupp.sum_mul]
have lem : ∀ {a : R}, a ∈ I → l a • algebraMap R S a * algebraMap R S p ∈
algebraMap R<x> S '' I.map (algebraMap R R<x>) := by
intro a ha
rw [Algebra.id.smul_eq_mul, mul_assoc, mul_comm, mul_assoc, Set.mem_image]
refine Exists.intro
(algebraMap R R<x> a * ⟨l a * algebraMap R S p,
show l a * algebraMap R S p ∈ R<x> from ?h⟩) ?_
case h =>
rw [mul_comm]
exact mem_conductor_iff.mp (Ideal.mem_comap.mp hp) _
· refine ⟨?_, ?_⟩
· rw [mul_comm]
apply Ideal.mul_mem_left (I.map (algebraMap R R<x>)) _ (Ideal.mem_map_of_mem _ ha)
· simp only [RingHom.map_mul, mul_comm (algebraMap R S p) (l a)]
rfl
refine Finset.sum_induction _ (fun u => u ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>))
(fun a b => ?_) ?_ ?_
· rintro ⟨z, hz, rfl⟩ ⟨y, hy, rfl⟩
rw [← RingHom.map_add]
exact ⟨z + y, Ideal.add_mem _ (SetLike.mem_coe.mp hz) hy, rfl⟩
· exact ⟨0, SetLike.mem_coe.mpr <| Ideal.zero_mem _, RingHom.map_zero _⟩
· intro y hy
exact lem ((Finsupp.mem_supported _ l).mp H hy)
#align prod_mem_ideal_map_of_mem_conductor prod_mem_ideal_map_of_mem_conductor
| Mathlib/NumberTheory/KummerDedekind.lean | 152 | 186 | theorem comap_map_eq_map_adjoin_of_coprime_conductor
(hx : (conductor R x).comap (algebraMap R S) ⊔ I = ⊤)
(h_alg : Function.Injective (algebraMap R<x> S)) :
(I.map (algebraMap R S)).comap (algebraMap R<x> S) = I.map (algebraMap R R<x>) := by |
apply le_antisymm
· -- This is adapted from [Neukirch1992]. Let `C = (conductor R x)`. The idea of the proof
-- is that since `I` and `C ∩ R` are coprime, we have
-- `(I * S) ∩ R<x> ⊆ (I + C) * ((I * S) ∩ R<x>) ⊆ I * R<x> + I * C * S ⊆ I * R<x>`.
intro y hy
obtain ⟨z, hz⟩ := y
obtain ⟨p, hp, q, hq, hpq⟩ := Submodule.mem_sup.mp ((Ideal.eq_top_iff_one _).mp hx)
have temp : algebraMap R S p * z + algebraMap R S q * z = z := by
simp only [← add_mul, ← RingHom.map_add (algebraMap R S), hpq, map_one, one_mul]
suffices z ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>) ↔
(⟨z, hz⟩ : R<x>) ∈ I.map (algebraMap R R<x>) by
rw [← this, ← temp]
obtain ⟨a, ha⟩ := (Set.mem_image _ _ _).mp (prod_mem_ideal_map_of_mem_conductor hp
(show z ∈ I.map (algebraMap R S) by rwa [Ideal.mem_comap] at hy))
use a + algebraMap R R<x> q * ⟨z, hz⟩
refine ⟨Ideal.add_mem (I.map (algebraMap R R<x>)) ha.left ?_, by
simp only [ha.right, map_add, AlgHom.map_mul, add_right_inj]; rfl⟩
rw [mul_comm]
exact Ideal.mul_mem_left (I.map (algebraMap R R<x>)) _ (Ideal.mem_map_of_mem _ hq)
refine ⟨fun h => ?_,
fun h => (Set.mem_image _ _ _).mpr (Exists.intro ⟨z, hz⟩ ⟨by simp [h], rfl⟩)⟩
obtain ⟨x₁, hx₁, hx₂⟩ := (Set.mem_image _ _ _).mp h
have : x₁ = ⟨z, hz⟩ := by
apply h_alg
simp [hx₂]
rfl
rwa [← this]
· -- The converse inclusion is trivial
have : algebraMap R S = (algebraMap _ S).comp (algebraMap R R<x>) := by ext; rfl
rw [this, ← Ideal.map_map]
apply Ideal.le_comap_map
| 0 |
import Mathlib.MeasureTheory.Group.GeometryOfNumbers
import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls
import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional
local notation "E" K =>
({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ)
section convexBodySum
open ENNReal MeasureTheory Fintype
open scoped Real Classical NNReal
variable [NumberField K] (B : ℝ)
variable {K}
noncomputable abbrev convexBodySumFun (x : E K) : ℝ := ∑ w, mult w * normAtPlace w x
theorem convexBodySumFun_apply (x : E K) :
convexBodySumFun x = ∑ w, mult w * normAtPlace w x := rfl
theorem convexBodySumFun_apply' (x : E K) :
convexBodySumFun x = ∑ w, ‖x.1 w‖ + 2 * ∑ w, ‖x.2 w‖ := by
simp_rw [convexBodySumFun_apply, ← Finset.sum_add_sum_compl {w | IsReal w}.toFinset,
Set.toFinset_setOf, Finset.compl_filter, not_isReal_iff_isComplex, ← Finset.subtype_univ,
← Finset.univ.sum_subtype_eq_sum_filter, Finset.mul_sum]
congr
· ext w
rw [mult, if_pos w.prop, normAtPlace_apply_isReal, Nat.cast_one, one_mul]
· ext w
rw [mult, if_neg (not_isReal_iff_isComplex.mpr w.prop), normAtPlace_apply_isComplex,
Nat.cast_ofNat]
theorem convexBodySumFun_nonneg (x : E K) :
0 ≤ convexBodySumFun x :=
Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _))
theorem convexBodySumFun_neg (x : E K) :
convexBodySumFun (- x) = convexBodySumFun x := by
simp_rw [convexBodySumFun, normAtPlace_neg]
theorem convexBodySumFun_add_le (x y : E K) :
convexBodySumFun (x + y) ≤ convexBodySumFun x + convexBodySumFun y := by
simp_rw [convexBodySumFun, ← Finset.sum_add_distrib, ← mul_add]
exact Finset.sum_le_sum
fun _ _ ↦ mul_le_mul_of_nonneg_left (normAtPlace_add_le _ x y) (Nat.cast_pos.mpr mult_pos).le
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean | 312 | 314 | theorem convexBodySumFun_smul (c : ℝ) (x : E K) :
convexBodySumFun (c • x) = |c| * convexBodySumFun x := by |
simp_rw [convexBodySumFun, normAtPlace_smul, ← mul_assoc, mul_comm, Finset.mul_sum, mul_assoc]
| 0 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 82 | 90 | theorem differentiableWithinAt_arcsin_Ici {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by |
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩
rintro h rfl
have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by
filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using
sin_arcsin'
have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp)
simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
| 0 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
namespace Set
variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)
| Mathlib/Algebra/Order/Interval/Set/Monoid.lean | 27 | 32 | theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by |
refine
⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h)
rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
| 0 |
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.pi from "leanprover-community/mathlib"@"e4bc74cbaf429d706cb9140902f7ca6c431e75a4"
-- Porting note: Added, since dot notation no longer works on `Function.update`
open Function
variable {ι : Type*} {α : ι → Type*}
namespace Set
section PiPreorder
variable [∀ i, Preorder (α i)] (x y : ∀ i, α i)
@[simp]
theorem pi_univ_Ici : (pi univ fun i ↦ Ici (x i)) = Ici x :=
ext fun y ↦ by simp [Pi.le_def]
#align set.pi_univ_Ici Set.pi_univ_Ici
@[simp]
theorem pi_univ_Iic : (pi univ fun i ↦ Iic (x i)) = Iic x :=
ext fun y ↦ by simp [Pi.le_def]
#align set.pi_univ_Iic Set.pi_univ_Iic
@[simp]
theorem pi_univ_Icc : (pi univ fun i ↦ Icc (x i) (y i)) = Icc x y :=
ext fun y ↦ by simp [Pi.le_def, forall_and]
#align set.pi_univ_Icc Set.pi_univ_Icc
theorem piecewise_mem_Icc {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i}
(h₁ : ∀ i ∈ s, f₁ i ∈ Icc (g₁ i) (g₂ i)) (h₂ : ∀ i ∉ s, f₂ i ∈ Icc (g₁ i) (g₂ i)) :
s.piecewise f₁ f₂ ∈ Icc g₁ g₂ :=
⟨le_piecewise (fun i hi ↦ (h₁ i hi).1) fun i hi ↦ (h₂ i hi).1,
piecewise_le (fun i hi ↦ (h₁ i hi).2) fun i hi ↦ (h₂ i hi).2⟩
#align set.piecewise_mem_Icc Set.piecewise_mem_Icc
theorem piecewise_mem_Icc' {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i}
(h₁ : f₁ ∈ Icc g₁ g₂) (h₂ : f₂ ∈ Icc g₁ g₂) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ :=
piecewise_mem_Icc (fun _ _ ↦ ⟨h₁.1 _, h₁.2 _⟩) fun _ _ ↦ ⟨h₂.1 _, h₂.2 _⟩
#align set.piecewise_mem_Icc' Set.piecewise_mem_Icc'
variable [DecidableEq ι]
open Function (update)
theorem pi_univ_Ioc_update_left {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : x i₀ ≤ m) :
(pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) =
{ z | m < z i₀ } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by
have : Ioc m (y i₀) = Ioi m ∩ Ioc (x i₀) (y i₀) := by
rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, ← inter_assoc,
inter_eq_self_of_subset_left (Ioi_subset_Ioi hm)]
simp_rw [univ_pi_update i₀ _ _ fun i z ↦ Ioc z (y i), ← pi_inter_compl ({i₀} : Set ι),
singleton_pi', ← inter_assoc, this]
rfl
#align set.pi_univ_Ioc_update_left Set.pi_univ_Ioc_update_left
theorem pi_univ_Ioc_update_right {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : m ≤ y i₀) :
(pi univ fun i ↦ Ioc (x i) (update y i₀ m i)) =
{ z | z i₀ ≤ m } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by
have : Ioc (x i₀) m = Iic m ∩ Ioc (x i₀) (y i₀) := by
rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, inter_left_comm,
inter_eq_self_of_subset_left (Iic_subset_Iic.2 hm)]
simp_rw [univ_pi_update i₀ y m fun i z ↦ Ioc (x i) z, ← pi_inter_compl ({i₀} : Set ι),
singleton_pi', ← inter_assoc, this]
rfl
#align set.pi_univ_Ioc_update_right Set.pi_univ_Ioc_update_right
| Mathlib/Order/Interval/Set/Pi.lean | 112 | 118 | theorem disjoint_pi_univ_Ioc_update_left_right {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} :
Disjoint (pi univ fun i ↦ Ioc (x i) (update y i₀ m i))
(pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) := by |
rw [disjoint_left]
rintro z h₁ h₂
refine (h₁ i₀ (mem_univ _)).2.not_lt ?_
simpa only [Function.update_same] using (h₂ i₀ (mem_univ _)).1
| 0 |
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.LinearAlgebra.PiTensorProduct
universe uι u𝕜 uE uF
variable {ι : Type uι} [Fintype ι]
variable {𝕜 : Type u𝕜} [NontriviallyNormedField 𝕜]
variable {E : ι → Type uE} [∀ i, SeminormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)]
variable {F : Type uF} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F]
open scoped TensorProduct
namespace PiTensorProduct
def projectiveSeminormAux : FreeAddMonoid (𝕜 × Π i, E i) → ℝ :=
List.sum ∘ (List.map (fun p ↦ ‖p.1‖ * ∏ i, ‖p.2 i‖))
theorem projectiveSeminormAux_nonneg (p : FreeAddMonoid (𝕜 × Π i, E i)) :
0 ≤ projectiveSeminormAux p := by
simp only [projectiveSeminormAux, Function.comp_apply]
refine List.sum_nonneg ?_
intro a
simp only [Multiset.map_coe, Multiset.mem_coe, List.mem_map, Prod.exists, forall_exists_index,
and_imp]
intro x m _ h
rw [← h]
exact mul_nonneg (norm_nonneg _) (Finset.prod_nonneg (fun _ _ ↦ norm_nonneg _))
theorem projectiveSeminormAux_add_le (p q : FreeAddMonoid (𝕜 × Π i, E i)) :
projectiveSeminormAux (p + q) ≤ projectiveSeminormAux p + projectiveSeminormAux q := by
simp only [projectiveSeminormAux, Function.comp_apply, Multiset.map_coe, Multiset.sum_coe]
erw [List.map_append]
rw [List.sum_append]
rfl
theorem projectiveSeminormAux_smul (p : FreeAddMonoid (𝕜 × Π i, E i)) (a : 𝕜) :
projectiveSeminormAux (List.map (fun (y : 𝕜 × Π i, E i) ↦ (a * y.1, y.2)) p) =
‖a‖ * projectiveSeminormAux p := by
simp only [projectiveSeminormAux, Function.comp_apply, Multiset.map_coe, List.map_map,
Multiset.sum_coe]
rw [← smul_eq_mul, List.smul_sum, ← List.comp_map]
congr 2
ext x
simp only [Function.comp_apply, norm_mul, smul_eq_mul]
rw [mul_assoc]
theorem bddBelow_projectiveSemiNormAux (x : ⨂[𝕜] i, E i) :
BddBelow (Set.range (fun (p : lifts x) ↦ projectiveSeminormAux p.1)) := by
existsi 0
rw [mem_lowerBounds]
simp only [Set.mem_range, Subtype.exists, exists_prop, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
exact fun p _ ↦ projectiveSeminormAux_nonneg p
noncomputable def projectiveSeminorm : Seminorm 𝕜 (⨂[𝕜] i, E i) := by
refine Seminorm.ofSMulLE (fun x ↦ iInf (fun (p : lifts x) ↦ projectiveSeminormAux p.1)) ?_ ?_ ?_
· refine le_antisymm ?_ ?_
· refine ciInf_le_of_le (bddBelow_projectiveSemiNormAux (0 : ⨂[𝕜] i, E i)) ⟨0, lifts_zero⟩ ?_
simp only [projectiveSeminormAux, Function.comp_apply]
rw [List.sum_eq_zero]
intro _
simp only [List.mem_map, Prod.exists, forall_exists_index, and_imp]
intro _ _ hxm
rw [← FreeAddMonoid.ofList_nil] at hxm
exfalso
exact List.not_mem_nil _ hxm
· letI : Nonempty (lifts 0) := ⟨0, lifts_zero (R := 𝕜) (s := E)⟩
exact le_ciInf (fun p ↦ projectiveSeminormAux_nonneg p.1)
· intro x y
letI := nonempty_subtype.mpr (nonempty_lifts x); letI := nonempty_subtype.mpr (nonempty_lifts y)
exact le_ciInf_add_ciInf (fun p q ↦ ciInf_le_of_le (bddBelow_projectiveSemiNormAux _)
⟨p.1 + q.1, lifts_add p.2 q.2⟩ (projectiveSeminormAux_add_le p.1 q.1))
· intro a x
letI := nonempty_subtype.mpr (nonempty_lifts x)
rw [Real.mul_iInf_of_nonneg (norm_nonneg _)]
refine le_ciInf ?_
intro p
rw [← projectiveSeminormAux_smul]
exact ciInf_le_of_le (bddBelow_projectiveSemiNormAux _)
⟨(List.map (fun y ↦ (a * y.1, y.2)) p.1), lifts_smul p.2 a⟩ (le_refl _)
theorem projectiveSeminorm_apply (x : ⨂[𝕜] i, E i) :
projectiveSeminorm x = iInf (fun (p : lifts x) ↦ projectiveSeminormAux p.1) := rfl
theorem projectiveSeminorm_tprod_le (m : Π i, E i) :
projectiveSeminorm (⨂ₜ[𝕜] i, m i) ≤ ∏ i, ‖m i‖ := by
rw [projectiveSeminorm_apply]
convert ciInf_le (bddBelow_projectiveSemiNormAux _) ⟨[((1 : 𝕜), m)] ,?_⟩
· simp only [projectiveSeminormAux, Function.comp_apply, List.map_cons, norm_one, one_mul,
List.map_nil, List.sum_cons, List.sum_nil, add_zero]
· rw [mem_lifts_iff, List.map_singleton, List.sum_singleton, one_smul]
| Mathlib/Analysis/NormedSpace/PiTensorProduct/ProjectiveSeminorm.lean | 134 | 153 | theorem norm_eval_le_projectiveSeminorm (x : ⨂[𝕜] i, E i) (G : Type*) [SeminormedAddCommGroup G]
[NormedSpace 𝕜 G] (f : ContinuousMultilinearMap 𝕜 E G) :
‖lift f.toMultilinearMap x‖ ≤ projectiveSeminorm x * ‖f‖ := by |
letI := nonempty_subtype.mpr (nonempty_lifts x)
rw [projectiveSeminorm_apply, Real.iInf_mul_of_nonneg (norm_nonneg _), projectiveSeminormAux]
refine le_ciInf ?_
intro ⟨p, hp⟩
rw [mem_lifts_iff] at hp
conv_lhs => rw [← hp, ← List.sum_map_hom, ← Multiset.sum_coe]
refine le_trans (norm_multiset_sum_le _) ?_
simp only [tprodCoeff_eq_smul_tprod, Multiset.map_coe, List.map_map, Multiset.sum_coe,
Function.comp_apply]
rw [mul_comm, ← smul_eq_mul, List.smul_sum]
refine List.Forall₂.sum_le_sum ?_
simp only [smul_eq_mul, List.map_map, List.forall₂_map_right_iff, Function.comp_apply,
List.forall₂_map_left_iff, map_smul, lift.tprod, ContinuousMultilinearMap.coe_coe,
List.forall₂_same, Prod.forall]
intro a m _
rw [norm_smul, ← mul_assoc, mul_comm ‖f‖ _, mul_assoc]
exact mul_le_mul_of_nonneg_left (f.le_opNorm _) (norm_nonneg _)
| 0 |
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 LinearOrderedAddCommGroup
variable [LinearOrderedAddCommGroup α]
| Mathlib/Algebra/Order/Interval/Set/Group.lean | 151 | 157 | theorem nonempty_Ico_sdiff {x dx y dy : α} (h : dy < dx) (hx : 0 < dx) :
Nonempty ↑(Ico x (x + dx) \ Ico y (y + dy)) := by |
cases' lt_or_le x y with h' h'
· use x
simp [*, not_le.2 h']
· use max x (x + dy)
simp [*, le_refl]
| 0 |
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.LinearAlgebra.Dimension.Constructions
#align_import algebra.linear_recurrence from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f"
noncomputable section
open Finset
open Polynomial
structure LinearRecurrence (α : Type*) [CommSemiring α] where
order : ℕ
coeffs : Fin order → α
#align linear_recurrence LinearRecurrence
instance (α : Type*) [CommSemiring α] : Inhabited (LinearRecurrence α) :=
⟨⟨0, default⟩⟩
namespace LinearRecurrence
section CommSemiring
variable {α : Type*} [CommSemiring α] (E : LinearRecurrence α)
def IsSolution (u : ℕ → α) :=
∀ n, u (n + E.order) = ∑ i, E.coeffs i * u (n + i)
#align linear_recurrence.is_solution LinearRecurrence.IsSolution
def mkSol (init : Fin E.order → α) : ℕ → α
| n =>
if h : n < E.order then init ⟨n, h⟩
else
∑ k : Fin E.order,
have _ : n - E.order + k < n := by
rw [add_comm, ← add_tsub_assoc_of_le (not_lt.mp h), tsub_lt_iff_left]
· exact add_lt_add_right k.is_lt n
· convert add_le_add (zero_le (k : ℕ)) (not_lt.mp h)
simp only [zero_add]
E.coeffs k * mkSol init (n - E.order + k)
#align linear_recurrence.mk_sol LinearRecurrence.mkSol
| Mathlib/Algebra/LinearRecurrence.lean | 85 | 88 | theorem is_sol_mkSol (init : Fin E.order → α) : E.IsSolution (E.mkSol init) := by |
intro n
rw [mkSol]
simp
| 0 |
import Mathlib.Analysis.Fourier.AddCircle
import Mathlib.Analysis.Fourier.FourierTransform
import Mathlib.Analysis.PSeries
import Mathlib.Analysis.Distribution.SchwartzSpace
import Mathlib.MeasureTheory.Measure.Lebesgue.Integral
#align_import analysis.fourier.poisson_summation from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open Function hiding comp_apply
open Set hiding restrict_apply
open Complex hiding abs_of_nonneg
open Real
open TopologicalSpace Filter MeasureTheory Asymptotics
open scoped Real Filter FourierTransform
open ContinuousMap
theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)}
(hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖)
(m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by
-- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc
-- block, but I think it's more legible this way. We start with preliminaries about the integrand.
let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩
have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by
have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x))
intro K g
simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul]
have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by
intro n; ext1 x
have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m))
simpa only [mul_one] using this.int_mul n x
-- Now the main argument. First unwind some definitions.
calc
fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m =
∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by
simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply,
coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul]
-- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values.
_ = ∫ x in (0:ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by
simp_rw [coe_mul, Pi.mul_apply,
← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left]
-- Swap sum and integral.
_ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by
refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm
convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1
exact funext fun n => neK _ _
_ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by
simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢
simp_rw [eadd]
-- Rearrange sum of interval integrals into an integral over `ℝ`.
_ = ∫ x, e x * f x := by
suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq
apply integrable_of_summable_norm_Icc
convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1
simp_rw [mul_comp] at eadd ⊢
simp_rw [eadd]
exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _
-- Minor tidying to finish
_ = 𝓕 f m := by
rw [fourierIntegral_real_eq_integral_exp_smul]
congr 1 with x : 1
rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply]
congr 2
push_cast
ring
#align real.fourier_coeff_tsum_comp_add Real.fourierCoeff_tsum_comp_add
| Mathlib/Analysis/Fourier/PoissonSummation.lean | 107 | 121 | theorem Real.tsum_eq_tsum_fourierIntegral {f : C(ℝ, ℂ)}
(h_norm :
∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict K‖)
(h_sum : Summable fun n : ℤ => 𝓕 f n) (x : ℝ) :
∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := by |
let F : C(UnitAddCircle, ℂ) :=
⟨(f.periodic_tsum_comp_add_zsmul 1).lift, continuous_coinduced_dom.mpr (map_continuous _)⟩
have : Summable (fourierCoeff F) := by
convert h_sum
exact Real.fourierCoeff_tsum_comp_add h_norm _
convert (has_pointwise_sum_fourier_series_of_summable this x).tsum_eq.symm using 1
· simpa only [F, coe_mk, ← QuotientAddGroup.mk_zero, Periodic.lift_coe, zsmul_one, comp_apply,
coe_addRight, zero_add]
using (hasSum_apply (summable_of_locally_summable_norm h_norm).hasSum x).tsum_eq
· simp_rw [← Real.fourierCoeff_tsum_comp_add h_norm, smul_eq_mul, F, coe_mk]
| 0 |
import Mathlib.Topology.Sheaves.Forget
import Mathlib.Topology.Sheaves.SheafCondition.PairwiseIntersections
import Mathlib.CategoryTheory.Limits.Shapes.Types
#align_import topology.sheaves.sheaf_condition.unique_gluing from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
noncomputable section
open TopCat TopCat.Presheaf CategoryTheory CategoryTheory.Limits
TopologicalSpace TopologicalSpace.Opens Opposite
universe v u x
variable {C : Type u} [Category.{v} C] [ConcreteCategory.{v} C]
namespace TopCat
namespace Presheaf
section
attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike
variable {X : TopCat.{x}} (F : Presheaf C X) {ι : Type x} (U : ι → Opens X)
def IsCompatible (sf : ∀ i : ι, F.obj (op (U i))) : Prop :=
∀ i j : ι, F.map (infLELeft (U i) (U j)).op (sf i) = F.map (infLERight (U i) (U j)).op (sf j)
set_option linter.uppercaseLean3 false in
#align Top.presheaf.is_compatible TopCat.Presheaf.IsCompatible
def IsGluing (sf : ∀ i : ι, F.obj (op (U i))) (s : F.obj (op (iSup U))) : Prop :=
∀ i : ι, F.map (Opens.leSupr U i).op s = sf i
set_option linter.uppercaseLean3 false in
#align Top.presheaf.is_gluing TopCat.Presheaf.IsGluing
def IsSheafUniqueGluing : Prop :=
∀ ⦃ι : Type x⦄ (U : ι → Opens X) (sf : ∀ i : ι, F.obj (op (U i))),
IsCompatible F U sf → ∃! s : F.obj (op (iSup U)), IsGluing F U sf s
set_option linter.uppercaseLean3 false in
#align Top.presheaf.is_sheaf_unique_gluing TopCat.Presheaf.IsSheafUniqueGluing
end
section TypeValued
variable {X : TopCat.{x}} {F : Presheaf (Type u) X} {ι : Type x} {U : ι → Opens X}
def objPairwiseOfFamily (sf : ∀ i, F.obj (op (U i))) :
∀ i, ((Pairwise.diagram U).op ⋙ F).obj i
| ⟨Pairwise.single i⟩ => sf i
| ⟨Pairwise.pair i j⟩ => F.map (infLELeft (U i) (U j)).op (sf i)
def IsCompatible.sectionPairwise {sf} (h : IsCompatible F U sf) :
((Pairwise.diagram U).op ⋙ F).sections := by
refine ⟨objPairwiseOfFamily sf, ?_⟩
let G := (Pairwise.diagram U).op ⋙ F
rintro (i|⟨i,j⟩) (i'|⟨i',j'⟩) (_|_|_|_)
· exact congr_fun (G.map_id <| op <| Pairwise.single i) _
· rfl
· exact (h i' i).symm
· exact congr_fun (G.map_id <| op <| Pairwise.pair i j) _
| Mathlib/Topology/Sheaves/SheafCondition/UniqueGluing.lean | 112 | 118 | theorem isGluing_iff_pairwise {sf s} : IsGluing F U sf s ↔
∀ i, (F.mapCone (Pairwise.cocone U).op).π.app i s = objPairwiseOfFamily sf i := by |
refine ⟨fun h ↦ ?_, fun h i ↦ h (op <| Pairwise.single i)⟩
rintro (i|⟨i,j⟩)
· exact h i
· rw [← (F.mapCone (Pairwise.cocone U).op).w (op <| Pairwise.Hom.left i j)]
exact congr_arg _ (h i)
| 0 |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Data.Finset.Pointwise
import Mathlib.Tactic.GCongr
#align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd"
open Nat
open NNRat Pointwise
namespace Finset
variable {α : Type*} [CommGroup α] [DecidableEq α] {A B C : Finset α}
@[to_additive card_sub_mul_le_card_sub_mul_card_sub
"**Ruzsa's triangle inequality**. Subtraction version."]
theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset α) :
(A / C).card * B.card ≤ (A / B).card * (B / C).card := by
rw [← card_product (A / B), ← mul_one ((A / B) ×ˢ (B / C)).card]
refine card_mul_le_card_mul (fun b ac ↦ ac.1 * ac.2 = b) (fun x hx ↦ ?_)
fun x _ ↦ card_le_one_iff.2 fun hu hv ↦
((mem_bipartiteBelow _).1 hu).2.symm.trans ?_
obtain ⟨a, ha, c, hc, rfl⟩ := mem_div.1 hx
refine card_le_card_of_inj_on (fun b ↦ (a / b, b / c)) (fun b hb ↦ ?_) fun b₁ _ b₂ _ h ↦ ?_
· rw [mem_bipartiteAbove]
exact ⟨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _⟩
· exact div_right_injective (Prod.ext_iff.1 h).1
· exact ((mem_bipartiteBelow _).1 hv).2
#align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div
#align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub
@[to_additive card_sub_mul_le_card_add_mul_card_add
"**Ruzsa's triangle inequality**. Sub-add-add version."]
| Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean | 63 | 66 | theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset α) :
(A / C).card * B.card ≤ (A * B).card * (B * C).card := by |
rw [← div_inv_eq_mul, ← card_inv B, ← card_inv (B * C), mul_inv, ← div_eq_mul_inv]
exact card_div_mul_le_card_div_mul_card_div _ _ _
| 0 |
import Batteries.Data.List.Lemmas
namespace List
universe u v
variable {α : Type u} {β : Type v}
@[simp] theorem eraseIdx_zero (l : List α) : eraseIdx l 0 = tail l := by cases l <;> rfl
theorem eraseIdx_eq_take_drop_succ :
∀ (l : List α) (i : Nat), l.eraseIdx i = l.take i ++ l.drop (i + 1)
| nil, _ => by simp
| a::l, 0 => by simp
| a::l, i + 1 => by simp [eraseIdx_eq_take_drop_succ l i]
theorem eraseIdx_sublist : ∀ (l : List α) (k : Nat), eraseIdx l k <+ l
| [], _ => by simp
| a::l, 0 => by simp
| a::l, k + 1 => by simp [eraseIdx_sublist l k]
theorem eraseIdx_subset (l : List α) (k : Nat) : eraseIdx l k ⊆ l := (eraseIdx_sublist l k).subset
@[simp]
theorem eraseIdx_eq_self : ∀ {l : List α} {k : Nat}, eraseIdx l k = l ↔ length l ≤ k
| [], _ => by simp
| a::l, 0 => by simp [(cons_ne_self _ _).symm]
| a::l, k + 1 => by simp [eraseIdx_eq_self]
alias ⟨_, eraseIdx_of_length_le⟩ := eraseIdx_eq_self
theorem eraseIdx_append_of_lt_length {l : List α} {k : Nat} (hk : k < length l) (l' : List α) :
eraseIdx (l ++ l') k = eraseIdx l k ++ l' := by
rw [eraseIdx_eq_take_drop_succ, take_append_of_le_length, drop_append_of_le_length,
eraseIdx_eq_take_drop_succ, append_assoc]
all_goals omega
theorem eraseIdx_append_of_length_le {l : List α} {k : Nat} (hk : length l ≤ k) (l' : List α) :
eraseIdx (l ++ l') k = l ++ eraseIdx l' (k - length l) := by
rw [eraseIdx_eq_take_drop_succ, eraseIdx_eq_take_drop_succ,
take_append_eq_append_take, drop_append_eq_append_drop,
take_all_of_le hk, drop_eq_nil_of_le (by omega), nil_append, append_assoc]
congr
omega
protected theorem IsPrefix.eraseIdx {l l' : List α} (h : l <+: l') (k : Nat) :
eraseIdx l k <+: eraseIdx l' k := by
rcases h with ⟨t, rfl⟩
if hkl : k < length l then
simp [eraseIdx_append_of_lt_length hkl]
else
rw [Nat.not_lt] at hkl
simp [eraseIdx_append_of_length_le hkl, eraseIdx_of_length_le hkl]
theorem mem_eraseIdx_iff_get {x : α} :
∀ {l} {k}, x ∈ eraseIdx l k ↔ ∃ i : Fin l.length, ↑i ≠ k ∧ l.get i = x
| [], _ => by
simp only [eraseIdx, Fin.exists_iff, not_mem_nil, false_iff]
rintro ⟨i, h, -⟩
exact Nat.not_lt_zero _ h
| a::l, 0 => by simp [Fin.exists_fin_succ, mem_iff_get]
| a::l, k+1 => by
simp [Fin.exists_fin_succ, mem_eraseIdx_iff_get, @eq_comm _ a, k.succ_ne_zero.symm]
| .lake/packages/batteries/Batteries/Data/List/EraseIdx.lean | 76 | 80 | theorem mem_eraseIdx_iff_get? {x : α} {l} {k} : x ∈ eraseIdx l k ↔ ∃ i ≠ k, l.get? i = x := by |
simp only [mem_eraseIdx_iff_get, Fin.exists_iff, exists_and_left, get_eq_iff, exists_prop]
refine exists_congr fun i => and_congr_right' <| and_iff_right_of_imp fun h => ?_
obtain ⟨h, -⟩ := get?_eq_some.1 h
exact h
| 0 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 76 | 85 | theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by |
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
| 0 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Tactic.Abel
#align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589"
universe u v
open Polynomial
open Polynomial
section Semiring
variable (S : Type u) [Semiring S]
noncomputable def ascPochhammer : ℕ → S[X]
| 0 => 1
| n + 1 => X * (ascPochhammer n).comp (X + 1)
#align pochhammer ascPochhammer
@[simp]
theorem ascPochhammer_zero : ascPochhammer S 0 = 1 :=
rfl
#align pochhammer_zero ascPochhammer_zero
@[simp]
theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer]
#align pochhammer_one ascPochhammer_one
theorem ascPochhammer_succ_left (n : ℕ) :
ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by
rw [ascPochhammer]
#align pochhammer_succ_left ascPochhammer_succ_left
theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] :
Monic <| ascPochhammer S n := by
induction' n with n hn
· simp
· have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1
rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul,
leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn,
monic_X, one_mul, one_mul, this, one_pow]
section
variable {S} {T : Type v} [Semiring T]
@[simp]
theorem ascPochhammer_map (f : S →+* T) (n : ℕ) :
(ascPochhammer S n).map f = ascPochhammer T n := by
induction' n with n ih
· simp
· simp [ih, ascPochhammer_succ_left, map_comp]
#align pochhammer_map ascPochhammer_map
theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) :
(ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by
rw [← ascPochhammer_map f]
exact eval_map f t
theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S]
(x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x =
(ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by
rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S),
← map_comp, eval_map]
end
@[simp, norm_cast]
theorem ascPochhammer_eval_cast (n k : ℕ) :
(((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by
rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S),
eval₂_at_natCast,Nat.cast_id]
#align pochhammer_eval_cast ascPochhammer_eval_cast
theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by
cases n
· simp
· simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left]
#align pochhammer_eval_zero ascPochhammer_eval_zero
theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by simp
#align pochhammer_zero_eval_zero ascPochhammer_zero_eval_zero
@[simp]
theorem ascPochhammer_ne_zero_eval_zero {n : ℕ} (h : n ≠ 0) : (ascPochhammer S n).eval 0 = 0 := by
simp [ascPochhammer_eval_zero, h]
#align pochhammer_ne_zero_eval_zero ascPochhammer_ne_zero_eval_zero
theorem ascPochhammer_succ_right (n : ℕ) :
ascPochhammer S (n + 1) = ascPochhammer S n * (X + (n : S[X])) := by
suffices h : ascPochhammer ℕ (n + 1) = ascPochhammer ℕ n * (X + (n : ℕ[X])) by
apply_fun Polynomial.map (algebraMap ℕ S) at h
simpa only [ascPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X,
Polynomial.map_natCast] using h
induction' n with n ih
· simp
· conv_lhs =>
rw [ascPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← ascPochhammer_succ_left, add_comp,
X_comp, natCast_comp, add_assoc, add_comm (1 : ℕ[X]), ← Nat.cast_succ]
#align pochhammer_succ_right ascPochhammer_succ_right
theorem ascPochhammer_succ_eval {S : Type*} [Semiring S] (n : ℕ) (k : S) :
(ascPochhammer S (n + 1)).eval k = (ascPochhammer S n).eval k * (k + n) := by
rw [ascPochhammer_succ_right, mul_add, eval_add, eval_mul_X, ← Nat.cast_comm, ← C_eq_natCast,
eval_C_mul, Nat.cast_comm, ← mul_add]
#align pochhammer_succ_eval ascPochhammer_succ_eval
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 143 | 152 | theorem ascPochhammer_succ_comp_X_add_one (n : ℕ) :
(ascPochhammer S (n + 1)).comp (X + 1) =
ascPochhammer S (n + 1) + (n + 1) • (ascPochhammer S n).comp (X + 1) := by |
suffices (ascPochhammer ℕ (n + 1)).comp (X + 1) =
ascPochhammer ℕ (n + 1) + (n + 1) * (ascPochhammer ℕ n).comp (X + 1)
by simpa [map_comp] using congr_arg (Polynomial.map (Nat.castRingHom S)) this
nth_rw 2 [ascPochhammer_succ_left]
rw [← add_mul, ascPochhammer_succ_right ℕ n, mul_comp, mul_comm, add_comp, X_comp, natCast_comp,
add_comm, ← add_assoc]
ring
| 0 |
import Mathlib.Algebra.BigOperators.Finsupp
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.LinearIndependent
import Mathlib.SetTheory.Cardinal.Cofinality
#align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
noncomputable section
universe u
open Function Set Submodule
variable {ι : Type*} {ι' : Type*} {R : Type*} {R₂ : Type*} {K : Type*}
variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*}
section Module
variable [Semiring R]
variable [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']
section
variable (ι R M)
structure Basis where
ofRepr ::
repr : M ≃ₗ[R] ι →₀ R
#align basis Basis
#align basis.repr Basis.repr
#align basis.of_repr Basis.ofRepr
end
instance uniqueBasis [Subsingleton R] : Unique (Basis ι R M) :=
⟨⟨⟨default⟩⟩, fun ⟨b⟩ => by rw [Subsingleton.elim b]⟩
#align unique_basis uniqueBasis
namespace Basis
instance : Inhabited (Basis ι R (ι →₀ R)) :=
⟨.ofRepr (LinearEquiv.refl _ _)⟩
variable (b b₁ : Basis ι R M) (i : ι) (c : R) (x : M)
section repr
theorem repr_injective : Injective (repr : Basis ι R M → M ≃ₗ[R] ι →₀ R) := fun f g h => by
cases f; cases g; congr
#align basis.repr_injective Basis.repr_injective
instance instFunLike : FunLike (Basis ι R M) ι M where
coe b i := b.repr.symm (Finsupp.single i 1)
coe_injective' f g h := repr_injective <| LinearEquiv.symm_bijective.injective <|
LinearEquiv.toLinearMap_injective <| by ext; exact congr_fun h _
#align basis.fun_like Basis.instFunLike
@[simp]
theorem coe_ofRepr (e : M ≃ₗ[R] ι →₀ R) : ⇑(ofRepr e) = fun i => e.symm (Finsupp.single i 1) :=
rfl
#align basis.coe_of_repr Basis.coe_ofRepr
protected theorem injective [Nontrivial R] : Injective b :=
b.repr.symm.injective.comp fun _ _ => (Finsupp.single_left_inj (one_ne_zero : (1 : R) ≠ 0)).mp
#align basis.injective Basis.injective
theorem repr_symm_single_one : b.repr.symm (Finsupp.single i 1) = b i :=
rfl
#align basis.repr_symm_single_one Basis.repr_symm_single_one
theorem repr_symm_single : b.repr.symm (Finsupp.single i c) = c • b i :=
calc
b.repr.symm (Finsupp.single i c) = b.repr.symm (c • Finsupp.single i (1 : R)) := by
{ rw [Finsupp.smul_single', mul_one] }
_ = c • b i := by rw [LinearEquiv.map_smul, repr_symm_single_one]
#align basis.repr_symm_single Basis.repr_symm_single
@[simp]
theorem repr_self : b.repr (b i) = Finsupp.single i 1 :=
LinearEquiv.apply_symm_apply _ _
#align basis.repr_self Basis.repr_self
theorem repr_self_apply (j) [Decidable (i = j)] : b.repr (b i) j = if i = j then 1 else 0 := by
rw [repr_self, Finsupp.single_apply]
#align basis.repr_self_apply Basis.repr_self_apply
@[simp]
theorem repr_symm_apply (v) : b.repr.symm v = Finsupp.total ι M R b v :=
calc
b.repr.symm v = b.repr.symm (v.sum Finsupp.single) := by simp
_ = v.sum fun i vi => b.repr.symm (Finsupp.single i vi) := map_finsupp_sum ..
_ = Finsupp.total ι M R b v := by simp only [repr_symm_single, Finsupp.total_apply]
#align basis.repr_symm_apply Basis.repr_symm_apply
@[simp]
theorem coe_repr_symm : ↑b.repr.symm = Finsupp.total ι M R b :=
LinearMap.ext fun v => b.repr_symm_apply v
#align basis.coe_repr_symm Basis.coe_repr_symm
@[simp]
theorem repr_total (v) : b.repr (Finsupp.total _ _ _ b v) = v := by
rw [← b.coe_repr_symm]
exact b.repr.apply_symm_apply v
#align basis.repr_total Basis.repr_total
@[simp]
theorem total_repr : Finsupp.total _ _ _ b (b.repr x) = x := by
rw [← b.coe_repr_symm]
exact b.repr.symm_apply_apply x
#align basis.total_repr Basis.total_repr
theorem repr_range : LinearMap.range (b.repr : M →ₗ[R] ι →₀ R) = Finsupp.supported R R univ := by
rw [LinearEquiv.range, Finsupp.supported_univ]
#align basis.repr_range Basis.repr_range
theorem mem_span_repr_support (m : M) : m ∈ span R (b '' (b.repr m).support) :=
(Finsupp.mem_span_image_iff_total _).2 ⟨b.repr m, by simp [Finsupp.mem_supported_support]⟩
#align basis.mem_span_repr_support Basis.mem_span_repr_support
| Mathlib/LinearAlgebra/Basis.lean | 186 | 189 | theorem repr_support_subset_of_mem_span (s : Set ι) {m : M}
(hm : m ∈ span R (b '' s)) : ↑(b.repr m).support ⊆ s := by |
rcases (Finsupp.mem_span_image_iff_total _).1 hm with ⟨l, hl, rfl⟩
rwa [repr_total, ← Finsupp.mem_supported R l]
| 0 |
import Mathlib.Analysis.Convex.Normed
import Mathlib.Analysis.Convex.Strict
import Mathlib.Analysis.Normed.Order.Basic
import Mathlib.Analysis.NormedSpace.AddTorsor
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Analysis.NormedSpace.Ray
#align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
open Convex Pointwise Set Metric
class StrictConvexSpace (𝕜 E : Type*) [NormedLinearOrderedField 𝕜] [NormedAddCommGroup E]
[NormedSpace 𝕜 E] : Prop where
strictConvex_closedBall : ∀ r : ℝ, 0 < r → StrictConvex 𝕜 (closedBall (0 : E) r)
#align strict_convex_space StrictConvexSpace
variable (𝕜 : Type*) {E : Type*} [NormedLinearOrderedField 𝕜] [NormedAddCommGroup E]
[NormedSpace 𝕜 E]
theorem strictConvex_closedBall [StrictConvexSpace 𝕜 E] (x : E) (r : ℝ) :
StrictConvex 𝕜 (closedBall x r) := by
rcases le_or_lt r 0 with hr | hr
· exact (subsingleton_closedBall x hr).strictConvex
rw [← vadd_closedBall_zero]
exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _
#align strict_convex_closed_ball strictConvex_closedBall
variable [NormedSpace ℝ E]
theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E 𝕜 ℝ]
(h : StrictConvex 𝕜 (closedBall (0 : E) 1)) : StrictConvexSpace 𝕜 E :=
⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩
#align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball
theorem StrictConvexSpace.of_norm_combo_lt_one
(h : ∀ x y : E, ‖x‖ = 1 → ‖y‖ = 1 → x ≠ y → ∃ a b : ℝ, a + b = 1 ∧ ‖a • x + b • y‖ < 1) :
StrictConvexSpace ℝ E := by
refine
StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ
((convex_closedBall _ _).strictConvex' fun x hx y hy hne => ?_)
rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball,
mem_sphere_zero_iff_norm] at hx hy
rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩
use b
rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff,
sub_eq_iff_eq_add.2 hab.symm]
#align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one
theorem StrictConvexSpace.of_norm_combo_ne_one
(h :
∀ x y : E,
‖x‖ = 1 → ‖y‖ = 1 → x ≠ y → ∃ a b : ℝ, 0 ≤ a ∧ 0 ≤ b ∧ a + b = 1 ∧ ‖a • x + b • y‖ ≠ 1) :
StrictConvexSpace ℝ E := by
refine StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ
((convex_closedBall _ _).strictConvex ?_)
simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise,
frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm]
intro x hx y hy hne
rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩
exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩
#align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one
| Mathlib/Analysis/Convex/StrictConvexSpace.lean | 123 | 130 | theorem StrictConvexSpace.of_norm_add_ne_two
(h : ∀ ⦃x y : E⦄, ‖x‖ = 1 → ‖y‖ = 1 → x ≠ y → ‖x + y‖ ≠ 2) : StrictConvexSpace ℝ E := by |
refine
StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne =>
⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, ?_⟩
rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne,
div_eq_one_iff_eq (two_ne_zero' ℝ)]
exact h hx hy hne
| 0 |
import Batteries.Classes.Order
namespace Batteries.PairingHeapImp
inductive Heap (α : Type u) where
| nil : Heap α
| node (a : α) (child sibling : Heap α) : Heap α
deriving Repr
def Heap.size : Heap α → Nat
| .nil => 0
| .node _ c s => c.size + 1 + s.size
def Heap.singleton (a : α) : Heap α := .node a .nil .nil
def Heap.isEmpty : Heap α → Bool
| .nil => true
| _ => false
@[specialize] def Heap.merge (le : α → α → Bool) : Heap α → Heap α → Heap α
| .nil, .nil => .nil
| .nil, .node a₂ c₂ _ => .node a₂ c₂ .nil
| .node a₁ c₁ _, .nil => .node a₁ c₁ .nil
| .node a₁ c₁ _, .node a₂ c₂ _ =>
if le a₁ a₂ then .node a₁ (.node a₂ c₂ c₁) .nil else .node a₂ (.node a₁ c₁ c₂) .nil
@[specialize] def Heap.combine (le : α → α → Bool) : Heap α → Heap α
| h₁@(.node _ _ h₂@(.node _ _ s)) => merge le (merge le h₁ h₂) (s.combine le)
| h => h
@[inline] def Heap.headD (a : α) : Heap α → α
| .nil => a
| .node a _ _ => a
@[inline] def Heap.head? : Heap α → Option α
| .nil => none
| .node a _ _ => some a
@[inline] def Heap.deleteMin (le : α → α → Bool) : Heap α → Option (α × Heap α)
| .nil => none
| .node a c _ => (a, combine le c)
@[inline] def Heap.tail? (le : α → α → Bool) (h : Heap α) : Option (Heap α) :=
deleteMin le h |>.map (·.snd)
@[inline] def Heap.tail (le : α → α → Bool) (h : Heap α) : Heap α :=
tail? le h |>.getD .nil
inductive Heap.NoSibling : Heap α → Prop
| nil : NoSibling .nil
| node (a c) : NoSibling (.node a c .nil)
instance : Decidable (Heap.NoSibling s) :=
match s with
| .nil => isTrue .nil
| .node a c .nil => isTrue (.node a c)
| .node _ _ (.node _ _ _) => isFalse nofun
theorem Heap.noSibling_merge (le) (s₁ s₂ : Heap α) :
(s₁.merge le s₂).NoSibling := by
unfold merge
(split <;> try split) <;> constructor
theorem Heap.noSibling_combine (le) (s : Heap α) :
(s.combine le).NoSibling := by
unfold combine; split
· exact noSibling_merge _ _ _
· match s with
| nil | node _ _ nil => constructor
| node _ _ (node _ _ s) => rename_i h; exact (h _ _ _ _ _ rfl).elim
theorem Heap.noSibling_deleteMin {s : Heap α} (eq : s.deleteMin le = some (a, s')) :
s'.NoSibling := by
cases s with cases eq | node a c => exact noSibling_combine _ _
| .lake/packages/batteries/Batteries/Data/PairingHeap.lean | 107 | 111 | theorem Heap.noSibling_tail? {s : Heap α} : s.tail? le = some s' →
s'.NoSibling := by |
simp only [Heap.tail?]; intro eq
match eq₂ : s.deleteMin le, eq with
| some (a, tl), rfl => exact noSibling_deleteMin eq₂
| 0 |
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Defs
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
variable {α : Type*}
open Opposite
namespace Set
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
| Mathlib/Data/Set/Opposite.lean | 92 | 96 | theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by |
ext
constructor
· apply op_injective
· apply unop_injective
| 0 |
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 Indecomposable
variable [Preadditive C] [HasBinaryBiproducts C]
-- There are another three potential variations of this lemma,
-- but as any one suffices to prove `indecomposable_of_simple` we will not give them all.
| Mathlib/CategoryTheory/Simple.lean | 193 | 201 | theorem Biprod.isIso_inl_iff_isZero (X Y : C) : IsIso (biprod.inl : X ⟶ X ⊞ Y) ↔ IsZero Y := by |
rw [biprod.isIso_inl_iff_id_eq_fst_comp_inl, ← biprod.total, add_right_eq_self]
constructor
· intro h
replace h := h =≫ biprod.snd
simpa [← IsZero.iff_isSplitEpi_eq_zero (biprod.snd : X ⊞ Y ⟶ Y)] using h
· intro h
rw [IsZero.iff_isSplitEpi_eq_zero (biprod.snd : X ⊞ Y ⟶ Y)] at h
rw [h, zero_comp]
| 0 |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.ZMod.Basic
#align_import data.zmod.parity from "leanprover-community/mathlib"@"048240e809f04e2bde02482ab44bc230744cc6c9"
namespace ZMod
theorem eq_zero_iff_even {n : ℕ} : (n : ZMod 2) = 0 ↔ Even n :=
(CharP.cast_eq_zero_iff (ZMod 2) 2 n).trans even_iff_two_dvd.symm
#align zmod.eq_zero_iff_even ZMod.eq_zero_iff_even
| Mathlib/Data/ZMod/Parity.lean | 28 | 29 | theorem eq_one_iff_odd {n : ℕ} : (n : ZMod 2) = 1 ↔ Odd n := by |
rw [← @Nat.cast_one (ZMod 2), ZMod.eq_iff_modEq_nat, Nat.odd_iff, Nat.ModEq]
| 0 |
import Mathlib.CategoryTheory.Action
import Mathlib.Combinatorics.Quiver.Arborescence
import Mathlib.Combinatorics.Quiver.ConnectedComponent
import Mathlib.GroupTheory.FreeGroup.IsFreeGroup
#align_import group_theory.nielsen_schreier from "leanprover-community/mathlib"@"1bda4fc53de6ade5ab9da36f2192e24e2084a2ce"
noncomputable section
open scoped Classical
universe v u
open CategoryTheory CategoryTheory.ActionCategory CategoryTheory.SingleObj Quiver FreeGroup
-- Porting note(#5171): @[nolint has_nonempty_instance]
@[nolint unusedArguments]
def IsFreeGroupoid.Generators (G) [Groupoid G] :=
G
#align is_free_groupoid.generators IsFreeGroupoid.Generators
class IsFreeGroupoid (G) [Groupoid.{v} G] where
quiverGenerators : Quiver.{v + 1} (IsFreeGroupoid.Generators G)
of : ∀ {a b : IsFreeGroupoid.Generators G}, (a ⟶ b) → ((show G from a) ⟶ b)
unique_lift :
∀ {X : Type v} [Group X] (f : Labelling (IsFreeGroupoid.Generators G) X),
∃! F : G ⥤ CategoryTheory.SingleObj X, ∀ (a b) (g : a ⟶ b), F.map (of g) = f g
#align is_free_groupoid IsFreeGroupoid
attribute [nolint docBlame] IsFreeGroupoid.of IsFreeGroupoid.unique_lift
namespace IsFreeGroupoid
attribute [instance] quiverGenerators
@[ext]
theorem ext_functor {G} [Groupoid.{v} G] [IsFreeGroupoid G] {X : Type v} [Group X]
(f g : G ⥤ CategoryTheory.SingleObj X) (h : ∀ (a b) (e : a ⟶ b), f.map (of e) = g.map (of e)) :
f = g :=
let ⟨_, _, u⟩ := @unique_lift G _ _ X _ fun (a b : Generators G) (e : a ⟶ b) => g.map (of e)
_root_.trans (u _ h) (u _ fun _ _ _ => rfl).symm
#align is_free_groupoid.ext_functor IsFreeGroupoid.ext_functor
instance actionGroupoidIsFree {G A : Type u} [Group G] [IsFreeGroup G] [MulAction G A] :
IsFreeGroupoid (ActionCategory G A) where
quiverGenerators :=
⟨fun a b => { e : IsFreeGroup.Generators G // IsFreeGroup.of e • a.back = b.back }⟩
of := fun (e : { e // _}) => ⟨IsFreeGroup.of e, e.property⟩
unique_lift := by
intro X _ f
let f' : IsFreeGroup.Generators G → (A → X) ⋊[mulAutArrow] G := fun e =>
⟨fun b => @f ⟨(), _⟩ ⟨(), b⟩ ⟨e, smul_inv_smul _ b⟩, IsFreeGroup.of e⟩
rcases IsFreeGroup.unique_lift f' with ⟨F', hF', uF'⟩
refine ⟨uncurry F' ?_, ?_, ?_⟩
· suffices SemidirectProduct.rightHom.comp F' = MonoidHom.id _ by
-- Porting note: `MonoidHom.ext_iff` has been deprecated.
exact DFunLike.ext_iff.mp this
apply IsFreeGroup.ext_hom (fun x ↦ ?_)
rw [MonoidHom.comp_apply, hF']
rfl
· rintro ⟨⟨⟩, a : A⟩ ⟨⟨⟩, b⟩ ⟨e, h : IsFreeGroup.of e • a = b⟩
change (F' (IsFreeGroup.of _)).left _ = _
rw [hF']
cases inv_smul_eq_iff.mpr h.symm
rfl
· intro E hE
have : curry E = F' := by
apply uF'
intro e
ext
· convert hE _ _ _
rfl
· rfl
apply Functor.hext
· intro
apply Unit.ext
· refine ActionCategory.cases ?_
intros
simp only [← this, uncurry_map, curry_apply_left, coe_back, homOfPair.val]
rfl
#align is_free_groupoid.action_groupoid_is_free IsFreeGroupoid.actionGroupoidIsFree
namespace SpanningTree
variable {G : Type u} [Groupoid.{u} G] [IsFreeGroupoid G]
(T : WideSubquiver (Symmetrify <| Generators G)) [Arborescence T]
private def root' : G :=
show T from root T
-- #align is_free_groupoid.spanning_tree.root' IsFreeGroupoid.SpanningTree.root'
-- this has to be marked noncomputable, see issue #451.
-- It might be nicer to define this in terms of `composePath`
-- Porting note: removed noncomputable. This is already declared at the beginning of the section.
def homOfPath : ∀ {a : G}, Path (root T) a → (root' T ⟶ a)
| _, Path.nil => 𝟙 _
| _, Path.cons p f => homOfPath p ≫ Sum.recOn f.val (fun e => of e) fun e => inv (of e)
#align is_free_groupoid.spanning_tree.hom_of_path IsFreeGroupoid.SpanningTree.homOfPath
def treeHom (a : G) : root' T ⟶ a :=
homOfPath T default
#align is_free_groupoid.spanning_tree.tree_hom IsFreeGroupoid.SpanningTree.treeHom
theorem treeHom_eq {a : G} (p : Path (root T) a) : treeHom T a = homOfPath T p := by
rw [treeHom, Unique.default_eq]
#align is_free_groupoid.spanning_tree.tree_hom_eq IsFreeGroupoid.SpanningTree.treeHom_eq
@[simp]
theorem treeHom_root : treeHom T (root' T) = 𝟙 _ :=
-- this should just be `treeHom_eq T Path.nil`, but Lean treats `homOfPath` with suspicion.
_root_.trans
(treeHom_eq T Path.nil) rfl
#align is_free_groupoid.spanning_tree.tree_hom_root IsFreeGroupoid.SpanningTree.treeHom_root
def loopOfHom {a b : G} (p : a ⟶ b) : End (root' T) :=
treeHom T a ≫ p ≫ inv (treeHom T b)
#align is_free_groupoid.spanning_tree.loop_of_hom IsFreeGroupoid.SpanningTree.loopOfHom
| Mathlib/GroupTheory/FreeGroup/NielsenSchreier.lean | 195 | 202 | theorem loopOfHom_eq_id {a b : Generators G} (e) (H : e ∈ wideSubquiverSymmetrify T a b) :
loopOfHom T (of e) = 𝟙 (root' T) := by |
rw [loopOfHom, ← Category.assoc, IsIso.comp_inv_eq, Category.id_comp]
cases' H with H H
· rw [treeHom_eq T (Path.cons default ⟨Sum.inl e, H⟩), homOfPath]
rfl
· rw [treeHom_eq T (Path.cons default ⟨Sum.inr e, H⟩), homOfPath]
simp only [IsIso.inv_hom_id, Category.comp_id, Category.assoc, treeHom]
| 0 |
import Mathlib.RingTheory.FiniteType
import Mathlib.RingTheory.Localization.AtPrime
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.RingTheory.RingHomProperties
import Mathlib.Data.Set.Subsingleton
#align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
open scoped Pointwise Classical
universe u
variable {R S : Type u} [CommRing R] [CommRing S] (M : Submonoid R)
variable (N : Submonoid S) (R' S' : Type u) [CommRing R'] [CommRing S'] (f : R →+* S)
variable [Algebra R R'] [Algebra S S']
section Properties
section Ideal
open scoped nonZeroDivisors
theorem Ideal.le_of_localization_maximal {I J : Ideal R}
(h : ∀ (P : Ideal R) (hP : P.IsMaximal),
Ideal.map (algebraMap R (Localization.AtPrime P)) I ≤
Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
I ≤ J := by
intro x hx
suffices J.colon (Ideal.span {x}) = ⊤ by
simpa using Submodule.mem_colon.mp
(show (1 : R) ∈ J.colon (Ideal.span {x}) from this.symm ▸ Submodule.mem_top) x
(Ideal.mem_span_singleton_self x)
refine Not.imp_symm (J.colon (Ideal.span {x})).exists_le_maximal ?_
push_neg
intro P hP le
obtain ⟨⟨⟨a, ha⟩, ⟨s, hs⟩⟩, eq⟩ :=
(IsLocalization.mem_map_algebraMap_iff P.primeCompl _).mp (h P hP (Ideal.mem_map_of_mem _ hx))
rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq
obtain ⟨⟨m, hm⟩, eq⟩ := (IsLocalization.map_eq_zero_iff P.primeCompl _ _).mp eq
refine hs ((hP.isPrime.mem_or_mem (le (Ideal.mem_colon_singleton.mpr ?_))).resolve_right hm)
simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq
simpa only [mul_assoc, eq] using J.mul_mem_left m ha
#align ideal.le_of_localization_maximal Ideal.le_of_localization_maximal
theorem Ideal.eq_of_localization_maximal {I J : Ideal R}
(h : ∀ (P : Ideal R) (_ : P.IsMaximal),
Ideal.map (algebraMap R (Localization.AtPrime P)) I =
Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
I = J :=
le_antisymm (Ideal.le_of_localization_maximal fun P hP => (h P hP).le)
(Ideal.le_of_localization_maximal fun P hP => (h P hP).ge)
#align ideal.eq_of_localization_maximal Ideal.eq_of_localization_maximal
theorem ideal_eq_bot_of_localization' (I : Ideal R)
(h : ∀ (J : Ideal R) (hJ : J.IsMaximal),
Ideal.map (algebraMap R (Localization.AtPrime J)) I = ⊥) :
I = ⊥ :=
Ideal.eq_of_localization_maximal fun P hP => by simpa using h P hP
#align ideal_eq_bot_of_localization' ideal_eq_bot_of_localization'
-- TODO: This proof should work for all modules, once we have enough material on submodules of
-- localized modules.
theorem ideal_eq_bot_of_localization (I : Ideal R)
(h : ∀ (J : Ideal R) (hJ : J.IsMaximal),
IsLocalization.coeSubmodule (Localization.AtPrime J) I = ⊥) :
I = ⊥ :=
ideal_eq_bot_of_localization' _ fun P hP =>
(Ideal.map_eq_bot_iff_le_ker _).mpr fun x hx => by
rw [RingHom.mem_ker, ← Submodule.mem_bot R, ← h P hP, IsLocalization.mem_coeSubmodule]
exact ⟨x, hx, rfl⟩
#align ideal_eq_bot_of_localization ideal_eq_bot_of_localization
| Mathlib/RingTheory/LocalProperties.lean | 290 | 300 | theorem eq_zero_of_localization (r : R)
(h : ∀ (J : Ideal R) (hJ : J.IsMaximal), algebraMap R (Localization.AtPrime J) r = 0) :
r = 0 := by |
rw [← Ideal.span_singleton_eq_bot]
apply ideal_eq_bot_of_localization
intro J hJ
delta IsLocalization.coeSubmodule
erw [Submodule.map_span, Submodule.span_eq_bot]
rintro _ ⟨_, h', rfl⟩
cases Set.mem_singleton_iff.mpr h'
exact h J hJ
| 0 |
import Mathlib.NumberTheory.ZetaValues
import Mathlib.NumberTheory.LSeries.RiemannZeta
open Complex Real Set
open scoped Nat
namespace HurwitzZeta
variable {k : ℕ} {x : ℝ}
theorem cosZeta_two_mul_nat (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k) / 2 / (2 * k)! *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_cosZeta x (?_ : 1 < re (2 * k))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_cos hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc,
← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul, cpow_natCast, ofReal_pow, ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, natCast_re, Nat.cast_lt]
omega
theorem sinZeta_two_mul_nat_add_one (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
sinZeta x (2 * k + 1) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k + 1) / 2 / (2 * k + 1)! *
((Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_sinZeta x (?_ : 1 < re (2 * k + 1))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_sin hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc]
congr 1
rw [← Nat.cast_ofNat, ← Nat.cast_mul, ← Nat.cast_add_one, cpow_natCast, ofReal_pow,
ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, ← Nat.cast_add_one, natCast_re,
Nat.cast_lt, lt_add_iff_pos_left]
exact mul_pos two_pos (Nat.pos_of_ne_zero hk)
| Mathlib/NumberTheory/LSeries/HurwitzZetaValues.lean | 100 | 110 | theorem cosZeta_two_mul_nat' (hk : k ≠ 0) (hx : x ∈ Icc (0 : ℝ) 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) / (2 * k) / Gammaℂ (2 * k) *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by |
rw [cosZeta_two_mul_nat hk hx]
congr 1
have : (2 * k)! = (2 * k) * Complex.Gamma (2 * k) := by
rw [(by { norm_cast; omega } : 2 * (k : ℂ) = ↑(2 * k - 1) + 1), Complex.Gamma_nat_eq_factorial,
← Nat.cast_add_one, ← Nat.cast_mul, ← Nat.factorial_succ, Nat.sub_add_cancel (by omega)]
simp_rw [this, Gammaℂ, cpow_neg, ← div_div, div_inv_eq_mul, div_mul_eq_mul_div, div_div,
mul_right_comm (2 : ℂ) (k : ℂ)]
norm_cast
| 0 |
import Mathlib.Topology.Connected.Basic
import Mathlib.Topology.Separation
open scoped Topology
variable {X Y A} [TopologicalSpace X] [TopologicalSpace A]
theorem embedding_toPullbackDiag (f : X → Y) : Embedding (toPullbackDiag f) :=
Embedding.mk' _ (injective_toPullbackDiag f) fun x ↦ by
rw [toPullbackDiag, nhds_induced, Filter.comap_comap, nhds_prod_eq, Filter.comap_prod]
erw [Filter.comap_id, inf_idem]
lemma Continuous.mapPullback {X₁ X₂ Y₁ Y₂ Z₁ Z₂}
[TopologicalSpace X₁] [TopologicalSpace X₂] [TopologicalSpace Z₁] [TopologicalSpace Z₂]
{f₁ : X₁ → Y₁} {g₁ : Z₁ → Y₁} {f₂ : X₂ → Y₂} {g₂ : Z₂ → Y₂}
{mapX : X₁ → X₂} (contX : Continuous mapX) {mapY : Y₁ → Y₂}
{mapZ : Z₁ → Z₂} (contZ : Continuous mapZ)
{commX : f₂ ∘ mapX = mapY ∘ f₁} {commZ : g₂ ∘ mapZ = mapY ∘ g₁} :
Continuous (Function.mapPullback mapX mapY mapZ commX commZ) := by
refine continuous_induced_rng.mpr (continuous_prod_mk.mpr ⟨?_, ?_⟩) <;>
apply_rules [continuous_fst, continuous_snd, continuous_subtype_val, Continuous.comp]
def IsSeparatedMap (f : X → Y) : Prop := ∀ x₁ x₂, f x₁ = f x₂ →
x₁ ≠ x₂ → ∃ s₁ s₂, IsOpen s₁ ∧ IsOpen s₂ ∧ x₁ ∈ s₁ ∧ x₂ ∈ s₂ ∧ Disjoint s₁ s₂
lemma t2space_iff_isSeparatedMap (y : Y) : T2Space X ↔ IsSeparatedMap fun _ : X ↦ y :=
⟨fun ⟨t2⟩ _ _ _ hne ↦ t2 hne, fun sep ↦ ⟨fun x₁ x₂ hne ↦ sep x₁ x₂ rfl hne⟩⟩
lemma T2Space.isSeparatedMap [T2Space X] (f : X → Y) : IsSeparatedMap f := fun _ _ _ ↦ t2_separation
lemma Function.Injective.isSeparatedMap {f : X → Y} (inj : f.Injective) : IsSeparatedMap f :=
fun _ _ he hne ↦ (hne (inj he)).elim
lemma isSeparatedMap_iff_disjoint_nhds {f : X → Y} : IsSeparatedMap f ↔
∀ x₁ x₂, f x₁ = f x₂ → x₁ ≠ x₂ → Disjoint (𝓝 x₁) (𝓝 x₂) :=
forall₃_congr fun x x' _ ↦ by simp only [(nhds_basis_opens x).disjoint_iff (nhds_basis_opens x'),
exists_prop, ← exists_and_left, and_assoc, and_comm, and_left_comm]
lemma isSeparatedMap_iff_nhds {f : X → Y} : IsSeparatedMap f ↔
∀ x₁ x₂, f x₁ = f x₂ → x₁ ≠ x₂ → ∃ s₁ ∈ 𝓝 x₁, ∃ s₂ ∈ 𝓝 x₂, Disjoint s₁ s₂ := by
simp_rw [isSeparatedMap_iff_disjoint_nhds, Filter.disjoint_iff]
open Set Filter in
| Mathlib/Topology/SeparatedMap.lean | 79 | 87 | theorem isSeparatedMap_iff_isClosed_diagonal {f : X → Y} :
IsSeparatedMap f ↔ IsClosed f.pullbackDiagonal := by |
simp_rw [isSeparatedMap_iff_nhds, ← isOpen_compl_iff, isOpen_iff_mem_nhds,
Subtype.forall, Prod.forall, nhds_induced, nhds_prod_eq]
refine forall₄_congr fun x₁ x₂ _ _ ↦ ⟨fun h ↦ ?_, fun ⟨t, ht, t_sub⟩ ↦ ?_⟩
· simp_rw [← Filter.disjoint_iff, ← compl_diagonal_mem_prod] at h
exact ⟨_, h, subset_rfl⟩
· obtain ⟨s₁, h₁, s₂, h₂, s_sub⟩ := mem_prod_iff.mp ht
exact ⟨s₁, h₁, s₂, h₂, disjoint_left.2 fun x h₁ h₂ ↦ @t_sub ⟨(x, x), rfl⟩ (s_sub ⟨h₁, h₂⟩) rfl⟩
| 0 |
import Mathlib.Data.DFinsupp.Basic
import Mathlib.Data.Finset.Pointwise
import Mathlib.LinearAlgebra.Basis.VectorSpace
#align_import algebra.group.unique_prods from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
@[to_additive
"Let `G` be a Type with addition, let `A B : Finset G` be finite subsets and
let `a0 b0 : G` be two elements. `UniqueAdd A B a0 b0` asserts `a0 + b0` can be written in at
most one way as a sum of an element from `A` and an element from `B`."]
def UniqueMul {G} [Mul G] (A B : Finset G) (a0 b0 : G) : Prop :=
∀ ⦃a b⦄, a ∈ A → b ∈ B → a * b = a0 * b0 → a = a0 ∧ b = b0
#align unique_mul UniqueMul
#align unique_add UniqueAdd
namespace UniqueMul
variable {G H : Type*} [Mul G] [Mul H] {A B : Finset G} {a0 b0 : G}
@[to_additive (attr := nontriviality, simp)]
theorem of_subsingleton [Subsingleton G] : UniqueMul A B a0 b0 := by
simp [UniqueMul, eq_iff_true_of_subsingleton]
@[to_additive]
| Mathlib/Algebra/Group/UniqueProds.lean | 71 | 75 | theorem of_card_le_one (hA : A.Nonempty) (hB : B.Nonempty) (hA1 : A.card ≤ 1) (hB1 : B.card ≤ 1) :
∃ a ∈ A, ∃ b ∈ B, UniqueMul A B a b := by |
rw [Finset.card_le_one_iff] at hA1 hB1
obtain ⟨a, ha⟩ := hA; obtain ⟨b, hb⟩ := hB
exact ⟨a, ha, b, hb, fun _ _ ha' hb' _ ↦ ⟨hA1 ha' ha, hB1 hb' hb⟩⟩
| 0 |
import Mathlib.MeasureTheory.Constructions.Prod.Basic
import Mathlib.MeasureTheory.Integral.DominatedConvergence
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.constructions.prod.integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical Topology ENNReal MeasureTheory
open Set Function Real ENNReal
open MeasureTheory MeasurableSpace MeasureTheory.Measure
open TopologicalSpace
open Filter hiding prod_eq map
variable {α α' β β' γ E : Type*}
variable [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace β']
variable [MeasurableSpace γ]
variable {μ μ' : Measure α} {ν ν' : Measure β} {τ : Measure γ}
variable [NormedAddCommGroup E]
theorem measurableSet_integrable [SigmaFinite ν] ⦃f : α → β → E⦄
(hf : StronglyMeasurable (uncurry f)) : MeasurableSet {x | Integrable (f x) ν} := by
simp_rw [Integrable, hf.of_uncurry_left.aestronglyMeasurable, true_and_iff]
exact measurableSet_lt (Measurable.lintegral_prod_right hf.ennnorm) measurable_const
#align measurable_set_integrable measurableSet_integrable
section
variable [NormedSpace ℝ E]
| Mathlib/MeasureTheory/Constructions/Prod/Integral.lean | 77 | 122 | theorem MeasureTheory.StronglyMeasurable.integral_prod_right [SigmaFinite ν] ⦃f : α → β → E⦄
(hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂ν := by |
by_cases hE : CompleteSpace E; swap; · simp [integral, hE, stronglyMeasurable_const]
borelize E
haveI : SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
hf.separableSpace_range_union_singleton
let s : ℕ → SimpleFunc (α × β) E :=
SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
let f' : ℕ → α → E := fun n => {x | Integrable (f x) ν}.indicator fun x => (s' n x).integral ν
have hf' : ∀ n, StronglyMeasurable (f' n) := by
intro n; refine StronglyMeasurable.indicator ?_ (measurableSet_integrable hf)
have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
intro x; refine Finset.Subset.trans (Finset.filter_subset _ _) ?_; intro y
simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
refine Finset.stronglyMeasurable_sum _ fun x _ => ?_
refine (Measurable.ennreal_toReal ?_).stronglyMeasurable.smul_const _
simp only [s', SimpleFunc.coe_comp, preimage_comp]
apply measurable_measure_prod_mk_left
exact (s n).measurableSet_fiber x
have h2f' : Tendsto f' atTop (𝓝 fun x : α => ∫ y : β, f x y ∂ν) := by
rw [tendsto_pi_nhds]; intro x
by_cases hfx : Integrable (f x) ν
· have (n) : Integrable (s' n x) ν := by
apply (hfx.norm.add hfx.norm).mono' (s' n x).aestronglyMeasurable
filter_upwards with y
simp_rw [s', SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n
simp only [f', hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem,
mem_setOf_eq]
refine
tendsto_integral_of_dominated_convergence (fun y => ‖f x y‖ + ‖f x y‖)
(fun n => (s' n x).aestronglyMeasurable) (hfx.norm.add hfx.norm) ?_ ?_
· refine fun n => eventually_of_forall fun y =>
SimpleFunc.norm_approxOn_zero_le ?_ ?_ (x, y) n
-- Porting note: Lean 3 solved the following two subgoals on its own
· exact hf.measurable
· simp
· refine eventually_of_forall fun y => SimpleFunc.tendsto_approxOn ?_ ?_ ?_
-- Porting note: Lean 3 solved the following two subgoals on its own
· exact hf.measurable.of_uncurry_left
· simp
apply subset_closure
simp [-uncurry_apply_pair]
· simp [f', hfx, integral_undef]
exact stronglyMeasurable_of_tendsto _ hf' h2f'
| 0 |
import Mathlib.Analysis.Complex.RemovableSingularity
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.complex.locally_uniform_limit from "leanprover-community/mathlib"@"fe44cd36149e675eb5dec87acc7e8f1d6568e081"
open Set Metric MeasureTheory Filter Complex intervalIntegral
open scoped Real Topology
variable {E ι : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] {U K : Set ℂ}
{z : ℂ} {M r δ : ℝ} {φ : Filter ι} {F : ι → ℂ → E} {f g : ℂ → E}
namespace Complex
section Cderiv
noncomputable def cderiv (r : ℝ) (f : ℂ → E) (z : ℂ) : E :=
(2 * π * I : ℂ)⁻¹ • ∮ w in C(z, r), ((w - z) ^ 2)⁻¹ • f w
#align complex.cderiv Complex.cderiv
theorem cderiv_eq_deriv (hU : IsOpen U) (hf : DifferentiableOn ℂ f U) (hr : 0 < r)
(hzr : closedBall z r ⊆ U) : cderiv r f z = deriv f z :=
two_pi_I_inv_smul_circleIntegral_sub_sq_inv_smul_of_differentiable hU hzr hf (mem_ball_self hr)
#align complex.cderiv_eq_deriv Complex.cderiv_eq_deriv
theorem norm_cderiv_le (hr : 0 < r) (hf : ∀ w ∈ sphere z r, ‖f w‖ ≤ M) :
‖cderiv r f z‖ ≤ M / r := by
have hM : 0 ≤ M := by
obtain ⟨w, hw⟩ : (sphere z r).Nonempty := NormedSpace.sphere_nonempty.mpr hr.le
exact (norm_nonneg _).trans (hf w hw)
have h1 : ∀ w ∈ sphere z r, ‖((w - z) ^ 2)⁻¹ • f w‖ ≤ M / r ^ 2 := by
intro w hw
simp only [mem_sphere_iff_norm, norm_eq_abs] at hw
simp only [norm_smul, inv_mul_eq_div, hw, norm_eq_abs, map_inv₀, Complex.abs_pow]
exact div_le_div hM (hf w hw) (sq_pos_of_pos hr) le_rfl
have h2 := circleIntegral.norm_integral_le_of_norm_le_const hr.le h1
simp only [cderiv, norm_smul]
refine (mul_le_mul le_rfl h2 (norm_nonneg _) (norm_nonneg _)).trans (le_of_eq ?_)
field_simp [_root_.abs_of_nonneg Real.pi_pos.le]
ring
#align complex.norm_cderiv_le Complex.norm_cderiv_le
theorem cderiv_sub (hr : 0 < r) (hf : ContinuousOn f (sphere z r))
(hg : ContinuousOn g (sphere z r)) : cderiv r (f - g) z = cderiv r f z - cderiv r g z := by
have h1 : ContinuousOn (fun w : ℂ => ((w - z) ^ 2)⁻¹) (sphere z r) := by
refine ((continuous_id'.sub continuous_const).pow 2).continuousOn.inv₀ fun w hw h => hr.ne ?_
rwa [mem_sphere_iff_norm, sq_eq_zero_iff.mp h, norm_zero] at hw
simp_rw [cderiv, ← smul_sub]
congr 1
simpa only [Pi.sub_apply, smul_sub] using
circleIntegral.integral_sub ((h1.smul hf).circleIntegrable hr.le)
((h1.smul hg).circleIntegrable hr.le)
#align complex.cderiv_sub Complex.cderiv_sub
theorem norm_cderiv_lt (hr : 0 < r) (hfM : ∀ w ∈ sphere z r, ‖f w‖ < M)
(hf : ContinuousOn f (sphere z r)) : ‖cderiv r f z‖ < M / r := by
obtain ⟨L, hL1, hL2⟩ : ∃ L < M, ∀ w ∈ sphere z r, ‖f w‖ ≤ L := by
have e1 : (sphere z r).Nonempty := NormedSpace.sphere_nonempty.mpr hr.le
have e2 : ContinuousOn (fun w => ‖f w‖) (sphere z r) := continuous_norm.comp_continuousOn hf
obtain ⟨x, hx, hx'⟩ := (isCompact_sphere z r).exists_isMaxOn e1 e2
exact ⟨‖f x‖, hfM x hx, hx'⟩
exact (norm_cderiv_le hr hL2).trans_lt ((div_lt_div_right hr).mpr hL1)
#align complex.norm_cderiv_lt Complex.norm_cderiv_lt
theorem norm_cderiv_sub_lt (hr : 0 < r) (hfg : ∀ w ∈ sphere z r, ‖f w - g w‖ < M)
(hf : ContinuousOn f (sphere z r)) (hg : ContinuousOn g (sphere z r)) :
‖cderiv r f z - cderiv r g z‖ < M / r :=
cderiv_sub hr hf hg ▸ norm_cderiv_lt hr hfg (hf.sub hg)
#align complex.norm_cderiv_sub_lt Complex.norm_cderiv_sub_lt
| Mathlib/Analysis/Complex/LocallyUniformLimit.lean | 95 | 110 | theorem _root_.TendstoUniformlyOn.cderiv (hF : TendstoUniformlyOn F f φ (cthickening δ K))
(hδ : 0 < δ) (hFn : ∀ᶠ n in φ, ContinuousOn (F n) (cthickening δ K)) :
TendstoUniformlyOn (cderiv δ ∘ F) (cderiv δ f) φ K := by |
rcases φ.eq_or_neBot with rfl | hne
· simp only [TendstoUniformlyOn, eventually_bot, imp_true_iff]
have e1 : ContinuousOn f (cthickening δ K) := TendstoUniformlyOn.continuousOn hF hFn
rw [tendstoUniformlyOn_iff] at hF ⊢
rintro ε hε
filter_upwards [hF (ε * δ) (mul_pos hε hδ), hFn] with n h h' z hz
simp_rw [dist_eq_norm] at h ⊢
have e2 : ∀ w ∈ sphere z δ, ‖f w - F n w‖ < ε * δ := fun w hw1 =>
h w (closedBall_subset_cthickening hz δ (sphere_subset_closedBall hw1))
have e3 := sphere_subset_closedBall.trans (closedBall_subset_cthickening hz δ)
have hf : ContinuousOn f (sphere z δ) :=
e1.mono (sphere_subset_closedBall.trans (closedBall_subset_cthickening hz δ))
simpa only [mul_div_cancel_right₀ _ hδ.ne.symm] using norm_cderiv_sub_lt hδ e2 hf (h'.mono e3)
| 0 |
import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral
#align_import analysis.special_functions.gamma.bohr_mollerup from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
set_option linter.uppercaseLean3 false
noncomputable section
open Filter Set MeasureTheory
open scoped Nat ENNReal Topology Real
namespace Real
section Convexity
theorem Gamma_mul_add_mul_le_rpow_Gamma_mul_rpow_Gamma {s t a b : ℝ} (hs : 0 < s) (ht : 0 < t)
(ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) :
Gamma (a * s + b * t) ≤ Gamma s ^ a * Gamma t ^ b := by
-- We will apply Hölder's inequality, for the conjugate exponents `p = 1 / a`
-- and `q = 1 / b`, to the functions `f a s` and `f b t`, where `f` is as follows:
let f : ℝ → ℝ → ℝ → ℝ := fun c u x => exp (-c * x) * x ^ (c * (u - 1))
have e : IsConjExponent (1 / a) (1 / b) := Real.isConjExponent_one_div ha hb hab
have hab' : b = 1 - a := by linarith
have hst : 0 < a * s + b * t := add_pos (mul_pos ha hs) (mul_pos hb ht)
-- some properties of f:
have posf : ∀ c u x : ℝ, x ∈ Ioi (0 : ℝ) → 0 ≤ f c u x := fun c u x hx =>
mul_nonneg (exp_pos _).le (rpow_pos_of_pos hx _).le
have posf' : ∀ c u : ℝ, ∀ᵐ x : ℝ ∂volume.restrict (Ioi 0), 0 ≤ f c u x := fun c u =>
(ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ (posf c u))
have fpow :
∀ {c x : ℝ} (_ : 0 < c) (u : ℝ) (_ : 0 < x), exp (-x) * x ^ (u - 1) = f c u x ^ (1 / c) := by
intro c x hc u hx
dsimp only [f]
rw [mul_rpow (exp_pos _).le ((rpow_nonneg hx.le) _), ← exp_mul, ← rpow_mul hx.le]
congr 2 <;> field_simp [hc.ne']; ring
-- show `f c u` is in `ℒp` for `p = 1/c`:
have f_mem_Lp :
∀ {c u : ℝ} (hc : 0 < c) (hu : 0 < u),
Memℒp (f c u) (ENNReal.ofReal (1 / c)) (volume.restrict (Ioi 0)) := by
intro c u hc hu
have A : ENNReal.ofReal (1 / c) ≠ 0 := by
rwa [Ne, ENNReal.ofReal_eq_zero, not_le, one_div_pos]
have B : ENNReal.ofReal (1 / c) ≠ ∞ := ENNReal.ofReal_ne_top
rw [← memℒp_norm_rpow_iff _ A B, ENNReal.toReal_ofReal (one_div_nonneg.mpr hc.le),
ENNReal.div_self A B, memℒp_one_iff_integrable]
· apply Integrable.congr (GammaIntegral_convergent hu)
refine eventuallyEq_of_mem (self_mem_ae_restrict measurableSet_Ioi) fun x hx => ?_
dsimp only
rw [fpow hc u hx]
congr 1
exact (norm_of_nonneg (posf _ _ x hx)).symm
· refine ContinuousOn.aestronglyMeasurable ?_ measurableSet_Ioi
refine (Continuous.continuousOn ?_).mul (ContinuousAt.continuousOn fun x hx => ?_)
· exact continuous_exp.comp (continuous_const.mul continuous_id')
· exact continuousAt_rpow_const _ _ (Or.inl (mem_Ioi.mp hx).ne')
-- now apply Hölder:
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst]
convert
MeasureTheory.integral_mul_le_Lp_mul_Lq_of_nonneg e (posf' a s) (posf' b t) (f_mem_Lp ha hs)
(f_mem_Lp hb ht) using
1
· refine setIntegral_congr measurableSet_Ioi fun x hx => ?_
dsimp only
have A : exp (-x) = exp (-a * x) * exp (-b * x) := by
rw [← exp_add, ← add_mul, ← neg_add, hab, neg_one_mul]
have B : x ^ (a * s + b * t - 1) = x ^ (a * (s - 1)) * x ^ (b * (t - 1)) := by
rw [← rpow_add hx, hab']; congr 1; ring
rw [A, B]
ring
· rw [one_div_one_div, one_div_one_div]
congr 2 <;> exact setIntegral_congr measurableSet_Ioi fun x hx => fpow (by assumption) _ hx
#align real.Gamma_mul_add_mul_le_rpow_Gamma_mul_rpow_Gamma Real.Gamma_mul_add_mul_le_rpow_Gamma_mul_rpow_Gamma
| Mathlib/Analysis/SpecialFunctions/Gamma/BohrMollerup.lean | 164 | 173 | theorem convexOn_log_Gamma : ConvexOn ℝ (Ioi 0) (log ∘ Gamma) := by |
refine convexOn_iff_forall_pos.mpr ⟨convex_Ioi _, fun x hx y hy a b ha hb hab => ?_⟩
have : b = 1 - a := by linarith
subst this
simp_rw [Function.comp_apply, smul_eq_mul]
simp only [mem_Ioi] at hx hy
rw [← log_rpow, ← log_rpow, ← log_mul]
· gcongr
exact Gamma_mul_add_mul_le_rpow_Gamma_mul_rpow_Gamma hx hy ha hb hab
all_goals positivity
| 0 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Data.Finset.Sym
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Nat.Choose.Multinomial
#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical NNReal Nat
universe u uD uE uF uG
open Set Fin Filter Function
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {D : Type uD} [NormedAddCommGroup D]
[NormedSpace 𝕜 D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type uF}
[NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
{s s₁ t u : Set E}
| Mathlib/Analysis/Calculus/ContDiff/Bounds.lean | 40 | 122 | theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu Fu Gu : Type u}
[NormedAddCommGroup Du] [NormedSpace 𝕜 Du] [NormedAddCommGroup Eu] [NormedSpace 𝕜 Eu]
[NormedAddCommGroup Fu] [NormedSpace 𝕜 Fu] [NormedAddCommGroup Gu] [NormedSpace 𝕜 Gu]
(B : Eu →L[𝕜] Fu →L[𝕜] Gu) {f : Du → Eu} {g : Du → Fu} {n : ℕ} {s : Set Du} {x : Du}
(hf : ContDiffOn 𝕜 n f s) (hg : ContDiffOn 𝕜 n g s) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) :
‖iteratedFDerivWithin 𝕜 n (fun y => B (f y) (g y)) s x‖ ≤
‖B‖ * ∑ i ∈ Finset.range (n + 1), (n.choose i : ℝ) * ‖iteratedFDerivWithin 𝕜 i f s x‖ *
‖iteratedFDerivWithin 𝕜 (n - i) g s x‖ := by |
/- We argue by induction on `n`. The bound is trivial for `n = 0`. For `n + 1`, we write
the `(n+1)`-th derivative as the `n`-th derivative of the derivative `B f g' + B f' g`,
and apply the inductive assumption to each of those two terms. For this induction to make sense,
the spaces of linear maps that appear in the induction should be in the same universe as the
original spaces, which explains why we assume in the lemma that all spaces live in the same
universe. -/
induction' n with n IH generalizing Eu Fu Gu
· simp only [Nat.zero_eq, norm_iteratedFDerivWithin_zero, zero_add, Finset.range_one,
Finset.sum_singleton, Nat.choose_self, Nat.cast_one, one_mul, Nat.sub_zero, ← mul_assoc]
apply B.le_opNorm₂
· have In : (n : ℕ∞) + 1 ≤ n.succ := by simp only [Nat.cast_succ, le_refl]
-- Porting note: the next line is a hack allowing Lean to find the operator norm instance.
let norm := @ContinuousLinearMap.hasOpNorm _ _ Eu ((Du →L[𝕜] Fu) →L[𝕜] Du →L[𝕜] Gu) _ _ _ _ _ _
(RingHom.id 𝕜)
have I1 :
‖iteratedFDerivWithin 𝕜 n (fun y : Du => B.precompR Du (f y) (fderivWithin 𝕜 g s y)) s x‖ ≤
‖B‖ * ∑ i ∈ Finset.range (n + 1), n.choose i * ‖iteratedFDerivWithin 𝕜 i f s x‖ *
‖iteratedFDerivWithin 𝕜 (n + 1 - i) g s x‖ := by
calc
‖iteratedFDerivWithin 𝕜 n (fun y : Du => B.precompR Du (f y) (fderivWithin 𝕜 g s y)) s x‖ ≤
‖B.precompR Du‖ * ∑ i ∈ Finset.range (n + 1),
n.choose i * ‖iteratedFDerivWithin 𝕜 i f s x‖ *
‖iteratedFDerivWithin 𝕜 (n - i) (fderivWithin 𝕜 g s) s x‖ :=
IH _ (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderivWithin hs In)
_ ≤ ‖B‖ * ∑ i ∈ Finset.range (n + 1), n.choose i * ‖iteratedFDerivWithin 𝕜 i f s x‖ *
‖iteratedFDerivWithin 𝕜 (n - i) (fderivWithin 𝕜 g s) s x‖ :=
mul_le_mul_of_nonneg_right (B.norm_precompR_le Du) (by positivity)
_ = _ := by
congr 1
apply Finset.sum_congr rfl fun i hi => ?_
rw [Nat.succ_sub (Nat.lt_succ_iff.1 (Finset.mem_range.1 hi)),
← norm_iteratedFDerivWithin_fderivWithin hs hx]
-- Porting note: the next line is a hack allowing Lean to find the operator norm instance.
let norm := @ContinuousLinearMap.hasOpNorm _ _ (Du →L[𝕜] Eu) (Fu →L[𝕜] Du →L[𝕜] Gu) _ _ _ _ _ _
(RingHom.id 𝕜)
have I2 :
‖iteratedFDerivWithin 𝕜 n (fun y : Du => B.precompL Du (fderivWithin 𝕜 f s y) (g y)) s x‖ ≤
‖B‖ * ∑ i ∈ Finset.range (n + 1), n.choose i * ‖iteratedFDerivWithin 𝕜 (i + 1) f s x‖ *
‖iteratedFDerivWithin 𝕜 (n - i) g s x‖ :=
calc
‖iteratedFDerivWithin 𝕜 n (fun y : Du => B.precompL Du (fderivWithin 𝕜 f s y) (g y)) s x‖ ≤
‖B.precompL Du‖ * ∑ i ∈ Finset.range (n + 1),
n.choose i * ‖iteratedFDerivWithin 𝕜 i (fderivWithin 𝕜 f s) s x‖ *
‖iteratedFDerivWithin 𝕜 (n - i) g s x‖ :=
IH _ (hf.fderivWithin hs In) (hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
_ ≤ ‖B‖ * ∑ i ∈ Finset.range (n + 1),
n.choose i * ‖iteratedFDerivWithin 𝕜 i (fderivWithin 𝕜 f s) s x‖ *
‖iteratedFDerivWithin 𝕜 (n - i) g s x‖ :=
mul_le_mul_of_nonneg_right (B.norm_precompL_le Du) (by positivity)
_ = _ := by
congr 1
apply Finset.sum_congr rfl fun i _ => ?_
rw [← norm_iteratedFDerivWithin_fderivWithin hs hx]
have J : iteratedFDerivWithin 𝕜 n
(fun y : Du => fderivWithin 𝕜 (fun y : Du => B (f y) (g y)) s y) s x =
iteratedFDerivWithin 𝕜 n (fun y => B.precompR Du (f y)
(fderivWithin 𝕜 g s y) + B.precompL Du (fderivWithin 𝕜 f s y) (g y)) s x := by
apply iteratedFDerivWithin_congr (fun y hy => ?_) hx
have L : (1 : ℕ∞) ≤ n.succ := by
simpa only [ENat.coe_one, Nat.one_le_cast] using Nat.succ_pos n
exact B.fderivWithin_of_bilinear (hf.differentiableOn L y hy) (hg.differentiableOn L y hy)
(hs y hy)
rw [← norm_iteratedFDerivWithin_fderivWithin hs hx, J]
have A : ContDiffOn 𝕜 n (fun y => B.precompR Du (f y) (fderivWithin 𝕜 g s y)) s :=
(B.precompR Du).isBoundedBilinearMap.contDiff.comp_contDiff_on₂
(hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderivWithin hs In)
have A' : ContDiffOn 𝕜 n (fun y => B.precompL Du (fderivWithin 𝕜 f s y) (g y)) s :=
(B.precompL Du).isBoundedBilinearMap.contDiff.comp_contDiff_on₂ (hf.fderivWithin hs In)
(hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
rw [iteratedFDerivWithin_add_apply' A A' hs hx]
apply (norm_add_le _ _).trans ((add_le_add I1 I2).trans (le_of_eq ?_))
simp_rw [← mul_add, mul_assoc]
congr 1
exact (Finset.sum_choose_succ_mul
(fun i j => ‖iteratedFDerivWithin 𝕜 i f s x‖ * ‖iteratedFDerivWithin 𝕜 j g s x‖) n).symm
| 0 |
import Mathlib.Data.Finset.Sigma
import Mathlib.Data.Finset.Pairwise
import Mathlib.Data.Finset.Powerset
import Mathlib.Data.Fintype.Basic
import Mathlib.Order.CompleteLatticeIntervals
#align_import order.sup_indep from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d"
variable {α β ι ι' : Type*}
namespace Finset
section Lattice
variable [Lattice α] [OrderBot α]
def SupIndep (s : Finset ι) (f : ι → α) : Prop :=
∀ ⦃t⦄, t ⊆ s → ∀ ⦃i⦄, i ∈ s → i ∉ t → Disjoint (f i) (t.sup f)
#align finset.sup_indep Finset.SupIndep
variable {s t : Finset ι} {f : ι → α} {i : ι}
instance [DecidableEq ι] [DecidableEq α] : Decidable (SupIndep s f) := by
refine @Finset.decidableForallOfDecidableSubsets _ _ _ (?_)
rintro t -
refine @Finset.decidableDforallFinset _ _ _ (?_)
rintro i -
have : Decidable (Disjoint (f i) (sup t f)) := decidable_of_iff' (_ = ⊥) disjoint_iff
infer_instance
theorem SupIndep.subset (ht : t.SupIndep f) (h : s ⊆ t) : s.SupIndep f := fun _ hu _ hi =>
ht (hu.trans h) (h hi)
#align finset.sup_indep.subset Finset.SupIndep.subset
@[simp]
theorem supIndep_empty (f : ι → α) : (∅ : Finset ι).SupIndep f := fun _ _ a ha =>
(not_mem_empty a ha).elim
#align finset.sup_indep_empty Finset.supIndep_empty
theorem supIndep_singleton (i : ι) (f : ι → α) : ({i} : Finset ι).SupIndep f :=
fun s hs j hji hj => by
rw [eq_empty_of_ssubset_singleton ⟨hs, fun h => hj (h hji)⟩, sup_empty]
exact disjoint_bot_right
#align finset.sup_indep_singleton Finset.supIndep_singleton
theorem SupIndep.pairwiseDisjoint (hs : s.SupIndep f) : (s : Set ι).PairwiseDisjoint f :=
fun _ ha _ hb hab =>
sup_singleton.subst <| hs (singleton_subset_iff.2 hb) ha <| not_mem_singleton.2 hab
#align finset.sup_indep.pairwise_disjoint Finset.SupIndep.pairwiseDisjoint
| Mathlib/Order/SupIndep.lean | 92 | 96 | theorem SupIndep.le_sup_iff (hs : s.SupIndep f) (hts : t ⊆ s) (hi : i ∈ s) (hf : ∀ i, f i ≠ ⊥) :
f i ≤ t.sup f ↔ i ∈ t := by |
refine ⟨fun h => ?_, le_sup⟩
by_contra hit
exact hf i (disjoint_self.1 <| (hs hts hi hit).mono_right h)
| 0 |
import Mathlib.Algebra.Polynomial.Basic
#align_import data.polynomial.monomial from "leanprover-community/mathlib"@"220f71ba506c8958c9b41bd82226b3d06b0991e8"
noncomputable section
namespace Polynomial
open Polynomial
universe u
variable {R : Type u} {a b : R} {m n : ℕ}
variable [Semiring R] {p q r : R[X]}
theorem monomial_one_eq_iff [Nontrivial R] {i j : ℕ} :
(monomial i 1 : R[X]) = monomial j 1 ↔ i = j := by
-- Porting note: `ofFinsupp.injEq` is required.
simp_rw [← ofFinsupp_single, ofFinsupp.injEq]
exact AddMonoidAlgebra.of_injective.eq_iff
#align polynomial.monomial_one_eq_iff Polynomial.monomial_one_eq_iff
instance infinite [Nontrivial R] : Infinite R[X] :=
Infinite.of_injective (fun i => monomial i 1) fun m n h => by simpa [monomial_one_eq_iff] using h
#align polynomial.infinite Polynomial.infinite
| Mathlib/Algebra/Polynomial/Monomial.lean | 39 | 56 | theorem card_support_le_one_iff_monomial {f : R[X]} :
Finset.card f.support ≤ 1 ↔ ∃ n a, f = monomial n a := by |
constructor
· intro H
rw [Finset.card_le_one_iff_subset_singleton] at H
rcases H with ⟨n, hn⟩
refine ⟨n, f.coeff n, ?_⟩
ext i
by_cases hi : i = n
· simp [hi, coeff_monomial]
· have : f.coeff i = 0 := by
rw [← not_mem_support_iff]
exact fun hi' => hi (Finset.mem_singleton.1 (hn hi'))
simp [this, Ne.symm hi, coeff_monomial]
· rintro ⟨n, a, rfl⟩
rw [← Finset.card_singleton n]
apply Finset.card_le_card
exact support_monomial' _ _
| 0 |
import Mathlib.Data.Nat.Prime
import Mathlib.Tactic.NormNum.Basic
#align_import data.nat.prime_norm_num from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
open Nat Qq Lean Meta
namespace Mathlib.Meta.NormNum
theorem not_prime_mul_of_ble (a b n : ℕ) (h : a * b = n) (h₁ : a.ble 1 = false)
(h₂ : b.ble 1 = false) : ¬ n.Prime :=
not_prime_mul' h (ble_eq_false.mp h₁).ne' (ble_eq_false.mp h₂).ne'
def deriveNotPrime (n d : ℕ) (en : Q(ℕ)) : Q(¬ Nat.Prime $en) := Id.run <| do
let d' : ℕ := n / d
let prf : Q($d * $d' = $en) := (q(Eq.refl $en) : Expr)
let r : Q(Nat.ble $d 1 = false) := (q(Eq.refl false) : Expr)
let r' : Q(Nat.ble $d' 1 = false) := (q(Eq.refl false) : Expr)
return q(not_prime_mul_of_ble _ _ _ $prf $r $r')
def MinFacHelper (n k : ℕ) : Prop :=
2 < k ∧ k % 2 = 1 ∧ k ≤ minFac n
theorem MinFacHelper.one_lt {n k : ℕ} (h : MinFacHelper n k) : 1 < n := by
have : 2 < minFac n := h.1.trans_le h.2.2
obtain rfl | h := n.eq_zero_or_pos
· contradiction
rcases (succ_le_of_lt h).eq_or_lt with rfl|h
· simp_all
exact h
theorem minFacHelper_0 (n : ℕ)
(h1 : Nat.ble (nat_lit 2) n = true) (h2 : nat_lit 1 = n % (nat_lit 2)) :
MinFacHelper n (nat_lit 3) := by
refine ⟨by norm_num, by norm_num, ?_⟩
refine (le_minFac'.mpr λ p hp hpn ↦ ?_).resolve_left (Nat.ne_of_gt (Nat.le_of_ble_eq_true h1))
rcases hp.eq_or_lt with rfl|h
· simp [(Nat.dvd_iff_mod_eq_zero ..).1 hpn] at h2
· exact h
theorem minFacHelper_1 {n k k' : ℕ} (e : k + 2 = k') (h : MinFacHelper n k)
(np : minFac n ≠ k) : MinFacHelper n k' := by
rw [← e]
refine ⟨Nat.lt_add_right _ h.1, ?_, ?_⟩
· rw [add_mod, mod_self, add_zero, mod_mod]
exact h.2.1
rcases h.2.2.eq_or_lt with rfl|h2
· exact (np rfl).elim
rcases (succ_le_of_lt h2).eq_or_lt with h2|h2
· refine ((h.1.trans_le h.2.2).ne ?_).elim
have h3 : 2 ∣ minFac n := by
rw [Nat.dvd_iff_mod_eq_zero, ← h2, succ_eq_add_one, add_mod, h.2.1]
rw [dvd_prime <| minFac_prime h.one_lt.ne'] at h3
norm_num at h3
exact h3
exact h2
theorem minFacHelper_2 {n k k' : ℕ} (e : k + 2 = k') (nk : ¬ Nat.Prime k)
(h : MinFacHelper n k) : MinFacHelper n k' := by
refine minFacHelper_1 e h λ h2 ↦ ?_
rw [← h2] at nk
exact nk <| minFac_prime h.one_lt.ne'
| Mathlib/Tactic/NormNum/Prime.lean | 90 | 95 | theorem minFacHelper_3 {n k k' : ℕ} (e : k + 2 = k') (nk : (n % k).beq 0 = false)
(h : MinFacHelper n k) : MinFacHelper n k' := by |
refine minFacHelper_1 e h λ h2 ↦ ?_
have nk := Nat.ne_of_beq_eq_false nk
rw [← Nat.dvd_iff_mod_eq_zero, ← h2] at nk
exact nk <| minFac_dvd n
| 0 |
import Mathlib.CategoryTheory.Filtered.Basic
import Mathlib.Topology.Category.TopCat.Limits.Basic
#align_import topology.category.Top.limits.konig from "leanprover-community/mathlib"@"dbdf71cee7bb20367cb7e37279c08b0c218cf967"
-- Porting note: every ML3 decl has an uppercase letter
set_option linter.uppercaseLean3 false
open CategoryTheory
open CategoryTheory.Limits
-- Porting note: changed universe order as `v` is usually passed explicitly
universe v u w
noncomputable section
namespace TopCat
section TopologicalKonig
variable {J : Type u} [SmallCategory J]
-- Porting note: generalized `F` to land in `v` not `u`
variable (F : J ⥤ TopCat.{v})
private abbrev FiniteDiagramArrow {J : Type u} [SmallCategory J] (G : Finset J) :=
Σ' (X Y : J) (_ : X ∈ G) (_ : Y ∈ G), X ⟶ Y
private abbrev FiniteDiagram (J : Type u) [SmallCategory J] :=
Σ G : Finset J, Finset (FiniteDiagramArrow G)
-- Porting note: generalized `F` to land in `v` not `u`
def partialSections {J : Type u} [SmallCategory J] (F : J ⥤ TopCat.{v}) {G : Finset J}
(H : Finset (FiniteDiagramArrow G)) : Set (∀ j, F.obj j) :=
{u | ∀ {f : FiniteDiagramArrow G} (_ : f ∈ H), F.map f.2.2.2.2 (u f.1) = u f.2.1}
#align Top.partial_sections TopCat.partialSections
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)]
{G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
classical
cases isEmpty_or_nonempty J
· exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩
haveI : IsCofiltered J := ⟨⟩
use fun j : J =>
if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some
else (h _).some
rintro ⟨X, Y, hX, hY, f⟩ hf
dsimp only
rwa [dif_pos hX, dif_pos hY, ← comp_app, ← F.map_comp, @IsCofiltered.infTo_commutes _ _ _ G H]
#align Top.partial_sections.nonempty TopCat.partialSections.nonempty
theorem partialSections.directed :
Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
classical
intro A B
let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
refine ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, ?_, ?_⟩
· rintro u hu f hf
have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_left
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
· rintro u hu f hf
have : ιB f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_right
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
#align Top.partial_sections.directed TopCat.partialSections.directed
| Mathlib/Topology/Category/TopCat/Limits/Konig.lean | 107 | 124 | theorem partialSections.closed [∀ j : J, T2Space (F.obj j)] {G : Finset J}
(H : Finset (FiniteDiagramArrow G)) : IsClosed (partialSections F H) := by |
have :
partialSections F H =
⋂ (f : FiniteDiagramArrow G) (_ : f ∈ H), {u | F.map f.2.2.2.2 (u f.1) = u f.2.1} := by
ext1
simp only [Set.mem_iInter, Set.mem_setOf_eq]
rfl
rw [this]
apply isClosed_biInter
intro f _
-- Porting note: can't see through forget
have : T2Space ((forget TopCat).obj (F.obj f.snd.fst)) :=
inferInstanceAs (T2Space (F.obj f.snd.fst))
apply isClosed_eq
-- Porting note: used to be a single `continuity` that closed both goals
· exact (F.map f.snd.snd.snd.snd).continuous.comp (continuous_apply f.fst)
· continuity
| 0 |
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
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]
#align quadratic_form.anisotropic_of_pi QuadraticForm.anisotropic_of_pi
| Mathlib/LinearAlgebra/QuadraticForm/Prod.lean | 328 | 339 | theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
{Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by |
simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
constructor
-- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
· intro h i x
classical
convert h (Pi.single i x) using 1
rw [Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hji => ?_, Pi.single_eq_same]
rw [Pi.single_eq_of_ne hji, map_zero]
· rintro h x
exact Finset.sum_nonneg fun i _ => h i (x i)
| 0 |
import Mathlib.Geometry.Manifold.Sheaf.Smooth
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace
noncomputable section
universe u
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
{EM : Type*} [NormedAddCommGroup EM] [NormedSpace 𝕜 EM]
{HM : Type*} [TopologicalSpace HM] (IM : ModelWithCorners 𝕜 EM HM)
{M : Type u} [TopologicalSpace M] [ChartedSpace HM M]
open AlgebraicGeometry Manifold TopologicalSpace Topology
| Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean | 43 | 98 | theorem smoothSheafCommRing.isUnit_stalk_iff {x : M}
(f : (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf.stalk x) :
IsUnit f ↔ f ∉ RingHom.ker (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) := by |
constructor
· rintro ⟨⟨f, g, hf, hg⟩, rfl⟩ (h' : smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x f = 0)
simpa [h'] using congr_arg (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) hf
· let S := (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf
-- Suppose that `f`, in the stalk at `x`, is nonzero at `x`
rintro (hf : _ ≠ 0)
-- Represent `f` as the germ of some function (also called `f`) on an open neighbourhood `U` of
-- `x`, which is nonzero at `x`
obtain ⟨U : Opens M, hxU, f : C^∞⟮IM, U; 𝓘(𝕜), 𝕜⟯, rfl⟩ := S.germ_exist x f
have hf' : f ⟨x, hxU⟩ ≠ 0 := by
convert hf
exact (smoothSheafCommRing.eval_germ U ⟨x, hxU⟩ f).symm
-- In fact, by continuity, `f` is nonzero on a neighbourhood `V` of `x`
have H : ∀ᶠ (z : U) in 𝓝 ⟨x, hxU⟩, f z ≠ 0 := f.2.continuous.continuousAt.eventually_ne hf'
rw [eventually_nhds_iff] at H
obtain ⟨V₀, hV₀f, hV₀, hxV₀⟩ := H
let V : Opens M := ⟨Subtype.val '' V₀, U.2.isOpenMap_subtype_val V₀ hV₀⟩
have hUV : V ≤ U := Subtype.coe_image_subset (U : Set M) V₀
have hV : V₀ = Set.range (Set.inclusion hUV) := by
convert (Set.range_inclusion hUV).symm
ext y
show _ ↔ y ∈ Subtype.val ⁻¹' (Subtype.val '' V₀)
rw [Set.preimage_image_eq _ Subtype.coe_injective]
clear_value V
subst hV
have hxV : x ∈ (V : Set M) := by
obtain ⟨x₀, hxx₀⟩ := hxV₀
convert x₀.2
exact congr_arg Subtype.val hxx₀.symm
have hVf : ∀ y : V, f (Set.inclusion hUV y) ≠ 0 :=
fun y ↦ hV₀f (Set.inclusion hUV y) (Set.mem_range_self y)
-- Let `g` be the pointwise inverse of `f` on `V`, which is smooth since `f` is nonzero there
let g : C^∞⟮IM, V; 𝓘(𝕜), 𝕜⟯ := ⟨(f ∘ Set.inclusion hUV)⁻¹, ?_⟩
-- The germ of `g` is inverse to the germ of `f`, so `f` is a unit
· refine ⟨⟨S.germ ⟨x, hxV⟩ (SmoothMap.restrictRingHom IM 𝓘(𝕜) 𝕜 hUV f), S.germ ⟨x, hxV⟩ g,
?_, ?_⟩, S.germ_res_apply hUV.hom ⟨x, hxV⟩ f⟩
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply mul_inv_cancel
exact hVf y
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply inv_mul_cancel
exact hVf y
· intro y
exact ((contDiffAt_inv _ (hVf y)).contMDiffAt).comp y
(f.smooth.comp (smooth_inclusion hUV)).smoothAt
| 0 |
import Mathlib.Algebra.Order.ToIntervalMod
import Mathlib.Algebra.Ring.AddAut
import Mathlib.Data.Nat.Totient
import Mathlib.GroupTheory.Divisible
import Mathlib.Topology.Connected.PathConnected
import Mathlib.Topology.IsLocalHomeomorph
#align_import topology.instances.add_circle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
noncomputable section
open AddCommGroup Set Function AddSubgroup TopologicalSpace
open Topology
variable {𝕜 B : Type*}
section Continuity
variable [LinearOrderedAddCommGroup 𝕜] [Archimedean 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜]
{p : 𝕜} (hp : 0 < p) (a x : 𝕜)
| Mathlib/Topology/Instances/AddCircle.lean | 64 | 79 | theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by |
intro s h
rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
obtain ⟨l, u, hxI, hIs⟩ := h
let d := toIcoDiv hp a x • p
have hd := toIcoMod_mem_Ico hp a x
simp_rw [subset_def, mem_inter_iff]
refine ⟨_, ⟨l + d, min (a + p) u + d, ?_, fun x => id⟩, fun y => ?_⟩ <;>
simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
· exact ⟨hxI.1, hd.2, hxI.2⟩
· rintro ⟨h, h'⟩
apply hIs
rw [← toIcoMod_sub_zsmul, (toIcoMod_eq_self _).2]
exacts [⟨h.1, h.2.2⟩, ⟨hd.1.trans (sub_le_sub_right h' _), h.2.1⟩]
| 0 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
#align_import ring_theory.polynomial.opposites from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
open Polynomial
open Polynomial MulOpposite
variable {R : Type*} [Semiring R]
noncomputable section
namespace Polynomial
def opRingEquiv (R : Type*) [Semiring R] : R[X]ᵐᵒᵖ ≃+* Rᵐᵒᵖ[X] :=
((toFinsuppIso R).op.trans AddMonoidAlgebra.opRingEquiv).trans (toFinsuppIso _).symm
#align polynomial.op_ring_equiv Polynomial.opRingEquiv
@[simp]
theorem opRingEquiv_op_monomial (n : ℕ) (r : R) :
opRingEquiv R (op (monomial n r : R[X])) = monomial n (op r) := by
simp only [opRingEquiv, RingEquiv.coe_trans, Function.comp_apply,
AddMonoidAlgebra.opRingEquiv_apply, RingEquiv.op_apply_apply, toFinsuppIso_apply, unop_op,
toFinsupp_monomial, Finsupp.mapRange_single, toFinsuppIso_symm_apply, ofFinsupp_single]
#align polynomial.op_ring_equiv_op_monomial Polynomial.opRingEquiv_op_monomial
@[simp]
theorem opRingEquiv_op_C (a : R) : opRingEquiv R (op (C a)) = C (op a) :=
opRingEquiv_op_monomial 0 a
set_option linter.uppercaseLean3 false in
#align polynomial.op_ring_equiv_op_C Polynomial.opRingEquiv_op_C
@[simp]
theorem opRingEquiv_op_X : opRingEquiv R (op (X : R[X])) = X :=
opRingEquiv_op_monomial 1 1
set_option linter.uppercaseLean3 false in
#align polynomial.op_ring_equiv_op_X Polynomial.opRingEquiv_op_X
theorem opRingEquiv_op_C_mul_X_pow (r : R) (n : ℕ) :
opRingEquiv R (op (C r * X ^ n : R[X])) = C (op r) * X ^ n := by
simp only [X_pow_mul, op_mul, op_pow, map_mul, map_pow, opRingEquiv_op_X, opRingEquiv_op_C]
set_option linter.uppercaseLean3 false in
#align polynomial.op_ring_equiv_op_C_mul_X_pow Polynomial.opRingEquiv_op_C_mul_X_pow
@[simp]
theorem opRingEquiv_symm_monomial (n : ℕ) (r : Rᵐᵒᵖ) :
(opRingEquiv R).symm (monomial n r) = op (monomial n (unop r)) :=
(opRingEquiv R).injective (by simp)
#align polynomial.op_ring_equiv_symm_monomial Polynomial.opRingEquiv_symm_monomial
@[simp]
theorem opRingEquiv_symm_C (a : Rᵐᵒᵖ) : (opRingEquiv R).symm (C a) = op (C (unop a)) :=
opRingEquiv_symm_monomial 0 a
set_option linter.uppercaseLean3 false in
#align polynomial.op_ring_equiv_symm_C Polynomial.opRingEquiv_symm_C
@[simp]
theorem opRingEquiv_symm_X : (opRingEquiv R).symm (X : Rᵐᵒᵖ[X]) = op X :=
opRingEquiv_symm_monomial 1 1
set_option linter.uppercaseLean3 false in
#align polynomial.op_ring_equiv_symm_X Polynomial.opRingEquiv_symm_X
theorem opRingEquiv_symm_C_mul_X_pow (r : Rᵐᵒᵖ) (n : ℕ) :
(opRingEquiv R).symm (C r * X ^ n : Rᵐᵒᵖ[X]) = op (C (unop r) * X ^ n) := by
rw [C_mul_X_pow_eq_monomial, opRingEquiv_symm_monomial, C_mul_X_pow_eq_monomial]
set_option linter.uppercaseLean3 false in
#align polynomial.op_ring_equiv_symm_C_mul_X_pow Polynomial.opRingEquiv_symm_C_mul_X_pow
@[simp]
theorem coeff_opRingEquiv (p : R[X]ᵐᵒᵖ) (n : ℕ) :
(opRingEquiv R p).coeff n = op ((unop p).coeff n) := by
induction' p using MulOpposite.rec' with p
cases p
rfl
#align polynomial.coeff_op_ring_equiv Polynomial.coeff_opRingEquiv
@[simp]
theorem support_opRingEquiv (p : R[X]ᵐᵒᵖ) : (opRingEquiv R p).support = (unop p).support := by
induction' p using MulOpposite.rec' with p
cases p
exact Finsupp.support_mapRange_of_injective (map_zero _) _ op_injective
#align polynomial.support_op_ring_equiv Polynomial.support_opRingEquiv
@[simp]
| Mathlib/RingTheory/Polynomial/Opposites.lean | 110 | 114 | theorem natDegree_opRingEquiv (p : R[X]ᵐᵒᵖ) : (opRingEquiv R p).natDegree = (unop p).natDegree := by |
by_cases p0 : p = 0
· simp only [p0, _root_.map_zero, natDegree_zero, unop_zero]
· simp only [p0, natDegree_eq_support_max', Ne, AddEquivClass.map_eq_zero_iff, not_false_iff,
support_opRingEquiv, unop_eq_zero_iff]
| 0 |
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.MeasureTheory.Integral.FundThmCalculus
#align_import analysis.special_functions.non_integrable from "leanprover-community/mathlib"@"55ec6e9af7d3e0043f57e394cb06a72f6275273e"
open scoped MeasureTheory Topology Interval NNReal ENNReal
open MeasureTheory TopologicalSpace Set Filter Asymptotics intervalIntegral
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F]
| Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean | 52 | 96 | theorem not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter_aux
[CompleteSpace E] {f : ℝ → E} {g : ℝ → F}
{k : Set ℝ} (l : Filter ℝ) [NeBot l] [TendstoIxxClass Icc l l]
(hl : k ∈ l) (hd : ∀ᶠ x in l, DifferentiableAt ℝ f x) (hf : Tendsto (fun x => ‖f x‖) l atTop)
(hfg : deriv f =O[l] g) : ¬IntegrableOn g k := by |
intro hgi
obtain ⟨C, hC₀, s, hsl, hsub, hfd, hg⟩ :
∃ (C : ℝ) (_ : 0 ≤ C), ∃ s ∈ l, (∀ x ∈ s, ∀ y ∈ s, [[x, y]] ⊆ k) ∧
(∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], DifferentiableAt ℝ f z) ∧
∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], ‖deriv f z‖ ≤ C * ‖g z‖ := by
rcases hfg.exists_nonneg with ⟨C, C₀, hC⟩
have h : ∀ᶠ x : ℝ × ℝ in l.prod l,
∀ y ∈ [[x.1, x.2]], (DifferentiableAt ℝ f y ∧ ‖deriv f y‖ ≤ C * ‖g y‖) ∧ y ∈ k :=
(tendsto_fst.uIcc tendsto_snd).eventually ((hd.and hC.bound).and hl).smallSets
rcases mem_prod_self_iff.1 h with ⟨s, hsl, hs⟩
simp only [prod_subset_iff, mem_setOf_eq] at hs
exact ⟨C, C₀, s, hsl, fun x hx y hy z hz => (hs x hx y hy z hz).2, fun x hx y hy z hz =>
(hs x hx y hy z hz).1.1, fun x hx y hy z hz => (hs x hx y hy z hz).1.2⟩
replace hgi : IntegrableOn (fun x ↦ C * ‖g x‖) k := by exact hgi.norm.smul C
obtain ⟨c, hc, d, hd, hlt⟩ : ∃ c ∈ s, ∃ d ∈ s, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f d‖ := by
rcases Filter.nonempty_of_mem hsl with ⟨c, hc⟩
have : ∀ᶠ x in l, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f x‖ :=
hf.eventually (eventually_gt_atTop _)
exact ⟨c, hc, (this.and hsl).exists.imp fun d hd => ⟨hd.2, hd.1⟩⟩
specialize hsub c hc d hd; specialize hfd c hc d hd
replace hg : ∀ x ∈ Ι c d, ‖deriv f x‖ ≤ C * ‖g x‖ :=
fun z hz => hg c hc d hd z ⟨hz.1.le, hz.2⟩
have hg_ae : ∀ᵐ x ∂volume.restrict (Ι c d), ‖deriv f x‖ ≤ C * ‖g x‖ :=
(ae_restrict_mem measurableSet_uIoc).mono hg
have hsub' : Ι c d ⊆ k := Subset.trans Ioc_subset_Icc_self hsub
have hfi : IntervalIntegrable (deriv f) volume c d := by
rw [intervalIntegrable_iff]
have : IntegrableOn (fun x ↦ C * ‖g x‖) (Ι c d) := IntegrableOn.mono hgi hsub' le_rfl
exact Integrable.mono' this (aestronglyMeasurable_deriv _ _) hg_ae
refine hlt.not_le (sub_le_iff_le_add'.1 ?_)
calc
‖f d‖ - ‖f c‖ ≤ ‖f d - f c‖ := norm_sub_norm_le _ _
_ = ‖∫ x in c..d, deriv f x‖ := congr_arg _ (integral_deriv_eq_sub hfd hfi).symm
_ = ‖∫ x in Ι c d, deriv f x‖ := norm_integral_eq_norm_integral_Ioc _
_ ≤ ∫ x in Ι c d, ‖deriv f x‖ := norm_integral_le_integral_norm _
_ ≤ ∫ x in Ι c d, C * ‖g x‖ :=
setIntegral_mono_on hfi.norm.def' (hgi.mono_set hsub') measurableSet_uIoc hg
_ ≤ ∫ x in k, C * ‖g x‖ := by
apply setIntegral_mono_set hgi
(ae_of_all _ fun x => mul_nonneg hC₀ (norm_nonneg _)) hsub'.eventuallyLE
| 0 |
import Mathlib.Algebra.Group.ConjFinite
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Dynamics.PeriodicPts
import Mathlib.GroupTheory.Commutator
import Mathlib.GroupTheory.Coset
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.GroupAction.Hom
#align_import group_theory.group_action.quotient from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
open Function
namespace MulAction
variable [Group α]
section QuotientAction
open Subgroup MulOpposite QuotientGroup
variable (β) [Monoid β] [MulAction β α] (H : Subgroup α)
class QuotientAction : Prop where
inv_mul_mem : ∀ (b : β) {a a' : α}, a⁻¹ * a' ∈ H → (b • a)⁻¹ * b • a' ∈ H
#align mul_action.quotient_action MulAction.QuotientAction
class _root_.AddAction.QuotientAction {α : Type u} (β : Type v) [AddGroup α] [AddMonoid β]
[AddAction β α] (H : AddSubgroup α) : Prop where
inv_mul_mem : ∀ (b : β) {a a' : α}, -a + a' ∈ H → -(b +ᵥ a) + (b +ᵥ a') ∈ H
#align add_action.quotient_action AddAction.QuotientAction
attribute [to_additive] MulAction.QuotientAction
@[to_additive]
instance left_quotientAction : QuotientAction α H :=
⟨fun _ _ _ _ => by rwa [smul_eq_mul, smul_eq_mul, mul_inv_rev, mul_assoc, inv_mul_cancel_left]⟩
#align mul_action.left_quotient_action MulAction.left_quotientAction
#align add_action.left_quotient_action AddAction.left_quotientAction
@[to_additive]
instance right_quotientAction : QuotientAction (normalizer H).op H :=
⟨fun b c _ _ => by
rwa [smul_def, smul_def, smul_eq_mul_unop, smul_eq_mul_unop, mul_inv_rev, ← mul_assoc,
mem_normalizer_iff'.mp b.prop, mul_assoc, mul_inv_cancel_left]⟩
#align mul_action.right_quotient_action MulAction.right_quotientAction
#align add_action.right_quotient_action AddAction.right_quotientAction
@[to_additive]
instance right_quotientAction' [hH : H.Normal] : QuotientAction αᵐᵒᵖ H :=
⟨fun _ _ _ _ => by
rwa [smul_eq_mul_unop, smul_eq_mul_unop, mul_inv_rev, mul_assoc, hH.mem_comm_iff, mul_assoc,
mul_inv_cancel_right]⟩
#align mul_action.right_quotient_action' MulAction.right_quotientAction'
#align add_action.right_quotient_action' AddAction.right_quotientAction'
@[to_additive]
instance quotient [QuotientAction β H] : MulAction β (α ⧸ H) where
smul b :=
Quotient.map' (b • ·) fun _ _ h =>
leftRel_apply.mpr <| QuotientAction.inv_mul_mem b <| leftRel_apply.mp h
one_smul q := Quotient.inductionOn' q fun a => congr_arg Quotient.mk'' (one_smul β a)
mul_smul b b' q := Quotient.inductionOn' q fun a => congr_arg Quotient.mk'' (mul_smul b b' a)
#align mul_action.quotient MulAction.quotient
#align add_action.quotient AddAction.quotient
variable {β}
@[to_additive (attr := simp)]
theorem Quotient.smul_mk [QuotientAction β H] (b : β) (a : α) :
(b • QuotientGroup.mk a : α ⧸ H) = QuotientGroup.mk (b • a) :=
rfl
#align mul_action.quotient.smul_mk MulAction.Quotient.smul_mk
#align add_action.quotient.vadd_mk AddAction.Quotient.vadd_mk
@[to_additive (attr := simp)]
theorem Quotient.smul_coe [QuotientAction β H] (b : β) (a : α) :
b • (a : α ⧸ H) = (↑(b • a) : α ⧸ H) :=
rfl
#align mul_action.quotient.smul_coe MulAction.Quotient.smul_coe
#align add_action.quotient.vadd_coe AddAction.Quotient.vadd_coe
@[to_additive (attr := simp)]
theorem Quotient.mk_smul_out' [QuotientAction β H] (b : β) (q : α ⧸ H) :
QuotientGroup.mk (b • q.out') = b • q := by rw [← Quotient.smul_mk, QuotientGroup.out_eq']
#align mul_action.quotient.mk_smul_out' MulAction.Quotient.mk_smul_out'
#align add_action.quotient.mk_vadd_out' AddAction.Quotient.mk_vadd_out'
-- Porting note: removed simp attribute, simp can prove this
@[to_additive]
theorem Quotient.coe_smul_out' [QuotientAction β H] (b : β) (q : α ⧸ H) : ↑(b • q.out') = b • q :=
Quotient.mk_smul_out' H b q
#align mul_action.quotient.coe_smul_out' MulAction.Quotient.coe_smul_out'
#align add_action.quotient.coe_vadd_out' AddAction.Quotient.coe_vadd_out'
| Mathlib/GroupTheory/GroupAction/Quotient.lean | 120 | 123 | theorem _root_.QuotientGroup.out'_conj_pow_minimalPeriod_mem (a : α) (q : α ⧸ H) :
q.out'⁻¹ * a ^ Function.minimalPeriod (a • ·) q * q.out' ∈ H := by |
rw [mul_assoc, ← QuotientGroup.eq', QuotientGroup.out_eq', ← smul_eq_mul, Quotient.mk_smul_out',
eq_comm, pow_smul_eq_iff_minimalPeriod_dvd]
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.