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.PFunctor.Univariate.M
#align_import data.qpf.univariate.basic from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
universe u
class QPF (F : Type u → Type u) [Functor F] where
P : PFunctor.{u}
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p
#align qpf QPF
namespace QPF
variable {F : Type u → Type u} [Functor F] [q : QPF F]
open Functor (Liftp Liftr)
theorem id_map {α : Type _} (x : F α) : id <$> x = x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map]
rfl
#align qpf.id_map QPF.id_map
theorem comp_map {α β γ : Type _} (f : α → β) (g : β → γ) (x : F α) :
(g ∘ f) <$> x = g <$> f <$> x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map, ← abs_map, ← abs_map]
rfl
#align qpf.comp_map QPF.comp_map
theorem lawfulFunctor
(h : ∀ α β : Type u, @Functor.mapConst F _ α _ = Functor.map ∘ Function.const β) :
LawfulFunctor F :=
{ map_const := @h
id_map := @id_map F _ _
comp_map := @comp_map F _ _ }
#align qpf.is_lawful_functor QPF.lawfulFunctor
section
open Functor
theorem liftp_iff {α : Type u} (p : α → Prop) (x : F α) :
Liftp p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i, p (f i) := by
constructor
· rintro ⟨y, hy⟩
cases' h : repr y with a f
use a, fun i => (f i).val
constructor
· rw [← hy, ← abs_repr y, h, ← abs_map]
rfl
intro i
apply (f i).property
rintro ⟨a, f, h₀, h₁⟩
use abs ⟨a, fun i => ⟨f i, h₁ i⟩⟩
rw [← abs_map, h₀]; rfl
#align qpf.liftp_iff QPF.liftp_iff
| Mathlib/Data/QPF/Univariate/Basic.lean | 117 | 131 | theorem liftp_iff' {α : Type u} (p : α → Prop) (x : F α) :
Liftp p x ↔ ∃ u : q.P α, abs u = x ∧ ∀ i, p (u.snd i) := by |
constructor
· rintro ⟨y, hy⟩
cases' h : repr y with a f
use ⟨a, fun i => (f i).val⟩
dsimp
constructor
· rw [← hy, ← abs_repr y, h, ← abs_map]
rfl
intro i
apply (f i).property
rintro ⟨⟨a, f⟩, h₀, h₁⟩; dsimp at *
use abs ⟨a, fun i => ⟨f i, h₁ i⟩⟩
rw [← abs_map, ← h₀]; rfl
| 13 | 442,413.392009 | 2 | 1.571429 | 7 | 1,701 |
import Mathlib.CategoryTheory.EqToHom
import Mathlib.CategoryTheory.Quotient
import Mathlib.Combinatorics.Quiver.Path
#align_import category_theory.path_category from "leanprover-community/mathlib"@"c6dd521ebdce53bb372c527569dd7c25de53a08b"
universe v₁ v₂ u₁ u₂
namespace CategoryTheory
section
def Paths (V : Type u₁) : Type u₁ := V
#align category_theory.paths CategoryTheory.Paths
instance (V : Type u₁) [Inhabited V] : Inhabited (Paths V) := ⟨(default : V)⟩
variable (V : Type u₁) [Quiver.{v₁ + 1} V]
namespace Paths
instance categoryPaths : Category.{max u₁ v₁} (Paths V) where
Hom := fun X Y : V => Quiver.Path X Y
id X := Quiver.Path.nil
comp f g := Quiver.Path.comp f g
#align category_theory.paths.category_paths CategoryTheory.Paths.categoryPaths
variable {V}
@[simps]
def of : V ⥤q Paths V where
obj X := X
map f := f.toPath
#align category_theory.paths.of CategoryTheory.Paths.of
attribute [local ext] Functor.ext
def lift {C} [Category C] (φ : V ⥤q C) : Paths V ⥤ C where
obj := φ.obj
map {X} {Y} f :=
@Quiver.Path.rec V _ X (fun Y _ => φ.obj X ⟶ φ.obj Y) (𝟙 <| φ.obj X)
(fun _ f ihp => ihp ≫ φ.map f) Y f
map_id X := rfl
map_comp f g := by
induction' g with _ _ g' p ih _ _ _
· rw [Category.comp_id]
rfl
· have : f ≫ Quiver.Path.cons g' p = (f ≫ g').cons p := by apply Quiver.Path.comp_cons
rw [this]
simp only at ih ⊢
rw [ih, Category.assoc]
#align category_theory.paths.lift CategoryTheory.Paths.lift
@[simp]
theorem lift_nil {C} [Category C] (φ : V ⥤q C) (X : V) :
(lift φ).map Quiver.Path.nil = 𝟙 (φ.obj X) := rfl
#align category_theory.paths.lift_nil CategoryTheory.Paths.lift_nil
@[simp]
theorem lift_cons {C} [Category C] (φ : V ⥤q C) {X Y Z : V} (p : Quiver.Path X Y) (f : Y ⟶ Z) :
(lift φ).map (p.cons f) = (lift φ).map p ≫ φ.map f := rfl
#align category_theory.paths.lift_cons CategoryTheory.Paths.lift_cons
@[simp]
theorem lift_toPath {C} [Category C] (φ : V ⥤q C) {X Y : V} (f : X ⟶ Y) :
(lift φ).map f.toPath = φ.map f := by
dsimp [Quiver.Hom.toPath, lift]
simp
#align category_theory.paths.lift_to_path CategoryTheory.Paths.lift_toPath
| Mathlib/CategoryTheory/PathCategory.lean | 93 | 100 | theorem lift_spec {C} [Category C] (φ : V ⥤q C) : of ⋙q (lift φ).toPrefunctor = φ := by |
fapply Prefunctor.ext
· rintro X
rfl
· rintro X Y f
rcases φ with ⟨φo, φm⟩
dsimp [lift, Quiver.Hom.toPath]
simp only [Category.id_comp]
| 7 | 1,096.633158 | 2 | 1.75 | 4 | 1,866 |
import Mathlib.CategoryTheory.Abelian.Basic
#align_import category_theory.idempotents.basic from "leanprover-community/mathlib"@"3a061790136d13594ec10c7c90d202335ac5d854"
open CategoryTheory
open CategoryTheory.Category
open CategoryTheory.Limits
open CategoryTheory.Preadditive
open Opposite
namespace CategoryTheory
variable (C : Type*) [Category C]
class IsIdempotentComplete : Prop where
idempotents_split :
∀ (X : C) (p : X ⟶ X), p ≫ p = p → ∃ (Y : C) (i : Y ⟶ X) (e : X ⟶ Y), i ≫ e = 𝟙 Y ∧ e ≫ i = p
#align category_theory.is_idempotent_complete CategoryTheory.IsIdempotentComplete
namespace Idempotents
theorem isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent :
IsIdempotentComplete C ↔ ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p := by
constructor
· intro
intro X p hp
rcases IsIdempotentComplete.idempotents_split X p hp with ⟨Y, i, e, ⟨h₁, h₂⟩⟩
exact
⟨Nonempty.intro
{ cone := Fork.ofι i (show i ≫ 𝟙 X = i ≫ p by rw [comp_id, ← h₂, ← assoc, h₁, id_comp])
isLimit := by
apply Fork.IsLimit.mk'
intro s
refine ⟨s.ι ≫ e, ?_⟩
constructor
· erw [assoc, h₂, ← Limits.Fork.condition s, comp_id]
· intro m hm
rw [Fork.ι_ofι] at hm
rw [← hm]
simp only [← hm, assoc, h₁]
exact (comp_id m).symm }⟩
· intro h
refine ⟨?_⟩
intro X p hp
haveI : HasEqualizer (𝟙 X) p := h X p hp
refine ⟨equalizer (𝟙 X) p, equalizer.ι (𝟙 X) p,
equalizer.lift p (show p ≫ 𝟙 X = p ≫ p by rw [hp, comp_id]), ?_, equalizer.lift_ι _ _⟩
ext
simp only [assoc, limit.lift_π, Eq.ndrec, id_eq, eq_mpr_eq_cast, Fork.ofι_pt,
Fork.ofι_π_app, id_comp]
rw [← equalizer.condition, comp_id]
#align category_theory.idempotents.is_idempotent_complete_iff_has_equalizer_of_id_and_idempotent CategoryTheory.Idempotents.isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent
variable {C}
theorem idem_of_id_sub_idem [Preadditive C] {X : C} (p : X ⟶ X) (hp : p ≫ p = p) :
(𝟙 _ - p) ≫ (𝟙 _ - p) = 𝟙 _ - p := by
simp only [comp_sub, sub_comp, id_comp, comp_id, hp, sub_self, sub_zero]
#align category_theory.idempotents.idem_of_id_sub_idem CategoryTheory.Idempotents.idem_of_id_sub_idem
variable (C)
theorem isIdempotentComplete_iff_idempotents_have_kernels [Preadditive C] :
IsIdempotentComplete C ↔ ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasKernel p := by
rw [isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent]
constructor
· intro h X p hp
haveI : HasEqualizer (𝟙 X) (𝟙 X - p) := h X (𝟙 _ - p) (idem_of_id_sub_idem p hp)
convert hasKernel_of_hasEqualizer (𝟙 X) (𝟙 X - p)
rw [sub_sub_cancel]
· intro h X p hp
haveI : HasKernel (𝟙 _ - p) := h X (𝟙 _ - p) (idem_of_id_sub_idem p hp)
apply Preadditive.hasEqualizer_of_hasKernel
#align category_theory.idempotents.is_idempotent_complete_iff_idempotents_have_kernels CategoryTheory.Idempotents.isIdempotentComplete_iff_idempotents_have_kernels
instance (priority := 100) isIdempotentComplete_of_abelian (D : Type*) [Category D] [Abelian D] :
IsIdempotentComplete D := by
rw [isIdempotentComplete_iff_idempotents_have_kernels]
intros
infer_instance
#align category_theory.idempotents.is_idempotent_complete_of_abelian CategoryTheory.Idempotents.isIdempotentComplete_of_abelian
variable {C}
| Mathlib/CategoryTheory/Idempotents/Basic.lean | 130 | 140 | theorem split_imp_of_iso {X X' : C} (φ : X ≅ X') (p : X ⟶ X) (p' : X' ⟶ X')
(hpp' : p ≫ φ.hom = φ.hom ≫ p')
(h : ∃ (Y : C) (i : Y ⟶ X) (e : X ⟶ Y), i ≫ e = 𝟙 Y ∧ e ≫ i = p) :
∃ (Y' : C) (i' : Y' ⟶ X') (e' : X' ⟶ Y'), i' ≫ e' = 𝟙 Y' ∧ e' ≫ i' = p' := by |
rcases h with ⟨Y, i, e, ⟨h₁, h₂⟩⟩
use Y, i ≫ φ.hom, φ.inv ≫ e
constructor
· slice_lhs 2 3 => rw [φ.hom_inv_id]
rw [id_comp, h₁]
· slice_lhs 2 3 => rw [h₂]
rw [hpp', ← assoc, φ.inv_hom_id, id_comp]
| 7 | 1,096.633158 | 2 | 1.6 | 5 | 1,735 |
import Mathlib.Analysis.Convex.Topology
import Mathlib.LinearAlgebra.Dimension.DivisionRing
import Mathlib.Topology.Algebra.Module.Cardinality
open Convex Set Metric
section TopologicalVectorSpace
variable {E : Type*} [AddCommGroup E] [Module ℝ E]
[TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul ℝ E]
| Mathlib/Analysis/NormedSpace/Connected.lean | 34 | 103 | theorem Set.Countable.isPathConnected_compl_of_one_lt_rank
(h : 1 < Module.rank ℝ E) {s : Set E} (hs : s.Countable) :
IsPathConnected sᶜ := by |
have : Nontrivial E := (rank_pos_iff_nontrivial (R := ℝ)).1 (zero_lt_one.trans h)
-- the set `sᶜ` is dense, therefore nonempty. Pick `a ∈ sᶜ`. We have to show that any
-- `b ∈ sᶜ` can be joined to `a`.
obtain ⟨a, ha⟩ : sᶜ.Nonempty := (hs.dense_compl ℝ).nonempty
refine ⟨a, ha, ?_⟩
intro b hb
rcases eq_or_ne a b with rfl|hab
· exact JoinedIn.refl ha
/- Assume `b ≠ a`. Write `a = c - x` and `b = c + x` for some nonzero `x`. Choose `y` which
is linearly independent from `x`. Then the segments joining `a = c - x` to `c + ty` are pairwise
disjoint for varying `t` (except for the endpoint `a`) so only countably many of them can
intersect `s`. In the same way, there are countably many `t`s for which the segment
from `b = c + x` to `c + ty` intersects `s`. Choosing `t` outside of these countable exceptions,
one gets a path in the complement of `s` from `a` to `z = c + ty` and then to `b`.
-/
let c := (2 : ℝ)⁻¹ • (a + b)
let x := (2 : ℝ)⁻¹ • (b - a)
have Ia : c - x = a := by
simp only [c, x, smul_add, smul_sub]
abel_nf
simp [zsmul_eq_smul_cast ℝ 2]
have Ib : c + x = b := by
simp only [c, x, smul_add, smul_sub]
abel_nf
simp [zsmul_eq_smul_cast ℝ 2]
have x_ne_zero : x ≠ 0 := by simpa [x] using sub_ne_zero.2 hab.symm
obtain ⟨y, hy⟩ : ∃ y, LinearIndependent ℝ ![x, y] :=
exists_linearIndependent_pair_of_one_lt_rank h x_ne_zero
have A : Set.Countable {t : ℝ | ([c + x -[ℝ] c + t • y] ∩ s).Nonempty} := by
apply countable_setOf_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs
intro t t' htt'
apply disjoint_iff_inter_eq_empty.2
have N : {c + x} ∩ s = ∅ := by
simpa only [singleton_inter_eq_empty, mem_compl_iff, Ib] using hb
rw [inter_assoc, inter_comm s, inter_assoc, inter_self, ← inter_assoc, ← subset_empty_iff, ← N]
apply inter_subset_inter_left
apply Eq.subset
apply segment_inter_eq_endpoint_of_linearIndependent_of_ne hy htt'.symm
have B : Set.Countable {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ s).Nonempty} := by
apply countable_setOf_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs
intro t t' htt'
apply disjoint_iff_inter_eq_empty.2
have N : {c - x} ∩ s = ∅ := by
simpa only [singleton_inter_eq_empty, mem_compl_iff, Ia] using ha
rw [inter_assoc, inter_comm s, inter_assoc, inter_self, ← inter_assoc, ← subset_empty_iff, ← N]
apply inter_subset_inter_left
rw [sub_eq_add_neg _ x]
apply Eq.subset
apply segment_inter_eq_endpoint_of_linearIndependent_of_ne _ htt'.symm
convert hy.units_smul ![-1, 1]
simp [← List.ofFn_inj]
obtain ⟨t, ht⟩ : Set.Nonempty ({t : ℝ | ([c + x -[ℝ] c + t • y] ∩ s).Nonempty}
∪ {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ s).Nonempty})ᶜ := ((A.union B).dense_compl ℝ).nonempty
let z := c + t • y
simp only [compl_union, mem_inter_iff, mem_compl_iff, mem_setOf_eq, not_nonempty_iff_eq_empty]
at ht
have JA : JoinedIn sᶜ a z := by
apply JoinedIn.of_segment_subset
rw [subset_compl_iff_disjoint_right, disjoint_iff_inter_eq_empty]
convert ht.2
exact Ia.symm
have JB : JoinedIn sᶜ b z := by
apply JoinedIn.of_segment_subset
rw [subset_compl_iff_disjoint_right, disjoint_iff_inter_eq_empty]
convert ht.1
exact Ib.symm
exact JA.trans JB.symm
| 67 | 125,236,317,084,221,370,000,000,000,000 | 2 | 2 | 1 | 2,081 |
import Mathlib.CategoryTheory.Abelian.Opposite
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels
import Mathlib.CategoryTheory.Preadditive.LeftExact
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.Algebra.Homology.Exact
import Mathlib.Tactic.TFAE
#align_import category_theory.abelian.exact from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v₁ v₂ u₁ u₂
noncomputable section
open CategoryTheory Limits Preadditive
variable {C : Type u₁} [Category.{v₁} C] [Abelian C]
namespace CategoryTheory
namespace Abelian
variable {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z)
attribute [local instance] hasEqualizers_of_hasKernels
theorem exact_iff_image_eq_kernel : Exact f g ↔ imageSubobject f = kernelSubobject g := by
constructor
· intro h
have : IsIso (imageToKernel f g h.w) := have := h.epi; isIso_of_mono_of_epi _
refine Subobject.eq_of_comm (asIso (imageToKernel _ _ h.w)) ?_
simp
· apply exact_of_image_eq_kernel
#align category_theory.abelian.exact_iff_image_eq_kernel CategoryTheory.Abelian.exact_iff_image_eq_kernel
theorem exact_iff : Exact f g ↔ f ≫ g = 0 ∧ kernel.ι g ≫ cokernel.π f = 0 := by
constructor
· exact fun h ↦ ⟨h.1, kernel_comp_cokernel f g h⟩
· refine fun h ↦ ⟨h.1, ?_⟩
suffices hl : IsLimit
(KernelFork.ofι (imageSubobject f).arrow (imageSubobject_arrow_comp_eq_zero h.1)) by
have : imageToKernel f g h.1 = (hl.conePointUniqueUpToIso (limit.isLimit _)).hom ≫
(kernelSubobjectIso _).inv := by ext; simp
rw [this]
infer_instance
refine KernelFork.IsLimit.ofι _ _ (fun u hu ↦ ?_) ?_ (fun _ _ _ h ↦ ?_)
· refine kernel.lift (cokernel.π f) u ?_ ≫ (imageIsoImage f).hom ≫ (imageSubobjectIso _).inv
rw [← kernel.lift_ι g u hu, Category.assoc, h.2, comp_zero]
· aesop_cat
· rw [← cancel_mono (imageSubobject f).arrow, h]
simp
#align category_theory.abelian.exact_iff CategoryTheory.Abelian.exact_iff
| Mathlib/CategoryTheory/Abelian/Exact.lean | 84 | 93 | theorem exact_iff' {cg : KernelFork g} (hg : IsLimit cg) {cf : CokernelCofork f}
(hf : IsColimit cf) : Exact f g ↔ f ≫ g = 0 ∧ cg.ι ≫ cf.π = 0 := by |
constructor
· intro h
exact ⟨h.1, fork_ι_comp_cofork_π f g h cg cf⟩
· rw [exact_iff]
refine fun h => ⟨h.1, ?_⟩
apply zero_of_epi_comp (IsLimit.conePointUniqueUpToIso hg (limit.isLimit _)).hom
apply zero_of_comp_mono (IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) hf).hom
simp [h.2]
| 8 | 2,980.957987 | 2 | 1.8 | 5 | 1,886 |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Cycle
variable [DecidableEq α] (s s' : Cycle α)
def formPerm : ∀ s : Cycle α, Nodup s → Equiv.Perm α :=
fun s => Quotient.hrecOn s (fun l _ => List.formPerm l) fun l₁ l₂ (h : l₁ ~r l₂) => by
apply Function.hfunext
· ext
exact h.nodup_iff
· intro h₁ h₂ _
exact heq_of_eq (formPerm_eq_of_isRotated h₁ h)
#align cycle.form_perm Cycle.formPerm
@[simp]
theorem formPerm_coe (l : List α) (hl : l.Nodup) : formPerm (l : Cycle α) hl = l.formPerm :=
rfl
#align cycle.form_perm_coe Cycle.formPerm_coe
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 149 | 156 | theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by |
induction' s using Quot.inductionOn with s
simp only [formPerm_coe, mk_eq_coe]
simp only [length_subsingleton_iff, length_coe, mk_eq_coe] at h
cases' s with hd tl
· simp
· simp only [length_eq_zero, add_le_iff_nonpos_left, List.length, nonpos_iff_eq_zero] at h
simp [h]
| 7 | 1,096.633158 | 2 | 1 | 18 | 1,030 |
import Mathlib.ModelTheory.Ultraproducts
import Mathlib.ModelTheory.Bundled
import Mathlib.ModelTheory.Skolem
#align_import model_theory.satisfiability from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728"
set_option linter.uppercaseLean3 false
universe u v w w'
open Cardinal CategoryTheory
open Cardinal FirstOrder
namespace FirstOrder
namespace Language
variable {L : Language.{u, v}} {T : L.Theory} {α : Type w} {n : ℕ}
namespace Theory
variable (T)
def IsSatisfiable : Prop :=
Nonempty (ModelType.{u, v, max u v} T)
#align first_order.language.Theory.is_satisfiable FirstOrder.Language.Theory.IsSatisfiable
def IsFinitelySatisfiable : Prop :=
∀ T0 : Finset L.Sentence, (T0 : L.Theory) ⊆ T → IsSatisfiable (T0 : L.Theory)
#align first_order.language.Theory.is_finitely_satisfiable FirstOrder.Language.Theory.IsFinitelySatisfiable
variable {T} {T' : L.Theory}
theorem Model.isSatisfiable (M : Type w) [Nonempty M] [L.Structure M] [M ⊨ T] :
T.IsSatisfiable :=
⟨((⊥ : Substructure _ (ModelType.of T M)).elementarySkolem₁Reduct.toModel T).shrink⟩
#align first_order.language.Theory.model.is_satisfiable FirstOrder.Language.Theory.Model.isSatisfiable
theorem IsSatisfiable.mono (h : T'.IsSatisfiable) (hs : T ⊆ T') : T.IsSatisfiable :=
⟨(Theory.Model.mono (ModelType.is_model h.some) hs).bundled⟩
#align first_order.language.Theory.is_satisfiable.mono FirstOrder.Language.Theory.IsSatisfiable.mono
theorem isSatisfiable_empty (L : Language.{u, v}) : IsSatisfiable (∅ : L.Theory) :=
⟨default⟩
#align first_order.language.Theory.is_satisfiable_empty FirstOrder.Language.Theory.isSatisfiable_empty
theorem isSatisfiable_of_isSatisfiable_onTheory {L' : Language.{w, w'}} (φ : L →ᴸ L')
(h : (φ.onTheory T).IsSatisfiable) : T.IsSatisfiable :=
Model.isSatisfiable (h.some.reduct φ)
#align first_order.language.Theory.is_satisfiable_of_is_satisfiable_on_Theory FirstOrder.Language.Theory.isSatisfiable_of_isSatisfiable_onTheory
theorem isSatisfiable_onTheory_iff {L' : Language.{w, w'}} {φ : L →ᴸ L'} (h : φ.Injective) :
(φ.onTheory T).IsSatisfiable ↔ T.IsSatisfiable := by
classical
refine ⟨isSatisfiable_of_isSatisfiable_onTheory φ, fun h' => ?_⟩
haveI : Inhabited h'.some := Classical.inhabited_of_nonempty'
exact Model.isSatisfiable (h'.some.defaultExpansion h)
#align first_order.language.Theory.is_satisfiable_on_Theory_iff FirstOrder.Language.Theory.isSatisfiable_onTheory_iff
theorem IsSatisfiable.isFinitelySatisfiable (h : T.IsSatisfiable) : T.IsFinitelySatisfiable :=
fun _ => h.mono
#align first_order.language.Theory.is_satisfiable.is_finitely_satisfiable FirstOrder.Language.Theory.IsSatisfiable.isFinitelySatisfiable
theorem isSatisfiable_iff_isFinitelySatisfiable {T : L.Theory} :
T.IsSatisfiable ↔ T.IsFinitelySatisfiable :=
⟨Theory.IsSatisfiable.isFinitelySatisfiable, fun h => by
classical
set M : Finset T → Type max u v := fun T0 : Finset T =>
(h (T0.map (Function.Embedding.subtype fun x => x ∈ T)) T0.map_subtype_subset).some.Carrier
let M' := Filter.Product (Ultrafilter.of (Filter.atTop : Filter (Finset T))) M
have h' : M' ⊨ T := by
refine ⟨fun φ hφ => ?_⟩
rw [Ultraproduct.sentence_realize]
refine
Filter.Eventually.filter_mono (Ultrafilter.of_le _)
(Filter.eventually_atTop.2
⟨{⟨φ, hφ⟩}, fun s h' =>
Theory.realize_sentence_of_mem (s.map (Function.Embedding.subtype fun x => x ∈ T))
?_⟩)
simp only [Finset.coe_map, Function.Embedding.coe_subtype, Set.mem_image, Finset.mem_coe,
Subtype.exists, Subtype.coe_mk, exists_and_right, exists_eq_right]
exact ⟨hφ, h' (Finset.mem_singleton_self _)⟩
exact ⟨ModelType.of T M'⟩⟩
#align first_order.language.Theory.is_satisfiable_iff_is_finitely_satisfiable FirstOrder.Language.Theory.isSatisfiable_iff_isFinitelySatisfiable
theorem isSatisfiable_directed_union_iff {ι : Type*} [Nonempty ι] {T : ι → L.Theory}
(h : Directed (· ⊆ ·) T) : Theory.IsSatisfiable (⋃ i, T i) ↔ ∀ i, (T i).IsSatisfiable := by
refine ⟨fun h' i => h'.mono (Set.subset_iUnion _ _), fun h' => ?_⟩
rw [isSatisfiable_iff_isFinitelySatisfiable, IsFinitelySatisfiable]
intro T0 hT0
obtain ⟨i, hi⟩ := h.exists_mem_subset_of_finset_subset_biUnion hT0
exact (h' i).mono hi
#align first_order.language.Theory.is_satisfiable_directed_union_iff FirstOrder.Language.Theory.isSatisfiable_directed_union_iff
| Mathlib/ModelTheory/Satisfiability.lean | 138 | 154 | theorem isSatisfiable_union_distinctConstantsTheory_of_card_le (T : L.Theory) (s : Set α)
(M : Type w') [Nonempty M] [L.Structure M] [M ⊨ T]
(h : Cardinal.lift.{w'} #s ≤ Cardinal.lift.{w} #M) :
((L.lhomWithConstants α).onTheory T ∪ L.distinctConstantsTheory s).IsSatisfiable := by |
haveI : Inhabited M := Classical.inhabited_of_nonempty inferInstance
rw [Cardinal.lift_mk_le'] at h
letI : (constantsOn α).Structure M := constantsOn.structure (Function.extend (↑) h.some default)
have : M ⊨ (L.lhomWithConstants α).onTheory T ∪ L.distinctConstantsTheory s := by
refine ((LHom.onTheory_model _ _).2 inferInstance).union ?_
rw [model_distinctConstantsTheory]
refine fun a as b bs ab => ?_
rw [← Subtype.coe_mk a as, ← Subtype.coe_mk b bs, ← Subtype.ext_iff]
exact
h.some.injective
((Subtype.coe_injective.extend_apply h.some default ⟨a, as⟩).symm.trans
(ab.trans (Subtype.coe_injective.extend_apply h.some default ⟨b, bs⟩)))
exact Model.isSatisfiable M
| 13 | 442,413.392009 | 2 | 2 | 5 | 2,364 |
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.MeasureTheory.Function.SimpleFuncDenseLp
#align_import measure_theory.integral.set_to_l1 from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology NNReal ENNReal MeasureTheory Pointwise
open Set Filter TopologicalSpace ENNReal EMetric
namespace MeasureTheory
variable {α E F F' G 𝕜 : Type*} {p : ℝ≥0∞} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup F'] [NormedSpace ℝ F']
[NormedAddCommGroup G] {m : MeasurableSpace α} {μ : Measure α}
local infixr:25 " →ₛ " => SimpleFunc
open Finset
section FinMeasAdditive
def FinMeasAdditive {β} [AddMonoid β] {_ : MeasurableSpace α} (μ : Measure α) (T : Set α → β) :
Prop :=
∀ s t, MeasurableSet s → MeasurableSet t → μ s ≠ ∞ → μ t ≠ ∞ → s ∩ t = ∅ → T (s ∪ t) = T s + T t
#align measure_theory.fin_meas_additive MeasureTheory.FinMeasAdditive
namespace FinMeasAdditive
variable {β : Type*} [AddCommMonoid β] {T T' : Set α → β}
theorem zero : FinMeasAdditive μ (0 : Set α → β) := fun s t _ _ _ _ _ => by simp
#align measure_theory.fin_meas_additive.zero MeasureTheory.FinMeasAdditive.zero
theorem add (hT : FinMeasAdditive μ T) (hT' : FinMeasAdditive μ T') :
FinMeasAdditive μ (T + T') := by
intro s t hs ht hμs hμt hst
simp only [hT s t hs ht hμs hμt hst, hT' s t hs ht hμs hμt hst, Pi.add_apply]
abel
#align measure_theory.fin_meas_additive.add MeasureTheory.FinMeasAdditive.add
theorem smul [Monoid 𝕜] [DistribMulAction 𝕜 β] (hT : FinMeasAdditive μ T) (c : 𝕜) :
FinMeasAdditive μ fun s => c • T s := fun s t hs ht hμs hμt hst => by
simp [hT s t hs ht hμs hμt hst]
#align measure_theory.fin_meas_additive.smul MeasureTheory.FinMeasAdditive.smul
theorem of_eq_top_imp_eq_top {μ' : Measure α} (h : ∀ s, MeasurableSet s → μ s = ∞ → μ' s = ∞)
(hT : FinMeasAdditive μ T) : FinMeasAdditive μ' T := fun s t hs ht hμ's hμ't hst =>
hT s t hs ht (mt (h s hs) hμ's) (mt (h t ht) hμ't) hst
#align measure_theory.fin_meas_additive.of_eq_top_imp_eq_top MeasureTheory.FinMeasAdditive.of_eq_top_imp_eq_top
theorem of_smul_measure (c : ℝ≥0∞) (hc_ne_top : c ≠ ∞) (hT : FinMeasAdditive (c • μ) T) :
FinMeasAdditive μ T := by
refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT
rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top] at hμs
simp only [hc_ne_top, or_false_iff, Ne, false_and_iff] at hμs
exact hμs.2
#align measure_theory.fin_meas_additive.of_smul_measure MeasureTheory.FinMeasAdditive.of_smul_measure
| Mathlib/MeasureTheory/Integral/SetToL1.lean | 130 | 135 | theorem smul_measure (c : ℝ≥0∞) (hc_ne_zero : c ≠ 0) (hT : FinMeasAdditive μ T) :
FinMeasAdditive (c • μ) T := by |
refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT
rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top]
simp only [hc_ne_zero, true_and_iff, Ne, not_false_iff]
exact Or.inl hμs
| 4 | 54.59815 | 2 | 1.8 | 5 | 1,900 |
import Mathlib.MeasureTheory.Measure.Restrict
#align_import measure_theory.measure.mutually_singular from "leanprover-community/mathlib"@"70a4f2197832bceab57d7f41379b2592d1110570"
open Set
open MeasureTheory NNReal ENNReal
namespace MeasureTheory
namespace Measure
variable {α : Type*} {m0 : MeasurableSpace α} {μ μ₁ μ₂ ν ν₁ ν₂ : Measure α}
def MutuallySingular {_ : MeasurableSpace α} (μ ν : Measure α) : Prop :=
∃ s : Set α, MeasurableSet s ∧ μ s = 0 ∧ ν sᶜ = 0
#align measure_theory.measure.mutually_singular MeasureTheory.Measure.MutuallySingular
@[inherit_doc MeasureTheory.Measure.MutuallySingular]
scoped[MeasureTheory] infixl:60 " ⟂ₘ " => MeasureTheory.Measure.MutuallySingular
namespace MutuallySingular
theorem mk {s t : Set α} (hs : μ s = 0) (ht : ν t = 0) (hst : univ ⊆ s ∪ t) :
MutuallySingular μ ν := by
use toMeasurable μ s, measurableSet_toMeasurable _ _, (measure_toMeasurable _).trans hs
refine measure_mono_null (fun x hx => (hst trivial).resolve_left fun hxs => hx ?_) ht
exact subset_toMeasurable _ _ hxs
#align measure_theory.measure.mutually_singular.mk MeasureTheory.Measure.MutuallySingular.mk
def nullSet (h : μ ⟂ₘ ν) : Set α := h.choose
lemma measurableSet_nullSet (h : μ ⟂ₘ ν) : MeasurableSet h.nullSet := h.choose_spec.1
@[simp]
lemma measure_nullSet (h : μ ⟂ₘ ν) : μ h.nullSet = 0 := h.choose_spec.2.1
@[simp]
lemma measure_compl_nullSet (h : μ ⟂ₘ ν) : ν h.nullSetᶜ = 0 := h.choose_spec.2.2
-- TODO: this is proved by simp, but is not simplified in other contexts without the @[simp]
-- attribute. Also, the linter does not complain about that attribute.
@[simp]
lemma restrict_nullSet (h : μ ⟂ₘ ν) : μ.restrict h.nullSet = 0 := by simp
-- TODO: this is proved by simp, but is not simplified in other contexts without the @[simp]
-- attribute. Also, the linter does not complain about that attribute.
@[simp]
lemma restrict_compl_nullSet (h : μ ⟂ₘ ν) : ν.restrict h.nullSetᶜ = 0 := by simp
@[simp]
theorem zero_right : μ ⟂ₘ 0 :=
⟨∅, MeasurableSet.empty, measure_empty, rfl⟩
#align measure_theory.measure.mutually_singular.zero_right MeasureTheory.Measure.MutuallySingular.zero_right
@[symm]
theorem symm (h : ν ⟂ₘ μ) : μ ⟂ₘ ν :=
let ⟨i, hi, his, hit⟩ := h
⟨iᶜ, hi.compl, hit, (compl_compl i).symm ▸ his⟩
#align measure_theory.measure.mutually_singular.symm MeasureTheory.Measure.MutuallySingular.symm
theorem comm : μ ⟂ₘ ν ↔ ν ⟂ₘ μ :=
⟨fun h => h.symm, fun h => h.symm⟩
#align measure_theory.measure.mutually_singular.comm MeasureTheory.Measure.MutuallySingular.comm
@[simp]
theorem zero_left : 0 ⟂ₘ μ :=
zero_right.symm
#align measure_theory.measure.mutually_singular.zero_left MeasureTheory.Measure.MutuallySingular.zero_left
theorem mono_ac (h : μ₁ ⟂ₘ ν₁) (hμ : μ₂ ≪ μ₁) (hν : ν₂ ≪ ν₁) : μ₂ ⟂ₘ ν₂ :=
let ⟨s, hs, h₁, h₂⟩ := h
⟨s, hs, hμ h₁, hν h₂⟩
#align measure_theory.measure.mutually_singular.mono_ac MeasureTheory.Measure.MutuallySingular.mono_ac
theorem mono (h : μ₁ ⟂ₘ ν₁) (hμ : μ₂ ≤ μ₁) (hν : ν₂ ≤ ν₁) : μ₂ ⟂ₘ ν₂ :=
h.mono_ac hμ.absolutelyContinuous hν.absolutelyContinuous
#align measure_theory.measure.mutually_singular.mono MeasureTheory.Measure.MutuallySingular.mono
@[simp]
lemma self_iff (μ : Measure α) : μ ⟂ₘ μ ↔ μ = 0 := by
refine ⟨?_, fun h ↦ by (rw [h]; exact zero_left)⟩
rintro ⟨s, hs, hμs, hμs_compl⟩
suffices μ Set.univ = 0 by rwa [measure_univ_eq_zero] at this
rw [← Set.union_compl_self s, measure_union disjoint_compl_right hs.compl, hμs, hμs_compl,
add_zero]
@[simp]
| Mathlib/MeasureTheory/Measure/MutuallySingular.lean | 114 | 120 | theorem sum_left {ι : Type*} [Countable ι] {μ : ι → Measure α} : sum μ ⟂ₘ ν ↔ ∀ i, μ i ⟂ₘ ν := by |
refine ⟨fun h i => h.mono (le_sum _ _) le_rfl, fun H => ?_⟩
choose s hsm hsμ hsν using H
refine ⟨⋂ i, s i, MeasurableSet.iInter hsm, ?_, ?_⟩
· rw [sum_apply _ (MeasurableSet.iInter hsm), ENNReal.tsum_eq_zero]
exact fun i => measure_mono_null (iInter_subset _ _) (hsμ i)
· rwa [compl_iInter, measure_iUnion_null_iff]
| 6 | 403.428793 | 2 | 1 | 3 | 913 |
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Nat.Choose.Vandermonde
import Mathlib.Tactic.FieldSimp
#align_import data.polynomial.hasse_deriv from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
noncomputable section
namespace Polynomial
open Nat Polynomial
open Function
variable {R : Type*} [Semiring R] (k : ℕ) (f : R[X])
def hasseDeriv (k : ℕ) : R[X] →ₗ[R] R[X] :=
lsum fun i => monomial (i - k) ∘ₗ DistribMulAction.toLinearMap R R (i.choose k)
#align polynomial.hasse_deriv Polynomial.hasseDeriv
theorem hasseDeriv_apply :
hasseDeriv k f = f.sum fun i r => monomial (i - k) (↑(i.choose k) * r) := by
dsimp [hasseDeriv]
congr; ext; congr
apply nsmul_eq_mul
#align polynomial.hasse_deriv_apply Polynomial.hasseDeriv_apply
theorem hasseDeriv_coeff (n : ℕ) :
(hasseDeriv k f).coeff n = (n + k).choose k * f.coeff (n + k) := by
rw [hasseDeriv_apply, coeff_sum, sum_def, Finset.sum_eq_single (n + k), coeff_monomial]
· simp only [if_true, add_tsub_cancel_right, eq_self_iff_true]
· intro i _hi hink
rw [coeff_monomial]
by_cases hik : i < k
· simp only [Nat.choose_eq_zero_of_lt hik, ite_self, Nat.cast_zero, zero_mul]
· push_neg at hik
rw [if_neg]
contrapose! hink
exact (tsub_eq_iff_eq_add_of_le hik).mp hink
· intro h
simp only [not_mem_support_iff.mp h, monomial_zero_right, mul_zero, coeff_zero]
#align polynomial.hasse_deriv_coeff Polynomial.hasseDeriv_coeff
theorem hasseDeriv_zero' : hasseDeriv 0 f = f := by
simp only [hasseDeriv_apply, tsub_zero, Nat.choose_zero_right, Nat.cast_one, one_mul,
sum_monomial_eq]
#align polynomial.hasse_deriv_zero' Polynomial.hasseDeriv_zero'
@[simp]
theorem hasseDeriv_zero : @hasseDeriv R _ 0 = LinearMap.id :=
LinearMap.ext <| hasseDeriv_zero'
#align polynomial.hasse_deriv_zero Polynomial.hasseDeriv_zero
theorem hasseDeriv_eq_zero_of_lt_natDegree (p : R[X]) (n : ℕ) (h : p.natDegree < n) :
hasseDeriv n p = 0 := by
rw [hasseDeriv_apply, sum_def]
refine Finset.sum_eq_zero fun x hx => ?_
simp [Nat.choose_eq_zero_of_lt ((le_natDegree_of_mem_supp _ hx).trans_lt h)]
#align polynomial.hasse_deriv_eq_zero_of_lt_nat_degree Polynomial.hasseDeriv_eq_zero_of_lt_natDegree
theorem hasseDeriv_one' : hasseDeriv 1 f = derivative f := by
simp only [hasseDeriv_apply, derivative_apply, ← C_mul_X_pow_eq_monomial, Nat.choose_one_right,
(Nat.cast_commute _ _).eq]
#align polynomial.hasse_deriv_one' Polynomial.hasseDeriv_one'
@[simp]
theorem hasseDeriv_one : @hasseDeriv R _ 1 = derivative :=
LinearMap.ext <| hasseDeriv_one'
#align polynomial.hasse_deriv_one Polynomial.hasseDeriv_one
@[simp]
theorem hasseDeriv_monomial (n : ℕ) (r : R) :
hasseDeriv k (monomial n r) = monomial (n - k) (↑(n.choose k) * r) := by
ext i
simp only [hasseDeriv_coeff, coeff_monomial]
by_cases hnik : n = i + k
· rw [if_pos hnik, if_pos, ← hnik]
apply tsub_eq_of_eq_add_rev
rwa [add_comm]
· rw [if_neg hnik, mul_zero]
by_cases hkn : k ≤ n
· rw [← tsub_eq_iff_eq_add_of_le hkn] at hnik
rw [if_neg hnik]
· push_neg at hkn
rw [Nat.choose_eq_zero_of_lt hkn, Nat.cast_zero, zero_mul, ite_self]
#align polynomial.hasse_deriv_monomial Polynomial.hasseDeriv_monomial
theorem hasseDeriv_C (r : R) (hk : 0 < k) : hasseDeriv k (C r) = 0 := by
rw [← monomial_zero_left, hasseDeriv_monomial, Nat.choose_eq_zero_of_lt hk, Nat.cast_zero,
zero_mul, monomial_zero_right]
set_option linter.uppercaseLean3 false in
#align polynomial.hasse_deriv_C Polynomial.hasseDeriv_C
theorem hasseDeriv_apply_one (hk : 0 < k) : hasseDeriv k (1 : R[X]) = 0 := by
rw [← C_1, hasseDeriv_C k _ hk]
#align polynomial.hasse_deriv_apply_one Polynomial.hasseDeriv_apply_one
theorem hasseDeriv_X (hk : 1 < k) : hasseDeriv k (X : R[X]) = 0 := by
rw [← monomial_one_one_eq_X, hasseDeriv_monomial, Nat.choose_eq_zero_of_lt hk, Nat.cast_zero,
zero_mul, monomial_zero_right]
set_option linter.uppercaseLean3 false in
#align polynomial.hasse_deriv_X Polynomial.hasseDeriv_X
| Mathlib/Algebra/Polynomial/HasseDeriv.lean | 143 | 161 | theorem factorial_smul_hasseDeriv : ⇑(k ! • @hasseDeriv R _ k) = (@derivative R _)^[k] := by |
induction' k with k ih
· rw [hasseDeriv_zero, factorial_zero, iterate_zero, one_smul, LinearMap.id_coe]
ext f n : 2
rw [iterate_succ_apply', ← ih]
simp only [LinearMap.smul_apply, coeff_smul, LinearMap.map_smul_of_tower, coeff_derivative,
hasseDeriv_coeff, ← @choose_symm_add _ k]
simp only [nsmul_eq_mul, factorial_succ, mul_assoc, succ_eq_add_one, ← add_assoc,
add_right_comm n 1 k, ← cast_succ]
rw [← (cast_commute (n + 1) (f.coeff (n + k + 1))).eq]
simp only [← mul_assoc]
norm_cast
congr 2
rw [mul_comm (k+1) _, mul_assoc, mul_assoc]
congr 1
have : n + k + 1 = n + (k + 1) := by apply add_assoc
rw [← choose_symm_of_eq_add this, choose_succ_right_eq, mul_comm]
congr
rw [add_assoc, add_tsub_cancel_left]
| 18 | 65,659,969.137331 | 2 | 1.2 | 10 | 1,278 |
import Mathlib.Data.Nat.Prime
import Mathlib.Tactic.NormNum.Basic
#align_import data.nat.prime_norm_num from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
open Nat Qq Lean Meta
namespace Mathlib.Meta.NormNum
theorem not_prime_mul_of_ble (a b n : ℕ) (h : a * b = n) (h₁ : a.ble 1 = false)
(h₂ : b.ble 1 = false) : ¬ n.Prime :=
not_prime_mul' h (ble_eq_false.mp h₁).ne' (ble_eq_false.mp h₂).ne'
def deriveNotPrime (n d : ℕ) (en : Q(ℕ)) : Q(¬ Nat.Prime $en) := Id.run <| do
let d' : ℕ := n / d
let prf : Q($d * $d' = $en) := (q(Eq.refl $en) : Expr)
let r : Q(Nat.ble $d 1 = false) := (q(Eq.refl false) : Expr)
let r' : Q(Nat.ble $d' 1 = false) := (q(Eq.refl false) : Expr)
return q(not_prime_mul_of_ble _ _ _ $prf $r $r')
def MinFacHelper (n k : ℕ) : Prop :=
2 < k ∧ k % 2 = 1 ∧ k ≤ minFac n
theorem MinFacHelper.one_lt {n k : ℕ} (h : MinFacHelper n k) : 1 < n := by
have : 2 < minFac n := h.1.trans_le h.2.2
obtain rfl | h := n.eq_zero_or_pos
· contradiction
rcases (succ_le_of_lt h).eq_or_lt with rfl|h
· simp_all
exact h
theorem minFacHelper_0 (n : ℕ)
(h1 : Nat.ble (nat_lit 2) n = true) (h2 : nat_lit 1 = n % (nat_lit 2)) :
MinFacHelper n (nat_lit 3) := by
refine ⟨by norm_num, by norm_num, ?_⟩
refine (le_minFac'.mpr λ p hp hpn ↦ ?_).resolve_left (Nat.ne_of_gt (Nat.le_of_ble_eq_true h1))
rcases hp.eq_or_lt with rfl|h
· simp [(Nat.dvd_iff_mod_eq_zero ..).1 hpn] at h2
· exact h
theorem minFacHelper_1 {n k k' : ℕ} (e : k + 2 = k') (h : MinFacHelper n k)
(np : minFac n ≠ k) : MinFacHelper n k' := by
rw [← e]
refine ⟨Nat.lt_add_right _ h.1, ?_, ?_⟩
· rw [add_mod, mod_self, add_zero, mod_mod]
exact h.2.1
rcases h.2.2.eq_or_lt with rfl|h2
· exact (np rfl).elim
rcases (succ_le_of_lt h2).eq_or_lt with h2|h2
· refine ((h.1.trans_le h.2.2).ne ?_).elim
have h3 : 2 ∣ minFac n := by
rw [Nat.dvd_iff_mod_eq_zero, ← h2, succ_eq_add_one, add_mod, h.2.1]
rw [dvd_prime <| minFac_prime h.one_lt.ne'] at h3
norm_num at h3
exact h3
exact h2
theorem minFacHelper_2 {n k k' : ℕ} (e : k + 2 = k') (nk : ¬ Nat.Prime k)
(h : MinFacHelper n k) : MinFacHelper n k' := by
refine minFacHelper_1 e h λ h2 ↦ ?_
rw [← h2] at nk
exact nk <| minFac_prime h.one_lt.ne'
| Mathlib/Tactic/NormNum/Prime.lean | 90 | 95 | theorem minFacHelper_3 {n k k' : ℕ} (e : k + 2 = k') (nk : (n % k).beq 0 = false)
(h : MinFacHelper n k) : MinFacHelper n k' := by |
refine minFacHelper_1 e h λ h2 ↦ ?_
have nk := Nat.ne_of_beq_eq_false nk
rw [← Nat.dvd_iff_mod_eq_zero, ← h2] at nk
exact nk <| minFac_dvd n
| 4 | 54.59815 | 2 | 1.8 | 5 | 1,898 |
import Mathlib.Data.Rat.Cast.Defs
import Mathlib.Algebra.Field.Basic
#align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
namespace Rat
variable {α : Type*} [DivisionRing α]
-- Porting note: rewrote proof
@[simp]
theorem cast_inv_nat (n : ℕ) : ((n⁻¹ : ℚ) : α) = (n : α)⁻¹ := by
cases' n with n
· simp
rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero,
Int.sign_eq_one_of_pos (Nat.cast_pos.mpr n.succ_pos), Int.cast_one, one_div]
#align rat.cast_inv_nat Rat.cast_inv_nat
-- Porting note: proof got a lot easier - is this still the intended statement?
@[simp]
theorem cast_inv_int (n : ℤ) : ((n⁻¹ : ℚ) : α) = (n : α)⁻¹ := by
cases' n with n n
· simp [ofInt_eq_cast, cast_inv_nat]
· simp only [ofInt_eq_cast, Int.cast_negSucc, ← Nat.cast_succ, cast_neg, inv_neg, cast_inv_nat]
#align rat.cast_inv_int Rat.cast_inv_int
@[simp, norm_cast]
| Mathlib/Data/Rat/Cast/Lemmas.lean | 44 | 51 | theorem cast_nnratCast {K} [DivisionRing K] (q : ℚ≥0) :
((q : ℚ) : K) = (q : K) := by |
rw [Rat.cast_def, NNRat.cast_def, NNRat.cast_def]
have hn := @num_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den
on_goal 1 => have hd := @den_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den
case hdp => simpa only [Nat.cast_pos] using q.den_pos
simp only [Int.cast_natCast, Nat.cast_inj] at hn hd
rw [hn, hd, Int.cast_natCast]
| 6 | 403.428793 | 2 | 1.333333 | 6 | 1,436 |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
open CategoryTheory
namespace ModuleCat
variable {ι ι' R : Type*} [Ring R] {S : ShortComplex (ModuleCat R)}
(hS : S.Exact) (hS' : S.ShortExact) {v : ι → S.X₁}
open CategoryTheory Submodule Set
section LinearIndependent
variable (hv : LinearIndependent R v) {u : ι ⊕ ι' → S.X₂}
(hw : LinearIndependent R (S.g ∘ u ∘ Sum.inr))
(hm : Mono S.f) (huv : u ∘ Sum.inl = S.f ∘ v)
theorem disjoint_span_sum : Disjoint (span R (range (u ∘ Sum.inl)))
(span R (range (u ∘ Sum.inr))) := by
rw [huv, disjoint_comm]
refine Disjoint.mono_right (span_mono (range_comp_subset_range _ _)) ?_
rw [← LinearMap.range_coe, span_eq (LinearMap.range S.f), hS.moduleCat_range_eq_ker]
exact range_ker_disjoint hw
theorem linearIndependent_leftExact : LinearIndependent R u := by
rw [linearIndependent_sum]
refine ⟨?_, LinearIndependent.of_comp S.g hw, disjoint_span_sum hS hw huv⟩
rw [huv, LinearMap.linearIndependent_iff S.f]; swap
· rw [LinearMap.ker_eq_bot, ← mono_iff_injective]
infer_instance
exact hv
| Mathlib/Algebra/Category/ModuleCat/Free.lean | 72 | 78 | theorem linearIndependent_shortExact {w : ι' → S.X₃} (hw : LinearIndependent R w) :
LinearIndependent R (Sum.elim (S.f ∘ v) (S.g.toFun.invFun ∘ w)) := by |
apply linearIndependent_leftExact hS'.exact hv _ hS'.mono_f rfl
dsimp
convert hw
ext
apply Function.rightInverse_invFun ((epi_iff_surjective _).mp hS'.epi_g)
| 5 | 148.413159 | 2 | 2 | 5 | 2,042 |
import Mathlib.Data.Nat.Defs
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.log from "leanprover-community/mathlib"@"3e00d81bdcbf77c8188bbd18f5524ddc3ed8cac6"
namespace Nat
--@[pp_nodot] porting note: unknown attribute
def log (b : ℕ) : ℕ → ℕ
| n => if h : b ≤ n ∧ 1 < b then log b (n / b) + 1 else 0
decreasing_by
-- putting this in the def triggers the `unusedHavesSuffices` linter:
-- https://github.com/leanprover-community/batteries/issues/428
have : n / b < n := div_lt_self ((Nat.zero_lt_one.trans h.2).trans_le h.1) h.2
decreasing_trivial
#align nat.log Nat.log
@[simp]
theorem log_eq_zero_iff {b n : ℕ} : log b n = 0 ↔ n < b ∨ b ≤ 1 := by
rw [log, dite_eq_right_iff]
simp only [Nat.add_eq_zero_iff, Nat.one_ne_zero, and_false, imp_false, not_and_or, not_le, not_lt]
#align nat.log_eq_zero_iff Nat.log_eq_zero_iff
theorem log_of_lt {b n : ℕ} (hb : n < b) : log b n = 0 :=
log_eq_zero_iff.2 (Or.inl hb)
#align nat.log_of_lt Nat.log_of_lt
theorem log_of_left_le_one {b : ℕ} (hb : b ≤ 1) (n) : log b n = 0 :=
log_eq_zero_iff.2 (Or.inr hb)
#align nat.log_of_left_le_one Nat.log_of_left_le_one
@[simp]
theorem log_pos_iff {b n : ℕ} : 0 < log b n ↔ b ≤ n ∧ 1 < b := by
rw [Nat.pos_iff_ne_zero, Ne, log_eq_zero_iff, not_or, not_lt, not_le]
#align nat.log_pos_iff Nat.log_pos_iff
theorem log_pos {b n : ℕ} (hb : 1 < b) (hbn : b ≤ n) : 0 < log b n :=
log_pos_iff.2 ⟨hbn, hb⟩
#align nat.log_pos Nat.log_pos
theorem log_of_one_lt_of_le {b n : ℕ} (h : 1 < b) (hn : b ≤ n) : log b n = log b (n / b) + 1 := by
rw [log]
exact if_pos ⟨hn, h⟩
#align nat.log_of_one_lt_of_le Nat.log_of_one_lt_of_le
@[simp] lemma log_zero_left : ∀ n, log 0 n = 0 := log_of_left_le_one $ Nat.zero_le _
#align nat.log_zero_left Nat.log_zero_left
@[simp]
theorem log_zero_right (b : ℕ) : log b 0 = 0 :=
log_eq_zero_iff.2 (le_total 1 b)
#align nat.log_zero_right Nat.log_zero_right
@[simp]
theorem log_one_left : ∀ n, log 1 n = 0 :=
log_of_left_le_one le_rfl
#align nat.log_one_left Nat.log_one_left
@[simp]
theorem log_one_right (b : ℕ) : log b 1 = 0 :=
log_eq_zero_iff.2 (lt_or_le _ _)
#align nat.log_one_right Nat.log_one_right
| Mathlib/Data/Nat/Log.lean | 89 | 101 | theorem pow_le_iff_le_log {b : ℕ} (hb : 1 < b) {x y : ℕ} (hy : y ≠ 0) :
b ^ x ≤ y ↔ x ≤ log b y := by |
induction' y using Nat.strong_induction_on with y ih generalizing x
cases x with
| zero => dsimp; omega
| succ x =>
rw [log]; split_ifs with h
· have b_pos : 0 < b := lt_of_succ_lt hb
rw [Nat.add_le_add_iff_right, ← ih (y / b) (div_lt_self
(Nat.pos_iff_ne_zero.2 hy) hb) (Nat.div_pos h.1 b_pos).ne', le_div_iff_mul_le b_pos,
pow_succ', Nat.mul_comm]
· exact iff_of_false (fun hby => h ⟨(le_self_pow x.succ_ne_zero _).trans hby, hb⟩)
(not_succ_le_zero _)
| 11 | 59,874.141715 | 2 | 1 | 6 | 1,106 |
import Mathlib.Algebra.Polynomial.Inductions
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.RingTheory.Multiplicity
import Mathlib.RingTheory.Ideal.Maps
#align_import data.polynomial.div from "leanprover-community/mathlib"@"e1e7190efdcefc925cb36f257a8362ef22944204"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {a b : R} {n : ℕ}
section Ring
variable [Ring R] {p q : R[X]}
theorem div_wf_lemma (h : degree q ≤ degree p ∧ p ≠ 0) (hq : Monic q) :
degree (p - q * (C (leadingCoeff p) * X ^ (natDegree p - natDegree q))) < degree p :=
have hp : leadingCoeff p ≠ 0 := mt leadingCoeff_eq_zero.1 h.2
have hq0 : q ≠ 0 := hq.ne_zero_of_polynomial_ne h.2
have hlt : natDegree q ≤ natDegree p :=
Nat.cast_le.1
(by rw [← degree_eq_natDegree h.2, ← degree_eq_natDegree hq0]; exact h.1)
degree_sub_lt
(by
rw [hq.degree_mul_comm, hq.degree_mul, degree_C_mul_X_pow _ hp, degree_eq_natDegree h.2,
degree_eq_natDegree hq0, ← Nat.cast_add, tsub_add_cancel_of_le hlt])
h.2 (by rw [leadingCoeff_monic_mul hq, leadingCoeff_mul_X_pow, leadingCoeff_C])
#align polynomial.div_wf_lemma Polynomial.div_wf_lemma
noncomputable def divModByMonicAux : ∀ (_p : R[X]) {q : R[X]}, Monic q → R[X] × R[X]
| p, q, hq =>
letI := Classical.decEq R
if h : degree q ≤ degree p ∧ p ≠ 0 then
let z := C (leadingCoeff p) * X ^ (natDegree p - natDegree q)
have _wf := div_wf_lemma h hq
let dm := divModByMonicAux (p - q * z) hq
⟨z + dm.1, dm.2⟩
else ⟨0, p⟩
termination_by p => p
#align polynomial.div_mod_by_monic_aux Polynomial.divModByMonicAux
def divByMonic (p q : R[X]) : R[X] :=
letI := Classical.decEq R
if hq : Monic q then (divModByMonicAux p hq).1 else 0
#align polynomial.div_by_monic Polynomial.divByMonic
def modByMonic (p q : R[X]) : R[X] :=
letI := Classical.decEq R
if hq : Monic q then (divModByMonicAux p hq).2 else p
#align polynomial.mod_by_monic Polynomial.modByMonic
@[inherit_doc]
infixl:70 " /ₘ " => divByMonic
@[inherit_doc]
infixl:70 " %ₘ " => modByMonic
theorem degree_modByMonic_lt [Nontrivial R] :
∀ (p : R[X]) {q : R[X]} (_hq : Monic q), degree (p %ₘ q) < degree q
| p, q, hq =>
letI := Classical.decEq R
if h : degree q ≤ degree p ∧ p ≠ 0 then by
have _wf := div_wf_lemma ⟨h.1, h.2⟩ hq
have :=
degree_modByMonic_lt (p - q * (C (leadingCoeff p) * X ^ (natDegree p - natDegree q))) hq
unfold modByMonic at this ⊢
unfold divModByMonicAux
dsimp
rw [dif_pos hq] at this ⊢
rw [if_pos h]
exact this
else
Or.casesOn (not_and_or.1 h)
(by
unfold modByMonic divModByMonicAux
dsimp
rw [dif_pos hq, if_neg h]
exact lt_of_not_ge)
(by
intro hp
unfold modByMonic divModByMonicAux
dsimp
rw [dif_pos hq, if_neg h, Classical.not_not.1 hp]
exact lt_of_le_of_ne bot_le (Ne.symm (mt degree_eq_bot.1 hq.ne_zero)))
termination_by p => p
#align polynomial.degree_mod_by_monic_lt Polynomial.degree_modByMonic_lt
| Mathlib/Algebra/Polynomial/Div.lean | 166 | 173 | theorem natDegree_modByMonic_lt (p : R[X]) {q : R[X]} (hmq : Monic q) (hq : q ≠ 1) :
natDegree (p %ₘ q) < q.natDegree := by |
by_cases hpq : p %ₘ q = 0
· rw [hpq, natDegree_zero, Nat.pos_iff_ne_zero]
contrapose! hq
exact eq_one_of_monic_natDegree_zero hmq hq
· haveI := Nontrivial.of_polynomial_ne hpq
exact natDegree_lt_natDegree hpq (degree_modByMonic_lt p hmq)
| 6 | 403.428793 | 2 | 2 | 4 | 2,144 |
import Mathlib.Combinatorics.SimpleGraph.Connectivity
namespace SimpleGraph
universe u v
variable {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'}
namespace Subgraph
protected structure Preconnected (H : G.Subgraph) : Prop where
protected coe : H.coe.Preconnected
instance {H : G.Subgraph} : Coe H.Preconnected H.coe.Preconnected := ⟨Preconnected.coe⟩
instance {H : G.Subgraph} : CoeFun H.Preconnected (fun _ => ∀ u v : H.verts, H.coe.Reachable u v) :=
⟨fun h => h.coe⟩
protected lemma preconnected_iff {H : G.Subgraph} :
H.Preconnected ↔ H.coe.Preconnected := ⟨fun ⟨h⟩ => h, .mk⟩
protected structure Connected (H : G.Subgraph) : Prop where
protected coe : H.coe.Connected
#align simple_graph.subgraph.connected SimpleGraph.Subgraph.Connected
instance {H : G.Subgraph} : Coe H.Connected H.coe.Connected := ⟨Connected.coe⟩
instance {H : G.Subgraph} : CoeFun H.Connected (fun _ => ∀ u v : H.verts, H.coe.Reachable u v) :=
⟨fun h => h.coe⟩
protected lemma connected_iff' {H : G.Subgraph} :
H.Connected ↔ H.coe.Connected := ⟨fun ⟨h⟩ => h, .mk⟩
protected lemma connected_iff {H : G.Subgraph} :
H.Connected ↔ H.Preconnected ∧ H.verts.Nonempty := by
rw [H.connected_iff', connected_iff, H.preconnected_iff, Set.nonempty_coe_sort]
protected lemma Connected.preconnected {H : G.Subgraph} (h : H.Connected) : H.Preconnected := by
rw [H.connected_iff] at h; exact h.1
protected lemma Connected.nonempty {H : G.Subgraph} (h : H.Connected) : H.verts.Nonempty := by
rw [H.connected_iff] at h; exact h.2
| Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean | 64 | 69 | theorem singletonSubgraph_connected {v : V} : (G.singletonSubgraph v).Connected := by |
refine ⟨⟨?_⟩⟩
rintro ⟨a, ha⟩ ⟨b, hb⟩
simp only [singletonSubgraph_verts, Set.mem_singleton_iff] at ha hb
subst_vars
rfl
| 5 | 148.413159 | 2 | 2 | 2 | 2,427 |
import Mathlib.Topology.Algebra.Module.WeakDual
import Mathlib.Algebra.Algebra.Spectrum
import Mathlib.Topology.ContinuousFunction.Algebra
import Mathlib.Data.Set.Lattice
#align_import topology.algebra.module.character_space from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
namespace WeakDual
def characterSpace (𝕜 : Type*) (A : Type*) [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜]
[ContinuousConstSMul 𝕜 𝕜] [NonUnitalNonAssocSemiring A] [TopologicalSpace A] [Module 𝕜 A] :=
{φ : WeakDual 𝕜 A | φ ≠ 0 ∧ ∀ x y : A, φ (x * y) = φ x * φ y}
#align weak_dual.character_space WeakDual.characterSpace
variable {𝕜 : Type*} {A : Type*}
-- Porting note: even though the capitalization of the namespace differs, it doesn't matter
-- because there is no dot notation since `characterSpace` is only a type via `CoeSort`.
namespace CharacterSpace
section NonUnitalNonAssocSemiring
variable [CommSemiring 𝕜] [TopologicalSpace 𝕜] [ContinuousAdd 𝕜] [ContinuousConstSMul 𝕜 𝕜]
[NonUnitalNonAssocSemiring A] [TopologicalSpace A] [Module 𝕜 A]
instance instFunLike : FunLike (characterSpace 𝕜 A) A 𝕜 where
coe φ := ((φ : WeakDual 𝕜 A) : A → 𝕜)
coe_injective' φ ψ h := by ext1; apply DFunLike.ext; exact congr_fun h
instance instContinuousLinearMapClass : ContinuousLinearMapClass (characterSpace 𝕜 A) 𝕜 A 𝕜 where
map_smulₛₗ φ := (φ : WeakDual 𝕜 A).map_smul
map_add φ := (φ : WeakDual 𝕜 A).map_add
map_continuous φ := (φ : WeakDual 𝕜 A).cont
-- Porting note: moved because Lean 4 doesn't see the `DFunLike` instance on `characterSpace 𝕜 A`
-- until the `ContinuousLinearMapClass` instance is declared
@[simp, norm_cast]
protected theorem coe_coe (φ : characterSpace 𝕜 A) : ⇑(φ : WeakDual 𝕜 A) = (φ : A → 𝕜) :=
rfl
#align weak_dual.character_space.coe_coe WeakDual.CharacterSpace.coe_coe
@[ext]
theorem ext {φ ψ : characterSpace 𝕜 A} (h : ∀ x, φ x = ψ x) : φ = ψ :=
DFunLike.ext _ _ h
#align weak_dual.character_space.ext WeakDual.CharacterSpace.ext
def toCLM (φ : characterSpace 𝕜 A) : A →L[𝕜] 𝕜 :=
(φ : WeakDual 𝕜 A)
#align weak_dual.character_space.to_clm WeakDual.CharacterSpace.toCLM
@[simp]
theorem coe_toCLM (φ : characterSpace 𝕜 A) : ⇑(toCLM φ) = φ :=
rfl
#align weak_dual.character_space.coe_to_clm WeakDual.CharacterSpace.coe_toCLM
instance instNonUnitalAlgHomClass : NonUnitalAlgHomClass (characterSpace 𝕜 A) 𝕜 A 𝕜 :=
{ CharacterSpace.instContinuousLinearMapClass with
map_smulₛₗ := fun φ => map_smul φ
map_zero := fun φ => map_zero φ
map_mul := fun φ => φ.prop.2 }
def toNonUnitalAlgHom (φ : characterSpace 𝕜 A) : A →ₙₐ[𝕜] 𝕜 where
toFun := (φ : A → 𝕜)
map_mul' := map_mul φ
map_smul' := map_smul φ
map_zero' := map_zero φ
map_add' := map_add φ
#align weak_dual.character_space.to_non_unital_alg_hom WeakDual.CharacterSpace.toNonUnitalAlgHom
@[simp]
theorem coe_toNonUnitalAlgHom (φ : characterSpace 𝕜 A) : ⇑(toNonUnitalAlgHom φ) = φ :=
rfl
#align weak_dual.character_space.coe_to_non_unital_alg_hom WeakDual.CharacterSpace.coe_toNonUnitalAlgHom
instance instIsEmpty [Subsingleton A] : IsEmpty (characterSpace 𝕜 A) :=
⟨fun φ => φ.prop.1 <|
ContinuousLinearMap.ext fun x => by
rw [show x = 0 from Subsingleton.elim x 0, map_zero, map_zero] ⟩
variable (𝕜 A)
theorem union_zero :
characterSpace 𝕜 A ∪ {0} = {φ : WeakDual 𝕜 A | ∀ x y : A, φ (x * y) = φ x * φ y} :=
le_antisymm (by
rintro φ (hφ | rfl)
· exact hφ.2
· exact fun _ _ => by exact (zero_mul (0 : 𝕜)).symm)
fun φ hφ => Or.elim (em <| φ = 0) Or.inr fun h₀ => Or.inl ⟨h₀, hφ⟩
#align weak_dual.character_space.union_zero WeakDual.CharacterSpace.union_zero
| Mathlib/Topology/Algebra/Module/CharacterSpace.lean | 128 | 134 | theorem union_zero_isClosed [T2Space 𝕜] [ContinuousMul 𝕜] :
IsClosed (characterSpace 𝕜 A ∪ {0}) := by |
simp only [union_zero, Set.setOf_forall]
exact
isClosed_iInter fun x =>
isClosed_iInter fun y =>
isClosed_eq (eval_continuous _) <| (eval_continuous _).mul (eval_continuous _)
| 5 | 148.413159 | 2 | 2 | 1 | 2,022 |
import Mathlib.Algebra.Polynomial.Mirror
import Mathlib.Analysis.Complex.Polynomial
#align_import data.polynomial.unit_trinomial from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
namespace Polynomial
open scoped Polynomial
open Finset
section Semiring
variable {R : Type*} [Semiring R] (k m n : ℕ) (u v w : R)
noncomputable def trinomial :=
C u * X ^ k + C v * X ^ m + C w * X ^ n
#align polynomial.trinomial Polynomial.trinomial
theorem trinomial_def : trinomial k m n u v w = C u * X ^ k + C v * X ^ m + C w * X ^ n :=
rfl
#align polynomial.trinomial_def Polynomial.trinomial_def
variable {k m n u v w}
theorem trinomial_leading_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff n = w := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg (hkm.trans hmn).ne', if_neg hmn.ne', if_pos rfl, zero_add, zero_add]
#align polynomial.trinomial_leading_coeff' Polynomial.trinomial_leading_coeff'
theorem trinomial_middle_coeff (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff m = v := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg hkm.ne', if_pos rfl, if_neg hmn.ne, zero_add, add_zero]
#align polynomial.trinomial_middle_coeff Polynomial.trinomial_middle_coeff
theorem trinomial_trailing_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff k = u := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_pos rfl, if_neg hkm.ne, if_neg (hkm.trans hmn).ne, add_zero, add_zero]
#align polynomial.trinomial_trailing_coeff' Polynomial.trinomial_trailing_coeff'
| Mathlib/Algebra/Polynomial/UnitTrinomial.lean | 67 | 78 | theorem trinomial_natDegree (hkm : k < m) (hmn : m < n) (hw : w ≠ 0) :
(trinomial k m n u v w).natDegree = n := by |
refine
natDegree_eq_of_degree_eq_some
((Finset.sup_le fun i h => ?_).antisymm <|
le_degree_of_ne_zero <| by rwa [trinomial_leading_coeff' hkm hmn])
replace h := support_trinomial' k m n u v w h
rw [mem_insert, mem_insert, mem_singleton] at h
rcases h with (rfl | rfl | rfl)
· exact WithBot.coe_le_coe.mpr (hkm.trans hmn).le
· exact WithBot.coe_le_coe.mpr hmn.le
· exact le_rfl
| 10 | 22,026.465795 | 2 | 1.111111 | 9 | 1,193 |
import Mathlib.Algebra.Homology.Homotopy
import Mathlib.Algebra.Category.ModuleCat.Abelian
import Mathlib.Algebra.Category.ModuleCat.Subobject
import Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory
#align_import algebra.homology.Module from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Limits HomologicalComplex
variable {R : Type v} [Ring R]
variable {ι : Type*} {c : ComplexShape ι} {C D : HomologicalComplex (ModuleCat.{u} R) c}
namespace ModuleCat
theorem homology'_ext {L M N K : ModuleCat.{u} R} {f : L ⟶ M} {g : M ⟶ N} (w : f ≫ g = 0)
{h k : homology' f g w ⟶ K}
(w :
∀ x : LinearMap.ker g,
h (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x)) =
k (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x))) :
h = k := by
refine Concrete.cokernel_funext fun n => ?_
-- Porting note: as `equiv_rw` was not ported, it was replaced by `Equiv.surjective`
-- Gosh it would be nice if `equiv_rw` could directly use an isomorphism, or an enriched `≃`.
obtain ⟨n, rfl⟩ := (kernelSubobjectIso g ≪≫
ModuleCat.kernelIsoKer g).toLinearEquiv.toEquiv.symm.surjective n
exact w n
set_option linter.uppercaseLean3 false in
#align Module.homology_ext ModuleCat.homology'_ext
abbrev toCycles' {C : HomologicalComplex (ModuleCat.{u} R) c} {i : ι}
(x : LinearMap.ker (C.dFrom i)) : (C.cycles' i : Type u) :=
toKernelSubobject x
set_option linter.uppercaseLean3 false in
#align Module.to_cycles ModuleCat.toCycles'
@[ext]
theorem cycles'_ext {C : HomologicalComplex (ModuleCat.{u} R) c} {i : ι}
{x y : (C.cycles' i : Type u)}
(w : (C.cycles' i).arrow x = (C.cycles' i).arrow y) : x = y := by
apply_fun (C.cycles' i).arrow using (ModuleCat.mono_iff_injective _).mp (cycles' C i).arrow_mono
exact w
set_option linter.uppercaseLean3 false in
#align Module.cycles_ext ModuleCat.cycles'_ext
-- Porting note: both proofs by `rw` were proofs by `simp` which no longer worked
-- see https://github.com/leanprover-community/mathlib4/issues/5026
@[simp]
| Mathlib/Algebra/Homology/ModuleCat.lean | 72 | 79 | theorem cycles'Map_toCycles' (f : C ⟶ D) {i : ι} (x : LinearMap.ker (C.dFrom i)) :
(cycles'Map f i) (toCycles' x) = toCycles' ⟨f.f i x.1, by
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
rw [LinearMap.mem_ker]; erw [Hom.comm_from_apply, x.2, map_zero]⟩ := by |
ext
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [cycles'Map_arrow_apply, toKernelSubobject_arrow, toKernelSubobject_arrow]
rfl
| 4 | 54.59815 | 2 | 1.25 | 4 | 1,337 |
import Mathlib.Algebra.Module.Card
import Mathlib.SetTheory.Cardinal.CountableCover
import Mathlib.SetTheory.Cardinal.Continuum
import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Topology.MetricSpace.Perfect
universe u v
open Filter Pointwise Set Function Cardinal
open scoped Cardinal Topology
theorem continuum_le_cardinal_of_nontriviallyNormedField
(𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by
suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by
rcases this with ⟨f, -, -, f_inj⟩
simpa using lift_mk_le_lift_mk_of_injective f_inj
apply Perfect.exists_nat_bool_injection _ univ_nonempty
refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩
rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩
have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) :=
tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc)
rw [add_zero] at A
have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU
rcases B.exists with ⟨n, hn⟩
refine ⟨x + c^n, by simpa using hn, ?_⟩
simp only [ne_eq, add_right_eq_self]
apply pow_ne_zero
simpa using c_pos
theorem continuum_le_cardinal_of_module
(𝕜 : Type u) (E : Type v) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
[AddCommGroup E] [Module 𝕜 E] [Nontrivial E] : 𝔠 ≤ #E := by
have A : lift.{v} (𝔠 : Cardinal.{u}) ≤ lift.{v} (#𝕜) := by
simpa using continuum_le_cardinal_of_nontriviallyNormedField 𝕜
simpa using A.trans (Cardinal.mk_le_of_module 𝕜 E)
lemma cardinal_eq_of_mem_nhds_zero
{E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : s ∈ 𝓝 (0 : E)) : #s = #E := by
obtain ⟨c, hc⟩ : ∃ x : 𝕜 , 1 < ‖x‖ := NormedField.exists_lt_norm 𝕜 1
have cn_ne : ∀ n, c^n ≠ 0 := by
intro n
apply pow_ne_zero
rintro rfl
simp only [norm_zero] at hc
exact lt_irrefl _ (hc.trans zero_lt_one)
have A : ∀ (x : E), ∀ᶠ n in (atTop : Filter ℕ), x ∈ c^n • s := by
intro x
have : Tendsto (fun n ↦ (c^n) ⁻¹ • x) atTop (𝓝 ((0 : 𝕜) • x)) := by
have : Tendsto (fun n ↦ (c^n)⁻¹) atTop (𝓝 0) := by
simp_rw [← inv_pow]
apply tendsto_pow_atTop_nhds_zero_of_norm_lt_one
rw [norm_inv]
exact inv_lt_one hc
exact Tendsto.smul_const this x
rw [zero_smul] at this
filter_upwards [this hs] with n (hn : (c ^ n)⁻¹ • x ∈ s)
exact (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).2 hn
have B : ∀ n, #(c^n • s :) = #s := by
intro n
have : (c^n • s :) ≃ s :=
{ toFun := fun x ↦ ⟨(c^n)⁻¹ • x.1, (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).1 x.2⟩
invFun := fun x ↦ ⟨(c^n) • x.1, smul_mem_smul_set x.2⟩
left_inv := fun x ↦ by simp [smul_smul, mul_inv_cancel (cn_ne n)]
right_inv := fun x ↦ by simp [smul_smul, inv_mul_cancel (cn_ne n)] }
exact Cardinal.mk_congr this
apply (Cardinal.mk_of_countable_eventually_mem A B).symm
| Mathlib/Topology/Algebra/Module/Cardinality.lean | 97 | 106 | theorem cardinal_eq_of_mem_nhds
{E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E]
{s : Set E} {x : E} (hs : s ∈ 𝓝 x) : #s = #E := by |
let g := Homeomorph.addLeft x
let t := g ⁻¹' s
have : t ∈ 𝓝 0 := g.continuous.continuousAt.preimage_mem_nhds (by simpa [g] using hs)
have A : #t = #E := cardinal_eq_of_mem_nhds_zero 𝕜 this
have B : #t = #s := Cardinal.mk_subtype_of_equiv s g.toEquiv
rwa [B] at A
| 6 | 403.428793 | 2 | 1.2 | 5 | 1,284 |
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integral
#align_import ring_theory.integrally_closed from "leanprover-community/mathlib"@"d35b4ff446f1421bd551fafa4b8efd98ac3ac408"
open scoped nonZeroDivisors Polynomial
open Polynomial
abbrev IsIntegrallyClosedIn (R A : Type*) [CommRing R] [CommRing A] [Algebra R A] :=
IsIntegralClosure R R A
abbrev IsIntegrallyClosed (R : Type*) [CommRing R] := IsIntegrallyClosedIn R (FractionRing R)
#align is_integrally_closed IsIntegrallyClosed
section Iff
variable {R : Type*} [CommRing R]
variable {A B : Type*} [CommRing A] [CommRing B] [Algebra R A] [Algebra R B]
theorem AlgHom.isIntegrallyClosedIn (f : A →ₐ[R] B) (hf : Function.Injective f) :
IsIntegrallyClosedIn R B → IsIntegrallyClosedIn R A := by
rintro ⟨inj, cl⟩
refine ⟨Function.Injective.of_comp (f := f) ?_, fun hx => ?_, ?_⟩
· convert inj
aesop
· obtain ⟨y, fx_eq⟩ := cl.mp ((isIntegral_algHom_iff f hf).mpr hx)
aesop
· rintro ⟨y, rfl⟩
apply (isIntegral_algHom_iff f hf).mp
aesop
theorem AlgEquiv.isIntegrallyClosedIn (e : A ≃ₐ[R] B) :
IsIntegrallyClosedIn R A ↔ IsIntegrallyClosedIn R B :=
⟨AlgHom.isIntegrallyClosedIn e.symm e.symm.injective, AlgHom.isIntegrallyClosedIn e e.injective⟩
variable (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
theorem isIntegrallyClosed_iff_isIntegrallyClosedIn :
IsIntegrallyClosed R ↔ IsIntegrallyClosedIn R K :=
(IsLocalization.algEquiv R⁰ _ _).isIntegrallyClosedIn
theorem isIntegrallyClosed_iff_isIntegralClosure : IsIntegrallyClosed R ↔ IsIntegralClosure R R K :=
isIntegrallyClosed_iff_isIntegrallyClosedIn K
#align is_integrally_closed_iff_is_integral_closure isIntegrallyClosed_iff_isIntegralClosure
| Mathlib/RingTheory/IntegrallyClosed.lean | 110 | 120 | theorem isIntegrallyClosedIn_iff {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] :
IsIntegrallyClosedIn R A ↔
Function.Injective (algebraMap R A) ∧
∀ {x : A}, IsIntegral R x → ∃ y, algebraMap R A y = x := by |
constructor
· rintro ⟨_, cl⟩
aesop
· rintro ⟨inj, cl⟩
refine ⟨inj, by aesop, ?_⟩
rintro ⟨y, rfl⟩
apply isIntegral_algebraMap
| 7 | 1,096.633158 | 2 | 1.75 | 4 | 1,859 |
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Topology.Algebra.Module.StrongTopology
#align_import analysis.normed_space.compact_operator from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open Function Set Filter Bornology Metric Pointwise Topology
def IsCompactOperator {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁] [TopologicalSpace M₂]
(f : M₁ → M₂) : Prop :=
∃ K, IsCompact K ∧ f ⁻¹' K ∈ (𝓝 0 : Filter M₁)
#align is_compact_operator IsCompactOperator
theorem isCompactOperator_zero {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁]
[TopologicalSpace M₂] [Zero M₂] : IsCompactOperator (0 : M₁ → M₂) :=
⟨{0}, isCompact_singleton, mem_of_superset univ_mem fun _ _ => rfl⟩
#align is_compact_operator_zero isCompactOperator_zero
section Characterizations
section
variable {R₁ R₂ : Type*} [Semiring R₁] [Semiring R₂] {σ₁₂ : R₁ →+* R₂} {M₁ M₂ : Type*}
[TopologicalSpace M₁] [AddCommMonoid M₁] [TopologicalSpace M₂]
theorem isCompactOperator_iff_exists_mem_nhds_image_subset_compact (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), ∃ K : Set M₂, IsCompact K ∧ f '' V ⊆ K :=
⟨fun ⟨K, hK, hKf⟩ => ⟨f ⁻¹' K, hKf, K, hK, image_preimage_subset _ _⟩, fun ⟨_, hV, K, hK, hVK⟩ =>
⟨K, hK, mem_of_superset hV (image_subset_iff.mp hVK)⟩⟩
#align is_compact_operator_iff_exists_mem_nhds_image_subset_compact isCompactOperator_iff_exists_mem_nhds_image_subset_compact
theorem isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image [T2Space M₂] (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), IsCompact (closure <| f '' V) := by
rw [isCompactOperator_iff_exists_mem_nhds_image_subset_compact]
exact
⟨fun ⟨V, hV, K, hK, hKV⟩ => ⟨V, hV, hK.closure_of_subset hKV⟩,
fun ⟨V, hV, hVc⟩ => ⟨V, hV, closure (f '' V), hVc, subset_closure⟩⟩
#align is_compact_operator_iff_exists_mem_nhds_is_compact_closure_image isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image
end
section Continuous
variable {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [NontriviallyNormedField 𝕜₂]
{σ₁₂ : 𝕜₁ →+* 𝕜₂} [RingHomIsometric σ₁₂] {M₁ M₂ : Type*} [TopologicalSpace M₁] [AddCommGroup M₁]
[TopologicalSpace M₂] [AddCommGroup M₂] [Module 𝕜₁ M₁] [Module 𝕜₂ M₂] [TopologicalAddGroup M₁]
[ContinuousConstSMul 𝕜₁ M₁] [TopologicalAddGroup M₂] [ContinuousSMul 𝕜₂ M₂]
@[continuity]
| Mathlib/Analysis/NormedSpace/CompactOperator.lean | 336 | 365 | theorem IsCompactOperator.continuous {f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) :
Continuous f := by |
letI : UniformSpace M₂ := TopologicalAddGroup.toUniformSpace _
haveI : UniformAddGroup M₂ := comm_topologicalAddGroup_is_uniform
-- Since `f` is linear, we only need to show that it is continuous at zero.
-- Let `U` be a neighborhood of `0` in `M₂`.
refine continuous_of_continuousAt_zero f fun U hU => ?_
rw [map_zero] at hU
-- The compactness of `f` gives us a compact set `K : Set M₂` such that `f ⁻¹' K` is a
-- neighborhood of `0` in `M₁`.
rcases hf with ⟨K, hK, hKf⟩
-- But any compact set is totally bounded, hence Von-Neumann bounded. Thus, `K` absorbs `U`.
-- This gives `r > 0` such that `∀ a : 𝕜₂, r ≤ ‖a‖ → K ⊆ a • U`.
rcases (hK.totallyBounded.isVonNBounded 𝕜₂ hU).exists_pos with ⟨r, hr, hrU⟩
-- Choose `c : 𝕜₂` with `r < ‖c‖`.
rcases NormedField.exists_lt_norm 𝕜₁ r with ⟨c, hc⟩
have hcnz : c ≠ 0 := ne_zero_of_norm_ne_zero (hr.trans hc).ne.symm
-- We have `f ⁻¹' ((σ₁₂ c⁻¹) • K) = c⁻¹ • f ⁻¹' K ∈ 𝓝 0`. Thus, showing that
-- `(σ₁₂ c⁻¹) • K ⊆ U` is enough to deduce that `f ⁻¹' U ∈ 𝓝 0`.
suffices (σ₁₂ <| c⁻¹) • K ⊆ U by
refine mem_of_superset ?_ this
have : IsUnit c⁻¹ := hcnz.isUnit.inv
rwa [mem_map, preimage_smul_setₛₗ _ _ _ f this, set_smul_mem_nhds_zero_iff (inv_ne_zero hcnz)]
-- Since `σ₁₂ c⁻¹` = `(σ₁₂ c)⁻¹`, we have to prove that `K ⊆ σ₁₂ c • U`.
rw [map_inv₀, ← subset_set_smul_iff₀ ((map_ne_zero σ₁₂).mpr hcnz)]
-- But `σ₁₂` is isometric, so `‖σ₁₂ c‖ = ‖c‖ > r`, which concludes the argument since
-- `∀ a : 𝕜₂, r ≤ ‖a‖ → K ⊆ a • U`.
refine hrU (σ₁₂ c) ?_
rw [RingHomIsometric.is_iso]
exact hc.le
| 28 | 1,446,257,064,291.475 | 2 | 1.6 | 5 | 1,713 |
import Mathlib.Topology.Separation
import Mathlib.Topology.UniformSpace.Basic
import Mathlib.Topology.UniformSpace.Cauchy
#align_import topology.uniform_space.uniform_convergence from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9"
noncomputable section
open Topology Uniformity Filter Set
universe u v w x
variable {α : Type u} {β : Type v} {γ : Type w} {ι : Type x} [UniformSpace β]
variable {F : ι → α → β} {f : α → β} {s s' : Set α} {x : α} {p : Filter ι} {p' : Filter α}
{g : ι → α}
def TendstoUniformlyOnFilter (F : ι → α → β) (f : α → β) (p : Filter ι) (p' : Filter α) :=
∀ u ∈ 𝓤 β, ∀ᶠ n : ι × α in p ×ˢ p', (f n.snd, F n.fst n.snd) ∈ u
#align tendsto_uniformly_on_filter TendstoUniformlyOnFilter
theorem tendstoUniformlyOnFilter_iff_tendsto :
TendstoUniformlyOnFilter F f p p' ↔
Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ p') (𝓤 β) :=
Iff.rfl
#align tendsto_uniformly_on_filter_iff_tendsto tendstoUniformlyOnFilter_iff_tendsto
def TendstoUniformlyOn (F : ι → α → β) (f : α → β) (p : Filter ι) (s : Set α) :=
∀ u ∈ 𝓤 β, ∀ᶠ n in p, ∀ x : α, x ∈ s → (f x, F n x) ∈ u
#align tendsto_uniformly_on TendstoUniformlyOn
theorem tendstoUniformlyOn_iff_tendstoUniformlyOnFilter :
TendstoUniformlyOn F f p s ↔ TendstoUniformlyOnFilter F f p (𝓟 s) := by
simp only [TendstoUniformlyOn, TendstoUniformlyOnFilter]
apply forall₂_congr
simp_rw [eventually_prod_principal_iff]
simp
#align tendsto_uniformly_on_iff_tendsto_uniformly_on_filter tendstoUniformlyOn_iff_tendstoUniformlyOnFilter
alias ⟨TendstoUniformlyOn.tendstoUniformlyOnFilter, TendstoUniformlyOnFilter.tendstoUniformlyOn⟩ :=
tendstoUniformlyOn_iff_tendstoUniformlyOnFilter
#align tendsto_uniformly_on.tendsto_uniformly_on_filter TendstoUniformlyOn.tendstoUniformlyOnFilter
#align tendsto_uniformly_on_filter.tendsto_uniformly_on TendstoUniformlyOnFilter.tendstoUniformlyOn
theorem tendstoUniformlyOn_iff_tendsto {F : ι → α → β} {f : α → β} {p : Filter ι} {s : Set α} :
TendstoUniformlyOn F f p s ↔
Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ 𝓟 s) (𝓤 β) := by
simp [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto]
#align tendsto_uniformly_on_iff_tendsto tendstoUniformlyOn_iff_tendsto
def TendstoUniformly (F : ι → α → β) (f : α → β) (p : Filter ι) :=
∀ u ∈ 𝓤 β, ∀ᶠ n in p, ∀ x : α, (f x, F n x) ∈ u
#align tendsto_uniformly TendstoUniformly
-- Porting note: moved from below
theorem tendstoUniformlyOn_univ : TendstoUniformlyOn F f p univ ↔ TendstoUniformly F f p := by
simp [TendstoUniformlyOn, TendstoUniformly]
#align tendsto_uniformly_on_univ tendstoUniformlyOn_univ
theorem tendstoUniformly_iff_tendstoUniformlyOnFilter :
TendstoUniformly F f p ↔ TendstoUniformlyOnFilter F f p ⊤ := by
rw [← tendstoUniformlyOn_univ, tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, principal_univ]
#align tendsto_uniformly_iff_tendsto_uniformly_on_filter tendstoUniformly_iff_tendstoUniformlyOnFilter
theorem TendstoUniformly.tendstoUniformlyOnFilter (h : TendstoUniformly F f p) :
TendstoUniformlyOnFilter F f p ⊤ := by rwa [← tendstoUniformly_iff_tendstoUniformlyOnFilter]
#align tendsto_uniformly.tendsto_uniformly_on_filter TendstoUniformly.tendstoUniformlyOnFilter
theorem tendstoUniformlyOn_iff_tendstoUniformly_comp_coe :
TendstoUniformlyOn F f p s ↔ TendstoUniformly (fun i (x : s) => F i x) (f ∘ (↑)) p :=
forall₂_congr fun u _ => by simp
#align tendsto_uniformly_on_iff_tendsto_uniformly_comp_coe tendstoUniformlyOn_iff_tendstoUniformly_comp_coe
theorem tendstoUniformly_iff_tendsto {F : ι → α → β} {f : α → β} {p : Filter ι} :
TendstoUniformly F f p ↔ Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ ⊤) (𝓤 β) := by
simp [tendstoUniformly_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto]
#align tendsto_uniformly_iff_tendsto tendstoUniformly_iff_tendsto
| Mathlib/Topology/UniformSpace/UniformConvergence.lean | 166 | 171 | theorem TendstoUniformlyOnFilter.tendsto_at (h : TendstoUniformlyOnFilter F f p p')
(hx : 𝓟 {x} ≤ p') : Tendsto (fun n => F n x) p <| 𝓝 (f x) := by |
refine Uniform.tendsto_nhds_right.mpr fun u hu => mem_map.mpr ?_
filter_upwards [(h u hu).curry]
intro i h
simpa using h.filter_mono hx
| 4 | 54.59815 | 2 | 0.571429 | 7 | 517 |
import Mathlib.Algebra.Category.GroupCat.Basic
import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects
#align_import algebra.category.Group.zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open CategoryTheory
open CategoryTheory.Limits
universe u
namespace GroupCat
@[to_additive]
| Mathlib/Algebra/Category/GroupCat/Zero.lean | 28 | 34 | theorem isZero_of_subsingleton (G : GroupCat) [Subsingleton G] : IsZero G := by |
refine ⟨fun X => ⟨⟨⟨1⟩, fun f => ?_⟩⟩, fun X => ⟨⟨⟨1⟩, fun f => ?_⟩⟩⟩
· ext x
have : x = 1 := Subsingleton.elim _ _
rw [this, map_one, map_one]
· ext
apply Subsingleton.elim
| 6 | 403.428793 | 2 | 2 | 2 | 2,492 |
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Data.PNat.Defs
#align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
open Finset Function PNat
namespace PNat
variable (a b : ℕ+)
instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ+ := Subtype.instLocallyFiniteOrder _
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl
#align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype
theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b :=
Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc
theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b :=
Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico
theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b :=
Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc
theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b :=
Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo
theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b :=
map_subtype_embedding_Icc _ _
#align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc
@[simp]
| Mathlib/Data/PNat/Interval.lean | 67 | 72 | theorem card_Icc : (Icc a b).card = b + 1 - a := by |
rw [← Nat.card_Icc]
-- Porting note: I had to change this to `erw` *and* provide the proof, yuck.
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
rw [card_map]
| 5 | 148.413159 | 2 | 1 | 8 | 948 |
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
#align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973"
namespace Real
open IsAbsoluteValue Finset CauSeq Complex
theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by
apply exp_approx_start
iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_
norm_num1
refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_
rw [_root_.abs_one, abs_of_pos] <;> norm_num1
#align real.exp_one_near_10 Real.exp_one_near_10
| Mathlib/Data/Complex/ExponentialBounds.lean | 28 | 33 | theorem exp_one_near_20 : |exp 1 - 363916618873 / 133877442384| ≤ 1 / 10 ^ 20 := by |
apply exp_approx_start
iterate 21 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_
norm_num1
refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_
rw [_root_.abs_one, abs_of_pos] <;> norm_num1
| 5 | 148.413159 | 2 | 2 | 5 | 2,495 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.Deriv.Linear
import Mathlib.Analysis.Complex.Conformal
import Mathlib.Analysis.Calculus.Conformal.NormedSpace
#align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
section RealDerivOfComplex
open Complex
variable {e : ℂ → ℂ} {e' : ℂ} {z : ℝ}
theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) :
HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by
have A : HasStrictFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasStrictFDerivAt
have B :
HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ)
(ofRealCLM z) :=
h.hasStrictFDerivAt.restrictScalars ℝ
have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt
-- Porting note: this should be by:
-- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt
-- but for some reason simp can not use `ContinuousLinearMap.comp_apply`
convert (C.comp z (B.comp z A)).hasStrictDerivAt
rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply]
simp
#align has_strict_deriv_at.real_of_complex HasStrictDerivAt.real_of_complex
theorem HasDerivAt.real_of_complex (h : HasDerivAt e e' z) :
HasDerivAt (fun x : ℝ => (e x).re) e'.re z := by
have A : HasFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasFDerivAt
have B :
HasFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ)
(ofRealCLM z) :=
h.hasFDerivAt.restrictScalars ℝ
have C : HasFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasFDerivAt
-- Porting note: this should be by:
-- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt
-- but for some reason simp can not use `ContinuousLinearMap.comp_apply`
convert (C.comp z (B.comp z A)).hasDerivAt
rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply]
simp
#align has_deriv_at.real_of_complex HasDerivAt.real_of_complex
| Mathlib/Analysis/Complex/RealDeriv.lean | 84 | 89 | theorem ContDiffAt.real_of_complex {n : ℕ∞} (h : ContDiffAt ℂ n e z) :
ContDiffAt ℝ n (fun x : ℝ => (e x).re) z := by |
have A : ContDiffAt ℝ n ((↑) : ℝ → ℂ) z := ofRealCLM.contDiff.contDiffAt
have B : ContDiffAt ℝ n e z := h.restrict_scalars ℝ
have C : ContDiffAt ℝ n re (e z) := reCLM.contDiff.contDiffAt
exact C.comp z (B.comp z A)
| 4 | 54.59815 | 2 | 1 | 11 | 1,076 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
namespace Set
variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)
theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by
refine
⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h)
rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ici_add_bij Set.Ici_add_bij
theorem Ioi_add_bij : BijOn (· + d) (Ioi a) (Ioi (a + d)) := by
refine
⟨fun x h => add_lt_add_right (mem_Ioi.mp h) _, fun _ _ _ _ h => add_right_cancel h, fun _ h =>
?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ioi.mp h).le
rw [mem_Ioi, add_right_comm, add_lt_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ioi_add_bij Set.Ioi_add_bij
theorem Icc_add_bij : BijOn (· + d) (Icc a b) (Icc (a + d) (b + d)) := by
rw [← Ici_inter_Iic, ← Ici_inter_Iic]
exact
(Ici_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
#align set.Icc_add_bij Set.Icc_add_bij
theorem Ioo_add_bij : BijOn (· + d) (Ioo a b) (Ioo (a + d) (b + d)) := by
rw [← Ioi_inter_Iio, ← Ioi_inter_Iio]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
lt_of_add_lt_add_right hx.2
#align set.Ioo_add_bij Set.Ioo_add_bij
| Mathlib/Algebra/Order/Interval/Set/Monoid.lean | 58 | 62 | theorem Ioc_add_bij : BijOn (· + d) (Ioc a b) (Ioc (a + d) (b + d)) := by |
rw [← Ioi_inter_Iic, ← Ioi_inter_Iic]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
| 4 | 54.59815 | 2 | 1.090909 | 11 | 1,187 |
import Mathlib.Algebra.Group.ConjFinite
import Mathlib.GroupTheory.Abelianization
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.GroupAction.Quotient
import Mathlib.GroupTheory.Index
import Mathlib.GroupTheory.SpecificGroups.Dihedral
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.Qify
#align_import group_theory.commuting_probability from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
noncomputable section
open scoped Classical
open Fintype
variable (M : Type*) [Mul M]
def commProb : ℚ :=
Nat.card { p : M × M // Commute p.1 p.2 } / (Nat.card M : ℚ) ^ 2
#align comm_prob commProb
theorem commProb_def :
commProb M = Nat.card { p : M × M // Commute p.1 p.2 } / (Nat.card M : ℚ) ^ 2 :=
rfl
#align comm_prob_def commProb_def
theorem commProb_prod (M' : Type*) [Mul M'] : commProb (M × M') = commProb M * commProb M' := by
simp_rw [commProb_def, div_mul_div_comm, Nat.card_prod, Nat.cast_mul, mul_pow, ← Nat.cast_mul,
← Nat.card_prod, Commute, SemiconjBy, Prod.ext_iff]
congr 2
exact Nat.card_congr ⟨fun x => ⟨⟨⟨x.1.1.1, x.1.2.1⟩, x.2.1⟩, ⟨⟨x.1.1.2, x.1.2.2⟩, x.2.2⟩⟩,
fun x => ⟨⟨⟨x.1.1.1, x.2.1.1⟩, ⟨x.1.1.2, x.2.1.2⟩⟩, ⟨x.1.2, x.2.2⟩⟩, fun x => rfl, fun x => rfl⟩
| Mathlib/GroupTheory/CommutingProbability.lean | 54 | 60 | theorem commProb_pi {α : Type*} (i : α → Type*) [Fintype α] [∀ a, Mul (i a)] :
commProb (∀ a, i a) = ∏ a, commProb (i a) := by |
simp_rw [commProb_def, Finset.prod_div_distrib, Finset.prod_pow, ← Nat.cast_prod,
← Nat.card_pi, Commute, SemiconjBy, Function.funext_iff]
congr 2
exact Nat.card_congr ⟨fun x a => ⟨⟨x.1.1 a, x.1.2 a⟩, x.2 a⟩, fun x => ⟨⟨fun a => (x a).1.1,
fun a => (x a).1.2⟩, fun a => (x a).2⟩, fun x => rfl, fun x => rfl⟩
| 5 | 148.413159 | 2 | 1.625 | 8 | 1,749 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.HasseDeriv
#align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace Polynomial
open Polynomial
variable {R : Type*} [Semiring R] (r : R) (f : R[X])
def taylor (r : R) : R[X] →ₗ[R] R[X] where
toFun f := f.comp (X + C r)
map_add' f g := add_comp
map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply]
#align polynomial.taylor Polynomial.taylor
theorem taylor_apply : taylor r f = f.comp (X + C r) :=
rfl
#align polynomial.taylor_apply Polynomial.taylor_apply
@[simp]
theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_X Polynomial.taylor_X
@[simp]
theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_C Polynomial.taylor_C
@[simp]
theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by
ext
simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp,
Function.comp_apply, LinearMap.coe_comp]
#align polynomial.taylor_zero' Polynomial.taylor_zero'
theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply]
#align polynomial.taylor_zero Polynomial.taylor_zero
@[simp]
theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [← C_1, taylor_C]
#align polynomial.taylor_one Polynomial.taylor_one
@[simp]
theorem taylor_monomial (i : ℕ) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by
simp [taylor_apply]
#align polynomial.taylor_monomial Polynomial.taylor_monomial
theorem taylor_coeff (n : ℕ) : (taylor r f).coeff n = (hasseDeriv n f).eval r :=
show (lcoeff R n).comp (taylor r) f = (leval r).comp (hasseDeriv n) f by
congr 1; clear! f; ext i
simp only [leval_apply, mul_one, one_mul, eval_monomial, LinearMap.comp_apply, coeff_C_mul,
hasseDeriv_monomial, taylor_apply, monomial_comp, C_1, (commute_X (C r)).add_pow i,
map_sum]
simp only [lcoeff_apply, ← C_eq_natCast, mul_assoc, ← C_pow, ← C_mul, coeff_mul_C,
(Nat.cast_commute _ _).eq, coeff_X_pow, boole_mul, Finset.sum_ite_eq, Finset.mem_range]
split_ifs with h; · rfl
push_neg at h; rw [Nat.choose_eq_zero_of_lt h, Nat.cast_zero, mul_zero]
#align polynomial.taylor_coeff Polynomial.taylor_coeff
@[simp]
theorem taylor_coeff_zero : (taylor r f).coeff 0 = f.eval r := by
rw [taylor_coeff, hasseDeriv_zero, LinearMap.id_apply]
#align polynomial.taylor_coeff_zero Polynomial.taylor_coeff_zero
@[simp]
theorem taylor_coeff_one : (taylor r f).coeff 1 = f.derivative.eval r := by
rw [taylor_coeff, hasseDeriv_one]
#align polynomial.taylor_coeff_one Polynomial.taylor_coeff_one
@[simp]
theorem natDegree_taylor (p : R[X]) (r : R) : natDegree (taylor r p) = natDegree p := by
refine map_natDegree_eq_natDegree _ ?_
nontriviality R
intro n c c0
simp [taylor_monomial, natDegree_C_mul_eq_of_mul_ne_zero, natDegree_pow_X_add_C, c0]
#align polynomial.nat_degree_taylor Polynomial.natDegree_taylor
@[simp]
theorem taylor_mul {R} [CommSemiring R] (r : R) (p q : R[X]) :
taylor r (p * q) = taylor r p * taylor r q := by simp only [taylor_apply, mul_comp]
#align polynomial.taylor_mul Polynomial.taylor_mul
@[simps!]
def taylorAlgHom {R} [CommSemiring R] (r : R) : R[X] →ₐ[R] R[X] :=
AlgHom.ofLinearMap (taylor r) (taylor_one r) (taylor_mul r)
#align polynomial.taylor_alg_hom Polynomial.taylorAlgHom
theorem taylor_taylor {R} [CommSemiring R] (f : R[X]) (r s : R) :
taylor r (taylor s f) = taylor (r + s) f := by
simp only [taylor_apply, comp_assoc, map_add, add_comp, X_comp, C_comp, C_add, add_assoc]
#align polynomial.taylor_taylor Polynomial.taylor_taylor
theorem taylor_eval {R} [CommSemiring R] (r : R) (f : R[X]) (s : R) :
(taylor r f).eval s = f.eval (s + r) := by
simp only [taylor_apply, eval_comp, eval_C, eval_X, eval_add]
#align polynomial.taylor_eval Polynomial.taylor_eval
theorem taylor_eval_sub {R} [CommRing R] (r : R) (f : R[X]) (s : R) :
(taylor r f).eval (s - r) = f.eval s := by rw [taylor_eval, sub_add_cancel]
#align polynomial.taylor_eval_sub Polynomial.taylor_eval_sub
| Mathlib/Algebra/Polynomial/Taylor.lean | 130 | 134 | theorem taylor_injective {R} [CommRing R] (r : R) : Function.Injective (taylor r) := by |
intro f g h
apply_fun taylor (-r) at h
simpa only [taylor_apply, comp_assoc, add_comp, X_comp, C_comp, C_neg, neg_add_cancel_right,
comp_X] using h
| 4 | 54.59815 | 2 | 0.466667 | 15 | 415 |
import Mathlib.Tactic.FinCases
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Algebra.Field.IsField
#align_import ring_theory.ideal.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u v w
variable {α : Type u} {β : Type v}
open Set Function
open Pointwise
abbrev Ideal (R : Type u) [Semiring R] :=
Submodule R R
#align ideal Ideal
@[mk_iff]
class IsPrincipalIdealRing (R : Type u) [Semiring R] : Prop where
principal : ∀ S : Ideal R, S.IsPrincipal
#align is_principal_ideal_ring IsPrincipalIdealRing
attribute [instance] IsPrincipalIdealRing.principal
section Semiring
namespace Ideal
variable [Semiring α] (I : Ideal α) {a b : α}
protected theorem zero_mem : (0 : α) ∈ I :=
Submodule.zero_mem I
#align ideal.zero_mem Ideal.zero_mem
protected theorem add_mem : a ∈ I → b ∈ I → a + b ∈ I :=
Submodule.add_mem I
#align ideal.add_mem Ideal.add_mem
variable (a)
theorem mul_mem_left : b ∈ I → a * b ∈ I :=
Submodule.smul_mem I a
#align ideal.mul_mem_left Ideal.mul_mem_left
variable {a}
@[ext]
theorem ext {I J : Ideal α} (h : ∀ x, x ∈ I ↔ x ∈ J) : I = J :=
Submodule.ext h
#align ideal.ext Ideal.ext
theorem sum_mem (I : Ideal α) {ι : Type*} {t : Finset ι} {f : ι → α} :
(∀ c ∈ t, f c ∈ I) → (∑ i ∈ t, f i) ∈ I :=
Submodule.sum_mem I
#align ideal.sum_mem Ideal.sum_mem
theorem eq_top_of_unit_mem (x y : α) (hx : x ∈ I) (h : y * x = 1) : I = ⊤ :=
eq_top_iff.2 fun z _ =>
calc
z = z * (y * x) := by simp [h]
_ = z * y * x := Eq.symm <| mul_assoc z y x
_ ∈ I := I.mul_mem_left _ hx
#align ideal.eq_top_of_unit_mem Ideal.eq_top_of_unit_mem
theorem eq_top_of_isUnit_mem {x} (hx : x ∈ I) (h : IsUnit x) : I = ⊤ :=
let ⟨y, hy⟩ := h.exists_left_inv
eq_top_of_unit_mem I x y hx hy
#align ideal.eq_top_of_is_unit_mem Ideal.eq_top_of_isUnit_mem
theorem eq_top_iff_one : I = ⊤ ↔ (1 : α) ∈ I :=
⟨by rintro rfl; trivial, fun h => eq_top_of_unit_mem _ _ 1 h (by simp)⟩
#align ideal.eq_top_iff_one Ideal.eq_top_iff_one
theorem ne_top_iff_one : I ≠ ⊤ ↔ (1 : α) ∉ I :=
not_congr I.eq_top_iff_one
#align ideal.ne_top_iff_one Ideal.ne_top_iff_one
@[simp]
| Mathlib/RingTheory/Ideal/Basic.lean | 106 | 110 | theorem unit_mul_mem_iff_mem {x y : α} (hy : IsUnit y) : y * x ∈ I ↔ x ∈ I := by |
refine ⟨fun h => ?_, fun h => I.mul_mem_left y h⟩
obtain ⟨y', hy'⟩ := hy.exists_left_inv
have := I.mul_mem_left y' h
rwa [← mul_assoc, hy', one_mul] at this
| 4 | 54.59815 | 2 | 1 | 3 | 963 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Data.ENat.Basic
#align_import data.polynomial.degree.trailing_degree from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
noncomputable section
open Function Polynomial Finsupp Finset
open scoped Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
def trailingDegree (p : R[X]) : ℕ∞ :=
p.support.min
#align polynomial.trailing_degree Polynomial.trailingDegree
theorem trailingDegree_lt_wf : WellFounded fun p q : R[X] => trailingDegree p < trailingDegree q :=
InvImage.wf trailingDegree wellFounded_lt
#align polynomial.trailing_degree_lt_wf Polynomial.trailingDegree_lt_wf
def natTrailingDegree (p : R[X]) : ℕ :=
(trailingDegree p).getD 0
#align polynomial.nat_trailing_degree Polynomial.natTrailingDegree
def trailingCoeff (p : R[X]) : R :=
coeff p (natTrailingDegree p)
#align polynomial.trailing_coeff Polynomial.trailingCoeff
def TrailingMonic (p : R[X]) :=
trailingCoeff p = (1 : R)
#align polynomial.trailing_monic Polynomial.TrailingMonic
theorem TrailingMonic.def : TrailingMonic p ↔ trailingCoeff p = 1 :=
Iff.rfl
#align polynomial.trailing_monic.def Polynomial.TrailingMonic.def
instance TrailingMonic.decidable [DecidableEq R] : Decidable (TrailingMonic p) :=
inferInstanceAs <| Decidable (trailingCoeff p = (1 : R))
#align polynomial.trailing_monic.decidable Polynomial.TrailingMonic.decidable
@[simp]
theorem TrailingMonic.trailingCoeff {p : R[X]} (hp : p.TrailingMonic) : trailingCoeff p = 1 :=
hp
#align polynomial.trailing_monic.trailing_coeff Polynomial.TrailingMonic.trailingCoeff
@[simp]
theorem trailingDegree_zero : trailingDegree (0 : R[X]) = ⊤ :=
rfl
#align polynomial.trailing_degree_zero Polynomial.trailingDegree_zero
@[simp]
theorem trailingCoeff_zero : trailingCoeff (0 : R[X]) = 0 :=
rfl
#align polynomial.trailing_coeff_zero Polynomial.trailingCoeff_zero
@[simp]
theorem natTrailingDegree_zero : natTrailingDegree (0 : R[X]) = 0 :=
rfl
#align polynomial.nat_trailing_degree_zero Polynomial.natTrailingDegree_zero
theorem trailingDegree_eq_top : trailingDegree p = ⊤ ↔ p = 0 :=
⟨fun h => support_eq_empty.1 (Finset.min_eq_top.1 h), fun h => by simp [h]⟩
#align polynomial.trailing_degree_eq_top Polynomial.trailingDegree_eq_top
theorem trailingDegree_eq_natTrailingDegree (hp : p ≠ 0) :
trailingDegree p = (natTrailingDegree p : ℕ∞) := by
let ⟨n, hn⟩ :=
not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt trailingDegree_eq_top.1 hp))
have hn : trailingDegree p = n := Classical.not_not.1 hn
rw [natTrailingDegree, hn]
rfl
#align polynomial.trailing_degree_eq_nat_trailing_degree Polynomial.trailingDegree_eq_natTrailingDegree
theorem trailingDegree_eq_iff_natTrailingDegree_eq {p : R[X]} {n : ℕ} (hp : p ≠ 0) :
p.trailingDegree = n ↔ p.natTrailingDegree = n := by
rw [trailingDegree_eq_natTrailingDegree hp]
exact WithTop.coe_eq_coe
#align polynomial.trailing_degree_eq_iff_nat_trailing_degree_eq Polynomial.trailingDegree_eq_iff_natTrailingDegree_eq
theorem trailingDegree_eq_iff_natTrailingDegree_eq_of_pos {p : R[X]} {n : ℕ} (hn : 0 < n) :
p.trailingDegree = n ↔ p.natTrailingDegree = n := by
constructor
· intro H
rwa [← trailingDegree_eq_iff_natTrailingDegree_eq]
rintro rfl
rw [trailingDegree_zero] at H
exact Option.noConfusion H
· intro H
rwa [trailingDegree_eq_iff_natTrailingDegree_eq]
rintro rfl
rw [natTrailingDegree_zero] at H
rw [H] at hn
exact lt_irrefl _ hn
#align polynomial.trailing_degree_eq_iff_nat_trailing_degree_eq_of_pos Polynomial.trailingDegree_eq_iff_natTrailingDegree_eq_of_pos
theorem natTrailingDegree_eq_of_trailingDegree_eq_some {p : R[X]} {n : ℕ}
(h : trailingDegree p = n) : natTrailingDegree p = n :=
have hp0 : p ≠ 0 := fun hp0 => by rw [hp0] at h; exact Option.noConfusion h
Option.some_inj.1 <|
show (natTrailingDegree p : ℕ∞) = n by rwa [← trailingDegree_eq_natTrailingDegree hp0]
#align polynomial.nat_trailing_degree_eq_of_trailing_degree_eq_some Polynomial.natTrailingDegree_eq_of_trailingDegree_eq_some
@[simp]
theorem natTrailingDegree_le_trailingDegree : ↑(natTrailingDegree p) ≤ trailingDegree p := by
by_cases hp : p = 0;
· rw [hp, trailingDegree_zero]
exact le_top
rw [trailingDegree_eq_natTrailingDegree hp]
#align polynomial.nat_trailing_degree_le_trailing_degree Polynomial.natTrailingDegree_le_trailingDegree
theorem natTrailingDegree_eq_of_trailingDegree_eq [Semiring S] {q : S[X]}
(h : trailingDegree p = trailingDegree q) : natTrailingDegree p = natTrailingDegree q := by
unfold natTrailingDegree
rw [h]
#align polynomial.nat_trailing_degree_eq_of_trailing_degree_eq Polynomial.natTrailingDegree_eq_of_trailingDegree_eq
theorem trailingDegree_le_of_ne_zero (h : coeff p n ≠ 0) : trailingDegree p ≤ n :=
show @LE.le ℕ∞ _ p.support.min n from min_le (mem_support_iff.2 h)
#align polynomial.le_trailing_degree_of_ne_zero Polynomial.trailingDegree_le_of_ne_zero
| Mathlib/Algebra/Polynomial/Degree/TrailingDegree.lean | 158 | 164 | theorem natTrailingDegree_le_of_ne_zero (h : coeff p n ≠ 0) : natTrailingDegree p ≤ n := by |
have : WithTop.some (natTrailingDegree p) = Nat.cast (natTrailingDegree p) := rfl
rw [← WithTop.coe_le_coe, this, ← trailingDegree_eq_natTrailingDegree]
· exact trailingDegree_le_of_ne_zero h
· intro h
subst h
exact h rfl
| 6 | 403.428793 | 2 | 1.666667 | 6 | 1,754 |
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Defs
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
variable {α : Type*}
open Opposite
namespace Set
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_op_unop Set.singleton_op_unop
@[simp 1100]
| Mathlib/Data/Set/Opposite.lean | 100 | 104 | theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by |
ext
constructor
· apply unop_injective
· apply op_injective
| 4 | 54.59815 | 2 | 1.333333 | 6 | 1,444 |
import Mathlib.LinearAlgebra.FreeModule.PID
import Mathlib.LinearAlgebra.FreeModule.Finite.Basic
import Mathlib.LinearAlgebra.BilinearForm.DualLattice
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.Localization.Module
import Mathlib.RingTheory.Trace
#align_import ring_theory.dedekind_domain.integral_closure from "leanprover-community/mathlib"@"4cf7ca0e69e048b006674cf4499e5c7d296a89e0"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
variable [IsDomain A]
section IsIntegralClosure
open Algebra
variable [Algebra A K] [IsFractionRing A K]
variable (L : Type*) [Field L] (C : Type*) [CommRing C]
variable [Algebra K L] [Algebra A L] [IsScalarTower A K L]
variable [Algebra C L] [IsIntegralClosure C A L] [Algebra A C] [IsScalarTower A C L]
theorem IsIntegralClosure.isLocalization [Algebra.IsAlgebraic K L] :
IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
haveI : IsDomain C :=
(IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L)
haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L
haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L
refine ⟨?_, fun z => ?_, fun {x y} h => ⟨1, ?_⟩⟩
· rintro ⟨_, x, hx, rfl⟩
rw [isUnit_iff_ne_zero, map_ne_zero_iff _ (IsIntegralClosure.algebraMap_injective C A L),
Subtype.coe_mk, map_ne_zero_iff _ (NoZeroSMulDivisors.algebraMap_injective A C)]
exact mem_nonZeroDivisors_iff_ne_zero.mp hx
· obtain ⟨m, hm⟩ :=
IsIntegral.exists_multiple_integral_of_isLocalization A⁰ z
(Algebra.IsIntegral.isIntegral (R := K) z)
obtain ⟨x, hx⟩ : ∃ x, algebraMap C L x = m • z := IsIntegralClosure.isIntegral_iff.mp hm
refine ⟨⟨x, algebraMap A C m, m, SetLike.coe_mem m, rfl⟩, ?_⟩
rw [Subtype.coe_mk, ← IsScalarTower.algebraMap_apply, hx, mul_comm, Submonoid.smul_def,
smul_def]
· simp only [IsIntegralClosure.algebraMap_injective C A L h]
theorem IsIntegralClosure.isLocalization_of_isSeparable [IsSeparable K L] :
IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L :=
IsIntegralClosure.isLocalization A K L C
#align is_integral_closure.is_localization IsIntegralClosure.isLocalization_of_isSeparable
variable [FiniteDimensional K L]
variable {A K L}
theorem IsIntegralClosure.range_le_span_dualBasis [IsSeparable K L] {ι : Type*} [Fintype ι]
[DecidableEq ι] (b : Basis ι K L) (hb_int : ∀ i, IsIntegral A (b i)) [IsIntegrallyClosed A] :
LinearMap.range ((Algebra.linearMap C L).restrictScalars A) ≤
Submodule.span A (Set.range <| (traceForm K L).dualBasis (traceForm_nondegenerate K L) b) := by
rw [← LinearMap.BilinForm.dualSubmodule_span_of_basis,
← LinearMap.BilinForm.le_flip_dualSubmodule, Submodule.span_le]
rintro _ ⟨i, rfl⟩ _ ⟨y, rfl⟩
simp only [LinearMap.coe_restrictScalars, linearMap_apply, LinearMap.BilinForm.flip_apply,
traceForm_apply]
refine IsIntegrallyClosed.isIntegral_iff.mp ?_
exact isIntegral_trace ((IsIntegralClosure.isIntegral A L y).algebraMap.mul (hb_int i))
#align is_integral_closure.range_le_span_dual_basis IsIntegralClosure.range_le_span_dualBasis
theorem integralClosure_le_span_dualBasis [IsSeparable K L] {ι : Type*} [Fintype ι] [DecidableEq ι]
(b : Basis ι K L) (hb_int : ∀ i, IsIntegral A (b i)) [IsIntegrallyClosed A] :
Subalgebra.toSubmodule (integralClosure A L) ≤
Submodule.span A (Set.range <| (traceForm K L).dualBasis (traceForm_nondegenerate K L) b) := by
refine le_trans ?_ (IsIntegralClosure.range_le_span_dualBasis (integralClosure A L) b hb_int)
intro x hx
exact ⟨⟨x, hx⟩, rfl⟩
#align integral_closure_le_span_dual_basis integralClosure_le_span_dualBasis
variable (A K)
| Mathlib/RingTheory/DedekindDomain/IntegralClosure.lean | 119 | 138 | theorem exists_integral_multiples (s : Finset L) :
∃ y ≠ (0 : A), ∀ x ∈ s, IsIntegral A (y • x) := by |
haveI := Classical.decEq L
refine s.induction ?_ ?_
· use 1, one_ne_zero
rintro x ⟨⟩
· rintro x s hx ⟨y, hy, hs⟩
have := exists_integral_multiple
((IsFractionRing.isAlgebraic_iff A K L).mpr (.of_finite _ x))
((injective_iff_map_eq_zero (algebraMap A L)).mp ?_)
· rcases this with ⟨x', y', hy', hx'⟩
refine ⟨y * y', mul_ne_zero hy hy', fun x'' hx'' => ?_⟩
rcases Finset.mem_insert.mp hx'' with (rfl | hx'')
· rw [mul_smul, Algebra.smul_def, Algebra.smul_def, mul_comm _ x'', hx']
exact isIntegral_algebraMap.mul x'.2
· rw [mul_comm, mul_smul, Algebra.smul_def]
exact isIntegral_algebraMap.mul (hs _ hx'')
· rw [IsScalarTower.algebraMap_eq A K L]
apply (algebraMap K L).injective.comp
exact IsFractionRing.injective _ _
| 18 | 65,659,969.137331 | 2 | 1.8 | 5 | 1,881 |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.LinearAlgebra.FreeModule.PID
import Mathlib.LinearAlgebra.Matrix.AbsoluteValue
import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue
import Mathlib.RingTheory.ClassGroup
import Mathlib.RingTheory.DedekindDomain.IntegralClosure
import Mathlib.RingTheory.Norm
#align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176"
open scoped nonZeroDivisors
namespace ClassGroup
open Ring
section EuclideanDomain
variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S]
variable [Field K] [Field L]
variable [Algebra R K] [IsFractionRing R K]
variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L]
variable [algRL : Algebra R L] [IsScalarTower R K L]
variable [Algebra R S] [Algebra S L]
variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L]
variable (abv : AbsoluteValue R ℤ)
variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S)
noncomputable def normBound : ℤ :=
let n := Fintype.card ι
let i : ι := Nonempty.some bS.index_nonempty
let m : ℤ :=
Finset.max'
(Finset.univ.image fun ijk : ι × ι × ι =>
abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2))
⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩
Nat.factorial n • (n • m) ^ n
#align class_group.norm_bound ClassGroup.normBound
theorem normBound_pos : 0 < normBound abv bS := by
obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by
by_contra! h
obtain ⟨i⟩ := bS.index_nonempty
apply bS.ne_zero i
apply
(injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS)
ext j k
simp [h, DMatrix.zero_apply]
simp only [normBound, Algebra.smul_def, eq_natCast]
apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _))
refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _
refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_)
exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩
#align class_group.norm_bound_pos ClassGroup.normBound_pos
theorem norm_le (a : S) {y : ℤ} (hy : ∀ k, abv (bS.repr a k) ≤ y) :
abv (Algebra.norm R a) ≤ normBound abv bS * y ^ Fintype.card ι := by
conv_lhs => rw [← bS.sum_repr a]
rw [Algebra.norm_apply, ← LinearMap.det_toMatrix bS]
simp only [Algebra.norm_apply, AlgHom.map_sum, AlgHom.map_smul, map_sum,
map_smul, Algebra.toMatrix_lmul_eq, normBound, smul_mul_assoc, ← mul_pow]
convert Matrix.det_sum_smul_le Finset.univ _ hy using 3
· rw [Finset.card_univ, smul_mul_assoc, mul_comm]
· intro i j k
apply Finset.le_max'
exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩
#align class_group.norm_le ClassGroup.norm_le
theorem norm_lt {T : Type*} [LinearOrderedRing T] (a : S) {y : T}
(hy : ∀ k, (abv (bS.repr a k) : T) < y) :
(abv (Algebra.norm R a) : T) < normBound abv bS * y ^ Fintype.card ι := by
obtain ⟨i⟩ := bS.index_nonempty
have him : (Finset.univ.image fun k => abv (bS.repr a k)).Nonempty :=
⟨_, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩⟩
set y' : ℤ := Finset.max' _ him with y'_def
have hy' : ∀ k, abv (bS.repr a k) ≤ y' := by
intro k
exact @Finset.le_max' ℤ _ _ _ (Finset.mem_image.mpr ⟨k, Finset.mem_univ _, rfl⟩)
have : (y' : T) < y := by
rw [y'_def, ←
Finset.max'_image (show Monotone (_ : ℤ → T) from fun x y h => Int.cast_le.mpr h)]
apply (Finset.max'_lt_iff _ (him.image _)).mpr
simp only [Finset.mem_image, exists_prop]
rintro _ ⟨x, ⟨k, -, rfl⟩, rfl⟩
exact hy k
have y'_nonneg : 0 ≤ y' := le_trans (abv.nonneg _) (hy' i)
apply (Int.cast_le.mpr (norm_le abv bS a hy')).trans_lt
simp only [Int.cast_mul, Int.cast_pow]
apply mul_lt_mul' le_rfl
· exact pow_lt_pow_left this (Int.cast_nonneg.mpr y'_nonneg) (@Fintype.card_ne_zero _ _ ⟨i⟩)
· exact pow_nonneg (Int.cast_nonneg.mpr y'_nonneg) _
· exact Int.cast_pos.mpr (normBound_pos abv bS)
#align class_group.norm_lt ClassGroup.norm_lt
| Mathlib/NumberTheory/ClassNumber/Finite.lean | 119 | 135 | theorem exists_min (I : (Ideal S)⁰) :
∃ b ∈ (I : Ideal S),
b ≠ 0 ∧ ∀ c ∈ (I : Ideal S), abv (Algebra.norm R c) < abv (Algebra.norm R b) → c =
(0 : S) := by |
obtain ⟨_, ⟨b, b_mem, b_ne_zero, rfl⟩, min⟩ := @Int.exists_least_of_bdd
(fun a => ∃ b ∈ (I : Ideal S), b ≠ (0 : S) ∧ abv (Algebra.norm R b) = a)
(by
use 0
rintro _ ⟨b, _, _, rfl⟩
apply abv.nonneg)
(by
obtain ⟨b, b_mem, b_ne_zero⟩ := (I : Ideal S).ne_bot_iff.mp (nonZeroDivisors.coe_ne_zero I)
exact ⟨_, ⟨b, b_mem, b_ne_zero, rfl⟩⟩)
refine ⟨b, b_mem, b_ne_zero, ?_⟩
intro c hc lt
contrapose! lt with c_ne_zero
exact min _ ⟨c, hc, c_ne_zero, rfl⟩
| 13 | 442,413.392009 | 2 | 2 | 4 | 2,456 |
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.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Limits.Shapes.Kernels
import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.Subobject.Lattice
import Mathlib.Order.Atoms
#align_import category_theory.simple from "leanprover-community/mathlib"@"4ed0bcaef698011b0692b93a042a2282f490f6b6"
noncomputable section
open CategoryTheory.Limits
namespace CategoryTheory
universe v u
variable {C : Type u} [Category.{v} C]
section
variable [HasZeroMorphisms C]
class Simple (X : C) : Prop where
mono_isIso_iff_nonzero : ∀ {Y : C} (f : Y ⟶ X) [Mono f], IsIso f ↔ f ≠ 0
#align category_theory.simple CategoryTheory.Simple
theorem isIso_of_mono_of_nonzero {X Y : C} [Simple Y] {f : X ⟶ Y} [Mono f] (w : f ≠ 0) : IsIso f :=
(Simple.mono_isIso_iff_nonzero f).mpr w
#align category_theory.is_iso_of_mono_of_nonzero CategoryTheory.isIso_of_mono_of_nonzero
theorem Simple.of_iso {X Y : C} [Simple Y] (i : X ≅ Y) : Simple X :=
{ mono_isIso_iff_nonzero := fun f m => by
haveI : Mono (f ≫ i.hom) := mono_comp _ _
constructor
· intro h w
have j : IsIso (f ≫ i.hom) := by infer_instance
rw [Simple.mono_isIso_iff_nonzero] at j
subst w
simp at j
· intro h
have j : IsIso (f ≫ i.hom) := by
apply isIso_of_mono_of_nonzero
intro w
apply h
simpa using (cancel_mono i.inv).2 w
rw [← Category.comp_id f, ← i.hom_inv_id, ← Category.assoc]
infer_instance }
#align category_theory.simple.of_iso CategoryTheory.Simple.of_iso
theorem Simple.iff_of_iso {X Y : C} (i : X ≅ Y) : Simple X ↔ Simple Y :=
⟨fun _ => Simple.of_iso i.symm, fun _ => Simple.of_iso i⟩
#align category_theory.simple.iff_of_iso CategoryTheory.Simple.iff_of_iso
theorem kernel_zero_of_nonzero_from_simple {X Y : C} [Simple X] {f : X ⟶ Y} [HasKernel f]
(w : f ≠ 0) : kernel.ι f = 0 := by
classical
by_contra h
haveI := isIso_of_mono_of_nonzero h
exact w (eq_zero_of_epi_kernel f)
#align category_theory.kernel_zero_of_nonzero_from_simple CategoryTheory.kernel_zero_of_nonzero_from_simple
-- See also `mono_of_nonzero_from_simple`, which requires `Preadditive C`.
theorem epi_of_nonzero_to_simple [HasEqualizers C] {X Y : C} [Simple Y] {f : X ⟶ Y} [HasImage f]
(w : f ≠ 0) : Epi f := by
rw [← image.fac f]
haveI : IsIso (image.ι f) := isIso_of_mono_of_nonzero fun h => w (eq_zero_of_image_eq_zero h)
apply epi_comp
#align category_theory.epi_of_nonzero_to_simple CategoryTheory.epi_of_nonzero_to_simple
theorem mono_to_simple_zero_of_not_iso {X Y : C} [Simple Y] {f : X ⟶ Y} [Mono f]
(w : IsIso f → False) : f = 0 := by
classical
by_contra h
exact w (isIso_of_mono_of_nonzero h)
#align category_theory.mono_to_simple_zero_of_not_iso CategoryTheory.mono_to_simple_zero_of_not_iso
theorem id_nonzero (X : C) [Simple.{v} X] : 𝟙 X ≠ 0 :=
(Simple.mono_isIso_iff_nonzero (𝟙 X)).mp (by infer_instance)
#align category_theory.id_nonzero CategoryTheory.id_nonzero
instance (X : C) [Simple.{v} X] : Nontrivial (End X) :=
nontrivial_of_ne 1 _ (id_nonzero X)
section
theorem Simple.not_isZero (X : C) [Simple X] : ¬IsZero X := by
simpa [Limits.IsZero.iff_id_eq_zero] using id_nonzero X
#align category_theory.simple.not_is_zero CategoryTheory.Simple.not_isZero
variable [HasZeroObject C]
open ZeroObject
variable (C)
theorem zero_not_simple [Simple (0 : C)] : False :=
(Simple.mono_isIso_iff_nonzero (0 : (0 : C) ⟶ (0 : C))).mp ⟨⟨0, by aesop_cat⟩⟩ rfl
#align category_theory.zero_not_simple CategoryTheory.zero_not_simple
end
end
-- We next make the dual arguments, but for this we must be in an abelian category.
section Abelian
variable [Abelian C]
theorem simple_of_cosimple (X : C) (h : ∀ {Z : C} (f : X ⟶ Z) [Epi f], IsIso f ↔ f ≠ 0) :
Simple X :=
⟨fun {Y} f I => by
classical
fconstructor
· intros
have hx := cokernel.π_of_epi f
by_contra h
subst h
exact (h _).mp (cokernel.π_of_zero _ _) hx
· intro hf
suffices Epi f by exact isIso_of_mono_of_epi _
apply Preadditive.epi_of_cokernel_zero
by_contra h'
exact cokernel_not_iso_of_nonzero hf ((h _).mpr h')⟩
#align category_theory.simple_of_cosimple CategoryTheory.simple_of_cosimple
theorem isIso_of_epi_of_nonzero {X Y : C} [Simple X] {f : X ⟶ Y} [Epi f] (w : f ≠ 0) : IsIso f :=
-- `f ≠ 0` means that `kernel.ι f` is not an iso, and hence zero, and hence `f` is a mono.
haveI : Mono f :=
Preadditive.mono_of_kernel_zero (mono_to_simple_zero_of_not_iso (kernel_not_iso_of_nonzero w))
isIso_of_mono_of_epi f
#align category_theory.is_iso_of_epi_of_nonzero CategoryTheory.isIso_of_epi_of_nonzero
| Mathlib/CategoryTheory/Simple.lean | 170 | 175 | theorem cokernel_zero_of_nonzero_to_simple {X Y : C} [Simple Y] {f : X ⟶ Y} (w : f ≠ 0) :
cokernel.π f = 0 := by |
classical
by_contra h
haveI := isIso_of_epi_of_nonzero h
exact w (eq_zero_of_mono_cokernel f)
| 4 | 54.59815 | 2 | 1.5 | 8 | 1,594 |
import Mathlib.RingTheory.Localization.Module
import Mathlib.RingTheory.Norm
import Mathlib.RingTheory.Discriminant
#align_import ring_theory.localization.norm from "leanprover-community/mathlib"@"2e59a6de168f95d16b16d217b808a36290398c0a"
open scoped nonZeroDivisors
variable (R : Type*) {S : Type*} [CommRing R] [CommRing S] [Algebra R S]
variable {Rₘ Sₘ : Type*} [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
variable (M : Submonoid R)
variable [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ]
variable [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
open Algebra
theorem Algebra.map_leftMulMatrix_localization {ι : Type*} [Fintype ι] [DecidableEq ι]
(b : Basis ι R S) (a : S) :
(algebraMap R Rₘ).mapMatrix (leftMulMatrix b a) =
leftMulMatrix (b.localizationLocalization Rₘ M Sₘ) (algebraMap S Sₘ a) := by
ext i j
simp only [Matrix.map_apply, RingHom.mapMatrix_apply, leftMulMatrix_eq_repr_mul, ← map_mul,
Basis.localizationLocalization_apply, Basis.localizationLocalization_repr_algebraMap]
theorem Algebra.norm_localization [Module.Free R S] [Module.Finite R S] (a : S) :
Algebra.norm Rₘ (algebraMap S Sₘ a) = algebraMap R Rₘ (Algebra.norm R a) := by
cases subsingleton_or_nontrivial R
· haveI : Subsingleton Rₘ := Module.subsingleton R Rₘ
simp [eq_iff_true_of_subsingleton]
let b := Module.Free.chooseBasis R S
letI := Classical.decEq (Module.Free.ChooseBasisIndex R S)
rw [Algebra.norm_eq_matrix_det (b.localizationLocalization Rₘ M Sₘ),
Algebra.norm_eq_matrix_det b, RingHom.map_det, ← Algebra.map_leftMulMatrix_localization]
#align algebra.norm_localization Algebra.norm_localization
variable {M} in
lemma Algebra.norm_eq_iff [Module.Free R S] [Module.Finite R S] {a : S} {b : R}
(hM : M ≤ nonZeroDivisors R) : Algebra.norm R a = b ↔
(Algebra.norm Rₘ) ((algebraMap S Sₘ) a) = algebraMap R Rₘ b :=
⟨fun h ↦ h.symm ▸ Algebra.norm_localization _ M _, fun h ↦
IsLocalization.injective Rₘ hM <| h.symm ▸ (Algebra.norm_localization R M a).symm⟩
| Mathlib/RingTheory/Localization/NormTrace.lean | 83 | 92 | theorem Algebra.trace_localization [Module.Free R S] [Module.Finite R S] (a : S) :
Algebra.trace Rₘ Sₘ (algebraMap S Sₘ a) = algebraMap R Rₘ (Algebra.trace R S a) := by |
cases subsingleton_or_nontrivial R
· haveI : Subsingleton Rₘ := Module.subsingleton R Rₘ
simp [eq_iff_true_of_subsingleton]
let b := Module.Free.chooseBasis R S
letI := Classical.decEq (Module.Free.ChooseBasisIndex R S)
rw [Algebra.trace_eq_matrix_trace (b.localizationLocalization Rₘ M Sₘ),
Algebra.trace_eq_matrix_trace b, ← Algebra.map_leftMulMatrix_localization]
exact (AddMonoidHom.map_trace (algebraMap R Rₘ).toAddMonoidHom _).symm
| 8 | 2,980.957987 | 2 | 1.6 | 5 | 1,731 |
import Mathlib.Topology.Algebra.Algebra
import Mathlib.Analysis.InnerProductSpace.Basic
#align_import analysis.inner_product_space.of_norm from "leanprover-community/mathlib"@"baa88307f3e699fa7054ef04ec79fa4f056169cb"
open RCLike
open scoped ComplexConjugate
variable {𝕜 : Type*} [RCLike 𝕜] (E : Type*) [NormedAddCommGroup E]
class InnerProductSpaceable : Prop where
parallelogram_identity :
∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)
#align inner_product_spaceable InnerProductSpaceable
variable (𝕜) {E}
theorem InnerProductSpace.toInnerProductSpaceable [InnerProductSpace 𝕜 E] :
InnerProductSpaceable E :=
⟨parallelogram_law_with_norm 𝕜⟩
#align inner_product_space.to_inner_product_spaceable InnerProductSpace.toInnerProductSpaceable
-- See note [lower instance priority]
instance (priority := 100) InnerProductSpace.toInnerProductSpaceable_ofReal
[InnerProductSpace ℝ E] : InnerProductSpaceable E :=
⟨parallelogram_law_with_norm ℝ⟩
#align inner_product_space.to_inner_product_spaceable_of_real InnerProductSpace.toInnerProductSpaceable_ofReal
variable [NormedSpace 𝕜 E]
local notation "𝓚" => algebraMap ℝ 𝕜
private noncomputable def inner_ (x y : E) : 𝕜 :=
4⁻¹ * (𝓚 ‖x + y‖ * 𝓚 ‖x + y‖ - 𝓚 ‖x - y‖ * 𝓚 ‖x - y‖ +
(I : 𝕜) * 𝓚 ‖(I : 𝕜) • x + y‖ * 𝓚 ‖(I : 𝕜) • x + y‖ -
(I : 𝕜) * 𝓚 ‖(I : 𝕜) • x - y‖ * 𝓚 ‖(I : 𝕜) • x - y‖)
namespace InnerProductSpaceable
variable {𝕜} (E)
-- Porting note: prime added to avoid clashing with public `innerProp`
private def innerProp' (r : 𝕜) : Prop :=
∀ x y : E, inner_ 𝕜 (r • x) y = conj r * inner_ 𝕜 x y
variable {E}
theorem innerProp_neg_one : innerProp' E ((-1 : ℤ) : 𝕜) := by
intro x y
simp only [inner_, neg_mul_eq_neg_mul, one_mul, Int.cast_one, one_smul, RingHom.map_one, map_neg,
Int.cast_neg, neg_smul, neg_one_mul]
rw [neg_mul_comm]
congr 1
have h₁ : ‖-x - y‖ = ‖x + y‖ := by rw [← neg_add', norm_neg]
have h₂ : ‖-x + y‖ = ‖x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add]
have h₃ : ‖(I : 𝕜) • -x + y‖ = ‖(I : 𝕜) • x - y‖ := by
rw [← neg_sub, norm_neg, sub_eq_neg_add, ← smul_neg]
have h₄ : ‖(I : 𝕜) • -x - y‖ = ‖(I : 𝕜) • x + y‖ := by rw [smul_neg, ← neg_add', norm_neg]
rw [h₁, h₂, h₃, h₄]
ring
#align inner_product_spaceable.inner_prop_neg_one InnerProductSpaceable.innerProp_neg_one
theorem _root_.Continuous.inner_ {f g : ℝ → E} (hf : Continuous f) (hg : Continuous g) :
Continuous fun x => inner_ 𝕜 (f x) (g x) := by
unfold inner_
have := Continuous.const_smul (M := 𝕜) hf I
continuity
#align inner_product_spaceable.continuous.inner_ Continuous.inner_
| Mathlib/Analysis/InnerProductSpace/OfNorm.lean | 127 | 136 | theorem inner_.norm_sq (x : E) : ‖x‖ ^ 2 = re (inner_ 𝕜 x x) := by |
simp only [inner_]
have h₁ : RCLike.normSq (4 : 𝕜) = 16 := by
have : ((4 : ℝ) : 𝕜) = (4 : 𝕜) := by norm_cast
rw [← this, normSq_eq_def', RCLike.norm_of_nonneg (by norm_num : (0 : ℝ) ≤ 4)]
norm_num
have h₂ : ‖x + x‖ = 2 * ‖x‖ := by rw [← two_smul 𝕜, norm_smul, RCLike.norm_two]
simp only [h₁, h₂, algebraMap_eq_ofReal, sub_self, norm_zero, mul_re, inv_re, ofNat_re, map_sub,
map_add, ofReal_re, ofNat_im, ofReal_im, mul_im, I_re, inv_im]
ring
| 9 | 8,103.083928 | 2 | 1.75 | 4 | 1,861 |
import Mathlib.Algebra.MvPolynomial.Basic
import Mathlib.RingTheory.Polynomial.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import ring_theory.adjoin.fg from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
universe u v w
open Subsemiring Ring Submodule
open Pointwise
namespace Subalgebra
variable {R : Type u} {A : Type v} {B : Type w}
variable [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
def FG (S : Subalgebra R A) : Prop :=
∃ t : Finset A, Algebra.adjoin R ↑t = S
#align subalgebra.fg Subalgebra.FG
theorem fg_adjoin_finset (s : Finset A) : (Algebra.adjoin R (↑s : Set A)).FG :=
⟨s, rfl⟩
#align subalgebra.fg_adjoin_finset Subalgebra.fg_adjoin_finset
theorem fg_def {S : Subalgebra R A} : S.FG ↔ ∃ t : Set A, Set.Finite t ∧ Algebra.adjoin R t = S :=
Iff.symm Set.exists_finite_iff_finset
#align subalgebra.fg_def Subalgebra.fg_def
theorem fg_bot : (⊥ : Subalgebra R A).FG :=
⟨∅, Finset.coe_empty ▸ Algebra.adjoin_empty R A⟩
#align subalgebra.fg_bot Subalgebra.fg_bot
theorem fg_of_fg_toSubmodule {S : Subalgebra R A} : S.toSubmodule.FG → S.FG :=
fun ⟨t, ht⟩ ↦ ⟨t, le_antisymm
(Algebra.adjoin_le fun x hx ↦ show x ∈ Subalgebra.toSubmodule S from ht ▸ subset_span hx) <|
show Subalgebra.toSubmodule S ≤ Subalgebra.toSubmodule (Algebra.adjoin R ↑t) from fun x hx ↦
span_le.mpr (fun x hx ↦ Algebra.subset_adjoin hx)
(show x ∈ span R ↑t by
rw [ht]
exact hx)⟩
#align subalgebra.fg_of_fg_to_submodule Subalgebra.fg_of_fg_toSubmodule
theorem fg_of_noetherian [IsNoetherian R A] (S : Subalgebra R A) : S.FG :=
fg_of_fg_toSubmodule (IsNoetherian.noetherian (Subalgebra.toSubmodule S))
#align subalgebra.fg_of_noetherian Subalgebra.fg_of_noetherian
theorem fg_of_submodule_fg (h : (⊤ : Submodule R A).FG) : (⊤ : Subalgebra R A).FG :=
let ⟨s, hs⟩ := h
⟨s, toSubmodule.injective <| by
rw [Algebra.top_toSubmodule, eq_top_iff, ← hs, span_le]
exact Algebra.subset_adjoin⟩
#align subalgebra.fg_of_submodule_fg Subalgebra.fg_of_submodule_fg
theorem FG.prod {S : Subalgebra R A} {T : Subalgebra R B} (hS : S.FG) (hT : T.FG) :
(S.prod T).FG := by
obtain ⟨s, hs⟩ := fg_def.1 hS
obtain ⟨t, ht⟩ := fg_def.1 hT
rw [← hs.2, ← ht.2]
exact fg_def.2 ⟨LinearMap.inl R A B '' (s ∪ {1}) ∪ LinearMap.inr R A B '' (t ∪ {1}),
Set.Finite.union (Set.Finite.image _ (Set.Finite.union hs.1 (Set.finite_singleton _)))
(Set.Finite.image _ (Set.Finite.union ht.1 (Set.finite_singleton _))),
Algebra.adjoin_inl_union_inr_eq_prod R s t⟩
#align subalgebra.fg.prod Subalgebra.FG.prod
section
open scoped Classical
theorem FG.map {S : Subalgebra R A} (f : A →ₐ[R] B) (hs : S.FG) : (S.map f).FG :=
let ⟨s, hs⟩ := hs
⟨s.image f, by rw [Finset.coe_image, Algebra.adjoin_image, hs]⟩
#align subalgebra.fg.map Subalgebra.FG.map
end
theorem fg_of_fg_map (S : Subalgebra R A) (f : A →ₐ[R] B) (hf : Function.Injective f)
(hs : (S.map f).FG) : S.FG :=
let ⟨s, hs⟩ := hs
⟨s.preimage f fun _ _ _ _ h ↦ hf h,
map_injective hf <| by
rw [← Algebra.adjoin_image, Finset.coe_preimage, Set.image_preimage_eq_of_subset, hs]
rw [← AlgHom.coe_range, ← Algebra.adjoin_le_iff, hs, ← Algebra.map_top]
exact map_mono le_top⟩
#align subalgebra.fg_of_fg_map Subalgebra.fg_of_fg_map
theorem fg_top (S : Subalgebra R A) : (⊤ : Subalgebra R S).FG ↔ S.FG :=
⟨fun h ↦ by
rw [← S.range_val, ← Algebra.map_top]
exact FG.map _ h, fun h ↦
fg_of_fg_map _ S.val Subtype.val_injective <| by
rw [Algebra.map_top, range_val]
exact h⟩
#align subalgebra.fg_top Subalgebra.fg_top
| Mathlib/RingTheory/Adjoin/FG.lean | 170 | 179 | theorem induction_on_adjoin [IsNoetherian R A] (P : Subalgebra R A → Prop) (base : P ⊥)
(ih : ∀ (S : Subalgebra R A) (x : A), P S → P (Algebra.adjoin R (insert x S)))
(S : Subalgebra R A) : P S := by |
classical
obtain ⟨t, rfl⟩ := S.fg_of_noetherian
refine Finset.induction_on t ?_ ?_
· simpa using base
intro x t _ h
rw [Finset.coe_insert]
simpa only [Algebra.adjoin_insert_adjoin] using ih _ x h
| 7 | 1,096.633158 | 2 | 2 | 3 | 2,099 |
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Nat.Factors
import Mathlib.Order.Interval.Finset.Nat
#align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped Classical
open Finset
namespace Nat
variable (n : ℕ)
def divisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 (n + 1))
#align nat.divisors Nat.divisors
def properDivisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 n)
#align nat.proper_divisors Nat.properDivisors
def divisorsAntidiagonal : Finset (ℕ × ℕ) :=
Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ×ˢ Ico 1 (n + 1))
#align nat.divisors_antidiagonal Nat.divisorsAntidiagonal
variable {n}
@[simp]
theorem filter_dvd_eq_divisors (h : n ≠ 0) : (Finset.range n.succ).filter (· ∣ n) = n.divisors := by
ext
simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors
@[simp]
theorem filter_dvd_eq_properDivisors (h : n ≠ 0) :
(Finset.range n).filter (· ∣ n) = n.properDivisors := by
ext
simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors
theorem properDivisors.not_self_mem : ¬n ∈ properDivisors n := by simp [properDivisors]
#align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem
@[simp]
theorem mem_properDivisors {m : ℕ} : n ∈ properDivisors m ↔ n ∣ m ∧ n < m := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [properDivisors]
simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range]
#align nat.mem_proper_divisors Nat.mem_properDivisors
theorem insert_self_properDivisors (h : n ≠ 0) : insert n (properDivisors n) = divisors n := by
rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h),
Finset.filter_insert, if_pos (dvd_refl n)]
#align nat.insert_self_proper_divisors Nat.insert_self_properDivisors
theorem cons_self_properDivisors (h : n ≠ 0) :
cons n (properDivisors n) properDivisors.not_self_mem = divisors n := by
rw [cons_eq_insert, insert_self_properDivisors h]
#align nat.cons_self_proper_divisors Nat.cons_self_properDivisors
@[simp]
theorem mem_divisors {m : ℕ} : n ∈ divisors m ↔ n ∣ m ∧ m ≠ 0 := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [divisors]
simp only [hm, Ne, not_false_iff, and_true_iff, ← filter_dvd_eq_divisors hm, mem_filter,
mem_range, and_iff_right_iff_imp, Nat.lt_succ_iff]
exact le_of_dvd hm.bot_lt
#align nat.mem_divisors Nat.mem_divisors
theorem one_mem_divisors : 1 ∈ divisors n ↔ n ≠ 0 := by simp
#align nat.one_mem_divisors Nat.one_mem_divisors
theorem mem_divisors_self (n : ℕ) (h : n ≠ 0) : n ∈ n.divisors :=
mem_divisors.2 ⟨dvd_rfl, h⟩
#align nat.mem_divisors_self Nat.mem_divisors_self
theorem dvd_of_mem_divisors {m : ℕ} (h : n ∈ divisors m) : n ∣ m := by
cases m
· apply dvd_zero
· simp [mem_divisors.1 h]
#align nat.dvd_of_mem_divisors Nat.dvd_of_mem_divisors
@[simp]
theorem mem_divisorsAntidiagonal {x : ℕ × ℕ} :
x ∈ divisorsAntidiagonal n ↔ x.fst * x.snd = n ∧ n ≠ 0 := by
simp only [divisorsAntidiagonal, Finset.mem_Ico, Ne, Finset.mem_filter, Finset.mem_product]
rw [and_comm]
apply and_congr_right
rintro rfl
constructor <;> intro h
· contrapose! h
simp [h]
· rw [Nat.lt_add_one_iff, Nat.lt_add_one_iff]
rw [mul_eq_zero, not_or] at h
simp only [succ_le_of_lt (Nat.pos_of_ne_zero h.1), succ_le_of_lt (Nat.pos_of_ne_zero h.2),
true_and_iff]
exact
⟨Nat.le_mul_of_pos_right _ (Nat.pos_of_ne_zero h.2),
Nat.le_mul_of_pos_left _ (Nat.pos_of_ne_zero h.1)⟩
#align nat.mem_divisors_antidiagonal Nat.mem_divisorsAntidiagonal
lemma ne_zero_of_mem_divisorsAntidiagonal {p : ℕ × ℕ} (hp : p ∈ n.divisorsAntidiagonal) :
p.1 ≠ 0 ∧ p.2 ≠ 0 := by
obtain ⟨hp₁, hp₂⟩ := Nat.mem_divisorsAntidiagonal.mp hp
exact mul_ne_zero_iff.mp (hp₁.symm ▸ hp₂)
lemma left_ne_zero_of_mem_divisorsAntidiagonal {p : ℕ × ℕ} (hp : p ∈ n.divisorsAntidiagonal) :
p.1 ≠ 0 :=
(ne_zero_of_mem_divisorsAntidiagonal hp).1
lemma right_ne_zero_of_mem_divisorsAntidiagonal {p : ℕ × ℕ} (hp : p ∈ n.divisorsAntidiagonal) :
p.2 ≠ 0 :=
(ne_zero_of_mem_divisorsAntidiagonal hp).2
| Mathlib/NumberTheory/Divisors.lean | 147 | 151 | theorem divisor_le {m : ℕ} : n ∈ divisors m → n ≤ m := by |
cases' m with m
· simp
· simp only [mem_divisors, Nat.succ_ne_zero m, and_true_iff, Ne, not_false_iff]
exact Nat.le_of_dvd (Nat.succ_pos m)
| 4 | 54.59815 | 2 | 1 | 11 | 1,070 |
import Mathlib.GroupTheory.Perm.Cycle.Basic
#align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open Equiv Function Finset
variable {ι α β : Type*}
namespace Equiv.Perm
section Generation
variable [Finite β]
open Subgroup
theorem closure_isCycle : closure { σ : Perm β | IsCycle σ } = ⊤ := by
classical
cases nonempty_fintype β
exact
top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle))
#align equiv.perm.closure_is_cycle Equiv.Perm.closure_isCycle
variable [DecidableEq α] [Fintype α]
theorem closure_cycle_adjacent_swap {σ : Perm α} (h1 : IsCycle σ) (h2 : σ.support = ⊤) (x : α) :
closure ({σ, swap x (σ x)} : Set (Perm α)) = ⊤ := by
let H := closure ({σ, swap x (σ x)} : Set (Perm α))
have h3 : σ ∈ H := subset_closure (Set.mem_insert σ _)
have h4 : swap x (σ x) ∈ H := subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _))
have step1 : ∀ n : ℕ, swap ((σ ^ n) x) ((σ ^ (n + 1) : Perm α) x) ∈ H := by
intro n
induction' n with n ih
· exact subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _))
· convert H.mul_mem (H.mul_mem h3 ih) (H.inv_mem h3)
simp_rw [mul_swap_eq_swap_mul, mul_inv_cancel_right, pow_succ']
rfl
have step2 : ∀ n : ℕ, swap x ((σ ^ n) x) ∈ H := by
intro n
induction' n with n ih
· simp only [Nat.zero_eq, pow_zero, coe_one, id_eq, swap_self, Set.mem_singleton_iff]
convert H.one_mem
· by_cases h5 : x = (σ ^ n) x
· rw [pow_succ', mul_apply, ← h5]
exact h4
by_cases h6 : x = (σ ^ (n + 1) : Perm α) x
· rw [← h6, swap_self]
exact H.one_mem
rw [swap_comm, ← swap_mul_swap_mul_swap h5 h6]
exact H.mul_mem (H.mul_mem (step1 n) ih) (step1 n)
have step3 : ∀ y : α, swap x y ∈ H := by
intro y
have hx : x ∈ (⊤ : Finset α) := Finset.mem_univ x
rw [← h2, mem_support] at hx
have hy : y ∈ (⊤ : Finset α) := Finset.mem_univ y
rw [← h2, mem_support] at hy
cases' IsCycle.exists_pow_eq h1 hx hy with n hn
rw [← hn]
exact step2 n
have step4 : ∀ y z : α, swap y z ∈ H := by
intro y z
by_cases h5 : z = x
· rw [h5, swap_comm]
exact step3 y
by_cases h6 : z = y
· rw [h6, swap_self]
exact H.one_mem
rw [← swap_mul_swap_mul_swap h5 h6, swap_comm z x]
exact H.mul_mem (H.mul_mem (step3 y) (step3 z)) (step3 y)
rw [eq_top_iff, ← closure_isSwap, closure_le]
rintro τ ⟨y, z, _, h6⟩
rw [h6]
exact step4 y z
#align equiv.perm.closure_cycle_adjacent_swap Equiv.Perm.closure_cycle_adjacent_swap
theorem closure_cycle_coprime_swap {n : ℕ} {σ : Perm α} (h0 : Nat.Coprime n (Fintype.card α))
(h1 : IsCycle σ) (h2 : σ.support = Finset.univ) (x : α) :
closure ({σ, swap x ((σ ^ n) x)} : Set (Perm α)) = ⊤ := by
rw [← Finset.card_univ, ← h2, ← h1.orderOf] at h0
cases' exists_pow_eq_self_of_coprime h0 with m hm
have h2' : (σ ^ n).support = ⊤ := Eq.trans (support_pow_coprime h0) h2
have h1' : IsCycle ((σ ^ n) ^ (m : ℤ)) := by rwa [← hm] at h1
replace h1' : IsCycle (σ ^ n) :=
h1'.of_pow (le_trans (support_pow_le σ n) (ge_of_eq (congr_arg support hm)))
rw [eq_top_iff, ← closure_cycle_adjacent_swap h1' h2' x, closure_le, Set.insert_subset_iff]
exact
⟨Subgroup.pow_mem (closure _) (subset_closure (Set.mem_insert σ _)) n,
Set.singleton_subset_iff.mpr (subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)))⟩
#align equiv.perm.closure_cycle_coprime_swap Equiv.Perm.closure_cycle_coprime_swap
| Mathlib/GroupTheory/Perm/Closure.lean | 111 | 122 | theorem closure_prime_cycle_swap {σ τ : Perm α} (h0 : (Fintype.card α).Prime) (h1 : IsCycle σ)
(h2 : σ.support = Finset.univ) (h3 : IsSwap τ) : closure ({σ, τ} : Set (Perm α)) = ⊤ := by |
obtain ⟨x, y, h4, h5⟩ := h3
obtain ⟨i, hi⟩ :=
h1.exists_pow_eq (mem_support.mp ((Finset.ext_iff.mp h2 x).mpr (Finset.mem_univ x)))
(mem_support.mp ((Finset.ext_iff.mp h2 y).mpr (Finset.mem_univ y)))
rw [h5, ← hi]
refine closure_cycle_coprime_swap
(Nat.Coprime.symm (h0.coprime_iff_not_dvd.mpr fun h => h4 ?_)) h1 h2 x
cases' h with m hm
rwa [hm, pow_mul, ← Finset.card_univ, ← h2, ← h1.orderOf, pow_orderOf_eq_one, one_pow,
one_apply] at hi
| 10 | 22,026.465795 | 2 | 2 | 4 | 2,314 |
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition
import Mathlib.LinearAlgebra.FreeModule.Basic
#align_import linear_algebra.free_module.pid from "leanprover-community/mathlib"@"d87199d51218d36a0a42c66c82d147b5a7ff87b3"
universe u v
section IsDomain
variable {ι : Type*} {R : Type*} [CommRing R] [IsDomain R]
variable {M : Type*} [AddCommGroup M] [Module R M] {b : ι → M}
open Submodule.IsPrincipal Set Submodule
| Mathlib/LinearAlgebra/FreeModule/PID.lean | 93 | 98 | theorem dvd_generator_iff {I : Ideal R} [I.IsPrincipal] {x : R} (hx : x ∈ I) :
x ∣ generator I ↔ I = Ideal.span {x} := by |
conv_rhs => rw [← span_singleton_generator I]
rw [Ideal.submodule_span_eq, Ideal.span_singleton_eq_span_singleton, ← dvd_dvd_iff_associated,
← mem_iff_generator_dvd]
exact ⟨fun h ↦ ⟨hx, h⟩, fun h ↦ h.2⟩
| 4 | 54.59815 | 2 | 2 | 3 | 2,115 |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic
import Mathlib.NumberTheory.GaussSum
#align_import number_theory.legendre_symbol.quadratic_char.gauss_sum from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
section SpecialValues
open ZMod MulChar
variable {F : Type*} [Field F] [Fintype F]
theorem quadraticChar_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F 2 = χ₈ (Fintype.card F) :=
IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F) isQuadratic_χ₈ hF
((quadraticChar_eq_pow_of_char_ne_two' hF 2).trans (FiniteField.two_pow_card hF))
#align quadratic_char_two quadraticChar_two
theorem FiniteField.isSquare_two_iff :
IsSquare (2 : F) ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5 := by
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (Ring.two_ne_zero hF), quadraticChar_two hF,
χ₈_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
#align finite_field.is_square_two_iff FiniteField.isSquare_two_iff
theorem quadraticChar_neg_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F (-2) = χ₈' (Fintype.card F) := by
rw [(by norm_num : (-2 : F) = -1 * 2), map_mul, χ₈'_eq_χ₄_mul_χ₈, quadraticChar_neg_one hF,
quadraticChar_two hF, @cast_natCast _ (ZMod 4) _ _ _ (by decide : 4 ∣ 8)]
#align quadratic_char_neg_two quadraticChar_neg_two
theorem FiniteField.isSquare_neg_two_iff :
IsSquare (-2 : F) ↔ Fintype.card F % 8 ≠ 5 ∧ Fintype.card F % 8 ≠ 7 := by
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (neg_ne_zero.mpr (Ring.two_ne_zero hF)),
quadraticChar_neg_two hF, χ₈'_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
#align finite_field.is_square_neg_two_iff FiniteField.isSquare_neg_two_iff
theorem quadraticChar_card_card [DecidableEq F] (hF : ringChar F ≠ 2) {F' : Type*} [Field F']
[Fintype F'] [DecidableEq F'] (hF' : ringChar F' ≠ 2) (h : ringChar F' ≠ ringChar F) :
quadraticChar F (Fintype.card F') =
quadraticChar F' (quadraticChar F (-1) * Fintype.card F) := by
let χ := (quadraticChar F).ringHomComp (algebraMap ℤ F')
have hχ₁ : χ.IsNontrivial := by
obtain ⟨a, ha⟩ := quadraticChar_exists_neg_one hF
have hu : IsUnit a := by
contrapose ha
exact ne_of_eq_of_ne (map_nonunit (quadraticChar F) ha) (mt zero_eq_neg.mp one_ne_zero)
use hu.unit
simp only [χ, IsUnit.unit_spec, ringHomComp_apply, eq_intCast, Ne, ha]
rw [Int.cast_neg, Int.cast_one]
exact Ring.neg_one_ne_one_of_char_ne_two hF'
have hχ₂ : χ.IsQuadratic := IsQuadratic.comp (quadraticChar_isQuadratic F) _
have h := Char.card_pow_card hχ₁ hχ₂ h hF'
rw [← quadraticChar_eq_pow_of_char_ne_two' hF'] at h
exact (IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F')
(quadraticChar_isQuadratic F) hF' h).symm
#align quadratic_char_card_card quadraticChar_card_card
theorem quadraticChar_odd_prime [DecidableEq F] (hF : ringChar F ≠ 2) {p : ℕ} [Fact p.Prime]
(hp₁ : p ≠ 2) (hp₂ : ringChar F ≠ p) :
quadraticChar F p = quadraticChar (ZMod p) (χ₄ (Fintype.card F) * Fintype.card F) := by
rw [← quadraticChar_neg_one hF]
have h := quadraticChar_card_card hF (ne_of_eq_of_ne (ringChar_zmod_n p) hp₁)
(ne_of_eq_of_ne (ringChar_zmod_n p) hp₂.symm)
rwa [card p] at h
#align quadratic_char_odd_prime quadraticChar_odd_prime
| Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/GaussSum.lean | 130 | 143 | theorem FiniteField.isSquare_odd_prime_iff (hF : ringChar F ≠ 2) {p : ℕ} [Fact p.Prime]
(hp : p ≠ 2) :
IsSquare (p : F) ↔ quadraticChar (ZMod p) (χ₄ (Fintype.card F) * Fintype.card F) ≠ -1 := by |
classical
by_cases hFp : ringChar F = p
· rw [show (p : F) = 0 by rw [← hFp]; exact ringChar.Nat.cast_ringChar]
simp only [isSquare_zero, Ne, true_iff_iff, map_mul]
obtain ⟨n, _, hc⟩ := FiniteField.card F (ringChar F)
have hchar : ringChar F = ringChar (ZMod p) := by rw [hFp]; exact (ringChar_zmod_n p).symm
conv => enter [1, 1, 2]; rw [hc, Nat.cast_pow, map_pow, hchar, map_ringChar]
simp only [zero_pow n.ne_zero, mul_zero, zero_eq_neg, one_ne_zero, not_false_iff]
· rw [← Iff.not_left (@quadraticChar_neg_one_iff_not_isSquare F _ _ _ _),
quadraticChar_odd_prime hF hp]
exact hFp
| 11 | 59,874.141715 | 2 | 1.833333 | 6 | 1,917 |
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Topology.Algebra.Module.Multilinear.Basic
open Bornology Filter Set Function
open scoped Topology
namespace Bornology.IsVonNBounded
variable {ι 𝕜 F : Type*} {E : ι → Type*} [NormedField 𝕜]
[∀ i, AddCommGroup (E i)] [∀ i, Module 𝕜 (E i)] [∀ i, TopologicalSpace (E i)]
[AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F]
| Mathlib/Topology/Algebra/Module/Multilinear/Bounded.lean | 44 | 83 | theorem image_multilinear' [Nonempty ι] {s : Set (∀ i, E i)} (hs : IsVonNBounded 𝕜 s)
(f : ContinuousMultilinearMap 𝕜 E F) : IsVonNBounded 𝕜 (f '' s) := fun V hV ↦ by
classical
if h₁ : ∀ c : 𝕜, ‖c‖ ≤ 1 then
exact absorbs_iff_norm.2 ⟨2, fun c hc ↦ by linarith [h₁ c]⟩
else
let _ : NontriviallyNormedField 𝕜 := ⟨by simpa using h₁⟩
obtain ⟨I, t, ht₀, hft⟩ :
∃ (I : Finset ι) (t : ∀ i, Set (E i)), (∀ i, t i ∈ 𝓝 0) ∧ Set.pi I t ⊆ f ⁻¹' V := by |
have hfV : f ⁻¹' V ∈ 𝓝 0 := (map_continuous f).tendsto' _ _ f.map_zero hV
rwa [nhds_pi, Filter.mem_pi, exists_finite_iff_finset] at hfV
have : ∀ i, ∃ c : 𝕜, c ≠ 0 ∧ ∀ c' : 𝕜, ‖c'‖ ≤ ‖c‖ → ∀ x ∈ s, c' • x i ∈ t i := fun i ↦ by
rw [isVonNBounded_pi_iff] at hs
have := (hs i).tendsto_smallSets_nhds.eventually (mem_lift' (ht₀ i))
rcases NormedAddCommGroup.nhds_zero_basis_norm_lt.eventually_iff.1 this with ⟨r, hr₀, hr⟩
rcases NormedField.exists_norm_lt 𝕜 hr₀ with ⟨c, hc₀, hc⟩
refine ⟨c, norm_pos_iff.1 hc₀, fun c' hle x hx ↦ ?_⟩
exact hr (hle.trans_lt hc) ⟨_, ⟨x, hx, rfl⟩, rfl⟩
choose c hc₀ hc using this
rw [absorbs_iff_eventually_nhds_zero (mem_of_mem_nhds hV),
NormedAddCommGroup.nhds_zero_basis_norm_lt.eventually_iff]
have hc₀' : ∏ i ∈ I, c i ≠ 0 := Finset.prod_ne_zero_iff.2 fun i _ ↦ hc₀ i
refine ⟨‖∏ i ∈ I, c i‖, norm_pos_iff.2 hc₀', fun a ha ↦ mapsTo_image_iff.2 fun x hx ↦ ?_⟩
let ⟨i₀⟩ := ‹Nonempty ι›
set y := I.piecewise (fun i ↦ c i • x i) x
calc
a • f x = f (update y i₀ ((a / ∏ i ∈ I, c i) • y i₀)) := by
rw [f.map_smul, update_eq_self, f.map_piecewise_smul, div_eq_mul_inv, mul_smul,
inv_smul_smul₀ hc₀']
_ ∈ V := hft fun i hi ↦ by
rcases eq_or_ne i i₀ with rfl | hne
· simp_rw [update_same, y, I.piecewise_eq_of_mem _ _ hi, smul_smul]
refine hc _ _ ?_ _ hx
calc
‖(a / ∏ i ∈ I, c i) * c i‖ ≤ (‖∏ i ∈ I, c i‖ / ‖∏ i ∈ I, c i‖) * ‖c i‖ := by
rw [norm_mul, norm_div]; gcongr; exact ha.out.le
_ ≤ 1 * ‖c i‖ := by gcongr; apply div_self_le_one
_ = ‖c i‖ := one_mul _
· simp_rw [update_noteq hne, y, I.piecewise_eq_of_mem _ _ hi]
exact hc _ _ le_rfl _ hx
| 31 | 29,048,849,665,247.426 | 2 | 2 | 2 | 2,153 |
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.Monotone.Basic
#align_import order.iterate from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f"
open Function
open Function (Commute)
namespace Monotone
variable {α : Type*} [Preorder α] {f : α → α} {x y : ℕ → α}
theorem seq_le_seq (hf : Monotone f) (n : ℕ) (h₀ : x 0 ≤ y 0) (hx : ∀ k < n, x (k + 1) ≤ f (x k))
(hy : ∀ k < n, f (y k) ≤ y (k + 1)) : x n ≤ y n := by
induction' n with n ihn
· exact h₀
· refine (hx _ n.lt_succ_self).trans ((hf <| ihn ?_ ?_).trans (hy _ n.lt_succ_self))
· exact fun k hk => hx _ (hk.trans n.lt_succ_self)
· exact fun k hk => hy _ (hk.trans n.lt_succ_self)
#align monotone.seq_le_seq Monotone.seq_le_seq
| Mathlib/Order/Iterate.lean | 51 | 60 | theorem seq_pos_lt_seq_of_lt_of_le (hf : Monotone f) {n : ℕ} (hn : 0 < n) (h₀ : x 0 ≤ y 0)
(hx : ∀ k < n, x (k + 1) < f (x k)) (hy : ∀ k < n, f (y k) ≤ y (k + 1)) : x n < y n := by |
induction' n with n ihn
· exact hn.false.elim
suffices x n ≤ y n from (hx n n.lt_succ_self).trans_le ((hf this).trans <| hy n n.lt_succ_self)
cases n with
| zero => exact h₀
| succ n =>
refine (ihn n.zero_lt_succ (fun k hk => hx _ ?_) fun k hk => hy _ ?_).le <;>
exact hk.trans n.succ.lt_succ_self
| 8 | 2,980.957987 | 2 | 1.666667 | 3 | 1,800 |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Expand
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.ZMod.Basic
#align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
open MvPolynomial
open Finset hiding map
open Finsupp (single)
--attribute [-simp] coe_eval₂_hom
variable (p : ℕ)
variable (R : Type*) [CommRing R] [DecidableEq R]
noncomputable def wittPolynomial (n : ℕ) : MvPolynomial ℕ R :=
∑ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i)
#align witt_polynomial wittPolynomial
theorem wittPolynomial_eq_sum_C_mul_X_pow (n : ℕ) :
wittPolynomial p R n = ∑ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by
apply sum_congr rfl
rintro i -
rw [monomial_eq, Finsupp.prod_single_index]
rw [pow_zero]
set_option linter.uppercaseLean3 false in
#align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow
-- Notation with ring of coefficients explicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W_" => wittPolynomial p
-- Notation with ring of coefficients implicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W" => wittPolynomial p _
open Witt
open MvPolynomial
section
variable {R} {S : Type*} [CommRing S]
@[simp]
theorem map_wittPolynomial (f : R →+* S) (n : ℕ) : map f (W n) = W n := by
rw [wittPolynomial, map_sum, wittPolynomial]
refine sum_congr rfl fun i _ => ?_
rw [map_monomial, RingHom.map_pow, map_natCast]
#align map_witt_polynomial map_wittPolynomial
variable (R)
@[simp]
theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : ℕ) :
constantCoeff (wittPolynomial p R n) = 0 := by
simp only [wittPolynomial, map_sum, constantCoeff_monomial]
rw [sum_eq_zero]
rintro i _
rw [if_neg]
rw [Finsupp.single_eq_zero]
exact ne_of_gt (pow_pos hp.1.pos _)
#align constant_coeff_witt_polynomial constantCoeff_wittPolynomial
@[simp]
theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by
simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self]
#align witt_polynomial_zero wittPolynomial_zero
@[simp]
theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton,
one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero]
#align witt_polynomial_one wittPolynomial_one
theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : ℕ → A) (n : ℕ) :
aeval f (W_ R n) = ∑ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by
simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index]
#align aeval_witt_polynomial aeval_wittPolynomial
@[simp]
theorem wittPolynomial_zmod_self (n : ℕ) :
W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow]
rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0,
zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl]
intro k hk
rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ']
congr
rw [mem_range] at hk
rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm]
#align witt_polynomial_zmod_self wittPolynomial_zmod_self
section PPrime
variable [hp : NeZero p]
| Mathlib/RingTheory/WittVector/WittPolynomial.lean | 170 | 181 | theorem wittPolynomial_vars [CharZero R] (n : ℕ) : (wittPolynomial p R n).vars = range (n + 1) := by |
have : ∀ i, (monomial (Finsupp.single i (p ^ (n - i))) ((p : R) ^ i)).vars = {i} := by
intro i
refine vars_monomial_single i (pow_ne_zero _ hp.1) ?_
rw [← Nat.cast_pow, Nat.cast_ne_zero]
exact pow_ne_zero i hp.1
rw [wittPolynomial, vars_sum_of_disjoint]
· simp only [this, biUnion_singleton_eq_self]
· simp only [this]
intro a b h
apply disjoint_singleton_left.mpr
rwa [mem_singleton]
| 11 | 59,874.141715 | 2 | 1.181818 | 11 | 1,247 |
import Mathlib.Algebra.MvPolynomial.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.RingTheory.Algebraic
#align_import field_theory.ax_grothendieck from "leanprover-community/mathlib"@"4e529b03dd62b7b7d13806c3fb974d9d4848910e"
noncomputable section
open MvPolynomial Finset Function
| Mathlib/FieldTheory/AxGrothendieck.lean | 33 | 66 | theorem ax_grothendieck_of_locally_finite {ι K R : Type*} [Field K] [Finite K] [CommRing R]
[Finite ι] [Algebra K R] [Algebra.IsAlgebraic K R] (ps : ι → MvPolynomial ι R)
(hinj : Injective fun v i => MvPolynomial.eval v (ps i)) :
Surjective fun v i => MvPolynomial.eval v (ps i) := by |
classical
intro v
cases nonempty_fintype ι
/- `s` is the set of all coefficients of the polynomial, as well as all of
the coordinates of `v`, the point I am trying to find the preimage of. -/
let s : Finset R :=
(Finset.biUnion (univ : Finset ι) fun i => (ps i).support.image fun x => coeff x (ps i)) ∪
(univ : Finset ι).image v
have hv : ∀ i, v i ∈ Algebra.adjoin K (s : Set R) := fun j =>
Algebra.subset_adjoin (mem_union_right _ (mem_image.2 ⟨j, mem_univ _, rfl⟩))
have hs₁ : ∀ (i : ι) (k : ι →₀ ℕ),
k ∈ (ps i).support → coeff k (ps i) ∈ Algebra.adjoin K (s : Set R) :=
fun i k hk => Algebra.subset_adjoin
(mem_union_left _ (mem_biUnion.2 ⟨i, mem_univ _, mem_image_of_mem _ hk⟩))
letI := isNoetherian_adjoin_finset s fun x _ => Algebra.IsIntegral.isIntegral (R := K) x
letI := Module.IsNoetherian.finite K (Algebra.adjoin K (s : Set R))
letI : Finite (Algebra.adjoin K (s : Set R)) :=
FiniteDimensional.finite_of_finite K (Algebra.adjoin K (s : Set R))
-- The restriction of the polynomial map, `ps`, to the subalgebra generated by `s`
let res : (ι → Algebra.adjoin K (s : Set R)) → ι → Algebra.adjoin K (s : Set R) := fun x i =>
⟨eval (fun j : ι => (x j : R)) (ps i), eval_mem (hs₁ _) fun i => (x i).2⟩
have hres_inj : Injective res := by
intro x y hxy
ext i
simp only [Subtype.ext_iff, funext_iff] at hxy
exact congr_fun (hinj (funext hxy)) i
have hres_surj : Surjective res := Finite.injective_iff_surjective.1 hres_inj
cases' hres_surj fun i => ⟨v i, hv i⟩ with w hw
use fun i => w i
simpa only [Subtype.ext_iff, funext_iff] using hw
| 30 | 10,686,474,581,524.463 | 2 | 2 | 1 | 2,155 |
import Mathlib.Analysis.Fourier.Inversion
open Real Complex Set MeasureTheory
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E]
open scoped FourierTransform
private theorem rexp_neg_deriv_aux :
∀ x ∈ univ, HasDerivWithinAt (rexp ∘ Neg.neg) (-rexp (-x)) univ x :=
fun x _ ↦ mul_neg_one (rexp (-x)) ▸
((Real.hasDerivAt_exp (-x)).comp x (hasDerivAt_neg x)).hasDerivWithinAt
private theorem rexp_neg_image_aux : rexp ∘ Neg.neg '' univ = Ioi 0 := by
rw [Set.image_comp, Set.image_univ_of_surjective neg_surjective, Set.image_univ, Real.range_exp]
private theorem rexp_neg_injOn_aux : univ.InjOn (rexp ∘ Neg.neg) :=
Real.exp_injective.injOn.comp neg_injective.injOn (univ.mapsTo_univ _)
private theorem rexp_cexp_aux (x : ℝ) (s : ℂ) (f : E) :
rexp (-x) • cexp (-↑x) ^ (s - 1) • f = cexp (-s * ↑x) • f := by
show (rexp (-x) : ℂ) • _ = _ • f
rw [← smul_assoc, smul_eq_mul]
push_cast
conv in cexp _ * _ => lhs; rw [← cpow_one (cexp _)]
rw [← cpow_add _ _ (Complex.exp_ne_zero _), cpow_def_of_ne_zero (Complex.exp_ne_zero _),
Complex.log_exp (by norm_num; exact pi_pos) (by simpa using pi_nonneg)]
ring_nf
theorem mellin_eq_fourierIntegral (f : ℝ → E) {s : ℂ} :
mellin f s = 𝓕 (fun (u : ℝ) ↦ (Real.exp (-s.re * u) • f (Real.exp (-u)))) (s.im / (2 * π)) :=
calc
mellin f s
= ∫ (u : ℝ), Complex.exp (-s * u) • f (Real.exp (-u)) := by
rw [mellin, ← rexp_neg_image_aux, integral_image_eq_integral_abs_deriv_smul
MeasurableSet.univ rexp_neg_deriv_aux rexp_neg_injOn_aux]
simp [rexp_cexp_aux]
_ = ∫ (u : ℝ), Complex.exp (↑(-2 * π * (u * (s.im / (2 * π)))) * I) •
(Real.exp (-s.re * u) • f (Real.exp (-u))) := by
congr
ext u
trans Complex.exp (-s.im * u * I) • (Real.exp (-s.re * u) • f (Real.exp (-u)))
· conv => lhs; rw [← re_add_im s]
rw [neg_add, add_mul, Complex.exp_add, mul_comm, ← smul_eq_mul, smul_assoc]
norm_cast
push_cast
ring_nf
congr
rw [mul_comm (-s.im : ℂ) (u : ℂ), mul_comm (-2 * π)]
have : 2 * (π : ℂ) ≠ 0 := by norm_num; exact pi_ne_zero
field_simp
_ = 𝓕 (fun (u : ℝ) ↦ (Real.exp (-s.re * u) • f (Real.exp (-u)))) (s.im / (2 * π)) := by
simp [fourierIntegral_eq']
theorem mellinInv_eq_fourierIntegralInv (σ : ℝ) (f : ℂ → E) {x : ℝ} (hx : 0 < x) :
mellinInv σ f x =
(x : ℂ) ^ (-σ : ℂ) • 𝓕⁻ (fun (y : ℝ) ↦ f (σ + 2 * π * y * I)) (-Real.log x) := calc
mellinInv σ f x
= (x : ℂ) ^ (-σ : ℂ) •
(∫ (y : ℝ), Complex.exp (2 * π * (y * (-Real.log x)) * I) • f (σ + 2 * π * y * I)) := by
rw [mellinInv, one_div, ← abs_of_pos (show 0 < (2 * π)⁻¹ by norm_num; exact pi_pos)]
have hx0 : (x : ℂ) ≠ 0 := ofReal_ne_zero.mpr (ne_of_gt hx)
simp_rw [neg_add, cpow_add _ _ hx0, mul_smul, integral_smul]
rw [smul_comm, ← Measure.integral_comp_mul_left]
congr! 3
rw [cpow_def_of_ne_zero hx0, ← Complex.ofReal_log hx.le]
push_cast
ring_nf
_ = (x : ℂ) ^ (-σ : ℂ) • 𝓕⁻ (fun (y : ℝ) ↦ f (σ + 2 * π * y * I)) (-Real.log x) := by
simp [fourierIntegralInv_eq']
variable [CompleteSpace E]
| Mathlib/Analysis/MellinInversion.lean | 89 | 121 | theorem mellin_inversion (σ : ℝ) (f : ℝ → E) {x : ℝ} (hx : 0 < x) (hf : MellinConvergent f σ)
(hFf : VerticalIntegrable (mellin f) σ) (hfx : ContinuousAt f x) :
mellinInv σ (mellin f) x = f x := by |
let g := fun (u : ℝ) => Real.exp (-σ * u) • f (Real.exp (-u))
replace hf : Integrable g := by
rw [MellinConvergent, ← rexp_neg_image_aux, integrableOn_image_iff_integrableOn_abs_deriv_smul
MeasurableSet.univ rexp_neg_deriv_aux rexp_neg_injOn_aux] at hf
replace hf : Integrable fun (x : ℝ) ↦ cexp (-↑σ * ↑x) • f (rexp (-x)) := by
simpa [rexp_cexp_aux] using hf
norm_cast at hf
replace hFf : Integrable (𝓕 g) := by
have h2π : 2 * π ≠ 0 := by norm_num; exact pi_ne_zero
have : Integrable (𝓕 (fun u ↦ rexp (-(σ * u)) • f (rexp (-u)))) := by
simpa [mellin_eq_fourierIntegral, mul_div_cancel_right₀ _ h2π] using hFf.comp_mul_right' h2π
simp_rw [neg_mul_eq_neg_mul] at this
exact this
replace hfx : ContinuousAt g (-Real.log x) := by
refine ContinuousAt.smul (by fun_prop) (ContinuousAt.comp ?_ (by fun_prop))
simpa [Real.exp_log hx] using hfx
calc
mellinInv σ (mellin f) x
= mellinInv σ (fun s ↦ 𝓕 g (s.im / (2 * π))) x := by
simp [g, mellinInv, mellin_eq_fourierIntegral]
_ = (x : ℂ) ^ (-σ : ℂ) • g (-Real.log x) := by
rw [mellinInv_eq_fourierIntegralInv _ _ hx, ← hf.fourier_inversion hFf hfx]
simp [mul_div_cancel_left₀ _ (show 2 * π ≠ 0 by norm_num; exact pi_ne_zero)]
_ = (x : ℂ) ^ (-σ : ℂ) • rexp (σ * Real.log x) • f (rexp (Real.log x)) := by simp [g]
_ = f x := by
norm_cast
rw [mul_comm σ, ← rpow_def_of_pos hx, Real.exp_log hx, ← Complex.ofReal_cpow hx.le]
norm_cast
rw [← smul_assoc, smul_eq_mul, Real.rpow_neg hx.le,
inv_mul_cancel (ne_of_gt (rpow_pos_of_pos hx σ)), one_smul]
| 30 | 10,686,474,581,524.463 | 2 | 2 | 3 | 1,966 |
import Mathlib.Data.List.Chain
import Mathlib.Data.List.Enum
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Pairwise
import Mathlib.Data.List.Zip
#align_import data.list.range from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
set_option autoImplicit true
universe u
open Nat
namespace List
variable {α : Type u}
@[simp] theorem range'_one {step} : range' s 1 step = [s] := rfl
#align list.length_range' List.length_range'
#align list.range'_eq_nil List.range'_eq_nil
#align list.mem_range' List.mem_range'_1
#align list.map_add_range' List.map_add_range'
#align list.map_sub_range' List.map_sub_range'
#align list.chain_succ_range' List.chain_succ_range'
#align list.chain_lt_range' List.chain_lt_range'
theorem pairwise_lt_range' : ∀ s n (step := 1) (_ : 0 < step := by simp),
Pairwise (· < ·) (range' s n step)
| _, 0, _, _ => Pairwise.nil
| s, n + 1, _, h => chain_iff_pairwise.1 (chain_lt_range' s n h)
#align list.pairwise_lt_range' List.pairwise_lt_range'
theorem nodup_range' (s n : ℕ) (step := 1) (h : 0 < step := by simp) : Nodup (range' s n step) :=
(pairwise_lt_range' s n step h).imp _root_.ne_of_lt
#align list.nodup_range' List.nodup_range'
#align list.range'_append List.range'_append
#align list.range'_sublist_right List.range'_sublist_right
#align list.range'_subset_right List.range'_subset_right
#align list.nth_range' List.get?_range'
set_option linter.deprecated false in
@[simp]
theorem nthLe_range' {n m step} (i) (H : i < (range' n m step).length) :
nthLe (range' n m step) i H = n + step * i := get_range' i H
set_option linter.deprecated false in
theorem nthLe_range'_1 {n m} (i) (H : i < (range' n m).length) :
nthLe (range' n m) i H = n + i := by simp
#align list.nth_le_range' List.nthLe_range'_1
#align list.range'_concat List.range'_concat
#align list.range_core List.range.loop
#align list.range_core_range' List.range_loop_range'
#align list.range_eq_range' List.range_eq_range'
#align list.range_succ_eq_map List.range_succ_eq_map
#align list.range'_eq_map_range List.range'_eq_map_range
#align list.length_range List.length_range
#align list.range_eq_nil List.range_eq_nil
theorem pairwise_lt_range (n : ℕ) : Pairwise (· < ·) (range n) := by
simp (config := {decide := true}) only [range_eq_range', pairwise_lt_range']
#align list.pairwise_lt_range List.pairwise_lt_range
theorem pairwise_le_range (n : ℕ) : Pairwise (· ≤ ·) (range n) :=
Pairwise.imp (@le_of_lt ℕ _) (pairwise_lt_range _)
#align list.pairwise_le_range List.pairwise_le_range
theorem take_range (m n : ℕ) : take m (range n) = range (min m n) := by
apply List.ext_get
· simp
· simp (config := { contextual := true }) [← get_take, Nat.lt_min]
theorem nodup_range (n : ℕ) : Nodup (range n) := by
simp (config := {decide := true}) only [range_eq_range', nodup_range']
#align list.nodup_range List.nodup_range
#align list.range_sublist List.range_sublist
#align list.range_subset List.range_subset
#align list.mem_range List.mem_range
#align list.not_mem_range_self List.not_mem_range_self
#align list.self_mem_range_succ List.self_mem_range_succ
#align list.nth_range List.get?_range
#align list.range_succ List.range_succ
#align list.range_zero List.range_zero
| Mathlib/Data/List/Range.lean | 104 | 112 | theorem chain'_range_succ (r : ℕ → ℕ → Prop) (n : ℕ) :
Chain' r (range n.succ) ↔ ∀ m < n, r m m.succ := by |
rw [range_succ]
induction' n with n hn
· simp
· rw [range_succ]
simp only [append_assoc, singleton_append, chain'_append_cons_cons, chain'_singleton,
and_true_iff]
rw [hn, forall_lt_succ]
| 7 | 1,096.633158 | 2 | 0.571429 | 7 | 516 |
import Mathlib.Topology.ExtendFrom
import Mathlib.Topology.Order.DenselyOrdered
#align_import topology.algebra.order.extend_from from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
set_option autoImplicit true
open Filter Set TopologicalSpace
open scoped Classical
open Topology
| Mathlib/Topology/Order/ExtendFrom.lean | 23 | 33 | theorem continuousOn_Icc_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α]
[OrderTopology α] [TopologicalSpace β] [RegularSpace β] {f : α → β} {a b : α} {la lb : β}
(hab : a ≠ b) (hf : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 la))
(hb : Tendsto f (𝓝[<] b) (𝓝 lb)) : ContinuousOn (extendFrom (Ioo a b) f) (Icc a b) := by |
apply continuousOn_extendFrom
· rw [closure_Ioo hab]
· intro x x_in
rcases eq_endpoints_or_mem_Ioo_of_mem_Icc x_in with (rfl | rfl | h)
· exact ⟨la, ha.mono_left <| nhdsWithin_mono _ Ioo_subset_Ioi_self⟩
· exact ⟨lb, hb.mono_left <| nhdsWithin_mono _ Ioo_subset_Iio_self⟩
· exact ⟨f x, hf x h⟩
| 7 | 1,096.633158 | 2 | 1.8 | 5 | 1,887 |
import Mathlib.Data.Finset.Fold
import Mathlib.Algebra.GCDMonoid.Multiset
#align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
#align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d"
variable {ι α β γ : Type*}
namespace Finset
open Multiset
variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α]
section lcm
def lcm (s : Finset β) (f : β → α) : α :=
s.fold GCDMonoid.lcm 1 f
#align finset.lcm Finset.lcm
variable {s s₁ s₂ : Finset β} {f : β → α}
theorem lcm_def : s.lcm f = (s.1.map f).lcm :=
rfl
#align finset.lcm_def Finset.lcm_def
@[simp]
theorem lcm_empty : (∅ : Finset β).lcm f = 1 :=
fold_empty
#align finset.lcm_empty Finset.lcm_empty
@[simp]
theorem lcm_dvd_iff {a : α} : s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a := by
apply Iff.trans Multiset.lcm_dvd
simp only [Multiset.mem_map, and_imp, exists_imp]
exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩
#align finset.lcm_dvd_iff Finset.lcm_dvd_iff
theorem lcm_dvd {a : α} : (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a :=
lcm_dvd_iff.2
#align finset.lcm_dvd Finset.lcm_dvd
theorem dvd_lcm {b : β} (hb : b ∈ s) : f b ∣ s.lcm f :=
lcm_dvd_iff.1 dvd_rfl _ hb
#align finset.dvd_lcm Finset.dvd_lcm
@[simp]
| Mathlib/Algebra/GCDMonoid/Finset.lean | 77 | 82 | theorem lcm_insert [DecidableEq β] {b : β} :
(insert b s : Finset β).lcm f = GCDMonoid.lcm (f b) (s.lcm f) := by |
by_cases h : b ∈ s
· rw [insert_eq_of_mem h,
(lcm_eq_right_iff (f b) (s.lcm f) (Multiset.normalize_lcm (s.1.map f))).2 (dvd_lcm h)]
apply fold_insert h
| 4 | 54.59815 | 2 | 1 | 13 | 925 |
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.NormedSpace.Complemented
#align_import analysis.calculus.implicit from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Topology
open Filter
open ContinuousLinearMap (fst snd smulRight ker_prod)
open ContinuousLinearEquiv (ofBijective)
open LinearMap (ker range)
-- Porting note(#5171): linter not yet ported @[nolint has_nonempty_instance]
structure ImplicitFunctionData (𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : Type*)
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [CompleteSpace E] (F : Type*) [NormedAddCommGroup F]
[NormedSpace 𝕜 F] [CompleteSpace F] (G : Type*) [NormedAddCommGroup G] [NormedSpace 𝕜 G]
[CompleteSpace G] where
leftFun : E → F
leftDeriv : E →L[𝕜] F
rightFun : E → G
rightDeriv : E →L[𝕜] G
pt : E
left_has_deriv : HasStrictFDerivAt leftFun leftDeriv pt
right_has_deriv : HasStrictFDerivAt rightFun rightDeriv pt
left_range : range leftDeriv = ⊤
right_range : range rightDeriv = ⊤
isCompl_ker : IsCompl (ker leftDeriv) (ker rightDeriv)
#align implicit_function_data ImplicitFunctionData
namespace ImplicitFunctionData
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] [CompleteSpace E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
[CompleteSpace F] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] [CompleteSpace G]
(φ : ImplicitFunctionData 𝕜 E F G)
def prodFun (x : E) : F × G :=
(φ.leftFun x, φ.rightFun x)
#align implicit_function_data.prod_fun ImplicitFunctionData.prodFun
@[simp]
theorem prodFun_apply (x : E) : φ.prodFun x = (φ.leftFun x, φ.rightFun x) :=
rfl
#align implicit_function_data.prod_fun_apply ImplicitFunctionData.prodFun_apply
protected theorem hasStrictFDerivAt :
HasStrictFDerivAt φ.prodFun
(φ.leftDeriv.equivProdOfSurjectiveOfIsCompl φ.rightDeriv φ.left_range φ.right_range
φ.isCompl_ker :
E →L[𝕜] F × G)
φ.pt :=
φ.left_has_deriv.prod φ.right_has_deriv
#align implicit_function_data.has_strict_fderiv_at ImplicitFunctionData.hasStrictFDerivAt
def toPartialHomeomorph : PartialHomeomorph E (F × G) :=
φ.hasStrictFDerivAt.toPartialHomeomorph _
#align implicit_function_data.to_local_homeomorph ImplicitFunctionData.toPartialHomeomorph
def implicitFunction : F → G → E :=
Function.curry <| φ.toPartialHomeomorph.symm
#align implicit_function_data.implicit_function ImplicitFunctionData.implicitFunction
@[simp]
theorem toPartialHomeomorph_coe : ⇑φ.toPartialHomeomorph = φ.prodFun :=
rfl
#align implicit_function_data.to_local_homeomorph_coe ImplicitFunctionData.toPartialHomeomorph_coe
theorem toPartialHomeomorph_apply (x : E) : φ.toPartialHomeomorph x = (φ.leftFun x, φ.rightFun x) :=
rfl
#align implicit_function_data.to_local_homeomorph_apply ImplicitFunctionData.toPartialHomeomorph_apply
theorem pt_mem_toPartialHomeomorph_source : φ.pt ∈ φ.toPartialHomeomorph.source :=
φ.hasStrictFDerivAt.mem_toPartialHomeomorph_source
#align implicit_function_data.pt_mem_to_local_homeomorph_source ImplicitFunctionData.pt_mem_toPartialHomeomorph_source
theorem map_pt_mem_toPartialHomeomorph_target :
(φ.leftFun φ.pt, φ.rightFun φ.pt) ∈ φ.toPartialHomeomorph.target :=
φ.toPartialHomeomorph.map_source <| φ.pt_mem_toPartialHomeomorph_source
#align implicit_function_data.map_pt_mem_to_local_homeomorph_target ImplicitFunctionData.map_pt_mem_toPartialHomeomorph_target
theorem prod_map_implicitFunction :
∀ᶠ p : F × G in 𝓝 (φ.prodFun φ.pt), φ.prodFun (φ.implicitFunction p.1 p.2) = p :=
φ.hasStrictFDerivAt.eventually_right_inverse.mono fun ⟨_, _⟩ h => h
#align implicit_function_data.prod_map_implicit_function ImplicitFunctionData.prod_map_implicitFunction
theorem left_map_implicitFunction :
∀ᶠ p : F × G in 𝓝 (φ.prodFun φ.pt), φ.leftFun (φ.implicitFunction p.1 p.2) = p.1 :=
φ.prod_map_implicitFunction.mono fun _ => congr_arg Prod.fst
#align implicit_function_data.left_map_implicit_function ImplicitFunctionData.left_map_implicitFunction
theorem right_map_implicitFunction :
∀ᶠ p : F × G in 𝓝 (φ.prodFun φ.pt), φ.rightFun (φ.implicitFunction p.1 p.2) = p.2 :=
φ.prod_map_implicitFunction.mono fun _ => congr_arg Prod.snd
#align implicit_function_data.right_map_implicit_function ImplicitFunctionData.right_map_implicitFunction
theorem implicitFunction_apply_image :
∀ᶠ x in 𝓝 φ.pt, φ.implicitFunction (φ.leftFun x) (φ.rightFun x) = x :=
φ.hasStrictFDerivAt.eventually_left_inverse
#align implicit_function_data.implicit_function_apply_image ImplicitFunctionData.implicitFunction_apply_image
theorem map_nhds_eq : map φ.leftFun (𝓝 φ.pt) = 𝓝 (φ.leftFun φ.pt) :=
show map (Prod.fst ∘ φ.prodFun) (𝓝 φ.pt) = 𝓝 (φ.prodFun φ.pt).1 by
rw [← map_map, φ.hasStrictFDerivAt.map_nhds_eq_of_equiv, map_fst_nhds]
#align implicit_function_data.map_nhds_eq ImplicitFunctionData.map_nhds_eq
| Mathlib/Analysis/Calculus/Implicit.lean | 201 | 214 | theorem implicitFunction_hasStrictFDerivAt (g'inv : G →L[𝕜] E)
(hg'inv : φ.rightDeriv.comp g'inv = ContinuousLinearMap.id 𝕜 G)
(hg'invf : φ.leftDeriv.comp g'inv = 0) :
HasStrictFDerivAt (φ.implicitFunction (φ.leftFun φ.pt)) g'inv (φ.rightFun φ.pt) := by |
have := φ.hasStrictFDerivAt.to_localInverse
simp only [prodFun] at this
convert this.comp (φ.rightFun φ.pt) ((hasStrictFDerivAt_const _ _).prod (hasStrictFDerivAt_id _))
-- Porting note: added parentheses to help `simp`
simp only [ContinuousLinearMap.ext_iff, (ContinuousLinearMap.comp_apply)] at hg'inv hg'invf ⊢
-- porting note (#10745): was `simp [ContinuousLinearEquiv.eq_symm_apply]`;
-- both `simp` and `rw` fail here, `erw` works
intro x
erw [ContinuousLinearEquiv.eq_symm_apply]
simp [*]
| 10 | 22,026.465795 | 2 | 2 | 1 | 2,392 |
import Mathlib.RingTheory.FiniteType
import Mathlib.RingTheory.Localization.AtPrime
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.RingTheory.RingHomProperties
import Mathlib.Data.Set.Subsingleton
#align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
open scoped Pointwise Classical
universe u
variable {R S : Type u} [CommRing R] [CommRing S] (M : Submonoid R)
variable (N : Submonoid S) (R' S' : Type u) [CommRing R'] [CommRing S'] (f : R →+* S)
variable [Algebra R R'] [Algebra S S']
section Properties
section Ideal
open scoped nonZeroDivisors
theorem Ideal.le_of_localization_maximal {I J : Ideal R}
(h : ∀ (P : Ideal R) (hP : P.IsMaximal),
Ideal.map (algebraMap R (Localization.AtPrime P)) I ≤
Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
I ≤ J := by
intro x hx
suffices J.colon (Ideal.span {x}) = ⊤ by
simpa using Submodule.mem_colon.mp
(show (1 : R) ∈ J.colon (Ideal.span {x}) from this.symm ▸ Submodule.mem_top) x
(Ideal.mem_span_singleton_self x)
refine Not.imp_symm (J.colon (Ideal.span {x})).exists_le_maximal ?_
push_neg
intro P hP le
obtain ⟨⟨⟨a, ha⟩, ⟨s, hs⟩⟩, eq⟩ :=
(IsLocalization.mem_map_algebraMap_iff P.primeCompl _).mp (h P hP (Ideal.mem_map_of_mem _ hx))
rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq
obtain ⟨⟨m, hm⟩, eq⟩ := (IsLocalization.map_eq_zero_iff P.primeCompl _ _).mp eq
refine hs ((hP.isPrime.mem_or_mem (le (Ideal.mem_colon_singleton.mpr ?_))).resolve_right hm)
simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq
simpa only [mul_assoc, eq] using J.mul_mem_left m ha
#align ideal.le_of_localization_maximal Ideal.le_of_localization_maximal
theorem Ideal.eq_of_localization_maximal {I J : Ideal R}
(h : ∀ (P : Ideal R) (_ : P.IsMaximal),
Ideal.map (algebraMap R (Localization.AtPrime P)) I =
Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
I = J :=
le_antisymm (Ideal.le_of_localization_maximal fun P hP => (h P hP).le)
(Ideal.le_of_localization_maximal fun P hP => (h P hP).ge)
#align ideal.eq_of_localization_maximal Ideal.eq_of_localization_maximal
theorem ideal_eq_bot_of_localization' (I : Ideal R)
(h : ∀ (J : Ideal R) (hJ : J.IsMaximal),
Ideal.map (algebraMap R (Localization.AtPrime J)) I = ⊥) :
I = ⊥ :=
Ideal.eq_of_localization_maximal fun P hP => by simpa using h P hP
#align ideal_eq_bot_of_localization' ideal_eq_bot_of_localization'
-- TODO: This proof should work for all modules, once we have enough material on submodules of
-- localized modules.
theorem ideal_eq_bot_of_localization (I : Ideal R)
(h : ∀ (J : Ideal R) (hJ : J.IsMaximal),
IsLocalization.coeSubmodule (Localization.AtPrime J) I = ⊥) :
I = ⊥ :=
ideal_eq_bot_of_localization' _ fun P hP =>
(Ideal.map_eq_bot_iff_le_ker _).mpr fun x hx => by
rw [RingHom.mem_ker, ← Submodule.mem_bot R, ← h P hP, IsLocalization.mem_coeSubmodule]
exact ⟨x, hx, rfl⟩
#align ideal_eq_bot_of_localization ideal_eq_bot_of_localization
| Mathlib/RingTheory/LocalProperties.lean | 290 | 300 | theorem eq_zero_of_localization (r : R)
(h : ∀ (J : Ideal R) (hJ : J.IsMaximal), algebraMap R (Localization.AtPrime J) r = 0) :
r = 0 := by |
rw [← Ideal.span_singleton_eq_bot]
apply ideal_eq_bot_of_localization
intro J hJ
delta IsLocalization.coeSubmodule
erw [Submodule.map_span, Submodule.span_eq_bot]
rintro _ ⟨_, h', rfl⟩
cases Set.mem_singleton_iff.mpr h'
exact h J hJ
| 8 | 2,980.957987 | 2 | 1.833333 | 6 | 1,920 |
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.List.Sublists
import Mathlib.Data.List.InsertNth
#align_import group_theory.free_group from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6"
open Relation
universe u v w
variable {α : Type u}
attribute [local simp] List.append_eq_has_append
-- Porting note: to_additive.map_namespace is not supported yet
-- worked around it by putting a few extra manual mappings (but not too many all in all)
-- run_cmd to_additive.map_namespace `FreeGroup `FreeAddGroup
inductive FreeAddGroup.Red.Step : List (α × Bool) → List (α × Bool) → Prop
| not {L₁ L₂ x b} : FreeAddGroup.Red.Step (L₁ ++ (x, b) :: (x, not b) :: L₂) (L₁ ++ L₂)
#align free_add_group.red.step FreeAddGroup.Red.Step
attribute [simp] FreeAddGroup.Red.Step.not
@[to_additive FreeAddGroup.Red.Step]
inductive FreeGroup.Red.Step : List (α × Bool) → List (α × Bool) → Prop
| not {L₁ L₂ x b} : FreeGroup.Red.Step (L₁ ++ (x, b) :: (x, not b) :: L₂) (L₁ ++ L₂)
#align free_group.red.step FreeGroup.Red.Step
attribute [simp] FreeGroup.Red.Step.not
namespace FreeGroup
variable {L L₁ L₂ L₃ L₄ : List (α × Bool)}
@[to_additive FreeAddGroup.Red "Reflexive-transitive closure of `Red.Step`"]
def Red : List (α × Bool) → List (α × Bool) → Prop :=
ReflTransGen Red.Step
#align free_group.red FreeGroup.Red
#align free_add_group.red FreeAddGroup.Red
@[to_additive (attr := refl)]
theorem Red.refl : Red L L :=
ReflTransGen.refl
#align free_group.red.refl FreeGroup.Red.refl
#align free_add_group.red.refl FreeAddGroup.Red.refl
@[to_additive (attr := trans)]
theorem Red.trans : Red L₁ L₂ → Red L₂ L₃ → Red L₁ L₃ :=
ReflTransGen.trans
#align free_group.red.trans FreeGroup.Red.trans
#align free_add_group.red.trans FreeAddGroup.Red.trans
namespace Red
@[to_additive "Predicate asserting that the word `w₁` can be reduced to `w₂` in one step, i.e. there
are words `w₃ w₄` and letter `x` such that `w₁ = w₃ + x + (-x) + w₄` and `w₂ = w₃w₄`"]
theorem Step.length : ∀ {L₁ L₂ : List (α × Bool)}, Step L₁ L₂ → L₂.length + 2 = L₁.length
| _, _, @Red.Step.not _ L1 L2 x b => by rw [List.length_append, List.length_append]; rfl
#align free_group.red.step.length FreeGroup.Red.Step.length
#align free_add_group.red.step.length FreeAddGroup.Red.Step.length
@[to_additive (attr := simp)]
theorem Step.not_rev {x b} : Step (L₁ ++ (x, !b) :: (x, b) :: L₂) (L₁ ++ L₂) := by
cases b <;> exact Step.not
#align free_group.red.step.bnot_rev FreeGroup.Red.Step.not_rev
#align free_add_group.red.step.bnot_rev FreeAddGroup.Red.Step.not_rev
@[to_additive (attr := simp)]
theorem Step.cons_not {x b} : Red.Step ((x, b) :: (x, !b) :: L) L :=
@Step.not _ [] _ _ _
#align free_group.red.step.cons_bnot FreeGroup.Red.Step.cons_not
#align free_add_group.red.step.cons_bnot FreeAddGroup.Red.Step.cons_not
@[to_additive (attr := simp)]
theorem Step.cons_not_rev {x b} : Red.Step ((x, !b) :: (x, b) :: L) L :=
@Red.Step.not_rev _ [] _ _ _
#align free_group.red.step.cons_bnot_rev FreeGroup.Red.Step.cons_not_rev
#align free_add_group.red.step.cons_bnot_rev FreeAddGroup.Red.Step.cons_not_rev
@[to_additive]
theorem Step.append_left : ∀ {L₁ L₂ L₃ : List (α × Bool)}, Step L₂ L₃ → Step (L₁ ++ L₂) (L₁ ++ L₃)
| _, _, _, Red.Step.not => by rw [← List.append_assoc, ← List.append_assoc]; constructor
#align free_group.red.step.append_left FreeGroup.Red.Step.append_left
#align free_add_group.red.step.append_left FreeAddGroup.Red.Step.append_left
@[to_additive]
theorem Step.cons {x} (H : Red.Step L₁ L₂) : Red.Step (x :: L₁) (x :: L₂) :=
@Step.append_left _ [x] _ _ H
#align free_group.red.step.cons FreeGroup.Red.Step.cons
#align free_add_group.red.step.cons FreeAddGroup.Red.Step.cons
@[to_additive]
theorem Step.append_right : ∀ {L₁ L₂ L₃ : List (α × Bool)}, Step L₁ L₂ → Step (L₁ ++ L₃) (L₂ ++ L₃)
| _, _, _, Red.Step.not => by simp
#align free_group.red.step.append_right FreeGroup.Red.Step.append_right
#align free_add_group.red.step.append_right FreeAddGroup.Red.Step.append_right
@[to_additive]
| Mathlib/GroupTheory/FreeGroup/Basic.lean | 151 | 155 | theorem not_step_nil : ¬Step [] L := by |
generalize h' : [] = L'
intro h
cases' h with L₁ L₂
simp [List.nil_eq_append] at h'
| 4 | 54.59815 | 2 | 1.333333 | 3 | 1,423 |
import Mathlib.Algebra.Algebra.Quasispectrum
import Mathlib.FieldTheory.IsAlgClosed.Spectrum
import Mathlib.Analysis.Complex.Liouville
import Mathlib.Analysis.Complex.Polynomial
import Mathlib.Analysis.Analytic.RadiusLiminf
import Mathlib.Topology.Algebra.Module.CharacterSpace
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.NormedSpace.UnitizationL1
#align_import analysis.normed_space.spectrum from "leanprover-community/mathlib"@"d608fc5d4e69d4cc21885913fb573a88b0deb521"
open scoped ENNReal NNReal
open NormedSpace -- For `NormedSpace.exp`.
noncomputable def spectralRadius (𝕜 : Type*) {A : Type*} [NormedField 𝕜] [Ring A] [Algebra 𝕜 A]
(a : A) : ℝ≥0∞ :=
⨆ k ∈ spectrum 𝕜 a, ‖k‖₊
#align spectral_radius spectralRadius
variable {𝕜 : Type*} {A : Type*}
namespace spectrum
section SpectrumCompact
open Filter
variable [NormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A]
local notation "σ" => spectrum 𝕜
local notation "ρ" => resolventSet 𝕜
local notation "↑ₐ" => algebraMap 𝕜 A
@[simp]
theorem SpectralRadius.of_subsingleton [Subsingleton A] (a : A) : spectralRadius 𝕜 a = 0 := by
simp [spectralRadius]
#align spectrum.spectral_radius.of_subsingleton spectrum.SpectralRadius.of_subsingleton
@[simp]
theorem spectralRadius_zero : spectralRadius 𝕜 (0 : A) = 0 := by
nontriviality A
simp [spectralRadius]
#align spectrum.spectral_radius_zero spectrum.spectralRadius_zero
theorem mem_resolventSet_of_spectralRadius_lt {a : A} {k : 𝕜} (h : spectralRadius 𝕜 a < ‖k‖₊) :
k ∈ ρ a :=
Classical.not_not.mp fun hn => h.not_le <| le_iSup₂ (α := ℝ≥0∞) k hn
#align spectrum.mem_resolvent_set_of_spectral_radius_lt spectrum.mem_resolventSet_of_spectralRadius_lt
variable [CompleteSpace A]
theorem isOpen_resolventSet (a : A) : IsOpen (ρ a) :=
Units.isOpen.preimage ((continuous_algebraMap 𝕜 A).sub continuous_const)
#align spectrum.is_open_resolvent_set spectrum.isOpen_resolventSet
protected theorem isClosed (a : A) : IsClosed (σ a) :=
(isOpen_resolventSet a).isClosed_compl
#align spectrum.is_closed spectrum.isClosed
| Mathlib/Analysis/NormedSpace/Spectrum.lean | 104 | 113 | theorem mem_resolventSet_of_norm_lt_mul {a : A} {k : 𝕜} (h : ‖a‖ * ‖(1 : A)‖ < ‖k‖) : k ∈ ρ a := by |
rw [resolventSet, Set.mem_setOf_eq, Algebra.algebraMap_eq_smul_one]
nontriviality A
have hk : k ≠ 0 :=
ne_zero_of_norm_ne_zero ((mul_nonneg (norm_nonneg _) (norm_nonneg _)).trans_lt h).ne'
letI ku := Units.map ↑ₐ.toMonoidHom (Units.mk0 k hk)
rw [← inv_inv ‖(1 : A)‖,
mul_inv_lt_iff (inv_pos.2 <| norm_pos_iff.2 (one_ne_zero : (1 : A) ≠ 0))] at h
have hku : ‖-a‖ < ‖(↑ku⁻¹ : A)‖⁻¹ := by simpa [ku, norm_algebraMap] using h
simpa [ku, sub_eq_add_neg, Algebra.algebraMap_eq_smul_one] using (ku.add (-a) hku).isUnit
| 9 | 8,103.083928 | 2 | 1 | 4 | 1,004 |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn
#align_import analysis.calculus.inverse from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Function Set Filter Metric
open scoped Topology Classical NNReal
noncomputable section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
variable {ε : ℝ}
open Asymptotics Filter Metric Set
open ContinuousLinearMap (id)
namespace HasStrictFDerivAt
| Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean | 74 | 83 | theorem approximates_deriv_on_nhds {f : E → F} {f' : E →L[𝕜] F} {a : E}
(hf : HasStrictFDerivAt f f' a) {c : ℝ≥0} (hc : Subsingleton E ∨ 0 < c) :
∃ s ∈ 𝓝 a, ApproximatesLinearOn f f' s c := by |
cases' hc with hE hc
· refine ⟨univ, IsOpen.mem_nhds isOpen_univ trivial, fun x _ y _ => ?_⟩
simp [@Subsingleton.elim E hE x y]
have := hf.def hc
rw [nhds_prod_eq, Filter.Eventually, mem_prod_same_iff] at this
rcases this with ⟨s, has, hs⟩
exact ⟨s, has, fun x hx y hy => hs (mk_mem_prod hx hy)⟩
| 7 | 1,096.633158 | 2 | 2 | 3 | 2,275 |
import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace
suppress_compilation
set_option linter.uppercaseLean3 false
open Metric
open scoped Classical NNReal Topology Uniformity
variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜]
section SemiNormed
variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E]
namespace ContinuousLinearMap
section MultiplicationLinear
section SMulLinear
variable (𝕜) (𝕜' : Type*) [NormedField 𝕜']
variable [NormedAlgebra 𝕜 𝕜'] [NormedSpace 𝕜' E] [IsScalarTower 𝕜 𝕜' E]
def lsmul : 𝕜' →L[𝕜] E →L[𝕜] E :=
((Algebra.lsmul 𝕜 𝕜 E).toLinearMap : 𝕜' →ₗ[𝕜] E →ₗ[𝕜] E).mkContinuous₂ 1 fun c x => by
simpa only [one_mul] using norm_smul_le c x
#align continuous_linear_map.lsmul ContinuousLinearMap.lsmul
@[simp]
theorem lsmul_apply (c : 𝕜') (x : E) : lsmul 𝕜 𝕜' c x = c • x :=
rfl
#align continuous_linear_map.lsmul_apply ContinuousLinearMap.lsmul_apply
variable {𝕜'}
| Mathlib/Analysis/NormedSpace/OperatorNorm/Mul.lean | 226 | 231 | theorem norm_toSpanSingleton (x : E) : ‖toSpanSingleton 𝕜 x‖ = ‖x‖ := by |
refine opNorm_eq_of_bounds (norm_nonneg _) (fun x => ?_) fun N _ h => ?_
· rw [toSpanSingleton_apply, norm_smul, mul_comm]
· specialize h 1
rw [toSpanSingleton_apply, norm_smul, mul_comm] at h
exact (mul_le_mul_right (by simp)).mp h
| 5 | 148.413159 | 2 | 1.5 | 2 | 1,587 |
import Mathlib.NumberTheory.LegendreSymbol.Basic
import Mathlib.Analysis.Normed.Field.Basic
#align_import number_theory.legendre_symbol.gauss_eisenstein_lemmas from "leanprover-community/mathlib"@"8818fdefc78642a7e6afcd20be5c184f3c7d9699"
open Finset Nat
open scoped Nat
section GaussEisenstein
namespace ZMod
| Mathlib/NumberTheory/LegendreSymbol/GaussEisensteinLemmas.lean | 30 | 60 | theorem Ico_map_valMinAbs_natAbs_eq_Ico_map_id (p : ℕ) [hp : Fact p.Prime] (a : ZMod p)
(hap : a ≠ 0) : ((Ico 1 (p / 2).succ).1.map fun (x : ℕ) => (a * x).valMinAbs.natAbs) =
(Ico 1 (p / 2).succ).1.map fun a => a := by |
have he : ∀ {x}, x ∈ Ico 1 (p / 2).succ → x ≠ 0 ∧ x ≤ p / 2 := by
simp (config := { contextual := true }) [Nat.lt_succ_iff, Nat.succ_le_iff, pos_iff_ne_zero]
have hep : ∀ {x}, x ∈ Ico 1 (p / 2).succ → x < p := fun hx =>
lt_of_le_of_lt (he hx).2 (Nat.div_lt_self hp.1.pos (by decide))
have hpe : ∀ {x}, x ∈ Ico 1 (p / 2).succ → ¬p ∣ x := fun hx hpx =>
not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero (he hx).1) hpx) (hep hx)
have hmem : ∀ (x : ℕ) (hx : x ∈ Ico 1 (p / 2).succ),
(a * x : ZMod p).valMinAbs.natAbs ∈ Ico 1 (p / 2).succ := by
intro x hx
simp [hap, CharP.cast_eq_zero_iff (ZMod p) p, hpe hx, Nat.lt_succ_iff, succ_le_iff,
pos_iff_ne_zero, natAbs_valMinAbs_le _]
have hsurj : ∀ (b : ℕ) (hb : b ∈ Ico 1 (p / 2).succ),
∃ x, ∃ _ : x ∈ Ico 1 (p / 2).succ, (a * x : ZMod p).valMinAbs.natAbs = b := by
intro b hb
refine ⟨(b / a : ZMod p).valMinAbs.natAbs, mem_Ico.mpr ⟨?_, ?_⟩, ?_⟩
· apply Nat.pos_of_ne_zero
simp only [div_eq_mul_inv, hap, CharP.cast_eq_zero_iff (ZMod p) p, hpe hb, not_false_iff,
valMinAbs_eq_zero, inv_eq_zero, Int.natAbs_eq_zero, Ne, _root_.mul_eq_zero, or_self_iff]
· apply lt_succ_of_le; apply natAbs_valMinAbs_le
· rw [natCast_natAbs_valMinAbs]
split_ifs
· erw [mul_div_cancel₀ _ hap, valMinAbs_def_pos, val_cast_of_lt (hep hb),
if_pos (le_of_lt_succ (mem_Ico.1 hb).2), Int.natAbs_ofNat]
· erw [mul_neg, mul_div_cancel₀ _ hap, natAbs_valMinAbs_neg, valMinAbs_def_pos,
val_cast_of_lt (hep hb), if_pos (le_of_lt_succ (mem_Ico.1 hb).2), Int.natAbs_ofNat]
exact Multiset.map_eq_map_of_bij_of_nodup _ _ (Finset.nodup _) (Finset.nodup _)
(fun x _ => (a * x : ZMod p).valMinAbs.natAbs) hmem
(inj_on_of_surj_on_of_card_le _ hmem hsurj le_rfl) hsurj (fun _ _ => rfl)
| 28 | 1,446,257,064,291.475 | 2 | 2 | 1 | 2,438 |
import Mathlib.Algebra.Star.Basic
import Mathlib.Algebra.Star.Pointwise
import Mathlib.Algebra.Group.Centralizer
variable {R : Type*} [Mul R] [StarMul R] {a : R} {s : Set R}
| Mathlib/Algebra/Star/Center.lean | 14 | 34 | theorem Set.star_mem_center (ha : a ∈ Set.center R) : star a ∈ Set.center R where
comm := by | simpa only [star_mul, star_star] using fun g =>
congr_arg star (((Set.mem_center_iff R).mp ha).comm <| star g).symm
left_assoc b c := calc
star a * (b * c) = star a * (star (star b) * star (star c)) := by rw [star_star, star_star]
_ = star a * star (star c * star b) := by rw [star_mul]
_ = star ((star c * star b) * a) := by rw [← star_mul]
_ = star (star c * (star b * a)) := by rw [ha.right_assoc]
_ = star (star b * a) * c := by rw [star_mul, star_star]
_ = (star a * b) * c := by rw [star_mul, star_star]
mid_assoc b c := calc
b * star a * c = star (star c * star (b * star a)) := by rw [← star_mul, star_star]
_ = star (star c * (a * star b)) := by rw [star_mul b, star_star]
_ = star ((star c * a) * star b) := by rw [ha.mid_assoc]
_ = b * (star a * c) := by rw [star_mul, star_star, star_mul (star c), star_star]
right_assoc b c := calc
b * c * star a = star (a * star (b * c)) := by rw [star_mul, star_star]
_ = star (a * (star c * star b)) := by rw [star_mul b]
_ = star ((a * star c) * star b) := by rw [ha.left_assoc]
_ = b * star (a * star c) := by rw [star_mul, star_star]
_ = b * (c * star a) := by rw [star_mul, star_star]
| 20 | 485,165,195.40979 | 2 | 2 | 1 | 2,109 |
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Data.List.Infix
import Mathlib.Data.List.MinMax
import Mathlib.Data.List.EditDistance.Defs
set_option autoImplicit true
variable {C : Levenshtein.Cost α β δ} [CanonicallyLinearOrderedAddCommMonoid δ]
theorem suffixLevenshtein_minimum_le_levenshtein_cons (xs : List α) (y ys) :
(suffixLevenshtein C xs ys).1.minimum ≤ levenshtein C xs (y :: ys) := by
induction xs with
| nil =>
simp only [suffixLevenshtein_nil', levenshtein_nil_cons,
List.minimum_singleton, WithTop.coe_le_coe]
exact le_add_of_nonneg_left (by simp)
| cons x xs ih =>
suffices
(suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (C.delete x + levenshtein C xs (y :: ys)) ∧
(suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (C.insert y + levenshtein C (x :: xs) ys) ∧
(suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (C.substitute x y + levenshtein C xs ys) by
simpa [suffixLevenshtein_eq_tails_map]
refine ⟨?_, ?_, ?_⟩
· calc
_ ≤ (suffixLevenshtein C xs ys).1.minimum := by
simp [suffixLevenshtein_cons₁_fst, List.minimum_cons]
_ ≤ ↑(levenshtein C xs (y :: ys)) := ih
_ ≤ _ := by simp
· calc
(suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (levenshtein C (x :: xs) ys) := by
simp [suffixLevenshtein_cons₁_fst, List.minimum_cons]
_ ≤ _ := by simp
· calc
(suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (levenshtein C xs ys) := by
simp only [suffixLevenshtein_cons₁_fst, List.minimum_cons]
apply min_le_of_right_le
cases xs
· simp [suffixLevenshtein_nil']
· simp [suffixLevenshtein_cons₁, List.minimum_cons]
_ ≤ _ := by simp
theorem le_suffixLevenshtein_cons_minimum (xs : List α) (y ys) :
(suffixLevenshtein C xs ys).1.minimum ≤ (suffixLevenshtein C xs (y :: ys)).1.minimum := by
apply List.le_minimum_of_forall_le
simp only [suffixLevenshtein_eq_tails_map]
simp only [List.mem_map, List.mem_tails, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
intro a suff
refine (?_ : _ ≤ _).trans (suffixLevenshtein_minimum_le_levenshtein_cons _ _ _)
simp only [suffixLevenshtein_eq_tails_map]
apply List.le_minimum_of_forall_le
intro b m
replace m : ∃ a_1, a_1 <:+ a ∧ levenshtein C a_1 ys = b := by simpa using m
obtain ⟨a', suff', rfl⟩ := m
apply List.minimum_le_of_mem'
simp only [List.mem_map, List.mem_tails]
suffices ∃ a, a <:+ xs ∧ levenshtein C a ys = levenshtein C a' ys by simpa
exact ⟨a', suff'.trans suff, rfl⟩
theorem le_suffixLevenshtein_append_minimum (xs : List α) (ys₁ ys₂) :
(suffixLevenshtein C xs ys₂).1.minimum ≤ (suffixLevenshtein C xs (ys₁ ++ ys₂)).1.minimum := by
induction ys₁ with
| nil => exact le_refl _
| cons y ys₁ ih => exact ih.trans (le_suffixLevenshtein_cons_minimum _ _ _)
| Mathlib/Data/List/EditDistance/Bounds.lean | 81 | 87 | theorem suffixLevenshtein_minimum_le_levenshtein_append (xs ys₁ ys₂) :
(suffixLevenshtein C xs ys₂).1.minimum ≤ levenshtein C xs (ys₁ ++ ys₂) := by |
cases ys₁ with
| nil => exact List.minimum_le_of_mem' (List.get_mem _ _ _)
| cons y ys₁ =>
exact (le_suffixLevenshtein_append_minimum _ _ _).trans
(suffixLevenshtein_minimum_le_levenshtein_cons _ _ _)
| 5 | 148.413159 | 2 | 1.5 | 6 | 1,674 |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.LinearAlgebra.FreeModule.PID
import Mathlib.LinearAlgebra.Matrix.AbsoluteValue
import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue
import Mathlib.RingTheory.ClassGroup
import Mathlib.RingTheory.DedekindDomain.IntegralClosure
import Mathlib.RingTheory.Norm
#align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176"
open scoped nonZeroDivisors
namespace ClassGroup
open Ring
section EuclideanDomain
variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S]
variable [Field K] [Field L]
variable [Algebra R K] [IsFractionRing R K]
variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L]
variable [algRL : Algebra R L] [IsScalarTower R K L]
variable [Algebra R S] [Algebra S L]
variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L]
variable (abv : AbsoluteValue R ℤ)
variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S)
noncomputable def normBound : ℤ :=
let n := Fintype.card ι
let i : ι := Nonempty.some bS.index_nonempty
let m : ℤ :=
Finset.max'
(Finset.univ.image fun ijk : ι × ι × ι =>
abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2))
⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩
Nat.factorial n • (n • m) ^ n
#align class_group.norm_bound ClassGroup.normBound
| Mathlib/NumberTheory/ClassNumber/Finite.lean | 58 | 71 | theorem normBound_pos : 0 < normBound abv bS := by |
obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by
by_contra! h
obtain ⟨i⟩ := bS.index_nonempty
apply bS.ne_zero i
apply
(injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS)
ext j k
simp [h, DMatrix.zero_apply]
simp only [normBound, Algebra.smul_def, eq_natCast]
apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _))
refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _
refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_)
exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩
| 13 | 442,413.392009 | 2 | 2 | 4 | 2,456 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
namespace Set
variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)
| Mathlib/Algebra/Order/Interval/Set/Monoid.lean | 27 | 32 | theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by |
refine
⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h)
rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
| 5 | 148.413159 | 2 | 1.090909 | 11 | 1,187 |
import Batteries.Data.List.Lemmas
import Batteries.Data.Array.Basic
import Batteries.Tactic.SeqFocus
import Batteries.Util.ProofWanted
namespace Array
| .lake/packages/batteries/Batteries/Data/Array/Lemmas.lean | 14 | 29 | theorem forIn_eq_data_forIn [Monad m]
(as : Array α) (b : β) (f : α → β → m (ForInStep β)) :
forIn as b f = forIn as.data b f := by |
let rec loop : ∀ {i h b j}, j + i = as.size →
Array.forIn.loop as f i h b = forIn (as.data.drop j) b f
| 0, _, _, _, rfl => by rw [List.drop_length]; rfl
| i+1, _, _, j, ij => by
simp only [forIn.loop, Nat.add]
have j_eq : j = size as - 1 - i := by simp [← ij, ← Nat.add_assoc]
have : as.size - 1 - i < as.size := j_eq ▸ ij ▸ Nat.lt_succ_of_le (Nat.le_add_right ..)
have : as[size as - 1 - i] :: as.data.drop (j + 1) = as.data.drop j := by
rw [j_eq]; exact List.get_cons_drop _ ⟨_, this⟩
simp only [← this, List.forIn_cons]; congr; funext x; congr; funext b
rw [loop (i := i)]; rw [← ij, Nat.succ_add]; rfl
conv => lhs; simp only [forIn, Array.forIn]
rw [loop (Nat.zero_add _)]; rfl
| 13 | 442,413.392009 | 2 | 1.5 | 6 | 1,680 |
import Mathlib.NumberTheory.Padics.PadicIntegers
import Mathlib.RingTheory.ZMod
#align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950"
noncomputable section
open scoped Classical
open Nat LocalRing Padic
namespace PadicInt
variable {p : ℕ} [hp_prime : Fact p.Prime]
section lift
open CauSeq PadicSeq
variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k))
(f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1)
def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val
#align padic_int.nth_hom PadicInt.nthHom
@[simp]
theorem nthHom_zero : nthHom f 0 = 0 := by
simp (config := { unfoldPartialApp := true }) [nthHom]
rfl
#align padic_int.nth_hom_zero PadicInt.nthHom_zero
variable {f}
theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) :
(p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by
specialize f_compat i j h
rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub]
dsimp [nthHom]
rw [← f_compat, RingHom.comp_apply]
simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast]
#align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub
theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by
intro ε hε
obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε
use k
intro j hj
refine lt_of_le_of_lt ?_ hk
-- Need to do beta reduction first, as `norm_cast` doesn't.
-- Added to adapt to leanprover/lean4#2734.
beta_reduce
norm_cast
rw [← padicNorm.dvd_iff_norm_le]
exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj
#align padic_int.is_cau_seq_nth_hom PadicInt.isCauSeq_nthHom
def nthHomSeq (r : R) : PadicSeq p :=
⟨fun n => nthHom f r n, isCauSeq_nthHom f_compat r⟩
#align padic_int.nth_hom_seq PadicInt.nthHomSeq
-- this lemma ran into issues after changing to `NeZero` and I'm not sure why.
theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 := by
intro ε hε
change _ < _ at hε
use 1
intro j hj
haveI : Fact (1 < p ^ j) := ⟨Nat.one_lt_pow (by omega) hp_prime.1.one_lt⟩
suffices (ZMod.cast (1 : ZMod (p ^ j)) : ℚ) = 1 by simp [nthHomSeq, nthHom, this, hε]
rw [ZMod.cast_eq_val, ZMod.val_one, Nat.cast_one]
#align padic_int.nth_hom_seq_one PadicInt.nthHomSeq_one
theorem nthHomSeq_add (r s : R) :
nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s := by
intro ε hε
obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε
use n
intro j hj
dsimp [nthHomSeq]
apply lt_of_le_of_lt _ hn
rw [← Int.cast_add, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ←
ZMod.intCast_zmod_eq_zero_iff_dvd]
dsimp [nthHom]
simp only [ZMod.natCast_val, RingHom.map_add, Int.cast_sub, ZMod.intCast_cast, Int.cast_add]
rw [ZMod.cast_add (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj)]
simp only [cast_add, ZMod.natCast_val, Int.cast_add, ZMod.intCast_cast, sub_self]
#align padic_int.nth_hom_seq_add PadicInt.nthHomSeq_add
theorem nthHomSeq_mul (r s : R) :
nthHomSeq f_compat (r * s) ≈ nthHomSeq f_compat r * nthHomSeq f_compat s := by
intro ε hε
obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε
use n
intro j hj
dsimp [nthHomSeq]
apply lt_of_le_of_lt _ hn
rw [← Int.cast_mul, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ←
ZMod.intCast_zmod_eq_zero_iff_dvd]
dsimp [nthHom]
simp only [ZMod.natCast_val, RingHom.map_mul, Int.cast_sub, ZMod.intCast_cast, Int.cast_mul]
rw [ZMod.cast_mul (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj), sub_self]
#align padic_int.nth_hom_seq_mul PadicInt.nthHomSeq_mul
def limNthHom (r : R) : ℤ_[p] :=
ofIntSeq (nthHom f r) (isCauSeq_nthHom f_compat r)
#align padic_int.lim_nth_hom PadicInt.limNthHom
| Mathlib/NumberTheory/Padics/RingHoms.lean | 586 | 597 | theorem limNthHom_spec (r : R) :
∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ n ≥ N, ‖limNthHom f_compat r - nthHom f r n‖ < ε := by |
intro ε hε
obtain ⟨ε', hε'0, hε'⟩ : ∃ v : ℚ, (0 : ℝ) < v ∧ ↑v < ε := exists_rat_btwn hε
norm_cast at hε'0
obtain ⟨N, hN⟩ := padicNormE.defn (nthHomSeq f_compat r) hε'0
use N
intro n hn
apply _root_.lt_trans _ hε'
change (padicNormE _ : ℝ) < _
norm_cast
exact hN _ hn
| 10 | 22,026.465795 | 2 | 1.833333 | 12 | 1,916 |
import Mathlib.MeasureTheory.MeasurableSpace.Basic
import Mathlib.Data.Set.MemPartition
import Mathlib.Order.Filter.CountableSeparatingOn
open Set MeasureTheory
namespace MeasurableSpace
variable {α β : Type*}
class CountablyGenerated (α : Type*) [m : MeasurableSpace α] : Prop where
isCountablyGenerated : ∃ b : Set (Set α), b.Countable ∧ m = generateFrom b
#align measurable_space.countably_generated MeasurableSpace.CountablyGenerated
def countableGeneratingSet (α : Type*) [MeasurableSpace α] [h : CountablyGenerated α] :
Set (Set α) :=
insert ∅ h.isCountablyGenerated.choose
lemma countable_countableGeneratingSet [MeasurableSpace α] [h : CountablyGenerated α] :
Set.Countable (countableGeneratingSet α) :=
Countable.insert _ h.isCountablyGenerated.choose_spec.1
lemma generateFrom_countableGeneratingSet [m : MeasurableSpace α] [h : CountablyGenerated α] :
generateFrom (countableGeneratingSet α) = m :=
(generateFrom_insert_empty _).trans <| h.isCountablyGenerated.choose_spec.2.symm
lemma empty_mem_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α] :
∅ ∈ countableGeneratingSet α := mem_insert _ _
lemma nonempty_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α] :
Set.Nonempty (countableGeneratingSet α) :=
⟨∅, mem_insert _ _⟩
lemma measurableSet_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α]
{s : Set α} (hs : s ∈ countableGeneratingSet α) :
MeasurableSet s := by
rw [← generateFrom_countableGeneratingSet (α := α)]
exact measurableSet_generateFrom hs
def natGeneratingSequence (α : Type*) [MeasurableSpace α] [CountablyGenerated α] : ℕ → (Set α) :=
enumerateCountable (countable_countableGeneratingSet (α := α)) ∅
lemma generateFrom_natGeneratingSequence (α : Type*) [m : MeasurableSpace α]
[CountablyGenerated α] : generateFrom (range (natGeneratingSequence _)) = m := by
rw [natGeneratingSequence, range_enumerateCountable_of_mem _ empty_mem_countableGeneratingSet,
generateFrom_countableGeneratingSet]
lemma measurableSet_natGeneratingSequence [MeasurableSpace α] [CountablyGenerated α] (n : ℕ) :
MeasurableSet (natGeneratingSequence α n) :=
measurableSet_countableGeneratingSet $ Set.enumerateCountable_mem _
empty_mem_countableGeneratingSet n
| Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean | 96 | 101 | theorem CountablyGenerated.comap [m : MeasurableSpace β] [h : CountablyGenerated β] (f : α → β) :
@CountablyGenerated α (.comap f m) := by |
rcases h with ⟨⟨b, hbc, rfl⟩⟩
rw [comap_generateFrom]
letI := generateFrom (preimage f '' b)
exact ⟨_, hbc.image _, rfl⟩
| 4 | 54.59815 | 2 | 1.5 | 4 | 1,686 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric TopologicalSpace Function Asymptotics Filter
open scoped Topology NNReal
variable {α β 𝕜 E F : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ}
variable [NormedSpace 𝕜 F]
variable {f : α → E → F} {f' : α → E → E →L[𝕜] F} {g : α → 𝕜 → F} {g' : α → 𝕜 → F} {v : ℕ → α → ℝ}
{s : Set E} {t : Set 𝕜} {x₀ x : E} {y₀ y : 𝕜} {N : ℕ∞}
theorem summable_of_summable_hasFDerivAt_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable (f · x₀))
(hx : x ∈ s) : Summable fun n => f n x := by
haveI := Classical.decEq α
rw [summable_iff_cauchySeq_finset] at hf0 ⊢
have A : UniformCauchySeqOn (fun t : Finset α => fun x => ∑ i ∈ t, f' i x) atTop s :=
(tendstoUniformlyOn_tsum hu hf').uniformCauchySeqOn
-- Porting note: Lean 4 failed to find `f` by unification
refine cauchy_map_of_uniformCauchySeqOn_fderiv (f := fun t x ↦ ∑ i ∈ t, f i x)
hs h's A (fun t y hy => ?_) hx₀ hx hf0
exact HasFDerivAt.sum fun i _ => hf i y hy
#align summable_of_summable_has_fderiv_at_of_is_preconnected summable_of_summable_hasFDerivAt_of_isPreconnected
theorem summable_of_summable_hasDerivAt_of_isPreconnected (hu : Summable u) (ht : IsOpen t)
(h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y)
(hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable (g · y₀))
(hy : y ∈ t) : Summable fun n => g n y := by
simp_rw [hasDerivAt_iff_hasFDerivAt] at hg
refine summable_of_summable_hasFDerivAt_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy
simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
| Mathlib/Analysis/Calculus/SmoothSeries.lean | 72 | 84 | theorem hasFDerivAt_tsum_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable fun n => f n x₀)
(hx : x ∈ s) : HasFDerivAt (fun y => ∑' n, f n y) (∑' n, f' n x) x := by |
classical
have A :
∀ x : E, x ∈ s → Tendsto (fun t : Finset α => ∑ n ∈ t, f n x) atTop (𝓝 (∑' n, f n x)) := by
intro y hy
apply Summable.hasSum
exact summable_of_summable_hasFDerivAt_of_isPreconnected hu hs h's hf hf' hx₀ hf0 hy
refine hasFDerivAt_of_tendstoUniformlyOn hs (tendstoUniformlyOn_tsum hu hf')
(fun t y hy => ?_) A _ hx
exact HasFDerivAt.sum fun n _ => hf n y hy
| 9 | 8,103.083928 | 2 | 1.6 | 5 | 1,721 |
import Mathlib.Algebra.GeomSum
import Mathlib.Algebra.Polynomial.Roots
import Mathlib.GroupTheory.SpecificGroups.Cyclic
#align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e"
section
open Finset Polynomial Function Nat
variable {R : Type*} {G : Type*}
variable [CommRing R] [IsDomain R] [Group G]
-- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore,
-- so we have to use `Finset.filter` instead
theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f)
{n : ℕ} (hn : 0 < n) (g₀ : G) :
Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by
haveI : DecidableEq R := Classical.decEq _
refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le
apply card_le_card_of_inj_on f
· intro g hg
rw [mem_filter] at hg
rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2]
· intros
apply hf
assumption
#align card_nth_roots_subgroup_units card_nthRoots_subgroup_units
theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by
classical
cases nonempty_fintype G
apply isCyclic_of_card_pow_eq_one_le
intro n hn
exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1))
#align is_cyclic_of_subgroup_is_domain isCyclic_of_subgroup_isDomain
instance [Finite Rˣ] : IsCyclic Rˣ :=
isCyclic_of_subgroup_isDomain (Units.coeHom R) <| Units.ext
section
variable (S : Subgroup Rˣ) [Finite S]
instance subgroup_units_cyclic : IsCyclic S := by
-- Porting note: the original proof used a `coe`, but I was not able to get it to work.
apply isCyclic_of_subgroup_isDomain (R := R) (G := S) _ _
· exact MonoidHom.mk (OneHom.mk (fun s => ↑s.val) rfl) (by simp)
· exact Units.ext.comp Subtype.val_injective
#align subgroup_units_cyclic subgroup_units_cyclic
end
section EuclideanDivision
variable [Fintype G]
@[deprecated (since := "2024-06-10")]
alias card_fiber_eq_of_mem_range := MonoidHom.card_fiber_eq_of_mem_range
| Mathlib/RingTheory/IntegralDomain.lean | 200 | 254 | theorem sum_hom_units_eq_zero (f : G →* R) (hf : f ≠ 1) : ∑ g : G, f g = 0 := by |
classical
obtain ⟨x, hx⟩ : ∃ x : MonoidHom.range f.toHomUnits,
∀ y : MonoidHom.range f.toHomUnits, y ∈ Submonoid.powers x :=
IsCyclic.exists_monoid_generator
have hx1 : x ≠ 1 := by
rintro rfl
apply hf
ext g
rw [MonoidHom.one_apply]
cases' hx ⟨f.toHomUnits g, g, rfl⟩ with n hn
rwa [Subtype.ext_iff, Units.ext_iff, Subtype.coe_mk, MonoidHom.coe_toHomUnits, one_pow,
eq_comm] at hn
replace hx1 : (x.val : R) - 1 ≠ 0 := -- Porting note: was `(x : R)`
fun h => hx1 (Subtype.eq (Units.ext (sub_eq_zero.1 h)))
let c := (univ.filter fun g => f.toHomUnits g = 1).card
calc
∑ g : G, f g = ∑ g : G, (f.toHomUnits g : R) := rfl
_ = ∑ u ∈ univ.image f.toHomUnits,
(univ.filter fun g => f.toHomUnits g = u).card • (u : R) :=
(sum_comp ((↑) : Rˣ → R) f.toHomUnits)
_ = ∑ u ∈ univ.image f.toHomUnits, c • (u : R) :=
(sum_congr rfl fun u hu => congr_arg₂ _ ?_ rfl)
-- remaining goal 1, proven below
-- Porting note: have to change `(b : R)` into `((b : Rˣ) : R)`
_ = ∑ b : MonoidHom.range f.toHomUnits, c • ((b : Rˣ) : R) :=
(Finset.sum_subtype _ (by simp) _)
_ = c • ∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R) := smul_sum.symm
_ = c • (0 : R) := congr_arg₂ _ rfl ?_
-- remaining goal 2, proven below
_ = (0 : R) := smul_zero _
· -- remaining goal 1
show (univ.filter fun g : G => f.toHomUnits g = u).card = c
apply MonoidHom.card_fiber_eq_of_mem_range f.toHomUnits
· simpa only [mem_image, mem_univ, true_and, Set.mem_range] using hu
· exact ⟨1, f.toHomUnits.map_one⟩
-- remaining goal 2
show (∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R)) = 0
calc
(∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R))
= ∑ n ∈ range (orderOf x), ((x : Rˣ) : R) ^ n :=
Eq.symm <|
sum_nbij (x ^ ·) (by simp only [mem_univ, forall_true_iff])
(by simpa using pow_injOn_Iio_orderOf)
(fun b _ => let ⟨n, hn⟩ := hx b
⟨n % orderOf x, mem_range.2 (Nat.mod_lt _ (orderOf_pos _)),
-- Porting note: have to use `dsimp` to apply the function
by dsimp at hn ⊢; rw [pow_mod_orderOf, hn]⟩)
(by simp only [imp_true_iff, eq_self_iff_true, Subgroup.coe_pow,
Units.val_pow_eq_pow_val])
_ = 0 := ?_
rw [← mul_left_inj' hx1, zero_mul, geom_sum_mul]
norm_cast
simp [pow_orderOf_eq_one]
| 53 | 104,137,594,330,290,870,000,000 | 2 | 2 | 6 | 2,481 |
import Mathlib.Algebra.Module.Card
import Mathlib.SetTheory.Cardinal.CountableCover
import Mathlib.SetTheory.Cardinal.Continuum
import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Topology.MetricSpace.Perfect
universe u v
open Filter Pointwise Set Function Cardinal
open scoped Cardinal Topology
| Mathlib/Topology/Algebra/Module/Cardinality.lean | 29 | 45 | theorem continuum_le_cardinal_of_nontriviallyNormedField
(𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by |
suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by
rcases this with ⟨f, -, -, f_inj⟩
simpa using lift_mk_le_lift_mk_of_injective f_inj
apply Perfect.exists_nat_bool_injection _ univ_nonempty
refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩
rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩
have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) :=
tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc)
rw [add_zero] at A
have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU
rcases B.exists with ⟨n, hn⟩
refine ⟨x + c^n, by simpa using hn, ?_⟩
simp only [ne_eq, add_right_eq_self]
apply pow_ne_zero
simpa using c_pos
| 15 | 3,269,017.372472 | 2 | 1.2 | 5 | 1,284 |
import Mathlib.Algebra.BigOperators.WithTop
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.ENNReal.Basic
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
section Mul
-- Porting note (#11215): TODO: generalize to `WithTop`
@[mono, gcongr]
| Mathlib/Data/ENNReal/Operations.lean | 33 | 41 | theorem mul_lt_mul (ac : a < c) (bd : b < d) : a * b < c * d := by |
rcases lt_iff_exists_nnreal_btwn.1 ac with ⟨a', aa', a'c⟩
lift a to ℝ≥0 using ne_top_of_lt aa'
rcases lt_iff_exists_nnreal_btwn.1 bd with ⟨b', bb', b'd⟩
lift b to ℝ≥0 using ne_top_of_lt bb'
norm_cast at *
calc
↑(a * b) < ↑(a' * b') := coe_lt_coe.2 (mul_lt_mul₀ aa' bb')
_ ≤ c * d := mul_le_mul' a'c.le b'd.le
| 8 | 2,980.957987 | 2 | 0.666667 | 12 | 570 |
import Mathlib.Topology.Sheaves.Presheaf
import Mathlib.Topology.Sheaves.Stalks
import Mathlib.CategoryTheory.Limits.Preserves.Filtered
import Mathlib.CategoryTheory.Sites.LocallySurjective
#align_import topology.sheaves.locally_surjective from "leanprover-community/mathlib"@"fb7698eb37544cbb66292b68b40e54d001f8d1a9"
universe v u
attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike
noncomputable section
open CategoryTheory
open TopologicalSpace
open Opposite
namespace TopCat.Presheaf
section LocallySurjective
open scoped AlgebraicGeometry
variable {C : Type u} [Category.{v} C] [ConcreteCategory.{v} C] {X : TopCat.{v}}
variable {ℱ 𝒢 : X.Presheaf C}
def IsLocallySurjective (T : ℱ ⟶ 𝒢) :=
CategoryTheory.Presheaf.IsLocallySurjective (Opens.grothendieckTopology X) T
set_option linter.uppercaseLean3 false in
#align Top.presheaf.is_locally_surjective TopCat.Presheaf.IsLocallySurjective
theorem isLocallySurjective_iff (T : ℱ ⟶ 𝒢) :
IsLocallySurjective T ↔
∀ (U t), ∀ x ∈ U, ∃ (V : _) (ι : V ⟶ U), (∃ s, T.app _ s = t |_ₕ ι) ∧ x ∈ V :=
⟨fun h _ => h.imageSieve_mem, fun h => ⟨h _⟩⟩
set_option linter.uppercaseLean3 false in
#align Top.presheaf.is_locally_surjective_iff TopCat.Presheaf.isLocallySurjective_iff
section SurjectiveOnStalks
variable [Limits.HasColimits C] [Limits.PreservesFilteredColimits (forget C)]
| Mathlib/Topology/Sheaves/LocallySurjective.lean | 78 | 118 | theorem locally_surjective_iff_surjective_on_stalks (T : ℱ ⟶ 𝒢) :
IsLocallySurjective T ↔ ∀ x : X, Function.Surjective ((stalkFunctor C x).map T) := by |
constructor <;> intro hT
· /- human proof:
Let g ∈ Γₛₜ 𝒢 x be a germ. Represent it on an open set U ⊆ X
as ⟨t, U⟩. By local surjectivity, pass to a smaller open set V
on which there exists s ∈ Γ_ ℱ V mapping to t |_ V.
Then the germ of s maps to g -/
-- Let g ∈ Γₛₜ 𝒢 x be a germ.
intro x g
-- Represent it on an open set U ⊆ X as ⟨t, U⟩.
obtain ⟨U, hxU, t, rfl⟩ := 𝒢.germ_exist x g
-- By local surjectivity, pass to a smaller open set V
-- on which there exists s ∈ Γ_ ℱ V mapping to t |_ V.
rcases hT.imageSieve_mem t x hxU with ⟨V, ι, ⟨s, h_eq⟩, hxV⟩
-- Then the germ of s maps to g.
use ℱ.germ ⟨x, hxV⟩ s
-- Porting note: `convert` went too deep and swapped LHS and RHS of the remaining goal relative
-- to lean 3.
convert stalkFunctor_map_germ_apply V ⟨x, hxV⟩ T s using 1
simpa [h_eq] using (germ_res_apply 𝒢 ι ⟨x, hxV⟩ t).symm
· /- human proof:
Let U be an open set, t ∈ Γ ℱ U a section, x ∈ U a point.
By surjectivity on stalks, the germ of t is the image of
some germ f ∈ Γₛₜ ℱ x. Represent f on some open set V ⊆ X as ⟨s, V⟩.
Then there is some possibly smaller open set x ∈ W ⊆ V ∩ U on which
we have T(s) |_ W = t |_ W. -/
constructor
intro U t x hxU
set t_x := 𝒢.germ ⟨x, hxU⟩ t with ht_x
obtain ⟨s_x, hs_x : ((stalkFunctor C x).map T) s_x = t_x⟩ := hT x t_x
obtain ⟨V, hxV, s, rfl⟩ := ℱ.germ_exist x s_x
-- rfl : ℱ.germ x s = s_x
have key_W := 𝒢.germ_eq x hxV hxU (T.app _ s) t <| by
convert hs_x using 1
symm
convert stalkFunctor_map_germ_apply _ _ _ s
obtain ⟨W, hxW, hWV, hWU, h_eq⟩ := key_W
refine ⟨W, hWU, ⟨ℱ.map hWV.op s, ?_⟩, hxW⟩
convert h_eq using 1
simp only [← comp_apply, T.naturality]
| 39 | 86,593,400,423,993,740 | 2 | 2 | 1 | 2,242 |
import Mathlib.Data.List.Lattice
import Mathlib.Data.List.Range
import Mathlib.Data.Bool.Basic
#align_import data.list.intervals from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
open Nat
namespace List
def Ico (n m : ℕ) : List ℕ :=
range' n (m - n)
#align list.Ico List.Ico
namespace Ico
theorem zero_bot (n : ℕ) : Ico 0 n = range n := by rw [Ico, Nat.sub_zero, range_eq_range']
#align list.Ico.zero_bot List.Ico.zero_bot
@[simp]
theorem length (n m : ℕ) : length (Ico n m) = m - n := by
dsimp [Ico]
simp [length_range', autoParam]
#align list.Ico.length List.Ico.length
theorem pairwise_lt (n m : ℕ) : Pairwise (· < ·) (Ico n m) := by
dsimp [Ico]
simp [pairwise_lt_range', autoParam]
#align list.Ico.pairwise_lt List.Ico.pairwise_lt
theorem nodup (n m : ℕ) : Nodup (Ico n m) := by
dsimp [Ico]
simp [nodup_range', autoParam]
#align list.Ico.nodup List.Ico.nodup
@[simp]
theorem mem {n m l : ℕ} : l ∈ Ico n m ↔ n ≤ l ∧ l < m := by
suffices n ≤ l ∧ l < n + (m - n) ↔ n ≤ l ∧ l < m by simp [Ico, this]
rcases le_total n m with hnm | hmn
· rw [Nat.add_sub_cancel' hnm]
· rw [Nat.sub_eq_zero_iff_le.mpr hmn, Nat.add_zero]
exact
and_congr_right fun hnl =>
Iff.intro (fun hln => (not_le_of_gt hln hnl).elim) fun hlm => lt_of_lt_of_le hlm hmn
#align list.Ico.mem List.Ico.mem
theorem eq_nil_of_le {n m : ℕ} (h : m ≤ n) : Ico n m = [] := by
simp [Ico, Nat.sub_eq_zero_iff_le.mpr h]
#align list.Ico.eq_nil_of_le List.Ico.eq_nil_of_le
theorem map_add (n m k : ℕ) : (Ico n m).map (k + ·) = Ico (n + k) (m + k) := by
rw [Ico, Ico, map_add_range', Nat.add_sub_add_right m k, Nat.add_comm n k]
#align list.Ico.map_add List.Ico.map_add
theorem map_sub (n m k : ℕ) (h₁ : k ≤ n) :
((Ico n m).map fun x => x - k) = Ico (n - k) (m - k) := by
rw [Ico, Ico, Nat.sub_sub_sub_cancel_right h₁, map_sub_range' _ _ _ h₁]
#align list.Ico.map_sub List.Ico.map_sub
@[simp]
theorem self_empty {n : ℕ} : Ico n n = [] :=
eq_nil_of_le (le_refl n)
#align list.Ico.self_empty List.Ico.self_empty
@[simp]
theorem eq_empty_iff {n m : ℕ} : Ico n m = [] ↔ m ≤ n :=
Iff.intro (fun h => Nat.sub_eq_zero_iff_le.mp <| by rw [← length, h, List.length]) eq_nil_of_le
#align list.Ico.eq_empty_iff List.Ico.eq_empty_iff
| Mathlib/Data/List/Intervals.lean | 95 | 100 | theorem append_consecutive {n m l : ℕ} (hnm : n ≤ m) (hml : m ≤ l) :
Ico n m ++ Ico m l = Ico n l := by |
dsimp only [Ico]
convert range'_append n (m-n) (l-m) 1 using 2
· rw [Nat.one_mul, Nat.add_sub_cancel' hnm]
· rw [Nat.sub_add_sub_cancel hml hnm]
| 4 | 54.59815 | 2 | 0.9375 | 16 | 794 |
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset
import Mathlib.Data.Finite.Card
import Mathlib.GroupTheory.Finiteness
import Mathlib.GroupTheory.GroupAction.Quotient
#align_import group_theory.index from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
namespace Subgroup
open Cardinal
variable {G : Type*} [Group G] (H K L : Subgroup G)
@[to_additive "The index of a subgroup as a natural number,
and returns 0 if the index is infinite."]
noncomputable def index : ℕ :=
Nat.card (G ⧸ H)
#align subgroup.index Subgroup.index
#align add_subgroup.index AddSubgroup.index
@[to_additive "The relative index of a subgroup as a natural number,
and returns 0 if the relative index is infinite."]
noncomputable def relindex : ℕ :=
(H.subgroupOf K).index
#align subgroup.relindex Subgroup.relindex
#align add_subgroup.relindex AddSubgroup.relindex
@[to_additive]
| Mathlib/GroupTheory/Index.lean | 62 | 76 | theorem index_comap_of_surjective {G' : Type*} [Group G'] {f : G' →* G}
(hf : Function.Surjective f) : (H.comap f).index = H.index := by |
letI := QuotientGroup.leftRel H
letI := QuotientGroup.leftRel (H.comap f)
have key : ∀ x y : G', Setoid.r x y ↔ Setoid.r (f x) (f y) := by
simp only [QuotientGroup.leftRel_apply]
exact fun x y => iff_of_eq (congr_arg (· ∈ H) (by rw [f.map_mul, f.map_inv]))
refine Cardinal.toNat_congr (Equiv.ofBijective (Quotient.map' f fun x y => (key x y).mp) ⟨?_, ?_⟩)
· simp_rw [← Quotient.eq''] at key
refine Quotient.ind' fun x => ?_
refine Quotient.ind' fun y => ?_
exact (key x y).mpr
· refine Quotient.ind' fun x => ?_
obtain ⟨y, hy⟩ := hf x
exact ⟨y, (Quotient.map'_mk'' f _ y).trans (congr_arg Quotient.mk'' hy)⟩
| 13 | 442,413.392009 | 2 | 0.666667 | 6 | 611 |
import Mathlib.Algebra.Algebra.Subalgebra.Directed
import Mathlib.FieldTheory.IntermediateField
import Mathlib.FieldTheory.Separable
import Mathlib.FieldTheory.SplittingField.IsSplittingField
import Mathlib.RingTheory.TensorProduct.Basic
#align_import field_theory.adjoin from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87"
set_option autoImplicit true
open FiniteDimensional Polynomial
open scoped Classical Polynomial
namespace IntermediateField
section AdjoinDef
variable (F : Type*) [Field F] {E : Type*} [Field E] [Algebra F E] (S : Set E)
-- Porting note: not adding `neg_mem'` causes an error.
def adjoin : IntermediateField F E :=
{ Subfield.closure (Set.range (algebraMap F E) ∪ S) with
algebraMap_mem' := fun x => Subfield.subset_closure (Or.inl (Set.mem_range_self x)) }
#align intermediate_field.adjoin IntermediateField.adjoin
variable {S}
theorem mem_adjoin_iff (x : E) :
x ∈ adjoin F S ↔ ∃ r s : MvPolynomial S F,
x = MvPolynomial.aeval Subtype.val r / MvPolynomial.aeval Subtype.val s := by
simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring,
Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring,
Algebra.adjoin_eq_range, AlgHom.mem_range, exists_exists_eq_and]
tauto
| Mathlib/FieldTheory/Adjoin.lean | 62 | 67 | theorem mem_adjoin_simple_iff {α : E} (x : E) :
x ∈ adjoin F {α} ↔ ∃ r s : F[X], x = aeval α r / aeval α s := by |
simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring,
Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring,
Algebra.adjoin_singleton_eq_range_aeval, AlgHom.mem_range, exists_exists_eq_and]
tauto
| 4 | 54.59815 | 2 | 2 | 2 | 1,932 |
import Mathlib.Analysis.LocallyConvex.BalancedCoreHull
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
import Mathlib.Topology.Algebra.Module.Simple
import Mathlib.Topology.Algebra.Module.Determinant
import Mathlib.RingTheory.Ideal.LocalRing
#align_import topology.algebra.module.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057"
universe u v w x
noncomputable section
open Set FiniteDimensional TopologicalSpace Filter
section NormedField
variable {𝕜 : Type u} [hnorm : NontriviallyNormedField 𝕜] {E : Type v} [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E] {F : Type w} [AddCommGroup F]
[Module 𝕜 F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul 𝕜 F] {F' : Type x}
[AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F']
[ContinuousSMul 𝕜 F']
| Mathlib/Topology/Algebra/Module/FiniteDimension.lean | 77 | 127 | theorem unique_topology_of_t2 {t : TopologicalSpace 𝕜} (h₁ : @TopologicalAddGroup 𝕜 t _)
(h₂ : @ContinuousSMul 𝕜 𝕜 _ hnorm.toUniformSpace.toTopologicalSpace t) (h₃ : @T2Space 𝕜 t) :
t = hnorm.toUniformSpace.toTopologicalSpace := by |
-- Let `𝓣₀` denote the topology on `𝕜` induced by the norm, and `𝓣` be any T2 vector
-- topology on `𝕜`. To show that `𝓣₀ = 𝓣`, it suffices to show that they have the same
-- neighborhoods of 0.
refine TopologicalAddGroup.ext h₁ inferInstance (le_antisymm ?_ ?_)
· -- To show `𝓣 ≤ 𝓣₀`, we have to show that closed balls are `𝓣`-neighborhoods of 0.
rw [Metric.nhds_basis_closedBall.ge_iff]
-- Let `ε > 0`. Since `𝕜` is nontrivially normed, we have `0 < ‖ξ₀‖ < ε` for some `ξ₀ : 𝕜`.
intro ε hε
rcases NormedField.exists_norm_lt 𝕜 hε with ⟨ξ₀, hξ₀, hξ₀ε⟩
-- Since `ξ₀ ≠ 0` and `𝓣` is T2, we know that `{ξ₀}ᶜ` is a `𝓣`-neighborhood of 0.
-- Porting note: added `mem_compl_singleton_iff.mpr`
have : {ξ₀}ᶜ ∈ @nhds 𝕜 t 0 := IsOpen.mem_nhds isOpen_compl_singleton <|
mem_compl_singleton_iff.mpr <| Ne.symm <| norm_ne_zero_iff.mp hξ₀.ne.symm
-- Thus, its balanced core `𝓑` is too. Let's show that the closed ball of radius `ε` contains
-- `𝓑`, which will imply that the closed ball is indeed a `𝓣`-neighborhood of 0.
have : balancedCore 𝕜 {ξ₀}ᶜ ∈ @nhds 𝕜 t 0 := balancedCore_mem_nhds_zero this
refine mem_of_superset this fun ξ hξ => ?_
-- Let `ξ ∈ 𝓑`. We want to show `‖ξ‖ < ε`. If `ξ = 0`, this is trivial.
by_cases hξ0 : ξ = 0
· rw [hξ0]
exact Metric.mem_closedBall_self hε.le
· rw [mem_closedBall_zero_iff]
-- Now suppose `ξ ≠ 0`. By contradiction, let's assume `ε < ‖ξ‖`, and show that
-- `ξ₀ ∈ 𝓑 ⊆ {ξ₀}ᶜ`, which is a contradiction.
by_contra! h
suffices (ξ₀ * ξ⁻¹) • ξ ∈ balancedCore 𝕜 {ξ₀}ᶜ by
rw [smul_eq_mul 𝕜, mul_assoc, inv_mul_cancel hξ0, mul_one] at this
exact not_mem_compl_iff.mpr (mem_singleton ξ₀) ((balancedCore_subset _) this)
-- For that, we use that `𝓑` is balanced : since `‖ξ₀‖ < ε < ‖ξ‖`, we have `‖ξ₀ / ξ‖ ≤ 1`,
-- hence `ξ₀ = (ξ₀ / ξ) • ξ ∈ 𝓑` because `ξ ∈ 𝓑`.
refine (balancedCore_balanced _).smul_mem ?_ hξ
rw [norm_mul, norm_inv, mul_inv_le_iff (norm_pos_iff.mpr hξ0), mul_one]
exact (hξ₀ε.trans h).le
· -- Finally, to show `𝓣₀ ≤ 𝓣`, we simply argue that `id = (fun x ↦ x • 1)` is continuous from
-- `(𝕜, 𝓣₀)` to `(𝕜, 𝓣)` because `(•) : (𝕜, 𝓣₀) × (𝕜, 𝓣) → (𝕜, 𝓣)` is continuous.
calc
@nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0 =
map id (@nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0) :=
map_id.symm
_ = map (fun x => id x • (1 : 𝕜)) (@nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0) := by
conv_rhs =>
congr
ext
rw [smul_eq_mul, mul_one]
_ ≤ @nhds 𝕜 t ((0 : 𝕜) • (1 : 𝕜)) :=
(@Tendsto.smul_const _ _ _ hnorm.toUniformSpace.toTopologicalSpace t _ _ _ _ _
tendsto_id (1 : 𝕜))
_ = @nhds 𝕜 t 0 := by rw [zero_smul]
| 48 | 701,673,591,209,763,100,000 | 2 | 2 | 2 | 2,137 |
import Mathlib.Algebra.MonoidAlgebra.Support
import Mathlib.Algebra.Polynomial.Basic
import Mathlib.Algebra.Regular.Basic
import Mathlib.Data.Nat.Choose.Sum
#align_import data.polynomial.coeff from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c"
set_option linter.uppercaseLean3 false
noncomputable section
open Finsupp Finset AddMonoidAlgebra
open Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ}
variable [Semiring R] {p q r : R[X]}
section Coeff
@[simp]
theorem coeff_add (p q : R[X]) (n : ℕ) : coeff (p + q) n = coeff p n + coeff q n := by
rcases p with ⟨⟩
rcases q with ⟨⟩
simp_rw [← ofFinsupp_add, coeff]
exact Finsupp.add_apply _ _ _
#align polynomial.coeff_add Polynomial.coeff_add
set_option linter.deprecated false in
@[simp]
theorem coeff_bit0 (p : R[X]) (n : ℕ) : coeff (bit0 p) n = bit0 (coeff p n) := by simp [bit0]
#align polynomial.coeff_bit0 Polynomial.coeff_bit0
@[simp]
theorem coeff_smul [SMulZeroClass S R] (r : S) (p : R[X]) (n : ℕ) :
coeff (r • p) n = r • coeff p n := by
rcases p with ⟨⟩
simp_rw [← ofFinsupp_smul, coeff]
exact Finsupp.smul_apply _ _ _
#align polynomial.coeff_smul Polynomial.coeff_smul
| Mathlib/Algebra/Polynomial/Coeff.lean | 60 | 65 | theorem support_smul [SMulZeroClass S R] (r : S) (p : R[X]) :
support (r • p) ⊆ support p := by |
intro i hi
simp? [mem_support_iff] at hi ⊢ says simp only [mem_support_iff, coeff_smul, ne_eq] at hi ⊢
contrapose! hi
simp [hi]
| 4 | 54.59815 | 2 | 1.125 | 8 | 1,203 |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Polynomial.RingDivision
#align_import data.polynomial.mirror from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
namespace Polynomial
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] (p q : R[X])
noncomputable def mirror :=
p.reverse * X ^ p.natTrailingDegree
#align polynomial.mirror Polynomial.mirror
@[simp]
theorem mirror_zero : (0 : R[X]).mirror = 0 := by simp [mirror]
#align polynomial.mirror_zero Polynomial.mirror_zero
theorem mirror_monomial (n : ℕ) (a : R) : (monomial n a).mirror = monomial n a := by
classical
by_cases ha : a = 0
· rw [ha, monomial_zero_right, mirror_zero]
· rw [mirror, reverse, natDegree_monomial n a, if_neg ha, natTrailingDegree_monomial ha, ←
C_mul_X_pow_eq_monomial, reflect_C_mul_X_pow, revAt_le (le_refl n), tsub_self, pow_zero,
mul_one]
#align polynomial.mirror_monomial Polynomial.mirror_monomial
theorem mirror_C (a : R) : (C a).mirror = C a :=
mirror_monomial 0 a
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_C Polynomial.mirror_C
theorem mirror_X : X.mirror = (X : R[X]) :=
mirror_monomial 1 (1 : R)
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_X Polynomial.mirror_X
| Mathlib/Algebra/Polynomial/Mirror.lean | 66 | 72 | theorem mirror_natDegree : p.mirror.natDegree = p.natDegree := by |
by_cases hp : p = 0
· rw [hp, mirror_zero]
nontriviality R
rw [mirror, natDegree_mul', reverse_natDegree, natDegree_X_pow,
tsub_add_cancel_of_le p.natTrailingDegree_le_natDegree]
rwa [leadingCoeff_X_pow, mul_one, reverse_leadingCoeff, Ne, trailingCoeff_eq_zero]
| 6 | 403.428793 | 2 | 1.571429 | 7 | 1,704 |
import Mathlib.MeasureTheory.SetSemiring
open MeasurableSpace Set
namespace MeasureTheory
variable {α : Type*} {𝒜 : Set (Set α)} {s t : Set α}
structure IsSetAlgebra (𝒜 : Set (Set α)) : Prop where
empty_mem : ∅ ∈ 𝒜
compl_mem : ∀ ⦃s⦄, s ∈ 𝒜 → sᶜ ∈ 𝒜
union_mem : ∀ ⦃s t⦄, s ∈ 𝒜 → t ∈ 𝒜 → s ∪ t ∈ 𝒜
section generateSetAlgebra
inductive generateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set (Set α)
| base (s : Set α) (s_mem : s ∈ 𝒜) : generateSetAlgebra 𝒜 s
| empty : generateSetAlgebra 𝒜 ∅
| compl (s : Set α) (hs : generateSetAlgebra 𝒜 s) : generateSetAlgebra 𝒜 sᶜ
| union (s t : Set α) (hs : generateSetAlgebra 𝒜 s) (ht : generateSetAlgebra 𝒜 t) :
generateSetAlgebra 𝒜 (s ∪ t)
theorem isSetAlgebra_generateSetAlgebra :
IsSetAlgebra (generateSetAlgebra 𝒜) where
empty_mem := generateSetAlgebra.empty
compl_mem := fun _ hs ↦ generateSetAlgebra.compl _ hs
union_mem := fun _ _ hs ht ↦ generateSetAlgebra.union _ _ hs ht
theorem self_subset_generateSetAlgebra : 𝒜 ⊆ generateSetAlgebra 𝒜 :=
fun _ ↦ generateSetAlgebra.base _
@[simp]
| Mathlib/MeasureTheory/SetAlgebra.lean | 122 | 134 | theorem generateFrom_generateSetAlgebra_eq :
generateFrom (generateSetAlgebra 𝒜) = generateFrom 𝒜 := by |
refine le_antisymm (fun s ms ↦ ?_) (generateFrom_mono self_subset_generateSetAlgebra)
refine @generateFrom_induction _ _ (generateSetAlgebra 𝒜) (fun t ht ↦ ?_)
(@MeasurableSet.empty _ (generateFrom 𝒜))
(fun t ↦ MeasurableSet.compl)
(fun f hf ↦ MeasurableSet.iUnion hf)
s ms
induction ht with
| base u u_mem => exact measurableSet_generateFrom u_mem
| empty => exact @MeasurableSet.empty _ (generateFrom 𝒜)
| compl u _ mu => exact mu.compl
| union u v _ _ mu mv => exact MeasurableSet.union mu mv
| 11 | 59,874.141715 | 2 | 2 | 4 | 1,933 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.Multiset.Pi
#align_import data.finset.pi from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9"
namespace Finset
open Multiset
section Pi
variable {α : Type*}
def Pi.empty (β : α → Sort*) (a : α) (h : a ∈ (∅ : Finset α)) : β a :=
Multiset.Pi.empty β a h
#align finset.pi.empty Finset.Pi.empty
universe u v
variable {β : α → Type u} {δ : α → Sort v} [DecidableEq α] {s : Finset α} {t : ∀ a, Finset (β a)}
def pi (s : Finset α) (t : ∀ a, Finset (β a)) : Finset (∀ a ∈ s, β a) :=
⟨s.1.pi fun a => (t a).1, s.nodup.pi fun a _ => (t a).nodup⟩
#align finset.pi Finset.pi
@[simp]
theorem pi_val (s : Finset α) (t : ∀ a, Finset (β a)) : (s.pi t).1 = s.1.pi fun a => (t a).1 :=
rfl
#align finset.pi_val Finset.pi_val
@[simp]
theorem mem_pi {s : Finset α} {t : ∀ a, Finset (β a)} {f : ∀ a ∈ s, β a} :
f ∈ s.pi t ↔ ∀ (a) (h : a ∈ s), f a h ∈ t a :=
Multiset.mem_pi _ _ _
#align finset.mem_pi Finset.mem_pi
def Pi.cons (s : Finset α) (a : α) (b : δ a) (f : ∀ a, a ∈ s → δ a) (a' : α) (h : a' ∈ insert a s) :
δ a' :=
Multiset.Pi.cons s.1 a b f _ (Multiset.mem_cons.2 <| mem_insert.symm.2 h)
#align finset.pi.cons Finset.Pi.cons
@[simp]
theorem Pi.cons_same (s : Finset α) (a : α) (b : δ a) (f : ∀ a, a ∈ s → δ a) (h : a ∈ insert a s) :
Pi.cons s a b f a h = b :=
Multiset.Pi.cons_same _
#align finset.pi.cons_same Finset.Pi.cons_same
theorem Pi.cons_ne {s : Finset α} {a a' : α} {b : δ a} {f : ∀ a, a ∈ s → δ a} {h : a' ∈ insert a s}
(ha : a ≠ a') : Pi.cons s a b f a' h = f a' ((mem_insert.1 h).resolve_left ha.symm) :=
Multiset.Pi.cons_ne _ (Ne.symm ha)
#align finset.pi.cons_ne Finset.Pi.cons_ne
theorem Pi.cons_injective {a : α} {b : δ a} {s : Finset α} (hs : a ∉ s) :
Function.Injective (Pi.cons s a b) := fun e₁ e₂ eq =>
@Multiset.Pi.cons_injective α _ δ a b s.1 hs _ _ <|
funext fun e =>
funext fun h =>
have :
Pi.cons s a b e₁ e (by simpa only [Multiset.mem_cons, mem_insert] using h) =
Pi.cons s a b e₂ e (by simpa only [Multiset.mem_cons, mem_insert] using h) := by
rw [eq]
this
#align finset.pi.cons_injective Finset.Pi.cons_injective
@[simp]
theorem pi_empty {t : ∀ a : α, Finset (β a)} : pi (∅ : Finset α) t = singleton (Pi.empty β) :=
rfl
#align finset.pi_empty Finset.pi_empty
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
lemma pi_nonempty : (s.pi t).Nonempty ↔ ∀ a ∈ s, (t a).Nonempty := by
simp [Finset.Nonempty, Classical.skolem]
@[simp]
| Mathlib/Data/Finset/Pi.lean | 96 | 112 | theorem pi_insert [∀ a, DecidableEq (β a)] {s : Finset α} {t : ∀ a : α, Finset (β a)} {a : α}
(ha : a ∉ s) : pi (insert a s) t = (t a).biUnion fun b => (pi s t).image (Pi.cons s a b) := by |
apply eq_of_veq
rw [← (pi (insert a s) t).2.dedup]
refine
(fun s' (h : s' = a ::ₘ s.1) =>
(?_ :
dedup (Multiset.pi s' fun a => (t a).1) =
dedup
((t a).1.bind fun b =>
dedup <|
(Multiset.pi s.1 fun a : α => (t a).val).map fun f a' h' =>
Multiset.Pi.cons s.1 a b f a' (h ▸ h'))))
_ (insert_val_of_not_mem ha)
subst s'; rw [pi_cons]
congr; funext b
exact ((pi s t).nodup.map <| Multiset.Pi.cons_injective ha).dedup.symm
| 15 | 3,269,017.372472 | 2 | 1.666667 | 3 | 1,804 |
import Mathlib.SetTheory.Ordinal.Arithmetic
namespace OrdinalApprox
universe u
variable {α : Type u}
variable [CompleteLattice α] (f : α →o α) (x : α)
open Function fixedPoints Cardinal Order OrderHom
set_option linter.unusedVariables false in
def lfpApprox (a : Ordinal.{u}) : α :=
sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } ∪ {x})
termination_by a
decreasing_by exact h
theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by
unfold Monotone; intros a b h; unfold lfpApprox
refine sSup_le_sSup ?h
apply sup_le_sup_right
simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intros a' h'
use a'
exact ⟨lt_of_lt_of_le h' h, rfl⟩
theorem le_lfpApprox {a : Ordinal} : x ≤ lfpApprox f x a := by
unfold lfpApprox
apply le_sSup
simp only [exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq, true_or]
| Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean | 92 | 112 | theorem lfpApprox_add_one (h : x ≤ f x) (a : Ordinal) :
lfpApprox f x (a+1) = f (lfpApprox f x a) := by |
apply le_antisymm
· conv => left; unfold lfpApprox
apply sSup_le
simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop, Set.union_singleton,
Set.mem_insert_iff, Set.mem_setOf_eq, forall_eq_or_imp, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
apply And.intro
· apply le_trans h
apply Monotone.imp f.monotone
exact le_lfpApprox f x
· intros a' h
apply f.2; apply lfpApprox_monotone; exact h
· conv => right; unfold lfpApprox
apply le_sSup
simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop]
rw [Set.mem_union]
apply Or.inl
simp only [Set.mem_setOf_eq]
use a
| 19 | 178,482,300.963187 | 2 | 1.8 | 5 | 1,896 |
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.QuotientNilpotent
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.RingTheory.FinitePresentation
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Localization.Away.AdjoinRoot
#align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166"
-- Porting note: added to make the syntax work below.
open scoped TensorProduct
universe u
namespace Algebra
section
variable (R : Type u) [CommSemiring R]
variable (A : Type u) [Semiring A] [Algebra R A]
@[mk_iff]
class FormallySmooth : Prop where
comp_surjective :
∀ ⦃B : Type u⦄ [CommRing B],
∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥),
Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
#align algebra.formally_smooth Algebra.FormallySmooth
end
namespace FormallySmooth
section
variable {R : Type u} [CommSemiring R]
variable {A : Type u} [Semiring A] [Algebra R A]
variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
theorem exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
[FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) :
∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by
revert g
change Function.Surjective (Ideal.Quotient.mkₐ R I).comp
revert _RB
apply Ideal.IsNilpotent.induction_on (R := B) I hI
· intro B _ I hI _; exact FormallySmooth.comp_surjective I hI
· intro B _ I J hIJ h₁ h₂ _ g
let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J :=
{
(DoubleQuot.quotQuotEquivQuotSup I J).trans
(Ideal.quotEquivOfEq (sup_eq_right.mpr hIJ)) with
commutes' := fun x => rfl }
obtain ⟨g', e⟩ := h₂ (this.symm.toAlgHom.comp g)
obtain ⟨g', rfl⟩ := h₁ g'
replace e := congr_arg this.toAlgHom.comp e
conv_rhs at e =>
rw [← AlgHom.comp_assoc, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.toAlgHom_eq_coe,
AlgEquiv.comp_symm, AlgHom.id_comp]
exact ⟨g', e⟩
#align algebra.formally_smooth.exists_lift Algebra.FormallySmooth.exists_lift
noncomputable def lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) : A →ₐ[R] B :=
(FormallySmooth.exists_lift I hI g).choose
#align algebra.formally_smooth.lift Algebra.FormallySmooth.lift
@[simp]
theorem comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) : (Ideal.Quotient.mkₐ R I).comp (FormallySmooth.lift I hI g) = g :=
(FormallySmooth.exists_lift I hI g).choose_spec
#align algebra.formally_smooth.comp_lift Algebra.FormallySmooth.comp_lift
@[simp]
theorem mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) (x : A) : Ideal.Quotient.mk I (FormallySmooth.lift I hI g x) = g x :=
AlgHom.congr_fun (FormallySmooth.comp_lift I hI g : _) x
#align algebra.formally_smooth.mk_lift Algebra.FormallySmooth.mk_lift
variable {C : Type u} [CommRing C] [Algebra R C]
noncomputable def liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C)
(g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) :
A →ₐ[R] B :=
FormallySmooth.lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)
#align algebra.formally_smooth.lift_of_surjective Algebra.FormallySmooth.liftOfSurjective
@[simp]
| Mathlib/RingTheory/Smooth/Basic.lean | 121 | 131 | theorem liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
(hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) (x : A) :
g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by |
apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective
change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [← FormallySmooth.mk_lift _ hg'
((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective
simp only [liftOfSurjective, AlgEquiv.apply_symm_apply, AlgEquiv.toAlgHom_eq_coe,
Ideal.quotientKerAlgEquivOfSurjective_apply, RingHom.kerLift_mk, RingHom.coe_coe]
| 8 | 2,980.957987 | 2 | 2 | 4 | 2,341 |
import Mathlib.MeasureTheory.Covering.DensityTheorem
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
#align_import measure_theory.covering.one_dim from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open Set MeasureTheory IsUnifLocDoublingMeasure Filter
open scoped Topology
namespace Real
theorem Icc_mem_vitaliFamily_at_right {x y : ℝ} (hxy : x < y) :
Icc x y ∈ (vitaliFamily (volume : Measure ℝ) 1).setsAt x := by
rw [Icc_eq_closedBall]
refine closedBall_mem_vitaliFamily_of_dist_le_mul _ ?_ (by linarith)
rw [dist_comm, Real.dist_eq, abs_of_nonneg] <;> linarith
#align real.Icc_mem_vitali_family_at_right Real.Icc_mem_vitaliFamily_at_right
theorem tendsto_Icc_vitaliFamily_right (x : ℝ) :
Tendsto (fun y => Icc x y) (𝓝[>] x) ((vitaliFamily (volume : Measure ℝ) 1).filterAt x) := by
refine (VitaliFamily.tendsto_filterAt_iff _).2 ⟨?_, ?_⟩
· filter_upwards [self_mem_nhdsWithin] with y hy using Icc_mem_vitaliFamily_at_right hy
· intro ε εpos
have : x ∈ Ico x (x + ε) := ⟨le_refl _, by linarith⟩
filter_upwards [Icc_mem_nhdsWithin_Ioi this] with y hy
rw [closedBall_eq_Icc]
exact Icc_subset_Icc (by linarith) hy.2
#align real.tendsto_Icc_vitali_family_right Real.tendsto_Icc_vitaliFamily_right
theorem Icc_mem_vitaliFamily_at_left {x y : ℝ} (hxy : x < y) :
Icc x y ∈ (vitaliFamily (volume : Measure ℝ) 1).setsAt y := by
rw [Icc_eq_closedBall]
refine closedBall_mem_vitaliFamily_of_dist_le_mul _ ?_ (by linarith)
rw [Real.dist_eq, abs_of_nonneg] <;> linarith
#align real.Icc_mem_vitali_family_at_left Real.Icc_mem_vitaliFamily_at_left
| Mathlib/MeasureTheory/Covering/OneDim.lean | 51 | 59 | theorem tendsto_Icc_vitaliFamily_left (x : ℝ) :
Tendsto (fun y => Icc y x) (𝓝[<] x) ((vitaliFamily (volume : Measure ℝ) 1).filterAt x) := by |
refine (VitaliFamily.tendsto_filterAt_iff _).2 ⟨?_, ?_⟩
· filter_upwards [self_mem_nhdsWithin] with y hy using Icc_mem_vitaliFamily_at_left hy
· intro ε εpos
have : x ∈ Ioc (x - ε) x := ⟨by linarith, le_refl _⟩
filter_upwards [Icc_mem_nhdsWithin_Iio this] with y hy
rw [closedBall_eq_Icc]
exact Icc_subset_Icc hy.1 (by linarith)
| 7 | 1,096.633158 | 2 | 1.5 | 4 | 1,590 |
import Mathlib.Geometry.Manifold.MFDeriv.Atlas
noncomputable section
open scoped Manifold
open Set
section UniqueMDiff
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M'] {s : Set M} {x : M}
theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x)
{f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f')
(hd : DenseRange f') : UniqueMDiffWithinAt I' (f '' s) (f x) := by
have := hs.inter' <| hf.1 (extChartAt_source_mem_nhds I' (f x))
refine (((hf.2.mono ?sub1).uniqueDiffWithinAt this hd).mono ?sub2).congr_pt ?pt
case pt => simp only [mfld_simps]
case sub1 => mfld_set_tac
case sub2 =>
rintro _ ⟨y, ⟨⟨hys, hfy⟩, -⟩, rfl⟩
exact ⟨⟨_, hys, ((extChartAt I' (f x)).left_inv hfy).symm⟩, mem_range_self _⟩
theorem UniqueMDiffOn.image_denseRange' (hs : UniqueMDiffOn I s) {f : M → M'}
{f' : M → E →L[𝕜] E'} (hf : ∀ x ∈ s, HasMFDerivWithinAt I I' f s x (f' x))
(hd : ∀ x ∈ s, DenseRange (f' x)) :
UniqueMDiffOn I' (f '' s) :=
forall_mem_image.2 fun x hx ↦ (hs x hx).image_denseRange (hf x hx) (hd x hx)
theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'}
(hf : MDifferentiableOn I I' f s) (hd : ∀ x ∈ s, DenseRange (mfderivWithin I I' f s x)) :
UniqueMDiffOn I' (f '' s) :=
hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd
protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph (hs : UniqueMDiffWithinAt I s x)
{e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) :
UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by
rw [← e.image_source_inter_eq', inter_comm]
exact (hs.inter (e.open_source.mem_nhds hx)).image_denseRange
(he.mdifferentiableAt hx).hasMFDerivAt.hasMFDerivWithinAt
(he.mfderiv_surjective hx).denseRange
theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'}
(he : e.MDifferentiable I I') : UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) := fun _x hx ↦
e.right_inv hx.1 ▸ (hs _ hx.2).preimage_partialHomeomorph he (e.map_target hx.1)
#align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage
theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M) :
UniqueDiffOn 𝕜 ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) := by
-- this is just a reformulation of `UniqueMDiffOn.uniqueMDiffOn_preimage`, using as `e`
-- the local chart at `x`.
apply UniqueMDiffOn.uniqueDiffOn
rw [← PartialEquiv.image_source_inter_eq', inter_comm, extChartAt_source]
exact (hs.inter (chartAt H x).open_source).image_denseRange'
(fun y hy ↦ hasMFDerivWithinAt_extChartAt I hy.2)
fun y hy ↦ ((mdifferentiable_chart _ _).mfderiv_surjective hy.2).denseRange
#align unique_mdiff_on.unique_diff_on_target_inter UniqueMDiffOn.uniqueDiffOn_target_inter
| Mathlib/Geometry/Manifold/MFDeriv/UniqueDifferential.lean | 98 | 107 | theorem UniqueMDiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMDiffOn I s) (x : M) (y : M')
{f : M → M'} (hf : ContinuousOn f s) :
UniqueDiffOn 𝕜
((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' y).source)) :=
haveI : UniqueMDiffOn I (s ∩ f ⁻¹' (extChartAt I' y).source) := by |
intro z hz
apply (hs z hz.1).inter'
apply (hf z hz.1).preimage_mem_nhdsWithin
exact (isOpen_extChartAt_source I' y).mem_nhds hz.2
this.uniqueDiffOn_target_inter _
| 5 | 148.413159 | 2 | 2 | 4 | 2,009 |
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section ENNReal
variable (μ) {f g : α → ℝ≥0∞}
noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.laverage MeasureTheory.laverage
notation3 "⨍⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => laverage μ r
notation3 "⨍⁻ "(...)", "r:60:(scoped f => laverage volume f) => r
notation3 "⨍⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => laverage (Measure.restrict μ s) r
notation3 (prettyPrint := false)
"⨍⁻ "(...)" in "s", "r:60:(scoped f => laverage Measure.restrict volume s f) => r
@[simp]
theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by rw [laverage, lintegral_zero]
#align measure_theory.laverage_zero MeasureTheory.laverage_zero
@[simp]
theorem laverage_zero_measure (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂(0 : Measure α) = 0 := by simp [laverage]
#align measure_theory.laverage_zero_measure MeasureTheory.laverage_zero_measure
theorem laverage_eq' (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂(μ univ)⁻¹ • μ := rfl
#align measure_theory.laverage_eq' MeasureTheory.laverage_eq'
theorem laverage_eq (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = (∫⁻ x, f x ∂μ) / μ univ := by
rw [laverage_eq', lintegral_smul_measure, ENNReal.div_eq_inv_mul]
#align measure_theory.laverage_eq MeasureTheory.laverage_eq
theorem laverage_eq_lintegral [IsProbabilityMeasure μ] (f : α → ℝ≥0∞) :
⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by rw [laverage, measure_univ, inv_one, one_smul]
#align measure_theory.laverage_eq_lintegral MeasureTheory.laverage_eq_lintegral
@[simp]
theorem measure_mul_laverage [IsFiniteMeasure μ] (f : α → ℝ≥0∞) :
μ univ * ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, lintegral_zero_measure, laverage_zero_measure, mul_zero]
· rw [laverage_eq, ENNReal.mul_div_cancel' (measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)]
#align measure_theory.measure_mul_laverage MeasureTheory.measure_mul_laverage
theorem setLaverage_eq (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = (∫⁻ x in s, f x ∂μ) / μ s := by rw [laverage_eq, restrict_apply_univ]
#align measure_theory.set_laverage_eq MeasureTheory.setLaverage_eq
theorem setLaverage_eq' (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = ∫⁻ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [laverage_eq', restrict_apply_univ]
#align measure_theory.set_laverage_eq' MeasureTheory.setLaverage_eq'
variable {μ}
theorem laverage_congr {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : ⨍⁻ x, f x ∂μ = ⨍⁻ x, g x ∂μ := by
simp only [laverage_eq, lintegral_congr_ae h]
#align measure_theory.laverage_congr MeasureTheory.laverage_congr
theorem setLaverage_congr (h : s =ᵐ[μ] t) : ⨍⁻ x in s, f x ∂μ = ⨍⁻ x in t, f x ∂μ := by
simp only [setLaverage_eq, set_lintegral_congr h, measure_congr h]
#align measure_theory.set_laverage_congr MeasureTheory.setLaverage_congr
theorem setLaverage_congr_fun (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) :
⨍⁻ x in s, f x ∂μ = ⨍⁻ x in s, g x ∂μ := by
simp only [laverage_eq, set_lintegral_congr_fun hs h]
#align measure_theory.set_laverage_congr_fun MeasureTheory.setLaverage_congr_fun
| Mathlib/MeasureTheory/Integral/Average.lean | 158 | 162 | theorem laverage_lt_top (hf : ∫⁻ x, f x ∂μ ≠ ∞) : ⨍⁻ x, f x ∂μ < ∞ := by |
obtain rfl | hμ := eq_or_ne μ 0
· simp
· rw [laverage_eq]
exact div_lt_top hf (measure_univ_ne_zero.2 hμ)
| 4 | 54.59815 | 2 | 0.347826 | 23 | 374 |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
#align gronwall_bound_x0 gronwallBound_x0
theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one]
· simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero]
#align gronwall_bound_ε0 gronwallBound_ε0
theorem gronwallBound_ε0_δ0 (K x : ℝ) : gronwallBound 0 K 0 x = 0 := by
simp only [gronwallBound_ε0, zero_mul]
#align gronwall_bound_ε0_δ0 gronwallBound_ε0_δ0
theorem gronwallBound_continuous_ε (δ K x : ℝ) : Continuous fun ε => gronwallBound δ K ε x := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK]
exact continuous_const.add (continuous_id.mul continuous_const)
· simp only [gronwallBound_of_K_ne_0 hK]
exact continuous_const.add ((continuous_id.mul continuous_const).mul continuous_const)
#align gronwall_bound_continuous_ε gronwallBound_continuous_ε
| Mathlib/Analysis/ODE/Gronwall.lean | 113 | 132 | theorem le_gronwallBound_of_liminf_deriv_right_le {f f' : ℝ → ℝ} {δ K ε : ℝ} {a b : ℝ}
(hf : ContinuousOn f (Icc a b))
(hf' : ∀ x ∈ Ico a b, ∀ r, f' x < r → ∃ᶠ z in 𝓝[>] x, (z - x)⁻¹ * (f z - f x) < r)
(ha : f a ≤ δ) (bound : ∀ x ∈ Ico a b, f' x ≤ K * f x + ε) :
∀ x ∈ Icc a b, f x ≤ gronwallBound δ K ε (x - a) := by |
have H : ∀ x ∈ Icc a b, ∀ ε' ∈ Ioi ε, f x ≤ gronwallBound δ K ε' (x - a) := by
intro x hx ε' hε'
apply image_le_of_liminf_slope_right_lt_deriv_boundary hf hf'
· rwa [sub_self, gronwallBound_x0]
· exact fun x => hasDerivAt_gronwallBound_shift δ K ε' x a
· intro x hx hfB
rw [← hfB]
apply lt_of_le_of_lt (bound x hx)
exact add_lt_add_left (mem_Ioi.1 hε') _
· exact hx
intro x hx
change f x ≤ (fun ε' => gronwallBound δ K ε' (x - a)) ε
convert continuousWithinAt_const.closure_le _ _ (H x hx)
· simp only [closure_Ioi, left_mem_Ici]
exact (gronwallBound_continuous_ε δ K (x - a)).continuousWithinAt
| 15 | 3,269,017.372472 | 2 | 1.428571 | 7 | 1,514 |
import Mathlib.MeasureTheory.Integral.FundThmCalculus
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
import Mathlib.Analysis.SpecialFunctions.NonIntegrable
import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
#align_import analysis.special_functions.integrals from "leanprover-community/mathlib"@"011cafb4a5bc695875d186e245d6b3df03bf6c40"
open Real Nat Set Finset
open scoped Real Interval
variable {a b : ℝ} (n : ℕ)
namespace intervalIntegral
open MeasureTheory
variable {f : ℝ → ℝ} {μ ν : Measure ℝ} [IsLocallyFiniteMeasure μ] (c d : ℝ)
@[simp]
theorem intervalIntegrable_pow : IntervalIntegrable (fun x => x ^ n) μ a b :=
(continuous_pow n).intervalIntegrable a b
#align interval_integral.interval_integrable_pow intervalIntegral.intervalIntegrable_pow
theorem intervalIntegrable_zpow {n : ℤ} (h : 0 ≤ n ∨ (0 : ℝ) ∉ [[a, b]]) :
IntervalIntegrable (fun x => x ^ n) μ a b :=
(continuousOn_id.zpow₀ n fun _ hx => h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable
#align interval_integral.interval_integrable_zpow intervalIntegral.intervalIntegrable_zpow
theorem intervalIntegrable_rpow {r : ℝ} (h : 0 ≤ r ∨ (0 : ℝ) ∉ [[a, b]]) :
IntervalIntegrable (fun x => x ^ r) μ a b :=
(continuousOn_id.rpow_const fun _ hx =>
h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable
#align interval_integral.interval_integrable_rpow intervalIntegral.intervalIntegrable_rpow
theorem intervalIntegrable_rpow' {r : ℝ} (h : -1 < r) :
IntervalIntegrable (fun x => x ^ r) volume a b := by
suffices ∀ c : ℝ, IntervalIntegrable (fun x => x ^ r) volume 0 c by
exact IntervalIntegrable.trans (this a).symm (this b)
have : ∀ c : ℝ, 0 ≤ c → IntervalIntegrable (fun x => x ^ r) volume 0 c := by
intro c hc
rw [intervalIntegrable_iff, uIoc_of_le hc]
have hderiv : ∀ x ∈ Ioo 0 c, HasDerivAt (fun x : ℝ => x ^ (r + 1) / (r + 1)) (x ^ r) x := by
intro x hx
convert (Real.hasDerivAt_rpow_const (p := r + 1) (Or.inl hx.1.ne')).div_const (r + 1) using 1
field_simp [(by linarith : r + 1 ≠ 0)]
apply integrableOn_deriv_of_nonneg _ hderiv
· intro x hx; apply rpow_nonneg hx.1.le
· refine (continuousOn_id.rpow_const ?_).div_const _; intro x _; right; linarith
intro c; rcases le_total 0 c with (hc | hc)
· exact this c hc
· rw [IntervalIntegrable.iff_comp_neg, neg_zero]
have m := (this (-c) (by linarith)).smul (cos (r * π))
rw [intervalIntegrable_iff] at m ⊢
refine m.congr_fun ?_ measurableSet_Ioc; intro x hx
rw [uIoc_of_le (by linarith : 0 ≤ -c)] at hx
simp only [Pi.smul_apply, Algebra.id.smul_eq_mul, log_neg_eq_log, mul_comm,
rpow_def_of_pos hx.1, rpow_def_of_neg (by linarith [hx.1] : -x < 0)]
#align interval_integral.interval_integrable_rpow' intervalIntegral.intervalIntegrable_rpow'
lemma integrableOn_Ioo_rpow_iff {s t : ℝ} (ht : 0 < t) :
IntegrableOn (fun x ↦ x ^ s) (Ioo (0 : ℝ) t) ↔ -1 < s := by
refine ⟨fun h ↦ ?_, fun h ↦ by simpa [intervalIntegrable_iff_integrableOn_Ioo_of_le ht.le]
using intervalIntegrable_rpow' h (a := 0) (b := t)⟩
contrapose! h
intro H
have I : 0 < min 1 t := lt_min zero_lt_one ht
have H' : IntegrableOn (fun x ↦ x ^ s) (Ioo 0 (min 1 t)) :=
H.mono (Set.Ioo_subset_Ioo le_rfl (min_le_right _ _)) le_rfl
have : IntegrableOn (fun x ↦ x⁻¹) (Ioo 0 (min 1 t)) := by
apply H'.mono' measurable_inv.aestronglyMeasurable
filter_upwards [ae_restrict_mem measurableSet_Ioo] with x hx
simp only [norm_inv, Real.norm_eq_abs, abs_of_nonneg (le_of_lt hx.1)]
rwa [← Real.rpow_neg_one x, Real.rpow_le_rpow_left_iff_of_base_lt_one hx.1]
exact lt_of_lt_of_le hx.2 (min_le_left _ _)
have : IntervalIntegrable (fun x ↦ x⁻¹) volume 0 (min 1 t) := by
rwa [intervalIntegrable_iff_integrableOn_Ioo_of_le I.le]
simp [intervalIntegrable_inv_iff, I.ne] at this
| Mathlib/Analysis/SpecialFunctions/Integrals.lean | 120 | 164 | theorem intervalIntegrable_cpow {r : ℂ} (h : 0 ≤ r.re ∨ (0 : ℝ) ∉ [[a, b]]) :
IntervalIntegrable (fun x : ℝ => (x : ℂ) ^ r) μ a b := by |
by_cases h2 : (0 : ℝ) ∉ [[a, b]]
· -- Easy case #1: 0 ∉ [a, b] -- use continuity.
refine (ContinuousAt.continuousOn fun x hx => ?_).intervalIntegrable
exact Complex.continuousAt_ofReal_cpow_const _ _ (Or.inr <| ne_of_mem_of_not_mem hx h2)
rw [eq_false h2, or_false_iff] at h
rcases lt_or_eq_of_le h with (h' | h')
· -- Easy case #2: 0 < re r -- again use continuity
exact (Complex.continuous_ofReal_cpow_const h').intervalIntegrable _ _
-- Now the hard case: re r = 0 and 0 is in the interval.
refine (IntervalIntegrable.intervalIntegrable_norm_iff ?_).mp ?_
· refine (measurable_of_continuousOn_compl_singleton (0 : ℝ) ?_).aestronglyMeasurable
exact ContinuousAt.continuousOn fun x hx =>
Complex.continuousAt_ofReal_cpow_const x r (Or.inr hx)
-- reduce to case of integral over `[0, c]`
suffices ∀ c : ℝ, IntervalIntegrable (fun x : ℝ => ‖(x:ℂ) ^ r‖) μ 0 c from
(this a).symm.trans (this b)
intro c
rcases le_or_lt 0 c with (hc | hc)
· -- case `0 ≤ c`: integrand is identically 1
have : IntervalIntegrable (fun _ => 1 : ℝ → ℝ) μ 0 c := intervalIntegrable_const
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hc] at this ⊢
refine IntegrableOn.congr_fun this (fun x hx => ?_) measurableSet_Ioc
dsimp only
rw [Complex.norm_eq_abs, Complex.abs_cpow_eq_rpow_re_of_pos hx.1, ← h', rpow_zero]
· -- case `c < 0`: integrand is identically constant, *except* at `x = 0` if `r ≠ 0`.
apply IntervalIntegrable.symm
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hc.le]
have : Ioc c 0 = Ioo c 0 ∪ {(0 : ℝ)} := by
rw [← Ioo_union_Icc_eq_Ioc hc (le_refl 0), ← Icc_def]
simp_rw [← le_antisymm_iff, setOf_eq_eq_singleton']
rw [this, integrableOn_union, and_comm]; constructor
· refine integrableOn_singleton_iff.mpr (Or.inr ?_)
exact isFiniteMeasureOnCompacts_of_isLocallyFiniteMeasure.lt_top_of_isCompact
isCompact_singleton
· have : ∀ x : ℝ, x ∈ Ioo c 0 → ‖Complex.exp (↑π * Complex.I * r)‖ = ‖(x : ℂ) ^ r‖ := by
intro x hx
rw [Complex.ofReal_cpow_of_nonpos hx.2.le, norm_mul, ← Complex.ofReal_neg,
Complex.norm_eq_abs (_ ^ _), Complex.abs_cpow_eq_rpow_re_of_pos (neg_pos.mpr hx.2), ← h',
rpow_zero, one_mul]
refine IntegrableOn.congr_fun ?_ this measurableSet_Ioo
rw [integrableOn_const]
refine Or.inr ((measure_mono Set.Ioo_subset_Icc_self).trans_lt ?_)
exact isFiniteMeasureOnCompacts_of_isLocallyFiniteMeasure.lt_top_of_isCompact isCompact_Icc
| 43 | 4,727,839,468,229,346,000 | 2 | 2 | 2 | 2,258 |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Set.Pointwise.Iterate
import Mathlib.Dynamics.Ergodic.Ergodic
import Mathlib.MeasureTheory.Covering.DensityTheorem
import Mathlib.MeasureTheory.Group.AddCircle
import Mathlib.MeasureTheory.Measure.Haar.Unique
#align_import dynamics.ergodic.add_circle from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655"
open Set Function MeasureTheory MeasureTheory.Measure Filter Metric
open scoped MeasureTheory NNReal ENNReal Topology Pointwise
namespace AddCircle
variable {T : ℝ} [hT : Fact (0 < T)]
| Mathlib/Dynamics/Ergodic/AddCircle.lean | 45 | 101 | theorem ae_empty_or_univ_of_forall_vadd_ae_eq_self {s : Set <| AddCircle T}
(hs : NullMeasurableSet s volume) {ι : Type*} {l : Filter ι} [l.NeBot] {u : ι → AddCircle T}
(hu₁ : ∀ i, (u i +ᵥ s : Set _) =ᵐ[volume] s) (hu₂ : Tendsto (addOrderOf ∘ u) l atTop) :
s =ᵐ[volume] (∅ : Set <| AddCircle T) ∨ s =ᵐ[volume] univ := by |
/- Sketch of proof:
Assume `T = 1` for simplicity and let `μ` be the Haar measure. We may assume `s` has positive
measure since otherwise there is nothing to prove. In this case, by Lebesgue's density theorem,
there exists a point `d` of positive density. Let `Iⱼ` be the sequence of closed balls about `d`
of diameter `1 / nⱼ` where `nⱼ` is the additive order of `uⱼ`. Since `d` has positive density we
must have `μ (s ∩ Iⱼ) / μ Iⱼ → 1` along `l`. However since `s` is invariant under the action of
`uⱼ` and since `Iⱼ` is a fundamental domain for this action, we must have
`μ (s ∩ Iⱼ) = nⱼ * μ s = (μ Iⱼ) * μ s`. We thus have `μ s → 1` and thus `μ s = 1`. -/
set μ := (volume : Measure <| AddCircle T)
set n : ι → ℕ := addOrderOf ∘ u
have hT₀ : 0 < T := hT.out
have hT₁ : ENNReal.ofReal T ≠ 0 := by simpa
rw [ae_eq_empty, ae_eq_univ_iff_measure_eq hs, AddCircle.measure_univ]
rcases eq_or_ne (μ s) 0 with h | h; · exact Or.inl h
right
obtain ⟨d, -, hd⟩ : ∃ d, d ∈ s ∧ ∀ {ι'} {l : Filter ι'} (w : ι' → AddCircle T) (δ : ι' → ℝ),
Tendsto δ l (𝓝[>] 0) → (∀ᶠ j in l, d ∈ closedBall (w j) (1 * δ j)) →
Tendsto (fun j => μ (s ∩ closedBall (w j) (δ j)) / μ (closedBall (w j) (δ j))) l (𝓝 1) :=
exists_mem_of_measure_ne_zero_of_ae h
(IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div μ s 1)
let I : ι → Set (AddCircle T) := fun j => closedBall d (T / (2 * ↑(n j)))
replace hd : Tendsto (fun j => μ (s ∩ I j) / μ (I j)) l (𝓝 1) := by
let δ : ι → ℝ := fun j => T / (2 * ↑(n j))
have hδ₀ : ∀ᶠ j in l, 0 < δ j :=
(hu₂.eventually_gt_atTop 0).mono fun j hj => div_pos hT₀ <| by positivity
have hδ₁ : Tendsto δ l (𝓝[>] 0) := by
refine tendsto_nhdsWithin_iff.mpr ⟨?_, hδ₀⟩
replace hu₂ : Tendsto (fun j => T⁻¹ * 2 * n j) l atTop :=
(tendsto_natCast_atTop_iff.mpr hu₂).const_mul_atTop (by positivity : 0 < T⁻¹ * 2)
convert hu₂.inv_tendsto_atTop
ext j
simp only [δ, Pi.inv_apply, mul_inv_rev, inv_inv, div_eq_inv_mul, ← mul_assoc]
have hw : ∀ᶠ j in l, d ∈ closedBall d (1 * δ j) := hδ₀.mono fun j hj => by
simp only [comp_apply, one_mul, mem_closedBall, dist_self]
apply hj.le
exact hd _ δ hδ₁ hw
suffices ∀ᶠ j in l, μ (s ∩ I j) / μ (I j) = μ s / ENNReal.ofReal T by
replace hd := hd.congr' this
rwa [tendsto_const_nhds_iff, ENNReal.div_eq_one_iff hT₁ ENNReal.ofReal_ne_top] at hd
refine (hu₂.eventually_gt_atTop 0).mono fun j hj => ?_
have : addOrderOf (u j) = n j := rfl
have huj : IsOfFinAddOrder (u j) := addOrderOf_pos_iff.mp hj
have huj' : 1 ≤ (↑(n j) : ℝ) := by norm_cast
have hI₀ : μ (I j) ≠ 0 := (measure_closedBall_pos _ d <| by positivity).ne.symm
have hI₁ : μ (I j) ≠ ⊤ := measure_ne_top _ _
have hI₂ : μ (I j) * ↑(n j) = ENNReal.ofReal T := by
rw [volume_closedBall, mul_div, mul_div_mul_left T _ two_ne_zero,
min_eq_right (div_le_self hT₀.le huj'), mul_comm, ← nsmul_eq_mul, ← ENNReal.ofReal_nsmul,
nsmul_eq_mul, mul_div_cancel₀]
exact Nat.cast_ne_zero.mpr hj.ne'
rw [ENNReal.div_eq_div_iff hT₁ ENNReal.ofReal_ne_top hI₀ hI₁,
volume_of_add_preimage_eq s _ (u j) d huj (hu₁ j) closedBall_ae_eq_ball, nsmul_eq_mul, ←
mul_assoc, this, hI₂]
| 53 | 104,137,594,330,290,870,000,000 | 2 | 2 | 2 | 2,345 |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Int.Basic
import Mathlib.Tactic.Ring
import Mathlib.Tactic.FieldSimp
import Mathlib.Data.Int.NatPrime
import Mathlib.Data.ZMod.Basic
#align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z ≠ 2 := by
change Fin 4 at z
fin_cases z <;> decide
#align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four
theorem Int.sq_ne_two_mod_four (z : ℤ) : z * z % 4 ≠ 2 := by
suffices ¬z * z % (4 : ℕ) = 2 % (4 : ℕ) by exact this
rw [← ZMod.intCast_eq_intCast_iff']
simpa using sq_ne_two_fin_zmod_four _
#align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four
noncomputable section
open scoped Classical
def PythagoreanTriple (x y z : ℤ) : Prop :=
x * x + y * y = z * z
#align pythagorean_triple PythagoreanTriple
theorem pythagoreanTriple_comm {x y z : ℤ} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by
delta PythagoreanTriple
rw [add_comm]
#align pythagorean_triple_comm pythagoreanTriple_comm
theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by
simp only [PythagoreanTriple, zero_mul, zero_add]
#align pythagorean_triple.zero PythagoreanTriple.zero
namespace PythagoreanTriple
variable {x y z : ℤ} (h : PythagoreanTriple x y z)
theorem eq : x * x + y * y = z * z :=
h
#align pythagorean_triple.eq PythagoreanTriple.eq
@[symm]
theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm]
#align pythagorean_triple.symm PythagoreanTriple.symm
theorem mul (k : ℤ) : PythagoreanTriple (k * x) (k * y) (k * z) :=
calc
k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring
_ = k ^ 2 * (z * z) := by rw [h.eq]
_ = k * z * (k * z) := by ring
#align pythagorean_triple.mul PythagoreanTriple.mul
| Mathlib/NumberTheory/PythagoreanTriples.lean | 87 | 93 | theorem mul_iff (k : ℤ) (hk : k ≠ 0) :
PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z := by |
refine ⟨?_, fun h => h.mul k⟩
simp only [PythagoreanTriple]
intro h
rw [← mul_left_inj' (mul_ne_zero hk hk)]
convert h using 1 <;> ring
| 5 | 148.413159 | 2 | 1.2 | 10 | 1,251 |
import Mathlib.CategoryTheory.EffectiveEpi.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.Tactic.ApplyFun
namespace CategoryTheory
open Limits
variable {C : Type*} [Category C]
noncomputable
def effectiveEpiStructIsColimitDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C)
(c : Cofan X) (hc : IsColimit c) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π] :
EffectiveEpiStruct (hc.desc (Cofan.mk B π)) where
desc e h := EffectiveEpiFamily.desc X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e) (fun a₁ a₂ g₁ g₂ hg ↦ by
simp only [← Category.assoc]
exact h (g₁ ≫ c.ι.app ⟨a₁⟩) (g₂ ≫ c.ι.app ⟨a₂⟩) (by simpa))
fac e h := hc.hom_ext (fun ⟨j⟩ ↦ (by simp))
uniq e _ m hm := EffectiveEpiFamily.uniq X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e)
(fun _ _ _ _ hg ↦ (by simp [← hm, reassoc_of% hg])) m (fun _ ↦ (by simp [← hm]))
noncomputable
def effectiveEpiStructDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C)
(π : (a : α) → (X a ⟶ B)) [HasCoproduct X] [EffectiveEpiFamily X π] :
EffectiveEpiStruct (Sigma.desc π) := by
simpa [coproductIsCoproduct] using
effectiveEpiStructIsColimitDescOfEffectiveEpiFamily X _ (coproductIsCoproduct _) π
instance {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [HasCoproduct X]
[EffectiveEpiFamily X π] : EffectiveEpi (Sigma.desc π) :=
⟨⟨effectiveEpiStructDescOfEffectiveEpiFamily X π⟩⟩
example {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π]
[HasCoproduct X] : Epi (Sigma.desc π) := inferInstance
| Mathlib/CategoryTheory/EffectiveEpi/Coproduct.lean | 61 | 93 | theorem effectiveEpiFamilyStructOfEffectiveEpiDesc_aux {B : C} {α : Type*} {X : α → C}
{π : (a : α) → X a ⟶ B} [HasCoproduct X]
[∀ {Z : C} (g : Z ⟶ ∐ X) (a : α), HasPullback g (Sigma.ι X a)]
[∀ {Z : C} (g : Z ⟶ ∐ X), HasCoproduct fun a ↦ pullback g (Sigma.ι X a)]
[∀ {Z : C} (g : Z ⟶ ∐ X), Epi (Sigma.desc fun a ↦ pullback.fst (f := g) (g := (Sigma.ι X a)))]
{W : C} {e : (a : α) → X a ⟶ W} (h : ∀ {Z : C} (a₁ a₂ : α) (g₁ : Z ⟶ X a₁) (g₂ : Z ⟶ X a₂),
g₁ ≫ π a₁ = g₂ ≫ π a₂ → g₁ ≫ e a₁ = g₂ ≫ e a₂) {Z : C}
{g₁ g₂ : Z ⟶ ∐ fun b ↦ X b} (hg : g₁ ≫ Sigma.desc π = g₂ ≫ Sigma.desc π) :
g₁ ≫ Sigma.desc e = g₂ ≫ Sigma.desc e := by |
apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := g₁) (g := (Sigma.ι X a))) ≫ ·) using
(fun a b ↦ (cancel_epi _).mp)
ext a
simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app]
rw [← Category.assoc, pullback.condition]
simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ g₂)
(g := (Sigma.ι X a))) ≫ ·) using (fun a b ↦ (cancel_epi _).mp)
ext b
simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app]
simp only [← Category.assoc]
rw [(Category.assoc _ _ g₂), pullback.condition]
simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
rw [← Category.assoc]
apply h
apply_fun (pullback.fst (f := g₁) (g := (Sigma.ι X a)) ≫ ·) at hg
rw [← Category.assoc, pullback.condition] at hg
simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] at hg
apply_fun ((Sigma.ι (fun a ↦ pullback _ _) b) ≫ (Sigma.desc fun a ↦ pullback.fst
(f := pullback.fst ≫ g₂) (g := (Sigma.ι X a))) ≫ ·) at hg
simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] at hg
simp only [← Category.assoc] at hg
rw [(Category.assoc _ _ g₂), pullback.condition] at hg
simpa using hg
| 24 | 26,489,122,129.84347 | 2 | 2 | 1 | 1,990 |
import Mathlib.RingTheory.Adjoin.FG
#align_import ring_theory.adjoin.tower from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open Pointwise
universe u v w u₁
variable (R : Type u) (S : Type v) (A : Type w) (B : Type u₁)
namespace Algebra
| Mathlib/RingTheory/Adjoin/Tower.lean | 30 | 46 | theorem adjoin_restrictScalars (C D E : Type*) [CommSemiring C] [CommSemiring D] [CommSemiring E]
[Algebra C D] [Algebra C E] [Algebra D E] [IsScalarTower C D E] (S : Set E) :
(Algebra.adjoin D S).restrictScalars C =
(Algebra.adjoin ((⊤ : Subalgebra C D).map (IsScalarTower.toAlgHom C D E)) S).restrictScalars
C := by |
suffices
Set.range (algebraMap D E) =
Set.range (algebraMap ((⊤ : Subalgebra C D).map (IsScalarTower.toAlgHom C D E)) E) by
ext x
change x ∈ Subsemiring.closure (_ ∪ S) ↔ x ∈ Subsemiring.closure (_ ∪ S)
rw [this]
ext x
constructor
· rintro ⟨y, hy⟩
exact ⟨⟨algebraMap D E y, ⟨y, ⟨Algebra.mem_top, rfl⟩⟩⟩, hy⟩
· rintro ⟨⟨y, ⟨z, ⟨h0, h1⟩⟩⟩, h2⟩
exact ⟨z, Eq.trans h1 h2⟩
| 12 | 162,754.791419 | 2 | 2 | 3 | 2,229 |
import Mathlib.Algebra.Group.Indicator
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.Field.Rat
import Mathlib.GroupTheory.GroupAction.Group
import Mathlib.GroupTheory.GroupAction.Pi
#align_import algebra.module.basic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e"
open Function Set
universe u v
variable {α R M M₂ : Type*}
@[deprecated (since := "2024-04-17")]
alias map_nat_cast_smul := map_natCast_smul
theorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M₂] {F : Type*} [FunLike F M M₂]
[AddMonoidHomClass F M M₂] (f : F) (R S : Type*)
[DivisionSemiring R] [DivisionSemiring S] [Module R M]
[Module S M₂] (n : ℕ) (x : M) : f ((n⁻¹ : R) • x) = (n⁻¹ : S) • f x := by
by_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0
· simp [hR, hS, map_zero f]
· suffices ∀ y, f y = 0 by rw [this, this, smul_zero]
clear x
intro x
rw [← inv_smul_smul₀ hS (f x), ← map_natCast_smul f R S]
simp [hR, map_zero f]
· suffices ∀ y, f y = 0 by simp [this]
clear x
intro x
rw [← smul_inv_smul₀ hR x, map_natCast_smul f R S, hS, zero_smul]
· rw [← inv_smul_smul₀ hS (f _), ← map_natCast_smul f R S, smul_inv_smul₀ hR]
#align map_inv_nat_cast_smul map_inv_natCast_smul
@[deprecated (since := "2024-04-17")]
alias map_inv_nat_cast_smul := map_inv_natCast_smul
| Mathlib/Algebra/Module/Basic.lean | 49 | 55 | theorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M₂] {F : Type*} [FunLike F M M₂]
[AddMonoidHomClass F M M₂] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M]
[Module S M₂] (z : ℤ) (x : M) : f ((z⁻¹ : R) • x) = (z⁻¹ : S) • f x := by |
obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg
· rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S]
· simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg,
map_inv_natCast_smul _ R S]
| 4 | 54.59815 | 2 | 1.666667 | 3 | 1,767 |
import Mathlib.NumberTheory.Padics.PadicIntegers
import Mathlib.RingTheory.ZMod
#align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950"
noncomputable section
open scoped Classical
open Nat LocalRing Padic
namespace PadicInt
variable {p : ℕ} [hp_prime : Fact p.Prime]
section lift
open CauSeq PadicSeq
variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k))
(f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1)
def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val
#align padic_int.nth_hom PadicInt.nthHom
@[simp]
theorem nthHom_zero : nthHom f 0 = 0 := by
simp (config := { unfoldPartialApp := true }) [nthHom]
rfl
#align padic_int.nth_hom_zero PadicInt.nthHom_zero
variable {f}
theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) :
(p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by
specialize f_compat i j h
rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub]
dsimp [nthHom]
rw [← f_compat, RingHom.comp_apply]
simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast]
#align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub
| Mathlib/NumberTheory/Padics/RingHoms.lean | 514 | 525 | theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by |
intro ε hε
obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε
use k
intro j hj
refine lt_of_le_of_lt ?_ hk
-- Need to do beta reduction first, as `norm_cast` doesn't.
-- Added to adapt to leanprover/lean4#2734.
beta_reduce
norm_cast
rw [← padicNorm.dvd_iff_norm_le]
exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj
| 11 | 59,874.141715 | 2 | 1.833333 | 12 | 1,916 |
import Mathlib.Data.Finset.Basic
variable {ι : Sort _} {π : ι → Sort _} {x : ∀ i, π i} [DecidableEq ι]
namespace Function
def updateFinset (x : ∀ i, π i) (s : Finset ι) (y : ∀ i : ↥s, π i) (i : ι) : π i :=
if hi : i ∈ s then y ⟨i, hi⟩ else x i
open Finset Equiv
theorem updateFinset_def {s : Finset ι} {y} :
updateFinset x s y = fun i ↦ if hi : i ∈ s then y ⟨i, hi⟩ else x i :=
rfl
@[simp] theorem updateFinset_empty {y} : updateFinset x ∅ y = x :=
rfl
| Mathlib/Data/Finset/Update.lean | 35 | 41 | theorem updateFinset_singleton {i y} :
updateFinset x {i} y = Function.update x i (y ⟨i, mem_singleton_self i⟩) := by |
congr with j
by_cases hj : j = i
· cases hj
simp only [dif_pos, Finset.mem_singleton, update_same, updateFinset]
· simp [hj, updateFinset]
| 5 | 148.413159 | 2 | 2 | 3 | 2,441 |
import Mathlib.RingTheory.DiscreteValuationRing.Basic
import Mathlib.RingTheory.MvPowerSeries.Inverse
import Mathlib.RingTheory.PowerSeries.Basic
import Mathlib.RingTheory.PowerSeries.Order
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Polynomial
open Finset (antidiagonal mem_antidiagonal)
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section Ring
variable [Ring R]
protected def inv.aux : R → R⟦X⟧ → R⟦X⟧ :=
MvPowerSeries.inv.aux
#align power_series.inv.aux PowerSeries.inv.aux
| Mathlib/RingTheory/PowerSeries/Inverse.lean | 54 | 81 | theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
coeff R n (inv.aux a φ) =
if n = 0 then a
else
-a *
∑ x ∈ antidiagonal n,
if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by |
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
simp only [Finsupp.single_eq_zero]
split_ifs; · rfl
congr 1
symm
apply Finset.sum_nbij' (fun (a, b) ↦ (single () a, single () b))
fun (f, g) ↦ (f (), g ())
· aesop
· aesop
· aesop
· aesop
· rintro ⟨i, j⟩ _hij
obtain H | H := le_or_lt n j
· aesop
rw [if_pos H, if_pos]
· rfl
refine ⟨?_, fun hh ↦ H.not_le ?_⟩
· rintro ⟨⟩
simpa [Finsupp.single_eq_same] using le_of_lt H
· simpa [Finsupp.single_eq_same] using hh ()
| 21 | 1,318,815,734.483215 | 2 | 1 | 2 | 1,105 |
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Nilpotent
import Mathlib.Order.Radical
def frattini (G : Type*) [Group G] : Subgroup G :=
Order.radical (Subgroup G)
variable {G H : Type*} [Group G] [Group H] {φ : G →* H} (hφ : Function.Surjective φ)
lemma frattini_le_coatom {K : Subgroup G} (h : IsCoatom K) : frattini G ≤ K :=
Order.radical_le_coatom h
open Subgroup
lemma frattini_le_comap_frattini_of_surjective : frattini G ≤ (frattini H).comap φ := by
simp_rw [frattini, Order.radical, comap_iInf, le_iInf_iff]
intro M hM
apply biInf_le
exact isCoatom_comap_of_surjective hφ hM
instance frattini_characteristic : (frattini G).Characteristic := by
rw [characteristic_iff_comap_eq]
intro φ
apply φ.comapSubgroup.map_radical
theorem frattini_nongenerating [IsCoatomic (Subgroup G)] {K : Subgroup G}
(h : K ⊔ frattini G = ⊤) : K = ⊤ :=
Order.radical_nongenerating h
-- The Sylow files unnecessarily use `Fintype` (computable) where often `Finite` would suffice,
-- so we need this:
attribute [local instance] Fintype.ofFinite
| Mathlib/GroupTheory/Frattini.lean | 59 | 74 | theorem frattini_nilpotent [Finite G] : Group.IsNilpotent (frattini G) := by |
-- We use the characterisation of nilpotency in terms of all Sylow subgroups being normal.
have q := (isNilpotent_of_finite_tfae (G := frattini G)).out 0 3
rw [q]; clear q
-- Consider each prime `p` and Sylow `p`-subgroup `P` of `frattini G`.
intro p p_prime P
-- The Frattini argument shows that the normalizer of `P` in `G`
-- together with `frattini G` generates `G`.
have frattini_argument := Sylow.normalizer_sup_eq_top P
-- and hence by the nongenerating property of the Frattini subgroup that
-- the normalizer of `P` in `G` is `G`.
have normalizer_P := frattini_nongenerating frattini_argument
-- This means that `P` is normal as a subgroup of `G`
have P_normal_in_G : (map (frattini G).subtype ↑P).Normal := normalizer_eq_top.mp normalizer_P
-- and hence also as a subgroup of `frattini G`, which was the remaining goal.
exact P_normal_in_G.of_map_subtype
| 15 | 3,269,017.372472 | 2 | 2 | 1 | 2,381 |
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax
#align_import algebra.order.group.min_max from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
section
variable {α : Type*} [Group α] [LinearOrder α] [CovariantClass α α (· * ·) (· ≤ ·)]
-- TODO: This duplicates `oneLePart_div_leOnePart`
@[to_additive (attr := simp)]
theorem max_one_div_max_inv_one_eq_self (a : α) : max a 1 / max a⁻¹ 1 = a := by
rcases le_total a 1 with (h | h) <;> simp [h]
#align max_one_div_max_inv_one_eq_self max_one_div_max_inv_one_eq_self
#align max_zero_sub_max_neg_zero_eq_self max_zero_sub_max_neg_zero_eq_self
alias max_zero_sub_eq_self := max_zero_sub_max_neg_zero_eq_self
#align max_zero_sub_eq_self max_zero_sub_eq_self
@[to_additive]
lemma max_inv_one (a : α) : max a⁻¹ 1 = a⁻¹ * max a 1 := by
rw [eq_inv_mul_iff_mul_eq, ← eq_div_iff_mul_eq', max_one_div_max_inv_one_eq_self]
end
section LinearOrderedAddCommGroup
variable {α : Type*} [LinearOrderedAddCommGroup α] {a b c : α}
theorem max_sub_max_le_max (a b c d : α) : max a b - max c d ≤ max (a - c) (b - d) := by
simp only [sub_le_iff_le_add, max_le_iff]; constructor
· calc
a = a - c + c := (sub_add_cancel a c).symm
_ ≤ max (a - c) (b - d) + max c d := add_le_add (le_max_left _ _) (le_max_left _ _)
· calc
b = b - d + d := (sub_add_cancel b d).symm
_ ≤ max (a - c) (b - d) + max c d := add_le_add (le_max_right _ _) (le_max_right _ _)
#align max_sub_max_le_max max_sub_max_le_max
| Mathlib/Algebra/Order/Group/MinMax.lean | 96 | 100 | theorem abs_max_sub_max_le_max (a b c d : α) : |max a b - max c d| ≤ max |a - c| |b - d| := by |
refine abs_sub_le_iff.2 ⟨?_, ?_⟩
· exact (max_sub_max_le_max _ _ _ _).trans (max_le_max (le_abs_self _) (le_abs_self _))
· rw [abs_sub_comm a c, abs_sub_comm b d]
exact (max_sub_max_le_max _ _ _ _).trans (max_le_max (le_abs_self _) (le_abs_self _))
| 4 | 54.59815 | 2 | 0.571429 | 7 | 524 |
import Mathlib.Algebra.Homology.ExactSequence
import Mathlib.CategoryTheory.Abelian.Refinements
#align_import category_theory.abelian.diagram_lemmas.four from "leanprover-community/mathlib"@"d34cbcf6c94953e965448c933cd9cc485115ebbd"
namespace CategoryTheory
open Category Limits Preadditive
namespace Abelian
variable {C : Type*} [Category C] [Abelian C]
open ComposableArrows
section Four
variable {R₁ R₂ : ComposableArrows C 3} (φ : R₁ ⟶ R₂)
theorem mono_of_epi_of_mono_of_mono' (hR₁ : R₁.map' 0 2 = 0)
(hR₁' : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
(hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact)
(h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
Mono (app' φ 2) := by
apply mono_of_cancel_zero
intro A f₂ h₁
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
rw [← cancel_mono (app' φ 3 _), assoc, NatTrans.naturality, reassoc_of% h₁,
zero_comp, zero_comp]
obtain ⟨A₁, π₁, _, f₁, hf₁⟩ := (hR₁'.exact 0).exact_up_to_refinements f₂ h₂
dsimp at hf₁
have h₃ : (f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
rw [assoc, ← NatTrans.naturality, ← reassoc_of% hf₁, h₁, comp_zero]
obtain ⟨A₂, π₂, _, g₀, hg₀⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₃
obtain ⟨A₃, π₃, _, f₀, hf₀⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
have h₄ : f₀ ≫ R₁.map' 0 1 = π₃ ≫ π₂ ≫ f₁ := by
rw [← cancel_mono (app' φ 1 _), assoc, assoc, assoc, NatTrans.naturality,
← reassoc_of% hf₀, hg₀]
rfl
rw [← cancel_epi π₁, comp_zero, hf₁, ← cancel_epi π₂, ← cancel_epi π₃, comp_zero,
comp_zero, ← reassoc_of% h₄, ← R₁.map'_comp 0 1 2, hR₁, comp_zero]
#align category_theory.abelian.mono_of_epi_of_mono_of_mono CategoryTheory.Abelian.mono_of_epi_of_mono_of_mono'
theorem mono_of_epi_of_mono_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
(h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
Mono (app' φ 2) :=
mono_of_epi_of_mono_of_mono' φ
(by simpa only [R₁.map'_comp 0 1 2] using hR₁.toIsComplex.zero 0)
(hR₁.exact 1).exact_toComposableArrows (hR₂.exact 0).exact_toComposableArrows h₀ h₁ h₃
attribute [local instance] epi_comp
| Mathlib/CategoryTheory/Abelian/DiagramLemmas/Four.lean | 95 | 120 | theorem epi_of_epi_of_epi_of_mono'
(hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
(hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
(h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
Epi (app' φ 1) := by |
rw [epi_iff_surjective_up_to_refinements]
intro A g₁
obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
dsimp at f₁ h₃
have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1 _) ≫ R₂.map' 1 2 = 0 := by
rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
dsimp at g₀ h₅
rw [comp_sub] at h₅
obtain ⟨A₄, π₄, _, f₀, h₆⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
refine ⟨A₄, π₄ ≫ π₃ ≫ π₂ ≫ π₁, inferInstance,
π₄ ≫ π₃ ≫ f₁ + f₀ ≫ (by exact R₁.map' 0 1), ?_⟩
rw [assoc, assoc, assoc, add_comp, assoc, assoc, assoc, NatTrans.naturality,
← reassoc_of% h₆, ← h₅, comp_sub]
dsimp
rw [add_sub_cancel]
| 21 | 1,318,815,734.483215 | 2 | 2 | 2 | 2,128 |
import Mathlib.Data.ZMod.Quotient
#align_import group_theory.complement from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
open Set
open scoped Pointwise
namespace Subgroup
variable {G : Type*} [Group G] (H K : Subgroup G) (S T : Set G)
@[to_additive "`S` and `T` are complements if `(+) : S × T → G` is a bijection"]
def IsComplement : Prop :=
Function.Bijective fun x : S × T => x.1.1 * x.2.1
#align subgroup.is_complement Subgroup.IsComplement
#align add_subgroup.is_complement AddSubgroup.IsComplement
@[to_additive "`H` and `K` are complements if `(+) : H × K → G` is a bijection"]
abbrev IsComplement' :=
IsComplement (H : Set G) (K : Set G)
#align subgroup.is_complement' Subgroup.IsComplement'
#align add_subgroup.is_complement' AddSubgroup.IsComplement'
@[to_additive "The set of left-complements of `T : Set G`"]
def leftTransversals : Set (Set G) :=
{ S : Set G | IsComplement S T }
#align subgroup.left_transversals Subgroup.leftTransversals
#align add_subgroup.left_transversals AddSubgroup.leftTransversals
@[to_additive "The set of right-complements of `S : Set G`"]
def rightTransversals : Set (Set G) :=
{ T : Set G | IsComplement S T }
#align subgroup.right_transversals Subgroup.rightTransversals
#align add_subgroup.right_transversals AddSubgroup.rightTransversals
variable {H K S T}
@[to_additive]
theorem isComplement'_def : IsComplement' H K ↔ IsComplement (H : Set G) (K : Set G) :=
Iff.rfl
#align subgroup.is_complement'_def Subgroup.isComplement'_def
#align add_subgroup.is_complement'_def AddSubgroup.isComplement'_def
@[to_additive]
theorem isComplement_iff_existsUnique :
IsComplement S T ↔ ∀ g : G, ∃! x : S × T, x.1.1 * x.2.1 = g :=
Function.bijective_iff_existsUnique _
#align subgroup.is_complement_iff_exists_unique Subgroup.isComplement_iff_existsUnique
#align add_subgroup.is_complement_iff_exists_unique AddSubgroup.isComplement_iff_existsUnique
@[to_additive]
theorem IsComplement.existsUnique (h : IsComplement S T) (g : G) :
∃! x : S × T, x.1.1 * x.2.1 = g :=
isComplement_iff_existsUnique.mp h g
#align subgroup.is_complement.exists_unique Subgroup.IsComplement.existsUnique
#align add_subgroup.is_complement.exists_unique AddSubgroup.IsComplement.existsUnique
@[to_additive]
theorem IsComplement'.symm (h : IsComplement' H K) : IsComplement' K H := by
let ϕ : H × K ≃ K × H :=
Equiv.mk (fun x => ⟨x.2⁻¹, x.1⁻¹⟩) (fun x => ⟨x.2⁻¹, x.1⁻¹⟩)
(fun x => Prod.ext (inv_inv _) (inv_inv _)) fun x => Prod.ext (inv_inv _) (inv_inv _)
let ψ : G ≃ G := Equiv.mk (fun g : G => g⁻¹) (fun g : G => g⁻¹) inv_inv inv_inv
suffices hf : (ψ ∘ fun x : H × K => x.1.1 * x.2.1) = (fun x : K × H => x.1.1 * x.2.1) ∘ ϕ by
rw [isComplement'_def, IsComplement, ← Equiv.bijective_comp ϕ]
apply (congr_arg Function.Bijective hf).mp -- Porting note: This was a `rw` in mathlib3
rwa [ψ.comp_bijective]
exact funext fun x => mul_inv_rev _ _
#align subgroup.is_complement'.symm Subgroup.IsComplement'.symm
#align add_subgroup.is_complement'.symm AddSubgroup.IsComplement'.symm
@[to_additive]
theorem isComplement'_comm : IsComplement' H K ↔ IsComplement' K H :=
⟨IsComplement'.symm, IsComplement'.symm⟩
#align subgroup.is_complement'_comm Subgroup.isComplement'_comm
#align add_subgroup.is_complement'_comm AddSubgroup.isComplement'_comm
@[to_additive]
theorem isComplement_univ_singleton {g : G} : IsComplement (univ : Set G) {g} :=
⟨fun ⟨_, _, rfl⟩ ⟨_, _, rfl⟩ h => Prod.ext (Subtype.ext (mul_right_cancel h)) rfl, fun x =>
⟨⟨⟨x * g⁻¹, ⟨⟩⟩, g, rfl⟩, inv_mul_cancel_right x g⟩⟩
#align subgroup.is_complement_top_singleton Subgroup.isComplement_univ_singleton
#align add_subgroup.is_complement_top_singleton AddSubgroup.isComplement_univ_singleton
@[to_additive]
theorem isComplement_singleton_univ {g : G} : IsComplement ({g} : Set G) univ :=
⟨fun ⟨⟨_, rfl⟩, _⟩ ⟨⟨_, rfl⟩, _⟩ h => Prod.ext rfl (Subtype.ext (mul_left_cancel h)), fun x =>
⟨⟨⟨g, rfl⟩, g⁻¹ * x, ⟨⟩⟩, mul_inv_cancel_left g x⟩⟩
#align subgroup.is_complement_singleton_top Subgroup.isComplement_singleton_univ
#align add_subgroup.is_complement_singleton_top AddSubgroup.isComplement_singleton_univ
@[to_additive]
theorem isComplement_singleton_left {g : G} : IsComplement {g} S ↔ S = univ := by
refine
⟨fun h => top_le_iff.mp fun x _ => ?_, fun h => (congr_arg _ h).mpr isComplement_singleton_univ⟩
obtain ⟨⟨⟨z, rfl : z = g⟩, y, _⟩, hy⟩ := h.2 (g * x)
rwa [← mul_left_cancel hy]
#align subgroup.is_complement_singleton_left Subgroup.isComplement_singleton_left
#align add_subgroup.is_complement_singleton_left AddSubgroup.isComplement_singleton_left
@[to_additive]
| Mathlib/GroupTheory/Complement.lean | 133 | 139 | theorem isComplement_singleton_right {g : G} : IsComplement S {g} ↔ S = univ := by |
refine
⟨fun h => top_le_iff.mp fun x _ => ?_, fun h => h ▸ isComplement_univ_singleton⟩
obtain ⟨y, hy⟩ := h.2 (x * g)
conv_rhs at hy => rw [← show y.2.1 = g from y.2.2]
rw [← mul_right_cancel hy]
exact y.1.2
| 6 | 403.428793 | 2 | 2 | 3 | 2,365 |
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Data.Fintype.Lattice
import Mathlib.RingTheory.Coprime.Lemmas
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
assert_not_exists Basis -- See `RingTheory.Ideal.Basis`
assert_not_exists Submodule.hasQuotient -- See `RingTheory.Ideal.QuotientOperations`
universe u v w x
open Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {M' F G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
⟨Submodule.map₂ (LinearMap.lsmul R M)⟩
#align submodule.has_smul' Submodule.hasSMul'
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I • J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
variable (R M) in
def _root_.Module.annihilator : Ideal R := LinearMap.ker (LinearMap.lsmul R M)
theorem _root_.Module.mem_annihilator {r} : r ∈ Module.annihilator R M ↔ ∀ m : M, r • m = 0 :=
⟨fun h ↦ (congr($h ·)), (LinearMap.ext ·)⟩
theorem _root_.LinearMap.annihilator_le_of_injective (f : M →ₗ[R] M') (hf : Function.Injective f) :
Module.annihilator R M' ≤ Module.annihilator R M := fun x h ↦ by
rw [Module.mem_annihilator] at h ⊢; exact fun m ↦ hf (by rw [map_smul, h, f.map_zero])
theorem _root_.LinearMap.annihilator_le_of_surjective (f : M →ₗ[R] M')
(hf : Function.Surjective f) : Module.annihilator R M ≤ Module.annihilator R M' := fun x h ↦ by
rw [Module.mem_annihilator] at h ⊢
intro m; obtain ⟨m, rfl⟩ := hf m
rw [← map_smul, h, f.map_zero]
theorem _root_.LinearEquiv.annihilator_eq (e : M ≃ₗ[R] M') :
Module.annihilator R M = Module.annihilator R M' :=
(e.annihilator_le_of_surjective e.surjective).antisymm (e.annihilator_le_of_injective e.injective)
abbrev annihilator (N : Submodule R M) : Ideal R :=
Module.annihilator R N
#align submodule.annihilator Submodule.annihilator
theorem annihilator_top : (⊤ : Submodule R M).annihilator = Module.annihilator R M :=
topEquiv.annihilator_eq
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r ∈ N.annihilator ↔ ∀ n ∈ N, r • n = (0 : M) := by
simp_rw [annihilator, Module.mem_annihilator, Subtype.forall, Subtype.ext_iff]; rfl
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r ∈ N.annihilator ↔ N ≤ comap (r • (LinearMap.id : M →ₗ[R] M)) ⊥ :=
mem_annihilator.trans ⟨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hn⟩
#align submodule.mem_annihilator' Submodule.mem_annihilator'
| Mathlib/RingTheory/Ideal/Operations.lean | 82 | 96 | theorem mem_annihilator_span (s : Set M) (r : R) :
r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by |
rw [Submodule.mem_annihilator]
constructor
· intro h n
exact h _ (Submodule.subset_span n.prop)
· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
· intro x hx
exact h ⟨x, hx⟩
· exact smul_zero _
· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
· intro a x hx
rw [smul_comm, hx, smul_zero]
| 13 | 442,413.392009 | 2 | 0.5 | 4 | 467 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.