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.Algebra.BigOperators.Group.Multiset
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
universe v
variable {α : Type*} {β : Type v} {γ δ : Type*}
namespace Multiset
def join : Multiset (Multiset α) → Multiset α :=
sum
#align multiset.join Multiset.join
theorem coe_join :
∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join
| [] => rfl
| l :: L => by
exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L)
#align multiset.coe_join Multiset.coe_join
@[simp]
theorem join_zero : @join α 0 = 0 :=
rfl
#align multiset.join_zero Multiset.join_zero
@[simp]
theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S :=
sum_cons _ _
#align multiset.join_cons Multiset.join_cons
@[simp]
theorem join_add (S T) : @join α (S + T) = join S + join T :=
sum_add _ _
#align multiset.join_add Multiset.join_add
@[simp]
theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a :=
sum_singleton _
#align multiset.singleton_join Multiset.singleton_join
@[simp]
theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s :=
Multiset.induction_on S (by simp) <| by
simp (config := { contextual := true }) [or_and_right, exists_or]
#align multiset.mem_join Multiset.mem_join
@[simp]
theorem card_join (S) : card (@join α S) = sum (map card S) :=
Multiset.induction_on S (by simp) (by simp)
#align multiset.card_join Multiset.card_join
@[simp]
| Mathlib/Data/Multiset/Bind.lean | 82 | 86 | theorem map_join (f : α → β) (S : Multiset (Multiset α)) :
map f (join S) = join (map (map f) S) := by |
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
| 0.625 |
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Multiset.Powerset
#align_import data.finset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace Finset
open Function Multiset
variable {α : Type*} {s t : Finset α}
section Powerset
def powerset (s : Finset α) : Finset (Finset α) :=
⟨(s.1.powerset.pmap Finset.mk) fun _t h => nodup_of_le (mem_powerset.1 h) s.nodup,
s.nodup.powerset.pmap fun _a _ha _b _hb => congr_arg Finset.val⟩
#align finset.powerset Finset.powerset
@[simp]
theorem mem_powerset {s t : Finset α} : s ∈ powerset t ↔ s ⊆ t := by
cases s
simp [powerset, mem_mk, mem_pmap, mk.injEq, mem_powerset, exists_prop, exists_eq_right,
← val_le_iff]
#align finset.mem_powerset Finset.mem_powerset
@[simp, norm_cast]
theorem coe_powerset (s : Finset α) :
(s.powerset : Set (Finset α)) = ((↑) : Finset α → Set α) ⁻¹' (s : Set α).powerset := by
ext
simp
#align finset.coe_powerset Finset.coe_powerset
-- Porting note: remove @[simp], simp can prove it
theorem empty_mem_powerset (s : Finset α) : ∅ ∈ powerset s :=
mem_powerset.2 (empty_subset _)
#align finset.empty_mem_powerset Finset.empty_mem_powerset
-- Porting note: remove @[simp], simp can prove it
theorem mem_powerset_self (s : Finset α) : s ∈ powerset s :=
mem_powerset.2 Subset.rfl
#align finset.mem_powerset_self Finset.mem_powerset_self
@[aesop safe apply (rule_sets := [finsetNonempty])]
theorem powerset_nonempty (s : Finset α) : s.powerset.Nonempty :=
⟨∅, empty_mem_powerset _⟩
#align finset.powerset_nonempty Finset.powerset_nonempty
@[simp]
theorem powerset_mono {s t : Finset α} : powerset s ⊆ powerset t ↔ s ⊆ t :=
⟨fun h => mem_powerset.1 <| h <| mem_powerset_self _, fun st _u h =>
mem_powerset.2 <| Subset.trans (mem_powerset.1 h) st⟩
#align finset.powerset_mono Finset.powerset_mono
theorem powerset_injective : Injective (powerset : Finset α → Finset (Finset α)) :=
(injective_of_le_imp_le _) powerset_mono.1
#align finset.powerset_injective Finset.powerset_injective
@[simp]
theorem powerset_inj : powerset s = powerset t ↔ s = t :=
powerset_injective.eq_iff
#align finset.powerset_inj Finset.powerset_inj
@[simp]
theorem powerset_empty : (∅ : Finset α).powerset = {∅} :=
rfl
#align finset.powerset_empty Finset.powerset_empty
@[simp]
| Mathlib/Data/Finset/Powerset.lean | 83 | 84 | theorem powerset_eq_singleton_empty : s.powerset = {∅} ↔ s = ∅ := by |
rw [← powerset_empty, powerset_inj]
| 0.625 |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af"
variable {l m n α : Type*}
namespace Matrix
open scoped Matrix
section CommRing
variable [Fintype l] [Fintype m] [Fintype n]
variable [DecidableEq l] [DecidableEq m] [DecidableEq n]
variable [CommRing α]
theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix l m α)
(D : Matrix l n α) [Invertible A] :
fromBlocks A B C D =
fromBlocks 1 0 (C * ⅟ A) 1 * fromBlocks A 0 0 (D - C * ⅟ A * B) *
fromBlocks 1 (⅟ A * B) 0 1 := by
simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add,
Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc,
Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel]
#align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁
theorem fromBlocks_eq_of_invertible₂₂ (A : Matrix l m α) (B : Matrix l n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
fromBlocks A B C D =
fromBlocks 1 (B * ⅟ D) 0 1 * fromBlocks (A - B * ⅟ D * C) 0 0 D *
fromBlocks 1 0 (⅟ D * C) 1 :=
(Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by
simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ←
submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply,
fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A
#align matrix.from_blocks_eq_of_invertible₂₂ Matrix.fromBlocks_eq_of_invertible₂₂
section Det
theorem det_fromBlocks₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible A] :
(Matrix.fromBlocks A B C D).det = det A * det (D - C * ⅟ A * B) := by
rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁,
det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one]
#align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁
@[simp]
theorem det_fromBlocks_one₁₁ (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α) :
(Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by
haveI : Invertible (1 : Matrix m m α) := invertibleOne
rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul]
#align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁
theorem det_fromBlocks₂₂ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
(Matrix.fromBlocks A B C D).det = det D * det (A - B * ⅟ D * C) := by
have : fromBlocks A B C D =
(fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by
ext (i j)
cases i <;> cases j <;> rfl
rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁]
#align matrix.det_from_blocks₂₂ Matrix.det_fromBlocks₂₂
@[simp]
| Mathlib/LinearAlgebra/Matrix/SchurComplement.lean | 417 | 420 | theorem det_fromBlocks_one₂₂ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α) :
(Matrix.fromBlocks A B C 1).det = det (A - B * C) := by |
haveI : Invertible (1 : Matrix n n α) := invertibleOne
rw [det_fromBlocks₂₂, invOf_one, Matrix.mul_one, det_one, one_mul]
| 0.625 |
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {α : Type*}
namespace Set
section LinearOrderedField
variable [LinearOrderedField α] {a : α}
@[simp]
theorem preimage_mul_const_Iio (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iio a = Iio (a / c) :=
ext fun _x => (lt_div_iff h).symm
#align set.preimage_mul_const_Iio Set.preimage_mul_const_Iio
@[simp]
theorem preimage_mul_const_Ioi (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioi a = Ioi (a / c) :=
ext fun _x => (div_lt_iff h).symm
#align set.preimage_mul_const_Ioi Set.preimage_mul_const_Ioi
@[simp]
theorem preimage_mul_const_Iic (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iic a = Iic (a / c) :=
ext fun _x => (le_div_iff h).symm
#align set.preimage_mul_const_Iic Set.preimage_mul_const_Iic
@[simp]
theorem preimage_mul_const_Ici (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ici a = Ici (a / c) :=
ext fun _x => (div_le_iff h).symm
#align set.preimage_mul_const_Ici Set.preimage_mul_const_Ici
@[simp]
theorem preimage_mul_const_Ioo (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c) := by simp [← Ioi_inter_Iio, h]
#align set.preimage_mul_const_Ioo Set.preimage_mul_const_Ioo
@[simp]
theorem preimage_mul_const_Ioc (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c) := by simp [← Ioi_inter_Iic, h]
#align set.preimage_mul_const_Ioc Set.preimage_mul_const_Ioc
@[simp]
theorem preimage_mul_const_Ico (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ico a b = Ico (a / c) (b / c) := by simp [← Ici_inter_Iio, h]
#align set.preimage_mul_const_Ico Set.preimage_mul_const_Ico
@[simp]
theorem preimage_mul_const_Icc (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Icc a b = Icc (a / c) (b / c) := by simp [← Ici_inter_Iic, h]
#align set.preimage_mul_const_Icc Set.preimage_mul_const_Icc
@[simp]
theorem preimage_mul_const_Iio_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Iio a = Ioi (a / c) :=
ext fun _x => (div_lt_iff_of_neg h).symm
#align set.preimage_mul_const_Iio_of_neg Set.preimage_mul_const_Iio_of_neg
@[simp]
theorem preimage_mul_const_Ioi_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioi a = Iio (a / c) :=
ext fun _x => (lt_div_iff_of_neg h).symm
#align set.preimage_mul_const_Ioi_of_neg Set.preimage_mul_const_Ioi_of_neg
@[simp]
theorem preimage_mul_const_Iic_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Iic a = Ici (a / c) :=
ext fun _x => (div_le_iff_of_neg h).symm
#align set.preimage_mul_const_Iic_of_neg Set.preimage_mul_const_Iic_of_neg
@[simp]
theorem preimage_mul_const_Ici_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ici a = Iic (a / c) :=
ext fun _x => (le_div_iff_of_neg h).symm
#align set.preimage_mul_const_Ici_of_neg Set.preimage_mul_const_Ici_of_neg
@[simp]
theorem preimage_mul_const_Ioo_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (b / c) (a / c) := by simp [← Ioi_inter_Iio, h, inter_comm]
#align set.preimage_mul_const_Ioo_of_neg Set.preimage_mul_const_Ioo_of_neg
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 668 | 670 | theorem preimage_mul_const_Ioc_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioc a b = Ico (b / c) (a / c) := by |
simp [← Ioi_inter_Iic, ← Ici_inter_Iio, h, inter_comm]
| 0.625 |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Logic.Function.Iterate
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Zify
#align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
namespace Nat
-- Porting note: Lean cannot find pp_nodot at the time of this port.
-- @[pp_nodot]
def fib (n : ℕ) : ℕ :=
((fun p : ℕ × ℕ => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst
#align nat.fib Nat.fib
@[simp]
theorem fib_zero : fib 0 = 0 :=
rfl
#align nat.fib_zero Nat.fib_zero
@[simp]
theorem fib_one : fib 1 = 1 :=
rfl
#align nat.fib_one Nat.fib_one
@[simp]
theorem fib_two : fib 2 = 1 :=
rfl
#align nat.fib_two Nat.fib_two
| Mathlib/Data/Nat/Fib/Basic.lean | 87 | 88 | theorem fib_add_two {n : ℕ} : fib (n + 2) = fib n + fib (n + 1) := by |
simp [fib, Function.iterate_succ_apply']
| 0.625 |
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Order.Disjointed
import Mathlib.MeasureTheory.OuterMeasure.Defs
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
section OuterMeasureClass
variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α]
{μ : F} {s t : Set α}
@[simp]
theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ
#align measure_theory.measure_empty MeasureTheory.measure_empty
@[mono, gcongr]
theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t :=
OuterMeasureClass.measure_mono μ h
#align measure_theory.measure_mono MeasureTheory.measure_mono
theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 :=
eq_bot_mono (measure_mono h) ht
#align measure_theory.measure_mono_null MeasureTheory.measure_mono_null
theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t :=
hs.bot_lt.trans_le (measure_mono h)
theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by
refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _
calc
μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed]
_ ≤ ∑' i, μ (disjointed t i) :=
OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _)
_ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset
#align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le
theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by
have := hI.to_subtype
rw [biUnion_eq_iUnion]
apply measure_iUnion_le
#align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le
theorem measure_biUnion_finset_le (I : Finset ι) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ (s i) :=
(measure_biUnion_le μ I.countable_toSet s).trans_eq <| I.tsum_subtype (μ <| s ·)
#align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le
| Mathlib/MeasureTheory/OuterMeasure/Basic.lean | 84 | 86 | theorem measure_iUnion_fintype_le [Fintype ι] (μ : F) (s : ι → Set α) :
μ (⋃ i, s i) ≤ ∑ i, μ (s i) := by |
simpa using measure_biUnion_finset_le Finset.univ s
| 0.625 |
import Mathlib.Deprecated.Group
#align_import deprecated.ring from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
universe u v w
variable {α : Type u}
structure IsSemiringHom {α : Type u} {β : Type v} [Semiring α] [Semiring β] (f : α → β) : Prop where
map_zero : f 0 = 0
map_one : f 1 = 1
map_add : ∀ x y, f (x + y) = f x + f y
map_mul : ∀ x y, f (x * y) = f x * f y
#align is_semiring_hom IsSemiringHom
structure IsRingHom {α : Type u} {β : Type v} [Ring α] [Ring β] (f : α → β) : Prop where
map_one : f 1 = 1
map_mul : ∀ x y, f (x * y) = f x * f y
map_add : ∀ x y, f (x + y) = f x + f y
#align is_ring_hom IsRingHom
namespace IsRingHom
variable {β : Type v} [Ring α] [Ring β]
theorem of_semiring {f : α → β} (H : IsSemiringHom f) : IsRingHom f :=
{ H with }
#align is_ring_hom.of_semiring IsRingHom.of_semiring
variable {f : α → β} (hf : IsRingHom f) {x y : α}
theorem map_zero (hf : IsRingHom f) : f 0 = 0 :=
calc
f 0 = f (0 + 0) - f 0 := by rw [hf.map_add]; simp
_ = 0 := by simp
#align is_ring_hom.map_zero IsRingHom.map_zero
theorem map_neg (hf : IsRingHom f) : f (-x) = -f x :=
calc
f (-x) = f (-x + x) - f x := by rw [hf.map_add]; simp
_ = -f x := by simp [hf.map_zero]
#align is_ring_hom.map_neg IsRingHom.map_neg
| Mathlib/Deprecated/Ring.lean | 114 | 115 | theorem map_sub (hf : IsRingHom f) : f (x - y) = f x - f y := by |
simp [sub_eq_add_neg, hf.map_add, hf.map_neg]
| 0.625 |
import Batteries.Tactic.Init
import Batteries.Tactic.Alias
import Batteries.Tactic.Lint.Misc
instance {f : α → β} [DecidablePred p] : DecidablePred (p ∘ f) :=
inferInstanceAs <| DecidablePred fun x => p (f x)
@[deprecated] alias proofIrrel := proof_irrel
theorem Function.id_def : @id α = fun x => x := rfl
alias ⟨forall_not_of_not_exists, not_exists_of_forall_not⟩ := not_exists
protected alias ⟨Decidable.exists_not_of_not_forall, _⟩ := Decidable.not_forall
theorem heq_iff_eq : HEq a b ↔ a = b := ⟨eq_of_heq, heq_of_eq⟩
@[simp] theorem eq_rec_constant {α : Sort _} {a a' : α} {β : Sort _} (y : β) (h : a = a') :
(@Eq.rec α a (fun α _ => β) y a' h) = y := by cases h; rfl
theorem congrArg₂ (f : α → β → γ) {x x' : α} {y y' : β}
(hx : x = x') (hy : y = y') : f x y = f x' y' := by subst hx hy; rfl
theorem congrFun₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _}
{f g : ∀ a b, γ a b} (h : f = g) (a : α) (b : β a) :
f a b = g a b :=
congrFun (congrFun h _) _
theorem congrFun₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _}
{f g : ∀ a b c, δ a b c} (h : f = g) (a : α) (b : β a) (c : γ a b) :
f a b c = g a b c :=
congrFun₂ (congrFun h _) _ _
theorem funext₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _}
{f g : ∀ a b, γ a b} (h : ∀ a b, f a b = g a b) : f = g :=
funext fun _ => funext <| h _
theorem funext₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _}
{f g : ∀ a b c, δ a b c} (h : ∀ a b c, f a b c = g a b c) : f = g :=
funext fun _ => funext₂ <| h _
theorem Function.funext_iff {β : α → Sort u} {f₁ f₂ : ∀ x : α, β x} : f₁ = f₂ ↔ ∀ a, f₁ a = f₂ a :=
⟨congrFun, funext⟩
theorem ne_of_apply_ne {α β : Sort _} (f : α → β) {x y : α} : f x ≠ f y → x ≠ y :=
mt <| congrArg _
protected theorem Eq.congr (h₁ : x₁ = y₁) (h₂ : x₂ = y₂) : x₁ = x₂ ↔ y₁ = y₂ := by
subst h₁; subst h₂; rfl
theorem Eq.congr_left {x y z : α} (h : x = y) : x = z ↔ y = z := by rw [h]
theorem Eq.congr_right {x y z : α} (h : x = y) : z = x ↔ z = y := by rw [h]
alias congr_arg := congrArg
alias congr_arg₂ := congrArg₂
alias congr_fun := congrFun
alias congr_fun₂ := congrFun₂
alias congr_fun₃ := congrFun₃
theorem heq_of_cast_eq : ∀ (e : α = β) (_ : cast e a = a'), HEq a a'
| rfl, rfl => .rfl
theorem cast_eq_iff_heq : cast e a = a' ↔ HEq a a' :=
⟨heq_of_cast_eq _, fun h => by cases h; rfl⟩
theorem eqRec_eq_cast {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') :
@Eq.rec α a motive x a' e = cast (e ▸ rfl) x := by
subst e; rfl
--Porting note: new theorem. More general version of `eqRec_heq`
theorem eqRec_heq_self {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') :
HEq (@Eq.rec α a motive x a' e) x := by
subst e; rfl
@[simp]
theorem eqRec_heq_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) :
HEq (@Eq.rec α a motive x a' e) y ↔ HEq x y := by
subst e; rfl
@[simp]
| .lake/packages/batteries/Batteries/Logic.lean | 106 | 109 | theorem heq_eqRec_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) :
HEq y (@Eq.rec α a motive x a' e) ↔ HEq y x := by |
subst e; rfl
| 0.625 |
import Mathlib.Algebra.Order.Ring.Cast
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
import Mathlib.Data.Num.Bitwise
#align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
set_option linter.deprecated false
-- Porting note: Required for the notation `-[n+1]`.
open Int Function
attribute [local simp] add_assoc
namespace Num
variable {α : Type*}
open PosNum
theorem add_zero (n : Num) : n + 0 = n := by cases n <;> rfl
#align num.add_zero Num.add_zero
| Mathlib/Data/Num/Lemmas.lean | 213 | 213 | theorem zero_add (n : Num) : 0 + n = n := by | cases n <;> rfl
| 0.625 |
import Mathlib.Analysis.InnerProductSpace.Dual
import Mathlib.Analysis.Calculus.FDeriv.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
open Topology InnerProductSpace Set
noncomputable section
variable {𝕜 F : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] [CompleteSpace F]
variable {f : F → 𝕜} {f' x : F}
def HasGradientAtFilter (f : F → 𝕜) (f' x : F) (L : Filter F) :=
HasFDerivAtFilter f (toDual 𝕜 F f') x L
def HasGradientWithinAt (f : F → 𝕜) (f' : F) (s : Set F) (x : F) :=
HasGradientAtFilter f f' x (𝓝[s] x)
def HasGradientAt (f : F → 𝕜) (f' x : F) :=
HasGradientAtFilter f f' x (𝓝 x)
def gradientWithin (f : F → 𝕜) (s : Set F) (x : F) : F :=
(toDual 𝕜 F).symm (fderivWithin 𝕜 f s x)
def gradient (f : F → 𝕜) (x : F) : F :=
(toDual 𝕜 F).symm (fderiv 𝕜 f x)
@[inherit_doc]
scoped[Gradient] notation "∇" => gradient
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
open scoped Gradient
variable {s : Set F} {L : Filter F}
theorem hasGradientWithinAt_iff_hasFDerivWithinAt {s : Set F} :
HasGradientWithinAt f f' s x ↔ HasFDerivWithinAt f (toDual 𝕜 F f') s x :=
Iff.rfl
| Mathlib/Analysis/Calculus/Gradient/Basic.lean | 90 | 92 | theorem hasFDerivWithinAt_iff_hasGradientWithinAt {frechet : F →L[𝕜] 𝕜} {s : Set F} :
HasFDerivWithinAt f frechet s x ↔ HasGradientWithinAt f ((toDual 𝕜 F).symm frechet) s x := by |
rw [hasGradientWithinAt_iff_hasFDerivWithinAt, (toDual 𝕜 F).apply_symm_apply frechet]
| 0.625 |
import Mathlib.Data.List.Range
import Mathlib.Data.List.Perm
#align_import data.list.sigma from "leanprover-community/mathlib"@"f808feb6c18afddb25e66a71d317643cf7fb5fbb"
universe u v
namespace List
variable {α : Type u} {β : α → Type v} {l l₁ l₂ : List (Sigma β)}
def keys : List (Sigma β) → List α :=
map Sigma.fst
#align list.keys List.keys
@[simp]
theorem keys_nil : @keys α β [] = [] :=
rfl
#align list.keys_nil List.keys_nil
@[simp]
theorem keys_cons {s} {l : List (Sigma β)} : (s :: l).keys = s.1 :: l.keys :=
rfl
#align list.keys_cons List.keys_cons
theorem mem_keys_of_mem {s : Sigma β} {l : List (Sigma β)} : s ∈ l → s.1 ∈ l.keys :=
mem_map_of_mem Sigma.fst
#align list.mem_keys_of_mem List.mem_keys_of_mem
theorem exists_of_mem_keys {a} {l : List (Sigma β)} (h : a ∈ l.keys) :
∃ b : β a, Sigma.mk a b ∈ l :=
let ⟨⟨_, b'⟩, m, e⟩ := exists_of_mem_map h
Eq.recOn e (Exists.intro b' m)
#align list.exists_of_mem_keys List.exists_of_mem_keys
theorem mem_keys {a} {l : List (Sigma β)} : a ∈ l.keys ↔ ∃ b : β a, Sigma.mk a b ∈ l :=
⟨exists_of_mem_keys, fun ⟨_, h⟩ => mem_keys_of_mem h⟩
#align list.mem_keys List.mem_keys
theorem not_mem_keys {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ b : β a, Sigma.mk a b ∉ l :=
(not_congr mem_keys).trans not_exists
#align list.not_mem_keys List.not_mem_keys
theorem not_eq_key {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ s : Sigma β, s ∈ l → a ≠ s.1 :=
Iff.intro (fun h₁ s h₂ e => absurd (mem_keys_of_mem h₂) (by rwa [e] at h₁)) fun f h₁ =>
let ⟨b, h₂⟩ := exists_of_mem_keys h₁
f _ h₂ rfl
#align list.not_eq_key List.not_eq_key
def NodupKeys (l : List (Sigma β)) : Prop :=
l.keys.Nodup
#align list.nodupkeys List.NodupKeys
theorem nodupKeys_iff_pairwise {l} : NodupKeys l ↔ Pairwise (fun s s' : Sigma β => s.1 ≠ s'.1) l :=
pairwise_map
#align list.nodupkeys_iff_pairwise List.nodupKeys_iff_pairwise
theorem NodupKeys.pairwise_ne {l} (h : NodupKeys l) :
Pairwise (fun s s' : Sigma β => s.1 ≠ s'.1) l :=
nodupKeys_iff_pairwise.1 h
#align list.nodupkeys.pairwise_ne List.NodupKeys.pairwise_ne
@[simp]
theorem nodupKeys_nil : @NodupKeys α β [] :=
Pairwise.nil
#align list.nodupkeys_nil List.nodupKeys_nil
@[simp]
| Mathlib/Data/List/Sigma.lean | 102 | 103 | theorem nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} :
NodupKeys (s :: l) ↔ s.1 ∉ l.keys ∧ NodupKeys l := by | simp [keys, NodupKeys]
| 0.625 |
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
| Mathlib/Algebra/Module/Submodule/Ker.lean | 92 | 93 | theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by | rw [ker_comp]; exact comap_mono bot_le
| 0.625 |
import Mathlib.Algebra.Group.Support
import Mathlib.Data.Set.Pointwise.SMul
#align_import data.set.pointwise.support from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
open Pointwise
open Function Set
section Group
variable {α β γ : Type*} [Group α] [MulAction α β]
theorem mulSupport_comp_inv_smul [One γ] (c : α) (f : β → γ) :
(mulSupport fun x ↦ f (c⁻¹ • x)) = c • mulSupport f := by
ext x
simp only [mem_smul_set_iff_inv_smul_mem, mem_mulSupport]
#align mul_support_comp_inv_smul mulSupport_comp_inv_smul
| Mathlib/Data/Set/Pointwise/Support.lean | 34 | 37 | theorem support_comp_inv_smul [Zero γ] (c : α) (f : β → γ) :
(support fun x ↦ f (c⁻¹ • x)) = c • support f := by |
ext x
simp only [mem_smul_set_iff_inv_smul_mem, mem_support]
| 0.59375 |
import Mathlib.Analysis.Calculus.ContDiff.Defs
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Inverse
#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical NNReal Nat
local notation "∞" => (⊤ : ℕ∞)
universe u v w uD uE uF uG
attribute [local instance 1001]
NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
open Set Fin Filter Function
open scoped Topology
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {D : Type uD} [NormedAddCommGroup D]
[NormedSpace 𝕜 D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type uF}
[NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
{X : Type*} [NormedAddCommGroup X] [NormedSpace 𝕜 X] {s s₁ t u : Set E} {f f₁ : E → F}
{g : F → G} {x x₀ : E} {c : F} {b : E × F → G} {m n : ℕ∞} {p : E → FormalMultilinearSeries 𝕜 E F}
@[simp]
theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {i : ℕ} :
iteratedFDerivWithin 𝕜 i (fun _ : E ↦ (0 : F)) s x = 0 := by
induction i generalizing x with
| zero => ext; simp
| succ i IH =>
ext m
rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ ↦ IH) (IH hx)]
rw [fderivWithin_const_apply _ (hs x hx)]
rfl
@[simp]
theorem iteratedFDeriv_zero_fun {n : ℕ} : (iteratedFDeriv 𝕜 n fun _ : E ↦ (0 : F)) = 0 :=
funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun
theorem contDiff_zero_fun : ContDiff 𝕜 n fun _ : E => (0 : F) :=
contDiff_of_differentiable_iteratedFDeriv fun m _ => by
rw [iteratedFDeriv_zero_fun]
exact differentiable_const (0 : E[×m]→L[𝕜] F)
#align cont_diff_zero_fun contDiff_zero_fun
theorem contDiff_const {c : F} : ContDiff 𝕜 n fun _ : E => c := by
suffices h : ContDiff 𝕜 ∞ fun _ : E => c from h.of_le le_top
rw [contDiff_top_iff_fderiv]
refine ⟨differentiable_const c, ?_⟩
rw [fderiv_const]
exact contDiff_zero_fun
#align cont_diff_const contDiff_const
theorem contDiffOn_const {c : F} {s : Set E} : ContDiffOn 𝕜 n (fun _ : E => c) s :=
contDiff_const.contDiffOn
#align cont_diff_on_const contDiffOn_const
theorem contDiffAt_const {c : F} : ContDiffAt 𝕜 n (fun _ : E => c) x :=
contDiff_const.contDiffAt
#align cont_diff_at_const contDiffAt_const
theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt 𝕜 n (fun _ : E => c) s x :=
contDiffAt_const.contDiffWithinAt
#align cont_diff_within_at_const contDiffWithinAt_const
@[nontriviality]
theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff 𝕜 n f := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const
#align cont_diff_of_subsingleton contDiff_of_subsingleton
@[nontriviality]
theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt 𝕜 n f x := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const
#align cont_diff_at_of_subsingleton contDiffAt_of_subsingleton
@[nontriviality]
theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt 𝕜 n f s x := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffWithinAt_const
#align cont_diff_within_at_of_subsingleton contDiffWithinAt_of_subsingleton
@[nontriviality]
| Mathlib/Analysis/Calculus/ContDiff/Basic.lean | 122 | 123 | theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn 𝕜 n f s := by |
rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
| 0.59375 |
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Order.Disjointed
import Mathlib.MeasureTheory.OuterMeasure.Defs
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
section OuterMeasureClass
variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α]
{μ : F} {s t : Set α}
@[simp]
theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ
#align measure_theory.measure_empty MeasureTheory.measure_empty
@[mono, gcongr]
theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t :=
OuterMeasureClass.measure_mono μ h
#align measure_theory.measure_mono MeasureTheory.measure_mono
theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 :=
eq_bot_mono (measure_mono h) ht
#align measure_theory.measure_mono_null MeasureTheory.measure_mono_null
theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t :=
hs.bot_lt.trans_le (measure_mono h)
theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by
refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _
calc
μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed]
_ ≤ ∑' i, μ (disjointed t i) :=
OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _)
_ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset
#align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le
theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by
have := hI.to_subtype
rw [biUnion_eq_iUnion]
apply measure_iUnion_le
#align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le
theorem measure_biUnion_finset_le (I : Finset ι) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ (s i) :=
(measure_biUnion_le μ I.countable_toSet s).trans_eq <| I.tsum_subtype (μ <| s ·)
#align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le
theorem measure_iUnion_fintype_le [Fintype ι] (μ : F) (s : ι → Set α) :
μ (⋃ i, s i) ≤ ∑ i, μ (s i) := by
simpa using measure_biUnion_finset_le Finset.univ s
#align measure_theory.measure_Union_fintype_le MeasureTheory.measure_iUnion_fintype_le
theorem measure_union_le (s t : Set α) : μ (s ∪ t) ≤ μ s + μ t := by
simpa [union_eq_iUnion] using measure_iUnion_fintype_le μ (cond · s t)
#align measure_theory.measure_union_le MeasureTheory.measure_union_le
theorem measure_le_inter_add_diff (μ : F) (s t : Set α) : μ s ≤ μ (s ∩ t) + μ (s \ t) := by
simpa using measure_union_le (s ∩ t) (s \ t)
theorem measure_diff_null (ht : μ t = 0) : μ (s \ t) = μ s :=
(measure_mono diff_subset).antisymm <| calc
μ s ≤ μ (s ∩ t) + μ (s \ t) := measure_le_inter_add_diff _ _ _
_ ≤ μ t + μ (s \ t) := by gcongr; apply inter_subset_right
_ = μ (s \ t) := by simp [ht]
#align measure_theory.measure_diff_null MeasureTheory.measure_diff_null
theorem measure_biUnion_null_iff {I : Set ι} (hI : I.Countable) {s : ι → Set α} :
μ (⋃ i ∈ I, s i) = 0 ↔ ∀ i ∈ I, μ (s i) = 0 := by
refine ⟨fun h i hi ↦ measure_mono_null (subset_biUnion_of_mem hi) h, fun h ↦ ?_⟩
have _ := hI.to_subtype
simpa [h] using measure_iUnion_le (μ := μ) fun x : I ↦ s x
#align measure_theory.measure_bUnion_null_iff MeasureTheory.measure_biUnion_null_iff
theorem measure_sUnion_null_iff {S : Set (Set α)} (hS : S.Countable) :
μ (⋃₀ S) = 0 ↔ ∀ s ∈ S, μ s = 0 := by
rw [sUnion_eq_biUnion, measure_biUnion_null_iff hS]
#align measure_theory.measure_sUnion_null_iff MeasureTheory.measure_sUnion_null_iff
@[simp]
theorem measure_iUnion_null_iff {ι : Sort*} [Countable ι] {s : ι → Set α} :
μ (⋃ i, s i) = 0 ↔ ∀ i, μ (s i) = 0 := by
rw [← sUnion_range, measure_sUnion_null_iff (countable_range s), forall_mem_range]
#align measure_theory.measure_Union_null_iff MeasureTheory.measure_iUnion_null_iff
alias ⟨_, measure_iUnion_null⟩ := measure_iUnion_null_iff
#align measure_theory.measure_Union_null MeasureTheory.measure_iUnion_null
@[simp]
theorem measure_union_null_iff : μ (s ∪ t) = 0 ↔ μ s = 0 ∧ μ t = 0 := by
simp [union_eq_iUnion, and_comm]
#align measure_theory.measure_union_null_iff MeasureTheory.measure_union_null_iff
| Mathlib/MeasureTheory/OuterMeasure/Basic.lean | 129 | 129 | theorem measure_union_null (hs : μ s = 0) (ht : μ t = 0) : μ (s ∪ t) = 0 := by | simp [*]
| 0.59375 |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section TypeclassesLeftLT
variable [LT α] [CovariantClass α α (· * ·) (· < ·)] {a b c : α}
@[to_additive (attr := simp) Left.neg_pos_iff "Uses `left` co(ntra)variant."]
theorem Left.one_lt_inv_iff : 1 < a⁻¹ ↔ a < 1 := by
rw [← mul_lt_mul_iff_left a, mul_inv_self, mul_one]
#align left.one_lt_inv_iff Left.one_lt_inv_iff
#align left.neg_pos_iff Left.neg_pos_iff
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
| Mathlib/Algebra/Order/Group/Defs.lean | 165 | 166 | theorem Left.inv_lt_one_iff : a⁻¹ < 1 ↔ 1 < a := by |
rw [← mul_lt_mul_iff_left a, mul_inv_self, mul_one]
| 0.59375 |
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]
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⟩
#align finset.lcm_dvd_iff Finset.lcm_dvd_iff
theorem lcm_dvd {a : α} : (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a :=
lcm_dvd_iff.2
#align finset.lcm_dvd Finset.lcm_dvd
theorem dvd_lcm {b : β} (hb : b ∈ s) : f b ∣ s.lcm f :=
lcm_dvd_iff.1 dvd_rfl _ hb
#align finset.dvd_lcm Finset.dvd_lcm
@[simp]
| Mathlib/Algebra/GCDMonoid/Finset.lean | 77 | 82 | theorem lcm_insert [DecidableEq β] {b : β} :
(insert b s : Finset β).lcm f = GCDMonoid.lcm (f b) (s.lcm f) := by |
by_cases h : b ∈ s
· rw [insert_eq_of_mem h,
(lcm_eq_right_iff (f b) (s.lcm f) (Multiset.normalize_lcm (s.1.map f))).2 (dvd_lcm h)]
apply fold_insert h
| 0.59375 |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f"
namespace PowerSeries
section Field
variable (A A' : Type*) [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A']
open Nat
def exp : PowerSeries A :=
mk fun n => algebraMap ℚ A (1 / n !)
#align power_series.exp PowerSeries.exp
def sin : PowerSeries A :=
mk fun n => if Even n then 0 else algebraMap ℚ A ((-1) ^ (n / 2) / n !)
#align power_series.sin PowerSeries.sin
def cos : PowerSeries A :=
mk fun n => if Even n then algebraMap ℚ A ((-1) ^ (n / 2) / n !) else 0
#align power_series.cos PowerSeries.cos
variable {A A'} [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A'] (n : ℕ) (f : A →+* A')
@[simp]
theorem coeff_exp : coeff A n (exp A) = algebraMap ℚ A (1 / n !) :=
coeff_mk _ _
#align power_series.coeff_exp PowerSeries.coeff_exp
@[simp]
theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by
rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp]
simp
#align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp
set_option linter.deprecated false in
@[simp]
| Mathlib/RingTheory/PowerSeries/WellKnown.lean | 181 | 182 | theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by |
rw [sin, coeff_mk, if_pos (even_bit0 n)]
| 0.59375 |
import Mathlib.MeasureTheory.OuterMeasure.Caratheodory
#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
open OuterMeasure
section Extend
variable {α : Type*} {P : α → Prop}
variable (m : ∀ s : α, P s → ℝ≥0∞)
def extend (s : α) : ℝ≥0∞ :=
⨅ h : P s, m s h
#align measure_theory.extend MeasureTheory.extend
theorem extend_eq {s : α} (h : P s) : extend m s = m s h := by simp [extend, h]
#align measure_theory.extend_eq MeasureTheory.extend_eq
theorem extend_eq_top {s : α} (h : ¬P s) : extend m s = ∞ := by simp [extend, h]
#align measure_theory.extend_eq_top MeasureTheory.extend_eq_top
theorem smul_extend {R} [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
[NoZeroSMulDivisors R ℝ≥0∞] {c : R} (hc : c ≠ 0) :
c • extend m = extend fun s h => c • m s h := by
ext1 s
dsimp [extend]
by_cases h : P s
· simp [h]
· simp [h, ENNReal.smul_top, hc]
#align measure_theory.smul_extend MeasureTheory.smul_extend
| Mathlib/MeasureTheory/OuterMeasure/Induced.lean | 65 | 68 | theorem le_extend {s : α} (h : P s) : m s h ≤ extend m s := by |
simp only [extend, le_iInf_iff]
intro
rfl
| 0.59375 |
import Mathlib.Topology.MetricSpace.PiNat
import Mathlib.Topology.MetricSpace.Isometry
import Mathlib.Topology.MetricSpace.Gluing
import Mathlib.Topology.Sets.Opens
import Mathlib.Analysis.Normed.Field.Basic
#align_import topology.metric_space.polish from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
noncomputable section
open scoped Topology Uniformity
open Filter TopologicalSpace Set Metric Function
variable {α : Type*} {β : Type*}
class PolishSpace (α : Type*) [h : TopologicalSpace α]
extends SecondCountableTopology α : Prop where
complete : ∃ m : MetricSpace α, m.toUniformSpace.toTopologicalSpace = h ∧
@CompleteSpace α m.toUniformSpace
#align polish_space PolishSpace
class UpgradedPolishSpace (α : Type*) extends MetricSpace α, SecondCountableTopology α,
CompleteSpace α
#align upgraded_polish_space UpgradedPolishSpace
instance (priority := 100) PolishSpace.of_separableSpace_completeSpace_metrizable [UniformSpace α]
[SeparableSpace α] [CompleteSpace α] [(𝓤 α).IsCountablyGenerated] [T0Space α] :
PolishSpace α where
toSecondCountableTopology := UniformSpace.secondCountable_of_separable α
complete := ⟨UniformSpace.metricSpace α, rfl, ‹_›⟩
#align polish_space_of_complete_second_countable PolishSpace.of_separableSpace_completeSpace_metrizable
def polishSpaceMetric (α : Type*) [TopologicalSpace α] [h : PolishSpace α] : MetricSpace α :=
h.complete.choose.replaceTopology h.complete.choose_spec.1.symm
#align polish_space_metric polishSpaceMetric
| Mathlib/Topology/MetricSpace/Polish.lean | 91 | 94 | theorem complete_polishSpaceMetric (α : Type*) [ht : TopologicalSpace α] [h : PolishSpace α] :
@CompleteSpace α (polishSpaceMetric α).toUniformSpace := by |
convert h.complete.choose_spec.2
exact MetricSpace.replaceTopology_eq _ _
| 0.59375 |
import Mathlib.FieldTheory.Separable
import Mathlib.FieldTheory.SplittingField.Construction
import Mathlib.Algebra.CharP.Reduced
open Function Polynomial
class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where
bijective_frobenius : Bijective <| frobenius R p
section PerfectRing
variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p]
lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p]
[IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p :=
⟨frobenius_inj R p, h⟩
#align perfect_ring.of_surjective PerfectRing.ofSurjective
instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p]
[Finite R] [IsReduced R] : PerfectRing R p :=
ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p)
variable [PerfectRing R p]
@[simp]
theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius
theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) :=
coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n
@[simp]
theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1
@[simp]
theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2
@[simps! apply]
noncomputable def frobeniusEquiv : R ≃+* R :=
RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius
#align frobenius_equiv frobeniusEquiv
@[simp]
theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl
#align coe_frobenius_equiv coe_frobeniusEquiv
theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl
@[simps! apply]
noncomputable def iterateFrobeniusEquiv : R ≃+* R :=
RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n)
@[simp]
theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl
theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl
theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x =
iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) :=
iterateFrobenius_add_apply R p m n x
theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) =
(iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) :=
RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n)
theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x =
(iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) :=
(iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm,
iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply]
theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm =
(iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm :=
RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n)
theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by
rw [iterateFrobeniusEquiv_def, pow_zero, pow_one]
| Mathlib/FieldTheory/Perfect.lean | 116 | 117 | theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by |
rw [iterateFrobeniusEquiv_def, pow_one]
| 0.59375 |
import Mathlib.Probability.Kernel.Composition
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import probability.kernel.integral_comp_prod from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113"
noncomputable section
open scoped Topology ENNReal MeasureTheory ProbabilityTheory
open Set Function Real ENNReal MeasureTheory Filter ProbabilityTheory ProbabilityTheory.kernel
variable {α β γ E : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{mγ : MeasurableSpace γ} [NormedAddCommGroup E] {κ : kernel α β} [IsSFiniteKernel κ]
{η : kernel (α × β) γ} [IsSFiniteKernel η] {a : α}
namespace ProbabilityTheory
theorem hasFiniteIntegral_prod_mk_left (a : α) {s : Set (β × γ)} (h2s : (κ ⊗ₖ η) a s ≠ ∞) :
HasFiniteIntegral (fun b => (η (a, b) (Prod.mk b ⁻¹' s)).toReal) (κ a) := by
let t := toMeasurable ((κ ⊗ₖ η) a) s
simp_rw [HasFiniteIntegral, ennnorm_eq_ofReal toReal_nonneg]
calc
∫⁻ b, ENNReal.ofReal (η (a, b) (Prod.mk b ⁻¹' s)).toReal ∂κ a
_ ≤ ∫⁻ b, η (a, b) (Prod.mk b ⁻¹' t) ∂κ a := by
refine lintegral_mono_ae ?_
filter_upwards [ae_kernel_lt_top a h2s] with b hb
rw [ofReal_toReal hb.ne]
exact measure_mono (preimage_mono (subset_toMeasurable _ _))
_ ≤ (κ ⊗ₖ η) a t := le_compProd_apply _ _ _ _
_ = (κ ⊗ₖ η) a s := measure_toMeasurable s
_ < ⊤ := h2s.lt_top
#align probability_theory.has_finite_integral_prod_mk_left ProbabilityTheory.hasFiniteIntegral_prod_mk_left
| Mathlib/Probability/Kernel/IntegralCompProd.lean | 64 | 68 | theorem integrable_kernel_prod_mk_left (a : α) {s : Set (β × γ)} (hs : MeasurableSet s)
(h2s : (κ ⊗ₖ η) a s ≠ ∞) : Integrable (fun b => (η (a, b) (Prod.mk b ⁻¹' s)).toReal) (κ a) := by |
constructor
· exact (measurable_kernel_prod_mk_left' hs a).ennreal_toReal.aestronglyMeasurable
· exact hasFiniteIntegral_prod_mk_left a h2s
| 0.59375 |
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]
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)
#align complex.closure_set_of_re_lt Complex.closure_setOf_re_lt
@[simp]
theorem closure_setOf_im_lt (a : ℝ) : closure { z : ℂ | z.im < a } = { z | z.im ≤ a } := by
simpa only [closure_Iio] using closure_preimage_im (Iio a)
#align complex.closure_set_of_im_lt Complex.closure_setOf_im_lt
@[simp]
| Mathlib/Analysis/Complex/ReImTopology.lean | 124 | 125 | theorem closure_setOf_lt_re (a : ℝ) : closure { z : ℂ | a < z.re } = { z | a ≤ z.re } := by |
simpa only [closure_Ioi] using closure_preimage_re (Ioi a)
| 0.59375 |
import Mathlib.Data.Rat.Encodable
import Mathlib.Data.Real.EReal
import Mathlib.Topology.Instances.ENNReal
import Mathlib.Topology.Order.MonotoneContinuity
#align_import topology.instances.ereal from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Set Filter Metric TopologicalSpace Topology
open scoped ENNReal NNReal Filter
variable {α : Type*} [TopologicalSpace α]
namespace EReal
instance : TopologicalSpace EReal := Preorder.topology EReal
instance : OrderTopology EReal := ⟨rfl⟩
instance : T5Space EReal := inferInstance
instance : T2Space EReal := inferInstance
lemma denseRange_ratCast : DenseRange (fun r : ℚ ↦ ((r : ℝ) : EReal)) :=
dense_of_exists_between fun _ _ h => exists_range_iff.2 <| exists_rat_btwn_of_lt h
instance : SecondCountableTopology EReal :=
have : SeparableSpace EReal := ⟨⟨_, countable_range _, denseRange_ratCast⟩⟩
.of_separableSpace_orderTopology _
theorem embedding_coe : Embedding ((↑) : ℝ → EReal) :=
coe_strictMono.embedding_of_ordConnected <| by rw [range_coe_eq_Ioo]; exact ordConnected_Ioo
#align ereal.embedding_coe EReal.embedding_coe
theorem openEmbedding_coe : OpenEmbedding ((↑) : ℝ → EReal) :=
⟨embedding_coe, by simp only [range_coe_eq_Ioo, isOpen_Ioo]⟩
#align ereal.open_embedding_coe EReal.openEmbedding_coe
@[norm_cast]
theorem tendsto_coe {α : Type*} {f : Filter α} {m : α → ℝ} {a : ℝ} :
Tendsto (fun a => (m a : EReal)) f (𝓝 ↑a) ↔ Tendsto m f (𝓝 a) :=
embedding_coe.tendsto_nhds_iff.symm
#align ereal.tendsto_coe EReal.tendsto_coe
theorem _root_.continuous_coe_real_ereal : Continuous ((↑) : ℝ → EReal) :=
embedding_coe.continuous
#align continuous_coe_real_ereal continuous_coe_real_ereal
theorem continuous_coe_iff {f : α → ℝ} : (Continuous fun a => (f a : EReal)) ↔ Continuous f :=
embedding_coe.continuous_iff.symm
#align ereal.continuous_coe_iff EReal.continuous_coe_iff
theorem nhds_coe {r : ℝ} : 𝓝 (r : EReal) = (𝓝 r).map (↑) :=
(openEmbedding_coe.map_nhds_eq r).symm
#align ereal.nhds_coe EReal.nhds_coe
theorem nhds_coe_coe {r p : ℝ} :
𝓝 ((r : EReal), (p : EReal)) = (𝓝 (r, p)).map fun p : ℝ × ℝ => (↑p.1, ↑p.2) :=
((openEmbedding_coe.prod openEmbedding_coe).map_nhds_eq (r, p)).symm
#align ereal.nhds_coe_coe EReal.nhds_coe_coe
| Mathlib/Topology/Instances/EReal.lean | 86 | 90 | theorem tendsto_toReal {a : EReal} (ha : a ≠ ⊤) (h'a : a ≠ ⊥) :
Tendsto EReal.toReal (𝓝 a) (𝓝 a.toReal) := by |
lift a to ℝ using ⟨ha, h'a⟩
rw [nhds_coe, tendsto_map'_iff]
exact tendsto_id
| 0.59375 |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section TypeclassesRightLT
variable [LT α] [CovariantClass α α (swap (· * ·)) (· < ·)] {a b c : α}
@[to_additive (attr := simp) "Uses `right` co(ntra)variant."]
| Mathlib/Algebra/Order/Group/Defs.lean | 280 | 281 | theorem Right.inv_lt_one_iff : a⁻¹ < 1 ↔ 1 < a := by |
rw [← mul_lt_mul_iff_right a, inv_mul_self, one_mul]
| 0.59375 |
import Mathlib.Data.Nat.Defs
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.log from "leanprover-community/mathlib"@"3e00d81bdcbf77c8188bbd18f5524ddc3ed8cac6"
namespace Nat
--@[pp_nodot] porting note: unknown attribute
def log (b : ℕ) : ℕ → ℕ
| n => if h : b ≤ n ∧ 1 < b then log b (n / b) + 1 else 0
decreasing_by
-- putting this in the def triggers the `unusedHavesSuffices` linter:
-- https://github.com/leanprover-community/batteries/issues/428
have : n / b < n := div_lt_self ((Nat.zero_lt_one.trans h.2).trans_le h.1) h.2
decreasing_trivial
#align nat.log Nat.log
@[simp]
theorem log_eq_zero_iff {b n : ℕ} : log b n = 0 ↔ n < b ∨ b ≤ 1 := by
rw [log, dite_eq_right_iff]
simp only [Nat.add_eq_zero_iff, Nat.one_ne_zero, and_false, imp_false, not_and_or, not_le, not_lt]
#align nat.log_eq_zero_iff Nat.log_eq_zero_iff
theorem log_of_lt {b n : ℕ} (hb : n < b) : log b n = 0 :=
log_eq_zero_iff.2 (Or.inl hb)
#align nat.log_of_lt Nat.log_of_lt
theorem log_of_left_le_one {b : ℕ} (hb : b ≤ 1) (n) : log b n = 0 :=
log_eq_zero_iff.2 (Or.inr hb)
#align nat.log_of_left_le_one Nat.log_of_left_le_one
@[simp]
theorem log_pos_iff {b n : ℕ} : 0 < log b n ↔ b ≤ n ∧ 1 < b := by
rw [Nat.pos_iff_ne_zero, Ne, log_eq_zero_iff, not_or, not_lt, not_le]
#align nat.log_pos_iff Nat.log_pos_iff
theorem log_pos {b n : ℕ} (hb : 1 < b) (hbn : b ≤ n) : 0 < log b n :=
log_pos_iff.2 ⟨hbn, hb⟩
#align nat.log_pos Nat.log_pos
| Mathlib/Data/Nat/Log.lean | 64 | 66 | theorem log_of_one_lt_of_le {b n : ℕ} (h : 1 < b) (hn : b ≤ n) : log b n = log b (n / b) + 1 := by |
rw [log]
exact if_pos ⟨hn, h⟩
| 0.59375 |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.Analysis.Convex.Segment
import Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
import Mathlib.Tactic.FieldSimp
#align_import analysis.convex.between from "leanprover-community/mathlib"@"571e13cacbed7bf042fd3058ce27157101433842"
variable (R : Type*) {V V' P P' : Type*}
open AffineEquiv AffineMap
section OrderedRing
variable [OrderedRing R] [AddCommGroup V] [Module R V] [AddTorsor V P]
variable [AddCommGroup V'] [Module R V'] [AddTorsor V' P']
def affineSegment (x y : P) :=
lineMap x y '' Set.Icc (0 : R) 1
#align affine_segment affineSegment
theorem affineSegment_eq_segment (x y : V) : affineSegment R x y = segment R x y := by
rw [segment_eq_image_lineMap, affineSegment]
#align affine_segment_eq_segment affineSegment_eq_segment
theorem affineSegment_comm (x y : P) : affineSegment R x y = affineSegment R y x := by
refine Set.ext fun z => ?_
constructor <;>
· rintro ⟨t, ht, hxy⟩
refine ⟨1 - t, ?_, ?_⟩
· rwa [Set.sub_mem_Icc_iff_right, sub_self, sub_zero]
· rwa [lineMap_apply_one_sub]
#align affine_segment_comm affineSegment_comm
theorem left_mem_affineSegment (x y : P) : x ∈ affineSegment R x y :=
⟨0, Set.left_mem_Icc.2 zero_le_one, lineMap_apply_zero _ _⟩
#align left_mem_affine_segment left_mem_affineSegment
theorem right_mem_affineSegment (x y : P) : y ∈ affineSegment R x y :=
⟨1, Set.right_mem_Icc.2 zero_le_one, lineMap_apply_one _ _⟩
#align right_mem_affine_segment right_mem_affineSegment
@[simp]
theorem affineSegment_same (x : P) : affineSegment R x x = {x} := by
-- Porting note: added as this doesn't do anything in `simp_rw` any more
rw [affineSegment]
-- Note: when adding "simp made no progress" in lean4#2336,
-- had to change `lineMap_same` to `lineMap_same _`. Not sure why?
-- Porting note: added `_ _` and `Function.const`
simp_rw [lineMap_same _, AffineMap.coe_const _ _, Function.const,
(Set.nonempty_Icc.mpr zero_le_one).image_const]
#align affine_segment_same affineSegment_same
variable {R}
@[simp]
theorem affineSegment_image (f : P →ᵃ[R] P') (x y : P) :
f '' affineSegment R x y = affineSegment R (f x) (f y) := by
rw [affineSegment, affineSegment, Set.image_image, ← comp_lineMap]
rfl
#align affine_segment_image affineSegment_image
variable (R)
@[simp]
theorem affineSegment_const_vadd_image (x y : P) (v : V) :
(v +ᵥ ·) '' affineSegment R x y = affineSegment R (v +ᵥ x) (v +ᵥ y) :=
affineSegment_image (AffineEquiv.constVAdd R P v : P →ᵃ[R] P) x y
#align affine_segment_const_vadd_image affineSegment_const_vadd_image
@[simp]
theorem affineSegment_vadd_const_image (x y : V) (p : P) :
(· +ᵥ p) '' affineSegment R x y = affineSegment R (x +ᵥ p) (y +ᵥ p) :=
affineSegment_image (AffineEquiv.vaddConst R p : V →ᵃ[R] P) x y
#align affine_segment_vadd_const_image affineSegment_vadd_const_image
@[simp]
theorem affineSegment_const_vsub_image (x y p : P) :
(p -ᵥ ·) '' affineSegment R x y = affineSegment R (p -ᵥ x) (p -ᵥ y) :=
affineSegment_image (AffineEquiv.constVSub R p : P →ᵃ[R] V) x y
#align affine_segment_const_vsub_image affineSegment_const_vsub_image
@[simp]
theorem affineSegment_vsub_const_image (x y p : P) :
(· -ᵥ p) '' affineSegment R x y = affineSegment R (x -ᵥ p) (y -ᵥ p) :=
affineSegment_image ((AffineEquiv.vaddConst R p).symm : P →ᵃ[R] V) x y
#align affine_segment_vsub_const_image affineSegment_vsub_const_image
variable {R}
@[simp]
| Mathlib/Analysis/Convex/Between.lean | 115 | 117 | theorem mem_const_vadd_affineSegment {x y z : P} (v : V) :
v +ᵥ z ∈ affineSegment R (v +ᵥ x) (v +ᵥ y) ↔ z ∈ affineSegment R x y := by |
rw [← affineSegment_const_vadd_image, (AddAction.injective v).mem_set_image]
| 0.59375 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
theorem aeval_T (x : A) (n : ℤ) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, eval₂_eq_eval_map, map_T]
#align polynomial.chebyshev.aeval_T Polynomial.Chebyshev.aeval_T
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 34 | 35 | theorem aeval_U (x : A) (n : ℤ) : aeval x (U R n) = (U A n).eval x := by |
rw [aeval_def, eval₂_eq_eval_map, map_U]
| 0.59375 |
import Mathlib.Algebra.Group.Subsemigroup.Basic
#align_import group_theory.subsemigroup.membership from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff"
assert_not_exists MonoidWithZero
variable {ι : Sort*} {M A B : Type*}
section NonAssoc
variable [Mul M]
open Set
namespace Subsemigroup
-- TODO: this section can be generalized to `[MulMemClass B M] [CompleteLattice B]`
-- such that `complete_lattice.le` coincides with `set_like.le`
@[to_additive]
theorem mem_iSup_of_directed {S : ι → Subsemigroup M} (hS : Directed (· ≤ ·) S) {x : M} :
(x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i := by
refine ⟨?_, fun ⟨i, hi⟩ ↦ le_iSup S i hi⟩
suffices x ∈ closure (⋃ i, (S i : Set M)) → ∃ i, x ∈ S i by
simpa only [closure_iUnion, closure_eq (S _)] using this
refine fun hx ↦ closure_induction hx (fun y hy ↦ mem_iUnion.mp hy) ?_
rintro x y ⟨i, hi⟩ ⟨j, hj⟩
rcases hS i j with ⟨k, hki, hkj⟩
exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩
#align subsemigroup.mem_supr_of_directed Subsemigroup.mem_iSup_of_directed
#align add_subsemigroup.mem_supr_of_directed AddSubsemigroup.mem_iSup_of_directed
@[to_additive]
theorem coe_iSup_of_directed {S : ι → Subsemigroup M} (hS : Directed (· ≤ ·) S) :
((⨆ i, S i : Subsemigroup M) : Set M) = ⋃ i, S i :=
Set.ext fun x => by simp [mem_iSup_of_directed hS]
#align subsemigroup.coe_supr_of_directed Subsemigroup.coe_iSup_of_directed
#align add_subsemigroup.coe_supr_of_directed AddSubsemigroup.coe_iSup_of_directed
@[to_additive]
theorem mem_sSup_of_directed_on {S : Set (Subsemigroup M)} (hS : DirectedOn (· ≤ ·) S) {x : M} :
x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s := by
simp only [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk,
exists_prop]
#align subsemigroup.mem_Sup_of_directed_on Subsemigroup.mem_sSup_of_directed_on
#align add_subsemigroup.mem_Sup_of_directed_on AddSubsemigroup.mem_sSup_of_directed_on
@[to_additive]
theorem coe_sSup_of_directed_on {S : Set (Subsemigroup M)} (hS : DirectedOn (· ≤ ·) S) :
(↑(sSup S) : Set M) = ⋃ s ∈ S, ↑s :=
Set.ext fun x => by simp [mem_sSup_of_directed_on hS]
#align subsemigroup.coe_Sup_of_directed_on Subsemigroup.coe_sSup_of_directed_on
#align add_subsemigroup.coe_Sup_of_directed_on AddSubsemigroup.coe_sSup_of_directed_on
@[to_additive]
theorem mem_sup_left {S T : Subsemigroup M} : ∀ {x : M}, x ∈ S → x ∈ S ⊔ T := by
have : S ≤ S ⊔ T := le_sup_left
tauto
#align subsemigroup.mem_sup_left Subsemigroup.mem_sup_left
#align add_subsemigroup.mem_sup_left AddSubsemigroup.mem_sup_left
@[to_additive]
theorem mem_sup_right {S T : Subsemigroup M} : ∀ {x : M}, x ∈ T → x ∈ S ⊔ T := by
have : T ≤ S ⊔ T := le_sup_right
tauto
#align subsemigroup.mem_sup_right Subsemigroup.mem_sup_right
#align add_subsemigroup.mem_sup_right AddSubsemigroup.mem_sup_right
@[to_additive]
theorem mul_mem_sup {S T : Subsemigroup M} {x y : M} (hx : x ∈ S) (hy : y ∈ T) : x * y ∈ S ⊔ T :=
mul_mem (mem_sup_left hx) (mem_sup_right hy)
#align subsemigroup.mul_mem_sup Subsemigroup.mul_mem_sup
#align add_subsemigroup.add_mem_sup AddSubsemigroup.add_mem_sup
@[to_additive]
theorem mem_iSup_of_mem {S : ι → Subsemigroup M} (i : ι) : ∀ {x : M}, x ∈ S i → x ∈ iSup S := by
have : S i ≤ iSup S := le_iSup _ _
tauto
#align subsemigroup.mem_supr_of_mem Subsemigroup.mem_iSup_of_mem
#align add_subsemigroup.mem_supr_of_mem AddSubsemigroup.mem_iSup_of_mem
@[to_additive]
| Mathlib/Algebra/Group/Subsemigroup/Membership.lean | 109 | 112 | theorem mem_sSup_of_mem {S : Set (Subsemigroup M)} {s : Subsemigroup M} (hs : s ∈ S) :
∀ {x : M}, x ∈ s → x ∈ sSup S := by |
have : s ≤ sSup S := le_sSup hs
tauto
| 0.59375 |
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]
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
#align category_theory.idempotents.karoubi.hom_ext CategoryTheory.Idempotents.Karoubi.hom_ext_iff
-- Porting note: added because `Hom.ext` is not triggered automatically
@[ext]
theorem hom_ext {P Q : Karoubi C} (f g : P ⟶ Q) (h : f.f = g.f) : f = g := by
simpa [hom_ext_iff] using h
@[simp]
theorem comp_f {P Q R : Karoubi C} (f : P ⟶ Q) (g : Q ⟶ R) : (f ≫ g).f = f.f ≫ g.f := rfl
#align category_theory.idempotents.karoubi.comp_f CategoryTheory.Idempotents.Karoubi.comp_f
@[simp]
theorem id_eq {P : Karoubi C} : 𝟙 P = ⟨P.p, by repeat' rw [P.idem]⟩ := rfl
#align category_theory.idempotents.karoubi.id_eq CategoryTheory.Idempotents.Karoubi.id_eq
instance coe : CoeTC C (Karoubi C) :=
⟨fun X => ⟨X, 𝟙 X, by rw [comp_id]⟩⟩
#align category_theory.idempotents.karoubi.coe CategoryTheory.Idempotents.Karoubi.coe
-- Porting note: removed @[simp] as the linter complains
theorem coe_X (X : C) : (X : Karoubi C).X = X := rfl
set_option linter.uppercaseLean3 false in
#align category_theory.idempotents.karoubi.coe_X CategoryTheory.Idempotents.Karoubi.coe_X
@[simp]
theorem coe_p (X : C) : (X : Karoubi C).p = 𝟙 X := rfl
#align category_theory.idempotents.karoubi.coe_p CategoryTheory.Idempotents.Karoubi.coe_p
@[simp]
| Mathlib/CategoryTheory/Idempotents/Karoubi.lean | 144 | 147 | theorem eqToHom_f {P Q : Karoubi C} (h : P = Q) :
Karoubi.Hom.f (eqToHom h) = P.p ≫ eqToHom (congr_arg Karoubi.X h) := by |
subst h
simp only [eqToHom_refl, Karoubi.id_eq, comp_id]
| 0.59375 |
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Perm.Basic
#align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Equiv Finset
namespace Equiv.Perm
variable {α : Type*}
section support
section Set
variable (p q : Perm α)
theorem set_support_inv_eq : { x | p⁻¹ x ≠ x } = { x | p x ≠ x } := by
ext x
simp only [Set.mem_setOf_eq, Ne]
rw [inv_def, symm_apply_eq, eq_comm]
#align equiv.perm.set_support_inv_eq Equiv.Perm.set_support_inv_eq
| Mathlib/GroupTheory/Perm/Support.lean | 270 | 271 | theorem set_support_apply_mem {p : Perm α} {a : α} :
p a ∈ { x | p x ≠ x } ↔ a ∈ { x | p x ≠ x } := by | simp
| 0.59375 |
import Mathlib.Data.Fin.Tuple.Basic
import Mathlib.Data.List.Join
#align_import data.list.of_fn from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b"
universe u
variable {α : Type u}
open Nat
namespace List
#noalign list.length_of_fn_aux
@[simp]
theorem length_ofFn_go {n} (f : Fin n → α) (i j h) : length (ofFn.go f i j h) = i := by
induction i generalizing j <;> simp_all [ofFn.go]
@[simp]
theorem length_ofFn {n} (f : Fin n → α) : length (ofFn f) = n := by
simp [ofFn, length_ofFn_go]
#align list.length_of_fn List.length_ofFn
#noalign list.nth_of_fn_aux
theorem get_ofFn_go {n} (f : Fin n → α) (i j h) (k) (hk) :
get (ofFn.go f i j h) ⟨k, hk⟩ = f ⟨j + k, by simp at hk; omega⟩ := by
let i+1 := i
cases k <;> simp [ofFn.go, get_ofFn_go (i := i)]
congr 2; omega
-- Porting note (#10756): new theorem
@[simp]
theorem get_ofFn {n} (f : Fin n → α) (i) : get (ofFn f) i = f (Fin.cast (by simp) i) := by
cases i; simp [ofFn, get_ofFn_go]
@[simp]
theorem get?_ofFn {n} (f : Fin n → α) (i) : get? (ofFn f) i = ofFnNthVal f i :=
if h : i < (ofFn f).length
then by
rw [get?_eq_get h, get_ofFn]
· simp only [length_ofFn] at h; simp [ofFnNthVal, h]
else by
rw [ofFnNthVal, dif_neg] <;>
simpa using h
#align list.nth_of_fn List.get?_ofFn
set_option linter.deprecated false in
@[deprecated get_ofFn (since := "2023-01-17")]
theorem nthLe_ofFn {n} (f : Fin n → α) (i : Fin n) :
nthLe (ofFn f) i ((length_ofFn f).symm ▸ i.2) = f i := by
simp [nthLe]
#align list.nth_le_of_fn List.nthLe_ofFn
set_option linter.deprecated false in
@[simp, deprecated get_ofFn (since := "2023-01-17")]
theorem nthLe_ofFn' {n} (f : Fin n → α) {i : ℕ} (h : i < (ofFn f).length) :
nthLe (ofFn f) i h = f ⟨i, length_ofFn f ▸ h⟩ :=
nthLe_ofFn f ⟨i, length_ofFn f ▸ h⟩
#align list.nth_le_of_fn' List.nthLe_ofFn'
@[simp]
theorem map_ofFn {β : Type*} {n : ℕ} (f : Fin n → α) (g : α → β) :
map g (ofFn f) = ofFn (g ∘ f) :=
ext_get (by simp) fun i h h' => by simp
#align list.map_of_fn List.map_ofFn
-- Porting note: we don't have Array' in mathlib4
--
-- theorem array_eq_of_fn {n} (a : Array' n α) : a.toList = ofFn a.read :=
-- by
-- suffices ∀ {m h l}, DArray.revIterateAux a (fun i => cons) m h l =
-- ofFnAux (DArray.read a) m h l
-- from this
-- intros; induction' m with m IH generalizing l; · rfl
-- simp only [DArray.revIterateAux, of_fn_aux, IH]
-- #align list.array_eq_of_fn List.array_eq_of_fn
@[congr]
| Mathlib/Data/List/OfFn.lean | 105 | 108 | theorem ofFn_congr {m n : ℕ} (h : m = n) (f : Fin m → α) :
ofFn f = ofFn fun i : Fin n => f (Fin.cast h.symm i) := by |
subst h
simp_rw [Fin.cast_refl, id]
| 0.59375 |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : ℝ) : ℝ :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
theorem logb_zero : logb b 0 = 0 := by simp [logb]
#align real.logb_zero Real.logb_zero
@[simp]
theorem logb_one : logb b 1 = 0 := by simp [logb]
#align real.logb_one Real.logb_one
@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 :=
div_self (log_pos hb).ne'
lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 :=
Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero
@[simp]
theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs]
#align real.logb_abs Real.logb_abs
@[simp]
theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by
rw [← logb_abs x, ← logb_abs (-x), abs_neg]
#align real.logb_neg_eq_logb Real.logb_neg_eq_logb
theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by
simp_rw [logb, log_mul hx hy, add_div]
#align real.logb_mul Real.logb_mul
theorem logb_div (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x / y) = logb b x - logb b y := by
simp_rw [logb, log_div hx hy, sub_div]
#align real.logb_div Real.logb_div
@[simp]
theorem logb_inv (x : ℝ) : logb b x⁻¹ = -logb b x := by simp [logb, neg_div]
#align real.logb_inv Real.logb_inv
theorem inv_logb (a b : ℝ) : (logb a b)⁻¹ = logb b a := by simp_rw [logb, inv_div]
#align real.inv_logb Real.inv_logb
theorem inv_logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) :
(logb (a * b) c)⁻¹ = (logb a c)⁻¹ + (logb b c)⁻¹ := by
simp_rw [inv_logb]; exact logb_mul h₁ h₂
#align real.inv_logb_mul_base Real.inv_logb_mul_base
theorem inv_logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) :
(logb (a / b) c)⁻¹ = (logb a c)⁻¹ - (logb b c)⁻¹ := by
simp_rw [inv_logb]; exact logb_div h₁ h₂
#align real.inv_logb_div_base Real.inv_logb_div_base
theorem logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) :
logb (a * b) c = ((logb a c)⁻¹ + (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_mul_base h₁ h₂ c, inv_inv]
#align real.logb_mul_base Real.logb_mul_base
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 101 | 102 | theorem logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) :
logb (a / b) c = ((logb a c)⁻¹ - (logb b c)⁻¹)⁻¹ := by | rw [← inv_logb_div_base h₁ h₂ c, inv_inv]
| 0.59375 |
import Mathlib.MeasureTheory.Constructions.Prod.Basic
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.Topology.Constructions
#align_import measure_theory.constructions.pi from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open Function Set MeasureTheory.OuterMeasure Filter MeasurableSpace Encodable
open scoped Classical Topology ENNReal
universe u v
variable {ι ι' : Type*} {α : ι → Type*}
theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) :
IsPiSystem (pi univ '' pi univ C) := by
rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hst
rw [← pi_inter_distrib] at hst ⊢; rw [univ_pi_nonempty_iff] at hst
exact mem_image_of_mem _ fun i _ => hC i _ (hs₁ i (mem_univ i)) _ (hs₂ i (mem_univ i)) (hst i)
#align is_pi_system.pi IsPiSystem.pi
theorem isPiSystem_pi [∀ i, MeasurableSpace (α i)] :
IsPiSystem (pi univ '' pi univ fun i => { s : Set (α i) | MeasurableSet s }) :=
IsPiSystem.pi fun _ => isPiSystem_measurableSet
#align is_pi_system_pi isPiSystem_pi
namespace MeasureTheory
variable [Fintype ι] {m : ∀ i, OuterMeasure (α i)}
@[simp]
def piPremeasure (m : ∀ i, OuterMeasure (α i)) (s : Set (∀ i, α i)) : ℝ≥0∞ :=
∏ i, m i (eval i '' s)
#align measure_theory.pi_premeasure MeasureTheory.piPremeasure
| Mathlib/MeasureTheory/Constructions/Pi.lean | 162 | 163 | theorem piPremeasure_pi {s : ∀ i, Set (α i)} (hs : (pi univ s).Nonempty) :
piPremeasure m (pi univ s) = ∏ i, m i (s i) := by | simp [hs, piPremeasure]
| 0.59375 |
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.MkIffOfInductiveProp
#align_import data.sum.basic from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc"
universe u v w x
variable {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {γ δ : Type*}
namespace Sum
#align sum.forall Sum.forall
#align sum.exists Sum.exists
theorem exists_sum {γ : α ⊕ β → Sort*} (p : (∀ ab, γ ab) → Prop) :
(∃ fab, p fab) ↔ (∃ fa fb, p (Sum.rec fa fb)) := by
rw [← not_forall_not, forall_sum]
simp
theorem inl_injective : Function.Injective (inl : α → Sum α β) := fun _ _ ↦ inl.inj
#align sum.inl_injective Sum.inl_injective
theorem inr_injective : Function.Injective (inr : β → Sum α β) := fun _ _ ↦ inr.inj
#align sum.inr_injective Sum.inr_injective
theorem sum_rec_congr (P : α ⊕ β → Sort*) (f : ∀ i, P (inl i)) (g : ∀ i, P (inr i))
{x y : α ⊕ β} (h : x = y) :
@Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by cases h; rfl
section get
#align sum.is_left Sum.isLeft
#align sum.is_right Sum.isRight
#align sum.get_left Sum.getLeft?
#align sum.get_right Sum.getRight?
variable {x y : Sum α β}
#align sum.get_left_eq_none_iff Sum.getLeft?_eq_none_iff
#align sum.get_right_eq_none_iff Sum.getRight?_eq_none_iff
theorem eq_left_iff_getLeft_eq {a : α} : x = inl a ↔ ∃ h, x.getLeft h = a := by
cases x <;> simp
theorem eq_right_iff_getRight_eq {b : β} : x = inr b ↔ ∃ h, x.getRight h = b := by
cases x <;> simp
#align sum.get_left_eq_some_iff Sum.getLeft?_eq_some_iff
#align sum.get_right_eq_some_iff Sum.getRight?_eq_some_iff
theorem getLeft_eq_getLeft? (h₁ : x.isLeft) (h₂ : x.getLeft?.isSome) :
x.getLeft h₁ = x.getLeft?.get h₂ := by simp [← getLeft?_eq_some_iff]
| Mathlib/Data/Sum/Basic.lean | 66 | 67 | theorem getRight_eq_getRight? (h₁ : x.isRight) (h₂ : x.getRight?.isSome) :
x.getRight h₁ = x.getRight?.get h₂ := by | simp [← getRight?_eq_some_iff]
| 0.59375 |
import Mathlib.Analysis.InnerProductSpace.TwoDim
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic
#align_import geometry.euclidean.angle.oriented.basic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open FiniteDimensional Complex
open scoped Real RealInnerProductSpace ComplexConjugate
namespace Orientation
attribute [local instance] Complex.finrank_real_complex_fact
variable {V V' : Type*}
variable [NormedAddCommGroup V] [NormedAddCommGroup V']
variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V']
variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2))
local notation "ω" => o.areaForm
def oangle (x y : V) : Real.Angle :=
Complex.arg (o.kahler x y)
#align orientation.oangle Orientation.oangle
theorem continuousAt_oangle {x : V × V} (hx1 : x.1 ≠ 0) (hx2 : x.2 ≠ 0) :
ContinuousAt (fun y : V × V => o.oangle y.1 y.2) x := by
refine (Complex.continuousAt_arg_coe_angle ?_).comp ?_
· exact o.kahler_ne_zero hx1 hx2
exact ((continuous_ofReal.comp continuous_inner).add
((continuous_ofReal.comp o.areaForm'.continuous₂).mul continuous_const)).continuousAt
#align orientation.continuous_at_oangle Orientation.continuousAt_oangle
@[simp]
theorem oangle_zero_left (x : V) : o.oangle 0 x = 0 := by simp [oangle]
#align orientation.oangle_zero_left Orientation.oangle_zero_left
@[simp]
theorem oangle_zero_right (x : V) : o.oangle x 0 = 0 := by simp [oangle]
#align orientation.oangle_zero_right Orientation.oangle_zero_right
@[simp]
theorem oangle_self (x : V) : o.oangle x x = 0 := by
rw [oangle, kahler_apply_self, ← ofReal_pow]
convert QuotientAddGroup.mk_zero (AddSubgroup.zmultiples (2 * π))
apply arg_ofReal_of_nonneg
positivity
#align orientation.oangle_self Orientation.oangle_self
theorem left_ne_zero_of_oangle_ne_zero {x y : V} (h : o.oangle x y ≠ 0) : x ≠ 0 := by
rintro rfl; simp at h
#align orientation.left_ne_zero_of_oangle_ne_zero Orientation.left_ne_zero_of_oangle_ne_zero
theorem right_ne_zero_of_oangle_ne_zero {x y : V} (h : o.oangle x y ≠ 0) : y ≠ 0 := by
rintro rfl; simp at h
#align orientation.right_ne_zero_of_oangle_ne_zero Orientation.right_ne_zero_of_oangle_ne_zero
| Mathlib/Geometry/Euclidean/Angle/Oriented/Basic.lean | 96 | 97 | theorem ne_of_oangle_ne_zero {x y : V} (h : o.oangle x y ≠ 0) : x ≠ y := by |
rintro rfl; simp at h
| 0.59375 |
import Mathlib.Data.Set.Image
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.with_bot_top from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
variable {α : Type*}
namespace WithTop
@[simp]
theorem preimage_coe_top : (some : α → WithTop α) ⁻¹' {⊤} = (∅ : Set α) :=
eq_empty_of_subset_empty fun _ => coe_ne_top
#align with_top.preimage_coe_top WithTop.preimage_coe_top
variable [Preorder α] {a b : α}
theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by
ext x
rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists]
#align with_top.range_coe WithTop.range_coe
@[simp]
theorem preimage_coe_Ioi : (some : α → WithTop α) ⁻¹' Ioi a = Ioi a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Ioi WithTop.preimage_coe_Ioi
@[simp]
theorem preimage_coe_Ici : (some : α → WithTop α) ⁻¹' Ici a = Ici a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Ici WithTop.preimage_coe_Ici
@[simp]
theorem preimage_coe_Iio : (some : α → WithTop α) ⁻¹' Iio a = Iio a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Iio WithTop.preimage_coe_Iio
@[simp]
theorem preimage_coe_Iic : (some : α → WithTop α) ⁻¹' Iic a = Iic a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Iic WithTop.preimage_coe_Iic
@[simp]
theorem preimage_coe_Icc : (some : α → WithTop α) ⁻¹' Icc a b = Icc a b := by simp [← Ici_inter_Iic]
#align with_top.preimage_coe_Icc WithTop.preimage_coe_Icc
@[simp]
theorem preimage_coe_Ico : (some : α → WithTop α) ⁻¹' Ico a b = Ico a b := by simp [← Ici_inter_Iio]
#align with_top.preimage_coe_Ico WithTop.preimage_coe_Ico
@[simp]
| Mathlib/Order/Interval/Set/WithBotTop.lean | 67 | 67 | theorem preimage_coe_Ioc : (some : α → WithTop α) ⁻¹' Ioc a b = Ioc a b := by | simp [← Ioi_inter_Iic]
| 0.59375 |
import Mathlib.Topology.Order
#align_import topology.maps from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d"
open Set Filter Function
open TopologicalSpace Topology Filter
variable {X : Type*} {Y : Type*} {Z : Type*} {ι : Type*} {f : X → Y} {g : Y → Z}
section Inducing
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
theorem inducing_induced (f : X → Y) : @Inducing X Y (TopologicalSpace.induced f ‹_›) _ f :=
@Inducing.mk _ _ (TopologicalSpace.induced f ‹_›) _ _ rfl
theorem inducing_id : Inducing (@id X) :=
⟨induced_id.symm⟩
#align inducing_id inducing_id
protected theorem Inducing.comp (hg : Inducing g) (hf : Inducing f) :
Inducing (g ∘ f) :=
⟨by rw [hf.induced, hg.induced, induced_compose]⟩
#align inducing.comp Inducing.comp
theorem Inducing.of_comp_iff (hg : Inducing g) :
Inducing (g ∘ f) ↔ Inducing f := by
refine ⟨fun h ↦ ?_, hg.comp⟩
rw [inducing_iff, hg.induced, induced_compose, h.induced]
#align inducing.inducing_iff Inducing.of_comp_iff
theorem inducing_of_inducing_compose
(hf : Continuous f) (hg : Continuous g) (hgf : Inducing (g ∘ f)) : Inducing f :=
⟨le_antisymm (by rwa [← continuous_iff_le_induced])
(by
rw [hgf.induced, ← induced_compose]
exact induced_mono hg.le_induced)⟩
#align inducing_of_inducing_compose inducing_of_inducing_compose
theorem inducing_iff_nhds : Inducing f ↔ ∀ x, 𝓝 x = comap f (𝓝 (f x)) :=
(inducing_iff _).trans (induced_iff_nhds_eq f)
#align inducing_iff_nhds inducing_iff_nhds
namespace Inducing
theorem nhds_eq_comap (hf : Inducing f) : ∀ x : X, 𝓝 x = comap f (𝓝 <| f x) :=
inducing_iff_nhds.1 hf
#align inducing.nhds_eq_comap Inducing.nhds_eq_comap
theorem basis_nhds {p : ι → Prop} {s : ι → Set Y} (hf : Inducing f) {x : X}
(h_basis : (𝓝 (f x)).HasBasis p s) : (𝓝 x).HasBasis p (preimage f ∘ s) :=
hf.nhds_eq_comap x ▸ h_basis.comap f
theorem nhdsSet_eq_comap (hf : Inducing f) (s : Set X) :
𝓝ˢ s = comap f (𝓝ˢ (f '' s)) := by
simp only [nhdsSet, sSup_image, comap_iSup, hf.nhds_eq_comap, iSup_image]
#align inducing.nhds_set_eq_comap Inducing.nhdsSet_eq_comap
theorem map_nhds_eq (hf : Inducing f) (x : X) : (𝓝 x).map f = 𝓝[range f] f x :=
hf.induced.symm ▸ map_nhds_induced_eq x
#align inducing.map_nhds_eq Inducing.map_nhds_eq
theorem map_nhds_of_mem (hf : Inducing f) (x : X) (h : range f ∈ 𝓝 (f x)) :
(𝓝 x).map f = 𝓝 (f x) :=
hf.induced.symm ▸ map_nhds_induced_of_mem h
#align inducing.map_nhds_of_mem Inducing.map_nhds_of_mem
-- Porting note (#10756): new lemma
theorem mapClusterPt_iff (hf : Inducing f) {x : X} {l : Filter X} :
MapClusterPt (f x) l f ↔ ClusterPt x l := by
delta MapClusterPt ClusterPt
rw [← Filter.push_pull', ← hf.nhds_eq_comap, map_neBot_iff]
theorem image_mem_nhdsWithin (hf : Inducing f) {x : X} {s : Set X} (hs : s ∈ 𝓝 x) :
f '' s ∈ 𝓝[range f] f x :=
hf.map_nhds_eq x ▸ image_mem_map hs
#align inducing.image_mem_nhds_within Inducing.image_mem_nhdsWithin
theorem tendsto_nhds_iff {f : ι → Y} {l : Filter ι} {y : Y} (hg : Inducing g) :
Tendsto f l (𝓝 y) ↔ Tendsto (g ∘ f) l (𝓝 (g y)) := by
rw [hg.nhds_eq_comap, tendsto_comap_iff]
#align inducing.tendsto_nhds_iff Inducing.tendsto_nhds_iff
theorem continuousAt_iff (hg : Inducing g) {x : X} :
ContinuousAt f x ↔ ContinuousAt (g ∘ f) x :=
hg.tendsto_nhds_iff
#align inducing.continuous_at_iff Inducing.continuousAt_iff
theorem continuous_iff (hg : Inducing g) :
Continuous f ↔ Continuous (g ∘ f) := by
simp_rw [continuous_iff_continuousAt, hg.continuousAt_iff]
#align inducing.continuous_iff Inducing.continuous_iff
| Mathlib/Topology/Maps.lean | 137 | 139 | theorem continuousAt_iff' (hf : Inducing f) {x : X} (h : range f ∈ 𝓝 (f x)) :
ContinuousAt (g ∘ f) x ↔ ContinuousAt g (f x) := by |
simp_rw [ContinuousAt, Filter.Tendsto, ← hf.map_nhds_of_mem _ h, Filter.map_map, comp]
| 0.59375 |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.AddTorsor
#align_import analysis.convex.normed from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
variable {ι : Type*} {E P : Type*}
open Metric Set
open scoped Convex
variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P]
variable {s t : Set E}
| Mathlib/Analysis/Convex/Normed.lean | 39 | 44 | theorem convexOn_norm (hs : Convex ℝ s) : ConvexOn ℝ s norm :=
⟨hs, fun x _ y _ a b ha hb _ =>
calc
‖a • x + b • y‖ ≤ ‖a • x‖ + ‖b • y‖ := norm_add_le _ _
_ = a * ‖x‖ + b * ‖y‖ := by |
rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]⟩
| 0.59375 |
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]
| Mathlib/Algebra/GCDMonoid/Finset.lean | 166 | 171 | 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
| 0.59375 |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Analysis.NormedSpace.LinearIsometry
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.LinearAlgebra.AffineSpace.Restrict
import Mathlib.Tactic.FailIfNoProgress
#align_import analysis.normed_space.affine_isometry from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open Function Set
variable (𝕜 : Type*) {V V₁ V₁' V₂ V₃ V₄ : Type*} {P₁ P₁' : Type*} (P P₂ : Type*) {P₃ P₄ : Type*}
[NormedField 𝕜]
[SeminormedAddCommGroup V] [NormedSpace 𝕜 V] [PseudoMetricSpace P] [NormedAddTorsor V P]
[SeminormedAddCommGroup V₁] [NormedSpace 𝕜 V₁] [PseudoMetricSpace P₁] [NormedAddTorsor V₁ P₁]
[SeminormedAddCommGroup V₁'] [NormedSpace 𝕜 V₁'] [MetricSpace P₁'] [NormedAddTorsor V₁' P₁']
[SeminormedAddCommGroup V₂] [NormedSpace 𝕜 V₂] [PseudoMetricSpace P₂] [NormedAddTorsor V₂ P₂]
[SeminormedAddCommGroup V₃] [NormedSpace 𝕜 V₃] [PseudoMetricSpace P₃] [NormedAddTorsor V₃ P₃]
[SeminormedAddCommGroup V₄] [NormedSpace 𝕜 V₄] [PseudoMetricSpace P₄] [NormedAddTorsor V₄ P₄]
structure AffineIsometry extends P →ᵃ[𝕜] P₂ where
norm_map : ∀ x : V, ‖linear x‖ = ‖x‖
#align affine_isometry AffineIsometry
variable {𝕜 P P₂}
@[inherit_doc]
notation:25 -- `→ᵃᵢ` would be more consistent with the linear isometry notation, but it is uglier
P " →ᵃⁱ[" 𝕜:25 "] " P₂:0 => AffineIsometry 𝕜 P P₂
variable (𝕜 P P₂)
structure AffineIsometryEquiv extends P ≃ᵃ[𝕜] P₂ where
norm_map : ∀ x, ‖linear x‖ = ‖x‖
#align affine_isometry_equiv AffineIsometryEquiv
variable {𝕜 P P₂}
-- `≃ᵃᵢ` would be more consistent with the linear isometry equiv notation, but it is uglier
notation:25 P " ≃ᵃⁱ[" 𝕜:25 "] " P₂:0 => AffineIsometryEquiv 𝕜 P P₂
namespace AffineIsometryEquiv
variable (e : P ≃ᵃⁱ[𝕜] P₂)
protected def linearIsometryEquiv : V ≃ₗᵢ[𝕜] V₂ :=
{ e.linear with norm_map' := e.norm_map }
#align affine_isometry_equiv.linear_isometry_equiv AffineIsometryEquiv.linearIsometryEquiv
@[simp]
| Mathlib/Analysis/NormedSpace/AffineIsometry.lean | 329 | 331 | theorem linear_eq_linear_isometry : e.linear = e.linearIsometryEquiv.toLinearEquiv := by |
ext
rfl
| 0.59375 |
import Mathlib.Data.Int.Range
import Mathlib.Data.ZMod.Basic
import Mathlib.NumberTheory.MulChar.Basic
#align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace ZMod
section QuadCharModP
@[simps]
def χ₄ : MulChar (ZMod 4) ℤ where
toFun := (![0, 1, 0, -1] : ZMod 4 → ℤ)
map_one' := rfl
map_mul' := by decide
map_nonunit' := by decide
#align zmod.χ₄ ZMod.χ₄
theorem isQuadratic_χ₄ : χ₄.IsQuadratic := by
intro a
-- Porting note (#11043): was `decide!`
fin_cases a
all_goals decide
#align zmod.is_quadratic_χ₄ ZMod.isQuadratic_χ₄
theorem χ₄_nat_mod_four (n : ℕ) : χ₄ n = χ₄ (n % 4 : ℕ) := by rw [← ZMod.natCast_mod n 4]
#align zmod.χ₄_nat_mod_four ZMod.χ₄_nat_mod_four
theorem χ₄_int_mod_four (n : ℤ) : χ₄ n = χ₄ (n % 4 : ℤ) := by
rw [← ZMod.intCast_mod n 4]
norm_cast
#align zmod.χ₄_int_mod_four ZMod.χ₄_int_mod_four
theorem χ₄_int_eq_if_mod_four (n : ℤ) :
χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by
have help : ∀ m : ℤ, 0 ≤ m → m < 4 → χ₄ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by
decide
rw [← Int.emod_emod_of_dvd n (by decide : (2 : ℤ) ∣ 4), ← ZMod.intCast_mod n 4]
exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num))
#align zmod.χ₄_int_eq_if_mod_four ZMod.χ₄_int_eq_if_mod_four
theorem χ₄_nat_eq_if_mod_four (n : ℕ) :
χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 :=
mod_cast χ₄_int_eq_if_mod_four n
#align zmod.χ₄_nat_eq_if_mod_four ZMod.χ₄_nat_eq_if_mod_four
theorem χ₄_eq_neg_one_pow {n : ℕ} (hn : n % 2 = 1) : χ₄ n = (-1) ^ (n / 2) := by
rw [χ₄_nat_eq_if_mod_four]
simp only [hn, Nat.one_ne_zero, if_false]
conv_rhs => -- Porting note: was `nth_rw`
arg 2; rw [← Nat.div_add_mod n 4]
enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)]
rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul,
neg_one_sq, one_pow, mul_one]
have help : ∀ m : ℕ, m < 4 → m % 2 = 1 → ite (m = 1) (1 : ℤ) (-1) = (-1) ^ (m / 2) := by decide
exact
help (n % 4) (Nat.mod_lt n (by norm_num))
((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn)
#align zmod.χ₄_eq_neg_one_pow ZMod.χ₄_eq_neg_one_pow
theorem χ₄_nat_one_mod_four {n : ℕ} (hn : n % 4 = 1) : χ₄ n = 1 := by
rw [χ₄_nat_mod_four, hn]
rfl
#align zmod.χ₄_nat_one_mod_four ZMod.χ₄_nat_one_mod_four
theorem χ₄_nat_three_mod_four {n : ℕ} (hn : n % 4 = 3) : χ₄ n = -1 := by
rw [χ₄_nat_mod_four, hn]
rfl
#align zmod.χ₄_nat_three_mod_four ZMod.χ₄_nat_three_mod_four
theorem χ₄_int_one_mod_four {n : ℤ} (hn : n % 4 = 1) : χ₄ n = 1 := by
rw [χ₄_int_mod_four, hn]
rfl
#align zmod.χ₄_int_one_mod_four ZMod.χ₄_int_one_mod_four
| Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean | 113 | 115 | theorem χ₄_int_three_mod_four {n : ℤ} (hn : n % 4 = 3) : χ₄ n = -1 := by |
rw [χ₄_int_mod_four, hn]
rfl
| 0.59375 |
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u w
open CategoryTheory CategoryTheory.Limits
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
open scoped Classical
noncomputable section
section
variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g]
theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g :=
imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp)
#align image_le_kernel image_le_kernel
def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) :=
Subobject.ofLE _ _ (image_le_kernel _ _ w)
#align image_to_kernel imageToKernel
instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by
dsimp only [imageToKernel]
infer_instance
@[simp]
theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) :
Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w :=
rfl
#align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel
attribute [local instance] ConcreteCategory.instFunLike
-- Porting note: removed elementwise attribute which does not seem to be helpful here
-- a more suitable lemma is added below
@[reassoc (attr := simp)]
theorem imageToKernel_arrow (w : f ≫ g = 0) :
imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by
simp [imageToKernel]
#align image_to_kernel_arrow imageToKernel_arrow
@[simp]
lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f ≫ g = 0)
(x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) :
(kernelSubobject g).arrow (imageToKernel f g w x) =
(imageSubobject f).arrow x := by
rw [← comp_apply, imageToKernel_arrow]
-- This is less useful as a `simp` lemma than it initially appears,
-- as it "loses" the information the morphism factors through the image.
theorem factorThruImageSubobject_comp_imageToKernel (w : f ≫ g = 0) :
factorThruImageSubobject f ≫ imageToKernel f g w = factorThruKernelSubobject g f w := by
ext
simp
#align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel
end
section
variable {A B C : V} (f : A ⟶ B) (g : B ⟶ C)
@[simp]
| Mathlib/Algebra/Homology/ImageToKernel.lean | 95 | 98 | theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} :
imageToKernel (0 : A ⟶ B) g w = 0 := by |
ext
simp
| 0.59375 |
import Mathlib.MeasureTheory.Group.Measure
assert_not_exists NormedSpace
namespace MeasureTheory
open Measure TopologicalSpace
open scoped ENNReal
variable {G : Type*} [MeasurableSpace G] {μ : Measure G} {g : G}
section MeasurableMul
variable [Group G] [MeasurableMul G]
@[to_additive
"Translating a function by left-addition does not change its Lebesgue integral with
respect to a left-invariant measure."]
theorem lintegral_mul_left_eq_self [IsMulLeftInvariant μ] (f : G → ℝ≥0∞) (g : G) :
(∫⁻ x, f (g * x) ∂μ) = ∫⁻ x, f x ∂μ := by
convert (lintegral_map_equiv f <| MeasurableEquiv.mulLeft g).symm
simp [map_mul_left_eq_self μ g]
#align measure_theory.lintegral_mul_left_eq_self MeasureTheory.lintegral_mul_left_eq_self
#align measure_theory.lintegral_add_left_eq_self MeasureTheory.lintegral_add_left_eq_self
@[to_additive
"Translating a function by right-addition does not change its Lebesgue integral with
respect to a right-invariant measure."]
theorem lintegral_mul_right_eq_self [IsMulRightInvariant μ] (f : G → ℝ≥0∞) (g : G) :
(∫⁻ x, f (x * g) ∂μ) = ∫⁻ x, f x ∂μ := by
convert (lintegral_map_equiv f <| MeasurableEquiv.mulRight g).symm using 1
simp [map_mul_right_eq_self μ g]
#align measure_theory.lintegral_mul_right_eq_self MeasureTheory.lintegral_mul_right_eq_self
#align measure_theory.lintegral_add_right_eq_self MeasureTheory.lintegral_add_right_eq_self
@[to_additive] -- Porting note: was `@[simp]`
| Mathlib/MeasureTheory/Group/LIntegral.lean | 54 | 56 | theorem lintegral_div_right_eq_self [IsMulRightInvariant μ] (f : G → ℝ≥0∞) (g : G) :
(∫⁻ x, f (x / g) ∂μ) = ∫⁻ x, f x ∂μ := by |
simp_rw [div_eq_mul_inv, lintegral_mul_right_eq_self f g⁻¹]
| 0.59375 |
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Invertible.Defs
import Mathlib.Algebra.Group.Hom.Defs
import Mathlib.Logic.Equiv.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {α : Type u}
@[simps]
def unitOfInvertible [Monoid α] (a : α) [Invertible a] : αˣ where
val := a
inv := ⅟ a
val_inv := by simp
inv_val := by simp
#align unit_of_invertible unitOfInvertible
#align coe_unit_of_invertible val_unitOfInvertible
#align coe_inv_unit_of_invertible val_inv_unitOfInvertible
theorem isUnit_of_invertible [Monoid α] (a : α) [Invertible a] : IsUnit a :=
⟨unitOfInvertible a, rfl⟩
#align is_unit_of_invertible isUnit_of_invertible
def Units.invertible [Monoid α] (u : αˣ) :
Invertible (u : α) where
invOf := ↑u⁻¹
invOf_mul_self := u.inv_mul
mul_invOf_self := u.mul_inv
#align units.invertible Units.invertible
@[simp]
theorem invOf_units [Monoid α] (u : αˣ) [Invertible (u : α)] : ⅟ (u : α) = ↑u⁻¹ :=
invOf_eq_right_inv u.mul_inv
#align inv_of_units invOf_units
theorem IsUnit.nonempty_invertible [Monoid α] {a : α} (h : IsUnit a) : Nonempty (Invertible a) :=
let ⟨x, hx⟩ := h
⟨x.invertible.copy _ hx.symm⟩
#align is_unit.nonempty_invertible IsUnit.nonempty_invertible
noncomputable def IsUnit.invertible [Monoid α] {a : α} (h : IsUnit a) : Invertible a :=
Classical.choice h.nonempty_invertible
#align is_unit.invertible IsUnit.invertible
@[simp]
theorem nonempty_invertible_iff_isUnit [Monoid α] (a : α) : Nonempty (Invertible a) ↔ IsUnit a :=
⟨Nonempty.rec <| @isUnit_of_invertible _ _ _, IsUnit.nonempty_invertible⟩
#align nonempty_invertible_iff_is_unit nonempty_invertible_iff_isUnit
theorem Commute.invOf_right [Monoid α] {a b : α} [Invertible b] (h : Commute a b) :
Commute a (⅟ b) :=
calc
a * ⅟ b = ⅟ b * (b * a * ⅟ b) := by simp [mul_assoc]
_ = ⅟ b * (a * b * ⅟ b) := by rw [h.eq]
_ = ⅟ b * a := by simp [mul_assoc]
#align commute.inv_of_right Commute.invOf_right
| Mathlib/Algebra/Group/Invertible/Basic.lean | 77 | 82 | theorem Commute.invOf_left [Monoid α] {a b : α} [Invertible b] (h : Commute b a) :
Commute (⅟ b) a :=
calc
⅟ b * a = ⅟ b * (a * b * ⅟ b) := by | simp [mul_assoc]
_ = ⅟ b * (b * a * ⅟ b) := by rw [h.eq]
_ = a * ⅟ b := by simp [mul_assoc]
| 0.59375 |
import Mathlib.Data.Option.Basic
import Mathlib.Data.Set.Basic
#align_import data.pequiv from "leanprover-community/mathlib"@"7c3269ca3fa4c0c19e4d127cd7151edbdbf99ed4"
universe u v w x
structure PEquiv (α : Type u) (β : Type v) where
toFun : α → Option β
invFun : β → Option α
inv : ∀ (a : α) (b : β), a ∈ invFun b ↔ b ∈ toFun a
#align pequiv PEquiv
infixr:25 " ≃. " => PEquiv
namespace PEquiv
variable {α : Type u} {β : Type v} {γ : Type w} {δ : Type x}
open Function Option
instance : FunLike (α ≃. β) α (Option β) :=
{ coe := toFun
coe_injective' := by
rintro ⟨f₁, f₂, hf⟩ ⟨g₁, g₂, hg⟩ (rfl : f₁ = g₁)
congr with y x
simp only [hf, hg] }
@[simp] theorem coe_mk (f₁ : α → Option β) (f₂ h) : (mk f₁ f₂ h : α → Option β) = f₁ :=
rfl
theorem coe_mk_apply (f₁ : α → Option β) (f₂ : β → Option α) (h) (x : α) :
(PEquiv.mk f₁ f₂ h : α → Option β) x = f₁ x :=
rfl
#align pequiv.coe_mk_apply PEquiv.coe_mk_apply
@[ext] theorem ext {f g : α ≃. β} (h : ∀ x, f x = g x) : f = g :=
DFunLike.ext f g h
#align pequiv.ext PEquiv.ext
theorem ext_iff {f g : α ≃. β} : f = g ↔ ∀ x, f x = g x :=
DFunLike.ext_iff
#align pequiv.ext_iff PEquiv.ext_iff
@[refl]
protected def refl (α : Type*) : α ≃. α where
toFun := some
invFun := some
inv _ _ := eq_comm
#align pequiv.refl PEquiv.refl
@[symm]
protected def symm (f : α ≃. β) : β ≃. α where
toFun := f.2
invFun := f.1
inv _ _ := (f.inv _ _).symm
#align pequiv.symm PEquiv.symm
theorem mem_iff_mem (f : α ≃. β) : ∀ {a : α} {b : β}, a ∈ f.symm b ↔ b ∈ f a :=
f.3 _ _
#align pequiv.mem_iff_mem PEquiv.mem_iff_mem
theorem eq_some_iff (f : α ≃. β) : ∀ {a : α} {b : β}, f.symm b = some a ↔ f a = some b :=
f.3 _ _
#align pequiv.eq_some_iff PEquiv.eq_some_iff
@[trans]
protected def trans (f : α ≃. β) (g : β ≃. γ) :
α ≃. γ where
toFun a := (f a).bind g
invFun a := (g.symm a).bind f.symm
inv a b := by simp_all [and_comm, eq_some_iff f, eq_some_iff g, bind_eq_some]
#align pequiv.trans PEquiv.trans
@[simp]
theorem refl_apply (a : α) : PEquiv.refl α a = some a :=
rfl
#align pequiv.refl_apply PEquiv.refl_apply
@[simp]
theorem symm_refl : (PEquiv.refl α).symm = PEquiv.refl α :=
rfl
#align pequiv.symm_refl PEquiv.symm_refl
@[simp]
| Mathlib/Data/PEquiv.lean | 136 | 136 | theorem symm_symm (f : α ≃. β) : f.symm.symm = f := by | cases f; rfl
| 0.59375 |
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Finset.Prod
#align_import data.fintype.prod from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
open Function
open Nat
universe u v
variable {α β γ : Type*}
open Finset Function
namespace Set
variable {s t : Set α}
| Mathlib/Data/Fintype/Prod.lean | 31 | 34 | theorem toFinset_prod (s : Set α) (t : Set β) [Fintype s] [Fintype t] [Fintype (s ×ˢ t)] :
(s ×ˢ t).toFinset = s.toFinset ×ˢ t.toFinset := by |
ext
simp
| 0.59375 |
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le
#align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp
| Mathlib/Algebra/Module/Submodule/Ker.lean | 96 | 100 | theorem ker_sup_ker_le_ker_comp_of_commute {f g : M →ₗ[R] M} (h : Commute f g) :
ker f ⊔ ker g ≤ ker (f ∘ₗ g) := by |
refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩
rw [← mul_eq_comp, h.eq, mul_eq_comp]
exact ker_le_ker_comp f g
| 0.59375 |
import Mathlib.Analysis.NormedSpace.AddTorsorBases
#align_import analysis.convex.intrinsic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open AffineSubspace Set
open scoped Pointwise
variable {𝕜 V W Q P : Type*}
section AddTorsor
variable (𝕜) [Ring 𝕜] [AddCommGroup V] [Module 𝕜 V] [TopologicalSpace P] [AddTorsor V P]
{s t : Set P} {x : P}
def intrinsicInterior (s : Set P) : Set P :=
(↑) '' interior ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_interior intrinsicInterior
def intrinsicFrontier (s : Set P) : Set P :=
(↑) '' frontier ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_frontier intrinsicFrontier
def intrinsicClosure (s : Set P) : Set P :=
(↑) '' closure ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_closure intrinsicClosure
variable {𝕜}
@[simp]
theorem mem_intrinsicInterior :
x ∈ intrinsicInterior 𝕜 s ↔ ∃ y, y ∈ interior ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_interior mem_intrinsicInterior
@[simp]
theorem mem_intrinsicFrontier :
x ∈ intrinsicFrontier 𝕜 s ↔ ∃ y, y ∈ frontier ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_frontier mem_intrinsicFrontier
@[simp]
theorem mem_intrinsicClosure :
x ∈ intrinsicClosure 𝕜 s ↔ ∃ y, y ∈ closure ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_closure mem_intrinsicClosure
theorem intrinsicInterior_subset : intrinsicInterior 𝕜 s ⊆ s :=
image_subset_iff.2 interior_subset
#align intrinsic_interior_subset intrinsicInterior_subset
theorem intrinsicFrontier_subset (hs : IsClosed s) : intrinsicFrontier 𝕜 s ⊆ s :=
image_subset_iff.2 (hs.preimage continuous_induced_dom).frontier_subset
#align intrinsic_frontier_subset intrinsicFrontier_subset
theorem intrinsicFrontier_subset_intrinsicClosure : intrinsicFrontier 𝕜 s ⊆ intrinsicClosure 𝕜 s :=
image_subset _ frontier_subset_closure
#align intrinsic_frontier_subset_intrinsic_closure intrinsicFrontier_subset_intrinsicClosure
theorem subset_intrinsicClosure : s ⊆ intrinsicClosure 𝕜 s :=
fun x hx => ⟨⟨x, subset_affineSpan _ _ hx⟩, subset_closure hx, rfl⟩
#align subset_intrinsic_closure subset_intrinsicClosure
@[simp]
theorem intrinsicInterior_empty : intrinsicInterior 𝕜 (∅ : Set P) = ∅ := by simp [intrinsicInterior]
#align intrinsic_interior_empty intrinsicInterior_empty
@[simp]
theorem intrinsicFrontier_empty : intrinsicFrontier 𝕜 (∅ : Set P) = ∅ := by simp [intrinsicFrontier]
#align intrinsic_frontier_empty intrinsicFrontier_empty
@[simp]
theorem intrinsicClosure_empty : intrinsicClosure 𝕜 (∅ : Set P) = ∅ := by simp [intrinsicClosure]
#align intrinsic_closure_empty intrinsicClosure_empty
@[simp]
theorem intrinsicClosure_nonempty : (intrinsicClosure 𝕜 s).Nonempty ↔ s.Nonempty :=
⟨by simp_rw [nonempty_iff_ne_empty]; rintro h rfl; exact h intrinsicClosure_empty,
Nonempty.mono subset_intrinsicClosure⟩
#align intrinsic_closure_nonempty intrinsicClosure_nonempty
alias ⟨Set.Nonempty.ofIntrinsicClosure, Set.Nonempty.intrinsicClosure⟩ := intrinsicClosure_nonempty
#align set.nonempty.of_intrinsic_closure Set.Nonempty.ofIntrinsicClosure
#align set.nonempty.intrinsic_closure Set.Nonempty.intrinsicClosure
--attribute [protected] Set.Nonempty.intrinsicClosure -- Porting note: removed
@[simp]
| Mathlib/Analysis/Convex/Intrinsic.lean | 136 | 138 | theorem intrinsicInterior_singleton (x : P) : intrinsicInterior 𝕜 ({x} : Set P) = {x} := by |
simpa only [intrinsicInterior, preimage_coe_affineSpan_singleton, interior_univ, image_univ,
Subtype.range_coe] using coe_affineSpan_singleton _ _ _
| 0.59375 |
import Mathlib.LinearAlgebra.Matrix.BilinearForm
import Mathlib.LinearAlgebra.Matrix.Charpoly.Minpoly
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.Vandermonde
import Mathlib.LinearAlgebra.Trace
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.FieldTheory.PrimitiveElement
import Mathlib.FieldTheory.Galois
import Mathlib.RingTheory.PowerBasis
import Mathlib.FieldTheory.Minpoly.MinpolyDiv
#align_import ring_theory.trace from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
universe u v w z
variable {R S T : Type*} [CommRing R] [CommRing S] [CommRing T]
variable [Algebra R S] [Algebra R T]
variable {K L : Type*} [Field K] [Field L] [Algebra K L]
variable {ι κ : Type w} [Fintype ι]
open FiniteDimensional
open LinearMap (BilinForm)
open LinearMap
open Matrix
open scoped Matrix
namespace Algebra
variable (b : Basis ι R S)
variable (R S)
noncomputable def trace : S →ₗ[R] R :=
(LinearMap.trace R S).comp (lmul R S).toLinearMap
#align algebra.trace Algebra.trace
variable {S}
-- Not a `simp` lemma since there are more interesting ways to rewrite `trace R S x`,
-- for example `trace_trace`
theorem trace_apply (x) : trace R S x = LinearMap.trace R S (lmul R S x) :=
rfl
#align algebra.trace_apply Algebra.trace_apply
theorem trace_eq_zero_of_not_exists_basis (h : ¬∃ s : Finset S, Nonempty (Basis s R S)) :
trace R S = 0 := by ext s; simp [trace_apply, LinearMap.trace, h]
#align algebra.trace_eq_zero_of_not_exists_basis Algebra.trace_eq_zero_of_not_exists_basis
variable {R}
-- Can't be a `simp` lemma because it depends on a choice of basis
theorem trace_eq_matrix_trace [DecidableEq ι] (b : Basis ι R S) (s : S) :
trace R S s = Matrix.trace (Algebra.leftMulMatrix b s) := by
rw [trace_apply, LinearMap.trace_eq_matrix_trace _ b, ← toMatrix_lmul_eq]; rfl
#align algebra.trace_eq_matrix_trace Algebra.trace_eq_matrix_trace
theorem trace_algebraMap_of_basis (x : R) : trace R S (algebraMap R S x) = Fintype.card ι • x := by
haveI := Classical.decEq ι
rw [trace_apply, LinearMap.trace_eq_matrix_trace R b, Matrix.trace]
convert Finset.sum_const x
simp [-coe_lmul_eq_mul]
#align algebra.trace_algebra_map_of_basis Algebra.trace_algebraMap_of_basis
@[simp]
theorem trace_algebraMap (x : K) : trace K L (algebraMap K L x) = finrank K L • x := by
by_cases H : ∃ s : Finset L, Nonempty (Basis s K L)
· rw [trace_algebraMap_of_basis H.choose_spec.some, finrank_eq_card_basis H.choose_spec.some]
· simp [trace_eq_zero_of_not_exists_basis K H, finrank_eq_zero_of_not_exists_basis_finset H]
#align algebra.trace_algebra_map Algebra.trace_algebraMap
theorem trace_trace_of_basis [Algebra S T] [IsScalarTower R S T] {ι κ : Type*} [Finite ι]
[Finite κ] (b : Basis ι R S) (c : Basis κ S T) (x : T) :
trace R S (trace S T x) = trace R T x := by
haveI := Classical.decEq ι
haveI := Classical.decEq κ
cases nonempty_fintype ι
cases nonempty_fintype κ
rw [trace_eq_matrix_trace (b.smul c), trace_eq_matrix_trace b, trace_eq_matrix_trace c,
Matrix.trace, Matrix.trace, Matrix.trace, ← Finset.univ_product_univ, Finset.sum_product]
refine Finset.sum_congr rfl fun i _ ↦ ?_
simp only [AlgHom.map_sum, smul_leftMulMatrix, Finset.sum_apply,
Matrix.diag, Finset.sum_apply
i (Finset.univ : Finset κ) fun y => leftMulMatrix b (leftMulMatrix c x y y)]
#align algebra.trace_trace_of_basis Algebra.trace_trace_of_basis
| Mathlib/RingTheory/Trace.lean | 149 | 153 | theorem trace_comp_trace_of_basis [Algebra S T] [IsScalarTower R S T] {ι κ : Type*} [Finite ι]
[Finite κ] (b : Basis ι R S) (c : Basis κ S T) :
(trace R S).comp ((trace S T).restrictScalars R) = trace R T := by |
ext
rw [LinearMap.comp_apply, LinearMap.restrictScalars_apply, trace_trace_of_basis b c]
| 0.59375 |
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.RingTheory.Coprime.Basic
import Mathlib.Tactic.AdaptationNote
#align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727"
variable {R S A K : Type*}
namespace Polynomial
open Polynomial
section Semiring
variable [Semiring R] [Semiring S]
noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] :=
∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i))
#align polynomial.scale_roots Polynomial.scaleRoots
@[simp]
theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) :
(scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by
simp (config := { contextual := true }) [scaleRoots, coeff_monomial]
#align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots
theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) :
(scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by
rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one]
#align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree
@[simp]
theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by
ext
simp
#align polynomial.zero_scale_roots Polynomial.zero_scaleRoots
| Mathlib/RingTheory/Polynomial/ScaleRoots.lean | 53 | 59 | theorem scaleRoots_ne_zero {p : R[X]} (hp : p ≠ 0) (s : R) : scaleRoots p s ≠ 0 := by |
intro h
have : p.coeff p.natDegree ≠ 0 := mt leadingCoeff_eq_zero.mp hp
have : (scaleRoots p s).coeff p.natDegree = 0 :=
congr_fun (congr_arg (coeff : R[X] → ℕ → R) h) p.natDegree
rw [coeff_scaleRoots_natDegree] at this
contradiction
| 0.59375 |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Equiv.Perm
section Fintype
variable [Fintype α] [DecidableEq α] (p : Equiv.Perm α) (x : α)
def toList : List α :=
(List.range (cycleOf p x).support.card).map fun k => (p ^ k) x
#align equiv.perm.to_list Equiv.Perm.toList
@[simp]
theorem toList_one : toList (1 : Perm α) x = [] := by simp [toList, cycleOf_one]
#align equiv.perm.to_list_one Equiv.Perm.toList_one
@[simp]
theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by simp [toList]
#align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff
@[simp]
theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList]
#align equiv.perm.length_to_list Equiv.Perm.length_toList
theorem toList_ne_singleton (y : α) : toList p x ≠ [y] := by
intro H
simpa [card_support_ne_one] using congr_arg length H
#align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton
theorem two_le_length_toList_iff_mem_support {p : Perm α} {x : α} :
2 ≤ length (toList p x) ↔ x ∈ p.support := by simp
#align equiv.perm.two_le_length_to_list_iff_mem_support Equiv.Perm.two_le_length_toList_iff_mem_support
theorem length_toList_pos_of_mem_support (h : x ∈ p.support) : 0 < length (toList p x) :=
zero_lt_two.trans_le (two_le_length_toList_iff_mem_support.mpr h)
#align equiv.perm.length_to_list_pos_of_mem_support Equiv.Perm.length_toList_pos_of_mem_support
theorem get_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).get ⟨n, hn⟩ = (p ^ n) x := by simp [toList]
theorem toList_get_zero (h : x ∈ p.support) :
(toList p x).get ⟨0, (length_toList_pos_of_mem_support _ _ h)⟩ = x := by simp [toList]
set_option linter.deprecated false in
@[deprecated get_toList (since := "2024-05-08")]
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 253 | 254 | theorem nthLe_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).nthLe n hn = (p ^ n) x := by | simp [toList]
| 0.59375 |
import Mathlib.Algebra.Order.Module.OrderedSMul
import Mathlib.Analysis.Convex.Star
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
#align_import analysis.convex.basic from "leanprover-community/mathlib"@"92bd7b1ffeb306a89f450bee126ddd8a284c259d"
variable {𝕜 E F β : Type*}
open LinearMap Set
open scoped Convex Pointwise
section OrderedSemiring
variable [OrderedSemiring 𝕜]
section AddCommMonoid
variable [AddCommMonoid E] [AddCommMonoid F]
section SMul
variable (𝕜) [SMul 𝕜 E] [SMul 𝕜 F] (s : Set E) {x : E}
def Convex : Prop :=
∀ ⦃x : E⦄, x ∈ s → StarConvex 𝕜 x s
#align convex Convex
variable {𝕜 s}
theorem Convex.starConvex (hs : Convex 𝕜 s) (hx : x ∈ s) : StarConvex 𝕜 x s :=
hs hx
#align convex.star_convex Convex.starConvex
theorem convex_iff_segment_subset : Convex 𝕜 s ↔ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → [x -[𝕜] y] ⊆ s :=
forall₂_congr fun _ _ => starConvex_iff_segment_subset
#align convex_iff_segment_subset convex_iff_segment_subset
theorem Convex.segment_subset (h : Convex 𝕜 s) {x y : E} (hx : x ∈ s) (hy : y ∈ s) :
[x -[𝕜] y] ⊆ s :=
convex_iff_segment_subset.1 h hx hy
#align convex.segment_subset Convex.segment_subset
theorem Convex.openSegment_subset (h : Convex 𝕜 s) {x y : E} (hx : x ∈ s) (hy : y ∈ s) :
openSegment 𝕜 x y ⊆ s :=
(openSegment_subset_segment 𝕜 x y).trans (h.segment_subset hx hy)
#align convex.open_segment_subset Convex.openSegment_subset
theorem convex_iff_pointwise_add_subset :
Convex 𝕜 s ↔ ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • s + b • s ⊆ s :=
Iff.intro
(by
rintro hA a b ha hb hab w ⟨au, ⟨u, hu, rfl⟩, bv, ⟨v, hv, rfl⟩, rfl⟩
exact hA hu hv ha hb hab)
fun h x hx y hy a b ha hb hab => (h ha hb hab) (Set.add_mem_add ⟨_, hx, rfl⟩ ⟨_, hy, rfl⟩)
#align convex_iff_pointwise_add_subset convex_iff_pointwise_add_subset
alias ⟨Convex.set_combo_subset, _⟩ := convex_iff_pointwise_add_subset
#align convex.set_combo_subset Convex.set_combo_subset
theorem convex_empty : Convex 𝕜 (∅ : Set E) := fun _ => False.elim
#align convex_empty convex_empty
theorem convex_univ : Convex 𝕜 (Set.univ : Set E) := fun _ _ => starConvex_univ _
#align convex_univ convex_univ
theorem Convex.inter {t : Set E} (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) : Convex 𝕜 (s ∩ t) :=
fun _ hx => (hs hx.1).inter (ht hx.2)
#align convex.inter Convex.inter
theorem convex_sInter {S : Set (Set E)} (h : ∀ s ∈ S, Convex 𝕜 s) : Convex 𝕜 (⋂₀ S) := fun _ hx =>
starConvex_sInter fun _ hs => h _ hs <| hx _ hs
#align convex_sInter convex_sInter
theorem convex_iInter {ι : Sort*} {s : ι → Set E} (h : ∀ i, Convex 𝕜 (s i)) :
Convex 𝕜 (⋂ i, s i) :=
sInter_range s ▸ convex_sInter <| forall_mem_range.2 h
#align convex_Inter convex_iInter
theorem convex_iInter₂ {ι : Sort*} {κ : ι → Sort*} {s : ∀ i, κ i → Set E}
(h : ∀ i j, Convex 𝕜 (s i j)) : Convex 𝕜 (⋂ (i) (j), s i j) :=
convex_iInter fun i => convex_iInter <| h i
#align convex_Inter₂ convex_iInter₂
theorem Convex.prod {s : Set E} {t : Set F} (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) :
Convex 𝕜 (s ×ˢ t) := fun _ hx => (hs hx.1).prod (ht hx.2)
#align convex.prod Convex.prod
theorem convex_pi {ι : Type*} {E : ι → Type*} [∀ i, AddCommMonoid (E i)] [∀ i, SMul 𝕜 (E i)]
{s : Set ι} {t : ∀ i, Set (E i)} (ht : ∀ ⦃i⦄, i ∈ s → Convex 𝕜 (t i)) : Convex 𝕜 (s.pi t) :=
fun _ hx => starConvex_pi fun _ hi => ht hi <| hx _ hi
#align convex_pi convex_pi
theorem Directed.convex_iUnion {ι : Sort*} {s : ι → Set E} (hdir : Directed (· ⊆ ·) s)
(hc : ∀ ⦃i : ι⦄, Convex 𝕜 (s i)) : Convex 𝕜 (⋃ i, s i) := by
rintro x hx y hy a b ha hb hab
rw [mem_iUnion] at hx hy ⊢
obtain ⟨i, hx⟩ := hx
obtain ⟨j, hy⟩ := hy
obtain ⟨k, hik, hjk⟩ := hdir i j
exact ⟨k, hc (hik hx) (hjk hy) ha hb hab⟩
#align directed.convex_Union Directed.convex_iUnion
| Mathlib/Analysis/Convex/Basic.lean | 131 | 134 | theorem DirectedOn.convex_sUnion {c : Set (Set E)} (hdir : DirectedOn (· ⊆ ·) c)
(hc : ∀ ⦃A : Set E⦄, A ∈ c → Convex 𝕜 A) : Convex 𝕜 (⋃₀ c) := by |
rw [sUnion_eq_iUnion]
exact (directedOn_iff_directed.1 hdir).convex_iUnion fun A => hc A.2
| 0.59375 |
import Mathlib.Order.Cover
import Mathlib.Order.Interval.Finset.Defs
#align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
assert_not_exists MonoidWithZero
assert_not_exists Finset.sum
open Function OrderDual
open FinsetInterval
variable {ι α : Type*}
namespace Finset
section Preorder
variable [Preorder α]
section LocallyFiniteOrder
variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α}
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by
rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc]
#align finset.nonempty_Icc Finset.nonempty_Icc
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico]
#align finset.nonempty_Ico Finset.nonempty_Ico
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc]
#align finset.nonempty_Ioc Finset.nonempty_Ioc
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo]
#align finset.nonempty_Ioo Finset.nonempty_Ioo
@[simp]
theorem Icc_eq_empty_iff : Icc a b = ∅ ↔ ¬a ≤ b := by
rw [← coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff]
#align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff
@[simp]
theorem Ico_eq_empty_iff : Ico a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff]
#align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff
@[simp]
theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff]
#align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem Ioo_eq_empty_iff [DenselyOrdered α] : Ioo a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff]
#align finset.Ioo_eq_empty_iff Finset.Ioo_eq_empty_iff
alias ⟨_, Icc_eq_empty⟩ := Icc_eq_empty_iff
#align finset.Icc_eq_empty Finset.Icc_eq_empty
alias ⟨_, Ico_eq_empty⟩ := Ico_eq_empty_iff
#align finset.Ico_eq_empty Finset.Ico_eq_empty
alias ⟨_, Ioc_eq_empty⟩ := Ioc_eq_empty_iff
#align finset.Ioc_eq_empty Finset.Ioc_eq_empty
@[simp]
theorem Ioo_eq_empty (h : ¬a < b) : Ioo a b = ∅ :=
eq_empty_iff_forall_not_mem.2 fun _ hx => h ((mem_Ioo.1 hx).1.trans (mem_Ioo.1 hx).2)
#align finset.Ioo_eq_empty Finset.Ioo_eq_empty
@[simp]
theorem Icc_eq_empty_of_lt (h : b < a) : Icc a b = ∅ :=
Icc_eq_empty h.not_le
#align finset.Icc_eq_empty_of_lt Finset.Icc_eq_empty_of_lt
@[simp]
theorem Ico_eq_empty_of_le (h : b ≤ a) : Ico a b = ∅ :=
Ico_eq_empty h.not_lt
#align finset.Ico_eq_empty_of_le Finset.Ico_eq_empty_of_le
@[simp]
theorem Ioc_eq_empty_of_le (h : b ≤ a) : Ioc a b = ∅ :=
Ioc_eq_empty h.not_lt
#align finset.Ioc_eq_empty_of_le Finset.Ioc_eq_empty_of_le
@[simp]
theorem Ioo_eq_empty_of_le (h : b ≤ a) : Ioo a b = ∅ :=
Ioo_eq_empty h.not_lt
#align finset.Ioo_eq_empty_of_le Finset.Ioo_eq_empty_of_le
-- porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Basic.lean | 134 | 134 | theorem left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := by | simp only [mem_Icc, true_and_iff, le_rfl]
| 0.59375 |
import Mathlib.Data.Int.Range
import Mathlib.Data.ZMod.Basic
import Mathlib.NumberTheory.MulChar.Basic
#align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace ZMod
section QuadCharModP
@[simps]
def χ₄ : MulChar (ZMod 4) ℤ where
toFun := (![0, 1, 0, -1] : ZMod 4 → ℤ)
map_one' := rfl
map_mul' := by decide
map_nonunit' := by decide
#align zmod.χ₄ ZMod.χ₄
theorem isQuadratic_χ₄ : χ₄.IsQuadratic := by
intro a
-- Porting note (#11043): was `decide!`
fin_cases a
all_goals decide
#align zmod.is_quadratic_χ₄ ZMod.isQuadratic_χ₄
theorem χ₄_nat_mod_four (n : ℕ) : χ₄ n = χ₄ (n % 4 : ℕ) := by rw [← ZMod.natCast_mod n 4]
#align zmod.χ₄_nat_mod_four ZMod.χ₄_nat_mod_four
theorem χ₄_int_mod_four (n : ℤ) : χ₄ n = χ₄ (n % 4 : ℤ) := by
rw [← ZMod.intCast_mod n 4]
norm_cast
#align zmod.χ₄_int_mod_four ZMod.χ₄_int_mod_four
theorem χ₄_int_eq_if_mod_four (n : ℤ) :
χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by
have help : ∀ m : ℤ, 0 ≤ m → m < 4 → χ₄ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by
decide
rw [← Int.emod_emod_of_dvd n (by decide : (2 : ℤ) ∣ 4), ← ZMod.intCast_mod n 4]
exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num))
#align zmod.χ₄_int_eq_if_mod_four ZMod.χ₄_int_eq_if_mod_four
theorem χ₄_nat_eq_if_mod_four (n : ℕ) :
χ₄ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 :=
mod_cast χ₄_int_eq_if_mod_four n
#align zmod.χ₄_nat_eq_if_mod_four ZMod.χ₄_nat_eq_if_mod_four
theorem χ₄_eq_neg_one_pow {n : ℕ} (hn : n % 2 = 1) : χ₄ n = (-1) ^ (n / 2) := by
rw [χ₄_nat_eq_if_mod_four]
simp only [hn, Nat.one_ne_zero, if_false]
conv_rhs => -- Porting note: was `nth_rw`
arg 2; rw [← Nat.div_add_mod n 4]
enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)]
rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul,
neg_one_sq, one_pow, mul_one]
have help : ∀ m : ℕ, m < 4 → m % 2 = 1 → ite (m = 1) (1 : ℤ) (-1) = (-1) ^ (m / 2) := by decide
exact
help (n % 4) (Nat.mod_lt n (by norm_num))
((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn)
#align zmod.χ₄_eq_neg_one_pow ZMod.χ₄_eq_neg_one_pow
theorem χ₄_nat_one_mod_four {n : ℕ} (hn : n % 4 = 1) : χ₄ n = 1 := by
rw [χ₄_nat_mod_four, hn]
rfl
#align zmod.χ₄_nat_one_mod_four ZMod.χ₄_nat_one_mod_four
theorem χ₄_nat_three_mod_four {n : ℕ} (hn : n % 4 = 3) : χ₄ n = -1 := by
rw [χ₄_nat_mod_four, hn]
rfl
#align zmod.χ₄_nat_three_mod_four ZMod.χ₄_nat_three_mod_four
| Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean | 107 | 109 | theorem χ₄_int_one_mod_four {n : ℤ} (hn : n % 4 = 1) : χ₄ n = 1 := by |
rw [χ₄_int_mod_four, hn]
rfl
| 0.59375 |
import Mathlib.Algebra.FreeNonUnitalNonAssocAlgebra
import Mathlib.Algebra.Lie.NonUnitalNonAssocAlgebra
import Mathlib.Algebra.Lie.UniversalEnveloping
import Mathlib.GroupTheory.GroupAction.Ring
#align_import algebra.lie.free from "leanprover-community/mathlib"@"841ac1a3d9162bf51c6327812ecb6e5e71883ac4"
universe u v w
noncomputable section
variable (R : Type u) (X : Type v) [CommRing R]
local notation "lib" => FreeNonUnitalNonAssocAlgebra
local notation "lib.lift" => FreeNonUnitalNonAssocAlgebra.lift
local notation "lib.of" => FreeNonUnitalNonAssocAlgebra.of
local notation "lib.lift_of_apply" => FreeNonUnitalNonAssocAlgebra.lift_of_apply
local notation "lib.lift_comp_of" => FreeNonUnitalNonAssocAlgebra.lift_comp_of
namespace FreeLieAlgebra
inductive Rel : lib R X → lib R X → Prop
| lie_self (a : lib R X) : Rel (a * a) 0
| leibniz_lie (a b c : lib R X) : Rel (a * (b * c)) (a * b * c + b * (a * c))
| smul (t : R) {a b : lib R X} : Rel a b → Rel (t • a) (t • b)
| add_right {a b : lib R X} (c : lib R X) : Rel a b → Rel (a + c) (b + c)
| mul_left (a : lib R X) {b c : lib R X} : Rel b c → Rel (a * b) (a * c)
| mul_right {a b : lib R X} (c : lib R X) : Rel a b → Rel (a * c) (b * c)
#align free_lie_algebra.rel FreeLieAlgebra.Rel
variable {R X}
theorem Rel.addLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a + b) (a + c) := by
rw [add_comm _ b, add_comm _ c]; exact h.add_right _
#align free_lie_algebra.rel.add_left FreeLieAlgebra.Rel.addLeft
| Mathlib/Algebra/Lie/Free.lean | 91 | 92 | theorem Rel.neg {a b : lib R X} (h : Rel R X a b) : Rel R X (-a) (-b) := by |
simpa only [neg_one_smul] using h.smul (-1)
| 0.59375 |
import Mathlib.Control.EquivFunctor
import Mathlib.Data.Option.Basic
import Mathlib.Data.Subtype
import Mathlib.Logic.Equiv.Defs
import Mathlib.Tactic.Cases
#align_import logic.equiv.option from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
universe u
namespace Equiv
open Option
variable {α β γ : Type*}
section RemoveNone
variable (e : Option α ≃ Option β)
def removeNone_aux (x : α) : β :=
if h : (e (some x)).isSome then Option.get _ h
else
Option.get _ <|
show (e none).isSome by
rw [← Option.ne_none_iff_isSome]
intro hn
rw [Option.not_isSome_iff_eq_none, ← hn] at h
exact Option.some_ne_none _ (e.injective h)
-- Porting note: private
-- #align equiv.remove_none_aux Equiv.removeNone_aux
| Mathlib/Logic/Equiv/Option.lean | 89 | 91 | theorem removeNone_aux_some {x : α} (h : ∃ x', e (some x) = some x') :
some (removeNone_aux e x) = e (some x) := by |
simp [removeNone_aux, Option.isSome_iff_exists.mpr h]
| 0.59375 |
import Mathlib.Order.Cover
import Mathlib.Order.Interval.Finset.Defs
#align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
assert_not_exists MonoidWithZero
assert_not_exists Finset.sum
open Function OrderDual
open FinsetInterval
variable {ι α : Type*}
namespace Finset
section Preorder
variable [Preorder α]
section LocallyFiniteOrder
variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α}
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by
rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc]
#align finset.nonempty_Icc Finset.nonempty_Icc
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico]
#align finset.nonempty_Ico Finset.nonempty_Ico
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc]
#align finset.nonempty_Ioc Finset.nonempty_Ioc
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo]
#align finset.nonempty_Ioo Finset.nonempty_Ioo
@[simp]
theorem Icc_eq_empty_iff : Icc a b = ∅ ↔ ¬a ≤ b := by
rw [← coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff]
#align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff
@[simp]
theorem Ico_eq_empty_iff : Ico a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff]
#align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff
@[simp]
theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff]
#align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem Ioo_eq_empty_iff [DenselyOrdered α] : Ioo a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff]
#align finset.Ioo_eq_empty_iff Finset.Ioo_eq_empty_iff
alias ⟨_, Icc_eq_empty⟩ := Icc_eq_empty_iff
#align finset.Icc_eq_empty Finset.Icc_eq_empty
alias ⟨_, Ico_eq_empty⟩ := Ico_eq_empty_iff
#align finset.Ico_eq_empty Finset.Ico_eq_empty
alias ⟨_, Ioc_eq_empty⟩ := Ioc_eq_empty_iff
#align finset.Ioc_eq_empty Finset.Ioc_eq_empty
@[simp]
theorem Ioo_eq_empty (h : ¬a < b) : Ioo a b = ∅ :=
eq_empty_iff_forall_not_mem.2 fun _ hx => h ((mem_Ioo.1 hx).1.trans (mem_Ioo.1 hx).2)
#align finset.Ioo_eq_empty Finset.Ioo_eq_empty
@[simp]
theorem Icc_eq_empty_of_lt (h : b < a) : Icc a b = ∅ :=
Icc_eq_empty h.not_le
#align finset.Icc_eq_empty_of_lt Finset.Icc_eq_empty_of_lt
@[simp]
theorem Ico_eq_empty_of_le (h : b ≤ a) : Ico a b = ∅ :=
Ico_eq_empty h.not_lt
#align finset.Ico_eq_empty_of_le Finset.Ico_eq_empty_of_le
@[simp]
theorem Ioc_eq_empty_of_le (h : b ≤ a) : Ioc a b = ∅ :=
Ioc_eq_empty h.not_lt
#align finset.Ioc_eq_empty_of_le Finset.Ioc_eq_empty_of_le
@[simp]
theorem Ioo_eq_empty_of_le (h : b ≤ a) : Ioo a b = ∅ :=
Ioo_eq_empty h.not_lt
#align finset.Ioo_eq_empty_of_le Finset.Ioo_eq_empty_of_le
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := by simp only [mem_Icc, true_and_iff, le_rfl]
#align finset.left_mem_Icc Finset.left_mem_Icc
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Ico : a ∈ Ico a b ↔ a < b := by simp only [mem_Ico, true_and_iff, le_refl]
#align finset.left_mem_Ico Finset.left_mem_Ico
-- porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Basic.lean | 144 | 144 | theorem right_mem_Icc : b ∈ Icc a b ↔ a ≤ b := by | simp only [mem_Icc, and_true_iff, le_rfl]
| 0.59375 |
import Mathlib.Data.PFunctor.Multivariate.Basic
#align_import data.pfunctor.multivariate.W from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u v
namespace MvPFunctor
open TypeVec
open MvFunctor
variable {n : ℕ} (P : MvPFunctor.{u} (n + 1))
inductive WPath : P.last.W → Fin2 n → Type u
| root (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (c : P.drop.B a i) : WPath ⟨a, f⟩ i
| child (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (j : P.last.B a)
(c : WPath (f j) i) : WPath ⟨a, f⟩ i
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path MvPFunctor.WPath
instance WPath.inhabited (x : P.last.W) {i} [I : Inhabited (P.drop.B x.head i)] :
Inhabited (WPath P x i) :=
⟨match x, I with
| ⟨a, f⟩, I => WPath.root a f i (@default _ I)⟩
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path.inhabited MvPFunctor.WPath.inhabited
def wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α)
(g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.WPath ⟨a, f⟩ ⟹ α := by
intro i x;
match x with
| WPath.root _ _ i c => exact g' i c
| WPath.child _ _ i j c => exact g j i c
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path_cases_on MvPFunctor.wPathCasesOn
def wPathDestLeft {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
(h : P.WPath ⟨a, f⟩ ⟹ α) : P.drop.B a ⟹ α := fun i c => h i (WPath.root a f i c)
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path_dest_left MvPFunctor.wPathDestLeft
def wPathDestRight {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
(h : P.WPath ⟨a, f⟩ ⟹ α) : ∀ j : P.last.B a, P.WPath (f j) ⟹ α := fun j i c =>
h i (WPath.child a f i j c)
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path_dest_right MvPFunctor.wPathDestRight
theorem wPathDestLeft_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
(g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) :
P.wPathDestLeft (P.wPathCasesOn g' g) = g' := rfl
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path_dest_left_W_path_cases_on MvPFunctor.wPathDestLeft_wPathCasesOn
theorem wPathDestRight_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
(g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) :
P.wPathDestRight (P.wPathCasesOn g' g) = g := rfl
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path_dest_right_W_path_cases_on MvPFunctor.wPathDestRight_wPathCasesOn
theorem wPathCasesOn_eta {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
(h : P.WPath ⟨a, f⟩ ⟹ α) : P.wPathCasesOn (P.wPathDestLeft h) (P.wPathDestRight h) = h := by
ext i x; cases x <;> rfl
set_option linter.uppercaseLean3 false in
#align mvpfunctor.W_path_cases_on_eta MvPFunctor.wPathCasesOn_eta
| Mathlib/Data/PFunctor/Multivariate/W.lean | 115 | 118 | theorem comp_wPathCasesOn {α β : TypeVec n} (h : α ⟹ β) {a : P.A} {f : P.last.B a → P.last.W}
(g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) :
h ⊚ P.wPathCasesOn g' g = P.wPathCasesOn (h ⊚ g') fun i => h ⊚ g i := by |
ext i x; cases x <;> rfl
| 0.59375 |
set_option autoImplicit true
namespace Array
@[simp]
theorem extract_eq_nil_of_start_eq_end {a : Array α} :
a.extract i i = #[] := by
refine extract_empty_of_stop_le_start a ?h
exact Nat.le_refl i
theorem extract_append_left {a b : Array α} {i j : Nat} (h : j ≤ a.size) :
(a ++ b).extract i j = a.extract i j := by
apply ext
· simp only [size_extract, size_append]
omega
· intro h1 h2 h3
rw [get_extract, get_append_left, get_extract]
theorem extract_append_right {a b : Array α} {i j : Nat} (h : a.size ≤ i) :
(a ++ b).extract i j = b.extract (i - a.size) (j - a.size) := by
apply ext
· rw [size_extract, size_extract, size_append]
omega
· intro k hi h2
rw [get_extract, get_extract,
get_append_right (show size a ≤ i + k by omega)]
congr
omega
theorem extract_eq_of_size_le_end {a : Array α} (h : a.size ≤ l) :
a.extract p l = a.extract p a.size := by
simp only [extract, Nat.min_eq_right h, Nat.sub_eq, mkEmpty_eq, Nat.min_self]
| Mathlib/Data/Array/ExtractLemmas.lean | 44 | 50 | theorem extract_extract {a : Array α} (h : s1 + e2 ≤ e1) :
(a.extract s1 e1).extract s2 e2 = a.extract (s1 + s2) (s1 + e2) := by |
apply ext
· simp only [size_extract]
omega
· intro i h1 h2
simp only [get_extract, Nat.add_assoc]
| 0.59375 |
import Mathlib.Algebra.MvPolynomial.Derivation
import Mathlib.Algebra.MvPolynomial.Variables
#align_import data.mv_polynomial.pderiv from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
universe u v
namespace MvPolynomial
open Set Function Finsupp
variable {R : Type u} {σ : Type v} {a a' a₁ a₂ : R} {s : σ →₀ ℕ}
section PDeriv
variable [CommSemiring R]
def pderiv (i : σ) : Derivation R (MvPolynomial σ R) (MvPolynomial σ R) :=
letI := Classical.decEq σ
mkDerivation R <| Pi.single i 1
#align mv_polynomial.pderiv MvPolynomial.pderiv
theorem pderiv_def [DecidableEq σ] (i : σ) : pderiv i = mkDerivation R (Pi.single i 1) := by
unfold pderiv; congr!
#align mv_polynomial.pderiv_def MvPolynomial.pderiv_def
@[simp]
theorem pderiv_monomial {i : σ} :
pderiv i (monomial s a) = monomial (s - single i 1) (a * s i) := by
classical
simp only [pderiv_def, mkDerivation_monomial, Finsupp.smul_sum, smul_eq_mul, ← smul_mul_assoc,
← (monomial _).map_smul]
refine (Finset.sum_eq_single i (fun j _ hne => ?_) fun hi => ?_).trans ?_
· simp [Pi.single_eq_of_ne hne]
· rw [Finsupp.not_mem_support_iff] at hi; simp [hi]
· simp
#align mv_polynomial.pderiv_monomial MvPolynomial.pderiv_monomial
theorem pderiv_C {i : σ} : pderiv i (C a) = 0 :=
derivation_C _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_C MvPolynomial.pderiv_C
theorem pderiv_one {i : σ} : pderiv i (1 : MvPolynomial σ R) = 0 := pderiv_C
#align mv_polynomial.pderiv_one MvPolynomial.pderiv_one
@[simp]
theorem pderiv_X [DecidableEq σ] (i j : σ) :
pderiv i (X j : MvPolynomial σ R) = Pi.single (f := fun j => _) i 1 j := by
rw [pderiv_def, mkDerivation_X]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_X MvPolynomial.pderiv_X
@[simp]
theorem pderiv_X_self (i : σ) : pderiv i (X i : MvPolynomial σ R) = 1 := by classical simp
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_X_self MvPolynomial.pderiv_X_self
@[simp]
theorem pderiv_X_of_ne {i j : σ} (h : j ≠ i) : pderiv i (X j : MvPolynomial σ R) = 0 := by
classical simp [h]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_X_of_ne MvPolynomial.pderiv_X_of_ne
theorem pderiv_eq_zero_of_not_mem_vars {i : σ} {f : MvPolynomial σ R} (h : i ∉ f.vars) :
pderiv i f = 0 :=
derivation_eq_zero_of_forall_mem_vars fun _ hj => pderiv_X_of_ne <| ne_of_mem_of_not_mem hj h
#align mv_polynomial.pderiv_eq_zero_of_not_mem_vars MvPolynomial.pderiv_eq_zero_of_not_mem_vars
| Mathlib/Algebra/MvPolynomial/PDeriv.lean | 111 | 112 | theorem pderiv_monomial_single {i : σ} {n : ℕ} : pderiv i (monomial (single i n) a) =
monomial (single i (n - 1)) (a * n) := by | simp
| 0.59375 |
import Mathlib.CategoryTheory.NatIso
import Mathlib.Logic.Equiv.Defs
#align_import category_theory.functor.fully_faithful from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe v₁ v₂ v₃ u₁ u₂ u₃
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D]
namespace Functor
class Full (F : C ⥤ D) : Prop where
map_surjective {X Y : C} : Function.Surjective (F.map (X := X) (Y := Y))
#align category_theory.full CategoryTheory.Functor.Full
class Faithful (F : C ⥤ D) : Prop where
map_injective : ∀ {X Y : C}, Function.Injective (F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)) := by
aesop_cat
#align category_theory.faithful CategoryTheory.Functor.Faithful
#align category_theory.faithful.map_injective CategoryTheory.Functor.Faithful.map_injective
variable {X Y : C}
theorem map_injective (F : C ⥤ D) [Faithful F] :
Function.Injective <| (F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)) :=
Faithful.map_injective
#align category_theory.functor.map_injective CategoryTheory.Functor.map_injective
lemma map_injective_iff (F : C ⥤ D) [Faithful F] {X Y : C} (f g : X ⟶ Y) :
F.map f = F.map g ↔ f = g :=
⟨fun h => F.map_injective h, fun h => by rw [h]⟩
theorem mapIso_injective (F : C ⥤ D) [Faithful F] :
Function.Injective <| (F.mapIso : (X ≅ Y) → (F.obj X ≅ F.obj Y)) := fun _ _ h =>
Iso.ext (map_injective F (congr_arg Iso.hom h : _))
#align category_theory.functor.map_iso_injective CategoryTheory.Functor.mapIso_injective
theorem map_surjective (F : C ⥤ D) [Full F] :
Function.Surjective (F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)) :=
Full.map_surjective
#align category_theory.functor.map_surjective CategoryTheory.Functor.map_surjective
noncomputable def preimage (F : C ⥤ D) [Full F] (f : F.obj X ⟶ F.obj Y) : X ⟶ Y :=
(F.map_surjective f).choose
#align category_theory.functor.preimage CategoryTheory.Functor.preimage
@[simp]
theorem map_preimage (F : C ⥤ D) [Full F] {X Y : C} (f : F.obj X ⟶ F.obj Y) :
F.map (preimage F f) = f :=
(F.map_surjective f).choose_spec
#align category_theory.functor.image_preimage CategoryTheory.Functor.map_preimage
variable {F : C ⥤ D} [Full F] [F.Faithful] {X Y Z : C}
@[simp]
theorem preimage_id : F.preimage (𝟙 (F.obj X)) = 𝟙 X :=
F.map_injective (by simp)
#align category_theory.preimage_id CategoryTheory.Functor.preimage_id
@[simp]
theorem preimage_comp (f : F.obj X ⟶ F.obj Y) (g : F.obj Y ⟶ F.obj Z) :
F.preimage (f ≫ g) = F.preimage f ≫ F.preimage g :=
F.map_injective (by simp)
#align category_theory.preimage_comp CategoryTheory.Functor.preimage_comp
@[simp]
theorem preimage_map (f : X ⟶ Y) : F.preimage (F.map f) = f :=
F.map_injective (by simp)
#align category_theory.preimage_map CategoryTheory.Functor.preimage_map
variable (F)
@[simps]
noncomputable def preimageIso (f : F.obj X ≅ F.obj Y) :
X ≅ Y where
hom := F.preimage f.hom
inv := F.preimage f.inv
hom_inv_id := F.map_injective (by simp)
inv_hom_id := F.map_injective (by simp)
#align category_theory.functor.preimage_iso CategoryTheory.Functor.preimageIso
#align category_theory.functor.preimage_iso_inv CategoryTheory.Functor.preimageIso_inv
#align category_theory.functor.preimage_iso_hom CategoryTheory.Functor.preimageIso_hom
@[simp]
| Mathlib/CategoryTheory/Functor/FullyFaithful.lean | 125 | 127 | theorem preimageIso_mapIso (f : X ≅ Y) : F.preimageIso (F.mapIso f) = f := by |
ext
simp
| 0.59375 |
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic
#align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473"
open Function
variable {α β : Type*}
section CovariantClassMulLe
variable [LinearOrder α]
section Mul
variable [Mul α]
@[to_additive]
theorem lt_or_lt_of_mul_lt_mul [CovariantClass α α (· * ·) (· ≤ ·)]
[CovariantClass α α (Function.swap (· * ·)) (· ≤ ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ < a₂ * b₂ → a₁ < a₂ ∨ b₁ < b₂ := by
contrapose!
exact fun h => mul_le_mul' h.1 h.2
#align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul
#align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add
@[to_additive]
| Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean | 99 | 103 | theorem le_or_lt_of_mul_le_mul [CovariantClass α α (· * ·) (· ≤ ·)]
[CovariantClass α α (Function.swap (· * ·)) (· < ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ ≤ a₂ * b₂ → a₁ ≤ a₂ ∨ b₁ < b₂ := by |
contrapose!
exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2
| 0.59375 |
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.finset_ops from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
namespace Multiset
open List
variable {α : Type*} [DecidableEq α] {s : Multiset α}
def ndinsert (a : α) (s : Multiset α) : Multiset α :=
Quot.liftOn s (fun l => (l.insert a : Multiset α)) fun _ _ p => Quot.sound (p.insert a)
#align multiset.ndinsert Multiset.ndinsert
@[simp]
theorem coe_ndinsert (a : α) (l : List α) : ndinsert a l = (insert a l : List α) :=
rfl
#align multiset.coe_ndinsert Multiset.coe_ndinsert
@[simp, nolint simpNF] -- Porting note (#10675): dsimp can not prove this
theorem ndinsert_zero (a : α) : ndinsert a 0 = {a} :=
rfl
#align multiset.ndinsert_zero Multiset.ndinsert_zero
@[simp]
theorem ndinsert_of_mem {a : α} {s : Multiset α} : a ∈ s → ndinsert a s = s :=
Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_mem h
#align multiset.ndinsert_of_mem Multiset.ndinsert_of_mem
@[simp]
theorem ndinsert_of_not_mem {a : α} {s : Multiset α} : a ∉ s → ndinsert a s = a ::ₘ s :=
Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_not_mem h
#align multiset.ndinsert_of_not_mem Multiset.ndinsert_of_not_mem
@[simp]
theorem mem_ndinsert {a b : α} {s : Multiset α} : a ∈ ndinsert b s ↔ a = b ∨ a ∈ s :=
Quot.inductionOn s fun _ => mem_insert_iff
#align multiset.mem_ndinsert Multiset.mem_ndinsert
@[simp]
theorem le_ndinsert_self (a : α) (s : Multiset α) : s ≤ ndinsert a s :=
Quot.inductionOn s fun _ => (sublist_insert _ _).subperm
#align multiset.le_ndinsert_self Multiset.le_ndinsert_self
-- Porting note: removing @[simp], simp can prove it
theorem mem_ndinsert_self (a : α) (s : Multiset α) : a ∈ ndinsert a s :=
mem_ndinsert.2 (Or.inl rfl)
#align multiset.mem_ndinsert_self Multiset.mem_ndinsert_self
theorem mem_ndinsert_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ ndinsert b s :=
mem_ndinsert.2 (Or.inr h)
#align multiset.mem_ndinsert_of_mem Multiset.mem_ndinsert_of_mem
@[simp]
| Mathlib/Data/Multiset/FinsetOps.lean | 74 | 75 | theorem length_ndinsert_of_mem {a : α} {s : Multiset α} (h : a ∈ s) :
card (ndinsert a s) = card s := by | simp [h]
| 0.59375 |
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.List.Perm
import Mathlib.Data.List.Range
#align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6"
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
open Nat
namespace List
@[simp]
theorem sublists'_nil : sublists' (@nil α) = [[]] :=
rfl
#align list.sublists'_nil List.sublists'_nil
@[simp]
theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
rfl
#align list.sublists'_singleton List.sublists'_singleton
#noalign list.map_sublists'_aux
#noalign list.sublists'_aux_append
#noalign list.sublists'_aux_eq_sublists'
-- Porting note: Not the same as `sublists'_aux` from Lean3
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) :=
r₁.foldl (init := r₂) fun r l => r ++ [a :: l]
#align list.sublists'_aux List.sublists'Aux
| Mathlib/Data/List/Sublists.lean | 52 | 59 | theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)),
sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray)
(fun r l => r.push (a :: l))).toList := by |
intro r₁ r₂
rw [sublists'Aux, Array.foldl_eq_foldl_data]
have := List.foldl_hom Array.toList (fun r l => r.push (a :: l))
(fun r l => r ++ [a :: l]) r₁ r₂.toArray (by simp)
simpa using this
| 0.59375 |
import Mathlib.SetTheory.Cardinal.Ordinal
#align_import set_theory.cardinal.continuum from "leanprover-community/mathlib"@"e08a42b2dd544cf11eba72e5fc7bf199d4349925"
namespace Cardinal
universe u v
open Cardinal
def continuum : Cardinal.{u} :=
2 ^ ℵ₀
#align cardinal.continuum Cardinal.continuum
scoped notation "𝔠" => Cardinal.continuum
@[simp]
theorem two_power_aleph0 : 2 ^ aleph0.{u} = continuum.{u} :=
rfl
#align cardinal.two_power_aleph_0 Cardinal.two_power_aleph0
@[simp]
theorem lift_continuum : lift.{v} 𝔠 = 𝔠 := by
rw [← two_power_aleph0, lift_two_power, lift_aleph0, two_power_aleph0]
#align cardinal.lift_continuum Cardinal.lift_continuum
@[simp]
theorem continuum_le_lift {c : Cardinal.{u}} : 𝔠 ≤ lift.{v} c ↔ 𝔠 ≤ c := by
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_le]
#align cardinal.continuum_le_lift Cardinal.continuum_le_lift
@[simp]
theorem lift_le_continuum {c : Cardinal.{u}} : lift.{v} c ≤ 𝔠 ↔ c ≤ 𝔠 := by
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_le]
#align cardinal.lift_le_continuum Cardinal.lift_le_continuum
@[simp]
theorem continuum_lt_lift {c : Cardinal.{u}} : 𝔠 < lift.{v} c ↔ 𝔠 < c := by
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_lt]
#align cardinal.continuum_lt_lift Cardinal.continuum_lt_lift
@[simp]
theorem lift_lt_continuum {c : Cardinal.{u}} : lift.{v} c < 𝔠 ↔ c < 𝔠 := by
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_lt]
#align cardinal.lift_lt_continuum Cardinal.lift_lt_continuum
theorem aleph0_lt_continuum : ℵ₀ < 𝔠 :=
cantor ℵ₀
#align cardinal.aleph_0_lt_continuum Cardinal.aleph0_lt_continuum
theorem aleph0_le_continuum : ℵ₀ ≤ 𝔠 :=
aleph0_lt_continuum.le
#align cardinal.aleph_0_le_continuum Cardinal.aleph0_le_continuum
@[simp]
theorem beth_one : beth 1 = 𝔠 := by simpa using beth_succ 0
#align cardinal.beth_one Cardinal.beth_one
theorem nat_lt_continuum (n : ℕ) : ↑n < 𝔠 :=
(nat_lt_aleph0 n).trans aleph0_lt_continuum
#align cardinal.nat_lt_continuum Cardinal.nat_lt_continuum
theorem mk_set_nat : #(Set ℕ) = 𝔠 := by simp
#align cardinal.mk_set_nat Cardinal.mk_set_nat
theorem continuum_pos : 0 < 𝔠 :=
nat_lt_continuum 0
#align cardinal.continuum_pos Cardinal.continuum_pos
theorem continuum_ne_zero : 𝔠 ≠ 0 :=
continuum_pos.ne'
#align cardinal.continuum_ne_zero Cardinal.continuum_ne_zero
| Mathlib/SetTheory/Cardinal/Continuum.lean | 101 | 103 | theorem aleph_one_le_continuum : aleph 1 ≤ 𝔠 := by |
rw [← succ_aleph0]
exact Order.succ_le_of_lt aleph0_lt_continuum
| 0.59375 |
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.Algebra.Order.Group.OrderIso
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.Order.UpperLower.Basic
#align_import algebra.order.upper_lower from "leanprover-community/mathlib"@"c0c52abb75074ed8b73a948341f50521fbf43b4c"
open Function Set
open Pointwise
section OrderedCommGroup
variable {α : Type*} [OrderedCommGroup α] {s t : Set α} {a : α}
@[to_additive]
theorem IsUpperSet.smul (hs : IsUpperSet s) : IsUpperSet (a • s) := hs.image <| OrderIso.mulLeft _
#align is_upper_set.smul IsUpperSet.smul
#align is_upper_set.vadd IsUpperSet.vadd
@[to_additive]
theorem IsLowerSet.smul (hs : IsLowerSet s) : IsLowerSet (a • s) := hs.image <| OrderIso.mulLeft _
#align is_lower_set.smul IsLowerSet.smul
#align is_lower_set.vadd IsLowerSet.vadd
@[to_additive]
theorem Set.OrdConnected.smul (hs : s.OrdConnected) : (a • s).OrdConnected := by
rw [← hs.upperClosure_inter_lowerClosure, smul_set_inter]
exact (upperClosure _).upper.smul.ordConnected.inter (lowerClosure _).lower.smul.ordConnected
#align set.ord_connected.smul Set.OrdConnected.smul
#align set.ord_connected.vadd Set.OrdConnected.vadd
@[to_additive]
theorem IsUpperSet.mul_left (ht : IsUpperSet t) : IsUpperSet (s * t) := by
rw [← smul_eq_mul, ← Set.iUnion_smul_set]
exact isUpperSet_iUnion₂ fun x _ ↦ ht.smul
#align is_upper_set.mul_left IsUpperSet.mul_left
#align is_upper_set.add_left IsUpperSet.add_left
@[to_additive]
| Mathlib/Algebra/Order/UpperLower.lean | 70 | 72 | theorem IsUpperSet.mul_right (hs : IsUpperSet s) : IsUpperSet (s * t) := by |
rw [mul_comm]
exact hs.mul_left
| 0.59375 |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : ℝ) : ℝ :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
theorem logb_zero : logb b 0 = 0 := by simp [logb]
#align real.logb_zero Real.logb_zero
@[simp]
theorem logb_one : logb b 1 = 0 := by simp [logb]
#align real.logb_one Real.logb_one
@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 :=
div_self (log_pos hb).ne'
lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 :=
Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero
@[simp]
theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs]
#align real.logb_abs Real.logb_abs
@[simp]
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 68 | 69 | theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by |
rw [← logb_abs x, ← logb_abs (-x), abs_neg]
| 0.59375 |
import Mathlib.Data.ENNReal.Inv
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
section iInf
variable {ι : Sort*} {f g : ι → ℝ≥0∞}
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
theorem toNNReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toNNReal = ⨅ i, (f i).toNNReal := by
cases isEmpty_or_nonempty ι
· rw [iInf_of_empty, top_toNNReal, NNReal.iInf_empty]
· lift f to ι → ℝ≥0 using hf
simp_rw [← coe_iInf, toNNReal_coe]
#align ennreal.to_nnreal_infi ENNReal.toNNReal_iInf
theorem toNNReal_sInf (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) :
(sInf s).toNNReal = sInf (ENNReal.toNNReal '' s) := by
have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs
-- Porting note: `← sInf_image'` had to be replaced by `← image_eq_range` as the lemmas are used
-- in a different order.
simpa only [← sInf_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iInf hf)
#align ennreal.to_nnreal_Inf ENNReal.toNNReal_sInf
theorem toNNReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toNNReal = ⨆ i, (f i).toNNReal := by
lift f to ι → ℝ≥0 using hf
simp_rw [toNNReal_coe]
by_cases h : BddAbove (range f)
· rw [← coe_iSup h, toNNReal_coe]
· rw [NNReal.iSup_of_not_bddAbove h, iSup_coe_eq_top.2 h, top_toNNReal]
#align ennreal.to_nnreal_supr ENNReal.toNNReal_iSup
theorem toNNReal_sSup (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) :
(sSup s).toNNReal = sSup (ENNReal.toNNReal '' s) := by
have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs
-- Porting note: `← sSup_image'` had to be replaced by `← image_eq_range` as the lemmas are used
-- in a different order.
simpa only [← sSup_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iSup hf)
#align ennreal.to_nnreal_Sup ENNReal.toNNReal_sSup
theorem toReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toReal = ⨅ i, (f i).toReal := by
simp only [ENNReal.toReal, toNNReal_iInf hf, NNReal.coe_iInf]
#align ennreal.to_real_infi ENNReal.toReal_iInf
theorem toReal_sInf (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) :
(sInf s).toReal = sInf (ENNReal.toReal '' s) := by
simp only [ENNReal.toReal, toNNReal_sInf s hf, NNReal.coe_sInf, Set.image_image]
#align ennreal.to_real_Inf ENNReal.toReal_sInf
theorem toReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toReal = ⨆ i, (f i).toReal := by
simp only [ENNReal.toReal, toNNReal_iSup hf, NNReal.coe_iSup]
#align ennreal.to_real_supr ENNReal.toReal_iSup
theorem toReal_sSup (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) :
(sSup s).toReal = sSup (ENNReal.toReal '' s) := by
simp only [ENNReal.toReal, toNNReal_sSup s hf, NNReal.coe_sSup, Set.image_image]
#align ennreal.to_real_Sup ENNReal.toReal_sSup
theorem iInf_add : iInf f + a = ⨅ i, f i + a :=
le_antisymm (le_iInf fun _ => add_le_add (iInf_le _ _) <| le_rfl)
(tsub_le_iff_right.1 <| le_iInf fun _ => tsub_le_iff_right.2 <| iInf_le _ _)
#align ennreal.infi_add ENNReal.iInf_add
theorem iSup_sub : (⨆ i, f i) - a = ⨆ i, f i - a :=
le_antisymm (tsub_le_iff_right.2 <| iSup_le fun i => tsub_le_iff_right.1 <| le_iSup (f · - a) i)
(iSup_le fun _ => tsub_le_tsub (le_iSup _ _) (le_refl a))
#align ennreal.supr_sub ENNReal.iSup_sub
theorem sub_iInf : (a - ⨅ i, f i) = ⨆ i, a - f i := by
refine eq_of_forall_ge_iff fun c => ?_
rw [tsub_le_iff_right, add_comm, iInf_add]
simp [tsub_le_iff_right, sub_eq_add_neg, add_comm]
#align ennreal.sub_infi ENNReal.sub_iInf
theorem sInf_add {s : Set ℝ≥0∞} : sInf s + a = ⨅ b ∈ s, b + a := by simp [sInf_eq_iInf, iInf_add]
#align ennreal.Inf_add ENNReal.sInf_add
| Mathlib/Data/ENNReal/Real.lean | 609 | 610 | theorem add_iInf {a : ℝ≥0∞} : a + iInf f = ⨅ b, a + f b := by |
rw [add_comm, iInf_add]; simp [add_comm]
| 0.59375 |
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Algebra.Module.LinearMap.Basic
import Mathlib.Data.Finset.Preimage
import Mathlib.Data.Set.Finite
import Mathlib.GroupTheory.GroupAction.BigOperators
#align_import data.dfinsupp.basic from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
universe u u₁ u₂ v v₁ v₂ v₃ w x y l
variable {ι : Type u} {γ : Type w} {β : ι → Type v} {β₁ : ι → Type v₁} {β₂ : ι → Type v₂}
variable (β)
structure DFinsupp [∀ i, Zero (β i)] : Type max u v where mk' ::
toFun : ∀ i, β i
support' : Trunc { s : Multiset ι // ∀ i, i ∈ s ∨ toFun i = 0 }
#align dfinsupp DFinsupp
variable {β}
notation3 "Π₀ "(...)", "r:(scoped f => DFinsupp f) => r
namespace DFinsupp
section Basic
variable [∀ i, Zero (β i)] [∀ i, Zero (β₁ i)] [∀ i, Zero (β₂ i)]
instance instDFunLike : DFunLike (Π₀ i, β i) ι β :=
⟨fun f => f.toFun, fun ⟨f₁, s₁⟩ ⟨f₂, s₁⟩ ↦ fun (h : f₁ = f₂) ↦ by
subst h
congr
apply Subsingleton.elim ⟩
#align dfinsupp.fun_like DFinsupp.instDFunLike
instance : CoeFun (Π₀ i, β i) fun _ => ∀ i, β i :=
inferInstance
@[simp]
theorem toFun_eq_coe (f : Π₀ i, β i) : f.toFun = f :=
rfl
#align dfinsupp.to_fun_eq_coe DFinsupp.toFun_eq_coe
@[ext]
theorem ext {f g : Π₀ i, β i} (h : ∀ i, f i = g i) : f = g :=
DFunLike.ext _ _ h
#align dfinsupp.ext DFinsupp.ext
#align dfinsupp.ext_iff DFunLike.ext_iff
#align dfinsupp.coe_fn_injective DFunLike.coe_injective
lemma ne_iff {f g : Π₀ i, β i} : f ≠ g ↔ ∃ i, f i ≠ g i := DFunLike.ne_iff
instance : Zero (Π₀ i, β i) :=
⟨⟨0, Trunc.mk <| ⟨∅, fun _ => Or.inr rfl⟩⟩⟩
instance : Inhabited (Π₀ i, β i) :=
⟨0⟩
@[simp, norm_cast] lemma coe_mk' (f : ∀ i, β i) (s) : ⇑(⟨f, s⟩ : Π₀ i, β i) = f := rfl
#align dfinsupp.coe_mk' DFinsupp.coe_mk'
@[simp, norm_cast] lemma coe_zero : ⇑(0 : Π₀ i, β i) = 0 := rfl
#align dfinsupp.coe_zero DFinsupp.coe_zero
theorem zero_apply (i : ι) : (0 : Π₀ i, β i) i = 0 :=
rfl
#align dfinsupp.zero_apply DFinsupp.zero_apply
def mapRange (f : ∀ i, β₁ i → β₂ i) (hf : ∀ i, f i 0 = 0) (x : Π₀ i, β₁ i) : Π₀ i, β₂ i :=
⟨fun i => f i (x i),
x.support'.map fun s => ⟨s.1, fun i => (s.2 i).imp_right fun h : x i = 0 => by
rw [← hf i, ← h]⟩⟩
#align dfinsupp.map_range DFinsupp.mapRange
@[simp]
theorem mapRange_apply (f : ∀ i, β₁ i → β₂ i) (hf : ∀ i, f i 0 = 0) (g : Π₀ i, β₁ i) (i : ι) :
mapRange f hf g i = f i (g i) :=
rfl
#align dfinsupp.map_range_apply DFinsupp.mapRange_apply
@[simp]
| Mathlib/Data/DFinsupp/Basic.lean | 144 | 147 | theorem mapRange_id (h : ∀ i, id (0 : β₁ i) = 0 := fun i => rfl) (g : Π₀ i : ι, β₁ i) :
mapRange (fun i => (id : β₁ i → β₁ i)) h g = g := by |
ext
rfl
| 0.59375 |
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import linear_algebra.projective_space.basic from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
variable (K V : Type*) [DivisionRing K] [AddCommGroup V] [Module K V]
def projectivizationSetoid : Setoid { v : V // v ≠ 0 } :=
(MulAction.orbitRel Kˣ V).comap (↑)
#align projectivization_setoid projectivizationSetoid
def Projectivization := Quotient (projectivizationSetoid K V)
#align projectivization Projectivization
scoped[LinearAlgebra.Projectivization] notation "ℙ" => Projectivization
namespace Projectivization
open scoped LinearAlgebra.Projectivization
variable {V}
def mk (v : V) (hv : v ≠ 0) : ℙ K V :=
Quotient.mk'' ⟨v, hv⟩
#align projectivization.mk Projectivization.mk
def mk' (v : { v : V // v ≠ 0 }) : ℙ K V :=
Quotient.mk'' v
#align projectivization.mk' Projectivization.mk'
@[simp]
theorem mk'_eq_mk (v : { v : V // v ≠ 0 }) : mk' K v = mk K ↑v v.2 := rfl
#align projectivization.mk'_eq_mk Projectivization.mk'_eq_mk
instance [Nontrivial V] : Nonempty (ℙ K V) :=
let ⟨v, hv⟩ := exists_ne (0 : V)
⟨mk K v hv⟩
variable {K}
protected noncomputable def rep (v : ℙ K V) : V :=
v.out'
#align projectivization.rep Projectivization.rep
theorem rep_nonzero (v : ℙ K V) : v.rep ≠ 0 :=
v.out'.2
#align projectivization.rep_nonzero Projectivization.rep_nonzero
@[simp]
theorem mk_rep (v : ℙ K V) : mk K v.rep v.rep_nonzero = v := Quotient.out_eq' _
#align projectivization.mk_rep Projectivization.mk_rep
open FiniteDimensional
protected def submodule (v : ℙ K V) : Submodule K V :=
(Quotient.liftOn' v fun v => K ∙ (v : V)) <| by
rintro ⟨a, ha⟩ ⟨b, hb⟩ ⟨x, rfl : x • b = a⟩
exact Submodule.span_singleton_group_smul_eq _ x _
#align projectivization.submodule Projectivization.submodule
variable (K)
theorem mk_eq_mk_iff (v w : V) (hv : v ≠ 0) (hw : w ≠ 0) :
mk K v hv = mk K w hw ↔ ∃ a : Kˣ, a • w = v :=
Quotient.eq''
#align projectivization.mk_eq_mk_iff Projectivization.mk_eq_mk_iff
theorem mk_eq_mk_iff' (v w : V) (hv : v ≠ 0) (hw : w ≠ 0) :
mk K v hv = mk K w hw ↔ ∃ a : K, a • w = v := by
rw [mk_eq_mk_iff K v w hv hw]
constructor
· rintro ⟨a, ha⟩
exact ⟨a, ha⟩
· rintro ⟨a, ha⟩
refine ⟨Units.mk0 a fun c => hv.symm ?_, ha⟩
rwa [c, zero_smul] at ha
#align projectivization.mk_eq_mk_iff' Projectivization.mk_eq_mk_iff'
theorem exists_smul_eq_mk_rep (v : V) (hv : v ≠ 0) : ∃ a : Kˣ, a • v = (mk K v hv).rep :=
(mk_eq_mk_iff K _ _ (rep_nonzero _) hv).1 (mk_rep _)
#align projectivization.exists_smul_eq_mk_rep Projectivization.exists_smul_eq_mk_rep
variable {K}
@[elab_as_elim]
theorem ind {P : ℙ K V → Prop} (h : ∀ (v : V) (h : v ≠ 0), P (mk K v h)) : ∀ p, P p :=
Quotient.ind' <| Subtype.rec <| h
#align projectivization.ind Projectivization.ind
@[simp]
theorem submodule_mk (v : V) (hv : v ≠ 0) : (mk K v hv).submodule = K ∙ v :=
rfl
#align projectivization.submodule_mk Projectivization.submodule_mk
| Mathlib/LinearAlgebra/Projectivization/Basic.lean | 137 | 139 | theorem submodule_eq (v : ℙ K V) : v.submodule = K ∙ v.rep := by |
conv_lhs => rw [← v.mk_rep]
rfl
| 0.59375 |
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Analysis.Seminorm
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Analysis.RCLike.Basic
#align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d"
open NormedField Set
open scoped Pointwise Topology NNReal
noncomputable section
variable {𝕜 E F : Type*}
section AddCommGroup
variable [AddCommGroup E] [Module ℝ E]
def gauge (s : Set E) (x : E) : ℝ :=
sInf { r : ℝ | 0 < r ∧ x ∈ r • s }
#align gauge gauge
variable {s t : Set E} {x : E} {a : ℝ}
theorem gauge_def : gauge s x = sInf ({ r ∈ Set.Ioi (0 : ℝ) | x ∈ r • s }) :=
rfl
#align gauge_def gauge_def
theorem gauge_def' : gauge s x = sInf {r ∈ Set.Ioi (0 : ℝ) | r⁻¹ • x ∈ s} := by
congrm sInf {r | ?_}
exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_mem₀ hr.ne' _ _
#align gauge_def' gauge_def'
private theorem gauge_set_bddBelow : BddBelow { r : ℝ | 0 < r ∧ x ∈ r • s } :=
⟨0, fun _ hr => hr.1.le⟩
theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent ℝ s) :
{ r : ℝ | 0 < r ∧ x ∈ r • s }.Nonempty :=
let ⟨r, hr₁, hr₂⟩ := (absorbs x).exists_pos
⟨r, hr₁, hr₂ r (Real.norm_of_nonneg hr₁.le).ge rfl⟩
#align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty
theorem gauge_mono (hs : Absorbent ℝ s) (h : s ⊆ t) : gauge t ≤ gauge s := fun _ =>
csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => ⟨hr.1, smul_set_mono h hr.2⟩
#align gauge_mono gauge_mono
theorem exists_lt_of_gauge_lt (absorbs : Absorbent ℝ s) (h : gauge s x < a) :
∃ b, 0 < b ∧ b < a ∧ x ∈ b • s := by
obtain ⟨b, ⟨hb, hx⟩, hba⟩ := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h
exact ⟨b, hb, hba, hx⟩
#align exists_lt_of_gauge_lt exists_lt_of_gauge_lt
@[simp]
theorem gauge_zero : gauge s 0 = 0 := by
rw [gauge_def']
by_cases h : (0 : E) ∈ s
· simp only [smul_zero, sep_true, h, csInf_Ioi]
· simp only [smul_zero, sep_false, h, Real.sInf_empty]
#align gauge_zero gauge_zero
@[simp]
theorem gauge_zero' : gauge (0 : Set E) = 0 := by
ext x
rw [gauge_def']
obtain rfl | hx := eq_or_ne x 0
· simp only [csInf_Ioi, mem_zero, Pi.zero_apply, eq_self_iff_true, sep_true, smul_zero]
· simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero]
convert Real.sInf_empty
exact eq_empty_iff_forall_not_mem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx
#align gauge_zero' gauge_zero'
@[simp]
theorem gauge_empty : gauge (∅ : Set E) = 0 := by
ext
simp only [gauge_def', Real.sInf_empty, mem_empty_iff_false, Pi.zero_apply, sep_false]
#align gauge_empty gauge_empty
theorem gauge_of_subset_zero (h : s ⊆ 0) : gauge s = 0 := by
obtain rfl | rfl := subset_singleton_iff_eq.1 h
exacts [gauge_empty, gauge_zero']
#align gauge_of_subset_zero gauge_of_subset_zero
theorem gauge_nonneg (x : E) : 0 ≤ gauge s x :=
Real.sInf_nonneg _ fun _ hx => hx.1.le
#align gauge_nonneg gauge_nonneg
theorem gauge_neg (symmetric : ∀ x ∈ s, -x ∈ s) (x : E) : gauge s (-x) = gauge s x := by
have : ∀ x, -x ∈ s ↔ x ∈ s := fun x => ⟨fun h => by simpa using symmetric _ h, symmetric x⟩
simp_rw [gauge_def', smul_neg, this]
#align gauge_neg gauge_neg
theorem gauge_neg_set_neg (x : E) : gauge (-s) (-x) = gauge s x := by
simp_rw [gauge_def', smul_neg, neg_mem_neg]
#align gauge_neg_set_neg gauge_neg_set_neg
| Mathlib/Analysis/Convex/Gauge.lean | 138 | 139 | theorem gauge_neg_set_eq_gauge_neg (x : E) : gauge (-s) x = gauge s (-x) := by |
rw [← gauge_neg_set_neg, neg_neg]
| 0.59375 |
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u w
open CategoryTheory CategoryTheory.Limits
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
open scoped Classical
noncomputable section
section
variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g]
theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g :=
imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp)
#align image_le_kernel image_le_kernel
def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) :=
Subobject.ofLE _ _ (image_le_kernel _ _ w)
#align image_to_kernel imageToKernel
instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by
dsimp only [imageToKernel]
infer_instance
@[simp]
theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) :
Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w :=
rfl
#align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel
attribute [local instance] ConcreteCategory.instFunLike
-- Porting note: removed elementwise attribute which does not seem to be helpful here
-- a more suitable lemma is added below
@[reassoc (attr := simp)]
theorem imageToKernel_arrow (w : f ≫ g = 0) :
imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by
simp [imageToKernel]
#align image_to_kernel_arrow imageToKernel_arrow
@[simp]
lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f ≫ g = 0)
(x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) :
(kernelSubobject g).arrow (imageToKernel f g w x) =
(imageSubobject f).arrow x := by
rw [← comp_apply, imageToKernel_arrow]
-- This is less useful as a `simp` lemma than it initially appears,
-- as it "loses" the information the morphism factors through the image.
theorem factorThruImageSubobject_comp_imageToKernel (w : f ≫ g = 0) :
factorThruImageSubobject f ≫ imageToKernel f g w = factorThruKernelSubobject g f w := by
ext
simp
#align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel
end
section
variable {A B C : V} (f : A ⟶ B) (g : B ⟶ C)
@[simp]
theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} :
imageToKernel (0 : A ⟶ B) g w = 0 := by
ext
simp
#align image_to_kernel_zero_left imageToKernel_zero_left
| Mathlib/Algebra/Homology/ImageToKernel.lean | 101 | 105 | theorem imageToKernel_zero_right [HasImages V] {w} :
imageToKernel f (0 : B ⟶ C) w =
(imageSubobject f).arrow ≫ inv (kernelSubobject (0 : B ⟶ C)).arrow := by |
ext
simp
| 0.59375 |
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Ideal
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.localization.submodule from "leanprover-community/mathlib"@"1ebb20602a8caef435ce47f6373e1aa40851a177"
variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S]
variable [Algebra R S] {P : Type*} [CommRing P]
namespace IsLocalization
-- This was previously a `hasCoe` instance, but if `S = R` then this will loop.
-- It could be a `hasCoeT` instance, but we keep it explicit here to avoid slowing down
-- the rest of the library.
def coeSubmodule (I : Ideal R) : Submodule R S :=
Submodule.map (Algebra.linearMap R S) I
#align is_localization.coe_submodule IsLocalization.coeSubmodule
theorem mem_coeSubmodule (I : Ideal R) {x : S} :
x ∈ coeSubmodule S I ↔ ∃ y : R, y ∈ I ∧ algebraMap R S y = x :=
Iff.rfl
#align is_localization.mem_coe_submodule IsLocalization.mem_coeSubmodule
theorem coeSubmodule_mono {I J : Ideal R} (h : I ≤ J) : coeSubmodule S I ≤ coeSubmodule S J :=
Submodule.map_mono h
#align is_localization.coe_submodule_mono IsLocalization.coeSubmodule_mono
@[simp]
theorem coeSubmodule_bot : coeSubmodule S (⊥ : Ideal R) = ⊥ := by
rw [coeSubmodule, Submodule.map_bot]
#align is_localization.coe_submodule_bot IsLocalization.coeSubmodule_bot
@[simp]
| Mathlib/RingTheory/Localization/Submodule.lean | 53 | 54 | theorem coeSubmodule_top : coeSubmodule S (⊤ : Ideal R) = 1 := by |
rw [coeSubmodule, Submodule.map_top, Submodule.one_eq_range]
| 0.59375 |
import Mathlib.Algebra.Group.Submonoid.Operations
import Mathlib.Algebra.Star.SelfAdjoint
#align_import algebra.star.unitary from "leanprover-community/mathlib"@"247a102b14f3cebfee126293341af5f6bed00237"
def unitary (R : Type*) [Monoid R] [StarMul R] : Submonoid R where
carrier := { U | star U * U = 1 ∧ U * star U = 1 }
one_mem' := by simp only [mul_one, and_self_iff, Set.mem_setOf_eq, star_one]
mul_mem' := @fun U B ⟨hA₁, hA₂⟩ ⟨hB₁, hB₂⟩ => by
refine ⟨?_, ?_⟩
· calc
star (U * B) * (U * B) = star B * star U * U * B := by simp only [mul_assoc, star_mul]
_ = star B * (star U * U) * B := by rw [← mul_assoc]
_ = 1 := by rw [hA₁, mul_one, hB₁]
· calc
U * B * star (U * B) = U * B * (star B * star U) := by rw [star_mul]
_ = U * (B * star B) * star U := by simp_rw [← mul_assoc]
_ = 1 := by rw [hB₂, mul_one, hA₂]
#align unitary unitary
variable {R : Type*}
namespace unitary
section Monoid
variable [Monoid R] [StarMul R]
theorem mem_iff {U : R} : U ∈ unitary R ↔ star U * U = 1 ∧ U * star U = 1 :=
Iff.rfl
#align unitary.mem_iff unitary.mem_iff
@[simp]
theorem star_mul_self_of_mem {U : R} (hU : U ∈ unitary R) : star U * U = 1 :=
hU.1
#align unitary.star_mul_self_of_mem unitary.star_mul_self_of_mem
@[simp]
theorem mul_star_self_of_mem {U : R} (hU : U ∈ unitary R) : U * star U = 1 :=
hU.2
#align unitary.mul_star_self_of_mem unitary.mul_star_self_of_mem
theorem star_mem {U : R} (hU : U ∈ unitary R) : star U ∈ unitary R :=
⟨by rw [star_star, mul_star_self_of_mem hU], by rw [star_star, star_mul_self_of_mem hU]⟩
#align unitary.star_mem unitary.star_mem
@[simp]
theorem star_mem_iff {U : R} : star U ∈ unitary R ↔ U ∈ unitary R :=
⟨fun h => star_star U ▸ star_mem h, star_mem⟩
#align unitary.star_mem_iff unitary.star_mem_iff
instance : Star (unitary R) :=
⟨fun U => ⟨star U, star_mem U.prop⟩⟩
@[simp, norm_cast]
theorem coe_star {U : unitary R} : ↑(star U) = (star U : R) :=
rfl
#align unitary.coe_star unitary.coe_star
theorem coe_star_mul_self (U : unitary R) : (star U : R) * U = 1 :=
star_mul_self_of_mem U.prop
#align unitary.coe_star_mul_self unitary.coe_star_mul_self
theorem coe_mul_star_self (U : unitary R) : (U : R) * star U = 1 :=
mul_star_self_of_mem U.prop
#align unitary.coe_mul_star_self unitary.coe_mul_star_self
@[simp]
theorem star_mul_self (U : unitary R) : star U * U = 1 :=
Subtype.ext <| coe_star_mul_self U
#align unitary.star_mul_self unitary.star_mul_self
@[simp]
theorem mul_star_self (U : unitary R) : U * star U = 1 :=
Subtype.ext <| coe_mul_star_self U
#align unitary.mul_star_self unitary.mul_star_self
instance : Group (unitary R) :=
{ Submonoid.toMonoid _ with
inv := star
mul_left_inv := star_mul_self }
instance : InvolutiveStar (unitary R) :=
⟨by
intro x
ext
rw [coe_star, coe_star, star_star]⟩
instance : StarMul (unitary R) :=
⟨by
intro x y
ext
rw [coe_star, Submonoid.coe_mul, Submonoid.coe_mul, coe_star, coe_star, star_mul]⟩
instance : Inhabited (unitary R) :=
⟨1⟩
theorem star_eq_inv (U : unitary R) : star U = U⁻¹ :=
rfl
#align unitary.star_eq_inv unitary.star_eq_inv
theorem star_eq_inv' : (star : unitary R → unitary R) = Inv.inv :=
rfl
#align unitary.star_eq_inv' unitary.star_eq_inv'
@[simps]
def toUnits : unitary R →* Rˣ where
toFun x := ⟨x, ↑x⁻¹, coe_mul_star_self x, coe_star_mul_self x⟩
map_one' := Units.ext rfl
map_mul' _ _ := Units.ext rfl
#align unitary.to_units unitary.toUnits
theorem toUnits_injective : Function.Injective (toUnits : unitary R → Rˣ) := fun _ _ h =>
Subtype.ext <| Units.ext_iff.mp h
#align unitary.to_units_injective unitary.toUnits_injective
| Mathlib/Algebra/Star/Unitary.lean | 141 | 145 | theorem _root_.IsUnit.mem_unitary_of_star_mul_self {u : R} (hu : IsUnit u)
(h_mul : star u * u = 1) : u ∈ unitary R := by |
refine unitary.mem_iff.mpr ⟨h_mul, ?_⟩
lift u to Rˣ using hu
exact left_inv_eq_right_inv h_mul u.mul_inv ▸ u.mul_inv
| 0.59375 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
⟨fun a b : V ↦ Sum (a ⟶ b) (b ⟶ a)⟩
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : ∀ {a b : V}, (a ⟶ b) → (b ⟶ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a ⟶ b) → (b ⟶ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : ∀ {a b : V} (f : a ⟶ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a ⟶ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 66 | 72 | theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a ⟶ b) : reverse f = reverse g ↔ f = g := by |
constructor
· rintro h
simpa using congr_arg Quiver.reverse h
· rintro h
congr
| 0.59375 |
import Mathlib.Algebra.Quaternion
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.quaternion from "leanprover-community/mathlib"@"07992a1d1f7a4176c6d3f160209608be4e198566"
@[inherit_doc] scoped[Quaternion] notation "ℍ" => Quaternion ℝ
open scoped RealInnerProductSpace
namespace Quaternion
instance : Inner ℝ ℍ :=
⟨fun a b => (a * star b).re⟩
theorem inner_self (a : ℍ) : ⟪a, a⟫ = normSq a :=
rfl
#align quaternion.inner_self Quaternion.inner_self
theorem inner_def (a b : ℍ) : ⟪a, b⟫ = (a * star b).re :=
rfl
#align quaternion.inner_def Quaternion.inner_def
noncomputable instance : NormedAddCommGroup ℍ :=
@InnerProductSpace.Core.toNormedAddCommGroup ℝ ℍ _ _ _
{ toInner := inferInstance
conj_symm := fun x y => by simp [inner_def, mul_comm]
nonneg_re := fun x => normSq_nonneg
definite := fun x => normSq_eq_zero.1
add_left := fun x y z => by simp only [inner_def, add_mul, add_re]
smul_left := fun x y r => by simp [inner_def] }
noncomputable instance : InnerProductSpace ℝ ℍ :=
InnerProductSpace.ofCore _
theorem normSq_eq_norm_mul_self (a : ℍ) : normSq a = ‖a‖ * ‖a‖ := by
rw [← inner_self, real_inner_self_eq_norm_mul_norm]
#align quaternion.norm_sq_eq_norm_sq Quaternion.normSq_eq_norm_mul_self
instance : NormOneClass ℍ :=
⟨by rw [norm_eq_sqrt_real_inner, inner_self, normSq.map_one, Real.sqrt_one]⟩
@[simp, norm_cast]
theorem norm_coe (a : ℝ) : ‖(a : ℍ)‖ = ‖a‖ := by
rw [norm_eq_sqrt_real_inner, inner_self, normSq_coe, Real.sqrt_sq_eq_abs, Real.norm_eq_abs]
#align quaternion.norm_coe Quaternion.norm_coe
@[simp, norm_cast]
theorem nnnorm_coe (a : ℝ) : ‖(a : ℍ)‖₊ = ‖a‖₊ :=
Subtype.ext <| norm_coe a
#align quaternion.nnnorm_coe Quaternion.nnnorm_coe
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
theorem norm_star (a : ℍ) : ‖star a‖ = ‖a‖ := by
simp_rw [norm_eq_sqrt_real_inner, inner_self, normSq_star]
#align quaternion.norm_star Quaternion.norm_star
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
theorem nnnorm_star (a : ℍ) : ‖star a‖₊ = ‖a‖₊ :=
Subtype.ext <| norm_star a
#align quaternion.nnnorm_star Quaternion.nnnorm_star
noncomputable instance : NormedDivisionRing ℍ where
dist_eq _ _ := rfl
norm_mul' a b := by
simp only [norm_eq_sqrt_real_inner, inner_self, normSq.map_mul]
exact Real.sqrt_mul normSq_nonneg _
-- Porting note: added `noncomputable`
noncomputable instance : NormedAlgebra ℝ ℍ where
norm_smul_le := norm_smul_le
toAlgebra := Quaternion.algebra
instance : CstarRing ℍ where
norm_star_mul_self {x} := (norm_mul _ _).trans <| congr_arg (· * ‖x‖) (norm_star x)
@[coe] def coeComplex (z : ℂ) : ℍ := ⟨z.re, z.im, 0, 0⟩
instance : Coe ℂ ℍ := ⟨coeComplex⟩
@[simp, norm_cast]
theorem coeComplex_re (z : ℂ) : (z : ℍ).re = z.re :=
rfl
#align quaternion.coe_complex_re Quaternion.coeComplex_re
@[simp, norm_cast]
theorem coeComplex_imI (z : ℂ) : (z : ℍ).imI = z.im :=
rfl
#align quaternion.coe_complex_im_i Quaternion.coeComplex_imI
@[simp, norm_cast]
theorem coeComplex_imJ (z : ℂ) : (z : ℍ).imJ = 0 :=
rfl
#align quaternion.coe_complex_im_j Quaternion.coeComplex_imJ
@[simp, norm_cast]
theorem coeComplex_imK (z : ℂ) : (z : ℍ).imK = 0 :=
rfl
#align quaternion.coe_complex_im_k Quaternion.coeComplex_imK
@[simp, norm_cast]
| Mathlib/Analysis/Quaternion.lean | 132 | 132 | theorem coeComplex_add (z w : ℂ) : ↑(z + w) = (z + w : ℍ) := by | ext <;> simp
| 0.59375 |
import Mathlib.Data.DFinsupp.Order
#align_import data.dfinsupp.multiset from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
open Function
variable {α : Type*} {β : α → Type*}
namespace Multiset
variable [DecidableEq α] {s t : Multiset α}
def toDFinsupp : Multiset α →+ Π₀ _ : α, ℕ where
toFun s :=
{ toFun := fun n ↦ s.count n
support' := Trunc.mk ⟨s, fun i ↦ (em (i ∈ s)).imp_right Multiset.count_eq_zero_of_not_mem⟩ }
map_zero' := rfl
map_add' _ _ := DFinsupp.ext fun _ ↦ Multiset.count_add _ _ _
#align multiset.to_dfinsupp Multiset.toDFinsupp
@[simp]
theorem toDFinsupp_apply (s : Multiset α) (a : α) : Multiset.toDFinsupp s a = s.count a :=
rfl
#align multiset.to_dfinsupp_apply Multiset.toDFinsupp_apply
@[simp]
theorem toDFinsupp_support (s : Multiset α) : s.toDFinsupp.support = s.toFinset :=
Finset.filter_true_of_mem fun _ hx ↦ count_ne_zero.mpr <| Multiset.mem_toFinset.1 hx
#align multiset.to_dfinsupp_support Multiset.toDFinsupp_support
@[simp]
| Mathlib/Data/DFinsupp/Multiset.lean | 67 | 71 | theorem toDFinsupp_replicate (a : α) (n : ℕ) :
toDFinsupp (Multiset.replicate n a) = DFinsupp.single a n := by |
ext i
dsimp [toDFinsupp]
simp [count_replicate, eq_comm]
| 0.59375 |
import Mathlib.Topology.Separation
import Mathlib.Algebra.BigOperators.Finprod
#align_import topology.algebra.infinite_sum.basic from "leanprover-community/mathlib"@"3b52265189f3fb43aa631edffce5d060fafaf82f"
noncomputable section
open Filter Function
open scoped Topology
variable {α β γ : Type*}
section HasProd
variable [CommMonoid α] [TopologicalSpace α]
@[to_additive "Infinite sum on a topological monoid
The `atTop` filter on `Finset β` is the limit of all finite sets towards the entire type. So we sum
up bigger and bigger sets. This sum operation is invariant under reordering. In particular,
the function `ℕ → ℝ` sending `n` to `(-1)^n / (n+1)` does not have a
sum for this definition, but a series which is absolutely convergent will have the correct sum.
This is based on Mario Carneiro's
[infinite sum `df-tsms` in Metamath](http://us.metamath.org/mpeuni/df-tsms.html).
For the definition and many statements, `α` does not need to be a topological monoid. We only add
this assumption later, for the lemmas where it is relevant."]
def HasProd (f : β → α) (a : α) : Prop :=
Tendsto (fun s : Finset β ↦ ∏ b ∈ s, f b) atTop (𝓝 a)
#align has_sum HasSum
@[to_additive "`Summable f` means that `f` has some (infinite) sum. Use `tsum` to get the value."]
def Multipliable (f : β → α) : Prop :=
∃ a, HasProd f a
#align summable Summable
open scoped Classical in
@[to_additive "`∑' i, f i` is the sum of `f` it exists, or 0 otherwise."]
noncomputable irreducible_def tprod {β} (f : β → α) :=
if h : Multipliable f then
if (mulSupport f).Finite then finprod f
else h.choose
else 1
#align tsum tsum
-- see Note [operator precedence of big operators]
@[inherit_doc tprod]
notation3 "∏' "(...)", "r:67:(scoped f => tprod f) => r
@[inherit_doc tsum]
notation3 "∑' "(...)", "r:67:(scoped f => tsum f) => r
variable {f g : β → α} {a b : α} {s : Finset β}
@[to_additive]
theorem HasProd.multipliable (h : HasProd f a) : Multipliable f :=
⟨a, h⟩
#align has_sum.summable HasSum.summable
@[to_additive]
theorem tprod_eq_one_of_not_multipliable (h : ¬Multipliable f) : ∏' b, f b = 1 := by
simp [tprod_def, h]
#align tsum_eq_zero_of_not_summable tsum_eq_zero_of_not_summable
@[to_additive]
theorem Function.Injective.hasProd_iff {g : γ → β} (hg : Injective g)
(hf : ∀ x, x ∉ Set.range g → f x = 1) : HasProd (f ∘ g) a ↔ HasProd f a := by
simp only [HasProd, Tendsto, comp_apply, hg.map_atTop_finset_prod_eq hf]
#align function.injective.has_sum_iff Function.Injective.hasSum_iff
@[to_additive]
theorem hasProd_subtype_iff_of_mulSupport_subset {s : Set β} (hf : mulSupport f ⊆ s) :
HasProd (f ∘ (↑) : s → α) a ↔ HasProd f a :=
Subtype.coe_injective.hasProd_iff <| by simpa using mulSupport_subset_iff'.1 hf
#align has_sum_subtype_iff_of_support_subset hasSum_subtype_iff_of_support_subset
@[to_additive]
theorem hasProd_fintype [Fintype β] (f : β → α) : HasProd f (∏ b, f b) :=
OrderTop.tendsto_atTop_nhds _
#align has_sum_fintype hasSum_fintype
@[to_additive]
protected theorem Finset.hasProd (s : Finset β) (f : β → α) :
HasProd (f ∘ (↑) : (↑s : Set β) → α) (∏ b ∈ s, f b) := by
rw [← prod_attach]
exact hasProd_fintype _
#align finset.has_sum Finset.hasSum
@[to_additive "If a function `f` vanishes outside of a finite set `s`, then it `HasSum`
`∑ b ∈ s, f b`."]
theorem hasProd_prod_of_ne_finset_one (hf : ∀ b ∉ s, f b = 1) :
HasProd f (∏ b ∈ s, f b) :=
(hasProd_subtype_iff_of_mulSupport_subset <| mulSupport_subset_iff'.2 hf).1 <| s.hasProd f
#align has_sum_sum_of_ne_finset_zero hasSum_sum_of_ne_finset_zero
@[to_additive]
theorem multipliable_of_ne_finset_one (hf : ∀ b ∉ s, f b = 1) : Multipliable f :=
(hasProd_prod_of_ne_finset_one hf).multipliable
#align summable_of_ne_finset_zero summable_of_ne_finset_zero
@[to_additive]
theorem Multipliable.hasProd (ha : Multipliable f) : HasProd f (∏' b, f b) := by
simp only [tprod_def, ha, dite_true]
by_cases H : (mulSupport f).Finite
· simp [H, hasProd_prod_of_ne_finset_one, finprod_eq_prod]
· simpa [H] using ha.choose_spec
#align summable.has_sum Summable.hasSum
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Defs.lean | 174 | 175 | theorem HasProd.unique {a₁ a₂ : α} [T2Space α] : HasProd f a₁ → HasProd f a₂ → a₁ = a₂ := by |
classical exact tendsto_nhds_unique
| 0.59375 |
import Mathlib.Topology.Algebra.UniformGroup
import Mathlib.Topology.UniformSpace.Pi
import Mathlib.Data.Matrix.Basic
#align_import topology.uniform_space.matrix from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Uniformity Topology
variable (m n 𝕜 : Type*) [UniformSpace 𝕜]
namespace Matrix
instance instUniformSpace : UniformSpace (Matrix m n 𝕜) :=
(by infer_instance : UniformSpace (m → n → 𝕜))
instance instUniformAddGroup [AddGroup 𝕜] [UniformAddGroup 𝕜] :
UniformAddGroup (Matrix m n 𝕜) :=
inferInstanceAs <| UniformAddGroup (m → n → 𝕜)
theorem uniformity :
𝓤 (Matrix m n 𝕜) = ⨅ (i : m) (j : n), (𝓤 𝕜).comap fun a => (a.1 i j, a.2 i j) := by
erw [Pi.uniformity]
simp_rw [Pi.uniformity, Filter.comap_iInf, Filter.comap_comap]
rfl
#align matrix.uniformity Matrix.uniformity
| Mathlib/Topology/UniformSpace/Matrix.lean | 37 | 40 | theorem uniformContinuous {β : Type*} [UniformSpace β] {f : β → Matrix m n 𝕜} :
UniformContinuous f ↔ ∀ i j, UniformContinuous fun x => f x i j := by |
simp only [UniformContinuous, Matrix.uniformity, Filter.tendsto_iInf, Filter.tendsto_comap_iff]
apply Iff.intro <;> intro a <;> apply a
| 0.59375 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : ℕ → Prop)
section Count
variable [DecidablePred p]
def count (n : ℕ) : ℕ :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : ℕ) : Fintype { i // i < n ∧ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : ℕ) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : ℕ) : count p n = Fintype.card { k : ℕ // k < n ∧ p k } := by
rw [count_eq_card_filter_range, ← Fintype.card_ofFinset, ← CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : ℕ) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n ↦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : ℕ) : count p (a + b) = count p a + count (fun k ↦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx ⟨c, _, rfl⟩
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : ℕ) : count p (a + b) = count (fun k ↦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : ℕ) :
count p (n + 1) = count (fun k ↦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : ℕ} : count p n < count p (n + 1) ↔ p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
theorem count_succ_eq_succ_count_iff {n : ℕ} : count p (n + 1) = count p n + 1 ↔ p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_succ_count_iff Nat.count_succ_eq_succ_count_iff
| Mathlib/Data/Nat/Count.lean | 110 | 111 | theorem count_succ_eq_count_iff {n : ℕ} : count p (n + 1) = count p n ↔ ¬p n := by |
by_cases h : p n <;> simp [h, count_succ]
| 0.59375 |
import Mathlib.AlgebraicGeometry.AffineScheme
import Mathlib.AlgebraicGeometry.Pullbacks
import Mathlib.CategoryTheory.MorphismProperty.Limits
import Mathlib.Data.List.TFAE
#align_import algebraic_geometry.morphisms.basic from "leanprover-community/mathlib"@"434e2fd21c1900747afc6d13d8be7f4eedba7218"
set_option linter.uppercaseLean3 false
universe u
open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite
noncomputable section
namespace AlgebraicGeometry
def AffineTargetMorphismProperty :=
∀ ⦃X Y : Scheme⦄ (_ : X ⟶ Y) [IsAffine Y], Prop
#align algebraic_geometry.affine_target_morphism_property AlgebraicGeometry.AffineTargetMorphismProperty
protected def Scheme.isIso : MorphismProperty Scheme :=
@IsIso Scheme _
#align algebraic_geometry.Scheme.is_iso AlgebraicGeometry.Scheme.isIso
protected def Scheme.affineTargetIsIso : AffineTargetMorphismProperty := fun _ _ f _ => IsIso f
#align algebraic_geometry.Scheme.affine_target_is_iso AlgebraicGeometry.Scheme.affineTargetIsIso
instance : Inhabited AffineTargetMorphismProperty := ⟨Scheme.affineTargetIsIso⟩
def AffineTargetMorphismProperty.toProperty (P : AffineTargetMorphismProperty) :
MorphismProperty Scheme := fun _ _ f => ∃ h, @P _ _ f h
#align algebraic_geometry.affine_target_morphism_property.to_property AlgebraicGeometry.AffineTargetMorphismProperty.toProperty
theorem AffineTargetMorphismProperty.toProperty_apply (P : AffineTargetMorphismProperty)
{X Y : Scheme} (f : X ⟶ Y) [i : IsAffine Y] : P.toProperty f ↔ P f := by
delta AffineTargetMorphismProperty.toProperty; simp [*]
#align algebraic_geometry.affine_target_morphism_property.to_property_apply AlgebraicGeometry.AffineTargetMorphismProperty.toProperty_apply
theorem affine_cancel_left_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso)
{X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso f] [IsAffine Z] : P (f ≫ g) ↔ P g := by
rw [← P.toProperty_apply, ← P.toProperty_apply, hP.cancel_left_isIso]
#align algebraic_geometry.affine_cancel_left_is_iso AlgebraicGeometry.affine_cancel_left_isIso
| Mathlib/AlgebraicGeometry/Morphisms/Basic.lean | 104 | 106 | theorem affine_cancel_right_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso)
{X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso g] [IsAffine Z] [IsAffine Y] :
P (f ≫ g) ↔ P f := by | rw [← P.toProperty_apply, ← P.toProperty_apply, hP.cancel_right_isIso]
| 0.59375 |
import Mathlib.Analysis.Convex.Function
import Mathlib.Analysis.Convex.StrictConvexSpace
import Mathlib.MeasureTheory.Function.AEEqOfIntegral
import Mathlib.MeasureTheory.Integral.Average
#align_import analysis.convex.integral from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open 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 : Set E} {t : Set α} {f : α → E} {g : E → ℝ} {C : ℝ}
theorem Convex.integral_mem [IsProbabilityMeasure μ] (hs : Convex ℝ s) (hsc : IsClosed s)
(hf : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) : (∫ x, f x ∂μ) ∈ s := by
borelize E
rcases hfi.aestronglyMeasurable with ⟨g, hgm, hfg⟩
haveI : SeparableSpace (range g ∩ s : Set E) :=
(hgm.isSeparable_range.mono inter_subset_left).separableSpace
obtain ⟨y₀, h₀⟩ : (range g ∩ s).Nonempty := by
rcases (hf.and hfg).exists with ⟨x₀, h₀⟩
exact ⟨f x₀, by simp only [h₀.2, mem_range_self], h₀.1⟩
rw [integral_congr_ae hfg]; rw [integrable_congr hfg] at hfi
have hg : ∀ᵐ x ∂μ, g x ∈ closure (range g ∩ s) := by
filter_upwards [hfg.rw (fun _ y => y ∈ s) hf] with x hx
apply subset_closure
exact ⟨mem_range_self _, hx⟩
set G : ℕ → SimpleFunc α E := SimpleFunc.approxOn _ hgm.measurable (range g ∩ s) y₀ h₀
have : Tendsto (fun n => (G n).integral μ) atTop (𝓝 <| ∫ x, g x ∂μ) :=
tendsto_integral_approxOn_of_measurable hfi _ hg _ (integrable_const _)
refine hsc.mem_of_tendsto this (eventually_of_forall fun n => hs.sum_mem ?_ ?_ ?_)
· exact fun _ _ => ENNReal.toReal_nonneg
· rw [← ENNReal.toReal_sum, (G n).sum_range_measure_preimage_singleton, measure_univ,
ENNReal.one_toReal]
exact fun _ _ => measure_ne_top _ _
· simp only [SimpleFunc.mem_range, forall_mem_range]
intro x
apply (range g).inter_subset_right
exact SimpleFunc.approxOn_mem hgm.measurable h₀ _ _
#align convex.integral_mem Convex.integral_mem
theorem Convex.average_mem [IsFiniteMeasure μ] [NeZero μ] (hs : Convex ℝ s) (hsc : IsClosed s)
(hfs : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) : (⨍ x, f x ∂μ) ∈ s := by
refine hs.integral_mem hsc (ae_mono' ?_ hfs) hfi.to_average
exact AbsolutelyContinuous.smul (refl _) _
#align convex.average_mem Convex.average_mem
theorem Convex.set_average_mem (hs : Convex ℝ s) (hsc : IsClosed s) (h0 : μ t ≠ 0) (ht : μ t ≠ ∞)
(hfs : ∀ᵐ x ∂μ.restrict t, f x ∈ s) (hfi : IntegrableOn f t μ) : (⨍ x in t, f x ∂μ) ∈ s :=
have := Fact.mk ht.lt_top
have := NeZero.mk h0
hs.average_mem hsc hfs hfi
#align convex.set_average_mem Convex.set_average_mem
theorem Convex.set_average_mem_closure (hs : Convex ℝ s) (h0 : μ t ≠ 0) (ht : μ t ≠ ∞)
(hfs : ∀ᵐ x ∂μ.restrict t, f x ∈ s) (hfi : IntegrableOn f t μ) :
(⨍ x in t, f x ∂μ) ∈ closure s :=
hs.closure.set_average_mem isClosed_closure h0 ht (hfs.mono fun _ hx => subset_closure hx) hfi
#align convex.set_average_mem_closure Convex.set_average_mem_closure
theorem ConvexOn.average_mem_epigraph [IsFiniteMeasure μ] [NeZero μ] (hg : ConvexOn ℝ s g)
(hgc : ContinuousOn g s) (hsc : IsClosed s) (hfs : ∀ᵐ x ∂μ, f x ∈ s)
(hfi : Integrable f μ) (hgi : Integrable (g ∘ f) μ) :
(⨍ x, f x ∂μ, ⨍ x, g (f x) ∂μ) ∈ {p : E × ℝ | p.1 ∈ s ∧ g p.1 ≤ p.2} := by
have ht_mem : ∀ᵐ x ∂μ, (f x, g (f x)) ∈ {p : E × ℝ | p.1 ∈ s ∧ g p.1 ≤ p.2} :=
hfs.mono fun x hx => ⟨hx, le_rfl⟩
exact average_pair hfi hgi ▸
hg.convex_epigraph.average_mem (hsc.epigraph hgc) ht_mem (hfi.prod_mk hgi)
#align convex_on.average_mem_epigraph ConvexOn.average_mem_epigraph
| Mathlib/Analysis/Convex/Integral.lean | 122 | 127 | theorem ConcaveOn.average_mem_hypograph [IsFiniteMeasure μ] [NeZero μ] (hg : ConcaveOn ℝ s g)
(hgc : ContinuousOn g s) (hsc : IsClosed s) (hfs : ∀ᵐ x ∂μ, f x ∈ s)
(hfi : Integrable f μ) (hgi : Integrable (g ∘ f) μ) :
(⨍ x, f x ∂μ, ⨍ x, g (f x) ∂μ) ∈ {p : E × ℝ | p.1 ∈ s ∧ p.2 ≤ g p.1} := by |
simpa only [mem_setOf_eq, Pi.neg_apply, average_neg, neg_le_neg_iff] using
hg.neg.average_mem_epigraph hgc.neg hsc hfs hfi hgi.neg
| 0.59375 |
import Mathlib.Algebra.Order.Floor
import Mathlib.Topology.Algebra.Order.Group
import Mathlib.Topology.Order.Basic
#align_import topology.algebra.order.floor from "leanprover-community/mathlib"@"84dc0bd6619acaea625086d6f53cb35cdd554219"
open Filter Function Int Set Topology
variable {α β γ : Type*} [LinearOrderedRing α] [FloorRing α]
theorem tendsto_floor_atTop : Tendsto (floor : α → ℤ) atTop atTop :=
floor_mono.tendsto_atTop_atTop fun b =>
⟨(b + 1 : ℤ), by rw [floor_intCast]; exact (lt_add_one _).le⟩
#align tendsto_floor_at_top tendsto_floor_atTop
theorem tendsto_floor_atBot : Tendsto (floor : α → ℤ) atBot atBot :=
floor_mono.tendsto_atBot_atBot fun b => ⟨b, (floor_intCast _).le⟩
#align tendsto_floor_at_bot tendsto_floor_atBot
theorem tendsto_ceil_atTop : Tendsto (ceil : α → ℤ) atTop atTop :=
ceil_mono.tendsto_atTop_atTop fun b => ⟨b, (ceil_intCast _).ge⟩
#align tendsto_ceil_at_top tendsto_ceil_atTop
theorem tendsto_ceil_atBot : Tendsto (ceil : α → ℤ) atBot atBot :=
ceil_mono.tendsto_atBot_atBot fun b =>
⟨(b - 1 : ℤ), by rw [ceil_intCast]; exact (sub_one_lt _).le⟩
#align tendsto_ceil_at_bot tendsto_ceil_atBot
variable [TopologicalSpace α]
theorem continuousOn_floor (n : ℤ) :
ContinuousOn (fun x => floor x : α → α) (Ico n (n + 1) : Set α) :=
(continuousOn_congr <| floor_eq_on_Ico' n).mpr continuousOn_const
#align continuous_on_floor continuousOn_floor
theorem continuousOn_ceil (n : ℤ) :
ContinuousOn (fun x => ceil x : α → α) (Ioc (n - 1) n : Set α) :=
(continuousOn_congr <| ceil_eq_on_Ioc' n).mpr continuousOn_const
#align continuous_on_ceil continuousOn_ceil
section OrderClosedTopology
variable [OrderClosedTopology α]
-- Porting note (#10756): new theorem
theorem tendsto_floor_right_pure_floor (x : α) : Tendsto (floor : α → ℤ) (𝓝[≥] x) (pure ⌊x⌋) :=
tendsto_pure.2 <| mem_of_superset (Ico_mem_nhdsWithin_Ici' <| lt_floor_add_one x) fun _y hy =>
floor_eq_on_Ico _ _ ⟨(floor_le x).trans hy.1, hy.2⟩
-- Porting note (#10756): new theorem
| Mathlib/Topology/Algebra/Order/Floor.lean | 74 | 75 | theorem tendsto_floor_right_pure (n : ℤ) : Tendsto (floor : α → ℤ) (𝓝[≥] n) (pure n) := by |
simpa only [floor_intCast] using tendsto_floor_right_pure_floor (n : α)
| 0.59375 |
import Mathlib.CategoryTheory.ConcreteCategory.Basic
import Mathlib.CategoryTheory.Limits.Preserves.Basic
import Mathlib.CategoryTheory.Limits.TypesFiltered
import Mathlib.CategoryTheory.Limits.Yoneda
import Mathlib.Tactic.ApplyFun
#align_import category_theory.limits.concrete_category from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
universe t w v u r
open CategoryTheory
namespace CategoryTheory.Limits
attribute [local instance] ConcreteCategory.instFunLike ConcreteCategory.hasCoeToSort
section Colimits
section
variable {C : Type u} [Category.{v} C] [ConcreteCategory.{t} C] {J : Type w} [Category.{r} J]
(F : J ⥤ C) [PreservesColimit F (forget C)]
theorem Concrete.from_union_surjective_of_isColimit {D : Cocone F} (hD : IsColimit D) :
let ff : (Σj : J, F.obj j) → D.pt := fun a => D.ι.app a.1 a.2
Function.Surjective ff := by
intro ff x
let E : Cocone (F ⋙ forget C) := (forget C).mapCocone D
let hE : IsColimit E := isColimitOfPreserves (forget C) hD
obtain ⟨j, y, hy⟩ := Types.jointly_surjective_of_isColimit hE x
exact ⟨⟨j, y⟩, hy⟩
#align category_theory.limits.concrete.from_union_surjective_of_is_colimit CategoryTheory.Limits.Concrete.from_union_surjective_of_isColimit
| Mathlib/CategoryTheory/Limits/ConcreteCategory.lean | 86 | 89 | theorem Concrete.isColimit_exists_rep {D : Cocone F} (hD : IsColimit D) (x : D.pt) :
∃ (j : J) (y : F.obj j), D.ι.app j y = x := by |
obtain ⟨a, rfl⟩ := Concrete.from_union_surjective_of_isColimit F hD x
exact ⟨a.1, a.2, rfl⟩
| 0.59375 |
import Mathlib.MeasureTheory.Function.L1Space
import Mathlib.MeasureTheory.Function.SimpleFuncDense
#align_import measure_theory.function.simple_func_dense_lp from "leanprover-community/mathlib"@"5a2df4cd59cb31e97a516d4603a14bed5c2f9425"
noncomputable section
set_option linter.uppercaseLean3 false
open Set Function Filter TopologicalSpace ENNReal EMetric Finset
open scoped Classical Topology ENNReal MeasureTheory
variable {α β ι E F 𝕜 : Type*}
namespace MeasureTheory
local infixr:25 " →ₛ " => SimpleFunc
namespace SimpleFunc
section Lp
variable [MeasurableSpace β] [MeasurableSpace E] [NormedAddCommGroup E] [NormedAddCommGroup F]
{q : ℝ} {p : ℝ≥0∞}
theorem nnnorm_approxOn_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E}
{y₀ : E} (h₀ : y₀ ∈ s) [SeparableSpace s] (x : β) (n : ℕ) :
‖approxOn f hf s y₀ h₀ n x - f x‖₊ ≤ ‖f x - y₀‖₊ := by
have := edist_approxOn_le hf h₀ x n
rw [edist_comm y₀] at this
simp only [edist_nndist, nndist_eq_nnnorm] at this
exact mod_cast this
#align measure_theory.simple_func.nnnorm_approx_on_le MeasureTheory.SimpleFunc.nnnorm_approxOn_le
| Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean | 77 | 82 | theorem norm_approxOn_y₀_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E}
{y₀ : E} (h₀ : y₀ ∈ s) [SeparableSpace s] (x : β) (n : ℕ) :
‖approxOn f hf s y₀ h₀ n x - y₀‖ ≤ ‖f x - y₀‖ + ‖f x - y₀‖ := by |
have := edist_approxOn_y0_le hf h₀ x n
repeat rw [edist_comm y₀, edist_eq_coe_nnnorm_sub] at this
exact mod_cast this
| 0.59375 |
import Mathlib.Algebra.Periodic
import Mathlib.Data.Nat.Count
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Interval.Finset.Nat
#align_import data.nat.periodic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
namespace Nat
open Nat Function
| Mathlib/Data/Nat/Periodic.lean | 25 | 26 | theorem periodic_gcd (a : ℕ) : Periodic (gcd a) a := by |
simp only [forall_const, gcd_add_self_right, eq_self_iff_true, Periodic]
| 0.59375 |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af"
variable {l m n α : Type*}
namespace Matrix
open scoped Matrix
section CommRing
variable [Fintype l] [Fintype m] [Fintype n]
variable [DecidableEq l] [DecidableEq m] [DecidableEq n]
variable [CommRing α]
theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix l m α)
(D : Matrix l n α) [Invertible A] :
fromBlocks A B C D =
fromBlocks 1 0 (C * ⅟ A) 1 * fromBlocks A 0 0 (D - C * ⅟ A * B) *
fromBlocks 1 (⅟ A * B) 0 1 := by
simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add,
Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc,
Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel]
#align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁
theorem fromBlocks_eq_of_invertible₂₂ (A : Matrix l m α) (B : Matrix l n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
fromBlocks A B C D =
fromBlocks 1 (B * ⅟ D) 0 1 * fromBlocks (A - B * ⅟ D * C) 0 0 D *
fromBlocks 1 0 (⅟ D * C) 1 :=
(Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by
simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ←
submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply,
fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A
#align matrix.from_blocks_eq_of_invertible₂₂ Matrix.fromBlocks_eq_of_invertible₂₂
section StarOrderedRing
variable {𝕜 : Type*} [CommRing 𝕜] [PartialOrder 𝕜] [StarRing 𝕜] [StarOrderedRing 𝕜]
scoped infixl:65 " ⊕ᵥ " => Sum.elim
theorem schur_complement_eq₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m 𝕜}
(B : Matrix m n 𝕜) (D : Matrix n n 𝕜) (x : m → 𝕜) (y : n → 𝕜) [Invertible A]
(hA : A.IsHermitian) :
(star (x ⊕ᵥ y)) ᵥ* (fromBlocks A B Bᴴ D) ⬝ᵥ (x ⊕ᵥ y) =
(star (x + (A⁻¹ * B) *ᵥ y)) ᵥ* A ⬝ᵥ (x + (A⁻¹ * B) *ᵥ y) +
(star y) ᵥ* (D - Bᴴ * A⁻¹ * B) ⬝ᵥ y := by
simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul,
dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hA.eq,
conjTranspose_nonsing_inv, star_mulVec]
abel
#align matrix.schur_complement_eq₁₁ Matrix.schur_complement_eq₁₁
| Mathlib/LinearAlgebra/Matrix/SchurComplement.lean | 494 | 503 | theorem schur_complement_eq₂₂ [Fintype m] [Fintype n] [DecidableEq n] (A : Matrix m m 𝕜)
(B : Matrix m n 𝕜) {D : Matrix n n 𝕜} (x : m → 𝕜) (y : n → 𝕜) [Invertible D]
(hD : D.IsHermitian) :
(star (x ⊕ᵥ y)) ᵥ* (fromBlocks A B Bᴴ D) ⬝ᵥ (x ⊕ᵥ y) =
(star ((D⁻¹ * Bᴴ) *ᵥ x + y)) ᵥ* D ⬝ᵥ ((D⁻¹ * Bᴴ) *ᵥ x + y) +
(star x) ᵥ* (A - B * D⁻¹ * Bᴴ) ⬝ᵥ x := by |
simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul,
dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hD.eq,
conjTranspose_nonsing_inv, star_mulVec]
abel
| 0.59375 |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.Ring.Int
#align_import algebra.field.power from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae"
variable {α : Type*}
section DivisionRing
variable [DivisionRing α] {n : ℤ}
theorem Odd.neg_zpow (h : Odd n) (a : α) : (-a) ^ n = -a ^ n := by
have hn : n ≠ 0 := by rintro rfl; exact Int.odd_iff_not_even.1 h even_zero
obtain ⟨k, rfl⟩ := h
simp_rw [zpow_add' (.inr (.inl hn)), zpow_one, zpow_mul, zpow_two, neg_mul_neg,
neg_mul_eq_mul_neg]
#align odd.neg_zpow Odd.neg_zpow
| Mathlib/Algebra/Field/Power.lean | 33 | 33 | theorem Odd.neg_one_zpow (h : Odd n) : (-1 : α) ^ n = -1 := by | rw [h.neg_zpow, one_zpow]
| 0.59375 |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section HeytingAlgebra
variable [HeytingAlgebra α] (a : α)
@[simp]
| Mathlib/Order/SymmDiff.lean | 371 | 371 | theorem bihimp_bot : a ⇔ ⊥ = aᶜ := by | simp [bihimp]
| 0.59375 |
import Mathlib.Order.Disjoint
#align_import order.prop_instances from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
instance Prop.instDistribLattice : DistribLattice Prop where
sup := Or
le_sup_left := @Or.inl
le_sup_right := @Or.inr
sup_le := fun _ _ _ => Or.rec
inf := And
inf_le_left := @And.left
inf_le_right := @And.right
le_inf := fun _ _ _ Hab Hac Ha => And.intro (Hab Ha) (Hac Ha)
le_sup_inf := fun _ _ _ => or_and_left.2
#align Prop.distrib_lattice Prop.instDistribLattice
instance Prop.instBoundedOrder : BoundedOrder Prop where
top := True
le_top _ _ := True.intro
bot := False
bot_le := @False.elim
#align Prop.bounded_order Prop.instBoundedOrder
@[simp]
theorem Prop.bot_eq_false : (⊥ : Prop) = False :=
rfl
#align Prop.bot_eq_false Prop.bot_eq_false
@[simp]
theorem Prop.top_eq_true : (⊤ : Prop) = True :=
rfl
#align Prop.top_eq_true Prop.top_eq_true
instance Prop.le_isTotal : IsTotal Prop (· ≤ ·) :=
⟨fun p q => by by_cases h : q <;> simp [h]⟩
#align Prop.le_is_total Prop.le_isTotal
noncomputable instance Prop.linearOrder : LinearOrder Prop := by
classical
exact Lattice.toLinearOrder Prop
#align Prop.linear_order Prop.linearOrder
@[simp]
theorem sup_Prop_eq : (· ⊔ ·) = (· ∨ ·) :=
rfl
#align sup_Prop_eq sup_Prop_eq
@[simp]
theorem inf_Prop_eq : (· ⊓ ·) = (· ∧ ·) :=
rfl
#align inf_Prop_eq inf_Prop_eq
namespace Pi
variable {ι : Type*} {α' : ι → Type*} [∀ i, PartialOrder (α' i)]
theorem disjoint_iff [∀ i, OrderBot (α' i)] {f g : ∀ i, α' i} :
Disjoint f g ↔ ∀ i, Disjoint (f i) (g i) := by
classical
constructor
· intro h i x hf hg
exact (update_le_iff.mp <| h (update_le_iff.mpr ⟨hf, fun _ _ => bot_le⟩)
(update_le_iff.mpr ⟨hg, fun _ _ => bot_le⟩)).1
· intro h x hf hg i
apply h i (hf i) (hg i)
#align pi.disjoint_iff Pi.disjoint_iff
theorem codisjoint_iff [∀ i, OrderTop (α' i)] {f g : ∀ i, α' i} :
Codisjoint f g ↔ ∀ i, Codisjoint (f i) (g i) :=
@disjoint_iff _ (fun i => (α' i)ᵒᵈ) _ _ _ _
#align pi.codisjoint_iff Pi.codisjoint_iff
| Mathlib/Order/PropInstances.lean | 88 | 90 | theorem isCompl_iff [∀ i, BoundedOrder (α' i)] {f g : ∀ i, α' i} :
IsCompl f g ↔ ∀ i, IsCompl (f i) (g i) := by |
simp_rw [_root_.isCompl_iff, disjoint_iff, codisjoint_iff, forall_and]
| 0.59375 |
import Mathlib.GroupTheory.Coxeter.Length
import Mathlib.Data.ZMod.Parity
namespace CoxeterSystem
open List Matrix Function
variable {B : Type*}
variable {W : Type*} [Group W]
variable {M : CoxeterMatrix B} (cs : CoxeterSystem M W)
local prefix:100 "s" => cs.simple
local prefix:100 "π" => cs.wordProd
local prefix:100 "ℓ" => cs.length
def IsReflection (t : W) : Prop := ∃ w i, t = w * s i * w⁻¹
theorem isReflection_simple (i : B) : cs.IsReflection (s i) := by use 1, i; simp
namespace IsReflection
variable {cs}
variable {t : W} (ht : cs.IsReflection t)
| Mathlib/GroupTheory/Coxeter/Inversion.lean | 68 | 70 | theorem pow_two : t ^ 2 = 1 := by |
rcases ht with ⟨w, i, rfl⟩
simp
| 0.59375 |
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic
#align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473"
open Function
variable {α β : Type*}
section CovariantClassMulLe
variable [LinearOrder α]
section Mul
variable [Mul α]
@[to_additive]
theorem lt_or_lt_of_mul_lt_mul [CovariantClass α α (· * ·) (· ≤ ·)]
[CovariantClass α α (Function.swap (· * ·)) (· ≤ ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ < a₂ * b₂ → a₁ < a₂ ∨ b₁ < b₂ := by
contrapose!
exact fun h => mul_le_mul' h.1 h.2
#align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul
#align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add
@[to_additive]
theorem le_or_lt_of_mul_le_mul [CovariantClass α α (· * ·) (· ≤ ·)]
[CovariantClass α α (Function.swap (· * ·)) (· < ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ ≤ a₂ * b₂ → a₁ ≤ a₂ ∨ b₁ < b₂ := by
contrapose!
exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2
#align le_or_lt_of_mul_le_mul le_or_lt_of_mul_le_mul
#align le_or_lt_of_add_le_add le_or_lt_of_add_le_add
@[to_additive]
theorem lt_or_le_of_mul_le_mul [CovariantClass α α (· * ·) (· < ·)]
[CovariantClass α α (Function.swap (· * ·)) (· ≤ ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ ≤ a₂ * b₂ → a₁ < a₂ ∨ b₁ ≤ b₂ := by
contrapose!
exact fun h => mul_lt_mul_of_le_of_lt h.1 h.2
#align lt_or_le_of_mul_le_mul lt_or_le_of_mul_le_mul
#align lt_or_le_of_add_le_add lt_or_le_of_add_le_add
@[to_additive]
theorem le_or_le_of_mul_le_mul [CovariantClass α α (· * ·) (· < ·)]
[CovariantClass α α (Function.swap (· * ·)) (· < ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ ≤ a₂ * b₂ → a₁ ≤ a₂ ∨ b₁ ≤ b₂ := by
contrapose!
exact fun h => mul_lt_mul_of_lt_of_lt h.1 h.2
#align le_or_le_of_mul_le_mul le_or_le_of_mul_le_mul
#align le_or_le_of_add_le_add le_or_le_of_add_le_add
@[to_additive]
| Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean | 126 | 133 | theorem mul_lt_mul_iff_of_le_of_le [CovariantClass α α (· * ·) (· ≤ ·)]
[CovariantClass α α (Function.swap (· * ·)) (· ≤ ·)] [CovariantClass α α (· * ·) (· < ·)]
[CovariantClass α α (Function.swap (· * ·)) (· < ·)] {a₁ a₂ b₁ b₂ : α} (ha : a₁ ≤ a₂)
(hb : b₁ ≤ b₂) : a₁ * b₁ < a₂ * b₂ ↔ a₁ < a₂ ∨ b₁ < b₂ := by |
refine ⟨lt_or_lt_of_mul_lt_mul, fun h => ?_⟩
cases' h with ha' hb'
· exact mul_lt_mul_of_lt_of_le ha' hb
· exact mul_lt_mul_of_le_of_lt ha hb'
| 0.59375 |
import Mathlib.Algebra.MonoidAlgebra.Degree
import Mathlib.Algebra.MvPolynomial.Rename
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Degrees
def degrees (p : MvPolynomial σ R) : Multiset σ :=
letI := Classical.decEq σ
p.support.sup fun s : σ →₀ ℕ => toMultiset s
#align mv_polynomial.degrees MvPolynomial.degrees
| Mathlib/Algebra/MvPolynomial/Degrees.lean | 84 | 85 | theorem degrees_def [DecidableEq σ] (p : MvPolynomial σ R) :
p.degrees = p.support.sup fun s : σ →₀ ℕ => Finsupp.toMultiset s := by | rw [degrees]; convert rfl
| 0.59375 |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticReciprocity
#align_import number_theory.legendre_symbol.jacobi_symbol from "leanprover-community/mathlib"@"74a27133cf29446a0983779e37c8f829a85368f3"
section Jacobi
open Nat ZMod
-- Since we need the fact that the factors are prime, we use `List.pmap`.
def jacobiSym (a : ℤ) (b : ℕ) : ℤ :=
(b.factors.pmap (fun p pp => @legendreSym p ⟨pp⟩ a) fun _ pf => prime_of_mem_factors pf).prod
#align jacobi_sym jacobiSym
-- Notation for the Jacobi symbol.
@[inherit_doc]
scoped[NumberTheorySymbols] notation "J(" a " | " b ")" => jacobiSym a b
-- Porting note: Without the following line, Lean expected `|` on several lines, e.g. line 102.
open NumberTheorySymbols
namespace jacobiSym
@[simp]
| Mathlib/NumberTheory/LegendreSymbol/JacobiSymbol.lean | 104 | 105 | theorem zero_right (a : ℤ) : J(a | 0) = 1 := by |
simp only [jacobiSym, factors_zero, List.prod_nil, List.pmap]
| 0.59375 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {α : Type*} {β : Type*}
local notation "𝕎" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x =>
⟨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R →+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;>
ext ⟨i, k⟩ <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac
#align witt_vector.map_fun.mul WittVector.mapFun.mul
| Mathlib/RingTheory/WittVector/Basic.lean | 117 | 117 | theorem neg : mapFun f (-x) = -mapFun f x := by | map_fun_tac
| 0.59375 |
import Mathlib.Algebra.BigOperators.Group.Finset
#align_import data.nat.gcd.big_operators from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace Nat
variable {ι : Type*}
theorem coprime_list_prod_left_iff {l : List ℕ} {k : ℕ} :
Coprime l.prod k ↔ ∀ n ∈ l, Coprime n k := by
induction l <;> simp [Nat.coprime_mul_iff_left, *]
theorem coprime_list_prod_right_iff {k : ℕ} {l : List ℕ} :
Coprime k l.prod ↔ ∀ n ∈ l, Coprime k n := by
simp_rw [coprime_comm (n := k), coprime_list_prod_left_iff]
theorem coprime_multiset_prod_left_iff {m : Multiset ℕ} {k : ℕ} :
Coprime m.prod k ↔ ∀ n ∈ m, Coprime n k := by
induction m using Quotient.inductionOn; simpa using coprime_list_prod_left_iff
theorem coprime_multiset_prod_right_iff {k : ℕ} {m : Multiset ℕ} :
Coprime k m.prod ↔ ∀ n ∈ m, Coprime k n := by
induction m using Quotient.inductionOn; simpa using coprime_list_prod_right_iff
| Mathlib/Data/Nat/GCD/BigOperators.lean | 36 | 38 | theorem coprime_prod_left_iff {t : Finset ι} {s : ι → ℕ} {x : ℕ} :
Coprime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, Coprime (s i) x := by |
simpa using coprime_multiset_prod_left_iff (m := t.val.map s)
| 0.59375 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : ∀ n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : ∀ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
| Mathlib/Data/Nat/Size.lean | 38 | 39 | theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by |
induction n <;> simp [bit_ne_zero, shiftLeft', *]
| 0.59375 |
import Mathlib.Order.Interval.Set.OrdConnected
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.ord_connected_component from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open Interval Function OrderDual
namespace Set
variable {α : Type*} [LinearOrder α] {s t : Set α} {x y z : α}
def ordConnectedComponent (s : Set α) (x : α) : Set α :=
{ y | [[x, y]] ⊆ s }
#align set.ord_connected_component Set.ordConnectedComponent
theorem mem_ordConnectedComponent : y ∈ ordConnectedComponent s x ↔ [[x, y]] ⊆ s :=
Iff.rfl
#align set.mem_ord_connected_component Set.mem_ordConnectedComponent
theorem dual_ordConnectedComponent :
ordConnectedComponent (ofDual ⁻¹' s) (toDual x) = ofDual ⁻¹' ordConnectedComponent s x :=
ext <| (Surjective.forall toDual.surjective).2 fun x => by
rw [mem_ordConnectedComponent, dual_uIcc]
rfl
#align set.dual_ord_connected_component Set.dual_ordConnectedComponent
theorem ordConnectedComponent_subset : ordConnectedComponent s x ⊆ s := fun _ hy =>
hy right_mem_uIcc
#align set.ord_connected_component_subset Set.ordConnectedComponent_subset
theorem subset_ordConnectedComponent {t} [h : OrdConnected s] (hs : x ∈ s) (ht : s ⊆ t) :
s ⊆ ordConnectedComponent t x := fun _ hy => (h.uIcc_subset hs hy).trans ht
#align set.subset_ord_connected_component Set.subset_ordConnectedComponent
@[simp]
theorem self_mem_ordConnectedComponent : x ∈ ordConnectedComponent s x ↔ x ∈ s := by
rw [mem_ordConnectedComponent, uIcc_self, singleton_subset_iff]
#align set.self_mem_ord_connected_component Set.self_mem_ordConnectedComponent
@[simp]
theorem nonempty_ordConnectedComponent : (ordConnectedComponent s x).Nonempty ↔ x ∈ s :=
⟨fun ⟨_, hy⟩ => hy <| left_mem_uIcc, fun h => ⟨x, self_mem_ordConnectedComponent.2 h⟩⟩
#align set.nonempty_ord_connected_component Set.nonempty_ordConnectedComponent
@[simp]
| Mathlib/Order/Interval/Set/OrdConnectedComponent.lean | 63 | 64 | theorem ordConnectedComponent_eq_empty : ordConnectedComponent s x = ∅ ↔ x ∉ s := by |
rw [← not_nonempty_iff_eq_empty, nonempty_ordConnectedComponent]
| 0.59375 |
import Mathlib.Analysis.Convex.Basic
import Mathlib.Topology.Algebra.Group.Basic
import Mathlib.Topology.Order.Basic
#align_import analysis.convex.strict from "leanprover-community/mathlib"@"84dc0bd6619acaea625086d6f53cb35cdd554219"
open Set
open Convex Pointwise
variable {𝕜 𝕝 E F β : Type*}
open Function Set
open Convex
section OrderedSemiring
variable [OrderedSemiring 𝕜] [TopologicalSpace E] [TopologicalSpace F]
section AddCommMonoid
variable [AddCommMonoid E] [AddCommMonoid F]
section SMul
variable (𝕜)
variable [SMul 𝕜 E] [SMul 𝕜 F] (s : Set E)
def StrictConvex : Prop :=
s.Pairwise fun x y => ∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b → a + b = 1 → a • x + b • y ∈ interior s
#align strict_convex StrictConvex
variable {𝕜 s}
variable {x y : E} {a b : 𝕜}
theorem strictConvex_iff_openSegment_subset :
StrictConvex 𝕜 s ↔ s.Pairwise fun x y => openSegment 𝕜 x y ⊆ interior s :=
forall₅_congr fun _ _ _ _ _ => (openSegment_subset_iff 𝕜).symm
#align strict_convex_iff_open_segment_subset strictConvex_iff_openSegment_subset
theorem StrictConvex.openSegment_subset (hs : StrictConvex 𝕜 s) (hx : x ∈ s) (hy : y ∈ s)
(h : x ≠ y) : openSegment 𝕜 x y ⊆ interior s :=
strictConvex_iff_openSegment_subset.1 hs hx hy h
#align strict_convex.open_segment_subset StrictConvex.openSegment_subset
theorem strictConvex_empty : StrictConvex 𝕜 (∅ : Set E) :=
pairwise_empty _
#align strict_convex_empty strictConvex_empty
theorem strictConvex_univ : StrictConvex 𝕜 (univ : Set E) := by
intro x _ y _ _ a b _ _ _
rw [interior_univ]
exact mem_univ _
#align strict_convex_univ strictConvex_univ
protected nonrec theorem StrictConvex.eq (hs : StrictConvex 𝕜 s) (hx : x ∈ s) (hy : y ∈ s)
(ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) (h : a • x + b • y ∉ interior s) : x = y :=
hs.eq hx hy fun H => h <| H ha hb hab
#align strict_convex.eq StrictConvex.eq
protected theorem StrictConvex.inter {t : Set E} (hs : StrictConvex 𝕜 s) (ht : StrictConvex 𝕜 t) :
StrictConvex 𝕜 (s ∩ t) := by
intro x hx y hy hxy a b ha hb hab
rw [interior_inter]
exact ⟨hs hx.1 hy.1 hxy ha hb hab, ht hx.2 hy.2 hxy ha hb hab⟩
#align strict_convex.inter StrictConvex.inter
theorem Directed.strictConvex_iUnion {ι : Sort*} {s : ι → Set E} (hdir : Directed (· ⊆ ·) s)
(hs : ∀ ⦃i : ι⦄, StrictConvex 𝕜 (s i)) : StrictConvex 𝕜 (⋃ i, s i) := by
rintro x hx y hy hxy a b ha hb hab
rw [mem_iUnion] at hx hy
obtain ⟨i, hx⟩ := hx
obtain ⟨j, hy⟩ := hy
obtain ⟨k, hik, hjk⟩ := hdir i j
exact interior_mono (subset_iUnion s k) (hs (hik hx) (hjk hy) hxy ha hb hab)
#align directed.strict_convex_Union Directed.strictConvex_iUnion
| Mathlib/Analysis/Convex/Strict.lean | 95 | 98 | theorem DirectedOn.strictConvex_sUnion {S : Set (Set E)} (hdir : DirectedOn (· ⊆ ·) S)
(hS : ∀ s ∈ S, StrictConvex 𝕜 s) : StrictConvex 𝕜 (⋃₀ S) := by |
rw [sUnion_eq_iUnion]
exact (directedOn_iff_directed.1 hdir).strictConvex_iUnion fun s => hS _ s.2
| 0.59375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.