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 221 |
|---|---|---|---|---|---|---|---|
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.GroupWithZero.Units.Equiv
import Mathlib.Algebra.Order.Field.Defs
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Order.Bounds.OrderIso
import Mathlib.Tactic.Positivity.Core
#align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd"
open Function OrderDual
variable {ΞΉ Ξ± Ξ² : Type*}
section LinearOrderedSemifield
variable [LinearOrderedSemifield Ξ±] {a b c d e : Ξ±} {m n : β€}
@[simps! (config := { simpRhs := true })]
def OrderIso.mulLeftβ (a : Ξ±) (ha : 0 < a) : Ξ± βo Ξ± :=
{ Equiv.mulLeftβ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha }
#align order_iso.mul_leftβ OrderIso.mulLeftβ
#align order_iso.mul_leftβ_symm_apply OrderIso.mulLeftβ_symm_apply
#align order_iso.mul_leftβ_apply OrderIso.mulLeftβ_apply
@[simps! (config := { simpRhs := true })]
def OrderIso.mulRightβ (a : Ξ±) (ha : 0 < a) : Ξ± βo Ξ± :=
{ Equiv.mulRightβ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha }
#align order_iso.mul_rightβ OrderIso.mulRightβ
#align order_iso.mul_rightβ_symm_apply OrderIso.mulRightβ_symm_apply
#align order_iso.mul_rightβ_apply OrderIso.mulRightβ_apply
theorem le_div_iff (hc : 0 < c) : a β€ b / c β a * c β€ b :=
β¨fun h => div_mul_cancelβ b (ne_of_lt hc).symm βΈ mul_le_mul_of_nonneg_right h hc.le, fun h =>
calc
a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm
_ β€ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le
_ = b / c := (div_eq_mul_one_div b c).symm
β©
#align le_div_iff le_div_iff
theorem le_div_iff' (hc : 0 < c) : a β€ b / c β c * a β€ b := by rw [mul_comm, le_div_iff hc]
#align le_div_iff' le_div_iff'
theorem div_le_iff (hb : 0 < b) : a / b β€ c β a β€ c * b :=
β¨fun h =>
calc
a = a / b * b := by rw [div_mul_cancelβ _ (ne_of_lt hb).symm]
_ β€ c * b := mul_le_mul_of_nonneg_right h hb.le
,
fun h =>
calc
a / b = a * (1 / b) := div_eq_mul_one_div a b
_ β€ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le
_ = c * b / b := (div_eq_mul_one_div (c * b) b).symm
_ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl
β©
#align div_le_iff div_le_iff
theorem div_le_iff' (hb : 0 < b) : a / b β€ c β a β€ b * c := by rw [mul_comm, div_le_iff hb]
#align div_le_iff' div_le_iff'
lemma div_le_commβ (hb : 0 < b) (hc : 0 < c) : a / b β€ c β a / c β€ b := by
rw [div_le_iff hb, div_le_iff' hc]
theorem lt_div_iff (hc : 0 < c) : a < b / c β a * c < b :=
lt_iff_lt_of_le_iff_le <| div_le_iff hc
#align lt_div_iff lt_div_iff
theorem lt_div_iff' (hc : 0 < c) : a < b / c β c * a < b := by rw [mul_comm, lt_div_iff hc]
#align lt_div_iff' lt_div_iff'
theorem div_lt_iff (hc : 0 < c) : b / c < a β b < a * c :=
lt_iff_lt_of_le_iff_le (le_div_iff hc)
#align div_lt_iff div_lt_iff
theorem div_lt_iff' (hc : 0 < c) : b / c < a β b < c * a := by rw [mul_comm, div_lt_iff hc]
#align div_lt_iff' div_lt_iff'
lemma div_lt_commβ (hb : 0 < b) (hc : 0 < c) : a / b < c β a / c < b := by
rw [div_lt_iff hb, div_lt_iff' hc]
| Mathlib/Algebra/Order/Field/Basic.lean | 99 | 101 | theorem inv_mul_le_iff (h : 0 < b) : bβ»ΒΉ * a β€ c β a β€ b * c := by |
rw [inv_eq_one_div, mul_comm, β div_eq_mul_one_div]
exact div_le_iff' h
| [
" a β€ b / c β c * a β€ b",
" a = a / b * b",
" c * b / b = c",
" a / b β€ c β a β€ b * c",
" a / b β€ c β a / c β€ b",
" a < b / c β c * a < b",
" b / c < a β b < c * a",
" a / b < c β a / c < b",
" bβ»ΒΉ * a β€ c β a β€ b * c"
] | [
" a β€ b / c β c * a β€ b",
" a = a / b * b",
" c * b / b = c",
" a / b β€ c β a β€ b * c",
" a / b β€ c β a / c β€ b",
" a < b / c β c * a < b",
" b / c < a β b < c * a",
" a / b < c β a / c < b",
" bβ»ΒΉ * a β€ c β a β€ b * c"
] |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic
import Mathlib.Analysis.NormedSpace.AffineIsometry
#align_import geometry.euclidean.angle.unoriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open Real RealInnerProductSpace
namespace EuclideanGeometry
open InnerProductGeometry
variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace β V] [MetricSpace P]
[NormedAddTorsor V P] {p pβ pβ pβ : P}
nonrec def angle (p1 p2 p3 : P) : β :=
angle (p1 -α΅₯ p2 : V) (p3 -α΅₯ p2)
#align euclidean_geometry.angle EuclideanGeometry.angle
@[inherit_doc] scoped notation "β " => EuclideanGeometry.angle
| Mathlib/Geometry/Euclidean/Angle/Unoriented/Affine.lean | 50 | 57 | theorem continuousAt_angle {x : P Γ P Γ P} (hx12 : x.1 β x.2.1) (hx32 : x.2.2 β x.2.1) :
ContinuousAt (fun y : P Γ P Γ P => β y.1 y.2.1 y.2.2) x := by |
let f : P Γ P Γ P β V Γ V := fun y => (y.1 -α΅₯ y.2.1, y.2.2 -α΅₯ y.2.1)
have hf1 : (f x).1 β 0 := by simp [hx12]
have hf2 : (f x).2 β 0 := by simp [hx32]
exact (InnerProductGeometry.continuousAt_angle hf1 hf2).comp
((continuous_fst.vsub continuous_snd.fst).prod_mk
(continuous_snd.snd.vsub continuous_snd.fst)).continuousAt
| [
" ContinuousAt (fun y => β y.1 y.2.1 y.2.2) x",
" (f x).1 β 0",
" (f x).2 β 0"
] | [
" ContinuousAt (fun y => β y.1 y.2.1 y.2.2) x"
] |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Analysis.NormedSpace.LinearIsometry
import Mathlib.Algebra.Star.SelfAdjoint
import Mathlib.Algebra.Star.Subalgebra
import Mathlib.Algebra.Star.Unitary
import Mathlib.Topology.Algebra.Module.Star
#align_import analysis.normed_space.star.basic from "leanprover-community/mathlib"@"aa6669832974f87406a3d9d70fc5707a60546207"
open Topology
local postfix:max "β" => star
class NormedStarGroup (E : Type*) [SeminormedAddCommGroup E] [StarAddMonoid E] : Prop where
norm_star : β x : E, βxββ = βxβ
#align normed_star_group NormedStarGroup
export NormedStarGroup (norm_star)
attribute [simp] norm_star
variable {π E Ξ± : Type*}
instance RingHomIsometric.starRingEnd [NormedCommRing E] [StarRing E] [NormedStarGroup E] :
RingHomIsometric (starRingEnd E) :=
β¨@norm_star _ _ _ _β©
#align ring_hom_isometric.star_ring_end RingHomIsometric.starRingEnd
class CstarRing (E : Type*) [NonUnitalNormedRing E] [StarRing E] : Prop where
norm_star_mul_self : β {x : E}, βxβ * xβ = βxβ * βxβ
#align cstar_ring CstarRing
instance : CstarRing β where norm_star_mul_self {x} := by simp only [star, id, norm_mul]
namespace CstarRing
section Unital
variable [NormedRing E] [StarRing E] [CstarRing E]
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
| Mathlib/Analysis/NormedSpace/Star/Basic.lean | 203 | 205 | theorem norm_one [Nontrivial E] : β(1 : E)β = 1 := by |
have : 0 < β(1 : E)β := norm_pos_iff.mpr one_ne_zero
rw [β mul_left_inj' this.ne', β norm_star_mul_self, mul_one, star_one, one_mul]
| [
" βxβ * xβ = βxβ * βxβ",
" β1β = 1"
] | [
" βxβ * xβ = βxβ * βxβ",
" β1β = 1"
] |
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Polynomial.IntegralNormalization
#align_import ring_theory.algebraic from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
universe u v w
open scoped Classical
open Polynomial
section
variable (R : Type u) {A : Type v} [CommRing R] [Ring A] [Algebra R A]
def IsAlgebraic (x : A) : Prop :=
β p : R[X], p β 0 β§ aeval x p = 0
#align is_algebraic IsAlgebraic
def Transcendental (x : A) : Prop :=
Β¬IsAlgebraic R x
#align transcendental Transcendental
theorem is_transcendental_of_subsingleton [Subsingleton R] (x : A) : Transcendental R x :=
fun β¨p, h, _β© => h <| Subsingleton.elim p 0
#align is_transcendental_of_subsingleton is_transcendental_of_subsingleton
variable {R}
nonrec
def Subalgebra.IsAlgebraic (S : Subalgebra R A) : Prop :=
β x β S, IsAlgebraic R x
#align subalgebra.is_algebraic Subalgebra.IsAlgebraic
variable (R A)
protected class Algebra.IsAlgebraic : Prop :=
isAlgebraic : β x : A, IsAlgebraic R x
#align algebra.is_algebraic Algebra.IsAlgebraic
variable {R A}
lemma Algebra.isAlgebraic_def : Algebra.IsAlgebraic R A β β x : A, IsAlgebraic R x :=
β¨fun β¨hβ© β¦ h, fun h β¦ β¨hβ©β©
theorem Subalgebra.isAlgebraic_iff (S : Subalgebra R A) :
S.IsAlgebraic β @Algebra.IsAlgebraic R S _ _ S.algebra := by
delta Subalgebra.IsAlgebraic
rw [Subtype.forall', Algebra.isAlgebraic_def]
refine forall_congr' fun x => exists_congr fun p => and_congr Iff.rfl ?_
have h : Function.Injective S.val := Subtype.val_injective
conv_rhs => rw [β h.eq_iff, AlgHom.map_zero]
rw [β aeval_algHom_apply, S.val_apply]
#align subalgebra.is_algebraic_iff Subalgebra.isAlgebraic_iff
| Mathlib/RingTheory/Algebraic.lean | 78 | 80 | theorem Algebra.isAlgebraic_iff : Algebra.IsAlgebraic R A β (β€ : Subalgebra R A).IsAlgebraic := by |
delta Subalgebra.IsAlgebraic
simp only [Algebra.isAlgebraic_def, Algebra.mem_top, forall_prop_of_true, iff_self_iff]
| [
" S.IsAlgebraic β Algebra.IsAlgebraic R β₯S",
" (β x β S, _root_.IsAlgebraic R x) β Algebra.IsAlgebraic R β₯S",
" (β (x : β₯S), _root_.IsAlgebraic R βx) β β (x : β₯S), _root_.IsAlgebraic R x",
" (aeval βx) p = 0 β (aeval x) p = 0",
"R : Type u\nA : Type v\ninstβΒ² : CommRing R\ninstβΒΉ : Ring A\ninstβ : Algebra R... | [
" S.IsAlgebraic β Algebra.IsAlgebraic R β₯S",
" (β x β S, _root_.IsAlgebraic R x) β Algebra.IsAlgebraic R β₯S",
" (β (x : β₯S), _root_.IsAlgebraic R βx) β β (x : β₯S), _root_.IsAlgebraic R x",
" (aeval βx) p = 0 β (aeval x) p = 0",
"R : Type u\nA : Type v\ninstβΒ² : CommRing R\ninstβΒΉ : Ring A\ninstβ : Algebra R... |
import Mathlib.Computability.Halting
import Mathlib.Computability.TuringMachine
import Mathlib.Data.Num.Lemmas
import Mathlib.Tactic.DeriveFintype
#align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8"
open Function (update)
open Relation
namespace Turing
namespace ToPartrec
inductive Code
| zero'
| succ
| tail
| cons : Code β Code β Code
| comp : Code β Code β Code
| case : Code β Code β Code
| fix : Code β Code
deriving DecidableEq, Inhabited
#align turing.to_partrec.code Turing.ToPartrec.Code
#align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero'
#align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ
#align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail
#align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons
#align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp
#align turing.to_partrec.code.case Turing.ToPartrec.Code.case
#align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix
def Code.eval : Code β List β β. List β
| Code.zero' => fun v => pure (0 :: v)
| Code.succ => fun v => pure [v.headI.succ]
| Code.tail => fun v => pure v.tail
| Code.cons f fs => fun v => do
let n β Code.eval f v
let ns β Code.eval fs v
pure (n.headI :: ns)
| Code.comp f g => fun v => g.eval v >>= f.eval
| Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail)
| Code.fix f =>
PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail
#align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval
namespace Code
@[simp]
theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval]
@[simp]
| Mathlib/Computability/TMToPartrec.lean | 143 | 143 | theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by | simp [eval]
| [
" zero'.eval = fun v => pure (0 :: v)",
" succ.eval = fun v => pure [v.headI.succ]"
] | [
" zero'.eval = fun v => pure (0 :: v)",
" succ.eval = fun v => pure [v.headI.succ]"
] |
import Mathlib.Data.Matroid.Restrict
variable {Ξ± : Type*} {M : Matroid Ξ±} {E B I X R J : Set Ξ±}
namespace Matroid
open Set
section EmptyOn
def emptyOn (Ξ± : Type*) : Matroid Ξ± where
E := β
Base := (Β· = β
)
Indep := (Β· = β
)
indep_iff' := by simp [subset_empty_iff]
exists_base := β¨β
, rflβ©
base_exchange := by rintro _ _ rfl; simp
maximality := by rintro _ _ _ rfl -; exact β¨β
, by simp [mem_maximals_iff]β©
subset_ground := by simp
@[simp] theorem emptyOn_ground : (emptyOn Ξ±).E = β
:= rfl
@[simp] theorem emptyOn_base_iff : (emptyOn Ξ±).Base B β B = β
:= Iff.rfl
@[simp] theorem emptyOn_indep_iff : (emptyOn Ξ±).Indep I β I = β
:= Iff.rfl
theorem ground_eq_empty_iff : (M.E = β
) β M = emptyOn Ξ± := by
simp only [emptyOn, eq_iff_indep_iff_indep_forall, iff_self_and]
exact fun h β¦ by simp [h, subset_empty_iff]
@[simp] theorem emptyOn_dual_eq : (emptyOn Ξ±)βΆ = emptyOn Ξ± := by
rw [β ground_eq_empty_iff]; rfl
@[simp] theorem restrict_empty (M : Matroid Ξ±) : M βΎ (β
: Set Ξ±) = emptyOn Ξ± := by
simp [β ground_eq_empty_iff]
| Mathlib/Data/Matroid/Constructions.lean | 67 | 69 | theorem eq_emptyOn_or_nonempty (M : Matroid Ξ±) : M = emptyOn Ξ± β¨ Matroid.Nonempty M := by |
rw [β ground_eq_empty_iff]
exact M.E.eq_empty_or_nonempty.elim Or.inl (fun h β¦ Or.inr β¨hβ©)
| [
" β β¦I : Set Ξ±β¦, (fun x => x = β
) I β β B, (fun x => x = β
) B β§ I β B",
" ExchangeProperty fun x => x = β
",
" (fun x => x = β
) Yβ β β a β β
\\ Yβ, β b β Yβ \\ β
, (fun x => x = β
) (insert b (β
\\ {a}))",
" β X β β
, ExistsMaximalSubsetProperty (fun x => x = β
) X",
" (maximals (fun x x_1 => x β x_1) {Y | (fun ... | [
" β β¦I : Set Ξ±β¦, (fun x => x = β
) I β β B, (fun x => x = β
) B β§ I β B",
" ExchangeProperty fun x => x = β
",
" (fun x => x = β
) Yβ β β a β β
\\ Yβ, β b β Yβ \\ β
, (fun x => x = β
) (insert b (β
\\ {a}))",
" β X β β
, ExistsMaximalSubsetProperty (fun x => x = β
) X",
" (maximals (fun x x_1 => x β x_1) {Y | (fun ... |
import Mathlib.Data.List.Basic
#align_import data.bool.all_any from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
variable {Ξ± : Type*} {p : Ξ± β Prop} [DecidablePred p] {l : List Ξ±} {a : Ξ±}
namespace List
-- Porting note: in Batteries
#align list.all_nil List.all_nil
#align list.all_cons List.all_consβ
theorem all_iff_forall {p : Ξ± β Bool} : all l p β β a β l, p a := by
induction' l with a l ih
Β· exact iff_of_true rfl (forall_mem_nil _)
simp only [all_cons, Bool.and_eq_true_iff, ih, forall_mem_cons]
#align list.all_iff_forall List.all_iff_forall
theorem all_iff_forall_prop : (all l fun a => p a) β β a β l, p a := by
simp only [all_iff_forall, decide_eq_true_iff]
#align list.all_iff_forall_prop List.all_iff_forall_prop
-- Porting note: in Batteries
#align list.any_nil List.any_nil
#align list.any_cons List.any_consβ
theorem any_iff_exists {p : Ξ± β Bool} : any l p β β a β l, p a := by
induction' l with a l ih
Β· exact iff_of_false Bool.false_ne_true (not_exists_mem_nil _)
simp only [any_cons, Bool.or_eq_true_iff, ih, exists_mem_cons_iff]
#align list.any_iff_exists List.any_iff_exists
| Mathlib/Data/Bool/AllAny.lean | 48 | 48 | theorem any_iff_exists_prop : (any l fun a => p a) β β a β l, p a := by | simp [any_iff_exists]
| [
" l.all p = true β β (a : Ξ±), a β l β p a = true",
" [].all p = true β β (a : Ξ±), a β [] β p a = true",
" (a :: l).all p = true β β (a_1 : Ξ±), a_1 β a :: l β p a_1 = true",
" (l.all fun a => decide (p a)) = true β β (a : Ξ±), a β l β p a",
" l.any p = true β β a, a β l β§ p a = true",
" [].any p = true β β ... | [
" l.all p = true β β (a : Ξ±), a β l β p a = true",
" [].all p = true β β (a : Ξ±), a β [] β p a = true",
" (a :: l).all p = true β β (a_1 : Ξ±), a_1 β a :: l β p a_1 = true",
" (l.all fun a => decide (p a)) = true β β (a : Ξ±), a β l β p a",
" l.any p = true β β a, a β l β§ p a = true",
" [].any p = true β β ... |
import Aesop
import Mathlib.Algebra.Group.Defs
import Mathlib.Data.Nat.Defs
import Mathlib.Data.Int.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Cases
import Mathlib.Tactic.SimpRw
import Mathlib.Tactic.SplitIfs
#align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
variable {Ξ± Ξ² G M : Type*}
@[to_additive]
instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (Ξ± := G) (Β· * Β·) := β¨mul_commβ©
#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
attribute [local simp] mul_assoc sub_eq_add_neg
section DivInvMonoid
variable [DivInvMonoid G] {a b c : G}
@[to_additive, field_simps] -- The attributes are out of order on purpose
theorem inv_eq_one_div (x : G) : xβ»ΒΉ = 1 / x := by rw [div_eq_mul_inv, one_mul]
#align inv_eq_one_div inv_eq_one_div
#align neg_eq_zero_sub neg_eq_zero_sub
@[to_additive]
theorem mul_one_div (x y : G) : x * (1 / y) = x / y := by
rw [div_eq_mul_inv, one_mul, div_eq_mul_inv]
#align mul_one_div mul_one_div
#align add_zero_sub add_zero_sub
@[to_additive]
theorem mul_div_assoc (a b c : G) : a * b / c = a * (b / c) := by
rw [div_eq_mul_inv, div_eq_mul_inv, mul_assoc _ _ _]
#align mul_div_assoc mul_div_assoc
#align add_sub_assoc add_sub_assoc
@[to_additive, field_simps] -- The attributes are out of order on purpose
theorem mul_div_assoc' (a b c : G) : a * (b / c) = a * b / c :=
(mul_div_assoc _ _ _).symm
#align mul_div_assoc' mul_div_assoc'
#align add_sub_assoc' add_sub_assoc'
@[to_additive (attr := simp)]
theorem one_div (a : G) : 1 / a = aβ»ΒΉ :=
(inv_eq_one_div a).symm
#align one_div one_div
#align zero_sub zero_sub
@[to_additive]
| Mathlib/Algebra/Group/Basic.lean | 474 | 474 | theorem mul_div (a b c : G) : a * (b / c) = a * b / c := by | simp only [mul_assoc, div_eq_mul_inv]
| [
" xβ»ΒΉ = 1 / x",
" x * (1 / y) = x / y",
" a * b / c = a * (b / c)",
" a * (b / c) = a * b / c"
] | [
" xβ»ΒΉ = 1 / x",
" x * (1 / y) = x / y",
" a * b / c = a * (b / c)",
" a * (b / c) = a * b / c"
] |
import Mathlib.Data.Nat.Factorial.Basic
import Mathlib.Order.Monotone.Basic
#align_import data.nat.choose.basic from "leanprover-community/mathlib"@"2f3994e1b117b1e1da49bcfb67334f33460c3ce4"
open Nat
namespace Nat
def choose : β β β β β
| _, 0 => 1
| 0, _ + 1 => 0
| n + 1, k + 1 => choose n k + choose n (k + 1)
#align nat.choose Nat.choose
@[simp]
theorem choose_zero_right (n : β) : choose n 0 = 1 := by cases n <;> rfl
#align nat.choose_zero_right Nat.choose_zero_right
@[simp]
theorem choose_zero_succ (k : β) : choose 0 (succ k) = 0 :=
rfl
#align nat.choose_zero_succ Nat.choose_zero_succ
theorem choose_succ_succ (n k : β) : choose (succ n) (succ k) = choose n k + choose n (succ k) :=
rfl
#align nat.choose_succ_succ Nat.choose_succ_succ
theorem choose_succ_succ' (n k : β) : choose (n + 1) (k + 1) = choose n k + choose n (k + 1) :=
rfl
theorem choose_eq_zero_of_lt : β {n k}, n < k β choose n k = 0
| _, 0, hk => absurd hk (Nat.not_lt_zero _)
| 0, k + 1, _ => choose_zero_succ _
| n + 1, k + 1, hk => by
have hnk : n < k := lt_of_succ_lt_succ hk
have hnk1 : n < k + 1 := lt_of_succ_lt hk
rw [choose_succ_succ, choose_eq_zero_of_lt hnk, choose_eq_zero_of_lt hnk1]
#align nat.choose_eq_zero_of_lt Nat.choose_eq_zero_of_lt
@[simp]
theorem choose_self (n : β) : choose n n = 1 := by
induction n <;> simp [*, choose, choose_eq_zero_of_lt (lt_succ_self _)]
#align nat.choose_self Nat.choose_self
@[simp]
theorem choose_succ_self (n : β) : choose n (succ n) = 0 :=
choose_eq_zero_of_lt (lt_succ_self _)
#align nat.choose_succ_self Nat.choose_succ_self
@[simp]
lemma choose_one_right (n : β) : choose n 1 = n := by induction n <;> simp [*, choose, Nat.add_comm]
#align nat.choose_one_right Nat.choose_one_right
-- The `n+1`-st triangle number is `n` more than the `n`-th triangle number
| Mathlib/Data/Nat/Choose/Basic.lean | 93 | 95 | theorem triangle_succ (n : β) : (n + 1) * (n + 1 - 1) / 2 = n * (n - 1) / 2 + n := by |
rw [β add_mul_div_left, Nat.mul_comm 2 n, β Nat.mul_add, Nat.add_sub_cancel, Nat.mul_comm]
cases n <;> rfl; apply zero_lt_succ
| [
" n.choose 0 = 1",
" choose 0 0 = 1",
" (nβ + 1).choose 0 = 1",
" (n + 1).choose (k + 1) = 0",
" n.choose n = 1",
" (nβ + 1).choose (nβ + 1) = 1",
" n.choose 1 = n",
" choose 0 1 = 0",
" (nβ + 1).choose 1 = nβ + 1",
" (n + 1) * (n + 1 - 1) / 2 = n * (n - 1) / 2 + n",
" n * (n + 1) / 2 = n * (n -... | [
" n.choose 0 = 1",
" choose 0 0 = 1",
" (nβ + 1).choose 0 = 1",
" (n + 1).choose (k + 1) = 0",
" n.choose n = 1",
" (nβ + 1).choose (nβ + 1) = 1",
" n.choose 1 = n",
" choose 0 1 = 0",
" (nβ + 1).choose 1 = nβ + 1",
" (n + 1) * (n + 1 - 1) / 2 = n * (n - 1) / 2 + n"
] |
import Mathlib.LinearAlgebra.Matrix.DotProduct
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
#align_import data.matrix.rank from "leanprover-community/mathlib"@"17219820a8aa8abe85adf5dfde19af1dd1bd8ae7"
open Matrix
namespace Matrix
open FiniteDimensional
variable {l m n o R : Type*} [Fintype n] [Fintype o]
section CommRing
variable [CommRing R]
noncomputable def rank (A : Matrix m n R) : β :=
finrank R <| LinearMap.range A.mulVecLin
#align matrix.rank Matrix.rank
@[simp]
theorem rank_one [StrongRankCondition R] [DecidableEq n] :
rank (1 : Matrix n n R) = Fintype.card n := by
rw [rank, mulVecLin_one, LinearMap.range_id, finrank_top, finrank_pi]
#align matrix.rank_one Matrix.rank_one
@[simp]
theorem rank_zero [Nontrivial R] : rank (0 : Matrix m n R) = 0 := by
rw [rank, mulVecLin_zero, LinearMap.range_zero, finrank_bot]
#align matrix.rank_zero Matrix.rank_zero
theorem rank_le_card_width [StrongRankCondition R] (A : Matrix m n R) :
A.rank β€ Fintype.card n := by
haveI : Module.Finite R (n β R) := Module.Finite.pi
haveI : Module.Free R (n β R) := Module.Free.pi _ _
exact A.mulVecLin.finrank_range_le.trans_eq (finrank_pi _)
#align matrix.rank_le_card_width Matrix.rank_le_card_width
theorem rank_le_width [StrongRankCondition R] {m n : β} (A : Matrix (Fin m) (Fin n) R) :
A.rank β€ n :=
A.rank_le_card_width.trans <| (Fintype.card_fin n).le
#align matrix.rank_le_width Matrix.rank_le_width
theorem rank_mul_le_left [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) :
(A * B).rank β€ A.rank := by
rw [rank, rank, mulVecLin_mul]
exact Cardinal.toNat_le_toNat (LinearMap.rank_comp_le_left _ _) (rank_lt_aleph0 _ _)
#align matrix.rank_mul_le_left Matrix.rank_mul_le_left
theorem rank_mul_le_right [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) :
(A * B).rank β€ B.rank := by
rw [rank, rank, mulVecLin_mul]
exact finrank_le_finrank_of_rank_le_rank (LinearMap.lift_rank_comp_le_right _ _)
(rank_lt_aleph0 _ _)
#align matrix.rank_mul_le_right Matrix.rank_mul_le_right
theorem rank_mul_le [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) :
(A * B).rank β€ min A.rank B.rank :=
le_min (rank_mul_le_left _ _) (rank_mul_le_right _ _)
#align matrix.rank_mul_le Matrix.rank_mul_le
| Mathlib/Data/Matrix/Rank.lean | 89 | 93 | theorem rank_unit [StrongRankCondition R] [DecidableEq n] (A : (Matrix n n R)Λ£) :
(A : Matrix n n R).rank = Fintype.card n := by |
apply le_antisymm (rank_le_card_width (A : Matrix n n R)) _
have := rank_mul_le_left (A : Matrix n n R) (βAβ»ΒΉ : Matrix n n R)
rwa [β Units.val_mul, mul_inv_self, Units.val_one, rank_one] at this
| [
" rank 1 = Fintype.card n",
" rank 0 = 0",
" A.rank β€ Fintype.card n",
" (A * B).rank β€ A.rank",
" finrank R β₯(LinearMap.range (A.mulVecLin ββ B.mulVecLin)) β€ finrank R β₯(LinearMap.range A.mulVecLin)",
" (A * B).rank β€ B.rank",
" finrank R β₯(LinearMap.range (A.mulVecLin ββ B.mulVecLin)) β€ finrank R β₯(Li... | [
" rank 1 = Fintype.card n",
" rank 0 = 0",
" A.rank β€ Fintype.card n",
" (A * B).rank β€ A.rank",
" finrank R β₯(LinearMap.range (A.mulVecLin ββ B.mulVecLin)) β€ finrank R β₯(LinearMap.range A.mulVecLin)",
" (A * B).rank β€ B.rank",
" finrank R β₯(LinearMap.range (A.mulVecLin ββ B.mulVecLin)) β€ finrank R β₯(Li... |
import Mathlib.Algebra.Module.LinearMap.Basic
import Mathlib.LinearAlgebra.Basic
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.BilinearMap
#align_import linear_algebra.sesquilinear_form from "leanprover-community/mathlib"@"87c54600fe3cdc7d32ff5b50873ac724d86aef8d"
variable {R Rβ Rβ Rβ M Mβ Mβ Mβ Mββ Mββ' Mββ Mββ' K Kβ Kβ V Vβ Vβ n : Type*}
namespace LinearMap
section CommRing
-- the `β` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable [CommSemiring R] [CommSemiring Rβ] [AddCommMonoid Mβ] [Module Rβ Mβ] [CommSemiring Rβ]
[AddCommMonoid Mβ] [Module Rβ Mβ] [AddCommMonoid M] [Module R M]
{Iβ : Rβ β+* R} {Iβ : Rβ β+* R} {Iβ' : Rβ β+* R}
def IsOrtho (B : Mβ βββ[Iβ] Mβ βββ[Iβ] M) (x : Mβ) (y : Mβ) : Prop :=
B x y = 0
#align linear_map.is_ortho LinearMap.IsOrtho
theorem isOrtho_def {B : Mβ βββ[Iβ] Mβ βββ[Iβ] M} {x y} : B.IsOrtho x y β B x y = 0 :=
Iff.rfl
#align linear_map.is_ortho_def LinearMap.isOrtho_def
theorem isOrtho_zero_left (B : Mβ βββ[Iβ] Mβ βββ[Iβ] M) (x) : IsOrtho B (0 : Mβ) x := by
dsimp only [IsOrtho]
rw [map_zero B, zero_apply]
#align linear_map.is_ortho_zero_left LinearMap.isOrtho_zero_left
theorem isOrtho_zero_right (B : Mβ βββ[Iβ] Mβ βββ[Iβ] M) (x) : IsOrtho B x (0 : Mβ) :=
map_zero (B x)
#align linear_map.is_ortho_zero_right LinearMap.isOrtho_zero_right
theorem isOrtho_flip {B : Mβ βββ[Iβ] Mβ βββ[Iβ'] M} {x y} : B.IsOrtho x y β B.flip.IsOrtho y x := by
simp_rw [isOrtho_def, flip_apply]
#align linear_map.is_ortho_flip LinearMap.isOrtho_flip
def IsOrthoα΅’ (B : Mβ βββ[Iβ] Mβ βββ[Iβ'] M) (v : n β Mβ) : Prop :=
Pairwise (B.IsOrtho on v)
set_option linter.uppercaseLean3 false in
#align linear_map.is_Ortho LinearMap.IsOrthoα΅’
theorem isOrthoα΅’_def {B : Mβ βββ[Iβ] Mβ βββ[Iβ'] M} {v : n β Mβ} :
B.IsOrthoα΅’ v β β i j : n, i β j β B (v i) (v j) = 0 :=
Iff.rfl
set_option linter.uppercaseLean3 false in
#align linear_map.is_Ortho_def LinearMap.isOrthoα΅’_def
| Mathlib/LinearAlgebra/SesquilinearForm.lean | 91 | 98 | theorem isOrthoα΅’_flip (B : Mβ βββ[Iβ] Mβ βββ[Iβ'] M) {v : n β Mβ} :
B.IsOrthoα΅’ v β B.flip.IsOrthoα΅’ v := by |
simp_rw [isOrthoα΅’_def]
constructor <;> intro h i j hij
Β· rw [flip_apply]
exact h j i (Ne.symm hij)
simp_rw [flip_apply] at h
exact h j i (Ne.symm hij)
| [
" B.IsOrtho 0 x",
" (B 0) x = 0",
" B.IsOrtho x y β B.flip.IsOrtho y x",
" B.IsOrthoα΅’ v β B.flip.IsOrthoα΅’ v",
" (β (i j : n), i β j β (B (v i)) (v j) = 0) β β (i j : n), i β j β (B.flip (v i)) (v j) = 0",
" (β (i j : n), i β j β (B (v i)) (v j) = 0) β β (i j : n), i β j β (B.flip (v i)) (v j) = 0",
" (β... | [
" B.IsOrtho 0 x",
" (B 0) x = 0",
" B.IsOrtho x y β B.flip.IsOrtho y x",
" B.IsOrthoα΅’ v β B.flip.IsOrthoα΅’ v"
] |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Hom.Defs
import Mathlib.Algebra.GroupWithZero.NeZero
import Mathlib.Algebra.Opposites
import Mathlib.Algebra.Ring.Defs
#align_import algebra.ring.basic from "leanprover-community/mathlib"@"2ed7e4aec72395b6a7c3ac4ac7873a7a43ead17c"
variable {R : Type*}
open Function
namespace AddHom
@[simps (config := .asFn)]
def mulLeft [Distrib R] (r : R) : AddHom R R where
toFun := (r * Β·)
map_add' := mul_add r
#align add_hom.mul_left AddHom.mulLeft
#align add_hom.mul_left_apply AddHom.mulLeft_apply
@[simps (config := .asFn)]
def mulRight [Distrib R] (r : R) : AddHom R R where
toFun a := a * r
map_add' _ _ := add_mul _ _ r
#align add_hom.mul_right AddHom.mulRight
#align add_hom.mul_right_apply AddHom.mulRight_apply
end AddHom
section HasDistribNeg
section Group
variable {Ξ± : Type*} [Group Ξ±] [HasDistribNeg Ξ±]
@[simp]
| Mathlib/Algebra/Ring/Basic.lean | 112 | 113 | theorem inv_neg' (a : Ξ±) : (-a)β»ΒΉ = -aβ»ΒΉ := by |
rw [eq_comm, eq_inv_iff_mul_eq_one, neg_mul, mul_neg, neg_neg, mul_left_inv]
| [
" (-a)β»ΒΉ = -aβ»ΒΉ"
] | [
" (-a)β»ΒΉ = -aβ»ΒΉ"
] |
import Mathlib.RingTheory.Localization.Basic
#align_import ring_theory.localization.integer from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
variable {R : Type*} [CommSemiring R] {M : Submonoid R} {S : Type*} [CommSemiring S]
variable [Algebra R S] {P : Type*} [CommSemiring P]
open Function
namespace IsLocalization
section
variable (R)
-- TODO: define a subalgebra of `IsInteger`s
def IsInteger (a : S) : Prop :=
a β (algebraMap R S).rangeS
#align is_localization.is_integer IsLocalization.IsInteger
end
theorem isInteger_zero : IsInteger R (0 : S) :=
Subsemiring.zero_mem _
#align is_localization.is_integer_zero IsLocalization.isInteger_zero
theorem isInteger_one : IsInteger R (1 : S) :=
Subsemiring.one_mem _
#align is_localization.is_integer_one IsLocalization.isInteger_one
theorem isInteger_add {a b : S} (ha : IsInteger R a) (hb : IsInteger R b) : IsInteger R (a + b) :=
Subsemiring.add_mem _ ha hb
#align is_localization.is_integer_add IsLocalization.isInteger_add
theorem isInteger_mul {a b : S} (ha : IsInteger R a) (hb : IsInteger R b) : IsInteger R (a * b) :=
Subsemiring.mul_mem _ ha hb
#align is_localization.is_integer_mul IsLocalization.isInteger_mul
theorem isInteger_smul {a : R} {b : S} (hb : IsInteger R b) : IsInteger R (a β’ b) := by
rcases hb with β¨b', hbβ©
use a * b'
rw [β hb, (algebraMap R S).map_mul, Algebra.smul_def]
#align is_localization.is_integer_smul IsLocalization.isInteger_smul
variable (M)
variable [IsLocalization M S]
theorem exists_integer_multiple' (a : S) : β b : M, IsInteger R (a * algebraMap R S b) :=
let β¨β¨Num, denomβ©, hβ© := IsLocalization.surj _ a
β¨denom, Set.mem_range.mpr β¨Num, h.symmβ©β©
#align is_localization.exists_integer_multiple' IsLocalization.exists_integer_multiple'
| Mathlib/RingTheory/Localization/Integer.lean | 85 | 87 | theorem exists_integer_multiple (a : S) : β b : M, IsInteger R ((b : R) β’ a) := by |
simp_rw [Algebra.smul_def, mul_comm _ a]
apply exists_integer_multiple'
| [
" IsInteger R (a β’ b)",
" (algebraMap R S) (a * b') = a β’ b",
" β b, IsInteger R (βb β’ a)",
" β b, IsInteger R (a * (algebraMap R S) βb)"
] | [
" IsInteger R (a β’ b)",
" (algebraMap R S) (a * b') = a β’ b",
" β b, IsInteger R (βb β’ a)"
] |
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic
#align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473"
open Function
variable {Ξ± Ξ² : Type*}
section CovariantClassMulLe
variable [LinearOrder Ξ±]
section Mul
variable [Mul Ξ±]
@[to_additive]
theorem lt_or_lt_of_mul_lt_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·)]
[CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· β€ Β·)] {aβ aβ bβ bβ : Ξ±} :
aβ * bβ < aβ * bβ β aβ < aβ β¨ bβ < bβ := by
contrapose!
exact fun h => mul_le_mul' h.1 h.2
#align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul
#align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add
@[to_additive]
theorem le_or_lt_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·)]
[CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {aβ aβ bβ bβ : Ξ±} :
aβ * bβ β€ aβ * bβ β aβ β€ aβ β¨ bβ < bβ := by
contrapose!
exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2
#align le_or_lt_of_mul_le_mul le_or_lt_of_mul_le_mul
#align le_or_lt_of_add_le_add le_or_lt_of_add_le_add
@[to_additive]
| Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean | 108 | 112 | theorem lt_or_le_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)]
[CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· β€ Β·)] {aβ aβ bβ bβ : Ξ±} :
aβ * bβ β€ aβ * bβ β aβ < aβ β¨ bβ β€ bβ := by |
contrapose!
exact fun h => mul_lt_mul_of_le_of_lt h.1 h.2
| [
" aβ * bβ < aβ * bβ β aβ < aβ β¨ bβ < bβ",
" aβ β€ aβ β§ bβ β€ bβ β aβ * bβ β€ aβ * bβ",
" aβ * bβ β€ aβ * bβ β aβ β€ aβ β¨ bβ < bβ",
" aβ < aβ β§ bβ β€ bβ β aβ * bβ < aβ * bβ",
" aβ * bβ β€ aβ * bβ β aβ < aβ β¨ bβ β€ bβ",
" aβ β€ aβ β§ bβ < bβ β aβ * bβ < aβ * bβ"
] | [
" aβ * bβ < aβ * bβ β aβ < aβ β¨ bβ < bβ",
" aβ β€ aβ β§ bβ β€ bβ β aβ * bβ β€ aβ * bβ",
" aβ * bβ β€ aβ * bβ β aβ β€ aβ β¨ bβ < bβ",
" aβ < aβ β§ bβ β€ bβ β aβ * bβ < aβ * bβ",
" aβ * bβ β€ aβ * bβ β aβ < aβ β¨ bβ β€ bβ"
] |
import Mathlib.MeasureTheory.Integral.Lebesgue
open Set hiding restrict restrict_apply
open Filter ENNReal NNReal MeasureTheory.Measure
namespace MeasureTheory
variable {Ξ± : Type*} {m0 : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±}
noncomputable
def Measure.withDensity {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (f : Ξ± β ββ₯0β) : Measure Ξ± :=
Measure.ofMeasurable (fun s _ => β«β» a in s, f a βΞΌ) (by simp) fun s hs hd =>
lintegral_iUnion hs hd _
#align measure_theory.measure.with_density MeasureTheory.Measure.withDensity
@[simp]
theorem withDensity_apply (f : Ξ± β ββ₯0β) {s : Set Ξ±} (hs : MeasurableSet s) :
ΞΌ.withDensity f s = β«β» a in s, f a βΞΌ :=
Measure.ofMeasurable_apply s hs
#align measure_theory.with_density_apply MeasureTheory.withDensity_apply
theorem withDensity_apply_le (f : Ξ± β ββ₯0β) (s : Set Ξ±) :
β«β» a in s, f a βΞΌ β€ ΞΌ.withDensity f s := by
let t := toMeasurable (ΞΌ.withDensity f) s
calc
β«β» a in s, f a βΞΌ β€ β«β» a in t, f a βΞΌ :=
lintegral_mono_set (subset_toMeasurable (withDensity ΞΌ f) s)
_ = ΞΌ.withDensity f t :=
(withDensity_apply f (measurableSet_toMeasurable (withDensity ΞΌ f) s)).symm
_ = ΞΌ.withDensity f s := measure_toMeasurable s
theorem withDensity_apply' [SFinite ΞΌ] (f : Ξ± β ββ₯0β) (s : Set Ξ±) :
ΞΌ.withDensity f s = β«β» a in s, f a βΞΌ := by
apply le_antisymm ?_ (withDensity_apply_le f s)
let t := toMeasurable ΞΌ s
calc
ΞΌ.withDensity f s β€ ΞΌ.withDensity f t := measure_mono (subset_toMeasurable ΞΌ s)
_ = β«β» a in t, f a βΞΌ := withDensity_apply f (measurableSet_toMeasurable ΞΌ s)
_ = β«β» a in s, f a βΞΌ := by congr 1; exact restrict_toMeasurable_of_sFinite s
@[simp]
lemma withDensity_zero_left (f : Ξ± β ββ₯0β) : (0 : Measure Ξ±).withDensity f = 0 := by
ext s hs
rw [withDensity_apply _ hs]
simp
theorem withDensity_congr_ae {f g : Ξ± β ββ₯0β} (h : f =α΅[ΞΌ] g) :
ΞΌ.withDensity f = ΞΌ.withDensity g := by
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, withDensity_apply _ hs]
exact lintegral_congr_ae (ae_restrict_of_ae h)
#align measure_theory.with_density_congr_ae MeasureTheory.withDensity_congr_ae
lemma withDensity_mono {f g : Ξ± β ββ₯0β} (hfg : f β€α΅[ΞΌ] g) :
ΞΌ.withDensity f β€ ΞΌ.withDensity g := by
refine le_iff.2 fun s hs β¦ ?_
rw [withDensity_apply _ hs, withDensity_apply _ hs]
refine set_lintegral_mono_ae' hs ?_
filter_upwards [hfg] with x h_le using fun _ β¦ h_le
| Mathlib/MeasureTheory/Measure/WithDensity.lean | 97 | 102 | theorem withDensity_add_left {f : Ξ± β ββ₯0β} (hf : Measurable f) (g : Ξ± β ββ₯0β) :
ΞΌ.withDensity (f + g) = ΞΌ.withDensity f + ΞΌ.withDensity g := by |
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, Measure.add_apply, withDensity_apply _ hs, withDensity_apply _ hs,
β lintegral_add_left hf]
simp only [Pi.add_apply]
| [
" (fun s x => β«β» (a : Ξ±) in s, f a βΞΌ) β
β― = 0",
" β«β» (a : Ξ±) in s, f a βΞΌ β€ (ΞΌ.withDensity f) s",
" (ΞΌ.withDensity f) s = β«β» (a : Ξ±) in s, f a βΞΌ",
" (ΞΌ.withDensity f) s β€ β«β» (a : Ξ±) in s, f a βΞΌ",
" β«β» (a : Ξ±) in t, f a βΞΌ = β«β» (a : Ξ±) in s, f a βΞΌ",
" ΞΌ.restrict t = ΞΌ.restrict s",
" withDensity 0 f =... | [
" (fun s x => β«β» (a : Ξ±) in s, f a βΞΌ) β
β― = 0",
" β«β» (a : Ξ±) in s, f a βΞΌ β€ (ΞΌ.withDensity f) s",
" (ΞΌ.withDensity f) s = β«β» (a : Ξ±) in s, f a βΞΌ",
" (ΞΌ.withDensity f) s β€ β«β» (a : Ξ±) in s, f a βΞΌ",
" β«β» (a : Ξ±) in t, f a βΞΌ = β«β» (a : Ξ±) in s, f a βΞΌ",
" ΞΌ.restrict t = ΞΌ.restrict s",
" withDensity 0 f =... |
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.Topology.Algebra.Nonarchimedean.Bases
import Mathlib.Topology.Algebra.UniformRing
#align_import topology.algebra.nonarchimedean.adic_topology from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {R : Type*} [CommRing R]
open Set TopologicalAddGroup Submodule Filter
open Topology Pointwise
namespace Ideal
theorem adic_basis (I : Ideal R) : SubmodulesRingBasis fun n : β => (I ^ n β’ β€ : Ideal R) :=
{ inter := by
suffices β i j : β, β k, I ^ k β€ I ^ i β§ I ^ k β€ I ^ j by
simpa only [smul_eq_mul, mul_top, Algebra.id.map_eq_id, map_id, le_inf_iff] using this
intro i j
exact β¨max i j, pow_le_pow_right (le_max_left i j), pow_le_pow_right (le_max_right i j)β©
leftMul := by
suffices β (a : R) (i : β), β j : β, a β’ I ^ j β€ I ^ i by
simpa only [smul_top_eq_map, Algebra.id.map_eq_id, map_id] using this
intro r n
use n
rintro a β¨x, hx, rflβ©
exact (I ^ n).smul_mem r hx
mul := by
suffices β i : β, β j : β, (β(I ^ j) * β(I ^ j) : Set R) β (β(I ^ i) : Set R) by
simpa only [smul_top_eq_map, Algebra.id.map_eq_id, map_id] using this
intro n
use n
rintro a β¨x, _hx, b, hb, rflβ©
exact (I ^ n).smul_mem x hb }
#align ideal.adic_basis Ideal.adic_basis
def ringFilterBasis (I : Ideal R) :=
I.adic_basis.toRing_subgroups_basis.toRingFilterBasis
#align ideal.ring_filter_basis Ideal.ringFilterBasis
def adicTopology (I : Ideal R) : TopologicalSpace R :=
(adic_basis I).topology
#align ideal.adic_topology Ideal.adicTopology
theorem nonarchimedean (I : Ideal R) : @NonarchimedeanRing R _ I.adicTopology :=
I.adic_basis.toRing_subgroups_basis.nonarchimedean
#align ideal.nonarchimedean Ideal.nonarchimedean
theorem hasBasis_nhds_zero_adic (I : Ideal R) :
HasBasis (@nhds R I.adicTopology (0 : R)) (fun _n : β => True) fun n =>
((I ^ n : Ideal R) : Set R) :=
β¨by
intro U
rw [I.ringFilterBasis.toAddGroupFilterBasis.nhds_zero_hasBasis.mem_iff]
constructor
Β· rintro β¨-, β¨i, rflβ©, hβ©
replace h : β(I ^ i) β U := by simpa using h
exact β¨i, trivial, hβ©
Β· rintro β¨i, -, hβ©
exact β¨(I ^ i : Ideal R), β¨i, by simpβ©, hβ©β©
#align ideal.has_basis_nhds_zero_adic Ideal.hasBasis_nhds_zero_adic
theorem hasBasis_nhds_adic (I : Ideal R) (x : R) :
HasBasis (@nhds R I.adicTopology x) (fun _n : β => True) fun n =>
(fun y => x + y) '' (I ^ n : Ideal R) := by
letI := I.adicTopology
have := I.hasBasis_nhds_zero_adic.map fun y => x + y
rwa [map_add_left_nhds_zero x] at this
#align ideal.has_basis_nhds_adic Ideal.hasBasis_nhds_adic
variable (I : Ideal R) (M : Type*) [AddCommGroup M] [Module R M]
| Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean | 116 | 126 | theorem adic_module_basis :
I.ringFilterBasis.SubmodulesBasis fun n : β => I ^ n β’ (β€ : Submodule R M) :=
{ inter := fun i j =>
β¨max i j,
le_inf_iff.mpr
β¨smul_mono_left <| pow_le_pow_right (le_max_left i j),
smul_mono_left <| pow_le_pow_right (le_max_right i j)β©β©
smul := fun m i =>
β¨(I ^ i β’ β€ : Ideal R), β¨i, by simpβ©, fun a a_in => by
replace a_in : a β I ^ i := by | simpa [(I ^ i).mul_top] using a_in
exact smul_mem_smul a_in mem_topβ© }
| [
" β (i j : β), β k, I ^ k β’ β€ β€ I ^ i β’ β€ β I ^ j β’ β€",
" β (i j : β), β k, I ^ k β€ I ^ i β§ I ^ k β€ I ^ j",
" β k, I ^ k β€ I ^ i β§ I ^ k β€ I ^ j",
" β (a : R) (i : β), β j, a β’ I ^ j β’ β€ β€ I ^ i β’ β€",
" β (a : R) (i : β), β j, a β’ I ^ j β€ I ^ i",
" β j, r β’ I ^ j β€ I ^ n",
" r β’ I ^ n β€ I ^ n",
" (Dis... | [
" β (i j : β), β k, I ^ k β’ β€ β€ I ^ i β’ β€ β I ^ j β’ β€",
" β (i j : β), β k, I ^ k β€ I ^ i β§ I ^ k β€ I ^ j",
" β k, I ^ k β€ I ^ i β§ I ^ k β€ I ^ j",
" β (a : R) (i : β), β j, a β’ I ^ j β’ β€ β€ I ^ i β’ β€",
" β (a : R) (i : β), β j, a β’ I ^ j β€ I ^ i",
" β j, r β’ I ^ j β€ I ^ n",
" r β’ I ^ n β€ I ^ n",
" (Dis... |
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic
#align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
namespace MeasureTheory
open Filter
open scoped ENNReal
variable {Ξ± E : Type*} {m m0 : MeasurableSpace Ξ±} {p : ββ₯0β} {q : β} {ΞΌ : Measure Ξ±}
[NormedAddCommGroup E]
theorem snorm'_trim (hm : m β€ m0) {f : Ξ± β E} (hf : StronglyMeasurable[m] f) :
snorm' f q (ΞΌ.trim hm) = snorm' f q ΞΌ := by
simp_rw [snorm']
congr 1
refine lintegral_trim hm ?_
refine @Measurable.pow_const _ _ _ _ _ _ _ m _ (@Measurable.coe_nnreal_ennreal _ m _ ?_) q
apply @StronglyMeasurable.measurable
exact @StronglyMeasurable.nnnorm Ξ± m _ _ _ hf
#align measure_theory.snorm'_trim MeasureTheory.snorm'_trim
theorem limsup_trim (hm : m β€ m0) {f : Ξ± β ββ₯0β} (hf : Measurable[m] f) :
limsup f (ae (ΞΌ.trim hm)) = limsup f (ae ΞΌ) := by
simp_rw [limsup_eq]
suffices h_set_eq : { a : ββ₯0β | βα΅ n βΞΌ.trim hm, f n β€ a } = { a : ββ₯0β | βα΅ n βΞΌ, f n β€ a } by
rw [h_set_eq]
ext1 a
suffices h_meas_eq : ΞΌ { x | Β¬f x β€ a } = ΞΌ.trim hm { x | Β¬f x β€ a } by
simp_rw [Set.mem_setOf_eq, ae_iff, h_meas_eq]
refine (trim_measurableSet_eq hm ?_).symm
refine @MeasurableSet.compl _ _ m (@measurableSet_le ββ₯0β _ _ _ _ m _ _ _ _ _ hf ?_)
exact @measurable_const _ _ _ m _
#align measure_theory.limsup_trim MeasureTheory.limsup_trim
theorem essSup_trim (hm : m β€ m0) {f : Ξ± β ββ₯0β} (hf : Measurable[m] f) :
essSup f (ΞΌ.trim hm) = essSup f ΞΌ := by
simp_rw [essSup]
exact limsup_trim hm hf
#align measure_theory.ess_sup_trim MeasureTheory.essSup_trim
theorem snormEssSup_trim (hm : m β€ m0) {f : Ξ± β E} (hf : StronglyMeasurable[m] f) :
snormEssSup f (ΞΌ.trim hm) = snormEssSup f ΞΌ :=
essSup_trim _ (@StronglyMeasurable.ennnorm _ m _ _ _ hf)
#align measure_theory.snorm_ess_sup_trim MeasureTheory.snormEssSup_trim
theorem snorm_trim (hm : m β€ m0) {f : Ξ± β E} (hf : StronglyMeasurable[m] f) :
snorm f p (ΞΌ.trim hm) = snorm f p ΞΌ := by
by_cases h0 : p = 0
Β· simp [h0]
by_cases h_top : p = β
Β· simpa only [h_top, snorm_exponent_top] using snormEssSup_trim hm hf
simpa only [snorm_eq_snorm' h0 h_top] using snorm'_trim hm hf
#align measure_theory.snorm_trim MeasureTheory.snorm_trim
| Mathlib/MeasureTheory/Function/LpSeminorm/Trim.lean | 68 | 71 | theorem snorm_trim_ae (hm : m β€ m0) {f : Ξ± β E} (hf : AEStronglyMeasurable f (ΞΌ.trim hm)) :
snorm f p (ΞΌ.trim hm) = snorm f p ΞΌ := by |
rw [snorm_congr_ae hf.ae_eq_mk, snorm_congr_ae (ae_eq_of_ae_eq_trim hf.ae_eq_mk)]
exact snorm_trim hm hf.stronglyMeasurable_mk
| [
" snorm' f q (ΞΌ.trim hm) = snorm' f q ΞΌ",
" (β«β» (a : Ξ±), ββf aββ ^ q βΞΌ.trim hm) ^ (1 / q) = (β«β» (a : Ξ±), ββf aββ ^ q βΞΌ) ^ (1 / q)",
" β«β» (a : Ξ±), ββf aββ ^ q βΞΌ.trim hm = β«β» (a : Ξ±), ββf aββ ^ q βΞΌ",
" Measurable fun a => ββf aββ ^ q",
" Measurable fun a => βf aββ",
" StronglyMeasurable fun a => βf aββ"... | [
" snorm' f q (ΞΌ.trim hm) = snorm' f q ΞΌ",
" (β«β» (a : Ξ±), ββf aββ ^ q βΞΌ.trim hm) ^ (1 / q) = (β«β» (a : Ξ±), ββf aββ ^ q βΞΌ) ^ (1 / q)",
" β«β» (a : Ξ±), ββf aββ ^ q βΞΌ.trim hm = β«β» (a : Ξ±), ββf aββ ^ q βΞΌ",
" Measurable fun a => ββf aββ ^ q",
" Measurable fun a => βf aββ",
" StronglyMeasurable fun a => βf aββ"... |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Int.GCD
import Mathlib.RingTheory.Coprime.Basic
#align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
universe u v
section RelPrime
variable {Ξ± I} [CommMonoid Ξ±] [DecompositionMonoid Ξ±] {x y z : Ξ±} {s : I β Ξ±} {t : Finset I}
theorem IsRelPrime.prod_left : (β i β t, IsRelPrime (s i) x) β IsRelPrime (β i β t, s i) x := by
classical
refine Finset.induction_on t (fun _ β¦ isRelPrime_one_left) fun b t hbt ih H β¦ ?_
rw [Finset.prod_insert hbt]
rw [Finset.forall_mem_insert] at H
exact H.1.mul_left (ih H.2)
theorem IsRelPrime.prod_right : (β i β t, IsRelPrime x (s i)) β IsRelPrime x (β i β t, s i) := by
simpa only [isRelPrime_comm] using IsRelPrime.prod_left (Ξ± := Ξ±)
theorem IsRelPrime.prod_left_iff : IsRelPrime (β i β t, s i) x β β i β t, IsRelPrime (s i) x := by
classical
refine Finset.induction_on t (iff_of_true isRelPrime_one_left fun _ β¦ by simp) fun b t hbt ih β¦ ?_
rw [Finset.prod_insert hbt, IsRelPrime.mul_left_iff, ih, Finset.forall_mem_insert]
| Mathlib/RingTheory/Coprime/Lemmas.lean | 250 | 251 | theorem IsRelPrime.prod_right_iff : IsRelPrime x (β i β t, s i) β β i β t, IsRelPrime x (s i) := by |
simpa only [isRelPrime_comm] using IsRelPrime.prod_left_iff (Ξ± := Ξ±)
| [
" (β i β t, IsRelPrime (s i) x) β IsRelPrime (β i β t, s i) x",
" IsRelPrime (β i β insert b t, s i) x",
" IsRelPrime (s b * β x β t, s x) x",
" (β i β t, IsRelPrime x (s i)) β IsRelPrime x (β i β t, s i)",
" IsRelPrime (β i β t, s i) x β β i β t, IsRelPrime (s i) x",
" xβ β β
β IsRelPrime (s xβ) x",
" ... | [
" (β i β t, IsRelPrime (s i) x) β IsRelPrime (β i β t, s i) x",
" IsRelPrime (β i β insert b t, s i) x",
" IsRelPrime (s b * β x β t, s x) x",
" (β i β t, IsRelPrime x (s i)) β IsRelPrime x (β i β t, s i)",
" IsRelPrime (β i β t, s i) x β β i β t, IsRelPrime (s i) x",
" xβ β β
β IsRelPrime (s xβ) x",
" ... |
import Mathlib.Topology.MetricSpace.ProperSpace
import Mathlib.Topology.MetricSpace.Cauchy
open Set Filter Bornology
open scoped ENNReal Uniformity Topology Pointwise
universe u v w
variable {Ξ± : Type u} {Ξ² : Type v} {X ΞΉ : Type*}
variable [PseudoMetricSpace Ξ±]
namespace Metric
#align metric.bounded Bornology.IsBounded
section Bounded
variable {x : Ξ±} {s t : Set Ξ±} {r : β}
#noalign metric.bounded_iff_is_bounded
#align metric.bounded_empty Bornology.isBounded_empty
#align metric.bounded_iff_mem_bounded Bornology.isBounded_iff_forall_mem
#align metric.bounded.mono Bornology.IsBounded.subset
theorem isBounded_closedBall : IsBounded (closedBall x r) :=
isBounded_iff.2 β¨r + r, fun y hy z hz =>
calc dist y z β€ dist y x + dist z x := dist_triangle_right _ _ _
_ β€ r + r := add_le_add hy hzβ©
#align metric.bounded_closed_ball Metric.isBounded_closedBall
theorem isBounded_ball : IsBounded (ball x r) :=
isBounded_closedBall.subset ball_subset_closedBall
#align metric.bounded_ball Metric.isBounded_ball
theorem isBounded_sphere : IsBounded (sphere x r) :=
isBounded_closedBall.subset sphere_subset_closedBall
#align metric.bounded_sphere Metric.isBounded_sphere
theorem isBounded_iff_subset_closedBall (c : Ξ±) : IsBounded s β β r, s β closedBall c r :=
β¨fun h β¦ (isBounded_iff.1 (h.insert c)).imp fun _r hr _x hx β¦ hr (.inr hx) (mem_insert _ _),
fun β¨_r, hrβ© β¦ isBounded_closedBall.subset hrβ©
#align metric.bounded_iff_subset_ball Metric.isBounded_iff_subset_closedBall
theorem _root_.Bornology.IsBounded.subset_closedBall (h : IsBounded s) (c : Ξ±) :
β r, s β closedBall c r :=
(isBounded_iff_subset_closedBall c).1 h
#align metric.bounded.subset_ball Bornology.IsBounded.subset_closedBall
theorem _root_.Bornology.IsBounded.subset_ball_lt (h : IsBounded s) (a : β) (c : Ξ±) :
β r, a < r β§ s β ball c r :=
let β¨r, hrβ© := h.subset_closedBall c
β¨max r a + 1, (le_max_right _ _).trans_lt (lt_add_one _), hr.trans <| closedBall_subset_ball <|
(le_max_left _ _).trans_lt (lt_add_one _)β©
theorem _root_.Bornology.IsBounded.subset_ball (h : IsBounded s) (c : Ξ±) : β r, s β ball c r :=
(h.subset_ball_lt 0 c).imp fun _ β¦ And.right
theorem isBounded_iff_subset_ball (c : Ξ±) : IsBounded s β β r, s β ball c r :=
β¨(IsBounded.subset_ball Β· c), fun β¨_r, hrβ© β¦ isBounded_ball.subset hrβ©
theorem _root_.Bornology.IsBounded.subset_closedBall_lt (h : IsBounded s) (a : β) (c : Ξ±) :
β r, a < r β§ s β closedBall c r :=
let β¨r, har, hrβ© := h.subset_ball_lt a c
β¨r, har, hr.trans ball_subset_closedBallβ©
#align metric.bounded.subset_ball_lt Bornology.IsBounded.subset_closedBall_lt
theorem isBounded_closure_of_isBounded (h : IsBounded s) : IsBounded (closure s) :=
let β¨C, hβ© := isBounded_iff.1 h
isBounded_iff.2 β¨C, fun _a ha _b hb => isClosed_Iic.closure_subset <|
map_mem_closureβ continuous_dist ha hb hβ©
#align metric.bounded_closure_of_bounded Metric.isBounded_closure_of_isBounded
protected theorem _root_.Bornology.IsBounded.closure (h : IsBounded s) : IsBounded (closure s) :=
isBounded_closure_of_isBounded h
#align metric.bounded.closure Bornology.IsBounded.closure
@[simp]
theorem isBounded_closure_iff : IsBounded (closure s) β IsBounded s :=
β¨fun h => h.subset subset_closure, fun h => h.closureβ©
#align metric.bounded_closure_iff Metric.isBounded_closure_iff
#align metric.bounded_union Bornology.isBounded_union
#align metric.bounded.union Bornology.IsBounded.union
#align metric.bounded_bUnion Bornology.isBounded_biUnion
#align metric.bounded.prod Bornology.IsBounded.prod
theorem hasBasis_cobounded_compl_closedBall (c : Ξ±) :
(cobounded Ξ±).HasBasis (fun _ β¦ True) (fun r β¦ (closedBall c r)αΆ) :=
β¨compl_surjective.forall.2 fun _ β¦ (isBounded_iff_subset_closedBall c).trans <| by simpβ©
theorem hasBasis_cobounded_compl_ball (c : Ξ±) :
(cobounded Ξ±).HasBasis (fun _ β¦ True) (fun r β¦ (ball c r)αΆ) :=
β¨compl_surjective.forall.2 fun _ β¦ (isBounded_iff_subset_ball c).trans <| by simpβ©
@[simp]
theorem comap_dist_right_atTop (c : Ξ±) : comap (dist Β· c) atTop = cobounded Ξ± :=
(atTop_basis.comap _).eq_of_same_basis <| by
simpa only [compl_def, mem_ball, not_lt] using hasBasis_cobounded_compl_ball c
@[simp]
theorem comap_dist_left_atTop (c : Ξ±) : comap (dist c) atTop = cobounded Ξ± := by
simpa only [dist_comm _ c] using comap_dist_right_atTop c
@[simp]
| Mathlib/Topology/MetricSpace/Bounded.lean | 137 | 139 | theorem tendsto_dist_right_atTop_iff (c : Ξ±) {f : Ξ² β Ξ±} {l : Filter Ξ²} :
Tendsto (fun x β¦ dist (f x) c) l atTop β Tendsto f l (cobounded Ξ±) := by |
rw [β comap_dist_right_atTop c, tendsto_comap_iff, Function.comp_def]
| [
" (β r, xβ β closedBall c r) β β i, True β§ (closedBall c i)αΆ β xβαΆ",
" (β r, xβ β ball c r) β β i, True β§ (ball c i)αΆ β xβαΆ",
" (cobounded Ξ±).HasBasis (fun x => True) fun i => (fun x => dist x c) β»ΒΉ' Ici i",
" comap (dist c) atTop = cobounded Ξ±",
" Tendsto (fun x => dist (f x) c) l atTop β Tendsto f l (cobo... | [
" (β r, xβ β closedBall c r) β β i, True β§ (closedBall c i)αΆ β xβαΆ",
" (β r, xβ β ball c r) β β i, True β§ (ball c i)αΆ β xβαΆ",
" (cobounded Ξ±).HasBasis (fun x => True) fun i => (fun x => dist x c) β»ΒΉ' Ici i",
" comap (dist c) atTop = cobounded Ξ±",
" Tendsto (fun x => dist (f x) c) l atTop β Tendsto f l (cobo... |
import Mathlib.RingTheory.PowerSeries.Trunc
import Mathlib.RingTheory.PowerSeries.Inverse
import Mathlib.RingTheory.Derivation.Basic
namespace PowerSeries
open Polynomial Derivation Nat
section CommutativeSemiring
variable {R} [CommSemiring R]
noncomputable def derivativeFun (f : Rβ¦Xβ§) : Rβ¦Xβ§ := mk fun n β¦ coeff R (n + 1) f * (n + 1)
theorem coeff_derivativeFun (f : Rβ¦Xβ§) (n : β) :
coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by
rw [derivativeFun, coeff_mk]
theorem derivativeFun_coe (f : R[X]) : (f : Rβ¦Xβ§).derivativeFun = derivative f := by
ext
rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative]
theorem derivativeFun_add (f g : Rβ¦Xβ§) :
derivativeFun (f + g) = derivativeFun f + derivativeFun g := by
ext
rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun,
coeff_derivativeFun, add_mul]
theorem derivativeFun_C (r : R) : derivativeFun (C R r) = 0 := by
ext n
-- Note that `map_zero` didn't get picked up, apparently due to a missing `FunLike.coe`
rw [coeff_derivativeFun, coeff_succ_C, zero_mul, (coeff R n).map_zero]
theorem trunc_derivativeFun (f : Rβ¦Xβ§) (n : β) :
trunc n f.derivativeFun = derivative (trunc (n + 1) f) := by
ext d
rw [coeff_trunc]
split_ifs with h
Β· have : d + 1 < n + 1 := succ_lt_succ_iff.2 h
rw [coeff_derivativeFun, coeff_derivative, coeff_trunc, if_pos this]
Β· have : Β¬d + 1 < n + 1 := by rwa [succ_lt_succ_iff]
rw [coeff_derivative, coeff_trunc, if_neg this, zero_mul]
--A special case of `derivativeFun_mul`, used in its proof.
private theorem derivativeFun_coe_mul_coe (f g : R[X]) : derivativeFun (f * g : Rβ¦Xβ§) =
f * derivative g + g * derivative f := by
rw [β coe_mul, derivativeFun_coe, derivative_mul,
add_comm, mul_comm _ g, β coe_mul, β coe_mul, Polynomial.coe_add]
theorem derivativeFun_mul (f g : Rβ¦Xβ§) :
derivativeFun (f * g) = f β’ g.derivativeFun + g β’ f.derivativeFun := by
ext n
have hβ : n < n + 1 := lt_succ_self n
have hβ : n < n + 1 + 1 := Nat.lt_add_right _ hβ
rw [coeff_derivativeFun, map_add, coeff_mul_eq_coeff_trunc_mul_trunc _ _ (lt_succ_self _),
smul_eq_mul, smul_eq_mul, coeff_mul_eq_coeff_trunc_mul_truncβ g f.derivativeFun hβ hβ,
coeff_mul_eq_coeff_trunc_mul_truncβ f g.derivativeFun hβ hβ, trunc_derivativeFun,
trunc_derivativeFun, β map_add, β derivativeFun_coe_mul_coe, coeff_derivativeFun]
| Mathlib/RingTheory/PowerSeries/Derivative.lean | 87 | 88 | theorem derivativeFun_one : derivativeFun (1 : Rβ¦Xβ§) = 0 := by |
rw [β map_one (C R), derivativeFun_C (1 : R)]
| [
" (coeff R n) f.derivativeFun = (coeff R (n + 1)) f * (βn + 1)",
" (βf).derivativeFun = β(derivative f)",
" (coeff R nβ) (βf).derivativeFun = (coeff R nβ) β(derivative f)",
" (f + g).derivativeFun = f.derivativeFun + g.derivativeFun",
" (coeff R nβ) (f + g).derivativeFun = (coeff R nβ) (f.derivativeFun + g.... | [
" (coeff R n) f.derivativeFun = (coeff R (n + 1)) f * (βn + 1)",
" (βf).derivativeFun = β(derivative f)",
" (coeff R nβ) (βf).derivativeFun = (coeff R nβ) β(derivative f)",
" (f + g).derivativeFun = f.derivativeFun + g.derivativeFun",
" (coeff R nβ) (f + g).derivativeFun = (coeff R nβ) (f.derivativeFun + g.... |
import Mathlib.Init.Logic
import Mathlib.Tactic.AdaptationNote
import Mathlib.Tactic.Coe
set_option autoImplicit true
-- We align Lean 3 lemmas with lemmas in `Init.SimpLemmas` in Lean 4.
#align band_self Bool.and_self
#align band_tt Bool.and_true
#align band_ff Bool.and_false
#align tt_band Bool.true_and
#align ff_band Bool.false_and
#align bor_self Bool.or_self
#align bor_tt Bool.or_true
#align bor_ff Bool.or_false
#align tt_bor Bool.true_or
#align ff_bor Bool.false_or
#align bnot_bnot Bool.not_not
namespace Bool
#align bool.cond_tt Bool.cond_true
#align bool.cond_ff Bool.cond_false
#align cond_a_a Bool.cond_self
attribute [simp] xor_self
#align bxor_self Bool.xor_self
#align bxor_tt Bool.xor_true
#align bxor_ff Bool.xor_false
#align tt_bxor Bool.true_xor
#align ff_bxor Bool.false_xor
theorem true_eq_false_eq_False : Β¬true = false := by decide
#align tt_eq_ff_eq_false Bool.true_eq_false_eq_False
theorem false_eq_true_eq_False : Β¬false = true := by decide
#align ff_eq_tt_eq_false Bool.false_eq_true_eq_False
theorem eq_false_eq_not_eq_true (b : Bool) : (Β¬b = true) = (b = false) := by simp
#align eq_ff_eq_not_eq_tt Bool.eq_false_eq_not_eq_true
theorem eq_true_eq_not_eq_false (b : Bool) : (Β¬b = false) = (b = true) := by simp
#align eq_tt_eq_not_eq_ft Bool.eq_true_eq_not_eq_false
theorem eq_false_of_not_eq_true {b : Bool} : Β¬b = true β b = false :=
Eq.mp (eq_false_eq_not_eq_true b)
#align eq_ff_of_not_eq_tt Bool.eq_false_of_not_eq_true
theorem eq_true_of_not_eq_false {b : Bool} : Β¬b = false β b = true :=
Eq.mp (eq_true_eq_not_eq_false b)
#align eq_tt_of_not_eq_ff Bool.eq_true_of_not_eq_false
theorem and_eq_true_eq_eq_true_and_eq_true (a b : Bool) :
((a && b) = true) = (a = true β§ b = true) := by simp
#align band_eq_true_eq_eq_tt_and_eq_tt Bool.and_eq_true_eq_eq_true_and_eq_true
theorem or_eq_true_eq_eq_true_or_eq_true (a b : Bool) :
((a || b) = true) = (a = true β¨ b = true) := by simp
#align bor_eq_true_eq_eq_tt_or_eq_tt Bool.or_eq_true_eq_eq_true_or_eq_true
| Mathlib/Init/Data/Bool/Lemmas.lean | 76 | 76 | theorem not_eq_true_eq_eq_false (a : Bool) : (not a = true) = (a = false) := by | cases a <;> simp
| [
" Β¬true = false",
" Β¬false = true",
" (Β¬b = true) = (b = false)",
" (Β¬b = false) = (b = true)",
" ((a && b) = true) = (a = true β§ b = true)",
" ((a || b) = true) = (a = true β¨ b = true)",
" ((!a) = true) = (a = false)",
" ((!false) = true) = (false = false)",
" ((!true) = true) = (true = false)"
] | [
" Β¬true = false",
" Β¬false = true",
" (Β¬b = true) = (b = false)",
" (Β¬b = false) = (b = true)",
" ((a && b) = true) = (a = true β§ b = true)",
" ((a || b) = true) = (a = true β¨ b = true)",
" ((!a) = true) = (a = false)"
] |
import Mathlib.Geometry.Manifold.ContMDiff.Defs
open Set Filter Function
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 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 Composition
| Mathlib/Geometry/Manifold/ContMDiff/Basic.lean | 52 | 77 | theorem ContMDiffWithinAt.comp {t : Set M'} {g : M' β M''} (x : M)
(hg : ContMDiffWithinAt I' I'' n g t (f x)) (hf : ContMDiffWithinAt I I' n f s x)
(st : MapsTo f s t) : ContMDiffWithinAt I I'' n (g β f) s x := by |
rw [contMDiffWithinAt_iff] at hg hf β’
refine β¨hg.1.comp hf.1 st, ?_β©
set e := extChartAt I x
set e' := extChartAt I' (f x)
have : e' (f x) = (writtenInExtChartAt I I' x f) (e x) := by simp only [e, e', mfld_simps]
rw [this] at hg
have A : βαΆ y in π[e.symm β»ΒΉ' s β© range I] e x, f (e.symm y) β t β§ f (e.symm y) β e'.source := by
simp only [e, β map_extChartAt_nhdsWithin, eventually_map]
filter_upwards [hf.1.tendsto (extChartAt_source_mem_nhds I' (f x)),
inter_mem_nhdsWithin s (extChartAt_source_mem_nhds I x)]
rintro x' (hfx' : f x' β e'.source) β¨hx's, hx'β©
simp only [e.map_source hx', true_and_iff, e.left_inv hx', st hx's, *]
refine ((hg.2.comp _ (hf.2.mono inter_subset_right) inter_subset_left).mono_of_mem
(inter_mem ?_ self_mem_nhdsWithin)).congr_of_eventuallyEq ?_ ?_
Β· filter_upwards [A]
rintro x' β¨ht, hfx'β©
simp only [*, mem_preimage, writtenInExtChartAt, (Β· β Β·), mem_inter_iff, e'.left_inv,
true_and_iff]
exact mem_range_self _
Β· filter_upwards [A]
rintro x' β¨-, hfx'β©
simp only [*, (Β· β Β·), writtenInExtChartAt, e'.left_inv]
Β· simp only [e, e', writtenInExtChartAt, (Β· β Β·), mem_extChartAt_source, e.left_inv, e'.left_inv]
| [
" ContMDiffWithinAt I I'' n (g β f) s x",
" ContinuousWithinAt (g β f) s x β§\n ContDiffWithinAt π n (β(extChartAt I'' ((g β f) x)) β (g β f) β β(extChartAt I x).symm)\n (β(extChartAt I x).symm β»ΒΉ' s β© range βI) (β(extChartAt I x) x)",
" ContDiffWithinAt π n (β(extChartAt I'' ((g β f) x)) β (g β f) β β... | [
" ContMDiffWithinAt I I'' n (g β f) s x"
] |
import Mathlib.MeasureTheory.MeasurableSpace.Defs
import Mathlib.SetTheory.Cardinal.Cofinality
import Mathlib.SetTheory.Cardinal.Continuum
#align_import measure_theory.card_measurable_space from "leanprover-community/mathlib"@"f2b108e8e97ba393f22bf794989984ddcc1da89b"
universe u
variable {Ξ± : Type u}
open Cardinal Set
-- Porting note: fix universe below, not here
local notation "Οβ" => (WellOrder.Ξ± <| Quotient.out <| Cardinal.ord (aleph 1 : Cardinal))
namespace MeasurableSpace
def generateMeasurableRec (s : Set (Set Ξ±)) : (Οβ : Type u) β Set (Set Ξ±)
| i =>
let S := β j : Iio i, generateMeasurableRec s (j.1)
s βͺ {β
} βͺ compl '' S βͺ Set.range fun f : β β S => β n, (f n).1
termination_by i => i
decreasing_by exact j.2
#align measurable_space.generate_measurable_rec MeasurableSpace.generateMeasurableRec
theorem self_subset_generateMeasurableRec (s : Set (Set Ξ±)) (i : Οβ) :
s β generateMeasurableRec s i := by
unfold generateMeasurableRec
apply_rules [subset_union_of_subset_left]
exact subset_rfl
#align measurable_space.self_subset_generate_measurable_rec MeasurableSpace.self_subset_generateMeasurableRec
| Mathlib/MeasureTheory/MeasurableSpace/Card.lean | 62 | 65 | theorem empty_mem_generateMeasurableRec (s : Set (Set Ξ±)) (i : Οβ) :
β
β generateMeasurableRec s i := by |
unfold generateMeasurableRec
exact mem_union_left _ (mem_union_left _ (mem_union_right _ (mem_singleton β
)))
| [
" (invImage (fun x => x) (hasWellFoundedOut (aleph 1).ord)).1 (βj) aβ",
" s β generateMeasurableRec s i",
" s β\n let i := i;\n let S := β j, generateMeasurableRec s βj;\n s βͺ {β
} βͺ compl '' S βͺ range fun f => β n, β(f n)",
" s β s",
" β
β generateMeasurableRec s i",
" β
β\n let i := i;\n l... | [
" (invImage (fun x => x) (hasWellFoundedOut (aleph 1).ord)).1 (βj) aβ",
" s β generateMeasurableRec s i",
" s β\n let i := i;\n let S := β j, generateMeasurableRec s βj;\n s βͺ {β
} βͺ compl '' S βͺ range fun f => β n, β(f n)",
" s β s",
" β
β generateMeasurableRec s i"
] |
import Mathlib.Order.PartialSups
#align_import order.disjointed from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable {Ξ± Ξ² : Type*}
section GeneralizedBooleanAlgebra
variable [GeneralizedBooleanAlgebra Ξ±]
def disjointed (f : β β Ξ±) : β β Ξ±
| 0 => f 0
| n + 1 => f (n + 1) \ partialSups f n
#align disjointed disjointed
@[simp]
theorem disjointed_zero (f : β β Ξ±) : disjointed f 0 = f 0 :=
rfl
#align disjointed_zero disjointed_zero
theorem disjointed_succ (f : β β Ξ±) (n : β) : disjointed f (n + 1) = f (n + 1) \ partialSups f n :=
rfl
#align disjointed_succ disjointed_succ
theorem disjointed_le_id : disjointed β€ (id : (β β Ξ±) β β β Ξ±) := by
rintro f n
cases n
Β· rfl
Β· exact sdiff_le
#align disjointed_le_id disjointed_le_id
theorem disjointed_le (f : β β Ξ±) : disjointed f β€ f :=
disjointed_le_id f
#align disjointed_le disjointed_le
theorem disjoint_disjointed (f : β β Ξ±) : Pairwise (Disjoint on disjointed f) := by
refine (Symmetric.pairwise_on Disjoint.symm _).2 fun m n h => ?_
cases n
Β· exact (Nat.not_lt_zero _ h).elim
exact
disjoint_sdiff_self_right.mono_left
((disjointed_le f m).trans (le_partialSups_of_le f (Nat.lt_add_one_iff.1 h)))
#align disjoint_disjointed disjoint_disjointed
-- Porting note: `disjointedRec` had a change in universe level.
def disjointedRec {f : β β Ξ±} {p : Ξ± β Sort*} (hdiff : β β¦t iβ¦, p t β p (t \ f i)) :
β β¦nβ¦, p (f n) β p (disjointed f n)
| 0 => id
| n + 1 => fun h => by
suffices H : β k, p (f (n + 1) \ partialSups f k) from H n
rintro k
induction' k with k ih
Β· exact hdiff h
rw [partialSups_succ, β sdiff_sdiff_left]
exact hdiff ih
#align disjointed_rec disjointedRec
@[simp]
theorem disjointedRec_zero {f : β β Ξ±} {p : Ξ± β Sort*} (hdiff : β β¦t iβ¦, p t β p (t \ f i))
(hβ : p (f 0)) : disjointedRec hdiff hβ = hβ :=
rfl
#align disjointed_rec_zero disjointedRec_zero
-- TODO: Find a useful statement of `disjointedRec_succ`.
protected lemma Monotone.disjointed_succ {f : β β Ξ±} (hf : Monotone f) (n : β) :
disjointed f (n + 1) = f (n + 1) \ f n := by rw [disjointed_succ, hf.partialSups_eq]
#align monotone.disjointed_eq Monotone.disjointed_succ
protected lemma Monotone.disjointed_succ_sup {f : β β Ξ±} (hf : Monotone f) (n : β) :
disjointed f (n + 1) β f n = f (n + 1) := by
rw [hf.disjointed_succ, sdiff_sup_cancel]; exact hf n.le_succ
@[simp]
| Mathlib/Order/Disjointed.lean | 114 | 118 | theorem partialSups_disjointed (f : β β Ξ±) : partialSups (disjointed f) = partialSups f := by |
ext n
induction' n with k ih
Β· rw [partialSups_zero, partialSups_zero, disjointed_zero]
Β· rw [partialSups_succ, partialSups_succ, disjointed_succ, ih, sup_sdiff_self_right]
| [
" disjointed β€ id",
" disjointed f n β€ id f n",
" disjointed f 0 β€ id f 0",
" disjointed f (nβ + 1) β€ id f (nβ + 1)",
" Pairwise (Disjoint on disjointed f)",
" Disjoint (disjointed f m) (disjointed f n)",
" Disjoint (disjointed f m) (disjointed f 0)",
" Disjoint (disjointed f m) (disjointed f (nβ + 1)... | [
" disjointed β€ id",
" disjointed f n β€ id f n",
" disjointed f 0 β€ id f 0",
" disjointed f (nβ + 1) β€ id f (nβ + 1)",
" Pairwise (Disjoint on disjointed f)",
" Disjoint (disjointed f m) (disjointed f n)",
" Disjoint (disjointed f m) (disjointed f 0)",
" Disjoint (disjointed f m) (disjointed f (nβ + 1)... |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Complex.Circle
import Mathlib.Analysis.InnerProductSpace.l2Space
import Mathlib.MeasureTheory.Function.ContinuousMapDense
import Mathlib.MeasureTheory.Function.L2Space
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Integral.Periodic
import Mathlib.Topology.ContinuousFunction.StoneWeierstrass
import Mathlib.MeasureTheory.Integral.FundThmCalculus
#align_import analysis.fourier.add_circle from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
open scoped ENNReal ComplexConjugate Real
open TopologicalSpace ContinuousMap MeasureTheory MeasureTheory.Measure Algebra Submodule Set
variable {T : β}
open AddCircle
section Monomials
def fourier (n : β€) : C(AddCircle T, β) where
toFun x := toCircle (n β’ x :)
continuous_toFun := continuous_induced_dom.comp <| continuous_toCircle.comp <| continuous_zsmul _
#align fourier fourier
@[simp]
theorem fourier_apply {n : β€} {x : AddCircle T} : fourier n x = toCircle (n β’ x :) :=
rfl
#align fourier_apply fourier_apply
-- @[simp] -- Porting note: simp normal form is `fourier_coe_apply'`
theorem fourier_coe_apply {n : β€} {x : β} :
fourier n (x : AddCircle T) = Complex.exp (2 * Ο * Complex.I * n * x / T) := by
rw [fourier_apply, β QuotientAddGroup.mk_zsmul, toCircle, Function.Periodic.lift_coe,
expMapCircle_apply, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_mul, zsmul_eq_mul,
Complex.ofReal_mul, Complex.ofReal_intCast]
norm_num
congr 1; ring
#align fourier_coe_apply fourier_coe_apply
@[simp]
theorem fourier_coe_apply' {n : β€} {x : β} :
toCircle (n β’ (x : AddCircle T) :) = Complex.exp (2 * Ο * Complex.I * n * x / T) := by
rw [β fourier_apply]; exact fourier_coe_apply
-- @[simp] -- Porting note: simp normal form is `fourier_zero'`
| Mathlib/Analysis/Fourier/AddCircle.lean | 132 | 135 | theorem fourier_zero {x : AddCircle T} : fourier 0 x = 1 := by |
induction x using QuotientAddGroup.induction_on'
simp only [fourier_coe_apply]
norm_num
| [
" (fourier n) βx = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" (β2 * βΟ / βT * (βn * βx) * Complex.I).exp = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" (2 * βΟ / βT * (βn * βx) * Complex.I).exp = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" 2 * βΟ / βT * (βn * βx) * Complex.I = 2 * βΟ * Complex.I * βn * βx / β... | [
" (fourier n) βx = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" (β2 * βΟ / βT * (βn * βx) * Complex.I).exp = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" (2 * βΟ / βT * (βn * βx) * Complex.I).exp = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" 2 * βΟ / βT * (βn * βx) * Complex.I = 2 * βΟ * Complex.I * βn * βx / β... |
import Mathlib.MeasureTheory.Integral.Bochner
import Mathlib.MeasureTheory.Group.Measure
#align_import measure_theory.group.integration from "leanprover-community/mathlib"@"ec247d43814751ffceb33b758e8820df2372bf6f"
namespace MeasureTheory
open Measure TopologicalSpace
open scoped ENNReal
variable {π M Ξ± G E F : Type*} [MeasurableSpace G]
variable [NormedAddCommGroup E] [NormedSpace β E] [CompleteSpace E] [NormedAddCommGroup F]
variable {ΞΌ : Measure G} {f : G β E} {g : G}
section MeasurableInv
variable [Group G] [MeasurableInv G]
@[to_additive]
theorem Integrable.comp_inv [IsInvInvariant ΞΌ] {f : G β F} (hf : Integrable f ΞΌ) :
Integrable (fun t => f tβ»ΒΉ) ΞΌ :=
(hf.mono_measure (map_inv_eq_self ΞΌ).le).comp_measurable measurable_inv
#align measure_theory.integrable.comp_inv MeasureTheory.Integrable.comp_inv
#align measure_theory.integrable.comp_neg MeasureTheory.Integrable.comp_neg
@[to_additive]
| Mathlib/MeasureTheory/Group/Integral.lean | 40 | 43 | theorem integral_inv_eq_self (f : G β E) (ΞΌ : Measure G) [IsInvInvariant ΞΌ] :
β« x, f xβ»ΒΉ βΞΌ = β« x, f x βΞΌ := by |
have h : MeasurableEmbedding fun x : G => xβ»ΒΉ := (MeasurableEquiv.inv G).measurableEmbedding
rw [β h.integral_map, map_inv_eq_self]
| [
" β« (x : G), f xβ»ΒΉ βΞΌ = β« (x : G), f x βΞΌ"
] | [
" β« (x : G), f xβ»ΒΉ βΞΌ = β« (x : G), f x βΞΌ"
] |
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Analysis.NormedSpace.LinearIsometry
#align_import analysis.normed_space.conformal_linear_map from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1"
noncomputable section
open Function LinearIsometry ContinuousLinearMap
def IsConformalMap {R : Type*} {X Y : Type*} [NormedField R] [SeminormedAddCommGroup X]
[SeminormedAddCommGroup Y] [NormedSpace R X] [NormedSpace R Y] (f' : X βL[R] Y) :=
β c β (0 : R), β li : X ββα΅’[R] Y, f' = c β’ li.toContinuousLinearMap
#align is_conformal_map IsConformalMap
variable {R M N G M' : Type*} [NormedField R] [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
[SeminormedAddCommGroup G] [NormedSpace R M] [NormedSpace R N] [NormedSpace R G]
[NormedAddCommGroup M'] [NormedSpace R M'] {f : M βL[R] N} {g : N βL[R] G} {c : R}
theorem isConformalMap_id : IsConformalMap (id R M) :=
β¨1, one_ne_zero, id, by simpβ©
#align is_conformal_map_id isConformalMap_id
theorem IsConformalMap.smul (hf : IsConformalMap f) {c : R} (hc : c β 0) :
IsConformalMap (c β’ f) := by
rcases hf with β¨c', hc', li, rflβ©
exact β¨c * c', mul_ne_zero hc hc', li, smul_smul _ _ _β©
#align is_conformal_map.smul IsConformalMap.smul
theorem isConformalMap_const_smul (hc : c β 0) : IsConformalMap (c β’ id R M) :=
isConformalMap_id.smul hc
#align is_conformal_map_const_smul isConformalMap_const_smul
protected theorem LinearIsometry.isConformalMap (f' : M ββα΅’[R] N) :
IsConformalMap f'.toContinuousLinearMap :=
β¨1, one_ne_zero, f', (one_smul _ _).symmβ©
#align linear_isometry.is_conformal_map LinearIsometry.isConformalMap
@[nontriviality]
theorem isConformalMap_of_subsingleton [Subsingleton M] (f' : M βL[R] N) : IsConformalMap f' :=
β¨1, one_ne_zero, β¨0, fun x => by simp [Subsingleton.elim x 0]β©, Subsingleton.elim _ _β©
#align is_conformal_map_of_subsingleton isConformalMap_of_subsingleton
namespace IsConformalMap
theorem comp (hg : IsConformalMap g) (hf : IsConformalMap f) : IsConformalMap (g.comp f) := by
rcases hf with β¨cf, hcf, lif, rflβ©
rcases hg with β¨cg, hcg, lig, rflβ©
refine β¨cg * cf, mul_ne_zero hcg hcf, lig.comp lif, ?_β©
rw [smul_comp, comp_smul, mul_smul]
rfl
#align is_conformal_map.comp IsConformalMap.comp
protected theorem injective {f : M' βL[R] N} (h : IsConformalMap f) : Function.Injective f := by
rcases h with β¨c, hc, li, rflβ©
exact (smul_right_injective _ hc).comp li.injective
#align is_conformal_map.injective IsConformalMap.injective
| Mathlib/Analysis/NormedSpace/ConformalLinearMap.lean | 97 | 100 | theorem ne_zero [Nontrivial M'] {f' : M' βL[R] N} (hf' : IsConformalMap f') : f' β 0 := by |
rintro rfl
rcases exists_ne (0 : M') with β¨a, haβ©
exact ha (hf'.injective rfl)
| [
" ContinuousLinearMap.id R M = 1 β’ LinearIsometry.id.toContinuousLinearMap",
" IsConformalMap (c β’ f)",
" IsConformalMap (c β’ c' β’ li.toContinuousLinearMap)",
" β0 xβ = βxβ",
" IsConformalMap (g.comp f)",
" IsConformalMap (g.comp (cf β’ lif.toContinuousLinearMap))",
" IsConformalMap ((cg β’ lig.toContinuo... | [
" ContinuousLinearMap.id R M = 1 β’ LinearIsometry.id.toContinuousLinearMap",
" IsConformalMap (c β’ f)",
" IsConformalMap (c β’ c' β’ li.toContinuousLinearMap)",
" β0 xβ = βxβ",
" IsConformalMap (g.comp f)",
" IsConformalMap (g.comp (cf β’ lif.toContinuousLinearMap))",
" IsConformalMap ((cg β’ lig.toContinuo... |
import Mathlib.Order.MinMax
import Mathlib.Data.Set.Subsingleton
import Mathlib.Tactic.Says
#align_import data.set.intervals.basic from "leanprover-community/mathlib"@"3ba15165bd6927679be7c22d6091a87337e3cd0c"
open Function
open OrderDual (toDual ofDual)
variable {Ξ± Ξ² : Type*}
namespace Set
section Preorder
variable [Preorder Ξ±] {a aβ aβ b bβ bβ c x : Ξ±}
def Ioo (a b : Ξ±) :=
{ x | a < x β§ x < b }
#align set.Ioo Set.Ioo
def Ico (a b : Ξ±) :=
{ x | a β€ x β§ x < b }
#align set.Ico Set.Ico
def Iio (a : Ξ±) :=
{ x | x < a }
#align set.Iio Set.Iio
def Icc (a b : Ξ±) :=
{ x | a β€ x β§ x β€ b }
#align set.Icc Set.Icc
def Iic (b : Ξ±) :=
{ x | x β€ b }
#align set.Iic Set.Iic
def Ioc (a b : Ξ±) :=
{ x | a < x β§ x β€ b }
#align set.Ioc Set.Ioc
def Ici (a : Ξ±) :=
{ x | a β€ x }
#align set.Ici Set.Ici
def Ioi (a : Ξ±) :=
{ x | a < x }
#align set.Ioi Set.Ioi
theorem Ioo_def (a b : Ξ±) : { x | a < x β§ x < b } = Ioo a b :=
rfl
#align set.Ioo_def Set.Ioo_def
theorem Ico_def (a b : Ξ±) : { x | a β€ x β§ x < b } = Ico a b :=
rfl
#align set.Ico_def Set.Ico_def
theorem Iio_def (a : Ξ±) : { x | x < a } = Iio a :=
rfl
#align set.Iio_def Set.Iio_def
theorem Icc_def (a b : Ξ±) : { x | a β€ x β§ x β€ b } = Icc a b :=
rfl
#align set.Icc_def Set.Icc_def
theorem Iic_def (b : Ξ±) : { x | x β€ b } = Iic b :=
rfl
#align set.Iic_def Set.Iic_def
theorem Ioc_def (a b : Ξ±) : { x | a < x β§ x β€ b } = Ioc a b :=
rfl
#align set.Ioc_def Set.Ioc_def
theorem Ici_def (a : Ξ±) : { x | a β€ x } = Ici a :=
rfl
#align set.Ici_def Set.Ici_def
theorem Ioi_def (a : Ξ±) : { x | a < x } = Ioi a :=
rfl
#align set.Ioi_def Set.Ioi_def
@[simp]
theorem mem_Ioo : x β Ioo a b β a < x β§ x < b :=
Iff.rfl
#align set.mem_Ioo Set.mem_Ioo
@[simp]
theorem mem_Ico : x β Ico a b β a β€ x β§ x < b :=
Iff.rfl
#align set.mem_Ico Set.mem_Ico
@[simp]
theorem mem_Iio : x β Iio b β x < b :=
Iff.rfl
#align set.mem_Iio Set.mem_Iio
@[simp]
theorem mem_Icc : x β Icc a b β a β€ x β§ x β€ b :=
Iff.rfl
#align set.mem_Icc Set.mem_Icc
@[simp]
theorem mem_Iic : x β Iic b β x β€ b :=
Iff.rfl
#align set.mem_Iic Set.mem_Iic
@[simp]
theorem mem_Ioc : x β Ioc a b β a < x β§ x β€ b :=
Iff.rfl
#align set.mem_Ioc Set.mem_Ioc
@[simp]
theorem mem_Ici : x β Ici a β a β€ x :=
Iff.rfl
#align set.mem_Ici Set.mem_Ici
@[simp]
theorem mem_Ioi : x β Ioi a β a < x :=
Iff.rfl
#align set.mem_Ioi Set.mem_Ioi
instance decidableMemIoo [Decidable (a < x β§ x < b)] : Decidable (x β Ioo a b) := by assumption
#align set.decidable_mem_Ioo Set.decidableMemIoo
instance decidableMemIco [Decidable (a β€ x β§ x < b)] : Decidable (x β Ico a b) := by assumption
#align set.decidable_mem_Ico Set.decidableMemIco
instance decidableMemIio [Decidable (x < b)] : Decidable (x β Iio b) := by assumption
#align set.decidable_mem_Iio Set.decidableMemIio
instance decidableMemIcc [Decidable (a β€ x β§ x β€ b)] : Decidable (x β Icc a b) := by assumption
#align set.decidable_mem_Icc Set.decidableMemIcc
instance decidableMemIic [Decidable (x β€ b)] : Decidable (x β Iic b) := by assumption
#align set.decidable_mem_Iic Set.decidableMemIic
instance decidableMemIoc [Decidable (a < x β§ x β€ b)] : Decidable (x β Ioc a b) := by assumption
#align set.decidable_mem_Ioc Set.decidableMemIoc
instance decidableMemIci [Decidable (a β€ x)] : Decidable (x β Ici a) := by assumption
#align set.decidable_mem_Ici Set.decidableMemIci
instance decidableMemIoi [Decidable (a < x)] : Decidable (x β Ioi a) := by assumption
#align set.decidable_mem_Ioi Set.decidableMemIoi
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem left_mem_Ioo : a β Ioo a b β False := by simp [lt_irrefl]
#align set.left_mem_Ioo Set.left_mem_Ioo
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem left_mem_Ico : a β Ico a b β a < b := by simp [le_refl]
#align set.left_mem_Ico Set.left_mem_Ico
-- Porting note (#10618): `simp` can prove this
-- @[simp]
| Mathlib/Order/Interval/Set/Basic.lean | 191 | 191 | theorem left_mem_Icc : a β Icc a b β a β€ b := by | simp [le_refl]
| [
" Decidable (x β Ioo a b)",
" Decidable (x β Ico a b)",
" Decidable (x β Iio b)",
" Decidable (x β Icc a b)",
" Decidable (x β Iic b)",
" Decidable (x β Ioc a b)",
" Decidable (x β Ici a)",
" Decidable (x β Ioi a)",
" a β Ioo a b β False",
" a β Ico a b β a < b",
" a β Icc a b β a β€ b"
] | [
" Decidable (x β Ioo a b)",
" Decidable (x β Ico a b)",
" Decidable (x β Iio b)",
" Decidable (x β Icc a b)",
" Decidable (x β Iic b)",
" Decidable (x β Ioc a b)",
" Decidable (x β Ici a)",
" Decidable (x β Ioi a)",
" a β Ioo a b β False",
" a β Ico a b β a < b",
" a β Icc a b β a β€ b"
] |
import Mathlib.RingTheory.WittVector.Frobenius
import Mathlib.RingTheory.WittVector.Verschiebung
import Mathlib.RingTheory.WittVector.MulP
#align_import ring_theory.witt_vector.identities from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
namespace WittVector
variable {p : β} {R : Type*} [hp : Fact p.Prime] [CommRing R]
-- type as `\bbW`
local notation "π" => WittVector p
noncomputable section
-- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added.
theorem frobenius_verschiebung (x : π R) : frobenius (verschiebung x) = x * p := by
have : IsPoly p fun {R} [CommRing R] x β¦ frobenius (verschiebung x) :=
IsPoly.comp (hg := frobenius_isPoly p) (hf := verschiebung_isPoly)
have : IsPoly p fun {R} [CommRing R] x β¦ x * p := mulN_isPoly p p
ghost_calc x
ghost_simp [mul_comm]
#align witt_vector.frobenius_verschiebung WittVector.frobenius_verschiebung
theorem verschiebung_zmod (x : π (ZMod p)) : verschiebung x = x * p := by
rw [β frobenius_verschiebung, frobenius_zmodp]
#align witt_vector.verschiebung_zmod WittVector.verschiebung_zmod
variable (p R)
theorem coeff_p_pow [CharP R p] (i : β) : ((p : π R) ^ i).coeff i = 1 := by
induction' i with i h
Β· simp only [Nat.zero_eq, one_coeff_zero, Ne, pow_zero]
Β· rw [pow_succ, β frobenius_verschiebung, coeff_frobenius_charP,
verschiebung_coeff_succ, h, one_pow]
#align witt_vector.coeff_p_pow WittVector.coeff_p_pow
theorem coeff_p_pow_eq_zero [CharP R p] {i j : β} (hj : j β i) : ((p : π R) ^ i).coeff j = 0 := by
induction' i with i hi generalizing j
Β· rw [pow_zero, one_coeff_eq_of_pos]
exact Nat.pos_of_ne_zero hj
Β· rw [pow_succ, β frobenius_verschiebung, coeff_frobenius_charP]
cases j
Β· rw [verschiebung_coeff_zero, zero_pow hp.out.ne_zero]
Β· rw [verschiebung_coeff_succ, hi (ne_of_apply_ne _ hj), zero_pow hp.out.ne_zero]
#align witt_vector.coeff_p_pow_eq_zero WittVector.coeff_p_pow_eq_zero
theorem coeff_p [CharP R p] (i : β) : (p : π R).coeff i = if i = 1 then 1 else 0 := by
split_ifs with hi
Β· simpa only [hi, pow_one] using coeff_p_pow p R 1
Β· simpa only [pow_one] using coeff_p_pow_eq_zero p R hi
#align witt_vector.coeff_p WittVector.coeff_p
@[simp]
theorem coeff_p_zero [CharP R p] : (p : π R).coeff 0 = 0 := by
rw [coeff_p, if_neg]
exact zero_ne_one
#align witt_vector.coeff_p_zero WittVector.coeff_p_zero
@[simp]
| Mathlib/RingTheory/WittVector/Identities.lean | 87 | 87 | theorem coeff_p_one [CharP R p] : (p : π R).coeff 1 = 1 := by | rw [coeff_p, if_pos rfl]
| [
" frobenius (verschiebung x) = x * βp",
" β (n : β), (ghostComponent n) (frobenius (verschiebung x)) = (ghostComponent n) (x * βp)",
" verschiebung x = x * βp",
" (βp ^ i).coeff i = 1",
" (βp ^ 0).coeff 0 = 1",
" (βp ^ (i + 1)).coeff (i + 1) = 1",
" (βp ^ i).coeff j = 0",
" (βp ^ 0).coeff j = 0",
" ... | [
" frobenius (verschiebung x) = x * βp",
" β (n : β), (ghostComponent n) (frobenius (verschiebung x)) = (ghostComponent n) (x * βp)",
" verschiebung x = x * βp",
" (βp ^ i).coeff i = 1",
" (βp ^ 0).coeff 0 = 1",
" (βp ^ (i + 1)).coeff (i + 1) = 1",
" (βp ^ i).coeff j = 0",
" (βp ^ 0).coeff j = 0",
" ... |
import Mathlib.Topology.MetricSpace.HausdorffDistance
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
#align_import measure_theory.measure.regular from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
open Set Filter ENNReal Topology NNReal TopologicalSpace
namespace MeasureTheory
namespace Measure
def InnerRegularWRT {Ξ±} {_ : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (p q : Set Ξ± β Prop) :=
β β¦Uβ¦, q U β β r < ΞΌ U, β K, K β U β§ p K β§ r < ΞΌ K
#align measure_theory.measure.inner_regular MeasureTheory.Measure.InnerRegularWRT
namespace InnerRegularWRT
variable {Ξ± : Type*} {m : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±} {p q : Set Ξ± β Prop} {U : Set Ξ±}
{Ξ΅ : ββ₯0β}
theorem measure_eq_iSup (H : InnerRegularWRT ΞΌ p q) (hU : q U) :
ΞΌ U = β¨ (K) (_ : K β U) (_ : p K), ΞΌ K := by
refine
le_antisymm (le_of_forall_lt fun r hr => ?_) (iSupβ_le fun K hK => iSup_le fun _ => ΞΌ.mono hK)
simpa only [lt_iSup_iff, exists_prop] using H hU r hr
#align measure_theory.measure.inner_regular.measure_eq_supr MeasureTheory.Measure.InnerRegularWRT.measure_eq_iSup
theorem exists_subset_lt_add (H : InnerRegularWRT ΞΌ p q) (h0 : p β
) (hU : q U) (hΞΌU : ΞΌ U β β)
(hΞ΅ : Ξ΅ β 0) : β K, K β U β§ p K β§ ΞΌ U < ΞΌ K + Ξ΅ := by
rcases eq_or_ne (ΞΌ U) 0 with hβ | hβ
Β· refine β¨β
, empty_subset _, h0, ?_β©
rwa [measure_empty, hβ, zero_add, pos_iff_ne_zero]
Β· rcases H hU _ (ENNReal.sub_lt_self hΞΌU hβ hΞ΅) with β¨K, hKU, hKc, hrKβ©
exact β¨K, hKU, hKc, ENNReal.lt_add_of_sub_lt_right (Or.inl hΞΌU) hrKβ©
#align measure_theory.measure.inner_regular.exists_subset_lt_add MeasureTheory.Measure.InnerRegularWRT.exists_subset_lt_add
protected theorem map {Ξ± Ξ²} [MeasurableSpace Ξ±] [MeasurableSpace Ξ²]
{ΞΌ : Measure Ξ±} {pa qa : Set Ξ± β Prop}
(H : InnerRegularWRT ΞΌ pa qa) {f : Ξ± β Ξ²} (hf : AEMeasurable f ΞΌ) {pb qb : Set Ξ² β Prop}
(hAB : β U, qb U β qa (f β»ΒΉ' U)) (hAB' : β K, pa K β pb (f '' K))
(hBβ : β U, qb U β MeasurableSet U) :
InnerRegularWRT (map f ΞΌ) pb qb := by
intro U hU r hr
rw [map_apply_of_aemeasurable hf (hBβ _ hU)] at hr
rcases H (hAB U hU) r hr with β¨K, hKU, hKc, hKβ©
refine β¨f '' K, image_subset_iff.2 hKU, hAB' _ hKc, ?_β©
exact hK.trans_le (le_map_apply_image hf _)
#align measure_theory.measure.inner_regular.map MeasureTheory.Measure.InnerRegularWRT.map
| Mathlib/MeasureTheory/Measure/Regular.lean | 244 | 252 | theorem map' {Ξ± Ξ²} [MeasurableSpace Ξ±] [MeasurableSpace Ξ²] {ΞΌ : Measure Ξ±} {pa qa : Set Ξ± β Prop}
(H : InnerRegularWRT ΞΌ pa qa) (f : Ξ± βα΅ Ξ²) {pb qb : Set Ξ² β Prop}
(hAB : β U, qb U β qa (f β»ΒΉ' U)) (hAB' : β K, pa K β pb (f '' K)) :
InnerRegularWRT (map f ΞΌ) pb qb := by |
intro U hU r hr
rw [f.map_apply U] at hr
rcases H (hAB U hU) r hr with β¨K, hKU, hKc, hKβ©
refine β¨f '' K, image_subset_iff.2 hKU, hAB' _ hKc, ?_β©
rwa [f.map_apply, f.preimage_image]
| [
" ΞΌ U = β¨ K, β¨ (_ : K β U), β¨ (_ : p K), ΞΌ K",
" r < β¨ K, β¨ (_ : K β U), β¨ (_ : p K), ΞΌ K",
" β K β U, p K β§ ΞΌ U < ΞΌ K + Ξ΅",
" ΞΌ U < ΞΌ β
+ Ξ΅",
" (map f ΞΌ).InnerRegularWRT pb qb",
" β K β U, pb K β§ r < (map f ΞΌ) K",
" r < (map f ΞΌ) (f '' K)",
" (map (βf) ΞΌ).InnerRegularWRT pb qb",
" β K β U, pb K β§ r... | [
" ΞΌ U = β¨ K, β¨ (_ : K β U), β¨ (_ : p K), ΞΌ K",
" r < β¨ K, β¨ (_ : K β U), β¨ (_ : p K), ΞΌ K",
" β K β U, p K β§ ΞΌ U < ΞΌ K + Ξ΅",
" ΞΌ U < ΞΌ β
+ Ξ΅",
" (map f ΞΌ).InnerRegularWRT pb qb",
" β K β U, pb K β§ r < (map f ΞΌ) K",
" r < (map f ΞΌ) (f '' K)",
" (map (βf) ΞΌ).InnerRegularWRT pb qb"
] |
import Mathlib.RingTheory.WittVector.Frobenius
import Mathlib.RingTheory.WittVector.Verschiebung
import Mathlib.RingTheory.WittVector.MulP
#align_import ring_theory.witt_vector.identities from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
namespace WittVector
variable {p : β} {R : Type*} [hp : Fact p.Prime] [CommRing R]
-- type as `\bbW`
local notation "π" => WittVector p
noncomputable section
-- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added.
| Mathlib/RingTheory/WittVector/Identities.lean | 42 | 47 | theorem frobenius_verschiebung (x : π R) : frobenius (verschiebung x) = x * p := by |
have : IsPoly p fun {R} [CommRing R] x β¦ frobenius (verschiebung x) :=
IsPoly.comp (hg := frobenius_isPoly p) (hf := verschiebung_isPoly)
have : IsPoly p fun {R} [CommRing R] x β¦ x * p := mulN_isPoly p p
ghost_calc x
ghost_simp [mul_comm]
| [
" frobenius (verschiebung x) = x * βp",
" β (n : β), (ghostComponent n) (frobenius (verschiebung x)) = (ghostComponent n) (x * βp)"
] | [
" frobenius (verschiebung x) = x * βp"
] |
import Mathlib.Data.Rat.Cast.Defs
import Mathlib.Algebra.Field.Basic
#align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
namespace Rat
variable {Ξ± : Type*} [DivisionRing Ξ±]
-- Porting note: rewrote proof
@[simp]
theorem cast_inv_nat (n : β) : ((nβ»ΒΉ : β) : Ξ±) = (n : Ξ±)β»ΒΉ := by
cases' n with n
Β· simp
rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero,
Int.sign_eq_one_of_pos (Nat.cast_pos.mpr n.succ_pos), Int.cast_one, one_div]
#align rat.cast_inv_nat Rat.cast_inv_nat
-- Porting note: proof got a lot easier - is this still the intended statement?
@[simp]
| Mathlib/Data/Rat/Cast/Lemmas.lean | 37 | 40 | theorem cast_inv_int (n : β€) : ((nβ»ΒΉ : β) : Ξ±) = (n : Ξ±)β»ΒΉ := by |
cases' n with n n
Β· simp [ofInt_eq_cast, cast_inv_nat]
Β· simp only [ofInt_eq_cast, Int.cast_negSucc, β Nat.cast_succ, cast_neg, inv_neg, cast_inv_nat]
| [
" β(βn)β»ΒΉ = (βn)β»ΒΉ",
" β(β0)β»ΒΉ = (β0)β»ΒΉ",
" β(β(n + 1))β»ΒΉ = (β(n + 1))β»ΒΉ",
" β(β(Int.ofNat n))β»ΒΉ = (β(Int.ofNat n))β»ΒΉ",
" β(β(Int.negSucc n))β»ΒΉ = (β(Int.negSucc n))β»ΒΉ"
] | [
" β(βn)β»ΒΉ = (βn)β»ΒΉ",
" β(β0)β»ΒΉ = (β0)β»ΒΉ",
" β(β(n + 1))β»ΒΉ = (β(n + 1))β»ΒΉ"
] |
import Mathlib.Data.Fin.VecNotation
import Mathlib.Logic.Embedding.Set
#align_import logic.equiv.fin from "leanprover-community/mathlib"@"bd835ef554f37ef9b804f0903089211f89cb370b"
assert_not_exists MonoidWithZero
universe u
variable {m n : β}
def finZeroEquiv : Fin 0 β Empty :=
Equiv.equivEmpty _
#align fin_zero_equiv finZeroEquiv
def finZeroEquiv' : Fin 0 β PEmpty.{u} :=
Equiv.equivPEmpty _
#align fin_zero_equiv' finZeroEquiv'
def finOneEquiv : Fin 1 β Unit :=
Equiv.equivPUnit _
#align fin_one_equiv finOneEquiv
def finTwoEquiv : Fin 2 β Bool where
toFun := ![false, true]
invFun b := b.casesOn 0 1
left_inv := Fin.forall_fin_two.2 <| by simp
right_inv := Bool.forall_bool.2 <| by simp
#align fin_two_equiv finTwoEquiv
@[simps (config := .asFn)]
def piFinTwoEquiv (Ξ± : Fin 2 β Type u) : (β i, Ξ± i) β Ξ± 0 Γ Ξ± 1 where
toFun f := (f 0, f 1)
invFun p := Fin.cons p.1 <| Fin.cons p.2 finZeroElim
left_inv _ := funext <| Fin.forall_fin_two.2 β¨rfl, rflβ©
right_inv := fun _ => rfl
#align pi_fin_two_equiv piFinTwoEquiv
#align pi_fin_two_equiv_symm_apply piFinTwoEquiv_symm_apply
#align pi_fin_two_equiv_apply piFinTwoEquiv_apply
theorem Fin.preimage_apply_01_prod {Ξ± : Fin 2 β Type u} (s : Set (Ξ± 0)) (t : Set (Ξ± 1)) :
(fun f : β i, Ξ± i => (f 0, f 1)) β»ΒΉ' s ΓΛ’ t =
Set.pi Set.univ (Fin.cons s <| Fin.cons t finZeroElim) := by
ext f
simp [Fin.forall_fin_two]
#align fin.preimage_apply_01_prod Fin.preimage_apply_01_prod
theorem Fin.preimage_apply_01_prod' {Ξ± : Type u} (s t : Set Ξ±) :
(fun f : Fin 2 β Ξ± => (f 0, f 1)) β»ΒΉ' s ΓΛ’ t = Set.pi Set.univ ![s, t] :=
@Fin.preimage_apply_01_prod (fun _ => Ξ±) s t
#align fin.preimage_apply_01_prod' Fin.preimage_apply_01_prod'
@[simps! (config := .asFn)]
def prodEquivPiFinTwo (Ξ± Ξ² : Type u) : Ξ± Γ Ξ² β β i : Fin 2, ![Ξ±, Ξ²] i :=
(piFinTwoEquiv (Fin.cons Ξ± (Fin.cons Ξ² finZeroElim))).symm
#align prod_equiv_pi_fin_two prodEquivPiFinTwo
#align prod_equiv_pi_fin_two_apply prodEquivPiFinTwo_apply
#align prod_equiv_pi_fin_two_symm_apply prodEquivPiFinTwo_symm_apply
@[simps (config := .asFn)]
def finTwoArrowEquiv (Ξ± : Type*) : (Fin 2 β Ξ±) β Ξ± Γ Ξ± :=
{ piFinTwoEquiv fun _ => Ξ± with invFun := fun x => ![x.1, x.2] }
#align fin_two_arrow_equiv finTwoArrowEquiv
#align fin_two_arrow_equiv_symm_apply finTwoArrowEquiv_symm_apply
#align fin_two_arrow_equiv_apply finTwoArrowEquiv_apply
def OrderIso.piFinTwoIso (Ξ± : Fin 2 β Type u) [β i, Preorder (Ξ± i)] : (β i, Ξ± i) βo Ξ± 0 Γ Ξ± 1 where
toEquiv := piFinTwoEquiv Ξ±
map_rel_iff' := Iff.symm Fin.forall_fin_two
#align order_iso.pi_fin_two_iso OrderIso.piFinTwoIso
def OrderIso.finTwoArrowIso (Ξ± : Type*) [Preorder Ξ±] : (Fin 2 β Ξ±) βo Ξ± Γ Ξ± :=
{ OrderIso.piFinTwoIso fun _ => Ξ± with toEquiv := finTwoArrowEquiv Ξ± }
#align order_iso.fin_two_arrow_iso OrderIso.finTwoArrowIso
def finSuccEquiv' (i : Fin (n + 1)) : Fin (n + 1) β Option (Fin n) where
toFun := i.insertNth none some
invFun x := x.casesOn' i (Fin.succAbove i)
left_inv x := Fin.succAboveCases i (by simp) (fun j => by simp) x
right_inv x := by cases x <;> dsimp <;> simp
#align fin_succ_equiv' finSuccEquiv'
@[simp]
theorem finSuccEquiv'_at (i : Fin (n + 1)) : (finSuccEquiv' i) i = none := by
simp [finSuccEquiv']
#align fin_succ_equiv'_at finSuccEquiv'_at
@[simp]
theorem finSuccEquiv'_succAbove (i : Fin (n + 1)) (j : Fin n) :
finSuccEquiv' i (i.succAbove j) = some j :=
@Fin.insertNth_apply_succAbove n (fun _ => Option (Fin n)) i _ _ _
#align fin_succ_equiv'_succ_above finSuccEquiv'_succAbove
theorem finSuccEquiv'_below {i : Fin (n + 1)} {m : Fin n} (h : Fin.castSucc m < i) :
(finSuccEquiv' i) (Fin.castSucc m) = m := by
rw [β Fin.succAbove_of_castSucc_lt _ _ h, finSuccEquiv'_succAbove]
#align fin_succ_equiv'_below finSuccEquiv'_below
| Mathlib/Logic/Equiv/Fin.lean | 126 | 128 | theorem finSuccEquiv'_above {i : Fin (n + 1)} {m : Fin n} (h : i β€ Fin.castSucc m) :
(finSuccEquiv' i) m.succ = some m := by |
rw [β Fin.succAbove_of_le_castSucc _ _ h, finSuccEquiv'_succAbove]
| [
" (fun b => Bool.casesOn b 0 1) (![false, true] 0) = 0 β§ (fun b => Bool.casesOn b 0 1) (![false, true] 1) = 1",
" ![false, true] ((fun b => Bool.casesOn b 0 1) false) = false β§\n ![false, true] ((fun b => Bool.casesOn b 0 1) true) = true",
" (fun f => (f 0, f 1)) β»ΒΉ' s ΓΛ’ t = Set.univ.pi (cons s (cons t finZ... | [
" (fun b => Bool.casesOn b 0 1) (![false, true] 0) = 0 β§ (fun b => Bool.casesOn b 0 1) (![false, true] 1) = 1",
" ![false, true] ((fun b => Bool.casesOn b 0 1) false) = false β§\n ![false, true] ((fun b => Bool.casesOn b 0 1) true) = true",
" (fun f => (f 0, f 1)) β»ΒΉ' s ΓΛ’ t = Set.univ.pi (cons s (cons t finZ... |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by simp [Filter.coprodα΅’]
#align filter.mem_Coprod_iff Filter.mem_coprodα΅’_iff
theorem compl_mem_coprodα΅’ {s : Set (β i, Ξ± i)} :
sαΆ β Filter.coprodα΅’ f β β i, (eval i '' s)αΆ β f i := by
simp only [Filter.coprodα΅’, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodα΅’
theorem coprodα΅’_neBot_iff' :
NeBot (Filter.coprodα΅’ f) β (β i, Nonempty (Ξ± i)) β§ β d, NeBot (f d) := by
simp only [Filter.coprodα΅’, iSup_neBot, β exists_and_left, β comap_eval_neBot_iff']
#align filter.Coprod_ne_bot_iff' Filter.coprodα΅’_neBot_iff'
@[simp]
theorem coprodα΅’_neBot_iff [β i, Nonempty (Ξ± i)] : NeBot (Filter.coprodα΅’ f) β β d, NeBot (f d) := by
simp [coprodα΅’_neBot_iff', *]
#align filter.Coprod_ne_bot_iff Filter.coprodα΅’_neBot_iff
| Mathlib/Order/Filter/Pi.lean | 248 | 250 | theorem coprodα΅’_eq_bot_iff' : Filter.coprodα΅’ f = β₯ β (β i, IsEmpty (Ξ± i)) β¨ f = β₯ := by |
simpa only [not_neBot, not_and_or, funext_iff, not_forall, not_exists, not_nonempty_iff]
using coprodα΅’_neBot_iff'.not
| [
" s β Filter.coprodα΅’ f β β (i : ΞΉ), β tβ β f i, eval i β»ΒΉ' tβ β s",
" sαΆ β Filter.coprodα΅’ f β β (i : ΞΉ), (eval i '' s)αΆ β f i",
" (Filter.coprodα΅’ f).NeBot β (β (i : ΞΉ), Nonempty (Ξ± i)) β§ β d, (f d).NeBot",
" (Filter.coprodα΅’ f).NeBot β β d, (f d).NeBot",
" Filter.coprodα΅’ f = β₯ β (β i, IsEmpty (Ξ± i)) β¨ f = β₯"... | [
" s β Filter.coprodα΅’ f β β (i : ΞΉ), β tβ β f i, eval i β»ΒΉ' tβ β s",
" sαΆ β Filter.coprodα΅’ f β β (i : ΞΉ), (eval i '' s)αΆ β f i",
" (Filter.coprodα΅’ f).NeBot β (β (i : ΞΉ), Nonempty (Ξ± i)) β§ β d, (f d).NeBot",
" (Filter.coprodα΅’ f).NeBot β β d, (f d).NeBot",
" Filter.coprodα΅’ f = β₯ β (β i, IsEmpty (Ξ± i)) β¨ f = β₯"... |
import Mathlib.Topology.ContinuousOn
#align_import topology.algebra.order.left_right from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Topology
section TopologicalSpace
variable {Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [LinearOrder Ξ±] [TopologicalSpace Ξ²]
| Mathlib/Topology/Order/LeftRight.lean | 111 | 112 | theorem nhds_left_sup_nhds_right (a : Ξ±) : π[β€] a β π[β₯] a = π a := by |
rw [β nhdsWithin_union, Iic_union_Ici, nhdsWithin_univ]
| [
" π[β€] a β π[β₯] a = π a"
] | [
" π[β€] a β π[β₯] a = π a"
] |
import Mathlib.Data.Complex.Module
import Mathlib.Data.Complex.Order
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.RealVectorSpace
#align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
assert_not_exists Absorbs
noncomputable section
namespace Complex
variable {z : β}
open ComplexConjugate Topology Filter
instance : Norm β :=
β¨absβ©
@[simp]
theorem norm_eq_abs (z : β) : βzβ = abs z :=
rfl
#align complex.norm_eq_abs Complex.norm_eq_abs
lemma norm_I : βIβ = 1 := abs_I
theorem norm_exp_ofReal_mul_I (t : β) : βexp (t * I)β = 1 := by
simp only [norm_eq_abs, abs_exp_ofReal_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.norm_exp_of_real_mul_I Complex.norm_exp_ofReal_mul_I
instance instNormedAddCommGroup : NormedAddCommGroup β :=
AddGroupNorm.toNormedAddCommGroup
{ abs with
map_zero' := map_zero abs
neg' := abs.map_neg
eq_zero_of_map_eq_zero' := fun _ => abs.eq_zero.1 }
instance : NormedField β where
dist_eq _ _ := rfl
norm_mul' := map_mul abs
instance : DenselyNormedField β where
lt_norm_lt rβ rβ hβ hr :=
let β¨x, hβ© := exists_between hr
β¨x, by rwa [norm_eq_abs, abs_ofReal, abs_of_pos (hβ.trans_lt h.1)]β©
instance {R : Type*} [NormedField R] [NormedAlgebra R β] : NormedAlgebra R β where
norm_smul_le r x := by
rw [β algebraMap_smul β r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, β Real.norm_eq_abs,
norm_algebraMap']
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace β E]
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedSpace.complexToReal : NormedSpace β E :=
NormedSpace.restrictScalars β β E
#align normed_space.complex_to_real NormedSpace.complexToReal
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedAlgebra.complexToReal {A : Type*} [SeminormedRing A]
[NormedAlgebra β A] : NormedAlgebra β A :=
NormedAlgebra.restrictScalars β β A
theorem dist_eq (z w : β) : dist z w = abs (z - w) :=
rfl
#align complex.dist_eq Complex.dist_eq
theorem dist_eq_re_im (z w : β) : dist z w = β((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by
rw [sq, sq]
rfl
#align complex.dist_eq_re_im Complex.dist_eq_re_im
@[simp]
theorem dist_mk (xβ yβ xβ yβ : β) :
dist (mk xβ yβ) (mk xβ yβ) = β((xβ - xβ) ^ 2 + (yβ - yβ) ^ 2) :=
dist_eq_re_im _ _
#align complex.dist_mk Complex.dist_mk
theorem dist_of_re_eq {z w : β} (h : z.re = w.re) : dist z w = dist z.im w.im := by
rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq]
#align complex.dist_of_re_eq Complex.dist_of_re_eq
theorem nndist_of_re_eq {z w : β} (h : z.re = w.re) : nndist z w = nndist z.im w.im :=
NNReal.eq <| dist_of_re_eq h
#align complex.nndist_of_re_eq Complex.nndist_of_re_eq
theorem edist_of_re_eq {z w : β} (h : z.re = w.re) : edist z w = edist z.im w.im := by
rw [edist_nndist, edist_nndist, nndist_of_re_eq h]
#align complex.edist_of_re_eq Complex.edist_of_re_eq
theorem dist_of_im_eq {z w : β} (h : z.im = w.im) : dist z w = dist z.re w.re := by
rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, add_zero, Real.sqrt_sq_eq_abs, Real.dist_eq]
#align complex.dist_of_im_eq Complex.dist_of_im_eq
theorem nndist_of_im_eq {z w : β} (h : z.im = w.im) : nndist z w = nndist z.re w.re :=
NNReal.eq <| dist_of_im_eq h
#align complex.nndist_of_im_eq Complex.nndist_of_im_eq
theorem edist_of_im_eq {z w : β} (h : z.im = w.im) : edist z w = edist z.re w.re := by
rw [edist_nndist, edist_nndist, nndist_of_im_eq h]
#align complex.edist_of_im_eq Complex.edist_of_im_eq
| Mathlib/Analysis/Complex/Basic.lean | 137 | 139 | theorem dist_conj_self (z : β) : dist (conj z) z = 2 * |z.im| := by |
rw [dist_of_re_eq (conj_re z), conj_im, dist_comm, Real.dist_eq, sub_neg_eq_add, β two_mul,
_root_.abs_mul, abs_of_pos (zero_lt_two' β)]
| [
" βcexp (βt * I)β = 1",
" rβ < ββxβ β§ ββxβ < rβ",
" βr β’ xβ β€ βrβ * βxβ",
" dist z w = β((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2)",
" dist z w = β((z.re - w.re) * (z.re - w.re) + (z.im - w.im) * (z.im - w.im))",
" dist z w = dist z.im w.im",
" edist z w = edist z.im w.im",
" dist z w = dist z.re w.re",
... | [
" βcexp (βt * I)β = 1",
" rβ < ββxβ β§ ββxβ < rβ",
" βr β’ xβ β€ βrβ * βxβ",
" dist z w = β((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2)",
" dist z w = β((z.re - w.re) * (z.re - w.re) + (z.im - w.im) * (z.im - w.im))",
" dist z w = dist z.im w.im",
" edist z w = edist z.im w.im",
" dist z w = dist z.re w.re",
... |
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β
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β]
#align mv_polynomial.expand_bindβ MvPolynomial.expand_bindβ
@[simp]
theorem map_expand (f : R β+* S) (p : β) (Ο : MvPolynomial Ο R) :
map f (expand p Ο) = expand p (map f Ο) := by simp [expand, map_bindβ]
#align mv_polynomial.map_expand MvPolynomial.map_expand
@[simp]
theorem rename_expand (f : Ο β Ο) (p : β) (Ο : MvPolynomial Ο R) :
rename f (expand p Ο) = expand p (rename f Ο) := by
simp [expand, bindβ_rename, rename_bindβ, Function.comp]
#align mv_polynomial.rename_expand MvPolynomial.rename_expand
@[simp]
| Mathlib/Algebra/MvPolynomial/Expand.lean | 88 | 92 | theorem rename_comp_expand (f : Ο β Ο) (p : β) :
(rename f).comp (expand p) =
(expand p).comp (rename f : MvPolynomial Ο R ββ[R] MvPolynomial Ο R) := by |
ext1 Ο
simp only [rename_expand, AlgHom.comp_apply]
| [
" (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.Analysis.NormedSpace.PiLp
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped NNReal Matrix
namespace Matrix
variable {R l m n Ξ± Ξ² : Type*} [Fintype l] [Fintype m] [Fintype n]
section LinfLinf
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup Ξ±] [SeminormedAddCommGroup Ξ²]
protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n Ξ±) :=
Pi.seminormedAddCommGroup
#align matrix.seminormed_add_comm_group Matrix.seminormedAddCommGroup
attribute [local instance] Matrix.seminormedAddCommGroup
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem norm_def (A : Matrix m n Ξ±) : βAβ = βfun i j => A i jβ := rfl
lemma norm_eq_sup_sup_nnnorm (A : Matrix m n Ξ±) :
βAβ = Finset.sup Finset.univ fun i β¦ Finset.sup Finset.univ fun j β¦ βA i jββ := by
simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def]
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem nnnorm_def (A : Matrix m n Ξ±) : βAββ = βfun i j => A i jββ := rfl
theorem norm_le_iff {r : β} (hr : 0 β€ r) {A : Matrix m n Ξ±} : βAβ β€ r β β i j, βA i jβ β€ r := by
simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr]
#align matrix.norm_le_iff Matrix.norm_le_iff
theorem nnnorm_le_iff {r : ββ₯0} {A : Matrix m n Ξ±} : βAββ β€ r β β i j, βA i jββ β€ r := by
simp_rw [nnnorm_def, pi_nnnorm_le_iff]
#align matrix.nnnorm_le_iff Matrix.nnnorm_le_iff
theorem norm_lt_iff {r : β} (hr : 0 < r) {A : Matrix m n Ξ±} : βAβ < r β β i j, βA i jβ < r := by
simp_rw [norm_def, pi_norm_lt_iff hr]
#align matrix.norm_lt_iff Matrix.norm_lt_iff
| Mathlib/Analysis/Matrix.lean | 102 | 104 | theorem nnnorm_lt_iff {r : ββ₯0} (hr : 0 < r) {A : Matrix m n Ξ±} :
βAββ < r β β i j, βA i jββ < r := by |
simp_rw [nnnorm_def, pi_nnnorm_lt_iff hr]
| [
" βAβ = β(Finset.univ.sup fun i => Finset.univ.sup fun j => βA i jββ)",
" βAβ β€ r β β (i : m) (j : n), βA i jβ β€ r",
" βAββ β€ r β β (i : m) (j : n), βA i jββ β€ r",
" βAβ < r β β (i : m) (j : n), βA i jβ < r",
" βAββ < r β β (i : m) (j : n), βA i jββ < r"
] | [
" βAβ = β(Finset.univ.sup fun i => Finset.univ.sup fun j => βA i jββ)",
" βAβ β€ r β β (i : m) (j : n), βA i jβ β€ r",
" βAββ β€ r β β (i : m) (j : n), βA i jββ β€ r",
" βAβ < r β β (i : m) (j : n), βA i jβ < r",
" βAββ < r β β (i : m) (j : n), βA i jββ < r"
] |
import Mathlib.Algebra.Group.Subsemigroup.Basic
#align_import group_theory.subsemigroup.membership from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff"
assert_not_exists MonoidWithZero
variable {ΞΉ : Sort*} {M A B : Type*}
section NonAssoc
variable [Mul M]
open Set
namespace Subsemigroup
-- TODO: this section can be generalized to `[MulMemClass B M] [CompleteLattice B]`
-- such that `complete_lattice.le` coincides with `set_like.le`
@[to_additive]
theorem mem_iSup_of_directed {S : ΞΉ β Subsemigroup M} (hS : Directed (Β· β€ Β·) S) {x : M} :
(x β β¨ i, S i) β β i, x β S i := by
refine β¨?_, fun β¨i, hiβ© β¦ le_iSup S i hiβ©
suffices x β closure (β i, (S i : Set M)) β β i, x β S i by
simpa only [closure_iUnion, closure_eq (S _)] using this
refine fun hx β¦ closure_induction hx (fun y hy β¦ mem_iUnion.mp hy) ?_
rintro x y β¨i, hiβ© β¨j, hjβ©
rcases hS i j with β¨k, hki, hkjβ©
exact β¨k, (S k).mul_mem (hki hi) (hkj hj)β©
#align subsemigroup.mem_supr_of_directed Subsemigroup.mem_iSup_of_directed
#align add_subsemigroup.mem_supr_of_directed AddSubsemigroup.mem_iSup_of_directed
@[to_additive]
theorem coe_iSup_of_directed {S : ΞΉ β Subsemigroup M} (hS : Directed (Β· β€ Β·) S) :
((β¨ i, S i : Subsemigroup M) : Set M) = β i, S i :=
Set.ext fun x => by simp [mem_iSup_of_directed hS]
#align subsemigroup.coe_supr_of_directed Subsemigroup.coe_iSup_of_directed
#align add_subsemigroup.coe_supr_of_directed AddSubsemigroup.coe_iSup_of_directed
@[to_additive]
| Mathlib/Algebra/Group/Subsemigroup/Membership.lean | 67 | 70 | theorem mem_sSup_of_directed_on {S : Set (Subsemigroup M)} (hS : DirectedOn (Β· β€ Β·) S) {x : M} :
x β sSup S β β s β S, x β s := by |
simp only [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk,
exists_prop]
| [
" x β β¨ i, S i β β i, x β S i",
" x β β¨ i, S i β β i, x β S i",
" x β closure (β i, β(S i)) β β i, x β S i",
" β (x y : M), (β i, x β S i) β (β i, y β S i) β β i, x * y β S i",
" β i, x * y β S i",
" x β β(β¨ i, S i) β x β β i, β(S i)",
" x β sSup S β β s β S, x β s"
] | [
" x β β¨ i, S i β β i, x β S i",
" x β β¨ i, S i β β i, x β S i",
" x β closure (β i, β(S i)) β β i, x β S i",
" β (x y : M), (β i, x β S i) β (β i, y β S i) β β i, x * y β S i",
" β i, x * y β S i",
" x β β(β¨ i, S i) β x β β i, β(S i)",
" x β sSup S β β s β S, x β s"
] |
import Mathlib.Algebra.MvPolynomial.Variables
#align_import data.mv_polynomial.supported from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
universe u v w
namespace MvPolynomial
variable {Ο Ο : Type*} {R : Type u} {S : Type v} {r : R} {e : β} {n m : Ο}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial Ο R}
variable (R)
noncomputable def supported (s : Set Ο) : Subalgebra R (MvPolynomial Ο R) :=
Algebra.adjoin R (X '' s)
#align mv_polynomial.supported MvPolynomial.supported
variable {R}
open Algebra
theorem supported_eq_range_rename (s : Set Ο) : supported R s = (rename ((β) : s β Ο)).range := by
rw [supported, Set.image_eq_range, adjoin_range_eq_range_aeval, rename]
congr
#align mv_polynomial.supported_eq_range_rename MvPolynomial.supported_eq_range_rename
noncomputable def supportedEquivMvPolynomial (s : Set Ο) : supported R s ββ[R] MvPolynomial s R :=
(Subalgebra.equivOfEq _ _ (supported_eq_range_rename s)).trans
(AlgEquiv.ofInjective (rename ((β) : s β Ο)) (rename_injective _ Subtype.val_injective)).symm
#align mv_polynomial.supported_equiv_mv_polynomial MvPolynomial.supportedEquivMvPolynomial
@[simp, nolint simpNF] -- Porting note: the `simpNF` linter complained about this lemma.
theorem supportedEquivMvPolynomial_symm_C (s : Set Ο) (x : R) :
(supportedEquivMvPolynomial s).symm (C x) = algebraMap R (supported R s) x := by
ext1
simp [supportedEquivMvPolynomial, MvPolynomial.algebraMap_eq]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.supported_equiv_mv_polynomial_symm_C MvPolynomial.supportedEquivMvPolynomial_symm_C
@[simp, nolint simpNF] -- Porting note: the `simpNF` linter complained about this lemma.
theorem supportedEquivMvPolynomial_symm_X (s : Set Ο) (i : s) :
(β((supportedEquivMvPolynomial s).symm (X i : MvPolynomial s R)) : MvPolynomial Ο R) = X βi :=
by simp [supportedEquivMvPolynomial]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.supported_equiv_mv_polynomial_symm_X MvPolynomial.supportedEquivMvPolynomial_symm_X
variable {s t : Set Ο}
theorem mem_supported : p β supported R s β βp.vars β s := by
classical
rw [supported_eq_range_rename, AlgHom.mem_range]
constructor
Β· rintro β¨p, rflβ©
refine _root_.trans (Finset.coe_subset.2 (vars_rename _ _)) ?_
simp
Β· intro hs
exact exists_rename_eq_of_vars_subset_range p ((β) : s β Ο) Subtype.val_injective (by simpa)
#align mv_polynomial.mem_supported MvPolynomial.mem_supported
theorem supported_eq_vars_subset : (supported R s : Set (MvPolynomial Ο R)) = { p | βp.vars β s } :=
Set.ext fun _ β¦ mem_supported
#align mv_polynomial.supported_eq_vars_subset MvPolynomial.supported_eq_vars_subset
@[simp]
theorem mem_supported_vars (p : MvPolynomial Ο R) : p β supported R (βp.vars : Set Ο) := by
rw [mem_supported]
#align mv_polynomial.mem_supported_vars MvPolynomial.mem_supported_vars
variable (s)
theorem supported_eq_adjoin_X : supported R s = Algebra.adjoin R (X '' s) := rfl
set_option linter.uppercaseLean3 false in
#align mv_polynomial.supported_eq_adjoin_X MvPolynomial.supported_eq_adjoin_X
@[simp]
theorem supported_univ : supported R (Set.univ : Set Ο) = β€ := by
simp [Algebra.eq_top_iff, mem_supported]
#align mv_polynomial.supported_univ MvPolynomial.supported_univ
@[simp]
theorem supported_empty : supported R (β
: Set Ο) = β₯ := by simp [supported_eq_adjoin_X]
#align mv_polynomial.supported_empty MvPolynomial.supported_empty
variable {s}
theorem supported_mono (st : s β t) : supported R s β€ supported R t :=
Algebra.adjoin_mono (Set.image_subset _ st)
#align mv_polynomial.supported_mono MvPolynomial.supported_mono
@[simp]
| Mathlib/Algebra/MvPolynomial/Supported.lean | 117 | 118 | theorem X_mem_supported [Nontrivial R] {i : Ο} : X i β supported R s β i β s := by |
simp [mem_supported]
| [
" supported R s = (rename Subtype.val).range",
" (aeval fun x => X βx).range = (aeval (X β Subtype.val)).range",
" (supportedEquivMvPolynomial s).symm (C x) = (algebraMap R β₯(supported R s)) x",
" β((supportedEquivMvPolynomial s).symm (C x)) = β((algebraMap R β₯(supported R s)) x)",
" β((supportedEquivMvPoly... | [
" supported R s = (rename Subtype.val).range",
" (aeval fun x => X βx).range = (aeval (X β Subtype.val)).range",
" (supportedEquivMvPolynomial s).symm (C x) = (algebraMap R β₯(supported R s)) x",
" β((supportedEquivMvPolynomial s).symm (C x)) = β((algebraMap R β₯(supported R s)) x)",
" β((supportedEquivMvPoly... |
import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.LocalExtr.Basic
#align_import analysis.calculus.darboux from "leanprover-community/mathlib"@"61b5e2755ccb464b68d05a9acf891ae04992d09d"
open Filter Set
open scoped Topology Classical
variable {a b : β} {f f' : β β β}
theorem exists_hasDerivWithinAt_eq_of_gt_of_lt (hab : a β€ b)
(hf : β x β Icc a b, HasDerivWithinAt f (f' x) (Icc a b) x) {m : β} (hma : f' a < m)
(hmb : m < f' b) : m β f' '' Ioo a b := by
rcases hab.eq_or_lt with (rfl | hab')
Β· exact (lt_asymm hma hmb).elim
set g : β β β := fun x => f x - m * x
have hg : β x β Icc a b, HasDerivWithinAt g (f' x - m) (Icc a b) x := by
intro x hx
simpa using (hf x hx).sub ((hasDerivWithinAt_id x _).const_mul m)
obtain β¨c, cmem, hcβ© : β c β Icc a b, IsMinOn g (Icc a b) c :=
isCompact_Icc.exists_isMinOn (nonempty_Icc.2 <| hab) fun x hx => (hg x hx).continuousWithinAt
have cmem' : c β Ioo a b := by
rcases cmem.1.eq_or_lt with (rfl | hac)
-- Show that `c` can't be equal to `a`
Β· refine absurd (sub_nonneg.1 <| nonneg_of_mul_nonneg_right ?_ (sub_pos.2 hab'))
(not_le_of_lt hma)
have : b - a β posTangentConeAt (Icc a b) a :=
mem_posTangentConeAt_of_segment_subset (segment_eq_Icc hab βΈ Subset.refl _)
simpa only [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply]
using hc.localize.hasFDerivWithinAt_nonneg (hg a (left_mem_Icc.2 hab)) this
rcases cmem.2.eq_or_gt with (rfl | hcb)
-- Show that `c` can't be equal to `b`
Β· refine absurd (sub_nonpos.1 <| nonpos_of_mul_nonneg_right ?_ (sub_lt_zero.2 hab'))
(not_le_of_lt hmb)
have : a - b β posTangentConeAt (Icc a b) b :=
mem_posTangentConeAt_of_segment_subset (by rw [segment_symm, segment_eq_Icc hab])
simpa only [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply]
using hc.localize.hasFDerivWithinAt_nonneg (hg b (right_mem_Icc.2 hab)) this
exact β¨hac, hcbβ©
use c, cmem'
rw [β sub_eq_zero]
have : Icc a b β π c := by rwa [β mem_interior_iff_mem_nhds, interior_Icc]
exact (hc.isLocalMin this).hasDerivAt_eq_zero ((hg c cmem).hasDerivAt this)
#align exists_has_deriv_within_at_eq_of_gt_of_lt exists_hasDerivWithinAt_eq_of_gt_of_lt
theorem exists_hasDerivWithinAt_eq_of_lt_of_gt (hab : a β€ b)
(hf : β x β Icc a b, HasDerivWithinAt f (f' x) (Icc a b) x) {m : β} (hma : m < f' a)
(hmb : f' b < m) : m β f' '' Ioo a b :=
let β¨c, cmem, hcβ© :=
exists_hasDerivWithinAt_eq_of_gt_of_lt hab (fun x hx => (hf x hx).neg) (neg_lt_neg hma)
(neg_lt_neg hmb)
β¨c, cmem, neg_injective hcβ©
#align exists_has_deriv_within_at_eq_of_lt_of_gt exists_hasDerivWithinAt_eq_of_lt_of_gt
| Mathlib/Analysis/Calculus/Darboux.lean | 76 | 90 | theorem Set.OrdConnected.image_hasDerivWithinAt {s : Set β} (hs : OrdConnected s)
(hf : β x β s, HasDerivWithinAt f (f' x) s x) : OrdConnected (f' '' s) := by |
apply ordConnected_of_Ioo
rintro _ β¨a, ha, rflβ© _ β¨b, hb, rflβ© - m β¨hma, hmbβ©
rcases le_total a b with hab | hab
Β· have : Icc a b β s := hs.out ha hb
rcases exists_hasDerivWithinAt_eq_of_gt_of_lt hab (fun x hx => (hf x <| this hx).mono this) hma
hmb with
β¨c, cmem, hcβ©
exact β¨c, this <| Ioo_subset_Icc_self cmem, hcβ©
Β· have : Icc b a β s := hs.out hb ha
rcases exists_hasDerivWithinAt_eq_of_lt_of_gt hab (fun x hx => (hf x <| this hx).mono this) hmb
hma with
β¨c, cmem, hcβ©
exact β¨c, this <| Ioo_subset_Icc_self cmem, hcβ©
| [
" m β f' '' Ioo a b",
" m β f' '' Ioo a a",
" β x β Icc a b, HasDerivWithinAt g (f' x - m) (Icc a b) x",
" HasDerivWithinAt g (f' x - m) (Icc a b) x",
" c β Ioo a b",
" a β Ioo a b",
" 0 β€ (b - a) * (f' a - m)",
" b β Ioo a b",
" 0 β€ (a - b) * (f' b - m)",
" segment β b a β Icc a b",
" f' c = m"... | [
" m β f' '' Ioo a b",
" m β f' '' Ioo a a",
" β x β Icc a b, HasDerivWithinAt g (f' x - m) (Icc a b) x",
" HasDerivWithinAt g (f' x - m) (Icc a b) x",
" c β Ioo a b",
" a β Ioo a b",
" 0 β€ (b - a) * (f' a - m)",
" b β Ioo a b",
" 0 β€ (a - b) * (f' b - m)",
" segment β b a β Icc a b",
" f' c = m"... |
import Mathlib.LinearAlgebra.Matrix.BilinearForm
import Mathlib.LinearAlgebra.Matrix.Charpoly.Minpoly
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.Vandermonde
import Mathlib.LinearAlgebra.Trace
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.FieldTheory.PrimitiveElement
import Mathlib.FieldTheory.Galois
import Mathlib.RingTheory.PowerBasis
import Mathlib.FieldTheory.Minpoly.MinpolyDiv
#align_import ring_theory.trace from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
universe u v w z
variable {R S T : Type*} [CommRing R] [CommRing S] [CommRing T]
variable [Algebra R S] [Algebra R T]
variable {K L : Type*} [Field K] [Field L] [Algebra K L]
variable {ΞΉ ΞΊ : Type w} [Fintype ΞΉ]
open FiniteDimensional
open LinearMap (BilinForm)
open LinearMap
open Matrix
open scoped Matrix
namespace Algebra
variable (b : Basis ΞΉ R S)
variable (R S)
noncomputable def trace : S ββ[R] R :=
(LinearMap.trace R S).comp (lmul R S).toLinearMap
#align algebra.trace Algebra.trace
variable {S}
-- Not a `simp` lemma since there are more interesting ways to rewrite `trace R S x`,
-- for example `trace_trace`
theorem trace_apply (x) : trace R S x = LinearMap.trace R S (lmul R S x) :=
rfl
#align algebra.trace_apply Algebra.trace_apply
theorem trace_eq_zero_of_not_exists_basis (h : Β¬β s : Finset S, Nonempty (Basis s R S)) :
trace R S = 0 := by ext s; simp [trace_apply, LinearMap.trace, h]
#align algebra.trace_eq_zero_of_not_exists_basis Algebra.trace_eq_zero_of_not_exists_basis
variable {R}
-- Can't be a `simp` lemma because it depends on a choice of basis
| Mathlib/RingTheory/Trace.lean | 109 | 111 | theorem trace_eq_matrix_trace [DecidableEq ΞΉ] (b : Basis ΞΉ R S) (s : S) :
trace R S s = Matrix.trace (Algebra.leftMulMatrix b s) := by |
rw [trace_apply, LinearMap.trace_eq_matrix_trace _ b, β toMatrix_lmul_eq]; rfl
| [
" trace R S = 0",
" (trace R S) s = 0 s",
" (trace R S) s = ((leftMulMatrix b) s).trace",
" ((toMatrix b b) ((lmul R S) s)).trace = ((toMatrix b b) (mulLeft R s)).trace"
] | [
" trace R S = 0",
" (trace R S) s = 0 s",
" (trace R S) s = ((leftMulMatrix b) s).trace"
] |
import Mathlib.Algebra.CharP.LocalRing
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.Tactic.FieldSimp
#align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
variable (R : Type*) [CommRing R]
class MixedCharZero (p : β) : Prop where
[toCharZero : CharZero R]
charP_quotient : β I : Ideal R, I β β€ β§ CharP (R β§Έ I) p
#align mixed_char_zero MixedCharZero
namespace MixedCharZero
| Mathlib/Algebra/CharP/MixedCharZero.lean | 85 | 105 | theorem reduce_to_p_prime {P : Prop} :
(β p > 0, MixedCharZero R p β P) β β p : β, p.Prime β MixedCharZero R p β P := by |
constructor
Β· intro h q q_prime q_mixedChar
exact h q (Nat.Prime.pos q_prime) q_mixedChar
Β· intro h q q_pos q_mixedChar
rcases q_mixedChar.charP_quotient with β¨I, hI_ne_top, _β©
-- Krull's Thm: There exists a prime ideal `P` such that `I β€ P`
rcases Ideal.exists_le_maximal I hI_ne_top with β¨M, hM_max, h_IMβ©
let r := ringChar (R β§Έ M)
have r_pos : r β 0 := by
have q_zero :=
congr_arg (Ideal.Quotient.factor I M h_IM) (CharP.cast_eq_zero (R β§Έ I) q)
simp only [map_natCast, map_zero] at q_zero
apply ne_zero_of_dvd_ne_zero (ne_of_gt q_pos)
exact (CharP.cast_eq_zero_iff (R β§Έ M) r q).mp q_zero
have r_prime : Nat.Prime r :=
or_iff_not_imp_right.1 (CharP.char_is_prime_or_zero (R β§Έ M) r) r_pos
apply h r r_prime
have : CharZero R := q_mixedChar.toCharZero
exact β¨β¨M, hM_max.ne_top, ringChar.of_eq rflβ©β©
| [
" (β p > 0, MixedCharZero R p β P) β β (p : β), p.Prime β MixedCharZero R p β P",
" (β p > 0, MixedCharZero R p β P) β β (p : β), p.Prime β MixedCharZero R p β P",
" P",
" (β (p : β), p.Prime β MixedCharZero R p β P) β β p > 0, MixedCharZero R p β P",
" r β 0",
" r β£ q",
" MixedCharZero R r"
] | [
" (β p > 0, MixedCharZero R p β P) β β (p : β), p.Prime β MixedCharZero R p β P"
] |
import Mathlib.Geometry.Manifold.Algebra.Monoid
#align_import geometry.manifold.algebra.lie_group from "leanprover-community/mathlib"@"f9ec187127cc5b381dfcf5f4a22dacca4c20b63d"
noncomputable section
open scoped Manifold
-- See note [Design choices about smooth algebraic structures]
class LieAddGroup {π : Type*} [NontriviallyNormedField π] {H : Type*} [TopologicalSpace H]
{E : Type*} [NormedAddCommGroup E] [NormedSpace π E] (I : ModelWithCorners π E H) (G : Type*)
[AddGroup G] [TopologicalSpace G] [ChartedSpace H G] extends SmoothAdd I G : Prop where
smooth_neg : Smooth I I fun a : G => -a
#align lie_add_group LieAddGroup
-- See note [Design choices about smooth algebraic structures]
@[to_additive]
class LieGroup {π : Type*} [NontriviallyNormedField π] {H : Type*} [TopologicalSpace H]
{E : Type*} [NormedAddCommGroup E] [NormedSpace π E] (I : ModelWithCorners π E H) (G : Type*)
[Group G] [TopologicalSpace G] [ChartedSpace H G] extends SmoothMul I G : Prop where
smooth_inv : Smooth I I fun a : G => aβ»ΒΉ
#align lie_group LieGroup
section PointwiseDivision
variable {π : Type*} [NontriviallyNormedField π] {H : Type*} [TopologicalSpace H] {E : Type*}
[NormedAddCommGroup E] [NormedSpace π E] {I : ModelWithCorners π E H} {F : Type*}
[NormedAddCommGroup F] [NormedSpace π F] {J : ModelWithCorners π F F} {G : Type*}
[TopologicalSpace G] [ChartedSpace H G] [Group G] [LieGroup I G] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace π E'] {H' : Type*} [TopologicalSpace H']
{I' : ModelWithCorners π E' H'} {M : Type*} [TopologicalSpace M] [ChartedSpace H' M]
{E'' : Type*} [NormedAddCommGroup E''] [NormedSpace π E''] {H'' : Type*} [TopologicalSpace H'']
{I'' : ModelWithCorners π E'' H''} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H'' M']
{n : ββ}
section
variable (I)
@[to_additive "In an additive Lie group, inversion is a smooth map."]
theorem smooth_inv : Smooth I I fun x : G => xβ»ΒΉ :=
LieGroup.smooth_inv
#align smooth_inv smooth_inv
#align smooth_neg smooth_neg
@[to_additive "An additive Lie group is an additive topological group. This is not an instance for
technical reasons, see note [Design choices about smooth algebraic structures]."]
theorem topologicalGroup_of_lieGroup : TopologicalGroup G :=
{ continuousMul_of_smooth I with continuous_inv := (smooth_inv I).continuous }
#align topological_group_of_lie_group topologicalGroup_of_lieGroup
#align topological_add_group_of_lie_add_group topologicalAddGroup_of_lieAddGroup
end
@[to_additive]
theorem ContMDiffWithinAt.inv {f : M β G} {s : Set M} {xβ : M}
(hf : ContMDiffWithinAt I' I n f s xβ) : ContMDiffWithinAt I' I n (fun x => (f x)β»ΒΉ) s xβ :=
((smooth_inv I).of_le le_top).contMDiffAt.contMDiffWithinAt.comp xβ hf <| Set.mapsTo_univ _ _
#align cont_mdiff_within_at.inv ContMDiffWithinAt.inv
#align cont_mdiff_within_at.neg ContMDiffWithinAt.neg
@[to_additive]
theorem ContMDiffAt.inv {f : M β G} {xβ : M} (hf : ContMDiffAt I' I n f xβ) :
ContMDiffAt I' I n (fun x => (f x)β»ΒΉ) xβ :=
((smooth_inv I).of_le le_top).contMDiffAt.comp xβ hf
#align cont_mdiff_at.inv ContMDiffAt.inv
#align cont_mdiff_at.neg ContMDiffAt.neg
@[to_additive]
theorem ContMDiffOn.inv {f : M β G} {s : Set M} (hf : ContMDiffOn I' I n f s) :
ContMDiffOn I' I n (fun x => (f x)β»ΒΉ) s := fun x hx => (hf x hx).inv
#align cont_mdiff_on.inv ContMDiffOn.inv
#align cont_mdiff_on.neg ContMDiffOn.neg
@[to_additive]
theorem ContMDiff.inv {f : M β G} (hf : ContMDiff I' I n f) : ContMDiff I' I n fun x => (f x)β»ΒΉ :=
fun x => (hf x).inv
#align cont_mdiff.inv ContMDiff.inv
#align cont_mdiff.neg ContMDiff.neg
@[to_additive]
nonrec theorem SmoothWithinAt.inv {f : M β G} {s : Set M} {xβ : M}
(hf : SmoothWithinAt I' I f s xβ) : SmoothWithinAt I' I (fun x => (f x)β»ΒΉ) s xβ :=
hf.inv
#align smooth_within_at.inv SmoothWithinAt.inv
#align smooth_within_at.neg SmoothWithinAt.neg
@[to_additive]
nonrec theorem SmoothAt.inv {f : M β G} {xβ : M} (hf : SmoothAt I' I f xβ) :
SmoothAt I' I (fun x => (f x)β»ΒΉ) xβ :=
hf.inv
#align smooth_at.inv SmoothAt.inv
#align smooth_at.neg SmoothAt.neg
@[to_additive]
nonrec theorem SmoothOn.inv {f : M β G} {s : Set M} (hf : SmoothOn I' I f s) :
SmoothOn I' I (fun x => (f x)β»ΒΉ) s :=
hf.inv
#align smooth_on.inv SmoothOn.inv
#align smooth_on.neg SmoothOn.neg
@[to_additive]
nonrec theorem Smooth.inv {f : M β G} (hf : Smooth I' I f) : Smooth I' I fun x => (f x)β»ΒΉ :=
hf.inv
#align smooth.inv Smooth.inv
#align smooth.neg Smooth.neg
@[to_additive]
| Mathlib/Geometry/Manifold/Algebra/LieGroup.lean | 171 | 174 | theorem ContMDiffWithinAt.div {f g : M β G} {s : Set M} {xβ : M}
(hf : ContMDiffWithinAt I' I n f s xβ) (hg : ContMDiffWithinAt I' I n g s xβ) :
ContMDiffWithinAt I' I n (fun x => f x / g x) s xβ := by |
simp_rw [div_eq_mul_inv]; exact hf.mul hg.inv
| [
" ContMDiffWithinAt I' I n (fun x => f x / g x) s xβ",
" ContMDiffWithinAt I' I n (fun x => f x * (g x)β»ΒΉ) s xβ"
] | [
" ContMDiffWithinAt I' I n (fun x => f x / g x) s xβ"
] |
import Batteries.Data.DList
import Mathlib.Mathport.Rename
import Mathlib.Tactic.Cases
#align_import data.dlist from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd"
universe u
#align dlist Batteries.DList
namespace Batteries.DList
open Function
variable {Ξ± : Type u}
#align dlist.of_list Batteries.DList.ofList
def lazy_ofList (l : Thunk (List Ξ±)) : DList Ξ± :=
β¨fun xs => l.get ++ xs, fun t => by simpβ©
#align dlist.lazy_of_list Batteries.DList.lazy_ofList
#align dlist.to_list Batteries.DList.toList
#align dlist.empty Batteries.DList.empty
#align dlist.singleton Batteries.DList.singleton
attribute [local simp] Function.comp
#align dlist.cons Batteries.DList.cons
#align dlist.concat Batteries.DList.push
#align dlist.append Batteries.DList.append
attribute [local simp] ofList toList empty singleton cons push append
theorem toList_ofList (l : List Ξ±) : DList.toList (DList.ofList l) = l := by
cases l; rfl; simp only [DList.toList, DList.ofList, List.cons_append, List.append_nil]
#align dlist.to_list_of_list Batteries.DList.toList_ofList
theorem ofList_toList (l : DList Ξ±) : DList.ofList (DList.toList l) = l := by
cases' l with app inv
simp only [ofList, toList, mk.injEq]
funext x
rw [(inv x)]
#align dlist.of_list_to_list Batteries.DList.ofList_toList
theorem toList_empty : toList (@empty Ξ±) = [] := by simp
#align dlist.to_list_empty Batteries.DList.toList_empty
theorem toList_singleton (x : Ξ±) : toList (singleton x) = [x] := by simp
#align dlist.to_list_singleton Batteries.DList.toList_singleton
theorem toList_append (lβ lβ : DList Ξ±) : toList (lβ ++ lβ) = toList lβ ++ toList lβ :=
show toList (DList.append lβ lβ) = toList lβ ++ toList lβ by
cases' lβ with _ lβ_invariant; cases' lβ; simp; rw [lβ_invariant]
#align dlist.to_list_append Batteries.DList.toList_append
| Mathlib/Data/DList/Defs.lean | 80 | 81 | theorem toList_cons (x : Ξ±) (l : DList Ξ±) : toList (cons x l) = x :: toList l := by |
cases l; simp
| [
" (fun xs => l.get ++ xs) t = (fun xs => l.get ++ xs) [] ++ t",
" (ofList l).toList = l",
" (ofList (headβ :: tailβ)).toList = headβ :: tailβ",
" ofList l.toList = l",
" ofList { apply := app, invariant := inv }.toList = { apply := app, invariant := inv }",
" (fun x => app [] ++ x) = app",
" app [] ++ x... | [
" (fun xs => l.get ++ xs) t = (fun xs => l.get ++ xs) [] ++ t",
" (ofList l).toList = l",
" (ofList (headβ :: tailβ)).toList = headβ :: tailβ",
" ofList l.toList = l",
" ofList { apply := app, invariant := inv }.toList = { apply := app, invariant := inv }",
" (fun x => app [] ++ x) = app",
" app [] ++ x... |
import Mathlib.Algebra.MvPolynomial.Funext
import Mathlib.Algebra.Ring.ULift
import Mathlib.RingTheory.WittVector.Basic
#align_import ring_theory.witt_vector.is_poly from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
namespace WittVector
universe u
variable {p : β} {R S : Type u} {Ο idx : Type*} [CommRing R] [CommRing S]
local notation "π" => WittVector p -- type as `\bbW`
open MvPolynomial
open Function (uncurry)
variable (p)
noncomputable section
theorem poly_eq_of_wittPolynomial_bind_eq' [Fact p.Prime] (f g : β β MvPolynomial (idx Γ β) β€)
(h : β n, bindβ f (wittPolynomial p _ n) = bindβ g (wittPolynomial p _ n)) : f = g := by
ext1 n
apply MvPolynomial.map_injective (Int.castRingHom β) Int.cast_injective
rw [β Function.funext_iff] at h
replace h :=
congr_arg (fun fam => bindβ (MvPolynomial.map (Int.castRingHom β) β fam) (xInTermsOfW p β n)) h
simpa only [Function.comp, map_bindβ, map_wittPolynomial, β bindβ_bindβ,
bindβ_wittPolynomial_xInTermsOfW, bindβ_X_right] using h
#align witt_vector.poly_eq_of_witt_polynomial_bind_eq' WittVector.poly_eq_of_wittPolynomial_bind_eq'
| Mathlib/RingTheory/WittVector/IsPoly.lean | 125 | 133 | theorem poly_eq_of_wittPolynomial_bind_eq [Fact p.Prime] (f g : β β MvPolynomial β β€)
(h : β n, bindβ f (wittPolynomial p _ n) = bindβ g (wittPolynomial p _ n)) : f = g := by |
ext1 n
apply MvPolynomial.map_injective (Int.castRingHom β) Int.cast_injective
rw [β Function.funext_iff] at h
replace h :=
congr_arg (fun fam => bindβ (MvPolynomial.map (Int.castRingHom β) β fam) (xInTermsOfW p β n)) h
simpa only [Function.comp, map_bindβ, map_wittPolynomial, β bindβ_bindβ,
bindβ_wittPolynomial_xInTermsOfW, bindβ_X_right] using h
| [
" f = g",
" f n = g n",
" (MvPolynomial.map (Int.castRingHom β)) (f n) = (MvPolynomial.map (Int.castRingHom β)) (g n)"
] | [
" f = g",
" f n = g n",
" (MvPolynomial.map (Int.castRingHom β)) (f n) = (MvPolynomial.map (Int.castRingHom β)) (g n)"
] |
import Mathlib.Algebra.DirectSum.Internal
import Mathlib.Algebra.GradedMonoid
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Equiv
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous
import Mathlib.Algebra.Polynomial.Roots
#align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
namespace MvPolynomial
variable {Ο : Type*} {Ο : Type*} {R : Type*} {S : Type*}
def degree (d : Ο ββ β) := β i β d.support, d i
theorem weightedDegree_one (d : Ο ββ β) :
weightedDegree 1 d = degree d := by
simp [weightedDegree, degree, Finsupp.total, Finsupp.sum]
def IsHomogeneous [CommSemiring R] (Ο : MvPolynomial Ο R) (n : β) :=
IsWeightedHomogeneous 1 Ο n
#align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous
variable [CommSemiring R]
theorem weightedTotalDegree_one (Ο : MvPolynomial Ο R) :
weightedTotalDegree (1 : Ο β β) Ο = Ο.totalDegree := by
simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe,
Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe,
id, Algebra.id.smul_eq_mul, mul_one]
variable (Ο R)
def homogeneousSubmodule (n : β) : Submodule R (MvPolynomial Ο R) where
carrier := { x | x.IsHomogeneous n }
smul_mem' r a ha c hc := by
rw [coeff_smul] at hc
apply ha
intro h
apply hc
rw [h]
exact smul_zero r
zero_mem' d hd := False.elim (hd <| coeff_zero _)
add_mem' {a b} ha hb c hc := by
rw [coeff_add] at hc
obtain h | h : coeff c a β 0 β¨ coeff c b β 0 := by
contrapose! hc
simp only [hc, add_zero]
Β· exact ha h
Β· exact hb h
#align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule
@[simp]
lemma weightedHomogeneousSubmodule_one (n : β) :
weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule Ο R n := rfl
variable {Ο R}
@[simp]
theorem mem_homogeneousSubmodule [CommSemiring R] (n : β) (p : MvPolynomial Ο R) :
p β homogeneousSubmodule Ο R n β p.IsHomogeneous n := Iff.rfl
#align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule
variable (Ο R)
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : β) :
homogeneousSubmodule Ο R n = Finsupp.supported _ R { d | degree d = n } := by
simp_rw [β weightedDegree_one]
exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n
#align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported
variable {Ο R}
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : β) :
homogeneousSubmodule Ο R m * homogeneousSubmodule Ο R n β€ homogeneousSubmodule Ο R (m + n) :=
weightedHomogeneousSubmodule_mul 1 m n
#align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul
section
variable [CommSemiring R]
theorem isHomogeneous_monomial {d : Ο ββ β} (r : R) {n : β} (hn : degree d = n) :
IsHomogeneous (monomial d r) n := by
simp_rw [β weightedDegree_one] at hn
exact isWeightedHomogeneous_monomial 1 d r hn
#align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial
variable (Ο)
theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial Ο R} :
p.totalDegree = 0 β IsHomogeneous p 0 := by
rw [β weightedTotalDegree_one,
β isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous]
alias β¨isHomogeneous_of_totalDegree_zero, _β© := totalDegree_zero_iff_isHomogeneous
#align mv_polynomial.is_homogeneous_of_total_degree_zero MvPolynomial.isHomogeneous_of_totalDegree_zero
| Mathlib/RingTheory/MvPolynomial/Homogeneous.lean | 132 | 134 | theorem isHomogeneous_C (r : R) : IsHomogeneous (C r : MvPolynomial Ο R) 0 := by |
apply isHomogeneous_monomial
simp only [degree, Finsupp.zero_apply, Finset.sum_const_zero]
| [
" (weightedDegree 1) d = degree d",
" weightedTotalDegree 1 Ο = Ο.totalDegree",
" (weightedDegree 1) c = n",
" coeff c a β 0 β¨ coeff c b β 0",
" coeff c a + coeff c b = 0",
" coeff c a β 0",
" False",
" r β’ coeff c a = 0",
" r β’ 0 = 0",
" homogeneousSubmodule Ο R n = Finsupp.supported R R {d | deg... | [
" (weightedDegree 1) d = degree d",
" weightedTotalDegree 1 Ο = Ο.totalDegree",
" (weightedDegree 1) c = n",
" coeff c a β 0 β¨ coeff c b β 0",
" coeff c a + coeff c b = 0",
" coeff c a β 0",
" False",
" r β’ coeff c a = 0",
" r β’ 0 = 0",
" homogeneousSubmodule Ο R n = Finsupp.supported R R {d | deg... |
import Mathlib.Algebra.Polynomial.Expand
import Mathlib.Algebra.Polynomial.Laurent
import Mathlib.LinearAlgebra.Matrix.Charpoly.Basic
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.RingTheory.Polynomial.Nilpotent
#align_import linear_algebra.matrix.charpoly.coeff from "leanprover-community/mathlib"@"9745b093210e9dac443af24da9dba0f9e2b6c912"
noncomputable section
-- porting note: whenever there was `β i : n, X - C (M i i)`, I replaced it with
-- `β i : n, (X - C (M i i))`, since otherwise Lean would parse as `(β i : n, X) - C (M i i)`
universe u v w z
open Finset Matrix Polynomial
variable {R : Type u} [CommRing R]
variable {n G : Type v} [DecidableEq n] [Fintype n]
variable {Ξ± Ξ² : Type v} [DecidableEq Ξ±]
variable {M : Matrix n n R}
namespace Matrix
theorem charmatrix_apply_natDegree [Nontrivial R] (i j : n) :
(charmatrix M i j).natDegree = ite (i = j) 1 0 := by
by_cases h : i = j <;> simp [h, β degree_eq_iff_natDegree_eq_of_pos (Nat.succ_pos 0)]
#align charmatrix_apply_nat_degree Matrix.charmatrix_apply_natDegree
theorem charmatrix_apply_natDegree_le (i j : n) :
(charmatrix M i j).natDegree β€ ite (i = j) 1 0 := by
split_ifs with h <;> simp [h, natDegree_X_le]
#align charmatrix_apply_nat_degree_le Matrix.charmatrix_apply_natDegree_le
variable (M)
theorem charpoly_sub_diagonal_degree_lt :
(M.charpoly - β i : n, (X - C (M i i))).degree < β(Fintype.card n - 1) := by
rw [charpoly, det_apply', β insert_erase (mem_univ (Equiv.refl n)),
sum_insert (not_mem_erase (Equiv.refl n) univ), add_comm]
simp only [charmatrix_apply_eq, one_mul, Equiv.Perm.sign_refl, id, Int.cast_one,
Units.val_one, add_sub_cancel_right, Equiv.coe_refl]
rw [β mem_degreeLT]
apply Submodule.sum_mem (degreeLT R (Fintype.card n - 1))
intro c hc; rw [β C_eq_intCast, C_mul']
apply Submodule.smul_mem (degreeLT R (Fintype.card n - 1)) ββ(Equiv.Perm.sign c)
rw [mem_degreeLT]
apply lt_of_le_of_lt degree_le_natDegree _
rw [Nat.cast_lt]
apply lt_of_le_of_lt _ (Equiv.Perm.fixed_point_card_lt_of_ne_one (ne_of_mem_erase hc))
apply le_trans (Polynomial.natDegree_prod_le univ fun i : n => charmatrix M (c i) i) _
rw [card_eq_sum_ones]; rw [sum_filter]; apply sum_le_sum
intros
apply charmatrix_apply_natDegree_le
#align matrix.charpoly_sub_diagonal_degree_lt Matrix.charpoly_sub_diagonal_degree_lt
theorem charpoly_coeff_eq_prod_coeff_of_le {k : β} (h : Fintype.card n - 1 β€ k) :
M.charpoly.coeff k = (β i : n, (X - C (M i i))).coeff k := by
apply eq_of_sub_eq_zero; rw [β coeff_sub]
apply Polynomial.coeff_eq_zero_of_degree_lt
apply lt_of_lt_of_le (charpoly_sub_diagonal_degree_lt M) ?_
rw [Nat.cast_le]; apply h
#align matrix.charpoly_coeff_eq_prod_coeff_of_le Matrix.charpoly_coeff_eq_prod_coeff_of_le
theorem det_of_card_zero (h : Fintype.card n = 0) (M : Matrix n n R) : M.det = 1 := by
rw [Fintype.card_eq_zero_iff] at h
suffices M = 1 by simp [this]
ext i
exact h.elim i
#align matrix.det_of_card_zero Matrix.det_of_card_zero
| Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean | 96 | 119 | theorem charpoly_degree_eq_dim [Nontrivial R] (M : Matrix n n R) :
M.charpoly.degree = Fintype.card n := by |
by_cases h : Fintype.card n = 0
Β· rw [h]
unfold charpoly
rw [det_of_card_zero]
Β· simp
Β· assumption
rw [β sub_add_cancel M.charpoly (β i : n, (X - C (M i i)))]
-- Porting note: added `β` in front of `Fintype.card n`
have h1 : (β i : n, (X - C (M i i))).degree = β(Fintype.card n) := by
rw [degree_eq_iff_natDegree_eq_of_pos (Nat.pos_of_ne_zero h), natDegree_prod']
Β· simp_rw [natDegree_X_sub_C]
rw [β Finset.card_univ, sum_const, smul_eq_mul, mul_one]
simp_rw [(monic_X_sub_C _).leadingCoeff]
simp
rw [degree_add_eq_right_of_degree_lt]
Β· exact h1
rw [h1]
apply lt_trans (charpoly_sub_diagonal_degree_lt M)
rw [Nat.cast_lt]
rw [β Nat.pred_eq_sub_one]
apply Nat.pred_lt
apply h
| [
" (M.charmatrix i j).natDegree = if i = j then 1 else 0",
" (M.charmatrix i j).natDegree β€ if i = j then 1 else 0",
" (M.charmatrix i j).natDegree β€ 1",
" (M.charmatrix i j).natDegree β€ 0",
" (M.charpoly - β i : n, (X - C (M i i))).degree < β(Fintype.card n - 1)",
" (β x β univ.erase (Equiv.refl n), ββ(Eq... | [
" (M.charmatrix i j).natDegree = if i = j then 1 else 0",
" (M.charmatrix i j).natDegree β€ if i = j then 1 else 0",
" (M.charmatrix i j).natDegree β€ 1",
" (M.charmatrix i j).natDegree β€ 0",
" (M.charpoly - β i : n, (X - C (M i i))).degree < β(Fintype.card n - 1)",
" (β x β univ.erase (Equiv.refl n), ββ(Eq... |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : β} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {Ξ± : Type*} {Ξ² : Type*}
local notation "π" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : Ξ± β Ξ²) : π Ξ± β π Ξ² := fun x => mk _ (f β x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : Ξ± β Ξ²) (hf : Injective f) : Injective (mapFun f : π Ξ± β π Ξ²) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : Ξ± β Ξ²) (hf : Surjective f) : Surjective (mapFun f : π Ξ± β π Ξ²) := fun x =>
β¨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]β©
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : π R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R β+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_evalβHom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply evalβHom_congr (RingHom.ext_int _ _) _ rfl <;>
ext β¨i, kβ© <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : π R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : π R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac
#align witt_vector.map_fun.mul WittVector.mapFun.mul
theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac
#align witt_vector.map_fun.neg WittVector.mapFun.neg
| Mathlib/RingTheory/WittVector/Basic.lean | 120 | 120 | theorem nsmul (n : β) (x : WittVector p R) : mapFun f (n β’ x) = n β’ mapFun f x := by | map_fun_tac
| [
" Injective (mapFun f)",
" aββ = aββ",
" aββ.coeff p = aββ.coeff p",
" mapFun f (mk p fun n => Classical.choose β―) = x",
" (mapFun f (mk p fun n => Classical.choose β―)).coeff n = x.coeff n",
" mapFun (βf) 0 = 0",
" mapFun (βf) 1 = 1",
" mapFun (βf) (x + y) = mapFun (βf) x + mapFun (βf) y",
" mapFun ... | [
" Injective (mapFun f)",
" aββ = aββ",
" aββ.coeff p = aββ.coeff p",
" mapFun f (mk p fun n => Classical.choose β―) = x",
" (mapFun f (mk p fun n => Classical.choose β―)).coeff n = x.coeff n",
" mapFun (βf) 0 = 0",
" mapFun (βf) 1 = 1",
" mapFun (βf) (x + y) = mapFun (βf) x + mapFun (βf) y",
" mapFun ... |
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
| Mathlib/Data/Real/GoldenRatio.lean | 79 | 80 | theorem one_sub_gold : 1 - Ο = Ο := by |
linarith [gold_add_goldConj]
| [
" Οβ»ΒΉ = -Ο",
" 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 - Ο = Ο"
] | [
" Οβ»ΒΉ = -Ο",
" 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 - Ο = Ο"
] |
import Mathlib.Data.Nat.Count
import Mathlib.Data.Nat.SuccPred
import Mathlib.Order.Interval.Set.Monotone
import Mathlib.Order.OrderIsoNat
#align_import data.nat.nth from "leanprover-community/mathlib"@"7fdd4f3746cb059edfdb5d52cba98f66fce418c0"
open Finset
namespace Nat
variable (p : β β Prop)
noncomputable def nth (p : β β Prop) (n : β) : β := by
classical exact
if h : Set.Finite (setOf p) then (h.toFinset.sort (Β· β€ Β·)).getD n 0
else @Nat.Subtype.orderIsoOfNat (setOf p) (Set.Infinite.to_subtype h) n
#align nat.nth Nat.nth
variable {p}
theorem nth_of_card_le (hf : (setOf p).Finite) {n : β} (hn : hf.toFinset.card β€ n) :
nth p n = 0 := by rw [nth, dif_pos hf, List.getD_eq_default]; rwa [Finset.length_sort]
#align nat.nth_of_card_le Nat.nth_of_card_le
theorem nth_eq_getD_sort (h : (setOf p).Finite) (n : β) :
nth p n = (h.toFinset.sort (Β· β€ Β·)).getD n 0 :=
dif_pos h
#align nat.nth_eq_nthd_sort Nat.nth_eq_getD_sort
theorem nth_eq_orderEmbOfFin (hf : (setOf p).Finite) {n : β} (hn : n < hf.toFinset.card) :
nth p n = hf.toFinset.orderEmbOfFin rfl β¨n, hnβ© := by
rw [nth_eq_getD_sort hf, Finset.orderEmbOfFin_apply, List.getD_eq_get]
#align nat.nth_eq_order_emb_of_fin Nat.nth_eq_orderEmbOfFin
theorem nth_strictMonoOn (hf : (setOf p).Finite) :
StrictMonoOn (nth p) (Set.Iio hf.toFinset.card) := by
rintro m (hm : m < _) n (hn : n < _) h
simp only [nth_eq_orderEmbOfFin, *]
exact OrderEmbedding.strictMono _ h
#align nat.nth_strict_mono_on Nat.nth_strictMonoOn
theorem nth_lt_nth_of_lt_card (hf : (setOf p).Finite) {m n : β} (h : m < n)
(hn : n < hf.toFinset.card) : nth p m < nth p n :=
nth_strictMonoOn hf (h.trans hn) hn h
#align nat.nth_lt_nth_of_lt_card Nat.nth_lt_nth_of_lt_card
theorem nth_le_nth_of_lt_card (hf : (setOf p).Finite) {m n : β} (h : m β€ n)
(hn : n < hf.toFinset.card) : nth p m β€ nth p n :=
(nth_strictMonoOn hf).monotoneOn (h.trans_lt hn) hn h
#align nat.nth_le_nth_of_lt_card Nat.nth_le_nth_of_lt_card
theorem lt_of_nth_lt_nth_of_lt_card (hf : (setOf p).Finite) {m n : β} (h : nth p m < nth p n)
(hm : m < hf.toFinset.card) : m < n :=
not_le.1 fun hle => h.not_le <| nth_le_nth_of_lt_card hf hle hm
#align nat.lt_of_nth_lt_nth_of_lt_card Nat.lt_of_nth_lt_nth_of_lt_card
theorem le_of_nth_le_nth_of_lt_card (hf : (setOf p).Finite) {m n : β} (h : nth p m β€ nth p n)
(hm : m < hf.toFinset.card) : m β€ n :=
not_lt.1 fun hlt => h.not_lt <| nth_lt_nth_of_lt_card hf hlt hm
#align nat.le_of_nth_le_nth_of_lt_card Nat.le_of_nth_le_nth_of_lt_card
theorem nth_injOn (hf : (setOf p).Finite) : (Set.Iio hf.toFinset.card).InjOn (nth p) :=
(nth_strictMonoOn hf).injOn
#align nat.nth_inj_on Nat.nth_injOn
theorem range_nth_of_finite (hf : (setOf p).Finite) : Set.range (nth p) = insert 0 (setOf p) := by
simpa only [β nth_eq_getD_sort hf, mem_sort, Set.Finite.mem_toFinset]
using Set.range_list_getD (hf.toFinset.sort (Β· β€ Β·)) 0
#align nat.range_nth_of_finite Nat.range_nth_of_finite
@[simp]
theorem image_nth_Iio_card (hf : (setOf p).Finite) : nth p '' Set.Iio hf.toFinset.card = setOf p :=
calc
nth p '' Set.Iio hf.toFinset.card = Set.range (hf.toFinset.orderEmbOfFin rfl) := by
ext x
simp only [Set.mem_image, Set.mem_range, Fin.exists_iff, β nth_eq_orderEmbOfFin hf,
Set.mem_Iio, exists_prop]
_ = setOf p := by rw [range_orderEmbOfFin, Set.Finite.coe_toFinset]
#align nat.image_nth_Iio_card Nat.image_nth_Iio_card
theorem nth_mem_of_lt_card {n : β} (hf : (setOf p).Finite) (hlt : n < hf.toFinset.card) :
p (nth p n) :=
(image_nth_Iio_card hf).subset <| Set.mem_image_of_mem _ hlt
#align nat.nth_mem_of_lt_card Nat.nth_mem_of_lt_card
theorem exists_lt_card_finite_nth_eq (hf : (setOf p).Finite) {x} (h : p x) :
β n, n < hf.toFinset.card β§ nth p n = x := by
rwa [β @Set.mem_setOf_eq _ _ p, β image_nth_Iio_card hf] at h
#align nat.exists_lt_card_finite_nth_eq Nat.exists_lt_card_finite_nth_eq
| Mathlib/Data/Nat/Nth.lean | 137 | 138 | theorem nth_apply_eq_orderIsoOfNat (hf : (setOf p).Infinite) (n : β) :
nth p n = @Nat.Subtype.orderIsoOfNat (setOf p) hf.to_subtype n := by | rw [nth, dif_neg hf]
| [
" β",
" nth p n = 0",
" (sort (fun x x_1 => x β€ x_1) hf.toFinset).length β€ n",
" nth p n = (hf.toFinset.orderEmbOfFin β―) β¨n, hnβ©",
" StrictMonoOn (nth p) (Set.Iio hf.toFinset.card)",
" nth p m < nth p n",
" (β―.toFinset.orderEmbOfFin β―) β¨m, β―β© < (β―.toFinset.orderEmbOfFin β―) β¨n, β―β©",
" Set.range (nth p)... | [
" β",
" nth p n = 0",
" (sort (fun x x_1 => x β€ x_1) hf.toFinset).length β€ n",
" nth p n = (hf.toFinset.orderEmbOfFin β―) β¨n, hnβ©",
" StrictMonoOn (nth p) (Set.Iio hf.toFinset.card)",
" nth p m < nth p n",
" (β―.toFinset.orderEmbOfFin β―) β¨m, β―β© < (β―.toFinset.orderEmbOfFin β―) β¨n, β―β©",
" Set.range (nth p)... |
import Mathlib.Analysis.Calculus.ContDiff.RCLike
import Mathlib.MeasureTheory.Measure.Hausdorff
#align_import topology.metric_space.hausdorff_dimension from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
open scoped MeasureTheory ENNReal NNReal Topology
open MeasureTheory MeasureTheory.Measure Set TopologicalSpace FiniteDimensional Filter
variable {ΞΉ X Y : Type*} [EMetricSpace X] [EMetricSpace Y]
@[irreducible] noncomputable def dimH (s : Set X) : ββ₯0β := by
borelize X; exact β¨ (d : ββ₯0) (_ : @hausdorffMeasure X _ _ β¨rflβ© d s = β), d
set_option linter.uppercaseLean3 false in
#align dimH dimH
section Measurable
variable [MeasurableSpace X] [BorelSpace X]
theorem dimH_def (s : Set X) : dimH s = β¨ (d : ββ₯0) (_ : ΞΌH[d] s = β), (d : ββ₯0β) := by
borelize X; rw [dimH]
set_option linter.uppercaseLean3 false in
#align dimH_def dimH_def
theorem hausdorffMeasure_of_lt_dimH {s : Set X} {d : ββ₯0} (h : βd < dimH s) : ΞΌH[d] s = β := by
simp only [dimH_def, lt_iSup_iff] at h
rcases h with β¨d', hsd', hdd'β©
rw [ENNReal.coe_lt_coe, β NNReal.coe_lt_coe] at hdd'
exact top_unique (hsd' βΈ hausdorffMeasure_mono hdd'.le _)
set_option linter.uppercaseLean3 false in
#align hausdorff_measure_of_lt_dimH hausdorffMeasure_of_lt_dimH
theorem dimH_le {s : Set X} {d : ββ₯0β} (H : β d' : ββ₯0, ΞΌH[d'] s = β β βd' β€ d) : dimH s β€ d :=
(dimH_def s).trans_le <| iSupβ_le H
set_option linter.uppercaseLean3 false in
#align dimH_le dimH_le
theorem dimH_le_of_hausdorffMeasure_ne_top {s : Set X} {d : ββ₯0} (h : ΞΌH[d] s β β) : dimH s β€ d :=
le_of_not_lt <| mt hausdorffMeasure_of_lt_dimH h
set_option linter.uppercaseLean3 false in
#align dimH_le_of_hausdorff_measure_ne_top dimH_le_of_hausdorffMeasure_ne_top
theorem le_dimH_of_hausdorffMeasure_eq_top {s : Set X} {d : ββ₯0} (h : ΞΌH[d] s = β) :
βd β€ dimH s := by
rw [dimH_def]; exact le_iSupβ (Ξ± := ββ₯0β) d h
set_option linter.uppercaseLean3 false in
#align le_dimH_of_hausdorff_measure_eq_top le_dimH_of_hausdorffMeasure_eq_top
| Mathlib/Topology/MetricSpace/HausdorffDimension.lean | 139 | 144 | theorem hausdorffMeasure_of_dimH_lt {s : Set X} {d : ββ₯0} (h : dimH s < d) : ΞΌH[d] s = 0 := by |
rw [dimH_def] at h
rcases ENNReal.lt_iff_exists_nnreal_btwn.1 h with β¨d', hsd', hd'dβ©
rw [ENNReal.coe_lt_coe, β NNReal.coe_lt_coe] at hd'd
exact (hausdorffMeasure_zero_or_top hd'd s).resolve_right fun hβ => hsd'.not_le <|
le_iSupβ (Ξ± := ββ₯0β) d' hβ
| [
" ββ₯0β",
" dimH s = β¨ d, β¨ (_ : ΞΌH[βd] s = β€), βd",
" ΞΌH[βd] s = β€",
" βd β€ dimH s",
" βd β€ β¨ d, β¨ (_ : ΞΌH[βd] s = β€), βd",
" ΞΌH[βd] s = 0"
] | [
" ββ₯0β",
" dimH s = β¨ d, β¨ (_ : ΞΌH[βd] s = β€), βd",
" ΞΌH[βd] s = β€",
" βd β€ dimH s",
" βd β€ β¨ d, β¨ (_ : ΞΌH[βd] s = β€), βd",
" ΞΌH[βd] s = 0"
] |
import Mathlib.Algebra.Polynomial.DenomsClearable
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Data.Real.Irrational
import Mathlib.Topology.Algebra.Polynomial
#align_import number_theory.liouville.basic from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
def Liouville (x : β) :=
β n : β, β a b : β€, 1 < b β§ x β a / b β§ |x - a / b| < 1 / (b : β) ^ n
#align liouville Liouville
namespace Liouville
protected theorem irrational {x : β} (h : Liouville x) : Irrational x := by
-- By contradiction, `x = a / b`, with `a β β€`, `0 < b β β` is a Liouville number,
rintro β¨β¨a, b, bN0, copβ©, rflβ©
-- clear up the mess of constructions of rationals
rw [Rat.cast_mk'] at h
-- Since `a / b` is a Liouville number, there are `p, q β β€`, with `q1 : 1 < q`,β
-- `a0 : a / b β p / q` and `a1 : |a / b - p / q| < 1 / q ^ (b + 1)`
rcases h (b + 1) with β¨p, q, q1, a0, a1β©
-- A few useful inequalities
have qR0 : (0 : β) < q := Int.cast_pos.mpr (zero_lt_one.trans q1)
have b0 : (b : β) β 0 := Nat.cast_ne_zero.mpr bN0
have bq0 : (0 : β) < b * q := mul_pos (Nat.cast_pos.mpr bN0.bot_lt) qR0
-- At a1, clear denominators...
replace a1 : |a * q - b * p| * q ^ (b + 1) < b * q := by
rw [div_sub_div _ _ b0 qR0.ne', abs_div, div_lt_div_iff (abs_pos.mpr bq0.ne') (pow_pos qR0 _),
abs_of_pos bq0, one_mul] at a1
exact mod_cast a1
-- At a0, clear denominators...
replace a0 : a * q - βb * p β 0 := by
rw [Ne, div_eq_div_iff b0 qR0.ne', mul_comm (p : β), β sub_eq_zero] at a0
exact mod_cast a0
-- Actually, `q` is a natural number
lift q to β using (zero_lt_one.trans q1).le
-- Looks innocuous, but we now have an integer with non-zero absolute value: this is at
-- least one away from zero. The gain here is what gets the proof going.
have ap : 0 < |a * βq - βb * p| := abs_pos.mpr a0
-- Actually, the absolute value of an integer is a natural number
-- FIXME: This `lift` call duplicates the hypotheses `a1` and `ap`
lift |a * βq - βb * p| to β using abs_nonneg (a * βq - βb * p) with e he
norm_cast at a1 ap q1
-- Recall this is by contradiction: we obtained the inequality `b * q β€ x * q ^ (b + 1)`, so
-- we are done.
exact not_le.mpr a1 (Nat.mul_lt_mul_pow_succ ap q1).le
#align liouville.irrational Liouville.irrational
open Polynomial Metric Set Real RingHom
open scoped Polynomial
theorem exists_one_le_pow_mul_dist {Z N R : Type*} [PseudoMetricSpace R] {d : N β β}
{j : Z β N β R} {f : R β R} {Ξ± : R} {Ξ΅ M : β}
-- denominators are positive
(d0 : β a : N, 1 β€ d a)
(e0 : 0 < Ξ΅)
-- function is Lipschitz at Ξ±
(B : β β¦y : Rβ¦, y β closedBall Ξ± Ξ΅ β dist (f Ξ±) (f y) β€ dist Ξ± y * M)
-- clear denominators
(L : β β¦z : Zβ¦, β β¦a : Nβ¦, j z a β closedBall Ξ± Ξ΅ β 1 β€ d a * dist (f Ξ±) (f (j z a))) :
β A : β, 0 < A β§ β z : Z, β a : N, 1 β€ d a * (dist Ξ± (j z a) * A) := by
-- A useful inequality to keep at hand
have me0 : 0 < max (1 / Ξ΅) M := lt_max_iff.mpr (Or.inl (one_div_pos.mpr e0))
-- The maximum between `1 / Ξ΅` and `M` works
refine β¨max (1 / Ξ΅) M, me0, fun z a => ?_β©
-- First, let's deal with the easy case in which we are far away from `Ξ±`
by_cases dm1 : 1 β€ dist Ξ± (j z a) * max (1 / Ξ΅) M
Β· exact one_le_mul_of_one_le_of_one_le (d0 a) dm1
Β· -- `j z a = z / (a + 1)`: we prove that this ratio is close to `Ξ±`
have : j z a β closedBall Ξ± Ξ΅ := by
refine mem_closedBall'.mp (le_trans ?_ ((one_div_le me0 e0).mpr (le_max_left _ _)))
exact (le_div_iff me0).mpr (not_le.mp dm1).le
-- use the "separation from `1`" (assumption `L`) for numerators,
refine (L this).trans ?_
-- remove a common factor and use the Lipschitz assumption `B`
refine mul_le_mul_of_nonneg_left ((B this).trans ?_) (zero_le_one.trans (d0 a))
exact mul_le_mul_of_nonneg_left (le_max_right _ M) dist_nonneg
#align liouville.exists_one_le_pow_mul_dist Liouville.exists_one_le_pow_mul_dist
| Mathlib/NumberTheory/Liouville/Basic.lean | 123 | 173 | theorem exists_pos_real_of_irrational_root {Ξ± : β} (ha : Irrational Ξ±) {f : β€[X]} (f0 : f β 0)
(fa : eval Ξ± (map (algebraMap β€ β) f) = 0) :
β A : β, 0 < A β§ β a : β€, β b : β,
(1 : β) β€ ((b : β) + 1) ^ f.natDegree * (|Ξ± - a / (b + 1)| * A) := by |
-- `fR` is `f` viewed as a polynomial with `β` coefficients.
set fR : β[X] := map (algebraMap β€ β) f
-- `fR` is non-zero, since `f` is non-zero.
obtain fR0 : fR β 0 := fun fR0 =>
(map_injective (algebraMap β€ β) fun _ _ A => Int.cast_inj.mp A).ne f0
(fR0.trans (Polynomial.map_zero _).symm)
-- reformulating assumption `fa`: `Ξ±` is a root of `fR`.
have ar : Ξ± β (fR.roots.toFinset : Set β) :=
Finset.mem_coe.mpr (Multiset.mem_toFinset.mpr ((mem_roots fR0).mpr (IsRoot.def.mpr fa)))
-- Since the polynomial `fR` has finitely many roots, there is a closed interval centered at `Ξ±`
-- such that `Ξ±` is the only root of `fR` in the interval.
obtain β¨ΞΆ, z0, Uβ© : β ΞΆ > 0, closedBall Ξ± ΞΆ β© fR.roots.toFinset = {Ξ±} :=
@exists_closedBall_inter_eq_singleton_of_discrete _ _ _ discrete_of_t1_of_finite _ ar
-- Since `fR` is continuous, it is bounded on the interval above.
obtain β¨xm, -, hMβ© : β xm : β, xm β Icc (Ξ± - ΞΆ) (Ξ± + ΞΆ) β§
IsMaxOn (|fR.derivative.eval Β·|) (Icc (Ξ± - ΞΆ) (Ξ± + ΞΆ)) xm :=
IsCompact.exists_isMaxOn isCompact_Icc
β¨Ξ±, (sub_lt_self Ξ± z0).le, (lt_add_of_pos_right Ξ± z0).leβ©
(continuous_abs.comp fR.derivative.continuous_aeval).continuousOn
-- Use the key lemma `exists_one_le_pow_mul_dist`: we are left to show that ...
refine
@exists_one_le_pow_mul_dist β€ β β _ _ _ (fun y => fR.eval y) Ξ± ΞΆ |fR.derivative.eval xm| ?_ z0
(fun y hy => ?_) fun z a hq => ?_
-- 1: the denominators are positive -- essentially by definition;
Β· exact fun a => one_le_pow_of_one_le ((le_add_iff_nonneg_left 1).mpr a.cast_nonneg) _
-- 2: the polynomial `fR` is Lipschitz at `Ξ±` -- as its derivative continuous;
Β· rw [mul_comm]
rw [Real.closedBall_eq_Icc] at hy
-- apply the Mean Value Theorem: the bound on the derivative comes from differentiability.
refine
Convex.norm_image_sub_le_of_norm_deriv_le (fun _ _ => fR.differentiableAt)
(fun y h => by rw [fR.deriv]; exact hM h) (convex_Icc _ _) hy (mem_Icc_iff_abs_le.mp ?_)
exact @mem_closedBall_self β _ Ξ± ΞΆ (le_of_lt z0)
-- 3: the weird inequality of Liouville type with powers of the denominators.
Β· show 1 β€ (a + 1 : β) ^ f.natDegree * |eval Ξ± fR - eval ((z : β) / (a + 1)) fR|
rw [fa, zero_sub, abs_neg]
rw [show (a + 1 : β) = ((a + 1 : β) : β€) by norm_cast] at hq β’
-- key observation: the right-hand side of the inequality is an *integer*. Therefore,
-- if its absolute value is not at least one, then it vanishes. Proceed by contradiction
refine one_le_pow_mul_abs_eval_div (Int.natCast_succ_pos a) fun hy => ?_
-- As the evaluation of the polynomial vanishes, we found a root of `fR` that is rational.
-- We know that `Ξ±` is the only root of `fR` in our interval, and `Ξ±` is irrational:
-- follow your nose.
refine (irrational_iff_ne_rational Ξ±).mp ha z (a + 1) (mem_singleton_iff.mp ?_).symm
refine U.subset ?_
refine β¨hq, Finset.mem_coe.mp (Multiset.mem_toFinset.mpr ?_)β©
exact (mem_roots fR0).mpr (IsRoot.def.mpr hy)
| [
" Irrational x",
" False",
" |a * q - βb * p| * q ^ (b + 1) < βb * q",
" a * q - βb * p β 0",
" β A, 0 < A β§ β (z : Z) (a : N), 1 β€ d a * (dist Ξ± (j z a) * A)",
" 1 β€ d a * (dist Ξ± (j z a) * max (1 / Ξ΅) M)",
" j z a β closedBall Ξ± Ξ΅",
" dist Ξ± (j z a) β€ 1 / max (1 / Ξ΅) M",
" d a * dist (f Ξ±) (f (j z... | [
" Irrational x",
" False",
" |a * q - βb * p| * q ^ (b + 1) < βb * q",
" a * q - βb * p β 0",
" β A, 0 < A β§ β (z : Z) (a : N), 1 β€ d a * (dist Ξ± (j z a) * A)",
" 1 β€ d a * (dist Ξ± (j z a) * max (1 / Ξ΅) M)",
" j z a β closedBall Ξ± Ξ΅",
" dist Ξ± (j z a) β€ 1 / max (1 / Ξ΅) M",
" d a * dist (f Ξ±) (f (j z... |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.units from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Int
theorem isUnit_iff_abs_eq {x : β€} : IsUnit x β abs x = 1 := by
rw [isUnit_iff_natAbs_eq, abs_eq_natAbs, β Int.ofNat_one, natCast_inj]
#align int.is_unit_iff_abs_eq Int.isUnit_iff_abs_eq
theorem isUnit_sq {a : β€} (ha : IsUnit a) : a ^ 2 = 1 := by rw [sq, isUnit_mul_self ha]
#align int.is_unit_sq Int.isUnit_sq
@[simp]
theorem units_sq (u : β€Λ£) : u ^ 2 = 1 := by
rw [Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one, isUnit_sq u.isUnit]
#align int.units_sq Int.units_sq
alias units_pow_two := units_sq
#align int.units_pow_two Int.units_pow_two
@[simp]
theorem units_mul_self (u : β€Λ£) : u * u = 1 := by rw [β sq, units_sq]
#align int.units_mul_self Int.units_mul_self
@[simp]
theorem units_inv_eq_self (u : β€Λ£) : uβ»ΒΉ = u := by rw [inv_eq_iff_mul_eq_one, units_mul_self]
#align int.units_inv_eq_self Int.units_inv_eq_self
theorem units_div_eq_mul (uβ uβ : β€Λ£) : uβ / uβ = uβ * uβ := by
rw [div_eq_mul_inv, units_inv_eq_self]
-- `Units.val_mul` is a "wrong turn" for the simplifier, this undoes it and simplifies further
@[simp]
theorem units_coe_mul_self (u : β€Λ£) : (u * u : β€) = 1 := by
rw [β Units.val_mul, units_mul_self, Units.val_one]
#align int.units_coe_mul_self Int.units_coe_mul_self
| Mathlib/Data/Int/Order/Units.lean | 49 | 49 | theorem neg_one_pow_ne_zero {n : β} : (-1 : β€) ^ n β 0 := by | simp
| [
" IsUnit x β |x| = 1",
" a ^ 2 = 1",
" u ^ 2 = 1",
" u * u = 1",
" uβ»ΒΉ = u",
" uβ / uβ = uβ * uβ",
" βu * βu = 1",
" (-1) ^ n β 0"
] | [
" IsUnit x β |x| = 1",
" a ^ 2 = 1",
" u ^ 2 = 1",
" u * u = 1",
" uβ»ΒΉ = u",
" uβ / uβ = uβ * uβ",
" βu * βu = 1",
" (-1) ^ n β 0"
] |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.Normed.Field.InfiniteSum
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.normed_space.exponential from "leanprover-community/mathlib"@"62748956a1ece9b26b33243e2e3a2852176666f5"
namespace NormedSpace
open Filter RCLike ContinuousMultilinearMap NormedField Asymptotics
open scoped Nat Topology ENNReal
section TopologicalAlgebra
variable (π πΈ : Type*) [Field π] [Ring πΈ] [Algebra π πΈ] [TopologicalSpace πΈ] [TopologicalRing πΈ]
def expSeries : FormalMultilinearSeries π πΈ πΈ := fun n =>
(n !β»ΒΉ : π) β’ ContinuousMultilinearMap.mkPiAlgebraFin π n πΈ
#align exp_series NormedSpace.expSeries
variable {πΈ}
noncomputable def exp (x : πΈ) : πΈ :=
(expSeries π πΈ).sum x
#align exp NormedSpace.exp
variable {π}
theorem expSeries_apply_eq (x : πΈ) (n : β) :
(expSeries π πΈ n fun _ => x) = (n !β»ΒΉ : π) β’ x ^ n := by simp [expSeries]
#align exp_series_apply_eq NormedSpace.expSeries_apply_eq
theorem expSeries_apply_eq' (x : πΈ) :
(fun n => expSeries π πΈ n fun _ => x) = fun n => (n !β»ΒΉ : π) β’ x ^ n :=
funext (expSeries_apply_eq x)
#align exp_series_apply_eq' NormedSpace.expSeries_apply_eq'
theorem expSeries_sum_eq (x : πΈ) : (expSeries π πΈ).sum x = β' n : β, (n !β»ΒΉ : π) β’ x ^ n :=
tsum_congr fun n => expSeries_apply_eq x n
#align exp_series_sum_eq NormedSpace.expSeries_sum_eq
theorem exp_eq_tsum : exp π = fun x : πΈ => β' n : β, (n !β»ΒΉ : π) β’ x ^ n :=
funext expSeries_sum_eq
#align exp_eq_tsum NormedSpace.exp_eq_tsum
theorem expSeries_apply_zero (n : β) :
(expSeries π πΈ n fun _ => (0 : πΈ)) = Pi.single (f := fun _ => πΈ) 0 1 n := by
rw [expSeries_apply_eq]
cases' n with n
Β· rw [pow_zero, Nat.factorial_zero, Nat.cast_one, inv_one, one_smul, Pi.single_eq_same]
Β· rw [zero_pow (Nat.succ_ne_zero _), smul_zero, Pi.single_eq_of_ne n.succ_ne_zero]
#align exp_series_apply_zero NormedSpace.expSeries_apply_zero
@[simp]
theorem exp_zero : exp π (0 : πΈ) = 1 := by
simp_rw [exp_eq_tsum, β expSeries_apply_eq, expSeries_apply_zero, tsum_pi_single]
#align exp_zero NormedSpace.exp_zero
@[simp]
theorem exp_op [T2Space πΈ] (x : πΈ) : exp π (MulOpposite.op x) = MulOpposite.op (exp π x) := by
simp_rw [exp, expSeries_sum_eq, β MulOpposite.op_pow, β MulOpposite.op_smul, tsum_op]
#align exp_op NormedSpace.exp_op
@[simp]
theorem exp_unop [T2Space πΈ] (x : πΈα΅α΅α΅) :
exp π (MulOpposite.unop x) = MulOpposite.unop (exp π x) := by
simp_rw [exp, expSeries_sum_eq, β MulOpposite.unop_pow, β MulOpposite.unop_smul, tsum_unop]
#align exp_unop NormedSpace.exp_unop
theorem star_exp [T2Space πΈ] [StarRing πΈ] [ContinuousStar πΈ] (x : πΈ) :
star (exp π x) = exp π (star x) := by
simp_rw [exp_eq_tsum, β star_pow, β star_inv_natCast_smul, β tsum_star]
#align star_exp NormedSpace.star_exp
variable (π)
theorem _root_.IsSelfAdjoint.exp [T2Space πΈ] [StarRing πΈ] [ContinuousStar πΈ] {x : πΈ}
(h : IsSelfAdjoint x) : IsSelfAdjoint (exp π x) :=
(star_exp x).trans <| h.symm βΈ rfl
#align is_self_adjoint.exp IsSelfAdjoint.exp
| Mathlib/Analysis/NormedSpace/Exponential.lean | 172 | 175 | theorem _root_.Commute.exp_right [T2Space πΈ] {x y : πΈ} (h : Commute x y) :
Commute x (exp π y) := by |
rw [exp_eq_tsum]
exact Commute.tsum_right x fun n => (h.pow_right n).smul_right _
| [
" ((expSeries π πΈ n) fun x_1 => x) = (βn !)β»ΒΉ β’ x ^ n",
" ((expSeries π πΈ n) fun x => 0) = Pi.single 0 1 n",
" (βn !)β»ΒΉ β’ 0 ^ n = Pi.single 0 1 n",
" (β0!)β»ΒΉ β’ 0 ^ 0 = Pi.single 0 1 0",
" (β(n + 1)!)β»ΒΉ β’ 0 ^ (n + 1) = Pi.single 0 1 (n + 1)",
" exp π 0 = 1",
" exp π (MulOpposite.op x) = MulOpposite... | [
" ((expSeries π πΈ n) fun x_1 => x) = (βn !)β»ΒΉ β’ x ^ n",
" ((expSeries π πΈ n) fun x => 0) = Pi.single 0 1 n",
" (βn !)β»ΒΉ β’ 0 ^ n = Pi.single 0 1 n",
" (β0!)β»ΒΉ β’ 0 ^ 0 = Pi.single 0 1 0",
" (β(n + 1)!)β»ΒΉ β’ 0 ^ (n + 1) = Pi.single 0 1 (n + 1)",
" exp π 0 = 1",
" exp π (MulOpposite.op x) = MulOpposite... |
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]
| Mathlib/Algebra/CharP/Two.lean | 33 | 33 | theorem add_self_eq_zero (x : R) : x + x = 0 := by | rw [β two_smul R x, two_eq_zero, zero_smul]
| [
" 2 = 0",
" x + x = 0"
] | [
" 2 = 0",
" x + x = 0"
] |
import Mathlib.LinearAlgebra.Dual
open Function Module
variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N]
structure PerfectPairing :=
toLin : M ββ[R] N ββ[R] R
bijectiveLeft : Bijective toLin
bijectiveRight : Bijective toLin.flip
attribute [nolint docBlame] PerfectPairing.toLin
variable {R M N}
namespace PerfectPairing
instance instFunLike : FunLike (PerfectPairing R M N) M (N ββ[R] R) where
coe f := f.toLin
coe_injective' x y h := by cases x; cases y; simpa using h
variable (p : PerfectPairing R M N)
protected def flip : PerfectPairing R N M where
toLin := p.toLin.flip
bijectiveLeft := p.bijectiveRight
bijectiveRight := p.bijectiveLeft
@[simp] lemma flip_flip : p.flip.flip = p := rfl
noncomputable def toDualLeft : M ββ[R] Dual R N :=
LinearEquiv.ofBijective p.toLin p.bijectiveLeft
@[simp]
theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a :=
rfl
@[simp]
| Mathlib/LinearAlgebra/PerfectPairing.lean | 71 | 74 | theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by |
have h := LinearEquiv.apply_symm_apply p.toDualLeft f
rw [toDualLeft_apply] at h
exact congrFun (congrArg DFunLike.coe h) x
| [
" x = y",
" { toLin := toLinβ, bijectiveLeft := bijectiveLeftβ, bijectiveRight := bijectiveRightβ } = y",
" { toLin := toLinβΒΉ, bijectiveLeft := bijectiveLeftβΒΉ, bijectiveRight := bijectiveRightβΒΉ } =\n { toLin := toLinβ, bijectiveLeft := bijectiveLeftβ, bijectiveRight := bijectiveRightβ }",
" (p (p.toDual... | [
" x = y",
" { toLin := toLinβ, bijectiveLeft := bijectiveLeftβ, bijectiveRight := bijectiveRightβ } = y",
" { toLin := toLinβΒΉ, bijectiveLeft := bijectiveLeftβΒΉ, bijectiveRight := bijectiveRightβΒΉ } =\n { toLin := toLinβ, bijectiveLeft := bijectiveLeftβ, bijectiveRight := bijectiveRightβ }",
" (p (p.toDual... |
import Mathlib.Topology.UniformSpace.CompactConvergence
import Mathlib.Topology.UniformSpace.Equicontinuity
import Mathlib.Topology.UniformSpace.Equiv
open Set Filter Uniformity Topology Function UniformConvergence
variable {ΞΉ X Y Ξ± Ξ² : Type*} [TopologicalSpace X] [UniformSpace Ξ±] [UniformSpace Ξ²]
variable {F : ΞΉ β X β Ξ±} {G : ΞΉ β Ξ² β Ξ±}
| Mathlib/Topology/UniformSpace/Ascoli.lean | 85 | 125 | theorem Equicontinuous.comap_uniformFun_eq [CompactSpace X] (F_eqcont : Equicontinuous F) :
(UniformFun.uniformSpace X Ξ±).comap F =
(Pi.uniformSpace _).comap F := by |
-- The `β€` inequality is trivial
refine le_antisymm (UniformSpace.comap_mono UniformFun.uniformContinuous_toFun) ?_
-- A bit of rewriting to get a nice intermediate statement.
change comap _ _ β€ comap _ _
simp_rw [Pi.uniformity, Filter.comap_iInf, comap_comap, Function.comp]
refine ((UniformFun.hasBasis_uniformity X Ξ±).comap (Prod.map F F)).ge_iff.mpr ?_
-- Core of the proof: we need to show that, for any entourage `U` in `Ξ±`,
-- the set `π(U) := {(i,j) : ΞΉ Γ ΞΉ | β x : X, (F i x, F j x) β U}` belongs to the filter
-- `β¨
x, comap ((i,j) β¦ (F i x, F j x)) (π€ Ξ±)`.
-- In other words, we have to show that it contains a finite intersection of
-- sets of the form `π(V, x) := {(i,j) : ΞΉ Γ ΞΉ | (F i x, F j x) β V}` for some
-- `x : X` and `V β π€ Ξ±`.
intro U hU
-- We will do an `Ξ΅/3` argument, so we start by choosing a symmetric entourage `V β π€ Ξ±`
-- such that `V β V β V β U`.
rcases comp_comp_symm_mem_uniformity_sets hU with β¨V, hV, Vsymm, hVUβ©
-- Set `Ξ© x := {y | β i, (F i x, F i y) β V}`. The equicontinuity of `F` guarantees that
-- each `Ξ© x` is a neighborhood of `x`.
let Ξ© x : Set X := {y | β i, (F i x, F i y) β V}
-- Hence, by compactness of `X`, we can find some `A β X` finite such that the `Ξ© a`s for `a β A`
-- still cover `X`.
rcases CompactSpace.elim_nhds_subcover Ξ© (fun x β¦ F_eqcont x V hV) with β¨A, Acoverβ©
-- We now claim that `β a β A, π(V, a) β π(U)`.
have : (β a β A, {ij : ΞΉ Γ ΞΉ | (F ij.1 a, F ij.2 a) β V}) β
(Prod.map F F) β»ΒΉ' UniformFun.gen X Ξ± U := by
-- Given `(i, j) β β a β A, π(V, a)` and `x : X`, we have to prove that `(F i x, F j x) β U`.
rintro β¨i, jβ© hij x
rw [mem_iInterβ] at hij
-- We know that `x β Ξ© a` for some `a β A`, so that both `(F i x, F i a)` and `(F j a, F j x)`
-- are in `V`.
rcases mem_iUnionβ.mp (Acover.symm.subset <| mem_univ x) with β¨a, ha, haxβ©
-- Since `(i, j) β π(V, a)` we also have `(F i a, F j a) β V`, and finally we get
-- `(F i x, F j x) β V β V β V β U`.
exact hVU (prod_mk_mem_compRel (prod_mk_mem_compRel
(Vsymm.mk_mem_comm.mp (hax i)) (hij a ha)) (hax j))
-- This completes the proof.
exact mem_of_superset
(A.iInter_mem_sets.mpr fun x _ β¦ mem_iInf_of_mem x <| preimage_mem_comap hV) this
| [
" UniformSpace.comap F (UniformFun.uniformSpace X Ξ±) = UniformSpace.comap F (Pi.uniformSpace fun i => Ξ±)",
" UniformSpace.comap F (Pi.uniformSpace fun i => Ξ±) β€ UniformSpace.comap F (UniformFun.uniformSpace X Ξ±)",
" comap (fun p => (F p.1, F p.2)) (π€ (X β Ξ±)) β€ comap (fun p => (F p.1, F p.2)) (π€ (X β Ξ±))",
... | [
" UniformSpace.comap F (UniformFun.uniformSpace X Ξ±) = UniformSpace.comap F (Pi.uniformSpace fun i => Ξ±)"
] |
import Mathlib.Algebra.Polynomial.Mirror
import Mathlib.Analysis.Complex.Polynomial
#align_import data.polynomial.unit_trinomial from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
namespace Polynomial
open scoped Polynomial
open Finset
section Semiring
variable {R : Type*} [Semiring R] (k m n : β) (u v w : R)
noncomputable def trinomial :=
C u * X ^ k + C v * X ^ m + C w * X ^ n
#align polynomial.trinomial Polynomial.trinomial
theorem trinomial_def : trinomial k m n u v w = C u * X ^ k + C v * X ^ m + C w * X ^ n :=
rfl
#align polynomial.trinomial_def Polynomial.trinomial_def
variable {k m n u v w}
theorem trinomial_leading_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff n = w := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg (hkm.trans hmn).ne', if_neg hmn.ne', if_pos rfl, zero_add, zero_add]
#align polynomial.trinomial_leading_coeff' Polynomial.trinomial_leading_coeff'
theorem trinomial_middle_coeff (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff m = v := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg hkm.ne', if_pos rfl, if_neg hmn.ne, zero_add, add_zero]
#align polynomial.trinomial_middle_coeff Polynomial.trinomial_middle_coeff
theorem trinomial_trailing_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff k = u := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_pos rfl, if_neg hkm.ne, if_neg (hkm.trans hmn).ne, add_zero, add_zero]
#align polynomial.trinomial_trailing_coeff' Polynomial.trinomial_trailing_coeff'
| Mathlib/Algebra/Polynomial/UnitTrinomial.lean | 67 | 78 | theorem trinomial_natDegree (hkm : k < m) (hmn : m < n) (hw : w β 0) :
(trinomial k m n u v w).natDegree = n := by |
refine
natDegree_eq_of_degree_eq_some
((Finset.sup_le fun i h => ?_).antisymm <|
le_degree_of_ne_zero <| by rwa [trinomial_leading_coeff' hkm hmn])
replace h := support_trinomial' k m n u v w h
rw [mem_insert, mem_insert, mem_singleton] at h
rcases h with (rfl | rfl | rfl)
Β· exact WithBot.coe_le_coe.mpr (hkm.trans hmn).le
Β· exact WithBot.coe_le_coe.mpr hmn.le
Β· exact le_rfl
| [
" (trinomial k m n u v w).coeff n = w",
" (trinomial k m n u v w).coeff m = v",
" (trinomial k m n u v w).coeff k = u",
" (trinomial k m n u v w).natDegree = n",
" (trinomial k m n u v w).coeff n β 0",
" βi β€ βn",
" βi β€ βi"
] | [
" (trinomial k m n u v w).coeff n = w",
" (trinomial k m n u v w).coeff m = v",
" (trinomial k m n u v w).coeff k = u",
" (trinomial k m n u v w).natDegree = n"
] |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ΞΉ Ξ± Ξ² : Type*} {Ο : ΞΉ β Type*}
def symmDiff [Sup Ξ±] [SDiff Ξ±] (a b : Ξ±) : Ξ± :=
a \ b β b \ a
#align symm_diff symmDiff
def bihimp [Inf Ξ±] [HImp Ξ±] (a b : Ξ±) : Ξ± :=
(b β¨ a) β (a β¨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " β " => symmDiff
scoped[symmDiff] infixl:100 " β " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup Ξ±] [SDiff Ξ±] (a b : Ξ±) : a β b = a \ b β b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf Ξ±] [HImp Ξ±] (a b : Ξ±) : a β b = (b β¨ a) β (a β¨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p β q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p β q β (p β q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
| Mathlib/Order/SymmDiff.lean | 96 | 96 | theorem Bool.symmDiff_eq_xor : β p q : Bool, p β q = xor p q := by | decide
| [
" β (p q : Bool), p β q = xor p q"
] | [
" β (p q : Bool), p β q = xor p q"
] |
import Mathlib.Topology.Homeomorph
import Mathlib.Topology.Order.LeftRightNhds
#align_import topology.algebra.order.monotone_continuity from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Set Filter
open Topology
section LinearOrder
variable {Ξ± Ξ² : Type*} [LinearOrder Ξ±] [TopologicalSpace Ξ±] [OrderTopology Ξ±]
variable [LinearOrder Ξ²] [TopologicalSpace Ξ²] [OrderTopology Ξ²]
theorem StrictMonoOn.continuousWithinAt_right_of_exists_between {f : Ξ± β Ξ²} {s : Set Ξ±} {a : Ξ±}
(h_mono : StrictMonoOn f s) (hs : s β π[β₯] a) (hfs : β b > f a, β c β s, f c β Ioc (f a) b) :
ContinuousWithinAt f (Ici a) a := by
have ha : a β Ici a := left_mem_Ici
have has : a β s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 β¨fun b hb => ?_, fun b hb => ?_β©
Β· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
((h_mono.le_iff_le has hxs).2 hxa)
Β· rcases hfs b hb with β¨c, hcs, hac, hcbβ©
rw [h_mono.lt_iff_lt has hcs] at hac
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 hac)]
rintro x hx β¨_, hxcβ©
exact ((h_mono.lt_iff_lt hx hcs).2 hxc).trans_le hcb
#align strict_mono_on.continuous_at_right_of_exists_between StrictMonoOn.continuousWithinAt_right_of_exists_between
| Mathlib/Topology/Order/MonotoneContinuity.lean | 63 | 75 | theorem continuousWithinAt_right_of_monotoneOn_of_exists_between {f : Ξ± β Ξ²} {s : Set Ξ±} {a : Ξ±}
(h_mono : MonotoneOn f s) (hs : s β π[β₯] a) (hfs : β b > f a, β c β s, f c β Ioo (f a) b) :
ContinuousWithinAt f (Ici a) a := by |
have ha : a β Ici a := left_mem_Ici
have has : a β s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 β¨fun b hb => ?_, fun b hb => ?_β©
Β· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
(h_mono has hxs hxa)
Β· rcases hfs b hb with β¨c, hcs, hac, hcbβ©
have : a < c := not_le.1 fun h => hac.not_le <| h_mono hcs has h
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 this)]
rintro x hx β¨_, hxcβ©
exact (h_mono hx hcs hxc.le).trans_lt hcb
| [
" ContinuousWithinAt f (Ici a) a",
" βαΆ (b_1 : Ξ±) in π[β₯] a, b < f b_1",
" βαΆ (b_1 : Ξ±) in π[β₯] a, f b_1 < b",
" β a_1 β s, a_1 β Ico a c β f a_1 < b",
" f x < b"
] | [
" ContinuousWithinAt f (Ici a) a",
" βαΆ (b_1 : Ξ±) in π[β₯] a, b < f b_1",
" βαΆ (b_1 : Ξ±) in π[β₯] a, f b_1 < b",
" β a_1 β s, a_1 β Ico a c β f a_1 < b",
" f x < b"
] |
import Batteries.Data.List.Basic
import Batteries.Data.List.Lemmas
open Nat
namespace List
section countP
variable (p q : Ξ± β Bool)
@[simp] theorem countP_nil : countP p [] = 0 := rfl
protected theorem countP_go_eq_add (l) : countP.go p l n = n + countP.go p l 0 := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
unfold countP.go
rw [ih (n := n + 1), ih (n := n), ih (n := 1)]
if h : p head then simp [h, Nat.add_assoc] else simp [h]
@[simp] theorem countP_cons_of_pos (l) (pa : p a) : countP p (a :: l) = countP p l + 1 := by
have : countP.go p (a :: l) 0 = countP.go p l 1 := show cond .. = _ by rw [pa]; rfl
unfold countP
rw [this, Nat.add_comm, List.countP_go_eq_add]
@[simp] theorem countP_cons_of_neg (l) (pa : Β¬p a) : countP p (a :: l) = countP p l := by
simp [countP, countP.go, pa]
theorem countP_cons (a : Ξ±) (l) : countP p (a :: l) = countP p l + if p a then 1 else 0 := by
by_cases h : p a <;> simp [h]
theorem length_eq_countP_add_countP (l) : length l = countP p l + countP (fun a => Β¬p a) l := by
induction l with
| nil => rfl
| cons x h ih =>
if h : p x then
rw [countP_cons_of_pos _ _ h, countP_cons_of_neg _ _ _, length, ih]
Β· rw [Nat.add_assoc, Nat.add_comm _ 1, Nat.add_assoc]
Β· simp only [h, not_true_eq_false, decide_False, not_false_eq_true]
else
rw [countP_cons_of_pos (fun a => Β¬p a) _ _, countP_cons_of_neg _ _ h, length, ih]
Β· rfl
Β· simp only [h, not_false_eq_true, decide_True]
theorem countP_eq_length_filter (l) : countP p l = length (filter p l) := by
induction l with
| nil => rfl
| cons x l ih =>
if h : p x
then rw [countP_cons_of_pos p l h, ih, filter_cons_of_pos l h, length]
else rw [countP_cons_of_neg p l h, ih, filter_cons_of_neg l h]
theorem countP_le_length : countP p l β€ l.length := by
simp only [countP_eq_length_filter]
apply length_filter_le
@[simp] theorem countP_append (lβ lβ) : countP p (lβ ++ lβ) = countP p lβ + countP p lβ := by
simp only [countP_eq_length_filter, filter_append, length_append]
theorem countP_pos : 0 < countP p l β β a β l, p a := by
simp only [countP_eq_length_filter, length_pos_iff_exists_mem, mem_filter, exists_prop]
theorem countP_eq_zero : countP p l = 0 β β a β l, Β¬p a := by
simp only [countP_eq_length_filter, length_eq_zero, filter_eq_nil]
| .lake/packages/batteries/Batteries/Data/List/Count.lean | 81 | 82 | theorem countP_eq_length : countP p l = l.length β β a β l, p a := by |
rw [countP_eq_length_filter, filter_length_eq_length]
| [
" countP.go p l n = n + countP.go p l 0",
" countP.go p [] n = n + countP.go p [] 0",
" countP.go p (head :: tail) n = n + countP.go p (head :: tail) 0",
" (bif p head then countP.go p tail (n + 1) else countP.go p tail n) =\n n + bif p head then countP.go p tail (0 + 1) else countP.go p tail 0",
" (bif ... | [
" countP.go p l n = n + countP.go p l 0",
" countP.go p [] n = n + countP.go p [] 0",
" countP.go p (head :: tail) n = n + countP.go p (head :: tail) 0",
" (bif p head then countP.go p tail (n + 1) else countP.go p tail n) =\n n + bif p head then countP.go p tail (0 + 1) else countP.go p tail 0",
" (bif ... |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.ParametricIntegral
import Mathlib.MeasureTheory.Constructions.Prod.Integral
import Mathlib.MeasureTheory.Function.LocallyIntegrable
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Group.Prod
import Mathlib.MeasureTheory.Integral.IntervalIntegral
#align_import analysis.convolution from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95"
open Set Function Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ContinuousLinearMap Metric Bornology
open scoped Pointwise Topology NNReal Filter
universe uπ uG uE uE' uE'' uF uF' uF'' uP
variable {π : Type uπ} {G : Type uG} {E : Type uE} {E' : Type uE'} {E'' : Type uE''} {F : Type uF}
{F' : Type uF'} {F'' : Type uF''} {P : Type uP}
variable [NormedAddCommGroup E] [NormedAddCommGroup E'] [NormedAddCommGroup E'']
[NormedAddCommGroup F] {f f' : G β E} {g g' : G β E'} {x x' : G} {y y' : E}
namespace MeasureTheory
section NontriviallyNormedField
variable [NontriviallyNormedField π]
variable [NormedSpace π E] [NormedSpace π E'] [NormedSpace π E''] [NormedSpace π F]
variable (L : E βL[π] E' βL[π] F)
section NoMeasurability
variable [AddGroup G] [TopologicalSpace G]
| Mathlib/Analysis/Convolution.lean | 118 | 128 | theorem convolution_integrand_bound_right_of_le_of_subset {C : β} (hC : β i, βg iβ β€ C) {x t : G}
{s u : Set G} (hx : x β s) (hu : -tsupport g + s β u) :
βL (f t) (g (x - t))β β€ u.indicator (fun t => βLβ * βf tβ * C) t := by |
-- Porting note: had to add `f := _`
refine le_indicator (f := fun t β¦ βL (f t) (g (x - t))β) (fun t _ => ?_) (fun t ht => ?_) t
Β· apply_rules [L.le_of_opNormβ_le_of_le, le_rfl]
Β· have : x - t β support g := by
refine mt (fun hxt => hu ?_) ht
refine β¨_, Set.neg_mem_neg.mpr (subset_closure hxt), _, hx, ?_β©
simp only [neg_sub, sub_add_cancel]
simp only [nmem_support.mp this, (L _).map_zero, norm_zero, le_rfl]
| [
" β(L (f t)) (g (x - t))β β€ u.indicator (fun t => βLβ * βf tβ * C) t",
" (fun t => β(L (f t)) (g (x - t))β) t β€ βLβ * βf tβ * C",
" (fun t => β(L (f t)) (g (x - t))β) t β€ 0",
" x - t β support g",
" t β -tsupport g + s",
" (fun x x_1 => x + x_1) (-(x - t)) x = t"
] | [
" β(L (f t)) (g (x - t))β β€ u.indicator (fun t => βLβ * βf tβ * C) t"
] |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.HasseDeriv
#align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace Polynomial
open Polynomial
variable {R : Type*} [Semiring R] (r : R) (f : R[X])
def taylor (r : R) : R[X] ββ[R] R[X] where
toFun f := f.comp (X + C r)
map_add' f g := add_comp
map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply]
#align polynomial.taylor Polynomial.taylor
theorem taylor_apply : taylor r f = f.comp (X + C r) :=
rfl
#align polynomial.taylor_apply Polynomial.taylor_apply
@[simp]
theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_X Polynomial.taylor_X
@[simp]
theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_C Polynomial.taylor_C
@[simp]
theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by
ext
simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp,
Function.comp_apply, LinearMap.coe_comp]
#align polynomial.taylor_zero' Polynomial.taylor_zero'
theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply]
#align polynomial.taylor_zero Polynomial.taylor_zero
@[simp]
theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [β C_1, taylor_C]
#align polynomial.taylor_one Polynomial.taylor_one
@[simp]
theorem taylor_monomial (i : β) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by
simp [taylor_apply]
#align polynomial.taylor_monomial Polynomial.taylor_monomial
theorem taylor_coeff (n : β) : (taylor r f).coeff n = (hasseDeriv n f).eval r :=
show (lcoeff R n).comp (taylor r) f = (leval r).comp (hasseDeriv n) f by
congr 1; clear! f; ext i
simp only [leval_apply, mul_one, one_mul, eval_monomial, LinearMap.comp_apply, coeff_C_mul,
hasseDeriv_monomial, taylor_apply, monomial_comp, C_1, (commute_X (C r)).add_pow i,
map_sum]
simp only [lcoeff_apply, β C_eq_natCast, mul_assoc, β C_pow, β C_mul, coeff_mul_C,
(Nat.cast_commute _ _).eq, coeff_X_pow, boole_mul, Finset.sum_ite_eq, Finset.mem_range]
split_ifs with h; Β· rfl
push_neg at h; rw [Nat.choose_eq_zero_of_lt h, Nat.cast_zero, mul_zero]
#align polynomial.taylor_coeff Polynomial.taylor_coeff
@[simp]
theorem taylor_coeff_zero : (taylor r f).coeff 0 = f.eval r := by
rw [taylor_coeff, hasseDeriv_zero, LinearMap.id_apply]
#align polynomial.taylor_coeff_zero Polynomial.taylor_coeff_zero
@[simp]
| Mathlib/Algebra/Polynomial/Taylor.lean | 93 | 94 | theorem taylor_coeff_one : (taylor r f).coeff 1 = f.derivative.eval r := by |
rw [taylor_coeff, hasseDeriv_one]
| [
" { toFun := fun f => f.comp (X + C r), map_add' := β― }.toFun (c β’ f) =\n (RingHom.id R) c β’ { toFun := fun f => f.comp (X + C r), map_add' := β― }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ββ monomial nβΒΉ) 1).coeff nβ = ((LinearMap.id ββ mono... | [
" { toFun := fun f => f.comp (X + C r), map_add' := β― }.toFun (c β’ f) =\n (RingHom.id R) c β’ { toFun := fun f => f.comp (X + C r), map_add' := β― }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ββ monomial nβΒΉ) 1).coeff nβ = ((LinearMap.id ββ mono... |
import Mathlib.RingTheory.Localization.Module
import Mathlib.RingTheory.Norm
import Mathlib.RingTheory.Discriminant
#align_import ring_theory.localization.norm from "leanprover-community/mathlib"@"2e59a6de168f95d16b16d217b808a36290398c0a"
open scoped nonZeroDivisors
variable (R : Type*) {S : Type*} [CommRing R] [CommRing S] [Algebra R S]
variable {Rβ Sβ : Type*} [CommRing Rβ] [Algebra R Rβ] [CommRing Sβ] [Algebra S Sβ]
variable (M : Submonoid R)
variable [IsLocalization M Rβ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sβ]
variable [Algebra Rβ Sβ] [Algebra R Sβ] [IsScalarTower R Rβ Sβ] [IsScalarTower R S Sβ]
open Algebra
theorem Algebra.map_leftMulMatrix_localization {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ]
(b : Basis ΞΉ R S) (a : S) :
(algebraMap R Rβ).mapMatrix (leftMulMatrix b a) =
leftMulMatrix (b.localizationLocalization Rβ M Sβ) (algebraMap S Sβ a) := by
ext i j
simp only [Matrix.map_apply, RingHom.mapMatrix_apply, leftMulMatrix_eq_repr_mul, β map_mul,
Basis.localizationLocalization_apply, Basis.localizationLocalization_repr_algebraMap]
| Mathlib/RingTheory/Localization/NormTrace.lean | 61 | 69 | theorem Algebra.norm_localization [Module.Free R S] [Module.Finite R S] (a : S) :
Algebra.norm Rβ (algebraMap S Sβ a) = algebraMap R Rβ (Algebra.norm R a) := by |
cases subsingleton_or_nontrivial R
Β· haveI : Subsingleton Rβ := Module.subsingleton R Rβ
simp [eq_iff_true_of_subsingleton]
let b := Module.Free.chooseBasis R S
letI := Classical.decEq (Module.Free.ChooseBasisIndex R S)
rw [Algebra.norm_eq_matrix_det (b.localizationLocalization Rβ M Sβ),
Algebra.norm_eq_matrix_det b, RingHom.map_det, β Algebra.map_leftMulMatrix_localization]
| [
" (algebraMap R Rβ).mapMatrix ((leftMulMatrix b) a) =\n (leftMulMatrix (Basis.localizationLocalization Rβ M Sβ b)) ((algebraMap S Sβ) a)",
" (algebraMap R Rβ).mapMatrix ((leftMulMatrix b) a) i j =\n (leftMulMatrix (Basis.localizationLocalization Rβ M Sβ b)) ((algebraMap S Sβ) a) i j",
" (norm Rβ) ((algebr... | [
" (algebraMap R Rβ).mapMatrix ((leftMulMatrix b) a) =\n (leftMulMatrix (Basis.localizationLocalization Rβ M Sβ b)) ((algebraMap S Sβ) a)",
" (algebraMap R Rβ).mapMatrix ((leftMulMatrix b) a) i j =\n (leftMulMatrix (Basis.localizationLocalization Rβ M Sβ b)) ((algebraMap S Sβ) a) i j",
" (norm Rβ) ((algebr... |
import Mathlib.Algebra.MvPolynomial.Derivation
import Mathlib.Algebra.MvPolynomial.Variables
#align_import data.mv_polynomial.pderiv from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
universe u v
namespace MvPolynomial
open Set Function Finsupp
variable {R : Type u} {Ο : Type v} {a a' aβ aβ : R} {s : Ο ββ β}
section PDeriv
variable [CommSemiring R]
def pderiv (i : Ο) : Derivation R (MvPolynomial Ο R) (MvPolynomial Ο R) :=
letI := Classical.decEq Ο
mkDerivation R <| Pi.single i 1
#align mv_polynomial.pderiv MvPolynomial.pderiv
theorem pderiv_def [DecidableEq Ο] (i : Ο) : pderiv i = mkDerivation R (Pi.single i 1) := by
unfold pderiv; congr!
#align mv_polynomial.pderiv_def MvPolynomial.pderiv_def
@[simp]
theorem pderiv_monomial {i : Ο} :
pderiv i (monomial s a) = monomial (s - single i 1) (a * s i) := by
classical
simp only [pderiv_def, mkDerivation_monomial, Finsupp.smul_sum, smul_eq_mul, β smul_mul_assoc,
β (monomial _).map_smul]
refine (Finset.sum_eq_single i (fun j _ hne => ?_) fun hi => ?_).trans ?_
Β· simp [Pi.single_eq_of_ne hne]
Β· rw [Finsupp.not_mem_support_iff] at hi; simp [hi]
Β· simp
#align mv_polynomial.pderiv_monomial MvPolynomial.pderiv_monomial
theorem pderiv_C {i : Ο} : pderiv i (C a) = 0 :=
derivation_C _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_C MvPolynomial.pderiv_C
theorem pderiv_one {i : Ο} : pderiv i (1 : MvPolynomial Ο R) = 0 := pderiv_C
#align mv_polynomial.pderiv_one MvPolynomial.pderiv_one
@[simp]
| Mathlib/Algebra/MvPolynomial/PDeriv.lean | 89 | 91 | theorem pderiv_X [DecidableEq Ο] (i j : Ο) :
pderiv i (X j : MvPolynomial Ο R) = Pi.single (f := fun j => _) i 1 j := by |
rw [pderiv_def, mkDerivation_X]
| [
" pderiv i = mkDerivation R (Pi.single i 1)",
" mkDerivation R (Pi.single i 1) = mkDerivation R (Pi.single i 1)",
" (pderiv i) ((monomial s) a) = (monomial (s - single i 1)) (a * β(s i))",
" (s.sum fun a_1 b => (monomial (s - single a_1 1)) (a * βb) * Pi.single i 1 a_1) =\n (monomial (s - single i 1)) (a *... | [
" pderiv i = mkDerivation R (Pi.single i 1)",
" mkDerivation R (Pi.single i 1) = mkDerivation R (Pi.single i 1)",
" (pderiv i) ((monomial s) a) = (monomial (s - single i 1)) (a * β(s i))",
" (s.sum fun a_1 b => (monomial (s - single a_1 1)) (a * βb) * Pi.single i 1 a_1) =\n (monomial (s - single i 1)) (a *... |
import Mathlib.Data.Finset.Fold
import Mathlib.Algebra.GCDMonoid.Multiset
#align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
#align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d"
variable {ΞΉ Ξ± Ξ² Ξ³ : Type*}
namespace Finset
open Multiset
variable [CancelCommMonoidWithZero Ξ±] [NormalizedGCDMonoid Ξ±]
section gcd
def gcd (s : Finset Ξ²) (f : Ξ² β Ξ±) : Ξ± :=
s.fold GCDMonoid.gcd 0 f
#align finset.gcd Finset.gcd
variable {s sβ sβ : Finset Ξ²} {f : Ξ² β Ξ±}
theorem gcd_def : s.gcd f = (s.1.map f).gcd :=
rfl
#align finset.gcd_def Finset.gcd_def
@[simp]
theorem gcd_empty : (β
: Finset Ξ²).gcd f = 0 :=
fold_empty
#align finset.gcd_empty Finset.gcd_empty
theorem dvd_gcd_iff {a : Ξ±} : a β£ s.gcd f β β b β s, a β£ f b := by
apply Iff.trans Multiset.dvd_gcd
simp only [Multiset.mem_map, and_imp, exists_imp]
exact β¨fun k b hb β¦ k _ _ hb rfl, fun k a' b hb h β¦ h βΈ k _ hbβ©
#align finset.dvd_gcd_iff Finset.dvd_gcd_iff
theorem gcd_dvd {b : Ξ²} (hb : b β s) : s.gcd f β£ f b :=
dvd_gcd_iff.1 dvd_rfl _ hb
#align finset.gcd_dvd Finset.gcd_dvd
theorem dvd_gcd {a : Ξ±} : (β b β s, a β£ f b) β a β£ s.gcd f :=
dvd_gcd_iff.2
#align finset.dvd_gcd Finset.dvd_gcd
@[simp]
theorem gcd_insert [DecidableEq Ξ²] {b : Ξ²} :
(insert b s : Finset Ξ²).gcd f = GCDMonoid.gcd (f b) (s.gcd f) := by
by_cases h : b β s
Β· rw [insert_eq_of_mem h,
(gcd_eq_right_iff (f b) (s.gcd f) (Multiset.normalize_gcd (s.1.map f))).2 (gcd_dvd h)]
apply fold_insert h
#align finset.gcd_insert Finset.gcd_insert
@[simp]
theorem gcd_singleton {b : Ξ²} : ({b} : Finset Ξ²).gcd f = normalize (f b) :=
Multiset.gcd_singleton
#align finset.gcd_singleton Finset.gcd_singleton
-- Porting note: Priority changed for `simpNF`
@[simp 1100]
theorem normalize_gcd : normalize (s.gcd f) = s.gcd f := by simp [gcd_def]
#align finset.normalize_gcd Finset.normalize_gcd
theorem gcd_union [DecidableEq Ξ²] : (sβ βͺ sβ).gcd f = GCDMonoid.gcd (sβ.gcd f) (sβ.gcd f) :=
Finset.induction_on sβ (by rw [empty_union, gcd_empty, gcd_zero_left, normalize_gcd])
fun a s _ ih β¦ by rw [insert_union, gcd_insert, gcd_insert, ih, gcd_assoc]
#align finset.gcd_union Finset.gcd_union
theorem gcd_congr {f g : Ξ² β Ξ±} (hs : sβ = sβ) (hfg : β a β sβ, f a = g a) :
sβ.gcd f = sβ.gcd g := by
subst hs
exact Finset.fold_congr hfg
#align finset.gcd_congr Finset.gcd_congr
theorem gcd_mono_fun {g : Ξ² β Ξ±} (h : β b β s, f b β£ g b) : s.gcd f β£ s.gcd g :=
dvd_gcd fun b hb β¦ (gcd_dvd hb).trans (h b hb)
#align finset.gcd_mono_fun Finset.gcd_mono_fun
theorem gcd_mono (h : sβ β sβ) : sβ.gcd f β£ sβ.gcd f :=
dvd_gcd fun _ hb β¦ gcd_dvd (h hb)
#align finset.gcd_mono Finset.gcd_mono
| Mathlib/Algebra/GCDMonoid/Finset.lean | 203 | 205 | theorem gcd_image [DecidableEq Ξ²] {g : Ξ³ β Ξ²} (s : Finset Ξ³) :
(s.image g).gcd f = s.gcd (f β g) := by |
classical induction' s using Finset.induction with c s _ ih <;> simp [*]
| [
" a β£ s.gcd f β β b β s, a β£ f b",
" (β b β Multiset.map f s.val, a β£ b) β β b β s, a β£ f b",
" (β (b : Ξ±), β x β s.val, f x = b β a β£ b) β β b β s, a β£ f b",
" (insert b s).gcd f = GCDMonoid.gcd (f b) (s.gcd f)",
" normalize (s.gcd f) = s.gcd f",
" (β
βͺ sβ).gcd f = GCDMonoid.gcd (β
.gcd f) (sβ.gcd f)",
... | [
" a β£ s.gcd f β β b β s, a β£ f b",
" (β b β Multiset.map f s.val, a β£ b) β β b β s, a β£ f b",
" (β (b : Ξ±), β x β s.val, f x = b β a β£ b) β β b β s, a β£ f b",
" (insert b s).gcd f = GCDMonoid.gcd (f b) (s.gcd f)",
" normalize (s.gcd f) = s.gcd f",
" (β
βͺ sβ).gcd f = GCDMonoid.gcd (β
.gcd f) (sβ.gcd f)",
... |
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.NormedSpace.RCLike
import Mathlib.Order.Filter.Curry
#align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Filter
open scoped uniformity Filter Topology
section LimitsOfDerivatives
variable {ΞΉ : Type*} {l : Filter ΞΉ} {E : Type*} [NormedAddCommGroup E] {π : Type*} [RCLike π]
[NormedSpace π E] {G : Type*} [NormedAddCommGroup G] [NormedSpace π G] {f : ΞΉ β E β G}
{g : E β G} {f' : ΞΉ β E β E βL[π] G} {g' : E β E βL[π] G} {x : E}
| Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean | 112 | 163 | theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (π x))
(hf : βαΆ n : ΞΉ Γ E in l ΓΛ’ π x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2)
(hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (π x) := by |
letI : NormedSpace β E := NormedSpace.restrictScalars β π _
rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero] at hf' β’
suffices
TendstoUniformlyOnFilter (fun (n : ΞΉ Γ ΞΉ) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0
(l ΓΛ’ l) (π x) β§
TendstoUniformlyOnFilter (fun (n : ΞΉ Γ ΞΉ) (_ : E) => f n.1 x - f n.2 x) 0 (l ΓΛ’ l) (π x) by
have := this.1.add this.2
rw [add_zero] at this
exact this.congr (by simp)
constructor
Β· -- This inequality follows from the mean value theorem. To apply it, we will need to shrink our
-- neighborhood to small enough ball
rw [Metric.tendstoUniformlyOnFilter_iff] at hf' β’
intro Ξ΅ hΞ΅
have := (tendsto_swap4_prod.eventually (hf.prod_mk hf)).diag_of_prod_right
obtain β¨a, b, c, d, eβ© := eventually_prod_iff.1 ((hf' Ξ΅ hΞ΅).and this)
obtain β¨R, hR, hR'β© := Metric.nhds_basis_ball.eventually_iff.mp d
let r := min 1 R
have hr : 0 < r := by simp [r, hR]
have hr' : β β¦y : Eβ¦, y β Metric.ball x r β c y := fun y hy =>
hR' (lt_of_lt_of_le (Metric.mem_ball.mp hy) (min_le_right _ _))
have hxy : β y : E, y β Metric.ball x r β βy - xβ < 1 := by
intro y hy
rw [Metric.mem_ball, dist_eq_norm] at hy
exact lt_of_lt_of_le hy (min_le_left _ _)
have hxyΞ΅ : β y : E, y β Metric.ball x r β Ξ΅ * βy - xβ < Ξ΅ := by
intro y hy
exact (mul_lt_iff_lt_one_right hΞ΅.lt).mpr (hxy y hy)
-- With a small ball in hand, apply the mean value theorem
refine
eventually_prod_iff.mpr
β¨_, b, fun e : E => Metric.ball x r e,
eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_β©
simp only [Pi.zero_apply, dist_zero_left] at e β’
refine lt_of_le_of_lt ?_ (hxyΞ΅ y hy)
exact
Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le
(fun y hy => ((e hn (hr' hy)).2.1.sub (e hn (hr' hy)).2.2).hasFDerivWithinAt)
(fun y hy => (e hn (hr' hy)).1.le) (convex_ball x r) (Metric.mem_ball_self hr) hy
Β· -- This is just `hfg` run through `eventually_prod_iff`
refine Metric.tendstoUniformlyOnFilter_iff.mpr fun Ξ΅ hΞ΅ => ?_
obtain β¨t, ht, ht'β© := (Metric.cauchy_iff.mp hfg).2 Ξ΅ hΞ΅
exact
eventually_prod_iff.mpr
β¨fun n : ΞΉ Γ ΞΉ => f n.1 x β t β§ f n.2 x β t,
eventually_prod_iff.mpr β¨_, ht, _, ht, fun {n} hn {n'} hn' => β¨hn, hn'β©β©,
fun _ => True,
by simp,
fun {n} hn {y} _ => by simpa [norm_sub_rev, dist_eq_norm] using ht' _ hn.1 _ hn.2β©
| [
" UniformCauchySeqOnFilter f l (π x)",
" TendstoUniformlyOnFilter (fun n z => f n.1 z - f n.2 z) 0 (l ΓΛ’ l) (π x)",
" βαΆ (n : (ΞΉ Γ ΞΉ) Γ E) in (l ΓΛ’ l) ΓΛ’ π x,\n ((fun n z => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) + fun n x_1 => f n.1 x - f n.2 x) n.1 n.2 =\n f n.1.1 n.2 - f n.1.2 n.2",
" TendstoU... | [
" UniformCauchySeqOnFilter f l (π x)"
] |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
import Mathlib.Topology.Order.ProjIcc
#align_import analysis.special_functions.trigonometric.inverse from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Topology Filter
open Set Filter
open Real
namespace Real
variable {x y : β}
-- @[pp_nodot] Porting note: not implemented
noncomputable def arcsin : β β β :=
Subtype.val β IccExtend (neg_le_self zero_le_one) sinOrderIso.symm
#align real.arcsin Real.arcsin
theorem arcsin_mem_Icc (x : β) : arcsin x β Icc (-(Ο / 2)) (Ο / 2) :=
Subtype.coe_prop _
#align real.arcsin_mem_Icc Real.arcsin_mem_Icc
@[simp]
theorem range_arcsin : range arcsin = Icc (-(Ο / 2)) (Ο / 2) := by
rw [arcsin, range_comp Subtype.val]
simp [Icc]
#align real.range_arcsin Real.range_arcsin
theorem arcsin_le_pi_div_two (x : β) : arcsin x β€ Ο / 2 :=
(arcsin_mem_Icc x).2
#align real.arcsin_le_pi_div_two Real.arcsin_le_pi_div_two
theorem neg_pi_div_two_le_arcsin (x : β) : -(Ο / 2) β€ arcsin x :=
(arcsin_mem_Icc x).1
#align real.neg_pi_div_two_le_arcsin Real.neg_pi_div_two_le_arcsin
theorem arcsin_projIcc (x : β) :
arcsin (projIcc (-1) 1 (neg_le_self zero_le_one) x) = arcsin x := by
rw [arcsin, Function.comp_apply, IccExtend_val, Function.comp_apply, IccExtend,
Function.comp_apply]
#align real.arcsin_proj_Icc Real.arcsin_projIcc
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Inverse.lean | 64 | 66 | theorem sin_arcsin' {x : β} (hx : x β Icc (-1 : β) 1) : sin (arcsin x) = x := by |
simpa [arcsin, IccExtend_of_mem _ _ hx, -OrderIso.apply_symm_apply] using
Subtype.ext_iff.1 (sinOrderIso.apply_symm_apply β¨x, hxβ©)
| [
" range arcsin = Icc (-(Ο / 2)) (Ο / 2)",
" Subtype.val '' range (IccExtend arcsin.proof_2 βsinOrderIso.symm) = Icc (-(Ο / 2)) (Ο / 2)",
" (β(projIcc (-1) 1 β― x)).arcsin = x.arcsin",
" x.arcsin.sin = x"
] | [
" range arcsin = Icc (-(Ο / 2)) (Ο / 2)",
" Subtype.val '' range (IccExtend arcsin.proof_2 βsinOrderIso.symm) = Icc (-(Ο / 2)) (Ο / 2)",
" (β(projIcc (-1) 1 β― x)).arcsin = x.arcsin",
" x.arcsin.sin = x"
] |
import Mathlib.Algebra.ContinuedFractions.Computation.Basic
import Mathlib.Algebra.ContinuedFractions.Translations
#align_import algebra.continued_fractions.computation.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
-- Fix a discrete linear ordered floor field and a value `v`.
variable {K : Type*} [LinearOrderedField K] [FloorRing K] {v : K}
namespace IntFractPair
theorem stream_zero (v : K) : IntFractPair.stream v 0 = some (IntFractPair.of v) :=
rfl
#align generalized_continued_fraction.int_fract_pair.stream_zero GeneralizedContinuedFraction.IntFractPair.stream_zero
variable {n : β}
theorem stream_eq_none_of_fr_eq_zero {ifp_n : IntFractPair K}
(stream_nth_eq : IntFractPair.stream v n = some ifp_n) (nth_fr_eq_zero : ifp_n.fr = 0) :
IntFractPair.stream v (n + 1) = none := by
cases' ifp_n with _ fr
change fr = 0 at nth_fr_eq_zero
simp [IntFractPair.stream, stream_nth_eq, nth_fr_eq_zero]
#align generalized_continued_fraction.int_fract_pair.stream_eq_none_of_fr_eq_zero GeneralizedContinuedFraction.IntFractPair.stream_eq_none_of_fr_eq_zero
theorem succ_nth_stream_eq_none_iff :
IntFractPair.stream v (n + 1) = none β
IntFractPair.stream v n = none β¨ β ifp, IntFractPair.stream v n = some ifp β§ ifp.fr = 0 := by
rw [IntFractPair.stream]
cases IntFractPair.stream v n <;> simp [imp_false]
#align generalized_continued_fraction.int_fract_pair.succ_nth_stream_eq_none_iff GeneralizedContinuedFraction.IntFractPair.succ_nth_stream_eq_none_iff
theorem succ_nth_stream_eq_some_iff {ifp_succ_n : IntFractPair K} :
IntFractPair.stream v (n + 1) = some ifp_succ_n β
β ifp_n : IntFractPair K,
IntFractPair.stream v n = some ifp_n β§
ifp_n.fr β 0 β§ IntFractPair.of ifp_n.frβ»ΒΉ = ifp_succ_n := by
simp [IntFractPair.stream, ite_eq_iff, Option.bind_eq_some]
#align generalized_continued_fraction.int_fract_pair.succ_nth_stream_eq_some_iff GeneralizedContinuedFraction.IntFractPair.succ_nth_stream_eq_some_iff
theorem stream_succ_of_some {p : IntFractPair K} (h : IntFractPair.stream v n = some p)
(h' : p.fr β 0) : IntFractPair.stream v (n + 1) = some (IntFractPair.of p.frβ»ΒΉ) :=
succ_nth_stream_eq_some_iff.mpr β¨p, h, h', rflβ©
#align generalized_continued_fraction.int_fract_pair.stream_succ_of_some GeneralizedContinuedFraction.IntFractPair.stream_succ_of_some
theorem stream_succ_of_int (a : β€) (n : β) : IntFractPair.stream (a : K) (n + 1) = none := by
induction' n with n ih
Β· refine IntFractPair.stream_eq_none_of_fr_eq_zero (IntFractPair.stream_zero (a : K)) ?_
simp only [IntFractPair.of, Int.fract_intCast]
Β· exact IntFractPair.succ_nth_stream_eq_none_iff.mpr (Or.inl ih)
#align generalized_continued_fraction.int_fract_pair.stream_succ_of_int GeneralizedContinuedFraction.IntFractPair.stream_succ_of_int
| Mathlib/Algebra/ContinuedFractions/Computation/Translations.lean | 112 | 121 | theorem exists_succ_nth_stream_of_fr_zero {ifp_succ_n : IntFractPair K}
(stream_succ_nth_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n)
(succ_nth_fr_eq_zero : ifp_succ_n.fr = 0) :
β ifp_n : IntFractPair K, IntFractPair.stream v n = some ifp_n β§ ifp_n.frβ»ΒΉ = βifp_n.frβ»ΒΉβ := by |
-- get the witness from `succ_nth_stream_eq_some_iff` and prove that it has the additional
-- properties
rcases succ_nth_stream_eq_some_iff.mp stream_succ_nth_eq with
β¨ifp_n, seq_nth_eq, _, rflβ©
refine β¨ifp_n, seq_nth_eq, ?_β©
simpa only [IntFractPair.of, Int.fract, sub_eq_zero] using succ_nth_fr_eq_zero
| [
" IntFractPair.stream v (n + 1) = none",
" IntFractPair.stream v (n + 1) = none β\n IntFractPair.stream v n = none β¨ β ifp, IntFractPair.stream v n = some ifp β§ ifp.fr = 0",
" ((IntFractPair.stream v n).bind fun ap_n => if ap_n.fr = 0 then none else some (IntFractPair.of ap_n.frβ»ΒΉ)) = none β\n IntFractPai... | [
" IntFractPair.stream v (n + 1) = none",
" IntFractPair.stream v (n + 1) = none β\n IntFractPair.stream v n = none β¨ β ifp, IntFractPair.stream v n = some ifp β§ ifp.fr = 0",
" ((IntFractPair.stream v n).bind fun ap_n => if ap_n.fr = 0 then none else some (IntFractPair.of ap_n.frβ»ΒΉ)) = none β\n IntFractPai... |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
theorem count_succ_eq_succ_count_iff {n : β} : count p (n + 1) = count p n + 1 β p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_succ_count_iff Nat.count_succ_eq_succ_count_iff
theorem count_succ_eq_count_iff {n : β} : count p (n + 1) = count p n β Β¬p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_count_iff Nat.count_succ_eq_count_iff
alias β¨_, count_succ_eq_succ_countβ© := count_succ_eq_succ_count_iff
#align nat.count_succ_eq_succ_count Nat.count_succ_eq_succ_count
alias β¨_, count_succ_eq_countβ© := count_succ_eq_count_iff
#align nat.count_succ_eq_count Nat.count_succ_eq_count
| Mathlib/Data/Nat/Count.lean | 120 | 122 | theorem count_le_cardinal (n : β) : (count p n : Cardinal) β€ Cardinal.mk { k | p k } := by |
rw [count_eq_card_fintype, β Cardinal.mk_fintype]
exact Cardinal.mk_subtype_mono fun x hx β¦ hx.2
| [
" count p 0 = 0",
" Fintype { i // i < n β§ p i }",
" β (x : β), x β filter p (range n) β x β fun x => x < n β§ p x",
" x β filter p (range n) β x β fun x => x < n β§ p x",
" x < n β§ p x β x β fun x => x < n β§ p x",
" count p n = (filter p (range n)).card",
" (List.filter (fun b => decide (p b)) (List.rang... | [
" count p 0 = 0",
" Fintype { i // i < n β§ p i }",
" β (x : β), x β filter p (range n) β x β fun x => x < n β§ p x",
" x β filter p (range n) β x β fun x => x < n β§ p x",
" x < n β§ p x β x β fun x => x < n β§ p x",
" count p n = (filter p (range n)).card",
" (List.filter (fun b => decide (p b)) (List.rang... |
import Mathlib.Data.Int.Order.Units
import Mathlib.Data.ZMod.IntUnitsPower
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.LinearAlgebra.DirectSum.TensorProduct
import Mathlib.Algebra.DirectSum.Algebra
suppress_compilation
open scoped TensorProduct DirectSum
variable {R ΞΉ A B : Type*}
namespace TensorProduct
variable [CommSemiring ΞΉ] [Module ΞΉ (Additive β€Λ£)] [DecidableEq ΞΉ]
variable (π : ΞΉ β Type*) (β¬ : ΞΉ β Type*)
variable [CommRing R]
variable [β i, AddCommGroup (π i)] [β i, AddCommGroup (β¬ i)]
variable [β i, Module R (π i)] [β i, Module R (β¬ i)]
variable [DirectSum.GRing π] [DirectSum.GRing β¬]
variable [DirectSum.GAlgebra R π] [DirectSum.GAlgebra R β¬]
-- this helps with performance
instance (i : ΞΉ Γ ΞΉ) : Module R (π (Prod.fst i) β[R] β¬ (Prod.snd i)) :=
TensorProduct.leftModule
open DirectSum (lof)
variable (R)
section gradedComm
local notation "πβ¬" => (fun i : ΞΉ Γ ΞΉ => π (Prod.fst i) β[R] β¬ (Prod.snd i))
local notation "β¬π" => (fun i : ΞΉ Γ ΞΉ => β¬ (Prod.fst i) β[R] π (Prod.snd i))
def gradedCommAux : DirectSum _ πβ¬ ββ[R] DirectSum _ β¬π := by
refine DirectSum.toModule R _ _ fun i => ?_
have o := DirectSum.lof R _ β¬π i.swap
have s : β€Λ£ := ((-1 : β€Λ£)^(i.1* i.2 : ΞΉ) : β€Λ£)
exact (s β’ o) ββ (TensorProduct.comm R _ _).toLinearMap
@[simp]
theorem gradedCommAux_lof_tmul (i j : ΞΉ) (a : π i) (b : β¬ j) :
gradedCommAux R π β¬ (lof R _ πβ¬ (i, j) (a ββ b)) =
(-1 : β€Λ£)^(j * i) β’ lof R _ β¬π (j, i) (b ββ a) := by
rw [gradedCommAux]
dsimp
simp [mul_comm i j]
@[simp]
| Mathlib/LinearAlgebra/TensorProduct/Graded/External.lean | 93 | 98 | theorem gradedCommAux_comp_gradedCommAux :
gradedCommAux R π β¬ ββ gradedCommAux R β¬ π = LinearMap.id := by |
ext i a b
dsimp
rw [gradedCommAux_lof_tmul, LinearMap.map_smul_of_tower, gradedCommAux_lof_tmul, smul_smul,
mul_comm i.2 i.1, Int.units_mul_self, one_smul]
| [
" (β¨ (i : ΞΉ Γ ΞΉ), π i.1 β[R] β¬ i.2) ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" π i.1 β[R] β¬ i.2 ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" (gradedCommAux R π β¬) ((lof R (ΞΉ Γ ΞΉ) (fun i => π i.1 β[R] β¬ i.2) (i, j)) (a ββ[R] b)) =\n (-1) ^ (j * i) β’ (lof R (ΞΉ Γ ΞΉ) (fun i => β¬ i.1 β[R] π i.2) (j, i)) (b ββ[... | [
" (β¨ (i : ΞΉ Γ ΞΉ), π i.1 β[R] β¬ i.2) ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" π i.1 β[R] β¬ i.2 ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" (gradedCommAux R π β¬) ((lof R (ΞΉ Γ ΞΉ) (fun i => π i.1 β[R] β¬ i.2) (i, j)) (a ββ[R] b)) =\n (-1) ^ (j * i) β’ (lof R (ΞΉ Γ ΞΉ) (fun i => β¬ i.1 β[R] π i.2) (j, i)) (b ββ[... |
import Mathlib.Algebra.Group.Aut
import Mathlib.Algebra.Group.Invertible.Basic
import Mathlib.Algebra.GroupWithZero.Units.Basic
import Mathlib.GroupTheory.GroupAction.Units
#align_import group_theory.group_action.group from "leanprover-community/mathlib"@"3b52265189f3fb43aa631edffce5d060fafaf82f"
universe u v w
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w}
section MulAction
section Group
variable [Group Ξ±] [MulAction Ξ± Ξ²]
@[to_additive (attr := simp)]
| Mathlib/GroupTheory/GroupAction/Group.lean | 30 | 30 | theorem inv_smul_smul (c : Ξ±) (x : Ξ²) : cβ»ΒΉ β’ c β’ x = x := by | rw [smul_smul, mul_left_inv, one_smul]
| [
" cβ»ΒΉ β’ c β’ x = x"
] | [
" cβ»ΒΉ β’ c β’ x = x"
] |
import Mathlib.Geometry.Euclidean.Inversion.Basic
import Mathlib.Geometry.Euclidean.PerpBisector
open Metric Function AffineMap Set AffineSubspace
open scoped Topology
variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace β V] [MetricSpace P]
[NormedAddTorsor V P] {c x y : P} {R : β}
namespace EuclideanGeometry
theorem inversion_mem_perpBisector_inversion_iff (hR : R β 0) (hx : x β c) (hy : y β c) :
inversion c R x β perpBisector c (inversion c R y) β dist x y = dist y c := by
rw [mem_perpBisector_iff_dist_eq, dist_inversion_inversion hx hy, dist_inversion_center]
have hx' := dist_ne_zero.2 hx
have hy' := dist_ne_zero.2 hy
field_simp [mul_assoc, mul_comm, hx, hx.symm, eq_comm]
theorem inversion_mem_perpBisector_inversion_iff' (hR : R β 0) (hy : y β c) :
inversion c R x β perpBisector c (inversion c R y) β dist x y = dist y c β§ x β c := by
rcases eq_or_ne x c with rfl | hx
Β· simp [*]
Β· simp [inversion_mem_perpBisector_inversion_iff hR hx hy, hx]
theorem preimage_inversion_perpBisector_inversion (hR : R β 0) (hy : y β c) :
inversion c R β»ΒΉ' perpBisector c (inversion c R y) = sphere y (dist y c) \ {c} :=
Set.ext fun _ β¦ inversion_mem_perpBisector_inversion_iff' hR hy
theorem preimage_inversion_perpBisector (hR : R β 0) (hy : y β c) :
inversion c R β»ΒΉ' perpBisector c y = sphere (inversion c R y) (R ^ 2 / dist y c) \ {c} := by
rw [β dist_inversion_center, β preimage_inversion_perpBisector_inversion hR,
inversion_inversion] <;> simp [*]
| Mathlib/Geometry/Euclidean/Inversion/ImageHyperplane.lean | 61 | 64 | theorem image_inversion_perpBisector (hR : R β 0) (hy : y β c) :
inversion c R '' perpBisector c y = sphere (inversion c R y) (R ^ 2 / dist y c) \ {c} := by |
rw [image_eq_preimage_of_inverse (inversion_involutive _ hR) (inversion_involutive _ hR),
preimage_inversion_perpBisector hR hy]
| [
" inversion c R x β perpBisector c (inversion c R y) β dist x y = dist y c",
" R ^ 2 / dist x c = R ^ 2 / (dist x c * dist y c) * dist x y β dist x y = dist y c",
" inversion c R x β perpBisector c (inversion c R y) β dist x y = dist y c β§ x β c",
" inversion x R x β perpBisector x (inversion x R y) β dist x ... | [
" inversion c R x β perpBisector c (inversion c R y) β dist x y = dist y c",
" R ^ 2 / dist x c = R ^ 2 / (dist x c * dist y c) * dist x y β dist x y = dist y c",
" inversion c R x β perpBisector c (inversion c R y) β dist x y = dist y c β§ x β c",
" inversion x R x β perpBisector x (inversion x R y) β dist x ... |
import Mathlib.Order.Filter.Prod
#align_import order.filter.n_ary from "leanprover-community/mathlib"@"78f647f8517f021d839a7553d5dc97e79b508dea"
open Function Set
open Filter
namespace Filter
variable {Ξ± Ξ±' Ξ² Ξ²' Ξ³ Ξ³' Ξ΄ Ξ΄' Ξ΅ Ξ΅' : Type*} {m : Ξ± β Ξ² β Ξ³} {f fβ fβ : Filter Ξ±}
{g gβ gβ : Filter Ξ²} {h hβ hβ : Filter Ξ³} {s sβ sβ : Set Ξ±} {t tβ tβ : Set Ξ²} {u : Set Ξ³}
{v : Set Ξ΄} {a : Ξ±} {b : Ξ²} {c : Ξ³}
def mapβ (m : Ξ± β Ξ² β Ξ³) (f : Filter Ξ±) (g : Filter Ξ²) : Filter Ξ³ :=
((f ΓΛ’ g).map (uncurry m)).copy { s | β u β f, β v β g, image2 m u v β s } fun _ β¦ by
simp only [mem_map, mem_prod_iff, image2_subset_iff, prod_subset_iff]; rfl
#align filter.mapβ Filter.mapβ
@[simp 900]
theorem mem_mapβ_iff : u β mapβ m f g β β s β f, β t β g, image2 m s t β u :=
Iff.rfl
#align filter.mem_mapβ_iff Filter.mem_mapβ_iff
theorem image2_mem_mapβ (hs : s β f) (ht : t β g) : image2 m s t β mapβ m f g :=
β¨_, hs, _, ht, Subset.rflβ©
#align filter.image2_mem_mapβ Filter.image2_mem_mapβ
theorem map_prod_eq_mapβ (m : Ξ± β Ξ² β Ξ³) (f : Filter Ξ±) (g : Filter Ξ²) :
Filter.map (fun p : Ξ± Γ Ξ² => m p.1 p.2) (f ΓΛ’ g) = mapβ m f g := by
rw [mapβ, copy_eq, uncurry_def]
#align filter.map_prod_eq_mapβ Filter.map_prod_eq_mapβ
theorem map_prod_eq_mapβ' (m : Ξ± Γ Ξ² β Ξ³) (f : Filter Ξ±) (g : Filter Ξ²) :
Filter.map m (f ΓΛ’ g) = mapβ (fun a b => m (a, b)) f g :=
map_prod_eq_mapβ (curry m) f g
#align filter.map_prod_eq_mapβ' Filter.map_prod_eq_mapβ'
@[simp]
theorem mapβ_mk_eq_prod (f : Filter Ξ±) (g : Filter Ξ²) : mapβ Prod.mk f g = f ΓΛ’ g := by
simp only [β map_prod_eq_mapβ, map_id']
#align filter.mapβ_mk_eq_prod Filter.mapβ_mk_eq_prod
-- lemma image2_mem_mapβ_iff (hm : injective2 m) : image2 m s t β mapβ m f g β s β f β§ t β g :=
-- β¨by { rintro β¨u, v, hu, hv, hβ©, rw image2_subset_image2_iff hm at h,
-- exact β¨mem_of_superset hu h.1, mem_of_superset hv h.2β© }, Ξ» h, image2_mem_mapβ h.1 h.2β©
theorem mapβ_mono (hf : fβ β€ fβ) (hg : gβ β€ gβ) : mapβ m fβ gβ β€ mapβ m fβ gβ :=
fun _ β¨s, hs, t, ht, hstβ© => β¨s, hf hs, t, hg ht, hstβ©
#align filter.mapβ_mono Filter.mapβ_mono
theorem mapβ_mono_left (h : gβ β€ gβ) : mapβ m f gβ β€ mapβ m f gβ :=
mapβ_mono Subset.rfl h
#align filter.mapβ_mono_left Filter.mapβ_mono_left
theorem mapβ_mono_right (h : fβ β€ fβ) : mapβ m fβ g β€ mapβ m fβ g :=
mapβ_mono h Subset.rfl
#align filter.mapβ_mono_right Filter.mapβ_mono_right
@[simp]
theorem le_mapβ_iff {h : Filter Ξ³} :
h β€ mapβ m f g β β β¦sβ¦, s β f β β β¦tβ¦, t β g β image2 m s t β h :=
β¨fun H _ hs _ ht => H <| image2_mem_mapβ hs ht, fun H _ β¨_, hs, _, ht, huβ© =>
mem_of_superset (H hs ht) huβ©
#align filter.le_mapβ_iff Filter.le_mapβ_iff
@[simp]
theorem mapβ_eq_bot_iff : mapβ m f g = β₯ β f = β₯ β¨ g = β₯ := by simp [β map_prod_eq_mapβ]
#align filter.mapβ_eq_bot_iff Filter.mapβ_eq_bot_iff
@[simp]
theorem mapβ_bot_left : mapβ m β₯ g = β₯ := mapβ_eq_bot_iff.2 <| .inl rfl
#align filter.mapβ_bot_left Filter.mapβ_bot_left
@[simp]
theorem mapβ_bot_right : mapβ m f β₯ = β₯ := mapβ_eq_bot_iff.2 <| .inr rfl
#align filter.mapβ_bot_right Filter.mapβ_bot_right
@[simp]
| Mathlib/Order/Filter/NAry.lean | 103 | 103 | theorem mapβ_neBot_iff : (mapβ m f g).NeBot β f.NeBot β§ g.NeBot := by | simp [neBot_iff, not_or]
| [
" xβ β {s | β u β f, β v β g, image2 m u v β s} β xβ β map (uncurry m) (f ΓΛ’ g)",
" xβ β {s | β u β f, β v β g, β x β u, β y β v, m x y β s} β\n β tβ β f, β tβ β g, β x β tβ, β y β tβ, (x, y) β uncurry m β»ΒΉ' xβ",
" map (fun p => m p.1 p.2) (f ΓΛ’ g) = mapβ m f g",
" mapβ Prod.mk f g = f ΓΛ’ g",
" mapβ m f ... | [
" xβ β {s | β u β f, β v β g, image2 m u v β s} β xβ β map (uncurry m) (f ΓΛ’ g)",
" xβ β {s | β u β f, β v β g, β x β u, β y β v, m x y β s} β\n β tβ β f, β tβ β g, β x β tβ, β y β tβ, (x, y) β uncurry m β»ΒΉ' xβ",
" map (fun p => m p.1 p.2) (f ΓΛ’ g) = mapβ m f g",
" mapβ Prod.mk f g = f ΓΛ’ g",
" mapβ m f ... |
import Mathlib.Data.ZMod.Quotient
import Mathlib.GroupTheory.NoncommPiCoprod
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Algebra.GCDMonoid.Finset
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Tactic.ByContra
import Mathlib.Tactic.Peel
#align_import group_theory.exponent from "leanprover-community/mathlib"@"52fa514ec337dd970d71d8de8d0fd68b455a1e54"
universe u
variable {G : Type u}
open scoped Classical
namespace Monoid
section Monoid
variable (G) [Monoid G]
@[to_additive
"A predicate on an additive monoid saying that there is a positive integer `n` such\n
that `n β’ g = 0` for all `g`."]
def ExponentExists :=
β n, 0 < n β§ β g : G, g ^ n = 1
#align monoid.exponent_exists Monoid.ExponentExists
#align add_monoid.exponent_exists AddMonoid.ExponentExists
@[to_additive
"The exponent of an additive group is the smallest positive integer `n` such that\n
`n β’ g = 0` for all `g β G` if it exists, otherwise it is zero by convention."]
noncomputable def exponent :=
if h : ExponentExists G then Nat.find h else 0
#align monoid.exponent Monoid.exponent
#align add_monoid.exponent AddMonoid.exponent
variable {G}
@[simp]
theorem _root_.AddMonoid.exponent_additive :
AddMonoid.exponent (Additive G) = exponent G := rfl
@[simp]
theorem exponent_multiplicative {G : Type*} [AddMonoid G] :
exponent (Multiplicative G) = AddMonoid.exponent G := rfl
open MulOpposite in
@[to_additive (attr := simp)]
theorem _root_.MulOpposite.exponent : exponent (MulOpposite G) = exponent G := by
simp only [Monoid.exponent, ExponentExists]
congr!
all_goals exact β¨(op_injective <| Β· <| op Β·), (unop_injective <| Β· <| unop Β·)β©
@[to_additive]
theorem ExponentExists.isOfFinOrder (h : ExponentExists G) {g : G} : IsOfFinOrder g :=
isOfFinOrder_iff_pow_eq_one.mpr <| by peel 2 h; exact this g
@[to_additive]
theorem ExponentExists.orderOf_pos (h : ExponentExists G) (g : G) : 0 < orderOf g :=
h.isOfFinOrder.orderOf_pos
@[to_additive]
theorem exponent_ne_zero : exponent G β 0 β ExponentExists G := by
rw [exponent]
split_ifs with h
Β· simp [h, @not_lt_zero' β]
--if this isn't done this way, `to_additive` freaks
Β· tauto
#align monoid.exponent_exists_iff_ne_zero Monoid.exponent_ne_zero
#align add_monoid.exponent_exists_iff_ne_zero AddMonoid.exponent_ne_zero
@[to_additive]
protected alias β¨_, ExponentExists.exponent_ne_zeroβ© := exponent_ne_zero
@[to_additive (attr := deprecated (since := "2024-01-27"))]
theorem exponentExists_iff_ne_zero : ExponentExists G β exponent G β 0 := exponent_ne_zero.symm
@[to_additive]
theorem exponent_pos : 0 < exponent G β ExponentExists G :=
pos_iff_ne_zero.trans exponent_ne_zero
@[to_additive]
protected alias β¨_, ExponentExists.exponent_posβ© := exponent_pos
@[to_additive]
theorem exponent_eq_zero_iff : exponent G = 0 β Β¬ExponentExists G :=
exponent_ne_zero.not_right
#align monoid.exponent_eq_zero_iff Monoid.exponent_eq_zero_iff
#align add_monoid.exponent_eq_zero_iff AddMonoid.exponent_eq_zero_iff
@[to_additive exponent_eq_zero_addOrder_zero]
theorem exponent_eq_zero_of_order_zero {g : G} (hg : orderOf g = 0) : exponent G = 0 :=
exponent_eq_zero_iff.mpr fun h β¦ h.orderOf_pos g |>.ne' hg
#align monoid.exponent_eq_zero_of_order_zero Monoid.exponent_eq_zero_of_order_zero
#align add_monoid.exponent_eq_zero_of_order_zero AddMonoid.exponent_eq_zero_addOrder_zero
@[to_additive "The exponent is zero iff for all nonzero `n`, one can find a `g` such that
`n β’ g β 0`."]
theorem exponent_eq_zero_iff_forall : exponent G = 0 β β n > 0, β g : G, g ^ n β 1 := by
rw [exponent_eq_zero_iff, ExponentExists]
push_neg
rfl
@[to_additive exponent_nsmul_eq_zero]
theorem pow_exponent_eq_one (g : G) : g ^ exponent G = 1 := by
by_cases h : ExponentExists G
Β· simp_rw [exponent, dif_pos h]
exact (Nat.find_spec h).2 g
Β· simp_rw [exponent, dif_neg h, pow_zero]
#align monoid.pow_exponent_eq_one Monoid.pow_exponent_eq_one
#align add_monoid.exponent_nsmul_eq_zero AddMonoid.exponent_nsmul_eq_zero
@[to_additive]
| Mathlib/GroupTheory/Exponent.lean | 160 | 163 | theorem pow_eq_mod_exponent {n : β} (g : G) : g ^ n = g ^ (n % exponent G) :=
calc
g ^ n = g ^ (n % exponent G + exponent G * (n / exponent G)) := by | rw [Nat.mod_add_div]
_ = g ^ (n % exponent G) := by simp [pow_add, pow_mul, pow_exponent_eq_one]
| [
" Monoid.exponent Gα΅α΅α΅ = Monoid.exponent G",
" (if h : β n, 0 < n β§ β (g : Gα΅α΅α΅), g ^ n = 1 then Nat.find h else 0) =\n if h : β n, 0 < n β§ β (g : G), g ^ n = 1 then Nat.find h else 0",
" (β (g : Gα΅α΅α΅), g ^ xβ = 1) β β (g : G), g ^ xβ = 1",
" β n, 0 < n β§ g ^ n = 1",
" g ^ nβ = 1",
" exponent G β 0 β E... | [
" Monoid.exponent Gα΅α΅α΅ = Monoid.exponent G",
" (if h : β n, 0 < n β§ β (g : Gα΅α΅α΅), g ^ n = 1 then Nat.find h else 0) =\n if h : β n, 0 < n β§ β (g : G), g ^ n = 1 then Nat.find h else 0",
" (β (g : Gα΅α΅α΅), g ^ xβ = 1) β β (g : G), g ^ xβ = 1",
" β n, 0 < n β§ g ^ n = 1",
" g ^ nβ = 1",
" exponent G β 0 β E... |
import Mathlib.RingTheory.RootsOfUnity.Basic
universe u
variable {L : Type u} [CommRing L] [IsDomain L]
variable (n : β+)
theorem rootsOfUnity.integer_power_of_ringEquiv (g : L β+* L) :
β m : β€, β t : rootsOfUnity n L, g (t : LΛ£) = (t ^ m : LΛ£) := by
obtain β¨m, hmβ© := MonoidHom.map_cyclic ((g : L β* L).restrictRootsOfUnity n).toMonoidHom
exact β¨m, fun t β¦ Units.ext_iff.1 <| SetCoe.ext_iff.2 <| hm tβ©
| Mathlib/NumberTheory/Cyclotomic/CyclotomicCharacter.lean | 77 | 79 | theorem rootsOfUnity.integer_power_of_ringEquiv' (g : L β+* L) :
β m : β€, β t β rootsOfUnity n L, g (t : LΛ£) = (t ^ m : LΛ£) := by |
simpa using rootsOfUnity.integer_power_of_ringEquiv n g
| [
" β m, β (t : β₯(rootsOfUnity n L)), g ββt = β(βt ^ m)",
" β m, β t β rootsOfUnity n L, g βt = β(t ^ m)"
] | [
" β m, β (t : β₯(rootsOfUnity n L)), g ββt = β(βt ^ m)",
" β m, β t β rootsOfUnity n L, g βt = β(t ^ m)"
] |
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {Ξ± : Type*}
namespace Set
section ContravariantLT
variable [Mul Ξ±] [PartialOrder Ξ±]
variable [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (Function.swap HMul.hMul) LT.lt]
@[to_additive Icc_add_Ico_subset]
theorem Icc_mul_Ico_subset' (a b c d : Ξ±) : Icc a b * Ico c d β Ico (a * c) (b * d) := by
haveI := covariantClass_le_of_lt
rintro x β¨y, β¨hya, hybβ©, z, β¨hzc, hzdβ©, rflβ©
exact β¨mul_le_mul' hya hzc, mul_lt_mul_of_le_of_lt hyb hzdβ©
@[to_additive Ico_add_Icc_subset]
theorem Ico_mul_Icc_subset' (a b c d : Ξ±) : Ico a b * Icc c d β Ico (a * c) (b * d) := by
haveI := covariantClass_le_of_lt
rintro x β¨y, β¨hya, hybβ©, z, β¨hzc, hzdβ©, rflβ©
exact β¨mul_le_mul' hya hzc, mul_lt_mul_of_lt_of_le hyb hzdβ©
@[to_additive Ioc_add_Ico_subset]
theorem Ioc_mul_Ico_subset' (a b c d : Ξ±) : Ioc a b * Ico c d β Ioo (a * c) (b * d) := by
haveI := covariantClass_le_of_lt
rintro x β¨y, β¨hya, hybβ©, z, β¨hzc, hzdβ©, rflβ©
exact β¨mul_lt_mul_of_lt_of_le hya hzc, mul_lt_mul_of_le_of_lt hyb hzdβ©
@[to_additive Ico_add_Ioc_subset]
theorem Ico_mul_Ioc_subset' (a b c d : Ξ±) : Ico a b * Ioc c d β Ioo (a * c) (b * d) := by
haveI := covariantClass_le_of_lt
rintro x β¨y, β¨hya, hybβ©, z, β¨hzc, hzdβ©, rflβ©
exact β¨mul_lt_mul_of_le_of_lt hya hzc, mul_lt_mul_of_lt_of_le hyb hzdβ©
@[to_additive Iic_add_Iio_subset]
theorem Iic_mul_Iio_subset' (a b : Ξ±) : Iic a * Iio b β Iio (a * b) := by
haveI := covariantClass_le_of_lt
rintro x β¨y, hya, z, hzb, rflβ©
exact mul_lt_mul_of_le_of_lt hya hzb
@[to_additive Iio_add_Iic_subset]
| Mathlib/Data/Set/Pointwise/Interval.lean | 98 | 101 | theorem Iio_mul_Iic_subset' (a b : Ξ±) : Iio a * Iic b β Iio (a * b) := by |
haveI := covariantClass_le_of_lt
rintro x β¨y, hya, z, hzb, rflβ©
exact mul_lt_mul_of_lt_of_le hya hzb
| [
" Icc a b * Ico c d β Ico (a * c) (b * d)",
" (fun x x_1 => x * x_1) y z β Ico (a * c) (b * d)",
" Ico a b * Icc c d β Ico (a * c) (b * d)",
" Ioc a b * Ico c d β Ioo (a * c) (b * d)",
" (fun x x_1 => x * x_1) y z β Ioo (a * c) (b * d)",
" Ico a b * Ioc c d β Ioo (a * c) (b * d)",
" Iic a * Iio b β Iio ... | [
" Icc a b * Ico c d β Ico (a * c) (b * d)",
" (fun x x_1 => x * x_1) y z β Ico (a * c) (b * d)",
" Ico a b * Icc c d β Ico (a * c) (b * d)",
" Ioc a b * Ico c d β Ioo (a * c) (b * d)",
" (fun x x_1 => x * x_1) y z β Ioo (a * c) (b * d)",
" Ico a b * Ioc c d β Ioo (a * c) (b * d)",
" Iic a * Iio b β Iio ... |
import Mathlib.Data.Fintype.Card
import Mathlib.Computability.Language
import Mathlib.Tactic.NormNum
#align_import computability.DFA from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
open Computability
universe u v
-- Porting note: Required as `DFA` is used in mathlib3
set_option linter.uppercaseLean3 false
structure DFA (Ξ± : Type u) (Ο : Type v) where
step : Ο β Ξ± β Ο
start : Ο
accept : Set Ο
#align DFA DFA
namespace DFA
variable {Ξ± : Type u} {Ο : Type v} (M : DFA Ξ± Ο)
instance [Inhabited Ο] : Inhabited (DFA Ξ± Ο) :=
β¨DFA.mk (fun _ _ => default) default β
β©
def evalFrom (start : Ο) : List Ξ± β Ο :=
List.foldl M.step start
#align DFA.eval_from DFA.evalFrom
@[simp]
theorem evalFrom_nil (s : Ο) : M.evalFrom s [] = s :=
rfl
#align DFA.eval_from_nil DFA.evalFrom_nil
@[simp]
theorem evalFrom_singleton (s : Ο) (a : Ξ±) : M.evalFrom s [a] = M.step s a :=
rfl
#align DFA.eval_from_singleton DFA.evalFrom_singleton
@[simp]
theorem evalFrom_append_singleton (s : Ο) (x : List Ξ±) (a : Ξ±) :
M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a := by
simp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]
#align DFA.eval_from_append_singleton DFA.evalFrom_append_singleton
def eval : List Ξ± β Ο :=
M.evalFrom M.start
#align DFA.eval DFA.eval
@[simp]
theorem eval_nil : M.eval [] = M.start :=
rfl
#align DFA.eval_nil DFA.eval_nil
@[simp]
theorem eval_singleton (a : Ξ±) : M.eval [a] = M.step M.start a :=
rfl
#align DFA.eval_singleton DFA.eval_singleton
@[simp]
theorem eval_append_singleton (x : List Ξ±) (a : Ξ±) : M.eval (x ++ [a]) = M.step (M.eval x) a :=
evalFrom_append_singleton _ _ _ _
#align DFA.eval_append_singleton DFA.eval_append_singleton
theorem evalFrom_of_append (start : Ο) (x y : List Ξ±) :
M.evalFrom start (x ++ y) = M.evalFrom (M.evalFrom start x) y :=
x.foldl_append _ _ y
#align DFA.eval_from_of_append DFA.evalFrom_of_append
def accepts : Language Ξ± := {x | M.eval x β M.accept}
#align DFA.accepts DFA.accepts
theorem mem_accepts (x : List Ξ±) : x β M.accepts β M.evalFrom M.start x β M.accept := by rfl
#align DFA.mem_accepts DFA.mem_accepts
| Mathlib/Computability/DFA.lean | 101 | 134 | theorem evalFrom_split [Fintype Ο] {x : List Ξ±} {s t : Ο} (hlen : Fintype.card Ο β€ x.length)
(hx : M.evalFrom s x = t) :
β q a b c,
x = a ++ b ++ c β§
a.length + b.length β€ Fintype.card Ο β§
b β [] β§ M.evalFrom s a = q β§ M.evalFrom q b = q β§ M.evalFrom q c = t := by |
obtain β¨n, m, hneq, heqβ© :=
Fintype.exists_ne_map_eq_of_card_lt
(fun n : Fin (Fintype.card Ο + 1) => M.evalFrom s (x.take n)) (by norm_num)
wlog hle : (n : β) β€ m
Β· exact this _ hlen hx _ _ hneq.symm heq.symm (le_of_not_le hle)
have hm : (m : β) β€ Fintype.card Ο := Fin.is_le m
refine
β¨M.evalFrom s ((x.take m).take n), (x.take m).take n, (x.take m).drop n,
x.drop m, ?_, ?_, ?_, by rfl, ?_β©
Β· rw [List.take_append_drop, List.take_append_drop]
Β· simp only [List.length_drop, List.length_take]
rw [min_eq_left (hm.trans hlen), min_eq_left hle, add_tsub_cancel_of_le hle]
exact hm
Β· intro h
have hlen' := congr_arg List.length h
simp only [List.length_drop, List.length, List.length_take] at hlen'
rw [min_eq_left, tsub_eq_zero_iff_le] at hlen'
Β· apply hneq
apply le_antisymm
assumption'
exact hm.trans hlen
have hq : M.evalFrom (M.evalFrom s ((x.take m).take n)) ((x.take m).drop n) =
M.evalFrom s ((x.take m).take n) := by
rw [List.take_take, min_eq_left hle, β evalFrom_of_append, heq, β min_eq_left hle, β
List.take_take, min_eq_left hle, List.take_append_drop]
use hq
rwa [β hq, β evalFrom_of_append, β evalFrom_of_append, β List.append_assoc,
List.take_append_drop, List.take_append_drop]
| [
" M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a",
" x β M.accepts β M.evalFrom M.start x β M.accept",
" β q a b c,\n x = a ++ b ++ c β§\n a.length + b.length β€ Fintype.card Ο β§ b β [] β§ M.evalFrom s a = q β§ M.evalFrom q b = q β§ M.evalFrom q c = t",
" Fintype.card Ο < Fintype.card (Fin (Fintype.ca... | [
" M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a",
" x β M.accepts β M.evalFrom M.start x β M.accept",
" β q a b c,\n x = a ++ b ++ c β§\n a.length + b.length β€ Fintype.card Ο β§ b β [] β§ M.evalFrom s a = q β§ M.evalFrom q b = q β§ M.evalFrom q c = t"
] |
import Mathlib.CategoryTheory.Sites.Sheaf
#align_import category_theory.sites.canonical from "leanprover-community/mathlib"@"9e7c80f638149bfb3504ba8ff48dfdbfc949fb1a"
universe v u
namespace CategoryTheory
open scoped Classical
open CategoryTheory Category Limits Sieve
variable {C : Type u} [Category.{v} C]
namespace Sheaf
variable {P : Cα΅α΅ β₯€ Type v}
variable {X Y : C} {S : Sieve X} {R : Presieve X}
variable (J Jβ : GrothendieckTopology C)
| Mathlib/CategoryTheory/Sites/Canonical.lean | 61 | 113 | theorem isSheafFor_bind (P : Cα΅α΅ β₯€ Type v) (U : Sieve X) (B : β β¦Yβ¦ β¦f : Y βΆ Xβ¦, U f β Sieve Y)
(hU : Presieve.IsSheafFor P (U : Presieve X))
(hB : β β¦Yβ¦ β¦f : Y βΆ Xβ¦ (hf : U f), Presieve.IsSheafFor P (B hf : Presieve Y))
(hB' : β β¦Yβ¦ β¦f : Y βΆ Xβ¦ (h : U f) β¦Zβ¦ (g : Z βΆ Y),
Presieve.IsSeparatedFor P (((B h).pullback g) : Presieve Z)) :
Presieve.IsSheafFor P (Sieve.bind (U : Presieve X) B : Presieve X) := by |
intro s hs
let y : β β¦Yβ¦ β¦f : Y βΆ Xβ¦ (hf : U f), Presieve.FamilyOfElements P (B hf : Presieve Y) :=
fun Y f hf Z g hg => s _ (Presieve.bind_comp _ _ hg)
have hy : β β¦Yβ¦ β¦f : Y βΆ Xβ¦ (hf : U f), (y hf).Compatible := by
intro Y f H Yβ Yβ Z gβ gβ fβ fβ hfβ hfβ comm
apply hs
apply reassoc_of% comm
let t : Presieve.FamilyOfElements P (U : Presieve X) :=
fun Y f hf => (hB hf).amalgamate (y hf) (hy hf)
have ht : β β¦Yβ¦ β¦f : Y βΆ Xβ¦ (hf : U f), (y hf).IsAmalgamation (t f hf) := fun Y f hf =>
(hB hf).isAmalgamation _
have hT : t.Compatible := by
rw [Presieve.compatible_iff_sieveCompatible]
intro Z W f h hf
apply (hB (U.downward_closed hf h)).isSeparatedFor.ext
intro Y l hl
apply (hB' hf (l β« h)).ext
intro M m hm
have : bind U B (m β« l β« h β« f) := by
-- Porting note: had to make explicit the parameter `((m β« l β« h) β« f)` and
-- using `by exact`
have : bind U B ((m β« l β« h) β« f) := by exact Presieve.bind_comp f hf hm
simpa using this
trans s (m β« l β« h β« f) this
Β· have := ht (U.downward_closed hf h) _ ((B _).downward_closed hl m)
rw [op_comp, FunctorToTypes.map_comp_apply] at this
rw [this]
change s _ _ = s _ _
-- Porting note: the proof was `by simp`
congr 1
simp only [assoc]
Β· have h : s _ _ = _ := (ht hf _ hm).symm
-- Porting note: this was done by `simp only [assoc] at`
conv_lhs at h => congr; rw [assoc, assoc]
rw [h]
simp only [op_comp, assoc, FunctorToTypes.map_comp_apply]
refine β¨hU.amalgamate t hT, ?_, ?_β©
Β· rintro Z _ β¨Y, f, g, hg, hf, rflβ©
rw [op_comp, FunctorToTypes.map_comp_apply, Presieve.IsSheafFor.valid_glue _ _ _ hg]
apply ht hg _ hf
Β· intro y hy
apply hU.isSeparatedFor.ext
intro Y f hf
apply (hB hf).isSeparatedFor.ext
intro Z g hg
rw [β FunctorToTypes.map_comp_apply, β op_comp, hy _ (Presieve.bind_comp _ _ hg),
hU.valid_glue _ _ hf, ht hf _ hg]
| [
" Presieve.IsSheafFor P (Sieve.bind U.arrows B).arrows",
" β! t, s.IsAmalgamation t",
" β β¦Y : Cβ¦ β¦f : Y βΆ Xβ¦ (hf : U.arrows f), (y hf).Compatible",
" P.map gβ.op (y H fβ hfβ) = P.map gβ.op (y H fβ hfβ)",
" gβ β« fβ β« f = gβ β« fβ β« f",
" t.Compatible",
" t.SieveCompatible",
" t (h β« f) β― = P.map h.op (... | [
" Presieve.IsSheafFor P (Sieve.bind U.arrows B).arrows"
] |
import Mathlib.Analysis.BoxIntegral.Partition.Filter
import Mathlib.Analysis.BoxIntegral.Partition.Measure
import Mathlib.Topology.UniformSpace.Compact
import Mathlib.Init.Data.Bool.Lemmas
#align_import analysis.box_integral.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical Topology NNReal Filter Uniformity BoxIntegral
open Set Finset Function Filter Metric BoxIntegral.IntegrationParams
noncomputable section
namespace BoxIntegral
universe u v w
variable {ΞΉ : Type u} {E : Type v} {F : Type w} [NormedAddCommGroup E] [NormedSpace β E]
[NormedAddCommGroup F] [NormedSpace β F] {I J : Box ΞΉ} {Ο : TaggedPrepartition I}
open TaggedPrepartition
local notation "ββΏ" => ΞΉ β β
def integralSum (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : TaggedPrepartition I) : F :=
β J β Ο.boxes, vol J (f (Ο.tag J))
#align box_integral.integral_sum BoxIntegral.integralSum
| Mathlib/Analysis/BoxIntegral/Basic.lean | 83 | 87 | theorem integralSum_biUnionTagged (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : Prepartition I)
(Οi : β J, TaggedPrepartition J) :
integralSum f vol (Ο.biUnionTagged Οi) = β J β Ο.boxes, integralSum f vol (Οi J) := by |
refine (Ο.sum_biUnion_boxes _ _).trans <| sum_congr rfl fun J hJ => sum_congr rfl fun J' hJ' => ?_
rw [Ο.tag_biUnionTagged hJ hJ']
| [
" integralSum f vol (Ο.biUnionTagged Οi) = β J β Ο.boxes, integralSum f vol (Οi J)",
" (vol J') (f ((Ο.biUnionTagged Οi).tag J')) = (vol J') (f ((Οi J).tag J'))"
] | [
" integralSum f vol (Ο.biUnionTagged Οi) = β J β Ο.boxes, integralSum f vol (Οi J)"
] |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.BigOperators.Finsupp
#align_import algebra.big_operators.associated from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*}
-- the same local notation used in `Algebra.Associated`
local infixl:50 " ~α΅€ " => Associated
theorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M Γ N} :
x ~α΅€ z β x.1 ~α΅€ z.1 β§ x.2 ~α΅€ z.2 :=
β¨fun β¨u, huβ© => β¨β¨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1β©,
β¨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2β©β©,
fun β¨β¨uβ, hββ©, β¨uβ, hββ©β© =>
β¨MulEquiv.prodUnits.invFun (uβ, uβ), Prod.eq_iff_fst_eq_snd_eq.2 β¨hβ, hββ©β©β©
| Mathlib/Algebra/BigOperators/Associated.lean | 58 | 69 | theorem Associated.prod {M : Type*} [CommMonoid M] {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β M)
(g : ΞΉ β M) (h : β i, i β s β (f i) ~α΅€ (g i)) : (β i β s, f i) ~α΅€ (β i β s, g i) := by |
induction s using Finset.induction with
| empty =>
simp only [Finset.prod_empty]
rfl
| @insert j s hjs IH =>
classical
convert_to (β i β insert j s, f i) ~α΅€ (β i β insert j s, g i)
rw [Finset.prod_insert hjs, Finset.prod_insert hjs]
exact Associated.mul_mul (h j (Finset.mem_insert_self j s))
(IH (fun i hi β¦ h i (Finset.mem_insert_of_mem hi)))
| [
" β i β s, f i ~α΅€ β i β s, g i",
" β i β β
, f i ~α΅€ β i β β
, g i",
" 1 ~α΅€ 1",
" β i β insert j s, f i ~α΅€ β i β insert j s, g i",
" f j * β x β s, f x ~α΅€ g j * β x β s, g x"
] | [
" β i β s, f i ~α΅€ β i β s, g i"
] |
import Mathlib.CategoryTheory.Abelian.Opposite
import Mathlib.CategoryTheory.Abelian.Homology
import Mathlib.Algebra.Homology.Additive
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
#align_import algebra.homology.opposite from "leanprover-community/mathlib"@"8c75ef3517d4106e89fe524e6281d0b0545f47fc"
noncomputable section
open Opposite CategoryTheory CategoryTheory.Limits
section
variable {V : Type*} [Category V] [Abelian V]
| Mathlib/Algebra/Homology/Opposite.lean | 40 | 50 | theorem imageToKernel_op {X Y Z : V} (f : X βΆ Y) (g : Y βΆ Z) (w : f β« g = 0) :
imageToKernel g.op f.op (by rw [β op_comp, w, op_zero]) =
(imageSubobjectIso _ βͺβ« (imageOpOp _).symm).hom β«
(cokernel.desc f (factorThruImage g)
(by rw [β cancel_mono (image.ΞΉ g), Category.assoc, image.fac, w, zero_comp])).op β«
(kernelSubobjectIso _ βͺβ« kernelOpOp _).inv := by |
ext
simp only [Iso.trans_hom, Iso.symm_hom, Iso.trans_inv, kernelOpOp_inv, Category.assoc,
imageToKernel_arrow, kernelSubobject_arrow', kernel.lift_ΞΉ, β op_comp, cokernel.Ο_desc,
β imageSubobject_arrow, β imageUnopOp_inv_comp_op_factorThruImage g.op]
rfl
| [
" g.op β« f.op = 0",
" f β« factorThruImage g = 0",
" imageToKernel g.op f.op β― =\n (imageSubobjectIso g.op βͺβ« (imageOpOp g).symm).hom β«\n (cokernel.desc f (factorThruImage g) β―).op β« (kernelSubobjectIso f.op βͺβ« kernelOpOp f).inv",
" imageToKernel g.op f.op β― β« (kernelSubobject f.op).arrow =\n ((imag... | [
" g.op β« f.op = 0",
" f β« factorThruImage g = 0",
" imageToKernel g.op f.op β― =\n (imageSubobjectIso g.op βͺβ« (imageOpOp g).symm).hom β«\n (cokernel.desc f (factorThruImage g) β―).op β« (kernelSubobjectIso f.op βͺβ« kernelOpOp f).inv"
] |
import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform
import Mathlib.Analysis.Fourier.PoissonSummation
open Real Set MeasureTheory Filter Asymptotics intervalIntegral
open scoped Real Topology FourierTransform RealInnerProductSpace
open Complex hiding exp continuous_exp abs_of_nonneg sq_abs
noncomputable section
section GaussianPoisson
variable {E : Type*} [NormedAddCommGroup E]
lemma rexp_neg_quadratic_isLittleO_rpow_atTop {a : β} (ha : a < 0) (b s : β) :
(fun x β¦ rexp (a * x ^ 2 + b * x)) =o[atTop] (Β· ^ s) := by
suffices (fun x β¦ rexp (a * x ^ 2 + b * x)) =o[atTop] (fun x β¦ rexp (-x)) by
refine this.trans ?_
simpa only [neg_one_mul] using isLittleO_exp_neg_mul_rpow_atTop zero_lt_one s
rw [isLittleO_exp_comp_exp_comp]
have : (fun x β¦ -x - (a * x ^ 2 + b * x)) = fun x β¦ x * (-a * x - (b + 1)) := by
ext1 x; ring_nf
rw [this]
exact tendsto_id.atTop_mul_atTop <|
Filter.tendsto_atTop_add_const_right _ _ <| tendsto_id.const_mul_atTop (neg_pos.mpr ha)
lemma cexp_neg_quadratic_isLittleO_rpow_atTop {a : β} (ha : a.re < 0) (b : β) (s : β) :
(fun x : β β¦ cexp (a * x ^ 2 + b * x)) =o[atTop] (Β· ^ s) := by
apply Asymptotics.IsLittleO.of_norm_left
convert rexp_neg_quadratic_isLittleO_rpow_atTop ha b.re s with x
simp_rw [Complex.norm_eq_abs, Complex.abs_exp, add_re, β ofReal_pow, mul_comm (_ : β) β(_ : β),
re_ofReal_mul, mul_comm _ (re _)]
lemma cexp_neg_quadratic_isLittleO_abs_rpow_cocompact {a : β} (ha : a.re < 0) (b : β) (s : β) :
(fun x : β β¦ cexp (a * x ^ 2 + b * x)) =o[cocompact β] (|Β·| ^ s) := by
rw [cocompact_eq_atBot_atTop, isLittleO_sup]
constructor
Β· refine ((cexp_neg_quadratic_isLittleO_rpow_atTop ha (-b) s).comp_tendsto
Filter.tendsto_neg_atBot_atTop).congr' (eventually_of_forall fun x β¦ ?_) ?_
Β· simp only [neg_mul, Function.comp_apply, ofReal_neg, neg_sq, mul_neg, neg_neg]
Β· refine (eventually_lt_atBot 0).mp (eventually_of_forall fun x hx β¦ ?_)
simp only [Function.comp_apply, abs_of_neg hx]
Β· refine (cexp_neg_quadratic_isLittleO_rpow_atTop ha b s).congr' EventuallyEq.rfl ?_
refine (eventually_gt_atTop 0).mp (eventually_of_forall fun x hx β¦ ?_)
simp_rw [abs_of_pos hx]
| Mathlib/Analysis/SpecialFunctions/Gaussian/PoissonSummation.lean | 68 | 76 | theorem tendsto_rpow_abs_mul_exp_neg_mul_sq_cocompact {a : β} (ha : 0 < a) (s : β) :
Tendsto (fun x : β => |x| ^ s * rexp (-a * x ^ 2)) (cocompact β) (π 0) := by |
conv in rexp _ => rw [β sq_abs]
erw [cocompact_eq_atBot_atTop, β comap_abs_atTop,
@tendsto_comap'_iff _ _ _ (fun y => y ^ s * rexp (-a * y ^ 2)) _ _ _
(mem_atTop_sets.mpr β¨0, fun b hb => β¨b, abs_of_nonneg hbβ©β©)]
exact
(rpow_mul_exp_neg_mul_sq_isLittleO_exp_neg ha s).tendsto_zero_of_tendsto
(tendsto_exp_atBot.comp <| tendsto_id.const_mul_atTop_of_neg (neg_lt_zero.mpr one_half_pos))
| [
" (fun x => rexp (a * x ^ 2 + b * x)) =o[atTop] fun x => x ^ s",
" (fun x => rexp (-x)) =o[atTop] fun x => x ^ s",
" (fun x => rexp (a * x ^ 2 + b * x)) =o[atTop] fun x => rexp (-x)",
" Tendsto (fun x => -x - (a * x ^ 2 + b * x)) atTop atTop",
" (fun x => -x - (a * x ^ 2 + b * x)) = fun x => x * (-a * x - (... | [
" (fun x => rexp (a * x ^ 2 + b * x)) =o[atTop] fun x => x ^ s",
" (fun x => rexp (-x)) =o[atTop] fun x => x ^ s",
" (fun x => rexp (a * x ^ 2 + b * x)) =o[atTop] fun x => rexp (-x)",
" Tendsto (fun x => -x - (a * x ^ 2 + b * x)) atTop atTop",
" (fun x => -x - (a * x ^ 2 + b * x)) = fun x => x * (-a * x - (... |
import Mathlib.Topology.UniformSpace.CompleteSeparated
import Mathlib.Topology.EMetricSpace.Lipschitz
import Mathlib.Topology.MetricSpace.Basic
import Mathlib.Topology.MetricSpace.Bounded
#align_import topology.metric_space.antilipschitz from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
variable {Ξ± Ξ² Ξ³ : Type*}
open scoped NNReal ENNReal Uniformity Topology
open Set Filter Bornology
def AntilipschitzWith [PseudoEMetricSpace Ξ±] [PseudoEMetricSpace Ξ²] (K : ββ₯0) (f : Ξ± β Ξ²) :=
β x y, edist x y β€ K * edist (f x) (f y)
#align antilipschitz_with AntilipschitzWith
theorem AntilipschitzWith.edist_lt_top [PseudoEMetricSpace Ξ±] [PseudoMetricSpace Ξ²] {K : ββ₯0}
{f : Ξ± β Ξ²} (h : AntilipschitzWith K f) (x y : Ξ±) : edist x y < β€ :=
(h x y).trans_lt <| ENNReal.mul_lt_top ENNReal.coe_ne_top (edist_ne_top _ _)
#align antilipschitz_with.edist_lt_top AntilipschitzWith.edist_lt_top
theorem AntilipschitzWith.edist_ne_top [PseudoEMetricSpace Ξ±] [PseudoMetricSpace Ξ²] {K : ββ₯0}
{f : Ξ± β Ξ²} (h : AntilipschitzWith K f) (x y : Ξ±) : edist x y β β€ :=
(h.edist_lt_top x y).ne
#align antilipschitz_with.edist_ne_top AntilipschitzWith.edist_ne_top
section Metric
variable [PseudoMetricSpace Ξ±] [PseudoMetricSpace Ξ²] {K : ββ₯0} {f : Ξ± β Ξ²}
theorem antilipschitzWith_iff_le_mul_nndist :
AntilipschitzWith K f β β x y, nndist x y β€ K * nndist (f x) (f y) := by
simp only [AntilipschitzWith, edist_nndist]
norm_cast
#align antilipschitz_with_iff_le_mul_nndist antilipschitzWith_iff_le_mul_nndist
alias β¨AntilipschitzWith.le_mul_nndist, AntilipschitzWith.of_le_mul_nndistβ© :=
antilipschitzWith_iff_le_mul_nndist
#align antilipschitz_with.le_mul_nndist AntilipschitzWith.le_mul_nndist
#align antilipschitz_with.of_le_mul_nndist AntilipschitzWith.of_le_mul_nndist
theorem antilipschitzWith_iff_le_mul_dist :
AntilipschitzWith K f β β x y, dist x y β€ K * dist (f x) (f y) := by
simp only [antilipschitzWith_iff_le_mul_nndist, dist_nndist]
norm_cast
#align antilipschitz_with_iff_le_mul_dist antilipschitzWith_iff_le_mul_dist
alias β¨AntilipschitzWith.le_mul_dist, AntilipschitzWith.of_le_mul_distβ© :=
antilipschitzWith_iff_le_mul_dist
#align antilipschitz_with.le_mul_dist AntilipschitzWith.le_mul_dist
#align antilipschitz_with.of_le_mul_dist AntilipschitzWith.of_le_mul_dist
namespace AntilipschitzWith
variable [PseudoEMetricSpace Ξ±] [PseudoEMetricSpace Ξ²] [PseudoEMetricSpace Ξ³]
variable {K : ββ₯0} {f : Ξ± β Ξ²}
open EMetric
-- uses neither `f` nor `hf`
@[nolint unusedArguments]
protected def k (_hf : AntilipschitzWith K f) : ββ₯0 := K
set_option linter.uppercaseLean3 false in
#align antilipschitz_with.K AntilipschitzWith.k
protected theorem injective {Ξ± : Type*} {Ξ² : Type*} [EMetricSpace Ξ±] [PseudoEMetricSpace Ξ²]
{K : ββ₯0} {f : Ξ± β Ξ²} (hf : AntilipschitzWith K f) : Function.Injective f := fun x y h => by
simpa only [h, edist_self, mul_zero, edist_le_zero] using hf x y
#align antilipschitz_with.injective AntilipschitzWith.injective
theorem mul_le_edist (hf : AntilipschitzWith K f) (x y : Ξ±) :
(K : ββ₯0β)β»ΒΉ * edist x y β€ edist (f x) (f y) := by
rw [mul_comm, β div_eq_mul_inv]
exact ENNReal.div_le_of_le_mul' (hf x y)
#align antilipschitz_with.mul_le_edist AntilipschitzWith.mul_le_edist
theorem ediam_preimage_le (hf : AntilipschitzWith K f) (s : Set Ξ²) : diam (f β»ΒΉ' s) β€ K * diam s :=
diam_le fun x hx y hy => (hf x y).trans <|
mul_le_mul_left' (edist_le_diam_of_mem (mem_preimage.1 hx) hy) K
#align antilipschitz_with.ediam_preimage_le AntilipschitzWith.ediam_preimage_le
theorem le_mul_ediam_image (hf : AntilipschitzWith K f) (s : Set Ξ±) : diam s β€ K * diam (f '' s) :=
(diam_mono (subset_preimage_image _ _)).trans (hf.ediam_preimage_le (f '' s))
#align antilipschitz_with.le_mul_ediam_image AntilipschitzWith.le_mul_ediam_image
protected theorem id : AntilipschitzWith 1 (id : Ξ± β Ξ±) := fun x y => by
simp only [ENNReal.coe_one, one_mul, id, le_refl]
#align antilipschitz_with.id AntilipschitzWith.id
| Mathlib/Topology/MetricSpace/Antilipschitz.lean | 129 | 134 | theorem comp {Kg : ββ₯0} {g : Ξ² β Ξ³} (hg : AntilipschitzWith Kg g) {Kf : ββ₯0} {f : Ξ± β Ξ²}
(hf : AntilipschitzWith Kf f) : AntilipschitzWith (Kf * Kg) (g β f) := fun x y =>
calc
edist x y β€ Kf * edist (f x) (f y) := hf x y
_ β€ Kf * (Kg * edist (g (f x)) (g (f y))) := ENNReal.mul_left_mono (hg _ _)
_ = _ := by | rw [ENNReal.coe_mul, mul_assoc]; rfl
| [
" AntilipschitzWith K f β β (x y : Ξ±), nndist x y β€ K * nndist (f x) (f y)",
" (β (x y : Ξ±), β(nndist x y) β€ βK * β(nndist (f x) (f y))) β β (x y : Ξ±), nndist x y β€ K * nndist (f x) (f y)",
" AntilipschitzWith K f β β (x y : Ξ±), dist x y β€ βK * dist (f x) (f y)",
" (β (x y : Ξ±), nndist x y β€ K * nndist (f x) ... | [
" AntilipschitzWith K f β β (x y : Ξ±), nndist x y β€ K * nndist (f x) (f y)",
" (β (x y : Ξ±), β(nndist x y) β€ βK * β(nndist (f x) (f y))) β β (x y : Ξ±), nndist x y β€ K * nndist (f x) (f y)",
" AntilipschitzWith K f β β (x y : Ξ±), dist x y β€ βK * dist (f x) (f y)",
" (β (x y : Ξ±), nndist x y β€ K * nndist (f x) ... |
import Mathlib.Topology.Separation
#align_import topology.sober from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
open Set
variable {Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [TopologicalSpace Ξ²]
section genericPoint
def IsGenericPoint (x : Ξ±) (S : Set Ξ±) : Prop :=
closure ({x} : Set Ξ±) = S
#align is_generic_point IsGenericPoint
theorem isGenericPoint_def {x : Ξ±} {S : Set Ξ±} : IsGenericPoint x S β closure ({x} : Set Ξ±) = S :=
Iff.rfl
#align is_generic_point_def isGenericPoint_def
theorem IsGenericPoint.def {x : Ξ±} {S : Set Ξ±} (h : IsGenericPoint x S) :
closure ({x} : Set Ξ±) = S :=
h
#align is_generic_point.def IsGenericPoint.def
theorem isGenericPoint_closure {x : Ξ±} : IsGenericPoint x (closure ({x} : Set Ξ±)) :=
refl _
#align is_generic_point_closure isGenericPoint_closure
variable {x y : Ξ±} {S U Z : Set Ξ±}
theorem isGenericPoint_iff_specializes : IsGenericPoint x S β β y, x β€³ y β y β S := by
simp only [specializes_iff_mem_closure, IsGenericPoint, Set.ext_iff]
#align is_generic_point_iff_specializes isGenericPoint_iff_specializes
section Sober
@[mk_iff]
class QuasiSober (Ξ± : Type*) [TopologicalSpace Ξ±] : Prop where
sober : β {S : Set Ξ±}, IsIrreducible S β IsClosed S β β x, IsGenericPoint x S
#align quasi_sober QuasiSober
noncomputable def IsIrreducible.genericPoint [QuasiSober Ξ±] {S : Set Ξ±} (hS : IsIrreducible S) :
Ξ± :=
(QuasiSober.sober hS.closure isClosed_closure).choose
#align is_irreducible.generic_point IsIrreducible.genericPoint
theorem IsIrreducible.genericPoint_spec [QuasiSober Ξ±] {S : Set Ξ±} (hS : IsIrreducible S) :
IsGenericPoint hS.genericPoint (closure S) :=
(QuasiSober.sober hS.closure isClosed_closure).choose_spec
#align is_irreducible.generic_point_spec IsIrreducible.genericPoint_spec
@[simp]
theorem IsIrreducible.genericPoint_closure_eq [QuasiSober Ξ±] {S : Set Ξ±} (hS : IsIrreducible S) :
closure ({hS.genericPoint} : Set Ξ±) = closure S :=
hS.genericPoint_spec
#align is_irreducible.generic_point_closure_eq IsIrreducible.genericPoint_closure_eq
variable (Ξ±)
noncomputable def genericPoint [QuasiSober Ξ±] [IrreducibleSpace Ξ±] : Ξ± :=
(IrreducibleSpace.isIrreducible_univ Ξ±).genericPoint
#align generic_point genericPoint
| Mathlib/Topology/Sober.lean | 148 | 150 | theorem genericPoint_spec [QuasiSober Ξ±] [IrreducibleSpace Ξ±] :
IsGenericPoint (genericPoint Ξ±) β€ := by |
simpa using (IrreducibleSpace.isIrreducible_univ Ξ±).genericPoint_spec
| [
" IsGenericPoint x S β β (y : Ξ±), x β€³ y β y β S",
" IsGenericPoint (genericPoint Ξ±) β€"
] | [
" IsGenericPoint x S β β (y : Ξ±), x β€³ y β y β S",
" IsGenericPoint (genericPoint Ξ±) β€"
] |
import Mathlib.Algebra.Polynomial.FieldDivision
import Mathlib.FieldTheory.Minpoly.Basic
import Mathlib.RingTheory.Algebraic
#align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5"
open scoped Classical
open Polynomial Set Function minpoly
namespace minpoly
variable {A B : Type*}
variable (A) [Field A]
section Ring
variable [Ring B] [Algebra A B] (x : B)
theorem degree_le_of_ne_zero {p : A[X]} (pnz : p β 0) (hp : Polynomial.aeval x p = 0) :
degree (minpoly A x) β€ degree p :=
calc
degree (minpoly A x) β€ degree (p * C (leadingCoeff p)β»ΒΉ) :=
min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp])
_ = degree p := degree_mul_leadingCoeff_inv p pnz
#align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero
theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e β 0 :=
minpoly.ne_zero <| .of_finite A _
#align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite
theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0)
(pmin : β q : A[X], q.Monic β Polynomial.aeval x q = 0 β degree p β€ degree q) :
p = minpoly A x := by
have hx : IsIntegral A x := β¨p, pmonic, hpβ©
symm; apply eq_of_sub_eq_zero
by_contra hnz
apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt
apply degree_sub_lt _ (minpoly.ne_zero hx)
Β· rw [(monic hx).leadingCoeff, pmonic.leadingCoeff]
Β· exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x))
#align minpoly.unique minpoly.unique
theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x β£ p := by
by_cases hp0 : p = 0
Β· simp only [hp0, dvd_zero]
have hx : IsIntegral A x := IsAlgebraic.isIntegral β¨p, hp0, hpβ©
rw [β modByMonic_eq_zero_iff_dvd (monic hx)]
by_contra hnz
apply degree_le_of_ne_zero A x hnz
((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt
exact degree_modByMonic_lt _ (monic hx)
#align minpoly.dvd minpoly.dvd
variable {A x} in
lemma dvd_iff {p : A[X]} : minpoly A x β£ p β Polynomial.aeval x p = 0 :=
β¨fun β¨q, hqβ© β¦ by rw [hq, map_mul, aeval, zero_mul], minpoly.dvd A xβ©
theorem isRadical [IsReduced B] : IsRadical (minpoly A x) := fun n p dvd β¦ by
rw [dvd_iff] at dvd β’; rw [map_pow] at dvd; exact IsReduced.eq_zero _ β¨n, dvdβ©
theorem dvd_map_of_isScalarTower (A K : Type*) {R : Type*} [CommRing A] [Field K] [CommRing R]
[Algebra A K] [Algebra A R] [Algebra K R] [IsScalarTower A K R] (x : R) :
minpoly K x β£ (minpoly A x).map (algebraMap A K) := by
refine minpoly.dvd K x ?_
rw [aeval_map_algebraMap, minpoly.aeval]
#align minpoly.dvd_map_of_is_scalar_tower minpoly.dvd_map_of_isScalarTower
| Mathlib/FieldTheory/Minpoly/Field.lean | 93 | 99 | theorem dvd_map_of_isScalarTower' (R : Type*) {S : Type*} (K L : Type*) [CommRing R]
[CommRing S] [Field K] [CommRing L] [Algebra R S] [Algebra R K] [Algebra S L] [Algebra K L]
[Algebra R L] [IsScalarTower R K L] [IsScalarTower R S L] (s : S) :
minpoly K (algebraMap S L s) β£ map (algebraMap R K) (minpoly R s) := by |
apply minpoly.dvd K (algebraMap S L s)
rw [β map_aeval_eq_aeval_map, minpoly.aeval, map_zero]
rw [β IsScalarTower.algebraMap_eq, β IsScalarTower.algebraMap_eq]
| [
" (Polynomial.aeval x) (p * C p.leadingCoeffβ»ΒΉ) = 0",
" p = minpoly A x",
" minpoly A x = p",
" minpoly A x - p = 0",
" False",
" (Polynomial.aeval x) (minpoly A x - p) = 0",
" (minpoly A x - p).degree < (minpoly A x).degree",
" (minpoly A x).leadingCoeff = p.leadingCoeff",
" (minpoly A x).degree = ... | [
" (Polynomial.aeval x) (p * C p.leadingCoeffβ»ΒΉ) = 0",
" p = minpoly A x",
" minpoly A x = p",
" minpoly A x - p = 0",
" False",
" (Polynomial.aeval x) (minpoly A x - p) = 0",
" (minpoly A x - p).degree < (minpoly A x).degree",
" (minpoly A x).leadingCoeff = p.leadingCoeff",
" (minpoly A x).degree = ... |
import Mathlib.Dynamics.PeriodicPts
import Mathlib.GroupTheory.Exponent
import Mathlib.GroupTheory.GroupAction.Basic
namespace MulAction
universe u v
variable {Ξ± : Type v}
variable {G : Type u} [Group G] [MulAction G Ξ±]
variable {M : Type u} [Monoid M] [MulAction M Ξ±]
@[to_additive "If the action is periodic, then a lower bound for its period can be computed."]
theorem le_period {m : M} {a : Ξ±} {n : β} (period_pos : 0 < period m a)
(moved : β k, 0 < k β k < n β m ^ k β’ a β a) : n β€ period m a :=
le_of_not_gt fun period_lt_n =>
moved _ period_pos period_lt_n <| pow_period_smul m a
@[to_additive "If for some `n`, `(n β’ m) +α΅₯ a = a`, then `period m a β€ n`."]
theorem period_le_of_fixed {m : M} {a : Ξ±} {n : β} (n_pos : 0 < n) (fixed : m ^ n β’ a = a) :
period m a β€ n :=
(isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_le n_pos
@[to_additive "If for some `n`, `(n β’ m) +α΅₯ a = a`, then `0 < period m a`."]
theorem period_pos_of_fixed {m : M} {a : Ξ±} {n : β} (n_pos : 0 < n) (fixed : m ^ n β’ a = a) :
0 < period m a :=
(isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_pos n_pos
@[to_additive]
theorem period_eq_one_iff {m : M} {a : Ξ±} : period m a = 1 β m β’ a = a :=
β¨fun eq_one => pow_one m βΈ eq_one βΈ pow_period_smul m a,
fun fixed => le_antisymm
(period_le_of_fixed one_pos (by simpa))
(period_pos_of_fixed one_pos (by simpa))β©
@[to_additive "For any non-zero `n` less than the period of `m` on `a`, `a` is moved by `n β’ m`."]
theorem pow_smul_ne_of_lt_period {m : M} {a : Ξ±} {n : β} (n_pos : 0 < n)
(n_lt_period : n < period m a) : m ^ n β’ a β a := fun a_fixed =>
not_le_of_gt n_lt_period <| period_le_of_fixed n_pos a_fixed
section Identities
variable (M) in
@[to_additive (attr := simp)]
theorem period_one (a : Ξ±) : period (1 : M) a = 1 := period_eq_one_iff.mpr (one_smul M a)
@[to_additive (attr := simp)]
| Mathlib/GroupTheory/GroupAction/Period.lean | 71 | 75 | theorem period_inv (g : G) (a : Ξ±) : period gβ»ΒΉ a = period g a := by |
simp only [period_eq_minimalPeriod, Function.minimalPeriod_eq_minimalPeriod_iff,
isPeriodicPt_smul_iff]
intro n
rw [smul_eq_iff_eq_inv_smul, eq_comm, β zpow_natCast, inv_zpow, inv_inv, zpow_natCast]
| [
" m ^ 1 β’ a = a",
" period gβ»ΒΉ a = period g a",
" β (n : β), gβ»ΒΉ ^ n β’ a = a β g ^ n β’ a = a",
" gβ»ΒΉ ^ n β’ a = a β g ^ n β’ a = a"
] | [
" m ^ 1 β’ a = a",
" period gβ»ΒΉ a = period g a"
] |
import Mathlib.Data.Setoid.Partition
import Mathlib.GroupTheory.GroupAction.Basic
import Mathlib.GroupTheory.GroupAction.Pointwise
import Mathlib.GroupTheory.GroupAction.SubMulAction
open scoped BigOperators Pointwise
namespace MulAction
section orbits
variable {G : Type*} [Group G] {X : Type*} [MulAction G X]
theorem orbit.eq_or_disjoint (a b : X) :
orbit G a = orbit G b β¨ Disjoint (orbit G a) (orbit G b) := by
apply (em (Disjoint (orbit G a) (orbit G b))).symm.imp _ id
simp (config := { contextual := true })
only [Set.not_disjoint_iff, β orbit_eq_iff, forall_exists_index, and_imp, eq_comm, implies_true]
| Mathlib/GroupTheory/GroupAction/Blocks.lean | 44 | 48 | theorem orbit.pairwiseDisjoint :
(Set.range fun x : X => orbit G x).PairwiseDisjoint id := by |
rintro s β¨x, rflβ© t β¨y, rflβ© h
contrapose! h
exact (orbit.eq_or_disjoint x y).resolve_right h
| [
" orbit G a = orbit G b β¨ Disjoint (orbit G a) (orbit G b)",
" Β¬Disjoint (orbit G a) (orbit G b) β orbit G a = orbit G b",
" (Set.range fun x => orbit G x).PairwiseDisjoint id",
" (Disjoint on id) ((fun x => orbit G x) x) ((fun x => orbit G x) y)",
" orbit G x = orbit G y"
] | [
" orbit G a = orbit G b β¨ Disjoint (orbit G a) (orbit G b)",
" Β¬Disjoint (orbit G a) (orbit G b) β orbit G a = orbit G b",
" (Set.range fun x => orbit G x).PairwiseDisjoint id"
] |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af"
variable {l m n Ξ± : Type*}
namespace Matrix
open scoped Matrix
section CommRing
variable [Fintype l] [Fintype m] [Fintype n]
variable [DecidableEq l] [DecidableEq m] [DecidableEq n]
variable [CommRing Ξ±]
theorem fromBlocks_eq_of_invertibleββ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±)
(D : Matrix l n Ξ±) [Invertible A] :
fromBlocks A B C D =
fromBlocks 1 0 (C * β
A) 1 * fromBlocks A 0 0 (D - C * β
A * B) *
fromBlocks 1 (β
A * B) 0 1 := by
simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add,
Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc,
Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel]
#align matrix.from_blocks_eq_of_invertibleββ Matrix.fromBlocks_eq_of_invertibleββ
theorem fromBlocks_eq_of_invertibleββ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±)
(D : Matrix n n Ξ±) [Invertible D] :
fromBlocks A B C D =
fromBlocks 1 (B * β
D) 0 1 * fromBlocks (A - B * β
D * C) 0 0 D *
fromBlocks 1 0 (β
D * C) 1 :=
(Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by
simpa [reindex_apply, Equiv.sumComm_symm, β submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), β
submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply,
fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertibleββ D C B A
#align matrix.from_blocks_eq_of_invertibleββ Matrix.fromBlocks_eq_of_invertibleββ
section Det
theorem det_fromBlocksββ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±)
(D : Matrix n n Ξ±) [Invertible A] :
(Matrix.fromBlocks A B C D).det = det A * det (D - C * β
A * B) := by
rw [fromBlocks_eq_of_invertibleββ (A := A), det_mul, det_mul, det_fromBlocks_zeroββ,
det_fromBlocks_zeroββ, det_fromBlocks_zeroββ, det_one, det_one, one_mul, one_mul, mul_one]
#align matrix.det_from_blocksββ Matrix.det_fromBlocksββ
@[simp]
theorem det_fromBlocks_oneββ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) :
(Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by
haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne
rw [det_fromBlocksββ, invOf_one, Matrix.mul_one, det_one, one_mul]
#align matrix.det_from_blocks_oneββ Matrix.det_fromBlocks_oneββ
theorem det_fromBlocksββ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±)
(D : Matrix n n Ξ±) [Invertible D] :
(Matrix.fromBlocks A B C D).det = det D * det (A - B * β
D * C) := by
have : fromBlocks A B C D =
(fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by
ext (i j)
cases i <;> cases j <;> rfl
rw [this, det_submatrix_equiv_self, det_fromBlocksββ]
#align matrix.det_from_blocksββ Matrix.det_fromBlocksββ
@[simp]
theorem det_fromBlocks_oneββ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) :
(Matrix.fromBlocks A B C 1).det = det (A - B * C) := by
haveI : Invertible (1 : Matrix n n Ξ±) := invertibleOne
rw [det_fromBlocksββ, invOf_one, Matrix.mul_one, det_one, one_mul]
#align matrix.det_from_blocks_oneββ Matrix.det_fromBlocks_oneββ
theorem det_one_add_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) :
det (1 + A * B) = det (1 + B * A) :=
calc
det (1 + A * B) = det (fromBlocks 1 (-A) B 1) := by
rw [det_fromBlocks_oneββ, Matrix.neg_mul, sub_neg_eq_add]
_ = det (1 + B * A) := by rw [det_fromBlocks_oneββ, Matrix.mul_neg, sub_neg_eq_add]
#align matrix.det_one_add_mul_comm Matrix.det_one_add_mul_comm
theorem det_mul_add_one_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) :
det (A * B + 1) = det (B * A + 1) := by rw [add_comm, det_one_add_mul_comm, add_comm]
#align matrix.det_mul_add_one_comm Matrix.det_mul_add_one_comm
theorem det_one_sub_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) :
det (1 - A * B) = det (1 - B * A) := by
rw [sub_eq_add_neg, β Matrix.neg_mul, det_one_add_mul_comm, Matrix.mul_neg, β sub_eq_add_neg]
#align matrix.det_one_sub_mul_comm Matrix.det_one_sub_mul_comm
theorem det_one_add_col_mul_row (u v : m β Ξ±) : det (1 + col u * row v) = 1 + v β¬α΅₯ u := by
rw [det_one_add_mul_comm, det_unique, Pi.add_apply, Pi.add_apply, Matrix.one_apply_eq,
Matrix.row_mul_col_apply]
#align matrix.det_one_add_col_mul_row Matrix.det_one_add_col_mul_row
| Mathlib/LinearAlgebra/Matrix/SchurComplement.lean | 454 | 459 | theorem det_add_col_mul_row {A : Matrix m m Ξ±} (hA : IsUnit A.det) (u v : m β Ξ±) :
(A + col u * row v).det = A.det * (1 + row v * Aβ»ΒΉ * col u).det := by |
nth_rewrite 1 [β Matrix.mul_one A]
rwa [β Matrix.mul_nonsing_inv_cancel_left A (col u * row v),
β Matrix.mul_add, det_mul, β Matrix.mul_assoc, det_one_add_mul_comm,
β Matrix.mul_assoc]
| [
" A.fromBlocks B C D = fromBlocks 1 0 (C * β
A) 1 * A.fromBlocks 0 0 (D - C * β
A * B) * fromBlocks 1 (β
A * B) 0 1",
" (reindex (Equiv.sumComm l n) (Equiv.sumComm m n)) (A.fromBlocks B C D) =\n (reindex (Equiv.sumComm l n) (Equiv.sumComm m n))\n (fromBlocks 1 (B * β
D) 0 1 * (A - B * β
D * C).fromBlocks 0 0 D... | [
" A.fromBlocks B C D = fromBlocks 1 0 (C * β
A) 1 * A.fromBlocks 0 0 (D - C * β
A * B) * fromBlocks 1 (β
A * B) 0 1",
" (reindex (Equiv.sumComm l n) (Equiv.sumComm m n)) (A.fromBlocks B C D) =\n (reindex (Equiv.sumComm l n) (Equiv.sumComm m n))\n (fromBlocks 1 (B * β
D) 0 1 * (A - B * β
D * C).fromBlocks 0 0 D... |
import Mathlib.MeasureTheory.Measure.Sub
import Mathlib.MeasureTheory.Decomposition.SignedHahn
import Mathlib.MeasureTheory.Function.AEEqOfIntegral
#align_import measure_theory.decomposition.lebesgue from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f"
open scoped MeasureTheory NNReal ENNReal
open Set
namespace MeasureTheory
namespace Measure
variable {Ξ± Ξ² : Type*} {m : MeasurableSpace Ξ±} {ΞΌ Ξ½ : Measure Ξ±}
class HaveLebesgueDecomposition (ΞΌ Ξ½ : Measure Ξ±) : Prop where
lebesgue_decomposition :
β p : Measure Ξ± Γ (Ξ± β ββ₯0β), Measurable p.2 β§ p.1 ββ Ξ½ β§ ΞΌ = p.1 + Ξ½.withDensity p.2
#align measure_theory.measure.have_lebesgue_decomposition MeasureTheory.Measure.HaveLebesgueDecomposition
#align measure_theory.measure.have_lebesgue_decomposition.lebesgue_decomposition MeasureTheory.Measure.HaveLebesgueDecomposition.lebesgue_decomposition
open Classical in
noncomputable irreducible_def singularPart (ΞΌ Ξ½ : Measure Ξ±) : Measure Ξ± :=
if h : HaveLebesgueDecomposition ΞΌ Ξ½ then (Classical.choose h.lebesgue_decomposition).1 else 0
#align measure_theory.measure.singular_part MeasureTheory.Measure.singularPart
open Classical in
noncomputable irreducible_def rnDeriv (ΞΌ Ξ½ : Measure Ξ±) : Ξ± β ββ₯0β :=
if h : HaveLebesgueDecomposition ΞΌ Ξ½ then (Classical.choose h.lebesgue_decomposition).2 else 0
#align measure_theory.measure.rn_deriv MeasureTheory.Measure.rnDeriv
section ByDefinition
| Mathlib/MeasureTheory/Decomposition/Lebesgue.lean | 86 | 90 | theorem haveLebesgueDecomposition_spec (ΞΌ Ξ½ : Measure Ξ±) [h : HaveLebesgueDecomposition ΞΌ Ξ½] :
Measurable (ΞΌ.rnDeriv Ξ½) β§
ΞΌ.singularPart Ξ½ ββ Ξ½ β§ ΞΌ = ΞΌ.singularPart Ξ½ + Ξ½.withDensity (ΞΌ.rnDeriv Ξ½) := by |
rw [singularPart, rnDeriv, dif_pos h, dif_pos h]
exact Classical.choose_spec h.lebesgue_decomposition
| [
" Measurable (ΞΌ.rnDeriv Ξ½) β§ ΞΌ.singularPart Ξ½ ββ Ξ½ β§ ΞΌ = ΞΌ.singularPart Ξ½ + Ξ½.withDensity (ΞΌ.rnDeriv Ξ½)",
" Measurable (Classical.choose β―).2 β§\n (Classical.choose β―).1 ββ Ξ½ β§ ΞΌ = (Classical.choose β―).1 + Ξ½.withDensity (Classical.choose β―).2"
] | [
" Measurable (ΞΌ.rnDeriv Ξ½) β§ ΞΌ.singularPart Ξ½ ββ Ξ½ β§ ΞΌ = ΞΌ.singularPart Ξ½ + Ξ½.withDensity (ΞΌ.rnDeriv Ξ½)"
] |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Tactic.Common
#align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
variable {Ξ± : Type*}
namespace Coheyting
variable [CoheytingAlgebra Ξ±] {a b : Ξ±}
def boundary (a : Ξ±) : Ξ± :=
a β οΏ’a
#align coheyting.boundary Coheyting.boundary
scoped[Heyting] prefix:120 "β " => Coheyting.boundary
-- Porting note: Should the notation be automatically included in the current scope?
open Heyting
-- Porting note: Should hnot be named hNot?
theorem inf_hnot_self (a : Ξ±) : a β οΏ’a = β a :=
rfl
#align coheyting.inf_hnot_self Coheyting.inf_hnot_self
theorem boundary_le : β a β€ a :=
inf_le_left
#align coheyting.boundary_le Coheyting.boundary_le
theorem boundary_le_hnot : β a β€ οΏ’a :=
inf_le_right
#align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot
@[simp]
theorem boundary_bot : β (β₯ : Ξ±) = β₯ := bot_inf_eq _
#align coheyting.boundary_bot Coheyting.boundary_bot
@[simp]
theorem boundary_top : β (β€ : Ξ±) = β₯ := by rw [boundary, hnot_top, inf_bot_eq]
#align coheyting.boundary_top Coheyting.boundary_top
theorem boundary_hnot_le (a : Ξ±) : β (οΏ’a) β€ β a :=
(inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le
#align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le
@[simp]
| Mathlib/Order/Heyting/Boundary.lean | 71 | 72 | theorem boundary_hnot_hnot (a : Ξ±) : β (οΏ’οΏ’a) = β (οΏ’a) := by |
simp_rw [boundary, hnot_hnot_hnot, inf_comm]
| [
" β β€ = β₯",
" β (οΏ’οΏ’a) = β (οΏ’a)"
] | [
" β β€ = β₯",
" β (οΏ’οΏ’a) = β (οΏ’a)"
] |
import Mathlib.RingTheory.GradedAlgebra.HomogeneousIdeal
import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.Topology.Sets.Opens
import Mathlib.Data.Set.Subsingleton
#align_import algebraic_geometry.projective_spectrum.topology from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
noncomputable section
open DirectSum Pointwise SetLike TopCat TopologicalSpace CategoryTheory Opposite
variable {R A : Type*}
variable [CommSemiring R] [CommRing A] [Algebra R A]
variable (π : β β Submodule R A) [GradedAlgebra π]
-- porting note (#5171): removed @[nolint has_nonempty_instance]
@[ext]
structure ProjectiveSpectrum where
asHomogeneousIdeal : HomogeneousIdeal π
isPrime : asHomogeneousIdeal.toIdeal.IsPrime
not_irrelevant_le : Β¬HomogeneousIdeal.irrelevant π β€ asHomogeneousIdeal
#align projective_spectrum ProjectiveSpectrum
attribute [instance] ProjectiveSpectrum.isPrime
namespace ProjectiveSpectrum
def zeroLocus (s : Set A) : Set (ProjectiveSpectrum π) :=
{ x | s β x.asHomogeneousIdeal }
#align projective_spectrum.zero_locus ProjectiveSpectrum.zeroLocus
@[simp]
theorem mem_zeroLocus (x : ProjectiveSpectrum π) (s : Set A) :
x β zeroLocus π s β s β x.asHomogeneousIdeal :=
Iff.rfl
#align projective_spectrum.mem_zero_locus ProjectiveSpectrum.mem_zeroLocus
@[simp]
theorem zeroLocus_span (s : Set A) : zeroLocus π (Ideal.span s) = zeroLocus π s := by
ext x
exact (Submodule.gi _ _).gc s x.asHomogeneousIdeal.toIdeal
#align projective_spectrum.zero_locus_span ProjectiveSpectrum.zeroLocus_span
variable {π}
def vanishingIdeal (t : Set (ProjectiveSpectrum π)) : HomogeneousIdeal π :=
β¨
(x : ProjectiveSpectrum π) (_ : x β t), x.asHomogeneousIdeal
#align projective_spectrum.vanishing_ideal ProjectiveSpectrum.vanishingIdeal
theorem coe_vanishingIdeal (t : Set (ProjectiveSpectrum π)) :
(vanishingIdeal t : Set A) =
{ f | β x : ProjectiveSpectrum π, x β t β f β x.asHomogeneousIdeal } := by
ext f
rw [vanishingIdeal, SetLike.mem_coe, β HomogeneousIdeal.mem_iff, HomogeneousIdeal.toIdeal_iInf,
Submodule.mem_iInf]
refine forall_congr' fun x => ?_
rw [HomogeneousIdeal.toIdeal_iInf, Submodule.mem_iInf, HomogeneousIdeal.mem_iff]
#align projective_spectrum.coe_vanishing_ideal ProjectiveSpectrum.coe_vanishingIdeal
| Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Topology.lean | 109 | 111 | theorem mem_vanishingIdeal (t : Set (ProjectiveSpectrum π)) (f : A) :
f β vanishingIdeal t β β x : ProjectiveSpectrum π, x β t β f β x.asHomogeneousIdeal := by |
rw [β SetLike.mem_coe, coe_vanishingIdeal, Set.mem_setOf_eq]
| [
" zeroLocus π β(Ideal.span s) = zeroLocus π s",
" x β zeroLocus π β(Ideal.span s) β x β zeroLocus π s",
" β(vanishingIdeal t) = {f | β x β t, f β x.asHomogeneousIdeal}",
" f β β(vanishingIdeal t) β f β {f | β x β t, f β x.asHomogeneousIdeal}",
" (β (i : ProjectiveSpectrum π), f β (β¨
(_ : i β t), i.asHo... | [
" zeroLocus π β(Ideal.span s) = zeroLocus π s",
" x β zeroLocus π β(Ideal.span s) β x β zeroLocus π s",
" β(vanishingIdeal t) = {f | β x β t, f β x.asHomogeneousIdeal}",
" f β β(vanishingIdeal t) β f β {f | β x β t, f β x.asHomogeneousIdeal}",
" (β (i : ProjectiveSpectrum π), f β (β¨
(_ : i β t), i.asHo... |
import Mathlib.Data.Set.Lattice
#align_import data.set.accumulate from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
variable {Ξ± Ξ² Ξ³ : Type*} {s : Ξ± β Set Ξ²} {t : Ξ± β Set Ξ³}
namespace Set
def Accumulate [LE Ξ±] (s : Ξ± β Set Ξ²) (x : Ξ±) : Set Ξ² :=
β y β€ x, s y
#align set.accumulate Set.Accumulate
theorem accumulate_def [LE Ξ±] {x : Ξ±} : Accumulate s x = β y β€ x, s y :=
rfl
#align set.accumulate_def Set.accumulate_def
@[simp]
| Mathlib/Data/Set/Accumulate.lean | 31 | 32 | theorem mem_accumulate [LE Ξ±] {x : Ξ±} {z : Ξ²} : z β Accumulate s x β β y β€ x, z β s y := by |
simp_rw [accumulate_def, mem_iUnionβ, exists_prop]
| [
" z β Accumulate s x β β y β€ x, z β s y"
] | [
" z β Accumulate s x β β y β€ x, z β s y"
] |
import Mathlib.Init.Logic
import Mathlib.Init.Function
import Mathlib.Init.Algebra.Classes
import Batteries.Util.LibraryNote
import Batteries.Tactic.Lint.Basic
#align_import logic.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
#align_import init.ite_simp from "leanprover-community/lean"@"4a03bdeb31b3688c31d02d7ff8e0ff2e5d6174db"
open Function
attribute [local instance 10] Classical.propDecidable
open Function
alias Membership.mem.ne_of_not_mem := ne_of_mem_of_not_mem
alias Membership.mem.ne_of_not_mem' := ne_of_mem_of_not_mem'
#align has_mem.mem.ne_of_not_mem Membership.mem.ne_of_not_mem
#align has_mem.mem.ne_of_not_mem' Membership.mem.ne_of_not_mem'
section Quantifiers
set_option autoImplicit true in
-- @[elab_as_elim] -- FIXME
noncomputable def Exists.classicalRecOn {p : Ξ± β Prop} (h : β a, p a) {C} (H : β a, p a β C) : C :=
H (Classical.choose h) (Classical.choose_spec h)
#align exists.classical_rec_on Exists.classicalRecOn
section BoundedQuantifiers
variable {Ξ± : Sort*} {r p q : Ξ± β Prop} {P Q : β x, p x β Prop} {b : Prop}
theorem bex_def : (β (x : _) (_ : p x), q x) β β x, p x β§ q x :=
β¨fun β¨x, px, qxβ© β¦ β¨x, px, qxβ©, fun β¨x, px, qxβ© β¦ β¨x, px, qxβ©β©
#align bex_def bex_def
theorem BEx.elim {b : Prop} : (β x h, P x h) β (β a h, P a h β b) β b
| β¨a, hβ, hββ©, h' => h' a hβ hβ
#align bex.elim BEx.elim
theorem BEx.intro (a : Ξ±) (hβ : p a) (hβ : P a hβ) : β (x : _) (h : p x), P x h :=
β¨a, hβ, hββ©
#align bex.intro BEx.intro
#align ball_congr forallβ_congr
#align bex_congr existsβ_congr
@[deprecated exists_eq_left (since := "2024-04-06")]
| Mathlib/Logic/Basic.lean | 1,092 | 1,093 | theorem bex_eq_left {a : Ξ±} : (β (x : _) (_ : x = a), p x) β p a := by |
simp only [exists_prop, exists_eq_left]
| [
" (β x x_1, p x) β p a"
] | [
" (β x x_1, p x) β p a"
] |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
open CategoryTheory
namespace ModuleCat
variable {ΞΉ ΞΉ' R : Type*} [Ring R] {S : ShortComplex (ModuleCat R)}
(hS : S.Exact) (hS' : S.ShortExact) {v : ΞΉ β S.Xβ}
open CategoryTheory Submodule Set
section LinearIndependent
variable (hv : LinearIndependent R v) {u : ΞΉ β ΞΉ' β S.Xβ}
(hw : LinearIndependent R (S.g β u β Sum.inr))
(hm : Mono S.f) (huv : u β Sum.inl = S.f β v)
theorem disjoint_span_sum : Disjoint (span R (range (u β Sum.inl)))
(span R (range (u β Sum.inr))) := by
rw [huv, disjoint_comm]
refine Disjoint.mono_right (span_mono (range_comp_subset_range _ _)) ?_
rw [β LinearMap.range_coe, span_eq (LinearMap.range S.f), hS.moduleCat_range_eq_ker]
exact range_ker_disjoint hw
theorem linearIndependent_leftExact : LinearIndependent R u := by
rw [linearIndependent_sum]
refine β¨?_, LinearIndependent.of_comp S.g hw, disjoint_span_sum hS hw huvβ©
rw [huv, LinearMap.linearIndependent_iff S.f]; swap
Β· rw [LinearMap.ker_eq_bot, β mono_iff_injective]
infer_instance
exact hv
| Mathlib/Algebra/Category/ModuleCat/Free.lean | 72 | 78 | theorem linearIndependent_shortExact {w : ΞΉ' β S.Xβ} (hw : LinearIndependent R w) :
LinearIndependent R (Sum.elim (S.f β v) (S.g.toFun.invFun β w)) := by |
apply linearIndependent_leftExact hS'.exact hv _ hS'.mono_f rfl
dsimp
convert hw
ext
apply Function.rightInverse_invFun ((epi_iff_surjective _).mp hS'.epi_g)
| [
" Disjoint (span R (range (u β Sum.inl))) (span R (range (u β Sum.inr)))",
" Disjoint (span R (range (u β Sum.inr))) (span R (range (βS.f β v)))",
" Disjoint (span R (range (u β Sum.inr))) (span R (range βS.f))",
" Disjoint (span R (range (u β Sum.inr))) (LinearMap.ker S.g)",
" LinearIndependent R u",
" L... | [
" Disjoint (span R (range (u β Sum.inl))) (span R (range (u β Sum.inr)))",
" Disjoint (span R (range (u β Sum.inr))) (span R (range (βS.f β v)))",
" Disjoint (span R (range (u β Sum.inr))) (span R (range βS.f))",
" Disjoint (span R (range (u β Sum.inr))) (LinearMap.ker S.g)",
" LinearIndependent R u",
" L... |
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 : Ξ±}
| Mathlib/Algebra/Field/Basic.lean | 29 | 29 | theorem add_div (a b c : Ξ±) : (a + b) / c = a / c + b / c := by | simp_rw [div_eq_mul_inv, add_mul]
| [
" (a + b) / c = a / c + b / c"
] | [
" (a + b) / c = a / c + b / c"
] |
import Mathlib.MeasureTheory.Measure.MeasureSpace
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
#align_import measure_theory.measure.open_pos from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Topology ENNReal MeasureTheory
open Set Function Filter
namespace MeasureTheory
namespace Measure
section Basic
variable {X Y : Type*} [TopologicalSpace X] {m : MeasurableSpace X} [TopologicalSpace Y]
[T2Space Y] (ΞΌ Ξ½ : Measure X)
class IsOpenPosMeasure : Prop where
open_pos : β U : Set X, IsOpen U β U.Nonempty β ΞΌ U β 0
#align measure_theory.measure.is_open_pos_measure MeasureTheory.Measure.IsOpenPosMeasure
variable [IsOpenPosMeasure ΞΌ] {s U F : Set X} {x : X}
theorem _root_.IsOpen.measure_ne_zero (hU : IsOpen U) (hne : U.Nonempty) : ΞΌ U β 0 :=
IsOpenPosMeasure.open_pos U hU hne
#align is_open.measure_ne_zero IsOpen.measure_ne_zero
theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < ΞΌ U :=
(hU.measure_ne_zero ΞΌ hne).bot_lt
#align is_open.measure_pos IsOpen.measure_pos
instance (priority := 100) [Nonempty X] : NeZero ΞΌ :=
β¨measure_univ_pos.mp <| isOpen_univ.measure_pos ΞΌ univ_nonemptyβ©
theorem _root_.IsOpen.measure_pos_iff (hU : IsOpen U) : 0 < ΞΌ U β U.Nonempty :=
β¨fun h => nonempty_iff_ne_empty.2 fun he => h.ne' <| he.symm βΈ measure_empty, hU.measure_pos ΞΌβ©
#align is_open.measure_pos_iff IsOpen.measure_pos_iff
theorem _root_.IsOpen.measure_eq_zero_iff (hU : IsOpen U) : ΞΌ U = 0 β U = β
:= by
simpa only [not_lt, nonpos_iff_eq_zero, not_nonempty_iff_eq_empty] using
not_congr (hU.measure_pos_iff ΞΌ)
#align is_open.measure_eq_zero_iff IsOpen.measure_eq_zero_iff
theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < ΞΌ s :=
(isOpen_interior.measure_pos ΞΌ h).trans_le (measure_mono interior_subset)
#align measure_theory.measure.measure_pos_of_nonempty_interior MeasureTheory.Measure.measure_pos_of_nonempty_interior
theorem measure_pos_of_mem_nhds (h : s β π x) : 0 < ΞΌ s :=
measure_pos_of_nonempty_interior _ β¨x, mem_interior_iff_mem_nhds.2 hβ©
#align measure_theory.measure.measure_pos_of_mem_nhds MeasureTheory.Measure.measure_pos_of_mem_nhds
theorem isOpenPosMeasure_smul {c : ββ₯0β} (h : c β 0) : IsOpenPosMeasure (c β’ ΞΌ) :=
β¨fun _U Uo Une => mul_ne_zero h (Uo.measure_ne_zero ΞΌ Une)β©
#align measure_theory.measure.is_open_pos_measure_smul MeasureTheory.Measure.isOpenPosMeasure_smul
variable {ΞΌ Ξ½}
protected theorem AbsolutelyContinuous.isOpenPosMeasure (h : ΞΌ βͺ Ξ½) : IsOpenPosMeasure Ξ½ :=
β¨fun _U ho hne hβ => ho.measure_ne_zero ΞΌ hne (h hβ)β©
#align measure_theory.measure.absolutely_continuous.is_open_pos_measure MeasureTheory.Measure.AbsolutelyContinuous.isOpenPosMeasure
theorem _root_.LE.le.isOpenPosMeasure (h : ΞΌ β€ Ξ½) : IsOpenPosMeasure Ξ½ :=
h.absolutelyContinuous.isOpenPosMeasure
#align has_le.le.is_open_pos_measure LE.le.isOpenPosMeasure
theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) :
ΞΌ U = 0 β U = β
:=
β¨fun h β¦ (hU.measure_eq_zero_iff ΞΌ).mp h, fun h β¦ by simp [h]β©
theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) :
U =α΅[ΞΌ] (β
: Set X) β U = β
:= by
rw [ae_eq_empty, hU.measure_zero_iff_eq_empty]
theorem _root_.IsOpen.eq_empty_of_measure_zero (hU : IsOpen U) (hβ : ΞΌ U = 0) : U = β
:=
(hU.measure_eq_zero_iff ΞΌ).mp hβ
#align is_open.eq_empty_of_measure_zero IsOpen.eq_empty_of_measure_zero
theorem _root_.IsClosed.ae_eq_univ_iff_eq (hF : IsClosed F) :
F =α΅[ΞΌ] univ β F = univ := by
refine β¨fun h β¦ ?_, fun h β¦ by rw [h]β©
rwa [ae_eq_univ, hF.isOpen_compl.measure_eq_zero_iff ΞΌ, compl_empty_iff] at h
theorem _root_.IsClosed.measure_eq_univ_iff_eq [OpensMeasurableSpace X] [IsFiniteMeasure ΞΌ]
(hF : IsClosed F) :
ΞΌ F = ΞΌ univ β F = univ := by
rw [β ae_eq_univ_iff_measure_eq hF.measurableSet.nullMeasurableSet, hF.ae_eq_univ_iff_eq]
| Mathlib/MeasureTheory/Measure/OpenPos.lean | 107 | 110 | theorem _root_.IsClosed.measure_eq_one_iff_eq_univ [OpensMeasurableSpace X] [IsProbabilityMeasure ΞΌ]
(hF : IsClosed F) :
ΞΌ F = 1 β F = univ := by |
rw [β measure_univ (ΞΌ := ΞΌ), hF.measure_eq_univ_iff_eq]
| [
" ΞΌ U = 0 β U = β
",
" ΞΌ U = 0",
" U =αΆ [ae ΞΌ] β
β U = β
",
" F =αΆ [ae ΞΌ] univ β F = univ",
" F =αΆ [ae ΞΌ] univ",
" F = univ",
" ΞΌ F = ΞΌ univ β F = univ",
" ΞΌ F = 1 β F = univ"
] | [
" ΞΌ U = 0 β U = β
",
" ΞΌ U = 0",
" U =αΆ [ae ΞΌ] β
β U = β
",
" F =αΆ [ae ΞΌ] univ β F = univ",
" F =αΆ [ae ΞΌ] univ",
" F = univ",
" ΞΌ F = ΞΌ univ β F = univ",
" ΞΌ F = 1 β F = univ"
] |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.LinearAlgebra.Matrix.Block
#align_import analysis.inner_product_space.gram_schmidt_ortho from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0"
open Finset Submodule FiniteDimensional
variable (π : Type*) {E : Type*} [RCLike π] [NormedAddCommGroup E] [InnerProductSpace π E]
variable {ΞΉ : Type*} [LinearOrder ΞΉ] [LocallyFiniteOrderBot ΞΉ] [IsWellOrder ΞΉ (Β· < Β·)]
attribute [local instance] IsWellOrder.toHasWellFounded
local notation "βͺ" x ", " y "β«" => @inner π _ _ x y
noncomputable def gramSchmidt [IsWellOrder ΞΉ (Β· < Β·)] (f : ΞΉ β E) (n : ΞΉ) : E :=
f n - β i : Iio n, orthogonalProjection (π β gramSchmidt f i) (f n)
termination_by n
decreasing_by exact mem_Iio.1 i.2
#align gram_schmidt gramSchmidt
theorem gramSchmidt_def (f : ΞΉ β E) (n : ΞΉ) :
gramSchmidt π f n = f n - β i β Iio n, orthogonalProjection (π β gramSchmidt π f i) (f n) := by
rw [β sum_attach, attach_eq_univ, gramSchmidt]
#align gram_schmidt_def gramSchmidt_def
theorem gramSchmidt_def' (f : ΞΉ β E) (n : ΞΉ) :
f n = gramSchmidt π f n + β i β Iio n, orthogonalProjection (π β gramSchmidt π f i) (f n) := by
rw [gramSchmidt_def, sub_add_cancel]
#align gram_schmidt_def' gramSchmidt_def'
theorem gramSchmidt_def'' (f : ΞΉ β E) (n : ΞΉ) :
f n = gramSchmidt π f n + β i β Iio n,
(βͺgramSchmidt π f i, f nβ« / (βgramSchmidt π f iβ : π) ^ 2) β’ gramSchmidt π f i := by
convert gramSchmidt_def' π f n
rw [orthogonalProjection_singleton, RCLike.ofReal_pow]
#align gram_schmidt_def'' gramSchmidt_def''
@[simp]
theorem gramSchmidt_zero {ΞΉ : Type*} [LinearOrder ΞΉ] [LocallyFiniteOrder ΞΉ] [OrderBot ΞΉ]
[IsWellOrder ΞΉ (Β· < Β·)] (f : ΞΉ β E) : gramSchmidt π f β₯ = f β₯ := by
rw [gramSchmidt_def, Iio_eq_Ico, Finset.Ico_self, Finset.sum_empty, sub_zero]
#align gram_schmidt_zero gramSchmidt_zero
theorem gramSchmidt_orthogonal (f : ΞΉ β E) {a b : ΞΉ} (hβ : a β b) :
βͺgramSchmidt π f a, gramSchmidt π f bβ« = 0 := by
suffices β a b : ΞΉ, a < b β βͺgramSchmidt π f a, gramSchmidt π f bβ« = 0 by
cases' hβ.lt_or_lt with ha hb
Β· exact this _ _ ha
Β· rw [inner_eq_zero_symm]
exact this _ _ hb
clear hβ a b
intro a b hβ
revert a
apply wellFounded_lt.induction b
intro b ih a hβ
simp only [gramSchmidt_def π f b, inner_sub_right, inner_sum, orthogonalProjection_singleton,
inner_smul_right]
rw [Finset.sum_eq_single_of_mem a (Finset.mem_Iio.mpr hβ)]
Β· by_cases h : gramSchmidt π f a = 0
Β· simp only [h, inner_zero_left, zero_div, zero_mul, sub_zero]
Β· rw [RCLike.ofReal_pow, β inner_self_eq_norm_sq_to_K, div_mul_cancelβ, sub_self]
rwa [inner_self_ne_zero]
intro i hi hia
simp only [mul_eq_zero, div_eq_zero_iff, inner_self_eq_zero]
right
cases' hia.lt_or_lt with hiaβ hiaβ
Β· rw [inner_eq_zero_symm]
exact ih a hβ i hiaβ
Β· exact ih i (mem_Iio.1 hi) a hiaβ
#align gram_schmidt_orthogonal gramSchmidt_orthogonal
theorem gramSchmidt_pairwise_orthogonal (f : ΞΉ β E) :
Pairwise fun a b => βͺgramSchmidt π f a, gramSchmidt π f bβ« = 0 := fun _ _ =>
gramSchmidt_orthogonal π f
#align gram_schmidt_pairwise_orthogonal gramSchmidt_pairwise_orthogonal
theorem gramSchmidt_inv_triangular (v : ΞΉ β E) {i j : ΞΉ} (hij : i < j) :
βͺgramSchmidt π v j, v iβ« = 0 := by
rw [gramSchmidt_def'' π v]
simp only [inner_add_right, inner_sum, inner_smul_right]
set b : ΞΉ β E := gramSchmidt π v
convert zero_add (0 : π)
Β· exact gramSchmidt_orthogonal π v hij.ne'
apply Finset.sum_eq_zero
rintro k hki'
have hki : k < i := by simpa using hki'
have : βͺb j, b kβ« = 0 := gramSchmidt_orthogonal π v (hki.trans hij).ne'
simp [this]
#align gram_schmidt_inv_triangular gramSchmidt_inv_triangular
open Submodule Set Order
theorem mem_span_gramSchmidt (f : ΞΉ β E) {i j : ΞΉ} (hij : i β€ j) :
f i β span π (gramSchmidt π f '' Set.Iic j) := by
rw [gramSchmidt_def' π f i]
simp_rw [orthogonalProjection_singleton]
exact Submodule.add_mem _ (subset_span <| mem_image_of_mem _ hij)
(Submodule.sum_mem _ fun k hk => smul_mem (span π (gramSchmidt π f '' Set.Iic j)) _ <|
subset_span <| mem_image_of_mem (gramSchmidt π f) <| (Finset.mem_Iio.1 hk).le.trans hij)
#align mem_span_gram_schmidt mem_span_gramSchmidt
| Mathlib/Analysis/InnerProductSpace/GramSchmidtOrtho.lean | 142 | 152 | theorem gramSchmidt_mem_span (f : ΞΉ β E) :
β {j i}, i β€ j β gramSchmidt π f i β span π (f '' Set.Iic j) := by |
intro j i hij
rw [gramSchmidt_def π f i]
simp_rw [orthogonalProjection_singleton]
refine Submodule.sub_mem _ (subset_span (mem_image_of_mem _ hij))
(Submodule.sum_mem _ fun k hk => ?_)
let hkj : k < j := (Finset.mem_Iio.1 hk).trans_le hij
exact smul_mem _ _
(span_mono (image_subset f <| Iic_subset_Iic.2 hkj.le) <| gramSchmidt_mem_span _ le_rfl)
termination_by j => j
| [
" (invImage (fun x => x) IsWellOrder.toHasWellFounded).1 (βi) n",
" gramSchmidt π f n = f n - β i β Iio n, β((orthogonalProjection (span π {gramSchmidt π f i})) (f n))",
" f n = gramSchmidt π f n + β i β Iio n, β((orthogonalProjection (span π {gramSchmidt π f i})) (f n))",
" f n = gramSchmidt π f n + β... | [
" (invImage (fun x => x) IsWellOrder.toHasWellFounded).1 (βi) n",
" gramSchmidt π f n = f n - β i β Iio n, β((orthogonalProjection (span π {gramSchmidt π f i})) (f n))",
" f n = gramSchmidt π f n + β i β Iio n, β((orthogonalProjection (span π {gramSchmidt π f i})) (f n))",
" f n = gramSchmidt π f n + β... |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Finsupp.Defs
import Mathlib.Data.Finset.Pairwise
#align_import data.finsupp.big_operators from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
variable {ΞΉ M : Type*} [DecidableEq ΞΉ]
theorem List.support_sum_subset [AddMonoid M] (l : List (ΞΉ ββ M)) :
l.sum.support β l.foldr (Finsupp.support Β· β Β·) β
:= by
induction' l with hd tl IH
Β· simp
Β· simp only [List.sum_cons, Finset.union_comm]
refine Finsupp.support_add.trans (Finset.union_subset_union ?_ IH)
rfl
#align list.support_sum_subset List.support_sum_subset
theorem Multiset.support_sum_subset [AddCommMonoid M] (s : Multiset (ΞΉ ββ M)) :
s.sum.support β (s.map Finsupp.support).sup := by
induction s using Quot.inductionOn
simpa only [Multiset.quot_mk_to_coe'', Multiset.sum_coe, Multiset.map_coe, Multiset.sup_coe,
List.foldr_map] using List.support_sum_subset _
#align multiset.support_sum_subset Multiset.support_sum_subset
theorem Finset.support_sum_subset [AddCommMonoid M] (s : Finset (ΞΉ ββ M)) :
(s.sum id).support β Finset.sup s Finsupp.support := by
classical convert Multiset.support_sum_subset s.1; simp
#align finset.support_sum_subset Finset.support_sum_subset
theorem List.mem_foldr_sup_support_iff [Zero M] {l : List (ΞΉ ββ M)} {x : ΞΉ} :
x β l.foldr (Finsupp.support Β· β Β·) β
β β f β l, x β f.support := by
simp only [Finset.sup_eq_union, List.foldr_map, Finsupp.mem_support_iff, exists_prop]
induction' l with hd tl IH
Β· simp
Β· simp only [foldr, Function.comp_apply, Finset.mem_union, Finsupp.mem_support_iff, ne_eq, IH,
find?, mem_cons, exists_eq_or_imp]
#align list.mem_foldr_sup_support_iff List.mem_foldr_sup_support_iff
theorem Multiset.mem_sup_map_support_iff [Zero M] {s : Multiset (ΞΉ ββ M)} {x : ΞΉ} :
x β (s.map Finsupp.support).sup β β f β s, x β f.support :=
Quot.inductionOn s fun _ β¦ by
simpa only [Multiset.quot_mk_to_coe'', Multiset.map_coe, Multiset.sup_coe, List.foldr_map]
using List.mem_foldr_sup_support_iff
#align multiset.mem_sup_map_support_iff Multiset.mem_sup_map_support_iff
theorem Finset.mem_sup_support_iff [Zero M] {s : Finset (ΞΉ ββ M)} {x : ΞΉ} :
x β s.sup Finsupp.support β β f β s, x β f.support :=
Multiset.mem_sup_map_support_iff
#align finset.mem_sup_support_iff Finset.mem_sup_support_iff
theorem List.support_sum_eq [AddMonoid M] (l : List (ΞΉ ββ M))
(hl : l.Pairwise (_root_.Disjoint on Finsupp.support)) :
l.sum.support = l.foldr (Finsupp.support Β· β Β·) β
:= by
induction' l with hd tl IH
Β· simp
Β· simp only [List.pairwise_cons] at hl
simp only [List.sum_cons, List.foldr_cons, Function.comp_apply]
rw [Finsupp.support_add_eq, IH hl.right, Finset.sup_eq_union]
suffices _root_.Disjoint hd.support (tl.foldr (fun x y β¦ (Finsupp.support x β y)) β
) by
exact Finset.disjoint_of_subset_right (List.support_sum_subset _) this
rw [β List.foldr_map, β Finset.bot_eq_empty, List.foldr_sup_eq_sup_toFinset,
Finset.disjoint_sup_right]
intro f hf
simp only [List.mem_toFinset, List.mem_map] at hf
obtain β¨f, hf, rflβ© := hf
exact hl.left _ hf
#align list.support_sum_eq List.support_sum_eq
theorem Multiset.support_sum_eq [AddCommMonoid M] (s : Multiset (ΞΉ ββ M))
(hs : s.Pairwise (_root_.Disjoint on Finsupp.support)) :
s.sum.support = (s.map Finsupp.support).sup := by
induction' s using Quot.inductionOn with a
obtain β¨l, hl, hdβ© := hs
suffices a.Pairwise (_root_.Disjoint on Finsupp.support) by
convert List.support_sum_eq a this
Β· simp only [Multiset.quot_mk_to_coe'', Multiset.sum_coe]
Β· dsimp only [Function.comp_def]
simp only [quot_mk_to_coe'', map_coe, sup_coe, ge_iff_le, Finset.le_eq_subset,
Finset.sup_eq_union, Finset.bot_eq_empty, List.foldr_map]
simp only [Multiset.quot_mk_to_coe'', Multiset.map_coe, Multiset.coe_eq_coe] at hl
exact hl.symm.pairwise hd fun h β¦ _root_.Disjoint.symm h
#align multiset.support_sum_eq Multiset.support_sum_eq
| Mathlib/Data/Finsupp/BigOperators.lean | 114 | 128 | theorem Finset.support_sum_eq [AddCommMonoid M] (s : Finset (ΞΉ ββ M))
(hs : (s : Set (ΞΉ ββ M)).PairwiseDisjoint Finsupp.support) :
(s.sum id).support = Finset.sup s Finsupp.support := by |
classical
suffices s.1.Pairwise (_root_.Disjoint on Finsupp.support) by
convert Multiset.support_sum_eq s.1 this
exact (Finset.sum_val _).symm
obtain β¨l, hl, hnβ© : β l : List (ΞΉ ββ M), l.toFinset = s β§ l.Nodup := by
refine β¨s.toList, ?_, Finset.nodup_toList _β©
simp
subst hl
rwa [List.toFinset_val, List.dedup_eq_self.mpr hn, Multiset.pairwise_coe_iff_pairwise, β
List.pairwiseDisjoint_iff_coe_toFinset_pairwise_disjoint hn]
intro x y hxy
exact symmetric_disjoint hxy
| [
" l.sum.support β foldr (fun x x_1 => x.support β x_1) β
l",
" [].sum.support β foldr (fun x x_1 => x.support β x_1) β
[]",
" (hd :: tl).sum.support β foldr (fun x x_1 => x.support β x_1) β
(hd :: tl)",
" (hd + tl.sum).support β foldr (fun x x_1 => x.support β x_1) β
(hd :: tl)",
" hd.support β hd.support",... | [
" l.sum.support β foldr (fun x x_1 => x.support β x_1) β
l",
" [].sum.support β foldr (fun x x_1 => x.support β x_1) β
[]",
" (hd :: tl).sum.support β foldr (fun x x_1 => x.support β x_1) β
(hd :: tl)",
" (hd + tl.sum).support β foldr (fun x x_1 => x.support β x_1) β
(hd :: tl)",
" hd.support β hd.support",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.