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 | goals listlengths 0 224 | goals_before listlengths 0 220 |
|---|---|---|---|---|---|---|---|
import Mathlib.Analysis.NormedSpace.AddTorsor
import Mathlib.LinearAlgebra.AffineSpace.Ordered
import Mathlib.Topology.ContinuousFunction.Basic
import Mathlib.Topology.GDelta
import Mathlib.Analysis.NormedSpace.FunctionSeries
import Mathlib.Analysis.SpecificLimits.Basic
#align_import topology.urysohns_lemma from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {X : Type*} [TopologicalSpace X]
open Set Filter TopologicalSpace Topology Filter
open scoped Pointwise
namespace Urysohns
set_option linter.uppercaseLean3 false
structure CU {X : Type*} [TopologicalSpace X] (P : Set X β Prop) where
protected C : Set X
protected U : Set X
protected P_C : P C
protected closed_C : IsClosed C
protected open_U : IsOpen U
protected subset : C β U
protected hP : β {c u : Set X}, IsClosed c β P c β IsOpen u β c β u β
β v, IsOpen v β§ c β v β§ closure v β u β§ P (closure v)
#align urysohns.CU Urysohns.CU
namespace CU
variable {P : Set X β Prop}
@[simps C]
def left (c : CU P) : CU P where
C := c.C
U := (c.hP c.closed_C c.P_C c.open_U c.subset).choose
closed_C := c.closed_C
P_C := c.P_C
open_U := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.1
subset := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.2.1
hP := c.hP
#align urysohns.CU.left Urysohns.CU.left
@[simps U]
def right (c : CU P) : CU P where
C := closure (c.hP c.closed_C c.P_C c.open_U c.subset).choose
U := c.U
closed_C := isClosed_closure
P_C := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.2.2.2
open_U := c.open_U
subset := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.2.2.1
hP := c.hP
#align urysohns.CU.right Urysohns.CU.right
theorem left_U_subset_right_C (c : CU P) : c.left.U β c.right.C :=
subset_closure
#align urysohns.CU.left_U_subset_right_C Urysohns.CU.left_U_subset_right_C
theorem left_U_subset (c : CU P) : c.left.U β c.U :=
Subset.trans c.left_U_subset_right_C c.right.subset
#align urysohns.CU.left_U_subset Urysohns.CU.left_U_subset
theorem subset_right_C (c : CU P) : c.C β c.right.C :=
Subset.trans c.left.subset c.left_U_subset_right_C
#align urysohns.CU.subset_right_C Urysohns.CU.subset_right_C
noncomputable def approx : β β CU P β X β β
| 0, c, x => indicator c.UαΆ 1 x
| n + 1, c, x => midpoint β (approx n c.left x) (approx n c.right x)
#align urysohns.CU.approx Urysohns.CU.approx
theorem approx_of_mem_C (c : CU P) (n : β) {x : X} (hx : x β c.C) : c.approx n x = 0 := by
induction' n with n ihn generalizing c
Β· exact indicator_of_not_mem (fun (hU : x β c.UαΆ) => hU <| c.subset hx) _
Β· simp only [approx]
rw [ihn, ihn, midpoint_self]
exacts [c.subset_right_C hx, hx]
#align urysohns.CU.approx_of_mem_C Urysohns.CU.approx_of_mem_C
theorem approx_of_nmem_U (c : CU P) (n : β) {x : X} (hx : x β c.U) : c.approx n x = 1 := by
induction' n with n ihn generalizing c
Β· rw [β mem_compl_iff] at hx
exact indicator_of_mem hx _
Β· simp only [approx]
rw [ihn, ihn, midpoint_self]
exacts [hx, fun hU => hx <| c.left_U_subset hU]
#align urysohns.CU.approx_of_nmem_U Urysohns.CU.approx_of_nmem_U
theorem approx_nonneg (c : CU P) (n : β) (x : X) : 0 β€ c.approx n x := by
induction' n with n ihn generalizing c
Β· exact indicator_nonneg (fun _ _ => zero_le_one) _
Β· simp only [approx, midpoint_eq_smul_add, invOf_eq_inv]
refine mul_nonneg (inv_nonneg.2 zero_le_two) (add_nonneg ?_ ?_) <;> apply ihn
#align urysohns.CU.approx_nonneg Urysohns.CU.approx_nonneg
| Mathlib/Topology/UrysohnsLemma.lean | 185 | 192 | theorem approx_le_one (c : CU P) (n : β) (x : X) : c.approx n x β€ 1 := by |
induction' n with n ihn generalizing c
Β· exact indicator_apply_le' (fun _ => le_rfl) fun _ => zero_le_one
Β· simp only [approx, midpoint_eq_smul_add, invOf_eq_inv, smul_eq_mul, β div_eq_inv_mul]
have := add_le_add (ihn (left c)) (ihn (right c))
set_option tactic.skipAssignedInstances false in
norm_num at this
exact Iff.mpr (div_le_one zero_lt_two) this
| [
" approx n c x = 0",
" approx 0 c x = 0",
" approx (n + 1) c x = 0",
" midpoint β (approx n c.left x) (approx n c.right x) = 0",
" x β c.left.C",
" approx n c x = 1",
" approx 0 c x = 1",
" approx (n + 1) c x = 1",
" midpoint β (approx n c.left x) (approx n c.right x) = 1",
" x β c.left.U",
" 0 ... | [
" approx n c x = 0",
" approx 0 c x = 0",
" approx (n + 1) c x = 0",
" midpoint β (approx n c.left x) (approx n c.right x) = 0",
" x β c.left.C",
" approx n c x = 1",
" approx 0 c x = 1",
" approx (n + 1) c x = 1",
" midpoint β (approx n c.left x) (approx n c.right x) = 1",
" x β c.left.U",
" 0 ... |
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Algebra.LinearRecurrence
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.Prime
#align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open Polynomial
abbrev goldenRatio : β := (1 + β5) / 2
#align golden_ratio goldenRatio
abbrev goldenConj : β := (1 - β5) / 2
#align golden_conj goldenConj
@[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο" => goldenRatio
@[inherit_doc goldenConj] scoped[goldenRatio] notation "Ο" => goldenConj
open Real goldenRatio
theorem inv_gold : Οβ»ΒΉ = -Ο := by
have : 1 + β5 β 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
field_simp [sub_mul, mul_add]
norm_num
#align inv_gold inv_gold
theorem inv_goldConj : Οβ»ΒΉ = -Ο := by
rw [inv_eq_iff_eq_inv, β neg_inv, β neg_eq_iff_eq_neg]
exact inv_gold.symm
#align inv_gold_conj inv_goldConj
@[simp]
theorem gold_mul_goldConj : Ο * Ο = -1 := by
field_simp
rw [β sq_sub_sq]
norm_num
#align gold_mul_gold_conj gold_mul_goldConj
@[simp]
theorem goldConj_mul_gold : Ο * Ο = -1 := by
rw [mul_comm]
exact gold_mul_goldConj
#align gold_conj_mul_gold goldConj_mul_gold
@[simp]
theorem gold_add_goldConj : Ο + Ο = 1 := by
rw [goldenRatio, goldenConj]
ring
#align gold_add_gold_conj gold_add_goldConj
theorem one_sub_goldConj : 1 - Ο = Ο := by
linarith [gold_add_goldConj]
#align one_sub_gold_conj one_sub_goldConj
theorem one_sub_gold : 1 - Ο = Ο := by
linarith [gold_add_goldConj]
#align one_sub_gold one_sub_gold
@[simp]
theorem gold_sub_goldConj : Ο - Ο = β5 := by ring
#align gold_sub_gold_conj gold_sub_goldConj
theorem gold_pow_sub_gold_pow (n : β) : Ο ^ (n + 2) - Ο ^ (n + 1) = Ο ^ n := by
rw [goldenRatio]; ring_nf; norm_num; ring
@[simp 1200]
theorem gold_sq : Ο ^ 2 = Ο + 1 := by
rw [goldenRatio, β sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_sq gold_sq
@[simp 1200]
theorem goldConj_sq : Ο ^ 2 = Ο + 1 := by
rw [goldenConj, β sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_conj_sq goldConj_sq
theorem gold_pos : 0 < Ο :=
mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two
#align gold_pos gold_pos
theorem gold_ne_zero : Ο β 0 :=
ne_of_gt gold_pos
#align gold_ne_zero gold_ne_zero
theorem one_lt_gold : 1 < Ο := by
refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos)
simp [β sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow`
#align one_lt_gold one_lt_gold
theorem gold_lt_two : Ο < 2 := by calc
(1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num
_ = 2 := by norm_num
| Mathlib/Data/Real/GoldenRatio.lean | 121 | 122 | theorem goldConj_neg : Ο < 0 := by |
linarith [one_sub_goldConj, one_lt_gold]
| [
" Οβ»ΒΉ = -Ο",
" 0 < 1",
" 0 < 5",
" 2 * 2 = 5 - 1",
" Οβ»ΒΉ = -Ο",
" -Ο = Οβ»ΒΉ",
" Ο * Ο = -1",
" (1 + β5) * (1 - β5) = -(2 * 2)",
" 1 ^ 2 - β5 ^ 2 = -(2 * 2)",
" Ο * Ο = -1",
" Ο + Ο = 1",
" (1 + β5) / 2 + (1 - β5) / 2 = 1",
" 1 - Ο = Ο",
" 1 - Ο = Ο",
" Ο - Ο = β5",
" Ο ^ (n + 2) - Ο ^ (... | [
" Οβ»ΒΉ = -Ο",
" 0 < 1",
" 0 < 5",
" 2 * 2 = 5 - 1",
" Οβ»ΒΉ = -Ο",
" -Ο = Οβ»ΒΉ",
" Ο * Ο = -1",
" (1 + β5) * (1 - β5) = -(2 * 2)",
" 1 ^ 2 - β5 ^ 2 = -(2 * 2)",
" Ο * Ο = -1",
" Ο + Ο = 1",
" (1 + β5) / 2 + (1 - β5) / 2 = 1",
" 1 - Ο = Ο",
" 1 - Ο = Ο",
" Ο - Ο = β5",
" Ο ^ (n + 2) - Ο ^ (... |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
#align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Filter Metric Set
open scoped ComplexConjugate Real Topology
namespace Complex
variable {a x z : β}
noncomputable def arg (x : β) : β :=
if 0 β€ x.re then Real.arcsin (x.im / abs x)
else if 0 β€ x.im then Real.arcsin ((-x).im / abs x) + Ο else Real.arcsin ((-x).im / abs x) - Ο
#align complex.arg Complex.arg
| Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean | 33 | 37 | theorem sin_arg (x : β) : Real.sin (arg x) = x.im / abs x := by |
unfold arg; split_ifs <;>
simp [sub_eq_add_neg, arg,
Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2,
Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg]
| [
" x.arg.sin = x.im / abs x",
" (if 0 β€ x.re then (x.im / abs x).arcsin\n else if 0 β€ x.im then ((-x).im / abs x).arcsin + Ο else ((-x).im / abs x).arcsin - Ο).sin =\n x.im / abs x",
" (x.im / abs x).arcsin.sin = x.im / abs x",
" (((-x).im / abs x).arcsin + Ο).sin = x.im / abs x",
" (((-x).im / abs x... | [] |
import Mathlib.Geometry.Manifold.ChartedSpace
#align_import geometry.manifold.local_invariant_properties from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db"
noncomputable section
open scoped Classical
open Manifold Topology
open Set Filter TopologicalSpace
variable {H M H' M' X : Type*}
variable [TopologicalSpace H] [TopologicalSpace M] [ChartedSpace H M]
variable [TopologicalSpace H'] [TopologicalSpace M'] [ChartedSpace H' M']
variable [TopologicalSpace X]
namespace StructureGroupoid
variable (G : StructureGroupoid H) (G' : StructureGroupoid H')
structure LocalInvariantProp (P : (H β H') β Set H β H β Prop) : Prop where
is_local : β {s x u} {f : H β H'}, IsOpen u β x β u β (P f s x β P f (s β© u) x)
right_invariance' : β {s x f} {e : PartialHomeomorph H H},
e β G β x β e.source β P f s x β P (f β e.symm) (e.symm β»ΒΉ' s) (e x)
congr_of_forall : β {s x} {f g : H β H'}, (β y β s, f y = g y) β f x = g x β P f s x β P g s x
left_invariance' : β {s x f} {e' : PartialHomeomorph H' H'},
e' β G' β s β f β»ΒΉ' e'.source β f x β e'.source β P f s x β P (e' β f) s x
#align structure_groupoid.local_invariant_prop StructureGroupoid.LocalInvariantProp
variable {G G'} {P : (H β H') β Set H β H β Prop} {s t u : Set H} {x : H}
variable (hG : G.LocalInvariantProp G' P)
section LocalStructomorph
variable (G)
open PartialHomeomorph
def IsLocalStructomorphWithinAt (f : H β H) (s : Set H) (x : H) : Prop :=
x β s β β e : PartialHomeomorph H H, e β G β§ EqOn f e.toFun (s β© e.source) β§ x β e.source
#align structure_groupoid.is_local_structomorph_within_at StructureGroupoid.IsLocalStructomorphWithinAt
theorem isLocalStructomorphWithinAt_localInvariantProp [ClosedUnderRestriction G] :
LocalInvariantProp G G (IsLocalStructomorphWithinAt G) :=
{ is_local := by
intro s x u f hu hux
constructor
Β· rintro h hx
rcases h hx.1 with β¨e, heG, hef, hexβ©
have : s β© u β© e.source β s β© e.source := by mfld_set_tac
exact β¨e, heG, hef.mono this, hexβ©
Β· rintro h hx
rcases h β¨hx, huxβ© with β¨e, heG, hef, hexβ©
refine β¨e.restr (interior u), ?_, ?_, ?_β©
Β· exact closedUnderRestriction' heG isOpen_interior
Β· have : s β© u β© e.source = s β© (e.source β© u) := by mfld_set_tac
simpa only [this, interior_interior, hu.interior_eq, mfld_simps] using hef
Β· simp only [*, interior_interior, hu.interior_eq, mfld_simps]
right_invariance' := by
intro s x f e' he'G he'x h hx
have hxs : x β s := by simpa only [e'.left_inv he'x, mfld_simps] using hx
rcases h hxs with β¨e, heG, hef, hexβ©
refine β¨e'.symm.trans e, G.trans (G.symm he'G) heG, ?_, ?_β©
Β· intro y hy
simp only [mfld_simps] at hy
simp only [hef β¨hy.1, hy.2.2β©, mfld_simps]
Β· simp only [hex, he'x, mfld_simps]
congr_of_forall := by
intro s x f g hfgs _ h hx
rcases h hx with β¨e, heG, hef, hexβ©
refine β¨e, heG, ?_, hexβ©
intro y hy
rw [β hef hy, hfgs y hy.1]
left_invariance' := by
intro s x f e' he'G _ hfx h hx
rcases h hx with β¨e, heG, hef, hexβ©
refine β¨e.trans e', G.trans heG he'G, ?_, ?_β©
Β· intro y hy
simp only [mfld_simps] at hy
simp only [hef β¨hy.1, hy.2.1β©, mfld_simps]
Β· simpa only [hex, hef β¨hx, hexβ©, mfld_simps] using hfx }
#align structure_groupoid.is_local_structomorph_within_at_local_invariant_prop StructureGroupoid.isLocalStructomorphWithinAt_localInvariantProp
| Mathlib/Geometry/Manifold/LocalInvariantProperties.lean | 648 | 666 | theorem _root_.PartialHomeomorph.isLocalStructomorphWithinAt_iff {G : StructureGroupoid H}
[ClosedUnderRestriction G] (f : PartialHomeomorph H H) {s : Set H} {x : H}
(hx : x β f.source βͺ sαΆ) :
G.IsLocalStructomorphWithinAt (βf) s x β
x β s β β e : PartialHomeomorph H H,
e β G β§ e.source β f.source β§ EqOn f (βe) (s β© e.source) β§ x β e.source := by |
constructor
Β· intro hf h2x
obtain β¨e, he, hfe, hxeβ© := hf h2x
refine β¨e.restr f.source, closedUnderRestriction' he f.open_source, ?_, ?_, hxe, ?_β©
Β· simp_rw [PartialHomeomorph.restr_source]
exact inter_subset_right.trans interior_subset
Β· intro x' hx'
exact hfe β¨hx'.1, hx'.2.1β©
Β· rw [f.open_source.interior_eq]
exact Or.resolve_right hx (not_not.mpr h2x)
Β· intro hf hx
obtain β¨e, he, _, hfe, hxeβ© := hf hx
exact β¨e, he, hfe, hxeβ©
| [
" β {s : Set H} {x : H} {u : Set H} {f : H β H},\n IsOpen u β x β u β (G.IsLocalStructomorphWithinAt f s x β G.IsLocalStructomorphWithinAt f (s β© u) x)",
" G.IsLocalStructomorphWithinAt f s x β G.IsLocalStructomorphWithinAt f (s β© u) x",
" G.IsLocalStructomorphWithinAt f s x β G.IsLocalStructomorphWithinAt f... | [
" β {s : Set H} {x : H} {u : Set H} {f : H β H},\n IsOpen u β x β u β (G.IsLocalStructomorphWithinAt f s x β G.IsLocalStructomorphWithinAt f (s β© u) x)",
" G.IsLocalStructomorphWithinAt f s x β G.IsLocalStructomorphWithinAt f (s β© u) x",
" G.IsLocalStructomorphWithinAt f s x β G.IsLocalStructomorphWithinAt f... |
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Ideal
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.localization.submodule from "leanprover-community/mathlib"@"1ebb20602a8caef435ce47f6373e1aa40851a177"
variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S]
variable [Algebra R S] {P : Type*} [CommRing P]
namespace IsLocalization
-- This was previously a `hasCoe` instance, but if `S = R` then this will loop.
-- It could be a `hasCoeT` instance, but we keep it explicit here to avoid slowing down
-- the rest of the library.
def coeSubmodule (I : Ideal R) : Submodule R S :=
Submodule.map (Algebra.linearMap R S) I
#align is_localization.coe_submodule IsLocalization.coeSubmodule
theorem mem_coeSubmodule (I : Ideal R) {x : S} :
x β coeSubmodule S I β β y : R, y β I β§ algebraMap R S y = x :=
Iff.rfl
#align is_localization.mem_coe_submodule IsLocalization.mem_coeSubmodule
theorem coeSubmodule_mono {I J : Ideal R} (h : I β€ J) : coeSubmodule S I β€ coeSubmodule S J :=
Submodule.map_mono h
#align is_localization.coe_submodule_mono IsLocalization.coeSubmodule_mono
@[simp]
theorem coeSubmodule_bot : coeSubmodule S (β₯ : Ideal R) = β₯ := by
rw [coeSubmodule, Submodule.map_bot]
#align is_localization.coe_submodule_bot IsLocalization.coeSubmodule_bot
@[simp]
theorem coeSubmodule_top : coeSubmodule S (β€ : Ideal R) = 1 := by
rw [coeSubmodule, Submodule.map_top, Submodule.one_eq_range]
#align is_localization.coe_submodule_top IsLocalization.coeSubmodule_top
@[simp]
theorem coeSubmodule_sup (I J : Ideal R) :
coeSubmodule S (I β J) = coeSubmodule S I β coeSubmodule S J :=
Submodule.map_sup _ _ _
#align is_localization.coe_submodule_sup IsLocalization.coeSubmodule_sup
@[simp]
theorem coeSubmodule_mul (I J : Ideal R) :
coeSubmodule S (I * J) = coeSubmodule S I * coeSubmodule S J :=
Submodule.map_mul _ _ (Algebra.ofId R S)
#align is_localization.coe_submodule_mul IsLocalization.coeSubmodule_mul
theorem coeSubmodule_fg (hS : Function.Injective (algebraMap R S)) (I : Ideal R) :
Submodule.FG (coeSubmodule S I) β Submodule.FG I :=
β¨Submodule.fg_of_fg_map _ (LinearMap.ker_eq_bot.mpr hS), Submodule.FG.map _β©
#align is_localization.coe_submodule_fg IsLocalization.coeSubmodule_fg
@[simp]
| Mathlib/RingTheory/Localization/Submodule.lean | 75 | 78 | theorem coeSubmodule_span (s : Set R) :
coeSubmodule S (Ideal.span s) = Submodule.span R (algebraMap R S '' s) := by |
rw [IsLocalization.coeSubmodule, Ideal.span, Submodule.map_span]
rfl
| [
" coeSubmodule S β₯ = β₯",
" coeSubmodule S β€ = 1",
" coeSubmodule S (Ideal.span s) = Submodule.span R (β(algebraMap R S) '' s)",
" Submodule.span R (β(Algebra.linearMap R S) '' s) = Submodule.span R (β(algebraMap R S) '' s)"
] | [
" coeSubmodule S β₯ = β₯",
" coeSubmodule S β€ = 1"
] |
import Mathlib.Combinatorics.Quiver.Basic
import Mathlib.Combinatorics.Quiver.Path
#align_import combinatorics.quiver.cast from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
universe v vβ vβ u uβ uβ
variable {U : Type*} [Quiver.{u + 1} U]
namespace Quiver
def Hom.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u βΆ v) : u' βΆ v' :=
Eq.ndrec (motive := (Β· βΆ v')) (Eq.ndrec e hv) hu
#align quiver.hom.cast Quiver.Hom.cast
theorem Hom.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u βΆ v) :
e.cast hu hv = _root_.cast (by {rw [hu, hv]}) e := by
subst_vars
rfl
#align quiver.hom.cast_eq_cast Quiver.Hom.cast_eq_cast
@[simp]
theorem Hom.cast_rfl_rfl {u v : U} (e : u βΆ v) : e.cast rfl rfl = e :=
rfl
#align quiver.hom.cast_rfl_rfl Quiver.Hom.cast_rfl_rfl
@[simp]
theorem Hom.cast_cast {u v u' v' u'' v'' : U} (e : u βΆ v) (hu : u = u') (hv : v = v')
(hu' : u' = u'') (hv' : v' = v'') :
(e.cast hu hv).cast hu' hv' = e.cast (hu.trans hu') (hv.trans hv') := by
subst_vars
rfl
#align quiver.hom.cast_cast Quiver.Hom.cast_cast
theorem Hom.cast_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u βΆ v) :
HEq (e.cast hu hv) e := by
subst_vars
rfl
#align quiver.hom.cast_heq Quiver.Hom.cast_heq
theorem Hom.cast_eq_iff_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u βΆ v) (e' : u' βΆ v') :
e.cast hu hv = e' β HEq e e' := by
rw [Hom.cast_eq_cast]
exact _root_.cast_eq_iff_heq
#align quiver.hom.cast_eq_iff_heq Quiver.Hom.cast_eq_iff_heq
theorem Hom.eq_cast_iff_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u βΆ v) (e' : u' βΆ v') :
e' = e.cast hu hv β HEq e' e := by
rw [eq_comm, Hom.cast_eq_iff_heq]
exact β¨HEq.symm, HEq.symmβ©
#align quiver.hom.eq_cast_iff_heq Quiver.Hom.eq_cast_iff_heq
open Path
def Path.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (p : Path u v) : Path u' v' :=
Eq.ndrec (motive := (Path Β· v')) (Eq.ndrec p hv) hu
#align quiver.path.cast Quiver.Path.cast
| Mathlib/Combinatorics/Quiver/Cast.lean | 87 | 90 | theorem Path.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (p : Path u v) :
p.cast hu hv = _root_.cast (by rw [hu, hv]) p := by |
subst_vars
rfl
| [
" (u βΆ v) = (u' βΆ v')",
" cast hu hv e = _root_.cast β― e",
" cast β― β― e = _root_.cast β― e",
" cast hu' hv' (cast hu hv e) = cast β― β― e",
" cast β― β― (cast β― β― e) = cast β― β― e",
" HEq (cast hu hv e) e",
" HEq (cast β― β― e) e",
" cast hu hv e = e' β HEq e e'",
" _root_.cast β― e = e' β HEq e e'",
" e' ... | [
" (u βΆ v) = (u' βΆ v')",
" cast hu hv e = _root_.cast β― e",
" cast β― β― e = _root_.cast β― e",
" cast hu' hv' (cast hu hv e) = cast β― β― e",
" cast β― β― (cast β― β― e) = cast β― β― e",
" HEq (cast hu hv e) e",
" HEq (cast β― β― e) e",
" cast hu hv e = e' β HEq e e'",
" _root_.cast β― e = e' β HEq e e'",
" e' ... |
import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.function.l2_space from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad"
set_option linter.uppercaseLean3 false
noncomputable section
open TopologicalSpace MeasureTheory MeasureTheory.Lp Filter
open scoped NNReal ENNReal MeasureTheory
namespace MeasureTheory
section
variable {Ξ± F : Type*} {m : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±} [NormedAddCommGroup F]
theorem Memβp.integrable_sq {f : Ξ± β β} (h : Memβp f 2 ΞΌ) : Integrable (fun x => f x ^ 2) ΞΌ := by
simpa [β memβp_one_iff_integrable] using h.norm_rpow two_ne_zero ENNReal.two_ne_top
#align measure_theory.mem_βp.integrable_sq MeasureTheory.Memβp.integrable_sq
theorem memβp_two_iff_integrable_sq_norm {f : Ξ± β F} (hf : AEStronglyMeasurable f ΞΌ) :
Memβp f 2 ΞΌ β Integrable (fun x => βf xβ ^ 2) ΞΌ := by
rw [β memβp_one_iff_integrable]
convert (memβp_norm_rpow_iff hf two_ne_zero ENNReal.two_ne_top).symm
Β· simp
Β· rw [div_eq_mul_inv, ENNReal.mul_inv_cancel two_ne_zero ENNReal.two_ne_top]
#align measure_theory.mem_βp_two_iff_integrable_sq_norm MeasureTheory.memβp_two_iff_integrable_sq_norm
theorem memβp_two_iff_integrable_sq {f : Ξ± β β} (hf : AEStronglyMeasurable f ΞΌ) :
Memβp f 2 ΞΌ β Integrable (fun x => f x ^ 2) ΞΌ := by
convert memβp_two_iff_integrable_sq_norm hf using 3
simp
#align measure_theory.mem_βp_two_iff_integrable_sq MeasureTheory.memβp_two_iff_integrable_sq
end
namespace L2
variable {Ξ± E F π : Type*} [RCLike π] [MeasurableSpace Ξ±] {ΞΌ : Measure Ξ±} [NormedAddCommGroup E]
[InnerProductSpace π E] [NormedAddCommGroup F]
local notation "βͺ" x ", " y "β«" => @inner π _ _ x y
theorem snorm_rpow_two_norm_lt_top (f : Lp F 2 ΞΌ) : snorm (fun x => βf xβ ^ (2 : β)) 1 ΞΌ < β := by
have h_two : ENNReal.ofReal (2 : β) = 2 := by simp [zero_le_one]
rw [snorm_norm_rpow f zero_lt_two, one_mul, h_two]
exact ENNReal.rpow_lt_top_of_nonneg zero_le_two (Lp.snorm_ne_top f)
#align measure_theory.L2.snorm_rpow_two_norm_lt_top MeasureTheory.L2.snorm_rpow_two_norm_lt_top
theorem snorm_inner_lt_top (f g : Ξ± ββ[ΞΌ] E) : snorm (fun x : Ξ± => βͺf x, g xβ«) 1 ΞΌ < β := by
have h : β x, ββͺf x, g xβ«β β€ ββf xβ ^ (2 : β) + βg xβ ^ (2 : β)β := by
intro x
rw [β @Nat.cast_two β, Real.rpow_natCast, Real.rpow_natCast]
calc
ββͺf x, g xβ«β β€ βf xβ * βg xβ := norm_inner_le_norm _ _
_ β€ 2 * βf xβ * βg xβ :=
(mul_le_mul_of_nonneg_right (le_mul_of_one_le_left (norm_nonneg _) one_le_two)
(norm_nonneg _))
-- TODO(kmill): the type ascription is getting around an elaboration error
_ β€ β(βf xβ ^ 2 + βg xβ ^ 2 : β)β := (two_mul_le_add_sq _ _).trans (le_abs_self _)
refine (snorm_mono_ae (ae_of_all _ h)).trans_lt ((snorm_add_le ?_ ?_ le_rfl).trans_lt ?_)
Β· exact ((Lp.aestronglyMeasurable f).norm.aemeasurable.pow_const _).aestronglyMeasurable
Β· exact ((Lp.aestronglyMeasurable g).norm.aemeasurable.pow_const _).aestronglyMeasurable
rw [ENNReal.add_lt_top]
exact β¨snorm_rpow_two_norm_lt_top f, snorm_rpow_two_norm_lt_top gβ©
#align measure_theory.L2.snorm_inner_lt_top MeasureTheory.L2.snorm_inner_lt_top
section InnerProductSpace
open scoped ComplexConjugate
instance : Inner π (Ξ± ββ[ΞΌ] E) :=
β¨fun f g => β« a, βͺf a, g aβ« βΞΌβ©
theorem inner_def (f g : Ξ± ββ[ΞΌ] E) : βͺf, gβ« = β« a : Ξ±, βͺf a, g aβ« βΞΌ :=
rfl
#align measure_theory.L2.inner_def MeasureTheory.L2.inner_def
| Mathlib/MeasureTheory/Function/L2Space.lean | 154 | 167 | theorem integral_inner_eq_sq_snorm (f : Ξ± ββ[ΞΌ] E) :
β« a, βͺf a, f aβ« βΞΌ = ENNReal.toReal (β«β» a, (βf aββ : ββ₯0β) ^ (2 : β) βΞΌ) := by |
simp_rw [inner_self_eq_norm_sq_to_K]
norm_cast
rw [integral_eq_lintegral_of_nonneg_ae]
rotate_left
Β· exact Filter.eventually_of_forall fun x => sq_nonneg _
Β· exact ((Lp.aestronglyMeasurable f).norm.aemeasurable.pow_const _).aestronglyMeasurable
congr
ext1 x
have h_two : (2 : β) = ((2 : β) : β) := by simp
rw [β Real.rpow_natCast _ 2, β h_two, β
ENNReal.ofReal_rpow_of_nonneg (norm_nonneg _) zero_le_two, ofReal_norm_eq_coe_nnnorm]
norm_cast
| [
" Integrable (fun x => f x ^ 2) ΞΌ",
" Memβp f 2 ΞΌ β Integrable (fun x => βf xβ ^ 2) ΞΌ",
" Memβp f 2 ΞΌ β Memβp (fun x => βf xβ ^ 2) 1 ΞΌ",
" βf xββ ^ 2 = βf xββ ^ ENNReal.toReal 2",
" 1 = 2 / 2",
" Memβp f 2 ΞΌ β Integrable (fun x => f x ^ 2) ΞΌ",
" f xβ ^ 2 = βf xββ ^ 2",
" snorm (fun x => βββf xβ ^ 2) 1... | [
" Integrable (fun x => f x ^ 2) ΞΌ",
" Memβp f 2 ΞΌ β Integrable (fun x => βf xβ ^ 2) ΞΌ",
" Memβp f 2 ΞΌ β Memβp (fun x => βf xβ ^ 2) 1 ΞΌ",
" βf xββ ^ 2 = βf xββ ^ ENNReal.toReal 2",
" 1 = 2 / 2",
" Memβp f 2 ΞΌ β Integrable (fun x => f x ^ 2) ΞΌ",
" f xβ ^ 2 = βf xββ ^ 2",
" snorm (fun x => βββf xβ ^ 2) 1... |
import Mathlib.Algebra.Lie.Nilpotent
import Mathlib.Algebra.Lie.Normalizer
#align_import algebra.lie.cartan_subalgebra from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102"
universe u v w wβ wβ
variable {R : Type u} {L : Type v}
variable [CommRing R] [LieRing L] [LieAlgebra R L] (H : LieSubalgebra R L)
def LieSubmodule.IsUcsLimit {M : Type*} [AddCommGroup M] [Module R M] [LieRingModule L M]
[LieModule R L M] (N : LieSubmodule R L M) : Prop :=
β k, β l, k β€ l β (β₯ : LieSubmodule R L M).ucs l = N
#align lie_submodule.is_ucs_limit LieSubmodule.IsUcsLimit
namespace LieSubalgebra
class IsCartanSubalgebra : Prop where
nilpotent : LieAlgebra.IsNilpotent R H
self_normalizing : H.normalizer = H
#align lie_subalgebra.is_cartan_subalgebra LieSubalgebra.IsCartanSubalgebra
instance [H.IsCartanSubalgebra] : LieAlgebra.IsNilpotent R H :=
IsCartanSubalgebra.nilpotent
@[simp]
theorem normalizer_eq_self_of_isCartanSubalgebra (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
H.toLieSubmodule.normalizer = H.toLieSubmodule := by
rw [β LieSubmodule.coe_toSubmodule_eq_iff, coe_normalizer_eq_normalizer,
IsCartanSubalgebra.self_normalizing, coe_toLieSubmodule]
#align lie_subalgebra.normalizer_eq_self_of_is_cartan_subalgebra LieSubalgebra.normalizer_eq_self_of_isCartanSubalgebra
@[simp]
| Mathlib/Algebra/Lie/CartanSubalgebra.lean | 65 | 69 | theorem ucs_eq_self_of_isCartanSubalgebra (H : LieSubalgebra R L) [H.IsCartanSubalgebra] (k : β) :
H.toLieSubmodule.ucs k = H.toLieSubmodule := by |
induction' k with k ih
Β· simp
Β· simp [ih]
| [
" H.toLieSubmodule.normalizer = H.toLieSubmodule",
" LieSubmodule.ucs k H.toLieSubmodule = H.toLieSubmodule",
" LieSubmodule.ucs 0 H.toLieSubmodule = H.toLieSubmodule",
" LieSubmodule.ucs (k + 1) H.toLieSubmodule = H.toLieSubmodule"
] | [
" H.toLieSubmodule.normalizer = H.toLieSubmodule"
] |
import Mathlib.RingTheory.Valuation.Basic
import Mathlib.NumberTheory.Padics.PadicNorm
import Mathlib.Analysis.Normed.Field.Basic
#align_import number_theory.padics.padic_numbers from "leanprover-community/mathlib"@"b9b2114f7711fec1c1e055d507f082f8ceb2c3b7"
noncomputable section
open scoped Classical
open Nat multiplicity padicNorm CauSeq CauSeq.Completion Metric
abbrev PadicSeq (p : β) :=
CauSeq _ (padicNorm p)
#align padic_seq PadicSeq
namespace PadicSeq
section
variable {p : β} [Fact p.Prime]
theorem stationary {f : CauSeq β (padicNorm p)} (hf : Β¬f β 0) :
β N, β m n, N β€ m β N β€ n β padicNorm p (f n) = padicNorm p (f m) :=
have : β Ξ΅ > 0, β N1, β j β₯ N1, Ξ΅ β€ padicNorm p (f j) :=
CauSeq.abv_pos_of_not_limZero <| not_limZero_of_not_congr_zero hf
let β¨Ξ΅, hΞ΅, N1, hN1β© := this
let β¨N2, hN2β© := CauSeq.cauchyβ f hΞ΅
β¨max N1 N2, fun n m hn hm β¦ by
have : padicNorm p (f n - f m) < Ξ΅ := hN2 _ (max_le_iff.1 hn).2 _ (max_le_iff.1 hm).2
have : padicNorm p (f n - f m) < padicNorm p (f n) :=
lt_of_lt_of_le this <| hN1 _ (max_le_iff.1 hn).1
have : padicNorm p (f n - f m) < max (padicNorm p (f n)) (padicNorm p (f m)) :=
lt_max_iff.2 (Or.inl this)
by_contra hne
rw [β padicNorm.neg (f m)] at hne
have hnam := add_eq_max_of_ne hne
rw [padicNorm.neg, max_comm] at hnam
rw [β hnam, sub_eq_add_neg, add_comm] at this
apply _root_.lt_irrefl _ thisβ©
#align padic_seq.stationary PadicSeq.stationary
def stationaryPoint {f : PadicSeq p} (hf : Β¬f β 0) : β :=
Classical.choose <| stationary hf
#align padic_seq.stationary_point PadicSeq.stationaryPoint
theorem stationaryPoint_spec {f : PadicSeq p} (hf : Β¬f β 0) :
β {m n},
stationaryPoint hf β€ m β stationaryPoint hf β€ n β padicNorm p (f n) = padicNorm p (f m) :=
@(Classical.choose_spec <| stationary hf)
#align padic_seq.stationary_point_spec PadicSeq.stationaryPoint_spec
def norm (f : PadicSeq p) : β :=
if hf : f β 0 then 0 else padicNorm p (f (stationaryPoint hf))
#align padic_seq.norm PadicSeq.norm
theorem norm_zero_iff (f : PadicSeq p) : f.norm = 0 β f β 0 := by
constructor
Β· intro h
by_contra hf
unfold norm at h
split_ifs at h
Β· contradiction
apply hf
intro Ξ΅ hΞ΅
exists stationaryPoint hf
intro j hj
have heq := stationaryPoint_spec hf le_rfl hj
simpa [h, heq]
Β· intro h
simp [norm, h]
#align padic_seq.norm_zero_iff PadicSeq.norm_zero_iff
end
section Valuation
open CauSeq
variable {p : β} [Fact p.Prime]
def valuation (f : PadicSeq p) : β€ :=
if hf : f β 0 then 0 else padicValRat p (f (stationaryPoint hf))
#align padic_seq.valuation PadicSeq.valuation
theorem norm_eq_pow_val {f : PadicSeq p} (hf : Β¬f β 0) : f.norm = (p : β) ^ (-f.valuation : β€) := by
rw [norm, valuation, dif_neg hf, dif_neg hf, padicNorm, if_neg]
intro H
apply CauSeq.not_limZero_of_not_congr_zero hf
intro Ξ΅ hΞ΅
use stationaryPoint hf
intro n hn
rw [stationaryPoint_spec hf le_rfl hn]
simpa [H] using hΞ΅
#align padic_seq.norm_eq_pow_val PadicSeq.norm_eq_pow_val
| Mathlib/NumberTheory/Padics/PadicNumbers.lean | 234 | 238 | theorem val_eq_iff_norm_eq {f g : PadicSeq p} (hf : Β¬f β 0) (hg : Β¬g β 0) :
f.valuation = g.valuation β f.norm = g.norm := by |
rw [norm_eq_pow_val hf, norm_eq_pow_val hg, β neg_inj, zpow_inj]
Β· exact mod_cast (Fact.out : p.Prime).pos
Β· exact mod_cast (Fact.out : p.Prime).ne_one
| [
" padicNorm p (βf m) = padicNorm p (βf n)",
" False",
" f.norm = 0 β f β 0",
" f.norm = 0 β f β 0",
" f β 0",
" β i, β j β₯ i, padicNorm p (β(f - 0) j) < Ξ΅",
" β j β₯ stationaryPoint hf, padicNorm p (β(f - 0) j) < Ξ΅",
" padicNorm p (β(f - 0) j) < Ξ΅",
" f β 0 β f.norm = 0",
" f.norm = 0",
" f.norm ... | [
" padicNorm p (βf m) = padicNorm p (βf n)",
" False",
" f.norm = 0 β f β 0",
" f.norm = 0 β f β 0",
" f β 0",
" β i, β j β₯ i, padicNorm p (β(f - 0) j) < Ξ΅",
" β j β₯ stationaryPoint hf, padicNorm p (β(f - 0) j) < Ξ΅",
" padicNorm p (β(f - 0) j) < Ξ΅",
" f β 0 β f.norm = 0",
" f.norm = 0",
" f.norm ... |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
#align_import measure_theory.integral.layercake from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b"
noncomputable section
open scoped ENNReal MeasureTheory Topology
open Set MeasureTheory Filter Measure
namespace MeasureTheory
section
variable {Ξ± R : Type*} [MeasurableSpace Ξ±] (ΞΌ : Measure Ξ±) [LinearOrder R]
| Mathlib/MeasureTheory/Integral/Layercake.lean | 73 | 82 | theorem countable_meas_le_ne_meas_lt (g : Ξ± β R) :
{t : R | ΞΌ {a : Ξ± | t β€ g a} β ΞΌ {a : Ξ± | t < g a}}.Countable := by |
-- the target set is contained in the set of points where the function `t β¦ ΞΌ {a : Ξ± | t β€ g a}`
-- jumps down on the right of `t`. This jump set is countable for any function.
let F : R β ββ₯0β := fun t β¦ ΞΌ {a : Ξ± | t β€ g a}
apply (countable_image_gt_image_Ioi F).mono
intro t ht
have : ΞΌ {a | t < g a} < ΞΌ {a | t β€ g a} :=
lt_of_le_of_ne (measure_mono (fun a ha β¦ le_of_lt ha)) (Ne.symm ht)
exact β¨ΞΌ {a | t < g a}, this, fun s hs β¦ measure_mono (fun a ha β¦ hs.trans_le ha)β©
| [
" {t | ΞΌ {a | t β€ g a} β ΞΌ {a | t < g a}}.Countable",
" {t | ΞΌ {a | t β€ g a} β ΞΌ {a | t < g a}} β {x | β z < F x, β (y : R), x < y β F y β€ z}",
" t β {x | β z < F x, β (y : R), x < y β F y β€ z}"
] | [] |
import Mathlib.LinearAlgebra.Span
import Mathlib.LinearAlgebra.BilinearMap
#align_import algebra.module.submodule.bilinear from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940"
universe uΞΉ u v
open Set
open Pointwise
namespace Submodule
variable {ΞΉ : Sort uΞΉ} {R M N P : Type*}
variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P]
variable [Module R M] [Module R N] [Module R P]
def mapβ (f : M ββ[R] N ββ[R] P) (p : Submodule R M) (q : Submodule R N) : Submodule R P :=
β¨ s : p, q.map (f s)
#align submodule.mapβ Submodule.mapβ
theorem apply_mem_mapβ (f : M ββ[R] N ββ[R] P) {m : M} {n : N} {p : Submodule R M}
{q : Submodule R N} (hm : m β p) (hn : n β q) : f m n β mapβ f p q :=
(le_iSup _ β¨m, hmβ© : _ β€ mapβ f p q) β¨n, hn, by rflβ©
#align submodule.apply_mem_mapβ Submodule.apply_mem_mapβ
theorem mapβ_le {f : M ββ[R] N ββ[R] P} {p : Submodule R M} {q : Submodule R N}
{r : Submodule R P} : mapβ f p q β€ r β β m β p, β n β q, f m n β r :=
β¨fun H _m hm _n hn => H <| apply_mem_mapβ _ hm hn, fun H =>
iSup_le fun β¨m, hmβ© => map_le_iff_le_comap.2 fun n hn => H m hm n hnβ©
#align submodule.mapβ_le Submodule.mapβ_le
variable (R)
| Mathlib/Algebra/Module/Submodule/Bilinear.lean | 59 | 73 | theorem mapβ_span_span (f : M ββ[R] N ββ[R] P) (s : Set M) (t : Set N) :
mapβ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by |
apply le_antisymm
Β· rw [mapβ_le]
apply @span_induction' R M _ _ _ s
intro a ha
apply @span_induction' R N _ _ _ t
intro b hb
exact subset_span β¨_, βΉ_βΊ, _, βΉ_βΊ, rflβ©
all_goals intros; simp only [*, add_mem, smul_mem, zero_mem, _root_.map_zero, map_add,
LinearMap.zero_apply, LinearMap.add_apply, LinearMap.smul_apply,
map_smul]
Β· rw [span_le, image2_subset_iff]
intro a ha b hb
exact apply_mem_mapβ _ (subset_span ha) (subset_span hb)
| [
" (f ββ¨m, hmβ©) n = (f m) n",
" mapβ f (span R s) (span R t) = span R (image2 (fun m n => (f m) n) s t)",
" mapβ f (span R s) (span R t) β€ span R (image2 (fun m n => (f m) n) s t)",
" β m β span R s, β n β span R t, (f m) n β span R (image2 (fun m n => (f m) n) s t)",
" β (a : R),\n β x β span R s,\n ... | [
" (f ββ¨m, hmβ©) n = (f m) n"
] |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {Ξ± : Type u}
class OrderedAddCommGroup (Ξ± : Type u) extends AddCommGroup Ξ±, PartialOrder Ξ± where
protected add_le_add_left : β a b : Ξ±, a β€ b β β c : Ξ±, c + a β€ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (Ξ± : Type u) extends CommGroup Ξ±, PartialOrder Ξ± where
protected mul_le_mul_left : β a b : Ξ±, a β€ b β β c : Ξ±, c * a β€ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (Ξ± : Type u) [OrderedCommGroup Ξ±] :
CovariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup Ξ±] :
OrderedCancelCommMonoid Ξ± :=
{ βΉOrderedCommGroup Ξ±βΊ with le_of_mul_le_mul_left := fun a b c β¦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (Ξ± : Type u) [OrderedAddCommGroup Ξ±] : CovariantClass Ξ± Ξ± (swap (Β· + Β·)) (Β· < Β·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le Ξ±
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (Ξ± : Type u) [OrderedCommGroup Ξ±] :
ContravariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·) where
elim a b c bc := by simpa using mul_le_mul_left' bc aβ»ΒΉ
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (Ξ± : Type u) [OrderedCommGroup Ξ±] :
ContravariantClass Ξ± Ξ± (swap (Β· * Β·)) (Β· β€ Β·) where
elim a b c bc := by simpa using mul_le_mul_right' bc aβ»ΒΉ
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group Ξ±]
section TypeclassesLeftLT
variable [LT Ξ±] [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] {a b c : Ξ±}
@[to_additive (attr := simp) Left.neg_pos_iff "Uses `left` co(ntra)variant."]
theorem Left.one_lt_inv_iff : 1 < aβ»ΒΉ β a < 1 := by
rw [β mul_lt_mul_iff_left a, mul_inv_self, mul_one]
#align left.one_lt_inv_iff Left.one_lt_inv_iff
#align left.neg_pos_iff Left.neg_pos_iff
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
theorem Left.inv_lt_one_iff : aβ»ΒΉ < 1 β 1 < a := by
rw [β mul_lt_mul_iff_left a, mul_inv_self, mul_one]
#align left.inv_lt_one_iff Left.inv_lt_one_iff
#align left.neg_neg_iff Left.neg_neg_iff
@[to_additive (attr := simp)]
theorem lt_inv_mul_iff_mul_lt : b < aβ»ΒΉ * c β a * b < c := by
rw [β mul_lt_mul_iff_left a]
simp
#align lt_inv_mul_iff_mul_lt lt_inv_mul_iff_mul_lt
#align lt_neg_add_iff_add_lt lt_neg_add_iff_add_lt
@[to_additive (attr := simp)]
| Mathlib/Algebra/Order/Group/Defs.lean | 178 | 179 | theorem inv_mul_lt_iff_lt_mul : bβ»ΒΉ * a < c β a < b * c := by |
rw [β mul_lt_mul_iff_left b, mul_inv_cancel_left]
| [
" b β€ c",
" 1 < aβ»ΒΉ β a < 1",
" aβ»ΒΉ < 1 β 1 < a",
" b < aβ»ΒΉ * c β a * b < c",
" a * b < a * (aβ»ΒΉ * c) β a * b < c",
" bβ»ΒΉ * a < c β a < b * c"
] | [
" b β€ c",
" 1 < aβ»ΒΉ β a < 1",
" aβ»ΒΉ < 1 β 1 < a",
" b < aβ»ΒΉ * c β a * b < c",
" a * b < a * (aβ»ΒΉ * c) β a * b < c"
] |
import Mathlib.Algebra.PUnitInstances
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Ring
import Mathlib.Order.Hom.Lattice
#align_import algebra.ring.boolean_ring from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped symmDiff
variable {Ξ± Ξ² Ξ³ : Type*}
class BooleanRing (Ξ±) extends Ring Ξ± where
mul_self : β a : Ξ±, a * a = a
#align boolean_ring BooleanRing
section BooleanRing
variable [BooleanRing Ξ±] (a b : Ξ±)
instance : Std.IdempotentOp (Ξ± := Ξ±) (Β· * Β·) :=
β¨BooleanRing.mul_selfβ©
@[simp]
theorem mul_self : a * a = a :=
BooleanRing.mul_self _
#align mul_self mul_self
@[simp]
theorem add_self : a + a = 0 := by
have : a + a = a + a + (a + a) :=
calc
a + a = (a + a) * (a + a) := by rw [mul_self]
_ = a * a + a * a + (a * a + a * a) := by rw [add_mul, mul_add]
_ = a + a + (a + a) := by rw [mul_self]
rwa [self_eq_add_left] at this
#align add_self add_self
@[simp]
theorem neg_eq : -a = a :=
calc
-a = -a + 0 := by rw [add_zero]
_ = -a + -a + a := by rw [β neg_add_self, add_assoc]
_ = a := by rw [add_self, zero_add]
#align neg_eq neg_eq
theorem add_eq_zero' : a + b = 0 β a = b :=
calc
a + b = 0 β a = -b := add_eq_zero_iff_eq_neg
_ β a = b := by rw [neg_eq]
#align add_eq_zero' add_eq_zero'
@[simp]
theorem mul_add_mul : a * b + b * a = 0 := by
have : a + b = a + b + (a * b + b * a) :=
calc
a + b = (a + b) * (a + b) := by rw [mul_self]
_ = a * a + a * b + (b * a + b * b) := by rw [add_mul, mul_add, mul_add]
_ = a + a * b + (b * a + b) := by simp only [mul_self]
_ = a + b + (a * b + b * a) := by abel
rwa [self_eq_add_right] at this
#align mul_add_mul mul_add_mul
@[simp]
theorem sub_eq_add : a - b = a + b := by rw [sub_eq_add_neg, add_right_inj, neg_eq]
#align sub_eq_add sub_eq_add
@[simp]
| Mathlib/Algebra/Ring/BooleanRing.lean | 105 | 105 | theorem mul_one_add_self : a * (1 + a) = 0 := by | rw [mul_add, mul_one, mul_self, add_self]
| [
" a + a = 0",
" a + a = (a + a) * (a + a)",
" (a + a) * (a + a) = a * a + a * a + (a * a + a * a)",
" a * a + a * a + (a * a + a * a) = a + a + (a + a)",
" -a = -a + 0",
" -a + 0 = -a + -a + a",
" -a + -a + a = a",
" a = -b β a = b",
" a * b + b * a = 0",
" a + b = (a + b) * (a + b)",
" (a + b) ... | [
" a + a = 0",
" a + a = (a + a) * (a + a)",
" (a + a) * (a + a) = a * a + a * a + (a * a + a * a)",
" a * a + a * a + (a * a + a * a) = a + a + (a + a)",
" -a = -a + 0",
" -a + 0 = -a + -a + a",
" -a + -a + a = a",
" a = -b β a = b",
" a * b + b * a = 0",
" a + b = (a + b) * (a + b)",
" (a + b) ... |
import Mathlib.Data.Fintype.Option
import Mathlib.Topology.Separation
import Mathlib.Topology.Sets.Opens
#align_import topology.alexandroff from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Set Filter Topology
variable {X : Type*}
def OnePoint (X : Type*) :=
Option X
#align alexandroff OnePoint
instance [Repr X] : Repr (OnePoint X) :=
β¨fun o _ =>
match o with
| none => "β"
| some a => "β" ++ repr aβ©
namespace OnePoint
@[match_pattern] def infty : OnePoint X := none
#align alexandroff.infty OnePoint.infty
@[inherit_doc]
scoped notation "β" => OnePoint.infty
@[coe, match_pattern] def some : X β OnePoint X := Option.some
instance : CoeTC X (OnePoint X) := β¨someβ©
instance : Inhabited (OnePoint X) := β¨ββ©
instance [Fintype X] : Fintype (OnePoint X) :=
inferInstanceAs (Fintype (Option X))
instance infinite [Infinite X] : Infinite (OnePoint X) :=
inferInstanceAs (Infinite (Option X))
#align alexandroff.infinite OnePoint.infinite
theorem coe_injective : Function.Injective ((β) : X β OnePoint X) :=
Option.some_injective X
#align alexandroff.coe_injective OnePoint.coe_injective
@[norm_cast]
theorem coe_eq_coe {x y : X} : (x : OnePoint X) = y β x = y :=
coe_injective.eq_iff
#align alexandroff.coe_eq_coe OnePoint.coe_eq_coe
@[simp]
theorem coe_ne_infty (x : X) : (x : OnePoint X) β β :=
nofun
#align alexandroff.coe_ne_infty OnePoint.coe_ne_infty
@[simp]
theorem infty_ne_coe (x : X) : β β (x : OnePoint X) :=
nofun
#align alexandroff.infty_ne_coe OnePoint.infty_ne_coe
@[elab_as_elim]
protected def rec {C : OnePoint X β Sort*} (hβ : C β) (hβ : β x : X, C x) :
β z : OnePoint X, C z
| β => hβ
| (x : X) => hβ x
#align alexandroff.rec OnePoint.rec
theorem isCompl_range_coe_infty : IsCompl (range ((β) : X β OnePoint X)) {β} :=
isCompl_range_some_none X
#align alexandroff.is_compl_range_coe_infty OnePoint.isCompl_range_coe_infty
-- Porting note: moved @[simp] to a new lemma
theorem range_coe_union_infty : range ((β) : X β OnePoint X) βͺ {β} = univ :=
range_some_union_none X
#align alexandroff.range_coe_union_infty OnePoint.range_coe_union_infty
@[simp]
theorem insert_infty_range_coe : insert β (range (@some X)) = univ :=
insert_none_range_some _
@[simp]
theorem range_coe_inter_infty : range ((β) : X β OnePoint X) β© {β} = β
:=
range_some_inter_none X
#align alexandroff.range_coe_inter_infty OnePoint.range_coe_inter_infty
@[simp]
theorem compl_range_coe : (range ((β) : X β OnePoint X))αΆ = {β} :=
compl_range_some X
#align alexandroff.compl_range_coe OnePoint.compl_range_coe
theorem compl_infty : ({β}αΆ : Set (OnePoint X)) = range ((β) : X β OnePoint X) :=
(@isCompl_range_coe_infty X).symm.compl_eq
#align alexandroff.compl_infty OnePoint.compl_infty
theorem compl_image_coe (s : Set X) : ((β) '' s : Set (OnePoint X))αΆ = (β) '' sαΆ βͺ {β} := by
rw [coe_injective.compl_image_eq, compl_range_coe]
#align alexandroff.compl_image_coe OnePoint.compl_image_coe
| Mathlib/Topology/Compactification/OnePoint.lean | 144 | 145 | theorem ne_infty_iff_exists {x : OnePoint X} : x β β β β y : X, (y : OnePoint X) = x := by |
induction x using OnePoint.rec <;> simp
| [
" (some '' s)αΆ = some '' sαΆ βͺ {β}",
" x β β β β y, βy = x",
" β β β β β y, βy = β",
" βxβ β β β β y, βy = βxβ"
] | [
" (some '' s)αΆ = some '' sαΆ βͺ {β}"
] |
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Combinatorics.SimpleGraph.Maps
open Finset
namespace SimpleGraph
variable {V : Type*} [DecidableEq V] (G : SimpleGraph V) (s t : V)
section ReplaceVertex
def replaceVertex : SimpleGraph V where
Adj v w := if v = t then if w = t then False else G.Adj s w
else if w = t then G.Adj v s else G.Adj v w
symm v w := by dsimp only; split_ifs <;> simp [adj_comm]
lemma not_adj_replaceVertex_same : Β¬(G.replaceVertex s t).Adj s t := by simp [replaceVertex]
@[simp] lemma replaceVertex_self : G.replaceVertex s s = G := by
ext; unfold replaceVertex; aesop (add simp or_iff_not_imp_left)
variable {t}
lemma adj_replaceVertex_iff_of_ne_left {w : V} (hw : w β t) :
(G.replaceVertex s t).Adj s w β G.Adj s w := by simp [replaceVertex, hw]
lemma adj_replaceVertex_iff_of_ne_right {w : V} (hw : w β t) :
(G.replaceVertex s t).Adj t w β G.Adj s w := by simp [replaceVertex, hw]
lemma adj_replaceVertex_iff_of_ne {v w : V} (hv : v β t) (hw : w β t) :
(G.replaceVertex s t).Adj v w β G.Adj v w := by simp [replaceVertex, hv, hw]
variable {s}
theorem edgeSet_replaceVertex_of_not_adj (hn : Β¬G.Adj s t) : (G.replaceVertex s t).edgeSet =
G.edgeSet \ G.incidenceSet t βͺ (s(Β·, t)) '' (G.neighborSet s) := by
ext e; refine e.inductionOn ?_
simp only [replaceVertex, mem_edgeSet, Set.mem_union, Set.mem_diff, mk'_mem_incidenceSet_iff]
intros; split_ifs; exacts [by simp_all, by aesop, by rw [adj_comm]; aesop, by aesop]
| Mathlib/Combinatorics/SimpleGraph/Operations.lean | 82 | 86 | theorem edgeSet_replaceVertex_of_adj (ha : G.Adj s t) : (G.replaceVertex s t).edgeSet =
(G.edgeSet \ G.incidenceSet t βͺ (s(Β·, t)) '' (G.neighborSet s)) \ {s(t, t)} := by |
ext e; refine e.inductionOn ?_
simp only [replaceVertex, mem_edgeSet, Set.mem_union, Set.mem_diff, mk'_mem_incidenceSet_iff]
intros; split_ifs; exacts [by simp_all, by aesop, by rw [adj_comm]; aesop, by aesop]
| [
" (fun v w => if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s else G.Adj v w) v w β\n (fun v w => if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s else G.Adj v w) w v",
" (if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s el... | [
" (fun v w => if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s else G.Adj v w) v w β\n (fun v w => if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s else G.Adj v w) w v",
" (if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s el... |
import Mathlib.Algebra.ContinuedFractions.Basic
import Mathlib.Algebra.GroupWithZero.Basic
#align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
section WithDivisionRing
variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : β} [DivisionRing K]
theorem nth_cont_eq_succ_nth_cont_aux : g.continuants n = g.continuantsAux (n + 1) :=
rfl
#align generalized_continued_fraction.nth_cont_eq_succ_nth_cont_aux GeneralizedContinuedFraction.nth_cont_eq_succ_nth_cont_aux
theorem num_eq_conts_a : g.numerators n = (g.continuants n).a :=
rfl
#align generalized_continued_fraction.num_eq_conts_a GeneralizedContinuedFraction.num_eq_conts_a
theorem denom_eq_conts_b : g.denominators n = (g.continuants n).b :=
rfl
#align generalized_continued_fraction.denom_eq_conts_b GeneralizedContinuedFraction.denom_eq_conts_b
theorem convergent_eq_num_div_denom : g.convergents n = g.numerators n / g.denominators n :=
rfl
#align generalized_continued_fraction.convergent_eq_num_div_denom GeneralizedContinuedFraction.convergent_eq_num_div_denom
theorem convergent_eq_conts_a_div_conts_b :
g.convergents n = (g.continuants n).a / (g.continuants n).b :=
rfl
#align generalized_continued_fraction.convergent_eq_conts_a_div_conts_b GeneralizedContinuedFraction.convergent_eq_conts_a_div_conts_b
theorem exists_conts_a_of_num {A : K} (nth_num_eq : g.numerators n = A) :
β conts, g.continuants n = conts β§ conts.a = A := by simpa
#align generalized_continued_fraction.exists_conts_a_of_num GeneralizedContinuedFraction.exists_conts_a_of_num
theorem exists_conts_b_of_denom {B : K} (nth_denom_eq : g.denominators n = B) :
β conts, g.continuants n = conts β§ conts.b = B := by simpa
#align generalized_continued_fraction.exists_conts_b_of_denom GeneralizedContinuedFraction.exists_conts_b_of_denom
@[simp]
theorem zeroth_continuant_aux_eq_one_zero : g.continuantsAux 0 = β¨1, 0β© :=
rfl
#align generalized_continued_fraction.zeroth_continuant_aux_eq_one_zero GeneralizedContinuedFraction.zeroth_continuant_aux_eq_one_zero
@[simp]
theorem first_continuant_aux_eq_h_one : g.continuantsAux 1 = β¨g.h, 1β© :=
rfl
#align generalized_continued_fraction.first_continuant_aux_eq_h_one GeneralizedContinuedFraction.first_continuant_aux_eq_h_one
@[simp]
theorem zeroth_continuant_eq_h_one : g.continuants 0 = β¨g.h, 1β© :=
rfl
#align generalized_continued_fraction.zeroth_continuant_eq_h_one GeneralizedContinuedFraction.zeroth_continuant_eq_h_one
@[simp]
theorem zeroth_numerator_eq_h : g.numerators 0 = g.h :=
rfl
#align generalized_continued_fraction.zeroth_numerator_eq_h GeneralizedContinuedFraction.zeroth_numerator_eq_h
@[simp]
theorem zeroth_denominator_eq_one : g.denominators 0 = 1 :=
rfl
#align generalized_continued_fraction.zeroth_denominator_eq_one GeneralizedContinuedFraction.zeroth_denominator_eq_one
@[simp]
theorem zeroth_convergent_eq_h : g.convergents 0 = g.h := by
simp [convergent_eq_num_div_denom, num_eq_conts_a, denom_eq_conts_b, div_one]
#align generalized_continued_fraction.zeroth_convergent_eq_h GeneralizedContinuedFraction.zeroth_convergent_eq_h
theorem second_continuant_aux_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.continuantsAux 2 = β¨gp.b * g.h + gp.a, gp.bβ© := by
simp [zeroth_s_eq, continuantsAux, nextContinuants, nextDenominator, nextNumerator]
#align generalized_continued_fraction.second_continuant_aux_eq GeneralizedContinuedFraction.second_continuant_aux_eq
theorem first_continuant_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.continuants 1 = β¨gp.b * g.h + gp.a, gp.bβ© := by
simp [nth_cont_eq_succ_nth_cont_aux]
-- Porting note (#10959): simp used to work here, but now it can't figure out that 1 + 1 = 2
convert second_continuant_aux_eq zeroth_s_eq
#align generalized_continued_fraction.first_continuant_eq GeneralizedContinuedFraction.first_continuant_eq
theorem first_numerator_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.numerators 1 = gp.b * g.h + gp.a := by simp [num_eq_conts_a, first_continuant_eq zeroth_s_eq]
#align generalized_continued_fraction.first_numerator_eq GeneralizedContinuedFraction.first_numerator_eq
theorem first_denominator_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.denominators 1 = gp.b := by simp [denom_eq_conts_b, first_continuant_eq zeroth_s_eq]
#align generalized_continued_fraction.first_denominator_eq GeneralizedContinuedFraction.first_denominator_eq
@[simp]
theorem zeroth_convergent'_aux_eq_zero {s : Stream'.Seq <| Pair K} :
convergents'Aux s 0 = (0 : K) :=
rfl
#align generalized_continued_fraction.zeroth_convergent'_aux_eq_zero GeneralizedContinuedFraction.zeroth_convergent'_aux_eq_zero
@[simp]
theorem zeroth_convergent'_eq_h : g.convergents' 0 = g.h := by simp [convergents']
#align generalized_continued_fraction.zeroth_convergent'_eq_h GeneralizedContinuedFraction.zeroth_convergent'_eq_h
| Mathlib/Algebra/ContinuedFractions/Translations.lean | 180 | 181 | theorem convergents'Aux_succ_none {s : Stream'.Seq (Pair K)} (h : s.head = none) (n : β) :
convergents'Aux s (n + 1) = 0 := by | simp [convergents'Aux, h, convergents'Aux.match_1]
| [
" β conts, g.continuants n = conts β§ conts.a = A",
" β conts, g.continuants n = conts β§ conts.b = B",
" g.convergents 0 = g.h",
" g.continuantsAux 2 = { a := gp.b * g.h + gp.a, b := gp.b }",
" g.continuants 1 = { a := gp.b * g.h + gp.a, b := gp.b }",
" g.numerators 1 = gp.b * g.h + gp.a",
" g.denominato... | [
" β conts, g.continuants n = conts β§ conts.a = A",
" β conts, g.continuants n = conts β§ conts.b = B",
" g.convergents 0 = g.h",
" g.continuantsAux 2 = { a := gp.b * g.h + gp.a, b := gp.b }",
" g.continuants 1 = { a := gp.b * g.h + gp.a, b := gp.b }",
" g.numerators 1 = gp.b * g.h + gp.a",
" g.denominato... |
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.Asymptotics.Theta
import Mathlib.Analysis.Normed.Order.Basic
#align_import analysis.asymptotics.asymptotic_equivalent from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Asymptotics
open Filter Function
open Topology
section NormedAddCommGroup
variable {Ξ± Ξ² : Type*} [NormedAddCommGroup Ξ²]
def IsEquivalent (l : Filter Ξ±) (u v : Ξ± β Ξ²) :=
(u - v) =o[l] v
#align asymptotics.is_equivalent Asymptotics.IsEquivalent
@[inherit_doc] scoped notation:50 u " ~[" l:50 "] " v:50 => Asymptotics.IsEquivalent l u v
variable {u v w : Ξ± β Ξ²} {l : Filter Ξ±}
theorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v := h
#align asymptotics.is_equivalent.is_o Asymptotics.IsEquivalent.isLittleO
nonrec theorem IsEquivalent.isBigO (h : u ~[l] v) : u =O[l] v :=
(IsBigO.congr_of_sub h.isBigO.symm).mp (isBigO_refl _ _)
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O Asymptotics.IsEquivalent.isBigO
theorem IsEquivalent.isBigO_symm (h : u ~[l] v) : v =O[l] u := by
convert h.isLittleO.right_isBigO_add
simp
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O_symm Asymptotics.IsEquivalent.isBigO_symm
theorem IsEquivalent.isTheta (h : u ~[l] v) : u =Ξ[l] v :=
β¨h.isBigO, h.isBigO_symmβ©
theorem IsEquivalent.isTheta_symm (h : u ~[l] v) : v =Ξ[l] u :=
β¨h.isBigO_symm, h.isBigOβ©
@[refl]
theorem IsEquivalent.refl : u ~[l] u := by
rw [IsEquivalent, sub_self]
exact isLittleO_zero _ _
#align asymptotics.is_equivalent.refl Asymptotics.IsEquivalent.refl
@[symm]
theorem IsEquivalent.symm (h : u ~[l] v) : v ~[l] u :=
(h.isLittleO.trans_isBigO h.isBigO_symm).symm
#align asymptotics.is_equivalent.symm Asymptotics.IsEquivalent.symm
@[trans]
theorem IsEquivalent.trans {l : Filter Ξ±} {u v w : Ξ± β Ξ²} (huv : u ~[l] v) (hvw : v ~[l] w) :
u ~[l] w :=
(huv.isLittleO.trans_isBigO hvw.isBigO).triangle hvw.isLittleO
#align asymptotics.is_equivalent.trans Asymptotics.IsEquivalent.trans
theorem IsEquivalent.congr_left {u v w : Ξ± β Ξ²} {l : Filter Ξ±} (huv : u ~[l] v) (huw : u =αΆ [l] w) :
w ~[l] v :=
huv.congr' (huw.sub (EventuallyEq.refl _ _)) (EventuallyEq.refl _ _)
#align asymptotics.is_equivalent.congr_left Asymptotics.IsEquivalent.congr_left
theorem IsEquivalent.congr_right {u v w : Ξ± β Ξ²} {l : Filter Ξ±} (huv : u ~[l] v) (hvw : v =αΆ [l] w) :
u ~[l] w :=
(huv.symm.congr_left hvw).symm
#align asymptotics.is_equivalent.congr_right Asymptotics.IsEquivalent.congr_right
| Mathlib/Analysis/Asymptotics/AsymptoticEquivalent.lean | 128 | 130 | theorem isEquivalent_zero_iff_eventually_zero : u ~[l] 0 β u =αΆ [l] 0 := by |
rw [IsEquivalent, sub_zero]
exact isLittleO_zero_right_iff
| [
" v =O[l] u",
" u xβ = (u - v) xβ + v xβ",
" u ~[l] u",
" 0 =o[l] u",
" u ~[l] 0 β u =αΆ [l] 0",
" u =o[l] 0 β u =αΆ [l] 0"
] | [
" v =O[l] u",
" u xβ = (u - v) xβ + v xβ",
" u ~[l] u",
" 0 =o[l] u"
] |
import Mathlib.Algebra.MvPolynomial.Equiv
import Mathlib.Algebra.Polynomial.Eval
#align_import data.mv_polynomial.polynomial from "leanprover-community/mathlib"@"0b89934139d3be96f9dab477f10c20f9f93da580"
namespace MvPolynomial
variable {R S Ο : Type*}
| Mathlib/Algebra/MvPolynomial/Polynomial.lean | 19 | 28 | theorem polynomial_eval_evalβ [CommSemiring R] [CommSemiring S]
{x : S} (f : R β+* Polynomial S) (g : Ο β Polynomial S) (p : MvPolynomial Ο R) :
Polynomial.eval x (evalβ f g p) =
evalβ ((Polynomial.evalRingHom x).comp f) (fun s => Polynomial.eval x (g s)) p := by |
apply induction_on p
Β· simp
Β· intro p q hp hq
simp [hp, hq]
Β· intro p n hp
simp [hp]
| [
" Polynomial.eval x (evalβ f g p) = evalβ ((Polynomial.evalRingHom x).comp f) (fun s => Polynomial.eval x (g s)) p",
" β (a : R),\n Polynomial.eval x (evalβ f g (C a)) =\n evalβ ((Polynomial.evalRingHom x).comp f) (fun s => Polynomial.eval x (g s)) (C a)",
" β (p q : MvPolynomial Ο R),\n Polynomial.e... | [] |
import Mathlib.Data.Matrix.Kronecker
import Mathlib.LinearAlgebra.Matrix.ToLin
import Mathlib.LinearAlgebra.TensorProduct.Basis
#align_import linear_algebra.tensor_product.matrix from "leanprover-community/mathlib"@"f784cc6142443d9ee623a20788c282112c322081"
variable {R : Type*} {M N P M' N' : Type*} {ΞΉ ΞΊ Ο ΞΉ' ΞΊ' : Type*}
variable [DecidableEq ΞΉ] [DecidableEq ΞΊ] [DecidableEq Ο]
variable [Fintype ΞΉ] [Fintype ΞΊ] [Fintype Ο] [Finite ΞΉ'] [Finite ΞΊ']
variable [CommRing R]
variable [AddCommGroup M] [AddCommGroup N] [AddCommGroup P]
variable [AddCommGroup M'] [AddCommGroup N']
variable [Module R M] [Module R N] [Module R P] [Module R M'] [Module R N']
variable (bM : Basis ΞΉ R M) (bN : Basis ΞΊ R N) (bP : Basis Ο R P)
variable (bM' : Basis ΞΉ' R M') (bN' : Basis ΞΊ' R N')
open Kronecker
open Matrix LinearMap
theorem TensorProduct.toMatrix_map (f : M ββ[R] M') (g : N ββ[R] N') :
toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN') (TensorProduct.map f g) =
toMatrix bM bM' f ββ toMatrix bN bN' g := by
ext β¨i, jβ© β¨i', j'β©
simp_rw [Matrix.kroneckerMap_apply, toMatrix_apply, Basis.tensorProduct_apply,
TensorProduct.map_tmul, Basis.tensorProduct_repr_tmul_apply]
#align tensor_product.to_matrix_map TensorProduct.toMatrix_map
| Mathlib/LinearAlgebra/TensorProduct/Matrix.lean | 49 | 53 | theorem Matrix.toLin_kronecker (A : Matrix ΞΉ' ΞΉ R) (B : Matrix ΞΊ' ΞΊ R) :
toLin (bM.tensorProduct bN) (bM'.tensorProduct bN') (A ββ B) =
TensorProduct.map (toLin bM bM' A) (toLin bN bN' B) := by |
rw [β LinearEquiv.eq_symm_apply, toLin_symm, TensorProduct.toMatrix_map, toMatrix_toLin,
toMatrix_toLin]
| [
" (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMatrix bN bN') g)",
" (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) (i, j) (i', j') =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMa... | [
" (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMatrix bN bN') g)",
" (toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN')) (map f g) (i, j) (i', j') =\n kroneckerMap (fun x x_1 => x * x_1) ((toMatrix bM bM') f) ((toMa... |
import Mathlib.Algebra.Algebra.Defs
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Localization.Basic
import Mathlib.SetTheory.Game.Birthday
import Mathlib.SetTheory.Surreal.Basic
#align_import set_theory.surreal.dyadic from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
universe u
namespace SetTheory
namespace PGame
def powHalf : β β PGame
| 0 => 1
| n + 1 => β¨PUnit, PUnit, 0, fun _ => powHalf nβ©
#align pgame.pow_half SetTheory.PGame.powHalf
@[simp]
theorem powHalf_zero : powHalf 0 = 1 :=
rfl
#align pgame.pow_half_zero SetTheory.PGame.powHalf_zero
| Mathlib/SetTheory/Surreal/Dyadic.lean | 52 | 52 | theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by | cases n <;> rfl
| [
" (powHalf n).LeftMoves = PUnit.{u_1 + 1}",
" (powHalf 0).LeftMoves = PUnit.{u_1 + 1}",
" (powHalf (nβ + 1)).LeftMoves = PUnit.{u_1 + 1}"
] | [] |
import Mathlib.Algebra.Ring.Idempotents
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Order.Basic
import Mathlib.Tactic.NoncommRing
#align_import analysis.normed_space.M_structure from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
variable (X : Type*) [NormedAddCommGroup X]
variable {M : Type*} [Ring M] [Module M X]
-- Porting note: Mathlib3 uses names with uppercase 'L' for L-projections
set_option linter.uppercaseLean3 false
structure IsLprojection (P : M) : Prop where
proj : IsIdempotentElem P
Lnorm : β x : X, βxβ = βP β’ xβ + β(1 - P) β’ xβ
#align is_Lprojection IsLprojection
structure IsMprojection (P : M) : Prop where
proj : IsIdempotentElem P
Mnorm : β x : X, βxβ = max βP β’ xβ β(1 - P) β’ xβ
#align is_Mprojection IsMprojection
variable {X}
namespace IsLprojection
-- Porting note: The literature always uses uppercase 'L' for L-projections
theorem Lcomplement {P : M} (h : IsLprojection X P) : IsLprojection X (1 - P) :=
β¨h.proj.one_sub, fun x => by
rw [add_comm, sub_sub_cancel]
exact h.Lnorm xβ©
#align is_Lprojection.Lcomplement IsLprojection.Lcomplement
theorem Lcomplement_iff (P : M) : IsLprojection X P β IsLprojection X (1 - P) :=
β¨Lcomplement, fun h => sub_sub_cancel 1 P βΈ h.Lcomplementβ©
#align is_Lprojection.Lcomplement_iff IsLprojection.Lcomplement_iff
| Mathlib/Analysis/NormedSpace/MStructure.lean | 105 | 144 | theorem commute [FaithfulSMul M X] {P Q : M} (hβ : IsLprojection X P) (hβ : IsLprojection X Q) :
Commute P Q := by |
have PR_eq_RPR : β R : M, IsLprojection X R β P * R = R * P * R := fun R hβ => by
-- Porting note: Needed to fix function, which changes indent of following lines
refine @eq_of_smul_eq_smul _ X _ _ _ _ fun x => by
rw [β norm_sub_eq_zero_iff]
have e1 : βR β’ xβ β₯ βR β’ xβ + 2 β’ β(P * R) β’ x - (R * P * R) β’ xβ :=
calc
βR β’ xβ = βR β’ P β’ R β’ xβ + β(1 - R) β’ P β’ R β’ xβ +
(β(R * R) β’ x - R β’ P β’ R β’ xβ + β(1 - R) β’ (1 - P) β’ R β’ xβ) := by
rw [hβ.Lnorm, hβ.Lnorm, hβ.Lnorm ((1 - P) β’ R β’ x), sub_smul 1 P, one_smul, smul_sub,
mul_smul]
_ = βR β’ P β’ R β’ xβ + β(1 - R) β’ P β’ R β’ xβ +
(βR β’ x - R β’ P β’ R β’ xβ + β((1 - R) * R) β’ x - (1 - R) β’ P β’ R β’ xβ) := by
rw [hβ.proj.eq, sub_smul 1 P, one_smul, smul_sub, mul_smul]
_ = βR β’ P β’ R β’ xβ + β(1 - R) β’ P β’ R β’ xβ +
(βR β’ x - R β’ P β’ R β’ xβ + β(1 - R) β’ P β’ R β’ xβ) := by
rw [sub_mul, hβ.proj.eq, one_mul, sub_self, zero_smul, zero_sub, norm_neg]
_ = βR β’ P β’ R β’ xβ + βR β’ x - R β’ P β’ R β’ xβ + 2 β’ β(1 - R) β’ P β’ R β’ xβ := by abel
_ β₯ βR β’ xβ + 2 β’ β(P * R) β’ x - (R * P * R) β’ xβ := by
rw [GE.ge]
have :=
add_le_add_right (norm_le_insert' (R β’ x) (R β’ P β’ R β’ x)) (2 β’ β(1 - R) β’ P β’ R β’ xβ)
simpa only [mul_smul, sub_smul, one_smul] using this
rw [GE.ge] at e1
-- Porting note: Bump index in nth_rewrite
nth_rewrite 2 [β add_zero βR β’ xβ] at e1
rw [add_le_add_iff_left, two_smul, β two_mul] at e1
rw [le_antisymm_iff]
refine β¨?_, norm_nonneg _β©
rwa [β mul_zero (2 : β), mul_le_mul_left (show (0 : β) < 2 by norm_num)] at e1
have QP_eq_QPQ : Q * P = Q * P * Q := by
have e1 : P * (1 - Q) = P * (1 - Q) - (Q * P - Q * P * Q) :=
calc
P * (1 - Q) = (1 - Q) * P * (1 - Q) := by rw [PR_eq_RPR (1 - Q) hβ.Lcomplement]
_ = P * (1 - Q) - (Q * P - Q * P * Q) := by noncomm_ring
rwa [eq_sub_iff_add_eq, add_right_eq_self, sub_eq_zero] at e1
show P * Q = Q * P
rw [QP_eq_QPQ, PR_eq_RPR Q hβ]
| [
" βxβ = β(1 - P) β’ xβ + β(1 - (1 - P)) β’ xβ",
" βxβ = βP β’ xβ + β(1 - P) β’ xβ",
" Commute P Q",
" P * R = R * P * R",
" (P * R) β’ x = (R * P * R) β’ x",
" β(P * R) β’ x - (R * P * R) β’ xβ = 0",
" βR β’ xβ = βR β’ P β’ R β’ xβ + β(1 - R) β’ P β’ R β’ xβ + (β(R * R) β’ x - R β’ P β’ R β’ xβ + β(1 - R) β’ (1 - P) β’ R β’ ... | [
" βxβ = β(1 - P) β’ xβ + β(1 - (1 - P)) β’ xβ",
" βxβ = βP β’ xβ + β(1 - P) β’ xβ"
] |
import Mathlib.Data.Vector.Basic
import Mathlib.Data.Vector.Snoc
set_option autoImplicit true
namespace Vector
section Fold
section Unary
variable (xs : Vector Ξ± n) (fβ : Ξ² β Οβ β Οβ Γ Ξ³) (fβ : Ξ± β Οβ β Οβ Γ Ξ²)
@[simp]
theorem mapAccumr_mapAccumr :
mapAccumr fβ (mapAccumr fβ xs sβ).snd sβ
= let m := (mapAccumr (fun x s =>
let rβ := fβ x s.snd
let rβ := fβ rβ.snd s.fst
((rβ.fst, rβ.fst), rβ.snd)
) xs (sβ, sβ))
(m.fst.fst, m.snd) := by
induction xs using Vector.revInductionOn generalizing sβ sβ <;> simp_all
@[simp]
| Mathlib/Data/Vector/MapLemmas.lean | 38 | 40 | theorem mapAccumr_map (fβ : Ξ± β Ξ²) :
(mapAccumr fβ (map fβ xs) s) = (mapAccumr (fun x s => fβ (fβ x) s) xs s) := by |
induction xs using Vector.revInductionOn generalizing s <;> simp_all
| [
" mapAccumr fβ (mapAccumr fβ xs sβ).2 sβ =\n let m :=\n mapAccumr\n (fun x s =>\n let rβ := fβ x s.2;\n let rβ := fβ rβ.2 s.1;\n ((rβ.1, rβ.1), rβ.2))\n xs (sβ, sβ);\n (m.1.1, m.2)",
" mapAccumr fβ (mapAccumr fβ nil sβ).2 sβ =\n let m :=\n mapAccumr\n ... | [
" mapAccumr fβ (mapAccumr fβ xs sβ).2 sβ =\n let m :=\n mapAccumr\n (fun x s =>\n let rβ := fβ x s.2;\n let rβ := fβ rβ.2 s.1;\n ((rβ.1, rβ.1), rβ.2))\n xs (sβ, sβ);\n (m.1.1, m.2)",
" mapAccumr fβ (mapAccumr fβ nil sβ).2 sβ =\n let m :=\n mapAccumr\n ... |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
section InfSet
variable [Preorder Ξ±] [InfSet Ξ±]
noncomputable def subsetInfSet [Inhabited s] : InfSet s where
sInf t :=
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β©
else default
#align subset_has_Inf subsetInfSet
attribute [local instance] subsetInfSet
@[simp]
theorem subset_sInf_def [Inhabited s] :
@sInf s _ = fun t =>
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β© else
default :=
rfl
#align subset_Inf_def subset_sInf_def
theorem subset_sInf_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddBelow t) (h : sInf ((β) '' t : Set Ξ±) β s) :
sInf ((β) '' t : Set Ξ±) = (@sInf s _ t : Ξ±) := by simp [dif_pos, h, h', h'']
#align subset_Inf_of_within subset_sInf_of_within
theorem subset_sInf_emptyset [Inhabited s] :
sInf (β
: Set s) = default := by
simp [sInf]
| Mathlib/Order/CompleteLatticeIntervals.lean | 106 | 108 | theorem subset_sInf_of_not_bddBelow [Inhabited s] {t : Set s} (ht : Β¬BddBelow t) :
sInf t = default := by |
simp [sInf, ht]
| [
" sInf (Subtype.val '' t) = β(sInf t)",
" sInf β
= default",
" sInf t = default"
] | [
" sInf (Subtype.val '' t) = β(sInf t)",
" sInf β
= default"
] |
import Mathlib.CategoryTheory.Balanced
import Mathlib.CategoryTheory.Limits.EssentiallySmall
import Mathlib.CategoryTheory.Limits.Opposites
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Subobject.Lattice
import Mathlib.CategoryTheory.Subobject.WellPowered
import Mathlib.Data.Set.Opposite
import Mathlib.Data.Set.Subsingleton
#align_import category_theory.generator from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff"
universe w vβ vβ uβ uβ
open CategoryTheory.Limits Opposite
namespace CategoryTheory
variable {C : Type uβ} [Category.{vβ} C] {D : Type uβ} [Category.{vβ} D]
def IsSeparating (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f g : X βΆ Y), (β G β π’, β (h : G βΆ X), h β« f = h β« g) β f = g
#align category_theory.is_separating CategoryTheory.IsSeparating
def IsCoseparating (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f g : X βΆ Y), (β G β π’, β (h : Y βΆ G), f β« h = g β« h) β f = g
#align category_theory.is_coseparating CategoryTheory.IsCoseparating
def IsDetecting (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f : X βΆ Y), (β G β π’, β (h : G βΆ Y), β! h' : G βΆ X, h' β« f = h) β IsIso f
#align category_theory.is_detecting CategoryTheory.IsDetecting
def IsCodetecting (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f : X βΆ Y), (β G β π’, β (h : X βΆ G), β! h' : Y βΆ G, f β« h' = h) β IsIso f
#align category_theory.is_codetecting CategoryTheory.IsCodetecting
section Dual
theorem isSeparating_op_iff (π’ : Set C) : IsSeparating π’.op β IsCoseparating π’ := by
refine β¨fun hπ’ X Y f g hfg => ?_, fun hπ’ X Y f g hfg => ?_β©
Β· refine Quiver.Hom.op_inj (hπ’ _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
Β· refine Quiver.Hom.unop_inj (hπ’ _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_separating_op_iff CategoryTheory.isSeparating_op_iff
theorem isCoseparating_op_iff (π’ : Set C) : IsCoseparating π’.op β IsSeparating π’ := by
refine β¨fun hπ’ X Y f g hfg => ?_, fun hπ’ X Y f g hfg => ?_β©
Β· refine Quiver.Hom.op_inj (hπ’ _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
Β· refine Quiver.Hom.unop_inj (hπ’ _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_coseparating_op_iff CategoryTheory.isCoseparating_op_iff
theorem isCoseparating_unop_iff (π’ : Set Cα΅α΅) : IsCoseparating π’.unop β IsSeparating π’ := by
rw [β isSeparating_op_iff, Set.unop_op]
#align category_theory.is_coseparating_unop_iff CategoryTheory.isCoseparating_unop_iff
theorem isSeparating_unop_iff (π’ : Set Cα΅α΅) : IsSeparating π’.unop β IsCoseparating π’ := by
rw [β isCoseparating_op_iff, Set.unop_op]
#align category_theory.is_separating_unop_iff CategoryTheory.isSeparating_unop_iff
| Mathlib/CategoryTheory/Generator.lean | 117 | 126 | theorem isDetecting_op_iff (π’ : Set C) : IsDetecting π’.op β IsCodetecting π’ := by |
refine β¨fun hπ’ X Y f hf => ?_, fun hπ’ X Y f hf => ?_β©
Β· refine (isIso_op_iff _).1 (hπ’ _ fun G hG h => ?_)
obtain β¨t, ht, ht'β© := hf (unop G) (Set.mem_op.1 hG) h.unop
exact
β¨t.op, Quiver.Hom.unop_inj ht, fun y hy => Quiver.Hom.unop_inj (ht' _ (Quiver.Hom.op_inj hy))β©
Β· refine (isIso_unop_iff _).1 (hπ’ _ fun G hG h => ?_)
obtain β¨t, ht, ht'β© := hf (op G) (Set.op_mem_op.2 hG) h.op
refine β¨t.unop, Quiver.Hom.op_inj ht, fun y hy => Quiver.Hom.op_inj (ht' _ ?_)β©
exact Quiver.Hom.unop_inj (by simpa only using hy)
| [
" IsSeparating π’.op β IsCoseparating π’",
" f = g",
" (h β« f.op).unop = (h β« g.op).unop",
" (f.unop β« h).op = (g.unop β« h).op",
" IsCoseparating π’.op β IsSeparating π’",
" (f.op β« h).unop = (g.op β« h).unop",
" (h β« f.unop).op = (h β« g.unop).op",
" IsCoseparating π’.unop β IsSeparating π’",
" IsSep... | [
" IsSeparating π’.op β IsCoseparating π’",
" f = g",
" (h β« f.op).unop = (h β« g.op).unop",
" (f.unop β« h).op = (g.unop β« h).op",
" IsCoseparating π’.op β IsSeparating π’",
" (f.op β« h).unop = (g.op β« h).unop",
" (h β« f.unop).op = (h β« g.unop).op",
" IsCoseparating π’.unop β IsSeparating π’",
" IsSep... |
import Mathlib.Analysis.SpecialFunctions.Complex.Arg
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Complex
open Set Filter Bornology
open scoped Real Topology ComplexConjugate
-- Porting note: @[pp_nodot] does not exist in mathlib4
noncomputable def log (x : β) : β :=
x.abs.log + arg x * I
#align complex.log Complex.log
theorem log_re (x : β) : x.log.re = x.abs.log := by simp [log]
#align complex.log_re Complex.log_re
theorem log_im (x : β) : x.log.im = x.arg := by simp [log]
#align complex.log_im Complex.log_im
theorem neg_pi_lt_log_im (x : β) : -Ο < (log x).im := by simp only [log_im, neg_pi_lt_arg]
#align complex.neg_pi_lt_log_im Complex.neg_pi_lt_log_im
theorem log_im_le_pi (x : β) : (log x).im β€ Ο := by simp only [log_im, arg_le_pi]
#align complex.log_im_le_pi Complex.log_im_le_pi
theorem exp_log {x : β} (hx : x β 0) : exp (log x) = x := by
rw [log, exp_add_mul_I, β ofReal_sin, sin_arg, β ofReal_cos, cos_arg hx, β ofReal_exp,
Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div,
mul_div_cancelβ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), β mul_assoc,
mul_div_cancelβ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im]
#align complex.exp_log Complex.exp_log
@[simp]
theorem range_exp : Set.range exp = {0}αΆ :=
Set.ext fun x =>
β¨by
rintro β¨x, rflβ©
exact exp_ne_zero x, fun hx => β¨log x, exp_log hxβ©β©
#align complex.range_exp Complex.range_exp
theorem log_exp {x : β} (hxβ : -Ο < x.im) (hxβ : x.im β€ Ο) : log (exp x) = x := by
rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, β ofReal_exp,
arg_mul_cos_add_sin_mul_I (Real.exp_pos _) β¨hxβ, hxββ©, re_add_im]
#align complex.log_exp Complex.log_exp
theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : β} (hxβ : -Ο < x.im) (hxβ : x.im β€ Ο) (hyβ : -Ο < y.im)
(hyβ : y.im β€ Ο) (hxy : exp x = exp y) : x = y := by
rw [β log_exp hxβ hxβ, β log_exp hyβ hyβ, hxy]
#align complex.exp_inj_of_neg_pi_lt_of_le_pi Complex.exp_inj_of_neg_pi_lt_of_le_pi
theorem ofReal_log {x : β} (hx : 0 β€ x) : (x.log : β) = log x :=
Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx])
(by rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx])
#align complex.of_real_log Complex.ofReal_log
@[simp, norm_cast]
lemma natCast_log {n : β} : Real.log n = log n := ofReal_natCast n βΈ ofReal_log n.cast_nonneg
@[simp]
lemma ofNat_log {n : β} [n.AtLeastTwo] :
Real.log (no_index (OfNat.ofNat n)) = log (OfNat.ofNat n) :=
natCast_log
theorem log_ofReal_re (x : β) : (log (x : β)).re = Real.log x := by simp [log_re]
#align complex.log_of_real_re Complex.log_ofReal_re
theorem log_ofReal_mul {r : β} (hr : 0 < r) {x : β} (hx : x β 0) :
log (r * x) = Real.log r + log x := by
replace hx := Complex.abs.ne_zero_iff.mpr hx
simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx,
ofReal_add, add_assoc]
#align complex.log_of_real_mul Complex.log_ofReal_mul
theorem log_mul_ofReal (r : β) (hr : 0 < r) (x : β) (hx : x β 0) :
log (x * r) = Real.log r + log x := by rw [mul_comm, log_ofReal_mul hr hx]
#align complex.log_mul_of_real Complex.log_mul_ofReal
lemma log_mul_eq_add_log_iff {x y : β} (hxβ : x β 0) (hyβ : y β 0) :
log (x * y) = log x + log y β arg x + arg y β Set.Ioc (-Ο) Ο := by
refine ext_iff.trans <| Iff.trans ?_ <| arg_mul_eq_add_arg_iff hxβ hyβ
simp_rw [add_re, add_im, log_re, log_im, AbsoluteValue.map_mul,
Real.log_mul (abs.ne_zero hxβ) (abs.ne_zero hyβ), true_and]
alias β¨_, log_mulβ© := log_mul_eq_add_log_iff
@[simp]
theorem log_zero : log 0 = 0 := by simp [log]
#align complex.log_zero Complex.log_zero
@[simp]
theorem log_one : log 1 = 0 := by simp [log]
#align complex.log_one Complex.log_one
theorem log_neg_one : log (-1) = Ο * I := by simp [log]
#align complex.log_neg_one Complex.log_neg_one
theorem log_I : log I = Ο / 2 * I := by simp [log]
set_option linter.uppercaseLean3 false in
#align complex.log_I Complex.log_I
| Mathlib/Analysis/SpecialFunctions/Complex/Log.lean | 120 | 120 | theorem log_neg_I : log (-I) = -(Ο / 2) * I := by | simp [log]
| [
" x.log.re = (abs x).log",
" x.log.im = x.arg",
" -Ο < x.log.im",
" x.log.im β€ Ο",
" cexp x.log = x",
" x β Set.range cexp β x β {0}αΆ",
" cexp x β {0}αΆ",
" (cexp x).log = x",
" x = y",
" (βx.log).re = (βx).log.re",
" (βx.log).im = (βx).log.im",
" (βx).log.re = x.log",
" (βr * x).log = βr.log... | [
" x.log.re = (abs x).log",
" x.log.im = x.arg",
" -Ο < x.log.im",
" x.log.im β€ Ο",
" cexp x.log = x",
" x β Set.range cexp β x β {0}αΆ",
" cexp x β {0}αΆ",
" (cexp x).log = x",
" x = y",
" (βx.log).re = (βx).log.re",
" (βx.log).im = (βx).log.im",
" (βx).log.re = x.log",
" (βr * x).log = βr.log... |
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.Asymptotics.Theta
import Mathlib.Analysis.Normed.Order.Basic
#align_import analysis.asymptotics.asymptotic_equivalent from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Asymptotics
open Filter Function
open Topology
section NormedAddCommGroup
variable {Ξ± Ξ² : Type*} [NormedAddCommGroup Ξ²]
def IsEquivalent (l : Filter Ξ±) (u v : Ξ± β Ξ²) :=
(u - v) =o[l] v
#align asymptotics.is_equivalent Asymptotics.IsEquivalent
@[inherit_doc] scoped notation:50 u " ~[" l:50 "] " v:50 => Asymptotics.IsEquivalent l u v
variable {u v w : Ξ± β Ξ²} {l : Filter Ξ±}
theorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v := h
#align asymptotics.is_equivalent.is_o Asymptotics.IsEquivalent.isLittleO
nonrec theorem IsEquivalent.isBigO (h : u ~[l] v) : u =O[l] v :=
(IsBigO.congr_of_sub h.isBigO.symm).mp (isBigO_refl _ _)
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O Asymptotics.IsEquivalent.isBigO
theorem IsEquivalent.isBigO_symm (h : u ~[l] v) : v =O[l] u := by
convert h.isLittleO.right_isBigO_add
simp
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O_symm Asymptotics.IsEquivalent.isBigO_symm
theorem IsEquivalent.isTheta (h : u ~[l] v) : u =Ξ[l] v :=
β¨h.isBigO, h.isBigO_symmβ©
theorem IsEquivalent.isTheta_symm (h : u ~[l] v) : v =Ξ[l] u :=
β¨h.isBigO_symm, h.isBigOβ©
@[refl]
theorem IsEquivalent.refl : u ~[l] u := by
rw [IsEquivalent, sub_self]
exact isLittleO_zero _ _
#align asymptotics.is_equivalent.refl Asymptotics.IsEquivalent.refl
@[symm]
theorem IsEquivalent.symm (h : u ~[l] v) : v ~[l] u :=
(h.isLittleO.trans_isBigO h.isBigO_symm).symm
#align asymptotics.is_equivalent.symm Asymptotics.IsEquivalent.symm
@[trans]
theorem IsEquivalent.trans {l : Filter Ξ±} {u v w : Ξ± β Ξ²} (huv : u ~[l] v) (hvw : v ~[l] w) :
u ~[l] w :=
(huv.isLittleO.trans_isBigO hvw.isBigO).triangle hvw.isLittleO
#align asymptotics.is_equivalent.trans Asymptotics.IsEquivalent.trans
theorem IsEquivalent.congr_left {u v w : Ξ± β Ξ²} {l : Filter Ξ±} (huv : u ~[l] v) (huw : u =αΆ [l] w) :
w ~[l] v :=
huv.congr' (huw.sub (EventuallyEq.refl _ _)) (EventuallyEq.refl _ _)
#align asymptotics.is_equivalent.congr_left Asymptotics.IsEquivalent.congr_left
theorem IsEquivalent.congr_right {u v w : Ξ± β Ξ²} {l : Filter Ξ±} (huv : u ~[l] v) (hvw : v =αΆ [l] w) :
u ~[l] w :=
(huv.symm.congr_left hvw).symm
#align asymptotics.is_equivalent.congr_right Asymptotics.IsEquivalent.congr_right
theorem isEquivalent_zero_iff_eventually_zero : u ~[l] 0 β u =αΆ [l] 0 := by
rw [IsEquivalent, sub_zero]
exact isLittleO_zero_right_iff
#align asymptotics.is_equivalent_zero_iff_eventually_zero Asymptotics.isEquivalent_zero_iff_eventually_zero
theorem isEquivalent_zero_iff_isBigO_zero : u ~[l] 0 β u =O[l] (0 : Ξ± β Ξ²) := by
refine β¨IsEquivalent.isBigO, fun h β¦ ?_β©
rw [isEquivalent_zero_iff_eventually_zero, eventuallyEq_iff_exists_mem]
exact β¨{ x : Ξ± | u x = 0 }, isBigO_zero_right_iff.mp h, fun x hx β¦ hxβ©
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent_zero_iff_is_O_zero Asymptotics.isEquivalent_zero_iff_isBigO_zero
theorem isEquivalent_const_iff_tendsto {c : Ξ²} (h : c β 0) :
u ~[l] const _ c β Tendsto u l (π c) := by
simp (config := { unfoldPartialApp := true }) only [IsEquivalent, const, isLittleO_const_iff h]
constructor <;> intro h
Β· have := h.sub (tendsto_const_nhds (x := -c))
simp only [Pi.sub_apply, sub_neg_eq_add, sub_add_cancel, zero_add] at this
exact this
Β· have := h.sub (tendsto_const_nhds (x := c))
rwa [sub_self] at this
#align asymptotics.is_equivalent_const_iff_tendsto Asymptotics.isEquivalent_const_iff_tendsto
| Mathlib/Analysis/Asymptotics/AsymptoticEquivalent.lean | 151 | 154 | theorem IsEquivalent.tendsto_const {c : Ξ²} (hu : u ~[l] const _ c) : Tendsto u l (π c) := by |
rcases em <| c = 0 with rfl | h
Β· exact (tendsto_congr' <| isEquivalent_zero_iff_eventually_zero.mp hu).mpr tendsto_const_nhds
Β· exact (isEquivalent_const_iff_tendsto h).mp hu
| [
" v =O[l] u",
" u xβ = (u - v) xβ + v xβ",
" u ~[l] u",
" 0 =o[l] u",
" u ~[l] 0 β u =αΆ [l] 0",
" u =o[l] 0 β u =αΆ [l] 0",
" u ~[l] 0 β u =O[l] 0",
" u ~[l] 0",
" β s β l, Set.EqOn u 0 s",
" u ~[l] const Ξ± c β Tendsto u l (π c)",
" Tendsto (u - fun x => c) l (π 0) β Tendsto u l (π c)",
" Tend... | [
" v =O[l] u",
" u xβ = (u - v) xβ + v xβ",
" u ~[l] u",
" 0 =o[l] u",
" u ~[l] 0 β u =αΆ [l] 0",
" u =o[l] 0 β u =αΆ [l] 0",
" u ~[l] 0 β u =O[l] 0",
" u ~[l] 0",
" β s β l, Set.EqOn u 0 s",
" u ~[l] const Ξ± c β Tendsto u l (π c)",
" Tendsto (u - fun x => c) l (π 0) β Tendsto u l (π c)",
" Tend... |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.Adjugate
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import linear_algebra.matrix.nonsingular_inverse from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
namespace Matrix
universe u u' v
variable {l : Type*} {m : Type u} {n : Type u'} {Ξ± : Type v}
open Matrix Equiv Equiv.Perm Finset
section Invertible
variable [Fintype n] [DecidableEq n] [CommRing Ξ±]
variable (A : Matrix n n Ξ±) (B : Matrix n n Ξ±)
def invertibleOfDetInvertible [Invertible A.det] : Invertible A where
invOf := β
A.det β’ A.adjugate
mul_invOf_self := by
rw [mul_smul_comm, mul_adjugate, smul_smul, invOf_mul_self, one_smul]
invOf_mul_self := by
rw [smul_mul_assoc, adjugate_mul, smul_smul, invOf_mul_self, one_smul]
#align matrix.invertible_of_det_invertible Matrix.invertibleOfDetInvertible
theorem invOf_eq [Invertible A.det] [Invertible A] : β
A = β
A.det β’ A.adjugate := by
letI := invertibleOfDetInvertible A
convert (rfl : β
A = _)
#align matrix.inv_of_eq Matrix.invOf_eq
def detInvertibleOfLeftInverse (h : B * A = 1) : Invertible A.det where
invOf := B.det
mul_invOf_self := by rw [mul_comm, β det_mul, h, det_one]
invOf_mul_self := by rw [β det_mul, h, det_one]
#align matrix.det_invertible_of_left_inverse Matrix.detInvertibleOfLeftInverse
def detInvertibleOfRightInverse (h : A * B = 1) : Invertible A.det where
invOf := B.det
mul_invOf_self := by rw [β det_mul, h, det_one]
invOf_mul_self := by rw [mul_comm, β det_mul, h, det_one]
#align matrix.det_invertible_of_right_inverse Matrix.detInvertibleOfRightInverse
def detInvertibleOfInvertible [Invertible A] : Invertible A.det :=
detInvertibleOfLeftInverse A (β
A) (invOf_mul_self _)
#align matrix.det_invertible_of_invertible Matrix.detInvertibleOfInvertible
theorem det_invOf [Invertible A] [Invertible A.det] : (β
A).det = β
A.det := by
letI := detInvertibleOfInvertible A
convert (rfl : _ = β
A.det)
#align matrix.det_inv_of Matrix.det_invOf
@[simps]
def invertibleEquivDetInvertible : Invertible A β Invertible A.det where
toFun := @detInvertibleOfInvertible _ _ _ _ _ A
invFun := @invertibleOfDetInvertible _ _ _ _ _ A
left_inv _ := Subsingleton.elim _ _
right_inv _ := Subsingleton.elim _ _
#align matrix.invertible_equiv_det_invertible Matrix.invertibleEquivDetInvertible
variable {A B}
| Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean | 120 | 129 | theorem mul_eq_one_comm : A * B = 1 β B * A = 1 :=
suffices β A B : Matrix n n Ξ±, A * B = 1 β B * A = 1 from β¨this A B, this B Aβ©
fun A B h => by
letI : Invertible B.det := detInvertibleOfLeftInverse _ _ h
letI : Invertible B := invertibleOfDetInvertible B
calc
B * A = B * A * (B * β
B) := by | rw [mul_invOf_self, Matrix.mul_one]
_ = B * (A * B * β
B) := by simp only [Matrix.mul_assoc]
_ = B * β
B := by rw [h, Matrix.one_mul]
_ = 1 := mul_invOf_self B
| [
" β
A.det β’ A.adjugate * A = 1",
" A * β
A.det β’ A.adjugate = 1",
" β
A = β
A.det β’ A.adjugate",
" B.det * A.det = 1",
" A.det * B.det = 1",
" (β
A).det = β
A.det",
" B * A = 1",
" B * A = B * A * (B * β
B)",
" B * A * (B * β
B) = B * (A * B * β
B)",
" B * (A * B * β
B) = B * β
B"
] | [
" β
A.det β’ A.adjugate * A = 1",
" A * β
A.det β’ A.adjugate = 1",
" β
A = β
A.det β’ A.adjugate",
" B.det * A.det = 1",
" A.det * B.det = 1",
" (β
A).det = β
A.det"
] |
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots
import Mathlib.FieldTheory.Finite.Trace
import Mathlib.Algebra.Group.AddChar
import Mathlib.Data.ZMod.Units
import Mathlib.Analysis.Complex.Polynomial
#align_import number_theory.legendre_symbol.add_character from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472"
universe u v
namespace AddChar
section Additive
-- The domain and target of our additive characters. Now we restrict to a ring in the domain.
variable {R : Type u} [CommRing R] {R' : Type v} [CommMonoid R']
lemma val_mem_rootsOfUnity (Ο : AddChar R R') (a : R) (h : 0 < ringChar R) :
(Ο.val_isUnit a).unit β rootsOfUnity (ringChar R).toPNat' R' := by
simp only [mem_rootsOfUnity', IsUnit.unit_spec, Nat.toPNat'_coe, h, βreduceIte,
β map_nsmul_eq_pow, nsmul_eq_mul, CharP.cast_eq_zero, zero_mul, map_zero_eq_one]
def IsPrimitive (Ο : AddChar R R') : Prop :=
β a : R, a β 0 β IsNontrivial (mulShift Ο a)
#align add_char.is_primitive AddChar.IsPrimitive
lemma IsPrimitive.compMulHom_of_isPrimitive {R'' : Type*} [CommMonoid R''] {Ο : AddChar R R'}
{f : R' β* R''} (hΟ : Ο.IsPrimitive) (hf : Function.Injective f) :
(f.compAddChar Ο).IsPrimitive := by
intro a a_ne_zero
obtain β¨r, ne_oneβ© := hΟ a a_ne_zero
rw [mulShift_apply] at ne_one
simp only [IsNontrivial, mulShift_apply, f.coe_compAddChar, Function.comp_apply]
exact β¨r, fun H β¦ ne_one <| hf <| f.map_one βΈ Hβ©
theorem to_mulShift_inj_of_isPrimitive {Ο : AddChar R R'} (hΟ : IsPrimitive Ο) :
Function.Injective Ο.mulShift := by
intro a b h
apply_fun fun x => x * mulShift Ο (-b) at h
simp only [mulShift_mul, mulShift_zero, add_right_neg] at h
have hβ := hΟ (a + -b)
rw [h, isNontrivial_iff_ne_trivial, β sub_eq_add_neg, sub_ne_zero] at hβ
exact not_not.mp fun h => hβ h rfl
#align add_char.to_mul_shift_inj_of_is_primitive AddChar.to_mulShift_inj_of_isPrimitive
-- `AddCommGroup.equiv_direct_sum_zmod_of_fintype`
-- gives the structure theorem for finite abelian groups.
-- This could be used to show that the map above is a bijection.
-- We leave this for a later occasion.
theorem IsNontrivial.isPrimitive {F : Type u} [Field F] {Ο : AddChar F R'} (hΟ : IsNontrivial Ο) :
IsPrimitive Ο := by
intro a ha
cases' hΟ with x h
use aβ»ΒΉ * x
rwa [mulShift_apply, mul_inv_cancel_leftβ ha]
#align add_char.is_nontrivial.is_primitive AddChar.IsNontrivial.isPrimitive
lemma not_isPrimitive_mulShift [Finite R] (e : AddChar R R') {r : R}
(hr : Β¬ IsUnit r) : Β¬ IsPrimitive (e.mulShift r) := by
simp only [IsPrimitive, not_forall]
simp only [isUnit_iff_mem_nonZeroDivisors_of_finite, mem_nonZeroDivisors_iff, not_forall] at hr
rcases hr with β¨x, h, h'β©
exact β¨x, h', by simp only [mulShift_mulShift, mul_comm r, h, mulShift_zero, not_ne_iff,
isNontrivial_iff_ne_trivial]β©
-- Porting note(#5171): this linter isn't ported yet.
-- can't prove that they always exist (referring to providing an `Inhabited` instance)
-- @[nolint has_nonempty_instance]
structure PrimitiveAddChar (R : Type u) [CommRing R] (R' : Type v) [Field R'] where
n : β+
char : AddChar R (CyclotomicField n R')
prim : IsPrimitive char
#align add_char.primitive_add_char AddChar.PrimitiveAddChar
#align add_char.primitive_add_char.n AddChar.PrimitiveAddChar.n
#align add_char.primitive_add_char.char AddChar.PrimitiveAddChar.char
#align add_char.primitive_add_char.prim AddChar.PrimitiveAddChar.prim
section ZModChar
variable {C : Type v} [CommMonoid C]
theorem zmod_char_isNontrivial_iff (n : β+) (Ο : AddChar (ZMod n) C) :
IsNontrivial Ο β Ο 1 β 1 := by
refine β¨?_, fun h => β¨1, hβ©β©
contrapose!
rintro hβ β¨a, haβ©
have haβ : a = a.val β’ (1 : ZMod βn) := by
rw [nsmul_eq_mul, mul_one]; exact (ZMod.natCast_zmod_val a).symm
rw [haβ, map_nsmul_eq_pow, hβ, one_pow] at ha
exact ha rfl
#align add_char.zmod_char_is_nontrivial_iff AddChar.zmod_char_isNontrivial_iff
| Mathlib/NumberTheory/LegendreSymbol/AddCharacter.lean | 189 | 192 | theorem IsPrimitive.zmod_char_eq_one_iff (n : β+) {Ο : AddChar (ZMod n) C} (hΟ : IsPrimitive Ο)
(a : ZMod n) : Ο a = 1 β a = 0 := by |
refine β¨fun h => not_imp_comm.mp (hΟ a) ?_, fun ha => by rw [ha, map_zero_eq_one]β©
rw [zmod_char_isNontrivial_iff n (mulShift Ο a), mulShift_apply, mul_one, h, Classical.not_not]
| [
" β―.unit β rootsOfUnity (ringChar R).toPNat' R'",
" (f.compAddChar Ο).IsPrimitive",
" ((f.compAddChar Ο).mulShift a).IsNontrivial",
" β a_1, f (Ο (a * a_1)) β 1",
" Function.Injective Ο.mulShift",
" a = b",
" Ο.IsPrimitive",
" (Ο.mulShift a).IsNontrivial",
" (Ο.mulShift a) (aβ»ΒΉ * x) β 1",
" Β¬(e.mu... | [
" β―.unit β rootsOfUnity (ringChar R).toPNat' R'",
" (f.compAddChar Ο).IsPrimitive",
" ((f.compAddChar Ο).mulShift a).IsNontrivial",
" β a_1, f (Ο (a * a_1)) β 1",
" Function.Injective Ο.mulShift",
" a = b",
" Ο.IsPrimitive",
" (Ο.mulShift a).IsNontrivial",
" (Ο.mulShift a) (aβ»ΒΉ * x) β 1",
" Β¬(e.mu... |
import Mathlib.CategoryTheory.Sites.Coherent.ReflectsPreregular
import Mathlib.Topology.Category.CompHaus.EffectiveEpi
import Mathlib.Topology.Category.Profinite.Limits
import Mathlib.Topology.Category.Stonean.Basic
universe u
attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike
open CategoryTheory Limits
namespace Profinite
noncomputable
def struct {B X : Profinite.{u}} (Ο : X βΆ B) (hΟ : Function.Surjective Ο) :
EffectiveEpiStruct Ο where
desc e h := (QuotientMap.of_surjective_continuous hΟ Ο.continuous).lift e fun a b hab β¦
DFunLike.congr_fun (h β¨fun _ β¦ a, continuous_constβ© β¨fun _ β¦ b, continuous_constβ©
(by ext; exact hab)) a
fac e h := ((QuotientMap.of_surjective_continuous hΟ Ο.continuous).lift_comp e
fun a b hab β¦ DFunLike.congr_fun (h β¨fun _ β¦ a, continuous_constβ© β¨fun _ β¦ b, continuous_constβ©
(by ext; exact hab)) a)
uniq e h g hm := by
suffices g = (QuotientMap.of_surjective_continuous hΟ Ο.continuous).liftEquiv β¨e,
fun a b hab β¦ DFunLike.congr_fun
(h β¨fun _ β¦ a, continuous_constβ© β¨fun _ β¦ b, continuous_constβ© (by ext; exact hab))
aβ© by assumption
rw [β Equiv.symm_apply_eq (QuotientMap.of_surjective_continuous hΟ Ο.continuous).liftEquiv]
ext
simp only [QuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, β hm]
rfl
open List in
theorem effectiveEpi_tfae
{B X : Profinite.{u}} (Ο : X βΆ B) :
TFAE
[ EffectiveEpi Ο
, Epi Ο
, Function.Surjective Ο
] := by
tfae_have 1 β 2
Β· intro; infer_instance
tfae_have 2 β 3
Β· exact epi_iff_surjective Ο
tfae_have 3 β 1
Β· exact fun hΟ β¦ β¨β¨struct Ο hΟβ©β©
tfae_finish
instance : profiniteToCompHaus.PreservesEffectiveEpis where
preserves f h :=
((CompHaus.effectiveEpi_tfae _).out 0 2).mpr (((Profinite.effectiveEpi_tfae _).out 0 2).mp h)
instance : profiniteToCompHaus.ReflectsEffectiveEpis where
reflects f h :=
((Profinite.effectiveEpi_tfae f).out 0 2).mpr (((CompHaus.effectiveEpi_tfae _).out 0 2).mp h)
noncomputable def profiniteToCompHausEffectivePresentation (X : CompHaus) :
profiniteToCompHaus.EffectivePresentation X where
p := Stonean.toProfinite.obj X.presentation
f := CompHaus.presentation.Ο X
effectiveEpi := ((CompHaus.effectiveEpi_tfae _).out 0 1).mpr (inferInstance : Epi _)
instance : profiniteToCompHaus.EffectivelyEnough where
presentation X := β¨profiniteToCompHausEffectivePresentation Xβ©
instance : Preregular Profinite.{u} := profiniteToCompHaus.reflects_preregular
example : Precoherent Profinite.{u} := inferInstance
-- TODO: prove this for `Type*`
open List in
| Mathlib/Topology/Category/Profinite/EffectiveEpi.lean | 110 | 128 | theorem effectiveEpiFamily_tfae
{Ξ± : Type} [Finite Ξ±] {B : Profinite.{u}}
(X : Ξ± β Profinite.{u}) (Ο : (a : Ξ±) β (X a βΆ B)) :
TFAE
[ EffectiveEpiFamily X Ο
, Epi (Sigma.desc Ο)
, β b : B, β (a : Ξ±) (x : X a), Ο a x = b
] := by |
tfae_have 2 β 1
Β· intro
simpa [β effectiveEpi_desc_iff_effectiveEpiFamily, (effectiveEpi_tfae (Sigma.desc Ο)).out 0 1]
tfae_have 1 β 2
Β· intro; infer_instance
tfae_have 3 β 1
Β· erw [((CompHaus.effectiveEpiFamily_tfae
(fun a β¦ profiniteToCompHaus.obj (X a)) (fun a β¦ profiniteToCompHaus.map (Ο a))).out 2 0 : )]
exact β¨fun h β¦ profiniteToCompHaus.finite_effectiveEpiFamily_of_map _ _ h,
fun _ β¦ inferInstanceβ©
tfae_finish
| [
" { toFun := fun x => a, continuous_toFun := β― } β« Ο = { toFun := fun x => b, continuous_toFun := β― } β« Ο",
" ({ toFun := fun x => a, continuous_toFun := β― } β« Ο) xβ = ({ toFun := fun x => b, continuous_toFun := β― } β« Ο) xβ",
" g = (fun {W} e h => β―.lift e β―) e β―",
" g = β―.liftEquiv β¨e, β―β©",
" β―.liftEquiv.s... | [
" { toFun := fun x => a, continuous_toFun := β― } β« Ο = { toFun := fun x => b, continuous_toFun := β― } β« Ο",
" ({ toFun := fun x => a, continuous_toFun := β― } β« Ο) xβ = ({ toFun := fun x => b, continuous_toFun := β― } β« Ο) xβ",
" g = (fun {W} e h => β―.lift e β―) e β―",
" g = β―.liftEquiv β¨e, β―β©",
" β―.liftEquiv.s... |
import Mathlib.Algebra.EuclideanDomain.Defs
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Regular
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Basic
#align_import algebra.euclidean_domain.basic from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u
namespace EuclideanDomain
variable {R : Type u}
variable [EuclideanDomain R]
local infixl:50 " βΊ " => EuclideanDomain.R
-- See note [lower instance priority]
instance (priority := 100) toMulDivCancelClass : MulDivCancelClass R where
mul_div_cancel a b hb := by
refine (eq_of_sub_eq_zero ?_).symm
by_contra h
have := mul_right_not_lt b h
rw [sub_mul, mul_comm (_ / _), sub_eq_iff_eq_add'.2 (div_add_mod (a * b) b).symm] at this
exact this (mod_lt _ hb)
#align euclidean_domain.mul_div_cancel_left mul_div_cancel_leftβ
#align euclidean_domain.mul_div_cancel mul_div_cancel_rightβ
@[simp]
theorem mod_eq_zero {a b : R} : a % b = 0 β b β£ a :=
β¨fun h => by
rw [β div_add_mod a b, h, add_zero]
exact dvd_mul_right _ _, fun β¨c, eβ© => by
rw [e, β add_left_cancel_iff, div_add_mod, add_zero]
haveI := Classical.dec
by_cases b0 : b = 0
Β· simp only [b0, zero_mul]
Β· rw [mul_div_cancel_leftβ _ b0]β©
#align euclidean_domain.mod_eq_zero EuclideanDomain.mod_eq_zero
@[simp]
theorem mod_self (a : R) : a % a = 0 :=
mod_eq_zero.2 dvd_rfl
#align euclidean_domain.mod_self EuclideanDomain.mod_self
theorem dvd_mod_iff {a b c : R} (h : c β£ b) : c β£ a % b β c β£ a := by
rw [β dvd_add_right (h.mul_right _), div_add_mod]
#align euclidean_domain.dvd_mod_iff EuclideanDomain.dvd_mod_iff
@[simp]
theorem mod_one (a : R) : a % 1 = 0 :=
mod_eq_zero.2 (one_dvd _)
#align euclidean_domain.mod_one EuclideanDomain.mod_one
@[simp]
theorem zero_mod (b : R) : 0 % b = 0 :=
mod_eq_zero.2 (dvd_zero _)
#align euclidean_domain.zero_mod EuclideanDomain.zero_mod
@[simp]
theorem zero_div {a : R} : 0 / a = 0 :=
by_cases (fun a0 : a = 0 => a0.symm βΈ div_zero 0) fun a0 => by
simpa only [zero_mul] using mul_div_cancel_rightβ 0 a0
#align euclidean_domain.zero_div EuclideanDomain.zero_div
@[simp]
| Mathlib/Algebra/EuclideanDomain/Basic.lean | 84 | 85 | theorem div_self {a : R} (a0 : a β 0) : a / a = 1 := by |
simpa only [one_mul] using mul_div_cancel_rightβ 1 a0
| [
" a * b / b = a",
" a - a * b / b = 0",
" False",
" b β£ a",
" b β£ b * (a / b)",
" a % b = 0",
" b * c = b * (b * c / b)",
" c β£ a % b β c β£ a",
" 0 / a = 0",
" a / a = 1"
] | [
" a * b / b = a",
" a - a * b / b = 0",
" False",
" b β£ a",
" b β£ b * (a / b)",
" a % b = 0",
" b * c = b * (b * c / b)",
" c β£ a % b β c β£ a",
" 0 / a = 0"
] |
import Mathlib.Data.Set.Image
import Mathlib.Data.List.GetD
#align_import data.set.list from "leanprover-community/mathlib"@"2ec920d35348cb2d13ac0e1a2ad9df0fdf1a76b4"
open List
variable {Ξ± Ξ² : Type*} (l : List Ξ±)
namespace Set
theorem range_list_map (f : Ξ± β Ξ²) : range (map f) = { l | β x β l, x β range f } := by
refine antisymm (range_subset_iff.2 fun l => forall_mem_map_iff.2 fun y _ => mem_range_self _)
fun l hl => ?_
induction' l with a l ihl; Β· exact β¨[], rflβ©
rcases ihl fun x hx => hl x <| subset_cons _ _ hx with β¨l, rflβ©
rcases hl a (mem_cons_self _ _) with β¨a, rflβ©
exact β¨a :: l, map_cons _ _ _β©
#align set.range_list_map Set.range_list_map
theorem range_list_map_coe (s : Set Ξ±) : range (map ((β) : s β Ξ±)) = { l | β x β l, x β s } := by
rw [range_list_map, Subtype.range_coe]
#align set.range_list_map_coe Set.range_list_map_coe
@[simp]
| Mathlib/Data/Set/List.lean | 38 | 40 | theorem range_list_get : range l.get = { x | x β l } := by |
ext x
rw [mem_setOf_eq, mem_iff_get, mem_range]
| [
" range (map f) = {l | β x β l, x β range f}",
" l β range (map f)",
" [] β range (map f)",
" a :: l β range (map f)",
" a :: map f l β range (map f)",
" f a :: map f l β range (map f)",
" range (map Subtype.val) = {l | β x β l, x β s}",
" range l.get = {x | x β l}",
" x β range l.get β x β {x | x β... | [
" range (map f) = {l | β x β l, x β range f}",
" l β range (map f)",
" [] β range (map f)",
" a :: l β range (map f)",
" a :: map f l β range (map f)",
" f a :: map f l β range (map f)",
" range (map Subtype.val) = {l | β x β l, x β s}"
] |
import Mathlib.Analysis.Normed.Group.Quotient
import Mathlib.Topology.Instances.AddCircle
#align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c"
noncomputable section
open Set
open Int hiding mem_zmultiples_iff
open AddSubgroup
namespace AddCircle
variable (p : β)
instance : NormedAddCommGroup (AddCircle p) :=
AddSubgroup.normedAddCommGroupQuotient _
@[simp]
| Mathlib/Analysis/Normed/Group/AddCircle.lean | 44 | 68 | theorem norm_coe_mul (x : β) (t : β) :
β(β(t * x) : AddCircle (t * p))β = |t| * β(x : AddCircle p)β := by |
have aux : β {a b c : β}, a β zmultiples b β c * a β zmultiples (c * b) := fun {a b c} h => by
simp only [mem_zmultiples_iff] at h β’
obtain β¨n, rflβ© := h
exact β¨n, (mul_smul_comm n c b).symmβ©
rcases eq_or_ne t 0 with (rfl | ht); Β· simp
have ht' : |t| β 0 := (not_congr abs_eq_zero).mpr ht
simp only [quotient_norm_eq, Real.norm_eq_abs]
conv_rhs => rw [β smul_eq_mul, β Real.sInf_smul_of_nonneg (abs_nonneg t)]
simp only [QuotientAddGroup.mk'_apply, QuotientAddGroup.eq_iff_sub_mem]
congr 1
ext z
rw [mem_smul_set_iff_inv_smul_memβ ht']
show
(β y, y - t * x β zmultiples (t * p) β§ |y| = z) β β w, w - x β zmultiples p β§ |w| = |t|β»ΒΉ * z
constructor
Β· rintro β¨y, hy, rflβ©
refine β¨tβ»ΒΉ * y, ?_, by rw [abs_mul, abs_inv]β©
rw [β inv_mul_cancel_leftβ ht x, β inv_mul_cancel_leftβ ht p, β mul_sub]
exact aux hy
Β· rintro β¨w, hw, hw'β©
refine β¨t * w, ?_, by rw [β (eq_inv_mul_iff_mul_eqβ ht').mp hw', abs_mul]β©
rw [β mul_sub]
exact aux hw
| [
" ββ(t * x)β = |t| * ββxβ",
" c * a β zmultiples (c * b)",
" β k, k β’ (c * b) = c * a",
" β k, k β’ (c * b) = c * n β’ b",
" ββ(0 * x)β = |0| * ββxβ",
" sInf ((fun a => |a|) '' {m | βm = β(t * x)}) = |t| * sInf ((fun a => |a|) '' {m | βm = βx})",
"p x t : β\naux : β {a b c : β}, a β zmultiples b β c * a β... | [] |
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.OrdConnected
#align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c"
variable {Ξ± Ξ² : Type*} [LinearOrder Ξ±]
open Function
namespace Set
def projIci (a x : Ξ±) : Ici a := β¨max a x, le_max_left _ _β©
#align set.proj_Ici Set.projIci
def projIic (b x : Ξ±) : Iic b := β¨min b x, min_le_left _ _β©
#align set.proj_Iic Set.projIic
def projIcc (a b : Ξ±) (h : a β€ b) (x : Ξ±) : Icc a b :=
β¨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)β©
#align set.proj_Icc Set.projIcc
variable {a b : Ξ±} (h : a β€ b) {x : Ξ±}
@[norm_cast]
theorem coe_projIci (a x : Ξ±) : (projIci a x : Ξ±) = max a x := rfl
#align set.coe_proj_Ici Set.coe_projIci
@[norm_cast]
theorem coe_projIic (b x : Ξ±) : (projIic b x : Ξ±) = min b x := rfl
#align set.coe_proj_Iic Set.coe_projIic
@[norm_cast]
theorem coe_projIcc (a b : Ξ±) (h : a β€ b) (x : Ξ±) : (projIcc a b h x : Ξ±) = max a (min b x) := rfl
#align set.coe_proj_Icc Set.coe_projIcc
theorem projIci_of_le (hx : x β€ a) : projIci a x = β¨a, le_rflβ© := Subtype.ext <| max_eq_left hx
#align set.proj_Ici_of_le Set.projIci_of_le
theorem projIic_of_le (hx : b β€ x) : projIic b x = β¨b, le_rflβ© := Subtype.ext <| min_eq_left hx
#align set.proj_Iic_of_le Set.projIic_of_le
theorem projIcc_of_le_left (hx : x β€ a) : projIcc a b h x = β¨a, left_mem_Icc.2 hβ© := by
simp [projIcc, hx, hx.trans h]
#align set.proj_Icc_of_le_left Set.projIcc_of_le_left
theorem projIcc_of_right_le (hx : b β€ x) : projIcc a b h x = β¨b, right_mem_Icc.2 hβ© := by
simp [projIcc, hx, h]
#align set.proj_Icc_of_right_le Set.projIcc_of_right_le
@[simp]
theorem projIci_self (a : Ξ±) : projIci a a = β¨a, le_rflβ© := projIci_of_le le_rfl
#align set.proj_Ici_self Set.projIci_self
@[simp]
theorem projIic_self (b : Ξ±) : projIic b b = β¨b, le_rflβ© := projIic_of_le le_rfl
#align set.proj_Iic_self Set.projIic_self
@[simp]
theorem projIcc_left : projIcc a b h a = β¨a, left_mem_Icc.2 hβ© :=
projIcc_of_le_left h le_rfl
#align set.proj_Icc_left Set.projIcc_left
@[simp]
theorem projIcc_right : projIcc a b h b = β¨b, right_mem_Icc.2 hβ© :=
projIcc_of_right_le h le_rfl
#align set.proj_Icc_right Set.projIcc_right
| Mathlib/Order/Interval/Set/ProjIcc.lean | 99 | 99 | theorem projIci_eq_self : projIci a x = β¨a, le_rflβ© β x β€ a := by | simp [projIci, Subtype.ext_iff]
| [
" projIcc a b h x = β¨a, β―β©",
" projIcc a b h x = β¨b, β―β©",
" projIci a x = β¨a, β―β© β x β€ a"
] | [
" projIcc a b h x = β¨a, β―β©",
" projIcc a b h x = β¨b, β―β©"
] |
import Mathlib.Analysis.Complex.UpperHalfPlane.Topology
import Mathlib.Analysis.SpecialFunctions.Arsinh
import Mathlib.Geometry.Euclidean.Inversion.Basic
#align_import analysis.complex.upper_half_plane.metric from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c"
noncomputable section
open scoped UpperHalfPlane ComplexConjugate NNReal Topology MatrixGroups
open Set Metric Filter Real
variable {z w : β} {r R : β}
namespace UpperHalfPlane
instance : Dist β :=
β¨fun z w => 2 * arsinh (dist (z : β) w / (2 * β(z.im * w.im)))β©
theorem dist_eq (z w : β) : dist z w = 2 * arsinh (dist (z : β) w / (2 * β(z.im * w.im))) :=
rfl
#align upper_half_plane.dist_eq UpperHalfPlane.dist_eq
theorem sinh_half_dist (z w : β) :
sinh (dist z w / 2) = dist (z : β) w / (2 * β(z.im * w.im)) := by
rw [dist_eq, mul_div_cancel_leftβ (arsinh _) two_ne_zero, sinh_arsinh]
#align upper_half_plane.sinh_half_dist UpperHalfPlane.sinh_half_dist
theorem cosh_half_dist (z w : β) :
cosh (dist z w / 2) = dist (z : β) (conj (w : β)) / (2 * β(z.im * w.im)) := by
rw [β sq_eq_sq, cosh_sq', sinh_half_dist, div_pow, div_pow, one_add_div, mul_pow, sq_sqrt]
Β· congr 1
simp only [Complex.dist_eq, Complex.sq_abs, Complex.normSq_sub, Complex.normSq_conj,
Complex.conj_conj, Complex.mul_re, Complex.conj_re, Complex.conj_im, coe_im]
ring
all_goals positivity
#align upper_half_plane.cosh_half_dist UpperHalfPlane.cosh_half_dist
theorem tanh_half_dist (z w : β) :
tanh (dist z w / 2) = dist (z : β) w / dist (z : β) (conj βw) := by
rw [tanh_eq_sinh_div_cosh, sinh_half_dist, cosh_half_dist, div_div_div_comm, div_self, div_one]
positivity
#align upper_half_plane.tanh_half_dist UpperHalfPlane.tanh_half_dist
theorem exp_half_dist (z w : β) :
exp (dist z w / 2) = (dist (z : β) w + dist (z : β) (conj βw)) / (2 * β(z.im * w.im)) := by
rw [β sinh_add_cosh, sinh_half_dist, cosh_half_dist, add_div]
#align upper_half_plane.exp_half_dist UpperHalfPlane.exp_half_dist
theorem cosh_dist (z w : β) : cosh (dist z w) = 1 + dist (z : β) w ^ 2 / (2 * z.im * w.im) := by
rw [dist_eq, cosh_two_mul, cosh_sq', add_assoc, β two_mul, sinh_arsinh, div_pow, mul_pow,
sq_sqrt, sq (2 : β), mul_assoc, β mul_div_assoc, mul_assoc, mul_div_mul_left] <;> positivity
#align upper_half_plane.cosh_dist UpperHalfPlane.cosh_dist
| Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean | 76 | 84 | theorem sinh_half_dist_add_dist (a b c : β) : sinh ((dist a b + dist b c) / 2) =
(dist (a : β) b * dist (c : β) (conj βb) + dist (b : β) c * dist (a : β) (conj βb)) /
(2 * β(a.im * c.im) * dist (b : β) (conj βb)) := by |
simp only [add_div _ _ (2 : β), sinh_add, sinh_half_dist, cosh_half_dist, div_mul_div_comm]
rw [β add_div, Complex.dist_self_conj, coe_im, abs_of_pos b.im_pos, mul_comm (dist (b : β) _),
dist_comm (b : β), Complex.dist_conj_comm, mul_mul_mul_comm, mul_mul_mul_comm _ _ _ b.im]
congr 2
rw [sqrt_mul, sqrt_mul, sqrt_mul, mul_comm (βa.im), mul_mul_mul_comm, mul_self_sqrt,
mul_comm] <;> exact (im_pos _).le
| [
" (dist z w / 2).sinh = dist βz βw / (2 * β(z.im * w.im))",
" (dist z w / 2).cosh = dist (βz) ((starRingEnd β) βw) / (2 * β(z.im * w.im))",
" (2 ^ 2 * (z.im * w.im) + dist βz βw ^ 2) / (2 ^ 2 * (z.im * w.im)) =\n dist (βz) ((starRingEnd β) βw) ^ 2 / (2 ^ 2 * (z.im * w.im))",
" 2 ^ 2 * (z.im * w.im) + dist ... | [
" (dist z w / 2).sinh = dist βz βw / (2 * β(z.im * w.im))",
" (dist z w / 2).cosh = dist (βz) ((starRingEnd β) βw) / (2 * β(z.im * w.im))",
" (2 ^ 2 * (z.im * w.im) + dist βz βw ^ 2) / (2 ^ 2 * (z.im * w.im)) =\n dist (βz) ((starRingEnd β) βw) ^ 2 / (2 ^ 2 * (z.im * w.im))",
" 2 ^ 2 * (z.im * w.im) + dist ... |
import Mathlib.Analysis.Calculus.TangentCone
import Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics
#align_import analysis.calculus.fderiv.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
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']
@[mk_iff hasFDerivAtFilter_iff_isLittleO]
structure HasFDerivAtFilter (f : E β F) (f' : E βL[π] F) (x : E) (L : Filter E) : Prop where
of_isLittleO :: isLittleO : (fun x' => f x' - f x - f' (x' - x)) =o[L] fun x' => x' - x
#align has_fderiv_at_filter HasFDerivAtFilter
@[fun_prop]
def HasFDerivWithinAt (f : E β F) (f' : E βL[π] F) (s : Set E) (x : E) :=
HasFDerivAtFilter f f' x (π[s] x)
#align has_fderiv_within_at HasFDerivWithinAt
@[fun_prop]
def HasFDerivAt (f : E β F) (f' : E βL[π] F) (x : E) :=
HasFDerivAtFilter f f' x (π x)
#align has_fderiv_at HasFDerivAt
@[fun_prop]
def HasStrictFDerivAt (f : E β F) (f' : E βL[π] F) (x : E) :=
(fun p : E Γ E => f p.1 - f p.2 - f' (p.1 - p.2)) =o[π (x, x)] fun p : E Γ E => p.1 - p.2
#align has_strict_fderiv_at HasStrictFDerivAt
variable (π)
@[fun_prop]
def DifferentiableWithinAt (f : E β F) (s : Set E) (x : E) :=
β f' : E βL[π] F, HasFDerivWithinAt f f' s x
#align differentiable_within_at DifferentiableWithinAt
@[fun_prop]
def DifferentiableAt (f : E β F) (x : E) :=
β f' : E βL[π] F, HasFDerivAt f f' x
#align differentiable_at DifferentiableAt
irreducible_def fderivWithin (f : E β F) (s : Set E) (x : E) : E βL[π] F :=
if π[s \ {x}] x = β₯ then 0 else
if h : β f', HasFDerivWithinAt f f' s x then Classical.choose h else 0
#align fderiv_within fderivWithin
irreducible_def fderiv (f : E β F) (x : E) : E βL[π] F :=
if h : β f', HasFDerivAt f f' x then Classical.choose h else 0
#align fderiv fderiv
@[fun_prop]
def DifferentiableOn (f : E β F) (s : Set E) :=
β x β s, DifferentiableWithinAt π f s x
#align differentiable_on DifferentiableOn
@[fun_prop]
def Differentiable (f : E β F) :=
β x, DifferentiableAt π f x
#align differentiable Differentiable
variable {π}
variable {f fβ fβ g : E β F}
variable {f' fβ' fβ' g' : E βL[π] F}
variable (e : E βL[π] F)
variable {x : E}
variable {s t : Set E}
variable {L Lβ Lβ : Filter E}
| Mathlib/Analysis/Calculus/FDeriv/Basic.lean | 216 | 217 | theorem fderivWithin_zero_of_isolated (h : π[s \ {x}] x = β₯) : fderivWithin π f s x = 0 := by |
rw [fderivWithin, if_pos h]
| [
" fderivWithin π f s x = 0"
] | [] |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {Ξ± Ξ² K : Type*}
section DivisionMonoid
variable [DivisionMonoid K] [HasDistribNeg K] {a b : K}
theorem one_div_neg_one_eq_neg_one : (1 : K) / -1 = -1 :=
have : -1 * -1 = (1 : K) := by rw [neg_mul_neg, one_mul]
Eq.symm (eq_one_div_of_mul_eq_one_right this)
#align one_div_neg_one_eq_neg_one one_div_neg_one_eq_neg_one
theorem one_div_neg_eq_neg_one_div (a : K) : 1 / -a = -(1 / a) :=
calc
1 / -a = 1 / (-1 * a) := by rw [neg_eq_neg_one_mul]
_ = 1 / a * (1 / -1) := by rw [one_div_mul_one_div_rev]
_ = 1 / a * -1 := by rw [one_div_neg_one_eq_neg_one]
_ = -(1 / a) := by rw [mul_neg, mul_one]
#align one_div_neg_eq_neg_one_div one_div_neg_eq_neg_one_div
theorem div_neg_eq_neg_div (a b : K) : b / -a = -(b / a) :=
calc
b / -a = b * (1 / -a) := by rw [β inv_eq_one_div, division_def]
_ = b * -(1 / a) := by rw [one_div_neg_eq_neg_one_div]
_ = -(b * (1 / a)) := by rw [neg_mul_eq_mul_neg]
_ = -(b / a) := by rw [mul_one_div]
#align div_neg_eq_neg_div div_neg_eq_neg_div
theorem neg_div (a b : K) : -b / a = -(b / a) := by
rw [neg_eq_neg_one_mul, mul_div_assoc, β neg_eq_neg_one_mul]
#align neg_div neg_div
@[field_simps]
theorem neg_div' (a b : K) : -(b / a) = -b / a := by simp [neg_div]
#align neg_div' neg_div'
@[simp]
| Mathlib/Algebra/Field/Basic.lean | 126 | 126 | theorem neg_div_neg_eq (a b : K) : -a / -b = a / b := by | rw [div_neg_eq_neg_div, neg_div, neg_neg]
| [
" -1 * -1 = 1",
" 1 / -a = 1 / (-1 * a)",
" 1 / (-1 * a) = 1 / a * (1 / -1)",
" 1 / a * (1 / -1) = 1 / a * -1",
" 1 / a * -1 = -(1 / a)",
" b / -a = b * (1 / -a)",
" b * (1 / -a) = b * -(1 / a)",
" b * -(1 / a) = -(b * (1 / a))",
" -(b * (1 / a)) = -(b / a)",
" -b / a = -(b / a)",
" -(b / a) = -... | [
" -1 * -1 = 1",
" 1 / -a = 1 / (-1 * a)",
" 1 / (-1 * a) = 1 / a * (1 / -1)",
" 1 / a * (1 / -1) = 1 / a * -1",
" 1 / a * -1 = -(1 / a)",
" b / -a = b * (1 / -a)",
" b * (1 / -a) = b * -(1 / a)",
" b * -(1 / a) = -(b * (1 / a))",
" -(b * (1 / a)) = -(b / a)",
" -b / a = -(b / a)",
" -(b / a) = -... |
import Mathlib.Algebra.Polynomial.Monic
#align_import algebra.polynomial.big_operators from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
open Finset
open Multiset
open Polynomial
universe u w
variable {R : Type u} {ΞΉ : Type w}
namespace Polynomial
variable (s : Finset ΞΉ)
section CommRing
variable [CommRing R]
open Monic
-- Eventually this can be generalized with Vieta's formulas
-- plus the connection between roots and factorization.
theorem multiset_prod_X_sub_C_nextCoeff (t : Multiset R) :
nextCoeff (t.map fun x => X - C x).prod = -t.sum := by
rw [nextCoeff_multiset_prod]
Β· simp only [nextCoeff_X_sub_C]
exact t.sum_hom (-AddMonoidHom.id R)
Β· intros
apply monic_X_sub_C
set_option linter.uppercaseLean3 false in
#align polynomial.multiset_prod_X_sub_C_next_coeff Polynomial.multiset_prod_X_sub_C_nextCoeff
| Mathlib/Algebra/Polynomial/BigOperators.lean | 263 | 265 | theorem prod_X_sub_C_nextCoeff {s : Finset ΞΉ} (f : ΞΉ β R) :
nextCoeff (β i β s, (X - C (f i))) = -β i β s, f i := by |
simpa using multiset_prod_X_sub_C_nextCoeff (s.1.map f)
| [
" (Multiset.map (fun x => X - C x) t).prod.nextCoeff = -t.sum",
" (Multiset.map (fun i => (X - C i).nextCoeff) t).sum = -t.sum",
" (Multiset.map (fun x => -x) t).sum = -t.sum",
" β i β t, (X - C i).Monic",
" (X - C iβ).Monic",
" (β i β s, (X - C (f i))).nextCoeff = -β i β s, f i"
] | [
" (Multiset.map (fun x => X - C x) t).prod.nextCoeff = -t.sum",
" (Multiset.map (fun i => (X - C i).nextCoeff) t).sum = -t.sum",
" (Multiset.map (fun x => -x) t).sum = -t.sum",
" β i β t, (X - C i).Monic",
" (X - C iβ).Monic"
] |
import Mathlib.RingTheory.Polynomial.Cyclotomic.Basic
import Mathlib.RingTheory.RootsOfUnity.Minpoly
#align_import ring_theory.polynomial.cyclotomic.roots from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
namespace Polynomial
variable {R : Type*} [CommRing R] {n : β}
| Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean | 40 | 49 | theorem isRoot_of_unity_of_root_cyclotomic {ΞΆ : R} {i : β} (hi : i β n.divisors)
(h : (cyclotomic i R).IsRoot ΞΆ) : ΞΆ ^ n = 1 := by |
rcases n.eq_zero_or_pos with (rfl | hn)
Β· exact pow_zero _
have := congr_arg (eval ΞΆ) (prod_cyclotomic_eq_X_pow_sub_one hn R).symm
rw [eval_sub, eval_pow, eval_X, eval_one] at this
convert eq_add_of_sub_eq' this
convert (add_zero (M := R) _).symm
apply eval_eq_zero_of_dvd_of_eval_eq_zero _ h
exact Finset.dvd_prod_of_mem _ hi
| [
" ΞΆ ^ n = 1",
" ΞΆ ^ 0 = 1",
" 1 = 1 + eval ΞΆ (β i β n.divisors, cyclotomic i R)",
" eval ΞΆ (β i β n.divisors, cyclotomic i R) = 0",
" cyclotomic i R β£ β i β n.divisors, cyclotomic i R"
] | [] |
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow
import Mathlib.Data.Finset.Fold
import Mathlib.Data.Finset.Option
import Mathlib.Data.Finset.Pi
import Mathlib.Data.Finset.Prod
import Mathlib.Data.Multiset.Lattice
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Hom.Lattice
import Mathlib.Order.Nat
#align_import data.finset.lattice from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
open Function Multiset OrderDual
variable {F Ξ± Ξ² Ξ³ ΞΉ ΞΊ : Type*}
namespace Finset
section Sup
-- TODO: define with just `[Bot Ξ±]` where some lemmas hold without requiring `[OrderBot Ξ±]`
variable [SemilatticeSup Ξ±] [OrderBot Ξ±]
def sup (s : Finset Ξ²) (f : Ξ² β Ξ±) : Ξ± :=
s.fold (Β· β Β·) β₯ f
#align finset.sup Finset.sup
variable {s sβ sβ : Finset Ξ²} {f g : Ξ² β Ξ±} {a : Ξ±}
theorem sup_def : s.sup f = (s.1.map f).sup :=
rfl
#align finset.sup_def Finset.sup_def
@[simp]
theorem sup_empty : (β
: Finset Ξ²).sup f = β₯ :=
fold_empty
#align finset.sup_empty Finset.sup_empty
@[simp]
theorem sup_cons {b : Ξ²} (h : b β s) : (cons b s h).sup f = f b β s.sup f :=
fold_cons h
#align finset.sup_cons Finset.sup_cons
@[simp]
theorem sup_insert [DecidableEq Ξ²] {b : Ξ²} : (insert b s : Finset Ξ²).sup f = f b β s.sup f :=
fold_insert_idem
#align finset.sup_insert Finset.sup_insert
@[simp]
theorem sup_image [DecidableEq Ξ²] (s : Finset Ξ³) (f : Ξ³ β Ξ²) (g : Ξ² β Ξ±) :
(s.image f).sup g = s.sup (g β f) :=
fold_image_idem
#align finset.sup_image Finset.sup_image
@[simp]
theorem sup_map (s : Finset Ξ³) (f : Ξ³ βͺ Ξ²) (g : Ξ² β Ξ±) : (s.map f).sup g = s.sup (g β f) :=
fold_map
#align finset.sup_map Finset.sup_map
@[simp]
theorem sup_singleton {b : Ξ²} : ({b} : Finset Ξ²).sup f = f b :=
Multiset.sup_singleton
#align finset.sup_singleton Finset.sup_singleton
theorem sup_sup : s.sup (f β g) = s.sup f β s.sup g := by
induction s using Finset.cons_induction with
| empty => rw [sup_empty, sup_empty, sup_empty, bot_sup_eq]
| cons _ _ _ ih =>
rw [sup_cons, sup_cons, sup_cons, ih]
exact sup_sup_sup_comm _ _ _ _
#align finset.sup_sup Finset.sup_sup
| Mathlib/Data/Finset/Lattice.lean | 90 | 93 | theorem sup_congr {f g : Ξ² β Ξ±} (hs : sβ = sβ) (hfg : β a β sβ, f a = g a) :
sβ.sup f = sβ.sup g := by |
subst hs
exact Finset.fold_congr hfg
| [
" s.sup (f β g) = s.sup f β s.sup g",
" β
.sup (f β g) = β
.sup f β β
.sup g",
" (cons aβ sβ hβ).sup (f β g) = (cons aβ sβ hβ).sup f β (cons aβ sβ hβ).sup g",
" (f β g) aβ β (sβ.sup f β sβ.sup g) = f aβ β sβ.sup f β (g aβ β sβ.sup g)",
" sβ.sup f = sβ.sup g",
" sβ.sup f = sβ.sup g"
] | [
" s.sup (f β g) = s.sup f β s.sup g",
" β
.sup (f β g) = β
.sup f β β
.sup g",
" (cons aβ sβ hβ).sup (f β g) = (cons aβ sβ hβ).sup f β (cons aβ sβ hβ).sup g",
" (f β g) aβ β (sβ.sup f β sβ.sup g) = f aβ β sβ.sup f β (g aβ β sβ.sup g)"
] |
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
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
#align real.exp_one_near_20 Real.exp_one_near_20
theorem exp_one_gt_d9 : 2.7182818283 < exp 1 :=
lt_of_lt_of_le (by norm_num) (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2)
#align real.exp_one_gt_d9 Real.exp_one_gt_d9
theorem exp_one_lt_d9 : exp 1 < 2.7182818286 :=
lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) (by norm_num)
#align real.exp_one_lt_d9 Real.exp_one_lt_d9
theorem exp_neg_one_gt_d9 : 0.36787944116 < exp (-1) := by
rw [exp_neg, lt_inv _ (exp_pos _)]
Β· refine lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) ?_
norm_num
Β· norm_num
#align real.exp_neg_one_gt_d9 Real.exp_neg_one_gt_d9
| Mathlib/Data/Complex/ExponentialBounds.lean | 51 | 55 | theorem exp_neg_one_lt_d9 : exp (-1) < 0.3678794412 := by |
rw [exp_neg, inv_lt (exp_pos _)]
Β· refine lt_of_lt_of_le ?_ (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2)
norm_num
Β· norm_num
| [
" |rexp 1 - 2244083 / 825552| β€ 1 / 10 ^ 10",
" |rexp 1 - expNear 0 1 (2244083 / 825552)| β€ |1| ^ 0 / β(Nat.factorial 0) * (1 / 10 ^ 10)",
" 0 + 1 = ?m.532",
" 1 = ?m.532",
" β1 = ?m.543",
" |rexp 1 - expNear 1 1 ((2244083 / 825552 - 1) * 1)| β€ |1| ^ 1 / β(Nat.factorial 1) * (1 / 10 ^ 10 * 1)",
" 1 + 1 ... | [
" |rexp 1 - 2244083 / 825552| β€ 1 / 10 ^ 10",
" |rexp 1 - expNear 0 1 (2244083 / 825552)| β€ |1| ^ 0 / β(Nat.factorial 0) * (1 / 10 ^ 10)",
" 0 + 1 = ?m.532",
" 1 = ?m.532",
" β1 = ?m.543",
" |rexp 1 - expNear 1 1 ((2244083 / 825552 - 1) * 1)| β€ |1| ^ 1 / β(Nat.factorial 1) * (1 / 10 ^ 10 * 1)",
" 1 + 1 ... |
import Mathlib.Algebra.EuclideanDomain.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Algebra.GCDMonoid.Nat
#align_import ring_theory.int.basic from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
theorem Int.Prime.dvd_mul {m n : β€} {p : β} (hp : Nat.Prime p) (h : (p : β€) β£ m * n) :
p β£ m.natAbs β¨ p β£ n.natAbs := by
rwa [β hp.dvd_mul, β Int.natAbs_mul, β Int.natCast_dvd]
#align int.prime.dvd_mul Int.Prime.dvd_mul
theorem Int.Prime.dvd_mul' {m n : β€} {p : β} (hp : Nat.Prime p) (h : (p : β€) β£ m * n) :
(p : β€) β£ m β¨ (p : β€) β£ n := by
rw [Int.natCast_dvd, Int.natCast_dvd]
exact Int.Prime.dvd_mul hp h
#align int.prime.dvd_mul' Int.Prime.dvd_mul'
theorem Int.Prime.dvd_pow {n : β€} {k p : β} (hp : Nat.Prime p) (h : (p : β€) β£ n ^ k) :
p β£ n.natAbs := by
rw [Int.natCast_dvd, Int.natAbs_pow] at h
exact hp.dvd_of_dvd_pow h
#align int.prime.dvd_pow Int.Prime.dvd_pow
theorem Int.Prime.dvd_pow' {n : β€} {k p : β} (hp : Nat.Prime p) (h : (p : β€) β£ n ^ k) :
(p : β€) β£ n := by
rw [Int.natCast_dvd]
exact Int.Prime.dvd_pow hp h
#align int.prime.dvd_pow' Int.Prime.dvd_pow'
theorem prime_two_or_dvd_of_dvd_two_mul_pow_self_two {m : β€} {p : β} (hp : Nat.Prime p)
(h : (p : β€) β£ 2 * m ^ 2) : p = 2 β¨ p β£ Int.natAbs m := by
cases' Int.Prime.dvd_mul hp h with hp2 hpp
Β· apply Or.intro_left
exact le_antisymm (Nat.le_of_dvd zero_lt_two hp2) (Nat.Prime.two_le hp)
Β· apply Or.intro_right
rw [sq, Int.natAbs_mul] at hpp
exact or_self_iff.mp ((Nat.Prime.dvd_mul hp).mp hpp)
#align prime_two_or_dvd_of_dvd_two_mul_pow_self_two prime_two_or_dvd_of_dvd_two_mul_pow_self_two
theorem Int.exists_prime_and_dvd {n : β€} (hn : n.natAbs β 1) : β p, Prime p β§ p β£ n := by
obtain β¨p, pp, pdβ© := Nat.exists_prime_and_dvd hn
exact β¨p, Nat.prime_iff_prime_int.mp pp, Int.natCast_dvd.mpr pdβ©
#align int.exists_prime_and_dvd Int.exists_prime_and_dvd
theorem Int.prime_iff_natAbs_prime {k : β€} : Prime k β Nat.Prime k.natAbs :=
(Int.associated_natAbs k).prime_iff.trans Nat.prime_iff_prime_int.symm
#align int.prime_iff_nat_abs_prime Int.prime_iff_natAbs_prime
namespace Int
theorem zmultiples_natAbs (a : β€) :
AddSubgroup.zmultiples (a.natAbs : β€) = AddSubgroup.zmultiples a :=
le_antisymm (AddSubgroup.zmultiples_le_of_mem (mem_zmultiples_iff.mpr (dvd_natAbs.mpr dvd_rfl)))
(AddSubgroup.zmultiples_le_of_mem (mem_zmultiples_iff.mpr (natAbs_dvd.mpr dvd_rfl)))
#align int.zmultiples_nat_abs Int.zmultiples_natAbs
theorem span_natAbs (a : β€) : Ideal.span ({(a.natAbs : β€)} : Set β€) = Ideal.span {a} := by
rw [Ideal.span_singleton_eq_span_singleton]
exact (associated_natAbs _).symm
#align int.span_nat_abs Int.span_natAbs
section bit
set_option linter.deprecated false
| Mathlib/RingTheory/Int/Basic.lean | 147 | 152 | theorem eq_pow_of_mul_eq_pow_bit1_left {a b c : β€} (hab : IsCoprime a b) {k : β}
(h : a * b = c ^ bit1 k) : β d, a = d ^ bit1 k := by |
obtain β¨d, hdβ© := exists_associated_pow_of_mul_eq_pow' hab h
replace hd := hd.symm
rw [associated_iff_natAbs, natAbs_eq_natAbs_iff, β neg_pow_bit1] at hd
obtain rfl | rfl := hd <;> exact β¨_, rflβ©
| [
" p β£ m.natAbs β¨ p β£ n.natAbs",
" βp β£ m β¨ βp β£ n",
" p β£ n.natAbs",
" βp β£ n",
" p = 2 β¨ p β£ m.natAbs",
" p = 2",
" p β£ m.natAbs",
" β p, Prime p β§ p β£ n",
" Ideal.span {βa.natAbs} = Ideal.span {a}",
" Associated (βa.natAbs) a",
" β d, a = d ^ bit1 k",
" β d_1, d ^ bit1 k = d_1 ^ bit1 k",
"... | [
" p β£ m.natAbs β¨ p β£ n.natAbs",
" βp β£ m β¨ βp β£ n",
" p β£ n.natAbs",
" βp β£ n",
" p = 2 β¨ p β£ m.natAbs",
" p = 2",
" p β£ m.natAbs",
" β p, Prime p β§ p β£ n",
" Ideal.span {βa.natAbs} = Ideal.span {a}",
" Associated (βa.natAbs) a"
] |
import Mathlib.Algebra.Order.Ring.Nat
#align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b"
namespace Nat
def dist (n m : β) :=
n - m + (m - n)
#align nat.dist Nat.dist
-- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet.
#noalign nat.dist.def
theorem dist_comm (n m : β) : dist n m = dist m n := by simp [dist, add_comm]
#align nat.dist_comm Nat.dist_comm
@[simp]
theorem dist_self (n : β) : dist n n = 0 := by simp [dist, tsub_self]
#align nat.dist_self Nat.dist_self
theorem eq_of_dist_eq_zero {n m : β} (h : dist n m = 0) : n = m :=
have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h
have : n β€ m := tsub_eq_zero_iff_le.mp this
have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h
have : m β€ n := tsub_eq_zero_iff_le.mp this
le_antisymm βΉn β€ mβΊ βΉm β€ nβΊ
#align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero
theorem dist_eq_zero {n m : β} (h : n = m) : dist n m = 0 := by rw [h, dist_self]
#align nat.dist_eq_zero Nat.dist_eq_zero
theorem dist_eq_sub_of_le {n m : β} (h : n β€ m) : dist n m = m - n := by
rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add]
#align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le
theorem dist_eq_sub_of_le_right {n m : β} (h : m β€ n) : dist n m = n - m := by
rw [dist_comm]; apply dist_eq_sub_of_le h
#align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right
theorem dist_tri_left (n m : β) : m β€ dist n m + n :=
le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _)
#align nat.dist_tri_left Nat.dist_tri_left
theorem dist_tri_right (n m : β) : m β€ n + dist n m := by rw [add_comm]; apply dist_tri_left
#align nat.dist_tri_right Nat.dist_tri_right
theorem dist_tri_left' (n m : β) : n β€ dist n m + m := by rw [dist_comm]; apply dist_tri_left
#align nat.dist_tri_left' Nat.dist_tri_left'
theorem dist_tri_right' (n m : β) : n β€ m + dist n m := by rw [dist_comm]; apply dist_tri_right
#align nat.dist_tri_right' Nat.dist_tri_right'
theorem dist_zero_right (n : β) : dist n 0 = n :=
Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n)
#align nat.dist_zero_right Nat.dist_zero_right
theorem dist_zero_left (n : β) : dist 0 n = n :=
Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n)
#align nat.dist_zero_left Nat.dist_zero_left
| Mathlib/Data/Nat/Dist.lean | 74 | 78 | theorem dist_add_add_right (n k m : β) : dist (n + k) (m + k) = dist n m :=
calc
dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl
_ = n - m + (m + k - (n + k)) := by | rw [@add_tsub_add_eq_tsub_right]
_ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right]
| [
" n.dist m = m.dist n",
" n.dist n = 0",
" n.dist m = 0",
" n.dist m = m - n",
" n.dist m = n - m",
" m.dist n = n - m",
" m β€ n + n.dist m",
" m β€ n.dist m + n",
" n β€ n.dist m + m",
" n β€ m.dist n + m",
" n β€ m + n.dist m",
" n β€ m + m.dist n",
" n + k - (m + k) + (m + k - (n + k)) = n - m... | [
" n.dist m = m.dist n",
" n.dist n = 0",
" n.dist m = 0",
" n.dist m = m - n",
" n.dist m = n - m",
" m.dist n = n - m",
" m β€ n + n.dist m",
" m β€ n.dist m + n",
" n β€ n.dist m + m",
" n β€ m.dist n + m",
" n β€ m + n.dist m",
" n β€ m + m.dist n"
] |
import Mathlib.ModelTheory.Quotients
import Mathlib.Order.Filter.Germ
import Mathlib.Order.Filter.Ultrafilter
#align_import model_theory.ultraproducts from "leanprover-community/mathlib"@"f1ae620609496a37534c2ab3640b641d5be8b6f0"
universe u v
variable {Ξ± : Type*} (M : Ξ± β Type*) (u : Ultrafilter Ξ±)
open FirstOrder Filter
open Filter
namespace FirstOrder
namespace Language
open Structure
variable {L : Language.{u, v}} [β a, L.Structure (M a)]
namespace Ultraproduct
instance setoidPrestructure : L.Prestructure ((u : Filter Ξ±).productSetoid M) :=
{ (u : Filter Ξ±).productSetoid M with
toStructure :=
{ funMap := fun {n} f x a => funMap f fun i => x i a
RelMap := fun {n} r x => βαΆ a : Ξ± in u, RelMap r fun i => x i a }
fun_equiv := fun {n} f x y xy => by
refine mem_of_superset (iInter_mem.2 xy) fun a ha => ?_
simp only [Set.mem_iInter, Set.mem_setOf_eq] at ha
simp only [Set.mem_setOf_eq, ha]
rel_equiv := fun {n} r x y xy => by
rw [β iff_eq_eq]
refine β¨fun hx => ?_, fun hy => ?_β©
Β· refine mem_of_superset (inter_mem hx (iInter_mem.2 xy)) ?_
rintro a β¨ha1, ha2β©
simp only [Set.mem_iInter, Set.mem_setOf_eq] at *
rw [β funext ha2]
exact ha1
Β· refine mem_of_superset (inter_mem hy (iInter_mem.2 xy)) ?_
rintro a β¨ha1, ha2β©
simp only [Set.mem_iInter, Set.mem_setOf_eq] at *
rw [funext ha2]
exact ha1 }
#align first_order.language.ultraproduct.setoid_prestructure FirstOrder.Language.Ultraproduct.setoidPrestructure
variable {M} {u}
instance Β«structureΒ» : L.Structure ((u : Filter Ξ±).Product M) :=
Language.quotientStructure
set_option linter.uppercaseLean3 false in
#align first_order.language.ultraproduct.Structure FirstOrder.Language.Ultraproduct.structure
theorem funMap_cast {n : β} (f : L.Functions n) (x : Fin n β β a, M a) :
(funMap f fun i => (x i : (u : Filter Ξ±).Product M)) =
(fun a => funMap f fun i => x i a : (u : Filter Ξ±).Product M) := by
apply funMap_quotient_mk'
#align first_order.language.ultraproduct.fun_map_cast FirstOrder.Language.Ultraproduct.funMap_cast
theorem term_realize_cast {Ξ² : Type*} (x : Ξ² β β a, M a) (t : L.Term Ξ²) :
(t.realize fun i => (x i : (u : Filter Ξ±).Product M)) =
(fun a => t.realize fun i => x i a : (u : Filter Ξ±).Product M) := by
convert @Term.realize_quotient_mk' L _ ((u : Filter Ξ±).productSetoid M)
(Ultraproduct.setoidPrestructure M u) _ t x using 2
ext a
induction t with
| var => rfl
| func _ _ t_ih => simp only [Term.realize, t_ih]; rfl
#align first_order.language.ultraproduct.term_realize_cast FirstOrder.Language.Ultraproduct.term_realize_cast
variable [β a : Ξ±, Nonempty (M a)]
| Mathlib/ModelTheory/Ultraproducts.lean | 96 | 144 | theorem boundedFormula_realize_cast {Ξ² : Type*} {n : β} (Ο : L.BoundedFormula Ξ² n)
(x : Ξ² β β a, M a) (v : Fin n β β a, M a) :
(Ο.Realize (fun i : Ξ² => (x i : (u : Filter Ξ±).Product M))
(fun i => (v i : (u : Filter Ξ±).Product M))) β
βαΆ a : Ξ± in u, Ο.Realize (fun i : Ξ² => x i a) fun i => v i a := by |
letI := (u : Filter Ξ±).productSetoid M
induction' Ο with _ _ _ _ _ _ _ _ m _ _ ih ih' k Ο ih
Β· simp only [BoundedFormula.Realize, eventually_const]
Β· have h2 : β a : Ξ±, (Sum.elim (fun i : Ξ² => x i a) fun i => v i a) = fun i => Sum.elim x v i a :=
fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl
simp only [BoundedFormula.Realize, h2, term_realize_cast]
erw [(Sum.comp_elim ((β) : (β a, M a) β (u : Filter Ξ±).Product M) x v).symm,
term_realize_cast, term_realize_cast]
exact Quotient.eq''
Β· have h2 : β a : Ξ±, (Sum.elim (fun i : Ξ² => x i a) fun i => v i a) = fun i => Sum.elim x v i a :=
fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl
simp only [BoundedFormula.Realize, h2]
erw [(Sum.comp_elim ((β) : (β a, M a) β (u : Filter Ξ±).Product M) x v).symm]
conv_lhs => enter [2, i]; erw [term_realize_cast]
apply relMap_quotient_mk'
Β· simp only [BoundedFormula.Realize, ih v, ih' v]
rw [Ultrafilter.eventually_imp]
Β· simp only [BoundedFormula.Realize]
apply Iff.trans (b := β m : β a : Ξ±, M a,
Ο.Realize (fun i : Ξ² => (x i : (u : Filter Ξ±).Product M))
(Fin.snoc (((β) : (β a, M a) β (u : Filter Ξ±).Product M) β v)
(m : (u : Filter Ξ±).Product M)))
Β· exact Quotient.forall
have h' :
β (m : β a, M a) (a : Ξ±),
(fun i : Fin (k + 1) => (Fin.snoc v m : _ β β a, M a) i a) =
Fin.snoc (fun i : Fin k => v i a) (m a) := by
refine fun m a => funext (Fin.reverseInduction ?_ fun i _ => ?_)
Β· simp only [Fin.snoc_last]
Β· simp only [Fin.snoc_castSucc]
simp only [β Fin.comp_snoc]
simp only [Function.comp, ih, h']
refine β¨fun h => ?_, fun h m => ?_β©
Β· contrapose! h
simp_rw [β Ultrafilter.eventually_not, not_forall] at h
refine
β¨fun a : Ξ± =>
Classical.epsilon fun m : M a =>
Β¬Ο.Realize (fun i => x i a) (Fin.snoc (fun i => v i a) m),
?_β©
rw [β Ultrafilter.eventually_not]
exact Filter.mem_of_superset h fun a ha => Classical.epsilon_spec ha
Β· rw [Filter.eventually_iff] at *
exact Filter.mem_of_superset h fun a ha => ha (m a)
| [
" funMap f x β funMap f y",
" a β {x_1 | (fun a => funMap f x a = funMap f y a) x_1}",
" RelMap r x = RelMap r y",
" RelMap r x β RelMap r y",
" RelMap r y",
" {x_1 | (fun a => RelMap r fun i => x i a) x_1} β© β i, {x_1 | (fun a => x i a = y i a) x_1} β\n {x | (fun a => RelMap r fun i => y i a) x}",
"... | [
" funMap f x β funMap f y",
" a β {x_1 | (fun a => funMap f x a = funMap f y a) x_1}",
" RelMap r x = RelMap r y",
" RelMap r x β RelMap r y",
" RelMap r y",
" {x_1 | (fun a => RelMap r fun i => x i a) x_1} β© β i, {x_1 | (fun a => x i a = y i a) x_1} β\n {x | (fun a => RelMap r fun i => y i a) x}",
"... |
import Mathlib.Data.List.Basic
#align_import data.list.palindrome from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
variable {Ξ± Ξ² : Type*}
namespace List
inductive Palindrome : List Ξ± β Prop
| nil : Palindrome []
| singleton : β x, Palindrome [x]
| cons_concat : β (x) {l}, Palindrome l β Palindrome (x :: (l ++ [x]))
#align list.palindrome List.Palindrome
namespace Palindrome
variable {l : List Ξ±}
theorem reverse_eq {l : List Ξ±} (p : Palindrome l) : reverse l = l := by
induction p <;> try (exact rfl)
simpa
#align list.palindrome.reverse_eq List.Palindrome.reverse_eq
theorem of_reverse_eq {l : List Ξ±} : reverse l = l β Palindrome l := by
refine bidirectionalRecOn l (fun _ => Palindrome.nil) (fun a _ => Palindrome.singleton a) ?_
intro x l y hp hr
rw [reverse_cons, reverse_append] at hr
rw [head_eq_of_cons_eq hr]
have : Palindrome l := hp (append_inj_left' (tail_eq_of_cons_eq hr) rfl)
exact Palindrome.cons_concat x this
#align list.palindrome.of_reverse_eq List.Palindrome.of_reverse_eq
theorem iff_reverse_eq {l : List Ξ±} : Palindrome l β reverse l = l :=
Iff.intro reverse_eq of_reverse_eq
#align list.palindrome.iff_reverse_eq List.Palindrome.iff_reverse_eq
| Mathlib/Data/List/Palindrome.lean | 68 | 70 | theorem append_reverse (l : List Ξ±) : Palindrome (l ++ reverse l) := by |
apply of_reverse_eq
rw [reverse_append, reverse_reverse]
| [
" l.reverse = l",
" [].reverse = []",
" [xβ].reverse = [xβ]",
" (xβ :: (lβ ++ [xβ])).reverse = xβ :: (lβ ++ [xβ])",
" l.reverse = l β l.Palindrome",
" β (a : Ξ±) (l : List Ξ±) (b : Ξ±),\n (l.reverse = l β l.Palindrome) β (a :: (l ++ [b])).reverse = a :: (l ++ [b]) β (a :: (l ++ [b])).Palindrome",
" (x :... | [
" l.reverse = l",
" [].reverse = []",
" [xβ].reverse = [xβ]",
" (xβ :: (lβ ++ [xβ])).reverse = xβ :: (lβ ++ [xβ])",
" l.reverse = l β l.Palindrome",
" β (a : Ξ±) (l : List Ξ±) (b : Ξ±),\n (l.reverse = l β l.Palindrome) β (a :: (l ++ [b])).reverse = a :: (l ++ [b]) β (a :: (l ++ [b])).Palindrome",
" (x :... |
import Mathlib.Data.Finset.Image
#align_import data.finset.card from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
assert_not_exists MonoidWithZero
-- TODO: After a lot more work,
-- assert_not_exists OrderedCommMonoid
open Function Multiset Nat
variable {Ξ± Ξ² R : Type*}
namespace Finset
variable {s t : Finset Ξ±} {a b : Ξ±}
def card (s : Finset Ξ±) : β :=
Multiset.card s.1
#align finset.card Finset.card
theorem card_def (s : Finset Ξ±) : s.card = Multiset.card s.1 :=
rfl
#align finset.card_def Finset.card_def
@[simp] lemma card_val (s : Finset Ξ±) : Multiset.card s.1 = s.card := rfl
#align finset.card_val Finset.card_val
@[simp]
theorem card_mk {m nodup} : (β¨m, nodupβ© : Finset Ξ±).card = Multiset.card m :=
rfl
#align finset.card_mk Finset.card_mk
@[simp]
theorem card_empty : card (β
: Finset Ξ±) = 0 :=
rfl
#align finset.card_empty Finset.card_empty
@[gcongr]
theorem card_le_card : s β t β s.card β€ t.card :=
Multiset.card_le_card β val_le_iff.mpr
#align finset.card_le_of_subset Finset.card_le_card
@[mono]
theorem card_mono : Monotone (@card Ξ±) := by apply card_le_card
#align finset.card_mono Finset.card_mono
@[simp] lemma card_eq_zero : s.card = 0 β s = β
:= card_eq_zero.trans val_eq_zero
lemma card_ne_zero : s.card β 0 β s.Nonempty := card_eq_zero.ne.trans nonempty_iff_ne_empty.symm
lemma card_pos : 0 < s.card β s.Nonempty := Nat.pos_iff_ne_zero.trans card_ne_zero
#align finset.card_eq_zero Finset.card_eq_zero
#align finset.card_pos Finset.card_pos
alias β¨_, Nonempty.card_posβ© := card_pos
alias β¨_, Nonempty.card_ne_zeroβ© := card_ne_zero
#align finset.nonempty.card_pos Finset.Nonempty.card_pos
theorem card_ne_zero_of_mem (h : a β s) : s.card β 0 :=
(not_congr card_eq_zero).2 <| ne_empty_of_mem h
#align finset.card_ne_zero_of_mem Finset.card_ne_zero_of_mem
@[simp]
theorem card_singleton (a : Ξ±) : card ({a} : Finset Ξ±) = 1 :=
Multiset.card_singleton _
#align finset.card_singleton Finset.card_singleton
theorem card_singleton_inter [DecidableEq Ξ±] : ({a} β© s).card β€ 1 := by
cases' Finset.decidableMem a s with h h
Β· simp [Finset.singleton_inter_of_not_mem h]
Β· simp [Finset.singleton_inter_of_mem h]
#align finset.card_singleton_inter Finset.card_singleton_inter
@[simp]
theorem card_cons (h : a β s) : (s.cons a h).card = s.card + 1 :=
Multiset.card_cons _ _
#align finset.card_cons Finset.card_cons
section InsertErase
variable [DecidableEq Ξ±]
@[simp]
theorem card_insert_of_not_mem (h : a β s) : (insert a s).card = s.card + 1 := by
rw [β cons_eq_insert _ _ h, card_cons]
#align finset.card_insert_of_not_mem Finset.card_insert_of_not_mem
theorem card_insert_of_mem (h : a β s) : card (insert a s) = s.card := by rw [insert_eq_of_mem h]
#align finset.card_insert_of_mem Finset.card_insert_of_mem
| Mathlib/Data/Finset/Card.lean | 114 | 118 | theorem card_insert_le (a : Ξ±) (s : Finset Ξ±) : card (insert a s) β€ s.card + 1 := by |
by_cases h : a β s
Β· rw [insert_eq_of_mem h]
exact Nat.le_succ _
Β· rw [card_insert_of_not_mem h]
| [
" Monotone card",
" ({a} β© s).card β€ 1",
" (insert a s).card = s.card + 1",
" (insert a s).card = s.card",
" (insert a s).card β€ s.card + 1",
" s.card β€ s.card + 1"
] | [
" Monotone card",
" ({a} β© s).card β€ 1",
" (insert a s).card = s.card + 1",
" (insert a s).card = s.card"
] |
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Directed
#align_import data.set.Union_lift from "leanprover-community/mathlib"@"5a4ea8453f128345f73cc656e80a49de2a54f481"
variable {Ξ± : Type*} {ΞΉ Ξ² : Sort _}
namespace Set
section UnionLift
@[nolint unusedArguments]
noncomputable def iUnionLift (S : ΞΉ β Set Ξ±) (f : β i, S i β Ξ²)
(_ : β (i j) (x : Ξ±) (hxi : x β S i) (hxj : x β S j), f i β¨x, hxiβ© = f j β¨x, hxjβ©) (T : Set Ξ±)
(hT : T β iUnion S) (x : T) : Ξ² :=
let i := Classical.indefiniteDescription _ (mem_iUnion.1 (hT x.prop))
f i β¨x, i.propβ©
#align set.Union_lift Set.iUnionLift
variable {S : ΞΉ β Set Ξ±} {f : β i, S i β Ξ²}
{hf : β (i j) (x : Ξ±) (hxi : x β S i) (hxj : x β S j), f i β¨x, hxiβ© = f j β¨x, hxjβ©} {T : Set Ξ±}
{hT : T β iUnion S} (hT' : T = iUnion S)
@[simp]
theorem iUnionLift_mk {i : ΞΉ} (x : S i) (hx : (x : Ξ±) β T) :
iUnionLift S f hf T hT β¨x, hxβ© = f i x := hf _ i x _ _
#align set.Union_lift_mk Set.iUnionLift_mk
@[simp]
theorem iUnionLift_inclusion {i : ΞΉ} (x : S i) (h : S i β T) :
iUnionLift S f hf T hT (Set.inclusion h x) = f i x :=
iUnionLift_mk x _
#align set.Union_lift_inclusion Set.iUnionLift_inclusion
| Mathlib/Data/Set/UnionLift.lean | 75 | 76 | theorem iUnionLift_of_mem (x : T) {i : ΞΉ} (hx : (x : Ξ±) β S i) :
iUnionLift S f hf T hT x = f i β¨x, hxβ© := by | cases' x with x hx; exact hf _ _ _ _ _
| [
" iUnionLift S f hf T hT x = f i β¨βx, hxβ©",
" iUnionLift S f hf T hT β¨x, hxββ© = f i β¨ββ¨x, hxββ©, hxβ©"
] | [] |
import Mathlib.AlgebraicTopology.DoldKan.FunctorGamma
import Mathlib.AlgebraicTopology.DoldKan.SplitSimplicialObject
import Mathlib.CategoryTheory.Idempotents.HomologicalComplex
#align_import algebraic_topology.dold_kan.gamma_comp_n from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
CategoryTheory.Idempotents Opposite SimplicialObject Simplicial
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] [HasFiniteCoproducts C]
@[simps!]
def ΞβNondegComplexIso (K : ChainComplex C β) : (Ξβ.splitting K).nondegComplex β
K :=
HomologicalComplex.Hom.isoOfComponents (fun n => Iso.refl _)
(by
rintro _ n (rfl : n + 1 = _)
dsimp
simp only [id_comp, comp_id, AlternatingFaceMapComplex.obj_d_eq, Preadditive.sum_comp,
Preadditive.comp_sum]
rw [Fintype.sum_eq_single (0 : Fin (n + 2))]
Β· simp only [Fin.val_zero, pow_zero, one_zsmul]
erw [Ξβ.Obj.mapMono_on_summand_id_assoc, Ξβ.Obj.Termwise.mapMono_Ξ΄β,
Splitting.cofan_inj_ΟSummand_eq_id, comp_id]
Β· intro i hi
dsimp
simp only [Preadditive.zsmul_comp, Preadditive.comp_zsmul, assoc]
erw [Ξβ.Obj.mapMono_on_summand_id_assoc, Ξβ.Obj.Termwise.mapMono_eq_zero, zero_comp,
zsmul_zero]
Β· intro h
replace h := congr_arg SimplexCategory.len h
change n + 1 = n at h
omega
Β· simpa only [IsΞ΄β.iff] using hi)
#align algebraic_topology.dold_kan.Ξβ_nondeg_complex_iso AlgebraicTopology.DoldKan.ΞβNondegComplexIso
def Ξβ'CompNondegComplexFunctor : Ξβ' β Split.nondegComplexFunctor β
π (ChainComplex C β) :=
NatIso.ofComponents ΞβNondegComplexIso
#align algebraic_topology.dold_kan.Ξβ'_comp_nondeg_complex_functor AlgebraicTopology.DoldKan.Ξβ'CompNondegComplexFunctor
def NβΞβ : Ξβ β Nβ β
toKaroubi (ChainComplex C β) :=
calc
Ξβ β Nβ β
Ξβ' β Split.forget C β Nβ := Functor.associator _ _ _
_ β
Ξβ' β Split.nondegComplexFunctor β toKaroubi _ :=
(isoWhiskerLeft Ξβ' Split.toKaroubiNondegComplexFunctorIsoNβ.symm)
_ β
(Ξβ' β Split.nondegComplexFunctor) β toKaroubi _ := (Functor.associator _ _ _).symm
_ β
π _ β toKaroubi (ChainComplex C β) := isoWhiskerRight Ξβ'CompNondegComplexFunctor _
_ β
toKaroubi (ChainComplex C β) := Functor.leftUnitor _
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.NβΞβ AlgebraicTopology.DoldKan.NβΞβ
theorem NβΞβ_app (K : ChainComplex C β) :
NβΞβ.app K = (Ξβ.splitting K).toKaroubiNondegComplexIsoNβ.symm βͺβ«
(toKaroubi _).mapIso (ΞβNondegComplexIso K) := by
ext1
dsimp [NβΞβ]
erw [id_comp, comp_id, comp_id]
rfl
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.NβΞβ_app AlgebraicTopology.DoldKan.NβΞβ_app
| Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean | 86 | 91 | theorem NβΞβ_hom_app (K : ChainComplex C β) :
NβΞβ.hom.app K = (Ξβ.splitting K).toKaroubiNondegComplexIsoNβ.inv β«
(toKaroubi _).map (ΞβNondegComplexIso K).hom := by |
change (NβΞβ.app K).hom = _
simp only [NβΞβ_app]
rfl
| [
" β (i j : β),\n (ComplexShape.down β).Rel i j β\n ((fun n => Iso.refl ((Ξβ.splitting K).nondegComplex.X n)) i).hom β« K.d i j =\n (Ξβ.splitting K).nondegComplex.d i j β« ((fun n => Iso.refl ((Ξβ.splitting K).nondegComplex.X n)) j).hom",
" ((fun n => Iso.refl ((Ξβ.splitting K).nondegComplex.X n)) (n ... | [
" β (i j : β),\n (ComplexShape.down β).Rel i j β\n ((fun n => Iso.refl ((Ξβ.splitting K).nondegComplex.X n)) i).hom β« K.d i j =\n (Ξβ.splitting K).nondegComplex.d i j β« ((fun n => Iso.refl ((Ξβ.splitting K).nondegComplex.X n)) j).hom",
" ((fun n => Iso.refl ((Ξβ.splitting K).nondegComplex.X n)) (n ... |
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.RingTheory.Ideal.Quotient
#align_import linear_algebra.smodeq from "leanprover-community/mathlib"@"146d3d1fa59c091fedaad8a4afa09d6802886d24"
open Submodule
open Polynomial
variable {R : Type*} [Ring R]
variable {A : Type*} [CommRing A]
variable {M : Type*} [AddCommGroup M] [Module R M] (U Uβ Uβ : Submodule R M)
variable {x xβ xβ y yβ yβ z zβ zβ : M}
variable {N : Type*} [AddCommGroup N] [Module R N] (V Vβ Vβ : Submodule R N)
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
def SModEq (x y : M) : Prop :=
(Submodule.Quotient.mk x : M β§Έ U) = Submodule.Quotient.mk y
#align smodeq SModEq
notation:50 x " β‘ " y " [SMOD " N "]" => SModEq N x y
variable {U Uβ Uβ}
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
protected theorem SModEq.def :
x β‘ y [SMOD U] β (Submodule.Quotient.mk x : M β§Έ U) = Submodule.Quotient.mk y :=
Iff.rfl
#align smodeq.def SModEq.def
namespace SModEq
theorem sub_mem : x β‘ y [SMOD U] β x - y β U := by rw [SModEq.def, Submodule.Quotient.eq]
#align smodeq.sub_mem SModEq.sub_mem
@[simp]
theorem top : x β‘ y [SMOD (β€ : Submodule R M)] :=
(Submodule.Quotient.eq β€).2 mem_top
#align smodeq.top SModEq.top
@[simp]
theorem bot : x β‘ y [SMOD (β₯ : Submodule R M)] β x = y := by
rw [SModEq.def, Submodule.Quotient.eq, mem_bot, sub_eq_zero]
#align smodeq.bot SModEq.bot
@[mono]
theorem mono (HU : Uβ β€ Uβ) (hxy : x β‘ y [SMOD Uβ]) : x β‘ y [SMOD Uβ] :=
(Submodule.Quotient.eq Uβ).2 <| HU <| (Submodule.Quotient.eq Uβ).1 hxy
#align smodeq.mono SModEq.mono
@[refl]
protected theorem refl (x : M) : x β‘ x [SMOD U] :=
@rfl _ _
#align smodeq.refl SModEq.refl
protected theorem rfl : x β‘ x [SMOD U] :=
SModEq.refl _
#align smodeq.rfl SModEq.rfl
instance : IsRefl _ (SModEq U) :=
β¨SModEq.reflβ©
@[symm]
nonrec theorem symm (hxy : x β‘ y [SMOD U]) : y β‘ x [SMOD U] :=
hxy.symm
#align smodeq.symm SModEq.symm
@[trans]
nonrec theorem trans (hxy : x β‘ y [SMOD U]) (hyz : y β‘ z [SMOD U]) : x β‘ z [SMOD U] :=
hxy.trans hyz
#align smodeq.trans SModEq.trans
instance instTrans : Trans (SModEq U) (SModEq U) (SModEq U) where
trans := trans
theorem add (hxyβ : xβ β‘ yβ [SMOD U]) (hxyβ : xβ β‘ yβ [SMOD U]) : xβ + xβ β‘ yβ + yβ [SMOD U] := by
rw [SModEq.def] at hxyβ hxyβ β’
simp_rw [Quotient.mk_add, hxyβ, hxyβ]
#align smodeq.add SModEq.add
theorem smul (hxy : x β‘ y [SMOD U]) (c : R) : c β’ x β‘ c β’ y [SMOD U] := by
rw [SModEq.def] at hxy β’
simp_rw [Quotient.mk_smul, hxy]
#align smodeq.smul SModEq.smul
theorem mul {I : Ideal A} {xβ xβ yβ yβ : A} (hxyβ : xβ β‘ yβ [SMOD I])
(hxyβ : xβ β‘ yβ [SMOD I]) : xβ * xβ β‘ yβ * yβ [SMOD I] := by
simp only [SModEq.def, Ideal.Quotient.mk_eq_mk, map_mul] at hxyβ hxyβ β’
rw [hxyβ, hxyβ]
| Mathlib/LinearAlgebra/SModEq.lean | 102 | 102 | theorem zero : x β‘ 0 [SMOD U] β x β U := by | rw [SModEq.def, Submodule.Quotient.eq, sub_zero]
| [
" x β‘ y [SMOD U] β x - y β U",
" x β‘ y [SMOD β₯] β x = y",
" xβ + xβ β‘ yβ + yβ [SMOD U]",
" Submodule.Quotient.mk (xβ + xβ) = Submodule.Quotient.mk (yβ + yβ)",
" c β’ x β‘ c β’ y [SMOD U]",
" Submodule.Quotient.mk (c β’ x) = Submodule.Quotient.mk (c β’ y)",
" xβ * xβ β‘ yβ * yβ [SMOD I]",
" (Ideal.Quotient.m... | [
" x β‘ y [SMOD U] β x - y β U",
" x β‘ y [SMOD β₯] β x = y",
" xβ + xβ β‘ yβ + yβ [SMOD U]",
" Submodule.Quotient.mk (xβ + xβ) = Submodule.Quotient.mk (yβ + yβ)",
" c β’ x β‘ c β’ y [SMOD U]",
" Submodule.Quotient.mk (c β’ x) = Submodule.Quotient.mk (c β’ y)",
" xβ * xβ β‘ yβ * yβ [SMOD I]",
" (Ideal.Quotient.m... |
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.Analysis.SumIntegralComparisons
import Mathlib.NumberTheory.Harmonic.Defs
theorem log_add_one_le_harmonic (n : β) :
Real.log β(n+1) β€ harmonic n := by
calc _ = β« x in (1:β)..β(n+1), xβ»ΒΉ := ?_
_ β€ β d β Finset.Icc 1 n, (d:β)β»ΒΉ := ?_
_ = harmonic n := ?_
Β· rw [Nat.cast_one, integral_inv (by simp [(show Β¬ (1 : β) β€ 0 by norm_num)]), div_one]
Β· exact (inv_antitoneOn_Icc_right <| by norm_num).integral_le_sum_Ico (Nat.le_add_left 1 n)
Β· simp only [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
theorem harmonic_le_one_add_log (n : β) :
harmonic n β€ 1 + Real.log n := by
by_cases hn0 : n = 0
Β· simp [hn0]
have hn : 1 β€ n := Nat.one_le_iff_ne_zero.mpr hn0
simp_rw [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
rw [β Finset.sum_erase_add (Finset.Icc 1 n) _ (Finset.left_mem_Icc.mpr hn), add_comm,
Nat.cast_one, inv_one]
refine add_le_add_left ?_ 1
simp only [Nat.lt_one_iff, Finset.mem_Icc, Finset.Icc_erase_left]
calc β d β .Ico 2 (n + 1), (d : β)β»ΒΉ
_ = β d β .Ico 2 (n + 1), (β(d + 1) - 1)β»ΒΉ := ?_
_ β€ β« x in (2).. β(n + 1), (x - 1)β»ΒΉ := ?_
_ = β« x in (1)..n, xβ»ΒΉ := ?_
_ = Real.log βn := ?_
Β· simp_rw [Nat.cast_add, Nat.cast_one, add_sub_cancel_right]
Β· exact @AntitoneOn.sum_le_integral_Ico 2 (n + 1) (fun x : β β¦ (x - 1)β»ΒΉ) (by linarith [hn]) <|
sub_inv_antitoneOn_Icc_right (by norm_num)
Β· convert intervalIntegral.integral_comp_sub_right _ 1
Β· norm_num
Β· simp only [Nat.cast_add, Nat.cast_one, add_sub_cancel_right]
Β· convert integral_inv _
Β· rw [div_one]
Β· simp only [Nat.one_le_cast, hn, Set.uIcc_of_le, Set.mem_Icc, Nat.cast_nonneg,
and_true, not_le, zero_lt_one]
theorem log_le_harmonic_floor (y : β) (hy : 0 β€ y) :
Real.log y β€ harmonic βyββ := by
by_cases h0 : y = 0
Β· simp [h0]
Β· calc
_ β€ Real.log β(Nat.floor y + 1) := ?_
_ β€ _ := log_add_one_le_harmonic _
gcongr
apply (Nat.le_ceil y).trans
norm_cast
exact Nat.ceil_le_floor_add_one y
| Mathlib/NumberTheory/Harmonic/Bounds.lean | 64 | 69 | theorem harmonic_floor_le_one_add_log (y : β) (hy : 1 β€ y) :
harmonic βyββ β€ 1 + Real.log y := by |
refine (harmonic_le_one_add_log _).trans ?_
gcongr
Β· exact_mod_cast Nat.floor_pos.mpr hy
Β· exact Nat.floor_le <| zero_le_one.trans hy
| [
" (β(n + 1)).log β€ β(harmonic n)",
" (β(n + 1)).log = β« (x : β) in β1 ..β(n + 1), xβ»ΒΉ",
" 0 β Set.uIcc 1 β(n + 1)",
" Β¬1 β€ 0",
" β« (x : β) in β1 ..β(n + 1), xβ»ΒΉ β€ β d β Finset.Icc 1 n, (βd)β»ΒΉ",
" 0 < β1",
" β d β Finset.Icc 1 n, (βd)β»ΒΉ = β(harmonic n)",
" β(harmonic n) β€ 1 + (βn).log",
" β x β Finse... | [
" (β(n + 1)).log β€ β(harmonic n)",
" (β(n + 1)).log = β« (x : β) in β1 ..β(n + 1), xβ»ΒΉ",
" 0 β Set.uIcc 1 β(n + 1)",
" Β¬1 β€ 0",
" β« (x : β) in β1 ..β(n + 1), xβ»ΒΉ β€ β d β Finset.Icc 1 n, (βd)β»ΒΉ",
" 0 < β1",
" β d β Finset.Icc 1 n, (βd)β»ΒΉ = β(harmonic n)",
" β(harmonic n) β€ 1 + (βn).log",
" β x β Finse... |
import Mathlib.Analysis.BoxIntegral.Box.Basic
import Mathlib.Analysis.SpecificLimits.Basic
#align_import analysis.box_integral.box.subbox_induction from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Finset Function Filter Metric Classical Topology Filter ENNReal
noncomputable section
namespace BoxIntegral
namespace Box
variable {ΞΉ : Type*} {I J : Box ΞΉ}
def splitCenterBox (I : Box ΞΉ) (s : Set ΞΉ) : Box ΞΉ where
lower := s.piecewise (fun i β¦ (I.lower i + I.upper i) / 2) I.lower
upper := s.piecewise I.upper fun i β¦ (I.lower i + I.upper i) / 2
lower_lt_upper i := by
dsimp only [Set.piecewise]
split_ifs <;> simp only [left_lt_add_div_two, add_div_two_lt_right, I.lower_lt_upper]
#align box_integral.box.split_center_box BoxIntegral.Box.splitCenterBox
theorem mem_splitCenterBox {s : Set ΞΉ} {y : ΞΉ β β} :
y β I.splitCenterBox s β y β I β§ β i, (I.lower i + I.upper i) / 2 < y i β i β s := by
simp only [splitCenterBox, mem_def, β forall_and]
refine forall_congr' fun i β¦ ?_
dsimp only [Set.piecewise]
split_ifs with hs <;> simp only [hs, iff_true_iff, iff_false_iff, not_lt]
exacts [β¨fun H β¦ β¨β¨(left_lt_add_div_two.2 (I.lower_lt_upper i)).trans H.1, H.2β©, H.1β©,
fun H β¦ β¨H.2, H.1.2β©β©,
β¨fun H β¦ β¨β¨H.1, H.2.trans (add_div_two_lt_right.2 (I.lower_lt_upper i)).leβ©, H.2β©,
fun H β¦ β¨H.1.1, H.2β©β©]
#align box_integral.box.mem_split_center_box BoxIntegral.Box.mem_splitCenterBox
theorem splitCenterBox_le (I : Box ΞΉ) (s : Set ΞΉ) : I.splitCenterBox s β€ I :=
fun _ hx β¦ (mem_splitCenterBox.1 hx).1
#align box_integral.box.split_center_box_le BoxIntegral.Box.splitCenterBox_le
theorem disjoint_splitCenterBox (I : Box ΞΉ) {s t : Set ΞΉ} (h : s β t) :
Disjoint (I.splitCenterBox s : Set (ΞΉ β β)) (I.splitCenterBox t) := by
rw [disjoint_iff_inf_le]
rintro y β¨hs, htβ©; apply h
ext i
rw [mem_coe, mem_splitCenterBox] at hs ht
rw [β hs.2, β ht.2]
#align box_integral.box.disjoint_split_center_box BoxIntegral.Box.disjoint_splitCenterBox
theorem injective_splitCenterBox (I : Box ΞΉ) : Injective I.splitCenterBox := fun _ _ H β¦
by_contra fun Hne β¦ (I.disjoint_splitCenterBox Hne).ne (nonempty_coe _).ne_empty (H βΈ rfl)
#align box_integral.box.injective_split_center_box BoxIntegral.Box.injective_splitCenterBox
@[simp]
theorem exists_mem_splitCenterBox {I : Box ΞΉ} {x : ΞΉ β β} : (β s, x β I.splitCenterBox s) β x β I :=
β¨fun β¨s, hsβ© β¦ I.splitCenterBox_le s hs, fun hx β¦
β¨{ i | (I.lower i + I.upper i) / 2 < x i }, mem_splitCenterBox.2 β¨hx, fun _ β¦ Iff.rflβ©β©β©
#align box_integral.box.exists_mem_split_center_box BoxIntegral.Box.exists_mem_splitCenterBox
@[simps]
def splitCenterBoxEmb (I : Box ΞΉ) : Set ΞΉ βͺ Box ΞΉ :=
β¨splitCenterBox I, injective_splitCenterBox Iβ©
#align box_integral.box.split_center_box_emb BoxIntegral.Box.splitCenterBoxEmb
@[simp]
theorem iUnion_coe_splitCenterBox (I : Box ΞΉ) : β s, (I.splitCenterBox s : Set (ΞΉ β β)) = I := by
ext x
simp
#align box_integral.box.Union_coe_split_center_box BoxIntegral.Box.iUnion_coe_splitCenterBox
@[simp]
theorem upper_sub_lower_splitCenterBox (I : Box ΞΉ) (s : Set ΞΉ) (i : ΞΉ) :
(I.splitCenterBox s).upper i - (I.splitCenterBox s).lower i = (I.upper i - I.lower i) / 2 := by
by_cases i β s <;> field_simp [splitCenterBox] <;> field_simp [mul_two, two_mul]
#align box_integral.box.upper_sub_lower_split_center_box BoxIntegral.Box.upper_sub_lower_splitCenterBox
@[elab_as_elim]
| Mathlib/Analysis/BoxIntegral/Box/SubboxInduction.lean | 122 | 170 | theorem subbox_induction_on' {p : Box ΞΉ β Prop} (I : Box ΞΉ)
(H_ind : β J β€ I, (β s, p (splitCenterBox J s)) β p J)
(H_nhds : β z β Box.Icc I, β U β π[Box.Icc I] z, β J β€ I, β (m : β), z β Box.Icc J β
Box.Icc J β U β (β i, J.upper i - J.lower i = (I.upper i - I.lower i) / 2 ^ m) β p J) :
p I := by |
by_contra hpI
-- First we use `H_ind` to construct a decreasing sequence of boxes such that `β m, Β¬p (J m)`.
replace H_ind := fun J hJ β¦ not_imp_not.2 (H_ind J hJ)
simp only [exists_imp, not_forall] at H_ind
choose! s hs using H_ind
set J : β β Box ΞΉ := fun m β¦ (fun J β¦ splitCenterBox J (s J))^[m] I
have J_succ : β m, J (m + 1) = splitCenterBox (J m) (s <| J m) :=
fun m β¦ iterate_succ_apply' _ _ _
-- Now we prove some properties of `J`
have hJmono : Antitone J :=
antitone_nat_of_succ_le fun n β¦ by simpa [J_succ] using splitCenterBox_le _ _
have hJle : β m, J m β€ I := fun m β¦ hJmono (zero_le m)
have hJp : β m, Β¬p (J m) :=
fun m β¦ Nat.recOn m hpI fun m β¦ by simpa only [J_succ] using hs (J m) (hJle m)
have hJsub : β m i, (J m).upper i - (J m).lower i = (I.upper i - I.lower i) / 2 ^ m := by
intro m i
induction' m with m ihm
Β· simp [J, Nat.zero_eq]
simp only [pow_succ, J_succ, upper_sub_lower_splitCenterBox, ihm, div_div]
have h0 : J 0 = I := rfl
clear_value J
clear hpI hs J_succ s
-- Let `z` be the unique common point of all `(J m).Icc`. Then `H_nhds` proves `p (J m)` for
-- sufficiently large `m`. This contradicts `hJp`.
set z : ΞΉ β β := β¨ m, (J m).lower
have hzJ : β m, z β Box.Icc (J m) :=
mem_iInter.1 (ciSup_mem_iInter_Icc_of_antitone_Icc
((@Box.Icc ΞΉ).monotone.comp_antitone hJmono) fun m β¦ (J m).lower_le_upper)
have hJl_mem : β m, (J m).lower β Box.Icc I := fun m β¦ le_iff_Icc.1 (hJle m) (J m).lower_mem_Icc
have hJu_mem : β m, (J m).upper β Box.Icc I := fun m β¦ le_iff_Icc.1 (hJle m) (J m).upper_mem_Icc
have hJlz : Tendsto (fun m β¦ (J m).lower) atTop (π z) :=
tendsto_atTop_ciSup (antitone_lower.comp hJmono) β¨I.upper, fun x β¨m, hmβ© β¦ hm βΈ (hJl_mem m).2β©
have hJuz : Tendsto (fun m β¦ (J m).upper) atTop (π z) := by
suffices Tendsto (fun m β¦ (J m).upper - (J m).lower) atTop (π 0) by simpa using hJlz.add this
refine tendsto_pi_nhds.2 fun i β¦ ?_
simpa [hJsub] using
tendsto_const_nhds.div_atTop (tendsto_pow_atTop_atTop_of_one_lt _root_.one_lt_two)
replace hJlz : Tendsto (fun m β¦ (J m).lower) atTop (π[Icc I.lower I.upper] z) :=
tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hJlz (eventually_of_forall hJl_mem)
replace hJuz : Tendsto (fun m β¦ (J m).upper) atTop (π[Icc I.lower I.upper] z) :=
tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hJuz (eventually_of_forall hJu_mem)
rcases H_nhds z (h0 βΈ hzJ 0) with β¨U, hUz, hUβ©
rcases (tendsto_lift'.1 (hJlz.Icc hJuz) U hUz).exists with β¨m, hUmβ©
exact hJp m (hU (J m) (hJle m) m (hzJ m) hUm (hJsub m))
| [
" s.piecewise (fun i => (I.lower i + I.upper i) / 2) I.lower i <\n s.piecewise I.upper (fun i => (I.lower i + I.upper i) / 2) i",
" (if i β s then (I.lower i + I.upper i) / 2 else I.lower i) < if i β s then I.upper i else (I.lower i + I.upper i) / 2",
" (I.lower i + I.upper i) / 2 < I.upper i",
" I.lower i... | [
" s.piecewise (fun i => (I.lower i + I.upper i) / 2) I.lower i <\n s.piecewise I.upper (fun i => (I.lower i + I.upper i) / 2) i",
" (if i β s then (I.lower i + I.upper i) / 2 else I.lower i) < if i β s then I.upper i else (I.lower i + I.upper i) / 2",
" (I.lower i + I.upper i) / 2 < I.upper i",
" I.lower i... |
import Mathlib.Probability.Notation
import Mathlib.Probability.Process.Stopping
#align_import probability.martingale.basic from "leanprover-community/mathlib"@"ba074af83b6cf54c3104e59402b39410ddbd6dca"
open TopologicalSpace Filter
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory
namespace MeasureTheory
variable {Ξ© E ΞΉ : Type*} [Preorder ΞΉ] {m0 : MeasurableSpace Ξ©} {ΞΌ : Measure Ξ©}
[NormedAddCommGroup E] [NormedSpace β E] [CompleteSpace E] {f g : ΞΉ β Ξ© β E} {β± : Filtration ΞΉ m0}
def Martingale (f : ΞΉ β Ξ© β E) (β± : Filtration ΞΉ m0) (ΞΌ : Measure Ξ©) : Prop :=
Adapted β± f β§ β i j, i β€ j β ΞΌ[f j|β± i] =α΅[ΞΌ] f i
#align measure_theory.martingale MeasureTheory.Martingale
def Supermartingale [LE E] (f : ΞΉ β Ξ© β E) (β± : Filtration ΞΉ m0) (ΞΌ : Measure Ξ©) : Prop :=
Adapted β± f β§ (β i j, i β€ j β ΞΌ[f j|β± i] β€α΅[ΞΌ] f i) β§ β i, Integrable (f i) ΞΌ
#align measure_theory.supermartingale MeasureTheory.Supermartingale
def Submartingale [LE E] (f : ΞΉ β Ξ© β E) (β± : Filtration ΞΉ m0) (ΞΌ : Measure Ξ©) : Prop :=
Adapted β± f β§ (β i j, i β€ j β f i β€α΅[ΞΌ] ΞΌ[f j|β± i]) β§ β i, Integrable (f i) ΞΌ
#align measure_theory.submartingale MeasureTheory.Submartingale
theorem martingale_const (β± : Filtration ΞΉ m0) (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ] (x : E) :
Martingale (fun _ _ => x) β± ΞΌ :=
β¨adapted_const β± _, fun i j _ => by rw [condexp_const (β±.le _)]β©
#align measure_theory.martingale_const MeasureTheory.martingale_const
theorem martingale_const_fun [OrderBot ΞΉ] (β± : Filtration ΞΉ m0) (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ]
{f : Ξ© β E} (hf : StronglyMeasurable[β± β₯] f) (hfint : Integrable f ΞΌ) :
Martingale (fun _ => f) β± ΞΌ := by
refine β¨fun i => hf.mono <| β±.mono bot_le, fun i j _ => ?_β©
rw [condexp_of_stronglyMeasurable (β±.le _) (hf.mono <| β±.mono bot_le) hfint]
#align measure_theory.martingale_const_fun MeasureTheory.martingale_const_fun
variable (E)
theorem martingale_zero (β± : Filtration ΞΉ m0) (ΞΌ : Measure Ξ©) : Martingale (0 : ΞΉ β Ξ© β E) β± ΞΌ :=
β¨adapted_zero E β±, fun i j _ => by rw [Pi.zero_apply, condexp_zero]; simpβ©
#align measure_theory.martingale_zero MeasureTheory.martingale_zero
variable {E}
namespace Martingale
protected theorem adapted (hf : Martingale f β± ΞΌ) : Adapted β± f :=
hf.1
#align measure_theory.martingale.adapted MeasureTheory.Martingale.adapted
protected theorem stronglyMeasurable (hf : Martingale f β± ΞΌ) (i : ΞΉ) :
StronglyMeasurable[β± i] (f i) :=
hf.adapted i
#align measure_theory.martingale.strongly_measurable MeasureTheory.Martingale.stronglyMeasurable
theorem condexp_ae_eq (hf : Martingale f β± ΞΌ) {i j : ΞΉ} (hij : i β€ j) : ΞΌ[f j|β± i] =α΅[ΞΌ] f i :=
hf.2 i j hij
#align measure_theory.martingale.condexp_ae_eq MeasureTheory.Martingale.condexp_ae_eq
protected theorem integrable (hf : Martingale f β± ΞΌ) (i : ΞΉ) : Integrable (f i) ΞΌ :=
integrable_condexp.congr (hf.condexp_ae_eq (le_refl i))
#align measure_theory.martingale.integrable MeasureTheory.Martingale.integrable
| Mathlib/Probability/Martingale/Basic.lean | 109 | 113 | theorem setIntegral_eq [SigmaFiniteFiltration ΞΌ β±] (hf : Martingale f β± ΞΌ) {i j : ΞΉ} (hij : i β€ j)
{s : Set Ξ©} (hs : MeasurableSet[β± i] s) : β« Ο in s, f i Ο βΞΌ = β« Ο in s, f j Ο βΞΌ := by |
rw [β @setIntegral_condexp _ _ _ _ _ (β± i) m0 _ _ _ (β±.le i) _ (hf.integrable j) hs]
refine setIntegral_congr_ae (β±.le i s hs) ?_
filter_upwards [hf.2 i j hij] with _ heq _ using heq.symm
| [
" ΞΌ[(fun x_1 x_2 => x) j|ββ± i] =αΆ [ae ΞΌ] (fun x_1 x_2 => x) i",
" Martingale (fun x => f) β± ΞΌ",
" ΞΌ[(fun x => f) j|ββ± i] =αΆ [ae ΞΌ] (fun x => f) i",
" ΞΌ[0 j|ββ± i] =αΆ [ae ΞΌ] 0 i",
" 0 =αΆ [ae ΞΌ] 0 i",
" β« (Ο : Ξ©) in s, f i Ο βΞΌ = β« (Ο : Ξ©) in s, f j Ο βΞΌ",
" β« (Ο : Ξ©) in s, f i Ο βΞΌ = β« (x : Ξ©) in s, (ΞΌ[f j|ββ±... | [
" ΞΌ[(fun x_1 x_2 => x) j|ββ± i] =αΆ [ae ΞΌ] (fun x_1 x_2 => x) i",
" Martingale (fun x => f) β± ΞΌ",
" ΞΌ[(fun x => f) j|ββ± i] =αΆ [ae ΞΌ] (fun x => f) i",
" ΞΌ[0 j|ββ± i] =αΆ [ae ΞΌ] 0 i",
" 0 =αΆ [ae ΞΌ] 0 i"
] |
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Limits.Constructions.EpiMono
import Mathlib.CategoryTheory.Limits.Preserves.Limits
import Mathlib.CategoryTheory.Limits.Shapes.Types
#align_import category_theory.glue_data from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
noncomputable section
open CategoryTheory.Limits
namespace CategoryTheory
universe v uβ uβ
variable (C : Type uβ) [Category.{v} C] {C' : Type uβ} [Category.{v} C']
-- Porting note(#5171): linter not ported yet
-- @[nolint has_nonempty_instance]
structure GlueData where
J : Type v
U : J β C
V : J Γ J β C
f : β i j, V (i, j) βΆ U i
f_mono : β i j, Mono (f i j) := by infer_instance
f_hasPullback : β i j k, HasPullback (f i j) (f i k) := by infer_instance
f_id : β i, IsIso (f i i) := by infer_instance
t : β i j, V (i, j) βΆ V (j, i)
t_id : β i, t i i = π _
t' : β i j k, pullback (f i j) (f i k) βΆ pullback (f j k) (f j i)
t_fac : β i j k, t' i j k β« pullback.snd = pullback.fst β« t i j
cocycle : β i j k, t' i j k β« t' j k i β« t' k i j = π _
#align category_theory.glue_data CategoryTheory.GlueData
attribute [simp] GlueData.t_id
attribute [instance] GlueData.f_id GlueData.f_mono GlueData.f_hasPullback
attribute [reassoc] GlueData.t_fac GlueData.cocycle
namespace GlueData
variable {C}
variable (D : GlueData C)
@[simp]
theorem t'_iij (i j : D.J) : D.t' i i j = (pullbackSymmetry _ _).hom := by
have eqβ := D.t_fac i i j
have eqβ := (IsIso.eq_comp_inv (D.f i i)).mpr (@pullback.condition _ _ _ _ _ _ (D.f i j) _)
rw [D.t_id, Category.comp_id, eqβ] at eqβ
have eqβ := (IsIso.eq_comp_inv (D.f i i)).mp eqβ
rw [Category.assoc, β pullback.condition, β Category.assoc] at eqβ
exact
Mono.right_cancellation _ _
((Mono.right_cancellation _ _ eqβ).trans (pullbackSymmetry_hom_comp_fst _ _).symm)
#align category_theory.glue_data.t'_iij CategoryTheory.GlueData.t'_iij
theorem t'_jii (i j : D.J) : D.t' j i i = pullback.fst β« D.t j i β« inv pullback.snd := by
rw [β Category.assoc, β D.t_fac]
simp
#align category_theory.glue_data.t'_jii CategoryTheory.GlueData.t'_jii
theorem t'_iji (i j : D.J) : D.t' i j i = pullback.fst β« D.t i j β« inv pullback.snd := by
rw [β Category.assoc, β D.t_fac]
simp
#align category_theory.glue_data.t'_iji CategoryTheory.GlueData.t'_iji
@[reassoc, elementwise (attr := simp)]
theorem t_inv (i j : D.J) : D.t i j β« D.t j i = π _ := by
have eq : (pullbackSymmetry (D.f i i) (D.f i j)).hom = pullback.snd β« inv pullback.fst := by simp
have := D.cocycle i j i
rw [D.t'_iij, D.t'_jii, D.t'_iji, fst_eq_snd_of_mono_eq, eq] at this
simp only [Category.assoc, IsIso.inv_hom_id_assoc] at this
rw [β IsIso.eq_inv_comp, β Category.assoc, IsIso.comp_inv_eq] at this
simpa using this
#align category_theory.glue_data.t_inv CategoryTheory.GlueData.t_inv
theorem t'_inv (i j k : D.J) :
D.t' i j k β« (pullbackSymmetry _ _).hom β« D.t' j i k β« (pullbackSymmetry _ _).hom = π _ := by
rw [β cancel_mono (pullback.fst : pullback (D.f i j) (D.f i k) βΆ _)]
simp [t_fac, t_fac_assoc]
#align category_theory.glue_data.t'_inv CategoryTheory.GlueData.t'_inv
instance t_isIso (i j : D.J) : IsIso (D.t i j) :=
β¨β¨D.t j i, D.t_inv _ _, D.t_inv _ _β©β©
#align category_theory.glue_data.t_is_iso CategoryTheory.GlueData.t_isIso
instance t'_isIso (i j k : D.J) : IsIso (D.t' i j k) :=
β¨β¨D.t' j k i β« D.t' k i j, D.cocycle _ _ _, by simpa using D.cocycle _ _ _β©β©
#align category_theory.glue_data.t'_is_iso CategoryTheory.GlueData.t'_isIso
@[reassoc]
| Mathlib/CategoryTheory/GlueData.lean | 123 | 129 | theorem t'_comp_eq_pullbackSymmetry (i j k : D.J) :
D.t' j k i β« D.t' k i j =
(pullbackSymmetry _ _).hom β« D.t' j i k β« (pullbackSymmetry _ _).hom := by |
trans inv (D.t' i j k)
Β· exact IsIso.eq_inv_of_hom_inv_id (D.cocycle _ _ _)
Β· rw [β cancel_mono (pullback.fst : pullback (D.f i j) (D.f i k) βΆ _)]
simp [t_fac, t_fac_assoc]
| [
" D.t' i i j = (pullbackSymmetry (D.f i i) (D.f i j)).hom",
" D.t' j i i = pullback.fst β« D.t j i β« inv pullback.snd",
" D.t' j i i = (D.t' j i i β« pullback.snd) β« inv pullback.snd",
" D.t' i j i = pullback.fst β« D.t i j β« inv pullback.snd",
" D.t' i j i = (D.t' i j i β« pullback.snd) β« inv pullback.snd",
... | [
" D.t' i i j = (pullbackSymmetry (D.f i i) (D.f i j)).hom",
" D.t' j i i = pullback.fst β« D.t j i β« inv pullback.snd",
" D.t' j i i = (D.t' j i i β« pullback.snd) β« inv pullback.snd",
" D.t' i j i = pullback.fst β« D.t i j β« inv pullback.snd",
" D.t' i j i = (D.t' i j i β« pullback.snd) β« inv pullback.snd",
... |
import Mathlib.Analysis.Complex.Circle
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
#align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
noncomputable section
open Complex
open ComplexConjugate
local notation "|" x "|" => Complex.abs x
def rotation : circle β* β ββα΅’[β] β where
toFun a :=
{ DistribMulAction.toLinearEquiv β β a with
norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] }
map_one' := LinearIsometryEquiv.ext <| one_smul circle
map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b
#align rotation rotation
@[simp]
theorem rotation_apply (a : circle) (z : β) : rotation a z = a * z :=
rfl
#align rotation_apply rotation_apply
@[simp]
theorem rotation_symm (a : circle) : (rotation a).symm = rotation aβ»ΒΉ :=
LinearIsometryEquiv.ext fun _ => rfl
#align rotation_symm rotation_symm
@[simp]
| Mathlib/Analysis/Complex/Isometry.lean | 60 | 62 | theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by |
ext1
simp
| [
" Complex.abs (βa * x) = Complex.abs x",
" (rotation a).trans (rotation b) = rotation (b * a)",
" ((rotation a).trans (rotation b)) xβ = (rotation (b * a)) xβ"
] | [
" Complex.abs (βa * x) = Complex.abs x"
] |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {Ξ± Ξ² K : Type*}
section DivisionSemiring
variable [DivisionSemiring Ξ±] {a b c d : Ξ±}
theorem add_div (a b c : Ξ±) : (a + b) / c = a / c + b / c := by simp_rw [div_eq_mul_inv, add_mul]
#align add_div add_div
@[field_simps]
theorem div_add_div_same (a b c : Ξ±) : a / c + b / c = (a + b) / c :=
(add_div _ _ _).symm
#align div_add_div_same div_add_div_same
theorem same_add_div (h : b β 0) : (b + a) / b = 1 + a / b := by rw [β div_self h, add_div]
#align same_add_div same_add_div
theorem div_add_same (h : b β 0) : (a + b) / b = a / b + 1 := by rw [β div_self h, add_div]
#align div_add_same div_add_same
theorem one_add_div (h : b β 0) : 1 + a / b = (b + a) / b :=
(same_add_div h).symm
#align one_add_div one_add_div
theorem div_add_one (h : b β 0) : a / b + 1 = (a + b) / b :=
(div_add_same h).symm
#align div_add_one div_add_one
theorem inv_add_inv' (ha : a β 0) (hb : b β 0) :
aβ»ΒΉ + bβ»ΒΉ = aβ»ΒΉ * (a + b) * bβ»ΒΉ :=
let _ := invertibleOfNonzero ha; let _ := invertibleOfNonzero hb; invOf_add_invOf a b
theorem one_div_mul_add_mul_one_div_eq_one_div_add_one_div (ha : a β 0) (hb : b β 0) :
1 / a * (a + b) * (1 / b) = 1 / a + 1 / b := by
simpa only [one_div] using (inv_add_inv' ha hb).symm
#align one_div_mul_add_mul_one_div_eq_one_div_add_one_div one_div_mul_add_mul_one_div_eq_one_div_add_one_div
theorem add_div_eq_mul_add_div (a b : Ξ±) (hc : c β 0) : a + b / c = (a * c + b) / c :=
(eq_div_iff_mul_eq hc).2 <| by rw [right_distrib, div_mul_cancelβ _ hc]
#align add_div_eq_mul_add_div add_div_eq_mul_add_div
@[field_simps]
| Mathlib/Algebra/Field/Basic.lean | 66 | 67 | theorem add_div' (a b c : Ξ±) (hc : c β 0) : b + a / c = (b * c + a) / c := by |
rw [add_div, mul_div_cancel_rightβ _ hc]
| [
" (a + b) / c = a / c + b / c",
" (b + a) / b = 1 + a / b",
" (a + b) / b = a / b + 1",
" 1 / a * (a + b) * (1 / b) = 1 / a + 1 / b",
" (a + b / c) * c = a * c + b",
" b + a / c = (b * c + a) / c"
] | [
" (a + b) / c = a / c + b / c",
" (b + a) / b = 1 + a / b",
" (a + b) / b = a / b + 1",
" 1 / a * (a + b) * (1 / b) = 1 / a + 1 / b",
" (a + b / c) * c = a * c + b"
] |
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.Images
import Mathlib.CategoryTheory.IsomorphismClasses
import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects
#align_import category_theory.limits.shapes.zero_morphisms from "leanprover-community/mathlib"@"f7707875544ef1f81b32cb68c79e0e24e45a0e76"
noncomputable section
universe v u
universe v' u'
open CategoryTheory
open CategoryTheory.Category
open scoped Classical
namespace CategoryTheory.Limits
variable (C : Type u) [Category.{v} C]
variable (D : Type u') [Category.{v'} D]
class HasZeroMorphisms where
[zero : β X Y : C, Zero (X βΆ Y)]
comp_zero : β {X Y : C} (f : X βΆ Y) (Z : C), f β« (0 : Y βΆ Z) = (0 : X βΆ Z) := by aesop_cat
zero_comp : β (X : C) {Y Z : C} (f : Y βΆ Z), (0 : X βΆ Y) β« f = (0 : X βΆ Z) := by aesop_cat
#align category_theory.limits.has_zero_morphisms CategoryTheory.Limits.HasZeroMorphisms
#align category_theory.limits.has_zero_morphisms.comp_zero' CategoryTheory.Limits.HasZeroMorphisms.comp_zero
#align category_theory.limits.has_zero_morphisms.zero_comp' CategoryTheory.Limits.HasZeroMorphisms.zero_comp
attribute [instance] HasZeroMorphisms.zero
variable {C}
@[simp]
theorem comp_zero [HasZeroMorphisms C] {X Y : C} {f : X βΆ Y} {Z : C} :
f β« (0 : Y βΆ Z) = (0 : X βΆ Z) :=
HasZeroMorphisms.comp_zero f Z
#align category_theory.limits.comp_zero CategoryTheory.Limits.comp_zero
@[simp]
theorem zero_comp [HasZeroMorphisms C] {X : C} {Y Z : C} {f : Y βΆ Z} :
(0 : X βΆ Y) β« f = (0 : X βΆ Z) :=
HasZeroMorphisms.zero_comp X f
#align category_theory.limits.zero_comp CategoryTheory.Limits.zero_comp
instance hasZeroMorphismsPEmpty : HasZeroMorphisms (Discrete PEmpty) where
zero := by aesop_cat
#align category_theory.limits.has_zero_morphisms_pempty CategoryTheory.Limits.hasZeroMorphismsPEmpty
instance hasZeroMorphismsPUnit : HasZeroMorphisms (Discrete PUnit) where
zero X Y := by repeat (constructor)
#align category_theory.limits.has_zero_morphisms_punit CategoryTheory.Limits.hasZeroMorphismsPUnit
open Opposite HasZeroMorphisms
instance hasZeroMorphismsOpposite [HasZeroMorphisms C] : HasZeroMorphisms Cα΅α΅ where
zero X Y := β¨(0 : unop Y βΆ unop X).opβ©
comp_zero f Z := congr_arg Quiver.Hom.op (HasZeroMorphisms.zero_comp (unop Z) f.unop)
zero_comp X {Y Z} (f : Y βΆ Z) :=
congrArg Quiver.Hom.op (HasZeroMorphisms.comp_zero f.unop (unop X))
#align category_theory.limits.has_zero_morphisms_opposite CategoryTheory.Limits.hasZeroMorphismsOpposite
section
variable [HasZeroMorphisms C]
@[simp] lemma op_zero (X Y : C) : (0 : X βΆ Y).op = 0 := rfl
#align category_theory.op_zero CategoryTheory.Limits.op_zero
@[simp] lemma unop_zero (X Y : Cα΅α΅) : (0 : X βΆ Y).unop = 0 := rfl
#align category_theory.unop_zero CategoryTheory.Limits.unop_zero
theorem zero_of_comp_mono {X Y Z : C} {f : X βΆ Y} (g : Y βΆ Z) [Mono g] (h : f β« g = 0) : f = 0 := by
rw [β zero_comp, cancel_mono] at h
exact h
#align category_theory.limits.zero_of_comp_mono CategoryTheory.Limits.zero_of_comp_mono
theorem zero_of_epi_comp {X Y Z : C} (f : X βΆ Y) {g : Y βΆ Z} [Epi f] (h : f β« g = 0) : g = 0 := by
rw [β comp_zero, cancel_epi] at h
exact h
#align category_theory.limits.zero_of_epi_comp CategoryTheory.Limits.zero_of_epi_comp
| Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean | 150 | 151 | theorem eq_zero_of_image_eq_zero {X Y : C} {f : X βΆ Y} [HasImage f] (w : image.ΞΉ f = 0) :
f = 0 := by | rw [β image.fac f, w, HasZeroMorphisms.comp_zero]
| [] | [] |
import Mathlib.Analysis.Normed.Field.Basic
#align_import analysis.normed_space.int from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8"
namespace Int
| Mathlib/Analysis/NormedSpace/Int.lean | 24 | 26 | theorem nnnorm_coe_units (e : β€Λ£) : β(e : β€)ββ = 1 := by |
obtain rfl | rfl := units_eq_one_or e <;>
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
| [
" ββeββ = 1",
" ββ1ββ = 1",
" ββ(-1)ββ = 1"
] | [] |
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Analysis.Convex.Hull
import Mathlib.LinearAlgebra.AffineSpace.Basis
#align_import analysis.convex.combination from "leanprover-community/mathlib"@"92bd7b1ffeb306a89f450bee126ddd8a284c259d"
open Set Function
open scoped Classical
open Pointwise
universe u u'
variable {R R' E F ΞΉ ΞΉ' Ξ± : Type*} [LinearOrderedField R] [LinearOrderedField R'] [AddCommGroup E]
[AddCommGroup F] [LinearOrderedAddCommGroup Ξ±] [Module R E] [Module R F] [Module R Ξ±]
[OrderedSMul R Ξ±] {s : Set E}
def Finset.centerMass (t : Finset ΞΉ) (w : ΞΉ β R) (z : ΞΉ β E) : E :=
(β i β t, w i)β»ΒΉ β’ β i β t, w i β’ z i
#align finset.center_mass Finset.centerMass
variable (i j : ΞΉ) (c : R) (t : Finset ΞΉ) (w : ΞΉ β R) (z : ΞΉ β E)
open Finset
theorem Finset.centerMass_empty : (β
: Finset ΞΉ).centerMass w z = 0 := by
simp only [centerMass, sum_empty, smul_zero]
#align finset.center_mass_empty Finset.centerMass_empty
theorem Finset.centerMass_pair (hne : i β j) :
({i, j} : Finset ΞΉ).centerMass w z = (w i / (w i + w j)) β’ z i + (w j / (w i + w j)) β’ z j := by
simp only [centerMass, sum_pair hne, smul_add, (mul_smul _ _ _).symm, div_eq_inv_mul]
#align finset.center_mass_pair Finset.centerMass_pair
variable {w}
theorem Finset.centerMass_insert (ha : i β t) (hw : β j β t, w j β 0) :
(insert i t).centerMass w z =
(w i / (w i + β j β t, w j)) β’ z i +
((β j β t, w j) / (w i + β j β t, w j)) β’ t.centerMass w z := by
simp only [centerMass, sum_insert ha, smul_add, (mul_smul _ _ _).symm, β div_eq_inv_mul]
congr 2
rw [div_mul_eq_mul_div, mul_inv_cancel hw, one_div]
#align finset.center_mass_insert Finset.centerMass_insert
theorem Finset.centerMass_singleton (hw : w i β 0) : ({i} : Finset ΞΉ).centerMass w z = z i := by
rw [centerMass, sum_singleton, sum_singleton, β mul_smul, inv_mul_cancel hw, one_smul]
#align finset.center_mass_singleton Finset.centerMass_singleton
@[simp] lemma Finset.centerMass_neg_left : t.centerMass (-w) z = t.centerMass w z := by
simp [centerMass, inv_neg]
lemma Finset.centerMass_smul_left {c : R'} [Module R' R] [Module R' E] [SMulCommClass R' R R]
[IsScalarTower R' R R] [SMulCommClass R R' E] [IsScalarTower R' R E] (hc : c β 0) :
t.centerMass (c β’ w) z = t.centerMass w z := by
simp [centerMass, -smul_assoc, smul_assoc c, β smul_sum, smul_invβ, smul_smul_smul_comm, hc]
theorem Finset.centerMass_eq_of_sum_1 (hw : β i β t, w i = 1) :
t.centerMass w z = β i β t, w i β’ z i := by
simp only [Finset.centerMass, hw, inv_one, one_smul]
#align finset.center_mass_eq_of_sum_1 Finset.centerMass_eq_of_sum_1
| Mathlib/Analysis/Convex/Combination.lean | 87 | 88 | theorem Finset.centerMass_smul : (t.centerMass w fun i => c β’ z i) = c β’ t.centerMass w z := by |
simp only [Finset.centerMass, Finset.smul_sum, (mul_smul _ _ _).symm, mul_comm c, mul_assoc]
| [
" β
.centerMass w z = 0",
" {i, j}.centerMass w z = (w i / (w i + w j)) β’ z i + (w j / (w i + w j)) β’ z j",
" (insert i t).centerMass w z =\n (w i / (w i + β j β t, w j)) β’ z i + ((β j β t, w j) / (w i + β j β t, w j)) β’ t.centerMass w z",
" (w i / (w i + β i β t, w i)) β’ z i + (w i + β i β t, w i)β»ΒΉ β’ β i ... | [
" β
.centerMass w z = 0",
" {i, j}.centerMass w z = (w i / (w i + w j)) β’ z i + (w j / (w i + w j)) β’ z j",
" (insert i t).centerMass w z =\n (w i / (w i + β j β t, w j)) β’ z i + ((β j β t, w j) / (w i + β j β t, w j)) β’ t.centerMass w z",
" (w i / (w i + β i β t, w i)) β’ z i + (w i + β i β t, w i)β»ΒΉ β’ β i ... |
import Mathlib.Logic.Pairwise
import Mathlib.Order.CompleteBooleanAlgebra
import Mathlib.Order.Directed
import Mathlib.Order.GaloisConnection
#align_import data.set.lattice from "leanprover-community/mathlib"@"b86832321b586c6ac23ef8cdef6a7a27e42b13bd"
open Function Set
universe u
variable {Ξ± Ξ² Ξ³ : Type*} {ΞΉ ΞΉ' ΞΉβ : Sort*} {ΞΊ ΞΊβ ΞΊβ : ΞΉ β Sort*} {ΞΊ' : ΞΉ' β Sort*}
namespace Set
theorem mem_iUnionβ {x : Ξ³} {s : β i, ΞΊ i β Set Ξ³} : (x β β (i) (j), s i j) β β i j, x β s i j := by
simp_rw [mem_iUnion]
#align set.mem_Unionβ Set.mem_iUnionβ
theorem mem_iInterβ {x : Ξ³} {s : β i, ΞΊ i β Set Ξ³} : (x β β (i) (j), s i j) β β i j, x β s i j := by
simp_rw [mem_iInter]
#align set.mem_Interβ Set.mem_iInterβ
theorem mem_iUnion_of_mem {s : ΞΉ β Set Ξ±} {a : Ξ±} (i : ΞΉ) (ha : a β s i) : a β β i, s i :=
mem_iUnion.2 β¨i, haβ©
#align set.mem_Union_of_mem Set.mem_iUnion_of_mem
theorem mem_iUnionβ_of_mem {s : β i, ΞΊ i β Set Ξ±} {a : Ξ±} {i : ΞΉ} (j : ΞΊ i) (ha : a β s i j) :
a β β (i) (j), s i j :=
mem_iUnionβ.2 β¨i, j, haβ©
#align set.mem_Unionβ_of_mem Set.mem_iUnionβ_of_mem
theorem mem_iInter_of_mem {s : ΞΉ β Set Ξ±} {a : Ξ±} (h : β i, a β s i) : a β β i, s i :=
mem_iInter.2 h
#align set.mem_Inter_of_mem Set.mem_iInter_of_mem
theorem mem_iInterβ_of_mem {s : β i, ΞΊ i β Set Ξ±} {a : Ξ±} (h : β i j, a β s i j) :
a β β (i) (j), s i j :=
mem_iInterβ.2 h
#align set.mem_Interβ_of_mem Set.mem_iInterβ_of_mem
instance completeAtomicBooleanAlgebra : CompleteAtomicBooleanAlgebra (Set Ξ±) :=
{ instBooleanAlgebraSet with
le_sSup := fun s t t_in a a_in => β¨t, t_in, a_inβ©
sSup_le := fun s t h a β¨t', β¨t'_in, a_inβ©β© => h t' t'_in a_in
le_sInf := fun s t h a a_in t' t'_in => h t' t'_in a_in
sInf_le := fun s t t_in a h => h _ t_in
iInf_iSup_eq := by intros; ext; simp [Classical.skolem] }
instance : OrderTop (Set Ξ±) where
top := univ
le_top := by simp
@[congr]
theorem iUnion_congr_Prop {p q : Prop} {fβ : p β Set Ξ±} {fβ : q β Set Ξ±} (pq : p β q)
(f : β x, fβ (pq.mpr x) = fβ x) : iUnion fβ = iUnion fβ :=
iSup_congr_Prop pq f
#align set.Union_congr_Prop Set.iUnion_congr_Prop
@[congr]
theorem iInter_congr_Prop {p q : Prop} {fβ : p β Set Ξ±} {fβ : q β Set Ξ±} (pq : p β q)
(f : β x, fβ (pq.mpr x) = fβ x) : iInter fβ = iInter fβ :=
iInf_congr_Prop pq f
#align set.Inter_congr_Prop Set.iInter_congr_Prop
theorem iUnion_plift_up (f : PLift ΞΉ β Set Ξ±) : β i, f (PLift.up i) = β i, f i :=
iSup_plift_up _
#align set.Union_plift_up Set.iUnion_plift_up
theorem iUnion_plift_down (f : ΞΉ β Set Ξ±) : β i, f (PLift.down i) = β i, f i :=
iSup_plift_down _
#align set.Union_plift_down Set.iUnion_plift_down
theorem iInter_plift_up (f : PLift ΞΉ β Set Ξ±) : β i, f (PLift.up i) = β i, f i :=
iInf_plift_up _
#align set.Inter_plift_up Set.iInter_plift_up
theorem iInter_plift_down (f : ΞΉ β Set Ξ±) : β i, f (PLift.down i) = β i, f i :=
iInf_plift_down _
#align set.Inter_plift_down Set.iInter_plift_down
theorem iUnion_eq_if {p : Prop} [Decidable p] (s : Set Ξ±) : β _ : p, s = if p then s else β
:=
iSup_eq_if _
#align set.Union_eq_if Set.iUnion_eq_if
theorem iUnion_eq_dif {p : Prop} [Decidable p] (s : p β Set Ξ±) :
β h : p, s h = if h : p then s h else β
:=
iSup_eq_dif _
#align set.Union_eq_dif Set.iUnion_eq_dif
theorem iInter_eq_if {p : Prop} [Decidable p] (s : Set Ξ±) : β _ : p, s = if p then s else univ :=
iInf_eq_if _
#align set.Inter_eq_if Set.iInter_eq_if
theorem iInf_eq_dif {p : Prop} [Decidable p] (s : p β Set Ξ±) :
β h : p, s h = if h : p then s h else univ :=
_root_.iInf_eq_dif _
#align set.Infi_eq_dif Set.iInf_eq_dif
| Mathlib/Data/Set/Lattice.lean | 207 | 211 | theorem exists_set_mem_of_union_eq_top {ΞΉ : Type*} (t : Set ΞΉ) (s : ΞΉ β Set Ξ²)
(w : β i β t, s i = β€) (x : Ξ²) : β i β t, x β s i := by |
have p : x β β€ := Set.mem_univ x
rw [β w, Set.mem_iUnion] at p
simpa using p
| [
" x β β i, β j, s i j β β i j, x β s i j",
" x β β i, β j, s i j β β (i : ΞΉ) (j : ΞΊ i), x β s i j",
" β {ΞΉ : Type u_1} {ΞΊ : ΞΉ β Type u_1} (f : (a : ΞΉ) β ΞΊ a β Set Ξ±), β¨
a, β¨ b, f a b = β¨ g, β¨
a, f a (g a)",
" β¨
a, β¨ b, fβ a b = β¨ g, β¨
a, fβ a (g a)",
" xβ β β¨
a, β¨ b, fβ a b β xβ β β¨ g, β¨
a, fβ a (g a)",
"... | [
" x β β i, β j, s i j β β i j, x β s i j",
" x β β i, β j, s i j β β (i : ΞΉ) (j : ΞΊ i), x β s i j",
" β {ΞΉ : Type u_1} {ΞΊ : ΞΉ β Type u_1} (f : (a : ΞΉ) β ΞΊ a β Set Ξ±), β¨
a, β¨ b, f a b = β¨ g, β¨
a, f a (g a)",
" β¨
a, β¨ b, fβ a b = β¨ g, β¨
a, fβ a (g a)",
" xβ β β¨
a, β¨ b, fβ a b β xβ β β¨ g, β¨
a, fβ a (g a)",
"... |
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.Data.Nat.Lattice
#align_import combinatorics.simple_graph.metric from "leanprover-community/mathlib"@"352ecfe114946c903338006dd3287cb5a9955ff2"
namespace SimpleGraph
variable {V : Type*} (G : SimpleGraph V)
noncomputable def dist (u v : V) : β :=
sInf (Set.range (Walk.length : G.Walk u v β β))
#align simple_graph.dist SimpleGraph.dist
variable {G}
protected theorem Reachable.exists_walk_of_dist {u v : V} (hr : G.Reachable u v) :
β p : G.Walk u v, p.length = G.dist u v :=
Nat.sInf_mem (Set.range_nonempty_iff_nonempty.mpr hr)
#align simple_graph.reachable.exists_walk_of_dist SimpleGraph.Reachable.exists_walk_of_dist
protected theorem Connected.exists_walk_of_dist (hconn : G.Connected) (u v : V) :
β p : G.Walk u v, p.length = G.dist u v :=
(hconn u v).exists_walk_of_dist
#align simple_graph.connected.exists_walk_of_dist SimpleGraph.Connected.exists_walk_of_dist
theorem dist_le {u v : V} (p : G.Walk u v) : G.dist u v β€ p.length :=
Nat.sInf_le β¨p, rflβ©
#align simple_graph.dist_le SimpleGraph.dist_le
@[simp]
theorem dist_eq_zero_iff_eq_or_not_reachable {u v : V} :
G.dist u v = 0 β u = v β¨ Β¬G.Reachable u v := by simp [dist, Nat.sInf_eq_zero, Reachable]
#align simple_graph.dist_eq_zero_iff_eq_or_not_reachable SimpleGraph.dist_eq_zero_iff_eq_or_not_reachable
theorem dist_self {v : V} : dist G v v = 0 := by simp
#align simple_graph.dist_self SimpleGraph.dist_self
protected theorem Reachable.dist_eq_zero_iff {u v : V} (hr : G.Reachable u v) :
G.dist u v = 0 β u = v := by simp [hr]
#align simple_graph.reachable.dist_eq_zero_iff SimpleGraph.Reachable.dist_eq_zero_iff
protected theorem Reachable.pos_dist_of_ne {u v : V} (h : G.Reachable u v) (hne : u β v) :
0 < G.dist u v :=
Nat.pos_of_ne_zero (by simp [h, hne])
#align simple_graph.reachable.pos_dist_of_ne SimpleGraph.Reachable.pos_dist_of_ne
protected theorem Connected.dist_eq_zero_iff (hconn : G.Connected) {u v : V} :
G.dist u v = 0 β u = v := by simp [hconn u v]
#align simple_graph.connected.dist_eq_zero_iff SimpleGraph.Connected.dist_eq_zero_iff
protected theorem Connected.pos_dist_of_ne {u v : V} (hconn : G.Connected) (hne : u β v) :
0 < G.dist u v :=
Nat.pos_of_ne_zero (by intro h; exact False.elim (hne (hconn.dist_eq_zero_iff.mp h)))
#align simple_graph.connected.pos_dist_of_ne SimpleGraph.Connected.pos_dist_of_ne
theorem dist_eq_zero_of_not_reachable {u v : V} (h : Β¬G.Reachable u v) : G.dist u v = 0 := by
simp [h]
#align simple_graph.dist_eq_zero_of_not_reachable SimpleGraph.dist_eq_zero_of_not_reachable
theorem nonempty_of_pos_dist {u v : V} (h : 0 < G.dist u v) :
(Set.univ : Set (G.Walk u v)).Nonempty := by
simpa [Set.range_nonempty_iff_nonempty, Set.nonempty_iff_univ_nonempty] using
Nat.nonempty_of_pos_sInf h
#align simple_graph.nonempty_of_pos_dist SimpleGraph.nonempty_of_pos_dist
protected theorem Connected.dist_triangle (hconn : G.Connected) {u v w : V} :
G.dist u w β€ G.dist u v + G.dist v w := by
obtain β¨p, hpβ© := hconn.exists_walk_of_dist u v
obtain β¨q, hqβ© := hconn.exists_walk_of_dist v w
rw [β hp, β hq, β Walk.length_append]
apply dist_le
#align simple_graph.connected.dist_triangle SimpleGraph.Connected.dist_triangle
private theorem dist_comm_aux {u v : V} (h : G.Reachable u v) : G.dist u v β€ G.dist v u := by
obtain β¨p, hpβ© := h.symm.exists_walk_of_dist
rw [β hp, β Walk.length_reverse]
apply dist_le
theorem dist_comm {u v : V} : G.dist u v = G.dist v u := by
by_cases h : G.Reachable u v
Β· apply le_antisymm (dist_comm_aux h) (dist_comm_aux h.symm)
Β· have h' : Β¬G.Reachable v u := fun h' => absurd h'.symm h
simp [h, h', dist_eq_zero_of_not_reachable]
#align simple_graph.dist_comm SimpleGraph.dist_comm
lemma dist_ne_zero_iff_ne_and_reachable {u v : V} : G.dist u v β 0 β u β v β§ G.Reachable u v := by
rw [ne_eq, dist_eq_zero_iff_eq_or_not_reachable.not]
push_neg; rfl
lemma Reachable.of_dist_ne_zero {u v : V} (h : G.dist u v β 0) : G.Reachable u v :=
(dist_ne_zero_iff_ne_and_reachable.mp h).2
lemma exists_walk_of_dist_ne_zero {u v : V} (h : G.dist u v β 0) :
β p : G.Walk u v, p.length = G.dist u v :=
(Reachable.of_dist_ne_zero h).exists_walk_of_dist
| Mathlib/Combinatorics/SimpleGraph/Metric.lean | 137 | 142 | theorem dist_eq_one_iff_adj {u v : V} : G.dist u v = 1 β G.Adj u v := by |
refine β¨fun h β¦ ?_, fun h β¦ ?_β©
Β· let β¨w, hwβ© := exists_walk_of_dist_ne_zero <| ne_zero_of_eq_one h
exact w.adj_of_length_eq_one <| h βΈ hw
Β· have : h.toWalk.length = 1 := Walk.length_cons _ _
exact ge_antisymm (h.reachable.pos_dist_of_ne h.ne) (this βΈ dist_le _)
| [
" G.dist u v = 0 β u = v β¨ Β¬G.Reachable u v",
" G.dist v v = 0",
" G.dist u v = 0 β u = v",
" G.dist u v β 0",
" False",
" G.dist u v = 0",
" Set.univ.Nonempty",
" G.dist u w β€ G.dist u v + G.dist v w",
" G.dist u w β€ (p.append q).length",
" G.dist u v β€ G.dist v u",
" G.dist u v β€ p.reverse.len... | [
" G.dist u v = 0 β u = v β¨ Β¬G.Reachable u v",
" G.dist v v = 0",
" G.dist u v = 0 β u = v",
" G.dist u v β 0",
" False",
" G.dist u v = 0",
" Set.univ.Nonempty",
" G.dist u w β€ G.dist u v + G.dist v w",
" G.dist u w β€ (p.append q).length",
" G.dist u v β€ G.dist v u",
" G.dist u v β€ p.reverse.len... |
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Combinatorics.SimpleGraph.Maps
open Finset
namespace SimpleGraph
variable {V : Type*} [DecidableEq V] (G : SimpleGraph V) (s t : V)
section AddEdge
def edge : SimpleGraph V := fromEdgeSet {s(s, t)}
lemma edge_adj (v w : V) : (edge s t).Adj v w β (v = s β§ w = t β¨ v = t β§ w = s) β§ v β w := by
rw [edge, fromEdgeSet_adj, Set.mem_singleton_iff, Sym2.eq_iff]
instance : DecidableRel (edge s t).Adj := fun _ _ β¦ by
rw [edge_adj]; infer_instance
lemma edge_self_eq_bot : edge s s = β₯ := by
ext; rw [edge_adj]; aesop
@[simp]
lemma sup_edge_self : G β edge s s = G := by
rw [edge_self_eq_bot, sup_of_le_left bot_le]
variable {s t}
lemma edge_edgeSet_of_ne (h : s β t) : (edge s t).edgeSet = {s(s, t)} := by
rwa [edge, edgeSet_fromEdgeSet, sdiff_eq_left, Set.disjoint_singleton_left, Set.mem_setOf_eq,
Sym2.isDiag_iff_proj_eq]
lemma sup_edge_of_adj (h : G.Adj s t) : G β edge s t = G := by
rwa [sup_eq_left, β edgeSet_subset_edgeSet, edge_edgeSet_of_ne h.ne, Set.singleton_subset_iff,
mem_edgeSet]
variable [Fintype V] [DecidableRel G.Adj]
instance : Fintype (edge s t).edgeSet := by rw [edge]; infer_instance
| Mathlib/Combinatorics/SimpleGraph/Operations.lean | 171 | 175 | theorem edgeFinset_sup_edge [Fintype (edgeSet (G β edge s t))] (hn : Β¬G.Adj s t) (h : s β t) :
(G β edge s t).edgeFinset = G.edgeFinset.cons s(s, t) (by simp_all) := by |
letI := Classical.decEq V
rw [edgeFinset_sup, cons_eq_insert, insert_eq, union_comm]
simp_rw [edgeFinset, edge_edgeSet_of_ne h]; rfl
| [
" (edge s t).Adj v w β (v = s β§ w = t β¨ v = t β§ w = s) β§ v β w",
" Decidable ((edge s t).Adj xβΒΉ xβ)",
" Decidable ((xβΒΉ = s β§ xβ = t β¨ xβΒΉ = t β§ xβ = s) β§ xβΒΉ β xβ)",
" edge s s = β₯",
" (edge s s).Adj xβΒΉ xβ β β₯.Adj xβΒΉ xβ",
" (xβΒΉ = s β§ xβ = s β¨ xβΒΉ = s β§ xβ = s) β§ xβΒΉ β xβ β β₯.Adj xβΒΉ xβ",
" G β edge... | [
" (edge s t).Adj v w β (v = s β§ w = t β¨ v = t β§ w = s) β§ v β w",
" Decidable ((edge s t).Adj xβΒΉ xβ)",
" Decidable ((xβΒΉ = s β§ xβ = t β¨ xβΒΉ = t β§ xβ = s) β§ xβΒΉ β xβ)",
" edge s s = β₯",
" (edge s s).Adj xβΒΉ xβ β β₯.Adj xβΒΉ xβ",
" (xβΒΉ = s β§ xβ = s β¨ xβΒΉ = s β§ xβ = s) β§ xβΒΉ β xβ β β₯.Adj xβΒΉ xβ",
" G β edge... |
import Mathlib.Data.Set.Image
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.with_bot_top from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
variable {Ξ± : Type*}
namespace WithTop
@[simp]
theorem preimage_coe_top : (some : Ξ± β WithTop Ξ±) β»ΒΉ' {β€} = (β
: Set Ξ±) :=
eq_empty_of_subset_empty fun _ => coe_ne_top
#align with_top.preimage_coe_top WithTop.preimage_coe_top
variable [Preorder Ξ±] {a b : Ξ±}
theorem range_coe : range (some : Ξ± β WithTop Ξ±) = Iio β€ := by
ext x
rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists]
#align with_top.range_coe WithTop.range_coe
@[simp]
theorem preimage_coe_Ioi : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ioi a = Ioi a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Ioi WithTop.preimage_coe_Ioi
@[simp]
theorem preimage_coe_Ici : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ici a = Ici a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Ici WithTop.preimage_coe_Ici
@[simp]
theorem preimage_coe_Iio : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Iio a = Iio a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Iio WithTop.preimage_coe_Iio
@[simp]
theorem preimage_coe_Iic : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Iic a = Iic a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Iic WithTop.preimage_coe_Iic
@[simp]
theorem preimage_coe_Icc : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Icc a b = Icc a b := by simp [β Ici_inter_Iic]
#align with_top.preimage_coe_Icc WithTop.preimage_coe_Icc
@[simp]
theorem preimage_coe_Ico : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ico a b = Ico a b := by simp [β Ici_inter_Iio]
#align with_top.preimage_coe_Ico WithTop.preimage_coe_Ico
@[simp]
| Mathlib/Order/Interval/Set/WithBotTop.lean | 67 | 67 | theorem preimage_coe_Ioc : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ioc a b = Ioc a b := by | simp [β Ioi_inter_Iic]
| [
" range some = Iio β€",
" x β range some β x β Iio β€",
" some β»ΒΉ' Icc βa βb = Icc a b",
" some β»ΒΉ' Ico βa βb = Ico a b",
" some β»ΒΉ' Ioc βa βb = Ioc a b"
] | [
" range some = Iio β€",
" x β range some β x β Iio β€",
" some β»ΒΉ' Icc βa βb = Icc a b",
" some β»ΒΉ' Ico βa βb = Ico a b"
] |
import Mathlib.Algebra.Group.Defs
import Mathlib.Algebra.GroupWithZero.Defs
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Tactic.Spread
import Mathlib.Util.AssertExists
#align_import algebra.ring.defs from "leanprover-community/mathlib"@"76de8ae01554c3b37d66544866659ff174e66e1f"
universe u v w x
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {R : Type x}
open Function
class Distrib (R : Type*) extends Mul R, Add R where
protected left_distrib : β a b c : R, a * (b + c) = a * b + a * c
protected right_distrib : β a b c : R, (a + b) * c = a * c + b * c
#align distrib Distrib
class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected left_distrib : β a b c : R, a * (b + c) = a * b + a * c
#align left_distrib_class LeftDistribClass
class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected right_distrib : β a b c : R, (a + b) * c = a * c + b * c
#align right_distrib_class RightDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R :=
β¨Distrib.left_distribβ©
#align distrib.left_distrib_class Distrib.leftDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] :
RightDistribClass R :=
β¨Distrib.right_distribβ©
#align distrib.right_distrib_class Distrib.rightDistribClass
theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) :
a * (b + c) = a * b + a * c :=
LeftDistribClass.left_distrib a b c
#align left_distrib left_distrib
alias mul_add := left_distrib
#align mul_add mul_add
theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) :
(a + b) * c = a * c + b * c :=
RightDistribClass.right_distrib a b c
#align right_distrib right_distrib
alias add_mul := right_distrib
#align add_mul add_mul
theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) :
(a + b + c) * d = a * d + b * d + c * d := by simp [right_distrib]
#align distrib_three_right distrib_three_right
class NonUnitalNonAssocSemiring (Ξ± : Type u) extends AddCommMonoid Ξ±, Distrib Ξ±, MulZeroClass Ξ±
#align non_unital_non_assoc_semiring NonUnitalNonAssocSemiring
class NonUnitalSemiring (Ξ± : Type u) extends NonUnitalNonAssocSemiring Ξ±, SemigroupWithZero Ξ±
#align non_unital_semiring NonUnitalSemiring
class NonAssocSemiring (Ξ± : Type u) extends NonUnitalNonAssocSemiring Ξ±, MulZeroOneClass Ξ±,
AddCommMonoidWithOne Ξ±
#align non_assoc_semiring NonAssocSemiring
class NonUnitalNonAssocRing (Ξ± : Type u) extends AddCommGroup Ξ±, NonUnitalNonAssocSemiring Ξ±
#align non_unital_non_assoc_ring NonUnitalNonAssocRing
class NonUnitalRing (Ξ± : Type*) extends NonUnitalNonAssocRing Ξ±, NonUnitalSemiring Ξ±
#align non_unital_ring NonUnitalRing
class NonAssocRing (Ξ± : Type*) extends NonUnitalNonAssocRing Ξ±, NonAssocSemiring Ξ±,
AddCommGroupWithOne Ξ±
#align non_assoc_ring NonAssocRing
class Semiring (Ξ± : Type u) extends NonUnitalSemiring Ξ±, NonAssocSemiring Ξ±, MonoidWithZero Ξ±
#align semiring Semiring
class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R
#align ring Ring
@[to_additive]
theorem mul_ite {Ξ±} [Mul Ξ±] (P : Prop) [Decidable P] (a b c : Ξ±) :
(a * if P then b else c) = if P then a * b else a * c := by split_ifs <;> rfl
#align mul_ite mul_ite
#align add_ite add_ite
@[to_additive]
theorem ite_mul {Ξ±} [Mul Ξ±] (P : Prop) [Decidable P] (a b c : Ξ±) :
(if P then a else b) * c = if P then a * c else b * c := by split_ifs <;> rfl
#align ite_mul ite_mul
#align ite_add ite_add
-- We make `mul_ite` and `ite_mul` simp lemmas,
-- but not `add_ite` or `ite_add`.
-- The problem we're trying to avoid is dealing with
-- summations of the form `β x β s, (f x + ite P 1 0)`,
-- in which `add_ite` followed by `sum_ite` would needlessly slice up
-- the `f x` terms according to whether `P` holds at `x`.
-- There doesn't appear to be a corresponding difficulty so far with
-- `mul_ite` and `ite_mul`.
attribute [simp] mul_ite ite_mul
theorem ite_sub_ite {Ξ±} [Sub Ξ±] (P : Prop) [Decidable P] (a b c d : Ξ±) :
((if P then a else b) - if P then c else d) = if P then a - c else b - d := by
split
repeat rfl
theorem ite_add_ite {Ξ±} [Add Ξ±] (P : Prop) [Decidable P] (a b c d : Ξ±) :
((if P then a else b) + if P then c else d) = if P then a + c else b + d := by
split
repeat rfl
-- Porting note: no @[simp] because simp proves it
| Mathlib/Algebra/Ring/Defs.lean | 244 | 245 | theorem mul_boole {Ξ±} [MulZeroOneClass Ξ±] (P : Prop) [Decidable P] (a : Ξ±) :
(a * if P then 1 else 0) = if P then a else 0 := by | simp
| [] | [] |
import Mathlib.Data.Fintype.Basic
#align_import data.fintype.quotient from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
def Quotient.finChoiceAux {ΞΉ : Type*} [DecidableEq ΞΉ] {Ξ± : ΞΉ β Type*} [S : β i, Setoid (Ξ± i)] :
β l : List ΞΉ, (β i β l, Quotient (S i)) β @Quotient (β i β l, Ξ± i) (by infer_instance)
| [], _ => β¦fun i h => nomatch List.not_mem_nil _ hβ§
| i :: l, f => by
refine Quotient.liftOnβ (f i (List.mem_cons_self _ _))
(Quotient.finChoiceAux l fun j h => f j (List.mem_cons_of_mem _ h)) ?_ ?_
Β· exact fun a l => β¦fun j h =>
if e : j = i then by rw [e]; exact a else l _ ((List.mem_cons.1 h).resolve_left e)β§
refine fun aβ lβ aβ lβ hβ hβ => Quotient.sound fun j h => ?_
by_cases e : j = i <;> simp [e]
Β· subst j
exact hβ
Β· exact hβ _ _
#align quotient.fin_choice_aux Quotient.finChoiceAux
theorem Quotient.finChoiceAux_eq {ΞΉ : Type*} [DecidableEq ΞΉ] {Ξ± : ΞΉ β Type*}
[S : β i, Setoid (Ξ± i)] :
β (l : List ΞΉ) (f : β i β l, Ξ± i), (Quotient.finChoiceAux l fun i h => β¦f i hβ§) = β¦fβ§
| [], f => Quotient.sound fun i h => nomatch List.not_mem_nil _ h
| i :: l, f => by
simp only [finChoiceAux, Quotient.finChoiceAux_eq l, eq_mpr_eq_cast, lift_mk]
refine Quotient.sound fun j h => ?_
by_cases e : j = i <;> simp [e] <;> try exact Setoid.refl _
subst j; exact Setoid.refl _
#align quotient.fin_choice_aux_eq Quotient.finChoiceAux_eq
def Quotient.finChoice {ΞΉ : Type*} [DecidableEq ΞΉ] [Fintype ΞΉ] {Ξ± : ΞΉ β Type*}
[S : β i, Setoid (Ξ± i)] (f : β i, Quotient (S i)) : @Quotient (β i, Ξ± i) (by infer_instance) :=
Quotient.liftOn
(@Quotient.recOn _ _ (fun l : Multiset ΞΉ => @Quotient (β i β l, Ξ± i) (by infer_instance))
Finset.univ.1 (fun l => Quotient.finChoiceAux l fun i _ => f i) (fun a b h => by
have := fun a => Quotient.finChoiceAux_eq a fun i _ => Quotient.out (f i)
simp? [Quotient.out_eq] at this says simp only [out_eq] at this
simp only [Multiset.quot_mk_to_coe, this]
let g := fun a : Multiset ΞΉ =>
(β¦fun (i : ΞΉ) (_ : i β a) => Quotient.out (f i)β§ : Quotient (by infer_instance))
apply eq_of_heq
trans (g a)
Β· exact eq_rec_heq (Ο := fun l : Multiset ΞΉ => @Quotient (β i β l, Ξ± i) (by infer_instance))
(Quotient.sound h) (g a)
Β· change HEq (g a) (g b); congr 1; exact Quotient.sound h))
(fun f => β¦fun i => f i (Finset.mem_univ _)β§) (fun a b h => Quotient.sound fun i => by apply h)
#align quotient.fin_choice Quotient.finChoice
| Mathlib/Data/Fintype/Quotient.lean | 76 | 84 | theorem Quotient.finChoice_eq {ΞΉ : Type*} [DecidableEq ΞΉ] [Fintype ΞΉ] {Ξ± : ΞΉ β Type*}
[β i, Setoid (Ξ± i)] (f : β i, Ξ± i) : (Quotient.finChoice fun i => β¦f iβ§) = β¦fβ§ := by |
dsimp only [Quotient.finChoice]
conv_lhs =>
enter [1]
tactic =>
change _ = β¦fun i _ => f iβ§
exact Quotient.inductionOn (@Finset.univ ΞΉ _).1 fun l => Quotient.finChoiceAux_eq _ _
rfl
| [
" Setoid ((i : ΞΉ) β i β l β Ξ± i)",
" Quotient inferInstance",
" Ξ± i β ((i : ΞΉ) β i β l β Ξ± i) β Quotient inferInstance",
" Ξ± j",
" Ξ± i",
" β (aβ : Ξ± i) (bβ : (i : ΞΉ) β i β l β Ξ± i) (aβ : Ξ± i) (bβ : (i : ΞΉ) β i β l β Ξ± i),\n aβ β aβ β\n bβ β bβ β\n β¦fun j h => if e : j = i then β―.mpr aβ else... | [
" Setoid ((i : ΞΉ) β i β l β Ξ± i)",
" Quotient inferInstance",
" Ξ± i β ((i : ΞΉ) β i β l β Ξ± i) β Quotient inferInstance",
" Ξ± j",
" Ξ± i",
" β (aβ : Ξ± i) (bβ : (i : ΞΉ) β i β l β Ξ± i) (aβ : Ξ± i) (bβ : (i : ΞΉ) β i β l β Ξ± i),\n aβ β aβ β\n bβ β bβ β\n β¦fun j h => if e : j = i then β―.mpr aβ else... |
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Algebra.MonoidAlgebra.Support
import Mathlib.Algebra.DirectSum.Internal
import Mathlib.RingTheory.GradedAlgebra.Basic
#align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3"
noncomputable section
namespace AddMonoidAlgebra
variable {M : Type*} {ΞΉ : Type*} {R : Type*}
section
variable (R) [CommSemiring R]
abbrev gradeBy (f : M β ΞΉ) (i : ΞΉ) : Submodule R R[M] where
carrier := { a | β m, m β a.support β f m = i }
zero_mem' m h := by cases h
add_mem' {a b} ha hb m h := by
classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m)
smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h
#align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy
abbrev grade (m : M) : Submodule R R[M] :=
gradeBy R id m
#align add_monoid_algebra.grade AddMonoidAlgebra.grade
theorem gradeBy_id : gradeBy R (id : M β M) = grade R := rfl
#align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id
theorem mem_gradeBy_iff (f : M β ΞΉ) (i : ΞΉ) (a : R[M]) :
a β gradeBy R f i β (a.support : Set M) β f β»ΒΉ' {i} := by rfl
#align add_monoid_algebra.mem_grade_by_iff AddMonoidAlgebra.mem_gradeBy_iff
theorem mem_grade_iff (m : M) (a : R[M]) : a β grade R m β a.support β {m} := by
rw [β Finset.coe_subset, Finset.coe_singleton]
rfl
#align add_monoid_algebra.mem_grade_iff AddMonoidAlgebra.mem_grade_iff
| Mathlib/Algebra/MonoidAlgebra/Grading.lean | 72 | 78 | theorem mem_grade_iff' (m : M) (a : R[M]) :
a β grade R m β a β (LinearMap.range (Finsupp.lsingle m : R ββ[R] M ββ R) :
Submodule R R[M]) := by |
rw [mem_grade_iff, Finsupp.support_subset_singleton']
apply exists_congr
intro r
constructor <;> exact Eq.symm
| [
" f m = i",
" a β gradeBy R f i β βa.support β f β»ΒΉ' {i}",
" a β grade R m β a.support β {m}",
" a β grade R m β βa.support β {m}",
" a β grade R m β a β LinearMap.range (Finsupp.lsingle m)",
" (β b, a = Finsupp.single m b) β a β LinearMap.range (Finsupp.lsingle m)",
" β (a_1 : R), a = Finsupp.single m ... | [
" f m = i",
" a β gradeBy R f i β βa.support β f β»ΒΉ' {i}",
" a β grade R m β a.support β {m}",
" a β grade R m β βa.support β {m}"
] |
import Mathlib.Algebra.CharP.ExpChar
import Mathlib.GroupTheory.OrderOfElement
#align_import algebra.char_p.two from "leanprover-community/mathlib"@"7f1ba1a333d66eed531ecb4092493cd1b6715450"
variable {R ΞΉ : Type*}
namespace CharTwo
section Semiring
variable [Semiring R] [CharP R 2]
theorem two_eq_zero : (2 : R) = 0 := by rw [β Nat.cast_two, CharP.cast_eq_zero]
#align char_two.two_eq_zero CharTwo.two_eq_zero
@[simp]
theorem add_self_eq_zero (x : R) : x + x = 0 := by rw [β two_smul R x, two_eq_zero, zero_smul]
#align char_two.add_self_eq_zero CharTwo.add_self_eq_zero
set_option linter.deprecated false in
@[simp]
theorem bit0_eq_zero : (bit0 : R β R) = 0 := by
funext
exact add_self_eq_zero _
#align char_two.bit0_eq_zero CharTwo.bit0_eq_zero
set_option linter.deprecated false in
| Mathlib/Algebra/CharP/Two.lean | 44 | 44 | theorem bit0_apply_eq_zero (x : R) : (bit0 x : R) = 0 := by | simp
| [
" 2 = 0",
" x + x = 0",
" bit0 = 0",
" bit0 xβ = 0 xβ",
" bit0 x = 0"
] | [
" 2 = 0",
" x + x = 0",
" bit0 = 0",
" bit0 xβ = 0 xβ"
] |
import Mathlib.Algebra.ContinuedFractions.Computation.ApproximationCorollaries
import Mathlib.Algebra.ContinuedFractions.Computation.Translations
import Mathlib.Data.Real.Irrational
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.Basic
#align_import number_theory.diophantine_approximation from "leanprover-community/mathlib"@"e25a317463bd37d88e33da164465d8c47922b1cd"
namespace Real
section Dirichlet
open Finset Int
theorem exists_int_int_abs_mul_sub_le (ΞΎ : β) {n : β} (n_pos : 0 < n) :
β j k : β€, 0 < k β§ k β€ n β§ |βk * ΞΎ - j| β€ 1 / (n + 1) := by
let f : β€ β β€ := fun m => βfract (ΞΎ * m) * (n + 1)β
have hn : 0 < (n : β) + 1 := mod_cast Nat.succ_pos _
have hfu := fun m : β€ => mul_lt_of_lt_one_left hn <| fract_lt_one (ΞΎ * βm)
conv in |_| β€ _ => rw [mul_comm, le_div_iff hn, β abs_of_pos hn, β abs_mul]
let D := Icc (0 : β€) n
by_cases H : β m β D, f m = n
Β· obtain β¨m, hm, hfβ© := H
have hf' : ((n : β€) : β) β€ fract (ΞΎ * m) * (n + 1) := hf βΈ floor_le (fract (ΞΎ * m) * (n + 1))
have hmβ : 0 < m := by
have hfβ : f 0 = 0 := by
-- Porting note: was
-- simp only [floor_eq_zero_iff, algebraMap.coe_zero, mul_zero, fract_zero,
-- zero_mul, Set.left_mem_Ico, zero_lt_one]
simp only [f, cast_zero, mul_zero, fract_zero, zero_mul, floor_zero]
refine Ne.lt_of_le (fun h => n_pos.ne ?_) (mem_Icc.mp hm).1
exact mod_cast hfβ.symm.trans (h.symm βΈ hf : f 0 = n)
refine β¨βΞΎ * mβ + 1, m, hmβ, (mem_Icc.mp hm).2, ?_β©
rw [cast_add, β sub_sub, sub_mul, cast_one, one_mul, abs_le]
refine
β¨le_sub_iff_add_le.mpr ?_, sub_le_iff_le_add.mpr <| le_of_lt <| (hfu m).trans <| lt_one_add _β©
simpa only [neg_add_cancel_comm_assoc] using hf'
Β· -- Porting note(https://github.com/leanprover-community/mathlib4/issues/5127): added `not_and`
simp_rw [not_exists, not_and] at H
have hD : (Ico (0 : β€) n).card < D.card := by rw [card_Icc, card_Ico]; exact lt_add_one n
have hfu' : β m, f m β€ n := fun m => lt_add_one_iff.mp (floor_lt.mpr (mod_cast hfu m))
have hwd : β m : β€, m β D β f m β Ico (0 : β€) n := fun x hx =>
mem_Ico.mpr
β¨floor_nonneg.mpr (mul_nonneg (fract_nonneg (ΞΎ * x)) hn.le), Ne.lt_of_le (H x hx) (hfu' x)β©
obtain β¨x, hx, y, hy, x_lt_y, hxyβ© : β x β D, β y β D, x < y β§ f x = f y := by
obtain β¨x, hx, y, hy, x_ne_y, hxyβ© := exists_ne_map_eq_of_card_lt_of_maps_to hD hwd
rcases lt_trichotomy x y with (h | h | h)
exacts [β¨x, hx, y, hy, h, hxyβ©, False.elim (x_ne_y h), β¨y, hy, x, hx, h, hxy.symmβ©]
refine
β¨βΞΎ * yβ - βΞΎ * xβ, y - x, sub_pos_of_lt x_lt_y,
sub_le_iff_le_add.mpr <| le_add_of_le_of_nonneg (mem_Icc.mp hy).2 (mem_Icc.mp hx).1, ?_β©
convert_to |fract (ΞΎ * y) * (n + 1) - fract (ΞΎ * x) * (n + 1)| β€ 1
Β· congr; push_cast; simp only [fract]; ring
exact (abs_sub_lt_one_of_floor_eq_floor hxy.symm).le
#align real.exists_int_int_abs_mul_sub_le Real.exists_int_int_abs_mul_sub_le
| Mathlib/NumberTheory/DiophantineApproximation.lean | 139 | 144 | theorem exists_nat_abs_mul_sub_round_le (ΞΎ : β) {n : β} (n_pos : 0 < n) :
β k : β, 0 < k β§ k β€ n β§ |βk * ΞΎ - round (βk * ΞΎ)| β€ 1 / (n + 1) := by |
obtain β¨j, k, hkβ, hkβ, hβ© := exists_int_int_abs_mul_sub_le ΞΎ n_pos
have hk := toNat_of_nonneg hkβ.le
rw [β hk] at hkβ hkβ h
exact β¨k.toNat, natCast_pos.mp hkβ, Nat.cast_le.mp hkβ, (round_le (βk.toNat * ΞΎ) j).trans hβ©
| [
" β j k, 0 < k β§ k β€ βn β§ |βk * ΞΎ - βj| β€ 1 / (βn + 1)",
"ΞΎ : β\nn : β\nn_pos : 0 < n\nf : β€ β β€ := fun m => βfract (ΞΎ * βm) * (βn + 1)β\nhn : 0 < βn + 1\nhfu : β (m : β€), fract (ΞΎ * βm) * (βn + 1) < βn + 1\nj k : β€\n| |βk * ΞΎ - βj| β€ 1 / (βn + 1)",
" β j k, 0 < k β§ k β€ βn β§ |(ΞΎ * βk - βj) * (βn + 1)| β€ 1",
"... | [
" β j k, 0 < k β§ k β€ βn β§ |βk * ΞΎ - βj| β€ 1 / (βn + 1)",
"ΞΎ : β\nn : β\nn_pos : 0 < n\nf : β€ β β€ := fun m => βfract (ΞΎ * βm) * (βn + 1)β\nhn : 0 < βn + 1\nhfu : β (m : β€), fract (ΞΎ * βm) * (βn + 1) < βn + 1\nj k : β€\n| |βk * ΞΎ - βj| β€ 1 / (βn + 1)",
" β j k, 0 < k β§ k β€ βn β§ |(ΞΎ * βk - βj) * (βn + 1)| β€ 1",
"... |
import Mathlib.Topology.PartialHomeomorph
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Data.Real.Sqrt
#align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Set Metric Pointwise
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace β E]
noncomputable section
@[simps (config := .lemmasOnly)]
def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where
toFun x := (β(1 + βxβ ^ 2))β»ΒΉ β’ x
invFun y := (β(1 - β(y : E)β ^ 2))β»ΒΉ β’ (y : E)
source := univ
target := ball 0 1
map_source' x _ := by
have : 0 < 1 + βxβ ^ 2 := by positivity
rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, β _root_.div_eq_inv_mul,
div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), β abs_norm x, β sq_lt_sq,
abs_norm, Real.sq_sqrt this.le]
exact lt_one_add _
map_target' _ _ := trivial
left_inv' x _ := by
field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs,
Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, β Real.sqrt_div (zero_lt_one_add_norm_sq x).le]
right_inv' y hy := by
have : 0 < 1 - βyβ ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le,
β Real.sqrt_div this.le]
open_source := isOpen_univ
open_target := isOpen_ball
continuousOn_toFun := by
suffices Continuous fun (x:E) => (β(1 + βxβ ^ 2))β»ΒΉ
from (this.smul continuous_id).continuousOn
refine Continuous.invβ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity)
continuity
continuousOn_invFun := by
have : β y β ball (0 : E) 1, β(1 - β(y : E)β ^ 2) β 0 := fun y hy β¦ by
rw [Real.sqrt_ne_zero']
nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
exact ContinuousOn.smul (ContinuousOn.invβ
(continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id
@[simp]
| Mathlib/Analysis/NormedSpace/HomeomorphBall.lean | 77 | 78 | theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by |
simp [PartialHomeomorph.univUnitBall_apply]
| [
" (fun x => (β(1 + βxβ ^ 2))β»ΒΉ β’ x) x β ball 0 1",
" 0 < 1 + βxβ ^ 2",
" βxβ ^ 2 < 1 + βxβ ^ 2",
" (fun y => (β(1 - βyβ ^ 2))β»ΒΉ β’ y) ((fun x => (β(1 + βxβ ^ 2))β»ΒΉ β’ x) x) = x",
" (fun x => (β(1 + βxβ ^ 2))β»ΒΉ β’ x) ((fun y => (β(1 - βyβ ^ 2))β»ΒΉ β’ y) y) = y",
" 0 < 1 - βyβ ^ 2",
" ContinuousOn\n β{ toFu... | [
" (fun x => (β(1 + βxβ ^ 2))β»ΒΉ β’ x) x β ball 0 1",
" 0 < 1 + βxβ ^ 2",
" βxβ ^ 2 < 1 + βxβ ^ 2",
" (fun y => (β(1 - βyβ ^ 2))β»ΒΉ β’ y) ((fun x => (β(1 + βxβ ^ 2))β»ΒΉ β’ x) x) = x",
" (fun x => (β(1 + βxβ ^ 2))β»ΒΉ β’ x) ((fun y => (β(1 - βyβ ^ 2))β»ΒΉ β’ y) y) = y",
" 0 < 1 - βyβ ^ 2",
" ContinuousOn\n β{ toFu... |
import Mathlib.Data.Set.Pointwise.Interval
import Mathlib.Topology.Algebra.Field
import Mathlib.Topology.Algebra.Order.Group
#align_import topology.algebra.order.field from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
open Set Filter TopologicalSpace Function
open scoped Pointwise Topology
open OrderDual (toDual ofDual)
theorem TopologicalRing.of_norm {R π : Type*} [NonUnitalNonAssocRing R] [LinearOrderedField π]
[TopologicalSpace R] [TopologicalAddGroup R] (norm : R β π)
(norm_nonneg : β x, 0 β€ norm x) (norm_mul_le : β x y, norm (x * y) β€ norm x * norm y)
(nhds_basis : (π (0 : R)).HasBasis ((0 : π) < Β·) (fun Ξ΅ β¦ { x | norm x < Ξ΅ })) :
TopologicalRing R := by
have h0 : β f : R β R, β c β₯ (0 : π), (β x, norm (f x) β€ c * norm x) β
Tendsto f (π 0) (π 0) := by
refine fun f c c0 hf β¦ (nhds_basis.tendsto_iff nhds_basis).2 fun Ξ΅ Ξ΅0 β¦ ?_
rcases exists_pos_mul_lt Ξ΅0 c with β¨Ξ΄, Ξ΄0, hΞ΄β©
refine β¨Ξ΄, Ξ΄0, fun x hx β¦ (hf _).trans_lt ?_β©
exact (mul_le_mul_of_nonneg_left (le_of_lt hx) c0).trans_lt hΞ΄
apply TopologicalRing.of_addGroup_of_nhds_zero
case hmul =>
refine ((nhds_basis.prod nhds_basis).tendsto_iff nhds_basis).2 fun Ξ΅ Ξ΅0 β¦ ?_
refine β¨(1, Ξ΅), β¨one_pos, Ξ΅0β©, fun (x, y) β¨hx, hyβ© => ?_β©
simp only [sub_zero] at *
calc norm (x * y) β€ norm x * norm y := norm_mul_le _ _
_ < Ξ΅ := mul_lt_of_le_one_of_lt_of_nonneg hx.le hy (norm_nonneg _)
case hmul_left => exact fun x => h0 _ (norm x) (norm_nonneg _) (norm_mul_le x)
case hmul_right =>
exact fun y => h0 (Β· * y) (norm y) (norm_nonneg y) fun x =>
(norm_mul_le x y).trans_eq (mul_comm _ _)
variable {π Ξ± : Type*} [LinearOrderedField π] [TopologicalSpace π] [OrderTopology π]
{l : Filter Ξ±} {f g : Ξ± β π}
-- see Note [lower instance priority]
instance (priority := 100) LinearOrderedField.topologicalRing : TopologicalRing π :=
.of_norm abs abs_nonneg (fun _ _ β¦ (abs_mul _ _).le) <| by
simpa using nhds_basis_abs_sub_lt (0 : π)
theorem Filter.Tendsto.atTop_mul {C : π} (hC : 0 < C) (hf : Tendsto f l atTop)
(hg : Tendsto g l (π C)) : Tendsto (fun x => f x * g x) l atTop := by
refine tendsto_atTop_mono' _ ?_ (hf.atTop_mul_const (half_pos hC))
filter_upwards [hg.eventually (lt_mem_nhds (half_lt_self hC)), hf.eventually_ge_atTop 0]
with x hg hf using mul_le_mul_of_nonneg_left hg.le hf
#align filter.tendsto.at_top_mul Filter.Tendsto.atTop_mul
theorem Filter.Tendsto.mul_atTop {C : π} (hC : 0 < C) (hf : Tendsto f l (π C))
(hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atTop := by
simpa only [mul_comm] using hg.atTop_mul hC hf
#align filter.tendsto.mul_at_top Filter.Tendsto.mul_atTop
| Mathlib/Topology/Algebra/Order/Field.lean | 79 | 82 | theorem Filter.Tendsto.atTop_mul_neg {C : π} (hC : C < 0) (hf : Tendsto f l atTop)
(hg : Tendsto g l (π C)) : Tendsto (fun x => f x * g x) l atBot := by |
have := hf.atTop_mul (neg_pos.2 hC) hg.neg
simpa only [(Β· β Β·), neg_mul_eq_mul_neg, neg_neg] using tendsto_neg_atTop_atBot.comp this
| [
" TopologicalRing R",
" β (f : R β R), β c β₯ 0, (β (x : R), norm (f x) β€ c * norm x) β Tendsto f (π 0) (π 0)",
" β ia, 0 < ia β§ β x β {x | norm x < ia}, f x β {x | norm x < Ξ΅}",
" c * norm x < Ξ΅",
" β (xβ : R), Tendsto (fun x => x * xβ) (π 0) (π 0)",
" Tendsto (uncurry fun x x_1 => x * x_1) (π 0 ΓΛ’ οΏ½... | [
" TopologicalRing R",
" β (f : R β R), β c β₯ 0, (β (x : R), norm (f x) β€ c * norm x) β Tendsto f (π 0) (π 0)",
" β ia, 0 < ia β§ β x β {x | norm x < ia}, f x β {x | norm x < Ξ΅}",
" c * norm x < Ξ΅",
" β (xβ : R), Tendsto (fun x => x * xβ) (π 0) (π 0)",
" Tendsto (uncurry fun x x_1 => x * x_1) (π 0 ΓΛ’ οΏ½... |
import Mathlib.Topology.Algebra.InfiniteSum.Order
import Mathlib.Topology.Algebra.InfiniteSum.Ring
import Mathlib.Topology.Instances.Real
import Mathlib.Topology.MetricSpace.Isometry
#align_import topology.instances.nnreal from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
noncomputable section
open Set TopologicalSpace Metric Filter
open Topology
namespace NNReal
open NNReal Filter
instance : TopologicalSpace ββ₯0 := inferInstance
-- short-circuit type class inference
instance : TopologicalSemiring ββ₯0 where
toContinuousAdd := continuousAdd_induced toRealHom
toContinuousMul := continuousMul_induced toRealHom
instance : SecondCountableTopology ββ₯0 :=
inferInstanceAs (SecondCountableTopology { x : β | 0 β€ x })
instance : OrderTopology ββ₯0 :=
orderTopology_of_ordConnected (t := Ici 0)
instance : CompleteSpace ββ₯0 :=
isClosed_Ici.completeSpace_coe
instance : ContinuousStar ββ₯0 where
continuous_star := continuous_id
section coe
variable {Ξ± : Type*}
open Filter Finset
theorem _root_.continuous_real_toNNReal : Continuous Real.toNNReal :=
(continuous_id.max continuous_const).subtype_mk _
#align continuous_real_to_nnreal continuous_real_toNNReal
@[simps (config := .asFn)]
noncomputable def _root_.ContinuousMap.realToNNReal : C(β, ββ₯0) :=
.mk Real.toNNReal continuous_real_toNNReal
theorem continuous_coe : Continuous ((β) : ββ₯0 β β) :=
continuous_subtype_val
#align nnreal.continuous_coe NNReal.continuous_coe
@[simps (config := .asFn)]
def _root_.ContinuousMap.coeNNRealReal : C(ββ₯0, β) :=
β¨(β), continuous_coeβ©
#align continuous_map.coe_nnreal_real ContinuousMap.coeNNRealReal
#align continuous_map.coe_nnreal_real_apply ContinuousMap.coeNNRealReal_apply
instance ContinuousMap.canLift {X : Type*} [TopologicalSpace X] :
CanLift C(X, β) C(X, ββ₯0) ContinuousMap.coeNNRealReal.comp fun f => β x, 0 β€ f x where
prf f hf := β¨β¨fun x => β¨f x, hf xβ©, f.2.subtype_mk _β©, DFunLike.ext' rflβ©
#align nnreal.continuous_map.can_lift NNReal.ContinuousMap.canLift
@[simp, norm_cast]
theorem tendsto_coe {f : Filter Ξ±} {m : Ξ± β ββ₯0} {x : ββ₯0} :
Tendsto (fun a => (m a : β)) f (π (x : β)) β Tendsto m f (π x) :=
tendsto_subtype_rng.symm
#align nnreal.tendsto_coe NNReal.tendsto_coe
theorem tendsto_coe' {f : Filter Ξ±} [NeBot f] {m : Ξ± β ββ₯0} {x : β} :
Tendsto (fun a => m a : Ξ± β β) f (π x) β β hx : 0 β€ x, Tendsto m f (π β¨x, hxβ©) :=
β¨fun h => β¨ge_of_tendsto' h fun c => (m c).2, tendsto_coe.1 hβ©, fun β¨_, hmβ© => tendsto_coe.2 hmβ©
#align nnreal.tendsto_coe' NNReal.tendsto_coe'
@[simp] theorem map_coe_atTop : map toReal atTop = atTop := map_val_Ici_atTop 0
#align nnreal.map_coe_at_top NNReal.map_coe_atTop
theorem comap_coe_atTop : comap toReal atTop = atTop := (atTop_Ici_eq 0).symm
#align nnreal.comap_coe_at_top NNReal.comap_coe_atTop
@[simp, norm_cast]
theorem tendsto_coe_atTop {f : Filter Ξ±} {m : Ξ± β ββ₯0} :
Tendsto (fun a => (m a : β)) f atTop β Tendsto m f atTop :=
tendsto_Ici_atTop.symm
#align nnreal.tendsto_coe_at_top NNReal.tendsto_coe_atTop
theorem _root_.tendsto_real_toNNReal {f : Filter Ξ±} {m : Ξ± β β} {x : β} (h : Tendsto m f (π x)) :
Tendsto (fun a => Real.toNNReal (m a)) f (π (Real.toNNReal x)) :=
(continuous_real_toNNReal.tendsto _).comp h
#align tendsto_real_to_nnreal tendsto_real_toNNReal
theorem _root_.tendsto_real_toNNReal_atTop : Tendsto Real.toNNReal atTop atTop := by
rw [β tendsto_coe_atTop]
exact tendsto_atTop_mono Real.le_coe_toNNReal tendsto_id
#align tendsto_real_to_nnreal_at_top tendsto_real_toNNReal_atTop
theorem nhds_zero : π (0 : ββ₯0) = β¨
(a : ββ₯0) (_ : a β 0), π (Iio a) :=
nhds_bot_order.trans <| by simp only [bot_lt_iff_ne_bot]; rfl
#align nnreal.nhds_zero NNReal.nhds_zero
theorem nhds_zero_basis : (π (0 : ββ₯0)).HasBasis (fun a : ββ₯0 => 0 < a) fun a => Iio a :=
nhds_bot_basis
#align nnreal.nhds_zero_basis NNReal.nhds_zero_basis
instance : ContinuousSub ββ₯0 :=
β¨((continuous_coe.fst'.sub continuous_coe.snd').max continuous_const).subtype_mk _β©
instance : HasContinuousInvβ ββ₯0 := inferInstance
instance [TopologicalSpace Ξ±] [MulAction β Ξ±] [ContinuousSMul β Ξ±] :
ContinuousSMul ββ₯0 Ξ± where
continuous_smul := continuous_induced_dom.fst'.smul continuous_snd
@[norm_cast]
| Mathlib/Topology/Instances/NNReal.lean | 163 | 164 | theorem hasSum_coe {f : Ξ± β ββ₯0} {r : ββ₯0} : HasSum (fun a => (f a : β)) (r : β) β HasSum f r := by |
simp only [HasSum, β coe_sum, tendsto_coe]
| [
" Tendsto Real.toNNReal atTop atTop",
" Tendsto (fun a => βa.toNNReal) atTop atTop",
" β¨
l, β¨
(_ : β₯ < l), π (Set.Iio l) = β¨
a, β¨
(_ : a β 0), π (Set.Iio a)",
" β¨
l, β¨
(_ : l β β₯), π (Set.Iio l) = β¨
a, β¨
(_ : a β 0), π (Set.Iio a)",
" HasSum (fun a => β(f a)) βr β HasSum f r"
] | [
" Tendsto Real.toNNReal atTop atTop",
" Tendsto (fun a => βa.toNNReal) atTop atTop",
" β¨
l, β¨
(_ : β₯ < l), π (Set.Iio l) = β¨
a, β¨
(_ : a β 0), π (Set.Iio a)",
" β¨
l, β¨
(_ : l β β₯), π (Set.Iio l) = β¨
a, β¨
(_ : a β 0), π (Set.Iio a)"
] |
import Mathlib.Data.Set.Prod
#align_import data.set.n_ary from "leanprover-community/mathlib"@"5e526d18cea33550268dcbbddcb822d5cde40654"
open Function
namespace Set
variable {Ξ± Ξ±' Ξ² Ξ²' Ξ³ Ξ³' Ξ΄ Ξ΄' Ξ΅ Ξ΅' ΞΆ ΞΆ' Ξ½ : Type*} {f f' : Ξ± β Ξ² β Ξ³} {g g' : Ξ± β Ξ² β Ξ³ β Ξ΄}
variable {s s' : Set Ξ±} {t t' : Set Ξ²} {u u' : Set Ξ³} {v : Set Ξ΄} {a a' : Ξ±} {b b' : Ξ²} {c c' : Ξ³}
{d d' : Ξ΄}
theorem mem_image2_iff (hf : Injective2 f) : f a b β image2 f s t β a β s β§ b β t :=
β¨by
rintro β¨a', ha', b', hb', hβ©
rcases hf h with β¨rfl, rflβ©
exact β¨ha', hb'β©, fun β¨ha, hbβ© => mem_image2_of_mem ha hbβ©
#align set.mem_image2_iff Set.mem_image2_iff
theorem image2_subset (hs : s β s') (ht : t β t') : image2 f s t β image2 f s' t' := by
rintro _ β¨a, ha, b, hb, rflβ©
exact mem_image2_of_mem (hs ha) (ht hb)
#align set.image2_subset Set.image2_subset
theorem image2_subset_left (ht : t β t') : image2 f s t β image2 f s t' :=
image2_subset Subset.rfl ht
#align set.image2_subset_left Set.image2_subset_left
theorem image2_subset_right (hs : s β s') : image2 f s t β image2 f s' t :=
image2_subset hs Subset.rfl
#align set.image2_subset_right Set.image2_subset_right
theorem image_subset_image2_left (hb : b β t) : (fun a => f a b) '' s β image2 f s t :=
forall_mem_image.2 fun _ ha => mem_image2_of_mem ha hb
#align set.image_subset_image2_left Set.image_subset_image2_left
theorem image_subset_image2_right (ha : a β s) : f a '' t β image2 f s t :=
forall_mem_image.2 fun _ => mem_image2_of_mem ha
#align set.image_subset_image2_right Set.image_subset_image2_right
theorem forall_image2_iff {p : Ξ³ β Prop} :
(β z β image2 f s t, p z) β β x β s, β y β t, p (f x y) :=
β¨fun h x hx y hy => h _ β¨x, hx, y, hy, rflβ©, fun h _ β¨x, hx, y, hy, hzβ© => hz βΈ h x hx y hyβ©
#align set.forall_image2_iff Set.forall_image2_iff
@[simp]
theorem image2_subset_iff {u : Set Ξ³} : image2 f s t β u β β x β s, β y β t, f x y β u :=
forall_image2_iff
#align set.image2_subset_iff Set.image2_subset_iff
theorem image2_subset_iff_left : image2 f s t β u β β a β s, (fun b => f a b) '' t β u := by
simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage]
#align set.image2_subset_iff_left Set.image2_subset_iff_left
theorem image2_subset_iff_right : image2 f s t β u β β b β t, (fun a => f a b) '' s β u := by
simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage, @forallβ_swap Ξ±]
#align set.image2_subset_iff_right Set.image2_subset_iff_right
variable (f)
-- Porting note: Removing `simp` - LHS does not simplify
lemma image_prod : (fun x : Ξ± Γ Ξ² β¦ f x.1 x.2) '' s ΓΛ’ t = image2 f s t :=
ext fun _ β¦ by simp [and_assoc]
#align set.image_prod Set.image_prod
@[simp] lemma image_uncurry_prod (s : Set Ξ±) (t : Set Ξ²) : uncurry f '' s ΓΛ’ t = image2 f s t :=
image_prod _
#align set.image_uncurry_prod Set.image_uncurry_prod
@[simp] lemma image2_mk_eq_prod : image2 Prod.mk s t = s ΓΛ’ t := ext <| by simp
#align set.image2_mk_eq_prod Set.image2_mk_eq_prod
-- Porting note: Removing `simp` - LHS does not simplify
lemma image2_curry (f : Ξ± Γ Ξ² β Ξ³) (s : Set Ξ±) (t : Set Ξ²) :
image2 (fun a b β¦ f (a, b)) s t = f '' s ΓΛ’ t := by
simp [β image_uncurry_prod, uncurry]
#align set.image2_curry Set.image2_curry
theorem image2_swap (s : Set Ξ±) (t : Set Ξ²) : image2 f s t = image2 (fun a b => f b a) t s := by
ext
constructor <;> rintro β¨a, ha, b, hb, rflβ© <;> exact β¨b, hb, a, ha, rflβ©
#align set.image2_swap Set.image2_swap
variable {f}
theorem image2_union_left : image2 f (s βͺ s') t = image2 f s t βͺ image2 f s' t := by
simp_rw [β image_prod, union_prod, image_union]
#align set.image2_union_left Set.image2_union_left
| Mathlib/Data/Set/NAry.lean | 107 | 108 | theorem image2_union_right : image2 f s (t βͺ t') = image2 f s t βͺ image2 f s t' := by |
rw [β image2_swap, image2_union_left, image2_swap f, image2_swap f]
| [
" f a b β image2 f s t β a β s β§ b β t",
" a β s β§ b β t",
" a' β s β§ b' β t",
" image2 f s t β image2 f s' t'",
" f a b β image2 f s' t'",
" image2 f s t β u β β a β s, (fun b => f a b) '' t β u",
" image2 f s t β u β β b β t, (fun a => f a b) '' s β u",
" xβ β (fun x => f x.1 x.2) '' s ΓΛ’ t β xβ β i... | [
" f a b β image2 f s t β a β s β§ b β t",
" a β s β§ b β t",
" a' β s β§ b' β t",
" image2 f s t β image2 f s' t'",
" f a b β image2 f s' t'",
" image2 f s t β u β β a β s, (fun b => f a b) '' t β u",
" image2 f s t β u β β b β t, (fun a => f a b) '' s β u",
" xβ β (fun x => f x.1 x.2) '' s ΓΛ’ t β xβ β i... |
import Mathlib.Algebra.CharP.Two
import Mathlib.Algebra.CharP.Reduced
import Mathlib.Algebra.NeZero
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.GroupTheory.SpecificGroups.Cyclic
import Mathlib.NumberTheory.Divisors
import Mathlib.RingTheory.IntegralDomain
import Mathlib.Tactic.Zify
#align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
open scoped Classical Polynomial
noncomputable section
open Polynomial
open Finset
variable {M N G R S F : Type*}
variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G]
section rootsOfUnity
variable {k l : β+}
def rootsOfUnity (k : β+) (M : Type*) [CommMonoid M] : Subgroup MΛ£ where
carrier := {ΞΆ | ΞΆ ^ (k : β) = 1}
one_mem' := one_pow _
mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul]
inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one]
#align roots_of_unity rootsOfUnity
@[simp]
theorem mem_rootsOfUnity (k : β+) (ΞΆ : MΛ£) : ΞΆ β rootsOfUnity k M β ΞΆ ^ (k : β) = 1 :=
Iff.rfl
#align mem_roots_of_unity mem_rootsOfUnity
theorem mem_rootsOfUnity' (k : β+) (ΞΆ : MΛ£) : ΞΆ β rootsOfUnity k M β (ΞΆ : M) ^ (k : β) = 1 := by
rw [mem_rootsOfUnity]; norm_cast
#align mem_roots_of_unity' mem_rootsOfUnity'
@[simp]
theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = β₯ := by ext; simp
theorem rootsOfUnity.coe_injective {n : β+} :
Function.Injective (fun x : rootsOfUnity n M β¦ x.val.val) :=
Units.ext.comp fun _ _ => Subtype.eq
#align roots_of_unity.coe_injective rootsOfUnity.coe_injective
@[simps! coe_val]
def rootsOfUnity.mkOfPowEq (ΞΆ : M) {n : β+} (h : ΞΆ ^ (n : β) = 1) : rootsOfUnity n M :=
β¨Units.ofPowEqOne ΞΆ n h n.ne_zero, Units.pow_ofPowEqOne _ _β©
#align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq
#align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe
@[simp]
theorem rootsOfUnity.coe_mkOfPowEq {ΞΆ : M} {n : β+} (h : ΞΆ ^ (n : β) = 1) :
((rootsOfUnity.mkOfPowEq _ h : MΛ£) : M) = ΞΆ :=
rfl
#align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq
theorem rootsOfUnity_le_of_dvd (h : k β£ l) : rootsOfUnity k M β€ rootsOfUnity l M := by
obtain β¨d, rflβ© := h
intro ΞΆ h
simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow]
#align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd
theorem map_rootsOfUnity (f : MΛ£ β* NΛ£) (k : β+) : (rootsOfUnity k M).map f β€ rootsOfUnity k N := by
rintro _ β¨ΞΆ, h, rflβ©
simp_all only [β map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one]
#align map_roots_of_unity map_rootsOfUnity
@[norm_cast]
theorem rootsOfUnity.coe_pow [CommMonoid R] (ΞΆ : rootsOfUnity k R) (m : β) :
(((ΞΆ ^ m :) : RΛ£) : R) = ((ΞΆ : RΛ£) : R) ^ m := by
rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val]
#align roots_of_unity.coe_pow rootsOfUnity.coe_pow
section Reduced
variable (R) [CommRing R] [IsReduced R]
-- @[simp] -- Porting note: simp normal form is `mem_rootsOfUnity_prime_pow_mul_iff'`
| Mathlib/RingTheory/RootsOfUnity/Basic.lean | 268 | 271 | theorem mem_rootsOfUnity_prime_pow_mul_iff (p k : β) (m : β+) [ExpChar R p]
{ΞΆ : RΛ£} : ΞΆ β rootsOfUnity (β¨p, expChar_pos R pβ© ^ k * m) R β ΞΆ β rootsOfUnity m R := by |
simp only [mem_rootsOfUnity', PNat.mul_coe, PNat.pow_coe, PNat.mk_coe,
ExpChar.pow_prime_pow_mul_eq_one_iff]
| [
" aβ * bβ β {ΞΆ | ΞΆ ^ βk = 1}",
" xβΒΉβ»ΒΉ β { carrier := {ΞΆ | ΞΆ ^ βk = 1}, mul_mem' := β―, one_mem' := β― }.carrier",
" ΞΆ β rootsOfUnity k M β βΞΆ ^ βk = 1",
" ΞΆ ^ βk = 1 β βΞΆ ^ βk = 1",
" rootsOfUnity 1 M = β₯",
" xβ β rootsOfUnity 1 M β xβ β β₯",
" rootsOfUnity k M β€ rootsOfUnity l M",
" rootsOfUnity k M β€ ... | [
" aβ * bβ β {ΞΆ | ΞΆ ^ βk = 1}",
" xβΒΉβ»ΒΉ β { carrier := {ΞΆ | ΞΆ ^ βk = 1}, mul_mem' := β―, one_mem' := β― }.carrier",
" ΞΆ β rootsOfUnity k M β βΞΆ ^ βk = 1",
" ΞΆ ^ βk = 1 β βΞΆ ^ βk = 1",
" rootsOfUnity 1 M = β₯",
" xβ β rootsOfUnity 1 M β xβ β β₯",
" rootsOfUnity k M β€ rootsOfUnity l M",
" rootsOfUnity k M β€ ... |
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
import Mathlib.Probability.Independence.Basic
#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open scoped Classical MeasureTheory NNReal ENNReal
open TopologicalSpace MeasureTheory.Measure
noncomputable section
namespace MeasureTheory
variable {Ξ© E : Type*} [MeasurableSpace E]
class HasPDF {m : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) : Prop where
pdf' : AEMeasurable X β β§ (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ
#align measure_theory.has_pdf MeasureTheory.HasPDF
section HasPDF
variable {_ : MeasurableSpace Ξ©}
theorem hasPDF_iff {X : Ξ© β E} {β : Measure Ξ©} {ΞΌ : Measure E} :
HasPDF X β ΞΌ β AEMeasurable X β β§ (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ :=
β¨@HasPDF.pdf' _ _ _ _ _ _ _, HasPDF.mkβ©
#align measure_theory.pdf.has_pdf_iff MeasureTheory.hasPDF_iff
| Mathlib/Probability/Density.lean | 82 | 86 | theorem hasPDF_iff_of_aemeasurable {X : Ξ© β E} {β : Measure Ξ©}
{ΞΌ : Measure E} (hX : AEMeasurable X β) :
HasPDF X β ΞΌ β (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ := by |
rw [hasPDF_iff]
simp only [hX, true_and]
| [
" HasPDF X β ΞΌ β (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ",
" AEMeasurable X β β§ (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ β\n (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ"
] | [] |
import Mathlib.Probability.ProbabilityMassFunction.Constructions
import Mathlib.Tactic.FinCases
namespace PMF
open ENNReal
noncomputable
def binomial (p : ββ₯0β) (h : p β€ 1) (n : β) : PMF (Fin (n + 1)) :=
.ofFintype (fun i => p^(i : β) * (1-p)^((Fin.last n - i) : β) * (n.choose i : β)) (by
convert (add_pow p (1-p) n).symm
Β· rw [Finset.sum_fin_eq_sum_range]
apply Finset.sum_congr rfl
intro i hi
rw [Finset.mem_range] at hi
rw [dif_pos hi, Fin.last]
Β· simp [h])
theorem binomial_apply (p : ββ₯0β) (h : p β€ 1) (n : β) (i : Fin (n + 1)) :
binomial p h n i = p^(i : β) * (1-p)^((Fin.last n - i) : β) * (n.choose i : β) := rfl
@[simp]
| Mathlib/Probability/ProbabilityMassFunction/Binomial.lean | 40 | 42 | theorem binomial_apply_zero (p : ββ₯0β) (h : p β€ 1) (n : β) :
binomial p h n 0 = (1-p)^n := by |
simp [binomial_apply]
| [
" β a : Fin (n + 1), (fun i => p ^ βi * (1 - p) ^ (β(Fin.last n) - βi) * β(n.choose βi)) a = 1",
" β a : Fin (n + 1), (fun i => p ^ βi * (1 - p) ^ (β(Fin.last n) - βi) * β(n.choose βi)) a =\n β m β Finset.range (n + 1), p ^ m * (1 - p) ^ (n - m) * β(n.choose m)",
" (β i β Finset.range (n + 1),\n if h : ... | [
" β a : Fin (n + 1), (fun i => p ^ βi * (1 - p) ^ (β(Fin.last n) - βi) * β(n.choose βi)) a = 1",
" β a : Fin (n + 1), (fun i => p ^ βi * (1 - p) ^ (β(Fin.last n) - βi) * β(n.choose βi)) a =\n β m β Finset.range (n + 1), p ^ m * (1 - p) ^ (n - m) * β(n.choose m)",
" (β i β Finset.range (n + 1),\n if h : ... |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.NormedSpace.HomeomorphBall
#align_import analysis.inner_product_space.calculus from "leanprover-community/mathlib"@"f9dd3204df14a0749cd456fac1e6849dfe7d2b88"
noncomputable section
open RCLike Real Filter
open scoped Classical Topology
section DerivInner
variable {π E F : Type*} [RCLike π]
variable [NormedAddCommGroup E] [InnerProductSpace π E]
variable [NormedAddCommGroup F] [InnerProductSpace β F]
local notation "βͺ" x ", " y "β«" => @inner π _ _ x y
variable (π) [NormedSpace β E]
def fderivInnerCLM (p : E Γ E) : E Γ E βL[β] π :=
isBoundedBilinearMap_inner.deriv p
#align fderiv_inner_clm fderivInnerCLM
@[simp]
theorem fderivInnerCLM_apply (p x : E Γ E) : fderivInnerCLM π p x = βͺp.1, x.2β« + βͺx.1, p.2β« :=
rfl
#align fderiv_inner_clm_apply fderivInnerCLM_apply
variable {π} -- Porting note: Lean 3 magically switches back to `{π}` here
theorem contDiff_inner {n} : ContDiff β n fun p : E Γ E => βͺp.1, p.2β« :=
isBoundedBilinearMap_inner.contDiff
#align cont_diff_inner contDiff_inner
theorem contDiffAt_inner {p : E Γ E} {n} : ContDiffAt β n (fun p : E Γ E => βͺp.1, p.2β«) p :=
ContDiff.contDiffAt contDiff_inner
#align cont_diff_at_inner contDiffAt_inner
theorem differentiable_inner : Differentiable β fun p : E Γ E => βͺp.1, p.2β« :=
isBoundedBilinearMap_inner.differentiableAt
#align differentiable_inner differentiable_inner
variable (π)
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace β G] {f g : G β E} {f' g' : G βL[β] E}
{s : Set G} {x : G} {n : ββ}
theorem ContDiffWithinAt.inner (hf : ContDiffWithinAt β n f s x) (hg : ContDiffWithinAt β n g s x) :
ContDiffWithinAt β n (fun x => βͺf x, g xβ«) s x :=
contDiffAt_inner.comp_contDiffWithinAt x (hf.prod hg)
#align cont_diff_within_at.inner ContDiffWithinAt.inner
nonrec theorem ContDiffAt.inner (hf : ContDiffAt β n f x) (hg : ContDiffAt β n g x) :
ContDiffAt β n (fun x => βͺf x, g xβ«) x :=
hf.inner π hg
#align cont_diff_at.inner ContDiffAt.inner
theorem ContDiffOn.inner (hf : ContDiffOn β n f s) (hg : ContDiffOn β n g s) :
ContDiffOn β n (fun x => βͺf x, g xβ«) s := fun x hx => (hf x hx).inner π (hg x hx)
#align cont_diff_on.inner ContDiffOn.inner
theorem ContDiff.inner (hf : ContDiff β n f) (hg : ContDiff β n g) :
ContDiff β n fun x => βͺf x, g xβ« :=
contDiff_inner.comp (hf.prod hg)
#align cont_diff.inner ContDiff.inner
theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x)
(hg : HasFDerivWithinAt g g' s x) :
HasFDerivWithinAt (fun t => βͺf t, g tβ«) ((fderivInnerCLM π (f x, g x)).comp <| f'.prod g') s
x :=
(isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp_hasFDerivWithinAt x (hf.prod hg)
#align has_fderiv_within_at.inner HasFDerivWithinAt.inner
theorem HasStrictFDerivAt.inner (hf : HasStrictFDerivAt f f' x) (hg : HasStrictFDerivAt g g' x) :
HasStrictFDerivAt (fun t => βͺf t, g tβ«) ((fderivInnerCLM π (f x, g x)).comp <| f'.prod g') x :=
(isBoundedBilinearMap_inner.hasStrictFDerivAt (f x, g x)).comp x (hf.prod hg)
#align has_strict_fderiv_at.inner HasStrictFDerivAt.inner
theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) :
HasFDerivAt (fun t => βͺf t, g tβ«) ((fderivInnerCLM π (f x, g x)).comp <| f'.prod g') x :=
(isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp x (hf.prod hg)
#align has_fderiv_at.inner HasFDerivAt.inner
theorem HasDerivWithinAt.inner {f g : β β E} {f' g' : E} {s : Set β} {x : β}
(hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) :
HasDerivWithinAt (fun t => βͺf t, g tβ«) (βͺf x, g'β« + βͺf', g xβ«) s x := by
simpa using (hf.hasFDerivWithinAt.inner π hg.hasFDerivWithinAt).hasDerivWithinAt
#align has_deriv_within_at.inner HasDerivWithinAt.inner
| Mathlib/Analysis/InnerProductSpace/Calculus.lean | 115 | 118 | theorem HasDerivAt.inner {f g : β β E} {f' g' : E} {x : β} :
HasDerivAt f f' x β HasDerivAt g g' x β
HasDerivAt (fun t => βͺf t, g tβ«) (βͺf x, g'β« + βͺf', g xβ«) x := by |
simpa only [β hasDerivWithinAt_univ] using HasDerivWithinAt.inner π
| [
" HasDerivWithinAt (fun t => βͺf t, g tβ«_π) (βͺf x, g'β«_π + βͺf', g xβ«_π) s x",
" HasDerivAt f f' x β HasDerivAt g g' x β HasDerivAt (fun t => βͺf t, g tβ«_π) (βͺf x, g'β«_π + βͺf', g xβ«_π) x"
] | [
" HasDerivWithinAt (fun t => βͺf t, g tβ«_π) (βͺf x, g'β«_π + βͺf', g xβ«_π) s x"
] |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Data.Rat.Denumerable
import Mathlib.Data.Set.Pointwise.Interval
import Mathlib.SetTheory.Cardinal.Continuum
#align_import data.real.cardinality from "leanprover-community/mathlib"@"7e7aaccf9b0182576cabdde36cf1b5ad3585b70d"
open Nat Set
open Cardinal
noncomputable section
namespace Cardinal
variable {c : β} {f g : β β Bool} {n : β}
def cantorFunctionAux (c : β) (f : β β Bool) (n : β) : β :=
cond (f n) (c ^ n) 0
#align cardinal.cantor_function_aux Cardinal.cantorFunctionAux
@[simp]
theorem cantorFunctionAux_true (h : f n = true) : cantorFunctionAux c f n = c ^ n := by
simp [cantorFunctionAux, h]
#align cardinal.cantor_function_aux_tt Cardinal.cantorFunctionAux_true
@[simp]
| Mathlib/Data/Real/Cardinality.lean | 69 | 70 | theorem cantorFunctionAux_false (h : f n = false) : cantorFunctionAux c f n = 0 := by |
simp [cantorFunctionAux, h]
| [
" cantorFunctionAux c f n = c ^ n",
" cantorFunctionAux c f n = 0"
] | [
" cantorFunctionAux c f n = c ^ n"
] |
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Measurable
open MeasureTheory
variable {π : Type*} [NontriviallyNormedField π] [LocallyCompactSpace π]
{E : Type*} [NormedAddCommGroup E] [NormedSpace π E] [MeasurableSpace E] [OpensMeasurableSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace π F] [CompleteSpace F]
{f : E β F} {v : E}
theorem measurableSet_lineDifferentiableAt (hf : Continuous f) :
MeasurableSet {x : E | LineDifferentiableAt π f x v} := by
borelize π
let g : E β π β F := fun x t β¦ f (x + t β’ v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact measurable_prod_mk_right (measurableSet_of_differentiableAt_with_param π hg)
theorem measurable_lineDeriv [MeasurableSpace F] [BorelSpace F]
(hf : Continuous f) : Measurable (fun x β¦ lineDeriv π f x v) := by
borelize π
let g : E β π β F := fun x t β¦ f (x + t β’ v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (measurable_deriv_with_param hg).comp measurable_prod_mk_right
| Mathlib/Analysis/Calculus/LineDeriv/Measurable.lean | 47 | 52 | theorem stronglyMeasurable_lineDeriv [SecondCountableTopologyEither E F] (hf : Continuous f) :
StronglyMeasurable (fun x β¦ lineDeriv π f x v) := by |
borelize π
let g : E β π β F := fun x t β¦ f (x + t β’ v)
have hg : Continuous g.uncurry := by apply hf.comp; continuity
exact (stronglyMeasurable_deriv_with_param hg).comp_measurable measurable_prod_mk_right
| [
" MeasurableSet {x | LineDifferentiableAt π f x v}",
" Continuous (Function.uncurry g)",
" Continuous fun x => x.1 + x.2 β’ v",
" Measurable fun x => lineDeriv π f x v",
" StronglyMeasurable fun x => lineDeriv π f x v"
] | [
" MeasurableSet {x | LineDifferentiableAt π f x v}",
" Continuous (Function.uncurry g)",
" Continuous fun x => x.1 + x.2 β’ v",
" Measurable fun x => lineDeriv π f x v"
] |
import Mathlib.Analysis.Calculus.Conformal.NormedSpace
import Mathlib.Analysis.InnerProductSpace.ConformalLinearMap
#align_import analysis.calculus.conformal.inner_product from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
variable {E F : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F]
variable [InnerProductSpace β E] [InnerProductSpace β F]
open RealInnerProductSpace
theorem conformalAt_iff' {f : E β F} {x : E} : ConformalAt f x β
β c : β, 0 < c β§ β u v : E, βͺfderiv β f x u, fderiv β f x vβ« = c * βͺu, vβ« := by
rw [conformalAt_iff_isConformalMap_fderiv, isConformalMap_iff]
#align conformal_at_iff' conformalAt_iff'
| Mathlib/Analysis/Calculus/Conformal/InnerProduct.lean | 36 | 38 | theorem conformalAt_iff {f : E β F} {x : E} {f' : E βL[β] F} (h : HasFDerivAt f f' x) :
ConformalAt f x β β c : β, 0 < c β§ β u v : E, βͺf' u, f' vβ« = c * βͺu, vβ« := by |
simp only [conformalAt_iff', h.fderiv]
| [
" ConformalAt f x β β c, 0 < c β§ β (u v : E), βͺ(fderiv β f x) u, (fderiv β f x) vβ«_β = c * βͺu, vβ«_β",
" ConformalAt f x β β c, 0 < c β§ β (u v : E), βͺf' u, f' vβ«_β = c * βͺu, vβ«_β"
] | [
" ConformalAt f x β β c, 0 < c β§ β (u v : E), βͺ(fderiv β f x) u, (fderiv β f x) vβ«_β = c * βͺu, vβ«_β"
] |
import Mathlib.Analysis.Complex.UpperHalfPlane.Basic
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup
import Mathlib.Tactic.AdaptationNote
#align_import number_theory.modular_forms.slash_actions from "leanprover-community/mathlib"@"738054fa93d43512da144ec45ce799d18fd44248"
open Complex UpperHalfPlane ModularGroup
open scoped UpperHalfPlane
local notation "GL(" n ", " R ")" "βΊ" => Matrix.GLPos (Fin n) R
local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R
local notation:1024 "ββ" A:1024 =>
(((A : GL(2, β)βΊ) : GL (Fin 2) β) : Matrix (Fin 2) (Fin 2) _)
-- like `ββ`, but allows the user to specify the ring `R`. Useful to help Lean elaborate.
local notation:1024 "ββ[" R "]" A:1024 =>
((A : GL (Fin 2) R) : Matrix (Fin 2) (Fin 2) R)
class SlashAction (Ξ² G Ξ± Ξ³ : Type*) [Group G] [AddMonoid Ξ±] [SMul Ξ³ Ξ±] where
map : Ξ² β G β Ξ± β Ξ±
zero_slash : β (k : Ξ²) (g : G), map k g 0 = 0
slash_one : β (k : Ξ²) (a : Ξ±), map k 1 a = a
slash_mul : β (k : Ξ²) (g h : G) (a : Ξ±), map k (g * h) a = map k h (map k g a)
smul_slash : β (k : Ξ²) (g : G) (a : Ξ±) (z : Ξ³), map k g (z β’ a) = z β’ map k g a
add_slash : β (k : Ξ²) (g : G) (a b : Ξ±), map k g (a + b) = map k g a + map k g b
#align slash_action SlashAction
scoped[ModularForm] notation:100 f " β£[" k ";" Ξ³ "] " a:100 => SlashAction.map Ξ³ k a f
scoped[ModularForm] notation:100 f " β£[" k "] " a:100 => SlashAction.map β k a f
open scoped ModularForm
@[simp]
theorem SlashAction.neg_slash {Ξ² G Ξ± Ξ³ : Type*} [Group G] [AddGroup Ξ±] [SMul Ξ³ Ξ±]
[SlashAction Ξ² G Ξ± Ξ³] (k : Ξ²) (g : G) (a : Ξ±) : (-a) β£[k;Ξ³] g = -a β£[k;Ξ³] g :=
eq_neg_of_add_eq_zero_left <| by
rw [β SlashAction.add_slash, add_left_neg, SlashAction.zero_slash]
#align slash_action.neg_slash SlashAction.neg_slash
@[simp]
| Mathlib/NumberTheory/ModularForms/SlashActions.lean | 67 | 70 | theorem SlashAction.smul_slash_of_tower {R Ξ² G Ξ± : Type*} (Ξ³ : Type*) [Group G] [AddGroup Ξ±]
[Monoid Ξ³] [MulAction Ξ³ Ξ±] [SMul R Ξ³] [SMul R Ξ±] [IsScalarTower R Ξ³ Ξ±] [SlashAction Ξ² G Ξ± Ξ³]
(k : Ξ²) (g : G) (a : Ξ±) (r : R) : (r β’ a) β£[k;Ξ³] g = r β’ a β£[k;Ξ³] g := by |
rw [β smul_one_smul Ξ³ r a, SlashAction.smul_slash, smul_one_smul]
| [
" (-a) β£[k;Ξ³] g + a β£[k;Ξ³] g = 0",
" (r β’ a) β£[k;Ξ³] g = r β’ a β£[k;Ξ³] g"
] | [
" (-a) β£[k;Ξ³] g + a β£[k;Ξ³] g = 0"
] |
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv
#align_import linear_algebra.affine_space.affine_subspace from "leanprover-community/mathlib"@"e96bdfbd1e8c98a09ff75f7ac6204d142debc840"
noncomputable section
open Affine
open Set
section
variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V]
variable [AffineSpace V P]
def vectorSpan (s : Set P) : Submodule k V :=
Submodule.span k (s -α΅₯ s)
#align vector_span vectorSpan
theorem vectorSpan_def (s : Set P) : vectorSpan k s = Submodule.span k (s -α΅₯ s) :=
rfl
#align vector_span_def vectorSpan_def
theorem vectorSpan_mono {sβ sβ : Set P} (h : sβ β sβ) : vectorSpan k sβ β€ vectorSpan k sβ :=
Submodule.span_mono (vsub_self_mono h)
#align vector_span_mono vectorSpan_mono
variable (P)
@[simp]
theorem vectorSpan_empty : vectorSpan k (β
: Set P) = (β₯ : Submodule k V) := by
rw [vectorSpan_def, vsub_empty, Submodule.span_empty]
#align vector_span_empty vectorSpan_empty
variable {P}
@[simp]
theorem vectorSpan_singleton (p : P) : vectorSpan k ({p} : Set P) = β₯ := by simp [vectorSpan_def]
#align vector_span_singleton vectorSpan_singleton
theorem vsub_set_subset_vectorSpan (s : Set P) : s -α΅₯ s β β(vectorSpan k s) :=
Submodule.subset_span
#align vsub_set_subset_vector_span vsub_set_subset_vectorSpan
theorem vsub_mem_vectorSpan {s : Set P} {p1 p2 : P} (hp1 : p1 β s) (hp2 : p2 β s) :
p1 -α΅₯ p2 β vectorSpan k s :=
vsub_set_subset_vectorSpan k s (vsub_mem_vsub hp1 hp2)
#align vsub_mem_vector_span vsub_mem_vectorSpan
def spanPoints (s : Set P) : Set P :=
{ p | β p1 β s, β v β vectorSpan k s, p = v +α΅₯ p1 }
#align span_points spanPoints
theorem mem_spanPoints (p : P) (s : Set P) : p β s β p β spanPoints k s
| hp => β¨p, hp, 0, Submodule.zero_mem _, (zero_vadd V p).symmβ©
#align mem_span_points mem_spanPoints
theorem subset_spanPoints (s : Set P) : s β spanPoints k s := fun p => mem_spanPoints k p s
#align subset_span_points subset_spanPoints
@[simp]
theorem spanPoints_nonempty (s : Set P) : (spanPoints k s).Nonempty β s.Nonempty := by
constructor
Β· contrapose
rw [Set.not_nonempty_iff_eq_empty, Set.not_nonempty_iff_eq_empty]
intro h
simp [h, spanPoints]
Β· exact fun h => h.mono (subset_spanPoints _ _)
#align span_points_nonempty spanPoints_nonempty
theorem vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan {s : Set P} {p : P} {v : V}
(hp : p β spanPoints k s) (hv : v β vectorSpan k s) : v +α΅₯ p β spanPoints k s := by
rcases hp with β¨p2, β¨hp2, β¨v2, β¨hv2, hv2pβ©β©β©β©
rw [hv2p, vadd_vadd]
exact β¨p2, hp2, v + v2, (vectorSpan k s).add_mem hv hv2, rflβ©
#align vadd_mem_span_points_of_mem_span_points_of_mem_vector_span vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan
| Mathlib/LinearAlgebra/AffineSpace/AffineSubspace.lean | 136 | 143 | theorem vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPoints {s : Set P} {p1 p2 : P}
(hp1 : p1 β spanPoints k s) (hp2 : p2 β spanPoints k s) : p1 -α΅₯ p2 β vectorSpan k s := by |
rcases hp1 with β¨p1a, β¨hp1a, β¨v1, β¨hv1, hv1pβ©β©β©β©
rcases hp2 with β¨p2a, β¨hp2a, β¨v2, β¨hv2, hv2pβ©β©β©β©
rw [hv1p, hv2p, vsub_vadd_eq_vsub_sub (v1 +α΅₯ p1a), vadd_vsub_assoc, add_comm, add_sub_assoc]
have hv1v2 : v1 - v2 β vectorSpan k s := (vectorSpan k s).sub_mem hv1 hv2
refine (vectorSpan k s).add_mem ?_ hv1v2
exact vsub_mem_vectorSpan k hp1a hp2a
| [
" vectorSpan k β
= β₯",
" vectorSpan k {p} = β₯",
" (spanPoints k s).Nonempty β s.Nonempty",
" (spanPoints k s).Nonempty β s.Nonempty",
" Β¬s.Nonempty β Β¬(spanPoints k s).Nonempty",
" s = β
β spanPoints k s = β
",
" spanPoints k s = β
",
" s.Nonempty β (spanPoints k s).Nonempty",
" v +α΅₯ p β spanPoints k ... | [
" vectorSpan k β
= β₯",
" vectorSpan k {p} = β₯",
" (spanPoints k s).Nonempty β s.Nonempty",
" (spanPoints k s).Nonempty β s.Nonempty",
" Β¬s.Nonempty β Β¬(spanPoints k s).Nonempty",
" s = β
β spanPoints k s = β
",
" spanPoints k s = β
",
" s.Nonempty β (spanPoints k s).Nonempty",
" v +α΅₯ p β spanPoints k ... |
import Mathlib.Data.ULift
import Mathlib.Data.ZMod.Defs
import Mathlib.SetTheory.Cardinal.PartENat
#align_import set_theory.cardinal.finite from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8"
set_option autoImplicit true
open Cardinal Function
noncomputable section
variable {Ξ± Ξ² : Type*}
namespace Nat
protected def card (Ξ± : Type*) : β :=
toNat (mk Ξ±)
#align nat.card Nat.card
@[simp]
theorem card_eq_fintype_card [Fintype Ξ±] : Nat.card Ξ± = Fintype.card Ξ± :=
mk_toNat_eq_card
#align nat.card_eq_fintype_card Nat.card_eq_fintype_card
theorem _root_.Fintype.card_eq_nat_card {_ : Fintype Ξ±} : Fintype.card Ξ± = Nat.card Ξ± :=
mk_toNat_eq_card.symm
lemma card_eq_finsetCard (s : Finset Ξ±) : Nat.card s = s.card := by
simp only [Nat.card_eq_fintype_card, Fintype.card_coe]
lemma card_eq_card_toFinset (s : Set Ξ±) [Fintype s] : Nat.card s = s.toFinset.card := by
simp only [β Nat.card_eq_finsetCard, s.mem_toFinset]
lemma card_eq_card_finite_toFinset {s : Set Ξ±} (hs : s.Finite) : Nat.card s = hs.toFinset.card := by
simp only [β Nat.card_eq_finsetCard, hs.mem_toFinset]
@[simp] theorem card_of_isEmpty [IsEmpty Ξ±] : Nat.card Ξ± = 0 := by simp [Nat.card]
#align nat.card_of_is_empty Nat.card_of_isEmpty
@[simp] lemma card_eq_zero_of_infinite [Infinite Ξ±] : Nat.card Ξ± = 0 := mk_toNat_of_infinite
#align nat.card_eq_zero_of_infinite Nat.card_eq_zero_of_infinite
lemma _root_.Set.Infinite.card_eq_zero {s : Set Ξ±} (hs : s.Infinite) : Nat.card s = 0 :=
@card_eq_zero_of_infinite _ hs.to_subtype
lemma card_eq_zero : Nat.card Ξ± = 0 β IsEmpty Ξ± β¨ Infinite Ξ± := by
simp [Nat.card, mk_eq_zero_iff, aleph0_le_mk_iff]
lemma card_ne_zero : Nat.card Ξ± β 0 β Nonempty Ξ± β§ Finite Ξ± := by simp [card_eq_zero, not_or]
lemma card_pos_iff : 0 < Nat.card Ξ± β Nonempty Ξ± β§ Finite Ξ± := by
simp [Nat.card, mk_eq_zero_iff, mk_lt_aleph0_iff]
@[simp] lemma card_pos [Nonempty Ξ±] [Finite Ξ±] : 0 < Nat.card Ξ± := card_pos_iff.2 β¨βΉ_βΊ, βΉ_βΊβ©
theorem finite_of_card_ne_zero (h : Nat.card Ξ± β 0) : Finite Ξ± := (card_ne_zero.1 h).2
#align nat.finite_of_card_ne_zero Nat.finite_of_card_ne_zero
theorem card_congr (f : Ξ± β Ξ²) : Nat.card Ξ± = Nat.card Ξ² :=
Cardinal.toNat_congr f
#align nat.card_congr Nat.card_congr
lemma card_le_card_of_injective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ²] (f : Ξ± β Ξ²)
(hf : Injective f) : Nat.card Ξ± β€ Nat.card Ξ² := by
simpa using toNat_le_toNat (lift_mk_le_lift_mk_of_injective hf) (by simp [lt_aleph0_of_finite])
lemma card_le_card_of_surjective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ±] (f : Ξ± β Ξ²)
(hf : Surjective f) : Nat.card Ξ² β€ Nat.card Ξ± := by
have : lift.{u} #Ξ² β€ lift.{v} #Ξ± := mk_le_of_surjective (ULift.map_surjective.2 hf)
simpa using toNat_le_toNat this (by simp [lt_aleph0_of_finite])
theorem card_eq_of_bijective (f : Ξ± β Ξ²) (hf : Function.Bijective f) : Nat.card Ξ± = Nat.card Ξ² :=
card_congr (Equiv.ofBijective f hf)
#align nat.card_eq_of_bijective Nat.card_eq_of_bijective
theorem card_eq_of_equiv_fin {Ξ± : Type*} {n : β} (f : Ξ± β Fin n) : Nat.card Ξ± = n := by
simpa only [card_eq_fintype_card, Fintype.card_fin] using card_congr f
#align nat.card_eq_of_equiv_fin Nat.card_eq_of_equiv_fin
def equivFinOfCardPos {Ξ± : Type*} (h : Nat.card Ξ± β 0) : Ξ± β Fin (Nat.card Ξ±) := by
cases fintypeOrInfinite Ξ±
Β· simpa only [card_eq_fintype_card] using Fintype.equivFin Ξ±
Β· simp only [card_eq_zero_of_infinite, ne_eq, not_true_eq_false] at h
#align nat.equiv_fin_of_card_pos Nat.equivFinOfCardPos
theorem card_of_subsingleton (a : Ξ±) [Subsingleton Ξ±] : Nat.card Ξ± = 1 := by
letI := Fintype.ofSubsingleton a
rw [card_eq_fintype_card, Fintype.card_ofSubsingleton a]
#align nat.card_of_subsingleton Nat.card_of_subsingleton
-- @[simp] -- Porting note (#10618): simp can prove this
theorem card_unique [Unique Ξ±] : Nat.card Ξ± = 1 :=
card_of_subsingleton default
#align nat.card_unique Nat.card_unique
theorem card_eq_one_iff_unique : Nat.card Ξ± = 1 β Subsingleton Ξ± β§ Nonempty Ξ± :=
Cardinal.toNat_eq_one_iff_unique
#align nat.card_eq_one_iff_unique Nat.card_eq_one_iff_unique
theorem card_eq_two_iff : Nat.card Ξ± = 2 β β x y : Ξ±, x β y β§ {x, y} = @Set.univ Ξ± :=
toNat_eq_ofNat.trans mk_eq_two_iff
#align nat.card_eq_two_iff Nat.card_eq_two_iff
theorem card_eq_two_iff' (x : Ξ±) : Nat.card Ξ± = 2 β β! y, y β x :=
toNat_eq_ofNat.trans (mk_eq_two_iff' x)
#align nat.card_eq_two_iff' Nat.card_eq_two_iff'
@[simp]
| Mathlib/SetTheory/Cardinal/Finite.lean | 167 | 170 | theorem card_sum [Finite Ξ±] [Finite Ξ²] : Nat.card (Ξ± β Ξ²) = Nat.card Ξ± + Nat.card Ξ² := by |
have := Fintype.ofFinite Ξ±
have := Fintype.ofFinite Ξ²
simp_rw [Nat.card_eq_fintype_card, Fintype.card_sum]
| [
" Nat.card { x // x β s } = s.card",
" Nat.card βs = s.toFinset.card",
" Nat.card βs = hs.toFinset.card",
" Nat.card Ξ± = 0",
" Nat.card Ξ± = 0 β IsEmpty Ξ± β¨ Infinite Ξ±",
" Nat.card Ξ± β 0 β Nonempty Ξ± β§ Finite Ξ±",
" 0 < Nat.card Ξ± β Nonempty Ξ± β§ Finite Ξ±",
" Nat.card Ξ± β€ Nat.card Ξ²",
" lift.{u, v} #Ξ² ... | [
" Nat.card { x // x β s } = s.card",
" Nat.card βs = s.toFinset.card",
" Nat.card βs = hs.toFinset.card",
" Nat.card Ξ± = 0",
" Nat.card Ξ± = 0 β IsEmpty Ξ± β¨ Infinite Ξ±",
" Nat.card Ξ± β 0 β Nonempty Ξ± β§ Finite Ξ±",
" 0 < Nat.card Ξ± β Nonempty Ξ± β§ Finite Ξ±",
" Nat.card Ξ± β€ Nat.card Ξ²",
" lift.{u, v} #Ξ² ... |
import Mathlib.Algebra.MonoidAlgebra.Degree
import Mathlib.Algebra.Polynomial.Coeff
import Mathlib.Algebra.Polynomial.Monomial
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Nat.WithBot
import Mathlib.Data.Nat.Cast.WithTop
import Mathlib.Data.Nat.SuccPred
#align_import data.polynomial.degree.definitions from "leanprover-community/mathlib"@"808ea4ebfabeb599f21ec4ae87d6dc969597887f"
-- Porting note: `Mathlib.Data.Nat.Cast.WithTop` should be imported for `Nat.cast_withBot`.
set_option linter.uppercaseLean3 false
noncomputable section
open Finsupp Finset
open Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b c d : R} {n m : β}
section Semiring
variable [Semiring R] {p q r : R[X]}
def degree (p : R[X]) : WithBot β :=
p.support.max
#align polynomial.degree Polynomial.degree
theorem supDegree_eq_degree (p : R[X]) : p.toFinsupp.supDegree WithBot.some = p.degree :=
max_eq_sup_coe
theorem degree_lt_wf : WellFounded fun p q : R[X] => degree p < degree q :=
InvImage.wf degree wellFounded_lt
#align polynomial.degree_lt_wf Polynomial.degree_lt_wf
instance : WellFoundedRelation R[X] :=
β¨_, degree_lt_wfβ©
def natDegree (p : R[X]) : β :=
(degree p).unbot' 0
#align polynomial.nat_degree Polynomial.natDegree
def leadingCoeff (p : R[X]) : R :=
coeff p (natDegree p)
#align polynomial.leading_coeff Polynomial.leadingCoeff
def Monic (p : R[X]) :=
leadingCoeff p = (1 : R)
#align polynomial.monic Polynomial.Monic
@[nontriviality]
theorem monic_of_subsingleton [Subsingleton R] (p : R[X]) : Monic p :=
Subsingleton.elim _ _
#align polynomial.monic_of_subsingleton Polynomial.monic_of_subsingleton
theorem Monic.def : Monic p β leadingCoeff p = 1 :=
Iff.rfl
#align polynomial.monic.def Polynomial.Monic.def
instance Monic.decidable [DecidableEq R] : Decidable (Monic p) := by unfold Monic; infer_instance
#align polynomial.monic.decidable Polynomial.Monic.decidable
@[simp]
theorem Monic.leadingCoeff {p : R[X]} (hp : p.Monic) : leadingCoeff p = 1 :=
hp
#align polynomial.monic.leading_coeff Polynomial.Monic.leadingCoeff
theorem Monic.coeff_natDegree {p : R[X]} (hp : p.Monic) : p.coeff p.natDegree = 1 :=
hp
#align polynomial.monic.coeff_nat_degree Polynomial.Monic.coeff_natDegree
@[simp]
theorem degree_zero : degree (0 : R[X]) = β₯ :=
rfl
#align polynomial.degree_zero Polynomial.degree_zero
@[simp]
theorem natDegree_zero : natDegree (0 : R[X]) = 0 :=
rfl
#align polynomial.nat_degree_zero Polynomial.natDegree_zero
@[simp]
theorem coeff_natDegree : coeff p (natDegree p) = leadingCoeff p :=
rfl
#align polynomial.coeff_nat_degree Polynomial.coeff_natDegree
@[simp]
theorem degree_eq_bot : degree p = β₯ β p = 0 :=
β¨fun h => support_eq_empty.1 (Finset.max_eq_bot.1 h), fun h => h.symm βΈ rflβ©
#align polynomial.degree_eq_bot Polynomial.degree_eq_bot
@[nontriviality]
theorem degree_of_subsingleton [Subsingleton R] : degree p = β₯ := by
rw [Subsingleton.elim p 0, degree_zero]
#align polynomial.degree_of_subsingleton Polynomial.degree_of_subsingleton
@[nontriviality]
theorem natDegree_of_subsingleton [Subsingleton R] : natDegree p = 0 := by
rw [Subsingleton.elim p 0, natDegree_zero]
#align polynomial.nat_degree_of_subsingleton Polynomial.natDegree_of_subsingleton
theorem degree_eq_natDegree (hp : p β 0) : degree p = (natDegree p : WithBot β) := by
let β¨n, hnβ© := not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt degree_eq_bot.1 hp))
have hn : degree p = some n := Classical.not_not.1 hn
rw [natDegree, hn]; rfl
#align polynomial.degree_eq_nat_degree Polynomial.degree_eq_natDegree
| Mathlib/Algebra/Polynomial/Degree/Definitions.lean | 138 | 144 | theorem supDegree_eq_natDegree (p : R[X]) : p.toFinsupp.supDegree id = p.natDegree := by |
obtain rfl|h := eq_or_ne p 0
Β· simp
apply WithBot.coe_injective
rw [β AddMonoidAlgebra.supDegree_withBot_some_comp, Function.comp_id, supDegree_eq_degree,
degree_eq_natDegree h, Nat.cast_withBot]
rwa [support_toFinsupp, nonempty_iff_ne_empty, Ne, support_eq_empty]
| [
" Decidable p.Monic",
" Decidable (p.leadingCoeff = 1)",
" p.degree = β₯",
" p.natDegree = 0",
" p.degree = βp.natDegree",
" Option.some n = β(WithBot.unbot' 0 (Option.some n))",
" AddMonoidAlgebra.supDegree id p.toFinsupp = p.natDegree",
" AddMonoidAlgebra.supDegree id (toFinsupp 0) = natDegree 0",
... | [
" Decidable p.Monic",
" Decidable (p.leadingCoeff = 1)",
" p.degree = β₯",
" p.natDegree = 0",
" p.degree = βp.natDegree",
" Option.some n = β(WithBot.unbot' 0 (Option.some n))"
] |
import Mathlib.Algebra.Module.Submodule.EqLocus
import Mathlib.Algebra.Module.Submodule.RestrictScalars
import Mathlib.Algebra.Ring.Idempotents
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.LinearAlgebra.Basic
import Mathlib.Order.CompactlyGenerated.Basic
import Mathlib.Order.OmegaCompletePartialOrder
#align_import linear_algebra.span from "leanprover-community/mathlib"@"10878f6bf1dab863445907ab23fbfcefcb5845d0"
variable {R Rβ K M Mβ V S : Type*}
namespace Submodule
open Function Set
open Pointwise
section AddCommMonoid
variable [Semiring R] [AddCommMonoid M] [Module R M]
variable {x : M} (p p' : Submodule R M)
variable [Semiring Rβ] {Οββ : R β+* Rβ}
variable [AddCommMonoid Mβ] [Module Rβ Mβ]
variable {F : Type*} [FunLike F M Mβ] [SemilinearMapClass F Οββ M Mβ]
section
variable (R)
def span (s : Set M) : Submodule R M :=
sInf { p | s β p }
#align submodule.span Submodule.span
variable {R}
-- Porting note: renamed field to `principal'` and added `principal` to fix explicit argument
@[mk_iff]
class IsPrincipal (S : Submodule R M) : Prop where
principal' : β a, S = span R {a}
#align submodule.is_principal Submodule.IsPrincipal
theorem IsPrincipal.principal (S : Submodule R M) [S.IsPrincipal] :
β a, S = span R {a} :=
Submodule.IsPrincipal.principal'
#align submodule.is_principal.principal Submodule.IsPrincipal.principal
end
variable {s t : Set M}
theorem mem_span : x β span R s β β p : Submodule R M, s β p β x β p :=
mem_iInterβ
#align submodule.mem_span Submodule.mem_span
@[aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_span : s β span R s := fun _ h => mem_span.2 fun _ hp => hp h
#align submodule.subset_span Submodule.subset_span
theorem span_le {p} : span R s β€ p β s β p :=
β¨Subset.trans subset_span, fun ss _ h => mem_span.1 h _ ssβ©
#align submodule.span_le Submodule.span_le
theorem span_mono (h : s β t) : span R s β€ span R t :=
span_le.2 <| Subset.trans h subset_span
#align submodule.span_mono Submodule.span_mono
theorem span_monotone : Monotone (span R : Set M β Submodule R M) := fun _ _ => span_mono
#align submodule.span_monotone Submodule.span_monotone
theorem span_eq_of_le (hβ : s β p) (hβ : p β€ span R s) : span R s = p :=
le_antisymm (span_le.2 hβ) hβ
#align submodule.span_eq_of_le Submodule.span_eq_of_le
theorem span_eq : span R (p : Set M) = p :=
span_eq_of_le _ (Subset.refl _) subset_span
#align submodule.span_eq Submodule.span_eq
theorem span_eq_span (hs : s β span R t) (ht : t β span R s) : span R s = span R t :=
le_antisymm (span_le.2 hs) (span_le.2 ht)
#align submodule.span_eq_span Submodule.span_eq_span
lemma coe_span_eq_self [SetLike S M] [AddSubmonoidClass S M] [SMulMemClass S R M] (s : S) :
(span R (s : Set M) : Set M) = s := by
refine le_antisymm ?_ subset_span
let s' : Submodule R M :=
{ carrier := s
add_mem' := add_mem
zero_mem' := zero_mem _
smul_mem' := SMulMemClass.smul_mem }
exact span_le (p := s') |>.mpr le_rfl
@[simp]
theorem span_coe_eq_restrictScalars [Semiring S] [SMul S R] [Module S M] [IsScalarTower S R M] :
span S (p : Set M) = p.restrictScalars S :=
span_eq (p.restrictScalars S)
#align submodule.span_coe_eq_restrict_scalars Submodule.span_coe_eq_restrictScalars
theorem image_span_subset (f : F) (s : Set M) (N : Submodule Rβ Mβ) :
f '' span R s β N β β m β s, f m β N := image_subset_iff.trans <| span_le (p := N.comap f)
theorem image_span_subset_span (f : F) (s : Set M) : f '' span R s β span Rβ (f '' s) :=
(image_span_subset f s _).2 fun x hx β¦ subset_span β¨x, hx, rflβ©
theorem map_span [RingHomSurjective Οββ] (f : F) (s : Set M) :
(span R s).map f = span Rβ (f '' s) :=
Eq.symm <| span_eq_of_le _ (Set.image_subset f subset_span) (image_span_subset_span f s)
#align submodule.map_span Submodule.map_span
alias _root_.LinearMap.map_span := Submodule.map_span
#align linear_map.map_span LinearMap.map_span
theorem map_span_le [RingHomSurjective Οββ] (f : F) (s : Set M) (N : Submodule Rβ Mβ) :
map f (span R s) β€ N β β m β s, f m β N := image_span_subset f s N
#align submodule.map_span_le Submodule.map_span_le
alias _root_.LinearMap.map_span_le := Submodule.map_span_le
#align linear_map.map_span_le LinearMap.map_span_le
@[simp]
theorem span_insert_zero : span R (insert (0 : M) s) = span R s := by
refine le_antisymm ?_ (Submodule.span_mono (Set.subset_insert 0 s))
rw [span_le, Set.insert_subset_iff]
exact β¨by simp only [SetLike.mem_coe, Submodule.zero_mem], Submodule.subset_spanβ©
#align submodule.span_insert_zero Submodule.span_insert_zero
-- See also `span_preimage_eq` below.
| Mathlib/LinearAlgebra/Span.lean | 154 | 157 | theorem span_preimage_le (f : F) (s : Set Mβ) :
span R (f β»ΒΉ' s) β€ (span Rβ s).comap f := by |
rw [span_le, comap_coe]
exact preimage_mono subset_span
| [
" β(span R βs) = βs",
" β(span R βs) β€ βs",
" span R (insert 0 s) = span R s",
" span R (insert 0 s) β€ span R s",
" 0 β β(span R s) β§ s β β(span R s)",
" 0 β β(span R s)",
" span R (βf β»ΒΉ' s) β€ comap f (span Rβ s)",
" βf β»ΒΉ' s β βf β»ΒΉ' β(span Rβ s)"
] | [
" β(span R βs) = βs",
" β(span R βs) β€ βs",
" span R (insert 0 s) = span R s",
" span R (insert 0 s) β€ span R s",
" 0 β β(span R s) β§ s β β(span R s)",
" 0 β β(span R s)"
] |
import Mathlib.Topology.Order.IsLUB
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {Ξ± Ξ² Ξ³ : Type*}
section DenselyOrdered
variable [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] [DenselyOrdered Ξ±] {a b : Ξ±}
{s : Set Ξ±}
theorem closure_Ioi' {a : Ξ±} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by
apply Subset.antisymm
Β· exact closure_minimal Ioi_subset_Ici_self isClosed_Ici
Β· rw [β diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff]
exact isGLB_Ioi.mem_closure h
#align closure_Ioi' closure_Ioi'
@[simp]
theorem closure_Ioi (a : Ξ±) [NoMaxOrder Ξ±] : closure (Ioi a) = Ici a :=
closure_Ioi' nonempty_Ioi
#align closure_Ioi closure_Ioi
theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a :=
closure_Ioi' (Ξ± := Ξ±α΅α΅) h
#align closure_Iio' closure_Iio'
@[simp]
theorem closure_Iio (a : Ξ±) [NoMinOrder Ξ±] : closure (Iio a) = Iic a :=
closure_Iio' nonempty_Iio
#align closure_Iio closure_Iio
@[simp]
theorem closure_Ioo {a b : Ξ±} (hab : a β b) : closure (Ioo a b) = Icc a b := by
apply Subset.antisymm
Β· exact closure_minimal Ioo_subset_Icc_self isClosed_Icc
Β· cases' hab.lt_or_lt with hab hab
Β· rw [β diff_subset_closure_iff, Icc_diff_Ioo_same hab.le]
have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab
simp only [insert_subset_iff, singleton_subset_iff]
exact β¨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'β©
Β· rw [Icc_eq_empty_of_lt hab]
exact empty_subset _
#align closure_Ioo closure_Ioo
@[simp]
theorem closure_Ioc {a b : Ξ±} (hab : a β b) : closure (Ioc a b) = Icc a b := by
apply Subset.antisymm
Β· exact closure_minimal Ioc_subset_Icc_self isClosed_Icc
Β· apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self)
rw [closure_Ioo hab]
#align closure_Ioc closure_Ioc
@[simp]
theorem closure_Ico {a b : Ξ±} (hab : a β b) : closure (Ico a b) = Icc a b := by
apply Subset.antisymm
Β· exact closure_minimal Ico_subset_Icc_self isClosed_Icc
Β· apply Subset.trans _ (closure_mono Ioo_subset_Ico_self)
rw [closure_Ioo hab]
#align closure_Ico closure_Ico
@[simp]
theorem interior_Ici' {a : Ξ±} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by
rw [β compl_Iio, interior_compl, closure_Iio' ha, compl_Iic]
#align interior_Ici' interior_Ici'
theorem interior_Ici [NoMinOrder Ξ±] {a : Ξ±} : interior (Ici a) = Ioi a :=
interior_Ici' nonempty_Iio
#align interior_Ici interior_Ici
@[simp]
theorem interior_Iic' {a : Ξ±} (ha : (Ioi a).Nonempty) : interior (Iic a) = Iio a :=
interior_Ici' (Ξ± := Ξ±α΅α΅) ha
#align interior_Iic' interior_Iic'
theorem interior_Iic [NoMaxOrder Ξ±] {a : Ξ±} : interior (Iic a) = Iio a :=
interior_Iic' nonempty_Ioi
#align interior_Iic interior_Iic
@[simp]
theorem interior_Icc [NoMinOrder Ξ±] [NoMaxOrder Ξ±] {a b : Ξ±} : interior (Icc a b) = Ioo a b := by
rw [β Ici_inter_Iic, interior_inter, interior_Ici, interior_Iic, Ioi_inter_Iio]
#align interior_Icc interior_Icc
@[simp]
theorem Icc_mem_nhds_iff [NoMinOrder Ξ±] [NoMaxOrder Ξ±] {a b x : Ξ±} :
Icc a b β π x β x β Ioo a b := by
rw [β interior_Icc, mem_interior_iff_mem_nhds]
@[simp]
theorem interior_Ico [NoMinOrder Ξ±] {a b : Ξ±} : interior (Ico a b) = Ioo a b := by
rw [β Ici_inter_Iio, interior_inter, interior_Ici, interior_Iio, Ioi_inter_Iio]
#align interior_Ico interior_Ico
@[simp]
theorem Ico_mem_nhds_iff [NoMinOrder Ξ±] {a b x : Ξ±} : Ico a b β π x β x β Ioo a b := by
rw [β interior_Ico, mem_interior_iff_mem_nhds]
@[simp]
theorem interior_Ioc [NoMaxOrder Ξ±] {a b : Ξ±} : interior (Ioc a b) = Ioo a b := by
rw [β Ioi_inter_Iic, interior_inter, interior_Ioi, interior_Iic, Ioi_inter_Iio]
#align interior_Ioc interior_Ioc
@[simp]
theorem Ioc_mem_nhds_iff [NoMaxOrder Ξ±] {a b x : Ξ±} : Ioc a b β π x β x β Ioo a b := by
rw [β interior_Ioc, mem_interior_iff_mem_nhds]
theorem closure_interior_Icc {a b : Ξ±} (h : a β b) : closure (interior (Icc a b)) = Icc a b :=
(closure_minimal interior_subset isClosed_Icc).antisymm <|
calc
Icc a b = closure (Ioo a b) := (closure_Ioo h).symm
_ β closure (interior (Icc a b)) :=
closure_mono (interior_maximal Ioo_subset_Icc_self isOpen_Ioo)
#align closure_interior_Icc closure_interior_Icc
| Mathlib/Topology/Order/DenselyOrdered.lean | 136 | 143 | theorem Ioc_subset_closure_interior (a b : Ξ±) : Ioc a b β closure (interior (Ioc a b)) := by |
rcases eq_or_ne a b with (rfl | h)
Β· simp
Β· calc
Ioc a b β Icc a b := Ioc_subset_Icc_self
_ = closure (Ioo a b) := (closure_Ioo h).symm
_ β closure (interior (Ioc a b)) :=
closure_mono (interior_maximal Ioo_subset_Ioc_self isOpen_Ioo)
| [
" closure (Ioi a) = Ici a",
" closure (Ioi a) β Ici a",
" Ici a β closure (Ioi a)",
" a β closure (Ioi a)",
" closure (Ioo a b) = Icc a b",
" closure (Ioo a b) β Icc a b",
" Icc a b β closure (Ioo a b)",
" {a, b} β closure (Ioo a b)",
" a β closure (Ioo a b) β§ b β closure (Ioo a b)",
" β
β closure... | [
" closure (Ioi a) = Ici a",
" closure (Ioi a) β Ici a",
" Ici a β closure (Ioi a)",
" a β closure (Ioi a)",
" closure (Ioo a b) = Icc a b",
" closure (Ioo a b) β Icc a b",
" Icc a b β closure (Ioo a b)",
" {a, b} β closure (Ioo a b)",
" a β closure (Ioo a b) β§ b β closure (Ioo a b)",
" β
β closure... |
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
| Mathlib/Topology/UniformSpace/UniformConvergence.lean | 124 | 127 | 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]
| [
" TendstoUniformlyOn F f p s β TendstoUniformlyOnFilter F f p (π s)",
" (β u β π€ Ξ², βαΆ (n : ΞΉ) in p, β x β s, (f x, F n x) β u) β\n β u β π€ Ξ², βαΆ (n : ΞΉ Γ Ξ±) in p ΓΛ’ π s, (f n.2, F n.1 n.2) β u",
" β a β π€ Ξ², (βαΆ (n : ΞΉ) in p, β x β s, (f x, F n x) β a) β βαΆ (n : ΞΉ Γ Ξ±) in p ΓΛ’ π s, (f n.2, F n.1 n.2) ... | [
" TendstoUniformlyOn F f p s β TendstoUniformlyOnFilter F f p (π s)",
" (β u β π€ Ξ², βαΆ (n : ΞΉ) in p, β x β s, (f x, F n x) β u) β\n β u β π€ Ξ², βαΆ (n : ΞΉ Γ Ξ±) in p ΓΛ’ π s, (f n.2, F n.1 n.2) β u",
" β a β π€ Ξ², (βαΆ (n : ΞΉ) in p, β x β s, (f x, F n x) β a) β βαΆ (n : ΞΉ Γ Ξ±) in p ΓΛ’ π s, (f n.2, F n.1 n.2) ... |
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Lp
import Mathlib.MeasureTheory.Integral.Bochner
import Mathlib.Order.Filter.IndicatorFunction
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner
import Mathlib.MeasureTheory.Function.LpSeminorm.Trim
#align_import measure_theory.function.conditional_expectation.ae_measurable from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e"
set_option linter.uppercaseLean3 false
open TopologicalSpace Filter
open scoped ENNReal MeasureTheory
namespace MeasureTheory
def AEStronglyMeasurable' {Ξ± Ξ²} [TopologicalSpace Ξ²] (m : MeasurableSpace Ξ±)
{_ : MeasurableSpace Ξ±} (f : Ξ± β Ξ²) (ΞΌ : Measure Ξ±) : Prop :=
β g : Ξ± β Ξ², StronglyMeasurable[m] g β§ f =α΅[ΞΌ] g
#align measure_theory.ae_strongly_measurable' MeasureTheory.AEStronglyMeasurable'
namespace AEStronglyMeasurable'
variable {Ξ± Ξ² π : Type*} {m m0 : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±} [TopologicalSpace Ξ²]
{f g : Ξ± β Ξ²}
| Mathlib/MeasureTheory/Function/ConditionalExpectation/AEMeasurable.lean | 62 | 64 | theorem congr (hf : AEStronglyMeasurable' m f ΞΌ) (hfg : f =α΅[ΞΌ] g) :
AEStronglyMeasurable' m g ΞΌ := by |
obtain β¨f', hf'_meas, hff'β© := hf; exact β¨f', hf'_meas, hfg.symm.trans hff'β©
| [
" AEStronglyMeasurable' m g ΞΌ"
] | [] |
import Mathlib.GroupTheory.GroupAction.Prod
import Mathlib.Algebra.Ring.Int
import Mathlib.Data.Nat.Cast.Basic
assert_not_exists DenselyOrdered
variable {M : Type*}
class NatPowAssoc (M : Type*) [MulOneClass M] [Pow M β] : Prop where
protected npow_add : β (k n: β) (x : M), x ^ (k + n) = x ^ k * x ^ n
protected npow_zero : β (x : M), x ^ 0 = 1
protected npow_one : β (x : M), x ^ 1 = x
section MulOneClass
variable [MulOneClass M] [Pow M β] [NatPowAssoc M]
theorem npow_add (k n : β) (x : M) : x ^ (k + n) = x ^ k * x ^ n :=
NatPowAssoc.npow_add k n x
@[simp]
theorem npow_zero (x : M) : x ^ 0 = 1 :=
NatPowAssoc.npow_zero x
@[simp]
theorem npow_one (x : M) : x ^ 1 = x :=
NatPowAssoc.npow_one x
theorem npow_mul_assoc (k m n : β) (x : M) :
(x ^ k * x ^ m) * x ^ n = x ^ k * (x ^ m * x ^ n) := by
simp only [β npow_add, add_assoc]
| Mathlib/Algebra/Group/NatPowAssoc.lean | 69 | 70 | theorem npow_mul_comm (m n : β) (x : M) :
x ^ m * x ^ n = x ^ n * x ^ m := by | simp only [β npow_add, add_comm]
| [
" x ^ k * x ^ m * x ^ n = x ^ k * (x ^ m * x ^ n)",
" x ^ m * x ^ n = x ^ n * x ^ m"
] | [
" x ^ k * x ^ m * x ^ n = x ^ k * (x ^ m * x ^ n)"
] |
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Set.Finite
#align_import combinatorics.hall.finite from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
open Finset
universe u v
namespace HallMarriageTheorem
variable {ΞΉ : Type u} {Ξ± : Type v} [DecidableEq Ξ±] {t : ΞΉ β Finset Ξ±}
section Fintype
variable [Fintype ΞΉ]
theorem hall_cond_of_erase {x : ΞΉ} (a : Ξ±)
(ha : β s : Finset ΞΉ, s.Nonempty β s β univ β s.card < (s.biUnion t).card)
(s' : Finset { x' : ΞΉ | x' β x }) : s'.card β€ (s'.biUnion fun x' => (t x').erase a).card := by
haveI := Classical.decEq ΞΉ
specialize ha (s'.image fun z => z.1)
rw [image_nonempty, Finset.card_image_of_injective s' Subtype.coe_injective] at ha
by_cases he : s'.Nonempty
Β· have ha' : s'.card < (s'.biUnion fun x => t x).card := by
convert ha he fun h => by simpa [β h] using mem_univ x using 2
ext x
simp only [mem_image, mem_biUnion, exists_prop, SetCoe.exists, exists_and_right,
exists_eq_right, Subtype.coe_mk]
rw [β erase_biUnion]
by_cases hb : a β s'.biUnion fun x => t x
Β· rw [card_erase_of_mem hb]
exact Nat.le_sub_one_of_lt ha'
Β· rw [erase_eq_of_not_mem hb]
exact Nat.le_of_lt ha'
Β· rw [nonempty_iff_ne_empty, not_not] at he
subst s'
simp
#align hall_marriage_theorem.hall_cond_of_erase HallMarriageTheorem.hall_cond_of_erase
theorem hall_hard_inductive_step_A {n : β} (hn : Fintype.card ΞΉ = n + 1)
(ht : β s : Finset ΞΉ, s.card β€ (s.biUnion t).card)
(ih :
β {ΞΉ' : Type u} [Fintype ΞΉ'] (t' : ΞΉ' β Finset Ξ±),
Fintype.card ΞΉ' β€ n β
(β s' : Finset ΞΉ', s'.card β€ (s'.biUnion t').card) β
β f : ΞΉ' β Ξ±, Function.Injective f β§ β x, f x β t' x)
(ha : β s : Finset ΞΉ, s.Nonempty β s β univ β s.card < (s.biUnion t).card) :
β f : ΞΉ β Ξ±, Function.Injective f β§ β x, f x β t x := by
haveI : Nonempty ΞΉ := Fintype.card_pos_iff.mp (hn.symm βΈ Nat.succ_pos _)
haveI := Classical.decEq ΞΉ
-- Choose an arbitrary element `x : ΞΉ` and `y : t x`.
let x := Classical.arbitrary ΞΉ
have tx_ne : (t x).Nonempty := by
rw [β Finset.card_pos]
calc
0 < 1 := Nat.one_pos
_ β€ (Finset.biUnion {x} t).card := ht {x}
_ = (t x).card := by rw [Finset.singleton_biUnion]
choose y hy using tx_ne
-- Restrict to everything except `x` and `y`.
let ΞΉ' := { x' : ΞΉ | x' β x }
let t' : ΞΉ' β Finset Ξ± := fun x' => (t x').erase y
have card_ΞΉ' : Fintype.card ΞΉ' = n :=
calc
Fintype.card ΞΉ' = Fintype.card ΞΉ - 1 := Set.card_ne_eq _
_ = n := by rw [hn, Nat.add_succ_sub_one, add_zero]
rcases ih t' card_ΞΉ'.le (hall_cond_of_erase y ha) with β¨f', hfinj, hfrβ©
-- Extend the resulting function.
refine β¨fun z => if h : z = x then y else f' β¨z, hβ©, ?_, ?_β©
Β· rintro zβ zβ
have key : β {x}, y β f' x := by
intro x h
simpa [t', β h] using hfr x
by_cases hβ : zβ = x <;> by_cases hβ : zβ = x <;> simp [hβ, hβ, hfinj.eq_iff, key, key.symm]
Β· intro z
simp only [ne_eq, Set.mem_setOf_eq]
split_ifs with hz
Β· rwa [hz]
Β· specialize hfr β¨z, hzβ©
rw [mem_erase] at hfr
exact hfr.2
set_option linter.uppercaseLean3 false in
#align hall_marriage_theorem.hall_hard_inductive_step_A HallMarriageTheorem.hall_hard_inductive_step_A
| Mathlib/Combinatorics/Hall/Finite.lean | 125 | 133 | theorem hall_cond_of_restrict {ΞΉ : Type u} {t : ΞΉ β Finset Ξ±} {s : Finset ΞΉ}
(ht : β s : Finset ΞΉ, s.card β€ (s.biUnion t).card) (s' : Finset (s : Set ΞΉ)) :
s'.card β€ (s'.biUnion fun a' => t a').card := by |
classical
rw [β card_image_of_injective s' Subtype.coe_injective]
convert ht (s'.image fun z => z.1) using 1
apply congr_arg
ext y
simp
| [
" s'.card β€ (s'.biUnion fun x' => (t βx').erase a).card",
" s'.card < (s'.biUnion fun x_1 => t βx_1).card",
" False",
" (s'.biUnion fun x_1 => t βx_1) = (image (fun z => βz) s').biUnion t",
" (x β s'.biUnion fun x => t βx) β x β (image (fun z => βz) s').biUnion t",
" s'.card β€ ((s'.biUnion fun x' => t βx'... | [
" s'.card β€ (s'.biUnion fun x' => (t βx').erase a).card",
" s'.card < (s'.biUnion fun x_1 => t βx_1).card",
" False",
" (s'.biUnion fun x_1 => t βx_1) = (image (fun z => βz) s').biUnion t",
" (x β s'.biUnion fun x => t βx) β x β (image (fun z => βz) s').biUnion t",
" s'.card β€ ((s'.biUnion fun x' => t βx'... |
import Mathlib.AlgebraicTopology.SplitSimplicialObject
import Mathlib.AlgebraicTopology.DoldKan.PInfty
#align_import algebraic_topology.dold_kan.functor_gamma from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits SimplexCategory
SimplicialObject Opposite CategoryTheory.Idempotents Simplicial DoldKan
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] (K K' : ChainComplex C β) (f : K βΆ K')
{Ξ Ξ' Ξ'' : SimplexCategory}
@[nolint unusedArguments]
def IsΞ΄β {Ξ Ξ' : SimplexCategory} (i : Ξ' βΆ Ξ) [Mono i] : Prop :=
Ξ.len = Ξ'.len + 1 β§ i.toOrderHom 0 β 0
#align algebraic_topology.dold_kan.is_Ξ΄β AlgebraicTopology.DoldKan.IsΞ΄β
namespace Ξβ
namespace Obj
def summand (Ξ : SimplexCategoryα΅α΅) (A : Splitting.IndexSet Ξ) : C :=
K.X A.1.unop.len
#align algebraic_topology.dold_kan.Ξβ.obj.summand AlgebraicTopology.DoldKan.Ξβ.Obj.summand
def objβ (K : ChainComplex C β) (Ξ : SimplexCategoryα΅α΅) [HasFiniteCoproducts C] : C :=
β fun A : Splitting.IndexSet Ξ => summand K Ξ A
#align algebraic_topology.dold_kan.Ξβ.obj.objβ AlgebraicTopology.DoldKan.Ξβ.Obj.objβ
namespace Termwise
def mapMono (K : ChainComplex C β) {Ξ' Ξ : SimplexCategory} (i : Ξ' βΆ Ξ) [Mono i] :
K.X Ξ.len βΆ K.X Ξ'.len := by
by_cases Ξ = Ξ'
Β· exact eqToHom (by congr)
Β· by_cases IsΞ΄β i
Β· exact K.d Ξ.len Ξ'.len
Β· exact 0
#align algebraic_topology.dold_kan.Ξβ.obj.termwise.map_mono AlgebraicTopology.DoldKan.Ξβ.Obj.Termwise.mapMono
variable (Ξ)
theorem mapMono_id : mapMono K (π Ξ) = π _ := by
unfold mapMono
simp only [eq_self_iff_true, eqToHom_refl, dite_eq_ite, if_true]
#align algebraic_topology.dold_kan.Ξβ.obj.termwise.map_mono_id AlgebraicTopology.DoldKan.Ξβ.Obj.Termwise.mapMono_id
variable {Ξ}
| Mathlib/AlgebraicTopology/DoldKan/FunctorGamma.lean | 112 | 117 | theorem mapMono_Ξ΄β' (i : Ξ' βΆ Ξ) [Mono i] (hi : IsΞ΄β i) : mapMono K i = K.d Ξ.len Ξ'.len := by |
unfold mapMono
suffices Ξ β Ξ' by
simp only [dif_neg this, dif_pos hi]
rintro rfl
simpa only [self_eq_add_right, Nat.one_ne_zero] using hi.1
| [
" K.X Ξ.len βΆ K.X Ξ'.len",
" K.X Ξ.len = K.X Ξ'.len",
" mapMono K (π Ξ) = π (K.X Ξ.len)",
" (if h : Ξ = Ξ then eqToHom β― else if h : IsΞ΄β (π Ξ) then K.d Ξ.len Ξ.len else 0) = π (K.X Ξ.len)",
" mapMono K i = K.d Ξ.len Ξ'.len",
" (if h : Ξ = Ξ' then eqToHom β― else if h : IsΞ΄β i then K.d Ξ.len Ξ'.len els... | [
" K.X Ξ.len βΆ K.X Ξ'.len",
" K.X Ξ.len = K.X Ξ'.len",
" mapMono K (π Ξ) = π (K.X Ξ.len)",
" (if h : Ξ = Ξ then eqToHom β― else if h : IsΞ΄β (π Ξ) then K.d Ξ.len Ξ.len else 0) = π (K.X Ξ.len)"
] |
import Mathlib.Algebra.MvPolynomial.Monad
#align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6"
namespace MvPolynomial
variable {Ο Ο R S : Type*} [CommSemiring R] [CommSemiring S]
noncomputable def expand (p : β) : MvPolynomial Ο R ββ[R] MvPolynomial Ο R :=
{ (evalβHom C fun i β¦ X i ^ p : MvPolynomial Ο R β+* MvPolynomial Ο R) with
commutes' := fun _ β¦ evalβHom_C _ _ _ }
#align mv_polynomial.expand MvPolynomial.expand
-- @[simp] -- Porting note (#10618): simp can prove this
theorem expand_C (p : β) (r : R) : expand p (C r : MvPolynomial Ο R) = C r :=
evalβHom_C _ _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.expand_C MvPolynomial.expand_C
@[simp]
theorem expand_X (p : β) (i : Ο) : expand p (X i : MvPolynomial Ο R) = X i ^ p :=
evalβHom_X' _ _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.expand_X MvPolynomial.expand_X
@[simp]
theorem expand_monomial (p : β) (d : Ο ββ β) (r : R) :
expand p (monomial d r) = C r * β i β d.support, (X i ^ p) ^ d i :=
bindβ_monomial _ _ _
#align mv_polynomial.expand_monomial MvPolynomial.expand_monomial
theorem expand_one_apply (f : MvPolynomial Ο R) : expand 1 f = f := by
simp only [expand, pow_one, evalβHom_eq_bindβ, bindβ_C_left, RingHom.toMonoidHom_eq_coe,
RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply]
#align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply
@[simp]
theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial Ο R) := by
ext1 f
rw [expand_one_apply, AlgHom.id_apply]
#align mv_polynomial.expand_one MvPolynomial.expand_one
theorem expand_comp_bindβ (p : β) (f : Ο β MvPolynomial Ο R) :
(expand p).comp (bindβ f) = bindβ fun i β¦ expand p (f i) := by
apply algHom_ext
intro i
simp only [AlgHom.comp_apply, bindβ_X_right]
#align mv_polynomial.expand_comp_bindβ MvPolynomial.expand_comp_bindβ
| Mathlib/Algebra/MvPolynomial/Expand.lean | 71 | 73 | theorem expand_bindβ (p : β) (f : Ο β MvPolynomial Ο R) (Ο : MvPolynomial Ο R) :
expand p (bindβ f Ο) = bindβ (fun i β¦ expand p (f i)) Ο := by |
rw [β AlgHom.comp_apply, expand_comp_bindβ]
| [
" (expand 1) f = f",
" expand 1 = AlgHom.id R (MvPolynomial Ο R)",
" (expand 1) (X f) = (AlgHom.id R (MvPolynomial Ο R)) (X f)",
" (expand p).comp (bindβ f) = bindβ fun i => (expand p) (f i)",
" β (i : Ο), ((expand p).comp (bindβ f)) (X i) = (bindβ fun i => (expand p) (f i)) (X i)",
" ((expand p).comp (bi... | [
" (expand 1) f = f",
" expand 1 = AlgHom.id R (MvPolynomial Ο R)",
" (expand 1) (X f) = (AlgHom.id R (MvPolynomial Ο R)) (X f)",
" (expand p).comp (bindβ f) = bindβ fun i => (expand p) (f i)",
" β (i : Ο), ((expand p).comp (bindβ f)) (X i) = (bindβ fun i => (expand p) (f i)) (X i)",
" ((expand p).comp (bi... |
import Mathlib.Data.Multiset.Bind
import Mathlib.Control.Traversable.Lemmas
import Mathlib.Control.Traversable.Instances
#align_import data.multiset.functor from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
universe u
namespace Multiset
open List
instance functor : Functor Multiset where map := @map
@[simp]
theorem fmap_def {Ξ±' Ξ²'} {s : Multiset Ξ±'} (f : Ξ±' β Ξ²') : f <$> s = s.map f :=
rfl
#align multiset.fmap_def Multiset.fmap_def
instance : LawfulFunctor Multiset where
id_map := by simp
comp_map := by simp
map_const {_ _} := rfl
open LawfulTraversable CommApplicative
variable {F : Type u β Type u} [Applicative F] [CommApplicative F]
variable {Ξ±' Ξ²' : Type u} (f : Ξ±' β F Ξ²')
def traverse : Multiset Ξ±' β F (Multiset Ξ²') := by
refine Quotient.lift (Functor.map Coe.coe β Traversable.traverse f) ?_
introv p; unfold Function.comp
induction p with
| nil => rfl
| @cons x lβ lβ _ h =>
have :
Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f lβ =
Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f lβ := by rw [h]
simpa [functor_norm] using this
| swap x y l =>
have :
(fun a b (l : List Ξ²') β¦ (β(a :: b :: l) : Multiset Ξ²')) <$> f y <*> f x =
(fun a b l β¦ β(a :: b :: l)) <$> f x <*> f y := by
rw [CommApplicative.commutative_map]
congr
funext a b l
simpa [flip] using Perm.swap a b l
simp [(Β· β Β·), this, functor_norm, Coe.coe]
| trans => simp [*]
#align multiset.traverse Multiset.traverse
instance : Monad Multiset :=
{ Multiset.functor with
pure := fun x β¦ {x}
bind := @bind }
@[simp]
theorem pure_def {Ξ±} : (pure : Ξ± β Multiset Ξ±) = singleton :=
rfl
#align multiset.pure_def Multiset.pure_def
@[simp]
theorem bind_def {Ξ± Ξ²} : (Β· >>= Β·) = @bind Ξ± Ξ² :=
rfl
#align multiset.bind_def Multiset.bind_def
instance : LawfulMonad Multiset := LawfulMonad.mk'
(bind_pure_comp := fun _ _ β¦ by simp only [pure_def, bind_def, bind_singleton, fmap_def])
(id_map := fun _ β¦ by simp only [fmap_def, id_eq, map_id'])
(pure_bind := fun _ _ β¦ by simp only [pure_def, bind_def, singleton_bind])
(bind_assoc := @bind_assoc)
open Functor
open Traversable LawfulTraversable
@[simp]
theorem lift_coe {Ξ± Ξ² : Type*} (x : List Ξ±) (f : List Ξ± β Ξ²)
(h : β a b : List Ξ±, a β b β f a = f b) : Quotient.lift f h (x : Multiset Ξ±) = f x :=
Quotient.lift_mk _ _ _
#align multiset.lift_coe Multiset.lift_coe
@[simp]
theorem map_comp_coe {Ξ± Ξ²} (h : Ξ± β Ξ²) :
Functor.map h β Coe.coe = (Coe.coe β Functor.map h : List Ξ± β Multiset Ξ²) := by
funext; simp only [Function.comp_apply, Coe.coe, fmap_def, map_coe, List.map_eq_map]
#align multiset.map_comp_coe Multiset.map_comp_coe
theorem id_traverse {Ξ± : Type*} (x : Multiset Ξ±) : traverse (pure : Ξ± β Id Ξ±) x = x := by
refine Quotient.inductionOn x ?_
intro
simp [traverse, Coe.coe]
#align multiset.id_traverse Multiset.id_traverse
theorem comp_traverse {G H : Type _ β Type _} [Applicative G] [Applicative H] [CommApplicative G]
[CommApplicative H] {Ξ± Ξ² Ξ³ : Type _} (g : Ξ± β G Ξ²) (h : Ξ² β H Ξ³) (x : Multiset Ξ±) :
traverse (Comp.mk β Functor.map h β g) x =
Comp.mk (Functor.map (traverse h) (traverse g x)) := by
refine Quotient.inductionOn x ?_
intro
simp only [traverse, quot_mk_to_coe, lift_coe, Coe.coe, Function.comp_apply, Functor.map_map,
functor_norm]
simp only [Function.comp, lift_coe]
#align multiset.comp_traverse Multiset.comp_traverse
theorem map_traverse {G : Type* β Type _} [Applicative G] [CommApplicative G] {Ξ± Ξ² Ξ³ : Type _}
(g : Ξ± β G Ξ²) (h : Ξ² β Ξ³) (x : Multiset Ξ±) :
Functor.map (Functor.map h) (traverse g x) = traverse (Functor.map h β g) x := by
refine Quotient.inductionOn x ?_
intro
simp only [traverse, quot_mk_to_coe, lift_coe, Function.comp_apply, Functor.map_map, map_comp_coe]
rw [LawfulFunctor.comp_map, Traversable.map_traverse']
rfl
#align multiset.map_traverse Multiset.map_traverse
| Mathlib/Data/Multiset/Functor.lean | 129 | 134 | theorem traverse_map {G : Type* β Type _} [Applicative G] [CommApplicative G] {Ξ± Ξ² Ξ³ : Type _}
(g : Ξ± β Ξ²) (h : Ξ² β G Ξ³) (x : Multiset Ξ±) : traverse h (map g x) = traverse (h β g) x := by |
refine Quotient.inductionOn x ?_
intro
simp only [traverse, quot_mk_to_coe, map_coe, lift_coe, Function.comp_apply]
rw [β Traversable.traverse_map h g, List.map_eq_map]
| [
" β {Ξ± : Type ?u.133} (x : Multiset Ξ±), id <$> x = x",
" β {Ξ± Ξ² Ξ³ : Type ?u.133} (g : Ξ± β Ξ²) (h : Ξ² β Ξ³) (x : Multiset Ξ±), (h β g) <$> x = h <$> g <$> x",
" Multiset Ξ±' β F (Multiset Ξ²')",
" β (a b : List Ξ±'),\n a β b β (Functor.map Coe.coe β Traversable.traverse f) a = (Functor.map Coe.coe β Traversable.t... | [
" β {Ξ± : Type ?u.133} (x : Multiset Ξ±), id <$> x = x",
" β {Ξ± Ξ² Ξ³ : Type ?u.133} (g : Ξ± β Ξ²) (h : Ξ² β Ξ³) (x : Multiset Ξ±), (h β g) <$> x = h <$> g <$> x",
" Multiset Ξ±' β F (Multiset Ξ²')",
" β (a b : List Ξ±'),\n a β b β (Functor.map Coe.coe β Traversable.traverse f) a = (Functor.map Coe.coe β Traversable.t... |
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.GroupTheory.GroupAction.Basic
import Mathlib.Dynamics.PeriodicPts
import Mathlib.Data.Set.Pointwise.SMul
namespace MulAction
open Pointwise
variable {Ξ± : Type*}
variable {G : Type*} [Group G] [MulAction G Ξ±]
variable {M : Type*} [Monoid M] [MulAction M Ξ±]
section Commute
@[to_additive "If `g` and `h` commute, then `g` fixes `h +α΅₯ x` iff `g` fixes `x`.
This is equivalent to say that the set `fixedBy Ξ± g` is fixed by `h`.
"]
| Mathlib/GroupTheory/GroupAction/FixedPoints.lean | 195 | 199 | theorem fixedBy_mem_fixedBy_of_commute {g h : G} (comm: Commute g h) :
(fixedBy Ξ± g) β fixedBy (Set Ξ±) h := by |
ext x
rw [Set.mem_smul_set_iff_inv_smul_mem, mem_fixedBy, β mul_smul, comm.inv_right, mul_smul,
smul_left_cancel_iff, mem_fixedBy]
| [
" fixedBy Ξ± g β fixedBy (Set Ξ±) h",
" x β h β’ fixedBy Ξ± g β x β fixedBy Ξ± g"
] | [] |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace InnerProductGeometry
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace β V]
theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
βx + yβ * βx + yβ = βxβ * βxβ + βyβ * βyβ β angle x y = Ο / 2 := by
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_add_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = Ο / 2) :
βx + yβ * βx + yβ = βxβ * βxβ + βyβ * βyβ :=
(norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq'
theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
βx - yβ * βx - yβ = βxβ * βxβ + βyβ * βyβ β angle x y = Ο / 2 := by
rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_sub_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = Ο / 2) :
βx - yβ * βx - yβ = βxβ * βxβ + βyβ * βyβ :=
(norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq'
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 69 | 73 | theorem angle_add_eq_arccos_of_inner_eq_zero {x y : V} (h : βͺx, yβ« = 0) :
angle x (x + y) = Real.arccos (βxβ / βx + yβ) := by |
rw [angle, inner_add_right, h, add_zero, real_inner_self_eq_norm_mul_norm]
by_cases hx : βxβ = 0; Β· simp [hx]
rw [div_mul_eq_div_div, mul_self_div_self]
| [
" βx + yβ * βx + yβ = βxβ * βxβ + βyβ * βyβ β angle x y = Ο / 2",
" βͺx, yβ«_β = 0 β angle x y = Ο / 2",
" βx - yβ * βx - yβ = βxβ * βxβ + βyβ * βyβ β angle x y = Ο / 2",
" angle x (x + y) = (βxβ / βx + yβ).arccos",
" (βxβ * βxβ / (βxβ * βx + yβ)).arccos = (βxβ / βx + yβ).arccos"
] | [
" βx + yβ * βx + yβ = βxβ * βxβ + βyβ * βyβ β angle x y = Ο / 2",
" βͺx, yβ«_β = 0 β angle x y = Ο / 2",
" βx - yβ * βx - yβ = βxβ * βxβ + βyβ * βyβ β angle x y = Ο / 2"
] |
import Mathlib.Logic.Pairwise
import Mathlib.Logic.Relation
import Mathlib.Data.List.Basic
#align_import data.list.pairwise from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open Nat Function
namespace List
variable {Ξ± Ξ² : Type*} {R S T : Ξ± β Ξ± β Prop} {a : Ξ±} {l : List Ξ±}
mk_iff_of_inductive_prop List.Pairwise List.pairwise_iff
#align list.pairwise_iff List.pairwise_iff
#align list.pairwise.nil List.Pairwise.nil
#align list.pairwise.cons List.Pairwise.cons
#align list.rel_of_pairwise_cons List.rel_of_pairwise_cons
#align list.pairwise.of_cons List.Pairwise.of_cons
#align list.pairwise.tail List.Pairwise.tail
#align list.pairwise.drop List.Pairwise.drop
#align list.pairwise.imp_of_mem List.Pairwise.imp_of_mem
#align list.pairwise.imp List.Pairwise.impβ -- Implicits Order
#align list.pairwise_and_iff List.pairwise_and_iff
#align list.pairwise.and List.Pairwise.and
#align list.pairwise.impβ List.Pairwise.impβ
#align list.pairwise.iff_of_mem List.Pairwise.iff_of_mem
#align list.pairwise.iff List.Pairwise.iff
#align list.pairwise_of_forall List.pairwise_of_forall
#align list.pairwise.and_mem List.Pairwise.and_mem
#align list.pairwise.imp_mem List.Pairwise.imp_mem
#align list.pairwise.sublist List.Pairwise.sublistβ -- Implicits order
#align list.pairwise.forall_of_forall_of_flip List.Pairwise.forall_of_forall_of_flip
theorem Pairwise.forall_of_forall (H : Symmetric R) (Hβ : β x β l, R x x) (Hβ : l.Pairwise R) :
β β¦xβ¦, x β l β β β¦yβ¦, y β l β R x y :=
Hβ.forall_of_forall_of_flip Hβ <| by rwa [H.flip_eq]
#align list.pairwise.forall_of_forall List.Pairwise.forall_of_forall
theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) :
β β¦aβ¦, a β l β β β¦bβ¦, b β l β a β b β R a b := by
apply Pairwise.forall_of_forall
Β· exact fun a b h hne => hR (h hne.symm)
Β· exact fun _ _ hx => (hx rfl).elim
Β· exact hl.imp (@fun a b h _ => by exact h)
#align list.pairwise.forall List.Pairwise.forall
theorem Pairwise.set_pairwise (hl : Pairwise R l) (hr : Symmetric R) : { x | x β l }.Pairwise R :=
hl.forall hr
#align list.pairwise.set_pairwise List.Pairwise.set_pairwise
#align list.pairwise_singleton List.pairwise_singleton
#align list.pairwise_pair List.pairwise_pair
#align list.pairwise_append List.pairwise_append
#align list.pairwise_append_comm List.pairwise_append_comm
#align list.pairwise_middle List.pairwise_middle
-- Porting note: Duplicate of `pairwise_map` but with `f` explicit.
@[deprecated (since := "2024-02-25")] theorem pairwise_map' (f : Ξ² β Ξ±) :
β {l : List Ξ²}, Pairwise R (map f l) β Pairwise (fun a b : Ξ² => R (f a) (f b)) l
| [] => by simp only [map, Pairwise.nil]
| b :: l => by
simp only [map, pairwise_cons, mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iffβ, pairwise_map]
#align list.pairwise_map List.pairwise_map'
#align list.pairwise.of_map List.Pairwise.of_map
#align list.pairwise.map List.Pairwise.map
#align list.pairwise_filter_map List.pairwise_filterMap
#align list.pairwise.filter_map List.Pairwise.filter_map
#align list.pairwise_filter List.pairwise_filter
#align list.pairwise.filter List.Pairwise.filterβ
theorem pairwise_pmap {p : Ξ² β Prop} {f : β b, p b β Ξ±} {l : List Ξ²} (h : β x β l, p x) :
Pairwise R (l.pmap f h) β
Pairwise (fun bβ bβ => β (hβ : p bβ) (hβ : p bβ), R (f bβ hβ) (f bβ hβ)) l := by
induction' l with a l ihl
Β· simp
obtain β¨_, hlβ© : p a β§ β b, b β l β p b := by simpa using h
simp only [ihl hl, pairwise_cons, existsβ_imp, pmap, and_congr_left_iff, mem_pmap]
refine fun _ => β¨fun H b hb _ hpb => H _ _ hb rfl, ?_β©
rintro H _ b hb rfl
exact H b hb _ _
#align list.pairwise_pmap List.pairwise_pmap
theorem Pairwise.pmap {l : List Ξ±} (hl : Pairwise R l) {p : Ξ± β Prop} {f : β a, p a β Ξ²}
(h : β x β l, p x) {S : Ξ² β Ξ² β Prop}
(hS : β β¦xβ¦ (hx : p x) β¦yβ¦ (hy : p y), R x y β S (f x hx) (f y hy)) :
Pairwise S (l.pmap f h) := by
refine (pairwise_pmap h).2 (Pairwise.imp_of_mem ?_ hl)
intros; apply hS; assumption
#align list.pairwise.pmap List.Pairwise.pmap
#align list.pairwise_join List.pairwise_join
#align list.pairwise_bind List.pairwise_bind
#align list.pairwise_reverse List.pairwise_reverse
#align list.pairwise_of_reflexive_on_dupl_of_forall_ne List.pairwise_of_reflexive_on_dupl_of_forall_ne
| Mathlib/Data/List/Pairwise.lean | 152 | 156 | theorem pairwise_of_forall_mem_list {l : List Ξ±} {r : Ξ± β Ξ± β Prop} (h : β a β l, β b β l, r a b) :
l.Pairwise r := by |
rw [pairwise_iff_forall_sublist]
intro a b hab
apply h <;> (apply hab.subset; simp)
| [
" Pairwise (flip fun x => R x) l",
" β β¦a : Ξ±β¦, a β l β β β¦b : Ξ±β¦, b β l β a β b β R a b",
" Symmetric fun x y => x β y β R x y",
" β (x : Ξ±), x β l β x β x β R x x",
" Pairwise (fun x y => x β y β R x y) l",
" R a b",
" Pairwise R (map f []) β Pairwise (fun a b => R (f a) (f b)) []",
" Pairwise R (ma... | [
" Pairwise (flip fun x => R x) l",
" β β¦a : Ξ±β¦, a β l β β β¦b : Ξ±β¦, b β l β a β b β R a b",
" Symmetric fun x y => x β y β R x y",
" β (x : Ξ±), x β l β x β x β R x x",
" Pairwise (fun x y => x β y β R x y) l",
" R a b",
" Pairwise R (map f []) β Pairwise (fun a b => R (f a) (f b)) []",
" Pairwise R (ma... |
import Mathlib.Geometry.Manifold.ContMDiff.Basic
open Set Function Filter ChartedSpace SmoothManifoldWithCorners
open scoped Topology Manifold
variable {π : Type*} [NontriviallyNormedField π]
-- declare a smooth manifold `M` over the pair `(E, H)`.
{E : Type*}
[NormedAddCommGroup E] [NormedSpace π E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners π E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
[SmoothManifoldWithCorners I M]
-- declare a smooth manifold `M'` over the pair `(E', H')`.
{E' : Type*}
[NormedAddCommGroup E'] [NormedSpace π E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners π E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M']
-- declare a manifold `M''` over the pair `(E'', H'')`.
{E'' : Type*}
[NormedAddCommGroup E''] [NormedSpace π E''] {H'' : Type*} [TopologicalSpace H'']
{I'' : ModelWithCorners π E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
-- declare a smooth manifold `N` over the pair `(F, G)`.
{F : Type*}
[NormedAddCommGroup F] [NormedSpace π F] {G : Type*} [TopologicalSpace G]
{J : ModelWithCorners π F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N]
[SmoothManifoldWithCorners J N]
-- declare a smooth manifold `N'` over the pair `(F', G')`.
{F' : Type*}
[NormedAddCommGroup F'] [NormedSpace π F'] {G' : Type*} [TopologicalSpace G']
{J' : ModelWithCorners π F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N']
[SmoothManifoldWithCorners J' N']
-- Fβ, Fβ, Fβ, Fβ are normed spaces
{Fβ : Type*}
[NormedAddCommGroup Fβ] [NormedSpace π Fβ] {Fβ : Type*} [NormedAddCommGroup Fβ]
[NormedSpace π Fβ] {Fβ : Type*} [NormedAddCommGroup Fβ] [NormedSpace π Fβ] {Fβ : Type*}
[NormedAddCommGroup Fβ] [NormedSpace π Fβ]
-- declare functions, sets, points and smoothness indices
{e : PartialHomeomorph M H}
{e' : PartialHomeomorph M' H'} {f fβ : M β M'} {s sβ t : Set M} {x : M} {m n : ββ}
variable {I I'}
section ProdMk
theorem ContMDiffWithinAt.prod_mk {f : M β M'} {g : M β N'} (hf : ContMDiffWithinAt I I' n f s x)
(hg : ContMDiffWithinAt I J' n g s x) :
ContMDiffWithinAt I (I'.prod J') n (fun x => (f x, g x)) s x := by
rw [contMDiffWithinAt_iff] at *
exact β¨hf.1.prod hg.1, hf.2.prod hg.2β©
#align cont_mdiff_within_at.prod_mk ContMDiffWithinAt.prod_mk
| Mathlib/Geometry/Manifold/ContMDiff/Product.lean | 66 | 70 | theorem ContMDiffWithinAt.prod_mk_space {f : M β E'} {g : M β F'}
(hf : ContMDiffWithinAt I π(π, E') n f s x) (hg : ContMDiffWithinAt I π(π, F') n g s x) :
ContMDiffWithinAt I π(π, E' Γ F') n (fun x => (f x, g x)) s x := by |
rw [contMDiffWithinAt_iff] at *
exact β¨hf.1.prod hg.1, hf.2.prod hg.2β©
| [
" ContMDiffWithinAt I (I'.prod J') n (fun x => (f x, g x)) s x",
" ContinuousWithinAt (fun x => (f x, g x)) s x β§\n ContDiffWithinAt π n (β(extChartAt (I'.prod J') (f x, g x)) β (fun x => (f x, g x)) β β(extChartAt I x).symm)\n (β(extChartAt I x).symm β»ΒΉ' s β© range βI) (β(extChartAt I x) x)",
" ContMDi... | [
" ContMDiffWithinAt I (I'.prod J') n (fun x => (f x, g x)) s x",
" ContinuousWithinAt (fun x => (f x, g x)) s x β§\n ContDiffWithinAt π n (β(extChartAt (I'.prod J') (f x, g x)) β (fun x => (f x, g x)) β β(extChartAt I x).symm)\n (β(extChartAt I x).symm β»ΒΉ' s β© range βI) (β(extChartAt I x) x)"
] |
import Mathlib.CategoryTheory.Sites.Coherent.SheafComparison
import Mathlib.CategoryTheory.Sites.Equivalence
namespace CategoryTheory
variable {C : Type*} [Category C]
open GrothendieckTopology
namespace Equivalence
variable {D : Type*} [Category D]
variable (e : C β D)
section Regular
variable [Preregular C]
theorem preregular : Preregular D := e.inverse.reflects_preregular
instance [EssentiallySmall C] :
Preregular (SmallModel C) := (equivSmallModel C).preregular
instance : haveI := preregular e
e.TransportsGrothendieckTopology (regularTopology C) (regularTopology D) where
eq_inducedTopology := regularTopology.eq_induced e.inverse
variable (A : Type*) [Category A]
@[simps!]
def sheafCongrPreregular : haveI := e.preregular
Sheaf (regularTopology C) A β Sheaf (regularTopology D) A := e.sheafCongr _ _ _
open Presheaf
| Mathlib/CategoryTheory/Sites/Coherent/Equivalence.lean | 101 | 106 | theorem preregular_isSheaf_iff (F : Cα΅α΅ β₯€ A) : haveI := e.preregular
IsSheaf (regularTopology C) F β IsSheaf (regularTopology D) (e.inverse.op β F) := by |
refine β¨fun hF β¦ ((e.sheafCongrPreregular A).functor.obj β¨F, hFβ©).cond, fun hF β¦ ?_β©
rw [isSheaf_of_iso_iff (P' := e.functor.op β e.inverse.op β F)]
Β· exact (e.sheafCongrPreregular A).inverse.obj β¨e.inverse.op β F, hFβ© |>.cond
Β· exact isoWhiskerRight e.op.unitIso F
| [
" IsSheaf (regularTopology C) F β IsSheaf (regularTopology D) (e.inverse.op β F)",
" IsSheaf (regularTopology C) F",
" IsSheaf (regularTopology C) (e.functor.op β e.inverse.op β F)",
" F β
e.functor.op β e.inverse.op β F"
] | [] |
import Mathlib.CategoryTheory.Sites.Sieves
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.Order.Copy
import Mathlib.Data.Set.Subsingleton
#align_import category_theory.sites.grothendieck from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
universe vβ uβ v u
namespace CategoryTheory
open CategoryTheory Category
variable (C : Type u) [Category.{v} C]
structure GrothendieckTopology where
sieves : β X : C, Set (Sieve X)
top_mem' : β X, β€ β sieves X
pullback_stable' : β β¦X Y : Cβ¦ β¦S : Sieve Xβ¦ (f : Y βΆ X), S β sieves X β S.pullback f β sieves Y
transitive' :
β β¦Xβ¦ β¦S : Sieve Xβ¦ (_ : S β sieves X) (R : Sieve X),
(β β¦Yβ¦ β¦f : Y βΆ Xβ¦, S f β R.pullback f β sieves Y) β R β sieves X
#align category_theory.grothendieck_topology CategoryTheory.GrothendieckTopology
namespace GrothendieckTopology
instance : CoeFun (GrothendieckTopology C) fun _ => β X : C, Set (Sieve X) :=
β¨sievesβ©
variable {C}
variable {X Y : C} {S R : Sieve X}
variable (J : GrothendieckTopology C)
@[ext]
| Mathlib/CategoryTheory/Sites/Grothendieck.lean | 105 | 109 | theorem ext {Jβ Jβ : GrothendieckTopology C} (h : (Jβ : β X : C, Set (Sieve X)) = Jβ) :
Jβ = Jβ := by |
cases Jβ
cases Jβ
congr
| [
" Jβ = Jβ",
" { sieves := sievesβ, top_mem' := top_mem'β, pullback_stable' := pullback_stable'β, transitive' := transitive'β } = Jβ",
" { sieves := sievesβΒΉ, top_mem' := top_mem'βΒΉ, pullback_stable' := pullback_stable'βΒΉ, transitive' := transitive'βΒΉ } =\n { sieves := sievesβ, top_mem' := top_mem'β, pullback... | [] |
import Mathlib.Algebra.Algebra.Basic
import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue
import Mathlib.Data.Real.Archimedean
#align_import number_theory.class_number.admissible_abs from "leanprover-community/mathlib"@"e97cf15cd1aec9bd5c193b2ffac5a6dc9118912b"
namespace AbsoluteValue
open Int
| Mathlib/NumberTheory/ClassNumber/AdmissibleAbs.lean | 31 | 52 | theorem exists_partition_int (n : β) {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) {b : β€} (hb : b β 0) (A : Fin n β β€) :
β t : Fin n β Fin β1 / Ξ΅ββ,
β iβ iβ, t iβ = t iβ β β(abs (A iβ % b - A iβ % b)) < abs b β’ Ξ΅ := by |
have hb' : (0 : β) < β(abs b) := Int.cast_pos.mpr (abs_pos.mpr hb)
have hbΞ΅ : 0 < abs b β’ Ξ΅ := by
rw [Algebra.smul_def]
exact mul_pos hb' hΞ΅
have hfloor : β i, 0 β€ floor ((A i % b : β€) / abs b β’ Ξ΅ : β) :=
fun _ β¦ floor_nonneg.mpr (div_nonneg (cast_nonneg.mpr (emod_nonneg _ hb)) hbΞ΅.le)
refine β¨fun i β¦ β¨natAbs (floor ((A i % b : β€) / abs b β’ Ξ΅ : β)), ?_β©, ?_β©
Β· rw [β ofNat_lt, natAbs_of_nonneg (hfloor i), floor_lt]
apply lt_of_lt_of_le _ (Nat.le_ceil _)
rw [Algebra.smul_def, eq_intCast, β div_div, div_lt_div_right hΞ΅, div_lt_iff hb', one_mul,
cast_lt]
exact Int.emod_lt _ hb
intro iβ iβ hi
have hi : (ββ(A iβ % b) / abs b β’ Ξ΅β.natAbs : β€) = ββ(A iβ % b) / abs b β’ Ξ΅β.natAbs :=
congr_arg ((β) : β β β€) (Fin.mk_eq_mk.mp hi)
rw [natAbs_of_nonneg (hfloor iβ), natAbs_of_nonneg (hfloor iβ)] at hi
have hi := abs_sub_lt_one_of_floor_eq_floor hi
rw [abs_sub_comm, β sub_div, abs_div, abs_of_nonneg hbΞ΅.le, div_lt_iff hbΞ΅, one_mul] at hi
rwa [Int.cast_abs, Int.cast_sub]
| [
" β t, β (iβ iβ : Fin n), t iβ = t iβ β β|A iβ % b - A iβ % b| < |b| β’ Ξ΅",
" 0 < |b| β’ Ξ΅",
" 0 < (algebraMap β€ β) |b| * Ξ΅",
" ββ(A i % b) / |b| β’ Ξ΅β.natAbs < β1 / Ξ΅ββ",
" β(A i % b) / |b| β’ Ξ΅ < βββ1 / Ξ΅ββ",
" β(A i % b) / |b| β’ Ξ΅ < 1 / Ξ΅",
" A i % b < |b|",
" β (iβ iβ : Fin n),\n (fun i => β¨ββ(A i ... | [] |
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Multiset.Powerset
#align_import data.finset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace Finset
open Function Multiset
variable {Ξ± : Type*} {s t : Finset Ξ±}
section Powerset
def powerset (s : Finset Ξ±) : Finset (Finset Ξ±) :=
β¨(s.1.powerset.pmap Finset.mk) fun _t h => nodup_of_le (mem_powerset.1 h) s.nodup,
s.nodup.powerset.pmap fun _a _ha _b _hb => congr_arg Finset.valβ©
#align finset.powerset Finset.powerset
@[simp]
theorem mem_powerset {s t : Finset Ξ±} : s β powerset t β s β t := by
cases s
simp [powerset, mem_mk, mem_pmap, mk.injEq, mem_powerset, exists_prop, exists_eq_right,
β val_le_iff]
#align finset.mem_powerset Finset.mem_powerset
@[simp, norm_cast]
theorem coe_powerset (s : Finset Ξ±) :
(s.powerset : Set (Finset Ξ±)) = ((β) : Finset Ξ± β Set Ξ±) β»ΒΉ' (s : Set Ξ±).powerset := by
ext
simp
#align finset.coe_powerset Finset.coe_powerset
-- Porting note: remove @[simp], simp can prove it
theorem empty_mem_powerset (s : Finset Ξ±) : β
β powerset s :=
mem_powerset.2 (empty_subset _)
#align finset.empty_mem_powerset Finset.empty_mem_powerset
-- Porting note: remove @[simp], simp can prove it
theorem mem_powerset_self (s : Finset Ξ±) : s β powerset s :=
mem_powerset.2 Subset.rfl
#align finset.mem_powerset_self Finset.mem_powerset_self
@[aesop safe apply (rule_sets := [finsetNonempty])]
theorem powerset_nonempty (s : Finset Ξ±) : s.powerset.Nonempty :=
β¨β
, empty_mem_powerset _β©
#align finset.powerset_nonempty Finset.powerset_nonempty
@[simp]
theorem powerset_mono {s t : Finset Ξ±} : powerset s β powerset t β s β t :=
β¨fun h => mem_powerset.1 <| h <| mem_powerset_self _, fun st _u h =>
mem_powerset.2 <| Subset.trans (mem_powerset.1 h) stβ©
#align finset.powerset_mono Finset.powerset_mono
theorem powerset_injective : Injective (powerset : Finset Ξ± β Finset (Finset Ξ±)) :=
(injective_of_le_imp_le _) powerset_mono.1
#align finset.powerset_injective Finset.powerset_injective
@[simp]
theorem powerset_inj : powerset s = powerset t β s = t :=
powerset_injective.eq_iff
#align finset.powerset_inj Finset.powerset_inj
@[simp]
theorem powerset_empty : (β
: Finset Ξ±).powerset = {β
} :=
rfl
#align finset.powerset_empty Finset.powerset_empty
@[simp]
theorem powerset_eq_singleton_empty : s.powerset = {β
} β s = β
:= by
rw [β powerset_empty, powerset_inj]
#align finset.powerset_eq_singleton_empty Finset.powerset_eq_singleton_empty
@[simp]
theorem card_powerset (s : Finset Ξ±) : card (powerset s) = 2 ^ card s :=
(card_pmap _ _ _).trans (Multiset.card_powerset s.1)
#align finset.card_powerset Finset.card_powerset
| Mathlib/Data/Finset/Powerset.lean | 93 | 96 | theorem not_mem_of_mem_powerset_of_not_mem {s t : Finset Ξ±} {a : Ξ±} (ht : t β s.powerset)
(h : a β s) : a β t := by |
apply mt _ h
apply mem_powerset.1 ht
| [
" s β t.powerset β s β t",
" { val := valβ, nodup := nodupβ } β t.powerset β { val := valβ, nodup := nodupβ } β t",
" βs.powerset = toSet β»ΒΉ' π«βs",
" xβ β βs.powerset β xβ β toSet β»ΒΉ' π«βs",
" s.powerset = {β
} β s = β
",
" a β t",
" a β t β a β s"
] | [
" s β t.powerset β s β t",
" { val := valβ, nodup := nodupβ } β t.powerset β { val := valβ, nodup := nodupβ } β t",
" βs.powerset = toSet β»ΒΉ' π«βs",
" xβ β βs.powerset β xβ β toSet β»ΒΉ' π«βs",
" s.powerset = {β
} β s = β
"
] |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
#align_import analysis.special_functions.pow.continuity from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
noncomputable section
open scoped Classical
open Real Topology NNReal ENNReal Filter ComplexConjugate
open Filter Finset Set
section CpowLimits
open Complex
variable {Ξ± : Type*}
theorem zero_cpow_eq_nhds {b : β} (hb : b β 0) : (fun x : β => (0 : β) ^ x) =αΆ [π b] 0 := by
suffices βαΆ x : β in π b, x β 0 from
this.mono fun x hx β¦ by
dsimp only
rw [zero_cpow hx, Pi.zero_apply]
exact IsOpen.eventually_mem isOpen_ne hb
#align zero_cpow_eq_nhds zero_cpow_eq_nhds
theorem cpow_eq_nhds {a b : β} (ha : a β 0) :
(fun x => x ^ b) =αΆ [π a] fun x => exp (log x * b) := by
suffices βαΆ x : β in π a, x β 0 from
this.mono fun x hx β¦ by
dsimp only
rw [cpow_def_of_ne_zero hx]
exact IsOpen.eventually_mem isOpen_ne ha
#align cpow_eq_nhds cpow_eq_nhds
theorem cpow_eq_nhds' {p : β Γ β} (hp_fst : p.fst β 0) :
(fun x => x.1 ^ x.2) =αΆ [π p] fun x => exp (log x.1 * x.2) := by
suffices βαΆ x : β Γ β in π p, x.1 β 0 from
this.mono fun x hx β¦ by
dsimp only
rw [cpow_def_of_ne_zero hx]
refine IsOpen.eventually_mem ?_ hp_fst
change IsOpen { x : β Γ β | x.1 = 0 }αΆ
rw [isOpen_compl_iff]
exact isClosed_eq continuous_fst continuous_const
#align cpow_eq_nhds' cpow_eq_nhds'
-- Continuity of `fun x => a ^ x`: union of these two lemmas is optimal.
theorem continuousAt_const_cpow {a b : β} (ha : a β 0) : ContinuousAt (fun x : β => a ^ x) b := by
have cpow_eq : (fun x : β => a ^ x) = fun x => exp (log a * x) := by
ext1 b
rw [cpow_def_of_ne_zero ha]
rw [cpow_eq]
exact continuous_exp.continuousAt.comp (ContinuousAt.mul continuousAt_const continuousAt_id)
#align continuous_at_const_cpow continuousAt_const_cpow
theorem continuousAt_const_cpow' {a b : β} (h : b β 0) : ContinuousAt (fun x : β => a ^ x) b := by
by_cases ha : a = 0
Β· rw [ha, continuousAt_congr (zero_cpow_eq_nhds h)]
exact continuousAt_const
Β· exact continuousAt_const_cpow ha
#align continuous_at_const_cpow' continuousAt_const_cpow'
theorem continuousAt_cpow {p : β Γ β} (hp_fst : p.fst β slitPlane) :
ContinuousAt (fun x : β Γ β => x.1 ^ x.2) p := by
rw [continuousAt_congr (cpow_eq_nhds' <| slitPlane_ne_zero hp_fst)]
refine continuous_exp.continuousAt.comp ?_
exact
ContinuousAt.mul
(ContinuousAt.comp (continuousAt_clog hp_fst) continuous_fst.continuousAt)
continuous_snd.continuousAt
#align continuous_at_cpow continuousAt_cpow
theorem continuousAt_cpow_const {a b : β} (ha : a β slitPlane) :
ContinuousAt (Β· ^ b) a :=
Tendsto.comp (@continuousAt_cpow (a, b) ha) (continuousAt_id.prod continuousAt_const)
#align continuous_at_cpow_const continuousAt_cpow_const
theorem Filter.Tendsto.cpow {l : Filter Ξ±} {f g : Ξ± β β} {a b : β} (hf : Tendsto f l (π a))
(hg : Tendsto g l (π b)) (ha : a β slitPlane) :
Tendsto (fun x => f x ^ g x) l (π (a ^ b)) :=
(@continuousAt_cpow (a, b) ha).tendsto.comp (hf.prod_mk_nhds hg)
#align filter.tendsto.cpow Filter.Tendsto.cpow
| Mathlib/Analysis/SpecialFunctions/Pow/Continuity.lean | 105 | 109 | theorem Filter.Tendsto.const_cpow {l : Filter Ξ±} {f : Ξ± β β} {a b : β} (hf : Tendsto f l (π b))
(h : a β 0 β¨ b β 0) : Tendsto (fun x => a ^ f x) l (π (a ^ b)) := by |
cases h with
| inl h => exact (continuousAt_const_cpow h).tendsto.comp hf
| inr h => exact (continuousAt_const_cpow' h).tendsto.comp hf
| [
" (fun x => 0 ^ x) =αΆ [π b] 0",
" (fun x => 0 ^ x) x = 0 x",
" 0 ^ x = OfNat.ofNat 0 x",
" βαΆ (x : β) in π b, x β 0",
" (fun x => x ^ b) =αΆ [π a] fun x => cexp (x.log * b)",
" (fun x => x ^ b) x = (fun x => cexp (x.log * b)) x",
" x ^ b = cexp (x.log * b)",
" βαΆ (x : β) in π a, x β 0",
" (fun x =>... | [
" (fun x => 0 ^ x) =αΆ [π b] 0",
" (fun x => 0 ^ x) x = 0 x",
" 0 ^ x = OfNat.ofNat 0 x",
" βαΆ (x : β) in π b, x β 0",
" (fun x => x ^ b) =αΆ [π a] fun x => cexp (x.log * b)",
" (fun x => x ^ b) x = (fun x => cexp (x.log * b)) x",
" x ^ b = cexp (x.log * b)",
" βαΆ (x : β) in π a, x β 0",
" (fun x =>... |
import Mathlib.MeasureTheory.Group.GeometryOfNumbers
import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls
import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional
local notation "E" K =>
({w : InfinitePlace K // IsReal w} β β) Γ ({w : InfinitePlace K // IsComplex w} β β)
section convexBodySum
open ENNReal MeasureTheory Fintype
open scoped Real Classical NNReal
variable [NumberField K] (B : β)
variable {K}
noncomputable abbrev convexBodySumFun (x : E K) : β := β w, mult w * normAtPlace w x
theorem convexBodySumFun_apply (x : E K) :
convexBodySumFun x = β w, mult w * normAtPlace w x := rfl
theorem convexBodySumFun_apply' (x : E K) :
convexBodySumFun x = β w, βx.1 wβ + 2 * β w, βx.2 wβ := by
simp_rw [convexBodySumFun_apply, β Finset.sum_add_sum_compl {w | IsReal w}.toFinset,
Set.toFinset_setOf, Finset.compl_filter, not_isReal_iff_isComplex, β Finset.subtype_univ,
β Finset.univ.sum_subtype_eq_sum_filter, Finset.mul_sum]
congr
Β· ext w
rw [mult, if_pos w.prop, normAtPlace_apply_isReal, Nat.cast_one, one_mul]
Β· ext w
rw [mult, if_neg (not_isReal_iff_isComplex.mpr w.prop), normAtPlace_apply_isComplex,
Nat.cast_ofNat]
theorem convexBodySumFun_nonneg (x : E K) :
0 β€ convexBodySumFun x :=
Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _))
theorem convexBodySumFun_neg (x : E K) :
convexBodySumFun (- x) = convexBodySumFun x := by
simp_rw [convexBodySumFun, normAtPlace_neg]
theorem convexBodySumFun_add_le (x y : E K) :
convexBodySumFun (x + y) β€ convexBodySumFun x + convexBodySumFun y := by
simp_rw [convexBodySumFun, β Finset.sum_add_distrib, β mul_add]
exact Finset.sum_le_sum
fun _ _ β¦ mul_le_mul_of_nonneg_left (normAtPlace_add_le _ x y) (Nat.cast_pos.mpr mult_pos).le
theorem convexBodySumFun_smul (c : β) (x : E K) :
convexBodySumFun (c β’ x) = |c| * convexBodySumFun x := by
simp_rw [convexBodySumFun, normAtPlace_smul, β mul_assoc, mul_comm, Finset.mul_sum, mul_assoc]
theorem convexBodySumFun_eq_zero_iff (x : E K) :
convexBodySumFun x = 0 β x = 0 := by
rw [β normAtPlace_eq_zero, convexBodySumFun, Finset.sum_eq_zero_iff_of_nonneg fun _ _ =>
mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _)]
conv =>
enter [1, w, hw]
rw [mul_left_mem_nonZeroDivisors_eq_zero_iff
(mem_nonZeroDivisors_iff_ne_zero.mpr <| Nat.cast_ne_zero.mpr mult_ne_zero)]
simp_rw [Finset.mem_univ, true_implies]
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean | 326 | 333 | theorem norm_le_convexBodySumFun (x : E K) : βxβ β€ convexBodySumFun x := by |
rw [norm_eq_sup'_normAtPlace]
refine (Finset.sup'_le_iff _ _).mpr fun w _ β¦ ?_
rw [convexBodySumFun_apply, β Finset.univ.add_sum_erase _ (Finset.mem_univ w)]
refine le_add_of_le_of_nonneg ?_ ?_
Β· exact le_mul_of_one_le_left (normAtPlace_nonneg w x) one_le_mult
Β· exact Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le
(normAtPlace_nonneg _ _))
| [
" convexBodySumFun x = β w : { w // w.IsReal }, βx.1 wβ + 2 * β w : { w // w.IsComplex }, βx.2 wβ",
" β x_1 β Finset.subtype (fun x => x.IsReal) Finset.univ, β(βx_1).mult * (normAtPlace βx_1) x +\n β x_1 β Finset.subtype (fun x => x.IsComplex) Finset.univ, β(βx_1).mult * (normAtPlace βx_1) x =\n β x_1 β F... | [
" convexBodySumFun x = β w : { w // w.IsReal }, βx.1 wβ + 2 * β w : { w // w.IsComplex }, βx.2 wβ",
" β x_1 β Finset.subtype (fun x => x.IsReal) Finset.univ, β(βx_1).mult * (normAtPlace βx_1) x +\n β x_1 β Finset.subtype (fun x => x.IsComplex) Finset.univ, β(βx_1).mult * (normAtPlace βx_1) x =\n β x_1 β F... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.