Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.57k | proof stringlengths 5 7.36k | hint bool 2 classes |
|---|---|---|---|---|---|---|
import Mathlib.Algebra.Order.ToIntervalMod
import Mathlib.Algebra.Ring.AddAut
import Mathlib.Data.Nat.Totient
import Mathlib.GroupTheory.Divisible
import Mathlib.Topology.Connected.PathConnected
import Mathlib.Topology.IsLocalHomeomorph
#align_import topology.instances.add_circle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
noncomputable section
open AddCommGroup Set Function AddSubgroup TopologicalSpace
open Topology
variable {𝕜 B : Type*}
section Continuity
variable [LinearOrderedAddCommGroup 𝕜] [Archimedean 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜]
{p : 𝕜} (hp : 0 < p) (a x : 𝕜)
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
intro s h
rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
obtain ⟨l, u, hxI, hIs⟩ := h
let d := toIcoDiv hp a x • p
have hd := toIcoMod_mem_Ico hp a x
simp_rw [subset_def, mem_inter_iff]
refine ⟨_, ⟨l + d, min (a + p) u + d, ?_, fun x => id⟩, fun y => ?_⟩ <;>
simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
· exact ⟨hxI.1, hd.2, hxI.2⟩
· rintro ⟨h, h'⟩
apply hIs
rw [← toIcoMod_sub_zsmul, (toIcoMod_eq_self _).2]
exacts [⟨h.1, h.2.2⟩, ⟨hd.1.trans (sub_le_sub_right h' _), h.2.1⟩]
#align continuous_right_to_Ico_mod continuous_right_toIcoMod
| Mathlib/Topology/Instances/AddCircle.lean | 82 | 89 | theorem continuous_left_toIocMod : ContinuousWithinAt (toIocMod hp a) (Iic x) x := by |
rw [(funext fun y => Eq.trans (by rw [neg_neg]) <| toIocMod_neg _ _ _ :
toIocMod hp a = (fun x => p - x) ∘ toIcoMod hp (-a) ∘ Neg.neg)]
-- Porting note: added
have : ContinuousNeg 𝕜 := TopologicalAddGroup.toContinuousNeg
exact
(continuous_sub_left _).continuousAt.comp_continuousWithinAt <|
(continuous_right_toIcoMod _ _ _).comp continuous_neg.continuousWithinAt fun y => neg_le_neg
| false |
import Mathlib.Analysis.Calculus.Deriv.AffineMap
import Mathlib.Analysis.Calculus.Deriv.Slope
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Comp
import Mathlib.Analysis.Calculus.LocalExtr.Rolle
import Mathlib.Analysis.Convex.Normed
import Mathlib.Analysis.RCLike.Basic
#align_import analysis.calculus.mean_value from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics ContinuousLinearMap Filter
open scoped Classical Topology NNReal
| Mathlib/Analysis/Calculus/MeanValue.lean | 92 | 124 | theorem image_le_of_liminf_slope_right_lt_deriv_boundary' {f f' : ℝ → ℝ} {a b : ℝ}
(hf : ContinuousOn f (Icc a b))
-- `hf'` actually says `liminf (f z - f x) / (z - x) ≤ f' x`
(hf' : ∀ x ∈ Ico a b, ∀ r, f' x < r → ∃ᶠ z in 𝓝[>] x, slope f x z < r)
{B B' : ℝ → ℝ} (ha : f a ≤ B a) (hB : ContinuousOn B (Icc a b))
(hB' : ∀ x ∈ Ico a b, HasDerivWithinAt B (B' x) (Ici x) x)
(bound : ∀ x ∈ Ico a b, f x = B x → f' x < B' x) : ∀ ⦃x⦄, x ∈ Icc a b → f x ≤ B x := by |
change Icc a b ⊆ { x | f x ≤ B x }
set s := { x | f x ≤ B x } ∩ Icc a b
have A : ContinuousOn (fun x => (f x, B x)) (Icc a b) := hf.prod hB
have : IsClosed s := by
simp only [s, inter_comm]
exact A.preimage_isClosed_of_isClosed isClosed_Icc OrderClosedTopology.isClosed_le'
apply this.Icc_subset_of_forall_exists_gt ha
rintro x ⟨hxB : f x ≤ B x, xab⟩ y hy
cases' hxB.lt_or_eq with hxB hxB
· -- If `f x < B x`, then all we need is continuity of both sides
refine nonempty_of_mem (inter_mem ?_ (Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, hy⟩))
have : ∀ᶠ x in 𝓝[Icc a b] x, f x < B x :=
A x (Ico_subset_Icc_self xab) (IsOpen.mem_nhds (isOpen_lt continuous_fst continuous_snd) hxB)
have : ∀ᶠ x in 𝓝[>] x, f x < B x := nhdsWithin_le_of_mem (Icc_mem_nhdsWithin_Ioi xab) this
exact this.mono fun y => le_of_lt
· rcases exists_between (bound x xab hxB) with ⟨r, hfr, hrB⟩
specialize hf' x xab r hfr
have HB : ∀ᶠ z in 𝓝[>] x, r < slope B x z :=
(hasDerivWithinAt_iff_tendsto_slope' <| lt_irrefl x).1 (hB' x xab).Ioi_of_Ici
(Ioi_mem_nhds hrB)
obtain ⟨z, hfz, hzB, hz⟩ : ∃ z, slope f x z < r ∧ r < slope B x z ∧ z ∈ Ioc x y :=
(hf'.and_eventually (HB.and (Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, hy⟩))).exists
refine ⟨z, ?_, hz⟩
have := (hfz.trans hzB).le
rwa [slope_def_field, slope_def_field, div_le_div_right (sub_pos.2 hz.1), hxB,
sub_le_sub_iff_right] at this
| false |
import Mathlib.Topology.Separation
import Mathlib.Algebra.Group.Defs
#align_import topology.algebra.semigroup from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
@[to_additive
"Any nonempty compact Hausdorff additive semigroup where right-addition is continuous
contains an idempotent, i.e. an `m` such that `m + m = m`"]
| Mathlib/Topology/Algebra/Semigroup.lean | 27 | 72 | theorem exists_idempotent_of_compact_t2_of_continuous_mul_left {M} [Nonempty M] [Semigroup M]
[TopologicalSpace M] [CompactSpace M] [T2Space M]
(continuous_mul_left : ∀ r : M, Continuous (· * r)) : ∃ m : M, m * m = m := by |
/- We apply Zorn's lemma to the poset of nonempty closed subsemigroups of `M`.
It will turn out that any minimal element is `{m}` for an idempotent `m : M`. -/
let S : Set (Set M) :=
{ N | IsClosed N ∧ N.Nonempty ∧ ∀ (m) (_ : m ∈ N) (m') (_ : m' ∈ N), m * m' ∈ N }
rsuffices ⟨N, ⟨N_closed, ⟨m, hm⟩, N_mul⟩, N_minimal⟩ : ∃ N ∈ S, ∀ N' ∈ S, N' ⊆ N → N' = N
· use m
/- We now have an element `m : M` of a minimal subsemigroup `N`, and want to show `m + m = m`.
We first show that every element of `N` is of the form `m' + m`. -/
have scaling_eq_self : (· * m) '' N = N := by
apply N_minimal
· refine ⟨(continuous_mul_left m).isClosedMap _ N_closed, ⟨_, ⟨m, hm, rfl⟩⟩, ?_⟩
rintro _ ⟨m'', hm'', rfl⟩ _ ⟨m', hm', rfl⟩
exact ⟨m'' * m * m', N_mul _ (N_mul _ hm'' _ hm) _ hm', mul_assoc _ _ _⟩
· rintro _ ⟨m', hm', rfl⟩
exact N_mul _ hm' _ hm
/- In particular, this means that `m' * m = m` for some `m'`. We now use minimality again
to show that this holds for all `m' ∈ N`. -/
have absorbing_eq_self : N ∩ { m' | m' * m = m } = N := by
apply N_minimal
· refine ⟨N_closed.inter ((T1Space.t1 m).preimage (continuous_mul_left m)), ?_, ?_⟩
· rwa [← scaling_eq_self] at hm
· rintro m'' ⟨mem'', eq'' : _ = m⟩ m' ⟨mem', eq' : _ = m⟩
refine ⟨N_mul _ mem'' _ mem', ?_⟩
rw [Set.mem_setOf_eq, mul_assoc, eq', eq'']
apply Set.inter_subset_left
-- Thus `m * m = m` as desired.
rw [← absorbing_eq_self] at hm
exact hm.2
refine zorn_superset _ fun c hcs hc => ?_
refine
⟨⋂₀ c, ⟨isClosed_sInter fun t ht => (hcs ht).1, ?_, fun m hm m' hm' => ?_⟩, fun s hs =>
Set.sInter_subset_of_mem hs⟩
· obtain rfl | hcnemp := c.eq_empty_or_nonempty
· rw [Set.sInter_empty]
apply Set.univ_nonempty
convert
@IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ _ _ hcnemp.coe_sort
((↑) : c → Set M) ?_ ?_ ?_ ?_
· exact Set.sInter_eq_iInter
· refine DirectedOn.directed_val (IsChain.directedOn hc.symm)
exacts [fun i => (hcs i.prop).2.1, fun i => (hcs i.prop).1.isCompact, fun i => (hcs i.prop).1]
· rw [Set.mem_sInter]
exact fun t ht => (hcs ht).2.2 m (Set.mem_sInter.mp hm t ht) m' (Set.mem_sInter.mp hm' t ht)
| false |
import Mathlib.MeasureTheory.Measure.Dirac
set_option autoImplicit true
open Set
open scoped ENNReal Classical
variable [MeasurableSpace α] [MeasurableSpace β] {s : Set α}
noncomputable section
namespace MeasureTheory.Measure
def count : Measure α :=
sum dirac
#align measure_theory.measure.count MeasureTheory.Measure.count
theorem le_count_apply : ∑' _ : s, (1 : ℝ≥0∞) ≤ count s :=
calc
(∑' _ : s, 1 : ℝ≥0∞) = ∑' i, indicator s 1 i := tsum_subtype s 1
_ ≤ ∑' i, dirac i s := ENNReal.tsum_le_tsum fun _ => le_dirac_apply
_ ≤ count s := le_sum_apply _ _
#align measure_theory.measure.le_count_apply MeasureTheory.Measure.le_count_apply
| Mathlib/MeasureTheory/Measure/Count.lean | 39 | 40 | theorem count_apply (hs : MeasurableSet s) : count s = ∑' i : s, 1 := by |
simp only [count, sum_apply, hs, dirac_apply', ← tsum_subtype s (1 : α → ℝ≥0∞), Pi.one_apply]
| false |
import Mathlib.SetTheory.Game.State
#align_import set_theory.game.domineering from "leanprover-community/mathlib"@"b134b2f5cf6dd25d4bbfd3c498b6e36c11a17225"
namespace SetTheory
namespace PGame
namespace Domineering
open Function
@[simps!]
def shiftUp : ℤ × ℤ ≃ ℤ × ℤ :=
(Equiv.refl ℤ).prodCongr (Equiv.addRight (1 : ℤ))
#align pgame.domineering.shift_up SetTheory.PGame.Domineering.shiftUp
@[simps!]
def shiftRight : ℤ × ℤ ≃ ℤ × ℤ :=
(Equiv.addRight (1 : ℤ)).prodCongr (Equiv.refl ℤ)
#align pgame.domineering.shift_right SetTheory.PGame.Domineering.shiftRight
-- Porting note: reducibility cannot be `local`. For now there are no dependents of this file so
-- being globally reducible is fine.
abbrev Board :=
Finset (ℤ × ℤ)
#align pgame.domineering.board SetTheory.PGame.Domineering.Board
def left (b : Board) : Finset (ℤ × ℤ) :=
b ∩ b.map shiftUp
#align pgame.domineering.left SetTheory.PGame.Domineering.left
def right (b : Board) : Finset (ℤ × ℤ) :=
b ∩ b.map shiftRight
#align pgame.domineering.right SetTheory.PGame.Domineering.right
theorem mem_left {b : Board} (x : ℤ × ℤ) : x ∈ left b ↔ x ∈ b ∧ (x.1, x.2 - 1) ∈ b :=
Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
#align pgame.domineering.mem_left SetTheory.PGame.Domineering.mem_left
theorem mem_right {b : Board} (x : ℤ × ℤ) : x ∈ right b ↔ x ∈ b ∧ (x.1 - 1, x.2) ∈ b :=
Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
#align pgame.domineering.mem_right SetTheory.PGame.Domineering.mem_right
def moveLeft (b : Board) (m : ℤ × ℤ) : Board :=
(b.erase m).erase (m.1, m.2 - 1)
#align pgame.domineering.move_left SetTheory.PGame.Domineering.moveLeft
def moveRight (b : Board) (m : ℤ × ℤ) : Board :=
(b.erase m).erase (m.1 - 1, m.2)
#align pgame.domineering.move_right SetTheory.PGame.Domineering.moveRight
theorem fst_pred_mem_erase_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
(m.1 - 1, m.2) ∈ b.erase m := by
rw [mem_right] at h
apply Finset.mem_erase_of_ne_of_mem _ h.2
exact ne_of_apply_ne Prod.fst (pred_ne_self m.1)
#align pgame.domineering.fst_pred_mem_erase_of_mem_right SetTheory.PGame.Domineering.fst_pred_mem_erase_of_mem_right
theorem snd_pred_mem_erase_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
(m.1, m.2 - 1) ∈ b.erase m := by
rw [mem_left] at h
apply Finset.mem_erase_of_ne_of_mem _ h.2
exact ne_of_apply_ne Prod.snd (pred_ne_self m.2)
#align pgame.domineering.snd_pred_mem_erase_of_mem_left SetTheory.PGame.Domineering.snd_pred_mem_erase_of_mem_left
theorem card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by
have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
have w₂ : (m.1, m.2 - 1) ∈ b.erase m := snd_pred_mem_erase_of_mem_left h
have i₁ := Finset.card_erase_lt_of_mem w₁
have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂)
exact Nat.lt_of_le_of_lt i₂ i₁
#align pgame.domineering.card_of_mem_left SetTheory.PGame.Domineering.card_of_mem_left
theorem card_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : 2 ≤ Finset.card b := by
have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
have w₂ := fst_pred_mem_erase_of_mem_right h
have i₁ := Finset.card_erase_lt_of_mem w₁
have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂)
exact Nat.lt_of_le_of_lt i₂ i₁
#align pgame.domineering.card_of_mem_right SetTheory.PGame.Domineering.card_of_mem_right
theorem moveLeft_card {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
Finset.card (moveLeft b m) + 2 = Finset.card b := by
dsimp [moveLeft]
rw [Finset.card_erase_of_mem (snd_pred_mem_erase_of_mem_left h)]
rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)]
exact tsub_add_cancel_of_le (card_of_mem_left h)
#align pgame.domineering.move_left_card SetTheory.PGame.Domineering.moveLeft_card
| Mathlib/SetTheory/Game/Domineering.lean | 117 | 122 | theorem moveRight_card {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
Finset.card (moveRight b m) + 2 = Finset.card b := by |
dsimp [moveRight]
rw [Finset.card_erase_of_mem (fst_pred_mem_erase_of_mem_right h)]
rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)]
exact tsub_add_cancel_of_le (card_of_mem_right h)
| false |
import Mathlib.Data.Complex.Basic
import Mathlib.MeasureTheory.Integral.CircleIntegral
#align_import measure_theory.integral.circle_transform from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open Set MeasureTheory Metric Filter Function
open scoped Interval Real
noncomputable section
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] (R : ℝ) (z w : ℂ)
namespace Complex
def circleTransform (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • (circleMap z R θ - w)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform Complex.circleTransform
def circleTransformDeriv (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • ((circleMap z R θ - w) ^ 2)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform_deriv Complex.circleTransformDeriv
theorem circleTransformDeriv_periodic (f : ℂ → E) :
Periodic (circleTransformDeriv R z w f) (2 * π) := by
have := periodic_circleMap
simp_rw [Periodic] at *
intro x
simp_rw [circleTransformDeriv, this]
congr 2
simp [this]
#align complex.circle_transform_deriv_periodic Complex.circleTransformDeriv_periodic
theorem circleTransformDeriv_eq (f : ℂ → E) : circleTransformDeriv R z w f =
fun θ => (circleMap z R θ - w)⁻¹ • circleTransform R z w f θ := by
ext
simp_rw [circleTransformDeriv, circleTransform, ← mul_smul, ← mul_assoc]
ring_nf
rw [inv_pow]
congr
ring
#align complex.circle_transform_deriv_eq Complex.circleTransformDeriv_eq
theorem integral_circleTransform (f : ℂ → E) :
(∫ θ : ℝ in (0)..2 * π, circleTransform R z w f θ) =
(2 * ↑π * I)⁻¹ • ∮ z in C(z, R), (z - w)⁻¹ • f z := by
simp_rw [circleTransform, circleIntegral, deriv_circleMap, circleMap]
simp
#align complex.integral_circle_transform Complex.integral_circleTransform
theorem continuous_circleTransform {R : ℝ} (hR : 0 < R) {f : ℂ → E} {z w : ℂ}
(hf : ContinuousOn f <| sphere z R) (hw : w ∈ ball z R) :
Continuous (circleTransform R z w f) := by
apply_rules [Continuous.smul, continuous_const]
· simp_rw [deriv_circleMap]
apply_rules [Continuous.mul, continuous_circleMap 0 R, continuous_const]
· exact continuous_circleMap_inv hw
· apply ContinuousOn.comp_continuous hf (continuous_circleMap z R)
exact fun _ => (circleMap_mem_sphere _ hR.le) _
#align complex.continuous_circle_transform Complex.continuous_circleTransform
theorem continuous_circleTransformDeriv {R : ℝ} (hR : 0 < R) {f : ℂ → E} {z w : ℂ}
(hf : ContinuousOn f (sphere z R)) (hw : w ∈ ball z R) :
Continuous (circleTransformDeriv R z w f) := by
rw [circleTransformDeriv_eq]
exact (continuous_circleMap_inv hw).smul (continuous_circleTransform hR hf hw)
#align complex.continuous_circle_transform_deriv Complex.continuous_circleTransformDeriv
def circleTransformBoundingFunction (R : ℝ) (z : ℂ) (w : ℂ × ℝ) : ℂ :=
circleTransformDeriv R z w.1 (fun _ => 1) w.2
#align complex.circle_transform_bounding_function Complex.circleTransformBoundingFunction
theorem continuousOn_prod_circle_transform_function {R r : ℝ} (hr : r < R) {z : ℂ} :
ContinuousOn (fun w : ℂ × ℝ => (circleMap z R w.snd - w.fst)⁻¹ ^ 2)
(closedBall z r ×ˢ univ) := by
simp_rw [← one_div]
apply_rules [ContinuousOn.pow, ContinuousOn.div, continuousOn_const]
· exact ((continuous_circleMap z R).comp_continuousOn continuousOn_snd).sub continuousOn_fst
· rintro ⟨a, b⟩ ⟨ha, -⟩
have ha2 : a ∈ ball z R := closedBall_subset_ball hr ha
exact sub_ne_zero.2 (circleMap_ne_mem_ball ha2 b)
#align complex.continuous_on_prod_circle_transform_function Complex.continuousOn_prod_circle_transform_function
theorem continuousOn_abs_circleTransformBoundingFunction {R r : ℝ} (hr : r < R) (z : ℂ) :
ContinuousOn (abs ∘ circleTransformBoundingFunction R z) (closedBall z r ×ˢ univ) := by
have : ContinuousOn (circleTransformBoundingFunction R z) (closedBall z r ×ˢ univ) := by
apply_rules [ContinuousOn.smul, continuousOn_const]
· simp only [deriv_circleMap]
apply_rules [ContinuousOn.mul, (continuous_circleMap 0 R).comp_continuousOn continuousOn_snd,
continuousOn_const]
· simpa only [inv_pow] using continuousOn_prod_circle_transform_function hr
exact this.norm
#align complex.continuous_on_abs_circle_transform_bounding_function Complex.continuousOn_abs_circleTransformBoundingFunction
theorem abs_circleTransformBoundingFunction_le {R r : ℝ} (hr : r < R) (hr' : 0 ≤ r) (z : ℂ) :
∃ x : closedBall z r ×ˢ [[0, 2 * π]], ∀ y : closedBall z r ×ˢ [[0, 2 * π]],
abs (circleTransformBoundingFunction R z y) ≤ abs (circleTransformBoundingFunction R z x) := by
have cts := continuousOn_abs_circleTransformBoundingFunction hr z
have comp : IsCompact (closedBall z r ×ˢ [[0, 2 * π]]) := by
apply_rules [IsCompact.prod, ProperSpace.isCompact_closedBall z r, isCompact_uIcc]
have none : (closedBall z r ×ˢ [[0, 2 * π]]).Nonempty :=
(nonempty_closedBall.2 hr').prod nonempty_uIcc
have := IsCompact.exists_isMaxOn comp none (cts.mono <| prod_mono_right (subset_univ _))
simpa [isMaxOn_iff] using this
#align complex.abs_circle_transform_bounding_function_le Complex.abs_circleTransformBoundingFunction_le
| Mathlib/MeasureTheory/Integral/CircleTransform.lean | 133 | 152 | theorem circleTransformDeriv_bound {R : ℝ} (hR : 0 < R) {z x : ℂ} {f : ℂ → ℂ} (hx : x ∈ ball z R)
(hf : ContinuousOn f (sphere z R)) : ∃ B ε : ℝ, 0 < ε ∧
ball x ε ⊆ ball z R ∧ ∀ (t : ℝ), ∀ y ∈ ball x ε, ‖circleTransformDeriv R z y f t‖ ≤ B := by |
obtain ⟨r, hr, hrx⟩ := exists_lt_mem_ball_of_mem_ball hx
obtain ⟨ε', hε', H⟩ := exists_ball_subset_ball hrx
obtain ⟨⟨⟨a, b⟩, ⟨ha, hb⟩⟩, hab⟩ :=
abs_circleTransformBoundingFunction_le hr (pos_of_mem_ball hrx).le z
let V : ℝ → ℂ → ℂ := fun θ w => circleTransformDeriv R z w (fun _ => 1) θ
obtain ⟨X, -, HX2⟩ := (isCompact_sphere z R).exists_isMaxOn
(NormedSpace.sphere_nonempty.2 hR.le) hf.norm
refine ⟨abs (V b a) * abs (f X), ε', hε', H.trans (ball_subset_ball hr.le), fun y v hv ↦ ?_⟩
obtain ⟨y1, hy1, hfun⟩ :=
Periodic.exists_mem_Ico₀ (circleTransformDeriv_periodic R z v f) Real.two_pi_pos y
have hy2 : y1 ∈ [[0, 2 * π]] := Icc_subset_uIcc <| Ico_subset_Icc_self hy1
simp only [isMaxOn_iff, mem_sphere_iff_norm, norm_eq_abs] at HX2
have := mul_le_mul (hab ⟨⟨v, y1⟩, ⟨ball_subset_closedBall (H hv), hy2⟩⟩)
(HX2 (circleMap z R y1) (circleMap_mem_sphere z hR.le y1)) (Complex.abs.nonneg _)
(Complex.abs.nonneg _)
rw [hfun]
simpa [V, circleTransformBoundingFunction, circleTransformDeriv, mul_assoc] using this
| false |
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]
| Mathlib/Data/Real/GoldenRatio.lean | 70 | 72 | theorem gold_add_goldConj : φ + ψ = 1 := by |
rw [goldenRatio, goldenConj]
ring
| false |
import Mathlib.Algebra.Polynomial.Mirror
import Mathlib.Analysis.Complex.Polynomial
#align_import data.polynomial.unit_trinomial from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
namespace Polynomial
open scoped Polynomial
open Finset
section Semiring
variable {R : Type*} [Semiring R] (k m n : ℕ) (u v w : R)
noncomputable def trinomial :=
C u * X ^ k + C v * X ^ m + C w * X ^ n
#align polynomial.trinomial Polynomial.trinomial
theorem trinomial_def : trinomial k m n u v w = C u * X ^ k + C v * X ^ m + C w * X ^ n :=
rfl
#align polynomial.trinomial_def Polynomial.trinomial_def
variable {k m n u v w}
| Mathlib/Algebra/Polynomial/UnitTrinomial.lean | 49 | 52 | theorem trinomial_leading_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff n = w := by |
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg (hkm.trans hmn).ne', if_neg hmn.ne', if_pos rfl, zero_add, zero_add]
| false |
import Mathlib.Order.Lattice
import Mathlib.Data.List.Sort
import Mathlib.Logic.Equiv.Fin
import Mathlib.Logic.Equiv.Functor
import Mathlib.Data.Fintype.Card
import Mathlib.Order.RelSeries
#align_import order.jordan_holder from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada"
universe u
open Set RelSeries
class JordanHolderLattice (X : Type u) [Lattice X] where
IsMaximal : X → X → Prop
lt_of_isMaximal : ∀ {x y}, IsMaximal x y → x < y
sup_eq_of_isMaximal : ∀ {x y z}, IsMaximal x z → IsMaximal y z → x ≠ y → x ⊔ y = z
isMaximal_inf_left_of_isMaximal_sup :
∀ {x y}, IsMaximal x (x ⊔ y) → IsMaximal y (x ⊔ y) → IsMaximal (x ⊓ y) x
Iso : X × X → X × X → Prop
iso_symm : ∀ {x y}, Iso x y → Iso y x
iso_trans : ∀ {x y z}, Iso x y → Iso y z → Iso x z
second_iso : ∀ {x y}, IsMaximal x (x ⊔ y) → Iso (x, x ⊔ y) (x ⊓ y, y)
#align jordan_holder_lattice JordanHolderLattice
namespace JordanHolderLattice
variable {X : Type u} [Lattice X] [JordanHolderLattice X]
theorem isMaximal_inf_right_of_isMaximal_sup {x y : X} (hxz : IsMaximal x (x ⊔ y))
(hyz : IsMaximal y (x ⊔ y)) : IsMaximal (x ⊓ y) y := by
rw [inf_comm]
rw [sup_comm] at hxz hyz
exact isMaximal_inf_left_of_isMaximal_sup hyz hxz
#align jordan_holder_lattice.is_maximal_inf_right_of_is_maximal_sup JordanHolderLattice.isMaximal_inf_right_of_isMaximal_sup
theorem isMaximal_of_eq_inf (x b : X) {a y : X} (ha : x ⊓ y = a) (hxy : x ≠ y) (hxb : IsMaximal x b)
(hyb : IsMaximal y b) : IsMaximal a y := by
have hb : x ⊔ y = b := sup_eq_of_isMaximal hxb hyb hxy
substs a b
exact isMaximal_inf_right_of_isMaximal_sup hxb hyb
#align jordan_holder_lattice.is_maximal_of_eq_inf JordanHolderLattice.isMaximal_of_eq_inf
| Mathlib/Order/JordanHolder.lean | 116 | 117 | theorem second_iso_of_eq {x y a b : X} (hm : IsMaximal x a) (ha : x ⊔ y = a) (hb : x ⊓ y = b) :
Iso (x, a) (b, y) := by | substs a b; exact second_iso hm
| false |
import Mathlib.RepresentationTheory.Rep
import Mathlib.Algebra.Category.FGModuleCat.Limits
import Mathlib.CategoryTheory.Preadditive.Schur
import Mathlib.RepresentationTheory.Basic
#align_import representation_theory.fdRep from "leanprover-community/mathlib"@"19a70dceb9dff0994b92d2dd049de7d84d28112b"
suppress_compilation
universe u
open CategoryTheory
open CategoryTheory.Limits
set_option linter.uppercaseLean3 false -- `FdRep`
abbrev FdRep (k G : Type u) [Field k] [Monoid G] :=
Action (FGModuleCat.{u} k) (MonCat.of G)
#align fdRep FdRep
namespace FdRep
variable {k G : Type u} [Field k] [Monoid G]
-- Porting note: `@[derive]` didn't work for `FdRep`. Add the 4 instances here.
instance : LargeCategory (FdRep k G) := inferInstance
instance : ConcreteCategory (FdRep k G) := inferInstance
instance : Preadditive (FdRep k G) := inferInstance
instance : HasFiniteLimits (FdRep k G) := inferInstance
instance : Linear k (FdRep k G) := by infer_instance
instance : CoeSort (FdRep k G) (Type u) :=
ConcreteCategory.hasCoeToSort _
instance (V : FdRep k G) : AddCommGroup V := by
change AddCommGroup ((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj; infer_instance
instance (V : FdRep k G) : Module k V := by
change Module k ((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj; infer_instance
instance (V : FdRep k G) : FiniteDimensional k V := by
change FiniteDimensional k ((forget₂ (FdRep k G) (FGModuleCat k)).obj V); infer_instance
instance (V W : FdRep k G) : FiniteDimensional k (V ⟶ W) :=
FiniteDimensional.of_injective ((forget₂ (FdRep k G) (FGModuleCat k)).mapLinearMap k)
(Functor.map_injective (forget₂ (FdRep k G) (FGModuleCat k)))
def ρ (V : FdRep k G) : G →* V →ₗ[k] V :=
Action.ρ V
#align fdRep.ρ FdRep.ρ
def isoToLinearEquiv {V W : FdRep k G} (i : V ≅ W) : V ≃ₗ[k] W :=
FGModuleCat.isoToLinearEquiv ((Action.forget (FGModuleCat k) (MonCat.of G)).mapIso i)
#align fdRep.iso_to_linear_equiv FdRep.isoToLinearEquiv
| Mathlib/RepresentationTheory/FdRep.lean | 95 | 100 | theorem Iso.conj_ρ {V W : FdRep k G} (i : V ≅ W) (g : G) :
W.ρ g = (FdRep.isoToLinearEquiv i).conj (V.ρ g) := by |
-- Porting note: Changed `rw` to `erw`
erw [FdRep.isoToLinearEquiv, ← FGModuleCat.Iso.conj_eq_conj, Iso.conj_apply]
rw [Iso.eq_inv_comp ((Action.forget (FGModuleCat k) (MonCat.of G)).mapIso i)]
exact (i.hom.comm g).symm
| false |
import Mathlib.Algebra.CharP.Basic
import Mathlib.Algebra.CharP.Algebra
import Mathlib.Data.Nat.Prime
#align_import algebra.char_p.exp_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe u
variable (R : Type u)
section Semiring
variable [Semiring R]
class inductive ExpChar (R : Type u) [Semiring R] : ℕ → Prop
| zero [CharZero R] : ExpChar R 1
| prime {q : ℕ} (hprime : q.Prime) [hchar : CharP R q] : ExpChar R q
#align exp_char ExpChar
#align exp_char.prime ExpChar.prime
instance expChar_prime (p) [CharP R p] [Fact p.Prime] : ExpChar R p := ExpChar.prime Fact.out
instance expChar_zero [CharZero R] : ExpChar R 1 := ExpChar.zero
instance (S : Type*) [Semiring S] (p) [ExpChar R p] [ExpChar S p] : ExpChar (R × S) p := by
obtain hp | ⟨hp⟩ := ‹ExpChar R p›
· have := Prod.charZero_of_left R S; exact .zero
obtain _ | _ := ‹ExpChar S p›
· exact (Nat.not_prime_one hp).elim
· have := Prod.charP R S p; exact .prime hp
variable {R} in
theorem ExpChar.eq {p q : ℕ} (hp : ExpChar R p) (hq : ExpChar R q) : p = q := by
cases' hp with hp _ hp' hp
· cases' hq with hq _ hq' hq
exacts [rfl, False.elim (Nat.not_prime_zero (CharP.eq R hq (CharP.ofCharZero R) ▸ hq'))]
· cases' hq with hq _ hq' hq
exacts [False.elim (Nat.not_prime_zero (CharP.eq R hp (CharP.ofCharZero R) ▸ hp')),
CharP.eq R hp hq]
theorem ExpChar.congr {p : ℕ} (q : ℕ) [hq : ExpChar R q] (h : q = p) : ExpChar R p := h ▸ hq
noncomputable def ringExpChar (R : Type*) [NonAssocSemiring R] : ℕ := max (ringChar R) 1
theorem ringExpChar.eq (q : ℕ) [h : ExpChar R q] : ringExpChar R = q := by
cases' h with _ _ h _
· haveI := CharP.ofCharZero R
rw [ringExpChar, ringChar.eq R 0]; rfl
rw [ringExpChar, ringChar.eq R q]
exact Nat.max_eq_left h.one_lt.le
@[simp]
theorem ringExpChar.eq_one (R : Type*) [NonAssocSemiring R] [CharZero R] : ringExpChar R = 1 := by
rw [ringExpChar, ringChar.eq_zero, max_eq_right zero_le_one]
theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] : q = 1 := by
cases' hq with q hq_one hq_prime hq_hchar
· rfl
· exact False.elim <| hq_prime.ne_zero <| hq_hchar.eq R hp
#align exp_char_one_of_char_zero expChar_one_of_char_zero
theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p = q ↔ p.Prime := by
cases' hq with q hq_one hq_prime hq_hchar
· rw [(CharP.eq R hp inferInstance : p = 0)]
decide
· exact ⟨fun hpq => hpq.symm ▸ hq_prime, fun _ => CharP.eq R hp hq_hchar⟩
#align char_eq_exp_char_iff char_eq_expChar_iff
section Nontrivial
variable [Nontrivial R]
theorem char_zero_of_expChar_one (p : ℕ) [hp : CharP R p] [hq : ExpChar R 1] : p = 0 := by
cases hq
· exact CharP.eq R hp inferInstance
· exact False.elim (CharP.char_ne_one R 1 rfl)
#align char_zero_of_exp_char_one char_zero_of_expChar_one
-- This could be an instance, but there are no `ExpChar R 1` instances in mathlib.
theorem charZero_of_expChar_one' [hq : ExpChar R 1] : CharZero R := by
cases hq
· assumption
· exact False.elim (CharP.char_ne_one R 1 rfl)
#align char_zero_of_exp_char_one' charZero_of_expChar_one'
| Mathlib/Algebra/CharP/ExpChar.lean | 120 | 125 | theorem expChar_one_iff_char_zero (p q : ℕ) [CharP R p] [ExpChar R q] : q = 1 ↔ p = 0 := by |
constructor
· rintro rfl
exact char_zero_of_expChar_one R p
· rintro rfl
exact expChar_one_of_char_zero R q
| false |
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.MeasureTheory.Integral.IntegrableOn
import Mathlib.MeasureTheory.Function.LocallyIntegrable
open Asymptotics MeasureTheory Set Filter
variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F]
{f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α}
theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l]
(hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter f l μ := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ :=
(hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets
refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩
refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_
exact (hfg x hx).trans (le_abs_self _)
theorem _root_.Asymptotics.IsBigO.integrable (hfm : AEStronglyMeasurable f μ)
(hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by
rewrite [← integrableAtFilter_top] at *
exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg
variable [TopologicalSpace α] [SecondCountableTopology α]
namespace MeasureTheory
theorem LocallyIntegrable.integrable_of_isBigO_cocompact [IsMeasurablyGenerated (cocompact α)]
(hf : LocallyIntegrable f μ) (ho : f =O[cocompact α] g)
(hg : IntegrableAtFilter g (cocompact α) μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_cocompact.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
section LinearOrder
variable [LinearOrder α] [CompactIccSpace α] {g' : α → F}
theorem LocallyIntegrable.integrable_of_isBigO_atBot_atTop
[IsMeasurablyGenerated (atBot (α := α))] [IsMeasurablyGenerated (atTop (α := α))]
(hf : LocallyIntegrable f μ)
(ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ)
(ho' : f =O[atTop] g') (hg' : IntegrableAtFilter g' atTop μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atBot_atTop.mpr
⟨⟨ho.integrableAtFilter ?_ hg, ho'.integrableAtFilter ?_ hg'⟩, hf⟩
all_goals exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
| Mathlib/MeasureTheory/Integral/Asymptotics.lean | 81 | 85 | theorem LocallyIntegrableOn.integrableOn_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))]
(hf : LocallyIntegrableOn f (Iic a) μ) (ho : f =O[atBot] g)
(hg : IntegrableAtFilter g atBot μ) : IntegrableOn f (Iic a) μ := by |
refine integrableOn_Iic_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact ⟨Iic a, Iic_mem_atBot a, hf.aestronglyMeasurable⟩
| false |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.special_functions.pow.nnreal from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
noncomputable section
open scoped Classical
open Real NNReal ENNReal ComplexConjugate
open Finset Function Set
namespace NNReal
variable {w x y z : ℝ}
noncomputable def rpow (x : ℝ≥0) (y : ℝ) : ℝ≥0 :=
⟨(x : ℝ) ^ y, Real.rpow_nonneg x.2 y⟩
#align nnreal.rpow NNReal.rpow
noncomputable instance : Pow ℝ≥0 ℝ :=
⟨rpow⟩
@[simp]
theorem rpow_eq_pow (x : ℝ≥0) (y : ℝ) : rpow x y = x ^ y :=
rfl
#align nnreal.rpow_eq_pow NNReal.rpow_eq_pow
@[simp, norm_cast]
theorem coe_rpow (x : ℝ≥0) (y : ℝ) : ((x ^ y : ℝ≥0) : ℝ) = (x : ℝ) ^ y :=
rfl
#align nnreal.coe_rpow NNReal.coe_rpow
@[simp]
theorem rpow_zero (x : ℝ≥0) : x ^ (0 : ℝ) = 1 :=
NNReal.eq <| Real.rpow_zero _
#align nnreal.rpow_zero NNReal.rpow_zero
@[simp]
| Mathlib/Analysis/SpecialFunctions/Pow/NNReal.lean | 57 | 59 | theorem rpow_eq_zero_iff {x : ℝ≥0} {y : ℝ} : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by
rw [← NNReal.coe_inj, coe_rpow, ← NNReal.coe_eq_zero] |
rw [← NNReal.coe_inj, coe_rpow, ← NNReal.coe_eq_zero]
exact Real.rpow_eq_zero_iff_of_nonneg x.2
| true |
import Mathlib.Analysis.Convex.Gauge
import Mathlib.Analysis.Convex.Normed
open Metric Bornology Filter Set
open scoped NNReal Topology Pointwise
noncomputable section
section Module
variable {E : Type*} [AddCommGroup E] [Module ℝ E]
def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) • x
theorem gaugeRescale_def (s t : Set E) (x : E) :
gaugeRescale s t x = (gauge s x / gauge t x) • x :=
rfl
@[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _
theorem gaugeRescale_smul (s t : Set E) {c : ℝ} (hc : 0 ≤ c) (x : E) :
gaugeRescale s t (c • x) = c • gaugeRescale s t x := by
simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul]
rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self]
variable [TopologicalSpace E] [T1Space E]
theorem gaugeRescale_self_apply {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s)
(x : E) : gaugeRescale s s x = x := by
rcases eq_or_ne x 0 with rfl | hx; · simp
rw [gaugeRescale, div_self, one_smul]
exact ((gauge_pos hsa hsb).2 hx).ne'
theorem gaugeRescale_self {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s) :
gaugeRescale s s = id :=
funext <| gaugeRescale_self_apply hsa hsb
theorem gauge_gaugeRescale' (s : Set E) {t : Set E} {x : E} (hx : gauge t x ≠ 0) :
gauge t (gaugeRescale s t x) = gauge s x := by
rw [gaugeRescale, gauge_smul_of_nonneg (div_nonneg (gauge_nonneg _) (gauge_nonneg _)),
smul_eq_mul, div_mul_cancel₀ _ hx]
theorem gauge_gaugeRescale (s : Set E) {t : Set E} (hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t)
(x : E) : gauge t (gaugeRescale s t x) = gauge s x := by
rcases eq_or_ne x 0 with rfl | hx
· simp
· exact gauge_gaugeRescale' s ((gauge_pos hta htb).2 hx).ne'
theorem gauge_gaugeRescale_le (s t : Set E) (x : E) :
gauge t (gaugeRescale s t x) ≤ gauge s x := by
by_cases hx : gauge t x = 0
· simp [gaugeRescale, hx, gauge_nonneg]
· exact (gauge_gaugeRescale' s hx).le
theorem gaugeRescale_gaugeRescale {s t u : Set E} (hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t)
(x : E) : gaugeRescale t u (gaugeRescale s t x) = gaugeRescale s u x := by
rcases eq_or_ne x 0 with rfl | hx; · simp
rw [gaugeRescale_def s t x, gaugeRescale_smul, gaugeRescale, gaugeRescale, smul_smul,
div_mul_div_cancel]
exacts [((gauge_pos hta htb).2 hx).ne', div_nonneg (gauge_nonneg _) (gauge_nonneg _)]
def gaugeRescaleEquiv (s t : Set E) (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s)
(hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t) : E ≃ E where
toFun := gaugeRescale s t
invFun := gaugeRescale t s
left_inv x := by rw [gaugeRescale_gaugeRescale, gaugeRescale_self_apply] <;> assumption
right_inv x := by rw [gaugeRescale_gaugeRescale, gaugeRescale_self_apply] <;> assumption
variable [TopologicalAddGroup E] [ContinuousSMul ℝ E] {s t : Set E}
theorem mapsTo_gaugeRescale_interior (h₀ : t ∈ 𝓝 0) (hc : Convex ℝ t) :
MapsTo (gaugeRescale s t) (interior s) (interior t) := fun x hx ↦ by
rw [← gauge_lt_one_iff_mem_interior] <;> try assumption
exact (gauge_gaugeRescale_le _ _ _).trans_lt (interior_subset_gauge_lt_one _ hx)
theorem mapsTo_gaugeRescale_closure {s t : Set E} (hsc : Convex ℝ s) (hs₀ : s ∈ 𝓝 0)
(htc : Convex ℝ t) (ht₀ : 0 ∈ t) (hta : Absorbent ℝ t) :
MapsTo (gaugeRescale s t) (closure s) (closure t) := fun _x hx ↦
mem_closure_of_gauge_le_one htc ht₀ hta <| (gauge_gaugeRescale_le _ _ _).trans <|
(gauge_le_one_iff_mem_closure hsc hs₀).2 hx
| Mathlib/Analysis/Convex/GaugeRescale.lean | 103 | 114 | theorem continuous_gaugeRescale {s t : Set E} (hs : Convex ℝ s) (hs₀ : s ∈ 𝓝 0)
(ht : Convex ℝ t) (ht₀ : t ∈ 𝓝 0) (htb : IsVonNBounded ℝ t) :
Continuous (gaugeRescale s t) := by
have hta : Absorbent ℝ t := absorbent_nhds_zero ht₀ |
have hta : Absorbent ℝ t := absorbent_nhds_zero ht₀
refine continuous_iff_continuousAt.2 fun x ↦ ?_
rcases eq_or_ne x 0 with rfl | hx
· rw [ContinuousAt, gaugeRescale_zero]
nth_rewrite 2 [← comap_gauge_nhds_zero htb ht₀]
simp only [tendsto_comap_iff, (· ∘ ·), gauge_gaugeRescale _ hta htb]
exact tendsto_gauge_nhds_zero hs₀
· exact ((continuousAt_gauge hs hs₀).div (continuousAt_gauge ht ht₀)
((gauge_pos hta htb).2 hx).ne').smul continuousAt_id
| true |
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)
| Mathlib/Analysis/InnerProductSpace/Orientation.lean | 91 | 96 | 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] |
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 [⋀^ι]→ₗ[ℝ] ℝ)]
| true |
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv
#align_import linear_algebra.affine_space.affine_subspace from "leanprover-community/mathlib"@"e96bdfbd1e8c98a09ff75f7ac6204d142debc840"
noncomputable section
open Affine
open Set
section
variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V]
variable [AffineSpace V P]
def vectorSpan (s : Set P) : Submodule k V :=
Submodule.span k (s -ᵥ s)
#align vector_span vectorSpan
theorem vectorSpan_def (s : Set P) : vectorSpan k s = Submodule.span k (s -ᵥ s) :=
rfl
#align vector_span_def vectorSpan_def
theorem vectorSpan_mono {s₁ s₂ : Set P} (h : s₁ ⊆ s₂) : vectorSpan k s₁ ≤ vectorSpan k s₂ :=
Submodule.span_mono (vsub_self_mono h)
#align vector_span_mono vectorSpan_mono
variable (P)
@[simp]
theorem vectorSpan_empty : vectorSpan k (∅ : Set P) = (⊥ : Submodule k V) := by
rw [vectorSpan_def, vsub_empty, Submodule.span_empty]
#align vector_span_empty vectorSpan_empty
variable {P}
@[simp]
theorem vectorSpan_singleton (p : P) : vectorSpan k ({p} : Set P) = ⊥ := by simp [vectorSpan_def]
#align vector_span_singleton vectorSpan_singleton
theorem vsub_set_subset_vectorSpan (s : Set P) : s -ᵥ s ⊆ ↑(vectorSpan k s) :=
Submodule.subset_span
#align vsub_set_subset_vector_span vsub_set_subset_vectorSpan
theorem vsub_mem_vectorSpan {s : Set P} {p1 p2 : P} (hp1 : p1 ∈ s) (hp2 : p2 ∈ s) :
p1 -ᵥ p2 ∈ vectorSpan k s :=
vsub_set_subset_vectorSpan k s (vsub_mem_vsub hp1 hp2)
#align vsub_mem_vector_span vsub_mem_vectorSpan
def spanPoints (s : Set P) : Set P :=
{ p | ∃ p1 ∈ s, ∃ v ∈ vectorSpan k s, p = v +ᵥ p1 }
#align span_points spanPoints
theorem mem_spanPoints (p : P) (s : Set P) : p ∈ s → p ∈ spanPoints k s
| hp => ⟨p, hp, 0, Submodule.zero_mem _, (zero_vadd V p).symm⟩
#align mem_span_points mem_spanPoints
theorem subset_spanPoints (s : Set P) : s ⊆ spanPoints k s := fun p => mem_spanPoints k p s
#align subset_span_points subset_spanPoints
@[simp]
theorem spanPoints_nonempty (s : Set P) : (spanPoints k s).Nonempty ↔ s.Nonempty := by
constructor
· contrapose
rw [Set.not_nonempty_iff_eq_empty, Set.not_nonempty_iff_eq_empty]
intro h
simp [h, spanPoints]
· exact fun h => h.mono (subset_spanPoints _ _)
#align span_points_nonempty spanPoints_nonempty
| Mathlib/LinearAlgebra/AffineSpace/AffineSubspace.lean | 128 | 132 | theorem vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan {s : Set P} {p : P} {v : V}
(hp : p ∈ spanPoints k s) (hv : v ∈ vectorSpan k s) : v +ᵥ p ∈ spanPoints k s := by
rcases hp with ⟨p2, ⟨hp2, ⟨v2, ⟨hv2, hv2p⟩⟩⟩⟩ |
rcases hp with ⟨p2, ⟨hp2, ⟨v2, ⟨hv2, hv2p⟩⟩⟩⟩
rw [hv2p, vadd_vadd]
exact ⟨p2, hp2, v + v2, (vectorSpan k s).add_mem hv hv2, rfl⟩
| true |
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.GroupTheory.GroupAction.Hom
open Set Pointwise
| Mathlib/GroupTheory/GroupAction/Pointwise.lean | 33 | 41 | theorem MulAction.smul_bijective_of_is_unit
{M : Type*} [Monoid M] {α : Type*} [MulAction M α] {m : M} (hm : IsUnit m) :
Function.Bijective (fun (a : α) ↦ m • a) := by
lift m to Mˣ using hm |
lift m to Mˣ using hm
rw [Function.bijective_iff_has_inverse]
use fun a ↦ m⁻¹ • a
constructor
· intro x; simp [← Units.smul_def]
· intro x; simp [← Units.smul_def]
| true |
import Mathlib.Data.List.Forall2
import Mathlib.Data.Set.Pairwise.Basic
import Mathlib.Init.Data.Fin.Basic
#align_import data.list.nodup from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
universe u v
open Nat Function
variable {α : Type u} {β : Type v} {l l₁ l₂ : List α} {r : α → α → Prop} {a b : α}
namespace List
@[simp]
theorem forall_mem_ne {a : α} {l : List α} : (∀ a' : α, a' ∈ l → ¬a = a') ↔ a ∉ l :=
⟨fun h m => h _ m rfl, fun h _ m e => h (e.symm ▸ m)⟩
#align list.forall_mem_ne List.forall_mem_ne
@[simp]
theorem nodup_nil : @Nodup α [] :=
Pairwise.nil
#align list.nodup_nil List.nodup_nil
@[simp]
| Mathlib/Data/List/Nodup.lean | 39 | 40 | theorem nodup_cons {a : α} {l : List α} : Nodup (a :: l) ↔ a ∉ l ∧ Nodup l := by |
simp only [Nodup, pairwise_cons, forall_mem_ne]
| true |
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
#align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe"
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor'' (X Y : C) :
(α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor''
@[reassoc]
theorem leftUnitor_tensor' (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y) := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor'
@[reassoc]
theorem leftUnitor_tensor_inv' (X Y : C) :
(λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by coherence
#align category_theory.monoidal_category.left_unitor_tensor_inv CategoryTheory.MonoidalCategory.leftUnitor_tensor_inv'
@[reassoc]
theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by
coherence
#align category_theory.monoidal_category.id_tensor_right_unitor_inv CategoryTheory.MonoidalCategory.id_tensor_rightUnitor_inv
@[reassoc]
theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by
coherence
#align category_theory.monoidal_category.left_unitor_inv_tensor_id CategoryTheory.MonoidalCategory.leftUnitor_inv_tensor_id
@[reassoc]
theorem pentagon_inv_inv_hom (W X Y Z : C) :
(α_ W (X ⊗ Y) Z).inv ≫ ((α_ W X Y).inv ⊗ 𝟙 Z) ≫ (α_ (W ⊗ X) Y Z).hom =
(𝟙 W ⊗ (α_ X Y Z).hom) ≫ (α_ W X (Y ⊗ Z)).inv := by
coherence
#align category_theory.monoidal_category.pentagon_inv_inv_hom CategoryTheory.MonoidalCategory.pentagon_inv_inv_hom
theorem unitors_equal : (λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom := by
coherence
#align category_theory.monoidal_category.unitors_equal CategoryTheory.MonoidalCategory.unitors_equal
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 67 | 68 | theorem unitors_inv_equal : (λ_ (𝟙_ C)).inv = (ρ_ (𝟙_ C)).inv := by |
coherence
| true |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Data.ENat.Basic
#align_import data.polynomial.degree.trailing_degree from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
noncomputable section
open Function Polynomial Finsupp Finset
open scoped Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
def trailingDegree (p : R[X]) : ℕ∞ :=
p.support.min
#align polynomial.trailing_degree Polynomial.trailingDegree
theorem trailingDegree_lt_wf : WellFounded fun p q : R[X] => trailingDegree p < trailingDegree q :=
InvImage.wf trailingDegree wellFounded_lt
#align polynomial.trailing_degree_lt_wf Polynomial.trailingDegree_lt_wf
def natTrailingDegree (p : R[X]) : ℕ :=
(trailingDegree p).getD 0
#align polynomial.nat_trailing_degree Polynomial.natTrailingDegree
def trailingCoeff (p : R[X]) : R :=
coeff p (natTrailingDegree p)
#align polynomial.trailing_coeff Polynomial.trailingCoeff
def TrailingMonic (p : R[X]) :=
trailingCoeff p = (1 : R)
#align polynomial.trailing_monic Polynomial.TrailingMonic
theorem TrailingMonic.def : TrailingMonic p ↔ trailingCoeff p = 1 :=
Iff.rfl
#align polynomial.trailing_monic.def Polynomial.TrailingMonic.def
instance TrailingMonic.decidable [DecidableEq R] : Decidable (TrailingMonic p) :=
inferInstanceAs <| Decidable (trailingCoeff p = (1 : R))
#align polynomial.trailing_monic.decidable Polynomial.TrailingMonic.decidable
@[simp]
theorem TrailingMonic.trailingCoeff {p : R[X]} (hp : p.TrailingMonic) : trailingCoeff p = 1 :=
hp
#align polynomial.trailing_monic.trailing_coeff Polynomial.TrailingMonic.trailingCoeff
@[simp]
theorem trailingDegree_zero : trailingDegree (0 : R[X]) = ⊤ :=
rfl
#align polynomial.trailing_degree_zero Polynomial.trailingDegree_zero
@[simp]
theorem trailingCoeff_zero : trailingCoeff (0 : R[X]) = 0 :=
rfl
#align polynomial.trailing_coeff_zero Polynomial.trailingCoeff_zero
@[simp]
theorem natTrailingDegree_zero : natTrailingDegree (0 : R[X]) = 0 :=
rfl
#align polynomial.nat_trailing_degree_zero Polynomial.natTrailingDegree_zero
theorem trailingDegree_eq_top : trailingDegree p = ⊤ ↔ p = 0 :=
⟨fun h => support_eq_empty.1 (Finset.min_eq_top.1 h), fun h => by simp [h]⟩
#align polynomial.trailing_degree_eq_top Polynomial.trailingDegree_eq_top
theorem trailingDegree_eq_natTrailingDegree (hp : p ≠ 0) :
trailingDegree p = (natTrailingDegree p : ℕ∞) := by
let ⟨n, hn⟩ :=
not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt trailingDegree_eq_top.1 hp))
have hn : trailingDegree p = n := Classical.not_not.1 hn
rw [natTrailingDegree, hn]
rfl
#align polynomial.trailing_degree_eq_nat_trailing_degree Polynomial.trailingDegree_eq_natTrailingDegree
| Mathlib/Algebra/Polynomial/Degree/TrailingDegree.lean | 111 | 114 | theorem trailingDegree_eq_iff_natTrailingDegree_eq {p : R[X]} {n : ℕ} (hp : p ≠ 0) :
p.trailingDegree = n ↔ p.natTrailingDegree = n := by
rw [trailingDegree_eq_natTrailingDegree hp] |
rw [trailingDegree_eq_natTrailingDegree hp]
exact WithTop.coe_eq_coe
| true |
import Mathlib.Topology.Bases
import Mathlib.Topology.DenseEmbedding
#align_import topology.stone_cech from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
noncomputable section
open Filter Set
open Topology
universe u v
section Ultrafilter
def ultrafilterBasis (α : Type u) : Set (Set (Ultrafilter α)) :=
range fun s : Set α => { u | s ∈ u }
#align ultrafilter_basis ultrafilterBasis
variable {α : Type u}
instance Ultrafilter.topologicalSpace : TopologicalSpace (Ultrafilter α) :=
TopologicalSpace.generateFrom (ultrafilterBasis α)
#align ultrafilter.topological_space Ultrafilter.topologicalSpace
theorem ultrafilterBasis_is_basis : TopologicalSpace.IsTopologicalBasis (ultrafilterBasis α) :=
⟨by
rintro _ ⟨a, rfl⟩ _ ⟨b, rfl⟩ u ⟨ua, ub⟩
refine ⟨_, ⟨a ∩ b, rfl⟩, inter_mem ua ub, fun v hv => ⟨?_, ?_⟩⟩ <;> apply mem_of_superset hv <;>
simp [inter_subset_right],
eq_univ_of_univ_subset <| subset_sUnion_of_mem <| ⟨univ, eq_univ_of_forall fun u => univ_mem⟩,
rfl⟩
#align ultrafilter_basis_is_basis ultrafilterBasis_is_basis
theorem ultrafilter_isOpen_basic (s : Set α) : IsOpen { u : Ultrafilter α | s ∈ u } :=
ultrafilterBasis_is_basis.isOpen ⟨s, rfl⟩
#align ultrafilter_is_open_basic ultrafilter_isOpen_basic
theorem ultrafilter_isClosed_basic (s : Set α) : IsClosed { u : Ultrafilter α | s ∈ u } := by
rw [← isOpen_compl_iff]
convert ultrafilter_isOpen_basic sᶜ using 1
ext u
exact Ultrafilter.compl_mem_iff_not_mem.symm
#align ultrafilter_is_closed_basic ultrafilter_isClosed_basic
| Mathlib/Topology/StoneCech.lean | 67 | 77 | theorem ultrafilter_converges_iff {u : Ultrafilter (Ultrafilter α)} {x : Ultrafilter α} :
↑u ≤ 𝓝 x ↔ x = joinM u := by
rw [eq_comm, ← Ultrafilter.coe_le_coe] |
rw [eq_comm, ← Ultrafilter.coe_le_coe]
change ↑u ≤ 𝓝 x ↔ ∀ s ∈ x, { v : Ultrafilter α | s ∈ v } ∈ u
simp only [TopologicalSpace.nhds_generateFrom, le_iInf_iff, ultrafilterBasis, le_principal_iff,
mem_setOf_eq]
constructor
· intro h a ha
exact h _ ⟨ha, a, rfl⟩
· rintro h a ⟨xi, a, rfl⟩
exact h _ xi
| true |
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.MeasureTheory.Constructions.BorelSpace.Complex
#align_import measure_theory.function.special_functions.inner from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
variable {α : Type*} {𝕜 : Type*} {E : Type*}
variable [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
@[aesop safe 20 apply (rule_sets := [Measurable])]
theorem Measurable.inner {_ : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {f g : α → E} (hf : Measurable f)
(hg : Measurable g) : Measurable fun t => ⟪f t, g t⟫ :=
Continuous.measurable2 continuous_inner hf hg
#align measurable.inner Measurable.inner
@[measurability]
theorem Measurable.const_inner {_ : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {c : E} {f : α → E} (hf : Measurable f) :
Measurable fun t => ⟪c, f t⟫ :=
Measurable.inner measurable_const hf
@[measurability]
theorem Measurable.inner_const {_ : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {c : E} {f : α → E} (hf : Measurable f) :
Measurable fun t => ⟪f t, c⟫ :=
Measurable.inner hf measurable_const
@[aesop safe 20 apply (rule_sets := [Measurable])]
| Mathlib/MeasureTheory/Function/SpecialFunctions/Inner.lean | 41 | 47 | theorem AEMeasurable.inner {m : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {μ : MeasureTheory.Measure α} {f g : α → E}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : AEMeasurable (fun x => ⟪f x, g x⟫) μ := by
refine ⟨fun x => ⟪hf.mk f x, hg.mk g x⟫, hf.measurable_mk.inner hg.measurable_mk, ?_⟩ |
refine ⟨fun x => ⟪hf.mk f x, hg.mk g x⟫, hf.measurable_mk.inner hg.measurable_mk, ?_⟩
refine hf.ae_eq_mk.mp (hg.ae_eq_mk.mono fun x hxg hxf => ?_)
dsimp only
congr
| true |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Tactic.Ring
#align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
def hyperoperation : ℕ → ℕ → ℕ → ℕ
| 0, _, k => k + 1
| 1, m, 0 => m
| 2, _, 0 => 0
| _ + 3, _, 0 => 1
| n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k)
#align hyperoperation hyperoperation
-- Basic hyperoperation lemmas
@[simp]
theorem hyperoperation_zero (m : ℕ) : hyperoperation 0 m = Nat.succ :=
funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one]
#align hyperoperation_zero hyperoperation_zero
theorem hyperoperation_ge_three_eq_one (n m : ℕ) : hyperoperation (n + 3) m 0 = 1 := by
rw [hyperoperation]
#align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one
theorem hyperoperation_recursion (n m k : ℕ) :
hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by
rw [hyperoperation]
#align hyperoperation_recursion hyperoperation_recursion
-- Interesting hyperoperation lemmas
@[simp]
theorem hyperoperation_one : hyperoperation 1 = (· + ·) := by
ext m k
induction' k with bn bih
· rw [Nat.add_zero m, hyperoperation]
· rw [hyperoperation_recursion, bih, hyperoperation_zero]
exact Nat.add_assoc m bn 1
#align hyperoperation_one hyperoperation_one
@[simp]
| Mathlib/Data/Nat/Hyperoperation.lean | 69 | 78 | theorem hyperoperation_two : hyperoperation 2 = (· * ·) := by
ext m k |
ext m k
induction' k with bn bih
· rw [hyperoperation]
exact (Nat.mul_zero m).symm
· rw [hyperoperation_recursion, hyperoperation_one, bih]
-- Porting note: was `ring`
dsimp only
nth_rewrite 1 [← mul_one m]
rw [← mul_add, add_comm]
| true |
import Mathlib.Data.Fintype.Basic
import Mathlib.ModelTheory.Substructures
#align_import model_theory.elementary_maps from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open FirstOrder
namespace FirstOrder
namespace Language
open Structure
variable (L : Language) (M : Type*) (N : Type*) {P : Type*} {Q : Type*}
variable [L.Structure M] [L.Structure N] [L.Structure P] [L.Structure Q]
structure ElementaryEmbedding where
toFun : M → N
-- Porting note:
-- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
-- but that isn't currently sufficient.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
-- If that can be improved, we should change this to `by aesop` and remove the proofs below.
map_formula' :
∀ ⦃n⦄ (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (toFun ∘ x) ↔ φ.Realize x := by
intros; trivial
#align first_order.language.elementary_embedding FirstOrder.Language.ElementaryEmbedding
#align first_order.language.elementary_embedding.to_fun FirstOrder.Language.ElementaryEmbedding.toFun
#align first_order.language.elementary_embedding.map_formula' FirstOrder.Language.ElementaryEmbedding.map_formula'
@[inherit_doc FirstOrder.Language.ElementaryEmbedding]
scoped[FirstOrder] notation:25 A " ↪ₑ[" L "] " B => FirstOrder.Language.ElementaryEmbedding L A B
variable {L} {M} {N}
namespace ElementaryEmbedding
attribute [coe] toFun
instance instFunLike : FunLike (M ↪ₑ[L] N) M N where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
simp only [ElementaryEmbedding.mk.injEq]
ext x
exact Function.funext_iff.1 h x
#align first_order.language.elementary_embedding.fun_like FirstOrder.Language.ElementaryEmbedding.instFunLike
instance : CoeFun (M ↪ₑ[L] N) fun _ => M → N :=
DFunLike.hasCoeToFun
@[simp]
| Mathlib/ModelTheory/ElementaryMaps.lean | 78 | 94 | theorem map_boundedFormula (f : M ↪ₑ[L] N) {α : Type*} {n : ℕ} (φ : L.BoundedFormula α n)
(v : α → M) (xs : Fin n → M) : φ.Realize (f ∘ v) (f ∘ xs) ↔ φ.Realize v xs := by
classical |
classical
rw [← BoundedFormula.realize_restrictFreeVar Set.Subset.rfl, Set.inclusion_eq_id, iff_eq_eq]
have h :=
f.map_formula' ((φ.restrictFreeVar id).toFormula.relabel (Fintype.equivFin _))
(Sum.elim (v ∘ (↑)) xs ∘ (Fintype.equivFin _).symm)
simp only [Formula.realize_relabel, BoundedFormula.realize_toFormula, iff_eq_eq] at h
rw [← Function.comp.assoc _ _ (Fintype.equivFin _).symm,
Function.comp.assoc _ (Fintype.equivFin _).symm (Fintype.equivFin _),
_root_.Equiv.symm_comp_self, Function.comp_id, Function.comp.assoc, Sum.elim_comp_inl,
Function.comp.assoc _ _ Sum.inr, Sum.elim_comp_inr, ← Function.comp.assoc] at h
refine h.trans ?_
erw [Function.comp.assoc _ _ (Fintype.equivFin _), _root_.Equiv.symm_comp_self,
Function.comp_id, Sum.elim_comp_inl, Sum.elim_comp_inr (v ∘ Subtype.val) xs,
← Set.inclusion_eq_id (s := (BoundedFormula.freeVarFinset φ : Set α)) Set.Subset.rfl,
BoundedFormula.realize_restrictFreeVar Set.Subset.rfl]
| true |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.Analysis.Convex.Segment
import Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
import Mathlib.Tactic.FieldSimp
#align_import analysis.convex.between from "leanprover-community/mathlib"@"571e13cacbed7bf042fd3058ce27157101433842"
variable (R : Type*) {V V' P P' : Type*}
open AffineEquiv AffineMap
section OrderedRing
variable [OrderedRing R] [AddCommGroup V] [Module R V] [AddTorsor V P]
variable [AddCommGroup V'] [Module R V'] [AddTorsor V' P']
def affineSegment (x y : P) :=
lineMap x y '' Set.Icc (0 : R) 1
#align affine_segment affineSegment
theorem affineSegment_eq_segment (x y : V) : affineSegment R x y = segment R x y := by
rw [segment_eq_image_lineMap, affineSegment]
#align affine_segment_eq_segment affineSegment_eq_segment
theorem affineSegment_comm (x y : P) : affineSegment R x y = affineSegment R y x := by
refine Set.ext fun z => ?_
constructor <;>
· rintro ⟨t, ht, hxy⟩
refine ⟨1 - t, ?_, ?_⟩
· rwa [Set.sub_mem_Icc_iff_right, sub_self, sub_zero]
· rwa [lineMap_apply_one_sub]
#align affine_segment_comm affineSegment_comm
theorem left_mem_affineSegment (x y : P) : x ∈ affineSegment R x y :=
⟨0, Set.left_mem_Icc.2 zero_le_one, lineMap_apply_zero _ _⟩
#align left_mem_affine_segment left_mem_affineSegment
theorem right_mem_affineSegment (x y : P) : y ∈ affineSegment R x y :=
⟨1, Set.right_mem_Icc.2 zero_le_one, lineMap_apply_one _ _⟩
#align right_mem_affine_segment right_mem_affineSegment
@[simp]
theorem affineSegment_same (x : P) : affineSegment R x x = {x} := by
-- Porting note: added as this doesn't do anything in `simp_rw` any more
rw [affineSegment]
-- Note: when adding "simp made no progress" in lean4#2336,
-- had to change `lineMap_same` to `lineMap_same _`. Not sure why?
-- Porting note: added `_ _` and `Function.const`
simp_rw [lineMap_same _, AffineMap.coe_const _ _, Function.const,
(Set.nonempty_Icc.mpr zero_le_one).image_const]
#align affine_segment_same affineSegment_same
variable {R}
@[simp]
| Mathlib/Analysis/Convex/Between.lean | 80 | 83 | theorem affineSegment_image (f : P →ᵃ[R] P') (x y : P) :
f '' affineSegment R x y = affineSegment R (f x) (f y) := by
rw [affineSegment, affineSegment, Set.image_image, ← comp_lineMap] |
rw [affineSegment, affineSegment, Set.image_image, ← comp_lineMap]
rfl
| true |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.Choose.Central
import Mathlib.Data.Tree.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Positivity
#align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da"
open Finset
open Finset.antidiagonal (fst_le snd_le)
def catalan : ℕ → ℕ
| 0 => 1
| n + 1 =>
∑ i : Fin n.succ,
catalan i * catalan (n - i)
#align catalan catalan
@[simp]
theorem catalan_zero : catalan 0 = 1 := by rw [catalan]
#align catalan_zero catalan_zero
theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) := by
rw [catalan]
#align catalan_succ catalan_succ
theorem catalan_succ' (n : ℕ) :
catalan (n + 1) = ∑ ij ∈ antidiagonal n, catalan ij.1 * catalan ij.2 := by
rw [catalan_succ, Nat.sum_antidiagonal_eq_sum_range_succ (fun x y => catalan x * catalan y) n,
sum_range]
#align catalan_succ' catalan_succ'
@[simp]
theorem catalan_one : catalan 1 = 1 := by simp [catalan_succ]
#align catalan_one catalan_one
private def gosperCatalan (n j : ℕ) : ℚ :=
Nat.centralBinom j * Nat.centralBinom (n - j) * (2 * j - n) / (2 * n * (n + 1))
private theorem gosper_trick {n i : ℕ} (h : i ≤ n) :
gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
Nat.centralBinom i / (i + 1) * Nat.centralBinom (n - i) / (n - i + 1) := by
have l₁ : (i : ℚ) + 1 ≠ 0 := by norm_cast
have l₂ : (n : ℚ) - i + 1 ≠ 0 := by norm_cast
have h₁ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (i + 1))) l₁).symm
have h₂ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (n - i + 1))) l₂).symm
have h₃ : ((i : ℚ) + 1) * (i + 1).centralBinom = 2 * (2 * i + 1) * i.centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ i
have h₄ :
((n : ℚ) - i + 1) * (n - i + 1).centralBinom = 2 * (2 * (n - i) + 1) * (n - i).centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ (n - i)
simp only [gosperCatalan]
push_cast
rw [show n + 1 - i = n - i + 1 by rw [Nat.add_comm (n - i) 1, ← (Nat.add_sub_assoc h 1),
add_comm]]
rw [h₁, h₂, h₃, h₄]
field_simp
ring
private theorem gosper_catalan_sub_eq_central_binom_div (n : ℕ) : gosperCatalan (n + 1) (n + 1) -
gosperCatalan (n + 1) 0 = Nat.centralBinom (n + 1) / (n + 2) := by
have : (n : ℚ) + 1 ≠ 0 := by norm_cast
have : (n : ℚ) + 1 + 1 ≠ 0 := by norm_cast
have h : (n : ℚ) + 2 ≠ 0 := by norm_cast
simp only [gosperCatalan, Nat.sub_zero, Nat.centralBinom_zero, Nat.sub_self]
field_simp
ring
theorem catalan_eq_centralBinom_div (n : ℕ) : catalan n = n.centralBinom / (n + 1) := by
suffices (catalan n : ℚ) = Nat.centralBinom n / (n + 1) by
have h := Nat.succ_dvd_centralBinom n
exact mod_cast this
induction' n using Nat.case_strong_induction_on with d hd
· simp
· simp_rw [catalan_succ, Nat.cast_sum, Nat.cast_mul]
trans (∑ i : Fin d.succ, Nat.centralBinom i / (i + 1) *
(Nat.centralBinom (d - i) / (d - i + 1)) : ℚ)
· congr
ext1 x
have m_le_d : x.val ≤ d := by apply Nat.le_of_lt_succ; apply x.2
have d_minus_x_le_d : (d - x.val) ≤ d := tsub_le_self
rw [hd _ m_le_d, hd _ d_minus_x_le_d]
norm_cast
· trans (∑ i : Fin d.succ, (gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i))
· refine sum_congr rfl fun i _ => ?_
rw [gosper_trick i.is_le, mul_div]
· rw [← sum_range fun i => gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i,
sum_range_sub, Nat.succ_eq_add_one]
rw [gosper_catalan_sub_eq_central_binom_div d]
norm_cast
#align catalan_eq_central_binom_div catalan_eq_centralBinom_div
theorem succ_mul_catalan_eq_centralBinom (n : ℕ) : (n + 1) * catalan n = n.centralBinom :=
(Nat.eq_mul_of_div_eq_right n.succ_dvd_centralBinom (catalan_eq_centralBinom_div n).symm).symm
#align succ_mul_catalan_eq_central_binom succ_mul_catalan_eq_centralBinom
theorem catalan_two : catalan 2 = 2 := by
norm_num [catalan_eq_centralBinom_div, Nat.centralBinom, Nat.choose]
#align catalan_two catalan_two
| Mathlib/Combinatorics/Enumerative/Catalan.lean | 148 | 149 | theorem catalan_three : catalan 3 = 5 := by |
norm_num [catalan_eq_centralBinom_div, Nat.centralBinom, Nat.choose]
| true |
import Mathlib.Algebra.FreeMonoid.Basic
import Mathlib.Algebra.Group.Submonoid.MulOpposite
import Mathlib.Algebra.Group.Submonoid.Operations
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Int.Order.Lemmas
#align_import group_theory.submonoid.membership from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
variable {M A B : Type*}
section Assoc
variable [Monoid M] [SetLike B M] [SubmonoidClass B M] {S : B}
section NonAssoc
variable [MulOneClass M]
open Set
namespace Submonoid
-- TODO: this section can be generalized to `[SubmonoidClass B M] [CompleteLattice B]`
-- such that `CompleteLattice.LE` coincides with `SetLike.LE`
@[to_additive]
theorem mem_iSup_of_directed {ι} [hι : Nonempty ι] {S : ι → Submonoid M} (hS : Directed (· ≤ ·) S)
{x : M} : (x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i := by
refine ⟨?_, fun ⟨i, hi⟩ ↦ le_iSup S i hi⟩
suffices x ∈ closure (⋃ i, (S i : Set M)) → ∃ i, x ∈ S i by
simpa only [closure_iUnion, closure_eq (S _)] using this
refine fun hx ↦ closure_induction hx (fun _ ↦ mem_iUnion.1) ?_ ?_
· exact hι.elim fun i ↦ ⟨i, (S i).one_mem⟩
· rintro x y ⟨i, hi⟩ ⟨j, hj⟩
rcases hS i j with ⟨k, hki, hkj⟩
exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩
#align submonoid.mem_supr_of_directed Submonoid.mem_iSup_of_directed
#align add_submonoid.mem_supr_of_directed AddSubmonoid.mem_iSup_of_directed
@[to_additive]
theorem coe_iSup_of_directed {ι} [Nonempty ι] {S : ι → Submonoid M} (hS : Directed (· ≤ ·) S) :
((⨆ i, S i : Submonoid M) : Set M) = ⋃ i, S i :=
Set.ext fun x ↦ by simp [mem_iSup_of_directed hS]
#align submonoid.coe_supr_of_directed Submonoid.coe_iSup_of_directed
#align add_submonoid.coe_supr_of_directed AddSubmonoid.coe_iSup_of_directed
@[to_additive]
theorem mem_sSup_of_directedOn {S : Set (Submonoid M)} (Sne : S.Nonempty)
(hS : DirectedOn (· ≤ ·) S) {x : M} : x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s := by
haveI : Nonempty S := Sne.to_subtype
simp [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk]
#align submonoid.mem_Sup_of_directed_on Submonoid.mem_sSup_of_directedOn
#align add_submonoid.mem_Sup_of_directed_on AddSubmonoid.mem_sSup_of_directedOn
@[to_additive]
theorem coe_sSup_of_directedOn {S : Set (Submonoid M)} (Sne : S.Nonempty)
(hS : DirectedOn (· ≤ ·) S) : (↑(sSup S) : Set M) = ⋃ s ∈ S, ↑s :=
Set.ext fun x => by simp [mem_sSup_of_directedOn Sne hS]
#align submonoid.coe_Sup_of_directed_on Submonoid.coe_sSup_of_directedOn
#align add_submonoid.coe_Sup_of_directed_on AddSubmonoid.coe_sSup_of_directedOn
@[to_additive]
theorem mem_sup_left {S T : Submonoid M} : ∀ {x : M}, x ∈ S → x ∈ S ⊔ T := by
rw [← SetLike.le_def]
exact le_sup_left
#align submonoid.mem_sup_left Submonoid.mem_sup_left
#align add_submonoid.mem_sup_left AddSubmonoid.mem_sup_left
@[to_additive]
theorem mem_sup_right {S T : Submonoid M} : ∀ {x : M}, x ∈ T → x ∈ S ⊔ T := by
rw [← SetLike.le_def]
exact le_sup_right
#align submonoid.mem_sup_right Submonoid.mem_sup_right
#align add_submonoid.mem_sup_right AddSubmonoid.mem_sup_right
@[to_additive]
theorem mul_mem_sup {S T : Submonoid M} {x y : M} (hx : x ∈ S) (hy : y ∈ T) : x * y ∈ S ⊔ T :=
(S ⊔ T).mul_mem (mem_sup_left hx) (mem_sup_right hy)
#align submonoid.mul_mem_sup Submonoid.mul_mem_sup
#align add_submonoid.add_mem_sup AddSubmonoid.add_mem_sup
@[to_additive]
theorem mem_iSup_of_mem {ι : Sort*} {S : ι → Submonoid M} (i : ι) :
∀ {x : M}, x ∈ S i → x ∈ iSup S := by
rw [← SetLike.le_def]
exact le_iSup _ _
#align submonoid.mem_supr_of_mem Submonoid.mem_iSup_of_mem
#align add_submonoid.mem_supr_of_mem AddSubmonoid.mem_iSup_of_mem
@[to_additive]
| Mathlib/Algebra/Group/Submonoid/Membership.lean | 262 | 265 | theorem mem_sSup_of_mem {S : Set (Submonoid M)} {s : Submonoid M} (hs : s ∈ S) :
∀ {x : M}, x ∈ s → x ∈ sSup S := by
rw [← SetLike.le_def] |
rw [← SetLike.le_def]
exact le_sSup hs
| true |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Equiv.Perm
section Fintype
variable [Fintype α] [DecidableEq α] (p : Equiv.Perm α) (x : α)
def toList : List α :=
(List.range (cycleOf p x).support.card).map fun k => (p ^ k) x
#align equiv.perm.to_list Equiv.Perm.toList
@[simp]
theorem toList_one : toList (1 : Perm α) x = [] := by simp [toList, cycleOf_one]
#align equiv.perm.to_list_one Equiv.Perm.toList_one
@[simp]
theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by simp [toList]
#align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff
@[simp]
theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList]
#align equiv.perm.length_to_list Equiv.Perm.length_toList
theorem toList_ne_singleton (y : α) : toList p x ≠ [y] := by
intro H
simpa [card_support_ne_one] using congr_arg length H
#align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton
theorem two_le_length_toList_iff_mem_support {p : Perm α} {x : α} :
2 ≤ length (toList p x) ↔ x ∈ p.support := by simp
#align equiv.perm.two_le_length_to_list_iff_mem_support Equiv.Perm.two_le_length_toList_iff_mem_support
theorem length_toList_pos_of_mem_support (h : x ∈ p.support) : 0 < length (toList p x) :=
zero_lt_two.trans_le (two_le_length_toList_iff_mem_support.mpr h)
#align equiv.perm.length_to_list_pos_of_mem_support Equiv.Perm.length_toList_pos_of_mem_support
theorem get_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).get ⟨n, hn⟩ = (p ^ n) x := by simp [toList]
theorem toList_get_zero (h : x ∈ p.support) :
(toList p x).get ⟨0, (length_toList_pos_of_mem_support _ _ h)⟩ = x := by simp [toList]
set_option linter.deprecated false in
@[deprecated get_toList (since := "2024-05-08")]
theorem nthLe_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).nthLe n hn = (p ^ n) x := by simp [toList]
#align equiv.perm.nth_le_to_list Equiv.Perm.nthLe_toList
set_option linter.deprecated false in
@[deprecated toList_get_zero (since := "2024-05-08")]
theorem toList_nthLe_zero (h : x ∈ p.support) :
(toList p x).nthLe 0 (length_toList_pos_of_mem_support _ _ h) = x := by simp [toList]
#align equiv.perm.to_list_nth_le_zero Equiv.Perm.toList_nthLe_zero
variable {p} {x}
theorem mem_toList_iff {y : α} : y ∈ toList p x ↔ SameCycle p x y ∧ x ∈ p.support := by
simp only [toList, mem_range, mem_map]
constructor
· rintro ⟨n, hx, rfl⟩
refine ⟨⟨n, rfl⟩, ?_⟩
contrapose! hx
rw [← support_cycleOf_eq_nil_iff] at hx
simp [hx]
· rintro ⟨h, hx⟩
simpa using h.exists_pow_eq_of_mem_support hx
#align equiv.perm.mem_to_list_iff Equiv.Perm.mem_toList_iff
set_option linter.deprecated false in
theorem nodup_toList (p : Perm α) (x : α) : Nodup (toList p x) := by
by_cases hx : p x = x
· rw [← not_mem_support, ← toList_eq_nil_iff] at hx
simp [hx]
have hc : IsCycle (cycleOf p x) := isCycle_cycleOf p hx
rw [nodup_iff_nthLe_inj]
rintro n m hn hm
rw [length_toList, ← hc.orderOf] at hm hn
rw [← cycleOf_apply_self, ← Ne, ← mem_support] at hx
rw [nthLe_toList, nthLe_toList, ← cycleOf_pow_apply_self p x n, ←
cycleOf_pow_apply_self p x m]
cases' n with n <;> cases' m with m
· simp
· rw [← hc.support_pow_of_pos_of_lt_orderOf m.zero_lt_succ hm, mem_support,
cycleOf_pow_apply_self] at hx
simp [hx.symm]
· rw [← hc.support_pow_of_pos_of_lt_orderOf n.zero_lt_succ hn, mem_support,
cycleOf_pow_apply_self] at hx
simp [hx]
intro h
have hn' : ¬orderOf (p.cycleOf x) ∣ n.succ := Nat.not_dvd_of_pos_of_lt n.zero_lt_succ hn
have hm' : ¬orderOf (p.cycleOf x) ∣ m.succ := Nat.not_dvd_of_pos_of_lt m.zero_lt_succ hm
rw [← hc.support_pow_eq_iff] at hn' hm'
rw [← Nat.mod_eq_of_lt hn, ← Nat.mod_eq_of_lt hm, ← pow_inj_mod]
refine support_congr ?_ ?_
· rw [hm', hn']
· rw [hm']
intro y hy
obtain ⟨k, rfl⟩ := hc.exists_pow_eq (mem_support.mp hx) (mem_support.mp hy)
rw [← mul_apply, (Commute.pow_pow_self _ _ _).eq, mul_apply, h, ← mul_apply, ← mul_apply,
(Commute.pow_pow_self _ _ _).eq]
#align equiv.perm.nodup_to_list Equiv.Perm.nodup_toList
set_option linter.deprecated false in
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 312 | 320 | theorem next_toList_eq_apply (p : Perm α) (x y : α) (hy : y ∈ toList p x) :
next (toList p x) y hy = p y := by
rw [mem_toList_iff] at hy |
rw [mem_toList_iff] at hy
obtain ⟨k, hk, hk'⟩ := hy.left.exists_pow_eq_of_mem_support hy.right
rw [← nthLe_toList p x k (by simpa using hk)] at hk'
simp_rw [← hk']
rw [next_nthLe _ (nodup_toList _ _), nthLe_toList, nthLe_toList, ← mul_apply, ← pow_succ',
length_toList, ← pow_mod_orderOf_cycleOf_apply p (k + 1), IsCycle.orderOf]
exact isCycle_cycleOf _ (mem_support.mp hy.right)
| true |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Real
open Set Filter
open scoped Topology Real
theorem tan_add {x y : ℝ}
(h : ((∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) ∨
(∃ k : ℤ, x = (2 * k + 1) * π / 2) ∧ ∃ l : ℤ, y = (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by
simpa only [← Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div,
Complex.ofReal_mul, Complex.ofReal_tan] using
@Complex.tan_add (x : ℂ) (y : ℂ) (by convert h <;> norm_cast)
#align real.tan_add Real.tan_add
theorem tan_add' {x y : ℝ}
(h : (∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) :=
tan_add (Or.inl h)
#align real.tan_add' Real.tan_add'
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean | 47 | 49 | theorem tan_two_mul {x : ℝ} : tan (2 * x) = 2 * tan x / (1 - tan x ^ 2) := by
have := @Complex.tan_two_mul x |
have := @Complex.tan_two_mul x
norm_cast at *
| true |
import Mathlib.Algebra.Order.Floor
import Mathlib.Algebra.ContinuedFractions.Basic
#align_import algebra.continued_fractions.computation.basic from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
-- Fix a carrier `K`.
variable (K : Type*)
structure IntFractPair where
b : ℤ
fr : K
#align generalized_continued_fraction.int_fract_pair GeneralizedContinuedFraction.IntFractPair
variable {K}
namespace IntFractPair
instance [Repr K] : Repr (IntFractPair K) :=
⟨fun p _ => "(b : " ++ repr p.b ++ ", fract : " ++ repr p.fr ++ ")"⟩
instance inhabited [Inhabited K] : Inhabited (IntFractPair K) :=
⟨⟨0, default⟩⟩
#align generalized_continued_fraction.int_fract_pair.inhabited GeneralizedContinuedFraction.IntFractPair.inhabited
def mapFr {β : Type*} (f : K → β) (gp : IntFractPair K) : IntFractPair β :=
⟨gp.b, f gp.fr⟩
set_option linter.uppercaseLean3 false in
#align generalized_continued_fraction.int_fract_pair.mapFr GeneralizedContinuedFraction.IntFractPair.mapFr
-- Note: this could be relaxed to something like `LinearOrderedDivisionRing` in the future.
-- Fix a discrete linear ordered field with `floor` function.
variable [LinearOrderedField K] [FloorRing K]
protected def of (v : K) : IntFractPair K :=
⟨⌊v⌋, Int.fract v⟩
#align generalized_continued_fraction.int_fract_pair.of GeneralizedContinuedFraction.IntFractPair.of
protected def stream (v : K) : Stream' <| Option (IntFractPair K)
| 0 => some (IntFractPair.of v)
| n + 1 =>
(IntFractPair.stream v n).bind fun ap_n =>
if ap_n.fr = 0 then none else some (IntFractPair.of ap_n.fr⁻¹)
#align generalized_continued_fraction.int_fract_pair.stream GeneralizedContinuedFraction.IntFractPair.stream
| Mathlib/Algebra/ContinuedFractions/Computation/Basic.lean | 159 | 161 | theorem stream_isSeq (v : K) : (IntFractPair.stream v).IsSeq := by
intro _ hyp |
intro _ hyp
simp [IntFractPair.stream, hyp]
| true |
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Order.Bounded
import Mathlib.SetTheory.Cardinal.PartENat
import Mathlib.SetTheory.Ordinal.Principal
import Mathlib.Tactic.Linarith
#align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f"
noncomputable section
open Function Set Cardinal Equiv Order Ordinal
open scoped Classical
universe u v w
namespace Cardinal
section UsingOrdinals
theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by
refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩
· rw [← Ordinal.le_zero, ord_le] at h
simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h
· rw [ord_le] at h ⊢
rwa [← @add_one_of_aleph0_le (card a), ← card_succ]
rw [← ord_le, ← le_succ_of_isLimit, ord_le]
· exact co.trans h
· rw [ord_aleph0]
exact omega_isLimit
#align cardinal.ord_is_limit Cardinal.ord_isLimit
theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α :=
Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2
section mulOrdinals
| Mathlib/SetTheory/Cardinal/Ordinal.lean | 500 | 543 | theorem mul_eq_self {c : Cardinal} (h : ℵ₀ ≤ c) : c * c = c := by
refine le_antisymm ?_ (by simpa only [mul_one] using mul_le_mul_left' (one_le_aleph0.trans h) c) |
refine le_antisymm ?_ (by simpa only [mul_one] using mul_le_mul_left' (one_le_aleph0.trans h) c)
-- the only nontrivial part is `c * c ≤ c`. We prove it inductively.
refine Acc.recOn (Cardinal.lt_wf.apply c) (fun c _ => Quotient.inductionOn c fun α IH ol => ?_) h
-- consider the minimal well-order `r` on `α` (a type with cardinality `c`).
rcases ord_eq α with ⟨r, wo, e⟩
letI := linearOrderOfSTO r
haveI : IsWellOrder α (· < ·) := wo
-- Define an order `s` on `α × α` by writing `(a, b) < (c, d)` if `max a b < max c d`, or
-- the max are equal and `a < c`, or the max are equal and `a = c` and `b < d`.
let g : α × α → α := fun p => max p.1 p.2
let f : α × α ↪ Ordinal × α × α :=
⟨fun p : α × α => (typein (· < ·) (g p), p), fun p q => congr_arg Prod.snd⟩
let s := f ⁻¹'o Prod.Lex (· < ·) (Prod.Lex (· < ·) (· < ·))
-- this is a well order on `α × α`.
haveI : IsWellOrder _ s := (RelEmbedding.preimage _ _).isWellOrder
/- it suffices to show that this well order is smaller than `r`
if it were larger, then `r` would be a strict prefix of `s`. It would be contained in
`β × β` for some `β` of cardinality `< c`. By the inductive assumption, this set has the
same cardinality as `β` (or it is finite if `β` is finite), so it is `< c`, which is a
contradiction. -/
suffices type s ≤ type r by exact card_le_card this
refine le_of_forall_lt fun o h => ?_
rcases typein_surj s h with ⟨p, rfl⟩
rw [← e, lt_ord]
refine lt_of_le_of_lt
(?_ : _ ≤ card (succ (typein (· < ·) (g p))) * card (succ (typein (· < ·) (g p)))) ?_
· have : { q | s q p } ⊆ insert (g p) { x | x < g p } ×ˢ insert (g p) { x | x < g p } := by
intro q h
simp only [s, f, Preimage, ge_iff_le, Embedding.coeFn_mk, Prod.lex_def, typein_lt_typein,
typein_inj, mem_setOf_eq] at h
exact max_le_iff.1 (le_iff_lt_or_eq.2 <| h.imp_right And.left)
suffices H : (insert (g p) { x | r x (g p) } : Set α) ≃ Sum { x | r x (g p) } PUnit from
⟨(Set.embeddingOfSubset _ _ this).trans
((Equiv.Set.prod _ _).trans (H.prodCongr H)).toEmbedding⟩
refine (Equiv.Set.insert ?_).trans ((Equiv.refl _).sumCongr punitEquivPUnit)
apply @irrefl _ r
cases' lt_or_le (card (succ (typein (· < ·) (g p)))) ℵ₀ with qo qo
· exact (mul_lt_aleph0 qo qo).trans_le ol
· suffices (succ (typein LT.lt (g p))).card < ⟦α⟧ from (IH _ this qo).trans_lt this
rw [← lt_ord]
apply (ord_isLimit ol).2
rw [mk'_def, e]
apply typein_lt_type
| true |
import Mathlib.Algebra.Group.Support
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Nat.Cast.Field
#align_import algebra.char_zero.lemmas from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829"
open Function Set
section AddMonoidWithOne
variable {α M : Type*} [AddMonoidWithOne M] [CharZero M] {n : ℕ}
instance CharZero.NeZero.two : NeZero (2 : M) :=
⟨by
have : ((2 : ℕ) : M) ≠ 0 := Nat.cast_ne_zero.2 (by decide)
rwa [Nat.cast_two] at this⟩
#align char_zero.ne_zero.two CharZero.NeZero.two
section
variable {R : Type*} [NonAssocSemiring R] [NoZeroDivisors R] [CharZero R] {a : R}
@[simp]
theorem add_self_eq_zero {a : R} : a + a = 0 ↔ a = 0 := by
simp only [(two_mul a).symm, mul_eq_zero, two_ne_zero, false_or_iff]
#align add_self_eq_zero add_self_eq_zero
set_option linter.deprecated false
@[simp]
theorem bit0_eq_zero {a : R} : bit0 a = 0 ↔ a = 0 :=
add_self_eq_zero
#align bit0_eq_zero bit0_eq_zero
@[simp]
theorem zero_eq_bit0 {a : R} : 0 = bit0 a ↔ a = 0 := by
rw [eq_comm]
exact bit0_eq_zero
#align zero_eq_bit0 zero_eq_bit0
theorem bit0_ne_zero : bit0 a ≠ 0 ↔ a ≠ 0 :=
bit0_eq_zero.not
#align bit0_ne_zero bit0_ne_zero
theorem zero_ne_bit0 : 0 ≠ bit0 a ↔ a ≠ 0 :=
zero_eq_bit0.not
#align zero_ne_bit0 zero_ne_bit0
end
section
variable {R : Type*} [NonAssocRing R] [NoZeroDivisors R] [CharZero R]
@[simp] theorem neg_eq_self_iff {a : R} : -a = a ↔ a = 0 :=
neg_eq_iff_add_eq_zero.trans add_self_eq_zero
#align neg_eq_self_iff neg_eq_self_iff
@[simp] theorem eq_neg_self_iff {a : R} : a = -a ↔ a = 0 :=
eq_neg_iff_add_eq_zero.trans add_self_eq_zero
#align eq_neg_self_iff eq_neg_self_iff
theorem nat_mul_inj {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) : n = 0 ∨ a = b := by
rw [← sub_eq_zero, ← mul_sub, mul_eq_zero, sub_eq_zero] at h
exact mod_cast h
#align nat_mul_inj nat_mul_inj
theorem nat_mul_inj' {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) (w : n ≠ 0) : a = b := by
simpa [w] using nat_mul_inj h
#align nat_mul_inj' nat_mul_inj'
set_option linter.deprecated false
theorem bit0_injective : Function.Injective (bit0 : R → R) := fun a b h => by
dsimp [bit0] at h
simp only [(two_mul a).symm, (two_mul b).symm] at h
refine nat_mul_inj' ?_ two_ne_zero
exact mod_cast h
#align bit0_injective bit0_injective
theorem bit1_injective : Function.Injective (bit1 : R → R) := fun a b h => by
simp only [bit1, add_left_inj] at h
exact bit0_injective h
#align bit1_injective bit1_injective
@[simp]
theorem bit0_eq_bit0 {a b : R} : bit0 a = bit0 b ↔ a = b :=
bit0_injective.eq_iff
#align bit0_eq_bit0 bit0_eq_bit0
@[simp]
theorem bit1_eq_bit1 {a b : R} : bit1 a = bit1 b ↔ a = b :=
bit1_injective.eq_iff
#align bit1_eq_bit1 bit1_eq_bit1
@[simp]
theorem bit1_eq_one {a : R} : bit1 a = 1 ↔ a = 0 := by
rw [show (1 : R) = bit1 0 by simp, bit1_eq_bit1]
#align bit1_eq_one bit1_eq_one
@[simp]
theorem one_eq_bit1 {a : R} : 1 = bit1 a ↔ a = 0 := by
rw [eq_comm]
exact bit1_eq_one
#align one_eq_bit1 one_eq_bit1
end
section
variable {R : Type*} [DivisionRing R] [CharZero R]
@[simp] lemma half_add_self (a : R) : (a + a) / 2 = a := by
rw [← mul_two, mul_div_cancel_right₀ a two_ne_zero]
#align half_add_self half_add_self
@[simp]
theorem add_halves' (a : R) : a / 2 + a / 2 = a := by rw [← add_div, half_add_self]
#align add_halves' add_halves'
theorem sub_half (a : R) : a - a / 2 = a / 2 := by rw [sub_eq_iff_eq_add, add_halves']
#align sub_half sub_half
| Mathlib/Algebra/CharZero/Lemmas.lean | 188 | 188 | theorem half_sub (a : R) : a / 2 - a = -(a / 2) := by | rw [← neg_sub, sub_half]
| true |
import Mathlib.LinearAlgebra.Quotient
#align_import linear_algebra.isomorphisms from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"
universe u v
variable {R M M₂ M₃ : Type*}
variable [Ring R] [AddCommGroup M] [AddCommGroup M₂] [AddCommGroup M₃]
variable [Module R M] [Module R M₂] [Module R M₃]
variable (f : M →ₗ[R] M₂)
namespace LinearMap
open Submodule
section IsomorphismLaws
noncomputable def quotKerEquivRange : (M ⧸ LinearMap.ker f) ≃ₗ[R] LinearMap.range f :=
(LinearEquiv.ofInjective (f.ker.liftQ f <| le_rfl) <|
ker_eq_bot.mp <| Submodule.ker_liftQ_eq_bot _ _ _ (le_refl (LinearMap.ker f))).trans
(LinearEquiv.ofEq _ _ <| Submodule.range_liftQ _ _ _)
#align linear_map.quot_ker_equiv_range LinearMap.quotKerEquivRange
noncomputable def quotKerEquivOfSurjective (f : M →ₗ[R] M₂) (hf : Function.Surjective f) :
(M ⧸ LinearMap.ker f) ≃ₗ[R] M₂ :=
f.quotKerEquivRange.trans (LinearEquiv.ofTop (LinearMap.range f) (LinearMap.range_eq_top.2 hf))
#align linear_map.quot_ker_equiv_of_surjective LinearMap.quotKerEquivOfSurjective
@[simp]
theorem quotKerEquivRange_apply_mk (x : M) :
(f.quotKerEquivRange (Submodule.Quotient.mk x) : M₂) = f x :=
rfl
#align linear_map.quot_ker_equiv_range_apply_mk LinearMap.quotKerEquivRange_apply_mk
@[simp]
theorem quotKerEquivRange_symm_apply_image (x : M) (h : f x ∈ LinearMap.range f) :
f.quotKerEquivRange.symm ⟨f x, h⟩ = f.ker.mkQ x :=
f.quotKerEquivRange.symm_apply_apply (f.ker.mkQ x)
#align linear_map.quot_ker_equiv_range_symm_apply_image LinearMap.quotKerEquivRange_symm_apply_image
-- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out
abbrev subToSupQuotient (p p' : Submodule R M) :
{ x // x ∈ p } →ₗ[R] { x // x ∈ p ⊔ p' } ⧸ comap (Submodule.subtype (p ⊔ p')) p' :=
(comap (p ⊔ p').subtype p').mkQ.comp (Submodule.inclusion le_sup_left)
-- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out
theorem comap_leq_ker_subToSupQuotient (p p' : Submodule R M) :
comap (Submodule.subtype p) (p ⊓ p') ≤ ker (subToSupQuotient p p') := by
rw [LinearMap.ker_comp, Submodule.inclusion, comap_codRestrict, ker_mkQ, map_comap_subtype]
exact comap_mono (inf_le_inf_right _ le_sup_left)
def quotientInfToSupQuotient (p p' : Submodule R M) :
(↥p) ⧸ (comap p.subtype (p ⊓ p')) →ₗ[R] (↥(p ⊔ p')) ⧸ (comap (p ⊔ p').subtype p') :=
(comap p.subtype (p ⊓ p')).liftQ (subToSupQuotient p p') (comap_leq_ker_subToSupQuotient p p')
#align linear_map.quotient_inf_to_sup_quotient LinearMap.quotientInfToSupQuotient
-- Porting note: breaking up original definition of quotientInfEquivSupQuotient to avoid timing out
| Mathlib/LinearAlgebra/Isomorphisms.lean | 81 | 85 | theorem quotientInfEquivSupQuotient_injective (p p' : Submodule R M) :
Function.Injective (quotientInfToSupQuotient p p') := by
rw [← ker_eq_bot, quotientInfToSupQuotient, ker_liftQ_eq_bot] |
rw [← ker_eq_bot, quotientInfToSupQuotient, ker_liftQ_eq_bot]
rw [ker_comp, ker_mkQ]
exact fun ⟨x, hx1⟩ hx2 => ⟨hx1, hx2⟩
| true |
import Mathlib.Order.Antichain
import Mathlib.Order.UpperLower.Basic
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.RelIso.Set
#align_import order.minimal from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
open Function Set
variable {α : Type*} (r r₁ r₂ : α → α → Prop) (s t : Set α) (a b : α)
def maximals : Set α :=
{ a ∈ s | ∀ ⦃b⦄, b ∈ s → r a b → r b a }
#align maximals maximals
def minimals : Set α :=
{ a ∈ s | ∀ ⦃b⦄, b ∈ s → r b a → r a b }
#align minimals minimals
theorem maximals_subset : maximals r s ⊆ s :=
sep_subset _ _
#align maximals_subset maximals_subset
theorem minimals_subset : minimals r s ⊆ s :=
sep_subset _ _
#align minimals_subset minimals_subset
@[simp]
theorem maximals_empty : maximals r ∅ = ∅ :=
sep_empty _
#align maximals_empty maximals_empty
@[simp]
theorem minimals_empty : minimals r ∅ = ∅ :=
sep_empty _
#align minimals_empty minimals_empty
@[simp]
theorem maximals_singleton : maximals r {a} = {a} :=
(maximals_subset _ _).antisymm <|
singleton_subset_iff.2 <|
⟨rfl, by
rintro b (rfl : b = a)
exact id⟩
#align maximals_singleton maximals_singleton
@[simp]
theorem minimals_singleton : minimals r {a} = {a} :=
maximals_singleton _ _
#align minimals_singleton minimals_singleton
theorem maximals_swap : maximals (swap r) s = minimals r s :=
rfl
#align maximals_swap maximals_swap
theorem minimals_swap : minimals (swap r) s = maximals r s :=
rfl
#align minimals_swap minimals_swap
section IsAntisymm
variable {r s t a b} [IsAntisymm α r]
theorem eq_of_mem_maximals (ha : a ∈ maximals r s) (hb : b ∈ s) (h : r a b) : a = b :=
antisymm h <| ha.2 hb h
#align eq_of_mem_maximals eq_of_mem_maximals
theorem eq_of_mem_minimals (ha : a ∈ minimals r s) (hb : b ∈ s) (h : r b a) : a = b :=
antisymm (ha.2 hb h) h
#align eq_of_mem_minimals eq_of_mem_minimals
set_option autoImplicit true
theorem mem_maximals_iff : x ∈ maximals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, y ∈ s → r x y → x = y := by
simp only [maximals, Set.mem_sep_iff, and_congr_right_iff]
refine fun _ ↦ ⟨fun h y hys hxy ↦ antisymm hxy (h hys hxy), fun h y hys hxy ↦ ?_⟩
convert hxy <;> rw [h hys hxy]
theorem mem_maximals_setOf_iff : x ∈ maximals r (setOf P) ↔ P x ∧ ∀ ⦃y⦄, P y → r x y → x = y :=
mem_maximals_iff
theorem mem_minimals_iff : x ∈ minimals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, y ∈ s → r y x → x = y :=
@mem_maximals_iff _ _ _ (IsAntisymm.swap r) _
theorem mem_minimals_setOf_iff : x ∈ minimals r (setOf P) ↔ P x ∧ ∀ ⦃y⦄, P y → r y x → x = y :=
mem_minimals_iff
theorem mem_minimals_iff_forall_lt_not_mem' (rlt : α → α → Prop) [IsNonstrictStrictOrder α r rlt] :
x ∈ minimals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, rlt y x → y ∉ s := by
simp [minimals, right_iff_left_not_left_of r rlt, not_imp_not, imp.swap (a := _ ∈ _)]
theorem mem_maximals_iff_forall_lt_not_mem' (rlt : α → α → Prop) [IsNonstrictStrictOrder α r rlt] :
x ∈ maximals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, rlt x y → y ∉ s := by
simp [maximals, right_iff_left_not_left_of r rlt, not_imp_not, imp.swap (a := _ ∈ _)]
| Mathlib/Order/Minimal.lean | 121 | 128 | theorem minimals_eq_minimals_of_subset_of_forall [IsTrans α r] (hts : t ⊆ s)
(h : ∀ x ∈ s, ∃ y ∈ t, r y x) : minimals r s = minimals r t := by
refine Set.ext fun a ↦ ⟨fun ⟨has, hmin⟩ ↦ ⟨?_,fun b hbt ↦ hmin (hts hbt)⟩, |
refine Set.ext fun a ↦ ⟨fun ⟨has, hmin⟩ ↦ ⟨?_,fun b hbt ↦ hmin (hts hbt)⟩,
fun ⟨hat, hmin⟩ ↦ ⟨hts hat, fun b hbs hba ↦ ?_⟩⟩
· obtain ⟨a', ha', haa'⟩ := h _ has
rwa [antisymm (hmin (hts ha') haa') haa']
obtain ⟨b', hb't, hb'b⟩ := h b hbs
rwa [antisymm (hmin hb't (Trans.trans hb'b hba)) (Trans.trans hb'b hba)]
| true |
import Mathlib.Topology.PartialHomeomorph
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Data.Real.Sqrt
#align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Set Metric Pointwise
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable section
@[simps (config := .lemmasOnly)]
def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where
toFun x := (√(1 + ‖x‖ ^ 2))⁻¹ • x
invFun y := (√(1 - ‖(y : E)‖ ^ 2))⁻¹ • (y : E)
source := univ
target := ball 0 1
map_source' x _ := by
have : 0 < 1 + ‖x‖ ^ 2 := by positivity
rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ← _root_.div_eq_inv_mul,
div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ← abs_norm x, ← sq_lt_sq,
abs_norm, Real.sq_sqrt this.le]
exact lt_one_add _
map_target' _ _ := trivial
left_inv' x _ := by
field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs,
Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, ← Real.sqrt_div (zero_lt_one_add_norm_sq x).le]
right_inv' y hy := by
have : 0 < 1 - ‖y‖ ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le,
← Real.sqrt_div this.le]
open_source := isOpen_univ
open_target := isOpen_ball
continuousOn_toFun := by
suffices Continuous fun (x:E) => (√(1 + ‖x‖ ^ 2))⁻¹
from (this.smul continuous_id).continuousOn
refine Continuous.inv₀ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity)
continuity
continuousOn_invFun := by
have : ∀ y ∈ ball (0 : E) 1, √(1 - ‖(y : E)‖ ^ 2) ≠ 0 := fun y hy ↦ by
rw [Real.sqrt_ne_zero']
nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
exact ContinuousOn.smul (ContinuousOn.inv₀
(continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id
@[simp]
theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by
simp [PartialHomeomorph.univUnitBall_apply]
@[simp]
theorem PartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by
simp [PartialHomeomorph.univUnitBall_symm_apply]
@[simps! (config := .lemmasOnly)]
def Homeomorph.unitBall : E ≃ₜ ball (0 : E) 1 :=
(Homeomorph.Set.univ _).symm.trans PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget
#align homeomorph_unit_ball Homeomorph.unitBall
@[simp]
theorem Homeomorph.coe_unitBall_apply_zero :
(Homeomorph.unitBall (0 : E) : E) = 0 :=
PartialHomeomorph.univUnitBall_apply_zero
#align coe_homeomorph_unit_ball_apply_zero Homeomorph.coe_unitBall_apply_zero
variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P]
namespace PartialHomeomorph
@[simps!]
def unitBallBall (c : P) (r : ℝ) (hr : 0 < r) : PartialHomeomorph E P :=
((Homeomorph.smulOfNeZero r hr.ne').trans
(IsometryEquiv.vaddConst c).toHomeomorph).toPartialHomeomorphOfImageEq
(ball 0 1) isOpen_ball (ball c r) <| by
change (IsometryEquiv.vaddConst c) ∘ (r • ·) '' ball (0 : E) 1 = ball c r
rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball]
simp [abs_of_pos hr]
def univBall (c : P) (r : ℝ) : PartialHomeomorph E P :=
if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl
else (IsometryEquiv.vaddConst c).toHomeomorph.toPartialHomeomorph
@[simp]
theorem univBall_source (c : P) (r : ℝ) : (univBall c r).source = univ := by
unfold univBall; split_ifs <;> rfl
| Mathlib/Analysis/NormedSpace/HomeomorphBall.lean | 130 | 131 | theorem univBall_target (c : P) {r : ℝ} (hr : 0 < r) : (univBall c r).target = ball c r := by |
rw [univBall, dif_pos hr]; rfl
| true |
import Mathlib.Logic.Encodable.Lattice
import Mathlib.MeasureTheory.MeasurableSpace.Defs
#align_import measure_theory.pi_system from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
open MeasurableSpace Set
open scoped Classical
open MeasureTheory
def IsPiSystem {α} (C : Set (Set α)) : Prop :=
∀ᵉ (s ∈ C) (t ∈ C), (s ∩ t : Set α).Nonempty → s ∩ t ∈ C
#align is_pi_system IsPiSystem
theorem IsPiSystem.singleton {α} (S : Set α) : IsPiSystem ({S} : Set (Set α)) := by
intro s h_s t h_t _
rw [Set.mem_singleton_iff.1 h_s, Set.mem_singleton_iff.1 h_t, Set.inter_self,
Set.mem_singleton_iff]
#align is_pi_system.singleton IsPiSystem.singleton
theorem IsPiSystem.insert_empty {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert ∅ S) := by
intro s hs t ht hst
cases' hs with hs hs
· simp [hs]
· cases' ht with ht ht
· simp [ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_empty IsPiSystem.insert_empty
theorem IsPiSystem.insert_univ {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert Set.univ S) := by
intro s hs t ht hst
cases' hs with hs hs
· cases' ht with ht ht <;> simp [hs, ht]
· cases' ht with ht ht
· simp [hs, ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_univ IsPiSystem.insert_univ
theorem IsPiSystem.comap {α β} {S : Set (Set β)} (h_pi : IsPiSystem S) (f : α → β) :
IsPiSystem { s : Set α | ∃ t ∈ S, f ⁻¹' t = s } := by
rintro _ ⟨s, hs_mem, rfl⟩ _ ⟨t, ht_mem, rfl⟩ hst
rw [← Set.preimage_inter] at hst ⊢
exact ⟨s ∩ t, h_pi s hs_mem t ht_mem (nonempty_of_nonempty_preimage hst), rfl⟩
#align is_pi_system.comap IsPiSystem.comap
theorem isPiSystem_iUnion_of_directed_le {α ι} (p : ι → Set (Set α))
(hp_pi : ∀ n, IsPiSystem (p n)) (hp_directed : Directed (· ≤ ·) p) :
IsPiSystem (⋃ n, p n) := by
intro t1 ht1 t2 ht2 h
rw [Set.mem_iUnion] at ht1 ht2 ⊢
cases' ht1 with n ht1
cases' ht2 with m ht2
obtain ⟨k, hpnk, hpmk⟩ : ∃ k, p n ≤ p k ∧ p m ≤ p k := hp_directed n m
exact ⟨k, hp_pi k t1 (hpnk ht1) t2 (hpmk ht2) h⟩
#align is_pi_system_Union_of_directed_le isPiSystem_iUnion_of_directed_le
theorem isPiSystem_iUnion_of_monotone {α ι} [SemilatticeSup ι] (p : ι → Set (Set α))
(hp_pi : ∀ n, IsPiSystem (p n)) (hp_mono : Monotone p) : IsPiSystem (⋃ n, p n) :=
isPiSystem_iUnion_of_directed_le p hp_pi (Monotone.directed_le hp_mono)
#align is_pi_system_Union_of_monotone isPiSystem_iUnion_of_monotone
inductive generatePiSystem {α} (S : Set (Set α)) : Set (Set α)
| base {s : Set α} (h_s : s ∈ S) : generatePiSystem S s
| inter {s t : Set α} (h_s : generatePiSystem S s) (h_t : generatePiSystem S t)
(h_nonempty : (s ∩ t).Nonempty) : generatePiSystem S (s ∩ t)
#align generate_pi_system generatePiSystem
theorem isPiSystem_generatePiSystem {α} (S : Set (Set α)) : IsPiSystem (generatePiSystem S) :=
fun _ h_s _ h_t h_nonempty => generatePiSystem.inter h_s h_t h_nonempty
#align is_pi_system_generate_pi_system isPiSystem_generatePiSystem
theorem subset_generatePiSystem_self {α} (S : Set (Set α)) : S ⊆ generatePiSystem S := fun _ =>
generatePiSystem.base
#align subset_generate_pi_system_self subset_generatePiSystem_self
theorem generatePiSystem_subset_self {α} {S : Set (Set α)} (h_S : IsPiSystem S) :
generatePiSystem S ⊆ S := fun x h => by
induction' h with _ h_s s u _ _ h_nonempty h_s h_u
· exact h_s
· exact h_S _ h_s _ h_u h_nonempty
#align generate_pi_system_subset_self generatePiSystem_subset_self
theorem generatePiSystem_eq {α} {S : Set (Set α)} (h_pi : IsPiSystem S) : generatePiSystem S = S :=
Set.Subset.antisymm (generatePiSystem_subset_self h_pi) (subset_generatePiSystem_self S)
#align generate_pi_system_eq generatePiSystem_eq
theorem generatePiSystem_mono {α} {S T : Set (Set α)} (hST : S ⊆ T) :
generatePiSystem S ⊆ generatePiSystem T := fun t ht => by
induction' ht with s h_s s u _ _ h_nonempty h_s h_u
· exact generatePiSystem.base (Set.mem_of_subset_of_mem hST h_s)
· exact isPiSystem_generatePiSystem T _ h_s _ h_u h_nonempty
#align generate_pi_system_mono generatePiSystem_mono
| Mathlib/MeasureTheory/PiSystem.lean | 256 | 261 | theorem generatePiSystem_measurableSet {α} [M : MeasurableSpace α] {S : Set (Set α)}
(h_meas_S : ∀ s ∈ S, MeasurableSet s) (t : Set α) (h_in_pi : t ∈ generatePiSystem S) :
MeasurableSet t := by
induction' h_in_pi with s h_s s u _ _ _ h_s h_u |
induction' h_in_pi with s h_s s u _ _ _ h_s h_u
· apply h_meas_S _ h_s
· apply MeasurableSet.inter h_s h_u
| true |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Order.Interval.Set.IsoIoo
import Mathlib.Topology.Order.MonotoneContinuity
import Mathlib.Topology.UrysohnsBounded
#align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [NormalSpace Y]
open Metric Set Filter
open BoundedContinuousFunction Topology
noncomputable section
namespace BoundedContinuousFunction
theorem tietze_extension_step (f : X →ᵇ ℝ) (e : C(X, Y)) (he : ClosedEmbedding e) :
∃ g : Y →ᵇ ℝ, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖ := by
have h3 : (0 : ℝ) < 3 := by norm_num1
have h23 : 0 < (2 / 3 : ℝ) := by norm_num1
-- In the trivial case `f = 0`, we take `g = 0`
rcases eq_or_ne f 0 with (rfl | hf)
· use 0
simp
replace hf : 0 < ‖f‖ := norm_pos_iff.2 hf
have hf3 : -‖f‖ / 3 < ‖f‖ / 3 := (div_lt_div_right h3).2 (Left.neg_lt_self hf)
have hc₁ : IsClosed (e '' (f ⁻¹' Iic (-‖f‖ / 3))) :=
he.isClosedMap _ (isClosed_Iic.preimage f.continuous)
have hc₂ : IsClosed (e '' (f ⁻¹' Ici (‖f‖ / 3))) :=
he.isClosedMap _ (isClosed_Ici.preimage f.continuous)
have hd : Disjoint (e '' (f ⁻¹' Iic (-‖f‖ / 3))) (e '' (f ⁻¹' Ici (‖f‖ / 3))) := by
refine disjoint_image_of_injective he.inj (Disjoint.preimage _ ?_)
rwa [Iic_disjoint_Ici, not_le]
rcases exists_bounded_mem_Icc_of_closed_of_le hc₁ hc₂ hd hf3.le with ⟨g, hg₁, hg₂, hgf⟩
refine ⟨g, ?_, ?_⟩
· refine (norm_le <| div_nonneg hf.le h3.le).mpr fun y => ?_
simpa [abs_le, neg_div] using hgf y
· refine (dist_le <| mul_nonneg h23.le hf.le).mpr fun x => ?_
have hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖ := by
simpa only [Real.norm_eq_abs, abs_le] using f.norm_coe_le_norm x
rcases le_total (f x) (-‖f‖ / 3) with hle₁ | hle₁
· calc
|g (e x) - f x| = -‖f‖ / 3 - f x := by
rw [hg₁ (mem_image_of_mem _ hle₁), Function.const_apply,
abs_of_nonneg (sub_nonneg.2 hle₁)]
_ ≤ 2 / 3 * ‖f‖ := by linarith
· rcases le_total (f x) (‖f‖ / 3) with hle₂ | hle₂
· simp only [neg_div] at *
calc
dist (g (e x)) (f x) ≤ |g (e x)| + |f x| := dist_le_norm_add_norm _ _
_ ≤ ‖f‖ / 3 + ‖f‖ / 3 := (add_le_add (abs_le.2 <| hgf _) (abs_le.2 ⟨hle₁, hle₂⟩))
_ = 2 / 3 * ‖f‖ := by linarith
· calc
|g (e x) - f x| = f x - ‖f‖ / 3 := by
rw [hg₂ (mem_image_of_mem _ hle₂), abs_sub_comm, Function.const_apply,
abs_of_nonneg (sub_nonneg.2 hle₂)]
_ ≤ 2 / 3 * ‖f‖ := by linarith
#align bounded_continuous_function.tietze_extension_step BoundedContinuousFunction.tietze_extension_step
| Mathlib/Topology/TietzeExtension.lean | 220 | 262 | theorem exists_extension_norm_eq_of_closedEmbedding' (f : X →ᵇ ℝ) (e : C(X, Y))
(he : ClosedEmbedding e) : ∃ g : Y →ᵇ ℝ, ‖g‖ = ‖f‖ ∧ g.compContinuous e = f := by
/- For the proof, we iterate `tietze_extension_step`. Each time we apply it to the difference |
/- For the proof, we iterate `tietze_extension_step`. Each time we apply it to the difference
between the previous approximation and `f`. -/
choose F hF_norm hF_dist using fun f : X →ᵇ ℝ => tietze_extension_step f e he
set g : ℕ → Y →ᵇ ℝ := fun n => (fun g => g + F (f - g.compContinuous e))^[n] 0
have g0 : g 0 = 0 := rfl
have g_succ : ∀ n, g (n + 1) = g n + F (f - (g n).compContinuous e) := fun n =>
Function.iterate_succ_apply' _ _ _
have hgf : ∀ n, dist ((g n).compContinuous e) f ≤ (2 / 3) ^ n * ‖f‖ := by
intro n
induction' n with n ihn
· simp [g0]
· rw [g_succ n, add_compContinuous, ← dist_sub_right, add_sub_cancel_left, pow_succ', mul_assoc]
refine (hF_dist _).trans (mul_le_mul_of_nonneg_left ?_ (by norm_num1))
rwa [← dist_eq_norm']
have hg_dist : ∀ n, dist (g n) (g (n + 1)) ≤ 1 / 3 * ‖f‖ * (2 / 3) ^ n := by
intro n
calc
dist (g n) (g (n + 1)) = ‖F (f - (g n).compContinuous e)‖ := by
rw [g_succ, dist_eq_norm', add_sub_cancel_left]
_ ≤ ‖f - (g n).compContinuous e‖ / 3 := hF_norm _
_ = 1 / 3 * dist ((g n).compContinuous e) f := by rw [dist_eq_norm', one_div, div_eq_inv_mul]
_ ≤ 1 / 3 * ((2 / 3) ^ n * ‖f‖) := mul_le_mul_of_nonneg_left (hgf n) (by norm_num1)
_ = 1 / 3 * ‖f‖ * (2 / 3) ^ n := by ac_rfl
have hg_cau : CauchySeq g := cauchySeq_of_le_geometric _ _ (by norm_num1) hg_dist
have :
Tendsto (fun n => (g n).compContinuous e) atTop
(𝓝 <| (limUnder atTop g).compContinuous e) :=
((continuous_compContinuous e).tendsto _).comp hg_cau.tendsto_limUnder
have hge : (limUnder atTop g).compContinuous e = f := by
refine tendsto_nhds_unique this (tendsto_iff_dist_tendsto_zero.2 ?_)
refine squeeze_zero (fun _ => dist_nonneg) hgf ?_
rw [← zero_mul ‖f‖]
refine (tendsto_pow_atTop_nhds_zero_of_lt_one ?_ ?_).mul tendsto_const_nhds <;> norm_num1
refine ⟨limUnder atTop g, le_antisymm ?_ ?_, hge⟩
· rw [← dist_zero_left, ← g0]
refine
(dist_le_of_le_geometric_of_tendsto₀ _ _ (by norm_num1)
hg_dist hg_cau.tendsto_limUnder).trans_eq ?_
field_simp [show (3 - 2 : ℝ) = 1 by norm_num1]
· rw [← hge]
exact norm_compContinuous_le _ _
| true |
import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.MeasureTheory.Constructions.BorelSpace.Complex
#align_import measure_theory.function.special_functions.is_R_or_C from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad"
noncomputable section
open NNReal ENNReal
namespace RCLike
variable {𝕜 : Type*} [RCLike 𝕜]
@[measurability]
theorem measurable_re : Measurable (re : 𝕜 → ℝ) :=
continuous_re.measurable
#align is_R_or_C.measurable_re RCLike.measurable_re
@[measurability]
theorem measurable_im : Measurable (im : 𝕜 → ℝ) :=
continuous_im.measurable
#align is_R_or_C.measurable_im RCLike.measurable_im
end RCLike
section
variable {α 𝕜 : Type*} [RCLike 𝕜] [MeasurableSpace α] {f : α → 𝕜} {μ : MeasureTheory.Measure α}
@[measurability]
theorem RCLike.measurable_ofReal : Measurable ((↑) : ℝ → 𝕜) :=
RCLike.continuous_ofReal.measurable
#align is_R_or_C.measurable_of_real RCLike.measurable_ofReal
theorem measurable_of_re_im (hre : Measurable fun x => RCLike.re (f x))
(him : Measurable fun x => RCLike.im (f x)) : Measurable f := by
convert Measurable.add (M := 𝕜) (RCLike.measurable_ofReal.comp hre)
((RCLike.measurable_ofReal.comp him).mul_const RCLike.I)
exact (RCLike.re_add_im _).symm
#align measurable_of_re_im measurable_of_re_im
| Mathlib/MeasureTheory/Function/SpecialFunctions/RCLike.lean | 80 | 84 | theorem aemeasurable_of_re_im (hre : AEMeasurable (fun x => RCLike.re (f x)) μ)
(him : AEMeasurable (fun x => RCLike.im (f x)) μ) : AEMeasurable f μ := by
convert AEMeasurable.add (M := 𝕜) (RCLike.measurable_ofReal.comp_aemeasurable hre) |
convert AEMeasurable.add (M := 𝕜) (RCLike.measurable_ofReal.comp_aemeasurable hre)
((RCLike.measurable_ofReal.comp_aemeasurable him).mul_const RCLike.I)
exact (RCLike.re_add_im _).symm
| true |
import Mathlib.RingTheory.GradedAlgebra.Basic
import Mathlib.Algebra.GradedMulAction
import Mathlib.Algebra.DirectSum.Decomposition
import Mathlib.Algebra.Module.BigOperators
#align_import algebra.module.graded_module from "leanprover-community/mathlib"@"59cdeb0da2480abbc235b7e611ccd9a7e5603d7c"
section
open DirectSum
variable {ιA ιB : Type*} (A : ιA → Type*) (M : ιB → Type*)
namespace DirectSum
open GradedMonoid
class GdistribMulAction [AddMonoid ιA] [VAdd ιA ιB] [GMonoid A] [∀ i, AddMonoid (M i)]
extends GMulAction A M where
smul_add {i j} (a : A i) (b c : M j) : smul a (b + c) = smul a b + smul a c
smul_zero {i j} (a : A i) : smul a (0 : M j) = 0
#align direct_sum.gdistrib_mul_action DirectSum.GdistribMulAction
class Gmodule [AddMonoid ιA] [VAdd ιA ιB] [∀ i, AddMonoid (A i)] [∀ i, AddMonoid (M i)] [GMonoid A]
extends GdistribMulAction A M where
add_smul {i j} (a a' : A i) (b : M j) : smul (a + a') b = smul a b + smul a' b
zero_smul {i j} (b : M j) : smul (0 : A i) b = 0
#align direct_sum.gmodule DirectSum.Gmodule
instance GSemiring.toGmodule [AddMonoid ιA] [∀ i : ιA, AddCommMonoid (A i)]
[h : GSemiring A] : Gmodule A A :=
{ GMonoid.toGMulAction A with
smul_add := fun _ _ _ => h.mul_add _ _ _
smul_zero := fun _ => h.mul_zero _
add_smul := fun _ _ => h.add_mul _ _
zero_smul := fun _ => h.zero_mul _ }
#align direct_sum.gsemiring.to_gmodule DirectSum.GSemiring.toGmodule
variable [AddMonoid ιA] [VAdd ιA ιB] [∀ i : ιA, AddCommMonoid (A i)] [∀ i, AddCommMonoid (M i)]
@[simps]
def gsmulHom [GMonoid A] [Gmodule A M] {i j} : A i →+ M j →+ M (i +ᵥ j) where
toFun a :=
{ toFun := fun b => GSMul.smul a b
map_zero' := GdistribMulAction.smul_zero _
map_add' := GdistribMulAction.smul_add _ }
map_zero' := AddMonoidHom.ext fun a => Gmodule.zero_smul a
map_add' _a₁ _a₂ := AddMonoidHom.ext fun _b => Gmodule.add_smul _ _ _
#align direct_sum.gsmul_hom DirectSum.gsmulHom
namespace Gmodule
def smulAddMonoidHom [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M] :
(⨁ i, A i) →+ (⨁ i, M i) →+ ⨁ i, M i :=
toAddMonoid fun _i =>
AddMonoidHom.flip <|
toAddMonoid fun _j => AddMonoidHom.flip <| (of M _).compHom.comp <| gsmulHom A M
#align direct_sum.gmodule.smul_add_monoid_hom DirectSum.Gmodule.smulAddMonoidHom
section
open GradedMonoid DirectSum Gmodule
instance [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M] :
SMul (⨁ i, A i) (⨁ i, M i) where
smul x y := smulAddMonoidHom A M x y
@[simp]
theorem smul_def [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M]
(x : ⨁ i, A i) (y : ⨁ i, M i) :
x • y = smulAddMonoidHom _ _ x y := rfl
#align direct_sum.gmodule.smul_def DirectSum.Gmodule.smul_def
@[simp]
| Mathlib/Algebra/Module/GradedModule.lean | 99 | 102 | theorem smulAddMonoidHom_apply_of_of [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M]
{i j} (x : A i) (y : M j) :
smulAddMonoidHom A M (DirectSum.of A i x) (of M j y) = of M (i +ᵥ j) (GSMul.smul x y) := by |
simp [smulAddMonoidHom]
| true |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section GeneralizedCoheytingAlgebra
variable [GeneralizedCoheytingAlgebra α] (a b c d : α)
@[simp]
theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b :=
rfl
#align to_dual_symm_diff toDual_symmDiff
@[simp]
theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b :=
rfl
#align of_dual_bihimp ofDual_bihimp
theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm]
#align symm_diff_comm symmDiff_comm
instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) :=
⟨symmDiff_comm⟩
#align symm_diff_is_comm symmDiff_isCommutative
@[simp]
theorem symmDiff_self : a ∆ a = ⊥ := by rw [symmDiff, sup_idem, sdiff_self]
#align symm_diff_self symmDiff_self
@[simp]
| Mathlib/Order/SymmDiff.lean | 125 | 125 | theorem symmDiff_bot : a ∆ ⊥ = a := by | rw [symmDiff, sdiff_bot, bot_sdiff, sup_bot_eq]
| true |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section GeneralizedCoheytingAlgebra
variable [GeneralizedCoheytingAlgebra α] (a b c d : α)
@[simp]
theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b :=
rfl
#align to_dual_symm_diff toDual_symmDiff
@[simp]
theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b :=
rfl
#align of_dual_bihimp ofDual_bihimp
| Mathlib/Order/SymmDiff.lean | 113 | 113 | theorem symmDiff_comm : a ∆ b = b ∆ a := by | simp only [symmDiff, sup_comm]
| true |
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Nat.Factors
import Mathlib.Order.Interval.Finset.Nat
#align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped Classical
open Finset
namespace Nat
variable (n : ℕ)
def divisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 (n + 1))
#align nat.divisors Nat.divisors
def properDivisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 n)
#align nat.proper_divisors Nat.properDivisors
def divisorsAntidiagonal : Finset (ℕ × ℕ) :=
Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ×ˢ Ico 1 (n + 1))
#align nat.divisors_antidiagonal Nat.divisorsAntidiagonal
variable {n}
@[simp]
theorem filter_dvd_eq_divisors (h : n ≠ 0) : (Finset.range n.succ).filter (· ∣ n) = n.divisors := by
ext
simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors
@[simp]
theorem filter_dvd_eq_properDivisors (h : n ≠ 0) :
(Finset.range n).filter (· ∣ n) = n.properDivisors := by
ext
simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors
theorem properDivisors.not_self_mem : ¬n ∈ properDivisors n := by simp [properDivisors]
#align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem
@[simp]
theorem mem_properDivisors {m : ℕ} : n ∈ properDivisors m ↔ n ∣ m ∧ n < m := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [properDivisors]
simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range]
#align nat.mem_proper_divisors Nat.mem_properDivisors
theorem insert_self_properDivisors (h : n ≠ 0) : insert n (properDivisors n) = divisors n := by
rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h),
Finset.filter_insert, if_pos (dvd_refl n)]
#align nat.insert_self_proper_divisors Nat.insert_self_properDivisors
theorem cons_self_properDivisors (h : n ≠ 0) :
cons n (properDivisors n) properDivisors.not_self_mem = divisors n := by
rw [cons_eq_insert, insert_self_properDivisors h]
#align nat.cons_self_proper_divisors Nat.cons_self_properDivisors
@[simp]
| Mathlib/NumberTheory/Divisors.lean | 95 | 99 | theorem mem_divisors {m : ℕ} : n ∈ divisors m ↔ n ∣ m ∧ m ≠ 0 := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [divisors] |
rcases eq_or_ne m 0 with (rfl | hm); · simp [divisors]
simp only [hm, Ne, not_false_iff, and_true_iff, ← filter_dvd_eq_divisors hm, mem_filter,
mem_range, and_iff_right_iff_imp, Nat.lt_succ_iff]
exact le_of_dvd hm.bot_lt
| true |
import Mathlib.CategoryTheory.Action
import Mathlib.Combinatorics.Quiver.Arborescence
import Mathlib.Combinatorics.Quiver.ConnectedComponent
import Mathlib.GroupTheory.FreeGroup.IsFreeGroup
#align_import group_theory.nielsen_schreier from "leanprover-community/mathlib"@"1bda4fc53de6ade5ab9da36f2192e24e2084a2ce"
noncomputable section
open scoped Classical
universe v u
open CategoryTheory CategoryTheory.ActionCategory CategoryTheory.SingleObj Quiver FreeGroup
-- Porting note(#5171): @[nolint has_nonempty_instance]
@[nolint unusedArguments]
def IsFreeGroupoid.Generators (G) [Groupoid G] :=
G
#align is_free_groupoid.generators IsFreeGroupoid.Generators
class IsFreeGroupoid (G) [Groupoid.{v} G] where
quiverGenerators : Quiver.{v + 1} (IsFreeGroupoid.Generators G)
of : ∀ {a b : IsFreeGroupoid.Generators G}, (a ⟶ b) → ((show G from a) ⟶ b)
unique_lift :
∀ {X : Type v} [Group X] (f : Labelling (IsFreeGroupoid.Generators G) X),
∃! F : G ⥤ CategoryTheory.SingleObj X, ∀ (a b) (g : a ⟶ b), F.map (of g) = f g
#align is_free_groupoid IsFreeGroupoid
attribute [nolint docBlame] IsFreeGroupoid.of IsFreeGroupoid.unique_lift
namespace IsFreeGroupoid
attribute [instance] quiverGenerators
@[ext]
theorem ext_functor {G} [Groupoid.{v} G] [IsFreeGroupoid G] {X : Type v} [Group X]
(f g : G ⥤ CategoryTheory.SingleObj X) (h : ∀ (a b) (e : a ⟶ b), f.map (of e) = g.map (of e)) :
f = g :=
let ⟨_, _, u⟩ := @unique_lift G _ _ X _ fun (a b : Generators G) (e : a ⟶ b) => g.map (of e)
_root_.trans (u _ h) (u _ fun _ _ _ => rfl).symm
#align is_free_groupoid.ext_functor IsFreeGroupoid.ext_functor
instance actionGroupoidIsFree {G A : Type u} [Group G] [IsFreeGroup G] [MulAction G A] :
IsFreeGroupoid (ActionCategory G A) where
quiverGenerators :=
⟨fun a b => { e : IsFreeGroup.Generators G // IsFreeGroup.of e • a.back = b.back }⟩
of := fun (e : { e // _}) => ⟨IsFreeGroup.of e, e.property⟩
unique_lift := by
intro X _ f
let f' : IsFreeGroup.Generators G → (A → X) ⋊[mulAutArrow] G := fun e =>
⟨fun b => @f ⟨(), _⟩ ⟨(), b⟩ ⟨e, smul_inv_smul _ b⟩, IsFreeGroup.of e⟩
rcases IsFreeGroup.unique_lift f' with ⟨F', hF', uF'⟩
refine ⟨uncurry F' ?_, ?_, ?_⟩
· suffices SemidirectProduct.rightHom.comp F' = MonoidHom.id _ by
-- Porting note: `MonoidHom.ext_iff` has been deprecated.
exact DFunLike.ext_iff.mp this
apply IsFreeGroup.ext_hom (fun x ↦ ?_)
rw [MonoidHom.comp_apply, hF']
rfl
· rintro ⟨⟨⟩, a : A⟩ ⟨⟨⟩, b⟩ ⟨e, h : IsFreeGroup.of e • a = b⟩
change (F' (IsFreeGroup.of _)).left _ = _
rw [hF']
cases inv_smul_eq_iff.mpr h.symm
rfl
· intro E hE
have : curry E = F' := by
apply uF'
intro e
ext
· convert hE _ _ _
rfl
· rfl
apply Functor.hext
· intro
apply Unit.ext
· refine ActionCategory.cases ?_
intros
simp only [← this, uncurry_map, curry_apply_left, coe_back, homOfPair.val]
rfl
#align is_free_groupoid.action_groupoid_is_free IsFreeGroupoid.actionGroupoidIsFree
private def symgen {G : Type u} [Groupoid.{v} G] [IsFreeGroupoid G] :
G → Symmetrify (Generators G) :=
id
-- #align is_free_groupoid.symgen IsFreeGroupoid.symgen
| Mathlib/GroupTheory/FreeGroup/NielsenSchreier.lean | 275 | 288 | theorem path_nonempty_of_hom {G} [Groupoid.{u, u} G] [IsFreeGroupoid G] {a b : G} :
Nonempty (a ⟶ b) → Nonempty (Path (symgen a) (symgen b)) := by
rintro ⟨p⟩ |
rintro ⟨p⟩
rw [← @WeaklyConnectedComponent.eq (Generators G), eq_comm, ← FreeGroup.of_injective.eq_iff, ←
mul_inv_eq_one]
let X := FreeGroup (WeaklyConnectedComponent <| Generators G)
let f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
let F : G ⥤ CategoryTheory.SingleObj.{u} (X : Type u) := SingleObj.differenceFunctor f
change (F.map p) = ((@CategoryTheory.Functor.const G _ _ (SingleObj.category X)).obj ()).map p
congr; ext
rw [Functor.const_obj_map, id_as_one, differenceFunctor_map, @mul_inv_eq_one _ _ (f _)]
apply congr_arg FreeGroup.of
apply (WeaklyConnectedComponent.eq _ _).mpr
exact ⟨Hom.toPath (Sum.inr (by assumption))⟩
| true |
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.Tactic.ByContra
import Mathlib.Topology.Algebra.Polynomial
import Mathlib.NumberTheory.Padics.PadicVal
import Mathlib.Analysis.Complex.Arg
#align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32"
namespace Polynomial
open Finset Nat
@[simp]
| Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean | 29 | 32 | theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
eval 1 (cyclotomic p R) = p := by
simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum, |
simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum,
Finset.card_range, smul_one_eq_cast]
| true |
import Mathlib.Analysis.Normed.Group.Basic
#align_import information_theory.hamming from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
section HammingDistNorm
open Finset Function
variable {α ι : Type*} {β : ι → Type*} [Fintype ι] [∀ i, DecidableEq (β i)]
variable {γ : ι → Type*} [∀ i, DecidableEq (γ i)]
def hammingDist (x y : ∀ i, β i) : ℕ :=
(univ.filter fun i => x i ≠ y i).card
#align hamming_dist hammingDist
@[simp]
theorem hammingDist_self (x : ∀ i, β i) : hammingDist x x = 0 := by
rw [hammingDist, card_eq_zero, filter_eq_empty_iff]
exact fun _ _ H => H rfl
#align hamming_dist_self hammingDist_self
theorem hammingDist_nonneg {x y : ∀ i, β i} : 0 ≤ hammingDist x y :=
zero_le _
#align hamming_dist_nonneg hammingDist_nonneg
theorem hammingDist_comm (x y : ∀ i, β i) : hammingDist x y = hammingDist y x := by
simp_rw [hammingDist, ne_comm]
#align hamming_dist_comm hammingDist_comm
theorem hammingDist_triangle (x y z : ∀ i, β i) :
hammingDist x z ≤ hammingDist x y + hammingDist y z := by
classical
unfold hammingDist
refine le_trans (card_mono ?_) (card_union_le _ _)
rw [← filter_or]
exact monotone_filter_right _ fun i h ↦ (h.ne_or_ne _).imp_right Ne.symm
#align hamming_dist_triangle hammingDist_triangle
theorem hammingDist_triangle_left (x y z : ∀ i, β i) :
hammingDist x y ≤ hammingDist z x + hammingDist z y := by
rw [hammingDist_comm z]
exact hammingDist_triangle _ _ _
#align hamming_dist_triangle_left hammingDist_triangle_left
| Mathlib/InformationTheory/Hamming.lean | 78 | 81 | theorem hammingDist_triangle_right (x y z : ∀ i, β i) :
hammingDist x y ≤ hammingDist x z + hammingDist y z := by
rw [hammingDist_comm y] |
rw [hammingDist_comm y]
exact hammingDist_triangle _ _ _
| true |
import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals
import Mathlib.Analysis.Calculus.ParametricIntegral
import Mathlib.MeasureTheory.Measure.Haar.NormedSpace
#align_import analysis.mellin_transform from "leanprover-community/mathlib"@"917c3c072e487b3cccdbfeff17e75b40e45f66cb"
open MeasureTheory Set Filter Asymptotics TopologicalSpace
open Real
open Complex hiding exp log abs_of_nonneg
open scoped Topology
noncomputable section
section Defs
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E]
def MellinConvergent (f : ℝ → E) (s : ℂ) : Prop :=
IntegrableOn (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) (Ioi 0)
#align mellin_convergent MellinConvergent
| Mathlib/Analysis/MellinTransform.lean | 47 | 50 | theorem MellinConvergent.const_smul {f : ℝ → E} {s : ℂ} (hf : MellinConvergent f s) {𝕜 : Type*}
[NontriviallyNormedField 𝕜] [NormedSpace 𝕜 E] [SMulCommClass ℂ 𝕜 E] (c : 𝕜) :
MellinConvergent (fun t => c • f t) s := by |
simpa only [MellinConvergent, smul_comm] using hf.smul c
| true |
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic
#align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap
open scoped NNReal ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α}
theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) :
μ[f|m] =ᵐ[μ.restrict s] 0 := by
by_cases hm : m ≤ m0
swap; · simp_rw [condexp_of_not_le hm]; rfl
by_cases hμm : SigmaFinite (μ.trim hm)
swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl
haveI : SigmaFinite (μ.trim hm) := hμm
have : SigmaFinite ((μ.restrict s).trim hm) := by
rw [← restrict_trim hm _ hs]
exact Restrict.sigmaFinite _ s
by_cases hf_int : Integrable f μ
swap; · rw [condexp_undef hf_int]
refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_
· exact fun t _ _ => integrable_condexp.integrableOn.integrableOn
· exact fun t _ _ => (integrable_zero _ _ _).integrableOn
· intro t ht _
rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ←
Measure.restrict_restrict (hm _ ht)]
refine setIntegral_congr_ae (hm _ ht) ?_
filter_upwards [hf] with x hx _ using hx
· exact stronglyMeasurable_condexp.aeStronglyMeasurable'
· exact stronglyMeasurable_zero.aeStronglyMeasurable'
#align measure_theory.condexp_ae_eq_restrict_zero MeasureTheory.condexp_ae_eq_restrict_zero
theorem condexp_indicator_aux (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict sᶜ] 0) :
μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
by_cases hm : m ≤ m0
swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl
have hsf_zero : ∀ g : α → E, g =ᵐ[μ.restrict sᶜ] 0 → s.indicator g =ᵐ[μ] g := fun g =>
indicator_ae_eq_of_restrict_compl_ae_eq_zero (hm _ hs)
refine ((hsf_zero (μ[f|m]) (condexp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm
exact condexp_congr_ae (hsf_zero f hf).symm
#align measure_theory.condexp_indicator_aux MeasureTheory.condexp_indicator_aux
| Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean | 75 | 112 | theorem condexp_indicator (hf_int : Integrable f μ) (hs : MeasurableSet[m] s) :
μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
by_cases hm : m ≤ m0 |
by_cases hm : m ≤ m0
swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl
by_cases hμm : SigmaFinite (μ.trim hm)
swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm, Set.indicator_zero']; rfl
haveI : SigmaFinite (μ.trim hm) := hμm
-- use `have` to perform what should be the first calc step because of an error I don't
-- understand
have : s.indicator (μ[f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) := by
rw [Set.indicator_self_add_compl s f]
refine (this.trans ?_).symm
calc
s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) =ᵐ[μ]
s.indicator (μ[s.indicator f|m] + μ[sᶜ.indicator f|m]) := by
have : μ[s.indicator f + sᶜ.indicator f|m] =ᵐ[μ] μ[s.indicator f|m] + μ[sᶜ.indicator f|m] :=
condexp_add (hf_int.indicator (hm _ hs)) (hf_int.indicator (hm _ hs.compl))
filter_upwards [this] with x hx
classical rw [Set.indicator_apply, Set.indicator_apply, hx]
_ = s.indicator (μ[s.indicator f|m]) + s.indicator (μ[sᶜ.indicator f|m]) :=
(s.indicator_add' _ _)
_ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) +
s.indicator (sᶜ.indicator (μ[sᶜ.indicator f|m])) := by
refine Filter.EventuallyEq.rfl.add ?_
have : sᶜ.indicator (μ[sᶜ.indicator f|m]) =ᵐ[μ] μ[sᶜ.indicator f|m] := by
refine (condexp_indicator_aux hs.compl ?_).symm.trans ?_
· exact indicator_ae_eq_restrict_compl (hm _ hs.compl)
· rw [Set.indicator_indicator, Set.inter_self]
filter_upwards [this] with x hx
by_cases hxs : x ∈ s
· simp only [hx, hxs, Set.indicator_of_mem]
· simp only [hxs, Set.indicator_of_not_mem, not_false_iff]
_ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) := by
rw [Set.indicator_indicator, Set.inter_compl_self, Set.indicator_empty', add_zero]
_ =ᵐ[μ] μ[s.indicator f|m] := by
refine (condexp_indicator_aux hs ?_).symm.trans ?_
· exact indicator_ae_eq_restrict_compl (hm _ hs)
· rw [Set.indicator_indicator, Set.inter_self]
| true |
import Mathlib.Algebra.Module.Card
import Mathlib.SetTheory.Cardinal.CountableCover
import Mathlib.SetTheory.Cardinal.Continuum
import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Topology.MetricSpace.Perfect
universe u v
open Filter Pointwise Set Function Cardinal
open scoped Cardinal Topology
theorem continuum_le_cardinal_of_nontriviallyNormedField
(𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by
suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by
rcases this with ⟨f, -, -, f_inj⟩
simpa using lift_mk_le_lift_mk_of_injective f_inj
apply Perfect.exists_nat_bool_injection _ univ_nonempty
refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩
rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩
have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) :=
tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc)
rw [add_zero] at A
have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU
rcases B.exists with ⟨n, hn⟩
refine ⟨x + c^n, by simpa using hn, ?_⟩
simp only [ne_eq, add_right_eq_self]
apply pow_ne_zero
simpa using c_pos
theorem continuum_le_cardinal_of_module
(𝕜 : Type u) (E : Type v) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
[AddCommGroup E] [Module 𝕜 E] [Nontrivial E] : 𝔠 ≤ #E := by
have A : lift.{v} (𝔠 : Cardinal.{u}) ≤ lift.{v} (#𝕜) := by
simpa using continuum_le_cardinal_of_nontriviallyNormedField 𝕜
simpa using A.trans (Cardinal.mk_le_of_module 𝕜 E)
lemma cardinal_eq_of_mem_nhds_zero
{E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : s ∈ 𝓝 (0 : E)) : #s = #E := by
obtain ⟨c, hc⟩ : ∃ x : 𝕜 , 1 < ‖x‖ := NormedField.exists_lt_norm 𝕜 1
have cn_ne : ∀ n, c^n ≠ 0 := by
intro n
apply pow_ne_zero
rintro rfl
simp only [norm_zero] at hc
exact lt_irrefl _ (hc.trans zero_lt_one)
have A : ∀ (x : E), ∀ᶠ n in (atTop : Filter ℕ), x ∈ c^n • s := by
intro x
have : Tendsto (fun n ↦ (c^n) ⁻¹ • x) atTop (𝓝 ((0 : 𝕜) • x)) := by
have : Tendsto (fun n ↦ (c^n)⁻¹) atTop (𝓝 0) := by
simp_rw [← inv_pow]
apply tendsto_pow_atTop_nhds_zero_of_norm_lt_one
rw [norm_inv]
exact inv_lt_one hc
exact Tendsto.smul_const this x
rw [zero_smul] at this
filter_upwards [this hs] with n (hn : (c ^ n)⁻¹ • x ∈ s)
exact (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).2 hn
have B : ∀ n, #(c^n • s :) = #s := by
intro n
have : (c^n • s :) ≃ s :=
{ toFun := fun x ↦ ⟨(c^n)⁻¹ • x.1, (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).1 x.2⟩
invFun := fun x ↦ ⟨(c^n) • x.1, smul_mem_smul_set x.2⟩
left_inv := fun x ↦ by simp [smul_smul, mul_inv_cancel (cn_ne n)]
right_inv := fun x ↦ by simp [smul_smul, inv_mul_cancel (cn_ne n)] }
exact Cardinal.mk_congr this
apply (Cardinal.mk_of_countable_eventually_mem A B).symm
theorem cardinal_eq_of_mem_nhds
{E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E]
{s : Set E} {x : E} (hs : s ∈ 𝓝 x) : #s = #E := by
let g := Homeomorph.addLeft x
let t := g ⁻¹' s
have : t ∈ 𝓝 0 := g.continuous.continuousAt.preimage_mem_nhds (by simpa [g] using hs)
have A : #t = #E := cardinal_eq_of_mem_nhds_zero 𝕜 this
have B : #t = #s := Cardinal.mk_subtype_of_equiv s g.toEquiv
rwa [B] at A
| Mathlib/Topology/Algebra/Module/Cardinality.lean | 110 | 115 | theorem cardinal_eq_of_isOpen
{E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E}
(hs : IsOpen s) (h's : s.Nonempty) : #s = #E := by
rcases h's with ⟨x, hx⟩ |
rcases h's with ⟨x, hx⟩
exact cardinal_eq_of_mem_nhds 𝕜 (hs.mem_nhds hx)
| true |
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.add_torsor from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
class AddTorsor (G : outParam Type*) (P : Type*) [AddGroup G] extends AddAction G P,
VSub G P where
[nonempty : Nonempty P]
vsub_vadd' : ∀ p₁ p₂ : P, (p₁ -ᵥ p₂ : G) +ᵥ p₂ = p₁
vadd_vsub' : ∀ (g : G) (p : P), g +ᵥ p -ᵥ p = g
#align add_torsor AddTorsor
-- Porting note(#12096): removed `nolint instance_priority`; lint not ported yet
attribute [instance 100] AddTorsor.nonempty
-- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet
--attribute [nolint dangerous_instance] AddTorsor.toVSub
-- Porting note(#12096): linter not ported yet
--@[nolint instance_priority]
instance addGroupIsAddTorsor (G : Type*) [AddGroup G] : AddTorsor G G where
vsub := Sub.sub
vsub_vadd' := sub_add_cancel
vadd_vsub' := add_sub_cancel_right
#align add_group_is_add_torsor addGroupIsAddTorsor
@[simp]
theorem vsub_eq_sub {G : Type*} [AddGroup G] (g₁ g₂ : G) : g₁ -ᵥ g₂ = g₁ - g₂ :=
rfl
#align vsub_eq_sub vsub_eq_sub
section General
variable {G : Type*} {P : Type*} [AddGroup G] [T : AddTorsor G P]
@[simp]
theorem vsub_vadd (p₁ p₂ : P) : p₁ -ᵥ p₂ +ᵥ p₂ = p₁ :=
AddTorsor.vsub_vadd' p₁ p₂
#align vsub_vadd vsub_vadd
@[simp]
theorem vadd_vsub (g : G) (p : P) : g +ᵥ p -ᵥ p = g :=
AddTorsor.vadd_vsub' g p
#align vadd_vsub vadd_vsub
theorem vadd_right_cancel {g₁ g₂ : G} (p : P) (h : g₁ +ᵥ p = g₂ +ᵥ p) : g₁ = g₂ := by
-- Porting note: vadd_vsub g₁ → vadd_vsub g₁ p
rw [← vadd_vsub g₁ p, h, vadd_vsub]
#align vadd_right_cancel vadd_right_cancel
@[simp]
theorem vadd_right_cancel_iff {g₁ g₂ : G} (p : P) : g₁ +ᵥ p = g₂ +ᵥ p ↔ g₁ = g₂ :=
⟨vadd_right_cancel p, fun h => h ▸ rfl⟩
#align vadd_right_cancel_iff vadd_right_cancel_iff
theorem vadd_right_injective (p : P) : Function.Injective ((· +ᵥ p) : G → P) := fun _ _ =>
vadd_right_cancel p
#align vadd_right_injective vadd_right_injective
theorem vadd_vsub_assoc (g : G) (p₁ p₂ : P) : g +ᵥ p₁ -ᵥ p₂ = g + (p₁ -ᵥ p₂) := by
apply vadd_right_cancel p₂
rw [vsub_vadd, add_vadd, vsub_vadd]
#align vadd_vsub_assoc vadd_vsub_assoc
@[simp]
theorem vsub_self (p : P) : p -ᵥ p = (0 : G) := by
rw [← zero_add (p -ᵥ p), ← vadd_vsub_assoc, vadd_vsub]
#align vsub_self vsub_self
theorem eq_of_vsub_eq_zero {p₁ p₂ : P} (h : p₁ -ᵥ p₂ = (0 : G)) : p₁ = p₂ := by
rw [← vsub_vadd p₁ p₂, h, zero_vadd]
#align eq_of_vsub_eq_zero eq_of_vsub_eq_zero
@[simp]
theorem vsub_eq_zero_iff_eq {p₁ p₂ : P} : p₁ -ᵥ p₂ = (0 : G) ↔ p₁ = p₂ :=
Iff.intro eq_of_vsub_eq_zero fun h => h ▸ vsub_self _
#align vsub_eq_zero_iff_eq vsub_eq_zero_iff_eq
theorem vsub_ne_zero {p q : P} : p -ᵥ q ≠ (0 : G) ↔ p ≠ q :=
not_congr vsub_eq_zero_iff_eq
#align vsub_ne_zero vsub_ne_zero
@[simp]
theorem vsub_add_vsub_cancel (p₁ p₂ p₃ : P) : p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) = p₁ -ᵥ p₃ := by
apply vadd_right_cancel p₃
rw [add_vadd, vsub_vadd, vsub_vadd, vsub_vadd]
#align vsub_add_vsub_cancel vsub_add_vsub_cancel
@[simp]
theorem neg_vsub_eq_vsub_rev (p₁ p₂ : P) : -(p₁ -ᵥ p₂) = p₂ -ᵥ p₁ := by
refine neg_eq_of_add_eq_zero_right (vadd_right_cancel p₁ ?_)
rw [vsub_add_vsub_cancel, vsub_self]
#align neg_vsub_eq_vsub_rev neg_vsub_eq_vsub_rev
theorem vadd_vsub_eq_sub_vsub (g : G) (p q : P) : g +ᵥ p -ᵥ q = g - (q -ᵥ p) := by
rw [vadd_vsub_assoc, sub_eq_add_neg, neg_vsub_eq_vsub_rev]
#align vadd_vsub_eq_sub_vsub vadd_vsub_eq_sub_vsub
| Mathlib/Algebra/AddTorsor.lean | 165 | 167 | theorem vsub_vadd_eq_vsub_sub (p₁ p₂ : P) (g : G) : p₁ -ᵥ (g +ᵥ p₂) = p₁ -ᵥ p₂ - g := by
rw [← add_right_inj (p₂ -ᵥ p₁ : G), vsub_add_vsub_cancel, ← neg_vsub_eq_vsub_rev, vadd_vsub, ← |
rw [← add_right_inj (p₂ -ᵥ p₁ : G), vsub_add_vsub_cancel, ← neg_vsub_eq_vsub_rev, vadd_vsub, ←
add_sub_assoc, ← neg_vsub_eq_vsub_rev, neg_add_self, zero_sub]
| true |
import Mathlib.Topology.Algebra.GroupWithZero
import Mathlib.Topology.Order.OrderClosed
#align_import topology.algebra.with_zero_topology from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064"
open Topology Filter TopologicalSpace Filter Set Function
namespace WithZeroTopology
variable {α Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] {γ γ₁ γ₂ : Γ₀} {l : Filter α}
{f : α → Γ₀}
scoped instance (priority := 100) topologicalSpace : TopologicalSpace Γ₀ :=
nhdsAdjoint 0 <| ⨅ γ ≠ 0, 𝓟 (Iio γ)
#align with_zero_topology.topological_space WithZeroTopology.topologicalSpace
theorem nhds_eq_update : (𝓝 : Γ₀ → Filter Γ₀) = update pure 0 (⨅ γ ≠ 0, 𝓟 (Iio γ)) := by
rw [nhds_nhdsAdjoint, sup_of_le_right]
exact le_iInf₂ fun γ hγ ↦ le_principal_iff.2 <| zero_lt_iff.2 hγ
#align with_zero_topology.nhds_eq_update WithZeroTopology.nhds_eq_update
theorem nhds_zero : 𝓝 (0 : Γ₀) = ⨅ γ ≠ 0, 𝓟 (Iio γ) := by
rw [nhds_eq_update, update_same]
#align with_zero_topology.nhds_zero WithZeroTopology.nhds_zero
theorem hasBasis_nhds_zero : (𝓝 (0 : Γ₀)).HasBasis (fun γ : Γ₀ => γ ≠ 0) Iio := by
rw [nhds_zero]
refine hasBasis_biInf_principal ?_ ⟨1, one_ne_zero⟩
exact directedOn_iff_directed.2 (Monotone.directed_ge fun a b hab => Iio_subset_Iio hab)
#align with_zero_topology.has_basis_nhds_zero WithZeroTopology.hasBasis_nhds_zero
theorem Iio_mem_nhds_zero (hγ : γ ≠ 0) : Iio γ ∈ 𝓝 (0 : Γ₀) :=
hasBasis_nhds_zero.mem_of_mem hγ
#align with_zero_topology.Iio_mem_nhds_zero WithZeroTopology.Iio_mem_nhds_zero
theorem nhds_zero_of_units (γ : Γ₀ˣ) : Iio ↑γ ∈ 𝓝 (0 : Γ₀) :=
Iio_mem_nhds_zero γ.ne_zero
#align with_zero_topology.nhds_zero_of_units WithZeroTopology.nhds_zero_of_units
theorem tendsto_zero : Tendsto f l (𝓝 (0 : Γ₀)) ↔ ∀ (γ₀) (_ : γ₀ ≠ 0), ∀ᶠ x in l, f x < γ₀ := by
simp [nhds_zero]
#align with_zero_topology.tendsto_zero WithZeroTopology.tendsto_zero
@[simp]
theorem nhds_of_ne_zero {γ : Γ₀} (h₀ : γ ≠ 0) : 𝓝 γ = pure γ :=
nhds_nhdsAdjoint_of_ne _ h₀
#align with_zero_topology.nhds_of_ne_zero WithZeroTopology.nhds_of_ne_zero
theorem nhds_coe_units (γ : Γ₀ˣ) : 𝓝 (γ : Γ₀) = pure (γ : Γ₀) :=
nhds_of_ne_zero γ.ne_zero
#align with_zero_topology.nhds_coe_units WithZeroTopology.nhds_coe_units
| Mathlib/Topology/Algebra/WithZeroTopology.lean | 101 | 101 | theorem singleton_mem_nhds_of_units (γ : Γ₀ˣ) : ({↑γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by | simp
| true |
import Mathlib.LinearAlgebra.CliffordAlgebra.Fold
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic
#align_import linear_algebra.exterior_algebra.of_alternating from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
variable {R M N N' : Type*}
variable [CommRing R] [AddCommGroup M] [AddCommGroup N] [AddCommGroup N']
variable [Module R M] [Module R N] [Module R N']
-- This instance can't be found where it's needed if we don't remind lean that it exists.
instance AlternatingMap.instModuleAddCommGroup {ι : Type*} :
Module R (M [⋀^ι]→ₗ[R] N) := by
infer_instance
#align alternating_map.module_add_comm_group AlternatingMap.instModuleAddCommGroup
namespace ExteriorAlgebra
open CliffordAlgebra hiding ι
def liftAlternating : (∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] N := by
suffices
(∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R]
ExteriorAlgebra R M →ₗ[R] ∀ i, M [⋀^Fin i]→ₗ[R] N by
refine LinearMap.compr₂ this ?_
refine (LinearEquiv.toLinearMap ?_).comp (LinearMap.proj 0)
exact AlternatingMap.constLinearEquivOfIsEmpty.symm
refine CliffordAlgebra.foldl _ ?_ ?_
· refine
LinearMap.mk₂ R (fun m f i => (f i.succ).curryLeft m) (fun m₁ m₂ f => ?_) (fun c m f => ?_)
(fun m f₁ f₂ => ?_) fun c m f => ?_
all_goals
ext i : 1
simp only [map_smul, map_add, Pi.add_apply, Pi.smul_apply, AlternatingMap.curryLeft_add,
AlternatingMap.curryLeft_smul, map_add, map_smul, LinearMap.add_apply, LinearMap.smul_apply]
· -- when applied twice with the same `m`, this recursive step produces 0
intro m x
dsimp only [LinearMap.mk₂_apply, QuadraticForm.coeFn_zero, Pi.zero_apply]
simp_rw [zero_smul]
ext i : 1
exact AlternatingMap.curryLeft_same _ _
#align exterior_algebra.lift_alternating ExteriorAlgebra.liftAlternating
@[simp]
theorem liftAlternating_ι (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M) :
liftAlternating (R := R) (M := M) (N := N) f (ι R m) = f 1 ![m] := by
dsimp [liftAlternating]
rw [foldl_ι, LinearMap.mk₂_apply, AlternatingMap.curryLeft_apply_apply]
congr
-- Porting note: In Lean 3, `congr` could use the `[Subsingleton (Fin 0 → M)]` instance to finish
-- the proof. Here, the instance can be synthesized but `congr` does not use it so the following
-- line is provided.
rw [Matrix.zero_empty]
#align exterior_algebra.lift_alternating_ι ExteriorAlgebra.liftAlternating_ι
theorem liftAlternating_ι_mul (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M)
(x : ExteriorAlgebra R M) :
liftAlternating (R := R) (M := M) (N := N) f (ι R m * x) =
liftAlternating (R := R) (M := M) (N := N) (fun i => (f i.succ).curryLeft m) x := by
dsimp [liftAlternating]
rw [foldl_mul, foldl_ι]
rfl
#align exterior_algebra.lift_alternating_ι_mul ExteriorAlgebra.liftAlternating_ι_mul
@[simp]
theorem liftAlternating_one (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) :
liftAlternating (R := R) (M := M) (N := N) f (1 : ExteriorAlgebra R M) = f 0 0 := by
dsimp [liftAlternating]
rw [foldl_one]
#align exterior_algebra.lift_alternating_one ExteriorAlgebra.liftAlternating_one
@[simp]
| Mathlib/LinearAlgebra/ExteriorAlgebra/OfAlternating.lean | 96 | 99 | theorem liftAlternating_algebraMap (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (r : R) :
liftAlternating (R := R) (M := M) (N := N) f (algebraMap _ (ExteriorAlgebra R M) r) =
r • f 0 0 := by |
rw [Algebra.algebraMap_eq_smul_one, map_smul, liftAlternating_one]
| true |
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.MeasureTheory.Integral.IntegrableOn
import Mathlib.MeasureTheory.Function.LocallyIntegrable
open Asymptotics MeasureTheory Set Filter
variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F]
{f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α}
theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l]
(hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter f l μ := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ :=
(hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets
refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩
refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_
exact (hfg x hx).trans (le_abs_self _)
theorem _root_.Asymptotics.IsBigO.integrable (hfm : AEStronglyMeasurable f μ)
(hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by
rewrite [← integrableAtFilter_top] at *
exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg
variable [TopologicalSpace α] [SecondCountableTopology α]
namespace MeasureTheory
theorem LocallyIntegrable.integrable_of_isBigO_cocompact [IsMeasurablyGenerated (cocompact α)]
(hf : LocallyIntegrable f μ) (ho : f =O[cocompact α] g)
(hg : IntegrableAtFilter g (cocompact α) μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_cocompact.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
section LinearOrder
variable [LinearOrder α] [CompactIccSpace α] {g' : α → F}
theorem LocallyIntegrable.integrable_of_isBigO_atBot_atTop
[IsMeasurablyGenerated (atBot (α := α))] [IsMeasurablyGenerated (atTop (α := α))]
(hf : LocallyIntegrable f μ)
(ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ)
(ho' : f =O[atTop] g') (hg' : IntegrableAtFilter g' atTop μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atBot_atTop.mpr
⟨⟨ho.integrableAtFilter ?_ hg, ho'.integrableAtFilter ?_ hg'⟩, hf⟩
all_goals exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
theorem LocallyIntegrableOn.integrableOn_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))]
(hf : LocallyIntegrableOn f (Iic a) μ) (ho : f =O[atBot] g)
(hg : IntegrableAtFilter g atBot μ) : IntegrableOn f (Iic a) μ := by
refine integrableOn_Iic_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact ⟨Iic a, Iic_mem_atBot a, hf.aestronglyMeasurable⟩
theorem LocallyIntegrableOn.integrableOn_of_isBigO_atTop [IsMeasurablyGenerated (atTop (α := α))]
(hf : LocallyIntegrableOn f (Ici a) μ) (ho : f =O[atTop] g)
(hg : IntegrableAtFilter g atTop μ) : IntegrableOn f (Ici a) μ := by
refine integrableOn_Ici_iff_integrableAtFilter_atTop.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact ⟨Ici a, Ici_mem_atTop a, hf.aestronglyMeasurable⟩
| Mathlib/MeasureTheory/Integral/Asymptotics.lean | 97 | 101 | theorem LocallyIntegrable.integrable_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))]
[OrderTop α] (hf : LocallyIntegrable f μ) (ho : f =O[atBot] g)
(hg : IntegrableAtFilter g atBot μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ |
refine integrable_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
| true |
import Mathlib.LinearAlgebra.CliffordAlgebra.Basic
import Mathlib.Data.ZMod.Basic
import Mathlib.RingTheory.GradedAlgebra.Basic
#align_import linear_algebra.clifford_algebra.grading from "leanprover-community/mathlib"@"34020e531ebc4e8aac6d449d9eecbcd1508ea8d0"
namespace CliffordAlgebra
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
variable {Q : QuadraticForm R M}
open scoped DirectSum
variable (Q)
def evenOdd (i : ZMod 2) : Submodule R (CliffordAlgebra Q) :=
⨆ j : { n : ℕ // ↑n = i }, LinearMap.range (ι Q) ^ (j : ℕ)
#align clifford_algebra.even_odd CliffordAlgebra.evenOdd
theorem one_le_evenOdd_zero : 1 ≤ evenOdd Q 0 := by
refine le_trans ?_ (le_iSup _ ⟨0, Nat.cast_zero⟩)
exact (pow_zero _).ge
#align clifford_algebra.one_le_even_odd_zero CliffordAlgebra.one_le_evenOdd_zero
theorem range_ι_le_evenOdd_one : LinearMap.range (ι Q) ≤ evenOdd Q 1 := by
refine le_trans ?_ (le_iSup _ ⟨1, Nat.cast_one⟩)
exact (pow_one _).ge
#align clifford_algebra.range_ι_le_even_odd_one CliffordAlgebra.range_ι_le_evenOdd_one
theorem ι_mem_evenOdd_one (m : M) : ι Q m ∈ evenOdd Q 1 :=
range_ι_le_evenOdd_one Q <| LinearMap.mem_range_self _ m
#align clifford_algebra.ι_mem_even_odd_one CliffordAlgebra.ι_mem_evenOdd_one
theorem ι_mul_ι_mem_evenOdd_zero (m₁ m₂ : M) : ι Q m₁ * ι Q m₂ ∈ evenOdd Q 0 :=
Submodule.mem_iSup_of_mem ⟨2, rfl⟩
(by
rw [Subtype.coe_mk, pow_two]
exact
Submodule.mul_mem_mul (LinearMap.mem_range_self (ι Q) m₁)
(LinearMap.mem_range_self (ι Q) m₂))
#align clifford_algebra.ι_mul_ι_mem_even_odd_zero CliffordAlgebra.ι_mul_ι_mem_evenOdd_zero
| Mathlib/LinearAlgebra/CliffordAlgebra/Grading.lean | 58 | 65 | theorem evenOdd_mul_le (i j : ZMod 2) : evenOdd Q i * evenOdd Q j ≤ evenOdd Q (i + j) := by
simp_rw [evenOdd, Submodule.iSup_eq_span, Submodule.span_mul_span] |
simp_rw [evenOdd, Submodule.iSup_eq_span, Submodule.span_mul_span]
apply Submodule.span_mono
simp_rw [Set.iUnion_mul, Set.mul_iUnion, Set.iUnion_subset_iff, Set.mul_subset_iff]
rintro ⟨xi, rfl⟩ ⟨yi, rfl⟩ x hx y hy
refine Set.mem_iUnion.mpr ⟨⟨xi + yi, Nat.cast_add _ _⟩, ?_⟩
simp only [Subtype.coe_mk, Nat.cast_add, pow_add]
exact Submodule.mul_mem_mul hx hy
| true |
import Mathlib.Analysis.NormedSpace.PiLp
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped NNReal Matrix
namespace Matrix
variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n]
section LinfLinf
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n α) :=
Pi.seminormedAddCommGroup
#align matrix.seminormed_add_comm_group Matrix.seminormedAddCommGroup
attribute [local instance] Matrix.seminormedAddCommGroup
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem norm_def (A : Matrix m n α) : ‖A‖ = ‖fun i j => A i j‖ := rfl
lemma norm_eq_sup_sup_nnnorm (A : Matrix m n α) :
‖A‖ = Finset.sup Finset.univ fun i ↦ Finset.sup Finset.univ fun j ↦ ‖A i j‖₊ := by
simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def]
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem nnnorm_def (A : Matrix m n α) : ‖A‖₊ = ‖fun i j => A i j‖₊ := rfl
theorem norm_le_iff {r : ℝ} (hr : 0 ≤ r) {A : Matrix m n α} : ‖A‖ ≤ r ↔ ∀ i j, ‖A i j‖ ≤ r := by
simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr]
#align matrix.norm_le_iff Matrix.norm_le_iff
theorem nnnorm_le_iff {r : ℝ≥0} {A : Matrix m n α} : ‖A‖₊ ≤ r ↔ ∀ i j, ‖A i j‖₊ ≤ r := by
simp_rw [nnnorm_def, pi_nnnorm_le_iff]
#align matrix.nnnorm_le_iff Matrix.nnnorm_le_iff
theorem norm_lt_iff {r : ℝ} (hr : 0 < r) {A : Matrix m n α} : ‖A‖ < r ↔ ∀ i j, ‖A i j‖ < r := by
simp_rw [norm_def, pi_norm_lt_iff hr]
#align matrix.norm_lt_iff Matrix.norm_lt_iff
theorem nnnorm_lt_iff {r : ℝ≥0} (hr : 0 < r) {A : Matrix m n α} :
‖A‖₊ < r ↔ ∀ i j, ‖A i j‖₊ < r := by
simp_rw [nnnorm_def, pi_nnnorm_lt_iff hr]
#align matrix.nnnorm_lt_iff Matrix.nnnorm_lt_iff
theorem norm_entry_le_entrywise_sup_norm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖ ≤ ‖A‖ :=
(norm_le_pi_norm (A i) j).trans (norm_le_pi_norm A i)
#align matrix.norm_entry_le_entrywise_sup_norm Matrix.norm_entry_le_entrywise_sup_norm
theorem nnnorm_entry_le_entrywise_sup_nnnorm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖₊ ≤ ‖A‖₊ :=
(nnnorm_le_pi_nnnorm (A i) j).trans (nnnorm_le_pi_nnnorm A i)
#align matrix.nnnorm_entry_le_entrywise_sup_nnnorm Matrix.nnnorm_entry_le_entrywise_sup_nnnorm
@[simp]
| Mathlib/Analysis/Matrix.lean | 116 | 118 | theorem nnnorm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖₊ = ‖a‖₊) :
‖A.map f‖₊ = ‖A‖₊ := by |
simp only [nnnorm_def, Pi.nnnorm_def, Matrix.map_apply, hf]
| true |
import Mathlib.RingTheory.Derivation.ToSquareZero
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.IsTensorProduct
import Mathlib.Algebra.Exact
import Mathlib.Algebra.MvPolynomial.PDeriv
import Mathlib.Algebra.Polynomial.Derivation
#align_import ring_theory.kaehler from "leanprover-community/mathlib"@"4b92a463033b5587bb011657e25e4710bfca7364"
suppress_compilation
section KaehlerDifferential
open scoped TensorProduct
open Algebra
universe u v
variable (R : Type u) (S : Type v) [CommRing R] [CommRing S] [Algebra R S]
abbrev KaehlerDifferential.ideal : Ideal (S ⊗[R] S) :=
RingHom.ker (TensorProduct.lmul' R : S ⊗[R] S →ₐ[R] S)
#align kaehler_differential.ideal KaehlerDifferential.ideal
variable {S}
theorem KaehlerDifferential.one_smul_sub_smul_one_mem_ideal (a : S) :
(1 : S) ⊗ₜ[R] a - a ⊗ₜ[R] (1 : S) ∈ KaehlerDifferential.ideal R S := by simp [RingHom.mem_ker]
#align kaehler_differential.one_smul_sub_smul_one_mem_ideal KaehlerDifferential.one_smul_sub_smul_one_mem_ideal
variable {R}
variable {M : Type*} [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower R S M]
def Derivation.tensorProductTo (D : Derivation R S M) : S ⊗[R] S →ₗ[S] M :=
TensorProduct.AlgebraTensorModule.lift ((LinearMap.lsmul S (S →ₗ[R] M)).flip D.toLinearMap)
#align derivation.tensor_product_to Derivation.tensorProductTo
theorem Derivation.tensorProductTo_tmul (D : Derivation R S M) (s t : S) :
D.tensorProductTo (s ⊗ₜ t) = s • D t := rfl
#align derivation.tensor_product_to_tmul Derivation.tensorProductTo_tmul
| Mathlib/RingTheory/Kaehler.lean | 78 | 99 | theorem Derivation.tensorProductTo_mul (D : Derivation R S M) (x y : S ⊗[R] S) :
D.tensorProductTo (x * y) =
TensorProduct.lmul' (S := S) R x • D.tensorProductTo y +
TensorProduct.lmul' (S := S) R y • D.tensorProductTo x := by
refine TensorProduct.induction_on x ?_ ?_ ?_ |
refine TensorProduct.induction_on x ?_ ?_ ?_
· rw [zero_mul, map_zero, map_zero, zero_smul, smul_zero, add_zero]
swap
· intro x₁ y₁ h₁ h₂
rw [add_mul, map_add, map_add, map_add, add_smul, smul_add, h₁, h₂, add_add_add_comm]
intro x₁ x₂
refine TensorProduct.induction_on y ?_ ?_ ?_
· rw [mul_zero, map_zero, map_zero, zero_smul, smul_zero, add_zero]
swap
· intro x₁ y₁ h₁ h₂
rw [mul_add, map_add, map_add, map_add, add_smul, smul_add, h₁, h₂, add_add_add_comm]
intro x y
simp only [TensorProduct.tmul_mul_tmul, Derivation.tensorProductTo,
TensorProduct.AlgebraTensorModule.lift_apply, TensorProduct.lift.tmul',
TensorProduct.lmul'_apply_tmul]
dsimp
rw [D.leibniz]
simp only [smul_smul, smul_add, mul_comm (x * y) x₁, mul_right_comm x₁ x₂, ← mul_assoc]
| true |
import Mathlib.Logic.Function.Basic
import Mathlib.Logic.Relator
import Mathlib.Init.Data.Quot
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Use
import Mathlib.Tactic.MkIffOfInductiveProp
import Mathlib.Tactic.SimpRw
#align_import logic.relation from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
open Function
variable {α β γ δ ε ζ : Type*}
namespace Relation
variable {r : α → α → Prop} {a b c d : α}
@[mk_iff ReflTransGen.cases_tail_iff]
inductive ReflTransGen (r : α → α → Prop) (a : α) : α → Prop
| refl : ReflTransGen r a a
| tail {b c} : ReflTransGen r a b → r b c → ReflTransGen r a c
#align relation.refl_trans_gen Relation.ReflTransGen
#align relation.refl_trans_gen.cases_tail_iff Relation.ReflTransGen.cases_tail_iff
attribute [refl] ReflTransGen.refl
@[mk_iff]
inductive ReflGen (r : α → α → Prop) (a : α) : α → Prop
| refl : ReflGen r a a
| single {b} : r a b → ReflGen r a b
#align relation.refl_gen Relation.ReflGen
#align relation.refl_gen_iff Relation.reflGen_iff
@[mk_iff]
inductive TransGen (r : α → α → Prop) (a : α) : α → Prop
| single {b} : r a b → TransGen r a b
| tail {b c} : TransGen r a b → r b c → TransGen r a c
#align relation.trans_gen Relation.TransGen
#align relation.trans_gen_iff Relation.transGen_iff
attribute [refl] ReflGen.refl
namespace ReflTransGen
@[trans]
theorem trans (hab : ReflTransGen r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by
induction hbc with
| refl => assumption
| tail _ hcd hac => exact hac.tail hcd
#align relation.refl_trans_gen.trans Relation.ReflTransGen.trans
theorem single (hab : r a b) : ReflTransGen r a b :=
refl.tail hab
#align relation.refl_trans_gen.single Relation.ReflTransGen.single
theorem head (hab : r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by
induction hbc with
| refl => exact refl.tail hab
| tail _ hcd hac => exact hac.tail hcd
#align relation.refl_trans_gen.head Relation.ReflTransGen.head
| Mathlib/Logic/Relation.lean | 312 | 316 | theorem symmetric (h : Symmetric r) : Symmetric (ReflTransGen r) := by
intro x y h |
intro x y h
induction' h with z w _ b c
· rfl
· apply Relation.ReflTransGen.head (h b) c
| true |
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv
#align_import linear_algebra.affine_space.midpoint from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open AffineMap AffineEquiv
section
variable (R : Type*) {V V' P P' : Type*} [Ring R] [Invertible (2 : R)] [AddCommGroup V]
[Module R V] [AddTorsor V P] [AddCommGroup V'] [Module R V'] [AddTorsor V' P']
def midpoint (x y : P) : P :=
lineMap x y (⅟ 2 : R)
#align midpoint midpoint
variable {R} {x y z : P}
@[simp]
theorem AffineMap.map_midpoint (f : P →ᵃ[R] P') (a b : P) :
f (midpoint R a b) = midpoint R (f a) (f b) :=
f.apply_lineMap a b _
#align affine_map.map_midpoint AffineMap.map_midpoint
@[simp]
theorem AffineEquiv.map_midpoint (f : P ≃ᵃ[R] P') (a b : P) :
f (midpoint R a b) = midpoint R (f a) (f b) :=
f.apply_lineMap a b _
#align affine_equiv.map_midpoint AffineEquiv.map_midpoint
theorem AffineEquiv.pointReflection_midpoint_left (x y : P) :
pointReflection R (midpoint R x y) x = y := by
rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul,
mul_invOf_self, one_smul, vsub_vadd]
#align affine_equiv.point_reflection_midpoint_left AffineEquiv.pointReflection_midpoint_left
@[simp] -- Porting note: added variant with `Equiv.pointReflection` for `simp`
theorem Equiv.pointReflection_midpoint_left (x y : P) :
(Equiv.pointReflection (midpoint R x y)) x = y := by
rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul,
mul_invOf_self, one_smul, vsub_vadd]
theorem midpoint_comm (x y : P) : midpoint R x y = midpoint R y x := by
rw [midpoint, ← lineMap_apply_one_sub, one_sub_invOf_two, midpoint]
#align midpoint_comm midpoint_comm
theorem AffineEquiv.pointReflection_midpoint_right (x y : P) :
pointReflection R (midpoint R x y) y = x := by
rw [midpoint_comm, AffineEquiv.pointReflection_midpoint_left]
#align affine_equiv.point_reflection_midpoint_right AffineEquiv.pointReflection_midpoint_right
@[simp] -- Porting note: added variant with `Equiv.pointReflection` for `simp`
theorem Equiv.pointReflection_midpoint_right (x y : P) :
(Equiv.pointReflection (midpoint R x y)) y = x := by
rw [midpoint_comm, Equiv.pointReflection_midpoint_left]
theorem midpoint_vsub_midpoint (p₁ p₂ p₃ p₄ : P) :
midpoint R p₁ p₂ -ᵥ midpoint R p₃ p₄ = midpoint R (p₁ -ᵥ p₃) (p₂ -ᵥ p₄) :=
lineMap_vsub_lineMap _ _ _ _ _
#align midpoint_vsub_midpoint midpoint_vsub_midpoint
theorem midpoint_vadd_midpoint (v v' : V) (p p' : P) :
midpoint R v v' +ᵥ midpoint R p p' = midpoint R (v +ᵥ p) (v' +ᵥ p') :=
lineMap_vadd_lineMap _ _ _ _ _
#align midpoint_vadd_midpoint midpoint_vadd_midpoint
theorem midpoint_eq_iff {x y z : P} : midpoint R x y = z ↔ pointReflection R z x = y :=
eq_comm.trans
((injective_pointReflection_left_of_module R x).eq_iff'
(AffineEquiv.pointReflection_midpoint_left x y)).symm
#align midpoint_eq_iff midpoint_eq_iff
@[simp]
theorem midpoint_pointReflection_left (x y : P) :
midpoint R (Equiv.pointReflection x y) y = x :=
midpoint_eq_iff.2 <| Equiv.pointReflection_involutive _ _
@[simp]
theorem midpoint_pointReflection_right (x y : P) :
midpoint R y (Equiv.pointReflection x y) = x :=
midpoint_eq_iff.2 rfl
@[simp]
theorem midpoint_vsub_left (p₁ p₂ : P) : midpoint R p₁ p₂ -ᵥ p₁ = (⅟ 2 : R) • (p₂ -ᵥ p₁) :=
lineMap_vsub_left _ _ _
#align midpoint_vsub_left midpoint_vsub_left
@[simp]
theorem midpoint_vsub_right (p₁ p₂ : P) : midpoint R p₁ p₂ -ᵥ p₂ = (⅟ 2 : R) • (p₁ -ᵥ p₂) := by
rw [midpoint_comm, midpoint_vsub_left]
#align midpoint_vsub_right midpoint_vsub_right
@[simp]
theorem left_vsub_midpoint (p₁ p₂ : P) : p₁ -ᵥ midpoint R p₁ p₂ = (⅟ 2 : R) • (p₁ -ᵥ p₂) :=
left_vsub_lineMap _ _ _
#align left_vsub_midpoint left_vsub_midpoint
@[simp]
theorem right_vsub_midpoint (p₁ p₂ : P) : p₂ -ᵥ midpoint R p₁ p₂ = (⅟ 2 : R) • (p₂ -ᵥ p₁) := by
rw [midpoint_comm, left_vsub_midpoint]
#align right_vsub_midpoint right_vsub_midpoint
| Mathlib/LinearAlgebra/AffineSpace/Midpoint.lean | 133 | 137 | theorem midpoint_vsub (p₁ p₂ p : P) :
midpoint R p₁ p₂ -ᵥ p = (⅟ 2 : R) • (p₁ -ᵥ p) + (⅟ 2 : R) • (p₂ -ᵥ p) := by
rw [← vsub_sub_vsub_cancel_right p₁ p p₂, smul_sub, sub_eq_add_neg, ← smul_neg, |
rw [← vsub_sub_vsub_cancel_right p₁ p p₂, smul_sub, sub_eq_add_neg, ← smul_neg,
neg_vsub_eq_vsub_rev, add_assoc, invOf_two_smul_add_invOf_two_smul, ← vadd_vsub_assoc,
midpoint_comm, midpoint, lineMap_apply]
| true |
import Mathlib.Algebra.BigOperators.Group.Multiset
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
universe v
variable {α : Type*} {β : Type v} {γ δ : Type*}
namespace Multiset
def join : Multiset (Multiset α) → Multiset α :=
sum
#align multiset.join Multiset.join
theorem coe_join :
∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join
| [] => rfl
| l :: L => by
exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L)
#align multiset.coe_join Multiset.coe_join
@[simp]
theorem join_zero : @join α 0 = 0 :=
rfl
#align multiset.join_zero Multiset.join_zero
@[simp]
theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S :=
sum_cons _ _
#align multiset.join_cons Multiset.join_cons
@[simp]
theorem join_add (S T) : @join α (S + T) = join S + join T :=
sum_add _ _
#align multiset.join_add Multiset.join_add
@[simp]
theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a :=
sum_singleton _
#align multiset.singleton_join Multiset.singleton_join
@[simp]
theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s :=
Multiset.induction_on S (by simp) <| by
simp (config := { contextual := true }) [or_and_right, exists_or]
#align multiset.mem_join Multiset.mem_join
@[simp]
theorem card_join (S) : card (@join α S) = sum (map card S) :=
Multiset.induction_on S (by simp) (by simp)
#align multiset.card_join Multiset.card_join
@[simp]
theorem map_join (f : α → β) (S : Multiset (Multiset α)) :
map f (join S) = join (map (map f) S) := by
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
@[to_additive (attr := simp)]
theorem prod_join [CommMonoid α] {S : Multiset (Multiset α)} :
prod (join S) = prod (map prod S) := by
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
theorem rel_join {r : α → β → Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by
induction h with
| zero => simp
| cons hab hst ih => simpa using hab.add ih
#align multiset.rel_join Multiset.rel_join
section Bind
variable (a : α) (s t : Multiset α) (f g : α → Multiset β)
def bind (s : Multiset α) (f : α → Multiset β) : Multiset β :=
(s.map f).join
#align multiset.bind Multiset.bind
@[simp]
| Mathlib/Data/Multiset/Bind.lean | 115 | 117 | theorem coe_bind (l : List α) (f : α → List β) : (@bind α β l fun a => f a) = l.bind f := by
rw [List.bind, ← coe_join, List.map_map] |
rw [List.bind, ← coe_join, List.map_map]
rfl
| true |
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Multiset.Powerset
#align_import data.finset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace Finset
open Function Multiset
variable {α : Type*} {s t : Finset α}
section powersetCard
variable {n} {s t : Finset α}
def powersetCard (n : ℕ) (s : Finset α) : Finset (Finset α) :=
⟨((s.1.powersetCard n).pmap Finset.mk) fun _t h => nodup_of_le (mem_powersetCard.1 h).1 s.2,
s.2.powersetCard.pmap fun _a _ha _b _hb => congr_arg Finset.val⟩
#align finset.powerset_len Finset.powersetCard
@[simp] lemma mem_powersetCard : s ∈ powersetCard n t ↔ s ⊆ t ∧ card s = n := by
cases s; simp [powersetCard, val_le_iff.symm]
#align finset.mem_powerset_len Finset.mem_powersetCard
@[simp]
theorem powersetCard_mono {n} {s t : Finset α} (h : s ⊆ t) : powersetCard n s ⊆ powersetCard n t :=
fun _u h' => mem_powersetCard.2 <|
And.imp (fun h₂ => Subset.trans h₂ h) id (mem_powersetCard.1 h')
#align finset.powerset_len_mono Finset.powersetCard_mono
@[simp]
theorem card_powersetCard (n : ℕ) (s : Finset α) :
card (powersetCard n s) = Nat.choose (card s) n :=
(card_pmap _ _ _).trans (Multiset.card_powersetCard n s.1)
#align finset.card_powerset_len Finset.card_powersetCard
@[simp]
| Mathlib/Data/Finset/Powerset.lean | 220 | 225 | theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} := by
ext; rw [mem_powersetCard, mem_singleton, card_eq_zero] |
ext; rw [mem_powersetCard, mem_singleton, card_eq_zero]
refine
⟨fun h => h.2, fun h => by
rw [h]
exact ⟨empty_subset s, rfl⟩⟩
| true |
import Mathlib.Topology.Connected.Basic
open Set Topology
universe u v
variable {α : Type u} {β : Type v} {ι : Type*} {π : ι → Type*} [TopologicalSpace α]
{s t u v : Set α}
section LocallyConnectedSpace
class LocallyConnectedSpace (α : Type*) [TopologicalSpace α] : Prop where
open_connected_basis : ∀ x, (𝓝 x).HasBasis (fun s : Set α => IsOpen s ∧ x ∈ s ∧ IsConnected s) id
#align locally_connected_space LocallyConnectedSpace
theorem locallyConnectedSpace_iff_open_connected_basis :
LocallyConnectedSpace α ↔
∀ x, (𝓝 x).HasBasis (fun s : Set α => IsOpen s ∧ x ∈ s ∧ IsConnected s) id :=
⟨@LocallyConnectedSpace.open_connected_basis _ _, LocallyConnectedSpace.mk⟩
#align locally_connected_space_iff_open_connected_basis locallyConnectedSpace_iff_open_connected_basis
theorem locallyConnectedSpace_iff_open_connected_subsets :
LocallyConnectedSpace α ↔
∀ x, ∀ U ∈ 𝓝 x, ∃ V : Set α, V ⊆ U ∧ IsOpen V ∧ x ∈ V ∧ IsConnected V := by
simp_rw [locallyConnectedSpace_iff_open_connected_basis]
refine forall_congr' fun _ => ?_
constructor
· intro h U hU
rcases h.mem_iff.mp hU with ⟨V, hV, hVU⟩
exact ⟨V, hVU, hV⟩
· exact fun h => ⟨fun U => ⟨fun hU =>
let ⟨V, hVU, hV⟩ := h U hU
⟨V, hV, hVU⟩, fun ⟨V, ⟨hV, hxV, _⟩, hVU⟩ => mem_nhds_iff.mpr ⟨V, hVU, hV, hxV⟩⟩⟩
#align locally_connected_space_iff_open_connected_subsets locallyConnectedSpace_iff_open_connected_subsets
instance (priority := 100) DiscreteTopology.toLocallyConnectedSpace (α) [TopologicalSpace α]
[DiscreteTopology α] : LocallyConnectedSpace α :=
locallyConnectedSpace_iff_open_connected_subsets.2 fun x _U hU =>
⟨{x}, singleton_subset_iff.2 <| mem_of_mem_nhds hU, isOpen_discrete _, rfl,
isConnected_singleton⟩
#align discrete_topology.to_locally_connected_space DiscreteTopology.toLocallyConnectedSpace
theorem connectedComponentIn_mem_nhds [LocallyConnectedSpace α] {F : Set α} {x : α} (h : F ∈ 𝓝 x) :
connectedComponentIn F x ∈ 𝓝 x := by
rw [(LocallyConnectedSpace.open_connected_basis x).mem_iff] at h
rcases h with ⟨s, ⟨h1s, hxs, h2s⟩, hsF⟩
exact mem_nhds_iff.mpr ⟨s, h2s.isPreconnected.subset_connectedComponentIn hxs hsF, h1s, hxs⟩
#align connected_component_in_mem_nhds connectedComponentIn_mem_nhds
protected theorem IsOpen.connectedComponentIn [LocallyConnectedSpace α] {F : Set α} {x : α}
(hF : IsOpen F) : IsOpen (connectedComponentIn F x) := by
rw [isOpen_iff_mem_nhds]
intro y hy
rw [connectedComponentIn_eq hy]
exact connectedComponentIn_mem_nhds (hF.mem_nhds <| connectedComponentIn_subset F x hy)
#align is_open.connected_component_in IsOpen.connectedComponentIn
theorem isOpen_connectedComponent [LocallyConnectedSpace α] {x : α} :
IsOpen (connectedComponent x) := by
rw [← connectedComponentIn_univ]
exact isOpen_univ.connectedComponentIn
#align is_open_connected_component isOpen_connectedComponent
theorem isClopen_connectedComponent [LocallyConnectedSpace α] {x : α} :
IsClopen (connectedComponent x) :=
⟨isClosed_connectedComponent, isOpen_connectedComponent⟩
#align is_clopen_connected_component isClopen_connectedComponent
theorem locallyConnectedSpace_iff_connectedComponentIn_open :
LocallyConnectedSpace α ↔
∀ F : Set α, IsOpen F → ∀ x ∈ F, IsOpen (connectedComponentIn F x) := by
constructor
· intro h
exact fun F hF x _ => hF.connectedComponentIn
· intro h
rw [locallyConnectedSpace_iff_open_connected_subsets]
refine fun x U hU =>
⟨connectedComponentIn (interior U) x,
(connectedComponentIn_subset _ _).trans interior_subset, h _ isOpen_interior x ?_,
mem_connectedComponentIn ?_, isConnected_connectedComponentIn_iff.mpr ?_⟩ <;>
exact mem_interior_iff_mem_nhds.mpr hU
#align locally_connected_space_iff_connected_component_in_open locallyConnectedSpace_iff_connectedComponentIn_open
theorem locallyConnectedSpace_iff_connected_subsets :
LocallyConnectedSpace α ↔ ∀ (x : α), ∀ U ∈ 𝓝 x, ∃ V ∈ 𝓝 x, IsPreconnected V ∧ V ⊆ U := by
constructor
· rw [locallyConnectedSpace_iff_open_connected_subsets]
intro h x U hxU
rcases h x U hxU with ⟨V, hVU, hV₁, hxV, hV₂⟩
exact ⟨V, hV₁.mem_nhds hxV, hV₂.isPreconnected, hVU⟩
· rw [locallyConnectedSpace_iff_connectedComponentIn_open]
refine fun h U hU x _ => isOpen_iff_mem_nhds.mpr fun y hy => ?_
rw [connectedComponentIn_eq hy]
rcases h y U (hU.mem_nhds <| (connectedComponentIn_subset _ _) hy) with ⟨V, hVy, hV, hVU⟩
exact Filter.mem_of_superset hVy (hV.subset_connectedComponentIn (mem_of_mem_nhds hVy) hVU)
#align locally_connected_space_iff_connected_subsets locallyConnectedSpace_iff_connected_subsets
theorem locallyConnectedSpace_iff_connected_basis :
LocallyConnectedSpace α ↔
∀ x, (𝓝 x).HasBasis (fun s : Set α => s ∈ 𝓝 x ∧ IsPreconnected s) id := by
rw [locallyConnectedSpace_iff_connected_subsets]
exact forall_congr' fun x => Filter.hasBasis_self.symm
#align locally_connected_space_iff_connected_basis locallyConnectedSpace_iff_connected_basis
| Mathlib/Topology/Connected/LocallyConnected.lean | 125 | 132 | theorem locallyConnectedSpace_of_connected_bases {ι : Type*} (b : α → ι → Set α) (p : α → ι → Prop)
(hbasis : ∀ x, (𝓝 x).HasBasis (p x) (b x))
(hconnected : ∀ x i, p x i → IsPreconnected (b x i)) : LocallyConnectedSpace α := by
rw [locallyConnectedSpace_iff_connected_basis] |
rw [locallyConnectedSpace_iff_connected_basis]
exact fun x =>
(hbasis x).to_hasBasis
(fun i hi => ⟨b x i, ⟨(hbasis x).mem_of_mem hi, hconnected x i hi⟩, subset_rfl⟩) fun s hs =>
⟨(hbasis x).index s hs.1, ⟨(hbasis x).property_index hs.1, (hbasis x).set_index_subset hs.1⟩⟩
| true |
import Mathlib.Analysis.PSeries
import Mathlib.Data.Real.Pi.Wallis
import Mathlib.Tactic.AdaptationNote
#align_import analysis.special_functions.stirling from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open scoped Topology Real Nat Asymptotics
open Finset Filter Nat Real
namespace Stirling
noncomputable def stirlingSeq (n : ℕ) : ℝ :=
n ! / (√(2 * n : ℝ) * (n / exp 1) ^ n)
#align stirling.stirling_seq Stirling.stirlingSeq
@[simp]
theorem stirlingSeq_zero : stirlingSeq 0 = 0 := by
rw [stirlingSeq, cast_zero, mul_zero, Real.sqrt_zero, zero_mul, div_zero]
#align stirling.stirling_seq_zero Stirling.stirlingSeq_zero
@[simp]
theorem stirlingSeq_one : stirlingSeq 1 = exp 1 / √2 := by
rw [stirlingSeq, pow_one, factorial_one, cast_one, mul_one, mul_one_div, one_div_div]
#align stirling.stirling_seq_one Stirling.stirlingSeq_one
theorem log_stirlingSeq_formula (n : ℕ) :
log (stirlingSeq n) = Real.log n ! - 1 / 2 * Real.log (2 * n) - n * log (n / exp 1) := by
cases n
· simp
· rw [stirlingSeq, log_div, log_mul, sqrt_eq_rpow, log_rpow, Real.log_pow, tsub_tsub]
<;> positivity
-- Porting note: generalized from `n.succ` to `n`
#align stirling.log_stirling_seq_formula Stirling.log_stirlingSeq_formulaₓ
| Mathlib/Analysis/SpecialFunctions/Stirling.lean | 77 | 93 | theorem log_stirlingSeq_diff_hasSum (m : ℕ) :
HasSum (fun k : ℕ => (1 : ℝ) / (2 * ↑(k + 1) + 1) * ((1 / (2 * ↑(m + 1) + 1)) ^ 2) ^ ↑(k + 1))
(log (stirlingSeq (m + 1)) - log (stirlingSeq (m + 2))) := by
let f (k : ℕ) := (1 : ℝ) / (2 * k + 1) * ((1 / (2 * ↑(m + 1) + 1)) ^ 2) ^ k |
let f (k : ℕ) := (1 : ℝ) / (2 * k + 1) * ((1 / (2 * ↑(m + 1) + 1)) ^ 2) ^ k
change HasSum (fun k => f (k + 1)) _
rw [hasSum_nat_add_iff]
convert (hasSum_log_one_add_inv m.cast_add_one_pos).mul_left ((↑(m + 1) : ℝ) + 1 / 2) using 1
· ext k
dsimp only [f]
rw [← pow_mul, pow_add]
push_cast
field_simp
ring
· have h : ∀ x ≠ (0 : ℝ), 1 + x⁻¹ = (x + 1) / x := fun x hx ↦ by field_simp [hx]
simp (disch := positivity) only [log_stirlingSeq_formula, log_div, log_mul, log_exp,
factorial_succ, cast_mul, cast_succ, cast_zero, range_one, sum_singleton, h]
ring
| true |
import Mathlib.LinearAlgebra.CliffordAlgebra.Fold
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic
#align_import linear_algebra.exterior_algebra.of_alternating from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
variable {R M N N' : Type*}
variable [CommRing R] [AddCommGroup M] [AddCommGroup N] [AddCommGroup N']
variable [Module R M] [Module R N] [Module R N']
-- This instance can't be found where it's needed if we don't remind lean that it exists.
instance AlternatingMap.instModuleAddCommGroup {ι : Type*} :
Module R (M [⋀^ι]→ₗ[R] N) := by
infer_instance
#align alternating_map.module_add_comm_group AlternatingMap.instModuleAddCommGroup
namespace ExteriorAlgebra
open CliffordAlgebra hiding ι
def liftAlternating : (∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] N := by
suffices
(∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R]
ExteriorAlgebra R M →ₗ[R] ∀ i, M [⋀^Fin i]→ₗ[R] N by
refine LinearMap.compr₂ this ?_
refine (LinearEquiv.toLinearMap ?_).comp (LinearMap.proj 0)
exact AlternatingMap.constLinearEquivOfIsEmpty.symm
refine CliffordAlgebra.foldl _ ?_ ?_
· refine
LinearMap.mk₂ R (fun m f i => (f i.succ).curryLeft m) (fun m₁ m₂ f => ?_) (fun c m f => ?_)
(fun m f₁ f₂ => ?_) fun c m f => ?_
all_goals
ext i : 1
simp only [map_smul, map_add, Pi.add_apply, Pi.smul_apply, AlternatingMap.curryLeft_add,
AlternatingMap.curryLeft_smul, map_add, map_smul, LinearMap.add_apply, LinearMap.smul_apply]
· -- when applied twice with the same `m`, this recursive step produces 0
intro m x
dsimp only [LinearMap.mk₂_apply, QuadraticForm.coeFn_zero, Pi.zero_apply]
simp_rw [zero_smul]
ext i : 1
exact AlternatingMap.curryLeft_same _ _
#align exterior_algebra.lift_alternating ExteriorAlgebra.liftAlternating
@[simp]
theorem liftAlternating_ι (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M) :
liftAlternating (R := R) (M := M) (N := N) f (ι R m) = f 1 ![m] := by
dsimp [liftAlternating]
rw [foldl_ι, LinearMap.mk₂_apply, AlternatingMap.curryLeft_apply_apply]
congr
-- Porting note: In Lean 3, `congr` could use the `[Subsingleton (Fin 0 → M)]` instance to finish
-- the proof. Here, the instance can be synthesized but `congr` does not use it so the following
-- line is provided.
rw [Matrix.zero_empty]
#align exterior_algebra.lift_alternating_ι ExteriorAlgebra.liftAlternating_ι
theorem liftAlternating_ι_mul (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M)
(x : ExteriorAlgebra R M) :
liftAlternating (R := R) (M := M) (N := N) f (ι R m * x) =
liftAlternating (R := R) (M := M) (N := N) (fun i => (f i.succ).curryLeft m) x := by
dsimp [liftAlternating]
rw [foldl_mul, foldl_ι]
rfl
#align exterior_algebra.lift_alternating_ι_mul ExteriorAlgebra.liftAlternating_ι_mul
@[simp]
theorem liftAlternating_one (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) :
liftAlternating (R := R) (M := M) (N := N) f (1 : ExteriorAlgebra R M) = f 0 0 := by
dsimp [liftAlternating]
rw [foldl_one]
#align exterior_algebra.lift_alternating_one ExteriorAlgebra.liftAlternating_one
@[simp]
theorem liftAlternating_algebraMap (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (r : R) :
liftAlternating (R := R) (M := M) (N := N) f (algebraMap _ (ExteriorAlgebra R M) r) =
r • f 0 0 := by
rw [Algebra.algebraMap_eq_smul_one, map_smul, liftAlternating_one]
#align exterior_algebra.lift_alternating_algebra_map ExteriorAlgebra.liftAlternating_algebraMap
@[simp]
theorem liftAlternating_apply_ιMulti {n : ℕ} (f : ∀ i, M [⋀^Fin i]→ₗ[R] N)
(v : Fin n → M) : liftAlternating (R := R) (M := M) (N := N) f (ιMulti R n v) = f n v := by
rw [ιMulti_apply]
-- Porting note: `v` is generalized automatically so it was removed from the next line
induction' n with n ih generalizing f
· -- Porting note: Lean does not automatically synthesize the instance
-- `[Subsingleton (Fin 0 → M)]` which is needed for `Subsingleton.elim 0 v` on line 114.
letI : Subsingleton (Fin 0 → M) := by infer_instance
rw [List.ofFn_zero, List.prod_nil, liftAlternating_one, Subsingleton.elim 0 v]
· rw [List.ofFn_succ, List.prod_cons, liftAlternating_ι_mul, ih,
AlternatingMap.curryLeft_apply_apply]
congr
exact Matrix.cons_head_tail _
#align exterior_algebra.lift_alternating_apply_ι_multi ExteriorAlgebra.liftAlternating_apply_ιMulti
@[simp]
theorem liftAlternating_comp_ιMulti {n : ℕ} (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) :
(liftAlternating (R := R) (M := M) (N := N) f).compAlternatingMap (ιMulti R n) = f n :=
AlternatingMap.ext <| liftAlternating_apply_ιMulti f
#align exterior_algebra.lift_alternating_comp_ι_multi ExteriorAlgebra.liftAlternating_comp_ιMulti
@[simp]
| Mathlib/LinearAlgebra/ExteriorAlgebra/OfAlternating.lean | 125 | 135 | theorem liftAlternating_comp (g : N →ₗ[R] N') (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) :
(liftAlternating (R := R) (M := M) (N := N') fun i => g.compAlternatingMap (f i)) =
g ∘ₗ liftAlternating (R := R) (M := M) (N := N) f := by
ext v |
ext v
rw [LinearMap.comp_apply]
induction' v using CliffordAlgebra.left_induction with r x y hx hy x m hx generalizing f
· rw [liftAlternating_algebraMap, liftAlternating_algebraMap, map_smul,
LinearMap.compAlternatingMap_apply]
· rw [map_add, map_add, map_add, hx, hy]
· rw [liftAlternating_ι_mul, liftAlternating_ι_mul, ← hx]
simp_rw [AlternatingMap.curryLeft_compAlternatingMap]
| true |
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.PEquiv
#align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
namespace PEquiv
open Matrix
universe u v
variable {k l m n : Type*}
variable {α : Type v}
open Matrix
def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α :=
of fun i j => if j ∈ f i then (1 : α) else 0
#align pequiv.to_matrix PEquiv.toMatrix
-- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024
@[simp]
theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) :
toMatrix f i j = if j ∈ f i then (1 : α) else 0 :=
rfl
#align pequiv.to_matrix_apply PEquiv.toMatrix_apply
theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α)
(i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f i with fi
· simp [h]
· rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm]
#align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply
theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) :
(f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by
ext
simp only [transpose, mem_iff_mem f, toMatrix_apply]
congr
#align pequiv.to_matrix_symm PEquiv.toMatrix_symm
@[simp]
theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] :
((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by
ext
simp [toMatrix_apply, one_apply]
#align pequiv.to_matrix_refl PEquiv.toMatrix_refl
theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n)
(i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f.symm j with fj
· simp [h, ← f.eq_some_iff]
· rw [Finset.sum_eq_single fj]
· simp [h, ← f.eq_some_iff]
· rintro b - n
simp [h, ← f.eq_some_iff, n.symm]
· simp
#align pequiv.matrix_mul_apply PEquiv.matrix_mul_apply
| Mathlib/Data/Matrix/PEquiv.lean | 96 | 99 | theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring α] (f : m ≃ m)
(M : Matrix m n α) : f.toPEquiv.toMatrix * M = M.submatrix f id := by
ext i j |
ext i j
rw [mul_matrix_apply, Equiv.toPEquiv_apply, submatrix_apply, id]
| true |
import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.Coxeter.Basic
namespace CoxeterSystem
open List Matrix Function Classical
variable {B : Type*}
variable {W : Type*} [Group W]
variable {M : CoxeterMatrix B} (cs : CoxeterSystem M W)
local prefix:100 "s" => cs.simple
local prefix:100 "π" => cs.wordProd
private theorem exists_word_with_prod (w : W) : ∃ n ω, ω.length = n ∧ π ω = w := by
rcases cs.wordProd_surjective w with ⟨ω, rfl⟩
use ω.length, ω
noncomputable def length (w : W) : ℕ := Nat.find (cs.exists_word_with_prod w)
local prefix:100 "ℓ" => cs.length
theorem exists_reduced_word (w : W) : ∃ ω, ω.length = ℓ w ∧ w = π ω := by
have := Nat.find_spec (cs.exists_word_with_prod w)
tauto
theorem length_wordProd_le (ω : List B) : ℓ (π ω) ≤ ω.length :=
Nat.find_min' (cs.exists_word_with_prod (π ω)) ⟨ω, by tauto⟩
@[simp] theorem length_one : ℓ (1 : W) = 0 := Nat.eq_zero_of_le_zero (cs.length_wordProd_le [])
@[simp]
theorem length_eq_zero_iff {w : W} : ℓ w = 0 ↔ w = 1 := by
constructor
· intro h
rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩
have : ω = [] := eq_nil_of_length_eq_zero (hω.trans h)
rw [this, wordProd_nil]
· rintro rfl
exact cs.length_one
@[simp]
| Mathlib/GroupTheory/Coxeter/Length.lean | 91 | 98 | theorem length_inv (w : W) : ℓ (w⁻¹) = ℓ w := by
apply Nat.le_antisymm |
apply Nat.le_antisymm
· rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩
have := cs.length_wordProd_le (List.reverse ω)
rwa [wordProd_reverse, length_reverse, hω] at this
· rcases cs.exists_reduced_word w⁻¹ with ⟨ω, hω, h'ω⟩
have := cs.length_wordProd_le (List.reverse ω)
rwa [wordProd_reverse, length_reverse, ← h'ω, hω, inv_inv] at this
| true |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Convex.Normed
import Mathlib.Analysis.Normed.Group.AddTorsor
#align_import analysis.convex.side from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
variable {R V V' P P' : Type*}
open AffineEquiv AffineMap
namespace AffineSubspace
section StrictOrderedCommRing
variable [StrictOrderedCommRing R] [AddCommGroup V] [Module R V] [AddTorsor V P]
variable [AddCommGroup V'] [Module R V'] [AddTorsor V' P']
def WSameSide (s : AffineSubspace R P) (x y : P) : Prop :=
∃ᵉ (p₁ ∈ s) (p₂ ∈ s), SameRay R (x -ᵥ p₁) (y -ᵥ p₂)
#align affine_subspace.w_same_side AffineSubspace.WSameSide
def SSameSide (s : AffineSubspace R P) (x y : P) : Prop :=
s.WSameSide x y ∧ x ∉ s ∧ y ∉ s
#align affine_subspace.s_same_side AffineSubspace.SSameSide
def WOppSide (s : AffineSubspace R P) (x y : P) : Prop :=
∃ᵉ (p₁ ∈ s) (p₂ ∈ s), SameRay R (x -ᵥ p₁) (p₂ -ᵥ y)
#align affine_subspace.w_opp_side AffineSubspace.WOppSide
def SOppSide (s : AffineSubspace R P) (x y : P) : Prop :=
s.WOppSide x y ∧ x ∉ s ∧ y ∉ s
#align affine_subspace.s_opp_side AffineSubspace.SOppSide
theorem WSameSide.map {s : AffineSubspace R P} {x y : P} (h : s.WSameSide x y) (f : P →ᵃ[R] P') :
(s.map f).WSameSide (f x) (f y) := by
rcases h with ⟨p₁, hp₁, p₂, hp₂, h⟩
refine ⟨f p₁, mem_map_of_mem f hp₁, f p₂, mem_map_of_mem f hp₂, ?_⟩
simp_rw [← linearMap_vsub]
exact h.map f.linear
#align affine_subspace.w_same_side.map AffineSubspace.WSameSide.map
theorem _root_.Function.Injective.wSameSide_map_iff {s : AffineSubspace R P} {x y : P}
{f : P →ᵃ[R] P'} (hf : Function.Injective f) :
(s.map f).WSameSide (f x) (f y) ↔ s.WSameSide x y := by
refine ⟨fun h => ?_, fun h => h.map _⟩
rcases h with ⟨fp₁, hfp₁, fp₂, hfp₂, h⟩
rw [mem_map] at hfp₁ hfp₂
rcases hfp₁ with ⟨p₁, hp₁, rfl⟩
rcases hfp₂ with ⟨p₂, hp₂, rfl⟩
refine ⟨p₁, hp₁, p₂, hp₂, ?_⟩
simp_rw [← linearMap_vsub, (f.linear_injective_iff.2 hf).sameRay_map_iff] at h
exact h
#align function.injective.w_same_side_map_iff Function.Injective.wSameSide_map_iff
theorem _root_.Function.Injective.sSameSide_map_iff {s : AffineSubspace R P} {x y : P}
{f : P →ᵃ[R] P'} (hf : Function.Injective f) :
(s.map f).SSameSide (f x) (f y) ↔ s.SSameSide x y := by
simp_rw [SSameSide, hf.wSameSide_map_iff, mem_map_iff_mem_of_injective hf]
#align function.injective.s_same_side_map_iff Function.Injective.sSameSide_map_iff
@[simp]
theorem _root_.AffineEquiv.wSameSide_map_iff {s : AffineSubspace R P} {x y : P} (f : P ≃ᵃ[R] P') :
(s.map ↑f).WSameSide (f x) (f y) ↔ s.WSameSide x y :=
(show Function.Injective f.toAffineMap from f.injective).wSameSide_map_iff
#align affine_equiv.w_same_side_map_iff AffineEquiv.wSameSide_map_iff
@[simp]
theorem _root_.AffineEquiv.sSameSide_map_iff {s : AffineSubspace R P} {x y : P} (f : P ≃ᵃ[R] P') :
(s.map ↑f).SSameSide (f x) (f y) ↔ s.SSameSide x y :=
(show Function.Injective f.toAffineMap from f.injective).sSameSide_map_iff
#align affine_equiv.s_same_side_map_iff AffineEquiv.sSameSide_map_iff
theorem WOppSide.map {s : AffineSubspace R P} {x y : P} (h : s.WOppSide x y) (f : P →ᵃ[R] P') :
(s.map f).WOppSide (f x) (f y) := by
rcases h with ⟨p₁, hp₁, p₂, hp₂, h⟩
refine ⟨f p₁, mem_map_of_mem f hp₁, f p₂, mem_map_of_mem f hp₂, ?_⟩
simp_rw [← linearMap_vsub]
exact h.map f.linear
#align affine_subspace.w_opp_side.map AffineSubspace.WOppSide.map
| Mathlib/Analysis/Convex/Side.lean | 109 | 119 | theorem _root_.Function.Injective.wOppSide_map_iff {s : AffineSubspace R P} {x y : P}
{f : P →ᵃ[R] P'} (hf : Function.Injective f) :
(s.map f).WOppSide (f x) (f y) ↔ s.WOppSide x y := by
refine ⟨fun h => ?_, fun h => h.map _⟩ |
refine ⟨fun h => ?_, fun h => h.map _⟩
rcases h with ⟨fp₁, hfp₁, fp₂, hfp₂, h⟩
rw [mem_map] at hfp₁ hfp₂
rcases hfp₁ with ⟨p₁, hp₁, rfl⟩
rcases hfp₂ with ⟨p₂, hp₂, rfl⟩
refine ⟨p₁, hp₁, p₂, hp₂, ?_⟩
simp_rw [← linearMap_vsub, (f.linear_injective_iff.2 hf).sameRay_map_iff] at h
exact h
| true |
import Mathlib.Control.Functor
import Mathlib.Tactic.Common
#align_import control.bifunctor from "leanprover-community/mathlib"@"dc1525fb3ef6eb4348fb1749c302d8abc303d34a"
universe u₀ u₁ u₂ v₀ v₁ v₂
open Function
class Bifunctor (F : Type u₀ → Type u₁ → Type u₂) where
bimap : ∀ {α α' β β'}, (α → α') → (β → β') → F α β → F α' β'
#align bifunctor Bifunctor
export Bifunctor (bimap)
class LawfulBifunctor (F : Type u₀ → Type u₁ → Type u₂) [Bifunctor F] : Prop where
id_bimap : ∀ {α β} (x : F α β), bimap id id x = x
bimap_bimap :
∀ {α₀ α₁ α₂ β₀ β₁ β₂} (f : α₀ → α₁) (f' : α₁ → α₂) (g : β₀ → β₁) (g' : β₁ → β₂) (x : F α₀ β₀),
bimap f' g' (bimap f g x) = bimap (f' ∘ f) (g' ∘ g) x
#align is_lawful_bifunctor LawfulBifunctor
export LawfulBifunctor (id_bimap bimap_bimap)
attribute [higher_order bimap_id_id] id_bimap
#align is_lawful_bifunctor.bimap_id_id LawfulBifunctor.bimap_id_id
attribute [higher_order bimap_comp_bimap] bimap_bimap
#align is_lawful_bifunctor.bimap_comp_bimap LawfulBifunctor.bimap_comp_bimap
export LawfulBifunctor (bimap_id_id bimap_comp_bimap)
variable {F : Type u₀ → Type u₁ → Type u₂} [Bifunctor F]
namespace Bifunctor
abbrev fst {α α' β} (f : α → α') : F α β → F α' β :=
bimap f id
#align bifunctor.fst Bifunctor.fst
abbrev snd {α β β'} (f : β → β') : F α β → F α β' :=
bimap id f
#align bifunctor.snd Bifunctor.snd
variable [LawfulBifunctor F]
@[higher_order fst_id]
theorem id_fst : ∀ {α β} (x : F α β), fst id x = x :=
@id_bimap _ _ _
#align bifunctor.id_fst Bifunctor.id_fst
#align bifunctor.fst_id Bifunctor.fst_id
@[higher_order snd_id]
theorem id_snd : ∀ {α β} (x : F α β), snd id x = x :=
@id_bimap _ _ _
#align bifunctor.id_snd Bifunctor.id_snd
#align bifunctor.snd_id Bifunctor.snd_id
@[higher_order fst_comp_fst]
| Mathlib/Control/Bifunctor.lean | 86 | 87 | theorem comp_fst {α₀ α₁ α₂ β} (f : α₀ → α₁) (f' : α₁ → α₂) (x : F α₀ β) :
fst f' (fst f x) = fst (f' ∘ f) x := by | simp [fst, bimap_bimap]
| true |
import Mathlib.Algebra.MvPolynomial.Rename
#align_import data.mv_polynomial.comap from "leanprover-community/mathlib"@"aba31c938d3243cc671be7091b28a1e0814647ee"
namespace MvPolynomial
variable {σ : Type*} {τ : Type*} {υ : Type*} {R : Type*} [CommSemiring R]
noncomputable def comap (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) : (τ → R) → σ → R :=
fun x i => aeval x (f (X i))
#align mv_polynomial.comap MvPolynomial.comap
@[simp]
theorem comap_apply (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) (x : τ → R) (i : σ) :
comap f x i = aeval x (f (X i)) :=
rfl
#align mv_polynomial.comap_apply MvPolynomial.comap_apply
@[simp]
| Mathlib/Algebra/MvPolynomial/Comap.lean | 48 | 50 | theorem comap_id_apply (x : σ → R) : comap (AlgHom.id R (MvPolynomial σ R)) x = x := by
funext i |
funext i
simp only [comap, AlgHom.id_apply, id, aeval_X]
| true |
import Mathlib.Algebra.Quaternion
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.quaternion from "leanprover-community/mathlib"@"07992a1d1f7a4176c6d3f160209608be4e198566"
@[inherit_doc] scoped[Quaternion] notation "ℍ" => Quaternion ℝ
open scoped RealInnerProductSpace
namespace Quaternion
instance : Inner ℝ ℍ :=
⟨fun a b => (a * star b).re⟩
theorem inner_self (a : ℍ) : ⟪a, a⟫ = normSq a :=
rfl
#align quaternion.inner_self Quaternion.inner_self
theorem inner_def (a b : ℍ) : ⟪a, b⟫ = (a * star b).re :=
rfl
#align quaternion.inner_def Quaternion.inner_def
noncomputable instance : NormedAddCommGroup ℍ :=
@InnerProductSpace.Core.toNormedAddCommGroup ℝ ℍ _ _ _
{ toInner := inferInstance
conj_symm := fun x y => by simp [inner_def, mul_comm]
nonneg_re := fun x => normSq_nonneg
definite := fun x => normSq_eq_zero.1
add_left := fun x y z => by simp only [inner_def, add_mul, add_re]
smul_left := fun x y r => by simp [inner_def] }
noncomputable instance : InnerProductSpace ℝ ℍ :=
InnerProductSpace.ofCore _
| Mathlib/Analysis/Quaternion.lean | 65 | 66 | theorem normSq_eq_norm_mul_self (a : ℍ) : normSq a = ‖a‖ * ‖a‖ := by |
rw [← inner_self, real_inner_self_eq_norm_mul_norm]
| true |
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
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]
#align complex.sin_arg Complex.sin_arg
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
rw [arg]
split_ifs with h₁ h₂
· rw [Real.cos_arcsin]
field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
· rw [Real.cos_add_pi, Real.cos_arcsin]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
_root_.abs_of_neg (not_le.1 h₁), *]
· rw [Real.cos_sub_pi, Real.cos_arcsin]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
_root_.abs_of_neg (not_le.1 h₁), *]
#align complex.cos_arg Complex.cos_arg
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
rcases eq_or_ne x 0 with (rfl | hx)
· simp
· have : abs x ≠ 0 := abs.ne_zero hx
apply Complex.ext <;> field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
set_option linter.uppercaseLean3 false in
#align complex.abs_mul_exp_arg_mul_I Complex.abs_mul_exp_arg_mul_I
@[simp]
| Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean | 63 | 64 | theorem abs_mul_cos_add_sin_mul_I (x : ℂ) : (abs x * (cos (arg x) + sin (arg x) * I) : ℂ) = x := by |
rw [← exp_mul_I, abs_mul_exp_arg_mul_I]
| true |
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
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
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.N₁Γ₀_hom_app AlgebraicTopology.DoldKan.N₁Γ₀_hom_app
theorem N₁Γ₀_inv_app (K : ChainComplex C ℕ) :
N₁Γ₀.inv.app K = (toKaroubi _).map (Γ₀NondegComplexIso K).inv ≫
(Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.hom := by
change (N₁Γ₀.app K).inv = _
simp only [N₁Γ₀_app]
rfl
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.N₁Γ₀_inv_app AlgebraicTopology.DoldKan.N₁Γ₀_inv_app
@[simp]
theorem N₁Γ₀_hom_app_f_f (K : ChainComplex C ℕ) (n : ℕ) :
(N₁Γ₀.hom.app K).f.f n = (Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.inv.f.f n := by
rw [N₁Γ₀_hom_app]
apply comp_id
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.N₁Γ₀_hom_app_f_f AlgebraicTopology.DoldKan.N₁Γ₀_hom_app_f_f
@[simp]
| Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean | 113 | 116 | theorem N₁Γ₀_inv_app_f_f (K : ChainComplex C ℕ) (n : ℕ) :
(N₁Γ₀.inv.app K).f.f n = (Γ₀.splitting K).toKaroubiNondegComplexIsoN₁.hom.f.f n := by
rw [N₁Γ₀_inv_app] |
rw [N₁Γ₀_inv_app]
apply id_comp
| true |
import Mathlib.CategoryTheory.CofilteredSystem
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.Data.Finite.Set
#align_import combinatorics.simple_graph.ends.defs from "leanprover-community/mathlib"@"b99e2d58a5e6861833fa8de11e51a81144258db4"
universe u
variable {V : Type u} (G : SimpleGraph V) (K L L' M : Set V)
namespace SimpleGraph
abbrev ComponentCompl :=
(G.induce Kᶜ).ConnectedComponent
#align simple_graph.component_compl SimpleGraph.ComponentCompl
variable {G} {K L M}
abbrev componentComplMk (G : SimpleGraph V) {v : V} (vK : v ∉ K) : G.ComponentCompl K :=
connectedComponentMk (G.induce Kᶜ) ⟨v, vK⟩
#align simple_graph.component_compl_mk SimpleGraph.componentComplMk
def ComponentCompl.supp (C : G.ComponentCompl K) : Set V :=
{ v : V | ∃ h : v ∉ K, G.componentComplMk h = C }
#align simple_graph.component_compl.supp SimpleGraph.ComponentCompl.supp
@[ext]
| Mathlib/Combinatorics/SimpleGraph/Ends/Defs.lean | 44 | 49 | theorem ComponentCompl.supp_injective :
Function.Injective (ComponentCompl.supp : G.ComponentCompl K → Set V) := by
refine ConnectedComponent.ind₂ ?_ |
refine ConnectedComponent.ind₂ ?_
rintro ⟨v, hv⟩ ⟨w, hw⟩ h
simp only [Set.ext_iff, ConnectedComponent.eq, Set.mem_setOf_eq, ComponentCompl.supp] at h ⊢
exact ((h v).mp ⟨hv, Reachable.refl _⟩).choose_spec
| true |
import Mathlib.Algebra.Group.Support
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Nat.Cast.Field
#align_import algebra.char_zero.lemmas from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829"
open Function Set
section AddMonoidWithOne
variable {α M : Type*} [AddMonoidWithOne M] [CharZero M] {n : ℕ}
instance CharZero.NeZero.two : NeZero (2 : M) :=
⟨by
have : ((2 : ℕ) : M) ≠ 0 := Nat.cast_ne_zero.2 (by decide)
rwa [Nat.cast_two] at this⟩
#align char_zero.ne_zero.two CharZero.NeZero.two
section
variable {R : Type*} [NonAssocSemiring R] [NoZeroDivisors R] [CharZero R] {a : R}
@[simp]
| Mathlib/Algebra/CharZero/Lemmas.lean | 88 | 89 | theorem add_self_eq_zero {a : R} : a + a = 0 ↔ a = 0 := by |
simp only [(two_mul a).symm, mul_eq_zero, two_ne_zero, false_or_iff]
| true |
import Mathlib.Data.Fintype.Order
import Mathlib.Data.Set.Finite
import Mathlib.Order.Category.FinPartOrd
import Mathlib.Order.Category.LinOrd
import Mathlib.CategoryTheory.Limits.Shapes.Images
import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
import Mathlib.Data.Set.Subsingleton
#align_import order.category.NonemptyFinLinOrd from "leanprover-community/mathlib"@"fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19"
universe u v
open CategoryTheory CategoryTheory.Limits
class NonemptyFiniteLinearOrder (α : Type*) extends Fintype α, LinearOrder α where
Nonempty : Nonempty α := by infer_instance
#align nonempty_fin_lin_ord NonemptyFiniteLinearOrder
attribute [instance] NonemptyFiniteLinearOrder.Nonempty
instance (priority := 100) NonemptyFiniteLinearOrder.toBoundedOrder (α : Type*)
[NonemptyFiniteLinearOrder α] : BoundedOrder α :=
Fintype.toBoundedOrder α
#align nonempty_fin_lin_ord.to_bounded_order NonemptyFiniteLinearOrder.toBoundedOrder
instance PUnit.nonemptyFiniteLinearOrder : NonemptyFiniteLinearOrder PUnit where
#align punit.nonempty_fin_lin_ord PUnit.nonemptyFiniteLinearOrder
instance Fin.nonemptyFiniteLinearOrder (n : ℕ) : NonemptyFiniteLinearOrder (Fin (n + 1)) where
#align fin.nonempty_fin_lin_ord Fin.nonemptyFiniteLinearOrder
instance ULift.nonemptyFiniteLinearOrder (α : Type u) [NonemptyFiniteLinearOrder α] :
NonemptyFiniteLinearOrder (ULift.{v} α) :=
{ LinearOrder.lift' Equiv.ulift (Equiv.injective _) with }
#align ulift.nonempty_fin_lin_ord ULift.nonemptyFiniteLinearOrder
instance (α : Type*) [NonemptyFiniteLinearOrder α] : NonemptyFiniteLinearOrder αᵒᵈ :=
{ OrderDual.fintype α with }
def NonemptyFinLinOrd :=
Bundled NonemptyFiniteLinearOrder
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd NonemptyFinLinOrd
namespace NonemptyFinLinOrd
instance : BundledHom.ParentProjection @NonemptyFiniteLinearOrder.toLinearOrder :=
⟨⟩
deriving instance LargeCategory for NonemptyFinLinOrd
-- Porting note: probably see https://github.com/leanprover-community/mathlib4/issues/5020
instance : ConcreteCategory NonemptyFinLinOrd :=
BundledHom.concreteCategory _
instance : CoeSort NonemptyFinLinOrd Type* :=
Bundled.coeSort
def of (α : Type*) [NonemptyFiniteLinearOrder α] : NonemptyFinLinOrd :=
Bundled.of α
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd.of NonemptyFinLinOrd.of
@[simp]
theorem coe_of (α : Type*) [NonemptyFiniteLinearOrder α] : ↥(of α) = α :=
rfl
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd.coe_of NonemptyFinLinOrd.coe_of
instance : Inhabited NonemptyFinLinOrd :=
⟨of PUnit⟩
instance (α : NonemptyFinLinOrd) : NonemptyFiniteLinearOrder α :=
α.str
instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrd LinOrd :=
BundledHom.forget₂ _ _
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrd.hasForgetToLinOrd
instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrd FinPartOrd where
forget₂ :=
{ obj := fun X => FinPartOrd.of X
map := @fun X Y => id }
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrd.hasForgetToFinPartOrd
@[simps]
def Iso.mk {α β : NonemptyFinLinOrd.{u}} (e : α ≃o β) : α ≅ β where
hom := (e : OrderHom _ _)
inv := (e.symm : OrderHom _ _)
hom_inv_id := by
ext x
exact e.symm_apply_apply x
inv_hom_id := by
ext x
exact e.apply_symm_apply x
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrd.Iso.mk
@[simps]
def dual : NonemptyFinLinOrd ⥤ NonemptyFinLinOrd where
obj X := of Xᵒᵈ
map := OrderHom.dual
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd.dual NonemptyFinLinOrd.dual
@[simps functor inverse]
def dualEquiv : NonemptyFinLinOrd ≌ NonemptyFinLinOrd where
functor := dual
inverse := dual
unitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
counitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
set_option linter.uppercaseLean3 false in
#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrd.dualEquiv
instance {A B : NonemptyFinLinOrd.{u}} : FunLike (A ⟶ B) A B where
coe f := ⇑(show OrderHom A B from f)
coe_injective' _ _ h := by
ext x
exact congr_fun h x
-- porting note (#10670): this instance was not necessary in mathlib
instance {A B : NonemptyFinLinOrd.{u}} : OrderHomClass (A ⟶ B) A B where
map_rel f _ _ h := f.monotone h
| Mathlib/Order/Category/NonemptyFinLinOrd.lean | 150 | 163 | theorem mono_iff_injective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
Mono f ↔ Function.Injective f := by
refine ⟨?_, ConcreteCategory.mono_of_injective f⟩ |
refine ⟨?_, ConcreteCategory.mono_of_injective f⟩
intro
intro a₁ a₂ h
let X := NonemptyFinLinOrd.of (ULift (Fin 1))
let g₁ : X ⟶ A := ⟨fun _ => a₁, fun _ _ _ => by rfl⟩
let g₂ : X ⟶ A := ⟨fun _ => a₂, fun _ _ _ => by rfl⟩
change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1))
have eq : g₁ ≫ f = g₂ ≫ f := by
ext
exact h
rw [cancel_mono] at eq
rw [eq]
| true |
import Mathlib.Algebra.Algebra.Tower
import Mathlib.Algebra.MvPolynomial.Basic
#align_import ring_theory.mv_polynomial.tower from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496"
variable (R A B : Type*) {σ : Type*}
namespace MvPolynomial
section CommSemiring
variable [CommSemiring R] [CommSemiring A] [CommSemiring B]
variable [Algebra R A] [Algebra A B] [Algebra R B] [IsScalarTower R A B]
variable {R A}
| Mathlib/RingTheory/MvPolynomial/Tower.lean | 48 | 53 | theorem aeval_algebraMap_apply (x : σ → A) (p : MvPolynomial σ R) :
aeval (algebraMap A B ∘ x) p = algebraMap A B (MvPolynomial.aeval x p) := by
rw [aeval_def, aeval_def, ← coe_eval₂Hom, ← coe_eval₂Hom, map_eval₂Hom, ← |
rw [aeval_def, aeval_def, ← coe_eval₂Hom, ← coe_eval₂Hom, map_eval₂Hom, ←
IsScalarTower.algebraMap_eq]
-- Porting note: added
simp only [Function.comp]
| true |
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.Eval
#align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd"
namespace Polynomial
open Polynomial Finsupp Finset
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] {f : R[X]}
def revAtFun (N i : ℕ) : ℕ :=
ite (i ≤ N) (N - i) i
#align polynomial.rev_at_fun Polynomial.revAtFun
theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by
unfold revAtFun
split_ifs with h j
· exact tsub_tsub_cancel_of_le h
· exfalso
apply j
exact Nat.sub_le N i
· rfl
#align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol
theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by
intro a b hab
rw [← @revAtFun_invol N a, hab, revAtFun_invol]
#align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj
def revAt (N : ℕ) : Function.Embedding ℕ ℕ where
toFun i := ite (i ≤ N) (N - i) i
inj' := revAtFun_inj
#align polynomial.rev_at Polynomial.revAt
@[simp]
theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i :=
rfl
#align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq
@[simp]
theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i :=
revAtFun_invol
#align polynomial.rev_at_invol Polynomial.revAt_invol
@[simp]
theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i :=
if_pos H
#align polynomial.rev_at_le Polynomial.revAt_le
lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h]
| Mathlib/Algebra/Polynomial/Reverse.lean | 82 | 88 | theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) :
revAt (N + O) (n + o) = revAt N n + revAt O o := by
rcases Nat.le.dest hn with ⟨n', rfl⟩ |
rcases Nat.le.dest hn with ⟨n', rfl⟩
rcases Nat.le.dest ho with ⟨o', rfl⟩
repeat' rw [revAt_le (le_add_right rfl.le)]
rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)]
repeat' rw [add_tsub_cancel_left]
| true |
import Mathlib.Data.Real.Basic
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Algebra.Order.EuclideanAbsoluteValue
#align_import number_theory.class_number.admissible_absolute_value from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
local infixl:50 " ≺ " => EuclideanDomain.r
namespace AbsoluteValue
variable {R : Type*} [EuclideanDomain R]
variable (abv : AbsoluteValue R ℤ)
structure IsAdmissible extends IsEuclidean abv where
protected card : ℝ → ℕ
exists_partition' :
∀ (n : ℕ) {ε : ℝ} (_ : 0 < ε) {b : R} (_ : b ≠ 0) (A : Fin n → R),
∃ t : Fin n → Fin (card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε
#align absolute_value.is_admissible AbsoluteValue.IsAdmissible
-- Porting note: no docstrings for IsAdmissible
attribute [nolint docBlame] IsAdmissible.card
namespace IsAdmissible
variable {abv}
theorem exists_partition {ι : Type*} [Finite ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0)
(A : ι → R) (h : abv.IsAdmissible) : ∃ t : ι → Fin (h.card ε),
∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε := by
rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩
obtain ⟨t, ht⟩ := h.exists_partition' n hε hb (A ∘ e.symm)
refine ⟨t ∘ e, fun i₀ i₁ h ↦ ?_⟩
convert (config := {transparency := .default})
ht (e i₀) (e i₁) h <;> simp only [e.symm_apply_apply]
#align absolute_value.is_admissible.exists_partition AbsoluteValue.IsAdmissible.exists_partition
theorem exists_approx_aux (n : ℕ) (h : abv.IsAdmissible) :
∀ {ε : ℝ} (_hε : 0 < ε) {b : R} (_hb : b ≠ 0) (A : Fin (h.card ε ^ n).succ → Fin n → R),
∃ i₀ i₁, i₀ ≠ i₁ ∧ ∀ k, (abv (A i₁ k % b - A i₀ k % b) : ℝ) < abv b • ε := by
haveI := Classical.decEq R
induction' n with n ih
· intro ε _hε b _hb A
refine ⟨0, 1, ?_, ?_⟩
· simp
rintro ⟨i, ⟨⟩⟩
intro ε hε b hb A
let M := h.card ε
-- By the "nicer" pigeonhole principle, we can find a collection `s`
-- of more than `M^n` remainders where the first components lie close together:
obtain ⟨s, s_inj, hs⟩ :
∃ s : Fin (M ^ n).succ → Fin (M ^ n.succ).succ,
Function.Injective s ∧ ∀ i₀ i₁, (abv (A (s i₁) 0 % b - A (s i₀) 0 % b) : ℝ) < abv b • ε := by
-- We can partition the `A`s into `M` subsets where
-- the first components lie close together:
obtain ⟨t, ht⟩ :
∃ t : Fin (M ^ n.succ).succ → Fin M,
∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ 0 % b - A i₀ 0 % b) : ℝ) < abv b • ε :=
h.exists_partition hε hb fun x ↦ A x 0
-- Since the `M` subsets contain more than `M * M^n` elements total,
-- there must be a subset that contains more than `M^n` elements.
obtain ⟨s, hs⟩ :=
Fintype.exists_lt_card_fiber_of_mul_lt_card (f := t)
(by simpa only [Fintype.card_fin, pow_succ'] using Nat.lt_succ_self (M ^ n.succ))
refine ⟨fun i ↦ (Finset.univ.filter fun x ↦ t x = s).toList.get <| i.castLE ?_, fun i j h ↦ ?_,
fun i₀ i₁ ↦ ht _ _ ?_⟩
· rwa [Finset.length_toList]
· simpa [(Finset.nodup_toList _).get_inj_iff] using h
· have : ∀ i, t ((Finset.univ.filter fun x ↦ t x = s).toList.get i) = s := fun i ↦
(Finset.mem_filter.mp (Finset.mem_toList.mp (List.get_mem _ i i.2))).2
simp [this]
-- Since `s` is large enough, there are two elements of `A ∘ s`
-- where the second components lie close together.
obtain ⟨k₀, k₁, hk, h⟩ := ih hε hb fun x ↦ Fin.tail (A (s x))
refine ⟨s k₀, s k₁, fun h ↦ hk (s_inj h), fun i ↦ Fin.cases ?_ (fun i ↦ ?_) i⟩
· exact hs k₀ k₁
· exact h i
#align absolute_value.is_admissible.exists_approx_aux AbsoluteValue.IsAdmissible.exists_approx_aux
| Mathlib/NumberTheory/ClassNumber/AdmissibleAbsoluteValue.lean | 117 | 123 | theorem exists_approx {ι : Type*} [Fintype ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0)
(h : abv.IsAdmissible) (A : Fin (h.card ε ^ Fintype.card ι).succ → ι → R) :
∃ i₀ i₁, i₀ ≠ i₁ ∧ ∀ k, (abv (A i₁ k % b - A i₀ k % b) : ℝ) < abv b • ε := by
let e := Fintype.equivFin ι |
let e := Fintype.equivFin ι
obtain ⟨i₀, i₁, ne, h⟩ := h.exists_approx_aux (Fintype.card ι) hε hb fun x y ↦ A x (e.symm y)
refine ⟨i₀, i₁, ne, fun k ↦ ?_⟩
convert h (e k) <;> simp only [e.symm_apply_apply]
| true |
import Mathlib.Analysis.Calculus.FDeriv.Basic
#align_import analysis.calculus.fderiv.restrict_scalars from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
section RestrictScalars
variable (𝕜 : Type*) [NontriviallyNormedField 𝕜]
variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜']
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedSpace 𝕜' E]
variable [IsScalarTower 𝕜 𝕜' E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedSpace 𝕜' F]
variable [IsScalarTower 𝕜 𝕜' F]
variable {f : E → F} {f' : E →L[𝕜'] F} {s : Set E} {x : E}
@[fun_prop]
theorem HasStrictFDerivAt.restrictScalars (h : HasStrictFDerivAt f f' x) :
HasStrictFDerivAt f (f'.restrictScalars 𝕜) x :=
h
#align has_strict_fderiv_at.restrict_scalars HasStrictFDerivAt.restrictScalars
theorem HasFDerivAtFilter.restrictScalars {L} (h : HasFDerivAtFilter f f' x L) :
HasFDerivAtFilter f (f'.restrictScalars 𝕜) x L :=
.of_isLittleO h.1
#align has_fderiv_at_filter.restrict_scalars HasFDerivAtFilter.restrictScalars
@[fun_prop]
theorem HasFDerivAt.restrictScalars (h : HasFDerivAt f f' x) :
HasFDerivAt f (f'.restrictScalars 𝕜) x :=
.of_isLittleO h.1
#align has_fderiv_at.restrict_scalars HasFDerivAt.restrictScalars
@[fun_prop]
theorem HasFDerivWithinAt.restrictScalars (h : HasFDerivWithinAt f f' s x) :
HasFDerivWithinAt f (f'.restrictScalars 𝕜) s x :=
.of_isLittleO h.1
#align has_fderiv_within_at.restrict_scalars HasFDerivWithinAt.restrictScalars
@[fun_prop]
theorem DifferentiableAt.restrictScalars (h : DifferentiableAt 𝕜' f x) : DifferentiableAt 𝕜 f x :=
(h.hasFDerivAt.restrictScalars 𝕜).differentiableAt
#align differentiable_at.restrict_scalars DifferentiableAt.restrictScalars
@[fun_prop]
theorem DifferentiableWithinAt.restrictScalars (h : DifferentiableWithinAt 𝕜' f s x) :
DifferentiableWithinAt 𝕜 f s x :=
(h.hasFDerivWithinAt.restrictScalars 𝕜).differentiableWithinAt
#align differentiable_within_at.restrict_scalars DifferentiableWithinAt.restrictScalars
@[fun_prop]
theorem DifferentiableOn.restrictScalars (h : DifferentiableOn 𝕜' f s) : DifferentiableOn 𝕜 f s :=
fun x hx => (h x hx).restrictScalars 𝕜
#align differentiable_on.restrict_scalars DifferentiableOn.restrictScalars
@[fun_prop]
theorem Differentiable.restrictScalars (h : Differentiable 𝕜' f) : Differentiable 𝕜 f := fun x =>
(h x).restrictScalars 𝕜
#align differentiable.restrict_scalars Differentiable.restrictScalars
@[fun_prop]
theorem HasFDerivWithinAt.of_restrictScalars {g' : E →L[𝕜] F} (h : HasFDerivWithinAt f g' s x)
(H : f'.restrictScalars 𝕜 = g') : HasFDerivWithinAt f f' s x := by
rw [← H] at h
exact .of_isLittleO h.1
#align has_fderiv_within_at_of_restrict_scalars HasFDerivWithinAt.of_restrictScalars
@[fun_prop]
| Mathlib/Analysis/Calculus/FDeriv/RestrictScalars.lean | 99 | 102 | theorem hasFDerivAt_of_restrictScalars {g' : E →L[𝕜] F} (h : HasFDerivAt f g' x)
(H : f'.restrictScalars 𝕜 = g') : HasFDerivAt f f' x := by
rw [← H] at h |
rw [← H] at h
exact .of_isLittleO h.1
| true |
import Mathlib.LinearAlgebra.TensorProduct.Tower
import Mathlib.Algebra.DirectSum.Module
#align_import linear_algebra.direct_sum.tensor_product from "leanprover-community/mathlib"@"9b9d125b7be0930f564a68f1d73ace10cf46064d"
suppress_compilation
universe u v₁ v₂ w₁ w₁' w₂ w₂'
section Ring
namespace TensorProduct
open TensorProduct
open DirectSum
open LinearMap
attribute [local ext] TensorProduct.ext
variable (R : Type u) [CommSemiring R] (S) [Semiring S] [Algebra R S]
variable {ι₁ : Type v₁} {ι₂ : Type v₂}
variable [DecidableEq ι₁] [DecidableEq ι₂]
variable (M₁ : ι₁ → Type w₁) (M₁' : Type w₁') (M₂ : ι₂ → Type w₂) (M₂' : Type w₂')
variable [∀ i₁, AddCommMonoid (M₁ i₁)] [AddCommMonoid M₁']
variable [∀ i₂, AddCommMonoid (M₂ i₂)] [AddCommMonoid M₂']
variable [∀ i₁, Module R (M₁ i₁)] [Module R M₁'] [∀ i₂, Module R (M₂ i₂)] [Module R M₂']
variable [∀ i₁, Module S (M₁ i₁)] [∀ i₁, IsScalarTower R S (M₁ i₁)]
protected def directSum :
((⨁ i₁, M₁ i₁) ⊗[R] ⨁ i₂, M₂ i₂) ≃ₗ[S] ⨁ i : ι₁ × ι₂, M₁ i.1 ⊗[R] M₂ i.2 := by
-- Porting note: entirely rewritten to allow unification to happen one step at a time
refine LinearEquiv.ofLinear (R := S) (R₂ := S) ?toFun ?invFun ?left ?right
· refine AlgebraTensorModule.lift ?_
refine DirectSum.toModule S _ _ fun i₁ => ?_
refine LinearMap.flip ?_
refine DirectSum.toModule R _ _ fun i₂ => LinearMap.flip <| ?_
refine AlgebraTensorModule.curry ?_
exact DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂)
· refine DirectSum.toModule S _ _ fun i => ?_
exact AlgebraTensorModule.map (DirectSum.lof S _ M₁ i.1) (DirectSum.lof R _ M₂ i.2)
· refine DirectSum.linearMap_ext S fun ⟨i₁, i₂⟩ => ?_
refine TensorProduct.AlgebraTensorModule.ext fun m₁ m₂ => ?_
-- Porting note: seems much nicer than the `repeat` lean 3 proof.
simp only [coe_comp, Function.comp_apply, toModule_lof, AlgebraTensorModule.map_tmul,
AlgebraTensorModule.lift_apply, lift.tmul, coe_restrictScalars, flip_apply,
AlgebraTensorModule.curry_apply, curry_apply, id_comp]
· -- `(_)` prevents typeclass search timing out on problems that can be solved immediately by
-- unification
apply TensorProduct.AlgebraTensorModule.curry_injective
refine DirectSum.linearMap_ext _ fun i₁ => ?_
refine LinearMap.ext fun x₁ => ?_
refine DirectSum.linearMap_ext _ fun i₂ => ?_
refine LinearMap.ext fun x₂ => ?_
-- Porting note: seems much nicer than the `repeat` lean 3 proof.
simp only [coe_comp, Function.comp_apply, AlgebraTensorModule.curry_apply, curry_apply,
coe_restrictScalars, AlgebraTensorModule.lift_apply, lift.tmul, toModule_lof, flip_apply,
AlgebraTensorModule.map_tmul, id_coe, id_eq]
#align tensor_product.direct_sum TensorProduct.directSum
def directSumLeft : (⨁ i₁, M₁ i₁) ⊗[R] M₂' ≃ₗ[R] ⨁ i, M₁ i ⊗[R] M₂' :=
LinearEquiv.ofLinear
(lift <|
DirectSum.toModule R _ _ fun i =>
(mk R _ _).compr₂ <| DirectSum.lof R ι₁ (fun i => M₁ i ⊗[R] M₂') _)
(DirectSum.toModule R _ _ fun i => rTensor _ (DirectSum.lof R ι₁ _ _))
(DirectSum.linearMap_ext R fun i =>
TensorProduct.ext <|
LinearMap.ext₂ fun m₁ m₂ => by
dsimp only [comp_apply, compr₂_apply, id_apply, mk_apply]
simp_rw [DirectSum.toModule_lof, rTensor_tmul, lift.tmul, DirectSum.toModule_lof,
compr₂_apply, mk_apply])
(TensorProduct.ext <|
DirectSum.linearMap_ext R fun i =>
LinearMap.ext₂ fun m₁ m₂ => by
dsimp only [comp_apply, compr₂_apply, id_apply, mk_apply]
simp_rw [lift.tmul, DirectSum.toModule_lof, compr₂_apply,
mk_apply, DirectSum.toModule_lof, rTensor_tmul])
#align tensor_product.direct_sum_left TensorProduct.directSumLeft
def directSumRight : (M₁' ⊗[R] ⨁ i, M₂ i) ≃ₗ[R] ⨁ i, M₁' ⊗[R] M₂ i :=
TensorProduct.comm R _ _ ≪≫ₗ directSumLeft R M₂ M₁' ≪≫ₗ
DFinsupp.mapRange.linearEquiv fun _ => TensorProduct.comm R _ _
#align tensor_product.direct_sum_right TensorProduct.directSumRight
variable {M₁ M₁' M₂ M₂'}
@[simp]
| Mathlib/LinearAlgebra/DirectSum/TensorProduct.lean | 150 | 153 | theorem directSum_lof_tmul_lof (i₁ : ι₁) (m₁ : M₁ i₁) (i₂ : ι₂) (m₂ : M₂ i₂) :
TensorProduct.directSum R S M₁ M₂ (DirectSum.lof S ι₁ M₁ i₁ m₁ ⊗ₜ DirectSum.lof R ι₂ M₂ i₂ m₂) =
DirectSum.lof S (ι₁ × ι₂) (fun i => M₁ i.1 ⊗[R] M₂ i.2) (i₁, i₂) (m₁ ⊗ₜ m₂) := by |
simp [TensorProduct.directSum]
| true |
import Mathlib.Analysis.BoxIntegral.Partition.Additive
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import analysis.box_integral.partition.measure from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open Set
noncomputable section
open scoped ENNReal Classical BoxIntegral
variable {ι : Type*}
namespace BoxIntegral
open MeasureTheory
namespace Box
variable (I : Box ι)
theorem measure_Icc_lt_top (μ : Measure (ι → ℝ)) [IsLocallyFiniteMeasure μ] : μ (Box.Icc I) < ∞ :=
show μ (Icc I.lower I.upper) < ∞ from I.isCompact_Icc.measure_lt_top
#align box_integral.box.measure_Icc_lt_top BoxIntegral.Box.measure_Icc_lt_top
theorem measure_coe_lt_top (μ : Measure (ι → ℝ)) [IsLocallyFiniteMeasure μ] : μ I < ∞ :=
(measure_mono <| coe_subset_Icc).trans_lt (I.measure_Icc_lt_top μ)
#align box_integral.box.measure_coe_lt_top BoxIntegral.Box.measure_coe_lt_top
variable [Fintype ι]
| Mathlib/Analysis/BoxIntegral/Partition/Measure.lean | 74 | 76 | theorem coe_ae_eq_Icc : (I : Set (ι → ℝ)) =ᵐ[volume] Box.Icc I := by
rw [coe_eq_pi] |
rw [coe_eq_pi]
exact Measure.univ_pi_Ioc_ae_eq_Icc
| true |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.Order.Invertible
import Mathlib.Algebra.Order.Module.OrderedSMul
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.LinearAlgebra.AffineSpace.Slope
import Mathlib.LinearAlgebra.AffineSpace.Midpoint
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.ordered from "leanprover-community/mathlib"@"78261225eb5cedc61c5c74ecb44e5b385d13b733"
open AffineMap
variable {k E PE : Type*}
section OrderedRing
variable [OrderedRing k] [OrderedAddCommGroup E] [Module k E] [OrderedSMul k E]
variable {a a' b b' : E} {r r' : k}
theorem lineMap_mono_left (ha : a ≤ a') (hr : r ≤ 1) : lineMap a b r ≤ lineMap a' b r := by
simp only [lineMap_apply_module]
exact add_le_add_right (smul_le_smul_of_nonneg_left ha (sub_nonneg.2 hr)) _
#align line_map_mono_left lineMap_mono_left
| Mathlib/LinearAlgebra/AffineSpace/Ordered.lean | 57 | 59 | theorem lineMap_strict_mono_left (ha : a < a') (hr : r < 1) : lineMap a b r < lineMap a' b r := by
simp only [lineMap_apply_module] |
simp only [lineMap_apply_module]
exact add_lt_add_right (smul_lt_smul_of_pos_left ha (sub_pos.2 hr)) _
| true |
import Mathlib.Algebra.Category.GroupCat.Abelian
import Mathlib.CategoryTheory.Limits.Shapes.Images
#align_import algebra.category.Group.images from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open CategoryTheory
open CategoryTheory.Limits
universe u
namespace AddCommGroupCat
set_option linter.uppercaseLean3 false
-- Note that because `injective_of_mono` is currently only proved in `Type 0`,
-- we restrict to the lowest universe here for now.
variable {G H : AddCommGroupCat.{0}} (f : G ⟶ H)
attribute [local ext] Subtype.ext_val
section
-- implementation details of `IsImage` for `AddCommGroupCat`; use the API, not these
def image : AddCommGroupCat :=
AddCommGroupCat.of (AddMonoidHom.range f)
#align AddCommGroup.image AddCommGroupCat.image
def image.ι : image f ⟶ H :=
f.range.subtype
#align AddCommGroup.image.ι AddCommGroupCat.image.ι
instance : Mono (image.ι f) :=
ConcreteCategory.mono_of_injective (image.ι f) Subtype.val_injective
def factorThruImage : G ⟶ image f :=
f.rangeRestrict
#align AddCommGroup.factor_thru_image AddCommGroupCat.factorThruImage
theorem image.fac : factorThruImage f ≫ image.ι f = f := by
ext
rfl
#align AddCommGroup.image.fac AddCommGroupCat.image.fac
attribute [local simp] image.fac
variable {f}
noncomputable def image.lift (F' : MonoFactorisation f) : image f ⟶ F'.I where
toFun := (fun x => F'.e (Classical.indefiniteDescription _ x.2).1 : image f → F'.I)
map_zero' := by
haveI := F'.m_mono
apply injective_of_mono F'.m
change (F'.e ≫ F'.m) _ = _
rw [F'.fac, AddMonoidHom.map_zero]
exact (Classical.indefiniteDescription (fun y => f y = 0) _).2
map_add' := by
intro x y
haveI := F'.m_mono
apply injective_of_mono F'.m
rw [AddMonoidHom.map_add]
change (F'.e ≫ F'.m) _ = (F'.e ≫ F'.m) _ + (F'.e ≫ F'.m) _
rw [F'.fac]
rw [(Classical.indefiniteDescription (fun z => f z = _) _).2]
rw [(Classical.indefiniteDescription (fun z => f z = _) _).2]
rw [(Classical.indefiniteDescription (fun z => f z = _) _).2]
rfl
#align AddCommGroup.image.lift AddCommGroupCat.image.lift
| Mathlib/Algebra/Category/GroupCat/Images.lean | 87 | 91 | theorem image.lift_fac (F' : MonoFactorisation f) : image.lift F' ≫ F'.m = image.ι f := by
ext x |
ext x
change (F'.e ≫ F'.m) _ = _
rw [F'.fac, (Classical.indefiniteDescription _ x.2).2]
rfl
| true |
import Mathlib.LinearAlgebra.Ray
import Mathlib.Analysis.NormedSpace.Real
#align_import analysis.normed_space.ray from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open Real
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*}
[NormedAddCommGroup F] [NormedSpace ℝ F]
variable {x y : F}
| Mathlib/Analysis/NormedSpace/Ray.lean | 59 | 65 | theorem norm_injOn_ray_left (hx : x ≠ 0) : { y | SameRay ℝ x y }.InjOn norm := by
rintro y hy z hz h |
rintro y hy z hz h
rcases hy.exists_nonneg_left hx with ⟨r, hr, rfl⟩
rcases hz.exists_nonneg_left hx with ⟨s, hs, rfl⟩
rw [norm_smul, norm_smul, mul_left_inj' (norm_ne_zero_iff.2 hx), norm_of_nonneg hr,
norm_of_nonneg hs] at h
rw [h]
| true |
import Mathlib.Order.Interval.Set.OrdConnectedComponent
import Mathlib.Topology.Order.Basic
#align_import topology.algebra.order.t5 from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Filter Set Function OrderDual Topology Interval
variable {X : Type*} [LinearOrder X] [TopologicalSpace X] [OrderTopology X] {a b c : X}
{s t : Set X}
namespace Set
@[simp]
| Mathlib/Topology/Order/T5.lean | 27 | 30 | theorem ordConnectedComponent_mem_nhds : ordConnectedComponent s a ∈ 𝓝 a ↔ s ∈ 𝓝 a := by
refine ⟨fun h => mem_of_superset h ordConnectedComponent_subset, fun h => ?_⟩ |
refine ⟨fun h => mem_of_superset h ordConnectedComponent_subset, fun h => ?_⟩
rcases exists_Icc_mem_subset_of_mem_nhds h with ⟨b, c, ha, ha', hs⟩
exact mem_of_superset ha' (subset_ordConnectedComponent ha hs)
| true |
import Mathlib.LinearAlgebra.QuadraticForm.TensorProduct
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
import Mathlib.LinearAlgebra.TensorProduct.Opposite
import Mathlib.RingTheory.TensorProduct.Basic
variable {R A V : Type*}
variable [CommRing R] [CommRing A] [AddCommGroup V]
variable [Algebra R A] [Module R V] [Module A V] [IsScalarTower R A V]
variable [Invertible (2 : R)]
open scoped TensorProduct
namespace CliffordAlgebra
variable (A)
-- `noncomputable` is a performance workaround for mathlib4#7103
noncomputable def ofBaseChangeAux (Q : QuadraticForm R V) :
CliffordAlgebra Q →ₐ[R] CliffordAlgebra (Q.baseChange A) :=
CliffordAlgebra.lift Q <| by
refine ⟨(ι (Q.baseChange A)).restrictScalars R ∘ₗ TensorProduct.mk R A V 1, fun v => ?_⟩
refine (CliffordAlgebra.ι_sq_scalar (Q.baseChange A) (1 ⊗ₜ v)).trans ?_
rw [QuadraticForm.baseChange_tmul, one_mul, ← Algebra.algebraMap_eq_smul_one,
← IsScalarTower.algebraMap_apply]
@[simp] theorem ofBaseChangeAux_ι (Q : QuadraticForm R V) (v : V) :
ofBaseChangeAux A Q (ι Q v) = ι (Q.baseChange A) (1 ⊗ₜ v) :=
CliffordAlgebra.lift_ι_apply _ _ v
-- `noncomputable` is a performance workaround for mathlib4#7103
noncomputable def ofBaseChange (Q : QuadraticForm R V) :
A ⊗[R] CliffordAlgebra Q →ₐ[A] CliffordAlgebra (Q.baseChange A) :=
Algebra.TensorProduct.lift (Algebra.ofId _ _) (ofBaseChangeAux A Q)
fun _a _x => Algebra.commutes _ _
@[simp] theorem ofBaseChange_tmul_ι (Q : QuadraticForm R V) (z : A) (v : V) :
ofBaseChange A Q (z ⊗ₜ ι Q v) = ι (Q.baseChange A) (z ⊗ₜ v) := by
show algebraMap _ _ z * ofBaseChangeAux A Q (ι Q v) = ι (Q.baseChange A) (z ⊗ₜ[R] v)
rw [ofBaseChangeAux_ι, ← Algebra.smul_def, ← map_smul, TensorProduct.smul_tmul', smul_eq_mul,
mul_one]
@[simp] theorem ofBaseChange_tmul_one (Q : QuadraticForm R V) (z : A) :
ofBaseChange A Q (z ⊗ₜ 1) = algebraMap _ _ z := by
show algebraMap _ _ z * ofBaseChangeAux A Q 1 = _
rw [map_one, mul_one]
-- `noncomputable` is a performance workaround for mathlib4#7103
noncomputable def toBaseChange (Q : QuadraticForm R V) :
CliffordAlgebra (Q.baseChange A) →ₐ[A] A ⊗[R] CliffordAlgebra Q :=
CliffordAlgebra.lift _ <| by
refine ⟨TensorProduct.AlgebraTensorModule.map (LinearMap.id : A →ₗ[A] A) (ι Q), ?_⟩
letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm
letI : Invertible (2 : A ⊗[R] CliffordAlgebra Q) :=
(Invertible.map (algebraMap R _) 2).copy 2 (map_ofNat _ _).symm
suffices hpure_tensor : ∀ v w, (1 * 1) ⊗ₜ[R] (ι Q v * ι Q w) + (1 * 1) ⊗ₜ[R] (ι Q w * ι Q v) =
QuadraticForm.polarBilin (Q.baseChange A) (1 ⊗ₜ[R] v) (1 ⊗ₜ[R] w) ⊗ₜ[R] 1 by
-- the crux is that by converting to a statement about linear maps instead of quadratic forms,
-- we then have access to all the partially-applied `ext` lemmas.
rw [CliffordAlgebra.forall_mul_self_eq_iff (isUnit_of_invertible _)]
refine TensorProduct.AlgebraTensorModule.curry_injective ?_
ext v w
exact hpure_tensor v w
intros v w
rw [← TensorProduct.tmul_add, CliffordAlgebra.ι_mul_ι_add_swap,
QuadraticForm.polarBilin_baseChange, LinearMap.BilinForm.baseChange_tmul, one_mul,
TensorProduct.smul_tmul, Algebra.algebraMap_eq_smul_one, QuadraticForm.polarBilin_apply_apply]
@[simp] theorem toBaseChange_ι (Q : QuadraticForm R V) (z : A) (v : V) :
toBaseChange A Q (ι (Q.baseChange A) (z ⊗ₜ v)) = z ⊗ₜ ι Q v :=
CliffordAlgebra.lift_ι_apply _ _ _
theorem toBaseChange_comp_involute (Q : QuadraticForm R V) :
(toBaseChange A Q).comp (involute : CliffordAlgebra (Q.baseChange A) →ₐ[A] _) =
(Algebra.TensorProduct.map (AlgHom.id _ _) involute).comp (toBaseChange A Q) := by
ext v
show toBaseChange A Q (involute (ι (Q.baseChange A) (1 ⊗ₜ[R] v)))
= (Algebra.TensorProduct.map (AlgHom.id _ _) involute :
A ⊗[R] CliffordAlgebra Q →ₐ[A] _)
(toBaseChange A Q (ι (Q.baseChange A) (1 ⊗ₜ[R] v)))
rw [toBaseChange_ι, involute_ι, map_neg (toBaseChange A Q), toBaseChange_ι,
Algebra.TensorProduct.map_tmul, AlgHom.id_apply, involute_ι, TensorProduct.tmul_neg]
theorem toBaseChange_involute (Q : QuadraticForm R V) (x : CliffordAlgebra (Q.baseChange A)) :
toBaseChange A Q (involute x) =
TensorProduct.map LinearMap.id (involute.toLinearMap) (toBaseChange A Q x) :=
DFunLike.congr_fun (toBaseChange_comp_involute A Q) x
open MulOpposite
| Mathlib/LinearAlgebra/CliffordAlgebra/BaseChange.lean | 124 | 137 | theorem toBaseChange_comp_reverseOp (Q : QuadraticForm R V) :
(toBaseChange A Q).op.comp reverseOp =
((Algebra.TensorProduct.opAlgEquiv R A A (CliffordAlgebra Q)).toAlgHom.comp <|
(Algebra.TensorProduct.map
(AlgEquiv.toOpposite A A).toAlgHom (reverseOp (Q := Q))).comp
(toBaseChange A Q)) := by
ext v |
ext v
show op (toBaseChange A Q (reverse (ι (Q.baseChange A) (1 ⊗ₜ[R] v)))) =
Algebra.TensorProduct.opAlgEquiv R A A (CliffordAlgebra Q)
(Algebra.TensorProduct.map (AlgEquiv.toOpposite A A).toAlgHom (reverseOp (Q := Q))
(toBaseChange A Q (ι (Q.baseChange A) (1 ⊗ₜ[R] v))))
rw [toBaseChange_ι, reverse_ι, toBaseChange_ι, Algebra.TensorProduct.map_tmul,
Algebra.TensorProduct.opAlgEquiv_tmul, reverseOp_ι]
rfl
| true |
import Mathlib.SetTheory.Game.Basic
import Mathlib.Tactic.NthRewrite
#align_import set_theory.game.impartial from "leanprover-community/mathlib"@"2e0975f6a25dd3fbfb9e41556a77f075f6269748"
universe u
namespace SetTheory
open scoped PGame
namespace PGame
def ImpartialAux : PGame → Prop
| G => (G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j)
termination_by G => G -- Porting note: Added `termination_by`
#align pgame.impartial_aux SetTheory.PGame.ImpartialAux
theorem impartialAux_def {G : PGame} :
G.ImpartialAux ↔
(G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j) := by
rw [ImpartialAux]
#align pgame.impartial_aux_def SetTheory.PGame.impartialAux_def
class Impartial (G : PGame) : Prop where
out : ImpartialAux G
#align pgame.impartial SetTheory.PGame.Impartial
theorem impartial_iff_aux {G : PGame} : G.Impartial ↔ G.ImpartialAux :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
#align pgame.impartial_iff_aux SetTheory.PGame.impartial_iff_aux
theorem impartial_def {G : PGame} :
G.Impartial ↔ (G ≈ -G) ∧ (∀ i, Impartial (G.moveLeft i)) ∧ ∀ j, Impartial (G.moveRight j) := by
simpa only [impartial_iff_aux] using impartialAux_def
#align pgame.impartial_def SetTheory.PGame.impartial_def
namespace Impartial
instance impartial_zero : Impartial 0 := by rw [impartial_def]; dsimp; simp
#align pgame.impartial.impartial_zero SetTheory.PGame.Impartial.impartial_zero
instance impartial_star : Impartial star := by
rw [impartial_def]; simpa using Impartial.impartial_zero
#align pgame.impartial.impartial_star SetTheory.PGame.Impartial.impartial_star
theorem neg_equiv_self (G : PGame) [h : G.Impartial] : G ≈ -G :=
(impartial_def.1 h).1
#align pgame.impartial.neg_equiv_self SetTheory.PGame.Impartial.neg_equiv_self
-- Porting note: Changed `-⟦G⟧` to `-(⟦G⟧ : Quotient setoid)`
@[simp]
theorem mk'_neg_equiv_self (G : PGame) [G.Impartial] : -(⟦G⟧ : Quotient setoid) = ⟦G⟧ :=
Quot.sound (Equiv.symm (neg_equiv_self G))
#align pgame.impartial.mk_neg_equiv_self SetTheory.PGame.Impartial.mk'_neg_equiv_self
instance moveLeft_impartial {G : PGame} [h : G.Impartial] (i : G.LeftMoves) :
(G.moveLeft i).Impartial :=
(impartial_def.1 h).2.1 i
#align pgame.impartial.move_left_impartial SetTheory.PGame.Impartial.moveLeft_impartial
instance moveRight_impartial {G : PGame} [h : G.Impartial] (j : G.RightMoves) :
(G.moveRight j).Impartial :=
(impartial_def.1 h).2.2 j
#align pgame.impartial.move_right_impartial SetTheory.PGame.Impartial.moveRight_impartial
theorem impartial_congr : ∀ {G H : PGame} (_ : G ≡r H) [G.Impartial], H.Impartial
| G, H => fun e => by
intro h
exact impartial_def.2
⟨Equiv.trans e.symm.equiv (Equiv.trans (neg_equiv_self G) (neg_equiv_neg_iff.2 e.equiv)),
fun i => impartial_congr (e.moveLeftSymm i), fun j => impartial_congr (e.moveRightSymm j)⟩
termination_by G H => (G, H)
#align pgame.impartial.impartial_congr SetTheory.PGame.Impartial.impartial_congr
instance impartial_add : ∀ (G H : PGame) [G.Impartial] [H.Impartial], (G + H).Impartial
| G, H, _, _ => by
rw [impartial_def]
refine ⟨Equiv.trans (add_congr (neg_equiv_self G) (neg_equiv_self _))
(Equiv.symm (negAddRelabelling _ _).equiv), fun k => ?_, fun k => ?_⟩
· apply leftMoves_add_cases k
all_goals
intro i; simp only [add_moveLeft_inl, add_moveLeft_inr]
apply impartial_add
· apply rightMoves_add_cases k
all_goals
intro i; simp only [add_moveRight_inl, add_moveRight_inr]
apply impartial_add
termination_by G H => (G, H)
#align pgame.impartial.impartial_add SetTheory.PGame.Impartial.impartial_add
instance impartial_neg : ∀ (G : PGame) [G.Impartial], (-G).Impartial
| G, _ => by
rw [impartial_def]
refine ⟨?_, fun i => ?_, fun i => ?_⟩
· rw [neg_neg]
exact Equiv.symm (neg_equiv_self G)
· rw [moveLeft_neg']
apply impartial_neg
· rw [moveRight_neg']
apply impartial_neg
termination_by G => G
#align pgame.impartial.impartial_neg SetTheory.PGame.Impartial.impartial_neg
variable (G : PGame) [Impartial G]
theorem nonpos : ¬0 < G := fun h => by
have h' := neg_lt_neg_iff.2 h
rw [neg_zero, lt_congr_left (Equiv.symm (neg_equiv_self G))] at h'
exact (h.trans h').false
#align pgame.impartial.nonpos SetTheory.PGame.Impartial.nonpos
theorem nonneg : ¬G < 0 := fun h => by
have h' := neg_lt_neg_iff.2 h
rw [neg_zero, lt_congr_right (Equiv.symm (neg_equiv_self G))] at h'
exact (h.trans h').false
#align pgame.impartial.nonneg SetTheory.PGame.Impartial.nonneg
| Mathlib/SetTheory/Game/Impartial.lean | 137 | 142 | theorem equiv_or_fuzzy_zero : (G ≈ 0) ∨ G ‖ 0 := by
rcases lt_or_equiv_or_gt_or_fuzzy G 0 with (h | h | h | h) |
rcases lt_or_equiv_or_gt_or_fuzzy G 0 with (h | h | h | h)
· exact ((nonneg G) h).elim
· exact Or.inl h
· exact ((nonpos G) h).elim
· exact Or.inr h
| true |
import Mathlib.Data.Int.Bitwise
import Mathlib.Data.Int.Order.Lemmas
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.Basic
#align_import data.int.lemmas from "leanprover-community/mathlib"@"09597669f02422ed388036273d8848119699c22f"
open Nat
namespace Int
theorem le_natCast_sub (m n : ℕ) : (m - n : ℤ) ≤ ↑(m - n : ℕ) := by
by_cases h : m ≥ n
· exact le_of_eq (Int.ofNat_sub h).symm
· simp [le_of_not_ge h, ofNat_le]
#align int.le_coe_nat_sub Int.le_natCast_sub
-- Porting note (#10618): simp can prove this @[simp]
theorem succ_natCast_pos (n : ℕ) : 0 < (n : ℤ) + 1 :=
lt_add_one_iff.mpr (by simp)
#align int.succ_coe_nat_pos Int.succ_natCast_pos
variable {a b : ℤ} {n : ℕ}
theorem natAbs_eq_iff_sq_eq {a b : ℤ} : a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2 := by
rw [sq, sq]
exact natAbs_eq_iff_mul_self_eq
#align int.nat_abs_eq_iff_sq_eq Int.natAbs_eq_iff_sq_eq
theorem natAbs_lt_iff_sq_lt {a b : ℤ} : a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2 := by
rw [sq, sq]
exact natAbs_lt_iff_mul_self_lt
#align int.nat_abs_lt_iff_sq_lt Int.natAbs_lt_iff_sq_lt
theorem natAbs_le_iff_sq_le {a b : ℤ} : a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2 := by
rw [sq, sq]
exact natAbs_le_iff_mul_self_le
#align int.nat_abs_le_iff_sq_le Int.natAbs_le_iff_sq_le
theorem natAbs_inj_of_nonneg_of_nonneg {a b : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b) :
natAbs a = natAbs b ↔ a = b := by rw [← sq_eq_sq ha hb, ← natAbs_eq_iff_sq_eq]
#align int.nat_abs_inj_of_nonneg_of_nonneg Int.natAbs_inj_of_nonneg_of_nonneg
theorem natAbs_inj_of_nonpos_of_nonpos {a b : ℤ} (ha : a ≤ 0) (hb : b ≤ 0) :
natAbs a = natAbs b ↔ a = b := by
simpa only [Int.natAbs_neg, neg_inj] using
natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) (neg_nonneg_of_nonpos hb)
#align int.nat_abs_inj_of_nonpos_of_nonpos Int.natAbs_inj_of_nonpos_of_nonpos
theorem natAbs_inj_of_nonneg_of_nonpos {a b : ℤ} (ha : 0 ≤ a) (hb : b ≤ 0) :
natAbs a = natAbs b ↔ a = -b := by
simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg ha (neg_nonneg_of_nonpos hb)
#align int.nat_abs_inj_of_nonneg_of_nonpos Int.natAbs_inj_of_nonneg_of_nonpos
theorem natAbs_inj_of_nonpos_of_nonneg {a b : ℤ} (ha : a ≤ 0) (hb : 0 ≤ b) :
natAbs a = natAbs b ↔ -a = b := by
simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) hb
#align int.nat_abs_inj_of_nonpos_of_nonneg Int.natAbs_inj_of_nonpos_of_nonneg
| Mathlib/Data/Int/Lemmas.lean | 82 | 86 | theorem natAbs_coe_sub_coe_le_of_le {a b n : ℕ} (a_le_n : a ≤ n) (b_le_n : b ≤ n) :
natAbs (a - b : ℤ) ≤ n := by
rw [← Nat.cast_le (α := ℤ), natCast_natAbs] |
rw [← Nat.cast_le (α := ℤ), natCast_natAbs]
exact abs_sub_le_of_nonneg_of_le (ofNat_nonneg a) (ofNat_le.mpr a_le_n)
(ofNat_nonneg b) (ofNat_le.mpr b_le_n)
| true |
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Order.Filter.Pi
#align_import order.filter.cofinite from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
open Set Function
variable {ι α β : Type*} {l : Filter α}
namespace Filter
def cofinite : Filter α :=
comk Set.Finite finite_empty (fun _t ht _s hsub ↦ ht.subset hsub) fun _ h _ ↦ h.union
#align filter.cofinite Filter.cofinite
@[simp]
theorem mem_cofinite {s : Set α} : s ∈ @cofinite α ↔ sᶜ.Finite :=
Iff.rfl
#align filter.mem_cofinite Filter.mem_cofinite
@[simp]
theorem eventually_cofinite {p : α → Prop} : (∀ᶠ x in cofinite, p x) ↔ { x | ¬p x }.Finite :=
Iff.rfl
#align filter.eventually_cofinite Filter.eventually_cofinite
theorem hasBasis_cofinite : HasBasis cofinite (fun s : Set α => s.Finite) compl :=
⟨fun s =>
⟨fun h => ⟨sᶜ, h, (compl_compl s).subset⟩, fun ⟨_t, htf, hts⟩ =>
htf.subset <| compl_subset_comm.2 hts⟩⟩
#align filter.has_basis_cofinite Filter.hasBasis_cofinite
instance cofinite_neBot [Infinite α] : NeBot (@cofinite α) :=
hasBasis_cofinite.neBot_iff.2 fun hs => hs.infinite_compl.nonempty
#align filter.cofinite_ne_bot Filter.cofinite_neBot
@[simp]
theorem cofinite_eq_bot_iff : @cofinite α = ⊥ ↔ Finite α := by
simp [← empty_mem_iff_bot, finite_univ_iff]
@[simp]
theorem cofinite_eq_bot [Finite α] : @cofinite α = ⊥ := cofinite_eq_bot_iff.2 ‹_›
theorem frequently_cofinite_iff_infinite {p : α → Prop} :
(∃ᶠ x in cofinite, p x) ↔ Set.Infinite { x | p x } := by
simp only [Filter.Frequently, eventually_cofinite, not_not, Set.Infinite]
#align filter.frequently_cofinite_iff_infinite Filter.frequently_cofinite_iff_infinite
lemma frequently_cofinite_mem_iff_infinite {s : Set α} : (∃ᶠ x in cofinite, x ∈ s) ↔ s.Infinite :=
frequently_cofinite_iff_infinite
alias ⟨_, _root_.Set.Infinite.frequently_cofinite⟩ := frequently_cofinite_mem_iff_infinite
@[simp]
lemma cofinite_inf_principal_neBot_iff {s : Set α} : (cofinite ⊓ 𝓟 s).NeBot ↔ s.Infinite :=
frequently_mem_iff_neBot.symm.trans frequently_cofinite_mem_iff_infinite
alias ⟨_, _root_.Set.Infinite.cofinite_inf_principal_neBot⟩ := cofinite_inf_principal_neBot_iff
theorem _root_.Set.Finite.compl_mem_cofinite {s : Set α} (hs : s.Finite) : sᶜ ∈ @cofinite α :=
mem_cofinite.2 <| (compl_compl s).symm ▸ hs
#align set.finite.compl_mem_cofinite Set.Finite.compl_mem_cofinite
theorem _root_.Set.Finite.eventually_cofinite_nmem {s : Set α} (hs : s.Finite) :
∀ᶠ x in cofinite, x ∉ s :=
hs.compl_mem_cofinite
#align set.finite.eventually_cofinite_nmem Set.Finite.eventually_cofinite_nmem
theorem _root_.Finset.eventually_cofinite_nmem (s : Finset α) : ∀ᶠ x in cofinite, x ∉ s :=
s.finite_toSet.eventually_cofinite_nmem
#align finset.eventually_cofinite_nmem Finset.eventually_cofinite_nmem
theorem _root_.Set.infinite_iff_frequently_cofinite {s : Set α} :
Set.Infinite s ↔ ∃ᶠ x in cofinite, x ∈ s :=
frequently_cofinite_iff_infinite.symm
#align set.infinite_iff_frequently_cofinite Set.infinite_iff_frequently_cofinite
theorem eventually_cofinite_ne (x : α) : ∀ᶠ a in cofinite, a ≠ x :=
(Set.finite_singleton x).eventually_cofinite_nmem
#align filter.eventually_cofinite_ne Filter.eventually_cofinite_ne
| Mathlib/Order/Filter/Cofinite.lean | 101 | 104 | theorem le_cofinite_iff_compl_singleton_mem : l ≤ cofinite ↔ ∀ x, {x}ᶜ ∈ l := by
refine ⟨fun h x => h (finite_singleton x).compl_mem_cofinite, fun h s (hs : sᶜ.Finite) => ?_⟩ |
refine ⟨fun h x => h (finite_singleton x).compl_mem_cofinite, fun h s (hs : sᶜ.Finite) => ?_⟩
rw [← compl_compl s, ← biUnion_of_singleton sᶜ, compl_iUnion₂, Filter.biInter_mem hs]
exact fun x _ => h x
| true |
import Mathlib.Data.Finset.Lattice
import Mathlib.Order.Hom.Basic
import Mathlib.Data.Set.Finite
import Mathlib.Order.ConditionallyCompleteLattice.Basic
#align_import order.partial_sups from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
variable {α : Type*}
section SemilatticeSup
variable [SemilatticeSup α]
def partialSups (f : ℕ → α) : ℕ →o α :=
⟨@Nat.rec (fun _ => α) (f 0) fun (n : ℕ) (a : α) => a ⊔ f (n + 1),
monotone_nat_of_le_succ fun _ => le_sup_left⟩
#align partial_sups partialSups
@[simp]
theorem partialSups_zero (f : ℕ → α) : partialSups f 0 = f 0 :=
rfl
#align partial_sups_zero partialSups_zero
@[simp]
theorem partialSups_succ (f : ℕ → α) (n : ℕ) :
partialSups f (n + 1) = partialSups f n ⊔ f (n + 1) :=
rfl
#align partial_sups_succ partialSups_succ
lemma partialSups_iff_forall {f : ℕ → α} (p : α → Prop)
(hp : ∀ {a b}, p (a ⊔ b) ↔ p a ∧ p b) : ∀ {n : ℕ}, p (partialSups f n) ↔ ∀ k ≤ n, p (f k)
| 0 => by simp
| (n + 1) => by simp [hp, partialSups_iff_forall, ← Nat.lt_succ_iff, ← Nat.forall_lt_succ]
@[simp]
lemma partialSups_le_iff {f : ℕ → α} {n : ℕ} {a : α} : partialSups f n ≤ a ↔ ∀ k ≤ n, f k ≤ a :=
partialSups_iff_forall (· ≤ a) sup_le_iff
theorem le_partialSups_of_le (f : ℕ → α) {m n : ℕ} (h : m ≤ n) : f m ≤ partialSups f n :=
partialSups_le_iff.1 le_rfl m h
#align le_partial_sups_of_le le_partialSups_of_le
theorem le_partialSups (f : ℕ → α) : f ≤ partialSups f := fun _n => le_partialSups_of_le f le_rfl
#align le_partial_sups le_partialSups
theorem partialSups_le (f : ℕ → α) (n : ℕ) (a : α) (w : ∀ m, m ≤ n → f m ≤ a) :
partialSups f n ≤ a :=
partialSups_le_iff.2 w
#align partial_sups_le partialSups_le
@[simp]
lemma upperBounds_range_partialSups (f : ℕ → α) :
upperBounds (Set.range (partialSups f)) = upperBounds (Set.range f) := by
ext a
simp only [mem_upperBounds, Set.forall_mem_range, partialSups_le_iff]
exact ⟨fun h _ ↦ h _ _ le_rfl, fun h _ _ _ ↦ h _⟩
@[simp]
theorem bddAbove_range_partialSups {f : ℕ → α} :
BddAbove (Set.range (partialSups f)) ↔ BddAbove (Set.range f) :=
.of_eq <| congr_arg Set.Nonempty <| upperBounds_range_partialSups f
#align bdd_above_range_partial_sups bddAbove_range_partialSups
| Mathlib/Order/PartialSups.lean | 97 | 101 | theorem Monotone.partialSups_eq {f : ℕ → α} (hf : Monotone f) : (partialSups f : ℕ → α) = f := by
ext n |
ext n
induction' n with n ih
· rfl
· rw [partialSups_succ, ih, sup_eq_right.2 (hf (Nat.le_succ _))]
| true |
import Mathlib.Algebra.MonoidAlgebra.Degree
import Mathlib.Algebra.Polynomial.Coeff
import Mathlib.Algebra.Polynomial.Monomial
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Nat.WithBot
import Mathlib.Data.Nat.Cast.WithTop
import Mathlib.Data.Nat.SuccPred
#align_import data.polynomial.degree.definitions from "leanprover-community/mathlib"@"808ea4ebfabeb599f21ec4ae87d6dc969597887f"
-- Porting note: `Mathlib.Data.Nat.Cast.WithTop` should be imported for `Nat.cast_withBot`.
set_option linter.uppercaseLean3 false
noncomputable section
open Finsupp Finset
open Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b c d : R} {n m : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
def degree (p : R[X]) : WithBot ℕ :=
p.support.max
#align polynomial.degree Polynomial.degree
theorem supDegree_eq_degree (p : R[X]) : p.toFinsupp.supDegree WithBot.some = p.degree :=
max_eq_sup_coe
theorem degree_lt_wf : WellFounded fun p q : R[X] => degree p < degree q :=
InvImage.wf degree wellFounded_lt
#align polynomial.degree_lt_wf Polynomial.degree_lt_wf
instance : WellFoundedRelation R[X] :=
⟨_, degree_lt_wf⟩
def natDegree (p : R[X]) : ℕ :=
(degree p).unbot' 0
#align polynomial.nat_degree Polynomial.natDegree
def leadingCoeff (p : R[X]) : R :=
coeff p (natDegree p)
#align polynomial.leading_coeff Polynomial.leadingCoeff
def Monic (p : R[X]) :=
leadingCoeff p = (1 : R)
#align polynomial.monic Polynomial.Monic
@[nontriviality]
theorem monic_of_subsingleton [Subsingleton R] (p : R[X]) : Monic p :=
Subsingleton.elim _ _
#align polynomial.monic_of_subsingleton Polynomial.monic_of_subsingleton
theorem Monic.def : Monic p ↔ leadingCoeff p = 1 :=
Iff.rfl
#align polynomial.monic.def Polynomial.Monic.def
instance Monic.decidable [DecidableEq R] : Decidable (Monic p) := by unfold Monic; infer_instance
#align polynomial.monic.decidable Polynomial.Monic.decidable
@[simp]
theorem Monic.leadingCoeff {p : R[X]} (hp : p.Monic) : leadingCoeff p = 1 :=
hp
#align polynomial.monic.leading_coeff Polynomial.Monic.leadingCoeff
theorem Monic.coeff_natDegree {p : R[X]} (hp : p.Monic) : p.coeff p.natDegree = 1 :=
hp
#align polynomial.monic.coeff_nat_degree Polynomial.Monic.coeff_natDegree
@[simp]
theorem degree_zero : degree (0 : R[X]) = ⊥ :=
rfl
#align polynomial.degree_zero Polynomial.degree_zero
@[simp]
theorem natDegree_zero : natDegree (0 : R[X]) = 0 :=
rfl
#align polynomial.nat_degree_zero Polynomial.natDegree_zero
@[simp]
theorem coeff_natDegree : coeff p (natDegree p) = leadingCoeff p :=
rfl
#align polynomial.coeff_nat_degree Polynomial.coeff_natDegree
@[simp]
theorem degree_eq_bot : degree p = ⊥ ↔ p = 0 :=
⟨fun h => support_eq_empty.1 (Finset.max_eq_bot.1 h), fun h => h.symm ▸ rfl⟩
#align polynomial.degree_eq_bot Polynomial.degree_eq_bot
@[nontriviality]
theorem degree_of_subsingleton [Subsingleton R] : degree p = ⊥ := by
rw [Subsingleton.elim p 0, degree_zero]
#align polynomial.degree_of_subsingleton Polynomial.degree_of_subsingleton
@[nontriviality]
theorem natDegree_of_subsingleton [Subsingleton R] : natDegree p = 0 := by
rw [Subsingleton.elim p 0, natDegree_zero]
#align polynomial.nat_degree_of_subsingleton Polynomial.natDegree_of_subsingleton
theorem degree_eq_natDegree (hp : p ≠ 0) : degree p = (natDegree p : WithBot ℕ) := by
let ⟨n, hn⟩ := not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt degree_eq_bot.1 hp))
have hn : degree p = some n := Classical.not_not.1 hn
rw [natDegree, hn]; rfl
#align polynomial.degree_eq_nat_degree Polynomial.degree_eq_natDegree
theorem supDegree_eq_natDegree (p : R[X]) : p.toFinsupp.supDegree id = p.natDegree := by
obtain rfl|h := eq_or_ne p 0
· simp
apply WithBot.coe_injective
rw [← AddMonoidAlgebra.supDegree_withBot_some_comp, Function.comp_id, supDegree_eq_degree,
degree_eq_natDegree h, Nat.cast_withBot]
rwa [support_toFinsupp, nonempty_iff_ne_empty, Ne, support_eq_empty]
| Mathlib/Algebra/Polynomial/Degree/Definitions.lean | 146 | 147 | theorem degree_eq_iff_natDegree_eq {p : R[X]} {n : ℕ} (hp : p ≠ 0) :
p.degree = n ↔ p.natDegree = n := by | rw [degree_eq_natDegree hp]; exact WithBot.coe_eq_coe
| true |
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.GroupTheory.GroupAction.Pi
open Function Set
structure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where
protected toFun : G → H
map_add_const' (x : G) : toFun (x + a) = toFun x + b
@[inherit_doc]
scoped [AddConstMap] notation:25 G " →+c[" a ", " b "] " H => AddConstMap G H a b
class AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]
(a : outParam G) (b : outParam H) extends DFunLike F G fun _ ↦ H where
map_add_const (f : F) (x : G) : f (x + a) = f x + b
namespace AddConstMapClass
attribute [simp] map_add_const
variable {F G H : Type*} {a : G} {b : H}
protected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :
Semiconj f (· + a) (· + b) :=
map_add_const f
@[simp]
theorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]
(f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by
simpa using (AddConstMapClass.semiconj f).iterate_right n x
@[simp]
| Mathlib/Algebra/AddConstMap/Basic.lean | 78 | 79 | theorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]
(f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by | simp [← map_add_nsmul]
| true |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.AddTorsor
#align_import analysis.convex.normed from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
variable {ι : Type*} {E P : Type*}
open Metric Set
open scoped Convex
variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P]
variable {s t : Set E}
theorem convexOn_norm (hs : Convex ℝ s) : ConvexOn ℝ s norm :=
⟨hs, fun x _ y _ a b ha hb _ =>
calc
‖a • x + b • y‖ ≤ ‖a • x‖ + ‖b • y‖ := norm_add_le _ _
_ = a * ‖x‖ + b * ‖y‖ := by
rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]⟩
#align convex_on_norm convexOn_norm
theorem convexOn_univ_norm : ConvexOn ℝ univ (norm : E → ℝ) :=
convexOn_norm convex_univ
#align convex_on_univ_norm convexOn_univ_norm
theorem convexOn_dist (z : E) (hs : Convex ℝ s) : ConvexOn ℝ s fun z' => dist z' z := by
simpa [dist_eq_norm, preimage_preimage] using
(convexOn_norm (hs.translate (-z))).comp_affineMap (AffineMap.id ℝ E - AffineMap.const ℝ E z)
#align convex_on_dist convexOn_dist
theorem convexOn_univ_dist (z : E) : ConvexOn ℝ univ fun z' => dist z' z :=
convexOn_dist z convex_univ
#align convex_on_univ_dist convexOn_univ_dist
theorem convex_ball (a : E) (r : ℝ) : Convex ℝ (Metric.ball a r) := by
simpa only [Metric.ball, sep_univ] using (convexOn_univ_dist a).convex_lt r
#align convex_ball convex_ball
theorem convex_closedBall (a : E) (r : ℝ) : Convex ℝ (Metric.closedBall a r) := by
simpa only [Metric.closedBall, sep_univ] using (convexOn_univ_dist a).convex_le r
#align convex_closed_ball convex_closedBall
theorem Convex.thickening (hs : Convex ℝ s) (δ : ℝ) : Convex ℝ (thickening δ s) := by
rw [← add_ball_zero]
exact hs.add (convex_ball 0 _)
#align convex.thickening Convex.thickening
theorem Convex.cthickening (hs : Convex ℝ s) (δ : ℝ) : Convex ℝ (cthickening δ s) := by
obtain hδ | hδ := le_total 0 δ
· rw [cthickening_eq_iInter_thickening hδ]
exact convex_iInter₂ fun _ _ => hs.thickening _
· rw [cthickening_of_nonpos hδ]
exact hs.closure
#align convex.cthickening Convex.cthickening
theorem convexHull_exists_dist_ge {s : Set E} {x : E} (hx : x ∈ convexHull ℝ s) (y : E) :
∃ x' ∈ s, dist x y ≤ dist x' y :=
(convexOn_dist y (convex_convexHull ℝ _)).exists_ge_of_mem_convexHull hx
#align convex_hull_exists_dist_ge convexHull_exists_dist_ge
| Mathlib/Analysis/Convex/Normed.lean | 92 | 97 | theorem convexHull_exists_dist_ge2 {s t : Set E} {x y : E} (hx : x ∈ convexHull ℝ s)
(hy : y ∈ convexHull ℝ t) : ∃ x' ∈ s, ∃ y' ∈ t, dist x y ≤ dist x' y' := by
rcases convexHull_exists_dist_ge hx y with ⟨x', hx', Hx'⟩ |
rcases convexHull_exists_dist_ge hx y with ⟨x', hx', Hx'⟩
rcases convexHull_exists_dist_ge hy x' with ⟨y', hy', Hy'⟩
use x', hx', y', hy'
exact le_trans Hx' (dist_comm y x' ▸ dist_comm y' x' ▸ Hy')
| true |
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Order.Disjointed
import Mathlib.MeasureTheory.OuterMeasure.Defs
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
section OuterMeasureClass
variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α]
{μ : F} {s t : Set α}
@[simp]
theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ
#align measure_theory.measure_empty MeasureTheory.measure_empty
@[mono, gcongr]
theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t :=
OuterMeasureClass.measure_mono μ h
#align measure_theory.measure_mono MeasureTheory.measure_mono
theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 :=
eq_bot_mono (measure_mono h) ht
#align measure_theory.measure_mono_null MeasureTheory.measure_mono_null
theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t :=
hs.bot_lt.trans_le (measure_mono h)
theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by
refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _
calc
μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed]
_ ≤ ∑' i, μ (disjointed t i) :=
OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _)
_ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset
#align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le
theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by
have := hI.to_subtype
rw [biUnion_eq_iUnion]
apply measure_iUnion_le
#align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le
theorem measure_biUnion_finset_le (I : Finset ι) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ (s i) :=
(measure_biUnion_le μ I.countable_toSet s).trans_eq <| I.tsum_subtype (μ <| s ·)
#align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le
theorem measure_iUnion_fintype_le [Fintype ι] (μ : F) (s : ι → Set α) :
μ (⋃ i, s i) ≤ ∑ i, μ (s i) := by
simpa using measure_biUnion_finset_le Finset.univ s
#align measure_theory.measure_Union_fintype_le MeasureTheory.measure_iUnion_fintype_le
theorem measure_union_le (s t : Set α) : μ (s ∪ t) ≤ μ s + μ t := by
simpa [union_eq_iUnion] using measure_iUnion_fintype_le μ (cond · s t)
#align measure_theory.measure_union_le MeasureTheory.measure_union_le
theorem measure_le_inter_add_diff (μ : F) (s t : Set α) : μ s ≤ μ (s ∩ t) + μ (s \ t) := by
simpa using measure_union_le (s ∩ t) (s \ t)
theorem measure_diff_null (ht : μ t = 0) : μ (s \ t) = μ s :=
(measure_mono diff_subset).antisymm <| calc
μ s ≤ μ (s ∩ t) + μ (s \ t) := measure_le_inter_add_diff _ _ _
_ ≤ μ t + μ (s \ t) := by gcongr; apply inter_subset_right
_ = μ (s \ t) := by simp [ht]
#align measure_theory.measure_diff_null MeasureTheory.measure_diff_null
theorem measure_biUnion_null_iff {I : Set ι} (hI : I.Countable) {s : ι → Set α} :
μ (⋃ i ∈ I, s i) = 0 ↔ ∀ i ∈ I, μ (s i) = 0 := by
refine ⟨fun h i hi ↦ measure_mono_null (subset_biUnion_of_mem hi) h, fun h ↦ ?_⟩
have _ := hI.to_subtype
simpa [h] using measure_iUnion_le (μ := μ) fun x : I ↦ s x
#align measure_theory.measure_bUnion_null_iff MeasureTheory.measure_biUnion_null_iff
theorem measure_sUnion_null_iff {S : Set (Set α)} (hS : S.Countable) :
μ (⋃₀ S) = 0 ↔ ∀ s ∈ S, μ s = 0 := by
rw [sUnion_eq_biUnion, measure_biUnion_null_iff hS]
#align measure_theory.measure_sUnion_null_iff MeasureTheory.measure_sUnion_null_iff
@[simp]
theorem measure_iUnion_null_iff {ι : Sort*} [Countable ι] {s : ι → Set α} :
μ (⋃ i, s i) = 0 ↔ ∀ i, μ (s i) = 0 := by
rw [← sUnion_range, measure_sUnion_null_iff (countable_range s), forall_mem_range]
#align measure_theory.measure_Union_null_iff MeasureTheory.measure_iUnion_null_iff
alias ⟨_, measure_iUnion_null⟩ := measure_iUnion_null_iff
#align measure_theory.measure_Union_null MeasureTheory.measure_iUnion_null
@[simp]
theorem measure_union_null_iff : μ (s ∪ t) = 0 ↔ μ s = 0 ∧ μ t = 0 := by
simp [union_eq_iUnion, and_comm]
#align measure_theory.measure_union_null_iff MeasureTheory.measure_union_null_iff
| Mathlib/MeasureTheory/OuterMeasure/Basic.lean | 129 | 129 | theorem measure_union_null (hs : μ s = 0) (ht : μ t = 0) : μ (s ∪ t) = 0 := by | simp [*]
| true |
import Mathlib.Algebra.BigOperators.Group.Multiset
import Mathlib.Data.PNat.Prime
import Mathlib.Data.Nat.Factors
import Mathlib.Data.Multiset.Sort
#align_import data.pnat.factors from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d"
-- Porting note: `deriving` contained Inhabited, CanonicallyOrderedAddCommMonoid, DistribLattice,
-- SemilatticeSup, OrderBot, Sub, OrderedSub
def PrimeMultiset :=
Multiset Nat.Primes deriving Inhabited, CanonicallyOrderedAddCommMonoid, DistribLattice,
SemilatticeSup, Sub
#align prime_multiset PrimeMultiset
instance : OrderBot PrimeMultiset where
bot_le := by simp only [bot_le, forall_const]
instance : OrderedSub PrimeMultiset where
tsub_le_iff_right _ _ _ := Multiset.sub_le_iff_le_add
namespace PrimeMultiset
-- `@[derive]` doesn't work for `meta` instances
unsafe instance : Repr PrimeMultiset := by delta PrimeMultiset; infer_instance
def ofPrime (p : Nat.Primes) : PrimeMultiset :=
({p} : Multiset Nat.Primes)
#align prime_multiset.of_prime PrimeMultiset.ofPrime
theorem card_ofPrime (p : Nat.Primes) : Multiset.card (ofPrime p) = 1 :=
rfl
#align prime_multiset.card_of_prime PrimeMultiset.card_ofPrime
def toNatMultiset : PrimeMultiset → Multiset ℕ := fun v => v.map Coe.coe
#align prime_multiset.to_nat_multiset PrimeMultiset.toNatMultiset
instance coeNat : Coe PrimeMultiset (Multiset ℕ) :=
⟨toNatMultiset⟩
#align prime_multiset.coe_nat PrimeMultiset.coeNat
def coeNatMonoidHom : PrimeMultiset →+ Multiset ℕ :=
{ Multiset.mapAddMonoidHom Coe.coe with toFun := Coe.coe }
#align prime_multiset.coe_nat_monoid_hom PrimeMultiset.coeNatMonoidHom
@[simp]
theorem coe_coeNatMonoidHom : (coeNatMonoidHom : PrimeMultiset → Multiset ℕ) = Coe.coe :=
rfl
#align prime_multiset.coe_coe_nat_monoid_hom PrimeMultiset.coe_coeNatMonoidHom
theorem coeNat_injective : Function.Injective (Coe.coe : PrimeMultiset → Multiset ℕ) :=
Multiset.map_injective Nat.Primes.coe_nat_injective
#align prime_multiset.coe_nat_injective PrimeMultiset.coeNat_injective
theorem coeNat_ofPrime (p : Nat.Primes) : (ofPrime p : Multiset ℕ) = {(p : ℕ)} :=
rfl
#align prime_multiset.coe_nat_of_prime PrimeMultiset.coeNat_ofPrime
theorem coeNat_prime (v : PrimeMultiset) (p : ℕ) (h : p ∈ (v : Multiset ℕ)) : p.Prime := by
rcases Multiset.mem_map.mp h with ⟨⟨_, hp'⟩, ⟨_, h_eq⟩⟩
exact h_eq ▸ hp'
#align prime_multiset.coe_nat_prime PrimeMultiset.coeNat_prime
def toPNatMultiset : PrimeMultiset → Multiset ℕ+ := fun v => v.map Coe.coe
#align prime_multiset.to_pnat_multiset PrimeMultiset.toPNatMultiset
instance coePNat : Coe PrimeMultiset (Multiset ℕ+) :=
⟨toPNatMultiset⟩
#align prime_multiset.coe_pnat PrimeMultiset.coePNat
def coePNatMonoidHom : PrimeMultiset →+ Multiset ℕ+ :=
{ Multiset.mapAddMonoidHom Coe.coe with toFun := Coe.coe }
#align prime_multiset.coe_pnat_monoid_hom PrimeMultiset.coePNatMonoidHom
@[simp]
theorem coe_coePNatMonoidHom : (coePNatMonoidHom : PrimeMultiset → Multiset ℕ+) = Coe.coe :=
rfl
#align prime_multiset.coe_coe_pnat_monoid_hom PrimeMultiset.coe_coePNatMonoidHom
theorem coePNat_injective : Function.Injective (Coe.coe : PrimeMultiset → Multiset ℕ+) :=
Multiset.map_injective Nat.Primes.coe_pnat_injective
#align prime_multiset.coe_pnat_injective PrimeMultiset.coePNat_injective
theorem coePNat_ofPrime (p : Nat.Primes) : (ofPrime p : Multiset ℕ+) = {(p : ℕ+)} :=
rfl
#align prime_multiset.coe_pnat_of_prime PrimeMultiset.coePNat_ofPrime
| Mathlib/Data/PNat/Factors.lean | 121 | 123 | theorem coePNat_prime (v : PrimeMultiset) (p : ℕ+) (h : p ∈ (v : Multiset ℕ+)) : p.Prime := by
rcases Multiset.mem_map.mp h with ⟨⟨_, hp'⟩, ⟨_, h_eq⟩⟩ |
rcases Multiset.mem_map.mp h with ⟨⟨_, hp'⟩, ⟨_, h_eq⟩⟩
exact h_eq ▸ hp'
| true |
import Mathlib.RepresentationTheory.FdRep
import Mathlib.LinearAlgebra.Trace
import Mathlib.RepresentationTheory.Invariants
#align_import representation_theory.character from "leanprover-community/mathlib"@"55b3f8206b8596db8bb1804d8a92814a0b6670c9"
noncomputable section
universe u
open CategoryTheory LinearMap CategoryTheory.MonoidalCategory Representation FiniteDimensional
variable {k : Type u} [Field k]
namespace FdRep
set_option linter.uppercaseLean3 false -- `FdRep`
section Monoid
variable {G : Type u} [Monoid G]
def character (V : FdRep k G) (g : G) :=
LinearMap.trace k V (V.ρ g)
#align fdRep.character FdRep.character
| Mathlib/RepresentationTheory/Character.lean | 54 | 55 | theorem char_mul_comm (V : FdRep k G) (g : G) (h : G) :
V.character (h * g) = V.character (g * h) := by | simp only [trace_mul_comm, character, map_mul]
| true |
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]
| Mathlib/Data/Finsupp/Basic.lean | 78 | 80 | theorem mem_graph_iff {c : α × M} {f : α →₀ M} : c ∈ f.graph ↔ f c.1 = c.2 ∧ c.2 ≠ 0 := by
cases c |
cases c
exact mk_mem_graph_iff
| true |
import Mathlib.Algebra.MvPolynomial.Rename
#align_import data.mv_polynomial.comap from "leanprover-community/mathlib"@"aba31c938d3243cc671be7091b28a1e0814647ee"
namespace MvPolynomial
variable {σ : Type*} {τ : Type*} {υ : Type*} {R : Type*} [CommSemiring R]
noncomputable def comap (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) : (τ → R) → σ → R :=
fun x i => aeval x (f (X i))
#align mv_polynomial.comap MvPolynomial.comap
@[simp]
theorem comap_apply (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) (x : τ → R) (i : σ) :
comap f x i = aeval x (f (X i)) :=
rfl
#align mv_polynomial.comap_apply MvPolynomial.comap_apply
@[simp]
theorem comap_id_apply (x : σ → R) : comap (AlgHom.id R (MvPolynomial σ R)) x = x := by
funext i
simp only [comap, AlgHom.id_apply, id, aeval_X]
#align mv_polynomial.comap_id_apply MvPolynomial.comap_id_apply
variable (σ R)
theorem comap_id : comap (AlgHom.id R (MvPolynomial σ R)) = id := by
funext x
exact comap_id_apply x
#align mv_polynomial.comap_id MvPolynomial.comap_id
variable {σ R}
theorem comap_comp_apply (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R)
(g : MvPolynomial τ R →ₐ[R] MvPolynomial υ R) (x : υ → R) :
comap (g.comp f) x = comap f (comap g x) := by
funext i
trans aeval x (aeval (fun i => g (X i)) (f (X i)))
· apply eval₂Hom_congr rfl rfl
rw [AlgHom.comp_apply]
suffices g = aeval fun i => g (X i) by rw [← this]
exact aeval_unique g
· simp only [comap, aeval_eq_eval₂Hom, map_eval₂Hom, AlgHom.comp_apply]
refine eval₂Hom_congr ?_ rfl rfl
ext r
apply aeval_C
#align mv_polynomial.comap_comp_apply MvPolynomial.comap_comp_apply
theorem comap_comp (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R)
(g : MvPolynomial τ R →ₐ[R] MvPolynomial υ R) : comap (g.comp f) = comap f ∘ comap g := by
funext x
exact comap_comp_apply _ _ _
#align mv_polynomial.comap_comp MvPolynomial.comap_comp
| Mathlib/Algebra/MvPolynomial/Comap.lean | 83 | 87 | theorem comap_eq_id_of_eq_id (f : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) (hf : ∀ φ, f φ = φ)
(x : σ → R) : comap f x = x := by
convert comap_id_apply x |
convert comap_id_apply x
ext1 φ
simp [hf, AlgHom.id_apply]
| true |
import Mathlib.MeasureTheory.Covering.DensityTheorem
#align_import measure_theory.covering.liminf_limsup from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655"
open Set Filter Metric MeasureTheory TopologicalSpace
open scoped NNReal ENNReal Topology
variable {α : Type*} [MetricSpace α] [SecondCountableTopology α] [MeasurableSpace α] [BorelSpace α]
variable (μ : Measure α) [IsLocallyFiniteMeasure μ] [IsUnifLocDoublingMeasure μ]
| Mathlib/MeasureTheory/Covering/LiminfLimsup.lean | 41 | 150 | theorem blimsup_cthickening_ae_le_of_eventually_mul_le_aux (p : ℕ → Prop) {s : ℕ → Set α}
(hs : ∀ i, IsClosed (s i)) {r₁ r₂ : ℕ → ℝ} (hr : Tendsto r₁ atTop (𝓝[>] 0)) (hrp : 0 ≤ r₁)
{M : ℝ} (hM : 0 < M) (hM' : M < 1) (hMr : ∀ᶠ i in atTop, M * r₁ i ≤ r₂ i) :
(blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ≤ᵐ[μ]
(blimsup (fun i => cthickening (r₂ i) (s i)) atTop p : Set α) := by
/- Sketch of proof: |
/- Sketch of proof:
Assume that `p` is identically true for simplicity. Let `Y₁ i = cthickening (r₁ i) (s i)`, define
`Y₂` similarly except using `r₂`, and let `(Z i) = ⋃_{j ≥ i} (Y₂ j)`. Our goal is equivalent to
showing that `μ ((limsup Y₁) \ (Z i)) = 0` for all `i`.
Assume for contradiction that `μ ((limsup Y₁) \ (Z i)) ≠ 0` for some `i` and let
`W = (limsup Y₁) \ (Z i)`. Apply Lebesgue's density theorem to obtain a point `d` in `W` of
density `1`. Since `d ∈ limsup Y₁`, there is a subsequence of `j ↦ Y₁ j`, indexed by
`f 0 < f 1 < ...`, such that `d ∈ Y₁ (f j)` for all `j`. For each `j`, we may thus choose
`w j ∈ s (f j)` such that `d ∈ B j`, where `B j = closedBall (w j) (r₁ (f j))`. Note that
since `d` has density one, `μ (W ∩ (B j)) / μ (B j) → 1`.
We obtain our contradiction by showing that there exists `η < 1` such that
`μ (W ∩ (B j)) / μ (B j) ≤ η` for sufficiently large `j`. In fact we claim that `η = 1 - C⁻¹`
is such a value where `C` is the scaling constant of `M⁻¹` for the uniformly locally doubling
measure `μ`.
To prove the claim, let `b j = closedBall (w j) (M * r₁ (f j))` and for given `j` consider the
sets `b j` and `W ∩ (B j)`. These are both subsets of `B j` and are disjoint for large enough `j`
since `M * r₁ j ≤ r₂ j` and thus `b j ⊆ Z i ⊆ Wᶜ`. We thus have:
`μ (b j) + μ (W ∩ (B j)) ≤ μ (B j)`. Combining this with `μ (B j) ≤ C * μ (b j)` we obtain
the required inequality. -/
set Y₁ : ℕ → Set α := fun i => cthickening (r₁ i) (s i)
set Y₂ : ℕ → Set α := fun i => cthickening (r₂ i) (s i)
let Z : ℕ → Set α := fun i => ⋃ (j) (_ : p j ∧ i ≤ j), Y₂ j
suffices ∀ i, μ (atTop.blimsup Y₁ p \ Z i) = 0 by
rwa [ae_le_set, @blimsup_eq_iInf_biSup_of_nat _ _ _ Y₂, iInf_eq_iInter, diff_iInter,
measure_iUnion_null_iff]
intros i
set W := atTop.blimsup Y₁ p \ Z i
by_contra contra
obtain ⟨d, hd, hd'⟩ : ∃ d, d ∈ W ∧ ∀ {ι : Type _} {l : Filter ι} (w : ι → α) (δ : ι → ℝ),
Tendsto δ l (𝓝[>] 0) → (∀ᶠ j in l, d ∈ closedBall (w j) (2 * δ j)) →
Tendsto (fun j => μ (W ∩ closedBall (w j) (δ j)) / μ (closedBall (w j) (δ j))) l (𝓝 1) :=
Measure.exists_mem_of_measure_ne_zero_of_ae contra
(IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div μ W 2)
replace hd : d ∈ blimsup Y₁ atTop p := ((mem_diff _).mp hd).1
obtain ⟨f : ℕ → ℕ, hf⟩ := exists_forall_mem_of_hasBasis_mem_blimsup' atTop_basis hd
simp only [forall_and] at hf
obtain ⟨hf₀ : ∀ j, d ∈ cthickening (r₁ (f j)) (s (f j)), hf₁, hf₂ : ∀ j, j ≤ f j⟩ := hf
have hf₃ : Tendsto f atTop atTop :=
tendsto_atTop_atTop.mpr fun j => ⟨f j, fun i hi => (hf₂ j).trans (hi.trans <| hf₂ i)⟩
replace hr : Tendsto (r₁ ∘ f) atTop (𝓝[>] 0) := hr.comp hf₃
replace hMr : ∀ᶠ j in atTop, M * r₁ (f j) ≤ r₂ (f j) := hf₃.eventually hMr
replace hf₀ : ∀ j, ∃ w ∈ s (f j), d ∈ closedBall w (2 * r₁ (f j)) := by
intro j
specialize hrp (f j)
rw [Pi.zero_apply] at hrp
rcases eq_or_lt_of_le hrp with (hr0 | hrp')
· specialize hf₀ j
rw [← hr0, cthickening_zero, (hs (f j)).closure_eq] at hf₀
exact ⟨d, hf₀, by simp [← hr0]⟩
· simpa using mem_iUnion₂.mp (cthickening_subset_iUnion_closedBall_of_lt (s (f j))
(by positivity) (lt_two_mul_self hrp') (hf₀ j))
choose w hw hw' using hf₀
let C := IsUnifLocDoublingMeasure.scalingConstantOf μ M⁻¹
have hC : 0 < C :=
lt_of_lt_of_le zero_lt_one (IsUnifLocDoublingMeasure.one_le_scalingConstantOf μ M⁻¹)
suffices ∃ η < (1 : ℝ≥0),
∀ᶠ j in atTop, μ (W ∩ closedBall (w j) (r₁ (f j))) / μ (closedBall (w j) (r₁ (f j))) ≤ η by
obtain ⟨η, hη, hη'⟩ := this
replace hη' : 1 ≤ η := by
simpa only [ENNReal.one_le_coe_iff] using
le_of_tendsto (hd' w (fun j => r₁ (f j)) hr <| eventually_of_forall hw') hη'
exact (lt_self_iff_false _).mp (lt_of_lt_of_le hη hη')
refine ⟨1 - C⁻¹, tsub_lt_self zero_lt_one (inv_pos.mpr hC), ?_⟩
replace hC : C ≠ 0 := ne_of_gt hC
let b : ℕ → Set α := fun j => closedBall (w j) (M * r₁ (f j))
let B : ℕ → Set α := fun j => closedBall (w j) (r₁ (f j))
have h₁ : ∀ j, b j ⊆ B j := fun j =>
closedBall_subset_closedBall (mul_le_of_le_one_left (hrp (f j)) hM'.le)
have h₂ : ∀ j, W ∩ B j ⊆ B j := fun j => inter_subset_right
have h₃ : ∀ᶠ j in atTop, Disjoint (b j) (W ∩ B j) := by
apply hMr.mp
rw [eventually_atTop]
refine
⟨i, fun j hj hj' => Disjoint.inf_right (B j) <| Disjoint.inf_right' (blimsup Y₁ atTop p) ?_⟩
change Disjoint (b j) (Z i)ᶜ
rw [disjoint_compl_right_iff_subset]
refine (closedBall_subset_cthickening (hw j) (M * r₁ (f j))).trans
((cthickening_mono hj' _).trans fun a ha => ?_)
simp only [Z, mem_iUnion, exists_prop]
exact ⟨f j, ⟨hf₁ j, hj.le.trans (hf₂ j)⟩, ha⟩
have h₄ : ∀ᶠ j in atTop, μ (B j) ≤ C * μ (b j) :=
(hr.eventually (IsUnifLocDoublingMeasure.eventually_measure_le_scaling_constant_mul'
μ M hM)).mono fun j hj => hj (w j)
refine (h₃.and h₄).mono fun j hj₀ => ?_
change μ (W ∩ B j) / μ (B j) ≤ ↑(1 - C⁻¹)
rcases eq_or_ne (μ (B j)) ∞ with (hB | hB); · simp [hB]
apply ENNReal.div_le_of_le_mul
rw [ENNReal.coe_sub, ENNReal.coe_one, ENNReal.sub_mul fun _ _ => hB, one_mul]
replace hB : ↑C⁻¹ * μ (B j) ≠ ∞ := by
refine ENNReal.mul_ne_top ?_ hB
rwa [ENNReal.coe_inv hC, Ne, ENNReal.inv_eq_top, ENNReal.coe_eq_zero]
obtain ⟨hj₁ : Disjoint (b j) (W ∩ B j), hj₂ : μ (B j) ≤ C * μ (b j)⟩ := hj₀
replace hj₂ : ↑C⁻¹ * μ (B j) ≤ μ (b j) := by
rw [ENNReal.coe_inv hC, ← ENNReal.div_eq_inv_mul]
exact ENNReal.div_le_of_le_mul' hj₂
have hj₃ : ↑C⁻¹ * μ (B j) + μ (W ∩ B j) ≤ μ (B j) := by
refine le_trans (add_le_add_right hj₂ _) ?_
rw [← measure_union' hj₁ measurableSet_closedBall]
exact measure_mono (union_subset (h₁ j) (h₂ j))
replace hj₃ := tsub_le_tsub_right hj₃ (↑C⁻¹ * μ (B j))
rwa [ENNReal.add_sub_cancel_left hB] at hj₃
| true |
import Mathlib.Order.Antichain
import Mathlib.Order.UpperLower.Basic
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.RelIso.Set
#align_import order.minimal from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
open Function Set
variable {α : Type*} (r r₁ r₂ : α → α → Prop) (s t : Set α) (a b : α)
def maximals : Set α :=
{ a ∈ s | ∀ ⦃b⦄, b ∈ s → r a b → r b a }
#align maximals maximals
def minimals : Set α :=
{ a ∈ s | ∀ ⦃b⦄, b ∈ s → r b a → r a b }
#align minimals minimals
theorem maximals_subset : maximals r s ⊆ s :=
sep_subset _ _
#align maximals_subset maximals_subset
theorem minimals_subset : minimals r s ⊆ s :=
sep_subset _ _
#align minimals_subset minimals_subset
@[simp]
theorem maximals_empty : maximals r ∅ = ∅ :=
sep_empty _
#align maximals_empty maximals_empty
@[simp]
theorem minimals_empty : minimals r ∅ = ∅ :=
sep_empty _
#align minimals_empty minimals_empty
@[simp]
theorem maximals_singleton : maximals r {a} = {a} :=
(maximals_subset _ _).antisymm <|
singleton_subset_iff.2 <|
⟨rfl, by
rintro b (rfl : b = a)
exact id⟩
#align maximals_singleton maximals_singleton
@[simp]
theorem minimals_singleton : minimals r {a} = {a} :=
maximals_singleton _ _
#align minimals_singleton minimals_singleton
theorem maximals_swap : maximals (swap r) s = minimals r s :=
rfl
#align maximals_swap maximals_swap
theorem minimals_swap : minimals (swap r) s = maximals r s :=
rfl
#align minimals_swap minimals_swap
section IsAntisymm
variable {r s t a b} [IsAntisymm α r]
theorem eq_of_mem_maximals (ha : a ∈ maximals r s) (hb : b ∈ s) (h : r a b) : a = b :=
antisymm h <| ha.2 hb h
#align eq_of_mem_maximals eq_of_mem_maximals
theorem eq_of_mem_minimals (ha : a ∈ minimals r s) (hb : b ∈ s) (h : r b a) : a = b :=
antisymm (ha.2 hb h) h
#align eq_of_mem_minimals eq_of_mem_minimals
set_option autoImplicit true
theorem mem_maximals_iff : x ∈ maximals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, y ∈ s → r x y → x = y := by
simp only [maximals, Set.mem_sep_iff, and_congr_right_iff]
refine fun _ ↦ ⟨fun h y hys hxy ↦ antisymm hxy (h hys hxy), fun h y hys hxy ↦ ?_⟩
convert hxy <;> rw [h hys hxy]
theorem mem_maximals_setOf_iff : x ∈ maximals r (setOf P) ↔ P x ∧ ∀ ⦃y⦄, P y → r x y → x = y :=
mem_maximals_iff
theorem mem_minimals_iff : x ∈ minimals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, y ∈ s → r y x → x = y :=
@mem_maximals_iff _ _ _ (IsAntisymm.swap r) _
theorem mem_minimals_setOf_iff : x ∈ minimals r (setOf P) ↔ P x ∧ ∀ ⦃y⦄, P y → r y x → x = y :=
mem_minimals_iff
| Mathlib/Order/Minimal.lean | 113 | 115 | theorem mem_minimals_iff_forall_lt_not_mem' (rlt : α → α → Prop) [IsNonstrictStrictOrder α r rlt] :
x ∈ minimals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, rlt y x → y ∉ s := by |
simp [minimals, right_iff_left_not_left_of r rlt, not_imp_not, imp.swap (a := _ ∈ _)]
| true |
import Mathlib.Algebra.BigOperators.Pi
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Data.Finsupp.Fin
import Mathlib.Data.Finsupp.Indicator
#align_import algebra.big_operators.finsupp from "leanprover-community/mathlib"@"842328d9df7e96fd90fc424e115679c15fb23a71"
noncomputable section
open Finset Function
variable {α ι γ A B C : Type*} [AddCommMonoid A] [AddCommMonoid B] [AddCommMonoid C]
variable {t : ι → A → C} (h0 : ∀ i, t i 0 = 0) (h1 : ∀ i x y, t i (x + y) = t i x + t i y)
variable {s : Finset α} {f : α → ι →₀ A} (i : ι)
variable (g : ι →₀ A) (k : ι → A → γ → B) (x : γ)
variable {β M M' N P G H R S : Type*}
namespace Finsupp
section SumProd
@[to_additive "`sum f g` is the sum of `g a (f a)` over the support of `f`. "]
def prod [Zero M] [CommMonoid N] (f : α →₀ M) (g : α → M → N) : N :=
∏ a ∈ f.support, g a (f a)
#align finsupp.prod Finsupp.prod
#align finsupp.sum Finsupp.sum
variable [Zero M] [Zero M'] [CommMonoid N]
@[to_additive]
theorem prod_of_support_subset (f : α →₀ M) {s : Finset α} (hs : f.support ⊆ s) (g : α → M → N)
(h : ∀ i ∈ s, g i 0 = 1) : f.prod g = ∏ x ∈ s, g x (f x) := by
refine Finset.prod_subset hs fun x hxs hx => h x hxs ▸ (congr_arg (g x) ?_)
exact not_mem_support_iff.1 hx
#align finsupp.prod_of_support_subset Finsupp.prod_of_support_subset
#align finsupp.sum_of_support_subset Finsupp.sum_of_support_subset
@[to_additive]
theorem prod_fintype [Fintype α] (f : α →₀ M) (g : α → M → N) (h : ∀ i, g i 0 = 1) :
f.prod g = ∏ i, g i (f i) :=
f.prod_of_support_subset (subset_univ _) g fun x _ => h x
#align finsupp.prod_fintype Finsupp.prod_fintype
#align finsupp.sum_fintype Finsupp.sum_fintype
@[to_additive (attr := simp)]
theorem prod_single_index {a : α} {b : M} {h : α → M → N} (h_zero : h a 0 = 1) :
(single a b).prod h = h a b :=
calc
(single a b).prod h = ∏ x ∈ {a}, h x (single a b x) :=
prod_of_support_subset _ support_single_subset h fun x hx =>
(mem_singleton.1 hx).symm ▸ h_zero
_ = h a b := by simp
#align finsupp.prod_single_index Finsupp.prod_single_index
#align finsupp.sum_single_index Finsupp.sum_single_index
@[to_additive]
theorem prod_mapRange_index {f : M → M'} {hf : f 0 = 0} {g : α →₀ M} {h : α → M' → N}
(h0 : ∀ a, h a 0 = 1) : (mapRange f hf g).prod h = g.prod fun a b => h a (f b) :=
Finset.prod_subset support_mapRange fun _ _ H => by rw [not_mem_support_iff.1 H, h0]
#align finsupp.prod_map_range_index Finsupp.prod_mapRange_index
#align finsupp.sum_map_range_index Finsupp.sum_mapRange_index
@[to_additive (attr := simp)]
theorem prod_zero_index {h : α → M → N} : (0 : α →₀ M).prod h = 1 :=
rfl
#align finsupp.prod_zero_index Finsupp.prod_zero_index
#align finsupp.sum_zero_index Finsupp.sum_zero_index
@[to_additive]
theorem prod_comm (f : α →₀ M) (g : β →₀ M') (h : α → M → β → M' → N) :
(f.prod fun x v => g.prod fun x' v' => h x v x' v') =
g.prod fun x' v' => f.prod fun x v => h x v x' v' :=
Finset.prod_comm
#align finsupp.prod_comm Finsupp.prod_comm
#align finsupp.sum_comm Finsupp.sum_comm
@[to_additive (attr := simp)]
theorem prod_ite_eq [DecidableEq α] (f : α →₀ M) (a : α) (b : α → M → N) :
(f.prod fun x v => ite (a = x) (b x v) 1) = ite (a ∈ f.support) (b a (f a)) 1 := by
dsimp [Finsupp.prod]
rw [f.support.prod_ite_eq]
#align finsupp.prod_ite_eq Finsupp.prod_ite_eq
#align finsupp.sum_ite_eq Finsupp.sum_ite_eq
-- @[simp]
theorem sum_ite_self_eq [DecidableEq α] {N : Type*} [AddCommMonoid N] (f : α →₀ N) (a : α) :
(f.sum fun x v => ite (a = x) v 0) = f a := by
classical
convert f.sum_ite_eq a fun _ => id
simp [ite_eq_right_iff.2 Eq.symm]
#align finsupp.sum_ite_self_eq Finsupp.sum_ite_self_eq
-- Porting note: Added this thm to replace the simp in the previous one. Need to add [DecidableEq N]
@[simp]
| Mathlib/Algebra/BigOperators/Finsupp.lean | 124 | 127 | theorem sum_ite_self_eq_aux [DecidableEq α] {N : Type*} [AddCommMonoid N] (f : α →₀ N) (a : α) :
(if a ∈ f.support then f a else 0) = f a := by
simp only [mem_support_iff, ne_eq, ite_eq_left_iff, not_not] |
simp only [mem_support_iff, ne_eq, ite_eq_left_iff, not_not]
exact fun h ↦ h.symm
| true |
import Mathlib.Analysis.Complex.UpperHalfPlane.Basic
import Mathlib.LinearAlgebra.GeneralLinearGroup
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
import Mathlib.Topology.Instances.Matrix
import Mathlib.Topology.Algebra.Module.FiniteDimension
#align_import number_theory.modular from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Complex hiding abs_two
open Matrix hiding mul_smul
open Matrix.SpecialLinearGroup UpperHalfPlane ModularGroup
noncomputable section
local notation "SL(" n ", " R ")" => SpecialLinearGroup (Fin n) R
local macro "↑ₘ" t:term:80 : term => `(term| ($t : Matrix (Fin 2) (Fin 2) ℤ))
open scoped UpperHalfPlane ComplexConjugate
namespace ModularGroup
variable {g : SL(2, ℤ)} (z : ℍ)
section BottomRow
| Mathlib/NumberTheory/Modular.lean | 85 | 89 | theorem bottom_row_coprime {R : Type*} [CommRing R] (g : SL(2, R)) :
IsCoprime ((↑g : Matrix (Fin 2) (Fin 2) R) 1 0) ((↑g : Matrix (Fin 2) (Fin 2) R) 1 1) := by
use -(↑g : Matrix (Fin 2) (Fin 2) R) 0 1, (↑g : Matrix (Fin 2) (Fin 2) R) 0 0 |
use -(↑g : Matrix (Fin 2) (Fin 2) R) 0 1, (↑g : Matrix (Fin 2) (Fin 2) R) 0 0
rw [add_comm, neg_mul, ← sub_eq_add_neg, ← det_fin_two]
exact g.det_coe
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.