Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | num_lines int64 1 150 | complexity_score float64 2.72 139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000B | diff_level int64 0 2 | file_diff_level float64 0 2 | theorem_same_file int64 1 32 | rank_file int64 0 2.51k |
|---|---|---|---|---|---|---|---|---|---|---|---|
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Fintype.Card
#align_import algebra.order.field.pi from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
variable {α ι : Type*} [LinearOrderedSemifield α]
| Mathlib/Algebra/Order/Field/Pi.lean | 21 | 31 | theorem Pi.exists_forall_pos_add_lt [ExistsAddOfLE α] [Finite ι] {x y : ι → α}
(h : ∀ i, x i < y i) : ∃ ε, 0 < ε ∧ ∀ i, x i + ε < y i := by |
cases nonempty_fintype ι
cases isEmpty_or_nonempty ι
· exact ⟨1, zero_lt_one, isEmptyElim⟩
choose ε hε hxε using fun i => exists_pos_add_of_lt' (h i)
obtain rfl : x + ε = y := funext hxε
have hε : 0 < Finset.univ.inf' Finset.univ_nonempty ε := (Finset.lt_inf'_iff _).2 fun i _ => hε _
exact
⟨_, half_pos hε, fun i =>
add_lt_add_left ((half_lt_self hε).trans_le <| Finset.inf'_le _ <| Finset.mem_univ _) _⟩
| 9 | 8,103.083928 | 2 | 2 | 1 | 2,287 |
import Mathlib.Analysis.InnerProductSpace.Orientation
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
#align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
variable {ι E F : Type*}
variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F]
[MeasurableSpace F] [BorelSpace F]
section
variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)]
| Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean | 34 | 43 | theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n))
(b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by |
have e : ι ≃ Fin n := by
refine Fintype.equivFinOfCardEq ?_
rw [← _i.out, finrank_eq_card_basis b.toBasis]
have A : ⇑b = b.reindex e ∘ e := by
ext x
simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply]
rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped,
o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one]
| 8 | 2,980.957987 | 2 | 1.857143 | 7 | 1,924 |
import Mathlib.GroupTheory.Abelianization
import Mathlib.GroupTheory.Exponent
import Mathlib.GroupTheory.Transfer
#align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6"
open scoped Pointwise
namespace Subgroup
open MemRightTransversals
variable {G : Type*} [Group G] {H : Subgroup G} {R S : Set G}
theorem closure_mul_image_mul_eq_top
(hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure S = ⊤) :
(closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹)) * R = ⊤ := by
let f : G → R := fun g => toFun hR g
let U : Set G := (R * S).image fun g => g * (f g : G)⁻¹
change (closure U : Set G) * R = ⊤
refine top_le_iff.mp fun g _ => ?_
refine closure_induction_right ?_ ?_ ?_ (eq_top_iff.mp hS (mem_top g))
· exact ⟨1, (closure U).one_mem, 1, hR1, one_mul 1⟩
· rintro - - s hs ⟨u, hu, r, hr, rfl⟩
rw [show u * r * s = u * (r * s * (f (r * s) : G)⁻¹) * f (r * s) by group]
refine Set.mul_mem_mul ((closure U).mul_mem hu ?_) (f (r * s)).coe_prop
exact subset_closure ⟨r * s, Set.mul_mem_mul hr hs, rfl⟩
· rintro - - s hs ⟨u, hu, r, hr, rfl⟩
rw [show u * r * s⁻¹ = u * (f (r * s⁻¹) * s * r⁻¹)⁻¹ * f (r * s⁻¹) by group]
refine Set.mul_mem_mul ((closure U).mul_mem hu ((closure U).inv_mem ?_)) (f (r * s⁻¹)).2
refine subset_closure ⟨f (r * s⁻¹) * s, Set.mul_mem_mul (f (r * s⁻¹)).2 hs, ?_⟩
rw [mul_right_inj, inv_inj, ← Subtype.coe_mk r hr, ← Subtype.ext_iff, Subtype.coe_mk]
apply (mem_rightTransversals_iff_existsUnique_mul_inv_mem.mp hR (f (r * s⁻¹) * s)).unique
(mul_inv_toFun_mem hR (f (r * s⁻¹) * s))
rw [mul_assoc, ← inv_inv s, ← mul_inv_rev, inv_inv]
exact toFun_mul_inv_mem hR (r * s⁻¹)
#align subgroup.closure_mul_image_mul_eq_top Subgroup.closure_mul_image_mul_eq_top
theorem closure_mul_image_eq (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R)
(hS : closure S = ⊤) : closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹) = H := by
have hU : closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹) ≤ H := by
rw [closure_le]
rintro - ⟨g, -, rfl⟩
exact mul_inv_toFun_mem hR g
refine le_antisymm hU fun h hh => ?_
obtain ⟨g, hg, r, hr, rfl⟩ :=
show h ∈ _ from eq_top_iff.mp (closure_mul_image_mul_eq_top hR hR1 hS) (mem_top h)
suffices (⟨r, hr⟩ : R) = (⟨1, hR1⟩ : R) by
simpa only [show r = 1 from Subtype.ext_iff.mp this, mul_one]
apply (mem_rightTransversals_iff_existsUnique_mul_inv_mem.mp hR r).unique
· rw [Subtype.coe_mk, mul_inv_self]
exact H.one_mem
· rw [Subtype.coe_mk, inv_one, mul_one]
exact (H.mul_mem_cancel_left (hU hg)).mp hh
#align subgroup.closure_mul_image_eq Subgroup.closure_mul_image_eq
theorem closure_mul_image_eq_top (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R)
(hS : closure S = ⊤) : closure ((R * S).image fun g =>
⟨g * (toFun hR g : G)⁻¹, mul_inv_toFun_mem hR g⟩ : Set H) = ⊤ := by
rw [eq_top_iff, ← map_subtype_le_map_subtype, MonoidHom.map_closure, Set.image_image]
exact (map_subtype_le ⊤).trans (ge_of_eq (closure_mul_image_eq hR hR1 hS))
#align subgroup.closure_mul_image_eq_top Subgroup.closure_mul_image_eq_top
theorem closure_mul_image_eq_top' [DecidableEq G] {R S : Finset G}
(hR : (R : Set G) ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R)
(hS : closure (S : Set G) = ⊤) :
closure (((R * S).image fun g => ⟨_, mul_inv_toFun_mem hR g⟩ : Finset H) : Set H) = ⊤ := by
rw [Finset.coe_image, Finset.coe_mul]
exact closure_mul_image_eq_top hR hR1 hS
#align subgroup.closure_mul_image_eq_top' Subgroup.closure_mul_image_eq_top'
variable (H)
| Mathlib/GroupTheory/Schreier.lean | 105 | 124 | theorem exists_finset_card_le_mul [FiniteIndex H] {S : Finset G} (hS : closure (S : Set G) = ⊤) :
∃ T : Finset H, T.card ≤ H.index * S.card ∧ closure (T : Set H) = ⊤ := by |
letI := H.fintypeQuotientOfFiniteIndex
haveI : DecidableEq G := Classical.decEq G
obtain ⟨R₀, hR, hR1⟩ := H.exists_right_transversal 1
haveI : Fintype R₀ := Fintype.ofEquiv _ (toEquiv hR)
let R : Finset G := Set.toFinset R₀
replace hR : (R : Set G) ∈ rightTransversals (H : Set G) := by rwa [Set.coe_toFinset]
replace hR1 : (1 : G) ∈ R := by rwa [Set.mem_toFinset]
refine ⟨_, ?_, closure_mul_image_eq_top' hR hR1 hS⟩
calc
_ ≤ (R * S).card := Finset.card_image_le
_ ≤ (R ×ˢ S).card := Finset.card_image_le
_ = R.card * S.card := R.card_product S
_ = H.index * S.card := congr_arg (· * S.card) ?_
calc
R.card = Fintype.card R := (Fintype.card_coe R).symm
_ = _ := (Fintype.card_congr (toEquiv hR)).symm
_ = Fintype.card (G ⧸ H) := QuotientGroup.card_quotient_rightRel H
_ = H.index := H.index_eq_card.symm
| 18 | 65,659,969.137331 | 2 | 1.6 | 5 | 1,726 |
import Mathlib.Geometry.Manifold.ChartedSpace
#align_import geometry.manifold.local_invariant_properties from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db"
noncomputable section
open scoped Classical
open Manifold Topology
open Set Filter TopologicalSpace
variable {H M H' M' X : Type*}
variable [TopologicalSpace H] [TopologicalSpace M] [ChartedSpace H M]
variable [TopologicalSpace H'] [TopologicalSpace M'] [ChartedSpace H' M']
variable [TopologicalSpace X]
namespace StructureGroupoid
variable (G : StructureGroupoid H) (G' : StructureGroupoid H')
structure LocalInvariantProp (P : (H → H') → Set H → H → Prop) : Prop where
is_local : ∀ {s x u} {f : H → H'}, IsOpen u → x ∈ u → (P f s x ↔ P f (s ∩ u) x)
right_invariance' : ∀ {s x f} {e : PartialHomeomorph H H},
e ∈ G → x ∈ e.source → P f s x → P (f ∘ e.symm) (e.symm ⁻¹' s) (e x)
congr_of_forall : ∀ {s x} {f g : H → H'}, (∀ y ∈ s, f y = g y) → f x = g x → P f s x → P g s x
left_invariance' : ∀ {s x f} {e' : PartialHomeomorph H' H'},
e' ∈ G' → s ⊆ f ⁻¹' e'.source → f x ∈ e'.source → P f s x → P (e' ∘ f) s x
#align structure_groupoid.local_invariant_prop StructureGroupoid.LocalInvariantProp
variable {G G'} {P : (H → H') → Set H → H → Prop} {s t u : Set H} {x : H}
variable (hG : G.LocalInvariantProp G' P)
section LocalStructomorph
variable (G)
open PartialHomeomorph
def IsLocalStructomorphWithinAt (f : H → H) (s : Set H) (x : H) : Prop :=
x ∈ s → ∃ e : PartialHomeomorph H H, e ∈ G ∧ EqOn f e.toFun (s ∩ e.source) ∧ x ∈ e.source
#align structure_groupoid.is_local_structomorph_within_at StructureGroupoid.IsLocalStructomorphWithinAt
theorem isLocalStructomorphWithinAt_localInvariantProp [ClosedUnderRestriction G] :
LocalInvariantProp G G (IsLocalStructomorphWithinAt G) :=
{ is_local := by
intro s x u f hu hux
constructor
· rintro h hx
rcases h hx.1 with ⟨e, heG, hef, hex⟩
have : s ∩ u ∩ e.source ⊆ s ∩ e.source := by mfld_set_tac
exact ⟨e, heG, hef.mono this, hex⟩
· rintro h hx
rcases h ⟨hx, hux⟩ with ⟨e, heG, hef, hex⟩
refine ⟨e.restr (interior u), ?_, ?_, ?_⟩
· exact closedUnderRestriction' heG isOpen_interior
· have : s ∩ u ∩ e.source = s ∩ (e.source ∩ u) := by mfld_set_tac
simpa only [this, interior_interior, hu.interior_eq, mfld_simps] using hef
· simp only [*, interior_interior, hu.interior_eq, mfld_simps]
right_invariance' := by
intro s x f e' he'G he'x h hx
have hxs : x ∈ s := by simpa only [e'.left_inv he'x, mfld_simps] using hx
rcases h hxs with ⟨e, heG, hef, hex⟩
refine ⟨e'.symm.trans e, G.trans (G.symm he'G) heG, ?_, ?_⟩
· intro y hy
simp only [mfld_simps] at hy
simp only [hef ⟨hy.1, hy.2.2⟩, mfld_simps]
· simp only [hex, he'x, mfld_simps]
congr_of_forall := by
intro s x f g hfgs _ h hx
rcases h hx with ⟨e, heG, hef, hex⟩
refine ⟨e, heG, ?_, hex⟩
intro y hy
rw [← hef hy, hfgs y hy.1]
left_invariance' := by
intro s x f e' he'G _ hfx h hx
rcases h hx with ⟨e, heG, hef, hex⟩
refine ⟨e.trans e', G.trans heG he'G, ?_, ?_⟩
· intro y hy
simp only [mfld_simps] at hy
simp only [hef ⟨hy.1, hy.2.1⟩, mfld_simps]
· simpa only [hex, hef ⟨hx, hex⟩, mfld_simps] using hfx }
#align structure_groupoid.is_local_structomorph_within_at_local_invariant_prop StructureGroupoid.isLocalStructomorphWithinAt_localInvariantProp
| Mathlib/Geometry/Manifold/LocalInvariantProperties.lean | 648 | 666 | theorem _root_.PartialHomeomorph.isLocalStructomorphWithinAt_iff {G : StructureGroupoid H}
[ClosedUnderRestriction G] (f : PartialHomeomorph H H) {s : Set H} {x : H}
(hx : x ∈ f.source ∪ sᶜ) :
G.IsLocalStructomorphWithinAt (⇑f) s x ↔
x ∈ s → ∃ e : PartialHomeomorph H H,
e ∈ G ∧ e.source ⊆ f.source ∧ EqOn f (⇑e) (s ∩ e.source) ∧ x ∈ e.source := by |
constructor
· intro hf h2x
obtain ⟨e, he, hfe, hxe⟩ := hf h2x
refine ⟨e.restr f.source, closedUnderRestriction' he f.open_source, ?_, ?_, hxe, ?_⟩
· simp_rw [PartialHomeomorph.restr_source]
exact inter_subset_right.trans interior_subset
· intro x' hx'
exact hfe ⟨hx'.1, hx'.2.1⟩
· rw [f.open_source.interior_eq]
exact Or.resolve_right hx (not_not.mpr h2x)
· intro hf hx
obtain ⟨e, he, _, hfe, hxe⟩ := hf hx
exact ⟨e, he, hfe, hxe⟩
| 13 | 442,413.392009 | 2 | 1.6 | 5 | 1,739 |
import Mathlib.NumberTheory.ZetaValues
import Mathlib.NumberTheory.LSeries.RiemannZeta
open Complex Real Set
open scoped Nat
namespace HurwitzZeta
variable {k : ℕ} {x : ℝ}
theorem cosZeta_two_mul_nat (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k) / 2 / (2 * k)! *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_cosZeta x (?_ : 1 < re (2 * k))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_cos hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc,
← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul, cpow_natCast, ofReal_pow, ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, natCast_re, Nat.cast_lt]
omega
theorem sinZeta_two_mul_nat_add_one (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
sinZeta x (2 * k + 1) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k + 1) / 2 / (2 * k + 1)! *
((Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_sinZeta x (?_ : 1 < re (2 * k + 1))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_sin hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc]
congr 1
rw [← Nat.cast_ofNat, ← Nat.cast_mul, ← Nat.cast_add_one, cpow_natCast, ofReal_pow,
ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, ← Nat.cast_add_one, natCast_re,
Nat.cast_lt, lt_add_iff_pos_left]
exact mul_pos two_pos (Nat.pos_of_ne_zero hk)
theorem cosZeta_two_mul_nat' (hk : k ≠ 0) (hx : x ∈ Icc (0 : ℝ) 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) / (2 * k) / Gammaℂ (2 * k) *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [cosZeta_two_mul_nat hk hx]
congr 1
have : (2 * k)! = (2 * k) * Complex.Gamma (2 * k) := by
rw [(by { norm_cast; omega } : 2 * (k : ℂ) = ↑(2 * k - 1) + 1), Complex.Gamma_nat_eq_factorial,
← Nat.cast_add_one, ← Nat.cast_mul, ← Nat.factorial_succ, Nat.sub_add_cancel (by omega)]
simp_rw [this, Gammaℂ, cpow_neg, ← div_div, div_inv_eq_mul, div_mul_eq_mul_div, div_div,
mul_right_comm (2 : ℂ) (k : ℂ)]
norm_cast
theorem sinZeta_two_mul_nat_add_one' (hk : k ≠ 0) (hx : x ∈ Icc (0 : ℝ) 1) :
sinZeta x (2 * k + 1) = (-1) ^ (k + 1) / (2 * k + 1) / Gammaℂ (2 * k + 1) *
((Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [sinZeta_two_mul_nat_add_one hk hx]
congr 1
have : (2 * k + 1)! = (2 * k + 1) * Complex.Gamma (2 * k + 1) := by
rw [(by simp : Complex.Gamma (2 * k + 1) = Complex.Gamma (↑(2 * k) + 1)),
Complex.Gamma_nat_eq_factorial, ← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul,
← Nat.cast_add_one, ← Nat.cast_mul, ← Nat.factorial_succ]
simp_rw [this, Gammaℂ, cpow_neg, ← div_div, div_inv_eq_mul, div_mul_eq_mul_div, div_div]
rw [(by simp : 2 * (k : ℂ) + 1 = ↑(2 * k + 1)), cpow_natCast]
ring
| Mathlib/NumberTheory/LSeries/HurwitzZetaValues.lean | 126 | 146 | theorem hurwitzZetaEven_one_sub_two_mul_nat (hk : k ≠ 0) (hx : x ∈ Icc (0 : ℝ) 1) :
hurwitzZetaEven x (1 - 2 * k) =
-1 / (2 * k) * ((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by |
have h1 (n : ℕ) : (2 * k : ℂ) ≠ -n := by
rw [← Int.cast_ofNat, ← Int.cast_natCast, ← Int.cast_mul, ← Int.cast_natCast n, ← Int.cast_neg,
Ne, Int.cast_inj, ← Ne]
refine ne_of_gt ((neg_nonpos_of_nonneg n.cast_nonneg).trans_lt (mul_pos two_pos ?_))
exact Nat.cast_pos.mpr (Nat.pos_of_ne_zero hk)
have h2 : (2 * k : ℂ) ≠ 1 := by norm_cast; simp only [mul_eq_one, OfNat.ofNat_ne_one,
false_and, not_false_eq_true]
have h3 : Gammaℂ (2 * k) ≠ 0 := by
refine mul_ne_zero (mul_ne_zero two_ne_zero ?_) (Gamma_ne_zero h1)
simp only [ne_eq, cpow_eq_zero_iff, mul_eq_zero, OfNat.ofNat_ne_zero, ofReal_eq_zero,
pi_ne_zero, Nat.cast_eq_zero, false_or, false_and, not_false_eq_true]
rw [hurwitzZetaEven_one_sub _ h1 (Or.inr h2), ← Gammaℂ, cosZeta_two_mul_nat' hk hx, ← mul_assoc,
← mul_div_assoc, mul_assoc, mul_div_cancel_left₀ _ h3, ← mul_div_assoc]
congr 2
rw [mul_div_assoc, mul_div_cancel_left₀ _ two_ne_zero, ← ofReal_natCast, ← ofReal_mul,
← ofReal_cos, mul_comm π, ← sub_zero (k * π), cos_nat_mul_pi_sub, Real.cos_zero, mul_one,
ofReal_pow, ofReal_neg, ofReal_one, pow_succ, mul_neg_one, mul_neg, ← mul_pow, neg_one_mul,
neg_neg, one_pow]
| 18 | 65,659,969.137331 | 2 | 2 | 8 | 2,019 |
import Mathlib.MeasureTheory.Group.Action
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Group.Pointwise
#align_import measure_theory.group.fundamental_domain from "leanprover-community/mathlib"@"3b52265189f3fb43aa631edffce5d060fafaf82f"
open scoped ENNReal Pointwise Topology NNReal ENNReal MeasureTheory
open MeasureTheory MeasureTheory.Measure Set Function TopologicalSpace Filter
namespace MeasureTheory
structure IsAddFundamentalDomain (G : Type*) {α : Type*} [Zero G] [VAdd G α] [MeasurableSpace α]
(s : Set α) (μ : Measure α := by volume_tac) : Prop where
protected nullMeasurableSet : NullMeasurableSet s μ
protected ae_covers : ∀ᵐ x ∂μ, ∃ g : G, g +ᵥ x ∈ s
protected aedisjoint : Pairwise <| (AEDisjoint μ on fun g : G => g +ᵥ s)
#align measure_theory.is_add_fundamental_domain MeasureTheory.IsAddFundamentalDomain
@[to_additive IsAddFundamentalDomain]
structure IsFundamentalDomain (G : Type*) {α : Type*} [One G] [SMul G α] [MeasurableSpace α]
(s : Set α) (μ : Measure α := by volume_tac) : Prop where
protected nullMeasurableSet : NullMeasurableSet s μ
protected ae_covers : ∀ᵐ x ∂μ, ∃ g : G, g • x ∈ s
protected aedisjoint : Pairwise <| (AEDisjoint μ on fun g : G => g • s)
#align measure_theory.is_fundamental_domain MeasureTheory.IsFundamentalDomain
variable {G H α β E : Type*}
namespace IsFundamentalDomain
variable [Group G] [Group H] [MulAction G α] [MeasurableSpace α] [MulAction H β] [MeasurableSpace β]
[NormedAddCommGroup E] {s t : Set α} {μ : Measure α}
@[to_additive "If for each `x : α`, exactly one of `g +ᵥ x`, `g : G`, belongs to a measurable set
`s`, then `s` is a fundamental domain for the additive action of `G` on `α`."]
theorem mk' (h_meas : NullMeasurableSet s μ) (h_exists : ∀ x : α, ∃! g : G, g • x ∈ s) :
IsFundamentalDomain G s μ where
nullMeasurableSet := h_meas
ae_covers := eventually_of_forall fun x => (h_exists x).exists
aedisjoint a b hab := Disjoint.aedisjoint <| disjoint_left.2 fun x hxa hxb => by
rw [mem_smul_set_iff_inv_smul_mem] at hxa hxb
exact hab (inv_injective <| (h_exists x).unique hxa hxb)
#align measure_theory.is_fundamental_domain.mk' MeasureTheory.IsFundamentalDomain.mk'
#align measure_theory.is_add_fundamental_domain.mk' MeasureTheory.IsAddFundamentalDomain.mk'
@[to_additive "For `s` to be a fundamental domain, it's enough to check
`MeasureTheory.AEDisjoint (g +ᵥ s) s` for `g ≠ 0`."]
theorem mk'' (h_meas : NullMeasurableSet s μ) (h_ae_covers : ∀ᵐ x ∂μ, ∃ g : G, g • x ∈ s)
(h_ae_disjoint : ∀ g, g ≠ (1 : G) → AEDisjoint μ (g • s) s)
(h_qmp : ∀ g : G, QuasiMeasurePreserving ((g • ·) : α → α) μ μ) :
IsFundamentalDomain G s μ where
nullMeasurableSet := h_meas
ae_covers := h_ae_covers
aedisjoint := pairwise_aedisjoint_of_aedisjoint_forall_ne_one h_ae_disjoint h_qmp
#align measure_theory.is_fundamental_domain.mk'' MeasureTheory.IsFundamentalDomain.mk''
#align measure_theory.is_add_fundamental_domain.mk'' MeasureTheory.IsAddFundamentalDomain.mk''
@[to_additive
"If a measurable space has a finite measure `μ` and a countable additive group `G` acts
quasi-measure-preservingly, then to show that a set `s` is a fundamental domain, it is sufficient
to check that its translates `g +ᵥ s` are (almost) disjoint and that the sum `∑' g, μ (g +ᵥ s)` is
sufficiently large."]
| Mathlib/MeasureTheory/Group/FundamentalDomain.lean | 121 | 137 | theorem mk_of_measure_univ_le [IsFiniteMeasure μ] [Countable G] (h_meas : NullMeasurableSet s μ)
(h_ae_disjoint : ∀ g ≠ (1 : G), AEDisjoint μ (g • s) s)
(h_qmp : ∀ g : G, QuasiMeasurePreserving (g • · : α → α) μ μ)
(h_measure_univ_le : μ (univ : Set α) ≤ ∑' g : G, μ (g • s)) : IsFundamentalDomain G s μ :=
have aedisjoint : Pairwise (AEDisjoint μ on fun g : G => g • s) :=
pairwise_aedisjoint_of_aedisjoint_forall_ne_one h_ae_disjoint h_qmp
{ nullMeasurableSet := h_meas
aedisjoint
ae_covers := by |
replace h_meas : ∀ g : G, NullMeasurableSet (g • s) μ := fun g => by
rw [← inv_inv g, ← preimage_smul]; exact h_meas.preimage (h_qmp g⁻¹)
have h_meas' : NullMeasurableSet {a | ∃ g : G, g • a ∈ s} μ := by
rw [← iUnion_smul_eq_setOf_exists]; exact .iUnion h_meas
rw [ae_iff_measure_eq h_meas', ← iUnion_smul_eq_setOf_exists]
refine le_antisymm (measure_mono <| subset_univ _) ?_
rw [measure_iUnion₀ aedisjoint h_meas]
exact h_measure_univ_le }
| 8 | 2,980.957987 | 2 | 0.5 | 4 | 453 |
import Mathlib.AlgebraicTopology.DoldKan.FunctorN
#align_import algebraic_topology.dold_kan.normalized from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
CategoryTheory.Subobject CategoryTheory.Idempotents DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
universe v
variable {A : Type*} [Category A] [Abelian A] {X : SimplicialObject A}
theorem HigherFacesVanish.inclusionOfMooreComplexMap (n : ℕ) :
HigherFacesVanish (n + 1) ((inclusionOfMooreComplexMap X).f (n + 1)) := fun j _ => by
dsimp [AlgebraicTopology.inclusionOfMooreComplexMap, NormalizedMooreComplex.objX]
rw [← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ j
(by simp only [Finset.mem_univ])), assoc, kernelSubobject_arrow_comp, comp_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.higher_faces_vanish.inclusion_of_Moore_complex_map AlgebraicTopology.DoldKan.HigherFacesVanish.inclusionOfMooreComplexMap
| Mathlib/AlgebraicTopology/DoldKan/Normalized.lean | 52 | 59 | theorem factors_normalizedMooreComplex_PInfty (n : ℕ) :
Subobject.Factors (NormalizedMooreComplex.objX X n) (PInfty.f n) := by |
rcases n with _|n
· apply top_factors
· rw [PInfty_f, NormalizedMooreComplex.objX, finset_inf_factors]
intro i _
apply kernelSubobject_factors
exact (HigherFacesVanish.of_P (n + 1) n) i le_add_self
| 6 | 403.428793 | 2 | 0.8 | 5 | 699 |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.Ring.Regular
import Mathlib.Tactic.Common
#align_import algebra.gcd_monoid.basic from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
variable {α : Type*}
-- Porting note: mathlib3 had a `@[protect_proj]` here, but adding `protected` to all the fields
-- adds unnecessary clutter to later code
class NormalizationMonoid (α : Type*) [CancelCommMonoidWithZero α] where
normUnit : α → αˣ
normUnit_zero : normUnit 0 = 1
normUnit_mul : ∀ {a b}, a ≠ 0 → b ≠ 0 → normUnit (a * b) = normUnit a * normUnit b
normUnit_coe_units : ∀ u : αˣ, normUnit u = u⁻¹
#align normalization_monoid NormalizationMonoid
export NormalizationMonoid (normUnit normUnit_zero normUnit_mul normUnit_coe_units)
attribute [simp] normUnit_coe_units normUnit_zero normUnit_mul
section NormalizationMonoid
variable [CancelCommMonoidWithZero α] [NormalizationMonoid α]
@[simp]
theorem normUnit_one : normUnit (1 : α) = 1 :=
normUnit_coe_units 1
#align norm_unit_one normUnit_one
-- Porting note (#11083): quite slow. Improve performance?
def normalize : α →*₀ α where
toFun x := x * normUnit x
map_zero' := by
simp only [normUnit_zero]
exact mul_one (0:α)
map_one' := by dsimp only; rw [normUnit_one, one_mul]; rfl
map_mul' x y :=
(by_cases fun hx : x = 0 => by dsimp only; rw [hx, zero_mul, zero_mul, zero_mul]) fun hx =>
(by_cases fun hy : y = 0 => by dsimp only; rw [hy, mul_zero, zero_mul, mul_zero]) fun hy => by
simp only [normUnit_mul hx hy, Units.val_mul]; simp only [mul_assoc, mul_left_comm y]
#align normalize normalize
theorem associated_normalize (x : α) : Associated x (normalize x) :=
⟨_, rfl⟩
#align associated_normalize associated_normalize
theorem normalize_associated (x : α) : Associated (normalize x) x :=
(associated_normalize _).symm
#align normalize_associated normalize_associated
theorem associated_normalize_iff {x y : α} : Associated x (normalize y) ↔ Associated x y :=
⟨fun h => h.trans (normalize_associated y), fun h => h.trans (associated_normalize y)⟩
#align associated_normalize_iff associated_normalize_iff
theorem normalize_associated_iff {x y : α} : Associated (normalize x) y ↔ Associated x y :=
⟨fun h => (associated_normalize _).trans h, fun h => (normalize_associated _).trans h⟩
#align normalize_associated_iff normalize_associated_iff
theorem Associates.mk_normalize (x : α) : Associates.mk (normalize x) = Associates.mk x :=
Associates.mk_eq_mk_iff_associated.2 (normalize_associated _)
#align associates.mk_normalize Associates.mk_normalize
@[simp]
theorem normalize_apply (x : α) : normalize x = x * normUnit x :=
rfl
#align normalize_apply normalize_apply
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem normalize_zero : normalize (0 : α) = 0 :=
normalize.map_zero
#align normalize_zero normalize_zero
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem normalize_one : normalize (1 : α) = 1 :=
normalize.map_one
#align normalize_one normalize_one
theorem normalize_coe_units (u : αˣ) : normalize (u : α) = 1 := by simp
#align normalize_coe_units normalize_coe_units
theorem normalize_eq_zero {x : α} : normalize x = 0 ↔ x = 0 :=
⟨fun hx => (associated_zero_iff_eq_zero x).1 <| hx ▸ associated_normalize _, by
rintro rfl; exact normalize_zero⟩
#align normalize_eq_zero normalize_eq_zero
theorem normalize_eq_one {x : α} : normalize x = 1 ↔ IsUnit x :=
⟨fun hx => isUnit_iff_exists_inv.2 ⟨_, hx⟩, fun ⟨u, hu⟩ => hu ▸ normalize_coe_units u⟩
#align normalize_eq_one normalize_eq_one
-- Porting note (#11083): quite slow. Improve performance?
@[simp]
theorem normUnit_mul_normUnit (a : α) : normUnit (a * normUnit a) = 1 := by
nontriviality α using Subsingleton.elim a 0
obtain rfl | h := eq_or_ne a 0
· rw [normUnit_zero, zero_mul, normUnit_zero]
· rw [normUnit_mul h (Units.ne_zero _), normUnit_coe_units, mul_inv_eq_one]
#align norm_unit_mul_norm_unit normUnit_mul_normUnit
theorem normalize_idem (x : α) : normalize (normalize x) = normalize x := by simp
#align normalize_idem normalize_idem
| Mathlib/Algebra/GCDMonoid/Basic.lean | 172 | 181 | theorem normalize_eq_normalize {a b : α} (hab : a ∣ b) (hba : b ∣ a) :
normalize a = normalize b := by |
nontriviality α
rcases associated_of_dvd_dvd hab hba with ⟨u, rfl⟩
refine by_cases (by rintro rfl; simp only [zero_mul]) fun ha : a ≠ 0 => ?_
suffices a * ↑(normUnit a) = a * ↑u * ↑(normUnit a) * ↑u⁻¹ by
simpa only [normalize_apply, mul_assoc, normUnit_mul ha u.ne_zero, normUnit_coe_units]
calc
a * ↑(normUnit a) = a * ↑(normUnit a) * ↑u * ↑u⁻¹ := (Units.mul_inv_cancel_right _ _).symm
_ = a * ↑u * ↑(normUnit a) * ↑u⁻¹ := by rw [mul_right_comm a]
| 8 | 2,980.957987 | 2 | 1 | 4 | 809 |
import Mathlib.CategoryTheory.Filtered.Connected
import Mathlib.CategoryTheory.Limits.TypesFiltered
import Mathlib.CategoryTheory.Limits.Final
universe v₁ v₂ u₁ u₂
namespace CategoryTheory
open CategoryTheory.Limits CategoryTheory.Functor Opposite
section ArbitraryUniverses
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D)
theorem Functor.final_of_isFiltered_structuredArrow [∀ d, IsFiltered (StructuredArrow d F)] :
Final F where
out _ := IsFiltered.isConnected _
theorem Functor.initial_of_isCofiltered_costructuredArrow
[∀ d, IsCofiltered (CostructuredArrow F d)] : Initial F where
out _ := IsCofiltered.isConnected _
theorem isFiltered_structuredArrow_of_isFiltered_of_exists [IsFilteredOrEmpty C]
(h₁ : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) (h₂ : ∀ {d : D} {c : C} (s s' : d ⟶ F.obj c),
∃ (c' : C) (t : c ⟶ c'), s ≫ F.map t = s' ≫ F.map t) (d : D) :
IsFiltered (StructuredArrow d F) := by
have : Nonempty (StructuredArrow d F) := by
obtain ⟨c, ⟨f⟩⟩ := h₁ d
exact ⟨.mk f⟩
suffices IsFilteredOrEmpty (StructuredArrow d F) from IsFiltered.mk
refine ⟨fun f g => ?_, fun f g η μ => ?_⟩
· obtain ⟨c, ⟨t, ht⟩⟩ := h₂ (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right))
(g.hom ≫ F.map (IsFiltered.rightToMax f.right g.right))
refine ⟨.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t)), ?_, ?_, trivial⟩
· exact StructuredArrow.homMk (IsFiltered.leftToMax _ _ ≫ t) rfl
· exact StructuredArrow.homMk (IsFiltered.rightToMax _ _ ≫ t) (by simpa using ht.symm)
· refine ⟨.mk (f.hom ≫ F.map (η.right ≫ IsFiltered.coeqHom η.right μ.right)),
StructuredArrow.homMk (IsFiltered.coeqHom η.right μ.right) (by simp), ?_⟩
simpa using IsFiltered.coeq_condition _ _
theorem isCofiltered_costructuredArrow_of_isCofiltered_of_exists [IsCofilteredOrEmpty C]
(h₁ : ∀ d, ∃ c, Nonempty (F.obj c ⟶ d)) (h₂ : ∀ {d : D} {c : C} (s s' : F.obj c ⟶ d),
∃ (c' : C) (t : c' ⟶ c), F.map t ≫ s = F.map t ≫ s') (d : D) :
IsCofiltered (CostructuredArrow F d) := by
suffices IsFiltered (CostructuredArrow F d)ᵒᵖ from isCofiltered_of_isFiltered_op _
suffices IsFiltered (StructuredArrow (op d) F.op) from
IsFiltered.of_equivalence (costructuredArrowOpEquivalence _ _).symm
apply isFiltered_structuredArrow_of_isFiltered_of_exists
· intro d
obtain ⟨c, ⟨t⟩⟩ := h₁ d.unop
exact ⟨op c, ⟨Quiver.Hom.op t⟩⟩
· intro d c s s'
obtain ⟨c', t, ht⟩ := h₂ s.unop s'.unop
exact ⟨op c', Quiver.Hom.op t, Quiver.Hom.unop_inj ht⟩
theorem Functor.final_of_exists_of_isFiltered [IsFilteredOrEmpty C]
(h₁ : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) (h₂ : ∀ {d : D} {c : C} (s s' : d ⟶ F.obj c),
∃ (c' : C) (t : c ⟶ c'), s ≫ F.map t = s' ≫ F.map t) : Functor.Final F := by
suffices ∀ d, IsFiltered (StructuredArrow d F) from final_of_isFiltered_structuredArrow F
exact isFiltered_structuredArrow_of_isFiltered_of_exists F h₁ h₂
theorem Functor.initial_of_exists_of_isCofiltered [IsCofilteredOrEmpty C]
(h₁ : ∀ d, ∃ c, Nonempty (F.obj c ⟶ d)) (h₂ : ∀ {d : D} {c : C} (s s' : F.obj c ⟶ d),
∃ (c' : C) (t : c' ⟶ c), F.map t ≫ s = F.map t ≫ s') : Functor.Initial F := by
suffices ∀ d, IsCofiltered (CostructuredArrow F d) from
initial_of_isCofiltered_costructuredArrow F
exact isCofiltered_costructuredArrow_of_isCofiltered_of_exists F h₁ h₂
theorem IsFilteredOrEmpty.of_exists_of_isFiltered_of_fullyFaithful [IsFilteredOrEmpty D] [F.Full]
[F.Faithful] (h : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) : IsFilteredOrEmpty C where
cocone_objs c c' := by
obtain ⟨c₀, ⟨f⟩⟩ := h (IsFiltered.max (F.obj c) (F.obj c'))
exact ⟨c₀, F.preimage (IsFiltered.leftToMax _ _ ≫ f),
F.preimage (IsFiltered.rightToMax _ _ ≫ f), trivial⟩
cocone_maps {c c'} f g := by
obtain ⟨c₀, ⟨f₀⟩⟩ := h (IsFiltered.coeq (F.map f) (F.map g))
refine ⟨_, F.preimage (IsFiltered.coeqHom (F.map f) (F.map g) ≫ f₀), F.map_injective ?_⟩
simp [reassoc_of% (IsFiltered.coeq_condition (F.map f) (F.map g))]
| Mathlib/CategoryTheory/Filtered/Final.lean | 121 | 126 | theorem IsCofilteredOrEmpty.of_exists_of_isCofiltered_of_fullyFaithful [IsCofilteredOrEmpty D]
[F.Full] [F.Faithful] (h : ∀ d, ∃ c, Nonempty (F.obj c ⟶ d)) : IsCofilteredOrEmpty C := by |
suffices IsFilteredOrEmpty Cᵒᵖ from isCofilteredOrEmpty_of_isFilteredOrEmpty_op _
refine IsFilteredOrEmpty.of_exists_of_isFiltered_of_fullyFaithful F.op (fun d => ?_)
obtain ⟨c, ⟨f⟩⟩ := h d.unop
exact ⟨op c, ⟨f.op⟩⟩
| 4 | 54.59815 | 2 | 1.666667 | 6 | 1,795 |
import Mathlib.Algebra.Module.Equiv
import Mathlib.Algebra.Module.Hom
import Mathlib.Algebra.Module.Prod
import Mathlib.Algebra.Module.Submodule.Range
import Mathlib.Data.Set.Finite
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Tactic.Abel
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*} {R₄ : Type*}
variable {S : Type*}
variable {K : Type*} {K₂ : Type*}
variable {M : Type*} {M' : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*} {M₄ : Type*}
variable {N : Type*} {N₂ : Type*}
variable {ι : Type*}
variable {V : Type*} {V₂ : Type*}
namespace IsLinearMap
| Mathlib/LinearAlgebra/Basic.lean | 73 | 80 | theorem isLinearMap_add [Semiring R] [AddCommMonoid M] [Module R M] :
IsLinearMap R fun x : M × M => x.1 + x.2 := by |
apply IsLinearMap.mk
· intro x y
simp only [Prod.fst_add, Prod.snd_add]
abel -- Porting Note: was cc
· intro x y
simp [smul_add]
| 6 | 403.428793 | 2 | 1.25 | 4 | 1,316 |
import Mathlib.Data.Matrix.Basis
import Mathlib.Data.Matrix.DMatrix
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.matrix.transvection from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6"
universe u₁ u₂
namespace Matrix
open Matrix
variable (n p : Type*) (R : Type u₂) {𝕜 : Type*} [Field 𝕜]
variable [DecidableEq n] [DecidableEq p]
variable [CommRing R]
section Transvection
variable {R n} (i j : n)
def transvection (c : R) : Matrix n n R :=
1 + Matrix.stdBasisMatrix i j c
#align matrix.transvection Matrix.transvection
@[simp]
theorem transvection_zero : transvection i j (0 : R) = 1 := by simp [transvection]
#align matrix.transvection_zero Matrix.transvection_zero
section
| Mathlib/LinearAlgebra/Matrix/Transvection.lean | 94 | 108 | theorem updateRow_eq_transvection [Finite n] (c : R) :
updateRow (1 : Matrix n n R) i ((1 : Matrix n n R) i + c • (1 : Matrix n n R) j) =
transvection i j c := by |
cases nonempty_fintype n
ext a b
by_cases ha : i = a
· by_cases hb : j = b
· simp only [updateRow_self, transvection, ha, hb, Pi.add_apply, StdBasisMatrix.apply_same,
one_apply_eq, Pi.smul_apply, mul_one, Algebra.id.smul_eq_mul, add_apply]
· simp only [updateRow_self, transvection, ha, hb, StdBasisMatrix.apply_of_ne, Pi.add_apply,
Ne, not_false_iff, Pi.smul_apply, and_false_iff, one_apply_ne, Algebra.id.smul_eq_mul,
mul_zero, add_apply]
· simp only [updateRow_ne, transvection, ha, Ne.symm ha, StdBasisMatrix.apply_of_ne, add_zero,
Algebra.id.smul_eq_mul, Ne, not_false_iff, DMatrix.add_apply, Pi.smul_apply,
mul_zero, false_and_iff, add_apply]
| 12 | 162,754.791419 | 2 | 0.666667 | 12 | 572 |
import Mathlib.CategoryTheory.PathCategory
import Mathlib.CategoryTheory.Functor.FullyFaithful
import Mathlib.CategoryTheory.Bicategory.Free
import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete
#align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff"
open Quiver (Path)
open Quiver.Path
namespace CategoryTheory
open Bicategory Category
universe v u
namespace FreeBicategory
variable {B : Type u} [Quiver.{v + 1} B]
@[simp]
def inclusionPathAux {a : B} : ∀ {b : B}, Path a b → Hom a b
| _, nil => Hom.id a
| _, cons p f => (inclusionPathAux p).comp (Hom.of f)
#align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux
local instance homCategory' (a b : B) : Category (Hom a b) :=
homCategory a b
def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) ⥤ Hom a b :=
Discrete.functor inclusionPathAux
#align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath
def preinclusion (B : Type u) [Quiver.{v + 1} B] :
PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where
obj a := a.as
map := @fun a b f => (@inclusionPath B _ a.as b.as).obj f
map₂ η := (inclusionPath _ _).map η
#align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion
@[simp]
theorem preinclusion_obj (a : B) : (preinclusion B).obj ⟨a⟩ = a :=
rfl
#align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj
@[simp]
theorem preinclusion_map₂ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (η : f ⟶ g) :
(preinclusion B).map₂ η = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom η))) := by
rcases η with ⟨⟨⟩⟩
cases Discrete.ext _ _ (by assumption)
convert (inclusionPath a b).map_id _
#align category_theory.free_bicategory.preinclusion_map₂ CategoryTheory.FreeBicategory.preinclusion_map₂
@[simp]
def normalizeAux {a : B} : ∀ {b c : B}, Path a b → Hom b c → Path a c
| _, _, p, Hom.of f => p.cons f
| _, _, p, Hom.id _ => p
| _, _, p, Hom.comp f g => normalizeAux (normalizeAux p f) g
#align category_theory.free_bicategory.normalize_aux CategoryTheory.FreeBicategory.normalizeAux
@[simp]
def normalizeIso {a : B} :
∀ {b c : B} (p : Path a b) (f : Hom b c),
(preinclusion B).map ⟨p⟩ ≫ f ≅ (preinclusion B).map ⟨normalizeAux p f⟩
| _, _, _, Hom.of _ => Iso.refl _
| _, _, _, Hom.id b => ρ_ _
| _, _, p, Hom.comp f g =>
(α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g
#align category_theory.free_bicategory.normalize_iso CategoryTheory.FreeBicategory.normalizeIso
theorem normalizeAux_congr {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) :
normalizeAux p f = normalizeAux p g := by
rcases η with ⟨η'⟩
apply @congr_fun _ _ fun p => normalizeAux p f
clear p η
induction η' with
| vcomp _ _ _ _ => apply Eq.trans <;> assumption
| whisker_left _ _ ih => funext; apply congr_fun ih
| whisker_right _ _ ih => funext; apply congr_arg₂ _ (congr_fun ih _) rfl
| _ => funext; rfl
#align category_theory.free_bicategory.normalize_aux_congr CategoryTheory.FreeBicategory.normalizeAux_congr
theorem normalize_naturality {a b c : B} (p : Path a b) {f g : Hom b c} (η : f ⟶ g) :
(preinclusion B).map ⟨p⟩ ◁ η ≫ (normalizeIso p g).hom =
(normalizeIso p f).hom ≫
(preinclusion B).map₂ (eqToHom (Discrete.ext _ _ (normalizeAux_congr p η))) := by
rcases η with ⟨η'⟩; clear η;
induction η' with
| id => simp
| vcomp η θ ihf ihg =>
simp only [mk_vcomp, Bicategory.whiskerLeft_comp]
slice_lhs 2 3 => rw [ihg]
slice_lhs 1 2 => rw [ihf]
simp
-- p ≠ nil required! See the docstring of `normalizeAux`.
| whisker_left _ _ ih =>
dsimp
rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc, ih]
simp
| whisker_right h η' ih =>
dsimp
rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, ih, comp_whiskerRight]
have := dcongr_arg (fun x => (normalizeIso x h).hom) (normalizeAux_congr p (Quot.mk _ η'))
dsimp at this; simp [this]
| _ => simp
#align category_theory.free_bicategory.normalize_naturality CategoryTheory.FreeBicategory.normalize_naturality
-- Porting note: the left-hand side is not in simp-normal form.
-- @[simp]
| Mathlib/CategoryTheory/Bicategory/Coherence.lean | 188 | 193 | theorem normalizeAux_nil_comp {a b c : B} (f : Hom a b) (g : Hom b c) :
normalizeAux nil (f.comp g) = (normalizeAux nil f).comp (normalizeAux nil g) := by |
induction g generalizing a with
| id => rfl
| of => rfl
| comp g _ ihf ihg => erw [ihg (f.comp g), ihf f, ihg g, comp_assoc]
| 4 | 54.59815 | 2 | 1.75 | 4 | 1,860 |
import Mathlib.Order.Ideal
import Mathlib.Data.Finset.Lattice
#align_import order.countable_dense_linear_order from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9"
noncomputable section
open scoped Classical
namespace Order
theorem exists_between_finsets {α : Type*} [LinearOrder α] [DenselyOrdered α] [NoMinOrder α]
[NoMaxOrder α] [nonem : Nonempty α] (lo hi : Finset α) (lo_lt_hi : ∀ x ∈ lo, ∀ y ∈ hi, x < y) :
∃ m : α, (∀ x ∈ lo, x < m) ∧ ∀ y ∈ hi, m < y :=
if nlo : lo.Nonempty then
if nhi : hi.Nonempty then
-- both sets are nonempty, use `DenselyOrdered`
Exists.elim
(exists_between (lo_lt_hi _ (Finset.max'_mem _ nlo) _ (Finset.min'_mem _ nhi))) fun m hm ↦
⟨m, fun x hx ↦ lt_of_le_of_lt (Finset.le_max' lo x hx) hm.1, fun y hy ↦
lt_of_lt_of_le hm.2 (Finset.min'_le hi y hy)⟩
else-- upper set is empty, use `NoMaxOrder`
Exists.elim
(exists_gt (Finset.max' lo nlo)) fun m hm ↦
⟨m, fun x hx ↦ lt_of_le_of_lt (Finset.le_max' lo x hx) hm, fun y hy ↦ (nhi ⟨y, hy⟩).elim⟩
else
if nhi : hi.Nonempty then
-- lower set is empty, use `NoMinOrder`
Exists.elim
(exists_lt (Finset.min' hi nhi)) fun m hm ↦
⟨m, fun x hx ↦ (nlo ⟨x, hx⟩).elim, fun y hy ↦ lt_of_lt_of_le hm (Finset.min'_le hi y hy)⟩
else -- both sets are empty, use `Nonempty`
nonem.elim
fun m ↦ ⟨m, fun x hx ↦ (nlo ⟨x, hx⟩).elim, fun y hy ↦ (nhi ⟨y, hy⟩).elim⟩
#align order.exists_between_finsets Order.exists_between_finsets
variable (α β : Type*) [LinearOrder α] [LinearOrder β]
-- Porting note: Mathport warning: expanding binder collection (p q «expr ∈ » f)
def PartialIso : Type _ :=
{ f : Finset (α × β) //
∀ p ∈ f, ∀ q ∈ f,
cmp (Prod.fst p) (Prod.fst q) = cmp (Prod.snd p) (Prod.snd q) }
#align order.partial_iso Order.PartialIso
namespace PartialIso
instance : Inhabited (PartialIso α β) := ⟨⟨∅, fun _p h _q ↦ (Finset.not_mem_empty _ h).elim⟩⟩
instance : Preorder (PartialIso α β) := Subtype.preorder _
variable {α β}
| Mathlib/Order/CountableDenseLinearOrder.lean | 94 | 122 | theorem exists_across [DenselyOrdered β] [NoMinOrder β] [NoMaxOrder β] [Nonempty β]
(f : PartialIso α β) (a : α) :
∃ b : β, ∀ p ∈ f.val, cmp (Prod.fst p) a = cmp (Prod.snd p) b := by |
by_cases h : ∃ b, (a, b) ∈ f.val
· cases' h with b hb
exact ⟨b, fun p hp ↦ f.prop _ hp _ hb⟩
have :
∀ x ∈ (f.val.filter fun p : α × β ↦ p.fst < a).image Prod.snd,
∀ y ∈ (f.val.filter fun p : α × β ↦ a < p.fst).image Prod.snd, x < y := by
intro x hx y hy
rw [Finset.mem_image] at hx hy
rcases hx with ⟨p, hp1, rfl⟩
rcases hy with ⟨q, hq1, rfl⟩
rw [Finset.mem_filter] at hp1 hq1
rw [← lt_iff_lt_of_cmp_eq_cmp (f.prop _ hp1.1 _ hq1.1)]
exact lt_trans hp1.right hq1.right
cases' exists_between_finsets _ _ this with b hb
use b
rintro ⟨p1, p2⟩ hp
have : p1 ≠ a := fun he ↦ h ⟨p2, he ▸ hp⟩
cases' lt_or_gt_of_ne this with hl hr
· have : p1 < a ∧ p2 < b :=
⟨hl, hb.1 _ (Finset.mem_image.mpr ⟨(p1, p2), Finset.mem_filter.mpr ⟨hp, hl⟩, rfl⟩)⟩
rw [← cmp_eq_lt_iff, ← cmp_eq_lt_iff] at this
exact this.1.trans this.2.symm
· have : a < p1 ∧ b < p2 :=
⟨hr, hb.2 _ (Finset.mem_image.mpr ⟨(p1, p2), Finset.mem_filter.mpr ⟨hp, hr⟩, rfl⟩)⟩
rw [← cmp_eq_gt_iff, ← cmp_eq_gt_iff] at this
exact this.1.trans this.2.symm
| 26 | 195,729,609,428.83878 | 2 | 2 | 1 | 2,286 |
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.MeasureTheory.Group.Pointwise
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.MeasureTheory.Measure.Haar.Basic
import Mathlib.MeasureTheory.Measure.Doubling
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric
#align_import measure_theory.measure.lebesgue.eq_haar from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
assert_not_exists MeasureTheory.integral
open TopologicalSpace Set Filter Metric Bornology
open scoped ENNReal Pointwise Topology NNReal
def TopologicalSpace.PositiveCompacts.Icc01 : PositiveCompacts ℝ where
carrier := Icc 0 1
isCompact' := isCompact_Icc
interior_nonempty' := by simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one]
#align topological_space.positive_compacts.Icc01 TopologicalSpace.PositiveCompacts.Icc01
universe u
def TopologicalSpace.PositiveCompacts.piIcc01 (ι : Type*) [Finite ι] :
PositiveCompacts (ι → ℝ) where
carrier := pi univ fun _ => Icc 0 1
isCompact' := isCompact_univ_pi fun _ => isCompact_Icc
interior_nonempty' := by
simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo,
imp_true_iff, zero_lt_one]
#align topological_space.positive_compacts.pi_Icc01 TopologicalSpace.PositiveCompacts.piIcc01
theorem Basis.parallelepiped_basisFun (ι : Type*) [Fintype ι] :
(Pi.basisFun ℝ ι).parallelepiped = TopologicalSpace.PositiveCompacts.piIcc01 ι :=
SetLike.coe_injective <| by
refine Eq.trans ?_ ((uIcc_of_le ?_).trans (Set.pi_univ_Icc _ _).symm)
· classical convert parallelepiped_single (ι := ι) 1
· exact zero_le_one
#align basis.parallelepiped_basis_fun Basis.parallelepiped_basisFun
| Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean | 84 | 91 | theorem Basis.parallelepiped_eq_map {ι E : Type*} [Fintype ι] [NormedAddCommGroup E]
[NormedSpace ℝ E] (b : Basis ι ℝ E) :
b.parallelepiped = (PositiveCompacts.piIcc01 ι).map b.equivFun.symm
b.equivFunL.symm.continuous b.equivFunL.symm.isOpenMap := by |
classical
rw [← Basis.parallelepiped_basisFun, ← Basis.parallelepiped_map]
congr with x
simp
| 4 | 54.59815 | 2 | 1.4 | 5 | 1,496 |
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Data.Finite.Card
#align_import group_theory.subgroup.finite from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6"
variable {G : Type*} [Group G]
variable {A : Type*} [AddGroup A]
namespace Subgroup
section Pi
open Set
variable {η : Type*} {f : η → Type*} [∀ i, Group (f i)]
@[to_additive]
| Mathlib/Algebra/Group/Subgroup/Finite.lean | 195 | 226 | theorem pi_mem_of_mulSingle_mem_aux [DecidableEq η] (I : Finset η) {H : Subgroup (∀ i, f i)}
(x : ∀ i, f i) (h1 : ∀ i, i ∉ I → x i = 1) (h2 : ∀ i, i ∈ I → Pi.mulSingle i (x i) ∈ H) :
x ∈ H := by |
induction' I using Finset.induction_on with i I hnmem ih generalizing x
· convert one_mem H
ext i
exact h1 i (Finset.not_mem_empty i)
· have : x = Function.update x i 1 * Pi.mulSingle i (x i) := by
ext j
by_cases heq : j = i
· subst heq
simp
· simp [heq]
rw [this]
clear this
apply mul_mem
· apply ih <;> clear ih
· intro j hj
by_cases heq : j = i
· subst heq
simp
· simp [heq]
apply h1 j
simpa [heq] using hj
· intro j hj
have : j ≠ i := by
rintro rfl
contradiction
simp only [ne_eq, this, not_false_eq_true, Function.update_noteq]
exact h2 _ (Finset.mem_insert_of_mem hj)
· apply h2
simp
| 29 | 3,931,334,297,144.042 | 2 | 1.8 | 5 | 1,897 |
import Mathlib.Data.ZMod.Basic
import Mathlib.Algebra.Group.Nat
import Mathlib.Tactic.IntervalCases
import Mathlib.GroupTheory.SpecificGroups.Dihedral
import Mathlib.GroupTheory.SpecificGroups.Cyclic
#align_import group_theory.specific_groups.quaternion from "leanprover-community/mathlib"@"879155bff5af618b9062cbb2915347dafd749ad6"
inductive QuaternionGroup (n : ℕ) : Type
| a : ZMod (2 * n) → QuaternionGroup n
| xa : ZMod (2 * n) → QuaternionGroup n
deriving DecidableEq
#align quaternion_group QuaternionGroup
namespace QuaternionGroup
variable {n : ℕ}
private def mul : QuaternionGroup n → QuaternionGroup n → QuaternionGroup n
| a i, a j => a (i + j)
| a i, xa j => xa (j - i)
| xa i, a j => xa (i + j)
| xa i, xa j => a (n + j - i)
private def one : QuaternionGroup n :=
a 0
instance : Inhabited (QuaternionGroup n) :=
⟨one⟩
private def inv : QuaternionGroup n → QuaternionGroup n
| a i => a (-i)
| xa i => xa (n + i)
instance : Group (QuaternionGroup n) where
mul := mul
mul_assoc := by
rintro (i | i) (j | j) (k | k) <;> simp only [(· * ·), mul] <;> ring_nf
congr
calc
-(n : ZMod (2 * n)) = 0 - n := by rw [zero_sub]
_ = 2 * n - n := by norm_cast; simp
_ = n := by ring
one := one
one_mul := by
rintro (i | i)
· exact congr_arg a (zero_add i)
· exact congr_arg xa (sub_zero i)
mul_one := by
rintro (i | i)
· exact congr_arg a (add_zero i)
· exact congr_arg xa (add_zero i)
inv := inv
mul_left_inv := by
rintro (i | i)
· exact congr_arg a (neg_add_self i)
· exact congr_arg a (sub_self (n + i))
@[simp]
theorem a_mul_a (i j : ZMod (2 * n)) : a i * a j = a (i + j) :=
rfl
#align quaternion_group.a_mul_a QuaternionGroup.a_mul_a
@[simp]
theorem a_mul_xa (i j : ZMod (2 * n)) : a i * xa j = xa (j - i) :=
rfl
#align quaternion_group.a_mul_xa QuaternionGroup.a_mul_xa
@[simp]
theorem xa_mul_a (i j : ZMod (2 * n)) : xa i * a j = xa (i + j) :=
rfl
#align quaternion_group.xa_mul_a QuaternionGroup.xa_mul_a
@[simp]
theorem xa_mul_xa (i j : ZMod (2 * n)) : xa i * xa j = a ((n : ZMod (2 * n)) + j - i) :=
rfl
#align quaternion_group.xa_mul_xa QuaternionGroup.xa_mul_xa
theorem one_def : (1 : QuaternionGroup n) = a 0 :=
rfl
#align quaternion_group.one_def QuaternionGroup.one_def
private def fintypeHelper : Sum (ZMod (2 * n)) (ZMod (2 * n)) ≃ QuaternionGroup n where
invFun i :=
match i with
| a j => Sum.inl j
| xa j => Sum.inr j
toFun i :=
match i with
| Sum.inl j => a j
| Sum.inr j => xa j
left_inv := by rintro (x | x) <;> rfl
right_inv := by rintro (x | x) <;> rfl
def quaternionGroupZeroEquivDihedralGroupZero : QuaternionGroup 0 ≃* DihedralGroup 0 where
toFun i :=
-- Porting note: Originally `QuaternionGroup.recOn i DihedralGroup.r DihedralGroup.sr`
match i with
| a j => DihedralGroup.r j
| xa j => DihedralGroup.sr j
invFun i :=
match i with
| DihedralGroup.r j => a j
| DihedralGroup.sr j => xa j
left_inv := by rintro (k | k) <;> rfl
right_inv := by rintro (k | k) <;> rfl
map_mul' := by rintro (k | k) (l | l) <;> simp
#align quaternion_group.quaternion_group_zero_equiv_dihedral_group_zero QuaternionGroup.quaternionGroupZeroEquivDihedralGroupZero
instance [NeZero n] : Fintype (QuaternionGroup n) :=
Fintype.ofEquiv _ fintypeHelper
instance : Nontrivial (QuaternionGroup n) :=
⟨⟨a 0, xa 0, by revert n; simp⟩⟩ -- Porting note: `revert n; simp` was `decide`
theorem card [NeZero n] : Fintype.card (QuaternionGroup n) = 4 * n := by
rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul]
ring
#align quaternion_group.card QuaternionGroup.card
@[simp]
theorem a_one_pow (k : ℕ) : (a 1 : QuaternionGroup n) ^ k = a k := by
induction' k with k IH
· rw [Nat.cast_zero]; rfl
· rw [pow_succ, IH, a_mul_a]
congr 1
norm_cast
#align quaternion_group.a_one_pow QuaternionGroup.a_one_pow
-- @[simp] -- Porting note: simp changes this to `a 0 = 1`, so this is no longer a good simp lemma.
theorem a_one_pow_n : (a 1 : QuaternionGroup n) ^ (2 * n) = 1 := by
rw [a_one_pow, one_def]
congr 1
exact ZMod.natCast_self _
#align quaternion_group.a_one_pow_n QuaternionGroup.a_one_pow_n
@[simp]
theorem xa_sq (i : ZMod (2 * n)) : xa i ^ 2 = a n := by simp [sq]
#align quaternion_group.xa_sq QuaternionGroup.xa_sq
@[simp]
theorem xa_pow_four (i : ZMod (2 * n)) : xa i ^ 4 = 1 := by
rw [pow_succ, pow_succ, sq, xa_mul_xa, a_mul_xa, xa_mul_xa,
add_sub_cancel_right, add_sub_assoc, sub_sub_cancel]
norm_cast
rw [← two_mul]
simp [one_def]
#align quaternion_group.xa_pow_four QuaternionGroup.xa_pow_four
@[simp]
| Mathlib/GroupTheory/SpecificGroups/Quaternion.lean | 211 | 222 | theorem orderOf_xa [NeZero n] (i : ZMod (2 * n)) : orderOf (xa i) = 4 := by |
change _ = 2 ^ 2
haveI : Fact (Nat.Prime 2) := Fact.mk Nat.prime_two
apply orderOf_eq_prime_pow
· intro h
simp only [pow_one, xa_sq] at h
injection h with h'
apply_fun ZMod.val at h'
apply_fun (· / n) at h'
simp only [ZMod.val_natCast, ZMod.val_zero, Nat.zero_div, Nat.mod_mul_left_div_self,
Nat.div_self (NeZero.pos n)] at h'
· norm_num
| 11 | 59,874.141715 | 2 | 1.333333 | 6 | 1,410 |
import Mathlib.Topology.Separation
open Topology Filter Set TopologicalSpace
section Basic
variable {α : Type*} [TopologicalSpace α] {C : Set α}
theorem AccPt.nhds_inter {x : α} {U : Set α} (h_acc : AccPt x (𝓟 C)) (hU : U ∈ 𝓝 x) :
AccPt x (𝓟 (U ∩ C)) := by
have : 𝓝[≠] x ≤ 𝓟 U := by
rw [le_principal_iff]
exact mem_nhdsWithin_of_mem_nhds hU
rw [AccPt, ← inf_principal, ← inf_assoc, inf_of_le_left this]
exact h_acc
#align acc_pt.nhds_inter AccPt.nhds_inter
def Preperfect (C : Set α) : Prop :=
∀ x ∈ C, AccPt x (𝓟 C)
#align preperfect Preperfect
@[mk_iff perfect_def]
structure Perfect (C : Set α) : Prop where
closed : IsClosed C
acc : Preperfect C
#align perfect Perfect
theorem preperfect_iff_nhds : Preperfect C ↔ ∀ x ∈ C, ∀ U ∈ 𝓝 x, ∃ y ∈ U ∩ C, y ≠ x := by
simp only [Preperfect, accPt_iff_nhds]
#align preperfect_iff_nhds preperfect_iff_nhds
section Preperfect
theorem Preperfect.open_inter {U : Set α} (hC : Preperfect C) (hU : IsOpen U) :
Preperfect (U ∩ C) := by
rintro x ⟨xU, xC⟩
apply (hC _ xC).nhds_inter
exact hU.mem_nhds xU
#align preperfect.open_inter Preperfect.open_inter
| Mathlib/Topology/Perfect.lean | 120 | 128 | theorem Preperfect.perfect_closure (hC : Preperfect C) : Perfect (closure C) := by |
constructor; · exact isClosed_closure
intro x hx
by_cases h : x ∈ C <;> apply AccPt.mono _ (principal_mono.mpr subset_closure)
· exact hC _ h
have : {x}ᶜ ∩ C = C := by simp [h]
rw [AccPt, nhdsWithin, inf_assoc, inf_principal, this]
rw [closure_eq_cluster_pts] at hx
exact hx
| 8 | 2,980.957987 | 2 | 1.666667 | 9 | 1,822 |
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.Calculus.Deriv.Inv
#align_import analysis.calculus.lhopital from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open Filter Set
open scoped Filter Topology Pointwise
variable {a b : ℝ} (hab : a < b) {l : Filter ℝ} {f f' g g' : ℝ → ℝ}
namespace HasDerivAt
| Mathlib/Analysis/Calculus/LHopital.lean | 51 | 92 | theorem lhopital_zero_right_on_Ioo (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x)
(hgg' : ∀ x ∈ Ioo a b, HasDerivAt g (g' x) x) (hg' : ∀ x ∈ Ioo a b, g' x ≠ 0)
(hfa : Tendsto f (𝓝[>] a) (𝓝 0)) (hga : Tendsto g (𝓝[>] a) (𝓝 0))
(hdiv : Tendsto (fun x => f' x / g' x) (𝓝[>] a) l) :
Tendsto (fun x => f x / g x) (𝓝[>] a) l := by |
have sub : ∀ x ∈ Ioo a b, Ioo a x ⊆ Ioo a b := fun x hx =>
Ioo_subset_Ioo (le_refl a) (le_of_lt hx.2)
have hg : ∀ x ∈ Ioo a b, g x ≠ 0 := by
intro x hx h
have : Tendsto g (𝓝[<] x) (𝓝 0) := by
rw [← h, ← nhdsWithin_Ioo_eq_nhdsWithin_Iio hx.1]
exact ((hgg' x hx).continuousAt.continuousWithinAt.mono <| sub x hx).tendsto
obtain ⟨y, hyx, hy⟩ : ∃ c ∈ Ioo a x, g' c = 0 :=
exists_hasDerivAt_eq_zero' hx.1 hga this fun y hy => hgg' y <| sub x hx hy
exact hg' y (sub x hx hyx) hy
have : ∀ x ∈ Ioo a b, ∃ c ∈ Ioo a x, f x * g' c = g x * f' c := by
intro x hx
rw [← sub_zero (f x), ← sub_zero (g x)]
exact exists_ratio_hasDerivAt_eq_ratio_slope' g g' hx.1 f f' (fun y hy => hgg' y <| sub x hx hy)
(fun y hy => hff' y <| sub x hx hy) hga hfa
(tendsto_nhdsWithin_of_tendsto_nhds (hgg' x hx).continuousAt.tendsto)
(tendsto_nhdsWithin_of_tendsto_nhds (hff' x hx).continuousAt.tendsto)
choose! c hc using this
have : ∀ x ∈ Ioo a b, ((fun x' => f' x' / g' x') ∘ c) x = f x / g x := by
intro x hx
rcases hc x hx with ⟨h₁, h₂⟩
field_simp [hg x hx, hg' (c x) ((sub x hx) h₁)]
simp only [h₂]
rw [mul_comm]
have cmp : ∀ x ∈ Ioo a b, a < c x ∧ c x < x := fun x hx => (hc x hx).1
rw [← nhdsWithin_Ioo_eq_nhdsWithin_Ioi hab]
apply tendsto_nhdsWithin_congr this
apply hdiv.comp
refine tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _
(tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds
(tendsto_nhdsWithin_of_tendsto_nhds tendsto_id) ?_ ?_) ?_
all_goals
apply eventually_nhdsWithin_of_forall
intro x hx
have := cmp x hx
try simp
linarith [this]
| 37 | 11,719,142,372,802,612 | 2 | 2 | 3 | 2,002 |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Polynomial.RingDivision
#align_import data.polynomial.mirror from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
namespace Polynomial
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] (p q : R[X])
noncomputable def mirror :=
p.reverse * X ^ p.natTrailingDegree
#align polynomial.mirror Polynomial.mirror
@[simp]
theorem mirror_zero : (0 : R[X]).mirror = 0 := by simp [mirror]
#align polynomial.mirror_zero Polynomial.mirror_zero
theorem mirror_monomial (n : ℕ) (a : R) : (monomial n a).mirror = monomial n a := by
classical
by_cases ha : a = 0
· rw [ha, monomial_zero_right, mirror_zero]
· rw [mirror, reverse, natDegree_monomial n a, if_neg ha, natTrailingDegree_monomial ha, ←
C_mul_X_pow_eq_monomial, reflect_C_mul_X_pow, revAt_le (le_refl n), tsub_self, pow_zero,
mul_one]
#align polynomial.mirror_monomial Polynomial.mirror_monomial
theorem mirror_C (a : R) : (C a).mirror = C a :=
mirror_monomial 0 a
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_C Polynomial.mirror_C
theorem mirror_X : X.mirror = (X : R[X]) :=
mirror_monomial 1 (1 : R)
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_X Polynomial.mirror_X
theorem mirror_natDegree : p.mirror.natDegree = p.natDegree := by
by_cases hp : p = 0
· rw [hp, mirror_zero]
nontriviality R
rw [mirror, natDegree_mul', reverse_natDegree, natDegree_X_pow,
tsub_add_cancel_of_le p.natTrailingDegree_le_natDegree]
rwa [leadingCoeff_X_pow, mul_one, reverse_leadingCoeff, Ne, trailingCoeff_eq_zero]
#align polynomial.mirror_nat_degree Polynomial.mirror_natDegree
| Mathlib/Algebra/Polynomial/Mirror.lean | 75 | 79 | theorem mirror_natTrailingDegree : p.mirror.natTrailingDegree = p.natTrailingDegree := by |
by_cases hp : p = 0
· rw [hp, mirror_zero]
· rw [mirror, natTrailingDegree_mul_X_pow ((mt reverse_eq_zero.mp) hp),
natTrailingDegree_reverse, zero_add]
| 4 | 54.59815 | 2 | 1.571429 | 7 | 1,704 |
import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.MeanInequalitiesPow
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Data.Set.Image
import Mathlib.Topology.Algebra.Order.LiminfLimsup
#align_import analysis.normed_space.lp_space from "leanprover-community/mathlib"@"de83b43717abe353f425855fcf0cedf9ea0fe8a4"
noncomputable section
open scoped NNReal ENNReal Function
variable {α : Type*} {E : α → Type*} {p q : ℝ≥0∞} [∀ i, NormedAddCommGroup (E i)]
def Memℓp (f : ∀ i, E i) (p : ℝ≥0∞) : Prop :=
if p = 0 then Set.Finite { i | f i ≠ 0 }
else if p = ∞ then BddAbove (Set.range fun i => ‖f i‖)
else Summable fun i => ‖f i‖ ^ p.toReal
#align mem_ℓp Memℓp
theorem memℓp_zero_iff {f : ∀ i, E i} : Memℓp f 0 ↔ Set.Finite { i | f i ≠ 0 } := by
dsimp [Memℓp]
rw [if_pos rfl]
#align mem_ℓp_zero_iff memℓp_zero_iff
theorem memℓp_zero {f : ∀ i, E i} (hf : Set.Finite { i | f i ≠ 0 }) : Memℓp f 0 :=
memℓp_zero_iff.2 hf
#align mem_ℓp_zero memℓp_zero
theorem memℓp_infty_iff {f : ∀ i, E i} : Memℓp f ∞ ↔ BddAbove (Set.range fun i => ‖f i‖) := by
dsimp [Memℓp]
rw [if_neg ENNReal.top_ne_zero, if_pos rfl]
#align mem_ℓp_infty_iff memℓp_infty_iff
theorem memℓp_infty {f : ∀ i, E i} (hf : BddAbove (Set.range fun i => ‖f i‖)) : Memℓp f ∞ :=
memℓp_infty_iff.2 hf
#align mem_ℓp_infty memℓp_infty
theorem memℓp_gen_iff (hp : 0 < p.toReal) {f : ∀ i, E i} :
Memℓp f p ↔ Summable fun i => ‖f i‖ ^ p.toReal := by
rw [ENNReal.toReal_pos_iff] at hp
dsimp [Memℓp]
rw [if_neg hp.1.ne', if_neg hp.2.ne]
#align mem_ℓp_gen_iff memℓp_gen_iff
theorem memℓp_gen {f : ∀ i, E i} (hf : Summable fun i => ‖f i‖ ^ p.toReal) : Memℓp f p := by
rcases p.trichotomy with (rfl | rfl | hp)
· apply memℓp_zero
have H : Summable fun _ : α => (1 : ℝ) := by simpa using hf
exact (Set.Finite.of_summable_const (by norm_num) H).subset (Set.subset_univ _)
· apply memℓp_infty
have H : Summable fun _ : α => (1 : ℝ) := by simpa using hf
simpa using ((Set.Finite.of_summable_const (by norm_num) H).image fun i => ‖f i‖).bddAbove
exact (memℓp_gen_iff hp).2 hf
#align mem_ℓp_gen memℓp_gen
theorem memℓp_gen' {C : ℝ} {f : ∀ i, E i} (hf : ∀ s : Finset α, ∑ i ∈ s, ‖f i‖ ^ p.toReal ≤ C) :
Memℓp f p := by
apply memℓp_gen
use ⨆ s : Finset α, ∑ i ∈ s, ‖f i‖ ^ p.toReal
apply hasSum_of_isLUB_of_nonneg
· intro b
exact Real.rpow_nonneg (norm_nonneg _) _
apply isLUB_ciSup
use C
rintro - ⟨s, rfl⟩
exact hf s
#align mem_ℓp_gen' memℓp_gen'
| Mathlib/Analysis/NormedSpace/lpSpace.lean | 130 | 138 | theorem zero_memℓp : Memℓp (0 : ∀ i, E i) p := by |
rcases p.trichotomy with (rfl | rfl | hp)
· apply memℓp_zero
simp
· apply memℓp_infty
simp only [norm_zero, Pi.zero_apply]
exact bddAbove_singleton.mono Set.range_const_subset
· apply memℓp_gen
simp [Real.zero_rpow hp.ne', summable_zero]
| 8 | 2,980.957987 | 2 | 1.625 | 8 | 1,750 |
import Mathlib.Algebra.Regular.Basic
import Mathlib.LinearAlgebra.Matrix.MvPolynomial
import Mathlib.LinearAlgebra.Matrix.Polynomial
import Mathlib.RingTheory.Polynomial.Basic
#align_import linear_algebra.matrix.adjugate from "leanprover-community/mathlib"@"a99f85220eaf38f14f94e04699943e185a5e1d1a"
namespace Matrix
universe u v w
variable {m : Type u} {n : Type v} {α : Type w}
variable [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m] [CommRing α]
open Matrix Polynomial Equiv Equiv.Perm Finset
section Cramer
variable (A : Matrix n n α) (b : n → α)
def cramerMap (i : n) : α :=
(A.updateColumn i b).det
#align matrix.cramer_map Matrix.cramerMap
theorem cramerMap_is_linear (i : n) : IsLinearMap α fun b => cramerMap A b i :=
{ map_add := det_updateColumn_add _ _
map_smul := det_updateColumn_smul _ _ }
#align matrix.cramer_map_is_linear Matrix.cramerMap_is_linear
theorem cramer_is_linear : IsLinearMap α (cramerMap A) := by
constructor <;> intros <;> ext i
· apply (cramerMap_is_linear A i).1
· apply (cramerMap_is_linear A i).2
#align matrix.cramer_is_linear Matrix.cramer_is_linear
def cramer (A : Matrix n n α) : (n → α) →ₗ[α] (n → α) :=
IsLinearMap.mk' (cramerMap A) (cramer_is_linear A)
#align matrix.cramer Matrix.cramer
theorem cramer_apply (i : n) : cramer A b i = (A.updateColumn i b).det :=
rfl
#align matrix.cramer_apply Matrix.cramer_apply
theorem cramer_transpose_apply (i : n) : cramer Aᵀ b i = (A.updateRow i b).det := by
rw [cramer_apply, updateColumn_transpose, det_transpose]
#align matrix.cramer_transpose_apply Matrix.cramer_transpose_apply
theorem cramer_transpose_row_self (i : n) : Aᵀ.cramer (A i) = Pi.single i A.det := by
ext j
rw [cramer_apply, Pi.single_apply]
split_ifs with h
· -- i = j: this entry should be `A.det`
subst h
simp only [updateColumn_transpose, det_transpose, updateRow_eq_self]
· -- i ≠ j: this entry should be 0
rw [updateColumn_transpose, det_transpose]
apply det_zero_of_row_eq h
rw [updateRow_self, updateRow_ne (Ne.symm h)]
#align matrix.cramer_transpose_row_self Matrix.cramer_transpose_row_self
theorem cramer_row_self (i : n) (h : ∀ j, b j = A j i) : A.cramer b = Pi.single i A.det := by
rw [← transpose_transpose A, det_transpose]
convert cramer_transpose_row_self Aᵀ i
exact funext h
#align matrix.cramer_row_self Matrix.cramer_row_self
@[simp]
theorem cramer_one : cramer (1 : Matrix n n α) = 1 := by
-- Porting note: was `ext i j`
refine LinearMap.pi_ext' (fun (i : n) => LinearMap.ext_ring (funext (fun (j : n) => ?_)))
convert congr_fun (cramer_row_self (1 : Matrix n n α) (Pi.single i 1) i _) j
· simp
· intro j
rw [Matrix.one_eq_pi_single, Pi.single_comm]
#align matrix.cramer_one Matrix.cramer_one
theorem cramer_smul (r : α) (A : Matrix n n α) :
cramer (r • A) = r ^ (Fintype.card n - 1) • cramer A :=
LinearMap.ext fun _ => funext fun _ => det_updateColumn_smul' _ _ _ _
#align matrix.cramer_smul Matrix.cramer_smul
@[simp]
theorem cramer_subsingleton_apply [Subsingleton n] (A : Matrix n n α) (b : n → α) (i : n) :
cramer A b i = b i := by rw [cramer_apply, det_eq_elem_of_subsingleton _ i, updateColumn_self]
#align matrix.cramer_subsingleton_apply Matrix.cramer_subsingleton_apply
theorem cramer_zero [Nontrivial n] : cramer (0 : Matrix n n α) = 0 := by
ext i j
obtain ⟨j', hj'⟩ : ∃ j', j' ≠ j := exists_ne j
apply det_eq_zero_of_column_eq_zero j'
intro j''
simp [updateColumn_ne hj']
#align matrix.cramer_zero Matrix.cramer_zero
theorem sum_cramer {β} (s : Finset β) (f : β → n → α) :
(∑ x ∈ s, cramer A (f x)) = cramer A (∑ x ∈ s, f x) :=
(map_sum (cramer A) ..).symm
#align matrix.sum_cramer Matrix.sum_cramer
| Mathlib/LinearAlgebra/Matrix/Adjugate.lean | 160 | 170 | theorem sum_cramer_apply {β} (s : Finset β) (f : n → β → α) (i : n) :
(∑ x ∈ s, cramer A (fun j => f j x) i) = cramer A (fun j : n => ∑ x ∈ s, f j x) i :=
calc
(∑ x ∈ s, cramer A (fun j => f j x) i) = (∑ x ∈ s, cramer A fun j => f j x) i :=
(Finset.sum_apply i s _).symm
_ = cramer A (fun j : n => ∑ x ∈ s, f j x) i := by |
rw [sum_cramer, cramer_apply, cramer_apply]
simp only [updateColumn]
congr with j
congr
apply Finset.sum_apply
| 5 | 148.413159 | 2 | 1.222222 | 9 | 1,297 |
import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp
#align_import measure_theory.integral.set_to_l1 from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology NNReal ENNReal MeasureTheory Pointwise
open Set Filter TopologicalSpace ENNReal EMetric
namespace MeasureTheory
variable {α E F F' G 𝕜 : Type*} {p : ℝ≥0∞} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup F'] [NormedSpace ℝ F']
[NormedAddCommGroup G] {m : MeasurableSpace α} {μ : Measure α}
local infixr:25 " →ₛ " => SimpleFunc
open Finset
section FinMeasAdditive
def FinMeasAdditive {β} [AddMonoid β] {_ : MeasurableSpace α} (μ : Measure α) (T : Set α → β) :
Prop :=
∀ s t, MeasurableSet s → MeasurableSet t → μ s ≠ ∞ → μ t ≠ ∞ → s ∩ t = ∅ → T (s ∪ t) = T s + T t
#align measure_theory.fin_meas_additive MeasureTheory.FinMeasAdditive
namespace FinMeasAdditive
variable {β : Type*} [AddCommMonoid β] {T T' : Set α → β}
theorem zero : FinMeasAdditive μ (0 : Set α → β) := fun s t _ _ _ _ _ => by simp
#align measure_theory.fin_meas_additive.zero MeasureTheory.FinMeasAdditive.zero
theorem add (hT : FinMeasAdditive μ T) (hT' : FinMeasAdditive μ T') :
FinMeasAdditive μ (T + T') := by
intro s t hs ht hμs hμt hst
simp only [hT s t hs ht hμs hμt hst, hT' s t hs ht hμs hμt hst, Pi.add_apply]
abel
#align measure_theory.fin_meas_additive.add MeasureTheory.FinMeasAdditive.add
theorem smul [Monoid 𝕜] [DistribMulAction 𝕜 β] (hT : FinMeasAdditive μ T) (c : 𝕜) :
FinMeasAdditive μ fun s => c • T s := fun s t hs ht hμs hμt hst => by
simp [hT s t hs ht hμs hμt hst]
#align measure_theory.fin_meas_additive.smul MeasureTheory.FinMeasAdditive.smul
theorem of_eq_top_imp_eq_top {μ' : Measure α} (h : ∀ s, MeasurableSet s → μ s = ∞ → μ' s = ∞)
(hT : FinMeasAdditive μ T) : FinMeasAdditive μ' T := fun s t hs ht hμ's hμ't hst =>
hT s t hs ht (mt (h s hs) hμ's) (mt (h t ht) hμ't) hst
#align measure_theory.fin_meas_additive.of_eq_top_imp_eq_top MeasureTheory.FinMeasAdditive.of_eq_top_imp_eq_top
| Mathlib/MeasureTheory/Integral/SetToL1.lean | 122 | 127 | theorem of_smul_measure (c : ℝ≥0∞) (hc_ne_top : c ≠ ∞) (hT : FinMeasAdditive (c • μ) T) :
FinMeasAdditive μ T := by |
refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT
rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top] at hμs
simp only [hc_ne_top, or_false_iff, Ne, false_and_iff] at hμs
exact hμs.2
| 4 | 54.59815 | 2 | 1.8 | 5 | 1,900 |
import Mathlib.Dynamics.FixedPoints.Basic
import Mathlib.Order.Hom.Order
#align_import order.fixed_points from "leanprover-community/mathlib"@"ba2245edf0c8bb155f1569fd9b9492a9b384cde6"
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
open Function (fixedPoints IsFixedPt)
namespace OrderHom
section Basic
variable [CompleteLattice α] (f : α →o α)
def lfp : (α →o α) →o α where
toFun f := sInf { a | f a ≤ a }
monotone' _ _ hle := sInf_le_sInf fun a ha => (hle a).trans ha
#align order_hom.lfp OrderHom.lfp
def gfp : (α →o α) →o α where
toFun f := sSup { a | a ≤ f a }
monotone' _ _ hle := sSup_le_sSup fun a ha => le_trans ha (hle a)
#align order_hom.gfp OrderHom.gfp
theorem lfp_le {a : α} (h : f a ≤ a) : lfp f ≤ a :=
sInf_le h
#align order_hom.lfp_le OrderHom.lfp_le
theorem lfp_le_fixed {a : α} (h : f a = a) : lfp f ≤ a :=
f.lfp_le h.le
#align order_hom.lfp_le_fixed OrderHom.lfp_le_fixed
theorem le_lfp {a : α} (h : ∀ b, f b ≤ b → a ≤ b) : a ≤ lfp f :=
le_sInf h
#align order_hom.le_lfp OrderHom.le_lfp
-- Porting note: for the rest of the file, replace the dot notation `_.lfp` with `lfp _`
-- same for `_.gfp`, `_.dual`
-- Probably related to https://github.com/leanprover/lean4/issues/1910
theorem map_le_lfp {a : α} (ha : a ≤ lfp f) : f a ≤ lfp f :=
f.le_lfp fun _ hb => (f.mono <| le_sInf_iff.1 ha _ hb).trans hb
#align order_hom.map_le_lfp OrderHom.map_le_lfp
@[simp]
theorem map_lfp : f (lfp f) = lfp f :=
have h : f (lfp f) ≤ lfp f := f.map_le_lfp le_rfl
h.antisymm <| f.lfp_le <| f.mono h
#align order_hom.map_lfp OrderHom.map_lfp
theorem isFixedPt_lfp : IsFixedPt f (lfp f) :=
f.map_lfp
#align order_hom.is_fixed_pt_lfp OrderHom.isFixedPt_lfp
theorem lfp_le_map {a : α} (ha : lfp f ≤ a) : lfp f ≤ f a :=
calc
lfp f = f (lfp f) := f.map_lfp.symm
_ ≤ f a := f.mono ha
#align order_hom.lfp_le_map OrderHom.lfp_le_map
theorem isLeast_lfp_le : IsLeast { a | f a ≤ a } (lfp f) :=
⟨f.map_lfp.le, fun _ => f.lfp_le⟩
#align order_hom.is_least_lfp_le OrderHom.isLeast_lfp_le
theorem isLeast_lfp : IsLeast (fixedPoints f) (lfp f) :=
⟨f.isFixedPt_lfp, fun _ => f.lfp_le_fixed⟩
#align order_hom.is_least_lfp OrderHom.isLeast_lfp_le
| Mathlib/Order/FixedPoints.lean | 100 | 107 | theorem lfp_induction {p : α → Prop} (step : ∀ a, p a → a ≤ lfp f → p (f a))
(hSup : ∀ s, (∀ a ∈ s, p a) → p (sSup s)) : p (lfp f) := by |
set s := { a | a ≤ lfp f ∧ p a }
specialize hSup s fun a => And.right
suffices sSup s = lfp f from this ▸ hSup
have h : sSup s ≤ lfp f := sSup_le fun b => And.left
have hmem : f (sSup s) ∈ s := ⟨f.map_le_lfp h, step _ hSup h⟩
exact h.antisymm (f.lfp_le <| le_sSup hmem)
| 6 | 403.428793 | 2 | 2 | 1 | 1,999 |
import Mathlib.LinearAlgebra.Alternating.Basic
import Mathlib.LinearAlgebra.Multilinear.TensorProduct
import Mathlib.GroupTheory.GroupAction.Quotient
#align_import linear_algebra.alternating from "leanprover-community/mathlib"@"0c1d80f5a86b36c1db32e021e8d19ae7809d5b79"
suppress_compilation
open TensorProduct
variable {ιa ιb : Type*} [Fintype ιa] [Fintype ιb]
variable {R' : Type*} {Mᵢ N₁ N₂ : Type*} [CommSemiring R'] [AddCommGroup N₁] [Module R' N₁]
[AddCommGroup N₂] [Module R' N₂] [AddCommMonoid Mᵢ] [Module R' Mᵢ]
open Equiv
| Mathlib/LinearAlgebra/Alternating/DomCoprod.lean | 212 | 222 | theorem MultilinearMap.domCoprod_alternization_coe [DecidableEq ιa] [DecidableEq ιb]
(a : MultilinearMap R' (fun _ : ιa => Mᵢ) N₁) (b : MultilinearMap R' (fun _ : ιb => Mᵢ) N₂) :
MultilinearMap.domCoprod (MultilinearMap.alternatization a)
(MultilinearMap.alternatization b) =
∑ σa : Perm ιa, ∑ σb : Perm ιb,
Equiv.Perm.sign σa • Equiv.Perm.sign σb •
MultilinearMap.domCoprod (a.domDomCongr σa) (b.domDomCongr σb) := by |
simp_rw [← MultilinearMap.domCoprod'_apply, MultilinearMap.alternatization_coe]
simp_rw [TensorProduct.sum_tmul, TensorProduct.tmul_sum, _root_.map_sum,
← TensorProduct.smul_tmul', TensorProduct.tmul_smul]
rfl
| 4 | 54.59815 | 2 | 2 | 1 | 2,352 |
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
| Mathlib/Algebra/Polynomial/Reverse.lean | 40 | 47 | 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
| 7 | 1,096.633158 | 2 | 1 | 12 | 945 |
import Mathlib.RingTheory.Finiteness
import Mathlib.Logic.Equiv.TransferInstance
universe u v w
open Function
variable (R : Type u) [Semiring R]
@[mk_iff]
class OrzechProperty : Prop where
injective_of_surjective_of_submodule' : ∀ {M : Type u} [AddCommMonoid M] [Module R M]
[Module.Finite R M] {N : Submodule R M} (f : N →ₗ[R] M), Surjective f → Injective f
namespace OrzechProperty
variable {R}
variable [OrzechProperty R] {M : Type v} [AddCommMonoid M] [Module R M] [Module.Finite R M]
| Mathlib/RingTheory/OrzechProperty.lean | 69 | 82 | theorem injective_of_surjective_of_injective
{N : Type w} [AddCommMonoid N] [Module R N]
(i f : N →ₗ[R] M) (hi : Injective i) (hf : Surjective f) : Injective f := by |
obtain ⟨n, g, hg⟩ := Module.Finite.exists_fin' R M
haveI := small_of_surjective hg
letI := Equiv.addCommMonoid (equivShrink M).symm
letI := Equiv.module R (equivShrink M).symm
let j : Shrink.{u} M ≃ₗ[R] M := Equiv.linearEquiv R (equivShrink M).symm
haveI := Module.Finite.equiv j.symm
let i' := j.symm.toLinearMap ∘ₗ i
replace hi : Injective i' := by simpa [i'] using hi
let f' := j.symm.toLinearMap ∘ₗ f ∘ₗ (LinearEquiv.ofInjective i' hi).symm.toLinearMap
replace hf : Surjective f' := by simpa [f'] using hf
simpa [f'] using injective_of_surjective_of_submodule' f' hf
| 11 | 59,874.141715 | 2 | 2 | 1 | 1,940 |
import Mathlib.Init.Data.Sigma.Lex
import Mathlib.Data.Prod.Lex
import Mathlib.Data.Sigma.Lex
import Mathlib.Order.Antichain
import Mathlib.Order.OrderIsoNat
import Mathlib.Order.WellFounded
import Mathlib.Tactic.TFAE
#align_import order.well_founded_set from "leanprover-community/mathlib"@"2c84c2c5496117349007d97104e7bbb471381592"
variable {ι α β γ : Type*} {π : ι → Type*}
namespace Set
def WellFoundedOn (s : Set α) (r : α → α → Prop) : Prop :=
WellFounded fun a b : s => r a b
#align set.well_founded_on Set.WellFoundedOn
@[simp]
theorem wellFoundedOn_empty (r : α → α → Prop) : WellFoundedOn ∅ r :=
wellFounded_of_isEmpty _
#align set.well_founded_on_empty Set.wellFoundedOn_empty
section WellFoundedOn
variable {r r' : α → α → Prop}
section AnyRel
variable {f : β → α} {s t : Set α} {x y : α}
theorem wellFoundedOn_iff :
s.WellFoundedOn r ↔ WellFounded fun a b : α => r a b ∧ a ∈ s ∧ b ∈ s := by
have f : RelEmbedding (fun (a : s) (b : s) => r a b) fun a b : α => r a b ∧ a ∈ s ∧ b ∈ s :=
⟨⟨(↑), Subtype.coe_injective⟩, by simp⟩
refine ⟨fun h => ?_, f.wellFounded⟩
rw [WellFounded.wellFounded_iff_has_min]
intro t ht
by_cases hst : (s ∩ t).Nonempty
· rw [← Subtype.preimage_coe_nonempty] at hst
rcases h.has_min (Subtype.val ⁻¹' t) hst with ⟨⟨m, ms⟩, mt, hm⟩
exact ⟨m, mt, fun x xt ⟨xm, xs, _⟩ => hm ⟨x, xs⟩ xt xm⟩
· rcases ht with ⟨m, mt⟩
exact ⟨m, mt, fun x _ ⟨_, _, ms⟩ => hst ⟨m, ⟨ms, mt⟩⟩⟩
#align set.well_founded_on_iff Set.wellFoundedOn_iff
@[simp]
theorem wellFoundedOn_univ : (univ : Set α).WellFoundedOn r ↔ WellFounded r := by
simp [wellFoundedOn_iff]
#align set.well_founded_on_univ Set.wellFoundedOn_univ
theorem _root_.WellFounded.wellFoundedOn : WellFounded r → s.WellFoundedOn r :=
InvImage.wf _
#align well_founded.well_founded_on WellFounded.wellFoundedOn
@[simp]
theorem wellFoundedOn_range : (range f).WellFoundedOn r ↔ WellFounded (r on f) := by
let f' : β → range f := fun c => ⟨f c, c, rfl⟩
refine ⟨fun h => (InvImage.wf f' h).mono fun c c' => id, fun h => ⟨?_⟩⟩
rintro ⟨_, c, rfl⟩
refine Acc.of_downward_closed f' ?_ _ ?_
· rintro _ ⟨_, c', rfl⟩ -
exact ⟨c', rfl⟩
· exact h.apply _
#align set.well_founded_on_range Set.wellFoundedOn_range
@[simp]
theorem wellFoundedOn_image {s : Set β} : (f '' s).WellFoundedOn r ↔ s.WellFoundedOn (r on f) := by
rw [image_eq_range]; exact wellFoundedOn_range
#align set.well_founded_on_image Set.wellFoundedOn_image
namespace WellFoundedOn
protected theorem induction (hs : s.WellFoundedOn r) (hx : x ∈ s) {P : α → Prop}
(hP : ∀ y ∈ s, (∀ z ∈ s, r z y → P z) → P y) : P x := by
let Q : s → Prop := fun y => P y
change Q ⟨x, hx⟩
refine WellFounded.induction hs ⟨x, hx⟩ ?_
simpa only [Subtype.forall]
#align set.well_founded_on.induction Set.WellFoundedOn.induction
protected theorem mono (h : t.WellFoundedOn r') (hle : r ≤ r') (hst : s ⊆ t) :
s.WellFoundedOn r := by
rw [wellFoundedOn_iff] at *
exact Subrelation.wf (fun xy => ⟨hle _ _ xy.1, hst xy.2.1, hst xy.2.2⟩) h
#align set.well_founded_on.mono Set.WellFoundedOn.mono
theorem mono' (h : ∀ (a) (_ : a ∈ s) (b) (_ : b ∈ s), r' a b → r a b) :
s.WellFoundedOn r → s.WellFoundedOn r' :=
Subrelation.wf @fun a b => h _ a.2 _ b.2
#align set.well_founded_on.mono' Set.WellFoundedOn.mono'
theorem subset (h : t.WellFoundedOn r) (hst : s ⊆ t) : s.WellFoundedOn r :=
h.mono le_rfl hst
#align set.well_founded_on.subset Set.WellFoundedOn.subset
open Relation
open List in
| Mathlib/Order/WellFoundedSet.lean | 146 | 161 | theorem acc_iff_wellFoundedOn {α} {r : α → α → Prop} {a : α} :
TFAE [Acc r a,
WellFoundedOn { b | ReflTransGen r b a } r,
WellFoundedOn { b | TransGen r b a } r] := by |
tfae_have 1 → 2
· refine fun h => ⟨fun b => InvImage.accessible _ ?_⟩
rw [← acc_transGen_iff] at h ⊢
obtain h' | h' := reflTransGen_iff_eq_or_transGen.1 b.2
· rwa [h'] at h
· exact h.inv h'
tfae_have 2 → 3
· exact fun h => h.subset fun _ => TransGen.to_reflTransGen
tfae_have 3 → 1
· refine fun h => Acc.intro _ (fun b hb => (h.apply ⟨b, .single hb⟩).of_fibration Subtype.val ?_)
exact fun ⟨c, hc⟩ d h => ⟨⟨d, .head h hc⟩, h, rfl⟩
tfae_finish
| 12 | 162,754.791419 | 2 | 1.5 | 10 | 1,649 |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Data.Set.Function
#align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set MeasureTheory.MeasureSpace
variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ}
theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
(∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
· apply Icc_subset_Icc
· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
simp only [Nat.cast_zero, add_zero]
_ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i < a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
apply hf _ _ hx.1
· simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left,
Nat.cast_le, and_self_iff]
· refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩
simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia]
_ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp
#align antitone_on.integral_le_sum AntitoneOn.integral_le_sum
| Mathlib/Analysis/SumIntegralComparisons.lean | 73 | 95 | theorem AntitoneOn.integral_le_sum_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) :
(∫ x in a..b, f x) ≤ ∑ x ∈ Finset.Ico a b, f x := by |
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
· skip
· skip
rw [add_comm]
· skip
· skip
congr
congr
rw [← zero_add a]
rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
rhs
congr
· skip
ext
rw [Nat.cast_add]
apply AntitoneOn.integral_le_sum
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
| 21 | 1,318,815,734.483215 | 2 | 2 | 4 | 2,208 |
import Mathlib.Analysis.InnerProductSpace.Orientation
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
#align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
variable {ι E F : Type*}
variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F]
[MeasurableSpace F] [BorelSpace F]
section
variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)]
theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n))
(b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by
have e : ι ≃ Fin n := by
refine Fintype.equivFinOfCardEq ?_
rw [← _i.out, finrank_eq_card_basis b.toBasis]
have A : ⇑b = b.reindex e ∘ e := by
ext x
simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply]
rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped,
o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one]
#align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis
| Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean | 48 | 54 | theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) :
o.volumeForm.measure = volume := by |
have A : o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = 1 :=
Orientation.measure_orthonormalBasis o (stdOrthonormalBasis ℝ F)
rw [addHaarMeasure_unique o.volumeForm.measure
(stdOrthonormalBasis ℝ F).toBasis.parallelepiped, A, one_smul]
simp only [volume, Basis.addHaar]
| 5 | 148.413159 | 2 | 1.857143 | 7 | 1,924 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
theorem differentiableWithinAt_arcsin_Ici {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩
rintro h rfl
have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by
filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using
sin_arcsin'
have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp)
simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
#align real.differentiable_within_at_arcsin_Ici Real.differentiableWithinAt_arcsin_Ici
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 93 | 98 | theorem differentiableWithinAt_arcsin_Iic {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Iic x) x ↔ x ≠ 1 := by |
refine ⟨fun h => ?_, fun h => (hasDerivWithinAt_arcsin_Iic h).differentiableWithinAt⟩
rw [← neg_neg x, ← image_neg_Ici] at h
have := (h.comp (-x) differentiableWithinAt_id.neg (mapsTo_image _ _)).neg
simpa [(· ∘ ·), differentiableWithinAt_arcsin_Ici] using this
| 4 | 54.59815 | 2 | 2 | 6 | 2,119 |
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.Analysis.SumIntegralComparisons
import Mathlib.NumberTheory.Harmonic.Defs
theorem log_add_one_le_harmonic (n : ℕ) :
Real.log ↑(n+1) ≤ harmonic n := by
calc _ = ∫ x in (1:ℕ)..↑(n+1), x⁻¹ := ?_
_ ≤ ∑ d ∈ Finset.Icc 1 n, (d:ℝ)⁻¹ := ?_
_ = harmonic n := ?_
· rw [Nat.cast_one, integral_inv (by simp [(show ¬ (1 : ℝ) ≤ 0 by norm_num)]), div_one]
· exact (inv_antitoneOn_Icc_right <| by norm_num).integral_le_sum_Ico (Nat.le_add_left 1 n)
· simp only [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
theorem harmonic_le_one_add_log (n : ℕ) :
harmonic n ≤ 1 + Real.log n := by
by_cases hn0 : n = 0
· simp [hn0]
have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr hn0
simp_rw [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
rw [← Finset.sum_erase_add (Finset.Icc 1 n) _ (Finset.left_mem_Icc.mpr hn), add_comm,
Nat.cast_one, inv_one]
refine add_le_add_left ?_ 1
simp only [Nat.lt_one_iff, Finset.mem_Icc, Finset.Icc_erase_left]
calc ∑ d ∈ .Ico 2 (n + 1), (d : ℝ)⁻¹
_ = ∑ d ∈ .Ico 2 (n + 1), (↑(d + 1) - 1)⁻¹ := ?_
_ ≤ ∫ x in (2).. ↑(n + 1), (x - 1)⁻¹ := ?_
_ = ∫ x in (1)..n, x⁻¹ := ?_
_ = Real.log ↑n := ?_
· simp_rw [Nat.cast_add, Nat.cast_one, add_sub_cancel_right]
· exact @AntitoneOn.sum_le_integral_Ico 2 (n + 1) (fun x : ℝ ↦ (x - 1)⁻¹) (by linarith [hn]) <|
sub_inv_antitoneOn_Icc_right (by norm_num)
· convert intervalIntegral.integral_comp_sub_right _ 1
· norm_num
· simp only [Nat.cast_add, Nat.cast_one, add_sub_cancel_right]
· convert integral_inv _
· rw [div_one]
· simp only [Nat.one_le_cast, hn, Set.uIcc_of_le, Set.mem_Icc, Nat.cast_nonneg,
and_true, not_le, zero_lt_one]
| Mathlib/NumberTheory/Harmonic/Bounds.lean | 52 | 62 | theorem log_le_harmonic_floor (y : ℝ) (hy : 0 ≤ y) :
Real.log y ≤ harmonic ⌊y⌋₊ := by |
by_cases h0 : y = 0
· simp [h0]
· calc
_ ≤ Real.log ↑(Nat.floor y + 1) := ?_
_ ≤ _ := log_add_one_le_harmonic _
gcongr
apply (Nat.le_ceil y).trans
norm_cast
exact Nat.ceil_le_floor_add_one y
| 9 | 8,103.083928 | 2 | 2 | 4 | 2,289 |
import Mathlib.Order.Interval.Set.Image
import Mathlib.Order.CompleteLatticeIntervals
import Mathlib.Topology.Order.DenselyOrdered
import Mathlib.Topology.Order.Monotone
#align_import topology.algebra.order.intermediate_value from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Filter OrderDual TopologicalSpace Function Set
open Topology Filter
universe u v w
section
variable {X : Type u} {α : Type v} [TopologicalSpace X] [LinearOrder α] [TopologicalSpace α]
[OrderClosedTopology α]
theorem intermediate_value_univ₂ [PreconnectedSpace X] {a b : X} {f g : X → α} (hf : Continuous f)
(hg : Continuous g) (ha : f a ≤ g a) (hb : g b ≤ f b) : ∃ x, f x = g x := by
obtain ⟨x, _, hfg, hgf⟩ : (univ ∩ { x | f x ≤ g x ∧ g x ≤ f x }).Nonempty :=
isPreconnected_closed_iff.1 PreconnectedSpace.isPreconnected_univ _ _ (isClosed_le hf hg)
(isClosed_le hg hf) (fun _ _ => le_total _ _) ⟨a, trivial, ha⟩ ⟨b, trivial, hb⟩
exact ⟨x, le_antisymm hfg hgf⟩
#align intermediate_value_univ₂ intermediate_value_univ₂
theorem intermediate_value_univ₂_eventually₁ [PreconnectedSpace X] {a : X} {l : Filter X} [NeBot l]
{f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (he : g ≤ᶠ[l] f) :
∃ x, f x = g x :=
let ⟨_, h⟩ := he.exists; intermediate_value_univ₂ hf hg ha h
#align intermediate_value_univ₂_eventually₁ intermediate_value_univ₂_eventually₁
theorem intermediate_value_univ₂_eventually₂ [PreconnectedSpace X] {l₁ l₂ : Filter X} [NeBot l₁]
[NeBot l₂] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (he₁ : f ≤ᶠ[l₁] g)
(he₂ : g ≤ᶠ[l₂] f) : ∃ x, f x = g x :=
let ⟨_, h₁⟩ := he₁.exists
let ⟨_, h₂⟩ := he₂.exists
intermediate_value_univ₂ hf hg h₁ h₂
#align intermediate_value_univ₂_eventually₂ intermediate_value_univ₂_eventually₂
theorem IsPreconnected.intermediate_value₂ {s : Set X} (hs : IsPreconnected s) {a b : X}
(ha : a ∈ s) (hb : b ∈ s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s)
(ha' : f a ≤ g a) (hb' : g b ≤ f b) : ∃ x ∈ s, f x = g x :=
let ⟨x, hx⟩ :=
@intermediate_value_univ₂ s α _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ ⟨b, hb⟩ _ _
(continuousOn_iff_continuous_restrict.1 hf) (continuousOn_iff_continuous_restrict.1 hg) ha'
hb'
⟨x, x.2, hx⟩
#align is_preconnected.intermediate_value₂ IsPreconnected.intermediate_value₂
theorem IsPreconnected.intermediate_value₂_eventually₁ {s : Set X} (hs : IsPreconnected s) {a : X}
{l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f g : X → α} (hf : ContinuousOn f s)
(hg : ContinuousOn g s) (ha' : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x ∈ s, f x = g x := by
rw [continuousOn_iff_continuous_restrict] at hf hg
obtain ⟨b, h⟩ :=
@intermediate_value_univ₂_eventually₁ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ _
(comap_coe_neBot_of_le_principal hl) _ _ hf hg ha' (he.comap _)
exact ⟨b, b.prop, h⟩
#align is_preconnected.intermediate_value₂_eventually₁ IsPreconnected.intermediate_value₂_eventually₁
| Mathlib/Topology/Order/IntermediateValue.lean | 115 | 124 | theorem IsPreconnected.intermediate_value₂_eventually₂ {s : Set X} (hs : IsPreconnected s)
{l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f g : X → α}
(hf : ContinuousOn f s) (hg : ContinuousOn g s) (he₁ : f ≤ᶠ[l₁] g) (he₂ : g ≤ᶠ[l₂] f) :
∃ x ∈ s, f x = g x := by |
rw [continuousOn_iff_continuous_restrict] at hf hg
obtain ⟨b, h⟩ :=
@intermediate_value_univ₂_eventually₂ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) _ _
(comap_coe_neBot_of_le_principal hl₁) (comap_coe_neBot_of_le_principal hl₂) _ _ hf hg
(he₁.comap _) (he₂.comap _)
exact ⟨b, b.prop, h⟩
| 6 | 403.428793 | 2 | 2 | 3 | 2,458 |
import Mathlib.Probability.IdentDistrib
import Mathlib.MeasureTheory.Integral.DominatedConvergence
import Mathlib.Analysis.SpecificLimits.FloorPow
import Mathlib.Analysis.PSeries
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
#align_import probability.strong_law from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open MeasureTheory Filter Finset Asymptotics
open Set (indicator)
open scoped Topology MeasureTheory ProbabilityTheory ENNReal NNReal
namespace ProbabilityTheory
section Truncation
variable {α : Type*}
def truncation (f : α → ℝ) (A : ℝ) :=
indicator (Set.Ioc (-A) A) id ∘ f
#align probability_theory.truncation ProbabilityTheory.truncation
variable {m : MeasurableSpace α} {μ : Measure α} {f : α → ℝ}
theorem _root_.MeasureTheory.AEStronglyMeasurable.truncation (hf : AEStronglyMeasurable f μ)
{A : ℝ} : AEStronglyMeasurable (truncation f A) μ := by
apply AEStronglyMeasurable.comp_aemeasurable _ hf.aemeasurable
exact (stronglyMeasurable_id.indicator measurableSet_Ioc).aestronglyMeasurable
#align measure_theory.ae_strongly_measurable.truncation MeasureTheory.AEStronglyMeasurable.truncation
theorem abs_truncation_le_bound (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |A| := by
simp only [truncation, Set.indicator, Set.mem_Icc, id, Function.comp_apply]
split_ifs with h
· exact abs_le_abs h.2 (neg_le.2 h.1.le)
· simp [abs_nonneg]
#align probability_theory.abs_truncation_le_bound ProbabilityTheory.abs_truncation_le_bound
@[simp]
theorem truncation_zero (f : α → ℝ) : truncation f 0 = 0 := by simp [truncation]; rfl
#align probability_theory.truncation_zero ProbabilityTheory.truncation_zero
theorem abs_truncation_le_abs_self (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |f x| := by
simp only [truncation, indicator, Set.mem_Icc, id, Function.comp_apply]
split_ifs
· exact le_rfl
· simp [abs_nonneg]
#align probability_theory.abs_truncation_le_abs_self ProbabilityTheory.abs_truncation_le_abs_self
theorem truncation_eq_self {f : α → ℝ} {A : ℝ} {x : α} (h : |f x| < A) :
truncation f A x = f x := by
simp only [truncation, indicator, Set.mem_Icc, id, Function.comp_apply, ite_eq_left_iff]
intro H
apply H.elim
simp [(abs_lt.1 h).1, (abs_lt.1 h).2.le]
#align probability_theory.truncation_eq_self ProbabilityTheory.truncation_eq_self
theorem truncation_eq_of_nonneg {f : α → ℝ} {A : ℝ} (h : ∀ x, 0 ≤ f x) :
truncation f A = indicator (Set.Ioc 0 A) id ∘ f := by
ext x
rcases (h x).lt_or_eq with (hx | hx)
· simp only [truncation, indicator, hx, Set.mem_Ioc, id, Function.comp_apply, true_and_iff]
by_cases h'x : f x ≤ A
· have : -A < f x := by linarith [h x]
simp only [this, true_and_iff]
· simp only [h'x, and_false_iff]
· simp only [truncation, indicator, hx, id, Function.comp_apply, ite_self]
#align probability_theory.truncation_eq_of_nonneg ProbabilityTheory.truncation_eq_of_nonneg
theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) : 0 ≤ truncation f A x :=
Set.indicator_apply_nonneg fun _ => h
#align probability_theory.truncation_nonneg ProbabilityTheory.truncation_nonneg
theorem _root_.MeasureTheory.AEStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
Memℒp.of_bound hf.truncation |A| (eventually_of_forall fun _ => abs_truncation_le_bound _ _ _)
#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation
theorem _root_.MeasureTheory.AEStronglyMeasurable.integrable_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ := by
rw [← memℒp_one_iff_integrable]; exact hf.memℒp_truncation
#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AEStronglyMeasurable.integrable_truncation
theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A)
{n : ℕ} (hn : n ≠ 0) : ∫ x, truncation f A x ^ n ∂μ = ∫ y in -A..A, y ^ n ∂Measure.map f μ := by
have M : MeasurableSet (Set.Ioc (-A) A) := measurableSet_Ioc
change ∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = _
rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le,
← integral_indicator M]
· simp only [indicator, zero_pow hn, id, ite_pow]
· linarith
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral ProbabilityTheory.moment_truncation_eq_intervalIntegral
| Mathlib/Probability/StrongLaw.lean | 151 | 175 | theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ}
{n : ℕ} (hn : n ≠ 0) (h'f : 0 ≤ f) :
∫ x, truncation f A x ^ n ∂μ = ∫ y in (0)..A, y ^ n ∂Measure.map f μ := by |
have M : MeasurableSet (Set.Ioc 0 A) := measurableSet_Ioc
have M' : MeasurableSet (Set.Ioc A 0) := measurableSet_Ioc
rw [truncation_eq_of_nonneg h'f]
change ∫ x, (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = _
rcases le_or_lt 0 A with (hA | hA)
· rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le hA,
← integral_indicator M]
· simp only [indicator, zero_pow hn, id, ite_pow]
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
· rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_ge hA.le,
← integral_indicator M']
· simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow hn, Set.indicator_empty, integral_zero,
zero_eq_neg]
apply integral_eq_zero_of_ae
have : ∀ᵐ x ∂Measure.map f μ, (0 : ℝ) ≤ x :=
(ae_map_iff hf.aemeasurable measurableSet_Ici).2 (eventually_of_forall h'f)
filter_upwards [this] with x hx
simp only [indicator, Set.mem_Ioc, Pi.zero_apply, ite_eq_right_iff, and_imp]
intro _ h''x
have : x = 0 := by linarith
simp [this, zero_pow hn]
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
| 22 | 3,584,912,846.131591 | 2 | 1.444444 | 9 | 1,531 |
import Mathlib.Init.Data.Sigma.Lex
import Mathlib.Data.Prod.Lex
import Mathlib.Data.Sigma.Lex
import Mathlib.Order.Antichain
import Mathlib.Order.OrderIsoNat
import Mathlib.Order.WellFounded
import Mathlib.Tactic.TFAE
#align_import order.well_founded_set from "leanprover-community/mathlib"@"2c84c2c5496117349007d97104e7bbb471381592"
variable {ι α β γ : Type*} {π : ι → Type*}
namespace Set
def WellFoundedOn (s : Set α) (r : α → α → Prop) : Prop :=
WellFounded fun a b : s => r a b
#align set.well_founded_on Set.WellFoundedOn
@[simp]
theorem wellFoundedOn_empty (r : α → α → Prop) : WellFoundedOn ∅ r :=
wellFounded_of_isEmpty _
#align set.well_founded_on_empty Set.wellFoundedOn_empty
section WellFoundedOn
variable {r r' : α → α → Prop}
section AnyRel
variable {f : β → α} {s t : Set α} {x y : α}
| Mathlib/Order/WellFoundedSet.lean | 76 | 88 | theorem wellFoundedOn_iff :
s.WellFoundedOn r ↔ WellFounded fun a b : α => r a b ∧ a ∈ s ∧ b ∈ s := by |
have f : RelEmbedding (fun (a : s) (b : s) => r a b) fun a b : α => r a b ∧ a ∈ s ∧ b ∈ s :=
⟨⟨(↑), Subtype.coe_injective⟩, by simp⟩
refine ⟨fun h => ?_, f.wellFounded⟩
rw [WellFounded.wellFounded_iff_has_min]
intro t ht
by_cases hst : (s ∩ t).Nonempty
· rw [← Subtype.preimage_coe_nonempty] at hst
rcases h.has_min (Subtype.val ⁻¹' t) hst with ⟨⟨m, ms⟩, mt, hm⟩
exact ⟨m, mt, fun x xt ⟨xm, xs, _⟩ => hm ⟨x, xs⟩ xt xm⟩
· rcases ht with ⟨m, mt⟩
exact ⟨m, mt, fun x _ ⟨_, _, ms⟩ => hst ⟨m, ⟨ms, mt⟩⟩⟩
| 11 | 59,874.141715 | 2 | 1.5 | 10 | 1,649 |
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Tactic.Monotonicity
#align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
open Int
variable {K : Type*} {v : K} {n : ℕ} [LinearOrderedField K] [FloorRing K]
namespace IntFractPair
theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1 := by
cases n with
| zero =>
have : IntFractPair.of v = ifp_n := by injection nth_stream_eq
rw [← this, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
| succ =>
rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩
rw [← ifp_of_eq_ifp_n, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg_lt_one
theorem nth_stream_fr_nonneg {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr :=
(nth_stream_fr_nonneg_lt_one nth_stream_eq).left
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg
theorem nth_stream_fr_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : ifp_n.fr < 1 :=
(nth_stream_fr_nonneg_lt_one nth_stream_eq).right
#align generalized_continued_fraction.int_fract_pair.nth_stream_fr_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_lt_one
| Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean | 96 | 107 | theorem one_le_succ_nth_stream_b {ifp_succ_n : IntFractPair K}
(succ_nth_stream_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n) : 1 ≤ ifp_succ_n.b := by |
obtain ⟨ifp_n, nth_stream_eq, stream_nth_fr_ne_zero, ⟨-⟩⟩ :
∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧ ifp_n.fr ≠ 0
∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n :=
succ_nth_stream_eq_some_iff.1 succ_nth_stream_eq
suffices 1 ≤ ifp_n.fr⁻¹ by rwa [IntFractPair.of, le_floor, cast_one]
suffices ifp_n.fr ≤ 1 by
have h : 0 < ifp_n.fr :=
lt_of_le_of_ne (nth_stream_fr_nonneg nth_stream_eq) stream_nth_fr_ne_zero.symm
apply one_le_inv h this
simp only [le_of_lt (nth_stream_fr_lt_one nth_stream_eq)]
| 10 | 22,026.465795 | 2 | 2 | 3 | 2,182 |
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic
import Mathlib.RingTheory.GradedAlgebra.Basic
#align_import linear_algebra.exterior_algebra.grading from "leanprover-community/mathlib"@"34020e531ebc4e8aac6d449d9eecbcd1508ea8d0"
namespace ExteriorAlgebra
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
variable (R M)
open scoped DirectSum
-- Porting note: protected
protected def GradedAlgebra.ι :
M →ₗ[R] ⨁ i : ℕ, ⋀[R]^i M :=
DirectSum.lof R ℕ (fun i => ⋀[R]^i M) 1 ∘ₗ
(ι R).codRestrict _ fun m => by simpa only [pow_one] using LinearMap.mem_range_self _ m
#align exterior_algebra.graded_algebra.ι ExteriorAlgebra.GradedAlgebra.ι
theorem GradedAlgebra.ι_apply (m : M) :
GradedAlgebra.ι R M m =
DirectSum.of (fun i : ℕ => ⋀[R]^i M) 1
⟨ι R m, by simpa only [pow_one] using LinearMap.mem_range_self _ m⟩ :=
rfl
#align exterior_algebra.graded_algebra.ι_apply ExteriorAlgebra.GradedAlgebra.ι_apply
-- Defining this instance manually, because Lean doesn't seem to be able to synthesize it.
-- Strangely, this problem only appears when we use the abbreviation or notation for the
-- exterior powers.
instance : SetLike.GradedMonoid fun i : ℕ ↦ ⋀[R]^i M :=
Submodule.nat_power_gradedMonoid (LinearMap.range (ι R : M →ₗ[R] ExteriorAlgebra R M))
-- Porting note: Lean needs to be reminded of this instance otherwise it cannot
-- synthesize 0 in the next theorem
attribute [local instance 1100] MulZeroClass.toZero in
theorem GradedAlgebra.ι_sq_zero (m : M) : GradedAlgebra.ι R M m * GradedAlgebra.ι R M m = 0 := by
rw [GradedAlgebra.ι_apply, DirectSum.of_mul_of]
exact DFinsupp.single_eq_zero.mpr (Subtype.ext <| ExteriorAlgebra.ι_sq_zero _)
#align exterior_algebra.graded_algebra.ι_sq_zero ExteriorAlgebra.GradedAlgebra.ι_sq_zero
def GradedAlgebra.liftι :
ExteriorAlgebra R M →ₐ[R] ⨁ i : ℕ, ⋀[R]^i M :=
lift R ⟨by apply GradedAlgebra.ι R M, GradedAlgebra.ι_sq_zero R M⟩
#align exterior_algebra.graded_algebra.lift_ι ExteriorAlgebra.GradedAlgebra.liftι
| Mathlib/LinearAlgebra/ExteriorAlgebra/Grading.lean | 64 | 80 | theorem GradedAlgebra.liftι_eq (i : ℕ) (x : ⋀[R]^i M) :
GradedAlgebra.liftι R M x = DirectSum.of (fun i => ⋀[R]^i M) i x := by |
cases' x with x hx
dsimp only [Subtype.coe_mk, DirectSum.lof_eq_of]
-- Porting note: original statement was
-- refine Submodule.pow_induction_on_left' _ (fun r => ?_) (fun x y i hx hy ihx ihy => ?_)
-- (fun m hm i x hx ih => ?_) hx
-- but it created invalid goals
induction hx using Submodule.pow_induction_on_left' with
| algebraMap => simp_rw [AlgHom.commutes, DirectSum.algebraMap_apply]; rfl
-- FIXME: specialized `map_add` to avoid a (whole-declaration) timeout
| add _ _ _ _ _ ihx ihy => simp_rw [AlgHom.map_add, ihx, ihy, ← AddMonoidHom.map_add]; rfl
| mem_mul _ hm _ _ _ ih =>
obtain ⟨_, rfl⟩ := hm
simp_rw [AlgHom.map_mul, ih, GradedAlgebra.liftι, lift_ι_apply, GradedAlgebra.ι_apply R M,
DirectSum.of_mul_of]
exact DirectSum.of_eq_of_gradedMonoid_eq (Sigma.subtype_ext (add_comm _ _) rfl)
| 15 | 3,269,017.372472 | 2 | 1.5 | 2 | 1,670 |
import Mathlib.FieldTheory.Finite.Basic
#align_import number_theory.wilson from "leanprover-community/mathlib"@"c471da714c044131b90c133701e51b877c246677"
open Finset Nat FiniteField ZMod
open scoped Nat
namespace ZMod
variable (p : ℕ) [Fact p.Prime]
@[simp]
| Mathlib/NumberTheory/Wilson.lean | 40 | 69 | theorem wilsons_lemma : ((p - 1)! : ZMod p) = -1 := by |
refine
calc
((p - 1)! : ZMod p) = ∏ x ∈ Ico 1 (succ (p - 1)), (x : ZMod p) := by
rw [← Finset.prod_Ico_id_eq_factorial, prod_natCast]
_ = ∏ x : (ZMod p)ˣ, (x : ZMod p) := ?_
_ = -1 := by
-- Porting note: `simp` is less powerful.
-- simp_rw [← Units.coeHom_apply, ← (Units.coeHom (ZMod p)).map_prod,
-- prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one]
simp_rw [← Units.coeHom_apply]
rw [← map_prod (Units.coeHom (ZMod p))]
simp_rw [prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one]
have hp : 0 < p := (Fact.out (p := p.Prime)).pos
symm
refine prod_bij (fun a _ => (a : ZMod p).val) ?_ ?_ ?_ ?_
· intro a ha
rw [mem_Ico, ← Nat.succ_sub hp, Nat.add_one_sub_one]
constructor
· apply Nat.pos_of_ne_zero; rw [← @val_zero p]
intro h; apply Units.ne_zero a (val_injective p h)
· exact val_lt _
· intro _ _ _ _ h; rw [Units.ext_iff]; exact val_injective p h
· intro b hb
rw [mem_Ico, Nat.succ_le_iff, ← succ_sub hp, Nat.add_one_sub_one, pos_iff_ne_zero] at hb
refine ⟨Units.mk0 b ?_, Finset.mem_univ _, ?_⟩
· intro h; apply hb.1; apply_fun val at h
simpa only [val_cast_of_lt hb.right, val_zero] using h
· simp only [val_cast_of_lt hb.right, Units.val_mk0]
· rintro a -; simp only [cast_id, natCast_val]
| 29 | 3,931,334,297,144.042 | 2 | 2 | 3 | 2,454 |
import Mathlib.MeasureTheory.PiSystem
import Mathlib.Order.OmegaCompletePartialOrder
import Mathlib.Topology.Constructions
import Mathlib.MeasureTheory.MeasurableSpace.Basic
open Set
namespace MeasureTheory
variable {ι : Type _} {α : ι → Type _}
section cylinder
def cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : Set (∀ i, α i) :=
(fun (f : ∀ i, α i) (i : s) ↦ f i) ⁻¹' S
@[simp]
theorem mem_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) (f : ∀ i, α i) :
f ∈ cylinder s S ↔ (fun i : s ↦ f i) ∈ S :=
mem_preimage
@[simp]
theorem cylinder_empty (s : Finset ι) : cylinder s (∅ : Set (∀ i : s, α i)) = ∅ := by
rw [cylinder, preimage_empty]
@[simp]
theorem cylinder_univ (s : Finset ι) : cylinder s (univ : Set (∀ i : s, α i)) = univ := by
rw [cylinder, preimage_univ]
@[simp]
| Mathlib/MeasureTheory/Constructions/Cylinders.lean | 169 | 183 | theorem cylinder_eq_empty_iff [h_nonempty : Nonempty (∀ i, α i)] (s : Finset ι)
(S : Set (∀ i : s, α i)) :
cylinder s S = ∅ ↔ S = ∅ := by |
refine ⟨fun h ↦ ?_, fun h ↦ by (rw [h]; exact cylinder_empty _)⟩
by_contra hS
rw [← Ne, ← nonempty_iff_ne_empty] at hS
let f := hS.some
have hf : f ∈ S := hS.choose_spec
classical
let f' : ∀ i, α i := fun i ↦ if hi : i ∈ s then f ⟨i, hi⟩ else h_nonempty.some i
have hf' : f' ∈ cylinder s S := by
rw [mem_cylinder]
simpa only [f', Finset.coe_mem, dif_pos]
rw [h] at hf'
exact not_mem_empty _ hf'
| 12 | 162,754.791419 | 2 | 0.6875 | 16 | 636 |
import Mathlib.Data.Matrix.Basis
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.Pi
#align_import linear_algebra.std_basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
open Function Set Submodule
namespace LinearMap
variable (R : Type*) {ι : Type*} [Semiring R] (φ : ι → Type*) [∀ i, AddCommMonoid (φ i)]
[∀ i, Module R (φ i)] [DecidableEq ι]
def stdBasis : ∀ i : ι, φ i →ₗ[R] ∀ i, φ i :=
single
#align linear_map.std_basis LinearMap.stdBasis
theorem stdBasis_apply (i : ι) (b : φ i) : stdBasis R φ i b = update (0 : (a : ι) → φ a) i b :=
rfl
#align linear_map.std_basis_apply LinearMap.stdBasis_apply
@[simp]
theorem stdBasis_apply' (i i' : ι) : (stdBasis R (fun _x : ι => R) i) 1 i' = ite (i = i') 1 0 := by
rw [LinearMap.stdBasis_apply, Function.update_apply, Pi.zero_apply]
congr 1; rw [eq_iff_iff, eq_comm]
#align linear_map.std_basis_apply' LinearMap.stdBasis_apply'
theorem coe_stdBasis (i : ι) : ⇑(stdBasis R φ i) = Pi.single i :=
rfl
#align linear_map.coe_std_basis LinearMap.coe_stdBasis
@[simp]
theorem stdBasis_same (i : ι) (b : φ i) : stdBasis R φ i b i = b :=
Pi.single_eq_same i b
#align linear_map.std_basis_same LinearMap.stdBasis_same
theorem stdBasis_ne (i j : ι) (h : j ≠ i) (b : φ i) : stdBasis R φ i b j = 0 :=
Pi.single_eq_of_ne h b
#align linear_map.std_basis_ne LinearMap.stdBasis_ne
| Mathlib/LinearAlgebra/StdBasis.lean | 73 | 77 | theorem stdBasis_eq_pi_diag (i : ι) : stdBasis R φ i = pi (diag i) := by |
ext x j
-- Porting note: made types explicit
convert (update_apply (R := R) (φ := φ) (ι := ι) 0 x i j _).symm
rfl
| 4 | 54.59815 | 2 | 1.5 | 6 | 1,540 |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Logic.Function.Iterate
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Zify
#align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
namespace Nat
-- Porting note: Lean cannot find pp_nodot at the time of this port.
-- @[pp_nodot]
def fib (n : ℕ) : ℕ :=
((fun p : ℕ × ℕ => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst
#align nat.fib Nat.fib
@[simp]
theorem fib_zero : fib 0 = 0 :=
rfl
#align nat.fib_zero Nat.fib_zero
@[simp]
theorem fib_one : fib 1 = 1 :=
rfl
#align nat.fib_one Nat.fib_one
@[simp]
theorem fib_two : fib 2 = 1 :=
rfl
#align nat.fib_two Nat.fib_two
theorem fib_add_two {n : ℕ} : fib (n + 2) = fib n + fib (n + 1) := by
simp [fib, Function.iterate_succ_apply']
#align nat.fib_add_two Nat.fib_add_two
lemma fib_add_one : ∀ {n}, n ≠ 0 → fib (n + 1) = fib (n - 1) + fib n
| _n + 1, _ => fib_add_two
theorem fib_le_fib_succ {n : ℕ} : fib n ≤ fib (n + 1) := by cases n <;> simp [fib_add_two]
#align nat.fib_le_fib_succ Nat.fib_le_fib_succ
@[mono]
theorem fib_mono : Monotone fib :=
monotone_nat_of_le_succ fun _ => fib_le_fib_succ
#align nat.fib_mono Nat.fib_mono
@[simp] lemma fib_eq_zero : ∀ {n}, fib n = 0 ↔ n = 0
| 0 => Iff.rfl
| 1 => Iff.rfl
| n + 2 => by simp [fib_add_two, fib_eq_zero]
@[simp] lemma fib_pos {n : ℕ} : 0 < fib n ↔ 0 < n := by simp [pos_iff_ne_zero]
#align nat.fib_pos Nat.fib_pos
theorem fib_add_two_sub_fib_add_one {n : ℕ} : fib (n + 2) - fib (n + 1) = fib n := by
rw [fib_add_two, add_tsub_cancel_right]
#align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one
theorem fib_lt_fib_succ {n : ℕ} (hn : 2 ≤ n) : fib n < fib (n + 1) := by
rcases exists_add_of_le hn with ⟨n, rfl⟩
rw [← tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos]
exact succ_pos n
#align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ
theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by
refine strictMono_nat_of_lt_succ fun n => ?_
rw [add_right_comm]
exact fib_lt_fib_succ (self_le_add_left _ _)
#align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono
lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2)
| _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn
lemma fib_lt_fib {m : ℕ} (hm : 2 ≤ m) : ∀ {n}, fib m < fib n ↔ m < n
| 0 => by simp [hm]
| 1 => by simp [hm]
| n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp
theorem le_fib_self {n : ℕ} (five_le_n : 5 ≤ n) : n ≤ fib n := by
induction' five_le_n with n five_le_n IH
·-- 5 ≤ fib 5
rfl
· -- n + 1 ≤ fib (n + 1) for 5 ≤ n
rw [succ_le_iff]
calc
n ≤ fib n := IH
_ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n)
#align nat.le_fib_self Nat.le_fib_self
lemma le_fib_add_one : ∀ n, n ≤ fib n + 1
| 0 => zero_le_one
| 1 => one_le_two
| 2 => le_rfl
| 3 => le_rfl
| 4 => le_rfl
| _n + 5 => (le_fib_self le_add_self).trans <| le_succ _
| Mathlib/Data/Nat/Fib/Basic.lean | 156 | 161 | theorem fib_coprime_fib_succ (n : ℕ) : Nat.Coprime (fib n) (fib (n + 1)) := by |
induction' n with n ih
· simp
· rw [fib_add_two]
simp only [coprime_add_self_right]
simp [Coprime, ih.symm]
| 5 | 148.413159 | 2 | 1.181818 | 11 | 1,246 |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Conj
universe w v u
namespace CategoryTheory.Limits.Types
variable (C : Type u) [Category.{v} C]
def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1}
@[simps]
def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where
pt := PUnit
ι := { app := fun X => id }
noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where
desc s := s.ι.app Classical.ofNonempty
fac s j := by
ext ⟨⟩
apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit)
intros X Y f
exact congrFun (s.ι.naturality f).symm PUnit.unit
uniq s m h := by
ext ⟨⟩
simp [← h Classical.ofNonempty]
instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) :=
⟨_, isColimitPUnitCocone _⟩
instance instSubsingletonColimitPUnit
[IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] :
Subsingleton (colimit (constPUnitFunctor.{w} C)) where
allEq a b := by
obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a
obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b
apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit)
exact fun c d f => colimit_sound f rfl
noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] :
colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
| Mathlib/CategoryTheory/Limits/IsConnected.lean | 87 | 93 | theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j)
(h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by |
induction h with
| rel _ _ h => exact Zigzag.of_hom <| Exists.choose h
| refl _ => exact Zigzag.refl _
| symm _ _ _ ih => exact zigzag_symmetric ih
| trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
| 5 | 148.413159 | 2 | 2 | 4 | 2,211 |
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.GroupAction.Quotient
import Mathlib.GroupTheory.QuotientGroup
import Mathlib.Topology.Algebra.Monoid
import Mathlib.Topology.Algebra.Constructions
#align_import topology.algebra.group.basic from "leanprover-community/mathlib"@"3b1890e71632be9e3b2086ab512c3259a7e9a3ef"
open scoped Classical
open Set Filter TopologicalSpace Function Topology Pointwise MulOpposite
universe u v w x
variable {G : Type w} {H : Type x} {α : Type u} {β : Type v}
section ContinuousMulGroup
variable [TopologicalSpace G] [Group G] [ContinuousMul G]
@[to_additive "Addition from the left in a topological additive group as a homeomorphism."]
protected def Homeomorph.mulLeft (a : G) : G ≃ₜ G :=
{ Equiv.mulLeft a with
continuous_toFun := continuous_const.mul continuous_id
continuous_invFun := continuous_const.mul continuous_id }
#align homeomorph.mul_left Homeomorph.mulLeft
#align homeomorph.add_left Homeomorph.addLeft
@[to_additive (attr := simp)]
theorem Homeomorph.coe_mulLeft (a : G) : ⇑(Homeomorph.mulLeft a) = (a * ·) :=
rfl
#align homeomorph.coe_mul_left Homeomorph.coe_mulLeft
#align homeomorph.coe_add_left Homeomorph.coe_addLeft
@[to_additive]
theorem Homeomorph.mulLeft_symm (a : G) : (Homeomorph.mulLeft a).symm = Homeomorph.mulLeft a⁻¹ := by
ext
rfl
#align homeomorph.mul_left_symm Homeomorph.mulLeft_symm
#align homeomorph.add_left_symm Homeomorph.addLeft_symm
@[to_additive]
lemma isOpenMap_mul_left (a : G) : IsOpenMap (a * ·) := (Homeomorph.mulLeft a).isOpenMap
#align is_open_map_mul_left isOpenMap_mul_left
#align is_open_map_add_left isOpenMap_add_left
@[to_additive IsOpen.left_addCoset]
theorem IsOpen.leftCoset {U : Set G} (h : IsOpen U) (x : G) : IsOpen (x • U) :=
isOpenMap_mul_left x _ h
#align is_open.left_coset IsOpen.leftCoset
#align is_open.left_add_coset IsOpen.left_addCoset
@[to_additive]
lemma isClosedMap_mul_left (a : G) : IsClosedMap (a * ·) := (Homeomorph.mulLeft a).isClosedMap
#align is_closed_map_mul_left isClosedMap_mul_left
#align is_closed_map_add_left isClosedMap_add_left
@[to_additive IsClosed.left_addCoset]
theorem IsClosed.leftCoset {U : Set G} (h : IsClosed U) (x : G) : IsClosed (x • U) :=
isClosedMap_mul_left x _ h
#align is_closed.left_coset IsClosed.leftCoset
#align is_closed.left_add_coset IsClosed.left_addCoset
@[to_additive "Addition from the right in a topological additive group as a homeomorphism."]
protected def Homeomorph.mulRight (a : G) : G ≃ₜ G :=
{ Equiv.mulRight a with
continuous_toFun := continuous_id.mul continuous_const
continuous_invFun := continuous_id.mul continuous_const }
#align homeomorph.mul_right Homeomorph.mulRight
#align homeomorph.add_right Homeomorph.addRight
@[to_additive (attr := simp)]
lemma Homeomorph.coe_mulRight (a : G) : ⇑(Homeomorph.mulRight a) = (· * a) := rfl
#align homeomorph.coe_mul_right Homeomorph.coe_mulRight
#align homeomorph.coe_add_right Homeomorph.coe_addRight
@[to_additive]
theorem Homeomorph.mulRight_symm (a : G) :
(Homeomorph.mulRight a).symm = Homeomorph.mulRight a⁻¹ := by
ext
rfl
#align homeomorph.mul_right_symm Homeomorph.mulRight_symm
#align homeomorph.add_right_symm Homeomorph.addRight_symm
@[to_additive]
theorem isOpenMap_mul_right (a : G) : IsOpenMap (· * a) :=
(Homeomorph.mulRight a).isOpenMap
#align is_open_map_mul_right isOpenMap_mul_right
#align is_open_map_add_right isOpenMap_add_right
@[to_additive IsOpen.right_addCoset]
theorem IsOpen.rightCoset {U : Set G} (h : IsOpen U) (x : G) : IsOpen (op x • U) :=
isOpenMap_mul_right x _ h
#align is_open.right_coset IsOpen.rightCoset
#align is_open.right_add_coset IsOpen.right_addCoset
@[to_additive]
theorem isClosedMap_mul_right (a : G) : IsClosedMap (· * a) :=
(Homeomorph.mulRight a).isClosedMap
#align is_closed_map_mul_right isClosedMap_mul_right
#align is_closed_map_add_right isClosedMap_add_right
@[to_additive IsClosed.right_addCoset]
theorem IsClosed.rightCoset {U : Set G} (h : IsClosed U) (x : G) : IsClosed (op x • U) :=
isClosedMap_mul_right x _ h
#align is_closed.right_coset IsClosed.rightCoset
#align is_closed.right_add_coset IsClosed.right_addCoset
@[to_additive]
| Mathlib/Topology/Algebra/Group/Basic.lean | 146 | 154 | theorem discreteTopology_of_isOpen_singleton_one (h : IsOpen ({1} : Set G)) :
DiscreteTopology G := by |
rw [← singletons_open_iff_discrete]
intro g
suffices {g} = (g⁻¹ * ·) ⁻¹' {1} by
rw [this]
exact (continuous_mul_left g⁻¹).isOpen_preimage _ h
simp only [mul_one, Set.preimage_mul_left_singleton, eq_self_iff_true, inv_inv,
Set.singleton_eq_singleton_iff]
| 7 | 1,096.633158 | 2 | 1.333333 | 3 | 1,428 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 66 | 71 | theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by |
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
| 4 | 54.59815 | 2 | 2 | 6 | 2,119 |
import Mathlib.GroupTheory.Solvable
import Mathlib.FieldTheory.PolynomialGaloisGroup
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a"
noncomputable section
open scoped Classical Polynomial IntermediateField
open Polynomial IntermediateField
section AbelRuffini
variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E]
theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance
#align gal_zero_is_solvable gal_zero_isSolvable
theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance
#align gal_one_is_solvable gal_one_isSolvable
theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_C_is_solvable gal_C_isSolvable
theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_is_solvable gal_X_isSolvable
theorem gal_X_sub_C_isSolvable (x : F) : IsSolvable (X - C x).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_sub_C_is_solvable gal_X_sub_C_isSolvable
theorem gal_X_pow_isSolvable (n : ℕ) : IsSolvable (X ^ n : F[X]).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_pow_is_solvable gal_X_pow_isSolvable
theorem gal_mul_isSolvable {p q : F[X]} (_ : IsSolvable p.Gal) (_ : IsSolvable q.Gal) :
IsSolvable (p * q).Gal :=
solvable_of_solvable_injective (Gal.restrictProd_injective p q)
#align gal_mul_is_solvable gal_mul_isSolvable
theorem gal_prod_isSolvable {s : Multiset F[X]} (hs : ∀ p ∈ s, IsSolvable (Gal p)) :
IsSolvable s.prod.Gal := by
apply Multiset.induction_on' s
· exact gal_one_isSolvable
· intro p t hps _ ht
rw [Multiset.insert_eq_cons, Multiset.prod_cons]
exact gal_mul_isSolvable (hs p hps) ht
#align gal_prod_is_solvable gal_prod_isSolvable
theorem gal_isSolvable_of_splits {p q : F[X]}
(_ : Fact (p.Splits (algebraMap F q.SplittingField))) (hq : IsSolvable q.Gal) :
IsSolvable p.Gal :=
haveI : IsSolvable (q.SplittingField ≃ₐ[F] q.SplittingField) := hq
solvable_of_surjective (AlgEquiv.restrictNormalHom_surjective q.SplittingField)
#align gal_is_solvable_of_splits gal_isSolvable_of_splits
theorem gal_isSolvable_tower (p q : F[X]) (hpq : p.Splits (algebraMap F q.SplittingField))
(hp : IsSolvable p.Gal) (hq : IsSolvable (q.map (algebraMap F p.SplittingField)).Gal) :
IsSolvable q.Gal := by
let K := p.SplittingField
let L := q.SplittingField
haveI : Fact (p.Splits (algebraMap F L)) := ⟨hpq⟩
let ϕ : (L ≃ₐ[K] L) ≃* (q.map (algebraMap F K)).Gal :=
(IsSplittingField.algEquiv L (q.map (algebraMap F K))).autCongr
have ϕ_inj : Function.Injective ϕ.toMonoidHom := ϕ.injective
haveI : IsSolvable (K ≃ₐ[F] K) := hp
haveI : IsSolvable (L ≃ₐ[K] L) := solvable_of_solvable_injective ϕ_inj
exact isSolvable_of_isScalarTower F p.SplittingField q.SplittingField
#align gal_is_solvable_tower gal_isSolvable_tower
section GalXPowSubC
| Mathlib/FieldTheory/AbelRuffini.lean | 98 | 114 | theorem gal_X_pow_sub_one_isSolvable (n : ℕ) : IsSolvable (X ^ n - 1 : F[X]).Gal := by |
by_cases hn : n = 0
· rw [hn, pow_zero, sub_self]
exact gal_zero_isSolvable
have hn' : 0 < n := pos_iff_ne_zero.mpr hn
have hn'' : (X ^ n - 1 : F[X]) ≠ 0 := X_pow_sub_C_ne_zero hn' 1
apply isSolvable_of_comm
intro σ τ
ext a ha
simp only [mem_rootSet_of_ne hn'', map_sub, aeval_X_pow, aeval_one, sub_eq_zero] at ha
have key : ∀ σ : (X ^ n - 1 : F[X]).Gal, ∃ m : ℕ, σ a = a ^ m := by
intro σ
lift n to ℕ+ using hn'
exact map_rootsOfUnity_eq_pow_self σ.toAlgHom (rootsOfUnity.mkOfPowEq a ha)
obtain ⟨c, hc⟩ := key σ
obtain ⟨d, hd⟩ := key τ
rw [σ.mul_apply, τ.mul_apply, hc, τ.map_pow, hd, σ.map_pow, hc, ← pow_mul, pow_mul']
| 16 | 8,886,110.520508 | 2 | 0.909091 | 11 | 788 |
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.NormTrace
#align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
open Finset NumberField Algebra FiniteDimensional
namespace RingOfIntegers
variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
noncomputable def norm [IsSeparable K L] : 𝓞 L →* 𝓞 K :=
RingOfIntegers.restrict_monoidHom
((Algebra.norm K).comp (algebraMap (𝓞 L) L : (𝓞 L) →* L))
fun x => isIntegral_norm K x.2
#align ring_of_integers.norm RingOfIntegers.norm
@[simp] lemma coe_norm [IsSeparable K L] (x : 𝓞 L) :
norm K x = Algebra.norm K (x : L) := rfl
theorem coe_algebraMap_norm [IsSeparable K L] (x : 𝓞 L) :
(algebraMap (𝓞 K) (𝓞 L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) :=
rfl
#align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm
theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : 𝓞 K) :
algebraMap _ K (norm K (algebraMap (𝓞 K) (𝓞 L) x)) =
Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl
#align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap
theorem norm_algebraMap [IsSeparable K L] (x : 𝓞 K) :
norm K (algebraMap (𝓞 K) (𝓞 L) x) = x ^ finrank K L := by
rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap,
RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap,
RingOfIntegers.coe_eq_algebraMap, map_pow]
#align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : 𝓞 L} : IsUnit (norm K x) ↔ IsUnit x := by
classical
refine ⟨fun hx => ?_, IsUnit.map _⟩
replace hx : IsUnit (algebraMap (𝓞 K) (𝓞 L) <| norm K x) := hx.map (algebraMap (𝓞 K) <| 𝓞 L)
refine @isUnit_of_mul_isUnit_right (𝓞 L) _
⟨(univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x,
prod_mem fun σ _ => x.2.map (σ : L →+* L).toIntAlgHom⟩ _ ?_
convert hx using 1
ext
convert_to ((univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x) *
∏ σ ∈ {(AlgEquiv.refl : L ≃ₐ[K] L)}, σ x = _
· rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul,
RingOfIntegers.map_mk]
· rw [prod_sdiff <| subset_univ _, ← norm_eq_prod_automorphisms, coe_algebraMap_norm]
#align ring_of_integers.is_unit_norm_of_is_galois RingOfIntegers.isUnit_norm_of_isGalois
theorem dvd_norm [IsGalois K L] (x : 𝓞 L) : x ∣ algebraMap (𝓞 K) (𝓞 L) (norm K x) := by
classical
have hint :
IsIntegral ℤ (∏ σ ∈ univ.erase (AlgEquiv.refl : L ≃ₐ[K] L), σ x) :=
IsIntegral.prod _ (fun σ _ =>
((RingOfIntegers.isIntegral_coe x).map σ))
refine ⟨⟨_, hint⟩, ?_⟩
ext
rw [coe_algebraMap_norm K x, norm_eq_prod_automorphisms]
simp [← Finset.mul_prod_erase _ _ (mem_univ AlgEquiv.refl)]
#align ring_of_integers.dvd_norm RingOfIntegers.dvd_norm
variable (F : Type*) [Field F] [Algebra K F] [IsSeparable K F] [FiniteDimensional K F]
theorem norm_norm [IsSeparable K L] [Algebra F L] [IsSeparable F L] [FiniteDimensional F L]
[IsScalarTower K F L] (x : 𝓞 L) : norm K (norm F x) = norm K x := by
rw [RingOfIntegers.ext_iff, coe_norm, coe_norm, coe_norm, Algebra.norm_norm]
#align ring_of_integers.norm_norm RingOfIntegers.norm_norm
variable {F}
| Mathlib/NumberTheory/NumberField/Norm.lean | 111 | 126 | theorem isUnit_norm [CharZero K] {x : 𝓞 F} : IsUnit (norm K x) ↔ IsUnit x := by |
letI : Algebra K (AlgebraicClosure K) := AlgebraicClosure.instAlgebra K
let L := normalClosure K F (AlgebraicClosure F)
haveI : FiniteDimensional F L := FiniteDimensional.right K F L
haveI : IsAlgClosure K (AlgebraicClosure F) :=
IsAlgClosure.ofAlgebraic K F (AlgebraicClosure F)
haveI : IsGalois F L := IsGalois.tower_top_of_isGalois K F L
calc
IsUnit (norm K x) ↔ IsUnit ((norm K) x ^ finrank F L) :=
(isUnit_pow_iff (pos_iff_ne_zero.mp finrank_pos)).symm
_ ↔ IsUnit (norm K (algebraMap (𝓞 F) (𝓞 L) x)) := by
rw [← norm_norm K F (algebraMap (𝓞 F) (𝓞 L) x), norm_algebraMap F _, map_pow]
_ ↔ IsUnit (algebraMap (𝓞 F) (𝓞 L) x) := isUnit_norm_of_isGalois K
_ ↔ IsUnit (norm F (algebraMap (𝓞 F) (𝓞 L) x)) := (isUnit_norm_of_isGalois F).symm
_ ↔ IsUnit (x ^ finrank F L) := (congr_arg IsUnit (norm_algebraMap F _)).to_iff
_ ↔ IsUnit x := isUnit_pow_iff (pos_iff_ne_zero.mp finrank_pos)
| 15 | 3,269,017.372472 | 2 | 1.4 | 5 | 1,486 |
import Mathlib.Data.Set.Equitable
import Mathlib.Logic.Equiv.Fin
import Mathlib.Order.Partition.Finpartition
#align_import order.partition.equipartition from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205"
open Finset Fintype
namespace Finpartition
variable {α : Type*} [DecidableEq α] {s t : Finset α} (P : Finpartition s)
def IsEquipartition : Prop :=
(P.parts : Set (Finset α)).EquitableOn card
#align finpartition.is_equipartition Finpartition.IsEquipartition
theorem isEquipartition_iff_card_parts_eq_average :
P.IsEquipartition ↔
∀ a : Finset α,
a ∈ P.parts → a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1 := by
simp_rw [IsEquipartition, Finset.equitableOn_iff, P.sum_card_parts]
#align finpartition.is_equipartition_iff_card_parts_eq_average Finpartition.isEquipartition_iff_card_parts_eq_average
variable {P}
lemma not_isEquipartition :
¬P.IsEquipartition ↔ ∃ a ∈ P.parts, ∃ b ∈ P.parts, b.card + 1 < a.card :=
Set.not_equitableOn
theorem _root_.Set.Subsingleton.isEquipartition (h : (P.parts : Set (Finset α)).Subsingleton) :
P.IsEquipartition :=
Set.Subsingleton.equitableOn h _
#align finpartition.set.subsingleton.is_equipartition Set.Subsingleton.isEquipartition
theorem IsEquipartition.card_parts_eq_average (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card = s.card / P.parts.card ∨ t.card = s.card / P.parts.card + 1 :=
P.isEquipartition_iff_card_parts_eq_average.1 hP _ ht
#align finpartition.is_equipartition.card_parts_eq_average Finpartition.IsEquipartition.card_parts_eq_average
| Mathlib/Order/Partition/Equipartition.lean | 61 | 66 | theorem IsEquipartition.card_part_eq_average_iff (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1 := by |
have a := hP.card_parts_eq_average ht
have b : ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1) := by
by_contra h; exact absurd (h.1 ▸ h.2) (lt_add_one _).ne
tauto
| 4 | 54.59815 | 2 | 1.375 | 8 | 1,469 |
import Mathlib.Combinatorics.SimpleGraph.DegreeSum
import Mathlib.Combinatorics.SimpleGraph.Subgraph
#align_import combinatorics.simple_graph.matching from "leanprover-community/mathlib"@"138448ae98f529ef34eeb61114191975ee2ca508"
universe u
namespace SimpleGraph
variable {V : Type u} {G : SimpleGraph V} (M : Subgraph G)
namespace Subgraph
def IsMatching : Prop := ∀ ⦃v⦄, v ∈ M.verts → ∃! w, M.Adj v w
#align simple_graph.subgraph.is_matching SimpleGraph.Subgraph.IsMatching
noncomputable def IsMatching.toEdge {M : Subgraph G} (h : M.IsMatching) (v : M.verts) : M.edgeSet :=
⟨s(v, (h v.property).choose), (h v.property).choose_spec.1⟩
#align simple_graph.subgraph.is_matching.to_edge SimpleGraph.Subgraph.IsMatching.toEdge
theorem IsMatching.toEdge_eq_of_adj {M : Subgraph G} (h : M.IsMatching) {v w : V} (hv : v ∈ M.verts)
(hvw : M.Adj v w) : h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩ := by
simp only [IsMatching.toEdge, Subtype.mk_eq_mk]
congr
exact ((h (M.edge_vert hvw)).choose_spec.2 w hvw).symm
#align simple_graph.subgraph.is_matching.to_edge_eq_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_of_adj
theorem IsMatching.toEdge.surjective {M : Subgraph G} (h : M.IsMatching) :
Function.Surjective h.toEdge := by
rintro ⟨e, he⟩
refine Sym2.ind (fun x y he => ?_) e he
exact ⟨⟨x, M.edge_vert he⟩, h.toEdge_eq_of_adj _ he⟩
#align simple_graph.subgraph.is_matching.to_edge.surjective SimpleGraph.Subgraph.IsMatching.toEdge.surjective
theorem IsMatching.toEdge_eq_toEdge_of_adj {M : Subgraph G} {v w : V} (h : M.IsMatching)
(hv : v ∈ M.verts) (hw : w ∈ M.verts) (ha : M.Adj v w) :
h.toEdge ⟨v, hv⟩ = h.toEdge ⟨w, hw⟩ := by
rw [h.toEdge_eq_of_adj hv ha, h.toEdge_eq_of_adj hw (M.symm ha), Subtype.mk_eq_mk, Sym2.eq_swap]
#align simple_graph.subgraph.is_matching.to_edge_eq_to_edge_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_toEdge_of_adj
def IsPerfectMatching : Prop := M.IsMatching ∧ M.IsSpanning
#align simple_graph.subgraph.is_perfect_matching SimpleGraph.Subgraph.IsPerfectMatching
theorem IsMatching.support_eq_verts {M : Subgraph G} (h : M.IsMatching) : M.support = M.verts := by
refine M.support_subset_verts.antisymm fun v hv => ?_
obtain ⟨w, hvw, -⟩ := h hv
exact ⟨_, hvw⟩
#align simple_graph.subgraph.is_matching.support_eq_verts SimpleGraph.Subgraph.IsMatching.support_eq_verts
theorem isMatching_iff_forall_degree {M : Subgraph G} [∀ v : V, Fintype (M.neighborSet v)] :
M.IsMatching ↔ ∀ v : V, v ∈ M.verts → M.degree v = 1 := by
simp only [degree_eq_one_iff_unique_adj, IsMatching]
#align simple_graph.subgraph.is_matching_iff_forall_degree SimpleGraph.Subgraph.isMatching_iff_forall_degree
| Mathlib/Combinatorics/SimpleGraph/Matching.lean | 101 | 111 | theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) :
Even M.verts.toFinset.card := by |
classical
rw [isMatching_iff_forall_degree] at h
use M.coe.edgeFinset.card
rw [← two_mul, ← M.coe.sum_degrees_eq_twice_card_edges]
-- Porting note: `SimpleGraph.Subgraph.coe_degree` does not trigger because it uses
-- instance arguments instead of implicit arguments for the first `Fintype` argument.
-- Using a `convert_to` to swap out the `Fintype` instance to the "right" one.
convert_to _ = Finset.sum Finset.univ fun v => SimpleGraph.degree (Subgraph.coe M) v using 3
simp [h, Finset.card_univ]
| 9 | 8,103.083928 | 2 | 0.888889 | 9 | 772 |
import Mathlib.CategoryTheory.Sites.SheafOfTypes
import Mathlib.Order.Closure
#align_import category_theory.sites.closed from "leanprover-community/mathlib"@"4cfc30e317caad46858393f1a7a33f609296cc30"
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C]
variable (J₁ J₂ : GrothendieckTopology C)
namespace GrothendieckTopology
@[simps]
def close {X : C} (S : Sieve X) : Sieve X where
arrows _ f := J₁.Covers S f
downward_closed hS := J₁.arrow_stable _ _ hS
#align category_theory.grothendieck_topology.close CategoryTheory.GrothendieckTopology.close
theorem le_close {X : C} (S : Sieve X) : S ≤ J₁.close S :=
fun _ _ hg => J₁.covering_of_eq_top (S.pullback_eq_top_of_mem hg)
#align category_theory.grothendieck_topology.le_close CategoryTheory.GrothendieckTopology.le_close
def IsClosed {X : C} (S : Sieve X) : Prop :=
∀ ⦃Y : C⦄ (f : Y ⟶ X), J₁.Covers S f → S f
#align category_theory.grothendieck_topology.is_closed CategoryTheory.GrothendieckTopology.IsClosed
theorem covers_iff_mem_of_isClosed {X : C} {S : Sieve X} (h : J₁.IsClosed S) {Y : C} (f : Y ⟶ X) :
J₁.Covers S f ↔ S f :=
⟨h _, J₁.arrow_max _ _⟩
#align category_theory.grothendieck_topology.covers_iff_mem_of_closed CategoryTheory.GrothendieckTopology.covers_iff_mem_of_isClosed
theorem isClosed_pullback {X Y : C} (f : Y ⟶ X) (S : Sieve X) :
J₁.IsClosed S → J₁.IsClosed (S.pullback f) :=
fun hS Z g hg => hS (g ≫ f) (by rwa [J₁.covers_iff, Sieve.pullback_comp])
#align category_theory.grothendieck_topology.is_closed_pullback CategoryTheory.GrothendieckTopology.isClosed_pullback
theorem le_close_of_isClosed {X : C} {S T : Sieve X} (h : S ≤ T) (hT : J₁.IsClosed T) :
J₁.close S ≤ T :=
fun _ f hf => hT _ (J₁.superset_covering (Sieve.pullback_monotone f h) hf)
#align category_theory.grothendieck_topology.le_close_of_is_closed CategoryTheory.GrothendieckTopology.le_close_of_isClosed
theorem close_isClosed {X : C} (S : Sieve X) : J₁.IsClosed (J₁.close S) :=
fun _ g hg => J₁.arrow_trans g _ S hg fun _ hS => hS
#align category_theory.grothendieck_topology.close_is_closed CategoryTheory.GrothendieckTopology.close_isClosed
@[simps! isClosed]
def closureOperator (X : C) : ClosureOperator (Sieve X) :=
.ofPred J₁.close J₁.IsClosed J₁.le_close J₁.close_isClosed fun _ _ ↦ J₁.le_close_of_isClosed
#align category_theory.grothendieck_topology.closure_operator CategoryTheory.GrothendieckTopology.closureOperator
#align category_theory.grothendieck_topology.closed_iff_closed CategoryTheory.GrothendieckTopology.closureOperator_isClosed
theorem isClosed_iff_close_eq_self {X : C} (S : Sieve X) : J₁.IsClosed S ↔ J₁.close S = S :=
(J₁.closureOperator _).isClosed_iff
#align category_theory.grothendieck_topology.is_closed_iff_close_eq_self CategoryTheory.GrothendieckTopology.isClosed_iff_close_eq_self
theorem close_eq_self_of_isClosed {X : C} {S : Sieve X} (hS : J₁.IsClosed S) : J₁.close S = S :=
(J₁.isClosed_iff_close_eq_self S).1 hS
#align category_theory.grothendieck_topology.close_eq_self_of_is_closed CategoryTheory.GrothendieckTopology.close_eq_self_of_isClosed
| Mathlib/CategoryTheory/Sites/Closed.lean | 124 | 132 | theorem pullback_close {X Y : C} (f : Y ⟶ X) (S : Sieve X) :
J₁.close (S.pullback f) = (J₁.close S).pullback f := by |
apply le_antisymm
· refine J₁.le_close_of_isClosed (Sieve.pullback_monotone _ (J₁.le_close S)) ?_
apply J₁.isClosed_pullback _ _ (J₁.close_isClosed _)
· intro Z g hg
change _ ∈ J₁ _
rw [← Sieve.pullback_comp]
apply hg
| 7 | 1,096.633158 | 2 | 2 | 2 | 2,090 |
import Mathlib.LinearAlgebra.LinearPMap
import Mathlib.Topology.Algebra.Module.Basic
#align_import topology.algebra.module.linear_pmap from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Topology
variable {R E F : Type*}
variable [CommRing R] [AddCommGroup E] [AddCommGroup F]
variable [Module R E] [Module R F]
variable [TopologicalSpace E] [TopologicalSpace F]
namespace LinearPMap
def IsClosed (f : E →ₗ.[R] F) : Prop :=
_root_.IsClosed (f.graph : Set (E × F))
#align linear_pmap.is_closed LinearPMap.IsClosed
variable [ContinuousAdd E] [ContinuousAdd F]
variable [TopologicalSpace R] [ContinuousSMul R E] [ContinuousSMul R F]
def IsClosable (f : E →ₗ.[R] F) : Prop :=
∃ f' : LinearPMap R E F, f.graph.topologicalClosure = f'.graph
#align linear_pmap.is_closable LinearPMap.IsClosable
theorem IsClosed.isClosable {f : E →ₗ.[R] F} (hf : f.IsClosed) : f.IsClosable :=
⟨f, hf.submodule_topologicalClosure_eq⟩
#align linear_pmap.is_closed.is_closable LinearPMap.IsClosed.isClosable
| Mathlib/Topology/Algebra/Module/LinearPMap.lean | 77 | 85 | theorem IsClosable.leIsClosable {f g : E →ₗ.[R] F} (hf : f.IsClosable) (hfg : g ≤ f) :
g.IsClosable := by |
cases' hf with f' hf
have : g.graph.topologicalClosure ≤ f'.graph := by
rw [← hf]
exact Submodule.topologicalClosure_mono (le_graph_of_le hfg)
use g.graph.topologicalClosure.toLinearPMap
rw [Submodule.toLinearPMap_graph_eq]
exact fun _ hx hx' => f'.graph_fst_eq_zero_snd (this hx) hx'
| 7 | 1,096.633158 | 2 | 1.222222 | 9 | 1,294 |
import Mathlib.Algebra.GCDMonoid.Basic
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Polynomial.Eisenstein.Basic
#align_import algebra.gcd_monoid.integrally_closed from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973"
open scoped Polynomial
variable {R A : Type*} [CommRing R] [IsDomain R] [CommRing A] [Algebra R A]
| Mathlib/Algebra/GCDMonoid/IntegrallyClosed.lean | 23 | 30 | theorem IsLocalization.surj_of_gcd_domain [GCDMonoid R] (M : Submonoid R) [IsLocalization M A]
(z : A) : ∃ a b : R, IsUnit (gcd a b) ∧ z * algebraMap R A b = algebraMap R A a := by |
obtain ⟨x, ⟨y, hy⟩, rfl⟩ := IsLocalization.mk'_surjective M z
obtain ⟨x', y', hx', hy', hu⟩ := extract_gcd x y
use x', y', hu
rw [mul_comm, IsLocalization.mul_mk'_eq_mk'_of_mul]
convert IsLocalization.mk'_mul_cancel_left (M := M) (S := A) _ _ using 2
rw [Subtype.coe_mk, hy', ← mul_comm y', mul_assoc]; conv_lhs => rw [hx']
| 6 | 403.428793 | 2 | 2 | 1 | 2,202 |
import Mathlib.Data.Set.Image
import Mathlib.Data.Set.Lattice
#align_import data.set.sigma from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f"
namespace Set
variable {ι ι' : Type*} {α β : ι → Type*} {s s₁ s₂ : Set ι} {t t₁ t₂ : ∀ i, Set (α i)}
{u : Set (Σ i, α i)} {x : Σ i, α i} {i j : ι} {a : α i}
@[simp]
theorem range_sigmaMk (i : ι) : range (Sigma.mk i : α i → Sigma α) = Sigma.fst ⁻¹' {i} := by
apply Subset.antisymm
· rintro _ ⟨b, rfl⟩
simp
· rintro ⟨x, y⟩ (rfl | _)
exact mem_range_self y
#align set.range_sigma_mk Set.range_sigmaMk
theorem preimage_image_sigmaMk_of_ne (h : i ≠ j) (s : Set (α j)) :
Sigma.mk i ⁻¹' (Sigma.mk j '' s) = ∅ := by
ext x
simp [h.symm]
#align set.preimage_image_sigma_mk_of_ne Set.preimage_image_sigmaMk_of_ne
theorem image_sigmaMk_preimage_sigmaMap_subset {β : ι' → Type*} (f : ι → ι')
(g : ∀ i, α i → β (f i)) (i : ι) (s : Set (β (f i))) :
Sigma.mk i '' (g i ⁻¹' s) ⊆ Sigma.map f g ⁻¹' (Sigma.mk (f i) '' s) :=
image_subset_iff.2 fun x hx ↦ ⟨g i x, hx, rfl⟩
#align set.image_sigma_mk_preimage_sigma_map_subset Set.image_sigmaMk_preimage_sigmaMap_subset
| Mathlib/Data/Set/Sigma.lean | 43 | 50 | theorem image_sigmaMk_preimage_sigmaMap {β : ι' → Type*} {f : ι → ι'} (hf : Function.Injective f)
(g : ∀ i, α i → β (f i)) (i : ι) (s : Set (β (f i))) :
Sigma.mk i '' (g i ⁻¹' s) = Sigma.map f g ⁻¹' (Sigma.mk (f i) '' s) := by |
refine (image_sigmaMk_preimage_sigmaMap_subset f g i s).antisymm ?_
rintro ⟨j, x⟩ ⟨y, hys, hxy⟩
simp only [hf.eq_iff, Sigma.map, Sigma.ext_iff] at hxy
rcases hxy with ⟨rfl, hxy⟩; rw [heq_iff_eq] at hxy; subst y
exact ⟨x, hys, rfl⟩
| 5 | 148.413159 | 2 | 1.666667 | 3 | 1,824 |
import Mathlib.MeasureTheory.Measure.Restrict
open scoped ENNReal NNReal Topology
open Set MeasureTheory Measure Filter Function MeasurableSpace ENNReal
variable {α β δ ι : Type*}
namespace MeasureTheory
variable {m0 : MeasurableSpace α} [MeasurableSpace β] {μ ν ν₁ ν₂: Measure α}
{s t : Set α}
section IsFiniteMeasure
class IsFiniteMeasure (μ : Measure α) : Prop where
measure_univ_lt_top : μ univ < ∞
#align measure_theory.is_finite_measure MeasureTheory.IsFiniteMeasure
#align measure_theory.is_finite_measure.measure_univ_lt_top MeasureTheory.IsFiniteMeasure.measure_univ_lt_top
theorem not_isFiniteMeasure_iff : ¬IsFiniteMeasure μ ↔ μ Set.univ = ∞ := by
refine ⟨fun h => ?_, fun h => fun h' => h'.measure_univ_lt_top.ne h⟩
by_contra h'
exact h ⟨lt_top_iff_ne_top.mpr h'⟩
#align measure_theory.not_is_finite_measure_iff MeasureTheory.not_isFiniteMeasure_iff
instance Restrict.isFiniteMeasure (μ : Measure α) [hs : Fact (μ s < ∞)] :
IsFiniteMeasure (μ.restrict s) :=
⟨by simpa using hs.elim⟩
#align measure_theory.restrict.is_finite_measure MeasureTheory.Restrict.isFiniteMeasure
theorem measure_lt_top (μ : Measure α) [IsFiniteMeasure μ] (s : Set α) : μ s < ∞ :=
(measure_mono (subset_univ s)).trans_lt IsFiniteMeasure.measure_univ_lt_top
#align measure_theory.measure_lt_top MeasureTheory.measure_lt_top
instance isFiniteMeasureRestrict (μ : Measure α) (s : Set α) [h : IsFiniteMeasure μ] :
IsFiniteMeasure (μ.restrict s) :=
⟨by simpa using measure_lt_top μ s⟩
#align measure_theory.is_finite_measure_restrict MeasureTheory.isFiniteMeasureRestrict
theorem measure_ne_top (μ : Measure α) [IsFiniteMeasure μ] (s : Set α) : μ s ≠ ∞ :=
ne_of_lt (measure_lt_top μ s)
#align measure_theory.measure_ne_top MeasureTheory.measure_ne_top
| Mathlib/MeasureTheory/Measure/Typeclasses.lean | 65 | 72 | theorem measure_compl_le_add_of_le_add [IsFiniteMeasure μ] (hs : MeasurableSet s)
(ht : MeasurableSet t) {ε : ℝ≥0∞} (h : μ s ≤ μ t + ε) : μ tᶜ ≤ μ sᶜ + ε := by |
rw [measure_compl ht (measure_ne_top μ _), measure_compl hs (measure_ne_top μ _),
tsub_le_iff_right]
calc
μ univ = μ univ - μ s + μ s := (tsub_add_cancel_of_le <| measure_mono s.subset_univ).symm
_ ≤ μ univ - μ s + (μ t + ε) := add_le_add_left h _
_ = _ := by rw [add_right_comm, add_assoc]
| 6 | 403.428793 | 2 | 1.25 | 8 | 1,315 |
import Mathlib.LinearAlgebra.Matrix.Symmetric
import Mathlib.LinearAlgebra.Matrix.Orthogonal
import Mathlib.Data.Matrix.Kronecker
#align_import linear_algebra.matrix.is_diag from "leanprover-community/mathlib"@"55e2dfde0cff928ce5c70926a3f2c7dee3e2dd99"
namespace Matrix
variable {α β R n m : Type*}
open Function
open Matrix Kronecker
def IsDiag [Zero α] (A : Matrix n n α) : Prop :=
Pairwise fun i j => A i j = 0
#align matrix.is_diag Matrix.IsDiag
@[simp]
theorem isDiag_diagonal [Zero α] [DecidableEq n] (d : n → α) : (diagonal d).IsDiag := fun _ _ =>
Matrix.diagonal_apply_ne _
#align matrix.is_diag_diagonal Matrix.isDiag_diagonal
theorem IsDiag.diagonal_diag [Zero α] [DecidableEq n] {A : Matrix n n α} (h : A.IsDiag) :
diagonal (diag A) = A :=
ext fun i j => by
obtain rfl | hij := Decidable.eq_or_ne i j
· rw [diagonal_apply_eq, diag]
· rw [diagonal_apply_ne _ hij, h hij]
#align matrix.is_diag.diagonal_diag Matrix.IsDiag.diagonal_diag
theorem isDiag_iff_diagonal_diag [Zero α] [DecidableEq n] (A : Matrix n n α) :
A.IsDiag ↔ diagonal (diag A) = A :=
⟨IsDiag.diagonal_diag, fun hd => hd ▸ isDiag_diagonal (diag A)⟩
#align matrix.is_diag_iff_diagonal_diag Matrix.isDiag_iff_diagonal_diag
theorem isDiag_of_subsingleton [Zero α] [Subsingleton n] (A : Matrix n n α) : A.IsDiag :=
fun i j h => (h <| Subsingleton.elim i j).elim
#align matrix.is_diag_of_subsingleton Matrix.isDiag_of_subsingleton
@[simp]
theorem isDiag_zero [Zero α] : (0 : Matrix n n α).IsDiag := fun _ _ _ => rfl
#align matrix.is_diag_zero Matrix.isDiag_zero
@[simp]
theorem isDiag_one [DecidableEq n] [Zero α] [One α] : (1 : Matrix n n α).IsDiag := fun _ _ =>
one_apply_ne
#align matrix.is_diag_one Matrix.isDiag_one
theorem IsDiag.map [Zero α] [Zero β] {A : Matrix n n α} (ha : A.IsDiag) {f : α → β} (hf : f 0 = 0) :
(A.map f).IsDiag := by
intro i j h
simp [ha h, hf]
#align matrix.is_diag.map Matrix.IsDiag.map
theorem IsDiag.neg [AddGroup α] {A : Matrix n n α} (ha : A.IsDiag) : (-A).IsDiag := by
intro i j h
simp [ha h]
#align matrix.is_diag.neg Matrix.IsDiag.neg
@[simp]
theorem isDiag_neg_iff [AddGroup α] {A : Matrix n n α} : (-A).IsDiag ↔ A.IsDiag :=
⟨fun ha _ _ h => neg_eq_zero.1 (ha h), IsDiag.neg⟩
#align matrix.is_diag_neg_iff Matrix.isDiag_neg_iff
theorem IsDiag.add [AddZeroClass α] {A B : Matrix n n α} (ha : A.IsDiag) (hb : B.IsDiag) :
(A + B).IsDiag := by
intro i j h
simp [ha h, hb h]
#align matrix.is_diag.add Matrix.IsDiag.add
theorem IsDiag.sub [AddGroup α] {A B : Matrix n n α} (ha : A.IsDiag) (hb : B.IsDiag) :
(A - B).IsDiag := by
intro i j h
simp [ha h, hb h]
#align matrix.is_diag.sub Matrix.IsDiag.sub
theorem IsDiag.smul [Monoid R] [AddMonoid α] [DistribMulAction R α] (k : R) {A : Matrix n n α}
(ha : A.IsDiag) : (k • A).IsDiag := by
intro i j h
simp [ha h]
#align matrix.is_diag.smul Matrix.IsDiag.smul
@[simp]
theorem isDiag_smul_one (n) [Semiring α] [DecidableEq n] (k : α) :
(k • (1 : Matrix n n α)).IsDiag :=
isDiag_one.smul k
#align matrix.is_diag_smul_one Matrix.isDiag_smul_one
theorem IsDiag.transpose [Zero α] {A : Matrix n n α} (ha : A.IsDiag) : Aᵀ.IsDiag := fun _ _ h =>
ha h.symm
#align matrix.is_diag.transpose Matrix.IsDiag.transpose
@[simp]
theorem isDiag_transpose_iff [Zero α] {A : Matrix n n α} : Aᵀ.IsDiag ↔ A.IsDiag :=
⟨IsDiag.transpose, IsDiag.transpose⟩
#align matrix.is_diag_transpose_iff Matrix.isDiag_transpose_iff
theorem IsDiag.conjTranspose [Semiring α] [StarRing α] {A : Matrix n n α} (ha : A.IsDiag) :
Aᴴ.IsDiag :=
ha.transpose.map (star_zero _)
#align matrix.is_diag.conj_transpose Matrix.IsDiag.conjTranspose
@[simp]
theorem isDiag_conjTranspose_iff [Semiring α] [StarRing α] {A : Matrix n n α} :
Aᴴ.IsDiag ↔ A.IsDiag :=
⟨fun ha => by
convert ha.conjTranspose
simp, IsDiag.conjTranspose⟩
#align matrix.is_diag_conj_transpose_iff Matrix.isDiag_conjTranspose_iff
theorem IsDiag.submatrix [Zero α] {A : Matrix n n α} (ha : A.IsDiag) {f : m → n}
(hf : Injective f) : (A.submatrix f f).IsDiag := fun _ _ h => ha (hf.ne h)
#align matrix.is_diag.submatrix Matrix.IsDiag.submatrix
| Mathlib/LinearAlgebra/Matrix/IsDiag.lean | 143 | 149 | theorem IsDiag.kronecker [MulZeroClass α] {A : Matrix m m α} {B : Matrix n n α} (hA : A.IsDiag)
(hB : B.IsDiag) : (A ⊗ₖ B).IsDiag := by |
rintro ⟨a, b⟩ ⟨c, d⟩ h
simp only [Prod.mk.inj_iff, Ne, not_and_or] at h
cases' h with hac hbd
· simp [hA hac]
· simp [hB hbd]
| 5 | 148.413159 | 2 | 1.25 | 8 | 1,302 |
import Mathlib.Data.List.Duplicate
import Mathlib.Data.List.Sort
#align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace List
variable {α : Type*}
section Sublist
theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ)
(hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by
induction' l with hd tl IH generalizing l' f
· simp
have : some hd = _ := hf 0
rw [eq_comm, List.get?_eq_some] at this
obtain ⟨w, h⟩ := this
let f' : ℕ ↪o ℕ :=
OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by
dsimp only
rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact b.succ_pos
have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by
intro ix
rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact ix.succ_pos
rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append]
apply List.Sublist.append _ (IH _ this)
rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)]
apply List.get_mem
#align list.sublist_of_order_embedding_nth_eq List.sublist_of_orderEmbedding_get?_eq
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
constructor
· intro H
induction' H with xs ys y _H IH xs ys x _H IH
· simp
· obtain ⟨f, hf⟩ := IH
refine ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), ?_⟩
simpa using hf
· obtain ⟨f, hf⟩ := IH
refine
⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) ?_, ?_⟩
· rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
· rintro ⟨_ | i⟩
· simp
· simpa using hf _
· rintro ⟨f, hf⟩
exact sublist_of_orderEmbedding_get?_eq f hf
#align list.sublist_iff_exists_order_embedding_nth_eq List.sublist_iff_exists_orderEmbedding_get?_eq
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
l <+ l' ↔
∃ f : Fin l.length ↪o Fin l'.length,
∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
rw [sublist_iff_exists_orderEmbedding_get?_eq]
constructor
· rintro ⟨f, hf⟩
have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
intro i hi
specialize hf i
rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
obtain ⟨h, -⟩ := hf
exact h
refine ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) ?_, ?_⟩
· simp
· intro i
apply Option.some_injective
simpa [get?_eq_get i.2, get?_eq_get (h i.2)] using hf i
· rintro ⟨f, hf⟩
refine
⟨OrderEmbedding.ofStrictMono (fun i => if hi : i < l.length then f ⟨i, hi⟩ else i + l'.length)
?_,
?_⟩
· intro i j h
dsimp only
split_ifs with hi hj hj
· rwa [Fin.val_fin_lt, f.lt_iff_lt]
· have := (f ⟨i, hi⟩).is_lt
omega
· exact absurd (h.trans hj) hi
· simpa using h
· intro i
simp only [OrderEmbedding.coe_ofStrictMono]
split_ifs with hi
· rw [get?_eq_get hi, get?_eq_get, ← hf]
· rw [get?_eq_none.mpr, get?_eq_none.mpr]
· simp
· simpa using hi
#align list.sublist_iff_exists_fin_order_embedding_nth_le_eq List.sublist_iff_exists_fin_orderEmbedding_get_eq
| Mathlib/Data/List/NodupEquivFin.lean | 211 | 232 | theorem duplicate_iff_exists_distinct_get {l : List α} {x : α} :
l.Duplicate x ↔
∃ (n m : Fin l.length) (_ : n < m),
x = l.get n ∧ x = l.get m := by |
classical
rw [duplicate_iff_two_le_count, le_count_iff_replicate_sublist,
sublist_iff_exists_fin_orderEmbedding_get_eq]
constructor
· rintro ⟨f, hf⟩
refine ⟨f ⟨0, by simp⟩, f ⟨1, by simp⟩, f.lt_iff_lt.2 (Nat.zero_lt_one), ?_⟩
rw [← hf, ← hf]; simp
· rintro ⟨n, m, hnm, h, h'⟩
refine ⟨OrderEmbedding.ofStrictMono (fun i => if (i : ℕ) = 0 then n else m) ?_, ?_⟩
· rintro ⟨⟨_ | i⟩, hi⟩ ⟨⟨_ | j⟩, hj⟩
· simp
· simp [hnm]
· simp
· simp only [Nat.lt_succ_iff, Nat.succ_le_succ_iff, replicate, length, Nat.le_zero] at hi hj
simp [hi, hj]
· rintro ⟨⟨_ | i⟩, hi⟩
· simpa using h
· simpa using h'
| 18 | 65,659,969.137331 | 2 | 2 | 4 | 1,962 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Tactic.Abel
#align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589"
universe u v
open Polynomial
open Polynomial
section Semiring
variable (S : Type u) [Semiring S]
noncomputable def ascPochhammer : ℕ → S[X]
| 0 => 1
| n + 1 => X * (ascPochhammer n).comp (X + 1)
#align pochhammer ascPochhammer
@[simp]
theorem ascPochhammer_zero : ascPochhammer S 0 = 1 :=
rfl
#align pochhammer_zero ascPochhammer_zero
@[simp]
theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer]
#align pochhammer_one ascPochhammer_one
theorem ascPochhammer_succ_left (n : ℕ) :
ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by
rw [ascPochhammer]
#align pochhammer_succ_left ascPochhammer_succ_left
theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] :
Monic <| ascPochhammer S n := by
induction' n with n hn
· simp
· have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1
rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul,
leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn,
monic_X, one_mul, one_mul, this, one_pow]
section
variable {S} {T : Type v} [Semiring T]
@[simp]
theorem ascPochhammer_map (f : S →+* T) (n : ℕ) :
(ascPochhammer S n).map f = ascPochhammer T n := by
induction' n with n ih
· simp
· simp [ih, ascPochhammer_succ_left, map_comp]
#align pochhammer_map ascPochhammer_map
theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) :
(ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by
rw [← ascPochhammer_map f]
exact eval_map f t
theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S]
(x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x =
(ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by
rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S),
← map_comp, eval_map]
end
@[simp, norm_cast]
theorem ascPochhammer_eval_cast (n k : ℕ) :
(((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by
rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S),
eval₂_at_natCast,Nat.cast_id]
#align pochhammer_eval_cast ascPochhammer_eval_cast
theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by
cases n
· simp
· simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left]
#align pochhammer_eval_zero ascPochhammer_eval_zero
theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by simp
#align pochhammer_zero_eval_zero ascPochhammer_zero_eval_zero
@[simp]
theorem ascPochhammer_ne_zero_eval_zero {n : ℕ} (h : n ≠ 0) : (ascPochhammer S n).eval 0 = 0 := by
simp [ascPochhammer_eval_zero, h]
#align pochhammer_ne_zero_eval_zero ascPochhammer_ne_zero_eval_zero
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 124 | 134 | theorem ascPochhammer_succ_right (n : ℕ) :
ascPochhammer S (n + 1) = ascPochhammer S n * (X + (n : S[X])) := by |
suffices h : ascPochhammer ℕ (n + 1) = ascPochhammer ℕ n * (X + (n : ℕ[X])) by
apply_fun Polynomial.map (algebraMap ℕ S) at h
simpa only [ascPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X,
Polynomial.map_natCast] using h
induction' n with n ih
· simp
· conv_lhs =>
rw [ascPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← ascPochhammer_succ_left, add_comp,
X_comp, natCast_comp, add_assoc, add_comm (1 : ℕ[X]), ← Nat.cast_succ]
| 9 | 8,103.083928 | 2 | 0.96 | 25 | 796 |
import Mathlib.Algebra.Polynomial.Coeff
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Polynomial
open Finset (antidiagonal mem_antidiagonal)
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section Trunc
variable [Semiring R]
open Finset Nat
def trunc (n : ℕ) (φ : R⟦X⟧) : R[X] :=
∑ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m φ)
#align power_series.trunc PowerSeries.trunc
theorem coeff_trunc (m) (n) (φ : R⟦X⟧) :
(trunc n φ).coeff m = if m < n then coeff R m φ else 0 := by
simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff]
#align power_series.coeff_trunc PowerSeries.coeff_trunc
@[simp]
theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 :=
Polynomial.ext fun m => by
rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero]
split_ifs <;> rfl
#align power_series.trunc_zero PowerSeries.trunc_zero
@[simp]
theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 :=
Polynomial.ext fun m => by
rw [coeff_trunc, coeff_one, Polynomial.coeff_one]
split_ifs with h _ h'
· rfl
· rfl
· subst h'; simp at h
· rfl
#align power_series.trunc_one PowerSeries.trunc_one
@[simp]
theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a :=
Polynomial.ext fun m => by
rw [coeff_trunc, coeff_C, Polynomial.coeff_C]
split_ifs with H <;> first |rfl|try simp_all
set_option linter.uppercaseLean3 false in
#align power_series.trunc_C PowerSeries.trunc_C
@[simp]
theorem trunc_add (n) (φ ψ : R⟦X⟧) : trunc n (φ + ψ) = trunc n φ + trunc n ψ :=
Polynomial.ext fun m => by
simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add]
split_ifs with H
· rfl
· rw [zero_add]
#align power_series.trunc_add PowerSeries.trunc_add
theorem trunc_succ (f : R⟦X⟧) (n : ℕ) :
trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by
rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range]
theorem natDegree_trunc_lt (f : R⟦X⟧) (n) : (trunc (n + 1) f).natDegree < n + 1 := by
rw [Nat.lt_succ_iff, natDegree_le_iff_coeff_eq_zero]
intros
rw [coeff_trunc]
split_ifs with h
· rw [lt_succ, ← not_lt] at h
contradiction
· rfl
@[simp] lemma trunc_zero' {f : R⟦X⟧} : trunc 0 f = 0 := rfl
theorem degree_trunc_lt (f : R⟦X⟧) (n) : (trunc n f).degree < n := by
rw [degree_lt_iff_coeff_zero]
intros
rw [coeff_trunc]
split_ifs with h
· rw [← not_le] at h
contradiction
· rfl
| Mathlib/RingTheory/PowerSeries/Trunc.lean | 108 | 120 | theorem eval₂_trunc_eq_sum_range {S : Type*} [Semiring S] (s : S) (G : R →+* S) (n) (f : R⟦X⟧) :
(trunc n f).eval₂ G s = ∑ i ∈ range n, G (coeff R i f) * s ^ i := by |
cases n with
| zero =>
rw [trunc_zero', range_zero, sum_empty, eval₂_zero]
| succ n =>
have := natDegree_trunc_lt f n
rw [eval₂_eq_sum_range' (hn := this)]
apply sum_congr rfl
intro _ h
rw [mem_range] at h
congr
rw [coeff_trunc, if_pos h]
| 11 | 59,874.141715 | 2 | 1.2 | 5 | 1,272 |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow
import Mathlib.Algebra.Ring.Int
import Mathlib.Data.Nat.Factorial.Basic
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Bounds.Basic
#align_import data.nat.prime from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
open Bool Subtype
open Nat
namespace Nat
variable {n : ℕ}
-- Porting note (#11180): removed @[pp_nodot]
def Prime (p : ℕ) :=
Irreducible p
#align nat.prime Nat.Prime
theorem irreducible_iff_nat_prime (a : ℕ) : Irreducible a ↔ Nat.Prime a :=
Iff.rfl
#align irreducible_iff_nat_prime Nat.irreducible_iff_nat_prime
@[aesop safe destruct] theorem not_prime_zero : ¬Prime 0
| h => h.ne_zero rfl
#align nat.not_prime_zero Nat.not_prime_zero
@[aesop safe destruct] theorem not_prime_one : ¬Prime 1
| h => h.ne_one rfl
#align nat.not_prime_one Nat.not_prime_one
theorem Prime.ne_zero {n : ℕ} (h : Prime n) : n ≠ 0 :=
Irreducible.ne_zero h
#align nat.prime.ne_zero Nat.Prime.ne_zero
theorem Prime.pos {p : ℕ} (pp : Prime p) : 0 < p :=
Nat.pos_of_ne_zero pp.ne_zero
#align nat.prime.pos Nat.Prime.pos
theorem Prime.two_le : ∀ {p : ℕ}, Prime p → 2 ≤ p
| 0, h => (not_prime_zero h).elim
| 1, h => (not_prime_one h).elim
| _ + 2, _ => le_add_self
#align nat.prime.two_le Nat.Prime.two_le
theorem Prime.one_lt {p : ℕ} : Prime p → 1 < p :=
Prime.two_le
#align nat.prime.one_lt Nat.Prime.one_lt
lemma Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p := hp.one_lt.le
instance Prime.one_lt' (p : ℕ) [hp : Fact p.Prime] : Fact (1 < p) :=
⟨hp.1.one_lt⟩
#align nat.prime.one_lt' Nat.Prime.one_lt'
theorem Prime.ne_one {p : ℕ} (hp : p.Prime) : p ≠ 1 :=
hp.one_lt.ne'
#align nat.prime.ne_one Nat.Prime.ne_one
theorem Prime.eq_one_or_self_of_dvd {p : ℕ} (pp : p.Prime) (m : ℕ) (hm : m ∣ p) :
m = 1 ∨ m = p := by
obtain ⟨n, hn⟩ := hm
have := pp.isUnit_or_isUnit hn
rw [Nat.isUnit_iff, Nat.isUnit_iff] at this
apply Or.imp_right _ this
rintro rfl
rw [hn, mul_one]
#align nat.prime.eq_one_or_self_of_dvd Nat.Prime.eq_one_or_self_of_dvd
| Mathlib/Data/Nat/Prime.lean | 99 | 109 | theorem prime_def_lt'' {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, m ∣ p → m = 1 ∨ m = p := by |
refine ⟨fun h => ⟨h.two_le, h.eq_one_or_self_of_dvd⟩, fun h => ?_⟩
-- Porting note: needed to make ℕ explicit
have h1 := (@one_lt_two ℕ ..).trans_le h.1
refine ⟨mt Nat.isUnit_iff.mp h1.ne', fun a b hab => ?_⟩
simp only [Nat.isUnit_iff]
apply Or.imp_right _ (h.2 a _)
· rintro rfl
rw [← mul_right_inj' (pos_of_gt h1).ne', ← hab, mul_one]
· rw [hab]
exact dvd_mul_right _ _
| 10 | 22,026.465795 | 2 | 2 | 3 | 2,433 |
import Mathlib.Geometry.Manifold.MFDeriv.Atlas
noncomputable section
open scoped Manifold
open Set
section UniqueMDiff
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M'] {s : Set M} {x : M}
| Mathlib/Geometry/Manifold/MFDeriv/UniqueDifferential.lean | 39 | 49 | theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x)
{f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f')
(hd : DenseRange f') : UniqueMDiffWithinAt I' (f '' s) (f x) := by |
/- Rewrite in coordinates, apply `HasFDerivWithinAt.uniqueDiffWithinAt`. -/
have := hs.inter' <| hf.1 (extChartAt_source_mem_nhds I' (f x))
refine (((hf.2.mono ?sub1).uniqueDiffWithinAt this hd).mono ?sub2).congr_pt ?pt
case pt => simp only [mfld_simps]
case sub1 => mfld_set_tac
case sub2 =>
rintro _ ⟨y, ⟨⟨hys, hfy⟩, -⟩, rfl⟩
exact ⟨⟨_, hys, ((extChartAt I' (f x)).left_inv hfy).symm⟩, mem_range_self _⟩
| 8 | 2,980.957987 | 2 | 2 | 4 | 2,009 |
import Mathlib.Topology.Compactness.Compact
open Set Filter Topology TopologicalSpace Classical
variable {X : Type*} {Y : Type*} {ι : Type*}
variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X}
instance [WeaklyLocallyCompactSpace X] [WeaklyLocallyCompactSpace Y] :
WeaklyLocallyCompactSpace (X × Y) where
exists_compact_mem_nhds x :=
let ⟨s₁, hc₁, h₁⟩ := exists_compact_mem_nhds x.1
let ⟨s₂, hc₂, h₂⟩ := exists_compact_mem_nhds x.2
⟨s₁ ×ˢ s₂, hc₁.prod hc₂, prod_mem_nhds h₁ h₂⟩
instance {ι : Type*} [Finite ι] {X : ι → Type*} [(i : ι) → TopologicalSpace (X i)]
[(i : ι) → WeaklyLocallyCompactSpace (X i)] :
WeaklyLocallyCompactSpace ((i : ι) → X i) where
exists_compact_mem_nhds := fun f ↦ by
choose s hsc hs using fun i ↦ exists_compact_mem_nhds (f i)
exact ⟨pi univ s, isCompact_univ_pi hsc, set_pi_mem_nhds univ.toFinite fun i _ ↦ hs i⟩
instance (priority := 100) [CompactSpace X] : WeaklyLocallyCompactSpace X where
exists_compact_mem_nhds _ := ⟨univ, isCompact_univ, univ_mem⟩
| Mathlib/Topology/Compactness/LocallyCompact.lean | 40 | 45 | theorem exists_compact_superset [WeaklyLocallyCompactSpace X] {K : Set X} (hK : IsCompact K) :
∃ K', IsCompact K' ∧ K ⊆ interior K' := by |
choose s hc hmem using fun x : X ↦ exists_compact_mem_nhds x
rcases hK.elim_nhds_subcover _ fun x _ ↦ interior_mem_nhds.2 (hmem x) with ⟨I, -, hIK⟩
refine ⟨⋃ x ∈ I, s x, I.isCompact_biUnion fun _ _ ↦ hc _, hIK.trans ?_⟩
exact iUnion₂_subset fun x hx ↦ interior_mono <| subset_iUnion₂ (s := fun x _ ↦ s x) x hx
| 4 | 54.59815 | 2 | 1.5 | 2 | 1,574 |
import Mathlib.Logic.Encodable.Basic
import Mathlib.Logic.Pairwise
import Mathlib.Data.Set.Subsingleton
#align_import logic.encodable.lattice from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set
namespace Encodable
variable {α : Type*} {β : Type*} [Encodable β]
theorem iSup_decode₂ [CompleteLattice α] (f : β → α) :
⨆ (i : ℕ) (b ∈ decode₂ β i), f b = (⨆ b, f b) := by
rw [iSup_comm]
simp only [mem_decode₂, iSup_iSup_eq_right]
#align encodable.supr_decode₂ Encodable.iSup_decode₂
theorem iUnion_decode₂ (f : β → Set α) : ⋃ (i : ℕ) (b ∈ decode₂ β i), f b = ⋃ b, f b :=
iSup_decode₂ f
#align encodable.Union_decode₂ Encodable.iUnion_decode₂
--@[elab_as_elim]
theorem iUnion_decode₂_cases {f : β → Set α} {C : Set α → Prop} (H0 : C ∅) (H1 : ∀ b, C (f b)) {n} :
C (⋃ b ∈ decode₂ β n, f b) :=
match decode₂ β n with
| none => by
simp only [Option.mem_def, iUnion_of_empty, iUnion_empty]
apply H0
| some b => by
convert H1 b
simp [ext_iff]
#align encodable.Union_decode₂_cases Encodable.iUnion_decode₂_cases
| Mathlib/Logic/Encodable/Lattice.lean | 53 | 59 | theorem iUnion_decode₂_disjoint_on {f : β → Set α} (hd : Pairwise (Disjoint on f)) :
Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) := by |
rintro i j ij
refine disjoint_left.mpr fun x => ?_
suffices ∀ a, encode a = i → x ∈ f a → ∀ b, encode b = j → x ∉ f b by simpa [decode₂_eq_some]
rintro a rfl ha b rfl hb
exact (hd (mt (congr_arg encode) ij)).le_bot ⟨ha, hb⟩
| 5 | 148.413159 | 2 | 1.5 | 2 | 1,685 |
import Mathlib.CategoryTheory.GlueData
import Mathlib.Topology.Category.TopCat.Limits.Pullbacks
import Mathlib.Topology.Category.TopCat.Opens
import Mathlib.Tactic.Generalize
import Mathlib.CategoryTheory.Elementwise
#align_import topology.gluing from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1"
noncomputable section
open TopologicalSpace CategoryTheory
universe v u
open CategoryTheory.Limits
namespace TopCat
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure GlueData extends GlueData TopCat where
f_open : ∀ i j, OpenEmbedding (f i j)
f_mono := fun i j => (TopCat.mono_iff_injective _).mpr (f_open i j).toEmbedding.inj
set_option linter.uppercaseLean3 false in
#align Top.glue_data TopCat.GlueData
namespace GlueData
variable (D : GlueData.{u})
local notation "𝖣" => D.toGlueData
theorem π_surjective : Function.Surjective 𝖣.π :=
(TopCat.epi_iff_surjective 𝖣.π).mp inferInstance
set_option linter.uppercaseLean3 false in
#align Top.glue_data.π_surjective TopCat.GlueData.π_surjective
| Mathlib/Topology/Gluing.lean | 104 | 115 | theorem isOpen_iff (U : Set 𝖣.glued) : IsOpen U ↔ ∀ i, IsOpen (𝖣.ι i ⁻¹' U) := by |
delta CategoryTheory.GlueData.ι
simp_rw [← Multicoequalizer.ι_sigmaπ 𝖣.diagram]
rw [← (homeoOfIso (Multicoequalizer.isoCoequalizer 𝖣.diagram).symm).isOpen_preimage]
rw [coequalizer_isOpen_iff]
dsimp only [GlueData.diagram_l, GlueData.diagram_left, GlueData.diagram_r, GlueData.diagram_right,
parallelPair_obj_one]
rw [colimit_isOpen_iff.{_,u}] -- Porting note: changed `.{u}` to `.{_,u}`. fun fact: the proof
-- breaks down if this `rw` is merged with the `rw` above.
constructor
· intro h j; exact h ⟨j⟩
· intro h j; cases j; apply h
| 11 | 59,874.141715 | 2 | 2 | 3 | 2,317 |
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Group.OrderIso
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Logic.Pairwise
#align_import data.set.intervals.group from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
variable {α : Type*}
namespace Set
section LinearOrderedAddCommGroup
variable [LinearOrderedAddCommGroup α]
| Mathlib/Algebra/Order/Interval/Set/Group.lean | 151 | 157 | theorem nonempty_Ico_sdiff {x dx y dy : α} (h : dy < dx) (hx : 0 < dx) :
Nonempty ↑(Ico x (x + dx) \ Ico y (y + dy)) := by |
cases' lt_or_le x y with h' h'
· use x
simp [*, not_le.2 h']
· use max x (x + dy)
simp [*, le_refl]
| 5 | 148.413159 | 2 | 1 | 6 | 939 |
import Mathlib.Algebra.Polynomial.Mirror
import Mathlib.Analysis.Complex.Polynomial
#align_import data.polynomial.unit_trinomial from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
namespace Polynomial
open scoped Polynomial
open Finset
section Semiring
variable {R : Type*} [Semiring R] (k m n : ℕ) (u v w : R)
noncomputable def trinomial :=
C u * X ^ k + C v * X ^ m + C w * X ^ n
#align polynomial.trinomial Polynomial.trinomial
theorem trinomial_def : trinomial k m n u v w = C u * X ^ k + C v * X ^ m + C w * X ^ n :=
rfl
#align polynomial.trinomial_def Polynomial.trinomial_def
variable {k m n u v w}
theorem trinomial_leading_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff n = w := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg (hkm.trans hmn).ne', if_neg hmn.ne', if_pos rfl, zero_add, zero_add]
#align polynomial.trinomial_leading_coeff' Polynomial.trinomial_leading_coeff'
theorem trinomial_middle_coeff (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff m = v := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg hkm.ne', if_pos rfl, if_neg hmn.ne, zero_add, add_zero]
#align polynomial.trinomial_middle_coeff Polynomial.trinomial_middle_coeff
theorem trinomial_trailing_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff k = u := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_pos rfl, if_neg hkm.ne, if_neg (hkm.trans hmn).ne, add_zero, add_zero]
#align polynomial.trinomial_trailing_coeff' Polynomial.trinomial_trailing_coeff'
theorem trinomial_natDegree (hkm : k < m) (hmn : m < n) (hw : w ≠ 0) :
(trinomial k m n u v w).natDegree = n := by
refine
natDegree_eq_of_degree_eq_some
((Finset.sup_le fun i h => ?_).antisymm <|
le_degree_of_ne_zero <| by rwa [trinomial_leading_coeff' hkm hmn])
replace h := support_trinomial' k m n u v w h
rw [mem_insert, mem_insert, mem_singleton] at h
rcases h with (rfl | rfl | rfl)
· exact WithBot.coe_le_coe.mpr (hkm.trans hmn).le
· exact WithBot.coe_le_coe.mpr hmn.le
· exact le_rfl
#align polynomial.trinomial_nat_degree Polynomial.trinomial_natDegree
theorem trinomial_natTrailingDegree (hkm : k < m) (hmn : m < n) (hu : u ≠ 0) :
(trinomial k m n u v w).natTrailingDegree = k := by
refine
natTrailingDegree_eq_of_trailingDegree_eq_some
((Finset.le_inf fun i h => ?_).antisymm <|
trailingDegree_le_of_ne_zero <| by rwa [trinomial_trailing_coeff' hkm hmn]).symm
replace h := support_trinomial' k m n u v w h
rw [mem_insert, mem_insert, mem_singleton] at h
rcases h with (rfl | rfl | rfl)
· exact le_rfl
· exact WithTop.coe_le_coe.mpr hkm.le
· exact WithTop.coe_le_coe.mpr (hkm.trans hmn).le
#align polynomial.trinomial_nat_trailing_degree Polynomial.trinomial_natTrailingDegree
theorem trinomial_leadingCoeff (hkm : k < m) (hmn : m < n) (hw : w ≠ 0) :
(trinomial k m n u v w).leadingCoeff = w := by
rw [leadingCoeff, trinomial_natDegree hkm hmn hw, trinomial_leading_coeff' hkm hmn]
#align polynomial.trinomial_leading_coeff Polynomial.trinomial_leadingCoeff
theorem trinomial_trailingCoeff (hkm : k < m) (hmn : m < n) (hu : u ≠ 0) :
(trinomial k m n u v w).trailingCoeff = u := by
rw [trailingCoeff, trinomial_natTrailingDegree hkm hmn hu, trinomial_trailing_coeff' hkm hmn]
#align polynomial.trinomial_trailing_coeff Polynomial.trinomial_trailingCoeff
theorem trinomial_monic (hkm : k < m) (hmn : m < n) : (trinomial k m n u v 1).Monic := by
nontriviality R
exact trinomial_leadingCoeff hkm hmn one_ne_zero
#align polynomial.trinomial_monic Polynomial.trinomial_monic
| Mathlib/Algebra/Polynomial/UnitTrinomial.lean | 110 | 117 | theorem trinomial_mirror (hkm : k < m) (hmn : m < n) (hu : u ≠ 0) (hw : w ≠ 0) :
(trinomial k m n u v w).mirror = trinomial k (n - m + k) n w v u := by |
rw [mirror, trinomial_natTrailingDegree hkm hmn hu, reverse, trinomial_natDegree hkm hmn hw,
trinomial_def, reflect_add, reflect_add, reflect_C_mul_X_pow, reflect_C_mul_X_pow,
reflect_C_mul_X_pow, revAt_le (hkm.trans hmn).le, revAt_le hmn.le, revAt_le le_rfl, add_mul,
add_mul, mul_assoc, mul_assoc, mul_assoc, ← pow_add, ← pow_add, ← pow_add,
Nat.sub_add_cancel (hkm.trans hmn).le, Nat.sub_self, zero_add, add_comm, add_comm (C u * X ^ n),
← add_assoc, ← trinomial_def]
| 6 | 403.428793 | 2 | 1.111111 | 9 | 1,193 |
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
#align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce"
open Set Filter MeasureTheory MeasurableSpace
open scoped Classical Topology NNReal ENNReal MeasureTheory
universe u v w x y
variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α}
namespace Real
theorem borel_eq_generateFrom_Ioo_rat :
borel ℝ = .generateFrom (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) :=
isTopologicalBasis_Ioo_rat.borel_eq_generateFrom
#align real.borel_eq_generate_from_Ioo_rat Real.borel_eq_generateFrom_Ioo_rat
theorem borel_eq_generateFrom_Iio_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Iio (a : ℝ)}) := by
rw [borel_eq_generateFrom_Iio]
refine le_antisymm
(generateFrom_le ?_)
(generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _)
rintro _ ⟨a, rfl⟩
have : IsLUB (range ((↑) : ℚ → ℝ) ∩ Iio a) a := by
simp [isLUB_iff_le_iff, mem_upperBounds, ← le_iff_forall_rat_lt_imp_le]
rw [← this.biUnion_Iio_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image]
exact MeasurableSet.biUnion (to_countable _)
fun b _ => GenerateMeasurable.basic (Iio (b : ℝ)) (by simp)
| Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean | 56 | 66 | theorem borel_eq_generateFrom_Ioi_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Ioi (a : ℝ)}) := by |
rw [borel_eq_generateFrom_Ioi]
refine le_antisymm
(generateFrom_le ?_)
(generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _)
rintro _ ⟨a, rfl⟩
have : IsGLB (range ((↑) : ℚ → ℝ) ∩ Ioi a) a := by
simp [isGLB_iff_le_iff, mem_lowerBounds, ← le_iff_forall_lt_rat_imp_le]
rw [← this.biUnion_Ioi_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image]
exact MeasurableSet.biUnion (to_countable _)
fun b _ => GenerateMeasurable.basic (Ioi (b : ℝ)) (by simp)
| 10 | 22,026.465795 | 2 | 1.444444 | 9 | 1,528 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.GeomSum
import Mathlib.LinearAlgebra.Matrix.Block
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.LinearAlgebra.Matrix.Nondegenerate
#align_import linear_algebra.vandermonde from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
variable {R : Type*} [CommRing R]
open Equiv Finset
open Matrix
namespace Matrix
def vandermonde {n : ℕ} (v : Fin n → R) : Matrix (Fin n) (Fin n) R := fun i j => v i ^ (j : ℕ)
#align matrix.vandermonde Matrix.vandermonde
@[simp]
theorem vandermonde_apply {n : ℕ} (v : Fin n → R) (i j) : vandermonde v i j = v i ^ (j : ℕ) :=
rfl
#align matrix.vandermonde_apply Matrix.vandermonde_apply
@[simp]
| Mathlib/LinearAlgebra/Vandermonde.lean | 49 | 56 | theorem vandermonde_cons {n : ℕ} (v0 : R) (v : Fin n → R) :
vandermonde (Fin.cons v0 v : Fin n.succ → R) =
Fin.cons (fun (j : Fin n.succ) => v0 ^ (j : ℕ)) fun i => Fin.cons 1
fun j => v i * vandermonde v i j := by |
ext i j
refine Fin.cases (by simp) (fun i => ?_) i
refine Fin.cases (by simp) (fun j => ?_) j
simp [pow_succ']
| 4 | 54.59815 | 2 | 1 | 5 | 1,157 |
import Mathlib.Topology.Separation
import Mathlib.Algebra.BigOperators.Finprod
#align_import topology.algebra.infinite_sum.basic from "leanprover-community/mathlib"@"3b52265189f3fb43aa631edffce5d060fafaf82f"
noncomputable section
open Filter Function
open scoped Topology
variable {α β γ : Type*}
section HasProd
variable [CommMonoid α] [TopologicalSpace α]
@[to_additive "Infinite sum on a topological monoid
The `atTop` filter on `Finset β` is the limit of all finite sets towards the entire type. So we sum
up bigger and bigger sets. This sum operation is invariant under reordering. In particular,
the function `ℕ → ℝ` sending `n` to `(-1)^n / (n+1)` does not have a
sum for this definition, but a series which is absolutely convergent will have the correct sum.
This is based on Mario Carneiro's
[infinite sum `df-tsms` in Metamath](http://us.metamath.org/mpeuni/df-tsms.html).
For the definition and many statements, `α` does not need to be a topological monoid. We only add
this assumption later, for the lemmas where it is relevant."]
def HasProd (f : β → α) (a : α) : Prop :=
Tendsto (fun s : Finset β ↦ ∏ b ∈ s, f b) atTop (𝓝 a)
#align has_sum HasSum
@[to_additive "`Summable f` means that `f` has some (infinite) sum. Use `tsum` to get the value."]
def Multipliable (f : β → α) : Prop :=
∃ a, HasProd f a
#align summable Summable
open scoped Classical in
@[to_additive "`∑' i, f i` is the sum of `f` it exists, or 0 otherwise."]
noncomputable irreducible_def tprod {β} (f : β → α) :=
if h : Multipliable f then
if (mulSupport f).Finite then finprod f
else h.choose
else 1
#align tsum tsum
-- see Note [operator precedence of big operators]
@[inherit_doc tprod]
notation3 "∏' "(...)", "r:67:(scoped f => tprod f) => r
@[inherit_doc tsum]
notation3 "∑' "(...)", "r:67:(scoped f => tsum f) => r
variable {f g : β → α} {a b : α} {s : Finset β}
@[to_additive]
theorem HasProd.multipliable (h : HasProd f a) : Multipliable f :=
⟨a, h⟩
#align has_sum.summable HasSum.summable
@[to_additive]
theorem tprod_eq_one_of_not_multipliable (h : ¬Multipliable f) : ∏' b, f b = 1 := by
simp [tprod_def, h]
#align tsum_eq_zero_of_not_summable tsum_eq_zero_of_not_summable
@[to_additive]
theorem Function.Injective.hasProd_iff {g : γ → β} (hg : Injective g)
(hf : ∀ x, x ∉ Set.range g → f x = 1) : HasProd (f ∘ g) a ↔ HasProd f a := by
simp only [HasProd, Tendsto, comp_apply, hg.map_atTop_finset_prod_eq hf]
#align function.injective.has_sum_iff Function.Injective.hasSum_iff
@[to_additive]
theorem hasProd_subtype_iff_of_mulSupport_subset {s : Set β} (hf : mulSupport f ⊆ s) :
HasProd (f ∘ (↑) : s → α) a ↔ HasProd f a :=
Subtype.coe_injective.hasProd_iff <| by simpa using mulSupport_subset_iff'.1 hf
#align has_sum_subtype_iff_of_support_subset hasSum_subtype_iff_of_support_subset
@[to_additive]
theorem hasProd_fintype [Fintype β] (f : β → α) : HasProd f (∏ b, f b) :=
OrderTop.tendsto_atTop_nhds _
#align has_sum_fintype hasSum_fintype
@[to_additive]
protected theorem Finset.hasProd (s : Finset β) (f : β → α) :
HasProd (f ∘ (↑) : (↑s : Set β) → α) (∏ b ∈ s, f b) := by
rw [← prod_attach]
exact hasProd_fintype _
#align finset.has_sum Finset.hasSum
@[to_additive "If a function `f` vanishes outside of a finite set `s`, then it `HasSum`
`∑ b ∈ s, f b`."]
theorem hasProd_prod_of_ne_finset_one (hf : ∀ b ∉ s, f b = 1) :
HasProd f (∏ b ∈ s, f b) :=
(hasProd_subtype_iff_of_mulSupport_subset <| mulSupport_subset_iff'.2 hf).1 <| s.hasProd f
#align has_sum_sum_of_ne_finset_zero hasSum_sum_of_ne_finset_zero
@[to_additive]
theorem multipliable_of_ne_finset_one (hf : ∀ b ∉ s, f b = 1) : Multipliable f :=
(hasProd_prod_of_ne_finset_one hf).multipliable
#align summable_of_ne_finset_zero summable_of_ne_finset_zero
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Defs.lean | 166 | 170 | theorem Multipliable.hasProd (ha : Multipliable f) : HasProd f (∏' b, f b) := by |
simp only [tprod_def, ha, dite_true]
by_cases H : (mulSupport f).Finite
· simp [H, hasProd_prod_of_ne_finset_one, finprod_eq_prod]
· simpa [H] using ha.choose_spec
| 4 | 54.59815 | 2 | 0.5 | 4 | 493 |
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Combinatorics.SetFamily.Compression.Down
import Mathlib.Order.UpperLower.Basic
import Mathlib.Data.Fintype.Powerset
#align_import combinatorics.set_family.harris_kleitman from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205"
open Finset
variable {α : Type*} [DecidableEq α] {𝒜 ℬ : Finset (Finset α)} {s : Finset α} {a : α}
theorem IsLowerSet.nonMemberSubfamily (h : IsLowerSet (𝒜 : Set (Finset α))) :
IsLowerSet (𝒜.nonMemberSubfamily a : Set (Finset α)) := fun s t hts => by
simp_rw [mem_coe, mem_nonMemberSubfamily]
exact And.imp (h hts) (mt <| @hts _)
#align is_lower_set.non_member_subfamily IsLowerSet.nonMemberSubfamily
theorem IsLowerSet.memberSubfamily (h : IsLowerSet (𝒜 : Set (Finset α))) :
IsLowerSet (𝒜.memberSubfamily a : Set (Finset α)) := by
rintro s t hts
simp_rw [mem_coe, mem_memberSubfamily]
exact And.imp (h <| insert_subset_insert _ hts) (mt <| @hts _)
#align is_lower_set.member_subfamily IsLowerSet.memberSubfamily
theorem IsLowerSet.memberSubfamily_subset_nonMemberSubfamily (h : IsLowerSet (𝒜 : Set (Finset α))) :
𝒜.memberSubfamily a ⊆ 𝒜.nonMemberSubfamily a := fun s => by
rw [mem_memberSubfamily, mem_nonMemberSubfamily]
exact And.imp_left (h <| subset_insert _ _)
#align is_lower_set.member_subfamily_subset_non_member_subfamily IsLowerSet.memberSubfamily_subset_nonMemberSubfamily
theorem IsLowerSet.le_card_inter_finset' (h𝒜 : IsLowerSet (𝒜 : Set (Finset α)))
(hℬ : IsLowerSet (ℬ : Set (Finset α))) (h𝒜s : ∀ t ∈ 𝒜, t ⊆ s) (hℬs : ∀ t ∈ ℬ, t ⊆ s) :
𝒜.card * ℬ.card ≤ 2 ^ s.card * (𝒜 ∩ ℬ).card := by
induction' s using Finset.induction with a s hs ih generalizing 𝒜 ℬ
· simp_rw [subset_empty, ← subset_singleton_iff', subset_singleton_iff] at h𝒜s hℬs
obtain rfl | rfl := h𝒜s
· simp only [card_empty, zero_mul, empty_inter, mul_zero, le_refl]
obtain rfl | rfl := hℬs
· simp only [card_empty, inter_empty, mul_zero, zero_mul, le_refl]
· simp only [card_empty, pow_zero, inter_singleton_of_mem, mem_singleton, card_singleton,
le_refl]
rw [card_insert_of_not_mem hs, ← card_memberSubfamily_add_card_nonMemberSubfamily a 𝒜, ←
card_memberSubfamily_add_card_nonMemberSubfamily a ℬ, add_mul, mul_add, mul_add,
add_comm (_ * _), add_add_add_comm]
refine
(add_le_add_right
(mul_add_mul_le_mul_add_mul
(card_le_card h𝒜.memberSubfamily_subset_nonMemberSubfamily) <|
card_le_card hℬ.memberSubfamily_subset_nonMemberSubfamily)
_).trans
?_
rw [← two_mul, pow_succ', mul_assoc]
have h₀ : ∀ 𝒞 : Finset (Finset α), (∀ t ∈ 𝒞, t ⊆ insert a s) →
∀ t ∈ 𝒞.nonMemberSubfamily a, t ⊆ s := by
rintro 𝒞 h𝒞 t ht
rw [mem_nonMemberSubfamily] at ht
exact (subset_insert_iff_of_not_mem ht.2).1 (h𝒞 _ ht.1)
have h₁ : ∀ 𝒞 : Finset (Finset α), (∀ t ∈ 𝒞, t ⊆ insert a s) →
∀ t ∈ 𝒞.memberSubfamily a, t ⊆ s := by
rintro 𝒞 h𝒞 t ht
rw [mem_memberSubfamily] at ht
exact (subset_insert_iff_of_not_mem ht.2).1 ((subset_insert _ _).trans <| h𝒞 _ ht.1)
refine mul_le_mul_left' ?_ _
refine (add_le_add (ih h𝒜.memberSubfamily hℬ.memberSubfamily (h₁ _ h𝒜s) <| h₁ _ hℬs) <|
ih h𝒜.nonMemberSubfamily hℬ.nonMemberSubfamily (h₀ _ h𝒜s) <| h₀ _ hℬs).trans_eq ?_
rw [← mul_add, ← memberSubfamily_inter, ← nonMemberSubfamily_inter,
card_memberSubfamily_add_card_nonMemberSubfamily]
#align is_lower_set.le_card_inter_finset' IsLowerSet.le_card_inter_finset'
variable [Fintype α]
theorem IsLowerSet.le_card_inter_finset (h𝒜 : IsLowerSet (𝒜 : Set (Finset α)))
(hℬ : IsLowerSet (ℬ : Set (Finset α))) : 𝒜.card * ℬ.card ≤ 2 ^ Fintype.card α * (𝒜 ∩ ℬ).card :=
h𝒜.le_card_inter_finset' hℬ (fun _ _ => subset_univ _) fun _ _ => subset_univ _
#align is_lower_set.le_card_inter_finset IsLowerSet.le_card_inter_finset
| Mathlib/Combinatorics/SetFamily/HarrisKleitman.lean | 103 | 110 | theorem IsUpperSet.card_inter_le_finset (h𝒜 : IsUpperSet (𝒜 : Set (Finset α)))
(hℬ : IsLowerSet (ℬ : Set (Finset α))) :
2 ^ Fintype.card α * (𝒜 ∩ ℬ).card ≤ 𝒜.card * ℬ.card := by |
rw [← isLowerSet_compl, ← coe_compl] at h𝒜
have := h𝒜.le_card_inter_finset hℬ
rwa [card_compl, Fintype.card_finset, tsub_mul, tsub_le_iff_tsub_le, ← mul_tsub, ←
card_sdiff inter_subset_right, sdiff_inter_self_right, sdiff_compl,
_root_.inf_comm] at this
| 5 | 148.413159 | 2 | 1.666667 | 3 | 1,794 |
import Mathlib.Order.BoundedOrder
#align_import data.prod.lex from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
variable {α β γ : Type*}
namespace Prod.Lex
@[inherit_doc] notation:35 α " ×ₗ " β:34 => Lex (Prod α β)
instance decidableEq (α β : Type*) [DecidableEq α] [DecidableEq β] : DecidableEq (α ×ₗ β) :=
instDecidableEqProd
#align prod.lex.decidable_eq Prod.Lex.decidableEq
instance inhabited (α β : Type*) [Inhabited α] [Inhabited β] : Inhabited (α ×ₗ β) :=
instInhabitedProd
#align prod.lex.inhabited Prod.Lex.inhabited
instance instLE (α β : Type*) [LT α] [LE β] : LE (α ×ₗ β) where le := Prod.Lex (· < ·) (· ≤ ·)
#align prod.lex.has_le Prod.Lex.instLE
instance instLT (α β : Type*) [LT α] [LT β] : LT (α ×ₗ β) where lt := Prod.Lex (· < ·) (· < ·)
#align prod.lex.has_lt Prod.Lex.instLT
theorem le_iff [LT α] [LE β] (a b : α × β) :
toLex a ≤ toLex b ↔ a.1 < b.1 ∨ a.1 = b.1 ∧ a.2 ≤ b.2 :=
Prod.lex_def (· < ·) (· ≤ ·)
#align prod.lex.le_iff Prod.Lex.le_iff
theorem lt_iff [LT α] [LT β] (a b : α × β) :
toLex a < toLex b ↔ a.1 < b.1 ∨ a.1 = b.1 ∧ a.2 < b.2 :=
Prod.lex_def (· < ·) (· < ·)
#align prod.lex.lt_iff Prod.Lex.lt_iff
example (x : α) (y : β) : toLex (x, y) = toLex (x, y) := rfl
instance preorder (α β : Type*) [Preorder α] [Preorder β] : Preorder (α ×ₗ β) :=
{ Prod.Lex.instLE α β, Prod.Lex.instLT α β with
le_refl := refl_of <| Prod.Lex _ _,
le_trans := fun _ _ _ => trans_of <| Prod.Lex _ _,
lt_iff_le_not_le := fun x₁ x₂ =>
match x₁, x₂ with
| (a₁, b₁), (a₂, b₂) => by
constructor
· rintro (⟨_, _, hlt⟩ | ⟨_, hlt⟩)
· constructor
· exact left _ _ hlt
· rintro ⟨⟩
· apply lt_asymm hlt; assumption
· exact lt_irrefl _ hlt
· constructor
· right
rw [lt_iff_le_not_le] at hlt
exact hlt.1
· rintro ⟨⟩
· apply lt_irrefl a₁
assumption
· rw [lt_iff_le_not_le] at hlt
apply hlt.2
assumption
· rintro ⟨⟨⟩, h₂r⟩
· left
assumption
· right
rw [lt_iff_le_not_le]
constructor
· assumption
· intro h
apply h₂r
right
exact h }
#align prod.lex.preorder Prod.Lex.preorder
theorem monotone_fst [Preorder α] [LE β] (t c : α ×ₗ β) (h : t ≤ c) :
(ofLex t).1 ≤ (ofLex c).1 := by
cases (Prod.Lex.le_iff t c).mp h with
| inl h' => exact h'.le
| inr h' => exact h'.1.le
section Preorder
variable [PartialOrder α] [Preorder β]
theorem toLex_mono : Monotone (toLex : α × β → α ×ₗ β) := by
rintro ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ ⟨ha, hb⟩
obtain rfl | ha : a₁ = a₂ ∨ _ := ha.eq_or_lt
· exact right _ hb
· exact left _ _ ha
#align prod.lex.to_lex_mono Prod.Lex.toLex_mono
| Mathlib/Data/Prod/Lex.lean | 122 | 126 | theorem toLex_strictMono : StrictMono (toLex : α × β → α ×ₗ β) := by |
rintro ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ h
obtain rfl | ha : a₁ = a₂ ∨ _ := h.le.1.eq_or_lt
· exact right _ (Prod.mk_lt_mk_iff_right.1 h)
· exact left _ _ ha
| 4 | 54.59815 | 2 | 1.666667 | 3 | 1,784 |
import Mathlib.Algebra.Homology.HomologicalComplex
import Mathlib.AlgebraicTopology.SimplicialObject
import Mathlib.CategoryTheory.Abelian.Basic
#align_import algebraic_topology.Moore_complex from "leanprover-community/mathlib"@"0bd2ea37bcba5769e14866170f251c9bc64e35d7"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Limits
open Opposite
namespace AlgebraicTopology
variable {C : Type*} [Category C] [Abelian C]
attribute [local instance] Abelian.hasPullbacks
namespace NormalizedMooreComplex
open CategoryTheory.Subobject
variable (X : SimplicialObject C)
def objX : ∀ n : ℕ, Subobject (X.obj (op (SimplexCategory.mk n)))
| 0 => ⊤
| n + 1 => Finset.univ.inf fun k : Fin (n + 1) => kernelSubobject (X.δ k.succ)
set_option linter.uppercaseLean3 false in
#align algebraic_topology.normalized_Moore_complex.obj_X AlgebraicTopology.NormalizedMooreComplex.objX
theorem objX_zero : objX X 0 = ⊤ :=
rfl
theorem objX_add_one (n) :
objX X (n + 1) = Finset.univ.inf fun k : Fin (n + 1) => kernelSubobject (X.δ k.succ) :=
rfl
attribute [eqns objX_zero objX_add_one] objX
attribute [simp] objX
@[simp]
def objD : ∀ n : ℕ, (objX X (n + 1) : C) ⟶ (objX X n : C)
| 0 => Subobject.arrow _ ≫ X.δ (0 : Fin 2) ≫ inv (⊤ : Subobject _).arrow
| n + 1 => by
-- The differential is `Subobject.arrow _ ≫ X.δ (0 : Fin (n+3))`,
-- factored through the intersection of the kernels.
refine factorThru _ (arrow _ ≫ X.δ (0 : Fin (n + 3))) ?_
-- We now need to show that it factors!
-- A morphism factors through an intersection of subobjects if it factors through each.
refine (finset_inf_factors _).mpr fun i _ => ?_
-- A morphism `f` factors through the kernel of `g` exactly if `f ≫ g = 0`.
apply kernelSubobject_factors
dsimp [objX]
-- Use a simplicial identity
erw [Category.assoc, ← X.δ_comp_δ (Fin.zero_le i.succ)]
-- We can rewrite the arrow out of the intersection of all the kernels as a composition
-- of a morphism we don't care about with the arrow out of the kernel of `X.δ i.succ.succ`.
rw [← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ i.succ (by simp)),
Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.normalized_Moore_complex.obj_d AlgebraicTopology.NormalizedMooreComplex.objD
| Mathlib/AlgebraicTopology/MooreComplex.lean | 100 | 111 | theorem d_squared (n : ℕ) : objD X (n + 1) ≫ objD X n = 0 := by |
-- It's a pity we need to do a case split here;
-- after the first erw the proofs are almost identical
rcases n with _ | n <;> dsimp [objD]
· erw [Subobject.factorThru_arrow_assoc, Category.assoc,
← X.δ_comp_δ_assoc (Fin.zero_le (0 : Fin 2)),
← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ (0 : Fin 2) (by simp)),
Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero]
· erw [factorThru_right, factorThru_eq_zero, factorThru_arrow_assoc, Category.assoc,
← X.δ_comp_δ (Fin.zero_le (0 : Fin (n + 3))),
← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ (0 : Fin (n + 3)) (by simp)),
Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero]
| 11 | 59,874.141715 | 2 | 2 | 1 | 1,950 |
import Mathlib.Data.Rat.Cast.Defs
import Mathlib.Algebra.Field.Basic
#align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
namespace Rat
variable {α : Type*} [DivisionRing α]
-- Porting note: rewrote proof
@[simp]
| Mathlib/Data/Rat/Cast/Lemmas.lean | 28 | 32 | theorem cast_inv_nat (n : ℕ) : ((n⁻¹ : ℚ) : α) = (n : α)⁻¹ := by |
cases' n with n
· simp
rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero,
Int.sign_eq_one_of_pos (Nat.cast_pos.mpr n.succ_pos), Int.cast_one, one_div]
| 4 | 54.59815 | 2 | 1.333333 | 6 | 1,436 |
import Mathlib.Geometry.Manifold.VectorBundle.Tangent
#align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
noncomputable section
open scoped Classical Topology Manifold
open Set ChartedSpace
section DerivativesDefinitions
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
{H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type*}
[TopologicalSpace M'] [ChartedSpace H' M']
def DifferentiableWithinAtProp (f : H → H') (s : Set H) (x : H) : Prop :=
DifferentiableWithinAt 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ Set.range I) (I x)
#align differentiable_within_at_prop DifferentiableWithinAtProp
theorem differentiable_within_at_localInvariantProp :
(contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
(DifferentiableWithinAtProp I I') :=
{ is_local := by
intro s x u f u_open xu
have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
simp only [Set.inter_right_comm, Set.preimage_inter]
rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
symm
apply differentiableWithinAt_inter
have : u ∈ 𝓝 (I.symm (I x)) := by
rw [ModelWithCorners.left_inv]
exact u_open.mem_nhds xu
apply I.continuous_symm.continuousAt this
right_invariance' := by
intro s x f e he hx h
rw [DifferentiableWithinAtProp] at h ⊢
have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps]
rw [this] at h
have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps]
have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this
convert (h.comp' _ (this.differentiableWithinAt le_top)).mono_of_mem _ using 1
· ext y; simp only [mfld_simps]
refine
mem_nhdsWithin.mpr
⟨I.symm ⁻¹' e.target, e.open_target.preimage I.continuous_symm, by
simp_rw [Set.mem_preimage, I.left_inv, e.mapsTo hx], ?_⟩
mfld_set_tac
congr_of_forall := by
intro s x f g h hx hf
apply hf.congr
· intro y hy
simp only [mfld_simps] at hy
simp only [h, hy, mfld_simps]
· simp only [hx, mfld_simps]
left_invariance' := by
intro s x f e' he' hs hx h
rw [DifferentiableWithinAtProp] at h ⊢
have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ Set.range I' := by
simp only [hx, mfld_simps]
have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A
convert (this.differentiableWithinAt le_top).comp _ h _
· ext y; simp only [mfld_simps]
· intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 }
#align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
def UniqueMDiffWithinAt (s : Set M) (x : M) :=
UniqueDiffWithinAt 𝕜 ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x)
#align unique_mdiff_within_at UniqueMDiffWithinAt
def UniqueMDiffOn (s : Set M) :=
∀ x ∈ s, UniqueMDiffWithinAt I s x
#align unique_mdiff_on UniqueMDiffOn
def MDifferentiableWithinAt (f : M → M') (s : Set M) (x : M) :=
LiftPropWithinAt (DifferentiableWithinAtProp I I') f s x
#align mdifferentiable_within_at MDifferentiableWithinAt
theorem mdifferentiableWithinAt_iff' (f : M → M') (s : Set M) (x : M) :
MDifferentiableWithinAt I I' f s x ↔ ContinuousWithinAt f s x ∧
DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f)
((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) := by
rw [MDifferentiableWithinAt, liftPropWithinAt_iff']; rfl
#align mdifferentiable_within_at_iff_lift_prop_within_at mdifferentiableWithinAt_iff'
@[deprecated (since := "2024-04-30")]
alias mdifferentiableWithinAt_iff_liftPropWithinAt := mdifferentiableWithinAt_iff'
variable {I I'} in
theorem MDifferentiableWithinAt.continuousWithinAt {f : M → M'} {s : Set M} {x : M}
(hf : MDifferentiableWithinAt I I' f s x) :
ContinuousWithinAt f s x :=
mdifferentiableWithinAt_iff' .. |>.1 hf |>.1
#align mdifferentiable_within_at.continuous_within_at MDifferentiableWithinAt.continuousWithinAt
variable {I I'} in
theorem MDifferentiableWithinAt.differentiableWithinAt_writtenInExtChartAt
{f : M → M'} {s : Set M} {x : M} (hf : MDifferentiableWithinAt I I' f s x) :
DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f)
((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) :=
mdifferentiableWithinAt_iff' .. |>.1 hf |>.2
def MDifferentiableAt (f : M → M') (x : M) :=
LiftPropAt (DifferentiableWithinAtProp I I') f x
#align mdifferentiable_at MDifferentiableAt
| Mathlib/Geometry/Manifold/MFDeriv/Defs.lean | 239 | 246 | theorem mdifferentiableAt_iff (f : M → M') (x : M) :
MDifferentiableAt I I' f x ↔ ContinuousAt f x ∧
DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x) := by |
rw [MDifferentiableAt, liftPropAt_iff]
congrm _ ∧ ?_
simp [DifferentiableWithinAtProp, Set.univ_inter]
-- Porting note: `rfl` wasn't needed
rfl
| 5 | 148.413159 | 2 | 1.333333 | 3 | 1,450 |
import Mathlib.GroupTheory.Perm.Cycle.Basic
#align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open Equiv Function Finset
variable {ι α β : Type*}
namespace Equiv.Perm
section Generation
variable [Finite β]
open Subgroup
theorem closure_isCycle : closure { σ : Perm β | IsCycle σ } = ⊤ := by
classical
cases nonempty_fintype β
exact
top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle))
#align equiv.perm.closure_is_cycle Equiv.Perm.closure_isCycle
variable [DecidableEq α] [Fintype α]
theorem closure_cycle_adjacent_swap {σ : Perm α} (h1 : IsCycle σ) (h2 : σ.support = ⊤) (x : α) :
closure ({σ, swap x (σ x)} : Set (Perm α)) = ⊤ := by
let H := closure ({σ, swap x (σ x)} : Set (Perm α))
have h3 : σ ∈ H := subset_closure (Set.mem_insert σ _)
have h4 : swap x (σ x) ∈ H := subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _))
have step1 : ∀ n : ℕ, swap ((σ ^ n) x) ((σ ^ (n + 1) : Perm α) x) ∈ H := by
intro n
induction' n with n ih
· exact subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _))
· convert H.mul_mem (H.mul_mem h3 ih) (H.inv_mem h3)
simp_rw [mul_swap_eq_swap_mul, mul_inv_cancel_right, pow_succ']
rfl
have step2 : ∀ n : ℕ, swap x ((σ ^ n) x) ∈ H := by
intro n
induction' n with n ih
· simp only [Nat.zero_eq, pow_zero, coe_one, id_eq, swap_self, Set.mem_singleton_iff]
convert H.one_mem
· by_cases h5 : x = (σ ^ n) x
· rw [pow_succ', mul_apply, ← h5]
exact h4
by_cases h6 : x = (σ ^ (n + 1) : Perm α) x
· rw [← h6, swap_self]
exact H.one_mem
rw [swap_comm, ← swap_mul_swap_mul_swap h5 h6]
exact H.mul_mem (H.mul_mem (step1 n) ih) (step1 n)
have step3 : ∀ y : α, swap x y ∈ H := by
intro y
have hx : x ∈ (⊤ : Finset α) := Finset.mem_univ x
rw [← h2, mem_support] at hx
have hy : y ∈ (⊤ : Finset α) := Finset.mem_univ y
rw [← h2, mem_support] at hy
cases' IsCycle.exists_pow_eq h1 hx hy with n hn
rw [← hn]
exact step2 n
have step4 : ∀ y z : α, swap y z ∈ H := by
intro y z
by_cases h5 : z = x
· rw [h5, swap_comm]
exact step3 y
by_cases h6 : z = y
· rw [h6, swap_self]
exact H.one_mem
rw [← swap_mul_swap_mul_swap h5 h6, swap_comm z x]
exact H.mul_mem (H.mul_mem (step3 y) (step3 z)) (step3 y)
rw [eq_top_iff, ← closure_isSwap, closure_le]
rintro τ ⟨y, z, _, h6⟩
rw [h6]
exact step4 y z
#align equiv.perm.closure_cycle_adjacent_swap Equiv.Perm.closure_cycle_adjacent_swap
| Mathlib/GroupTheory/Perm/Closure.lean | 96 | 108 | theorem closure_cycle_coprime_swap {n : ℕ} {σ : Perm α} (h0 : Nat.Coprime n (Fintype.card α))
(h1 : IsCycle σ) (h2 : σ.support = Finset.univ) (x : α) :
closure ({σ, swap x ((σ ^ n) x)} : Set (Perm α)) = ⊤ := by |
rw [← Finset.card_univ, ← h2, ← h1.orderOf] at h0
cases' exists_pow_eq_self_of_coprime h0 with m hm
have h2' : (σ ^ n).support = ⊤ := Eq.trans (support_pow_coprime h0) h2
have h1' : IsCycle ((σ ^ n) ^ (m : ℤ)) := by rwa [← hm] at h1
replace h1' : IsCycle (σ ^ n) :=
h1'.of_pow (le_trans (support_pow_le σ n) (ge_of_eq (congr_arg support hm)))
rw [eq_top_iff, ← closure_cycle_adjacent_swap h1' h2' x, closure_le, Set.insert_subset_iff]
exact
⟨Subgroup.pow_mem (closure _) (subset_closure (Set.mem_insert σ _)) n,
Set.singleton_subset_iff.mpr (subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)))⟩
| 10 | 22,026.465795 | 2 | 2 | 4 | 2,314 |
import Mathlib.Init.Data.Sigma.Lex
import Mathlib.Data.Prod.Lex
import Mathlib.Data.Sigma.Lex
import Mathlib.Order.Antichain
import Mathlib.Order.OrderIsoNat
import Mathlib.Order.WellFounded
import Mathlib.Tactic.TFAE
#align_import order.well_founded_set from "leanprover-community/mathlib"@"2c84c2c5496117349007d97104e7bbb471381592"
variable {ι α β γ : Type*} {π : ι → Type*}
namespace Set
def WellFoundedOn (s : Set α) (r : α → α → Prop) : Prop :=
WellFounded fun a b : s => r a b
#align set.well_founded_on Set.WellFoundedOn
@[simp]
theorem wellFoundedOn_empty (r : α → α → Prop) : WellFoundedOn ∅ r :=
wellFounded_of_isEmpty _
#align set.well_founded_on_empty Set.wellFoundedOn_empty
def PartiallyWellOrderedOn (s : Set α) (r : α → α → Prop) : Prop :=
∀ f : ℕ → α, (∀ n, f n ∈ s) → ∃ m n : ℕ, m < n ∧ r (f m) (f n)
#align set.partially_well_ordered_on Set.PartiallyWellOrderedOn
section PartiallyWellOrderedOn
variable {r : α → α → Prop} {r' : β → β → Prop} {f : α → β} {s : Set α} {t : Set α} {a : α}
theorem PartiallyWellOrderedOn.mono (ht : t.PartiallyWellOrderedOn r) (h : s ⊆ t) :
s.PartiallyWellOrderedOn r := fun f hf => ht f fun n => h <| hf n
#align set.partially_well_ordered_on.mono Set.PartiallyWellOrderedOn.mono
@[simp]
theorem partiallyWellOrderedOn_empty (r : α → α → Prop) : PartiallyWellOrderedOn ∅ r := fun _ h =>
(h 0).elim
#align set.partially_well_ordered_on_empty Set.partiallyWellOrderedOn_empty
theorem PartiallyWellOrderedOn.union (hs : s.PartiallyWellOrderedOn r)
(ht : t.PartiallyWellOrderedOn r) : (s ∪ t).PartiallyWellOrderedOn r := by
rintro f hf
rcases Nat.exists_subseq_of_forall_mem_union f hf with ⟨g, hgs | hgt⟩
· rcases hs _ hgs with ⟨m, n, hlt, hr⟩
exact ⟨g m, g n, g.strictMono hlt, hr⟩
· rcases ht _ hgt with ⟨m, n, hlt, hr⟩
exact ⟨g m, g n, g.strictMono hlt, hr⟩
#align set.partially_well_ordered_on.union Set.PartiallyWellOrderedOn.union
@[simp]
theorem partiallyWellOrderedOn_union :
(s ∪ t).PartiallyWellOrderedOn r ↔ s.PartiallyWellOrderedOn r ∧ t.PartiallyWellOrderedOn r :=
⟨fun h => ⟨h.mono subset_union_left, h.mono subset_union_right⟩, fun h =>
h.1.union h.2⟩
#align set.partially_well_ordered_on_union Set.partiallyWellOrderedOn_union
theorem PartiallyWellOrderedOn.image_of_monotone_on (hs : s.PartiallyWellOrderedOn r)
(hf : ∀ a₁ ∈ s, ∀ a₂ ∈ s, r a₁ a₂ → r' (f a₁) (f a₂)) : (f '' s).PartiallyWellOrderedOn r' := by
intro g' hg'
choose g hgs heq using hg'
obtain rfl : f ∘ g = g' := funext heq
obtain ⟨m, n, hlt, hmn⟩ := hs g hgs
exact ⟨m, n, hlt, hf _ (hgs m) _ (hgs n) hmn⟩
#align set.partially_well_ordered_on.image_of_monotone_on Set.PartiallyWellOrderedOn.image_of_monotone_on
theorem _root_.IsAntichain.finite_of_partiallyWellOrderedOn (ha : IsAntichain r s)
(hp : s.PartiallyWellOrderedOn r) : s.Finite := by
refine not_infinite.1 fun hi => ?_
obtain ⟨m, n, hmn, h⟩ := hp (fun n => hi.natEmbedding _ n) fun n => (hi.natEmbedding _ n).2
exact hmn.ne ((hi.natEmbedding _).injective <| Subtype.val_injective <|
ha.eq (hi.natEmbedding _ m).2 (hi.natEmbedding _ n).2 h)
#align is_antichain.finite_of_partially_well_ordered_on IsAntichain.finite_of_partiallyWellOrderedOn
section IsRefl
variable [IsRefl α r]
protected theorem Finite.partiallyWellOrderedOn (hs : s.Finite) : s.PartiallyWellOrderedOn r := by
intro f hf
obtain ⟨m, n, hmn, h⟩ := hs.exists_lt_map_eq_of_forall_mem hf
exact ⟨m, n, hmn, h.subst <| refl (f m)⟩
#align set.finite.partially_well_ordered_on Set.Finite.partiallyWellOrderedOn
theorem _root_.IsAntichain.partiallyWellOrderedOn_iff (hs : IsAntichain r s) :
s.PartiallyWellOrderedOn r ↔ s.Finite :=
⟨hs.finite_of_partiallyWellOrderedOn, Finite.partiallyWellOrderedOn⟩
#align is_antichain.partially_well_ordered_on_iff IsAntichain.partiallyWellOrderedOn_iff
@[simp]
theorem partiallyWellOrderedOn_singleton (a : α) : PartiallyWellOrderedOn {a} r :=
(finite_singleton a).partiallyWellOrderedOn
#align set.partially_well_ordered_on_singleton Set.partiallyWellOrderedOn_singleton
@[nontriviality]
theorem Subsingleton.partiallyWellOrderedOn (hs : s.Subsingleton) : PartiallyWellOrderedOn s r :=
hs.finite.partiallyWellOrderedOn
@[simp]
theorem partiallyWellOrderedOn_insert :
PartiallyWellOrderedOn (insert a s) r ↔ PartiallyWellOrderedOn s r := by
simp only [← singleton_union, partiallyWellOrderedOn_union,
partiallyWellOrderedOn_singleton, true_and_iff]
#align set.partially_well_ordered_on_insert Set.partiallyWellOrderedOn_insert
protected theorem PartiallyWellOrderedOn.insert (h : PartiallyWellOrderedOn s r) (a : α) :
PartiallyWellOrderedOn (insert a s) r :=
partiallyWellOrderedOn_insert.2 h
#align set.partially_well_ordered_on.insert Set.PartiallyWellOrderedOn.insert
| Mathlib/Order/WellFoundedSet.lean | 356 | 373 | theorem partiallyWellOrderedOn_iff_finite_antichains [IsSymm α r] :
s.PartiallyWellOrderedOn r ↔ ∀ t, t ⊆ s → IsAntichain r t → t.Finite := by |
refine ⟨fun h t ht hrt => hrt.finite_of_partiallyWellOrderedOn (h.mono ht), ?_⟩
rintro hs f hf
by_contra! H
refine infinite_range_of_injective (fun m n hmn => ?_) (hs _ (range_subset_iff.2 hf) ?_)
· obtain h | h | h := lt_trichotomy m n
· refine (H _ _ h ?_).elim
rw [hmn]
exact refl _
· exact h
· refine (H _ _ h ?_).elim
rw [hmn]
exact refl _
rintro _ ⟨m, hm, rfl⟩ _ ⟨n, hn, rfl⟩ hmn
obtain h | h := (ne_of_apply_ne _ hmn).lt_or_lt
· exact H _ _ h
· exact mt symm (H _ _ h)
| 16 | 8,886,110.520508 | 2 | 1.5 | 10 | 1,649 |
import Mathlib.Analysis.Convex.Combination
import Mathlib.Analysis.Convex.Extreme
#align_import analysis.convex.independent from "leanprover-community/mathlib"@"fefd8a38be7811574cd2ec2f77d3a393a407f112"
open scoped Classical
open Affine
open Finset Function
variable {𝕜 E ι : Type*}
section OrderedSemiring
variable (𝕜) [OrderedSemiring 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E}
def ConvexIndependent (p : ι → E) : Prop :=
∀ (s : Set ι) (x : ι), p x ∈ convexHull 𝕜 (p '' s) → x ∈ s
#align convex_independent ConvexIndependent
variable {𝕜}
theorem Subsingleton.convexIndependent [Subsingleton ι] (p : ι → E) : ConvexIndependent 𝕜 p := by
intro s x hx
have : (convexHull 𝕜 (p '' s)).Nonempty := ⟨p x, hx⟩
rw [convexHull_nonempty_iff, Set.image_nonempty] at this
rwa [Subsingleton.mem_iff_nonempty]
#align subsingleton.convex_independent Subsingleton.convexIndependent
protected theorem ConvexIndependent.injective {p : ι → E} (hc : ConvexIndependent 𝕜 p) :
Function.Injective p := by
refine fun i j hij => hc {j} i ?_
rw [hij, Set.image_singleton, convexHull_singleton]
exact Set.mem_singleton _
#align convex_independent.injective ConvexIndependent.injective
theorem ConvexIndependent.comp_embedding {ι' : Type*} (f : ι' ↪ ι) {p : ι → E}
(hc : ConvexIndependent 𝕜 p) : ConvexIndependent 𝕜 (p ∘ f) := by
intro s x hx
rw [← f.injective.mem_set_image]
exact hc _ _ (by rwa [Set.image_image])
#align convex_independent.comp_embedding ConvexIndependent.comp_embedding
protected theorem ConvexIndependent.subtype {p : ι → E} (hc : ConvexIndependent 𝕜 p) (s : Set ι) :
ConvexIndependent 𝕜 fun i : s => p i :=
hc.comp_embedding (Embedding.subtype _)
#align convex_independent.subtype ConvexIndependent.subtype
protected theorem ConvexIndependent.range {p : ι → E} (hc : ConvexIndependent 𝕜 p) :
ConvexIndependent 𝕜 ((↑) : Set.range p → E) := by
let f : Set.range p → ι := fun x => x.property.choose
have hf : ∀ x, p (f x) = x := fun x => x.property.choose_spec
let fe : Set.range p ↪ ι := ⟨f, fun x₁ x₂ he => Subtype.ext (hf x₁ ▸ hf x₂ ▸ he ▸ rfl)⟩
convert hc.comp_embedding fe
ext
rw [Embedding.coeFn_mk, comp_apply, hf]
#align convex_independent.range ConvexIndependent.range
protected theorem ConvexIndependent.mono {s t : Set E} (hc : ConvexIndependent 𝕜 ((↑) : t → E))
(hs : s ⊆ t) : ConvexIndependent 𝕜 ((↑) : s → E) :=
hc.comp_embedding (s.embeddingOfSubset t hs)
#align convex_independent.mono ConvexIndependent.mono
theorem Function.Injective.convexIndependent_iff_set {p : ι → E} (hi : Function.Injective p) :
ConvexIndependent 𝕜 ((↑) : Set.range p → E) ↔ ConvexIndependent 𝕜 p :=
⟨fun hc =>
hc.comp_embedding
(⟨fun i => ⟨p i, Set.mem_range_self _⟩, fun _ _ h => hi (Subtype.mk_eq_mk.1 h)⟩ :
ι ↪ Set.range p),
ConvexIndependent.range⟩
#align function.injective.convex_independent_iff_set Function.Injective.convexIndependent_iff_set
@[simp]
protected theorem ConvexIndependent.mem_convexHull_iff {p : ι → E} (hc : ConvexIndependent 𝕜 p)
(s : Set ι) (i : ι) : p i ∈ convexHull 𝕜 (p '' s) ↔ i ∈ s :=
⟨hc _ _, fun hi => subset_convexHull 𝕜 _ (Set.mem_image_of_mem p hi)⟩
#align convex_independent.mem_convex_hull_iff ConvexIndependent.mem_convexHull_iff
theorem convexIndependent_iff_not_mem_convexHull_diff {p : ι → E} :
ConvexIndependent 𝕜 p ↔ ∀ i s, p i ∉ convexHull 𝕜 (p '' (s \ {i})) := by
refine ⟨fun hc i s h => ?_, fun h s i hi => ?_⟩
· rw [hc.mem_convexHull_iff] at h
exact h.2 (Set.mem_singleton _)
· by_contra H
refine h i s ?_
rw [Set.diff_singleton_eq_self H]
exact hi
#align convex_independent_iff_not_mem_convex_hull_diff convexIndependent_iff_not_mem_convexHull_diff
| Mathlib/Analysis/Convex/Independent.lean | 144 | 153 | theorem convexIndependent_set_iff_inter_convexHull_subset {s : Set E} :
ConvexIndependent 𝕜 ((↑) : s → E) ↔ ∀ t, t ⊆ s → s ∩ convexHull 𝕜 t ⊆ t := by |
constructor
· rintro hc t h x ⟨hxs, hxt⟩
refine hc { x | ↑x ∈ t } ⟨x, hxs⟩ ?_
rw [Subtype.coe_image_of_subset h]
exact hxt
· intro hc t x h
rw [← Subtype.coe_injective.mem_set_image]
exact hc (t.image ((↑) : s → E)) (Subtype.coe_image_subset s t) ⟨x.prop, h⟩
| 8 | 2,980.957987 | 2 | 1.8 | 5 | 1,891 |
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Vars
def vars (p : MvPolynomial σ R) : Finset σ :=
letI := Classical.decEq σ
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_C MvPolynomial.vars_C
@[simp]
theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_X MvPolynomial.vars_X
theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop]
#align mv_polynomial.mem_vars MvPolynomial.mem_vars
theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support)
{v : σ} (h : v ∉ vars f) : x v = 0 := by
contrapose! h
exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
#align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero
theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) :
(p + q).vars ⊆ p.vars ∪ q.vars := by
intro x hx
simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx ⊢
simpa using Multiset.mem_of_le (degrees_add _ _) hx
#align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset
theorem vars_add_of_disjoint [DecidableEq σ] (h : Disjoint p.vars q.vars) :
(p + q).vars = p.vars ∪ q.vars := by
refine (vars_add_subset p q).antisymm fun x hx => ?_
simp only [vars_def, Multiset.disjoint_toFinset] at h hx ⊢
rwa [degrees_add_of_disjoint h, Multiset.toFinset_union]
#align mv_polynomial.vars_add_of_disjoint MvPolynomial.vars_add_of_disjoint
section Mul
theorem vars_mul [DecidableEq σ] (φ ψ : MvPolynomial σ R) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars := by
simp_rw [vars_def, ← Multiset.toFinset_add, Multiset.toFinset_subset]
exact Multiset.subset_of_le (degrees_mul φ ψ)
#align mv_polynomial.vars_mul MvPolynomial.vars_mul
@[simp]
theorem vars_one : (1 : MvPolynomial σ R).vars = ∅ :=
vars_C
#align mv_polynomial.vars_one MvPolynomial.vars_one
theorem vars_pow (φ : MvPolynomial σ R) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars := by
classical
induction' n with n ih
· simp
· rw [pow_succ']
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset (Finset.Subset.refl _) ih
#align mv_polynomial.vars_pow MvPolynomial.vars_pow
theorem vars_prod {ι : Type*} [DecidableEq σ] {s : Finset ι} (f : ι → MvPolynomial σ R) :
(∏ i ∈ s, f i).vars ⊆ s.biUnion fun i => (f i).vars := by
classical
induction s using Finset.induction_on with
| empty => simp
| insert hs hsub =>
simp only [hs, Finset.biUnion_insert, Finset.prod_insert, not_false_iff]
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset_union (Finset.Subset.refl _) hsub
#align mv_polynomial.vars_prod MvPolynomial.vars_prod
section Sum
variable {ι : Type*} (t : Finset ι) (φ : ι → MvPolynomial σ R)
| Mathlib/Algebra/MvPolynomial/Variables.lean | 180 | 189 | theorem vars_sum_subset [DecidableEq σ] :
(∑ i ∈ t, φ i).vars ⊆ Finset.biUnion t fun i => (φ i).vars := by |
classical
induction t using Finset.induction_on with
| empty => simp
| insert has hsum =>
rw [Finset.biUnion_insert, Finset.sum_insert has]
refine Finset.Subset.trans
(vars_add_subset _ _) (Finset.union_subset_union (Finset.Subset.refl _) ?_)
assumption
| 8 | 2,980.957987 | 2 | 0.9 | 20 | 778 |
import Mathlib.MeasureTheory.Group.GeometryOfNumbers
import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls
import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional
local notation "E" K =>
({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ)
section convexBodyLT
open Metric NNReal
variable (f : InfinitePlace K → ℝ≥0)
abbrev convexBodyLT : Set (E K) :=
(Set.univ.pi (fun w : { w : InfinitePlace K // IsReal w } => ball 0 (f w))) ×ˢ
(Set.univ.pi (fun w : { w : InfinitePlace K // IsComplex w } => ball 0 (f w)))
theorem convexBodyLT_mem {x : K} :
mixedEmbedding K x ∈ (convexBodyLT K f) ↔ ∀ w : InfinitePlace K, w x < f w := by
simp_rw [mixedEmbedding, RingHom.prod_apply, Set.mem_prod, Set.mem_pi, Set.mem_univ,
forall_true_left, mem_ball_zero_iff, Pi.ringHom_apply, ← Complex.norm_real,
embedding_of_isReal_apply, Subtype.forall, ← forall₂_or_left, ← not_isReal_iff_isComplex, em,
forall_true_left, norm_embedding_eq]
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean | 70 | 75 | theorem convexBodyLT_neg_mem (x : E K) (hx : x ∈ (convexBodyLT K f)) :
-x ∈ (convexBodyLT K f) := by |
simp only [Set.mem_prod, Prod.fst_neg, Set.mem_pi, Set.mem_univ, Pi.neg_apply,
mem_ball_zero_iff, norm_neg, Real.norm_eq_abs, forall_true_left, Subtype.forall,
Prod.snd_neg, Complex.norm_eq_abs] at hx ⊢
exact hx
| 4 | 54.59815 | 2 | 1.666667 | 15 | 1,803 |
import Mathlib.Algebra.Polynomial.Smeval
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.RingTheory.Polynomial.Pochhammer
section Multichoose
open Function Polynomial
class BinomialRing (R : Type*) [AddCommMonoid R] [Pow R ℕ] where
nsmul_right_injective (n : ℕ) (h : n ≠ 0) : Injective (n • · : R → R)
multichoose : R → ℕ → R
factorial_nsmul_multichoose (r : R) (n : ℕ) :
n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r
section Pochhammer
namespace Polynomial
theorem ascPochhammer_smeval_cast (R : Type*) [Semiring R] {S : Type*} [NonAssocSemiring S]
[Pow S ℕ] [Module R S] [IsScalarTower R S S] [NatPowAssoc S]
(x : S) (n : ℕ) : (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x := by
induction' n with n hn
· simp only [Nat.zero_eq, ascPochhammer_zero, smeval_one, one_smul]
· simp only [ascPochhammer_succ_right, mul_add, smeval_add, smeval_mul_X, ← Nat.cast_comm]
simp only [← C_eq_natCast, smeval_C_mul, hn, ← nsmul_eq_smul_cast R n]
exact rfl
variable {R S : Type*}
theorem ascPochhammer_smeval_eq_eval [Semiring R] (r : R) (n : ℕ) :
(ascPochhammer ℕ n).smeval r = (ascPochhammer R n).eval r := by
rw [eval_eq_smeval, ascPochhammer_smeval_cast R]
variable [NonAssocRing R] [Pow R ℕ] [NatPowAssoc R]
theorem descPochhammer_smeval_eq_ascPochhammer (r : R) (n : ℕ) :
(descPochhammer ℤ n).smeval r = (ascPochhammer ℕ n).smeval (r - n + 1) := by
induction n with
| zero => simp only [descPochhammer_zero, ascPochhammer_zero, smeval_one, npow_zero]
| succ n ih =>
rw [Nat.cast_succ, sub_add, add_sub_cancel_right, descPochhammer_succ_right, smeval_mul, ih,
ascPochhammer_succ_left, X_mul, smeval_mul_X, smeval_comp, smeval_sub, ← C_eq_natCast,
smeval_add, smeval_one, smeval_C]
simp only [smeval_X, npow_one, npow_zero, zsmul_one, Int.cast_natCast, one_smul]
| Mathlib/RingTheory/Binomial.lean | 117 | 127 | theorem descPochhammer_smeval_eq_descFactorial (n k : ℕ) :
(descPochhammer ℤ k).smeval (n : R) = n.descFactorial k := by |
induction k with
| zero =>
rw [descPochhammer_zero, Nat.descFactorial_zero, Nat.cast_one, smeval_one, npow_zero, one_smul]
| succ k ih =>
rw [descPochhammer_succ_right, Nat.descFactorial_succ, smeval_mul, ih, mul_comm, Nat.cast_mul,
smeval_sub, smeval_X, smeval_natCast, npow_one, npow_zero, nsmul_one]
by_cases h : n < k
· simp only [Nat.descFactorial_eq_zero_iff_lt.mpr h, Nat.cast_zero, zero_mul]
· rw [Nat.cast_sub <| not_lt.mp h]
| 9 | 8,103.083928 | 2 | 1.6 | 5 | 1,723 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.Order.Fin
import Mathlib.Order.PiLex
import Mathlib.Order.Interval.Set.Basic
#align_import data.fin.tuple.basic from "leanprover-community/mathlib"@"ef997baa41b5c428be3fb50089a7139bf4ee886b"
assert_not_exists MonoidWithZero
universe u v
namespace Fin
variable {m n : ℕ}
open Function
section Tuple
example (α : Fin 0 → Sort u) : Unique (∀ i : Fin 0, α i) := by infer_instance
theorem tuple0_le {α : Fin 0 → Type*} [∀ i, Preorder (α i)] (f g : ∀ i, α i) : f ≤ g :=
finZeroElim
#align fin.tuple0_le Fin.tuple0_le
variable {α : Fin (n + 1) → Type u} (x : α 0) (q : ∀ i, α i) (p : ∀ i : Fin n, α i.succ) (i : Fin n)
(y : α i.succ) (z : α 0)
def tail (q : ∀ i, α i) : ∀ i : Fin n, α i.succ := fun i ↦ q i.succ
#align fin.tail Fin.tail
theorem tail_def {n : ℕ} {α : Fin (n + 1) → Type*} {q : ∀ i, α i} :
(tail fun k : Fin (n + 1) ↦ q k) = fun k : Fin n ↦ q k.succ :=
rfl
#align fin.tail_def Fin.tail_def
def cons (x : α 0) (p : ∀ i : Fin n, α i.succ) : ∀ i, α i := fun j ↦ Fin.cases x p j
#align fin.cons Fin.cons
@[simp]
theorem tail_cons : tail (cons x p) = p := by
simp (config := { unfoldPartialApp := true }) [tail, cons]
#align fin.tail_cons Fin.tail_cons
@[simp]
theorem cons_succ : cons x p i.succ = p i := by simp [cons]
#align fin.cons_succ Fin.cons_succ
@[simp]
theorem cons_zero : cons x p 0 = x := by simp [cons]
#align fin.cons_zero Fin.cons_zero
@[simp]
theorem cons_one {α : Fin (n + 2) → Type*} (x : α 0) (p : ∀ i : Fin n.succ, α i.succ) :
cons x p 1 = p 0 := by
rw [← cons_succ x p]; rfl
@[simp]
theorem cons_update : cons x (update p i y) = update (cons x p) i.succ y := by
ext j
by_cases h : j = 0
· rw [h]
simp [Ne.symm (succ_ne_zero i)]
· let j' := pred j h
have : j'.succ = j := succ_pred j h
rw [← this, cons_succ]
by_cases h' : j' = i
· rw [h']
simp
· have : j'.succ ≠ i.succ := by rwa [Ne, succ_inj]
rw [update_noteq h', update_noteq this, cons_succ]
#align fin.cons_update Fin.cons_update
theorem cons_injective2 : Function.Injective2 (@cons n α) := fun x₀ y₀ x y h ↦
⟨congr_fun h 0, funext fun i ↦ by simpa using congr_fun h (Fin.succ i)⟩
#align fin.cons_injective2 Fin.cons_injective2
@[simp]
theorem cons_eq_cons {x₀ y₀ : α 0} {x y : ∀ i : Fin n, α i.succ} :
cons x₀ x = cons y₀ y ↔ x₀ = y₀ ∧ x = y :=
cons_injective2.eq_iff
#align fin.cons_eq_cons Fin.cons_eq_cons
theorem cons_left_injective (x : ∀ i : Fin n, α i.succ) : Function.Injective fun x₀ ↦ cons x₀ x :=
cons_injective2.left _
#align fin.cons_left_injective Fin.cons_left_injective
theorem cons_right_injective (x₀ : α 0) : Function.Injective (cons x₀) :=
cons_injective2.right _
#align fin.cons_right_injective Fin.cons_right_injective
theorem update_cons_zero : update (cons x p) 0 z = cons z p := by
ext j
by_cases h : j = 0
· rw [h]
simp
· simp only [h, update_noteq, Ne, not_false_iff]
let j' := pred j h
have : j'.succ = j := succ_pred j h
rw [← this, cons_succ, cons_succ]
#align fin.update_cons_zero Fin.update_cons_zero
@[simp, nolint simpNF] -- Porting note: linter claims LHS doesn't simplify
| Mathlib/Data/Fin/Tuple/Basic.lean | 141 | 150 | theorem cons_self_tail : cons (q 0) (tail q) = q := by |
ext j
by_cases h : j = 0
· rw [h]
simp
· let j' := pred j h
have : j'.succ = j := succ_pred j h
rw [← this]
unfold tail
rw [cons_succ]
| 9 | 8,103.083928 | 2 | 0.875 | 8 | 761 |
import Mathlib.Data.Int.GCD
import Mathlib.Tactic.NormNum
namespace Tactic
namespace NormNum
theorem int_gcd_helper' {d : ℕ} {x y : ℤ} (a b : ℤ) (h₁ : (d : ℤ) ∣ x) (h₂ : (d : ℤ) ∣ y)
(h₃ : x * a + y * b = d) : Int.gcd x y = d := by
refine Nat.dvd_antisymm ?_ (Int.natCast_dvd_natCast.1 (Int.dvd_gcd h₁ h₂))
rw [← Int.natCast_dvd_natCast, ← h₃]
apply dvd_add
· exact Int.gcd_dvd_left.mul_right _
· exact Int.gcd_dvd_right.mul_right _
theorem nat_gcd_helper_dvd_left (x y : ℕ) (h : y % x = 0) : Nat.gcd x y = x :=
Nat.gcd_eq_left (Nat.dvd_of_mod_eq_zero h)
theorem nat_gcd_helper_dvd_right (x y : ℕ) (h : x % y = 0) : Nat.gcd x y = y :=
Nat.gcd_eq_right (Nat.dvd_of_mod_eq_zero h)
| Mathlib/Tactic/NormNum/GCD.lean | 36 | 43 | theorem nat_gcd_helper_2 (d x y a b : ℕ) (hu : x % d = 0) (hv : y % d = 0)
(h : x * a = y * b + d) : Nat.gcd x y = d := by |
rw [← Int.gcd_natCast_natCast]
apply int_gcd_helper' a (-b)
(Int.natCast_dvd_natCast.mpr (Nat.dvd_of_mod_eq_zero hu))
(Int.natCast_dvd_natCast.mpr (Nat.dvd_of_mod_eq_zero hv))
rw [mul_neg, ← sub_eq_add_neg, sub_eq_iff_eq_add']
exact mod_cast h
| 6 | 403.428793 | 2 | 1 | 4 | 950 |
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Num.Lemmas
import Mathlib.Data.Option.Basic
import Mathlib.SetTheory.Cardinal.Basic
#align_import computability.encoding from "leanprover-community/mathlib"@"b6395b3a5acd655b16385fa0cdbf1961d6c34b3e"
universe u v
open Cardinal
namespace Computability
structure Encoding (α : Type u) where
Γ : Type v
encode : α → List Γ
decode : List Γ → Option α
decode_encode : ∀ x, decode (encode x) = some x
#align computability.encoding Computability.Encoding
theorem Encoding.encode_injective {α : Type u} (e : Encoding α) : Function.Injective e.encode := by
refine fun _ _ h => Option.some_injective _ ?_
rw [← e.decode_encode, ← e.decode_encode, h]
#align computability.encoding.encode_injective Computability.Encoding.encode_injective
structure FinEncoding (α : Type u) extends Encoding.{u, 0} α where
ΓFin : Fintype Γ
#align computability.fin_encoding Computability.FinEncoding
instance Γ.fintype {α : Type u} (e : FinEncoding α) : Fintype e.toEncoding.Γ :=
e.ΓFin
#align computability.Γ.fintype Computability.Γ.fintype
inductive Γ'
| blank
| bit (b : Bool)
| bra
| ket
| comma
deriving DecidableEq
#align computability.Γ' Computability.Γ'
-- Porting note: A handler for `Fintype` had not been implemented yet.
instance Γ'.fintype : Fintype Γ' :=
⟨⟨{.blank, .bit true, .bit false, .bra, .ket, .comma}, by decide⟩,
by intro; cases_type* Γ' Bool <;> decide⟩
#align computability.Γ'.fintype Computability.Γ'.fintype
instance inhabitedΓ' : Inhabited Γ' :=
⟨Γ'.blank⟩
#align computability.inhabited_Γ' Computability.inhabitedΓ'
def inclusionBoolΓ' : Bool → Γ' :=
Γ'.bit
#align computability.inclusion_bool_Γ' Computability.inclusionBoolΓ'
def sectionΓ'Bool : Γ' → Bool
| Γ'.bit b => b
| _ => Inhabited.default
#align computability.section_Γ'_bool Computability.sectionΓ'Bool
theorem leftInverse_section_inclusion : Function.LeftInverse sectionΓ'Bool inclusionBoolΓ' :=
fun x => Bool.casesOn x rfl rfl
#align computability.left_inverse_section_inclusion Computability.leftInverse_section_inclusion
theorem inclusionBoolΓ'_injective : Function.Injective inclusionBoolΓ' :=
Function.HasLeftInverse.injective (Exists.intro sectionΓ'Bool leftInverse_section_inclusion)
#align computability.inclusion_bool_Γ'_injective Computability.inclusionBoolΓ'_injective
def encodePosNum : PosNum → List Bool
| PosNum.one => [true]
| PosNum.bit0 n => false :: encodePosNum n
| PosNum.bit1 n => true :: encodePosNum n
#align computability.encode_pos_num Computability.encodePosNum
def encodeNum : Num → List Bool
| Num.zero => []
| Num.pos n => encodePosNum n
#align computability.encode_num Computability.encodeNum
def encodeNat (n : ℕ) : List Bool :=
encodeNum n
#align computability.encode_nat Computability.encodeNat
def decodePosNum : List Bool → PosNum
| false :: l => PosNum.bit0 (decodePosNum l)
| true :: l => ite (l = []) PosNum.one (PosNum.bit1 (decodePosNum l))
| _ => PosNum.one
#align computability.decode_pos_num Computability.decodePosNum
def decodeNum : List Bool → Num := fun l => ite (l = []) Num.zero <| decodePosNum l
#align computability.decode_num Computability.decodeNum
def decodeNat : List Bool → Nat := fun l => decodeNum l
#align computability.decode_nat Computability.decodeNat
theorem encodePosNum_nonempty (n : PosNum) : encodePosNum n ≠ [] :=
PosNum.casesOn n (List.cons_ne_nil _ _) (fun _m => List.cons_ne_nil _ _) fun _m =>
List.cons_ne_nil _ _
#align computability.encode_pos_num_nonempty Computability.encodePosNum_nonempty
| Mathlib/Computability/Encoding.lean | 134 | 140 | theorem decode_encodePosNum : ∀ n, decodePosNum (encodePosNum n) = n := by |
intro n
induction' n with m hm m hm <;> unfold encodePosNum decodePosNum
· rfl
· rw [hm]
exact if_neg (encodePosNum_nonempty m)
· exact congr_arg PosNum.bit0 hm
| 6 | 403.428793 | 2 | 1.5 | 4 | 1,566 |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.Module.Defs
import Mathlib.Tactic.Abel
namespace Finset
variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] (f : ℕ → R) (g : ℕ → M) {m n : ℕ}
-- The partial sum of `g`, starting from zero
local notation "G " n:80 => ∑ i ∈ range n, g i
theorem sum_Ico_by_parts (hmn : m < n) :
∑ i ∈ Ico m n, f i • g i =
f (n - 1) • G n - f m • G m - ∑ i ∈ Ico m (n - 1), (f (i + 1) - f i) • G (i + 1) := by
have h₁ : (∑ i ∈ Ico (m + 1) n, f i • G i) = ∑ i ∈ Ico m (n - 1), f (i + 1) • G (i + 1) := by
rw [← Nat.sub_add_cancel (Nat.one_le_of_lt hmn), ← sum_Ico_add']
simp only [ge_iff_le, tsub_le_iff_right, add_le_iff_nonpos_left, nonpos_iff_eq_zero,
tsub_eq_zero_iff_le, add_tsub_cancel_right]
have h₂ :
(∑ i ∈ Ico (m + 1) n, f i • G (i + 1)) =
(∑ i ∈ Ico m (n - 1), f i • G (i + 1)) + f (n - 1) • G n - f m • G (m + 1) := by
rw [← sum_Ico_sub_bot _ hmn, ← sum_Ico_succ_sub_top _ (Nat.le_sub_one_of_lt hmn),
Nat.sub_add_cancel (pos_of_gt hmn), sub_add_cancel]
rw [sum_eq_sum_Ico_succ_bot hmn]
-- Porting note: the following used to be done with `conv`
have h₃: (Finset.sum (Ico (m + 1) n) fun i => f i • g i) =
(Finset.sum (Ico (m + 1) n) fun i =>
f i • ((Finset.sum (Finset.range (i + 1)) g) -
(Finset.sum (Finset.range i) g))) := by
congr; funext; rw [← sum_range_succ_sub_sum g]
rw [h₃]
simp_rw [smul_sub, sum_sub_distrib, h₂, h₁]
-- Porting note: the following used to be done with `conv`
have h₄ : ((((Finset.sum (Ico m (n - 1)) fun i => f i • Finset.sum (range (i + 1)) fun i => g i) +
f (n - 1) • Finset.sum (range n) fun i => g i) -
f m • Finset.sum (range (m + 1)) fun i => g i) -
Finset.sum (Ico m (n - 1)) fun i => f (i + 1) • Finset.sum (range (i + 1)) fun i => g i) =
f (n - 1) • (range n).sum g - f m • (range (m + 1)).sum g +
Finset.sum (Ico m (n - 1)) (fun i => f i • (range (i + 1)).sum g -
f (i + 1) • (range (i + 1)).sum g) := by
rw [← add_sub, add_comm, ← add_sub, ← sum_sub_distrib]
rw [h₄]
have : ∀ i, f i • G (i + 1) - f (i + 1) • G (i + 1) = -((f (i + 1) - f i) • G (i + 1)) := by
intro i
rw [sub_smul]
abel
simp_rw [this, sum_neg_distrib, sum_range_succ, smul_add]
abel
#align finset.sum_Ico_by_parts Finset.sum_Ico_by_parts
variable (n)
| Mathlib/Algebra/BigOperators/Module.lean | 63 | 69 | theorem sum_range_by_parts :
∑ i ∈ range n, f i • g i =
f (n - 1) • G n - ∑ i ∈ range (n - 1), (f (i + 1) - f i) • G (i + 1) := by |
by_cases hn : n = 0
· simp [hn]
· rw [range_eq_Ico, sum_Ico_by_parts f g (Nat.pos_of_ne_zero hn), sum_range_zero, smul_zero,
sub_zero, range_eq_Ico]
| 4 | 54.59815 | 2 | 2 | 2 | 2,449 |
import Mathlib.Algebra.Order.Group.TypeTags
import Mathlib.FieldTheory.RatFunc.Degree
import Mathlib.RingTheory.DedekindDomain.IntegralClosure
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.Topology.Algebra.ValuedField
#align_import number_theory.function_field from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open scoped nonZeroDivisors Polynomial DiscreteValuation
variable (Fq F : Type) [Field Fq] [Field F]
abbrev FunctionField [Algebra (RatFunc Fq) F] : Prop :=
FiniteDimensional (RatFunc Fq) F
#align function_field FunctionField
-- Porting note: Removed `protected`
theorem functionField_iff (Fqt : Type*) [Field Fqt] [Algebra Fq[X] Fqt]
[IsFractionRing Fq[X] Fqt] [Algebra (RatFunc Fq) F] [Algebra Fqt F] [Algebra Fq[X] F]
[IsScalarTower Fq[X] Fqt F] [IsScalarTower Fq[X] (RatFunc Fq) F] :
FunctionField Fq F ↔ FiniteDimensional Fqt F := by
let e := IsLocalization.algEquiv Fq[X]⁰ (RatFunc Fq) Fqt
have : ∀ (c) (x : F), e c • x = c • x := by
intro c x
rw [Algebra.smul_def, Algebra.smul_def]
congr
refine congr_fun (f := fun c => algebraMap Fqt F (e c)) ?_ c -- Porting note: Added `(f := _)`
refine IsLocalization.ext (nonZeroDivisors Fq[X]) _ _ ?_ ?_ ?_ ?_ ?_ <;> intros <;>
simp only [AlgEquiv.map_one, RingHom.map_one, AlgEquiv.map_mul, RingHom.map_mul,
AlgEquiv.commutes, ← IsScalarTower.algebraMap_apply]
constructor <;> intro h
· let b := FiniteDimensional.finBasis (RatFunc Fq) F
exact FiniteDimensional.of_fintype_basis (b.mapCoeffs e this)
· let b := FiniteDimensional.finBasis Fqt F
refine FiniteDimensional.of_fintype_basis (b.mapCoeffs e.symm ?_)
intro c x; convert (this (e.symm c) x).symm; simp only [e.apply_symm_apply]
#align function_field_iff functionField_iff
theorem algebraMap_injective [Algebra Fq[X] F] [Algebra (RatFunc Fq) F]
[IsScalarTower Fq[X] (RatFunc Fq) F] : Function.Injective (⇑(algebraMap Fq[X] F)) := by
rw [IsScalarTower.algebraMap_eq Fq[X] (RatFunc Fq) F]
exact (algebraMap (RatFunc Fq) F).injective.comp (IsFractionRing.injective Fq[X] (RatFunc Fq))
#align algebra_map_injective algebraMap_injective
namespace FunctionField
def ringOfIntegers [Algebra Fq[X] F] :=
integralClosure Fq[X] F
#align function_field.ring_of_integers FunctionField.ringOfIntegers
section InftyValuation
variable [DecidableEq (RatFunc Fq)]
def inftyValuationDef (r : RatFunc Fq) : ℤₘ₀ :=
if r = 0 then 0 else ↑(Multiplicative.ofAdd r.intDegree)
#align function_field.infty_valuation_def FunctionField.inftyValuationDef
theorem InftyValuation.map_zero' : inftyValuationDef Fq 0 = 0 :=
if_pos rfl
#align function_field.infty_valuation.map_zero' FunctionField.InftyValuation.map_zero'
theorem InftyValuation.map_one' : inftyValuationDef Fq 1 = 1 :=
(if_neg one_ne_zero).trans <| by rw [RatFunc.intDegree_one, ofAdd_zero, WithZero.coe_one]
#align function_field.infty_valuation.map_one' FunctionField.InftyValuation.map_one'
| Mathlib/NumberTheory/FunctionField.lean | 168 | 176 | theorem InftyValuation.map_mul' (x y : RatFunc Fq) :
inftyValuationDef Fq (x * y) = inftyValuationDef Fq x * inftyValuationDef Fq y := by |
rw [inftyValuationDef, inftyValuationDef, inftyValuationDef]
by_cases hx : x = 0
· rw [hx, zero_mul, if_pos (Eq.refl _), zero_mul]
· by_cases hy : y = 0
· rw [hy, mul_zero, if_pos (Eq.refl _), mul_zero]
· rw [if_neg hx, if_neg hy, if_neg (mul_ne_zero hx hy), ← WithZero.coe_mul, WithZero.coe_inj,
← ofAdd_add, RatFunc.intDegree_mul hx hy]
| 7 | 1,096.633158 | 2 | 1.428571 | 7 | 1,522 |
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Nat.Choose.Vandermonde
import Mathlib.Tactic.FieldSimp
#align_import data.polynomial.hasse_deriv from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
noncomputable section
namespace Polynomial
open Nat Polynomial
open Function
variable {R : Type*} [Semiring R] (k : ℕ) (f : R[X])
def hasseDeriv (k : ℕ) : R[X] →ₗ[R] R[X] :=
lsum fun i => monomial (i - k) ∘ₗ DistribMulAction.toLinearMap R R (i.choose k)
#align polynomial.hasse_deriv Polynomial.hasseDeriv
theorem hasseDeriv_apply :
hasseDeriv k f = f.sum fun i r => monomial (i - k) (↑(i.choose k) * r) := by
dsimp [hasseDeriv]
congr; ext; congr
apply nsmul_eq_mul
#align polynomial.hasse_deriv_apply Polynomial.hasseDeriv_apply
| Mathlib/Algebra/Polynomial/HasseDeriv.lean | 67 | 80 | theorem hasseDeriv_coeff (n : ℕ) :
(hasseDeriv k f).coeff n = (n + k).choose k * f.coeff (n + k) := by |
rw [hasseDeriv_apply, coeff_sum, sum_def, Finset.sum_eq_single (n + k), coeff_monomial]
· simp only [if_true, add_tsub_cancel_right, eq_self_iff_true]
· intro i _hi hink
rw [coeff_monomial]
by_cases hik : i < k
· simp only [Nat.choose_eq_zero_of_lt hik, ite_self, Nat.cast_zero, zero_mul]
· push_neg at hik
rw [if_neg]
contrapose! hink
exact (tsub_eq_iff_eq_add_of_le hik).mp hink
· intro h
simp only [not_mem_support_iff.mp h, monomial_zero_right, mul_zero, coeff_zero]
| 12 | 162,754.791419 | 2 | 1.2 | 10 | 1,278 |
import Mathlib.Geometry.Manifold.Sheaf.Smooth
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace
noncomputable section
universe u
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
{EM : Type*} [NormedAddCommGroup EM] [NormedSpace 𝕜 EM]
{HM : Type*} [TopologicalSpace HM] (IM : ModelWithCorners 𝕜 EM HM)
{M : Type u} [TopologicalSpace M] [ChartedSpace HM M]
open AlgebraicGeometry Manifold TopologicalSpace Topology
| Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean | 43 | 98 | theorem smoothSheafCommRing.isUnit_stalk_iff {x : M}
(f : (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf.stalk x) :
IsUnit f ↔ f ∉ RingHom.ker (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) := by |
constructor
· rintro ⟨⟨f, g, hf, hg⟩, rfl⟩ (h' : smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x f = 0)
simpa [h'] using congr_arg (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) hf
· let S := (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf
-- Suppose that `f`, in the stalk at `x`, is nonzero at `x`
rintro (hf : _ ≠ 0)
-- Represent `f` as the germ of some function (also called `f`) on an open neighbourhood `U` of
-- `x`, which is nonzero at `x`
obtain ⟨U : Opens M, hxU, f : C^∞⟮IM, U; 𝓘(𝕜), 𝕜⟯, rfl⟩ := S.germ_exist x f
have hf' : f ⟨x, hxU⟩ ≠ 0 := by
convert hf
exact (smoothSheafCommRing.eval_germ U ⟨x, hxU⟩ f).symm
-- In fact, by continuity, `f` is nonzero on a neighbourhood `V` of `x`
have H : ∀ᶠ (z : U) in 𝓝 ⟨x, hxU⟩, f z ≠ 0 := f.2.continuous.continuousAt.eventually_ne hf'
rw [eventually_nhds_iff] at H
obtain ⟨V₀, hV₀f, hV₀, hxV₀⟩ := H
let V : Opens M := ⟨Subtype.val '' V₀, U.2.isOpenMap_subtype_val V₀ hV₀⟩
have hUV : V ≤ U := Subtype.coe_image_subset (U : Set M) V₀
have hV : V₀ = Set.range (Set.inclusion hUV) := by
convert (Set.range_inclusion hUV).symm
ext y
show _ ↔ y ∈ Subtype.val ⁻¹' (Subtype.val '' V₀)
rw [Set.preimage_image_eq _ Subtype.coe_injective]
clear_value V
subst hV
have hxV : x ∈ (V : Set M) := by
obtain ⟨x₀, hxx₀⟩ := hxV₀
convert x₀.2
exact congr_arg Subtype.val hxx₀.symm
have hVf : ∀ y : V, f (Set.inclusion hUV y) ≠ 0 :=
fun y ↦ hV₀f (Set.inclusion hUV y) (Set.mem_range_self y)
-- Let `g` be the pointwise inverse of `f` on `V`, which is smooth since `f` is nonzero there
let g : C^∞⟮IM, V; 𝓘(𝕜), 𝕜⟯ := ⟨(f ∘ Set.inclusion hUV)⁻¹, ?_⟩
-- The germ of `g` is inverse to the germ of `f`, so `f` is a unit
· refine ⟨⟨S.germ ⟨x, hxV⟩ (SmoothMap.restrictRingHom IM 𝓘(𝕜) 𝕜 hUV f), S.germ ⟨x, hxV⟩ g,
?_, ?_⟩, S.germ_res_apply hUV.hom ⟨x, hxV⟩ f⟩
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply mul_inv_cancel
exact hVf y
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply inv_mul_cancel
exact hVf y
· intro y
exact ((contDiffAt_inv _ (hVf y)).contMDiffAt).comp y
(f.smooth.comp (smooth_inclusion hUV)).smoothAt
| 53 | 104,137,594,330,290,870,000,000 | 2 | 1.5 | 2 | 1,620 |
import Mathlib.Analysis.SpecialFunctions.JapaneseBracket
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Integral.IntegralEqImproper
import Mathlib.MeasureTheory.Measure.Lebesgue.Integral
#align_import analysis.special_functions.improper_integrals from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open Real Set Filter MeasureTheory intervalIntegral
open scoped Topology
| Mathlib/Analysis/SpecialFunctions/ImproperIntegrals.lean | 32 | 38 | theorem integrableOn_exp_Iic (c : ℝ) : IntegrableOn exp (Iic c) := by |
refine
integrableOn_Iic_of_intervalIntegral_norm_bounded (exp c) c
(fun y => intervalIntegrable_exp.1) tendsto_id
(eventually_of_mem (Iic_mem_atBot 0) fun y _ => ?_)
simp_rw [norm_of_nonneg (exp_pos _).le, integral_exp, sub_le_self_iff]
exact (exp_pos _).le
| 6 | 403.428793 | 2 | 1.5 | 8 | 1,667 |
import Mathlib.MeasureTheory.Integral.Lebesgue
import Mathlib.Topology.MetricSpace.ThickenedIndicator
open MeasureTheory Topology Metric Filter Set ENNReal NNReal
open scoped Topology ENNReal NNReal BoundedContinuousFunction
section auxiliary
namespace MeasureTheory
variable {Ω : Type*} [TopologicalSpace Ω] [MeasurableSpace Ω] [OpensMeasurableSpace Ω]
theorem tendsto_lintegral_nn_filter_of_le_const {ι : Type*} {L : Filter ι} [L.IsCountablyGenerated]
(μ : Measure Ω) [IsFiniteMeasure μ] {fs : ι → Ω →ᵇ ℝ≥0} {c : ℝ≥0}
(fs_le_const : ∀ᶠ i in L, ∀ᵐ ω : Ω ∂μ, fs i ω ≤ c) {f : Ω → ℝ≥0}
(fs_lim : ∀ᵐ ω : Ω ∂μ, Tendsto (fun i ↦ fs i ω) L (𝓝 (f ω))) :
Tendsto (fun i ↦ ∫⁻ ω, fs i ω ∂μ) L (𝓝 (∫⁻ ω, f ω ∂μ)) := by
refine tendsto_lintegral_filter_of_dominated_convergence (fun _ ↦ c)
(eventually_of_forall fun i ↦ (ENNReal.continuous_coe.comp (fs i).continuous).measurable) ?_
(@lintegral_const_lt_top _ _ μ _ _ (@ENNReal.coe_ne_top c)).ne ?_
· simpa only [Function.comp_apply, ENNReal.coe_le_coe] using fs_le_const
· simpa only [Function.comp_apply, ENNReal.tendsto_coe] using fs_lim
#align measure_theory.finite_measure.tendsto_lintegral_nn_filter_of_le_const MeasureTheory.tendsto_lintegral_nn_filter_of_le_const
theorem measure_of_cont_bdd_of_tendsto_filter_indicator {ι : Type*} {L : Filter ι}
[L.IsCountablyGenerated] [TopologicalSpace Ω] [OpensMeasurableSpace Ω] (μ : Measure Ω)
[IsFiniteMeasure μ] {c : ℝ≥0} {E : Set Ω} (E_mble : MeasurableSet E) (fs : ι → Ω →ᵇ ℝ≥0)
(fs_bdd : ∀ᶠ i in L, ∀ᵐ ω : Ω ∂μ, fs i ω ≤ c)
(fs_lim : ∀ᵐ ω ∂μ, Tendsto (fun i ↦ fs i ω) L (𝓝 (indicator E (fun _ ↦ (1 : ℝ≥0)) ω))) :
Tendsto (fun n ↦ lintegral μ fun ω ↦ fs n ω) L (𝓝 (μ E)) := by
convert tendsto_lintegral_nn_filter_of_le_const μ fs_bdd fs_lim
have aux : ∀ ω, indicator E (fun _ ↦ (1 : ℝ≥0∞)) ω = ↑(indicator E (fun _ ↦ (1 : ℝ≥0)) ω) :=
fun ω ↦ by simp only [ENNReal.coe_indicator, ENNReal.coe_one]
simp_rw [← aux, lintegral_indicator _ E_mble]
simp only [lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
#align measure_theory.measure_of_cont_bdd_of_tendsto_filter_indicator MeasureTheory.measure_of_cont_bdd_of_tendsto_filter_indicator
theorem measure_of_cont_bdd_of_tendsto_indicator [OpensMeasurableSpace Ω]
(μ : Measure Ω) [IsFiniteMeasure μ] {c : ℝ≥0} {E : Set Ω} (E_mble : MeasurableSet E)
(fs : ℕ → Ω →ᵇ ℝ≥0) (fs_bdd : ∀ n ω, fs n ω ≤ c)
(fs_lim : Tendsto (fun n ω ↦ fs n ω) atTop (𝓝 (indicator E fun _ ↦ (1 : ℝ≥0)))) :
Tendsto (fun n ↦ lintegral μ fun ω ↦ fs n ω) atTop (𝓝 (μ E)) := by
have fs_lim' :
∀ ω, Tendsto (fun n : ℕ ↦ (fs n ω : ℝ≥0)) atTop (𝓝 (indicator E (fun _ ↦ (1 : ℝ≥0)) ω)) := by
rw [tendsto_pi_nhds] at fs_lim
exact fun ω ↦ fs_lim ω
apply measure_of_cont_bdd_of_tendsto_filter_indicator μ E_mble fs
(eventually_of_forall fun n ↦ eventually_of_forall (fs_bdd n)) (eventually_of_forall fs_lim')
#align measure_theory.measure_of_cont_bdd_of_tendsto_indicator MeasureTheory.measure_of_cont_bdd_of_tendsto_indicator
| Mathlib/MeasureTheory/Measure/HasOuterApproxClosed.lean | 110 | 119 | theorem tendsto_lintegral_thickenedIndicator_of_isClosed {Ω : Type*} [MeasurableSpace Ω]
[PseudoEMetricSpace Ω] [OpensMeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] {F : Set Ω}
(F_closed : IsClosed F) {δs : ℕ → ℝ} (δs_pos : ∀ n, 0 < δs n)
(δs_lim : Tendsto δs atTop (𝓝 0)) :
Tendsto (fun n ↦ lintegral μ fun ω ↦ (thickenedIndicator (δs_pos n) F ω : ℝ≥0∞)) atTop
(𝓝 (μ F)) := by |
apply measure_of_cont_bdd_of_tendsto_indicator μ F_closed.measurableSet
(fun n ↦ thickenedIndicator (δs_pos n) F) fun n ω ↦ thickenedIndicator_le_one (δs_pos n) F ω
have key := thickenedIndicator_tendsto_indicator_closure δs_pos δs_lim F
rwa [F_closed.closure_eq] at key
| 4 | 54.59815 | 2 | 2 | 4 | 2,283 |
import Mathlib.Data.Finset.Pointwise
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.DFinsupp.Order
import Mathlib.Order.Interval.Finset.Basic
#align_import data.dfinsupp.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
open DFinsupp Finset
open Pointwise
variable {ι : Type*} {α : ι → Type*}
namespace Finset
variable [DecidableEq ι] [∀ i, Zero (α i)] {s : Finset ι} {f : Π₀ i, α i} {t : ∀ i, Finset (α i)}
def dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : Finset (Π₀ i, α i) :=
(s.pi t).map
⟨fun f => DFinsupp.mk s fun i => f i i.2, by
refine (mk_injective _).comp fun f g h => ?_
ext i hi
convert congr_fun h ⟨i, hi⟩⟩
#align finset.dfinsupp Finset.dfinsupp
@[simp]
theorem card_dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) :
(s.dfinsupp t).card = ∏ i ∈ s, (t i).card :=
(card_map _).trans <| card_pi _ _
#align finset.card_dfinsupp Finset.card_dfinsupp
variable [∀ i, DecidableEq (α i)]
| Mathlib/Data/DFinsupp/Interval.lean | 48 | 58 | theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by |
refine mem_map.trans ⟨?_, ?_⟩
· rintro ⟨f, hf, rfl⟩
rw [Function.Embedding.coeFn_mk] -- Porting note: added to avoid heartbeat timeout
refine ⟨support_mk_subset, fun i hi => ?_⟩
convert mem_pi.1 hf i hi
exact mk_of_mem hi
· refine fun h => ⟨fun i _ => f i, mem_pi.2 h.2, ?_⟩
ext i
dsimp
exact ite_eq_left_iff.2 fun hi => (not_mem_support_iff.1 fun H => hi <| h.1 H).symm
| 10 | 22,026.465795 | 2 | 2 | 3 | 2,505 |
import Mathlib.Probability.Kernel.MeasurableIntegral
#align_import probability.kernel.composition from "leanprover-community/mathlib"@"3b92d54a05ee592aa2c6181a4e76b1bb7cc45d0b"
open MeasureTheory
open scoped ENNReal
namespace ProbabilityTheory
namespace kernel
variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
section CompositionProduct
variable {γ : Type*} {mγ : MeasurableSpace γ} {s : Set (β × γ)}
noncomputable def compProdFun (κ : kernel α β) (η : kernel (α × β) γ) (a : α) (s : Set (β × γ)) :
ℝ≥0∞ :=
∫⁻ b, η (a, b) {c | (b, c) ∈ s} ∂κ a
#align probability_theory.kernel.comp_prod_fun ProbabilityTheory.kernel.compProdFun
theorem compProdFun_empty (κ : kernel α β) (η : kernel (α × β) γ) (a : α) :
compProdFun κ η a ∅ = 0 := by
simp only [compProdFun, Set.mem_empty_iff_false, Set.setOf_false, measure_empty,
MeasureTheory.lintegral_const, zero_mul]
#align probability_theory.kernel.comp_prod_fun_empty ProbabilityTheory.kernel.compProdFun_empty
theorem compProdFun_iUnion (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α)
(f : ℕ → Set (β × γ)) (hf_meas : ∀ i, MeasurableSet (f i))
(hf_disj : Pairwise (Disjoint on f)) :
compProdFun κ η a (⋃ i, f i) = ∑' i, compProdFun κ η a (f i) := by
have h_Union :
(fun b => η (a, b) {c : γ | (b, c) ∈ ⋃ i, f i}) = fun b =>
η (a, b) (⋃ i, {c : γ | (b, c) ∈ f i}) := by
ext1 b
congr with c
simp only [Set.mem_iUnion, Set.iSup_eq_iUnion, Set.mem_setOf_eq]
rw [compProdFun, h_Union]
have h_tsum :
(fun b => η (a, b) (⋃ i, {c : γ | (b, c) ∈ f i})) = fun b =>
∑' i, η (a, b) {c : γ | (b, c) ∈ f i} := by
ext1 b
rw [measure_iUnion]
· intro i j hij s hsi hsj c hcs
have hbci : {(b, c)} ⊆ f i := by rw [Set.singleton_subset_iff]; exact hsi hcs
have hbcj : {(b, c)} ⊆ f j := by rw [Set.singleton_subset_iff]; exact hsj hcs
simpa only [Set.bot_eq_empty, Set.le_eq_subset, Set.singleton_subset_iff,
Set.mem_empty_iff_false] using hf_disj hij hbci hbcj
· -- Porting note: behavior of `@` changed relative to lean 3, was
-- exact fun i => (@measurable_prod_mk_left β γ _ _ b) _ (hf_meas i)
exact fun i => (@measurable_prod_mk_left β γ _ _ b) (hf_meas i)
rw [h_tsum, lintegral_tsum]
· rfl
· intro i
have hm : MeasurableSet {p : (α × β) × γ | (p.1.2, p.2) ∈ f i} :=
measurable_fst.snd.prod_mk measurable_snd (hf_meas i)
exact ((measurable_kernel_prod_mk_left hm).comp measurable_prod_mk_left).aemeasurable
#align probability_theory.kernel.comp_prod_fun_Union ProbabilityTheory.kernel.compProdFun_iUnion
theorem compProdFun_tsum_right (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α)
(hs : MeasurableSet s) : compProdFun κ η a s = ∑' n, compProdFun κ (seq η n) a s := by
simp_rw [compProdFun, (measure_sum_seq η _).symm]
have :
∫⁻ b, Measure.sum (fun n => seq η n (a, b)) {c : γ | (b, c) ∈ s} ∂κ a =
∫⁻ b, ∑' n, seq η n (a, b) {c : γ | (b, c) ∈ s} ∂κ a := by
congr
ext1 b
rw [Measure.sum_apply]
exact measurable_prod_mk_left hs
rw [this, lintegral_tsum]
exact fun n => ((measurable_kernel_prod_mk_left (κ := (seq η n))
((measurable_fst.snd.prod_mk measurable_snd) hs)).comp measurable_prod_mk_left).aemeasurable
#align probability_theory.kernel.comp_prod_fun_tsum_right ProbabilityTheory.kernel.compProdFun_tsum_right
theorem compProdFun_tsum_left (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] (a : α)
(s : Set (β × γ)) : compProdFun κ η a s = ∑' n, compProdFun (seq κ n) η a s := by
simp_rw [compProdFun, (measure_sum_seq κ _).symm, lintegral_sum_measure]
#align probability_theory.kernel.comp_prod_fun_tsum_left ProbabilityTheory.kernel.compProdFun_tsum_left
theorem compProdFun_eq_tsum (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
[IsSFiniteKernel η] (a : α) (hs : MeasurableSet s) :
compProdFun κ η a s = ∑' (n) (m), compProdFun (seq κ n) (seq η m) a s := by
simp_rw [compProdFun_tsum_left κ η a s, compProdFun_tsum_right _ η a hs]
#align probability_theory.kernel.comp_prod_fun_eq_tsum ProbabilityTheory.kernel.compProdFun_eq_tsum
| Mathlib/Probability/Kernel/Composition.lean | 158 | 169 | theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
[IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by |
simp only [compProdFun]
have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
have :
(Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
η p {c : γ | (p.2, c) ∈ s} := by
ext1 p
rw [Function.uncurry_apply_pair]
rw [this]
exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs)
exact h_meas.lintegral_kernel_prod_right
| 10 | 22,026.465795 | 2 | 1.166667 | 6 | 1,242 |
import Mathlib.CategoryTheory.Idempotents.Basic
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Equivalence
#align_import category_theory.idempotents.karoubi from "leanprover-community/mathlib"@"200eda15d8ff5669854ff6bcc10aaf37cb70498f"
noncomputable section
open CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Limits BigOperators
namespace CategoryTheory
variable (C : Type*) [Category C]
namespace Idempotents
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure Karoubi where
X : C
p : X ⟶ X
idem : p ≫ p = p := by aesop_cat
#align category_theory.idempotents.karoubi CategoryTheory.Idempotents.Karoubi
namespace Karoubi
variable {C}
attribute [reassoc (attr := simp)] idem
@[ext]
| Mathlib/CategoryTheory/Idempotents/Karoubi.lean | 60 | 66 | theorem ext {P Q : Karoubi C} (h_X : P.X = Q.X) (h_p : P.p ≫ eqToHom h_X = eqToHom h_X ≫ Q.p) :
P = Q := by |
cases P
cases Q
dsimp at h_X h_p
subst h_X
simpa only [mk.injEq, heq_eq_eq, true_and, eqToHom_refl, comp_id, id_comp] using h_p
| 5 | 148.413159 | 2 | 0.625 | 8 | 543 |
import Mathlib.RingTheory.WittVector.Basic
import Mathlib.RingTheory.WittVector.IsPoly
#align_import ring_theory.witt_vector.init_tail from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) {R : Type*} [CommRing R]
-- type as `\bbW`
local notation "𝕎" => WittVector p
namespace WittVector
open MvPolynomial
open scoped Classical
noncomputable section
section
def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R :=
mk p fun n => if P n then x.coeff n else 0
#align witt_vector.select WittVector.select
section Select
variable (P : ℕ → Prop)
def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ :=
if P n then X n else 0
#align witt_vector.select_poly WittVector.selectPoly
| Mathlib/RingTheory/WittVector/InitTail.lean | 72 | 77 | theorem coeff_select (x : 𝕎 R) (n : ℕ) :
(select P x).coeff n = aeval x.coeff (selectPoly P n) := by |
dsimp [select, selectPoly]
split_ifs with hi
· rw [aeval_X, mk]; simp only [hi]; rfl
· rw [AlgHom.map_zero, mk]; simp only [hi]; rfl
| 4 | 54.59815 | 2 | 2 | 3 | 2,250 |
import Mathlib.Data.Finsupp.Defs
#align_import data.finsupp.fin from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
noncomputable section
namespace Finsupp
variable {n : ℕ} (i : Fin n) {M : Type*} [Zero M] (y : M) (t : Fin (n + 1) →₀ M) (s : Fin n →₀ M)
def tail (s : Fin (n + 1) →₀ M) : Fin n →₀ M :=
Finsupp.equivFunOnFinite.symm (Fin.tail s)
#align finsupp.tail Finsupp.tail
def cons (y : M) (s : Fin n →₀ M) : Fin (n + 1) →₀ M :=
Finsupp.equivFunOnFinite.symm (Fin.cons y s : Fin (n + 1) → M)
#align finsupp.cons Finsupp.cons
theorem tail_apply : tail t i = t i.succ :=
rfl
#align finsupp.tail_apply Finsupp.tail_apply
@[simp]
theorem cons_zero : cons y s 0 = y :=
rfl
#align finsupp.cons_zero Finsupp.cons_zero
@[simp]
theorem cons_succ : cons y s i.succ = s i :=
-- Porting note: was Fin.cons_succ _ _ _
rfl
#align finsupp.cons_succ Finsupp.cons_succ
@[simp]
theorem tail_cons : tail (cons y s) = s :=
ext fun k => by simp only [tail_apply, cons_succ]
#align finsupp.tail_cons Finsupp.tail_cons
@[simp]
theorem cons_tail : cons (t 0) (tail t) = t := by
ext a
by_cases c_a : a = 0
· rw [c_a, cons_zero]
· rw [← Fin.succ_pred a c_a, cons_succ, ← tail_apply]
#align finsupp.cons_tail Finsupp.cons_tail
@[simp]
| Mathlib/Data/Finsupp/Fin.lean | 68 | 73 | theorem cons_zero_zero : cons 0 (0 : Fin n →₀ M) = 0 := by |
ext a
by_cases c : a = 0
· simp [c]
· rw [← Fin.succ_pred a c, cons_succ]
simp
| 5 | 148.413159 | 2 | 1.4 | 5 | 1,500 |
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.Valuation.ValuationRing
import Mathlib.RingTheory.Nakayama
#align_import ring_theory.discrete_valuation_ring.tfae from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable (R : Type*) [CommRing R] (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
open scoped DiscreteValuation
open LocalRing FiniteDimensional
theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
(h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
∃ n : ℕ, I = maximalIdeal R ^ n := by
by_cases h : IsField R;
· exact ⟨0, by simp [letI := h.toField; (eq_bot_or_eq_top I).resolve_left hI]⟩
classical
obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
by_cases hI' : I = ⊤
· use 0; rw [pow_zero, hI', Ideal.one_eq_top]
have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
(SetLike.ext_iff.mp hx r).trans Ideal.mem_span_singleton
have : x ≠ 0 := by
rintro rfl
apply Ring.ne_bot_of_isMaximal_of_not_isField (maximalIdeal.isMaximal R) h
simp [hx]
have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r := by
intro r hr₁ hr₂
obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
have : ∀ b ∈ f, Associated x b := by
intro b hb
exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
clear hr₁ hr₂ hf₁
induction' f using Multiset.induction with fa fs fh
· exact (hf₂ rfl).elim
rcases eq_or_ne fs ∅ with (rfl | hf')
· use 1
rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
exact this _ (Multiset.mem_cons_self _ _)
· obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
use n + 1
rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
have : ∃ n : ℕ, x ^ n ∈ I := by
obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by
by_contra! h; apply hI; rw [eq_bot_iff]; exact h
obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximalIdeal hI' hr₁)
use n
rwa [← I.unit_mul_mem_iff_mem u.isUnit, mul_comm]
use Nat.find this
apply le_antisymm
· change ∀ s ∈ I, s ∈ _
by_contra! hI''
obtain ⟨s, hs₁, hs₂⟩ := hI''
apply hs₂
by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximalIdeal hI' hs₁)
rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.isUnit] at hs₁ ⊢
apply Ideal.pow_le_pow_right (Nat.find_min' this hs₁)
apply Ideal.pow_mem_pow
exact (H _).mpr (dvd_refl _)
· rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
exact Nat.find_spec this
#align exists_maximal_ideal_pow_eq_of_principal exists_maximalIdeal_pow_eq_of_principal
| Mathlib/RingTheory/DiscreteValuationRing/TFAE.lean | 92 | 150 | theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
[IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by |
classical
by_cases ne_bot : maximalIdeal R = ⊥
· rw [ne_bot]; infer_instance
obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximalIdeal R, a ≠ (0 : R) := by
by_contra! h'; apply ne_bot; rwa [eq_bot_iff]
have hle : Ideal.span {a} ≤ maximalIdeal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
have : (Ideal.span {a}).radical = maximalIdeal R := by
rw [Ideal.radical_eq_sInf]
apply le_antisymm
· exact sInf_le ⟨hle, inferInstance⟩
· refine
le_sInf fun I hI =>
(eq_maximalIdeal <| hI.2.isMaximal (fun e => ha₂ ?_)).ge
rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
have : ∃ n, maximalIdeal R ^ n ≤ Ideal.span {a} := by
rw [← this]; apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
cases' hn : Nat.find this with n
· have := Nat.find_spec this
rw [hn, pow_zero, Ideal.one_eq_top] at this
exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximalIdeal R ^ n, ¬b ∈ Ideal.span {a} := by
by_contra! h'; rw [Nat.find_eq_iff] at hn; exact hn.2 n n.lt_succ_self fun x hx => h' x hx
have hb₃ : ∀ m ∈ maximalIdeal R, ∃ k : R, k * a = b * m := by
intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
rw [hn, pow_succ]; exact Ideal.mul_mem_mul hb₁ hm
have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
let K := FractionRing R
let x : K := algebraMap R K b / algebraMap R K a
let M := Submodule.map (Algebra.linearMap R K) (maximalIdeal R)
have ha₃ : algebraMap R K a ≠ 0 := IsFractionRing.to_map_eq_zero_iff.not.mpr ha₂
by_cases hx : ∀ y ∈ M, x * y ∈ M
· have := isIntegral_of_smul_mem_submodule M ?_ ?_ x hx
· obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
refine (hb₂ (Ideal.mem_span_singleton'.mpr ⟨y, ?_⟩)).elim
apply IsFractionRing.injective R K
rw [map_mul, e, div_mul_cancel₀ _ ha₃]
· rw [Submodule.ne_bot_iff]; refine ⟨_, ⟨a, ha₁, rfl⟩, ?_⟩
exact (IsFractionRing.to_map_eq_zero_iff (K := K)).not.mpr ha₂
· apply Submodule.FG.map; exact IsNoetherian.noetherian _
· have :
(M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.linearMap R K) = ⊤ := by
by_contra h; apply hx
rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
obtain ⟨k, hk⟩ := hb₃ m hm
have hk' : x * algebraMap R K m = algebraMap R K k := by
rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel_right₀ _ ha₃]
exact ⟨k, le_maximalIdeal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximalIdeal R, b * y = a := by
rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this
obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy'
exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
refine ⟨⟨y, ?_⟩⟩
apply le_antisymm
· intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk
rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact Ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
· rwa [Submodule.span_le, Set.singleton_subset_iff]
| 57 | 5,685,719,999,335,932,000,000,000 | 2 | 2 | 2 | 2,187 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Algebra.Ring.Rat
import Mathlib.Data.PNat.Defs
#align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
namespace Rat
open Rat
theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by
cases' e : a /. b with n d h c
rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e
refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <|
c.dvd_of_dvd_mul_right ?_
have := congr_arg Int.natAbs e
simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
#align rat.num_dvd Rat.num_dvd
theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b := by
by_cases b0 : b = 0; · simp [b0]
cases' e : a /. b with n d h c
rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e
refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_
rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp
#align rat.denom_dvd Rat.den_dvd
| Mathlib/Data/Rat/Lemmas.lean | 41 | 56 | theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) :
∃ c : ℤ, n = c * q.num ∧ d = c * q.den := by |
obtain rfl | hn := eq_or_ne n 0
· simp [qdf]
have : q.num * d = n * ↑q.den := by
refine (divInt_eq_iff ?_ hd).mp ?_
· exact Int.natCast_ne_zero.mpr (Rat.den_nz _)
· rwa [num_divInt_den]
have hqdn : q.num ∣ n := by
rw [qdf]
exact Rat.num_dvd _ hd
refine ⟨n / q.num, ?_, ?_⟩
· rw [Int.ediv_mul_cancel hqdn]
· refine Int.eq_mul_div_of_mul_eq_mul_of_dvd_left ?_ hqdn this
rw [qdf]
exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn)
| 14 | 1,202,604.284165 | 2 | 1.333333 | 12 | 1,389 |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic
import Mathlib.NumberTheory.GaussSum
#align_import number_theory.legendre_symbol.quadratic_char.gauss_sum from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
section SpecialValues
open ZMod MulChar
variable {F : Type*} [Field F] [Fintype F]
theorem quadraticChar_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F 2 = χ₈ (Fintype.card F) :=
IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F) isQuadratic_χ₈ hF
((quadraticChar_eq_pow_of_char_ne_two' hF 2).trans (FiniteField.two_pow_card hF))
#align quadratic_char_two quadraticChar_two
theorem FiniteField.isSquare_two_iff :
IsSquare (2 : F) ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5 := by
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (Ring.two_ne_zero hF), quadraticChar_two hF,
χ₈_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
#align finite_field.is_square_two_iff FiniteField.isSquare_two_iff
theorem quadraticChar_neg_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F (-2) = χ₈' (Fintype.card F) := by
rw [(by norm_num : (-2 : F) = -1 * 2), map_mul, χ₈'_eq_χ₄_mul_χ₈, quadraticChar_neg_one hF,
quadraticChar_two hF, @cast_natCast _ (ZMod 4) _ _ _ (by decide : 4 ∣ 8)]
#align quadratic_char_neg_two quadraticChar_neg_two
| Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/GaussSum.lean | 72 | 91 | theorem FiniteField.isSquare_neg_two_iff :
IsSquare (-2 : F) ↔ Fintype.card F % 8 ≠ 5 ∧ Fintype.card F % 8 ≠ 7 := by |
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (neg_ne_zero.mpr (Ring.two_ne_zero hF)),
quadraticChar_neg_two hF, χ₈'_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
| 18 | 65,659,969.137331 | 2 | 1.833333 | 6 | 1,917 |
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.Algebra.Polynomial.Lifts
import Mathlib.GroupTheory.MonoidLocalization
import Mathlib.RingTheory.Algebraic
import Mathlib.RingTheory.Ideal.LocalRing
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Integer
#align_import ring_theory.localization.integral from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86"
variable {R : Type*} [CommRing R] (M : Submonoid R) {S : Type*} [CommRing S]
variable [Algebra R S] {P : Type*} [CommRing P]
open Polynomial
namespace IsLocalization
open IsLocalization
section IsIntegral
variable {Rₘ Sₘ : Type*} [CommRing Rₘ] [CommRing Sₘ]
variable [Algebra R Rₘ] [IsLocalization M Rₘ]
variable [Algebra S Sₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ]
variable {M}
open Polynomial
| Mathlib/RingTheory/Localization/Integral.lean | 185 | 201 | theorem RingHom.isIntegralElem_localization_at_leadingCoeff {R S : Type*} [CommRing R] [CommRing S]
(f : R →+* S) (x : S) (p : R[X]) (hf : p.eval₂ f x = 0) (M : Submonoid R)
(hM : p.leadingCoeff ∈ M) {Rₘ Sₘ : Type*} [CommRing Rₘ] [CommRing Sₘ] [Algebra R Rₘ]
[IsLocalization M Rₘ] [Algebra S Sₘ] [IsLocalization (M.map f : Submonoid S) Sₘ] :
(map Sₘ f M.le_comap_map : Rₘ →+* _).IsIntegralElem (algebraMap S Sₘ x) := by |
by_cases triv : (1 : Rₘ) = 0
· exact ⟨0, ⟨_root_.trans leadingCoeff_zero triv.symm, eval₂_zero _ _⟩⟩
haveI : Nontrivial Rₘ := nontrivial_of_ne 1 0 triv
obtain ⟨b, hb⟩ := isUnit_iff_exists_inv.mp (map_units Rₘ ⟨p.leadingCoeff, hM⟩)
refine ⟨p.map (algebraMap R Rₘ) * C b, ⟨?_, ?_⟩⟩
· refine monic_mul_C_of_leadingCoeff_mul_eq_one ?_
rwa [leadingCoeff_map_of_leadingCoeff_ne_zero (algebraMap R Rₘ)]
refine fun hfp => zero_ne_one
(_root_.trans (zero_mul b).symm (hfp ▸ hb) : (0 : Rₘ) = 1)
· refine eval₂_mul_eq_zero_of_left _ _ _ ?_
erw [eval₂_map, IsLocalization.map_comp, ← hom_eval₂ _ f (algebraMap S Sₘ) x]
exact _root_.trans (congr_arg (algebraMap S Sₘ) hf) (RingHom.map_zero _)
| 12 | 162,754.791419 | 2 | 1.333333 | 6 | 1,454 |
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic
suppress_compilation
open Bornology
open Filter hiding map_smul
open scoped Classical NNReal Topology Uniformity
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*}
section SemiNormed
open Metric ContinuousLinearMap
variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup Eₗ] [SeminormedAddCommGroup F]
[SeminormedAddCommGroup Fₗ] [SeminormedAddCommGroup G] [SeminormedAddCommGroup Gₗ]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜 Eₗ] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜 Fₗ] [NormedSpace 𝕜₃ G]
[NormedSpace 𝕜 Gₗ] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃}
[RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [FunLike 𝓕 E F]
namespace ContinuousLinearMap
section OpNorm
open Set Real
section
variable [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₃] (f g : E →SL[σ₁₂] F) (h : F →SL[σ₂₃] G)
(x : E)
| Mathlib/Analysis/NormedSpace/OperatorNorm/NNNorm.lean | 49 | 53 | theorem nnnorm_def (f : E →SL[σ₁₂] F) : ‖f‖₊ = sInf { c | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ } := by |
ext
rw [NNReal.coe_sInf, coe_nnnorm, norm_def, NNReal.coe_image]
simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_setOf_eq, NNReal.coe_mk,
exists_prop]
| 4 | 54.59815 | 2 | 1 | 2 | 1,028 |
import Mathlib.Analysis.InnerProductSpace.Projection
import Mathlib.Analysis.NormedSpace.lpSpace
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.inner_product_space.l2_space from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
open RCLike Submodule Filter
open scoped NNReal ENNReal Classical ComplexConjugate Topology
noncomputable section
variable {ι 𝕜 : Type*} [RCLike 𝕜] {E : Type*}
variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [cplt : CompleteSpace E]
variable {G : ι → Type*} [∀ i, NormedAddCommGroup (G i)] [∀ i, InnerProductSpace 𝕜 (G i)]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
notation "ℓ²(" ι ", " 𝕜 ")" => lp (fun i : ι => 𝕜) 2
namespace lp
theorem summable_inner (f g : lp G 2) : Summable fun i => ⟪f i, g i⟫ := by
-- Apply the Direct Comparison Test, comparing with ∑' i, ‖f i‖ * ‖g i‖ (summable by Hölder)
refine .of_norm_bounded (fun i => ‖f i‖ * ‖g i‖) (lp.summable_mul ?_ f g) ?_
· rw [Real.isConjExponent_iff]; norm_num
intro i
-- Then apply Cauchy-Schwarz pointwise
exact norm_inner_le_norm (𝕜 := 𝕜) _ _
#align lp.summable_inner lp.summable_inner
instance instInnerProductSpace : InnerProductSpace 𝕜 (lp G 2) :=
{ lp.normedAddCommGroup (E := G) (p := 2) with
inner := fun f g => ∑' i, ⟪f i, g i⟫
norm_sq_eq_inner := fun f => by
calc
‖f‖ ^ 2 = ‖f‖ ^ (2 : ℝ≥0∞).toReal := by norm_cast
_ = ∑' i, ‖f i‖ ^ (2 : ℝ≥0∞).toReal := lp.norm_rpow_eq_tsum ?_ f
_ = ∑' i, ‖f i‖ ^ (2 : ℕ) := by norm_cast
_ = ∑' i, re ⟪f i, f i⟫ := by
congr
funext i
rw [norm_sq_eq_inner (𝕜 := 𝕜)]
-- Porting note: `simp` couldn't do this anymore
_ = re (∑' i, ⟪f i, f i⟫) := (RCLike.reCLM.map_tsum ?_).symm
· norm_num
· exact summable_inner f f
conj_symm := fun f g => by
calc
conj _ = conj (∑' i, ⟪g i, f i⟫) := by congr
_ = ∑' i, conj ⟪g i, f i⟫ := RCLike.conjCLE.map_tsum
_ = ∑' i, ⟪f i, g i⟫ := by simp only [inner_conj_symm]
_ = _ := by congr
add_left := fun f₁ f₂ g => by
calc
_ = ∑' i, ⟪(f₁ + f₂) i, g i⟫ := ?_
_ = ∑' i, (⟪f₁ i, g i⟫ + ⟪f₂ i, g i⟫) := by
simp only [inner_add_left, Pi.add_apply, coeFn_add]
_ = (∑' i, ⟪f₁ i, g i⟫) + ∑' i, ⟪f₂ i, g i⟫ := tsum_add ?_ ?_
_ = _ := by congr
· congr
· exact summable_inner f₁ g
· exact summable_inner f₂ g
smul_left := fun f g c => by
calc
_ = ∑' i, ⟪c • f i, g i⟫ := ?_
_ = ∑' i, conj c * ⟪f i, g i⟫ := by simp only [inner_smul_left]
_ = conj c * ∑' i, ⟪f i, g i⟫ := tsum_mul_left
_ = _ := ?_
· simp only [coeFn_smul, Pi.smul_apply]
· congr }
theorem inner_eq_tsum (f g : lp G 2) : ⟪f, g⟫ = ∑' i, ⟪f i, g i⟫ :=
rfl
#align lp.inner_eq_tsum lp.inner_eq_tsum
theorem hasSum_inner (f g : lp G 2) : HasSum (fun i => ⟪f i, g i⟫) ⟪f, g⟫ :=
(summable_inner f g).hasSum
#align lp.has_sum_inner lp.hasSum_inner
| Mathlib/Analysis/InnerProductSpace/l2Space.lean | 164 | 171 | theorem inner_single_left (i : ι) (a : G i) (f : lp G 2) : ⟪lp.single 2 i a, f⟫ = ⟪a, f i⟫ := by |
refine (hasSum_inner (lp.single 2 i a) f).unique ?_
convert hasSum_ite_eq i ⟪a, f i⟫ using 1
ext j
rw [lp.single_apply]
split_ifs with h
· subst h; rfl
· simp
| 7 | 1,096.633158 | 2 | 1.333333 | 3 | 1,398 |
import Mathlib.CategoryTheory.Limits.Preserves.Finite
import Mathlib.CategoryTheory.Sites.Canonical
import Mathlib.CategoryTheory.Sites.Coherent.Basic
import Mathlib.CategoryTheory.Sites.Preserves
universe v u w
namespace CategoryTheory
open Limits
variable {C : Type u} [Category.{v} C]
variable [FinitaryPreExtensive C]
class Presieve.Extensive {X : C} (R : Presieve X) : Prop where
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Finite α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.Extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.Extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
open Presieve Opposite
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.Extensive]
(F : Cᵒᵖ ⥤ Type w) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨α, _, Z, π, rfl, ⟨hc⟩⟩ := Extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
cases nonempty_fintype α
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Finite α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).Extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
| Mathlib/CategoryTheory/Sites/Coherent/ExtensiveSheaves.lean | 64 | 70 | theorem extensiveTopology.isSheaf_yoneda_obj (W : C) : Presieve.IsSheaf (extensiveTopology C)
(yoneda.obj W) := by |
erw [isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi
have : R.Extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩
exact isSheafFor_extensive_of_preservesFiniteProducts _ _
| 5 | 148.413159 | 2 | 2 | 4 | 2,378 |
import Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions
noncomputable section
open scoped Manifold
open Bundle Set Topology
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
{E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
{E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H'']
(I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
section Charts
variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
[SmoothManifoldWithCorners I'' M''] {e : PartialHomeomorph M H}
theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.source) :
MDifferentiableAt I I e x := by
rw [mdifferentiableAt_iff]
refine ⟨(e.continuousOn x hx).continuousAt (e.open_source.mem_nhds hx), ?_⟩
have mem :
I ((chartAt H x : M → H) x) ∈ I.symm ⁻¹' ((chartAt H x).symm ≫ₕ e).source ∩ range I := by
simp only [hx, mfld_simps]
have : (chartAt H x).symm.trans e ∈ contDiffGroupoid ∞ I :=
HasGroupoid.compatible (chart_mem_atlas H x) h
have A :
ContDiffOn 𝕜 ∞ (I ∘ (chartAt H x).symm.trans e ∘ I.symm)
(I.symm ⁻¹' ((chartAt H x).symm.trans e).source ∩ range I) :=
this.1
have B := A.differentiableOn le_top (I ((chartAt H x : M → H) x)) mem
simp only [mfld_simps] at B
rw [inter_comm, differentiableWithinAt_inter] at B
· simpa only [mfld_simps]
· apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
#align mdifferentiable_at_atlas mdifferentiableAt_atlas
theorem mdifferentiableOn_atlas (h : e ∈ atlas H M) : MDifferentiableOn I I e e.source :=
fun _x hx => (mdifferentiableAt_atlas I h hx).mdifferentiableWithinAt
#align mdifferentiable_on_atlas mdifferentiableOn_atlas
| Mathlib/Geometry/Manifold/MFDeriv/Atlas.lean | 113 | 129 | theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e.target) :
MDifferentiableAt I I e.symm x := by |
rw [mdifferentiableAt_iff]
refine ⟨(e.continuousOn_symm x hx).continuousAt (e.open_target.mem_nhds hx), ?_⟩
have mem : I x ∈ I.symm ⁻¹' (e.symm ≫ₕ chartAt H (e.symm x)).source ∩ range I := by
simp only [hx, mfld_simps]
have : e.symm.trans (chartAt H (e.symm x)) ∈ contDiffGroupoid ∞ I :=
HasGroupoid.compatible h (chart_mem_atlas H _)
have A :
ContDiffOn 𝕜 ∞ (I ∘ e.symm.trans (chartAt H (e.symm x)) ∘ I.symm)
(I.symm ⁻¹' (e.symm.trans (chartAt H (e.symm x))).source ∩ range I) :=
this.1
have B := A.differentiableOn le_top (I x) mem
simp only [mfld_simps] at B
rw [inter_comm, differentiableWithinAt_inter] at B
· simpa only [mfld_simps]
· apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
| 15 | 3,269,017.372472 | 2 | 2 | 6 | 2,362 |
import Mathlib.Topology.ContinuousFunction.Bounded
import Mathlib.Topology.Sets.Compacts
#align_import measure_theory.integral.riesz_markov_kakutani from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f"
noncomputable section
open BoundedContinuousFunction NNReal ENNReal
open Set Function TopologicalSpace
variable {X : Type*} [TopologicalSpace X]
variable (Λ : (X →ᵇ ℝ≥0) →ₗ[ℝ≥0] ℝ≥0)
def rieszContentAux : Compacts X → ℝ≥0 := fun K =>
sInf (Λ '' { f : X →ᵇ ℝ≥0 | ∀ x ∈ K, (1 : ℝ≥0) ≤ f x })
#align riesz_content_aux rieszContentAux
section RieszMonotone
| Mathlib/MeasureTheory/Integral/RieszMarkovKakutani.lean | 51 | 56 | theorem rieszContentAux_image_nonempty (K : Compacts X) :
(Λ '' { f : X →ᵇ ℝ≥0 | ∀ x ∈ K, (1 : ℝ≥0) ≤ f x }).Nonempty := by |
rw [image_nonempty]
use (1 : X →ᵇ ℝ≥0)
intro x _
simp only [BoundedContinuousFunction.coe_one, Pi.one_apply]; rfl
| 4 | 54.59815 | 2 | 2 | 1 | 2,127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.