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 |
|---|---|---|---|---|---|
import Mathlib.MeasureTheory.Integral.IntegrableOn
#align_import measure_theory.function.locally_integrable from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b"
open MeasureTheory MeasureTheory.Measure Set Function TopologicalSpace Bornology
open scoped Topology Interval ENNReal
variable {X Y E F R : Type*} [MeasurableSpace X] [TopologicalSpace X]
variable [MeasurableSpace Y] [TopologicalSpace Y]
variable [NormedAddCommGroup E] [NormedAddCommGroup F] {f g : X → E} {μ : Measure X} {s : Set X}
namespace MeasureTheory
open MeasureTheory
open scoped ENNReal
namespace MeasureTheory
variable [OpensMeasurableSpace X] {A K : Set X}
section Mul
variable [NormedRing R] [SecondCountableTopologyEither X R] {g g' : X → R}
| Mathlib/MeasureTheory/Function/LocallyIntegrable.lean | 597 | 609 | theorem IntegrableOn.mul_continuousOn_of_subset (hg : IntegrableOn g A μ) (hg' : ContinuousOn g' K)
(hA : MeasurableSet A) (hK : IsCompact K) (hAK : A ⊆ K) :
IntegrableOn (fun x => g x * g' x) A μ := by |
rcases IsCompact.exists_bound_of_continuousOn hK hg' with ⟨C, hC⟩
rw [IntegrableOn, ← memℒp_one_iff_integrable] at hg ⊢
have : ∀ᵐ x ∂μ.restrict A, ‖g x * g' x‖ ≤ C * ‖g x‖ := by
filter_upwards [ae_restrict_mem hA] with x hx
refine (norm_mul_le _ _).trans ?_
rw [mul_comm]
gcongr
exact hC x (hAK hx)
exact
Memℒp.of_le_mul hg (hg.aestronglyMeasurable.mul <| (hg'.mono hAK).aestronglyMeasurable hA) this
|
import Mathlib.Topology.MetricSpace.Isometry
#align_import topology.metric_space.gluing from "leanprover-community/mathlib"@"e1a7bdeb4fd826b7e71d130d34988f0a2d26a177"
noncomputable section
universe u v w
open Function Set Uniformity Topology
namespace Metric
--section
section InductiveLimit
open Nat
variable {X : ℕ → Type u} [∀ n, MetricSpace (X n)] {f : ∀ n, X n → X (n + 1)}
def inductiveLimitDist (f : ∀ n, X n → X (n + 1)) (x y : Σn, X n) : ℝ :=
dist (leRecOn (le_max_left x.1 y.1) (f _) x.2 : X (max x.1 y.1))
(leRecOn (le_max_right x.1 y.1) (f _) y.2 : X (max x.1 y.1))
#align metric.inductive_limit_dist Metric.inductiveLimitDist
| Mathlib/Topology/MetricSpace/Gluing.lean | 570 | 588 | theorem inductiveLimitDist_eq_dist (I : ∀ n, Isometry (f n)) (x y : Σn, X n) :
∀ m (hx : x.1 ≤ m) (hy : y.1 ≤ m), inductiveLimitDist f x y =
dist (leRecOn hx (f _) x.2 : X m) (leRecOn hy (f _) y.2 : X m)
| 0, hx, hy => by
cases' x with i x; cases' y with j y
obtain rfl : i = 0 := nonpos_iff_eq_zero.1 hx
obtain rfl : j = 0 := nonpos_iff_eq_zero.1 hy
rfl
| (m + 1), hx, hy => by
by_cases h : max x.1 y.1 = (m + 1)
· generalize m + 1 = m' at *
subst m'
rfl
· have : max x.1 y.1 ≤ succ m := by | simp [hx, hy]
have : max x.1 y.1 ≤ m := by simpa [h] using of_le_succ this
have xm : x.1 ≤ m := le_trans (le_max_left _ _) this
have ym : y.1 ≤ m := le_trans (le_max_right _ _) this
rw [leRecOn_succ xm, leRecOn_succ ym, (I m).dist_eq]
exact inductiveLimitDist_eq_dist I x y m xm ym
|
import Mathlib.Data.Bool.Set
import Mathlib.Data.Nat.Set
import Mathlib.Data.Set.Prod
import Mathlib.Data.ULift
import Mathlib.Order.Bounds.Basic
import Mathlib.Order.Hom.Set
import Mathlib.Order.SetNotation
#align_import order.complete_lattice from "leanprover-community/mathlib"@"5709b0d8725255e76f47debca6400c07b5c2d8e6"
open Function OrderDual Set
variable {α β β₂ γ : Type*} {ι ι' : Sort*} {κ : ι → Sort*} {κ' : ι' → Sort*}
instance OrderDual.supSet (α) [InfSet α] : SupSet αᵒᵈ :=
⟨(sInf : Set α → α)⟩
instance OrderDual.infSet (α) [SupSet α] : InfSet αᵒᵈ :=
⟨(sSup : Set α → α)⟩
class CompleteSemilatticeSup (α : Type*) extends PartialOrder α, SupSet α where
le_sSup : ∀ s, ∀ a ∈ s, a ≤ sSup s
sSup_le : ∀ s a, (∀ b ∈ s, b ≤ a) → sSup s ≤ a
#align complete_semilattice_Sup CompleteSemilatticeSup
section
variable [CompleteSemilatticeSup α] {s t : Set α} {a b : α}
theorem le_sSup : a ∈ s → a ≤ sSup s :=
CompleteSemilatticeSup.le_sSup s a
#align le_Sup le_sSup
theorem sSup_le : (∀ b ∈ s, b ≤ a) → sSup s ≤ a :=
CompleteSemilatticeSup.sSup_le s a
#align Sup_le sSup_le
theorem isLUB_sSup (s : Set α) : IsLUB s (sSup s) :=
⟨fun _ ↦ le_sSup, fun _ ↦ sSup_le⟩
#align is_lub_Sup isLUB_sSup
lemma isLUB_iff_sSup_eq : IsLUB s a ↔ sSup s = a :=
⟨(isLUB_sSup s).unique, by rintro rfl; exact isLUB_sSup _⟩
alias ⟨IsLUB.sSup_eq, _⟩ := isLUB_iff_sSup_eq
#align is_lub.Sup_eq IsLUB.sSup_eq
theorem le_sSup_of_le (hb : b ∈ s) (h : a ≤ b) : a ≤ sSup s :=
le_trans h (le_sSup hb)
#align le_Sup_of_le le_sSup_of_le
@[gcongr]
theorem sSup_le_sSup (h : s ⊆ t) : sSup s ≤ sSup t :=
(isLUB_sSup s).mono (isLUB_sSup t) h
#align Sup_le_Sup sSup_le_sSup
@[simp]
theorem sSup_le_iff : sSup s ≤ a ↔ ∀ b ∈ s, b ≤ a :=
isLUB_le_iff (isLUB_sSup s)
#align Sup_le_iff sSup_le_iff
theorem le_sSup_iff : a ≤ sSup s ↔ ∀ b ∈ upperBounds s, a ≤ b :=
⟨fun h _ hb => le_trans h (sSup_le hb), fun hb => hb _ fun _ => le_sSup⟩
#align le_Sup_iff le_sSup_iff
| Mathlib/Order/CompleteLattice.lean | 110 | 111 | theorem le_iSup_iff {s : ι → α} : a ≤ iSup s ↔ ∀ b, (∀ i, s i ≤ b) → a ≤ b := by |
simp [iSup, le_sSup_iff, upperBounds]
|
import Mathlib.Algebra.GCDMonoid.Finset
import Mathlib.Algebra.Polynomial.CancelLeads
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.FieldDivision
#align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3"
namespace Polynomial
open Polynomial
section Primitive
variable {R : Type*} [CommSemiring R]
def IsPrimitive (p : R[X]) : Prop :=
∀ r : R, C r ∣ p → IsUnit r
#align polynomial.is_primitive Polynomial.IsPrimitive
theorem isPrimitive_iff_isUnit_of_C_dvd {p : R[X]} : p.IsPrimitive ↔ ∀ r : R, C r ∣ p → IsUnit r :=
Iff.rfl
set_option linter.uppercaseLean3 false in
#align polynomial.is_primitive_iff_is_unit_of_C_dvd Polynomial.isPrimitive_iff_isUnit_of_C_dvd
@[simp]
theorem isPrimitive_one : IsPrimitive (1 : R[X]) := fun _ h =>
isUnit_C.mp (isUnit_of_dvd_one h)
#align polynomial.is_primitive_one Polynomial.isPrimitive_one
| Mathlib/RingTheory/Polynomial/Content.lean | 56 | 58 | theorem Monic.isPrimitive {p : R[X]} (hp : p.Monic) : p.IsPrimitive := by |
rintro r ⟨q, h⟩
exact isUnit_of_mul_eq_one r (q.coeff p.natDegree) (by rwa [← coeff_C_mul, ← h])
|
import Mathlib.Init.Data.Ordering.Basic
import Mathlib.Order.Synonym
#align_import order.compare from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
variable {α β : Type*}
def cmpLE {α} [LE α] [@DecidableRel α (· ≤ ·)] (x y : α) : Ordering :=
if x ≤ y then if y ≤ x then Ordering.eq else Ordering.lt else Ordering.gt
#align cmp_le cmpLE
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
(cmpLE x y).swap = cmpLE y x := by
by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, *, Ordering.swap]
cases not_or_of_not xy yx (total_of _ _ _)
#align cmp_le_swap cmpLE_swap
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
[@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing]
cases not_or_of_not xy yx (total_of _ _ _)
#align cmp_le_eq_cmp cmpLE_eq_cmp
namespace Ordering
-- Porting note: we have removed `@[simp]` here in favour of separate simp lemmas,
-- otherwise this definition will unfold to a match.
def Compares [LT α] : Ordering → α → α → Prop
| lt, a, b => a < b
| eq, a, b => a = b
| gt, a, b => a > b
#align ordering.compares Ordering.Compares
@[simp]
lemma compares_lt [LT α] (a b : α) : Compares lt a b = (a < b) := rfl
@[simp]
lemma compares_eq [LT α] (a b : α) : Compares eq a b = (a = b) := rfl
@[simp]
lemma compares_gt [LT α] (a b : α) : Compares gt a b = (a > b) := rfl
theorem compares_swap [LT α] {a b : α} {o : Ordering} : o.swap.Compares a b ↔ o.Compares b a := by
cases o
· exact Iff.rfl
· exact eq_comm
· exact Iff.rfl
#align ordering.compares_swap Ordering.compares_swap
alias ⟨Compares.of_swap, Compares.swap⟩ := compares_swap
#align ordering.compares.of_swap Ordering.Compares.of_swap
#align ordering.compares.swap Ordering.Compares.swap
| Mathlib/Order/Compare.lean | 78 | 79 | theorem swap_eq_iff_eq_swap {o o' : Ordering} : o.swap = o' ↔ o = o'.swap := by |
rw [← swap_inj, swap_swap]
|
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Transvection
import Mathlib.MeasureTheory.Group.LIntegral
import Mathlib.MeasureTheory.Integral.Marginal
import Mathlib.MeasureTheory.Measure.Stieltjes
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
#align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
assert_not_exists MeasureTheory.integral
noncomputable section
open scoped Classical
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ENNReal (ofReal)
open scoped ENNReal NNReal Topology
section regionBetween
variable {α : Type*}
def regionBetween (f g : α → ℝ) (s : Set α) : Set (α × ℝ) :=
{ p : α × ℝ | p.1 ∈ s ∧ p.2 ∈ Ioo (f p.1) (g p.1) }
#align region_between regionBetween
theorem regionBetween_subset (f g : α → ℝ) (s : Set α) : regionBetween f g s ⊆ s ×ˢ univ := by
simpa only [prod_univ, regionBetween, Set.preimage, setOf_subset_setOf] using fun a => And.left
#align region_between_subset regionBetween_subset
variable [MeasurableSpace α] {μ : Measure α} {f g : α → ℝ} {s : Set α}
theorem measurableSet_regionBetween (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) :
MeasurableSet (regionBetween f g s) := by
dsimp only [regionBetween, Ioo, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_lt measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
#align measurable_set_region_between measurableSet_regionBetween
theorem measurableSet_region_between_oc (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst) } := by
dsimp only [regionBetween, Ioc, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_le measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
#align measurable_set_region_between_oc measurableSet_region_between_oc
| Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean | 481 | 489 | theorem measurableSet_region_between_co (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst) } := by |
dsimp only [regionBetween, Ico, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_le (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_lt measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
|
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.disjoint from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u v w
variable {ι : Sort u} {α : Type v} {β : Type w}
open Set
open OrderDual (toDual)
namespace Set
section LinearOrder
variable [LinearOrder α] {a₁ a₂ b₁ b₂ : α}
@[simp]
theorem Ico_disjoint_Ico : Disjoint (Ico a₁ a₂) (Ico b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
simp_rw [Set.disjoint_iff_inter_eq_empty, Ico_inter_Ico, Ico_eq_empty_iff, inf_eq_min, sup_eq_max,
not_lt]
#align set.Ico_disjoint_Ico Set.Ico_disjoint_Ico
@[simp]
theorem Ioc_disjoint_Ioc : Disjoint (Ioc a₁ a₂) (Ioc b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
have h : _ ↔ min (toDual a₁) (toDual b₁) ≤ max (toDual a₂) (toDual b₂) := Ico_disjoint_Ico
simpa only [dual_Ico] using h
#align set.Ioc_disjoint_Ioc Set.Ioc_disjoint_Ioc
@[simp]
theorem Ioo_disjoint_Ioo [DenselyOrdered α] :
Disjoint (Set.Ioo a₁ a₂) (Set.Ioo b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
simp_rw [Set.disjoint_iff_inter_eq_empty, Ioo_inter_Ioo, Ioo_eq_empty_iff, inf_eq_min, sup_eq_max,
not_lt]
theorem eq_of_Ico_disjoint {x₁ x₂ y₁ y₂ : α} (h : Disjoint (Ico x₁ x₂) (Ico y₁ y₂)) (hx : x₁ < x₂)
(h2 : x₂ ∈ Ico y₁ y₂) : y₁ = x₂ := by
rw [Ico_disjoint_Ico, min_eq_left (le_of_lt h2.2), le_max_iff] at h
apply le_antisymm h2.1
exact h.elim (fun h => absurd hx (not_lt_of_le h)) id
#align set.eq_of_Ico_disjoint Set.eq_of_Ico_disjoint
@[simp]
theorem iUnion_Ico_eq_Iio_self_iff {f : ι → α} {a : α} :
⋃ i, Ico (f i) a = Iio a ↔ ∀ x < a, ∃ i, f i ≤ x := by
simp [← Ici_inter_Iio, ← iUnion_inter, subset_def]
#align set.Union_Ico_eq_Iio_self_iff Set.iUnion_Ico_eq_Iio_self_iff
@[simp]
theorem iUnion_Ioc_eq_Ioi_self_iff {f : ι → α} {a : α} :
⋃ i, Ioc a (f i) = Ioi a ↔ ∀ x, a < x → ∃ i, x ≤ f i := by
simp [← Ioi_inter_Iic, ← inter_iUnion, subset_def]
#align set.Union_Ioc_eq_Ioi_self_iff Set.iUnion_Ioc_eq_Ioi_self_iff
@[simp]
| Mathlib/Order/Interval/Set/Disjoint.lean | 182 | 184 | theorem biUnion_Ico_eq_Iio_self_iff {p : ι → Prop} {f : ∀ i, p i → α} {a : α} :
⋃ (i) (hi : p i), Ico (f i hi) a = Iio a ↔ ∀ x < a, ∃ i hi, f i hi ≤ x := by |
simp [← Ici_inter_Iio, ← iUnion_inter, subset_def]
|
import Mathlib.MeasureTheory.Measure.Typeclasses
open scoped ENNReal
namespace MeasureTheory
variable {α : Type*}
noncomputable
def Measure.trim {m m0 : MeasurableSpace α} (μ : @Measure α m0) (hm : m ≤ m0) : @Measure α m :=
@OuterMeasure.toMeasure α m μ.toOuterMeasure (hm.trans (le_toOuterMeasure_caratheodory μ))
#align measure_theory.measure.trim MeasureTheory.Measure.trim
@[simp]
theorem trim_eq_self [MeasurableSpace α] {μ : Measure α} : μ.trim le_rfl = μ := by
simp [Measure.trim]
#align measure_theory.trim_eq_self MeasureTheory.trim_eq_self
variable {m m0 : MeasurableSpace α} {μ : Measure α} {s : Set α}
theorem toOuterMeasure_trim_eq_trim_toOuterMeasure (μ : Measure α) (hm : m ≤ m0) :
@Measure.toOuterMeasure _ m (μ.trim hm) = @OuterMeasure.trim _ m μ.toOuterMeasure := by
rw [Measure.trim, toMeasure_toOuterMeasure (ms := m)]
#align measure_theory.to_outer_measure_trim_eq_trim_to_outer_measure MeasureTheory.toOuterMeasure_trim_eq_trim_toOuterMeasure
@[simp]
theorem zero_trim (hm : m ≤ m0) : (0 : Measure α).trim hm = (0 : @Measure α m) := by
simp [Measure.trim, @OuterMeasure.toMeasure_zero _ m]
#align measure_theory.zero_trim MeasureTheory.zero_trim
| Mathlib/MeasureTheory/Measure/Trim.lean | 53 | 54 | theorem trim_measurableSet_eq (hm : m ≤ m0) (hs : @MeasurableSet α m s) : μ.trim hm s = μ s := by |
rw [Measure.trim, toMeasure_apply (ms := m) _ _ hs, Measure.coe_toOuterMeasure]
|
import Mathlib.Analysis.Seminorm
import Mathlib.Topology.Algebra.Equicontinuity
import Mathlib.Topology.MetricSpace.Equicontinuity
import Mathlib.Topology.Algebra.FilterBasis
import Mathlib.Topology.Algebra.Module.LocallyConvex
#align_import analysis.locally_convex.with_seminorms from "leanprover-community/mathlib"@"b31173ee05c911d61ad6a05bd2196835c932e0ec"
open NormedField Set Seminorm TopologicalSpace Filter List
open NNReal Pointwise Topology Uniformity
variable {𝕜 𝕜₂ 𝕝 𝕝₂ E F G ι ι' : Type*}
section FilterBasis
variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
variable (𝕜 E ι)
abbrev SeminormFamily :=
ι → Seminorm 𝕜 E
#align seminorm_family SeminormFamily
variable {𝕜 E ι}
section Bounded
namespace Seminorm
variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
variable [NormedField 𝕜₂] [AddCommGroup F] [Module 𝕜₂ F]
variable {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂]
-- Todo: This should be phrased entirely in terms of the von Neumann bornology.
def IsBounded (p : ι → Seminorm 𝕜 E) (q : ι' → Seminorm 𝕜₂ F) (f : E →ₛₗ[σ₁₂] F) : Prop :=
∀ i, ∃ s : Finset ι, ∃ C : ℝ≥0, (q i).comp f ≤ C • s.sup p
#align seminorm.is_bounded Seminorm.IsBounded
| Mathlib/Analysis/LocallyConvex/WithSeminorms.lean | 226 | 229 | theorem isBounded_const (ι' : Type*) [Nonempty ι'] {p : ι → Seminorm 𝕜 E} {q : Seminorm 𝕜₂ F}
(f : E →ₛₗ[σ₁₂] F) :
IsBounded p (fun _ : ι' => q) f ↔ ∃ (s : Finset ι) (C : ℝ≥0), q.comp f ≤ C • s.sup p := by |
simp only [IsBounded, forall_const]
|
import Mathlib.RingTheory.RootsOfUnity.Basic
import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed
import Mathlib.Algebra.GCDMonoid.IntegrallyClosed
import Mathlib.FieldTheory.Finite.Basic
#align_import ring_theory.roots_of_unity.minpoly from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
open minpoly Polynomial
open scoped Polynomial
namespace IsPrimitiveRoot
section CommRing
variable {n : ℕ} {K : Type*} [CommRing K] {μ : K} (h : IsPrimitiveRoot μ n)
-- Porting note: `hpos` was in the `variable` line, with an `omit` in mathlib3 just after this
-- declaration. For some reason, in Lean4, `hpos` gets included also in the declarations below,
-- even if it is not used in the proof.
theorem isIntegral (hpos : 0 < n) : IsIntegral ℤ μ := by
use X ^ n - 1
constructor
· exact monic_X_pow_sub_C 1 (ne_of_lt hpos).symm
· simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, eval₂_one, eval₂_X_pow, eval₂_sub,
sub_self]
#align is_primitive_root.is_integral IsPrimitiveRoot.isIntegral
section IsDomain
variable [IsDomain K] [CharZero K]
theorem minpoly_dvd_x_pow_sub_one : minpoly ℤ μ ∣ X ^ n - 1 := by
rcases n.eq_zero_or_pos with (rfl | h0)
· simp
apply minpoly.isIntegrallyClosed_dvd (isIntegral h h0)
simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, aeval_X_pow, eq_intCast, Int.cast_one,
aeval_one, AlgHom.map_sub, sub_self]
set_option linter.uppercaseLean3 false in
#align is_primitive_root.minpoly_dvd_X_pow_sub_one IsPrimitiveRoot.minpoly_dvd_x_pow_sub_one
theorem separable_minpoly_mod {p : ℕ} [Fact p.Prime] (hdiv : ¬p ∣ n) :
Separable (map (Int.castRingHom (ZMod p)) (minpoly ℤ μ)) := by
have hdvd : map (Int.castRingHom (ZMod p)) (minpoly ℤ μ) ∣ X ^ n - 1 := by
convert RingHom.map_dvd (mapRingHom (Int.castRingHom (ZMod p)))
(minpoly_dvd_x_pow_sub_one h)
simp only [map_sub, map_pow, coe_mapRingHom, map_X, map_one]
refine Separable.of_dvd (separable_X_pow_sub_C 1 ?_ one_ne_zero) hdvd
by_contra hzero
exact hdiv ((ZMod.natCast_zmod_eq_zero_iff_dvd n p).1 hzero)
#align is_primitive_root.separable_minpoly_mod IsPrimitiveRoot.separable_minpoly_mod
theorem squarefree_minpoly_mod {p : ℕ} [Fact p.Prime] (hdiv : ¬p ∣ n) :
Squarefree (map (Int.castRingHom (ZMod p)) (minpoly ℤ μ)) :=
(separable_minpoly_mod h hdiv).squarefree
#align is_primitive_root.squarefree_minpoly_mod IsPrimitiveRoot.squarefree_minpoly_mod
| Mathlib/RingTheory/RootsOfUnity/Minpoly.lean | 82 | 90 | theorem minpoly_dvd_expand {p : ℕ} (hdiv : ¬p ∣ n) :
minpoly ℤ μ ∣ expand ℤ p (minpoly ℤ (μ ^ p)) := by |
rcases n.eq_zero_or_pos with (rfl | hpos)
· simp_all
letI : IsIntegrallyClosed ℤ := GCDMonoid.toIsIntegrallyClosed
refine minpoly.isIntegrallyClosed_dvd (h.isIntegral hpos) ?_
rw [aeval_def, coe_expand, ← comp, eval₂_eq_eval_map, map_comp, Polynomial.map_pow, map_X,
eval_comp, eval_pow, eval_X, ← eval₂_eq_eval_map, ← aeval_def]
exact minpoly.aeval _ _
|
import Mathlib.CategoryTheory.Functor.Flat
import Mathlib.CategoryTheory.Sites.Sheaf
import Mathlib.Tactic.ApplyFun
#align_import category_theory.sites.cover_preserving from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
universe w v₁ v₂ v₃ u₁ u₂ u₃
noncomputable section
open CategoryTheory Opposite CategoryTheory.Presieve.FamilyOfElements CategoryTheory.Presieve
CategoryTheory.Limits
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D)
variable {A : Type u₃} [Category.{v₃} A]
variable (J : GrothendieckTopology C) (K : GrothendieckTopology D)
variable {L : GrothendieckTopology A}
-- Porting note(#5171): removed `@[nolint has_nonempty_instance]`
structure CoverPreserving (G : C ⥤ D) : Prop where
cover_preserve : ∀ {U : C} {S : Sieve U} (_ : S ∈ J U), S.functorPushforward G ∈ K (G.obj U)
#align category_theory.cover_preserving CategoryTheory.CoverPreserving
theorem idCoverPreserving : CoverPreserving J J (𝟭 _) :=
⟨fun hS => by simpa using hS⟩
#align category_theory.id_cover_preserving CategoryTheory.idCoverPreserving
theorem CoverPreserving.comp {F} (hF : CoverPreserving J K F) {G} (hG : CoverPreserving K L G) :
CoverPreserving J L (F ⋙ G) :=
⟨fun hS => by
rw [Sieve.functorPushforward_comp]
exact hG.cover_preserve (hF.cover_preserve hS)⟩
#align category_theory.cover_preserving.comp CategoryTheory.CoverPreserving.comp
-- Porting note(#5171): linter not ported yet @[nolint has_nonempty_instance]
structure CompatiblePreserving (K : GrothendieckTopology D) (G : C ⥤ D) : Prop where
compatible :
∀ (ℱ : SheafOfTypes.{w} K) {Z} {T : Presieve Z} {x : FamilyOfElements (G.op ⋙ ℱ.val) T}
(_ : x.Compatible) {Y₁ Y₂} {X} (f₁ : X ⟶ G.obj Y₁) (f₂ : X ⟶ G.obj Y₂) {g₁ : Y₁ ⟶ Z}
{g₂ : Y₂ ⟶ Z} (hg₁ : T g₁) (hg₂ : T g₂) (_ : f₁ ≫ G.map g₁ = f₂ ≫ G.map g₂),
ℱ.val.map f₁.op (x g₁ hg₁) = ℱ.val.map f₂.op (x g₂ hg₂)
#align category_theory.compatible_preserving CategoryTheory.CompatiblePreserving
variable {J K} {G : C ⥤ D} (hG : CompatiblePreserving.{w} K G) (ℱ : SheafOfTypes.{w} K) {Z : C}
variable {T : Presieve Z} {x : FamilyOfElements (G.op ⋙ ℱ.val) T} (h : x.Compatible)
theorem Presieve.FamilyOfElements.Compatible.functorPushforward :
(x.functorPushforward G).Compatible := by
rintro Z₁ Z₂ W g₁ g₂ f₁' f₂' H₁ H₂ eq
unfold FamilyOfElements.functorPushforward
rcases getFunctorPushforwardStructure H₁ with ⟨X₁, f₁, h₁, hf₁, rfl⟩
rcases getFunctorPushforwardStructure H₂ with ⟨X₂, f₂, h₂, hf₂, rfl⟩
suffices ℱ.val.map (g₁ ≫ h₁).op (x f₁ hf₁) = ℱ.val.map (g₂ ≫ h₂).op (x f₂ hf₂) by
simpa using this
apply hG.compatible ℱ h _ _ hf₁ hf₂
simpa using eq
#align category_theory.presieve.family_of_elements.compatible.functor_pushforward CategoryTheory.Presieve.FamilyOfElements.Compatible.functorPushforward
@[simp]
| Mathlib/CategoryTheory/Sites/CoverPreserving.lean | 116 | 121 | theorem CompatiblePreserving.apply_map {Y : C} {f : Y ⟶ Z} (hf : T f) :
x.functorPushforward G (G.map f) (image_mem_functorPushforward G T hf) = x f hf := by |
unfold FamilyOfElements.functorPushforward
rcases getFunctorPushforwardStructure (image_mem_functorPushforward G T hf) with
⟨X, g, f', hg, eq⟩
simpa using hG.compatible ℱ h f' (𝟙 _) hg hf (by simp [eq])
|
import Mathlib.Analysis.InnerProductSpace.TwoDim
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic
#align_import geometry.euclidean.angle.oriented.basic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open FiniteDimensional Complex
open scoped Real RealInnerProductSpace ComplexConjugate
namespace Orientation
attribute [local instance] Complex.finrank_real_complex_fact
variable {V V' : Type*}
variable [NormedAddCommGroup V] [NormedAddCommGroup V']
variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V']
variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2))
local notation "ω" => o.areaForm
def oangle (x y : V) : Real.Angle :=
Complex.arg (o.kahler x y)
#align orientation.oangle Orientation.oangle
theorem continuousAt_oangle {x : V × V} (hx1 : x.1 ≠ 0) (hx2 : x.2 ≠ 0) :
ContinuousAt (fun y : V × V => o.oangle y.1 y.2) x := by
refine (Complex.continuousAt_arg_coe_angle ?_).comp ?_
· exact o.kahler_ne_zero hx1 hx2
exact ((continuous_ofReal.comp continuous_inner).add
((continuous_ofReal.comp o.areaForm'.continuous₂).mul continuous_const)).continuousAt
#align orientation.continuous_at_oangle Orientation.continuousAt_oangle
@[simp]
theorem oangle_zero_left (x : V) : o.oangle 0 x = 0 := by simp [oangle]
#align orientation.oangle_zero_left Orientation.oangle_zero_left
@[simp]
theorem oangle_zero_right (x : V) : o.oangle x 0 = 0 := by simp [oangle]
#align orientation.oangle_zero_right Orientation.oangle_zero_right
@[simp]
theorem oangle_self (x : V) : o.oangle x x = 0 := by
rw [oangle, kahler_apply_self, ← ofReal_pow]
convert QuotientAddGroup.mk_zero (AddSubgroup.zmultiples (2 * π))
apply arg_ofReal_of_nonneg
positivity
#align orientation.oangle_self Orientation.oangle_self
theorem left_ne_zero_of_oangle_ne_zero {x y : V} (h : o.oangle x y ≠ 0) : x ≠ 0 := by
rintro rfl; simp at h
#align orientation.left_ne_zero_of_oangle_ne_zero Orientation.left_ne_zero_of_oangle_ne_zero
theorem right_ne_zero_of_oangle_ne_zero {x y : V} (h : o.oangle x y ≠ 0) : y ≠ 0 := by
rintro rfl; simp at h
#align orientation.right_ne_zero_of_oangle_ne_zero Orientation.right_ne_zero_of_oangle_ne_zero
| Mathlib/Geometry/Euclidean/Angle/Oriented/Basic.lean | 96 | 97 | theorem ne_of_oangle_ne_zero {x y : V} (h : o.oangle x y ≠ 0) : x ≠ y := by |
rintro rfl; simp at h
|
import Mathlib.Algebra.BigOperators.Finsupp
import Mathlib.Algebra.Module.Basic
import Mathlib.Algebra.Regular.SMul
import Mathlib.Data.Finset.Preimage
import Mathlib.Data.Rat.BigOperators
import Mathlib.GroupTheory.GroupAction.Hom
import Mathlib.Data.Set.Subsingleton
#align_import data.finsupp.basic from "leanprover-community/mathlib"@"f69db8cecc668e2d5894d7e9bfc491da60db3b9f"
noncomputable section
open Finset Function
variable {α β γ ι M M' N P G H R S : Type*}
namespace Finsupp
section Graph
variable [Zero M]
def graph (f : α →₀ M) : Finset (α × M) :=
f.support.map ⟨fun a => Prod.mk a (f a), fun _ _ h => (Prod.mk.inj h).1⟩
#align finsupp.graph Finsupp.graph
theorem mk_mem_graph_iff {a : α} {m : M} {f : α →₀ M} : (a, m) ∈ f.graph ↔ f a = m ∧ m ≠ 0 := by
simp_rw [graph, mem_map, mem_support_iff]
constructor
· rintro ⟨b, ha, rfl, -⟩
exact ⟨rfl, ha⟩
· rintro ⟨rfl, ha⟩
exact ⟨a, ha, rfl⟩
#align finsupp.mk_mem_graph_iff Finsupp.mk_mem_graph_iff
@[simp]
theorem mem_graph_iff {c : α × M} {f : α →₀ M} : c ∈ f.graph ↔ f c.1 = c.2 ∧ c.2 ≠ 0 := by
cases c
exact mk_mem_graph_iff
#align finsupp.mem_graph_iff Finsupp.mem_graph_iff
theorem mk_mem_graph (f : α →₀ M) {a : α} (ha : a ∈ f.support) : (a, f a) ∈ f.graph :=
mk_mem_graph_iff.2 ⟨rfl, mem_support_iff.1 ha⟩
#align finsupp.mk_mem_graph Finsupp.mk_mem_graph
theorem apply_eq_of_mem_graph {a : α} {m : M} {f : α →₀ M} (h : (a, m) ∈ f.graph) : f a = m :=
(mem_graph_iff.1 h).1
#align finsupp.apply_eq_of_mem_graph Finsupp.apply_eq_of_mem_graph
@[simp 1100] -- Porting note: change priority to appease `simpNF`
theorem not_mem_graph_snd_zero (a : α) (f : α →₀ M) : (a, (0 : M)) ∉ f.graph := fun h =>
(mem_graph_iff.1 h).2.irrefl
#align finsupp.not_mem_graph_snd_zero Finsupp.not_mem_graph_snd_zero
@[simp]
theorem image_fst_graph [DecidableEq α] (f : α →₀ M) : f.graph.image Prod.fst = f.support := by
classical simp only [graph, map_eq_image, image_image, Embedding.coeFn_mk, (· ∘ ·), image_id']
#align finsupp.image_fst_graph Finsupp.image_fst_graph
theorem graph_injective (α M) [Zero M] : Injective (@graph α M _) := by
intro f g h
classical
have hsup : f.support = g.support := by rw [← image_fst_graph, h, image_fst_graph]
refine ext_iff'.2 ⟨hsup, fun x hx => apply_eq_of_mem_graph <| h.symm ▸ ?_⟩
exact mk_mem_graph _ (hsup ▸ hx)
#align finsupp.graph_injective Finsupp.graph_injective
@[simp]
theorem graph_inj {f g : α →₀ M} : f.graph = g.graph ↔ f = g :=
(graph_injective α M).eq_iff
#align finsupp.graph_inj Finsupp.graph_inj
@[simp]
| Mathlib/Data/Finsupp/Basic.lean | 115 | 115 | theorem graph_zero : graph (0 : α →₀ M) = ∅ := by | simp [graph]
|
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.List.MinMax
import Mathlib.Algebra.Tropical.Basic
import Mathlib.Order.ConditionallyCompleteLattice.Finset
#align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
variable {R S : Type*}
open Tropical Finset
theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by
induction' l with hd tl IH
· simp
· simp [← IH]
#align list.trop_sum List.trop_sum
theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) :
trop s.sum = Multiset.prod (s.map trop) :=
Quotient.inductionOn s (by simpa using List.trop_sum)
#align multiset.trop_sum Multiset.trop_sum
theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S → R) :
trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by
convert Multiset.trop_sum (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align trop_sum trop_sum
theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) :
untrop l.prod = List.sum (l.map untrop) := by
induction' l with hd tl IH
· simp
· simp [← IH]
#align list.untrop_prod List.untrop_prod
theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) :
untrop s.prod = Multiset.sum (s.map untrop) :=
Quotient.inductionOn s (by simpa using List.untrop_prod)
#align multiset.untrop_prod Multiset.untrop_prod
theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S → Tropical R) :
untrop (∏ i ∈ s, f i) = ∑ i ∈ s, untrop (f i) := by
convert Multiset.untrop_prod (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align untrop_prod untrop_prod
-- Porting note: replaced `coe` with `WithTop.some` in statement
theorem List.trop_minimum [LinearOrder R] (l : List R) :
trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by
induction' l with hd tl IH
· simp
· simp [List.minimum_cons, ← IH]
#align list.trop_minimum List.trop_minimum
theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) :
trop s.inf = Multiset.sum (s.map trop) := by
induction' s using Multiset.induction with s x IH
· simp
· simp [← IH]
#align multiset.trop_inf Multiset.trop_inf
theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S → R) :
trop (s.inf f) = ∑ i ∈ s, trop (f i) := by
convert Multiset.trop_inf (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align finset.trop_inf Finset.trop_inf
theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S → WithTop R) :
trop (sInf (f '' s)) = ∑ i ∈ s, trop (f i) := by
rcases s.eq_empty_or_nonempty with (rfl | h)
· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top]
rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf]
#align trop_Inf_image trop_sInf_image
theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S → WithTop R) :
trop (⨅ i : S, f i) = ∑ i : S, trop (f i) := by
rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image]
#align trop_infi trop_iInf
theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) :
untrop s.sum = Multiset.inf (s.map untrop) := by
induction' s using Multiset.induction with s x IH
· simp
· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH]
rfl
#align multiset.untrop_sum Multiset.untrop_sum
| Mathlib/Algebra/Tropical/BigOperators.lean | 119 | 123 | theorem Finset.untrop_sum' [LinearOrder R] [OrderTop R] (s : Finset S) (f : S → Tropical R) :
untrop (∑ i ∈ s, f i) = s.inf (untrop ∘ f) := by |
convert Multiset.untrop_sum (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
|
import Mathlib.Algebra.Order.CauSeq.BigOperators
import Mathlib.Data.Complex.Abs
import Mathlib.Data.Complex.BigOperators
import Mathlib.Data.Nat.Choose.Sum
#align_import data.complex.exponential from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
open CauSeq Finset IsAbsoluteValue
open scoped Classical ComplexConjugate
namespace Complex
| Mathlib/Data/Complex/Exponential.lean | 1,285 | 1,309 | theorem sum_div_factorial_le {α : Type*} [LinearOrderedField α] (n j : ℕ) (hn : 0 < n) :
(∑ m ∈ filter (fun k => n ≤ k) (range j),
(1 / m.factorial : α)) ≤ n.succ / (n.factorial * n) :=
calc
(∑ m ∈ filter (fun k => n ≤ k) (range j), (1 / m.factorial : α)) =
∑ m ∈ range (j - n), (1 / ((m + n).factorial : α)) := by |
refine sum_nbij' (· - n) (· + n) ?_ ?_ ?_ ?_ ?_ <;>
simp (config := { contextual := true }) [lt_tsub_iff_right, tsub_add_cancel_of_le]
_ ≤ ∑ m ∈ range (j - n), ((n.factorial : α) * (n.succ : α) ^ m)⁻¹ := by
simp_rw [one_div]
gcongr
rw [← Nat.cast_pow, ← Nat.cast_mul, Nat.cast_le, add_comm]
exact Nat.factorial_mul_pow_le_factorial
_ = (n.factorial : α)⁻¹ * ∑ m ∈ range (j - n), (n.succ : α)⁻¹ ^ m := by
simp [mul_inv, ← mul_sum, ← sum_mul, mul_comm, inv_pow]
_ = ((n.succ : α) - n.succ * (n.succ : α)⁻¹ ^ (j - n)) / (n.factorial * n) := by
have h₁ : (n.succ : α) ≠ 1 :=
@Nat.cast_one α _ ▸ mt Nat.cast_inj.1 (mt Nat.succ.inj (pos_iff_ne_zero.1 hn))
have h₂ : (n.succ : α) ≠ 0 := by positivity
have h₃ : (n.factorial * n : α) ≠ 0 := by positivity
have h₄ : (n.succ - 1 : α) = n := by simp
rw [geom_sum_inv h₁ h₂, eq_div_iff_mul_eq h₃, mul_comm _ (n.factorial * n : α),
← mul_assoc (n.factorial⁻¹ : α), ← mul_inv_rev, h₄, ← mul_assoc (n.factorial * n : α),
mul_comm (n : α) n.factorial, mul_inv_cancel h₃, one_mul, mul_comm]
_ ≤ n.succ / (n.factorial * n : α) := by gcongr; apply sub_le_self; positivity
|
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Analysis.SpecialFunctions.NonIntegrable
import Mathlib.Analysis.Analytic.Basic
#align_import measure_theory.integral.circle_integral from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
variable {E : Type*} [NormedAddCommGroup E]
noncomputable section
open scoped Real NNReal Interval Pointwise Topology
open Complex MeasureTheory TopologicalSpace Metric Function Set Filter Asymptotics
def circleMap (c : ℂ) (R : ℝ) : ℝ → ℂ := fun θ => c + R * exp (θ * I)
#align circle_map circleMap
theorem periodic_circleMap (c : ℂ) (R : ℝ) : Periodic (circleMap c R) (2 * π) := fun θ => by
simp [circleMap, add_mul, exp_periodic _]
#align periodic_circle_map periodic_circleMap
theorem Set.Countable.preimage_circleMap {s : Set ℂ} (hs : s.Countable) (c : ℂ) {R : ℝ}
(hR : R ≠ 0) : (circleMap c R ⁻¹' s).Countable :=
show (((↑) : ℝ → ℂ) ⁻¹' ((· * I) ⁻¹'
(exp ⁻¹' ((R * ·) ⁻¹' ((c + ·) ⁻¹' s))))).Countable from
(((hs.preimage (add_right_injective _)).preimage <|
mul_right_injective₀ <| ofReal_ne_zero.2 hR).preimage_cexp.preimage <|
mul_left_injective₀ I_ne_zero).preimage ofReal_injective
#align set.countable.preimage_circle_map Set.Countable.preimage_circleMap
@[simp]
theorem circleMap_sub_center (c : ℂ) (R : ℝ) (θ : ℝ) : circleMap c R θ - c = circleMap 0 R θ := by
simp [circleMap]
#align circle_map_sub_center circleMap_sub_center
theorem circleMap_zero (R θ : ℝ) : circleMap 0 R θ = R * exp (θ * I) :=
zero_add _
#align circle_map_zero circleMap_zero
@[simp]
theorem abs_circleMap_zero (R : ℝ) (θ : ℝ) : abs (circleMap 0 R θ) = |R| := by simp [circleMap]
#align abs_circle_map_zero abs_circleMap_zero
theorem circleMap_mem_sphere' (c : ℂ) (R : ℝ) (θ : ℝ) : circleMap c R θ ∈ sphere c |R| := by simp
#align circle_map_mem_sphere' circleMap_mem_sphere'
| Mathlib/MeasureTheory/Integral/CircleIntegral.lean | 120 | 122 | theorem circleMap_mem_sphere (c : ℂ) {R : ℝ} (hR : 0 ≤ R) (θ : ℝ) :
circleMap c R θ ∈ sphere c R := by |
simpa only [_root_.abs_of_nonneg hR] using circleMap_mem_sphere' c R θ
|
import Mathlib.LinearAlgebra.Matrix.Gershgorin
import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody
import Mathlib.NumberTheory.NumberField.Units.Basic
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import number_theory.number_field.units from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
noncomputable section
open NumberField NumberField.InfinitePlace NumberField.Units BigOperators
variable (K : Type*) [Field K] [NumberField K]
namespace NumberField.Units.dirichletUnitTheorem
open scoped Classical
open Finset
variable {K}
def w₀ : InfinitePlace K := (inferInstance : Nonempty (InfinitePlace K)).some
variable (K)
def logEmbedding : Additive ((𝓞 K)ˣ) →+ ({w : InfinitePlace K // w ≠ w₀} → ℝ) :=
{ toFun := fun x w => mult w.val * Real.log (w.val ↑(Additive.toMul x))
map_zero' := by simp; rfl
map_add' := fun _ _ => by simp [Real.log_mul, mul_add]; rfl }
variable {K}
@[simp]
theorem logEmbedding_component (x : (𝓞 K)ˣ) (w : {w : InfinitePlace K // w ≠ w₀}) :
(logEmbedding K x) w = mult w.val * Real.log (w.val x) := rfl
theorem sum_logEmbedding_component (x : (𝓞 K)ˣ) :
∑ w, logEmbedding K x w = - mult (w₀ : InfinitePlace K) * Real.log (w₀ (x : K)) := by
have h := congr_arg Real.log (prod_eq_abs_norm (x : K))
rw [show |(Algebra.norm ℚ) (x : K)| = 1 from isUnit_iff_norm.mp x.isUnit, Rat.cast_one,
Real.log_one, Real.log_prod] at h
· simp_rw [Real.log_pow] at h
rw [← insert_erase (mem_univ w₀), sum_insert (not_mem_erase w₀ univ), add_comm,
add_eq_zero_iff_eq_neg] at h
convert h using 1
· refine (sum_subtype _ (fun w => ?_) (fun w => (mult w) * (Real.log (w (x : K))))).symm
exact ⟨ne_of_mem_erase, fun h => mem_erase_of_ne_of_mem h (mem_univ w)⟩
· norm_num
· exact fun w _ => pow_ne_zero _ (AbsoluteValue.ne_zero _ (coe_ne_zero x))
theorem mult_log_place_eq_zero {x : (𝓞 K)ˣ} {w : InfinitePlace K} :
mult w * Real.log (w x) = 0 ↔ w x = 1 := by
rw [mul_eq_zero, or_iff_right, Real.log_eq_zero, or_iff_right, or_iff_left]
· linarith [(apply_nonneg _ _ : 0 ≤ w x)]
· simp only [ne_eq, map_eq_zero, coe_ne_zero x, not_false_eq_true]
· refine (ne_of_gt ?_)
rw [mult]; split_ifs <;> norm_num
theorem logEmbedding_eq_zero_iff {x : (𝓞 K)ˣ} :
logEmbedding K x = 0 ↔ x ∈ torsion K := by
rw [mem_torsion]
refine ⟨fun h w => ?_, fun h => ?_⟩
· by_cases hw : w = w₀
· suffices -mult w₀ * Real.log (w₀ (x : K)) = 0 by
rw [neg_mul, neg_eq_zero, ← hw] at this
exact mult_log_place_eq_zero.mp this
rw [← sum_logEmbedding_component, sum_eq_zero]
exact fun w _ => congrFun h w
· exact mult_log_place_eq_zero.mp (congrFun h ⟨w, hw⟩)
· ext w
rw [logEmbedding_component, h w.val, Real.log_one, mul_zero, Pi.zero_apply]
| Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean | 122 | 126 | theorem logEmbedding_component_le {r : ℝ} {x : (𝓞 K)ˣ} (hr : 0 ≤ r) (h : ‖logEmbedding K x‖ ≤ r)
(w : {w : InfinitePlace K // w ≠ w₀}) : |logEmbedding K x w| ≤ r := by |
lift r to NNReal using hr
simp_rw [Pi.norm_def, NNReal.coe_le_coe, Finset.sup_le_iff, ← NNReal.coe_le_coe] at h
exact h w (mem_univ _)
|
import Mathlib.Control.Applicative
import Mathlib.Control.Traversable.Basic
#align_import control.traversable.lemmas from "leanprover-community/mathlib"@"3342d1b2178381196f818146ff79bc0e7ccd9e2d"
universe u
open LawfulTraversable
open Function hiding comp
open Functor
attribute [functor_norm] LawfulTraversable.naturality
attribute [simp] LawfulTraversable.id_traverse
namespace Traversable
variable {t : Type u → Type u}
variable [Traversable t] [LawfulTraversable t]
variable (F G : Type u → Type u)
variable [Applicative F] [LawfulApplicative F]
variable [Applicative G] [LawfulApplicative G]
variable {α β γ : Type u}
variable (g : α → F β)
variable (h : β → G γ)
variable (f : β → γ)
def PureTransformation :
ApplicativeTransformation Id F where
app := @pure F _
preserves_pure' x := rfl
preserves_seq' f x := by
simp only [map_pure, seq_pure]
rfl
#align traversable.pure_transformation Traversable.PureTransformation
@[simp]
theorem pureTransformation_apply {α} (x : id α) : PureTransformation F x = pure x :=
rfl
#align traversable.pure_transformation_apply Traversable.pureTransformation_apply
variable {F G} (x : t β)
-- Porting note: need to specify `m/F/G := Id` because `id` no longer has a `Monad` instance
theorem map_eq_traverse_id : map (f := t) f = traverse (m := Id) (pure ∘ f) :=
funext fun y => (traverse_eq_map_id f y).symm
#align traversable.map_eq_traverse_id Traversable.map_eq_traverse_id
theorem map_traverse (x : t α) : map f <$> traverse g x = traverse (map f ∘ g) x := by
rw [map_eq_traverse_id f]
refine (comp_traverse (pure ∘ f) g x).symm.trans ?_
congr; apply Comp.applicative_comp_id
#align traversable.map_traverse Traversable.map_traverse
theorem traverse_map (f : β → F γ) (g : α → β) (x : t α) :
traverse f (g <$> x) = traverse (f ∘ g) x := by
rw [@map_eq_traverse_id t _ _ _ _ g]
refine (comp_traverse (G := Id) f (pure ∘ g) x).symm.trans ?_
congr; apply Comp.applicative_id_comp
#align traversable.traverse_map Traversable.traverse_map
| Mathlib/Control/Traversable/Lemmas.lean | 83 | 86 | theorem pure_traverse (x : t α) : traverse pure x = (pure x : F (t α)) := by |
have : traverse pure x = pure (traverse (m := Id) pure x) :=
(naturality (PureTransformation F) pure x).symm
rwa [id_traverse] at this
|
import Mathlib.Data.Finsupp.Basic
import Mathlib.Data.List.AList
#align_import data.finsupp.alist from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
namespace AList
variable {α M : Type*} [Zero M]
open List
noncomputable def lookupFinsupp (l : AList fun _x : α => M) : α →₀ M where
support := by
haveI := Classical.decEq α; haveI := Classical.decEq M
exact (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset
toFun a :=
haveI := Classical.decEq α
(l.lookup a).getD 0
mem_support_toFun a := by
classical
simp_rw [@mem_toFinset _ _, List.mem_keys, List.mem_filter, ← mem_lookup_iff]
cases lookup a l <;> simp
#align alist.lookup_finsupp AList.lookupFinsupp
@[simp]
theorem lookupFinsupp_apply [DecidableEq α] (l : AList fun _x : α => M) (a : α) :
l.lookupFinsupp a = (l.lookup a).getD 0 := by
convert rfl; congr
#align alist.lookup_finsupp_apply AList.lookupFinsupp_apply
@[simp]
theorem lookupFinsupp_support [DecidableEq α] [DecidableEq M] (l : AList fun _x : α => M) :
l.lookupFinsupp.support = (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset := by
convert rfl; congr
· apply Subsingleton.elim
· funext; congr
#align alist.lookup_finsupp_support AList.lookupFinsupp_support
theorem lookupFinsupp_eq_iff_of_ne_zero [DecidableEq α] {l : AList fun _x : α => M} {a : α} {x : M}
(hx : x ≠ 0) : l.lookupFinsupp a = x ↔ x ∈ l.lookup a := by
rw [lookupFinsupp_apply]
cases' lookup a l with m <;> simp [hx.symm]
#align alist.lookup_finsupp_eq_iff_of_ne_zero AList.lookupFinsupp_eq_iff_of_ne_zero
theorem lookupFinsupp_eq_zero_iff [DecidableEq α] {l : AList fun _x : α => M} {a : α} :
l.lookupFinsupp a = 0 ↔ a ∉ l ∨ (0 : M) ∈ l.lookup a := by
rw [lookupFinsupp_apply, ← lookup_eq_none]
cases' lookup a l with m <;> simp
#align alist.lookup_finsupp_eq_zero_iff AList.lookupFinsupp_eq_zero_iff
@[simp]
theorem empty_lookupFinsupp : lookupFinsupp (∅ : AList fun _x : α => M) = 0 := by
classical
ext
simp
#align alist.empty_lookup_finsupp AList.empty_lookupFinsupp
@[simp]
| Mathlib/Data/Finsupp/AList.lean | 109 | 112 | theorem insert_lookupFinsupp [DecidableEq α] (l : AList fun _x : α => M) (a : α) (m : M) :
(l.insert a m).lookupFinsupp = l.lookupFinsupp.update a m := by |
ext b
by_cases h : b = a <;> simp [h]
|
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho
import Mathlib.LinearAlgebra.Orientation
#align_import analysis.inner_product_space.orientation from "leanprover-community/mathlib"@"bd65478311e4dfd41f48bf38c7e3b02fb75d0163"
noncomputable section
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
open FiniteDimensional
open scoped RealInnerProductSpace
namespace OrthonormalBasis
variable {ι : Type*} [Fintype ι] [DecidableEq ι] [ne : Nonempty ι] (e f : OrthonormalBasis ι ℝ E)
(x : Orientation ℝ E ι)
theorem det_to_matrix_orthonormalBasis_of_same_orientation
(h : e.toBasis.orientation = f.toBasis.orientation) : e.toBasis.det f = 1 := by
apply (e.det_to_matrix_orthonormalBasis_real f).resolve_right
have : 0 < e.toBasis.det f := by
rw [e.toBasis.orientation_eq_iff_det_pos] at h
simpa using h
linarith
#align orthonormal_basis.det_to_matrix_orthonormal_basis_of_same_orientation OrthonormalBasis.det_to_matrix_orthonormalBasis_of_same_orientation
theorem det_to_matrix_orthonormalBasis_of_opposite_orientation
(h : e.toBasis.orientation ≠ f.toBasis.orientation) : e.toBasis.det f = -1 := by
contrapose! h
simp [e.toBasis.orientation_eq_iff_det_pos,
(e.det_to_matrix_orthonormalBasis_real f).resolve_right h]
#align orthonormal_basis.det_to_matrix_orthonormal_basis_of_opposite_orientation OrthonormalBasis.det_to_matrix_orthonormalBasis_of_opposite_orientation
variable {e f}
theorem same_orientation_iff_det_eq_det :
e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by
constructor
· intro h
dsimp [Basis.orientation]
congr
· intro h
rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
simp [e.det_to_matrix_orthonormalBasis_of_same_orientation f h]
#align orthonormal_basis.same_orientation_iff_det_eq_det OrthonormalBasis.same_orientation_iff_det_eq_det
variable (e f)
theorem det_eq_neg_det_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) :
e.toBasis.det = -f.toBasis.det := by
rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
-- Porting note: added `neg_one_smul` with explicit type
simp [e.det_to_matrix_orthonormalBasis_of_opposite_orientation f h,
neg_one_smul ℝ (M := E [⋀^ι]→ₗ[ℝ] ℝ)]
#align orthonormal_basis.det_eq_neg_det_of_opposite_orientation OrthonormalBasis.det_eq_neg_det_of_opposite_orientation
section AdjustToOrientation
theorem orthonormal_adjustToOrientation : Orthonormal ℝ (e.toBasis.adjustToOrientation x) := by
apply e.orthonormal.orthonormal_of_forall_eq_or_eq_neg
simpa using e.toBasis.adjustToOrientation_apply_eq_or_eq_neg x
#align orthonormal_basis.orthonormal_adjust_to_orientation OrthonormalBasis.orthonormal_adjustToOrientation
def adjustToOrientation : OrthonormalBasis ι ℝ E :=
(e.toBasis.adjustToOrientation x).toOrthonormalBasis (e.orthonormal_adjustToOrientation x)
#align orthonormal_basis.adjust_to_orientation OrthonormalBasis.adjustToOrientation
theorem toBasis_adjustToOrientation :
(e.adjustToOrientation x).toBasis = e.toBasis.adjustToOrientation x :=
(e.toBasis.adjustToOrientation x).toBasis_toOrthonormalBasis _
#align orthonormal_basis.to_basis_adjust_to_orientation OrthonormalBasis.toBasis_adjustToOrientation
@[simp]
theorem orientation_adjustToOrientation : (e.adjustToOrientation x).toBasis.orientation = x := by
rw [e.toBasis_adjustToOrientation]
exact e.toBasis.orientation_adjustToOrientation x
#align orthonormal_basis.orientation_adjust_to_orientation OrthonormalBasis.orientation_adjustToOrientation
theorem adjustToOrientation_apply_eq_or_eq_neg (i : ι) :
e.adjustToOrientation x i = e i ∨ e.adjustToOrientation x i = -e i := by
simpa [← e.toBasis_adjustToOrientation] using
e.toBasis.adjustToOrientation_apply_eq_or_eq_neg x i
#align orthonormal_basis.adjust_to_orientation_apply_eq_or_eq_neg OrthonormalBasis.adjustToOrientation_apply_eq_or_eq_neg
| Mathlib/Analysis/InnerProductSpace/Orientation.lean | 135 | 138 | theorem det_adjustToOrientation :
(e.adjustToOrientation x).toBasis.det = e.toBasis.det ∨
(e.adjustToOrientation x).toBasis.det = -e.toBasis.det := by |
simpa using e.toBasis.det_adjustToOrientation x
|
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Range
#align_import data.list.fin_range from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
universe u
namespace List
variable {α : Type u}
@[simp]
theorem map_coe_finRange (n : ℕ) : ((finRange n) : List (Fin n)).map (Fin.val) = List.range n := by
simp_rw [finRange, map_pmap, pmap_eq_map]
exact List.map_id _
#align list.map_coe_fin_range List.map_coe_finRange
theorem finRange_succ_eq_map (n : ℕ) : finRange n.succ = 0 :: (finRange n).map Fin.succ := by
apply map_injective_iff.mpr Fin.val_injective
rw [map_cons, map_coe_finRange, range_succ_eq_map, Fin.val_zero, ← map_coe_finRange, map_map,
map_map]
simp only [Function.comp, Fin.val_succ]
#align list.fin_range_succ_eq_map List.finRange_succ_eq_map
theorem finRange_succ (n : ℕ) :
finRange n.succ = (finRange n |>.map Fin.castSucc |>.concat (.last _)) := by
apply map_injective_iff.mpr Fin.val_injective
simp [range_succ, Function.comp_def]
-- Porting note: `map_nth_le` moved to `List.finRange_map_get` in Data.List.Range
theorem ofFn_eq_pmap {n} {f : Fin n → α} :
ofFn f = pmap (fun i hi => f ⟨i, hi⟩) (range n) fun _ => mem_range.1 := by
rw [pmap_eq_map_attach]
exact ext_get (by simp) fun i hi1 hi2 => by simp [get_ofFn f ⟨i, hi1⟩]
#align list.of_fn_eq_pmap List.ofFn_eq_pmap
theorem ofFn_id (n) : ofFn id = finRange n :=
ofFn_eq_pmap
#align list.of_fn_id List.ofFn_id
theorem ofFn_eq_map {n} {f : Fin n → α} : ofFn f = (finRange n).map f := by
rw [← ofFn_id, map_ofFn, Function.comp_id]
#align list.of_fn_eq_map List.ofFn_eq_map
| Mathlib/Data/List/FinRange.lean | 58 | 61 | theorem nodup_ofFn_ofInjective {n} {f : Fin n → α} (hf : Function.Injective f) :
Nodup (ofFn f) := by |
rw [ofFn_eq_pmap]
exact (nodup_range n).pmap fun _ _ _ _ H => Fin.val_eq_of_eq <| hf H
|
import Mathlib.RingTheory.Polynomial.Pochhammer
#align_import data.nat.factorial.cast from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b"
open Nat
variable (S : Type*)
namespace Nat
section Semiring
variable [Semiring S] (a b : ℕ)
-- Porting note: added type ascription around a + 1
| Mathlib/Data/Nat/Factorial/Cast.lean | 34 | 35 | theorem cast_ascFactorial : (a.ascFactorial b : S) = (ascPochhammer S b).eval (a : S) := by |
rw [← ascPochhammer_nat_eq_ascFactorial, ascPochhammer_eval_cast]
|
import Mathlib.AlgebraicGeometry.Morphisms.Basic
import Mathlib.RingTheory.LocalProperties
#align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
universe u
open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry
variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop)
namespace RingHom
variable {P}
theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y]
(f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔
P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _
(Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _
(X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _
(Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by
rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso,
← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r)))
(X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff]
congr
delta IsLocalization.Away.map
refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_
generalize_proofs
haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)
-- Porting note: needs to be very explicit here
convert
(@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r))
_ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1
change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _
rw [f.val.c.naturality_assoc]
simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp]
congr 1
#align ring_hom.respects_iso.basic_open_iff RingHom.RespectsIso.basicOpen_iff
theorem RespectsIso.basicOpen_iff_localization (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X]
[IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map f.op) r) := by
refine (hP.basicOpen_iff _ _).trans ?_
-- Porting note: was a one line term mode proof, but this `dsimp` is vital so the term mode
-- one liner is not possible
dsimp
rw [← hP.is_localization_away_iff]
#align ring_hom.respects_iso.basic_open_iff_localization RingHom.RespectsIso.basicOpen_iff_localization
@[deprecated (since := "2024-03-02")] alias
RespectsIso.ofRestrict_morphismRestrict_iff_of_isAffine := RespectsIso.basicOpen_iff_localization
| Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean | 86 | 102 | theorem RespectsIso.ofRestrict_morphismRestrict_iff (hP : RingHom.RespectsIso @P) {X Y : Scheme.{u}}
[IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) (U : Opens X.carrier)
(hU : IsAffineOpen U) {V : Opens _}
(e : V = (Scheme.ιOpens <| f ⁻¹ᵁ Y.basicOpen r) ⁻¹ᵁ U) :
P (Scheme.Γ.map (Scheme.ιOpens V ≫ f ∣_ Y.basicOpen r).op) ↔
P (Localization.awayMap (Scheme.Γ.map (Scheme.ιOpens U ≫ f).op) r) := by |
subst e
refine (hP.cancel_right_isIso _
(Scheme.Γ.mapIso (Scheme.restrictRestrictComm _ _ _).op).inv).symm.trans ?_
haveI : IsAffine _ := hU
rw [← hP.basicOpen_iff_localization, iff_iff_eq]
congr 1
simp only [Functor.mapIso_inv, Iso.op_inv, ← Functor.map_comp, ← op_comp, morphismRestrict_comp]
rw [← Category.assoc]
congr 3
rw [← cancel_mono (Scheme.ιOpens _), Category.assoc, Scheme.restrictRestrictComm,
IsOpenImmersion.isoOfRangeEq_inv_fac, morphismRestrict_ι]
|
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Finset.Image
import Mathlib.Data.Multiset.Fold
#align_import data.finset.fold from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
namespace Finset
open Multiset
variable {α β γ : Type*}
section Fold
variable (op : β → β → β) [hc : Std.Commutative op] [ha : Std.Associative op]
local notation a " * " b => op a b
def fold (b : β) (f : α → β) (s : Finset α) : β :=
(s.1.map f).fold op b
#align finset.fold Finset.fold
variable {op} {f : α → β} {b : β} {s : Finset α} {a : α}
@[simp]
theorem fold_empty : (∅ : Finset α).fold op b f = b :=
rfl
#align finset.fold_empty Finset.fold_empty
@[simp]
theorem fold_cons (h : a ∉ s) : (cons a s h).fold op b f = f a * s.fold op b f := by
dsimp only [fold]
rw [cons_val, Multiset.map_cons, fold_cons_left]
#align finset.fold_cons Finset.fold_cons
@[simp]
theorem fold_insert [DecidableEq α] (h : a ∉ s) :
(insert a s).fold op b f = f a * s.fold op b f := by
unfold fold
rw [insert_val, ndinsert_of_not_mem h, Multiset.map_cons, fold_cons_left]
#align finset.fold_insert Finset.fold_insert
@[simp]
theorem fold_singleton : ({a} : Finset α).fold op b f = f a * b :=
rfl
#align finset.fold_singleton Finset.fold_singleton
@[simp]
| Mathlib/Data/Finset/Fold.lean | 68 | 69 | theorem fold_map {g : γ ↪ α} {s : Finset γ} : (s.map g).fold op b f = s.fold op b (f ∘ g) := by |
simp only [fold, map, Multiset.map_map]
|
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Factorial.DoubleFactorial
#align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"938d3db9c278f8a52c0f964a405806f0f2b09b74"
noncomputable section
open Polynomial
namespace Polynomial
noncomputable def hermite : ℕ → Polynomial ℤ
| 0 => 1
| n + 1 => X * hermite n - derivative (hermite n)
#align polynomial.hermite Polynomial.hermite
@[simp]
theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - derivative (hermite n) := by
rw [hermite]
#align polynomial.hermite_succ Polynomial.hermite_succ
theorem hermite_eq_iterate (n : ℕ) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by
induction' n with n ih
· rfl
· rw [Function.iterate_succ_apply', ← ih, hermite_succ]
#align polynomial.hermite_eq_iterate Polynomial.hermite_eq_iterate
@[simp]
theorem hermite_zero : hermite 0 = C 1 :=
rfl
#align polynomial.hermite_zero Polynomial.hermite_zero
-- Porting note (#10618): There was initially @[simp] on this line but it was removed
-- because simp can prove this theorem
theorem hermite_one : hermite 1 = X := by
rw [hermite_succ, hermite_zero]
simp only [map_one, mul_one, derivative_one, sub_zero]
#align polynomial.hermite_one Polynomial.hermite_one
section coeff
| Mathlib/RingTheory/Polynomial/Hermite/Basic.lean | 82 | 83 | theorem coeff_hermite_succ_zero (n : ℕ) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by |
simp [coeff_derivative]
|
import Mathlib.Algebra.Module.Submodule.Ker
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
variable {R : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*} {K₂ : Type*}
variable {M : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
section
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def range [RingHomSurjective τ₁₂] (f : F) : Submodule R₂ M₂ :=
(map f ⊤).copy (Set.range f) Set.image_univ.symm
#align linear_map.range LinearMap.range
theorem range_coe [RingHomSurjective τ₁₂] (f : F) : (range f : Set M₂) = Set.range f :=
rfl
#align linear_map.range_coe LinearMap.range_coe
theorem range_toAddSubmonoid [RingHomSurjective τ₁₂] (f : M →ₛₗ[τ₁₂] M₂) :
f.range.toAddSubmonoid = AddMonoidHom.mrange f :=
rfl
#align linear_map.range_to_add_submonoid LinearMap.range_toAddSubmonoid
@[simp]
theorem mem_range [RingHomSurjective τ₁₂] {f : F} {x} : x ∈ range f ↔ ∃ y, f y = x :=
Iff.rfl
#align linear_map.mem_range LinearMap.mem_range
theorem range_eq_map [RingHomSurjective τ₁₂] (f : F) : range f = map f ⊤ := by
ext
simp
#align linear_map.range_eq_map LinearMap.range_eq_map
theorem mem_range_self [RingHomSurjective τ₁₂] (f : F) (x : M) : f x ∈ range f :=
⟨x, rfl⟩
#align linear_map.mem_range_self LinearMap.mem_range_self
@[simp]
theorem range_id : range (LinearMap.id : M →ₗ[R] M) = ⊤ :=
SetLike.coe_injective Set.range_id
#align linear_map.range_id LinearMap.range_id
theorem range_comp [RingHomSurjective τ₁₂] [RingHomSurjective τ₂₃] [RingHomSurjective τ₁₃]
(f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) : range (g.comp f : M →ₛₗ[τ₁₃] M₃) = map g (range f) :=
SetLike.coe_injective (Set.range_comp g f)
#align linear_map.range_comp LinearMap.range_comp
theorem range_comp_le_range [RingHomSurjective τ₂₃] [RingHomSurjective τ₁₃] (f : M →ₛₗ[τ₁₂] M₂)
(g : M₂ →ₛₗ[τ₂₃] M₃) : range (g.comp f : M →ₛₗ[τ₁₃] M₃) ≤ range g :=
SetLike.coe_mono (Set.range_comp_subset_range f g)
#align linear_map.range_comp_le_range LinearMap.range_comp_le_range
theorem range_eq_top [RingHomSurjective τ₁₂] {f : F} : range f = ⊤ ↔ Surjective f := by
rw [SetLike.ext'_iff, range_coe, top_coe, Set.range_iff_surjective]
#align linear_map.range_eq_top LinearMap.range_eq_top
| Mathlib/Algebra/Module/Submodule/Range.lean | 104 | 105 | theorem range_le_iff_comap [RingHomSurjective τ₁₂] {f : F} {p : Submodule R₂ M₂} :
range f ≤ p ↔ comap f p = ⊤ := by | rw [range_eq_map, map_le_iff_le_comap, eq_top_iff]
|
import Mathlib.Combinatorics.Enumerative.Composition
import Mathlib.Tactic.ApplyFun
#align_import combinatorics.partition from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Multiset
namespace Nat
@[ext]
structure Partition (n : ℕ) where
parts : Multiset ℕ
parts_pos : ∀ {i}, i ∈ parts → 0 < i
parts_sum : parts.sum = n
-- Porting note: chokes on `parts_pos`
--deriving DecidableEq
#align nat.partition Nat.Partition
namespace Partition
-- TODO: This should be automatically derived, see lean4#2914
instance decidableEqPartition {n : ℕ} : DecidableEq (Partition n) :=
fun _ _ => decidable_of_iff' _ <| Partition.ext_iff _ _
@[simps]
def ofComposition (n : ℕ) (c : Composition n) : Partition n where
parts := c.blocks
parts_pos hi := c.blocks_pos hi
parts_sum := by rw [Multiset.sum_coe, c.blocks_sum]
#align nat.partition.of_composition Nat.Partition.ofComposition
| Mathlib/Combinatorics/Enumerative/Partition.lean | 77 | 80 | theorem ofComposition_surj {n : ℕ} : Function.Surjective (ofComposition n) := by |
rintro ⟨b, hb₁, hb₂⟩
induction b using Quotient.inductionOn with | _ b => ?_
exact ⟨⟨b, hb₁, by simpa using hb₂⟩, Partition.ext _ _ rfl⟩
|
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Rat.Cast.Order
import Mathlib.Order.Partition.Finpartition
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
#align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1"
open Finset
variable {𝕜 ι κ α β : Type*}
namespace Rel
section Asymmetric
variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α}
{t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜}
def interedges (s : Finset α) (t : Finset β) : Finset (α × β) :=
(s ×ˢ t).filter fun e ↦ r e.1 e.2
#align rel.interedges Rel.interedges
def edgeDensity (s : Finset α) (t : Finset β) : ℚ :=
(interedges r s t).card / (s.card * t.card)
#align rel.edge_density Rel.edgeDensity
variable {r}
theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by
rw [interedges, mem_filter, Finset.mem_product, and_assoc]
#align rel.mem_interedges_iff Rel.mem_interedges_iff
theorem mk_mem_interedges_iff : (a, b) ∈ interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b :=
mem_interedges_iff
#align rel.mk_mem_interedges_iff Rel.mk_mem_interedges_iff
@[simp]
theorem interedges_empty_left (t : Finset β) : interedges r ∅ t = ∅ := by
rw [interedges, Finset.empty_product, filter_empty]
#align rel.interedges_empty_left Rel.interedges_empty_left
theorem interedges_mono (hs : s₂ ⊆ s₁) (ht : t₂ ⊆ t₁) : interedges r s₂ t₂ ⊆ interedges r s₁ t₁ :=
fun x ↦ by
simp_rw [mem_interedges_iff]
exact fun h ↦ ⟨hs h.1, ht h.2.1, h.2.2⟩
#align rel.interedges_mono Rel.interedges_mono
variable (r)
theorem card_interedges_add_card_interedges_compl (s : Finset α) (t : Finset β) :
(interedges r s t).card + (interedges (fun x y ↦ ¬r x y) s t).card = s.card * t.card := by
classical
rw [← card_product, interedges, interedges, ← card_union_of_disjoint, filter_union_filter_neg_eq]
exact disjoint_filter.2 fun _ _ ↦ Classical.not_not.2
#align rel.card_interedges_add_card_interedges_compl Rel.card_interedges_add_card_interedges_compl
theorem interedges_disjoint_left {s s' : Finset α} (hs : Disjoint s s') (t : Finset β) :
Disjoint (interedges r s t) (interedges r s' t) := by
rw [Finset.disjoint_left] at hs ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact hs hx.1 hy.1
#align rel.interedges_disjoint_left Rel.interedges_disjoint_left
theorem interedges_disjoint_right (s : Finset α) {t t' : Finset β} (ht : Disjoint t t') :
Disjoint (interedges r s t) (interedges r s t') := by
rw [Finset.disjoint_left] at ht ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact ht hx.2.1 hy.2.1
#align rel.interedges_disjoint_right Rel.interedges_disjoint_right
section DecidableEq
variable [DecidableEq α] [DecidableEq β]
lemma interedges_eq_biUnion :
interedges r s t = s.biUnion (fun x ↦ (t.filter (r x)).map ⟨(x, ·), Prod.mk.inj_left x⟩) := by
ext ⟨x, y⟩; simp [mem_interedges_iff]
theorem interedges_biUnion_left (s : Finset ι) (t : Finset β) (f : ι → Finset α) :
interedges r (s.biUnion f) t = s.biUnion fun a ↦ interedges r (f a) t := by
ext
simp only [mem_biUnion, mem_interedges_iff, exists_and_right, ← and_assoc]
#align rel.interedges_bUnion_left Rel.interedges_biUnion_left
| Mathlib/Combinatorics/SimpleGraph/Density.lean | 115 | 120 | theorem interedges_biUnion_right (s : Finset α) (t : Finset ι) (f : ι → Finset β) :
interedges r s (t.biUnion f) = t.biUnion fun b ↦ interedges r s (f b) := by |
ext a
simp only [mem_interedges_iff, mem_biUnion]
exact ⟨fun ⟨x₁, ⟨x₂, x₃, x₄⟩, x₅⟩ ↦ ⟨x₂, x₃, x₁, x₄, x₅⟩,
fun ⟨x₂, x₃, x₁, x₄, x₅⟩ ↦ ⟨x₁, ⟨x₂, x₃, x₄⟩, x₅⟩⟩
|
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Analytic.CPolynomial
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
import Mathlib.Analysis.Calculus.FDeriv.Add
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open Filter Asymptotics
open scoped ENNReal
universe u v
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
section fderiv
variable {p : FormalMultilinearSeries 𝕜 E F} {r : ℝ≥0∞}
variable {f : E → F} {x : E} {s : Set E}
| Mathlib/Analysis/Calculus/FDeriv/Analytic.lean | 39 | 44 | theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p 1)) x := by |
refine h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right ?_)
refine isLittleO_iff_exists_eq_mul.2 ⟨fun y => ‖y - (x, x)‖, ?_, EventuallyEq.rfl⟩
refine (continuous_id.sub continuous_const).norm.tendsto' _ _ ?_
rw [_root_.id, sub_self, norm_zero]
|
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
import Mathlib.MeasureTheory.Covering.VitaliFamily
import Mathlib.Data.Set.Pairwise.Lattice
#align_import measure_theory.covering.vitali from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
variable {α ι : Type*}
open Set Metric MeasureTheory TopologicalSpace Filter
open scoped NNReal Classical ENNReal Topology
namespace Vitali
| Mathlib/MeasureTheory/Covering/Vitali.lean | 58 | 153 | theorem exists_disjoint_subfamily_covering_enlargment (B : ι → Set α) (t : Set ι) (δ : ι → ℝ)
(τ : ℝ) (hτ : 1 < τ) (δnonneg : ∀ a ∈ t, 0 ≤ δ a) (R : ℝ) (δle : ∀ a ∈ t, δ a ≤ R)
(hne : ∀ a ∈ t, (B a).Nonempty) :
∃ u ⊆ t,
u.PairwiseDisjoint B ∧ ∀ a ∈ t, ∃ b ∈ u, (B a ∩ B b).Nonempty ∧ δ a ≤ τ * δ b := by |
/- The proof could be formulated as a transfinite induction. First pick an element of `t` with `δ`
as large as possible (up to a factor of `τ`). Then among the remaining elements not intersecting
the already chosen one, pick another element with large `δ`. Go on forever (transfinitely) until
there is nothing left.
Instead, we give a direct Zorn-based argument. Consider a maximal family `u` of disjoint sets
with the following property: if an element `a` of `t` intersects some element `b` of `u`, then it
intersects some `b' ∈ u` with `δ b' ≥ δ a / τ`. Such a maximal family exists by Zorn. If this
family did not intersect some element `a ∈ t`, then take an element `a' ∈ t` which does not
intersect any element of `u`, with `δ a'` almost as large as possible. One checks easily
that `u ∪ {a'}` still has this property, contradicting the maximality. Therefore, `u`
intersects all elements of `t`, and by definition it satisfies all the desired properties.
-/
let T : Set (Set ι) := { u | u ⊆ t ∧ u.PairwiseDisjoint B ∧
∀ a ∈ t, ∀ b ∈ u, (B a ∩ B b).Nonempty → ∃ c ∈ u, (B a ∩ B c).Nonempty ∧ δ a ≤ τ * δ c }
-- By Zorn, choose a maximal family in the good set `T` of disjoint families.
obtain ⟨u, uT, hu⟩ : ∃ u ∈ T, ∀ v ∈ T, u ⊆ v → v = u := by
refine zorn_subset _ fun U UT hU => ?_
refine ⟨⋃₀ U, ?_, fun s hs => subset_sUnion_of_mem hs⟩
simp only [T, Set.sUnion_subset_iff, and_imp, exists_prop, forall_exists_index, mem_sUnion,
Set.mem_setOf_eq]
refine
⟨fun u hu => (UT hu).1, (pairwiseDisjoint_sUnion hU.directedOn).2 fun u hu => (UT hu).2.1,
fun a hat b u uU hbu hab => ?_⟩
obtain ⟨c, cu, ac, hc⟩ : ∃ c, c ∈ u ∧ (B a ∩ B c).Nonempty ∧ δ a ≤ τ * δ c :=
(UT uU).2.2 a hat b hbu hab
exact ⟨c, ⟨u, uU, cu⟩, ac, hc⟩
-- The only nontrivial bit is to check that every `a ∈ t` intersects an element `b ∈ u` with
-- comparatively large `δ b`. Assume this is not the case, then we will contradict the maximality.
refine ⟨u, uT.1, uT.2.1, fun a hat => ?_⟩
contrapose! hu
have a_disj : ∀ c ∈ u, Disjoint (B a) (B c) := by
intro c hc
by_contra h
rw [not_disjoint_iff_nonempty_inter] at h
obtain ⟨d, du, ad, hd⟩ : ∃ d, d ∈ u ∧ (B a ∩ B d).Nonempty ∧ δ a ≤ τ * δ d :=
uT.2.2 a hat c hc h
exact lt_irrefl _ ((hu d du ad).trans_le hd)
-- Let `A` be all the elements of `t` which do not intersect the family `u`. It is nonempty as it
-- contains `a`. We will pick an element `a'` of `A` with `δ a'` almost as large as possible.
let A := { a' | a' ∈ t ∧ ∀ c ∈ u, Disjoint (B a') (B c) }
have Anonempty : A.Nonempty := ⟨a, hat, a_disj⟩
let m := sSup (δ '' A)
have bddA : BddAbove (δ '' A) := by
refine ⟨R, fun x xA => ?_⟩
rcases (mem_image _ _ _).1 xA with ⟨a', ha', rfl⟩
exact δle a' ha'.1
obtain ⟨a', a'A, ha'⟩ : ∃ a' ∈ A, m / τ ≤ δ a' := by
have : 0 ≤ m := (δnonneg a hat).trans (le_csSup bddA (mem_image_of_mem _ ⟨hat, a_disj⟩))
rcases eq_or_lt_of_le this with (mzero | mpos)
· refine ⟨a, ⟨hat, a_disj⟩, ?_⟩
simpa only [← mzero, zero_div] using δnonneg a hat
· have I : m / τ < m := by
rw [div_lt_iff (zero_lt_one.trans hτ)]
conv_lhs => rw [← mul_one m]
exact (mul_lt_mul_left mpos).2 hτ
rcases exists_lt_of_lt_csSup (Anonempty.image _) I with ⟨x, xA, hx⟩
rcases (mem_image _ _ _).1 xA with ⟨a', ha', rfl⟩
exact ⟨a', ha', hx.le⟩
clear hat hu a_disj a
have a'_ne_u : a' ∉ u := fun H => (hne _ a'A.1).ne_empty (disjoint_self.1 (a'A.2 _ H))
-- we claim that `u ∪ {a'}` still belongs to `T`, contradicting the maximality of `u`.
refine ⟨insert a' u, ⟨?_, ?_, ?_⟩, subset_insert _ _, (ne_insert_of_not_mem _ a'_ne_u).symm⟩
· -- check that `u ∪ {a'}` is made of elements of `t`.
rw [insert_subset_iff]
exact ⟨a'A.1, uT.1⟩
· -- Check that `u ∪ {a'}` is a disjoint family. This follows from the fact that `a'` does not
-- intersect `u`.
exact uT.2.1.insert fun b bu _ => a'A.2 b bu
· -- check that every element `c` of `t` intersecting `u ∪ {a'}` intersects an element of this
-- family with large `δ`.
intro c ct b ba'u hcb
-- if `c` already intersects an element of `u`, then it intersects an element of `u` with
-- large `δ` by the assumption on `u`, and there is nothing left to do.
by_cases H : ∃ d ∈ u, (B c ∩ B d).Nonempty
· rcases H with ⟨d, du, hd⟩
rcases uT.2.2 c ct d du hd with ⟨d', d'u, hd'⟩
exact ⟨d', mem_insert_of_mem _ d'u, hd'⟩
· -- Otherwise, `c` belongs to `A`. The element of `u ∪ {a'}` that it intersects has to be `a'`.
-- Moreover, `δ c` is smaller than the maximum `m` of `δ` over `A`, which is `≤ δ a' / τ`
-- thanks to the good choice of `a'`. This is the desired inequality.
push_neg at H
simp only [← disjoint_iff_inter_eq_empty] at H
rcases mem_insert_iff.1 ba'u with (rfl | H')
· refine ⟨b, mem_insert _ _, hcb, ?_⟩
calc
δ c ≤ m := le_csSup bddA (mem_image_of_mem _ ⟨ct, H⟩)
_ = τ * (m / τ) := by field_simp [(zero_lt_one.trans hτ).ne']
_ ≤ τ * δ b := by gcongr
· rw [← not_disjoint_iff_nonempty_inter] at hcb
exact (hcb (H _ H')).elim
|
import Mathlib.Topology.Homeomorph
import Mathlib.Topology.Order.LeftRightNhds
#align_import topology.algebra.order.monotone_continuity from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Set Filter
open Topology
section LinearOrder
variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
variable [LinearOrder β] [TopologicalSpace β] [OrderTopology β]
| Mathlib/Topology/Order/MonotoneContinuity.lean | 42 | 54 | theorem StrictMonoOn.continuousWithinAt_right_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b) :
ContinuousWithinAt f (Ici a) a := by |
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
((h_mono.le_iff_le has hxs).2 hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
rw [h_mono.lt_iff_lt has hcs] at hac
filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 hac)]
rintro x hx ⟨_, hxc⟩
exact ((h_mono.lt_iff_lt hx hcs).2 hxc).trans_le hcb
|
import Mathlib.Combinatorics.SimpleGraph.Init
import Mathlib.Data.Rel
import Mathlib.Data.Set.Finite
import Mathlib.Data.Sym.Sym2
#align_import combinatorics.simple_graph.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
-- Porting note: using `aesop` for automation
-- Porting note: These attributes are needed to use `aesop` as a replacement for `obviously`
attribute [aesop norm unfold (rule_sets := [SimpleGraph])] Symmetric
attribute [aesop norm unfold (rule_sets := [SimpleGraph])] Irreflexive
-- Porting note: a thin wrapper around `aesop` for graph lemmas, modelled on `aesop_cat`
macro (name := aesop_graph) "aesop_graph" c:Aesop.tactic_clause* : tactic =>
`(tactic|
aesop $c*
(config := { introsTransparency? := some .default, terminal := true })
(rule_sets := [$(Lean.mkIdent `SimpleGraph):ident]))
macro (name := aesop_graph?) "aesop_graph?" c:Aesop.tactic_clause* : tactic =>
`(tactic|
aesop $c*
(config := { introsTransparency? := some .default, terminal := true })
(rule_sets := [$(Lean.mkIdent `SimpleGraph):ident]))
macro (name := aesop_graph_nonterminal) "aesop_graph_nonterminal" c:Aesop.tactic_clause* : tactic =>
`(tactic|
aesop $c*
(config := { introsTransparency? := some .default, warnOnNonterminal := false })
(rule_sets := [$(Lean.mkIdent `SimpleGraph):ident]))
open Finset Function
universe u v w
@[ext, aesop safe constructors (rule_sets := [SimpleGraph])]
structure SimpleGraph (V : Type u) where
Adj : V → V → Prop
symm : Symmetric Adj := by aesop_graph
loopless : Irreflexive Adj := by aesop_graph
#align simple_graph SimpleGraph
-- Porting note: changed `obviously` to `aesop` in the `structure`
initialize_simps_projections SimpleGraph (Adj → adj)
@[simps]
def SimpleGraph.mk' {V : Type u} :
{adj : V → V → Bool // (∀ x y, adj x y = adj y x) ∧ (∀ x, ¬ adj x x)} ↪ SimpleGraph V where
toFun x := ⟨fun v w ↦ x.1 v w, fun v w ↦ by simp [x.2.1], fun v ↦ by simp [x.2.2]⟩
inj' := by
rintro ⟨adj, _⟩ ⟨adj', _⟩
simp only [mk.injEq, Subtype.mk.injEq]
intro h
funext v w
simpa [Bool.coe_iff_coe] using congr_fun₂ h v w
instance {V : Type u} [Fintype V] [DecidableEq V] : Fintype (SimpleGraph V) where
elems := Finset.univ.map SimpleGraph.mk'
complete := by
classical
rintro ⟨Adj, hs, hi⟩
simp only [mem_map, mem_univ, true_and, Subtype.exists, Bool.not_eq_true]
refine ⟨fun v w ↦ Adj v w, ⟨?_, ?_⟩, ?_⟩
· simp [hs.iff]
· intro v; simp [hi v]
· ext
simp
def SimpleGraph.fromRel {V : Type u} (r : V → V → Prop) : SimpleGraph V where
Adj a b := a ≠ b ∧ (r a b ∨ r b a)
symm := fun _ _ ⟨hn, hr⟩ => ⟨hn.symm, hr.symm⟩
loopless := fun _ ⟨hn, _⟩ => hn rfl
#align simple_graph.from_rel SimpleGraph.fromRel
@[simp]
theorem SimpleGraph.fromRel_adj {V : Type u} (r : V → V → Prop) (v w : V) :
(SimpleGraph.fromRel r).Adj v w ↔ v ≠ w ∧ (r v w ∨ r w v) :=
Iff.rfl
#align simple_graph.from_rel_adj SimpleGraph.fromRel_adj
-- Porting note: attributes needed for `completeGraph`
attribute [aesop safe (rule_sets := [SimpleGraph])] Ne.symm
attribute [aesop safe (rule_sets := [SimpleGraph])] Ne.irrefl
def completeGraph (V : Type u) : SimpleGraph V where Adj := Ne
#align complete_graph completeGraph
def emptyGraph (V : Type u) : SimpleGraph V where Adj _ _ := False
#align empty_graph emptyGraph
@[simps]
def completeBipartiteGraph (V W : Type*) : SimpleGraph (Sum V W) where
Adj v w := v.isLeft ∧ w.isRight ∨ v.isRight ∧ w.isLeft
symm v w := by cases v <;> cases w <;> simp
loopless v := by cases v <;> simp
#align complete_bipartite_graph completeBipartiteGraph
namespace SimpleGraph
variable {ι : Sort*} {V : Type u} (G : SimpleGraph V) {a b c u v w : V} {e : Sym2 V}
@[simp]
protected theorem irrefl {v : V} : ¬G.Adj v v :=
G.loopless v
#align simple_graph.irrefl SimpleGraph.irrefl
theorem adj_comm (u v : V) : G.Adj u v ↔ G.Adj v u :=
⟨fun x => G.symm x, fun x => G.symm x⟩
#align simple_graph.adj_comm SimpleGraph.adj_comm
@[symm]
theorem adj_symm (h : G.Adj u v) : G.Adj v u :=
G.symm h
#align simple_graph.adj_symm SimpleGraph.adj_symm
theorem Adj.symm {G : SimpleGraph V} {u v : V} (h : G.Adj u v) : G.Adj v u :=
G.symm h
#align simple_graph.adj.symm SimpleGraph.Adj.symm
| Mathlib/Combinatorics/SimpleGraph/Basic.lean | 188 | 190 | theorem ne_of_adj (h : G.Adj a b) : a ≠ b := by |
rintro rfl
exact G.irrefl h
|
import Mathlib.Tactic.ApplyFun
import Mathlib.Topology.UniformSpace.Basic
import Mathlib.Topology.Separation
#align_import topology.uniform_space.separation from "leanprover-community/mathlib"@"0c1f285a9f6e608ae2bdffa3f993eafb01eba829"
open Filter Set Function Topology Uniformity UniformSpace
open scoped Classical
noncomputable section
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
variable [UniformSpace α] [UniformSpace β] [UniformSpace γ]
instance (priority := 100) UniformSpace.to_regularSpace : RegularSpace α :=
.of_hasBasis
(fun _ ↦ nhds_basis_uniformity' uniformity_hasBasis_closed)
fun a _V hV ↦ isClosed_ball a hV.2
#align uniform_space.to_regular_space UniformSpace.to_regularSpace
#align separation_rel Inseparable
#noalign separated_equiv
#align separation_rel_iff_specializes specializes_iff_inseparable
#noalign separation_rel_iff_inseparable
theorem Filter.HasBasis.specializes_iff_uniformity {ι : Sort*} {p : ι → Prop} {s : ι → Set (α × α)}
(h : (𝓤 α).HasBasis p s) {x y : α} : x ⤳ y ↔ ∀ i, p i → (x, y) ∈ s i :=
(nhds_basis_uniformity h).specializes_iff
theorem Filter.HasBasis.inseparable_iff_uniformity {ι : Sort*} {p : ι → Prop} {s : ι → Set (α × α)}
(h : (𝓤 α).HasBasis p s) {x y : α} : Inseparable x y ↔ ∀ i, p i → (x, y) ∈ s i :=
specializes_iff_inseparable.symm.trans h.specializes_iff_uniformity
#align filter.has_basis.mem_separation_rel Filter.HasBasis.inseparable_iff_uniformity
theorem inseparable_iff_ker_uniformity {x y : α} : Inseparable x y ↔ (x, y) ∈ (𝓤 α).ker :=
(𝓤 α).basis_sets.inseparable_iff_uniformity
protected theorem Inseparable.nhds_le_uniformity {x y : α} (h : Inseparable x y) :
𝓝 (x, y) ≤ 𝓤 α := by
rw [h.prod rfl]
apply nhds_le_uniformity
| Mathlib/Topology/UniformSpace/Separation.lean | 142 | 146 | theorem inseparable_iff_clusterPt_uniformity {x y : α} :
Inseparable x y ↔ ClusterPt (x, y) (𝓤 α) := by |
refine ⟨fun h ↦ .of_nhds_le h.nhds_le_uniformity, fun h ↦ ?_⟩
simp_rw [uniformity_hasBasis_closed.inseparable_iff_uniformity, isClosed_iff_clusterPt]
exact fun U ⟨hU, hUc⟩ ↦ hUc _ <| h.mono <| le_principal_iff.2 hU
|
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section NormedAddCommGroup
variable (μ)
variable {f g : α → E}
noncomputable def average (f : α → E) :=
∫ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.average MeasureTheory.average
notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r
notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r
@[simp]
theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero]
#align measure_theory.average_zero MeasureTheory.average_zero
@[simp]
theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by
rw [average, smul_zero, integral_zero_measure]
#align measure_theory.average_zero_measure MeasureTheory.average_zero_measure
@[simp]
theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ :=
integral_neg f
#align measure_theory.average_neg MeasureTheory.average_neg
theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ :=
rfl
#align measure_theory.average_eq' MeasureTheory.average_eq'
theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by
rw [average_eq', integral_smul_measure, ENNReal.toReal_inv]
#align measure_theory.average_eq MeasureTheory.average_eq
theorem average_eq_integral [IsProbabilityMeasure μ] (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rw [average, measure_univ, inv_one, one_smul]
#align measure_theory.average_eq_integral MeasureTheory.average_eq_integral
@[simp]
theorem measure_smul_average [IsFiniteMeasure μ] (f : α → E) :
(μ univ).toReal • ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, integral_zero_measure, average_zero_measure, smul_zero]
· rw [average_eq, smul_inv_smul₀]
refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne'
rwa [Ne, measure_univ_eq_zero]
#align measure_theory.measure_smul_average MeasureTheory.measure_smul_average
theorem setAverage_eq (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ x in s, f x ∂μ := by rw [average_eq, restrict_apply_univ]
#align measure_theory.set_average_eq MeasureTheory.setAverage_eq
| Mathlib/MeasureTheory/Integral/Average.lean | 354 | 356 | theorem setAverage_eq' (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = ∫ x, f x ∂(μ s)⁻¹ • μ.restrict s := by |
simp only [average_eq', restrict_apply_univ]
|
import Mathlib.CategoryTheory.Preadditive.InjectiveResolution
import Mathlib.Algebra.Homology.HomotopyCategory
import Mathlib.Data.Set.Subsingleton
import Mathlib.Tactic.AdaptationNote
#align_import category_theory.abelian.injective_resolution from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open CategoryTheory Category Limits
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C]
open Injective
namespace InjectiveResolution
set_option linter.uppercaseLean3 false -- `InjectiveResolution`
section
variable [HasZeroObject C] [HasZeroMorphisms C]
def descFZero {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y) (J : InjectiveResolution Z) :
J.cocomplex.X 0 ⟶ I.cocomplex.X 0 :=
factorThru (f ≫ I.ι.f 0) (J.ι.f 0)
#align category_theory.InjectiveResolution.desc_f_zero CategoryTheory.InjectiveResolution.descFZero
end
section Abelian
variable [Abelian C]
lemma exact₀ {Z : C} (I : InjectiveResolution Z) :
(ShortComplex.mk _ _ I.ι_f_zero_comp_complex_d).Exact :=
ShortComplex.exact_of_f_is_kernel _ I.isLimitKernelFork
def descFOne {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y) (J : InjectiveResolution Z) :
J.cocomplex.X 1 ⟶ I.cocomplex.X 1 :=
J.exact₀.descToInjective (descFZero f I J ≫ I.cocomplex.d 0 1)
(by dsimp; simp [← assoc, assoc, descFZero])
#align category_theory.InjectiveResolution.desc_f_one CategoryTheory.InjectiveResolution.descFOne
@[simp]
| Mathlib/CategoryTheory/Abelian/InjectiveResolution.lean | 76 | 79 | theorem descFOne_zero_comm {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y)
(J : InjectiveResolution Z) :
J.cocomplex.d 0 1 ≫ descFOne f I J = descFZero f I J ≫ I.cocomplex.d 0 1 := by |
apply J.exact₀.comp_descToInjective
|
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Topology.Algebra.InfiniteSum.Order
import Mathlib.Topology.Instances.Real
import Mathlib.Topology.Instances.ENNReal
#align_import topology.algebra.infinite_sum.real from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
open Filter Finset NNReal Topology
variable {α β : Type*} [PseudoMetricSpace α] {f : ℕ → α} {a : α}
theorem cauchySeq_of_dist_le_of_summable (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) : CauchySeq f := by
lift d to ℕ → ℝ≥0 using fun n ↦ dist_nonneg.trans (hf n)
apply cauchySeq_of_edist_le_of_summable d (α := α) (f := f)
· exact_mod_cast hf
· exact_mod_cast hd
#align cauchy_seq_of_dist_le_of_summable cauchySeq_of_dist_le_of_summable
theorem cauchySeq_of_summable_dist (h : Summable fun n ↦ dist (f n) (f n.succ)) : CauchySeq f :=
cauchySeq_of_dist_le_of_summable _ (fun _ ↦ le_rfl) h
#align cauchy_seq_of_summable_dist cauchySeq_of_summable_dist
theorem dist_le_tsum_of_dist_le_of_tendsto (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) {a : α} (ha : Tendsto f atTop (𝓝 a)) (n : ℕ) :
dist (f n) a ≤ ∑' m, d (n + m) := by
refine le_of_tendsto (tendsto_const_nhds.dist ha) (eventually_atTop.2 ⟨n, fun m hnm ↦ ?_⟩)
refine le_trans (dist_le_Ico_sum_of_dist_le hnm fun _ _ ↦ hf _) ?_
rw [sum_Ico_eq_sum_range]
refine sum_le_tsum (range _) (fun _ _ ↦ le_trans dist_nonneg (hf _)) ?_
exact hd.comp_injective (add_right_injective n)
#align dist_le_tsum_of_dist_le_of_tendsto dist_le_tsum_of_dist_le_of_tendsto
| Mathlib/Topology/Algebra/InfiniteSum/Real.lean | 49 | 51 | theorem dist_le_tsum_of_dist_le_of_tendsto₀ (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) (ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ tsum d := by |
simpa only [zero_add] using dist_le_tsum_of_dist_le_of_tendsto d hf hd ha 0
|
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {𝕜 E : Type*} [LinearOrderedField 𝕜] [TopologicalSpace E]
[AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : 𝕜) • a + (1 / 2 : 𝕜) • c = b := by
rwa [← smul_add, one_div, inv_smul_eq_iff₀ (show (2 : 𝕜) ≠ 0 by norm_num), two_smul]
have :=
hs₁.eq (hs₀.frontier_subset ha) (hs₀.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, ← add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
· rw [sphere_zero]
exact threeAPFree_singleton _
· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {α β : Type*} {n d k N : ℕ} {x : Fin n → ℕ}
def box (n d : ℕ) : Finset (Fin n → ℕ) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x ∈ box n d ↔ ∀ i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = ∅ := by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : ℕ) : Finset (Fin n → ℕ) :=
(box n d).filter fun x => ∑ i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 ⊆ 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
theorem sphere_zero_right (n k : ℕ) : sphere (n + 1) 0 k = ∅ := by simp [sphere]
#align behrend.sphere_zero_right Behrend.sphere_zero_right
theorem sphere_subset_box : sphere n d k ⊆ box n d :=
filter_subset _ _
#align behrend.sphere_subset_box Behrend.sphere_subset_box
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 125 | 129 | theorem norm_of_mem_sphere {x : Fin n → ℕ} (hx : x ∈ sphere n d k) :
‖(WithLp.equiv 2 _).symm ((↑) ∘ x : Fin n → ℝ)‖ = √↑k := by |
rw [EuclideanSpace.norm_eq]
dsimp
simp_rw [abs_cast, ← cast_pow, ← cast_sum, (mem_filter.1 hx).2]
|
import Mathlib.Data.Fintype.Card
import Mathlib.Data.List.MinMax
import Mathlib.Data.Nat.Order.Lemmas
import Mathlib.Logic.Encodable.Basic
#align_import logic.denumerable from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
variable {α β : Type*}
class Denumerable (α : Type*) extends Encodable α where
decode_inv : ∀ n, ∃ a ∈ decode n, encode a = n
#align denumerable Denumerable
open Nat
namespace Denumerable
section
variable [Denumerable α] [Denumerable β]
open Encodable
theorem decode_isSome (α) [Denumerable α] (n : ℕ) : (decode (α := α) n).isSome :=
Option.isSome_iff_exists.2 <| (decode_inv n).imp fun _ => And.left
#align denumerable.decode_is_some Denumerable.decode_isSome
def ofNat (α) [Denumerable α] (n : ℕ) : α :=
Option.get _ (decode_isSome α n)
#align denumerable.of_nat Denumerable.ofNat
@[simp]
theorem decode_eq_ofNat (α) [Denumerable α] (n : ℕ) : decode (α := α) n = some (ofNat α n) :=
Option.eq_some_of_isSome _
#align denumerable.decode_eq_of_nat Denumerable.decode_eq_ofNat
@[simp]
theorem ofNat_of_decode {n b} (h : decode (α := α) n = some b) : ofNat (α := α) n = b :=
Option.some.inj <| (decode_eq_ofNat _ _).symm.trans h
#align denumerable.of_nat_of_decode Denumerable.ofNat_of_decode
@[simp]
| Mathlib/Logic/Denumerable.lean | 65 | 67 | theorem encode_ofNat (n) : encode (ofNat α n) = n := by |
obtain ⟨a, h, e⟩ := decode_inv (α := α) n
rwa [ofNat_of_decode h]
|
import Mathlib.Algebra.ContinuedFractions.Computation.Approximations
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Data.Rat.Floor
#align_import algebra.continued_fractions.computation.terminates_iff_rat from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
variable {K : Type*} [LinearOrderedField K] [FloorRing K]
attribute [local simp] Pair.map IntFractPair.mapFr
section RatOfTerminates
variable (v : K) (n : ℕ)
nonrec theorem exists_gcf_pair_rat_eq_of_nth_conts_aux :
∃ conts : Pair ℚ, (of v).continuantsAux n = (conts.map (↑) : Pair K) :=
Nat.strong_induction_on n
(by
clear n
let g := of v
intro n IH
rcases n with (_ | _ | n)
-- n = 0
· suffices ∃ gp : Pair ℚ, Pair.mk (1 : K) 0 = gp.map (↑) by simpa [continuantsAux]
use Pair.mk 1 0
simp
-- n = 1
· suffices ∃ conts : Pair ℚ, Pair.mk g.h 1 = conts.map (↑) by simpa [continuantsAux]
use Pair.mk ⌊v⌋ 1
simp [g]
-- 2 ≤ n
· cases' IH (n + 1) <| lt_add_one (n + 1) with pred_conts pred_conts_eq
-- invoke the IH
cases' s_ppred_nth_eq : g.s.get? n with gp_n
-- option.none
· use pred_conts
have : g.continuantsAux (n + 2) = g.continuantsAux (n + 1) :=
continuantsAux_stable_of_terminated (n + 1).le_succ s_ppred_nth_eq
simp only [this, pred_conts_eq]
-- option.some
· -- invoke the IH a second time
cases' IH n <| lt_of_le_of_lt n.le_succ <| lt_add_one <| n + 1 with ppred_conts
ppred_conts_eq
obtain ⟨a_eq_one, z, b_eq_z⟩ : gp_n.a = 1 ∧ ∃ z : ℤ, gp_n.b = (z : K) :=
of_part_num_eq_one_and_exists_int_part_denom_eq s_ppred_nth_eq
-- finally, unfold the recurrence to obtain the required rational value.
simp only [a_eq_one, b_eq_z,
continuantsAux_recurrence s_ppred_nth_eq ppred_conts_eq pred_conts_eq]
use nextContinuants 1 (z : ℚ) ppred_conts pred_conts
cases ppred_conts; cases pred_conts
simp [nextContinuants, nextNumerator, nextDenominator])
#align generalized_continued_fraction.exists_gcf_pair_rat_eq_of_nth_conts_aux GeneralizedContinuedFraction.exists_gcf_pair_rat_eq_of_nth_conts_aux
theorem exists_gcf_pair_rat_eq_nth_conts :
∃ conts : Pair ℚ, (of v).continuants n = (conts.map (↑) : Pair K) := by
rw [nth_cont_eq_succ_nth_cont_aux]; exact exists_gcf_pair_rat_eq_of_nth_conts_aux v <| n + 1
#align generalized_continued_fraction.exists_gcf_pair_rat_eq_nth_conts GeneralizedContinuedFraction.exists_gcf_pair_rat_eq_nth_conts
theorem exists_rat_eq_nth_numerator : ∃ q : ℚ, (of v).numerators n = (q : K) := by
rcases exists_gcf_pair_rat_eq_nth_conts v n with ⟨⟨a, _⟩, nth_cont_eq⟩
use a
simp [num_eq_conts_a, nth_cont_eq]
#align generalized_continued_fraction.exists_rat_eq_nth_numerator GeneralizedContinuedFraction.exists_rat_eq_nth_numerator
| Mathlib/Algebra/ContinuedFractions/Computation/TerminatesIffRat.lean | 112 | 115 | theorem exists_rat_eq_nth_denominator : ∃ q : ℚ, (of v).denominators n = (q : K) := by |
rcases exists_gcf_pair_rat_eq_nth_conts v n with ⟨⟨_, b⟩, nth_cont_eq⟩
use b
simp [denom_eq_conts_b, nth_cont_eq]
|
import Mathlib.Analysis.Calculus.LineDeriv.Measurable
import Mathlib.Analysis.NormedSpace.FiniteDimension
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.Analysis.BoundedVariation
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.Analysis.Distribution.AEEqOfIntegralContDiff
import Mathlib.MeasureTheory.Measure.Haar.Disintegration
open Filter MeasureTheory Measure FiniteDimensional Metric Set Asymptotics
open scoped NNReal ENNReal Topology
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] {C D : ℝ≥0} {f g : E → ℝ} {s : Set E}
{μ : Measure E} [IsAddHaarMeasure μ]
namespace LipschitzWith
theorem ae_lineDifferentiableAt (hf : LipschitzWith C f) (v : E) :
∀ᵐ p ∂μ, LineDifferentiableAt ℝ f p v := by
let L : ℝ →L[ℝ] E := ContinuousLinearMap.smulRight (1 : ℝ →L[ℝ] ℝ) v
suffices A : ∀ p, ∀ᵐ (t : ℝ) ∂volume, LineDifferentiableAt ℝ f (p + t • v) v from
ae_mem_of_ae_add_linearMap_mem L.toLinearMap volume μ
(measurableSet_lineDifferentiableAt hf.continuous) A
intro p
have : ∀ᵐ (s : ℝ), DifferentiableAt ℝ (fun t ↦ f (p + t • v)) s :=
(hf.comp ((LipschitzWith.const p).add L.lipschitz)).ae_differentiableAt_real
filter_upwards [this] with s hs
have h's : DifferentiableAt ℝ (fun t ↦ f (p + t • v)) (s + 0) := by simpa using hs
have : DifferentiableAt ℝ (fun t ↦ s + t) 0 := differentiableAt_id.const_add _
simp only [LineDifferentiableAt]
convert h's.comp 0 this with _ t
simp only [LineDifferentiableAt, add_assoc, Function.comp_apply, add_smul]
theorem memℒp_lineDeriv (hf : LipschitzWith C f) (v : E) :
Memℒp (fun x ↦ lineDeriv ℝ f x v) ∞ μ :=
memℒp_top_of_bound (aestronglyMeasurable_lineDeriv hf.continuous μ)
(C * ‖v‖) (eventually_of_forall (fun _x ↦ norm_lineDeriv_le_of_lipschitz ℝ hf))
theorem locallyIntegrable_lineDeriv (hf : LipschitzWith C f) (v : E) :
LocallyIntegrable (fun x ↦ lineDeriv ℝ f x v) μ :=
(hf.memℒp_lineDeriv v).locallyIntegrable le_top
| Mathlib/Analysis/Calculus/Rademacher.lean | 97 | 117 | theorem integral_inv_smul_sub_mul_tendsto_integral_lineDeriv_mul
(hf : LipschitzWith C f) (hg : Integrable g μ) (v : E) :
Tendsto (fun (t : ℝ) ↦ ∫ x, (t⁻¹ • (f (x + t • v) - f x)) * g x ∂μ) (𝓝[>] 0)
(𝓝 (∫ x, lineDeriv ℝ f x v * g x ∂μ)) := by |
apply tendsto_integral_filter_of_dominated_convergence (fun x ↦ (C * ‖v‖) * ‖g x‖)
· filter_upwards with t
apply AEStronglyMeasurable.mul ?_ hg.aestronglyMeasurable
apply aestronglyMeasurable_const.smul
apply AEStronglyMeasurable.sub _ hf.continuous.measurable.aestronglyMeasurable
apply AEMeasurable.aestronglyMeasurable
exact hf.continuous.measurable.comp_aemeasurable' (aemeasurable_id'.add_const _)
· filter_upwards [self_mem_nhdsWithin] with t (ht : 0 < t)
filter_upwards with x
calc ‖t⁻¹ • (f (x + t • v) - f x) * g x‖
= (t⁻¹ * ‖f (x + t • v) - f x‖) * ‖g x‖ := by simp [norm_mul, ht.le]
_ ≤ (t⁻¹ * (C * ‖(x + t • v) - x‖)) * ‖g x‖ := by
gcongr; exact LipschitzWith.norm_sub_le hf (x + t • v) x
_ = (C * ‖v‖) *‖g x‖ := by field_simp [norm_smul, abs_of_nonneg ht.le]; ring
· exact hg.norm.const_mul _
· filter_upwards [hf.ae_lineDifferentiableAt v] with x hx
exact hx.hasLineDerivAt.tendsto_slope_zero_right.mul tendsto_const_nhds
|
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Dynamics.BirkhoffSum.Average
open Function Set Filter
open scoped Topology ENNReal Uniformity
section
variable {α E : Type*}
theorem Function.IsFixedPt.tendsto_birkhoffAverage
(R : Type*) [DivisionSemiring R] [CharZero R]
[AddCommMonoid E] [TopologicalSpace E] [Module R E]
{f : α → α} {x : α} (h : f.IsFixedPt x) (g : α → E) :
Tendsto (birkhoffAverage R f g · x) atTop (𝓝 (g x)) :=
tendsto_const_nhds.congr' <| (eventually_ne_atTop 0).mono fun _n hn ↦
(h.birkhoffAverage_eq R g hn).symm
variable [NormedAddCommGroup E]
theorem dist_birkhoffSum_apply_birkhoffSum (f : α → α) (g : α → E) (n : ℕ) (x : α) :
dist (birkhoffSum f g n (f x)) (birkhoffSum f g n x) = dist (g (f^[n] x)) (g x) := by
simp only [dist_eq_norm, birkhoffSum_apply_sub_birkhoffSum]
theorem dist_birkhoffSum_birkhoffSum_le (f : α → α) (g : α → E) (n : ℕ) (x y : α) :
dist (birkhoffSum f g n x) (birkhoffSum f g n y) ≤
∑ k ∈ Finset.range n, dist (g (f^[k] x)) (g (f^[k] y)) :=
dist_sum_sum_le _ _ _
variable (𝕜 : Type*) [RCLike 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E]
theorem dist_birkhoffAverage_birkhoffAverage (f : α → α) (g : α → E) (n : ℕ) (x y : α) :
dist (birkhoffAverage 𝕜 f g n x) (birkhoffAverage 𝕜 f g n y) =
dist (birkhoffSum f g n x) (birkhoffSum f g n y) / n := by
simp [birkhoffAverage, dist_smul₀, div_eq_inv_mul]
theorem dist_birkhoffAverage_birkhoffAverage_le (f : α → α) (g : α → E) (n : ℕ) (x y : α) :
dist (birkhoffAverage 𝕜 f g n x) (birkhoffAverage 𝕜 f g n y) ≤
(∑ k ∈ Finset.range n, dist (g (f^[k] x)) (g (f^[k] y))) / n :=
(dist_birkhoffAverage_birkhoffAverage _ _ _ _ _ _).trans_le <| by
gcongr; apply dist_birkhoffSum_birkhoffSum_le
theorem dist_birkhoffAverage_apply_birkhoffAverage (f : α → α) (g : α → E) (n : ℕ) (x : α) :
dist (birkhoffAverage 𝕜 f g n (f x)) (birkhoffAverage 𝕜 f g n x) =
dist (g (f^[n] x)) (g x) / n := by
simp [dist_birkhoffAverage_birkhoffAverage, dist_birkhoffSum_apply_birkhoffSum]
theorem tendsto_birkhoffAverage_apply_sub_birkhoffAverage {f : α → α} {g : α → E} {x : α}
(h : Bornology.IsBounded (range (g <| f^[·] x))) :
Tendsto (fun n ↦ birkhoffAverage 𝕜 f g n (f x) - birkhoffAverage 𝕜 f g n x) atTop (𝓝 0) := by
rcases Metric.isBounded_range_iff.1 h with ⟨C, hC⟩
have : Tendsto (fun n : ℕ ↦ C / n) atTop (𝓝 0) :=
tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop
refine squeeze_zero_norm (fun n ↦ ?_) this
rw [← dist_eq_norm, dist_birkhoffAverage_apply_birkhoffAverage]
gcongr
exact hC n 0
theorem tendsto_birkhoffAverage_apply_sub_birkhoffAverage' {g : α → E}
(h : Bornology.IsBounded (range g)) (f : α → α) (x : α):
Tendsto (fun n ↦ birkhoffAverage 𝕜 f g n (f x) - birkhoffAverage 𝕜 f g n x) atTop (𝓝 0) :=
tendsto_birkhoffAverage_apply_sub_birkhoffAverage _ <| h.subset <| range_comp_subset_range _ _
end
variable (𝕜 : Type*) {X E : Type*}
[PseudoEMetricSpace X] [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
{f : X → X} {g : X → E} {l : X → E}
| Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean | 106 | 122 | theorem uniformEquicontinuous_birkhoffAverage (hf : LipschitzWith 1 f) (hg : UniformContinuous g) :
UniformEquicontinuous (birkhoffAverage 𝕜 f g) := by |
refine Metric.uniformity_basis_dist_le.uniformEquicontinuous_iff_right.2 fun ε hε ↦ ?_
rcases (uniformity_basis_edist_le.uniformContinuous_iff Metric.uniformity_basis_dist_le).1 hg ε hε
with ⟨δ, hδ₀, hδε⟩
refine mem_uniformity_edist.2 ⟨δ, hδ₀, fun {x y} h n ↦ ?_⟩
calc
dist (birkhoffAverage 𝕜 f g n x) (birkhoffAverage 𝕜 f g n y)
≤ (∑ k ∈ Finset.range n, dist (g (f^[k] x)) (g (f^[k] y))) / n :=
dist_birkhoffAverage_birkhoffAverage_le ..
_ ≤ (∑ _k ∈ Finset.range n, ε) / n := by
gcongr
refine hδε _ _ ?_
simpa using (hf.iterate _).edist_le_mul_of_le h.le
_ = n * ε / n := by simp
_ ≤ ε := by
rcases eq_or_ne n 0 with hn | hn <;> field_simp [hn, hε.le, mul_div_cancel_left₀]
|
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
| Mathlib/Init/Data/Bool/Lemmas.lean | 54 | 54 | theorem eq_false_eq_not_eq_true (b : Bool) : (¬b = true) = (b = false) := by | simp
|
import Mathlib.Analysis.NormedSpace.AddTorsor
import Mathlib.LinearAlgebra.AffineSpace.Ordered
import Mathlib.Topology.ContinuousFunction.Basic
import Mathlib.Topology.GDelta
import Mathlib.Analysis.NormedSpace.FunctionSeries
import Mathlib.Analysis.SpecificLimits.Basic
#align_import topology.urysohns_lemma from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {X : Type*} [TopologicalSpace X]
open Set Filter TopologicalSpace Topology Filter
open scoped Pointwise
namespace Urysohns
set_option linter.uppercaseLean3 false
structure CU {X : Type*} [TopologicalSpace X] (P : Set X → Prop) where
protected C : Set X
protected U : Set X
protected P_C : P C
protected closed_C : IsClosed C
protected open_U : IsOpen U
protected subset : C ⊆ U
protected hP : ∀ {c u : Set X}, IsClosed c → P c → IsOpen u → c ⊆ u →
∃ v, IsOpen v ∧ c ⊆ v ∧ closure v ⊆ u ∧ P (closure v)
#align urysohns.CU Urysohns.CU
namespace CU
variable {P : Set X → Prop}
@[simps C]
def left (c : CU P) : CU P where
C := c.C
U := (c.hP c.closed_C c.P_C c.open_U c.subset).choose
closed_C := c.closed_C
P_C := c.P_C
open_U := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.1
subset := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.2.1
hP := c.hP
#align urysohns.CU.left Urysohns.CU.left
@[simps U]
def right (c : CU P) : CU P where
C := closure (c.hP c.closed_C c.P_C c.open_U c.subset).choose
U := c.U
closed_C := isClosed_closure
P_C := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.2.2.2
open_U := c.open_U
subset := (c.hP c.closed_C c.P_C c.open_U c.subset).choose_spec.2.2.1
hP := c.hP
#align urysohns.CU.right Urysohns.CU.right
theorem left_U_subset_right_C (c : CU P) : c.left.U ⊆ c.right.C :=
subset_closure
#align urysohns.CU.left_U_subset_right_C Urysohns.CU.left_U_subset_right_C
theorem left_U_subset (c : CU P) : c.left.U ⊆ c.U :=
Subset.trans c.left_U_subset_right_C c.right.subset
#align urysohns.CU.left_U_subset Urysohns.CU.left_U_subset
theorem subset_right_C (c : CU P) : c.C ⊆ c.right.C :=
Subset.trans c.left.subset c.left_U_subset_right_C
#align urysohns.CU.subset_right_C Urysohns.CU.subset_right_C
noncomputable def approx : ℕ → CU P → X → ℝ
| 0, c, x => indicator c.Uᶜ 1 x
| n + 1, c, x => midpoint ℝ (approx n c.left x) (approx n c.right x)
#align urysohns.CU.approx Urysohns.CU.approx
theorem approx_of_mem_C (c : CU P) (n : ℕ) {x : X} (hx : x ∈ c.C) : c.approx n x = 0 := by
induction' n with n ihn generalizing c
· exact indicator_of_not_mem (fun (hU : x ∈ c.Uᶜ) => hU <| c.subset hx) _
· simp only [approx]
rw [ihn, ihn, midpoint_self]
exacts [c.subset_right_C hx, hx]
#align urysohns.CU.approx_of_mem_C Urysohns.CU.approx_of_mem_C
theorem approx_of_nmem_U (c : CU P) (n : ℕ) {x : X} (hx : x ∉ c.U) : c.approx n x = 1 := by
induction' n with n ihn generalizing c
· rw [← mem_compl_iff] at hx
exact indicator_of_mem hx _
· simp only [approx]
rw [ihn, ihn, midpoint_self]
exacts [hx, fun hU => hx <| c.left_U_subset hU]
#align urysohns.CU.approx_of_nmem_U Urysohns.CU.approx_of_nmem_U
theorem approx_nonneg (c : CU P) (n : ℕ) (x : X) : 0 ≤ c.approx n x := by
induction' n with n ihn generalizing c
· exact indicator_nonneg (fun _ _ => zero_le_one) _
· simp only [approx, midpoint_eq_smul_add, invOf_eq_inv]
refine mul_nonneg (inv_nonneg.2 zero_le_two) (add_nonneg ?_ ?_) <;> apply ihn
#align urysohns.CU.approx_nonneg Urysohns.CU.approx_nonneg
| Mathlib/Topology/UrysohnsLemma.lean | 185 | 192 | theorem approx_le_one (c : CU P) (n : ℕ) (x : X) : c.approx n x ≤ 1 := by |
induction' n with n ihn generalizing c
· exact indicator_apply_le' (fun _ => le_rfl) fun _ => zero_le_one
· simp only [approx, midpoint_eq_smul_add, invOf_eq_inv, smul_eq_mul, ← div_eq_inv_mul]
have := add_le_add (ihn (left c)) (ihn (right c))
set_option tactic.skipAssignedInstances false in
norm_num at this
exact Iff.mpr (div_le_one zero_lt_two) this
|
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Algebra.LinearRecurrence
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.Prime
#align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open Polynomial
abbrev goldenRatio : ℝ := (1 + √5) / 2
#align golden_ratio goldenRatio
abbrev goldenConj : ℝ := (1 - √5) / 2
#align golden_conj goldenConj
@[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio
@[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj
open Real goldenRatio
theorem inv_gold : φ⁻¹ = -ψ := by
have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
field_simp [sub_mul, mul_add]
norm_num
#align inv_gold inv_gold
theorem inv_goldConj : ψ⁻¹ = -φ := by
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
exact inv_gold.symm
#align inv_gold_conj inv_goldConj
@[simp]
theorem gold_mul_goldConj : φ * ψ = -1 := by
field_simp
rw [← sq_sub_sq]
norm_num
#align gold_mul_gold_conj gold_mul_goldConj
@[simp]
theorem goldConj_mul_gold : ψ * φ = -1 := by
rw [mul_comm]
exact gold_mul_goldConj
#align gold_conj_mul_gold goldConj_mul_gold
@[simp]
theorem gold_add_goldConj : φ + ψ = 1 := by
rw [goldenRatio, goldenConj]
ring
#align gold_add_gold_conj gold_add_goldConj
theorem one_sub_goldConj : 1 - φ = ψ := by
linarith [gold_add_goldConj]
#align one_sub_gold_conj one_sub_goldConj
theorem one_sub_gold : 1 - ψ = φ := by
linarith [gold_add_goldConj]
#align one_sub_gold one_sub_gold
@[simp]
theorem gold_sub_goldConj : φ - ψ = √5 := by ring
#align gold_sub_gold_conj gold_sub_goldConj
theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2) - φ ^ (n + 1) = φ ^ n := by
rw [goldenRatio]; ring_nf; norm_num; ring
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
rw [goldenRatio, ← sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_sq gold_sq
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
rw [goldenConj, ← sub_eq_zero]
ring_nf
rw [Real.sq_sqrt] <;> norm_num
#align gold_conj_sq goldConj_sq
theorem gold_pos : 0 < φ :=
mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two
#align gold_pos gold_pos
theorem gold_ne_zero : φ ≠ 0 :=
ne_of_gt gold_pos
#align gold_ne_zero gold_ne_zero
theorem one_lt_gold : 1 < φ := by
refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos)
simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow`
#align one_lt_gold one_lt_gold
theorem gold_lt_two : φ < 2 := by calc
(1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num
_ = 2 := by norm_num
| Mathlib/Data/Real/GoldenRatio.lean | 121 | 122 | theorem goldConj_neg : ψ < 0 := by |
linarith [one_sub_goldConj, one_lt_gold]
|
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
#align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Filter Metric Set
open scoped ComplexConjugate Real Topology
namespace Complex
variable {a x z : ℂ}
noncomputable def arg (x : ℂ) : ℝ :=
if 0 ≤ x.re then Real.arcsin (x.im / abs x)
else if 0 ≤ x.im then Real.arcsin ((-x).im / abs x) + π else Real.arcsin ((-x).im / abs x) - π
#align complex.arg Complex.arg
| Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean | 33 | 37 | theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by |
unfold arg; split_ifs <;>
simp [sub_eq_add_neg, arg,
Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2,
Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg]
|
import Mathlib.Geometry.Manifold.ChartedSpace
#align_import geometry.manifold.local_invariant_properties from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db"
noncomputable section
open scoped Classical
open Manifold Topology
open Set Filter TopologicalSpace
variable {H M H' M' X : Type*}
variable [TopologicalSpace H] [TopologicalSpace M] [ChartedSpace H M]
variable [TopologicalSpace H'] [TopologicalSpace M'] [ChartedSpace H' M']
variable [TopologicalSpace X]
namespace StructureGroupoid
variable (G : StructureGroupoid H) (G' : StructureGroupoid H')
structure LocalInvariantProp (P : (H → H') → Set H → H → Prop) : Prop where
is_local : ∀ {s x u} {f : H → H'}, IsOpen u → x ∈ u → (P f s x ↔ P f (s ∩ u) x)
right_invariance' : ∀ {s x f} {e : PartialHomeomorph H H},
e ∈ G → x ∈ e.source → P f s x → P (f ∘ e.symm) (e.symm ⁻¹' s) (e x)
congr_of_forall : ∀ {s x} {f g : H → H'}, (∀ y ∈ s, f y = g y) → f x = g x → P f s x → P g s x
left_invariance' : ∀ {s x f} {e' : PartialHomeomorph H' H'},
e' ∈ G' → s ⊆ f ⁻¹' e'.source → f x ∈ e'.source → P f s x → P (e' ∘ f) s x
#align structure_groupoid.local_invariant_prop StructureGroupoid.LocalInvariantProp
variable {G G'} {P : (H → H') → Set H → H → Prop} {s t u : Set H} {x : H}
variable (hG : G.LocalInvariantProp G' P)
section LocalStructomorph
variable (G)
open PartialHomeomorph
def IsLocalStructomorphWithinAt (f : H → H) (s : Set H) (x : H) : Prop :=
x ∈ s → ∃ e : PartialHomeomorph H H, e ∈ G ∧ EqOn f e.toFun (s ∩ e.source) ∧ x ∈ e.source
#align structure_groupoid.is_local_structomorph_within_at StructureGroupoid.IsLocalStructomorphWithinAt
theorem isLocalStructomorphWithinAt_localInvariantProp [ClosedUnderRestriction G] :
LocalInvariantProp G G (IsLocalStructomorphWithinAt G) :=
{ is_local := by
intro s x u f hu hux
constructor
· rintro h hx
rcases h hx.1 with ⟨e, heG, hef, hex⟩
have : s ∩ u ∩ e.source ⊆ s ∩ e.source := by mfld_set_tac
exact ⟨e, heG, hef.mono this, hex⟩
· rintro h hx
rcases h ⟨hx, hux⟩ with ⟨e, heG, hef, hex⟩
refine ⟨e.restr (interior u), ?_, ?_, ?_⟩
· exact closedUnderRestriction' heG isOpen_interior
· have : s ∩ u ∩ e.source = s ∩ (e.source ∩ u) := by mfld_set_tac
simpa only [this, interior_interior, hu.interior_eq, mfld_simps] using hef
· simp only [*, interior_interior, hu.interior_eq, mfld_simps]
right_invariance' := by
intro s x f e' he'G he'x h hx
have hxs : x ∈ s := by simpa only [e'.left_inv he'x, mfld_simps] using hx
rcases h hxs with ⟨e, heG, hef, hex⟩
refine ⟨e'.symm.trans e, G.trans (G.symm he'G) heG, ?_, ?_⟩
· intro y hy
simp only [mfld_simps] at hy
simp only [hef ⟨hy.1, hy.2.2⟩, mfld_simps]
· simp only [hex, he'x, mfld_simps]
congr_of_forall := by
intro s x f g hfgs _ h hx
rcases h hx with ⟨e, heG, hef, hex⟩
refine ⟨e, heG, ?_, hex⟩
intro y hy
rw [← hef hy, hfgs y hy.1]
left_invariance' := by
intro s x f e' he'G _ hfx h hx
rcases h hx with ⟨e, heG, hef, hex⟩
refine ⟨e.trans e', G.trans heG he'G, ?_, ?_⟩
· intro y hy
simp only [mfld_simps] at hy
simp only [hef ⟨hy.1, hy.2.1⟩, mfld_simps]
· simpa only [hex, hef ⟨hx, hex⟩, mfld_simps] using hfx }
#align structure_groupoid.is_local_structomorph_within_at_local_invariant_prop StructureGroupoid.isLocalStructomorphWithinAt_localInvariantProp
| Mathlib/Geometry/Manifold/LocalInvariantProperties.lean | 648 | 666 | theorem _root_.PartialHomeomorph.isLocalStructomorphWithinAt_iff {G : StructureGroupoid H}
[ClosedUnderRestriction G] (f : PartialHomeomorph H H) {s : Set H} {x : H}
(hx : x ∈ f.source ∪ sᶜ) :
G.IsLocalStructomorphWithinAt (⇑f) s x ↔
x ∈ s → ∃ e : PartialHomeomorph H H,
e ∈ G ∧ e.source ⊆ f.source ∧ EqOn f (⇑e) (s ∩ e.source) ∧ x ∈ e.source := by |
constructor
· intro hf h2x
obtain ⟨e, he, hfe, hxe⟩ := hf h2x
refine ⟨e.restr f.source, closedUnderRestriction' he f.open_source, ?_, ?_, hxe, ?_⟩
· simp_rw [PartialHomeomorph.restr_source]
exact inter_subset_right.trans interior_subset
· intro x' hx'
exact hfe ⟨hx'.1, hx'.2.1⟩
· rw [f.open_source.interior_eq]
exact Or.resolve_right hx (not_not.mpr h2x)
· intro hf hx
obtain ⟨e, he, _, hfe, hxe⟩ := hf hx
exact ⟨e, he, hfe, hxe⟩
|
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Ideal
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.localization.submodule from "leanprover-community/mathlib"@"1ebb20602a8caef435ce47f6373e1aa40851a177"
variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S]
variable [Algebra R S] {P : Type*} [CommRing P]
namespace IsLocalization
-- This was previously a `hasCoe` instance, but if `S = R` then this will loop.
-- It could be a `hasCoeT` instance, but we keep it explicit here to avoid slowing down
-- the rest of the library.
def coeSubmodule (I : Ideal R) : Submodule R S :=
Submodule.map (Algebra.linearMap R S) I
#align is_localization.coe_submodule IsLocalization.coeSubmodule
theorem mem_coeSubmodule (I : Ideal R) {x : S} :
x ∈ coeSubmodule S I ↔ ∃ y : R, y ∈ I ∧ algebraMap R S y = x :=
Iff.rfl
#align is_localization.mem_coe_submodule IsLocalization.mem_coeSubmodule
theorem coeSubmodule_mono {I J : Ideal R} (h : I ≤ J) : coeSubmodule S I ≤ coeSubmodule S J :=
Submodule.map_mono h
#align is_localization.coe_submodule_mono IsLocalization.coeSubmodule_mono
@[simp]
theorem coeSubmodule_bot : coeSubmodule S (⊥ : Ideal R) = ⊥ := by
rw [coeSubmodule, Submodule.map_bot]
#align is_localization.coe_submodule_bot IsLocalization.coeSubmodule_bot
@[simp]
theorem coeSubmodule_top : coeSubmodule S (⊤ : Ideal R) = 1 := by
rw [coeSubmodule, Submodule.map_top, Submodule.one_eq_range]
#align is_localization.coe_submodule_top IsLocalization.coeSubmodule_top
@[simp]
theorem coeSubmodule_sup (I J : Ideal R) :
coeSubmodule S (I ⊔ J) = coeSubmodule S I ⊔ coeSubmodule S J :=
Submodule.map_sup _ _ _
#align is_localization.coe_submodule_sup IsLocalization.coeSubmodule_sup
@[simp]
theorem coeSubmodule_mul (I J : Ideal R) :
coeSubmodule S (I * J) = coeSubmodule S I * coeSubmodule S J :=
Submodule.map_mul _ _ (Algebra.ofId R S)
#align is_localization.coe_submodule_mul IsLocalization.coeSubmodule_mul
theorem coeSubmodule_fg (hS : Function.Injective (algebraMap R S)) (I : Ideal R) :
Submodule.FG (coeSubmodule S I) ↔ Submodule.FG I :=
⟨Submodule.fg_of_fg_map _ (LinearMap.ker_eq_bot.mpr hS), Submodule.FG.map _⟩
#align is_localization.coe_submodule_fg IsLocalization.coeSubmodule_fg
@[simp]
| Mathlib/RingTheory/Localization/Submodule.lean | 75 | 78 | theorem coeSubmodule_span (s : Set R) :
coeSubmodule S (Ideal.span s) = Submodule.span R (algebraMap R S '' s) := by |
rw [IsLocalization.coeSubmodule, Ideal.span, Submodule.map_span]
rfl
|
import Mathlib.CategoryTheory.Comma.StructuredArrow
import Mathlib.CategoryTheory.PUnit
import Mathlib.CategoryTheory.Functor.ReflectsIso
import Mathlib.CategoryTheory.Functor.EpiMono
#align_import category_theory.over from "leanprover-community/mathlib"@"8a318021995877a44630c898d0b2bc376fceef3b"
namespace CategoryTheory
universe v₁ v₂ u₁ u₂
-- morphism levels before object levels. See note [CategoryTheory universes].
variable {T : Type u₁} [Category.{v₁} T]
def Over (X : T) :=
CostructuredArrow (𝟭 T) X
#align category_theory.over CategoryTheory.Over
instance (X : T) : Category (Over X) := commaCategory
-- Satisfying the inhabited linter
instance Over.inhabited [Inhabited T] : Inhabited (Over (default : T)) where
default :=
{ left := default
right := default
hom := 𝟙 _ }
#align category_theory.over.inhabited CategoryTheory.Over.inhabited
namespace Over
variable {X : T}
@[ext]
theorem OverMorphism.ext {X : T} {U V : Over X} {f g : U ⟶ V} (h : f.left = g.left) : f = g := by
let ⟨_,b,_⟩ := f
let ⟨_,e,_⟩ := g
congr
simp only [eq_iff_true_of_subsingleton]
#align category_theory.over.over_morphism.ext CategoryTheory.Over.OverMorphism.ext
-- @[simp] : Porting note (#10618): simp can prove this
theorem over_right (U : Over X) : U.right = ⟨⟨⟩⟩ := by simp only
#align category_theory.over.over_right CategoryTheory.Over.over_right
@[simp]
theorem id_left (U : Over X) : CommaMorphism.left (𝟙 U) = 𝟙 U.left :=
rfl
#align category_theory.over.id_left CategoryTheory.Over.id_left
@[simp]
theorem comp_left (a b c : Over X) (f : a ⟶ b) (g : b ⟶ c) : (f ≫ g).left = f.left ≫ g.left :=
rfl
#align category_theory.over.comp_left CategoryTheory.Over.comp_left
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Comma/Over.lean | 81 | 81 | theorem w {A B : Over X} (f : A ⟶ B) : f.left ≫ B.hom = A.hom := by | have := f.w; aesop_cat
|
import Mathlib.Algebra.Lie.Nilpotent
import Mathlib.Algebra.Lie.Normalizer
#align_import algebra.lie.cartan_subalgebra from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102"
universe u v w w₁ w₂
variable {R : Type u} {L : Type v}
variable [CommRing R] [LieRing L] [LieAlgebra R L] (H : LieSubalgebra R L)
def LieSubmodule.IsUcsLimit {M : Type*} [AddCommGroup M] [Module R M] [LieRingModule L M]
[LieModule R L M] (N : LieSubmodule R L M) : Prop :=
∃ k, ∀ l, k ≤ l → (⊥ : LieSubmodule R L M).ucs l = N
#align lie_submodule.is_ucs_limit LieSubmodule.IsUcsLimit
namespace LieSubalgebra
class IsCartanSubalgebra : Prop where
nilpotent : LieAlgebra.IsNilpotent R H
self_normalizing : H.normalizer = H
#align lie_subalgebra.is_cartan_subalgebra LieSubalgebra.IsCartanSubalgebra
instance [H.IsCartanSubalgebra] : LieAlgebra.IsNilpotent R H :=
IsCartanSubalgebra.nilpotent
@[simp]
theorem normalizer_eq_self_of_isCartanSubalgebra (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
H.toLieSubmodule.normalizer = H.toLieSubmodule := by
rw [← LieSubmodule.coe_toSubmodule_eq_iff, coe_normalizer_eq_normalizer,
IsCartanSubalgebra.self_normalizing, coe_toLieSubmodule]
#align lie_subalgebra.normalizer_eq_self_of_is_cartan_subalgebra LieSubalgebra.normalizer_eq_self_of_isCartanSubalgebra
@[simp]
| Mathlib/Algebra/Lie/CartanSubalgebra.lean | 65 | 69 | theorem ucs_eq_self_of_isCartanSubalgebra (H : LieSubalgebra R L) [H.IsCartanSubalgebra] (k : ℕ) :
H.toLieSubmodule.ucs k = H.toLieSubmodule := by |
induction' k with k ih
· simp
· simp [ih]
|
import Mathlib.RingTheory.Valuation.Basic
import Mathlib.NumberTheory.Padics.PadicNorm
import Mathlib.Analysis.Normed.Field.Basic
#align_import number_theory.padics.padic_numbers from "leanprover-community/mathlib"@"b9b2114f7711fec1c1e055d507f082f8ceb2c3b7"
noncomputable section
open scoped Classical
open Nat multiplicity padicNorm CauSeq CauSeq.Completion Metric
abbrev PadicSeq (p : ℕ) :=
CauSeq _ (padicNorm p)
#align padic_seq PadicSeq
namespace PadicSeq
section
variable {p : ℕ} [Fact p.Prime]
theorem stationary {f : CauSeq ℚ (padicNorm p)} (hf : ¬f ≈ 0) :
∃ N, ∀ m n, N ≤ m → N ≤ n → padicNorm p (f n) = padicNorm p (f m) :=
have : ∃ ε > 0, ∃ N1, ∀ j ≥ N1, ε ≤ padicNorm p (f j) :=
CauSeq.abv_pos_of_not_limZero <| not_limZero_of_not_congr_zero hf
let ⟨ε, hε, N1, hN1⟩ := this
let ⟨N2, hN2⟩ := CauSeq.cauchy₂ f hε
⟨max N1 N2, fun n m hn hm ↦ by
have : padicNorm p (f n - f m) < ε := hN2 _ (max_le_iff.1 hn).2 _ (max_le_iff.1 hm).2
have : padicNorm p (f n - f m) < padicNorm p (f n) :=
lt_of_lt_of_le this <| hN1 _ (max_le_iff.1 hn).1
have : padicNorm p (f n - f m) < max (padicNorm p (f n)) (padicNorm p (f m)) :=
lt_max_iff.2 (Or.inl this)
by_contra hne
rw [← padicNorm.neg (f m)] at hne
have hnam := add_eq_max_of_ne hne
rw [padicNorm.neg, max_comm] at hnam
rw [← hnam, sub_eq_add_neg, add_comm] at this
apply _root_.lt_irrefl _ this⟩
#align padic_seq.stationary PadicSeq.stationary
def stationaryPoint {f : PadicSeq p} (hf : ¬f ≈ 0) : ℕ :=
Classical.choose <| stationary hf
#align padic_seq.stationary_point PadicSeq.stationaryPoint
theorem stationaryPoint_spec {f : PadicSeq p} (hf : ¬f ≈ 0) :
∀ {m n},
stationaryPoint hf ≤ m → stationaryPoint hf ≤ n → padicNorm p (f n) = padicNorm p (f m) :=
@(Classical.choose_spec <| stationary hf)
#align padic_seq.stationary_point_spec PadicSeq.stationaryPoint_spec
def norm (f : PadicSeq p) : ℚ :=
if hf : f ≈ 0 then 0 else padicNorm p (f (stationaryPoint hf))
#align padic_seq.norm PadicSeq.norm
theorem norm_zero_iff (f : PadicSeq p) : f.norm = 0 ↔ f ≈ 0 := by
constructor
· intro h
by_contra hf
unfold norm at h
split_ifs at h
· contradiction
apply hf
intro ε hε
exists stationaryPoint hf
intro j hj
have heq := stationaryPoint_spec hf le_rfl hj
simpa [h, heq]
· intro h
simp [norm, h]
#align padic_seq.norm_zero_iff PadicSeq.norm_zero_iff
end
section Valuation
open CauSeq
variable {p : ℕ} [Fact p.Prime]
def valuation (f : PadicSeq p) : ℤ :=
if hf : f ≈ 0 then 0 else padicValRat p (f (stationaryPoint hf))
#align padic_seq.valuation PadicSeq.valuation
theorem norm_eq_pow_val {f : PadicSeq p} (hf : ¬f ≈ 0) : f.norm = (p : ℚ) ^ (-f.valuation : ℤ) := by
rw [norm, valuation, dif_neg hf, dif_neg hf, padicNorm, if_neg]
intro H
apply CauSeq.not_limZero_of_not_congr_zero hf
intro ε hε
use stationaryPoint hf
intro n hn
rw [stationaryPoint_spec hf le_rfl hn]
simpa [H] using hε
#align padic_seq.norm_eq_pow_val PadicSeq.norm_eq_pow_val
| Mathlib/NumberTheory/Padics/PadicNumbers.lean | 234 | 238 | theorem val_eq_iff_norm_eq {f g : PadicSeq p} (hf : ¬f ≈ 0) (hg : ¬g ≈ 0) :
f.valuation = g.valuation ↔ f.norm = g.norm := by |
rw [norm_eq_pow_val hf, norm_eq_pow_val hg, ← neg_inj, zpow_inj]
· exact mod_cast (Fact.out : p.Prime).pos
· exact mod_cast (Fact.out : p.Prime).ne_one
|
import Mathlib.MeasureTheory.Integral.IntervalIntegral
#align_import measure_theory.integral.layercake from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b"
noncomputable section
open scoped ENNReal MeasureTheory Topology
open Set MeasureTheory Filter Measure
namespace MeasureTheory
section
variable {α R : Type*} [MeasurableSpace α] (μ : Measure α) [LinearOrder R]
| Mathlib/MeasureTheory/Integral/Layercake.lean | 73 | 82 | theorem countable_meas_le_ne_meas_lt (g : α → R) :
{t : R | μ {a : α | t ≤ g a} ≠ μ {a : α | t < g a}}.Countable := by |
-- the target set is contained in the set of points where the function `t ↦ μ {a : α | t ≤ g a}`
-- jumps down on the right of `t`. This jump set is countable for any function.
let F : R → ℝ≥0∞ := fun t ↦ μ {a : α | t ≤ g a}
apply (countable_image_gt_image_Ioi F).mono
intro t ht
have : μ {a | t < g a} < μ {a | t ≤ g a} :=
lt_of_le_of_ne (measure_mono (fun a ha ↦ le_of_lt ha)) (Ne.symm ht)
exact ⟨μ {a | t < g a}, this, fun s hs ↦ measure_mono (fun a ha ↦ hs.trans_le ha)⟩
|
import Mathlib.LinearAlgebra.Span
import Mathlib.LinearAlgebra.BilinearMap
#align_import algebra.module.submodule.bilinear from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940"
universe uι u v
open Set
open Pointwise
namespace Submodule
variable {ι : Sort uι} {R M N P : Type*}
variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P]
variable [Module R M] [Module R N] [Module R P]
def map₂ (f : M →ₗ[R] N →ₗ[R] P) (p : Submodule R M) (q : Submodule R N) : Submodule R P :=
⨆ s : p, q.map (f s)
#align submodule.map₂ Submodule.map₂
theorem apply_mem_map₂ (f : M →ₗ[R] N →ₗ[R] P) {m : M} {n : N} {p : Submodule R M}
{q : Submodule R N} (hm : m ∈ p) (hn : n ∈ q) : f m n ∈ map₂ f p q :=
(le_iSup _ ⟨m, hm⟩ : _ ≤ map₂ f p q) ⟨n, hn, by rfl⟩
#align submodule.apply_mem_map₂ Submodule.apply_mem_map₂
theorem map₂_le {f : M →ₗ[R] N →ₗ[R] P} {p : Submodule R M} {q : Submodule R N}
{r : Submodule R P} : map₂ f p q ≤ r ↔ ∀ m ∈ p, ∀ n ∈ q, f m n ∈ r :=
⟨fun H _m hm _n hn => H <| apply_mem_map₂ _ hm hn, fun H =>
iSup_le fun ⟨m, hm⟩ => map_le_iff_le_comap.2 fun n hn => H m hm n hn⟩
#align submodule.map₂_le Submodule.map₂_le
variable (R)
| Mathlib/Algebra/Module/Submodule/Bilinear.lean | 59 | 73 | theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by |
apply le_antisymm
· rw [map₂_le]
apply @span_induction' R M _ _ _ s
intro a ha
apply @span_induction' R N _ _ _ t
intro b hb
exact subset_span ⟨_, ‹_›, _, ‹_›, rfl⟩
all_goals intros; simp only [*, add_mem, smul_mem, zero_mem, _root_.map_zero, map_add,
LinearMap.zero_apply, LinearMap.add_apply, LinearMap.smul_apply,
map_smul]
· rw [span_le, image2_subset_iff]
intro a ha b hb
exact apply_mem_map₂ _ (subset_span ha) (subset_span hb)
|
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section TypeclassesLeftLT
variable [LT α] [CovariantClass α α (· * ·) (· < ·)] {a b c : α}
@[to_additive (attr := simp) Left.neg_pos_iff "Uses `left` co(ntra)variant."]
theorem Left.one_lt_inv_iff : 1 < a⁻¹ ↔ a < 1 := by
rw [← mul_lt_mul_iff_left a, mul_inv_self, mul_one]
#align left.one_lt_inv_iff Left.one_lt_inv_iff
#align left.neg_pos_iff Left.neg_pos_iff
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
theorem Left.inv_lt_one_iff : a⁻¹ < 1 ↔ 1 < a := by
rw [← mul_lt_mul_iff_left a, mul_inv_self, mul_one]
#align left.inv_lt_one_iff Left.inv_lt_one_iff
#align left.neg_neg_iff Left.neg_neg_iff
@[to_additive (attr := simp)]
theorem lt_inv_mul_iff_mul_lt : b < a⁻¹ * c ↔ a * b < c := by
rw [← mul_lt_mul_iff_left a]
simp
#align lt_inv_mul_iff_mul_lt lt_inv_mul_iff_mul_lt
#align lt_neg_add_iff_add_lt lt_neg_add_iff_add_lt
@[to_additive (attr := simp)]
| Mathlib/Algebra/Order/Group/Defs.lean | 178 | 179 | theorem inv_mul_lt_iff_lt_mul : b⁻¹ * a < c ↔ a < b * c := by |
rw [← mul_lt_mul_iff_left b, mul_inv_cancel_left]
|
import Mathlib.Algebra.PUnitInstances
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Ring
import Mathlib.Order.Hom.Lattice
#align_import algebra.ring.boolean_ring from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped symmDiff
variable {α β γ : Type*}
class BooleanRing (α) extends Ring α where
mul_self : ∀ a : α, a * a = a
#align boolean_ring BooleanRing
section BooleanRing
variable [BooleanRing α] (a b : α)
instance : Std.IdempotentOp (α := α) (· * ·) :=
⟨BooleanRing.mul_self⟩
@[simp]
theorem mul_self : a * a = a :=
BooleanRing.mul_self _
#align mul_self mul_self
@[simp]
theorem add_self : a + a = 0 := by
have : a + a = a + a + (a + a) :=
calc
a + a = (a + a) * (a + a) := by rw [mul_self]
_ = a * a + a * a + (a * a + a * a) := by rw [add_mul, mul_add]
_ = a + a + (a + a) := by rw [mul_self]
rwa [self_eq_add_left] at this
#align add_self add_self
@[simp]
theorem neg_eq : -a = a :=
calc
-a = -a + 0 := by rw [add_zero]
_ = -a + -a + a := by rw [← neg_add_self, add_assoc]
_ = a := by rw [add_self, zero_add]
#align neg_eq neg_eq
theorem add_eq_zero' : a + b = 0 ↔ a = b :=
calc
a + b = 0 ↔ a = -b := add_eq_zero_iff_eq_neg
_ ↔ a = b := by rw [neg_eq]
#align add_eq_zero' add_eq_zero'
@[simp]
theorem mul_add_mul : a * b + b * a = 0 := by
have : a + b = a + b + (a * b + b * a) :=
calc
a + b = (a + b) * (a + b) := by rw [mul_self]
_ = a * a + a * b + (b * a + b * b) := by rw [add_mul, mul_add, mul_add]
_ = a + a * b + (b * a + b) := by simp only [mul_self]
_ = a + b + (a * b + b * a) := by abel
rwa [self_eq_add_right] at this
#align mul_add_mul mul_add_mul
@[simp]
theorem sub_eq_add : a - b = a + b := by rw [sub_eq_add_neg, add_right_inj, neg_eq]
#align sub_eq_add sub_eq_add
@[simp]
| Mathlib/Algebra/Ring/BooleanRing.lean | 105 | 105 | theorem mul_one_add_self : a * (1 + a) = 0 := by | rw [mul_add, mul_one, mul_self, add_self]
|
import Mathlib.Data.Fintype.Option
import Mathlib.Topology.Separation
import Mathlib.Topology.Sets.Opens
#align_import topology.alexandroff from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Set Filter Topology
variable {X : Type*}
def OnePoint (X : Type*) :=
Option X
#align alexandroff OnePoint
instance [Repr X] : Repr (OnePoint X) :=
⟨fun o _ =>
match o with
| none => "∞"
| some a => "↑" ++ repr a⟩
namespace OnePoint
@[match_pattern] def infty : OnePoint X := none
#align alexandroff.infty OnePoint.infty
@[inherit_doc]
scoped notation "∞" => OnePoint.infty
@[coe, match_pattern] def some : X → OnePoint X := Option.some
instance : CoeTC X (OnePoint X) := ⟨some⟩
instance : Inhabited (OnePoint X) := ⟨∞⟩
instance [Fintype X] : Fintype (OnePoint X) :=
inferInstanceAs (Fintype (Option X))
instance infinite [Infinite X] : Infinite (OnePoint X) :=
inferInstanceAs (Infinite (Option X))
#align alexandroff.infinite OnePoint.infinite
theorem coe_injective : Function.Injective ((↑) : X → OnePoint X) :=
Option.some_injective X
#align alexandroff.coe_injective OnePoint.coe_injective
@[norm_cast]
theorem coe_eq_coe {x y : X} : (x : OnePoint X) = y ↔ x = y :=
coe_injective.eq_iff
#align alexandroff.coe_eq_coe OnePoint.coe_eq_coe
@[simp]
theorem coe_ne_infty (x : X) : (x : OnePoint X) ≠ ∞ :=
nofun
#align alexandroff.coe_ne_infty OnePoint.coe_ne_infty
@[simp]
theorem infty_ne_coe (x : X) : ∞ ≠ (x : OnePoint X) :=
nofun
#align alexandroff.infty_ne_coe OnePoint.infty_ne_coe
@[elab_as_elim]
protected def rec {C : OnePoint X → Sort*} (h₁ : C ∞) (h₂ : ∀ x : X, C x) :
∀ z : OnePoint X, C z
| ∞ => h₁
| (x : X) => h₂ x
#align alexandroff.rec OnePoint.rec
theorem isCompl_range_coe_infty : IsCompl (range ((↑) : X → OnePoint X)) {∞} :=
isCompl_range_some_none X
#align alexandroff.is_compl_range_coe_infty OnePoint.isCompl_range_coe_infty
-- Porting note: moved @[simp] to a new lemma
theorem range_coe_union_infty : range ((↑) : X → OnePoint X) ∪ {∞} = univ :=
range_some_union_none X
#align alexandroff.range_coe_union_infty OnePoint.range_coe_union_infty
@[simp]
theorem insert_infty_range_coe : insert ∞ (range (@some X)) = univ :=
insert_none_range_some _
@[simp]
theorem range_coe_inter_infty : range ((↑) : X → OnePoint X) ∩ {∞} = ∅ :=
range_some_inter_none X
#align alexandroff.range_coe_inter_infty OnePoint.range_coe_inter_infty
@[simp]
theorem compl_range_coe : (range ((↑) : X → OnePoint X))ᶜ = {∞} :=
compl_range_some X
#align alexandroff.compl_range_coe OnePoint.compl_range_coe
theorem compl_infty : ({∞}ᶜ : Set (OnePoint X)) = range ((↑) : X → OnePoint X) :=
(@isCompl_range_coe_infty X).symm.compl_eq
#align alexandroff.compl_infty OnePoint.compl_infty
theorem compl_image_coe (s : Set X) : ((↑) '' s : Set (OnePoint X))ᶜ = (↑) '' sᶜ ∪ {∞} := by
rw [coe_injective.compl_image_eq, compl_range_coe]
#align alexandroff.compl_image_coe OnePoint.compl_image_coe
| Mathlib/Topology/Compactification/OnePoint.lean | 144 | 145 | theorem ne_infty_iff_exists {x : OnePoint X} : x ≠ ∞ ↔ ∃ y : X, (y : OnePoint X) = x := by |
induction x using OnePoint.rec <;> simp
|
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Combinatorics.SimpleGraph.Maps
open Finset
namespace SimpleGraph
variable {V : Type*} [DecidableEq V] (G : SimpleGraph V) (s t : V)
section ReplaceVertex
def replaceVertex : SimpleGraph V where
Adj v w := if v = t then if w = t then False else G.Adj s w
else if w = t then G.Adj v s else G.Adj v w
symm v w := by dsimp only; split_ifs <;> simp [adj_comm]
lemma not_adj_replaceVertex_same : ¬(G.replaceVertex s t).Adj s t := by simp [replaceVertex]
@[simp] lemma replaceVertex_self : G.replaceVertex s s = G := by
ext; unfold replaceVertex; aesop (add simp or_iff_not_imp_left)
variable {t}
lemma adj_replaceVertex_iff_of_ne_left {w : V} (hw : w ≠ t) :
(G.replaceVertex s t).Adj s w ↔ G.Adj s w := by simp [replaceVertex, hw]
lemma adj_replaceVertex_iff_of_ne_right {w : V} (hw : w ≠ t) :
(G.replaceVertex s t).Adj t w ↔ G.Adj s w := by simp [replaceVertex, hw]
lemma adj_replaceVertex_iff_of_ne {v w : V} (hv : v ≠ t) (hw : w ≠ t) :
(G.replaceVertex s t).Adj v w ↔ G.Adj v w := by simp [replaceVertex, hv, hw]
variable {s}
theorem edgeSet_replaceVertex_of_not_adj (hn : ¬G.Adj s t) : (G.replaceVertex s t).edgeSet =
G.edgeSet \ G.incidenceSet t ∪ (s(·, t)) '' (G.neighborSet s) := by
ext e; refine e.inductionOn ?_
simp only [replaceVertex, mem_edgeSet, Set.mem_union, Set.mem_diff, mk'_mem_incidenceSet_iff]
intros; split_ifs; exacts [by simp_all, by aesop, by rw [adj_comm]; aesop, by aesop]
| Mathlib/Combinatorics/SimpleGraph/Operations.lean | 82 | 86 | theorem edgeSet_replaceVertex_of_adj (ha : G.Adj s t) : (G.replaceVertex s t).edgeSet =
(G.edgeSet \ G.incidenceSet t ∪ (s(·, t)) '' (G.neighborSet s)) \ {s(t, t)} := by |
ext e; refine e.inductionOn ?_
simp only [replaceVertex, mem_edgeSet, Set.mem_union, Set.mem_diff, mk'_mem_incidenceSet_iff]
intros; split_ifs; exacts [by simp_all, by aesop, by rw [adj_comm]; aesop, by aesop]
|
import Mathlib.Algebra.ContinuedFractions.Basic
import Mathlib.Algebra.GroupWithZero.Basic
#align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
section WithDivisionRing
variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : ℕ} [DivisionRing K]
theorem nth_cont_eq_succ_nth_cont_aux : g.continuants n = g.continuantsAux (n + 1) :=
rfl
#align generalized_continued_fraction.nth_cont_eq_succ_nth_cont_aux GeneralizedContinuedFraction.nth_cont_eq_succ_nth_cont_aux
theorem num_eq_conts_a : g.numerators n = (g.continuants n).a :=
rfl
#align generalized_continued_fraction.num_eq_conts_a GeneralizedContinuedFraction.num_eq_conts_a
theorem denom_eq_conts_b : g.denominators n = (g.continuants n).b :=
rfl
#align generalized_continued_fraction.denom_eq_conts_b GeneralizedContinuedFraction.denom_eq_conts_b
theorem convergent_eq_num_div_denom : g.convergents n = g.numerators n / g.denominators n :=
rfl
#align generalized_continued_fraction.convergent_eq_num_div_denom GeneralizedContinuedFraction.convergent_eq_num_div_denom
theorem convergent_eq_conts_a_div_conts_b :
g.convergents n = (g.continuants n).a / (g.continuants n).b :=
rfl
#align generalized_continued_fraction.convergent_eq_conts_a_div_conts_b GeneralizedContinuedFraction.convergent_eq_conts_a_div_conts_b
theorem exists_conts_a_of_num {A : K} (nth_num_eq : g.numerators n = A) :
∃ conts, g.continuants n = conts ∧ conts.a = A := by simpa
#align generalized_continued_fraction.exists_conts_a_of_num GeneralizedContinuedFraction.exists_conts_a_of_num
theorem exists_conts_b_of_denom {B : K} (nth_denom_eq : g.denominators n = B) :
∃ conts, g.continuants n = conts ∧ conts.b = B := by simpa
#align generalized_continued_fraction.exists_conts_b_of_denom GeneralizedContinuedFraction.exists_conts_b_of_denom
@[simp]
theorem zeroth_continuant_aux_eq_one_zero : g.continuantsAux 0 = ⟨1, 0⟩ :=
rfl
#align generalized_continued_fraction.zeroth_continuant_aux_eq_one_zero GeneralizedContinuedFraction.zeroth_continuant_aux_eq_one_zero
@[simp]
theorem first_continuant_aux_eq_h_one : g.continuantsAux 1 = ⟨g.h, 1⟩ :=
rfl
#align generalized_continued_fraction.first_continuant_aux_eq_h_one GeneralizedContinuedFraction.first_continuant_aux_eq_h_one
@[simp]
theorem zeroth_continuant_eq_h_one : g.continuants 0 = ⟨g.h, 1⟩ :=
rfl
#align generalized_continued_fraction.zeroth_continuant_eq_h_one GeneralizedContinuedFraction.zeroth_continuant_eq_h_one
@[simp]
theorem zeroth_numerator_eq_h : g.numerators 0 = g.h :=
rfl
#align generalized_continued_fraction.zeroth_numerator_eq_h GeneralizedContinuedFraction.zeroth_numerator_eq_h
@[simp]
theorem zeroth_denominator_eq_one : g.denominators 0 = 1 :=
rfl
#align generalized_continued_fraction.zeroth_denominator_eq_one GeneralizedContinuedFraction.zeroth_denominator_eq_one
@[simp]
theorem zeroth_convergent_eq_h : g.convergents 0 = g.h := by
simp [convergent_eq_num_div_denom, num_eq_conts_a, denom_eq_conts_b, div_one]
#align generalized_continued_fraction.zeroth_convergent_eq_h GeneralizedContinuedFraction.zeroth_convergent_eq_h
theorem second_continuant_aux_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.continuantsAux 2 = ⟨gp.b * g.h + gp.a, gp.b⟩ := by
simp [zeroth_s_eq, continuantsAux, nextContinuants, nextDenominator, nextNumerator]
#align generalized_continued_fraction.second_continuant_aux_eq GeneralizedContinuedFraction.second_continuant_aux_eq
theorem first_continuant_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.continuants 1 = ⟨gp.b * g.h + gp.a, gp.b⟩ := by
simp [nth_cont_eq_succ_nth_cont_aux]
-- Porting note (#10959): simp used to work here, but now it can't figure out that 1 + 1 = 2
convert second_continuant_aux_eq zeroth_s_eq
#align generalized_continued_fraction.first_continuant_eq GeneralizedContinuedFraction.first_continuant_eq
theorem first_numerator_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.numerators 1 = gp.b * g.h + gp.a := by simp [num_eq_conts_a, first_continuant_eq zeroth_s_eq]
#align generalized_continued_fraction.first_numerator_eq GeneralizedContinuedFraction.first_numerator_eq
theorem first_denominator_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) :
g.denominators 1 = gp.b := by simp [denom_eq_conts_b, first_continuant_eq zeroth_s_eq]
#align generalized_continued_fraction.first_denominator_eq GeneralizedContinuedFraction.first_denominator_eq
@[simp]
theorem zeroth_convergent'_aux_eq_zero {s : Stream'.Seq <| Pair K} :
convergents'Aux s 0 = (0 : K) :=
rfl
#align generalized_continued_fraction.zeroth_convergent'_aux_eq_zero GeneralizedContinuedFraction.zeroth_convergent'_aux_eq_zero
@[simp]
theorem zeroth_convergent'_eq_h : g.convergents' 0 = g.h := by simp [convergents']
#align generalized_continued_fraction.zeroth_convergent'_eq_h GeneralizedContinuedFraction.zeroth_convergent'_eq_h
| Mathlib/Algebra/ContinuedFractions/Translations.lean | 180 | 181 | theorem convergents'Aux_succ_none {s : Stream'.Seq (Pair K)} (h : s.head = none) (n : ℕ) :
convergents'Aux s (n + 1) = 0 := by | simp [convergents'Aux, h, convergents'Aux.match_1]
|
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.Asymptotics.Theta
import Mathlib.Analysis.Normed.Order.Basic
#align_import analysis.asymptotics.asymptotic_equivalent from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Asymptotics
open Filter Function
open Topology
section NormedAddCommGroup
variable {α β : Type*} [NormedAddCommGroup β]
def IsEquivalent (l : Filter α) (u v : α → β) :=
(u - v) =o[l] v
#align asymptotics.is_equivalent Asymptotics.IsEquivalent
@[inherit_doc] scoped notation:50 u " ~[" l:50 "] " v:50 => Asymptotics.IsEquivalent l u v
variable {u v w : α → β} {l : Filter α}
theorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v := h
#align asymptotics.is_equivalent.is_o Asymptotics.IsEquivalent.isLittleO
nonrec theorem IsEquivalent.isBigO (h : u ~[l] v) : u =O[l] v :=
(IsBigO.congr_of_sub h.isBigO.symm).mp (isBigO_refl _ _)
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O Asymptotics.IsEquivalent.isBigO
theorem IsEquivalent.isBigO_symm (h : u ~[l] v) : v =O[l] u := by
convert h.isLittleO.right_isBigO_add
simp
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O_symm Asymptotics.IsEquivalent.isBigO_symm
theorem IsEquivalent.isTheta (h : u ~[l] v) : u =Θ[l] v :=
⟨h.isBigO, h.isBigO_symm⟩
theorem IsEquivalent.isTheta_symm (h : u ~[l] v) : v =Θ[l] u :=
⟨h.isBigO_symm, h.isBigO⟩
@[refl]
theorem IsEquivalent.refl : u ~[l] u := by
rw [IsEquivalent, sub_self]
exact isLittleO_zero _ _
#align asymptotics.is_equivalent.refl Asymptotics.IsEquivalent.refl
@[symm]
theorem IsEquivalent.symm (h : u ~[l] v) : v ~[l] u :=
(h.isLittleO.trans_isBigO h.isBigO_symm).symm
#align asymptotics.is_equivalent.symm Asymptotics.IsEquivalent.symm
@[trans]
theorem IsEquivalent.trans {l : Filter α} {u v w : α → β} (huv : u ~[l] v) (hvw : v ~[l] w) :
u ~[l] w :=
(huv.isLittleO.trans_isBigO hvw.isBigO).triangle hvw.isLittleO
#align asymptotics.is_equivalent.trans Asymptotics.IsEquivalent.trans
theorem IsEquivalent.congr_left {u v w : α → β} {l : Filter α} (huv : u ~[l] v) (huw : u =ᶠ[l] w) :
w ~[l] v :=
huv.congr' (huw.sub (EventuallyEq.refl _ _)) (EventuallyEq.refl _ _)
#align asymptotics.is_equivalent.congr_left Asymptotics.IsEquivalent.congr_left
theorem IsEquivalent.congr_right {u v w : α → β} {l : Filter α} (huv : u ~[l] v) (hvw : v =ᶠ[l] w) :
u ~[l] w :=
(huv.symm.congr_left hvw).symm
#align asymptotics.is_equivalent.congr_right Asymptotics.IsEquivalent.congr_right
| Mathlib/Analysis/Asymptotics/AsymptoticEquivalent.lean | 128 | 130 | theorem isEquivalent_zero_iff_eventually_zero : u ~[l] 0 ↔ u =ᶠ[l] 0 := by |
rw [IsEquivalent, sub_zero]
exact isLittleO_zero_right_iff
|
import Mathlib.Algebra.MvPolynomial.Equiv
import Mathlib.Algebra.Polynomial.Eval
#align_import data.mv_polynomial.polynomial from "leanprover-community/mathlib"@"0b89934139d3be96f9dab477f10c20f9f93da580"
namespace MvPolynomial
variable {R S σ : Type*}
| Mathlib/Algebra/MvPolynomial/Polynomial.lean | 19 | 28 | theorem polynomial_eval_eval₂ [CommSemiring R] [CommSemiring S]
{x : S} (f : R →+* Polynomial S) (g : σ → Polynomial S) (p : MvPolynomial σ R) :
Polynomial.eval x (eval₂ f g p) =
eval₂ ((Polynomial.evalRingHom x).comp f) (fun s => Polynomial.eval x (g s)) p := by |
apply induction_on p
· simp
· intro p q hp hq
simp [hp, hq]
· intro p n hp
simp [hp]
|
import Mathlib.Data.Matrix.Kronecker
import Mathlib.LinearAlgebra.Matrix.ToLin
import Mathlib.LinearAlgebra.TensorProduct.Basis
#align_import linear_algebra.tensor_product.matrix from "leanprover-community/mathlib"@"f784cc6142443d9ee623a20788c282112c322081"
variable {R : Type*} {M N P M' N' : Type*} {ι κ τ ι' κ' : Type*}
variable [DecidableEq ι] [DecidableEq κ] [DecidableEq τ]
variable [Fintype ι] [Fintype κ] [Fintype τ] [Finite ι'] [Finite κ']
variable [CommRing R]
variable [AddCommGroup M] [AddCommGroup N] [AddCommGroup P]
variable [AddCommGroup M'] [AddCommGroup N']
variable [Module R M] [Module R N] [Module R P] [Module R M'] [Module R N']
variable (bM : Basis ι R M) (bN : Basis κ R N) (bP : Basis τ R P)
variable (bM' : Basis ι' R M') (bN' : Basis κ' R N')
open Kronecker
open Matrix LinearMap
theorem TensorProduct.toMatrix_map (f : M →ₗ[R] M') (g : N →ₗ[R] N') :
toMatrix (bM.tensorProduct bN) (bM'.tensorProduct bN') (TensorProduct.map f g) =
toMatrix bM bM' f ⊗ₖ toMatrix bN bN' g := by
ext ⟨i, j⟩ ⟨i', j'⟩
simp_rw [Matrix.kroneckerMap_apply, toMatrix_apply, Basis.tensorProduct_apply,
TensorProduct.map_tmul, Basis.tensorProduct_repr_tmul_apply]
#align tensor_product.to_matrix_map TensorProduct.toMatrix_map
| Mathlib/LinearAlgebra/TensorProduct/Matrix.lean | 49 | 53 | theorem Matrix.toLin_kronecker (A : Matrix ι' ι R) (B : Matrix κ' κ R) :
toLin (bM.tensorProduct bN) (bM'.tensorProduct bN') (A ⊗ₖ B) =
TensorProduct.map (toLin bM bM' A) (toLin bN bN' B) := by |
rw [← LinearEquiv.eq_symm_apply, toLin_symm, TensorProduct.toMatrix_map, toMatrix_toLin,
toMatrix_toLin]
|
import Mathlib.Algebra.Algebra.Defs
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Localization.Basic
import Mathlib.SetTheory.Game.Birthday
import Mathlib.SetTheory.Surreal.Basic
#align_import set_theory.surreal.dyadic from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
universe u
namespace SetTheory
namespace PGame
def powHalf : ℕ → PGame
| 0 => 1
| n + 1 => ⟨PUnit, PUnit, 0, fun _ => powHalf n⟩
#align pgame.pow_half SetTheory.PGame.powHalf
@[simp]
theorem powHalf_zero : powHalf 0 = 1 :=
rfl
#align pgame.pow_half_zero SetTheory.PGame.powHalf_zero
| Mathlib/SetTheory/Surreal/Dyadic.lean | 52 | 52 | theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by | cases n <;> rfl
|
import Mathlib.Data.Vector.Basic
import Mathlib.Data.Vector.Snoc
set_option autoImplicit true
namespace Vector
section Fold
section Unary
variable (xs : Vector α n) (f₁ : β → σ₁ → σ₁ × γ) (f₂ : α → σ₂ → σ₂ × β)
@[simp]
theorem mapAccumr_mapAccumr :
mapAccumr f₁ (mapAccumr f₂ xs s₂).snd s₁
= let m := (mapAccumr (fun x s =>
let r₂ := f₂ x s.snd
let r₁ := f₁ r₂.snd s.fst
((r₁.fst, r₂.fst), r₁.snd)
) xs (s₁, s₂))
(m.fst.fst, m.snd) := by
induction xs using Vector.revInductionOn generalizing s₁ s₂ <;> simp_all
@[simp]
| Mathlib/Data/Vector/MapLemmas.lean | 38 | 40 | theorem mapAccumr_map (f₂ : α → β) :
(mapAccumr f₁ (map f₂ xs) s) = (mapAccumr (fun x s => f₁ (f₂ x) s) xs s) := by |
induction xs using Vector.revInductionOn generalizing s <;> simp_all
|
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ι : Sort*} {α : Type*} (s : Set α)
section InfSet
variable [Preorder α] [InfSet α]
noncomputable def subsetInfSet [Inhabited s] : InfSet s where
sInf t :=
if ht : t.Nonempty ∧ BddBelow t ∧ sInf ((↑) '' t : Set α) ∈ s
then ⟨sInf ((↑) '' t : Set α), ht.2.2⟩
else default
#align subset_has_Inf subsetInfSet
attribute [local instance] subsetInfSet
@[simp]
theorem subset_sInf_def [Inhabited s] :
@sInf s _ = fun t =>
if ht : t.Nonempty ∧ BddBelow t ∧ sInf ((↑) '' t : Set α) ∈ s
then ⟨sInf ((↑) '' t : Set α), ht.2.2⟩ else
default :=
rfl
#align subset_Inf_def subset_sInf_def
theorem subset_sInf_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddBelow t) (h : sInf ((↑) '' t : Set α) ∈ s) :
sInf ((↑) '' t : Set α) = (@sInf s _ t : α) := by simp [dif_pos, h, h', h'']
#align subset_Inf_of_within subset_sInf_of_within
theorem subset_sInf_emptyset [Inhabited s] :
sInf (∅ : Set s) = default := by
simp [sInf]
| Mathlib/Order/CompleteLatticeIntervals.lean | 106 | 108 | theorem subset_sInf_of_not_bddBelow [Inhabited s] {t : Set s} (ht : ¬BddBelow t) :
sInf t = default := by |
simp [sInf, ht]
|
import Mathlib.CategoryTheory.Balanced
import Mathlib.CategoryTheory.Limits.EssentiallySmall
import Mathlib.CategoryTheory.Limits.Opposites
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Subobject.Lattice
import Mathlib.CategoryTheory.Subobject.WellPowered
import Mathlib.Data.Set.Opposite
import Mathlib.Data.Set.Subsingleton
#align_import category_theory.generator from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff"
universe w v₁ v₂ u₁ u₂
open CategoryTheory.Limits Opposite
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D]
def IsSeparating (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : G ⟶ X), h ≫ f = h ≫ g) → f = g
#align category_theory.is_separating CategoryTheory.IsSeparating
def IsCoseparating (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : Y ⟶ G), f ≫ h = g ≫ h) → f = g
#align category_theory.is_coseparating CategoryTheory.IsCoseparating
def IsDetecting (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : G ⟶ Y), ∃! h' : G ⟶ X, h' ≫ f = h) → IsIso f
#align category_theory.is_detecting CategoryTheory.IsDetecting
def IsCodetecting (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : X ⟶ G), ∃! h' : Y ⟶ G, f ≫ h' = h) → IsIso f
#align category_theory.is_codetecting CategoryTheory.IsCodetecting
section Dual
theorem isSeparating_op_iff (𝒢 : Set C) : IsSeparating 𝒢.op ↔ IsCoseparating 𝒢 := by
refine ⟨fun h𝒢 X Y f g hfg => ?_, fun h𝒢 X Y f g hfg => ?_⟩
· refine Quiver.Hom.op_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
· refine Quiver.Hom.unop_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_separating_op_iff CategoryTheory.isSeparating_op_iff
theorem isCoseparating_op_iff (𝒢 : Set C) : IsCoseparating 𝒢.op ↔ IsSeparating 𝒢 := by
refine ⟨fun h𝒢 X Y f g hfg => ?_, fun h𝒢 X Y f g hfg => ?_⟩
· refine Quiver.Hom.op_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
· refine Quiver.Hom.unop_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_coseparating_op_iff CategoryTheory.isCoseparating_op_iff
theorem isCoseparating_unop_iff (𝒢 : Set Cᵒᵖ) : IsCoseparating 𝒢.unop ↔ IsSeparating 𝒢 := by
rw [← isSeparating_op_iff, Set.unop_op]
#align category_theory.is_coseparating_unop_iff CategoryTheory.isCoseparating_unop_iff
theorem isSeparating_unop_iff (𝒢 : Set Cᵒᵖ) : IsSeparating 𝒢.unop ↔ IsCoseparating 𝒢 := by
rw [← isCoseparating_op_iff, Set.unop_op]
#align category_theory.is_separating_unop_iff CategoryTheory.isSeparating_unop_iff
| Mathlib/CategoryTheory/Generator.lean | 117 | 126 | theorem isDetecting_op_iff (𝒢 : Set C) : IsDetecting 𝒢.op ↔ IsCodetecting 𝒢 := by |
refine ⟨fun h𝒢 X Y f hf => ?_, fun h𝒢 X Y f hf => ?_⟩
· refine (isIso_op_iff _).1 (h𝒢 _ fun G hG h => ?_)
obtain ⟨t, ht, ht'⟩ := hf (unop G) (Set.mem_op.1 hG) h.unop
exact
⟨t.op, Quiver.Hom.unop_inj ht, fun y hy => Quiver.Hom.unop_inj (ht' _ (Quiver.Hom.op_inj hy))⟩
· refine (isIso_unop_iff _).1 (h𝒢 _ fun G hG h => ?_)
obtain ⟨t, ht, ht'⟩ := hf (op G) (Set.op_mem_op.2 hG) h.op
refine ⟨t.unop, Quiver.Hom.op_inj ht, fun y hy => Quiver.Hom.op_inj (ht' _ ?_)⟩
exact Quiver.Hom.unop_inj (by simpa only using hy)
|
import Mathlib.Analysis.SpecialFunctions.Complex.Arg
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Complex
open Set Filter Bornology
open scoped Real Topology ComplexConjugate
-- Porting note: @[pp_nodot] does not exist in mathlib4
noncomputable def log (x : ℂ) : ℂ :=
x.abs.log + arg x * I
#align complex.log Complex.log
theorem log_re (x : ℂ) : x.log.re = x.abs.log := by simp [log]
#align complex.log_re Complex.log_re
theorem log_im (x : ℂ) : x.log.im = x.arg := by simp [log]
#align complex.log_im Complex.log_im
theorem neg_pi_lt_log_im (x : ℂ) : -π < (log x).im := by simp only [log_im, neg_pi_lt_arg]
#align complex.neg_pi_lt_log_im Complex.neg_pi_lt_log_im
theorem log_im_le_pi (x : ℂ) : (log x).im ≤ π := by simp only [log_im, arg_le_pi]
#align complex.log_im_le_pi Complex.log_im_le_pi
theorem exp_log {x : ℂ} (hx : x ≠ 0) : exp (log x) = x := by
rw [log, exp_add_mul_I, ← ofReal_sin, sin_arg, ← ofReal_cos, cos_arg hx, ← ofReal_exp,
Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), ← mul_assoc,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im]
#align complex.exp_log Complex.exp_log
@[simp]
theorem range_exp : Set.range exp = {0}ᶜ :=
Set.ext fun x =>
⟨by
rintro ⟨x, rfl⟩
exact exp_ne_zero x, fun hx => ⟨log x, exp_log hx⟩⟩
#align complex.range_exp Complex.range_exp
theorem log_exp {x : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) : log (exp x) = x := by
rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, ← ofReal_exp,
arg_mul_cos_add_sin_mul_I (Real.exp_pos _) ⟨hx₁, hx₂⟩, re_add_im]
#align complex.log_exp Complex.log_exp
theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) (hy₁ : -π < y.im)
(hy₂ : y.im ≤ π) (hxy : exp x = exp y) : x = y := by
rw [← log_exp hx₁ hx₂, ← log_exp hy₁ hy₂, hxy]
#align complex.exp_inj_of_neg_pi_lt_of_le_pi Complex.exp_inj_of_neg_pi_lt_of_le_pi
theorem ofReal_log {x : ℝ} (hx : 0 ≤ x) : (x.log : ℂ) = log x :=
Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx])
(by rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx])
#align complex.of_real_log Complex.ofReal_log
@[simp, norm_cast]
lemma natCast_log {n : ℕ} : Real.log n = log n := ofReal_natCast n ▸ ofReal_log n.cast_nonneg
@[simp]
lemma ofNat_log {n : ℕ} [n.AtLeastTwo] :
Real.log (no_index (OfNat.ofNat n)) = log (OfNat.ofNat n) :=
natCast_log
theorem log_ofReal_re (x : ℝ) : (log (x : ℂ)).re = Real.log x := by simp [log_re]
#align complex.log_of_real_re Complex.log_ofReal_re
theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : ℂ} (hx : x ≠ 0) :
log (r * x) = Real.log r + log x := by
replace hx := Complex.abs.ne_zero_iff.mpr hx
simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx,
ofReal_add, add_assoc]
#align complex.log_of_real_mul Complex.log_ofReal_mul
theorem log_mul_ofReal (r : ℝ) (hr : 0 < r) (x : ℂ) (hx : x ≠ 0) :
log (x * r) = Real.log r + log x := by rw [mul_comm, log_ofReal_mul hr hx]
#align complex.log_mul_of_real Complex.log_mul_ofReal
lemma log_mul_eq_add_log_iff {x y : ℂ} (hx₀ : x ≠ 0) (hy₀ : y ≠ 0) :
log (x * y) = log x + log y ↔ arg x + arg y ∈ Set.Ioc (-π) π := by
refine ext_iff.trans <| Iff.trans ?_ <| arg_mul_eq_add_arg_iff hx₀ hy₀
simp_rw [add_re, add_im, log_re, log_im, AbsoluteValue.map_mul,
Real.log_mul (abs.ne_zero hx₀) (abs.ne_zero hy₀), true_and]
alias ⟨_, log_mul⟩ := log_mul_eq_add_log_iff
@[simp]
theorem log_zero : log 0 = 0 := by simp [log]
#align complex.log_zero Complex.log_zero
@[simp]
theorem log_one : log 1 = 0 := by simp [log]
#align complex.log_one Complex.log_one
theorem log_neg_one : log (-1) = π * I := by simp [log]
#align complex.log_neg_one Complex.log_neg_one
theorem log_I : log I = π / 2 * I := by simp [log]
set_option linter.uppercaseLean3 false in
#align complex.log_I Complex.log_I
| Mathlib/Analysis/SpecialFunctions/Complex/Log.lean | 120 | 120 | theorem log_neg_I : log (-I) = -(π / 2) * I := by | simp [log]
|
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.Asymptotics.Theta
import Mathlib.Analysis.Normed.Order.Basic
#align_import analysis.asymptotics.asymptotic_equivalent from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Asymptotics
open Filter Function
open Topology
section NormedAddCommGroup
variable {α β : Type*} [NormedAddCommGroup β]
def IsEquivalent (l : Filter α) (u v : α → β) :=
(u - v) =o[l] v
#align asymptotics.is_equivalent Asymptotics.IsEquivalent
@[inherit_doc] scoped notation:50 u " ~[" l:50 "] " v:50 => Asymptotics.IsEquivalent l u v
variable {u v w : α → β} {l : Filter α}
theorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v := h
#align asymptotics.is_equivalent.is_o Asymptotics.IsEquivalent.isLittleO
nonrec theorem IsEquivalent.isBigO (h : u ~[l] v) : u =O[l] v :=
(IsBigO.congr_of_sub h.isBigO.symm).mp (isBigO_refl _ _)
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O Asymptotics.IsEquivalent.isBigO
theorem IsEquivalent.isBigO_symm (h : u ~[l] v) : v =O[l] u := by
convert h.isLittleO.right_isBigO_add
simp
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O_symm Asymptotics.IsEquivalent.isBigO_symm
theorem IsEquivalent.isTheta (h : u ~[l] v) : u =Θ[l] v :=
⟨h.isBigO, h.isBigO_symm⟩
theorem IsEquivalent.isTheta_symm (h : u ~[l] v) : v =Θ[l] u :=
⟨h.isBigO_symm, h.isBigO⟩
@[refl]
theorem IsEquivalent.refl : u ~[l] u := by
rw [IsEquivalent, sub_self]
exact isLittleO_zero _ _
#align asymptotics.is_equivalent.refl Asymptotics.IsEquivalent.refl
@[symm]
theorem IsEquivalent.symm (h : u ~[l] v) : v ~[l] u :=
(h.isLittleO.trans_isBigO h.isBigO_symm).symm
#align asymptotics.is_equivalent.symm Asymptotics.IsEquivalent.symm
@[trans]
theorem IsEquivalent.trans {l : Filter α} {u v w : α → β} (huv : u ~[l] v) (hvw : v ~[l] w) :
u ~[l] w :=
(huv.isLittleO.trans_isBigO hvw.isBigO).triangle hvw.isLittleO
#align asymptotics.is_equivalent.trans Asymptotics.IsEquivalent.trans
theorem IsEquivalent.congr_left {u v w : α → β} {l : Filter α} (huv : u ~[l] v) (huw : u =ᶠ[l] w) :
w ~[l] v :=
huv.congr' (huw.sub (EventuallyEq.refl _ _)) (EventuallyEq.refl _ _)
#align asymptotics.is_equivalent.congr_left Asymptotics.IsEquivalent.congr_left
theorem IsEquivalent.congr_right {u v w : α → β} {l : Filter α} (huv : u ~[l] v) (hvw : v =ᶠ[l] w) :
u ~[l] w :=
(huv.symm.congr_left hvw).symm
#align asymptotics.is_equivalent.congr_right Asymptotics.IsEquivalent.congr_right
theorem isEquivalent_zero_iff_eventually_zero : u ~[l] 0 ↔ u =ᶠ[l] 0 := by
rw [IsEquivalent, sub_zero]
exact isLittleO_zero_right_iff
#align asymptotics.is_equivalent_zero_iff_eventually_zero Asymptotics.isEquivalent_zero_iff_eventually_zero
theorem isEquivalent_zero_iff_isBigO_zero : u ~[l] 0 ↔ u =O[l] (0 : α → β) := by
refine ⟨IsEquivalent.isBigO, fun h ↦ ?_⟩
rw [isEquivalent_zero_iff_eventually_zero, eventuallyEq_iff_exists_mem]
exact ⟨{ x : α | u x = 0 }, isBigO_zero_right_iff.mp h, fun x hx ↦ hx⟩
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent_zero_iff_is_O_zero Asymptotics.isEquivalent_zero_iff_isBigO_zero
theorem isEquivalent_const_iff_tendsto {c : β} (h : c ≠ 0) :
u ~[l] const _ c ↔ Tendsto u l (𝓝 c) := by
simp (config := { unfoldPartialApp := true }) only [IsEquivalent, const, isLittleO_const_iff h]
constructor <;> intro h
· have := h.sub (tendsto_const_nhds (x := -c))
simp only [Pi.sub_apply, sub_neg_eq_add, sub_add_cancel, zero_add] at this
exact this
· have := h.sub (tendsto_const_nhds (x := c))
rwa [sub_self] at this
#align asymptotics.is_equivalent_const_iff_tendsto Asymptotics.isEquivalent_const_iff_tendsto
| Mathlib/Analysis/Asymptotics/AsymptoticEquivalent.lean | 151 | 154 | theorem IsEquivalent.tendsto_const {c : β} (hu : u ~[l] const _ c) : Tendsto u l (𝓝 c) := by |
rcases em <| c = 0 with rfl | h
· exact (tendsto_congr' <| isEquivalent_zero_iff_eventually_zero.mp hu).mpr tendsto_const_nhds
· exact (isEquivalent_const_iff_tendsto h).mp hu
|
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.Adjugate
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import linear_algebra.matrix.nonsingular_inverse from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
namespace Matrix
universe u u' v
variable {l : Type*} {m : Type u} {n : Type u'} {α : Type v}
open Matrix Equiv Equiv.Perm Finset
section Invertible
variable [Fintype n] [DecidableEq n] [CommRing α]
variable (A : Matrix n n α) (B : Matrix n n α)
def invertibleOfDetInvertible [Invertible A.det] : Invertible A where
invOf := ⅟ A.det • A.adjugate
mul_invOf_self := by
rw [mul_smul_comm, mul_adjugate, smul_smul, invOf_mul_self, one_smul]
invOf_mul_self := by
rw [smul_mul_assoc, adjugate_mul, smul_smul, invOf_mul_self, one_smul]
#align matrix.invertible_of_det_invertible Matrix.invertibleOfDetInvertible
theorem invOf_eq [Invertible A.det] [Invertible A] : ⅟ A = ⅟ A.det • A.adjugate := by
letI := invertibleOfDetInvertible A
convert (rfl : ⅟ A = _)
#align matrix.inv_of_eq Matrix.invOf_eq
def detInvertibleOfLeftInverse (h : B * A = 1) : Invertible A.det where
invOf := B.det
mul_invOf_self := by rw [mul_comm, ← det_mul, h, det_one]
invOf_mul_self := by rw [← det_mul, h, det_one]
#align matrix.det_invertible_of_left_inverse Matrix.detInvertibleOfLeftInverse
def detInvertibleOfRightInverse (h : A * B = 1) : Invertible A.det where
invOf := B.det
mul_invOf_self := by rw [← det_mul, h, det_one]
invOf_mul_self := by rw [mul_comm, ← det_mul, h, det_one]
#align matrix.det_invertible_of_right_inverse Matrix.detInvertibleOfRightInverse
def detInvertibleOfInvertible [Invertible A] : Invertible A.det :=
detInvertibleOfLeftInverse A (⅟ A) (invOf_mul_self _)
#align matrix.det_invertible_of_invertible Matrix.detInvertibleOfInvertible
theorem det_invOf [Invertible A] [Invertible A.det] : (⅟ A).det = ⅟ A.det := by
letI := detInvertibleOfInvertible A
convert (rfl : _ = ⅟ A.det)
#align matrix.det_inv_of Matrix.det_invOf
@[simps]
def invertibleEquivDetInvertible : Invertible A ≃ Invertible A.det where
toFun := @detInvertibleOfInvertible _ _ _ _ _ A
invFun := @invertibleOfDetInvertible _ _ _ _ _ A
left_inv _ := Subsingleton.elim _ _
right_inv _ := Subsingleton.elim _ _
#align matrix.invertible_equiv_det_invertible Matrix.invertibleEquivDetInvertible
variable {A B}
| Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean | 120 | 129 | theorem mul_eq_one_comm : A * B = 1 ↔ B * A = 1 :=
suffices ∀ A B : Matrix n n α, A * B = 1 → B * A = 1 from ⟨this A B, this B A⟩
fun A B h => by
letI : Invertible B.det := detInvertibleOfLeftInverse _ _ h
letI : Invertible B := invertibleOfDetInvertible B
calc
B * A = B * A * (B * ⅟ B) := by | rw [mul_invOf_self, Matrix.mul_one]
_ = B * (A * B * ⅟ B) := by simp only [Matrix.mul_assoc]
_ = B * ⅟ B := by rw [h, Matrix.one_mul]
_ = 1 := mul_invOf_self B
|
import Mathlib.Analysis.NormedSpace.HahnBanach.Extension
import Mathlib.Analysis.NormedSpace.HahnBanach.Separation
import Mathlib.LinearAlgebra.Dual
import Mathlib.Analysis.NormedSpace.BoundedLinearMaps
@[mk_iff separatingDual_def]
class SeparatingDual (R V : Type*) [Ring R] [AddCommGroup V] [TopologicalSpace V]
[TopologicalSpace R] [Module R V] : Prop :=
exists_ne_zero' : ∀ (x : V), x ≠ 0 → ∃ f : V →L[R] R, f x ≠ 0
instance {E : Type*} [TopologicalSpace E] [AddCommGroup E] [TopologicalAddGroup E]
[Module ℝ E] [ContinuousSMul ℝ E] [LocallyConvexSpace ℝ E] [T1Space E] : SeparatingDual ℝ E :=
⟨fun x hx ↦ by
rcases geometric_hahn_banach_point_point hx.symm with ⟨f, hf⟩
simp only [map_zero] at hf
exact ⟨f, hf.ne'⟩⟩
instance {E 𝕜 : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] : SeparatingDual 𝕜 E :=
⟨fun x hx ↦ by
rcases exists_dual_vector 𝕜 x hx with ⟨f, -, hf⟩
refine ⟨f, ?_⟩
simpa [hf] using hx⟩
namespace SeparatingDual
section Field
variable {R V : Type*} [Field R] [AddCommGroup V] [TopologicalSpace R] [TopologicalSpace V]
[TopologicalRing R] [TopologicalAddGroup V] [Module R V] [SeparatingDual R V]
-- TODO (@alreadydone): this could generalize to CommRing R if we were to add a section
| Mathlib/Analysis/NormedSpace/HahnBanach/SeparatingDual.lean | 80 | 85 | theorem _root_.separatingDual_iff_injective : SeparatingDual R V ↔
Function.Injective (ContinuousLinearMap.coeLM (R := R) R (M := V) (N₃ := R)).flip := by |
simp_rw [separatingDual_def, Ne, injective_iff_map_eq_zero]
congrm ∀ v, ?_
rw [not_imp_comm, LinearMap.ext_iff]
push_neg; rfl
|
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots
import Mathlib.FieldTheory.Finite.Trace
import Mathlib.Algebra.Group.AddChar
import Mathlib.Data.ZMod.Units
import Mathlib.Analysis.Complex.Polynomial
#align_import number_theory.legendre_symbol.add_character from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472"
universe u v
namespace AddChar
section Additive
-- The domain and target of our additive characters. Now we restrict to a ring in the domain.
variable {R : Type u} [CommRing R] {R' : Type v} [CommMonoid R']
lemma val_mem_rootsOfUnity (φ : AddChar R R') (a : R) (h : 0 < ringChar R) :
(φ.val_isUnit a).unit ∈ rootsOfUnity (ringChar R).toPNat' R' := by
simp only [mem_rootsOfUnity', IsUnit.unit_spec, Nat.toPNat'_coe, h, ↓reduceIte,
← map_nsmul_eq_pow, nsmul_eq_mul, CharP.cast_eq_zero, zero_mul, map_zero_eq_one]
def IsPrimitive (ψ : AddChar R R') : Prop :=
∀ a : R, a ≠ 0 → IsNontrivial (mulShift ψ a)
#align add_char.is_primitive AddChar.IsPrimitive
lemma IsPrimitive.compMulHom_of_isPrimitive {R'' : Type*} [CommMonoid R''] {φ : AddChar R R'}
{f : R' →* R''} (hφ : φ.IsPrimitive) (hf : Function.Injective f) :
(f.compAddChar φ).IsPrimitive := by
intro a a_ne_zero
obtain ⟨r, ne_one⟩ := hφ a a_ne_zero
rw [mulShift_apply] at ne_one
simp only [IsNontrivial, mulShift_apply, f.coe_compAddChar, Function.comp_apply]
exact ⟨r, fun H ↦ ne_one <| hf <| f.map_one ▸ H⟩
theorem to_mulShift_inj_of_isPrimitive {ψ : AddChar R R'} (hψ : IsPrimitive ψ) :
Function.Injective ψ.mulShift := by
intro a b h
apply_fun fun x => x * mulShift ψ (-b) at h
simp only [mulShift_mul, mulShift_zero, add_right_neg] at h
have h₂ := hψ (a + -b)
rw [h, isNontrivial_iff_ne_trivial, ← sub_eq_add_neg, sub_ne_zero] at h₂
exact not_not.mp fun h => h₂ h rfl
#align add_char.to_mul_shift_inj_of_is_primitive AddChar.to_mulShift_inj_of_isPrimitive
-- `AddCommGroup.equiv_direct_sum_zmod_of_fintype`
-- gives the structure theorem for finite abelian groups.
-- This could be used to show that the map above is a bijection.
-- We leave this for a later occasion.
theorem IsNontrivial.isPrimitive {F : Type u} [Field F] {ψ : AddChar F R'} (hψ : IsNontrivial ψ) :
IsPrimitive ψ := by
intro a ha
cases' hψ with x h
use a⁻¹ * x
rwa [mulShift_apply, mul_inv_cancel_left₀ ha]
#align add_char.is_nontrivial.is_primitive AddChar.IsNontrivial.isPrimitive
lemma not_isPrimitive_mulShift [Finite R] (e : AddChar R R') {r : R}
(hr : ¬ IsUnit r) : ¬ IsPrimitive (e.mulShift r) := by
simp only [IsPrimitive, not_forall]
simp only [isUnit_iff_mem_nonZeroDivisors_of_finite, mem_nonZeroDivisors_iff, not_forall] at hr
rcases hr with ⟨x, h, h'⟩
exact ⟨x, h', by simp only [mulShift_mulShift, mul_comm r, h, mulShift_zero, not_ne_iff,
isNontrivial_iff_ne_trivial]⟩
-- Porting note(#5171): this linter isn't ported yet.
-- can't prove that they always exist (referring to providing an `Inhabited` instance)
-- @[nolint has_nonempty_instance]
structure PrimitiveAddChar (R : Type u) [CommRing R] (R' : Type v) [Field R'] where
n : ℕ+
char : AddChar R (CyclotomicField n R')
prim : IsPrimitive char
#align add_char.primitive_add_char AddChar.PrimitiveAddChar
#align add_char.primitive_add_char.n AddChar.PrimitiveAddChar.n
#align add_char.primitive_add_char.char AddChar.PrimitiveAddChar.char
#align add_char.primitive_add_char.prim AddChar.PrimitiveAddChar.prim
section ZModChar
variable {C : Type v} [CommMonoid C]
theorem zmod_char_isNontrivial_iff (n : ℕ+) (ψ : AddChar (ZMod n) C) :
IsNontrivial ψ ↔ ψ 1 ≠ 1 := by
refine ⟨?_, fun h => ⟨1, h⟩⟩
contrapose!
rintro h₁ ⟨a, ha⟩
have ha₁ : a = a.val • (1 : ZMod ↑n) := by
rw [nsmul_eq_mul, mul_one]; exact (ZMod.natCast_zmod_val a).symm
rw [ha₁, map_nsmul_eq_pow, h₁, one_pow] at ha
exact ha rfl
#align add_char.zmod_char_is_nontrivial_iff AddChar.zmod_char_isNontrivial_iff
| Mathlib/NumberTheory/LegendreSymbol/AddCharacter.lean | 189 | 192 | theorem IsPrimitive.zmod_char_eq_one_iff (n : ℕ+) {ψ : AddChar (ZMod n) C} (hψ : IsPrimitive ψ)
(a : ZMod n) : ψ a = 1 ↔ a = 0 := by |
refine ⟨fun h => not_imp_comm.mp (hψ a) ?_, fun ha => by rw [ha, map_zero_eq_one]⟩
rw [zmod_char_isNontrivial_iff n (mulShift ψ a), mulShift_apply, mul_one, h, Classical.not_not]
|
import Mathlib.CategoryTheory.Sites.Coherent.ReflectsPreregular
import Mathlib.Topology.Category.CompHaus.EffectiveEpi
import Mathlib.Topology.Category.Profinite.Limits
import Mathlib.Topology.Category.Stonean.Basic
universe u
attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike
open CategoryTheory Limits
namespace Profinite
noncomputable
def struct {B X : Profinite.{u}} (π : X ⟶ B) (hπ : Function.Surjective π) :
EffectiveEpiStruct π where
desc e h := (QuotientMap.of_surjective_continuous hπ π.continuous).lift e fun a b hab ↦
DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩
(by ext; exact hab)) a
fac e h := ((QuotientMap.of_surjective_continuous hπ π.continuous).lift_comp e
fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩
(by ext; exact hab)) a)
uniq e h g hm := by
suffices g = (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv ⟨e,
fun a b hab ↦ DFunLike.congr_fun
(h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab))
a⟩ by assumption
rw [← Equiv.symm_apply_eq (QuotientMap.of_surjective_continuous hπ π.continuous).liftEquiv]
ext
simp only [QuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm]
rfl
open List in
theorem effectiveEpi_tfae
{B X : Profinite.{u}} (π : X ⟶ B) :
TFAE
[ EffectiveEpi π
, Epi π
, Function.Surjective π
] := by
tfae_have 1 → 2
· intro; infer_instance
tfae_have 2 ↔ 3
· exact epi_iff_surjective π
tfae_have 3 → 1
· exact fun hπ ↦ ⟨⟨struct π hπ⟩⟩
tfae_finish
instance : profiniteToCompHaus.PreservesEffectiveEpis where
preserves f h :=
((CompHaus.effectiveEpi_tfae _).out 0 2).mpr (((Profinite.effectiveEpi_tfae _).out 0 2).mp h)
instance : profiniteToCompHaus.ReflectsEffectiveEpis where
reflects f h :=
((Profinite.effectiveEpi_tfae f).out 0 2).mpr (((CompHaus.effectiveEpi_tfae _).out 0 2).mp h)
noncomputable def profiniteToCompHausEffectivePresentation (X : CompHaus) :
profiniteToCompHaus.EffectivePresentation X where
p := Stonean.toProfinite.obj X.presentation
f := CompHaus.presentation.π X
effectiveEpi := ((CompHaus.effectiveEpi_tfae _).out 0 1).mpr (inferInstance : Epi _)
instance : profiniteToCompHaus.EffectivelyEnough where
presentation X := ⟨profiniteToCompHausEffectivePresentation X⟩
instance : Preregular Profinite.{u} := profiniteToCompHaus.reflects_preregular
example : Precoherent Profinite.{u} := inferInstance
-- TODO: prove this for `Type*`
open List in
| Mathlib/Topology/Category/Profinite/EffectiveEpi.lean | 110 | 128 | theorem effectiveEpiFamily_tfae
{α : Type} [Finite α] {B : Profinite.{u}}
(X : α → Profinite.{u}) (π : (a : α) → (X a ⟶ B)) :
TFAE
[ EffectiveEpiFamily X π
, Epi (Sigma.desc π)
, ∀ b : B, ∃ (a : α) (x : X a), π a x = b
] := by |
tfae_have 2 → 1
· intro
simpa [← effectiveEpi_desc_iff_effectiveEpiFamily, (effectiveEpi_tfae (Sigma.desc π)).out 0 1]
tfae_have 1 → 2
· intro; infer_instance
tfae_have 3 ↔ 1
· erw [((CompHaus.effectiveEpiFamily_tfae
(fun a ↦ profiniteToCompHaus.obj (X a)) (fun a ↦ profiniteToCompHaus.map (π a))).out 2 0 : )]
exact ⟨fun h ↦ profiniteToCompHaus.finite_effectiveEpiFamily_of_map _ _ h,
fun _ ↦ inferInstance⟩
tfae_finish
|
import Mathlib.Algebra.EuclideanDomain.Defs
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Regular
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Basic
#align_import algebra.euclidean_domain.basic from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u
namespace EuclideanDomain
variable {R : Type u}
variable [EuclideanDomain R]
local infixl:50 " ≺ " => EuclideanDomain.R
-- See note [lower instance priority]
instance (priority := 100) toMulDivCancelClass : MulDivCancelClass R where
mul_div_cancel a b hb := by
refine (eq_of_sub_eq_zero ?_).symm
by_contra h
have := mul_right_not_lt b h
rw [sub_mul, mul_comm (_ / _), sub_eq_iff_eq_add'.2 (div_add_mod (a * b) b).symm] at this
exact this (mod_lt _ hb)
#align euclidean_domain.mul_div_cancel_left mul_div_cancel_left₀
#align euclidean_domain.mul_div_cancel mul_div_cancel_right₀
@[simp]
theorem mod_eq_zero {a b : R} : a % b = 0 ↔ b ∣ a :=
⟨fun h => by
rw [← div_add_mod a b, h, add_zero]
exact dvd_mul_right _ _, fun ⟨c, e⟩ => by
rw [e, ← add_left_cancel_iff, div_add_mod, add_zero]
haveI := Classical.dec
by_cases b0 : b = 0
· simp only [b0, zero_mul]
· rw [mul_div_cancel_left₀ _ b0]⟩
#align euclidean_domain.mod_eq_zero EuclideanDomain.mod_eq_zero
@[simp]
theorem mod_self (a : R) : a % a = 0 :=
mod_eq_zero.2 dvd_rfl
#align euclidean_domain.mod_self EuclideanDomain.mod_self
theorem dvd_mod_iff {a b c : R} (h : c ∣ b) : c ∣ a % b ↔ c ∣ a := by
rw [← dvd_add_right (h.mul_right _), div_add_mod]
#align euclidean_domain.dvd_mod_iff EuclideanDomain.dvd_mod_iff
@[simp]
theorem mod_one (a : R) : a % 1 = 0 :=
mod_eq_zero.2 (one_dvd _)
#align euclidean_domain.mod_one EuclideanDomain.mod_one
@[simp]
theorem zero_mod (b : R) : 0 % b = 0 :=
mod_eq_zero.2 (dvd_zero _)
#align euclidean_domain.zero_mod EuclideanDomain.zero_mod
@[simp]
theorem zero_div {a : R} : 0 / a = 0 :=
by_cases (fun a0 : a = 0 => a0.symm ▸ div_zero 0) fun a0 => by
simpa only [zero_mul] using mul_div_cancel_right₀ 0 a0
#align euclidean_domain.zero_div EuclideanDomain.zero_div
@[simp]
| Mathlib/Algebra/EuclideanDomain/Basic.lean | 84 | 85 | theorem div_self {a : R} (a0 : a ≠ 0) : a / a = 1 := by |
simpa only [one_mul] using mul_div_cancel_right₀ 1 a0
|
import Mathlib.Data.Set.Image
import Mathlib.Data.List.GetD
#align_import data.set.list from "leanprover-community/mathlib"@"2ec920d35348cb2d13ac0e1a2ad9df0fdf1a76b4"
open List
variable {α β : Type*} (l : List α)
namespace Set
theorem range_list_map (f : α → β) : range (map f) = { l | ∀ x ∈ l, x ∈ range f } := by
refine antisymm (range_subset_iff.2 fun l => forall_mem_map_iff.2 fun y _ => mem_range_self _)
fun l hl => ?_
induction' l with a l ihl; · exact ⟨[], rfl⟩
rcases ihl fun x hx => hl x <| subset_cons _ _ hx with ⟨l, rfl⟩
rcases hl a (mem_cons_self _ _) with ⟨a, rfl⟩
exact ⟨a :: l, map_cons _ _ _⟩
#align set.range_list_map Set.range_list_map
theorem range_list_map_coe (s : Set α) : range (map ((↑) : s → α)) = { l | ∀ x ∈ l, x ∈ s } := by
rw [range_list_map, Subtype.range_coe]
#align set.range_list_map_coe Set.range_list_map_coe
@[simp]
| Mathlib/Data/Set/List.lean | 38 | 40 | theorem range_list_get : range l.get = { x | x ∈ l } := by |
ext x
rw [mem_setOf_eq, mem_iff_get, mem_range]
|
import Mathlib.Analysis.Normed.Group.Quotient
import Mathlib.Topology.Instances.AddCircle
#align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c"
noncomputable section
open Set
open Int hiding mem_zmultiples_iff
open AddSubgroup
namespace AddCircle
variable (p : ℝ)
instance : NormedAddCommGroup (AddCircle p) :=
AddSubgroup.normedAddCommGroupQuotient _
@[simp]
| Mathlib/Analysis/Normed/Group/AddCircle.lean | 44 | 68 | theorem norm_coe_mul (x : ℝ) (t : ℝ) :
‖(↑(t * x) : AddCircle (t * p))‖ = |t| * ‖(x : AddCircle p)‖ := by |
have aux : ∀ {a b c : ℝ}, a ∈ zmultiples b → c * a ∈ zmultiples (c * b) := fun {a b c} h => by
simp only [mem_zmultiples_iff] at h ⊢
obtain ⟨n, rfl⟩ := h
exact ⟨n, (mul_smul_comm n c b).symm⟩
rcases eq_or_ne t 0 with (rfl | ht); · simp
have ht' : |t| ≠ 0 := (not_congr abs_eq_zero).mpr ht
simp only [quotient_norm_eq, Real.norm_eq_abs]
conv_rhs => rw [← smul_eq_mul, ← Real.sInf_smul_of_nonneg (abs_nonneg t)]
simp only [QuotientAddGroup.mk'_apply, QuotientAddGroup.eq_iff_sub_mem]
congr 1
ext z
rw [mem_smul_set_iff_inv_smul_mem₀ ht']
show
(∃ y, y - t * x ∈ zmultiples (t * p) ∧ |y| = z) ↔ ∃ w, w - x ∈ zmultiples p ∧ |w| = |t|⁻¹ * z
constructor
· rintro ⟨y, hy, rfl⟩
refine ⟨t⁻¹ * y, ?_, by rw [abs_mul, abs_inv]⟩
rw [← inv_mul_cancel_left₀ ht x, ← inv_mul_cancel_left₀ ht p, ← mul_sub]
exact aux hy
· rintro ⟨w, hw, hw'⟩
refine ⟨t * w, ?_, by rw [← (eq_inv_mul_iff_mul_eq₀ ht').mp hw', abs_mul]⟩
rw [← mul_sub]
exact aux hw
|
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.OrdConnected
#align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c"
variable {α β : Type*} [LinearOrder α]
open Function
namespace Set
def projIci (a x : α) : Ici a := ⟨max a x, le_max_left _ _⟩
#align set.proj_Ici Set.projIci
def projIic (b x : α) : Iic b := ⟨min b x, min_le_left _ _⟩
#align set.proj_Iic Set.projIic
def projIcc (a b : α) (h : a ≤ b) (x : α) : Icc a b :=
⟨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)⟩
#align set.proj_Icc Set.projIcc
variable {a b : α} (h : a ≤ b) {x : α}
@[norm_cast]
theorem coe_projIci (a x : α) : (projIci a x : α) = max a x := rfl
#align set.coe_proj_Ici Set.coe_projIci
@[norm_cast]
theorem coe_projIic (b x : α) : (projIic b x : α) = min b x := rfl
#align set.coe_proj_Iic Set.coe_projIic
@[norm_cast]
theorem coe_projIcc (a b : α) (h : a ≤ b) (x : α) : (projIcc a b h x : α) = max a (min b x) := rfl
#align set.coe_proj_Icc Set.coe_projIcc
theorem projIci_of_le (hx : x ≤ a) : projIci a x = ⟨a, le_rfl⟩ := Subtype.ext <| max_eq_left hx
#align set.proj_Ici_of_le Set.projIci_of_le
theorem projIic_of_le (hx : b ≤ x) : projIic b x = ⟨b, le_rfl⟩ := Subtype.ext <| min_eq_left hx
#align set.proj_Iic_of_le Set.projIic_of_le
theorem projIcc_of_le_left (hx : x ≤ a) : projIcc a b h x = ⟨a, left_mem_Icc.2 h⟩ := by
simp [projIcc, hx, hx.trans h]
#align set.proj_Icc_of_le_left Set.projIcc_of_le_left
theorem projIcc_of_right_le (hx : b ≤ x) : projIcc a b h x = ⟨b, right_mem_Icc.2 h⟩ := by
simp [projIcc, hx, h]
#align set.proj_Icc_of_right_le Set.projIcc_of_right_le
@[simp]
theorem projIci_self (a : α) : projIci a a = ⟨a, le_rfl⟩ := projIci_of_le le_rfl
#align set.proj_Ici_self Set.projIci_self
@[simp]
theorem projIic_self (b : α) : projIic b b = ⟨b, le_rfl⟩ := projIic_of_le le_rfl
#align set.proj_Iic_self Set.projIic_self
@[simp]
theorem projIcc_left : projIcc a b h a = ⟨a, left_mem_Icc.2 h⟩ :=
projIcc_of_le_left h le_rfl
#align set.proj_Icc_left Set.projIcc_left
@[simp]
theorem projIcc_right : projIcc a b h b = ⟨b, right_mem_Icc.2 h⟩ :=
projIcc_of_right_le h le_rfl
#align set.proj_Icc_right Set.projIcc_right
| Mathlib/Order/Interval/Set/ProjIcc.lean | 99 | 99 | theorem projIci_eq_self : projIci a x = ⟨a, le_rfl⟩ ↔ x ≤ a := by | simp [projIci, Subtype.ext_iff]
|
import Mathlib.Analysis.Complex.UpperHalfPlane.Topology
import Mathlib.Analysis.SpecialFunctions.Arsinh
import Mathlib.Geometry.Euclidean.Inversion.Basic
#align_import analysis.complex.upper_half_plane.metric from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c"
noncomputable section
open scoped UpperHalfPlane ComplexConjugate NNReal Topology MatrixGroups
open Set Metric Filter Real
variable {z w : ℍ} {r R : ℝ}
namespace UpperHalfPlane
instance : Dist ℍ :=
⟨fun z w => 2 * arsinh (dist (z : ℂ) w / (2 * √(z.im * w.im)))⟩
theorem dist_eq (z w : ℍ) : dist z w = 2 * arsinh (dist (z : ℂ) w / (2 * √(z.im * w.im))) :=
rfl
#align upper_half_plane.dist_eq UpperHalfPlane.dist_eq
theorem sinh_half_dist (z w : ℍ) :
sinh (dist z w / 2) = dist (z : ℂ) w / (2 * √(z.im * w.im)) := by
rw [dist_eq, mul_div_cancel_left₀ (arsinh _) two_ne_zero, sinh_arsinh]
#align upper_half_plane.sinh_half_dist UpperHalfPlane.sinh_half_dist
theorem cosh_half_dist (z w : ℍ) :
cosh (dist z w / 2) = dist (z : ℂ) (conj (w : ℂ)) / (2 * √(z.im * w.im)) := by
rw [← sq_eq_sq, cosh_sq', sinh_half_dist, div_pow, div_pow, one_add_div, mul_pow, sq_sqrt]
· congr 1
simp only [Complex.dist_eq, Complex.sq_abs, Complex.normSq_sub, Complex.normSq_conj,
Complex.conj_conj, Complex.mul_re, Complex.conj_re, Complex.conj_im, coe_im]
ring
all_goals positivity
#align upper_half_plane.cosh_half_dist UpperHalfPlane.cosh_half_dist
theorem tanh_half_dist (z w : ℍ) :
tanh (dist z w / 2) = dist (z : ℂ) w / dist (z : ℂ) (conj ↑w) := by
rw [tanh_eq_sinh_div_cosh, sinh_half_dist, cosh_half_dist, div_div_div_comm, div_self, div_one]
positivity
#align upper_half_plane.tanh_half_dist UpperHalfPlane.tanh_half_dist
theorem exp_half_dist (z w : ℍ) :
exp (dist z w / 2) = (dist (z : ℂ) w + dist (z : ℂ) (conj ↑w)) / (2 * √(z.im * w.im)) := by
rw [← sinh_add_cosh, sinh_half_dist, cosh_half_dist, add_div]
#align upper_half_plane.exp_half_dist UpperHalfPlane.exp_half_dist
theorem cosh_dist (z w : ℍ) : cosh (dist z w) = 1 + dist (z : ℂ) w ^ 2 / (2 * z.im * w.im) := by
rw [dist_eq, cosh_two_mul, cosh_sq', add_assoc, ← two_mul, sinh_arsinh, div_pow, mul_pow,
sq_sqrt, sq (2 : ℝ), mul_assoc, ← mul_div_assoc, mul_assoc, mul_div_mul_left] <;> positivity
#align upper_half_plane.cosh_dist UpperHalfPlane.cosh_dist
| Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean | 76 | 84 | theorem sinh_half_dist_add_dist (a b c : ℍ) : sinh ((dist a b + dist b c) / 2) =
(dist (a : ℂ) b * dist (c : ℂ) (conj ↑b) + dist (b : ℂ) c * dist (a : ℂ) (conj ↑b)) /
(2 * √(a.im * c.im) * dist (b : ℂ) (conj ↑b)) := by |
simp only [add_div _ _ (2 : ℝ), sinh_add, sinh_half_dist, cosh_half_dist, div_mul_div_comm]
rw [← add_div, Complex.dist_self_conj, coe_im, abs_of_pos b.im_pos, mul_comm (dist (b : ℂ) _),
dist_comm (b : ℂ), Complex.dist_conj_comm, mul_mul_mul_comm, mul_mul_mul_comm _ _ _ b.im]
congr 2
rw [sqrt_mul, sqrt_mul, sqrt_mul, mul_comm (√a.im), mul_mul_mul_comm, mul_self_sqrt,
mul_comm] <;> exact (im_pos _).le
|
import Mathlib.Analysis.Calculus.TangentCone
import Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics
#align_import analysis.calculus.fderiv.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
@[mk_iff hasFDerivAtFilter_iff_isLittleO]
structure HasFDerivAtFilter (f : E → F) (f' : E →L[𝕜] F) (x : E) (L : Filter E) : Prop where
of_isLittleO :: isLittleO : (fun x' => f x' - f x - f' (x' - x)) =o[L] fun x' => x' - x
#align has_fderiv_at_filter HasFDerivAtFilter
@[fun_prop]
def HasFDerivWithinAt (f : E → F) (f' : E →L[𝕜] F) (s : Set E) (x : E) :=
HasFDerivAtFilter f f' x (𝓝[s] x)
#align has_fderiv_within_at HasFDerivWithinAt
@[fun_prop]
def HasFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) :=
HasFDerivAtFilter f f' x (𝓝 x)
#align has_fderiv_at HasFDerivAt
@[fun_prop]
def HasStrictFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) :=
(fun p : E × E => f p.1 - f p.2 - f' (p.1 - p.2)) =o[𝓝 (x, x)] fun p : E × E => p.1 - p.2
#align has_strict_fderiv_at HasStrictFDerivAt
variable (𝕜)
@[fun_prop]
def DifferentiableWithinAt (f : E → F) (s : Set E) (x : E) :=
∃ f' : E →L[𝕜] F, HasFDerivWithinAt f f' s x
#align differentiable_within_at DifferentiableWithinAt
@[fun_prop]
def DifferentiableAt (f : E → F) (x : E) :=
∃ f' : E →L[𝕜] F, HasFDerivAt f f' x
#align differentiable_at DifferentiableAt
irreducible_def fderivWithin (f : E → F) (s : Set E) (x : E) : E →L[𝕜] F :=
if 𝓝[s \ {x}] x = ⊥ then 0 else
if h : ∃ f', HasFDerivWithinAt f f' s x then Classical.choose h else 0
#align fderiv_within fderivWithin
irreducible_def fderiv (f : E → F) (x : E) : E →L[𝕜] F :=
if h : ∃ f', HasFDerivAt f f' x then Classical.choose h else 0
#align fderiv fderiv
@[fun_prop]
def DifferentiableOn (f : E → F) (s : Set E) :=
∀ x ∈ s, DifferentiableWithinAt 𝕜 f s x
#align differentiable_on DifferentiableOn
@[fun_prop]
def Differentiable (f : E → F) :=
∀ x, DifferentiableAt 𝕜 f x
#align differentiable Differentiable
variable {𝕜}
variable {f f₀ f₁ g : E → F}
variable {f' f₀' f₁' g' : E →L[𝕜] F}
variable (e : E →L[𝕜] F)
variable {x : E}
variable {s t : Set E}
variable {L L₁ L₂ : Filter E}
| Mathlib/Analysis/Calculus/FDeriv/Basic.lean | 216 | 217 | theorem fderivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : fderivWithin 𝕜 f s x = 0 := by |
rw [fderivWithin, if_pos h]
|
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {α β K : Type*}
section DivisionMonoid
variable [DivisionMonoid K] [HasDistribNeg K] {a b : K}
theorem one_div_neg_one_eq_neg_one : (1 : K) / -1 = -1 :=
have : -1 * -1 = (1 : K) := by rw [neg_mul_neg, one_mul]
Eq.symm (eq_one_div_of_mul_eq_one_right this)
#align one_div_neg_one_eq_neg_one one_div_neg_one_eq_neg_one
theorem one_div_neg_eq_neg_one_div (a : K) : 1 / -a = -(1 / a) :=
calc
1 / -a = 1 / (-1 * a) := by rw [neg_eq_neg_one_mul]
_ = 1 / a * (1 / -1) := by rw [one_div_mul_one_div_rev]
_ = 1 / a * -1 := by rw [one_div_neg_one_eq_neg_one]
_ = -(1 / a) := by rw [mul_neg, mul_one]
#align one_div_neg_eq_neg_one_div one_div_neg_eq_neg_one_div
theorem div_neg_eq_neg_div (a b : K) : b / -a = -(b / a) :=
calc
b / -a = b * (1 / -a) := by rw [← inv_eq_one_div, division_def]
_ = b * -(1 / a) := by rw [one_div_neg_eq_neg_one_div]
_ = -(b * (1 / a)) := by rw [neg_mul_eq_mul_neg]
_ = -(b / a) := by rw [mul_one_div]
#align div_neg_eq_neg_div div_neg_eq_neg_div
theorem neg_div (a b : K) : -b / a = -(b / a) := by
rw [neg_eq_neg_one_mul, mul_div_assoc, ← neg_eq_neg_one_mul]
#align neg_div neg_div
@[field_simps]
theorem neg_div' (a b : K) : -(b / a) = -b / a := by simp [neg_div]
#align neg_div' neg_div'
@[simp]
| Mathlib/Algebra/Field/Basic.lean | 126 | 126 | theorem neg_div_neg_eq (a b : K) : -a / -b = a / b := by | rw [div_neg_eq_neg_div, neg_div, neg_neg]
|
import Mathlib.Algebra.Polynomial.Monic
#align_import algebra.polynomial.big_operators from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
open Finset
open Multiset
open Polynomial
universe u w
variable {R : Type u} {ι : Type w}
namespace Polynomial
variable (s : Finset ι)
section CommRing
variable [CommRing R]
open Monic
-- Eventually this can be generalized with Vieta's formulas
-- plus the connection between roots and factorization.
theorem multiset_prod_X_sub_C_nextCoeff (t : Multiset R) :
nextCoeff (t.map fun x => X - C x).prod = -t.sum := by
rw [nextCoeff_multiset_prod]
· simp only [nextCoeff_X_sub_C]
exact t.sum_hom (-AddMonoidHom.id R)
· intros
apply monic_X_sub_C
set_option linter.uppercaseLean3 false in
#align polynomial.multiset_prod_X_sub_C_next_coeff Polynomial.multiset_prod_X_sub_C_nextCoeff
| Mathlib/Algebra/Polynomial/BigOperators.lean | 263 | 265 | theorem prod_X_sub_C_nextCoeff {s : Finset ι} (f : ι → R) :
nextCoeff (∏ i ∈ s, (X - C (f i))) = -∑ i ∈ s, f i := by |
simpa using multiset_prod_X_sub_C_nextCoeff (s.1.map f)
|
import Mathlib.RingTheory.Polynomial.Cyclotomic.Basic
import Mathlib.RingTheory.RootsOfUnity.Minpoly
#align_import ring_theory.polynomial.cyclotomic.roots from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
namespace Polynomial
variable {R : Type*} [CommRing R] {n : ℕ}
| Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean | 40 | 49 | theorem isRoot_of_unity_of_root_cyclotomic {ζ : R} {i : ℕ} (hi : i ∈ n.divisors)
(h : (cyclotomic i R).IsRoot ζ) : ζ ^ n = 1 := by |
rcases n.eq_zero_or_pos with (rfl | hn)
· exact pow_zero _
have := congr_arg (eval ζ) (prod_cyclotomic_eq_X_pow_sub_one hn R).symm
rw [eval_sub, eval_pow, eval_X, eval_one] at this
convert eq_add_of_sub_eq' this
convert (add_zero (M := R) _).symm
apply eval_eq_zero_of_dvd_of_eval_eq_zero _ h
exact Finset.dvd_prod_of_mem _ hi
|
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow
import Mathlib.Data.Finset.Fold
import Mathlib.Data.Finset.Option
import Mathlib.Data.Finset.Pi
import Mathlib.Data.Finset.Prod
import Mathlib.Data.Multiset.Lattice
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Hom.Lattice
import Mathlib.Order.Nat
#align_import data.finset.lattice from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
open Function Multiset OrderDual
variable {F α β γ ι κ : Type*}
namespace Finset
section Sup
-- TODO: define with just `[Bot α]` where some lemmas hold without requiring `[OrderBot α]`
variable [SemilatticeSup α] [OrderBot α]
def sup (s : Finset β) (f : β → α) : α :=
s.fold (· ⊔ ·) ⊥ f
#align finset.sup Finset.sup
variable {s s₁ s₂ : Finset β} {f g : β → α} {a : α}
theorem sup_def : s.sup f = (s.1.map f).sup :=
rfl
#align finset.sup_def Finset.sup_def
@[simp]
theorem sup_empty : (∅ : Finset β).sup f = ⊥ :=
fold_empty
#align finset.sup_empty Finset.sup_empty
@[simp]
theorem sup_cons {b : β} (h : b ∉ s) : (cons b s h).sup f = f b ⊔ s.sup f :=
fold_cons h
#align finset.sup_cons Finset.sup_cons
@[simp]
theorem sup_insert [DecidableEq β] {b : β} : (insert b s : Finset β).sup f = f b ⊔ s.sup f :=
fold_insert_idem
#align finset.sup_insert Finset.sup_insert
@[simp]
theorem sup_image [DecidableEq β] (s : Finset γ) (f : γ → β) (g : β → α) :
(s.image f).sup g = s.sup (g ∘ f) :=
fold_image_idem
#align finset.sup_image Finset.sup_image
@[simp]
theorem sup_map (s : Finset γ) (f : γ ↪ β) (g : β → α) : (s.map f).sup g = s.sup (g ∘ f) :=
fold_map
#align finset.sup_map Finset.sup_map
@[simp]
theorem sup_singleton {b : β} : ({b} : Finset β).sup f = f b :=
Multiset.sup_singleton
#align finset.sup_singleton Finset.sup_singleton
theorem sup_sup : s.sup (f ⊔ g) = s.sup f ⊔ s.sup g := by
induction s using Finset.cons_induction with
| empty => rw [sup_empty, sup_empty, sup_empty, bot_sup_eq]
| cons _ _ _ ih =>
rw [sup_cons, sup_cons, sup_cons, ih]
exact sup_sup_sup_comm _ _ _ _
#align finset.sup_sup Finset.sup_sup
| Mathlib/Data/Finset/Lattice.lean | 90 | 93 | theorem sup_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀ a ∈ s₂, f a = g a) :
s₁.sup f = s₂.sup g := by |
subst hs
exact Finset.fold_congr hfg
|
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
#align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973"
namespace Real
open IsAbsoluteValue Finset CauSeq Complex
theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by
apply exp_approx_start
iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_
norm_num1
refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_
rw [_root_.abs_one, abs_of_pos] <;> norm_num1
#align real.exp_one_near_10 Real.exp_one_near_10
theorem exp_one_near_20 : |exp 1 - 363916618873 / 133877442384| ≤ 1 / 10 ^ 20 := by
apply exp_approx_start
iterate 21 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_
norm_num1
refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_
rw [_root_.abs_one, abs_of_pos] <;> norm_num1
#align real.exp_one_near_20 Real.exp_one_near_20
theorem exp_one_gt_d9 : 2.7182818283 < exp 1 :=
lt_of_lt_of_le (by norm_num) (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2)
#align real.exp_one_gt_d9 Real.exp_one_gt_d9
theorem exp_one_lt_d9 : exp 1 < 2.7182818286 :=
lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) (by norm_num)
#align real.exp_one_lt_d9 Real.exp_one_lt_d9
theorem exp_neg_one_gt_d9 : 0.36787944116 < exp (-1) := by
rw [exp_neg, lt_inv _ (exp_pos _)]
· refine lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) ?_
norm_num
· norm_num
#align real.exp_neg_one_gt_d9 Real.exp_neg_one_gt_d9
| Mathlib/Data/Complex/ExponentialBounds.lean | 51 | 55 | theorem exp_neg_one_lt_d9 : exp (-1) < 0.3678794412 := by |
rw [exp_neg, inv_lt (exp_pos _)]
· refine lt_of_lt_of_le ?_ (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2)
norm_num
· norm_num
|
import Mathlib.Algebra.EuclideanDomain.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Algebra.GCDMonoid.Nat
#align_import ring_theory.int.basic from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
theorem Int.Prime.dvd_mul {m n : ℤ} {p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ m * n) :
p ∣ m.natAbs ∨ p ∣ n.natAbs := by
rwa [← hp.dvd_mul, ← Int.natAbs_mul, ← Int.natCast_dvd]
#align int.prime.dvd_mul Int.Prime.dvd_mul
theorem Int.Prime.dvd_mul' {m n : ℤ} {p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ m * n) :
(p : ℤ) ∣ m ∨ (p : ℤ) ∣ n := by
rw [Int.natCast_dvd, Int.natCast_dvd]
exact Int.Prime.dvd_mul hp h
#align int.prime.dvd_mul' Int.Prime.dvd_mul'
theorem Int.Prime.dvd_pow {n : ℤ} {k p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ n ^ k) :
p ∣ n.natAbs := by
rw [Int.natCast_dvd, Int.natAbs_pow] at h
exact hp.dvd_of_dvd_pow h
#align int.prime.dvd_pow Int.Prime.dvd_pow
theorem Int.Prime.dvd_pow' {n : ℤ} {k p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ n ^ k) :
(p : ℤ) ∣ n := by
rw [Int.natCast_dvd]
exact Int.Prime.dvd_pow hp h
#align int.prime.dvd_pow' Int.Prime.dvd_pow'
theorem prime_two_or_dvd_of_dvd_two_mul_pow_self_two {m : ℤ} {p : ℕ} (hp : Nat.Prime p)
(h : (p : ℤ) ∣ 2 * m ^ 2) : p = 2 ∨ p ∣ Int.natAbs m := by
cases' Int.Prime.dvd_mul hp h with hp2 hpp
· apply Or.intro_left
exact le_antisymm (Nat.le_of_dvd zero_lt_two hp2) (Nat.Prime.two_le hp)
· apply Or.intro_right
rw [sq, Int.natAbs_mul] at hpp
exact or_self_iff.mp ((Nat.Prime.dvd_mul hp).mp hpp)
#align prime_two_or_dvd_of_dvd_two_mul_pow_self_two prime_two_or_dvd_of_dvd_two_mul_pow_self_two
theorem Int.exists_prime_and_dvd {n : ℤ} (hn : n.natAbs ≠ 1) : ∃ p, Prime p ∧ p ∣ n := by
obtain ⟨p, pp, pd⟩ := Nat.exists_prime_and_dvd hn
exact ⟨p, Nat.prime_iff_prime_int.mp pp, Int.natCast_dvd.mpr pd⟩
#align int.exists_prime_and_dvd Int.exists_prime_and_dvd
theorem Int.prime_iff_natAbs_prime {k : ℤ} : Prime k ↔ Nat.Prime k.natAbs :=
(Int.associated_natAbs k).prime_iff.trans Nat.prime_iff_prime_int.symm
#align int.prime_iff_nat_abs_prime Int.prime_iff_natAbs_prime
namespace Int
theorem zmultiples_natAbs (a : ℤ) :
AddSubgroup.zmultiples (a.natAbs : ℤ) = AddSubgroup.zmultiples a :=
le_antisymm (AddSubgroup.zmultiples_le_of_mem (mem_zmultiples_iff.mpr (dvd_natAbs.mpr dvd_rfl)))
(AddSubgroup.zmultiples_le_of_mem (mem_zmultiples_iff.mpr (natAbs_dvd.mpr dvd_rfl)))
#align int.zmultiples_nat_abs Int.zmultiples_natAbs
theorem span_natAbs (a : ℤ) : Ideal.span ({(a.natAbs : ℤ)} : Set ℤ) = Ideal.span {a} := by
rw [Ideal.span_singleton_eq_span_singleton]
exact (associated_natAbs _).symm
#align int.span_nat_abs Int.span_natAbs
section bit
set_option linter.deprecated false
| Mathlib/RingTheory/Int/Basic.lean | 147 | 152 | theorem eq_pow_of_mul_eq_pow_bit1_left {a b c : ℤ} (hab : IsCoprime a b) {k : ℕ}
(h : a * b = c ^ bit1 k) : ∃ d, a = d ^ bit1 k := by |
obtain ⟨d, hd⟩ := exists_associated_pow_of_mul_eq_pow' hab h
replace hd := hd.symm
rw [associated_iff_natAbs, natAbs_eq_natAbs_iff, ← neg_pow_bit1] at hd
obtain rfl | rfl := hd <;> exact ⟨_, rfl⟩
|
import Mathlib.ModelTheory.Quotients
import Mathlib.Order.Filter.Germ
import Mathlib.Order.Filter.Ultrafilter
#align_import model_theory.ultraproducts from "leanprover-community/mathlib"@"f1ae620609496a37534c2ab3640b641d5be8b6f0"
universe u v
variable {α : Type*} (M : α → Type*) (u : Ultrafilter α)
open FirstOrder Filter
open Filter
namespace FirstOrder
namespace Language
open Structure
variable {L : Language.{u, v}} [∀ a, L.Structure (M a)]
namespace Ultraproduct
instance setoidPrestructure : L.Prestructure ((u : Filter α).productSetoid M) :=
{ (u : Filter α).productSetoid M with
toStructure :=
{ funMap := fun {n} f x a => funMap f fun i => x i a
RelMap := fun {n} r x => ∀ᶠ a : α in u, RelMap r fun i => x i a }
fun_equiv := fun {n} f x y xy => by
refine mem_of_superset (iInter_mem.2 xy) fun a ha => ?_
simp only [Set.mem_iInter, Set.mem_setOf_eq] at ha
simp only [Set.mem_setOf_eq, ha]
rel_equiv := fun {n} r x y xy => by
rw [← iff_eq_eq]
refine ⟨fun hx => ?_, fun hy => ?_⟩
· refine mem_of_superset (inter_mem hx (iInter_mem.2 xy)) ?_
rintro a ⟨ha1, ha2⟩
simp only [Set.mem_iInter, Set.mem_setOf_eq] at *
rw [← funext ha2]
exact ha1
· refine mem_of_superset (inter_mem hy (iInter_mem.2 xy)) ?_
rintro a ⟨ha1, ha2⟩
simp only [Set.mem_iInter, Set.mem_setOf_eq] at *
rw [funext ha2]
exact ha1 }
#align first_order.language.ultraproduct.setoid_prestructure FirstOrder.Language.Ultraproduct.setoidPrestructure
variable {M} {u}
instance «structure» : L.Structure ((u : Filter α).Product M) :=
Language.quotientStructure
set_option linter.uppercaseLean3 false in
#align first_order.language.ultraproduct.Structure FirstOrder.Language.Ultraproduct.structure
theorem funMap_cast {n : ℕ} (f : L.Functions n) (x : Fin n → ∀ a, M a) :
(funMap f fun i => (x i : (u : Filter α).Product M)) =
(fun a => funMap f fun i => x i a : (u : Filter α).Product M) := by
apply funMap_quotient_mk'
#align first_order.language.ultraproduct.fun_map_cast FirstOrder.Language.Ultraproduct.funMap_cast
theorem term_realize_cast {β : Type*} (x : β → ∀ a, M a) (t : L.Term β) :
(t.realize fun i => (x i : (u : Filter α).Product M)) =
(fun a => t.realize fun i => x i a : (u : Filter α).Product M) := by
convert @Term.realize_quotient_mk' L _ ((u : Filter α).productSetoid M)
(Ultraproduct.setoidPrestructure M u) _ t x using 2
ext a
induction t with
| var => rfl
| func _ _ t_ih => simp only [Term.realize, t_ih]; rfl
#align first_order.language.ultraproduct.term_realize_cast FirstOrder.Language.Ultraproduct.term_realize_cast
variable [∀ a : α, Nonempty (M a)]
| Mathlib/ModelTheory/Ultraproducts.lean | 96 | 144 | theorem boundedFormula_realize_cast {β : Type*} {n : ℕ} (φ : L.BoundedFormula β n)
(x : β → ∀ a, M a) (v : Fin n → ∀ a, M a) :
(φ.Realize (fun i : β => (x i : (u : Filter α).Product M))
(fun i => (v i : (u : Filter α).Product M))) ↔
∀ᶠ a : α in u, φ.Realize (fun i : β => x i a) fun i => v i a := by |
letI := (u : Filter α).productSetoid M
induction' φ with _ _ _ _ _ _ _ _ m _ _ ih ih' k φ ih
· simp only [BoundedFormula.Realize, eventually_const]
· have h2 : ∀ a : α, (Sum.elim (fun i : β => x i a) fun i => v i a) = fun i => Sum.elim x v i a :=
fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl
simp only [BoundedFormula.Realize, h2, term_realize_cast]
erw [(Sum.comp_elim ((↑) : (∀ a, M a) → (u : Filter α).Product M) x v).symm,
term_realize_cast, term_realize_cast]
exact Quotient.eq''
· have h2 : ∀ a : α, (Sum.elim (fun i : β => x i a) fun i => v i a) = fun i => Sum.elim x v i a :=
fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl
simp only [BoundedFormula.Realize, h2]
erw [(Sum.comp_elim ((↑) : (∀ a, M a) → (u : Filter α).Product M) x v).symm]
conv_lhs => enter [2, i]; erw [term_realize_cast]
apply relMap_quotient_mk'
· simp only [BoundedFormula.Realize, ih v, ih' v]
rw [Ultrafilter.eventually_imp]
· simp only [BoundedFormula.Realize]
apply Iff.trans (b := ∀ m : ∀ a : α, M a,
φ.Realize (fun i : β => (x i : (u : Filter α).Product M))
(Fin.snoc (((↑) : (∀ a, M a) → (u : Filter α).Product M) ∘ v)
(m : (u : Filter α).Product M)))
· exact Quotient.forall
have h' :
∀ (m : ∀ a, M a) (a : α),
(fun i : Fin (k + 1) => (Fin.snoc v m : _ → ∀ a, M a) i a) =
Fin.snoc (fun i : Fin k => v i a) (m a) := by
refine fun m a => funext (Fin.reverseInduction ?_ fun i _ => ?_)
· simp only [Fin.snoc_last]
· simp only [Fin.snoc_castSucc]
simp only [← Fin.comp_snoc]
simp only [Function.comp, ih, h']
refine ⟨fun h => ?_, fun h m => ?_⟩
· contrapose! h
simp_rw [← Ultrafilter.eventually_not, not_forall] at h
refine
⟨fun a : α =>
Classical.epsilon fun m : M a =>
¬φ.Realize (fun i => x i a) (Fin.snoc (fun i => v i a) m),
?_⟩
rw [← Ultrafilter.eventually_not]
exact Filter.mem_of_superset h fun a ha => Classical.epsilon_spec ha
· rw [Filter.eventually_iff] at *
exact Filter.mem_of_superset h fun a ha => ha (m a)
|
import Mathlib.Data.List.Basic
#align_import data.list.palindrome from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
variable {α β : Type*}
namespace List
inductive Palindrome : List α → Prop
| nil : Palindrome []
| singleton : ∀ x, Palindrome [x]
| cons_concat : ∀ (x) {l}, Palindrome l → Palindrome (x :: (l ++ [x]))
#align list.palindrome List.Palindrome
namespace Palindrome
variable {l : List α}
theorem reverse_eq {l : List α} (p : Palindrome l) : reverse l = l := by
induction p <;> try (exact rfl)
simpa
#align list.palindrome.reverse_eq List.Palindrome.reverse_eq
theorem of_reverse_eq {l : List α} : reverse l = l → Palindrome l := by
refine bidirectionalRecOn l (fun _ => Palindrome.nil) (fun a _ => Palindrome.singleton a) ?_
intro x l y hp hr
rw [reverse_cons, reverse_append] at hr
rw [head_eq_of_cons_eq hr]
have : Palindrome l := hp (append_inj_left' (tail_eq_of_cons_eq hr) rfl)
exact Palindrome.cons_concat x this
#align list.palindrome.of_reverse_eq List.Palindrome.of_reverse_eq
theorem iff_reverse_eq {l : List α} : Palindrome l ↔ reverse l = l :=
Iff.intro reverse_eq of_reverse_eq
#align list.palindrome.iff_reverse_eq List.Palindrome.iff_reverse_eq
| Mathlib/Data/List/Palindrome.lean | 68 | 70 | theorem append_reverse (l : List α) : Palindrome (l ++ reverse l) := by |
apply of_reverse_eq
rw [reverse_append, reverse_reverse]
|
import Mathlib.Data.Finset.Image
#align_import data.finset.card from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
assert_not_exists MonoidWithZero
-- TODO: After a lot more work,
-- assert_not_exists OrderedCommMonoid
open Function Multiset Nat
variable {α β R : Type*}
namespace Finset
variable {s t : Finset α} {a b : α}
def card (s : Finset α) : ℕ :=
Multiset.card s.1
#align finset.card Finset.card
theorem card_def (s : Finset α) : s.card = Multiset.card s.1 :=
rfl
#align finset.card_def Finset.card_def
@[simp] lemma card_val (s : Finset α) : Multiset.card s.1 = s.card := rfl
#align finset.card_val Finset.card_val
@[simp]
theorem card_mk {m nodup} : (⟨m, nodup⟩ : Finset α).card = Multiset.card m :=
rfl
#align finset.card_mk Finset.card_mk
@[simp]
theorem card_empty : card (∅ : Finset α) = 0 :=
rfl
#align finset.card_empty Finset.card_empty
@[gcongr]
theorem card_le_card : s ⊆ t → s.card ≤ t.card :=
Multiset.card_le_card ∘ val_le_iff.mpr
#align finset.card_le_of_subset Finset.card_le_card
@[mono]
theorem card_mono : Monotone (@card α) := by apply card_le_card
#align finset.card_mono Finset.card_mono
@[simp] lemma card_eq_zero : s.card = 0 ↔ s = ∅ := card_eq_zero.trans val_eq_zero
lemma card_ne_zero : s.card ≠ 0 ↔ s.Nonempty := card_eq_zero.ne.trans nonempty_iff_ne_empty.symm
lemma card_pos : 0 < s.card ↔ s.Nonempty := Nat.pos_iff_ne_zero.trans card_ne_zero
#align finset.card_eq_zero Finset.card_eq_zero
#align finset.card_pos Finset.card_pos
alias ⟨_, Nonempty.card_pos⟩ := card_pos
alias ⟨_, Nonempty.card_ne_zero⟩ := card_ne_zero
#align finset.nonempty.card_pos Finset.Nonempty.card_pos
theorem card_ne_zero_of_mem (h : a ∈ s) : s.card ≠ 0 :=
(not_congr card_eq_zero).2 <| ne_empty_of_mem h
#align finset.card_ne_zero_of_mem Finset.card_ne_zero_of_mem
@[simp]
theorem card_singleton (a : α) : card ({a} : Finset α) = 1 :=
Multiset.card_singleton _
#align finset.card_singleton Finset.card_singleton
theorem card_singleton_inter [DecidableEq α] : ({a} ∩ s).card ≤ 1 := by
cases' Finset.decidableMem a s with h h
· simp [Finset.singleton_inter_of_not_mem h]
· simp [Finset.singleton_inter_of_mem h]
#align finset.card_singleton_inter Finset.card_singleton_inter
@[simp]
theorem card_cons (h : a ∉ s) : (s.cons a h).card = s.card + 1 :=
Multiset.card_cons _ _
#align finset.card_cons Finset.card_cons
section InsertErase
variable [DecidableEq α]
@[simp]
theorem card_insert_of_not_mem (h : a ∉ s) : (insert a s).card = s.card + 1 := by
rw [← cons_eq_insert _ _ h, card_cons]
#align finset.card_insert_of_not_mem Finset.card_insert_of_not_mem
theorem card_insert_of_mem (h : a ∈ s) : card (insert a s) = s.card := by rw [insert_eq_of_mem h]
#align finset.card_insert_of_mem Finset.card_insert_of_mem
| Mathlib/Data/Finset/Card.lean | 114 | 118 | theorem card_insert_le (a : α) (s : Finset α) : card (insert a s) ≤ s.card + 1 := by |
by_cases h : a ∈ s
· rw [insert_eq_of_mem h]
exact Nat.le_succ _
· rw [card_insert_of_not_mem h]
|
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Directed
#align_import data.set.Union_lift from "leanprover-community/mathlib"@"5a4ea8453f128345f73cc656e80a49de2a54f481"
variable {α : Type*} {ι β : Sort _}
namespace Set
section UnionLift
@[nolint unusedArguments]
noncomputable def iUnionLift (S : ι → Set α) (f : ∀ i, S i → β)
(_ : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩) (T : Set α)
(hT : T ⊆ iUnion S) (x : T) : β :=
let i := Classical.indefiniteDescription _ (mem_iUnion.1 (hT x.prop))
f i ⟨x, i.prop⟩
#align set.Union_lift Set.iUnionLift
variable {S : ι → Set α} {f : ∀ i, S i → β}
{hf : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩} {T : Set α}
{hT : T ⊆ iUnion S} (hT' : T = iUnion S)
@[simp]
theorem iUnionLift_mk {i : ι} (x : S i) (hx : (x : α) ∈ T) :
iUnionLift S f hf T hT ⟨x, hx⟩ = f i x := hf _ i x _ _
#align set.Union_lift_mk Set.iUnionLift_mk
@[simp]
theorem iUnionLift_inclusion {i : ι} (x : S i) (h : S i ⊆ T) :
iUnionLift S f hf T hT (Set.inclusion h x) = f i x :=
iUnionLift_mk x _
#align set.Union_lift_inclusion Set.iUnionLift_inclusion
| Mathlib/Data/Set/UnionLift.lean | 75 | 76 | theorem iUnionLift_of_mem (x : T) {i : ι} (hx : (x : α) ∈ S i) :
iUnionLift S f hf T hT x = f i ⟨x, hx⟩ := by | cases' x with x hx; exact hf _ _ _ _ _
|
import Mathlib.AlgebraicTopology.DoldKan.FunctorGamma
import Mathlib.AlgebraicTopology.DoldKan.SplitSimplicialObject
import Mathlib.CategoryTheory.Idempotents.HomologicalComplex
#align_import algebraic_topology.dold_kan.gamma_comp_n from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
CategoryTheory.Idempotents Opposite SimplicialObject Simplicial
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] [HasFiniteCoproducts C]
@[simps!]
def Γ₀NondegComplexIso (K : ChainComplex C ℕ) : (Γ₀.splitting K).nondegComplex ≅ K :=
HomologicalComplex.Hom.isoOfComponents (fun n => Iso.refl _)
(by
rintro _ n (rfl : n + 1 = _)
dsimp
simp only [id_comp, comp_id, AlternatingFaceMapComplex.obj_d_eq, Preadditive.sum_comp,
Preadditive.comp_sum]
rw [Fintype.sum_eq_single (0 : Fin (n + 2))]
· simp only [Fin.val_zero, pow_zero, one_zsmul]
erw [Γ₀.Obj.mapMono_on_summand_id_assoc, Γ₀.Obj.Termwise.mapMono_δ₀,
Splitting.cofan_inj_πSummand_eq_id, comp_id]
· intro i hi
dsimp
simp only [Preadditive.zsmul_comp, Preadditive.comp_zsmul, assoc]
erw [Γ₀.Obj.mapMono_on_summand_id_assoc, Γ₀.Obj.Termwise.mapMono_eq_zero, zero_comp,
zsmul_zero]
· intro h
replace h := congr_arg SimplexCategory.len h
change n + 1 = n at h
omega
· simpa only [Isδ₀.iff] using hi)
#align algebraic_topology.dold_kan.Γ₀_nondeg_complex_iso AlgebraicTopology.DoldKan.Γ₀NondegComplexIso
def Γ₀'CompNondegComplexFunctor : Γ₀' ⋙ Split.nondegComplexFunctor ≅ 𝟭 (ChainComplex C ℕ) :=
NatIso.ofComponents Γ₀NondegComplexIso
#align algebraic_topology.dold_kan.Γ₀'_comp_nondeg_complex_functor AlgebraicTopology.DoldKan.Γ₀'CompNondegComplexFunctor
def N₁Γ₀ : Γ₀ ⋙ N₁ ≅ toKaroubi (ChainComplex C ℕ) :=
calc
Γ₀ ⋙ N₁ ≅ Γ₀' ⋙ Split.forget C ⋙ N₁ := Functor.associator _ _ _
_ ≅ Γ₀' ⋙ Split.nondegComplexFunctor ⋙ toKaroubi _ :=
(isoWhiskerLeft Γ₀' Split.toKaroubiNondegComplexFunctorIsoN₁.symm)
_ ≅ (Γ₀' ⋙ Split.nondegComplexFunctor) ⋙ toKaroubi _ := (Functor.associator _ _ _).symm
_ ≅ 𝟭 _ ⋙ toKaroubi (ChainComplex C ℕ) := isoWhiskerRight Γ₀'CompNondegComplexFunctor _
_ ≅ toKaroubi (ChainComplex C ℕ) := Functor.leftUnitor _
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.N₁Γ₀ AlgebraicTopology.DoldKan.N₁Γ₀
theorem N₁Γ₀_app (K : ChainComplex C ℕ) :
N₁Γ₀.app K = (Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.symm ≪≫
(toKaroubi _).mapIso (Γ₀NondegComplexIso K) := by
ext1
dsimp [N₁Γ₀]
erw [id_comp, comp_id, comp_id]
rfl
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.N₁Γ₀_app AlgebraicTopology.DoldKan.N₁Γ₀_app
| Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean | 86 | 91 | theorem N₁Γ₀_hom_app (K : ChainComplex C ℕ) :
N₁Γ₀.hom.app K = (Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.inv ≫
(toKaroubi _).map (Γ₀NondegComplexIso K).hom := by |
change (N₁Γ₀.app K).hom = _
simp only [N₁Γ₀_app]
rfl
|
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.RingTheory.Ideal.Quotient
#align_import linear_algebra.smodeq from "leanprover-community/mathlib"@"146d3d1fa59c091fedaad8a4afa09d6802886d24"
open Submodule
open Polynomial
variable {R : Type*} [Ring R]
variable {A : Type*} [CommRing A]
variable {M : Type*} [AddCommGroup M] [Module R M] (U U₁ U₂ : Submodule R M)
variable {x x₁ x₂ y y₁ y₂ z z₁ z₂ : M}
variable {N : Type*} [AddCommGroup N] [Module R N] (V V₁ V₂ : Submodule R N)
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
def SModEq (x y : M) : Prop :=
(Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y
#align smodeq SModEq
notation:50 x " ≡ " y " [SMOD " N "]" => SModEq N x y
variable {U U₁ U₂}
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
protected theorem SModEq.def :
x ≡ y [SMOD U] ↔ (Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y :=
Iff.rfl
#align smodeq.def SModEq.def
namespace SModEq
theorem sub_mem : x ≡ y [SMOD U] ↔ x - y ∈ U := by rw [SModEq.def, Submodule.Quotient.eq]
#align smodeq.sub_mem SModEq.sub_mem
@[simp]
theorem top : x ≡ y [SMOD (⊤ : Submodule R M)] :=
(Submodule.Quotient.eq ⊤).2 mem_top
#align smodeq.top SModEq.top
@[simp]
theorem bot : x ≡ y [SMOD (⊥ : Submodule R M)] ↔ x = y := by
rw [SModEq.def, Submodule.Quotient.eq, mem_bot, sub_eq_zero]
#align smodeq.bot SModEq.bot
@[mono]
theorem mono (HU : U₁ ≤ U₂) (hxy : x ≡ y [SMOD U₁]) : x ≡ y [SMOD U₂] :=
(Submodule.Quotient.eq U₂).2 <| HU <| (Submodule.Quotient.eq U₁).1 hxy
#align smodeq.mono SModEq.mono
@[refl]
protected theorem refl (x : M) : x ≡ x [SMOD U] :=
@rfl _ _
#align smodeq.refl SModEq.refl
protected theorem rfl : x ≡ x [SMOD U] :=
SModEq.refl _
#align smodeq.rfl SModEq.rfl
instance : IsRefl _ (SModEq U) :=
⟨SModEq.refl⟩
@[symm]
nonrec theorem symm (hxy : x ≡ y [SMOD U]) : y ≡ x [SMOD U] :=
hxy.symm
#align smodeq.symm SModEq.symm
@[trans]
nonrec theorem trans (hxy : x ≡ y [SMOD U]) (hyz : y ≡ z [SMOD U]) : x ≡ z [SMOD U] :=
hxy.trans hyz
#align smodeq.trans SModEq.trans
instance instTrans : Trans (SModEq U) (SModEq U) (SModEq U) where
trans := trans
theorem add (hxy₁ : x₁ ≡ y₁ [SMOD U]) (hxy₂ : x₂ ≡ y₂ [SMOD U]) : x₁ + x₂ ≡ y₁ + y₂ [SMOD U] := by
rw [SModEq.def] at hxy₁ hxy₂ ⊢
simp_rw [Quotient.mk_add, hxy₁, hxy₂]
#align smodeq.add SModEq.add
theorem smul (hxy : x ≡ y [SMOD U]) (c : R) : c • x ≡ c • y [SMOD U] := by
rw [SModEq.def] at hxy ⊢
simp_rw [Quotient.mk_smul, hxy]
#align smodeq.smul SModEq.smul
theorem mul {I : Ideal A} {x₁ x₂ y₁ y₂ : A} (hxy₁ : x₁ ≡ y₁ [SMOD I])
(hxy₂ : x₂ ≡ y₂ [SMOD I]) : x₁ * x₂ ≡ y₁ * y₂ [SMOD I] := by
simp only [SModEq.def, Ideal.Quotient.mk_eq_mk, map_mul] at hxy₁ hxy₂ ⊢
rw [hxy₁, hxy₂]
| Mathlib/LinearAlgebra/SModEq.lean | 102 | 102 | theorem zero : x ≡ 0 [SMOD U] ↔ x ∈ U := by | rw [SModEq.def, Submodule.Quotient.eq, sub_zero]
|
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.Analysis.SumIntegralComparisons
import Mathlib.NumberTheory.Harmonic.Defs
theorem log_add_one_le_harmonic (n : ℕ) :
Real.log ↑(n+1) ≤ harmonic n := by
calc _ = ∫ x in (1:ℕ)..↑(n+1), x⁻¹ := ?_
_ ≤ ∑ d ∈ Finset.Icc 1 n, (d:ℝ)⁻¹ := ?_
_ = harmonic n := ?_
· rw [Nat.cast_one, integral_inv (by simp [(show ¬ (1 : ℝ) ≤ 0 by norm_num)]), div_one]
· exact (inv_antitoneOn_Icc_right <| by norm_num).integral_le_sum_Ico (Nat.le_add_left 1 n)
· simp only [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
theorem harmonic_le_one_add_log (n : ℕ) :
harmonic n ≤ 1 + Real.log n := by
by_cases hn0 : n = 0
· simp [hn0]
have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr hn0
simp_rw [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
rw [← Finset.sum_erase_add (Finset.Icc 1 n) _ (Finset.left_mem_Icc.mpr hn), add_comm,
Nat.cast_one, inv_one]
refine add_le_add_left ?_ 1
simp only [Nat.lt_one_iff, Finset.mem_Icc, Finset.Icc_erase_left]
calc ∑ d ∈ .Ico 2 (n + 1), (d : ℝ)⁻¹
_ = ∑ d ∈ .Ico 2 (n + 1), (↑(d + 1) - 1)⁻¹ := ?_
_ ≤ ∫ x in (2).. ↑(n + 1), (x - 1)⁻¹ := ?_
_ = ∫ x in (1)..n, x⁻¹ := ?_
_ = Real.log ↑n := ?_
· simp_rw [Nat.cast_add, Nat.cast_one, add_sub_cancel_right]
· exact @AntitoneOn.sum_le_integral_Ico 2 (n + 1) (fun x : ℝ ↦ (x - 1)⁻¹) (by linarith [hn]) <|
sub_inv_antitoneOn_Icc_right (by norm_num)
· convert intervalIntegral.integral_comp_sub_right _ 1
· norm_num
· simp only [Nat.cast_add, Nat.cast_one, add_sub_cancel_right]
· convert integral_inv _
· rw [div_one]
· simp only [Nat.one_le_cast, hn, Set.uIcc_of_le, Set.mem_Icc, Nat.cast_nonneg,
and_true, not_le, zero_lt_one]
theorem log_le_harmonic_floor (y : ℝ) (hy : 0 ≤ y) :
Real.log y ≤ harmonic ⌊y⌋₊ := by
by_cases h0 : y = 0
· simp [h0]
· calc
_ ≤ Real.log ↑(Nat.floor y + 1) := ?_
_ ≤ _ := log_add_one_le_harmonic _
gcongr
apply (Nat.le_ceil y).trans
norm_cast
exact Nat.ceil_le_floor_add_one y
| Mathlib/NumberTheory/Harmonic/Bounds.lean | 64 | 69 | theorem harmonic_floor_le_one_add_log (y : ℝ) (hy : 1 ≤ y) :
harmonic ⌊y⌋₊ ≤ 1 + Real.log y := by |
refine (harmonic_le_one_add_log _).trans ?_
gcongr
· exact_mod_cast Nat.floor_pos.mpr hy
· exact Nat.floor_le <| zero_le_one.trans hy
|
import Mathlib.Analysis.BoxIntegral.Box.Basic
import Mathlib.Analysis.SpecificLimits.Basic
#align_import analysis.box_integral.box.subbox_induction from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Finset Function Filter Metric Classical Topology Filter ENNReal
noncomputable section
namespace BoxIntegral
namespace Box
variable {ι : Type*} {I J : Box ι}
def splitCenterBox (I : Box ι) (s : Set ι) : Box ι where
lower := s.piecewise (fun i ↦ (I.lower i + I.upper i) / 2) I.lower
upper := s.piecewise I.upper fun i ↦ (I.lower i + I.upper i) / 2
lower_lt_upper i := by
dsimp only [Set.piecewise]
split_ifs <;> simp only [left_lt_add_div_two, add_div_two_lt_right, I.lower_lt_upper]
#align box_integral.box.split_center_box BoxIntegral.Box.splitCenterBox
theorem mem_splitCenterBox {s : Set ι} {y : ι → ℝ} :
y ∈ I.splitCenterBox s ↔ y ∈ I ∧ ∀ i, (I.lower i + I.upper i) / 2 < y i ↔ i ∈ s := by
simp only [splitCenterBox, mem_def, ← forall_and]
refine forall_congr' fun i ↦ ?_
dsimp only [Set.piecewise]
split_ifs with hs <;> simp only [hs, iff_true_iff, iff_false_iff, not_lt]
exacts [⟨fun H ↦ ⟨⟨(left_lt_add_div_two.2 (I.lower_lt_upper i)).trans H.1, H.2⟩, H.1⟩,
fun H ↦ ⟨H.2, H.1.2⟩⟩,
⟨fun H ↦ ⟨⟨H.1, H.2.trans (add_div_two_lt_right.2 (I.lower_lt_upper i)).le⟩, H.2⟩,
fun H ↦ ⟨H.1.1, H.2⟩⟩]
#align box_integral.box.mem_split_center_box BoxIntegral.Box.mem_splitCenterBox
theorem splitCenterBox_le (I : Box ι) (s : Set ι) : I.splitCenterBox s ≤ I :=
fun _ hx ↦ (mem_splitCenterBox.1 hx).1
#align box_integral.box.split_center_box_le BoxIntegral.Box.splitCenterBox_le
theorem disjoint_splitCenterBox (I : Box ι) {s t : Set ι} (h : s ≠ t) :
Disjoint (I.splitCenterBox s : Set (ι → ℝ)) (I.splitCenterBox t) := by
rw [disjoint_iff_inf_le]
rintro y ⟨hs, ht⟩; apply h
ext i
rw [mem_coe, mem_splitCenterBox] at hs ht
rw [← hs.2, ← ht.2]
#align box_integral.box.disjoint_split_center_box BoxIntegral.Box.disjoint_splitCenterBox
theorem injective_splitCenterBox (I : Box ι) : Injective I.splitCenterBox := fun _ _ H ↦
by_contra fun Hne ↦ (I.disjoint_splitCenterBox Hne).ne (nonempty_coe _).ne_empty (H ▸ rfl)
#align box_integral.box.injective_split_center_box BoxIntegral.Box.injective_splitCenterBox
@[simp]
theorem exists_mem_splitCenterBox {I : Box ι} {x : ι → ℝ} : (∃ s, x ∈ I.splitCenterBox s) ↔ x ∈ I :=
⟨fun ⟨s, hs⟩ ↦ I.splitCenterBox_le s hs, fun hx ↦
⟨{ i | (I.lower i + I.upper i) / 2 < x i }, mem_splitCenterBox.2 ⟨hx, fun _ ↦ Iff.rfl⟩⟩⟩
#align box_integral.box.exists_mem_split_center_box BoxIntegral.Box.exists_mem_splitCenterBox
@[simps]
def splitCenterBoxEmb (I : Box ι) : Set ι ↪ Box ι :=
⟨splitCenterBox I, injective_splitCenterBox I⟩
#align box_integral.box.split_center_box_emb BoxIntegral.Box.splitCenterBoxEmb
@[simp]
theorem iUnion_coe_splitCenterBox (I : Box ι) : ⋃ s, (I.splitCenterBox s : Set (ι → ℝ)) = I := by
ext x
simp
#align box_integral.box.Union_coe_split_center_box BoxIntegral.Box.iUnion_coe_splitCenterBox
@[simp]
theorem upper_sub_lower_splitCenterBox (I : Box ι) (s : Set ι) (i : ι) :
(I.splitCenterBox s).upper i - (I.splitCenterBox s).lower i = (I.upper i - I.lower i) / 2 := by
by_cases i ∈ s <;> field_simp [splitCenterBox] <;> field_simp [mul_two, two_mul]
#align box_integral.box.upper_sub_lower_split_center_box BoxIntegral.Box.upper_sub_lower_splitCenterBox
@[elab_as_elim]
| Mathlib/Analysis/BoxIntegral/Box/SubboxInduction.lean | 122 | 170 | theorem subbox_induction_on' {p : Box ι → Prop} (I : Box ι)
(H_ind : ∀ J ≤ I, (∀ s, p (splitCenterBox J s)) → p J)
(H_nhds : ∀ z ∈ Box.Icc I, ∃ U ∈ 𝓝[Box.Icc I] z, ∀ J ≤ I, ∀ (m : ℕ), z ∈ Box.Icc J →
Box.Icc J ⊆ U → (∀ i, J.upper i - J.lower i = (I.upper i - I.lower i) / 2 ^ m) → p J) :
p I := by |
by_contra hpI
-- First we use `H_ind` to construct a decreasing sequence of boxes such that `∀ m, ¬p (J m)`.
replace H_ind := fun J hJ ↦ not_imp_not.2 (H_ind J hJ)
simp only [exists_imp, not_forall] at H_ind
choose! s hs using H_ind
set J : ℕ → Box ι := fun m ↦ (fun J ↦ splitCenterBox J (s J))^[m] I
have J_succ : ∀ m, J (m + 1) = splitCenterBox (J m) (s <| J m) :=
fun m ↦ iterate_succ_apply' _ _ _
-- Now we prove some properties of `J`
have hJmono : Antitone J :=
antitone_nat_of_succ_le fun n ↦ by simpa [J_succ] using splitCenterBox_le _ _
have hJle : ∀ m, J m ≤ I := fun m ↦ hJmono (zero_le m)
have hJp : ∀ m, ¬p (J m) :=
fun m ↦ Nat.recOn m hpI fun m ↦ by simpa only [J_succ] using hs (J m) (hJle m)
have hJsub : ∀ m i, (J m).upper i - (J m).lower i = (I.upper i - I.lower i) / 2 ^ m := by
intro m i
induction' m with m ihm
· simp [J, Nat.zero_eq]
simp only [pow_succ, J_succ, upper_sub_lower_splitCenterBox, ihm, div_div]
have h0 : J 0 = I := rfl
clear_value J
clear hpI hs J_succ s
-- Let `z` be the unique common point of all `(J m).Icc`. Then `H_nhds` proves `p (J m)` for
-- sufficiently large `m`. This contradicts `hJp`.
set z : ι → ℝ := ⨆ m, (J m).lower
have hzJ : ∀ m, z ∈ Box.Icc (J m) :=
mem_iInter.1 (ciSup_mem_iInter_Icc_of_antitone_Icc
((@Box.Icc ι).monotone.comp_antitone hJmono) fun m ↦ (J m).lower_le_upper)
have hJl_mem : ∀ m, (J m).lower ∈ Box.Icc I := fun m ↦ le_iff_Icc.1 (hJle m) (J m).lower_mem_Icc
have hJu_mem : ∀ m, (J m).upper ∈ Box.Icc I := fun m ↦ le_iff_Icc.1 (hJle m) (J m).upper_mem_Icc
have hJlz : Tendsto (fun m ↦ (J m).lower) atTop (𝓝 z) :=
tendsto_atTop_ciSup (antitone_lower.comp hJmono) ⟨I.upper, fun x ⟨m, hm⟩ ↦ hm ▸ (hJl_mem m).2⟩
have hJuz : Tendsto (fun m ↦ (J m).upper) atTop (𝓝 z) := by
suffices Tendsto (fun m ↦ (J m).upper - (J m).lower) atTop (𝓝 0) by simpa using hJlz.add this
refine tendsto_pi_nhds.2 fun i ↦ ?_
simpa [hJsub] using
tendsto_const_nhds.div_atTop (tendsto_pow_atTop_atTop_of_one_lt _root_.one_lt_two)
replace hJlz : Tendsto (fun m ↦ (J m).lower) atTop (𝓝[Icc I.lower I.upper] z) :=
tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hJlz (eventually_of_forall hJl_mem)
replace hJuz : Tendsto (fun m ↦ (J m).upper) atTop (𝓝[Icc I.lower I.upper] z) :=
tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hJuz (eventually_of_forall hJu_mem)
rcases H_nhds z (h0 ▸ hzJ 0) with ⟨U, hUz, hU⟩
rcases (tendsto_lift'.1 (hJlz.Icc hJuz) U hUz).exists with ⟨m, hUm⟩
exact hJp m (hU (J m) (hJle m) m (hzJ m) hUm (hJsub m))
|
import Mathlib.Probability.Notation
import Mathlib.Probability.Process.Stopping
#align_import probability.martingale.basic from "leanprover-community/mathlib"@"ba074af83b6cf54c3104e59402b39410ddbd6dca"
open TopologicalSpace Filter
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory
namespace MeasureTheory
variable {Ω E ι : Type*} [Preorder ι] {m0 : MeasurableSpace Ω} {μ : Measure Ω}
[NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f g : ι → Ω → E} {ℱ : Filtration ι m0}
def Martingale (f : ι → Ω → E) (ℱ : Filtration ι m0) (μ : Measure Ω) : Prop :=
Adapted ℱ f ∧ ∀ i j, i ≤ j → μ[f j|ℱ i] =ᵐ[μ] f i
#align measure_theory.martingale MeasureTheory.Martingale
def Supermartingale [LE E] (f : ι → Ω → E) (ℱ : Filtration ι m0) (μ : Measure Ω) : Prop :=
Adapted ℱ f ∧ (∀ i j, i ≤ j → μ[f j|ℱ i] ≤ᵐ[μ] f i) ∧ ∀ i, Integrable (f i) μ
#align measure_theory.supermartingale MeasureTheory.Supermartingale
def Submartingale [LE E] (f : ι → Ω → E) (ℱ : Filtration ι m0) (μ : Measure Ω) : Prop :=
Adapted ℱ f ∧ (∀ i j, i ≤ j → f i ≤ᵐ[μ] μ[f j|ℱ i]) ∧ ∀ i, Integrable (f i) μ
#align measure_theory.submartingale MeasureTheory.Submartingale
theorem martingale_const (ℱ : Filtration ι m0) (μ : Measure Ω) [IsFiniteMeasure μ] (x : E) :
Martingale (fun _ _ => x) ℱ μ :=
⟨adapted_const ℱ _, fun i j _ => by rw [condexp_const (ℱ.le _)]⟩
#align measure_theory.martingale_const MeasureTheory.martingale_const
theorem martingale_const_fun [OrderBot ι] (ℱ : Filtration ι m0) (μ : Measure Ω) [IsFiniteMeasure μ]
{f : Ω → E} (hf : StronglyMeasurable[ℱ ⊥] f) (hfint : Integrable f μ) :
Martingale (fun _ => f) ℱ μ := by
refine ⟨fun i => hf.mono <| ℱ.mono bot_le, fun i j _ => ?_⟩
rw [condexp_of_stronglyMeasurable (ℱ.le _) (hf.mono <| ℱ.mono bot_le) hfint]
#align measure_theory.martingale_const_fun MeasureTheory.martingale_const_fun
variable (E)
theorem martingale_zero (ℱ : Filtration ι m0) (μ : Measure Ω) : Martingale (0 : ι → Ω → E) ℱ μ :=
⟨adapted_zero E ℱ, fun i j _ => by rw [Pi.zero_apply, condexp_zero]; simp⟩
#align measure_theory.martingale_zero MeasureTheory.martingale_zero
variable {E}
namespace Martingale
protected theorem adapted (hf : Martingale f ℱ μ) : Adapted ℱ f :=
hf.1
#align measure_theory.martingale.adapted MeasureTheory.Martingale.adapted
protected theorem stronglyMeasurable (hf : Martingale f ℱ μ) (i : ι) :
StronglyMeasurable[ℱ i] (f i) :=
hf.adapted i
#align measure_theory.martingale.strongly_measurable MeasureTheory.Martingale.stronglyMeasurable
theorem condexp_ae_eq (hf : Martingale f ℱ μ) {i j : ι} (hij : i ≤ j) : μ[f j|ℱ i] =ᵐ[μ] f i :=
hf.2 i j hij
#align measure_theory.martingale.condexp_ae_eq MeasureTheory.Martingale.condexp_ae_eq
protected theorem integrable (hf : Martingale f ℱ μ) (i : ι) : Integrable (f i) μ :=
integrable_condexp.congr (hf.condexp_ae_eq (le_refl i))
#align measure_theory.martingale.integrable MeasureTheory.Martingale.integrable
| Mathlib/Probability/Martingale/Basic.lean | 109 | 113 | theorem setIntegral_eq [SigmaFiniteFiltration μ ℱ] (hf : Martingale f ℱ μ) {i j : ι} (hij : i ≤ j)
{s : Set Ω} (hs : MeasurableSet[ℱ i] s) : ∫ ω in s, f i ω ∂μ = ∫ ω in s, f j ω ∂μ := by |
rw [← @setIntegral_condexp _ _ _ _ _ (ℱ i) m0 _ _ _ (ℱ.le i) _ (hf.integrable j) hs]
refine setIntegral_congr_ae (ℱ.le i s hs) ?_
filter_upwards [hf.2 i j hij] with _ heq _ using heq.symm
|
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Limits.Constructions.EpiMono
import Mathlib.CategoryTheory.Limits.Preserves.Limits
import Mathlib.CategoryTheory.Limits.Shapes.Types
#align_import category_theory.glue_data from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
noncomputable section
open CategoryTheory.Limits
namespace CategoryTheory
universe v u₁ u₂
variable (C : Type u₁) [Category.{v} C] {C' : Type u₂} [Category.{v} C']
-- Porting note(#5171): linter not ported yet
-- @[nolint has_nonempty_instance]
structure GlueData where
J : Type v
U : J → C
V : J × J → C
f : ∀ i j, V (i, j) ⟶ U i
f_mono : ∀ i j, Mono (f i j) := by infer_instance
f_hasPullback : ∀ i j k, HasPullback (f i j) (f i k) := by infer_instance
f_id : ∀ i, IsIso (f i i) := by infer_instance
t : ∀ i j, V (i, j) ⟶ V (j, i)
t_id : ∀ i, t i i = 𝟙 _
t' : ∀ i j k, pullback (f i j) (f i k) ⟶ pullback (f j k) (f j i)
t_fac : ∀ i j k, t' i j k ≫ pullback.snd = pullback.fst ≫ t i j
cocycle : ∀ i j k, t' i j k ≫ t' j k i ≫ t' k i j = 𝟙 _
#align category_theory.glue_data CategoryTheory.GlueData
attribute [simp] GlueData.t_id
attribute [instance] GlueData.f_id GlueData.f_mono GlueData.f_hasPullback
attribute [reassoc] GlueData.t_fac GlueData.cocycle
namespace GlueData
variable {C}
variable (D : GlueData C)
@[simp]
theorem t'_iij (i j : D.J) : D.t' i i j = (pullbackSymmetry _ _).hom := by
have eq₁ := D.t_fac i i j
have eq₂ := (IsIso.eq_comp_inv (D.f i i)).mpr (@pullback.condition _ _ _ _ _ _ (D.f i j) _)
rw [D.t_id, Category.comp_id, eq₂] at eq₁
have eq₃ := (IsIso.eq_comp_inv (D.f i i)).mp eq₁
rw [Category.assoc, ← pullback.condition, ← Category.assoc] at eq₃
exact
Mono.right_cancellation _ _
((Mono.right_cancellation _ _ eq₃).trans (pullbackSymmetry_hom_comp_fst _ _).symm)
#align category_theory.glue_data.t'_iij CategoryTheory.GlueData.t'_iij
theorem t'_jii (i j : D.J) : D.t' j i i = pullback.fst ≫ D.t j i ≫ inv pullback.snd := by
rw [← Category.assoc, ← D.t_fac]
simp
#align category_theory.glue_data.t'_jii CategoryTheory.GlueData.t'_jii
theorem t'_iji (i j : D.J) : D.t' i j i = pullback.fst ≫ D.t i j ≫ inv pullback.snd := by
rw [← Category.assoc, ← D.t_fac]
simp
#align category_theory.glue_data.t'_iji CategoryTheory.GlueData.t'_iji
@[reassoc, elementwise (attr := simp)]
theorem t_inv (i j : D.J) : D.t i j ≫ D.t j i = 𝟙 _ := by
have eq : (pullbackSymmetry (D.f i i) (D.f i j)).hom = pullback.snd ≫ inv pullback.fst := by simp
have := D.cocycle i j i
rw [D.t'_iij, D.t'_jii, D.t'_iji, fst_eq_snd_of_mono_eq, eq] at this
simp only [Category.assoc, IsIso.inv_hom_id_assoc] at this
rw [← IsIso.eq_inv_comp, ← Category.assoc, IsIso.comp_inv_eq] at this
simpa using this
#align category_theory.glue_data.t_inv CategoryTheory.GlueData.t_inv
theorem t'_inv (i j k : D.J) :
D.t' i j k ≫ (pullbackSymmetry _ _).hom ≫ D.t' j i k ≫ (pullbackSymmetry _ _).hom = 𝟙 _ := by
rw [← cancel_mono (pullback.fst : pullback (D.f i j) (D.f i k) ⟶ _)]
simp [t_fac, t_fac_assoc]
#align category_theory.glue_data.t'_inv CategoryTheory.GlueData.t'_inv
instance t_isIso (i j : D.J) : IsIso (D.t i j) :=
⟨⟨D.t j i, D.t_inv _ _, D.t_inv _ _⟩⟩
#align category_theory.glue_data.t_is_iso CategoryTheory.GlueData.t_isIso
instance t'_isIso (i j k : D.J) : IsIso (D.t' i j k) :=
⟨⟨D.t' j k i ≫ D.t' k i j, D.cocycle _ _ _, by simpa using D.cocycle _ _ _⟩⟩
#align category_theory.glue_data.t'_is_iso CategoryTheory.GlueData.t'_isIso
@[reassoc]
| Mathlib/CategoryTheory/GlueData.lean | 123 | 129 | theorem t'_comp_eq_pullbackSymmetry (i j k : D.J) :
D.t' j k i ≫ D.t' k i j =
(pullbackSymmetry _ _).hom ≫ D.t' j i k ≫ (pullbackSymmetry _ _).hom := by |
trans inv (D.t' i j k)
· exact IsIso.eq_inv_of_hom_inv_id (D.cocycle _ _ _)
· rw [← cancel_mono (pullback.fst : pullback (D.f i j) (D.f i k) ⟶ _)]
simp [t_fac, t_fac_assoc]
|
import Mathlib.Analysis.Complex.Circle
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
#align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
noncomputable section
open Complex
open ComplexConjugate
local notation "|" x "|" => Complex.abs x
def rotation : circle →* ℂ ≃ₗᵢ[ℝ] ℂ where
toFun a :=
{ DistribMulAction.toLinearEquiv ℝ ℂ a with
norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] }
map_one' := LinearIsometryEquiv.ext <| one_smul circle
map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b
#align rotation rotation
@[simp]
theorem rotation_apply (a : circle) (z : ℂ) : rotation a z = a * z :=
rfl
#align rotation_apply rotation_apply
@[simp]
theorem rotation_symm (a : circle) : (rotation a).symm = rotation a⁻¹ :=
LinearIsometryEquiv.ext fun _ => rfl
#align rotation_symm rotation_symm
@[simp]
| Mathlib/Analysis/Complex/Isometry.lean | 60 | 62 | theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by |
ext1
simp
|
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {α β K : Type*}
section DivisionSemiring
variable [DivisionSemiring α] {a b c d : α}
theorem add_div (a b c : α) : (a + b) / c = a / c + b / c := by simp_rw [div_eq_mul_inv, add_mul]
#align add_div add_div
@[field_simps]
theorem div_add_div_same (a b c : α) : a / c + b / c = (a + b) / c :=
(add_div _ _ _).symm
#align div_add_div_same div_add_div_same
theorem same_add_div (h : b ≠ 0) : (b + a) / b = 1 + a / b := by rw [← div_self h, add_div]
#align same_add_div same_add_div
theorem div_add_same (h : b ≠ 0) : (a + b) / b = a / b + 1 := by rw [← div_self h, add_div]
#align div_add_same div_add_same
theorem one_add_div (h : b ≠ 0) : 1 + a / b = (b + a) / b :=
(same_add_div h).symm
#align one_add_div one_add_div
theorem div_add_one (h : b ≠ 0) : a / b + 1 = (a + b) / b :=
(div_add_same h).symm
#align div_add_one div_add_one
theorem inv_add_inv' (ha : a ≠ 0) (hb : b ≠ 0) :
a⁻¹ + b⁻¹ = a⁻¹ * (a + b) * b⁻¹ :=
let _ := invertibleOfNonzero ha; let _ := invertibleOfNonzero hb; invOf_add_invOf a b
theorem one_div_mul_add_mul_one_div_eq_one_div_add_one_div (ha : a ≠ 0) (hb : b ≠ 0) :
1 / a * (a + b) * (1 / b) = 1 / a + 1 / b := by
simpa only [one_div] using (inv_add_inv' ha hb).symm
#align one_div_mul_add_mul_one_div_eq_one_div_add_one_div one_div_mul_add_mul_one_div_eq_one_div_add_one_div
theorem add_div_eq_mul_add_div (a b : α) (hc : c ≠ 0) : a + b / c = (a * c + b) / c :=
(eq_div_iff_mul_eq hc).2 <| by rw [right_distrib, div_mul_cancel₀ _ hc]
#align add_div_eq_mul_add_div add_div_eq_mul_add_div
@[field_simps]
| Mathlib/Algebra/Field/Basic.lean | 66 | 67 | theorem add_div' (a b c : α) (hc : c ≠ 0) : b + a / c = (b * c + a) / c := by |
rw [add_div, mul_div_cancel_right₀ _ hc]
|
import Mathlib.Logic.Pairwise
import Mathlib.Order.CompleteBooleanAlgebra
import Mathlib.Order.Directed
import Mathlib.Order.GaloisConnection
#align_import data.set.lattice from "leanprover-community/mathlib"@"b86832321b586c6ac23ef8cdef6a7a27e42b13bd"
open Function Set
universe u
variable {α β γ : Type*} {ι ι' ι₂ : Sort*} {κ κ₁ κ₂ : ι → Sort*} {κ' : ι' → Sort*}
namespace Set
theorem mem_iUnion₂ {x : γ} {s : ∀ i, κ i → Set γ} : (x ∈ ⋃ (i) (j), s i j) ↔ ∃ i j, x ∈ s i j := by
simp_rw [mem_iUnion]
#align set.mem_Union₂ Set.mem_iUnion₂
theorem mem_iInter₂ {x : γ} {s : ∀ i, κ i → Set γ} : (x ∈ ⋂ (i) (j), s i j) ↔ ∀ i j, x ∈ s i j := by
simp_rw [mem_iInter]
#align set.mem_Inter₂ Set.mem_iInter₂
theorem mem_iUnion_of_mem {s : ι → Set α} {a : α} (i : ι) (ha : a ∈ s i) : a ∈ ⋃ i, s i :=
mem_iUnion.2 ⟨i, ha⟩
#align set.mem_Union_of_mem Set.mem_iUnion_of_mem
theorem mem_iUnion₂_of_mem {s : ∀ i, κ i → Set α} {a : α} {i : ι} (j : κ i) (ha : a ∈ s i j) :
a ∈ ⋃ (i) (j), s i j :=
mem_iUnion₂.2 ⟨i, j, ha⟩
#align set.mem_Union₂_of_mem Set.mem_iUnion₂_of_mem
theorem mem_iInter_of_mem {s : ι → Set α} {a : α} (h : ∀ i, a ∈ s i) : a ∈ ⋂ i, s i :=
mem_iInter.2 h
#align set.mem_Inter_of_mem Set.mem_iInter_of_mem
theorem mem_iInter₂_of_mem {s : ∀ i, κ i → Set α} {a : α} (h : ∀ i j, a ∈ s i j) :
a ∈ ⋂ (i) (j), s i j :=
mem_iInter₂.2 h
#align set.mem_Inter₂_of_mem Set.mem_iInter₂_of_mem
instance completeAtomicBooleanAlgebra : CompleteAtomicBooleanAlgebra (Set α) :=
{ instBooleanAlgebraSet with
le_sSup := fun s t t_in a a_in => ⟨t, t_in, a_in⟩
sSup_le := fun s t h a ⟨t', ⟨t'_in, a_in⟩⟩ => h t' t'_in a_in
le_sInf := fun s t h a a_in t' t'_in => h t' t'_in a_in
sInf_le := fun s t t_in a h => h _ t_in
iInf_iSup_eq := by intros; ext; simp [Classical.skolem] }
instance : OrderTop (Set α) where
top := univ
le_top := by simp
@[congr]
theorem iUnion_congr_Prop {p q : Prop} {f₁ : p → Set α} {f₂ : q → Set α} (pq : p ↔ q)
(f : ∀ x, f₁ (pq.mpr x) = f₂ x) : iUnion f₁ = iUnion f₂ :=
iSup_congr_Prop pq f
#align set.Union_congr_Prop Set.iUnion_congr_Prop
@[congr]
theorem iInter_congr_Prop {p q : Prop} {f₁ : p → Set α} {f₂ : q → Set α} (pq : p ↔ q)
(f : ∀ x, f₁ (pq.mpr x) = f₂ x) : iInter f₁ = iInter f₂ :=
iInf_congr_Prop pq f
#align set.Inter_congr_Prop Set.iInter_congr_Prop
theorem iUnion_plift_up (f : PLift ι → Set α) : ⋃ i, f (PLift.up i) = ⋃ i, f i :=
iSup_plift_up _
#align set.Union_plift_up Set.iUnion_plift_up
theorem iUnion_plift_down (f : ι → Set α) : ⋃ i, f (PLift.down i) = ⋃ i, f i :=
iSup_plift_down _
#align set.Union_plift_down Set.iUnion_plift_down
theorem iInter_plift_up (f : PLift ι → Set α) : ⋂ i, f (PLift.up i) = ⋂ i, f i :=
iInf_plift_up _
#align set.Inter_plift_up Set.iInter_plift_up
theorem iInter_plift_down (f : ι → Set α) : ⋂ i, f (PLift.down i) = ⋂ i, f i :=
iInf_plift_down _
#align set.Inter_plift_down Set.iInter_plift_down
theorem iUnion_eq_if {p : Prop} [Decidable p] (s : Set α) : ⋃ _ : p, s = if p then s else ∅ :=
iSup_eq_if _
#align set.Union_eq_if Set.iUnion_eq_if
theorem iUnion_eq_dif {p : Prop} [Decidable p] (s : p → Set α) :
⋃ h : p, s h = if h : p then s h else ∅ :=
iSup_eq_dif _
#align set.Union_eq_dif Set.iUnion_eq_dif
theorem iInter_eq_if {p : Prop} [Decidable p] (s : Set α) : ⋂ _ : p, s = if p then s else univ :=
iInf_eq_if _
#align set.Inter_eq_if Set.iInter_eq_if
theorem iInf_eq_dif {p : Prop} [Decidable p] (s : p → Set α) :
⋂ h : p, s h = if h : p then s h else univ :=
_root_.iInf_eq_dif _
#align set.Infi_eq_dif Set.iInf_eq_dif
| Mathlib/Data/Set/Lattice.lean | 207 | 211 | theorem exists_set_mem_of_union_eq_top {ι : Type*} (t : Set ι) (s : ι → Set β)
(w : ⋃ i ∈ t, s i = ⊤) (x : β) : ∃ i ∈ t, x ∈ s i := by |
have p : x ∈ ⊤ := Set.mem_univ x
rw [← w, Set.mem_iUnion] at p
simpa using p
|
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.Data.Nat.Lattice
#align_import combinatorics.simple_graph.metric from "leanprover-community/mathlib"@"352ecfe114946c903338006dd3287cb5a9955ff2"
namespace SimpleGraph
variable {V : Type*} (G : SimpleGraph V)
noncomputable def dist (u v : V) : ℕ :=
sInf (Set.range (Walk.length : G.Walk u v → ℕ))
#align simple_graph.dist SimpleGraph.dist
variable {G}
protected theorem Reachable.exists_walk_of_dist {u v : V} (hr : G.Reachable u v) :
∃ p : G.Walk u v, p.length = G.dist u v :=
Nat.sInf_mem (Set.range_nonempty_iff_nonempty.mpr hr)
#align simple_graph.reachable.exists_walk_of_dist SimpleGraph.Reachable.exists_walk_of_dist
protected theorem Connected.exists_walk_of_dist (hconn : G.Connected) (u v : V) :
∃ p : G.Walk u v, p.length = G.dist u v :=
(hconn u v).exists_walk_of_dist
#align simple_graph.connected.exists_walk_of_dist SimpleGraph.Connected.exists_walk_of_dist
theorem dist_le {u v : V} (p : G.Walk u v) : G.dist u v ≤ p.length :=
Nat.sInf_le ⟨p, rfl⟩
#align simple_graph.dist_le SimpleGraph.dist_le
@[simp]
theorem dist_eq_zero_iff_eq_or_not_reachable {u v : V} :
G.dist u v = 0 ↔ u = v ∨ ¬G.Reachable u v := by simp [dist, Nat.sInf_eq_zero, Reachable]
#align simple_graph.dist_eq_zero_iff_eq_or_not_reachable SimpleGraph.dist_eq_zero_iff_eq_or_not_reachable
theorem dist_self {v : V} : dist G v v = 0 := by simp
#align simple_graph.dist_self SimpleGraph.dist_self
protected theorem Reachable.dist_eq_zero_iff {u v : V} (hr : G.Reachable u v) :
G.dist u v = 0 ↔ u = v := by simp [hr]
#align simple_graph.reachable.dist_eq_zero_iff SimpleGraph.Reachable.dist_eq_zero_iff
protected theorem Reachable.pos_dist_of_ne {u v : V} (h : G.Reachable u v) (hne : u ≠ v) :
0 < G.dist u v :=
Nat.pos_of_ne_zero (by simp [h, hne])
#align simple_graph.reachable.pos_dist_of_ne SimpleGraph.Reachable.pos_dist_of_ne
protected theorem Connected.dist_eq_zero_iff (hconn : G.Connected) {u v : V} :
G.dist u v = 0 ↔ u = v := by simp [hconn u v]
#align simple_graph.connected.dist_eq_zero_iff SimpleGraph.Connected.dist_eq_zero_iff
protected theorem Connected.pos_dist_of_ne {u v : V} (hconn : G.Connected) (hne : u ≠ v) :
0 < G.dist u v :=
Nat.pos_of_ne_zero (by intro h; exact False.elim (hne (hconn.dist_eq_zero_iff.mp h)))
#align simple_graph.connected.pos_dist_of_ne SimpleGraph.Connected.pos_dist_of_ne
theorem dist_eq_zero_of_not_reachable {u v : V} (h : ¬G.Reachable u v) : G.dist u v = 0 := by
simp [h]
#align simple_graph.dist_eq_zero_of_not_reachable SimpleGraph.dist_eq_zero_of_not_reachable
theorem nonempty_of_pos_dist {u v : V} (h : 0 < G.dist u v) :
(Set.univ : Set (G.Walk u v)).Nonempty := by
simpa [Set.range_nonempty_iff_nonempty, Set.nonempty_iff_univ_nonempty] using
Nat.nonempty_of_pos_sInf h
#align simple_graph.nonempty_of_pos_dist SimpleGraph.nonempty_of_pos_dist
protected theorem Connected.dist_triangle (hconn : G.Connected) {u v w : V} :
G.dist u w ≤ G.dist u v + G.dist v w := by
obtain ⟨p, hp⟩ := hconn.exists_walk_of_dist u v
obtain ⟨q, hq⟩ := hconn.exists_walk_of_dist v w
rw [← hp, ← hq, ← Walk.length_append]
apply dist_le
#align simple_graph.connected.dist_triangle SimpleGraph.Connected.dist_triangle
private theorem dist_comm_aux {u v : V} (h : G.Reachable u v) : G.dist u v ≤ G.dist v u := by
obtain ⟨p, hp⟩ := h.symm.exists_walk_of_dist
rw [← hp, ← Walk.length_reverse]
apply dist_le
theorem dist_comm {u v : V} : G.dist u v = G.dist v u := by
by_cases h : G.Reachable u v
· apply le_antisymm (dist_comm_aux h) (dist_comm_aux h.symm)
· have h' : ¬G.Reachable v u := fun h' => absurd h'.symm h
simp [h, h', dist_eq_zero_of_not_reachable]
#align simple_graph.dist_comm SimpleGraph.dist_comm
lemma dist_ne_zero_iff_ne_and_reachable {u v : V} : G.dist u v ≠ 0 ↔ u ≠ v ∧ G.Reachable u v := by
rw [ne_eq, dist_eq_zero_iff_eq_or_not_reachable.not]
push_neg; rfl
lemma Reachable.of_dist_ne_zero {u v : V} (h : G.dist u v ≠ 0) : G.Reachable u v :=
(dist_ne_zero_iff_ne_and_reachable.mp h).2
lemma exists_walk_of_dist_ne_zero {u v : V} (h : G.dist u v ≠ 0) :
∃ p : G.Walk u v, p.length = G.dist u v :=
(Reachable.of_dist_ne_zero h).exists_walk_of_dist
| Mathlib/Combinatorics/SimpleGraph/Metric.lean | 137 | 142 | theorem dist_eq_one_iff_adj {u v : V} : G.dist u v = 1 ↔ G.Adj u v := by |
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· let ⟨w, hw⟩ := exists_walk_of_dist_ne_zero <| ne_zero_of_eq_one h
exact w.adj_of_length_eq_one <| h ▸ hw
· have : h.toWalk.length = 1 := Walk.length_cons _ _
exact ge_antisymm (h.reachable.pos_dist_of_ne h.ne) (this ▸ dist_le _)
|
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Combinatorics.SimpleGraph.Maps
open Finset
namespace SimpleGraph
variable {V : Type*} [DecidableEq V] (G : SimpleGraph V) (s t : V)
section AddEdge
def edge : SimpleGraph V := fromEdgeSet {s(s, t)}
lemma edge_adj (v w : V) : (edge s t).Adj v w ↔ (v = s ∧ w = t ∨ v = t ∧ w = s) ∧ v ≠ w := by
rw [edge, fromEdgeSet_adj, Set.mem_singleton_iff, Sym2.eq_iff]
instance : DecidableRel (edge s t).Adj := fun _ _ ↦ by
rw [edge_adj]; infer_instance
lemma edge_self_eq_bot : edge s s = ⊥ := by
ext; rw [edge_adj]; aesop
@[simp]
lemma sup_edge_self : G ⊔ edge s s = G := by
rw [edge_self_eq_bot, sup_of_le_left bot_le]
variable {s t}
lemma edge_edgeSet_of_ne (h : s ≠ t) : (edge s t).edgeSet = {s(s, t)} := by
rwa [edge, edgeSet_fromEdgeSet, sdiff_eq_left, Set.disjoint_singleton_left, Set.mem_setOf_eq,
Sym2.isDiag_iff_proj_eq]
lemma sup_edge_of_adj (h : G.Adj s t) : G ⊔ edge s t = G := by
rwa [sup_eq_left, ← edgeSet_subset_edgeSet, edge_edgeSet_of_ne h.ne, Set.singleton_subset_iff,
mem_edgeSet]
variable [Fintype V] [DecidableRel G.Adj]
instance : Fintype (edge s t).edgeSet := by rw [edge]; infer_instance
| Mathlib/Combinatorics/SimpleGraph/Operations.lean | 171 | 175 | theorem edgeFinset_sup_edge [Fintype (edgeSet (G ⊔ edge s t))] (hn : ¬G.Adj s t) (h : s ≠ t) :
(G ⊔ edge s t).edgeFinset = G.edgeFinset.cons s(s, t) (by simp_all) := by |
letI := Classical.decEq V
rw [edgeFinset_sup, cons_eq_insert, insert_eq, union_comm]
simp_rw [edgeFinset, edge_edgeSet_of_ne h]; rfl
|
import Mathlib.Data.Set.Image
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.with_bot_top from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
variable {α : Type*}
namespace WithTop
@[simp]
theorem preimage_coe_top : (some : α → WithTop α) ⁻¹' {⊤} = (∅ : Set α) :=
eq_empty_of_subset_empty fun _ => coe_ne_top
#align with_top.preimage_coe_top WithTop.preimage_coe_top
variable [Preorder α] {a b : α}
theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by
ext x
rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists]
#align with_top.range_coe WithTop.range_coe
@[simp]
theorem preimage_coe_Ioi : (some : α → WithTop α) ⁻¹' Ioi a = Ioi a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Ioi WithTop.preimage_coe_Ioi
@[simp]
theorem preimage_coe_Ici : (some : α → WithTop α) ⁻¹' Ici a = Ici a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Ici WithTop.preimage_coe_Ici
@[simp]
theorem preimage_coe_Iio : (some : α → WithTop α) ⁻¹' Iio a = Iio a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Iio WithTop.preimage_coe_Iio
@[simp]
theorem preimage_coe_Iic : (some : α → WithTop α) ⁻¹' Iic a = Iic a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Iic WithTop.preimage_coe_Iic
@[simp]
theorem preimage_coe_Icc : (some : α → WithTop α) ⁻¹' Icc a b = Icc a b := by simp [← Ici_inter_Iic]
#align with_top.preimage_coe_Icc WithTop.preimage_coe_Icc
@[simp]
theorem preimage_coe_Ico : (some : α → WithTop α) ⁻¹' Ico a b = Ico a b := by simp [← Ici_inter_Iio]
#align with_top.preimage_coe_Ico WithTop.preimage_coe_Ico
@[simp]
| Mathlib/Order/Interval/Set/WithBotTop.lean | 67 | 67 | theorem preimage_coe_Ioc : (some : α → WithTop α) ⁻¹' Ioc a b = Ioc a b := by | simp [← Ioi_inter_Iic]
|
import Mathlib.Algebra.Group.Defs
import Mathlib.Algebra.GroupWithZero.Defs
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Tactic.Spread
import Mathlib.Util.AssertExists
#align_import algebra.ring.defs from "leanprover-community/mathlib"@"76de8ae01554c3b37d66544866659ff174e66e1f"
universe u v w x
variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x}
open Function
class Distrib (R : Type*) extends Mul R, Add R where
protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
#align distrib Distrib
class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
#align left_distrib_class LeftDistribClass
class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
#align right_distrib_class RightDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R :=
⟨Distrib.left_distrib⟩
#align distrib.left_distrib_class Distrib.leftDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] :
RightDistribClass R :=
⟨Distrib.right_distrib⟩
#align distrib.right_distrib_class Distrib.rightDistribClass
theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) :
a * (b + c) = a * b + a * c :=
LeftDistribClass.left_distrib a b c
#align left_distrib left_distrib
alias mul_add := left_distrib
#align mul_add mul_add
theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) :
(a + b) * c = a * c + b * c :=
RightDistribClass.right_distrib a b c
#align right_distrib right_distrib
alias add_mul := right_distrib
#align add_mul add_mul
theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) :
(a + b + c) * d = a * d + b * d + c * d := by simp [right_distrib]
#align distrib_three_right distrib_three_right
class NonUnitalNonAssocSemiring (α : Type u) extends AddCommMonoid α, Distrib α, MulZeroClass α
#align non_unital_non_assoc_semiring NonUnitalNonAssocSemiring
class NonUnitalSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, SemigroupWithZero α
#align non_unital_semiring NonUnitalSemiring
class NonAssocSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, MulZeroOneClass α,
AddCommMonoidWithOne α
#align non_assoc_semiring NonAssocSemiring
class NonUnitalNonAssocRing (α : Type u) extends AddCommGroup α, NonUnitalNonAssocSemiring α
#align non_unital_non_assoc_ring NonUnitalNonAssocRing
class NonUnitalRing (α : Type*) extends NonUnitalNonAssocRing α, NonUnitalSemiring α
#align non_unital_ring NonUnitalRing
class NonAssocRing (α : Type*) extends NonUnitalNonAssocRing α, NonAssocSemiring α,
AddCommGroupWithOne α
#align non_assoc_ring NonAssocRing
class Semiring (α : Type u) extends NonUnitalSemiring α, NonAssocSemiring α, MonoidWithZero α
#align semiring Semiring
class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R
#align ring Ring
@[to_additive]
theorem mul_ite {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
(a * if P then b else c) = if P then a * b else a * c := by split_ifs <;> rfl
#align mul_ite mul_ite
#align add_ite add_ite
@[to_additive]
theorem ite_mul {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
(if P then a else b) * c = if P then a * c else b * c := by split_ifs <;> rfl
#align ite_mul ite_mul
#align ite_add ite_add
-- We make `mul_ite` and `ite_mul` simp lemmas,
-- but not `add_ite` or `ite_add`.
-- The problem we're trying to avoid is dealing with
-- summations of the form `∑ x ∈ s, (f x + ite P 1 0)`,
-- in which `add_ite` followed by `sum_ite` would needlessly slice up
-- the `f x` terms according to whether `P` holds at `x`.
-- There doesn't appear to be a corresponding difficulty so far with
-- `mul_ite` and `ite_mul`.
attribute [simp] mul_ite ite_mul
theorem ite_sub_ite {α} [Sub α] (P : Prop) [Decidable P] (a b c d : α) :
((if P then a else b) - if P then c else d) = if P then a - c else b - d := by
split
repeat rfl
theorem ite_add_ite {α} [Add α] (P : Prop) [Decidable P] (a b c d : α) :
((if P then a else b) + if P then c else d) = if P then a + c else b + d := by
split
repeat rfl
-- Porting note: no @[simp] because simp proves it
| Mathlib/Algebra/Ring/Defs.lean | 244 | 245 | theorem mul_boole {α} [MulZeroOneClass α] (P : Prop) [Decidable P] (a : α) :
(a * if P then 1 else 0) = if P then a else 0 := by | simp
|
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Algebra.MonoidAlgebra.Support
import Mathlib.Algebra.DirectSum.Internal
import Mathlib.RingTheory.GradedAlgebra.Basic
#align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3"
noncomputable section
namespace AddMonoidAlgebra
variable {M : Type*} {ι : Type*} {R : Type*}
section
variable (R) [CommSemiring R]
abbrev gradeBy (f : M → ι) (i : ι) : Submodule R R[M] where
carrier := { a | ∀ m, m ∈ a.support → f m = i }
zero_mem' m h := by cases h
add_mem' {a b} ha hb m h := by
classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m)
smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h
#align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy
abbrev grade (m : M) : Submodule R R[M] :=
gradeBy R id m
#align add_monoid_algebra.grade AddMonoidAlgebra.grade
theorem gradeBy_id : gradeBy R (id : M → M) = grade R := rfl
#align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id
theorem mem_gradeBy_iff (f : M → ι) (i : ι) (a : R[M]) :
a ∈ gradeBy R f i ↔ (a.support : Set M) ⊆ f ⁻¹' {i} := by rfl
#align add_monoid_algebra.mem_grade_by_iff AddMonoidAlgebra.mem_gradeBy_iff
theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.support ⊆ {m} := by
rw [← Finset.coe_subset, Finset.coe_singleton]
rfl
#align add_monoid_algebra.mem_grade_iff AddMonoidAlgebra.mem_grade_iff
| Mathlib/Algebra/MonoidAlgebra/Grading.lean | 72 | 78 | theorem mem_grade_iff' (m : M) (a : R[M]) :
a ∈ grade R m ↔ a ∈ (LinearMap.range (Finsupp.lsingle m : R →ₗ[R] M →₀ R) :
Submodule R R[M]) := by |
rw [mem_grade_iff, Finsupp.support_subset_singleton']
apply exists_congr
intro r
constructor <;> exact Eq.symm
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.