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 | eval_complexity float64 0 1 |
|---|---|---|---|---|---|---|
import Mathlib.Data.Set.Image
import Mathlib.Data.SProd
#align_import data.set.prod from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
open Function
namespace Set
section Prod
variable {α β γ δ : Type*} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {a : α} {b : β}
theorem Subsingleton.prod (hs : s.Subsingleton) (ht : t.Subsingleton) :
(s ×ˢ t).Subsingleton := fun _x hx _y hy ↦
Prod.ext (hs hx.1 hy.1) (ht hx.2 hy.2)
noncomputable instance decidableMemProd [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] :
DecidablePred (· ∈ s ×ˢ t) := fun _ => And.decidable
#align set.decidable_mem_prod Set.decidableMemProd
@[gcongr]
theorem prod_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : s₁ ×ˢ t₁ ⊆ s₂ ×ˢ t₂ :=
fun _ ⟨h₁, h₂⟩ => ⟨hs h₁, ht h₂⟩
#align set.prod_mono Set.prod_mono
@[gcongr]
theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t :=
prod_mono hs Subset.rfl
#align set.prod_mono_left Set.prod_mono_left
@[gcongr]
theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂ :=
prod_mono Subset.rfl ht
#align set.prod_mono_right Set.prod_mono_right
@[simp]
theorem prod_self_subset_prod_self : s₁ ×ˢ s₁ ⊆ s₂ ×ˢ s₂ ↔ s₁ ⊆ s₂ :=
⟨fun h _ hx => (h (mk_mem_prod hx hx)).1, fun h _ hx => ⟨h hx.1, h hx.2⟩⟩
#align set.prod_self_subset_prod_self Set.prod_self_subset_prod_self
@[simp]
theorem prod_self_ssubset_prod_self : s₁ ×ˢ s₁ ⊂ s₂ ×ˢ s₂ ↔ s₁ ⊂ s₂ :=
and_congr prod_self_subset_prod_self <| not_congr prod_self_subset_prod_self
#align set.prod_self_ssubset_prod_self Set.prod_self_ssubset_prod_self
theorem prod_subset_iff {P : Set (α × β)} : s ×ˢ t ⊆ P ↔ ∀ x ∈ s, ∀ y ∈ t, (x, y) ∈ P :=
⟨fun h _ hx _ hy => h (mk_mem_prod hx hy), fun h ⟨_, _⟩ hp => h _ hp.1 _ hp.2⟩
#align set.prod_subset_iff Set.prod_subset_iff
theorem forall_prod_set {p : α × β → Prop} : (∀ x ∈ s ×ˢ t, p x) ↔ ∀ x ∈ s, ∀ y ∈ t, p (x, y) :=
prod_subset_iff
#align set.forall_prod_set Set.forall_prod_set
theorem exists_prod_set {p : α × β → Prop} : (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y) := by
simp [and_assoc]
#align set.exists_prod_set Set.exists_prod_set
@[simp]
theorem prod_empty : s ×ˢ (∅ : Set β) = ∅ := by
ext
exact and_false_iff _
#align set.prod_empty Set.prod_empty
@[simp]
theorem empty_prod : (∅ : Set α) ×ˢ t = ∅ := by
ext
exact false_and_iff _
#align set.empty_prod Set.empty_prod
@[simp, mfld_simps]
theorem univ_prod_univ : @univ α ×ˢ @univ β = univ := by
ext
exact true_and_iff _
#align set.univ_prod_univ Set.univ_prod_univ
theorem univ_prod {t : Set β} : (univ : Set α) ×ˢ t = Prod.snd ⁻¹' t := by simp [prod_eq]
#align set.univ_prod Set.univ_prod
theorem prod_univ {s : Set α} : s ×ˢ (univ : Set β) = Prod.fst ⁻¹' s := by simp [prod_eq]
#align set.prod_univ Set.prod_univ
@[simp] lemma prod_eq_univ [Nonempty α] [Nonempty β] : s ×ˢ t = univ ↔ s = univ ∧ t = univ := by
simp [eq_univ_iff_forall, forall_and]
@[simp]
| Mathlib/Data/Set/Prod.lean | 111 | 113 | theorem singleton_prod : ({a} : Set α) ×ˢ t = Prod.mk a '' t := by |
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
| 0.71875 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Monic
#align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
open Polynomial
noncomputable section
namespace Polynomial
universe u v w
section Semiring
variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S}
def lifts (f : R →+* S) : Subsemiring S[X] :=
RingHom.rangeS (mapRingHom f)
#align polynomial.lifts Polynomial.lifts
theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by
simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS]
#align polynomial.mem_lifts Polynomial.mem_lifts
theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by
simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS]
#align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range
theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by
simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS]
#align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS
theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by
rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f]
rfl
#align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts
theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f :=
⟨C r, by
simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true,
and_self_iff]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.C_mem_lifts Polynomial.C_mem_lifts
theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by
obtain ⟨r, rfl⟩ := Set.mem_range.1 h
use C r
simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true,
and_self_iff]
set_option linter.uppercaseLean3 false in
#align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts
theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f :=
⟨X, by
simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X,
and_self_iff]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.X_mem_lifts Polynomial.X_mem_lifts
theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f :=
⟨X ^ n, by
simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true,
map_X, and_self_iff]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts
theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by
simp only [lifts, RingHom.mem_rangeS] at hp ⊢
obtain ⟨p₁, rfl⟩ := hp
use C r * p₁
simp only [coe_mapRingHom, map_C, map_mul]
#align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts
| Mathlib/Algebra/Polynomial/Lifts.lean | 120 | 124 | theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by |
obtain ⟨r, rfl⟩ := Set.mem_range.1 h
use monomial n r
simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true,
and_self_iff]
| 0.71875 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.NormedSpace.HomeomorphBall
#align_import analysis.inner_product_space.calculus from "leanprover-community/mathlib"@"f9dd3204df14a0749cd456fac1e6849dfe7d2b88"
noncomputable section
open RCLike Real Filter
open scoped Classical Topology
section PiLike
open ContinuousLinearMap
variable {𝕜 ι H : Type*} [RCLike 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
{f : H → EuclideanSpace 𝕜 ι} {f' : H →L[𝕜] EuclideanSpace 𝕜 ι} {t : Set H} {y : H}
theorem differentiableWithinAt_euclidean :
DifferentiableWithinAt 𝕜 f t y ↔ ∀ i, DifferentiableWithinAt 𝕜 (fun x => f x i) t y := by
rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableWithinAt_iff, differentiableWithinAt_pi]
rfl
#align differentiable_within_at_euclidean differentiableWithinAt_euclidean
theorem differentiableAt_euclidean :
DifferentiableAt 𝕜 f y ↔ ∀ i, DifferentiableAt 𝕜 (fun x => f x i) y := by
rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableAt_iff, differentiableAt_pi]
rfl
#align differentiable_at_euclidean differentiableAt_euclidean
theorem differentiableOn_euclidean :
DifferentiableOn 𝕜 f t ↔ ∀ i, DifferentiableOn 𝕜 (fun x => f x i) t := by
rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableOn_iff, differentiableOn_pi]
rfl
#align differentiable_on_euclidean differentiableOn_euclidean
theorem differentiable_euclidean : Differentiable 𝕜 f ↔ ∀ i, Differentiable 𝕜 fun x => f x i := by
rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiable_iff, differentiable_pi]
rfl
#align differentiable_euclidean differentiable_euclidean
theorem hasStrictFDerivAt_euclidean :
HasStrictFDerivAt f f' y ↔
∀ i, HasStrictFDerivAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') y := by
rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasStrictFDerivAt_iff, hasStrictFDerivAt_pi']
rfl
#align has_strict_fderiv_at_euclidean hasStrictFDerivAt_euclidean
| Mathlib/Analysis/InnerProductSpace/Calculus.lean | 340 | 344 | theorem hasFDerivWithinAt_euclidean :
HasFDerivWithinAt f f' t y ↔
∀ i, HasFDerivWithinAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') t y := by |
rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasFDerivWithinAt_iff, hasFDerivWithinAt_pi']
rfl
| 0.71875 |
import Mathlib.Algebra.Group.Support
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Nat.Cast.Field
#align_import algebra.char_zero.lemmas from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829"
open Function Set
section AddMonoidWithOne
variable {α M : Type*} [AddMonoidWithOne M] [CharZero M] {n : ℕ}
instance CharZero.NeZero.two : NeZero (2 : M) :=
⟨by
have : ((2 : ℕ) : M) ≠ 0 := Nat.cast_ne_zero.2 (by decide)
rwa [Nat.cast_two] at this⟩
#align char_zero.ne_zero.two CharZero.NeZero.two
section
variable {R : Type*} [NonAssocSemiring R] [NoZeroDivisors R] [CharZero R] {a : R}
@[simp]
theorem add_self_eq_zero {a : R} : a + a = 0 ↔ a = 0 := by
simp only [(two_mul a).symm, mul_eq_zero, two_ne_zero, false_or_iff]
#align add_self_eq_zero add_self_eq_zero
set_option linter.deprecated false
@[simp]
theorem bit0_eq_zero {a : R} : bit0 a = 0 ↔ a = 0 :=
add_self_eq_zero
#align bit0_eq_zero bit0_eq_zero
@[simp]
theorem zero_eq_bit0 {a : R} : 0 = bit0 a ↔ a = 0 := by
rw [eq_comm]
exact bit0_eq_zero
#align zero_eq_bit0 zero_eq_bit0
theorem bit0_ne_zero : bit0 a ≠ 0 ↔ a ≠ 0 :=
bit0_eq_zero.not
#align bit0_ne_zero bit0_ne_zero
theorem zero_ne_bit0 : 0 ≠ bit0 a ↔ a ≠ 0 :=
zero_eq_bit0.not
#align zero_ne_bit0 zero_ne_bit0
end
section
variable {R : Type*} [NonAssocRing R] [NoZeroDivisors R] [CharZero R]
@[simp] theorem neg_eq_self_iff {a : R} : -a = a ↔ a = 0 :=
neg_eq_iff_add_eq_zero.trans add_self_eq_zero
#align neg_eq_self_iff neg_eq_self_iff
@[simp] theorem eq_neg_self_iff {a : R} : a = -a ↔ a = 0 :=
eq_neg_iff_add_eq_zero.trans add_self_eq_zero
#align eq_neg_self_iff eq_neg_self_iff
| Mathlib/Algebra/CharZero/Lemmas.lean | 127 | 129 | theorem nat_mul_inj {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) : n = 0 ∨ a = b := by |
rw [← sub_eq_zero, ← mul_sub, mul_eq_zero, sub_eq_zero] at h
exact mod_cast h
| 0.71875 |
import Mathlib.Init.Function
#align_import data.option.n_ary from "leanprover-community/mathlib"@"995b47e555f1b6297c7cf16855f1023e355219fb"
universe u
open Function
namespace Option
variable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ}
def map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ :=
a.bind fun a => b.map <| f a
#align option.map₂ Option.map₂
theorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) :
map₂ f a b = f <$> a <*> b := by
cases a <;> rfl
#align option.map₂_def Option.map₂_def
-- Porting note (#10618): In Lean3, was `@[simp]` but now `simp` can prove it
theorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl
#align option.map₂_some_some Option.map₂_some_some
theorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl
#align option.map₂_coe_coe Option.map₂_coe_coe
@[simp]
theorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl
#align option.map₂_none_left Option.map₂_none_left
@[simp]
theorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl
#align option.map₂_none_right Option.map₂_none_right
@[simp]
theorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b :=
rfl
#align option.map₂_coe_left Option.map₂_coe_left
-- Porting note: This proof was `rfl` in Lean3, but now is not.
@[simp]
theorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) :
map₂ f a b = a.map fun a => f a b := by cases a <;> rfl
#align option.map₂_coe_right Option.map₂_coe_right
-- Porting note: Removed the `@[simp]` tag as membership of an `Option` is no-longer simp-normal.
theorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by
simp [map₂, bind_eq_some]
#align option.mem_map₂_iff Option.mem_map₂_iff
@[simp]
theorem map₂_eq_none_iff : map₂ f a b = none ↔ a = none ∨ b = none := by
cases a <;> cases b <;> simp
#align option.map₂_eq_none_iff Option.map₂_eq_none_iff
theorem map₂_swap (f : α → β → γ) (a : Option α) (b : Option β) :
map₂ f a b = map₂ (fun a b => f b a) b a := by cases a <;> cases b <;> rfl
#align option.map₂_swap Option.map₂_swap
theorem map_map₂ (f : α → β → γ) (g : γ → δ) :
(map₂ f a b).map g = map₂ (fun a b => g (f a b)) a b := by cases a <;> cases b <;> rfl
#align option.map_map₂ Option.map_map₂
theorem map₂_map_left (f : γ → β → δ) (g : α → γ) :
map₂ f (a.map g) b = map₂ (fun a b => f (g a) b) a b := by cases a <;> rfl
#align option.map₂_map_left Option.map₂_map_left
theorem map₂_map_right (f : α → γ → δ) (g : β → γ) :
map₂ f a (b.map g) = map₂ (fun a b => f a (g b)) a b := by cases b <;> rfl
#align option.map₂_map_right Option.map₂_map_right
@[simp]
theorem map₂_curry (f : α × β → γ) (a : Option α) (b : Option β) :
map₂ (curry f) a b = Option.map f (map₂ Prod.mk a b) := (map_map₂ _ _).symm
#align option.map₂_curry Option.map₂_curry
@[simp]
theorem map_uncurry (f : α → β → γ) (x : Option (α × β)) :
x.map (uncurry f) = map₂ f (x.map Prod.fst) (x.map Prod.snd) := by cases x <;> rfl
#align option.map_uncurry Option.map_uncurry
variable {α' β' δ' ε ε' : Type*}
| Mathlib/Data/Option/NAry.lean | 124 | 127 | theorem map₂_assoc {f : δ → γ → ε} {g : α → β → δ} {f' : α → ε' → ε} {g' : β → γ → ε'}
(h_assoc : ∀ a b c, f (g a b) c = f' a (g' b c)) :
map₂ f (map₂ g a b) c = map₂ f' a (map₂ g' b c) := by |
cases a <;> cases b <;> cases c <;> simp [h_assoc]
| 0.71875 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.NormedSpace.FiniteDimension
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open Function Set Filter
open scoped Topology Filter
variable {E X : Type*}
structure ContDiffBump (c : E) where
(rIn rOut : ℝ)
rIn_pos : 0 < rIn
rIn_lt_rOut : rIn < rOut
#align cont_diff_bump ContDiffBump
#align cont_diff_bump.r ContDiffBump.rIn
set_option linter.uppercaseLean3 false in
#align cont_diff_bump.R ContDiffBump.rOut
#align cont_diff_bump.r_pos ContDiffBump.rIn_pos
set_option linter.uppercaseLean3 false in
#align cont_diff_bump.r_lt_R ContDiffBump.rIn_lt_rOut
-- Porting note(#5171): linter not yet ported; was @[nolint has_nonempty_instance]
structure ContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where
toFun : ℝ → E → ℝ
mem_Icc : ∀ (R : ℝ) (x : E), toFun R x ∈ Icc (0 : ℝ) 1
symmetric : ∀ (R : ℝ) (x : E), toFun R (-x) = toFun R x
smooth : ContDiffOn ℝ ⊤ (uncurry toFun) (Ioi (1 : ℝ) ×ˢ (univ : Set E))
eq_one : ∀ R : ℝ, 1 < R → ∀ x : E, ‖x‖ ≤ 1 → toFun R x = 1
support : ∀ R : ℝ, 1 < R → Function.support (toFun R) = Metric.ball (0 : E) R
#align cont_diff_bump_base ContDiffBumpBase
class HasContDiffBump (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] : Prop where
out : Nonempty (ContDiffBumpBase E)
#align has_cont_diff_bump HasContDiffBump
def someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E]
[hb : HasContDiffBump E] : ContDiffBumpBase E :=
Nonempty.some hb.out
#align some_cont_diff_bump_base someContDiffBumpBase
namespace ContDiffBump
theorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut :=
f.rIn_pos.trans f.rIn_lt_rOut
set_option linter.uppercaseLean3 false in
#align cont_diff_bump.R_pos ContDiffBump.rOut_pos
| Mathlib/Analysis/Calculus/BumpFunction/Basic.lean | 118 | 120 | theorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn := by |
rw [one_lt_div f.rIn_pos]
exact f.rIn_lt_rOut
| 0.71875 |
import Mathlib.MeasureTheory.Function.L1Space
import Mathlib.Analysis.NormedSpace.IndicatorFunction
#align_import measure_theory.integral.integrable_on from "leanprover-community/mathlib"@"8b8ba04e2f326f3f7cf24ad129beda58531ada61"
noncomputable section
open Set Filter TopologicalSpace MeasureTheory Function
open scoped Classical Topology Interval Filter ENNReal MeasureTheory
variable {α β E F : Type*} [MeasurableSpace α]
section
variable [TopologicalSpace β] {l l' : Filter α} {f g : α → β} {μ ν : Measure α}
def StronglyMeasurableAtFilter (f : α → β) (l : Filter α) (μ : Measure α := by volume_tac) :=
∃ s ∈ l, AEStronglyMeasurable f (μ.restrict s)
#align strongly_measurable_at_filter StronglyMeasurableAtFilter
@[simp]
theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ :=
⟨∅, mem_bot, by simp⟩
#align strongly_measurable_at_bot stronglyMeasurableAt_bot
protected theorem StronglyMeasurableAtFilter.eventually (h : StronglyMeasurableAtFilter f l μ) :
∀ᶠ s in l.smallSets, AEStronglyMeasurable f (μ.restrict s) :=
(eventually_smallSets' fun _ _ => AEStronglyMeasurable.mono_set).2 h
#align strongly_measurable_at_filter.eventually StronglyMeasurableAtFilter.eventually
protected theorem StronglyMeasurableAtFilter.filter_mono (h : StronglyMeasurableAtFilter f l μ)
(h' : l' ≤ l) : StronglyMeasurableAtFilter f l' μ :=
let ⟨s, hsl, hs⟩ := h
⟨s, h' hsl, hs⟩
#align strongly_measurable_at_filter.filter_mono StronglyMeasurableAtFilter.filter_mono
protected theorem MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter
(h : AEStronglyMeasurable f μ) : StronglyMeasurableAtFilter f l μ :=
⟨univ, univ_mem, by rwa [Measure.restrict_univ]⟩
#align measure_theory.ae_strongly_measurable.strongly_measurable_at_filter MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter
theorem AeStronglyMeasurable.stronglyMeasurableAtFilter_of_mem {s}
(h : AEStronglyMeasurable f (μ.restrict s)) (hl : s ∈ l) : StronglyMeasurableAtFilter f l μ :=
⟨s, hl, h⟩
#align ae_strongly_measurable.strongly_measurable_at_filter_of_mem AeStronglyMeasurable.stronglyMeasurableAtFilter_of_mem
protected theorem MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter
(h : StronglyMeasurable f) : StronglyMeasurableAtFilter f l μ :=
h.aestronglyMeasurable.stronglyMeasurableAtFilter
#align measure_theory.strongly_measurable.strongly_measurable_at_filter MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter
end
namespace MeasureTheory
section NormedAddCommGroup
theorem hasFiniteIntegral_restrict_of_bounded [NormedAddCommGroup E] {f : α → E} {s : Set α}
{μ : Measure α} {C} (hs : μ s < ∞) (hf : ∀ᵐ x ∂μ.restrict s, ‖f x‖ ≤ C) :
HasFiniteIntegral f (μ.restrict s) :=
haveI : IsFiniteMeasure (μ.restrict s) := ⟨by rwa [Measure.restrict_apply_univ]⟩
hasFiniteIntegral_of_bounded hf
#align measure_theory.has_finite_integral_restrict_of_bounded MeasureTheory.hasFiniteIntegral_restrict_of_bounded
variable [NormedAddCommGroup E] {f g : α → E} {s t : Set α} {μ ν : Measure α}
def IntegrableOn (f : α → E) (s : Set α) (μ : Measure α := by volume_tac) : Prop :=
Integrable f (μ.restrict s)
#align measure_theory.integrable_on MeasureTheory.IntegrableOn
theorem IntegrableOn.integrable (h : IntegrableOn f s μ) : Integrable f (μ.restrict s) :=
h
#align measure_theory.integrable_on.integrable MeasureTheory.IntegrableOn.integrable
@[simp]
| Mathlib/MeasureTheory/Integral/IntegrableOn.lean | 99 | 99 | theorem integrableOn_empty : IntegrableOn f ∅ μ := by | simp [IntegrableOn, integrable_zero_measure]
| 0.71875 |
import Mathlib.Order.Filter.Cofinite
import Mathlib.Order.Hom.CompleteLattice
#align_import order.liminf_limsup from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780"
set_option autoImplicit true
open Filter Set Function
variable {α β γ ι ι' : Type*}
namespace Filter
section Relation
def IsBounded (r : α → α → Prop) (f : Filter α) :=
∃ b, ∀ᶠ x in f, r x b
#align filter.is_bounded Filter.IsBounded
def IsBoundedUnder (r : α → α → Prop) (f : Filter β) (u : β → α) :=
(map u f).IsBounded r
#align filter.is_bounded_under Filter.IsBoundedUnder
variable {r : α → α → Prop} {f g : Filter α}
theorem isBounded_iff : f.IsBounded r ↔ ∃ s ∈ f.sets, ∃ b, s ⊆ { x | r x b } :=
Iff.intro (fun ⟨b, hb⟩ => ⟨{ a | r a b }, hb, b, Subset.refl _⟩) fun ⟨_, hs, b, hb⟩ =>
⟨b, mem_of_superset hs hb⟩
#align filter.is_bounded_iff Filter.isBounded_iff
theorem isBoundedUnder_of {f : Filter β} {u : β → α} : (∃ b, ∀ x, r (u x) b) → f.IsBoundedUnder r u
| ⟨b, hb⟩ => ⟨b, show ∀ᶠ x in f, r (u x) b from eventually_of_forall hb⟩
#align filter.is_bounded_under_of Filter.isBoundedUnder_of
theorem isBounded_bot : IsBounded r ⊥ ↔ Nonempty α := by simp [IsBounded, exists_true_iff_nonempty]
#align filter.is_bounded_bot Filter.isBounded_bot
theorem isBounded_top : IsBounded r ⊤ ↔ ∃ t, ∀ x, r x t := by simp [IsBounded, eq_univ_iff_forall]
#align filter.is_bounded_top Filter.isBounded_top
| Mathlib/Order/LiminfLimsup.lean | 83 | 84 | theorem isBounded_principal (s : Set α) : IsBounded r (𝓟 s) ↔ ∃ t, ∀ x ∈ s, r x t := by |
simp [IsBounded, subset_def]
| 0.71875 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
namespace Set
variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)
theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by
refine
⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h)
rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ici_add_bij Set.Ici_add_bij
theorem Ioi_add_bij : BijOn (· + d) (Ioi a) (Ioi (a + d)) := by
refine
⟨fun x h => add_lt_add_right (mem_Ioi.mp h) _, fun _ _ _ _ h => add_right_cancel h, fun _ h =>
?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ioi.mp h).le
rw [mem_Ioi, add_right_comm, add_lt_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ioi_add_bij Set.Ioi_add_bij
theorem Icc_add_bij : BijOn (· + d) (Icc a b) (Icc (a + d) (b + d)) := by
rw [← Ici_inter_Iic, ← Ici_inter_Iic]
exact
(Ici_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
#align set.Icc_add_bij Set.Icc_add_bij
theorem Ioo_add_bij : BijOn (· + d) (Ioo a b) (Ioo (a + d) (b + d)) := by
rw [← Ioi_inter_Iio, ← Ioi_inter_Iio]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
lt_of_add_lt_add_right hx.2
#align set.Ioo_add_bij Set.Ioo_add_bij
theorem Ioc_add_bij : BijOn (· + d) (Ioc a b) (Ioc (a + d) (b + d)) := by
rw [← Ioi_inter_Iic, ← Ioi_inter_Iic]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
#align set.Ioc_add_bij Set.Ioc_add_bij
theorem Ico_add_bij : BijOn (· + d) (Ico a b) (Ico (a + d) (b + d)) := by
rw [← Ici_inter_Iio, ← Ici_inter_Iio]
exact
(Ici_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
lt_of_add_lt_add_right hx.2
#align set.Ico_add_bij Set.Ico_add_bij
@[simp]
theorem image_add_const_Ici : (fun x => x + a) '' Ici b = Ici (b + a) :=
(Ici_add_bij _ _).image_eq
#align set.image_add_const_Ici Set.image_add_const_Ici
@[simp]
theorem image_add_const_Ioi : (fun x => x + a) '' Ioi b = Ioi (b + a) :=
(Ioi_add_bij _ _).image_eq
#align set.image_add_const_Ioi Set.image_add_const_Ioi
@[simp]
theorem image_add_const_Icc : (fun x => x + a) '' Icc b c = Icc (b + a) (c + a) :=
(Icc_add_bij _ _ _).image_eq
#align set.image_add_const_Icc Set.image_add_const_Icc
@[simp]
theorem image_add_const_Ico : (fun x => x + a) '' Ico b c = Ico (b + a) (c + a) :=
(Ico_add_bij _ _ _).image_eq
#align set.image_add_const_Ico Set.image_add_const_Ico
@[simp]
theorem image_add_const_Ioc : (fun x => x + a) '' Ioc b c = Ioc (b + a) (c + a) :=
(Ioc_add_bij _ _ _).image_eq
#align set.image_add_const_Ioc Set.image_add_const_Ioc
@[simp]
theorem image_add_const_Ioo : (fun x => x + a) '' Ioo b c = Ioo (b + a) (c + a) :=
(Ioo_add_bij _ _ _).image_eq
#align set.image_add_const_Ioo Set.image_add_const_Ioo
@[simp]
theorem image_const_add_Ici : (fun x => a + x) '' Ici b = Ici (a + b) := by
simp only [add_comm a, image_add_const_Ici]
#align set.image_const_add_Ici Set.image_const_add_Ici
@[simp]
theorem image_const_add_Ioi : (fun x => a + x) '' Ioi b = Ioi (a + b) := by
simp only [add_comm a, image_add_const_Ioi]
#align set.image_const_add_Ioi Set.image_const_add_Ioi
@[simp]
| Mathlib/Algebra/Order/Interval/Set/Monoid.lean | 123 | 124 | theorem image_const_add_Icc : (fun x => a + x) '' Icc b c = Icc (a + b) (a + c) := by |
simp only [add_comm a, image_add_const_Icc]
| 0.71875 |
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
#align_import category_theory.limits.shapes.strict_initial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v u
namespace CategoryTheory
namespace Limits
open Category
variable (C : Type u) [Category.{v} C]
section StrictInitial
class HasStrictInitialObjects : Prop where
out : ∀ {I A : C} (f : A ⟶ I), IsInitial I → IsIso f
#align category_theory.limits.has_strict_initial_objects CategoryTheory.Limits.HasStrictInitialObjects
variable {C}
section
variable [HasStrictInitialObjects C] {I : C}
theorem IsInitial.isIso_to (hI : IsInitial I) {A : C} (f : A ⟶ I) : IsIso f :=
HasStrictInitialObjects.out f hI
#align category_theory.limits.is_initial.is_iso_to CategoryTheory.Limits.IsInitial.isIso_to
| Mathlib/CategoryTheory/Limits/Shapes/StrictInitial.lean | 74 | 77 | theorem IsInitial.strict_hom_ext (hI : IsInitial I) {A : C} (f g : A ⟶ I) : f = g := by |
haveI := hI.isIso_to f
haveI := hI.isIso_to g
exact eq_of_inv_eq_inv (hI.hom_ext (inv f) (inv g))
| 0.71875 |
import Mathlib.LinearAlgebra.Matrix.Symmetric
import Mathlib.LinearAlgebra.Matrix.Orthogonal
import Mathlib.Data.Matrix.Kronecker
#align_import linear_algebra.matrix.is_diag from "leanprover-community/mathlib"@"55e2dfde0cff928ce5c70926a3f2c7dee3e2dd99"
namespace Matrix
variable {α β R n m : Type*}
open Function
open Matrix Kronecker
def IsDiag [Zero α] (A : Matrix n n α) : Prop :=
Pairwise fun i j => A i j = 0
#align matrix.is_diag Matrix.IsDiag
@[simp]
theorem isDiag_diagonal [Zero α] [DecidableEq n] (d : n → α) : (diagonal d).IsDiag := fun _ _ =>
Matrix.diagonal_apply_ne _
#align matrix.is_diag_diagonal Matrix.isDiag_diagonal
theorem IsDiag.diagonal_diag [Zero α] [DecidableEq n] {A : Matrix n n α} (h : A.IsDiag) :
diagonal (diag A) = A :=
ext fun i j => by
obtain rfl | hij := Decidable.eq_or_ne i j
· rw [diagonal_apply_eq, diag]
· rw [diagonal_apply_ne _ hij, h hij]
#align matrix.is_diag.diagonal_diag Matrix.IsDiag.diagonal_diag
theorem isDiag_iff_diagonal_diag [Zero α] [DecidableEq n] (A : Matrix n n α) :
A.IsDiag ↔ diagonal (diag A) = A :=
⟨IsDiag.diagonal_diag, fun hd => hd ▸ isDiag_diagonal (diag A)⟩
#align matrix.is_diag_iff_diagonal_diag Matrix.isDiag_iff_diagonal_diag
theorem isDiag_of_subsingleton [Zero α] [Subsingleton n] (A : Matrix n n α) : A.IsDiag :=
fun i j h => (h <| Subsingleton.elim i j).elim
#align matrix.is_diag_of_subsingleton Matrix.isDiag_of_subsingleton
@[simp]
theorem isDiag_zero [Zero α] : (0 : Matrix n n α).IsDiag := fun _ _ _ => rfl
#align matrix.is_diag_zero Matrix.isDiag_zero
@[simp]
theorem isDiag_one [DecidableEq n] [Zero α] [One α] : (1 : Matrix n n α).IsDiag := fun _ _ =>
one_apply_ne
#align matrix.is_diag_one Matrix.isDiag_one
theorem IsDiag.map [Zero α] [Zero β] {A : Matrix n n α} (ha : A.IsDiag) {f : α → β} (hf : f 0 = 0) :
(A.map f).IsDiag := by
intro i j h
simp [ha h, hf]
#align matrix.is_diag.map Matrix.IsDiag.map
| Mathlib/LinearAlgebra/Matrix/IsDiag.lean | 82 | 84 | theorem IsDiag.neg [AddGroup α] {A : Matrix n n α} (ha : A.IsDiag) : (-A).IsDiag := by |
intro i j h
simp [ha h]
| 0.71875 |
import Mathlib.Order.SuccPred.Basic
#align_import order.succ_pred.relation from "leanprover-community/mathlib"@"9aba7801eeecebb61f58a5763c2b6dd1b47dc6ef"
open Function Order Relation Set
section PartialSucc
variable {α : Type*} [PartialOrder α] [SuccOrder α] [IsSuccArchimedean α]
theorem reflTransGen_of_succ_of_le (r : α → α → Prop) {n m : α} (h : ∀ i ∈ Ico n m, r i (succ i))
(hnm : n ≤ m) : ReflTransGen r n m := by
revert h; refine Succ.rec ?_ ?_ hnm
· intro _
exact ReflTransGen.refl
· intro m hnm ih h
have : ReflTransGen r n m := ih fun i hi => h i ⟨hi.1, hi.2.trans_le <| le_succ m⟩
rcases (le_succ m).eq_or_lt with hm | hm
· rwa [← hm]
exact this.tail (h m ⟨hnm, hm⟩)
#align refl_trans_gen_of_succ_of_le reflTransGen_of_succ_of_le
| Mathlib/Order/SuccPred/Relation.lean | 40 | 43 | theorem reflTransGen_of_succ_of_ge (r : α → α → Prop) {n m : α} (h : ∀ i ∈ Ico m n, r (succ i) i)
(hmn : m ≤ n) : ReflTransGen r n m := by |
rw [← reflTransGen_swap]
exact reflTransGen_of_succ_of_le (swap r) h hmn
| 0.71875 |
import Mathlib.Analysis.SpecialFunctions.Complex.Arg
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Complex
open Set Filter Bornology
open scoped Real Topology ComplexConjugate
-- Porting note: @[pp_nodot] does not exist in mathlib4
noncomputable def log (x : ℂ) : ℂ :=
x.abs.log + arg x * I
#align complex.log Complex.log
theorem log_re (x : ℂ) : x.log.re = x.abs.log := by simp [log]
#align complex.log_re Complex.log_re
theorem log_im (x : ℂ) : x.log.im = x.arg := by simp [log]
#align complex.log_im Complex.log_im
theorem neg_pi_lt_log_im (x : ℂ) : -π < (log x).im := by simp only [log_im, neg_pi_lt_arg]
#align complex.neg_pi_lt_log_im Complex.neg_pi_lt_log_im
theorem log_im_le_pi (x : ℂ) : (log x).im ≤ π := by simp only [log_im, arg_le_pi]
#align complex.log_im_le_pi Complex.log_im_le_pi
theorem exp_log {x : ℂ} (hx : x ≠ 0) : exp (log x) = x := by
rw [log, exp_add_mul_I, ← ofReal_sin, sin_arg, ← ofReal_cos, cos_arg hx, ← ofReal_exp,
Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), ← mul_assoc,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im]
#align complex.exp_log Complex.exp_log
@[simp]
theorem range_exp : Set.range exp = {0}ᶜ :=
Set.ext fun x =>
⟨by
rintro ⟨x, rfl⟩
exact exp_ne_zero x, fun hx => ⟨log x, exp_log hx⟩⟩
#align complex.range_exp Complex.range_exp
theorem log_exp {x : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) : log (exp x) = x := by
rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, ← ofReal_exp,
arg_mul_cos_add_sin_mul_I (Real.exp_pos _) ⟨hx₁, hx₂⟩, re_add_im]
#align complex.log_exp Complex.log_exp
theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) (hy₁ : -π < y.im)
(hy₂ : y.im ≤ π) (hxy : exp x = exp y) : x = y := by
rw [← log_exp hx₁ hx₂, ← log_exp hy₁ hy₂, hxy]
#align complex.exp_inj_of_neg_pi_lt_of_le_pi Complex.exp_inj_of_neg_pi_lt_of_le_pi
theorem ofReal_log {x : ℝ} (hx : 0 ≤ x) : (x.log : ℂ) = log x :=
Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx])
(by rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx])
#align complex.of_real_log Complex.ofReal_log
@[simp, norm_cast]
lemma natCast_log {n : ℕ} : Real.log n = log n := ofReal_natCast n ▸ ofReal_log n.cast_nonneg
@[simp]
lemma ofNat_log {n : ℕ} [n.AtLeastTwo] :
Real.log (no_index (OfNat.ofNat n)) = log (OfNat.ofNat n) :=
natCast_log
theorem log_ofReal_re (x : ℝ) : (log (x : ℂ)).re = Real.log x := by simp [log_re]
#align complex.log_of_real_re Complex.log_ofReal_re
theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : ℂ} (hx : x ≠ 0) :
log (r * x) = Real.log r + log x := by
replace hx := Complex.abs.ne_zero_iff.mpr hx
simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx,
ofReal_add, add_assoc]
#align complex.log_of_real_mul Complex.log_ofReal_mul
theorem log_mul_ofReal (r : ℝ) (hr : 0 < r) (x : ℂ) (hx : x ≠ 0) :
log (x * r) = Real.log r + log x := by rw [mul_comm, log_ofReal_mul hr hx]
#align complex.log_mul_of_real Complex.log_mul_ofReal
lemma log_mul_eq_add_log_iff {x y : ℂ} (hx₀ : x ≠ 0) (hy₀ : y ≠ 0) :
log (x * y) = log x + log y ↔ arg x + arg y ∈ Set.Ioc (-π) π := by
refine ext_iff.trans <| Iff.trans ?_ <| arg_mul_eq_add_arg_iff hx₀ hy₀
simp_rw [add_re, add_im, log_re, log_im, AbsoluteValue.map_mul,
Real.log_mul (abs.ne_zero hx₀) (abs.ne_zero hy₀), true_and]
alias ⟨_, log_mul⟩ := log_mul_eq_add_log_iff
@[simp]
theorem log_zero : log 0 = 0 := by simp [log]
#align complex.log_zero Complex.log_zero
@[simp]
| Mathlib/Analysis/SpecialFunctions/Complex/Log.lean | 110 | 110 | theorem log_one : log 1 = 0 := by | simp [log]
| 0.71875 |
import Mathlib.Algebra.Field.Basic
import Mathlib.Deprecated.Subring
#align_import deprecated.subfield from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc"
variable {F : Type*} [Field F] (S : Set F)
structure IsSubfield extends IsSubring S : Prop where
inv_mem : ∀ {x : F}, x ∈ S → x⁻¹ ∈ S
#align is_subfield IsSubfield
| Mathlib/Deprecated/Subfield.lean | 40 | 43 | theorem IsSubfield.div_mem {S : Set F} (hS : IsSubfield S) {x y : F} (hx : x ∈ S) (hy : y ∈ S) :
x / y ∈ S := by |
rw [div_eq_mul_inv]
exact hS.toIsSubring.toIsSubmonoid.mul_mem hx (hS.inv_mem hy)
| 0.71875 |
import Mathlib.Algebra.GCDMonoid.Finset
import Mathlib.Algebra.Polynomial.CancelLeads
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.FieldDivision
#align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3"
namespace Polynomial
open Polynomial
variable {R : Type*} [CommRing R] [IsDomain R]
section NormalizedGCDMonoid
variable [NormalizedGCDMonoid R]
def content (p : R[X]) : R :=
p.support.gcd p.coeff
#align polynomial.content Polynomial.content
| Mathlib/RingTheory/Polynomial/Content.lean | 83 | 88 | theorem content_dvd_coeff {p : R[X]} (n : ℕ) : p.content ∣ p.coeff n := by |
by_cases h : n ∈ p.support
· apply Finset.gcd_dvd h
rw [mem_support_iff, Classical.not_not] at h
rw [h]
apply dvd_zero
| 0.71875 |
import Mathlib.LinearAlgebra.QuadraticForm.TensorProduct
import Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv
suppress_compilation
universe uR uM₁ uM₂ uM₃ uM₄
variable {R : Type uR} {M₁ : Type uM₁} {M₂ : Type uM₂} {M₃ : Type uM₃} {M₄ : Type uM₄}
open scoped TensorProduct
namespace QuadraticForm
variable [CommRing R]
variable [AddCommGroup M₁] [AddCommGroup M₂] [AddCommGroup M₃] [AddCommGroup M₄]
variable [Module R M₁] [Module R M₂] [Module R M₃] [Module R M₄] [Invertible (2 : R)]
@[simp]
theorem tmul_comp_tensorMap
{Q₁ : QuadraticForm R M₁} {Q₂ : QuadraticForm R M₂}
{Q₃ : QuadraticForm R M₃} {Q₄ : QuadraticForm R M₄}
(f : Q₁ →qᵢ Q₂) (g : Q₃ →qᵢ Q₄) :
(Q₂.tmul Q₄).comp (TensorProduct.map f.toLinearMap g.toLinearMap) = Q₁.tmul Q₃ := by
have h₁ : Q₁ = Q₂.comp f.toLinearMap := QuadraticForm.ext fun x => (f.map_app x).symm
have h₃ : Q₃ = Q₄.comp g.toLinearMap := QuadraticForm.ext fun x => (g.map_app x).symm
refine (QuadraticForm.associated_rightInverse R).injective ?_
ext m₁ m₃ m₁' m₃'
simp [-associated_apply, h₁, h₃, associated_tmul]
@[simp]
theorem tmul_tensorMap_apply
{Q₁ : QuadraticForm R M₁} {Q₂ : QuadraticForm R M₂}
{Q₃ : QuadraticForm R M₃} {Q₄ : QuadraticForm R M₄}
(f : Q₁ →qᵢ Q₂) (g : Q₃ →qᵢ Q₄) (x : M₁ ⊗[R] M₃) :
Q₂.tmul Q₄ (TensorProduct.map f.toLinearMap g.toLinearMap x) = Q₁.tmul Q₃ x :=
DFunLike.congr_fun (tmul_comp_tensorMap f g) x
section tensorLId
| Mathlib/LinearAlgebra/QuadraticForm/TensorProduct/Isometries.lean | 186 | 192 | theorem comp_tensorLId_eq (Q₂ : QuadraticForm R M₂) :
Q₂.comp (TensorProduct.lid R M₂) = (sq (R := R)).tmul Q₂ := by |
refine (QuadraticForm.associated_rightInverse R).injective ?_
ext m₂ m₂'
dsimp [-associated_apply]
simp only [associated_tmul, QuadraticForm.associated_comp]
simp [-associated_apply, mul_one]
| 0.71875 |
import Aesop
import Mathlib.Algebra.Group.Defs
import Mathlib.Data.Nat.Defs
import Mathlib.Data.Int.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Cases
import Mathlib.Tactic.SimpRw
import Mathlib.Tactic.SplitIfs
#align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
variable {α β G M : Type*}
@[to_additive]
instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (α := G) (· * ·) := ⟨mul_comm⟩
#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
attribute [local simp] mul_assoc sub_eq_add_neg
section DivInvMonoid
variable [DivInvMonoid G] {a b c : G}
@[to_additive, field_simps] -- The attributes are out of order on purpose
theorem inv_eq_one_div (x : G) : x⁻¹ = 1 / x := by rw [div_eq_mul_inv, one_mul]
#align inv_eq_one_div inv_eq_one_div
#align neg_eq_zero_sub neg_eq_zero_sub
@[to_additive]
theorem mul_one_div (x y : G) : x * (1 / y) = x / y := by
rw [div_eq_mul_inv, one_mul, div_eq_mul_inv]
#align mul_one_div mul_one_div
#align add_zero_sub add_zero_sub
@[to_additive]
| Mathlib/Algebra/Group/Basic.lean | 456 | 457 | theorem mul_div_assoc (a b c : G) : a * b / c = a * (b / c) := by |
rw [div_eq_mul_inv, div_eq_mul_inv, mul_assoc _ _ _]
| 0.71875 |
import Mathlib.Geometry.Euclidean.Angle.Oriented.Affine
import Mathlib.Geometry.Euclidean.Angle.Unoriented.RightAngle
#align_import geometry.euclidean.angle.oriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace Orientation
open FiniteDimensional
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
variable [hd2 : Fact (finrank ℝ V = 2)] (o : Orientation ℝ V (Fin 2))
theorem oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by
have hs : (o.oangle x (x + y)).sign = 1 := by
rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two]
rw [o.oangle_eq_angle_of_sign_eq_one hs,
InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero
(o.inner_eq_zero_of_oangle_eq_pi_div_two h)]
#align orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two
theorem oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle (x + y) y = Real.arccos (‖y‖ / ‖x + y‖) := by
rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢
rw [add_comm]
exact (-o).oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two h
#align orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two
theorem oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖) := by
have hs : (o.oangle x (x + y)).sign = 1 := by
rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two]
rw [o.oangle_eq_angle_of_sign_eq_one hs,
InnerProductGeometry.angle_add_eq_arcsin_of_inner_eq_zero
(o.inner_eq_zero_of_oangle_eq_pi_div_two h)
(Or.inl (o.left_ne_zero_of_oangle_eq_pi_div_two h))]
#align orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two
theorem oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle (x + y) y = Real.arcsin (‖x‖ / ‖x + y‖) := by
rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢
rw [add_comm]
exact (-o).oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two h
#align orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two
theorem oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle x (x + y) = Real.arctan (‖y‖ / ‖x‖) := by
have hs : (o.oangle x (x + y)).sign = 1 := by
rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two]
rw [o.oangle_eq_angle_of_sign_eq_one hs,
InnerProductGeometry.angle_add_eq_arctan_of_inner_eq_zero
(o.inner_eq_zero_of_oangle_eq_pi_div_two h) (o.left_ne_zero_of_oangle_eq_pi_div_two h)]
#align orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two
| Mathlib/Geometry/Euclidean/Angle/Oriented/RightAngle.lean | 83 | 87 | theorem oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle (x + y) y = Real.arctan (‖x‖ / ‖y‖) := by |
rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢
rw [add_comm]
exact (-o).oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two h
| 0.71875 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
#align_import analysis.calculus.deriv.comp from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
open scoped Classical
open Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
section CompositionVector
open ContinuousLinearMap
variable {l : F → E} {l' : F →L[𝕜] E} {y : F}
variable (x)
theorem HasFDerivWithinAt.comp_hasDerivWithinAt {t : Set F} (hl : HasFDerivWithinAt l l' t (f x))
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasFDerivWithinAt hst).hasDerivWithinAt
#align has_fderiv_within_at.comp_has_deriv_within_at HasFDerivWithinAt.comp_hasDerivWithinAt
theorem HasFDerivWithinAt.comp_hasDerivWithinAt_of_eq {t : Set F}
(hl : HasFDerivWithinAt l l' t y)
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf hst
theorem HasFDerivAt.comp_hasDerivWithinAt (hl : HasFDerivAt l l' (f x))
(hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (l ∘ f) (l' f') s x :=
hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf (mapsTo_univ _ _)
#align has_fderiv_at.comp_has_deriv_within_at HasFDerivAt.comp_hasDerivWithinAt
theorem HasFDerivAt.comp_hasDerivWithinAt_of_eq (hl : HasFDerivAt l l' y)
(hf : HasDerivWithinAt f f' s x) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf
theorem HasFDerivAt.comp_hasDerivAt (hl : HasFDerivAt l l' (f x)) (hf : HasDerivAt f f' x) :
HasDerivAt (l ∘ f) (l' f') x :=
hasDerivWithinAt_univ.mp <| hl.comp_hasDerivWithinAt x hf.hasDerivWithinAt
#align has_fderiv_at.comp_has_deriv_at HasFDerivAt.comp_hasDerivAt
theorem HasFDerivAt.comp_hasDerivAt_of_eq
(hl : HasFDerivAt l l' y) (hf : HasDerivAt f f' x) (hy : y = f x) :
HasDerivAt (l ∘ f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasDerivAt x hf
theorem HasStrictFDerivAt.comp_hasStrictDerivAt (hl : HasStrictFDerivAt l l' (f x))
(hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (l ∘ f) (l' f') x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasStrictFDerivAt).hasStrictDerivAt
#align has_strict_fderiv_at.comp_has_strict_deriv_at HasStrictFDerivAt.comp_hasStrictDerivAt
| Mathlib/Analysis/Calculus/Deriv/Comp.lean | 393 | 396 | theorem HasStrictFDerivAt.comp_hasStrictDerivAt_of_eq (hl : HasStrictFDerivAt l l' y)
(hf : HasStrictDerivAt f f' x) (hy : y = f x) :
HasStrictDerivAt (l ∘ f) (l' f') x := by |
rw [hy] at hl; exact hl.comp_hasStrictDerivAt x hf
| 0.71875 |
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]
| Mathlib/Algebra/Polynomial/Taylor.lean | 98 | 102 | 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]
| 0.71875 |
import Batteries.Tactic.SeqFocus
namespace Ordering
@[simp] theorem swap_swap {o : Ordering} : o.swap.swap = o := by cases o <;> rfl
@[simp] theorem swap_inj {o₁ o₂ : Ordering} : o₁.swap = o₂.swap ↔ o₁ = o₂ :=
⟨fun h => by simpa using congrArg swap h, congrArg _⟩
theorem swap_then (o₁ o₂ : Ordering) : (o₁.then o₂).swap = o₁.swap.then o₂.swap := by
cases o₁ <;> rfl
theorem then_eq_lt {o₁ o₂ : Ordering} : o₁.then o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
cases o₁ <;> cases o₂ <;> decide
| .lake/packages/batteries/Batteries/Classes/Order.lean | 23 | 24 | theorem then_eq_eq {o₁ o₂ : Ordering} : o₁.then o₂ = eq ↔ o₁ = eq ∧ o₂ = eq := by |
cases o₁ <;> simp [«then»]
| 0.71875 |
import Mathlib.Algebra.FreeMonoid.Basic
import Mathlib.Algebra.Group.Submonoid.MulOpposite
import Mathlib.Algebra.Group.Submonoid.Operations
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Int.Order.Lemmas
#align_import group_theory.submonoid.membership from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
variable {M A B : Type*}
section Assoc
variable [Monoid M] [SetLike B M] [SubmonoidClass B M] {S : B}
namespace Submonoid
variable [Monoid M] {a : M}
open MonoidHom
theorem closure_singleton_eq (x : M) : closure ({x} : Set M) = mrange (powersHom M x) :=
closure_eq_of_le (Set.singleton_subset_iff.2 ⟨Multiplicative.ofAdd 1, pow_one x⟩) fun _ ⟨_, hn⟩ =>
hn ▸ pow_mem (subset_closure <| Set.mem_singleton _) _
#align submonoid.closure_singleton_eq Submonoid.closure_singleton_eq
theorem mem_closure_singleton {x y : M} : y ∈ closure ({x} : Set M) ↔ ∃ n : ℕ, x ^ n = y := by
rw [closure_singleton_eq, mem_mrange]; rfl
#align submonoid.mem_closure_singleton Submonoid.mem_closure_singleton
theorem mem_closure_singleton_self {y : M} : y ∈ closure ({y} : Set M) :=
mem_closure_singleton.2 ⟨1, pow_one y⟩
#align submonoid.mem_closure_singleton_self Submonoid.mem_closure_singleton_self
| Mathlib/Algebra/Group/Submonoid/Membership.lean | 340 | 341 | theorem closure_singleton_one : closure ({1} : Set M) = ⊥ := by |
simp [eq_bot_iff_forall, mem_closure_singleton]
| 0.71875 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
α : Expr
univ : Level
α0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let α ← inferType e
let c ← synthInstance (← mkAppM ``AddCommMonoid #[α])
let cg ← synthInstance? (← mkAppM ``AddCommGroup #[α])
let u ← mkFreshLevelMVar
_ ← isDefEq (.sort (.succ u)) (← inferType α)
let α0 ← Expr.ofNat α 0
match cg with
| some cg => return ⟨α, u, α0, true, cg⟩
| _ => return ⟨α, u, α0, false, c⟩
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr → Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.α).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (← synthInstance ((Expr.const inst [c.univ]).app c.α)) l
def addG : Name → Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c ← read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {α} [AddCommMonoid α] (n : ℕ) (x a : α) : α := n • x + a
def termg {α} [AddCommGroup α] (n : ℤ) (x a : α) : α := n • x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : ℤ) : M Expr := do
Expr.ofInt (mkConst (if (← read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr → Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (← mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (← read).α0
open NormalExpr
theorem const_add_term {α} [AddCommMonoid α] (k n x a a') (h : k + a = a') :
k + @term α _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
theorem const_add_termg {α} [AddCommGroup α] (k n x a a') (h : k + a = a') :
k + @termg α _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
theorem term_add_const {α} [AddCommMonoid α] (n x a k a') (h : a + k = a') :
@term α _ n x a + k = term n x a' := by
simp [h.symm, term, add_assoc]
theorem term_add_constg {α} [AddCommGroup α] (n x a k a') (h : a + k = a') :
@termg α _ n x a + k = termg n x a' := by
simp [h.symm, termg, add_assoc]
theorem term_add_term {α} [AddCommMonoid α] (n₁ x a₁ n₂ a₂ n' a') (h₁ : n₁ + n₂ = n')
(h₂ : a₁ + a₂ = a') : @term α _ n₁ x a₁ + @term α _ n₂ x a₂ = term n' x a' := by
simp [h₁.symm, h₂.symm, term, add_nsmul, add_assoc, add_left_comm]
theorem term_add_termg {α} [AddCommGroup α] (n₁ x a₁ n₂ a₂ n' a')
(h₁ : n₁ + n₂ = n') (h₂ : a₁ + a₂ = a') :
@termg α _ n₁ x a₁ + @termg α _ n₂ x a₂ = termg n' x a' := by
simp only [termg, h₁.symm, add_zsmul, h₂.symm]
exact add_add_add_comm (n₁ • x) a₁ (n₂ • x) a₂
theorem zero_term {α} [AddCommMonoid α] (x a) : @term α _ 0 x a = a := by
simp [term, zero_nsmul, one_nsmul]
| Mathlib/Tactic/Abel.lean | 157 | 158 | theorem zero_termg {α} [AddCommGroup α] (x a) : @termg α _ 0 x a = a := by |
simp [termg, zero_zsmul]
| 0.71875 |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iio]
#align order_iso.preimage_Ico OrderIso.preimage_Ico
@[simp]
theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iic]
#align order_iso.preimage_Ioc OrderIso.preimage_Ioc
@[simp]
theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iio]
#align order_iso.preimage_Ioo OrderIso.preimage_Ioo
@[simp]
theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm]
#align order_iso.image_Iic OrderIso.image_Iic
@[simp]
theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) :=
e.dual.image_Iic a
#align order_iso.image_Ici OrderIso.image_Ici
@[simp]
theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm]
#align order_iso.image_Iio OrderIso.image_Iio
@[simp]
theorem image_Ioi (e : α ≃o β) (a : α) : e '' Ioi a = Ioi (e a) :=
e.dual.image_Iio a
#align order_iso.image_Ioi OrderIso.image_Ioi
@[simp]
theorem image_Ioo (e : α ≃o β) (a b : α) : e '' Ioo a b = Ioo (e a) (e b) := by
rw [e.image_eq_preimage, e.symm.preimage_Ioo, e.symm_symm]
#align order_iso.image_Ioo OrderIso.image_Ioo
@[simp]
theorem image_Ioc (e : α ≃o β) (a b : α) : e '' Ioc a b = Ioc (e a) (e b) := by
rw [e.image_eq_preimage, e.symm.preimage_Ioc, e.symm_symm]
#align order_iso.image_Ioc OrderIso.image_Ioc
@[simp]
theorem image_Ico (e : α ≃o β) (a b : α) : e '' Ico a b = Ico (e a) (e b) := by
rw [e.image_eq_preimage, e.symm.preimage_Ico, e.symm_symm]
#align order_iso.image_Ico OrderIso.image_Ico
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 103 | 104 | theorem image_Icc (e : α ≃o β) (a b : α) : e '' Icc a b = Icc (e a) (e b) := by |
rw [e.image_eq_preimage, e.symm.preimage_Icc, e.symm_symm]
| 0.71875 |
import Mathlib.Order.RelClasses
#align_import data.sigma.lex from "leanprover-community/mathlib"@"41cf0cc2f528dd40a8f2db167ea4fb37b8fde7f3"
namespace Sigma
variable {ι : Type*} {α : ι → Type*} {r r₁ r₂ : ι → ι → Prop} {s s₁ s₂ : ∀ i, α i → α i → Prop}
{a b : Σ i, α i}
inductive Lex (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) : ∀ _ _ : Σ i, α i, Prop
| left {i j : ι} (a : α i) (b : α j) : r i j → Lex r s ⟨i, a⟩ ⟨j, b⟩
| right {i : ι} (a b : α i) : s i a b → Lex r s ⟨i, a⟩ ⟨i, b⟩
#align sigma.lex Sigma.Lex
theorem lex_iff : Lex r s a b ↔ r a.1 b.1 ∨ ∃ h : a.1 = b.1, s b.1 (h.rec a.2) b.2 := by
constructor
· rintro (⟨a, b, hij⟩ | ⟨a, b, hab⟩)
· exact Or.inl hij
· exact Or.inr ⟨rfl, hab⟩
· obtain ⟨i, a⟩ := a
obtain ⟨j, b⟩ := b
dsimp only
rintro (h | ⟨rfl, h⟩)
· exact Lex.left _ _ h
· exact Lex.right _ _ h
#align sigma.lex_iff Sigma.lex_iff
instance Lex.decidable (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) [DecidableEq ι]
[DecidableRel r] [∀ i, DecidableRel (s i)] : DecidableRel (Lex r s) := fun _ _ =>
decidable_of_decidable_of_iff lex_iff.symm
#align sigma.lex.decidable Sigma.Lex.decidable
theorem Lex.mono (hr : ∀ a b, r₁ a b → r₂ a b) (hs : ∀ i a b, s₁ i a b → s₂ i a b) {a b : Σ i, α i}
(h : Lex r₁ s₁ a b) : Lex r₂ s₂ a b := by
obtain ⟨a, b, hij⟩ | ⟨a, b, hab⟩ := h
· exact Lex.left _ _ (hr _ _ hij)
· exact Lex.right _ _ (hs _ _ _ hab)
#align sigma.lex.mono Sigma.Lex.mono
theorem Lex.mono_left (hr : ∀ a b, r₁ a b → r₂ a b) {a b : Σ i, α i} (h : Lex r₁ s a b) :
Lex r₂ s a b :=
h.mono hr fun _ _ _ => id
#align sigma.lex.mono_left Sigma.Lex.mono_left
theorem Lex.mono_right (hs : ∀ i a b, s₁ i a b → s₂ i a b) {a b : Σ i, α i} (h : Lex r s₁ a b) :
Lex r s₂ a b :=
h.mono (fun _ _ => id) hs
#align sigma.lex.mono_right Sigma.Lex.mono_right
| Mathlib/Data/Sigma/Lex.lean | 80 | 83 | theorem lex_swap : Lex (Function.swap r) s a b ↔ Lex r (fun i => Function.swap (s i)) b a := by |
constructor <;>
· rintro (⟨a, b, h⟩ | ⟨a, b, h⟩)
exacts [Lex.left _ _ h, Lex.right _ _ h]
| 0.71875 |
import Mathlib.LinearAlgebra.Dimension.DivisionRing
import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition
noncomputable section
universe u v v' v''
variable {K : Type u} {V V₁ : Type v} {V' V'₁ : Type v'} {V'' : Type v''}
open Cardinal Basis Submodule Function Set
namespace LinearMap
section Ring
variable [Ring K] [AddCommGroup V] [Module K V] [AddCommGroup V₁] [Module K V₁]
variable [AddCommGroup V'] [Module K V']
abbrev rank (f : V →ₗ[K] V') : Cardinal :=
Module.rank K (LinearMap.range f)
#align linear_map.rank LinearMap.rank
theorem rank_le_range (f : V →ₗ[K] V') : rank f ≤ Module.rank K V' :=
rank_submodule_le _
#align linear_map.rank_le_range LinearMap.rank_le_range
theorem rank_le_domain (f : V →ₗ[K] V₁) : rank f ≤ Module.rank K V :=
rank_range_le _
#align linear_map.rank_le_domain LinearMap.rank_le_domain
@[simp]
theorem rank_zero [Nontrivial K] : rank (0 : V →ₗ[K] V') = 0 := by
rw [rank, LinearMap.range_zero, rank_bot]
#align linear_map.rank_zero LinearMap.rank_zero
variable [AddCommGroup V''] [Module K V'']
theorem rank_comp_le_left (g : V →ₗ[K] V') (f : V' →ₗ[K] V'') : rank (f.comp g) ≤ rank f := by
refine rank_le_of_submodule _ _ ?_
rw [LinearMap.range_comp]
exact LinearMap.map_le_range
#align linear_map.rank_comp_le_left LinearMap.rank_comp_le_left
theorem lift_rank_comp_le_right (g : V →ₗ[K] V') (f : V' →ₗ[K] V'') :
Cardinal.lift.{v'} (rank (f.comp g)) ≤ Cardinal.lift.{v''} (rank g) := by
rw [rank, rank, LinearMap.range_comp]; exact lift_rank_map_le _ _
#align linear_map.lift_rank_comp_le_right LinearMap.lift_rank_comp_le_right
theorem lift_rank_comp_le (g : V →ₗ[K] V') (f : V' →ₗ[K] V'') :
Cardinal.lift.{v'} (rank (f.comp g)) ≤
min (Cardinal.lift.{v'} (rank f)) (Cardinal.lift.{v''} (rank g)) :=
le_min (Cardinal.lift_le.mpr <| rank_comp_le_left _ _) (lift_rank_comp_le_right _ _)
#align linear_map.lift_rank_comp_le LinearMap.lift_rank_comp_le
variable [AddCommGroup V'₁] [Module K V'₁]
theorem rank_comp_le_right (g : V →ₗ[K] V') (f : V' →ₗ[K] V'₁) : rank (f.comp g) ≤ rank g := by
simpa only [Cardinal.lift_id] using lift_rank_comp_le_right g f
#align linear_map.rank_comp_le_right LinearMap.rank_comp_le_right
| Mathlib/LinearAlgebra/Dimension/LinearMap.lean | 79 | 81 | theorem rank_comp_le (g : V →ₗ[K] V') (f : V' →ₗ[K] V'₁) :
rank (f.comp g) ≤ min (rank f) (rank g) := by |
simpa only [Cardinal.lift_id] using lift_rank_comp_le g f
| 0.71875 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Order.WithBot
#align_import data.set.image from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29"
universe u v
open Function Set
namespace Set
variable {α β γ : Type*} {ι ι' : Sort*}
section Preimage
variable {f : α → β} {g : β → γ}
@[simp]
theorem preimage_empty : f ⁻¹' ∅ = ∅ :=
rfl
#align set.preimage_empty Set.preimage_empty
theorem preimage_congr {f g : α → β} {s : Set β} (h : ∀ x : α, f x = g x) : f ⁻¹' s = g ⁻¹' s := by
congr with x
simp [h]
#align set.preimage_congr Set.preimage_congr
@[gcongr]
theorem preimage_mono {s t : Set β} (h : s ⊆ t) : f ⁻¹' s ⊆ f ⁻¹' t := fun _ hx => h hx
#align set.preimage_mono Set.preimage_mono
@[simp, mfld_simps]
theorem preimage_univ : f ⁻¹' univ = univ :=
rfl
#align set.preimage_univ Set.preimage_univ
theorem subset_preimage_univ {s : Set α} : s ⊆ f ⁻¹' univ :=
subset_univ _
#align set.subset_preimage_univ Set.subset_preimage_univ
@[simp, mfld_simps]
theorem preimage_inter {s t : Set β} : f ⁻¹' (s ∩ t) = f ⁻¹' s ∩ f ⁻¹' t :=
rfl
#align set.preimage_inter Set.preimage_inter
@[simp]
theorem preimage_union {s t : Set β} : f ⁻¹' (s ∪ t) = f ⁻¹' s ∪ f ⁻¹' t :=
rfl
#align set.preimage_union Set.preimage_union
@[simp]
theorem preimage_compl {s : Set β} : f ⁻¹' sᶜ = (f ⁻¹' s)ᶜ :=
rfl
#align set.preimage_compl Set.preimage_compl
@[simp]
theorem preimage_diff (f : α → β) (s t : Set β) : f ⁻¹' (s \ t) = f ⁻¹' s \ f ⁻¹' t :=
rfl
#align set.preimage_diff Set.preimage_diff
open scoped symmDiff in
@[simp]
lemma preimage_symmDiff {f : α → β} (s t : Set β) : f ⁻¹' (s ∆ t) = (f ⁻¹' s) ∆ (f ⁻¹' t) :=
rfl
#align set.preimage_symm_diff Set.preimage_symmDiff
@[simp]
theorem preimage_ite (f : α → β) (s t₁ t₂ : Set β) :
f ⁻¹' s.ite t₁ t₂ = (f ⁻¹' s).ite (f ⁻¹' t₁) (f ⁻¹' t₂) :=
rfl
#align set.preimage_ite Set.preimage_ite
@[simp]
theorem preimage_setOf_eq {p : α → Prop} {f : β → α} : f ⁻¹' { a | p a } = { a | p (f a) } :=
rfl
#align set.preimage_set_of_eq Set.preimage_setOf_eq
@[simp]
theorem preimage_id_eq : preimage (id : α → α) = id :=
rfl
#align set.preimage_id_eq Set.preimage_id_eq
@[mfld_simps]
theorem preimage_id {s : Set α} : id ⁻¹' s = s :=
rfl
#align set.preimage_id Set.preimage_id
@[simp, mfld_simps]
theorem preimage_id' {s : Set α} : (fun x => x) ⁻¹' s = s :=
rfl
#align set.preimage_id' Set.preimage_id'
@[simp]
theorem preimage_const_of_mem {b : β} {s : Set β} (h : b ∈ s) : (fun _ : α => b) ⁻¹' s = univ :=
eq_univ_of_forall fun _ => h
#align set.preimage_const_of_mem Set.preimage_const_of_mem
@[simp]
theorem preimage_const_of_not_mem {b : β} {s : Set β} (h : b ∉ s) : (fun _ : α => b) ⁻¹' s = ∅ :=
eq_empty_of_subset_empty fun _ hx => h hx
#align set.preimage_const_of_not_mem Set.preimage_const_of_not_mem
| Mathlib/Data/Set/Image.lean | 133 | 136 | theorem preimage_const (b : β) (s : Set β) [Decidable (b ∈ s)] :
(fun _ : α => b) ⁻¹' s = if b ∈ s then univ else ∅ := by |
split_ifs with hb
exacts [preimage_const_of_mem hb, preimage_const_of_not_mem hb]
| 0.71875 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Algebra.Ring.Rat
import Mathlib.Data.PNat.Defs
#align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
namespace Rat
open Rat
theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by
cases' e : a /. b with n d h c
rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e
refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <|
c.dvd_of_dvd_mul_right ?_
have := congr_arg Int.natAbs e
simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
#align rat.num_dvd Rat.num_dvd
theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b := by
by_cases b0 : b = 0; · simp [b0]
cases' e : a /. b with n d h c
rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e
refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_
rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp
#align rat.denom_dvd Rat.den_dvd
theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) :
∃ c : ℤ, n = c * q.num ∧ d = c * q.den := by
obtain rfl | hn := eq_or_ne n 0
· simp [qdf]
have : q.num * d = n * ↑q.den := by
refine (divInt_eq_iff ?_ hd).mp ?_
· exact Int.natCast_ne_zero.mpr (Rat.den_nz _)
· rwa [num_divInt_den]
have hqdn : q.num ∣ n := by
rw [qdf]
exact Rat.num_dvd _ hd
refine ⟨n / q.num, ?_, ?_⟩
· rw [Int.ediv_mul_cancel hqdn]
· refine Int.eq_mul_div_of_mul_eq_mul_of_dvd_left ?_ hqdn this
rw [qdf]
exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn)
#align rat.num_denom_mk Rat.num_den_mk
#noalign rat.mk_pnat_num
#noalign rat.mk_pnat_denom
theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
rw [← Int.div_eq_ediv_of_dvd] <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
Int.zero_ediv, Int.ofNat_dvd_left, Nat.gcd_dvd_left, this]
#align rat.num_mk Rat.num_mk
theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
if_neg (Nat.cast_add_one_ne_zero _), this]
#align rat.denom_mk Rat.den_mk
#noalign rat.mk_pnat_denom_dvd
theorem add_den_dvd (q₁ q₂ : ℚ) : (q₁ + q₂).den ∣ q₁.den * q₂.den := by
rw [add_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
#align rat.add_denom_dvd Rat.add_den_dvd
| Mathlib/Data/Rat/Lemmas.lean | 87 | 90 | theorem mul_den_dvd (q₁ q₂ : ℚ) : (q₁ * q₂).den ∣ q₁.den * q₂.den := by |
rw [mul_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
| 0.71875 |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 53 | 54 | theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by |
simp [← Ici_inter_Iio]
| 0.71875 |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.units from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Int
theorem isUnit_iff_abs_eq {x : ℤ} : IsUnit x ↔ abs x = 1 := by
rw [isUnit_iff_natAbs_eq, abs_eq_natAbs, ← Int.ofNat_one, natCast_inj]
#align int.is_unit_iff_abs_eq Int.isUnit_iff_abs_eq
theorem isUnit_sq {a : ℤ} (ha : IsUnit a) : a ^ 2 = 1 := by rw [sq, isUnit_mul_self ha]
#align int.is_unit_sq Int.isUnit_sq
@[simp]
theorem units_sq (u : ℤˣ) : u ^ 2 = 1 := by
rw [Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one, isUnit_sq u.isUnit]
#align int.units_sq Int.units_sq
alias units_pow_two := units_sq
#align int.units_pow_two Int.units_pow_two
@[simp]
theorem units_mul_self (u : ℤˣ) : u * u = 1 := by rw [← sq, units_sq]
#align int.units_mul_self Int.units_mul_self
@[simp]
theorem units_inv_eq_self (u : ℤˣ) : u⁻¹ = u := by rw [inv_eq_iff_mul_eq_one, units_mul_self]
#align int.units_inv_eq_self Int.units_inv_eq_self
theorem units_div_eq_mul (u₁ u₂ : ℤˣ) : u₁ / u₂ = u₁ * u₂ := by
rw [div_eq_mul_inv, units_inv_eq_self]
-- `Units.val_mul` is a "wrong turn" for the simplifier, this undoes it and simplifies further
@[simp]
| Mathlib/Data/Int/Order/Units.lean | 45 | 46 | theorem units_coe_mul_self (u : ℤˣ) : (u * u : ℤ) = 1 := by |
rw [← Units.val_mul, units_mul_self, Units.val_one]
| 0.71875 |
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 lcm
def lcm (s : Finset β) (f : β → α) : α :=
s.fold GCDMonoid.lcm 1 f
#align finset.lcm Finset.lcm
variable {s s₁ s₂ : Finset β} {f : β → α}
theorem lcm_def : s.lcm f = (s.1.map f).lcm :=
rfl
#align finset.lcm_def Finset.lcm_def
@[simp]
theorem lcm_empty : (∅ : Finset β).lcm f = 1 :=
fold_empty
#align finset.lcm_empty Finset.lcm_empty
@[simp]
| Mathlib/Algebra/GCDMonoid/Finset.lean | 62 | 65 | theorem lcm_dvd_iff {a : α} : s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a := by |
apply Iff.trans Multiset.lcm_dvd
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⟩
| 0.71875 |
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.UniqueFactorizationDomain
#align_import ring_theory.localization.num_denom from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86"
variable {R : Type*} [CommRing R] (M : Submonoid R) {S : Type*} [CommRing S]
variable [Algebra R S] {P : Type*} [CommRing P]
namespace IsFractionRing
open IsLocalization
section NumDen
variable (A : Type*) [CommRing A] [IsDomain A] [UniqueFactorizationMonoid A]
variable {K : Type*} [Field K] [Algebra A K] [IsFractionRing A K]
theorem exists_reduced_fraction (x : K) :
∃ (a : A) (b : nonZeroDivisors A), IsRelPrime a b ∧ mk' K a b = x := by
obtain ⟨⟨b, b_nonzero⟩, a, hab⟩ := exists_integer_multiple (nonZeroDivisors A) x
obtain ⟨a', b', c', no_factor, rfl, rfl⟩ :=
UniqueFactorizationMonoid.exists_reduced_factors' a b
(mem_nonZeroDivisors_iff_ne_zero.mp b_nonzero)
obtain ⟨_, b'_nonzero⟩ := mul_mem_nonZeroDivisors.mp b_nonzero
refine ⟨a', ⟨b', b'_nonzero⟩, no_factor, ?_⟩
refine mul_left_cancel₀ (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors b_nonzero) ?_
simp only [Subtype.coe_mk, RingHom.map_mul, Algebra.smul_def] at *
erw [← hab, mul_assoc, mk'_spec' _ a' ⟨b', b'_nonzero⟩]
#align is_fraction_ring.exists_reduced_fraction IsFractionRing.exists_reduced_fraction
noncomputable def num (x : K) : A :=
Classical.choose (exists_reduced_fraction A x)
#align is_fraction_ring.num IsFractionRing.num
noncomputable def den (x : K) : nonZeroDivisors A :=
Classical.choose (Classical.choose_spec (exists_reduced_fraction A x))
#align is_fraction_ring.denom IsFractionRing.den
theorem num_den_reduced (x : K) : IsRelPrime (num A x) (den A x) :=
(Classical.choose_spec (Classical.choose_spec (exists_reduced_fraction A x))).1
#align is_fraction_ring.num_denom_reduced IsFractionRing.num_den_reduced
-- @[simp] -- Porting note: LHS reduces to give the simp lemma below
theorem mk'_num_den (x : K) : mk' K (num A x) (den A x) = x :=
(Classical.choose_spec (Classical.choose_spec (exists_reduced_fraction A x))).2
#align is_fraction_ring.mk'_num_denom IsFractionRing.mk'_num_den
@[simp]
| Mathlib/RingTheory/Localization/NumDen.lean | 70 | 72 | theorem mk'_num_den' (x : K) : algebraMap A K (num A x) / algebraMap A K (den A x) = x := by |
rw [← mk'_eq_div]
apply mk'_num_den
| 0.71875 |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Data.Set.Image
import Mathlib.MeasureTheory.Function.LpSeminorm.ChebyshevMarkov
import Mathlib.MeasureTheory.Function.LpSeminorm.CompareExp
import Mathlib.MeasureTheory.Function.LpSeminorm.TriangleInequality
import Mathlib.MeasureTheory.Measure.OpenPos
import Mathlib.Topology.ContinuousFunction.Compact
import Mathlib.Order.Filter.IndicatorFunction
#align_import measure_theory.function.lp_space from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
noncomputable section
set_option linter.uppercaseLean3 false
open TopologicalSpace MeasureTheory Filter
open scoped NNReal ENNReal Topology MeasureTheory Uniformity
variable {α E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α}
[NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
namespace MeasureTheory
@[simp]
theorem snorm_aeeqFun {α E : Type*} [MeasurableSpace α] {μ : Measure α} [NormedAddCommGroup E]
{p : ℝ≥0∞} {f : α → E} (hf : AEStronglyMeasurable f μ) :
snorm (AEEqFun.mk f hf) p μ = snorm f p μ :=
snorm_congr_ae (AEEqFun.coeFn_mk _ _)
#align measure_theory.snorm_ae_eq_fun MeasureTheory.snorm_aeeqFun
theorem Memℒp.snorm_mk_lt_top {α E : Type*} [MeasurableSpace α] {μ : Measure α}
[NormedAddCommGroup E] {p : ℝ≥0∞} {f : α → E} (hfp : Memℒp f p μ) :
snorm (AEEqFun.mk f hfp.1) p μ < ∞ := by simp [hfp.2]
#align measure_theory.mem_ℒp.snorm_mk_lt_top MeasureTheory.Memℒp.snorm_mk_lt_top
def Lp {α} (E : Type*) {m : MeasurableSpace α} [NormedAddCommGroup E] (p : ℝ≥0∞)
(μ : Measure α := by volume_tac) : AddSubgroup (α →ₘ[μ] E) where
carrier := { f | snorm f p μ < ∞ }
zero_mem' := by simp [snorm_congr_ae AEEqFun.coeFn_zero, snorm_zero]
add_mem' {f g} hf hg := by
simp [snorm_congr_ae (AEEqFun.coeFn_add f g),
snorm_add_lt_top ⟨f.aestronglyMeasurable, hf⟩ ⟨g.aestronglyMeasurable, hg⟩]
neg_mem' {f} hf := by rwa [Set.mem_setOf_eq, snorm_congr_ae (AEEqFun.coeFn_neg f), snorm_neg]
#align measure_theory.Lp MeasureTheory.Lp
-- Porting note: calling the first argument `α` breaks the `(α := ·)` notation
scoped notation:25 α' " →₁[" μ "] " E => MeasureTheory.Lp (α := α') E 1 μ
scoped notation:25 α' " →₂[" μ "] " E => MeasureTheory.Lp (α := α') E 2 μ
namespace Lp
instance instCoeFun : CoeFun (Lp E p μ) (fun _ => α → E) :=
⟨fun f => ((f : α →ₘ[μ] E) : α → E)⟩
#align measure_theory.Lp.has_coe_to_fun MeasureTheory.Lp.instCoeFun
@[ext high]
theorem ext {f g : Lp E p μ} (h : f =ᵐ[μ] g) : f = g := by
cases f
cases g
simp only [Subtype.mk_eq_mk]
exact AEEqFun.ext h
#align measure_theory.Lp.ext MeasureTheory.Lp.ext
theorem ext_iff {f g : Lp E p μ} : f = g ↔ f =ᵐ[μ] g :=
⟨fun h => by rw [h], fun h => ext h⟩
#align measure_theory.Lp.ext_iff MeasureTheory.Lp.ext_iff
theorem mem_Lp_iff_snorm_lt_top {f : α →ₘ[μ] E} : f ∈ Lp E p μ ↔ snorm f p μ < ∞ := Iff.rfl
#align measure_theory.Lp.mem_Lp_iff_snorm_lt_top MeasureTheory.Lp.mem_Lp_iff_snorm_lt_top
| Mathlib/MeasureTheory/Function/LpSpace.lean | 177 | 178 | theorem mem_Lp_iff_memℒp {f : α →ₘ[μ] E} : f ∈ Lp E p μ ↔ Memℒp f p μ := by |
simp [mem_Lp_iff_snorm_lt_top, Memℒp, f.stronglyMeasurable.aestronglyMeasurable]
| 0.71875 |
import Mathlib.Analysis.NormedSpace.PiLp
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped NNReal Matrix
namespace Matrix
variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n]
section LinfLinf
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n α) :=
Pi.seminormedAddCommGroup
#align matrix.seminormed_add_comm_group Matrix.seminormedAddCommGroup
attribute [local instance] Matrix.seminormedAddCommGroup
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem norm_def (A : Matrix m n α) : ‖A‖ = ‖fun i j => A i j‖ := rfl
lemma norm_eq_sup_sup_nnnorm (A : Matrix m n α) :
‖A‖ = Finset.sup Finset.univ fun i ↦ Finset.sup Finset.univ fun j ↦ ‖A i j‖₊ := by
simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def]
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem nnnorm_def (A : Matrix m n α) : ‖A‖₊ = ‖fun i j => A i j‖₊ := rfl
theorem norm_le_iff {r : ℝ} (hr : 0 ≤ r) {A : Matrix m n α} : ‖A‖ ≤ r ↔ ∀ i j, ‖A i j‖ ≤ r := by
simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr]
#align matrix.norm_le_iff Matrix.norm_le_iff
theorem nnnorm_le_iff {r : ℝ≥0} {A : Matrix m n α} : ‖A‖₊ ≤ r ↔ ∀ i j, ‖A i j‖₊ ≤ r := by
simp_rw [nnnorm_def, pi_nnnorm_le_iff]
#align matrix.nnnorm_le_iff Matrix.nnnorm_le_iff
theorem norm_lt_iff {r : ℝ} (hr : 0 < r) {A : Matrix m n α} : ‖A‖ < r ↔ ∀ i j, ‖A i j‖ < r := by
simp_rw [norm_def, pi_norm_lt_iff hr]
#align matrix.norm_lt_iff Matrix.norm_lt_iff
theorem nnnorm_lt_iff {r : ℝ≥0} (hr : 0 < r) {A : Matrix m n α} :
‖A‖₊ < r ↔ ∀ i j, ‖A i j‖₊ < r := by
simp_rw [nnnorm_def, pi_nnnorm_lt_iff hr]
#align matrix.nnnorm_lt_iff Matrix.nnnorm_lt_iff
theorem norm_entry_le_entrywise_sup_norm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖ ≤ ‖A‖ :=
(norm_le_pi_norm (A i) j).trans (norm_le_pi_norm A i)
#align matrix.norm_entry_le_entrywise_sup_norm Matrix.norm_entry_le_entrywise_sup_norm
theorem nnnorm_entry_le_entrywise_sup_nnnorm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖₊ ≤ ‖A‖₊ :=
(nnnorm_le_pi_nnnorm (A i) j).trans (nnnorm_le_pi_nnnorm A i)
#align matrix.nnnorm_entry_le_entrywise_sup_nnnorm Matrix.nnnorm_entry_le_entrywise_sup_nnnorm
@[simp]
theorem nnnorm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖₊ = ‖a‖₊) :
‖A.map f‖₊ = ‖A‖₊ := by
simp only [nnnorm_def, Pi.nnnorm_def, Matrix.map_apply, hf]
#align matrix.nnnorm_map_eq Matrix.nnnorm_map_eq
@[simp]
theorem norm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖ = ‖a‖) : ‖A.map f‖ = ‖A‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_map_eq A f fun a => Subtype.ext <| hf a : _)
#align matrix.norm_map_eq Matrix.norm_map_eq
@[simp]
theorem nnnorm_transpose (A : Matrix m n α) : ‖Aᵀ‖₊ = ‖A‖₊ :=
Finset.sup_comm _ _ _
#align matrix.nnnorm_transpose Matrix.nnnorm_transpose
@[simp]
theorem norm_transpose (A : Matrix m n α) : ‖Aᵀ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_transpose A
#align matrix.norm_transpose Matrix.norm_transpose
@[simp]
theorem nnnorm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) :
‖Aᴴ‖₊ = ‖A‖₊ :=
(nnnorm_map_eq _ _ nnnorm_star).trans A.nnnorm_transpose
#align matrix.nnnorm_conj_transpose Matrix.nnnorm_conjTranspose
@[simp]
theorem norm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) : ‖Aᴴ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_conjTranspose A
#align matrix.norm_conj_transpose Matrix.norm_conjTranspose
instance [StarAddMonoid α] [NormedStarGroup α] : NormedStarGroup (Matrix m m α) :=
⟨norm_conjTranspose⟩
@[simp]
theorem nnnorm_col (v : m → α) : ‖col v‖₊ = ‖v‖₊ := by
simp [nnnorm_def, Pi.nnnorm_def]
#align matrix.nnnorm_col Matrix.nnnorm_col
@[simp]
theorem norm_col (v : m → α) : ‖col v‖ = ‖v‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_col v
#align matrix.norm_col Matrix.norm_col
@[simp]
| Mathlib/Analysis/Matrix.lean | 161 | 162 | theorem nnnorm_row (v : n → α) : ‖row v‖₊ = ‖v‖₊ := by |
simp [nnnorm_def, Pi.nnnorm_def]
| 0.71875 |
import Mathlib.Analysis.Complex.Circle
import Mathlib.Analysis.NormedSpace.BallAction
#align_import analysis.complex.unit_disc.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open Set Function Metric
noncomputable section
local notation "conj'" => starRingEnd ℂ
namespace Complex
def UnitDisc : Type :=
ball (0 : ℂ) 1 deriving TopologicalSpace
#align complex.unit_disc Complex.UnitDisc
@[inherit_doc] scoped[UnitDisc] notation "𝔻" => Complex.UnitDisc
open UnitDisc
namespace UnitDisc
instance instCommSemigroup : CommSemigroup UnitDisc := by unfold UnitDisc; infer_instance
instance instHasDistribNeg : HasDistribNeg UnitDisc := by unfold UnitDisc; infer_instance
instance instCoe : Coe UnitDisc ℂ := ⟨Subtype.val⟩
theorem coe_injective : Injective ((↑) : 𝔻 → ℂ) :=
Subtype.coe_injective
#align complex.unit_disc.coe_injective Complex.UnitDisc.coe_injective
theorem abs_lt_one (z : 𝔻) : abs (z : ℂ) < 1 :=
mem_ball_zero_iff.1 z.2
#align complex.unit_disc.abs_lt_one Complex.UnitDisc.abs_lt_one
theorem abs_ne_one (z : 𝔻) : abs (z : ℂ) ≠ 1 :=
z.abs_lt_one.ne
#align complex.unit_disc.abs_ne_one Complex.UnitDisc.abs_ne_one
| Mathlib/Analysis/Complex/UnitDisc/Basic.lean | 53 | 55 | theorem normSq_lt_one (z : 𝔻) : normSq z < 1 := by |
convert (Real.sqrt_lt' one_pos).1 z.abs_lt_one
exact (one_pow 2).symm
| 0.71875 |
import Mathlib.Data.Finset.Card
#align_import data.finset.prod from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
assert_not_exists MonoidWithZero
open Multiset
variable {α β γ : Type*}
namespace Finset
section Prod
variable {s s' : Finset α} {t t' : Finset β} {a : α} {b : β}
protected def product (s : Finset α) (t : Finset β) : Finset (α × β) :=
⟨_, s.nodup.product t.nodup⟩
#align finset.product Finset.product
instance instSProd : SProd (Finset α) (Finset β) (Finset (α × β)) where
sprod := Finset.product
@[simp]
theorem product_val : (s ×ˢ t).1 = s.1 ×ˢ t.1 :=
rfl
#align finset.product_val Finset.product_val
@[simp]
theorem mem_product {p : α × β} : p ∈ s ×ˢ t ↔ p.1 ∈ s ∧ p.2 ∈ t :=
Multiset.mem_product
#align finset.mem_product Finset.mem_product
theorem mk_mem_product (ha : a ∈ s) (hb : b ∈ t) : (a, b) ∈ s ×ˢ t :=
mem_product.2 ⟨ha, hb⟩
#align finset.mk_mem_product Finset.mk_mem_product
@[simp, norm_cast]
theorem coe_product (s : Finset α) (t : Finset β) :
(↑(s ×ˢ t) : Set (α × β)) = (s : Set α) ×ˢ t :=
Set.ext fun _ => Finset.mem_product
#align finset.coe_product Finset.coe_product
theorem subset_product_image_fst [DecidableEq α] : (s ×ˢ t).image Prod.fst ⊆ s := fun i => by
simp (config := { contextual := true }) [mem_image]
#align finset.subset_product_image_fst Finset.subset_product_image_fst
theorem subset_product_image_snd [DecidableEq β] : (s ×ˢ t).image Prod.snd ⊆ t := fun i => by
simp (config := { contextual := true }) [mem_image]
#align finset.subset_product_image_snd Finset.subset_product_image_snd
theorem product_image_fst [DecidableEq α] (ht : t.Nonempty) : (s ×ˢ t).image Prod.fst = s := by
ext i
simp [mem_image, ht.exists_mem]
#align finset.product_image_fst Finset.product_image_fst
| Mathlib/Data/Finset/Prod.lean | 81 | 83 | theorem product_image_snd [DecidableEq β] (ht : s.Nonempty) : (s ×ˢ t).image Prod.snd = t := by |
ext i
simp [mem_image, ht.exists_mem]
| 0.71875 |
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Order.Disjointed
import Mathlib.MeasureTheory.OuterMeasure.Defs
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
section OuterMeasureClass
variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α]
{μ : F} {s t : Set α}
@[simp]
theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ
#align measure_theory.measure_empty MeasureTheory.measure_empty
@[mono, gcongr]
theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t :=
OuterMeasureClass.measure_mono μ h
#align measure_theory.measure_mono MeasureTheory.measure_mono
theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 :=
eq_bot_mono (measure_mono h) ht
#align measure_theory.measure_mono_null MeasureTheory.measure_mono_null
theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t :=
hs.bot_lt.trans_le (measure_mono h)
theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by
refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _
calc
μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed]
_ ≤ ∑' i, μ (disjointed t i) :=
OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _)
_ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset
#align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le
| Mathlib/MeasureTheory/OuterMeasure/Basic.lean | 72 | 76 | theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by |
have := hI.to_subtype
rw [biUnion_eq_iUnion]
apply measure_iUnion_le
| 0.71875 |
import Mathlib.Data.Vector.Basic
#align_import data.vector.mem from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
namespace Vector
variable {α β : Type*} {n : ℕ} (a a' : α)
@[simp]
theorem get_mem (i : Fin n) (v : Vector α n) : v.get i ∈ v.toList := by
rw [get_eq_get]
exact List.get_mem _ _ _
#align vector.nth_mem Vector.get_mem
theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by
simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get]
exact
⟨fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length] at hi, h⟩, fun ⟨i, hi, h⟩ =>
⟨i, by rwa [toList_length], h⟩⟩
#align vector.mem_iff_nth Vector.mem_iff_get
theorem not_mem_nil : a ∉ (Vector.nil : Vector α 0).toList := by
unfold Vector.nil
dsimp
simp
#align vector.not_mem_nil Vector.not_mem_nil
theorem not_mem_zero (v : Vector α 0) : a ∉ v.toList :=
(Vector.eq_nil v).symm ▸ not_mem_nil a
#align vector.not_mem_zero Vector.not_mem_zero
| Mathlib/Data/Vector/Mem.lean | 48 | 49 | theorem mem_cons_iff (v : Vector α n) : a' ∈ (a ::ᵥ v).toList ↔ a' = a ∨ a' ∈ v.toList := by |
rw [Vector.toList_cons, List.mem_cons]
| 0.71875 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Induction
#align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f"
set_option linter.uppercaseLean3 false
noncomputable section
open Finset AddMonoidAlgebra
open Polynomial
namespace Polynomial
universe u v w y
variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {a b : R} {m n : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
section
variable [Semiring S]
variable (f : R →+* S) (x : S)
irreducible_def eval₂ (p : R[X]) : S :=
p.sum fun e a => f a * x ^ e
#align polynomial.eval₂ Polynomial.eval₂
theorem eval₂_eq_sum {f : R →+* S} {x : S} : p.eval₂ f x = p.sum fun e a => f a * x ^ e := by
rw [eval₂_def]
#align polynomial.eval₂_eq_sum Polynomial.eval₂_eq_sum
theorem eval₂_congr {R S : Type*} [Semiring R] [Semiring S] {f g : R →+* S} {s t : S}
{φ ψ : R[X]} : f = g → s = t → φ = ψ → eval₂ f s φ = eval₂ g t ψ := by
rintro rfl rfl rfl; rfl
#align polynomial.eval₂_congr Polynomial.eval₂_congr
@[simp]
theorem eval₂_at_zero : p.eval₂ f 0 = f (coeff p 0) := by
simp (config := { contextual := true }) only [eval₂_eq_sum, zero_pow_eq, mul_ite, mul_zero,
mul_one, sum, Classical.not_not, mem_support_iff, sum_ite_eq', ite_eq_left_iff,
RingHom.map_zero, imp_true_iff, eq_self_iff_true]
#align polynomial.eval₂_at_zero Polynomial.eval₂_at_zero
@[simp]
theorem eval₂_zero : (0 : R[X]).eval₂ f x = 0 := by simp [eval₂_eq_sum]
#align polynomial.eval₂_zero Polynomial.eval₂_zero
@[simp]
theorem eval₂_C : (C a).eval₂ f x = f a := by simp [eval₂_eq_sum]
#align polynomial.eval₂_C Polynomial.eval₂_C
@[simp]
theorem eval₂_X : X.eval₂ f x = x := by simp [eval₂_eq_sum]
#align polynomial.eval₂_X Polynomial.eval₂_X
@[simp]
theorem eval₂_monomial {n : ℕ} {r : R} : (monomial n r).eval₂ f x = f r * x ^ n := by
simp [eval₂_eq_sum]
#align polynomial.eval₂_monomial Polynomial.eval₂_monomial
@[simp]
theorem eval₂_X_pow {n : ℕ} : (X ^ n).eval₂ f x = x ^ n := by
rw [X_pow_eq_monomial]
convert eval₂_monomial f x (n := n) (r := 1)
simp
#align polynomial.eval₂_X_pow Polynomial.eval₂_X_pow
@[simp]
theorem eval₂_add : (p + q).eval₂ f x = p.eval₂ f x + q.eval₂ f x := by
simp only [eval₂_eq_sum]
apply sum_add_index <;> simp [add_mul]
#align polynomial.eval₂_add Polynomial.eval₂_add
@[simp]
theorem eval₂_one : (1 : R[X]).eval₂ f x = 1 := by rw [← C_1, eval₂_C, f.map_one]
#align polynomial.eval₂_one Polynomial.eval₂_one
set_option linter.deprecated false in
@[simp]
| Mathlib/Algebra/Polynomial/Eval.lean | 100 | 100 | theorem eval₂_bit0 : (bit0 p).eval₂ f x = bit0 (p.eval₂ f x) := by | rw [bit0, eval₂_add, bit0]
| 0.71875 |
import Mathlib.MeasureTheory.Integral.Bochner
import Mathlib.MeasureTheory.Group.Measure
#align_import measure_theory.group.integration from "leanprover-community/mathlib"@"ec247d43814751ffceb33b758e8820df2372bf6f"
namespace MeasureTheory
open Measure TopologicalSpace
open scoped ENNReal
variable {𝕜 M α G E F : Type*} [MeasurableSpace G]
variable [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F]
variable {μ : Measure G} {f : G → E} {g : G}
section MeasurableMul
variable [Group G] [MeasurableMul G]
@[to_additive
"Translating a function by left-addition does not change its integral with respect to a
left-invariant measure."] -- Porting note: was `@[simp]`
theorem integral_mul_left_eq_self [IsMulLeftInvariant μ] (f : G → E) (g : G) :
(∫ x, f (g * x) ∂μ) = ∫ x, f x ∂μ := by
have h_mul : MeasurableEmbedding fun x => g * x := (MeasurableEquiv.mulLeft g).measurableEmbedding
rw [← h_mul.integral_map, map_mul_left_eq_self]
#align measure_theory.integral_mul_left_eq_self MeasureTheory.integral_mul_left_eq_self
#align measure_theory.integral_add_left_eq_self MeasureTheory.integral_add_left_eq_self
@[to_additive
"Translating a function by right-addition does not change its integral with respect to a
right-invariant measure."] -- Porting note: was `@[simp]`
theorem integral_mul_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) :
(∫ x, f (x * g) ∂μ) = ∫ x, f x ∂μ := by
have h_mul : MeasurableEmbedding fun x => x * g :=
(MeasurableEquiv.mulRight g).measurableEmbedding
rw [← h_mul.integral_map, map_mul_right_eq_self]
#align measure_theory.integral_mul_right_eq_self MeasureTheory.integral_mul_right_eq_self
#align measure_theory.integral_add_right_eq_self MeasureTheory.integral_add_right_eq_self
@[to_additive] -- Porting note: was `@[simp]`
| Mathlib/MeasureTheory/Group/Integral.lean | 79 | 83 | theorem integral_div_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) :
(∫ x, f (x / g) ∂μ) = ∫ x, f x ∂μ := by |
simp_rw [div_eq_mul_inv]
-- Porting note: was `simp_rw`
rw [integral_mul_right_eq_self f g⁻¹]
| 0.71875 |
import Mathlib.Algebra.Module.BigOperators
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Tactic.FinCases
#align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open Affine
namespace Finset
variable (k : Type*) {V : Type*} {P : Type*} [DivisionRing k] [AddCommGroup V] [Module k V]
variable [AffineSpace V P] {ι : Type*} (s : Finset ι) {ι₂ : Type*} (s₂ : Finset ι₂)
def centroidWeights : ι → k :=
Function.const ι (card s : k)⁻¹
#align finset.centroid_weights Finset.centroidWeights
@[simp]
theorem centroidWeights_apply (i : ι) : s.centroidWeights k i = (card s : k)⁻¹ :=
rfl
#align finset.centroid_weights_apply Finset.centroidWeights_apply
theorem centroidWeights_eq_const : s.centroidWeights k = Function.const ι (card s : k)⁻¹ :=
rfl
#align finset.centroid_weights_eq_const Finset.centroidWeights_eq_const
variable {k}
theorem sum_centroidWeights_eq_one_of_cast_card_ne_zero (h : (card s : k) ≠ 0) :
∑ i ∈ s, s.centroidWeights k i = 1 := by simp [h]
#align finset.sum_centroid_weights_eq_one_of_cast_card_ne_zero Finset.sum_centroidWeights_eq_one_of_cast_card_ne_zero
variable (k)
| Mathlib/LinearAlgebra/AffineSpace/Combination.lean | 804 | 809 | theorem sum_centroidWeights_eq_one_of_card_ne_zero [CharZero k] (h : card s ≠ 0) :
∑ i ∈ s, s.centroidWeights k i = 1 := by |
-- Porting note: `simp` cannot find `mul_inv_cancel` and does not use `norm_cast`
simp only [centroidWeights_apply, sum_const, nsmul_eq_mul, ne_eq, Nat.cast_eq_zero, card_eq_zero]
refine mul_inv_cancel ?_
norm_cast
| 0.71875 |
import Mathlib.CategoryTheory.EpiMono
import Mathlib.CategoryTheory.Functor.FullyFaithful
import Mathlib.Tactic.PPWithUniv
import Mathlib.Data.Set.Defs
#align_import category_theory.types from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
namespace CategoryTheory
-- morphism levels before object levels. See note [CategoryTheory universes].
universe v v' w u u'
@[to_additive existing CategoryTheory.types]
instance types : LargeCategory (Type u) where
Hom a b := a → b
id a := id
comp f g := g ∘ f
#align category_theory.types CategoryTheory.types
theorem types_hom {α β : Type u} : (α ⟶ β) = (α → β) :=
rfl
#align category_theory.types_hom CategoryTheory.types_hom
-- porting note (#10688): this lemma was not here in Lean 3. Lean 3 `ext` would solve this goal
-- because of its "if all else fails, apply all `ext` lemmas" policy,
-- which apparently we want to move away from.
@[ext] theorem types_ext {α β : Type u} (f g : α ⟶ β) (h : ∀ a : α, f a = g a) : f = g := by
funext x
exact h x
theorem types_id (X : Type u) : 𝟙 X = id :=
rfl
#align category_theory.types_id CategoryTheory.types_id
theorem types_comp {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z) : f ≫ g = g ∘ f :=
rfl
#align category_theory.types_comp CategoryTheory.types_comp
@[simp]
theorem types_id_apply (X : Type u) (x : X) : (𝟙 X : X → X) x = x :=
rfl
#align category_theory.types_id_apply CategoryTheory.types_id_apply
@[simp]
theorem types_comp_apply {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) : (f ≫ g) x = g (f x) :=
rfl
#align category_theory.types_comp_apply CategoryTheory.types_comp_apply
@[simp]
theorem hom_inv_id_apply {X Y : Type u} (f : X ≅ Y) (x : X) : f.inv (f.hom x) = x :=
congr_fun f.hom_inv_id x
#align category_theory.hom_inv_id_apply CategoryTheory.hom_inv_id_apply
@[simp]
theorem inv_hom_id_apply {X Y : Type u} (f : X ≅ Y) (y : Y) : f.hom (f.inv y) = y :=
congr_fun f.inv_hom_id y
#align category_theory.inv_hom_id_apply CategoryTheory.inv_hom_id_apply
-- Unfortunately without this wrapper we can't use `CategoryTheory` idioms, such as `IsIso f`.
abbrev asHom {α β : Type u} (f : α → β) : α ⟶ β :=
f
#align category_theory.as_hom CategoryTheory.asHom
@[inherit_doc]
scoped notation "↾" f:200 => CategoryTheory.asHom f
section
-- We verify the expected type checking behaviour of `asHom`
variable (α β γ : Type u) (f : α → β) (g : β → γ)
example : α → γ :=
↾f ≫ ↾g
example [IsIso (↾f)] : Mono (↾f) := by infer_instance
example [IsIso (↾f)] : ↾f ≫ inv (↾f) = 𝟙 α := by simp
end
namespace FunctorToTypes
variable {C : Type u} [Category.{v} C] (F G H : C ⥤ Type w) {X Y Z : C}
variable (σ : F ⟶ G) (τ : G ⟶ H)
@[simp]
| Mathlib/CategoryTheory/Types.lean | 152 | 153 | theorem map_comp_apply (f : X ⟶ Y) (g : Y ⟶ Z) (a : F.obj X) :
(F.map (f ≫ g)) a = (F.map g) ((F.map f) a) := by | simp [types_comp]
| 0.71875 |
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
| 0.71875 |
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]
| 0.71875 |
import Mathlib.CategoryTheory.Idempotents.Basic
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Equivalence
#align_import category_theory.idempotents.karoubi from "leanprover-community/mathlib"@"200eda15d8ff5669854ff6bcc10aaf37cb70498f"
noncomputable section
open CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Limits BigOperators
namespace CategoryTheory
variable (C : Type*) [Category C]
namespace Idempotents
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure Karoubi where
X : C
p : X ⟶ X
idem : p ≫ p = p := by aesop_cat
#align category_theory.idempotents.karoubi CategoryTheory.Idempotents.Karoubi
namespace Karoubi
variable {C}
attribute [reassoc (attr := simp)] idem
@[ext]
theorem ext {P Q : Karoubi C} (h_X : P.X = Q.X) (h_p : P.p ≫ eqToHom h_X = eqToHom h_X ≫ Q.p) :
P = Q := by
cases P
cases Q
dsimp at h_X h_p
subst h_X
simpa only [mk.injEq, heq_eq_eq, true_and, eqToHom_refl, comp_id, id_comp] using h_p
#align category_theory.idempotents.karoubi.ext CategoryTheory.Idempotents.Karoubi.ext
@[ext]
structure Hom (P Q : Karoubi C) where
f : P.X ⟶ Q.X
comm : f = P.p ≫ f ≫ Q.p := by aesop_cat
#align category_theory.idempotents.karoubi.hom CategoryTheory.Idempotents.Karoubi.Hom
instance [Preadditive C] (P Q : Karoubi C) : Inhabited (Hom P Q) :=
⟨⟨0, by rw [zero_comp, comp_zero]⟩⟩
@[reassoc (attr := simp)]
theorem p_comp {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f := by rw [f.comm, ← assoc, P.idem]
#align category_theory.idempotents.karoubi.p_comp CategoryTheory.Idempotents.Karoubi.p_comp
@[reassoc (attr := simp)]
theorem comp_p {P Q : Karoubi C} (f : Hom P Q) : f.f ≫ Q.p = f.f := by
rw [f.comm, assoc, assoc, Q.idem]
#align category_theory.idempotents.karoubi.comp_p CategoryTheory.Idempotents.Karoubi.comp_p
@[reassoc]
theorem p_comm {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f ≫ Q.p := by rw [p_comp, comp_p]
#align category_theory.idempotents.karoubi.p_comm CategoryTheory.Idempotents.Karoubi.p_comm
theorem comp_proof {P Q R : Karoubi C} (g : Hom Q R) (f : Hom P Q) :
f.f ≫ g.f = P.p ≫ (f.f ≫ g.f) ≫ R.p := by rw [assoc, comp_p, ← assoc, p_comp]
#align category_theory.idempotents.karoubi.comp_proof CategoryTheory.Idempotents.Karoubi.comp_proof
instance : Category (Karoubi C) where
Hom := Karoubi.Hom
id P := ⟨P.p, by repeat' rw [P.idem]⟩
comp f g := ⟨f.f ≫ g.f, Karoubi.comp_proof g f⟩
@[simp]
| Mathlib/CategoryTheory/Idempotents/Karoubi.lean | 108 | 112 | theorem hom_ext_iff {P Q : Karoubi C} {f g : P ⟶ Q} : f = g ↔ f.f = g.f := by |
constructor
· intro h
rw [h]
· apply Hom.ext
| 0.71875 |
import Mathlib.AlgebraicTopology.SimplexCategory
import Mathlib.CategoryTheory.Comma.Arrow
import Mathlib.CategoryTheory.Limits.FunctorCategory
import Mathlib.CategoryTheory.Opposites
#align_import algebraic_topology.simplicial_object from "leanprover-community/mathlib"@"5ed51dc37c6b891b79314ee11a50adc2b1df6fd6"
open Opposite
open CategoryTheory
open CategoryTheory.Limits
universe v u v' u'
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
-- porting note (#5171): removed @[nolint has_nonempty_instance]
def SimplicialObject :=
SimplexCategoryᵒᵖ ⥤ C
#align category_theory.simplicial_object CategoryTheory.SimplicialObject
@[simps!]
instance : Category (SimplicialObject C) := by
dsimp only [SimplicialObject]
infer_instance
namespace SimplicialObject
set_option quotPrecheck false in
scoped[Simplicial]
notation3:1000 X " _[" n "]" =>
(X : CategoryTheory.SimplicialObject _).obj (Opposite.op (SimplexCategory.mk n))
open Simplicial
instance {J : Type v} [SmallCategory J] [HasLimitsOfShape J C] :
HasLimitsOfShape J (SimplicialObject C) := by
dsimp [SimplicialObject]
infer_instance
instance [HasLimits C] : HasLimits (SimplicialObject C) :=
⟨inferInstance⟩
instance {J : Type v} [SmallCategory J] [HasColimitsOfShape J C] :
HasColimitsOfShape J (SimplicialObject C) := by
dsimp [SimplicialObject]
infer_instance
instance [HasColimits C] : HasColimits (SimplicialObject C) :=
⟨inferInstance⟩
variable {C}
-- Porting note (#10688): added to ease automation
@[ext]
lemma hom_ext {X Y : SimplicialObject C} (f g : X ⟶ Y)
(h : ∀ (n : SimplexCategoryᵒᵖ), f.app n = g.app n) : f = g :=
NatTrans.ext _ _ (by ext; apply h)
variable (X : SimplicialObject C)
def δ {n} (i : Fin (n + 2)) : X _[n + 1] ⟶ X _[n] :=
X.map (SimplexCategory.δ i).op
#align category_theory.simplicial_object.δ CategoryTheory.SimplicialObject.δ
def σ {n} (i : Fin (n + 1)) : X _[n] ⟶ X _[n + 1] :=
X.map (SimplexCategory.σ i).op
#align category_theory.simplicial_object.σ CategoryTheory.SimplicialObject.σ
def eqToIso {n m : ℕ} (h : n = m) : X _[n] ≅ X _[m] :=
X.mapIso (CategoryTheory.eqToIso (by congr))
#align category_theory.simplicial_object.eq_to_iso CategoryTheory.SimplicialObject.eqToIso
@[simp]
| Mathlib/AlgebraicTopology/SimplicialObject.lean | 100 | 102 | theorem eqToIso_refl {n : ℕ} (h : n = n) : X.eqToIso h = Iso.refl _ := by |
ext
simp [eqToIso]
| 0.71875 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Algebra.Ring.Rat
import Mathlib.Data.PNat.Defs
#align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
namespace Rat
open Rat
theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by
cases' e : a /. b with n d h c
rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e
refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <|
c.dvd_of_dvd_mul_right ?_
have := congr_arg Int.natAbs e
simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
#align rat.num_dvd Rat.num_dvd
theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b := by
by_cases b0 : b = 0; · simp [b0]
cases' e : a /. b with n d h c
rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e
refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_
rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp
#align rat.denom_dvd Rat.den_dvd
theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) :
∃ c : ℤ, n = c * q.num ∧ d = c * q.den := by
obtain rfl | hn := eq_or_ne n 0
· simp [qdf]
have : q.num * d = n * ↑q.den := by
refine (divInt_eq_iff ?_ hd).mp ?_
· exact Int.natCast_ne_zero.mpr (Rat.den_nz _)
· rwa [num_divInt_den]
have hqdn : q.num ∣ n := by
rw [qdf]
exact Rat.num_dvd _ hd
refine ⟨n / q.num, ?_, ?_⟩
· rw [Int.ediv_mul_cancel hqdn]
· refine Int.eq_mul_div_of_mul_eq_mul_of_dvd_left ?_ hqdn this
rw [qdf]
exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn)
#align rat.num_denom_mk Rat.num_den_mk
#noalign rat.mk_pnat_num
#noalign rat.mk_pnat_denom
theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
rw [← Int.div_eq_ediv_of_dvd] <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
Int.zero_ediv, Int.ofNat_dvd_left, Nat.gcd_dvd_left, this]
#align rat.num_mk Rat.num_mk
theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
if_neg (Nat.cast_add_one_ne_zero _), this]
#align rat.denom_mk Rat.den_mk
#noalign rat.mk_pnat_denom_dvd
theorem add_den_dvd (q₁ q₂ : ℚ) : (q₁ + q₂).den ∣ q₁.den * q₂.den := by
rw [add_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
#align rat.add_denom_dvd Rat.add_den_dvd
theorem mul_den_dvd (q₁ q₂ : ℚ) : (q₁ * q₂).den ∣ q₁.den * q₂.den := by
rw [mul_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
#align rat.mul_denom_dvd Rat.mul_den_dvd
theorem mul_num (q₁ q₂ : ℚ) :
(q₁ * q₂).num = q₁.num * q₂.num / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) := by
rw [mul_def, normalize_eq]
#align rat.mul_num Rat.mul_num
| Mathlib/Data/Rat/Lemmas.lean | 98 | 101 | theorem mul_den (q₁ q₂ : ℚ) :
(q₁ * q₂).den =
q₁.den * q₂.den / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) := by |
rw [mul_def, normalize_eq]
| 0.71875 |
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
#align_import data.sigma.basic from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
open Function
namespace PSigma
variable {α : Sort*} {β : α → Sort*}
def elim {γ} (f : ∀ a, β a → γ) (a : PSigma β) : γ :=
PSigma.casesOn a f
#align psigma.elim PSigma.elim
@[simp]
theorem elim_val {γ} (f : ∀ a, β a → γ) (a b) : PSigma.elim f ⟨a, b⟩ = f a b :=
rfl
#align psigma.elim_val PSigma.elim_val
instance [Inhabited α] [Inhabited (β default)] : Inhabited (PSigma β) :=
⟨⟨default, default⟩⟩
instance decidableEq [h₁ : DecidableEq α] [h₂ : ∀ a, DecidableEq (β a)] : DecidableEq (PSigma β)
| ⟨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 ↦ PSigma.noConfusion h fun _ e₂ ↦ n <| eq_of_heq e₂
| _, _, _, _, isFalse n => isFalse fun h ↦ PSigma.noConfusion h fun e₁ _ ↦ n e₁
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/porting.20data.2Esigma.2Ebasic/near/304855864
-- for an explanation of why this is currently needed. It generates `PSigma.mk.inj`.
-- This could be done elsewhere.
gen_injective_theorems% PSigma
theorem mk.inj_iff {a₁ a₂ : α} {b₁ : β a₁} {b₂ : β a₂} :
@PSigma.mk α β a₁ b₁ = @PSigma.mk α β a₂ b₂ ↔ a₁ = a₂ ∧ HEq b₁ b₂ :=
(Iff.intro PSigma.mk.inj) fun ⟨h₁, h₂⟩ ↦
match a₁, a₂, b₁, b₂, h₁, h₂ with
| _, _, _, _, Eq.refl _, HEq.refl _ => rfl
#align psigma.mk.inj_iff PSigma.mk.inj_iff
#align psigma.ext PSigma.ext
| Mathlib/Data/Sigma/Basic.lean | 273 | 274 | theorem ext_iff {x₀ x₁ : PSigma β} : x₀ = x₁ ↔ x₀.1 = x₁.1 ∧ HEq x₀.2 x₁.2 := by |
cases x₀; cases x₁; exact PSigma.mk.inj_iff
| 0.71875 |
import Mathlib.MeasureTheory.Measure.Content
import Mathlib.MeasureTheory.Group.Prod
import Mathlib.Topology.Algebra.Group.Compact
#align_import measure_theory.measure.haar.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open Set Inv Function TopologicalSpace MeasurableSpace
open scoped NNReal Classical ENNReal Pointwise Topology
namespace MeasureTheory
namespace Measure
section Group
variable {G : Type*} [Group G]
namespace haar
-- Porting note: Even in `noncomputable section`, a definition with `to_additive` require
-- `noncomputable` to generate an additive definition.
-- Please refer to leanprover/lean4#2077.
@[to_additive addIndex "additive version of `MeasureTheory.Measure.haar.index`"]
noncomputable def index (K V : Set G) : ℕ :=
sInf <| Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V }
#align measure_theory.measure.haar.index MeasureTheory.Measure.haar.index
#align measure_theory.measure.haar.add_index MeasureTheory.Measure.haar.addIndex
@[to_additive addIndex_empty]
theorem index_empty {V : Set G} : index ∅ V = 0 := by
simp only [index, Nat.sInf_eq_zero]; left; use ∅
simp only [Finset.card_empty, empty_subset, mem_setOf_eq, eq_self_iff_true, and_self_iff]
#align measure_theory.measure.haar.index_empty MeasureTheory.Measure.haar.index_empty
#align measure_theory.measure.haar.add_index_empty MeasureTheory.Measure.haar.addIndex_empty
variable [TopologicalSpace G]
@[to_additive "additive version of `MeasureTheory.Measure.haar.prehaar`"]
noncomputable def prehaar (K₀ U : Set G) (K : Compacts G) : ℝ :=
(index (K : Set G) U : ℝ) / index K₀ U
#align measure_theory.measure.haar.prehaar MeasureTheory.Measure.haar.prehaar
#align measure_theory.measure.haar.add_prehaar MeasureTheory.Measure.haar.addPrehaar
@[to_additive]
theorem prehaar_empty (K₀ : PositiveCompacts G) {U : Set G} : prehaar (K₀ : Set G) U ⊥ = 0 := by
rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div]
#align measure_theory.measure.haar.prehaar_empty MeasureTheory.Measure.haar.prehaar_empty
#align measure_theory.measure.haar.add_prehaar_empty MeasureTheory.Measure.haar.addPrehaar_empty
@[to_additive]
| Mathlib/MeasureTheory/Measure/Haar/Basic.lean | 128 | 129 | theorem prehaar_nonneg (K₀ : PositiveCompacts G) {U : Set G} (K : Compacts G) :
0 ≤ prehaar (K₀ : Set G) U K := by | apply div_nonneg <;> norm_cast <;> apply zero_le
| 0.71875 |
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'
theorem mul_inv_le_iff (h : 0 < b) : a * b⁻¹ ≤ c ↔ a ≤ b * c := by rw [mul_comm, inv_mul_le_iff h]
#align mul_inv_le_iff mul_inv_le_iff
| Mathlib/Algebra/Order/Field/Basic.lean | 110 | 110 | theorem mul_inv_le_iff' (h : 0 < b) : a * b⁻¹ ≤ c ↔ a ≤ c * b := by | rw [mul_comm, inv_mul_le_iff' h]
| 0.71875 |
import Mathlib.Analysis.Calculus.FDeriv.Bilinear
#align_import analysis.calculus.fderiv.mul from "leanprover-community/mathlib"@"d608fc5d4e69d4cc21885913fb573a88b0deb521"
open scoped Classical
open Filter Asymptotics ContinuousLinearMap Set Metric Topology NNReal ENNReal
noncomputable section
section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
variable {f f₀ f₁ g : E → F}
variable {f' f₀' f₁' g' : E →L[𝕜] F}
variable (e : E →L[𝕜] F)
variable {x : E}
variable {s t : Set E}
variable {L L₁ L₂ : Filter E}
section Mul
variable {𝔸 𝔸' : Type*} [NormedRing 𝔸] [NormedCommRing 𝔸'] [NormedAlgebra 𝕜 𝔸] [NormedAlgebra 𝕜 𝔸']
{a b : E → 𝔸} {a' b' : E →L[𝕜] 𝔸} {c d : E → 𝔸'} {c' d' : E →L[𝕜] 𝔸'}
@[fun_prop]
theorem HasStrictFDerivAt.mul' {x : E} (ha : HasStrictFDerivAt a a' x)
(hb : HasStrictFDerivAt b b' x) :
HasStrictFDerivAt (fun y => a y * b y) (a x • b' + a'.smulRight (b x)) x :=
((ContinuousLinearMap.mul 𝕜 𝔸).isBoundedBilinearMap.hasStrictFDerivAt (a x, b x)).comp x
(ha.prod hb)
#align has_strict_fderiv_at.mul' HasStrictFDerivAt.mul'
@[fun_prop]
| Mathlib/Analysis/Calculus/FDeriv/Mul.lean | 376 | 380 | theorem HasStrictFDerivAt.mul (hc : HasStrictFDerivAt c c' x) (hd : HasStrictFDerivAt d d' x) :
HasStrictFDerivAt (fun y => c y * d y) (c x • d' + d x • c') x := by |
convert hc.mul' hd
ext z
apply mul_comm
| 0.71875 |
import Mathlib.Init.Logic
import Mathlib.Tactic.AdaptationNote
import Mathlib.Tactic.Coe
set_option autoImplicit true
-- We align Lean 3 lemmas with lemmas in `Init.SimpLemmas` in Lean 4.
#align band_self Bool.and_self
#align band_tt Bool.and_true
#align band_ff Bool.and_false
#align tt_band Bool.true_and
#align ff_band Bool.false_and
#align bor_self Bool.or_self
#align bor_tt Bool.or_true
#align bor_ff Bool.or_false
#align tt_bor Bool.true_or
#align ff_bor Bool.false_or
#align bnot_bnot Bool.not_not
namespace Bool
#align bool.cond_tt Bool.cond_true
#align bool.cond_ff Bool.cond_false
#align cond_a_a Bool.cond_self
attribute [simp] xor_self
#align bxor_self Bool.xor_self
#align bxor_tt Bool.xor_true
#align bxor_ff Bool.xor_false
#align tt_bxor Bool.true_xor
#align ff_bxor Bool.false_xor
theorem true_eq_false_eq_False : ¬true = false := by decide
#align tt_eq_ff_eq_false Bool.true_eq_false_eq_False
theorem false_eq_true_eq_False : ¬false = true := by decide
#align ff_eq_tt_eq_false Bool.false_eq_true_eq_False
theorem eq_false_eq_not_eq_true (b : Bool) : (¬b = true) = (b = false) := by simp
#align eq_ff_eq_not_eq_tt Bool.eq_false_eq_not_eq_true
theorem eq_true_eq_not_eq_false (b : Bool) : (¬b = false) = (b = true) := by simp
#align eq_tt_eq_not_eq_ft Bool.eq_true_eq_not_eq_false
theorem eq_false_of_not_eq_true {b : Bool} : ¬b = true → b = false :=
Eq.mp (eq_false_eq_not_eq_true b)
#align eq_ff_of_not_eq_tt Bool.eq_false_of_not_eq_true
theorem eq_true_of_not_eq_false {b : Bool} : ¬b = false → b = true :=
Eq.mp (eq_true_eq_not_eq_false b)
#align eq_tt_of_not_eq_ff Bool.eq_true_of_not_eq_false
| Mathlib/Init/Data/Bool/Lemmas.lean | 68 | 69 | theorem and_eq_true_eq_eq_true_and_eq_true (a b : Bool) :
((a && b) = true) = (a = true ∧ b = true) := by | simp
| 0.71875 |
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.GroupTheory.GroupAction.Ring
#align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
noncomputable section
open Finset
open Polynomial
namespace Polynomial
universe u v w y z
variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ}
section Derivative
section Semiring
variable [Semiring R]
def derivative : R[X] →ₗ[R] R[X] where
toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1)
map_add' p q := by
dsimp only
rw [sum_add_index] <;>
simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul,
RingHom.map_zero]
map_smul' a p := by
dsimp; rw [sum_smul_index] <;>
simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul,
RingHom.map_zero, sum]
#align polynomial.derivative Polynomial.derivative
theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) :=
rfl
#align polynomial.derivative_apply Polynomial.derivative_apply
theorem coeff_derivative (p : R[X]) (n : ℕ) :
coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by
rw [derivative_apply]
simp only [coeff_X_pow, coeff_sum, coeff_C_mul]
rw [sum, Finset.sum_eq_single (n + 1)]
· simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast
· intro b
cases b
· intros
rw [Nat.cast_zero, mul_zero, zero_mul]
· intro _ H
rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero]
· rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one,
mem_support_iff]
intro h
push_neg at h
simp [h]
#align polynomial.coeff_derivative Polynomial.coeff_derivative
-- Porting note (#10618): removed `simp`: `simp` can prove it.
theorem derivative_zero : derivative (0 : R[X]) = 0 :=
derivative.map_zero
#align polynomial.derivative_zero Polynomial.derivative_zero
theorem iterate_derivative_zero {k : ℕ} : derivative^[k] (0 : R[X]) = 0 :=
iterate_map_zero derivative k
#align polynomial.iterate_derivative_zero Polynomial.iterate_derivative_zero
@[simp]
theorem derivative_monomial (a : R) (n : ℕ) :
derivative (monomial n a) = monomial (n - 1) (a * n) := by
rw [derivative_apply, sum_monomial_index, C_mul_X_pow_eq_monomial]
simp
#align polynomial.derivative_monomial Polynomial.derivative_monomial
theorem derivative_C_mul_X (a : R) : derivative (C a * X) = C a := by
simp [C_mul_X_eq_monomial, derivative_monomial, Nat.cast_one, mul_one]
set_option linter.uppercaseLean3 false in
#align polynomial.derivative_C_mul_X Polynomial.derivative_C_mul_X
theorem derivative_C_mul_X_pow (a : R) (n : ℕ) :
derivative (C a * X ^ n) = C (a * n) * X ^ (n - 1) := by
rw [C_mul_X_pow_eq_monomial, C_mul_X_pow_eq_monomial, derivative_monomial]
set_option linter.uppercaseLean3 false in
#align polynomial.derivative_C_mul_X_pow Polynomial.derivative_C_mul_X_pow
theorem derivative_C_mul_X_sq (a : R) : derivative (C a * X ^ 2) = C (a * 2) * X := by
rw [derivative_C_mul_X_pow, Nat.cast_two, pow_one]
set_option linter.uppercaseLean3 false in
#align polynomial.derivative_C_mul_X_sq Polynomial.derivative_C_mul_X_sq
@[simp]
theorem derivative_X_pow (n : ℕ) : derivative (X ^ n : R[X]) = C (n : R) * X ^ (n - 1) := by
convert derivative_C_mul_X_pow (1 : R) n <;> simp
set_option linter.uppercaseLean3 false in
#align polynomial.derivative_X_pow Polynomial.derivative_X_pow
-- Porting note (#10618): removed `simp`: `simp` can prove it.
theorem derivative_X_sq : derivative (X ^ 2 : R[X]) = C 2 * X := by
rw [derivative_X_pow, Nat.cast_two, pow_one]
set_option linter.uppercaseLean3 false in
#align polynomial.derivative_X_sq Polynomial.derivative_X_sq
@[simp]
theorem derivative_C {a : R} : derivative (C a) = 0 := by simp [derivative_apply]
set_option linter.uppercaseLean3 false in
#align polynomial.derivative_C Polynomial.derivative_C
| Mathlib/Algebra/Polynomial/Derivative.lean | 125 | 126 | theorem derivative_of_natDegree_zero {p : R[X]} (hp : p.natDegree = 0) : derivative p = 0 := by |
rw [eq_C_of_natDegree_eq_zero hp, derivative_C]
| 0.71875 |
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.SpecialFunctions.Log.Basic
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Tactic.AdaptationNote
#align_import analysis.special_functions.log.deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open Filter Finset Set
open scoped Topology
namespace Real
variable {x : ℝ}
| Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean | 34 | 39 | theorem hasStrictDerivAt_log_of_pos (hx : 0 < x) : HasStrictDerivAt log x⁻¹ x := by |
have : HasStrictDerivAt log (exp <| log x)⁻¹ x :=
(hasStrictDerivAt_exp <| log x).of_local_left_inverse (continuousAt_log hx.ne')
(ne_of_gt <| exp_pos _) <|
Eventually.mono (lt_mem_nhds hx) @exp_log
rwa [exp_log hx] at this
| 0.71875 |
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section ENNReal
variable (μ) {f g : α → ℝ≥0∞}
noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.laverage MeasureTheory.laverage
notation3 "⨍⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => laverage μ r
notation3 "⨍⁻ "(...)", "r:60:(scoped f => laverage volume f) => r
notation3 "⨍⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => laverage (Measure.restrict μ s) r
notation3 (prettyPrint := false)
"⨍⁻ "(...)" in "s", "r:60:(scoped f => laverage Measure.restrict volume s f) => r
@[simp]
theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by rw [laverage, lintegral_zero]
#align measure_theory.laverage_zero MeasureTheory.laverage_zero
@[simp]
theorem laverage_zero_measure (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂(0 : Measure α) = 0 := by simp [laverage]
#align measure_theory.laverage_zero_measure MeasureTheory.laverage_zero_measure
theorem laverage_eq' (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂(μ univ)⁻¹ • μ := rfl
#align measure_theory.laverage_eq' MeasureTheory.laverage_eq'
theorem laverage_eq (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = (∫⁻ x, f x ∂μ) / μ univ := by
rw [laverage_eq', lintegral_smul_measure, ENNReal.div_eq_inv_mul]
#align measure_theory.laverage_eq MeasureTheory.laverage_eq
theorem laverage_eq_lintegral [IsProbabilityMeasure μ] (f : α → ℝ≥0∞) :
⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by rw [laverage, measure_univ, inv_one, one_smul]
#align measure_theory.laverage_eq_lintegral MeasureTheory.laverage_eq_lintegral
@[simp]
theorem measure_mul_laverage [IsFiniteMeasure μ] (f : α → ℝ≥0∞) :
μ univ * ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, lintegral_zero_measure, laverage_zero_measure, mul_zero]
· rw [laverage_eq, ENNReal.mul_div_cancel' (measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)]
#align measure_theory.measure_mul_laverage MeasureTheory.measure_mul_laverage
theorem setLaverage_eq (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = (∫⁻ x in s, f x ∂μ) / μ s := by rw [laverage_eq, restrict_apply_univ]
#align measure_theory.set_laverage_eq MeasureTheory.setLaverage_eq
theorem setLaverage_eq' (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = ∫⁻ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [laverage_eq', restrict_apply_univ]
#align measure_theory.set_laverage_eq' MeasureTheory.setLaverage_eq'
variable {μ}
| Mathlib/MeasureTheory/Integral/Average.lean | 145 | 146 | theorem laverage_congr {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : ⨍⁻ x, f x ∂μ = ⨍⁻ x, g x ∂μ := by |
simp only [laverage_eq, lintegral_congr_ae h]
| 0.71875 |
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
| Mathlib/Algebra/Order/Field/Basic.lean | 93 | 93 | theorem div_lt_iff' (hc : 0 < c) : b / c < a ↔ b < c * a := by | rw [mul_comm, div_lt_iff hc]
| 0.71875 |
import Mathlib.Tactic.Ring
#align_import algebra.group_power.identities from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
variable {R : Type*} [CommRing R] {a b x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ y₁ y₂ y₃ y₄ y₅ y₆ y₇ y₈ n : R}
theorem sq_add_sq_mul_sq_add_sq :
(x₁ ^ 2 + x₂ ^ 2) * (y₁ ^ 2 + y₂ ^ 2) = (x₁ * y₁ - x₂ * y₂) ^ 2 + (x₁ * y₂ + x₂ * y₁) ^ 2 := by
ring
#align sq_add_sq_mul_sq_add_sq sq_add_sq_mul_sq_add_sq
| Mathlib/Algebra/Ring/Identities.lean | 31 | 34 | theorem sq_add_mul_sq_mul_sq_add_mul_sq :
(x₁ ^ 2 + n * x₂ ^ 2) * (y₁ ^ 2 + n * y₂ ^ 2) =
(x₁ * y₁ - n * x₂ * y₂) ^ 2 + n * (x₁ * y₂ + x₂ * y₁) ^ 2 := by |
ring
| 0.71875 |
import Mathlib.RingTheory.WittVector.InitTail
#align_import ring_theory.witt_vector.truncated from "leanprover-community/mathlib"@"acbe099ced8be9c9754d62860110295cde0d7181"
open Function (Injective Surjective)
noncomputable section
variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) (R : Type*)
local notation "𝕎" => WittVector p -- type as `\bbW`
@[nolint unusedArguments]
def TruncatedWittVector (_ : ℕ) (n : ℕ) (R : Type*) :=
Fin n → R
#align truncated_witt_vector TruncatedWittVector
instance (p n : ℕ) (R : Type*) [Inhabited R] : Inhabited (TruncatedWittVector p n R) :=
⟨fun _ => default⟩
variable {n R}
namespace TruncatedWittVector
variable (p)
def mk (x : Fin n → R) : TruncatedWittVector p n R :=
x
#align truncated_witt_vector.mk TruncatedWittVector.mk
variable {p}
def coeff (i : Fin n) (x : TruncatedWittVector p n R) : R :=
x i
#align truncated_witt_vector.coeff TruncatedWittVector.coeff
@[ext]
theorem ext {x y : TruncatedWittVector p n R} (h : ∀ i, x.coeff i = y.coeff i) : x = y :=
funext h
#align truncated_witt_vector.ext TruncatedWittVector.ext
theorem ext_iff {x y : TruncatedWittVector p n R} : x = y ↔ ∀ i, x.coeff i = y.coeff i :=
⟨fun h i => by rw [h], ext⟩
#align truncated_witt_vector.ext_iff TruncatedWittVector.ext_iff
@[simp]
theorem coeff_mk (x : Fin n → R) (i : Fin n) : (mk p x).coeff i = x i :=
rfl
#align truncated_witt_vector.coeff_mk TruncatedWittVector.coeff_mk
@[simp]
| Mathlib/RingTheory/WittVector/Truncated.lean | 100 | 101 | theorem mk_coeff (x : TruncatedWittVector p n R) : (mk p fun i => x.coeff i) = x := by |
ext i; rw [coeff_mk]
| 0.71875 |
import Mathlib.LinearAlgebra.Projectivization.Basic
#align_import linear_algebra.projective_space.independence from "leanprover-community/mathlib"@"1e82f5ec4645f6a92bb9e02fce51e44e3bc3e1fe"
open scoped LinearAlgebra.Projectivization
variable {ι K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] {f : ι → ℙ K V}
namespace Projectivization
inductive Independent : (ι → ℙ K V) → Prop
| mk (f : ι → V) (hf : ∀ i : ι, f i ≠ 0) (hl : LinearIndependent K f) :
Independent fun i => mk K (f i) (hf i)
#align projectivization.independent Projectivization.Independent
theorem independent_iff : Independent f ↔ LinearIndependent K (Projectivization.rep ∘ f) := by
refine ⟨?_, fun h => ?_⟩
· rintro ⟨ff, hff, hh⟩
choose a ha using fun i : ι => exists_smul_eq_mk_rep K (ff i) (hff i)
convert hh.units_smul a
ext i
exact (ha i).symm
· convert Independent.mk _ _ h
· simp only [mk_rep, Function.comp_apply]
· intro i
apply rep_nonzero
#align projectivization.independent_iff Projectivization.independent_iff
theorem independent_iff_completeLattice_independent :
Independent f ↔ CompleteLattice.Independent fun i => (f i).submodule := by
refine ⟨?_, fun h => ?_⟩
· rintro ⟨f, hf, hi⟩
simp only [submodule_mk]
exact (CompleteLattice.independent_iff_linearIndependent_of_ne_zero (R := K) hf).mpr hi
· rw [independent_iff]
refine h.linearIndependent (Projectivization.submodule ∘ f) (fun i => ?_) fun i => ?_
· simpa only [Function.comp_apply, submodule_eq] using Submodule.mem_span_singleton_self _
· exact rep_nonzero (f i)
#align projectivization.independent_iff_complete_lattice_independent Projectivization.independent_iff_completeLattice_independent
inductive Dependent : (ι → ℙ K V) → Prop
| mk (f : ι → V) (hf : ∀ i : ι, f i ≠ 0) (h : ¬LinearIndependent K f) :
Dependent fun i => mk K (f i) (hf i)
#align projectivization.dependent Projectivization.Dependent
theorem dependent_iff : Dependent f ↔ ¬LinearIndependent K (Projectivization.rep ∘ f) := by
refine ⟨?_, fun h => ?_⟩
· rintro ⟨ff, hff, hh1⟩
contrapose! hh1
choose a ha using fun i : ι => exists_smul_eq_mk_rep K (ff i) (hff i)
convert hh1.units_smul a⁻¹
ext i
simp only [← ha, inv_smul_smul, Pi.smul_apply', Pi.inv_apply, Function.comp_apply]
· convert Dependent.mk _ _ h
· simp only [mk_rep, Function.comp_apply]
· exact fun i => rep_nonzero (f i)
#align projectivization.dependent_iff Projectivization.dependent_iff
theorem dependent_iff_not_independent : Dependent f ↔ ¬Independent f := by
rw [dependent_iff, independent_iff]
#align projectivization.dependent_iff_not_independent Projectivization.dependent_iff_not_independent
theorem independent_iff_not_dependent : Independent f ↔ ¬Dependent f := by
rw [dependent_iff_not_independent, Classical.not_not]
#align projectivization.independent_iff_not_dependent Projectivization.independent_iff_not_dependent
@[simp]
theorem dependent_pair_iff_eq (u v : ℙ K V) : Dependent ![u, v] ↔ u = v := by
rw [dependent_iff_not_independent, independent_iff, linearIndependent_fin2,
Function.comp_apply, Matrix.cons_val_one, Matrix.head_cons, Ne]
simp only [Matrix.cons_val_zero, not_and, not_forall, Classical.not_not, Function.comp_apply,
← mk_eq_mk_iff' K _ _ (rep_nonzero u) (rep_nonzero v), mk_rep, Classical.imp_iff_right_iff]
exact Or.inl (rep_nonzero v)
#align projectivization.dependent_pair_iff_eq Projectivization.dependent_pair_iff_eq
@[simp]
| Mathlib/LinearAlgebra/Projectivization/Independence.lean | 119 | 120 | theorem independent_pair_iff_neq (u v : ℙ K V) : Independent ![u, v] ↔ u ≠ v := by |
rw [independent_iff_not_dependent, dependent_pair_iff_eq u v]
| 0.71875 |
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section NormedAddCommGroup
variable (μ)
variable {f g : α → E}
noncomputable def average (f : α → E) :=
∫ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.average MeasureTheory.average
notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r
notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r
@[simp]
theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero]
#align measure_theory.average_zero MeasureTheory.average_zero
@[simp]
| Mathlib/MeasureTheory/Integral/Average.lean | 319 | 320 | theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by |
rw [average, smul_zero, integral_zero_measure]
| 0.71875 |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.GeomSum
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.SMulWithZero
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.Data.Nat.Lattice
import Mathlib.RingTheory.Nilpotent.Defs
#align_import ring_theory.nilpotent from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff"
universe u v
open Function Set
variable {R S : Type*} {x y : R}
| Mathlib/RingTheory/Nilpotent/Basic.lean | 40 | 43 | theorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by |
obtain ⟨n, hn⟩ := h
use n
rw [neg_pow, hn, mul_zero]
| 0.71875 |
import Mathlib.Init.Logic
import Mathlib.Init.Function
import Mathlib.Init.Algebra.Classes
import Batteries.Util.LibraryNote
import Batteries.Tactic.Lint.Basic
#align_import logic.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
#align_import init.ite_simp from "leanprover-community/lean"@"4a03bdeb31b3688c31d02d7ff8e0ff2e5d6174db"
open Function
attribute [local instance 10] Classical.propDecidable
section Miscellany
-- Porting note: the following `inline` attributes have been omitted,
-- on the assumption that this issue has been dealt with properly in Lean 4.
--
-- attribute [inline]
-- And.decidable Or.decidable Decidable.false Xor.decidable Iff.decidable Decidable.true
-- Implies.decidable Not.decidable Ne.decidable Bool.decidableEq Decidable.toBool
attribute [simp] cast_eq cast_heq imp_false
abbrev hidden {α : Sort*} {a : α} := a
#align hidden hidden
variable {α : Sort*}
instance (priority := 10) decidableEq_of_subsingleton [Subsingleton α] : DecidableEq α :=
fun a b ↦ isTrue (Subsingleton.elim a b)
#align decidable_eq_of_subsingleton decidableEq_of_subsingleton
instance [Subsingleton α] (p : α → Prop) : Subsingleton (Subtype p) :=
⟨fun ⟨x, _⟩ ⟨y, _⟩ ↦ by cases Subsingleton.elim x y; rfl⟩
#align pempty PEmpty
| Mathlib/Logic/Basic.lean | 59 | 61 | theorem congr_heq {α β γ : Sort _} {f : α → γ} {g : β → γ} {x : α} {y : β}
(h₁ : HEq f g) (h₂ : HEq x y) : f x = g y := by |
cases h₂; cases h₁; rfl
| 0.71875 |
import Mathlib.Data.Fintype.Prod
import Mathlib.Data.Fintype.Sum
import Mathlib.SetTheory.Cardinal.Finite
#align_import data.fintype.units from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
variable {α : Type*}
instance UnitsInt.fintype : Fintype ℤˣ :=
⟨{1, -1}, fun x ↦ by cases Int.units_eq_one_or x <;> simp [*]⟩
#align units_int.fintype UnitsInt.fintype
@[simp]
theorem UnitsInt.univ : (Finset.univ : Finset ℤˣ) = {1, -1} := rfl
#align units_int.univ UnitsInt.univ
@[simp]
theorem Fintype.card_units_int : Fintype.card ℤˣ = 2 := rfl
#align fintype.card_units_int Fintype.card_units_int
instance [Monoid α] [Fintype α] [DecidableEq α] : Fintype αˣ :=
Fintype.ofEquiv _ (unitsEquivProdSubtype α).symm
instance [Monoid α] [Finite α] : Finite αˣ := Finite.of_injective _ Units.ext
theorem Fintype.card_eq_card_units_add_one [GroupWithZero α] [Fintype α] [DecidableEq α] :
Fintype.card α = Fintype.card αˣ + 1 := by
rw [eq_comm, Fintype.card_congr unitsEquivNeZero]
have := Fintype.card_congr (Equiv.sumCompl (· = (0 : α)))
rwa [Fintype.card_sum, add_comm, Fintype.card_subtype_eq] at this
theorem Nat.card_eq_card_units_add_one [GroupWithZero α] [Finite α] :
Nat.card α = Nat.card αˣ + 1 := by
have : Fintype α := Fintype.ofFinite α
classical
rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, Fintype.card_eq_card_units_add_one]
| Mathlib/Data/Fintype/Units.lean | 48 | 50 | theorem Fintype.card_units [GroupWithZero α] [Fintype α] [DecidableEq α] :
Fintype.card αˣ = Fintype.card α - 1 := by |
rw [@Fintype.card_eq_card_units_add_one α, Nat.add_sub_cancel]
| 0.71875 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ι : Type*} {α : ι → Type*} {f f₁ f₂ : (i : ι) → Filter (α i)} {s : (i : ι) → Set (α i)}
{p : ∀ i, α i → Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodᵢ (f : ∀ i, Filter (α i)) : Filter (∀ i, α i) :=
⨆ i : ι, comap (eval i) (f i)
#align filter.Coprod Filter.coprodᵢ
theorem mem_coprodᵢ_iff {s : Set (∀ i, α i)} :
s ∈ Filter.coprodᵢ f ↔ ∀ i : ι, ∃ t₁ ∈ f i, eval i ⁻¹' t₁ ⊆ s := by simp [Filter.coprodᵢ]
#align filter.mem_Coprod_iff Filter.mem_coprodᵢ_iff
theorem compl_mem_coprodᵢ {s : Set (∀ i, α i)} :
sᶜ ∈ Filter.coprodᵢ f ↔ ∀ i, (eval i '' s)ᶜ ∈ f i := by
simp only [Filter.coprodᵢ, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodᵢ
theorem coprodᵢ_neBot_iff' :
NeBot (Filter.coprodᵢ f) ↔ (∀ i, Nonempty (α i)) ∧ ∃ d, NeBot (f d) := by
simp only [Filter.coprodᵢ, iSup_neBot, ← exists_and_left, ← comap_eval_neBot_iff']
#align filter.Coprod_ne_bot_iff' Filter.coprodᵢ_neBot_iff'
@[simp]
| Mathlib/Order/Filter/Pi.lean | 244 | 245 | theorem coprodᵢ_neBot_iff [∀ i, Nonempty (α i)] : NeBot (Filter.coprodᵢ f) ↔ ∃ d, NeBot (f d) := by |
simp [coprodᵢ_neBot_iff', *]
| 0.71875 |
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.Matrix
import Mathlib.LinearAlgebra.Matrix.ZPow
import Mathlib.LinearAlgebra.Matrix.Hermitian
import Mathlib.LinearAlgebra.Matrix.Symmetric
import Mathlib.Topology.UniformSpace.Matrix
#align_import analysis.normed_space.matrix_exponential from "leanprover-community/mathlib"@"1e3201306d4d9eb1fd54c60d7c4510ad5126f6f9"
open scoped Matrix
open NormedSpace -- For `exp`.
variable (𝕂 : Type*) {m n p : Type*} {n' : m → Type*} {𝔸 : Type*}
namespace Matrix
section Topological
section Ring
variable [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [∀ i, Fintype (n' i)]
[∀ i, DecidableEq (n' i)] [Field 𝕂] [Ring 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸]
[Algebra 𝕂 𝔸] [T2Space 𝔸]
theorem exp_diagonal (v : m → 𝔸) : exp 𝕂 (diagonal v) = diagonal (exp 𝕂 v) := by
simp_rw [exp_eq_tsum, diagonal_pow, ← diagonal_smul, ← diagonal_tsum]
#align matrix.exp_diagonal Matrix.exp_diagonal
| Mathlib/Analysis/NormedSpace/MatrixExponential.lean | 84 | 86 | theorem exp_blockDiagonal (v : m → Matrix n n 𝔸) :
exp 𝕂 (blockDiagonal v) = blockDiagonal (exp 𝕂 v) := by |
simp_rw [exp_eq_tsum, ← blockDiagonal_pow, ← blockDiagonal_smul, ← blockDiagonal_tsum]
| 0.71875 |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Finset.Option
#align_import algebra.big_operators.option from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
open Function
namespace Finset
variable {α M : Type*} [CommMonoid M]
@[to_additive (attr := simp)]
| Mathlib/Algebra/BigOperators/Option.lean | 25 | 26 | theorem prod_insertNone (f : Option α → M) (s : Finset α) :
∏ x ∈ insertNone s, f x = f none * ∏ x ∈ s, f (some x) := by | simp [insertNone]
| 0.71875 |
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.Algebra.Polynomial.RingDivision
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
universe u v
variable (K : Type u)
structure RatFunc [CommRing K] : Type u where ofFractionRing ::
toFractionRing : FractionRing K[X]
#align ratfunc RatFunc
#align ratfunc.of_fraction_ring RatFunc.ofFractionRing
#align ratfunc.to_fraction_ring RatFunc.toFractionRing
namespace RatFunc
section CommRing
variable {K}
variable [CommRing K]
section Rec
theorem ofFractionRing_injective : Function.Injective (ofFractionRing : _ → RatFunc K) :=
fun _ _ => ofFractionRing.inj
#align ratfunc.of_fraction_ring_injective RatFunc.ofFractionRing_injective
theorem toFractionRing_injective : Function.Injective (toFractionRing : _ → FractionRing K[X])
-- Porting note: the `xy` input was `rfl` and then there was no need for the `subst`
| ⟨x⟩, ⟨y⟩, xy => by subst xy; rfl
#align ratfunc.to_fraction_ring_injective RatFunc.toFractionRing_injective
protected irreducible_def liftOn {P : Sort v} (x : RatFunc K) (f : K[X] → K[X] → P)
(H : ∀ {p q p' q'} (_hq : q ∈ K[X]⁰) (_hq' : q' ∈ K[X]⁰), q' * p = q * p' → f p q = f p' q') :
P := by
refine Localization.liftOn (toFractionRing x) (fun p q => f p q) ?_
intros p p' q q' h
exact H q.2 q'.2 (let ⟨⟨c, hc⟩, mul_eq⟩ := Localization.r_iff_exists.mp h
mul_cancel_left_coe_nonZeroDivisors.mp mul_eq)
-- Porting note: the definition above was as follows
-- (-- Fix timeout by manipulating elaboration order
-- fun p q => f p q)
-- fun p p' q q' h => by
-- exact H q.2 q'.2
-- (let ⟨⟨c, hc⟩, mul_eq⟩ := Localization.r_iff_exists.mp h
-- mul_cancel_left_coe_nonZeroDivisors.mp mul_eq)
#align ratfunc.lift_on RatFunc.liftOn
theorem liftOn_ofFractionRing_mk {P : Sort v} (n : K[X]) (d : K[X]⁰) (f : K[X] → K[X] → P)
(H : ∀ {p q p' q'} (_hq : q ∈ K[X]⁰) (_hq' : q' ∈ K[X]⁰), q' * p = q * p' → f p q = f p' q') :
RatFunc.liftOn (ofFractionRing (Localization.mk n d)) f @H = f n d := by
rw [RatFunc.liftOn]
exact Localization.liftOn_mk _ _ _ _
#align ratfunc.lift_on_of_fraction_ring_mk RatFunc.liftOn_ofFractionRing_mk
theorem liftOn_condition_of_liftOn'_condition {P : Sort v} {f : K[X] → K[X] → P}
(H : ∀ {p q a} (hq : q ≠ 0) (_ha : a ≠ 0), f (a * p) (a * q) = f p q) ⦃p q p' q' : K[X]⦄
(hq : q ≠ 0) (hq' : q' ≠ 0) (h : q' * p = q * p') : f p q = f p' q' :=
calc
f p q = f (q' * p) (q' * q) := (H hq hq').symm
_ = f (q * p') (q * q') := by rw [h, mul_comm q']
_ = f p' q' := H hq' hq
#align ratfunc.lift_on_condition_of_lift_on'_condition RatFunc.liftOn_condition_of_liftOn'_condition
section IsDomain
variable [IsDomain K]
protected irreducible_def mk (p q : K[X]) : RatFunc K :=
ofFractionRing (algebraMap _ _ p / algebraMap _ _ q)
#align ratfunc.mk RatFunc.mk
theorem mk_eq_div' (p q : K[X]) :
RatFunc.mk p q = ofFractionRing (algebraMap _ _ p / algebraMap _ _ q) := by rw [RatFunc.mk]
#align ratfunc.mk_eq_div' RatFunc.mk_eq_div'
| Mathlib/FieldTheory/RatFunc/Defs.lean | 158 | 159 | theorem mk_zero (p : K[X]) : RatFunc.mk p 0 = ofFractionRing (0 : FractionRing K[X]) := by |
rw [mk_eq_div', RingHom.map_zero, div_zero]
| 0.71875 |
import Mathlib.Data.Fintype.Quotient
import Mathlib.ModelTheory.Semantics
#align_import model_theory.quotients from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
namespace FirstOrder
namespace Language
variable (L : Language) {M : Type*}
open FirstOrder
open Structure
class Prestructure (s : Setoid M) where
toStructure : L.Structure M
fun_equiv : ∀ {n} {f : L.Functions n} (x y : Fin n → M), x ≈ y → funMap f x ≈ funMap f y
rel_equiv : ∀ {n} {r : L.Relations n} (x y : Fin n → M) (_ : x ≈ y), RelMap r x = RelMap r y
#align first_order.language.prestructure FirstOrder.Language.Prestructure
#align first_order.language.prestructure.to_structure FirstOrder.Language.Prestructure.toStructure
#align first_order.language.prestructure.fun_equiv FirstOrder.Language.Prestructure.fun_equiv
#align first_order.language.prestructure.rel_equiv FirstOrder.Language.Prestructure.rel_equiv
variable {L} {s : Setoid M}
variable [ps : L.Prestructure s]
instance quotientStructure : L.Structure (Quotient s) where
funMap {n} f x :=
Quotient.map (@funMap L M ps.toStructure n f) Prestructure.fun_equiv (Quotient.finChoice x)
RelMap {n} r x :=
Quotient.lift (@RelMap L M ps.toStructure n r) Prestructure.rel_equiv (Quotient.finChoice x)
#align first_order.language.quotient_structure FirstOrder.Language.quotientStructure
variable (s)
theorem funMap_quotient_mk' {n : ℕ} (f : L.Functions n) (x : Fin n → M) :
(funMap f fun i => (⟦x i⟧ : Quotient s)) = ⟦@funMap _ _ ps.toStructure _ f x⟧ := by
change
Quotient.map (@funMap L M ps.toStructure n f) Prestructure.fun_equiv (Quotient.finChoice _) =
_
rw [Quotient.finChoice_eq, Quotient.map_mk]
#align first_order.language.fun_map_quotient_mk FirstOrder.Language.funMap_quotient_mk'
| Mathlib/ModelTheory/Quotients.lean | 65 | 70 | theorem relMap_quotient_mk' {n : ℕ} (r : L.Relations n) (x : Fin n → M) :
(RelMap r fun i => (⟦x i⟧ : Quotient s)) ↔ @RelMap _ _ ps.toStructure _ r x := by |
change
Quotient.lift (@RelMap L M ps.toStructure n r) Prestructure.rel_equiv (Quotient.finChoice _) ↔
_
rw [Quotient.finChoice_eq, Quotient.lift_mk]
| 0.71875 |
import Mathlib.Analysis.InnerProductSpace.Calculus
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.inner_product_space.euclidean_dist from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057"
open scoped Topology
open Set
variable {E : Type*} [AddCommGroup E] [TopologicalSpace E] [TopologicalAddGroup E] [T2Space E]
[Module ℝ E] [ContinuousSMul ℝ E] [FiniteDimensional ℝ E]
noncomputable section
open FiniteDimensional
def toEuclidean : E ≃L[ℝ] EuclideanSpace ℝ (Fin <| finrank ℝ E) :=
ContinuousLinearEquiv.ofFinrankEq finrank_euclideanSpace_fin.symm
#align to_euclidean toEuclidean
namespace Euclidean
nonrec def dist (x y : E) : ℝ :=
dist (toEuclidean x) (toEuclidean y)
#align euclidean.dist Euclidean.dist
def closedBall (x : E) (r : ℝ) : Set E :=
{y | dist y x ≤ r}
#align euclidean.closed_ball Euclidean.closedBall
def ball (x : E) (r : ℝ) : Set E :=
{y | dist y x < r}
#align euclidean.ball Euclidean.ball
theorem ball_eq_preimage (x : E) (r : ℝ) :
ball x r = toEuclidean ⁻¹' Metric.ball (toEuclidean x) r :=
rfl
#align euclidean.ball_eq_preimage Euclidean.ball_eq_preimage
theorem closedBall_eq_preimage (x : E) (r : ℝ) :
closedBall x r = toEuclidean ⁻¹' Metric.closedBall (toEuclidean x) r :=
rfl
#align euclidean.closed_ball_eq_preimage Euclidean.closedBall_eq_preimage
theorem ball_subset_closedBall {x : E} {r : ℝ} : ball x r ⊆ closedBall x r := fun _ (hy : _ < r) =>
le_of_lt hy
#align euclidean.ball_subset_closed_ball Euclidean.ball_subset_closedBall
theorem isOpen_ball {x : E} {r : ℝ} : IsOpen (ball x r) :=
Metric.isOpen_ball.preimage toEuclidean.continuous
#align euclidean.is_open_ball Euclidean.isOpen_ball
theorem mem_ball_self {x : E} {r : ℝ} (hr : 0 < r) : x ∈ ball x r :=
Metric.mem_ball_self hr
#align euclidean.mem_ball_self Euclidean.mem_ball_self
| Mathlib/Analysis/InnerProductSpace/EuclideanDist.lean | 82 | 84 | theorem closedBall_eq_image (x : E) (r : ℝ) :
closedBall x r = toEuclidean.symm '' Metric.closedBall (toEuclidean x) r := by |
rw [toEuclidean.image_symm_eq_preimage, closedBall_eq_preimage]
| 0.71875 |
import Mathlib.Data.Matrix.Block
#align_import linear_algebra.matrix.symmetric from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
variable {α β n m R : Type*}
namespace Matrix
open Matrix
def IsSymm (A : Matrix n n α) : Prop :=
Aᵀ = A
#align matrix.is_symm Matrix.IsSymm
instance (A : Matrix n n α) [Decidable (Aᵀ = A)] : Decidable (IsSymm A) :=
inferInstanceAs <| Decidable (_ = _)
theorem IsSymm.eq {A : Matrix n n α} (h : A.IsSymm) : Aᵀ = A :=
h
#align matrix.is_symm.eq Matrix.IsSymm.eq
theorem IsSymm.ext_iff {A : Matrix n n α} : A.IsSymm ↔ ∀ i j, A j i = A i j :=
Matrix.ext_iff.symm
#align matrix.is_symm.ext_iff Matrix.IsSymm.ext_iff
-- @[ext] -- Porting note: removed attribute
theorem IsSymm.ext {A : Matrix n n α} : (∀ i j, A j i = A i j) → A.IsSymm :=
Matrix.ext
#align matrix.is_symm.ext Matrix.IsSymm.ext
theorem IsSymm.apply {A : Matrix n n α} (h : A.IsSymm) (i j : n) : A j i = A i j :=
IsSymm.ext_iff.1 h i j
#align matrix.is_symm.apply Matrix.IsSymm.apply
theorem isSymm_mul_transpose_self [Fintype n] [CommSemiring α] (A : Matrix n n α) :
(A * Aᵀ).IsSymm :=
transpose_mul _ _
#align matrix.is_symm_mul_transpose_self Matrix.isSymm_mul_transpose_self
theorem isSymm_transpose_mul_self [Fintype n] [CommSemiring α] (A : Matrix n n α) :
(Aᵀ * A).IsSymm :=
transpose_mul _ _
#align matrix.is_symm_transpose_mul_self Matrix.isSymm_transpose_mul_self
theorem isSymm_add_transpose_self [AddCommSemigroup α] (A : Matrix n n α) : (A + Aᵀ).IsSymm :=
add_comm _ _
#align matrix.is_symm_add_transpose_self Matrix.isSymm_add_transpose_self
theorem isSymm_transpose_add_self [AddCommSemigroup α] (A : Matrix n n α) : (Aᵀ + A).IsSymm :=
add_comm _ _
#align matrix.is_symm_transpose_add_self Matrix.isSymm_transpose_add_self
@[simp]
theorem isSymm_zero [Zero α] : (0 : Matrix n n α).IsSymm :=
transpose_zero
#align matrix.is_symm_zero Matrix.isSymm_zero
@[simp]
theorem isSymm_one [DecidableEq n] [Zero α] [One α] : (1 : Matrix n n α).IsSymm :=
transpose_one
#align matrix.is_symm_one Matrix.isSymm_one
| Mathlib/LinearAlgebra/Matrix/Symmetric.lean | 86 | 89 | theorem IsSymm.pow [CommSemiring α] [Fintype n] [DecidableEq n] {A : Matrix n n α} (h : A.IsSymm)
(k : ℕ) :
(A ^ k).IsSymm := by |
rw [IsSymm, transpose_pow, h]
| 0.71875 |
import Mathlib.Init.Function
#align_import data.option.n_ary from "leanprover-community/mathlib"@"995b47e555f1b6297c7cf16855f1023e355219fb"
universe u
open Function
namespace Option
variable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ}
def map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ :=
a.bind fun a => b.map <| f a
#align option.map₂ Option.map₂
theorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) :
map₂ f a b = f <$> a <*> b := by
cases a <;> rfl
#align option.map₂_def Option.map₂_def
-- Porting note (#10618): In Lean3, was `@[simp]` but now `simp` can prove it
theorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl
#align option.map₂_some_some Option.map₂_some_some
theorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl
#align option.map₂_coe_coe Option.map₂_coe_coe
@[simp]
theorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl
#align option.map₂_none_left Option.map₂_none_left
@[simp]
theorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl
#align option.map₂_none_right Option.map₂_none_right
@[simp]
theorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b :=
rfl
#align option.map₂_coe_left Option.map₂_coe_left
-- Porting note: This proof was `rfl` in Lean3, but now is not.
@[simp]
theorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) :
map₂ f a b = a.map fun a => f a b := by cases a <;> rfl
#align option.map₂_coe_right Option.map₂_coe_right
-- Porting note: Removed the `@[simp]` tag as membership of an `Option` is no-longer simp-normal.
theorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by
simp [map₂, bind_eq_some]
#align option.mem_map₂_iff Option.mem_map₂_iff
@[simp]
| Mathlib/Data/Option/NAry.lean | 83 | 84 | theorem map₂_eq_none_iff : map₂ f a b = none ↔ a = none ∨ b = none := by |
cases a <;> cases b <;> simp
| 0.71875 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.FDeriv.Add
#align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
noncomputable section
open scoped Classical Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
section Mul
variable {𝕜' 𝔸 : Type*} [NormedField 𝕜'] [NormedRing 𝔸] [NormedAlgebra 𝕜 𝕜'] [NormedAlgebra 𝕜 𝔸]
{c d : 𝕜 → 𝔸} {c' d' : 𝔸} {u v : 𝕜 → 𝕜'}
theorem HasDerivWithinAt.mul (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x) :
HasDerivWithinAt (fun y => c y * d y) (c' * d x + c x * d') s x := by
have := (HasFDerivWithinAt.mul' hc hd).hasDerivWithinAt
rwa [ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, one_smul, one_smul,
add_comm] at this
#align has_deriv_within_at.mul HasDerivWithinAt.mul
theorem HasDerivAt.mul (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) :
HasDerivAt (fun y => c y * d y) (c' * d x + c x * d') x := by
rw [← hasDerivWithinAt_univ] at *
exact hc.mul hd
#align has_deriv_at.mul HasDerivAt.mul
| Mathlib/Analysis/Calculus/Deriv/Mul.lean | 221 | 227 | theorem HasStrictDerivAt.mul (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x) :
HasStrictDerivAt (fun y => c y * d y) (c' * d x + c x * d') x := by |
have := (HasStrictFDerivAt.mul' hc hd).hasStrictDerivAt
rwa [ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, one_smul, one_smul,
add_comm] at this
| 0.71875 |
import Mathlib.CategoryTheory.Opposites
#align_import category_theory.eq_to_hom from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe v₁ v₂ v₃ u₁ u₂ u₃
-- morphism levels before object levels. See note [CategoryTheory universes].
namespace CategoryTheory
open Opposite
variable {C : Type u₁} [Category.{v₁} C]
def eqToHom {X Y : C} (p : X = Y) : X ⟶ Y := by rw [p]; exact 𝟙 _
#align category_theory.eq_to_hom CategoryTheory.eqToHom
@[simp]
theorem eqToHom_refl (X : C) (p : X = X) : eqToHom p = 𝟙 X :=
rfl
#align category_theory.eq_to_hom_refl CategoryTheory.eqToHom_refl
@[reassoc (attr := simp)]
theorem eqToHom_trans {X Y Z : C} (p : X = Y) (q : Y = Z) :
eqToHom p ≫ eqToHom q = eqToHom (p.trans q) := by
cases p
cases q
simp
#align category_theory.eq_to_hom_trans CategoryTheory.eqToHom_trans
theorem comp_eqToHom_iff {X Y Y' : C} (p : Y = Y') (f : X ⟶ Y) (g : X ⟶ Y') :
f ≫ eqToHom p = g ↔ f = g ≫ eqToHom p.symm :=
{ mp := fun h => h ▸ by simp
mpr := fun h => by simp [eq_whisker h (eqToHom p)] }
#align category_theory.comp_eq_to_hom_iff CategoryTheory.comp_eqToHom_iff
theorem eqToHom_comp_iff {X X' Y : C} (p : X = X') (f : X ⟶ Y) (g : X' ⟶ Y) :
eqToHom p ≫ g = f ↔ g = eqToHom p.symm ≫ f :=
{ mp := fun h => h ▸ by simp
mpr := fun h => h ▸ by simp [whisker_eq _ h] }
#align category_theory.eq_to_hom_comp_iff CategoryTheory.eqToHom_comp_iff
variable {β : Sort*}
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_naturality {f g : β → C} (z : ∀ b, f b ⟶ g b) {j j' : β} (w : j = j') :
z j ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ z j' := by
cases w
simp
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_iso_hom_naturality {f g : β → C} (z : ∀ b, f b ≅ g b) {j j' : β} (w : j = j') :
(z j).hom ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ (z j').hom := by
cases w
simp
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_iso_inv_naturality {f g : β → C} (z : ∀ b, f b ≅ g b) {j j' : β} (w : j = j') :
(z j).inv ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ (z j').inv := by
cases w
simp
@[simp, nolint simpNF]
theorem congrArg_cast_hom_left {X Y Z : C} (p : X = Y) (q : Y ⟶ Z) :
cast (congrArg (fun W : C => W ⟶ Z) p.symm) q = eqToHom p ≫ q := by
cases p
simp
theorem congrArg_mpr_hom_left {X Y Z : C} (p : X = Y) (q : Y ⟶ Z) :
(congrArg (fun W : C => W ⟶ Z) p).mpr q = eqToHom p ≫ q := by
cases p
simp
#align category_theory.congr_arg_mpr_hom_left CategoryTheory.congrArg_mpr_hom_left
@[simp, nolint simpNF]
theorem congrArg_cast_hom_right {X Y Z : C} (p : X ⟶ Y) (q : Z = Y) :
cast (congrArg (fun W : C => X ⟶ W) q.symm) p = p ≫ eqToHom q.symm := by
cases q
simp
| Mathlib/CategoryTheory/EqToHom.lean | 138 | 141 | theorem congrArg_mpr_hom_right {X Y Z : C} (p : X ⟶ Y) (q : Z = Y) :
(congrArg (fun W : C => X ⟶ W) q).mpr p = p ≫ eqToHom q.symm := by |
cases q
simp
| 0.71875 |
import Mathlib.Algebra.Group.Defs
import Mathlib.Algebra.GroupWithZero.Defs
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Tactic.Spread
import Mathlib.Util.AssertExists
#align_import algebra.ring.defs from "leanprover-community/mathlib"@"76de8ae01554c3b37d66544866659ff174e66e1f"
universe u v w x
variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x}
open Function
class Distrib (R : Type*) extends Mul R, Add R where
protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
#align distrib Distrib
class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
#align left_distrib_class LeftDistribClass
class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
#align right_distrib_class RightDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R :=
⟨Distrib.left_distrib⟩
#align distrib.left_distrib_class Distrib.leftDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] :
RightDistribClass R :=
⟨Distrib.right_distrib⟩
#align distrib.right_distrib_class Distrib.rightDistribClass
theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) :
a * (b + c) = a * b + a * c :=
LeftDistribClass.left_distrib a b c
#align left_distrib left_distrib
alias mul_add := left_distrib
#align mul_add mul_add
theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) :
(a + b) * c = a * c + b * c :=
RightDistribClass.right_distrib a b c
#align right_distrib right_distrib
alias add_mul := right_distrib
#align add_mul add_mul
theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) :
(a + b + c) * d = a * d + b * d + c * d := by simp [right_distrib]
#align distrib_three_right distrib_three_right
class NonUnitalNonAssocSemiring (α : Type u) extends AddCommMonoid α, Distrib α, MulZeroClass α
#align non_unital_non_assoc_semiring NonUnitalNonAssocSemiring
class NonUnitalSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, SemigroupWithZero α
#align non_unital_semiring NonUnitalSemiring
class NonAssocSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, MulZeroOneClass α,
AddCommMonoidWithOne α
#align non_assoc_semiring NonAssocSemiring
class NonUnitalNonAssocRing (α : Type u) extends AddCommGroup α, NonUnitalNonAssocSemiring α
#align non_unital_non_assoc_ring NonUnitalNonAssocRing
class NonUnitalRing (α : Type*) extends NonUnitalNonAssocRing α, NonUnitalSemiring α
#align non_unital_ring NonUnitalRing
class NonAssocRing (α : Type*) extends NonUnitalNonAssocRing α, NonAssocSemiring α,
AddCommGroupWithOne α
#align non_assoc_ring NonAssocRing
class Semiring (α : Type u) extends NonUnitalSemiring α, NonAssocSemiring α, MonoidWithZero α
#align semiring Semiring
class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R
#align ring Ring
@[to_additive]
theorem mul_ite {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
(a * if P then b else c) = if P then a * b else a * c := by split_ifs <;> rfl
#align mul_ite mul_ite
#align add_ite add_ite
@[to_additive]
theorem ite_mul {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
(if P then a else b) * c = if P then a * c else b * c := by split_ifs <;> rfl
#align ite_mul ite_mul
#align ite_add ite_add
-- We make `mul_ite` and `ite_mul` simp lemmas,
-- but not `add_ite` or `ite_add`.
-- The problem we're trying to avoid is dealing with
-- summations of the form `∑ x ∈ s, (f x + ite P 1 0)`,
-- in which `add_ite` followed by `sum_ite` would needlessly slice up
-- the `f x` terms according to whether `P` holds at `x`.
-- There doesn't appear to be a corresponding difficulty so far with
-- `mul_ite` and `ite_mul`.
attribute [simp] mul_ite ite_mul
| Mathlib/Algebra/Ring/Defs.lean | 218 | 221 | theorem ite_sub_ite {α} [Sub α] (P : Prop) [Decidable P] (a b c d : α) :
((if P then a else b) - if P then c else d) = if P then a - c else b - d := by |
split
repeat rfl
| 0.71875 |
import Mathlib.Analysis.Calculus.FDeriv.Linear
import Mathlib.Analysis.Calculus.FDeriv.Comp
#align_import analysis.calculus.fderiv.prod from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
variable {f f₀ f₁ g : E → F}
variable {f' f₀' f₁' g' : E →L[𝕜] F}
variable (e : E →L[𝕜] F)
variable {x : E}
variable {s t : Set E}
variable {L L₁ L₂ : Filter E}
section CartesianProduct
section Pi
variable {ι : Type*} [Fintype ι] {F' : ι → Type*} [∀ i, NormedAddCommGroup (F' i)]
[∀ i, NormedSpace 𝕜 (F' i)] {φ : ∀ i, E → F' i} {φ' : ∀ i, E →L[𝕜] F' i} {Φ : E → ∀ i, F' i}
{Φ' : E →L[𝕜] ∀ i, F' i}
@[simp]
| Mathlib/Analysis/Calculus/FDeriv/Prod.lean | 400 | 403 | theorem hasStrictFDerivAt_pi' :
HasStrictFDerivAt Φ Φ' x ↔ ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x := by |
simp only [HasStrictFDerivAt, ContinuousLinearMap.coe_pi]
exact isLittleO_pi
| 0.71875 |
import Mathlib.Topology.Algebra.InfiniteSum.Group
import Mathlib.Topology.Algebra.Star
noncomputable section
open Filter Finset Function
open scoped Topology
variable {α β γ δ : Type*}
section ProdDomain
variable [CommMonoid α] [TopologicalSpace α]
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean | 33 | 35 | theorem hasProd_pi_single [DecidableEq β] (b : β) (a : α) : HasProd (Pi.mulSingle b a) a := by |
convert hasProd_ite_eq b a
simp [Pi.mulSingle_apply]
| 0.71875 |
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 Equalizer
variable (f g : X ⟶ Y) [HasEqualizer f g]
abbrev equalizerSubobject : Subobject X :=
Subobject.mk (equalizer.ι f g)
#align category_theory.limits.equalizer_subobject CategoryTheory.Limits.equalizerSubobject
def equalizerSubobjectIso : (equalizerSubobject f g : C) ≅ equalizer f g :=
Subobject.underlyingIso (equalizer.ι f g)
#align category_theory.limits.equalizer_subobject_iso CategoryTheory.Limits.equalizerSubobjectIso
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 50 | 52 | theorem equalizerSubobject_arrow :
(equalizerSubobjectIso f g).hom ≫ equalizer.ι f g = (equalizerSubobject f g).arrow := by |
simp [equalizerSubobjectIso]
| 0.71875 |
import Mathlib.Data.Matrix.Basic
variable {l m n o : Type*}
universe u v w
variable {R : Type*} {α : Type v} {β : Type w}
namespace Matrix
def col (w : m → α) : Matrix m Unit α :=
of fun x _ => w x
#align matrix.col Matrix.col
-- TODO: set as an equation lemma for `col`, see mathlib4#3024
@[simp]
theorem col_apply (w : m → α) (i j) : col w i j = w i :=
rfl
#align matrix.col_apply Matrix.col_apply
def row (v : n → α) : Matrix Unit n α :=
of fun _ y => v y
#align matrix.row Matrix.row
-- TODO: set as an equation lemma for `row`, see mathlib4#3024
@[simp]
theorem row_apply (v : n → α) (i j) : row v i j = v j :=
rfl
#align matrix.row_apply Matrix.row_apply
theorem col_injective : Function.Injective (col : (m → α) → _) :=
fun _x _y h => funext fun i => congr_fun₂ h i ()
@[simp] theorem col_inj {v w : m → α} : col v = col w ↔ v = w := col_injective.eq_iff
@[simp] theorem col_zero [Zero α] : col (0 : m → α) = 0 := rfl
@[simp] theorem col_eq_zero [Zero α] (v : m → α) : col v = 0 ↔ v = 0 := col_inj
@[simp]
theorem col_add [Add α] (v w : m → α) : col (v + w) = col v + col w := by
ext
rfl
#align matrix.col_add Matrix.col_add
@[simp]
theorem col_smul [SMul R α] (x : R) (v : m → α) : col (x • v) = x • col v := by
ext
rfl
#align matrix.col_smul Matrix.col_smul
theorem row_injective : Function.Injective (row : (n → α) → _) :=
fun _x _y h => funext fun j => congr_fun₂ h () j
@[simp] theorem row_inj {v w : n → α} : row v = row w ↔ v = w := row_injective.eq_iff
@[simp] theorem row_zero [Zero α] : row (0 : n → α) = 0 := rfl
@[simp] theorem row_eq_zero [Zero α] (v : n → α) : row v = 0 ↔ v = 0 := row_inj
@[simp]
theorem row_add [Add α] (v w : m → α) : row (v + w) = row v + row w := by
ext
rfl
#align matrix.row_add Matrix.row_add
@[simp]
theorem row_smul [SMul R α] (x : R) (v : m → α) : row (x • v) = x • row v := by
ext
rfl
#align matrix.row_smul Matrix.row_smul
@[simp]
theorem transpose_col (v : m → α) : (Matrix.col v)ᵀ = Matrix.row v := by
ext
rfl
#align matrix.transpose_col Matrix.transpose_col
@[simp]
theorem transpose_row (v : m → α) : (Matrix.row v)ᵀ = Matrix.col v := by
ext
rfl
#align matrix.transpose_row Matrix.transpose_row
@[simp]
theorem conjTranspose_col [Star α] (v : m → α) : (col v)ᴴ = row (star v) := by
ext
rfl
#align matrix.conj_transpose_col Matrix.conjTranspose_col
@[simp]
theorem conjTranspose_row [Star α] (v : m → α) : (row v)ᴴ = col (star v) := by
ext
rfl
#align matrix.conj_transpose_row Matrix.conjTranspose_row
theorem row_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) :
Matrix.row (v ᵥ* M) = Matrix.row v * M := by
ext
rfl
#align matrix.row_vec_mul Matrix.row_vecMul
theorem col_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) :
Matrix.col (v ᵥ* M) = (Matrix.row v * M)ᵀ := by
ext
rfl
#align matrix.col_vec_mul Matrix.col_vecMul
| Mathlib/Data/Matrix/RowCol.lean | 129 | 132 | theorem col_mulVec [Fintype n] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : n → α) :
Matrix.col (M *ᵥ v) = M * Matrix.col v := by |
ext
rfl
| 0.71875 |
import Mathlib.Data.ENat.Lattice
import Mathlib.Order.OrderIsoNat
import Mathlib.Tactic.TFAE
#align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b"
open List hiding le_antisymm
open OrderDual
universe u v
variable {α β : Type*}
namespace Set
section LT
variable [LT α] [LT β] (s t : Set α)
def subchain : Set (List α) :=
{ l | l.Chain' (· < ·) ∧ ∀ i ∈ l, i ∈ s }
#align set.subchain Set.subchain
@[simp] -- porting note: new `simp`
theorem nil_mem_subchain : [] ∈ s.subchain := ⟨trivial, fun _ ↦ nofun⟩
#align set.nil_mem_subchain Set.nil_mem_subchain
variable {s} {l : List α} {a : α}
theorem cons_mem_subchain_iff :
(a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by
simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm,
and_assoc]
#align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff
@[simp] -- Porting note (#10756): new lemma + `simp`
theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by simp [cons_mem_subchain_iff]
instance : Nonempty s.subchain :=
⟨⟨[], s.nil_mem_subchain⟩⟩
variable (s)
noncomputable def chainHeight : ℕ∞ :=
⨆ l ∈ s.subchain, length l
#align set.chain_height Set.chainHeight
theorem chainHeight_eq_iSup_subtype : s.chainHeight = ⨆ l : s.subchain, ↑l.1.length :=
iSup_subtype'
#align set.chain_height_eq_supr_subtype Set.chainHeight_eq_iSup_subtype
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
∃ l ∈ s.subchain, length l = n := by
rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
rw [chainHeight_eq_iSup_subtype] at ha
· obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ :=
not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
(l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩
· rw [ENat.iSup_coe_lt_top] at ha
obtain ⟨⟨l, h₁, h₂⟩, e : l.length = _⟩ := Nat.sSup_mem (Set.range_nonempty _) ha
refine
⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
(l.length_take n).trans <| min_eq_left <| ?_⟩
rwa [e, ← Nat.cast_le (α := ℕ∞), sSup_range, ENat.coe_iSup ha, ← chainHeight_eq_iSup_subtype]
#align set.exists_chain_of_le_chain_height Set.exists_chain_of_le_chainHeight
theorem le_chainHeight_TFAE (n : ℕ) :
TFAE [↑n ≤ s.chainHeight, ∃ l ∈ s.subchain, length l = n, ∃ l ∈ s.subchain, n ≤ length l] := by
tfae_have 1 → 2; · exact s.exists_chain_of_le_chainHeight
tfae_have 2 → 3; · rintro ⟨l, hls, he⟩; exact ⟨l, hls, he.ge⟩
tfae_have 3 → 1; · rintro ⟨l, hs, hn⟩; exact le_iSup₂_of_le l hs (WithTop.coe_le_coe.2 hn)
tfae_finish
#align set.le_chain_height_tfae Set.le_chainHeight_TFAE
variable {s t}
theorem le_chainHeight_iff {n : ℕ} : ↑n ≤ s.chainHeight ↔ ∃ l ∈ s.subchain, length l = n :=
(le_chainHeight_TFAE s n).out 0 1
#align set.le_chain_height_iff Set.le_chainHeight_iff
theorem length_le_chainHeight_of_mem_subchain (hl : l ∈ s.subchain) : ↑l.length ≤ s.chainHeight :=
le_chainHeight_iff.mpr ⟨l, hl, rfl⟩
#align set.length_le_chain_height_of_mem_subchain Set.length_le_chainHeight_of_mem_subchain
theorem chainHeight_eq_top_iff : s.chainHeight = ⊤ ↔ ∀ n, ∃ l ∈ s.subchain, length l = n := by
refine ⟨fun h n ↦ le_chainHeight_iff.1 (le_top.trans_eq h.symm), fun h ↦ ?_⟩
contrapose! h; obtain ⟨n, hn⟩ := WithTop.ne_top_iff_exists.1 h
exact ⟨n + 1, fun l hs ↦ (Nat.lt_succ_iff.2 <| Nat.cast_le.1 <|
(length_le_chainHeight_of_mem_subchain hs).trans_eq hn.symm).ne⟩
#align set.chain_height_eq_top_iff Set.chainHeight_eq_top_iff
@[simp]
theorem one_le_chainHeight_iff : 1 ≤ s.chainHeight ↔ s.Nonempty := by
rw [← Nat.cast_one, Set.le_chainHeight_iff]
simp only [length_eq_one, @and_comm (_ ∈ _), @eq_comm _ _ [_], exists_exists_eq_and,
singleton_mem_subchain_iff, Set.Nonempty]
#align set.one_le_chain_height_iff Set.one_le_chainHeight_iff
@[simp]
| Mathlib/Order/Height.lean | 142 | 144 | theorem chainHeight_eq_zero_iff : s.chainHeight = 0 ↔ s = ∅ := by |
rw [← not_iff_not, ← Ne, ← ENat.one_le_iff_ne_zero, one_le_chainHeight_iff,
nonempty_iff_ne_empty]
| 0.71875 |
import Mathlib.MeasureTheory.Integral.Bochner
import Mathlib.MeasureTheory.Group.Measure
#align_import measure_theory.group.integration from "leanprover-community/mathlib"@"ec247d43814751ffceb33b758e8820df2372bf6f"
namespace MeasureTheory
open Measure TopologicalSpace
open scoped ENNReal
variable {𝕜 M α G E F : Type*} [MeasurableSpace G]
variable [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F]
variable {μ : Measure G} {f : G → E} {g : G}
section MeasurableMul
variable [Group G] [MeasurableMul G]
@[to_additive
"Translating a function by left-addition does not change its integral with respect to a
left-invariant measure."] -- Porting note: was `@[simp]`
theorem integral_mul_left_eq_self [IsMulLeftInvariant μ] (f : G → E) (g : G) :
(∫ x, f (g * x) ∂μ) = ∫ x, f x ∂μ := by
have h_mul : MeasurableEmbedding fun x => g * x := (MeasurableEquiv.mulLeft g).measurableEmbedding
rw [← h_mul.integral_map, map_mul_left_eq_self]
#align measure_theory.integral_mul_left_eq_self MeasureTheory.integral_mul_left_eq_self
#align measure_theory.integral_add_left_eq_self MeasureTheory.integral_add_left_eq_self
@[to_additive
"Translating a function by right-addition does not change its integral with respect to a
right-invariant measure."] -- Porting note: was `@[simp]`
theorem integral_mul_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) :
(∫ x, f (x * g) ∂μ) = ∫ x, f x ∂μ := by
have h_mul : MeasurableEmbedding fun x => x * g :=
(MeasurableEquiv.mulRight g).measurableEmbedding
rw [← h_mul.integral_map, map_mul_right_eq_self]
#align measure_theory.integral_mul_right_eq_self MeasureTheory.integral_mul_right_eq_self
#align measure_theory.integral_add_right_eq_self MeasureTheory.integral_add_right_eq_self
@[to_additive] -- Porting note: was `@[simp]`
theorem integral_div_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) :
(∫ x, f (x / g) ∂μ) = ∫ x, f x ∂μ := by
simp_rw [div_eq_mul_inv]
-- Porting note: was `simp_rw`
rw [integral_mul_right_eq_self f g⁻¹]
#align measure_theory.integral_div_right_eq_self MeasureTheory.integral_div_right_eq_self
#align measure_theory.integral_sub_right_eq_self MeasureTheory.integral_sub_right_eq_self
@[to_additive
"If some left-translate of a function negates it, then the integral of the function with
respect to a left-invariant measure is 0."]
theorem integral_eq_zero_of_mul_left_eq_neg [IsMulLeftInvariant μ] (hf' : ∀ x, f (g * x) = -f x) :
∫ x, f x ∂μ = 0 := by
simp_rw [← self_eq_neg ℝ E, ← integral_neg, ← hf', integral_mul_left_eq_self]
#align measure_theory.integral_eq_zero_of_mul_left_eq_neg MeasureTheory.integral_eq_zero_of_mul_left_eq_neg
#align measure_theory.integral_eq_zero_of_add_left_eq_neg MeasureTheory.integral_eq_zero_of_add_left_eq_neg
@[to_additive
"If some right-translate of a function negates it, then the integral of the function with
respect to a right-invariant measure is 0."]
| Mathlib/MeasureTheory/Group/Integral.lean | 103 | 105 | theorem integral_eq_zero_of_mul_right_eq_neg [IsMulRightInvariant μ] (hf' : ∀ x, f (x * g) = -f x) :
∫ x, f x ∂μ = 0 := by |
simp_rw [← self_eq_neg ℝ E, ← integral_neg, ← hf', integral_mul_right_eq_self]
| 0.71875 |
import Mathlib.RingTheory.WittVector.Frobenius
import Mathlib.RingTheory.WittVector.Verschiebung
import Mathlib.RingTheory.WittVector.MulP
#align_import ring_theory.witt_vector.identities from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
namespace WittVector
variable {p : ℕ} {R : Type*} [hp : Fact p.Prime] [CommRing R]
-- type as `\bbW`
local notation "𝕎" => WittVector p
noncomputable section
-- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added.
theorem frobenius_verschiebung (x : 𝕎 R) : frobenius (verschiebung x) = x * p := by
have : IsPoly p fun {R} [CommRing R] x ↦ frobenius (verschiebung x) :=
IsPoly.comp (hg := frobenius_isPoly p) (hf := verschiebung_isPoly)
have : IsPoly p fun {R} [CommRing R] x ↦ x * p := mulN_isPoly p p
ghost_calc x
ghost_simp [mul_comm]
#align witt_vector.frobenius_verschiebung WittVector.frobenius_verschiebung
theorem verschiebung_zmod (x : 𝕎 (ZMod p)) : verschiebung x = x * p := by
rw [← frobenius_verschiebung, frobenius_zmodp]
#align witt_vector.verschiebung_zmod WittVector.verschiebung_zmod
variable (p R)
theorem coeff_p_pow [CharP R p] (i : ℕ) : ((p : 𝕎 R) ^ i).coeff i = 1 := by
induction' i with i h
· simp only [Nat.zero_eq, one_coeff_zero, Ne, pow_zero]
· rw [pow_succ, ← frobenius_verschiebung, coeff_frobenius_charP,
verschiebung_coeff_succ, h, one_pow]
#align witt_vector.coeff_p_pow WittVector.coeff_p_pow
theorem coeff_p_pow_eq_zero [CharP R p] {i j : ℕ} (hj : j ≠ i) : ((p : 𝕎 R) ^ i).coeff j = 0 := by
induction' i with i hi generalizing j
· rw [pow_zero, one_coeff_eq_of_pos]
exact Nat.pos_of_ne_zero hj
· rw [pow_succ, ← frobenius_verschiebung, coeff_frobenius_charP]
cases j
· rw [verschiebung_coeff_zero, zero_pow hp.out.ne_zero]
· rw [verschiebung_coeff_succ, hi (ne_of_apply_ne _ hj), zero_pow hp.out.ne_zero]
#align witt_vector.coeff_p_pow_eq_zero WittVector.coeff_p_pow_eq_zero
theorem coeff_p [CharP R p] (i : ℕ) : (p : 𝕎 R).coeff i = if i = 1 then 1 else 0 := by
split_ifs with hi
· simpa only [hi, pow_one] using coeff_p_pow p R 1
· simpa only [pow_one] using coeff_p_pow_eq_zero p R hi
#align witt_vector.coeff_p WittVector.coeff_p
@[simp]
theorem coeff_p_zero [CharP R p] : (p : 𝕎 R).coeff 0 = 0 := by
rw [coeff_p, if_neg]
exact zero_ne_one
#align witt_vector.coeff_p_zero WittVector.coeff_p_zero
@[simp]
theorem coeff_p_one [CharP R p] : (p : 𝕎 R).coeff 1 = 1 := by rw [coeff_p, if_pos rfl]
#align witt_vector.coeff_p_one WittVector.coeff_p_one
theorem p_nonzero [Nontrivial R] [CharP R p] : (p : 𝕎 R) ≠ 0 := by
intro h
simpa only [h, zero_coeff, zero_ne_one] using coeff_p_one p R
#align witt_vector.p_nonzero WittVector.p_nonzero
theorem FractionRing.p_nonzero [Nontrivial R] [CharP R p] : (p : FractionRing (𝕎 R)) ≠ 0 := by
simpa using (IsFractionRing.injective (𝕎 R) (FractionRing (𝕎 R))).ne (WittVector.p_nonzero _ _)
#align witt_vector.fraction_ring.p_nonzero WittVector.FractionRing.p_nonzero
variable {p R}
-- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added.
theorem verschiebung_mul_frobenius (x y : 𝕎 R) :
verschiebung (x * frobenius y) = verschiebung x * y := by
have : IsPoly₂ p fun {R} [Rcr : CommRing R] x y ↦ verschiebung (x * frobenius y) :=
IsPoly.comp₂ (hg := verschiebung_isPoly)
(hf := IsPoly₂.comp (hh := mulIsPoly₂) (hf := idIsPolyI' p) (hg := frobenius_isPoly p))
have : IsPoly₂ p fun {R} [CommRing R] x y ↦ verschiebung x * y :=
IsPoly₂.comp (hh := mulIsPoly₂) (hf := verschiebung_isPoly) (hg := idIsPolyI' p)
ghost_calc x y
rintro ⟨⟩ <;> ghost_simp [mul_assoc]
#align witt_vector.verschiebung_mul_frobenius WittVector.verschiebung_mul_frobenius
theorem mul_charP_coeff_zero [CharP R p] (x : 𝕎 R) : (x * p).coeff 0 = 0 := by
rw [← frobenius_verschiebung, coeff_frobenius_charP, verschiebung_coeff_zero,
zero_pow hp.out.ne_zero]
#align witt_vector.mul_char_p_coeff_zero WittVector.mul_charP_coeff_zero
| Mathlib/RingTheory/WittVector/Identities.lean | 119 | 121 | theorem mul_charP_coeff_succ [CharP R p] (x : 𝕎 R) (i : ℕ) :
(x * p).coeff (i + 1) = x.coeff i ^ p := by |
rw [← frobenius_verschiebung, coeff_frobenius_charP, verschiebung_coeff_succ]
| 0.71875 |
import Mathlib.MeasureTheory.Measure.MeasureSpace
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
#align_import measure_theory.measure.open_pos from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Topology ENNReal MeasureTheory
open Set Function Filter
namespace MeasureTheory
namespace Measure
section Basic
variable {X Y : Type*} [TopologicalSpace X] {m : MeasurableSpace X} [TopologicalSpace Y]
[T2Space Y] (μ ν : Measure X)
class IsOpenPosMeasure : Prop where
open_pos : ∀ U : Set X, IsOpen U → U.Nonempty → μ U ≠ 0
#align measure_theory.measure.is_open_pos_measure MeasureTheory.Measure.IsOpenPosMeasure
variable [IsOpenPosMeasure μ] {s U F : Set X} {x : X}
theorem _root_.IsOpen.measure_ne_zero (hU : IsOpen U) (hne : U.Nonempty) : μ U ≠ 0 :=
IsOpenPosMeasure.open_pos U hU hne
#align is_open.measure_ne_zero IsOpen.measure_ne_zero
theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < μ U :=
(hU.measure_ne_zero μ hne).bot_lt
#align is_open.measure_pos IsOpen.measure_pos
instance (priority := 100) [Nonempty X] : NeZero μ :=
⟨measure_univ_pos.mp <| isOpen_univ.measure_pos μ univ_nonempty⟩
theorem _root_.IsOpen.measure_pos_iff (hU : IsOpen U) : 0 < μ U ↔ U.Nonempty :=
⟨fun h => nonempty_iff_ne_empty.2 fun he => h.ne' <| he.symm ▸ measure_empty, hU.measure_pos μ⟩
#align is_open.measure_pos_iff IsOpen.measure_pos_iff
theorem _root_.IsOpen.measure_eq_zero_iff (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := by
simpa only [not_lt, nonpos_iff_eq_zero, not_nonempty_iff_eq_empty] using
not_congr (hU.measure_pos_iff μ)
#align is_open.measure_eq_zero_iff IsOpen.measure_eq_zero_iff
theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < μ s :=
(isOpen_interior.measure_pos μ h).trans_le (measure_mono interior_subset)
#align measure_theory.measure.measure_pos_of_nonempty_interior MeasureTheory.Measure.measure_pos_of_nonempty_interior
theorem measure_pos_of_mem_nhds (h : s ∈ 𝓝 x) : 0 < μ s :=
measure_pos_of_nonempty_interior _ ⟨x, mem_interior_iff_mem_nhds.2 h⟩
#align measure_theory.measure.measure_pos_of_mem_nhds MeasureTheory.Measure.measure_pos_of_mem_nhds
theorem isOpenPosMeasure_smul {c : ℝ≥0∞} (h : c ≠ 0) : IsOpenPosMeasure (c • μ) :=
⟨fun _U Uo Une => mul_ne_zero h (Uo.measure_ne_zero μ Une)⟩
#align measure_theory.measure.is_open_pos_measure_smul MeasureTheory.Measure.isOpenPosMeasure_smul
variable {μ ν}
protected theorem AbsolutelyContinuous.isOpenPosMeasure (h : μ ≪ ν) : IsOpenPosMeasure ν :=
⟨fun _U ho hne h₀ => ho.measure_ne_zero μ hne (h h₀)⟩
#align measure_theory.measure.absolutely_continuous.is_open_pos_measure MeasureTheory.Measure.AbsolutelyContinuous.isOpenPosMeasure
theorem _root_.LE.le.isOpenPosMeasure (h : μ ≤ ν) : IsOpenPosMeasure ν :=
h.absolutelyContinuous.isOpenPosMeasure
#align has_le.le.is_open_pos_measure LE.le.isOpenPosMeasure
theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) :
μ U = 0 ↔ U = ∅ :=
⟨fun h ↦ (hU.measure_eq_zero_iff μ).mp h, fun h ↦ by simp [h]⟩
theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) :
U =ᵐ[μ] (∅ : Set X) ↔ U = ∅ := by
rw [ae_eq_empty, hU.measure_zero_iff_eq_empty]
theorem _root_.IsOpen.eq_empty_of_measure_zero (hU : IsOpen U) (h₀ : μ U = 0) : U = ∅ :=
(hU.measure_eq_zero_iff μ).mp h₀
#align is_open.eq_empty_of_measure_zero IsOpen.eq_empty_of_measure_zero
theorem _root_.IsClosed.ae_eq_univ_iff_eq (hF : IsClosed F) :
F =ᵐ[μ] univ ↔ F = univ := by
refine ⟨fun h ↦ ?_, fun h ↦ by rw [h]⟩
rwa [ae_eq_univ, hF.isOpen_compl.measure_eq_zero_iff μ, compl_empty_iff] at h
| Mathlib/MeasureTheory/Measure/OpenPos.lean | 102 | 105 | theorem _root_.IsClosed.measure_eq_univ_iff_eq [OpensMeasurableSpace X] [IsFiniteMeasure μ]
(hF : IsClosed F) :
μ F = μ univ ↔ F = univ := by |
rw [← ae_eq_univ_iff_measure_eq hF.measurableSet.nullMeasurableSet, hF.ae_eq_univ_iff_eq]
| 0.71875 |
import Mathlib.LinearAlgebra.Matrix.Symmetric
import Mathlib.LinearAlgebra.Matrix.Orthogonal
import Mathlib.Data.Matrix.Kronecker
#align_import linear_algebra.matrix.is_diag from "leanprover-community/mathlib"@"55e2dfde0cff928ce5c70926a3f2c7dee3e2dd99"
namespace Matrix
variable {α β R n m : Type*}
open Function
open Matrix Kronecker
def IsDiag [Zero α] (A : Matrix n n α) : Prop :=
Pairwise fun i j => A i j = 0
#align matrix.is_diag Matrix.IsDiag
@[simp]
theorem isDiag_diagonal [Zero α] [DecidableEq n] (d : n → α) : (diagonal d).IsDiag := fun _ _ =>
Matrix.diagonal_apply_ne _
#align matrix.is_diag_diagonal Matrix.isDiag_diagonal
theorem IsDiag.diagonal_diag [Zero α] [DecidableEq n] {A : Matrix n n α} (h : A.IsDiag) :
diagonal (diag A) = A :=
ext fun i j => by
obtain rfl | hij := Decidable.eq_or_ne i j
· rw [diagonal_apply_eq, diag]
· rw [diagonal_apply_ne _ hij, h hij]
#align matrix.is_diag.diagonal_diag Matrix.IsDiag.diagonal_diag
theorem isDiag_iff_diagonal_diag [Zero α] [DecidableEq n] (A : Matrix n n α) :
A.IsDiag ↔ diagonal (diag A) = A :=
⟨IsDiag.diagonal_diag, fun hd => hd ▸ isDiag_diagonal (diag A)⟩
#align matrix.is_diag_iff_diagonal_diag Matrix.isDiag_iff_diagonal_diag
theorem isDiag_of_subsingleton [Zero α] [Subsingleton n] (A : Matrix n n α) : A.IsDiag :=
fun i j h => (h <| Subsingleton.elim i j).elim
#align matrix.is_diag_of_subsingleton Matrix.isDiag_of_subsingleton
@[simp]
theorem isDiag_zero [Zero α] : (0 : Matrix n n α).IsDiag := fun _ _ _ => rfl
#align matrix.is_diag_zero Matrix.isDiag_zero
@[simp]
theorem isDiag_one [DecidableEq n] [Zero α] [One α] : (1 : Matrix n n α).IsDiag := fun _ _ =>
one_apply_ne
#align matrix.is_diag_one Matrix.isDiag_one
| Mathlib/LinearAlgebra/Matrix/IsDiag.lean | 76 | 79 | theorem IsDiag.map [Zero α] [Zero β] {A : Matrix n n α} (ha : A.IsDiag) {f : α → β} (hf : f 0 = 0) :
(A.map f).IsDiag := by |
intro i j h
simp [ha h, hf]
| 0.71875 |
import Mathlib.Data.Nat.Bits
import Mathlib.Data.Nat.Pairing
#align_import logic.equiv.nat from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open Nat Function
namespace Equiv
variable {α : Type*}
@[simps]
def boolProdNatEquivNat : Bool × ℕ ≃ ℕ where
toFun := uncurry bit
invFun := boddDiv2
left_inv := fun ⟨b, n⟩ => by simp only [bodd_bit, div2_bit, uncurry_apply_pair, boddDiv2_eq]
right_inv n := by simp only [bit_decomp, boddDiv2_eq, uncurry_apply_pair]
#align equiv.bool_prod_nat_equiv_nat Equiv.boolProdNatEquivNat
#align equiv.bool_prod_nat_equiv_nat_symm_apply Equiv.boolProdNatEquivNat_symm_apply
#align equiv.bool_prod_nat_equiv_nat_apply Equiv.boolProdNatEquivNat_apply
@[simps! symm_apply]
def natSumNatEquivNat : ℕ ⊕ ℕ ≃ ℕ :=
(boolProdEquivSum ℕ).symm.trans boolProdNatEquivNat
#align equiv.nat_sum_nat_equiv_nat Equiv.natSumNatEquivNat
#align equiv.nat_sum_nat_equiv_nat_symm_apply Equiv.natSumNatEquivNat_symm_apply
set_option linter.deprecated false in
@[simp]
| Mathlib/Logic/Equiv/Nat.lean | 48 | 49 | theorem natSumNatEquivNat_apply : ⇑natSumNatEquivNat = Sum.elim bit0 bit1 := by |
ext (x | x) <;> rfl
| 0.71875 |
import Mathlib.RingTheory.Polynomial.Basic
import Mathlib.RingTheory.Ideal.LocalRing
#align_import data.polynomial.expand from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
universe u v w
open Polynomial
open Finset
namespace Polynomial
section CommSemiring
variable (R : Type u) [CommSemiring R] {S : Type v} [CommSemiring S] (p q : ℕ)
noncomputable def expand : R[X] →ₐ[R] R[X] :=
{ (eval₂RingHom C (X ^ p) : R[X] →+* R[X]) with commutes' := fun _ => eval₂_C _ _ }
#align polynomial.expand Polynomial.expand
theorem coe_expand : (expand R p : R[X] → R[X]) = eval₂ C (X ^ p) :=
rfl
#align polynomial.coe_expand Polynomial.coe_expand
variable {R}
theorem expand_eq_comp_X_pow {f : R[X]} : expand R p f = f.comp (X ^ p) := rfl
theorem expand_eq_sum {f : R[X]} : expand R p f = f.sum fun e a => C a * (X ^ p) ^ e := by
simp [expand, eval₂]
#align polynomial.expand_eq_sum Polynomial.expand_eq_sum
@[simp]
theorem expand_C (r : R) : expand R p (C r) = C r :=
eval₂_C _ _
set_option linter.uppercaseLean3 false in
#align polynomial.expand_C Polynomial.expand_C
@[simp]
theorem expand_X : expand R p X = X ^ p :=
eval₂_X _ _
set_option linter.uppercaseLean3 false in
#align polynomial.expand_X Polynomial.expand_X
@[simp]
theorem expand_monomial (r : R) : expand R p (monomial q r) = monomial (q * p) r := by
simp_rw [← smul_X_eq_monomial, AlgHom.map_smul, AlgHom.map_pow, expand_X, mul_comm, pow_mul]
#align polynomial.expand_monomial Polynomial.expand_monomial
theorem expand_expand (f : R[X]) : expand R p (expand R q f) = expand R (p * q) f :=
Polynomial.induction_on f (fun r => by simp_rw [expand_C])
(fun f g ihf ihg => by simp_rw [AlgHom.map_add, ihf, ihg]) fun n r _ => by
simp_rw [AlgHom.map_mul, expand_C, AlgHom.map_pow, expand_X, AlgHom.map_pow, expand_X, pow_mul]
#align polynomial.expand_expand Polynomial.expand_expand
theorem expand_mul (f : R[X]) : expand R (p * q) f = expand R p (expand R q f) :=
(expand_expand p q f).symm
#align polynomial.expand_mul Polynomial.expand_mul
@[simp]
| Mathlib/Algebra/Polynomial/Expand.lean | 80 | 80 | theorem expand_zero (f : R[X]) : expand R 0 f = C (eval 1 f) := by | simp [expand]
| 0.71875 |
import Mathlib.Algebra.GCDMonoid.Basic
import Mathlib.Data.Multiset.FinsetOps
import Mathlib.Data.Multiset.Fold
#align_import algebra.gcd_monoid.multiset from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
namespace Multiset
variable {α : Type*} [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α]
section gcd
def gcd (s : Multiset α) : α :=
s.fold GCDMonoid.gcd 0
#align multiset.gcd Multiset.gcd
@[simp]
theorem gcd_zero : (0 : Multiset α).gcd = 0 :=
fold_zero _ _
#align multiset.gcd_zero Multiset.gcd_zero
@[simp]
theorem gcd_cons (a : α) (s : Multiset α) : (a ::ₘ s).gcd = GCDMonoid.gcd a s.gcd :=
fold_cons_left _ _ _ _
#align multiset.gcd_cons Multiset.gcd_cons
@[simp]
theorem gcd_singleton {a : α} : ({a} : Multiset α).gcd = normalize a :=
(fold_singleton _ _ _).trans <| gcd_zero_right _
#align multiset.gcd_singleton Multiset.gcd_singleton
@[simp]
theorem gcd_add (s₁ s₂ : Multiset α) : (s₁ + s₂).gcd = GCDMonoid.gcd s₁.gcd s₂.gcd :=
Eq.trans (by simp [gcd]) (fold_add _ _ _ _ _)
#align multiset.gcd_add Multiset.gcd_add
theorem dvd_gcd {s : Multiset α} {a : α} : a ∣ s.gcd ↔ ∀ b ∈ s, a ∣ b :=
Multiset.induction_on s (by simp)
(by simp (config := { contextual := true }) [or_imp, forall_and, dvd_gcd_iff])
#align multiset.dvd_gcd Multiset.dvd_gcd
theorem gcd_dvd {s : Multiset α} {a : α} (h : a ∈ s) : s.gcd ∣ a :=
dvd_gcd.1 dvd_rfl _ h
#align multiset.gcd_dvd Multiset.gcd_dvd
theorem gcd_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₂.gcd ∣ s₁.gcd :=
dvd_gcd.2 fun _ hb ↦ gcd_dvd (h hb)
#align multiset.gcd_mono Multiset.gcd_mono
@[simp 1100]
theorem normalize_gcd (s : Multiset α) : normalize s.gcd = s.gcd :=
Multiset.induction_on s (by simp) fun a s _ ↦ by simp
#align multiset.normalize_gcd Multiset.normalize_gcd
theorem gcd_eq_zero_iff (s : Multiset α) : s.gcd = 0 ↔ ∀ x : α, x ∈ s → x = 0 := by
constructor
· intro h x hx
apply eq_zero_of_zero_dvd
rw [← h]
apply gcd_dvd hx
· refine s.induction_on ?_ ?_
· simp
intro a s sgcd h
simp [h a (mem_cons_self a s), sgcd fun x hx ↦ h x (mem_cons_of_mem hx)]
#align multiset.gcd_eq_zero_iff Multiset.gcd_eq_zero_iff
theorem gcd_map_mul (a : α) (s : Multiset α) : (s.map (a * ·)).gcd = normalize a * s.gcd := by
refine s.induction_on ?_ fun b s ih ↦ ?_
· simp_rw [map_zero, gcd_zero, mul_zero]
· simp_rw [map_cons, gcd_cons, ← gcd_mul_left]
rw [ih]
apply ((normalize_associated a).mul_right _).gcd_eq_right
#align multiset.gcd_map_mul Multiset.gcd_map_mul
section
variable [DecidableEq α]
@[simp]
theorem gcd_dedup (s : Multiset α) : (dedup s).gcd = s.gcd :=
Multiset.induction_on s (by simp) fun a s IH ↦ by
by_cases h : a ∈ s <;> simp [IH, h]
unfold gcd
rw [← cons_erase h, fold_cons_left, ← gcd_assoc, gcd_same]
apply (associated_normalize _).gcd_eq_left
#align multiset.gcd_dedup Multiset.gcd_dedup
@[simp]
theorem gcd_ndunion (s₁ s₂ : Multiset α) : (ndunion s₁ s₂).gcd = GCDMonoid.gcd s₁.gcd s₂.gcd := by
rw [← gcd_dedup, dedup_ext.2, gcd_dedup, gcd_add]
simp
#align multiset.gcd_ndunion Multiset.gcd_ndunion
@[simp]
theorem gcd_union (s₁ s₂ : Multiset α) : (s₁ ∪ s₂).gcd = GCDMonoid.gcd s₁.gcd s₂.gcd := by
rw [← gcd_dedup, dedup_ext.2, gcd_dedup, gcd_add]
simp
#align multiset.gcd_union Multiset.gcd_union
@[simp]
| Mathlib/Algebra/GCDMonoid/Multiset.lean | 219 | 221 | theorem gcd_ndinsert (a : α) (s : Multiset α) : (ndinsert a s).gcd = GCDMonoid.gcd a s.gcd := by |
rw [← gcd_dedup, dedup_ext.2, gcd_dedup, gcd_cons]
simp
| 0.71875 |
import Mathlib.Analysis.Calculus.Deriv.Slope
import Mathlib.Analysis.Calculus.Deriv.Inv
#align_import analysis.calculus.dslope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open scoped Classical Topology Filter
open Function Set Filter
variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
noncomputable def dslope (f : 𝕜 → E) (a : 𝕜) : 𝕜 → E :=
update (slope f a) a (deriv f a)
#align dslope dslope
@[simp]
theorem dslope_same (f : 𝕜 → E) (a : 𝕜) : dslope f a a = deriv f a :=
update_same _ _ _
#align dslope_same dslope_same
variable {f : 𝕜 → E} {a b : 𝕜} {s : Set 𝕜}
theorem dslope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a b = slope f a b :=
update_noteq h _ _
#align dslope_of_ne dslope_of_ne
theorem ContinuousLinearMap.dslope_comp {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
(f : E →L[𝕜] F) (g : 𝕜 → E) (a b : 𝕜) (H : a = b → DifferentiableAt 𝕜 g a) :
dslope (f ∘ g) a b = f (dslope g a b) := by
rcases eq_or_ne b a with (rfl | hne)
· simp only [dslope_same]
exact (f.hasFDerivAt.comp_hasDerivAt b (H rfl).hasDerivAt).deriv
· simpa only [dslope_of_ne _ hne] using f.toLinearMap.slope_comp g a b
#align continuous_linear_map.dslope_comp ContinuousLinearMap.dslope_comp
theorem eqOn_dslope_slope (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope f a) (slope f a) {a}ᶜ := fun _ =>
dslope_of_ne f
#align eq_on_dslope_slope eqOn_dslope_slope
theorem dslope_eventuallyEq_slope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a =ᶠ[𝓝 b] slope f a :=
(eqOn_dslope_slope f a).eventuallyEq_of_mem (isOpen_ne.mem_nhds h)
#align dslope_eventually_eq_slope_of_ne dslope_eventuallyEq_slope_of_ne
theorem dslope_eventuallyEq_slope_punctured_nhds (f : 𝕜 → E) : dslope f a =ᶠ[𝓝[≠] a] slope f a :=
(eqOn_dslope_slope f a).eventuallyEq_of_mem self_mem_nhdsWithin
#align dslope_eventually_eq_slope_punctured_nhds dslope_eventuallyEq_slope_punctured_nhds
@[simp]
theorem sub_smul_dslope (f : 𝕜 → E) (a b : 𝕜) : (b - a) • dslope f a b = f b - f a := by
rcases eq_or_ne b a with (rfl | hne) <;> simp [dslope_of_ne, *]
#align sub_smul_dslope sub_smul_dslope
| Mathlib/Analysis/Calculus/Dslope.lean | 72 | 74 | theorem dslope_sub_smul_of_ne (f : 𝕜 → E) (h : b ≠ a) :
dslope (fun x => (x - a) • f x) a b = f b := by |
rw [dslope_of_ne _ h, slope_sub_smul _ h.symm]
| 0.71875 |
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Inhabit
#align_import data.prod.basic from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
@[simp]
theorem Prod.map_apply (f : α → γ) (g : β → δ) (p : α × β) : Prod.map f g p = (f p.1, g p.2) := rfl
#align prod_map Prod.map_apply
@[deprecated (since := "2024-05-08")] alias Prod_map := Prod.map_apply
namespace Prod
@[simp]
theorem mk.eta : ∀ {p : α × β}, (p.1, p.2) = p
| (_, _) => rfl
@[simp]
theorem «forall» {p : α × β → Prop} : (∀ x, p x) ↔ ∀ a b, p (a, b) :=
⟨fun h a b ↦ h (a, b), fun h ⟨a, b⟩ ↦ h a b⟩
#align prod.forall Prod.forall
@[simp]
theorem «exists» {p : α × β → Prop} : (∃ x, p x) ↔ ∃ a b, p (a, b) :=
⟨fun ⟨⟨a, b⟩, h⟩ ↦ ⟨a, b, h⟩, fun ⟨a, b, h⟩ ↦ ⟨⟨a, b⟩, h⟩⟩
#align prod.exists Prod.exists
theorem forall' {p : α → β → Prop} : (∀ x : α × β, p x.1 x.2) ↔ ∀ a b, p a b :=
Prod.forall
#align prod.forall' Prod.forall'
theorem exists' {p : α → β → Prop} : (∃ x : α × β, p x.1 x.2) ↔ ∃ a b, p a b :=
Prod.exists
#align prod.exists' Prod.exists'
@[simp]
theorem snd_comp_mk (x : α) : Prod.snd ∘ (Prod.mk x : β → α × β) = id :=
rfl
#align prod.snd_comp_mk Prod.snd_comp_mk
@[simp]
theorem fst_comp_mk (x : α) : Prod.fst ∘ (Prod.mk x : β → α × β) = Function.const β x :=
rfl
#align prod.fst_comp_mk Prod.fst_comp_mk
@[simp, mfld_simps]
theorem map_mk (f : α → γ) (g : β → δ) (a : α) (b : β) : map f g (a, b) = (f a, g b) :=
rfl
#align prod.map_mk Prod.map_mk
theorem map_fst (f : α → γ) (g : β → δ) (p : α × β) : (map f g p).1 = f p.1 :=
rfl
#align prod.map_fst Prod.map_fst
theorem map_snd (f : α → γ) (g : β → δ) (p : α × β) : (map f g p).2 = g p.2 :=
rfl
#align prod.map_snd Prod.map_snd
theorem map_fst' (f : α → γ) (g : β → δ) : Prod.fst ∘ map f g = f ∘ Prod.fst :=
funext <| map_fst f g
#align prod.map_fst' Prod.map_fst'
theorem map_snd' (f : α → γ) (g : β → δ) : Prod.snd ∘ map f g = g ∘ Prod.snd :=
funext <| map_snd f g
#align prod.map_snd' Prod.map_snd'
theorem map_comp_map {ε ζ : Type*} (f : α → β) (f' : γ → δ) (g : β → ε) (g' : δ → ζ) :
Prod.map g g' ∘ Prod.map f f' = Prod.map (g ∘ f) (g' ∘ f') :=
rfl
#align prod.map_comp_map Prod.map_comp_map
theorem map_map {ε ζ : Type*} (f : α → β) (f' : γ → δ) (g : β → ε) (g' : δ → ζ) (x : α × γ) :
Prod.map g g' (Prod.map f f' x) = Prod.map (g ∘ f) (g' ∘ f') x :=
rfl
#align prod.map_map Prod.map_map
-- Porting note: mathlib3 proof uses `by cc` for the mpr direction
-- Porting note: `@[simp]` tag removed because auto-generated `mk.injEq` simplifies LHS
-- @[simp]
theorem mk.inj_iff {a₁ a₂ : α} {b₁ b₂ : β} : (a₁, b₁) = (a₂, b₂) ↔ a₁ = a₂ ∧ b₁ = b₂ :=
Iff.of_eq (mk.injEq _ _ _ _)
#align prod.mk.inj_iff Prod.mk.inj_iff
theorem mk.inj_left {α β : Type*} (a : α) : Function.Injective (Prod.mk a : β → α × β) := by
intro b₁ b₂ h
simpa only [true_and, Prod.mk.inj_iff, eq_self_iff_true] using h
#align prod.mk.inj_left Prod.mk.inj_left
theorem mk.inj_right {α β : Type*} (b : β) :
Function.Injective (fun a ↦ Prod.mk a b : α → α × β) := by
intro b₁ b₂ h
simpa only [and_true, eq_self_iff_true, mk.inj_iff] using h
#align prod.mk.inj_right Prod.mk.inj_right
lemma mk_inj_left {a : α} {b₁ b₂ : β} : (a, b₁) = (a, b₂) ↔ b₁ = b₂ := (mk.inj_left _).eq_iff
#align prod.mk_inj_left Prod.mk_inj_left
lemma mk_inj_right {a₁ a₂ : α} {b : β} : (a₁, b) = (a₂, b) ↔ a₁ = a₂ := (mk.inj_right _).eq_iff
#align prod.mk_inj_right Prod.mk_inj_right
| Mathlib/Data/Prod/Basic.lean | 122 | 123 | theorem ext_iff {p q : α × β} : p = q ↔ p.1 = q.1 ∧ p.2 = q.2 := by |
rw [mk.inj_iff]
| 0.71875 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : ℕ)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 84 | 85 | theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by |
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
| 0.71875 |
import Mathlib.Data.List.Nodup
#align_import data.list.duplicate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {α : Type*}
namespace List
inductive Duplicate (x : α) : List α → Prop
| cons_mem {l : List α} : x ∈ l → Duplicate x (x :: l)
| cons_duplicate {y : α} {l : List α} : Duplicate x l → Duplicate x (y :: l)
#align list.duplicate List.Duplicate
local infixl:50 " ∈+ " => List.Duplicate
variable {l : List α} {x : α}
theorem Mem.duplicate_cons_self (h : x ∈ l) : x ∈+ x :: l :=
Duplicate.cons_mem h
#align list.mem.duplicate_cons_self List.Mem.duplicate_cons_self
theorem Duplicate.duplicate_cons (h : x ∈+ l) (y : α) : x ∈+ y :: l :=
Duplicate.cons_duplicate h
#align list.duplicate.duplicate_cons List.Duplicate.duplicate_cons
theorem Duplicate.mem (h : x ∈+ l) : x ∈ l := by
induction' h with l' _ y l' _ hm
· exact mem_cons_self _ _
· exact mem_cons_of_mem _ hm
#align list.duplicate.mem List.Duplicate.mem
| Mathlib/Data/List/Duplicate.lean | 52 | 55 | theorem Duplicate.mem_cons_self (h : x ∈+ x :: l) : x ∈ l := by |
cases' h with _ h _ _ h
· exact h
· exact h.mem
| 0.71875 |
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Order.Filter.Subsingleton
open Set
variable {α β γ δ : Type*} {l : Filter α} {f : α → β}
namespace Filter
def EventuallyConst (f : α → β) (l : Filter α) : Prop := (map f l).Subsingleton
theorem HasBasis.eventuallyConst_iff {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
(h : l.HasBasis p s) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ x ∈ s i, ∀ y ∈ s i, f x = f y :=
(h.map f).subsingleton_iff.trans <| by simp only [Set.Subsingleton, forall_mem_image]
theorem HasBasis.eventuallyConst_iff' {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
{x : ι → α} (h : l.HasBasis p s) (hx : ∀ i, p i → x i ∈ s i) :
EventuallyConst f l ↔ ∃ i, p i ∧ ∀ y ∈ s i, f y = f (x i) :=
h.eventuallyConst_iff.trans <| exists_congr fun i ↦ and_congr_right fun hi ↦
⟨fun h ↦ (h · · (x i) (hx i hi)), fun h a ha b hb ↦ h a ha ▸ (h b hb).symm⟩
lemma eventuallyConst_iff_tendsto [Nonempty β] :
EventuallyConst f l ↔ ∃ x, Tendsto f l (pure x) :=
subsingleton_iff_exists_le_pure
alias ⟨EventuallyConst.exists_tendsto, _⟩ := eventuallyConst_iff_tendsto
theorem EventuallyConst.of_tendsto {x : β} (h : Tendsto f l (pure x)) : EventuallyConst f l :=
have : Nonempty β := ⟨x⟩; eventuallyConst_iff_tendsto.2 ⟨x, h⟩
theorem eventuallyConst_iff_exists_eventuallyEq [Nonempty β] :
EventuallyConst f l ↔ ∃ c, f =ᶠ[l] fun _ ↦ c :=
subsingleton_iff_exists_singleton_mem
alias ⟨EventuallyConst.eventuallyEq_const, _⟩ := eventuallyConst_iff_exists_eventuallyEq
theorem eventuallyConst_pred' {p : α → Prop} :
EventuallyConst p l ↔ (p =ᶠ[l] fun _ ↦ False) ∨ (p =ᶠ[l] fun _ ↦ True) := by
simp only [eventuallyConst_iff_exists_eventuallyEq, Prop.exists_iff]
theorem eventuallyConst_pred {p : α → Prop} :
EventuallyConst p l ↔ (∀ᶠ x in l, p x) ∨ (∀ᶠ x in l, ¬p x) := by
simp [eventuallyConst_pred', or_comm, EventuallyEq]
theorem eventuallyConst_set' {s : Set α} :
EventuallyConst s l ↔ (s =ᶠ[l] (∅ : Set α)) ∨ s =ᶠ[l] univ :=
eventuallyConst_pred'
theorem eventuallyConst_set {s : Set α} :
EventuallyConst s l ↔ (∀ᶠ x in l, x ∈ s) ∨ (∀ᶠ x in l, x ∉ s) :=
eventuallyConst_pred
theorem EventuallyEq.eventuallyConst_iff {g : α → β} (h : f =ᶠ[l] g) :
EventuallyConst f l ↔ EventuallyConst g l := by
simp only [EventuallyConst, map_congr h]
@[simp] theorem eventuallyConst_id : EventuallyConst id l ↔ l.Subsingleton := Iff.rfl
namespace EventuallyConst
@[simp] protected lemma bot : EventuallyConst f ⊥ := subsingleton_bot
@[simp]
protected lemma const (c : β) : EventuallyConst (fun _ ↦ c) l :=
.of_tendsto tendsto_const_pure
protected lemma congr {g} (h : EventuallyConst f l) (hg : f =ᶠ[l] g) : EventuallyConst g l :=
hg.eventuallyConst_iff.1 h
@[nontriviality]
lemma of_subsingleton_right [Subsingleton β] : EventuallyConst f l := .of_subsingleton
nonrec lemma anti {l'} (h : EventuallyConst f l) (hl' : l' ≤ l) : EventuallyConst f l' :=
h.anti (map_mono hl')
@[nontriviality]
lemma of_subsingleton_left [Subsingleton α] : EventuallyConst f l :=
.map .of_subsingleton f
lemma comp (h : EventuallyConst f l) (g : β → γ) : EventuallyConst (g ∘ f) l := h.map g
@[to_additive]
protected lemma inv [Inv β] (h : EventuallyConst f l) : EventuallyConst (f⁻¹) l := h.comp Inv.inv
lemma comp_tendsto {lb : Filter β} {g : β → γ} (hg : EventuallyConst g lb)
(hf : Tendsto f l lb) : EventuallyConst (g ∘ f) l :=
hg.anti hf
lemma apply {ι : Type*} {p : ι → Type*} {g : α → ∀ x, p x}
(h : EventuallyConst g l) (i : ι) : EventuallyConst (g · i) l :=
h.comp <| Function.eval i
lemma comp₂ {g : α → γ} (hf : EventuallyConst f l) (op : β → γ → δ) (hg : EventuallyConst g l) :
EventuallyConst (fun x ↦ op (f x) (g x)) l :=
((hf.prod hg).map op.uncurry).anti <|
(tendsto_map (f := op.uncurry)).comp (tendsto_map.prod_mk tendsto_map)
lemma prod_mk {g : α → γ} (hf : EventuallyConst f l) (hg : EventuallyConst g l) :
EventuallyConst (fun x ↦ (f x, g x)) l :=
hf.comp₂ Prod.mk hg
@[to_additive]
lemma mul [Mul β] {g : α → β} (hf : EventuallyConst f l) (hg : EventuallyConst g l) :
EventuallyConst (f * g) l :=
hf.comp₂ (· * ·) hg
variable [One β] {s : Set α} {c : β}
@[to_additive]
lemma of_mulIndicator_const (h : EventuallyConst (s.mulIndicator fun _ ↦ c) l) (hc : c ≠ 1) :
EventuallyConst s l := by
simpa [(· ∘ ·), hc, imp_false] using h.comp (· = c)
@[to_additive]
theorem mulIndicator_const (h : EventuallyConst s l) (c : β) :
EventuallyConst (s.mulIndicator fun _ ↦ c) l := by
classical exact h.comp (if · then c else 1)
@[to_additive]
theorem mulIndicator_const_iff_of_ne (hc : c ≠ 1) :
EventuallyConst (s.mulIndicator fun _ ↦ c) l ↔ EventuallyConst s l :=
⟨(of_mulIndicator_const · hc), (mulIndicator_const · c)⟩
@[to_additive (attr := simp)]
| Mathlib/Order/Filter/EventuallyConst.lean | 145 | 147 | theorem mulIndicator_const_iff :
EventuallyConst (s.mulIndicator fun _ ↦ c) l ↔ c = 1 ∨ EventuallyConst s l := by |
rcases eq_or_ne c 1 with rfl | hc <;> simp [mulIndicator_const_iff_of_ne, *]
| 0.71875 |
import Mathlib.Topology.MetricSpace.PseudoMetric
#align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
open Set Filter Bornology
open scoped NNReal Uniformity
universe u v w
variable {α : Type u} {β : Type v} {X ι : Type*}
variable [PseudoMetricSpace α]
class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where
eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y
#align metric_space MetricSpace
@[ext]
theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) :
m = m' := by
cases m; cases m'; congr; ext1; assumption
#align metric_space.ext MetricSpace.ext
def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ)
(dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x)
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
(H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s)
(eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α :=
{ PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with
eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ }
#align metric_space.of_dist_topology MetricSpace.ofDistTopology
variable {γ : Type w} [MetricSpace γ]
theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y :=
MetricSpace.eq_of_dist_eq_zero
#align eq_of_dist_eq_zero eq_of_dist_eq_zero
@[simp]
theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y :=
Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _
#align dist_eq_zero dist_eq_zero
@[simp]
theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero]
#align zero_eq_dist zero_eq_dist
theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by
simpa only [not_iff_not] using dist_eq_zero
#align dist_ne_zero dist_ne_zero
@[simp]
theorem dist_le_zero {x y : γ} : dist x y ≤ 0 ↔ x = y := by
simpa [le_antisymm_iff, dist_nonneg] using @dist_eq_zero _ _ x y
#align dist_le_zero dist_le_zero
@[simp]
| Mathlib/Topology/MetricSpace/Basic.lean | 87 | 88 | theorem dist_pos {x y : γ} : 0 < dist x y ↔ x ≠ y := by |
simpa only [not_le] using not_congr dist_le_zero
| 0.71875 |
import Mathlib.Geometry.Manifold.ContMDiff.Product
import Mathlib.Analysis.NormedSpace.OperatorNorm.Prod
open Set ChartedSpace SmoothManifoldWithCorners
open scoped Topology Manifold
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
-- declare a smooth manifold `M` over the pair `(E, H)`.
{E : Type*}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H} {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
[SmoothManifoldWithCorners I M]
-- declare a smooth manifold `M'` over the pair `(E', H')`.
{E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M']
-- declare a smooth manifold `N` over the pair `(F, G)`.
{F : Type*}
[NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*} [TopologicalSpace G]
{J : ModelWithCorners 𝕜 F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N]
[SmoothManifoldWithCorners J N]
-- declare a smooth manifold `N'` over the pair `(F', G')`.
{F' : Type*}
[NormedAddCommGroup F'] [NormedSpace 𝕜 F'] {G' : Type*} [TopologicalSpace G']
{J' : ModelWithCorners 𝕜 F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N']
[SmoothManifoldWithCorners J' N']
-- F₁, F₂, F₃, F₄ are normed spaces
{F₁ : Type*} [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type*} [NormedAddCommGroup F₂]
[NormedSpace 𝕜 F₂] {F₃ : Type*} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type*}
[NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄]
-- declare functions, sets, points and smoothness indices
{f f₁ : M → M'} {s t : Set M} {x : M} {m n : ℕ∞}
section Module
theorem contMDiffWithinAt_iff_contDiffWithinAt {f : E → E'} {s : Set E} {x : E} :
ContMDiffWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') n f s x ↔ ContDiffWithinAt 𝕜 n f s x := by
simp (config := { contextual := true }) only [ContMDiffWithinAt, liftPropWithinAt_iff',
ContDiffWithinAtProp, iff_def, mfld_simps]
exact ContDiffWithinAt.continuousWithinAt
#align cont_mdiff_within_at_iff_cont_diff_within_at contMDiffWithinAt_iff_contDiffWithinAt
alias ⟨ContMDiffWithinAt.contDiffWithinAt, ContDiffWithinAt.contMDiffWithinAt⟩ :=
contMDiffWithinAt_iff_contDiffWithinAt
#align cont_mdiff_within_at.cont_diff_within_at ContMDiffWithinAt.contDiffWithinAt
#align cont_diff_within_at.cont_mdiff_within_at ContDiffWithinAt.contMDiffWithinAt
theorem contMDiffAt_iff_contDiffAt {f : E → E'} {x : E} :
ContMDiffAt 𝓘(𝕜, E) 𝓘(𝕜, E') n f x ↔ ContDiffAt 𝕜 n f x := by
rw [← contMDiffWithinAt_univ, contMDiffWithinAt_iff_contDiffWithinAt, contDiffWithinAt_univ]
#align cont_mdiff_at_iff_cont_diff_at contMDiffAt_iff_contDiffAt
alias ⟨ContMDiffAt.contDiffAt, ContDiffAt.contMDiffAt⟩ := contMDiffAt_iff_contDiffAt
#align cont_mdiff_at.cont_diff_at ContMDiffAt.contDiffAt
#align cont_diff_at.cont_mdiff_at ContDiffAt.contMDiffAt
theorem contMDiffOn_iff_contDiffOn {f : E → E'} {s : Set E} :
ContMDiffOn 𝓘(𝕜, E) 𝓘(𝕜, E') n f s ↔ ContDiffOn 𝕜 n f s :=
forall_congr' <| by simp [contMDiffWithinAt_iff_contDiffWithinAt]
#align cont_mdiff_on_iff_cont_diff_on contMDiffOn_iff_contDiffOn
alias ⟨ContMDiffOn.contDiffOn, ContDiffOn.contMDiffOn⟩ := contMDiffOn_iff_contDiffOn
#align cont_mdiff_on.cont_diff_on ContMDiffOn.contDiffOn
#align cont_diff_on.cont_mdiff_on ContDiffOn.contMDiffOn
| Mathlib/Geometry/Manifold/ContMDiff/NormedSpace.lean | 81 | 82 | theorem contMDiff_iff_contDiff {f : E → E'} : ContMDiff 𝓘(𝕜, E) 𝓘(𝕜, E') n f ↔ ContDiff 𝕜 n f := by |
rw [← contDiffOn_univ, ← contMDiffOn_univ, contMDiffOn_iff_contDiffOn]
| 0.71875 |
import Mathlib.Analysis.Complex.Basic
import Mathlib.Topology.FiberBundle.IsHomeomorphicTrivialBundle
#align_import analysis.complex.re_im_topology from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6"
open Set
noncomputable section
namespace Complex
theorem isHomeomorphicTrivialFiberBundle_re : IsHomeomorphicTrivialFiberBundle ℝ re :=
⟨equivRealProdCLM.toHomeomorph, fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_re Complex.isHomeomorphicTrivialFiberBundle_re
theorem isHomeomorphicTrivialFiberBundle_im : IsHomeomorphicTrivialFiberBundle ℝ im :=
⟨equivRealProdCLM.toHomeomorph.trans (Homeomorph.prodComm ℝ ℝ), fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_im Complex.isHomeomorphicTrivialFiberBundle_im
theorem isOpenMap_re : IsOpenMap re :=
isHomeomorphicTrivialFiberBundle_re.isOpenMap_proj
#align complex.is_open_map_re Complex.isOpenMap_re
theorem isOpenMap_im : IsOpenMap im :=
isHomeomorphicTrivialFiberBundle_im.isOpenMap_proj
#align complex.is_open_map_im Complex.isOpenMap_im
theorem quotientMap_re : QuotientMap re :=
isHomeomorphicTrivialFiberBundle_re.quotientMap_proj
#align complex.quotient_map_re Complex.quotientMap_re
theorem quotientMap_im : QuotientMap im :=
isHomeomorphicTrivialFiberBundle_im.quotientMap_proj
#align complex.quotient_map_im Complex.quotientMap_im
theorem interior_preimage_re (s : Set ℝ) : interior (re ⁻¹' s) = re ⁻¹' interior s :=
(isOpenMap_re.preimage_interior_eq_interior_preimage continuous_re _).symm
#align complex.interior_preimage_re Complex.interior_preimage_re
theorem interior_preimage_im (s : Set ℝ) : interior (im ⁻¹' s) = im ⁻¹' interior s :=
(isOpenMap_im.preimage_interior_eq_interior_preimage continuous_im _).symm
#align complex.interior_preimage_im Complex.interior_preimage_im
theorem closure_preimage_re (s : Set ℝ) : closure (re ⁻¹' s) = re ⁻¹' closure s :=
(isOpenMap_re.preimage_closure_eq_closure_preimage continuous_re _).symm
#align complex.closure_preimage_re Complex.closure_preimage_re
theorem closure_preimage_im (s : Set ℝ) : closure (im ⁻¹' s) = im ⁻¹' closure s :=
(isOpenMap_im.preimage_closure_eq_closure_preimage continuous_im _).symm
#align complex.closure_preimage_im Complex.closure_preimage_im
theorem frontier_preimage_re (s : Set ℝ) : frontier (re ⁻¹' s) = re ⁻¹' frontier s :=
(isOpenMap_re.preimage_frontier_eq_frontier_preimage continuous_re _).symm
#align complex.frontier_preimage_re Complex.frontier_preimage_re
theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' frontier s :=
(isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm
#align complex.frontier_preimage_im Complex.frontier_preimage_im
@[simp]
theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by
simpa only [interior_Iic] using interior_preimage_re (Iic a)
#align complex.interior_set_of_re_le Complex.interior_setOf_re_le
@[simp]
theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by
simpa only [interior_Iic] using interior_preimage_im (Iic a)
#align complex.interior_set_of_im_le Complex.interior_setOf_im_le
@[simp]
theorem interior_setOf_le_re (a : ℝ) : interior { z : ℂ | a ≤ z.re } = { z | a < z.re } := by
simpa only [interior_Ici] using interior_preimage_re (Ici a)
#align complex.interior_set_of_le_re Complex.interior_setOf_le_re
@[simp]
theorem interior_setOf_le_im (a : ℝ) : interior { z : ℂ | a ≤ z.im } = { z | a < z.im } := by
simpa only [interior_Ici] using interior_preimage_im (Ici a)
#align complex.interior_set_of_le_im Complex.interior_setOf_le_im
@[simp]
| Mathlib/Analysis/Complex/ReImTopology.lean | 114 | 115 | theorem closure_setOf_re_lt (a : ℝ) : closure { z : ℂ | z.re < a } = { z | z.re ≤ a } := by |
simpa only [closure_Iio] using closure_preimage_re (Iio a)
| 0.71875 |
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
#align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe"
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor'' (X Y : C) :
(α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor''
@[reassoc]
theorem leftUnitor_tensor' (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y) := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor'
@[reassoc]
theorem leftUnitor_tensor_inv' (X Y : C) :
(λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by coherence
#align category_theory.monoidal_category.left_unitor_tensor_inv CategoryTheory.MonoidalCategory.leftUnitor_tensor_inv'
@[reassoc]
theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by
coherence
#align category_theory.monoidal_category.id_tensor_right_unitor_inv CategoryTheory.MonoidalCategory.id_tensor_rightUnitor_inv
@[reassoc]
theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by
coherence
#align category_theory.monoidal_category.left_unitor_inv_tensor_id CategoryTheory.MonoidalCategory.leftUnitor_inv_tensor_id
@[reassoc]
theorem pentagon_inv_inv_hom (W X Y Z : C) :
(α_ W (X ⊗ Y) Z).inv ≫ ((α_ W X Y).inv ⊗ 𝟙 Z) ≫ (α_ (W ⊗ X) Y Z).hom =
(𝟙 W ⊗ (α_ X Y Z).hom) ≫ (α_ W X (Y ⊗ Z)).inv := by
coherence
#align category_theory.monoidal_category.pentagon_inv_inv_hom CategoryTheory.MonoidalCategory.pentagon_inv_inv_hom
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 63 | 64 | theorem unitors_equal : (λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom := by |
coherence
| 0.71875 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Order.WithBot
#align_import data.set.image from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29"
universe u v
open Function Set
namespace Set
variable {α β γ : Type*} {ι ι' : Sort*}
section Image
variable {f : α → β} {s t : Set α}
-- Porting note: `Set.image` is already defined in `Init.Set`
#align set.image Set.image
@[deprecated mem_image (since := "2024-03-23")]
theorem mem_image_iff_bex {f : α → β} {s : Set α} {y : β} :
y ∈ f '' s ↔ ∃ (x : _) (_ : x ∈ s), f x = y :=
bex_def.symm
#align set.mem_image_iff_bex Set.mem_image_iff_bex
theorem image_eta (f : α → β) : f '' s = (fun x => f x) '' s :=
rfl
#align set.image_eta Set.image_eta
theorem _root_.Function.Injective.mem_set_image {f : α → β} (hf : Injective f) {s : Set α} {a : α} :
f a ∈ f '' s ↔ a ∈ s :=
⟨fun ⟨_, hb, Eq⟩ => hf Eq ▸ hb, mem_image_of_mem f⟩
#align function.injective.mem_set_image Function.Injective.mem_set_image
theorem forall_mem_image {f : α → β} {s : Set α} {p : β → Prop} :
(∀ y ∈ f '' s, p y) ↔ ∀ ⦃x⦄, x ∈ s → p (f x) := by simp
#align set.ball_image_iff Set.forall_mem_image
theorem exists_mem_image {f : α → β} {s : Set α} {p : β → Prop} :
(∃ y ∈ f '' s, p y) ↔ ∃ x ∈ s, p (f x) := by simp
#align set.bex_image_iff Set.exists_mem_image
@[deprecated (since := "2024-02-21")] alias ball_image_iff := forall_mem_image
@[deprecated (since := "2024-02-21")] alias bex_image_iff := exists_mem_image
@[deprecated (since := "2024-02-21")] alias ⟨_, ball_image_of_ball⟩ := forall_mem_image
#align set.ball_image_of_ball Set.ball_image_of_ball
@[deprecated forall_mem_image (since := "2024-02-21")]
theorem mem_image_elim {f : α → β} {s : Set α} {C : β → Prop} (h : ∀ x : α, x ∈ s → C (f x)) :
∀ {y : β}, y ∈ f '' s → C y := forall_mem_image.2 h _
#align set.mem_image_elim Set.mem_image_elim
@[deprecated forall_mem_image (since := "2024-02-21")]
theorem mem_image_elim_on {f : α → β} {s : Set α} {C : β → Prop} {y : β} (h_y : y ∈ f '' s)
(h : ∀ x : α, x ∈ s → C (f x)) : C y := forall_mem_image.2 h _ h_y
#align set.mem_image_elim_on Set.mem_image_elim_on
-- Porting note: used to be `safe`
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
ext x
exact exists_congr fun a ↦ and_congr_right fun ha ↦ by rw [h a ha]
#align set.image_congr Set.image_congr
theorem image_congr' {f g : α → β} {s : Set α} (h : ∀ x : α, f x = g x) : f '' s = g '' s :=
image_congr fun x _ => h x
#align set.image_congr' Set.image_congr'
@[gcongr]
lemma image_mono (h : s ⊆ t) : f '' s ⊆ f '' t := by
rintro - ⟨a, ha, rfl⟩; exact mem_image_of_mem f (h ha)
| Mathlib/Data/Set/Image.lean | 263 | 263 | theorem image_comp (f : β → γ) (g : α → β) (a : Set α) : f ∘ g '' a = f '' (g '' a) := by | aesop
| 0.71875 |
import Mathlib.Analysis.SpecialFunctions.Exp
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Analysis.NormedSpace.Real
#align_import analysis.special_functions.log.basic from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def log (x : ℝ) : ℝ :=
if hx : x = 0 then 0 else expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩
#align real.log Real.log
theorem log_of_ne_zero (hx : x ≠ 0) : log x = expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ :=
dif_neg hx
#align real.log_of_ne_zero Real.log_of_ne_zero
theorem log_of_pos (hx : 0 < x) : log x = expOrderIso.symm ⟨x, hx⟩ := by
rw [log_of_ne_zero hx.ne']
congr
exact abs_of_pos hx
#align real.log_of_pos Real.log_of_pos
theorem exp_log_eq_abs (hx : x ≠ 0) : exp (log x) = |x| := by
rw [log_of_ne_zero hx, ← coe_expOrderIso_apply, OrderIso.apply_symm_apply, Subtype.coe_mk]
#align real.exp_log_eq_abs Real.exp_log_eq_abs
| Mathlib/Analysis/SpecialFunctions/Log/Basic.lean | 59 | 61 | theorem exp_log (hx : 0 < x) : exp (log x) = x := by |
rw [exp_log_eq_abs hx.ne']
exact abs_of_pos hx
| 0.71875 |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Fin
import Mathlib.GroupTheory.GroupAction.Pi
import Mathlib.Logic.Equiv.Fin
#align_import algebra.big_operators.fin from "leanprover-community/mathlib"@"cc5dd6244981976cc9da7afc4eee5682b037a013"
open Finset
variable {α : Type*} {β : Type*}
namespace Fin
@[to_additive]
theorem prod_ofFn [CommMonoid β] {n : ℕ} (f : Fin n → β) : (List.ofFn f).prod = ∏ i, f i := by
simp [prod_eq_multiset_prod]
#align fin.prod_of_fn Fin.prod_ofFn
#align fin.sum_of_fn Fin.sum_ofFn
@[to_additive]
theorem prod_univ_def [CommMonoid β] {n : ℕ} (f : Fin n → β) :
∏ i, f i = ((List.finRange n).map f).prod := by
rw [← List.ofFn_eq_map, prod_ofFn]
#align fin.prod_univ_def Fin.prod_univ_def
#align fin.sum_univ_def Fin.sum_univ_def
@[to_additive "A sum of a function `f : Fin 0 → β` is `0` because `Fin 0` is empty"]
theorem prod_univ_zero [CommMonoid β] (f : Fin 0 → β) : ∏ i, f i = 1 :=
rfl
#align fin.prod_univ_zero Fin.prod_univ_zero
#align fin.sum_univ_zero Fin.sum_univ_zero
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f x`, for some `x : Fin (n + 1)` plus the remaining product"]
theorem prod_univ_succAbove [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) (x : Fin (n + 1)) :
∏ i, f i = f x * ∏ i : Fin n, f (x.succAbove i) := by
rw [univ_succAbove, prod_cons, Finset.prod_map _ x.succAboveEmb]
rfl
#align fin.prod_univ_succ_above Fin.prod_univ_succAbove
#align fin.sum_univ_succ_above Fin.sum_univ_succAbove
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f 0` plus the remaining product"]
theorem prod_univ_succ [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) :
∏ i, f i = f 0 * ∏ i : Fin n, f i.succ :=
prod_univ_succAbove f 0
#align fin.prod_univ_succ Fin.prod_univ_succ
#align fin.sum_univ_succ Fin.sum_univ_succ
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f (Fin.last n)` plus the remaining sum"]
theorem prod_univ_castSucc [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) :
∏ i, f i = (∏ i : Fin n, f (Fin.castSucc i)) * f (last n) := by
simpa [mul_comm] using prod_univ_succAbove f (last n)
#align fin.prod_univ_cast_succ Fin.prod_univ_castSucc
#align fin.sum_univ_cast_succ Fin.sum_univ_castSucc
@[to_additive (attr := simp)]
theorem prod_univ_get [CommMonoid α] (l : List α) : ∏ i, l.get i = l.prod := by
simp [Finset.prod_eq_multiset_prod]
@[to_additive (attr := simp)]
theorem prod_univ_get' [CommMonoid β] (l : List α) (f : α → β) :
∏ i, f (l.get i) = (l.map f).prod := by
simp [Finset.prod_eq_multiset_prod]
@[to_additive]
| Mathlib/Algebra/BigOperators/Fin.lean | 106 | 108 | theorem prod_cons [CommMonoid β] {n : ℕ} (x : β) (f : Fin n → β) :
(∏ i : Fin n.succ, (cons x f : Fin n.succ → β) i) = x * ∏ i : Fin n, f i := by |
simp_rw [prod_univ_succ, cons_zero, cons_succ]
| 0.71875 |
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.LinearAlgebra.Matrix.Trace
import Mathlib.LinearAlgebra.Matrix.Symmetric
#align_import combinatorics.simple_graph.adj_matrix from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
open Matrix
open Finset Matrix SimpleGraph
variable {V α β : Type*}
namespace Matrix
structure IsAdjMatrix [Zero α] [One α] (A : Matrix V V α) : Prop where
zero_or_one : ∀ i j, A i j = 0 ∨ A i j = 1 := by aesop
symm : A.IsSymm := by aesop
apply_diag : ∀ i, A i i = 0 := by aesop
#align matrix.is_adj_matrix Matrix.IsAdjMatrix
namespace IsAdjMatrix
variable {A : Matrix V V α}
@[simp]
| Mathlib/Combinatorics/SimpleGraph/AdjMatrix.lean | 64 | 65 | theorem apply_diag_ne [MulZeroOneClass α] [Nontrivial α] (h : IsAdjMatrix A) (i : V) :
¬A i i = 1 := by | simp [h.apply_diag i]
| 0.71875 |
import Mathlib.Data.Set.Finite
import Mathlib.Order.Partition.Finpartition
#align_import data.setoid.partition from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205"
namespace Setoid
variable {α : Type*}
theorem eq_of_mem_eqv_class {c : Set (Set α)} (H : ∀ a, ∃! b ∈ c, a ∈ b) {x b b'}
(hc : b ∈ c) (hb : x ∈ b) (hc' : b' ∈ c) (hb' : x ∈ b') : b = b' :=
(H x).unique ⟨hc, hb⟩ ⟨hc', hb'⟩
#align setoid.eq_of_mem_eqv_class Setoid.eq_of_mem_eqv_class
def mkClasses (c : Set (Set α)) (H : ∀ a, ∃! b ∈ c, a ∈ b) : Setoid α where
r x y := ∀ s ∈ c, x ∈ s → y ∈ s
iseqv.refl := fun _ _ _ hx => hx
iseqv.symm := fun {x _y} h s hs hy => by
obtain ⟨t, ⟨ht, hx⟩, _⟩ := H x
rwa [eq_of_mem_eqv_class H hs hy ht (h t ht hx)]
iseqv.trans := fun {_x y z} h1 h2 s hs hx => h2 s hs (h1 s hs hx)
#align setoid.mk_classes Setoid.mkClasses
def classes (r : Setoid α) : Set (Set α) :=
{ s | ∃ y, s = { x | r.Rel x y } }
#align setoid.classes Setoid.classes
theorem mem_classes (r : Setoid α) (y) : { x | r.Rel x y } ∈ r.classes :=
⟨y, rfl⟩
#align setoid.mem_classes Setoid.mem_classes
| Mathlib/Data/Setoid/Partition.lean | 67 | 71 | theorem classes_ker_subset_fiber_set {β : Type*} (f : α → β) :
(Setoid.ker f).classes ⊆ Set.range fun y => { x | f x = y } := by |
rintro s ⟨x, rfl⟩
rw [Set.mem_range]
exact ⟨f x, rfl⟩
| 0.71875 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.