Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | num_lines int64 1 150 |
|---|---|---|---|---|---|---|
import Mathlib.Algebra.Group.Units
import Mathlib.Algebra.GroupWithZero.Basic
import Mathlib.Logic.Equiv.Defs
import Mathlib.Tactic.Contrapose
import Mathlib.Tactic.Nontriviality
import Mathlib.Tactic.Spread
import Mathlib.Util.AssertExists
#align_import algebra.group_with_zero.units.basic from "leanprover-community/mathlib"@"df5e9937a06fdd349fc60106f54b84d47b1434f0"
-- Guard against import creep
assert_not_exists Multiplicative
assert_not_exists DenselyOrdered
variable {α M₀ G₀ M₀' G₀' F F' : Type*}
variable [MonoidWithZero M₀]
@[simp]
theorem isUnit_zero_iff : IsUnit (0 : M₀) ↔ (0 : M₀) = 1 :=
⟨fun ⟨⟨_, a, (a0 : 0 * a = 1), _⟩, rfl⟩ => by rwa [zero_mul] at a0, fun h =>
@isUnit_of_subsingleton _ _ (subsingleton_of_zero_eq_one h) 0⟩
#align is_unit_zero_iff isUnit_zero_iff
-- Porting note: removed `simp` tag because `simpNF` says it's redundant
theorem not_isUnit_zero [Nontrivial M₀] : ¬IsUnit (0 : M₀) :=
mt isUnit_zero_iff.1 zero_ne_one
#align not_is_unit_zero not_isUnit_zero
namespace Ring
open scoped Classical
noncomputable def inverse : M₀ → M₀ := fun x => if h : IsUnit x then ((h.unit⁻¹ : M₀ˣ) : M₀) else 0
#align ring.inverse Ring.inverse
@[simp]
| Mathlib/Algebra/GroupWithZero/Units/Basic.lean | 98 | 99 | theorem inverse_unit (u : M₀ˣ) : inverse (u : M₀) = (u⁻¹ : M₀ˣ) := by |
rw [inverse, dif_pos u.isUnit, IsUnit.unit_of_val_units]
| 1 |
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)
| 1 |
import Mathlib.MeasureTheory.Measure.MeasureSpaceDef
#align_import measure_theory.measure.ae_disjoint from "leanprover-community/mathlib"@"bc7d81beddb3d6c66f71449c5bc76c38cb77cf9e"
open Set Function
namespace MeasureTheory
variable {ι α : Type*} {m : MeasurableSpace α} (μ : Measure α)
def AEDisjoint (s t : Set α) :=
μ (s ∩ t) = 0
#align measure_theory.ae_disjoint MeasureTheory.AEDisjoint
variable {μ} {s t u v : Set α}
theorem exists_null_pairwise_disjoint_diff [Countable ι] {s : ι → Set α}
(hd : Pairwise (AEDisjoint μ on s)) : ∃ t : ι → Set α, (∀ i, MeasurableSet (t i)) ∧
(∀ i, μ (t i) = 0) ∧ Pairwise (Disjoint on fun i => s i \ t i) := by
refine ⟨fun i => toMeasurable μ (s i ∩ ⋃ j ∈ ({i}ᶜ : Set ι), s j), fun i =>
measurableSet_toMeasurable _ _, fun i => ?_, ?_⟩
· simp only [measure_toMeasurable, inter_iUnion]
exact (measure_biUnion_null_iff <| to_countable _).2 fun j hj => hd (Ne.symm hj)
· simp only [Pairwise, disjoint_left, onFun, mem_diff, not_and, and_imp, Classical.not_not]
intro i j hne x hi hU hj
replace hU : x ∉ s i ∩ iUnion fun j ↦ iUnion fun _ ↦ s j :=
fun h ↦ hU (subset_toMeasurable _ _ h)
simp only [mem_inter_iff, mem_iUnion, not_and, not_exists] at hU
exact (hU hi j hne.symm hj).elim
#align measure_theory.exists_null_pairwise_disjoint_diff MeasureTheory.exists_null_pairwise_disjoint_diff
namespace AEDisjoint
protected theorem eq (h : AEDisjoint μ s t) : μ (s ∩ t) = 0 :=
h
#align measure_theory.ae_disjoint.eq MeasureTheory.AEDisjoint.eq
@[symm]
protected theorem symm (h : AEDisjoint μ s t) : AEDisjoint μ t s := by rwa [AEDisjoint, inter_comm]
#align measure_theory.ae_disjoint.symm MeasureTheory.AEDisjoint.symm
protected theorem symmetric : Symmetric (AEDisjoint μ) := fun _ _ => AEDisjoint.symm
#align measure_theory.ae_disjoint.symmetric MeasureTheory.AEDisjoint.symmetric
protected theorem comm : AEDisjoint μ s t ↔ AEDisjoint μ t s :=
⟨AEDisjoint.symm, AEDisjoint.symm⟩
#align measure_theory.ae_disjoint.comm MeasureTheory.AEDisjoint.comm
protected theorem _root_.Disjoint.aedisjoint (h : Disjoint s t) : AEDisjoint μ s t := by
rw [AEDisjoint, disjoint_iff_inter_eq_empty.1 h, measure_empty]
#align disjoint.ae_disjoint Disjoint.aedisjoint
protected theorem _root_.Pairwise.aedisjoint {f : ι → Set α} (hf : Pairwise (Disjoint on f)) :
Pairwise (AEDisjoint μ on f) :=
hf.mono fun _i _j h => h.aedisjoint
#align pairwise.ae_disjoint Pairwise.aedisjoint
protected theorem _root_.Set.PairwiseDisjoint.aedisjoint {f : ι → Set α} {s : Set ι}
(hf : s.PairwiseDisjoint f) : s.Pairwise (AEDisjoint μ on f) :=
hf.mono' fun _i _j h => h.aedisjoint
#align set.pairwise_disjoint.ae_disjoint Set.PairwiseDisjoint.aedisjoint
theorem mono_ae (h : AEDisjoint μ s t) (hu : u ≤ᵐ[μ] s) (hv : v ≤ᵐ[μ] t) : AEDisjoint μ u v :=
measure_mono_null_ae (hu.inter hv) h
#align measure_theory.ae_disjoint.mono_ae MeasureTheory.AEDisjoint.mono_ae
protected theorem mono (h : AEDisjoint μ s t) (hu : u ⊆ s) (hv : v ⊆ t) : AEDisjoint μ u v :=
mono_ae h (HasSubset.Subset.eventuallyLE hu) (HasSubset.Subset.eventuallyLE hv)
#align measure_theory.ae_disjoint.mono MeasureTheory.AEDisjoint.mono
protected theorem congr (h : AEDisjoint μ s t) (hu : u =ᵐ[μ] s) (hv : v =ᵐ[μ] t) :
AEDisjoint μ u v :=
mono_ae h (Filter.EventuallyEq.le hu) (Filter.EventuallyEq.le hv)
#align measure_theory.ae_disjoint.congr MeasureTheory.AEDisjoint.congr
@[simp]
theorem iUnion_left_iff [Countable ι] {s : ι → Set α} :
AEDisjoint μ (⋃ i, s i) t ↔ ∀ i, AEDisjoint μ (s i) t := by
simp only [AEDisjoint, iUnion_inter, measure_iUnion_null_iff]
#align measure_theory.ae_disjoint.Union_left_iff MeasureTheory.AEDisjoint.iUnion_left_iff
@[simp]
theorem iUnion_right_iff [Countable ι] {t : ι → Set α} :
AEDisjoint μ s (⋃ i, t i) ↔ ∀ i, AEDisjoint μ s (t i) := by
simp only [AEDisjoint, inter_iUnion, measure_iUnion_null_iff]
#align measure_theory.ae_disjoint.Union_right_iff MeasureTheory.AEDisjoint.iUnion_right_iff
@[simp]
| Mathlib/MeasureTheory/Measure/AEDisjoint.lean | 106 | 107 | theorem union_left_iff : AEDisjoint μ (s ∪ t) u ↔ AEDisjoint μ s u ∧ AEDisjoint μ t u := by |
simp [union_eq_iUnion, and_comm]
| 1 |
import Mathlib.Algebra.Polynomial.Expand
import Mathlib.Algebra.Polynomial.Laurent
import Mathlib.LinearAlgebra.Matrix.Charpoly.Basic
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.RingTheory.Polynomial.Nilpotent
#align_import linear_algebra.matrix.charpoly.coeff from "leanprover-community/mathlib"@"9745b093210e9dac443af24da9dba0f9e2b6c912"
noncomputable section
-- porting note: whenever there was `∏ i : n, X - C (M i i)`, I replaced it with
-- `∏ i : n, (X - C (M i i))`, since otherwise Lean would parse as `(∏ i : n, X) - C (M i i)`
universe u v w z
open Finset Matrix Polynomial
variable {R : Type u} [CommRing R]
variable {n G : Type v} [DecidableEq n] [Fintype n]
variable {α β : Type v} [DecidableEq α]
variable {M : Matrix n n R}
namespace Matrix
| Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean | 49 | 51 | theorem charmatrix_apply_natDegree [Nontrivial R] (i j : n) :
(charmatrix M i j).natDegree = ite (i = j) 1 0 := by |
by_cases h : i = j <;> simp [h, ← degree_eq_iff_natDegree_eq_of_pos (Nat.succ_pos 0)]
| 1 |
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.disjoint from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u v w
variable {ι : Sort u} {α : Type v} {β : Type w}
open Set
open OrderDual (toDual)
namespace Set
section Preorder
variable [Preorder α] {a b c : α}
@[simp]
theorem Iic_disjoint_Ioi (h : a ≤ b) : Disjoint (Iic a) (Ioi b) :=
disjoint_left.mpr fun _ ha hb => (h.trans_lt hb).not_le ha
#align set.Iic_disjoint_Ioi Set.Iic_disjoint_Ioi
@[simp]
theorem Iio_disjoint_Ici (h : a ≤ b) : Disjoint (Iio a) (Ici b) :=
disjoint_left.mpr fun _ ha hb => (h.trans_lt' ha).not_le hb
@[simp]
theorem Iic_disjoint_Ioc (h : a ≤ b) : Disjoint (Iic a) (Ioc b c) :=
(Iic_disjoint_Ioi h).mono le_rfl Ioc_subset_Ioi_self
#align set.Iic_disjoint_Ioc Set.Iic_disjoint_Ioc
@[simp]
theorem Ioc_disjoint_Ioc_same : Disjoint (Ioc a b) (Ioc b c) :=
(Iic_disjoint_Ioc le_rfl).mono Ioc_subset_Iic_self le_rfl
#align set.Ioc_disjoint_Ioc_same Set.Ioc_disjoint_Ioc_same
@[simp]
theorem Ico_disjoint_Ico_same : Disjoint (Ico a b) (Ico b c) :=
disjoint_left.mpr fun _ hab hbc => hab.2.not_le hbc.1
#align set.Ico_disjoint_Ico_same Set.Ico_disjoint_Ico_same
@[simp]
theorem Ici_disjoint_Iic : Disjoint (Ici a) (Iic b) ↔ ¬a ≤ b := by
rw [Set.disjoint_iff_inter_eq_empty, Ici_inter_Iic, Icc_eq_empty_iff]
#align set.Ici_disjoint_Iic Set.Ici_disjoint_Iic
@[simp]
theorem Iic_disjoint_Ici : Disjoint (Iic a) (Ici b) ↔ ¬b ≤ a :=
disjoint_comm.trans Ici_disjoint_Iic
#align set.Iic_disjoint_Ici Set.Iic_disjoint_Ici
@[simp]
theorem Ioc_disjoint_Ioi (h : b ≤ c) : Disjoint (Ioc a b) (Ioi c) :=
disjoint_left.mpr (fun _ hx hy ↦ (hx.2.trans h).not_lt hy)
theorem Ioc_disjoint_Ioi_same : Disjoint (Ioc a b) (Ioi b) :=
Ioc_disjoint_Ioi le_rfl
@[simp]
theorem iUnion_Iic : ⋃ a : α, Iic a = univ :=
iUnion_eq_univ_iff.2 fun x => ⟨x, right_mem_Iic⟩
#align set.Union_Iic Set.iUnion_Iic
@[simp]
theorem iUnion_Ici : ⋃ a : α, Ici a = univ :=
iUnion_eq_univ_iff.2 fun x => ⟨x, left_mem_Ici⟩
#align set.Union_Ici Set.iUnion_Ici
@[simp]
| Mathlib/Order/Interval/Set/Disjoint.lean | 87 | 88 | theorem iUnion_Icc_right (a : α) : ⋃ b, Icc a b = Ici a := by |
simp only [← Ici_inter_Iic, ← inter_iUnion, iUnion_Iic, inter_univ]
| 1 |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.CategoryTheory.ConcreteCategory.Basic
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.Data.Set.Subsingleton
#align_import category_theory.limits.shapes.types from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
universe v u
open CategoryTheory Limits
namespace CategoryTheory.Limits.Types
example : HasProducts.{v} (Type v) := inferInstance
example [UnivLE.{v, u}] : HasProducts.{v} (Type u) := inferInstance
-- This shortcut instance is required in `Mathlib.CategoryTheory.Closed.Types`,
-- although I don't understand why, and wish it wasn't.
instance : HasProducts.{v} (Type v) := inferInstance
@[simp 1001]
theorem pi_lift_π_apply {β : Type v} [Small.{u} β] (f : β → Type u) {P : Type u}
(s : ∀ b, P ⟶ f b) (b : β) (x : P) :
(Pi.π f b : (piObj f) → f b) (@Pi.lift β _ _ f _ P s x) = s b x :=
congr_fun (limit.lift_π (Fan.mk P s) ⟨b⟩) x
#align category_theory.limits.types.pi_lift_π_apply CategoryTheory.Limits.Types.pi_lift_π_apply
| Mathlib/CategoryTheory/Limits/Shapes/Types.lean | 66 | 69 | theorem pi_lift_π_apply' {β : Type v} (f : β → Type v) {P : Type v}
(s : ∀ b, P ⟶ f b) (b : β) (x : P) :
(Pi.π f b : (piObj f) → f b) (@Pi.lift β _ _ f _ P s x) = s b x := by |
simp
| 1 |
import Batteries.Control.ForInStep.Basic
@[simp] theorem ForInStep.bind_done [Monad m] (a : α) (f : α → m (ForInStep α)) :
(ForInStep.done a).bind (m := m) f = pure (.done a) := rfl
@[simp] theorem ForInStep.bind_yield [Monad m] (a : α) (f : α → m (ForInStep α)) :
(ForInStep.yield a).bind (m := m) f = f a := rfl
attribute [simp] ForInStep.bindM
@[simp] theorem ForInStep.run_done : (ForInStep.done a).run = a := rfl
@[simp] theorem ForInStep.run_yield : (ForInStep.yield a).run = a := rfl
@[simp] theorem ForInStep.bindList_nil [Monad m] (f : α → β → m (ForInStep β))
(s : ForInStep β) : s.bindList f [] = pure s := rfl
@[simp] theorem ForInStep.bindList_cons [Monad m]
(f : α → β → m (ForInStep β)) (s : ForInStep β) (a l) :
s.bindList f (a::l) = s.bind fun b => f a b >>= (·.bindList f l) := rfl
@[simp] theorem ForInStep.done_bindList [Monad m]
(f : α → β → m (ForInStep β)) (a l) :
(ForInStep.done a).bindList f l = pure (.done a) := by cases l <;> simp
@[simp] theorem ForInStep.bind_yield_bindList [Monad m]
(f : α → β → m (ForInStep β)) (s : ForInStep β) (l) :
(s.bind fun a => (yield a).bindList f l) = s.bindList f l := by cases s <;> simp
@[simp] theorem ForInStep.bind_bindList_assoc [Monad m] [LawfulMonad m]
(f : β → m (ForInStep β)) (g : α → β → m (ForInStep β)) (s : ForInStep β) (l) :
s.bind f >>= (·.bindList g l) = s.bind fun b => f b >>= (·.bindList g l) := by
cases s <;> simp
| .lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean | 40 | 42 | theorem ForInStep.bindList_cons' [Monad m] [LawfulMonad m]
(f : α → β → m (ForInStep β)) (s : ForInStep β) (a l) :
s.bindList f (a::l) = s.bind (f a) >>= (·.bindList f l) := by | simp
| 1 |
import Mathlib.Algebra.GroupWithZero.Indicator
import Mathlib.Algebra.Module.Basic
import Mathlib.Topology.Separation
#align_import topology.support from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46"
open Function Set Filter Topology
variable {X α α' β γ δ M E R : Type*}
section One
variable [One α] [TopologicalSpace X]
@[to_additive " The topological support of a function is the closure of its support. i.e. the
closure of the set of all elements where the function is nonzero. "]
def mulTSupport (f : X → α) : Set X := closure (mulSupport f)
#align mul_tsupport mulTSupport
#align tsupport tsupport
@[to_additive]
theorem subset_mulTSupport (f : X → α) : mulSupport f ⊆ mulTSupport f :=
subset_closure
#align subset_mul_tsupport subset_mulTSupport
#align subset_tsupport subset_tsupport
@[to_additive]
theorem isClosed_mulTSupport (f : X → α) : IsClosed (mulTSupport f) :=
isClosed_closure
#align is_closed_mul_tsupport isClosed_mulTSupport
#align is_closed_tsupport isClosed_tsupport
@[to_additive]
| Mathlib/Topology/Support.lean | 63 | 64 | theorem mulTSupport_eq_empty_iff {f : X → α} : mulTSupport f = ∅ ↔ f = 1 := by |
rw [mulTSupport, closure_empty_iff, mulSupport_eq_empty_iff]
| 1 |
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]
theorem toDFinsupp_replicate (a : α) (n : ℕ) :
toDFinsupp (Multiset.replicate n a) = DFinsupp.single a n := by
ext i
dsimp [toDFinsupp]
simp [count_replicate, eq_comm]
#align multiset.to_dfinsupp_replicate Multiset.toDFinsupp_replicate
@[simp]
| Mathlib/Data/DFinsupp/Multiset.lean | 75 | 76 | theorem toDFinsupp_singleton (a : α) : toDFinsupp {a} = DFinsupp.single a 1 := by |
rw [← replicate_one, toDFinsupp_replicate]
| 1 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Reverse
import Mathlib.Algebra.Polynomial.Inductions
import Mathlib.RingTheory.Localization.Basic
#align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86"
open Polynomial Function AddMonoidAlgebra Finsupp
noncomputable section
variable {R : Type*}
abbrev LaurentPolynomial (R : Type*) [Semiring R] :=
AddMonoidAlgebra R ℤ
#align laurent_polynomial LaurentPolynomial
@[nolint docBlame]
scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R
open LaurentPolynomial
-- Porting note: `ext` no longer applies `Finsupp.ext` automatically
@[ext]
theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : ∀ a, p a = q a) : p = q :=
Finsupp.ext h
def Polynomial.toLaurent [Semiring R] : R[X] →+* R[T;T⁻¹] :=
(mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R)
#align polynomial.to_laurent Polynomial.toLaurent
theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) :
toLaurent p = p.toFinsupp.mapDomain (↑) :=
rfl
#align polynomial.to_laurent_apply Polynomial.toLaurent_apply
def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] :=
(mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom
#align polynomial.to_laurent_alg Polynomial.toLaurentAlg
@[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] :
(toLaurentAlg : R[X] → R[T;T⁻¹]) = toLaurent :=
rfl
theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f :=
rfl
#align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply
namespace LaurentPolynomial
section Semiring
variable [Semiring R]
theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) :=
rfl
#align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one
def C : R →+* R[T;T⁻¹] :=
singleZeroRingHom
set_option linter.uppercaseLean3 false in
#align laurent_polynomial.C LaurentPolynomial.C
theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) :
algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) :=
rfl
#align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply
theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r :=
rfl
set_option linter.uppercaseLean3 false in
#align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap
theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl
set_option linter.uppercaseLean3 false in
#align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C
@[simp] lemma C_apply (t : R) (n : ℤ) : C t n = if n = 0 then t else 0 := by
rw [← single_eq_C, Finsupp.single_apply]; aesop
def T (n : ℤ) : R[T;T⁻¹] :=
Finsupp.single n 1
set_option linter.uppercaseLean3 false in
#align laurent_polynomial.T LaurentPolynomial.T
@[simp] lemma T_apply (m n : ℤ) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 :=
Finsupp.single_apply
@[simp]
theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 :=
rfl
set_option linter.uppercaseLean3 false in
#align laurent_polynomial.T_zero LaurentPolynomial.T_zero
theorem T_add (m n : ℤ) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by
-- Porting note: was `convert single_mul_single.symm`
simp [T, single_mul_single]
set_option linter.uppercaseLean3 false in
#align laurent_polynomial.T_add LaurentPolynomial.T_add
| Mathlib/Algebra/Polynomial/Laurent.lean | 191 | 191 | theorem T_sub (m n : ℤ) : (T (m - n) : R[T;T⁻¹]) = T m * T (-n) := by | rw [← T_add, sub_eq_add_neg]
| 1 |
import Mathlib.Order.RelClasses
import Mathlib.Order.Interval.Set.Basic
#align_import order.bounded from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
namespace Set
variable {α : Type*} {r : α → α → Prop} {s t : Set α}
theorem Bounded.mono (hst : s ⊆ t) (hs : Bounded r t) : Bounded r s :=
hs.imp fun _ ha b hb => ha b (hst hb)
#align set.bounded.mono Set.Bounded.mono
theorem Unbounded.mono (hst : s ⊆ t) (hs : Unbounded r s) : Unbounded r t := fun a =>
let ⟨b, hb, hb'⟩ := hs a
⟨b, hst hb, hb'⟩
#align set.unbounded.mono Set.Unbounded.mono
theorem unbounded_le_of_forall_exists_lt [Preorder α] (h : ∀ a, ∃ b ∈ s, a < b) :
Unbounded (· ≤ ·) s := fun a =>
let ⟨b, hb, hb'⟩ := h a
⟨b, hb, fun hba => hba.not_lt hb'⟩
#align set.unbounded_le_of_forall_exists_lt Set.unbounded_le_of_forall_exists_lt
theorem unbounded_le_iff [LinearOrder α] : Unbounded (· ≤ ·) s ↔ ∀ a, ∃ b ∈ s, a < b := by
simp only [Unbounded, not_le]
#align set.unbounded_le_iff Set.unbounded_le_iff
theorem unbounded_lt_of_forall_exists_le [Preorder α] (h : ∀ a, ∃ b ∈ s, a ≤ b) :
Unbounded (· < ·) s := fun a =>
let ⟨b, hb, hb'⟩ := h a
⟨b, hb, fun hba => hba.not_le hb'⟩
#align set.unbounded_lt_of_forall_exists_le Set.unbounded_lt_of_forall_exists_le
| Mathlib/Order/Bounded.lean | 54 | 55 | theorem unbounded_lt_iff [LinearOrder α] : Unbounded (· < ·) s ↔ ∀ a, ∃ b ∈ s, a ≤ b := by |
simp only [Unbounded, not_lt]
| 1 |
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]
| Mathlib/Analysis/Convex/Intrinsic.lean | 120 | 120 | theorem intrinsicClosure_empty : intrinsicClosure 𝕜 (∅ : Set P) = ∅ := by | simp [intrinsicClosure]
| 1 |
import Mathlib.NumberTheory.Padics.PadicNumbers
import Mathlib.RingTheory.DiscreteValuationRing.Basic
#align_import number_theory.padics.padic_integers from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open Padic Metric LocalRing
noncomputable section
open scoped Classical
def PadicInt (p : ℕ) [Fact p.Prime] :=
{ x : ℚ_[p] // ‖x‖ ≤ 1 }
#align padic_int PadicInt
notation "ℤ_[" p "]" => PadicInt p
namespace PadicInt
variable {p : ℕ} [Fact p.Prime]
instance : Coe ℤ_[p] ℚ_[p] :=
⟨Subtype.val⟩
theorem ext {x y : ℤ_[p]} : (x : ℚ_[p]) = y → x = y :=
Subtype.ext
#align padic_int.ext PadicInt.ext
variable (p)
def subring : Subring ℚ_[p] where
carrier := { x : ℚ_[p] | ‖x‖ ≤ 1 }
zero_mem' := by set_option tactic.skipAssignedInstances false in norm_num
one_mem' := by set_option tactic.skipAssignedInstances false in norm_num
add_mem' hx hy := (padicNormE.nonarchimedean _ _).trans <| max_le_iff.2 ⟨hx, hy⟩
mul_mem' hx hy := (padicNormE.mul _ _).trans_le <| mul_le_one hx (norm_nonneg _) hy
neg_mem' hx := (norm_neg _).trans_le hx
#align padic_int.subring PadicInt.subring
@[simp]
theorem mem_subring_iff {x : ℚ_[p]} : x ∈ subring p ↔ ‖x‖ ≤ 1 := Iff.rfl
#align padic_int.mem_subring_iff PadicInt.mem_subring_iff
variable {p}
instance : Add ℤ_[p] := (by infer_instance : Add (subring p))
instance : Mul ℤ_[p] := (by infer_instance : Mul (subring p))
instance : Neg ℤ_[p] := (by infer_instance : Neg (subring p))
instance : Sub ℤ_[p] := (by infer_instance : Sub (subring p))
instance : Zero ℤ_[p] := (by infer_instance : Zero (subring p))
instance : Inhabited ℤ_[p] := ⟨0⟩
instance : One ℤ_[p] := ⟨⟨1, by norm_num⟩⟩
@[simp]
theorem mk_zero {h} : (⟨0, h⟩ : ℤ_[p]) = (0 : ℤ_[p]) := rfl
#align padic_int.mk_zero PadicInt.mk_zero
@[simp, norm_cast]
theorem coe_add (z1 z2 : ℤ_[p]) : ((z1 + z2 : ℤ_[p]) : ℚ_[p]) = z1 + z2 := rfl
#align padic_int.coe_add PadicInt.coe_add
@[simp, norm_cast]
theorem coe_mul (z1 z2 : ℤ_[p]) : ((z1 * z2 : ℤ_[p]) : ℚ_[p]) = z1 * z2 := rfl
#align padic_int.coe_mul PadicInt.coe_mul
@[simp, norm_cast]
theorem coe_neg (z1 : ℤ_[p]) : ((-z1 : ℤ_[p]) : ℚ_[p]) = -z1 := rfl
#align padic_int.coe_neg PadicInt.coe_neg
@[simp, norm_cast]
theorem coe_sub (z1 z2 : ℤ_[p]) : ((z1 - z2 : ℤ_[p]) : ℚ_[p]) = z1 - z2 := rfl
#align padic_int.coe_sub PadicInt.coe_sub
@[simp, norm_cast]
theorem coe_one : ((1 : ℤ_[p]) : ℚ_[p]) = 1 := rfl
#align padic_int.coe_one PadicInt.coe_one
@[simp, norm_cast]
theorem coe_zero : ((0 : ℤ_[p]) : ℚ_[p]) = 0 := rfl
#align padic_int.coe_zero PadicInt.coe_zero
| Mathlib/NumberTheory/Padics/PadicIntegers.lean | 145 | 145 | theorem coe_eq_zero (z : ℤ_[p]) : (z : ℚ_[p]) = 0 ↔ z = 0 := by | rw [← coe_zero, Subtype.coe_inj]
| 1 |
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Order.Filter.Subsingleton
open Set
variable {α β γ δ : Type*} {l : Filter α} {f : α → β}
namespace Filter
def EventuallyConst (f : α → β) (l : Filter α) : Prop := (map f l).Subsingleton
theorem HasBasis.eventuallyConst_iff {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
(h : l.HasBasis p s) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ x ∈ s i, ∀ y ∈ s i, f x = f y :=
(h.map f).subsingleton_iff.trans <| by simp only [Set.Subsingleton, forall_mem_image]
theorem HasBasis.eventuallyConst_iff' {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
{x : ι → α} (h : l.HasBasis p s) (hx : ∀ i, p i → x i ∈ s i) :
EventuallyConst f l ↔ ∃ i, p i ∧ ∀ y ∈ s i, f y = f (x i) :=
h.eventuallyConst_iff.trans <| exists_congr fun i ↦ and_congr_right fun hi ↦
⟨fun h ↦ (h · · (x i) (hx i hi)), fun h a ha b hb ↦ h a ha ▸ (h b hb).symm⟩
lemma eventuallyConst_iff_tendsto [Nonempty β] :
EventuallyConst f l ↔ ∃ x, Tendsto f l (pure x) :=
subsingleton_iff_exists_le_pure
alias ⟨EventuallyConst.exists_tendsto, _⟩ := eventuallyConst_iff_tendsto
theorem EventuallyConst.of_tendsto {x : β} (h : Tendsto f l (pure x)) : EventuallyConst f l :=
have : Nonempty β := ⟨x⟩; eventuallyConst_iff_tendsto.2 ⟨x, h⟩
theorem eventuallyConst_iff_exists_eventuallyEq [Nonempty β] :
EventuallyConst f l ↔ ∃ c, f =ᶠ[l] fun _ ↦ c :=
subsingleton_iff_exists_singleton_mem
alias ⟨EventuallyConst.eventuallyEq_const, _⟩ := eventuallyConst_iff_exists_eventuallyEq
| Mathlib/Order/Filter/EventuallyConst.lean | 57 | 59 | theorem eventuallyConst_pred' {p : α → Prop} :
EventuallyConst p l ↔ (p =ᶠ[l] fun _ ↦ False) ∨ (p =ᶠ[l] fun _ ↦ True) := by |
simp only [eventuallyConst_iff_exists_eventuallyEq, Prop.exists_iff]
| 1 |
import Mathlib.Logic.Function.Iterate
import Mathlib.Topology.EMetricSpace.Basic
import Mathlib.Tactic.GCongr
#align_import topology.metric_space.lipschitz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
universe u v w x
open Filter Function Set Topology NNReal ENNReal Bornology
variable {α : Type u} {β : Type v} {γ : Type w} {ι : Type x}
def LipschitzWith [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) :=
∀ x y, edist (f x) (f y) ≤ K * edist x y
#align lipschitz_with LipschitzWith
def LipschitzOnWith [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β)
(s : Set α) :=
∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → edist (f x) (f y) ≤ K * edist x y
#align lipschitz_on_with LipschitzOnWith
def LocallyLipschitz [PseudoEMetricSpace α] [PseudoEMetricSpace β] (f : α → β) : Prop :=
∀ x : α, ∃ K, ∃ t ∈ 𝓝 x, LipschitzOnWith K f t
@[simp]
theorem lipschitzOnWith_empty [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) :
LipschitzOnWith K f ∅ := fun _ => False.elim
#align lipschitz_on_with_empty lipschitzOnWith_empty
theorem LipschitzOnWith.mono [PseudoEMetricSpace α] [PseudoEMetricSpace β] {K : ℝ≥0} {s t : Set α}
{f : α → β} (hf : LipschitzOnWith K f t) (h : s ⊆ t) : LipschitzOnWith K f s :=
fun _x x_in _y y_in => hf (h x_in) (h y_in)
#align lipschitz_on_with.mono LipschitzOnWith.mono
@[simp]
theorem lipschitzOn_univ [PseudoEMetricSpace α] [PseudoEMetricSpace β] {K : ℝ≥0} {f : α → β} :
LipschitzOnWith K f univ ↔ LipschitzWith K f := by simp [LipschitzOnWith, LipschitzWith]
#align lipschitz_on_univ lipschitzOn_univ
| Mathlib/Topology/EMetricSpace/Lipschitz.lean | 86 | 88 | theorem lipschitzOnWith_iff_restrict [PseudoEMetricSpace α] [PseudoEMetricSpace β] {K : ℝ≥0}
{f : α → β} {s : Set α} : LipschitzOnWith K f s ↔ LipschitzWith K (s.restrict f) := by |
simp only [LipschitzOnWith, LipschitzWith, SetCoe.forall', restrict, Subtype.edist_eq]
| 1 |
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Algebra.Group.Basic
#align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
universe u
open Nat
namespace Int
variable {R : Type u} [AddGroupWithOne R]
@[simp, norm_cast squash]
theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) :=
AddGroupWithOne.intCast_negSucc n
#align int.cast_neg_succ_of_nat Int.cast_negSuccₓ
-- expected `n` to be implicit, and `HasLiftT`
@[simp, norm_cast]
theorem cast_zero : ((0 : ℤ) : R) = 0 :=
(AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero
#align int.cast_zero Int.cast_zeroₓ
-- type had `HasLiftT`
-- This lemma competes with `Int.ofNat_eq_natCast` to come later
@[simp high, nolint simpNF, norm_cast]
theorem cast_natCast (n : ℕ) : ((n : ℤ) : R) = n :=
AddGroupWithOne.intCast_ofNat _
#align int.cast_coe_nat Int.cast_natCastₓ
-- expected `n` to be implicit, and `HasLiftT`
#align int.cast_of_nat Int.cast_natCastₓ
-- See note [no_index around OfNat.ofNat]
@[simp, norm_cast]
theorem cast_ofNat (n : ℕ) [n.AtLeastTwo] :
((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by
simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n
@[simp, norm_cast]
| Mathlib/Data/Int/Cast/Basic.lean | 79 | 80 | theorem cast_one : ((1 : ℤ) : R) = 1 := by |
erw [cast_natCast, Nat.cast_one]
| 1 |
import Mathlib.Topology.Algebra.Group.Basic
import Mathlib.Logic.Function.Iterate
#align_import dynamics.flow from "leanprover-community/mathlib"@"717c073262cd9d59b1a1dcda7e8ab570c5b63370"
open Set Function Filter
section Invariant
variable {τ : Type*} {α : Type*}
def IsInvariant (ϕ : τ → α → α) (s : Set α) : Prop :=
∀ t, MapsTo (ϕ t) s s
#align is_invariant IsInvariant
variable (ϕ : τ → α → α) (s : Set α)
| Mathlib/Dynamics/Flow.lean | 49 | 50 | theorem isInvariant_iff_image : IsInvariant ϕ s ↔ ∀ t, ϕ t '' s ⊆ s := by |
simp_rw [IsInvariant, mapsTo']
| 1 |
import Mathlib.Analysis.Complex.Polynomial
import Mathlib.NumberTheory.NumberField.Norm
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Norm
import Mathlib.Topology.Instances.Complex
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import number_theory.number_field.embeddings from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c"
open scoped Classical
namespace NumberField.Embeddings
section Fintype
open FiniteDimensional
variable (K : Type*) [Field K] [NumberField K]
variable (A : Type*) [Field A] [CharZero A]
noncomputable instance : Fintype (K →+* A) :=
Fintype.ofEquiv (K →ₐ[ℚ] A) RingHom.equivRatAlgHom.symm
variable [IsAlgClosed A]
| Mathlib/NumberTheory/NumberField/Embeddings.lean | 54 | 55 | theorem card : Fintype.card (K →+* A) = finrank ℚ K := by |
rw [Fintype.ofEquiv_card RingHom.equivRatAlgHom.symm, AlgHom.card]
| 1 |
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]
theorem symm_symm (f : α ≃. β) : f.symm.symm = f := by cases f; rfl
#align pequiv.symm_symm PEquiv.symm_symm
theorem symm_bijective : Function.Bijective (PEquiv.symm : (α ≃. β) → β ≃. α) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
theorem symm_injective : Function.Injective (@PEquiv.symm α β) :=
symm_bijective.injective
#align pequiv.symm_injective PEquiv.symm_injective
theorem trans_assoc (f : α ≃. β) (g : β ≃. γ) (h : γ ≃. δ) :
(f.trans g).trans h = f.trans (g.trans h) :=
ext fun _ => Option.bind_assoc _ _ _
#align pequiv.trans_assoc PEquiv.trans_assoc
theorem mem_trans (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ) :
c ∈ f.trans g a ↔ ∃ b, b ∈ f a ∧ c ∈ g b :=
Option.bind_eq_some'
#align pequiv.mem_trans PEquiv.mem_trans
theorem trans_eq_some (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ) :
f.trans g a = some c ↔ ∃ b, f a = some b ∧ g b = some c :=
Option.bind_eq_some'
#align pequiv.trans_eq_some PEquiv.trans_eq_some
theorem trans_eq_none (f : α ≃. β) (g : β ≃. γ) (a : α) :
f.trans g a = none ↔ ∀ b c, b ∉ f a ∨ c ∉ g b := by
simp only [eq_none_iff_forall_not_mem, mem_trans, imp_iff_not_or.symm]
push_neg
exact forall_swap
#align pequiv.trans_eq_none PEquiv.trans_eq_none
@[simp]
theorem refl_trans (f : α ≃. β) : (PEquiv.refl α).trans f = f := by
ext; dsimp [PEquiv.trans]; rfl
#align pequiv.refl_trans PEquiv.refl_trans
@[simp]
| Mathlib/Data/PEquiv.lean | 174 | 175 | theorem trans_refl (f : α ≃. β) : f.trans (PEquiv.refl β) = f := by |
ext; dsimp [PEquiv.trans]; simp
| 1 |
import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace
#align_import geometry.manifold.vector_bundle.fiberwise_linear from "leanprover-community/mathlib"@"be2c24f56783935652cefffb4bfca7e4b25d167e"
noncomputable section
open Set TopologicalSpace
open scoped Manifold Topology
variable {𝕜 B F : Type*} [TopologicalSpace B]
variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup F] [NormedSpace 𝕜 F]
namespace FiberwiseLinear
variable {φ φ' : B → F ≃L[𝕜] F} {U U' : Set B}
def partialHomeomorph (φ : B → F ≃L[𝕜] F) (hU : IsOpen U)
(hφ : ContinuousOn (fun x => φ x : B → F →L[𝕜] F) U)
(h2φ : ContinuousOn (fun x => (φ x).symm : B → F →L[𝕜] F) U) :
PartialHomeomorph (B × F) (B × F) where
toFun x := (x.1, φ x.1 x.2)
invFun x := (x.1, (φ x.1).symm x.2)
source := U ×ˢ univ
target := U ×ˢ univ
map_source' _x hx := mk_mem_prod hx.1 (mem_univ _)
map_target' _x hx := mk_mem_prod hx.1 (mem_univ _)
left_inv' _ _ := Prod.ext rfl (ContinuousLinearEquiv.symm_apply_apply _ _)
right_inv' _ _ := Prod.ext rfl (ContinuousLinearEquiv.apply_symm_apply _ _)
open_source := hU.prod isOpen_univ
open_target := hU.prod isOpen_univ
continuousOn_toFun :=
have : ContinuousOn (fun p : B × F => ((φ p.1 : F →L[𝕜] F), p.2)) (U ×ˢ univ) :=
hφ.prod_map continuousOn_id
continuousOn_fst.prod (isBoundedBilinearMap_apply.continuous.comp_continuousOn this)
continuousOn_invFun :=
haveI : ContinuousOn (fun p : B × F => (((φ p.1).symm : F →L[𝕜] F), p.2)) (U ×ˢ univ) :=
h2φ.prod_map continuousOn_id
continuousOn_fst.prod (isBoundedBilinearMap_apply.continuous.comp_continuousOn this)
#align fiberwise_linear.local_homeomorph FiberwiseLinear.partialHomeomorph
theorem trans_partialHomeomorph_apply (hU : IsOpen U)
(hφ : ContinuousOn (fun x => φ x : B → F →L[𝕜] F) U)
(h2φ : ContinuousOn (fun x => (φ x).symm : B → F →L[𝕜] F) U) (hU' : IsOpen U')
(hφ' : ContinuousOn (fun x => φ' x : B → F →L[𝕜] F) U')
(h2φ' : ContinuousOn (fun x => (φ' x).symm : B → F →L[𝕜] F) U') (b : B) (v : F) :
(FiberwiseLinear.partialHomeomorph φ hU hφ h2φ ≫ₕ
FiberwiseLinear.partialHomeomorph φ' hU' hφ' h2φ')
⟨b, v⟩ =
⟨b, φ' b (φ b v)⟩ :=
rfl
#align fiberwise_linear.trans_local_homeomorph_apply FiberwiseLinear.trans_partialHomeomorph_apply
| Mathlib/Geometry/Manifold/VectorBundle/FiberwiseLinear.lean | 74 | 82 | theorem source_trans_partialHomeomorph (hU : IsOpen U)
(hφ : ContinuousOn (fun x => φ x : B → F →L[𝕜] F) U)
(h2φ : ContinuousOn (fun x => (φ x).symm : B → F →L[𝕜] F) U) (hU' : IsOpen U')
(hφ' : ContinuousOn (fun x => φ' x : B → F →L[𝕜] F) U')
(h2φ' : ContinuousOn (fun x => (φ' x).symm : B → F →L[𝕜] F) U') :
(FiberwiseLinear.partialHomeomorph φ hU hφ h2φ ≫ₕ
FiberwiseLinear.partialHomeomorph φ' hU' hφ' h2φ').source =
(U ∩ U') ×ˢ univ := by |
dsimp only [FiberwiseLinear.partialHomeomorph]; mfld_set_tac
| 1 |
import Mathlib.GroupTheory.Solvable
import Mathlib.FieldTheory.PolynomialGaloisGroup
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a"
noncomputable section
open scoped Classical Polynomial IntermediateField
open Polynomial IntermediateField
section AbelRuffini
variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E]
theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance
#align gal_zero_is_solvable gal_zero_isSolvable
theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance
#align gal_one_is_solvable gal_one_isSolvable
| Mathlib/FieldTheory/AbelRuffini.lean | 45 | 45 | theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by | infer_instance
| 1 |
import Mathlib.Data.List.Infix
#align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
-- Make sure we don't import algebra
assert_not_exists Monoid
variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ)
namespace List
def rdrop : List α :=
l.take (l.length - n)
#align list.rdrop List.rdrop
@[simp]
theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop]
#align list.rdrop_nil List.rdrop_nil
@[simp]
theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop]
#align list.rdrop_zero List.rdrop_zero
theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by
rw [rdrop]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· simp [take_append]
· simp [take_append_eq_append_take, IH]
#align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse
@[simp]
theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by
simp [rdrop_eq_reverse_drop_reverse]
#align list.rdrop_concat_succ List.rdrop_concat_succ
def rtake : List α :=
l.drop (l.length - n)
#align list.rtake List.rtake
@[simp]
theorem rtake_nil : rtake ([] : List α) n = [] := by simp [rtake]
#align list.rtake_nil List.rtake_nil
@[simp]
theorem rtake_zero : rtake l 0 = [] := by simp [rtake]
#align list.rtake_zero List.rtake_zero
theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) := by
rw [rtake]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· exact drop_length _
· simp [drop_append_eq_append_drop, IH]
#align list.rtake_eq_reverse_take_reverse List.rtake_eq_reverse_take_reverse
@[simp]
theorem rtake_concat_succ (x : α) : rtake (l ++ [x]) (n + 1) = rtake l n ++ [x] := by
simp [rtake_eq_reverse_take_reverse]
#align list.rtake_concat_succ List.rtake_concat_succ
def rdropWhile : List α :=
reverse (l.reverse.dropWhile p)
#align list.rdrop_while List.rdropWhile
@[simp]
theorem rdropWhile_nil : rdropWhile p ([] : List α) = [] := by simp [rdropWhile, dropWhile]
#align list.rdrop_while_nil List.rdropWhile_nil
theorem rdropWhile_concat (x : α) :
rdropWhile p (l ++ [x]) = if p x then rdropWhile p l else l ++ [x] := by
simp only [rdropWhile, dropWhile, reverse_append, reverse_singleton, singleton_append]
split_ifs with h <;> simp [h]
#align list.rdrop_while_concat List.rdropWhile_concat
@[simp]
theorem rdropWhile_concat_pos (x : α) (h : p x) : rdropWhile p (l ++ [x]) = rdropWhile p l := by
rw [rdropWhile_concat, if_pos h]
#align list.rdrop_while_concat_pos List.rdropWhile_concat_pos
@[simp]
theorem rdropWhile_concat_neg (x : α) (h : ¬p x) : rdropWhile p (l ++ [x]) = l ++ [x] := by
rw [rdropWhile_concat, if_neg h]
#align list.rdrop_while_concat_neg List.rdropWhile_concat_neg
theorem rdropWhile_singleton (x : α) : rdropWhile p [x] = if p x then [] else [x] := by
rw [← nil_append [x], rdropWhile_concat, rdropWhile_nil]
#align list.rdrop_while_singleton List.rdropWhile_singleton
theorem rdropWhile_last_not (hl : l.rdropWhile p ≠ []) : ¬p ((rdropWhile p l).getLast hl) := by
simp_rw [rdropWhile]
rw [getLast_reverse]
exact dropWhile_nthLe_zero_not _ _ _
#align list.rdrop_while_last_not List.rdropWhile_last_not
theorem rdropWhile_prefix : l.rdropWhile p <+: l := by
rw [← reverse_suffix, rdropWhile, reverse_reverse]
exact dropWhile_suffix _
#align list.rdrop_while_prefix List.rdropWhile_prefix
variable {p} {l}
@[simp]
| Mathlib/Data/List/DropRight.lean | 139 | 139 | theorem rdropWhile_eq_nil_iff : rdropWhile p l = [] ↔ ∀ x ∈ l, p x := by | simp [rdropWhile]
| 1 |
import Mathlib.Topology.Separation
#align_import topology.sober from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
open Set
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β]
section genericPoint
def IsGenericPoint (x : α) (S : Set α) : Prop :=
closure ({x} : Set α) = S
#align is_generic_point IsGenericPoint
theorem isGenericPoint_def {x : α} {S : Set α} : IsGenericPoint x S ↔ closure ({x} : Set α) = S :=
Iff.rfl
#align is_generic_point_def isGenericPoint_def
theorem IsGenericPoint.def {x : α} {S : Set α} (h : IsGenericPoint x S) :
closure ({x} : Set α) = S :=
h
#align is_generic_point.def IsGenericPoint.def
theorem isGenericPoint_closure {x : α} : IsGenericPoint x (closure ({x} : Set α)) :=
refl _
#align is_generic_point_closure isGenericPoint_closure
variable {x y : α} {S U Z : Set α}
theorem isGenericPoint_iff_specializes : IsGenericPoint x S ↔ ∀ y, x ⤳ y ↔ y ∈ S := by
simp only [specializes_iff_mem_closure, IsGenericPoint, Set.ext_iff]
#align is_generic_point_iff_specializes isGenericPoint_iff_specializes
namespace IsGenericPoint
theorem specializes_iff_mem (h : IsGenericPoint x S) : x ⤳ y ↔ y ∈ S :=
isGenericPoint_iff_specializes.1 h y
#align is_generic_point.specializes_iff_mem IsGenericPoint.specializes_iff_mem
protected theorem specializes (h : IsGenericPoint x S) (h' : y ∈ S) : x ⤳ y :=
h.specializes_iff_mem.2 h'
#align is_generic_point.specializes IsGenericPoint.specializes
protected theorem mem (h : IsGenericPoint x S) : x ∈ S :=
h.specializes_iff_mem.1 specializes_rfl
#align is_generic_point.mem IsGenericPoint.mem
protected theorem isClosed (h : IsGenericPoint x S) : IsClosed S :=
h.def ▸ isClosed_closure
#align is_generic_point.is_closed IsGenericPoint.isClosed
protected theorem isIrreducible (h : IsGenericPoint x S) : IsIrreducible S :=
h.def ▸ isIrreducible_singleton.closure
#align is_generic_point.is_irreducible IsGenericPoint.isIrreducible
protected theorem inseparable (h : IsGenericPoint x S) (h' : IsGenericPoint y S) :
Inseparable x y :=
(h.specializes h'.mem).antisymm (h'.specializes h.mem)
protected theorem eq [T0Space α] (h : IsGenericPoint x S) (h' : IsGenericPoint y S) : x = y :=
(h.inseparable h').eq
#align is_generic_point.eq IsGenericPoint.eq
theorem mem_open_set_iff (h : IsGenericPoint x S) (hU : IsOpen U) : x ∈ U ↔ (S ∩ U).Nonempty :=
⟨fun h' => ⟨x, h.mem, h'⟩, fun ⟨_y, hyS, hyU⟩ => (h.specializes hyS).mem_open hU hyU⟩
#align is_generic_point.mem_open_set_iff IsGenericPoint.mem_open_set_iff
| Mathlib/Topology/Sober.lean | 92 | 93 | theorem disjoint_iff (h : IsGenericPoint x S) (hU : IsOpen U) : Disjoint S U ↔ x ∉ U := by |
rw [h.mem_open_set_iff hU, ← not_disjoint_iff_nonempty_inter, Classical.not_not]
| 1 |
import Mathlib.Init.Control.Combinators
import Mathlib.Init.Function
import Mathlib.Tactic.CasesM
import Mathlib.Tactic.Attr.Core
#align_import control.basic from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
universe u v w
variable {α β γ : Type u}
section Applicative
variable {F : Type u → Type v} [Applicative F]
def zipWithM {α₁ α₂ φ : Type u} (f : α₁ → α₂ → F φ) : ∀ (_ : List α₁) (_ : List α₂), F (List φ)
| x :: xs, y :: ys => (· :: ·) <$> f x y <*> zipWithM f xs ys
| _, _ => pure []
#align mzip_with zipWithM
def zipWithM' (f : α → β → F γ) : List α → List β → F PUnit
| x :: xs, y :: ys => f x y *> zipWithM' f xs ys
| [], _ => pure PUnit.unit
| _, [] => pure PUnit.unit
#align mzip_with' zipWithM'
variable [LawfulApplicative F]
@[simp]
theorem pure_id'_seq (x : F α) : (pure fun x => x) <*> x = x :=
pure_id_seq x
#align pure_id'_seq pure_id'_seq
@[functor_norm]
theorem seq_map_assoc (x : F (α → β)) (f : γ → α) (y : F γ) :
x <*> f <$> y = (· ∘ f) <$> x <*> y := by
simp only [← pure_seq]
simp only [seq_assoc, Function.comp, seq_pure, ← comp_map]
simp [pure_seq]
#align seq_map_assoc seq_map_assoc
@[functor_norm]
| Mathlib/Control/Basic.lean | 68 | 70 | theorem map_seq (f : β → γ) (x : F (α → β)) (y : F α) :
f <$> (x <*> y) = (f ∘ ·) <$> x <*> y := by |
simp only [← pure_seq]; simp [seq_assoc]
| 1 |
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Analysis.Convex.Hull
import Mathlib.LinearAlgebra.AffineSpace.Basis
#align_import analysis.convex.combination from "leanprover-community/mathlib"@"92bd7b1ffeb306a89f450bee126ddd8a284c259d"
open Set Function
open scoped Classical
open Pointwise
universe u u'
variable {R R' E F ι ι' α : Type*} [LinearOrderedField R] [LinearOrderedField R'] [AddCommGroup E]
[AddCommGroup F] [LinearOrderedAddCommGroup α] [Module R E] [Module R F] [Module R α]
[OrderedSMul R α] {s : Set E}
def Finset.centerMass (t : Finset ι) (w : ι → R) (z : ι → E) : E :=
(∑ i ∈ t, w i)⁻¹ • ∑ i ∈ t, w i • z i
#align finset.center_mass Finset.centerMass
variable (i j : ι) (c : R) (t : Finset ι) (w : ι → R) (z : ι → E)
open Finset
theorem Finset.centerMass_empty : (∅ : Finset ι).centerMass w z = 0 := by
simp only [centerMass, sum_empty, smul_zero]
#align finset.center_mass_empty Finset.centerMass_empty
theorem Finset.centerMass_pair (hne : i ≠ j) :
({i, j} : Finset ι).centerMass w z = (w i / (w i + w j)) • z i + (w j / (w i + w j)) • z j := by
simp only [centerMass, sum_pair hne, smul_add, (mul_smul _ _ _).symm, div_eq_inv_mul]
#align finset.center_mass_pair Finset.centerMass_pair
variable {w}
theorem Finset.centerMass_insert (ha : i ∉ t) (hw : ∑ j ∈ t, w j ≠ 0) :
(insert i t).centerMass w z =
(w i / (w i + ∑ j ∈ t, w j)) • z i +
((∑ j ∈ t, w j) / (w i + ∑ j ∈ t, w j)) • t.centerMass w z := by
simp only [centerMass, sum_insert ha, smul_add, (mul_smul _ _ _).symm, ← div_eq_inv_mul]
congr 2
rw [div_mul_eq_mul_div, mul_inv_cancel hw, one_div]
#align finset.center_mass_insert Finset.centerMass_insert
theorem Finset.centerMass_singleton (hw : w i ≠ 0) : ({i} : Finset ι).centerMass w z = z i := by
rw [centerMass, sum_singleton, sum_singleton, ← mul_smul, inv_mul_cancel hw, one_smul]
#align finset.center_mass_singleton Finset.centerMass_singleton
@[simp] lemma Finset.centerMass_neg_left : t.centerMass (-w) z = t.centerMass w z := by
simp [centerMass, inv_neg]
lemma Finset.centerMass_smul_left {c : R'} [Module R' R] [Module R' E] [SMulCommClass R' R R]
[IsScalarTower R' R R] [SMulCommClass R R' E] [IsScalarTower R' R E] (hc : c ≠ 0) :
t.centerMass (c • w) z = t.centerMass w z := by
simp [centerMass, -smul_assoc, smul_assoc c, ← smul_sum, smul_inv₀, smul_smul_smul_comm, hc]
| Mathlib/Analysis/Convex/Combination.lean | 82 | 84 | theorem Finset.centerMass_eq_of_sum_1 (hw : ∑ i ∈ t, w i = 1) :
t.centerMass w z = ∑ i ∈ t, w i • z i := by |
simp only [Finset.centerMass, hw, inv_one, one_smul]
| 1 |
import Mathlib.Algebra.ContinuedFractions.Computation.Basic
import Mathlib.Algebra.ContinuedFractions.Translations
#align_import algebra.continued_fractions.computation.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
-- Fix a discrete linear ordered floor field and a value `v`.
variable {K : Type*} [LinearOrderedField K] [FloorRing K] {v : K}
namespace IntFractPair
theorem stream_zero (v : K) : IntFractPair.stream v 0 = some (IntFractPair.of v) :=
rfl
#align generalized_continued_fraction.int_fract_pair.stream_zero GeneralizedContinuedFraction.IntFractPair.stream_zero
variable {n : ℕ}
theorem stream_eq_none_of_fr_eq_zero {ifp_n : IntFractPair K}
(stream_nth_eq : IntFractPair.stream v n = some ifp_n) (nth_fr_eq_zero : ifp_n.fr = 0) :
IntFractPair.stream v (n + 1) = none := by
cases' ifp_n with _ fr
change fr = 0 at nth_fr_eq_zero
simp [IntFractPair.stream, stream_nth_eq, nth_fr_eq_zero]
#align generalized_continued_fraction.int_fract_pair.stream_eq_none_of_fr_eq_zero GeneralizedContinuedFraction.IntFractPair.stream_eq_none_of_fr_eq_zero
theorem succ_nth_stream_eq_none_iff :
IntFractPair.stream v (n + 1) = none ↔
IntFractPair.stream v n = none ∨ ∃ ifp, IntFractPair.stream v n = some ifp ∧ ifp.fr = 0 := by
rw [IntFractPair.stream]
cases IntFractPair.stream v n <;> simp [imp_false]
#align generalized_continued_fraction.int_fract_pair.succ_nth_stream_eq_none_iff GeneralizedContinuedFraction.IntFractPair.succ_nth_stream_eq_none_iff
| Mathlib/Algebra/ContinuedFractions/Computation/Translations.lean | 87 | 92 | theorem succ_nth_stream_eq_some_iff {ifp_succ_n : IntFractPair K} :
IntFractPair.stream v (n + 1) = some ifp_succ_n ↔
∃ ifp_n : IntFractPair K,
IntFractPair.stream v n = some ifp_n ∧
ifp_n.fr ≠ 0 ∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n := by |
simp [IntFractPair.stream, ite_eq_iff, Option.bind_eq_some]
| 1 |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Rat.Cast.Order
import Mathlib.Order.Partition.Finpartition
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
#align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1"
open Finset
variable {𝕜 ι κ α β : Type*}
namespace Rel
section Asymmetric
variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α}
{t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜}
def interedges (s : Finset α) (t : Finset β) : Finset (α × β) :=
(s ×ˢ t).filter fun e ↦ r e.1 e.2
#align rel.interedges Rel.interedges
def edgeDensity (s : Finset α) (t : Finset β) : ℚ :=
(interedges r s t).card / (s.card * t.card)
#align rel.edge_density Rel.edgeDensity
variable {r}
theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by
rw [interedges, mem_filter, Finset.mem_product, and_assoc]
#align rel.mem_interedges_iff Rel.mem_interedges_iff
theorem mk_mem_interedges_iff : (a, b) ∈ interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b :=
mem_interedges_iff
#align rel.mk_mem_interedges_iff Rel.mk_mem_interedges_iff
@[simp]
theorem interedges_empty_left (t : Finset β) : interedges r ∅ t = ∅ := by
rw [interedges, Finset.empty_product, filter_empty]
#align rel.interedges_empty_left Rel.interedges_empty_left
theorem interedges_mono (hs : s₂ ⊆ s₁) (ht : t₂ ⊆ t₁) : interedges r s₂ t₂ ⊆ interedges r s₁ t₁ :=
fun x ↦ by
simp_rw [mem_interedges_iff]
exact fun h ↦ ⟨hs h.1, ht h.2.1, h.2.2⟩
#align rel.interedges_mono Rel.interedges_mono
variable (r)
theorem card_interedges_add_card_interedges_compl (s : Finset α) (t : Finset β) :
(interedges r s t).card + (interedges (fun x y ↦ ¬r x y) s t).card = s.card * t.card := by
classical
rw [← card_product, interedges, interedges, ← card_union_of_disjoint, filter_union_filter_neg_eq]
exact disjoint_filter.2 fun _ _ ↦ Classical.not_not.2
#align rel.card_interedges_add_card_interedges_compl Rel.card_interedges_add_card_interedges_compl
theorem interedges_disjoint_left {s s' : Finset α} (hs : Disjoint s s') (t : Finset β) :
Disjoint (interedges r s t) (interedges r s' t) := by
rw [Finset.disjoint_left] at hs ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact hs hx.1 hy.1
#align rel.interedges_disjoint_left Rel.interedges_disjoint_left
theorem interedges_disjoint_right (s : Finset α) {t t' : Finset β} (ht : Disjoint t t') :
Disjoint (interedges r s t) (interedges r s t') := by
rw [Finset.disjoint_left] at ht ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact ht hx.2.1 hy.2.1
#align rel.interedges_disjoint_right Rel.interedges_disjoint_right
theorem card_interedges_le_mul (s : Finset α) (t : Finset β) :
(interedges r s t).card ≤ s.card * t.card :=
(card_filter_le _ _).trans (card_product _ _).le
#align rel.card_interedges_le_mul Rel.card_interedges_le_mul
| Mathlib/Combinatorics/SimpleGraph/Density.lean | 136 | 137 | theorem edgeDensity_nonneg (s : Finset α) (t : Finset β) : 0 ≤ edgeDensity r s t := by |
apply div_nonneg <;> exact mod_cast Nat.zero_le _
| 1 |
import Mathlib.CategoryTheory.Preadditive.Basic
#align_import category_theory.preadditive.functor_category from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3"
namespace CategoryTheory
open CategoryTheory.Limits Preadditive
variable {C D : Type*} [Category C] [Category D] [Preadditive D]
instance {F G : C ⥤ D} : Zero (F ⟶ G) where
zero := { app := fun X => 0 }
instance {F G : C ⥤ D} : Add (F ⟶ G) where
add α β := { app := fun X => α.app X + β.app X }
instance {F G : C ⥤ D} : Neg (F ⟶ G) where
neg α := { app := fun X => -α.app X }
instance functorCategoryPreadditive : Preadditive (C ⥤ D) where
homGroup F G :=
{ nsmul := nsmulRec
zsmul := zsmulRec
sub := fun α β => { app := fun X => α.app X - β.app X }
add_assoc := by
intros
ext
apply add_assoc
zero_add := by
intros
dsimp
ext
apply zero_add
add_zero := by
intros
dsimp
ext
apply add_zero
add_comm := by
intros
dsimp
ext
apply add_comm
sub_eq_add_neg := by
intros
dsimp
ext
apply sub_eq_add_neg
add_left_neg := by
intros
dsimp
ext
apply add_left_neg }
add_comp := by
intros
dsimp
ext
apply add_comp
comp_add := by
intros
dsimp
ext
apply comp_add
#align category_theory.functor_category_preadditive CategoryTheory.functorCategoryPreadditive
namespace NatTrans
variable {F G : C ⥤ D}
@[simps]
def appHom (X : C) : (F ⟶ G) →+ (F.obj X ⟶ G.obj X) where
toFun α := α.app X
map_zero' := rfl
map_add' _ _ := rfl
#align category_theory.nat_trans.app_hom CategoryTheory.NatTrans.appHom
@[simp]
theorem app_zero (X : C) : (0 : F ⟶ G).app X = 0 :=
rfl
#align category_theory.nat_trans.app_zero CategoryTheory.NatTrans.app_zero
@[simp]
theorem app_add (X : C) (α β : F ⟶ G) : (α + β).app X = α.app X + β.app X :=
rfl
#align category_theory.nat_trans.app_add CategoryTheory.NatTrans.app_add
@[simp]
theorem app_sub (X : C) (α β : F ⟶ G) : (α - β).app X = α.app X - β.app X :=
rfl
#align category_theory.nat_trans.app_sub CategoryTheory.NatTrans.app_sub
@[simp]
theorem app_neg (X : C) (α : F ⟶ G) : (-α).app X = -α.app X :=
rfl
#align category_theory.nat_trans.app_neg CategoryTheory.NatTrans.app_neg
@[simp]
theorem app_nsmul (X : C) (α : F ⟶ G) (n : ℕ) : (n • α).app X = n • α.app X :=
(appHom X).map_nsmul α n
#align category_theory.nat_trans.app_nsmul CategoryTheory.NatTrans.app_nsmul
@[simp]
theorem app_zsmul (X : C) (α : F ⟶ G) (n : ℤ) : (n • α).app X = n • α.app X :=
(appHom X : (F ⟶ G) →+ (F.obj X ⟶ G.obj X)).map_zsmul α n
#align category_theory.nat_trans.app_zsmul CategoryTheory.NatTrans.app_zsmul
@[simp]
theorem app_units_zsmul (X : C) (α : F ⟶ G) (n : ℤˣ) : (n • α).app X = n • α.app X := by
apply app_zsmul
@[simp]
| Mathlib/CategoryTheory/Preadditive/FunctorCategory.lean | 127 | 129 | theorem app_sum {ι : Type*} (s : Finset ι) (X : C) (α : ι → (F ⟶ G)) :
(∑ i ∈ s, α i).app X = ∑ i ∈ s, (α i).app X := by |
simp only [← appHom_apply, map_sum]
| 1 |
import Mathlib.Order.Ideal
#align_import order.pfilter from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da"
open OrderDual
namespace Order
structure PFilter (P : Type*) [Preorder P] where
dual : Ideal Pᵒᵈ
#align order.pfilter Order.PFilter
variable {P : Type*}
def IsPFilter [Preorder P] (F : Set P) : Prop :=
IsIdeal (OrderDual.ofDual ⁻¹' F)
#align order.is_pfilter Order.IsPFilter
theorem IsPFilter.of_def [Preorder P] {F : Set P} (nonempty : F.Nonempty)
(directed : DirectedOn (· ≥ ·) F) (mem_of_le : ∀ {x y : P}, x ≤ y → x ∈ F → y ∈ F) :
IsPFilter F :=
⟨fun _ _ _ _ => mem_of_le ‹_› ‹_›, nonempty, directed⟩
#align order.is_pfilter.of_def Order.IsPFilter.of_def
def IsPFilter.toPFilter [Preorder P] {F : Set P} (h : IsPFilter F) : PFilter P :=
⟨h.toIdeal⟩
#align order.is_pfilter.to_pfilter Order.IsPFilter.toPFilter
namespace PFilter
section Preorder
variable [Preorder P] {x y : P} (F s t : PFilter P)
instance [Inhabited P] : Inhabited (PFilter P) := ⟨⟨default⟩⟩
instance : SetLike (PFilter P) P where
coe F := toDual ⁻¹' F.dual.carrier
coe_injective' := fun ⟨_⟩ ⟨_⟩ h => congr_arg mk <| Ideal.ext h
#align order.pfilter.mem_coe SetLike.mem_coeₓ
theorem isPFilter : IsPFilter (F : Set P) := F.dual.isIdeal
#align order.pfilter.is_pfilter Order.PFilter.isPFilter
protected theorem nonempty : (F : Set P).Nonempty := F.dual.nonempty
#align order.pfilter.nonempty Order.PFilter.nonempty
theorem directed : DirectedOn (· ≥ ·) (F : Set P) := F.dual.directed
#align order.pfilter.directed Order.PFilter.directed
theorem mem_of_le {F : PFilter P} : x ≤ y → x ∈ F → y ∈ F := fun h => F.dual.lower h
#align order.pfilter.mem_of_le Order.PFilter.mem_of_le
@[ext]
theorem ext (h : (s : Set P) = t) : s = t := SetLike.ext' h
#align order.pfilter.ext Order.PFilter.ext
@[trans]
theorem mem_of_mem_of_le {F G : PFilter P} (hx : x ∈ F) (hle : F ≤ G) : x ∈ G :=
hle hx
#align order.pfilter.mem_of_mem_of_le Order.PFilter.mem_of_mem_of_le
def principal (p : P) : PFilter P :=
⟨Ideal.principal (toDual p)⟩
#align order.pfilter.principal Order.PFilter.principal
@[simp]
theorem mem_mk (x : P) (I : Ideal Pᵒᵈ) : x ∈ (⟨I⟩ : PFilter P) ↔ toDual x ∈ I :=
Iff.rfl
#align order.pfilter.mem_def Order.PFilter.mem_mk
@[simp]
theorem principal_le_iff {F : PFilter P} : principal x ≤ F ↔ x ∈ F :=
Ideal.principal_le_iff (x := toDual x)
#align order.pfilter.principal_le_iff Order.PFilter.principal_le_iff
@[simp] theorem mem_principal : x ∈ principal y ↔ y ≤ x := Iff.rfl
#align order.pfilter.mem_principal Order.PFilter.mem_principal
| Mathlib/Order/PFilter.lean | 120 | 120 | theorem principal_le_principal_iff {p q : P} : principal q ≤ principal p ↔ p ≤ q := by | simp
| 1 |
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]
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]
#align list.of_fn_congr List.ofFn_congr
@[simp]
theorem ofFn_zero (f : Fin 0 → α) : ofFn f = [] :=
ext_get (by simp) (fun i hi₁ hi₂ => by contradiction)
#align list.of_fn_zero List.ofFn_zero
@[simp]
theorem ofFn_succ {n} (f : Fin (succ n) → α) : ofFn f = f 0 :: ofFn fun i => f i.succ :=
ext_get (by simp) (fun i hi₁ hi₂ => by
cases i
· simp; rfl
· simp)
#align list.of_fn_succ List.ofFn_succ
theorem ofFn_succ' {n} (f : Fin (succ n) → α) :
ofFn f = (ofFn fun i => f (Fin.castSucc i)).concat (f (Fin.last _)) := by
induction' n with n IH
· rw [ofFn_zero, concat_nil, ofFn_succ, ofFn_zero]
rfl
· rw [ofFn_succ, IH, ofFn_succ, concat_cons, Fin.castSucc_zero]
congr
#align list.of_fn_succ' List.ofFn_succ'
@[simp]
theorem ofFn_eq_nil_iff {n : ℕ} {f : Fin n → α} : ofFn f = [] ↔ n = 0 := by
cases n <;> simp only [ofFn_zero, ofFn_succ, eq_self_iff_true, Nat.succ_ne_zero]
#align list.of_fn_eq_nil_iff List.ofFn_eq_nil_iff
| Mathlib/Data/List/OfFn.lean | 139 | 141 | theorem last_ofFn {n : ℕ} (f : Fin n → α) (h : ofFn f ≠ [])
(hn : n - 1 < n := Nat.pred_lt <| ofFn_eq_nil_iff.not.mp h) :
getLast (ofFn f) h = f ⟨n - 1, hn⟩ := by | simp [getLast_eq_get]
| 1 |
import Mathlib.LinearAlgebra.Matrix.DotProduct
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
#align_import data.matrix.rank from "leanprover-community/mathlib"@"17219820a8aa8abe85adf5dfde19af1dd1bd8ae7"
open Matrix
namespace Matrix
open FiniteDimensional
variable {l m n o R : Type*} [Fintype n] [Fintype o]
section CommRing
variable [CommRing R]
noncomputable def rank (A : Matrix m n R) : ℕ :=
finrank R <| LinearMap.range A.mulVecLin
#align matrix.rank Matrix.rank
@[simp]
| Mathlib/Data/Matrix/Rank.lean | 49 | 51 | theorem rank_one [StrongRankCondition R] [DecidableEq n] :
rank (1 : Matrix n n R) = Fintype.card n := by |
rw [rank, mulVecLin_one, LinearMap.range_id, finrank_top, finrank_pi]
| 1 |
import Mathlib.Algebra.GroupWithZero.Units.Basic
import Mathlib.Algebra.Group.Semiconj.Units
import Mathlib.Init.Classical
#align_import algebra.group_with_zero.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
assert_not_exists DenselyOrdered
variable {α M₀ G₀ M₀' G₀' F F' : Type*}
namespace SemiconjBy
@[simp]
theorem zero_right [MulZeroClass G₀] (a : G₀) : SemiconjBy a 0 0 := by
simp only [SemiconjBy, mul_zero, zero_mul]
#align semiconj_by.zero_right SemiconjBy.zero_right
@[simp]
| Mathlib/Algebra/GroupWithZero/Semiconj.lean | 29 | 30 | theorem zero_left [MulZeroClass G₀] (x y : G₀) : SemiconjBy 0 x y := by |
simp only [SemiconjBy, mul_zero, zero_mul]
| 1 |
import Mathlib.Topology.Sets.Opens
#align_import topology.local_at_target from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open TopologicalSpace Set Filter
open Topology Filter
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β}
variable {s : Set β} {ι : Type*} {U : ι → Opens β} (hU : iSup U = ⊤)
theorem Set.restrictPreimage_inducing (s : Set β) (h : Inducing f) :
Inducing (s.restrictPreimage f) := by
simp_rw [← inducing_subtype_val.of_comp_iff, inducing_iff_nhds, restrictPreimage,
MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊢
intro a
rw [← h, ← inducing_subtype_val.nhds_eq_comap]
#align set.restrict_preimage_inducing Set.restrictPreimage_inducing
alias Inducing.restrictPreimage := Set.restrictPreimage_inducing
#align inducing.restrict_preimage Inducing.restrictPreimage
theorem Set.restrictPreimage_embedding (s : Set β) (h : Embedding f) :
Embedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s, h.2.restrictPreimage s⟩
#align set.restrict_preimage_embedding Set.restrictPreimage_embedding
alias Embedding.restrictPreimage := Set.restrictPreimage_embedding
#align embedding.restrict_preimage Embedding.restrictPreimage
theorem Set.restrictPreimage_openEmbedding (s : Set β) (h : OpenEmbedding f) :
OpenEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ continuous_subtype_val.isOpen_preimage _ h.isOpen_range⟩
#align set.restrict_preimage_open_embedding Set.restrictPreimage_openEmbedding
alias OpenEmbedding.restrictPreimage := Set.restrictPreimage_openEmbedding
#align open_embedding.restrict_preimage OpenEmbedding.restrictPreimage
theorem Set.restrictPreimage_closedEmbedding (s : Set β) (h : ClosedEmbedding f) :
ClosedEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ inducing_subtype_val.isClosed_preimage _ h.isClosed_range⟩
#align set.restrict_preimage_closed_embedding Set.restrictPreimage_closedEmbedding
alias ClosedEmbedding.restrictPreimage := Set.restrictPreimage_closedEmbedding
#align closed_embedding.restrict_preimage ClosedEmbedding.restrictPreimage
theorem IsClosedMap.restrictPreimage (H : IsClosedMap f) (s : Set β) :
IsClosedMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsClosed u → Subtype.val ⁻¹' u = t →
∃ v, IsClosed v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isClosed_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
@[deprecated (since := "2024-04-02")]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
IsClosedMap (s.restrictPreimage f) := H.restrictPreimage s
theorem IsOpenMap.restrictPreimage (H : IsOpenMap f) (s : Set β) :
IsOpenMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsOpen u → Subtype.val ⁻¹' u = t →
∃ v, IsOpen v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isOpen_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
@[deprecated (since := "2024-04-02")]
theorem Set.restrictPreimage_isOpenMap (s : Set β) (H : IsOpenMap f) :
IsOpenMap (s.restrictPreimage f) := H.restrictPreimage s
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
constructor
· exact fun H i => H.inter (U i).2
· intro H
have : ⋃ i, (U i : Set β) = Set.univ := by
convert congr_arg (SetLike.coe) hU
simp
rw [← s.inter_univ, ← this, Set.inter_iUnion]
exact isOpen_iUnion H
#align is_open_iff_inter_of_supr_eq_top isOpen_iff_inter_of_iSup_eq_top
theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
-- Porting note: rewrote to avoid ´simp´ issues
rw [isOpen_iff_inter_of_iSup_eq_top hU s]
refine forall_congr' fun i => ?_
rw [(U _).2.openEmbedding_subtype_val.open_iff_image_open]
erw [Set.image_preimage_eq_inter_range]
rw [Subtype.range_coe, Opens.carrier_eq_coe]
#align is_open_iff_coe_preimage_of_supr_eq_top isOpen_iff_coe_preimage_of_iSup_eq_top
| Mathlib/Topology/LocalAtTarget.lean | 111 | 113 | theorem isClosed_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
IsClosed s ↔ ∀ i, IsClosed ((↑) ⁻¹' s : Set (U i)) := by |
simpa using isOpen_iff_coe_preimage_of_iSup_eq_top hU sᶜ
| 1 |
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace 𝕜 G]
structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends
IsLinearMap 𝕜 f : Prop where
bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖
#align is_bounded_linear_map IsBoundedLinearMap
theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ)
(h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f :=
⟨hf,
by_cases
(fun (this : M ≤ 0) =>
⟨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩)
fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩
#align is_linear_map.with_bound IsLinearMap.with_bound
theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f :=
{ f.toLinearMap.isLinear with bound := f.bound }
#align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap
namespace IsBoundedLinearMap
def toLinearMap (f : E → F) (h : IsBoundedLinearMap 𝕜 f) : E →ₗ[𝕜] F :=
IsLinearMap.mk' _ h.toIsLinearMap
#align is_bounded_linear_map.to_linear_map IsBoundedLinearMap.toLinearMap
def toContinuousLinearMap {f : E → F} (hf : IsBoundedLinearMap 𝕜 f) : E →L[𝕜] F :=
{ toLinearMap f hf with
cont :=
let ⟨C, _, hC⟩ := hf.bound
AddMonoidHomClass.continuous_of_bound (toLinearMap f hf) C hC }
#align is_bounded_linear_map.to_continuous_linear_map IsBoundedLinearMap.toContinuousLinearMap
theorem zero : IsBoundedLinearMap 𝕜 fun _ : E => (0 : F) :=
(0 : E →ₗ[𝕜] F).isLinear.with_bound 0 <| by simp [le_refl]
#align is_bounded_linear_map.zero IsBoundedLinearMap.zero
theorem id : IsBoundedLinearMap 𝕜 fun x : E => x :=
LinearMap.id.isLinear.with_bound 1 <| by simp [le_refl]
#align is_bounded_linear_map.id IsBoundedLinearMap.id
theorem fst : IsBoundedLinearMap 𝕜 fun x : E × F => x.1 := by
refine (LinearMap.fst 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_left _ _
#align is_bounded_linear_map.fst IsBoundedLinearMap.fst
theorem snd : IsBoundedLinearMap 𝕜 fun x : E × F => x.2 := by
refine (LinearMap.snd 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_right _ _
#align is_bounded_linear_map.snd IsBoundedLinearMap.snd
variable {f g : E → F}
theorem smul (c : 𝕜) (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 (c • f) :=
let ⟨hlf, M, _, hM⟩ := hf
(c • hlf.mk' f).isLinear.with_bound (‖c‖ * M) fun x =>
calc
‖c • f x‖ = ‖c‖ * ‖f x‖ := norm_smul c (f x)
_ ≤ ‖c‖ * (M * ‖x‖) := mul_le_mul_of_nonneg_left (hM _) (norm_nonneg _)
_ = ‖c‖ * M * ‖x‖ := (mul_assoc _ _ _).symm
#align is_bounded_linear_map.smul IsBoundedLinearMap.smul
theorem neg (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 fun e => -f e := by
rw [show (fun e => -f e) = fun e => (-1 : 𝕜) • f e by funext; simp]
exact smul (-1) hf
#align is_bounded_linear_map.neg IsBoundedLinearMap.neg
theorem add (hf : IsBoundedLinearMap 𝕜 f) (hg : IsBoundedLinearMap 𝕜 g) :
IsBoundedLinearMap 𝕜 fun e => f e + g e :=
let ⟨hlf, Mf, _, hMf⟩ := hf
let ⟨hlg, Mg, _, hMg⟩ := hg
(hlf.mk' _ + hlg.mk' _).isLinear.with_bound (Mf + Mg) fun x =>
calc
‖f x + g x‖ ≤ Mf * ‖x‖ + Mg * ‖x‖ := norm_add_le_of_le (hMf x) (hMg x)
_ ≤ (Mf + Mg) * ‖x‖ := by rw [add_mul]
#align is_bounded_linear_map.add IsBoundedLinearMap.add
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 155 | 156 | theorem sub (hf : IsBoundedLinearMap 𝕜 f) (hg : IsBoundedLinearMap 𝕜 g) :
IsBoundedLinearMap 𝕜 fun e => f e - g e := by | simpa [sub_eq_add_neg] using add hf (neg hg)
| 1 |
import Mathlib.AlgebraicTopology.DoldKan.FunctorN
#align_import algebraic_topology.dold_kan.normalized from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
CategoryTheory.Subobject CategoryTheory.Idempotents DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
universe v
variable {A : Type*} [Category A] [Abelian A] {X : SimplicialObject A}
theorem HigherFacesVanish.inclusionOfMooreComplexMap (n : ℕ) :
HigherFacesVanish (n + 1) ((inclusionOfMooreComplexMap X).f (n + 1)) := fun j _ => by
dsimp [AlgebraicTopology.inclusionOfMooreComplexMap, NormalizedMooreComplex.objX]
rw [← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ j
(by simp only [Finset.mem_univ])), assoc, kernelSubobject_arrow_comp, comp_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.higher_faces_vanish.inclusion_of_Moore_complex_map AlgebraicTopology.DoldKan.HigherFacesVanish.inclusionOfMooreComplexMap
theorem factors_normalizedMooreComplex_PInfty (n : ℕ) :
Subobject.Factors (NormalizedMooreComplex.objX X n) (PInfty.f n) := by
rcases n with _|n
· apply top_factors
· rw [PInfty_f, NormalizedMooreComplex.objX, finset_inf_factors]
intro i _
apply kernelSubobject_factors
exact (HigherFacesVanish.of_P (n + 1) n) i le_add_self
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.factors_normalized_Moore_complex_P_infty AlgebraicTopology.DoldKan.factors_normalizedMooreComplex_PInfty
@[simps!]
def PInftyToNormalizedMooreComplex (X : SimplicialObject A) : K[X] ⟶ N[X] :=
ChainComplex.ofHom _ _ _ _ _ _
(fun n => factorThru _ _ (factors_normalizedMooreComplex_PInfty n)) fun n => by
rw [← cancel_mono (NormalizedMooreComplex.objX X n).arrow, assoc, assoc, factorThru_arrow,
← inclusionOfMooreComplexMap_f, ← normalizedMooreComplex_objD,
← (inclusionOfMooreComplexMap X).comm (n + 1) n, inclusionOfMooreComplexMap_f,
factorThru_arrow_assoc, ← alternatingFaceMapComplex_obj_d]
exact PInfty.comm (n + 1) n
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_infty_to_normalized_Moore_complex AlgebraicTopology.DoldKan.PInftyToNormalizedMooreComplex
@[reassoc (attr := simp)]
theorem PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (X : SimplicialObject A) :
PInftyToNormalizedMooreComplex X ≫ inclusionOfMooreComplexMap X = PInfty := by aesop_cat
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_infty_to_normalized_Moore_complex_comp_inclusion_of_Moore_complex_map AlgebraicTopology.DoldKan.PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap
@[reassoc (attr := simp)]
theorem PInftyToNormalizedMooreComplex_naturality {X Y : SimplicialObject A} (f : X ⟶ Y) :
AlternatingFaceMapComplex.map f ≫ PInftyToNormalizedMooreComplex Y =
PInftyToNormalizedMooreComplex X ≫ NormalizedMooreComplex.map f := by
aesop_cat
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_infty_to_normalized_Moore_complex_naturality AlgebraicTopology.DoldKan.PInftyToNormalizedMooreComplex_naturality
@[reassoc (attr := simp)]
| Mathlib/AlgebraicTopology/DoldKan/Normalized.lean | 91 | 92 | theorem PInfty_comp_PInftyToNormalizedMooreComplex (X : SimplicialObject A) :
PInfty ≫ PInftyToNormalizedMooreComplex X = PInftyToNormalizedMooreComplex X := by | aesop_cat
| 1 |
import Mathlib.Algebra.GeomSum
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Algebra.Ring.Int
import Mathlib.NumberTheory.Padics.PadicVal
import Mathlib.RingTheory.Ideal.Quotient
#align_import number_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open Ideal Ideal.Quotient Finset
variable {R : Type*} {n : ℕ}
section CommRing
variable [CommRing R] {a b x y : R}
theorem dvd_geom_sum₂_iff_of_dvd_sub {x y p : R} (h : p ∣ x - y) :
(p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) ↔ p ∣ n * y ^ (n - 1) := by
rw [← mem_span_singleton, ← Ideal.Quotient.eq] at h
simp only [← mem_span_singleton, ← eq_zero_iff_mem, RingHom.map_geom_sum₂, h, geom_sum₂_self,
_root_.map_mul, map_pow, map_natCast]
#align dvd_geom_sum₂_iff_of_dvd_sub dvd_geom_sum₂_iff_of_dvd_sub
| Mathlib/NumberTheory/Multiplicity.lean | 46 | 48 | theorem dvd_geom_sum₂_iff_of_dvd_sub' {x y p : R} (h : p ∣ x - y) :
(p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) ↔ p ∣ n * x ^ (n - 1) := by |
rw [geom_sum₂_comm, dvd_geom_sum₂_iff_of_dvd_sub]; simpa using h.neg_right
| 1 |
import Mathlib.Computability.DFA
import Mathlib.Data.Fintype.Powerset
#align_import computability.NFA from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
open Set
open Computability
universe u v
-- Porting note: Required as `NFA` is used in mathlib3
set_option linter.uppercaseLean3 false
structure NFA (α : Type u) (σ : Type v) where
step : σ → α → Set σ
start : Set σ
accept : Set σ
#align NFA NFA
variable {α : Type u} {σ σ' : Type v} (M : NFA α σ)
namespace NFA
instance : Inhabited (NFA α σ) :=
⟨NFA.mk (fun _ _ => ∅) ∅ ∅⟩
def stepSet (S : Set σ) (a : α) : Set σ :=
⋃ s ∈ S, M.step s a
#align NFA.step_set NFA.stepSet
| Mathlib/Computability/NFA.lean | 53 | 54 | theorem mem_stepSet (s : σ) (S : Set σ) (a : α) : s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.step t a := by |
simp [stepSet]
| 1 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : ℕ)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 89 | 90 | theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc ↑a ↑b := by |
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
| 1 |
import Mathlib.Data.Finset.Image
#align_import data.finset.card from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
assert_not_exists MonoidWithZero
-- TODO: After a lot more work,
-- assert_not_exists OrderedCommMonoid
open Function Multiset Nat
variable {α β R : Type*}
namespace Finset
variable {s t : Finset α} {a b : α}
def card (s : Finset α) : ℕ :=
Multiset.card s.1
#align finset.card Finset.card
theorem card_def (s : Finset α) : s.card = Multiset.card s.1 :=
rfl
#align finset.card_def Finset.card_def
@[simp] lemma card_val (s : Finset α) : Multiset.card s.1 = s.card := rfl
#align finset.card_val Finset.card_val
@[simp]
theorem card_mk {m nodup} : (⟨m, nodup⟩ : Finset α).card = Multiset.card m :=
rfl
#align finset.card_mk Finset.card_mk
@[simp]
theorem card_empty : card (∅ : Finset α) = 0 :=
rfl
#align finset.card_empty Finset.card_empty
@[gcongr]
theorem card_le_card : s ⊆ t → s.card ≤ t.card :=
Multiset.card_le_card ∘ val_le_iff.mpr
#align finset.card_le_of_subset Finset.card_le_card
@[mono]
theorem card_mono : Monotone (@card α) := by apply card_le_card
#align finset.card_mono Finset.card_mono
@[simp] lemma card_eq_zero : s.card = 0 ↔ s = ∅ := card_eq_zero.trans val_eq_zero
lemma card_ne_zero : s.card ≠ 0 ↔ s.Nonempty := card_eq_zero.ne.trans nonempty_iff_ne_empty.symm
lemma card_pos : 0 < s.card ↔ s.Nonempty := Nat.pos_iff_ne_zero.trans card_ne_zero
#align finset.card_eq_zero Finset.card_eq_zero
#align finset.card_pos Finset.card_pos
alias ⟨_, Nonempty.card_pos⟩ := card_pos
alias ⟨_, Nonempty.card_ne_zero⟩ := card_ne_zero
#align finset.nonempty.card_pos Finset.Nonempty.card_pos
theorem card_ne_zero_of_mem (h : a ∈ s) : s.card ≠ 0 :=
(not_congr card_eq_zero).2 <| ne_empty_of_mem h
#align finset.card_ne_zero_of_mem Finset.card_ne_zero_of_mem
@[simp]
theorem card_singleton (a : α) : card ({a} : Finset α) = 1 :=
Multiset.card_singleton _
#align finset.card_singleton Finset.card_singleton
theorem card_singleton_inter [DecidableEq α] : ({a} ∩ s).card ≤ 1 := by
cases' Finset.decidableMem a s with h h
· simp [Finset.singleton_inter_of_not_mem h]
· simp [Finset.singleton_inter_of_mem h]
#align finset.card_singleton_inter Finset.card_singleton_inter
@[simp]
theorem card_cons (h : a ∉ s) : (s.cons a h).card = s.card + 1 :=
Multiset.card_cons _ _
#align finset.card_cons Finset.card_cons
section InsertErase
variable [DecidableEq α]
@[simp]
theorem card_insert_of_not_mem (h : a ∉ s) : (insert a s).card = s.card + 1 := by
rw [← cons_eq_insert _ _ h, card_cons]
#align finset.card_insert_of_not_mem Finset.card_insert_of_not_mem
| Mathlib/Data/Finset/Card.lean | 111 | 111 | theorem card_insert_of_mem (h : a ∈ s) : card (insert a s) = s.card := by | rw [insert_eq_of_mem h]
| 1 |
import Batteries.Tactic.Lint.Basic
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Order.ZeroLEOne
import Mathlib.Data.Nat.Cast.Order
import Mathlib.Init.Data.Int.Order
set_option autoImplicit true
namespace Linarith
theorem lt_irrefl {α : Type u} [Preorder α] {a : α} : ¬a < a := _root_.lt_irrefl a
| Mathlib/Tactic/Linarith/Lemmas.lean | 27 | 28 | theorem eq_of_eq_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b = 0) : a + b = 0 := by |
simp [*]
| 1 |
import Mathlib.Analysis.SpecialFunctions.Exp
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Analysis.NormedSpace.Real
#align_import analysis.special_functions.log.basic from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def log (x : ℝ) : ℝ :=
if hx : x = 0 then 0 else expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩
#align real.log Real.log
theorem log_of_ne_zero (hx : x ≠ 0) : log x = expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ :=
dif_neg hx
#align real.log_of_ne_zero Real.log_of_ne_zero
theorem log_of_pos (hx : 0 < x) : log x = expOrderIso.symm ⟨x, hx⟩ := by
rw [log_of_ne_zero hx.ne']
congr
exact abs_of_pos hx
#align real.log_of_pos Real.log_of_pos
theorem exp_log_eq_abs (hx : x ≠ 0) : exp (log x) = |x| := by
rw [log_of_ne_zero hx, ← coe_expOrderIso_apply, OrderIso.apply_symm_apply, Subtype.coe_mk]
#align real.exp_log_eq_abs Real.exp_log_eq_abs
theorem exp_log (hx : 0 < x) : exp (log x) = x := by
rw [exp_log_eq_abs hx.ne']
exact abs_of_pos hx
#align real.exp_log Real.exp_log
theorem exp_log_of_neg (hx : x < 0) : exp (log x) = -x := by
rw [exp_log_eq_abs (ne_of_lt hx)]
exact abs_of_neg hx
#align real.exp_log_of_neg Real.exp_log_of_neg
theorem le_exp_log (x : ℝ) : x ≤ exp (log x) := by
by_cases h_zero : x = 0
· rw [h_zero, log, dif_pos rfl, exp_zero]
exact zero_le_one
· rw [exp_log_eq_abs h_zero]
exact le_abs_self _
#align real.le_exp_log Real.le_exp_log
@[simp]
theorem log_exp (x : ℝ) : log (exp x) = x :=
exp_injective <| exp_log (exp_pos x)
#align real.log_exp Real.log_exp
theorem surjOn_log : SurjOn log (Ioi 0) univ := fun x _ => ⟨exp x, exp_pos x, log_exp x⟩
#align real.surj_on_log Real.surjOn_log
theorem log_surjective : Surjective log := fun x => ⟨exp x, log_exp x⟩
#align real.log_surjective Real.log_surjective
@[simp]
theorem range_log : range log = univ :=
log_surjective.range_eq
#align real.range_log Real.range_log
@[simp]
theorem log_zero : log 0 = 0 :=
dif_pos rfl
#align real.log_zero Real.log_zero
@[simp]
theorem log_one : log 1 = 0 :=
exp_injective <| by rw [exp_log zero_lt_one, exp_zero]
#align real.log_one Real.log_one
@[simp]
theorem log_abs (x : ℝ) : log |x| = log x := by
by_cases h : x = 0
· simp [h]
· rw [← exp_eq_exp, exp_log_eq_abs h, exp_log_eq_abs (abs_pos.2 h).ne', abs_abs]
#align real.log_abs Real.log_abs
@[simp]
theorem log_neg_eq_log (x : ℝ) : log (-x) = log x := by rw [← log_abs x, ← log_abs (-x), abs_neg]
#align real.log_neg_eq_log Real.log_neg_eq_log
theorem sinh_log {x : ℝ} (hx : 0 < x) : sinh (log x) = (x - x⁻¹) / 2 := by
rw [sinh_eq, exp_neg, exp_log hx]
#align real.sinh_log Real.sinh_log
| Mathlib/Analysis/SpecialFunctions/Log/Basic.lean | 118 | 119 | theorem cosh_log {x : ℝ} (hx : 0 < x) : cosh (log x) = (x + x⁻¹) / 2 := by |
rw [cosh_eq, exp_neg, exp_log hx]
| 1 |
import Mathlib.Analysis.Convex.Between
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.Topology.MetricSpace.Holder
import Mathlib.Topology.MetricSpace.MetricSeparated
#align_import measure_theory.measure.hausdorff from "leanprover-community/mathlib"@"3d5c4a7a5fb0d982f97ed953161264f1dbd90ead"
open scoped NNReal ENNReal Topology
open EMetric Set Function Filter Encodable FiniteDimensional TopologicalSpace
noncomputable section
variable {ι X Y : Type*} [EMetricSpace X] [EMetricSpace Y]
namespace MeasureTheory
namespace OuterMeasure
def IsMetric (μ : OuterMeasure X) : Prop :=
∀ s t : Set X, IsMetricSeparated s t → μ (s ∪ t) = μ s + μ t
#align measure_theory.outer_measure.is_metric MeasureTheory.OuterMeasure.IsMetric
def mkMetric'.pre (m : Set X → ℝ≥0∞) (r : ℝ≥0∞) : OuterMeasure X :=
boundedBy <| extend fun s (_ : diam s ≤ r) => m s
#align measure_theory.outer_measure.mk_metric'.pre MeasureTheory.OuterMeasure.mkMetric'.pre
def mkMetric' (m : Set X → ℝ≥0∞) : OuterMeasure X :=
⨆ r > 0, mkMetric'.pre m r
#align measure_theory.outer_measure.mk_metric' MeasureTheory.OuterMeasure.mkMetric'
def mkMetric (m : ℝ≥0∞ → ℝ≥0∞) : OuterMeasure X :=
mkMetric' fun s => m (diam s)
#align measure_theory.outer_measure.mk_metric MeasureTheory.OuterMeasure.mkMetric
namespace mkMetric'
variable {m : Set X → ℝ≥0∞} {r : ℝ≥0∞} {μ : OuterMeasure X} {s : Set X}
| Mathlib/MeasureTheory/Measure/Hausdorff.lean | 270 | 271 | theorem le_pre : μ ≤ pre m r ↔ ∀ s : Set X, diam s ≤ r → μ s ≤ m s := by |
simp only [pre, le_boundedBy, extend, le_iInf_iff]
| 1 |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {α β K : Type*}
section DivisionMonoid
variable [DivisionMonoid K] [HasDistribNeg K] {a b : K}
theorem one_div_neg_one_eq_neg_one : (1 : K) / -1 = -1 :=
have : -1 * -1 = (1 : K) := by rw [neg_mul_neg, one_mul]
Eq.symm (eq_one_div_of_mul_eq_one_right this)
#align one_div_neg_one_eq_neg_one one_div_neg_one_eq_neg_one
theorem one_div_neg_eq_neg_one_div (a : K) : 1 / -a = -(1 / a) :=
calc
1 / -a = 1 / (-1 * a) := by rw [neg_eq_neg_one_mul]
_ = 1 / a * (1 / -1) := by rw [one_div_mul_one_div_rev]
_ = 1 / a * -1 := by rw [one_div_neg_one_eq_neg_one]
_ = -(1 / a) := by rw [mul_neg, mul_one]
#align one_div_neg_eq_neg_one_div one_div_neg_eq_neg_one_div
theorem div_neg_eq_neg_div (a b : K) : b / -a = -(b / a) :=
calc
b / -a = b * (1 / -a) := by rw [← inv_eq_one_div, division_def]
_ = b * -(1 / a) := by rw [one_div_neg_eq_neg_one_div]
_ = -(b * (1 / a)) := by rw [neg_mul_eq_mul_neg]
_ = -(b / a) := by rw [mul_one_div]
#align div_neg_eq_neg_div div_neg_eq_neg_div
theorem neg_div (a b : K) : -b / a = -(b / a) := by
rw [neg_eq_neg_one_mul, mul_div_assoc, ← neg_eq_neg_one_mul]
#align neg_div neg_div
@[field_simps]
theorem neg_div' (a b : K) : -(b / a) = -b / a := by simp [neg_div]
#align neg_div' neg_div'
@[simp]
theorem neg_div_neg_eq (a b : K) : -a / -b = a / b := by rw [div_neg_eq_neg_div, neg_div, neg_neg]
#align neg_div_neg_eq neg_div_neg_eq
theorem neg_inv : -a⁻¹ = (-a)⁻¹ := by rw [inv_eq_one_div, inv_eq_one_div, div_neg_eq_neg_div]
#align neg_inv neg_inv
theorem div_neg (a : K) : a / -b = -(a / b) := by rw [← div_neg_eq_neg_div]
#align div_neg div_neg
| Mathlib/Algebra/Field/Basic.lean | 135 | 135 | theorem inv_neg : (-a)⁻¹ = -a⁻¹ := by | rw [neg_inv]
| 1 |
import Mathlib.Algebra.BigOperators.Group.List
import Mathlib.Algebra.Group.Prod
import Mathlib.Data.Multiset.Basic
#align_import algebra.big_operators.multiset.basic from "leanprover-community/mathlib"@"6c5f73fd6f6cc83122788a80a27cdd54663609f4"
assert_not_exists MonoidWithZero
variable {F ι α β γ : Type*}
namespace Multiset
section CommMonoid
variable [CommMonoid α] [CommMonoid β] {s t : Multiset α} {a : α} {m : Multiset ι} {f g : ι → α}
@[to_additive
"Sum of a multiset given a commutative additive monoid structure on `α`.
`sum {a, b, c} = a + b + c`"]
def prod : Multiset α → α :=
foldr (· * ·) (fun x y z => by simp [mul_left_comm]) 1
#align multiset.prod Multiset.prod
#align multiset.sum Multiset.sum
@[to_additive]
theorem prod_eq_foldr (s : Multiset α) :
prod s = foldr (· * ·) (fun x y z => by simp [mul_left_comm]) 1 s :=
rfl
#align multiset.prod_eq_foldr Multiset.prod_eq_foldr
#align multiset.sum_eq_foldr Multiset.sum_eq_foldr
@[to_additive]
theorem prod_eq_foldl (s : Multiset α) :
prod s = foldl (· * ·) (fun x y z => by simp [mul_right_comm]) 1 s :=
(foldr_swap _ _ _ _).trans (by simp [mul_comm])
#align multiset.prod_eq_foldl Multiset.prod_eq_foldl
#align multiset.sum_eq_foldl Multiset.sum_eq_foldl
@[to_additive (attr := simp, norm_cast)]
theorem prod_coe (l : List α) : prod ↑l = l.prod :=
prod_eq_foldl _
#align multiset.coe_prod Multiset.prod_coe
#align multiset.coe_sum Multiset.sum_coe
@[to_additive (attr := simp)]
theorem prod_toList (s : Multiset α) : s.toList.prod = s.prod := by
conv_rhs => rw [← coe_toList s]
rw [prod_coe]
#align multiset.prod_to_list Multiset.prod_toList
#align multiset.sum_to_list Multiset.sum_toList
@[to_additive (attr := simp)]
theorem prod_zero : @prod α _ 0 = 1 :=
rfl
#align multiset.prod_zero Multiset.prod_zero
#align multiset.sum_zero Multiset.sum_zero
@[to_additive (attr := simp)]
theorem prod_cons (a : α) (s) : prod (a ::ₘ s) = a * prod s :=
foldr_cons _ _ _ _ _
#align multiset.prod_cons Multiset.prod_cons
#align multiset.sum_cons Multiset.sum_cons
@[to_additive (attr := simp)]
theorem prod_erase [DecidableEq α] (h : a ∈ s) : a * (s.erase a).prod = s.prod := by
rw [← s.coe_toList, coe_erase, prod_coe, prod_coe, List.prod_erase (mem_toList.2 h)]
#align multiset.prod_erase Multiset.prod_erase
#align multiset.sum_erase Multiset.sum_erase
@[to_additive (attr := simp)]
theorem prod_map_erase [DecidableEq ι] {a : ι} (h : a ∈ m) :
f a * ((m.erase a).map f).prod = (m.map f).prod := by
rw [← m.coe_toList, coe_erase, map_coe, map_coe, prod_coe, prod_coe,
List.prod_map_erase f (mem_toList.2 h)]
#align multiset.prod_map_erase Multiset.prod_map_erase
#align multiset.sum_map_erase Multiset.sum_map_erase
@[to_additive (attr := simp)]
| Mathlib/Algebra/BigOperators/Group/Multiset.lean | 99 | 100 | theorem prod_singleton (a : α) : prod {a} = a := by |
simp only [mul_one, prod_cons, ← cons_zero, eq_self_iff_true, prod_zero]
| 1 |
import Mathlib.Topology.Algebra.Module.Basic
import Mathlib.LinearAlgebra.Multilinear.Basic
#align_import topology.algebra.module.multilinear from "leanprover-community/mathlib"@"f40476639bac089693a489c9e354ebd75dc0f886"
open Function Fin Set
universe u v w w₁ w₁' w₂ w₃ w₄
variable {R : Type u} {ι : Type v} {n : ℕ} {M : Fin n.succ → Type w} {M₁ : ι → Type w₁}
{M₁' : ι → Type w₁'} {M₂ : Type w₂} {M₃ : Type w₃} {M₄ : Type w₄}
structure ContinuousMultilinearMap (R : Type u) {ι : Type v} (M₁ : ι → Type w₁) (M₂ : Type w₂)
[Semiring R] [∀ i, AddCommMonoid (M₁ i)] [AddCommMonoid M₂] [∀ i, Module R (M₁ i)] [Module R M₂]
[∀ i, TopologicalSpace (M₁ i)] [TopologicalSpace M₂] extends MultilinearMap R M₁ M₂ where
cont : Continuous toFun
#align continuous_multilinear_map ContinuousMultilinearMap
attribute [inherit_doc ContinuousMultilinearMap] ContinuousMultilinearMap.cont
@[inherit_doc]
notation:25 M "[×" n "]→L[" R "] " M' => ContinuousMultilinearMap R (fun i : Fin n => M) M'
namespace ContinuousMultilinearMap
section Semiring
variable [Semiring R] [∀ i, AddCommMonoid (M i)] [∀ i, AddCommMonoid (M₁ i)]
[∀ i, AddCommMonoid (M₁' i)] [AddCommMonoid M₂] [AddCommMonoid M₃] [AddCommMonoid M₄]
[∀ i, Module R (M i)] [∀ i, Module R (M₁ i)] [∀ i, Module R (M₁' i)] [Module R M₂] [Module R M₃]
[Module R M₄] [∀ i, TopologicalSpace (M i)] [∀ i, TopologicalSpace (M₁ i)]
[∀ i, TopologicalSpace (M₁' i)] [TopologicalSpace M₂] [TopologicalSpace M₃] [TopologicalSpace M₄]
(f f' : ContinuousMultilinearMap R M₁ M₂)
theorem toMultilinearMap_injective :
Function.Injective
(ContinuousMultilinearMap.toMultilinearMap :
ContinuousMultilinearMap R M₁ M₂ → MultilinearMap R M₁ M₂)
| ⟨f, hf⟩, ⟨g, hg⟩, h => by subst h; rfl
#align continuous_multilinear_map.to_multilinear_map_injective ContinuousMultilinearMap.toMultilinearMap_injective
instance funLike : FunLike (ContinuousMultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂ where
coe f := f.toFun
coe_injective' _ _ h := toMultilinearMap_injective <| MultilinearMap.coe_injective h
instance continuousMapClass :
ContinuousMapClass (ContinuousMultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂ where
map_continuous := ContinuousMultilinearMap.cont
#align continuous_multilinear_map.continuous_map_class ContinuousMultilinearMap.continuousMapClass
instance : CoeFun (ContinuousMultilinearMap R M₁ M₂) fun _ => (∀ i, M₁ i) → M₂ :=
⟨fun f => f⟩
def Simps.apply (L₁ : ContinuousMultilinearMap R M₁ M₂) (v : ∀ i, M₁ i) : M₂ :=
L₁ v
#align continuous_multilinear_map.simps.apply ContinuousMultilinearMap.Simps.apply
initialize_simps_projections ContinuousMultilinearMap (-toMultilinearMap,
toMultilinearMap_toFun → apply)
@[continuity]
theorem coe_continuous : Continuous (f : (∀ i, M₁ i) → M₂) :=
f.cont
#align continuous_multilinear_map.coe_continuous ContinuousMultilinearMap.coe_continuous
@[simp]
theorem coe_coe : (f.toMultilinearMap : (∀ i, M₁ i) → M₂) = f :=
rfl
#align continuous_multilinear_map.coe_coe ContinuousMultilinearMap.coe_coe
@[ext]
theorem ext {f f' : ContinuousMultilinearMap R M₁ M₂} (H : ∀ x, f x = f' x) : f = f' :=
DFunLike.ext _ _ H
#align continuous_multilinear_map.ext ContinuousMultilinearMap.ext
| Mathlib/Topology/Algebra/Module/Multilinear/Basic.lean | 113 | 114 | theorem ext_iff {f f' : ContinuousMultilinearMap R M₁ M₂} : f = f' ↔ ∀ x, f x = f' x := by |
rw [← toMultilinearMap_injective.eq_iff, MultilinearMap.ext_iff]; rfl
| 1 |
import Mathlib.Topology.Order.IsLUB
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α β γ : Type*}
section DenselyOrdered
variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [DenselyOrdered α] {a b : α}
{s : Set α}
theorem closure_Ioi' {a : α} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by
apply Subset.antisymm
· exact closure_minimal Ioi_subset_Ici_self isClosed_Ici
· rw [← diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff]
exact isGLB_Ioi.mem_closure h
#align closure_Ioi' closure_Ioi'
@[simp]
theorem closure_Ioi (a : α) [NoMaxOrder α] : closure (Ioi a) = Ici a :=
closure_Ioi' nonempty_Ioi
#align closure_Ioi closure_Ioi
theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a :=
closure_Ioi' (α := αᵒᵈ) h
#align closure_Iio' closure_Iio'
@[simp]
theorem closure_Iio (a : α) [NoMinOrder α] : closure (Iio a) = Iic a :=
closure_Iio' nonempty_Iio
#align closure_Iio closure_Iio
@[simp]
theorem closure_Ioo {a b : α} (hab : a ≠ b) : closure (Ioo a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioo_subset_Icc_self isClosed_Icc
· cases' hab.lt_or_lt with hab hab
· rw [← diff_subset_closure_iff, Icc_diff_Ioo_same hab.le]
have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab
simp only [insert_subset_iff, singleton_subset_iff]
exact ⟨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'⟩
· rw [Icc_eq_empty_of_lt hab]
exact empty_subset _
#align closure_Ioo closure_Ioo
@[simp]
theorem closure_Ioc {a b : α} (hab : a ≠ b) : closure (Ioc a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioc_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self)
rw [closure_Ioo hab]
#align closure_Ioc closure_Ioc
@[simp]
theorem closure_Ico {a b : α} (hab : a ≠ b) : closure (Ico a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ico_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ico_self)
rw [closure_Ioo hab]
#align closure_Ico closure_Ico
@[simp]
theorem interior_Ici' {a : α} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by
rw [← compl_Iio, interior_compl, closure_Iio' ha, compl_Iic]
#align interior_Ici' interior_Ici'
theorem interior_Ici [NoMinOrder α] {a : α} : interior (Ici a) = Ioi a :=
interior_Ici' nonempty_Iio
#align interior_Ici interior_Ici
@[simp]
theorem interior_Iic' {a : α} (ha : (Ioi a).Nonempty) : interior (Iic a) = Iio a :=
interior_Ici' (α := αᵒᵈ) ha
#align interior_Iic' interior_Iic'
theorem interior_Iic [NoMaxOrder α] {a : α} : interior (Iic a) = Iio a :=
interior_Iic' nonempty_Ioi
#align interior_Iic interior_Iic
@[simp]
theorem interior_Icc [NoMinOrder α] [NoMaxOrder α] {a b : α} : interior (Icc a b) = Ioo a b := by
rw [← Ici_inter_Iic, interior_inter, interior_Ici, interior_Iic, Ioi_inter_Iio]
#align interior_Icc interior_Icc
@[simp]
theorem Icc_mem_nhds_iff [NoMinOrder α] [NoMaxOrder α] {a b x : α} :
Icc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by
rw [← interior_Icc, mem_interior_iff_mem_nhds]
@[simp]
theorem interior_Ico [NoMinOrder α] {a b : α} : interior (Ico a b) = Ioo a b := by
rw [← Ici_inter_Iio, interior_inter, interior_Ici, interior_Iio, Ioi_inter_Iio]
#align interior_Ico interior_Ico
@[simp]
theorem Ico_mem_nhds_iff [NoMinOrder α] {a b x : α} : Ico a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by
rw [← interior_Ico, mem_interior_iff_mem_nhds]
@[simp]
theorem interior_Ioc [NoMaxOrder α] {a b : α} : interior (Ioc a b) = Ioo a b := by
rw [← Ioi_inter_Iic, interior_inter, interior_Ioi, interior_Iic, Ioi_inter_Iio]
#align interior_Ioc interior_Ioc
@[simp]
| Mathlib/Topology/Order/DenselyOrdered.lean | 125 | 126 | theorem Ioc_mem_nhds_iff [NoMaxOrder α] {a b x : α} : Ioc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by |
rw [← interior_Ioc, mem_interior_iff_mem_nhds]
| 1 |
import Mathlib.Algebra.Order.Interval.Set.Instances
import Mathlib.Order.Interval.Set.ProjIcc
import Mathlib.Topology.Instances.Real
#align_import topology.unit_interval from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Topology Filter
open Set Int Set.Icc
abbrev unitInterval : Set ℝ :=
Set.Icc 0 1
#align unit_interval unitInterval
@[inherit_doc]
scoped[unitInterval] notation "I" => unitInterval
section partition
@[simp]
theorem projIcc_eq_zero {x : ℝ} : projIcc (0 : ℝ) 1 zero_le_one x = 0 ↔ x ≤ 0 :=
projIcc_eq_left zero_lt_one
#align proj_Icc_eq_zero projIcc_eq_zero
@[simp]
theorem projIcc_eq_one {x : ℝ} : projIcc (0 : ℝ) 1 zero_le_one x = 1 ↔ 1 ≤ x :=
projIcc_eq_right zero_lt_one
#align proj_Icc_eq_one projIcc_eq_one
section
variable {𝕜 : Type*} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [TopologicalRing 𝕜]
-- We only need the ordering on `𝕜` here to avoid talking about flipping the interval over.
-- At the end of the day I only care about `ℝ`, so I'm hesitant to put work into generalizing.
| Mathlib/Topology/UnitInterval.lean | 323 | 324 | theorem affineHomeomorph_image_I (a b : 𝕜) (h : 0 < a) :
affineHomeomorph a b h.ne.symm '' Set.Icc 0 1 = Set.Icc b (a + b) := by | simp [h]
| 1 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.HasseDeriv
#align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace Polynomial
open Polynomial
variable {R : Type*} [Semiring R] (r : R) (f : R[X])
def taylor (r : R) : R[X] →ₗ[R] R[X] where
toFun f := f.comp (X + C r)
map_add' f g := add_comp
map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply]
#align polynomial.taylor Polynomial.taylor
theorem taylor_apply : taylor r f = f.comp (X + C r) :=
rfl
#align polynomial.taylor_apply Polynomial.taylor_apply
@[simp]
| Mathlib/Algebra/Polynomial/Taylor.lean | 46 | 46 | theorem taylor_X : taylor r X = X + C r := by | simp only [taylor_apply, X_comp]
| 1 |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section GeneralizedCoheytingAlgebra
variable [GeneralizedCoheytingAlgebra α] (a b c d : α)
@[simp]
theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b :=
rfl
#align to_dual_symm_diff toDual_symmDiff
@[simp]
theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b :=
rfl
#align of_dual_bihimp ofDual_bihimp
theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm]
#align symm_diff_comm symmDiff_comm
instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) :=
⟨symmDiff_comm⟩
#align symm_diff_is_comm symmDiff_isCommutative
@[simp]
theorem symmDiff_self : a ∆ a = ⊥ := by rw [symmDiff, sup_idem, sdiff_self]
#align symm_diff_self symmDiff_self
@[simp]
theorem symmDiff_bot : a ∆ ⊥ = a := by rw [symmDiff, sdiff_bot, bot_sdiff, sup_bot_eq]
#align symm_diff_bot symmDiff_bot
@[simp]
theorem bot_symmDiff : ⊥ ∆ a = a := by rw [symmDiff_comm, symmDiff_bot]
#align bot_symm_diff bot_symmDiff
@[simp]
theorem symmDiff_eq_bot {a b : α} : a ∆ b = ⊥ ↔ a = b := by
simp_rw [symmDiff, sup_eq_bot_iff, sdiff_eq_bot_iff, le_antisymm_iff]
#align symm_diff_eq_bot symmDiff_eq_bot
theorem symmDiff_of_le {a b : α} (h : a ≤ b) : a ∆ b = b \ a := by
rw [symmDiff, sdiff_eq_bot_iff.2 h, bot_sup_eq]
#align symm_diff_of_le symmDiff_of_le
theorem symmDiff_of_ge {a b : α} (h : b ≤ a) : a ∆ b = a \ b := by
rw [symmDiff, sdiff_eq_bot_iff.2 h, sup_bot_eq]
#align symm_diff_of_ge symmDiff_of_ge
theorem symmDiff_le {a b c : α} (ha : a ≤ b ⊔ c) (hb : b ≤ a ⊔ c) : a ∆ b ≤ c :=
sup_le (sdiff_le_iff.2 ha) <| sdiff_le_iff.2 hb
#align symm_diff_le symmDiff_le
theorem symmDiff_le_iff {a b c : α} : a ∆ b ≤ c ↔ a ≤ b ⊔ c ∧ b ≤ a ⊔ c := by
simp_rw [symmDiff, sup_le_iff, sdiff_le_iff]
#align symm_diff_le_iff symmDiff_le_iff
@[simp]
theorem symmDiff_le_sup {a b : α} : a ∆ b ≤ a ⊔ b :=
sup_le_sup sdiff_le sdiff_le
#align symm_diff_le_sup symmDiff_le_sup
theorem symmDiff_eq_sup_sdiff_inf : a ∆ b = (a ⊔ b) \ (a ⊓ b) := by simp [sup_sdiff, symmDiff]
#align symm_diff_eq_sup_sdiff_inf symmDiff_eq_sup_sdiff_inf
| Mathlib/Order/SymmDiff.lean | 161 | 162 | theorem Disjoint.symmDiff_eq_sup {a b : α} (h : Disjoint a b) : a ∆ b = a ⊔ b := by |
rw [symmDiff, h.sdiff_eq_left, h.sdiff_eq_right]
| 1 |
import Mathlib.Probability.Kernel.Disintegration.Unique
import Mathlib.Probability.Notation
#align_import probability.kernel.cond_distrib from "leanprover-community/mathlib"@"00abe0695d8767201e6d008afa22393978bb324d"
open MeasureTheory Set Filter TopologicalSpace
open scoped ENNReal MeasureTheory ProbabilityTheory
namespace ProbabilityTheory
variable {α β Ω F : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω]
[Nonempty Ω] [NormedAddCommGroup F] {mα : MeasurableSpace α} {μ : Measure α} [IsFiniteMeasure μ]
{X : α → β} {Y : α → Ω}
noncomputable irreducible_def condDistrib {_ : MeasurableSpace α} [MeasurableSpace β] (Y : α → Ω)
(X : α → β) (μ : Measure α) [IsFiniteMeasure μ] : kernel β Ω :=
(μ.map fun a => (X a, Y a)).condKernel
#align probability_theory.cond_distrib ProbabilityTheory.condDistrib
instance [MeasurableSpace β] : IsMarkovKernel (condDistrib Y X μ) := by
rw [condDistrib]; infer_instance
variable {mβ : MeasurableSpace β} {s : Set Ω} {t : Set β} {f : β × Ω → F}
lemma condDistrib_apply_of_ne_zero [MeasurableSingletonClass β]
(hY : Measurable Y) (x : β) (hX : μ.map X {x} ≠ 0) (s : Set Ω) :
condDistrib Y X μ x s = (μ.map X {x})⁻¹ * μ.map (fun a => (X a, Y a)) ({x} ×ˢ s) := by
rw [condDistrib, Measure.condKernel_apply_of_ne_zero _ s]
· rw [Measure.fst_map_prod_mk hY]
· rwa [Measure.fst_map_prod_mk hY]
theorem condDistrib_ae_eq_of_measure_eq_compProd (hX : Measurable X) (hY : Measurable Y)
(κ : kernel β Ω) [IsFiniteKernel κ] (hκ : μ.map (fun x => (X x, Y x)) = μ.map X ⊗ₘ κ) :
∀ᵐ x ∂μ.map X, κ x = condDistrib Y X μ x := by
have heq : μ.map X = (μ.map (fun x ↦ (X x, Y x))).fst := by
ext s hs
rw [Measure.map_apply hX hs, Measure.fst_apply hs, Measure.map_apply]
exacts [rfl, Measurable.prod hX hY, measurable_fst hs]
rw [heq, condDistrib]
refine eq_condKernel_of_measure_eq_compProd _ ?_
convert hκ
exact heq.symm
section Integrability
theorem integrable_toReal_condDistrib (hX : AEMeasurable X μ) (hs : MeasurableSet s) :
Integrable (fun a => (condDistrib Y X μ (X a) s).toReal) μ := by
refine integrable_toReal_of_lintegral_ne_top ?_ ?_
· exact Measurable.comp_aemeasurable (kernel.measurable_coe _ hs) hX
· refine ne_of_lt ?_
calc
∫⁻ a, condDistrib Y X μ (X a) s ∂μ ≤ ∫⁻ _, 1 ∂μ := lintegral_mono fun a => prob_le_one
_ = μ univ := lintegral_one
_ < ∞ := measure_lt_top _ _
#align probability_theory.integrable_to_real_cond_distrib ProbabilityTheory.integrable_toReal_condDistrib
| Mathlib/Probability/Kernel/CondDistrib.lean | 145 | 148 | theorem _root_.MeasureTheory.Integrable.condDistrib_ae_map
(hY : AEMeasurable Y μ) (hf_int : Integrable f (μ.map fun a => (X a, Y a))) :
∀ᵐ b ∂μ.map X, Integrable (fun ω => f (b, ω)) (condDistrib Y X μ b) := by |
rw [condDistrib, ← Measure.fst_map_prod_mk₀ (X := X) hY]; exact hf_int.condKernel_ae
| 1 |
import Mathlib.Topology.Algebra.InfiniteSum.Basic
import Mathlib.Topology.Algebra.UniformGroup
noncomputable section
open Filter Finset Function
open scoped Topology
variable {α β γ δ : Type*}
section TopologicalGroup
variable [CommGroup α] [TopologicalSpace α] [TopologicalGroup α]
variable {f g : β → α} {a a₁ a₂ : α}
-- `by simpa using` speeds up elaboration. Why?
@[to_additive]
theorem HasProd.inv (h : HasProd f a) : HasProd (fun b ↦ (f b)⁻¹) a⁻¹ := by
simpa only using h.map (MonoidHom.id α)⁻¹ continuous_inv
#align has_sum.neg HasSum.neg
@[to_additive]
theorem Multipliable.inv (hf : Multipliable f) : Multipliable fun b ↦ (f b)⁻¹ :=
hf.hasProd.inv.multipliable
#align summable.neg Summable.neg
@[to_additive]
theorem Multipliable.of_inv (hf : Multipliable fun b ↦ (f b)⁻¹) : Multipliable f := by
simpa only [inv_inv] using hf.inv
#align summable.of_neg Summable.of_neg
@[to_additive]
theorem multipliable_inv_iff : (Multipliable fun b ↦ (f b)⁻¹) ↔ Multipliable f :=
⟨Multipliable.of_inv, Multipliable.inv⟩
#align summable_neg_iff summable_neg_iff
@[to_additive]
theorem HasProd.div (hf : HasProd f a₁) (hg : HasProd g a₂) :
HasProd (fun b ↦ f b / g b) (a₁ / a₂) := by
simp only [div_eq_mul_inv]
exact hf.mul hg.inv
#align has_sum.sub HasSum.sub
@[to_additive]
theorem Multipliable.div (hf : Multipliable f) (hg : Multipliable g) :
Multipliable fun b ↦ f b / g b :=
(hf.hasProd.div hg.hasProd).multipliable
#align summable.sub Summable.sub
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Group.lean | 63 | 65 | theorem Multipliable.trans_div (hg : Multipliable g) (hfg : Multipliable fun b ↦ f b / g b) :
Multipliable f := by |
simpa only [div_mul_cancel] using hfg.mul hg
| 1 |
import Mathlib.Analysis.NormedSpace.Exponential
#align_import analysis.normed_space.star.exponential from "leanprover-community/mathlib"@"1e3201306d4d9eb1fd54c60d7c4510ad5126f6f9"
open NormedSpace -- For `NormedSpace.exp`.
section Star
variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] [StarRing A] [ContinuousStar A]
[CompleteSpace A] [StarModule ℂ A]
open Complex
@[simps]
noncomputable def selfAdjoint.expUnitary (a : selfAdjoint A) : unitary A :=
⟨exp ℂ ((I • a.val) : A),
exp_mem_unitary_of_mem_skewAdjoint _ (a.prop.smul_mem_skewAdjoint conj_I)⟩
#align self_adjoint.exp_unitary selfAdjoint.expUnitary
open selfAdjoint
theorem Commute.expUnitary_add {a b : selfAdjoint A} (h : Commute (a : A) (b : A)) :
expUnitary (a + b) = expUnitary a * expUnitary b := by
ext
have hcomm : Commute (I • (a : A)) (I • (b : A)) := by
unfold Commute SemiconjBy
simp only [h.eq, Algebra.smul_mul_assoc, Algebra.mul_smul_comm]
simpa only [expUnitary_coe, AddSubgroup.coe_add, smul_add] using exp_add_of_commute hcomm
#align commute.exp_unitary_add Commute.expUnitary_add
| Mathlib/Analysis/NormedSpace/Star/Exponential.lean | 51 | 56 | theorem Commute.expUnitary {a b : selfAdjoint A} (h : Commute (a : A) (b : A)) :
Commute (expUnitary a) (expUnitary b) :=
calc
selfAdjoint.expUnitary a * selfAdjoint.expUnitary b =
selfAdjoint.expUnitary b * selfAdjoint.expUnitary a := by |
rw [← h.expUnitary_add, ← h.symm.expUnitary_add, add_comm]
| 1 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode α) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
· apply min?_reverse
· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode α) : t.reverse.max? = t.min? := by
rw [← min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : ¬x ∈ (.nil : RBNode α) := by simp [(·∈·), EMem]
@[simp] theorem mem_node {y c a x b} :
y ∈ (.node c a x b : RBNode α) ↔ y = x ∨ y ∈ a ∨ y ∈ b := by simp [(·∈·), EMem]
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 32 | 33 | theorem All_def {t : RBNode α} : t.All p ↔ ∀ x ∈ t, p x := by |
induction t <;> simp [or_imp, forall_and, *]
| 1 |
import Mathlib.Algebra.CharZero.Defs
import Mathlib.Algebra.Group.Hom.Defs
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Algebra.Order.Monoid.OrderDual
import Mathlib.Algebra.Order.ZeroLEOne
import Mathlib.Data.Nat.Cast.Defs
import Mathlib.Order.WithBot
#align_import algebra.order.monoid.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
universe u v
variable {α : Type u} {β : Type v}
open Function
namespace WithTop
section Add
variable [Add α] {a b c d : WithTop α} {x y : α}
instance add : Add (WithTop α) :=
⟨Option.map₂ (· + ·)⟩
#align with_top.has_add WithTop.add
@[simp, norm_cast] lemma coe_add (a b : α) : ↑(a + b) = (a + b : WithTop α) := rfl
#align with_top.coe_add WithTop.coe_add
#noalign with_top.coe_bit0
#noalign with_top.coe_bit1
@[simp]
theorem top_add (a : WithTop α) : ⊤ + a = ⊤ :=
rfl
#align with_top.top_add WithTop.top_add
@[simp]
| Mathlib/Algebra/Order/Monoid/WithTop.lean | 128 | 128 | theorem add_top (a : WithTop α) : a + ⊤ = ⊤ := by | cases a <;> rfl
| 1 |
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.disjoint from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u v w
variable {ι : Sort u} {α : Type v} {β : Type w}
open Set
open OrderDual (toDual)
namespace Set
section LinearOrder
variable [LinearOrder α] {a₁ a₂ b₁ b₂ : α}
@[simp]
theorem Ico_disjoint_Ico : Disjoint (Ico a₁ a₂) (Ico b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
simp_rw [Set.disjoint_iff_inter_eq_empty, Ico_inter_Ico, Ico_eq_empty_iff, inf_eq_min, sup_eq_max,
not_lt]
#align set.Ico_disjoint_Ico Set.Ico_disjoint_Ico
@[simp]
theorem Ioc_disjoint_Ioc : Disjoint (Ioc a₁ a₂) (Ioc b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
have h : _ ↔ min (toDual a₁) (toDual b₁) ≤ max (toDual a₂) (toDual b₂) := Ico_disjoint_Ico
simpa only [dual_Ico] using h
#align set.Ioc_disjoint_Ioc Set.Ioc_disjoint_Ioc
@[simp]
theorem Ioo_disjoint_Ioo [DenselyOrdered α] :
Disjoint (Set.Ioo a₁ a₂) (Set.Ioo b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
simp_rw [Set.disjoint_iff_inter_eq_empty, Ioo_inter_Ioo, Ioo_eq_empty_iff, inf_eq_min, sup_eq_max,
not_lt]
theorem eq_of_Ico_disjoint {x₁ x₂ y₁ y₂ : α} (h : Disjoint (Ico x₁ x₂) (Ico y₁ y₂)) (hx : x₁ < x₂)
(h2 : x₂ ∈ Ico y₁ y₂) : y₁ = x₂ := by
rw [Ico_disjoint_Ico, min_eq_left (le_of_lt h2.2), le_max_iff] at h
apply le_antisymm h2.1
exact h.elim (fun h => absurd hx (not_lt_of_le h)) id
#align set.eq_of_Ico_disjoint Set.eq_of_Ico_disjoint
@[simp]
theorem iUnion_Ico_eq_Iio_self_iff {f : ι → α} {a : α} :
⋃ i, Ico (f i) a = Iio a ↔ ∀ x < a, ∃ i, f i ≤ x := by
simp [← Ici_inter_Iio, ← iUnion_inter, subset_def]
#align set.Union_Ico_eq_Iio_self_iff Set.iUnion_Ico_eq_Iio_self_iff
@[simp]
| Mathlib/Order/Interval/Set/Disjoint.lean | 176 | 178 | theorem iUnion_Ioc_eq_Ioi_self_iff {f : ι → α} {a : α} :
⋃ i, Ioc a (f i) = Ioi a ↔ ∀ x, a < x → ∃ i, x ≤ f i := by |
simp [← Ioi_inter_Iic, ← inter_iUnion, subset_def]
| 1 |
import Mathlib.Analysis.SpecialFunctions.Complex.Arg
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Complex
open Set Filter Bornology
open scoped Real Topology ComplexConjugate
-- Porting note: @[pp_nodot] does not exist in mathlib4
noncomputable def log (x : ℂ) : ℂ :=
x.abs.log + arg x * I
#align complex.log Complex.log
theorem log_re (x : ℂ) : x.log.re = x.abs.log := by simp [log]
#align complex.log_re Complex.log_re
theorem log_im (x : ℂ) : x.log.im = x.arg := by simp [log]
#align complex.log_im Complex.log_im
theorem neg_pi_lt_log_im (x : ℂ) : -π < (log x).im := by simp only [log_im, neg_pi_lt_arg]
#align complex.neg_pi_lt_log_im Complex.neg_pi_lt_log_im
theorem log_im_le_pi (x : ℂ) : (log x).im ≤ π := by simp only [log_im, arg_le_pi]
#align complex.log_im_le_pi Complex.log_im_le_pi
theorem exp_log {x : ℂ} (hx : x ≠ 0) : exp (log x) = x := by
rw [log, exp_add_mul_I, ← ofReal_sin, sin_arg, ← ofReal_cos, cos_arg hx, ← ofReal_exp,
Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), ← mul_assoc,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im]
#align complex.exp_log Complex.exp_log
@[simp]
theorem range_exp : Set.range exp = {0}ᶜ :=
Set.ext fun x =>
⟨by
rintro ⟨x, rfl⟩
exact exp_ne_zero x, fun hx => ⟨log x, exp_log hx⟩⟩
#align complex.range_exp Complex.range_exp
theorem log_exp {x : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) : log (exp x) = x := by
rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, ← ofReal_exp,
arg_mul_cos_add_sin_mul_I (Real.exp_pos _) ⟨hx₁, hx₂⟩, re_add_im]
#align complex.log_exp Complex.log_exp
theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) (hy₁ : -π < y.im)
(hy₂ : y.im ≤ π) (hxy : exp x = exp y) : x = y := by
rw [← log_exp hx₁ hx₂, ← log_exp hy₁ hy₂, hxy]
#align complex.exp_inj_of_neg_pi_lt_of_le_pi Complex.exp_inj_of_neg_pi_lt_of_le_pi
theorem ofReal_log {x : ℝ} (hx : 0 ≤ x) : (x.log : ℂ) = log x :=
Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx])
(by rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx])
#align complex.of_real_log Complex.ofReal_log
@[simp, norm_cast]
lemma natCast_log {n : ℕ} : Real.log n = log n := ofReal_natCast n ▸ ofReal_log n.cast_nonneg
@[simp]
lemma ofNat_log {n : ℕ} [n.AtLeastTwo] :
Real.log (no_index (OfNat.ofNat n)) = log (OfNat.ofNat n) :=
natCast_log
theorem log_ofReal_re (x : ℝ) : (log (x : ℂ)).re = Real.log x := by simp [log_re]
#align complex.log_of_real_re Complex.log_ofReal_re
theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : ℂ} (hx : x ≠ 0) :
log (r * x) = Real.log r + log x := by
replace hx := Complex.abs.ne_zero_iff.mpr hx
simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx,
ofReal_add, add_assoc]
#align complex.log_of_real_mul Complex.log_ofReal_mul
theorem log_mul_ofReal (r : ℝ) (hr : 0 < r) (x : ℂ) (hx : x ≠ 0) :
log (x * r) = Real.log r + log x := by rw [mul_comm, log_ofReal_mul hr hx]
#align complex.log_mul_of_real Complex.log_mul_ofReal
lemma log_mul_eq_add_log_iff {x y : ℂ} (hx₀ : x ≠ 0) (hy₀ : y ≠ 0) :
log (x * y) = log x + log y ↔ arg x + arg y ∈ Set.Ioc (-π) π := by
refine ext_iff.trans <| Iff.trans ?_ <| arg_mul_eq_add_arg_iff hx₀ hy₀
simp_rw [add_re, add_im, log_re, log_im, AbsoluteValue.map_mul,
Real.log_mul (abs.ne_zero hx₀) (abs.ne_zero hy₀), true_and]
alias ⟨_, log_mul⟩ := log_mul_eq_add_log_iff
@[simp]
| Mathlib/Analysis/SpecialFunctions/Complex/Log.lean | 106 | 106 | theorem log_zero : log 0 = 0 := by | simp [log]
| 1 |
import Mathlib.Computability.Halting
import Mathlib.Computability.TuringMachine
import Mathlib.Data.Num.Lemmas
import Mathlib.Tactic.DeriveFintype
#align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8"
open Function (update)
open Relation
namespace Turing
namespace ToPartrec
inductive Code
| zero'
| succ
| tail
| cons : Code → Code → Code
| comp : Code → Code → Code
| case : Code → Code → Code
| fix : Code → Code
deriving DecidableEq, Inhabited
#align turing.to_partrec.code Turing.ToPartrec.Code
#align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero'
#align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ
#align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail
#align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons
#align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp
#align turing.to_partrec.code.case Turing.ToPartrec.Code.case
#align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix
def Code.eval : Code → List ℕ →. List ℕ
| Code.zero' => fun v => pure (0 :: v)
| Code.succ => fun v => pure [v.headI.succ]
| Code.tail => fun v => pure v.tail
| Code.cons f fs => fun v => do
let n ← Code.eval f v
let ns ← Code.eval fs v
pure (n.headI :: ns)
| Code.comp f g => fun v => g.eval v >>= f.eval
| Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail)
| Code.fix f =>
PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail
#align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval
namespace Code
@[simp]
theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval]
@[simp]
theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by simp [eval]
@[simp]
theorem tail_eval : tail.eval = fun v => pure v.tail := by simp [eval]
@[simp]
theorem cons_eval (f fs) : (cons f fs).eval = fun v => do {
let n ← Code.eval f v
let ns ← Code.eval fs v
pure (n.headI :: ns) } := by simp [eval]
@[simp]
theorem comp_eval (f g) : (comp f g).eval = fun v => g.eval v >>= f.eval := by simp [eval]
@[simp]
theorem case_eval (f g) :
(case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) := by
simp [eval]
@[simp]
theorem fix_eval (f) : (fix f).eval =
PFun.fix fun v => (f.eval v).map fun v =>
if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail := by
simp [eval]
def nil : Code :=
tail.comp succ
#align turing.to_partrec.code.nil Turing.ToPartrec.Code.nil
@[simp]
theorem nil_eval (v) : nil.eval v = pure [] := by simp [nil]
#align turing.to_partrec.code.nil_eval Turing.ToPartrec.Code.nil_eval
def id : Code :=
tail.comp zero'
#align turing.to_partrec.code.id Turing.ToPartrec.Code.id
@[simp]
theorem id_eval (v) : id.eval v = pure v := by simp [id]
#align turing.to_partrec.code.id_eval Turing.ToPartrec.Code.id_eval
def head : Code :=
cons id nil
#align turing.to_partrec.code.head Turing.ToPartrec.Code.head
@[simp]
theorem head_eval (v) : head.eval v = pure [v.headI] := by simp [head]
#align turing.to_partrec.code.head_eval Turing.ToPartrec.Code.head_eval
def zero : Code :=
cons zero' nil
#align turing.to_partrec.code.zero Turing.ToPartrec.Code.zero
@[simp]
| Mathlib/Computability/TMToPartrec.lean | 201 | 201 | theorem zero_eval (v) : zero.eval v = pure [0] := by | simp [zero]
| 1 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
#align_import analysis.calculus.deriv.comp from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
open scoped Classical
open Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
section CompositionVector
open ContinuousLinearMap
variable {l : F → E} {l' : F →L[𝕜] E} {y : F}
variable (x)
theorem HasFDerivWithinAt.comp_hasDerivWithinAt {t : Set F} (hl : HasFDerivWithinAt l l' t (f x))
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasFDerivWithinAt hst).hasDerivWithinAt
#align has_fderiv_within_at.comp_has_deriv_within_at HasFDerivWithinAt.comp_hasDerivWithinAt
theorem HasFDerivWithinAt.comp_hasDerivWithinAt_of_eq {t : Set F}
(hl : HasFDerivWithinAt l l' t y)
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf hst
theorem HasFDerivAt.comp_hasDerivWithinAt (hl : HasFDerivAt l l' (f x))
(hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (l ∘ f) (l' f') s x :=
hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf (mapsTo_univ _ _)
#align has_fderiv_at.comp_has_deriv_within_at HasFDerivAt.comp_hasDerivWithinAt
theorem HasFDerivAt.comp_hasDerivWithinAt_of_eq (hl : HasFDerivAt l l' y)
(hf : HasDerivWithinAt f f' s x) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf
theorem HasFDerivAt.comp_hasDerivAt (hl : HasFDerivAt l l' (f x)) (hf : HasDerivAt f f' x) :
HasDerivAt (l ∘ f) (l' f') x :=
hasDerivWithinAt_univ.mp <| hl.comp_hasDerivWithinAt x hf.hasDerivWithinAt
#align has_fderiv_at.comp_has_deriv_at HasFDerivAt.comp_hasDerivAt
theorem HasFDerivAt.comp_hasDerivAt_of_eq
(hl : HasFDerivAt l l' y) (hf : HasDerivAt f f' x) (hy : y = f x) :
HasDerivAt (l ∘ f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasDerivAt x hf
theorem HasStrictFDerivAt.comp_hasStrictDerivAt (hl : HasStrictFDerivAt l l' (f x))
(hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (l ∘ f) (l' f') x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasStrictFDerivAt).hasStrictDerivAt
#align has_strict_fderiv_at.comp_has_strict_deriv_at HasStrictFDerivAt.comp_hasStrictDerivAt
theorem HasStrictFDerivAt.comp_hasStrictDerivAt_of_eq (hl : HasStrictFDerivAt l l' y)
(hf : HasStrictDerivAt f f' x) (hy : y = f x) :
HasStrictDerivAt (l ∘ f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasStrictDerivAt x hf
theorem fderivWithin.comp_derivWithin {t : Set F} (hl : DifferentiableWithinAt 𝕜 l t (f x))
(hf : DifferentiableWithinAt 𝕜 f s x) (hs : MapsTo f s t) (hxs : UniqueDiffWithinAt 𝕜 s x) :
derivWithin (l ∘ f) s x = (fderivWithin 𝕜 l t (f x) : F → E) (derivWithin f s x) :=
(hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf.hasDerivWithinAt hs).derivWithin hxs
#align fderiv_within.comp_deriv_within fderivWithin.comp_derivWithin
| Mathlib/Analysis/Calculus/Deriv/Comp.lean | 404 | 408 | theorem fderivWithin.comp_derivWithin_of_eq {t : Set F} (hl : DifferentiableWithinAt 𝕜 l t y)
(hf : DifferentiableWithinAt 𝕜 f s x) (hs : MapsTo f s t) (hxs : UniqueDiffWithinAt 𝕜 s x)
(hy : y = f x) :
derivWithin (l ∘ f) s x = (fderivWithin 𝕜 l t (f x) : F → E) (derivWithin f s x) := by |
rw [hy] at hl; exact fderivWithin.comp_derivWithin x hl hf hs hxs
| 1 |
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Transvection
import Mathlib.MeasureTheory.Group.LIntegral
import Mathlib.MeasureTheory.Integral.Marginal
import Mathlib.MeasureTheory.Measure.Stieltjes
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
#align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
assert_not_exists MeasureTheory.integral
noncomputable section
open scoped Classical
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ENNReal (ofReal)
open scoped ENNReal NNReal Topology
section regionBetween
variable {α : Type*}
def regionBetween (f g : α → ℝ) (s : Set α) : Set (α × ℝ) :=
{ p : α × ℝ | p.1 ∈ s ∧ p.2 ∈ Ioo (f p.1) (g p.1) }
#align region_between regionBetween
theorem regionBetween_subset (f g : α → ℝ) (s : Set α) : regionBetween f g s ⊆ s ×ˢ univ := by
simpa only [prod_univ, regionBetween, Set.preimage, setOf_subset_setOf] using fun a => And.left
#align region_between_subset regionBetween_subset
variable [MeasurableSpace α] {μ : Measure α} {f g : α → ℝ} {s : Set α}
theorem measurableSet_regionBetween (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) :
MeasurableSet (regionBetween f g s) := by
dsimp only [regionBetween, Ioo, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_lt measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
#align measurable_set_region_between measurableSet_regionBetween
theorem measurableSet_region_between_oc (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst) } := by
dsimp only [regionBetween, Ioc, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_le measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
#align measurable_set_region_between_oc measurableSet_region_between_oc
theorem measurableSet_region_between_co (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst) } := by
dsimp only [regionBetween, Ico, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_le (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_lt measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
#align measurable_set_region_between_co measurableSet_region_between_co
theorem measurableSet_region_between_cc (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst) } := by
dsimp only [regionBetween, Icc, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_le (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_le measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
#align measurable_set_region_between_cc measurableSet_region_between_cc
| Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean | 506 | 508 | theorem measurableSet_graph (hf : Measurable f) :
MeasurableSet { p : α × ℝ | p.snd = f p.fst } := by |
simpa using measurableSet_region_between_cc hf hf MeasurableSet.univ
| 1 |
import Mathlib.Data.Int.Interval
import Mathlib.Data.Int.SuccPred
import Mathlib.Data.Int.ConditionallyCompleteOrder
import Mathlib.Topology.Instances.Discrete
import Mathlib.Topology.MetricSpace.Bounded
import Mathlib.Order.Filter.Archimedean
#align_import topology.instances.int from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open Metric Set Filter
namespace Int
instance : Dist ℤ :=
⟨fun x y => dist (x : ℝ) y⟩
theorem dist_eq (x y : ℤ) : dist x y = |(x : ℝ) - y| := rfl
#align int.dist_eq Int.dist_eq
theorem dist_eq' (m n : ℤ) : dist m n = |m - n| := by rw [dist_eq]; norm_cast
@[norm_cast, simp]
theorem dist_cast_real (x y : ℤ) : dist (x : ℝ) y = dist x y :=
rfl
#align int.dist_cast_real Int.dist_cast_real
theorem pairwise_one_le_dist : Pairwise fun m n : ℤ => 1 ≤ dist m n := by
intro m n hne
rw [dist_eq]; norm_cast; rwa [← zero_add (1 : ℤ), Int.add_one_le_iff, abs_pos, sub_ne_zero]
#align int.pairwise_one_le_dist Int.pairwise_one_le_dist
theorem uniformEmbedding_coe_real : UniformEmbedding ((↑) : ℤ → ℝ) :=
uniformEmbedding_bot_of_pairwise_le_dist zero_lt_one pairwise_one_le_dist
#align int.uniform_embedding_coe_real Int.uniformEmbedding_coe_real
theorem closedEmbedding_coe_real : ClosedEmbedding ((↑) : ℤ → ℝ) :=
closedEmbedding_of_pairwise_le_dist zero_lt_one pairwise_one_le_dist
#align int.closed_embedding_coe_real Int.closedEmbedding_coe_real
instance : MetricSpace ℤ := Int.uniformEmbedding_coe_real.comapMetricSpace _
theorem preimage_ball (x : ℤ) (r : ℝ) : (↑) ⁻¹' ball (x : ℝ) r = ball x r := rfl
#align int.preimage_ball Int.preimage_ball
theorem preimage_closedBall (x : ℤ) (r : ℝ) : (↑) ⁻¹' closedBall (x : ℝ) r = closedBall x r := rfl
#align int.preimage_closed_ball Int.preimage_closedBall
theorem ball_eq_Ioo (x : ℤ) (r : ℝ) : ball x r = Ioo ⌊↑x - r⌋ ⌈↑x + r⌉ := by
rw [← preimage_ball, Real.ball_eq_Ioo, preimage_Ioo]
#align int.ball_eq_Ioo Int.ball_eq_Ioo
theorem closedBall_eq_Icc (x : ℤ) (r : ℝ) : closedBall x r = Icc ⌈↑x - r⌉ ⌊↑x + r⌋ := by
rw [← preimage_closedBall, Real.closedBall_eq_Icc, preimage_Icc]
#align int.closed_ball_eq_Icc Int.closedBall_eq_Icc
instance : ProperSpace ℤ :=
⟨fun x r => by
rw [closedBall_eq_Icc]
exact (Set.finite_Icc _ _).isCompact⟩
@[simp]
theorem cobounded_eq : Bornology.cobounded ℤ = atBot ⊔ atTop := by
simp_rw [← comap_dist_right_atTop (0 : ℤ), dist_eq', sub_zero,
← comap_abs_atTop, ← @Int.comap_cast_atTop ℝ, comap_comap]; rfl
@[deprecated (since := "2024-02-07")] alias cocompact_eq := cocompact_eq_atBot_atTop
#align int.cocompact_eq Int.cocompact_eq
@[simp]
| Mathlib/Topology/Instances/Int.lean | 84 | 85 | theorem cofinite_eq : (cofinite : Filter ℤ) = atBot ⊔ atTop := by |
rw [← cocompact_eq_cofinite, cocompact_eq_atBot_atTop]
| 1 |
import Mathlib.Order.MinMax
import Mathlib.Data.Set.Subsingleton
import Mathlib.Tactic.Says
#align_import data.set.intervals.basic from "leanprover-community/mathlib"@"3ba15165bd6927679be7c22d6091a87337e3cd0c"
open Function
open OrderDual (toDual ofDual)
variable {α β : Type*}
namespace Set
section Preorder
variable [Preorder α] {a a₁ a₂ b b₁ b₂ c x : α}
def Ioo (a b : α) :=
{ x | a < x ∧ x < b }
#align set.Ioo Set.Ioo
def Ico (a b : α) :=
{ x | a ≤ x ∧ x < b }
#align set.Ico Set.Ico
def Iio (a : α) :=
{ x | x < a }
#align set.Iio Set.Iio
def Icc (a b : α) :=
{ x | a ≤ x ∧ x ≤ b }
#align set.Icc Set.Icc
def Iic (b : α) :=
{ x | x ≤ b }
#align set.Iic Set.Iic
def Ioc (a b : α) :=
{ x | a < x ∧ x ≤ b }
#align set.Ioc Set.Ioc
def Ici (a : α) :=
{ x | a ≤ x }
#align set.Ici Set.Ici
def Ioi (a : α) :=
{ x | a < x }
#align set.Ioi Set.Ioi
theorem Ioo_def (a b : α) : { x | a < x ∧ x < b } = Ioo a b :=
rfl
#align set.Ioo_def Set.Ioo_def
theorem Ico_def (a b : α) : { x | a ≤ x ∧ x < b } = Ico a b :=
rfl
#align set.Ico_def Set.Ico_def
theorem Iio_def (a : α) : { x | x < a } = Iio a :=
rfl
#align set.Iio_def Set.Iio_def
theorem Icc_def (a b : α) : { x | a ≤ x ∧ x ≤ b } = Icc a b :=
rfl
#align set.Icc_def Set.Icc_def
theorem Iic_def (b : α) : { x | x ≤ b } = Iic b :=
rfl
#align set.Iic_def Set.Iic_def
theorem Ioc_def (a b : α) : { x | a < x ∧ x ≤ b } = Ioc a b :=
rfl
#align set.Ioc_def Set.Ioc_def
theorem Ici_def (a : α) : { x | a ≤ x } = Ici a :=
rfl
#align set.Ici_def Set.Ici_def
theorem Ioi_def (a : α) : { x | a < x } = Ioi a :=
rfl
#align set.Ioi_def Set.Ioi_def
@[simp]
theorem mem_Ioo : x ∈ Ioo a b ↔ a < x ∧ x < b :=
Iff.rfl
#align set.mem_Ioo Set.mem_Ioo
@[simp]
theorem mem_Ico : x ∈ Ico a b ↔ a ≤ x ∧ x < b :=
Iff.rfl
#align set.mem_Ico Set.mem_Ico
@[simp]
theorem mem_Iio : x ∈ Iio b ↔ x < b :=
Iff.rfl
#align set.mem_Iio Set.mem_Iio
@[simp]
theorem mem_Icc : x ∈ Icc a b ↔ a ≤ x ∧ x ≤ b :=
Iff.rfl
#align set.mem_Icc Set.mem_Icc
@[simp]
theorem mem_Iic : x ∈ Iic b ↔ x ≤ b :=
Iff.rfl
#align set.mem_Iic Set.mem_Iic
@[simp]
theorem mem_Ioc : x ∈ Ioc a b ↔ a < x ∧ x ≤ b :=
Iff.rfl
#align set.mem_Ioc Set.mem_Ioc
@[simp]
theorem mem_Ici : x ∈ Ici a ↔ a ≤ x :=
Iff.rfl
#align set.mem_Ici Set.mem_Ici
@[simp]
theorem mem_Ioi : x ∈ Ioi a ↔ a < x :=
Iff.rfl
#align set.mem_Ioi Set.mem_Ioi
instance decidableMemIoo [Decidable (a < x ∧ x < b)] : Decidable (x ∈ Ioo a b) := by assumption
#align set.decidable_mem_Ioo Set.decidableMemIoo
instance decidableMemIco [Decidable (a ≤ x ∧ x < b)] : Decidable (x ∈ Ico a b) := by assumption
#align set.decidable_mem_Ico Set.decidableMemIco
instance decidableMemIio [Decidable (x < b)] : Decidable (x ∈ Iio b) := by assumption
#align set.decidable_mem_Iio Set.decidableMemIio
instance decidableMemIcc [Decidable (a ≤ x ∧ x ≤ b)] : Decidable (x ∈ Icc a b) := by assumption
#align set.decidable_mem_Icc Set.decidableMemIcc
instance decidableMemIic [Decidable (x ≤ b)] : Decidable (x ∈ Iic b) := by assumption
#align set.decidable_mem_Iic Set.decidableMemIic
instance decidableMemIoc [Decidable (a < x ∧ x ≤ b)] : Decidable (x ∈ Ioc a b) := by assumption
#align set.decidable_mem_Ioc Set.decidableMemIoc
instance decidableMemIci [Decidable (a ≤ x)] : Decidable (x ∈ Ici a) := by assumption
#align set.decidable_mem_Ici Set.decidableMemIci
instance decidableMemIoi [Decidable (a < x)] : Decidable (x ∈ Ioi a) := by assumption
#align set.decidable_mem_Ioi Set.decidableMemIoi
-- Porting note (#10618): `simp` can prove this
-- @[simp]
| Mathlib/Order/Interval/Set/Basic.lean | 181 | 181 | theorem left_mem_Ioo : a ∈ Ioo a b ↔ False := by | simp [lt_irrefl]
| 1 |
import Mathlib.GroupTheory.Subgroup.Center
import Mathlib.GroupTheory.Submonoid.Centralizer
#align_import group_theory.subgroup.basic from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
open Function
open Int
variable {G : Type*} [Group G]
namespace Subgroup
variable {H K : Subgroup G}
@[to_additive
"The `centralizer` of `H` is the additive subgroup of `g : G` commuting with every `h : H`."]
def centralizer (s : Set G) : Subgroup G :=
{ Submonoid.centralizer s with
carrier := Set.centralizer s
inv_mem' := Set.inv_mem_centralizer }
#align subgroup.centralizer Subgroup.centralizer
#align add_subgroup.centralizer AddSubgroup.centralizer
@[to_additive]
theorem mem_centralizer_iff {g : G} {s : Set G} : g ∈ centralizer s ↔ ∀ h ∈ s, h * g = g * h :=
Iff.rfl
#align subgroup.mem_centralizer_iff Subgroup.mem_centralizer_iff
#align add_subgroup.mem_centralizer_iff AddSubgroup.mem_centralizer_iff
@[to_additive]
| Mathlib/GroupTheory/Subgroup/Centralizer.lean | 42 | 44 | theorem mem_centralizer_iff_commutator_eq_one {g : G} {s : Set G} :
g ∈ centralizer s ↔ ∀ h ∈ s, h * g * h⁻¹ * g⁻¹ = 1 := by |
simp only [mem_centralizer_iff, mul_inv_eq_iff_eq_mul, one_mul]
| 1 |
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Preserves.Basic
#align_import category_theory.limits.preserves.shapes.pullbacks from "leanprover-community/mathlib"@"f11e306adb9f2a393539d2bb4293bf1b42caa7ac"
noncomputable section
universe v₁ v₂ u₁ u₂
-- Porting note: need Functor namespace for mapCone
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Functor
namespace CategoryTheory.Limits
section Pullback
variable {C : Type u₁} [Category.{v₁} C]
variable {D : Type u₂} [Category.{v₂} D]
variable (G : C ⥤ D)
variable {W X Y Z : C} {f : X ⟶ Z} {g : Y ⟶ Z} {h : W ⟶ X} {k : W ⟶ Y} (comm : h ≫ f = k ≫ g)
def isLimitMapConePullbackConeEquiv :
IsLimit (mapCone G (PullbackCone.mk h k comm)) ≃
IsLimit
(PullbackCone.mk (G.map h) (G.map k) (by simp only [← G.map_comp, comm]) :
PullbackCone (G.map f) (G.map g)) :=
(IsLimit.postcomposeHomEquiv (diagramIsoCospan.{v₂} _) _).symm.trans <|
IsLimit.equivIsoLimit <|
Cones.ext (Iso.refl _) <| by
rintro (_ | _ | _) <;> dsimp <;> simp only [comp_id, id_comp, G.map_comp]
#align category_theory.limits.is_limit_map_cone_pullback_cone_equiv CategoryTheory.Limits.isLimitMapConePullbackConeEquiv
def isLimitPullbackConeMapOfIsLimit [PreservesLimit (cospan f g) G]
(l : IsLimit (PullbackCone.mk h k comm)) :
have : G.map h ≫ G.map f = G.map k ≫ G.map g := by rw [← G.map_comp, ← G.map_comp,comm]
IsLimit (PullbackCone.mk (G.map h) (G.map k) this) :=
isLimitMapConePullbackConeEquiv G comm (PreservesLimit.preserves l)
#align category_theory.limits.is_limit_pullback_cone_map_of_is_limit CategoryTheory.Limits.isLimitPullbackConeMapOfIsLimit
def isLimitOfIsLimitPullbackConeMap [ReflectsLimit (cospan f g) G]
(l : IsLimit (PullbackCone.mk (G.map h) (G.map k) (show G.map h ≫ G.map f = G.map k ≫ G.map g
from by simp only [← G.map_comp,comm]))) : IsLimit (PullbackCone.mk h k comm) :=
ReflectsLimit.reflects ((isLimitMapConePullbackConeEquiv G comm).symm l)
#align category_theory.limits.is_limit_of_is_limit_pullback_cone_map CategoryTheory.Limits.isLimitOfIsLimitPullbackConeMap
variable (f g) [PreservesLimit (cospan f g) G]
def isLimitOfHasPullbackOfPreservesLimit [i : HasPullback f g] :
have : G.map pullback.fst ≫ G.map f = G.map pullback.snd ≫ G.map g := by
simp only [← G.map_comp, pullback.condition];
IsLimit (PullbackCone.mk (G.map (@pullback.fst _ _ _ _ _ f g i)) (G.map pullback.snd) this) :=
isLimitPullbackConeMapOfIsLimit G _ (pullbackIsPullback f g)
#align category_theory.limits.is_limit_of_has_pullback_of_preserves_limit CategoryTheory.Limits.isLimitOfHasPullbackOfPreservesLimit
def preservesPullbackSymmetry : PreservesLimit (cospan g f) G where
preserves {c} hc := by
apply (IsLimit.postcomposeHomEquiv (diagramIsoCospan.{v₂} _) _).toFun
apply IsLimit.ofIsoLimit _ (PullbackCone.isoMk _).symm
apply PullbackCone.isLimitOfFlip
apply (isLimitMapConePullbackConeEquiv _ _).toFun
· refine @PreservesLimit.preserves _ _ _ _ _ _ _ _ ?_ _ ?_
· dsimp
infer_instance
apply PullbackCone.isLimitOfFlip
apply IsLimit.ofIsoLimit _ (PullbackCone.isoMk _)
exact (IsLimit.postcomposeHomEquiv (diagramIsoCospan.{v₁} _) _).invFun hc
· exact
(c.π.naturality WalkingCospan.Hom.inr).symm.trans
(c.π.naturality WalkingCospan.Hom.inl : _)
#align category_theory.limits.preserves_pullback_symmetry CategoryTheory.Limits.preservesPullbackSymmetry
theorem hasPullback_of_preservesPullback [HasPullback f g] : HasPullback (G.map f) (G.map g) :=
⟨⟨⟨_, isLimitPullbackConeMapOfIsLimit G _ (pullbackIsPullback _ _)⟩⟩⟩
#align category_theory.limits.has_pullback_of_preserves_pullback CategoryTheory.Limits.hasPullback_of_preservesPullback
variable [HasPullback f g] [HasPullback (G.map f) (G.map g)]
def PreservesPullback.iso : G.obj (pullback f g) ≅ pullback (G.map f) (G.map g) :=
IsLimit.conePointUniqueUpToIso (isLimitOfHasPullbackOfPreservesLimit G f g) (limit.isLimit _)
#align category_theory.limits.preserves_pullback.iso CategoryTheory.Limits.PreservesPullback.iso
@[simp]
theorem PreservesPullback.iso_hom : (PreservesPullback.iso G f g).hom = pullbackComparison G f g :=
rfl
#align category_theory.limits.preserves_pullback.iso_hom CategoryTheory.Limits.PreservesPullback.iso_hom
@[reassoc]
theorem PreservesPullback.iso_hom_fst :
(PreservesPullback.iso G f g).hom ≫ pullback.fst = G.map pullback.fst := by
simp [PreservesPullback.iso]
#align category_theory.limits.preserves_pullback.iso_hom_fst CategoryTheory.Limits.PreservesPullback.iso_hom_fst
@[reassoc]
theorem PreservesPullback.iso_hom_snd :
(PreservesPullback.iso G f g).hom ≫ pullback.snd = G.map pullback.snd := by
simp [PreservesPullback.iso]
#align category_theory.limits.preserves_pullback.iso_hom_snd CategoryTheory.Limits.PreservesPullback.iso_hom_snd
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Limits/Preserves/Shapes/Pullbacks.lean | 132 | 134 | theorem PreservesPullback.iso_inv_fst :
(PreservesPullback.iso G f g).inv ≫ G.map pullback.fst = pullback.fst := by |
simp [PreservesPullback.iso, Iso.inv_comp_eq]
| 1 |
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
theorem pderiv_monomial_single {i : σ} {n : ℕ} : pderiv i (monomial (single i n) a) =
monomial (single i (n - 1)) (a * n) := by simp
#align mv_polynomial.pderiv_monomial_single MvPolynomial.pderiv_monomial_single
theorem pderiv_mul {i : σ} {f g : MvPolynomial σ R} :
pderiv i (f * g) = pderiv i f * g + f * pderiv i g := by
simp only [(pderiv i).leibniz f g, smul_eq_mul, mul_comm, add_comm]
#align mv_polynomial.pderiv_mul MvPolynomial.pderiv_mul
theorem pderiv_pow {i : σ} {f : MvPolynomial σ R} {n : ℕ} :
pderiv i (f ^ n) = n * f ^ (n - 1) * pderiv i f := by
rw [(pderiv i).leibniz_pow f n, nsmul_eq_mul, smul_eq_mul, mul_assoc]
-- @[simp] -- Porting note (#10618): simp can prove this
| Mathlib/Algebra/MvPolynomial/PDeriv.lean | 125 | 126 | theorem pderiv_C_mul {f : MvPolynomial σ R} {i : σ} : pderiv i (C a * f) = C a * pderiv i f := by |
rw [C_mul', Derivation.map_smul, C_mul']
| 1 |
import Mathlib.RingTheory.WittVector.Truncated
import Mathlib.RingTheory.WittVector.Identities
import Mathlib.NumberTheory.Padics.RingHoms
#align_import ring_theory.witt_vector.compare from "leanprover-community/mathlib"@"168ad7fc5d8173ad38be9767a22d50b8ecf1cd00"
noncomputable section
variable {p : ℕ} [hp : Fact p.Prime]
local notation "𝕎" => WittVector p
namespace TruncatedWittVector
variable (p) (n : ℕ) (R : Type*) [CommRing R]
theorem eq_of_le_of_cast_pow_eq_zero [CharP R p] (i : ℕ) (hin : i ≤ n)
(hpi : (p : TruncatedWittVector p n R) ^ i = 0) : i = n := by
contrapose! hpi
replace hin := lt_of_le_of_ne hin hpi; clear hpi
have : (p : TruncatedWittVector p n R) ^ i = WittVector.truncate n ((p : 𝕎 R) ^ i) := by
rw [RingHom.map_pow, map_natCast]
rw [this, ne_eq, ext_iff, not_forall]; clear this
use ⟨i, hin⟩
rw [WittVector.coeff_truncate, coeff_zero, Fin.val_mk, WittVector.coeff_p_pow]
haveI : Nontrivial R := CharP.nontrivial_of_char_ne_one hp.1.ne_one
exact one_ne_zero
#align truncated_witt_vector.eq_of_le_of_cast_pow_eq_zero TruncatedWittVector.eq_of_le_of_cast_pow_eq_zero
section Iso
variable {R}
theorem card_zmod : Fintype.card (TruncatedWittVector p n (ZMod p)) = p ^ n := by
rw [card, ZMod.card]
#align truncated_witt_vector.card_zmod TruncatedWittVector.card_zmod
theorem charP_zmod : CharP (TruncatedWittVector p n (ZMod p)) (p ^ n) :=
charP_of_prime_pow_injective _ _ _ (card_zmod _ _) (eq_of_le_of_cast_pow_eq_zero p n (ZMod p))
#align truncated_witt_vector.char_p_zmod TruncatedWittVector.charP_zmod
attribute [local instance] charP_zmod
def zmodEquivTrunc : ZMod (p ^ n) ≃+* TruncatedWittVector p n (ZMod p) :=
ZMod.ringEquiv (TruncatedWittVector p n (ZMod p)) (card_zmod _ _)
#align truncated_witt_vector.zmod_equiv_trunc TruncatedWittVector.zmodEquivTrunc
theorem zmodEquivTrunc_apply {x : ZMod (p ^ n)} :
zmodEquivTrunc p n x = ZMod.castHom (by rfl) (TruncatedWittVector p n (ZMod p)) x :=
rfl
#align truncated_witt_vector.zmod_equiv_trunc_apply TruncatedWittVector.zmodEquivTrunc_apply
theorem commutes {m : ℕ} (hm : n ≤ m) :
(truncate hm).comp (zmodEquivTrunc p m).toRingHom =
(zmodEquivTrunc p n).toRingHom.comp (ZMod.castHom (pow_dvd_pow p hm) _) :=
RingHom.ext_zmod _ _
#align truncated_witt_vector.commutes TruncatedWittVector.commutes
theorem commutes' {m : ℕ} (hm : n ≤ m) (x : ZMod (p ^ m)) :
truncate hm (zmodEquivTrunc p m x) = zmodEquivTrunc p n (ZMod.castHom (pow_dvd_pow p hm) _ x) :=
show (truncate hm).comp (zmodEquivTrunc p m).toRingHom x = _ by rw [commutes _ _ hm]; rfl
#align truncated_witt_vector.commutes' TruncatedWittVector.commutes'
theorem commutes_symm' {m : ℕ} (hm : n ≤ m) (x : TruncatedWittVector p m (ZMod p)) :
(zmodEquivTrunc p n).symm (truncate hm x) =
ZMod.castHom (pow_dvd_pow p hm) _ ((zmodEquivTrunc p m).symm x) := by
apply (zmodEquivTrunc p n).injective
rw [← commutes' _ _ hm]
simp
#align truncated_witt_vector.commutes_symm' TruncatedWittVector.commutes_symm'
| Mathlib/RingTheory/WittVector/Compare.lean | 127 | 130 | theorem commutes_symm {m : ℕ} (hm : n ≤ m) :
(zmodEquivTrunc p n).symm.toRingHom.comp (truncate hm) =
(ZMod.castHom (pow_dvd_pow p hm) _).comp (zmodEquivTrunc p m).symm.toRingHom := by |
ext; apply commutes_symm'
| 1 |
import Batteries.Data.List.Basic
namespace Batteries
inductive AssocList (α : Type u) (β : Type v) where
| nil
| cons (key : α) (value : β) (tail : AssocList α β)
deriving Inhabited
namespace AssocList
@[simp] def toList : AssocList α β → List (α × β)
| nil => []
| cons a b es => (a, b) :: es.toList
instance : EmptyCollection (AssocList α β) := ⟨nil⟩
@[simp] theorem empty_eq : (∅ : AssocList α β) = nil := rfl
def isEmpty : AssocList α β → Bool
| nil => true
| _ => false
@[simp] theorem isEmpty_eq (l : AssocList α β) : isEmpty l = l.toList.isEmpty := by
cases l <;> simp [*, isEmpty, List.isEmpty]
def length (L : AssocList α β) : Nat :=
match L with
| .nil => 0
| .cons _ _ t => t.length + 1
@[simp] theorem length_nil : length (nil : AssocList α β) = 0 := rfl
@[simp] theorem length_cons : length (cons a b t) = length t + 1 := rfl
theorem length_toList (l : AssocList α β) : l.toList.length = l.length := by
induction l <;> simp_all
@[specialize] def foldlM [Monad m] (f : δ → α → β → m δ) : (init : δ) → AssocList α β → m δ
| d, nil => pure d
| d, cons a b es => do foldlM f (← f d a b) es
@[simp] theorem foldlM_eq [Monad m] (f : δ → α → β → m δ) (init l) :
foldlM f init l = l.toList.foldlM (fun d (a, b) => f d a b) init := by
induction l generalizing init <;> simp [*, foldlM]
@[inline] def foldl (f : δ → α → β → δ) (init : δ) (as : AssocList α β) : δ :=
Id.run (foldlM f init as)
@[simp] theorem foldl_eq (f : δ → α → β → δ) (init l) :
foldl f init l = l.toList.foldl (fun d (a, b) => f d a b) init := by
simp [List.foldl_eq_foldlM, foldl, Id.run]
def toListTR (as : AssocList α β) : List (α × β) :=
as.foldl (init := #[]) (fun r a b => r.push (a, b)) |>.toList
@[csimp] theorem toList_eq_toListTR : @toList = @toListTR := by
funext α β as; simp [toListTR]
exact .symm <| (Array.foldl_data_eq_map (toList as) _ id).trans (List.map_id _)
@[specialize] def forM [Monad m] (f : α → β → m PUnit) : AssocList α β → m PUnit
| nil => pure ⟨⟩
| cons a b es => do f a b; forM f es
@[simp] theorem forM_eq [Monad m] (f : α → β → m PUnit) (l) :
forM f l = l.toList.forM (fun (a, b) => f a b) := by
induction l <;> simp [*, forM]
@[simp] def mapKey (f : α → δ) : AssocList α β → AssocList δ β
| nil => nil
| cons k v t => cons (f k) v (mapKey f t)
@[simp] theorem toList_mapKey (f : α → δ) (l : AssocList α β) :
(mapKey f l).toList = l.toList.map (fun (a, b) => (f a, b)) := by
induction l <;> simp [*]
@[simp] theorem length_mapKey : (mapKey f l).length = l.length := by
induction l <;> simp_all
@[simp] def mapVal (f : α → β → δ) : AssocList α β → AssocList α δ
| nil => nil
| cons k v t => cons k (f k v) (mapVal f t)
@[simp] theorem toList_mapVal (f : α → β → δ) (l : AssocList α β) :
(mapVal f l).toList = l.toList.map (fun (a, b) => (a, f a b)) := by
induction l <;> simp [*]
@[simp] theorem length_mapVal : (mapVal f l).length = l.length := by
induction l <;> simp_all
@[specialize] def findEntryP? (p : α → β → Bool) : AssocList α β → Option (α × β)
| nil => none
| cons k v es => bif p k v then some (k, v) else findEntryP? p es
@[simp] theorem findEntryP?_eq (p : α → β → Bool) (l : AssocList α β) :
findEntryP? p l = l.toList.find? fun (a, b) => p a b := by
induction l <;> simp [findEntryP?, List.find?_cons]; split <;> simp [*]
@[inline] def findEntry? [BEq α] (a : α) (l : AssocList α β) : Option (α × β) :=
findEntryP? (fun k _ => k == a) l
@[simp] theorem findEntry?_eq [BEq α] (a : α) (l : AssocList α β) :
findEntry? a l = l.toList.find? (·.1 == a) := findEntryP?_eq ..
def find? [BEq α] (a : α) : AssocList α β → Option β
| nil => none
| cons k v es => match k == a with
| true => some v
| false => find? a es
| .lake/packages/batteries/Batteries/Data/AssocList.lean | 139 | 141 | theorem find?_eq_findEntry? [BEq α] (a : α) (l : AssocList α β) :
find? a l = (l.findEntry? a).map (·.2) := by |
induction l <;> simp [find?, List.find?_cons]; split <;> simp [*]
| 1 |
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
#align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe"
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor'' (X Y : C) :
(α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor''
@[reassoc]
theorem leftUnitor_tensor' (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y) := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor'
@[reassoc]
theorem leftUnitor_tensor_inv' (X Y : C) :
(λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by coherence
#align category_theory.monoidal_category.left_unitor_tensor_inv CategoryTheory.MonoidalCategory.leftUnitor_tensor_inv'
@[reassoc]
theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by
coherence
#align category_theory.monoidal_category.id_tensor_right_unitor_inv CategoryTheory.MonoidalCategory.id_tensor_rightUnitor_inv
@[reassoc]
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 52 | 53 | theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by |
coherence
| 1 |
import Mathlib.RingTheory.WittVector.Frobenius
import Mathlib.RingTheory.WittVector.Verschiebung
import Mathlib.RingTheory.WittVector.MulP
#align_import ring_theory.witt_vector.identities from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
namespace WittVector
variable {p : ℕ} {R : Type*} [hp : Fact p.Prime] [CommRing R]
-- type as `\bbW`
local notation "𝕎" => WittVector p
noncomputable section
-- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added.
theorem frobenius_verschiebung (x : 𝕎 R) : frobenius (verschiebung x) = x * p := by
have : IsPoly p fun {R} [CommRing R] x ↦ frobenius (verschiebung x) :=
IsPoly.comp (hg := frobenius_isPoly p) (hf := verschiebung_isPoly)
have : IsPoly p fun {R} [CommRing R] x ↦ x * p := mulN_isPoly p p
ghost_calc x
ghost_simp [mul_comm]
#align witt_vector.frobenius_verschiebung WittVector.frobenius_verschiebung
theorem verschiebung_zmod (x : 𝕎 (ZMod p)) : verschiebung x = x * p := by
rw [← frobenius_verschiebung, frobenius_zmodp]
#align witt_vector.verschiebung_zmod WittVector.verschiebung_zmod
variable (p R)
theorem coeff_p_pow [CharP R p] (i : ℕ) : ((p : 𝕎 R) ^ i).coeff i = 1 := by
induction' i with i h
· simp only [Nat.zero_eq, one_coeff_zero, Ne, pow_zero]
· rw [pow_succ, ← frobenius_verschiebung, coeff_frobenius_charP,
verschiebung_coeff_succ, h, one_pow]
#align witt_vector.coeff_p_pow WittVector.coeff_p_pow
theorem coeff_p_pow_eq_zero [CharP R p] {i j : ℕ} (hj : j ≠ i) : ((p : 𝕎 R) ^ i).coeff j = 0 := by
induction' i with i hi generalizing j
· rw [pow_zero, one_coeff_eq_of_pos]
exact Nat.pos_of_ne_zero hj
· rw [pow_succ, ← frobenius_verschiebung, coeff_frobenius_charP]
cases j
· rw [verschiebung_coeff_zero, zero_pow hp.out.ne_zero]
· rw [verschiebung_coeff_succ, hi (ne_of_apply_ne _ hj), zero_pow hp.out.ne_zero]
#align witt_vector.coeff_p_pow_eq_zero WittVector.coeff_p_pow_eq_zero
theorem coeff_p [CharP R p] (i : ℕ) : (p : 𝕎 R).coeff i = if i = 1 then 1 else 0 := by
split_ifs with hi
· simpa only [hi, pow_one] using coeff_p_pow p R 1
· simpa only [pow_one] using coeff_p_pow_eq_zero p R hi
#align witt_vector.coeff_p WittVector.coeff_p
@[simp]
theorem coeff_p_zero [CharP R p] : (p : 𝕎 R).coeff 0 = 0 := by
rw [coeff_p, if_neg]
exact zero_ne_one
#align witt_vector.coeff_p_zero WittVector.coeff_p_zero
@[simp]
theorem coeff_p_one [CharP R p] : (p : 𝕎 R).coeff 1 = 1 := by rw [coeff_p, if_pos rfl]
#align witt_vector.coeff_p_one WittVector.coeff_p_one
theorem p_nonzero [Nontrivial R] [CharP R p] : (p : 𝕎 R) ≠ 0 := by
intro h
simpa only [h, zero_coeff, zero_ne_one] using coeff_p_one p R
#align witt_vector.p_nonzero WittVector.p_nonzero
| Mathlib/RingTheory/WittVector/Identities.lean | 95 | 96 | theorem FractionRing.p_nonzero [Nontrivial R] [CharP R p] : (p : FractionRing (𝕎 R)) ≠ 0 := by |
simpa using (IsFractionRing.injective (𝕎 R) (FractionRing (𝕎 R))).ne (WittVector.p_nonzero _ _)
| 1 |
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]
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)
#align complex.closure_set_of_lt_re Complex.closure_setOf_lt_re
@[simp]
theorem closure_setOf_lt_im (a : ℝ) : closure { z : ℂ | a < z.im } = { z | a ≤ z.im } := by
simpa only [closure_Ioi] using closure_preimage_im (Ioi a)
#align complex.closure_set_of_lt_im Complex.closure_setOf_lt_im
@[simp]
theorem frontier_setOf_re_le (a : ℝ) : frontier { z : ℂ | z.re ≤ a } = { z | z.re = a } := by
simpa only [frontier_Iic] using frontier_preimage_re (Iic a)
#align complex.frontier_set_of_re_le Complex.frontier_setOf_re_le
@[simp]
| Mathlib/Analysis/Complex/ReImTopology.lean | 139 | 140 | theorem frontier_setOf_im_le (a : ℝ) : frontier { z : ℂ | z.im ≤ a } = { z | z.im = a } := by |
simpa only [frontier_Iic] using frontier_preimage_im (Iic a)
| 1 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Filter Asymptotics Set
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F :=
(iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv iteratedDeriv
def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F :=
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv_within iteratedDerivWithin
variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜}
theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by
ext x
rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ]
#align iterated_deriv_within_univ iteratedDerivWithin_univ
theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x =
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 :=
rfl
#align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin
theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s =
(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by
ext x; rfl
#align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_eq_equiv_comp :
iteratedFDerivWithin 𝕜 n f s =
ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm,
Function.id_comp]
#align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} :
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m =
(∏ i, m i) • iteratedDerivWithin n f s x := by
rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ]
simp
#align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod
theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin :
‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by
rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map]
#align norm_iterated_fderiv_within_eq_norm_iterated_deriv_within norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin
@[simp]
theorem iteratedDerivWithin_zero : iteratedDerivWithin 0 f s = f := by
ext x
simp [iteratedDerivWithin]
#align iterated_deriv_within_zero iteratedDerivWithin_zero
@[simp]
| Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean | 119 | 121 | theorem iteratedDerivWithin_one {x : 𝕜} (h : UniqueDiffWithinAt 𝕜 s x) :
iteratedDerivWithin 1 f s x = derivWithin f s x := by |
simp only [iteratedDerivWithin, iteratedFDerivWithin_one_apply h]; rfl
| 1 |
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition
import Mathlib.RingTheory.MvPolynomial.Basic
#align_import field_theory.mv_polynomial from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f"
noncomputable section
open scoped Classical
open Set LinearMap Submodule
namespace MvPolynomial
universe u
variable {σ : Type u} {K : Type u} [Field K]
open scoped Classical
| Mathlib/FieldTheory/MvPolynomial.lean | 54 | 55 | theorem rank_mvPolynomial : Module.rank K (MvPolynomial σ K) = Cardinal.mk (σ →₀ ℕ) := by |
rw [← Cardinal.lift_inj, ← (basisMonomials σ K).mk_eq_rank]
| 1 |
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Data.Finset.Sym
import Mathlib.Data.Matrix.Basic
#align_import combinatorics.simple_graph.inc_matrix from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496"
open Finset Matrix SimpleGraph Sym2
open Matrix
namespace SimpleGraph
variable (R : Type*) {α : Type*} (G : SimpleGraph α)
noncomputable def incMatrix [Zero R] [One R] : Matrix α (Sym2 α) R := fun a =>
(G.incidenceSet a).indicator 1
#align simple_graph.inc_matrix SimpleGraph.incMatrix
variable {R}
theorem incMatrix_apply [Zero R] [One R] {a : α} {e : Sym2 α} :
G.incMatrix R a e = (G.incidenceSet a).indicator 1 e :=
rfl
#align simple_graph.inc_matrix_apply SimpleGraph.incMatrix_apply
theorem incMatrix_apply' [Zero R] [One R] [DecidableEq α] [DecidableRel G.Adj] {a : α}
{e : Sym2 α} : G.incMatrix R a e = if e ∈ G.incidenceSet a then 1 else 0 := by
unfold incMatrix Set.indicator
convert rfl
#align simple_graph.inc_matrix_apply' SimpleGraph.incMatrix_apply'
section MulZeroOneClass
variable [MulZeroOneClass R] {a b : α} {e : Sym2 α}
theorem incMatrix_apply_mul_incMatrix_apply : G.incMatrix R a e * G.incMatrix R b e =
(G.incidenceSet a ∩ G.incidenceSet b).indicator 1 e := by
classical simp only [incMatrix, Set.indicator_apply, ite_zero_mul_ite_zero, Pi.one_apply, mul_one,
Set.mem_inter_iff]
#align simple_graph.inc_matrix_apply_mul_inc_matrix_apply SimpleGraph.incMatrix_apply_mul_incMatrix_apply
theorem incMatrix_apply_mul_incMatrix_apply_of_not_adj (hab : a ≠ b) (h : ¬G.Adj a b) :
G.incMatrix R a e * G.incMatrix R b e = 0 := by
rw [incMatrix_apply_mul_incMatrix_apply, Set.indicator_of_not_mem]
rw [G.incidenceSet_inter_incidenceSet_of_not_adj h hab]
exact Set.not_mem_empty e
#align simple_graph.inc_matrix_apply_mul_inc_matrix_apply_of_not_adj SimpleGraph.incMatrix_apply_mul_incMatrix_apply_of_not_adj
theorem incMatrix_of_not_mem_incidenceSet (h : e ∉ G.incidenceSet a) : G.incMatrix R a e = 0 := by
rw [incMatrix_apply, Set.indicator_of_not_mem h]
#align simple_graph.inc_matrix_of_not_mem_incidence_set SimpleGraph.incMatrix_of_not_mem_incidenceSet
theorem incMatrix_of_mem_incidenceSet (h : e ∈ G.incidenceSet a) : G.incMatrix R a e = 1 := by
rw [incMatrix_apply, Set.indicator_of_mem h, Pi.one_apply]
#align simple_graph.inc_matrix_of_mem_incidence_set SimpleGraph.incMatrix_of_mem_incidenceSet
variable [Nontrivial R]
| Mathlib/Combinatorics/SimpleGraph/IncMatrix.lean | 102 | 103 | theorem incMatrix_apply_eq_zero_iff : G.incMatrix R a e = 0 ↔ e ∉ G.incidenceSet a := by |
simp only [incMatrix_apply, Set.indicator_apply_eq_zero, Pi.one_apply, one_ne_zero]
| 1 |
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]
| Mathlib/Order/Interval/Finset/Basic.lean | 139 | 139 | theorem left_mem_Ico : a ∈ Ico a b ↔ a < b := by | simp only [mem_Ico, true_and_iff, le_refl]
| 1 |
import Mathlib.LinearAlgebra.AffineSpace.Independent
import Mathlib.LinearAlgebra.Basis
#align_import linear_algebra.affine_space.basis from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Affine
open Set
universe u₁ u₂ u₃ u₄
structure AffineBasis (ι : Type u₁) (k : Type u₂) {V : Type u₃} (P : Type u₄) [AddCommGroup V]
[AffineSpace V P] [Ring k] [Module k V] where
protected toFun : ι → P
protected ind' : AffineIndependent k toFun
protected tot' : affineSpan k (range toFun) = ⊤
#align affine_basis AffineBasis
variable {ι ι' k V P : Type*} [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P) {s : Finset ι} {i j : ι} (e : ι ≃ ι')
instance : Inhabited (AffineBasis PUnit k PUnit) :=
⟨⟨id, affineIndependent_of_subsingleton k id, by simp⟩⟩
instance instFunLike : FunLike (AffineBasis ι k P) ι P where
coe := AffineBasis.toFun
coe_injective' f g h := by cases f; cases g; congr
#align affine_basis.fun_like AffineBasis.instFunLike
@[ext]
theorem ext {b₁ b₂ : AffineBasis ι k P} (h : (b₁ : ι → P) = b₂) : b₁ = b₂ :=
DFunLike.coe_injective h
#align affine_basis.ext AffineBasis.ext
theorem ind : AffineIndependent k b :=
b.ind'
#align affine_basis.ind AffineBasis.ind
theorem tot : affineSpan k (range b) = ⊤ :=
b.tot'
#align affine_basis.tot AffineBasis.tot
protected theorem nonempty : Nonempty ι :=
not_isEmpty_iff.mp fun hι => by
simpa only [@range_eq_empty _ _ hι, AffineSubspace.span_empty, bot_ne_top] using b.tot
#align affine_basis.nonempty AffineBasis.nonempty
def reindex (e : ι ≃ ι') : AffineBasis ι' k P :=
⟨b ∘ e.symm, b.ind.comp_embedding e.symm.toEmbedding, by
rw [e.symm.surjective.range_comp]
exact b.3⟩
#align affine_basis.reindex AffineBasis.reindex
@[simp, norm_cast]
theorem coe_reindex : ⇑(b.reindex e) = b ∘ e.symm :=
rfl
#align affine_basis.coe_reindex AffineBasis.coe_reindex
@[simp]
theorem reindex_apply (i' : ι') : b.reindex e i' = b (e.symm i') :=
rfl
#align affine_basis.reindex_apply AffineBasis.reindex_apply
@[simp]
theorem reindex_refl : b.reindex (Equiv.refl _) = b :=
ext rfl
#align affine_basis.reindex_refl AffineBasis.reindex_refl
noncomputable def basisOf (i : ι) : Basis { j : ι // j ≠ i } k V :=
Basis.mk ((affineIndependent_iff_linearIndependent_vsub k b i).mp b.ind)
(by
suffices
Submodule.span k (range fun j : { x // x ≠ i } => b ↑j -ᵥ b i) = vectorSpan k (range b) by
rw [this, ← direction_affineSpan, b.tot, AffineSubspace.direction_top]
conv_rhs => rw [← image_univ]
rw [vectorSpan_image_eq_span_vsub_set_right_ne k b (mem_univ i)]
congr
ext v
simp)
#align affine_basis.basis_of AffineBasis.basisOf
@[simp]
theorem basisOf_apply (i : ι) (j : { j : ι // j ≠ i }) : b.basisOf i j = b ↑j -ᵥ b i := by
simp [basisOf]
#align affine_basis.basis_of_apply AffineBasis.basisOf_apply
@[simp]
theorem basisOf_reindex (i : ι') :
(b.reindex e).basisOf i =
(b.basisOf <| e.symm i).reindex (e.subtypeEquiv fun _ => e.eq_symm_apply.not) := by
ext j
simp
#align affine_basis.basis_of_reindex AffineBasis.basisOf_reindex
noncomputable def coord (i : ι) : P →ᵃ[k] k where
toFun q := 1 - (b.basisOf i).sumCoords (q -ᵥ b i)
linear := -(b.basisOf i).sumCoords
map_vadd' q v := by
dsimp only
rw [vadd_vsub_assoc, LinearMap.map_add, vadd_eq_add, LinearMap.neg_apply,
sub_add_eq_sub_sub_swap, add_comm, sub_eq_add_neg]
#align affine_basis.coord AffineBasis.coord
@[simp]
theorem linear_eq_sumCoords (i : ι) : (b.coord i).linear = -(b.basisOf i).sumCoords :=
rfl
#align affine_basis.linear_eq_sum_coords AffineBasis.linear_eq_sumCoords
@[simp]
theorem coord_reindex (i : ι') : (b.reindex e).coord i = b.coord (e.symm i) := by
ext
classical simp [AffineBasis.coord]
#align affine_basis.coord_reindex AffineBasis.coord_reindex
@[simp]
theorem coord_apply_eq (i : ι) : b.coord i (b i) = 1 := by
simp only [coord, Basis.coe_sumCoords, LinearEquiv.map_zero, LinearEquiv.coe_coe, sub_zero,
AffineMap.coe_mk, Finsupp.sum_zero_index, vsub_self]
#align affine_basis.coord_apply_eq AffineBasis.coord_apply_eq
@[simp]
theorem coord_apply_ne (h : i ≠ j) : b.coord i (b j) = 0 := by
-- Porting note:
-- in mathlib3 we didn't need to given the `fun j => j ≠ i` argument to `Subtype.coe_mk`,
-- but I don't think we can complain: this proof was over-golfed.
rw [coord, AffineMap.coe_mk, ← @Subtype.coe_mk _ (fun j => j ≠ i) j h.symm, ← b.basisOf_apply,
Basis.sumCoords_self_apply, sub_self]
#align affine_basis.coord_apply_ne AffineBasis.coord_apply_ne
| Mathlib/LinearAlgebra/AffineSpace/Basis.lean | 182 | 183 | theorem coord_apply [DecidableEq ι] (i j : ι) : b.coord i (b j) = if i = j then 1 else 0 := by |
rcases eq_or_ne i j with h | h <;> simp [h]
| 1 |
import Batteries.Tactic.Alias
import Batteries.Data.Nat.Basic
namespace Nat
@[simp] theorem recAux_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) :
Nat.recAux zero succ 0 = zero := rfl
theorem recAux_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) (n) :
Nat.recAux zero succ (n+1) = succ n (Nat.recAux zero succ n) := rfl
@[simp] theorem recAuxOn_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) :
Nat.recAuxOn 0 zero succ = zero := rfl
theorem recAuxOn_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) (n) :
Nat.recAuxOn (n+1) zero succ = succ n (Nat.recAuxOn n zero succ) := rfl
@[simp] theorem casesAuxOn_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive (n+1)) :
Nat.casesAuxOn 0 zero succ = zero := rfl
theorem casesAuxOn_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive (n+1)) (n) :
Nat.casesAuxOn (n+1) zero succ = succ n := rfl
theorem strongRec_eq {motive : Nat → Sort _} (ind : ∀ n, (∀ m, m < n → motive m) → motive n)
(t : Nat) : Nat.strongRec ind t = ind t fun m _ => Nat.strongRec ind m := by
conv => lhs; unfold Nat.strongRec
theorem strongRecOn_eq {motive : Nat → Sort _} (ind : ∀ n, (∀ m, m < n → motive m) → motive n)
(t : Nat) : Nat.strongRecOn t ind = ind t fun m _ => Nat.strongRecOn m ind :=
Nat.strongRec_eq ..
@[simp] theorem recDiagAux_zero_left {motive : Nat → Nat → Sort _}
(zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (n) :
Nat.recDiagAux zero_left zero_right succ_succ 0 n = zero_left n := by cases n <;> rfl
@[simp] theorem recDiagAux_zero_right {motive : Nat → Nat → Sort _}
(zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m)
(h : zero_left 0 = zero_right 0 := by first | assumption | trivial) :
Nat.recDiagAux zero_left zero_right succ_succ m 0 = zero_right m := by cases m; exact h; rfl
theorem recDiagAux_succ_succ {motive : Nat → Nat → Sort _}
(zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m n) :
Nat.recDiagAux zero_left zero_right succ_succ (m+1) (n+1)
= succ_succ m n (Nat.recDiagAux zero_left zero_right succ_succ m n) := rfl
@[simp] theorem recDiag_zero_zero {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0)
(zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) :
Nat.recDiag (motive:=motive) zero_zero zero_succ succ_zero succ_succ 0 0 = zero_zero := rfl
theorem recDiag_zero_succ {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0)
(zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (n) :
Nat.recDiag zero_zero zero_succ succ_zero succ_succ 0 (n+1)
= zero_succ n (Nat.recDiag zero_zero zero_succ succ_zero succ_succ 0 n) := by
simp [Nat.recDiag]; rfl
| .lake/packages/batteries/Batteries/Data/Nat/Lemmas.lean | 81 | 86 | theorem recDiag_succ_zero {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0)
(zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m) :
Nat.recDiag zero_zero zero_succ succ_zero succ_succ (m+1) 0
= succ_zero m (Nat.recDiag zero_zero zero_succ succ_zero succ_succ m 0) := by |
simp [Nat.recDiag]; cases m <;> rfl
| 1 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed
import Mathlib.RingTheory.PowerBasis
#align_import ring_theory.is_adjoin_root from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
open scoped Polynomial
open Polynomial
noncomputable section
universe u v
-- Porting note: this looks like something that should not be here
-- -- This class doesn't really make sense on a predicate
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure IsAdjoinRoot {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S]
(f : R[X]) : Type max u v where
map : R[X] →+* S
map_surjective : Function.Surjective map
ker_map : RingHom.ker map = Ideal.span {f}
algebraMap_eq : algebraMap R S = map.comp Polynomial.C
#align is_adjoin_root IsAdjoinRoot
-- This class doesn't really make sense on a predicate
-- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
structure IsAdjoinRootMonic {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S]
(f : R[X]) extends IsAdjoinRoot S f where
Monic : Monic f
#align is_adjoin_root_monic IsAdjoinRootMonic
section Ring
variable {R : Type u} {S : Type v} [CommRing R] [Ring S] {f : R[X]} [Algebra R S]
namespace IsAdjoinRoot
def root (h : IsAdjoinRoot S f) : S :=
h.map X
#align is_adjoin_root.root IsAdjoinRoot.root
theorem subsingleton (h : IsAdjoinRoot S f) [Subsingleton R] : Subsingleton S :=
h.map_surjective.subsingleton
#align is_adjoin_root.subsingleton IsAdjoinRoot.subsingleton
theorem algebraMap_apply (h : IsAdjoinRoot S f) (x : R) :
algebraMap R S x = h.map (Polynomial.C x) := by rw [h.algebraMap_eq, RingHom.comp_apply]
#align is_adjoin_root.algebra_map_apply IsAdjoinRoot.algebraMap_apply
@[simp]
| Mathlib/RingTheory/IsAdjoinRoot.lean | 132 | 133 | theorem mem_ker_map (h : IsAdjoinRoot S f) {p} : p ∈ RingHom.ker h.map ↔ f ∣ p := by |
rw [h.ker_map, Ideal.mem_span_singleton]
| 1 |
import Mathlib.Init.Algebra.Classes
import Mathlib.Init.Data.Ordering.Basic
#align_import init.data.ordering.lemmas from "leanprover-community/lean"@"4bd314f7bd5e0c9e813fc201f1279a23f13f9f1d"
universe u
namespace Ordering
@[simp]
theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) :
((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by
by_cases c <;> simp [*]
#align ordering.ite_eq_lt_distrib Ordering.ite_eq_lt_distrib
@[simp]
| Mathlib/Init/Data/Ordering/Lemmas.lean | 26 | 28 | theorem ite_eq_eq_distrib (c : Prop) [Decidable c] (a b : Ordering) :
((if c then a else b) = Ordering.eq) = if c then a = Ordering.eq else b = Ordering.eq := by |
by_cases c <;> simp [*]
| 1 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {α : Type u}
class Invertible [Mul α] [One α] (a : α) : Type u where
invOf : α
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"⅟" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul α] [One α] (a : α) {_ : Invertible a} : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul α] [One α] (a : α) [Invertible a] : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul α] [One α] (a : α) {_ : Invertible a} : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul α] [One α] (a : α) [Invertible a] : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid α] (a b : α) [Invertible a] : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid α] (a b : α) [Invertible a] : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * ⅟ b * b = a := by
simp [mul_assoc]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 136 | 137 | theorem mul_invOf_mul_self_cancel [Monoid α] (a b : α) [Invertible b] : a * ⅟ b * b = a := by |
simp [mul_assoc]
| 1 |
import Mathlib.Analysis.NormedSpace.PiLp
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped NNReal Matrix
namespace Matrix
variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n]
section LinfLinf
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n α) :=
Pi.seminormedAddCommGroup
#align matrix.seminormed_add_comm_group Matrix.seminormedAddCommGroup
attribute [local instance] Matrix.seminormedAddCommGroup
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem norm_def (A : Matrix m n α) : ‖A‖ = ‖fun i j => A i j‖ := rfl
lemma norm_eq_sup_sup_nnnorm (A : Matrix m n α) :
‖A‖ = Finset.sup Finset.univ fun i ↦ Finset.sup Finset.univ fun j ↦ ‖A i j‖₊ := by
simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def]
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem nnnorm_def (A : Matrix m n α) : ‖A‖₊ = ‖fun i j => A i j‖₊ := rfl
theorem norm_le_iff {r : ℝ} (hr : 0 ≤ r) {A : Matrix m n α} : ‖A‖ ≤ r ↔ ∀ i j, ‖A i j‖ ≤ r := by
simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr]
#align matrix.norm_le_iff Matrix.norm_le_iff
| Mathlib/Analysis/Matrix.lean | 94 | 95 | theorem nnnorm_le_iff {r : ℝ≥0} {A : Matrix m n α} : ‖A‖₊ ≤ r ↔ ∀ i j, ‖A i j‖₊ ≤ r := by |
simp_rw [nnnorm_def, pi_nnnorm_le_iff]
| 1 |
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Order.Filter.Subsingleton
open Set
variable {α β γ δ : Type*} {l : Filter α} {f : α → β}
namespace Filter
def EventuallyConst (f : α → β) (l : Filter α) : Prop := (map f l).Subsingleton
theorem HasBasis.eventuallyConst_iff {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
(h : l.HasBasis p s) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ x ∈ s i, ∀ y ∈ s i, f x = f y :=
(h.map f).subsingleton_iff.trans <| by simp only [Set.Subsingleton, forall_mem_image]
theorem HasBasis.eventuallyConst_iff' {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
{x : ι → α} (h : l.HasBasis p s) (hx : ∀ i, p i → x i ∈ s i) :
EventuallyConst f l ↔ ∃ i, p i ∧ ∀ y ∈ s i, f y = f (x i) :=
h.eventuallyConst_iff.trans <| exists_congr fun i ↦ and_congr_right fun hi ↦
⟨fun h ↦ (h · · (x i) (hx i hi)), fun h a ha b hb ↦ h a ha ▸ (h b hb).symm⟩
lemma eventuallyConst_iff_tendsto [Nonempty β] :
EventuallyConst f l ↔ ∃ x, Tendsto f l (pure x) :=
subsingleton_iff_exists_le_pure
alias ⟨EventuallyConst.exists_tendsto, _⟩ := eventuallyConst_iff_tendsto
theorem EventuallyConst.of_tendsto {x : β} (h : Tendsto f l (pure x)) : EventuallyConst f l :=
have : Nonempty β := ⟨x⟩; eventuallyConst_iff_tendsto.2 ⟨x, h⟩
theorem eventuallyConst_iff_exists_eventuallyEq [Nonempty β] :
EventuallyConst f l ↔ ∃ c, f =ᶠ[l] fun _ ↦ c :=
subsingleton_iff_exists_singleton_mem
alias ⟨EventuallyConst.eventuallyEq_const, _⟩ := eventuallyConst_iff_exists_eventuallyEq
theorem eventuallyConst_pred' {p : α → Prop} :
EventuallyConst p l ↔ (p =ᶠ[l] fun _ ↦ False) ∨ (p =ᶠ[l] fun _ ↦ True) := by
simp only [eventuallyConst_iff_exists_eventuallyEq, Prop.exists_iff]
| Mathlib/Order/Filter/EventuallyConst.lean | 61 | 63 | theorem eventuallyConst_pred {p : α → Prop} :
EventuallyConst p l ↔ (∀ᶠ x in l, p x) ∨ (∀ᶠ x in l, ¬p x) := by |
simp [eventuallyConst_pred', or_comm, EventuallyEq]
| 1 |
import Mathlib.Algebra.Field.Opposite
import Mathlib.Algebra.Group.Subgroup.ZPowers
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Algebra.Ring.NegOnePow
import Mathlib.Algebra.Order.Archimedean
import Mathlib.GroupTheory.Coset
#align_import algebra.periodic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e"
variable {α β γ : Type*} {f g : α → β} {c c₁ c₂ x : α}
open Set
namespace Function
@[simp]
def Periodic [Add α] (f : α → β) (c : α) : Prop :=
∀ x : α, f (x + c) = f x
#align function.periodic Function.Periodic
protected theorem Periodic.funext [Add α] (h : Periodic f c) : (fun x => f (x + c)) = f :=
funext h
#align function.periodic.funext Function.Periodic.funext
protected theorem Periodic.comp [Add α] (h : Periodic f c) (g : β → γ) : Periodic (g ∘ f) c := by
simp_all
#align function.periodic.comp Function.Periodic.comp
theorem Periodic.comp_addHom [Add α] [Add γ] (h : Periodic f c) (g : AddHom γ α) (g_inv : α → γ)
(hg : RightInverse g_inv g) : Periodic (f ∘ g) (g_inv c) := fun x => by
simp only [hg c, h (g x), map_add, comp_apply]
#align function.periodic.comp_add_hom Function.Periodic.comp_addHom
@[to_additive]
protected theorem Periodic.mul [Add α] [Mul β] (hf : Periodic f c) (hg : Periodic g c) :
Periodic (f * g) c := by simp_all
#align function.periodic.mul Function.Periodic.mul
#align function.periodic.add Function.Periodic.add
@[to_additive]
protected theorem Periodic.div [Add α] [Div β] (hf : Periodic f c) (hg : Periodic g c) :
Periodic (f / g) c := by simp_all
#align function.periodic.div Function.Periodic.div
#align function.periodic.sub Function.Periodic.sub
@[to_additive]
theorem _root_.List.periodic_prod [Add α] [Monoid β] (l : List (α → β))
(hl : ∀ f ∈ l, Periodic f c) : Periodic l.prod c := by
induction' l with g l ih hl
· simp
· rw [List.forall_mem_cons] at hl
simpa only [List.prod_cons] using hl.1.mul (ih hl.2)
#align list.periodic_prod List.periodic_prod
#align list.periodic_sum List.periodic_sum
@[to_additive]
theorem _root_.Multiset.periodic_prod [Add α] [CommMonoid β] (s : Multiset (α → β))
(hs : ∀ f ∈ s, Periodic f c) : Periodic s.prod c :=
(s.prod_toList ▸ s.toList.periodic_prod) fun f hf => hs f <| Multiset.mem_toList.mp hf
#align multiset.periodic_prod Multiset.periodic_prod
#align multiset.periodic_sum Multiset.periodic_sum
@[to_additive]
theorem _root_.Finset.periodic_prod [Add α] [CommMonoid β] {ι : Type*} {f : ι → α → β}
(s : Finset ι) (hs : ∀ i ∈ s, Periodic (f i) c) : Periodic (∏ i ∈ s, f i) c :=
s.prod_to_list f ▸ (s.toList.map f).periodic_prod (by simpa [-Periodic] )
#align finset.periodic_prod Finset.periodic_prod
#align finset.periodic_sum Finset.periodic_sum
@[to_additive]
protected theorem Periodic.smul [Add α] [SMul γ β] (h : Periodic f c) (a : γ) :
Periodic (a • f) c := by simp_all
#align function.periodic.smul Function.Periodic.smul
#align function.periodic.vadd Function.Periodic.vadd
protected theorem Periodic.const_smul [AddMonoid α] [Group γ] [DistribMulAction γ α]
(h : Periodic f c) (a : γ) : Periodic (fun x => f (a • x)) (a⁻¹ • c) := fun x => by
simpa only [smul_add, smul_inv_smul] using h (a • x)
#align function.periodic.const_smul Function.Periodic.const_smul
protected theorem Periodic.const_smul₀ [AddCommMonoid α] [DivisionSemiring γ] [Module γ α]
(h : Periodic f c) (a : γ) : Periodic (fun x => f (a • x)) (a⁻¹ • c) := fun x => by
by_cases ha : a = 0
· simp only [ha, zero_smul]
· simpa only [smul_add, smul_inv_smul₀ ha] using h (a • x)
#align function.periodic.const_smul₀ Function.Periodic.const_smul₀
protected theorem Periodic.const_mul [DivisionSemiring α] (h : Periodic f c) (a : α) :
Periodic (fun x => f (a * x)) (a⁻¹ * c) :=
Periodic.const_smul₀ h a
#align function.periodic.const_mul Function.Periodic.const_mul
theorem Periodic.const_inv_smul [AddMonoid α] [Group γ] [DistribMulAction γ α] (h : Periodic f c)
(a : γ) : Periodic (fun x => f (a⁻¹ • x)) (a • c) := by
simpa only [inv_inv] using h.const_smul a⁻¹
#align function.periodic.const_inv_smul Function.Periodic.const_inv_smul
| Mathlib/Algebra/Periodic.lean | 128 | 130 | theorem Periodic.const_inv_smul₀ [AddCommMonoid α] [DivisionSemiring γ] [Module γ α]
(h : Periodic f c) (a : γ) : Periodic (fun x => f (a⁻¹ • x)) (a • c) := by |
simpa only [inv_inv] using h.const_smul₀ a⁻¹
| 1 |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.GroupWithZero.Units.Equiv
import Mathlib.Algebra.Order.Field.Defs
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Order.Bounds.OrderIso
import Mathlib.Tactic.Positivity.Core
#align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd"
open Function OrderDual
variable {ι α β : Type*}
section
variable [LinearOrderedField α] {a b c d : α} {n : ℤ}
theorem div_pos_iff : 0 < a / b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0 := by
simp only [division_def, mul_pos_iff, inv_pos, inv_lt_zero]
#align div_pos_iff div_pos_iff
theorem div_neg_iff : a / b < 0 ↔ 0 < a ∧ b < 0 ∨ a < 0 ∧ 0 < b := by
simp [division_def, mul_neg_iff]
#align div_neg_iff div_neg_iff
theorem div_nonneg_iff : 0 ≤ a / b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 := by
simp [division_def, mul_nonneg_iff]
#align div_nonneg_iff div_nonneg_iff
theorem div_nonpos_iff : a / b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b := by
simp [division_def, mul_nonpos_iff]
#align div_nonpos_iff div_nonpos_iff
theorem div_nonneg_of_nonpos (ha : a ≤ 0) (hb : b ≤ 0) : 0 ≤ a / b :=
div_nonneg_iff.2 <| Or.inr ⟨ha, hb⟩
#align div_nonneg_of_nonpos div_nonneg_of_nonpos
theorem div_pos_of_neg_of_neg (ha : a < 0) (hb : b < 0) : 0 < a / b :=
div_pos_iff.2 <| Or.inr ⟨ha, hb⟩
#align div_pos_of_neg_of_neg div_pos_of_neg_of_neg
theorem div_neg_of_neg_of_pos (ha : a < 0) (hb : 0 < b) : a / b < 0 :=
div_neg_iff.2 <| Or.inr ⟨ha, hb⟩
#align div_neg_of_neg_of_pos div_neg_of_neg_of_pos
theorem div_neg_of_pos_of_neg (ha : 0 < a) (hb : b < 0) : a / b < 0 :=
div_neg_iff.2 <| Or.inl ⟨ha, hb⟩
#align div_neg_of_pos_of_neg div_neg_of_pos_of_neg
theorem div_le_iff_of_neg (hc : c < 0) : b / c ≤ a ↔ a * c ≤ b :=
⟨fun h => div_mul_cancel₀ b (ne_of_lt hc) ▸ mul_le_mul_of_nonpos_right h hc.le, fun h =>
calc
a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc)
_ ≥ b * (1 / c) := mul_le_mul_of_nonpos_right h (one_div_neg.2 hc).le
_ = b / c := (div_eq_mul_one_div b c).symm
⟩
#align div_le_iff_of_neg div_le_iff_of_neg
| Mathlib/Algebra/Order/Field/Basic.lean | 674 | 675 | theorem div_le_iff_of_neg' (hc : c < 0) : b / c ≤ a ↔ c * a ≤ b := by |
rw [mul_comm, div_le_iff_of_neg hc]
| 1 |
import Mathlib.Data.Nat.Bitwise
import Mathlib.SetTheory.Game.Birthday
import Mathlib.SetTheory.Game.Impartial
#align_import set_theory.game.nim from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
noncomputable section
universe u
namespace SetTheory
open scoped PGame
namespace PGame
-- Uses `noncomputable!` to avoid `rec_fn_macro only allowed in meta definitions` VM error
noncomputable def nim : Ordinal.{u} → PGame.{u}
| o₁ =>
let f o₂ :=
have _ : Ordinal.typein o₁.out.r o₂ < o₁ := Ordinal.typein_lt_self o₂
nim (Ordinal.typein o₁.out.r o₂)
⟨o₁.out.α, o₁.out.α, f, f⟩
termination_by o => o
#align pgame.nim SetTheory.PGame.nim
open Ordinal
theorem nim_def (o : Ordinal) :
have : IsWellOrder (Quotient.out o).α (· < ·) := inferInstance
nim o =
PGame.mk o.out.α o.out.α (fun o₂ => nim (Ordinal.typein (· < ·) o₂)) fun o₂ =>
nim (Ordinal.typein (· < ·) o₂) := by
rw [nim]; rfl
#align pgame.nim_def SetTheory.PGame.nim_def
theorem leftMoves_nim (o : Ordinal) : (nim o).LeftMoves = o.out.α := by rw [nim_def]; rfl
#align pgame.left_moves_nim SetTheory.PGame.leftMoves_nim
| Mathlib/SetTheory/Game/Nim.lean | 70 | 70 | theorem rightMoves_nim (o : Ordinal) : (nim o).RightMoves = o.out.α := by | rw [nim_def]; rfl
| 1 |
import Batteries.Tactic.SeqFocus
namespace Ordering
@[simp] theorem swap_swap {o : Ordering} : o.swap.swap = o := by cases o <;> rfl
@[simp] theorem swap_inj {o₁ o₂ : Ordering} : o₁.swap = o₂.swap ↔ o₁ = o₂ :=
⟨fun h => by simpa using congrArg swap h, congrArg _⟩
theorem swap_then (o₁ o₂ : Ordering) : (o₁.then o₂).swap = o₁.swap.then o₂.swap := by
cases o₁ <;> rfl
theorem then_eq_lt {o₁ o₂ : Ordering} : o₁.then o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
cases o₁ <;> cases o₂ <;> decide
theorem then_eq_eq {o₁ o₂ : Ordering} : o₁.then o₂ = eq ↔ o₁ = eq ∧ o₂ = eq := by
cases o₁ <;> simp [«then»]
| .lake/packages/batteries/Batteries/Classes/Order.lean | 26 | 27 | theorem then_eq_gt {o₁ o₂ : Ordering} : o₁.then o₂ = gt ↔ o₁ = gt ∨ o₁ = eq ∧ o₂ = gt := by |
cases o₁ <;> cases o₂ <;> decide
| 1 |
import Mathlib.Data.Multiset.Nodup
import Mathlib.Data.List.NatAntidiagonal
#align_import data.multiset.nat_antidiagonal from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace Multiset
namespace Nat
def antidiagonal (n : ℕ) : Multiset (ℕ × ℕ) :=
List.Nat.antidiagonal n
#align multiset.nat.antidiagonal Multiset.Nat.antidiagonal
@[simp]
theorem mem_antidiagonal {n : ℕ} {x : ℕ × ℕ} : x ∈ antidiagonal n ↔ x.1 + x.2 = n := by
rw [antidiagonal, mem_coe, List.Nat.mem_antidiagonal]
#align multiset.nat.mem_antidiagonal Multiset.Nat.mem_antidiagonal
@[simp]
theorem card_antidiagonal (n : ℕ) : card (antidiagonal n) = n + 1 := by
rw [antidiagonal, coe_card, List.Nat.length_antidiagonal]
#align multiset.nat.card_antidiagonal Multiset.Nat.card_antidiagonal
@[simp]
theorem antidiagonal_zero : antidiagonal 0 = {(0, 0)} :=
rfl
#align multiset.nat.antidiagonal_zero Multiset.Nat.antidiagonal_zero
@[simp]
theorem nodup_antidiagonal (n : ℕ) : Nodup (antidiagonal n) :=
coe_nodup.2 <| List.Nat.nodup_antidiagonal n
#align multiset.nat.nodup_antidiagonal Multiset.Nat.nodup_antidiagonal
@[simp]
| Mathlib/Data/Multiset/NatAntidiagonal.lean | 59 | 61 | theorem antidiagonal_succ {n : ℕ} :
antidiagonal (n + 1) = (0, n + 1) ::ₘ (antidiagonal n).map (Prod.map Nat.succ id) := by |
simp only [antidiagonal, List.Nat.antidiagonal_succ, map_coe, cons_coe]
| 1 |
import Mathlib.Analysis.Calculus.Deriv.Slope
import Mathlib.Analysis.Calculus.Deriv.Inv
#align_import analysis.calculus.dslope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open scoped Classical Topology Filter
open Function Set Filter
variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
noncomputable def dslope (f : 𝕜 → E) (a : 𝕜) : 𝕜 → E :=
update (slope f a) a (deriv f a)
#align dslope dslope
@[simp]
theorem dslope_same (f : 𝕜 → E) (a : 𝕜) : dslope f a a = deriv f a :=
update_same _ _ _
#align dslope_same dslope_same
variable {f : 𝕜 → E} {a b : 𝕜} {s : Set 𝕜}
theorem dslope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a b = slope f a b :=
update_noteq h _ _
#align dslope_of_ne dslope_of_ne
theorem ContinuousLinearMap.dslope_comp {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
(f : E →L[𝕜] F) (g : 𝕜 → E) (a b : 𝕜) (H : a = b → DifferentiableAt 𝕜 g a) :
dslope (f ∘ g) a b = f (dslope g a b) := by
rcases eq_or_ne b a with (rfl | hne)
· simp only [dslope_same]
exact (f.hasFDerivAt.comp_hasDerivAt b (H rfl).hasDerivAt).deriv
· simpa only [dslope_of_ne _ hne] using f.toLinearMap.slope_comp g a b
#align continuous_linear_map.dslope_comp ContinuousLinearMap.dslope_comp
theorem eqOn_dslope_slope (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope f a) (slope f a) {a}ᶜ := fun _ =>
dslope_of_ne f
#align eq_on_dslope_slope eqOn_dslope_slope
theorem dslope_eventuallyEq_slope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a =ᶠ[𝓝 b] slope f a :=
(eqOn_dslope_slope f a).eventuallyEq_of_mem (isOpen_ne.mem_nhds h)
#align dslope_eventually_eq_slope_of_ne dslope_eventuallyEq_slope_of_ne
theorem dslope_eventuallyEq_slope_punctured_nhds (f : 𝕜 → E) : dslope f a =ᶠ[𝓝[≠] a] slope f a :=
(eqOn_dslope_slope f a).eventuallyEq_of_mem self_mem_nhdsWithin
#align dslope_eventually_eq_slope_punctured_nhds dslope_eventuallyEq_slope_punctured_nhds
@[simp]
theorem sub_smul_dslope (f : 𝕜 → E) (a b : 𝕜) : (b - a) • dslope f a b = f b - f a := by
rcases eq_or_ne b a with (rfl | hne) <;> simp [dslope_of_ne, *]
#align sub_smul_dslope sub_smul_dslope
theorem dslope_sub_smul_of_ne (f : 𝕜 → E) (h : b ≠ a) :
dslope (fun x => (x - a) • f x) a b = f b := by
rw [dslope_of_ne _ h, slope_sub_smul _ h.symm]
#align dslope_sub_smul_of_ne dslope_sub_smul_of_ne
theorem eqOn_dslope_sub_smul (f : 𝕜 → E) (a : 𝕜) :
EqOn (dslope (fun x => (x - a) • f x) a) f {a}ᶜ := fun _ => dslope_sub_smul_of_ne f
#align eq_on_dslope_sub_smul eqOn_dslope_sub_smul
theorem dslope_sub_smul [DecidableEq 𝕜] (f : 𝕜 → E) (a : 𝕜) :
dslope (fun x => (x - a) • f x) a = update f a (deriv (fun x => (x - a) • f x) a) :=
eq_update_iff.2 ⟨dslope_same _ _, eqOn_dslope_sub_smul f a⟩
#align dslope_sub_smul dslope_sub_smul
@[simp]
theorem continuousAt_dslope_same : ContinuousAt (dslope f a) a ↔ DifferentiableAt 𝕜 f a := by
simp only [dslope, continuousAt_update_same, ← hasDerivAt_deriv_iff, hasDerivAt_iff_tendsto_slope]
#align continuous_at_dslope_same continuousAt_dslope_same
theorem ContinuousWithinAt.of_dslope (h : ContinuousWithinAt (dslope f a) s b) :
ContinuousWithinAt f s b := by
have : ContinuousWithinAt (fun x => (x - a) • dslope f a x + f a) s b :=
((continuousWithinAt_id.sub continuousWithinAt_const).smul h).add continuousWithinAt_const
simpa only [sub_smul_dslope, sub_add_cancel] using this
#align continuous_within_at.of_dslope ContinuousWithinAt.of_dslope
theorem ContinuousAt.of_dslope (h : ContinuousAt (dslope f a) b) : ContinuousAt f b :=
(continuousWithinAt_univ _ _).1 h.continuousWithinAt.of_dslope
#align continuous_at.of_dslope ContinuousAt.of_dslope
theorem ContinuousOn.of_dslope (h : ContinuousOn (dslope f a) s) : ContinuousOn f s := fun x hx =>
(h x hx).of_dslope
#align continuous_on.of_dslope ContinuousOn.of_dslope
theorem continuousWithinAt_dslope_of_ne (h : b ≠ a) :
ContinuousWithinAt (dslope f a) s b ↔ ContinuousWithinAt f s b := by
refine ⟨ContinuousWithinAt.of_dslope, fun hc => ?_⟩
simp only [dslope, continuousWithinAt_update_of_ne h]
exact ((continuousWithinAt_id.sub continuousWithinAt_const).inv₀ (sub_ne_zero.2 h)).smul
(hc.sub continuousWithinAt_const)
#align continuous_within_at_dslope_of_ne continuousWithinAt_dslope_of_ne
| Mathlib/Analysis/Calculus/Dslope.lean | 114 | 115 | theorem continuousAt_dslope_of_ne (h : b ≠ a) : ContinuousAt (dslope f a) b ↔ ContinuousAt f b := by |
simp only [← continuousWithinAt_univ, continuousWithinAt_dslope_of_ne h]
| 1 |
import Mathlib.Data.Setoid.Partition
import Mathlib.GroupTheory.GroupAction.Basic
import Mathlib.GroupTheory.GroupAction.Pointwise
import Mathlib.GroupTheory.GroupAction.SubMulAction
open scoped BigOperators Pointwise
namespace MulAction
section SMul
variable (G : Type*) {X : Type*} [SMul G X]
-- Change terminology : is_fully_invariant ?
def IsFixedBlock (B : Set X) := ∀ g : G, g • B = B
def IsInvariantBlock (B : Set X) := ∀ g : G, g • B ⊆ B
def IsTrivialBlock (B : Set X) := B.Subsingleton ∨ B = ⊤
def IsBlock (B : Set X) := (Set.range fun g : G => g • B).PairwiseDisjoint id
variable {G}
theorem IsBlock.def {B : Set X} :
IsBlock G B ↔ ∀ g g' : G, g • B = g' • B ∨ Disjoint (g • B) (g' • B) := by
apply Set.pairwiseDisjoint_range_iff
theorem IsBlock.mk_notempty {B : Set X} :
IsBlock G B ↔ ∀ g g' : G, g • B ∩ g' • B ≠ ∅ → g • B = g' • B := by
simp_rw [IsBlock.def, or_iff_not_imp_right, Set.disjoint_iff_inter_eq_empty]
theorem IsFixedBlock.isBlock {B : Set X} (hfB : IsFixedBlock G B) :
IsBlock G B := by
simp [IsBlock.def, hfB _]
variable (X)
theorem isBlock_empty : IsBlock G (⊥ : Set X) := by
simp [IsBlock.def, Set.bot_eq_empty, Set.smul_set_empty]
variable {X}
| Mathlib/GroupTheory/GroupAction/Blocks.lean | 107 | 108 | theorem isBlock_singleton (a : X) : IsBlock G ({a} : Set X) := by |
simp [IsBlock.def, Classical.or_iff_not_imp_left]
| 1 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.HasseDeriv
#align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace Polynomial
open Polynomial
variable {R : Type*} [Semiring R] (r : R) (f : R[X])
def taylor (r : R) : R[X] →ₗ[R] R[X] where
toFun f := f.comp (X + C r)
map_add' f g := add_comp
map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply]
#align polynomial.taylor Polynomial.taylor
theorem taylor_apply : taylor r f = f.comp (X + C r) :=
rfl
#align polynomial.taylor_apply Polynomial.taylor_apply
@[simp]
theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_X Polynomial.taylor_X
@[simp]
theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_C Polynomial.taylor_C
@[simp]
theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by
ext
simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp,
Function.comp_apply, LinearMap.coe_comp]
#align polynomial.taylor_zero' Polynomial.taylor_zero'
theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply]
#align polynomial.taylor_zero Polynomial.taylor_zero
@[simp]
theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [← C_1, taylor_C]
#align polynomial.taylor_one Polynomial.taylor_one
@[simp]
| Mathlib/Algebra/Polynomial/Taylor.lean | 70 | 71 | theorem taylor_monomial (i : ℕ) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by |
simp [taylor_apply]
| 1 |
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 WittVector
private def ghostFun : 𝕎 R → ℕ → R := fun x n => aeval x.coeff (W_ ℤ n)
section GhostFun
variable (x y : WittVector p R)
-- The following lemmas are not `@[simp]` because they will be bundled in `ghostMap` later on.
@[local simp]
| Mathlib/RingTheory/WittVector/Basic.lean | 183 | 185 | theorem matrix_vecEmpty_coeff {R} (i j) :
@coeff p R (Matrix.vecEmpty i) j = (Matrix.vecEmpty i : ℕ → R) j := by |
rcases i with ⟨_ | _ | _ | _ | i_val, ⟨⟩⟩
| 1 |
import Mathlib.Analysis.BoxIntegral.Box.Basic
import Mathlib.Analysis.SpecificLimits.Basic
#align_import analysis.box_integral.box.subbox_induction from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Finset Function Filter Metric Classical Topology Filter ENNReal
noncomputable section
namespace BoxIntegral
namespace Box
variable {ι : Type*} {I J : Box ι}
def splitCenterBox (I : Box ι) (s : Set ι) : Box ι where
lower := s.piecewise (fun i ↦ (I.lower i + I.upper i) / 2) I.lower
upper := s.piecewise I.upper fun i ↦ (I.lower i + I.upper i) / 2
lower_lt_upper i := by
dsimp only [Set.piecewise]
split_ifs <;> simp only [left_lt_add_div_two, add_div_two_lt_right, I.lower_lt_upper]
#align box_integral.box.split_center_box BoxIntegral.Box.splitCenterBox
theorem mem_splitCenterBox {s : Set ι} {y : ι → ℝ} :
y ∈ I.splitCenterBox s ↔ y ∈ I ∧ ∀ i, (I.lower i + I.upper i) / 2 < y i ↔ i ∈ s := by
simp only [splitCenterBox, mem_def, ← forall_and]
refine forall_congr' fun i ↦ ?_
dsimp only [Set.piecewise]
split_ifs with hs <;> simp only [hs, iff_true_iff, iff_false_iff, not_lt]
exacts [⟨fun H ↦ ⟨⟨(left_lt_add_div_two.2 (I.lower_lt_upper i)).trans H.1, H.2⟩, H.1⟩,
fun H ↦ ⟨H.2, H.1.2⟩⟩,
⟨fun H ↦ ⟨⟨H.1, H.2.trans (add_div_two_lt_right.2 (I.lower_lt_upper i)).le⟩, H.2⟩,
fun H ↦ ⟨H.1.1, H.2⟩⟩]
#align box_integral.box.mem_split_center_box BoxIntegral.Box.mem_splitCenterBox
theorem splitCenterBox_le (I : Box ι) (s : Set ι) : I.splitCenterBox s ≤ I :=
fun _ hx ↦ (mem_splitCenterBox.1 hx).1
#align box_integral.box.split_center_box_le BoxIntegral.Box.splitCenterBox_le
theorem disjoint_splitCenterBox (I : Box ι) {s t : Set ι} (h : s ≠ t) :
Disjoint (I.splitCenterBox s : Set (ι → ℝ)) (I.splitCenterBox t) := by
rw [disjoint_iff_inf_le]
rintro y ⟨hs, ht⟩; apply h
ext i
rw [mem_coe, mem_splitCenterBox] at hs ht
rw [← hs.2, ← ht.2]
#align box_integral.box.disjoint_split_center_box BoxIntegral.Box.disjoint_splitCenterBox
theorem injective_splitCenterBox (I : Box ι) : Injective I.splitCenterBox := fun _ _ H ↦
by_contra fun Hne ↦ (I.disjoint_splitCenterBox Hne).ne (nonempty_coe _).ne_empty (H ▸ rfl)
#align box_integral.box.injective_split_center_box BoxIntegral.Box.injective_splitCenterBox
@[simp]
theorem exists_mem_splitCenterBox {I : Box ι} {x : ι → ℝ} : (∃ s, x ∈ I.splitCenterBox s) ↔ x ∈ I :=
⟨fun ⟨s, hs⟩ ↦ I.splitCenterBox_le s hs, fun hx ↦
⟨{ i | (I.lower i + I.upper i) / 2 < x i }, mem_splitCenterBox.2 ⟨hx, fun _ ↦ Iff.rfl⟩⟩⟩
#align box_integral.box.exists_mem_split_center_box BoxIntegral.Box.exists_mem_splitCenterBox
@[simps]
def splitCenterBoxEmb (I : Box ι) : Set ι ↪ Box ι :=
⟨splitCenterBox I, injective_splitCenterBox I⟩
#align box_integral.box.split_center_box_emb BoxIntegral.Box.splitCenterBoxEmb
@[simp]
theorem iUnion_coe_splitCenterBox (I : Box ι) : ⋃ s, (I.splitCenterBox s : Set (ι → ℝ)) = I := by
ext x
simp
#align box_integral.box.Union_coe_split_center_box BoxIntegral.Box.iUnion_coe_splitCenterBox
@[simp]
| Mathlib/Analysis/BoxIntegral/Box/SubboxInduction.lean | 101 | 103 | theorem upper_sub_lower_splitCenterBox (I : Box ι) (s : Set ι) (i : ι) :
(I.splitCenterBox s).upper i - (I.splitCenterBox s).lower i = (I.upper i - I.lower i) / 2 := by |
by_cases i ∈ s <;> field_simp [splitCenterBox] <;> field_simp [mul_two, two_mul]
| 1 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Order.WithBot
#align_import data.set.image from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29"
universe u v
open Function Set
namespace Set
variable {α β γ : Type*} {ι ι' : Sort*}
theorem powerset_insert (s : Set α) (a : α) : 𝒫 insert a s = 𝒫 s ∪ insert a '' 𝒫 s := by
ext t
simp_rw [mem_union, mem_image, mem_powerset_iff]
constructor
· intro h
by_cases hs : a ∈ t
· right
refine ⟨t \ {a}, ?_, ?_⟩
· rw [diff_singleton_subset_iff]
assumption
· rw [insert_diff_singleton, insert_eq_of_mem hs]
· left
exact (subset_insert_iff_of_not_mem hs).mp h
· rintro (h | ⟨s', h₁, rfl⟩)
· exact subset_trans h (subset_insert a s)
· exact insert_subset_insert h₁
#align set.powerset_insert Set.powerset_insert
section Range
variable {f : ι → α} {s t : Set α}
theorem forall_mem_range {p : α → Prop} : (∀ a ∈ range f, p a) ↔ ∀ i, p (f i) := by simp
#align set.forall_range_iff Set.forall_mem_range
@[deprecated (since := "2024-02-21")] alias forall_range_iff := forall_mem_range
theorem forall_subtype_range_iff {p : range f → Prop} :
(∀ a : range f, p a) ↔ ∀ i, p ⟨f i, mem_range_self _⟩ :=
⟨fun H i => H _, fun H ⟨y, i, hi⟩ => by
subst hi
apply H⟩
#align set.forall_subtype_range_iff Set.forall_subtype_range_iff
| Mathlib/Data/Set/Image.lean | 666 | 666 | theorem exists_range_iff {p : α → Prop} : (∃ a ∈ range f, p a) ↔ ∃ i, p (f i) := by | simp
| 1 |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Regular.Basic
#align_import algebra.regular.pow from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb"
variable {R : Type*} {a b : R}
section Monoid
variable [Monoid R]
| Mathlib/Algebra/Regular/Pow.lean | 31 | 32 | theorem IsLeftRegular.pow (n : ℕ) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n) := by |
simp only [IsLeftRegular, ← mul_left_iterate, rla.iterate n]
| 1 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {α : Type u}
class Invertible [Mul α] [One α] (a : α) : Type u where
invOf : α
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"⅟" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul α] [One α] (a : α) {_ : Invertible a} : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul α] [One α] (a : α) [Invertible a] : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul α] [One α] (a : α) {_ : Invertible a} : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul α] [One α] (a : α) [Invertible a] : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid α] (a b : α) [Invertible a] : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 128 | 129 | theorem mul_invOf_self_assoc [Monoid α] (a b : α) [Invertible a] : a * (⅟ a * b) = b := by |
rw [← mul_assoc, mul_invOf_self, one_mul]
| 1 |
import Mathlib.Algebra.Group.Prod
import Mathlib.Algebra.Group.Units.Equiv
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Logic.Equiv.Set
import Mathlib.Tactic.Common
#align_import group_theory.perm.basic from "leanprover-community/mathlib"@"b86832321b586c6ac23ef8cdef6a7a27e42b13bd"
universe u v
namespace Equiv
variable {α : Type u} {β : Type v}
namespace Perm
instance instOne : One (Perm α) where one := Equiv.refl _
instance instMul : Mul (Perm α) where mul f g := Equiv.trans g f
instance instInv : Inv (Perm α) where inv := Equiv.symm
instance instPowNat : Pow (Perm α) ℕ where
pow f n := ⟨f^[n], f.symm^[n], f.left_inv.iterate _, f.right_inv.iterate _⟩
instance permGroup : Group (Perm α) where
mul_assoc f g h := (trans_assoc _ _ _).symm
one_mul := trans_refl
mul_one := refl_trans
mul_left_inv := self_trans_symm
npow n f := f ^ n
npow_succ n f := coe_fn_injective $ Function.iterate_succ _ _
zpow := zpowRec fun n f ↦ f ^ n
zpow_succ' n f := coe_fn_injective $ Function.iterate_succ _ _
#align equiv.perm.perm_group Equiv.Perm.permGroup
@[simp]
theorem default_eq : (default : Perm α) = 1 :=
rfl
#align equiv.perm.default_eq Equiv.Perm.default_eq
@[simps]
def equivUnitsEnd : Perm α ≃* Units (Function.End α) where
-- Porting note: needed to add `.toFun`.
toFun e := ⟨e.toFun, e.symm.toFun, e.self_comp_symm, e.symm_comp_self⟩
invFun u :=
⟨(u : Function.End α), (↑u⁻¹ : Function.End α), congr_fun u.inv_val, congr_fun u.val_inv⟩
left_inv _ := ext fun _ => rfl
right_inv _ := Units.ext rfl
map_mul' _ _ := rfl
#align equiv.perm.equiv_units_End Equiv.Perm.equivUnitsEnd
#align equiv.perm.equiv_units_End_symm_apply_apply Equiv.Perm.equivUnitsEnd_symm_apply_apply
#align equiv.perm.equiv_units_End_symm_apply_symm_apply Equiv.Perm.equivUnitsEnd_symm_apply_symm_apply
@[simps!]
def _root_.MonoidHom.toHomPerm {G : Type*} [Group G] (f : G →* Function.End α) : G →* Perm α :=
equivUnitsEnd.symm.toMonoidHom.comp f.toHomUnits
#align monoid_hom.to_hom_perm MonoidHom.toHomPerm
#align monoid_hom.to_hom_perm_apply_symm_apply MonoidHom.toHomPerm_apply_symm_apply
#align monoid_hom.to_hom_perm_apply_apply MonoidHom.toHomPerm_apply_apply
theorem mul_apply (f g : Perm α) (x) : (f * g) x = f (g x) :=
Equiv.trans_apply _ _ _
#align equiv.perm.mul_apply Equiv.Perm.mul_apply
theorem one_apply (x) : (1 : Perm α) x = x :=
rfl
#align equiv.perm.one_apply Equiv.Perm.one_apply
@[simp]
theorem inv_apply_self (f : Perm α) (x) : f⁻¹ (f x) = x :=
f.symm_apply_apply x
#align equiv.perm.inv_apply_self Equiv.Perm.inv_apply_self
@[simp]
theorem apply_inv_self (f : Perm α) (x) : f (f⁻¹ x) = x :=
f.apply_symm_apply x
#align equiv.perm.apply_inv_self Equiv.Perm.apply_inv_self
theorem one_def : (1 : Perm α) = Equiv.refl α :=
rfl
#align equiv.perm.one_def Equiv.Perm.one_def
theorem mul_def (f g : Perm α) : f * g = g.trans f :=
rfl
#align equiv.perm.mul_def Equiv.Perm.mul_def
theorem inv_def (f : Perm α) : f⁻¹ = f.symm :=
rfl
#align equiv.perm.inv_def Equiv.Perm.inv_def
@[simp, norm_cast] lemma coe_one : ⇑(1 : Perm α) = id := rfl
#align equiv.perm.coe_one Equiv.Perm.coe_one
@[simp, norm_cast] lemma coe_mul (f g : Perm α) : ⇑(f * g) = f ∘ g := rfl
#align equiv.perm.coe_mul Equiv.Perm.coe_mul
@[norm_cast] lemma coe_pow (f : Perm α) (n : ℕ) : ⇑(f ^ n) = f^[n] := rfl
#align equiv.perm.coe_pow Equiv.Perm.coe_pow
@[simp] lemma iterate_eq_pow (f : Perm α) (n : ℕ) : f^[n] = ⇑(f ^ n) := rfl
#align equiv.perm.iterate_eq_pow Equiv.Perm.iterate_eq_pow
theorem eq_inv_iff_eq {f : Perm α} {x y : α} : x = f⁻¹ y ↔ f x = y :=
f.eq_symm_apply
#align equiv.perm.eq_inv_iff_eq Equiv.Perm.eq_inv_iff_eq
theorem inv_eq_iff_eq {f : Perm α} {x y : α} : f⁻¹ x = y ↔ x = f y :=
f.symm_apply_eq
#align equiv.perm.inv_eq_iff_eq Equiv.Perm.inv_eq_iff_eq
| Mathlib/GroupTheory/Perm/Basic.lean | 125 | 127 | theorem zpow_apply_comm {α : Type*} (σ : Perm α) (m n : ℤ) {x : α} :
(σ ^ m) ((σ ^ n) x) = (σ ^ n) ((σ ^ m) x) := by |
rw [← Equiv.Perm.mul_apply, ← Equiv.Perm.mul_apply, zpow_mul_comm]
| 1 |
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
theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : ∀ {n}, (n ≠ 0) → shiftLeft' true m n ≠ 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n ≠ 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n ≠ 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n ≠ 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h ⊢
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h ⊢
cases b; · exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
| Mathlib/Data/Nat/Size.lean | 103 | 104 | theorem size_shiftLeft {m} (h : m ≠ 0) (n) : size (m <<< n) = size m + n := by |
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false]
| 1 |
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
theorem degrees_def [DecidableEq σ] (p : MvPolynomial σ R) :
p.degrees = p.support.sup fun s : σ →₀ ℕ => Finsupp.toMultiset s := by rw [degrees]; convert rfl
#align mv_polynomial.degrees_def MvPolynomial.degrees_def
theorem degrees_monomial (s : σ →₀ ℕ) (a : R) : degrees (monomial s a) ≤ toMultiset s := by
classical
refine (supDegree_single s a).trans_le ?_
split_ifs
exacts [bot_le, le_rfl]
#align mv_polynomial.degrees_monomial MvPolynomial.degrees_monomial
theorem degrees_monomial_eq (s : σ →₀ ℕ) (a : R) (ha : a ≠ 0) :
degrees (monomial s a) = toMultiset s := by
classical
exact (supDegree_single s a).trans (if_neg ha)
#align mv_polynomial.degrees_monomial_eq MvPolynomial.degrees_monomial_eq
theorem degrees_C (a : R) : degrees (C a : MvPolynomial σ R) = 0 :=
Multiset.le_zero.1 <| degrees_monomial _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.degrees_C MvPolynomial.degrees_C
theorem degrees_X' (n : σ) : degrees (X n : MvPolynomial σ R) ≤ {n} :=
le_trans (degrees_monomial _ _) <| le_of_eq <| toMultiset_single _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.degrees_X' MvPolynomial.degrees_X'
@[simp]
theorem degrees_X [Nontrivial R] (n : σ) : degrees (X n : MvPolynomial σ R) = {n} :=
(degrees_monomial_eq _ (1 : R) one_ne_zero).trans (toMultiset_single _ _)
set_option linter.uppercaseLean3 false in
#align mv_polynomial.degrees_X MvPolynomial.degrees_X
@[simp]
theorem degrees_zero : degrees (0 : MvPolynomial σ R) = 0 := by
rw [← C_0]
exact degrees_C 0
#align mv_polynomial.degrees_zero MvPolynomial.degrees_zero
@[simp]
theorem degrees_one : degrees (1 : MvPolynomial σ R) = 0 :=
degrees_C 1
#align mv_polynomial.degrees_one MvPolynomial.degrees_one
| Mathlib/Algebra/MvPolynomial/Degrees.lean | 128 | 130 | theorem degrees_add [DecidableEq σ] (p q : MvPolynomial σ R) :
(p + q).degrees ≤ p.degrees ⊔ q.degrees := by |
simp_rw [degrees_def]; exact supDegree_add_le
| 1 |
import Mathlib.Topology.Category.LightProfinite.Basic
import Mathlib.Topology.Category.Profinite.Limits
namespace LightProfinite
universe u w
attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike
open CategoryTheory Limits
section Pullbacks
variable {X Y B : LightProfinite.{u}} (f : X ⟶ B) (g : Y ⟶ B)
def pullback : LightProfinite.{u} :=
letI set := { xy : X × Y | f xy.fst = g xy.snd }
haveI : CompactSpace set := isCompact_iff_compactSpace.mp
(isClosed_eq (f.continuous.comp continuous_fst) (g.continuous.comp continuous_snd)).isCompact
LightProfinite.of set
def pullback.fst : pullback f g ⟶ X where
toFun := fun ⟨⟨x, _⟩, _⟩ ↦ x
continuous_toFun := Continuous.comp continuous_fst continuous_subtype_val
def pullback.snd : pullback f g ⟶ Y where
toFun := fun ⟨⟨_, y⟩, _⟩ ↦ y
continuous_toFun := Continuous.comp continuous_snd continuous_subtype_val
@[reassoc]
lemma pullback.condition : pullback.fst f g ≫ f = pullback.snd f g ≫ g := by
ext ⟨_, h⟩
exact h
def pullback.lift {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
Z ⟶ pullback f g where
toFun := fun z ↦ ⟨⟨a z, b z⟩, by apply_fun (· z) at w; exact w⟩
continuous_toFun := by
apply Continuous.subtype_mk
rw [continuous_prod_mk]
exact ⟨a.continuous, b.continuous⟩
@[reassoc (attr := simp)]
lemma pullback.lift_fst {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
pullback.lift f g a b w ≫ pullback.fst f g = a := rfl
@[reassoc (attr := simp)]
lemma pullback.lift_snd {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
pullback.lift f g a b w ≫ pullback.snd f g = b := rfl
lemma pullback.hom_ext {Z : LightProfinite.{u}} (a b : Z ⟶ pullback f g)
(hfst : a ≫ pullback.fst f g = b ≫ pullback.fst f g)
(hsnd : a ≫ pullback.snd f g = b ≫ pullback.snd f g) : a = b := by
ext z
apply_fun (· z) at hfst hsnd
apply Subtype.ext
apply Prod.ext
· exact hfst
· exact hsnd
@[simps! pt π]
def pullback.cone : Limits.PullbackCone f g :=
Limits.PullbackCone.mk (pullback.fst f g) (pullback.snd f g) (pullback.condition f g)
@[simps! lift]
def pullback.isLimit : Limits.IsLimit (pullback.cone f g) :=
Limits.PullbackCone.isLimitAux _
(fun s ↦ pullback.lift f g s.fst s.snd s.condition)
(fun _ ↦ pullback.lift_fst _ _ _ _ _)
(fun _ ↦ pullback.lift_snd _ _ _ _ _)
(fun _ _ hm ↦ pullback.hom_ext _ _ _ _ (hm .left) (hm .right))
section FiniteCoproducts
variable {α : Type w} [Finite α] (X : α → LightProfinite.{max u w})
def finiteCoproduct : LightProfinite := LightProfinite.of <| Σ (a : α), X a
def finiteCoproduct.ι (a : α) : X a ⟶ finiteCoproduct X where
toFun := (⟨a, ·⟩)
continuous_toFun := continuous_sigmaMk (σ := fun a ↦ X a)
def finiteCoproduct.desc {B : LightProfinite.{max u w}} (e : (a : α) → (X a ⟶ B)) :
finiteCoproduct X ⟶ B where
toFun := fun ⟨a, x⟩ ↦ e a x
continuous_toFun := by
apply continuous_sigma
intro a
exact (e a).continuous
@[reassoc (attr := simp)]
lemma finiteCoproduct.ι_desc {B : LightProfinite.{max u w}} (e : (a : α) → (X a ⟶ B)) (a : α) :
finiteCoproduct.ι X a ≫ finiteCoproduct.desc X e = e a := rfl
lemma finiteCoproduct.hom_ext {B : LightProfinite.{max u w}} (f g : finiteCoproduct X ⟶ B)
(h : ∀ a : α, finiteCoproduct.ι X a ≫ f = finiteCoproduct.ι X a ≫ g) : f = g := by
ext ⟨a, x⟩
specialize h a
apply_fun (· x) at h
exact h
abbrev finiteCoproduct.cofan : Limits.Cofan X :=
Cofan.mk (finiteCoproduct X) (finiteCoproduct.ι X)
def finiteCoproduct.isColimit : Limits.IsColimit (finiteCoproduct.cofan X) :=
mkCofanColimit _
(fun s ↦ desc _ fun a ↦ s.inj a)
(fun s a ↦ ι_desc _ _ _)
fun s m hm ↦ finiteCoproduct.hom_ext _ _ _ fun a ↦
(by ext t; exact congrFun (congrArg DFunLike.coe (hm a)) t)
instance (n : ℕ) (F : Discrete (Fin n) ⥤ LightProfinite) :
HasColimit (Discrete.functor (F.obj ∘ Discrete.mk) : Discrete (Fin n) ⥤ LightProfinite) where
exists_colimit := ⟨⟨finiteCoproduct.cofan _, finiteCoproduct.isColimit _⟩⟩
instance : HasFiniteCoproducts LightProfinite where
out _ := { has_colimit := fun _ ↦ hasColimitOfIso Discrete.natIsoFunctor }
section Iso
noncomputable
def coproductIsoCoproduct : finiteCoproduct X ≅ ∐ X :=
Limits.IsColimit.coconePointUniqueUpToIso (finiteCoproduct.isColimit X) (Limits.colimit.isColimit _)
| Mathlib/Topology/Category/LightProfinite/Limits.lean | 202 | 204 | theorem Sigma.ι_comp_toFiniteCoproduct (a : α) :
(Limits.Sigma.ι X a) ≫ (coproductIsoCoproduct X).inv = finiteCoproduct.ι X a := by |
simp [coproductIsoCoproduct]
| 1 |
import Mathlib.Data.Set.Lattice
import Mathlib.Init.Set
import Mathlib.Control.Basic
import Mathlib.Lean.Expr.ExtraRecognizers
#align_import data.set.functor from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u
open Function
namespace Set
variable {α β : Type u} {s : Set α} {f : α → Set β} {g : Set (α → β)}
protected def monad : Monad.{u} Set where
pure a := {a}
bind s f := ⋃ i ∈ s, f i
seq s t := Set.seq s (t ())
map := Set.image
instance : CoeHead (Set s) (Set α) := ⟨fun t => (Subtype.val '' t)⟩
theorem coe_eq_image_val (t : Set s) :
@Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) := by
change ⋃ (x ∈ t), {x.1} = _
ext
simp
variable {β : Set α} {γ : Set β} {a : α}
theorem mem_image_val_of_mem (ha : a ∈ β) (ha' : ⟨a, ha⟩ ∈ γ) : a ∈ (γ : Set α) :=
⟨_, ha', rfl⟩
| Mathlib/Data/Set/Functor.lean | 146 | 147 | theorem image_val_subset : (γ : Set α) ⊆ β := by |
rintro _ ⟨⟨_, ha⟩, _, rfl⟩; exact ha
| 1 |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iio]
#align order_iso.preimage_Ico OrderIso.preimage_Ico
@[simp]
theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iic]
#align order_iso.preimage_Ioc OrderIso.preimage_Ioc
@[simp]
theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iio]
#align order_iso.preimage_Ioo OrderIso.preimage_Ioo
@[simp]
theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm]
#align order_iso.image_Iic OrderIso.image_Iic
@[simp]
theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) :=
e.dual.image_Iic a
#align order_iso.image_Ici OrderIso.image_Ici
@[simp]
theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm]
#align order_iso.image_Iio OrderIso.image_Iio
@[simp]
theorem image_Ioi (e : α ≃o β) (a : α) : e '' Ioi a = Ioi (e a) :=
e.dual.image_Iio a
#align order_iso.image_Ioi OrderIso.image_Ioi
@[simp]
theorem image_Ioo (e : α ≃o β) (a b : α) : e '' Ioo a b = Ioo (e a) (e b) := by
rw [e.image_eq_preimage, e.symm.preimage_Ioo, e.symm_symm]
#align order_iso.image_Ioo OrderIso.image_Ioo
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 93 | 94 | theorem image_Ioc (e : α ≃o β) (a b : α) : e '' Ioc a b = Ioc (e a) (e b) := by |
rw [e.image_eq_preimage, e.symm.preimage_Ioc, e.symm_symm]
| 1 |
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.add_torsor from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
class AddTorsor (G : outParam Type*) (P : Type*) [AddGroup G] extends AddAction G P,
VSub G P where
[nonempty : Nonempty P]
vsub_vadd' : ∀ p₁ p₂ : P, (p₁ -ᵥ p₂ : G) +ᵥ p₂ = p₁
vadd_vsub' : ∀ (g : G) (p : P), g +ᵥ p -ᵥ p = g
#align add_torsor AddTorsor
-- Porting note(#12096): removed `nolint instance_priority`; lint not ported yet
attribute [instance 100] AddTorsor.nonempty
-- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet
--attribute [nolint dangerous_instance] AddTorsor.toVSub
-- Porting note(#12096): linter not ported yet
--@[nolint instance_priority]
instance addGroupIsAddTorsor (G : Type*) [AddGroup G] : AddTorsor G G where
vsub := Sub.sub
vsub_vadd' := sub_add_cancel
vadd_vsub' := add_sub_cancel_right
#align add_group_is_add_torsor addGroupIsAddTorsor
@[simp]
theorem vsub_eq_sub {G : Type*} [AddGroup G] (g₁ g₂ : G) : g₁ -ᵥ g₂ = g₁ - g₂ :=
rfl
#align vsub_eq_sub vsub_eq_sub
section General
variable {G : Type*} {P : Type*} [AddGroup G] [T : AddTorsor G P]
@[simp]
theorem vsub_vadd (p₁ p₂ : P) : p₁ -ᵥ p₂ +ᵥ p₂ = p₁ :=
AddTorsor.vsub_vadd' p₁ p₂
#align vsub_vadd vsub_vadd
@[simp]
theorem vadd_vsub (g : G) (p : P) : g +ᵥ p -ᵥ p = g :=
AddTorsor.vadd_vsub' g p
#align vadd_vsub vadd_vsub
theorem vadd_right_cancel {g₁ g₂ : G} (p : P) (h : g₁ +ᵥ p = g₂ +ᵥ p) : g₁ = g₂ := by
-- Porting note: vadd_vsub g₁ → vadd_vsub g₁ p
rw [← vadd_vsub g₁ p, h, vadd_vsub]
#align vadd_right_cancel vadd_right_cancel
@[simp]
theorem vadd_right_cancel_iff {g₁ g₂ : G} (p : P) : g₁ +ᵥ p = g₂ +ᵥ p ↔ g₁ = g₂ :=
⟨vadd_right_cancel p, fun h => h ▸ rfl⟩
#align vadd_right_cancel_iff vadd_right_cancel_iff
theorem vadd_right_injective (p : P) : Function.Injective ((· +ᵥ p) : G → P) := fun _ _ =>
vadd_right_cancel p
#align vadd_right_injective vadd_right_injective
theorem vadd_vsub_assoc (g : G) (p₁ p₂ : P) : g +ᵥ p₁ -ᵥ p₂ = g + (p₁ -ᵥ p₂) := by
apply vadd_right_cancel p₂
rw [vsub_vadd, add_vadd, vsub_vadd]
#align vadd_vsub_assoc vadd_vsub_assoc
@[simp]
theorem vsub_self (p : P) : p -ᵥ p = (0 : G) := by
rw [← zero_add (p -ᵥ p), ← vadd_vsub_assoc, vadd_vsub]
#align vsub_self vsub_self
theorem eq_of_vsub_eq_zero {p₁ p₂ : P} (h : p₁ -ᵥ p₂ = (0 : G)) : p₁ = p₂ := by
rw [← vsub_vadd p₁ p₂, h, zero_vadd]
#align eq_of_vsub_eq_zero eq_of_vsub_eq_zero
@[simp]
theorem vsub_eq_zero_iff_eq {p₁ p₂ : P} : p₁ -ᵥ p₂ = (0 : G) ↔ p₁ = p₂ :=
Iff.intro eq_of_vsub_eq_zero fun h => h ▸ vsub_self _
#align vsub_eq_zero_iff_eq vsub_eq_zero_iff_eq
theorem vsub_ne_zero {p q : P} : p -ᵥ q ≠ (0 : G) ↔ p ≠ q :=
not_congr vsub_eq_zero_iff_eq
#align vsub_ne_zero vsub_ne_zero
@[simp]
theorem vsub_add_vsub_cancel (p₁ p₂ p₃ : P) : p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) = p₁ -ᵥ p₃ := by
apply vadd_right_cancel p₃
rw [add_vadd, vsub_vadd, vsub_vadd, vsub_vadd]
#align vsub_add_vsub_cancel vsub_add_vsub_cancel
@[simp]
theorem neg_vsub_eq_vsub_rev (p₁ p₂ : P) : -(p₁ -ᵥ p₂) = p₂ -ᵥ p₁ := by
refine neg_eq_of_add_eq_zero_right (vadd_right_cancel p₁ ?_)
rw [vsub_add_vsub_cancel, vsub_self]
#align neg_vsub_eq_vsub_rev neg_vsub_eq_vsub_rev
| Mathlib/Algebra/AddTorsor.lean | 159 | 160 | theorem vadd_vsub_eq_sub_vsub (g : G) (p q : P) : g +ᵥ p -ᵥ q = g - (q -ᵥ p) := by |
rw [vadd_vsub_assoc, sub_eq_add_neg, neg_vsub_eq_vsub_rev]
| 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.