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
import Mathlib.MeasureTheory.Constructions.Pi import Mathlib.MeasureTheory.Constructions.Prod.Integral open Fintype MeasureTheory MeasureTheory.Measure variable {𝕜 : Type*} [RCLike 𝕜] namespace MeasureTheory theorem Integrable.fin_nat_prod {n : ℕ} {E : Fin n → Type*} [∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))] {f : (i : Fin n) → E i → 𝕜} (hf : ∀ i, Integrable (f i)) : Integrable (fun (x : (i : Fin n) → E i) ↦ ∏ i, f i (x i)) := by induction n with | zero => simp only [Nat.zero_eq, Finset.univ_eq_empty, Finset.prod_empty, volume_pi, integrable_const_iff, one_ne_zero, pi_empty_univ, ENNReal.one_lt_top, or_true] | succ n n_ih => have := ((measurePreserving_piFinSuccAbove (fun i => (volume : Measure (E i))) 0).symm) rw [volume_pi, ← this.integrable_comp_emb (MeasurableEquiv.measurableEmbedding _)] simp_rw [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.prod_univ_succ, Fin.insertNth_zero] simp only [Fin.zero_succAbove, cast_eq, Function.comp_def, Fin.cons_zero, Fin.cons_succ] have : Integrable (fun (x : (j : Fin n) → E (Fin.succ j)) ↦ ∏ j, f (Fin.succ j) (x j)) := n_ih (fun i ↦ hf _) exact Integrable.prod_mul (hf 0) this theorem Integrable.fintype_prod_dep {ι : Type*} [Fintype ι] {E : ι → Type*} {f : (i : ι) → E i → 𝕜} [∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))] (hf : ∀ i, Integrable (f i)) : Integrable (fun (x : (i : ι) → E i) ↦ ∏ i, f i (x i)) := by let e := (equivFin ι).symm simp_rw [← (volume_measurePreserving_piCongrLeft _ e).integrable_comp_emb (MeasurableEquiv.measurableEmbedding _), ← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, Function.comp_def, Equiv.piCongrLeft_apply_apply] exact .fin_nat_prod (fun i ↦ hf _) theorem Integrable.fintype_prod {ι : Type*} [Fintype ι] {E : Type*} {f : ι → E → 𝕜} [MeasureSpace E] [SigmaFinite (volume : Measure E)] (hf : ∀ i, Integrable (f i)) : Integrable (fun (x : ι → E) ↦ ∏ i, f i (x i)) := Integrable.fintype_prod_dep hf theorem integral_fin_nat_prod_eq_prod {n : ℕ} {E : Fin n → Type*} [∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))] (f : (i : Fin n) → E i → 𝕜) : ∫ x : (i : Fin n) → E i, ∏ i, f i (x i) = ∏ i, ∫ x, f i x := by induction n with | zero => simp only [Nat.zero_eq, volume_pi, Finset.univ_eq_empty, Finset.prod_empty, integral_const, pi_empty_univ, ENNReal.one_toReal, smul_eq_mul, mul_one, pow_zero, one_smul] | succ n n_ih => calc _ = ∫ x : E 0 × ((i : Fin n) → E (Fin.succ i)), f 0 x.1 * ∏ i : Fin n, f (Fin.succ i) (x.2 i) := by rw [volume_pi, ← ((measurePreserving_piFinSuccAbove (fun i => (volume : Measure (E i))) 0).symm).integral_comp'] simp_rw [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.prod_univ_succ, Fin.insertNth_zero, Fin.cons_succ, volume_eq_prod, volume_pi, Fin.zero_succAbove, cast_eq, Fin.cons_zero] _ = (∫ x, f 0 x) * ∏ i : Fin n, ∫ (x : E (Fin.succ i)), f (Fin.succ i) x := by rw [← n_ih, ← integral_prod_mul, volume_eq_prod] _ = ∏ i, ∫ x, f i x := by rw [Fin.prod_univ_succ] theorem integral_fintype_prod_eq_prod (ι : Type*) [Fintype ι] {E : ι → Type*} (f : (i : ι) → E i → 𝕜) [∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))] : ∫ x : (i : ι) → E i, ∏ i, f i (x i) = ∏ i, ∫ x, f i x := by let e := (equivFin ι).symm rw [← (volume_measurePreserving_piCongrLeft _ e).integral_comp'] simp_rw [← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft_apply_apply, MeasureTheory.integral_fin_nat_prod_eq_prod]
Mathlib/MeasureTheory/Integral/Pi.lean
95
98
theorem integral_fintype_prod_eq_pow {E : Type*} (ι : Type*) [Fintype ι] (f : E → 𝕜) [MeasureSpace E] [SigmaFinite (volume : Measure E)] : ∫ x : ι → E, ∏ i, f (x i) = (∫ x, f x) ^ (card ι) := by
rw [integral_fintype_prod_eq_prod, Finset.prod_const, card]
1
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.MeasureTheory.Constructions.BorelSpace.ContinuousLinearMap import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import analysis.calculus.fderiv_measurable from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" set_option linter.uppercaseLean3 false -- A B D noncomputable section open Set Metric Asymptotics Filter ContinuousLinearMap MeasureTheory TopologicalSpace open scoped Topology section fderiv variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {f : E → F} (K : Set (E →L[𝕜] F)) namespace FDerivMeasurableAux def A (f : E → F) (L : E →L[𝕜] F) (r ε : ℝ) : Set E := { x | ∃ r' ∈ Ioc (r / 2) r, ∀ y ∈ ball x r', ∀ z ∈ ball x r', ‖f z - f y - L (z - y)‖ < ε * r } #align fderiv_measurable_aux.A FDerivMeasurableAux.A def B (f : E → F) (K : Set (E →L[𝕜] F)) (r s ε : ℝ) : Set E := ⋃ L ∈ K, A f L r ε ∩ A f L s ε #align fderiv_measurable_aux.B FDerivMeasurableAux.B def D (f : E → F) (K : Set (E →L[𝕜] F)) : Set E := ⋂ e : ℕ, ⋃ n : ℕ, ⋂ (p ≥ n) (q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e) #align fderiv_measurable_aux.D FDerivMeasurableAux.D theorem isOpen_A (L : E →L[𝕜] F) (r ε : ℝ) : IsOpen (A f L r ε) := by rw [Metric.isOpen_iff] rintro x ⟨r', r'_mem, hr'⟩ obtain ⟨s, s_gt, s_lt⟩ : ∃ s : ℝ, r / 2 < s ∧ s < r' := exists_between r'_mem.1 have : s ∈ Ioc (r / 2) r := ⟨s_gt, le_of_lt (s_lt.trans_le r'_mem.2)⟩ refine ⟨r' - s, by linarith, fun x' hx' => ⟨s, this, ?_⟩⟩ have B : ball x' s ⊆ ball x r' := ball_subset (le_of_lt hx') intro y hy z hz exact hr' y (B hy) z (B hz) #align fderiv_measurable_aux.is_open_A FDerivMeasurableAux.isOpen_A
Mathlib/Analysis/Calculus/FDeriv/Measurable.lean
144
145
theorem isOpen_B {K : Set (E →L[𝕜] F)} {r s ε : ℝ} : IsOpen (B f K r s ε) := by
simp [B, isOpen_biUnion, IsOpen.inter, isOpen_A]
1
import Mathlib.Data.Bundle import Mathlib.Data.Set.Image import Mathlib.Topology.PartialHomeomorph import Mathlib.Topology.Order.Basic #align_import topology.fiber_bundle.trivialization from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" open TopologicalSpace Filter Set Bundle Function open scoped Topology Classical Bundle variable {ι : Type*} {B : Type*} {F : Type*} {E : B → Type*} variable (F) {Z : Type*} [TopologicalSpace B] [TopologicalSpace F] {proj : Z → B} structure Pretrivialization (proj : Z → B) extends PartialEquiv Z (B × F) where open_target : IsOpen target baseSet : Set B open_baseSet : IsOpen baseSet source_eq : source = proj ⁻¹' baseSet target_eq : target = baseSet ×ˢ univ proj_toFun : ∀ p ∈ source, (toFun p).1 = proj p #align pretrivialization Pretrivialization namespace Pretrivialization variable {F} variable (e : Pretrivialization F proj) {x : Z} @[coe] def toFun' : Z → (B × F) := e.toFun instance : CoeFun (Pretrivialization F proj) fun _ => Z → B × F := ⟨toFun'⟩ @[ext] lemma ext' (e e' : Pretrivialization F proj) (h₁ : e.toPartialEquiv = e'.toPartialEquiv) (h₂ : e.baseSet = e'.baseSet) : e = e' := by cases e; cases e'; congr #align pretrivialization.ext Pretrivialization.ext' -- Porting note (#11215): TODO: move `ext` here? lemma ext {e e' : Pretrivialization F proj} (h₁ : ∀ x, e x = e' x) (h₂ : ∀ x, e.toPartialEquiv.symm x = e'.toPartialEquiv.symm x) (h₃ : e.baseSet = e'.baseSet) : e = e' := by ext1 <;> [ext1; exact h₃] · apply h₁ · apply h₂ · rw [e.source_eq, e'.source_eq, h₃] lemma toPartialEquiv_injective [Nonempty F] : Injective (toPartialEquiv : Pretrivialization F proj → PartialEquiv Z (B × F)) := by refine fun e e' h ↦ ext' _ _ h ?_ simpa only [fst_image_prod, univ_nonempty, target_eq] using congr_arg (Prod.fst '' PartialEquiv.target ·) h @[simp, mfld_simps] theorem coe_coe : ⇑e.toPartialEquiv = e := rfl #align pretrivialization.coe_coe Pretrivialization.coe_coe @[simp, mfld_simps] theorem coe_fst (ex : x ∈ e.source) : (e x).1 = proj x := e.proj_toFun x ex #align pretrivialization.coe_fst Pretrivialization.coe_fst theorem mem_source : x ∈ e.source ↔ proj x ∈ e.baseSet := by rw [e.source_eq, mem_preimage] #align pretrivialization.mem_source Pretrivialization.mem_source theorem coe_fst' (ex : proj x ∈ e.baseSet) : (e x).1 = proj x := e.coe_fst (e.mem_source.2 ex) #align pretrivialization.coe_fst' Pretrivialization.coe_fst' protected theorem eqOn : EqOn (Prod.fst ∘ e) proj e.source := fun _ hx => e.coe_fst hx #align pretrivialization.eq_on Pretrivialization.eqOn theorem mk_proj_snd (ex : x ∈ e.source) : (proj x, (e x).2) = e x := Prod.ext (e.coe_fst ex).symm rfl #align pretrivialization.mk_proj_snd Pretrivialization.mk_proj_snd theorem mk_proj_snd' (ex : proj x ∈ e.baseSet) : (proj x, (e x).2) = e x := Prod.ext (e.coe_fst' ex).symm rfl #align pretrivialization.mk_proj_snd' Pretrivialization.mk_proj_snd' def setSymm : e.target → Z := e.target.restrict e.toPartialEquiv.symm #align pretrivialization.set_symm Pretrivialization.setSymm
Mathlib/Topology/FiberBundle/Trivialization.lean
141
142
theorem mem_target {x : B × F} : x ∈ e.target ↔ x.1 ∈ e.baseSet := by
rw [e.target_eq, prod_univ, mem_preimage]
1
import Mathlib.Algebra.Polynomial.Splits #align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222" noncomputable section @[ext] structure Cubic (R : Type*) where (a b c d : R) #align cubic Cubic namespace Cubic open Cubic Polynomial open Polynomial variable {R S F K : Type*} instance [Inhabited R] : Inhabited (Cubic R) := ⟨⟨default, default, default, default⟩⟩ instance [Zero R] : Zero (Cubic R) := ⟨⟨0, 0, 0, 0⟩⟩ section Basic variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R] def toPoly (P : Cubic R) : R[X] := C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d #align cubic.to_poly Cubic.toPoly theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} : C w * (X - C x) * (X - C y) * (X - C z) = toPoly ⟨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)⟩ := by simp only [toPoly, C_neg, C_add, C_mul] ring1 set_option linter.uppercaseLean3 false in #align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq theorem prod_X_sub_C_eq [CommRing S] {x y z : S} : (X - C x) * (X - C y) * (X - C z) = toPoly ⟨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)⟩ := by rw [← one_mul <| X - C x, ← C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul] set_option linter.uppercaseLean3 false in #align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq section Map variable [Semiring S] {φ : R →+* S} def map (φ : R →+* S) (P : Cubic R) : Cubic S := ⟨φ P.a, φ P.b, φ P.c, φ P.d⟩ #align cubic.map Cubic.map
Mathlib/Algebra/CubicDiscriminant.lean
458
459
theorem map_toPoly : (map φ P).toPoly = Polynomial.map φ P.toPoly := by
simp only [map, toPoly, map_C, map_X, Polynomial.map_add, Polynomial.map_mul, Polynomial.map_pow]
1
import Mathlib.Algebra.Algebra.Spectrum import Mathlib.LinearAlgebra.GeneralLinearGroup import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.RingTheory.Nilpotent.Basic #align_import linear_algebra.eigenspace.basic from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" universe u v w namespace Module namespace End open FiniteDimensional Set variable {K R : Type v} {V M : Type w} [CommRing R] [AddCommGroup M] [Module R M] [Field K] [AddCommGroup V] [Module K V] def eigenspace (f : End R M) (μ : R) : Submodule R M := LinearMap.ker (f - algebraMap R (End R M) μ) #align module.End.eigenspace Module.End.eigenspace @[simp]
Mathlib/LinearAlgebra/Eigenspace/Basic.lean
69
69
theorem eigenspace_zero (f : End R M) : f.eigenspace 0 = LinearMap.ker f := by
simp [eigenspace]
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Finset.Sort import Mathlib.Data.Set.Subsingleton #align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open List variable {n : ℕ} @[ext] structure Composition (n : ℕ) where blocks : List ℕ blocks_pos : ∀ {i}, i ∈ blocks → 0 < i blocks_sum : blocks.sum = n #align composition Composition @[ext] structure CompositionAsSet (n : ℕ) where boundaries : Finset (Fin n.succ) zero_mem : (0 : Fin n.succ) ∈ boundaries getLast_mem : Fin.last n ∈ boundaries #align composition_as_set CompositionAsSet instance {n : ℕ} : Inhabited (CompositionAsSet n) := ⟨⟨Finset.univ, Finset.mem_univ _, Finset.mem_univ _⟩⟩ namespace Composition variable (c : Composition n) instance (n : ℕ) : ToString (Composition n) := ⟨fun c => toString c.blocks⟩ abbrev length : ℕ := c.blocks.length #align composition.length Composition.length theorem blocks_length : c.blocks.length = c.length := rfl #align composition.blocks_length Composition.blocks_length def blocksFun : Fin c.length → ℕ := c.blocks.get #align composition.blocks_fun Composition.blocksFun theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks := ofFn_get _ #align composition.of_fn_blocks_fun Composition.ofFn_blocksFun theorem sum_blocksFun : ∑ i, c.blocksFun i = n := by conv_rhs => rw [← c.blocks_sum, ← ofFn_blocksFun, sum_ofFn] #align composition.sum_blocks_fun Composition.sum_blocksFun theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i ∈ c.blocks := get_mem _ _ _ #align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks @[simp] theorem one_le_blocks {i : ℕ} (h : i ∈ c.blocks) : 1 ≤ i := c.blocks_pos h #align composition.one_le_blocks Composition.one_le_blocks @[simp] theorem one_le_blocks' {i : ℕ} (h : i < c.length) : 1 ≤ c.blocks.get ⟨i, h⟩ := c.one_le_blocks (get_mem (blocks c) i h) #align composition.one_le_blocks' Composition.one_le_blocks' @[simp] theorem blocks_pos' (i : ℕ) (h : i < c.length) : 0 < c.blocks.get ⟨i, h⟩ := c.one_le_blocks' h #align composition.blocks_pos' Composition.blocks_pos' theorem one_le_blocksFun (i : Fin c.length) : 1 ≤ c.blocksFun i := c.one_le_blocks (c.blocksFun_mem_blocks i) #align composition.one_le_blocks_fun Composition.one_le_blocksFun theorem length_le : c.length ≤ n := by conv_rhs => rw [← c.blocks_sum] exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi #align composition.length_le Composition.length_le theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by apply length_pos_of_sum_pos convert h exact c.blocks_sum #align composition.length_pos_of_pos Composition.length_pos_of_pos def sizeUpTo (i : ℕ) : ℕ := (c.blocks.take i).sum #align composition.size_up_to Composition.sizeUpTo @[simp] theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo] #align composition.size_up_to_zero Composition.sizeUpTo_zero theorem sizeUpTo_ofLength_le (i : ℕ) (h : c.length ≤ i) : c.sizeUpTo i = n := by dsimp [sizeUpTo] convert c.blocks_sum exact take_all_of_le h #align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le @[simp] theorem sizeUpTo_length : c.sizeUpTo c.length = n := c.sizeUpTo_ofLength_le c.length le_rfl #align composition.size_up_to_length Composition.sizeUpTo_length theorem sizeUpTo_le (i : ℕ) : c.sizeUpTo i ≤ n := by conv_rhs => rw [← c.blocks_sum, ← sum_take_add_sum_drop _ i] exact Nat.le_add_right _ _ #align composition.size_up_to_le Composition.sizeUpTo_le theorem sizeUpTo_succ {i : ℕ} (h : i < c.length) : c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get ⟨i, h⟩ := by simp only [sizeUpTo] rw [sum_take_succ _ _ h] #align composition.size_up_to_succ Composition.sizeUpTo_succ theorem sizeUpTo_succ' (i : Fin c.length) : c.sizeUpTo ((i : ℕ) + 1) = c.sizeUpTo i + c.blocksFun i := c.sizeUpTo_succ i.2 #align composition.size_up_to_succ' Composition.sizeUpTo_succ' theorem sizeUpTo_strict_mono {i : ℕ} (h : i < c.length) : c.sizeUpTo i < c.sizeUpTo (i + 1) := by rw [c.sizeUpTo_succ h] simp #align composition.size_up_to_strict_mono Composition.sizeUpTo_strict_mono theorem monotone_sizeUpTo : Monotone c.sizeUpTo := monotone_sum_take _ #align composition.monotone_size_up_to Composition.monotone_sizeUpTo def boundary : Fin (c.length + 1) ↪o Fin (n + 1) := (OrderEmbedding.ofStrictMono fun i => ⟨c.sizeUpTo i, Nat.lt_succ_of_le (c.sizeUpTo_le i)⟩) <| Fin.strictMono_iff_lt_succ.2 fun ⟨_, hi⟩ => c.sizeUpTo_strict_mono hi #align composition.boundary Composition.boundary @[simp]
Mathlib/Combinatorics/Enumerative/Composition.lean
252
252
theorem boundary_zero : c.boundary 0 = 0 := by
simp [boundary, Fin.ext_iff]
1
import Mathlib.Algebra.Polynomial.Degree.Definitions #align_import ring_theory.polynomial.opposites from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial open Polynomial MulOpposite variable {R : Type*} [Semiring R] noncomputable section namespace Polynomial def opRingEquiv (R : Type*) [Semiring R] : R[X]ᵐᵒᵖ ≃+* Rᵐᵒᵖ[X] := ((toFinsuppIso R).op.trans AddMonoidAlgebra.opRingEquiv).trans (toFinsuppIso _).symm #align polynomial.op_ring_equiv Polynomial.opRingEquiv @[simp] theorem opRingEquiv_op_monomial (n : ℕ) (r : R) : opRingEquiv R (op (monomial n r : R[X])) = monomial n (op r) := by simp only [opRingEquiv, RingEquiv.coe_trans, Function.comp_apply, AddMonoidAlgebra.opRingEquiv_apply, RingEquiv.op_apply_apply, toFinsuppIso_apply, unop_op, toFinsupp_monomial, Finsupp.mapRange_single, toFinsuppIso_symm_apply, ofFinsupp_single] #align polynomial.op_ring_equiv_op_monomial Polynomial.opRingEquiv_op_monomial @[simp] theorem opRingEquiv_op_C (a : R) : opRingEquiv R (op (C a)) = C (op a) := opRingEquiv_op_monomial 0 a set_option linter.uppercaseLean3 false in #align polynomial.op_ring_equiv_op_C Polynomial.opRingEquiv_op_C @[simp] theorem opRingEquiv_op_X : opRingEquiv R (op (X : R[X])) = X := opRingEquiv_op_monomial 1 1 set_option linter.uppercaseLean3 false in #align polynomial.op_ring_equiv_op_X Polynomial.opRingEquiv_op_X
Mathlib/RingTheory/Polynomial/Opposites.lean
57
59
theorem opRingEquiv_op_C_mul_X_pow (r : R) (n : ℕ) : opRingEquiv R (op (C r * X ^ n : R[X])) = C (op r) * X ^ n := by
simp only [X_pow_mul, op_mul, op_pow, map_mul, map_pow, opRingEquiv_op_X, opRingEquiv_op_C]
1
import Mathlib.Algebra.Order.Invertible import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.LinearAlgebra.AffineSpace.Midpoint import Mathlib.LinearAlgebra.Ray import Mathlib.Tactic.GCongr #align_import analysis.convex.segment from "leanprover-community/mathlib"@"c5773405394e073885e2a144c9ca14637e8eb963" variable {𝕜 E F G ι : Type*} {π : ι → Type*} open Function Set open Pointwise Convex section OrderedSemiring variable [OrderedSemiring 𝕜] [AddCommMonoid E] section SMul variable (𝕜) [SMul 𝕜 E] {s : Set E} {x y : E} def segment (x y : E) : Set E := { z : E | ∃ a b : 𝕜, 0 ≤ a ∧ 0 ≤ b ∧ a + b = 1 ∧ a • x + b • y = z } #align segment segment def openSegment (x y : E) : Set E := { z : E | ∃ a b : 𝕜, 0 < a ∧ 0 < b ∧ a + b = 1 ∧ a • x + b • y = z } #align open_segment openSegment @[inherit_doc] scoped[Convex] notation (priority := high) "[" x "-[" 𝕜 "]" y "]" => segment 𝕜 x y theorem segment_eq_image₂ (x y : E) : [x -[𝕜] y] = (fun p : 𝕜 × 𝕜 => p.1 • x + p.2 • y) '' { p | 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.1 + p.2 = 1 } := by simp only [segment, image, Prod.exists, mem_setOf_eq, exists_prop, and_assoc] #align segment_eq_image₂ segment_eq_image₂
Mathlib/Analysis/Convex/Segment.lean
68
71
theorem openSegment_eq_image₂ (x y : E) : openSegment 𝕜 x y = (fun p : 𝕜 × 𝕜 => p.1 • x + p.2 • y) '' { p | 0 < p.1 ∧ 0 < p.2 ∧ p.1 + p.2 = 1 } := by
simp only [openSegment, image, Prod.exists, mem_setOf_eq, exists_prop, and_assoc]
1
import Mathlib.Analysis.NormedSpace.BoundedLinearMaps import Mathlib.Topology.FiberBundle.Basic #align_import topology.vector_bundle.basic from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" noncomputable section open scoped Classical open Bundle Set open scoped Topology variable (R : Type*) {B : Type*} (F : Type*) (E : B → Type*) section TopologicalVectorSpace variable {F E} variable [Semiring R] [TopologicalSpace F] [TopologicalSpace B] protected class Pretrivialization.IsLinear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)] (e : Pretrivialization F (π F E)) : Prop where linear : ∀ b ∈ e.baseSet, IsLinearMap R fun x : E b => (e ⟨b, x⟩).2 #align pretrivialization.is_linear Pretrivialization.IsLinear namespace Pretrivialization variable (e : Pretrivialization F (π F E)) {x : TotalSpace F E} {b : B} {y : E b} theorem linear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)] [e.IsLinear R] {b : B} (hb : b ∈ e.baseSet) : IsLinearMap R fun x : E b => (e ⟨b, x⟩).2 := Pretrivialization.IsLinear.linear b hb #align pretrivialization.linear Pretrivialization.linear variable [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)] @[simps!] protected def symmₗ (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) : F →ₗ[R] E b := by refine IsLinearMap.mk' (e.symm b) ?_ by_cases hb : b ∈ e.baseSet · exact (((e.linear R hb).mk' _).inverse (e.symm b) (e.symm_apply_apply_mk hb) fun v ↦ congr_arg Prod.snd <| e.apply_mk_symm hb v).isLinear · rw [e.coe_symm_of_not_mem hb] exact (0 : F →ₗ[R] E b).isLinear #align pretrivialization.symmₗ Pretrivialization.symmₗ @[simps (config := .asFn)] def linearEquivAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) (hb : b ∈ e.baseSet) : E b ≃ₗ[R] F where toFun y := (e ⟨b, y⟩).2 invFun := e.symm b left_inv := e.symm_apply_apply_mk hb right_inv v := by simp_rw [e.apply_mk_symm hb v] map_add' v w := (e.linear R hb).map_add v w map_smul' c v := (e.linear R hb).map_smul c v #align pretrivialization.linear_equiv_at Pretrivialization.linearEquivAt protected def linearMapAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) : E b →ₗ[R] F := if hb : b ∈ e.baseSet then e.linearEquivAt R b hb else 0 #align pretrivialization.linear_map_at Pretrivialization.linearMapAt variable {R} theorem coe_linearMapAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) : ⇑(e.linearMapAt R b) = fun y => if b ∈ e.baseSet then (e ⟨b, y⟩).2 else 0 := by rw [Pretrivialization.linearMapAt] split_ifs <;> rfl #align pretrivialization.coe_linear_map_at Pretrivialization.coe_linearMapAt
Mathlib/Topology/VectorBundle/Basic.lean
126
128
theorem coe_linearMapAt_of_mem (e : Pretrivialization F (π F E)) [e.IsLinear R] {b : B} (hb : b ∈ e.baseSet) : ⇑(e.linearMapAt R b) = fun y => (e ⟨b, y⟩).2 := by
simp_rw [coe_linearMapAt, if_pos hb]
1
import Mathlib.Algebra.DirectSum.Module import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Convex.Uniform import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.BoundedLinearMaps #align_import analysis.inner_product_space.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" noncomputable section open RCLike Real Filter open Topology ComplexConjugate open LinearMap (BilinForm) variable {𝕜 E F : Type*} [RCLike 𝕜] class Inner (𝕜 E : Type*) where inner : E → E → 𝕜 #align has_inner Inner export Inner (inner) notation3:max "⟪" x ", " y "⟫_" 𝕜:max => @inner 𝕜 _ _ x y class InnerProductSpace (𝕜 : Type*) (E : Type*) [RCLike 𝕜] [NormedAddCommGroup E] extends NormedSpace 𝕜 E, Inner 𝕜 E where norm_sq_eq_inner : ∀ x : E, ‖x‖ ^ 2 = re (inner x x) conj_symm : ∀ x y, conj (inner y x) = inner x y add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y #align inner_product_space InnerProductSpace -- @[nolint HasNonemptyInstance] porting note: I don't think we have this linter anymore structure InnerProductSpace.Core (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F] [Module 𝕜 F] extends Inner 𝕜 F where conj_symm : ∀ x y, conj (inner y x) = inner x y nonneg_re : ∀ x, 0 ≤ re (inner x x) definite : ∀ x, inner x x = 0 → x = 0 add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y #align inner_product_space.core InnerProductSpace.Core attribute [class] InnerProductSpace.Core def InnerProductSpace.toCore [NormedAddCommGroup E] [c : InnerProductSpace 𝕜 E] : InnerProductSpace.Core 𝕜 E := { c with nonneg_re := fun x => by rw [← InnerProductSpace.norm_sq_eq_inner] apply sq_nonneg definite := fun x hx => norm_eq_zero.1 <| pow_eq_zero (n := 2) <| by rw [InnerProductSpace.norm_sq_eq_inner (𝕜 := 𝕜) x, hx, map_zero] } #align inner_product_space.to_core InnerProductSpace.toCore namespace InnerProductSpace.Core variable [AddCommGroup F] [Module 𝕜 F] [c : InnerProductSpace.Core 𝕜 F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 F _ x y local notation "normSqK" => @RCLike.normSq 𝕜 _ local notation "reK" => @RCLike.re 𝕜 _ local notation "ext_iff" => @RCLike.ext_iff 𝕜 _ local postfix:90 "†" => starRingEnd _ def toInner' : Inner 𝕜 F := c.toInner #align inner_product_space.core.to_has_inner' InnerProductSpace.Core.toInner' attribute [local instance] toInner' def normSq (x : F) := reK ⟪x, x⟫ #align inner_product_space.core.norm_sq InnerProductSpace.Core.normSq local notation "normSqF" => @normSq 𝕜 F _ _ _ _ theorem inner_conj_symm (x y : F) : ⟪y, x⟫† = ⟪x, y⟫ := c.conj_symm x y #align inner_product_space.core.inner_conj_symm InnerProductSpace.Core.inner_conj_symm theorem inner_self_nonneg {x : F} : 0 ≤ re ⟪x, x⟫ := c.nonneg_re _ #align inner_product_space.core.inner_self_nonneg InnerProductSpace.Core.inner_self_nonneg theorem inner_self_im (x : F) : im ⟪x, x⟫ = 0 := by rw [← @ofReal_inj 𝕜, im_eq_conj_sub] simp [inner_conj_symm] #align inner_product_space.core.inner_self_im InnerProductSpace.Core.inner_self_im theorem inner_add_left (x y z : F) : ⟪x + y, z⟫ = ⟪x, z⟫ + ⟪y, z⟫ := c.add_left _ _ _ #align inner_product_space.core.inner_add_left InnerProductSpace.Core.inner_add_left
Mathlib/Analysis/InnerProductSpace/Basic.lean
220
221
theorem inner_add_right (x y z : F) : ⟪x, y + z⟫ = ⟪x, y⟫ + ⟪x, z⟫ := by
rw [← inner_conj_symm, inner_add_left, RingHom.map_add]; simp only [inner_conj_symm]
1
import Mathlib.Algebra.Field.Defs import Mathlib.Algebra.GroupWithZero.Units.Lemmas import Mathlib.Algebra.Ring.Commute import Mathlib.Algebra.Ring.Invertible import Mathlib.Order.Synonym #align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102" open Function OrderDual Set universe u variable {α β K : Type*} section DivisionMonoid variable [DivisionMonoid K] [HasDistribNeg K] {a b : K} theorem one_div_neg_one_eq_neg_one : (1 : K) / -1 = -1 := have : -1 * -1 = (1 : K) := by rw [neg_mul_neg, one_mul] Eq.symm (eq_one_div_of_mul_eq_one_right this) #align one_div_neg_one_eq_neg_one one_div_neg_one_eq_neg_one theorem one_div_neg_eq_neg_one_div (a : K) : 1 / -a = -(1 / a) := calc 1 / -a = 1 / (-1 * a) := by rw [neg_eq_neg_one_mul] _ = 1 / a * (1 / -1) := by rw [one_div_mul_one_div_rev] _ = 1 / a * -1 := by rw [one_div_neg_one_eq_neg_one] _ = -(1 / a) := by rw [mul_neg, mul_one] #align one_div_neg_eq_neg_one_div one_div_neg_eq_neg_one_div theorem div_neg_eq_neg_div (a b : K) : b / -a = -(b / a) := calc b / -a = b * (1 / -a) := by rw [← inv_eq_one_div, division_def] _ = b * -(1 / a) := by rw [one_div_neg_eq_neg_one_div] _ = -(b * (1 / a)) := by rw [neg_mul_eq_mul_neg] _ = -(b / a) := by rw [mul_one_div] #align div_neg_eq_neg_div div_neg_eq_neg_div theorem neg_div (a b : K) : -b / a = -(b / a) := by rw [neg_eq_neg_one_mul, mul_div_assoc, ← neg_eq_neg_one_mul] #align neg_div neg_div @[field_simps] theorem neg_div' (a b : K) : -(b / a) = -b / a := by simp [neg_div] #align neg_div' neg_div' @[simp] theorem neg_div_neg_eq (a b : K) : -a / -b = a / b := by rw [div_neg_eq_neg_div, neg_div, neg_neg] #align neg_div_neg_eq neg_div_neg_eq
Mathlib/Algebra/Field/Basic.lean
129
129
theorem neg_inv : -a⁻¹ = (-a)⁻¹ := by
rw [inv_eq_one_div, inv_eq_one_div, div_neg_eq_neg_div]
1
import Mathlib.Algebra.BigOperators.Finprod import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Topology.Compactness.Paracompact import Mathlib.Topology.ShrinkingLemma import Mathlib.Topology.UrysohnsLemma #align_import topology.partition_of_unity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" universe u v open Function Set Filter open scoped Classical open Topology noncomputable section structure PartitionOfUnity (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun sum_eq_one' : ∀ x ∈ s, ∑ᶠ i, toFun i x = 1 sum_le_one' : ∀ x, ∑ᶠ i, toFun i x ≤ 1 #align partition_of_unity PartitionOfUnity structure BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun le_one' : toFun ≤ 1 eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1 #align bump_covering BumpCovering variable {ι : Type u} {X : Type v} [TopologicalSpace X] namespace PartitionOfUnity variable {E : Type*} [AddCommMonoid E] [SMulWithZero ℝ E] [TopologicalSpace E] [ContinuousSMul ℝ E] {s : Set X} (f : PartitionOfUnity ι X s) instance : FunLike (PartitionOfUnity ι X s) ι C(X, ℝ) where coe := toFun coe_injective' := fun f g h ↦ by cases f; cases g; congr protected theorem locallyFinite : LocallyFinite fun i => support (f i) := f.locallyFinite' #align partition_of_unity.locally_finite PartitionOfUnity.locallyFinite theorem locallyFinite_tsupport : LocallyFinite fun i => tsupport (f i) := f.locallyFinite.closure #align partition_of_unity.locally_finite_tsupport PartitionOfUnity.locallyFinite_tsupport theorem nonneg (i : ι) (x : X) : 0 ≤ f i x := f.nonneg' i x #align partition_of_unity.nonneg PartitionOfUnity.nonneg theorem sum_eq_one {x : X} (hx : x ∈ s) : ∑ᶠ i, f i x = 1 := f.sum_eq_one' x hx #align partition_of_unity.sum_eq_one PartitionOfUnity.sum_eq_one theorem exists_pos {x : X} (hx : x ∈ s) : ∃ i, 0 < f i x := by have H := f.sum_eq_one hx contrapose! H simpa only [fun i => (H i).antisymm (f.nonneg i x), finsum_zero] using zero_ne_one #align partition_of_unity.exists_pos PartitionOfUnity.exists_pos theorem sum_le_one (x : X) : ∑ᶠ i, f i x ≤ 1 := f.sum_le_one' x #align partition_of_unity.sum_le_one PartitionOfUnity.sum_le_one theorem sum_nonneg (x : X) : 0 ≤ ∑ᶠ i, f i x := finsum_nonneg fun i => f.nonneg i x #align partition_of_unity.sum_nonneg PartitionOfUnity.sum_nonneg theorem le_one (i : ι) (x : X) : f i x ≤ 1 := (single_le_finsum i (f.locallyFinite.point_finite x) fun j => f.nonneg j x).trans (f.sum_le_one x) #align partition_of_unity.le_one PartitionOfUnity.le_one section finsupport variable {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X) def finsupport : Finset ι := (ρ.locallyFinite.point_finite x₀).toFinset @[simp]
Mathlib/Topology/PartitionOfUnity.lean
188
190
theorem mem_finsupport (x₀ : X) {i} : i ∈ ρ.finsupport x₀ ↔ i ∈ support fun i ↦ ρ i x₀ := by
simp only [finsupport, mem_support, Finite.mem_toFinset, mem_setOf_eq]
1
import Mathlib.CategoryTheory.Monoidal.Mon_ #align_import category_theory.monoidal.Mod_ from "leanprover-community/mathlib"@"33085c9739c41428651ac461a323fde9a2688d9b" universe v₁ v₂ u₁ u₂ open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] variable {C} structure Mod_ (A : Mon_ C) where X : C act : A.X ⊗ X ⟶ X one_act : (A.one ▷ X) ≫ act = (λ_ X).hom := by aesop_cat assoc : (A.mul ▷ X) ≫ act = (α_ A.X A.X X).hom ≫ (A.X ◁ act) ≫ act := by aesop_cat set_option linter.uppercaseLean3 false in #align Mod_ Mod_ attribute [reassoc (attr := simp)] Mod_.one_act Mod_.assoc namespace Mod_ variable {A : Mon_ C} (M : Mod_ A) theorem assoc_flip : (A.X ◁ M.act) ≫ M.act = (α_ A.X A.X M.X).inv ≫ (A.mul ▷ M.X) ≫ M.act := by simp set_option linter.uppercaseLean3 false in #align Mod_.assoc_flip Mod_.assoc_flip @[ext] structure Hom (M N : Mod_ A) where hom : M.X ⟶ N.X act_hom : M.act ≫ hom = (A.X ◁ hom) ≫ N.act := by aesop_cat set_option linter.uppercaseLean3 false in #align Mod_.hom Mod_.Hom attribute [reassoc (attr := simp)] Hom.act_hom @[simps] def id (M : Mod_ A) : Hom M M where hom := 𝟙 M.X set_option linter.uppercaseLean3 false in #align Mod_.id Mod_.id instance homInhabited (M : Mod_ A) : Inhabited (Hom M M) := ⟨id M⟩ set_option linter.uppercaseLean3 false in #align Mod_.hom_inhabited Mod_.homInhabited @[simps] def comp {M N O : Mod_ A} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom set_option linter.uppercaseLean3 false in #align Mod_.comp Mod_.comp instance : Category (Mod_ A) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added because `Hom.ext` is not triggered automatically -- See https://github.com/leanprover-community/mathlib4/issues/5229 @[ext] lemma hom_ext {M N : Mod_ A} (f₁ f₂ : M ⟶ N) (h : f₁.hom = f₂.hom) : f₁ = f₂ := Hom.ext _ _ h @[simp]
Mathlib/CategoryTheory/Monoidal/Mod_.lean
81
82
theorem id_hom' (M : Mod_ A) : (𝟙 M : M ⟶ M).hom = 𝟙 M.X := by
rfl
1
import Mathlib.Order.Filter.Bases import Mathlib.Order.ConditionallyCompleteLattice.Basic #align_import order.filter.lift from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" open Set Classical Filter Function namespace Filter variable {α β γ : Type*} {ι : Sort*} section lift protected def lift (f : Filter α) (g : Set α → Filter β) := ⨅ s ∈ f, g s #align filter.lift Filter.lift variable {f f₁ f₂ : Filter α} {g g₁ g₂ : Set α → Filter β} @[simp] theorem lift_top (g : Set α → Filter β) : (⊤ : Filter α).lift g = g univ := by simp [Filter.lift] #align filter.lift_top Filter.lift_top -- Porting note: use `∃ i, p i ∧ _` instead of `∃ i (hi : p i), _` theorem HasBasis.mem_lift_iff {ι} {p : ι → Prop} {s : ι → Set α} {f : Filter α} (hf : f.HasBasis p s) {β : ι → Type*} {pg : ∀ i, β i → Prop} {sg : ∀ i, β i → Set γ} {g : Set α → Filter γ} (hg : ∀ i, (g <| s i).HasBasis (pg i) (sg i)) (gm : Monotone g) {s : Set γ} : s ∈ f.lift g ↔ ∃ i, p i ∧ ∃ x, pg i x ∧ sg i x ⊆ s := by refine (mem_biInf_of_directed ?_ ⟨univ, univ_sets _⟩).trans ?_ · intro t₁ ht₁ t₂ ht₂ exact ⟨t₁ ∩ t₂, inter_mem ht₁ ht₂, gm inter_subset_left, gm inter_subset_right⟩ · simp only [← (hg _).mem_iff] exact hf.exists_iff fun t₁ t₂ ht H => gm ht H #align filter.has_basis.mem_lift_iff Filter.HasBasis.mem_lift_iffₓ theorem HasBasis.lift {ι} {p : ι → Prop} {s : ι → Set α} {f : Filter α} (hf : f.HasBasis p s) {β : ι → Type*} {pg : ∀ i, β i → Prop} {sg : ∀ i, β i → Set γ} {g : Set α → Filter γ} (hg : ∀ i, (g (s i)).HasBasis (pg i) (sg i)) (gm : Monotone g) : (f.lift g).HasBasis (fun i : Σi, β i => p i.1 ∧ pg i.1 i.2) fun i : Σi, β i => sg i.1 i.2 := by refine ⟨fun t => (hf.mem_lift_iff hg gm).trans ?_⟩ simp [Sigma.exists, and_assoc, exists_and_left] #align filter.has_basis.lift Filter.HasBasis.lift theorem mem_lift_sets (hg : Monotone g) {s : Set β} : s ∈ f.lift g ↔ ∃ t ∈ f, s ∈ g t := (f.basis_sets.mem_lift_iff (fun s => (g s).basis_sets) hg).trans <| by simp only [id, exists_mem_subset_iff] #align filter.mem_lift_sets Filter.mem_lift_sets theorem sInter_lift_sets (hg : Monotone g) : ⋂₀ { s | s ∈ f.lift g } = ⋂ s ∈ f, ⋂₀ { t | t ∈ g s } := by simp only [sInter_eq_biInter, mem_setOf_eq, Filter.mem_sets, mem_lift_sets hg, iInter_exists, iInter_and, @iInter_comm _ (Set β)] #align filter.sInter_lift_sets Filter.sInter_lift_sets theorem mem_lift {s : Set β} {t : Set α} (ht : t ∈ f) (hs : s ∈ g t) : s ∈ f.lift g := le_principal_iff.mp <| show f.lift g ≤ 𝓟 s from iInf_le_of_le t <| iInf_le_of_le ht <| le_principal_iff.mpr hs #align filter.mem_lift Filter.mem_lift theorem lift_le {f : Filter α} {g : Set α → Filter β} {h : Filter β} {s : Set α} (hs : s ∈ f) (hg : g s ≤ h) : f.lift g ≤ h := iInf₂_le_of_le s hs hg #align filter.lift_le Filter.lift_le theorem le_lift {f : Filter α} {g : Set α → Filter β} {h : Filter β} : h ≤ f.lift g ↔ ∀ s ∈ f, h ≤ g s := le_iInf₂_iff #align filter.le_lift Filter.le_lift theorem lift_mono (hf : f₁ ≤ f₂) (hg : g₁ ≤ g₂) : f₁.lift g₁ ≤ f₂.lift g₂ := iInf_mono fun s => iInf_mono' fun hs => ⟨hf hs, hg s⟩ #align filter.lift_mono Filter.lift_mono theorem lift_mono' (hg : ∀ s ∈ f, g₁ s ≤ g₂ s) : f.lift g₁ ≤ f.lift g₂ := iInf₂_mono hg #align filter.lift_mono' Filter.lift_mono'
Mathlib/Order/Filter/Lift.lean
106
108
theorem tendsto_lift {m : γ → β} {l : Filter γ} : Tendsto m l (f.lift g) ↔ ∀ s ∈ f, Tendsto m l (g s) := by
simp only [Filter.lift, tendsto_iInf]
1
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring.List import Mathlib.Data.Int.ModEq import Mathlib.Data.Nat.Bits import Mathlib.Data.Nat.Log import Mathlib.Data.List.Indexes import Mathlib.Data.List.Palindrome import Mathlib.Tactic.IntervalCases import Mathlib.Tactic.Linarith import Mathlib.Tactic.Ring #align_import data.nat.digits from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768" namespace Nat variable {n : ℕ} def digitsAux0 : ℕ → List ℕ | 0 => [] | n + 1 => [n + 1] #align nat.digits_aux_0 Nat.digitsAux0 def digitsAux1 (n : ℕ) : List ℕ := List.replicate n 1 #align nat.digits_aux_1 Nat.digitsAux1 def digitsAux (b : ℕ) (h : 2 ≤ b) : ℕ → List ℕ | 0 => [] | n + 1 => ((n + 1) % b) :: digitsAux b h ((n + 1) / b) decreasing_by exact Nat.div_lt_self (Nat.succ_pos _) h #align nat.digits_aux Nat.digitsAux @[simp] theorem digitsAux_zero (b : ℕ) (h : 2 ≤ b) : digitsAux b h 0 = [] := by rw [digitsAux] #align nat.digits_aux_zero Nat.digitsAux_zero theorem digitsAux_def (b : ℕ) (h : 2 ≤ b) (n : ℕ) (w : 0 < n) : digitsAux b h n = (n % b) :: digitsAux b h (n / b) := by cases n · cases w · rw [digitsAux] #align nat.digits_aux_def Nat.digitsAux_def def digits : ℕ → ℕ → List ℕ | 0 => digitsAux0 | 1 => digitsAux1 | b + 2 => digitsAux (b + 2) (by norm_num) #align nat.digits Nat.digits @[simp] theorem digits_zero (b : ℕ) : digits b 0 = [] := by rcases b with (_ | ⟨_ | ⟨_⟩⟩) <;> simp [digits, digitsAux0, digitsAux1] #align nat.digits_zero Nat.digits_zero -- @[simp] -- Porting note (#10618): simp can prove this theorem digits_zero_zero : digits 0 0 = [] := rfl #align nat.digits_zero_zero Nat.digits_zero_zero @[simp] theorem digits_zero_succ (n : ℕ) : digits 0 n.succ = [n + 1] := rfl #align nat.digits_zero_succ Nat.digits_zero_succ theorem digits_zero_succ' : ∀ {n : ℕ}, n ≠ 0 → digits 0 n = [n] | 0, h => (h rfl).elim | _ + 1, _ => rfl #align nat.digits_zero_succ' Nat.digits_zero_succ' @[simp] theorem digits_one (n : ℕ) : digits 1 n = List.replicate n 1 := rfl #align nat.digits_one Nat.digits_one -- @[simp] -- Porting note (#10685): dsimp can prove this theorem digits_one_succ (n : ℕ) : digits 1 (n + 1) = 1 :: digits 1 n := rfl #align nat.digits_one_succ Nat.digits_one_succ
Mathlib/Data/Nat/Digits.lean
119
121
theorem digits_add_two_add_one (b n : ℕ) : digits (b + 2) (n + 1) = ((n + 1) % (b + 2)) :: digits (b + 2) ((n + 1) / (b + 2)) := by
simp [digits, digitsAux_def]
1
import Mathlib.Topology.Order #align_import topology.maps from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d" open Set Filter Function open TopologicalSpace Topology Filter variable {X : Type*} {Y : Type*} {Z : Type*} {ι : Type*} {f : X → Y} {g : Y → Z} section Inducing variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] theorem inducing_induced (f : X → Y) : @Inducing X Y (TopologicalSpace.induced f ‹_›) _ f := @Inducing.mk _ _ (TopologicalSpace.induced f ‹_›) _ _ rfl theorem inducing_id : Inducing (@id X) := ⟨induced_id.symm⟩ #align inducing_id inducing_id protected theorem Inducing.comp (hg : Inducing g) (hf : Inducing f) : Inducing (g ∘ f) := ⟨by rw [hf.induced, hg.induced, induced_compose]⟩ #align inducing.comp Inducing.comp theorem Inducing.of_comp_iff (hg : Inducing g) : Inducing (g ∘ f) ↔ Inducing f := by refine ⟨fun h ↦ ?_, hg.comp⟩ rw [inducing_iff, hg.induced, induced_compose, h.induced] #align inducing.inducing_iff Inducing.of_comp_iff theorem inducing_of_inducing_compose (hf : Continuous f) (hg : Continuous g) (hgf : Inducing (g ∘ f)) : Inducing f := ⟨le_antisymm (by rwa [← continuous_iff_le_induced]) (by rw [hgf.induced, ← induced_compose] exact induced_mono hg.le_induced)⟩ #align inducing_of_inducing_compose inducing_of_inducing_compose theorem inducing_iff_nhds : Inducing f ↔ ∀ x, 𝓝 x = comap f (𝓝 (f x)) := (inducing_iff _).trans (induced_iff_nhds_eq f) #align inducing_iff_nhds inducing_iff_nhds namespace Inducing theorem nhds_eq_comap (hf : Inducing f) : ∀ x : X, 𝓝 x = comap f (𝓝 <| f x) := inducing_iff_nhds.1 hf #align inducing.nhds_eq_comap Inducing.nhds_eq_comap theorem basis_nhds {p : ι → Prop} {s : ι → Set Y} (hf : Inducing f) {x : X} (h_basis : (𝓝 (f x)).HasBasis p s) : (𝓝 x).HasBasis p (preimage f ∘ s) := hf.nhds_eq_comap x ▸ h_basis.comap f theorem nhdsSet_eq_comap (hf : Inducing f) (s : Set X) : 𝓝ˢ s = comap f (𝓝ˢ (f '' s)) := by simp only [nhdsSet, sSup_image, comap_iSup, hf.nhds_eq_comap, iSup_image] #align inducing.nhds_set_eq_comap Inducing.nhdsSet_eq_comap theorem map_nhds_eq (hf : Inducing f) (x : X) : (𝓝 x).map f = 𝓝[range f] f x := hf.induced.symm ▸ map_nhds_induced_eq x #align inducing.map_nhds_eq Inducing.map_nhds_eq theorem map_nhds_of_mem (hf : Inducing f) (x : X) (h : range f ∈ 𝓝 (f x)) : (𝓝 x).map f = 𝓝 (f x) := hf.induced.symm ▸ map_nhds_induced_of_mem h #align inducing.map_nhds_of_mem Inducing.map_nhds_of_mem -- Porting note (#10756): new lemma theorem mapClusterPt_iff (hf : Inducing f) {x : X} {l : Filter X} : MapClusterPt (f x) l f ↔ ClusterPt x l := by delta MapClusterPt ClusterPt rw [← Filter.push_pull', ← hf.nhds_eq_comap, map_neBot_iff] theorem image_mem_nhdsWithin (hf : Inducing f) {x : X} {s : Set X} (hs : s ∈ 𝓝 x) : f '' s ∈ 𝓝[range f] f x := hf.map_nhds_eq x ▸ image_mem_map hs #align inducing.image_mem_nhds_within Inducing.image_mem_nhdsWithin theorem tendsto_nhds_iff {f : ι → Y} {l : Filter ι} {y : Y} (hg : Inducing g) : Tendsto f l (𝓝 y) ↔ Tendsto (g ∘ f) l (𝓝 (g y)) := by rw [hg.nhds_eq_comap, tendsto_comap_iff] #align inducing.tendsto_nhds_iff Inducing.tendsto_nhds_iff theorem continuousAt_iff (hg : Inducing g) {x : X} : ContinuousAt f x ↔ ContinuousAt (g ∘ f) x := hg.tendsto_nhds_iff #align inducing.continuous_at_iff Inducing.continuousAt_iff theorem continuous_iff (hg : Inducing g) : Continuous f ↔ Continuous (g ∘ f) := by simp_rw [continuous_iff_continuousAt, hg.continuousAt_iff] #align inducing.continuous_iff Inducing.continuous_iff theorem continuousAt_iff' (hf : Inducing f) {x : X} (h : range f ∈ 𝓝 (f x)) : ContinuousAt (g ∘ f) x ↔ ContinuousAt g (f x) := by simp_rw [ContinuousAt, Filter.Tendsto, ← hf.map_nhds_of_mem _ h, Filter.map_map, comp] #align inducing.continuous_at_iff' Inducing.continuousAt_iff' protected theorem continuous (hf : Inducing f) : Continuous f := hf.continuous_iff.mp continuous_id #align inducing.continuous Inducing.continuous theorem closure_eq_preimage_closure_image (hf : Inducing f) (s : Set X) : closure s = f ⁻¹' closure (f '' s) := by ext x rw [Set.mem_preimage, ← closure_induced, hf.induced] #align inducing.closure_eq_preimage_closure_image Inducing.closure_eq_preimage_closure_image
Mathlib/Topology/Maps.lean
152
153
theorem isClosed_iff (hf : Inducing f) {s : Set X} : IsClosed s ↔ ∃ t, IsClosed t ∧ f ⁻¹' t = s := by
rw [hf.induced, isClosed_induced_iff]
1
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by -- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx #align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) : b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul, reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq] #align clifford_algebra.contract_right_mul_ι CliffordAlgebra.contractRight_mul_ι theorem contractLeft_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : d⌋(algebraMap _ _ r * b) = algebraMap _ _ r * (d⌋b) := by rw [← Algebra.smul_def, map_smul, Algebra.smul_def] #align clifford_algebra.contract_left_algebra_map_mul CliffordAlgebra.contractLeft_algebraMap_mul
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
149
151
theorem contractLeft_mul_algebraMap (a : CliffordAlgebra Q) (r : R) : d⌋(a * algebraMap _ _ r) = d⌋a * algebraMap _ _ r := by
rw [← Algebra.commutes, contractLeft_algebraMap_mul, Algebra.commutes]
1
import Mathlib.Data.Nat.Count import Mathlib.Data.Nat.SuccPred import Mathlib.Order.Interval.Set.Monotone import Mathlib.Order.OrderIsoNat #align_import data.nat.nth from "leanprover-community/mathlib"@"7fdd4f3746cb059edfdb5d52cba98f66fce418c0" open Finset namespace Nat variable (p : ℕ → Prop) noncomputable def nth (p : ℕ → Prop) (n : ℕ) : ℕ := by classical exact if h : Set.Finite (setOf p) then (h.toFinset.sort (· ≤ ·)).getD n 0 else @Nat.Subtype.orderIsoOfNat (setOf p) (Set.Infinite.to_subtype h) n #align nat.nth Nat.nth variable {p} theorem nth_of_card_le (hf : (setOf p).Finite) {n : ℕ} (hn : hf.toFinset.card ≤ n) : nth p n = 0 := by rw [nth, dif_pos hf, List.getD_eq_default]; rwa [Finset.length_sort] #align nat.nth_of_card_le Nat.nth_of_card_le theorem nth_eq_getD_sort (h : (setOf p).Finite) (n : ℕ) : nth p n = (h.toFinset.sort (· ≤ ·)).getD n 0 := dif_pos h #align nat.nth_eq_nthd_sort Nat.nth_eq_getD_sort
Mathlib/Data/Nat/Nth.lean
71
73
theorem nth_eq_orderEmbOfFin (hf : (setOf p).Finite) {n : ℕ} (hn : n < hf.toFinset.card) : nth p n = hf.toFinset.orderEmbOfFin rfl ⟨n, hn⟩ := by
rw [nth_eq_getD_sort hf, Finset.orderEmbOfFin_apply, List.getD_eq_get]
1
import Mathlib.Data.List.Nodup import Mathlib.Data.List.Zip import Mathlib.Data.Nat.Defs import Mathlib.Data.List.Infix #align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u variable {α : Type u} open Nat Function namespace List theorem rotate_mod (l : List α) (n : ℕ) : l.rotate (n % l.length) = l.rotate n := by simp [rotate] #align list.rotate_mod List.rotate_mod @[simp] theorem rotate_nil (n : ℕ) : ([] : List α).rotate n = [] := by simp [rotate] #align list.rotate_nil List.rotate_nil @[simp]
Mathlib/Data/List/Rotate.lean
45
45
theorem rotate_zero (l : List α) : l.rotate 0 = l := by
simp [rotate]
1
import Mathlib.Analysis.Convex.Hull #align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8" open Set variable {ι : Sort*} {𝕜 E : Type*} section OrderedSemiring variable (𝕜) [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] {s t s₁ s₂ t₁ t₂ u : Set E} {x y : E} def convexJoin (s t : Set E) : Set E := ⋃ (x ∈ s) (y ∈ t), segment 𝕜 x y #align convex_join convexJoin variable {𝕜} theorem mem_convexJoin : x ∈ convexJoin 𝕜 s t ↔ ∃ a ∈ s, ∃ b ∈ t, x ∈ segment 𝕜 a b := by simp [convexJoin] #align mem_convex_join mem_convexJoin theorem convexJoin_comm (s t : Set E) : convexJoin 𝕜 s t = convexJoin 𝕜 t s := (iUnion₂_comm _).trans <| by simp_rw [convexJoin, segment_symm] #align convex_join_comm convexJoin_comm theorem convexJoin_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s₁ t₁ ⊆ convexJoin 𝕜 s₂ t₂ := biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht #align convex_join_mono convexJoin_mono theorem convexJoin_mono_left (hs : s₁ ⊆ s₂) : convexJoin 𝕜 s₁ t ⊆ convexJoin 𝕜 s₂ t := convexJoin_mono hs Subset.rfl #align convex_join_mono_left convexJoin_mono_left theorem convexJoin_mono_right (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s t₁ ⊆ convexJoin 𝕜 s t₂ := convexJoin_mono Subset.rfl ht #align convex_join_mono_right convexJoin_mono_right @[simp] theorem convexJoin_empty_left (t : Set E) : convexJoin 𝕜 ∅ t = ∅ := by simp [convexJoin] #align convex_join_empty_left convexJoin_empty_left @[simp] theorem convexJoin_empty_right (s : Set E) : convexJoin 𝕜 s ∅ = ∅ := by simp [convexJoin] #align convex_join_empty_right convexJoin_empty_right @[simp] theorem convexJoin_singleton_left (t : Set E) (x : E) : convexJoin 𝕜 {x} t = ⋃ y ∈ t, segment 𝕜 x y := by simp [convexJoin] #align convex_join_singleton_left convexJoin_singleton_left @[simp] theorem convexJoin_singleton_right (s : Set E) (y : E) : convexJoin 𝕜 s {y} = ⋃ x ∈ s, segment 𝕜 x y := by simp [convexJoin] #align convex_join_singleton_right convexJoin_singleton_right -- Porting note (#10618): simp can prove it
Mathlib/Analysis/Convex/Join.lean
75
75
theorem convexJoin_singletons (x : E) : convexJoin 𝕜 {x} {y} = segment 𝕜 x y := by
simp
1
import Mathlib.Control.Functor.Multivariate import Mathlib.Data.PFunctor.Univariate.Basic #align_import data.pfunctor.multivariate.basic from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d" universe u v open MvFunctor @[pp_with_univ] structure MvPFunctor (n : ℕ) where A : Type u B : A → TypeVec.{u} n #align mvpfunctor MvPFunctor namespace MvPFunctor open MvFunctor (LiftP LiftR) variable {n m : ℕ} (P : MvPFunctor.{u} n) @[coe] def Obj (α : TypeVec.{u} n) : Type u := Σ a : P.A, P.B a ⟹ α #align mvpfunctor.obj MvPFunctor.Obj instance : CoeFun (MvPFunctor.{u} n) (fun _ => TypeVec.{u} n → Type u) where coe := Obj def map {α β : TypeVec n} (f : α ⟹ β) : P α → P β := fun ⟨a, g⟩ => ⟨a, TypeVec.comp f g⟩ #align mvpfunctor.map MvPFunctor.map instance : Inhabited (MvPFunctor n) := ⟨⟨default, default⟩⟩ instance Obj.inhabited {α : TypeVec n} [Inhabited P.A] [∀ i, Inhabited (α i)] : Inhabited (P α) := ⟨⟨default, fun _ _ => default⟩⟩ #align mvpfunctor.obj.inhabited MvPFunctor.Obj.inhabited instance : MvFunctor.{u} P.Obj := ⟨@MvPFunctor.map n P⟩ theorem map_eq {α β : TypeVec n} (g : α ⟹ β) (a : P.A) (f : P.B a ⟹ α) : @MvFunctor.map _ P.Obj _ _ _ g ⟨a, f⟩ = ⟨a, g ⊚ f⟩ := rfl #align mvpfunctor.map_eq MvPFunctor.map_eq theorem id_map {α : TypeVec n} : ∀ x : P α, TypeVec.id <$$> x = x | ⟨_, _⟩ => rfl #align mvpfunctor.id_map MvPFunctor.id_map theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) : ∀ x : P α, (g ⊚ f) <$$> x = g <$$> f <$$> x | ⟨_, _⟩ => rfl #align mvpfunctor.comp_map MvPFunctor.comp_map instance : LawfulMvFunctor.{u} P.Obj where id_map := @id_map _ P comp_map := @comp_map _ P def const (n : ℕ) (A : Type u) : MvPFunctor n := { A B := fun _ _ => PEmpty } #align mvpfunctor.const MvPFunctor.const def comp (P : MvPFunctor.{u} n) (Q : Fin2 n → MvPFunctor.{u} m) : MvPFunctor m where A := Σ a₂ : P.1, ∀ i, P.2 a₂ i → (Q i).1 B a i := Σ(j : _) (b : P.2 a.1 j), (Q j).2 (a.snd j b) i #align mvpfunctor.comp MvPFunctor.comp variable {P} {Q : Fin2 n → MvPFunctor.{u} m} {α β : TypeVec.{u} m} def comp.mk (x : P (fun i => Q i α)) : comp P Q α := ⟨⟨x.1, fun _ a => (x.2 _ a).1⟩, fun i a => (x.snd a.fst a.snd.fst).snd i a.snd.snd⟩ #align mvpfunctor.comp.mk MvPFunctor.comp.mk def comp.get (x : comp P Q α) : P (fun i => Q i α) := ⟨x.1.1, fun i a => ⟨x.fst.snd i a, fun (j : Fin2 m) (b : (Q i).B _ j) => x.snd j ⟨i, ⟨a, b⟩⟩⟩⟩ #align mvpfunctor.comp.get MvPFunctor.comp.get theorem comp.get_map (f : α ⟹ β) (x : comp P Q α) : comp.get (f <$$> x) = (fun i (x : Q i α) => f <$$> x) <$$> comp.get x := by rfl #align mvpfunctor.comp.get_map MvPFunctor.comp.get_map @[simp]
Mathlib/Data/PFunctor/Multivariate/Basic.lean
148
149
theorem comp.get_mk (x : P (fun i => Q i α)) : comp.get (comp.mk x) = x := by
rfl
1
import Mathlib.Geometry.Euclidean.Sphere.Basic #align_import geometry.euclidean.sphere.second_inter from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open RealInnerProductSpace namespace EuclideanGeometry variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] def Sphere.secondInter (s : Sphere P) (p : P) (v : V) : P := (-2 * ⟪v, p -ᵥ s.center⟫ / ⟪v, v⟫) • v +ᵥ p #align euclidean_geometry.sphere.second_inter EuclideanGeometry.Sphere.secondInter @[simp] theorem Sphere.secondInter_dist (s : Sphere P) (p : P) (v : V) : dist (s.secondInter p v) s.center = dist p s.center := by rw [Sphere.secondInter] by_cases hv : v = 0; · simp [hv] rw [dist_smul_vadd_eq_dist _ _ hv] exact Or.inr rfl #align euclidean_geometry.sphere.second_inter_dist EuclideanGeometry.Sphere.secondInter_dist @[simp]
Mathlib/Geometry/Euclidean/Sphere/SecondInter.lean
54
55
theorem Sphere.secondInter_mem {s : Sphere P} {p : P} (v : V) : s.secondInter p v ∈ s ↔ p ∈ s := by
simp_rw [mem_sphere, Sphere.secondInter_dist]
1
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finsupp.Defs import Mathlib.Data.Finset.Pairwise #align_import data.finsupp.big_operators from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" variable {ι M : Type*} [DecidableEq ι] theorem List.support_sum_subset [AddMonoid M] (l : List (ι →₀ M)) : l.sum.support ⊆ l.foldr (Finsupp.support · ⊔ ·) ∅ := by induction' l with hd tl IH · simp · simp only [List.sum_cons, Finset.union_comm] refine Finsupp.support_add.trans (Finset.union_subset_union ?_ IH) rfl #align list.support_sum_subset List.support_sum_subset theorem Multiset.support_sum_subset [AddCommMonoid M] (s : Multiset (ι →₀ M)) : s.sum.support ⊆ (s.map Finsupp.support).sup := by induction s using Quot.inductionOn simpa only [Multiset.quot_mk_to_coe'', Multiset.sum_coe, Multiset.map_coe, Multiset.sup_coe, List.foldr_map] using List.support_sum_subset _ #align multiset.support_sum_subset Multiset.support_sum_subset
Mathlib/Data/Finsupp/BigOperators.lean
55
57
theorem Finset.support_sum_subset [AddCommMonoid M] (s : Finset (ι →₀ M)) : (s.sum id).support ⊆ Finset.sup s Finsupp.support := by
classical convert Multiset.support_sum_subset s.1; simp
1
import Mathlib.Algebra.EuclideanDomain.Defs import Mathlib.Algebra.Ring.Divisibility.Basic import Mathlib.Algebra.Ring.Regular import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Ring.Basic #align_import algebra.euclidean_domain.basic from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6" universe u namespace EuclideanDomain variable {R : Type u} variable [EuclideanDomain R] local infixl:50 " ≺ " => EuclideanDomain.R -- See note [lower instance priority] instance (priority := 100) toMulDivCancelClass : MulDivCancelClass R where mul_div_cancel a b hb := by refine (eq_of_sub_eq_zero ?_).symm by_contra h have := mul_right_not_lt b h rw [sub_mul, mul_comm (_ / _), sub_eq_iff_eq_add'.2 (div_add_mod (a * b) b).symm] at this exact this (mod_lt _ hb) #align euclidean_domain.mul_div_cancel_left mul_div_cancel_left₀ #align euclidean_domain.mul_div_cancel mul_div_cancel_right₀ @[simp] theorem mod_eq_zero {a b : R} : a % b = 0 ↔ b ∣ a := ⟨fun h => by rw [← div_add_mod a b, h, add_zero] exact dvd_mul_right _ _, fun ⟨c, e⟩ => by rw [e, ← add_left_cancel_iff, div_add_mod, add_zero] haveI := Classical.dec by_cases b0 : b = 0 · simp only [b0, zero_mul] · rw [mul_div_cancel_left₀ _ b0]⟩ #align euclidean_domain.mod_eq_zero EuclideanDomain.mod_eq_zero @[simp] theorem mod_self (a : R) : a % a = 0 := mod_eq_zero.2 dvd_rfl #align euclidean_domain.mod_self EuclideanDomain.mod_self
Mathlib/Algebra/EuclideanDomain/Basic.lean
63
64
theorem dvd_mod_iff {a b c : R} (h : c ∣ b) : c ∣ a % b ↔ c ∣ a := by
rw [← dvd_add_right (h.mul_right _), div_add_mod]
1
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring.List import Mathlib.Data.Int.ModEq import Mathlib.Data.Nat.Bits import Mathlib.Data.Nat.Log import Mathlib.Data.List.Indexes import Mathlib.Data.List.Palindrome import Mathlib.Tactic.IntervalCases import Mathlib.Tactic.Linarith import Mathlib.Tactic.Ring #align_import data.nat.digits from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768" namespace Nat variable {n : ℕ} def digitsAux0 : ℕ → List ℕ | 0 => [] | n + 1 => [n + 1] #align nat.digits_aux_0 Nat.digitsAux0 def digitsAux1 (n : ℕ) : List ℕ := List.replicate n 1 #align nat.digits_aux_1 Nat.digitsAux1 def digitsAux (b : ℕ) (h : 2 ≤ b) : ℕ → List ℕ | 0 => [] | n + 1 => ((n + 1) % b) :: digitsAux b h ((n + 1) / b) decreasing_by exact Nat.div_lt_self (Nat.succ_pos _) h #align nat.digits_aux Nat.digitsAux @[simp]
Mathlib/Data/Nat/Digits.lean
60
60
theorem digitsAux_zero (b : ℕ) (h : 2 ≤ b) : digitsAux b h 0 = [] := by
rw [digitsAux]
1
import Mathlib.Analysis.Convex.Topology import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.Seminorm import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Analysis.RCLike.Basic #align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d" open NormedField Set open scoped Pointwise Topology NNReal noncomputable section variable {𝕜 E F : Type*} section AddCommGroup variable [AddCommGroup E] [Module ℝ E] def gauge (s : Set E) (x : E) : ℝ := sInf { r : ℝ | 0 < r ∧ x ∈ r • s } #align gauge gauge variable {s t : Set E} {x : E} {a : ℝ} theorem gauge_def : gauge s x = sInf ({ r ∈ Set.Ioi (0 : ℝ) | x ∈ r • s }) := rfl #align gauge_def gauge_def theorem gauge_def' : gauge s x = sInf {r ∈ Set.Ioi (0 : ℝ) | r⁻¹ • x ∈ s} := by congrm sInf {r | ?_} exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_mem₀ hr.ne' _ _ #align gauge_def' gauge_def' private theorem gauge_set_bddBelow : BddBelow { r : ℝ | 0 < r ∧ x ∈ r • s } := ⟨0, fun _ hr => hr.1.le⟩ theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent ℝ s) : { r : ℝ | 0 < r ∧ x ∈ r • s }.Nonempty := let ⟨r, hr₁, hr₂⟩ := (absorbs x).exists_pos ⟨r, hr₁, hr₂ r (Real.norm_of_nonneg hr₁.le).ge rfl⟩ #align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty theorem gauge_mono (hs : Absorbent ℝ s) (h : s ⊆ t) : gauge t ≤ gauge s := fun _ => csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => ⟨hr.1, smul_set_mono h hr.2⟩ #align gauge_mono gauge_mono theorem exists_lt_of_gauge_lt (absorbs : Absorbent ℝ s) (h : gauge s x < a) : ∃ b, 0 < b ∧ b < a ∧ x ∈ b • s := by obtain ⟨b, ⟨hb, hx⟩, hba⟩ := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h exact ⟨b, hb, hba, hx⟩ #align exists_lt_of_gauge_lt exists_lt_of_gauge_lt @[simp] theorem gauge_zero : gauge s 0 = 0 := by rw [gauge_def'] by_cases h : (0 : E) ∈ s · simp only [smul_zero, sep_true, h, csInf_Ioi] · simp only [smul_zero, sep_false, h, Real.sInf_empty] #align gauge_zero gauge_zero @[simp] theorem gauge_zero' : gauge (0 : Set E) = 0 := by ext x rw [gauge_def'] obtain rfl | hx := eq_or_ne x 0 · simp only [csInf_Ioi, mem_zero, Pi.zero_apply, eq_self_iff_true, sep_true, smul_zero] · simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero] convert Real.sInf_empty exact eq_empty_iff_forall_not_mem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx #align gauge_zero' gauge_zero' @[simp] theorem gauge_empty : gauge (∅ : Set E) = 0 := by ext simp only [gauge_def', Real.sInf_empty, mem_empty_iff_false, Pi.zero_apply, sep_false] #align gauge_empty gauge_empty theorem gauge_of_subset_zero (h : s ⊆ 0) : gauge s = 0 := by obtain rfl | rfl := subset_singleton_iff_eq.1 h exacts [gauge_empty, gauge_zero'] #align gauge_of_subset_zero gauge_of_subset_zero theorem gauge_nonneg (x : E) : 0 ≤ gauge s x := Real.sInf_nonneg _ fun _ hx => hx.1.le #align gauge_nonneg gauge_nonneg theorem gauge_neg (symmetric : ∀ x ∈ s, -x ∈ s) (x : E) : gauge s (-x) = gauge s x := by have : ∀ x, -x ∈ s ↔ x ∈ s := fun x => ⟨fun h => by simpa using symmetric _ h, symmetric x⟩ simp_rw [gauge_def', smul_neg, this] #align gauge_neg gauge_neg
Mathlib/Analysis/Convex/Gauge.lean
134
135
theorem gauge_neg_set_neg (x : E) : gauge (-s) (-x) = gauge s x := by
simp_rw [gauge_def', smul_neg, neg_mem_neg]
1
import Mathlib.Algebra.Algebra.Subalgebra.Operations import Mathlib.Algebra.Ring.Fin import Mathlib.RingTheory.Ideal.Quotient #align_import ring_theory.ideal.quotient_operations from "leanprover-community/mathlib"@"b88d81c84530450a8989e918608e5960f015e6c8" universe u v w namespace Ideal open Function RingHom variable {R : Type u} {S : Type v} {F : Type w} [CommRing R] [Semiring S] @[simp] theorem map_quotient_self (I : Ideal R) : map (Quotient.mk I) I = ⊥ := eq_bot_iff.2 <| Ideal.map_le_iff_le_comap.2 fun _ hx => (Submodule.mem_bot (R ⧸ I)).2 <| Ideal.Quotient.eq_zero_iff_mem.2 hx #align ideal.map_quotient_self Ideal.map_quotient_self @[simp] theorem mk_ker {I : Ideal R} : ker (Quotient.mk I) = I := by ext rw [ker, mem_comap, Submodule.mem_bot, Quotient.eq_zero_iff_mem] #align ideal.mk_ker Ideal.mk_ker theorem map_mk_eq_bot_of_le {I J : Ideal R} (h : I ≤ J) : I.map (Quotient.mk J) = ⊥ := by rw [map_eq_bot_iff_le_ker, mk_ker] exact h #align ideal.map_mk_eq_bot_of_le Ideal.map_mk_eq_bot_of_le theorem ker_quotient_lift {I : Ideal R} (f : R →+* S) (H : I ≤ ker f) : ker (Ideal.Quotient.lift I f H) = f.ker.map (Quotient.mk I) := by apply Ideal.ext intro x constructor · intro hx obtain ⟨y, hy⟩ := Quotient.mk_surjective x rw [mem_ker, ← hy, Ideal.Quotient.lift_mk, ← mem_ker] at hx rw [← hy, mem_map_iff_of_surjective (Quotient.mk I) Quotient.mk_surjective] exact ⟨y, hx, rfl⟩ · intro hx rw [mem_map_iff_of_surjective (Quotient.mk I) Quotient.mk_surjective] at hx obtain ⟨y, hy⟩ := hx rw [mem_ker, ← hy.right, Ideal.Quotient.lift_mk] exact hy.left #align ideal.ker_quotient_lift Ideal.ker_quotient_lift lemma injective_lift_iff {I : Ideal R} {f : R →+* S} (H : ∀ (a : R), a ∈ I → f a = 0) : Injective (Quotient.lift I f H) ↔ ker f = I := by rw [injective_iff_ker_eq_bot, ker_quotient_lift, map_eq_bot_iff_le_ker, mk_ker] constructor · exact fun h ↦ le_antisymm h H · rintro rfl; rfl lemma ker_Pi_Quotient_mk {ι : Type*} (I : ι → Ideal R) : ker (Pi.ringHom fun i : ι ↦ Quotient.mk (I i)) = ⨅ i, I i := by simp [Pi.ker_ringHom, mk_ker] @[simp] theorem bot_quotient_isMaximal_iff (I : Ideal R) : (⊥ : Ideal (R ⧸ I)).IsMaximal ↔ I.IsMaximal := ⟨fun hI => mk_ker (I := I) ▸ comap_isMaximal_of_surjective (Quotient.mk I) Quotient.mk_surjective (K := ⊥) (H := hI), fun hI => by letI := Quotient.field I exact bot_isMaximal⟩ #align ideal.bot_quotient_is_maximal_iff Ideal.bot_quotient_isMaximal_iff @[simp] theorem mem_quotient_iff_mem_sup {I J : Ideal R} {x : R} : Quotient.mk I x ∈ J.map (Quotient.mk I) ↔ x ∈ J ⊔ I := by rw [← mem_comap, comap_map_of_surjective (Quotient.mk I) Quotient.mk_surjective, ← ker_eq_comap_bot, mk_ker] #align ideal.mem_quotient_iff_mem_sup Ideal.mem_quotient_iff_mem_sup
Mathlib/RingTheory/Ideal/QuotientOperations.lean
189
191
theorem mem_quotient_iff_mem {I J : Ideal R} (hIJ : I ≤ J) {x : R} : Quotient.mk I x ∈ J.map (Quotient.mk I) ↔ x ∈ J := by
rw [mem_quotient_iff_mem_sup, sup_eq_left.mpr hIJ]
1
import Mathlib.Analysis.Calculus.ContDiff.Bounds import Mathlib.Analysis.Calculus.IteratedDeriv.Defs import Mathlib.Analysis.Calculus.LineDeriv.Basic import Mathlib.Analysis.LocallyConvex.WithSeminorms import Mathlib.Analysis.Normed.Group.ZeroAtInfty import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Analysis.SpecialFunctions.JapaneseBracket import Mathlib.Topology.Algebra.UniformFilterBasis import Mathlib.Tactic.MoveAdd #align_import analysis.schwartz_space from "leanprover-community/mathlib"@"e137999b2c6f2be388f4cd3bbf8523de1910cd2b" noncomputable section open scoped Nat NNReal variable {𝕜 𝕜' D E F G V : Type*} variable [NormedAddCommGroup E] [NormedSpace ℝ E] variable [NormedAddCommGroup F] [NormedSpace ℝ F] variable (E F) structure SchwartzMap where toFun : E → F smooth' : ContDiff ℝ ⊤ toFun decay' : ∀ k n : ℕ, ∃ C : ℝ, ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n toFun x‖ ≤ C #align schwartz_map SchwartzMap scoped[SchwartzMap] notation "𝓢(" E ", " F ")" => SchwartzMap E F variable {E F} namespace SchwartzMap -- Porting note: removed -- instance : Coe 𝓢(E, F) (E → F) := ⟨toFun⟩ instance instFunLike : FunLike 𝓢(E, F) E F where coe f := f.toFun coe_injective' f g h := by cases f; cases g; congr #align schwartz_map.fun_like SchwartzMap.instFunLike instance instCoeFun : CoeFun 𝓢(E, F) fun _ => E → F := DFunLike.hasCoeToFun #align schwartz_map.has_coe_to_fun SchwartzMap.instCoeFun theorem decay (f : 𝓢(E, F)) (k n : ℕ) : ∃ C : ℝ, 0 < C ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ C := by rcases f.decay' k n with ⟨C, hC⟩ exact ⟨max C 1, by positivity, fun x => (hC x).trans (le_max_left _ _)⟩ #align schwartz_map.decay SchwartzMap.decay theorem smooth (f : 𝓢(E, F)) (n : ℕ∞) : ContDiff ℝ n f := f.smooth'.of_le le_top #align schwartz_map.smooth SchwartzMap.smooth @[continuity] protected theorem continuous (f : 𝓢(E, F)) : Continuous f := (f.smooth 0).continuous #align schwartz_map.continuous SchwartzMap.continuous instance instContinuousMapClass : ContinuousMapClass 𝓢(E, F) E F where map_continuous := SchwartzMap.continuous protected theorem differentiable (f : 𝓢(E, F)) : Differentiable ℝ f := (f.smooth 1).differentiable rfl.le #align schwartz_map.differentiable SchwartzMap.differentiable protected theorem differentiableAt (f : 𝓢(E, F)) {x : E} : DifferentiableAt ℝ f x := f.differentiable.differentiableAt #align schwartz_map.differentiable_at SchwartzMap.differentiableAt @[ext] theorem ext {f g : 𝓢(E, F)} (h : ∀ x, (f : E → F) x = g x) : f = g := DFunLike.ext f g h #align schwartz_map.ext SchwartzMap.ext section Aux theorem bounds_nonempty (k n : ℕ) (f : 𝓢(E, F)) : ∃ c : ℝ, c ∈ { c : ℝ | 0 ≤ c ∧ ∀ x : E, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } := let ⟨M, hMp, hMb⟩ := f.decay k n ⟨M, le_of_lt hMp, hMb⟩ #align schwartz_map.bounds_nonempty SchwartzMap.bounds_nonempty theorem bounds_bddBelow (k n : ℕ) (f : 𝓢(E, F)) : BddBelow { c | 0 ≤ c ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } := ⟨0, fun _ ⟨hn, _⟩ => hn⟩ #align schwartz_map.bounds_bdd_below SchwartzMap.bounds_bddBelow theorem decay_add_le_aux (k n : ℕ) (f g : 𝓢(E, F)) (x : E) : ‖x‖ ^ k * ‖iteratedFDeriv ℝ n ((f : E → F) + (g : E → F)) x‖ ≤ ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ + ‖x‖ ^ k * ‖iteratedFDeriv ℝ n g x‖ := by rw [← mul_add] refine mul_le_mul_of_nonneg_left ?_ (by positivity) rw [iteratedFDeriv_add_apply (f.smooth _) (g.smooth _)] exact norm_add_le _ _ #align schwartz_map.decay_add_le_aux SchwartzMap.decay_add_le_aux
Mathlib/Analysis/Distribution/SchwartzSpace.lean
203
205
theorem decay_neg_aux (k n : ℕ) (f : 𝓢(E, F)) (x : E) : ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (-f : E → F) x‖ = ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ := by
rw [iteratedFDeriv_neg_apply, norm_neg]
1
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Module.Pi #align_import data.holor from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" universe u open List def HolorIndex (ds : List ℕ) : Type := { is : List ℕ // Forall₂ (· < ·) is ds } #align holor_index HolorIndex namespace HolorIndex variable {ds₁ ds₂ ds₃ : List ℕ} def take : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₁ | ds, is => ⟨List.take (length ds) is.1, forall₂_take_append is.1 ds ds₂ is.2⟩ #align holor_index.take HolorIndex.take def drop : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₂ | ds, is => ⟨List.drop (length ds) is.1, forall₂_drop_append is.1 ds ds₂ is.2⟩ #align holor_index.drop HolorIndex.drop
Mathlib/Data/Holor.lean
58
59
theorem cast_type (is : List ℕ) (eq : ds₁ = ds₂) (h : Forall₂ (· < ·) is ds₁) : (cast (congr_arg HolorIndex eq) ⟨is, h⟩).val = is := by
subst eq; rfl
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Polynomial.Degree.Lemmas #align_import data.polynomial.erase_lead from "leanprover-community/mathlib"@"fa256f00ce018e7b40e1dc756e403c86680bf448" noncomputable section open Polynomial open Polynomial Finset namespace Polynomial variable {R : Type*} [Semiring R] {f : R[X]} def eraseLead (f : R[X]) : R[X] := Polynomial.erase f.natDegree f #align polynomial.erase_lead Polynomial.eraseLead section EraseLead theorem eraseLead_support (f : R[X]) : f.eraseLead.support = f.support.erase f.natDegree := by simp only [eraseLead, support_erase] #align polynomial.erase_lead_support Polynomial.eraseLead_support theorem eraseLead_coeff (i : ℕ) : f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i := by simp only [eraseLead, coeff_erase] #align polynomial.erase_lead_coeff Polynomial.eraseLead_coeff @[simp] theorem eraseLead_coeff_natDegree : f.eraseLead.coeff f.natDegree = 0 := by simp [eraseLead_coeff] #align polynomial.erase_lead_coeff_nat_degree Polynomial.eraseLead_coeff_natDegree theorem eraseLead_coeff_of_ne (i : ℕ) (hi : i ≠ f.natDegree) : f.eraseLead.coeff i = f.coeff i := by simp [eraseLead_coeff, hi] #align polynomial.erase_lead_coeff_of_ne Polynomial.eraseLead_coeff_of_ne @[simp]
Mathlib/Algebra/Polynomial/EraseLead.lean
60
60
theorem eraseLead_zero : eraseLead (0 : R[X]) = 0 := by
simp only [eraseLead, erase_zero]
1
import Mathlib.Data.List.Infix #align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" -- Make sure we don't import algebra assert_not_exists Monoid variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ) namespace List def rdrop : List α := l.take (l.length - n) #align list.rdrop List.rdrop @[simp] theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop] #align list.rdrop_nil List.rdrop_nil @[simp] theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop] #align list.rdrop_zero List.rdrop_zero theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by rw [rdrop] induction' l using List.reverseRecOn with xs x IH generalizing n · simp · cases n · simp [take_append] · simp [take_append_eq_append_take, IH] #align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse @[simp] theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by simp [rdrop_eq_reverse_drop_reverse] #align list.rdrop_concat_succ List.rdrop_concat_succ def rtake : List α := l.drop (l.length - n) #align list.rtake List.rtake @[simp] theorem rtake_nil : rtake ([] : List α) n = [] := by simp [rtake] #align list.rtake_nil List.rtake_nil @[simp] theorem rtake_zero : rtake l 0 = [] := by simp [rtake] #align list.rtake_zero List.rtake_zero theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) := by rw [rtake] induction' l using List.reverseRecOn with xs x IH generalizing n · simp · cases n · exact drop_length _ · simp [drop_append_eq_append_drop, IH] #align list.rtake_eq_reverse_take_reverse List.rtake_eq_reverse_take_reverse @[simp]
Mathlib/Data/List/DropRight.lean
91
92
theorem rtake_concat_succ (x : α) : rtake (l ++ [x]) (n + 1) = rtake l n ++ [x] := by
simp [rtake_eq_reverse_take_reverse]
1
import Mathlib.Analysis.NormedSpace.Basic #align_import analysis.normed_space.enorm from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" noncomputable section attribute [local instance] Classical.propDecidable open ENNReal structure ENorm (𝕜 : Type*) (V : Type*) [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] where toFun : V → ℝ≥0∞ eq_zero' : ∀ x, toFun x = 0 → x = 0 map_add_le' : ∀ x y : V, toFun (x + y) ≤ toFun x + toFun y map_smul_le' : ∀ (c : 𝕜) (x : V), toFun (c • x) ≤ ‖c‖₊ * toFun x #align enorm ENorm namespace ENorm variable {𝕜 : Type*} {V : Type*} [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] (e : ENorm 𝕜 V) -- Porting note: added to appease norm_cast complaints attribute [coe] ENorm.toFun instance : CoeFun (ENorm 𝕜 V) fun _ => V → ℝ≥0∞ := ⟨ENorm.toFun⟩ theorem coeFn_injective : Function.Injective ((↑) : ENorm 𝕜 V → V → ℝ≥0∞) := fun e₁ e₂ h => by cases e₁ cases e₂ congr #align enorm.coe_fn_injective ENorm.coeFn_injective @[ext] theorem ext {e₁ e₂ : ENorm 𝕜 V} (h : ∀ x, e₁ x = e₂ x) : e₁ = e₂ := coeFn_injective <| funext h #align enorm.ext ENorm.ext theorem ext_iff {e₁ e₂ : ENorm 𝕜 V} : e₁ = e₂ ↔ ∀ x, e₁ x = e₂ x := ⟨fun h _ => h ▸ rfl, ext⟩ #align enorm.ext_iff ENorm.ext_iff @[simp, norm_cast] theorem coe_inj {e₁ e₂ : ENorm 𝕜 V} : (e₁ : V → ℝ≥0∞) = e₂ ↔ e₁ = e₂ := coeFn_injective.eq_iff #align enorm.coe_inj ENorm.coe_inj @[simp] theorem map_smul (c : 𝕜) (x : V) : e (c • x) = ‖c‖₊ * e x := by apply le_antisymm (e.map_smul_le' c x) by_cases hc : c = 0 · simp [hc] calc (‖c‖₊ : ℝ≥0∞) * e x = ‖c‖₊ * e (c⁻¹ • c • x) := by rw [inv_smul_smul₀ hc] _ ≤ ‖c‖₊ * (‖c⁻¹‖₊ * e (c • x)) := mul_le_mul_left' (e.map_smul_le' _ _) _ _ = e (c • x) := by rw [← mul_assoc, nnnorm_inv, ENNReal.coe_inv, ENNReal.mul_inv_cancel _ ENNReal.coe_ne_top, one_mul] <;> simp [hc] #align enorm.map_smul ENorm.map_smul @[simp] theorem map_zero : e 0 = 0 := by rw [← zero_smul 𝕜 (0 : V), e.map_smul] norm_num #align enorm.map_zero ENorm.map_zero @[simp] theorem eq_zero_iff {x : V} : e x = 0 ↔ x = 0 := ⟨e.eq_zero' x, fun h => h.symm ▸ e.map_zero⟩ #align enorm.eq_zero_iff ENorm.eq_zero_iff @[simp] theorem map_neg (x : V) : e (-x) = e x := calc e (-x) = ‖(-1 : 𝕜)‖₊ * e x := by rw [← map_smul, neg_one_smul] _ = e x := by simp #align enorm.map_neg ENorm.map_neg
Mathlib/Analysis/NormedSpace/ENorm.lean
113
113
theorem map_sub_rev (x y : V) : e (x - y) = e (y - x) := by
rw [← neg_sub, e.map_neg]
1
import Mathlib.RepresentationTheory.Rep import Mathlib.Algebra.Category.FGModuleCat.Limits import Mathlib.CategoryTheory.Preadditive.Schur import Mathlib.RepresentationTheory.Basic #align_import representation_theory.fdRep from "leanprover-community/mathlib"@"19a70dceb9dff0994b92d2dd049de7d84d28112b" suppress_compilation universe u open CategoryTheory open CategoryTheory.Limits set_option linter.uppercaseLean3 false -- `FdRep` abbrev FdRep (k G : Type u) [Field k] [Monoid G] := Action (FGModuleCat.{u} k) (MonCat.of G) #align fdRep FdRep namespace FdRep variable {k G : Type u} [Field k] [Monoid G] -- Porting note: `@[derive]` didn't work for `FdRep`. Add the 4 instances here. instance : LargeCategory (FdRep k G) := inferInstance instance : ConcreteCategory (FdRep k G) := inferInstance instance : Preadditive (FdRep k G) := inferInstance instance : HasFiniteLimits (FdRep k G) := inferInstance instance : Linear k (FdRep k G) := by infer_instance instance : CoeSort (FdRep k G) (Type u) := ConcreteCategory.hasCoeToSort _ instance (V : FdRep k G) : AddCommGroup V := by change AddCommGroup ((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj; infer_instance instance (V : FdRep k G) : Module k V := by change Module k ((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj; infer_instance instance (V : FdRep k G) : FiniteDimensional k V := by change FiniteDimensional k ((forget₂ (FdRep k G) (FGModuleCat k)).obj V); infer_instance instance (V W : FdRep k G) : FiniteDimensional k (V ⟶ W) := FiniteDimensional.of_injective ((forget₂ (FdRep k G) (FGModuleCat k)).mapLinearMap k) (Functor.map_injective (forget₂ (FdRep k G) (FGModuleCat k))) def ρ (V : FdRep k G) : G →* V →ₗ[k] V := Action.ρ V #align fdRep.ρ FdRep.ρ def isoToLinearEquiv {V W : FdRep k G} (i : V ≅ W) : V ≃ₗ[k] W := FGModuleCat.isoToLinearEquiv ((Action.forget (FGModuleCat k) (MonCat.of G)).mapIso i) #align fdRep.iso_to_linear_equiv FdRep.isoToLinearEquiv theorem Iso.conj_ρ {V W : FdRep k G} (i : V ≅ W) (g : G) : W.ρ g = (FdRep.isoToLinearEquiv i).conj (V.ρ g) := by -- Porting note: Changed `rw` to `erw` erw [FdRep.isoToLinearEquiv, ← FGModuleCat.Iso.conj_eq_conj, Iso.conj_apply] rw [Iso.eq_inv_comp ((Action.forget (FGModuleCat k) (MonCat.of G)).mapIso i)] exact (i.hom.comm g).symm #align fdRep.iso.conj_ρ FdRep.Iso.conj_ρ @[simps ρ] def of {V : Type u} [AddCommGroup V] [Module k V] [FiniteDimensional k V] (ρ : Representation k G V) : FdRep k G := ⟨FGModuleCat.of k V, ρ⟩ #align fdRep.of FdRep.of instance : HasForget₂ (FdRep k G) (Rep k G) where forget₂ := (forget₂ (FGModuleCat k) (ModuleCat k)).mapAction (MonCat.of G)
Mathlib/RepresentationTheory/FdRep.lean
113
114
theorem forget₂_ρ (V : FdRep k G) : ((forget₂ (FdRep k G) (Rep k G)).obj V).ρ = V.ρ := by
ext g v; rfl
1
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat import Mathlib.RepresentationTheory.GroupCohomology.Basic import Mathlib.RepresentationTheory.Invariants universe v u noncomputable section open CategoryTheory Limits Representation variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G) namespace groupCohomology section IsMulCocycle section variable {G M : Type*} [Mul G] [CommGroup M] [SMul G M] def IsMulOneCocycle (f : G → M) : Prop := ∀ g h : G, f (g * h) = g • f h * f g def IsMulTwoCocycle (f : G × G → M) : Prop := ∀ g h j : G, f (g * h, j) * f (g, h) = g • (f (h, j)) * f (g, h * j) end section variable {G M : Type*} [Monoid G] [CommGroup M] [MulAction G M] theorem map_one_of_isMulOneCocycle {f : G → M} (hf : IsMulOneCocycle f) : f 1 = 1 := by simpa only [mul_one, one_smul, self_eq_mul_right] using hf 1 1 theorem map_one_fst_of_isMulTwoCocycle {f : G × G → M} (hf : IsMulTwoCocycle f) (g : G) : f (1, g) = f (1, 1) := by simpa only [one_smul, one_mul, mul_one, mul_right_inj] using (hf 1 1 g).symm
Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean
532
534
theorem map_one_snd_of_isMulTwoCocycle {f : G × G → M} (hf : IsMulTwoCocycle f) (g : G) : f (g, 1) = g • f (1, 1) := by
simpa only [mul_one, mul_left_inj] using hf g 1 1
1
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} @[simp] theorem reduceOption_cons_of_some (x : α) (l : List (Option α)) : reduceOption (some x :: l) = x :: l.reduceOption := by simp only [reduceOption, filterMap, id, eq_self_iff_true, and_self_iff] #align list.reduce_option_cons_of_some List.reduceOption_cons_of_some @[simp]
Mathlib/Data/List/ReduceOption.lean
25
26
theorem reduceOption_cons_of_none (l : List (Option α)) : reduceOption (none :: l) = l.reduceOption := by
simp only [reduceOption, filterMap, id]
1
import Mathlib.Analysis.RCLike.Lemmas import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.function.l2_space from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad" set_option linter.uppercaseLean3 false noncomputable section open TopologicalSpace MeasureTheory MeasureTheory.Lp Filter open scoped NNReal ENNReal MeasureTheory namespace MeasureTheory section variable {α F : Type*} {m : MeasurableSpace α} {μ : Measure α} [NormedAddCommGroup F] theorem Memℒp.integrable_sq {f : α → ℝ} (h : Memℒp f 2 μ) : Integrable (fun x => f x ^ 2) μ := by simpa [← memℒp_one_iff_integrable] using h.norm_rpow two_ne_zero ENNReal.two_ne_top #align measure_theory.mem_ℒp.integrable_sq MeasureTheory.Memℒp.integrable_sq theorem memℒp_two_iff_integrable_sq_norm {f : α → F} (hf : AEStronglyMeasurable f μ) : Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ := by rw [← memℒp_one_iff_integrable] convert (memℒp_norm_rpow_iff hf two_ne_zero ENNReal.two_ne_top).symm · simp · rw [div_eq_mul_inv, ENNReal.mul_inv_cancel two_ne_zero ENNReal.two_ne_top] #align measure_theory.mem_ℒp_two_iff_integrable_sq_norm MeasureTheory.memℒp_two_iff_integrable_sq_norm theorem memℒp_two_iff_integrable_sq {f : α → ℝ} (hf : AEStronglyMeasurable f μ) : Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ := by convert memℒp_two_iff_integrable_sq_norm hf using 3 simp #align measure_theory.mem_ℒp_two_iff_integrable_sq MeasureTheory.memℒp_two_iff_integrable_sq end section InnerProductSpace variable {α : Type*} {m : MeasurableSpace α} {p : ℝ≥0∞} {μ : Measure α} variable {E 𝕜 : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y theorem Memℒp.const_inner (c : E) {f : α → E} (hf : Memℒp f p μ) : Memℒp (fun a => ⟪c, f a⟫) p μ := hf.of_le_mul (AEStronglyMeasurable.inner aestronglyMeasurable_const hf.1) (eventually_of_forall fun _ => norm_inner_le_norm _ _) #align measure_theory.mem_ℒp.const_inner MeasureTheory.Memℒp.const_inner theorem Memℒp.inner_const {f : α → E} (hf : Memℒp f p μ) (c : E) : Memℒp (fun a => ⟪f a, c⟫) p μ := hf.of_le_mul (AEStronglyMeasurable.inner hf.1 aestronglyMeasurable_const) (eventually_of_forall fun x => by rw [mul_comm]; exact norm_inner_le_norm _ _) #align measure_theory.mem_ℒp.inner_const MeasureTheory.Memℒp.inner_const variable {f : α → E} theorem Integrable.const_inner (c : E) (hf : Integrable f μ) : Integrable (fun x => ⟪c, f x⟫) μ := by rw [← memℒp_one_iff_integrable] at hf ⊢; exact hf.const_inner c #align measure_theory.integrable.const_inner MeasureTheory.Integrable.const_inner theorem Integrable.inner_const (hf : Integrable f μ) (c : E) : Integrable (fun x => ⟪f x, c⟫) μ := by rw [← memℒp_one_iff_integrable] at hf ⊢; exact hf.inner_const c #align measure_theory.integrable.inner_const MeasureTheory.Integrable.inner_const variable [CompleteSpace E] [NormedSpace ℝ E] theorem _root_.integral_inner {f : α → E} (hf : Integrable f μ) (c : E) : ∫ x, ⟪c, f x⟫ ∂μ = ⟪c, ∫ x, f x ∂μ⟫ := ((innerSL 𝕜 c).restrictScalars ℝ).integral_comp_comm hf #align integral_inner integral_inner variable (𝕜) -- variable binder update doesn't work for lemmas which refer to `𝕜` only via the notation -- Porting note: removed because it causes ambiguity in the lemma below -- local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y
Mathlib/MeasureTheory/Function/L2Space.lean
104
106
theorem _root_.integral_eq_zero_of_forall_integral_inner_eq_zero (f : α → E) (hf : Integrable f μ) (hf_int : ∀ c : E, ∫ x, ⟪c, f x⟫ ∂μ = 0) : ∫ x, f x ∂μ = 0 := by
specialize hf_int (∫ x, f x ∂μ); rwa [integral_inner hf, inner_self_eq_zero] at hf_int
1
import Mathlib.Data.Fin.Fin2 import Mathlib.Data.PFun import Mathlib.Data.Vector3 import Mathlib.NumberTheory.PellMatiyasevic #align_import number_theory.dioph from "leanprover-community/mathlib"@"a66d07e27d5b5b8ac1147cacfe353478e5c14002" open Fin2 Function Nat Sum local infixr:67 " ::ₒ " => Option.elim' local infixr:65 " ⊗ " => Sum.elim universe u section Polynomials variable {α β γ : Type*} inductive IsPoly : ((α → ℕ) → ℤ) → Prop | proj : ∀ i, IsPoly fun x : α → ℕ => x i | const : ∀ n : ℤ, IsPoly fun _ : α → ℕ => n | sub : ∀ {f g : (α → ℕ) → ℤ}, IsPoly f → IsPoly g → IsPoly fun x => f x - g x | mul : ∀ {f g : (α → ℕ) → ℤ}, IsPoly f → IsPoly g → IsPoly fun x => f x * g x #align is_poly IsPoly
Mathlib/NumberTheory/Dioph.lean
85
86
theorem IsPoly.neg {f : (α → ℕ) → ℤ} : IsPoly f → IsPoly (-f) := by
rw [← zero_sub]; exact (IsPoly.const 0).sub
1
import Batteries.Tactic.Init import Batteries.Tactic.Alias import Batteries.Tactic.Lint.Misc instance {f : α → β} [DecidablePred p] : DecidablePred (p ∘ f) := inferInstanceAs <| DecidablePred fun x => p (f x) @[deprecated] alias proofIrrel := proof_irrel theorem Function.id_def : @id α = fun x => x := rfl alias ⟨forall_not_of_not_exists, not_exists_of_forall_not⟩ := not_exists protected alias ⟨Decidable.exists_not_of_not_forall, _⟩ := Decidable.not_forall theorem heq_iff_eq : HEq a b ↔ a = b := ⟨eq_of_heq, heq_of_eq⟩ @[simp] theorem eq_rec_constant {α : Sort _} {a a' : α} {β : Sort _} (y : β) (h : a = a') : (@Eq.rec α a (fun α _ => β) y a' h) = y := by cases h; rfl theorem congrArg₂ (f : α → β → γ) {x x' : α} {y y' : β} (hx : x = x') (hy : y = y') : f x y = f x' y' := by subst hx hy; rfl theorem congrFun₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : f = g) (a : α) (b : β a) : f a b = g a b := congrFun (congrFun h _) _ theorem congrFun₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : f = g) (a : α) (b : β a) (c : γ a b) : f a b c = g a b c := congrFun₂ (congrFun h _) _ _ theorem funext₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : ∀ a b, f a b = g a b) : f = g := funext fun _ => funext <| h _ theorem funext₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : ∀ a b c, f a b c = g a b c) : f = g := funext fun _ => funext₂ <| h _ theorem Function.funext_iff {β : α → Sort u} {f₁ f₂ : ∀ x : α, β x} : f₁ = f₂ ↔ ∀ a, f₁ a = f₂ a := ⟨congrFun, funext⟩ theorem ne_of_apply_ne {α β : Sort _} (f : α → β) {x y : α} : f x ≠ f y → x ≠ y := mt <| congrArg _ protected theorem Eq.congr (h₁ : x₁ = y₁) (h₂ : x₂ = y₂) : x₁ = x₂ ↔ y₁ = y₂ := by subst h₁; subst h₂; rfl
.lake/packages/batteries/Batteries/Logic.lean
72
72
theorem Eq.congr_left {x y z : α} (h : x = y) : x = z ↔ y = z := by
rw [h]
1
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Algebra.Order.Field.Defs import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Order.Bounds.OrderIso import Mathlib.Tactic.Positivity.Core #align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd" open Function OrderDual variable {ι α β : Type*} section LinearOrderedSemifield variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ} @[simps! (config := { simpRhs := true })] def OrderIso.mulLeft₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulLeft₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha } #align order_iso.mul_left₀ OrderIso.mulLeft₀ #align order_iso.mul_left₀_symm_apply OrderIso.mulLeft₀_symm_apply #align order_iso.mul_left₀_apply OrderIso.mulLeft₀_apply @[simps! (config := { simpRhs := true })] def OrderIso.mulRight₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulRight₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha } #align order_iso.mul_right₀ OrderIso.mulRight₀ #align order_iso.mul_right₀_symm_apply OrderIso.mulRight₀_symm_apply #align order_iso.mul_right₀_apply OrderIso.mulRight₀_apply theorem le_div_iff (hc : 0 < c) : a ≤ b / c ↔ a * c ≤ b := ⟨fun h => div_mul_cancel₀ b (ne_of_lt hc).symm ▸ mul_le_mul_of_nonneg_right h hc.le, fun h => calc a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm _ ≤ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le _ = b / c := (div_eq_mul_one_div b c).symm ⟩ #align le_div_iff le_div_iff theorem le_div_iff' (hc : 0 < c) : a ≤ b / c ↔ c * a ≤ b := by rw [mul_comm, le_div_iff hc] #align le_div_iff' le_div_iff' theorem div_le_iff (hb : 0 < b) : a / b ≤ c ↔ a ≤ c * b := ⟨fun h => calc a = a / b * b := by rw [div_mul_cancel₀ _ (ne_of_lt hb).symm] _ ≤ c * b := mul_le_mul_of_nonneg_right h hb.le , fun h => calc a / b = a * (1 / b) := div_eq_mul_one_div a b _ ≤ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le _ = c * b / b := (div_eq_mul_one_div (c * b) b).symm _ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl ⟩ #align div_le_iff div_le_iff theorem div_le_iff' (hb : 0 < b) : a / b ≤ c ↔ a ≤ b * c := by rw [mul_comm, div_le_iff hb] #align div_le_iff' div_le_iff' lemma div_le_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b ≤ c ↔ a / c ≤ b := by rw [div_le_iff hb, div_le_iff' hc] theorem lt_div_iff (hc : 0 < c) : a < b / c ↔ a * c < b := lt_iff_lt_of_le_iff_le <| div_le_iff hc #align lt_div_iff lt_div_iff theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b := by rw [mul_comm, lt_div_iff hc] #align lt_div_iff' lt_div_iff' theorem div_lt_iff (hc : 0 < c) : b / c < a ↔ b < a * c := lt_iff_lt_of_le_iff_le (le_div_iff hc) #align div_lt_iff div_lt_iff theorem div_lt_iff' (hc : 0 < c) : b / c < a ↔ b < c * a := by rw [mul_comm, div_lt_iff hc] #align div_lt_iff' div_lt_iff' lemma div_lt_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b < c ↔ a / c < b := by rw [div_lt_iff hb, div_lt_iff' hc] theorem inv_mul_le_iff (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ b * c := by rw [inv_eq_one_div, mul_comm, ← div_eq_mul_one_div] exact div_le_iff' h #align inv_mul_le_iff inv_mul_le_iff
Mathlib/Algebra/Order/Field/Basic.lean
104
104
theorem inv_mul_le_iff' (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ c * b := by
rw [inv_mul_le_iff h, mul_comm]
1
import Mathlib.Data.Finsupp.Defs #align_import data.finsupp.ne_locus from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α M N P : Type*} namespace Finsupp variable [DecidableEq α] section NHasZero variable [DecidableEq N] [Zero N] (f g : α →₀ N) def neLocus (f g : α →₀ N) : Finset α := (f.support ∪ g.support).filter fun x => f x ≠ g x #align finsupp.ne_locus Finsupp.neLocus @[simp] theorem mem_neLocus {f g : α →₀ N} {a : α} : a ∈ f.neLocus g ↔ f a ≠ g a := by simpa only [neLocus, Finset.mem_filter, Finset.mem_union, mem_support_iff, and_iff_right_iff_imp] using Ne.ne_or_ne _ #align finsupp.mem_ne_locus Finsupp.mem_neLocus theorem not_mem_neLocus {f g : α →₀ N} {a : α} : a ∉ f.neLocus g ↔ f a = g a := mem_neLocus.not.trans not_ne_iff #align finsupp.not_mem_ne_locus Finsupp.not_mem_neLocus @[simp] theorem coe_neLocus : ↑(f.neLocus g) = { x | f x ≠ g x } := by ext exact mem_neLocus #align finsupp.coe_ne_locus Finsupp.coe_neLocus @[simp] theorem neLocus_eq_empty {f g : α →₀ N} : f.neLocus g = ∅ ↔ f = g := ⟨fun h => ext fun a => not_not.mp (mem_neLocus.not.mp (Finset.eq_empty_iff_forall_not_mem.mp h a)), fun h => h ▸ by simp only [neLocus, Ne, eq_self_iff_true, not_true, Finset.filter_False]⟩ #align finsupp.ne_locus_eq_empty Finsupp.neLocus_eq_empty @[simp] theorem nonempty_neLocus_iff {f g : α →₀ N} : (f.neLocus g).Nonempty ↔ f ≠ g := Finset.nonempty_iff_ne_empty.trans neLocus_eq_empty.not #align finsupp.nonempty_ne_locus_iff Finsupp.nonempty_neLocus_iff
Mathlib/Data/Finsupp/NeLocus.lean
69
70
theorem neLocus_comm : f.neLocus g = g.neLocus f := by
simp_rw [neLocus, Finset.union_comm, ne_comm]
1
import Mathlib.Data.Stream.Defs import Mathlib.Logic.Function.Basic import Mathlib.Init.Data.List.Basic import Mathlib.Data.List.Basic #align_import data.stream.init from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" set_option autoImplicit true open Nat Function Option namespace Stream' variable {α : Type u} {β : Type v} {δ : Type w} instance [Inhabited α] : Inhabited (Stream' α) := ⟨Stream'.const default⟩ protected theorem eta (s : Stream' α) : (head s::tail s) = s := funext fun i => by cases i <;> rfl #align stream.eta Stream'.eta @[ext] protected theorem ext {s₁ s₂ : Stream' α} : (∀ n, get s₁ n = get s₂ n) → s₁ = s₂ := fun h => funext h #align stream.ext Stream'.ext @[simp] theorem get_zero_cons (a : α) (s : Stream' α) : get (a::s) 0 = a := rfl #align stream.nth_zero_cons Stream'.get_zero_cons @[simp] theorem head_cons (a : α) (s : Stream' α) : head (a::s) = a := rfl #align stream.head_cons Stream'.head_cons @[simp] theorem tail_cons (a : α) (s : Stream' α) : tail (a::s) = s := rfl #align stream.tail_cons Stream'.tail_cons @[simp] theorem get_drop (n m : Nat) (s : Stream' α) : get (drop m s) n = get s (n + m) := rfl #align stream.nth_drop Stream'.get_drop theorem tail_eq_drop (s : Stream' α) : tail s = drop 1 s := rfl #align stream.tail_eq_drop Stream'.tail_eq_drop @[simp] theorem drop_drop (n m : Nat) (s : Stream' α) : drop n (drop m s) = drop (n + m) s := by ext; simp [Nat.add_assoc] #align stream.drop_drop Stream'.drop_drop @[simp] theorem get_tail {s : Stream' α} : s.tail.get n = s.get (n + 1) := rfl @[simp] theorem tail_drop' {s : Stream' α} : tail (drop i s) = s.drop (i+1) := by ext; simp [Nat.add_comm, Nat.add_assoc, Nat.add_left_comm] @[simp] theorem drop_tail' {s : Stream' α} : drop i (tail s) = s.drop (i+1) := rfl theorem tail_drop (n : Nat) (s : Stream' α) : tail (drop n s) = drop n (tail s) := by simp #align stream.tail_drop Stream'.tail_drop theorem get_succ (n : Nat) (s : Stream' α) : get s (succ n) = get (tail s) n := rfl #align stream.nth_succ Stream'.get_succ @[simp] theorem get_succ_cons (n : Nat) (s : Stream' α) (x : α) : get (x::s) n.succ = get s n := rfl #align stream.nth_succ_cons Stream'.get_succ_cons @[simp] theorem drop_zero {s : Stream' α} : s.drop 0 = s := rfl theorem drop_succ (n : Nat) (s : Stream' α) : drop (succ n) s = drop n (tail s) := rfl #align stream.drop_succ Stream'.drop_succ theorem head_drop (a : Stream' α) (n : ℕ) : (a.drop n).head = a.get n := by simp #align stream.head_drop Stream'.head_drop theorem cons_injective2 : Function.Injective2 (cons : α → Stream' α → Stream' α) := fun x y s t h => ⟨by rw [← get_zero_cons x s, h, get_zero_cons], Stream'.ext fun n => by rw [← get_succ_cons n _ x, h, get_succ_cons]⟩ #align stream.cons_injective2 Stream'.cons_injective2 theorem cons_injective_left (s : Stream' α) : Function.Injective fun x => cons x s := cons_injective2.left _ #align stream.cons_injective_left Stream'.cons_injective_left theorem cons_injective_right (x : α) : Function.Injective (cons x) := cons_injective2.right _ #align stream.cons_injective_right Stream'.cons_injective_right theorem all_def (p : α → Prop) (s : Stream' α) : All p s = ∀ n, p (get s n) := rfl #align stream.all_def Stream'.all_def theorem any_def (p : α → Prop) (s : Stream' α) : Any p s = ∃ n, p (get s n) := rfl #align stream.any_def Stream'.any_def @[simp] theorem mem_cons (a : α) (s : Stream' α) : a ∈ a::s := Exists.intro 0 rfl #align stream.mem_cons Stream'.mem_cons theorem mem_cons_of_mem {a : α} {s : Stream' α} (b : α) : a ∈ s → a ∈ b::s := fun ⟨n, h⟩ => Exists.intro (succ n) (by rw [get_succ, tail_cons, h]) #align stream.mem_cons_of_mem Stream'.mem_cons_of_mem theorem eq_or_mem_of_mem_cons {a b : α} {s : Stream' α} : (a ∈ b::s) → a = b ∨ a ∈ s := fun ⟨n, h⟩ => by cases' n with n' · left exact h · right rw [get_succ, tail_cons] at h exact ⟨n', h⟩ #align stream.eq_or_mem_of_mem_cons Stream'.eq_or_mem_of_mem_cons theorem mem_of_get_eq {n : Nat} {s : Stream' α} {a : α} : a = get s n → a ∈ s := fun h => Exists.intro n h #align stream.mem_of_nth_eq Stream'.mem_of_get_eq section Map variable (f : α → β) theorem drop_map (n : Nat) (s : Stream' α) : drop n (map f s) = map f (drop n s) := Stream'.ext fun _ => rfl #align stream.drop_map Stream'.drop_map @[simp] theorem get_map (n : Nat) (s : Stream' α) : get (map f s) n = f (get s n) := rfl #align stream.nth_map Stream'.get_map theorem tail_map (s : Stream' α) : tail (map f s) = map f (tail s) := rfl #align stream.tail_map Stream'.tail_map @[simp] theorem head_map (s : Stream' α) : head (map f s) = f (head s) := rfl #align stream.head_map Stream'.head_map
Mathlib/Data/Stream/Init.lean
162
163
theorem map_eq (s : Stream' α) : map f s = f (head s)::map f (tail s) := by
rw [← Stream'.eta (map f s), tail_map, head_map]
1
import Mathlib.Algebra.Order.Group.Defs import Mathlib.Algebra.Order.Monoid.WithTop #align_import algebra.order.group.with_top from "leanprover-community/mathlib"@"f178c0e25af359f6cbc72a96a243efd3b12423a3" namespace WithTop variable {α : Type*} namespace LinearOrderedAddCommGroup variable [LinearOrderedAddCommGroup α] {a b c d : α} instance instNeg : Neg (WithTop α) where neg := Option.map fun a : α => -a protected def sub : ∀ _ _ : WithTop α, WithTop α | _, ⊤ => ⊤ | ⊤, (x : α) => ⊤ | (x : α), (y : α) => (x - y : α) instance instSub : Sub (WithTop α) where sub := WithTop.LinearOrderedAddCommGroup.sub @[simp, norm_cast] theorem coe_neg (a : α) : ((-a : α) : WithTop α) = -a := rfl #align with_top.coe_neg WithTop.LinearOrderedAddCommGroup.coe_neg @[simp] theorem neg_top : -(⊤ : WithTop α) = ⊤ := rfl @[simp, norm_cast] theorem coe_sub {a b : α} : (↑(a - b) : WithTop α) = ↑a - ↑b := rfl @[simp]
Mathlib/Algebra/Order/Group/WithTop.lean
61
62
theorem top_sub {a : WithTop α} : (⊤ : WithTop α) - a = ⊤ := by
cases a <;> rfl
1
import Batteries.Tactic.Lint.Basic import Mathlib.Algebra.Order.Monoid.Unbundled.Basic import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Order import Mathlib.Init.Data.Int.Order set_option autoImplicit true namespace Linarith theorem lt_irrefl {α : Type u} [Preorder α] {a : α} : ¬a < a := _root_.lt_irrefl a theorem eq_of_eq_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b = 0) : a + b = 0 := by simp [*]
Mathlib/Tactic/Linarith/Lemmas.lean
30
31
theorem le_of_eq_of_le {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b ≤ 0) : a + b ≤ 0 := by
simp [*]
1
import Mathlib.Topology.MetricSpace.Basic #align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b" variable {α β : Type*} namespace Set section Einfsep open ENNReal open Function noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ := ⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y #align set.einfsep Set.einfsep section EDist variable [EDist α] {x y : α} {s t : Set α} theorem le_einfsep_iff {d} : d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by simp_rw [einfsep, le_iInf_iff] #align set.le_einfsep_iff Set.le_einfsep_iff theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop] #align set.einfsep_zero Set.einfsep_zero theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by rw [pos_iff_ne_zero, Ne, einfsep_zero] simp only [not_forall, not_exists, not_lt, exists_prop, not_and] #align set.einfsep_pos Set.einfsep_pos theorem einfsep_top : s.einfsep = ∞ ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → edist x y = ∞ := by simp_rw [einfsep, iInf_eq_top] #align set.einfsep_top Set.einfsep_top theorem einfsep_lt_top : s.einfsep < ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < ∞ := by simp_rw [einfsep, iInf_lt_iff, exists_prop] #align set.einfsep_lt_top Set.einfsep_lt_top theorem einfsep_ne_top : s.einfsep ≠ ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y ≠ ∞ := by simp_rw [← lt_top_iff_ne_top, einfsep_lt_top] #align set.einfsep_ne_top Set.einfsep_ne_top theorem einfsep_lt_iff {d} : s.einfsep < d ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < d := by simp_rw [einfsep, iInf_lt_iff, exists_prop] #align set.einfsep_lt_iff Set.einfsep_lt_iff theorem nontrivial_of_einfsep_lt_top (hs : s.einfsep < ∞) : s.Nontrivial := by rcases einfsep_lt_top.1 hs with ⟨_, hx, _, hy, hxy, _⟩ exact ⟨_, hx, _, hy, hxy⟩ #align set.nontrivial_of_einfsep_lt_top Set.nontrivial_of_einfsep_lt_top theorem nontrivial_of_einfsep_ne_top (hs : s.einfsep ≠ ∞) : s.Nontrivial := nontrivial_of_einfsep_lt_top (lt_top_iff_ne_top.mpr hs) #align set.nontrivial_of_einfsep_ne_top Set.nontrivial_of_einfsep_ne_top theorem Subsingleton.einfsep (hs : s.Subsingleton) : s.einfsep = ∞ := by rw [einfsep_top] exact fun _ hx _ hy hxy => (hxy <| hs hx hy).elim #align set.subsingleton.einfsep Set.Subsingleton.einfsep
Mathlib/Topology/MetricSpace/Infsep.lean
98
100
theorem le_einfsep_image_iff {d} {f : β → α} {s : Set β} : d ≤ einfsep (f '' s) ↔ ∀ x ∈ s, ∀ y ∈ s, f x ≠ f y → d ≤ edist (f x) (f y) := by
simp_rw [le_einfsep_iff, forall_mem_image]
1
import Mathlib.LinearAlgebra.Dimension.Constructions import Mathlib.LinearAlgebra.Dimension.Finite universe u v open Function Set Cardinal variable {R} {M M₁ M₂ M₃ : Type u} {M' : Type v} [Ring R] variable [AddCommGroup M] [AddCommGroup M₁] [AddCommGroup M₂] [AddCommGroup M₃] [AddCommGroup M'] variable [Module R M] [Module R M₁] [Module R M₂] [Module R M₃] [Module R M'] @[pp_with_univ] class HasRankNullity (R : Type v) [inst : Ring R] : Prop where exists_set_linearIndependent : ∀ (M : Type u) [AddCommGroup M] [Module R M], ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val rank_quotient_add_rank : ∀ {M : Type u} [AddCommGroup M] [Module R M] (N : Submodule R M), Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M variable [HasRankNullity.{u} R] lemma rank_quotient_add_rank (N : Submodule R M) : Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M := HasRankNullity.rank_quotient_add_rank N #align rank_quotient_add_rank rank_quotient_add_rank variable (R M) in lemma exists_set_linearIndependent : ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val := HasRankNullity.exists_set_linearIndependent M variable (R) in instance (priority := 100) : Nontrivial R := by refine (subsingleton_or_nontrivial R).resolve_left fun H ↦ ?_ have := rank_quotient_add_rank (R := R) (M := PUnit) ⊥ simp [one_add_one_eq_two] at this theorem lift_rank_range_add_rank_ker (f : M →ₗ[R] M') : lift.{u} (Module.rank R (LinearMap.range f)) + lift.{v} (Module.rank R (LinearMap.ker f)) = lift.{v} (Module.rank R M) := by haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p) rw [← f.quotKerEquivRange.lift_rank_eq, ← lift_add, rank_quotient_add_rank] theorem rank_range_add_rank_ker (f : M →ₗ[R] M₁) : Module.rank R (LinearMap.range f) + Module.rank R (LinearMap.ker f) = Module.rank R M := by haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p) rw [← f.quotKerEquivRange.rank_eq, rank_quotient_add_rank] #align rank_range_add_rank_ker rank_range_add_rank_ker theorem lift_rank_eq_of_surjective {f : M →ₗ[R] M'} (h : Surjective f) : lift.{v} (Module.rank R M) = lift.{u} (Module.rank R M') + lift.{v} (Module.rank R (LinearMap.ker f)) := by rw [← lift_rank_range_add_rank_ker f, ← rank_range_of_surjective f h]
Mathlib/LinearAlgebra/Dimension/RankNullity.lean
86
88
theorem rank_eq_of_surjective {f : M →ₗ[R] M₁} (h : Surjective f) : Module.rank R M = Module.rank R M₁ + Module.rank R (LinearMap.ker f) := by
rw [← rank_range_add_rank_ker f, ← rank_range_of_surjective f h]
1
import Mathlib.Analysis.Convex.Between import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import geometry.euclidean.angle.unoriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open Real RealInnerProductSpace namespace EuclideanGeometry open InnerProductGeometry variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] {p p₀ p₁ p₂ : P} nonrec def angle (p1 p2 p3 : P) : ℝ := angle (p1 -ᵥ p2 : V) (p3 -ᵥ p2) #align euclidean_geometry.angle EuclideanGeometry.angle @[inherit_doc] scoped notation "∠" => EuclideanGeometry.angle theorem continuousAt_angle {x : P × P × P} (hx12 : x.1 ≠ x.2.1) (hx32 : x.2.2 ≠ x.2.1) : ContinuousAt (fun y : P × P × P => ∠ y.1 y.2.1 y.2.2) x := by let f : P × P × P → V × V := fun y => (y.1 -ᵥ y.2.1, y.2.2 -ᵥ y.2.1) have hf1 : (f x).1 ≠ 0 := by simp [hx12] have hf2 : (f x).2 ≠ 0 := by simp [hx32] exact (InnerProductGeometry.continuousAt_angle hf1 hf2).comp ((continuous_fst.vsub continuous_snd.fst).prod_mk (continuous_snd.snd.vsub continuous_snd.fst)).continuousAt #align euclidean_geometry.continuous_at_angle EuclideanGeometry.continuousAt_angle @[simp] theorem _root_.AffineIsometry.angle_map {V₂ P₂ : Type*} [NormedAddCommGroup V₂] [InnerProductSpace ℝ V₂] [MetricSpace P₂] [NormedAddTorsor V₂ P₂] (f : P →ᵃⁱ[ℝ] P₂) (p₁ p₂ p₃ : P) : ∠ (f p₁) (f p₂) (f p₃) = ∠ p₁ p₂ p₃ := by simp_rw [angle, ← AffineIsometry.map_vsub, LinearIsometry.angle_map] #align affine_isometry.angle_map AffineIsometry.angle_map @[simp, norm_cast] theorem _root_.AffineSubspace.angle_coe {s : AffineSubspace ℝ P} (p₁ p₂ p₃ : s) : haveI : Nonempty s := ⟨p₁⟩ ∠ (p₁ : P) (p₂ : P) (p₃ : P) = ∠ p₁ p₂ p₃ := haveI : Nonempty s := ⟨p₁⟩ s.subtypeₐᵢ.angle_map p₁ p₂ p₃ #align affine_subspace.angle_coe AffineSubspace.angle_coe @[simp] theorem angle_const_vadd (v : V) (p₁ p₂ p₃ : P) : ∠ (v +ᵥ p₁) (v +ᵥ p₂) (v +ᵥ p₃) = ∠ p₁ p₂ p₃ := (AffineIsometryEquiv.constVAdd ℝ P v).toAffineIsometry.angle_map _ _ _ #align euclidean_geometry.angle_const_vadd EuclideanGeometry.angle_const_vadd @[simp] theorem angle_vadd_const (v₁ v₂ v₃ : V) (p : P) : ∠ (v₁ +ᵥ p) (v₂ +ᵥ p) (v₃ +ᵥ p) = ∠ v₁ v₂ v₃ := (AffineIsometryEquiv.vaddConst ℝ p).toAffineIsometry.angle_map _ _ _ #align euclidean_geometry.angle_vadd_const EuclideanGeometry.angle_vadd_const @[simp] theorem angle_const_vsub (p p₁ p₂ p₃ : P) : ∠ (p -ᵥ p₁) (p -ᵥ p₂) (p -ᵥ p₃) = ∠ p₁ p₂ p₃ := (AffineIsometryEquiv.constVSub ℝ p).toAffineIsometry.angle_map _ _ _ #align euclidean_geometry.angle_const_vsub EuclideanGeometry.angle_const_vsub @[simp] theorem angle_vsub_const (p₁ p₂ p₃ p : P) : ∠ (p₁ -ᵥ p) (p₂ -ᵥ p) (p₃ -ᵥ p) = ∠ p₁ p₂ p₃ := (AffineIsometryEquiv.vaddConst ℝ p).symm.toAffineIsometry.angle_map _ _ _ #align euclidean_geometry.angle_vsub_const EuclideanGeometry.angle_vsub_const @[simp] theorem angle_add_const (v₁ v₂ v₃ : V) (v : V) : ∠ (v₁ + v) (v₂ + v) (v₃ + v) = ∠ v₁ v₂ v₃ := angle_vadd_const _ _ _ _ #align euclidean_geometry.angle_add_const EuclideanGeometry.angle_add_const @[simp] theorem angle_const_add (v : V) (v₁ v₂ v₃ : V) : ∠ (v + v₁) (v + v₂) (v + v₃) = ∠ v₁ v₂ v₃ := angle_const_vadd _ _ _ _ #align euclidean_geometry.angle_const_add EuclideanGeometry.angle_const_add @[simp] theorem angle_sub_const (v₁ v₂ v₃ : V) (v : V) : ∠ (v₁ - v) (v₂ - v) (v₃ - v) = ∠ v₁ v₂ v₃ := by simpa only [vsub_eq_sub] using angle_vsub_const v₁ v₂ v₃ v #align euclidean_geometry.angle_sub_const EuclideanGeometry.angle_sub_const @[simp] theorem angle_const_sub (v : V) (v₁ v₂ v₃ : V) : ∠ (v - v₁) (v - v₂) (v - v₃) = ∠ v₁ v₂ v₃ := by simpa only [vsub_eq_sub] using angle_const_vsub v v₁ v₂ v₃ #align euclidean_geometry.angle_const_sub EuclideanGeometry.angle_const_sub @[simp]
Mathlib/Geometry/Euclidean/Angle/Unoriented/Affine.lean
125
126
theorem angle_neg (v₁ v₂ v₃ : V) : ∠ (-v₁) (-v₂) (-v₃) = ∠ v₁ v₂ v₃ := by
simpa only [zero_sub] using angle_const_sub 0 v₁ v₂ v₃
1
import Mathlib.Algebra.GCDMonoid.Basic import Mathlib.Algebra.Order.Ring.Int import Mathlib.Data.Int.GCD instance : GCDMonoid ℕ where gcd := Nat.gcd lcm := Nat.lcm gcd_dvd_left := Nat.gcd_dvd_left gcd_dvd_right := Nat.gcd_dvd_right dvd_gcd := Nat.dvd_gcd gcd_mul_lcm a b := by rw [Nat.gcd_mul_lcm]; rfl lcm_zero_left := Nat.lcm_zero_left lcm_zero_right := Nat.lcm_zero_right theorem gcd_eq_nat_gcd (m n : ℕ) : gcd m n = Nat.gcd m n := rfl #align gcd_eq_nat_gcd gcd_eq_nat_gcd theorem lcm_eq_nat_lcm (m n : ℕ) : lcm m n = Nat.lcm m n := rfl #align lcm_eq_nat_lcm lcm_eq_nat_lcm instance : NormalizedGCDMonoid ℕ := { (inferInstance : GCDMonoid ℕ), (inferInstance : NormalizationMonoid ℕ) with normalize_gcd := fun _ _ => normalize_eq _ normalize_lcm := fun _ _ => normalize_eq _ } namespace Int section NormalizationMonoid instance normalizationMonoid : NormalizationMonoid ℤ where normUnit a := if 0 ≤ a then 1 else -1 normUnit_zero := if_pos le_rfl normUnit_mul {a b} hna hnb := by cases' hna.lt_or_lt with ha ha <;> cases' hnb.lt_or_lt with hb hb <;> simp [mul_nonneg_iff, ha.le, ha.not_le, hb.le, hb.not_le] normUnit_coe_units u := (units_eq_one_or u).elim (fun eq => eq.symm ▸ if_pos zero_le_one) fun eq => eq.symm ▸ if_neg (not_le_of_gt <| show (-1 : ℤ) < 0 by decide) -- Porting note: added theorem normUnit_eq (z : ℤ) : normUnit z = if 0 ≤ z then 1 else -1 := rfl theorem normalize_of_nonneg {z : ℤ} (h : 0 ≤ z) : normalize z = z := by rw [normalize_apply, normUnit_eq, if_pos h, Units.val_one, mul_one] #align int.normalize_of_nonneg Int.normalize_of_nonneg theorem normalize_of_nonpos {z : ℤ} (h : z ≤ 0) : normalize z = -z := by obtain rfl | h := h.eq_or_lt · simp · rw [normalize_apply, normUnit_eq, if_neg (not_le_of_gt h), Units.val_neg, Units.val_one, mul_neg_one] #align int.normalize_of_nonpos Int.normalize_of_nonpos theorem normalize_coe_nat (n : ℕ) : normalize (n : ℤ) = n := normalize_of_nonneg (ofNat_le_ofNat_of_le <| Nat.zero_le n) #align int.normalize_coe_nat Int.normalize_coe_nat
Mathlib/Algebra/GCDMonoid/Nat.lean
82
83
theorem abs_eq_normalize (z : ℤ) : |z| = normalize z := by
cases le_total 0 z <;> simp [-normalize_apply, normalize_of_nonneg, normalize_of_nonpos, *]
1
import Mathlib.Data.List.Lattice import Mathlib.Data.List.Range import Mathlib.Data.Bool.Basic #align_import data.list.intervals from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213" open Nat namespace List def Ico (n m : ℕ) : List ℕ := range' n (m - n) #align list.Ico List.Ico namespace Ico theorem zero_bot (n : ℕ) : Ico 0 n = range n := by rw [Ico, Nat.sub_zero, range_eq_range'] #align list.Ico.zero_bot List.Ico.zero_bot @[simp] theorem length (n m : ℕ) : length (Ico n m) = m - n := by dsimp [Ico] simp [length_range', autoParam] #align list.Ico.length List.Ico.length theorem pairwise_lt (n m : ℕ) : Pairwise (· < ·) (Ico n m) := by dsimp [Ico] simp [pairwise_lt_range', autoParam] #align list.Ico.pairwise_lt List.Ico.pairwise_lt theorem nodup (n m : ℕ) : Nodup (Ico n m) := by dsimp [Ico] simp [nodup_range', autoParam] #align list.Ico.nodup List.Ico.nodup @[simp] theorem mem {n m l : ℕ} : l ∈ Ico n m ↔ n ≤ l ∧ l < m := by suffices n ≤ l ∧ l < n + (m - n) ↔ n ≤ l ∧ l < m by simp [Ico, this] rcases le_total n m with hnm | hmn · rw [Nat.add_sub_cancel' hnm] · rw [Nat.sub_eq_zero_iff_le.mpr hmn, Nat.add_zero] exact and_congr_right fun hnl => Iff.intro (fun hln => (not_le_of_gt hln hnl).elim) fun hlm => lt_of_lt_of_le hlm hmn #align list.Ico.mem List.Ico.mem theorem eq_nil_of_le {n m : ℕ} (h : m ≤ n) : Ico n m = [] := by simp [Ico, Nat.sub_eq_zero_iff_le.mpr h] #align list.Ico.eq_nil_of_le List.Ico.eq_nil_of_le
Mathlib/Data/List/Intervals.lean
76
77
theorem map_add (n m k : ℕ) : (Ico n m).map (k + ·) = Ico (n + k) (m + k) := by
rw [Ico, Ico, map_add_range', Nat.add_sub_add_right m k, Nat.add_comm n k]
1
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.Adjugate import Mathlib.LinearAlgebra.FiniteDimensional #align_import linear_algebra.matrix.nonsingular_inverse from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422" namespace Matrix universe u u' v variable {l : Type*} {m : Type u} {n : Type u'} {α : Type v} open Matrix Equiv Equiv.Perm Finset section Inv variable [Fintype n] [DecidableEq n] [CommRing α] variable (A : Matrix n n α) (B : Matrix n n α) theorem isUnit_det_transpose (h : IsUnit A.det) : IsUnit Aᵀ.det := by rw [det_transpose] exact h #align matrix.is_unit_det_transpose Matrix.isUnit_det_transpose noncomputable instance inv : Inv (Matrix n n α) := ⟨fun A => Ring.inverse A.det • A.adjugate⟩ theorem inv_def (A : Matrix n n α) : A⁻¹ = Ring.inverse A.det • A.adjugate := rfl #align matrix.inv_def Matrix.inv_def theorem nonsing_inv_apply_not_isUnit (h : ¬IsUnit A.det) : A⁻¹ = 0 := by rw [inv_def, Ring.inverse_non_unit _ h, zero_smul] #align matrix.nonsing_inv_apply_not_is_unit Matrix.nonsing_inv_apply_not_isUnit
Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean
225
226
theorem nonsing_inv_apply (h : IsUnit A.det) : A⁻¹ = (↑h.unit⁻¹ : α) • A.adjugate := by
rw [inv_def, ← Ring.inverse_unit h.unit, IsUnit.unit_spec]
1
import Mathlib.Geometry.Manifold.MFDeriv.FDeriv noncomputable section open scoped Manifold open Bundle Set Topology section SpecificFunctions 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'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M''] variable {s : Set M} {x : M} section id theorem hasMFDerivAt_id (x : M) : HasMFDerivAt I I (@id M) x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) := by refine ⟨continuousAt_id, ?_⟩ have : ∀ᶠ y in 𝓝[range I] (extChartAt I x) x, (extChartAt I x ∘ (extChartAt I x).symm) y = y := by apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin I x) mfld_set_tac apply HasFDerivWithinAt.congr_of_eventuallyEq (hasFDerivWithinAt_id _ _) this simp only [mfld_simps] #align has_mfderiv_at_id hasMFDerivAt_id theorem hasMFDerivWithinAt_id (s : Set M) (x : M) : HasMFDerivWithinAt I I (@id M) s x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) := (hasMFDerivAt_id I x).hasMFDerivWithinAt #align has_mfderiv_within_at_id hasMFDerivWithinAt_id theorem mdifferentiableAt_id : MDifferentiableAt I I (@id M) x := (hasMFDerivAt_id I x).mdifferentiableAt #align mdifferentiable_at_id mdifferentiableAt_id theorem mdifferentiableWithinAt_id : MDifferentiableWithinAt I I (@id M) s x := (mdifferentiableAt_id I).mdifferentiableWithinAt #align mdifferentiable_within_at_id mdifferentiableWithinAt_id theorem mdifferentiable_id : MDifferentiable I I (@id M) := fun _ => mdifferentiableAt_id I #align mdifferentiable_id mdifferentiable_id theorem mdifferentiableOn_id : MDifferentiableOn I I (@id M) s := (mdifferentiable_id I).mdifferentiableOn #align mdifferentiable_on_id mdifferentiableOn_id @[simp, mfld_simps] theorem mfderiv_id : mfderiv I I (@id M) x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) := HasMFDerivAt.mfderiv (hasMFDerivAt_id I x) #align mfderiv_id mfderiv_id theorem mfderivWithin_id (hxs : UniqueMDiffWithinAt I s x) : mfderivWithin I I (@id M) s x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) := by rw [MDifferentiable.mfderivWithin (mdifferentiableAt_id I) hxs] exact mfderiv_id I #align mfderiv_within_id mfderivWithin_id @[simp, mfld_simps]
Mathlib/Geometry/Manifold/MFDeriv/SpecificFunctions.lean
164
164
theorem tangentMap_id : tangentMap I I (id : M → M) = id := by
ext1 ⟨x, v⟩; simp [tangentMap]
1
import Mathlib.Order.Filter.Partial import Mathlib.Topology.Basic #align_import topology.partial from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter open Topology variable {X Y : Type*} [TopologicalSpace X] theorem rtendsto_nhds {r : Rel Y X} {l : Filter Y} {x : X} : RTendsto r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.core s ∈ l := all_mem_nhds_filter _ _ (fun _s _t => id) _ #align rtendsto_nhds rtendsto_nhds theorem rtendsto'_nhds {r : Rel Y X} {l : Filter Y} {x : X} : RTendsto' r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.preimage s ∈ l := by rw [rtendsto'_def] apply all_mem_nhds_filter apply Rel.preimage_mono #align rtendsto'_nhds rtendsto'_nhds theorem ptendsto_nhds {f : Y →. X} {l : Filter Y} {x : X} : PTendsto f l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → f.core s ∈ l := rtendsto_nhds #align ptendsto_nhds ptendsto_nhds theorem ptendsto'_nhds {f : Y →. X} {l : Filter Y} {x : X} : PTendsto' f l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → f.preimage s ∈ l := rtendsto'_nhds #align ptendsto'_nhds ptendsto'_nhds variable [TopologicalSpace Y] def PContinuous (f : X →. Y) := ∀ s, IsOpen s → IsOpen (f.preimage s) #align pcontinuous PContinuous
Mathlib/Topology/Partial.lean
57
58
theorem open_dom_of_pcontinuous {f : X →. Y} (h : PContinuous f) : IsOpen f.Dom := by
rw [← PFun.preimage_univ]; exact h _ isOpen_univ
1
import Mathlib.Data.Multiset.Dedup #align_import data.multiset.finset_ops from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" namespace Multiset open List variable {α : Type*} [DecidableEq α] {s : Multiset α} def ndinsert (a : α) (s : Multiset α) : Multiset α := Quot.liftOn s (fun l => (l.insert a : Multiset α)) fun _ _ p => Quot.sound (p.insert a) #align multiset.ndinsert Multiset.ndinsert @[simp] theorem coe_ndinsert (a : α) (l : List α) : ndinsert a l = (insert a l : List α) := rfl #align multiset.coe_ndinsert Multiset.coe_ndinsert @[simp, nolint simpNF] -- Porting note (#10675): dsimp can not prove this theorem ndinsert_zero (a : α) : ndinsert a 0 = {a} := rfl #align multiset.ndinsert_zero Multiset.ndinsert_zero @[simp] theorem ndinsert_of_mem {a : α} {s : Multiset α} : a ∈ s → ndinsert a s = s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_mem h #align multiset.ndinsert_of_mem Multiset.ndinsert_of_mem @[simp] theorem ndinsert_of_not_mem {a : α} {s : Multiset α} : a ∉ s → ndinsert a s = a ::ₘ s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_not_mem h #align multiset.ndinsert_of_not_mem Multiset.ndinsert_of_not_mem @[simp] theorem mem_ndinsert {a b : α} {s : Multiset α} : a ∈ ndinsert b s ↔ a = b ∨ a ∈ s := Quot.inductionOn s fun _ => mem_insert_iff #align multiset.mem_ndinsert Multiset.mem_ndinsert @[simp] theorem le_ndinsert_self (a : α) (s : Multiset α) : s ≤ ndinsert a s := Quot.inductionOn s fun _ => (sublist_insert _ _).subperm #align multiset.le_ndinsert_self Multiset.le_ndinsert_self -- Porting note: removing @[simp], simp can prove it theorem mem_ndinsert_self (a : α) (s : Multiset α) : a ∈ ndinsert a s := mem_ndinsert.2 (Or.inl rfl) #align multiset.mem_ndinsert_self Multiset.mem_ndinsert_self theorem mem_ndinsert_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ ndinsert b s := mem_ndinsert.2 (Or.inr h) #align multiset.mem_ndinsert_of_mem Multiset.mem_ndinsert_of_mem @[simp]
Mathlib/Data/Multiset/FinsetOps.lean
74
75
theorem length_ndinsert_of_mem {a : α} {s : Multiset α} (h : a ∈ s) : card (ndinsert a s) = card s := by
simp [h]
1
import Mathlib.Algebra.Group.Defs import Mathlib.Algebra.GroupWithZero.Defs import Mathlib.Data.Int.Cast.Defs import Mathlib.Tactic.Spread import Mathlib.Util.AssertExists #align_import algebra.ring.defs from "leanprover-community/mathlib"@"76de8ae01554c3b37d66544866659ff174e66e1f" universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x} open Function class Distrib (R : Type*) extends Mul R, Add R where protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c #align distrib Distrib class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c #align left_distrib_class LeftDistribClass class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c #align right_distrib_class RightDistribClass -- see Note [lower instance priority] instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R := ⟨Distrib.left_distrib⟩ #align distrib.left_distrib_class Distrib.leftDistribClass -- see Note [lower instance priority] instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] : RightDistribClass R := ⟨Distrib.right_distrib⟩ #align distrib.right_distrib_class Distrib.rightDistribClass theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) : a * (b + c) = a * b + a * c := LeftDistribClass.left_distrib a b c #align left_distrib left_distrib alias mul_add := left_distrib #align mul_add mul_add theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) : (a + b) * c = a * c + b * c := RightDistribClass.right_distrib a b c #align right_distrib right_distrib alias add_mul := right_distrib #align add_mul add_mul
Mathlib/Algebra/Ring/Defs.lean
94
95
theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) : (a + b + c) * d = a * d + b * d + c * d := by
simp [right_distrib]
1
import Mathlib.Data.Complex.Module import Mathlib.Data.Complex.Order import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.RealVectorSpace #align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" assert_not_exists Absorbs noncomputable section namespace Complex variable {z : ℂ} open ComplexConjugate Topology Filter instance : Norm ℂ := ⟨abs⟩ @[simp] theorem norm_eq_abs (z : ℂ) : ‖z‖ = abs z := rfl #align complex.norm_eq_abs Complex.norm_eq_abs lemma norm_I : ‖I‖ = 1 := abs_I theorem norm_exp_ofReal_mul_I (t : ℝ) : ‖exp (t * I)‖ = 1 := by simp only [norm_eq_abs, abs_exp_ofReal_mul_I] set_option linter.uppercaseLean3 false in #align complex.norm_exp_of_real_mul_I Complex.norm_exp_ofReal_mul_I instance instNormedAddCommGroup : NormedAddCommGroup ℂ := AddGroupNorm.toNormedAddCommGroup { abs with map_zero' := map_zero abs neg' := abs.map_neg eq_zero_of_map_eq_zero' := fun _ => abs.eq_zero.1 } instance : NormedField ℂ where dist_eq _ _ := rfl norm_mul' := map_mul abs instance : DenselyNormedField ℂ where lt_norm_lt r₁ r₂ h₀ hr := let ⟨x, h⟩ := exists_between hr ⟨x, by rwa [norm_eq_abs, abs_ofReal, abs_of_pos (h₀.trans_lt h.1)]⟩ instance {R : Type*} [NormedField R] [NormedAlgebra R ℝ] : NormedAlgebra R ℂ where norm_smul_le r x := by rw [← algebraMap_smul ℝ r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, ← Real.norm_eq_abs, norm_algebraMap'] variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℂ E] -- see Note [lower instance priority] instance (priority := 900) _root_.NormedSpace.complexToReal : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ ℂ E #align normed_space.complex_to_real NormedSpace.complexToReal -- see Note [lower instance priority] instance (priority := 900) _root_.NormedAlgebra.complexToReal {A : Type*} [SeminormedRing A] [NormedAlgebra ℂ A] : NormedAlgebra ℝ A := NormedAlgebra.restrictScalars ℝ ℂ A theorem dist_eq (z w : ℂ) : dist z w = abs (z - w) := rfl #align complex.dist_eq Complex.dist_eq theorem dist_eq_re_im (z w : ℂ) : dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by rw [sq, sq] rfl #align complex.dist_eq_re_im Complex.dist_eq_re_im @[simp] theorem dist_mk (x₁ y₁ x₂ y₂ : ℝ) : dist (mk x₁ y₁) (mk x₂ y₂) = √((x₁ - x₂) ^ 2 + (y₁ - y₂) ^ 2) := dist_eq_re_im _ _ #align complex.dist_mk Complex.dist_mk theorem dist_of_re_eq {z w : ℂ} (h : z.re = w.re) : dist z w = dist z.im w.im := by rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq] #align complex.dist_of_re_eq Complex.dist_of_re_eq theorem nndist_of_re_eq {z w : ℂ} (h : z.re = w.re) : nndist z w = nndist z.im w.im := NNReal.eq <| dist_of_re_eq h #align complex.nndist_of_re_eq Complex.nndist_of_re_eq
Mathlib/Analysis/Complex/Basic.lean
121
122
theorem edist_of_re_eq {z w : ℂ} (h : z.re = w.re) : edist z w = edist z.im w.im := by
rw [edist_nndist, edist_nndist, nndist_of_re_eq h]
1
import Mathlib.Topology.MetricSpace.Basic #align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b" variable {α β : Type*} namespace Set section Einfsep open ENNReal open Function noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ := ⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y #align set.einfsep Set.einfsep section EDist variable [EDist α] {x y : α} {s t : Set α} theorem le_einfsep_iff {d} : d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by simp_rw [einfsep, le_iInf_iff] #align set.le_einfsep_iff Set.le_einfsep_iff theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop] #align set.einfsep_zero Set.einfsep_zero theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by rw [pos_iff_ne_zero, Ne, einfsep_zero] simp only [not_forall, not_exists, not_lt, exists_prop, not_and] #align set.einfsep_pos Set.einfsep_pos theorem einfsep_top : s.einfsep = ∞ ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → edist x y = ∞ := by simp_rw [einfsep, iInf_eq_top] #align set.einfsep_top Set.einfsep_top
Mathlib/Topology/MetricSpace/Infsep.lean
69
71
theorem einfsep_lt_top : s.einfsep < ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < ∞ := by
simp_rw [einfsep, iInf_lt_iff, exists_prop]
1
import Mathlib.Algebra.Group.Units.Equiv import Mathlib.CategoryTheory.Endomorphism #align_import category_theory.conj from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" universe v u namespace CategoryTheory namespace Iso variable {C : Type u} [Category.{v} C] def homCongr {X Y X₁ Y₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) : (X ⟶ Y) ≃ (X₁ ⟶ Y₁) where toFun f := α.inv ≫ f ≫ β.hom invFun f := α.hom ≫ f ≫ β.inv left_inv f := show α.hom ≫ (α.inv ≫ f ≫ β.hom) ≫ β.inv = f by rw [Category.assoc, Category.assoc, β.hom_inv_id, α.hom_inv_id_assoc, Category.comp_id] right_inv f := show α.inv ≫ (α.hom ≫ f ≫ β.inv) ≫ β.hom = f by rw [Category.assoc, Category.assoc, β.inv_hom_id, α.inv_hom_id_assoc, Category.comp_id] #align category_theory.iso.hom_congr CategoryTheory.Iso.homCongr -- @[simp, nolint simpNF] Porting note (#10675): dsimp can not prove this @[simp] theorem homCongr_apply {X Y X₁ Y₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) (f : X ⟶ Y) : α.homCongr β f = α.inv ≫ f ≫ β.hom := by rfl #align category_theory.iso.hom_congr_apply CategoryTheory.Iso.homCongr_apply theorem homCongr_comp {X Y Z X₁ Y₁ Z₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) (γ : Z ≅ Z₁) (f : X ⟶ Y) (g : Y ⟶ Z) : α.homCongr γ (f ≫ g) = α.homCongr β f ≫ β.homCongr γ g := by simp #align category_theory.iso.hom_congr_comp CategoryTheory.Iso.homCongr_comp
Mathlib/CategoryTheory/Conj.lean
60
60
theorem homCongr_refl {X Y : C} (f : X ⟶ Y) : (Iso.refl X).homCongr (Iso.refl Y) f = f := by
simp
1
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} #align list.length_enum_from List.enumFrom_length #align list.length_enum List.enum_length @[simp] theorem get?_enumFrom : ∀ n (l : List α) m, get? (enumFrom n l) m = (get? l m).map fun a => (n + m, a) | n, [], m => rfl | n, a :: l, 0 => rfl | n, a :: l, m + 1 => (get?_enumFrom (n + 1) l m).trans <| by rw [Nat.add_right_comm]; rfl #align list.enum_from_nth List.get?_enumFrom @[deprecated (since := "2024-04-06")] alias enumFrom_get? := get?_enumFrom @[simp] theorem get?_enum (l : List α) (n) : get? (enum l) n = (get? l n).map fun a => (n, a) := by rw [enum, get?_enumFrom, Nat.zero_add] #align list.enum_nth List.get?_enum @[deprecated (since := "2024-04-06")] alias enum_get? := get?_enum @[simp] theorem enumFrom_map_snd : ∀ (n) (l : List α), map Prod.snd (enumFrom n l) = l | _, [] => rfl | _, _ :: _ => congr_arg (cons _) (enumFrom_map_snd _ _) #align list.enum_from_map_snd List.enumFrom_map_snd @[simp] theorem enum_map_snd (l : List α) : map Prod.snd (enum l) = l := enumFrom_map_snd _ _ #align list.enum_map_snd List.enum_map_snd @[simp] theorem get_enumFrom (l : List α) (n) (i : Fin (l.enumFrom n).length) : (l.enumFrom n).get i = (n + i, l.get (i.cast enumFrom_length)) := by simp [get_eq_get?] #align list.nth_le_enum_from List.get_enumFrom @[simp] theorem get_enum (l : List α) (i : Fin l.enum.length) : l.enum.get i = (i.1, l.get (i.cast enum_length)) := by simp [enum] #align list.nth_le_enum List.get_enum theorem mk_add_mem_enumFrom_iff_get? {n i : ℕ} {x : α} {l : List α} : (n + i, x) ∈ enumFrom n l ↔ l.get? i = x := by simp [mem_iff_get?] theorem mk_mem_enumFrom_iff_le_and_get?_sub {n i : ℕ} {x : α} {l : List α} : (i, x) ∈ enumFrom n l ↔ n ≤ i ∧ l.get? (i - n) = x := by if h : n ≤ i then rcases Nat.exists_eq_add_of_le h with ⟨i, rfl⟩ simp [mk_add_mem_enumFrom_iff_get?, Nat.add_sub_cancel_left] else have : ∀ k, n + k ≠ i := by rintro k rfl; simp at h simp [h, mem_iff_get?, this] theorem mk_mem_enum_iff_get? {i : ℕ} {x : α} {l : List α} : (i, x) ∈ enum l ↔ l.get? i = x := by simp [enum, mk_mem_enumFrom_iff_le_and_get?_sub] theorem mem_enum_iff_get? {x : ℕ × α} {l : List α} : x ∈ enum l ↔ l.get? x.1 = x.2 := mk_mem_enum_iff_get? theorem le_fst_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) : n ≤ x.1 := (mk_mem_enumFrom_iff_le_and_get?_sub.1 h).1 theorem fst_lt_add_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) : x.1 < n + length l := by rcases mem_iff_get.1 h with ⟨i, rfl⟩ simpa using i.is_lt theorem fst_lt_of_mem_enum {x : ℕ × α} {l : List α} (h : x ∈ enum l) : x.1 < length l := by simpa using fst_lt_add_of_mem_enumFrom h theorem snd_mem_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) : x.2 ∈ l := enumFrom_map_snd n l ▸ mem_map_of_mem _ h theorem snd_mem_of_mem_enum {x : ℕ × α} {l : List α} (h : x ∈ enum l) : x.2 ∈ l := snd_mem_of_mem_enumFrom h theorem mem_enumFrom {x : α} {i j : ℕ} (xs : List α) (h : (i, x) ∈ xs.enumFrom j) : j ≤ i ∧ i < j + xs.length ∧ x ∈ xs := ⟨le_fst_of_mem_enumFrom h, fst_lt_add_of_mem_enumFrom h, snd_mem_of_mem_enumFrom h⟩ #align list.mem_enum_from List.mem_enumFrom @[simp] theorem enum_nil : enum ([] : List α) = [] := rfl #align list.enum_nil List.enum_nil #align list.enum_from_nil List.enumFrom_nil #align list.enum_from_cons List.enumFrom_cons @[simp] theorem enum_cons (x : α) (xs : List α) : enum (x :: xs) = (0, x) :: enumFrom 1 xs := rfl #align list.enum_cons List.enum_cons @[simp] theorem enumFrom_singleton (x : α) (n : ℕ) : enumFrom n [x] = [(n, x)] := rfl #align list.enum_from_singleton List.enumFrom_singleton @[simp] theorem enum_singleton (x : α) : enum [x] = [(0, x)] := rfl #align list.enum_singleton List.enum_singleton theorem enumFrom_append (xs ys : List α) (n : ℕ) : enumFrom n (xs ++ ys) = enumFrom n xs ++ enumFrom (n + xs.length) ys := by induction' xs with x xs IH generalizing ys n · simp · rw [cons_append, enumFrom_cons, IH, ← cons_append, ← enumFrom_cons, length, Nat.add_right_comm, Nat.add_assoc] #align list.enum_from_append List.enumFrom_append
Mathlib/Data/List/Enum.lean
132
133
theorem enum_append (xs ys : List α) : enum (xs ++ ys) = enum xs ++ enumFrom xs.length ys := by
simp [enum, enumFrom_append]
1
import Mathlib.Data.Finset.Card #align_import data.finset.option from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" variable {α β : Type*} open Function namespace Finset def insertNone : Finset α ↪o Finset (Option α) := (OrderEmbedding.ofMapLEIff fun s => cons none (s.map Embedding.some) <| by simp) fun s t => by rw [le_iff_subset, cons_subset_cons, map_subset_map, le_iff_subset] #align finset.insert_none Finset.insertNone @[simp] theorem mem_insertNone {s : Finset α} : ∀ {o : Option α}, o ∈ insertNone s ↔ ∀ a ∈ o, a ∈ s | none => iff_of_true (Multiset.mem_cons_self _ _) fun a h => by cases h | some a => Multiset.mem_cons.trans <| by simp #align finset.mem_insert_none Finset.mem_insertNone lemma forall_mem_insertNone {s : Finset α} {p : Option α → Prop} : (∀ a ∈ insertNone s, p a) ↔ p none ∧ ∀ a ∈ s, p a := by simp [Option.forall]
Mathlib/Data/Finset/Option.lean
78
78
theorem some_mem_insertNone {s : Finset α} {a : α} : some a ∈ insertNone s ↔ a ∈ s := by
simp
1
import Mathlib.LinearAlgebra.Basis.VectorSpace import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.SetTheory.Cardinal.Subfield import Mathlib.LinearAlgebra.Dimension.RankNullity #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u₀ u v v' v'' u₁' w w' variable {K R : Type u} {V V₁ V₂ V₃ : Type v} {V' V'₁ : Type v'} {V'' : Type v''} variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*} open Cardinal Basis Submodule Function Set section Module section Basis open FiniteDimensional variable [DivisionRing K] [AddCommGroup V] [Module K V] theorem linearIndependent_of_top_le_span_of_card_eq_finrank {ι : Type*} [Fintype ι] {b : ι → V} (spans : ⊤ ≤ span K (Set.range b)) (card_eq : Fintype.card ι = finrank K V) : LinearIndependent K b := linearIndependent_iff'.mpr fun s g dependent i i_mem_s => by classical by_contra gx_ne_zero -- We'll derive a contradiction by showing `b '' (univ \ {i})` of cardinality `n - 1` -- spans a vector space of dimension `n`. refine not_le_of_gt (span_lt_top_of_card_lt_finrank (show (b '' (Set.univ \ {i})).toFinset.card < finrank K V from ?_)) ?_ · calc (b '' (Set.univ \ {i})).toFinset.card = ((Set.univ \ {i}).toFinset.image b).card := by rw [Set.toFinset_card, Fintype.card_ofFinset] _ ≤ (Set.univ \ {i}).toFinset.card := Finset.card_image_le _ = (Finset.univ.erase i).card := (congr_arg Finset.card (Finset.ext (by simp [and_comm]))) _ < Finset.univ.card := Finset.card_erase_lt_of_mem (Finset.mem_univ i) _ = finrank K V := card_eq -- We already have that `b '' univ` spans the whole space, -- so we only need to show that the span of `b '' (univ \ {i})` contains each `b j`. refine spans.trans (span_le.mpr ?_) rintro _ ⟨j, rfl, rfl⟩ -- The case that `j ≠ i` is easy because `b j ∈ b '' (univ \ {i})`. by_cases j_eq : j = i swap · refine subset_span ⟨j, (Set.mem_diff _).mpr ⟨Set.mem_univ _, ?_⟩, rfl⟩ exact mt Set.mem_singleton_iff.mp j_eq -- To show `b i ∈ span (b '' (univ \ {i}))`, we use that it's a weighted sum -- of the other `b j`s. rw [j_eq, SetLike.mem_coe, show b i = -((g i)⁻¹ • (s.erase i).sum fun j => g j • b j) from _] · refine neg_mem (smul_mem _ _ (sum_mem fun k hk => ?_)) obtain ⟨k_ne_i, _⟩ := Finset.mem_erase.mp hk refine smul_mem _ _ (subset_span ⟨k, ?_, rfl⟩) simp_all only [Set.mem_univ, Set.mem_diff, Set.mem_singleton_iff, and_self, not_false_eq_true] -- To show `b i` is a weighted sum of the other `b j`s, we'll rewrite this sum -- to have the form of the assumption `dependent`. apply eq_neg_of_add_eq_zero_left calc (b i + (g i)⁻¹ • (s.erase i).sum fun j => g j • b j) = (g i)⁻¹ • (g i • b i + (s.erase i).sum fun j => g j • b j) := by rw [smul_add, ← mul_smul, inv_mul_cancel gx_ne_zero, one_smul] _ = (g i)⁻¹ • (0 : V) := congr_arg _ ?_ _ = 0 := smul_zero _ -- And then it's just a bit of manipulation with finite sums. rwa [← Finset.insert_erase i_mem_s, Finset.sum_insert (Finset.not_mem_erase _ _)] at dependent #align linear_independent_of_top_le_span_of_card_eq_finrank linearIndependent_of_top_le_span_of_card_eq_finrank theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} : LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by constructor · intro h exact (finrank_span_eq_card h).symm · intro hc let f := Submodule.subtype (span K (Set.range b)) let b' : ι → span K (Set.range b) := fun i => ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩ have hs : ⊤ ≤ span K (Set.range b') := by intro x have h : span K (f '' Set.range b') = map f (span K (Set.range b')) := span_image f have hf : f '' Set.range b' = Set.range b := by ext x simp [f, Set.mem_image, Set.mem_range] rw [hf] at h have hx : (x : V) ∈ span K (Set.range b) := x.property conv at hx => arg 2 rw [h] simpa [f, mem_map] using hx have hi : LinearMap.ker f = ⊥ := ker_subtype _ convert (linearIndependent_of_top_le_span_of_card_eq_finrank hs hc).map' _ hi #align linear_independent_iff_card_eq_finrank_span linearIndependent_iff_card_eq_finrank_span
Mathlib/LinearAlgebra/Dimension/DivisionRing.lean
196
198
theorem linearIndependent_iff_card_le_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} : LinearIndependent K b ↔ Fintype.card ι ≤ (Set.range b).finrank K := by
rw [linearIndependent_iff_card_eq_finrank_span, (finrank_range_le_card _).le_iff_eq]
1
import Mathlib.Algebra.CharP.ExpChar import Mathlib.GroupTheory.OrderOfElement #align_import algebra.char_p.two from "leanprover-community/mathlib"@"7f1ba1a333d66eed531ecb4092493cd1b6715450" variable {R ι : Type*} namespace CharTwo section Semiring variable [Semiring R] [CharP R 2] theorem two_eq_zero : (2 : R) = 0 := by rw [← Nat.cast_two, CharP.cast_eq_zero] #align char_two.two_eq_zero CharTwo.two_eq_zero @[simp] theorem add_self_eq_zero (x : R) : x + x = 0 := by rw [← two_smul R x, two_eq_zero, zero_smul] #align char_two.add_self_eq_zero CharTwo.add_self_eq_zero set_option linter.deprecated false in @[simp] theorem bit0_eq_zero : (bit0 : R → R) = 0 := by funext exact add_self_eq_zero _ #align char_two.bit0_eq_zero CharTwo.bit0_eq_zero set_option linter.deprecated false in theorem bit0_apply_eq_zero (x : R) : (bit0 x : R) = 0 := by simp #align char_two.bit0_apply_eq_zero CharTwo.bit0_apply_eq_zero set_option linter.deprecated false in @[simp] theorem bit1_eq_one : (bit1 : R → R) = 1 := by funext simp [bit1] #align char_two.bit1_eq_one CharTwo.bit1_eq_one set_option linter.deprecated false in
Mathlib/Algebra/CharP/Two.lean
55
55
theorem bit1_apply_eq_one (x : R) : (bit1 x : R) = 1 := by
simp
1
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z ≠ 2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : ℤ) : z * z % 4 ≠ 2 := by suffices ¬z * z % (4 : ℕ) = 2 % (4 : ℕ) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : ℤ) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : ℤ} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : ℤ} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm]
Mathlib/NumberTheory/PythagoreanTriples.lean
73
73
theorem symm : PythagoreanTriple y x z := by
rwa [pythagoreanTriple_comm]
1
import Mathlib.Algebra.Order.Field.Canonical.Defs #align_import algebra.order.field.canonical.basic from "leanprover-community/mathlib"@"ee0c179cd3c8a45aa5bffbf1b41d8dbede452865" variable {α : Type*} section CanonicallyLinearOrderedSemifield variable [CanonicallyLinearOrderedSemifield α] [Sub α] [OrderedSub α]
Mathlib/Algebra/Order/Field/Canonical/Basic.lean
22
22
theorem tsub_div (a b c : α) : (a - b) / c = a / c - b / c := by
simp_rw [div_eq_mul_inv, tsub_mul]
1
import Mathlib.Topology.MetricSpace.Basic #align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b" variable {α β : Type*} namespace Set section Einfsep open ENNReal open Function noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ := ⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y #align set.einfsep Set.einfsep section EDist variable [EDist α] {x y : α} {s t : Set α} theorem le_einfsep_iff {d} : d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by simp_rw [einfsep, le_iInf_iff] #align set.le_einfsep_iff Set.le_einfsep_iff theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop] #align set.einfsep_zero Set.einfsep_zero theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by rw [pos_iff_ne_zero, Ne, einfsep_zero] simp only [not_forall, not_exists, not_lt, exists_prop, not_and] #align set.einfsep_pos Set.einfsep_pos
Mathlib/Topology/MetricSpace/Infsep.lean
64
66
theorem einfsep_top : s.einfsep = ∞ ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → edist x y = ∞ := by
simp_rw [einfsep, iInf_eq_top]
1
import Mathlib.Data.Set.Lattice import Mathlib.Data.Set.Pairwise.Basic #align_import data.set.pairwise.lattice from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Function Set Order variable {α β γ ι ι' : Type*} {κ : Sort*} {r p q : α → α → Prop} section Pairwise variable {f g : ι → α} {s t u : Set α} {a b : α} namespace Set theorem pairwise_iUnion {f : κ → Set α} (h : Directed (· ⊆ ·) f) : (⋃ n, f n).Pairwise r ↔ ∀ n, (f n).Pairwise r := by constructor · intro H n exact Pairwise.mono (subset_iUnion _ _) H · intro H i hi j hj hij rcases mem_iUnion.1 hi with ⟨m, hm⟩ rcases mem_iUnion.1 hj with ⟨n, hn⟩ rcases h m n with ⟨p, mp, np⟩ exact H p (mp hm) (np hn) hij #align set.pairwise_Union Set.pairwise_iUnion
Mathlib/Data/Set/Pairwise/Lattice.lean
39
41
theorem pairwise_sUnion {r : α → α → Prop} {s : Set (Set α)} (h : DirectedOn (· ⊆ ·) s) : (⋃₀ s).Pairwise r ↔ ∀ a ∈ s, Set.Pairwise a r := by
rw [sUnion_eq_iUnion, pairwise_iUnion h.directed_val, SetCoe.forall]
1
import Mathlib.Algebra.Lie.Abelian import Mathlib.Algebra.Lie.IdealOperations import Mathlib.Algebra.Lie.Quotient #align_import algebra.lie.normalizer from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102" variable {R L M M' : Type*} variable [CommRing R] [LieRing L] [LieAlgebra R L] variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] variable [AddCommGroup M'] [Module R M'] [LieRingModule L M'] [LieModule R L M'] namespace LieSubmodule variable (N : LieSubmodule R L M) {N₁ N₂ : LieSubmodule R L M} def normalizer : LieSubmodule R L M where carrier := {m | ∀ x : L, ⁅x, m⁆ ∈ N} add_mem' hm₁ hm₂ x := by rw [lie_add]; exact N.add_mem' (hm₁ x) (hm₂ x) zero_mem' x := by simp smul_mem' t m hm x := by rw [lie_smul]; exact N.smul_mem' t (hm x) lie_mem {x m} hm y := by rw [leibniz_lie]; exact N.add_mem' (hm ⁅y, x⁆) (N.lie_mem (hm y)) #align lie_submodule.normalizer LieSubmodule.normalizer @[simp] theorem mem_normalizer (m : M) : m ∈ N.normalizer ↔ ∀ x : L, ⁅x, m⁆ ∈ N := Iff.rfl #align lie_submodule.mem_normalizer LieSubmodule.mem_normalizer @[simp] theorem le_normalizer : N ≤ N.normalizer := by intro m hm rw [mem_normalizer] exact fun x => N.lie_mem hm #align lie_submodule.le_normalizer LieSubmodule.le_normalizer
Mathlib/Algebra/Lie/Normalizer.lean
70
71
theorem normalizer_inf : (N₁ ⊓ N₂).normalizer = N₁.normalizer ⊓ N₂.normalizer := by
ext; simp [← forall_and]
1
import Mathlib.MeasureTheory.Function.AEEqFun.DomAct import Mathlib.MeasureTheory.Function.LpSpace set_option autoImplicit true open MeasureTheory Filter open scoped ENNReal namespace DomMulAct variable {M N α E : Type*} [MeasurableSpace M] [MeasurableSpace N] [MeasurableSpace α] [NormedAddCommGroup E] {μ : MeasureTheory.Measure α} {p : ℝ≥0∞} section SMul variable [SMul M α] [SMulInvariantMeasure M α μ] [MeasurableSMul M α] @[to_additive] instance : SMul Mᵈᵐᵃ (Lp E p μ) where smul c f := Lp.compMeasurePreserving (mk.symm c • ·) (measurePreserving_smul _ _) f @[to_additive (attr := simp)] theorem smul_Lp_val (c : Mᵈᵐᵃ) (f : Lp E p μ) : (c • f).1 = c • f.1 := rfl @[to_additive] theorem smul_Lp_ae_eq (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • f =ᵐ[μ] (f <| mk.symm c • ·) := Lp.coeFn_compMeasurePreserving _ _ @[to_additive] theorem mk_smul_toLp (c : M) {f : α → E} (hf : Memℒp f p μ) : mk c • hf.toLp f = (hf.comp_measurePreserving <| measurePreserving_smul c μ).toLp (f <| c • ·) := rfl @[to_additive (attr := simp)] theorem smul_Lp_const [IsFiniteMeasure μ] (c : Mᵈᵐᵃ) (a : E) : c • Lp.const p μ a = Lp.const p μ a := rfl instance [SMul N α] [SMulCommClass M N α] [SMulInvariantMeasure N α μ] [MeasurableSMul N α] : SMulCommClass Mᵈᵐᵃ Nᵈᵐᵃ (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass Mᵈᵐᵃ 𝕜 (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass 𝕜 Mᵈᵐᵃ (Lp E p μ) := .symm _ _ _ -- We don't have a typeclass for additive versions of the next few lemmas -- Should we add `AddDistribAddAction` with `to_additive` both from `MulDistribMulAction` -- and `DistribMulAction`? @[to_additive]
Mathlib/MeasureTheory/Function/LpSpace/DomAct/Basic.lean
70
71
theorem smul_Lp_add (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f + g) = c • f + c • g := by
rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl
1
import Mathlib.Algebra.Order.Ring.Cast import Mathlib.Data.Int.Cast.Lemmas import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.PSub import Mathlib.Data.Nat.Size import Mathlib.Data.Num.Bitwise #align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" set_option linter.deprecated false -- Porting note: Required for the notation `-[n+1]`. open Int Function attribute [local simp] add_assoc namespace Num variable {α : Type*} open PosNum
Mathlib/Data/Num/Lemmas.lean
712
712
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by
cases b <;> cases n <;> rfl
1
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Algebra.Order.Field.Defs import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Order.Bounds.OrderIso import Mathlib.Tactic.Positivity.Core #align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd" open Function OrderDual variable {ι α β : Type*} section LinearOrderedSemifield variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ} @[simps! (config := { simpRhs := true })] def OrderIso.mulLeft₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulLeft₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha } #align order_iso.mul_left₀ OrderIso.mulLeft₀ #align order_iso.mul_left₀_symm_apply OrderIso.mulLeft₀_symm_apply #align order_iso.mul_left₀_apply OrderIso.mulLeft₀_apply @[simps! (config := { simpRhs := true })] def OrderIso.mulRight₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulRight₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha } #align order_iso.mul_right₀ OrderIso.mulRight₀ #align order_iso.mul_right₀_symm_apply OrderIso.mulRight₀_symm_apply #align order_iso.mul_right₀_apply OrderIso.mulRight₀_apply theorem le_div_iff (hc : 0 < c) : a ≤ b / c ↔ a * c ≤ b := ⟨fun h => div_mul_cancel₀ b (ne_of_lt hc).symm ▸ mul_le_mul_of_nonneg_right h hc.le, fun h => calc a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm _ ≤ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le _ = b / c := (div_eq_mul_one_div b c).symm ⟩ #align le_div_iff le_div_iff
Mathlib/Algebra/Order/Field/Basic.lean
58
58
theorem le_div_iff' (hc : 0 < c) : a ≤ b / c ↔ c * a ≤ b := by
rw [mul_comm, le_div_iff hc]
1
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor import Mathlib.CategoryTheory.Monoidal.Functor #align_import category_theory.monoidal.preadditive from "leanprover-community/mathlib"@"986c4d5761f938b2e1c43c01f001b6d9d88c2055" noncomputable section open scoped Classical namespace CategoryTheory open CategoryTheory.Limits open CategoryTheory.MonoidalCategory variable (C : Type*) [Category C] [Preadditive C] [MonoidalCategory C] class MonoidalPreadditive : Prop where whiskerLeft_zero : ∀ {X Y Z : C}, X ◁ (0 : Y ⟶ Z) = 0 := by aesop_cat zero_whiskerRight : ∀ {X Y Z : C}, (0 : Y ⟶ Z) ▷ X = 0 := by aesop_cat whiskerLeft_add : ∀ {X Y Z : C} (f g : Y ⟶ Z), X ◁ (f + g) = X ◁ f + X ◁ g := by aesop_cat add_whiskerRight : ∀ {X Y Z : C} (f g : Y ⟶ Z), (f + g) ▷ X = f ▷ X + g ▷ X := by aesop_cat #align category_theory.monoidal_preadditive CategoryTheory.MonoidalPreadditive attribute [simp] MonoidalPreadditive.whiskerLeft_zero MonoidalPreadditive.zero_whiskerRight attribute [simp] MonoidalPreadditive.whiskerLeft_add MonoidalPreadditive.add_whiskerRight variable {C} variable [MonoidalPreadditive C] instance tensorLeft_additive (X : C) : (tensorLeft X).Additive where #align category_theory.tensor_left_additive CategoryTheory.tensorLeft_additive instance tensorRight_additive (X : C) : (tensorRight X).Additive where #align category_theory.tensor_right_additive CategoryTheory.tensorRight_additive instance tensoringLeft_additive (X : C) : ((tensoringLeft C).obj X).Additive where #align category_theory.tensoring_left_additive CategoryTheory.tensoringLeft_additive instance tensoringRight_additive (X : C) : ((tensoringRight C).obj X).Additive where #align category_theory.tensoring_right_additive CategoryTheory.tensoringRight_additive theorem monoidalPreadditive_of_faithful {D} [Category D] [Preadditive D] [MonoidalCategory D] (F : MonoidalFunctor D C) [F.Faithful] [F.Additive] : MonoidalPreadditive D := { whiskerLeft_zero := by intros apply F.toFunctor.map_injective simp [F.map_whiskerLeft] zero_whiskerRight := by intros apply F.toFunctor.map_injective simp [F.map_whiskerRight] whiskerLeft_add := by intros apply F.toFunctor.map_injective simp only [F.map_whiskerLeft, Functor.map_add, Preadditive.comp_add, Preadditive.add_comp, MonoidalPreadditive.whiskerLeft_add] add_whiskerRight := by intros apply F.toFunctor.map_injective simp only [F.map_whiskerRight, Functor.map_add, Preadditive.comp_add, Preadditive.add_comp, MonoidalPreadditive.add_whiskerRight] } #align category_theory.monoidal_preadditive_of_faithful CategoryTheory.monoidalPreadditive_of_faithful theorem whiskerLeft_sum (P : C) {Q R : C} {J : Type*} (s : Finset J) (g : J → (Q ⟶ R)) : P ◁ ∑ j ∈ s, g j = ∑ j ∈ s, P ◁ g j := map_sum ((tensoringLeft C).obj P).mapAddHom g s theorem sum_whiskerRight {Q R : C} {J : Type*} (s : Finset J) (g : J → (Q ⟶ R)) (P : C) : (∑ j ∈ s, g j) ▷ P = ∑ j ∈ s, g j ▷ P := map_sum ((tensoringRight C).obj P).mapAddHom g s
Mathlib/CategoryTheory/Monoidal/Preadditive.lean
113
115
theorem tensor_sum {P Q R S : C} {J : Type*} (s : Finset J) (f : P ⟶ Q) (g : J → (R ⟶ S)) : (f ⊗ ∑ j ∈ s, g j) = ∑ j ∈ s, f ⊗ g j := by
simp only [tensorHom_def, whiskerLeft_sum, Preadditive.comp_sum]
1
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.HasseDeriv #align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section namespace Polynomial open Polynomial variable {R : Type*} [Semiring R] (r : R) (f : R[X]) def taylor (r : R) : R[X] →ₗ[R] R[X] where toFun f := f.comp (X + C r) map_add' f g := add_comp map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply] #align polynomial.taylor Polynomial.taylor theorem taylor_apply : taylor r f = f.comp (X + C r) := rfl #align polynomial.taylor_apply Polynomial.taylor_apply @[simp] theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp] set_option linter.uppercaseLean3 false in #align polynomial.taylor_X Polynomial.taylor_X @[simp] theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp] set_option linter.uppercaseLean3 false in #align polynomial.taylor_C Polynomial.taylor_C @[simp] theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by ext simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp, Function.comp_apply, LinearMap.coe_comp] #align polynomial.taylor_zero' Polynomial.taylor_zero' theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply] #align polynomial.taylor_zero Polynomial.taylor_zero @[simp] theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [← C_1, taylor_C] #align polynomial.taylor_one Polynomial.taylor_one @[simp] theorem taylor_monomial (i : ℕ) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by simp [taylor_apply] #align polynomial.taylor_monomial Polynomial.taylor_monomial theorem taylor_coeff (n : ℕ) : (taylor r f).coeff n = (hasseDeriv n f).eval r := show (lcoeff R n).comp (taylor r) f = (leval r).comp (hasseDeriv n) f by congr 1; clear! f; ext i simp only [leval_apply, mul_one, one_mul, eval_monomial, LinearMap.comp_apply, coeff_C_mul, hasseDeriv_monomial, taylor_apply, monomial_comp, C_1, (commute_X (C r)).add_pow i, map_sum] simp only [lcoeff_apply, ← C_eq_natCast, mul_assoc, ← C_pow, ← C_mul, coeff_mul_C, (Nat.cast_commute _ _).eq, coeff_X_pow, boole_mul, Finset.sum_ite_eq, Finset.mem_range] split_ifs with h; · rfl push_neg at h; rw [Nat.choose_eq_zero_of_lt h, Nat.cast_zero, mul_zero] #align polynomial.taylor_coeff Polynomial.taylor_coeff @[simp] theorem taylor_coeff_zero : (taylor r f).coeff 0 = f.eval r := by rw [taylor_coeff, hasseDeriv_zero, LinearMap.id_apply] #align polynomial.taylor_coeff_zero Polynomial.taylor_coeff_zero @[simp] theorem taylor_coeff_one : (taylor r f).coeff 1 = f.derivative.eval r := by rw [taylor_coeff, hasseDeriv_one] #align polynomial.taylor_coeff_one Polynomial.taylor_coeff_one @[simp] theorem natDegree_taylor (p : R[X]) (r : R) : natDegree (taylor r p) = natDegree p := by refine map_natDegree_eq_natDegree _ ?_ nontriviality R intro n c c0 simp [taylor_monomial, natDegree_C_mul_eq_of_mul_ne_zero, natDegree_pow_X_add_C, c0] #align polynomial.nat_degree_taylor Polynomial.natDegree_taylor @[simp] theorem taylor_mul {R} [CommSemiring R] (r : R) (p q : R[X]) : taylor r (p * q) = taylor r p * taylor r q := by simp only [taylor_apply, mul_comp] #align polynomial.taylor_mul Polynomial.taylor_mul @[simps!] def taylorAlgHom {R} [CommSemiring R] (r : R) : R[X] →ₐ[R] R[X] := AlgHom.ofLinearMap (taylor r) (taylor_one r) (taylor_mul r) #align polynomial.taylor_alg_hom Polynomial.taylorAlgHom theorem taylor_taylor {R} [CommSemiring R] (f : R[X]) (r s : R) : taylor r (taylor s f) = taylor (r + s) f := by simp only [taylor_apply, comp_assoc, map_add, add_comp, X_comp, C_comp, C_add, add_assoc] #align polynomial.taylor_taylor Polynomial.taylor_taylor
Mathlib/Algebra/Polynomial/Taylor.lean
121
123
theorem taylor_eval {R} [CommSemiring R] (r : R) (f : R[X]) (s : R) : (taylor r f).eval s = f.eval (s + r) := by
simp only [taylor_apply, eval_comp, eval_C, eval_X, eval_add]
1
import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Tactic.LinearCombination #align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946" namespace Polynomial.Chebyshev set_option linter.uppercaseLean3 false -- `T` `U` `X` open Polynomial variable (R S : Type*) [CommRing R] [CommRing S] -- Well-founded definitions are now irreducible by default; -- as this was implemented before this change, -- we just set it back to semireducible to avoid needing to change any proofs. @[semireducible] noncomputable def T : ℤ → R[X] | 0 => 1 | 1 => X | (n : ℕ) + 2 => 2 * X * T (n + 1) - T n | -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1) termination_by n => Int.natAbs n + Int.natAbs (n - 1) #align polynomial.chebyshev.T Polynomial.Chebyshev.T @[elab_as_elim] protected theorem induct (motive : ℤ → Prop) (zero : motive 0) (one : motive 1) (add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2)) (neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) : ∀ (a : ℤ), motive a := T.induct Unit motive zero one add_two fun n hn hnm => by simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm @[simp] theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n | (k : ℕ) => T.eq_3 R k | -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k #align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
Mathlib/RingTheory/Polynomial/Chebyshev.lean
90
91
theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by
linear_combination (norm := ring_nf) T_add_two R (n - 1)
1
import Mathlib.SetTheory.Game.Basic import Mathlib.Tactic.NthRewrite #align_import set_theory.game.impartial from "leanprover-community/mathlib"@"2e0975f6a25dd3fbfb9e41556a77f075f6269748" universe u namespace SetTheory open scoped PGame namespace PGame def ImpartialAux : PGame → Prop | G => (G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j) termination_by G => G -- Porting note: Added `termination_by` #align pgame.impartial_aux SetTheory.PGame.ImpartialAux theorem impartialAux_def {G : PGame} : G.ImpartialAux ↔ (G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j) := by rw [ImpartialAux] #align pgame.impartial_aux_def SetTheory.PGame.impartialAux_def class Impartial (G : PGame) : Prop where out : ImpartialAux G #align pgame.impartial SetTheory.PGame.Impartial theorem impartial_iff_aux {G : PGame} : G.Impartial ↔ G.ImpartialAux := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align pgame.impartial_iff_aux SetTheory.PGame.impartial_iff_aux
Mathlib/SetTheory/Game/Impartial.lean
50
52
theorem impartial_def {G : PGame} : G.Impartial ↔ (G ≈ -G) ∧ (∀ i, Impartial (G.moveLeft i)) ∧ ∀ j, Impartial (G.moveRight j) := by
simpa only [impartial_iff_aux] using impartialAux_def
1
import Aesop import Mathlib.Algebra.Group.Defs import Mathlib.Data.Nat.Defs import Mathlib.Data.Int.Defs import Mathlib.Logic.Function.Basic import Mathlib.Tactic.Cases import Mathlib.Tactic.SimpRw import Mathlib.Tactic.SplitIfs #align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered open Function universe u variable {α β G M : Type*} @[to_additive] instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (α := G) (· * ·) := ⟨mul_comm⟩ #align comm_semigroup.to_is_commutative CommMagma.to_isCommutative #align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative section MulOneClass variable {M : Type u} [MulOneClass M] @[to_additive] theorem ite_mul_one {P : Prop} [Decidable P] {a b : M} : ite P (a * b) 1 = ite P a 1 * ite P b 1 := by by_cases h:P <;> simp [h] #align ite_mul_one ite_mul_one #align ite_add_zero ite_add_zero @[to_additive]
Mathlib/Algebra/Group/Basic.lean
153
155
theorem ite_one_mul {P : Prop} [Decidable P] {a b : M} : ite P 1 (a * b) = ite P 1 a * ite P 1 b := by
by_cases h:P <;> simp [h]
1
import Mathlib.Order.Filter.Basic import Mathlib.Algebra.Module.Pi #align_import order.filter.germ from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" namespace Filter variable {α β γ δ : Type*} {l : Filter α} {f g h : α → β} theorem const_eventuallyEq' [NeBot l] {a b : β} : (∀ᶠ _ in l, a = b) ↔ a = b := eventually_const #align filter.const_eventually_eq' Filter.const_eventuallyEq' theorem const_eventuallyEq [NeBot l] {a b : β} : ((fun _ => a) =ᶠ[l] fun _ => b) ↔ a = b := @const_eventuallyEq' _ _ _ _ a b #align filter.const_eventually_eq Filter.const_eventuallyEq def germSetoid (l : Filter α) (β : Type*) : Setoid (α → β) where r := EventuallyEq l iseqv := ⟨EventuallyEq.refl _, EventuallyEq.symm, EventuallyEq.trans⟩ #align filter.germ_setoid Filter.germSetoid def Germ (l : Filter α) (β : Type*) : Type _ := Quotient (germSetoid l β) #align filter.germ Filter.Germ def productSetoid (l : Filter α) (ε : α → Type*) : Setoid ((a : _) → ε a) where r f g := ∀ᶠ a in l, f a = g a iseqv := ⟨fun _ => eventually_of_forall fun _ => rfl, fun h => h.mono fun _ => Eq.symm, fun h1 h2 => h1.congr (h2.mono fun _ hx => hx ▸ Iff.rfl)⟩ #align filter.product_setoid Filter.productSetoid -- Porting note: removed @[protected] def Product (l : Filter α) (ε : α → Type*) : Type _ := Quotient (productSetoid l ε) #align filter.product Filter.Product namespace Germ -- Porting note: added @[coe] def ofFun : (α → β) → (Germ l β) := @Quotient.mk' _ (germSetoid _ _) instance : CoeTC (α → β) (Germ l β) := ⟨ofFun⟩ @[coe] -- Porting note: removed `HasLiftT` instance def const {l : Filter α} (b : β) : (Germ l β) := ofFun fun _ => b instance coeTC : CoeTC β (Germ l β) := ⟨const⟩ def IsConstant {l : Filter α} (P : Germ l β) : Prop := P.liftOn (fun f ↦ ∃ b : β, f =ᶠ[l] (fun _ ↦ b)) <| by suffices ∀ f g : α → β, ∀ b : β, f =ᶠ[l] g → (f =ᶠ[l] fun _ ↦ b) → (g =ᶠ[l] fun _ ↦ b) from fun f g h ↦ propext ⟨fun ⟨b, hb⟩ ↦ ⟨b, this f g b h hb⟩, fun ⟨b, hb⟩ ↦ ⟨b, h.trans hb⟩⟩ exact fun f g b hfg hf ↦ (hfg.symm).trans hf theorem isConstant_coe {l : Filter α} {b} (h : ∀ x', f x' = b) : (↑f : Germ l β).IsConstant := ⟨b, eventually_of_forall (fun x ↦ h x)⟩ @[simp]
Mathlib/Order/Filter/Germ.lean
132
133
theorem isConstant_coe_const {l : Filter α} {b : β} : (fun _ : α ↦ b : Germ l β).IsConstant := by
use b
1
import Mathlib.SetTheory.Game.Ordinal import Mathlib.SetTheory.Ordinal.NaturalOps #align_import set_theory.game.birthday from "leanprover-community/mathlib"@"a347076985674932c0e91da09b9961ed0a79508c" universe u open Ordinal namespace SetTheory open scoped NaturalOps PGame namespace PGame noncomputable def birthday : PGame.{u} → Ordinal.{u} | ⟨_, _, xL, xR⟩ => max (lsub.{u, u} fun i => birthday (xL i)) (lsub.{u, u} fun i => birthday (xR i)) #align pgame.birthday SetTheory.PGame.birthday theorem birthday_def (x : PGame) : birthday x = max (lsub.{u, u} fun i => birthday (x.moveLeft i)) (lsub.{u, u} fun i => birthday (x.moveRight i)) := by cases x; rw [birthday]; rfl #align pgame.birthday_def SetTheory.PGame.birthday_def theorem birthday_moveLeft_lt {x : PGame} (i : x.LeftMoves) : (x.moveLeft i).birthday < x.birthday := by cases x; rw [birthday]; exact lt_max_of_lt_left (lt_lsub _ i) #align pgame.birthday_move_left_lt SetTheory.PGame.birthday_moveLeft_lt theorem birthday_moveRight_lt {x : PGame} (i : x.RightMoves) : (x.moveRight i).birthday < x.birthday := by cases x; rw [birthday]; exact lt_max_of_lt_right (lt_lsub _ i) #align pgame.birthday_move_right_lt SetTheory.PGame.birthday_moveRight_lt theorem lt_birthday_iff {x : PGame} {o : Ordinal} : o < x.birthday ↔ (∃ i : x.LeftMoves, o ≤ (x.moveLeft i).birthday) ∨ ∃ i : x.RightMoves, o ≤ (x.moveRight i).birthday := by constructor · rw [birthday_def] intro h cases' lt_max_iff.1 h with h' h' · left rwa [lt_lsub_iff] at h' · right rwa [lt_lsub_iff] at h' · rintro (⟨i, hi⟩ | ⟨i, hi⟩) · exact hi.trans_lt (birthday_moveLeft_lt i) · exact hi.trans_lt (birthday_moveRight_lt i) #align pgame.lt_birthday_iff SetTheory.PGame.lt_birthday_iff theorem Relabelling.birthday_congr : ∀ {x y : PGame.{u}}, x ≡r y → birthday x = birthday y | ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩, r => by unfold birthday congr 1 all_goals apply lsub_eq_of_range_eq.{u, u, u} ext i; constructor all_goals rintro ⟨j, rfl⟩ · exact ⟨_, (r.moveLeft j).birthday_congr.symm⟩ · exact ⟨_, (r.moveLeftSymm j).birthday_congr⟩ · exact ⟨_, (r.moveRight j).birthday_congr.symm⟩ · exact ⟨_, (r.moveRightSymm j).birthday_congr⟩ termination_by x y => (x, y) #align pgame.relabelling.birthday_congr SetTheory.PGame.Relabelling.birthday_congr @[simp]
Mathlib/SetTheory/Game/Birthday.lean
97
99
theorem birthday_eq_zero {x : PGame} : birthday x = 0 ↔ IsEmpty x.LeftMoves ∧ IsEmpty x.RightMoves := by
rw [birthday_def, max_eq_zero, lsub_eq_zero_iff, lsub_eq_zero_iff]
1
import Mathlib.Data.Finsupp.ToDFinsupp import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.LinearIndependent #align_import linear_algebra.dfinsupp from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" variable {ι : Type*} {R : Type*} {S : Type*} {M : ι → Type*} {N : Type*} namespace DFinsupp variable [Semiring R] [∀ i, AddCommMonoid (M i)] [∀ i, Module R (M i)] variable [AddCommMonoid N] [Module R N] section DecidableEq variable [DecidableEq ι] def lmk (s : Finset ι) : (∀ i : (↑s : Set ι), M i) →ₗ[R] Π₀ i, M i where toFun := mk s map_add' _ _ := mk_add map_smul' c x := mk_smul c x #align dfinsupp.lmk DFinsupp.lmk def lsingle (i) : M i →ₗ[R] Π₀ i, M i := { DFinsupp.singleAddHom _ _ with toFun := single i map_smul' := single_smul } #align dfinsupp.lsingle DFinsupp.lsingle theorem lhom_ext ⦃φ ψ : (Π₀ i, M i) →ₗ[R] N⦄ (h : ∀ i x, φ (single i x) = ψ (single i x)) : φ = ψ := LinearMap.toAddMonoidHom_injective <| addHom_ext h #align dfinsupp.lhom_ext DFinsupp.lhom_ext @[ext 1100] theorem lhom_ext' ⦃φ ψ : (Π₀ i, M i) →ₗ[R] N⦄ (h : ∀ i, φ.comp (lsingle i) = ψ.comp (lsingle i)) : φ = ψ := lhom_ext fun i => LinearMap.congr_fun (h i) #align dfinsupp.lhom_ext' DFinsupp.lhom_ext' def lapply (i : ι) : (Π₀ i, M i) →ₗ[R] M i where toFun f := f i map_add' f g := add_apply f g i map_smul' c f := smul_apply c f i #align dfinsupp.lapply DFinsupp.lapply -- This lemma has always been bad, but the linter only noticed after lean4#2644. @[simp, nolint simpNF] theorem lmk_apply (s : Finset ι) (x) : (lmk s : _ →ₗ[R] Π₀ i, M i) x = mk s x := rfl #align dfinsupp.lmk_apply DFinsupp.lmk_apply @[simp] theorem lsingle_apply (i : ι) (x : M i) : (lsingle i : (M i) →ₗ[R] _) x = single i x := rfl #align dfinsupp.lsingle_apply DFinsupp.lsingle_apply @[simp] theorem lapply_apply (i : ι) (f : Π₀ i, M i) : (lapply i : (Π₀ i, M i) →ₗ[R] _) f = f i := rfl #align dfinsupp.lapply_apply DFinsupp.lapply_apply section Lsum -- Porting note: Unclear how true these docstrings are in lean 4 instance addCommMonoidOfLinearMap : AddCommMonoid (Π₀ i : ι, M i →ₗ[R] N) := inferInstance #align dfinsupp.add_comm_monoid_of_linear_map DFinsupp.addCommMonoidOfLinearMap instance moduleOfLinearMap [Semiring S] [Module S N] [SMulCommClass R S N] : Module S (Π₀ i : ι, M i →ₗ[R] N) := DFinsupp.module #align dfinsupp.module_of_linear_map DFinsupp.moduleOfLinearMap variable (S) instance {R : Type*} {S : Type*} [Semiring R] [Semiring S] (σ : R →+* S) {σ' : S →+* R} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] (M : Type*) (M₂ : Type*) [AddCommMonoid M] [AddCommMonoid M₂] [Module R M] [Module S M₂] : EquivLike (LinearEquiv σ M M₂) M M₂ := inferInstance @[simps] def lsum [Semiring S] [Module S N] [SMulCommClass R S N] : (∀ i, M i →ₗ[R] N) ≃ₗ[S] (Π₀ i, M i) →ₗ[R] N where toFun F := { toFun := sumAddHom fun i => (F i).toAddMonoidHom map_add' := (DFinsupp.liftAddHom fun (i : ι) => (F i).toAddMonoidHom).map_add map_smul' := fun c f => by dsimp apply DFinsupp.induction f · rw [smul_zero, AddMonoidHom.map_zero, smul_zero] · intro a b f _ _ hf rw [smul_add, AddMonoidHom.map_add, AddMonoidHom.map_add, smul_add, hf, ← single_smul, sumAddHom_single, sumAddHom_single, LinearMap.toAddMonoidHom_coe, LinearMap.map_smul] } invFun F i := F.comp (lsingle i) left_inv F := by ext simp right_inv F := by refine DFinsupp.lhom_ext' (fun i ↦ ?_) ext simp map_add' F G := by refine DFinsupp.lhom_ext' (fun i ↦ ?_) ext simp map_smul' c F := by refine DFinsupp.lhom_ext' (fun i ↦ ?_) ext simp #align dfinsupp.lsum DFinsupp.lsum
Mathlib/LinearAlgebra/DFinsupp.lean
170
172
theorem lsum_single [Semiring S] [Module S N] [SMulCommClass R S N] (F : ∀ i, M i →ₗ[R] N) (i) (x : M i) : lsum S (M := M) F (single i x) = F i x := by
simp
1
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.Nat.GCD.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.Linarith #align_import data.nat.choose.central from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace Nat def centralBinom (n : ℕ) := (2 * n).choose n #align nat.central_binom Nat.centralBinom theorem centralBinom_eq_two_mul_choose (n : ℕ) : centralBinom n = (2 * n).choose n := rfl #align nat.central_binom_eq_two_mul_choose Nat.centralBinom_eq_two_mul_choose theorem centralBinom_pos (n : ℕ) : 0 < centralBinom n := choose_pos (Nat.le_mul_of_pos_left _ zero_lt_two) #align nat.central_binom_pos Nat.centralBinom_pos theorem centralBinom_ne_zero (n : ℕ) : centralBinom n ≠ 0 := (centralBinom_pos n).ne' #align nat.central_binom_ne_zero Nat.centralBinom_ne_zero @[simp] theorem centralBinom_zero : centralBinom 0 = 1 := choose_zero_right _ #align nat.central_binom_zero Nat.centralBinom_zero theorem choose_le_centralBinom (r n : ℕ) : choose (2 * n) r ≤ centralBinom n := calc (2 * n).choose r ≤ (2 * n).choose (2 * n / 2) := choose_le_middle r (2 * n) _ = (2 * n).choose n := by rw [Nat.mul_div_cancel_left n zero_lt_two] #align nat.choose_le_central_binom Nat.choose_le_centralBinom theorem two_le_centralBinom (n : ℕ) (n_pos : 0 < n) : 2 ≤ centralBinom n := calc 2 ≤ 2 * n := Nat.le_mul_of_pos_right _ n_pos _ = (2 * n).choose 1 := (choose_one_right (2 * n)).symm _ ≤ centralBinom n := choose_le_centralBinom 1 n #align nat.two_le_central_binom Nat.two_le_centralBinom theorem succ_mul_centralBinom_succ (n : ℕ) : (n + 1) * centralBinom (n + 1) = 2 * (2 * n + 1) * centralBinom n := calc (n + 1) * (2 * (n + 1)).choose (n + 1) = (2 * n + 2).choose (n + 1) * (n + 1) := mul_comm _ _ _ = (2 * n + 1).choose n * (2 * n + 2) := by rw [choose_succ_right_eq, choose_mul_succ_eq] _ = 2 * ((2 * n + 1).choose n * (n + 1)) := by ring _ = 2 * ((2 * n + 1).choose n * (2 * n + 1 - n)) := by rw [two_mul n, add_assoc, Nat.add_sub_cancel_left] _ = 2 * ((2 * n).choose n * (2 * n + 1)) := by rw [choose_mul_succ_eq] _ = 2 * (2 * n + 1) * (2 * n).choose n := by rw [mul_assoc, mul_comm (2 * n + 1)] #align nat.succ_mul_central_binom_succ Nat.succ_mul_centralBinom_succ theorem four_pow_lt_mul_centralBinom (n : ℕ) (n_big : 4 ≤ n) : 4 ^ n < n * centralBinom n := by induction' n using Nat.strong_induction_on with n IH rcases lt_trichotomy n 4 with (hn | rfl | hn) · clear IH; exact False.elim ((not_lt.2 n_big) hn) · norm_num [centralBinom, choose] obtain ⟨n, rfl⟩ : ∃ m, n = m + 1 := Nat.exists_eq_succ_of_ne_zero (Nat.not_eq_zero_of_lt hn) calc 4 ^ (n + 1) < 4 * (n * centralBinom n) := lt_of_eq_of_lt pow_succ' <| (mul_lt_mul_left <| zero_lt_four' ℕ).mpr (IH n n.lt_succ_self (Nat.le_of_lt_succ hn)) _ ≤ 2 * (2 * n + 1) * centralBinom n := by rw [← mul_assoc]; linarith _ = (n + 1) * centralBinom (n + 1) := (succ_mul_centralBinom_succ n).symm #align nat.four_pow_lt_mul_central_binom Nat.four_pow_lt_mul_centralBinom
Mathlib/Data/Nat/Choose/Central.lean
105
115
theorem four_pow_le_two_mul_self_mul_centralBinom : ∀ (n : ℕ) (_ : 0 < n), 4 ^ n ≤ 2 * n * centralBinom n | 0, pr => (Nat.not_lt_zero _ pr).elim | 1, _ => by norm_num [centralBinom, choose] | 2, _ => by norm_num [centralBinom, choose] | 3, _ => by norm_num [centralBinom, choose] | n + 4, _ => calc 4 ^ (n+4) ≤ (n+4) * centralBinom (n+4) := (four_pow_lt_mul_centralBinom _ le_add_self).le _ ≤ 2 * (n+4) * centralBinom (n+4) := by
rw [mul_assoc]; refine Nat.le_mul_of_pos_left _ zero_lt_two
1
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs #align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F := (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv iteratedDeriv def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F := (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv_within iteratedDerivWithin variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜} theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by ext x rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ] #align iterated_deriv_within_univ iteratedDerivWithin_univ theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x = (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 := rfl #align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin
Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean
84
86
theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s = (ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by
ext x; rfl
1
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 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 #align integrable_on_exp_Iic integrableOn_exp_Iic theorem integral_exp_Iic (c : ℝ) : ∫ x : ℝ in Iic c, exp x = exp c := by refine tendsto_nhds_unique (intervalIntegral_tendsto_integral_Iic _ (integrableOn_exp_Iic _) tendsto_id) ?_ simp_rw [integral_exp, show 𝓝 (exp c) = 𝓝 (exp c - 0) by rw [sub_zero]] exact tendsto_exp_atBot.const_sub _ #align integral_exp_Iic integral_exp_Iic theorem integral_exp_Iic_zero : ∫ x : ℝ in Iic 0, exp x = 1 := exp_zero ▸ integral_exp_Iic 0 #align integral_exp_Iic_zero integral_exp_Iic_zero theorem integral_exp_neg_Ioi (c : ℝ) : (∫ x : ℝ in Ioi c, exp (-x)) = exp (-c) := by simpa only [integral_comp_neg_Ioi] using integral_exp_Iic (-c) #align integral_exp_neg_Ioi integral_exp_neg_Ioi
Mathlib/Analysis/SpecialFunctions/ImproperIntegrals.lean
57
58
theorem integral_exp_neg_Ioi_zero : (∫ x : ℝ in Ioi 0, exp (-x)) = 1 := by
simpa only [neg_zero, exp_zero] using integral_exp_neg_Ioi 0
1
import Mathlib.Algebra.Order.BigOperators.Ring.Finset import Mathlib.Analysis.Convex.Hull import Mathlib.LinearAlgebra.AffineSpace.Basis #align_import analysis.convex.combination from "leanprover-community/mathlib"@"92bd7b1ffeb306a89f450bee126ddd8a284c259d" open Set Function open scoped Classical open Pointwise universe u u' variable {R R' E F ι ι' α : Type*} [LinearOrderedField R] [LinearOrderedField R'] [AddCommGroup E] [AddCommGroup F] [LinearOrderedAddCommGroup α] [Module R E] [Module R F] [Module R α] [OrderedSMul R α] {s : Set E} def Finset.centerMass (t : Finset ι) (w : ι → R) (z : ι → E) : E := (∑ i ∈ t, w i)⁻¹ • ∑ i ∈ t, w i • z i #align finset.center_mass Finset.centerMass variable (i j : ι) (c : R) (t : Finset ι) (w : ι → R) (z : ι → E) open Finset theorem Finset.centerMass_empty : (∅ : Finset ι).centerMass w z = 0 := by simp only [centerMass, sum_empty, smul_zero] #align finset.center_mass_empty Finset.centerMass_empty
Mathlib/Analysis/Convex/Combination.lean
54
56
theorem Finset.centerMass_pair (hne : i ≠ j) : ({i, j} : Finset ι).centerMass w z = (w i / (w i + w j)) • z i + (w j / (w i + w j)) • z j := by
simp only [centerMass, sum_pair hne, smul_add, (mul_smul _ _ _).symm, div_eq_inv_mul]
1
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
Mathlib/Topology/Perfect.lean
87
88
theorem preperfect_iff_nhds : Preperfect C ↔ ∀ x ∈ C, ∀ U ∈ 𝓝 x, ∃ y ∈ U ∩ C, y ≠ x := by
simp only [Preperfect, accPt_iff_nhds]
1
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by erw [constr_basis b, constr_basis b] simp only [eq_comm] #align basis.to_dual_apply Basis.toDual_apply @[simp] theorem toDual_total_left (f : ι →₀ R) (i : ι) : b.toDual (Finsupp.total ι M R b f) (b i) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply] simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq'] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_left Basis.toDual_total_left @[simp] theorem toDual_total_right (f : ι →₀ R) (i : ι) : b.toDual (b i) (Finsupp.total ι M R b f) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum] simp_rw [LinearMap.map_smul, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_right Basis.toDual_total_right theorem toDual_apply_left (m : M) (i : ι) : b.toDual m (b i) = b.repr m i := by rw [← b.toDual_total_left, b.total_repr] #align basis.to_dual_apply_left Basis.toDual_apply_left
Mathlib/LinearAlgebra/Dual.lean
333
334
theorem toDual_apply_right (i : ι) (m : M) : b.toDual (b i) m = b.repr m i := by
rw [← b.toDual_total_right, b.total_repr]
1
import Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing import Mathlib.AlgebraicGeometry.OpenImmersion #align_import algebraic_geometry.gluing from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false noncomputable section universe u open TopologicalSpace CategoryTheory Opposite open CategoryTheory.Limits AlgebraicGeometry.PresheafedSpace open CategoryTheory.GlueData namespace AlgebraicGeometry namespace Scheme -- Porting note(#5171): @[nolint has_nonempty_instance]; linter not ported yet structure GlueData extends CategoryTheory.GlueData Scheme where f_open : ∀ i j, IsOpenImmersion (f i j) #align algebraic_geometry.Scheme.glue_data AlgebraicGeometry.Scheme.GlueData attribute [instance] GlueData.f_open namespace OpenCover variable {X : Scheme.{u}} (𝒰 : OpenCover.{u} X) def gluedCoverT' (x y z : 𝒰.J) : pullback (pullback.fst : pullback (𝒰.map x) (𝒰.map y) ⟶ _) (pullback.fst : pullback (𝒰.map x) (𝒰.map z) ⟶ _) ⟶ pullback (pullback.fst : pullback (𝒰.map y) (𝒰.map z) ⟶ _) (pullback.fst : pullback (𝒰.map y) (𝒰.map x) ⟶ _) := by refine (pullbackRightPullbackFstIso _ _ _).hom ≫ ?_ refine ?_ ≫ (pullbackSymmetry _ _).hom refine ?_ ≫ (pullbackRightPullbackFstIso _ _ _).inv refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (𝟙 _) (𝟙 _) ?_ ?_ · simp [pullback.condition] · simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t' AlgebraicGeometry.Scheme.OpenCover.gluedCoverT' @[simp, reassoc] theorem gluedCoverT'_fst_fst (x y z : 𝒰.J) : 𝒰.gluedCoverT' x y z ≫ pullback.fst ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_fst @[simp, reassoc] theorem gluedCoverT'_fst_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.fst ≫ pullback.snd = pullback.snd ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_snd AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_snd @[simp, reassoc] theorem gluedCoverT'_snd_fst (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_snd_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_snd_fst @[simp, reassoc]
Mathlib/AlgebraicGeometry/Gluing.lean
314
316
theorem gluedCoverT'_snd_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.snd = pullback.fst ≫ pullback.fst := by
delta gluedCoverT'; simp
1
import Mathlib.CategoryTheory.Subobject.Lattice #align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d" universe v u noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite variable {C : Type u} [Category.{v} C] {X Y Z : C} namespace CategoryTheory namespace Limits section Kernel variable [HasZeroMorphisms C] (f : X ⟶ Y) [HasKernel f] abbrev kernelSubobject : Subobject X := Subobject.mk (kernel.ι f) #align category_theory.limits.kernel_subobject CategoryTheory.Limits.kernelSubobject def kernelSubobjectIso : (kernelSubobject f : C) ≅ kernel f := Subobject.underlyingIso (kernel.ι f) #align category_theory.limits.kernel_subobject_iso CategoryTheory.Limits.kernelSubobjectIso @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobject_arrow : (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow := by simp [kernelSubobjectIso] #align category_theory.limits.kernel_subobject_arrow CategoryTheory.Limits.kernelSubobject_arrow @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobject_arrow' : (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f := by simp [kernelSubobjectIso] #align category_theory.limits.kernel_subobject_arrow' CategoryTheory.Limits.kernelSubobject_arrow' @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobject_arrow_comp : (kernelSubobject f).arrow ≫ f = 0 := by rw [← kernelSubobject_arrow] simp only [Category.assoc, kernel.condition, comp_zero] #align category_theory.limits.kernel_subobject_arrow_comp CategoryTheory.Limits.kernelSubobject_arrow_comp theorem kernelSubobject_factors {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : (kernelSubobject f).Factors h := ⟨kernel.lift _ h w, by simp⟩ #align category_theory.limits.kernel_subobject_factors CategoryTheory.Limits.kernelSubobject_factors theorem kernelSubobject_factors_iff {W : C} (h : W ⟶ X) : (kernelSubobject f).Factors h ↔ h ≫ f = 0 := ⟨fun w => by rw [← Subobject.factorThru_arrow _ _ w, Category.assoc, kernelSubobject_arrow_comp, comp_zero], kernelSubobject_factors f h⟩ #align category_theory.limits.kernel_subobject_factors_iff CategoryTheory.Limits.kernelSubobject_factors_iff def factorThruKernelSubobject {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : W ⟶ kernelSubobject f := (kernelSubobject f).factorThru h (kernelSubobject_factors f h w) #align category_theory.limits.factor_thru_kernel_subobject CategoryTheory.Limits.factorThruKernelSubobject @[simp] theorem factorThruKernelSubobject_comp_arrow {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : factorThruKernelSubobject f h w ≫ (kernelSubobject f).arrow = h := by dsimp [factorThruKernelSubobject] simp #align category_theory.limits.factor_thru_kernel_subobject_comp_arrow CategoryTheory.Limits.factorThruKernelSubobject_comp_arrow @[simp] theorem factorThruKernelSubobject_comp_kernelSubobjectIso {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : factorThruKernelSubobject f h w ≫ (kernelSubobjectIso f).hom = kernel.lift f h w := (cancel_mono (kernel.ι f)).1 <| by simp #align category_theory.limits.factor_thru_kernel_subobject_comp_kernel_subobject_iso CategoryTheory.Limits.factorThruKernelSubobject_comp_kernelSubobjectIso section variable {f} {X' Y' : C} {f' : X' ⟶ Y'} [HasKernel f'] def kernelSubobjectMap (sq : Arrow.mk f ⟶ Arrow.mk f') : (kernelSubobject f : C) ⟶ (kernelSubobject f' : C) := Subobject.factorThru _ ((kernelSubobject f).arrow ≫ sq.left) (kernelSubobject_factors _ _ (by simp [sq.w])) #align category_theory.limits.kernel_subobject_map CategoryTheory.Limits.kernelSubobjectMap @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobjectMap_arrow (sq : Arrow.mk f ⟶ Arrow.mk f') : kernelSubobjectMap sq ≫ (kernelSubobject f').arrow = (kernelSubobject f).arrow ≫ sq.left := by simp [kernelSubobjectMap] #align category_theory.limits.kernel_subobject_map_arrow CategoryTheory.Limits.kernelSubobjectMap_arrow @[simp] theorem kernelSubobjectMap_id : kernelSubobjectMap (𝟙 (Arrow.mk f)) = 𝟙 _ := by aesop_cat #align category_theory.limits.kernel_subobject_map_id CategoryTheory.Limits.kernelSubobjectMap_id @[simp]
Mathlib/CategoryTheory/Subobject/Limits.lean
168
171
theorem kernelSubobjectMap_comp {X'' Y'' : C} {f'' : X'' ⟶ Y''} [HasKernel f''] (sq : Arrow.mk f ⟶ Arrow.mk f') (sq' : Arrow.mk f' ⟶ Arrow.mk f'') : kernelSubobjectMap (sq ≫ sq') = kernelSubobjectMap sq ≫ kernelSubobjectMap sq' := by
aesop_cat
1
import Mathlib.Data.Finset.Grade import Mathlib.Order.Interval.Finset.Basic #align_import data.finset.interval from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" variable {α β : Type*} namespace Finset section Decidable variable [DecidableEq α] (s t : Finset α) instance instLocallyFiniteOrder : LocallyFiniteOrder (Finset α) where finsetIcc s t := t.powerset.filter (s ⊆ ·) finsetIco s t := t.ssubsets.filter (s ⊆ ·) finsetIoc s t := t.powerset.filter (s ⊂ ·) finsetIoo s t := t.ssubsets.filter (s ⊂ ·) finset_mem_Icc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ico s t u := by rw [mem_filter, mem_ssubsets] exact and_comm finset_mem_Ioc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ioo s t u := by rw [mem_filter, mem_ssubsets] exact and_comm theorem Icc_eq_filter_powerset : Icc s t = t.powerset.filter (s ⊆ ·) := rfl #align finset.Icc_eq_filter_powerset Finset.Icc_eq_filter_powerset theorem Ico_eq_filter_ssubsets : Ico s t = t.ssubsets.filter (s ⊆ ·) := rfl #align finset.Ico_eq_filter_ssubsets Finset.Ico_eq_filter_ssubsets theorem Ioc_eq_filter_powerset : Ioc s t = t.powerset.filter (s ⊂ ·) := rfl #align finset.Ioc_eq_filter_powerset Finset.Ioc_eq_filter_powerset theorem Ioo_eq_filter_ssubsets : Ioo s t = t.ssubsets.filter (s ⊂ ·) := rfl #align finset.Ioo_eq_filter_ssubsets Finset.Ioo_eq_filter_ssubsets theorem Iic_eq_powerset : Iic s = s.powerset := filter_true_of_mem fun t _ => empty_subset t #align finset.Iic_eq_powerset Finset.Iic_eq_powerset theorem Iio_eq_ssubsets : Iio s = s.ssubsets := filter_true_of_mem fun t _ => empty_subset t #align finset.Iio_eq_ssubsets Finset.Iio_eq_ssubsets variable {s t} theorem Icc_eq_image_powerset (h : s ⊆ t) : Icc s t = (t \ s).powerset.image (s ∪ ·) := by ext u simp_rw [mem_Icc, mem_image, mem_powerset] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_le_sdiff_right ht, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, union_subset h <| hv.trans sdiff_subset⟩ #align finset.Icc_eq_image_powerset Finset.Icc_eq_image_powerset theorem Ico_eq_image_ssubsets (h : s ⊆ t) : Ico s t = (t \ s).ssubsets.image (s ∪ ·) := by ext u simp_rw [mem_Ico, mem_image, mem_ssubsets] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_lt_sdiff_right ht hs, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, sup_lt_of_lt_sdiff_left hv h⟩ #align finset.Ico_eq_image_ssubsets Finset.Ico_eq_image_ssubsets theorem card_Icc_finset (h : s ⊆ t) : (Icc s t).card = 2 ^ (t.card - s.card) := by rw [← card_sdiff h, ← card_powerset, Icc_eq_image_powerset h, Finset.card_image_iff] rintro u hu v hv (huv : s ⊔ u = s ⊔ v) rw [mem_coe, mem_powerset] at hu hv rw [← (disjoint_sdiff.mono_right hu : Disjoint s u).sup_sdiff_cancel_left, ← (disjoint_sdiff.mono_right hv : Disjoint s v).sup_sdiff_cancel_left, huv] #align finset.card_Icc_finset Finset.card_Icc_finset theorem card_Ico_finset (h : s ⊆ t) : (Ico s t).card = 2 ^ (t.card - s.card) - 1 := by rw [card_Ico_eq_card_Icc_sub_one, card_Icc_finset h] #align finset.card_Ico_finset Finset.card_Ico_finset theorem card_Ioc_finset (h : s ⊆ t) : (Ioc s t).card = 2 ^ (t.card - s.card) - 1 := by rw [card_Ioc_eq_card_Icc_sub_one, card_Icc_finset h] #align finset.card_Ioc_finset Finset.card_Ioc_finset theorem card_Ioo_finset (h : s ⊆ t) : (Ioo s t).card = 2 ^ (t.card - s.card) - 2 := by rw [card_Ioo_eq_card_Icc_sub_two, card_Icc_finset h] #align finset.card_Ioo_finset Finset.card_Ioo_finset
Mathlib/Data/Finset/Interval.lean
125
125
theorem card_Iic_finset : (Iic s).card = 2 ^ s.card := by
rw [Iic_eq_powerset, card_powerset]
1
import Aesop import Mathlib.Algebra.Group.Defs import Mathlib.Data.Nat.Defs import Mathlib.Data.Int.Defs import Mathlib.Logic.Function.Basic import Mathlib.Tactic.Cases import Mathlib.Tactic.SimpRw import Mathlib.Tactic.SplitIfs #align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered open Function universe u variable {α β G M : Type*} @[to_additive] instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (α := G) (· * ·) := ⟨mul_comm⟩ #align comm_semigroup.to_is_commutative CommMagma.to_isCommutative #align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative section CommSemigroup variable [CommSemigroup G] @[to_additive] theorem mul_left_comm : ∀ a b c : G, a * (b * c) = b * (a * c) := left_comm Mul.mul mul_comm mul_assoc #align mul_left_comm mul_left_comm #align add_left_comm add_left_comm @[to_additive] theorem mul_right_comm : ∀ a b c : G, a * b * c = a * c * b := right_comm Mul.mul mul_comm mul_assoc #align mul_right_comm mul_right_comm #align add_right_comm add_right_comm @[to_additive] theorem mul_mul_mul_comm (a b c d : G) : a * b * (c * d) = a * c * (b * d) := by simp only [mul_left_comm, mul_assoc] #align mul_mul_mul_comm mul_mul_mul_comm #align add_add_add_comm add_add_add_comm @[to_additive]
Mathlib/Algebra/Group/Basic.lean
202
203
theorem mul_rotate (a b c : G) : a * b * c = b * c * a := by
simp only [mul_left_comm, mul_comm]
1
import Mathlib.Data.Part import Mathlib.Data.Rel #align_import data.pfun from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" open Function def PFun (α β : Type*) := α → Part β #align pfun PFun infixr:25 " →. " => PFun namespace PFun variable {α β γ δ ε ι : Type*} instance inhabited : Inhabited (α →. β) := ⟨fun _ => Part.none⟩ #align pfun.inhabited PFun.inhabited def Dom (f : α →. β) : Set α := { a | (f a).Dom } #align pfun.dom PFun.Dom @[simp]
Mathlib/Data/PFun.lean
80
80
theorem mem_dom (f : α →. β) (x : α) : x ∈ Dom f ↔ ∃ y, y ∈ f x := by
simp [Dom, Part.dom_iff_mem]
1
import Mathlib.Data.DFinsupp.Interval import Mathlib.Data.DFinsupp.Multiset import Mathlib.Order.Interval.Finset.Nat #align_import data.multiset.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset DFinsupp Function open Pointwise variable {α : Type*} namespace Multiset variable [DecidableEq α] (s t : Multiset α) instance instLocallyFiniteOrder : LocallyFiniteOrder (Multiset α) := LocallyFiniteOrder.ofIcc (Multiset α) (fun s t => (Finset.Icc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding) fun s t x => by simp theorem Icc_eq : Finset.Icc s t = (Finset.Icc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding := rfl #align multiset.Icc_eq Multiset.Icc_eq theorem uIcc_eq : uIcc s t = (uIcc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding := (Icc_eq _ _).trans <| by simp [uIcc] #align multiset.uIcc_eq Multiset.uIcc_eq theorem card_Icc : (Finset.Icc s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) := by simp_rw [Icc_eq, Finset.card_map, DFinsupp.card_Icc, Nat.card_Icc, Multiset.toDFinsupp_apply, toDFinsupp_support] #align multiset.card_Icc Multiset.card_Icc theorem card_Ico : (Finset.Ico s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) - 1 := by rw [Finset.card_Ico_eq_card_Icc_sub_one, card_Icc] #align multiset.card_Ico Multiset.card_Ico theorem card_Ioc : (Finset.Ioc s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) - 1 := by rw [Finset.card_Ioc_eq_card_Icc_sub_one, card_Icc] #align multiset.card_Ioc Multiset.card_Ioc
Mathlib/Data/Multiset/Interval.lean
72
74
theorem card_Ioo : (Finset.Ioo s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) - 2 := by
rw [Finset.card_Ioo_eq_card_Icc_sub_two, card_Icc]
1
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]
Mathlib/Order/WellFoundedSet.lean
92
93
theorem wellFoundedOn_univ : (univ : Set α).WellFoundedOn r ↔ WellFounded r := by
simp [wellFoundedOn_iff]
1
import Mathlib.FieldTheory.RatFunc.Defs import Mathlib.RingTheory.EuclideanDomain import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Polynomial.Content #align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6" universe u v noncomputable section open scoped Classical open scoped nonZeroDivisors Polynomial variable {K : Type u} namespace RatFunc section Field variable [CommRing K] protected irreducible_def zero : RatFunc K := ⟨0⟩ #align ratfunc.zero RatFunc.zero instance : Zero (RatFunc K) := ⟨RatFunc.zero⟩ -- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [zero_def]` -- that does not close the goal theorem ofFractionRing_zero : (ofFractionRing 0 : RatFunc K) = 0 := by simp only [Zero.zero, OfNat.ofNat, RatFunc.zero] #align ratfunc.of_fraction_ring_zero RatFunc.ofFractionRing_zero protected irreducible_def add : RatFunc K → RatFunc K → RatFunc K | ⟨p⟩, ⟨q⟩ => ⟨p + q⟩ #align ratfunc.add RatFunc.add instance : Add (RatFunc K) := ⟨RatFunc.add⟩ -- Porting note: added `HAdd.hAdd`. using `simp?` produces `simp only [add_def]` -- that does not close the goal theorem ofFractionRing_add (p q : FractionRing K[X]) : ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q := by simp only [HAdd.hAdd, Add.add, RatFunc.add] #align ratfunc.of_fraction_ring_add RatFunc.ofFractionRing_add protected irreducible_def sub : RatFunc K → RatFunc K → RatFunc K | ⟨p⟩, ⟨q⟩ => ⟨p - q⟩ #align ratfunc.sub RatFunc.sub instance : Sub (RatFunc K) := ⟨RatFunc.sub⟩ -- Porting note: added `HSub.hSub`. using `simp?` produces `simp only [sub_def]` -- that does not close the goal theorem ofFractionRing_sub (p q : FractionRing K[X]) : ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q := by simp only [Sub.sub, HSub.hSub, RatFunc.sub] #align ratfunc.of_fraction_ring_sub RatFunc.ofFractionRing_sub protected irreducible_def neg : RatFunc K → RatFunc K | ⟨p⟩ => ⟨-p⟩ #align ratfunc.neg RatFunc.neg instance : Neg (RatFunc K) := ⟨RatFunc.neg⟩ theorem ofFractionRing_neg (p : FractionRing K[X]) : ofFractionRing (-p) = -ofFractionRing p := by simp only [Neg.neg, RatFunc.neg] #align ratfunc.of_fraction_ring_neg RatFunc.ofFractionRing_neg protected irreducible_def one : RatFunc K := ⟨1⟩ #align ratfunc.one RatFunc.one instance : One (RatFunc K) := ⟨RatFunc.one⟩ -- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [one_def]` -- that does not close the goal theorem ofFractionRing_one : (ofFractionRing 1 : RatFunc K) = 1 := by simp only [One.one, OfNat.ofNat, RatFunc.one] #align ratfunc.of_fraction_ring_one RatFunc.ofFractionRing_one protected irreducible_def mul : RatFunc K → RatFunc K → RatFunc K | ⟨p⟩, ⟨q⟩ => ⟨p * q⟩ #align ratfunc.mul RatFunc.mul instance : Mul (RatFunc K) := ⟨RatFunc.mul⟩ -- Porting note: added `HMul.hMul`. using `simp?` produces `simp only [mul_def]` -- that does not close the goal theorem ofFractionRing_mul (p q : FractionRing K[X]) : ofFractionRing (p * q) = ofFractionRing p * ofFractionRing q := by simp only [Mul.mul, HMul.hMul, RatFunc.mul] #align ratfunc.of_fraction_ring_mul RatFunc.ofFractionRing_mul section IsDomain variable [IsDomain K] protected irreducible_def div : RatFunc K → RatFunc K → RatFunc K | ⟨p⟩, ⟨q⟩ => ⟨p / q⟩ #align ratfunc.div RatFunc.div instance : Div (RatFunc K) := ⟨RatFunc.div⟩ -- Porting note: added `HDiv.hDiv`. using `simp?` produces `simp only [div_def]` -- that does not close the goal
Mathlib/FieldTheory/RatFunc/Basic.lean
164
166
theorem ofFractionRing_div (p q : FractionRing K[X]) : ofFractionRing (p / q) = ofFractionRing p / ofFractionRing q := by
simp only [Div.div, HDiv.hDiv, RatFunc.div]
1
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Algebra.Order.Field.Defs import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Order.Bounds.OrderIso import Mathlib.Tactic.Positivity.Core #align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd" open Function OrderDual variable {ι α β : Type*} section LinearOrderedSemifield variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ} @[simps! (config := { simpRhs := true })] def OrderIso.mulLeft₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulLeft₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha } #align order_iso.mul_left₀ OrderIso.mulLeft₀ #align order_iso.mul_left₀_symm_apply OrderIso.mulLeft₀_symm_apply #align order_iso.mul_left₀_apply OrderIso.mulLeft₀_apply @[simps! (config := { simpRhs := true })] def OrderIso.mulRight₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulRight₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha } #align order_iso.mul_right₀ OrderIso.mulRight₀ #align order_iso.mul_right₀_symm_apply OrderIso.mulRight₀_symm_apply #align order_iso.mul_right₀_apply OrderIso.mulRight₀_apply theorem le_div_iff (hc : 0 < c) : a ≤ b / c ↔ a * c ≤ b := ⟨fun h => div_mul_cancel₀ b (ne_of_lt hc).symm ▸ mul_le_mul_of_nonneg_right h hc.le, fun h => calc a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm _ ≤ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le _ = b / c := (div_eq_mul_one_div b c).symm ⟩ #align le_div_iff le_div_iff theorem le_div_iff' (hc : 0 < c) : a ≤ b / c ↔ c * a ≤ b := by rw [mul_comm, le_div_iff hc] #align le_div_iff' le_div_iff' theorem div_le_iff (hb : 0 < b) : a / b ≤ c ↔ a ≤ c * b := ⟨fun h => calc a = a / b * b := by rw [div_mul_cancel₀ _ (ne_of_lt hb).symm] _ ≤ c * b := mul_le_mul_of_nonneg_right h hb.le , fun h => calc a / b = a * (1 / b) := div_eq_mul_one_div a b _ ≤ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le _ = c * b / b := (div_eq_mul_one_div (c * b) b).symm _ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl ⟩ #align div_le_iff div_le_iff theorem div_le_iff' (hb : 0 < b) : a / b ≤ c ↔ a ≤ b * c := by rw [mul_comm, div_le_iff hb] #align div_le_iff' div_le_iff' lemma div_le_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b ≤ c ↔ a / c ≤ b := by rw [div_le_iff hb, div_le_iff' hc] theorem lt_div_iff (hc : 0 < c) : a < b / c ↔ a * c < b := lt_iff_lt_of_le_iff_le <| div_le_iff hc #align lt_div_iff lt_div_iff theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b := by rw [mul_comm, lt_div_iff hc] #align lt_div_iff' lt_div_iff' theorem div_lt_iff (hc : 0 < c) : b / c < a ↔ b < a * c := lt_iff_lt_of_le_iff_le (le_div_iff hc) #align div_lt_iff div_lt_iff theorem div_lt_iff' (hc : 0 < c) : b / c < a ↔ b < c * a := by rw [mul_comm, div_lt_iff hc] #align div_lt_iff' div_lt_iff' lemma div_lt_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b < c ↔ a / c < b := by rw [div_lt_iff hb, div_lt_iff' hc] theorem inv_mul_le_iff (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ b * c := by rw [inv_eq_one_div, mul_comm, ← div_eq_mul_one_div] exact div_le_iff' h #align inv_mul_le_iff inv_mul_le_iff theorem inv_mul_le_iff' (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ c * b := by rw [inv_mul_le_iff h, mul_comm] #align inv_mul_le_iff' inv_mul_le_iff'
Mathlib/Algebra/Order/Field/Basic.lean
107
107
theorem mul_inv_le_iff (h : 0 < b) : a * b⁻¹ ≤ c ↔ a ≤ b * c := by
rw [mul_comm, inv_mul_le_iff h]
1
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp] theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs] #align real.logb_abs Real.logb_abs @[simp]
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
68
69
theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by
rw [← logb_abs x, ← logb_abs (-x), abs_neg]
1
import Mathlib.SetTheory.Cardinal.Finite #align_import data.set.ncard from "leanprover-community/mathlib"@"74c2af38a828107941029b03839882c5c6f87a04" namespace Set variable {α β : Type*} {s t : Set α} noncomputable def encard (s : Set α) : ℕ∞ := PartENat.withTopEquiv (PartENat.card s) @[simp] theorem encard_univ_coe (s : Set α) : encard (univ : Set s) = encard s := by rw [encard, encard, PartENat.card_congr (Equiv.Set.univ ↑s)] theorem encard_univ (α : Type*) : encard (univ : Set α) = PartENat.withTopEquiv (PartENat.card α) := by rw [encard, PartENat.card_congr (Equiv.Set.univ α)] theorem Finite.encard_eq_coe_toFinset_card (h : s.Finite) : s.encard = h.toFinset.card := by have := h.fintype rw [encard, PartENat.card_eq_coe_fintype_card, PartENat.withTopEquiv_natCast, toFinite_toFinset, toFinset_card] theorem encard_eq_coe_toFinset_card (s : Set α) [Fintype s] : encard s = s.toFinset.card := by have h := toFinite s rw [h.encard_eq_coe_toFinset_card, toFinite_toFinset] theorem encard_coe_eq_coe_finsetCard (s : Finset α) : encard (s : Set α) = s.card := by rw [Finite.encard_eq_coe_toFinset_card (Finset.finite_toSet s)]; simp theorem Infinite.encard_eq {s : Set α} (h : s.Infinite) : s.encard = ⊤ := by have := h.to_subtype rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.withTopEquiv_symm_top, PartENat.card_eq_top_of_infinite] @[simp] theorem encard_eq_zero : s.encard = 0 ↔ s = ∅ := by rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.withTopEquiv_symm_zero, PartENat.card_eq_zero_iff_empty, isEmpty_subtype, eq_empty_iff_forall_not_mem] @[simp] theorem encard_empty : (∅ : Set α).encard = 0 := by rw [encard_eq_zero] theorem nonempty_of_encard_ne_zero (h : s.encard ≠ 0) : s.Nonempty := by rwa [nonempty_iff_ne_empty, Ne, ← encard_eq_zero] theorem encard_ne_zero : s.encard ≠ 0 ↔ s.Nonempty := by rw [ne_eq, encard_eq_zero, nonempty_iff_ne_empty] @[simp] theorem encard_pos : 0 < s.encard ↔ s.Nonempty := by rw [pos_iff_ne_zero, encard_ne_zero] @[simp] theorem encard_singleton (e : α) : ({e} : Set α).encard = 1 := by rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.card_eq_coe_fintype_card, Fintype.card_ofSubsingleton, Nat.cast_one]; rfl theorem encard_union_eq (h : Disjoint s t) : (s ∪ t).encard = s.encard + t.encard := by classical have e := (Equiv.Set.union (by rwa [subset_empty_iff, ← disjoint_iff_inter_eq_empty])).symm simp [encard, ← PartENat.card_congr e, PartENat.card_sum, PartENat.withTopEquiv] theorem encard_insert_of_not_mem {a : α} (has : a ∉ s) : (insert a s).encard = s.encard + 1 := by rw [← union_singleton, encard_union_eq (by simpa), encard_singleton] theorem Finite.encard_lt_top (h : s.Finite) : s.encard < ⊤ := by refine h.induction_on (by simp) ?_ rintro a t hat _ ht' rw [encard_insert_of_not_mem hat] exact lt_tsub_iff_right.1 ht' theorem Finite.encard_eq_coe (h : s.Finite) : s.encard = ENat.toNat s.encard := (ENat.coe_toNat h.encard_lt_top.ne).symm theorem Finite.exists_encard_eq_coe (h : s.Finite) : ∃ (n : ℕ), s.encard = n := ⟨_, h.encard_eq_coe⟩ @[simp] theorem encard_lt_top_iff : s.encard < ⊤ ↔ s.Finite := ⟨fun h ↦ by_contra fun h' ↦ h.ne (Infinite.encard_eq h'), Finite.encard_lt_top⟩ @[simp] theorem encard_eq_top_iff : s.encard = ⊤ ↔ s.Infinite := by rw [← not_iff_not, ← Ne, ← lt_top_iff_ne_top, encard_lt_top_iff, not_infinite] theorem encard_ne_top_iff : s.encard ≠ ⊤ ↔ s.Finite := by simp
Mathlib/Data/Set/Card.lean
140
141
theorem finite_of_encard_le_coe {k : ℕ} (h : s.encard ≤ k) : s.Finite := by
rw [← encard_lt_top_iff]; exact h.trans_lt (WithTop.coe_lt_top _)
1
import Batteries.Data.UInt @[ext] theorem Char.ext : {a b : Char} → a.val = b.val → a = b | ⟨_,_⟩, ⟨_,_⟩, rfl => rfl theorem Char.ext_iff {x y : Char} : x = y ↔ x.val = y.val := ⟨congrArg _, Char.ext⟩ theorem Char.le_antisymm_iff {x y : Char} : x = y ↔ x ≤ y ∧ y ≤ x := Char.ext_iff.trans UInt32.le_antisymm_iff theorem Char.le_antisymm {x y : Char} (h1 : x ≤ y) (h2 : y ≤ x) : x = y := Char.le_antisymm_iff.2 ⟨h1, h2⟩ instance : Batteries.LawfulOrd Char := .compareOfLessAndEq (fun _ => Nat.lt_irrefl _) Nat.lt_trans Nat.not_lt Char.le_antisymm namespace String private theorem csize_eq (c) : csize c = 1 ∨ csize c = 2 ∨ csize c = 3 ∨ csize c = 4 := by simp only [csize, Char.utf8Size] repeat (first | split | (solve | simp (config := {decide := true})))
.lake/packages/batteries/Batteries/Data/Char.lean
30
31
theorem csize_pos (c) : 0 < csize c := by
rcases csize_eq c with _|_|_|_ <;> simp_all (config := {decide := true})
1
import Mathlib.Data.ENNReal.Inv #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal section iInf variable {ι : Sort*} {f g : ι → ℝ≥0∞} variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} theorem toNNReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toNNReal = ⨅ i, (f i).toNNReal := by cases isEmpty_or_nonempty ι · rw [iInf_of_empty, top_toNNReal, NNReal.iInf_empty] · lift f to ι → ℝ≥0 using hf simp_rw [← coe_iInf, toNNReal_coe] #align ennreal.to_nnreal_infi ENNReal.toNNReal_iInf theorem toNNReal_sInf (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) : (sInf s).toNNReal = sInf (ENNReal.toNNReal '' s) := by have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs -- Porting note: `← sInf_image'` had to be replaced by `← image_eq_range` as the lemmas are used -- in a different order. simpa only [← sInf_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iInf hf) #align ennreal.to_nnreal_Inf ENNReal.toNNReal_sInf theorem toNNReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toNNReal = ⨆ i, (f i).toNNReal := by lift f to ι → ℝ≥0 using hf simp_rw [toNNReal_coe] by_cases h : BddAbove (range f) · rw [← coe_iSup h, toNNReal_coe] · rw [NNReal.iSup_of_not_bddAbove h, iSup_coe_eq_top.2 h, top_toNNReal] #align ennreal.to_nnreal_supr ENNReal.toNNReal_iSup theorem toNNReal_sSup (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) : (sSup s).toNNReal = sSup (ENNReal.toNNReal '' s) := by have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs -- Porting note: `← sSup_image'` had to be replaced by `← image_eq_range` as the lemmas are used -- in a different order. simpa only [← sSup_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iSup hf) #align ennreal.to_nnreal_Sup ENNReal.toNNReal_sSup theorem toReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toReal = ⨅ i, (f i).toReal := by simp only [ENNReal.toReal, toNNReal_iInf hf, NNReal.coe_iInf] #align ennreal.to_real_infi ENNReal.toReal_iInf theorem toReal_sInf (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) : (sInf s).toReal = sInf (ENNReal.toReal '' s) := by simp only [ENNReal.toReal, toNNReal_sInf s hf, NNReal.coe_sInf, Set.image_image] #align ennreal.to_real_Inf ENNReal.toReal_sInf theorem toReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toReal = ⨆ i, (f i).toReal := by simp only [ENNReal.toReal, toNNReal_iSup hf, NNReal.coe_iSup] #align ennreal.to_real_supr ENNReal.toReal_iSup theorem toReal_sSup (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) : (sSup s).toReal = sSup (ENNReal.toReal '' s) := by simp only [ENNReal.toReal, toNNReal_sSup s hf, NNReal.coe_sSup, Set.image_image] #align ennreal.to_real_Sup ENNReal.toReal_sSup theorem iInf_add : iInf f + a = ⨅ i, f i + a := le_antisymm (le_iInf fun _ => add_le_add (iInf_le _ _) <| le_rfl) (tsub_le_iff_right.1 <| le_iInf fun _ => tsub_le_iff_right.2 <| iInf_le _ _) #align ennreal.infi_add ENNReal.iInf_add theorem iSup_sub : (⨆ i, f i) - a = ⨆ i, f i - a := le_antisymm (tsub_le_iff_right.2 <| iSup_le fun i => tsub_le_iff_right.1 <| le_iSup (f · - a) i) (iSup_le fun _ => tsub_le_tsub (le_iSup _ _) (le_refl a)) #align ennreal.supr_sub ENNReal.iSup_sub theorem sub_iInf : (a - ⨅ i, f i) = ⨆ i, a - f i := by refine eq_of_forall_ge_iff fun c => ?_ rw [tsub_le_iff_right, add_comm, iInf_add] simp [tsub_le_iff_right, sub_eq_add_neg, add_comm] #align ennreal.sub_infi ENNReal.sub_iInf theorem sInf_add {s : Set ℝ≥0∞} : sInf s + a = ⨅ b ∈ s, b + a := by simp [sInf_eq_iInf, iInf_add] #align ennreal.Inf_add ENNReal.sInf_add
Mathlib/Data/ENNReal/Real.lean
609
610
theorem add_iInf {a : ℝ≥0∞} : a + iInf f = ⨅ b, a + f b := by
rw [add_comm, iInf_add]; simp [add_comm]
1
import Mathlib.Algebra.Group.Units import Mathlib.Algebra.GroupWithZero.Basic import Mathlib.Logic.Equiv.Defs import Mathlib.Tactic.Contrapose import Mathlib.Tactic.Nontriviality import Mathlib.Tactic.Spread import Mathlib.Util.AssertExists #align_import algebra.group_with_zero.units.basic from "leanprover-community/mathlib"@"df5e9937a06fdd349fc60106f54b84d47b1434f0" -- Guard against import creep assert_not_exists Multiplicative assert_not_exists DenselyOrdered variable {α M₀ G₀ M₀' G₀' F F' : Type*} variable [MonoidWithZero M₀] @[simp] theorem isUnit_zero_iff : IsUnit (0 : M₀) ↔ (0 : M₀) = 1 := ⟨fun ⟨⟨_, a, (a0 : 0 * a = 1), _⟩, rfl⟩ => by rwa [zero_mul] at a0, fun h => @isUnit_of_subsingleton _ _ (subsingleton_of_zero_eq_one h) 0⟩ #align is_unit_zero_iff isUnit_zero_iff -- Porting note: removed `simp` tag because `simpNF` says it's redundant theorem not_isUnit_zero [Nontrivial M₀] : ¬IsUnit (0 : M₀) := mt isUnit_zero_iff.1 zero_ne_one #align not_is_unit_zero not_isUnit_zero namespace Ring open scoped Classical noncomputable def inverse : M₀ → M₀ := fun x => if h : IsUnit x then ((h.unit⁻¹ : M₀ˣ) : M₀) else 0 #align ring.inverse Ring.inverse @[simp] theorem inverse_unit (u : M₀ˣ) : inverse (u : M₀) = (u⁻¹ : M₀ˣ) := by rw [inverse, dif_pos u.isUnit, IsUnit.unit_of_val_units] #align ring.inverse_unit Ring.inverse_unit @[simp] theorem inverse_non_unit (x : M₀) (h : ¬IsUnit x) : inverse x = 0 := dif_neg h #align ring.inverse_non_unit Ring.inverse_non_unit theorem mul_inverse_cancel (x : M₀) (h : IsUnit x) : x * inverse x = 1 := by rcases h with ⟨u, rfl⟩ rw [inverse_unit, Units.mul_inv] #align ring.mul_inverse_cancel Ring.mul_inverse_cancel theorem inverse_mul_cancel (x : M₀) (h : IsUnit x) : inverse x * x = 1 := by rcases h with ⟨u, rfl⟩ rw [inverse_unit, Units.inv_mul] #align ring.inverse_mul_cancel Ring.inverse_mul_cancel
Mathlib/Algebra/GroupWithZero/Units/Basic.lean
118
119
theorem mul_inverse_cancel_right (x y : M₀) (h : IsUnit x) : y * x * inverse x = y := by
rw [mul_assoc, mul_inverse_cancel x h, mul_one]
1
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp] theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs] #align real.logb_abs Real.logb_abs @[simp] theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by rw [← logb_abs x, ← logb_abs (-x), abs_neg] #align real.logb_neg_eq_logb Real.logb_neg_eq_logb theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by simp_rw [logb, log_mul hx hy, add_div] #align real.logb_mul Real.logb_mul theorem logb_div (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x / y) = logb b x - logb b y := by simp_rw [logb, log_div hx hy, sub_div] #align real.logb_div Real.logb_div @[simp] theorem logb_inv (x : ℝ) : logb b x⁻¹ = -logb b x := by simp [logb, neg_div] #align real.logb_inv Real.logb_inv theorem inv_logb (a b : ℝ) : (logb a b)⁻¹ = logb b a := by simp_rw [logb, inv_div] #align real.inv_logb Real.inv_logb theorem inv_logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a * b) c)⁻¹ = (logb a c)⁻¹ + (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_mul h₁ h₂ #align real.inv_logb_mul_base Real.inv_logb_mul_base theorem inv_logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a / b) c)⁻¹ = (logb a c)⁻¹ - (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_div h₁ h₂ #align real.inv_logb_div_base Real.inv_logb_div_base theorem logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a * b) c = ((logb a c)⁻¹ + (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_mul_base h₁ h₂ c, inv_inv] #align real.logb_mul_base Real.logb_mul_base theorem logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a / b) c = ((logb a c)⁻¹ - (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_div_base h₁ h₂ c, inv_inv] #align real.logb_div_base Real.logb_div_base theorem mul_logb {a b c : ℝ} (h₁ : b ≠ 0) (h₂ : b ≠ 1) (h₃ : b ≠ -1) : logb a b * logb b c = logb a c := by unfold logb rw [mul_comm, div_mul_div_cancel _ (log_ne_zero.mpr ⟨h₁, h₂, h₃⟩)] #align real.mul_logb Real.mul_logb theorem div_logb {a b c : ℝ} (h₁ : c ≠ 0) (h₂ : c ≠ 1) (h₃ : c ≠ -1) : logb a c / logb b c = logb a b := div_div_div_cancel_left' _ _ <| log_ne_zero.mpr ⟨h₁, h₂, h₃⟩ #align real.div_logb Real.div_logb theorem logb_rpow_eq_mul_logb_of_pos (hx : 0 < x) : logb b (x ^ y) = y * logb b x := by rw [logb, log_rpow hx, logb, mul_div_assoc]
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
119
120
theorem logb_pow {k : ℕ} (hx : 0 < x) : logb b (x ^ k) = k * logb b x := by
rw [← rpow_natCast, logb_rpow_eq_mul_logb_of_pos hx]
1
import Mathlib.Algebra.Order.Hom.Monoid import Mathlib.SetTheory.Game.Ordinal #align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"8900d545017cd21961daa2a1734bb658ef52c618" universe u namespace SetTheory open scoped PGame namespace PGame def Numeric : PGame → Prop | ⟨_, _, L, R⟩ => (∀ i j, L i < R j) ∧ (∀ i, Numeric (L i)) ∧ ∀ j, Numeric (R j) #align pgame.numeric SetTheory.PGame.Numeric
Mathlib/SetTheory/Surreal/Basic.lean
71
75
theorem numeric_def {x : PGame} : Numeric x ↔ (∀ i j, x.moveLeft i < x.moveRight j) ∧ (∀ i, Numeric (x.moveLeft i)) ∧ ∀ j, Numeric (x.moveRight j) := by
cases x; rfl
1
import Mathlib.Data.Finset.Fold import Mathlib.Algebra.GCDMonoid.Multiset #align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" #align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d" variable {ι α β γ : Type*} namespace Finset open Multiset variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] section gcd def gcd (s : Finset β) (f : β → α) : α := s.fold GCDMonoid.gcd 0 f #align finset.gcd Finset.gcd variable {s s₁ s₂ : Finset β} {f : β → α} theorem gcd_def : s.gcd f = (s.1.map f).gcd := rfl #align finset.gcd_def Finset.gcd_def @[simp] theorem gcd_empty : (∅ : Finset β).gcd f = 0 := fold_empty #align finset.gcd_empty Finset.gcd_empty theorem dvd_gcd_iff {a : α} : a ∣ s.gcd f ↔ ∀ b ∈ s, a ∣ f b := by apply Iff.trans Multiset.dvd_gcd simp only [Multiset.mem_map, and_imp, exists_imp] exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩ #align finset.dvd_gcd_iff Finset.dvd_gcd_iff theorem gcd_dvd {b : β} (hb : b ∈ s) : s.gcd f ∣ f b := dvd_gcd_iff.1 dvd_rfl _ hb #align finset.gcd_dvd Finset.gcd_dvd theorem dvd_gcd {a : α} : (∀ b ∈ s, a ∣ f b) → a ∣ s.gcd f := dvd_gcd_iff.2 #align finset.dvd_gcd Finset.dvd_gcd @[simp] theorem gcd_insert [DecidableEq β] {b : β} : (insert b s : Finset β).gcd f = GCDMonoid.gcd (f b) (s.gcd f) := by by_cases h : b ∈ s · rw [insert_eq_of_mem h, (gcd_eq_right_iff (f b) (s.gcd f) (Multiset.normalize_gcd (s.1.map f))).2 (gcd_dvd h)] apply fold_insert h #align finset.gcd_insert Finset.gcd_insert @[simp] theorem gcd_singleton {b : β} : ({b} : Finset β).gcd f = normalize (f b) := Multiset.gcd_singleton #align finset.gcd_singleton Finset.gcd_singleton -- Porting note: Priority changed for `simpNF` @[simp 1100]
Mathlib/Algebra/GCDMonoid/Finset.lean
181
181
theorem normalize_gcd : normalize (s.gcd f) = s.gcd f := by
simp [gcd_def]
1
import Mathlib.Init.Function import Mathlib.Logic.Function.Basic #align_import data.sigma.basic from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" open Function section Sigma variable {α α₁ α₂ : Type*} {β : α → Type*} {β₁ : α₁ → Type*} {β₂ : α₂ → Type*} namespace Sigma instance instInhabitedSigma [Inhabited α] [Inhabited (β default)] : Inhabited (Sigma β) := ⟨⟨default, default⟩⟩ instance instDecidableEqSigma [h₁ : DecidableEq α] [h₂ : ∀ a, DecidableEq (β a)] : DecidableEq (Sigma β) | ⟨a₁, b₁⟩, ⟨a₂, b₂⟩ => match a₁, b₁, a₂, b₂, h₁ a₁ a₂ with | _, b₁, _, b₂, isTrue (Eq.refl _) => match b₁, b₂, h₂ _ b₁ b₂ with | _, _, isTrue (Eq.refl _) => isTrue rfl | _, _, isFalse n => isFalse fun h ↦ Sigma.noConfusion h fun _ e₂ ↦ n <| eq_of_heq e₂ | _, _, _, _, isFalse n => isFalse fun h ↦ Sigma.noConfusion h fun e₁ _ ↦ n e₁ -- sometimes the built-in injectivity support does not work @[simp] -- @[nolint simpNF] theorem mk.inj_iff {a₁ a₂ : α} {b₁ : β a₁} {b₂ : β a₂} : Sigma.mk a₁ b₁ = ⟨a₂, b₂⟩ ↔ a₁ = a₂ ∧ HEq b₁ b₂ := ⟨fun h ↦ by cases h; simp, fun ⟨h₁, h₂⟩ ↦ by subst h₁; rw [eq_of_heq h₂]⟩ #align sigma.mk.inj_iff Sigma.mk.inj_iff @[simp] theorem eta : ∀ x : Σa, β a, Sigma.mk x.1 x.2 = x | ⟨_, _⟩ => rfl #align sigma.eta Sigma.eta #align sigma.ext Sigma.ext
Mathlib/Data/Sigma/Basic.lean
70
71
theorem ext_iff {x₀ x₁ : Sigma β} : x₀ = x₁ ↔ x₀.1 = x₁.1 ∧ HEq x₀.2 x₁.2 := by
cases x₀; cases x₁; exact Sigma.mk.inj_iff
1