Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | num_lines int64 1 150 | complexity_score float64 2.72 139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000B | diff_level int64 0 2 | file_diff_level float64 0 2 | theorem_same_file int64 1 32 | rank_file int64 0 2.51k |
|---|---|---|---|---|---|---|---|---|---|---|---|
import Mathlib.Data.List.Forall2
#align_import data.list.sections from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
open Nat Function
namespace List
variable {α β : Type*}
| Mathlib/Data/List/Sections.lean | 23 | 34 | theorem mem_sections {L : List (List α)} {f} : f ∈ sections L ↔ Forall₂ (· ∈ ·) f L := by |
refine ⟨fun h => ?_, fun h => ?_⟩
· induction L generalizing f
· cases mem_singleton.1 h
exact Forall₂.nil
simp only [sections, bind_eq_bind, mem_bind, mem_map] at h
rcases h with ⟨_, _, _, _, rfl⟩
simp only [*, forall₂_cons, true_and_iff]
· induction' h with a l f L al fL fs
· simp only [sections, mem_singleton]
simp only [sections, bind_eq_bind, mem_bind, mem_map]
exact ⟨f, fs, a, al, rfl⟩
| 11 | 59,874.141715 | 2 | 2 | 1 | 2,167 |
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Invertible.Basic
import Mathlib.Algebra.GroupWithZero.Units.Basic
import Mathlib.Data.Set.Basic
import Mathlib.Logic.Basic
#align_import group_theory.subsemigroup.center from "leanprover-community/mathlib"@"1ac8d4304efba9d03fa720d06516fac845aa5353"
variable {M : Type*}
structure IsAddCentral [Add M] (z : M) : Prop where
comm (a : M) : z + a = a + z
left_assoc (b c : M) : z + (b + c) = (z + b) + c
mid_assoc (a c : M) : (a + z) + c = a + (z + c)
right_assoc (a b : M) : (a + b) + z = a + (b + z)
@[to_additive]
structure IsMulCentral [Mul M] (z : M) : Prop where
comm (a : M) : z * a = a * z
left_assoc (b c : M) : z * (b * c) = (z * b) * c
mid_assoc (a c : M) : (a * z) * c = a * (z * c)
right_assoc (a b : M) : (a * b) * z = a * (b * z)
attribute [mk_iff] IsMulCentral IsAddCentral
attribute [to_additive existing] isMulCentral_iff
namespace Set
section Mul
variable (M) [Mul M]
@[to_additive addCenter " The center of an additive magma. "]
def center : Set M :=
{ z | IsMulCentral z }
#align set.center Set.center
#align set.add_center Set.addCenter
-- Porting note: The `to_additive` version used to be `mem_addCenter` without the iff
@[to_additive mem_addCenter_iff]
theorem mem_center_iff {z : M} : z ∈ center M ↔ IsMulCentral z :=
Iff.rfl
#align set.mem_center_iff Set.mem_center_iff
#align set.mem_add_center Set.mem_addCenter_iff
variable {M}
@[to_additive (attr := simp) add_mem_addCenter]
| Mathlib/Algebra/Group/Center.lean | 98 | 119 | theorem mul_mem_center [Mul M] {z₁ z₂ : M} (hz₁ : z₁ ∈ Set.center M) (hz₂ : z₂ ∈ Set.center M) :
z₁ * z₂ ∈ Set.center M where
comm a := calc
z₁ * z₂ * a = z₂ * z₁ * a := by | rw [hz₁.comm]
_ = z₂ * (z₁ * a) := by rw [hz₁.mid_assoc z₂]
_ = (a * z₁) * z₂ := by rw [hz₁.comm, hz₂.comm]
_ = a * (z₁ * z₂) := by rw [hz₂.right_assoc a z₁]
left_assoc (b c : M) := calc
z₁ * z₂ * (b * c) = z₁ * (z₂ * (b * c)) := by rw [hz₂.mid_assoc]
_ = z₁ * ((z₂ * b) * c) := by rw [hz₂.left_assoc]
_ = (z₁ * (z₂ * b)) * c := by rw [hz₁.left_assoc]
_ = z₁ * z₂ * b * c := by rw [hz₂.mid_assoc]
mid_assoc (a c : M) := calc
a * (z₁ * z₂) * c = ((a * z₁) * z₂) * c := by rw [hz₁.mid_assoc]
_ = (a * z₁) * (z₂ * c) := by rw [hz₂.mid_assoc]
_ = a * (z₁ * (z₂ * c)) := by rw [hz₁.mid_assoc]
_ = a * (z₁ * z₂ * c) := by rw [hz₂.mid_assoc]
right_assoc (a b : M) := calc
a * b * (z₁ * z₂) = ((a * b) * z₁) * z₂ := by rw [hz₂.right_assoc]
_ = (a * (b * z₁)) * z₂ := by rw [hz₁.right_assoc]
_ = a * ((b * z₁) * z₂) := by rw [hz₂.right_assoc]
_ = a * (b * (z₁ * z₂)) := by rw [hz₁.mid_assoc]
| 19 | 178,482,300.963187 | 2 | 2 | 1 | 2,168 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Nat
import Mathlib.Data.Set.Basic
import Mathlib.Tactic.Common
#align_import data.set.enumerate from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
noncomputable section
open Function
namespace Set
section Enumerate
variable {α : Type*} (sel : Set α → Option α)
def enumerate : Set α → ℕ → Option α
| s, 0 => sel s
| s, n + 1 => do
let a ← sel s
enumerate (s \ {a}) n
#align set.enumerate Set.enumerate
theorem enumerate_eq_none_of_sel {s : Set α} (h : sel s = none) : ∀ {n}, enumerate sel s n = none
| 0 => by simp [h, enumerate]
| n + 1 => by simp [h, enumerate]
#align set.enumerate_eq_none_of_sel Set.enumerate_eq_none_of_sel
theorem enumerate_eq_none :
∀ {s n₁ n₂}, enumerate sel s n₁ = none → n₁ ≤ n₂ → enumerate sel s n₂ = none
| s, 0, m => fun h _ ↦ enumerate_eq_none_of_sel sel h
| s, n + 1, m => fun h hm ↦ by
cases hs : sel s
· exact enumerate_eq_none_of_sel sel hs
· cases m with
| zero => contradiction
| succ m' =>
simp? [hs, enumerate] at h ⊢ says
simp only [enumerate, hs, Option.bind_eq_bind, Option.some_bind] at h ⊢
have hm : n ≤ m' := Nat.le_of_succ_le_succ hm
exact enumerate_eq_none h hm
#align set.enumerate_eq_none Set.enumerate_eq_none
theorem enumerate_mem (h_sel : ∀ s a, sel s = some a → a ∈ s) :
∀ {s n a}, enumerate sel s n = some a → a ∈ s
| s, 0, a => h_sel s a
| s, n + 1, a => by
cases h : sel s with
| none => simp [enumerate_eq_none_of_sel, h]
| some a' =>
simp only [enumerate, h, Nat.add_eq, add_zero]
exact fun h' : enumerate sel (s \ {a'}) n = some a ↦
have : a ∈ s \ {a'} := enumerate_mem h_sel h'
this.left
#align set.enumerate_mem Set.enumerate_mem
| Mathlib/Data/Set/Enumerate.lean | 75 | 101 | theorem enumerate_inj {n₁ n₂ : ℕ} {a : α} {s : Set α} (h_sel : ∀ s a, sel s = some a → a ∈ s)
(h₁ : enumerate sel s n₁ = some a) (h₂ : enumerate sel s n₂ = some a) : n₁ = n₂ := by |
/- Porting note: The `rcase, on_goal, all_goals` has been used instead of
the not-yet-ported `wlog` -/
rcases le_total n₁ n₂ with (hn|hn)
on_goal 2 => swap_var n₁ ↔ n₂, h₁ ↔ h₂
all_goals
rcases Nat.le.dest hn with ⟨m, rfl⟩
clear hn
induction n₁ generalizing s with
| zero =>
cases m with
| zero => rfl
| succ m =>
have h' : enumerate sel (s \ {a}) m = some a := by
simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add]; exact h₂
have : a ∈ s \ {a} := enumerate_mem sel h_sel h'
simp_all [Set.mem_diff_singleton]
| succ k ih =>
cases h : sel s with
/- Porting note: The original covered both goals with just `simp_all <;> tauto` -/
| none =>
simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
| some =>
simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq,
Nat.add_succ, Nat.succ.injEq]
exact ih h₁ h₂
| 25 | 72,004,899,337.38586 | 2 | 2 | 1 | 2,169 |
import Mathlib.Algebra.Ring.Idempotents
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Order.Basic
import Mathlib.Tactic.NoncommRing
#align_import analysis.normed_space.M_structure from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
variable (X : Type*) [NormedAddCommGroup X]
variable {M : Type*} [Ring M] [Module M X]
-- Porting note: Mathlib3 uses names with uppercase 'L' for L-projections
set_option linter.uppercaseLean3 false
structure IsLprojection (P : M) : Prop where
proj : IsIdempotentElem P
Lnorm : ∀ x : X, ‖x‖ = ‖P • x‖ + ‖(1 - P) • x‖
#align is_Lprojection IsLprojection
structure IsMprojection (P : M) : Prop where
proj : IsIdempotentElem P
Mnorm : ∀ x : X, ‖x‖ = max ‖P • x‖ ‖(1 - P) • x‖
#align is_Mprojection IsMprojection
variable {X}
namespace IsLprojection
-- Porting note: The literature always uses uppercase 'L' for L-projections
theorem Lcomplement {P : M} (h : IsLprojection X P) : IsLprojection X (1 - P) :=
⟨h.proj.one_sub, fun x => by
rw [add_comm, sub_sub_cancel]
exact h.Lnorm x⟩
#align is_Lprojection.Lcomplement IsLprojection.Lcomplement
theorem Lcomplement_iff (P : M) : IsLprojection X P ↔ IsLprojection X (1 - P) :=
⟨Lcomplement, fun h => sub_sub_cancel 1 P ▸ h.Lcomplement⟩
#align is_Lprojection.Lcomplement_iff IsLprojection.Lcomplement_iff
| Mathlib/Analysis/NormedSpace/MStructure.lean | 105 | 144 | theorem commute [FaithfulSMul M X] {P Q : M} (h₁ : IsLprojection X P) (h₂ : IsLprojection X Q) :
Commute P Q := by |
have PR_eq_RPR : ∀ R : M, IsLprojection X R → P * R = R * P * R := fun R h₃ => by
-- Porting note: Needed to fix function, which changes indent of following lines
refine @eq_of_smul_eq_smul _ X _ _ _ _ fun x => by
rw [← norm_sub_eq_zero_iff]
have e1 : ‖R • x‖ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ :=
calc
‖R • x‖ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ +
(‖(R * R) • x - R • P • R • x‖ + ‖(1 - R) • (1 - P) • R • x‖) := by
rw [h₁.Lnorm, h₃.Lnorm, h₃.Lnorm ((1 - P) • R • x), sub_smul 1 P, one_smul, smul_sub,
mul_smul]
_ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ +
(‖R • x - R • P • R • x‖ + ‖((1 - R) * R) • x - (1 - R) • P • R • x‖) := by
rw [h₃.proj.eq, sub_smul 1 P, one_smul, smul_sub, mul_smul]
_ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ +
(‖R • x - R • P • R • x‖ + ‖(1 - R) • P • R • x‖) := by
rw [sub_mul, h₃.proj.eq, one_mul, sub_self, zero_smul, zero_sub, norm_neg]
_ = ‖R • P • R • x‖ + ‖R • x - R • P • R • x‖ + 2 • ‖(1 - R) • P • R • x‖ := by abel
_ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ := by
rw [GE.ge]
have :=
add_le_add_right (norm_le_insert' (R • x) (R • P • R • x)) (2 • ‖(1 - R) • P • R • x‖)
simpa only [mul_smul, sub_smul, one_smul] using this
rw [GE.ge] at e1
-- Porting note: Bump index in nth_rewrite
nth_rewrite 2 [← add_zero ‖R • x‖] at e1
rw [add_le_add_iff_left, two_smul, ← two_mul] at e1
rw [le_antisymm_iff]
refine ⟨?_, norm_nonneg _⟩
rwa [← mul_zero (2 : ℝ), mul_le_mul_left (show (0 : ℝ) < 2 by norm_num)] at e1
have QP_eq_QPQ : Q * P = Q * P * Q := by
have e1 : P * (1 - Q) = P * (1 - Q) - (Q * P - Q * P * Q) :=
calc
P * (1 - Q) = (1 - Q) * P * (1 - Q) := by rw [PR_eq_RPR (1 - Q) h₂.Lcomplement]
_ = P * (1 - Q) - (Q * P - Q * P * Q) := by noncomm_ring
rwa [eq_sub_iff_add_eq, add_right_eq_self, sub_eq_zero] at e1
show P * Q = Q * P
rw [QP_eq_QPQ, PR_eq_RPR Q h₂]
| 37 | 11,719,142,372,802,612 | 2 | 2 | 2 | 2,170 |
import Mathlib.Algebra.Ring.Idempotents
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Order.Basic
import Mathlib.Tactic.NoncommRing
#align_import analysis.normed_space.M_structure from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
variable (X : Type*) [NormedAddCommGroup X]
variable {M : Type*} [Ring M] [Module M X]
-- Porting note: Mathlib3 uses names with uppercase 'L' for L-projections
set_option linter.uppercaseLean3 false
structure IsLprojection (P : M) : Prop where
proj : IsIdempotentElem P
Lnorm : ∀ x : X, ‖x‖ = ‖P • x‖ + ‖(1 - P) • x‖
#align is_Lprojection IsLprojection
structure IsMprojection (P : M) : Prop where
proj : IsIdempotentElem P
Mnorm : ∀ x : X, ‖x‖ = max ‖P • x‖ ‖(1 - P) • x‖
#align is_Mprojection IsMprojection
variable {X}
namespace IsLprojection
-- Porting note: The literature always uses uppercase 'L' for L-projections
theorem Lcomplement {P : M} (h : IsLprojection X P) : IsLprojection X (1 - P) :=
⟨h.proj.one_sub, fun x => by
rw [add_comm, sub_sub_cancel]
exact h.Lnorm x⟩
#align is_Lprojection.Lcomplement IsLprojection.Lcomplement
theorem Lcomplement_iff (P : M) : IsLprojection X P ↔ IsLprojection X (1 - P) :=
⟨Lcomplement, fun h => sub_sub_cancel 1 P ▸ h.Lcomplement⟩
#align is_Lprojection.Lcomplement_iff IsLprojection.Lcomplement_iff
theorem commute [FaithfulSMul M X] {P Q : M} (h₁ : IsLprojection X P) (h₂ : IsLprojection X Q) :
Commute P Q := by
have PR_eq_RPR : ∀ R : M, IsLprojection X R → P * R = R * P * R := fun R h₃ => by
-- Porting note: Needed to fix function, which changes indent of following lines
refine @eq_of_smul_eq_smul _ X _ _ _ _ fun x => by
rw [← norm_sub_eq_zero_iff]
have e1 : ‖R • x‖ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ :=
calc
‖R • x‖ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ +
(‖(R * R) • x - R • P • R • x‖ + ‖(1 - R) • (1 - P) • R • x‖) := by
rw [h₁.Lnorm, h₃.Lnorm, h₃.Lnorm ((1 - P) • R • x), sub_smul 1 P, one_smul, smul_sub,
mul_smul]
_ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ +
(‖R • x - R • P • R • x‖ + ‖((1 - R) * R) • x - (1 - R) • P • R • x‖) := by
rw [h₃.proj.eq, sub_smul 1 P, one_smul, smul_sub, mul_smul]
_ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ +
(‖R • x - R • P • R • x‖ + ‖(1 - R) • P • R • x‖) := by
rw [sub_mul, h₃.proj.eq, one_mul, sub_self, zero_smul, zero_sub, norm_neg]
_ = ‖R • P • R • x‖ + ‖R • x - R • P • R • x‖ + 2 • ‖(1 - R) • P • R • x‖ := by abel
_ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ := by
rw [GE.ge]
have :=
add_le_add_right (norm_le_insert' (R • x) (R • P • R • x)) (2 • ‖(1 - R) • P • R • x‖)
simpa only [mul_smul, sub_smul, one_smul] using this
rw [GE.ge] at e1
-- Porting note: Bump index in nth_rewrite
nth_rewrite 2 [← add_zero ‖R • x‖] at e1
rw [add_le_add_iff_left, two_smul, ← two_mul] at e1
rw [le_antisymm_iff]
refine ⟨?_, norm_nonneg _⟩
rwa [← mul_zero (2 : ℝ), mul_le_mul_left (show (0 : ℝ) < 2 by norm_num)] at e1
have QP_eq_QPQ : Q * P = Q * P * Q := by
have e1 : P * (1 - Q) = P * (1 - Q) - (Q * P - Q * P * Q) :=
calc
P * (1 - Q) = (1 - Q) * P * (1 - Q) := by rw [PR_eq_RPR (1 - Q) h₂.Lcomplement]
_ = P * (1 - Q) - (Q * P - Q * P * Q) := by noncomm_ring
rwa [eq_sub_iff_add_eq, add_right_eq_self, sub_eq_zero] at e1
show P * Q = Q * P
rw [QP_eq_QPQ, PR_eq_RPR Q h₂]
#align is_Lprojection.commute IsLprojection.commute
| Mathlib/Analysis/NormedSpace/MStructure.lean | 147 | 162 | theorem mul [FaithfulSMul M X] {P Q : M} (h₁ : IsLprojection X P) (h₂ : IsLprojection X Q) :
IsLprojection X (P * Q) := by |
refine ⟨IsIdempotentElem.mul_of_commute (h₁.commute h₂) h₁.proj h₂.proj, ?_⟩
intro x
refine le_antisymm ?_ ?_
· calc
‖x‖ = ‖(P * Q) • x + (x - (P * Q) • x)‖ := by rw [add_sub_cancel ((P * Q) • x) x]
_ ≤ ‖(P * Q) • x‖ + ‖x - (P * Q) • x‖ := by apply norm_add_le
_ = ‖(P * Q) • x‖ + ‖(1 - P * Q) • x‖ := by rw [sub_smul, one_smul]
· calc
‖x‖ = ‖P • Q • x‖ + (‖Q • x - P • Q • x‖ + ‖x - Q • x‖) := by
rw [h₂.Lnorm x, h₁.Lnorm (Q • x), sub_smul, one_smul, sub_smul, one_smul, add_assoc]
_ ≥ ‖P • Q • x‖ + ‖Q • x - P • Q • x + (x - Q • x)‖ :=
((add_le_add_iff_left ‖P • Q • x‖).mpr (norm_add_le (Q • x - P • Q • x) (x - Q • x)))
_ = ‖(P * Q) • x‖ + ‖(1 - P * Q) • x‖ := by
rw [sub_add_sub_cancel', sub_smul, one_smul, mul_smul]
| 14 | 1,202,604.284165 | 2 | 2 | 2 | 2,170 |
import Mathlib.Topology.Homeomorph
import Mathlib.Topology.Order.LeftRightNhds
#align_import topology.algebra.order.monotone_continuity from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Set Filter
open Topology
section LinearOrder
variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
variable [LinearOrder β] [TopologicalSpace β] [OrderTopology β]
| Mathlib/Topology/Order/MonotoneContinuity.lean | 42 | 54 | theorem StrictMonoOn.continuousWithinAt_right_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b) :
ContinuousWithinAt f (Ici a) a := by |
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
((h_mono.le_iff_le has hxs).2 hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
rw [h_mono.lt_iff_lt has hcs] at hac
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 hac)]
rintro x hx ⟨_, hxc⟩
exact ((h_mono.lt_iff_lt hx hcs).2 hxc).trans_le hcb
| 10 | 22,026.465795 | 2 | 2 | 3 | 2,171 |
import Mathlib.Topology.Homeomorph
import Mathlib.Topology.Order.LeftRightNhds
#align_import topology.algebra.order.monotone_continuity from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Set Filter
open Topology
section LinearOrder
variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
variable [LinearOrder β] [TopologicalSpace β] [OrderTopology β]
theorem StrictMonoOn.continuousWithinAt_right_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b) :
ContinuousWithinAt f (Ici a) a := by
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
((h_mono.le_iff_le has hxs).2 hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
rw [h_mono.lt_iff_lt has hcs] at hac
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 hac)]
rintro x hx ⟨_, hxc⟩
exact ((h_mono.lt_iff_lt hx hcs).2 hxc).trans_le hcb
#align strict_mono_on.continuous_at_right_of_exists_between StrictMonoOn.continuousWithinAt_right_of_exists_between
| Mathlib/Topology/Order/MonotoneContinuity.lean | 63 | 75 | theorem continuousWithinAt_right_of_monotoneOn_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : MonotoneOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioo (f a) b) :
ContinuousWithinAt f (Ici a) a := by |
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
(h_mono has hxs hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
have : a < c := not_le.1 fun h => hac.not_le <| h_mono hcs has h
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 this)]
rintro x hx ⟨_, hxc⟩
exact (h_mono hx hcs hxc.le).trans_lt hcb
| 10 | 22,026.465795 | 2 | 2 | 3 | 2,171 |
import Mathlib.Topology.Homeomorph
import Mathlib.Topology.Order.LeftRightNhds
#align_import topology.algebra.order.monotone_continuity from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Set Filter
open Topology
section LinearOrder
variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
variable [LinearOrder β] [TopologicalSpace β] [OrderTopology β]
theorem StrictMonoOn.continuousWithinAt_right_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b) :
ContinuousWithinAt f (Ici a) a := by
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
((h_mono.le_iff_le has hxs).2 hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
rw [h_mono.lt_iff_lt has hcs] at hac
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 hac)]
rintro x hx ⟨_, hxc⟩
exact ((h_mono.lt_iff_lt hx hcs).2 hxc).trans_le hcb
#align strict_mono_on.continuous_at_right_of_exists_between StrictMonoOn.continuousWithinAt_right_of_exists_between
theorem continuousWithinAt_right_of_monotoneOn_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : MonotoneOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioo (f a) b) :
ContinuousWithinAt f (Ici a) a := by
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
(h_mono has hxs hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
have : a < c := not_le.1 fun h => hac.not_le <| h_mono hcs has h
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 this)]
rintro x hx ⟨_, hxc⟩
exact (h_mono hx hcs hxc.le).trans_lt hcb
#align continuous_at_right_of_monotone_on_of_exists_between continuousWithinAt_right_of_monotoneOn_of_exists_between
| Mathlib/Topology/Order/MonotoneContinuity.lean | 81 | 89 | theorem continuousWithinAt_right_of_monotoneOn_of_closure_image_mem_nhdsWithin [DenselyOrdered β]
{f : α → β} {s : Set α} {a : α} (h_mono : MonotoneOn f s) (hs : s ∈ 𝓝[≥] a)
(hfs : closure (f '' s) ∈ 𝓝[≥] f a) : ContinuousWithinAt f (Ici a) a := by |
refine continuousWithinAt_right_of_monotoneOn_of_exists_between h_mono hs fun b hb => ?_
rcases (mem_nhdsWithin_Ici_iff_exists_mem_Ioc_Ico_subset hb).1 hfs with ⟨b', ⟨hab', hbb'⟩, hb'⟩
rcases exists_between hab' with ⟨c', hc'⟩
rcases mem_closure_iff.1 (hb' ⟨hc'.1.le, hc'.2⟩) (Ioo (f a) b') isOpen_Ioo hc' with
⟨_, hc, ⟨c, hcs, rfl⟩⟩
exact ⟨c, hcs, hc.1, hc.2.trans_le hbb'⟩
| 6 | 403.428793 | 2 | 2 | 3 | 2,171 |
import Mathlib.Analysis.InnerProductSpace.Projection
import Mathlib.Dynamics.BirkhoffSum.NormedSpace
open Filter Finset Function Bornology
open scoped Topology
variable {𝕜 E : Type*} [RCLike 𝕜] [NormedAddCommGroup E]
| Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean | 43 | 71 | theorem LinearMap.tendsto_birkhoffAverage_of_ker_subset_closure [NormedSpace 𝕜 E]
(f : E →ₗ[𝕜] E) (hf : LipschitzWith 1 f) (g : E →L[𝕜] LinearMap.eqLocus f 1)
(hg_proj : ∀ x : LinearMap.eqLocus f 1, g x = x)
(hg_ker : (LinearMap.ker g : Set E) ⊆ closure (LinearMap.range (f - 1))) (x : E) :
Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 (g x)) := by |
/- Any point can be represented as a sum of `y ∈ LinearMap.ker g` and a fixed point `z`. -/
obtain ⟨y, hy, z, hz, rfl⟩ : ∃ y, g y = 0 ∧ ∃ z, IsFixedPt f z ∧ x = y + z :=
⟨x - g x, by simp [hg_proj], g x, (g x).2, by simp⟩
/- For a fixed point, the theorem is trivial,
so it suffices to prove it for `y ∈ LinearMap.ker g`. -/
suffices Tendsto (birkhoffAverage 𝕜 f _root_.id · y) atTop (𝓝 0) by
have hgz : g z = z := congr_arg Subtype.val (hg_proj ⟨z, hz⟩)
simpa [hy, hgz, birkhoffAverage, birkhoffSum, Finset.sum_add_distrib, smul_add]
using this.add (hz.tendsto_birkhoffAverage 𝕜 _root_.id)
/- By continuity, it suffices to prove the theorem on a dense subset of `LinearMap.ker g`.
By assumption, `LinearMap.range (f - 1)` is dense in the kernel of `g`,
so it suffices to prove the theorem for `y = f x - x`. -/
have : IsClosed {x | Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 0)} :=
isClosed_setOf_tendsto_birkhoffAverage 𝕜 hf uniformContinuous_id continuous_const
refine closure_minimal (Set.forall_mem_range.2 fun x ↦ ?_) this (hg_ker hy)
/- Finally, for `y = f x - x` the average is equal to the difference between averages
along the orbits of `f x` and `x`, and most of the terms cancel. -/
have : IsBounded (Set.range (_root_.id <| f^[·] x)) :=
isBounded_iff_forall_norm_le.2 ⟨‖x‖, Set.forall_mem_range.2 fun n ↦ by
have H : f^[n] 0 = 0 := iterate_map_zero (f : E →+ E) n
simpa [H] using (hf.iterate n).dist_le_mul x 0⟩
have H : ∀ n x y, f^[n] (x - y) = f^[n] x - f^[n] y := iterate_map_sub (f : E →+ E)
simpa [birkhoffAverage, birkhoffSum, Finset.sum_sub_distrib, smul_sub, H]
using tendsto_birkhoffAverage_apply_sub_birkhoffAverage 𝕜 this
| 24 | 26,489,122,129.84347 | 2 | 2 | 2 | 2,172 |
import Mathlib.Analysis.InnerProductSpace.Projection
import Mathlib.Dynamics.BirkhoffSum.NormedSpace
open Filter Finset Function Bornology
open scoped Topology
variable {𝕜 E : Type*} [RCLike 𝕜] [NormedAddCommGroup E]
theorem LinearMap.tendsto_birkhoffAverage_of_ker_subset_closure [NormedSpace 𝕜 E]
(f : E →ₗ[𝕜] E) (hf : LipschitzWith 1 f) (g : E →L[𝕜] LinearMap.eqLocus f 1)
(hg_proj : ∀ x : LinearMap.eqLocus f 1, g x = x)
(hg_ker : (LinearMap.ker g : Set E) ⊆ closure (LinearMap.range (f - 1))) (x : E) :
Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 (g x)) := by
obtain ⟨y, hy, z, hz, rfl⟩ : ∃ y, g y = 0 ∧ ∃ z, IsFixedPt f z ∧ x = y + z :=
⟨x - g x, by simp [hg_proj], g x, (g x).2, by simp⟩
suffices Tendsto (birkhoffAverage 𝕜 f _root_.id · y) atTop (𝓝 0) by
have hgz : g z = z := congr_arg Subtype.val (hg_proj ⟨z, hz⟩)
simpa [hy, hgz, birkhoffAverage, birkhoffSum, Finset.sum_add_distrib, smul_add]
using this.add (hz.tendsto_birkhoffAverage 𝕜 _root_.id)
have : IsClosed {x | Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 0)} :=
isClosed_setOf_tendsto_birkhoffAverage 𝕜 hf uniformContinuous_id continuous_const
refine closure_minimal (Set.forall_mem_range.2 fun x ↦ ?_) this (hg_ker hy)
have : IsBounded (Set.range (_root_.id <| f^[·] x)) :=
isBounded_iff_forall_norm_le.2 ⟨‖x‖, Set.forall_mem_range.2 fun n ↦ by
have H : f^[n] 0 = 0 := iterate_map_zero (f : E →+ E) n
simpa [H] using (hf.iterate n).dist_le_mul x 0⟩
have H : ∀ n x y, f^[n] (x - y) = f^[n] x - f^[n] y := iterate_map_sub (f : E →+ E)
simpa [birkhoffAverage, birkhoffSum, Finset.sum_sub_distrib, smul_sub, H]
using tendsto_birkhoffAverage_apply_sub_birkhoffAverage 𝕜 this
variable [InnerProductSpace 𝕜 E] [CompleteSpace E]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
| Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean | 84 | 103 | theorem ContinuousLinearMap.tendsto_birkhoffAverage_orthogonalProjection (f : E →L[𝕜] E)
(hf : ‖f‖ ≤ 1) (x : E) :
Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop
(𝓝 <| orthogonalProjection (LinearMap.eqLocus f 1) x) := by |
/- Due to the previous theorem, it suffices to verify
that the range of `f - 1` is dense in the orthogonal complement
to the submodule of fixed points of `f`. -/
apply (f : E →ₗ[𝕜] E).tendsto_birkhoffAverage_of_ker_subset_closure (f.lipschitz.weaken hf)
· exact orthogonalProjection_mem_subspace_eq_self (K := LinearMap.eqLocus f 1)
· clear x
/- In other words, we need to verify that any vector that is orthogonal to the range of `f - 1`
is a fixed point of `f`. -/
rw [ker_orthogonalProjection, ← Submodule.topologicalClosure_coe, SetLike.coe_subset_coe,
← Submodule.orthogonal_orthogonal_eq_closure]
/- To verify this, we verify `‖f x‖ ≤ ‖x‖` (because `‖f‖ ≤ 1`) and `⟪f x, x⟫ = ‖x‖²`. -/
refine Submodule.orthogonal_le fun x hx ↦ eq_of_norm_le_re_inner_eq_norm_sq (𝕜 := 𝕜) ?_ ?_
· simpa using f.le_of_opNorm_le hf x
· have : ∀ y, ⟪f y, x⟫ = ⟪y, x⟫ := by
simpa [Submodule.mem_orthogonal, inner_sub_left, sub_eq_zero] using hx
simp [this, ← norm_sq_eq_inner]
| 16 | 8,886,110.520508 | 2 | 2 | 2 | 2,172 |
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
| 27 | 532,048,240,601.79865 | 2 | 2 | 1 | 2,173 |
import Batteries.Classes.Order
import Batteries.Control.ForInStep.Basic
namespace Batteries
namespace BinomialHeap
namespace Imp
inductive HeapNode (α : Type u) where
| nil : HeapNode α
| node (a : α) (child sibling : HeapNode α) : HeapNode α
deriving Repr
@[simp] def HeapNode.realSize : HeapNode α → Nat
| .nil => 0
| .node _ c s => c.realSize + 1 + s.realSize
def HeapNode.singleton (a : α) : HeapNode α := .node a .nil .nil
def HeapNode.rank : HeapNode α → Nat
| .nil => 0
| .node _ _ s => s.rank + 1
@[inline] private def HeapNode.rankTR (s : HeapNode α) : Nat := go s 0 where
go : HeapNode α → Nat → Nat
| .nil, r => r
| .node _ _ s, r => go s (r + 1)
@[csimp] private theorem HeapNode.rankTR_eq : @rankTR = @rank := by
funext α s; exact go s 0
where
go {α} : ∀ s n, @rankTR.go α s n = rank s + n
| .nil, _ => (Nat.zero_add ..).symm
| .node .., _ => by simp_arith only [rankTR.go, go, rank]
inductive Heap (α : Type u) where
| nil : Heap α
| cons (rank : Nat) (val : α) (node : HeapNode α) (next : Heap α) : Heap α
deriving Repr
@[simp] def Heap.realSize : Heap α → Nat
| .nil => 0
| .cons _ _ c s => c.realSize + 1 + s.realSize
def Heap.size : Heap α → Nat
| .nil => 0
| .cons r _ _ s => 1 <<< r + s.size
@[inline] def Heap.isEmpty : Heap α → Bool
| .nil => true
| _ => false
@[inline] def Heap.singleton (a : α) : Heap α := .cons 0 a .nil .nil
def Heap.rankGT : Heap α → Nat → Prop
| .nil, _ => True
| .cons r .., n => n < r
instance : Decidable (Heap.rankGT s n) :=
match s with
| .nil => inferInstanceAs (Decidable True)
| .cons .. => inferInstanceAs (Decidable (_ < _))
@[simp] def Heap.length : Heap α → Nat
| .nil => 0
| .cons _ _ _ r => r.length + 1
@[inline] def combine (le : α → α → Bool) (a₁ a₂ : α) (n₁ n₂ : HeapNode α) : α × HeapNode α :=
if le a₁ a₂ then (a₁, .node a₂ n₂ n₁) else (a₂, .node a₁ n₁ n₂)
@[specialize] def Heap.merge (le : α → α → Bool) : Heap α → Heap α → Heap α
| .nil, h => h
| h, .nil => h
| s₁@(.cons r₁ a₁ n₁ t₁), s₂@(.cons r₂ a₂ n₂ t₂) =>
if r₁ < r₂ then .cons r₁ a₁ n₁ (merge le t₁ s₂)
else if r₂ < r₁ then .cons r₂ a₂ n₂ (merge le s₁ t₂)
else
let (a, n) := combine le a₁ a₂ n₁ n₂
let r := r₁ + 1
if t₁.rankGT r then if t₂.rankGT r
then .cons r a n (merge le t₁ t₂)
else merge le (.cons r a n t₁) t₂
else if t₂.rankGT r
then merge le t₁ (.cons r a n t₂)
else .cons r a n (merge le t₁ t₂)
termination_by s₁ s₂ => s₁.length + s₂.length
def HeapNode.toHeap (s : HeapNode α) : Heap α := go s s.rank .nil where
go : HeapNode α → Nat → Heap α → Heap α
| .nil, _, res => res
| .node a c s, n, res => go s (n - 1) (.cons (n - 1) a c res)
@[specialize] def Heap.headD (le : α → α → Bool) (a : α) : Heap α → α
| .nil => a
| .cons _ b _ hs => headD le (if le a b then a else b) hs
@[inline] def Heap.head? (le : α → α → Bool) : Heap α → Option α
| .nil => none
| .cons _ h _ hs => some <| headD le h hs
structure FindMin (α) where
before : Heap α → Heap α := id
val : α
node : HeapNode α
next : Heap α
@[specialize] def Heap.findMin (le : α → α → Bool) (k : Heap α → Heap α) :
Heap α → FindMin α → FindMin α
| .nil, res => res
| .cons r a c s, res =>
-- It is important that we check `le res.val a` here, not the other way
-- around. This ensures that head? and findMin find the same element even
-- when we have `le res.val a` and `le a res.val` (i.e. le is not antisymmetric).
findMin le (k ∘ .cons r a c) s <| if le res.val a then res else ⟨k, a, c, s⟩
def Heap.deleteMin (le : α → α → Bool) : Heap α → Option (α × Heap α)
| .nil => none
| .cons r a c s =>
let { before, val, node, next } := findMin le (.cons r a c) s ⟨id, a, c, s⟩
some (val, node.toHeap.merge le (before next))
@[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
| .lake/packages/batteries/Batteries/Data/BinomialHeap/Basic.lean | 205 | 221 | theorem Heap.realSize_merge (le) (s₁ s₂ : Heap α) :
(s₁.merge le s₂).realSize = s₁.realSize + s₂.realSize := by |
unfold merge; split
· simp
· simp
· next r₁ a₁ n₁ t₁ r₂ a₂ n₂ t₂ =>
have IH₁ r a n := realSize_merge le t₁ (cons r a n t₂)
have IH₂ r a n := realSize_merge le (cons r a n t₁) t₂
have IH₃ := realSize_merge le t₁ t₂
split; · simp [IH₁, Nat.add_assoc]
split; · simp [IH₂, Nat.add_assoc, Nat.add_left_comm]
split; simp only; rename_i a n eq
have : n.realSize = n₁.realSize + 1 + n₂.realSize := by
rw [combine] at eq; split at eq <;> cases eq <;>
simp [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm]
split <;> split <;> simp [IH₁, IH₂, IH₃, this, Nat.add_assoc, Nat.add_left_comm]
termination_by s₁.length + s₂.length
| 15 | 3,269,017.372472 | 2 | 2 | 1 | 2,174 |
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.MeasureTheory.Integral.IntegralEqImproper
open MeasureTheory Measure FiniteDimensional
variable {E F G W : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F]
[NormedSpace ℝ F] [NormedAddCommGroup G] [NormedSpace ℝ G] [NormedAddCommGroup W]
[NormedSpace ℝ W] [MeasurableSpace E] [BorelSpace E] {μ : Measure E}
lemma integral_bilinear_hasLineDerivAt_right_eq_neg_left_of_integrable_aux1 [SigmaFinite μ]
{f f' : E × ℝ → F} {g g' : E × ℝ → G} {B : F →L[ℝ] G →L[ℝ] W}
(hf'g : Integrable (fun x ↦ B (f' x) (g x)) (μ.prod volume))
(hfg' : Integrable (fun x ↦ B (f x) (g' x)) (μ.prod volume))
(hfg : Integrable (fun x ↦ B (f x) (g x)) (μ.prod volume))
(hf : ∀ x, HasLineDerivAt ℝ f (f' x) x (0, 1)) (hg : ∀ x, HasLineDerivAt ℝ g (g' x) x (0, 1)) :
∫ x, B (f x) (g' x) ∂(μ.prod volume) = - ∫ x, B (f' x) (g x) ∂(μ.prod volume) := calc
∫ x, B (f x) (g' x) ∂(μ.prod volume)
= ∫ x, (∫ t, B (f (x, t)) (g' (x, t))) ∂μ := integral_prod _ hfg'
_ = ∫ x, (- ∫ t, B (f' (x, t)) (g (x, t))) ∂μ := by
apply integral_congr_ae
filter_upwards [hf'g.prod_right_ae, hfg'.prod_right_ae, hfg.prod_right_ae]
with x hf'gx hfg'x hfgx
apply integral_bilinear_hasDerivAt_right_eq_neg_left_of_integrable ?_ ?_ hfg'x hf'gx hfgx
· intro t
convert (hf (x, t)).scomp_of_eq t ((hasDerivAt_id t).add (hasDerivAt_const t (-t))) (by simp)
<;> simp
· intro t
convert (hg (x, t)).scomp_of_eq t ((hasDerivAt_id t).add (hasDerivAt_const t (-t))) (by simp)
<;> simp
_ = - ∫ x, B (f' x) (g x) ∂(μ.prod volume) := by rw [integral_neg, integral_prod _ hf'g]
lemma integral_bilinear_hasLineDerivAt_right_eq_neg_left_of_integrable_aux2
[FiniteDimensional ℝ E] {μ : Measure (E × ℝ)} [IsAddHaarMeasure μ]
{f f' : E × ℝ → F} {g g' : E × ℝ → G} {B : F →L[ℝ] G →L[ℝ] W}
(hf'g : Integrable (fun x ↦ B (f' x) (g x)) μ)
(hfg' : Integrable (fun x ↦ B (f x) (g' x)) μ)
(hfg : Integrable (fun x ↦ B (f x) (g x)) μ)
(hf : ∀ x, HasLineDerivAt ℝ f (f' x) x (0, 1)) (hg : ∀ x, HasLineDerivAt ℝ g (g' x) x (0, 1)) :
∫ x, B (f x) (g' x) ∂μ = - ∫ x, B (f' x) (g x) ∂μ := by
let ν : Measure E := addHaar
have A : ν.prod volume = (addHaarScalarFactor (ν.prod volume) μ) • μ :=
isAddLeftInvariant_eq_smul _ _
have Hf'g : Integrable (fun x ↦ B (f' x) (g x)) (ν.prod volume) := by
rw [A]; exact hf'g.smul_measure_nnreal
have Hfg' : Integrable (fun x ↦ B (f x) (g' x)) (ν.prod volume) := by
rw [A]; exact hfg'.smul_measure_nnreal
have Hfg : Integrable (fun x ↦ B (f x) (g x)) (ν.prod volume) := by
rw [A]; exact hfg.smul_measure_nnreal
rw [isAddLeftInvariant_eq_smul μ (ν.prod volume)]
simp [integral_bilinear_hasLineDerivAt_right_eq_neg_left_of_integrable_aux1 Hf'g Hfg' Hfg hf hg]
variable [FiniteDimensional ℝ E] [IsAddHaarMeasure μ]
| Mathlib/Analysis/Calculus/LineDeriv/IntegrationByParts.lean | 101 | 151 | theorem integral_bilinear_hasLineDerivAt_right_eq_neg_left_of_integrable
{f f' : E → F} {g g' : E → G} {v : E} {B : F →L[ℝ] G →L[ℝ] W}
(hf'g : Integrable (fun x ↦ B (f' x) (g x)) μ) (hfg' : Integrable (fun x ↦ B (f x) (g' x)) μ)
(hfg : Integrable (fun x ↦ B (f x) (g x)) μ)
(hf : ∀ x, HasLineDerivAt ℝ f (f' x) x v) (hg : ∀ x, HasLineDerivAt ℝ g (g' x) x v) :
∫ x, B (f x) (g' x) ∂μ = - ∫ x, B (f' x) (g x) ∂μ := by |
by_cases hW : CompleteSpace W; swap
· simp [integral, hW]
rcases eq_or_ne v 0 with rfl|hv
· have Hf' x : f' x = 0 := by
simpa [(hasLineDerivAt_zero (f := f) (x := x)).lineDeriv] using (hf x).lineDeriv.symm
have Hg' x : g' x = 0 := by
simpa [(hasLineDerivAt_zero (f := g) (x := x)).lineDeriv] using (hg x).lineDeriv.symm
simp [Hf', Hg']
have : Nontrivial E := nontrivial_iff.2 ⟨v, 0, hv⟩
let n := finrank ℝ E
let E' := Fin (n - 1) → ℝ
obtain ⟨L, hL⟩ : ∃ L : E ≃L[ℝ] (E' × ℝ), L v = (0, 1) := by
have : finrank ℝ (E' × ℝ) = n := by simpa [this, E'] using Nat.sub_add_cancel finrank_pos
have L₀ : E ≃L[ℝ] (E' × ℝ) := (ContinuousLinearEquiv.ofFinrankEq this).symm
obtain ⟨M, hM⟩ : ∃ M : (E' × ℝ) ≃L[ℝ] (E' × ℝ), M (L₀ v) = (0, 1) := by
apply SeparatingDual.exists_continuousLinearEquiv_apply_eq
· simpa using hv
· simp
exact ⟨L₀.trans M, by simp [hM]⟩
let ν := Measure.map L μ
suffices H : ∫ (x : E' × ℝ), (B (f (L.symm x))) (g' (L.symm x)) ∂ν =
-∫ (x : E' × ℝ), (B (f' (L.symm x))) (g (L.symm x)) ∂ν by
have : μ = Measure.map L.symm ν := by
simp [Measure.map_map L.symm.continuous.measurable L.continuous.measurable]
have hL : ClosedEmbedding L.symm := L.symm.toHomeomorph.closedEmbedding
simpa [this, hL.integral_map] using H
have L_emb : MeasurableEmbedding L := L.toHomeomorph.measurableEmbedding
apply integral_bilinear_hasLineDerivAt_right_eq_neg_left_of_integrable_aux2
· simpa [L_emb.integrable_map_iff, Function.comp] using hf'g
· simpa [L_emb.integrable_map_iff, Function.comp] using hfg'
· simpa [L_emb.integrable_map_iff, Function.comp] using hfg
· intro x
have : f = (f ∘ L.symm) ∘ (L : E →ₗ[ℝ] (E' × ℝ)) := by ext y; simp
specialize hf (L.symm x)
rw [this] at hf
convert hf.of_comp using 1
· simp
· simp [← hL]
· intro x
have : g = (g ∘ L.symm) ∘ (L : E →ₗ[ℝ] (E' × ℝ)) := by ext y; simp
specialize hg (L.symm x)
rw [this] at hg
convert hg.of_comp using 1
· simp
· simp [← hL]
| 45 | 34,934,271,057,485,095,000 | 2 | 2 | 1 | 2,175 |
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.LinearAlgebra.Dual
#align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Topology Filter
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E}
{f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ}
| Mathlib/Analysis/Calculus/LagrangeMultipliers.lean | 44 | 53 | theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by |
intro htop
set fφ := fun x => (f x, φ x)
have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by
change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀)
rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop]
exact map_snd_nhdsWithin _
exact hextr.not_nhds_le_map A.ge
| 7 | 1,096.633158 | 2 | 2 | 4 | 2,176 |
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.LinearAlgebra.Dual
#align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Topology Filter
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E}
{f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ}
theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by
intro htop
set fφ := fun x => (f x, φ x)
have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by
change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀)
rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop]
exact map_snd_nhdsWithin _
exact hextr.not_nhds_le_map A.ge
#align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
| Mathlib/Analysis/Calculus/LagrangeMultipliers.lean | 60 | 78 | theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) :
∃ (Λ : Module.Dual ℝ F) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ ∀ x, Λ (f' x) + Λ₀ • φ' x = 0 := by |
rcases Submodule.exists_le_ker_of_lt_top _
(lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hφ') with
⟨Λ', h0, hΛ'⟩
set e : ((F →ₗ[ℝ] ℝ) × ℝ) ≃ₗ[ℝ] F × ℝ →ₗ[ℝ] ℝ :=
((LinearEquiv.refl ℝ (F →ₗ[ℝ] ℝ)).prod (LinearMap.ringLmapEquivSelf ℝ ℝ ℝ).symm).trans
(LinearMap.coprodEquiv ℝ)
rcases e.surjective Λ' with ⟨⟨Λ, Λ₀⟩, rfl⟩
refine ⟨Λ, Λ₀, e.map_ne_zero_iff.1 h0, fun x => ?_⟩
convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΛ') x using 1
-- squeezed `simp [mul_comm]` to speed up elaboration
simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply,
LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply,
ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply,
LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight,
LinearMap.one_apply, mul_comm]
| 15 | 3,269,017.372472 | 2 | 2 | 4 | 2,176 |
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.LinearAlgebra.Dual
#align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Topology Filter
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E}
{f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ}
theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by
intro htop
set fφ := fun x => (f x, φ x)
have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by
change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀)
rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop]
exact map_snd_nhdsWithin _
exact hextr.not_nhds_le_map A.ge
#align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) :
∃ (Λ : Module.Dual ℝ F) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ ∀ x, Λ (f' x) + Λ₀ • φ' x = 0 := by
rcases Submodule.exists_le_ker_of_lt_top _
(lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hφ') with
⟨Λ', h0, hΛ'⟩
set e : ((F →ₗ[ℝ] ℝ) × ℝ) ≃ₗ[ℝ] F × ℝ →ₗ[ℝ] ℝ :=
((LinearEquiv.refl ℝ (F →ₗ[ℝ] ℝ)).prod (LinearMap.ringLmapEquivSelf ℝ ℝ ℝ).symm).trans
(LinearMap.coprodEquiv ℝ)
rcases e.surjective Λ' with ⟨⟨Λ, Λ₀⟩, rfl⟩
refine ⟨Λ, Λ₀, e.map_ne_zero_iff.1 h0, fun x => ?_⟩
convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΛ') x using 1
-- squeezed `simp [mul_comm]` to speed up elaboration
simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply,
LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply,
ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply,
LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight,
LinearMap.one_apply, mul_comm]
#align is_local_extr_on.exists_linear_map_of_has_strict_fderiv_at IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
| Mathlib/Analysis/Calculus/LagrangeMultipliers.lean | 84 | 97 | theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d {f : E → ℝ} {f' : E →L[ℝ] ℝ}
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • f' + b • φ' = 0 := by |
obtain ⟨Λ, Λ₀, hΛ, hfΛ⟩ := hextr.exists_linear_map_of_hasStrictFDerivAt hf' hφ'
refine ⟨Λ 1, Λ₀, ?_, ?_⟩
· contrapose! hΛ
simp only [Prod.mk_eq_zero] at hΛ ⊢
refine ⟨LinearMap.ext fun x => ?_, hΛ.2⟩
simpa [hΛ.1] using Λ.map_smul x 1
· ext x
have H₁ : Λ (f' x) = f' x * Λ 1 := by
simpa only [mul_one, Algebra.id.smul_eq_mul] using Λ.map_smul (f' x) 1
have H₂ : f' x * Λ 1 + Λ₀ * φ' x = 0 := by simpa only [Algebra.id.smul_eq_mul, H₁] using hfΛ x
simpa [mul_comm] using H₂
| 11 | 59,874.141715 | 2 | 2 | 4 | 2,176 |
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.LinearAlgebra.Dual
#align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Topology Filter
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E}
{f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ}
theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by
intro htop
set fφ := fun x => (f x, φ x)
have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by
change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀)
rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop]
exact map_snd_nhdsWithin _
exact hextr.not_nhds_le_map A.ge
#align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) :
∃ (Λ : Module.Dual ℝ F) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ ∀ x, Λ (f' x) + Λ₀ • φ' x = 0 := by
rcases Submodule.exists_le_ker_of_lt_top _
(lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hφ') with
⟨Λ', h0, hΛ'⟩
set e : ((F →ₗ[ℝ] ℝ) × ℝ) ≃ₗ[ℝ] F × ℝ →ₗ[ℝ] ℝ :=
((LinearEquiv.refl ℝ (F →ₗ[ℝ] ℝ)).prod (LinearMap.ringLmapEquivSelf ℝ ℝ ℝ).symm).trans
(LinearMap.coprodEquiv ℝ)
rcases e.surjective Λ' with ⟨⟨Λ, Λ₀⟩, rfl⟩
refine ⟨Λ, Λ₀, e.map_ne_zero_iff.1 h0, fun x => ?_⟩
convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΛ') x using 1
-- squeezed `simp [mul_comm]` to speed up elaboration
simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply,
LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply,
ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply,
LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight,
LinearMap.one_apply, mul_comm]
#align is_local_extr_on.exists_linear_map_of_has_strict_fderiv_at IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d {f : E → ℝ} {f' : E →L[ℝ] ℝ}
(hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀)
(hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • f' + b • φ' = 0 := by
obtain ⟨Λ, Λ₀, hΛ, hfΛ⟩ := hextr.exists_linear_map_of_hasStrictFDerivAt hf' hφ'
refine ⟨Λ 1, Λ₀, ?_, ?_⟩
· contrapose! hΛ
simp only [Prod.mk_eq_zero] at hΛ ⊢
refine ⟨LinearMap.ext fun x => ?_, hΛ.2⟩
simpa [hΛ.1] using Λ.map_smul x 1
· ext x
have H₁ : Λ (f' x) = f' x * Λ 1 := by
simpa only [mul_one, Algebra.id.smul_eq_mul] using Λ.map_smul (f' x) 1
have H₂ : f' x * Λ 1 + Λ₀ * φ' x = 0 := by simpa only [Algebra.id.smul_eq_mul, H₁] using hfΛ x
simpa [mul_comm] using H₂
#align is_local_extr_on.exists_multipliers_of_has_strict_fderiv_at_1d IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d
| Mathlib/Analysis/Calculus/LagrangeMultipliers.lean | 108 | 121 | theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt {ι : Type*} [Fintype ι]
{f : ι → E → ℝ} {f' : ι → E →L[ℝ] ℝ} (hextr : IsLocalExtrOn φ {x | ∀ i, f i x = f i x₀} x₀)
(hf' : ∀ i, HasStrictFDerivAt (f i) (f' i) x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) :
∃ (Λ : ι → ℝ) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ (∑ i, Λ i • f' i) + Λ₀ • φ' = 0 := by |
letI := Classical.decEq ι
replace hextr : IsLocalExtrOn φ {x | (fun i => f i x) = fun i => f i x₀} x₀ := by
simpa only [Function.funext_iff] using hextr
rcases hextr.exists_linear_map_of_hasStrictFDerivAt (hasStrictFDerivAt_pi.2 fun i => hf' i)
hφ' with
⟨Λ, Λ₀, h0, hsum⟩
rcases (LinearEquiv.piRing ℝ ℝ ι ℝ).symm.surjective Λ with ⟨Λ, rfl⟩
refine ⟨Λ, Λ₀, ?_, ?_⟩
· simpa only [Ne, Prod.ext_iff, LinearEquiv.map_eq_zero_iff, Prod.fst_zero] using h0
· ext x; simpa [mul_comm] using hsum x
| 10 | 22,026.465795 | 2 | 2 | 4 | 2,176 |
import Mathlib.CategoryTheory.Limits.Shapes.Equalizers
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.StrongEpi
import Mathlib.CategoryTheory.MorphismProperty.Factorization
#align_import category_theory.limits.shapes.images from "leanprover-community/mathlib"@"563aed347eb59dc4181cb732cda0d124d736eaa3"
noncomputable section
universe v u
open CategoryTheory
open CategoryTheory.Limits.WalkingParallelPair
namespace CategoryTheory.Limits
variable {C : Type u} [Category.{v} C]
variable {X Y : C} (f : X ⟶ Y)
structure MonoFactorisation (f : X ⟶ Y) where
I : C -- Porting note: violates naming conventions but can't think a better replacement
m : I ⟶ Y
[m_mono : Mono m]
e : X ⟶ I
fac : e ≫ m = f := by aesop_cat
#align category_theory.limits.mono_factorisation CategoryTheory.Limits.MonoFactorisation
#align category_theory.limits.mono_factorisation.fac' CategoryTheory.Limits.MonoFactorisation.fac
attribute [inherit_doc MonoFactorisation] MonoFactorisation.I MonoFactorisation.m
MonoFactorisation.m_mono MonoFactorisation.e MonoFactorisation.fac
attribute [reassoc (attr := simp)] MonoFactorisation.fac
attribute [instance] MonoFactorisation.m_mono
attribute [instance] MonoFactorisation.m_mono
namespace MonoFactorisation
def self [Mono f] : MonoFactorisation f where
I := X
m := f
e := 𝟙 X
#align category_theory.limits.mono_factorisation.self CategoryTheory.Limits.MonoFactorisation.self
-- I'm not sure we really need this, but the linter says that an inhabited instance
-- ought to exist...
instance [Mono f] : Inhabited (MonoFactorisation f) := ⟨self f⟩
variable {f}
@[ext]
| Mathlib/CategoryTheory/Limits/Shapes/Images.lean | 108 | 115 | theorem ext {F F' : MonoFactorisation f} (hI : F.I = F'.I)
(hm : F.m = eqToHom hI ≫ F'.m) : F = F' := by |
cases' F with _ Fm _ _ Ffac; cases' F' with _ Fm' _ _ Ffac'
cases' hI
simp? at hm says simp only [eqToHom_refl, Category.id_comp] at hm
congr
apply (cancel_mono Fm).1
rw [Ffac, hm, Ffac']
| 6 | 403.428793 | 2 | 2 | 1 | 2,177 |
import Mathlib.RingTheory.OrzechProperty
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f"
noncomputable section
open Function
universe u v w
section
variable (R : Type u) [Semiring R]
@[mk_iff]
class StrongRankCondition : Prop where
le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m
#align strong_rank_condition StrongRankCondition
theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Injective f → n ≤ m :=
StrongRankCondition.le_of_fin_injective f
#align le_of_fin_injective le_of_fin_injective
| Mathlib/LinearAlgebra/InvariantBasisNumber.lean | 130 | 139 | theorem strongRankCondition_iff_succ :
StrongRankCondition R ↔
∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by |
refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩
· letI : StrongRankCondition R := h
exact Nat.not_succ_le_self n (le_of_fin_injective R f hf)
· by_contra H
exact
h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H))))
(hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _))
| 7 | 1,096.633158 | 2 | 2 | 5 | 2,178 |
import Mathlib.RingTheory.OrzechProperty
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f"
noncomputable section
open Function
universe u v w
section
variable (R : Type u) [Semiring R]
@[mk_iff]
class StrongRankCondition : Prop where
le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m
#align strong_rank_condition StrongRankCondition
theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Injective f → n ≤ m :=
StrongRankCondition.le_of_fin_injective f
#align le_of_fin_injective le_of_fin_injective
theorem strongRankCondition_iff_succ :
StrongRankCondition R ↔
∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by
refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩
· letI : StrongRankCondition R := h
exact Nat.not_succ_le_self n (le_of_fin_injective R f hf)
· by_contra H
exact
h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H))))
(hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _))
#align strong_rank_condition_iff_succ strongRankCondition_iff_succ
instance (priority := 100) strongRankCondition_of_orzechProperty
[Nontrivial R] [OrzechProperty R] : StrongRankCondition R := by
refine (strongRankCondition_iff_succ R).2 fun n i hi ↦ ?_
let f : (Fin (n + 1) → R) →ₗ[R] Fin n → R := {
toFun := fun x ↦ x ∘ Fin.castSucc
map_add' := fun _ _ ↦ rfl
map_smul' := fun _ _ ↦ rfl
}
have h : (0 : Fin (n + 1) → R) = update (0 : Fin (n + 1) → R) (Fin.last n) 1 := by
apply OrzechProperty.injective_of_surjective_of_injective i f hi
(Fin.castSucc_injective _).surjective_comp_right
ext m
simp [f, update_apply, (Fin.castSucc_lt_last m).ne]
simpa using congr_fun h (Fin.last n)
| Mathlib/LinearAlgebra/InvariantBasisNumber.lean | 158 | 164 | theorem card_le_of_injective [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by |
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_injective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).injective.comp i).comp (LinearEquiv.injective P))
| 5 | 148.413159 | 2 | 2 | 5 | 2,178 |
import Mathlib.RingTheory.OrzechProperty
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f"
noncomputable section
open Function
universe u v w
section
variable (R : Type u) [Semiring R]
@[mk_iff]
class StrongRankCondition : Prop where
le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m
#align strong_rank_condition StrongRankCondition
theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Injective f → n ≤ m :=
StrongRankCondition.le_of_fin_injective f
#align le_of_fin_injective le_of_fin_injective
theorem strongRankCondition_iff_succ :
StrongRankCondition R ↔
∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by
refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩
· letI : StrongRankCondition R := h
exact Nat.not_succ_le_self n (le_of_fin_injective R f hf)
· by_contra H
exact
h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H))))
(hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _))
#align strong_rank_condition_iff_succ strongRankCondition_iff_succ
instance (priority := 100) strongRankCondition_of_orzechProperty
[Nontrivial R] [OrzechProperty R] : StrongRankCondition R := by
refine (strongRankCondition_iff_succ R).2 fun n i hi ↦ ?_
let f : (Fin (n + 1) → R) →ₗ[R] Fin n → R := {
toFun := fun x ↦ x ∘ Fin.castSucc
map_add' := fun _ _ ↦ rfl
map_smul' := fun _ _ ↦ rfl
}
have h : (0 : Fin (n + 1) → R) = update (0 : Fin (n + 1) → R) (Fin.last n) 1 := by
apply OrzechProperty.injective_of_surjective_of_injective i f hi
(Fin.castSucc_injective _).surjective_comp_right
ext m
simp [f, update_apply, (Fin.castSucc_lt_last m).ne]
simpa using congr_fun h (Fin.last n)
theorem card_le_of_injective [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_injective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).injective.comp i).comp (LinearEquiv.injective P))
#align card_le_of_injective card_le_of_injective
| Mathlib/LinearAlgebra/InvariantBasisNumber.lean | 167 | 173 | theorem card_le_of_injective' [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α →₀ R) →ₗ[R] β →₀ R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by |
let P := Finsupp.linearEquivFunOnFinite R R β
let Q := (Finsupp.linearEquivFunOnFinite R R α).symm
exact
card_le_of_injective R ((P.toLinearMap.comp f).comp Q.toLinearMap)
((P.injective.comp i).comp Q.injective)
| 5 | 148.413159 | 2 | 2 | 5 | 2,178 |
import Mathlib.RingTheory.OrzechProperty
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f"
noncomputable section
open Function
universe u v w
section
variable (R : Type u) [Semiring R]
@[mk_iff]
class StrongRankCondition : Prop where
le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m
#align strong_rank_condition StrongRankCondition
theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Injective f → n ≤ m :=
StrongRankCondition.le_of_fin_injective f
#align le_of_fin_injective le_of_fin_injective
theorem strongRankCondition_iff_succ :
StrongRankCondition R ↔
∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by
refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩
· letI : StrongRankCondition R := h
exact Nat.not_succ_le_self n (le_of_fin_injective R f hf)
· by_contra H
exact
h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H))))
(hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _))
#align strong_rank_condition_iff_succ strongRankCondition_iff_succ
instance (priority := 100) strongRankCondition_of_orzechProperty
[Nontrivial R] [OrzechProperty R] : StrongRankCondition R := by
refine (strongRankCondition_iff_succ R).2 fun n i hi ↦ ?_
let f : (Fin (n + 1) → R) →ₗ[R] Fin n → R := {
toFun := fun x ↦ x ∘ Fin.castSucc
map_add' := fun _ _ ↦ rfl
map_smul' := fun _ _ ↦ rfl
}
have h : (0 : Fin (n + 1) → R) = update (0 : Fin (n + 1) → R) (Fin.last n) 1 := by
apply OrzechProperty.injective_of_surjective_of_injective i f hi
(Fin.castSucc_injective _).surjective_comp_right
ext m
simp [f, update_apply, (Fin.castSucc_lt_last m).ne]
simpa using congr_fun h (Fin.last n)
theorem card_le_of_injective [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_injective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).injective.comp i).comp (LinearEquiv.injective P))
#align card_le_of_injective card_le_of_injective
theorem card_le_of_injective' [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α →₀ R) →ₗ[R] β →₀ R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := Finsupp.linearEquivFunOnFinite R R β
let Q := (Finsupp.linearEquivFunOnFinite R R α).symm
exact
card_le_of_injective R ((P.toLinearMap.comp f).comp Q.toLinearMap)
((P.injective.comp i).comp Q.injective)
#align card_le_of_injective' card_le_of_injective'
class RankCondition : Prop where
le_of_fin_surjective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Surjective f → m ≤ n
#align rank_condition RankCondition
theorem le_of_fin_surjective [RankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Surjective f → m ≤ n :=
RankCondition.le_of_fin_surjective f
#align le_of_fin_surjective le_of_fin_surjective
| Mathlib/LinearAlgebra/InvariantBasisNumber.lean | 188 | 194 | theorem card_le_of_surjective [RankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Surjective f) : Fintype.card β ≤ Fintype.card α := by |
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_surjective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).surjective.comp i).comp (LinearEquiv.surjective P))
| 5 | 148.413159 | 2 | 2 | 5 | 2,178 |
import Mathlib.RingTheory.OrzechProperty
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f"
noncomputable section
open Function
universe u v w
section
variable (R : Type u) [Semiring R]
@[mk_iff]
class StrongRankCondition : Prop where
le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m
#align strong_rank_condition StrongRankCondition
theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Injective f → n ≤ m :=
StrongRankCondition.le_of_fin_injective f
#align le_of_fin_injective le_of_fin_injective
theorem strongRankCondition_iff_succ :
StrongRankCondition R ↔
∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by
refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩
· letI : StrongRankCondition R := h
exact Nat.not_succ_le_self n (le_of_fin_injective R f hf)
· by_contra H
exact
h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H))))
(hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _))
#align strong_rank_condition_iff_succ strongRankCondition_iff_succ
instance (priority := 100) strongRankCondition_of_orzechProperty
[Nontrivial R] [OrzechProperty R] : StrongRankCondition R := by
refine (strongRankCondition_iff_succ R).2 fun n i hi ↦ ?_
let f : (Fin (n + 1) → R) →ₗ[R] Fin n → R := {
toFun := fun x ↦ x ∘ Fin.castSucc
map_add' := fun _ _ ↦ rfl
map_smul' := fun _ _ ↦ rfl
}
have h : (0 : Fin (n + 1) → R) = update (0 : Fin (n + 1) → R) (Fin.last n) 1 := by
apply OrzechProperty.injective_of_surjective_of_injective i f hi
(Fin.castSucc_injective _).surjective_comp_right
ext m
simp [f, update_apply, (Fin.castSucc_lt_last m).ne]
simpa using congr_fun h (Fin.last n)
theorem card_le_of_injective [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_injective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).injective.comp i).comp (LinearEquiv.injective P))
#align card_le_of_injective card_le_of_injective
theorem card_le_of_injective' [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α →₀ R) →ₗ[R] β →₀ R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := Finsupp.linearEquivFunOnFinite R R β
let Q := (Finsupp.linearEquivFunOnFinite R R α).symm
exact
card_le_of_injective R ((P.toLinearMap.comp f).comp Q.toLinearMap)
((P.injective.comp i).comp Q.injective)
#align card_le_of_injective' card_le_of_injective'
class RankCondition : Prop where
le_of_fin_surjective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Surjective f → m ≤ n
#align rank_condition RankCondition
theorem le_of_fin_surjective [RankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Surjective f → m ≤ n :=
RankCondition.le_of_fin_surjective f
#align le_of_fin_surjective le_of_fin_surjective
theorem card_le_of_surjective [RankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Surjective f) : Fintype.card β ≤ Fintype.card α := by
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_surjective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).surjective.comp i).comp (LinearEquiv.surjective P))
#align card_le_of_surjective card_le_of_surjective
| Mathlib/LinearAlgebra/InvariantBasisNumber.lean | 197 | 203 | theorem card_le_of_surjective' [RankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α →₀ R) →ₗ[R] β →₀ R) (i : Surjective f) : Fintype.card β ≤ Fintype.card α := by |
let P := Finsupp.linearEquivFunOnFinite R R β
let Q := (Finsupp.linearEquivFunOnFinite R R α).symm
exact
card_le_of_surjective R ((P.toLinearMap.comp f).comp Q.toLinearMap)
((P.surjective.comp i).comp Q.surjective)
| 5 | 148.413159 | 2 | 2 | 5 | 2,178 |
import Mathlib.Topology.Constructions
import Mathlib.Topology.Separation
open Set Filter Function Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : X → Y}
section codiscrete_filter
| Mathlib/Topology/DiscreteSubset.lean | 83 | 92 | theorem isClosed_and_discrete_iff {S : Set X} :
IsClosed S ∧ DiscreteTopology S ↔ ∀ x, Disjoint (𝓝[≠] x) (𝓟 S) := by |
rw [discreteTopology_subtype_iff, isClosed_iff_clusterPt, ← forall_and]
congrm (∀ x, ?_)
rw [← not_imp_not, clusterPt_iff_not_disjoint, not_not, ← disjoint_iff]
constructor <;> intro H
· by_cases hx : x ∈ S
exacts [H.2 hx, (H.1 hx).mono_left nhdsWithin_le_nhds]
· refine ⟨fun hx ↦ ?_, fun _ ↦ H⟩
simpa [disjoint_iff, nhdsWithin, inf_assoc, hx] using H
| 8 | 2,980.957987 | 2 | 2 | 1 | 2,179 |
import Mathlib.LinearAlgebra.Matrix.Transvection
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.Tactic.FinCases
#align_import linear_algebra.matrix.block from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
open Finset Function OrderDual
open Matrix
universe v
variable {α β m n o : Type*} {m' n' : α → Type*}
variable {R : Type v} [CommRing R] {M N : Matrix m m R} {b : m → α}
namespace Matrix
section LT
variable [LT α]
def BlockTriangular (M : Matrix m m R) (b : m → α) : Prop :=
∀ ⦃i j⦄, b j < b i → M i j = 0
#align matrix.block_triangular Matrix.BlockTriangular
@[simp]
protected theorem BlockTriangular.submatrix {f : n → m} (h : M.BlockTriangular b) :
(M.submatrix f f).BlockTriangular (b ∘ f) := fun _ _ hij => h hij
#align matrix.block_triangular.submatrix Matrix.BlockTriangular.submatrix
| Mathlib/LinearAlgebra/Matrix/Block.lean | 63 | 69 | theorem blockTriangular_reindex_iff {b : n → α} {e : m ≃ n} :
(reindex e e M).BlockTriangular b ↔ M.BlockTriangular (b ∘ e) := by |
refine ⟨fun h => ?_, fun h => ?_⟩
· convert h.submatrix
simp only [reindex_apply, submatrix_submatrix, submatrix_id_id, Equiv.symm_comp_self]
· convert h.submatrix
simp only [comp.assoc b e e.symm, Equiv.self_comp_symm, comp_id]
| 5 | 148.413159 | 2 | 2 | 1 | 2,180 |
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)
| 30 | 10,686,474,581,524.463 | 2 | 2 | 2 | 2,181 |
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' : ℝ → ℝ}
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)
#align exists_has_deriv_within_at_eq_of_gt_of_lt exists_hasDerivWithinAt_eq_of_gt_of_lt
theorem exists_hasDerivWithinAt_eq_of_lt_of_gt (hab : a ≤ b)
(hf : ∀ x ∈ Icc a b, HasDerivWithinAt f (f' x) (Icc a b) x) {m : ℝ} (hma : m < f' a)
(hmb : f' b < m) : m ∈ f' '' Ioo a b :=
let ⟨c, cmem, hc⟩ :=
exists_hasDerivWithinAt_eq_of_gt_of_lt hab (fun x hx => (hf x hx).neg) (neg_lt_neg hma)
(neg_lt_neg hmb)
⟨c, cmem, neg_injective hc⟩
#align exists_has_deriv_within_at_eq_of_lt_of_gt exists_hasDerivWithinAt_eq_of_lt_of_gt
| Mathlib/Analysis/Calculus/Darboux.lean | 76 | 90 | theorem Set.OrdConnected.image_hasDerivWithinAt {s : Set ℝ} (hs : OrdConnected s)
(hf : ∀ x ∈ s, HasDerivWithinAt f (f' x) s x) : OrdConnected (f' '' s) := by |
apply ordConnected_of_Ioo
rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ - m ⟨hma, hmb⟩
rcases le_total a b with hab | hab
· have : Icc a b ⊆ s := hs.out ha hb
rcases exists_hasDerivWithinAt_eq_of_gt_of_lt hab (fun x hx => (hf x <| this hx).mono this) hma
hmb with
⟨c, cmem, hc⟩
exact ⟨c, this <| Ioo_subset_Icc_self cmem, hc⟩
· have : Icc b a ⊆ s := hs.out hb ha
rcases exists_hasDerivWithinAt_eq_of_lt_of_gt hab (fun x hx => (hf x <| this hx).mono this) hmb
hma with
⟨c, cmem, hc⟩
exact ⟨c, this <| Ioo_subset_Icc_self cmem, hc⟩
| 13 | 442,413.392009 | 2 | 2 | 2 | 2,181 |
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Tactic.Monotonicity
#align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
open Int
variable {K : Type*} {v : K} {n : ℕ} [LinearOrderedField K] [FloorRing K]
namespace IntFractPair
| Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean | 70 | 80 | theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1 := by |
cases n with
| zero =>
have : IntFractPair.of v = ifp_n := by injection nth_stream_eq
rw [← this, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
| succ =>
rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩
rw [← ifp_of_eq_ifp_n, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
| 9 | 8,103.083928 | 2 | 2 | 3 | 2,182 |
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Tactic.Monotonicity
#align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
open Int
variable {K : Type*} {v : K} {n : ℕ} [LinearOrderedField K] [FloorRing K]
namespace IntFractPair
theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1 := by
cases n with
| zero =>
have : IntFractPair.of v = ifp_n := by injection nth_stream_eq
rw [← this, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
| succ =>
rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩
rw [← ifp_of_eq_ifp_n, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg_lt_one
theorem nth_stream_fr_nonneg {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr :=
(nth_stream_fr_nonneg_lt_one nth_stream_eq).left
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg
theorem nth_stream_fr_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : ifp_n.fr < 1 :=
(nth_stream_fr_nonneg_lt_one nth_stream_eq).right
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_lt_one
| Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean | 96 | 107 | theorem one_le_succ_nth_stream_b {ifp_succ_n : IntFractPair K}
(succ_nth_stream_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n) : 1 ≤ ifp_succ_n.b := by |
obtain ⟨ifp_n, nth_stream_eq, stream_nth_fr_ne_zero, ⟨-⟩⟩ :
∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧ ifp_n.fr ≠ 0
∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n :=
succ_nth_stream_eq_some_iff.1 succ_nth_stream_eq
suffices 1 ≤ ifp_n.fr⁻¹ by rwa [IntFractPair.of, le_floor, cast_one]
suffices ifp_n.fr ≤ 1 by
have h : 0 < ifp_n.fr :=
lt_of_le_of_ne (nth_stream_fr_nonneg nth_stream_eq) stream_nth_fr_ne_zero.symm
apply one_le_inv h this
simp only [le_of_lt (nth_stream_fr_lt_one nth_stream_eq)]
| 10 | 22,026.465795 | 2 | 2 | 3 | 2,182 |
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Tactic.Monotonicity
#align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
open Int
variable {K : Type*} {v : K} {n : ℕ} [LinearOrderedField K] [FloorRing K]
namespace IntFractPair
theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1 := by
cases n with
| zero =>
have : IntFractPair.of v = ifp_n := by injection nth_stream_eq
rw [← this, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
| succ =>
rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩
rw [← ifp_of_eq_ifp_n, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg_lt_one
theorem nth_stream_fr_nonneg {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr :=
(nth_stream_fr_nonneg_lt_one nth_stream_eq).left
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg
theorem nth_stream_fr_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : ifp_n.fr < 1 :=
(nth_stream_fr_nonneg_lt_one nth_stream_eq).right
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_lt_one
theorem one_le_succ_nth_stream_b {ifp_succ_n : IntFractPair K}
(succ_nth_stream_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n) : 1 ≤ ifp_succ_n.b := by
obtain ⟨ifp_n, nth_stream_eq, stream_nth_fr_ne_zero, ⟨-⟩⟩ :
∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧ ifp_n.fr ≠ 0
∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n :=
succ_nth_stream_eq_some_iff.1 succ_nth_stream_eq
suffices 1 ≤ ifp_n.fr⁻¹ by rwa [IntFractPair.of, le_floor, cast_one]
suffices ifp_n.fr ≤ 1 by
have h : 0 < ifp_n.fr :=
lt_of_le_of_ne (nth_stream_fr_nonneg nth_stream_eq) stream_nth_fr_ne_zero.symm
apply one_le_inv h this
simp only [le_of_lt (nth_stream_fr_lt_one nth_stream_eq)]
#align generalized_continued_fraction.int_fract_pair.one_le_succ_nth_stream_b GeneralizedContinuedFraction.IntFractPair.one_le_succ_nth_stream_b
| Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean | 115 | 127 | theorem succ_nth_stream_b_le_nth_stream_fr_inv {ifp_n ifp_succ_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n)
(succ_nth_stream_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n) :
(ifp_succ_n.b : K) ≤ ifp_n.fr⁻¹ := by |
suffices (⌊ifp_n.fr⁻¹⌋ : K) ≤ ifp_n.fr⁻¹ by
cases' ifp_n with _ ifp_n_fr
have : ifp_n_fr ≠ 0 := by
intro h
simp [h, IntFractPair.stream, nth_stream_eq] at succ_nth_stream_eq
have : IntFractPair.of ifp_n_fr⁻¹ = ifp_succ_n := by
simpa [this, IntFractPair.stream, nth_stream_eq, Option.coe_def] using succ_nth_stream_eq
rwa [← this]
exact floor_le ifp_n.fr⁻¹
| 9 | 8,103.083928 | 2 | 2 | 3 | 2,182 |
import Mathlib.CategoryTheory.Limits.Shapes.WideEqualizers
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
#align_import category_theory.limits.constructions.weakly_initial from "leanprover-community/mathlib"@"239d882c4fb58361ee8b3b39fb2091320edef10a"
universe v u
namespace CategoryTheory
open Limits
variable {C : Type u} [Category.{v} C]
theorem has_weakly_initial_of_weakly_initial_set_and_hasProducts [HasProducts.{v} C] {ι : Type v}
{B : ι → C} (hB : ∀ A : C, ∃ i, Nonempty (B i ⟶ A)) : ∃ T : C, ∀ X, Nonempty (T ⟶ X) :=
⟨∏ᶜ B, fun X => ⟨Pi.π _ _ ≫ (hB X).choose_spec.some⟩⟩
#align category_theory.has_weakly_initial_of_weakly_initial_set_and_has_products CategoryTheory.has_weakly_initial_of_weakly_initial_set_and_hasProducts
| Mathlib/CategoryTheory/Limits/Constructions/WeaklyInitial.lean | 46 | 64 | theorem hasInitial_of_weakly_initial_and_hasWideEqualizers [HasWideEqualizers.{v} C] {T : C}
(hT : ∀ X, Nonempty (T ⟶ X)) : HasInitial C := by |
let endos := T ⟶ T
let i := wideEqualizer.ι (id : endos → endos)
haveI : Nonempty endos := ⟨𝟙 _⟩
have : ∀ X : C, Unique (wideEqualizer (id : endos → endos) ⟶ X) := by
intro X
refine ⟨⟨i ≫ Classical.choice (hT X)⟩, fun a => ?_⟩
let E := equalizer a (i ≫ Classical.choice (hT _))
let e : E ⟶ wideEqualizer id := equalizer.ι _ _
let h : T ⟶ E := Classical.choice (hT E)
have : ((i ≫ h) ≫ e) ≫ i = i ≫ 𝟙 _ := by
rw [Category.assoc, Category.assoc]
apply wideEqualizer.condition (id : endos → endos) (h ≫ e ≫ i)
rw [Category.comp_id, cancel_mono_id i] at this
haveI : IsSplitEpi e := IsSplitEpi.mk' ⟨i ≫ h, this⟩
rw [← cancel_epi e]
apply equalizer.condition
exact hasInitial_of_unique (wideEqualizer (id : endos → endos))
| 17 | 24,154,952.753575 | 2 | 2 | 1 | 2,183 |
import Mathlib.RingTheory.SimpleModule
import Mathlib.Topology.Algebra.Module.Basic
#align_import topology.algebra.module.simple from "leanprover-community/mathlib"@"f430769b562e0cedef59ee1ed968d67e0e0c86ba"
universe u v w
variable {R : Type u} {M : Type v} {N : Type w} [Ring R] [TopologicalSpace R] [TopologicalSpace M]
[AddCommGroup M] [AddCommGroup N] [Module R M] [ContinuousSMul R M] [Module R N] [ContinuousAdd M]
[IsSimpleModule R N]
| Mathlib/Topology/Algebra/Module/Simple.lean | 28 | 34 | theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) :
IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by |
rcases l.surjective_or_eq_zero with (hl | rfl)
· exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl)
· rw [LinearMap.ker_zero]
left
exact isClosed_univ
| 5 | 148.413159 | 2 | 2 | 1 | 2,184 |
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Nat.ModEq
import Mathlib.Data.Nat.GCD.BigOperators
namespace Nat
variable {ι : Type*}
lemma modEq_list_prod_iff {a b} {l : List ℕ} (co : l.Pairwise Coprime) :
a ≡ b [MOD l.prod] ↔ ∀ i, a ≡ b [MOD l.get i] := by
induction' l with m l ih
· simp [modEq_one]
· have : Coprime m l.prod := coprime_list_prod_right_iff.mpr (List.pairwise_cons.mp co).1
simp only [List.prod_cons, ← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co),
List.length_cons]
constructor
· rintro ⟨h0, hs⟩ i
cases i using Fin.cases <;> simp [h0, hs]
· intro h; exact ⟨h 0, fun i => h i.succ⟩
lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) :
a ≡ b [MOD (l.map s).prod] ↔ ∀ i ∈ l, a ≡ b [MOD s i] := by
induction' l with i l ih
· simp [modEq_one]
· have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
simp [← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co)]
variable (a s : ι → ℕ)
def chineseRemainderOfList : (l : List ι) → l.Pairwise (Coprime on s) →
{ k // ∀ i ∈ l, k ≡ a i [MOD s i] }
| [], _ => ⟨0, by simp⟩
| i :: l, co => by
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
have ih := chineseRemainderOfList l co.of_cons
have k := chineseRemainder this (a i) ih
use k
simp only [List.mem_cons, forall_eq_or_imp, k.prop.1, true_and]
intro j hj
exact ((modEq_list_prod_iff' co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj)
@[simp] theorem chineseRemainderOfList_nil :
(chineseRemainderOfList a s [] List.Pairwise.nil : ℕ) = 0 := rfl
| Mathlib/Data/Nat/ChineseRemainder.lean | 75 | 91 | theorem chineseRemainderOfList_lt_prod (l : List ι)
(co : l.Pairwise (Coprime on s)) (hs : ∀ i ∈ l, s i ≠ 0) :
chineseRemainderOfList a s l co < (l.map s).prod := by |
cases l with
| nil => simp
| cons i l =>
simp only [chineseRemainderOfList, List.map_cons, List.prod_cons]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
refine chineseRemainder_lt_mul this (a i) (chineseRemainderOfList a s l co.of_cons)
(hs i (List.mem_cons_self _ l)) ?_
simp only [ne_eq, List.prod_eq_zero_iff, List.mem_map, not_exists, not_and]
intro j hj
exact hs j (List.mem_cons_of_mem _ hj)
| 14 | 1,202,604.284165 | 2 | 2 | 3 | 2,185 |
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Nat.ModEq
import Mathlib.Data.Nat.GCD.BigOperators
namespace Nat
variable {ι : Type*}
lemma modEq_list_prod_iff {a b} {l : List ℕ} (co : l.Pairwise Coprime) :
a ≡ b [MOD l.prod] ↔ ∀ i, a ≡ b [MOD l.get i] := by
induction' l with m l ih
· simp [modEq_one]
· have : Coprime m l.prod := coprime_list_prod_right_iff.mpr (List.pairwise_cons.mp co).1
simp only [List.prod_cons, ← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co),
List.length_cons]
constructor
· rintro ⟨h0, hs⟩ i
cases i using Fin.cases <;> simp [h0, hs]
· intro h; exact ⟨h 0, fun i => h i.succ⟩
lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) :
a ≡ b [MOD (l.map s).prod] ↔ ∀ i ∈ l, a ≡ b [MOD s i] := by
induction' l with i l ih
· simp [modEq_one]
· have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
simp [← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co)]
variable (a s : ι → ℕ)
def chineseRemainderOfList : (l : List ι) → l.Pairwise (Coprime on s) →
{ k // ∀ i ∈ l, k ≡ a i [MOD s i] }
| [], _ => ⟨0, by simp⟩
| i :: l, co => by
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
have ih := chineseRemainderOfList l co.of_cons
have k := chineseRemainder this (a i) ih
use k
simp only [List.mem_cons, forall_eq_or_imp, k.prop.1, true_and]
intro j hj
exact ((modEq_list_prod_iff' co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj)
@[simp] theorem chineseRemainderOfList_nil :
(chineseRemainderOfList a s [] List.Pairwise.nil : ℕ) = 0 := rfl
theorem chineseRemainderOfList_lt_prod (l : List ι)
(co : l.Pairwise (Coprime on s)) (hs : ∀ i ∈ l, s i ≠ 0) :
chineseRemainderOfList a s l co < (l.map s).prod := by
cases l with
| nil => simp
| cons i l =>
simp only [chineseRemainderOfList, List.map_cons, List.prod_cons]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
refine chineseRemainder_lt_mul this (a i) (chineseRemainderOfList a s l co.of_cons)
(hs i (List.mem_cons_self _ l)) ?_
simp only [ne_eq, List.prod_eq_zero_iff, List.mem_map, not_exists, not_and]
intro j hj
exact hs j (List.mem_cons_of_mem _ hj)
| Mathlib/Data/Nat/ChineseRemainder.lean | 93 | 105 | theorem chineseRemainderOfList_modEq_unique (l : List ι)
(co : l.Pairwise (Coprime on s)) {z} (hz : ∀ i ∈ l, z ≡ a i [MOD s i]) :
z ≡ chineseRemainderOfList a s l co [MOD (l.map s).prod] := by |
induction' l with i l ih
· simp [modEq_one]
· simp only [List.map_cons, List.prod_cons, chineseRemainderOfList]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
exact chineseRemainder_modEq_unique this
(hz i (List.mem_cons_self _ _)) (ih co.of_cons (fun j hj => hz j (List.mem_cons_of_mem _ hj)))
| 10 | 22,026.465795 | 2 | 2 | 3 | 2,185 |
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Nat.ModEq
import Mathlib.Data.Nat.GCD.BigOperators
namespace Nat
variable {ι : Type*}
lemma modEq_list_prod_iff {a b} {l : List ℕ} (co : l.Pairwise Coprime) :
a ≡ b [MOD l.prod] ↔ ∀ i, a ≡ b [MOD l.get i] := by
induction' l with m l ih
· simp [modEq_one]
· have : Coprime m l.prod := coprime_list_prod_right_iff.mpr (List.pairwise_cons.mp co).1
simp only [List.prod_cons, ← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co),
List.length_cons]
constructor
· rintro ⟨h0, hs⟩ i
cases i using Fin.cases <;> simp [h0, hs]
· intro h; exact ⟨h 0, fun i => h i.succ⟩
lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) :
a ≡ b [MOD (l.map s).prod] ↔ ∀ i ∈ l, a ≡ b [MOD s i] := by
induction' l with i l ih
· simp [modEq_one]
· have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
simp [← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co)]
variable (a s : ι → ℕ)
def chineseRemainderOfList : (l : List ι) → l.Pairwise (Coprime on s) →
{ k // ∀ i ∈ l, k ≡ a i [MOD s i] }
| [], _ => ⟨0, by simp⟩
| i :: l, co => by
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
have ih := chineseRemainderOfList l co.of_cons
have k := chineseRemainder this (a i) ih
use k
simp only [List.mem_cons, forall_eq_or_imp, k.prop.1, true_and]
intro j hj
exact ((modEq_list_prod_iff' co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj)
@[simp] theorem chineseRemainderOfList_nil :
(chineseRemainderOfList a s [] List.Pairwise.nil : ℕ) = 0 := rfl
theorem chineseRemainderOfList_lt_prod (l : List ι)
(co : l.Pairwise (Coprime on s)) (hs : ∀ i ∈ l, s i ≠ 0) :
chineseRemainderOfList a s l co < (l.map s).prod := by
cases l with
| nil => simp
| cons i l =>
simp only [chineseRemainderOfList, List.map_cons, List.prod_cons]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
refine chineseRemainder_lt_mul this (a i) (chineseRemainderOfList a s l co.of_cons)
(hs i (List.mem_cons_self _ l)) ?_
simp only [ne_eq, List.prod_eq_zero_iff, List.mem_map, not_exists, not_and]
intro j hj
exact hs j (List.mem_cons_of_mem _ hj)
theorem chineseRemainderOfList_modEq_unique (l : List ι)
(co : l.Pairwise (Coprime on s)) {z} (hz : ∀ i ∈ l, z ≡ a i [MOD s i]) :
z ≡ chineseRemainderOfList a s l co [MOD (l.map s).prod] := by
induction' l with i l ih
· simp [modEq_one]
· simp only [List.map_cons, List.prod_cons, chineseRemainderOfList]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
exact chineseRemainder_modEq_unique this
(hz i (List.mem_cons_self _ _)) (ih co.of_cons (fun j hj => hz j (List.mem_cons_of_mem _ hj)))
| Mathlib/Data/Nat/ChineseRemainder.lean | 107 | 118 | theorem chineseRemainderOfList_perm {l l' : List ι} (hl : l.Perm l')
(hs : ∀ i ∈ l, s i ≠ 0) (co : l.Pairwise (Coprime on s)) :
(chineseRemainderOfList a s l co : ℕ) =
chineseRemainderOfList a s l' (co.perm hl coprime_comm.mpr) := by |
let z := chineseRemainderOfList a s l' (co.perm hl coprime_comm.mpr)
have hlp : (l.map s).prod = (l'.map s).prod := List.Perm.prod_eq (List.Perm.map s hl)
exact (chineseRemainderOfList_modEq_unique a s l co (z := z)
(fun i hi => z.prop i (hl.symm.mem_iff.mpr hi))).symm.eq_of_lt_of_lt
(chineseRemainderOfList_lt_prod _ _ _ _ hs)
(by rw [hlp]
exact chineseRemainderOfList_lt_prod _ _ _ _
(by simpa [List.Perm.mem_iff hl.symm] using hs))
| 8 | 2,980.957987 | 2 | 2 | 3 | 2,185 |
import Mathlib.Data.Set.Lattice
#align_import order.concept from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae"
open Function OrderDual Set
variable {ι : Sort*} {α β γ : Type*} {κ : ι → Sort*} (r : α → β → Prop) {s s₁ s₂ : Set α}
{t t₁ t₂ : Set β}
def intentClosure (s : Set α) : Set β :=
{ b | ∀ ⦃a⦄, a ∈ s → r a b }
#align intent_closure intentClosure
def extentClosure (t : Set β) : Set α :=
{ a | ∀ ⦃b⦄, b ∈ t → r a b }
#align extent_closure extentClosure
variable {r}
theorem subset_intentClosure_iff_subset_extentClosure :
t ⊆ intentClosure r s ↔ s ⊆ extentClosure r t :=
⟨fun h _ ha _ hb => h hb ha, fun h _ hb _ ha => h ha hb⟩
#align subset_intent_closure_iff_subset_extent_closure subset_intentClosure_iff_subset_extentClosure
variable (r)
theorem gc_intentClosure_extentClosure :
GaloisConnection (toDual ∘ intentClosure r) (extentClosure r ∘ ofDual) := fun _ _ =>
subset_intentClosure_iff_subset_extentClosure
#align gc_intent_closure_extent_closure gc_intentClosure_extentClosure
theorem intentClosure_swap (t : Set β) : intentClosure (swap r) t = extentClosure r t :=
rfl
#align intent_closure_swap intentClosure_swap
theorem extentClosure_swap (s : Set α) : extentClosure (swap r) s = intentClosure r s :=
rfl
#align extent_closure_swap extentClosure_swap
@[simp]
theorem intentClosure_empty : intentClosure r ∅ = univ :=
eq_univ_of_forall fun _ _ => False.elim
#align intent_closure_empty intentClosure_empty
@[simp]
theorem extentClosure_empty : extentClosure r ∅ = univ :=
intentClosure_empty _
#align extent_closure_empty extentClosure_empty
@[simp]
theorem intentClosure_union (s₁ s₂ : Set α) :
intentClosure r (s₁ ∪ s₂) = intentClosure r s₁ ∩ intentClosure r s₂ :=
Set.ext fun _ => forall₂_or_left
#align intent_closure_union intentClosure_union
@[simp]
theorem extentClosure_union (t₁ t₂ : Set β) :
extentClosure r (t₁ ∪ t₂) = extentClosure r t₁ ∩ extentClosure r t₂ :=
intentClosure_union _ _ _
#align extent_closure_union extentClosure_union
@[simp]
theorem intentClosure_iUnion (f : ι → Set α) :
intentClosure r (⋃ i, f i) = ⋂ i, intentClosure r (f i) :=
(gc_intentClosure_extentClosure r).l_iSup
#align intent_closure_Union intentClosure_iUnion
@[simp]
theorem extentClosure_iUnion (f : ι → Set β) :
extentClosure r (⋃ i, f i) = ⋂ i, extentClosure r (f i) :=
intentClosure_iUnion _ _
#align extent_closure_Union extentClosure_iUnion
theorem intentClosure_iUnion₂ (f : ∀ i, κ i → Set α) :
intentClosure r (⋃ (i) (j), f i j) = ⋂ (i) (j), intentClosure r (f i j) :=
(gc_intentClosure_extentClosure r).l_iSup₂
#align intent_closure_Union₂ intentClosure_iUnion₂
theorem extentClosure_iUnion₂ (f : ∀ i, κ i → Set β) :
extentClosure r (⋃ (i) (j), f i j) = ⋂ (i) (j), extentClosure r (f i j) :=
intentClosure_iUnion₂ _ _
#align extent_closure_Union₂ extentClosure_iUnion₂
theorem subset_extentClosure_intentClosure (s : Set α) :
s ⊆ extentClosure r (intentClosure r s) :=
(gc_intentClosure_extentClosure r).le_u_l _
#align subset_extent_closure_intent_closure subset_extentClosure_intentClosure
theorem subset_intentClosure_extentClosure (t : Set β) :
t ⊆ intentClosure r (extentClosure r t) :=
subset_extentClosure_intentClosure _ t
#align subset_intent_closure_extent_closure subset_intentClosure_extentClosure
@[simp]
theorem intentClosure_extentClosure_intentClosure (s : Set α) :
intentClosure r (extentClosure r <| intentClosure r s) = intentClosure r s :=
(gc_intentClosure_extentClosure r).l_u_l_eq_l _
#align intent_closure_extent_closure_intent_closure intentClosure_extentClosure_intentClosure
@[simp]
theorem extentClosure_intentClosure_extentClosure (t : Set β) :
extentClosure r (intentClosure r <| extentClosure r t) = extentClosure r t :=
intentClosure_extentClosure_intentClosure _ t
#align extent_closure_intent_closure_extent_closure extentClosure_intentClosure_extentClosure
theorem intentClosure_anti : Antitone (intentClosure r) :=
(gc_intentClosure_extentClosure r).monotone_l
#align intent_closure_anti intentClosure_anti
theorem extentClosure_anti : Antitone (extentClosure r) :=
intentClosure_anti _
#align extent_closure_anti extentClosure_anti
variable (α β)
structure Concept extends Set α × Set β where
closure_fst : intentClosure r fst = snd
closure_snd : extentClosure r snd = fst
#align concept Concept
initialize_simps_projections Concept (+toProd, -fst, -snd)
namespace Concept
variable {r α β} {c d : Concept α β r}
attribute [simp] closure_fst closure_snd
@[ext]
| Mathlib/Order/Concept.lean | 180 | 185 | theorem ext (h : c.fst = d.fst) : c = d := by |
obtain ⟨⟨s₁, t₁⟩, h₁, _⟩ := c
obtain ⟨⟨s₂, t₂⟩, h₂, _⟩ := d
dsimp at h₁ h₂ h
substs h h₁ h₂
rfl
| 5 | 148.413159 | 2 | 2 | 2 | 2,186 |
import Mathlib.Data.Set.Lattice
#align_import order.concept from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae"
open Function OrderDual Set
variable {ι : Sort*} {α β γ : Type*} {κ : ι → Sort*} (r : α → β → Prop) {s s₁ s₂ : Set α}
{t t₁ t₂ : Set β}
def intentClosure (s : Set α) : Set β :=
{ b | ∀ ⦃a⦄, a ∈ s → r a b }
#align intent_closure intentClosure
def extentClosure (t : Set β) : Set α :=
{ a | ∀ ⦃b⦄, b ∈ t → r a b }
#align extent_closure extentClosure
variable {r}
theorem subset_intentClosure_iff_subset_extentClosure :
t ⊆ intentClosure r s ↔ s ⊆ extentClosure r t :=
⟨fun h _ ha _ hb => h hb ha, fun h _ hb _ ha => h ha hb⟩
#align subset_intent_closure_iff_subset_extent_closure subset_intentClosure_iff_subset_extentClosure
variable (r)
theorem gc_intentClosure_extentClosure :
GaloisConnection (toDual ∘ intentClosure r) (extentClosure r ∘ ofDual) := fun _ _ =>
subset_intentClosure_iff_subset_extentClosure
#align gc_intent_closure_extent_closure gc_intentClosure_extentClosure
theorem intentClosure_swap (t : Set β) : intentClosure (swap r) t = extentClosure r t :=
rfl
#align intent_closure_swap intentClosure_swap
theorem extentClosure_swap (s : Set α) : extentClosure (swap r) s = intentClosure r s :=
rfl
#align extent_closure_swap extentClosure_swap
@[simp]
theorem intentClosure_empty : intentClosure r ∅ = univ :=
eq_univ_of_forall fun _ _ => False.elim
#align intent_closure_empty intentClosure_empty
@[simp]
theorem extentClosure_empty : extentClosure r ∅ = univ :=
intentClosure_empty _
#align extent_closure_empty extentClosure_empty
@[simp]
theorem intentClosure_union (s₁ s₂ : Set α) :
intentClosure r (s₁ ∪ s₂) = intentClosure r s₁ ∩ intentClosure r s₂ :=
Set.ext fun _ => forall₂_or_left
#align intent_closure_union intentClosure_union
@[simp]
theorem extentClosure_union (t₁ t₂ : Set β) :
extentClosure r (t₁ ∪ t₂) = extentClosure r t₁ ∩ extentClosure r t₂ :=
intentClosure_union _ _ _
#align extent_closure_union extentClosure_union
@[simp]
theorem intentClosure_iUnion (f : ι → Set α) :
intentClosure r (⋃ i, f i) = ⋂ i, intentClosure r (f i) :=
(gc_intentClosure_extentClosure r).l_iSup
#align intent_closure_Union intentClosure_iUnion
@[simp]
theorem extentClosure_iUnion (f : ι → Set β) :
extentClosure r (⋃ i, f i) = ⋂ i, extentClosure r (f i) :=
intentClosure_iUnion _ _
#align extent_closure_Union extentClosure_iUnion
theorem intentClosure_iUnion₂ (f : ∀ i, κ i → Set α) :
intentClosure r (⋃ (i) (j), f i j) = ⋂ (i) (j), intentClosure r (f i j) :=
(gc_intentClosure_extentClosure r).l_iSup₂
#align intent_closure_Union₂ intentClosure_iUnion₂
theorem extentClosure_iUnion₂ (f : ∀ i, κ i → Set β) :
extentClosure r (⋃ (i) (j), f i j) = ⋂ (i) (j), extentClosure r (f i j) :=
intentClosure_iUnion₂ _ _
#align extent_closure_Union₂ extentClosure_iUnion₂
theorem subset_extentClosure_intentClosure (s : Set α) :
s ⊆ extentClosure r (intentClosure r s) :=
(gc_intentClosure_extentClosure r).le_u_l _
#align subset_extent_closure_intent_closure subset_extentClosure_intentClosure
theorem subset_intentClosure_extentClosure (t : Set β) :
t ⊆ intentClosure r (extentClosure r t) :=
subset_extentClosure_intentClosure _ t
#align subset_intent_closure_extent_closure subset_intentClosure_extentClosure
@[simp]
theorem intentClosure_extentClosure_intentClosure (s : Set α) :
intentClosure r (extentClosure r <| intentClosure r s) = intentClosure r s :=
(gc_intentClosure_extentClosure r).l_u_l_eq_l _
#align intent_closure_extent_closure_intent_closure intentClosure_extentClosure_intentClosure
@[simp]
theorem extentClosure_intentClosure_extentClosure (t : Set β) :
extentClosure r (intentClosure r <| extentClosure r t) = extentClosure r t :=
intentClosure_extentClosure_intentClosure _ t
#align extent_closure_intent_closure_extent_closure extentClosure_intentClosure_extentClosure
theorem intentClosure_anti : Antitone (intentClosure r) :=
(gc_intentClosure_extentClosure r).monotone_l
#align intent_closure_anti intentClosure_anti
theorem extentClosure_anti : Antitone (extentClosure r) :=
intentClosure_anti _
#align extent_closure_anti extentClosure_anti
variable (α β)
structure Concept extends Set α × Set β where
closure_fst : intentClosure r fst = snd
closure_snd : extentClosure r snd = fst
#align concept Concept
initialize_simps_projections Concept (+toProd, -fst, -snd)
namespace Concept
variable {r α β} {c d : Concept α β r}
attribute [simp] closure_fst closure_snd
@[ext]
theorem ext (h : c.fst = d.fst) : c = d := by
obtain ⟨⟨s₁, t₁⟩, h₁, _⟩ := c
obtain ⟨⟨s₂, t₂⟩, h₂, _⟩ := d
dsimp at h₁ h₂ h
substs h h₁ h₂
rfl
#align concept.ext Concept.ext
| Mathlib/Order/Concept.lean | 188 | 193 | theorem ext' (h : c.snd = d.snd) : c = d := by |
obtain ⟨⟨s₁, t₁⟩, _, h₁⟩ := c
obtain ⟨⟨s₂, t₂⟩, _, h₂⟩ := d
dsimp at h₁ h₂ h
substs h h₁ h₂
rfl
| 5 | 148.413159 | 2 | 2 | 2 | 2,186 |
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.Valuation.ValuationRing
import Mathlib.RingTheory.Nakayama
#align_import ring_theory.discrete_valuation_ring.tfae from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable (R : Type*) [CommRing R] (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
open scoped DiscreteValuation
open LocalRing FiniteDimensional
| Mathlib/RingTheory/DiscreteValuationRing/TFAE.lean | 37 | 89 | theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
(h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
∃ n : ℕ, I = maximalIdeal R ^ n := by |
by_cases h : IsField R;
· exact ⟨0, by simp [letI := h.toField; (eq_bot_or_eq_top I).resolve_left hI]⟩
classical
obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
by_cases hI' : I = ⊤
· use 0; rw [pow_zero, hI', Ideal.one_eq_top]
have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
(SetLike.ext_iff.mp hx r).trans Ideal.mem_span_singleton
have : x ≠ 0 := by
rintro rfl
apply Ring.ne_bot_of_isMaximal_of_not_isField (maximalIdeal.isMaximal R) h
simp [hx]
have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r := by
intro r hr₁ hr₂
obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
have : ∀ b ∈ f, Associated x b := by
intro b hb
exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
clear hr₁ hr₂ hf₁
induction' f using Multiset.induction with fa fs fh
· exact (hf₂ rfl).elim
rcases eq_or_ne fs ∅ with (rfl | hf')
· use 1
rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
exact this _ (Multiset.mem_cons_self _ _)
· obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
use n + 1
rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
have : ∃ n : ℕ, x ^ n ∈ I := by
obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by
by_contra! h; apply hI; rw [eq_bot_iff]; exact h
obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximalIdeal hI' hr₁)
use n
rwa [← I.unit_mul_mem_iff_mem u.isUnit, mul_comm]
use Nat.find this
apply le_antisymm
· change ∀ s ∈ I, s ∈ _
by_contra! hI''
obtain ⟨s, hs₁, hs₂⟩ := hI''
apply hs₂
by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximalIdeal hI' hs₁)
rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.isUnit] at hs₁ ⊢
apply Ideal.pow_le_pow_right (Nat.find_min' this hs₁)
apply Ideal.pow_mem_pow
exact (H _).mpr (dvd_refl _)
· rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
exact Nat.find_spec this
| 50 | 5,184,705,528,587,073,000,000 | 2 | 2 | 2 | 2,187 |
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.Valuation.ValuationRing
import Mathlib.RingTheory.Nakayama
#align_import ring_theory.discrete_valuation_ring.tfae from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable (R : Type*) [CommRing R] (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
open scoped DiscreteValuation
open LocalRing FiniteDimensional
theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
(h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
∃ n : ℕ, I = maximalIdeal R ^ n := by
by_cases h : IsField R;
· exact ⟨0, by simp [letI := h.toField; (eq_bot_or_eq_top I).resolve_left hI]⟩
classical
obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
by_cases hI' : I = ⊤
· use 0; rw [pow_zero, hI', Ideal.one_eq_top]
have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
(SetLike.ext_iff.mp hx r).trans Ideal.mem_span_singleton
have : x ≠ 0 := by
rintro rfl
apply Ring.ne_bot_of_isMaximal_of_not_isField (maximalIdeal.isMaximal R) h
simp [hx]
have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r := by
intro r hr₁ hr₂
obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
have : ∀ b ∈ f, Associated x b := by
intro b hb
exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
clear hr₁ hr₂ hf₁
induction' f using Multiset.induction with fa fs fh
· exact (hf₂ rfl).elim
rcases eq_or_ne fs ∅ with (rfl | hf')
· use 1
rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
exact this _ (Multiset.mem_cons_self _ _)
· obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
use n + 1
rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
have : ∃ n : ℕ, x ^ n ∈ I := by
obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by
by_contra! h; apply hI; rw [eq_bot_iff]; exact h
obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximalIdeal hI' hr₁)
use n
rwa [← I.unit_mul_mem_iff_mem u.isUnit, mul_comm]
use Nat.find this
apply le_antisymm
· change ∀ s ∈ I, s ∈ _
by_contra! hI''
obtain ⟨s, hs₁, hs₂⟩ := hI''
apply hs₂
by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximalIdeal hI' hs₁)
rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.isUnit] at hs₁ ⊢
apply Ideal.pow_le_pow_right (Nat.find_min' this hs₁)
apply Ideal.pow_mem_pow
exact (H _).mpr (dvd_refl _)
· rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
exact Nat.find_spec this
#align exists_maximal_ideal_pow_eq_of_principal exists_maximalIdeal_pow_eq_of_principal
| Mathlib/RingTheory/DiscreteValuationRing/TFAE.lean | 92 | 150 | theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
[IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by |
classical
by_cases ne_bot : maximalIdeal R = ⊥
· rw [ne_bot]; infer_instance
obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximalIdeal R, a ≠ (0 : R) := by
by_contra! h'; apply ne_bot; rwa [eq_bot_iff]
have hle : Ideal.span {a} ≤ maximalIdeal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
have : (Ideal.span {a}).radical = maximalIdeal R := by
rw [Ideal.radical_eq_sInf]
apply le_antisymm
· exact sInf_le ⟨hle, inferInstance⟩
· refine
le_sInf fun I hI =>
(eq_maximalIdeal <| hI.2.isMaximal (fun e => ha₂ ?_)).ge
rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
have : ∃ n, maximalIdeal R ^ n ≤ Ideal.span {a} := by
rw [← this]; apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
cases' hn : Nat.find this with n
· have := Nat.find_spec this
rw [hn, pow_zero, Ideal.one_eq_top] at this
exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximalIdeal R ^ n, ¬b ∈ Ideal.span {a} := by
by_contra! h'; rw [Nat.find_eq_iff] at hn; exact hn.2 n n.lt_succ_self fun x hx => h' x hx
have hb₃ : ∀ m ∈ maximalIdeal R, ∃ k : R, k * a = b * m := by
intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
rw [hn, pow_succ]; exact Ideal.mul_mem_mul hb₁ hm
have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
let K := FractionRing R
let x : K := algebraMap R K b / algebraMap R K a
let M := Submodule.map (Algebra.linearMap R K) (maximalIdeal R)
have ha₃ : algebraMap R K a ≠ 0 := IsFractionRing.to_map_eq_zero_iff.not.mpr ha₂
by_cases hx : ∀ y ∈ M, x * y ∈ M
· have := isIntegral_of_smul_mem_submodule M ?_ ?_ x hx
· obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
refine (hb₂ (Ideal.mem_span_singleton'.mpr ⟨y, ?_⟩)).elim
apply IsFractionRing.injective R K
rw [map_mul, e, div_mul_cancel₀ _ ha₃]
· rw [Submodule.ne_bot_iff]; refine ⟨_, ⟨a, ha₁, rfl⟩, ?_⟩
exact (IsFractionRing.to_map_eq_zero_iff (K := K)).not.mpr ha₂
· apply Submodule.FG.map; exact IsNoetherian.noetherian _
· have :
(M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.linearMap R K) = ⊤ := by
by_contra h; apply hx
rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
obtain ⟨k, hk⟩ := hb₃ m hm
have hk' : x * algebraMap R K m = algebraMap R K k := by
rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel_right₀ _ ha₃]
exact ⟨k, le_maximalIdeal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximalIdeal R, b * y = a := by
rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this
obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy'
exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
refine ⟨⟨y, ?_⟩⟩
apply le_antisymm
· intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk
rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact Ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
· rwa [Submodule.span_le, Set.singleton_subset_iff]
| 57 | 5,685,719,999,335,932,000,000,000 | 2 | 2 | 2 | 2,187 |
import Mathlib.AlgebraicTopology.SimplicialObject
import Mathlib.CategoryTheory.Limits.Shapes.Products
#align_import algebraic_topology.split_simplicial_object from "leanprover-community/mathlib"@"dd1f8496baa505636a82748e6b652165ea888733"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits Opposite SimplexCategory
open Simplicial
universe u
variable {C : Type*} [Category C]
namespace SimplicialObject
namespace Splitting
def IndexSet (Δ : SimplexCategoryᵒᵖ) :=
ΣΔ' : SimplexCategoryᵒᵖ, { α : Δ.unop ⟶ Δ'.unop // Epi α }
#align simplicial_object.splitting.index_set SimplicialObject.Splitting.IndexSet
namespace IndexSet
@[simps]
def mk {Δ Δ' : SimplexCategory} (f : Δ ⟶ Δ') [Epi f] : IndexSet (op Δ) :=
⟨op Δ', f, inferInstance⟩
#align simplicial_object.splitting.index_set.mk SimplicialObject.Splitting.IndexSet.mk
variable {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ)
def e :=
A.2.1
#align simplicial_object.splitting.index_set.e SimplicialObject.Splitting.IndexSet.e
instance : Epi A.e :=
A.2.2
theorem ext' : A = ⟨A.1, ⟨A.e, A.2.2⟩⟩ := rfl
#align simplicial_object.splitting.index_set.ext' SimplicialObject.Splitting.IndexSet.ext'
| Mathlib/AlgebraicTopology/SplitSimplicialObject.lean | 77 | 84 | theorem ext (A₁ A₂ : IndexSet Δ) (h₁ : A₁.1 = A₂.1) (h₂ : A₁.e ≫ eqToHom (by rw [h₁]) = A₂.e) :
A₁ = A₂ := by |
rcases A₁ with ⟨Δ₁, ⟨α₁, hα₁⟩⟩
rcases A₂ with ⟨Δ₂, ⟨α₂, hα₂⟩⟩
simp only at h₁
subst h₁
simp only [eqToHom_refl, comp_id, IndexSet.e] at h₂
simp only [h₂]
| 6 | 403.428793 | 2 | 2 | 5 | 2,188 |
import Mathlib.AlgebraicTopology.SimplicialObject
import Mathlib.CategoryTheory.Limits.Shapes.Products
#align_import algebraic_topology.split_simplicial_object from "leanprover-community/mathlib"@"dd1f8496baa505636a82748e6b652165ea888733"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits Opposite SimplexCategory
open Simplicial
universe u
variable {C : Type*} [Category C]
namespace SimplicialObject
namespace Splitting
def IndexSet (Δ : SimplexCategoryᵒᵖ) :=
ΣΔ' : SimplexCategoryᵒᵖ, { α : Δ.unop ⟶ Δ'.unop // Epi α }
#align simplicial_object.splitting.index_set SimplicialObject.Splitting.IndexSet
namespace IndexSet
@[simps]
def mk {Δ Δ' : SimplexCategory} (f : Δ ⟶ Δ') [Epi f] : IndexSet (op Δ) :=
⟨op Δ', f, inferInstance⟩
#align simplicial_object.splitting.index_set.mk SimplicialObject.Splitting.IndexSet.mk
variable {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ)
def e :=
A.2.1
#align simplicial_object.splitting.index_set.e SimplicialObject.Splitting.IndexSet.e
instance : Epi A.e :=
A.2.2
theorem ext' : A = ⟨A.1, ⟨A.e, A.2.2⟩⟩ := rfl
#align simplicial_object.splitting.index_set.ext' SimplicialObject.Splitting.IndexSet.ext'
theorem ext (A₁ A₂ : IndexSet Δ) (h₁ : A₁.1 = A₂.1) (h₂ : A₁.e ≫ eqToHom (by rw [h₁]) = A₂.e) :
A₁ = A₂ := by
rcases A₁ with ⟨Δ₁, ⟨α₁, hα₁⟩⟩
rcases A₂ with ⟨Δ₂, ⟨α₂, hα₂⟩⟩
simp only at h₁
subst h₁
simp only [eqToHom_refl, comp_id, IndexSet.e] at h₂
simp only [h₂]
#align simplicial_object.splitting.index_set.ext SimplicialObject.Splitting.IndexSet.ext
instance : Fintype (IndexSet Δ) :=
Fintype.ofInjective
(fun A =>
⟨⟨A.1.unop.len, Nat.lt_succ_iff.mpr (len_le_of_epi (inferInstance : Epi A.e))⟩,
A.e.toOrderHom⟩ :
IndexSet Δ → Sigma fun k : Fin (Δ.unop.len + 1) => Fin (Δ.unop.len + 1) → Fin (k + 1))
(by
rintro ⟨Δ₁, α₁⟩ ⟨Δ₂, α₂⟩ h₁
induction' Δ₁ using Opposite.rec with Δ₁
induction' Δ₂ using Opposite.rec with Δ₂
simp only [unop_op, Sigma.mk.inj_iff, Fin.mk.injEq] at h₁
have h₂ : Δ₁ = Δ₂ := by
ext1
simpa only [Fin.mk_eq_mk] using h₁.1
subst h₂
refine ext _ _ rfl ?_
ext : 2
exact eq_of_heq h₁.2)
variable (Δ)
@[simps]
def id : IndexSet Δ :=
⟨Δ, ⟨𝟙 _, by infer_instance⟩⟩
#align simplicial_object.splitting.index_set.id SimplicialObject.Splitting.IndexSet.id
instance : Inhabited (IndexSet Δ) :=
⟨id Δ⟩
variable {Δ}
@[simp]
def EqId : Prop :=
A = id _
#align simplicial_object.splitting.index_set.eq_id SimplicialObject.Splitting.IndexSet.EqId
| Mathlib/AlgebraicTopology/SplitSimplicialObject.lean | 127 | 140 | theorem eqId_iff_eq : A.EqId ↔ A.1 = Δ := by |
constructor
· intro h
dsimp at h
rw [h]
rfl
· intro h
rcases A with ⟨_, ⟨f, hf⟩⟩
simp only at h
subst h
refine ext _ _ rfl ?_
haveI := hf
simp only [eqToHom_refl, comp_id]
exact eq_id_of_epi f
| 13 | 442,413.392009 | 2 | 2 | 5 | 2,188 |
import Mathlib.AlgebraicTopology.SimplicialObject
import Mathlib.CategoryTheory.Limits.Shapes.Products
#align_import algebraic_topology.split_simplicial_object from "leanprover-community/mathlib"@"dd1f8496baa505636a82748e6b652165ea888733"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits Opposite SimplexCategory
open Simplicial
universe u
variable {C : Type*} [Category C]
namespace SimplicialObject
namespace Splitting
def IndexSet (Δ : SimplexCategoryᵒᵖ) :=
ΣΔ' : SimplexCategoryᵒᵖ, { α : Δ.unop ⟶ Δ'.unop // Epi α }
#align simplicial_object.splitting.index_set SimplicialObject.Splitting.IndexSet
namespace IndexSet
@[simps]
def mk {Δ Δ' : SimplexCategory} (f : Δ ⟶ Δ') [Epi f] : IndexSet (op Δ) :=
⟨op Δ', f, inferInstance⟩
#align simplicial_object.splitting.index_set.mk SimplicialObject.Splitting.IndexSet.mk
variable {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ)
def e :=
A.2.1
#align simplicial_object.splitting.index_set.e SimplicialObject.Splitting.IndexSet.e
instance : Epi A.e :=
A.2.2
theorem ext' : A = ⟨A.1, ⟨A.e, A.2.2⟩⟩ := rfl
#align simplicial_object.splitting.index_set.ext' SimplicialObject.Splitting.IndexSet.ext'
theorem ext (A₁ A₂ : IndexSet Δ) (h₁ : A₁.1 = A₂.1) (h₂ : A₁.e ≫ eqToHom (by rw [h₁]) = A₂.e) :
A₁ = A₂ := by
rcases A₁ with ⟨Δ₁, ⟨α₁, hα₁⟩⟩
rcases A₂ with ⟨Δ₂, ⟨α₂, hα₂⟩⟩
simp only at h₁
subst h₁
simp only [eqToHom_refl, comp_id, IndexSet.e] at h₂
simp only [h₂]
#align simplicial_object.splitting.index_set.ext SimplicialObject.Splitting.IndexSet.ext
instance : Fintype (IndexSet Δ) :=
Fintype.ofInjective
(fun A =>
⟨⟨A.1.unop.len, Nat.lt_succ_iff.mpr (len_le_of_epi (inferInstance : Epi A.e))⟩,
A.e.toOrderHom⟩ :
IndexSet Δ → Sigma fun k : Fin (Δ.unop.len + 1) => Fin (Δ.unop.len + 1) → Fin (k + 1))
(by
rintro ⟨Δ₁, α₁⟩ ⟨Δ₂, α₂⟩ h₁
induction' Δ₁ using Opposite.rec with Δ₁
induction' Δ₂ using Opposite.rec with Δ₂
simp only [unop_op, Sigma.mk.inj_iff, Fin.mk.injEq] at h₁
have h₂ : Δ₁ = Δ₂ := by
ext1
simpa only [Fin.mk_eq_mk] using h₁.1
subst h₂
refine ext _ _ rfl ?_
ext : 2
exact eq_of_heq h₁.2)
variable (Δ)
@[simps]
def id : IndexSet Δ :=
⟨Δ, ⟨𝟙 _, by infer_instance⟩⟩
#align simplicial_object.splitting.index_set.id SimplicialObject.Splitting.IndexSet.id
instance : Inhabited (IndexSet Δ) :=
⟨id Δ⟩
variable {Δ}
@[simp]
def EqId : Prop :=
A = id _
#align simplicial_object.splitting.index_set.eq_id SimplicialObject.Splitting.IndexSet.EqId
theorem eqId_iff_eq : A.EqId ↔ A.1 = Δ := by
constructor
· intro h
dsimp at h
rw [h]
rfl
· intro h
rcases A with ⟨_, ⟨f, hf⟩⟩
simp only at h
subst h
refine ext _ _ rfl ?_
haveI := hf
simp only [eqToHom_refl, comp_id]
exact eq_id_of_epi f
#align simplicial_object.splitting.index_set.eq_id_iff_eq SimplicialObject.Splitting.IndexSet.eqId_iff_eq
| Mathlib/AlgebraicTopology/SplitSimplicialObject.lean | 143 | 151 | theorem eqId_iff_len_eq : A.EqId ↔ A.1.unop.len = Δ.unop.len := by |
rw [eqId_iff_eq]
constructor
· intro h
rw [h]
· intro h
rw [← unop_inj_iff]
ext
exact h
| 8 | 2,980.957987 | 2 | 2 | 5 | 2,188 |
import Mathlib.AlgebraicTopology.SimplicialObject
import Mathlib.CategoryTheory.Limits.Shapes.Products
#align_import algebraic_topology.split_simplicial_object from "leanprover-community/mathlib"@"dd1f8496baa505636a82748e6b652165ea888733"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits Opposite SimplexCategory
open Simplicial
universe u
variable {C : Type*} [Category C]
namespace SimplicialObject
namespace Splitting
def IndexSet (Δ : SimplexCategoryᵒᵖ) :=
ΣΔ' : SimplexCategoryᵒᵖ, { α : Δ.unop ⟶ Δ'.unop // Epi α }
#align simplicial_object.splitting.index_set SimplicialObject.Splitting.IndexSet
namespace IndexSet
@[simps]
def mk {Δ Δ' : SimplexCategory} (f : Δ ⟶ Δ') [Epi f] : IndexSet (op Δ) :=
⟨op Δ', f, inferInstance⟩
#align simplicial_object.splitting.index_set.mk SimplicialObject.Splitting.IndexSet.mk
variable {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ)
def e :=
A.2.1
#align simplicial_object.splitting.index_set.e SimplicialObject.Splitting.IndexSet.e
instance : Epi A.e :=
A.2.2
theorem ext' : A = ⟨A.1, ⟨A.e, A.2.2⟩⟩ := rfl
#align simplicial_object.splitting.index_set.ext' SimplicialObject.Splitting.IndexSet.ext'
theorem ext (A₁ A₂ : IndexSet Δ) (h₁ : A₁.1 = A₂.1) (h₂ : A₁.e ≫ eqToHom (by rw [h₁]) = A₂.e) :
A₁ = A₂ := by
rcases A₁ with ⟨Δ₁, ⟨α₁, hα₁⟩⟩
rcases A₂ with ⟨Δ₂, ⟨α₂, hα₂⟩⟩
simp only at h₁
subst h₁
simp only [eqToHom_refl, comp_id, IndexSet.e] at h₂
simp only [h₂]
#align simplicial_object.splitting.index_set.ext SimplicialObject.Splitting.IndexSet.ext
instance : Fintype (IndexSet Δ) :=
Fintype.ofInjective
(fun A =>
⟨⟨A.1.unop.len, Nat.lt_succ_iff.mpr (len_le_of_epi (inferInstance : Epi A.e))⟩,
A.e.toOrderHom⟩ :
IndexSet Δ → Sigma fun k : Fin (Δ.unop.len + 1) => Fin (Δ.unop.len + 1) → Fin (k + 1))
(by
rintro ⟨Δ₁, α₁⟩ ⟨Δ₂, α₂⟩ h₁
induction' Δ₁ using Opposite.rec with Δ₁
induction' Δ₂ using Opposite.rec with Δ₂
simp only [unop_op, Sigma.mk.inj_iff, Fin.mk.injEq] at h₁
have h₂ : Δ₁ = Δ₂ := by
ext1
simpa only [Fin.mk_eq_mk] using h₁.1
subst h₂
refine ext _ _ rfl ?_
ext : 2
exact eq_of_heq h₁.2)
variable (Δ)
@[simps]
def id : IndexSet Δ :=
⟨Δ, ⟨𝟙 _, by infer_instance⟩⟩
#align simplicial_object.splitting.index_set.id SimplicialObject.Splitting.IndexSet.id
instance : Inhabited (IndexSet Δ) :=
⟨id Δ⟩
variable {Δ}
@[simp]
def EqId : Prop :=
A = id _
#align simplicial_object.splitting.index_set.eq_id SimplicialObject.Splitting.IndexSet.EqId
theorem eqId_iff_eq : A.EqId ↔ A.1 = Δ := by
constructor
· intro h
dsimp at h
rw [h]
rfl
· intro h
rcases A with ⟨_, ⟨f, hf⟩⟩
simp only at h
subst h
refine ext _ _ rfl ?_
haveI := hf
simp only [eqToHom_refl, comp_id]
exact eq_id_of_epi f
#align simplicial_object.splitting.index_set.eq_id_iff_eq SimplicialObject.Splitting.IndexSet.eqId_iff_eq
theorem eqId_iff_len_eq : A.EqId ↔ A.1.unop.len = Δ.unop.len := by
rw [eqId_iff_eq]
constructor
· intro h
rw [h]
· intro h
rw [← unop_inj_iff]
ext
exact h
#align simplicial_object.splitting.index_set.eq_id_iff_len_eq SimplicialObject.Splitting.IndexSet.eqId_iff_len_eq
| Mathlib/AlgebraicTopology/SplitSimplicialObject.lean | 154 | 159 | theorem eqId_iff_len_le : A.EqId ↔ Δ.unop.len ≤ A.1.unop.len := by |
rw [eqId_iff_len_eq]
constructor
· intro h
rw [h]
· exact le_antisymm (len_le_of_epi (inferInstance : Epi A.e))
| 5 | 148.413159 | 2 | 2 | 5 | 2,188 |
import Mathlib.AlgebraicTopology.SimplicialObject
import Mathlib.CategoryTheory.Limits.Shapes.Products
#align_import algebraic_topology.split_simplicial_object from "leanprover-community/mathlib"@"dd1f8496baa505636a82748e6b652165ea888733"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits Opposite SimplexCategory
open Simplicial
universe u
variable {C : Type*} [Category C]
namespace SimplicialObject
namespace Splitting
def IndexSet (Δ : SimplexCategoryᵒᵖ) :=
ΣΔ' : SimplexCategoryᵒᵖ, { α : Δ.unop ⟶ Δ'.unop // Epi α }
#align simplicial_object.splitting.index_set SimplicialObject.Splitting.IndexSet
namespace IndexSet
@[simps]
def mk {Δ Δ' : SimplexCategory} (f : Δ ⟶ Δ') [Epi f] : IndexSet (op Δ) :=
⟨op Δ', f, inferInstance⟩
#align simplicial_object.splitting.index_set.mk SimplicialObject.Splitting.IndexSet.mk
variable {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ)
def e :=
A.2.1
#align simplicial_object.splitting.index_set.e SimplicialObject.Splitting.IndexSet.e
instance : Epi A.e :=
A.2.2
theorem ext' : A = ⟨A.1, ⟨A.e, A.2.2⟩⟩ := rfl
#align simplicial_object.splitting.index_set.ext' SimplicialObject.Splitting.IndexSet.ext'
theorem ext (A₁ A₂ : IndexSet Δ) (h₁ : A₁.1 = A₂.1) (h₂ : A₁.e ≫ eqToHom (by rw [h₁]) = A₂.e) :
A₁ = A₂ := by
rcases A₁ with ⟨Δ₁, ⟨α₁, hα₁⟩⟩
rcases A₂ with ⟨Δ₂, ⟨α₂, hα₂⟩⟩
simp only at h₁
subst h₁
simp only [eqToHom_refl, comp_id, IndexSet.e] at h₂
simp only [h₂]
#align simplicial_object.splitting.index_set.ext SimplicialObject.Splitting.IndexSet.ext
instance : Fintype (IndexSet Δ) :=
Fintype.ofInjective
(fun A =>
⟨⟨A.1.unop.len, Nat.lt_succ_iff.mpr (len_le_of_epi (inferInstance : Epi A.e))⟩,
A.e.toOrderHom⟩ :
IndexSet Δ → Sigma fun k : Fin (Δ.unop.len + 1) => Fin (Δ.unop.len + 1) → Fin (k + 1))
(by
rintro ⟨Δ₁, α₁⟩ ⟨Δ₂, α₂⟩ h₁
induction' Δ₁ using Opposite.rec with Δ₁
induction' Δ₂ using Opposite.rec with Δ₂
simp only [unop_op, Sigma.mk.inj_iff, Fin.mk.injEq] at h₁
have h₂ : Δ₁ = Δ₂ := by
ext1
simpa only [Fin.mk_eq_mk] using h₁.1
subst h₂
refine ext _ _ rfl ?_
ext : 2
exact eq_of_heq h₁.2)
variable (Δ)
@[simps]
def id : IndexSet Δ :=
⟨Δ, ⟨𝟙 _, by infer_instance⟩⟩
#align simplicial_object.splitting.index_set.id SimplicialObject.Splitting.IndexSet.id
instance : Inhabited (IndexSet Δ) :=
⟨id Δ⟩
variable {Δ}
@[simp]
def EqId : Prop :=
A = id _
#align simplicial_object.splitting.index_set.eq_id SimplicialObject.Splitting.IndexSet.EqId
theorem eqId_iff_eq : A.EqId ↔ A.1 = Δ := by
constructor
· intro h
dsimp at h
rw [h]
rfl
· intro h
rcases A with ⟨_, ⟨f, hf⟩⟩
simp only at h
subst h
refine ext _ _ rfl ?_
haveI := hf
simp only [eqToHom_refl, comp_id]
exact eq_id_of_epi f
#align simplicial_object.splitting.index_set.eq_id_iff_eq SimplicialObject.Splitting.IndexSet.eqId_iff_eq
theorem eqId_iff_len_eq : A.EqId ↔ A.1.unop.len = Δ.unop.len := by
rw [eqId_iff_eq]
constructor
· intro h
rw [h]
· intro h
rw [← unop_inj_iff]
ext
exact h
#align simplicial_object.splitting.index_set.eq_id_iff_len_eq SimplicialObject.Splitting.IndexSet.eqId_iff_len_eq
theorem eqId_iff_len_le : A.EqId ↔ Δ.unop.len ≤ A.1.unop.len := by
rw [eqId_iff_len_eq]
constructor
· intro h
rw [h]
· exact le_antisymm (len_le_of_epi (inferInstance : Epi A.e))
#align simplicial_object.splitting.index_set.eq_id_iff_len_le SimplicialObject.Splitting.IndexSet.eqId_iff_len_le
| Mathlib/AlgebraicTopology/SplitSimplicialObject.lean | 162 | 171 | theorem eqId_iff_mono : A.EqId ↔ Mono A.e := by |
constructor
· intro h
dsimp at h
subst h
dsimp only [id, e]
infer_instance
· intro h
rw [eqId_iff_len_le]
exact len_le_of_mono h
| 9 | 8,103.083928 | 2 | 2 | 5 | 2,188 |
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.JacobsonIdeal
#align_import ring_theory.jacobson from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
set_option autoImplicit true
universe u
namespace Ideal
open Polynomial
open Polynomial
section IsJacobson
variable {R S : Type*} [CommRing R] [CommRing S] {I : Ideal R}
class IsJacobson (R : Type*) [CommRing R] : Prop where
out' : ∀ I : Ideal R, I.IsRadical → I.jacobson = I
#align ideal.is_jacobson Ideal.IsJacobson
theorem isJacobson_iff {R} [CommRing R] :
IsJacobson R ↔ ∀ I : Ideal R, I.IsRadical → I.jacobson = I :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
#align ideal.is_jacobson_iff Ideal.isJacobson_iff
theorem IsJacobson.out {R} [CommRing R] :
IsJacobson R → ∀ {I : Ideal R}, I.IsRadical → I.jacobson = I :=
isJacobson_iff.1
#align ideal.is_jacobson.out Ideal.IsJacobson.out
| Mathlib/RingTheory/Jacobson.lean | 70 | 78 | theorem isJacobson_iff_prime_eq : IsJacobson R ↔ ∀ P : Ideal R, IsPrime P → P.jacobson = P := by |
refine isJacobson_iff.trans ⟨fun h I hI => h I hI.isRadical, ?_⟩
refine fun h I hI ↦ le_antisymm (fun x hx ↦ ?_) (fun x hx ↦ mem_sInf.mpr fun _ hJ ↦ hJ.left hx)
rw [← hI.radical, radical_eq_sInf I, mem_sInf]
intro P hP
rw [Set.mem_setOf_eq] at hP
erw [mem_sInf] at hx
erw [← h P hP.right, mem_sInf]
exact fun J hJ => hx ⟨le_trans hP.left hJ.left, hJ.right⟩
| 8 | 2,980.957987 | 2 | 2 | 4 | 2,189 |
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.JacobsonIdeal
#align_import ring_theory.jacobson from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
set_option autoImplicit true
universe u
namespace Ideal
open Polynomial
open Polynomial
section IsJacobson
variable {R S : Type*} [CommRing R] [CommRing S] {I : Ideal R}
class IsJacobson (R : Type*) [CommRing R] : Prop where
out' : ∀ I : Ideal R, I.IsRadical → I.jacobson = I
#align ideal.is_jacobson Ideal.IsJacobson
theorem isJacobson_iff {R} [CommRing R] :
IsJacobson R ↔ ∀ I : Ideal R, I.IsRadical → I.jacobson = I :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
#align ideal.is_jacobson_iff Ideal.isJacobson_iff
theorem IsJacobson.out {R} [CommRing R] :
IsJacobson R → ∀ {I : Ideal R}, I.IsRadical → I.jacobson = I :=
isJacobson_iff.1
#align ideal.is_jacobson.out Ideal.IsJacobson.out
theorem isJacobson_iff_prime_eq : IsJacobson R ↔ ∀ P : Ideal R, IsPrime P → P.jacobson = P := by
refine isJacobson_iff.trans ⟨fun h I hI => h I hI.isRadical, ?_⟩
refine fun h I hI ↦ le_antisymm (fun x hx ↦ ?_) (fun x hx ↦ mem_sInf.mpr fun _ hJ ↦ hJ.left hx)
rw [← hI.radical, radical_eq_sInf I, mem_sInf]
intro P hP
rw [Set.mem_setOf_eq] at hP
erw [mem_sInf] at hx
erw [← h P hP.right, mem_sInf]
exact fun J hJ => hx ⟨le_trans hP.left hJ.left, hJ.right⟩
#align ideal.is_jacobson_iff_prime_eq Ideal.isJacobson_iff_prime_eq
theorem isJacobson_iff_sInf_maximal : IsJacobson R ↔ ∀ {I : Ideal R}, I.IsPrime →
∃ M : Set (Ideal R), (∀ J ∈ M, IsMaximal J ∨ J = ⊤) ∧ I = sInf M :=
⟨fun H _I h => eq_jacobson_iff_sInf_maximal.1 (H.out h.isRadical), fun H =>
isJacobson_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal.2 (H hP)⟩
#align ideal.is_jacobson_iff_Inf_maximal Ideal.isJacobson_iff_sInf_maximal
theorem isJacobson_iff_sInf_maximal' : IsJacobson R ↔ ∀ {I : Ideal R}, I.IsPrime →
∃ M : Set (Ideal R), (∀ J ∈ M, ∀ (K : Ideal R), J < K → K = ⊤) ∧ I = sInf M :=
⟨fun H _I h => eq_jacobson_iff_sInf_maximal'.1 (H.out h.isRadical), fun H =>
isJacobson_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal'.2 (H hP)⟩
#align ideal.is_jacobson_iff_Inf_maximal' Ideal.isJacobson_iff_sInf_maximal'
theorem radical_eq_jacobson [H : IsJacobson R] (I : Ideal R) : I.radical = I.jacobson :=
le_antisymm (le_sInf fun _J ⟨hJ, hJ_max⟩ => (IsPrime.radical_le_iff hJ_max.isPrime).mpr hJ)
(H.out (radical_isRadical I) ▸ jacobson_mono le_radical)
#align ideal.radical_eq_jacobson Ideal.radical_eq_jacobson
instance (priority := 100) isJacobson_field {K : Type*} [Field K] : IsJacobson K :=
⟨fun I _ => Or.recOn (eq_bot_or_top I)
(fun h => le_antisymm (sInf_le ⟨le_rfl, h.symm ▸ bot_isMaximal⟩) (h.symm ▸ bot_le)) fun h =>
by rw [h, jacobson_eq_top_iff]⟩
#align ideal.is_jacobson_field Ideal.isJacobson_field
| Mathlib/RingTheory/Jacobson.lean | 108 | 117 | theorem isJacobson_of_surjective [H : IsJacobson R] :
(∃ f : R →+* S, Function.Surjective ↑f) → IsJacobson S := by |
rintro ⟨f, hf⟩
rw [isJacobson_iff_sInf_maximal]
intro p hp
use map f '' { J : Ideal R | comap f p ≤ J ∧ J.IsMaximal }
use fun j ⟨J, hJ, hmap⟩ => hmap ▸ (map_eq_top_or_isMaximal_of_surjective f hf hJ.right).symm
have : p = map f (comap f p).jacobson :=
(IsJacobson.out' _ <| hp.isRadical.comap f).symm ▸ (map_comap_of_surjective f hf p).symm
exact this.trans (map_sInf hf fun J ⟨hJ, _⟩ => le_trans (Ideal.ker_le_comap f) hJ)
| 8 | 2,980.957987 | 2 | 2 | 4 | 2,189 |
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.JacobsonIdeal
#align_import ring_theory.jacobson from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
set_option autoImplicit true
universe u
namespace Ideal
open Polynomial
open Polynomial
section IsJacobson
variable {R S : Type*} [CommRing R] [CommRing S] {I : Ideal R}
class IsJacobson (R : Type*) [CommRing R] : Prop where
out' : ∀ I : Ideal R, I.IsRadical → I.jacobson = I
#align ideal.is_jacobson Ideal.IsJacobson
theorem isJacobson_iff {R} [CommRing R] :
IsJacobson R ↔ ∀ I : Ideal R, I.IsRadical → I.jacobson = I :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
#align ideal.is_jacobson_iff Ideal.isJacobson_iff
theorem IsJacobson.out {R} [CommRing R] :
IsJacobson R → ∀ {I : Ideal R}, I.IsRadical → I.jacobson = I :=
isJacobson_iff.1
#align ideal.is_jacobson.out Ideal.IsJacobson.out
theorem isJacobson_iff_prime_eq : IsJacobson R ↔ ∀ P : Ideal R, IsPrime P → P.jacobson = P := by
refine isJacobson_iff.trans ⟨fun h I hI => h I hI.isRadical, ?_⟩
refine fun h I hI ↦ le_antisymm (fun x hx ↦ ?_) (fun x hx ↦ mem_sInf.mpr fun _ hJ ↦ hJ.left hx)
rw [← hI.radical, radical_eq_sInf I, mem_sInf]
intro P hP
rw [Set.mem_setOf_eq] at hP
erw [mem_sInf] at hx
erw [← h P hP.right, mem_sInf]
exact fun J hJ => hx ⟨le_trans hP.left hJ.left, hJ.right⟩
#align ideal.is_jacobson_iff_prime_eq Ideal.isJacobson_iff_prime_eq
theorem isJacobson_iff_sInf_maximal : IsJacobson R ↔ ∀ {I : Ideal R}, I.IsPrime →
∃ M : Set (Ideal R), (∀ J ∈ M, IsMaximal J ∨ J = ⊤) ∧ I = sInf M :=
⟨fun H _I h => eq_jacobson_iff_sInf_maximal.1 (H.out h.isRadical), fun H =>
isJacobson_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal.2 (H hP)⟩
#align ideal.is_jacobson_iff_Inf_maximal Ideal.isJacobson_iff_sInf_maximal
theorem isJacobson_iff_sInf_maximal' : IsJacobson R ↔ ∀ {I : Ideal R}, I.IsPrime →
∃ M : Set (Ideal R), (∀ J ∈ M, ∀ (K : Ideal R), J < K → K = ⊤) ∧ I = sInf M :=
⟨fun H _I h => eq_jacobson_iff_sInf_maximal'.1 (H.out h.isRadical), fun H =>
isJacobson_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal'.2 (H hP)⟩
#align ideal.is_jacobson_iff_Inf_maximal' Ideal.isJacobson_iff_sInf_maximal'
theorem radical_eq_jacobson [H : IsJacobson R] (I : Ideal R) : I.radical = I.jacobson :=
le_antisymm (le_sInf fun _J ⟨hJ, hJ_max⟩ => (IsPrime.radical_le_iff hJ_max.isPrime).mpr hJ)
(H.out (radical_isRadical I) ▸ jacobson_mono le_radical)
#align ideal.radical_eq_jacobson Ideal.radical_eq_jacobson
instance (priority := 100) isJacobson_field {K : Type*} [Field K] : IsJacobson K :=
⟨fun I _ => Or.recOn (eq_bot_or_top I)
(fun h => le_antisymm (sInf_le ⟨le_rfl, h.symm ▸ bot_isMaximal⟩) (h.symm ▸ bot_le)) fun h =>
by rw [h, jacobson_eq_top_iff]⟩
#align ideal.is_jacobson_field Ideal.isJacobson_field
theorem isJacobson_of_surjective [H : IsJacobson R] :
(∃ f : R →+* S, Function.Surjective ↑f) → IsJacobson S := by
rintro ⟨f, hf⟩
rw [isJacobson_iff_sInf_maximal]
intro p hp
use map f '' { J : Ideal R | comap f p ≤ J ∧ J.IsMaximal }
use fun j ⟨J, hJ, hmap⟩ => hmap ▸ (map_eq_top_or_isMaximal_of_surjective f hf hJ.right).symm
have : p = map f (comap f p).jacobson :=
(IsJacobson.out' _ <| hp.isRadical.comap f).symm ▸ (map_comap_of_surjective f hf p).symm
exact this.trans (map_sInf hf fun J ⟨hJ, _⟩ => le_trans (Ideal.ker_le_comap f) hJ)
#align ideal.is_jacobson_of_surjective Ideal.isJacobson_of_surjective
instance (priority := 100) isJacobson_quotient [IsJacobson R] : IsJacobson (R ⧸ I) :=
isJacobson_of_surjective ⟨Quotient.mk I, by
rintro ⟨x⟩
use x
rfl⟩
#align ideal.is_jacobson_quotient Ideal.isJacobson_quotient
theorem isJacobson_iso (e : R ≃+* S) : IsJacobson R ↔ IsJacobson S :=
⟨fun h => @isJacobson_of_surjective _ _ _ _ h ⟨(e : R →+* S), e.surjective⟩, fun h =>
@isJacobson_of_surjective _ _ _ _ h ⟨(e.symm : S →+* R), e.symm.surjective⟩⟩
#align ideal.is_jacobson_iso Ideal.isJacobson_iso
| Mathlib/RingTheory/Jacobson.lean | 132 | 148 | theorem isJacobson_of_isIntegral [Algebra R S] [Algebra.IsIntegral R S] (hR : IsJacobson R) :
IsJacobson S := by |
rw [isJacobson_iff_prime_eq]
intro P hP
by_cases hP_top : comap (algebraMap R S) P = ⊤
· simp [comap_eq_top_iff.1 hP_top]
· haveI : Nontrivial (R ⧸ comap (algebraMap R S) P) := Quotient.nontrivial hP_top
rw [jacobson_eq_iff_jacobson_quotient_eq_bot]
refine eq_bot_of_comap_eq_bot (R := R ⧸ comap (algebraMap R S) P) ?_
rw [eq_bot_iff, ← jacobson_eq_iff_jacobson_quotient_eq_bot.1
((isJacobson_iff_prime_eq.1 hR) (comap (algebraMap R S) P) (comap_isPrime _ _)),
comap_jacobson]
refine sInf_le_sInf fun J hJ => ?_
simp only [true_and_iff, Set.mem_image, bot_le, Set.mem_setOf_eq]
have : J.IsMaximal := by simpa using hJ
exact exists_ideal_over_maximal_of_isIntegral J
(comap_bot_le_of_injective _ algebraMap_quotient_injective)
| 15 | 3,269,017.372472 | 2 | 2 | 4 | 2,189 |
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.JacobsonIdeal
#align_import ring_theory.jacobson from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
set_option autoImplicit true
universe u
namespace Ideal
open Polynomial
open Polynomial
namespace Polynomial
open Polynomial
section CommRing
-- Porting note: move to better place
-- Porting note: make `S` and `T` universe polymorphic
lemma Subring.mem_closure_image_of {S T : Type*} [CommRing S] [CommRing T] (g : S →+* T)
(u : Set S) (x : S) (hx : x ∈ Subring.closure u) : g x ∈ Subring.closure (g '' u) := by
rw [Subring.mem_closure] at hx ⊢
intro T₁ h₁
rw [← Subring.mem_comap]
apply hx
simp only [Subring.coe_comap, ← Set.image_subset_iff, SetLike.mem_coe]
exact h₁
-- Porting note: move to better place
lemma mem_closure_X_union_C {R : Type*} [Ring R] (p : R[X]) :
p ∈ Subring.closure (insert X {f | f.degree ≤ 0} : Set R[X]) := by
refine Polynomial.induction_on p ?_ ?_ ?_
· intro r
apply Subring.subset_closure
apply Set.mem_insert_of_mem
exact degree_C_le
· intros p1 p2 h1 h2
exact Subring.add_mem _ h1 h2
· intros n r hr
rw [pow_succ, ← mul_assoc]
apply Subring.mul_mem _ hr
apply Subring.subset_closure
apply Set.mem_insert
variable {R S : Type*} [CommRing R] [CommRing S] [IsDomain S]
variable {Rₘ Sₘ : Type*} [CommRing Rₘ] [CommRing Sₘ]
| Mathlib/RingTheory/Jacobson.lean | 303 | 355 | theorem isIntegral_isLocalization_polynomial_quotient
(P : Ideal R[X]) (pX : R[X]) (hpX : pX ∈ P) [Algebra (R ⧸ P.comap (C : R →+* R[X])) Rₘ]
[IsLocalization.Away (pX.map (Quotient.mk (P.comap (C : R →+* R[X])))).leadingCoeff Rₘ]
[Algebra (R[X] ⧸ P) Sₘ] [IsLocalization ((Submonoid.powers (pX.map (Quotient.mk (P.comap
(C : R →+* R[X])))).leadingCoeff).map (quotientMap P C le_rfl) : Submonoid (R[X] ⧸ P)) Sₘ] :
(IsLocalization.map Sₘ (quotientMap P C le_rfl) (Submonoid.powers (pX.map (Quotient.mk (P.comap
(C : R →+* R[X])))).leadingCoeff).le_comap_map : Rₘ →+* Sₘ).IsIntegral := by |
let P' : Ideal R := P.comap C
let M : Submonoid (R ⧸ P') :=
Submonoid.powers (pX.map (Quotient.mk (P.comap (C : R →+* R[X])))).leadingCoeff
let M' : Submonoid (R[X] ⧸ P) :=
(Submonoid.powers (pX.map (Quotient.mk (P.comap (C : R →+* R[X])))).leadingCoeff).map
(quotientMap P C le_rfl)
let φ : R ⧸ P' →+* R[X] ⧸ P := quotientMap P C le_rfl
let φ' : Rₘ →+* Sₘ := IsLocalization.map Sₘ φ M.le_comap_map
have hφ' : φ.comp (Quotient.mk P') = (Quotient.mk P).comp C := rfl
intro p
obtain ⟨⟨p', ⟨q, hq⟩⟩, hp⟩ := IsLocalization.surj M' p
suffices φ'.IsIntegralElem (algebraMap (R[X] ⧸ P) Sₘ p') by
obtain ⟨q', hq', rfl⟩ := hq
obtain ⟨q'', hq''⟩ := isUnit_iff_exists_inv'.1 (IsLocalization.map_units Rₘ (⟨q', hq'⟩ : M))
refine (hp.symm ▸ this).of_mul_unit φ' p (algebraMap (R[X] ⧸ P) Sₘ (φ q')) q'' ?_
rw [← φ'.map_one, ← congr_arg φ' hq'', φ'.map_mul, ← φ'.comp_apply]
simp only [IsLocalization.map_comp _]
rw [RingHom.comp_apply]
dsimp at hp
refine @IsIntegral.of_mem_closure'' Rₘ _ Sₘ _ φ'
((algebraMap (R[X] ⧸ P) Sₘ).comp (Quotient.mk P) '' insert X { p | p.degree ≤ 0 }) ?_
((algebraMap (R[X] ⧸ P) Sₘ) p') ?_
· rintro x ⟨p, hp, rfl⟩
simp only [Set.mem_insert_iff] at hp
cases' hp with hy hy
· rw [hy]
refine φ.isIntegralElem_localization_at_leadingCoeff ((Quotient.mk P) X)
(pX.map (Quotient.mk P')) ?_ M ?_
· rwa [eval₂_map, hφ', ← hom_eval₂, Quotient.eq_zero_iff_mem, eval₂_C_X]
· use 1
simp only [pow_one]
· rw [Set.mem_setOf_eq, degree_le_zero_iff] at hy
-- Porting note: was `refine' hy.symm ▸`
-- `⟨X - C (algebraMap _ _ ((Quotient.mk P') (p.coeff 0))), monic_X_sub_C _, _⟩`
rw [hy]
use X - C (algebraMap (R ⧸ P') Rₘ ((Quotient.mk P') (p.coeff 0)))
constructor
· apply monic_X_sub_C
· simp only [eval₂_sub, eval₂_X, eval₂_C]
rw [sub_eq_zero, ← φ'.comp_apply]
simp only [IsLocalization.map_comp _]
rfl
· obtain ⟨p, rfl⟩ := Quotient.mk_surjective p'
rw [← RingHom.comp_apply]
apply Subring.mem_closure_image_of
apply Polynomial.mem_closure_X_union_C
| 46 | 94,961,194,206,024,480,000 | 2 | 2 | 4 | 2,189 |
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.ContinuousFunction.CocompactMap
open Filter Metric
variable {𝕜 E F 𝓕 : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [ProperSpace E] [ProperSpace F]
variable {f : 𝓕}
| Mathlib/Analysis/Normed/Group/CocompactMap.lean | 29 | 39 | theorem CocompactMapClass.norm_le [FunLike 𝓕 E F] [CocompactMapClass 𝓕 E F] (ε : ℝ) :
∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖ := by |
have h := cocompact_tendsto f
rw [tendsto_def] at h
specialize h (Metric.closedBall 0 ε)ᶜ (mem_cocompact_of_closedBall_compl_subset 0 ⟨ε, rfl.subset⟩)
rcases closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩
use r
intro x hx
suffices x ∈ f⁻¹' (Metric.closedBall 0 ε)ᶜ by aesop
apply hr
simp [hx]
| 9 | 8,103.083928 | 2 | 2 | 2 | 2,190 |
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.ContinuousFunction.CocompactMap
open Filter Metric
variable {𝕜 E F 𝓕 : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [ProperSpace E] [ProperSpace F]
variable {f : 𝓕}
theorem CocompactMapClass.norm_le [FunLike 𝓕 E F] [CocompactMapClass 𝓕 E F] (ε : ℝ) :
∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖ := by
have h := cocompact_tendsto f
rw [tendsto_def] at h
specialize h (Metric.closedBall 0 ε)ᶜ (mem_cocompact_of_closedBall_compl_subset 0 ⟨ε, rfl.subset⟩)
rcases closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩
use r
intro x hx
suffices x ∈ f⁻¹' (Metric.closedBall 0 ε)ᶜ by aesop
apply hr
simp [hx]
| Mathlib/Analysis/Normed/Group/CocompactMap.lean | 41 | 53 | theorem Filter.tendsto_cocompact_cocompact_of_norm {f : E → F}
(h : ∀ ε : ℝ, ∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖) :
Tendsto f (cocompact E) (cocompact F) := by |
rw [tendsto_def]
intro s hs
rcases closedBall_compl_subset_of_mem_cocompact hs 0 with ⟨ε, hε⟩
rcases h ε with ⟨r, hr⟩
apply mem_cocompact_of_closedBall_compl_subset 0
use r
intro x hx
simp only [Set.mem_compl_iff, Metric.mem_closedBall, dist_zero_right, not_le] at hx
apply hε
simp [hr x hx]
| 10 | 22,026.465795 | 2 | 2 | 2 | 2,190 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
#align_import analysis.special_functions.sqrt from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set
open scoped Topology
namespace Real
noncomputable def sqPartialHomeomorph : PartialHomeomorph ℝ ℝ where
toFun x := x ^ 2
invFun := (√·)
source := Ioi 0
target := Ioi 0
map_source' _ h := mem_Ioi.2 (pow_pos (mem_Ioi.1 h) _)
map_target' _ h := mem_Ioi.2 (sqrt_pos.2 h)
left_inv' _ h := sqrt_sq (le_of_lt h)
right_inv' _ h := sq_sqrt (le_of_lt h)
open_source := isOpen_Ioi
open_target := isOpen_Ioi
continuousOn_toFun := (continuous_pow 2).continuousOn
continuousOn_invFun := continuousOn_id.sqrt
#align real.sq_local_homeomorph Real.sqPartialHomeomorph
| Mathlib/Analysis/SpecialFunctions/Sqrt.lean | 46 | 58 | theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
HasStrictDerivAt (√·) (1 / (2 * √x)) x ∧ ∀ n, ContDiffAt ℝ n (√·) x := by |
cases' hx.lt_or_lt with hx hx
· rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
have : (√·) =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
exact
⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
contDiffAt_const.congr_of_eventuallyEq this⟩
· have : ↑2 * √x ^ (2 - 1) ≠ 0 := by simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ]
constructor
· simpa using sqPartialHomeomorph.hasStrictDerivAt_symm hx this (hasStrictDerivAt_pow 2 _)
· exact fun n => sqPartialHomeomorph.contDiffAt_symm_deriv this hx (hasDerivAt_pow 2 (√x))
(contDiffAt_id.pow 2)
| 11 | 59,874.141715 | 2 | 2 | 1 | 2,191 |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.Order.Field.Defs
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.Algebra.Order.Group.MinMax
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Data.Finset.Preimage
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.Order.Interval.Set.OrderIso
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.Filter.Bases
#align_import order.filter.at_top_bot from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
set_option autoImplicit true
variable {ι ι' α β γ : Type*}
open Set
namespace Filter
def atTop [Preorder α] : Filter α :=
⨅ a, 𝓟 (Ici a)
#align filter.at_top Filter.atTop
def atBot [Preorder α] : Filter α :=
⨅ a, 𝓟 (Iic a)
#align filter.at_bot Filter.atBot
theorem mem_atTop [Preorder α] (a : α) : { b : α | a ≤ b } ∈ @atTop α _ :=
mem_iInf_of_mem a <| Subset.refl _
#align filter.mem_at_top Filter.mem_atTop
theorem Ici_mem_atTop [Preorder α] (a : α) : Ici a ∈ (atTop : Filter α) :=
mem_atTop a
#align filter.Ici_mem_at_top Filter.Ici_mem_atTop
theorem Ioi_mem_atTop [Preorder α] [NoMaxOrder α] (x : α) : Ioi x ∈ (atTop : Filter α) :=
let ⟨z, hz⟩ := exists_gt x
mem_of_superset (mem_atTop z) fun _ h => lt_of_lt_of_le hz h
#align filter.Ioi_mem_at_top Filter.Ioi_mem_atTop
theorem mem_atBot [Preorder α] (a : α) : { b : α | b ≤ a } ∈ @atBot α _ :=
mem_iInf_of_mem a <| Subset.refl _
#align filter.mem_at_bot Filter.mem_atBot
theorem Iic_mem_atBot [Preorder α] (a : α) : Iic a ∈ (atBot : Filter α) :=
mem_atBot a
#align filter.Iic_mem_at_bot Filter.Iic_mem_atBot
theorem Iio_mem_atBot [Preorder α] [NoMinOrder α] (x : α) : Iio x ∈ (atBot : Filter α) :=
let ⟨z, hz⟩ := exists_lt x
mem_of_superset (mem_atBot z) fun _ h => lt_of_le_of_lt h hz
#align filter.Iio_mem_at_bot Filter.Iio_mem_atBot
theorem disjoint_atBot_principal_Ioi [Preorder α] (x : α) : Disjoint atBot (𝓟 (Ioi x)) :=
disjoint_of_disjoint_of_mem (Iic_disjoint_Ioi le_rfl) (Iic_mem_atBot x) (mem_principal_self _)
#align filter.disjoint_at_bot_principal_Ioi Filter.disjoint_atBot_principal_Ioi
theorem disjoint_atTop_principal_Iio [Preorder α] (x : α) : Disjoint atTop (𝓟 (Iio x)) :=
@disjoint_atBot_principal_Ioi αᵒᵈ _ _
#align filter.disjoint_at_top_principal_Iio Filter.disjoint_atTop_principal_Iio
theorem disjoint_atTop_principal_Iic [Preorder α] [NoMaxOrder α] (x : α) :
Disjoint atTop (𝓟 (Iic x)) :=
disjoint_of_disjoint_of_mem (Iic_disjoint_Ioi le_rfl).symm (Ioi_mem_atTop x)
(mem_principal_self _)
#align filter.disjoint_at_top_principal_Iic Filter.disjoint_atTop_principal_Iic
theorem disjoint_atBot_principal_Ici [Preorder α] [NoMinOrder α] (x : α) :
Disjoint atBot (𝓟 (Ici x)) :=
@disjoint_atTop_principal_Iic αᵒᵈ _ _ _
#align filter.disjoint_at_bot_principal_Ici Filter.disjoint_atBot_principal_Ici
theorem disjoint_pure_atTop [Preorder α] [NoMaxOrder α] (x : α) : Disjoint (pure x) atTop :=
Disjoint.symm <| (disjoint_atTop_principal_Iic x).mono_right <| le_principal_iff.2 <|
mem_pure.2 right_mem_Iic
#align filter.disjoint_pure_at_top Filter.disjoint_pure_atTop
theorem disjoint_pure_atBot [Preorder α] [NoMinOrder α] (x : α) : Disjoint (pure x) atBot :=
@disjoint_pure_atTop αᵒᵈ _ _ _
#align filter.disjoint_pure_at_bot Filter.disjoint_pure_atBot
theorem not_tendsto_const_atTop [Preorder α] [NoMaxOrder α] (x : α) (l : Filter β) [l.NeBot] :
¬Tendsto (fun _ => x) l atTop :=
tendsto_const_pure.not_tendsto (disjoint_pure_atTop x)
#align filter.not_tendsto_const_at_top Filter.not_tendsto_const_atTop
theorem not_tendsto_const_atBot [Preorder α] [NoMinOrder α] (x : α) (l : Filter β) [l.NeBot] :
¬Tendsto (fun _ => x) l atBot :=
tendsto_const_pure.not_tendsto (disjoint_pure_atBot x)
#align filter.not_tendsto_const_at_bot Filter.not_tendsto_const_atBot
| Mathlib/Order/Filter/AtTopBot.lean | 118 | 125 | theorem disjoint_atBot_atTop [PartialOrder α] [Nontrivial α] :
Disjoint (atBot : Filter α) atTop := by |
rcases exists_pair_ne α with ⟨x, y, hne⟩
by_cases hle : x ≤ y
· refine disjoint_of_disjoint_of_mem ?_ (Iic_mem_atBot x) (Ici_mem_atTop y)
exact Iic_disjoint_Ici.2 (hle.lt_of_ne hne).not_le
· refine disjoint_of_disjoint_of_mem ?_ (Iic_mem_atBot y) (Ici_mem_atTop x)
exact Iic_disjoint_Ici.2 hle
| 6 | 403.428793 | 2 | 2 | 1 | 2,192 |
import Mathlib.Combinatorics.Hall.Finite
import Mathlib.CategoryTheory.CofilteredSystem
import Mathlib.Data.Rel
#align_import combinatorics.hall.basic from "leanprover-community/mathlib"@"8195826f5c428fc283510bc67303dd4472d78498"
open Finset CategoryTheory
universe u v
def hallMatchingsOn {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) :=
{ f : ι' → α | Function.Injective f ∧ ∀ x, f x ∈ t x }
#align hall_matchings_on hallMatchingsOn
def hallMatchingsOn.restrict {ι : Type u} {α : Type v} (t : ι → Finset α) {ι' ι'' : Finset ι}
(h : ι' ⊆ ι'') (f : hallMatchingsOn t ι'') : hallMatchingsOn t ι' := by
refine ⟨fun i => f.val ⟨i, h i.property⟩, ?_⟩
cases' f.property with hinj hc
refine ⟨?_, fun i => hc ⟨i, h i.property⟩⟩
rintro ⟨i, hi⟩ ⟨j, hj⟩ hh
simpa only [Subtype.mk_eq_mk] using hinj hh
#align hall_matchings_on.restrict hallMatchingsOn.restrict
| Mathlib/Combinatorics/Hall/Basic.lean | 77 | 86 | theorem hallMatchingsOn.nonempty {ι : Type u} {α : Type v} [DecidableEq α] (t : ι → Finset α)
(h : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (ι' : Finset ι) :
Nonempty (hallMatchingsOn t ι') := by |
classical
refine ⟨Classical.indefiniteDescription _ ?_⟩
apply (all_card_le_biUnion_card_iff_existsInjective' fun i : ι' => t i).mp
intro s'
convert h (s'.image (↑)) using 1
· simp only [card_image_of_injective s' Subtype.coe_injective]
· rw [image_biUnion]
| 7 | 1,096.633158 | 2 | 2 | 2 | 2,193 |
import Mathlib.Combinatorics.Hall.Finite
import Mathlib.CategoryTheory.CofilteredSystem
import Mathlib.Data.Rel
#align_import combinatorics.hall.basic from "leanprover-community/mathlib"@"8195826f5c428fc283510bc67303dd4472d78498"
open Finset CategoryTheory
universe u v
def hallMatchingsOn {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) :=
{ f : ι' → α | Function.Injective f ∧ ∀ x, f x ∈ t x }
#align hall_matchings_on hallMatchingsOn
def hallMatchingsOn.restrict {ι : Type u} {α : Type v} (t : ι → Finset α) {ι' ι'' : Finset ι}
(h : ι' ⊆ ι'') (f : hallMatchingsOn t ι'') : hallMatchingsOn t ι' := by
refine ⟨fun i => f.val ⟨i, h i.property⟩, ?_⟩
cases' f.property with hinj hc
refine ⟨?_, fun i => hc ⟨i, h i.property⟩⟩
rintro ⟨i, hi⟩ ⟨j, hj⟩ hh
simpa only [Subtype.mk_eq_mk] using hinj hh
#align hall_matchings_on.restrict hallMatchingsOn.restrict
theorem hallMatchingsOn.nonempty {ι : Type u} {α : Type v} [DecidableEq α] (t : ι → Finset α)
(h : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (ι' : Finset ι) :
Nonempty (hallMatchingsOn t ι') := by
classical
refine ⟨Classical.indefiniteDescription _ ?_⟩
apply (all_card_le_biUnion_card_iff_existsInjective' fun i : ι' => t i).mp
intro s'
convert h (s'.image (↑)) using 1
· simp only [card_image_of_injective s' Subtype.coe_injective]
· rw [image_biUnion]
#align hall_matchings_on.nonempty hallMatchingsOn.nonempty
def hallMatchingsFunctor {ι : Type u} {α : Type v} (t : ι → Finset α) :
(Finset ι)ᵒᵖ ⥤ Type max u v where
obj ι' := hallMatchingsOn t ι'.unop
map {ι' ι''} g f := hallMatchingsOn.restrict t (CategoryTheory.leOfHom g.unop) f
#align hall_matchings_functor hallMatchingsFunctor
instance hallMatchingsOn.finite {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) :
Finite (hallMatchingsOn t ι') := by
classical
rw [hallMatchingsOn]
let g : hallMatchingsOn t ι' → ι' → ι'.biUnion t := by
rintro f i
refine ⟨f.val i, ?_⟩
rw [mem_biUnion]
exact ⟨i, i.property, f.property.2 i⟩
apply Finite.of_injective g
intro f f' h
ext a
rw [Function.funext_iff] at h
simpa [g] using h a
#align hall_matchings_on.finite hallMatchingsOn.finite
| Mathlib/Combinatorics/Hall/Basic.lean | 123 | 163 | theorem Finset.all_card_le_biUnion_card_iff_exists_injective {ι : Type u} {α : Type v}
[DecidableEq α] (t : ι → Finset α) :
(∀ s : Finset ι, s.card ≤ (s.biUnion t).card) ↔
∃ f : ι → α, Function.Injective f ∧ ∀ x, f x ∈ t x := by |
constructor
· intro h
-- Set up the functor
haveI : ∀ ι' : (Finset ι)ᵒᵖ, Nonempty ((hallMatchingsFunctor t).obj ι') := fun ι' =>
hallMatchingsOn.nonempty t h ι'.unop
classical
haveI : ∀ ι' : (Finset ι)ᵒᵖ, Finite ((hallMatchingsFunctor t).obj ι') := by
intro ι'
rw [hallMatchingsFunctor]
infer_instance
-- Apply the compactness argument
obtain ⟨u, hu⟩ := nonempty_sections_of_finite_inverse_system (hallMatchingsFunctor t)
-- Interpret the resulting section of the inverse limit
refine ⟨?_, ?_, ?_⟩
·-- Build the matching function from the section
exact fun i =>
(u (Opposite.op ({i} : Finset ι))).val ⟨i, by simp only [Opposite.unop_op, mem_singleton]⟩
· -- Show that it is injective
intro i i'
have subi : ({i} : Finset ι) ⊆ {i, i'} := by simp
have subi' : ({i'} : Finset ι) ⊆ {i, i'} := by simp
rw [← Finset.le_iff_subset] at subi subi'
simp only
rw [← hu (CategoryTheory.homOfLE subi).op, ← hu (CategoryTheory.homOfLE subi').op]
let uii' := u (Opposite.op ({i, i'} : Finset ι))
exact fun h => Subtype.mk_eq_mk.mp (uii'.property.1 h)
· -- Show that it maps each index to the corresponding finite set
intro i
apply (u (Opposite.op ({i} : Finset ι))).property.2
· -- The reverse direction is a straightforward cardinality argument
rintro ⟨f, hf₁, hf₂⟩ s
rw [← Finset.card_image_of_injective s hf₁]
apply Finset.card_le_card
intro
rw [Finset.mem_image, Finset.mem_biUnion]
rintro ⟨x, hx, rfl⟩
exact ⟨x, hx, hf₂ x⟩
| 37 | 11,719,142,372,802,612 | 2 | 2 | 2 | 2,193 |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.Multilinear.Basic
#align_import linear_algebra.multilinear.basis from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
open MultilinearMap
variable {R : Type*} {ι : Type*} {n : ℕ} {M : Fin n → Type*} {M₂ : Type*} {M₃ : Type*}
variable [CommSemiring R] [AddCommMonoid M₂] [AddCommMonoid M₃] [∀ i, AddCommMonoid (M i)]
variable [∀ i, Module R (M i)] [Module R M₂] [Module R M₃]
| Mathlib/LinearAlgebra/Multilinear/Basis.lean | 32 | 49 | theorem Basis.ext_multilinear_fin {f g : MultilinearMap R M M₂} {ι₁ : Fin n → Type*}
(e : ∀ i, Basis (ι₁ i) R (M i))
(h : ∀ v : ∀ i, ι₁ i, (f fun i => e i (v i)) = g fun i => e i (v i)) : f = g := by |
induction' n with m hm
· ext x
convert h finZeroElim
· apply Function.LeftInverse.injective uncurry_curryLeft
refine Basis.ext (e 0) ?_
intro i
apply hm (Fin.tail e)
intro j
convert h (Fin.cons i j)
iterate 2
rw [curryLeft_apply]
congr 1 with x
refine Fin.cases rfl (fun x => ?_) x
dsimp [Fin.tail]
rw [Fin.cons_succ, Fin.cons_succ]
| 15 | 3,269,017.372472 | 2 | 2 | 2 | 2,194 |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.Multilinear.Basic
#align_import linear_algebra.multilinear.basis from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
open MultilinearMap
variable {R : Type*} {ι : Type*} {n : ℕ} {M : Fin n → Type*} {M₂ : Type*} {M₃ : Type*}
variable [CommSemiring R] [AddCommMonoid M₂] [AddCommMonoid M₃] [∀ i, AddCommMonoid (M i)]
variable [∀ i, Module R (M i)] [Module R M₂] [Module R M₃]
theorem Basis.ext_multilinear_fin {f g : MultilinearMap R M M₂} {ι₁ : Fin n → Type*}
(e : ∀ i, Basis (ι₁ i) R (M i))
(h : ∀ v : ∀ i, ι₁ i, (f fun i => e i (v i)) = g fun i => e i (v i)) : f = g := by
induction' n with m hm
· ext x
convert h finZeroElim
· apply Function.LeftInverse.injective uncurry_curryLeft
refine Basis.ext (e 0) ?_
intro i
apply hm (Fin.tail e)
intro j
convert h (Fin.cons i j)
iterate 2
rw [curryLeft_apply]
congr 1 with x
refine Fin.cases rfl (fun x => ?_) x
dsimp [Fin.tail]
rw [Fin.cons_succ, Fin.cons_succ]
#align basis.ext_multilinear_fin Basis.ext_multilinear_fin
| Mathlib/LinearAlgebra/Multilinear/Basis.lean | 56 | 61 | theorem Basis.ext_multilinear [Finite ι] {f g : MultilinearMap R (fun _ : ι => M₂) M₃} {ι₁ : Type*}
(e : Basis ι₁ R M₂) (h : ∀ v : ι → ι₁, (f fun i => e (v i)) = g fun i => e (v i)) : f = g := by |
cases nonempty_fintype ι
exact
(domDomCongr_eq_iff (Fintype.equivFin ι) f g).mp
(Basis.ext_multilinear_fin (fun _ => e) fun i => h (i ∘ _))
| 4 | 54.59815 | 2 | 2 | 2 | 2,194 |
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.Algebra.Ring.NegOnePow
namespace Matrix
variable {R : Type*} [CommRing R]
| Mathlib/LinearAlgebra/Matrix/Determinant/Misc.lean | 21 | 47 | theorem submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det {n : ℕ}
(M : Matrix (Fin (n + 1)) (Fin n) R) (hv : ∑ j, M j = 0) (j₁ j₂ : Fin (n + 1)) :
(M.submatrix (Fin.succAbove j₁) id).det =
Int.negOnePow (j₁ - j₂) • (M.submatrix (Fin.succAbove j₂) id).det := by |
suffices ∀ j, (M.submatrix (Fin.succAbove j) id).det =
Int.negOnePow j • (M.submatrix (Fin.succAbove 0) id).det by
rw [this j₁, this j₂, smul_smul, ← Int.negOnePow_add, sub_add_cancel]
intro j
induction j using Fin.induction with
| zero => rw [Fin.val_zero, Nat.cast_zero, Int.negOnePow_zero, one_smul]
| succ i h_ind =>
rw [Fin.val_succ, Nat.cast_add, Nat.cast_one, Int.negOnePow_succ, Units.neg_smul,
← neg_eq_iff_eq_neg, ← neg_one_smul R,
← det_updateRow_sum (M.submatrix i.succ.succAbove id) i (fun _ ↦ -1),
← Fin.coe_castSucc i, ← h_ind]
congr
ext a b
simp_rw [neg_one_smul, updateRow_apply, Finset.sum_neg_distrib, Pi.neg_apply,
Finset.sum_apply, submatrix_apply, id_eq]
split_ifs with h
· replace hv := congr_fun hv b
rw [Fin.sum_univ_succAbove _ i.succ, Pi.add_apply, Finset.sum_apply] at hv
rwa [h, Fin.succAbove_castSucc_self, neg_eq_iff_add_eq_zero, add_comm]
· obtain h|h := ne_iff_lt_or_gt.mp h
· rw [Fin.succAbove_castSucc_of_lt _ _ h,
Fin.succAbove_of_succ_le _ _ (Fin.succ_lt_succ_iff.mpr h).le]
· rw [Fin.succAbove_succ_of_lt _ _ h, Fin.succAbove_castSucc_of_le _ _ h.le]
| 23 | 9,744,803,446.248903 | 2 | 2 | 2 | 2,195 |
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.Algebra.Ring.NegOnePow
namespace Matrix
variable {R : Type*} [CommRing R]
theorem submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det {n : ℕ}
(M : Matrix (Fin (n + 1)) (Fin n) R) (hv : ∑ j, M j = 0) (j₁ j₂ : Fin (n + 1)) :
(M.submatrix (Fin.succAbove j₁) id).det =
Int.negOnePow (j₁ - j₂) • (M.submatrix (Fin.succAbove j₂) id).det := by
suffices ∀ j, (M.submatrix (Fin.succAbove j) id).det =
Int.negOnePow j • (M.submatrix (Fin.succAbove 0) id).det by
rw [this j₁, this j₂, smul_smul, ← Int.negOnePow_add, sub_add_cancel]
intro j
induction j using Fin.induction with
| zero => rw [Fin.val_zero, Nat.cast_zero, Int.negOnePow_zero, one_smul]
| succ i h_ind =>
rw [Fin.val_succ, Nat.cast_add, Nat.cast_one, Int.negOnePow_succ, Units.neg_smul,
← neg_eq_iff_eq_neg, ← neg_one_smul R,
← det_updateRow_sum (M.submatrix i.succ.succAbove id) i (fun _ ↦ -1),
← Fin.coe_castSucc i, ← h_ind]
congr
ext a b
simp_rw [neg_one_smul, updateRow_apply, Finset.sum_neg_distrib, Pi.neg_apply,
Finset.sum_apply, submatrix_apply, id_eq]
split_ifs with h
· replace hv := congr_fun hv b
rw [Fin.sum_univ_succAbove _ i.succ, Pi.add_apply, Finset.sum_apply] at hv
rwa [h, Fin.succAbove_castSucc_self, neg_eq_iff_add_eq_zero, add_comm]
· obtain h|h := ne_iff_lt_or_gt.mp h
· rw [Fin.succAbove_castSucc_of_lt _ _ h,
Fin.succAbove_of_succ_le _ _ (Fin.succ_lt_succ_iff.mpr h).le]
· rw [Fin.succAbove_succ_of_lt _ _ h, Fin.succAbove_castSucc_of_le _ _ h.le]
| Mathlib/LinearAlgebra/Matrix/Determinant/Misc.lean | 51 | 59 | theorem submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det' {n : ℕ}
(M : Matrix (Fin n) (Fin (n + 1)) R) (hv : ∀ i, ∑ j, M i j = 0) (j₁ j₂ : Fin (n + 1)) :
(M.submatrix id (Fin.succAbove j₁)).det =
Int.negOnePow (j₁ - j₂) • (M.submatrix id (Fin.succAbove j₂)).det := by |
rw [← det_transpose, transpose_submatrix,
submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det M.transpose ?_ j₁ j₂,
← det_transpose, transpose_submatrix, transpose_transpose]
ext
simp_rw [Finset.sum_apply, transpose_apply, hv, Pi.zero_apply]
| 5 | 148.413159 | 2 | 2 | 2 | 2,195 |
import Mathlib.Algebra.Module.Torsion
import Mathlib.RingTheory.DedekindDomain.Ideal
#align_import algebra.module.dedekind_domain from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8"
universe u v
variable {R : Type u} [CommRing R] [IsDomain R] {M : Type v} [AddCommGroup M] [Module R M]
open scoped DirectSum
namespace Submodule
variable [IsDedekindDomain R]
open UniqueFactorizationMonoid
open scoped Classical
| Mathlib/Algebra/Module/DedekindDomain.lean | 37 | 59 | theorem isInternal_prime_power_torsion_of_is_torsion_by_ideal {I : Ideal R} (hI : I ≠ ⊥)
(hM : Module.IsTorsionBySet R M I) :
DirectSum.IsInternal fun p : (factors I).toFinset =>
torsionBySet R M (p ^ (factors I).count ↑p : Ideal R) := by |
let P := factors I
have prime_of_mem := fun p (hp : p ∈ P.toFinset) =>
prime_of_factor p (Multiset.mem_toFinset.mp hp)
apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _
· convert hM
rw [← Finset.inf_eq_iInf, IsDedekindDomain.inf_prime_pow_eq_prod, ← Finset.prod_multiset_count,
← associated_iff_eq]
· exact factors_prod hI
· exact prime_of_mem
· exact fun _ _ _ _ ij => ij
· intro p hp q hq pq; dsimp
rw [irreducible_pow_sup]
· suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]
rw [Multiset.count_eq_zero,
normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,
Multiset.mem_replicate]
exact fun H => pq <| H.2.trans <| normalize_eq q
· rw [← Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero
· exact (prime_of_mem p hp).irreducible
| 19 | 178,482,300.963187 | 2 | 2 | 2 | 2,196 |
import Mathlib.Algebra.Module.Torsion
import Mathlib.RingTheory.DedekindDomain.Ideal
#align_import algebra.module.dedekind_domain from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8"
universe u v
variable {R : Type u} [CommRing R] [IsDomain R] {M : Type v} [AddCommGroup M] [Module R M]
open scoped DirectSum
namespace Submodule
variable [IsDedekindDomain R]
open UniqueFactorizationMonoid
open scoped Classical
theorem isInternal_prime_power_torsion_of_is_torsion_by_ideal {I : Ideal R} (hI : I ≠ ⊥)
(hM : Module.IsTorsionBySet R M I) :
DirectSum.IsInternal fun p : (factors I).toFinset =>
torsionBySet R M (p ^ (factors I).count ↑p : Ideal R) := by
let P := factors I
have prime_of_mem := fun p (hp : p ∈ P.toFinset) =>
prime_of_factor p (Multiset.mem_toFinset.mp hp)
apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _
· convert hM
rw [← Finset.inf_eq_iInf, IsDedekindDomain.inf_prime_pow_eq_prod, ← Finset.prod_multiset_count,
← associated_iff_eq]
· exact factors_prod hI
· exact prime_of_mem
· exact fun _ _ _ _ ij => ij
· intro p hp q hq pq; dsimp
rw [irreducible_pow_sup]
· suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]
rw [Multiset.count_eq_zero,
normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,
Multiset.mem_replicate]
exact fun H => pq <| H.2.trans <| normalize_eq q
· rw [← Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero
· exact (prime_of_mem p hp).irreducible
#align submodule.is_internal_prime_power_torsion_of_is_torsion_by_ideal Submodule.isInternal_prime_power_torsion_of_is_torsion_by_ideal
| Mathlib/Algebra/Module/DedekindDomain.lean | 65 | 72 | theorem isInternal_prime_power_torsion [Module.Finite R M] (hM : Module.IsTorsion R M) :
DirectSum.IsInternal fun p : (factors (⊤ : Submodule R M).annihilator).toFinset =>
torsionBySet R M (p ^ (factors (⊤ : Submodule R M).annihilator).count ↑p : Ideal R) := by |
have hM' := Module.isTorsionBySet_annihilator_top R M
have hI := Submodule.annihilator_top_inter_nonZeroDivisors hM
refine isInternal_prime_power_torsion_of_is_torsion_by_ideal ?_ hM'
rw [← Set.nonempty_iff_ne_empty] at hI; rw [Submodule.ne_bot_iff]
obtain ⟨x, H, hx⟩ := hI; exact ⟨x, H, nonZeroDivisors.ne_zero hx⟩
| 5 | 148.413159 | 2 | 2 | 2 | 2,196 |
import Mathlib.Data.Real.Basic
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Algebra.Order.EuclideanAbsoluteValue
#align_import number_theory.class_number.admissible_absolute_value from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
local infixl:50 " ≺ " => EuclideanDomain.r
namespace AbsoluteValue
variable {R : Type*} [EuclideanDomain R]
variable (abv : AbsoluteValue R ℤ)
structure IsAdmissible extends IsEuclidean abv where
protected card : ℝ → ℕ
exists_partition' :
∀ (n : ℕ) {ε : ℝ} (_ : 0 < ε) {b : R} (_ : b ≠ 0) (A : Fin n → R),
∃ t : Fin n → Fin (card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε
#align absolute_value.is_admissible AbsoluteValue.IsAdmissible
-- Porting note: no docstrings for IsAdmissible
attribute [nolint docBlame] IsAdmissible.card
namespace IsAdmissible
variable {abv}
| Mathlib/NumberTheory/ClassNumber/AdmissibleAbsoluteValue.lean | 61 | 68 | theorem exists_partition {ι : Type*} [Finite ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0)
(A : ι → R) (h : abv.IsAdmissible) : ∃ t : ι → Fin (h.card ε),
∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε := by |
rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩
obtain ⟨t, ht⟩ := h.exists_partition' n hε hb (A ∘ e.symm)
refine ⟨t ∘ e, fun i₀ i₁ h ↦ ?_⟩
convert (config := {transparency := .default})
ht (e i₀) (e i₁) h <;> simp only [e.symm_apply_apply]
| 5 | 148.413159 | 2 | 2 | 3 | 2,197 |
import Mathlib.Data.Real.Basic
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Algebra.Order.EuclideanAbsoluteValue
#align_import number_theory.class_number.admissible_absolute_value from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
local infixl:50 " ≺ " => EuclideanDomain.r
namespace AbsoluteValue
variable {R : Type*} [EuclideanDomain R]
variable (abv : AbsoluteValue R ℤ)
structure IsAdmissible extends IsEuclidean abv where
protected card : ℝ → ℕ
exists_partition' :
∀ (n : ℕ) {ε : ℝ} (_ : 0 < ε) {b : R} (_ : b ≠ 0) (A : Fin n → R),
∃ t : Fin n → Fin (card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε
#align absolute_value.is_admissible AbsoluteValue.IsAdmissible
-- Porting note: no docstrings for IsAdmissible
attribute [nolint docBlame] IsAdmissible.card
namespace IsAdmissible
variable {abv}
theorem exists_partition {ι : Type*} [Finite ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0)
(A : ι → R) (h : abv.IsAdmissible) : ∃ t : ι → Fin (h.card ε),
∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε := by
rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩
obtain ⟨t, ht⟩ := h.exists_partition' n hε hb (A ∘ e.symm)
refine ⟨t ∘ e, fun i₀ i₁ h ↦ ?_⟩
convert (config := {transparency := .default})
ht (e i₀) (e i₁) h <;> simp only [e.symm_apply_apply]
#align absolute_value.is_admissible.exists_partition AbsoluteValue.IsAdmissible.exists_partition
| Mathlib/NumberTheory/ClassNumber/AdmissibleAbsoluteValue.lean | 73 | 112 | theorem exists_approx_aux (n : ℕ) (h : abv.IsAdmissible) :
∀ {ε : ℝ} (_hε : 0 < ε) {b : R} (_hb : b ≠ 0) (A : Fin (h.card ε ^ n).succ → Fin n → R),
∃ i₀ i₁, i₀ ≠ i₁ ∧ ∀ k, (abv (A i₁ k % b - A i₀ k % b) : ℝ) < abv b • ε := by |
haveI := Classical.decEq R
induction' n with n ih
· intro ε _hε b _hb A
refine ⟨0, 1, ?_, ?_⟩
· simp
rintro ⟨i, ⟨⟩⟩
intro ε hε b hb A
let M := h.card ε
-- By the "nicer" pigeonhole principle, we can find a collection `s`
-- of more than `M^n` remainders where the first components lie close together:
obtain ⟨s, s_inj, hs⟩ :
∃ s : Fin (M ^ n).succ → Fin (M ^ n.succ).succ,
Function.Injective s ∧ ∀ i₀ i₁, (abv (A (s i₁) 0 % b - A (s i₀) 0 % b) : ℝ) < abv b • ε := by
-- We can partition the `A`s into `M` subsets where
-- the first components lie close together:
obtain ⟨t, ht⟩ :
∃ t : Fin (M ^ n.succ).succ → Fin M,
∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ 0 % b - A i₀ 0 % b) : ℝ) < abv b • ε :=
h.exists_partition hε hb fun x ↦ A x 0
-- Since the `M` subsets contain more than `M * M^n` elements total,
-- there must be a subset that contains more than `M^n` elements.
obtain ⟨s, hs⟩ :=
Fintype.exists_lt_card_fiber_of_mul_lt_card (f := t)
(by simpa only [Fintype.card_fin, pow_succ'] using Nat.lt_succ_self (M ^ n.succ))
refine ⟨fun i ↦ (Finset.univ.filter fun x ↦ t x = s).toList.get <| i.castLE ?_, fun i j h ↦ ?_,
fun i₀ i₁ ↦ ht _ _ ?_⟩
· rwa [Finset.length_toList]
· simpa [(Finset.nodup_toList _).get_inj_iff] using h
· have : ∀ i, t ((Finset.univ.filter fun x ↦ t x = s).toList.get i) = s := fun i ↦
(Finset.mem_filter.mp (Finset.mem_toList.mp (List.get_mem _ i i.2))).2
simp [this]
-- Since `s` is large enough, there are two elements of `A ∘ s`
-- where the second components lie close together.
obtain ⟨k₀, k₁, hk, h⟩ := ih hε hb fun x ↦ Fin.tail (A (s x))
refine ⟨s k₀, s k₁, fun h ↦ hk (s_inj h), fun i ↦ Fin.cases ?_ (fun i ↦ ?_) i⟩
· exact hs k₀ k₁
· exact h i
| 37 | 11,719,142,372,802,612 | 2 | 2 | 3 | 2,197 |
import Mathlib.Data.Real.Basic
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Algebra.Order.EuclideanAbsoluteValue
#align_import number_theory.class_number.admissible_absolute_value from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
local infixl:50 " ≺ " => EuclideanDomain.r
namespace AbsoluteValue
variable {R : Type*} [EuclideanDomain R]
variable (abv : AbsoluteValue R ℤ)
structure IsAdmissible extends IsEuclidean abv where
protected card : ℝ → ℕ
exists_partition' :
∀ (n : ℕ) {ε : ℝ} (_ : 0 < ε) {b : R} (_ : b ≠ 0) (A : Fin n → R),
∃ t : Fin n → Fin (card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε
#align absolute_value.is_admissible AbsoluteValue.IsAdmissible
-- Porting note: no docstrings for IsAdmissible
attribute [nolint docBlame] IsAdmissible.card
namespace IsAdmissible
variable {abv}
theorem exists_partition {ι : Type*} [Finite ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0)
(A : ι → R) (h : abv.IsAdmissible) : ∃ t : ι → Fin (h.card ε),
∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε := by
rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩
obtain ⟨t, ht⟩ := h.exists_partition' n hε hb (A ∘ e.symm)
refine ⟨t ∘ e, fun i₀ i₁ h ↦ ?_⟩
convert (config := {transparency := .default})
ht (e i₀) (e i₁) h <;> simp only [e.symm_apply_apply]
#align absolute_value.is_admissible.exists_partition AbsoluteValue.IsAdmissible.exists_partition
theorem exists_approx_aux (n : ℕ) (h : abv.IsAdmissible) :
∀ {ε : ℝ} (_hε : 0 < ε) {b : R} (_hb : b ≠ 0) (A : Fin (h.card ε ^ n).succ → Fin n → R),
∃ i₀ i₁, i₀ ≠ i₁ ∧ ∀ k, (abv (A i₁ k % b - A i₀ k % b) : ℝ) < abv b • ε := by
haveI := Classical.decEq R
induction' n with n ih
· intro ε _hε b _hb A
refine ⟨0, 1, ?_, ?_⟩
· simp
rintro ⟨i, ⟨⟩⟩
intro ε hε b hb A
let M := h.card ε
-- By the "nicer" pigeonhole principle, we can find a collection `s`
-- of more than `M^n` remainders where the first components lie close together:
obtain ⟨s, s_inj, hs⟩ :
∃ s : Fin (M ^ n).succ → Fin (M ^ n.succ).succ,
Function.Injective s ∧ ∀ i₀ i₁, (abv (A (s i₁) 0 % b - A (s i₀) 0 % b) : ℝ) < abv b • ε := by
-- We can partition the `A`s into `M` subsets where
-- the first components lie close together:
obtain ⟨t, ht⟩ :
∃ t : Fin (M ^ n.succ).succ → Fin M,
∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ 0 % b - A i₀ 0 % b) : ℝ) < abv b • ε :=
h.exists_partition hε hb fun x ↦ A x 0
-- Since the `M` subsets contain more than `M * M^n` elements total,
-- there must be a subset that contains more than `M^n` elements.
obtain ⟨s, hs⟩ :=
Fintype.exists_lt_card_fiber_of_mul_lt_card (f := t)
(by simpa only [Fintype.card_fin, pow_succ'] using Nat.lt_succ_self (M ^ n.succ))
refine ⟨fun i ↦ (Finset.univ.filter fun x ↦ t x = s).toList.get <| i.castLE ?_, fun i j h ↦ ?_,
fun i₀ i₁ ↦ ht _ _ ?_⟩
· rwa [Finset.length_toList]
· simpa [(Finset.nodup_toList _).get_inj_iff] using h
· have : ∀ i, t ((Finset.univ.filter fun x ↦ t x = s).toList.get i) = s := fun i ↦
(Finset.mem_filter.mp (Finset.mem_toList.mp (List.get_mem _ i i.2))).2
simp [this]
-- Since `s` is large enough, there are two elements of `A ∘ s`
-- where the second components lie close together.
obtain ⟨k₀, k₁, hk, h⟩ := ih hε hb fun x ↦ Fin.tail (A (s x))
refine ⟨s k₀, s k₁, fun h ↦ hk (s_inj h), fun i ↦ Fin.cases ?_ (fun i ↦ ?_) i⟩
· exact hs k₀ k₁
· exact h i
#align absolute_value.is_admissible.exists_approx_aux AbsoluteValue.IsAdmissible.exists_approx_aux
| Mathlib/NumberTheory/ClassNumber/AdmissibleAbsoluteValue.lean | 117 | 123 | theorem exists_approx {ι : Type*} [Fintype ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0)
(h : abv.IsAdmissible) (A : Fin (h.card ε ^ Fintype.card ι).succ → ι → R) :
∃ i₀ i₁, i₀ ≠ i₁ ∧ ∀ k, (abv (A i₁ k % b - A i₀ k % b) : ℝ) < abv b • ε := by |
let e := Fintype.equivFin ι
obtain ⟨i₀, i₁, ne, h⟩ := h.exists_approx_aux (Fintype.card ι) hε hb fun x y ↦ A x (e.symm y)
refine ⟨i₀, i₁, ne, fun k ↦ ?_⟩
convert h (e k) <;> simp only [e.symm_apply_apply]
| 4 | 54.59815 | 2 | 2 | 3 | 2,197 |
import Mathlib.Topology.MetricSpace.PseudoMetric
import Mathlib.Topology.UniformSpace.Equicontinuity
#align_import topology.metric_space.equicontinuity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Topology Uniformity
variable {α β ι : Type*} [PseudoMetricSpace α]
namespace Metric
theorem equicontinuousAt_iff_right {ι : Type*} [TopologicalSpace β] {F : ι → β → α} {x₀ : β} :
EquicontinuousAt F x₀ ↔ ∀ ε > 0, ∀ᶠ x in 𝓝 x₀, ∀ i, dist (F i x₀) (F i x) < ε :=
uniformity_basis_dist.equicontinuousAt_iff_right
#align metric.equicontinuous_at_iff_right Metric.equicontinuousAt_iff_right
theorem equicontinuousAt_iff {ι : Type*} [PseudoMetricSpace β] {F : ι → β → α} {x₀ : β} :
EquicontinuousAt F x₀ ↔ ∀ ε > 0, ∃ δ > 0, ∀ x, dist x x₀ < δ → ∀ i, dist (F i x₀) (F i x) < ε :=
nhds_basis_ball.equicontinuousAt_iff uniformity_basis_dist
#align metric.equicontinuous_at_iff Metric.equicontinuousAt_iff
protected theorem equicontinuousAt_iff_pair {ι : Type*} [TopologicalSpace β] {F : ι → β → α}
{x₀ : β} :
EquicontinuousAt F x₀ ↔
∀ ε > 0, ∃ U ∈ 𝓝 x₀, ∀ x ∈ U, ∀ x' ∈ U, ∀ i, dist (F i x) (F i x') < ε := by
rw [equicontinuousAt_iff_pair]
constructor <;> intro H
· intro ε hε
exact H _ (dist_mem_uniformity hε)
· intro U hU
rcases mem_uniformity_dist.mp hU with ⟨ε, hε, hεU⟩
refine Exists.imp (fun V => And.imp_right fun h => ?_) (H _ hε)
exact fun x hx x' hx' i => hεU (h _ hx _ hx' i)
#align metric.equicontinuous_at_iff_pair Metric.equicontinuousAt_iff_pair
theorem uniformEquicontinuous_iff_right {ι : Type*} [UniformSpace β] {F : ι → β → α} :
UniformEquicontinuous F ↔ ∀ ε > 0, ∀ᶠ xy : β × β in 𝓤 β, ∀ i, dist (F i xy.1) (F i xy.2) < ε :=
uniformity_basis_dist.uniformEquicontinuous_iff_right
#align metric.uniform_equicontinuous_iff_right Metric.uniformEquicontinuous_iff_right
theorem uniformEquicontinuous_iff {ι : Type*} [PseudoMetricSpace β] {F : ι → β → α} :
UniformEquicontinuous F ↔
∀ ε > 0, ∃ δ > 0, ∀ x y, dist x y < δ → ∀ i, dist (F i x) (F i y) < ε :=
uniformity_basis_dist.uniformEquicontinuous_iff uniformity_basis_dist
#align metric.uniform_equicontinuous_iff Metric.uniformEquicontinuous_iff
| Mathlib/Topology/MetricSpace/Equicontinuity.lean | 90 | 97 | theorem equicontinuousAt_of_continuity_modulus {ι : Type*} [TopologicalSpace β] {x₀ : β}
(b : β → ℝ) (b_lim : Tendsto b (𝓝 x₀) (𝓝 0)) (F : ι → β → α)
(H : ∀ᶠ x in 𝓝 x₀, ∀ i, dist (F i x₀) (F i x) ≤ b x) : EquicontinuousAt F x₀ := by |
rw [Metric.equicontinuousAt_iff_right]
intro ε ε0
-- Porting note: Lean 3 didn't need `Filter.mem_map.mp` here
filter_upwards [Filter.mem_map.mp <| b_lim (Iio_mem_nhds ε0), H] using
fun x hx₁ hx₂ i => (hx₂ i).trans_lt hx₁
| 5 | 148.413159 | 2 | 2 | 2 | 2,198 |
import Mathlib.Topology.MetricSpace.PseudoMetric
import Mathlib.Topology.UniformSpace.Equicontinuity
#align_import topology.metric_space.equicontinuity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Topology Uniformity
variable {α β ι : Type*} [PseudoMetricSpace α]
namespace Metric
theorem equicontinuousAt_iff_right {ι : Type*} [TopologicalSpace β] {F : ι → β → α} {x₀ : β} :
EquicontinuousAt F x₀ ↔ ∀ ε > 0, ∀ᶠ x in 𝓝 x₀, ∀ i, dist (F i x₀) (F i x) < ε :=
uniformity_basis_dist.equicontinuousAt_iff_right
#align metric.equicontinuous_at_iff_right Metric.equicontinuousAt_iff_right
theorem equicontinuousAt_iff {ι : Type*} [PseudoMetricSpace β] {F : ι → β → α} {x₀ : β} :
EquicontinuousAt F x₀ ↔ ∀ ε > 0, ∃ δ > 0, ∀ x, dist x x₀ < δ → ∀ i, dist (F i x₀) (F i x) < ε :=
nhds_basis_ball.equicontinuousAt_iff uniformity_basis_dist
#align metric.equicontinuous_at_iff Metric.equicontinuousAt_iff
protected theorem equicontinuousAt_iff_pair {ι : Type*} [TopologicalSpace β] {F : ι → β → α}
{x₀ : β} :
EquicontinuousAt F x₀ ↔
∀ ε > 0, ∃ U ∈ 𝓝 x₀, ∀ x ∈ U, ∀ x' ∈ U, ∀ i, dist (F i x) (F i x') < ε := by
rw [equicontinuousAt_iff_pair]
constructor <;> intro H
· intro ε hε
exact H _ (dist_mem_uniformity hε)
· intro U hU
rcases mem_uniformity_dist.mp hU with ⟨ε, hε, hεU⟩
refine Exists.imp (fun V => And.imp_right fun h => ?_) (H _ hε)
exact fun x hx x' hx' i => hεU (h _ hx _ hx' i)
#align metric.equicontinuous_at_iff_pair Metric.equicontinuousAt_iff_pair
theorem uniformEquicontinuous_iff_right {ι : Type*} [UniformSpace β] {F : ι → β → α} :
UniformEquicontinuous F ↔ ∀ ε > 0, ∀ᶠ xy : β × β in 𝓤 β, ∀ i, dist (F i xy.1) (F i xy.2) < ε :=
uniformity_basis_dist.uniformEquicontinuous_iff_right
#align metric.uniform_equicontinuous_iff_right Metric.uniformEquicontinuous_iff_right
theorem uniformEquicontinuous_iff {ι : Type*} [PseudoMetricSpace β] {F : ι → β → α} :
UniformEquicontinuous F ↔
∀ ε > 0, ∃ δ > 0, ∀ x y, dist x y < δ → ∀ i, dist (F i x) (F i y) < ε :=
uniformity_basis_dist.uniformEquicontinuous_iff uniformity_basis_dist
#align metric.uniform_equicontinuous_iff Metric.uniformEquicontinuous_iff
theorem equicontinuousAt_of_continuity_modulus {ι : Type*} [TopologicalSpace β] {x₀ : β}
(b : β → ℝ) (b_lim : Tendsto b (𝓝 x₀) (𝓝 0)) (F : ι → β → α)
(H : ∀ᶠ x in 𝓝 x₀, ∀ i, dist (F i x₀) (F i x) ≤ b x) : EquicontinuousAt F x₀ := by
rw [Metric.equicontinuousAt_iff_right]
intro ε ε0
-- Porting note: Lean 3 didn't need `Filter.mem_map.mp` here
filter_upwards [Filter.mem_map.mp <| b_lim (Iio_mem_nhds ε0), H] using
fun x hx₁ hx₂ i => (hx₂ i).trans_lt hx₁
#align metric.equicontinuous_at_of_continuity_modulus Metric.equicontinuousAt_of_continuity_modulus
| Mathlib/Topology/MetricSpace/Equicontinuity.lean | 103 | 114 | theorem uniformEquicontinuous_of_continuity_modulus {ι : Type*} [PseudoMetricSpace β] (b : ℝ → ℝ)
(b_lim : Tendsto b (𝓝 0) (𝓝 0)) (F : ι → β → α)
(H : ∀ (x y : β) (i), dist (F i x) (F i y) ≤ b (dist x y)) : UniformEquicontinuous F := by |
rw [Metric.uniformEquicontinuous_iff]
intro ε ε0
rcases tendsto_nhds_nhds.1 b_lim ε ε0 with ⟨δ, δ0, hδ⟩
refine ⟨δ, δ0, fun x y hxy i => ?_⟩
calc
dist (F i x) (F i y) ≤ b (dist x y) := H x y i
_ ≤ |b (dist x y)| := le_abs_self _
_ = dist (b (dist x y)) 0 := by simp [Real.dist_eq]
_ < ε := hδ (by simpa only [Real.dist_eq, tsub_zero, abs_dist] using hxy)
| 9 | 8,103.083928 | 2 | 2 | 2 | 2,198 |
import Mathlib.Algebra.Algebra.RestrictScalars
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.LinearAlgebra.Quotient
import Mathlib.LinearAlgebra.StdBasis
import Mathlib.GroupTheory.Finiteness
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.RingTheory.Nilpotent.Defs
#align_import ring_theory.finiteness from "leanprover-community/mathlib"@"c813ed7de0f5115f956239124e9b30f3a621966f"
open Function (Surjective)
namespace Submodule
variable {R : Type*} {M : Type*} [Semiring R] [AddCommMonoid M] [Module R M]
open Set
def FG (N : Submodule R M) : Prop :=
∃ S : Finset M, Submodule.span R ↑S = N
#align submodule.fg Submodule.FG
theorem fg_def {N : Submodule R M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ span R S = N :=
⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by
rintro ⟨t', h, rfl⟩
rcases Finite.exists_finset_coe h with ⟨t, rfl⟩
exact ⟨t, rfl⟩⟩
#align submodule.fg_def Submodule.fg_def
theorem fg_iff_addSubmonoid_fg (P : Submodule ℕ M) : P.FG ↔ P.toAddSubmonoid.FG :=
⟨fun ⟨S, hS⟩ => ⟨S, by simpa [← span_nat_eq_addSubmonoid_closure] using hS⟩, fun ⟨S, hS⟩ =>
⟨S, by simpa [← span_nat_eq_addSubmonoid_closure] using hS⟩⟩
#align submodule.fg_iff_add_submonoid_fg Submodule.fg_iff_addSubmonoid_fg
theorem fg_iff_add_subgroup_fg {G : Type*} [AddCommGroup G] (P : Submodule ℤ G) :
P.FG ↔ P.toAddSubgroup.FG :=
⟨fun ⟨S, hS⟩ => ⟨S, by simpa [← span_int_eq_addSubgroup_closure] using hS⟩, fun ⟨S, hS⟩ =>
⟨S, by simpa [← span_int_eq_addSubgroup_closure] using hS⟩⟩
#align submodule.fg_iff_add_subgroup_fg Submodule.fg_iff_add_subgroup_fg
| Mathlib/RingTheory/Finiteness.lean | 69 | 77 | theorem fg_iff_exists_fin_generating_family {N : Submodule R M} :
N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), span R (range s) = N := by |
rw [fg_def]
constructor
· rintro ⟨S, Sfin, hS⟩
obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding
exact ⟨n, f, hS⟩
· rintro ⟨n, s, hs⟩
exact ⟨range s, finite_range s, hs⟩
| 7 | 1,096.633158 | 2 | 2 | 2 | 2,199 |
import Mathlib.Algebra.Algebra.RestrictScalars
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.LinearAlgebra.Quotient
import Mathlib.LinearAlgebra.StdBasis
import Mathlib.GroupTheory.Finiteness
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.RingTheory.Nilpotent.Defs
#align_import ring_theory.finiteness from "leanprover-community/mathlib"@"c813ed7de0f5115f956239124e9b30f3a621966f"
open Function (Surjective)
namespace Submodule
variable {R : Type*} {M : Type*} [Semiring R] [AddCommMonoid M] [Module R M]
open Set
def FG (N : Submodule R M) : Prop :=
∃ S : Finset M, Submodule.span R ↑S = N
#align submodule.fg Submodule.FG
theorem fg_def {N : Submodule R M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ span R S = N :=
⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by
rintro ⟨t', h, rfl⟩
rcases Finite.exists_finset_coe h with ⟨t, rfl⟩
exact ⟨t, rfl⟩⟩
#align submodule.fg_def Submodule.fg_def
theorem fg_iff_addSubmonoid_fg (P : Submodule ℕ M) : P.FG ↔ P.toAddSubmonoid.FG :=
⟨fun ⟨S, hS⟩ => ⟨S, by simpa [← span_nat_eq_addSubmonoid_closure] using hS⟩, fun ⟨S, hS⟩ =>
⟨S, by simpa [← span_nat_eq_addSubmonoid_closure] using hS⟩⟩
#align submodule.fg_iff_add_submonoid_fg Submodule.fg_iff_addSubmonoid_fg
theorem fg_iff_add_subgroup_fg {G : Type*} [AddCommGroup G] (P : Submodule ℤ G) :
P.FG ↔ P.toAddSubgroup.FG :=
⟨fun ⟨S, hS⟩ => ⟨S, by simpa [← span_int_eq_addSubgroup_closure] using hS⟩, fun ⟨S, hS⟩ =>
⟨S, by simpa [← span_int_eq_addSubgroup_closure] using hS⟩⟩
#align submodule.fg_iff_add_subgroup_fg Submodule.fg_iff_add_subgroup_fg
theorem fg_iff_exists_fin_generating_family {N : Submodule R M} :
N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), span R (range s) = N := by
rw [fg_def]
constructor
· rintro ⟨S, Sfin, hS⟩
obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding
exact ⟨n, f, hS⟩
· rintro ⟨n, s, hs⟩
exact ⟨range s, finite_range s, hs⟩
#align submodule.fg_iff_exists_fin_generating_family Submodule.fg_iff_exists_fin_generating_family
| Mathlib/RingTheory/Finiteness.lean | 82 | 134 | theorem exists_sub_one_mem_and_smul_eq_zero_of_fg_of_le_smul {R : Type*} [CommRing R] {M : Type*}
[AddCommGroup M] [Module R M] (I : Ideal R) (N : Submodule R M) (hn : N.FG) (hin : N ≤ I • N) :
∃ r : R, r - 1 ∈ I ∧ ∀ n ∈ N, r • n = (0 : M) := by |
rw [fg_def] at hn
rcases hn with ⟨s, hfs, hs⟩
have : ∃ r : R, r - 1 ∈ I ∧ N ≤ (I • span R s).comap (LinearMap.lsmul R M r) ∧ s ⊆ N := by
refine ⟨1, ?_, ?_, ?_⟩
· rw [sub_self]
exact I.zero_mem
· rw [hs]
intro n hn
rw [mem_comap]
change (1 : R) • n ∈ I • N
rw [one_smul]
exact hin hn
· rw [← span_le, hs]
clear hin hs
revert this
refine Set.Finite.dinduction_on _ hfs (fun H => ?_) @fun i s _ _ ih H => ?_
· rcases H with ⟨r, hr1, hrn, _⟩
refine ⟨r, hr1, fun n hn => ?_⟩
specialize hrn hn
rwa [mem_comap, span_empty, smul_bot, mem_bot] at hrn
apply ih
rcases H with ⟨r, hr1, hrn, hs⟩
rw [← Set.singleton_union, span_union, smul_sup] at hrn
rw [Set.insert_subset_iff] at hs
have : ∃ c : R, c - 1 ∈ I ∧ c • i ∈ I • span R s := by
specialize hrn hs.1
rw [mem_comap, mem_sup] at hrn
rcases hrn with ⟨y, hy, z, hz, hyz⟩
dsimp at hyz
rw [mem_smul_span_singleton] at hy
rcases hy with ⟨c, hci, rfl⟩
use r - c
constructor
· rw [sub_right_comm]
exact I.sub_mem hr1 hci
· rw [sub_smul, ← hyz, add_sub_cancel_left]
exact hz
rcases this with ⟨c, hc1, hci⟩
refine ⟨c * r, ?_, ?_, hs.2⟩
· simpa only [mul_sub, mul_one, sub_add_sub_cancel] using I.add_mem (I.mul_mem_left c hr1) hc1
· intro n hn
specialize hrn hn
rw [mem_comap, mem_sup] at hrn
rcases hrn with ⟨y, hy, z, hz, hyz⟩
dsimp at hyz
rw [mem_smul_span_singleton] at hy
rcases hy with ⟨d, _, rfl⟩
simp only [mem_comap, LinearMap.lsmul_apply]
rw [mul_smul, ← hyz, smul_add, smul_smul, mul_comm, mul_smul]
exact add_mem (smul_mem _ _ hci) (smul_mem _ _ hz)
| 50 | 5,184,705,528,587,073,000,000 | 2 | 2 | 2 | 2,199 |
import Mathlib.Data.Fintype.Basic
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Tactic.Zify
import Mathlib.Data.Nat.Totient
#align_import number_theory.lucas_primality from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
| Mathlib/NumberTheory/LucasPrimality.lean | 42 | 63 | theorem lucas_primality (p : ℕ) (a : ZMod p) (ha : a ^ (p - 1) = 1)
(hd : ∀ q : ℕ, q.Prime → q ∣ p - 1 → a ^ ((p - 1) / q) ≠ 1) : p.Prime := by |
have h0 : p ≠ 0 := by
rintro ⟨⟩
exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _)
have h1 : p ≠ 1 := by
rintro ⟨⟩
exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _)
have hp1 : 1 < p := lt_of_le_of_ne h0.bot_lt h1.symm
have order_of_a : orderOf a = p - 1 := by
apply orderOf_eq_of_pow_and_pow_div_prime _ ha hd
exact tsub_pos_of_lt hp1
haveI : NeZero p := ⟨h0⟩
rw [Nat.prime_iff_card_units]
-- Prove cardinality of `Units` of `ZMod p` is both `≤ p-1` and `≥ p-1`
refine le_antisymm (Nat.card_units_zmod_lt_sub_one hp1) ?_
have hp' : p - 2 + 1 = p - 1 := tsub_add_eq_add_tsub hp1
let a' : (ZMod p)ˣ := Units.mkOfMulEqOne a (a ^ (p - 2)) (by rw [← pow_succ', hp', ha])
calc
p - 1 = orderOf a := order_of_a.symm
_ = orderOf a' := (orderOf_injective (Units.coeHom (ZMod p)) Units.ext a')
_ ≤ Fintype.card (ZMod p)ˣ := orderOf_le_card_univ
| 20 | 485,165,195.40979 | 2 | 2 | 1 | 2,200 |
import Mathlib.RingTheory.Flat.Basic
import Mathlib.RingTheory.IsTensorProduct
import Mathlib.LinearAlgebra.TensorProduct.Tower
universe u v w t
open Function (Injective Surjective)
open LinearMap (lsmul rTensor lTensor)
open TensorProduct
namespace Module.Flat
section Composition
variable (R : Type u) (S : Type v) (M : Type w)
[CommRing R] [CommRing S] [Algebra R S]
[AddCommGroup M] [Module R M] [Module S M] [IsScalarTower R S M]
private noncomputable abbrev auxRightMul (I : Ideal R) : M ⊗[R] I →ₗ[S] M := by
letI i : M ⊗[R] I →ₗ[S] M ⊗[R] R := AlgebraTensorModule.map LinearMap.id I.subtype
letI e' : M ⊗[R] R →ₗ[S] M := AlgebraTensorModule.rid R S M
exact AlgebraTensorModule.rid R S M ∘ₗ i
private noncomputable abbrev J (I : Ideal R) : Ideal S := LinearMap.range (auxRightMul R S S I)
private noncomputable abbrev auxIso [Module.Flat R S] {I : Ideal R} :
S ⊗[R] I ≃ₗ[S] J R S I := by
apply LinearEquiv.ofInjective (auxRightMul R S S I)
simp only [LinearMap.coe_comp, LinearEquiv.coe_coe, EquivLike.comp_injective]
exact (Module.Flat.iff_lTensor_injective' R S).mp inferInstance I
private noncomputable abbrev auxLTensor [Module.Flat R S] (I : Ideal R) :
M ⊗[R] I →ₗ[S] M := by
letI e1 : M ⊗[R] I ≃ₗ[S] M ⊗[S] (S ⊗[R] I) :=
(AlgebraTensorModule.cancelBaseChange R S S M I).symm
letI e2 : M ⊗[S] (S ⊗[R] I) ≃ₗ[S] M ⊗[S] (J R S I) :=
TensorProduct.congr (LinearEquiv.refl S M) (auxIso R S)
letI e3 : M ⊗[S] (J R S I) →ₗ[S] M ⊗[S] S := lTensor M (J R S I).subtype
letI e4 : M ⊗[S] S →ₗ[S] M := TensorProduct.rid S M
exact e4 ∘ₗ e3 ∘ₗ (e1 ≪≫ₗ e2)
private lemma auxLTensor_eq [Module.Flat R S] {I : Ideal R} :
(auxLTensor R S M I : M ⊗[R] I →ₗ[R] M) =
TensorProduct.rid R M ∘ₗ lTensor M (I.subtype) := by
apply TensorProduct.ext'
intro m x
erw [TensorProduct.rid_tmul]
simp
| Mathlib/RingTheory/Flat/Stability.lean | 86 | 94 | theorem comp [Module.Flat R S] [Module.Flat S M] : Module.Flat R M := by |
rw [Module.Flat.iff_lTensor_injective']
intro I
rw [← EquivLike.comp_injective _ (TensorProduct.rid R M)]
haveI h : TensorProduct.rid R M ∘ lTensor M (Submodule.subtype I) =
TensorProduct.rid R M ∘ₗ lTensor M I.subtype := rfl
simp only [h, ← auxLTensor_eq R S M, LinearMap.coe_restrictScalars, LinearMap.coe_comp,
LinearEquiv.coe_coe, EquivLike.comp_injective, EquivLike.injective_comp]
exact (Module.Flat.iff_lTensor_injective' S M).mp inferInstance _
| 8 | 2,980.957987 | 2 | 2 | 1 | 2,201 |
import Mathlib.Algebra.GCDMonoid.Basic
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Polynomial.Eisenstein.Basic
#align_import algebra.gcd_monoid.integrally_closed from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973"
open scoped Polynomial
variable {R A : Type*} [CommRing R] [IsDomain R] [CommRing A] [Algebra R A]
| Mathlib/Algebra/GCDMonoid/IntegrallyClosed.lean | 23 | 30 | theorem IsLocalization.surj_of_gcd_domain [GCDMonoid R] (M : Submonoid R) [IsLocalization M A]
(z : A) : ∃ a b : R, IsUnit (gcd a b) ∧ z * algebraMap R A b = algebraMap R A a := by |
obtain ⟨x, ⟨y, hy⟩, rfl⟩ := IsLocalization.mk'_surjective M z
obtain ⟨x', y', hx', hy', hu⟩ := extract_gcd x y
use x', y', hu
rw [mul_comm, IsLocalization.mul_mk'_eq_mk'_of_mul]
convert IsLocalization.mk'_mul_cancel_left (M := M) (S := A) _ _ using 2
rw [Subtype.coe_mk, hy', ← mul_comm y', mul_assoc]; conv_lhs => rw [hx']
| 6 | 403.428793 | 2 | 2 | 1 | 2,202 |
import Mathlib.Data.Fintype.Basic
#align_import data.fintype.quotient from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
def Quotient.finChoiceAux {ι : Type*} [DecidableEq ι] {α : ι → Type*} [S : ∀ i, Setoid (α i)] :
∀ l : List ι, (∀ i ∈ l, Quotient (S i)) → @Quotient (∀ i ∈ l, α i) (by infer_instance)
| [], _ => ⟦fun i h => nomatch List.not_mem_nil _ h⟧
| i :: l, f => by
refine Quotient.liftOn₂ (f i (List.mem_cons_self _ _))
(Quotient.finChoiceAux l fun j h => f j (List.mem_cons_of_mem _ h)) ?_ ?_
· exact fun a l => ⟦fun j h =>
if e : j = i then by rw [e]; exact a else l _ ((List.mem_cons.1 h).resolve_left e)⟧
refine fun a₁ l₁ a₂ l₂ h₁ h₂ => Quotient.sound fun j h => ?_
by_cases e : j = i <;> simp [e]
· subst j
exact h₁
· exact h₂ _ _
#align quotient.fin_choice_aux Quotient.finChoiceAux
theorem Quotient.finChoiceAux_eq {ι : Type*} [DecidableEq ι] {α : ι → Type*}
[S : ∀ i, Setoid (α i)] :
∀ (l : List ι) (f : ∀ i ∈ l, α i), (Quotient.finChoiceAux l fun i h => ⟦f i h⟧) = ⟦f⟧
| [], f => Quotient.sound fun i h => nomatch List.not_mem_nil _ h
| i :: l, f => by
simp only [finChoiceAux, Quotient.finChoiceAux_eq l, eq_mpr_eq_cast, lift_mk]
refine Quotient.sound fun j h => ?_
by_cases e : j = i <;> simp [e] <;> try exact Setoid.refl _
subst j; exact Setoid.refl _
#align quotient.fin_choice_aux_eq Quotient.finChoiceAux_eq
def Quotient.finChoice {ι : Type*} [DecidableEq ι] [Fintype ι] {α : ι → Type*}
[S : ∀ i, Setoid (α i)] (f : ∀ i, Quotient (S i)) : @Quotient (∀ i, α i) (by infer_instance) :=
Quotient.liftOn
(@Quotient.recOn _ _ (fun l : Multiset ι => @Quotient (∀ i ∈ l, α i) (by infer_instance))
Finset.univ.1 (fun l => Quotient.finChoiceAux l fun i _ => f i) (fun a b h => by
have := fun a => Quotient.finChoiceAux_eq a fun i _ => Quotient.out (f i)
simp? [Quotient.out_eq] at this says simp only [out_eq] at this
simp only [Multiset.quot_mk_to_coe, this]
let g := fun a : Multiset ι =>
(⟦fun (i : ι) (_ : i ∈ a) => Quotient.out (f i)⟧ : Quotient (by infer_instance))
apply eq_of_heq
trans (g a)
· exact eq_rec_heq (φ := fun l : Multiset ι => @Quotient (∀ i ∈ l, α i) (by infer_instance))
(Quotient.sound h) (g a)
· change HEq (g a) (g b); congr 1; exact Quotient.sound h))
(fun f => ⟦fun i => f i (Finset.mem_univ _)⟧) (fun a b h => Quotient.sound fun i => by apply h)
#align quotient.fin_choice Quotient.finChoice
| Mathlib/Data/Fintype/Quotient.lean | 76 | 84 | theorem Quotient.finChoice_eq {ι : Type*} [DecidableEq ι] [Fintype ι] {α : ι → Type*}
[∀ i, Setoid (α i)] (f : ∀ i, α i) : (Quotient.finChoice fun i => ⟦f i⟧) = ⟦f⟧ := by |
dsimp only [Quotient.finChoice]
conv_lhs =>
enter [1]
tactic =>
change _ = ⟦fun i _ => f i⟧
exact Quotient.inductionOn (@Finset.univ ι _).1 fun l => Quotient.finChoiceAux_eq _ _
rfl
| 7 | 1,096.633158 | 2 | 2 | 1 | 2,203 |
import Mathlib.Algebra.Order.Hom.Ring
import Mathlib.Algebra.Order.Pointwise
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import algebra.order.complete_field from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
variable {F α β γ : Type*}
noncomputable section
open Function Rat Real Set
open scoped Classical Pointwise
-- @[protect_proj] -- Porting note: does not exist anymore
class ConditionallyCompleteLinearOrderedField (α : Type*) extends
LinearOrderedField α, ConditionallyCompleteLinearOrder α
#align conditionally_complete_linear_ordered_field ConditionallyCompleteLinearOrderedField
-- see Note [lower instance priority]
instance (priority := 100) ConditionallyCompleteLinearOrderedField.to_archimedean
[ConditionallyCompleteLinearOrderedField α] : Archimedean α :=
archimedean_iff_nat_lt.2
(by
by_contra! h
obtain ⟨x, h⟩ := h
have := csSup_le _ _ (range_nonempty Nat.cast)
(forall_mem_range.2 fun m =>
le_sub_iff_add_le.2 <| le_csSup _ _ ⟨x, forall_mem_range.2 h⟩ ⟨m+1, Nat.cast_succ m⟩)
linarith)
#align conditionally_complete_linear_ordered_field.to_archimedean ConditionallyCompleteLinearOrderedField.to_archimedean
instance : ConditionallyCompleteLinearOrderedField ℝ :=
{ (inferInstance : LinearOrderedField ℝ),
(inferInstance : ConditionallyCompleteLinearOrder ℝ) with }
namespace LinearOrderedField
section CutMap
variable [LinearOrderedField α]
section DivisionRing
variable (β) [DivisionRing β] {a a₁ a₂ : α} {b : β} {q : ℚ}
def cutMap (a : α) : Set β :=
(Rat.cast : ℚ → β) '' {t | ↑t < a}
#align linear_ordered_field.cut_map LinearOrderedField.cutMap
theorem cutMap_mono (h : a₁ ≤ a₂) : cutMap β a₁ ⊆ cutMap β a₂ := image_subset _ fun _ => h.trans_lt'
#align linear_ordered_field.cut_map_mono LinearOrderedField.cutMap_mono
variable {β}
@[simp]
theorem mem_cutMap_iff : b ∈ cutMap β a ↔ ∃ q : ℚ, (q : α) < a ∧ (q : β) = b := Iff.rfl
#align linear_ordered_field.mem_cut_map_iff LinearOrderedField.mem_cutMap_iff
-- @[simp] -- Porting note: not in simpNF
theorem coe_mem_cutMap_iff [CharZero β] : (q : β) ∈ cutMap β a ↔ (q : α) < a :=
Rat.cast_injective.mem_set_image
#align linear_ordered_field.coe_mem_cut_map_iff LinearOrderedField.coe_mem_cutMap_iff
| Mathlib/Algebra/Order/CompleteField.lean | 121 | 127 | theorem cutMap_self (a : α) : cutMap α a = Iio a ∩ range (Rat.cast : ℚ → α) := by |
ext
constructor
· rintro ⟨q, h, rfl⟩
exact ⟨h, q, rfl⟩
· rintro ⟨h, q, rfl⟩
exact ⟨q, h, rfl⟩
| 6 | 403.428793 | 2 | 2 | 1 | 2,204 |
import Mathlib.Analysis.NormedSpace.lpSpace
import Mathlib.Analysis.NormedSpace.PiLp
import Mathlib.Topology.ContinuousFunction.Bounded
#align_import analysis.normed_space.lp_equiv from "leanprover-community/mathlib"@"6afc9b06856ad973f6a2619e3e8a0a8d537a58f2"
open scoped ENNReal
section LpPiLp
set_option linter.uppercaseLean3 false
variable {α : Type*} {E : α → Type*} [∀ i, NormedAddCommGroup (E i)] {p : ℝ≥0∞}
section Finite
variable [Finite α]
| Mathlib/Analysis/NormedSpace/LpEquiv.lean | 54 | 58 | theorem Memℓp.all (f : ∀ i, E i) : Memℓp f p := by |
rcases p.trichotomy with (rfl | rfl | _h)
· exact memℓp_zero_iff.mpr { i : α | f i ≠ 0 }.toFinite
· exact memℓp_infty_iff.mpr (Set.Finite.bddAbove (Set.range fun i : α ↦ ‖f i‖).toFinite)
· cases nonempty_fintype α; exact memℓp_gen ⟨Finset.univ.sum _, hasSum_fintype _⟩
| 4 | 54.59815 | 2 | 2 | 1 | 2,205 |
import Mathlib.Analysis.Complex.AbelLimit
import Mathlib.Analysis.SpecialFunctions.Complex.Arctan
#align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Real
open Filter Finset
open scoped Topology
| Mathlib/Data/Real/Pi/Leibniz.lean | 21 | 57 | theorem tendsto_sum_pi_div_four :
Tendsto (fun k => ∑ i ∈ range k, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 (π / 4)) := by |
-- The series is alternating with terms of decreasing magnitude, so it converges to some limit
obtain ⟨l, h⟩ :
∃ l, Tendsto (fun n ↦ ∑ i ∈ range n, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 l) := by
apply Antitone.tendsto_alternating_series_of_tendsto_zero
· exact antitone_iff_forall_lt.mpr fun _ _ _ ↦ by gcongr
· apply Tendsto.inv_tendsto_atTop; apply tendsto_atTop_add_const_right
exact tendsto_natCast_atTop_atTop.const_mul_atTop zero_lt_two
-- Abel's limit theorem states that the corresponding power series has the same limit as `x → 1⁻`
have abel := tendsto_tsum_powerSeries_nhdsWithin_lt h
-- Massage the expression to get `x ^ (2 * n + 1)` in the tsum rather than `x ^ n`...
have m : 𝓝[<] (1 : ℝ) ≤ 𝓝 1 := tendsto_nhdsWithin_of_tendsto_nhds fun _ a ↦ a
have q : Tendsto (fun x : ℝ ↦ x ^ 2) (𝓝[<] 1) (𝓝[<] 1) := by
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
· nth_rw 3 [← one_pow 2]
exact Tendsto.pow ‹_› _
· rw [eventually_iff_exists_mem]
use Set.Ioo (-1) 1
exact ⟨(by rw [mem_nhdsWithin_Iio_iff_exists_Ioo_subset]; use -1, by simp),
fun _ _ ↦ by rwa [Set.mem_Iio, sq_lt_one_iff_abs_lt_one, abs_lt, ← Set.mem_Ioo]⟩
replace abel := (abel.comp q).mul m
rw [mul_one] at abel
-- ...so that we can replace the tsum with the real arctangent function
replace abel : Tendsto arctan (𝓝[<] 1) (𝓝 l) := by
apply abel.congr'
rw [eventuallyEq_nhdsWithin_iff, Metric.eventually_nhds_iff]
use 1, zero_lt_one
intro y hy1 hy2
rw [dist_eq, abs_sub_lt_iff] at hy1
rw [Set.mem_Iio] at hy2
have ny : ‖y‖ < 1 := by rw [norm_eq_abs, abs_lt]; constructor <;> linarith
rw [← (hasSum_arctan ny).tsum_eq, Function.comp_apply, ← tsum_mul_right]
simp_rw [mul_assoc, ← pow_mul, ← pow_succ, div_mul_eq_mul_div]
norm_cast
-- But `arctan` is continuous everywhere, so the limit is `arctan 1 = π / 4`
rwa [tendsto_nhds_unique abel ((continuous_arctan.tendsto 1).mono_left m), arctan_one] at h
| 35 | 1,586,013,452,313,430.8 | 2 | 2 | 1 | 2,206 |
import Mathlib.Algebra.CharP.Defs
import Mathlib.Data.Nat.Prime
import Mathlib.ModelTheory.Algebra.Ring.FreeCommRing
import Mathlib.ModelTheory.Algebra.Field.Basic
variable {p : ℕ} {K : Type*}
namespace FirstOrder
namespace Field
open Language Ring
noncomputable def eqZero (n : ℕ) : Language.ring.Sentence :=
Term.equal (termOfFreeCommRing n) 0
@[simp] theorem realize_eqZero [CommRing K] [CompatibleRing K] (n : ℕ)
(v : Empty → K) : (Formula.Realize (eqZero n) v) ↔ ((n : K) = 0) := by
simp [eqZero, Term.realize]
def _root_.FirstOrder.Language.Theory.fieldOfChar (p : ℕ) : Language.ring.Theory :=
Theory.field ∪
if p = 0
then (fun q => ∼(eqZero q)) '' {q : ℕ | q.Prime}
else if p.Prime then {eqZero p}
else {⊥}
instance model_hasChar_of_charP [Field K] [CompatibleRing K] [CharP K p] :
(Theory.fieldOfChar p).Model K := by
refine Language.Theory.model_union_iff.2 ⟨inferInstance, ?_⟩
cases CharP.char_is_prime_or_zero K p with
| inl hp =>
simp [hp.ne_zero, hp, Sentence.Realize]
| inr hp =>
subst hp
simp only [ite_false, ite_true, Theory.model_iff, Set.mem_image, Set.mem_setOf_eq,
Sentence.Realize, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂,
Formula.realize_not, realize_eqZero, ← CharZero.charZero_iff_forall_prime_ne_zero]
exact CharP.charP_to_charZero K
| Mathlib/ModelTheory/Algebra/Field/CharP.lean | 63 | 78 | theorem charP_iff_model_fieldOfChar [Field K] [CompatibleRing K] :
(Theory.fieldOfChar p).Model K ↔ CharP K p := by |
simp only [Theory.fieldOfChar, Theory.model_union_iff,
(show (Theory.field.Model K) by infer_instance), true_and]
split_ifs with hp0 hp
· subst hp0
simp only [Theory.model_iff, Set.mem_image, Set.mem_setOf_eq, Sentence.Realize,
forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, Formula.realize_not,
realize_eqZero, ← CharZero.charZero_iff_forall_prime_ne_zero]
exact ⟨fun _ => CharP.ofCharZero _, fun _ => CharP.charP_to_charZero K⟩
· simp only [Theory.model_iff, Set.mem_singleton_iff, Sentence.Realize, forall_eq,
realize_eqZero, ← CharP.charP_iff_prime_eq_zero hp]
· simp only [Theory.model_iff, Set.mem_singleton_iff, Sentence.Realize,
forall_eq, Formula.realize_bot, false_iff]
intro H
cases (CharP.char_is_prime_or_zero K p) <;> simp_all
| 14 | 1,202,604.284165 | 2 | 2 | 1 | 2,207 |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Data.Set.Function
#align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set MeasureTheory.MeasureSpace
variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ}
| Mathlib/Analysis/SumIntegralComparisons.lean | 47 | 70 | theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by |
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
simp only [Nat.cast_zero, add_zero]
_ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i < a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
apply hf _ _ hx.1
· simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left,
Nat.cast_le, and_self_iff]
· refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia]
_ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp
| 22 | 3,584,912,846.131591 | 2 | 2 | 4 | 2,208 |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Data.Set.Function
#align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set MeasureTheory.MeasureSpace
variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ}
theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
simp only [Nat.cast_zero, add_zero]
_ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i < a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
apply hf _ _ hx.1
· simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left,
Nat.cast_le, and_self_iff]
· refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia]
_ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp
#align antitone_on.integral_le_sum AntitoneOn.integral_le_sum
| Mathlib/Analysis/SumIntegralComparisons.lean | 73 | 95 | theorem AntitoneOn.integral_le_sum_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) :
(∫ x in a..b, f x) ≤ ∑ x ∈ Finset.Ico a b, f x := by |
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
· skip
· skip
rw [add_comm]
· skip
· skip
congr
congr
rw [← zero_add a]
rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
rhs
congr
· skip
ext
rw [Nat.cast_add]
apply AntitoneOn.integral_le_sum
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
| 21 | 1,318,815,734.483215 | 2 | 2 | 4 | 2,208 |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Data.Set.Function
#align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set MeasureTheory.MeasureSpace
variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ}
theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
simp only [Nat.cast_zero, add_zero]
_ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i < a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
apply hf _ _ hx.1
· simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left,
Nat.cast_le, and_self_iff]
· refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia]
_ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp
#align antitone_on.integral_le_sum AntitoneOn.integral_le_sum
theorem AntitoneOn.integral_le_sum_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) :
(∫ x in a..b, f x) ≤ ∑ x ∈ Finset.Ico a b, f x := by
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
· skip
· skip
rw [add_comm]
· skip
· skip
congr
congr
rw [← zero_add a]
rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
rhs
congr
· skip
ext
rw [Nat.cast_add]
apply AntitoneOn.integral_le_sum
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
#align antitone_on.integral_le_sum_Ico AntitoneOn.integral_le_sum_Ico
| Mathlib/Analysis/SumIntegralComparisons.lean | 98 | 123 | theorem AntitoneOn.sum_le_integral (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) ≤ ∫ x in x₀..x₀ + a, f x := by |
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
(∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) =
∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + (i + 1 : ℕ)) := by simp
_ ≤ ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i + 1 ≤ a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (by simp) (hint _ ia) fun x hx => ?_
apply hf _ _ hx.2
· refine mem_Icc.2 ⟨le_trans ((le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _)) hx.1,
le_trans hx.2 ?_⟩
simp only [Nat.cast_le, add_le_add_iff_left, ia]
· refine mem_Icc.2 ⟨(le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _), ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, ia]
_ = ∫ x in x₀..x₀ + a, f x := by
convert intervalIntegral.sum_integral_adjacent_intervals hint
simp only [Nat.cast_zero, add_zero]
| 24 | 26,489,122,129.84347 | 2 | 2 | 4 | 2,208 |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Data.Set.Function
#align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set MeasureTheory.MeasureSpace
variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ}
theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
simp only [Nat.cast_zero, add_zero]
_ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i < a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
apply hf _ _ hx.1
· simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left,
Nat.cast_le, and_self_iff]
· refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia]
_ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp
#align antitone_on.integral_le_sum AntitoneOn.integral_le_sum
theorem AntitoneOn.integral_le_sum_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) :
(∫ x in a..b, f x) ≤ ∑ x ∈ Finset.Ico a b, f x := by
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
· skip
· skip
rw [add_comm]
· skip
· skip
congr
congr
rw [← zero_add a]
rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
rhs
congr
· skip
ext
rw [Nat.cast_add]
apply AntitoneOn.integral_le_sum
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
#align antitone_on.integral_le_sum_Ico AntitoneOn.integral_le_sum_Ico
theorem AntitoneOn.sum_le_integral (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) ≤ ∫ x in x₀..x₀ + a, f x := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
(∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) =
∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + (i + 1 : ℕ)) := by simp
_ ≤ ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i + 1 ≤ a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (by simp) (hint _ ia) fun x hx => ?_
apply hf _ _ hx.2
· refine mem_Icc.2 ⟨le_trans ((le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _)) hx.1,
le_trans hx.2 ?_⟩
simp only [Nat.cast_le, add_le_add_iff_left, ia]
· refine mem_Icc.2 ⟨(le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _), ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, ia]
_ = ∫ x in x₀..x₀ + a, f x := by
convert intervalIntegral.sum_integral_adjacent_intervals hint
simp only [Nat.cast_zero, add_zero]
#align antitone_on.sum_le_integral AntitoneOn.sum_le_integral
| Mathlib/Analysis/SumIntegralComparisons.lean | 126 | 147 | theorem AntitoneOn.sum_le_integral_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) :
(∑ i ∈ Finset.Ico a b, f (i + 1 : ℕ)) ≤ ∫ x in a..b, f x := by |
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
congr
rw [← zero_add a]
· skip
· skip
· skip
rw [add_comm]
rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
lhs
congr
congr
· skip
ext
rw [add_assoc, Nat.cast_add]
apply AntitoneOn.sum_le_integral
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
| 20 | 485,165,195.40979 | 2 | 2 | 4 | 2,208 |
import Mathlib.MeasureTheory.Integral.IntegralEqImproper
#align_import measure_theory.integral.peak_function from "leanprover-community/mathlib"@"13b0d72fd8533ba459ac66e9a885e35ffabb32b2"
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace Metric
open scoped Topology ENNReal
open Set
variable {α E ι : Type*} {hm : MeasurableSpace α} {μ : Measure α} [TopologicalSpace α]
[BorelSpace α] [NormedAddCommGroup E] [NormedSpace ℝ E] {g : α → E} {l : Filter ι} {x₀ : α}
{s t : Set α} {φ : ι → α → ℝ} {a : E}
| Mathlib/MeasureTheory/Integral/PeakFunction.lean | 54 | 86 | theorem integrableOn_peak_smul_of_integrableOn_of_tendsto
(hs : MeasurableSet s) (h'st : t ∈ 𝓝[s] x₀)
(hlφ : ∀ u : Set α, IsOpen u → x₀ ∈ u → TendstoUniformlyOn φ 0 l (s \ u))
(hiφ : Tendsto (fun i ↦ ∫ x in t, φ i x ∂μ) l (𝓝 1))
(h'iφ : ∀ᶠ i in l, AEStronglyMeasurable (φ i) (μ.restrict s))
(hmg : IntegrableOn g s μ) (hcg : Tendsto g (𝓝[s] x₀) (𝓝 a)) :
∀ᶠ i in l, IntegrableOn (fun x => φ i x • g x) s μ := by |
obtain ⟨u, u_open, x₀u, ut, hu⟩ :
∃ u, IsOpen u ∧ x₀ ∈ u ∧ s ∩ u ⊆ t ∧ ∀ x ∈ u ∩ s, g x ∈ ball a 1 := by
rcases mem_nhdsWithin.1 (Filter.inter_mem h'st (hcg (ball_mem_nhds _ zero_lt_one)))
with ⟨u, u_open, x₀u, hu⟩
refine ⟨u, u_open, x₀u, ?_, hu.trans inter_subset_right⟩
rw [inter_comm]
exact hu.trans inter_subset_left
rw [tendsto_iff_norm_sub_tendsto_zero] at hiφ
filter_upwards [tendstoUniformlyOn_iff.1 (hlφ u u_open x₀u) 1 zero_lt_one,
(tendsto_order.1 hiφ).2 1 zero_lt_one, h'iφ] with i hi h'i h''i
have I : IntegrableOn (φ i) t μ := .of_integral_ne_zero (fun h ↦ by simp [h] at h'i)
have A : IntegrableOn (fun x => φ i x • g x) (s \ u) μ := by
refine Integrable.smul_of_top_right (hmg.mono diff_subset le_rfl) ?_
apply memℒp_top_of_bound (h''i.mono_set diff_subset) 1
filter_upwards [self_mem_ae_restrict (hs.diff u_open.measurableSet)] with x hx
simpa only [Pi.zero_apply, dist_zero_left] using (hi x hx).le
have B : IntegrableOn (fun x => φ i x • g x) (s ∩ u) μ := by
apply Integrable.smul_of_top_left
· exact IntegrableOn.mono_set I ut
· apply
memℒp_top_of_bound (hmg.mono_set inter_subset_left).aestronglyMeasurable (‖a‖ + 1)
filter_upwards [self_mem_ae_restrict (hs.inter u_open.measurableSet)] with x hx
rw [inter_comm] at hx
exact (norm_lt_of_mem_ball (hu x hx)).le
convert A.union B
simp only [diff_union_inter]
| 26 | 195,729,609,428.83878 | 2 | 2 | 2 | 2,209 |
import Mathlib.MeasureTheory.Integral.IntegralEqImproper
#align_import measure_theory.integral.peak_function from "leanprover-community/mathlib"@"13b0d72fd8533ba459ac66e9a885e35ffabb32b2"
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace Metric
open scoped Topology ENNReal
open Set
variable {α E ι : Type*} {hm : MeasurableSpace α} {μ : Measure α} [TopologicalSpace α]
[BorelSpace α] [NormedAddCommGroup E] [NormedSpace ℝ E] {g : α → E} {l : Filter ι} {x₀ : α}
{s t : Set α} {φ : ι → α → ℝ} {a : E}
theorem integrableOn_peak_smul_of_integrableOn_of_tendsto
(hs : MeasurableSet s) (h'st : t ∈ 𝓝[s] x₀)
(hlφ : ∀ u : Set α, IsOpen u → x₀ ∈ u → TendstoUniformlyOn φ 0 l (s \ u))
(hiφ : Tendsto (fun i ↦ ∫ x in t, φ i x ∂μ) l (𝓝 1))
(h'iφ : ∀ᶠ i in l, AEStronglyMeasurable (φ i) (μ.restrict s))
(hmg : IntegrableOn g s μ) (hcg : Tendsto g (𝓝[s] x₀) (𝓝 a)) :
∀ᶠ i in l, IntegrableOn (fun x => φ i x • g x) s μ := by
obtain ⟨u, u_open, x₀u, ut, hu⟩ :
∃ u, IsOpen u ∧ x₀ ∈ u ∧ s ∩ u ⊆ t ∧ ∀ x ∈ u ∩ s, g x ∈ ball a 1 := by
rcases mem_nhdsWithin.1 (Filter.inter_mem h'st (hcg (ball_mem_nhds _ zero_lt_one)))
with ⟨u, u_open, x₀u, hu⟩
refine ⟨u, u_open, x₀u, ?_, hu.trans inter_subset_right⟩
rw [inter_comm]
exact hu.trans inter_subset_left
rw [tendsto_iff_norm_sub_tendsto_zero] at hiφ
filter_upwards [tendstoUniformlyOn_iff.1 (hlφ u u_open x₀u) 1 zero_lt_one,
(tendsto_order.1 hiφ).2 1 zero_lt_one, h'iφ] with i hi h'i h''i
have I : IntegrableOn (φ i) t μ := .of_integral_ne_zero (fun h ↦ by simp [h] at h'i)
have A : IntegrableOn (fun x => φ i x • g x) (s \ u) μ := by
refine Integrable.smul_of_top_right (hmg.mono diff_subset le_rfl) ?_
apply memℒp_top_of_bound (h''i.mono_set diff_subset) 1
filter_upwards [self_mem_ae_restrict (hs.diff u_open.measurableSet)] with x hx
simpa only [Pi.zero_apply, dist_zero_left] using (hi x hx).le
have B : IntegrableOn (fun x => φ i x • g x) (s ∩ u) μ := by
apply Integrable.smul_of_top_left
· exact IntegrableOn.mono_set I ut
· apply
memℒp_top_of_bound (hmg.mono_set inter_subset_left).aestronglyMeasurable (‖a‖ + 1)
filter_upwards [self_mem_ae_restrict (hs.inter u_open.measurableSet)] with x hx
rw [inter_comm] at hx
exact (norm_lt_of_mem_ball (hu x hx)).le
convert A.union B
simp only [diff_union_inter]
#align integrable_on_peak_smul_of_integrable_on_of_continuous_within_at integrableOn_peak_smul_of_integrableOn_of_tendsto
@[deprecated (since := "2024-02-20")]
alias integrableOn_peak_smul_of_integrableOn_of_continuousWithinAt :=
integrableOn_peak_smul_of_integrableOn_of_tendsto
variable [CompleteSpace E]
| Mathlib/MeasureTheory/Integral/PeakFunction.lean | 99 | 182 | theorem tendsto_setIntegral_peak_smul_of_integrableOn_of_tendsto_aux
(hs : MeasurableSet s) (ht : MeasurableSet t) (hts : t ⊆ s) (h'ts : t ∈ 𝓝[s] x₀)
(hnφ : ∀ᶠ i in l, ∀ x ∈ s, 0 ≤ φ i x)
(hlφ : ∀ u : Set α, IsOpen u → x₀ ∈ u → TendstoUniformlyOn φ 0 l (s \ u))
(hiφ : Tendsto (fun i ↦ ∫ x in t, φ i x ∂μ) l (𝓝 1))
(h'iφ : ∀ᶠ i in l, AEStronglyMeasurable (φ i) (μ.restrict s))
(hmg : IntegrableOn g s μ) (hcg : Tendsto g (𝓝[s] x₀) (𝓝 0)) :
Tendsto (fun i : ι => ∫ x in s, φ i x • g x ∂μ) l (𝓝 0) := by |
refine Metric.tendsto_nhds.2 fun ε εpos => ?_
obtain ⟨δ, hδ, δpos, δone⟩ : ∃ δ, (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ < ε ∧ 0 < δ ∧ δ < 1:= by
have A :
Tendsto (fun δ => (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ) (𝓝[>] 0)
(𝓝 ((0 * ∫ x in s, ‖g x‖ ∂μ) + 2 * 0)) := by
apply Tendsto.mono_left _ nhdsWithin_le_nhds
exact (tendsto_id.mul tendsto_const_nhds).add (tendsto_id.const_mul _)
rw [zero_mul, zero_add, mul_zero] at A
have : Ioo (0 : ℝ) 1 ∈ 𝓝[>] 0 := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, zero_lt_one⟩
rcases (((tendsto_order.1 A).2 ε εpos).and this).exists with ⟨δ, hδ, h'δ⟩
exact ⟨δ, hδ, h'δ.1, h'δ.2⟩
suffices ∀ᶠ i in l, ‖∫ x in s, φ i x • g x ∂μ‖ ≤ (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ by
filter_upwards [this] with i hi
simp only [dist_zero_right]
exact hi.trans_lt hδ
obtain ⟨u, u_open, x₀u, ut, hu⟩ :
∃ u, IsOpen u ∧ x₀ ∈ u ∧ s ∩ u ⊆ t ∧ ∀ x ∈ u ∩ s, g x ∈ ball 0 δ := by
rcases mem_nhdsWithin.1 (Filter.inter_mem h'ts (hcg (ball_mem_nhds _ δpos)))
with ⟨u, u_open, x₀u, hu⟩
refine ⟨u, u_open, x₀u, ?_, hu.trans inter_subset_right⟩
rw [inter_comm]
exact hu.trans inter_subset_left
filter_upwards [tendstoUniformlyOn_iff.1 (hlφ u u_open x₀u) δ δpos,
(tendsto_order.1 (tendsto_iff_norm_sub_tendsto_zero.1 hiφ)).2 δ δpos, hnφ,
integrableOn_peak_smul_of_integrableOn_of_tendsto hs h'ts hlφ hiφ h'iφ hmg hcg]
with i hi h'i hφpos h''i
have I : IntegrableOn (φ i) t μ := by
apply Integrable.of_integral_ne_zero (fun h ↦ ?_)
simp [h] at h'i
linarith
have B : ‖∫ x in s ∩ u, φ i x • g x ∂μ‖ ≤ 2 * δ :=
calc
‖∫ x in s ∩ u, φ i x • g x ∂μ‖ ≤ ∫ x in s ∩ u, ‖φ i x • g x‖ ∂μ :=
norm_integral_le_integral_norm _
_ ≤ ∫ x in s ∩ u, ‖φ i x‖ * δ ∂μ := by
refine setIntegral_mono_on ?_ ?_ (hs.inter u_open.measurableSet) fun x hx => ?_
· exact IntegrableOn.mono_set h''i.norm inter_subset_left
· exact IntegrableOn.mono_set (I.norm.mul_const _) ut
rw [norm_smul]
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
rw [inter_comm] at hu
exact (mem_ball_zero_iff.1 (hu x hx)).le
_ ≤ ∫ x in t, ‖φ i x‖ * δ ∂μ := by
apply setIntegral_mono_set
· exact I.norm.mul_const _
· exact eventually_of_forall fun x => mul_nonneg (norm_nonneg _) δpos.le
· exact eventually_of_forall ut
_ = ∫ x in t, φ i x * δ ∂μ := by
apply setIntegral_congr ht fun x hx => ?_
rw [Real.norm_of_nonneg (hφpos _ (hts hx))]
_ = (∫ x in t, φ i x ∂μ) * δ := by rw [integral_mul_right]
_ ≤ 2 * δ := by gcongr; linarith [(le_abs_self _).trans h'i.le]
have C : ‖∫ x in s \ u, φ i x • g x ∂μ‖ ≤ δ * ∫ x in s, ‖g x‖ ∂μ :=
calc
‖∫ x in s \ u, φ i x • g x ∂μ‖ ≤ ∫ x in s \ u, ‖φ i x • g x‖ ∂μ :=
norm_integral_le_integral_norm _
_ ≤ ∫ x in s \ u, δ * ‖g x‖ ∂μ := by
refine setIntegral_mono_on ?_ ?_ (hs.diff u_open.measurableSet) fun x hx => ?_
· exact IntegrableOn.mono_set h''i.norm diff_subset
· exact IntegrableOn.mono_set (hmg.norm.const_mul _) diff_subset
rw [norm_smul]
apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
simpa only [Pi.zero_apply, dist_zero_left] using (hi x hx).le
_ ≤ δ * ∫ x in s, ‖g x‖ ∂μ := by
rw [integral_mul_left]
apply mul_le_mul_of_nonneg_left (setIntegral_mono_set hmg.norm _ _) δpos.le
· filter_upwards with x using norm_nonneg _
· filter_upwards using diff_subset (s := s) (t := u)
calc
‖∫ x in s, φ i x • g x ∂μ‖ =
‖(∫ x in s \ u, φ i x • g x ∂μ) + ∫ x in s ∩ u, φ i x • g x ∂μ‖ := by
conv_lhs => rw [← diff_union_inter s u]
rw [integral_union disjoint_sdiff_inter (hs.inter u_open.measurableSet)
(h''i.mono_set diff_subset) (h''i.mono_set inter_subset_left)]
_ ≤ ‖∫ x in s \ u, φ i x • g x ∂μ‖ + ‖∫ x in s ∩ u, φ i x • g x ∂μ‖ := norm_add_le _ _
_ ≤ (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ := add_le_add C B
| 76 | 1,014,800,388,113,888,700,000,000,000,000,000 | 2 | 2 | 2 | 2,209 |
import Mathlib.Topology.Constructions
import Mathlib.Topology.ContinuousOn
#align_import topology.bases from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Function Topology
noncomputable section
namespace TopologicalSpace
universe u
variable {α : Type u} {β : Type*} [t : TopologicalSpace α] {B : Set (Set α)} {s : Set α}
structure IsTopologicalBasis (s : Set (Set α)) : Prop where
exists_subset_inter : ∀ t₁ ∈ s, ∀ t₂ ∈ s, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂
sUnion_eq : ⋃₀ s = univ
eq_generateFrom : t = generateFrom s
#align topological_space.is_topological_basis TopologicalSpace.IsTopologicalBasis
| Mathlib/Topology/Bases.lean | 77 | 90 | theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (insert ∅ s) := by |
refine ⟨?_, by rw [sUnion_insert, empty_union, h.sUnion_eq], ?_⟩
· rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
· cases hx₁
· cases hx₁
· cases hx₂
· obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
exact ⟨t₃, .inr h₃, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (le_generateFrom fun t => ?_) (generateFrom_anti <| subset_insert ∅ s)
rintro (rfl | ht)
· exact @isOpen_empty _ (generateFrom s)
· exact .basic t ht
| 12 | 162,754.791419 | 2 | 2 | 5 | 2,210 |
import Mathlib.Topology.Constructions
import Mathlib.Topology.ContinuousOn
#align_import topology.bases from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Function Topology
noncomputable section
namespace TopologicalSpace
universe u
variable {α : Type u} {β : Type*} [t : TopologicalSpace α] {B : Set (Set α)} {s : Set α}
structure IsTopologicalBasis (s : Set (Set α)) : Prop where
exists_subset_inter : ∀ t₁ ∈ s, ∀ t₂ ∈ s, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂
sUnion_eq : ⋃₀ s = univ
eq_generateFrom : t = generateFrom s
#align topological_space.is_topological_basis TopologicalSpace.IsTopologicalBasis
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (insert ∅ s) := by
refine ⟨?_, by rw [sUnion_insert, empty_union, h.sUnion_eq], ?_⟩
· rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
· cases hx₁
· cases hx₁
· cases hx₂
· obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
exact ⟨t₃, .inr h₃, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (le_generateFrom fun t => ?_) (generateFrom_anti <| subset_insert ∅ s)
rintro (rfl | ht)
· exact @isOpen_empty _ (generateFrom s)
· exact .basic t ht
#align topological_space.is_topological_basis.insert_empty TopologicalSpace.IsTopologicalBasis.insert_empty
| Mathlib/Topology/Bases.lean | 93 | 103 | theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (s \ {∅}) := by |
refine ⟨?_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], ?_⟩
· rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (generateFrom_anti diff_subset) (le_generateFrom fun t ht => ?_)
obtain rfl | he := eq_or_ne t ∅
· exact @isOpen_empty _ (generateFrom _)
· exact .basic t ⟨ht, he⟩
| 9 | 8,103.083928 | 2 | 2 | 5 | 2,210 |
import Mathlib.Topology.Constructions
import Mathlib.Topology.ContinuousOn
#align_import topology.bases from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Function Topology
noncomputable section
namespace TopologicalSpace
universe u
variable {α : Type u} {β : Type*} [t : TopologicalSpace α] {B : Set (Set α)} {s : Set α}
structure IsTopologicalBasis (s : Set (Set α)) : Prop where
exists_subset_inter : ∀ t₁ ∈ s, ∀ t₂ ∈ s, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂
sUnion_eq : ⋃₀ s = univ
eq_generateFrom : t = generateFrom s
#align topological_space.is_topological_basis TopologicalSpace.IsTopologicalBasis
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (insert ∅ s) := by
refine ⟨?_, by rw [sUnion_insert, empty_union, h.sUnion_eq], ?_⟩
· rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
· cases hx₁
· cases hx₁
· cases hx₂
· obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
exact ⟨t₃, .inr h₃, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (le_generateFrom fun t => ?_) (generateFrom_anti <| subset_insert ∅ s)
rintro (rfl | ht)
· exact @isOpen_empty _ (generateFrom s)
· exact .basic t ht
#align topological_space.is_topological_basis.insert_empty TopologicalSpace.IsTopologicalBasis.insert_empty
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (s \ {∅}) := by
refine ⟨?_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], ?_⟩
· rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (generateFrom_anti diff_subset) (le_generateFrom fun t ht => ?_)
obtain rfl | he := eq_or_ne t ∅
· exact @isOpen_empty _ (generateFrom _)
· exact .basic t ⟨ht, he⟩
#align topological_space.is_topological_basis.diff_empty TopologicalSpace.IsTopologicalBasis.diff_empty
| Mathlib/Topology/Bases.lean | 108 | 119 | theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by |
subst t; letI := generateFrom s
refine ⟨?_, ?_, le_antisymm (le_generateFrom ?_) <| generateFrom_anti fun t ht => ?_⟩
· rintro _ ⟨t₁, ⟨hft₁, ht₁b⟩, rfl⟩ _ ⟨t₂, ⟨hft₂, ht₂b⟩, rfl⟩ x h
exact ⟨_, ⟨_, ⟨hft₁.union hft₂, union_subset ht₁b ht₂b⟩, sInter_union t₁ t₂⟩, h, Subset.rfl⟩
· rw [sUnion_image, iUnion₂_eq_univ_iff]
exact fun x => ⟨∅, ⟨finite_empty, empty_subset _⟩, sInter_empty.substr <| mem_univ x⟩
· rintro _ ⟨t, ⟨hft, htb⟩, rfl⟩
exact hft.isOpen_sInter fun s hs ↦ GenerateOpen.basic _ <| htb hs
· rw [← sInter_singleton t]
exact ⟨{t}, ⟨finite_singleton t, singleton_subset_iff.2 ht⟩, rfl⟩
| 10 | 22,026.465795 | 2 | 2 | 5 | 2,210 |
import Mathlib.Topology.Constructions
import Mathlib.Topology.ContinuousOn
#align_import topology.bases from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Function Topology
noncomputable section
namespace TopologicalSpace
universe u
variable {α : Type u} {β : Type*} [t : TopologicalSpace α] {B : Set (Set α)} {s : Set α}
structure IsTopologicalBasis (s : Set (Set α)) : Prop where
exists_subset_inter : ∀ t₁ ∈ s, ∀ t₂ ∈ s, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂
sUnion_eq : ⋃₀ s = univ
eq_generateFrom : t = generateFrom s
#align topological_space.is_topological_basis TopologicalSpace.IsTopologicalBasis
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (insert ∅ s) := by
refine ⟨?_, by rw [sUnion_insert, empty_union, h.sUnion_eq], ?_⟩
· rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
· cases hx₁
· cases hx₁
· cases hx₂
· obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
exact ⟨t₃, .inr h₃, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (le_generateFrom fun t => ?_) (generateFrom_anti <| subset_insert ∅ s)
rintro (rfl | ht)
· exact @isOpen_empty _ (generateFrom s)
· exact .basic t ht
#align topological_space.is_topological_basis.insert_empty TopologicalSpace.IsTopologicalBasis.insert_empty
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (s \ {∅}) := by
refine ⟨?_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], ?_⟩
· rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (generateFrom_anti diff_subset) (le_generateFrom fun t ht => ?_)
obtain rfl | he := eq_or_ne t ∅
· exact @isOpen_empty _ (generateFrom _)
· exact .basic t ⟨ht, he⟩
#align topological_space.is_topological_basis.diff_empty TopologicalSpace.IsTopologicalBasis.diff_empty
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
subst t; letI := generateFrom s
refine ⟨?_, ?_, le_antisymm (le_generateFrom ?_) <| generateFrom_anti fun t ht => ?_⟩
· rintro _ ⟨t₁, ⟨hft₁, ht₁b⟩, rfl⟩ _ ⟨t₂, ⟨hft₂, ht₂b⟩, rfl⟩ x h
exact ⟨_, ⟨_, ⟨hft₁.union hft₂, union_subset ht₁b ht₂b⟩, sInter_union t₁ t₂⟩, h, Subset.rfl⟩
· rw [sUnion_image, iUnion₂_eq_univ_iff]
exact fun x => ⟨∅, ⟨finite_empty, empty_subset _⟩, sInter_empty.substr <| mem_univ x⟩
· rintro _ ⟨t, ⟨hft, htb⟩, rfl⟩
exact hft.isOpen_sInter fun s hs ↦ GenerateOpen.basic _ <| htb hs
· rw [← sInter_singleton t]
exact ⟨{t}, ⟨finite_singleton t, singleton_subset_iff.2 ht⟩, rfl⟩
#align topological_space.is_topological_basis_of_subbasis TopologicalSpace.isTopologicalBasis_of_subbasis
| Mathlib/Topology/Bases.lean | 122 | 129 | theorem IsTopologicalBasis.of_hasBasis_nhds {s : Set (Set α)}
(h_nhds : ∀ a, (𝓝 a).HasBasis (fun t ↦ t ∈ s ∧ a ∈ t) id) : IsTopologicalBasis s where
exists_subset_inter t₁ ht₁ t₂ ht₂ x hx := by |
simpa only [and_assoc, (h_nhds x).mem_iff]
using (inter_mem ((h_nhds _).mem_of_mem ⟨ht₁, hx.1⟩) ((h_nhds _).mem_of_mem ⟨ht₂, hx.2⟩))
sUnion_eq := sUnion_eq_univ_iff.2 fun x ↦ (h_nhds x).ex_mem
eq_generateFrom := ext_nhds fun x ↦ by
simpa only [nhds_generateFrom, and_comm] using (h_nhds x).eq_biInf
| 5 | 148.413159 | 2 | 2 | 5 | 2,210 |
import Mathlib.Topology.Constructions
import Mathlib.Topology.ContinuousOn
#align_import topology.bases from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Function Topology
noncomputable section
namespace TopologicalSpace
universe u
variable {α : Type u} {β : Type*} [t : TopologicalSpace α] {B : Set (Set α)} {s : Set α}
structure IsTopologicalBasis (s : Set (Set α)) : Prop where
exists_subset_inter : ∀ t₁ ∈ s, ∀ t₂ ∈ s, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂
sUnion_eq : ⋃₀ s = univ
eq_generateFrom : t = generateFrom s
#align topological_space.is_topological_basis TopologicalSpace.IsTopologicalBasis
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (insert ∅ s) := by
refine ⟨?_, by rw [sUnion_insert, empty_union, h.sUnion_eq], ?_⟩
· rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
· cases hx₁
· cases hx₁
· cases hx₂
· obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
exact ⟨t₃, .inr h₃, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (le_generateFrom fun t => ?_) (generateFrom_anti <| subset_insert ∅ s)
rintro (rfl | ht)
· exact @isOpen_empty _ (generateFrom s)
· exact .basic t ht
#align topological_space.is_topological_basis.insert_empty TopologicalSpace.IsTopologicalBasis.insert_empty
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (s \ {∅}) := by
refine ⟨?_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], ?_⟩
· rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
· rw [h.eq_generateFrom]
refine le_antisymm (generateFrom_anti diff_subset) (le_generateFrom fun t ht => ?_)
obtain rfl | he := eq_or_ne t ∅
· exact @isOpen_empty _ (generateFrom _)
· exact .basic t ⟨ht, he⟩
#align topological_space.is_topological_basis.diff_empty TopologicalSpace.IsTopologicalBasis.diff_empty
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
subst t; letI := generateFrom s
refine ⟨?_, ?_, le_antisymm (le_generateFrom ?_) <| generateFrom_anti fun t ht => ?_⟩
· rintro _ ⟨t₁, ⟨hft₁, ht₁b⟩, rfl⟩ _ ⟨t₂, ⟨hft₂, ht₂b⟩, rfl⟩ x h
exact ⟨_, ⟨_, ⟨hft₁.union hft₂, union_subset ht₁b ht₂b⟩, sInter_union t₁ t₂⟩, h, Subset.rfl⟩
· rw [sUnion_image, iUnion₂_eq_univ_iff]
exact fun x => ⟨∅, ⟨finite_empty, empty_subset _⟩, sInter_empty.substr <| mem_univ x⟩
· rintro _ ⟨t, ⟨hft, htb⟩, rfl⟩
exact hft.isOpen_sInter fun s hs ↦ GenerateOpen.basic _ <| htb hs
· rw [← sInter_singleton t]
exact ⟨{t}, ⟨finite_singleton t, singleton_subset_iff.2 ht⟩, rfl⟩
#align topological_space.is_topological_basis_of_subbasis TopologicalSpace.isTopologicalBasis_of_subbasis
theorem IsTopologicalBasis.of_hasBasis_nhds {s : Set (Set α)}
(h_nhds : ∀ a, (𝓝 a).HasBasis (fun t ↦ t ∈ s ∧ a ∈ t) id) : IsTopologicalBasis s where
exists_subset_inter t₁ ht₁ t₂ ht₂ x hx := by
simpa only [and_assoc, (h_nhds x).mem_iff]
using (inter_mem ((h_nhds _).mem_of_mem ⟨ht₁, hx.1⟩) ((h_nhds _).mem_of_mem ⟨ht₂, hx.2⟩))
sUnion_eq := sUnion_eq_univ_iff.2 fun x ↦ (h_nhds x).ex_mem
eq_generateFrom := ext_nhds fun x ↦ by
simpa only [nhds_generateFrom, and_comm] using (h_nhds x).eq_biInf
theorem isTopologicalBasis_of_isOpen_of_nhds {s : Set (Set α)} (h_open : ∀ u ∈ s, IsOpen u)
(h_nhds : ∀ (a : α) (u : Set α), a ∈ u → IsOpen u → ∃ v ∈ s, a ∈ v ∧ v ⊆ u) :
IsTopologicalBasis s :=
.of_hasBasis_nhds <| fun a ↦
(nhds_basis_opens a).to_hasBasis' (by simpa [and_assoc] using h_nhds a)
fun t ⟨hts, hat⟩ ↦ (h_open _ hts).mem_nhds hat
#align topological_space.is_topological_basis_of_open_of_nhds TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
| Mathlib/Topology/Bases.lean | 143 | 153 | theorem IsTopologicalBasis.mem_nhds_iff {a : α} {s : Set α} {b : Set (Set α)}
(hb : IsTopologicalBasis b) : s ∈ 𝓝 a ↔ ∃ t ∈ b, a ∈ t ∧ t ⊆ s := by |
change s ∈ (𝓝 a).sets ↔ ∃ t ∈ b, a ∈ t ∧ t ⊆ s
rw [hb.eq_generateFrom, nhds_generateFrom, biInf_sets_eq]
· simp [and_assoc, and_left_comm]
· rintro s ⟨hs₁, hs₂⟩ t ⟨ht₁, ht₂⟩
let ⟨u, hu₁, hu₂, hu₃⟩ := hb.1 _ hs₂ _ ht₂ _ ⟨hs₁, ht₁⟩
exact ⟨u, ⟨hu₂, hu₁⟩, le_principal_iff.2 (hu₃.trans inter_subset_left),
le_principal_iff.2 (hu₃.trans inter_subset_right)⟩
· rcases eq_univ_iff_forall.1 hb.sUnion_eq a with ⟨i, h1, h2⟩
exact ⟨i, h2, h1⟩
| 9 | 8,103.083928 | 2 | 2 | 5 | 2,210 |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Conj
universe w v u
namespace CategoryTheory.Limits.Types
variable (C : Type u) [Category.{v} C]
def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1}
@[simps]
def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where
pt := PUnit
ι := { app := fun X => id }
noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where
desc s := s.ι.app Classical.ofNonempty
fac s j := by
ext ⟨⟩
apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit)
intros X Y f
exact congrFun (s.ι.naturality f).symm PUnit.unit
uniq s m h := by
ext ⟨⟩
simp [← h Classical.ofNonempty]
instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) :=
⟨_, isColimitPUnitCocone _⟩
instance instSubsingletonColimitPUnit
[IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] :
Subsingleton (colimit (constPUnitFunctor.{w} C)) where
allEq a b := by
obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a
obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b
apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit)
exact fun c d f => colimit_sound f rfl
noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] :
colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
| Mathlib/CategoryTheory/Limits/IsConnected.lean | 87 | 93 | theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j)
(h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by |
induction h with
| rel _ _ h => exact Zigzag.of_hom <| Exists.choose h
| refl _ => exact Zigzag.refl _
| symm _ _ _ ih => exact zigzag_symmetric ih
| trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
| 5 | 148.413159 | 2 | 2 | 4 | 2,211 |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Conj
universe w v u
namespace CategoryTheory.Limits.Types
variable (C : Type u) [Category.{v} C]
def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1}
@[simps]
def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where
pt := PUnit
ι := { app := fun X => id }
noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where
desc s := s.ι.app Classical.ofNonempty
fac s j := by
ext ⟨⟩
apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit)
intros X Y f
exact congrFun (s.ι.naturality f).symm PUnit.unit
uniq s m h := by
ext ⟨⟩
simp [← h Classical.ofNonempty]
instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) :=
⟨_, isColimitPUnitCocone _⟩
instance instSubsingletonColimitPUnit
[IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] :
Subsingleton (colimit (constPUnitFunctor.{w} C)) where
allEq a b := by
obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a
obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b
apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit)
exact fun c d f => colimit_sound f rfl
noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] :
colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j)
(h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by
induction h with
| rel _ _ h => exact Zigzag.of_hom <| Exists.choose h
| refl _ => exact Zigzag.refl _
| symm _ _ _ ih => exact zigzag_symmetric ih
| trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
| Mathlib/CategoryTheory/Limits/IsConnected.lean | 97 | 104 | theorem isConnected_iff_colimit_constPUnitFunctor_iso_pUnit
[HasColimit (constPUnitFunctor.{w} C)] :
IsConnected C ↔ Nonempty (colimit (constPUnitFunctor.{w} C) ≅ PUnit) := by |
refine ⟨fun _ => ⟨colimitConstPUnitIsoPUnit.{w} C⟩, fun ⟨h⟩ => ?_⟩
have : Nonempty C := nonempty_of_nonempty_colimit <| Nonempty.map h.inv inferInstance
refine zigzag_isConnected <| fun c d => ?_
refine zigzag_of_eqvGen_quot_rel _ (constPUnitFunctor C) ⟨c, PUnit.unit⟩ ⟨d, PUnit.unit⟩ ?_
exact colimit_eq <| h.toEquiv.injective rfl
| 5 | 148.413159 | 2 | 2 | 4 | 2,211 |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Conj
universe w v u
namespace CategoryTheory.Limits.Types
variable (C : Type u) [Category.{v} C]
def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1}
@[simps]
def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where
pt := PUnit
ι := { app := fun X => id }
noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where
desc s := s.ι.app Classical.ofNonempty
fac s j := by
ext ⟨⟩
apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit)
intros X Y f
exact congrFun (s.ι.naturality f).symm PUnit.unit
uniq s m h := by
ext ⟨⟩
simp [← h Classical.ofNonempty]
instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) :=
⟨_, isColimitPUnitCocone _⟩
instance instSubsingletonColimitPUnit
[IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] :
Subsingleton (colimit (constPUnitFunctor.{w} C)) where
allEq a b := by
obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a
obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b
apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit)
exact fun c d f => colimit_sound f rfl
noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] :
colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j)
(h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by
induction h with
| rel _ _ h => exact Zigzag.of_hom <| Exists.choose h
| refl _ => exact Zigzag.refl _
| symm _ _ _ ih => exact zigzag_symmetric ih
| trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
theorem isConnected_iff_colimit_constPUnitFunctor_iso_pUnit
[HasColimit (constPUnitFunctor.{w} C)] :
IsConnected C ↔ Nonempty (colimit (constPUnitFunctor.{w} C) ≅ PUnit) := by
refine ⟨fun _ => ⟨colimitConstPUnitIsoPUnit.{w} C⟩, fun ⟨h⟩ => ?_⟩
have : Nonempty C := nonempty_of_nonempty_colimit <| Nonempty.map h.inv inferInstance
refine zigzag_isConnected <| fun c d => ?_
refine zigzag_of_eqvGen_quot_rel _ (constPUnitFunctor C) ⟨c, PUnit.unit⟩ ⟨d, PUnit.unit⟩ ?_
exact colimit_eq <| h.toEquiv.injective rfl
| Mathlib/CategoryTheory/Limits/IsConnected.lean | 106 | 112 | theorem isConnected_iff_isColimit_pUnitCocone :
IsConnected C ↔ Nonempty (IsColimit (pUnitCocone.{w} C)) := by |
refine ⟨fun inst => ⟨isColimitPUnitCocone C⟩, fun ⟨h⟩ => ?_⟩
let colimitCocone : ColimitCocone (constPUnitFunctor C) := ⟨pUnitCocone.{w} C, h⟩
have : HasColimit (constPUnitFunctor.{w} C) := ⟨⟨colimitCocone⟩⟩
simp only [isConnected_iff_colimit_constPUnitFunctor_iso_pUnit.{w} C]
exact ⟨colimit.isoColimitCocone colimitCocone⟩
| 5 | 148.413159 | 2 | 2 | 4 | 2,211 |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Conj
universe w v u
namespace CategoryTheory.Limits.Types
variable (C : Type u) [Category.{v} C]
def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1}
@[simps]
def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where
pt := PUnit
ι := { app := fun X => id }
noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where
desc s := s.ι.app Classical.ofNonempty
fac s j := by
ext ⟨⟩
apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit)
intros X Y f
exact congrFun (s.ι.naturality f).symm PUnit.unit
uniq s m h := by
ext ⟨⟩
simp [← h Classical.ofNonempty]
instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) :=
⟨_, isColimitPUnitCocone _⟩
instance instSubsingletonColimitPUnit
[IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] :
Subsingleton (colimit (constPUnitFunctor.{w} C)) where
allEq a b := by
obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a
obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b
apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit)
exact fun c d f => colimit_sound f rfl
noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] :
colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j)
(h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by
induction h with
| rel _ _ h => exact Zigzag.of_hom <| Exists.choose h
| refl _ => exact Zigzag.refl _
| symm _ _ _ ih => exact zigzag_symmetric ih
| trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
theorem isConnected_iff_colimit_constPUnitFunctor_iso_pUnit
[HasColimit (constPUnitFunctor.{w} C)] :
IsConnected C ↔ Nonempty (colimit (constPUnitFunctor.{w} C) ≅ PUnit) := by
refine ⟨fun _ => ⟨colimitConstPUnitIsoPUnit.{w} C⟩, fun ⟨h⟩ => ?_⟩
have : Nonempty C := nonempty_of_nonempty_colimit <| Nonempty.map h.inv inferInstance
refine zigzag_isConnected <| fun c d => ?_
refine zigzag_of_eqvGen_quot_rel _ (constPUnitFunctor C) ⟨c, PUnit.unit⟩ ⟨d, PUnit.unit⟩ ?_
exact colimit_eq <| h.toEquiv.injective rfl
theorem isConnected_iff_isColimit_pUnitCocone :
IsConnected C ↔ Nonempty (IsColimit (pUnitCocone.{w} C)) := by
refine ⟨fun inst => ⟨isColimitPUnitCocone C⟩, fun ⟨h⟩ => ?_⟩
let colimitCocone : ColimitCocone (constPUnitFunctor C) := ⟨pUnitCocone.{w} C, h⟩
have : HasColimit (constPUnitFunctor.{w} C) := ⟨⟨colimitCocone⟩⟩
simp only [isConnected_iff_colimit_constPUnitFunctor_iso_pUnit.{w} C]
exact ⟨colimit.isoColimitCocone colimitCocone⟩
universe v₂ u₂
variable {C : Type u} {D: Type u₂} [Category.{v} C] [Category.{v₂} D]
| Mathlib/CategoryTheory/Limits/IsConnected.lean | 118 | 123 | theorem isConnected_iff_of_final (F : C ⥤ D) [CategoryTheory.Functor.Final F] :
IsConnected C ↔ IsConnected D := by |
rw [isConnected_iff_colimit_constPUnitFunctor_iso_pUnit.{max v u v₂ u₂} C,
isConnected_iff_colimit_constPUnitFunctor_iso_pUnit.{max v u v₂ u₂} D]
exact Equiv.nonempty_congr <| Iso.isoCongrLeft <|
CategoryTheory.Functor.Final.colimitIso F <| constPUnitFunctor.{max u v u₂ v₂} D
| 4 | 54.59815 | 2 | 2 | 4 | 2,211 |
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic
import Mathlib.Topology.NoetherianSpace
#align_import algebraic_geometry.prime_spectrum.noetherian from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301"
universe u v
namespace PrimeSpectrum
open Submodule
variable (R : Type u) [CommRing R] [IsNoetherianRing R]
variable {A : Type u} [CommRing A] [IsDomain A] [IsNoetherianRing A]
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Noetherian.lean | 27 | 54 | theorem exists_primeSpectrum_prod_le (I : Ideal R) :
∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I := by |
-- Porting note: Need to specify `P` explicitly
refine IsNoetherian.induction
(P := fun I => ∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I)
(fun (M : Ideal R) hgt => ?_) I
by_cases h_prM : M.IsPrime
· use {⟨M, h_prM⟩}
rw [Multiset.map_singleton, Multiset.prod_singleton]
by_cases htop : M = ⊤
· rw [htop]
exact ⟨0, le_top⟩
have lt_add : ∀ z ∉ M, M < M + span R {z} := by
intro z hz
refine lt_of_le_of_ne le_sup_left fun m_eq => hz ?_
rw [m_eq]
exact Ideal.mem_sup_right (mem_span_singleton_self z)
obtain ⟨x, hx, y, hy, hxy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left htop
obtain ⟨Wx, h_Wx⟩ := hgt (M + span R {x}) (lt_add _ hx)
obtain ⟨Wy, h_Wy⟩ := hgt (M + span R {y}) (lt_add _ hy)
use Wx + Wy
rw [Multiset.map_add, Multiset.prod_add]
apply le_trans (Submodule.mul_le_mul h_Wx h_Wy)
rw [add_mul]
apply sup_le (show M * (M + span R {y}) ≤ M from Ideal.mul_le_right)
rw [mul_add]
apply sup_le (show span R {x} * M ≤ M from Ideal.mul_le_left)
rwa [span_mul_span, Set.singleton_mul_singleton, span_singleton_le_iff_mem]
| 26 | 195,729,609,428.83878 | 2 | 2 | 2 | 2,212 |
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic
import Mathlib.Topology.NoetherianSpace
#align_import algebraic_geometry.prime_spectrum.noetherian from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301"
universe u v
namespace PrimeSpectrum
open Submodule
variable (R : Type u) [CommRing R] [IsNoetherianRing R]
variable {A : Type u} [CommRing A] [IsDomain A] [IsNoetherianRing A]
theorem exists_primeSpectrum_prod_le (I : Ideal R) :
∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I := by
-- Porting note: Need to specify `P` explicitly
refine IsNoetherian.induction
(P := fun I => ∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I)
(fun (M : Ideal R) hgt => ?_) I
by_cases h_prM : M.IsPrime
· use {⟨M, h_prM⟩}
rw [Multiset.map_singleton, Multiset.prod_singleton]
by_cases htop : M = ⊤
· rw [htop]
exact ⟨0, le_top⟩
have lt_add : ∀ z ∉ M, M < M + span R {z} := by
intro z hz
refine lt_of_le_of_ne le_sup_left fun m_eq => hz ?_
rw [m_eq]
exact Ideal.mem_sup_right (mem_span_singleton_self z)
obtain ⟨x, hx, y, hy, hxy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left htop
obtain ⟨Wx, h_Wx⟩ := hgt (M + span R {x}) (lt_add _ hx)
obtain ⟨Wy, h_Wy⟩ := hgt (M + span R {y}) (lt_add _ hy)
use Wx + Wy
rw [Multiset.map_add, Multiset.prod_add]
apply le_trans (Submodule.mul_le_mul h_Wx h_Wy)
rw [add_mul]
apply sup_le (show M * (M + span R {y}) ≤ M from Ideal.mul_le_right)
rw [mul_add]
apply sup_le (show span R {x} * M ≤ M from Ideal.mul_le_left)
rwa [span_mul_span, Set.singleton_mul_singleton, span_singleton_le_iff_mem]
#align prime_spectrum.exists_prime_spectrum_prod_le PrimeSpectrum.exists_primeSpectrum_prod_le
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Noetherian.lean | 60 | 97 | theorem exists_primeSpectrum_prod_le_and_ne_bot_of_domain (h_fA : ¬IsField A) {I : Ideal A}
(h_nzI : I ≠ ⊥) :
∃ Z : Multiset (PrimeSpectrum A),
Multiset.prod (Z.map asIdeal) ≤ I ∧ Multiset.prod (Z.map asIdeal) ≠ ⊥ := by |
revert h_nzI
-- Porting note: Need to specify `P` explicitly
refine IsNoetherian.induction (P := fun I => I ≠ ⊥ → ∃ Z : Multiset (PrimeSpectrum A),
Multiset.prod (Z.map asIdeal) ≤ I ∧ Multiset.prod (Z.map asIdeal) ≠ ⊥)
(fun (M : Ideal A) hgt => ?_) I
intro h_nzM
have hA_nont : Nontrivial A := IsDomain.toNontrivial
by_cases h_topM : M = ⊤
· rcases h_topM with rfl
obtain ⟨p_id, h_nzp, h_pp⟩ : ∃ p : Ideal A, p ≠ ⊥ ∧ p.IsPrime := by
apply Ring.not_isField_iff_exists_prime.mp h_fA
use ({⟨p_id, h_pp⟩} : Multiset (PrimeSpectrum A)), le_top
rwa [Multiset.map_singleton, Multiset.prod_singleton]
by_cases h_prM : M.IsPrime
· use ({⟨M, h_prM⟩} : Multiset (PrimeSpectrum A))
rw [Multiset.map_singleton, Multiset.prod_singleton]
exact ⟨le_rfl, h_nzM⟩
obtain ⟨x, hx, y, hy, h_xy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left h_topM
have lt_add : ∀ z ∉ M, M < M + span A {z} := by
intro z hz
refine lt_of_le_of_ne le_sup_left fun m_eq => hz ?_
rw [m_eq]
exact mem_sup_right (mem_span_singleton_self z)
obtain ⟨Wx, h_Wx_le, h_Wx_ne⟩ := hgt (M + span A {x}) (lt_add _ hx) (ne_bot_of_gt (lt_add _ hx))
obtain ⟨Wy, h_Wy_le, h_Wx_ne⟩ := hgt (M + span A {y}) (lt_add _ hy) (ne_bot_of_gt (lt_add _ hy))
use Wx + Wy
rw [Multiset.map_add, Multiset.prod_add]
refine ⟨le_trans (Submodule.mul_le_mul h_Wx_le h_Wy_le) ?_, mt Ideal.mul_eq_bot.mp ?_⟩
· rw [add_mul]
apply sup_le (show M * (M + span A {y}) ≤ M from Ideal.mul_le_right)
rw [mul_add]
apply sup_le (show span A {x} * M ≤ M from Ideal.mul_le_left)
rwa [span_mul_span, Set.singleton_mul_singleton, span_singleton_le_iff_mem]
· rintro (hx | hy) <;> contradiction
| 34 | 583,461,742,527,454.9 | 2 | 2 | 2 | 2,212 |
import Mathlib.Analysis.Complex.AbsMax
import Mathlib.Analysis.Complex.RemovableSingularity
#align_import analysis.complex.schwarz from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Metric Set Function Filter TopologicalSpace
open scoped Topology
namespace Complex
section Space
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {R R₁ R₂ : ℝ} {f : ℂ → E}
{c z z₀ : ℂ}
| Mathlib/Analysis/Complex/Schwarz.lean | 65 | 88 | theorem schwarz_aux {f : ℂ → ℂ} (hd : DifferentiableOn ℂ f (ball c R₁))
(h_maps : MapsTo f (ball c R₁) (ball (f c) R₂)) (hz : z ∈ ball c R₁) :
‖dslope f c z‖ ≤ R₂ / R₁ := by |
have hR₁ : 0 < R₁ := nonempty_ball.1 ⟨z, hz⟩
suffices ∀ᶠ r in 𝓝[<] R₁, ‖dslope f c z‖ ≤ R₂ / r by
refine ge_of_tendsto ?_ this
exact (tendsto_const_nhds.div tendsto_id hR₁.ne').mono_left nhdsWithin_le_nhds
rw [mem_ball] at hz
filter_upwards [Ioo_mem_nhdsWithin_Iio ⟨hz, le_rfl⟩] with r hr
have hr₀ : 0 < r := dist_nonneg.trans_lt hr.1
replace hd : DiffContOnCl ℂ (dslope f c) (ball c r) := by
refine DifferentiableOn.diffContOnCl ?_
rw [closure_ball c hr₀.ne']
exact ((differentiableOn_dslope <| ball_mem_nhds _ hR₁).mpr hd).mono
(closedBall_subset_ball hr.2)
refine norm_le_of_forall_mem_frontier_norm_le isBounded_ball hd ?_ ?_
· rw [frontier_ball c hr₀.ne']
intro z hz
have hz' : z ≠ c := ne_of_mem_sphere hz hr₀.ne'
rw [dslope_of_ne _ hz', slope_def_module, norm_smul, norm_inv, mem_sphere_iff_norm.1 hz, ←
div_eq_inv_mul, div_le_div_right hr₀, ← dist_eq_norm]
exact le_of_lt (h_maps (mem_ball.2 (by rw [mem_sphere.1 hz]; exact hr.2)))
· rw [closure_ball c hr₀.ne', mem_closedBall]
exact hr.1.le
| 21 | 1,318,815,734.483215 | 2 | 2 | 3 | 2,213 |
import Mathlib.Analysis.Complex.AbsMax
import Mathlib.Analysis.Complex.RemovableSingularity
#align_import analysis.complex.schwarz from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Metric Set Function Filter TopologicalSpace
open scoped Topology
namespace Complex
section Space
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {R R₁ R₂ : ℝ} {f : ℂ → E}
{c z z₀ : ℂ}
theorem schwarz_aux {f : ℂ → ℂ} (hd : DifferentiableOn ℂ f (ball c R₁))
(h_maps : MapsTo f (ball c R₁) (ball (f c) R₂)) (hz : z ∈ ball c R₁) :
‖dslope f c z‖ ≤ R₂ / R₁ := by
have hR₁ : 0 < R₁ := nonempty_ball.1 ⟨z, hz⟩
suffices ∀ᶠ r in 𝓝[<] R₁, ‖dslope f c z‖ ≤ R₂ / r by
refine ge_of_tendsto ?_ this
exact (tendsto_const_nhds.div tendsto_id hR₁.ne').mono_left nhdsWithin_le_nhds
rw [mem_ball] at hz
filter_upwards [Ioo_mem_nhdsWithin_Iio ⟨hz, le_rfl⟩] with r hr
have hr₀ : 0 < r := dist_nonneg.trans_lt hr.1
replace hd : DiffContOnCl ℂ (dslope f c) (ball c r) := by
refine DifferentiableOn.diffContOnCl ?_
rw [closure_ball c hr₀.ne']
exact ((differentiableOn_dslope <| ball_mem_nhds _ hR₁).mpr hd).mono
(closedBall_subset_ball hr.2)
refine norm_le_of_forall_mem_frontier_norm_le isBounded_ball hd ?_ ?_
· rw [frontier_ball c hr₀.ne']
intro z hz
have hz' : z ≠ c := ne_of_mem_sphere hz hr₀.ne'
rw [dslope_of_ne _ hz', slope_def_module, norm_smul, norm_inv, mem_sphere_iff_norm.1 hz, ←
div_eq_inv_mul, div_le_div_right hr₀, ← dist_eq_norm]
exact le_of_lt (h_maps (mem_ball.2 (by rw [mem_sphere.1 hz]; exact hr.2)))
· rw [closure_ball c hr₀.ne', mem_closedBall]
exact hr.1.le
#align complex.schwarz_aux Complex.schwarz_aux
| Mathlib/Analysis/Complex/Schwarz.lean | 92 | 108 | theorem norm_dslope_le_div_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
(h_maps : MapsTo f (ball c R₁) (ball (f c) R₂)) (hz : z ∈ ball c R₁) :
‖dslope f c z‖ ≤ R₂ / R₁ := by |
have hR₁ : 0 < R₁ := nonempty_ball.1 ⟨z, hz⟩
have hR₂ : 0 < R₂ := nonempty_ball.1 ⟨f z, h_maps hz⟩
rcases eq_or_ne (dslope f c z) 0 with hc | hc
· rw [hc, norm_zero]; exact div_nonneg hR₂.le hR₁.le
rcases exists_dual_vector ℂ _ hc with ⟨g, hg, hgf⟩
have hg' : ‖g‖₊ = 1 := NNReal.eq hg
have hg₀ : ‖g‖₊ ≠ 0 := by simpa only [hg'] using one_ne_zero
calc
‖dslope f c z‖ = ‖dslope (g ∘ f) c z‖ := by
rw [g.dslope_comp, hgf, RCLike.norm_ofReal, abs_norm]
exact fun _ => hd.differentiableAt (ball_mem_nhds _ hR₁)
_ ≤ R₂ / R₁ := by
refine schwarz_aux (g.differentiable.comp_differentiableOn hd) (MapsTo.comp ?_ h_maps) hz
simpa only [hg', NNReal.coe_one, one_mul] using g.lipschitz.mapsTo_ball hg₀ (f c) R₂
| 14 | 1,202,604.284165 | 2 | 2 | 3 | 2,213 |
import Mathlib.Analysis.Complex.AbsMax
import Mathlib.Analysis.Complex.RemovableSingularity
#align_import analysis.complex.schwarz from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Metric Set Function Filter TopologicalSpace
open scoped Topology
namespace Complex
section Space
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {R R₁ R₂ : ℝ} {f : ℂ → E}
{c z z₀ : ℂ}
theorem schwarz_aux {f : ℂ → ℂ} (hd : DifferentiableOn ℂ f (ball c R₁))
(h_maps : MapsTo f (ball c R₁) (ball (f c) R₂)) (hz : z ∈ ball c R₁) :
‖dslope f c z‖ ≤ R₂ / R₁ := by
have hR₁ : 0 < R₁ := nonempty_ball.1 ⟨z, hz⟩
suffices ∀ᶠ r in 𝓝[<] R₁, ‖dslope f c z‖ ≤ R₂ / r by
refine ge_of_tendsto ?_ this
exact (tendsto_const_nhds.div tendsto_id hR₁.ne').mono_left nhdsWithin_le_nhds
rw [mem_ball] at hz
filter_upwards [Ioo_mem_nhdsWithin_Iio ⟨hz, le_rfl⟩] with r hr
have hr₀ : 0 < r := dist_nonneg.trans_lt hr.1
replace hd : DiffContOnCl ℂ (dslope f c) (ball c r) := by
refine DifferentiableOn.diffContOnCl ?_
rw [closure_ball c hr₀.ne']
exact ((differentiableOn_dslope <| ball_mem_nhds _ hR₁).mpr hd).mono
(closedBall_subset_ball hr.2)
refine norm_le_of_forall_mem_frontier_norm_le isBounded_ball hd ?_ ?_
· rw [frontier_ball c hr₀.ne']
intro z hz
have hz' : z ≠ c := ne_of_mem_sphere hz hr₀.ne'
rw [dslope_of_ne _ hz', slope_def_module, norm_smul, norm_inv, mem_sphere_iff_norm.1 hz, ←
div_eq_inv_mul, div_le_div_right hr₀, ← dist_eq_norm]
exact le_of_lt (h_maps (mem_ball.2 (by rw [mem_sphere.1 hz]; exact hr.2)))
· rw [closure_ball c hr₀.ne', mem_closedBall]
exact hr.1.le
#align complex.schwarz_aux Complex.schwarz_aux
theorem norm_dslope_le_div_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
(h_maps : MapsTo f (ball c R₁) (ball (f c) R₂)) (hz : z ∈ ball c R₁) :
‖dslope f c z‖ ≤ R₂ / R₁ := by
have hR₁ : 0 < R₁ := nonempty_ball.1 ⟨z, hz⟩
have hR₂ : 0 < R₂ := nonempty_ball.1 ⟨f z, h_maps hz⟩
rcases eq_or_ne (dslope f c z) 0 with hc | hc
· rw [hc, norm_zero]; exact div_nonneg hR₂.le hR₁.le
rcases exists_dual_vector ℂ _ hc with ⟨g, hg, hgf⟩
have hg' : ‖g‖₊ = 1 := NNReal.eq hg
have hg₀ : ‖g‖₊ ≠ 0 := by simpa only [hg'] using one_ne_zero
calc
‖dslope f c z‖ = ‖dslope (g ∘ f) c z‖ := by
rw [g.dslope_comp, hgf, RCLike.norm_ofReal, abs_norm]
exact fun _ => hd.differentiableAt (ball_mem_nhds _ hR₁)
_ ≤ R₂ / R₁ := by
refine schwarz_aux (g.differentiable.comp_differentiableOn hd) (MapsTo.comp ?_ h_maps) hz
simpa only [hg', NNReal.coe_one, one_mul] using g.lipschitz.mapsTo_ball hg₀ (f c) R₂
#align complex.norm_dslope_le_div_of_maps_to_ball Complex.norm_dslope_le_div_of_mapsTo_ball
| Mathlib/Analysis/Complex/Schwarz.lean | 113 | 130 | theorem affine_of_mapsTo_ball_of_exists_norm_dslope_eq_div [CompleteSpace E] [StrictConvexSpace ℝ E]
(hd : DifferentiableOn ℂ f (ball c R₁)) (h_maps : Set.MapsTo f (ball c R₁) (ball (f c) R₂))
(h_z₀ : z₀ ∈ ball c R₁) (h_eq : ‖dslope f c z₀‖ = R₂ / R₁) :
Set.EqOn f (fun z => f c + (z - c) • dslope f c z₀) (ball c R₁) := by |
set g := dslope f c
rintro z hz
by_cases h : z = c; · simp [h]
have h_R₁ : 0 < R₁ := nonempty_ball.mp ⟨_, h_z₀⟩
have g_le_div : ∀ z ∈ ball c R₁, ‖g z‖ ≤ R₂ / R₁ := fun z hz =>
norm_dslope_le_div_of_mapsTo_ball hd h_maps hz
have g_max : IsMaxOn (norm ∘ g) (ball c R₁) z₀ :=
isMaxOn_iff.mpr fun z hz => by simpa [h_eq] using g_le_div z hz
have g_diff : DifferentiableOn ℂ g (ball c R₁) :=
(differentiableOn_dslope (isOpen_ball.mem_nhds (mem_ball_self h_R₁))).mpr hd
have : g z = g z₀ := eqOn_of_isPreconnected_of_isMaxOn_norm (convex_ball c R₁).isPreconnected
isOpen_ball g_diff h_z₀ g_max hz
simp [g] at this
simp [g, ← this]
| 14 | 1,202,604.284165 | 2 | 2 | 3 | 2,213 |
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Measurable
open MeasureTheory
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] [LocallyCompactSpace 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace E] [OpensMeasurableSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F]
{f : E → F} {v : E}
| Mathlib/Analysis/Calculus/LineDeriv/Measurable.lean | 33 | 38 | theorem measurableSet_lineDifferentiableAt (hf : Continuous f) :
MeasurableSet {x : E | LineDifferentiableAt 𝕜 f x v} := by |
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact measurable_prod_mk_right (measurableSet_of_differentiableAt_with_param 𝕜 hg)
| 4 | 54.59815 | 2 | 2 | 6 | 2,214 |
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Measurable
open MeasureTheory
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] [LocallyCompactSpace 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace E] [OpensMeasurableSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F]
{f : E → F} {v : E}
theorem measurableSet_lineDifferentiableAt (hf : Continuous f) :
MeasurableSet {x : E | LineDifferentiableAt 𝕜 f x v} := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact measurable_prod_mk_right (measurableSet_of_differentiableAt_with_param 𝕜 hg)
| Mathlib/Analysis/Calculus/LineDeriv/Measurable.lean | 40 | 45 | theorem measurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun x ↦ lineDeriv 𝕜 f x v) := by |
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (measurable_deriv_with_param hg).comp measurable_prod_mk_right
| 4 | 54.59815 | 2 | 2 | 6 | 2,214 |
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Measurable
open MeasureTheory
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] [LocallyCompactSpace 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace E] [OpensMeasurableSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F]
{f : E → F} {v : E}
theorem measurableSet_lineDifferentiableAt (hf : Continuous f) :
MeasurableSet {x : E | LineDifferentiableAt 𝕜 f x v} := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact measurable_prod_mk_right (measurableSet_of_differentiableAt_with_param 𝕜 hg)
theorem measurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun x ↦ lineDeriv 𝕜 f x v) := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (measurable_deriv_with_param hg).comp measurable_prod_mk_right
| Mathlib/Analysis/Calculus/LineDeriv/Measurable.lean | 47 | 52 | theorem stronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F] (hf : Continuous f) :
StronglyMeasurable (fun x ↦ lineDeriv 𝕜 f x v) := by |
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (stronglyMeasurable_deriv_with_param hg).comp_measurable measurable_prod_mk_right
| 4 | 54.59815 | 2 | 2 | 6 | 2,214 |
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Measurable
open MeasureTheory
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] [LocallyCompactSpace 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace E] [OpensMeasurableSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F]
{f : E → F} {v : E}
theorem measurableSet_lineDifferentiableAt (hf : Continuous f) :
MeasurableSet {x : E | LineDifferentiableAt 𝕜 f x v} := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact measurable_prod_mk_right (measurableSet_of_differentiableAt_with_param 𝕜 hg)
theorem measurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun x ↦ lineDeriv 𝕜 f x v) := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (measurable_deriv_with_param hg).comp measurable_prod_mk_right
theorem stronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F] (hf : Continuous f) :
StronglyMeasurable (fun x ↦ lineDeriv 𝕜 f x v) := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (stronglyMeasurable_deriv_with_param hg).comp_measurable measurable_prod_mk_right
theorem aemeasurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) (μ : Measure E) :
AEMeasurable (fun x ↦ lineDeriv 𝕜 f x v) μ :=
(measurable_lineDeriv hf).aemeasurable
theorem aestronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F]
(hf : Continuous f) (μ : Measure E) :
AEStronglyMeasurable (fun x ↦ lineDeriv 𝕜 f x v) μ :=
(stronglyMeasurable_lineDeriv hf).aestronglyMeasurable
variable [SecondCountableTopology E]
| Mathlib/Analysis/Calculus/LineDeriv/Measurable.lean | 72 | 81 | theorem measurableSet_lineDifferentiableAt_uncurry (hf : Continuous f) :
MeasurableSet {p : E × E | LineDifferentiableAt 𝕜 f p.1 p.2} := by |
borelize 𝕜
let g : (E × E) → 𝕜 → F := fun p t ↦ f (p.1 + t • p.2)
have : Continuous g.uncurry :=
hf.comp <| (continuous_fst.comp continuous_fst).add
<| continuous_snd.smul (continuous_snd.comp continuous_fst)
have M_meas : MeasurableSet {q : (E × E) × 𝕜 | DifferentiableAt 𝕜 (g q.1) q.2} :=
measurableSet_of_differentiableAt_with_param 𝕜 this
exact measurable_prod_mk_right M_meas
| 8 | 2,980.957987 | 2 | 2 | 6 | 2,214 |
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Measurable
open MeasureTheory
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] [LocallyCompactSpace 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace E] [OpensMeasurableSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [CompleteSpace F]
{f : E → F} {v : E}
theorem measurableSet_lineDifferentiableAt (hf : Continuous f) :
MeasurableSet {x : E | LineDifferentiableAt 𝕜 f x v} := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact measurable_prod_mk_right (measurableSet_of_differentiableAt_with_param 𝕜 hg)
theorem measurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun x ↦ lineDeriv 𝕜 f x v) := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (measurable_deriv_with_param hg).comp measurable_prod_mk_right
theorem stronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F] (hf : Continuous f) :
StronglyMeasurable (fun x ↦ lineDeriv 𝕜 f x v) := by
borelize 𝕜
let g : E → 𝕜 → F := fun x t ↦ f (x + t • v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (stronglyMeasurable_deriv_with_param hg).comp_measurable measurable_prod_mk_right
theorem aemeasurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) (μ : Measure E) :
AEMeasurable (fun x ↦ lineDeriv 𝕜 f x v) μ :=
(measurable_lineDeriv hf).aemeasurable
theorem aestronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F]
(hf : Continuous f) (μ : Measure E) :
AEStronglyMeasurable (fun x ↦ lineDeriv 𝕜 f x v) μ :=
(stronglyMeasurable_lineDeriv hf).aestronglyMeasurable
variable [SecondCountableTopology E]
theorem measurableSet_lineDifferentiableAt_uncurry (hf : Continuous f) :
MeasurableSet {p : E × E | LineDifferentiableAt 𝕜 f p.1 p.2} := by
borelize 𝕜
let g : (E × E) → 𝕜 → F := fun p t ↦ f (p.1 + t • p.2)
have : Continuous g.uncurry :=
hf.comp <| (continuous_fst.comp continuous_fst).add
<| continuous_snd.smul (continuous_snd.comp continuous_fst)
have M_meas : MeasurableSet {q : (E × E) × 𝕜 | DifferentiableAt 𝕜 (g q.1) q.2} :=
measurableSet_of_differentiableAt_with_param 𝕜 this
exact measurable_prod_mk_right M_meas
| Mathlib/Analysis/Calculus/LineDeriv/Measurable.lean | 83 | 90 | theorem measurable_lineDeriv_uncurry [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun (p : E × E) ↦ lineDeriv 𝕜 f p.1 p.2) := by |
borelize 𝕜
let g : (E × E) → 𝕜 → F := fun p t ↦ f (p.1 + t • p.2)
have : Continuous g.uncurry :=
hf.comp <| (continuous_fst.comp continuous_fst).add
<| continuous_snd.smul (continuous_snd.comp continuous_fst)
exact (measurable_deriv_with_param this).comp measurable_prod_mk_right
| 6 | 403.428793 | 2 | 2 | 6 | 2,214 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.