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.SetTheory.Cardinal.Finite #align_import data.set.ncard from "leanprover-community/mathlib"@"74c2af38a828107941029b03839882c5c6f87a04" namespace Set variable {Ξ± Ξ² : Type*} {s t : Set Ξ±} noncomputable def encard (s : Set Ξ±) : β„•βˆž := PartENat.withTopEquiv (PartENat.card s) @[simp] theorem encard_univ_coe (s : Set Ξ±) : encard (univ : Set s) = encard s := by rw [encard, encard, PartENat.card_congr (Equiv.Set.univ ↑s)]
Mathlib/Data/Set/Card.lean
69
71
theorem encard_univ (Ξ± : Type*) : encard (univ : Set Ξ±) = PartENat.withTopEquiv (PartENat.card Ξ±) := by
rw [encard, PartENat.card_congr (Equiv.Set.univ Ξ±)]
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 Composition variable {π•œ' : Type*} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {s' t' : Set π•œ'} {h : π•œ β†’ π•œ'} {h₁ : π•œ β†’ π•œ} {hβ‚‚ : π•œ' β†’ π•œ'} {h' hβ‚‚' : π•œ'} {h₁' : π•œ} {g₁ : π•œ' β†’ F} {g₁' : F} {L' : Filter π•œ'} {y : π•œ'} (x) theorem HasDerivAtFilter.scomp (hg : HasDerivAtFilter g₁ g₁' (h x) L') (hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') : HasDerivAtFilter (g₁ ∘ h) (h' β€’ g₁') x L := by simpa using ((hg.restrictScalars π•œ).comp x hh hL).hasDerivAtFilter #align has_deriv_at_filter.scomp HasDerivAtFilter.scomp
Mathlib/Analysis/Calculus/Deriv/Comp.lean
80
83
theorem HasDerivAtFilter.scomp_of_eq (hg : HasDerivAtFilter g₁ g₁' y L') (hh : HasDerivAtFilter h h' x L) (hy : y = h x) (hL : Tendsto h L L') : HasDerivAtFilter (g₁ ∘ h) (h' β€’ g₁') x L := by
rw [hy] at hg; exact hg.scomp x hh hL
1
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.PiL2 #align_import analysis.inner_product_space.adjoint from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open RCLike open scoped ComplexConjugate variable {π•œ E F G : Type*} [RCLike π•œ] variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] variable [InnerProductSpace π•œ E] [InnerProductSpace π•œ F] [InnerProductSpace π•œ G] local notation "βŸͺ" x ", " y "⟫" => @inner π•œ _ _ x y open InnerProductSpace namespace ContinuousLinearMap variable [CompleteSpace E] [CompleteSpace G] -- Note: made noncomputable to stop excess compilation -- leanprover-community/mathlib4#7103 noncomputable def adjointAux : (E β†’L[π•œ] F) β†’L⋆[π•œ] F β†’L[π•œ] E := (ContinuousLinearMap.compSL _ _ _ _ _ ((toDual π•œ E).symm : NormedSpace.Dual π•œ E β†’L⋆[π•œ] E)).comp (toSesqForm : (E β†’L[π•œ] F) β†’L[π•œ] F β†’L⋆[π•œ] NormedSpace.Dual π•œ E) #align continuous_linear_map.adjoint_aux ContinuousLinearMap.adjointAux @[simp] theorem adjointAux_apply (A : E β†’L[π•œ] F) (x : F) : adjointAux A x = ((toDual π•œ E).symm : NormedSpace.Dual π•œ E β†’ E) ((toSesqForm A) x) := rfl #align continuous_linear_map.adjoint_aux_apply ContinuousLinearMap.adjointAux_apply theorem adjointAux_inner_left (A : E β†’L[π•œ] F) (x : E) (y : F) : βŸͺadjointAux A y, x⟫ = βŸͺy, A x⟫ := by rw [adjointAux_apply, toDual_symm_apply, toSesqForm_apply_coe, coe_comp', innerSL_apply_coe, Function.comp_apply] #align continuous_linear_map.adjoint_aux_inner_left ContinuousLinearMap.adjointAux_inner_left
Mathlib/Analysis/InnerProductSpace/Adjoint.lean
85
87
theorem adjointAux_inner_right (A : E β†’L[π•œ] F) (x : E) (y : F) : βŸͺx, adjointAux A y⟫ = βŸͺA x, y⟫ := by
rw [← inner_conj_symm, adjointAux_inner_left, inner_conj_symm]
1
import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact import Mathlib.Topology.QuasiSeparated #align_import algebraic_geometry.morphisms.quasi_separated from "leanprover-community/mathlib"@"1a51edf13debfcbe223fa06b1cb353b9ed9751cc" noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe u open scoped AlgebraicGeometry namespace AlgebraicGeometry variable {X Y : Scheme.{u}} (f : X ⟢ Y) @[mk_iff] class QuasiSeparated (f : X ⟢ Y) : Prop where diagonalQuasiCompact : QuasiCompact (pullback.diagonal f) := by infer_instance #align algebraic_geometry.quasi_separated AlgebraicGeometry.QuasiSeparated def QuasiSeparated.affineProperty : AffineTargetMorphismProperty := fun X _ _ _ => QuasiSeparatedSpace X.carrier #align algebraic_geometry.quasi_separated.affine_property AlgebraicGeometry.QuasiSeparated.affineProperty theorem quasiSeparatedSpace_iff_affine (X : Scheme) : QuasiSeparatedSpace X.carrier ↔ βˆ€ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by rw [quasiSeparatedSpace_iff] constructor Β· intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact Β· intro H suffices βˆ€ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1), IsCompact (U βŠ“ V).1 by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV' intro U hU V hV -- Porting note: it complains "unable to find motive", but telling Lean that motive is -- underscore is actually sufficient, weird apply compact_open_induction_on (P := _) V hV Β· simp Β· intro S _ V hV change IsCompact (U.1 ∩ (S.1 βˆͺ V.1)) rw [Set.inter_union_distrib_left] apply hV.union clear hV apply compact_open_induction_on (P := _) U hU Β· simp Β· intro S _ W hW change IsCompact ((S.1 βˆͺ W.1) ∩ V.1) rw [Set.union_inter_distrib_right] apply hW.union apply H #align algebraic_geometry.quasi_separated_space_iff_affine AlgebraicGeometry.quasiSeparatedSpace_iff_affine theorem quasi_compact_affineProperty_iff_quasiSeparatedSpace {X Y : Scheme} [IsAffine Y] (f : X ⟢ Y) : QuasiCompact.affineProperty.diagonal f ↔ QuasiSeparatedSpace X.carrier := by delta AffineTargetMorphismProperty.diagonal rw [quasiSeparatedSpace_iff_affine] constructor Β· intro H U V haveI : IsAffine _ := U.2 haveI : IsAffine _ := V.2 let g : pullback (X.ofRestrict U.1.openEmbedding) (X.ofRestrict V.1.openEmbedding) ⟢ X := pullback.fst ≫ X.ofRestrict _ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e erw [Subtype.range_coe, Subtype.range_coe] at e rw [isCompact_iff_compactSpace] exact @Homeomorph.compactSpace _ _ _ _ (H _ _) e Β· introv H h₁ hβ‚‚ let g : pullback f₁ fβ‚‚ ⟢ X := pullback.fst ≫ f₁ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e simp_rw [isCompact_iff_compactSpace] at H exact @Homeomorph.compactSpace _ _ _ _ (H ⟨⟨_, h₁.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩ ⟨⟨_, hβ‚‚.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩) e.symm #align algebraic_geometry.quasi_compact_affine_property_iff_quasi_separated_space AlgebraicGeometry.quasi_compact_affineProperty_iff_quasiSeparatedSpace
Mathlib/AlgebraicGeometry/Morphisms/QuasiSeparated.lean
117
118
theorem quasiSeparated_eq_diagonal_is_quasiCompact : @QuasiSeparated = MorphismProperty.diagonal @QuasiCompact := by
ext; exact quasiSeparated_iff _
1
import Mathlib.Algebra.Algebra.Operations import Mathlib.Data.Fintype.Lattice import Mathlib.RingTheory.Coprime.Lemmas #align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" assert_not_exists Basis -- See `RingTheory.Ideal.Basis` assert_not_exists Submodule.hasQuotient -- See `RingTheory.Ideal.QuotientOperations` universe u v w x open Pointwise namespace Submodule variable {R : Type u} {M : Type v} {M' F G : Type*} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M'] open Pointwise instance hasSMul' : SMul (Ideal R) (Submodule R M) := ⟨Submodule.mapβ‚‚ (LinearMap.lsmul R M)⟩ #align submodule.has_smul' Submodule.hasSMul' protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β€’ J = I * J := rfl #align ideal.smul_eq_mul Ideal.smul_eq_mul variable (R M) in def _root_.Module.annihilator : Ideal R := LinearMap.ker (LinearMap.lsmul R M) theorem _root_.Module.mem_annihilator {r} : r ∈ Module.annihilator R M ↔ βˆ€ m : M, r β€’ m = 0 := ⟨fun h ↦ (congr($h Β·)), (LinearMap.ext Β·)⟩ theorem _root_.LinearMap.annihilator_le_of_injective (f : M β†’β‚—[R] M') (hf : Function.Injective f) : Module.annihilator R M' ≀ Module.annihilator R M := fun x h ↦ by rw [Module.mem_annihilator] at h ⊒; exact fun m ↦ hf (by rw [map_smul, h, f.map_zero]) theorem _root_.LinearMap.annihilator_le_of_surjective (f : M β†’β‚—[R] M') (hf : Function.Surjective f) : Module.annihilator R M ≀ Module.annihilator R M' := fun x h ↦ by rw [Module.mem_annihilator] at h ⊒ intro m; obtain ⟨m, rfl⟩ := hf m rw [← map_smul, h, f.map_zero] theorem _root_.LinearEquiv.annihilator_eq (e : M ≃ₗ[R] M') : Module.annihilator R M = Module.annihilator R M' := (e.annihilator_le_of_surjective e.surjective).antisymm (e.annihilator_le_of_injective e.injective) abbrev annihilator (N : Submodule R M) : Ideal R := Module.annihilator R N #align submodule.annihilator Submodule.annihilator theorem annihilator_top : (⊀ : Submodule R M).annihilator = Module.annihilator R M := topEquiv.annihilator_eq variable {I J : Ideal R} {N P : Submodule R M}
Mathlib/RingTheory/Ideal/Operations.lean
74
75
theorem mem_annihilator {r} : r ∈ N.annihilator ↔ βˆ€ n ∈ N, r β€’ n = (0 : M) := by
simp_rw [annihilator, Module.mem_annihilator, Subtype.forall, Subtype.ext_iff]; rfl
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]
Mathlib/Data/Finset/Card.lean
69
69
theorem card_mono : Monotone (@card Ξ±) := by
apply card_le_card
1
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Data.Rat.Denumerable import Mathlib.Data.Set.Pointwise.Interval import Mathlib.SetTheory.Cardinal.Continuum #align_import data.real.cardinality from "leanprover-community/mathlib"@"7e7aaccf9b0182576cabdde36cf1b5ad3585b70d" open Nat Set open Cardinal noncomputable section namespace Cardinal variable {c : ℝ} {f g : β„• β†’ Bool} {n : β„•} def cantorFunctionAux (c : ℝ) (f : β„• β†’ Bool) (n : β„•) : ℝ := cond (f n) (c ^ n) 0 #align cardinal.cantor_function_aux Cardinal.cantorFunctionAux @[simp]
Mathlib/Data/Real/Cardinality.lean
64
65
theorem cantorFunctionAux_true (h : f n = true) : cantorFunctionAux c f n = c ^ n := by
simp [cantorFunctionAux, h]
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 Composition variable {π•œ' : Type*} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {s' t' : Set π•œ'} {h : π•œ β†’ π•œ'} {h₁ : π•œ β†’ π•œ} {hβ‚‚ : π•œ' β†’ π•œ'} {h' hβ‚‚' : π•œ'} {h₁' : π•œ} {g₁ : π•œ' β†’ F} {g₁' : F} {L' : Filter π•œ'} {y : π•œ'} (x) theorem HasDerivAtFilter.scomp (hg : HasDerivAtFilter g₁ g₁' (h x) L') (hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') : HasDerivAtFilter (g₁ ∘ h) (h' β€’ g₁') x L := by simpa using ((hg.restrictScalars π•œ).comp x hh hL).hasDerivAtFilter #align has_deriv_at_filter.scomp HasDerivAtFilter.scomp theorem HasDerivAtFilter.scomp_of_eq (hg : HasDerivAtFilter g₁ g₁' y L') (hh : HasDerivAtFilter h h' x L) (hy : y = h x) (hL : Tendsto h L L') : HasDerivAtFilter (g₁ ∘ h) (h' β€’ g₁') x L := by rw [hy] at hg; exact hg.scomp x hh hL theorem HasDerivWithinAt.scomp_hasDerivAt (hg : HasDerivWithinAt g₁ g₁' s' (h x)) (hh : HasDerivAt h h' x) (hs : βˆ€ x, h x ∈ s') : HasDerivAt (g₁ ∘ h) (h' β€’ g₁') x := hg.scomp x hh <| tendsto_inf.2 ⟨hh.continuousAt, tendsto_principal.2 <| eventually_of_forall hs⟩ #align has_deriv_within_at.scomp_has_deriv_at HasDerivWithinAt.scomp_hasDerivAt
Mathlib/Analysis/Calculus/Deriv/Comp.lean
90
93
theorem HasDerivWithinAt.scomp_hasDerivAt_of_eq (hg : HasDerivWithinAt g₁ g₁' s' y) (hh : HasDerivAt h h' x) (hs : βˆ€ x, h x ∈ s') (hy : y = h x) : HasDerivAt (g₁ ∘ h) (h' β€’ g₁') x := by
rw [hy] at hg; exact hg.scomp_hasDerivAt x hh hs
1
import Mathlib.Data.Finset.Lattice import Mathlib.Data.Fintype.Vector import Mathlib.Data.Multiset.Sym #align_import data.finset.sym from "leanprover-community/mathlib"@"02ba8949f486ebecf93fe7460f1ed0564b5e442c" namespace Finset variable {Ξ± : Type*} @[simps] protected def sym2 (s : Finset Ξ±) : Finset (Sym2 Ξ±) := ⟨s.1.sym2, s.2.sym2⟩ #align finset.sym2 Finset.sym2 section variable {s t : Finset Ξ±} {a b : Ξ±} theorem mk_mem_sym2_iff : s(a, b) ∈ s.sym2 ↔ a ∈ s ∧ b ∈ s := by rw [mem_mk, sym2_val, Multiset.mk_mem_sym2_iff, mem_mk, mem_mk] #align finset.mk_mem_sym2_iff Finset.mk_mem_sym2_iff @[simp] theorem mem_sym2_iff {m : Sym2 Ξ±} : m ∈ s.sym2 ↔ βˆ€ a ∈ m, a ∈ s := by rw [mem_mk, sym2_val, Multiset.mem_sym2_iff] simp only [mem_val] #align finset.mem_sym2_iff Finset.mem_sym2_iff instance _root_.Sym2.instFintype [Fintype Ξ±] : Fintype (Sym2 Ξ±) where elems := Finset.univ.sym2 complete := fun x ↦ by rw [mem_sym2_iff]; exact (fun a _ ↦ mem_univ a) -- Note(kmill): Using a default argument to make this simp lemma more general. @[simp] theorem sym2_univ [Fintype Ξ±] (inst : Fintype (Sym2 Ξ±) := Sym2.instFintype) : (univ : Finset Ξ±).sym2 = univ := by ext simp only [mem_sym2_iff, mem_univ, implies_true] #align finset.sym2_univ Finset.sym2_univ @[simp, mono] theorem sym2_mono (h : s βŠ† t) : s.sym2 βŠ† t.sym2 := by rw [← val_le_iff, sym2_val, sym2_val] apply Multiset.sym2_mono rwa [val_le_iff] #align finset.sym2_mono Finset.sym2_mono theorem monotone_sym2 : Monotone (Finset.sym2 : Finset Ξ± β†’ _) := fun _ _ => sym2_mono theorem injective_sym2 : Function.Injective (Finset.sym2 : Finset Ξ± β†’ _) := by intro s t h ext x simpa using congr(s(x, x) ∈ $h) theorem strictMono_sym2 : StrictMono (Finset.sym2 : Finset Ξ± β†’ _) := monotone_sym2.strictMono_of_injective injective_sym2 theorem sym2_toFinset [DecidableEq Ξ±] (m : Multiset Ξ±) : m.toFinset.sym2 = m.sym2.toFinset := by ext z refine z.ind fun x y ↦ ?_ simp only [mk_mem_sym2_iff, Multiset.mem_toFinset, Multiset.mk_mem_sym2_iff] @[simp] theorem sym2_empty : (βˆ… : Finset Ξ±).sym2 = βˆ… := rfl #align finset.sym2_empty Finset.sym2_empty @[simp]
Mathlib/Data/Finset/Sym.lean
96
97
theorem sym2_eq_empty : s.sym2 = βˆ… ↔ s = βˆ… := by
rw [← val_eq_zero, sym2_val, Multiset.sym2_eq_zero_iff, val_eq_zero]
1
import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Metric Set open Pointwise Topology variable {π•œ E : Type*} variable [NormedField π•œ] section SeminormedAddCommGroup variable [SeminormedAddCommGroup E] [NormedSpace π•œ E] theorem smul_ball {c : π•œ} (hc : c β‰  0) (x : E) (r : ℝ) : c β€’ ball x r = ball (c β€’ x) (β€–cβ€– * r) := by ext y rw [mem_smul_set_iff_inv_smul_memβ‚€ hc] conv_lhs => rw [← inv_smul_smulβ‚€ hc x] simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smulβ‚€] #align smul_ball smul_ball theorem smul_unitBall {c : π•œ} (hc : c β‰  0) : c β€’ ball (0 : E) (1 : ℝ) = ball (0 : E) β€–cβ€– := by rw [_root_.smul_ball hc, smul_zero, mul_one] #align smul_unit_ball smul_unitBall theorem smul_sphere' {c : π•œ} (hc : c β‰  0) (x : E) (r : ℝ) : c β€’ sphere x r = sphere (c β€’ x) (β€–cβ€– * r) := by ext y rw [mem_smul_set_iff_inv_smul_memβ‚€ hc] conv_lhs => rw [← inv_smul_smulβ‚€ hc x] simp only [mem_sphere, dist_smulβ‚€, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r] #align smul_sphere' smul_sphere'
Mathlib/Analysis/NormedSpace/Pointwise.lean
104
106
theorem smul_closedBall' {c : π•œ} (hc : c β‰  0) (x : E) (r : ℝ) : c β€’ closedBall x r = closedBall (c β€’ x) (β€–cβ€– * r) := by
simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc]
1
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.LinearAlgebra.FreeModule.Basic import Mathlib.LinearAlgebra.FreeModule.Finite.Basic #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v v' w open Cardinal Basis Submodule Function Set DirectSum FiniteDimensional variable {R : Type u} {M M₁ : Type v} {M' : Type v'} variable [Ring R] [StrongRankCondition R] variable [AddCommGroup M] [Module R M] [Module.Free R M] variable [AddCommGroup M'] [Module R M'] [Module.Free R M'] variable [AddCommGroup M₁] [Module R M₁] [Module.Free R M₁] namespace Module.Free variable (R M) theorem rank_eq_card_chooseBasisIndex : Module.rank R M = #(ChooseBasisIndex R M) := (chooseBasis R M).mk_eq_rank''.symm #align module.free.rank_eq_card_choose_basis_index Module.Free.rank_eq_card_chooseBasisIndex
Mathlib/LinearAlgebra/Dimension/Free.lean
88
90
theorem _root_.FiniteDimensional.finrank_eq_card_chooseBasisIndex [Module.Finite R M] : finrank R M = Fintype.card (ChooseBasisIndex R M) := by
simp [finrank, rank_eq_card_chooseBasisIndex]
1
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Dynamics.FixedPoints.Basic open Finset Function section AddCommMonoid variable {Ξ± M : Type*} [AddCommMonoid M] def birkhoffSum (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) (n : β„•) (x : Ξ±) : M := βˆ‘ k ∈ range n, g (f^[k] x) theorem birkhoffSum_zero (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) (x : Ξ±) : birkhoffSum f g 0 x = 0 := sum_range_zero _ @[simp] theorem birkhoffSum_zero' (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) : birkhoffSum f g 0 = 0 := funext <| birkhoffSum_zero _ _ theorem birkhoffSum_one (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) (x : Ξ±) : birkhoffSum f g 1 x = g x := sum_range_one _ @[simp] theorem birkhoffSum_one' (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) : birkhoffSum f g 1 = g := funext <| birkhoffSum_one f g theorem birkhoffSum_succ (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) (n : β„•) (x : Ξ±) : birkhoffSum f g (n + 1) x = birkhoffSum f g n x + g (f^[n] x) := sum_range_succ _ _ theorem birkhoffSum_succ' (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) (n : β„•) (x : Ξ±) : birkhoffSum f g (n + 1) x = g x + birkhoffSum f g n (f x) := (sum_range_succ' _ _).trans (add_comm _ _)
Mathlib/Dynamics/BirkhoffSum/Basic.lean
51
53
theorem birkhoffSum_add (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ M) (m n : β„•) (x : Ξ±) : birkhoffSum f g (m + n) x = birkhoffSum f g m x + birkhoffSum f g n (f^[m] x) := by
simp_rw [birkhoffSum, sum_range_add, add_comm m, iterate_add_apply]
1
import Mathlib.Topology.MetricSpace.Basic #align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b" variable {Ξ± Ξ² : Type*} namespace Set section Einfsep open ENNReal open Function noncomputable def einfsep [EDist Ξ±] (s : Set Ξ±) : ℝβ‰₯0∞ := β¨… (x ∈ s) (y ∈ s) (_ : x β‰  y), edist x y #align set.einfsep Set.einfsep section EDist variable [EDist Ξ±] {x y : Ξ±} {s t : Set Ξ±} theorem le_einfsep_iff {d} : d ≀ s.einfsep ↔ βˆ€ x ∈ s, βˆ€ y ∈ s, x β‰  y β†’ d ≀ edist x y := by simp_rw [einfsep, le_iInf_iff] #align set.le_einfsep_iff Set.le_einfsep_iff theorem einfsep_zero : s.einfsep = 0 ↔ βˆ€ C > 0, βˆƒ x ∈ s, βˆƒ y ∈ s, x β‰  y ∧ edist x y < C := by simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop] #align set.einfsep_zero Set.einfsep_zero theorem einfsep_pos : 0 < s.einfsep ↔ βˆƒ C > 0, βˆ€ x ∈ s, βˆ€ y ∈ s, x β‰  y β†’ C ≀ edist x y := by rw [pos_iff_ne_zero, Ne, einfsep_zero] simp only [not_forall, not_exists, not_lt, exists_prop, not_and] #align set.einfsep_pos Set.einfsep_pos theorem einfsep_top : s.einfsep = ∞ ↔ βˆ€ x ∈ s, βˆ€ y ∈ s, x β‰  y β†’ edist x y = ∞ := by simp_rw [einfsep, iInf_eq_top] #align set.einfsep_top Set.einfsep_top theorem einfsep_lt_top : s.einfsep < ∞ ↔ βˆƒ x ∈ s, βˆƒ y ∈ s, x β‰  y ∧ edist x y < ∞ := by simp_rw [einfsep, iInf_lt_iff, exists_prop] #align set.einfsep_lt_top Set.einfsep_lt_top
Mathlib/Topology/MetricSpace/Infsep.lean
74
76
theorem einfsep_ne_top : s.einfsep β‰  ∞ ↔ βˆƒ x ∈ s, βˆƒ y ∈ s, x β‰  y ∧ edist x y β‰  ∞ := by
simp_rw [← lt_top_iff_ne_top, einfsep_lt_top]
1
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le
Mathlib/Data/Nat/Dist.lean
49
50
theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by
rw [dist_comm]; apply dist_eq_sub_of_le h
1
import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.NormedSpace.HomeomorphBall #align_import analysis.inner_product_space.calculus from "leanprover-community/mathlib"@"f9dd3204df14a0749cd456fac1e6849dfe7d2b88" noncomputable section open RCLike Real Filter open scoped Classical Topology section DerivInner variable {π•œ E F : Type*} [RCLike π•œ] variable [NormedAddCommGroup E] [InnerProductSpace π•œ E] variable [NormedAddCommGroup F] [InnerProductSpace ℝ F] local notation "βŸͺ" x ", " y "⟫" => @inner π•œ _ _ x y variable (π•œ) [NormedSpace ℝ E] def fderivInnerCLM (p : E Γ— E) : E Γ— E β†’L[ℝ] π•œ := isBoundedBilinearMap_inner.deriv p #align fderiv_inner_clm fderivInnerCLM @[simp] theorem fderivInnerCLM_apply (p x : E Γ— E) : fderivInnerCLM π•œ p x = βŸͺp.1, x.2⟫ + βŸͺx.1, p.2⟫ := rfl #align fderiv_inner_clm_apply fderivInnerCLM_apply variable {π•œ} -- Porting note: Lean 3 magically switches back to `{π•œ}` here theorem contDiff_inner {n} : ContDiff ℝ n fun p : E Γ— E => βŸͺp.1, p.2⟫ := isBoundedBilinearMap_inner.contDiff #align cont_diff_inner contDiff_inner theorem contDiffAt_inner {p : E Γ— E} {n} : ContDiffAt ℝ n (fun p : E Γ— E => βŸͺp.1, p.2⟫) p := ContDiff.contDiffAt contDiff_inner #align cont_diff_at_inner contDiffAt_inner theorem differentiable_inner : Differentiable ℝ fun p : E Γ— E => βŸͺp.1, p.2⟫ := isBoundedBilinearMap_inner.differentiableAt #align differentiable_inner differentiable_inner variable (π•œ) variable {G : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G] {f g : G β†’ E} {f' g' : G β†’L[ℝ] E} {s : Set G} {x : G} {n : β„•βˆž} theorem ContDiffWithinAt.inner (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x) : ContDiffWithinAt ℝ n (fun x => βŸͺf x, g x⟫) s x := contDiffAt_inner.comp_contDiffWithinAt x (hf.prod hg) #align cont_diff_within_at.inner ContDiffWithinAt.inner nonrec theorem ContDiffAt.inner (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) : ContDiffAt ℝ n (fun x => βŸͺf x, g x⟫) x := hf.inner π•œ hg #align cont_diff_at.inner ContDiffAt.inner theorem ContDiffOn.inner (hf : ContDiffOn ℝ n f s) (hg : ContDiffOn ℝ n g s) : ContDiffOn ℝ n (fun x => βŸͺf x, g x⟫) s := fun x hx => (hf x hx).inner π•œ (hg x hx) #align cont_diff_on.inner ContDiffOn.inner theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : ContDiff ℝ n fun x => βŸͺf x, g x⟫ := contDiff_inner.comp (hf.prod hg) #align cont_diff.inner ContDiff.inner theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x) (hg : HasFDerivWithinAt g g' s x) : HasFDerivWithinAt (fun t => βŸͺf t, g t⟫) ((fderivInnerCLM π•œ (f x, g x)).comp <| f'.prod g') s x := (isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp_hasFDerivWithinAt x (hf.prod hg) #align has_fderiv_within_at.inner HasFDerivWithinAt.inner theorem HasStrictFDerivAt.inner (hf : HasStrictFDerivAt f f' x) (hg : HasStrictFDerivAt g g' x) : HasStrictFDerivAt (fun t => βŸͺf t, g t⟫) ((fderivInnerCLM π•œ (f x, g x)).comp <| f'.prod g') x := (isBoundedBilinearMap_inner.hasStrictFDerivAt (f x, g x)).comp x (hf.prod hg) #align has_strict_fderiv_at.inner HasStrictFDerivAt.inner theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) : HasFDerivAt (fun t => βŸͺf t, g t⟫) ((fderivInnerCLM π•œ (f x, g x)).comp <| f'.prod g') x := (isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp x (hf.prod hg) #align has_fderiv_at.inner HasFDerivAt.inner
Mathlib/Analysis/InnerProductSpace/Calculus.lean
109
112
theorem HasDerivWithinAt.inner {f g : ℝ β†’ E} {f' g' : E} {s : Set ℝ} {x : ℝ} (hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (fun t => βŸͺf t, g t⟫) (βŸͺf x, g'⟫ + βŸͺf', g x⟫) s x := by
simpa using (hf.hasFDerivWithinAt.inner π•œ hg.hasFDerivWithinAt).hasDerivWithinAt
1
import Mathlib.Control.Applicative import Mathlib.Control.Traversable.Basic import Mathlib.Data.List.Forall2 import Mathlib.Data.Set.Functor #align_import control.traversable.instances from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" universe u v section Option open Functor variable {F G : Type u β†’ Type u} variable [Applicative F] [Applicative G] variable [LawfulApplicative F] [LawfulApplicative G] theorem Option.id_traverse {Ξ±} (x : Option Ξ±) : Option.traverse (pure : Ξ± β†’ Id Ξ±) x = x := by cases x <;> rfl #align option.id_traverse Option.id_traverse
Mathlib/Control/Traversable/Instances.lean
35
38
theorem Option.comp_traverse {Ξ± Ξ² Ξ³} (f : Ξ² β†’ F Ξ³) (g : Ξ± β†’ G Ξ²) (x : Option Ξ±) : Option.traverse (Comp.mk ∘ (f <$> Β·) ∘ g) x = Comp.mk (Option.traverse f <$> Option.traverse g x) := by
cases x <;> simp! [functor_norm] <;> rfl
1
import Mathlib.Order.Interval.Set.UnorderedInterval import Mathlib.Algebra.Order.Interval.Set.Monoid import Mathlib.Data.Set.Pointwise.Basic import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Group.MinMax #align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Interval Pointwise variable {Ξ± : Type*} namespace Set section OrderedAddCommGroup variable [OrderedAddCommGroup Ξ±] (a b c : Ξ±) @[simp] theorem preimage_const_add_Ici : (fun x => a + x) ⁻¹' Ici b = Ici (b - a) := ext fun _x => sub_le_iff_le_add'.symm #align set.preimage_const_add_Ici Set.preimage_const_add_Ici @[simp] theorem preimage_const_add_Ioi : (fun x => a + x) ⁻¹' Ioi b = Ioi (b - a) := ext fun _x => sub_lt_iff_lt_add'.symm #align set.preimage_const_add_Ioi Set.preimage_const_add_Ioi @[simp] theorem preimage_const_add_Iic : (fun x => a + x) ⁻¹' Iic b = Iic (b - a) := ext fun _x => le_sub_iff_add_le'.symm #align set.preimage_const_add_Iic Set.preimage_const_add_Iic @[simp] theorem preimage_const_add_Iio : (fun x => a + x) ⁻¹' Iio b = Iio (b - a) := ext fun _x => lt_sub_iff_add_lt'.symm #align set.preimage_const_add_Iio Set.preimage_const_add_Iio @[simp] theorem preimage_const_add_Icc : (fun x => a + x) ⁻¹' Icc b c = Icc (b - a) (c - a) := by simp [← Ici_inter_Iic] #align set.preimage_const_add_Icc Set.preimage_const_add_Icc @[simp] theorem preimage_const_add_Ico : (fun x => a + x) ⁻¹' Ico b c = Ico (b - a) (c - a) := by simp [← Ici_inter_Iio] #align set.preimage_const_add_Ico Set.preimage_const_add_Ico @[simp] theorem preimage_const_add_Ioc : (fun x => a + x) ⁻¹' Ioc b c = Ioc (b - a) (c - a) := by simp [← Ioi_inter_Iic] #align set.preimage_const_add_Ioc Set.preimage_const_add_Ioc @[simp] theorem preimage_const_add_Ioo : (fun x => a + x) ⁻¹' Ioo b c = Ioo (b - a) (c - a) := by simp [← Ioi_inter_Iio] #align set.preimage_const_add_Ioo Set.preimage_const_add_Ioo @[simp] theorem preimage_add_const_Ici : (fun x => x + a) ⁻¹' Ici b = Ici (b - a) := ext fun _x => sub_le_iff_le_add.symm #align set.preimage_add_const_Ici Set.preimage_add_const_Ici @[simp] theorem preimage_add_const_Ioi : (fun x => x + a) ⁻¹' Ioi b = Ioi (b - a) := ext fun _x => sub_lt_iff_lt_add.symm #align set.preimage_add_const_Ioi Set.preimage_add_const_Ioi @[simp] theorem preimage_add_const_Iic : (fun x => x + a) ⁻¹' Iic b = Iic (b - a) := ext fun _x => le_sub_iff_add_le.symm #align set.preimage_add_const_Iic Set.preimage_add_const_Iic @[simp] theorem preimage_add_const_Iio : (fun x => x + a) ⁻¹' Iio b = Iio (b - a) := ext fun _x => lt_sub_iff_add_lt.symm #align set.preimage_add_const_Iio Set.preimage_add_const_Iio @[simp] theorem preimage_add_const_Icc : (fun x => x + a) ⁻¹' Icc b c = Icc (b - a) (c - a) := by simp [← Ici_inter_Iic] #align set.preimage_add_const_Icc Set.preimage_add_const_Icc @[simp] theorem preimage_add_const_Ico : (fun x => x + a) ⁻¹' Ico b c = Ico (b - a) (c - a) := by simp [← Ici_inter_Iio] #align set.preimage_add_const_Ico Set.preimage_add_const_Ico @[simp]
Mathlib/Data/Set/Pointwise/Interval.lean
202
203
theorem preimage_add_const_Ioc : (fun x => x + a) ⁻¹' Ioc b c = Ioc (b - a) (c - a) := by
simp [← Ioi_inter_Iic]
1
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat import Mathlib.RepresentationTheory.GroupCohomology.Basic import Mathlib.RepresentationTheory.Invariants universe v u noncomputable section open CategoryTheory Limits Representation variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G) namespace groupCohomology section IsMulCocycle section variable {G M : Type*} [Mul G] [CommGroup M] [SMul G M] def IsMulOneCocycle (f : G β†’ M) : Prop := βˆ€ g h : G, f (g * h) = g β€’ f h * f g def IsMulTwoCocycle (f : G Γ— G β†’ M) : Prop := βˆ€ g h j : G, f (g * h, j) * f (g, h) = g β€’ (f (h, j)) * f (g, h * j) end section variable {G M : Type*} [Monoid G] [CommGroup M] [MulAction G M] theorem map_one_of_isMulOneCocycle {f : G β†’ M} (hf : IsMulOneCocycle f) : f 1 = 1 := by simpa only [mul_one, one_smul, self_eq_mul_right] using hf 1 1
Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean
528
530
theorem map_one_fst_of_isMulTwoCocycle {f : G Γ— G β†’ M} (hf : IsMulTwoCocycle f) (g : G) : f (1, g) = f (1, 1) := by
simpa only [one_smul, one_mul, mul_one, mul_right_inj] using (hf 1 1 g).symm
1
import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.Polynomial.Basic import Mathlib.Algebra.Regular.Basic import Mathlib.Data.Nat.Choose.Sum #align_import data.polynomial.coeff from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c" set_option linter.uppercaseLean3 false noncomputable section open Finsupp Finset AddMonoidAlgebra open Polynomial namespace Polynomial universe u v variable {R : Type u} {S : Type v} {a b : R} {n m : β„•} variable [Semiring R] {p q r : R[X]} section Coeff @[simp] theorem coeff_add (p q : R[X]) (n : β„•) : coeff (p + q) n = coeff p n + coeff q n := by rcases p with ⟨⟩ rcases q with ⟨⟩ simp_rw [← ofFinsupp_add, coeff] exact Finsupp.add_apply _ _ _ #align polynomial.coeff_add Polynomial.coeff_add set_option linter.deprecated false in @[simp]
Mathlib/Algebra/Polynomial/Coeff.lean
49
49
theorem coeff_bit0 (p : R[X]) (n : β„•) : coeff (bit0 p) n = bit0 (coeff p n) := by
simp [bit0]
1
import Batteries.Tactic.SeqFocus namespace Batteries class TotalBLE (le : Ξ± β†’ Ξ± β†’ Bool) : Prop where total : le a b ∨ le b a class OrientedCmp (cmp : Ξ± β†’ Ξ± β†’ Ordering) : Prop where symm (x y) : (cmp x y).swap = cmp y x class TransCmp (cmp : Ξ± β†’ Ξ± β†’ Ordering) extends OrientedCmp cmp : Prop where le_trans : cmp x y β‰  .gt β†’ cmp y z β‰  .gt β†’ cmp x z β‰  .gt instance [inst : OrientedCmp cmp] : OrientedCmp (flip cmp) where symm _ _ := inst.symm .. instance [inst : TransCmp cmp] : TransCmp (flip cmp) where le_trans h1 h2 := inst.le_trans h2 h1 class BEqCmp [BEq Ξ±] (cmp : Ξ± β†’ Ξ± β†’ Ordering) : Prop where cmp_iff_beq : cmp x y = .eq ↔ x == y
.lake/packages/batteries/Batteries/Classes/Order.lean
121
122
theorem BEqCmp.cmp_iff_eq [BEq Ξ±] [LawfulBEq Ξ±] [BEqCmp (Ξ± := Ξ±) cmp] : cmp x y = .eq ↔ x = y := by
simp [BEqCmp.cmp_iff_beq]
1
import Mathlib.Order.Bounds.Basic import Mathlib.Order.WellFounded import Mathlib.Data.Set.Image import Mathlib.Order.Interval.Set.Basic import Mathlib.Data.Set.Lattice #align_import order.conditionally_complete_lattice.basic from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1" open Function OrderDual Set variable {Ξ± Ξ² Ξ³ : Type*} {ΞΉ : Sort*} section variable [Preorder Ξ±] open scoped Classical noncomputable instance WithTop.instSupSet [SupSet Ξ±] : SupSet (WithTop Ξ±) := ⟨fun S => if ⊀ ∈ S then ⊀ else if BddAbove ((fun (a : Ξ±) ↦ ↑a) ⁻¹' S : Set Ξ±) then ↑(sSup ((fun (a : Ξ±) ↦ (a : WithTop Ξ±)) ⁻¹' S : Set Ξ±)) else ⊀⟩ noncomputable instance WithTop.instInfSet [InfSet Ξ±] : InfSet (WithTop Ξ±) := ⟨fun S => if S βŠ† {⊀} ∨ Β¬BddBelow S then ⊀ else ↑(sInf ((fun (a : Ξ±) ↦ ↑a) ⁻¹' S : Set Ξ±))⟩ noncomputable instance WithBot.instSupSet [SupSet Ξ±] : SupSet (WithBot Ξ±) := ⟨(WithTop.instInfSet (Ξ± := Ξ±α΅’α΅ˆ)).sInf⟩ noncomputable instance WithBot.instInfSet [InfSet Ξ±] : InfSet (WithBot Ξ±) := ⟨(WithTop.instSupSet (Ξ± := Ξ±α΅’α΅ˆ)).sSup⟩ theorem WithTop.sSup_eq [SupSet Ξ±] {s : Set (WithTop Ξ±)} (hs : ⊀ βˆ‰ s) (hs' : BddAbove ((↑) ⁻¹' s : Set Ξ±)) : sSup s = ↑(sSup ((↑) ⁻¹' s) : Ξ±) := (if_neg hs).trans <| if_pos hs' #align with_top.Sup_eq WithTop.sSup_eq theorem WithTop.sInf_eq [InfSet Ξ±] {s : Set (WithTop Ξ±)} (hs : Β¬s βŠ† {⊀}) (h's : BddBelow s) : sInf s = ↑(sInf ((↑) ⁻¹' s) : Ξ±) := if_neg <| by simp [hs, h's] #align with_top.Inf_eq WithTop.sInf_eq theorem WithBot.sInf_eq [InfSet Ξ±] {s : Set (WithBot Ξ±)} (hs : βŠ₯ βˆ‰ s) (hs' : BddBelow ((↑) ⁻¹' s : Set Ξ±)) : sInf s = ↑(sInf ((↑) ⁻¹' s) : Ξ±) := (if_neg hs).trans <| if_pos hs' #align with_bot.Inf_eq WithBot.sInf_eq theorem WithBot.sSup_eq [SupSet Ξ±] {s : Set (WithBot Ξ±)} (hs : Β¬s βŠ† {βŠ₯}) (h's : BddAbove s) : sSup s = ↑(sSup ((↑) ⁻¹' s) : Ξ±) := WithTop.sInf_eq (Ξ± := Ξ±α΅’α΅ˆ) hs h's #align with_bot.Sup_eq WithBot.sSup_eq @[simp] theorem WithTop.sInf_empty [InfSet Ξ±] : sInf (βˆ… : Set (WithTop Ξ±)) = ⊀ := if_pos <| by simp #align with_top.cInf_empty WithTop.sInf_empty @[simp] theorem WithTop.iInf_empty [IsEmpty ΞΉ] [InfSet Ξ±] (f : ΞΉ β†’ WithTop Ξ±) : β¨… i, f i = ⊀ := by rw [iInf, range_eq_empty, WithTop.sInf_empty] #align with_top.cinfi_empty WithTop.iInf_empty theorem WithTop.coe_sInf' [InfSet Ξ±] {s : Set Ξ±} (hs : s.Nonempty) (h's : BddBelow s) : ↑(sInf s) = (sInf ((fun (a : Ξ±) ↦ ↑a) '' s) : WithTop Ξ±) := by obtain ⟨x, hx⟩ := hs change _ = ite _ _ _ split_ifs with h Β· rcases h with h1 | h2 Β· cases h1 (mem_image_of_mem _ hx) Β· exact (h2 (Monotone.map_bddBelow coe_mono h's)).elim Β· rw [preimage_image_eq] exact Option.some_injective _ #align with_top.coe_Inf' WithTop.coe_sInf' -- Porting note: the mathlib3 proof uses `range_comp` in the opposite direction and -- does not need `rfl`. @[norm_cast] theorem WithTop.coe_iInf [Nonempty ΞΉ] [InfSet Ξ±] {f : ΞΉ β†’ Ξ±} (hf : BddBelow (range f)) : ↑(β¨… i, f i) = (β¨… i, f i : WithTop Ξ±) := by rw [iInf, iInf, WithTop.coe_sInf' (range_nonempty f) hf, ← range_comp] rfl #align with_top.coe_infi WithTop.coe_iInf theorem WithTop.coe_sSup' [SupSet Ξ±] {s : Set Ξ±} (hs : BddAbove s) : ↑(sSup s) = (sSup ((fun (a : Ξ±) ↦ ↑a) '' s) : WithTop Ξ±) := by change _ = ite _ _ _ rw [if_neg, preimage_image_eq, if_pos hs] Β· exact Option.some_injective _ Β· rintro ⟨x, _, ⟨⟩⟩ #align with_top.coe_Sup' WithTop.coe_sSup' -- Porting note: the mathlib3 proof uses `range_comp` in the opposite direction and -- does not need `rfl`. @[norm_cast]
Mathlib/Order/ConditionallyCompleteLattice/Basic.lean
127
129
theorem WithTop.coe_iSup [SupSet Ξ±] (f : ΞΉ β†’ Ξ±) (h : BddAbove (Set.range f)) : ↑(⨆ i, f i) = (⨆ i, f i : WithTop Ξ±) := by
rw [iSup, iSup, WithTop.coe_sSup' h, ← range_comp]; rfl
1
import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.Tactic.FieldSimp #align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open AffineMap variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE] def slope (f : k β†’ PE) (a b : k) : E := (b - a)⁻¹ β€’ (f b -α΅₯ f a) #align slope slope theorem slope_fun_def (f : k β†’ PE) : slope f = fun a b => (b - a)⁻¹ β€’ (f b -α΅₯ f a) := rfl #align slope_fun_def slope_fun_def theorem slope_def_field (f : k β†’ k) (a b : k) : slope f a b = (f b - f a) / (b - a) := (div_eq_inv_mul _ _).symm #align slope_def_field slope_def_field theorem slope_fun_def_field (f : k β†’ k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) := (div_eq_inv_mul _ _).symm #align slope_fun_def_field slope_fun_def_field @[simp] theorem slope_same (f : k β†’ PE) (a : k) : (slope f a a : E) = 0 := by rw [slope, sub_self, inv_zero, zero_smul] #align slope_same slope_same theorem slope_def_module (f : k β†’ E) (a b : k) : slope f a b = (b - a)⁻¹ β€’ (f b - f a) := rfl #align slope_def_module slope_def_module @[simp] theorem sub_smul_slope (f : k β†’ PE) (a b : k) : (b - a) β€’ slope f a b = f b -α΅₯ f a := by rcases eq_or_ne a b with (rfl | hne) Β· rw [sub_self, zero_smul, vsub_self] Β· rw [slope, smul_inv_smulβ‚€ (sub_ne_zero.2 hne.symm)] #align sub_smul_slope sub_smul_slope theorem sub_smul_slope_vadd (f : k β†’ PE) (a b : k) : (b - a) β€’ slope f a b +α΅₯ f a = f b := by rw [sub_smul_slope, vsub_vadd] #align sub_smul_slope_vadd sub_smul_slope_vadd @[simp] theorem slope_vadd_const (f : k β†’ E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by ext a b simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub] #align slope_vadd_const slope_vadd_const @[simp] theorem slope_sub_smul (f : k β†’ E) {a b : k} (h : a β‰  b) : slope (fun x => (x - a) β€’ f x) a b = f b := by simp [slope, inv_smul_smulβ‚€ (sub_ne_zero.2 h.symm)] #align slope_sub_smul slope_sub_smul
Mathlib/LinearAlgebra/AffineSpace/Slope.lean
78
79
theorem eq_of_slope_eq_zero {f : k β†’ PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [← sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
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
.lake/packages/batteries/Batteries/Data/Nat/Lemmas.lean
74
79
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
1
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Linear import Mathlib.Analysis.Complex.Conformal import Mathlib.Analysis.Calculus.Conformal.NormedSpace #align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" section RealDerivOfComplex open Complex variable {e : β„‚ β†’ β„‚} {e' : β„‚} {z : ℝ} theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) : HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasStrictFDerivAt ((↑) : ℝ β†’ β„‚) ofRealCLM z := ofRealCLM.hasStrictFDerivAt have B : HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : β„‚ β†’L[β„‚] β„‚).restrictScalars ℝ) (ofRealCLM z) := h.hasStrictFDerivAt.restrictScalars ℝ have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasStrictDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_strict_deriv_at.real_of_complex HasStrictDerivAt.real_of_complex theorem HasDerivAt.real_of_complex (h : HasDerivAt e e' z) : HasDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasFDerivAt ((↑) : ℝ β†’ β„‚) ofRealCLM z := ofRealCLM.hasFDerivAt have B : HasFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : β„‚ β†’L[β„‚] β„‚).restrictScalars ℝ) (ofRealCLM z) := h.hasFDerivAt.restrictScalars ℝ have C : HasFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_deriv_at.real_of_complex HasDerivAt.real_of_complex theorem ContDiffAt.real_of_complex {n : β„•βˆž} (h : ContDiffAt β„‚ n e z) : ContDiffAt ℝ n (fun x : ℝ => (e x).re) z := by have A : ContDiffAt ℝ n ((↑) : ℝ β†’ β„‚) z := ofRealCLM.contDiff.contDiffAt have B : ContDiffAt ℝ n e z := h.restrict_scalars ℝ have C : ContDiffAt ℝ n re (e z) := reCLM.contDiff.contDiffAt exact C.comp z (B.comp z A) #align cont_diff_at.real_of_complex ContDiffAt.real_of_complex theorem ContDiff.real_of_complex {n : β„•βˆž} (h : ContDiff β„‚ n e) : ContDiff ℝ n fun x : ℝ => (e x).re := contDiff_iff_contDiffAt.2 fun _ => h.contDiffAt.real_of_complex #align cont_diff.real_of_complex ContDiff.real_of_complex variable {E : Type*} [NormedAddCommGroup E] [NormedSpace β„‚ E] theorem HasStrictDerivAt.complexToReal_fderiv' {f : β„‚ β†’ E} {x : β„‚} {f' : E} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (reCLM.smulRight f' + I β€’ imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasStrictFDerivAt.restrictScalars ℝ #align has_strict_deriv_at.complex_to_real_fderiv' HasStrictDerivAt.complexToReal_fderiv' theorem HasDerivAt.complexToReal_fderiv' {f : β„‚ β†’ E} {x : β„‚} {f' : E} (h : HasDerivAt f f' x) : HasFDerivAt f (reCLM.smulRight f' + I β€’ imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivAt.restrictScalars ℝ #align has_deriv_at.complex_to_real_fderiv' HasDerivAt.complexToReal_fderiv' theorem HasDerivWithinAt.complexToReal_fderiv' {f : β„‚ β†’ E} {s : Set β„‚} {x : β„‚} {f' : E} (h : HasDerivWithinAt f f' s x) : HasFDerivWithinAt f (reCLM.smulRight f' + I β€’ imCLM.smulRight f') s x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivWithinAt.restrictScalars ℝ #align has_deriv_within_at.complex_to_real_fderiv' HasDerivWithinAt.complexToReal_fderiv'
Mathlib/Analysis/Complex/RealDeriv.lean
118
120
theorem HasStrictDerivAt.complexToReal_fderiv {f : β„‚ β†’ β„‚} {f' x : β„‚} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (f' β€’ (1 : β„‚ β†’L[ℝ] β„‚)) x := by
simpa only [Complex.restrictScalars_one_smulRight] using h.hasStrictFDerivAt.restrictScalars ℝ
1
import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Ideal.Operations namespace Submodule open Pointwise variable {R M M' F G : Type*} [CommRing R] [AddCommGroup M] [Module R M] variable {N N₁ Nβ‚‚ P P₁ Pβ‚‚ : Submodule R M} def colon (N P : Submodule R M) : Ideal R := annihilator (P.map N.mkQ) #align submodule.colon Submodule.colon theorem mem_colon {r} : r ∈ N.colon P ↔ βˆ€ p ∈ P, r β€’ p ∈ N := mem_annihilator.trans ⟨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)), fun H _ ⟨p, hp, hpm⟩ => hpm β–Έ ((Quotient.mk_eq_zero N).2 <| H p hp)⟩ #align submodule.mem_colon Submodule.mem_colon theorem mem_colon' {r} : r ∈ N.colon P ↔ P ≀ comap (r β€’ (LinearMap.id : M β†’β‚—[R] M)) N := mem_colon #align submodule.mem_colon' Submodule.mem_colon' @[simp] theorem colon_top {I : Ideal R} : I.colon ⊀ = I := by simp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul] exact fun x ↦ ⟨fun h ↦ mul_one x β–Έ h 1 trivial, fun h _ _ ↦ I.mul_mem_right _ h⟩ @[simp] theorem colon_bot : colon βŠ₯ N = N.annihilator := by simp_rw [SetLike.ext_iff, mem_colon, mem_annihilator, mem_bot, forall_const] theorem colon_mono (hn : N₁ ≀ Nβ‚‚) (hp : P₁ ≀ Pβ‚‚) : N₁.colon Pβ‚‚ ≀ Nβ‚‚.colon P₁ := fun _ hrnp => mem_colon.2 fun p₁ hp₁ => hn <| mem_colon.1 hrnp p₁ <| hp hp₁ #align submodule.colon_mono Submodule.colon_mono theorem iInf_colon_iSup (ι₁ : Sort*) (f : ι₁ β†’ Submodule R M) (ΞΉβ‚‚ : Sort*) (g : ΞΉβ‚‚ β†’ Submodule R M) : (β¨… i, f i).colon (⨆ j, g j) = β¨… (i) (j), (f i).colon (g j) := le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H => mem_colon'.2 <| iSup_le fun j => map_le_iff_le_comap.1 <| le_iInf fun i => map_le_iff_le_comap.2 <| mem_colon'.1 <| have := (mem_iInf _).1 H i have := (mem_iInf _).1 this j this #align submodule.infi_colon_supr Submodule.iInf_colon_iSup @[simp] theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} : r ∈ N.colon (Submodule.span R {x}) ↔ r β€’ x ∈ N := calc r ∈ N.colon (Submodule.span R {x}) ↔ βˆ€ a : R, r β€’ a β€’ x ∈ N := by simp [Submodule.mem_colon, Submodule.mem_span_singleton] _ ↔ r β€’ x ∈ N := by simp_rw [fun (a : R) ↦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff #align submodule.mem_colon_singleton Submodule.mem_colon_singleton @[simp]
Mathlib/RingTheory/Ideal/Colon.lean
76
78
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} : r ∈ I.colon (Ideal.span {x}) ↔ r * x ∈ I := by
simp only [← Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
1
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset import Mathlib.Data.Finite.Card import Mathlib.GroupTheory.Finiteness import Mathlib.GroupTheory.GroupAction.Quotient #align_import group_theory.index from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace Subgroup open Cardinal variable {G : Type*} [Group G] (H K L : Subgroup G) @[to_additive "The index of a subgroup as a natural number, and returns 0 if the index is infinite."] noncomputable def index : β„• := Nat.card (G β§Έ H) #align subgroup.index Subgroup.index #align add_subgroup.index AddSubgroup.index @[to_additive "The relative index of a subgroup as a natural number, and returns 0 if the relative index is infinite."] noncomputable def relindex : β„• := (H.subgroupOf K).index #align subgroup.relindex Subgroup.relindex #align add_subgroup.relindex AddSubgroup.relindex @[to_additive] theorem index_comap_of_surjective {G' : Type*} [Group G'] {f : G' β†’* G} (hf : Function.Surjective f) : (H.comap f).index = H.index := by letI := QuotientGroup.leftRel H letI := QuotientGroup.leftRel (H.comap f) have key : βˆ€ x y : G', Setoid.r x y ↔ Setoid.r (f x) (f y) := by simp only [QuotientGroup.leftRel_apply] exact fun x y => iff_of_eq (congr_arg (Β· ∈ H) (by rw [f.map_mul, f.map_inv])) refine Cardinal.toNat_congr (Equiv.ofBijective (Quotient.map' f fun x y => (key x y).mp) ⟨?_, ?_⟩) Β· simp_rw [← Quotient.eq''] at key refine Quotient.ind' fun x => ?_ refine Quotient.ind' fun y => ?_ exact (key x y).mpr Β· refine Quotient.ind' fun x => ?_ obtain ⟨y, hy⟩ := hf x exact ⟨y, (Quotient.map'_mk'' f _ y).trans (congr_arg Quotient.mk'' hy)⟩ #align subgroup.index_comap_of_surjective Subgroup.index_comap_of_surjective #align add_subgroup.index_comap_of_surjective AddSubgroup.index_comap_of_surjective @[to_additive] theorem index_comap {G' : Type*} [Group G'] (f : G' β†’* G) : (H.comap f).index = H.relindex f.range := Eq.trans (congr_arg index (by rfl)) ((H.subgroupOf f.range).index_comap_of_surjective f.rangeRestrict_surjective) #align subgroup.index_comap Subgroup.index_comap #align add_subgroup.index_comap AddSubgroup.index_comap @[to_additive] theorem relindex_comap {G' : Type*} [Group G'] (f : G' β†’* G) (K : Subgroup G') : relindex (comap f H) K = relindex H (map f K) := by rw [relindex, subgroupOf, comap_comap, index_comap, ← f.map_range, K.subtype_range] #align subgroup.relindex_comap Subgroup.relindex_comap #align add_subgroup.relindex_comap AddSubgroup.relindex_comap variable {H K L} @[to_additive relindex_mul_index] theorem relindex_mul_index (h : H ≀ K) : H.relindex K * K.index = H.index := ((mul_comm _ _).trans (Cardinal.toNat_mul _ _).symm).trans (congr_arg Cardinal.toNat (Equiv.cardinal_eq (quotientEquivProdOfLE h))).symm #align subgroup.relindex_mul_index Subgroup.relindex_mul_index #align add_subgroup.relindex_mul_index AddSubgroup.relindex_mul_index @[to_additive] theorem index_dvd_of_le (h : H ≀ K) : K.index ∣ H.index := dvd_of_mul_left_eq (H.relindex K) (relindex_mul_index h) #align subgroup.index_dvd_of_le Subgroup.index_dvd_of_le #align add_subgroup.index_dvd_of_le AddSubgroup.index_dvd_of_le @[to_additive] theorem relindex_dvd_index_of_le (h : H ≀ K) : H.relindex K ∣ H.index := dvd_of_mul_right_eq K.index (relindex_mul_index h) #align subgroup.relindex_dvd_index_of_le Subgroup.relindex_dvd_index_of_le #align add_subgroup.relindex_dvd_index_of_le AddSubgroup.relindex_dvd_index_of_le @[to_additive] theorem relindex_subgroupOf (hKL : K ≀ L) : (H.subgroupOf L).relindex (K.subgroupOf L) = H.relindex K := ((index_comap (H.subgroupOf L) (inclusion hKL)).trans (congr_arg _ (inclusion_range hKL))).symm #align subgroup.relindex_subgroup_of Subgroup.relindex_subgroupOf #align add_subgroup.relindex_add_subgroup_of AddSubgroup.relindex_addSubgroupOf variable (H K L) @[to_additive relindex_mul_relindex] theorem relindex_mul_relindex (hHK : H ≀ K) (hKL : K ≀ L) : H.relindex K * K.relindex L = H.relindex L := by rw [← relindex_subgroupOf hKL] exact relindex_mul_index fun x hx => hHK hx #align subgroup.relindex_mul_relindex Subgroup.relindex_mul_relindex #align add_subgroup.relindex_mul_relindex AddSubgroup.relindex_mul_relindex @[to_additive] theorem inf_relindex_right : (H βŠ“ K).relindex K = H.relindex K := by rw [relindex, relindex, inf_subgroupOf_right] #align subgroup.inf_relindex_right Subgroup.inf_relindex_right #align add_subgroup.inf_relindex_right AddSubgroup.inf_relindex_right @[to_additive]
Mathlib/GroupTheory/Index.lean
140
141
theorem inf_relindex_left : (H βŠ“ K).relindex H = K.relindex H := by
rw [inf_comm, inf_relindex_right]
1
import Mathlib.Data.Fintype.Card import Mathlib.Order.UpperLower.Basic #align_import combinatorics.set_family.intersecting from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46" open Finset variable {Ξ± : Type*} namespace Set section SemilatticeInf variable [SemilatticeInf Ξ±] [OrderBot Ξ±] {s t : Set Ξ±} {a b c : Ξ±} def Intersecting (s : Set Ξ±) : Prop := βˆ€ ⦃a⦄, a ∈ s β†’ βˆ€ ⦃b⦄, b ∈ s β†’ Β¬Disjoint a b #align set.intersecting Set.Intersecting @[mono] theorem Intersecting.mono (h : t βŠ† s) (hs : s.Intersecting) : t.Intersecting := fun _a ha _b hb => hs (h ha) (h hb) #align set.intersecting.mono Set.Intersecting.mono theorem Intersecting.not_bot_mem (hs : s.Intersecting) : βŠ₯ βˆ‰ s := fun h => hs h h disjoint_bot_left #align set.intersecting.not_bot_mem Set.Intersecting.not_bot_mem theorem Intersecting.ne_bot (hs : s.Intersecting) (ha : a ∈ s) : a β‰  βŠ₯ := ne_of_mem_of_not_mem ha hs.not_bot_mem #align set.intersecting.ne_bot Set.Intersecting.ne_bot theorem intersecting_empty : (βˆ… : Set Ξ±).Intersecting := fun _ => False.elim #align set.intersecting_empty Set.intersecting_empty @[simp]
Mathlib/Combinatorics/SetFamily/Intersecting.lean
61
61
theorem intersecting_singleton : ({a} : Set Ξ±).Intersecting ↔ a β‰  βŠ₯ := by
simp [Intersecting]
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] theorem leftUnitor_inv_tensor_id (X Y : C) : (Ξ»_ X).inv βŠ— πŸ™ Y = (Ξ»_ _).inv ≫ (Ξ±_ _ _ _).inv := by coherence #align category_theory.monoidal_category.left_unitor_inv_tensor_id CategoryTheory.MonoidalCategory.leftUnitor_inv_tensor_id @[reassoc]
Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean
57
60
theorem pentagon_inv_inv_hom (W X Y Z : C) : (Ξ±_ W (X βŠ— Y) Z).inv ≫ ((Ξ±_ W X Y).inv βŠ— πŸ™ Z) ≫ (Ξ±_ (W βŠ— X) Y Z).hom = (πŸ™ W βŠ— (Ξ±_ X Y Z).hom) ≫ (Ξ±_ W X (Y βŠ— Z)).inv := by
coherence
1
import Mathlib.MeasureTheory.Measure.VectorMeasure import Mathlib.MeasureTheory.Function.AEEqOfIntegral #align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1" noncomputable section open scoped Classical MeasureTheory NNReal ENNReal variable {Ξ± Ξ² : Type*} {m : MeasurableSpace Ξ±} namespace MeasureTheory open TopologicalSpace variable {ΞΌ Ξ½ : Measure Ξ±} variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] def Measure.withDensityα΅₯ {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (f : Ξ± β†’ E) : VectorMeasure Ξ± E := if hf : Integrable f ΞΌ then { measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x βˆ‚ΞΌ else 0 empty' := by simp not_measurable' := fun s hs => if_neg hs m_iUnion' := fun s hs₁ hsβ‚‚ => by dsimp only convert hasSum_integral_iUnion hs₁ hsβ‚‚ hf.integrableOn with n Β· rw [if_pos (hs₁ n)] Β· rw [if_pos (MeasurableSet.iUnion hs₁)] } else 0 #align measure_theory.measure.with_densityα΅₯ MeasureTheory.Measure.withDensityα΅₯ open Measure variable {f g : Ξ± β†’ E} theorem withDensityα΅₯_apply (hf : Integrable f ΞΌ) {s : Set Ξ±} (hs : MeasurableSet s) : ΞΌ.withDensityα΅₯ f s = ∫ x in s, f x βˆ‚ΞΌ := by rw [withDensityα΅₯, dif_pos hf]; exact dif_pos hs #align measure_theory.with_densityα΅₯_apply MeasureTheory.withDensityα΅₯_apply @[simp] theorem withDensityα΅₯_zero : ΞΌ.withDensityα΅₯ (0 : Ξ± β†’ E) = 0 := by ext1 s hs; erw [withDensityα΅₯_apply (integrable_zero Ξ± E ΞΌ) hs]; simp #align measure_theory.with_densityα΅₯_zero MeasureTheory.withDensityα΅₯_zero @[simp] theorem withDensityα΅₯_neg : ΞΌ.withDensityα΅₯ (-f) = -ΞΌ.withDensityα΅₯ f := by by_cases hf : Integrable f ΞΌ Β· ext1 i hi rw [VectorMeasure.neg_apply, withDensityα΅₯_apply hf hi, ← integral_neg, withDensityα΅₯_apply hf.neg hi] rfl Β· rw [withDensityα΅₯, withDensityα΅₯, dif_neg hf, dif_neg, neg_zero] rwa [integrable_neg_iff] #align measure_theory.with_densityα΅₯_neg MeasureTheory.withDensityα΅₯_neg theorem withDensityα΅₯_neg' : (ΞΌ.withDensityα΅₯ fun x => -f x) = -ΞΌ.withDensityα΅₯ f := withDensityα΅₯_neg #align measure_theory.with_densityα΅₯_neg' MeasureTheory.withDensityα΅₯_neg' @[simp] theorem withDensityα΅₯_add (hf : Integrable f ΞΌ) (hg : Integrable g ΞΌ) : ΞΌ.withDensityα΅₯ (f + g) = ΞΌ.withDensityα΅₯ f + ΞΌ.withDensityα΅₯ g := by ext1 i hi rw [withDensityα΅₯_apply (hf.add hg) hi, VectorMeasure.add_apply, withDensityα΅₯_apply hf hi, withDensityα΅₯_apply hg hi] simp_rw [Pi.add_apply] rw [integral_add] <;> rw [← integrableOn_univ] Β· exact hf.integrableOn.restrict MeasurableSet.univ Β· exact hg.integrableOn.restrict MeasurableSet.univ #align measure_theory.with_densityα΅₯_add MeasureTheory.withDensityα΅₯_add theorem withDensityα΅₯_add' (hf : Integrable f ΞΌ) (hg : Integrable g ΞΌ) : (ΞΌ.withDensityα΅₯ fun x => f x + g x) = ΞΌ.withDensityα΅₯ f + ΞΌ.withDensityα΅₯ g := withDensityα΅₯_add hf hg #align measure_theory.with_densityα΅₯_add' MeasureTheory.withDensityα΅₯_add' @[simp]
Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean
101
103
theorem withDensityα΅₯_sub (hf : Integrable f ΞΌ) (hg : Integrable g ΞΌ) : ΞΌ.withDensityα΅₯ (f - g) = ΞΌ.withDensityα΅₯ f - ΞΌ.withDensityα΅₯ g := by
rw [sub_eq_add_neg, sub_eq_add_neg, withDensityα΅₯_add hf hg.neg, withDensityα΅₯_neg]
1
import Mathlib.Algebra.Polynomial.Eval import Mathlib.RingTheory.Ideal.Quotient #align_import linear_algebra.smodeq from "leanprover-community/mathlib"@"146d3d1fa59c091fedaad8a4afa09d6802886d24" open Submodule open Polynomial variable {R : Type*} [Ring R] variable {A : Type*} [CommRing A] variable {M : Type*} [AddCommGroup M] [Module R M] (U U₁ Uβ‚‚ : Submodule R M) variable {x x₁ xβ‚‚ y y₁ yβ‚‚ z z₁ zβ‚‚ : M} variable {N : Type*} [AddCommGroup N] [Module R N] (V V₁ Vβ‚‚ : Submodule R N) set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 def SModEq (x y : M) : Prop := (Submodule.Quotient.mk x : M β§Έ U) = Submodule.Quotient.mk y #align smodeq SModEq notation:50 x " ≑ " y " [SMOD " N "]" => SModEq N x y variable {U U₁ Uβ‚‚} set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 protected theorem SModEq.def : x ≑ y [SMOD U] ↔ (Submodule.Quotient.mk x : M β§Έ U) = Submodule.Quotient.mk y := Iff.rfl #align smodeq.def SModEq.def namespace SModEq
Mathlib/LinearAlgebra/SModEq.lean
44
44
theorem sub_mem : x ≑ y [SMOD U] ↔ x - y ∈ U := by
rw [SModEq.def, Submodule.Quotient.eq]
1
import Mathlib.Algebra.Order.Group.Abs import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Group.OrderIso import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Data.Int.Cast.Lemmas import Mathlib.Order.Interval.Set.Basic import Mathlib.Logic.Pairwise #align_import data.set.intervals.group from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" variable {Ξ± : Type*} namespace Set section PairwiseDisjoint section OrderedCommGroup variable [OrderedCommGroup Ξ±] (a b : Ξ±) @[to_additive] theorem pairwise_disjoint_Ioc_mul_zpow : Pairwise (Disjoint on fun n : β„€ => Ioc (a * b ^ n) (a * b ^ (n + 1))) := by simp (config := { unfoldPartialApp := true }) only [Function.onFun] simp_rw [Set.disjoint_iff] intro m n hmn x hx apply hmn have hb : 1 < b := by have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_le hx.1.2 rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this have i1 := hx.1.1.trans_le hx.2.2 have i2 := hx.2.1.trans_le hx.1.2 rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2 exact le_antisymm i1 i2 #align set.pairwise_disjoint_Ioc_mul_zpow Set.pairwise_disjoint_Ioc_mul_zpow #align set.pairwise_disjoint_Ioc_add_zsmul Set.pairwise_disjoint_Ioc_add_zsmul @[to_additive] theorem pairwise_disjoint_Ico_mul_zpow : Pairwise (Disjoint on fun n : β„€ => Ico (a * b ^ n) (a * b ^ (n + 1))) := by simp (config := { unfoldPartialApp := true }) only [Function.onFun] simp_rw [Set.disjoint_iff] intro m n hmn x hx apply hmn have hb : 1 < b := by have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_lt hx.1.2 rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this have i1 := hx.1.1.trans_lt hx.2.2 have i2 := hx.2.1.trans_lt hx.1.2 rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2 exact le_antisymm i1 i2 #align set.pairwise_disjoint_Ico_mul_zpow Set.pairwise_disjoint_Ico_mul_zpow #align set.pairwise_disjoint_Ico_add_zsmul Set.pairwise_disjoint_Ico_add_zsmul @[to_additive] theorem pairwise_disjoint_Ioo_mul_zpow : Pairwise (Disjoint on fun n : β„€ => Ioo (a * b ^ n) (a * b ^ (n + 1))) := fun _ _ hmn => (pairwise_disjoint_Ioc_mul_zpow a b hmn).mono Ioo_subset_Ioc_self Ioo_subset_Ioc_self #align set.pairwise_disjoint_Ioo_mul_zpow Set.pairwise_disjoint_Ioo_mul_zpow #align set.pairwise_disjoint_Ioo_add_zsmul Set.pairwise_disjoint_Ioo_add_zsmul @[to_additive] theorem pairwise_disjoint_Ioc_zpow : Pairwise (Disjoint on fun n : β„€ => Ioc (b ^ n) (b ^ (n + 1))) := by simpa only [one_mul] using pairwise_disjoint_Ioc_mul_zpow 1 b #align set.pairwise_disjoint_Ioc_zpow Set.pairwise_disjoint_Ioc_zpow #align set.pairwise_disjoint_Ioc_zsmul Set.pairwise_disjoint_Ioc_zsmul @[to_additive] theorem pairwise_disjoint_Ico_zpow : Pairwise (Disjoint on fun n : β„€ => Ico (b ^ n) (b ^ (n + 1))) := by simpa only [one_mul] using pairwise_disjoint_Ico_mul_zpow 1 b #align set.pairwise_disjoint_Ico_zpow Set.pairwise_disjoint_Ico_zpow #align set.pairwise_disjoint_Ico_zsmul Set.pairwise_disjoint_Ico_zsmul @[to_additive]
Mathlib/Algebra/Order/Interval/Set/Group.lean
226
228
theorem pairwise_disjoint_Ioo_zpow : Pairwise (Disjoint on fun n : β„€ => Ioo (b ^ n) (b ^ (n + 1))) := by
simpa only [one_mul] using pairwise_disjoint_Ioo_mul_zpow 1 b
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.CharZero.Lemmas import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Tree.Basic import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.GCongr import Mathlib.Tactic.Positivity #align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da" open Finset open Finset.antidiagonal (fst_le snd_le) def catalan : β„• β†’ β„• | 0 => 1 | n + 1 => βˆ‘ i : Fin n.succ, catalan i * catalan (n - i) #align catalan catalan @[simp] theorem catalan_zero : catalan 0 = 1 := by rw [catalan] #align catalan_zero catalan_zero
Mathlib/Combinatorics/Enumerative/Catalan.lean
68
69
theorem catalan_succ (n : β„•) : catalan (n + 1) = βˆ‘ i : Fin n.succ, catalan i * catalan (n - i) := by
rw [catalan]
1
import Mathlib.Data.Finsupp.Encodable import Mathlib.LinearAlgebra.Pi import Mathlib.LinearAlgebra.Span import Mathlib.Data.Set.Countable #align_import linear_algebra.finsupp from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" noncomputable section open Set LinearMap Submodule namespace Finsupp variable {Ξ± : Type*} {M : Type*} {N : Type*} {P : Type*} {R : Type*} {S : Type*} variable [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M] variable [AddCommMonoid N] [Module R N] variable [AddCommMonoid P] [Module R P] def lsingle (a : Ξ±) : M β†’β‚—[R] Ξ± β†’β‚€ M := { Finsupp.singleAddHom a with map_smul' := fun _ _ => (smul_single _ _ _).symm } #align finsupp.lsingle Finsupp.lsingle theorem lhom_ext ⦃φ ψ : (Ξ± β†’β‚€ M) β†’β‚—[R] N⦄ (h : βˆ€ a b, Ο† (single a b) = ψ (single a b)) : Ο† = ψ := LinearMap.toAddMonoidHom_injective <| addHom_ext h #align finsupp.lhom_ext Finsupp.lhom_ext -- Porting note: The priority should be higher than `LinearMap.ext`. @[ext high] theorem lhom_ext' ⦃φ ψ : (Ξ± β†’β‚€ M) β†’β‚—[R] N⦄ (h : βˆ€ a, Ο†.comp (lsingle a) = ψ.comp (lsingle a)) : Ο† = ψ := lhom_ext fun a => LinearMap.congr_fun (h a) #align finsupp.lhom_ext' Finsupp.lhom_ext' def lapply (a : Ξ±) : (Ξ± β†’β‚€ M) β†’β‚—[R] M := { Finsupp.applyAddHom a with map_smul' := fun _ _ => rfl } #align finsupp.lapply Finsupp.lapply @[simps] def lcoeFun : (Ξ± β†’β‚€ M) β†’β‚—[R] Ξ± β†’ M where toFun := (⇑) map_add' x y := by ext simp map_smul' x y := by ext simp #align finsupp.lcoe_fun Finsupp.lcoeFun @[simp] theorem lsingle_apply (a : Ξ±) (b : M) : (lsingle a : M β†’β‚—[R] Ξ± β†’β‚€ M) b = single a b := rfl #align finsupp.lsingle_apply Finsupp.lsingle_apply @[simp] theorem lapply_apply (a : Ξ±) (f : Ξ± β†’β‚€ M) : (lapply a : (Ξ± β†’β‚€ M) β†’β‚—[R] M) f = f a := rfl #align finsupp.lapply_apply Finsupp.lapply_apply @[simp] theorem lapply_comp_lsingle_same (a : Ξ±) : lapply a βˆ˜β‚— lsingle a = (.id : M β†’β‚—[R] M) := by ext; simp @[simp]
Mathlib/LinearAlgebra/Finsupp.lean
237
238
theorem lapply_comp_lsingle_of_ne (a a' : Ξ±) (h : a β‰  a') : lapply a βˆ˜β‚— lsingle a' = (0 : M β†’β‚—[R] M) := by
ext; simp [h.symm]
1
import Mathlib.Algebra.Module.Submodule.Map #align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" open Function open Pointwise variable {R : Type*} {R₁ : Type*} {Rβ‚‚ : Type*} {R₃ : Type*} variable {K : Type*} variable {M : Type*} {M₁ : Type*} {Mβ‚‚ : Type*} {M₃ : Type*} variable {V : Type*} {Vβ‚‚ : Type*} namespace LinearMap section AddCommMonoid variable [Semiring R] [Semiring Rβ‚‚] [Semiring R₃] variable [AddCommMonoid M] [AddCommMonoid Mβ‚‚] [AddCommMonoid M₃] variable {σ₁₂ : R β†’+* Rβ‚‚} {σ₂₃ : Rβ‚‚ β†’+* R₃} {σ₁₃ : R β†’+* R₃} variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] variable [Module R M] [Module Rβ‚‚ Mβ‚‚] [Module R₃ M₃] open Submodule variable {σ₂₁ : Rβ‚‚ β†’+* R} {τ₁₂ : R β†’+* Rβ‚‚} {τ₂₃ : Rβ‚‚ β†’+* R₃} {τ₁₃ : R β†’+* R₃} variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃] variable {F : Type*} [FunLike F M Mβ‚‚] [SemilinearMapClass F τ₁₂ M Mβ‚‚] def ker (f : F) : Submodule R M := comap f βŠ₯ #align linear_map.ker LinearMap.ker @[simp] theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 := mem_bot Rβ‚‚ #align linear_map.mem_ker LinearMap.mem_ker @[simp] theorem ker_id : ker (LinearMap.id : M β†’β‚—[R] M) = βŠ₯ := rfl #align linear_map.ker_id LinearMap.ker_id @[simp] theorem map_coe_ker (f : F) (x : ker f) : f x = 0 := mem_ker.1 x.2 #align linear_map.map_coe_ker LinearMap.map_coe_ker theorem ker_toAddSubmonoid (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) := rfl #align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid theorem comp_ker_subtype (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) : f.comp f.ker.subtype = 0 := LinearMap.ext fun x => mem_ker.1 x.2 #align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype theorem ker_comp (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) (g : Mβ‚‚ β†’β‚›β‚—[τ₂₃] M₃) : ker (g.comp f : M β†’β‚›β‚—[τ₁₃] M₃) = comap f (ker g) := rfl #align linear_map.ker_comp LinearMap.ker_comp theorem ker_le_ker_comp (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) (g : Mβ‚‚ β†’β‚›β‚—[τ₂₃] M₃) : ker f ≀ ker (g.comp f : M β†’β‚›β‚—[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le #align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp theorem ker_sup_ker_le_ker_comp_of_commute {f g : M β†’β‚—[R] M} (h : Commute f g) : ker f βŠ” ker g ≀ ker (f βˆ˜β‚— g) := by refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩ rw [← mul_eq_comp, h.eq, mul_eq_comp] exact ker_le_ker_comp f g @[simp] theorem ker_le_comap {p : Submodule Rβ‚‚ Mβ‚‚} (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) : ker f ≀ p.comap f := fun x hx ↦ by simp [mem_ker.mp hx] theorem disjoint_ker {f : F} {p : Submodule R M} : Disjoint p (ker f) ↔ βˆ€ x ∈ p, f x = 0 β†’ x = 0 := by simp [disjoint_def] #align linear_map.disjoint_ker LinearMap.disjoint_ker theorem ker_eq_bot' {f : F} : ker f = βŠ₯ ↔ βˆ€ m, f m = 0 β†’ m = 0 := by simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊀) #align linear_map.ker_eq_bot' LinearMap.ker_eq_bot' theorem ker_eq_bot_of_inverse {τ₂₁ : Rβ‚‚ β†’+* R} [RingHomInvPair τ₁₂ τ₂₁] {f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚} {g : Mβ‚‚ β†’β‚›β‚—[τ₂₁] M} (h : (g.comp f : M β†’β‚—[R] M) = id) : ker f = βŠ₯ := ker_eq_bot'.2 fun m hm => by rw [← id_apply (R := R) m, ← h, comp_apply, hm, g.map_zero] #align linear_map.ker_eq_bot_of_inverse LinearMap.ker_eq_bot_of_inverse theorem le_ker_iff_map [RingHomSurjective τ₁₂] {f : F} {p : Submodule R M} : p ≀ ker f ↔ map f p = βŠ₯ := by rw [ker, eq_bot_iff, map_le_iff_le_comap] #align linear_map.le_ker_iff_map LinearMap.le_ker_iff_map
Mathlib/Algebra/Module/Submodule/Ker.lean
125
126
theorem ker_codRestrict {τ₂₁ : Rβ‚‚ β†’+* R} (p : Submodule R M) (f : Mβ‚‚ β†’β‚›β‚—[τ₂₁] M) (hf) : ker (codRestrict p f hf) = ker f := by
rw [ker, comap_codRestrict, Submodule.map_bot]; rfl
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]
Mathlib/Order/Interval/Set/OrderIso.lean
78
79
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]
1
import Mathlib.Topology.MetricSpace.Basic #align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b" variable {Ξ± Ξ² : Type*} namespace Set section Einfsep open ENNReal open Function noncomputable def einfsep [EDist Ξ±] (s : Set Ξ±) : ℝβ‰₯0∞ := β¨… (x ∈ s) (y ∈ s) (_ : x β‰  y), edist x y #align set.einfsep Set.einfsep section Infsep open ENNReal open Set Function noncomputable def infsep [EDist Ξ±] (s : Set Ξ±) : ℝ := ENNReal.toReal s.einfsep #align set.infsep Set.infsep section EDist variable [EDist Ξ±] {x y : Ξ±} {s : Set Ξ±}
Mathlib/Topology/MetricSpace/Infsep.lean
332
333
theorem infsep_zero : s.infsep = 0 ↔ s.einfsep = 0 ∨ s.einfsep = ∞ := by
rw [infsep, ENNReal.toReal_eq_zero_iff]
1
import Mathlib.Data.List.Cycle import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a" open Equiv Equiv.Perm List variable {Ξ± : Type*} namespace Equiv.Perm section Fintype variable [Fintype Ξ±] [DecidableEq Ξ±] (p : Equiv.Perm Ξ±) (x : Ξ±) def toList : List Ξ± := (List.range (cycleOf p x).support.card).map fun k => (p ^ k) x #align equiv.perm.to_list Equiv.Perm.toList @[simp] theorem toList_one : toList (1 : Perm Ξ±) x = [] := by simp [toList, cycleOf_one] #align equiv.perm.to_list_one Equiv.Perm.toList_one @[simp] theorem toList_eq_nil_iff {p : Perm Ξ±} {x} : toList p x = [] ↔ x βˆ‰ p.support := by simp [toList] #align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff @[simp] theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList] #align equiv.perm.length_to_list Equiv.Perm.length_toList theorem toList_ne_singleton (y : Ξ±) : toList p x β‰  [y] := by intro H simpa [card_support_ne_one] using congr_arg length H #align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton theorem two_le_length_toList_iff_mem_support {p : Perm Ξ±} {x : Ξ±} : 2 ≀ length (toList p x) ↔ x ∈ p.support := by simp #align equiv.perm.two_le_length_to_list_iff_mem_support Equiv.Perm.two_le_length_toList_iff_mem_support theorem length_toList_pos_of_mem_support (h : x ∈ p.support) : 0 < length (toList p x) := zero_lt_two.trans_le (two_le_length_toList_iff_mem_support.mpr h) #align equiv.perm.length_to_list_pos_of_mem_support Equiv.Perm.length_toList_pos_of_mem_support theorem get_toList (n : β„•) (hn : n < length (toList p x)) : (toList p x).get ⟨n, hn⟩ = (p ^ n) x := by simp [toList]
Mathlib/GroupTheory/Perm/Cycle/Concrete.lean
248
249
theorem toList_get_zero (h : x ∈ p.support) : (toList p x).get ⟨0, (length_toList_pos_of_mem_support _ _ h)⟩ = x := by
simp [toList]
1
import Mathlib.Algebra.Module.Submodule.Map #align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" open Function open Pointwise variable {R : Type*} {R₁ : Type*} {Rβ‚‚ : Type*} {R₃ : Type*} variable {K : Type*} variable {M : Type*} {M₁ : Type*} {Mβ‚‚ : Type*} {M₃ : Type*} variable {V : Type*} {Vβ‚‚ : Type*} namespace LinearMap section AddCommMonoid variable [Semiring R] [Semiring Rβ‚‚] [Semiring R₃] variable [AddCommMonoid M] [AddCommMonoid Mβ‚‚] [AddCommMonoid M₃] variable {σ₁₂ : R β†’+* Rβ‚‚} {σ₂₃ : Rβ‚‚ β†’+* R₃} {σ₁₃ : R β†’+* R₃} variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] variable [Module R M] [Module Rβ‚‚ Mβ‚‚] [Module R₃ M₃] open Submodule variable {σ₂₁ : Rβ‚‚ β†’+* R} {τ₁₂ : R β†’+* Rβ‚‚} {τ₂₃ : Rβ‚‚ β†’+* R₃} {τ₁₃ : R β†’+* R₃} variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃] variable {F : Type*} [FunLike F M Mβ‚‚] [SemilinearMapClass F τ₁₂ M Mβ‚‚] def ker (f : F) : Submodule R M := comap f βŠ₯ #align linear_map.ker LinearMap.ker @[simp] theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 := mem_bot Rβ‚‚ #align linear_map.mem_ker LinearMap.mem_ker @[simp] theorem ker_id : ker (LinearMap.id : M β†’β‚—[R] M) = βŠ₯ := rfl #align linear_map.ker_id LinearMap.ker_id @[simp] theorem map_coe_ker (f : F) (x : ker f) : f x = 0 := mem_ker.1 x.2 #align linear_map.map_coe_ker LinearMap.map_coe_ker theorem ker_toAddSubmonoid (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) := rfl #align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid theorem comp_ker_subtype (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) : f.comp f.ker.subtype = 0 := LinearMap.ext fun x => mem_ker.1 x.2 #align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype theorem ker_comp (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) (g : Mβ‚‚ β†’β‚›β‚—[τ₂₃] M₃) : ker (g.comp f : M β†’β‚›β‚—[τ₁₃] M₃) = comap f (ker g) := rfl #align linear_map.ker_comp LinearMap.ker_comp theorem ker_le_ker_comp (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) (g : Mβ‚‚ β†’β‚›β‚—[τ₂₃] M₃) : ker f ≀ ker (g.comp f : M β†’β‚›β‚—[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le #align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp theorem ker_sup_ker_le_ker_comp_of_commute {f g : M β†’β‚—[R] M} (h : Commute f g) : ker f βŠ” ker g ≀ ker (f βˆ˜β‚— g) := by refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩ rw [← mul_eq_comp, h.eq, mul_eq_comp] exact ker_le_ker_comp f g @[simp] theorem ker_le_comap {p : Submodule Rβ‚‚ Mβ‚‚} (f : M β†’β‚›β‚—[τ₁₂] Mβ‚‚) : ker f ≀ p.comap f := fun x hx ↦ by simp [mem_ker.mp hx] theorem disjoint_ker {f : F} {p : Submodule R M} : Disjoint p (ker f) ↔ βˆ€ x ∈ p, f x = 0 β†’ x = 0 := by simp [disjoint_def] #align linear_map.disjoint_ker LinearMap.disjoint_ker
Mathlib/Algebra/Module/Submodule/Ker.lean
112
113
theorem ker_eq_bot' {f : F} : ker f = βŠ₯ ↔ βˆ€ m, f m = 0 β†’ m = 0 := by
simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊀)
1
import Mathlib.Data.Nat.Defs import Mathlib.Tactic.GCongr.Core import Mathlib.Tactic.Common import Mathlib.Tactic.Monotonicity.Attr #align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" namespace Nat def factorial : β„• β†’ β„• | 0 => 1 | succ n => succ n * factorial n #align nat.factorial Nat.factorial scoped notation:10000 n "!" => Nat.factorial n section DescFactorial def descFactorial (n : β„•) : β„• β†’ β„• | 0 => 1 | k + 1 => (n - k) * descFactorial n k #align nat.desc_factorial Nat.descFactorial @[simp] theorem descFactorial_zero (n : β„•) : n.descFactorial 0 = 1 := rfl #align nat.desc_factorial_zero Nat.descFactorial_zero @[simp] theorem descFactorial_succ (n k : β„•) : n.descFactorial (k + 1) = (n - k) * n.descFactorial k := rfl #align nat.desc_factorial_succ Nat.descFactorial_succ theorem zero_descFactorial_succ (k : β„•) : (0 : β„•).descFactorial (k + 1) = 0 := by rw [descFactorial_succ, Nat.zero_sub, Nat.zero_mul] #align nat.zero_desc_factorial_succ Nat.zero_descFactorial_succ
Mathlib/Data/Nat/Factorial/Basic.lean
344
344
theorem descFactorial_one (n : β„•) : n.descFactorial 1 = n := by
simp
1
import Mathlib.Analysis.Normed.Field.Basic import Mathlib.Analysis.SpecialFunctions.Pow.Real #align_import analysis.normed.ring.seminorm from "leanprover-community/mathlib"@"7ea604785a41a0681eac70c5a82372493dbefc68" open NNReal variable {F R S : Type*} (x y : R) (r : ℝ) structure RingSeminorm (R : Type*) [NonUnitalNonAssocRing R] extends AddGroupSeminorm R where mul_le' : βˆ€ x y : R, toFun (x * y) ≀ toFun x * toFun y #align ring_seminorm RingSeminorm structure RingNorm (R : Type*) [NonUnitalNonAssocRing R] extends RingSeminorm R, AddGroupNorm R #align ring_norm RingNorm structure MulRingSeminorm (R : Type*) [NonAssocRing R] extends AddGroupSeminorm R, MonoidWithZeroHom R ℝ #align mul_ring_seminorm MulRingSeminorm structure MulRingNorm (R : Type*) [NonAssocRing R] extends MulRingSeminorm R, AddGroupNorm R #align mul_ring_norm MulRingNorm attribute [nolint docBlame] RingSeminorm.toAddGroupSeminorm RingNorm.toAddGroupNorm RingNorm.toRingSeminorm MulRingSeminorm.toAddGroupSeminorm MulRingSeminorm.toMonoidWithZeroHom MulRingNorm.toAddGroupNorm MulRingNorm.toMulRingSeminorm namespace RingSeminorm section NonUnitalRing variable [NonUnitalRing R] instance funLike : FunLike (RingSeminorm R) R ℝ where coe f := f.toFun coe_injective' f g h := by cases f cases g congr ext x exact congr_fun h x instance ringSeminormClass : RingSeminormClass (RingSeminorm R) R ℝ where map_zero f := f.map_zero' map_add_le_add f := f.add_le' map_mul_le_mul f := f.mul_le' map_neg_eq_map f := f.neg' #align ring_seminorm.ring_seminorm_class RingSeminorm.ringSeminormClass @[simp] theorem toFun_eq_coe (p : RingSeminorm R) : (p.toAddGroupSeminorm : R β†’ ℝ) = p := rfl #align ring_seminorm.to_fun_eq_coe RingSeminorm.toFun_eq_coe @[ext] theorem ext {p q : RingSeminorm R} : (βˆ€ x, p x = q x) β†’ p = q := DFunLike.ext p q #align ring_seminorm.ext RingSeminorm.ext instance : Zero (RingSeminorm R) := ⟨{ AddGroupSeminorm.instZeroAddGroupSeminorm.zero with mul_le' := fun _ _ => (zero_mul _).ge }⟩ theorem eq_zero_iff {p : RingSeminorm R} : p = 0 ↔ βˆ€ x, p x = 0 := DFunLike.ext_iff #align ring_seminorm.eq_zero_iff RingSeminorm.eq_zero_iff
Mathlib/Analysis/Normed/Ring/Seminorm.lean
116
116
theorem ne_zero_iff {p : RingSeminorm R} : p β‰  0 ↔ βˆƒ x, p x β‰  0 := by
simp [eq_zero_iff]
1
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b β‰  0 ∧ b β‰  1 ∧ b β‰  -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp] theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs] #align real.logb_abs Real.logb_abs @[simp] theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by rw [← logb_abs x, ← logb_abs (-x), abs_neg] #align real.logb_neg_eq_logb Real.logb_neg_eq_logb
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
72
73
theorem logb_mul (hx : x β‰  0) (hy : y β‰  0) : logb b (x * y) = logb b x + logb b y := by
simp_rw [logb, log_mul hx hy, add_div]
1
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Data.Rat.Denumerable import Mathlib.Data.Set.Pointwise.Interval import Mathlib.SetTheory.Cardinal.Continuum #align_import data.real.cardinality from "leanprover-community/mathlib"@"7e7aaccf9b0182576cabdde36cf1b5ad3585b70d" open Nat Set open Cardinal noncomputable section namespace Cardinal variable {c : ℝ} {f g : β„• β†’ Bool} {n : β„•} def cantorFunctionAux (c : ℝ) (f : β„• β†’ Bool) (n : β„•) : ℝ := cond (f n) (c ^ n) 0 #align cardinal.cantor_function_aux Cardinal.cantorFunctionAux @[simp] theorem cantorFunctionAux_true (h : f n = true) : cantorFunctionAux c f n = c ^ n := by simp [cantorFunctionAux, h] #align cardinal.cantor_function_aux_tt Cardinal.cantorFunctionAux_true @[simp] theorem cantorFunctionAux_false (h : f n = false) : cantorFunctionAux c f n = 0 := by simp [cantorFunctionAux, h] #align cardinal.cantor_function_aux_ff Cardinal.cantorFunctionAux_false theorem cantorFunctionAux_nonneg (h : 0 ≀ c) : 0 ≀ cantorFunctionAux c f n := by cases h' : f n <;> simp [h'] apply pow_nonneg h #align cardinal.cantor_function_aux_nonneg Cardinal.cantorFunctionAux_nonneg theorem cantorFunctionAux_eq (h : f n = g n) : cantorFunctionAux c f n = cantorFunctionAux c g n := by simp [cantorFunctionAux, h] #align cardinal.cantor_function_aux_eq Cardinal.cantorFunctionAux_eq
Mathlib/Data/Real/Cardinality.lean
82
83
theorem cantorFunctionAux_zero (f : β„• β†’ Bool) : cantorFunctionAux c f 0 = cond (f 0) 1 0 := by
cases h : f 0 <;> simp [h]
1
import Mathlib.CategoryTheory.Idempotents.Basic import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor import Mathlib.CategoryTheory.Equivalence #align_import category_theory.idempotents.karoubi from "leanprover-community/mathlib"@"200eda15d8ff5669854ff6bcc10aaf37cb70498f" noncomputable section open CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Limits BigOperators namespace CategoryTheory variable (C : Type*) [Category C] namespace Idempotents -- porting note (#5171): removed @[nolint has_nonempty_instance] structure Karoubi where X : C p : X ⟢ X idem : p ≫ p = p := by aesop_cat #align category_theory.idempotents.karoubi CategoryTheory.Idempotents.Karoubi namespace Karoubi variable {C} attribute [reassoc (attr := simp)] idem @[ext] theorem ext {P Q : Karoubi C} (h_X : P.X = Q.X) (h_p : P.p ≫ eqToHom h_X = eqToHom h_X ≫ Q.p) : P = Q := by cases P cases Q dsimp at h_X h_p subst h_X simpa only [mk.injEq, heq_eq_eq, true_and, eqToHom_refl, comp_id, id_comp] using h_p #align category_theory.idempotents.karoubi.ext CategoryTheory.Idempotents.Karoubi.ext @[ext] structure Hom (P Q : Karoubi C) where f : P.X ⟢ Q.X comm : f = P.p ≫ f ≫ Q.p := by aesop_cat #align category_theory.idempotents.karoubi.hom CategoryTheory.Idempotents.Karoubi.Hom instance [Preadditive C] (P Q : Karoubi C) : Inhabited (Hom P Q) := ⟨⟨0, by rw [zero_comp, comp_zero]⟩⟩ @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Idempotents/Karoubi.lean
85
85
theorem p_comp {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f := by
rw [f.comm, ← assoc, P.idem]
1
import Mathlib.Algebra.Group.Indicator import Mathlib.Data.Finset.Piecewise import Mathlib.Data.Finset.Preimage #align_import algebra.big_operators.basic from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83" -- TODO -- assert_not_exists AddCommMonoidWithOne assert_not_exists MonoidWithZero assert_not_exists MulAction variable {ΞΉ ΞΊ Ξ± Ξ² Ξ³ : Type*} open Fin Function namespace Finset @[to_additive "`βˆ‘ x ∈ s, f x` is the sum of `f x` as `x` ranges over the elements of the finite set `s`."] protected def prod [CommMonoid Ξ²] (s : Finset Ξ±) (f : Ξ± β†’ Ξ²) : Ξ² := (s.1.map f).prod #align finset.prod Finset.prod #align finset.sum Finset.sum @[to_additive (attr := simp)] theorem prod_mk [CommMonoid Ξ²] (s : Multiset Ξ±) (hs : s.Nodup) (f : Ξ± β†’ Ξ²) : (⟨s, hs⟩ : Finset Ξ±).prod f = (s.map f).prod := rfl #align finset.prod_mk Finset.prod_mk #align finset.sum_mk Finset.sum_mk @[to_additive (attr := simp)]
Mathlib/Algebra/BigOperators/Group/Finset.lean
67
68
theorem prod_val [CommMonoid Ξ±] (s : Finset Ξ±) : s.1.prod = s.prod id := by
rw [Finset.prod, Multiset.map_id]
1
import Mathlib.Order.Interval.Set.UnorderedInterval import Mathlib.Algebra.Order.Interval.Set.Monoid import Mathlib.Data.Set.Pointwise.Basic import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Group.MinMax #align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Interval Pointwise variable {Ξ± : Type*} namespace Set section LinearOrderedField variable [LinearOrderedField Ξ±] {a : Ξ±} @[simp] theorem preimage_mul_const_Iio (a : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Iio a = Iio (a / c) := ext fun _x => (lt_div_iff h).symm #align set.preimage_mul_const_Iio Set.preimage_mul_const_Iio @[simp] theorem preimage_mul_const_Ioi (a : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Ioi a = Ioi (a / c) := ext fun _x => (div_lt_iff h).symm #align set.preimage_mul_const_Ioi Set.preimage_mul_const_Ioi @[simp] theorem preimage_mul_const_Iic (a : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Iic a = Iic (a / c) := ext fun _x => (le_div_iff h).symm #align set.preimage_mul_const_Iic Set.preimage_mul_const_Iic @[simp] theorem preimage_mul_const_Ici (a : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Ici a = Ici (a / c) := ext fun _x => (div_le_iff h).symm #align set.preimage_mul_const_Ici Set.preimage_mul_const_Ici @[simp] theorem preimage_mul_const_Ioo (a b : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c) := by simp [← Ioi_inter_Iio, h] #align set.preimage_mul_const_Ioo Set.preimage_mul_const_Ioo @[simp] theorem preimage_mul_const_Ioc (a b : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c) := by simp [← Ioi_inter_Iic, h] #align set.preimage_mul_const_Ioc Set.preimage_mul_const_Ioc @[simp] theorem preimage_mul_const_Ico (a b : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Ico a b = Ico (a / c) (b / c) := by simp [← Ici_inter_Iio, h] #align set.preimage_mul_const_Ico Set.preimage_mul_const_Ico @[simp] theorem preimage_mul_const_Icc (a b : Ξ±) {c : Ξ±} (h : 0 < c) : (fun x => x * c) ⁻¹' Icc a b = Icc (a / c) (b / c) := by simp [← Ici_inter_Iic, h] #align set.preimage_mul_const_Icc Set.preimage_mul_const_Icc @[simp] theorem preimage_mul_const_Iio_of_neg (a : Ξ±) {c : Ξ±} (h : c < 0) : (fun x => x * c) ⁻¹' Iio a = Ioi (a / c) := ext fun _x => (div_lt_iff_of_neg h).symm #align set.preimage_mul_const_Iio_of_neg Set.preimage_mul_const_Iio_of_neg @[simp] theorem preimage_mul_const_Ioi_of_neg (a : Ξ±) {c : Ξ±} (h : c < 0) : (fun x => x * c) ⁻¹' Ioi a = Iio (a / c) := ext fun _x => (lt_div_iff_of_neg h).symm #align set.preimage_mul_const_Ioi_of_neg Set.preimage_mul_const_Ioi_of_neg @[simp] theorem preimage_mul_const_Iic_of_neg (a : Ξ±) {c : Ξ±} (h : c < 0) : (fun x => x * c) ⁻¹' Iic a = Ici (a / c) := ext fun _x => (div_le_iff_of_neg h).symm #align set.preimage_mul_const_Iic_of_neg Set.preimage_mul_const_Iic_of_neg @[simp] theorem preimage_mul_const_Ici_of_neg (a : Ξ±) {c : Ξ±} (h : c < 0) : (fun x => x * c) ⁻¹' Ici a = Iic (a / c) := ext fun _x => (le_div_iff_of_neg h).symm #align set.preimage_mul_const_Ici_of_neg Set.preimage_mul_const_Ici_of_neg @[simp] theorem preimage_mul_const_Ioo_of_neg (a b : Ξ±) {c : Ξ±} (h : c < 0) : (fun x => x * c) ⁻¹' Ioo a b = Ioo (b / c) (a / c) := by simp [← Ioi_inter_Iio, h, inter_comm] #align set.preimage_mul_const_Ioo_of_neg Set.preimage_mul_const_Ioo_of_neg @[simp] theorem preimage_mul_const_Ioc_of_neg (a b : Ξ±) {c : Ξ±} (h : c < 0) : (fun x => x * c) ⁻¹' Ioc a b = Ico (b / c) (a / c) := by simp [← Ioi_inter_Iic, ← Ici_inter_Iio, h, inter_comm] #align set.preimage_mul_const_Ioc_of_neg Set.preimage_mul_const_Ioc_of_neg @[simp]
Mathlib/Data/Set/Pointwise/Interval.lean
674
676
theorem preimage_mul_const_Ico_of_neg (a b : α) {c : α} (h : c < 0) : (fun x => x * c) ⁻¹' Ico a b = Ioc (b / c) (a / c) := by
simp [← Ici_inter_Iio, ← Ioi_inter_Iic, h, inter_comm]
1
import Mathlib.Algebra.Quaternion import Mathlib.Tactic.Ring #align_import algebra.quaternion_basis from "leanprover-community/mathlib"@"3aa5b8a9ed7a7cabd36e6e1d022c9858ab8a8c2d" open Quaternion namespace QuaternionAlgebra structure Basis {R : Type*} (A : Type*) [CommRing R] [Ring A] [Algebra R A] (c₁ cβ‚‚ : R) where (i j k : A) i_mul_i : i * i = c₁ β€’ (1 : A) j_mul_j : j * j = cβ‚‚ β€’ (1 : A) i_mul_j : i * j = k j_mul_i : j * i = -k #align quaternion_algebra.basis QuaternionAlgebra.Basis variable {R : Type*} {A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B] variable {c₁ cβ‚‚ : R} namespace Basis @[ext] protected theorem ext ⦃q₁ qβ‚‚ : Basis A c₁ c₂⦄ (hi : q₁.i = qβ‚‚.i) (hj : q₁.j = qβ‚‚.j) : q₁ = qβ‚‚ := by cases q₁; rename_i q₁_i_mul_j _ cases qβ‚‚; rename_i qβ‚‚_i_mul_j _ congr rw [← q₁_i_mul_j, ← qβ‚‚_i_mul_j] congr #align quaternion_algebra.basis.ext QuaternionAlgebra.Basis.ext variable (R) @[simps i j k] protected def self : Basis ℍ[R,c₁,cβ‚‚] c₁ cβ‚‚ where i := ⟨0, 1, 0, 0⟩ i_mul_i := by ext <;> simp j := ⟨0, 0, 1, 0⟩ j_mul_j := by ext <;> simp k := ⟨0, 0, 0, 1⟩ i_mul_j := by ext <;> simp j_mul_i := by ext <;> simp #align quaternion_algebra.basis.self QuaternionAlgebra.Basis.self variable {R} instance : Inhabited (Basis ℍ[R,c₁,cβ‚‚] c₁ cβ‚‚) := ⟨Basis.self R⟩ variable (q : Basis A c₁ cβ‚‚) attribute [simp] i_mul_i j_mul_j i_mul_j j_mul_i @[simp]
Mathlib/Algebra/QuaternionBasis.lean
84
85
theorem i_mul_k : q.i * q.k = c₁ β€’ q.j := by
rw [← i_mul_j, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul]
1
import Mathlib.Data.Analysis.Filter import Mathlib.Topology.Bases import Mathlib.Topology.LocallyFinite #align_import data.analysis.topology from "leanprover-community/mathlib"@"55d771df074d0dd020139ee1cd4b95521422df9f" open Set open Filter hiding Realizer open Topology structure Ctop (Ξ± Οƒ : Type*) where f : Οƒ β†’ Set Ξ± top : Ξ± β†’ Οƒ top_mem : βˆ€ x : Ξ±, x ∈ f (top x) inter : βˆ€ (a b) (x : Ξ±), x ∈ f a ∩ f b β†’ Οƒ inter_mem : βˆ€ a b x h, x ∈ f (inter a b x h) inter_sub : βˆ€ a b x h, f (inter a b x h) βŠ† f a ∩ f b #align ctop Ctop variable {Ξ± : Type*} {Ξ² : Type*} {Οƒ : Type*} {Ο„ : Type*} instance : Inhabited (Ctop Ξ± (Set Ξ±)) := ⟨{ f := id top := singleton top_mem := mem_singleton inter := fun s t _ _ ↦ s ∩ t inter_mem := fun _s _t _a ↦ id inter_sub := fun _s _t _a _ha ↦ Subset.rfl }⟩ namespace Ctop section variable (F : Ctop Ξ± Οƒ) instance : CoeFun (Ctop Ξ± Οƒ) fun _ ↦ Οƒ β†’ Set Ξ± := ⟨Ctop.f⟩ -- @[simp] -- Porting note (#10685): dsimp can prove this theorem coe_mk (f T h₁ I hβ‚‚ h₃ a) : (@Ctop.mk Ξ± Οƒ f T h₁ I hβ‚‚ h₃) a = f a := rfl #align ctop.coe_mk Ctop.coe_mk def ofEquiv (E : Οƒ ≃ Ο„) : Ctop Ξ± Οƒ β†’ Ctop Ξ± Ο„ | ⟨f, T, h₁, I, hβ‚‚, hβ‚ƒβŸ© => { f := fun a ↦ f (E.symm a) top := fun x ↦ E (T x) top_mem := fun x ↦ by simpa using h₁ x inter := fun a b x h ↦ E (I (E.symm a) (E.symm b) x h) inter_mem := fun a b x h ↦ by simpa using hβ‚‚ (E.symm a) (E.symm b) x h inter_sub := fun a b x h ↦ by simpa using h₃ (E.symm a) (E.symm b) x h } #align ctop.of_equiv Ctop.ofEquiv @[simp]
Mathlib/Data/Analysis/Topology.lean
79
80
theorem ofEquiv_val (E : Οƒ ≃ Ο„) (F : Ctop Ξ± Οƒ) (a : Ο„) : F.ofEquiv E a = F (E.symm a) := by
cases F; rfl
1
import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {Ξ± E F : Type*} {m0 : MeasurableSpace Ξ±} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {ΞΌ Ξ½ : Measure Ξ±} {s t : Set Ξ±} namespace MeasureTheory section NormedAddCommGroup variable (ΞΌ) variable {f g : Ξ± β†’ E} noncomputable def average (f : Ξ± β†’ E) := ∫ x, f x βˆ‚(ΞΌ univ)⁻¹ β€’ ΞΌ #align measure_theory.average MeasureTheory.average notation3 "⨍ "(...)", "r:60:(scoped f => f)" βˆ‚"ΞΌ:70 => average ΞΌ r notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" βˆ‚"ΞΌ:70 => average (Measure.restrict ΞΌ s) r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r @[simp] theorem average_zero : ⨍ _, (0 : E) βˆ‚ΞΌ = 0 := by rw [average, integral_zero] #align measure_theory.average_zero MeasureTheory.average_zero @[simp] theorem average_zero_measure (f : Ξ± β†’ E) : ⨍ x, f x βˆ‚(0 : Measure Ξ±) = 0 := by rw [average, smul_zero, integral_zero_measure] #align measure_theory.average_zero_measure MeasureTheory.average_zero_measure @[simp] theorem average_neg (f : Ξ± β†’ E) : ⨍ x, -f x βˆ‚ΞΌ = -⨍ x, f x βˆ‚ΞΌ := integral_neg f #align measure_theory.average_neg MeasureTheory.average_neg theorem average_eq' (f : Ξ± β†’ E) : ⨍ x, f x βˆ‚ΞΌ = ∫ x, f x βˆ‚(ΞΌ univ)⁻¹ β€’ ΞΌ := rfl #align measure_theory.average_eq' MeasureTheory.average_eq' theorem average_eq (f : Ξ± β†’ E) : ⨍ x, f x βˆ‚ΞΌ = (ΞΌ univ).toReal⁻¹ β€’ ∫ x, f x βˆ‚ΞΌ := by rw [average_eq', integral_smul_measure, ENNReal.toReal_inv] #align measure_theory.average_eq MeasureTheory.average_eq theorem average_eq_integral [IsProbabilityMeasure ΞΌ] (f : Ξ± β†’ E) : ⨍ x, f x βˆ‚ΞΌ = ∫ x, f x βˆ‚ΞΌ := by rw [average, measure_univ, inv_one, one_smul] #align measure_theory.average_eq_integral MeasureTheory.average_eq_integral @[simp] theorem measure_smul_average [IsFiniteMeasure ΞΌ] (f : Ξ± β†’ E) : (ΞΌ univ).toReal β€’ ⨍ x, f x βˆ‚ΞΌ = ∫ x, f x βˆ‚ΞΌ := by rcases eq_or_ne ΞΌ 0 with hΞΌ | hΞΌ Β· rw [hΞΌ, integral_zero_measure, average_zero_measure, smul_zero] Β· rw [average_eq, smul_inv_smulβ‚€] refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne' rwa [Ne, measure_univ_eq_zero] #align measure_theory.measure_smul_average MeasureTheory.measure_smul_average theorem setAverage_eq (f : Ξ± β†’ E) (s : Set Ξ±) : ⨍ x in s, f x βˆ‚ΞΌ = (ΞΌ s).toReal⁻¹ β€’ ∫ x in s, f x βˆ‚ΞΌ := by rw [average_eq, restrict_apply_univ] #align measure_theory.set_average_eq MeasureTheory.setAverage_eq theorem setAverage_eq' (f : Ξ± β†’ E) (s : Set Ξ±) : ⨍ x in s, f x βˆ‚ΞΌ = ∫ x, f x βˆ‚(ΞΌ s)⁻¹ β€’ ΞΌ.restrict s := by simp only [average_eq', restrict_apply_univ] #align measure_theory.set_average_eq' MeasureTheory.setAverage_eq' variable {ΞΌ}
Mathlib/MeasureTheory/Integral/Average.lean
361
362
theorem average_congr {f g : Ξ± β†’ E} (h : f =ᡐ[ΞΌ] g) : ⨍ x, f x βˆ‚ΞΌ = ⨍ x, g x βˆ‚ΞΌ := by
simp only [average_eq, integral_congr_ae h]
1
import Mathlib.Algebra.Group.Prod import Mathlib.Order.Cover #align_import algebra.support from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1" assert_not_exists MonoidWithZero open Set namespace Function variable {Ξ± Ξ² A B M N P G : Type*} section One variable [One M] [One N] [One P] @[to_additive "`support` of a function is the set of points `x` such that `f x β‰  0`."] def mulSupport (f : Ξ± β†’ M) : Set Ξ± := {x | f x β‰  1} #align function.mul_support Function.mulSupport #align function.support Function.support @[to_additive] theorem mulSupport_eq_preimage (f : Ξ± β†’ M) : mulSupport f = f ⁻¹' {1}ᢜ := rfl #align function.mul_support_eq_preimage Function.mulSupport_eq_preimage #align function.support_eq_preimage Function.support_eq_preimage @[to_additive] theorem nmem_mulSupport {f : Ξ± β†’ M} {x : Ξ±} : x βˆ‰ mulSupport f ↔ f x = 1 := not_not #align function.nmem_mul_support Function.nmem_mulSupport #align function.nmem_support Function.nmem_support @[to_additive] theorem compl_mulSupport {f : Ξ± β†’ M} : (mulSupport f)ᢜ = { x | f x = 1 } := ext fun _ => nmem_mulSupport #align function.compl_mul_support Function.compl_mulSupport #align function.compl_support Function.compl_support @[to_additive (attr := simp)] theorem mem_mulSupport {f : Ξ± β†’ M} {x : Ξ±} : x ∈ mulSupport f ↔ f x β‰  1 := Iff.rfl #align function.mem_mul_support Function.mem_mulSupport #align function.mem_support Function.mem_support @[to_additive (attr := simp)] theorem mulSupport_subset_iff {f : Ξ± β†’ M} {s : Set Ξ±} : mulSupport f βŠ† s ↔ βˆ€ x, f x β‰  1 β†’ x ∈ s := Iff.rfl #align function.mul_support_subset_iff Function.mulSupport_subset_iff #align function.support_subset_iff Function.support_subset_iff @[to_additive] theorem mulSupport_subset_iff' {f : Ξ± β†’ M} {s : Set Ξ±} : mulSupport f βŠ† s ↔ βˆ€ x βˆ‰ s, f x = 1 := forall_congr' fun _ => not_imp_comm #align function.mul_support_subset_iff' Function.mulSupport_subset_iff' #align function.support_subset_iff' Function.support_subset_iff' @[to_additive] theorem mulSupport_eq_iff {f : Ξ± β†’ M} {s : Set Ξ±} : mulSupport f = s ↔ (βˆ€ x, x ∈ s β†’ f x β‰  1) ∧ βˆ€ x, x βˆ‰ s β†’ f x = 1 := by simp (config := { contextual := true }) only [ext_iff, mem_mulSupport, ne_eq, iff_def, not_imp_comm, and_comm, forall_and] #align function.mul_support_eq_iff Function.mulSupport_eq_iff #align function.support_eq_iff Function.support_eq_iff @[to_additive] theorem ext_iff_mulSupport {f g : Ξ± β†’ M} : f = g ↔ f.mulSupport = g.mulSupport ∧ βˆ€ x ∈ f.mulSupport, f x = g x := ⟨fun h ↦ h β–Έ ⟨rfl, fun _ _ ↦ rfl⟩, fun ⟨h₁, hβ‚‚βŸ© ↦ funext fun x ↦ by if hx : x ∈ f.mulSupport then exact hβ‚‚ x hx else rw [nmem_mulSupport.1 hx, nmem_mulSupport.1 (mt (Set.ext_iff.1 h₁ x).2 hx)]⟩ @[to_additive] theorem mulSupport_update_of_ne_one [DecidableEq Ξ±] (f : Ξ± β†’ M) (x : Ξ±) {y : M} (hy : y β‰  1) : mulSupport (update f x y) = insert x (mulSupport f) := by ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*] @[to_additive]
Mathlib/Algebra/Group/Support.lean
93
95
theorem mulSupport_update_one [DecidableEq Ξ±] (f : Ξ± β†’ M) (x : Ξ±) : mulSupport (update f x 1) = mulSupport f \ {x} := by
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
1
import Mathlib.Algebra.Group.Equiv.Basic import Mathlib.Data.ENat.Lattice import Mathlib.Data.Part import Mathlib.Tactic.NormNum #align_import data.nat.part_enat from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" open Part hiding some def PartENat : Type := Part β„• #align part_enat PartENat namespace PartENat @[coe] def some : β„• β†’ PartENat := Part.some #align part_enat.some PartENat.some instance : Zero PartENat := ⟨some 0⟩ instance : Inhabited PartENat := ⟨0⟩ instance : One PartENat := ⟨some 1⟩ instance : Add PartENat := ⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => get x h.1 + get y h.2⟩⟩ instance (n : β„•) : Decidable (some n).Dom := isTrue trivial @[simp] theorem dom_some (x : β„•) : (some x).Dom := trivial #align part_enat.dom_some PartENat.dom_some instance addCommMonoid : AddCommMonoid PartENat where add := (Β· + Β·) zero := 0 add_comm x y := Part.ext' and_comm fun _ _ => add_comm _ _ zero_add x := Part.ext' (true_and_iff _) fun _ _ => zero_add _ add_zero x := Part.ext' (and_true_iff _) fun _ _ => add_zero _ add_assoc x y z := Part.ext' and_assoc fun _ _ => add_assoc _ _ _ nsmul := nsmulRec instance : AddCommMonoidWithOne PartENat := { PartENat.addCommMonoid with one := 1 natCast := some natCast_zero := rfl natCast_succ := fun _ => Part.ext' (true_and_iff _).symm fun _ _ => rfl } theorem some_eq_natCast (n : β„•) : some n = n := rfl #align part_enat.some_eq_coe PartENat.some_eq_natCast instance : CharZero PartENat where cast_injective := Part.some_injective theorem natCast_inj {x y : β„•} : (x : PartENat) = y ↔ x = y := Nat.cast_inj #align part_enat.coe_inj PartENat.natCast_inj @[simp] theorem dom_natCast (x : β„•) : (x : PartENat).Dom := trivial #align part_enat.dom_coe PartENat.dom_natCast -- See note [no_index around OfNat.ofNat] @[simp] theorem dom_ofNat (x : β„•) [x.AtLeastTwo] : (no_index (OfNat.ofNat x : PartENat)).Dom := trivial @[simp] theorem dom_zero : (0 : PartENat).Dom := trivial @[simp] theorem dom_one : (1 : PartENat).Dom := trivial instance : CanLift PartENat β„• (↑) Dom := ⟨fun n hn => ⟨n.get hn, Part.some_get _⟩⟩ instance : LE PartENat := ⟨fun x y => βˆƒ h : y.Dom β†’ x.Dom, βˆ€ hy : y.Dom, x.get (h hy) ≀ y.get hy⟩ instance : Top PartENat := ⟨none⟩ instance : Bot PartENat := ⟨0⟩ instance : Sup PartENat := ⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => x.get h.1 βŠ” y.get h.2⟩⟩ theorem le_def (x y : PartENat) : x ≀ y ↔ βˆƒ h : y.Dom β†’ x.Dom, βˆ€ hy : y.Dom, x.get (h hy) ≀ y.get hy := Iff.rfl #align part_enat.le_def PartENat.le_def @[elab_as_elim] protected theorem casesOn' {P : PartENat β†’ Prop} : βˆ€ a : PartENat, P ⊀ β†’ (βˆ€ n : β„•, P (some n)) β†’ P a := Part.induction_on #align part_enat.cases_on' PartENat.casesOn' @[elab_as_elim] protected theorem casesOn {P : PartENat β†’ Prop} : βˆ€ a : PartENat, P ⊀ β†’ (βˆ€ n : β„•, P n) β†’ P a := by exact PartENat.casesOn' #align part_enat.cases_on PartENat.casesOn -- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later theorem top_add (x : PartENat) : ⊀ + x = ⊀ := Part.ext' (false_and_iff _) fun h => h.left.elim #align part_enat.top_add PartENat.top_add -- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later theorem add_top (x : PartENat) : x + ⊀ = ⊀ := by rw [add_comm, top_add] #align part_enat.add_top PartENat.add_top @[simp] theorem natCast_get {x : PartENat} (h : x.Dom) : (x.get h : PartENat) = x := by exact Part.ext' (iff_of_true trivial h) fun _ _ => rfl #align part_enat.coe_get PartENat.natCast_get @[simp, norm_cast] theorem get_natCast' (x : β„•) (h : (x : PartENat).Dom) : get (x : PartENat) h = x := by rw [← natCast_inj, natCast_get] #align part_enat.get_coe' PartENat.get_natCast' theorem get_natCast {x : β„•} : get (x : PartENat) (dom_natCast x) = x := get_natCast' _ _ #align part_enat.get_coe PartENat.get_natCast
Mathlib/Data/Nat/PartENat.lean
192
194
theorem coe_add_get {x : β„•} {y : PartENat} (h : ((x : PartENat) + y).Dom) : get ((x : PartENat) + y) h = x + get y h.2 := by
rfl
1
import Mathlib.Data.Finset.Prod import Mathlib.Data.Set.Finite #align_import data.finset.n_ary from "leanprover-community/mathlib"@"eba7871095e834365616b5e43c8c7bb0b37058d0" open Function Set variable {Ξ± Ξ±' Ξ² Ξ²' Ξ³ Ξ³' Ξ΄ Ξ΄' Ξ΅ Ξ΅' ΞΆ ΞΆ' Ξ½ : Type*} namespace Finset variable [DecidableEq Ξ±'] [DecidableEq Ξ²'] [DecidableEq Ξ³] [DecidableEq Ξ³'] [DecidableEq Ξ΄] [DecidableEq Ξ΄'] [DecidableEq Ξ΅] [DecidableEq Ξ΅'] {f f' : Ξ± β†’ Ξ² β†’ Ξ³} {g g' : Ξ± β†’ Ξ² β†’ Ξ³ β†’ Ξ΄} {s s' : Finset Ξ±} {t t' : Finset Ξ²} {u u' : Finset Ξ³} {a a' : Ξ±} {b b' : Ξ²} {c : Ξ³} def imageβ‚‚ (f : Ξ± β†’ Ξ² β†’ Ξ³) (s : Finset Ξ±) (t : Finset Ξ²) : Finset Ξ³ := (s Γ—Λ’ t).image <| uncurry f #align finset.imageβ‚‚ Finset.imageβ‚‚ @[simp] theorem mem_imageβ‚‚ : c ∈ imageβ‚‚ f s t ↔ βˆƒ a ∈ s, βˆƒ b ∈ t, f a b = c := by simp [imageβ‚‚, and_assoc] #align finset.mem_imageβ‚‚ Finset.mem_imageβ‚‚ @[simp, norm_cast] theorem coe_imageβ‚‚ (f : Ξ± β†’ Ξ² β†’ Ξ³) (s : Finset Ξ±) (t : Finset Ξ²) : (imageβ‚‚ f s t : Set Ξ³) = Set.image2 f s t := Set.ext fun _ => mem_imageβ‚‚ #align finset.coe_imageβ‚‚ Finset.coe_imageβ‚‚ theorem card_imageβ‚‚_le (f : Ξ± β†’ Ξ² β†’ Ξ³) (s : Finset Ξ±) (t : Finset Ξ²) : (imageβ‚‚ f s t).card ≀ s.card * t.card := card_image_le.trans_eq <| card_product _ _ #align finset.card_imageβ‚‚_le Finset.card_imageβ‚‚_le theorem card_imageβ‚‚_iff : (imageβ‚‚ f s t).card = s.card * t.card ↔ (s Γ—Λ’ t : Set (Ξ± Γ— Ξ²)).InjOn fun x => f x.1 x.2 := by rw [← card_product, ← coe_product] exact card_image_iff #align finset.card_imageβ‚‚_iff Finset.card_imageβ‚‚_iff theorem card_imageβ‚‚ (hf : Injective2 f) (s : Finset Ξ±) (t : Finset Ξ²) : (imageβ‚‚ f s t).card = s.card * t.card := (card_image_of_injective _ hf.uncurry).trans <| card_product _ _ #align finset.card_imageβ‚‚ Finset.card_imageβ‚‚ theorem mem_imageβ‚‚_of_mem (ha : a ∈ s) (hb : b ∈ t) : f a b ∈ imageβ‚‚ f s t := mem_imageβ‚‚.2 ⟨a, ha, b, hb, rfl⟩ #align finset.mem_imageβ‚‚_of_mem Finset.mem_imageβ‚‚_of_mem theorem mem_imageβ‚‚_iff (hf : Injective2 f) : f a b ∈ imageβ‚‚ f s t ↔ a ∈ s ∧ b ∈ t := by rw [← mem_coe, coe_imageβ‚‚, mem_image2_iff hf, mem_coe, mem_coe] #align finset.mem_imageβ‚‚_iff Finset.mem_imageβ‚‚_iff theorem imageβ‚‚_subset (hs : s βŠ† s') (ht : t βŠ† t') : imageβ‚‚ f s t βŠ† imageβ‚‚ f s' t' := by rw [← coe_subset, coe_imageβ‚‚, coe_imageβ‚‚] exact image2_subset hs ht #align finset.imageβ‚‚_subset Finset.imageβ‚‚_subset theorem imageβ‚‚_subset_left (ht : t βŠ† t') : imageβ‚‚ f s t βŠ† imageβ‚‚ f s t' := imageβ‚‚_subset Subset.rfl ht #align finset.imageβ‚‚_subset_left Finset.imageβ‚‚_subset_left theorem imageβ‚‚_subset_right (hs : s βŠ† s') : imageβ‚‚ f s t βŠ† imageβ‚‚ f s' t := imageβ‚‚_subset hs Subset.rfl #align finset.imageβ‚‚_subset_right Finset.imageβ‚‚_subset_right theorem image_subset_imageβ‚‚_left (hb : b ∈ t) : s.image (fun a => f a b) βŠ† imageβ‚‚ f s t := image_subset_iff.2 fun _ ha => mem_imageβ‚‚_of_mem ha hb #align finset.image_subset_imageβ‚‚_left Finset.image_subset_imageβ‚‚_left theorem image_subset_imageβ‚‚_right (ha : a ∈ s) : t.image (fun b => f a b) βŠ† imageβ‚‚ f s t := image_subset_iff.2 fun _ => mem_imageβ‚‚_of_mem ha #align finset.image_subset_imageβ‚‚_right Finset.image_subset_imageβ‚‚_right
Mathlib/Data/Finset/NAry.lean
98
100
theorem forall_imageβ‚‚_iff {p : Ξ³ β†’ Prop} : (βˆ€ z ∈ imageβ‚‚ f s t, p z) ↔ βˆ€ x ∈ s, βˆ€ y ∈ t, p (f x y) := by
simp_rw [← mem_coe, coe_imageβ‚‚, forall_image2_iff]
1
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open Function Filter Set open scoped Topology namespace Real variable {x y : ℝ} -- @[pp_nodot] is no longer needed def arsinh (x : ℝ) := log (x + √(1 + x ^ 2)) #align real.arsinh Real.arsinh theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by apply exp_log rw [← neg_lt_iff_pos_add'] apply lt_sqrt_of_sq_lt simp #align real.exp_arsinh Real.exp_arsinh @[simp] theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh] #align real.arsinh_zero Real.arsinh_zero @[simp] theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh] apply eq_inv_of_mul_eq_one_left rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right] exact add_nonneg zero_le_one (sq_nonneg _) #align real.arsinh_neg Real.arsinh_neg @[simp] theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp #align real.sinh_arsinh Real.sinh_arsinh @[simp] theorem cosh_arsinh (x : ℝ) : cosh (arsinh x) = √(1 + x ^ 2) := by rw [← sqrt_sq (cosh_pos _).le, cosh_sq', sinh_arsinh] #align real.cosh_arsinh Real.cosh_arsinh theorem sinh_surjective : Surjective sinh := LeftInverse.surjective sinh_arsinh #align real.sinh_surjective Real.sinh_surjective theorem sinh_bijective : Bijective sinh := ⟨sinh_injective, sinh_surjective⟩ #align real.sinh_bijective Real.sinh_bijective @[simp] theorem arsinh_sinh (x : ℝ) : arsinh (sinh x) = x := rightInverse_of_injective_of_leftInverse sinh_injective sinh_arsinh x #align real.arsinh_sinh Real.arsinh_sinh @[simps] def sinhEquiv : ℝ ≃ ℝ where toFun := sinh invFun := arsinh left_inv := arsinh_sinh right_inv := sinh_arsinh #align real.sinh_equiv Real.sinhEquiv @[simps! (config := .asFn)] def sinhOrderIso : ℝ ≃o ℝ where toEquiv := sinhEquiv map_rel_iff' := @sinh_le_sinh #align real.sinh_order_iso Real.sinhOrderIso @[simps! (config := .asFn)] def sinhHomeomorph : ℝ β‰ƒβ‚œ ℝ := sinhOrderIso.toHomeomorph #align real.sinh_homeomorph Real.sinhHomeomorph theorem arsinh_bijective : Bijective arsinh := sinhEquiv.symm.bijective #align real.arsinh_bijective Real.arsinh_bijective theorem arsinh_injective : Injective arsinh := sinhEquiv.symm.injective #align real.arsinh_injective Real.arsinh_injective theorem arsinh_surjective : Surjective arsinh := sinhEquiv.symm.surjective #align real.arsinh_surjective Real.arsinh_surjective theorem arsinh_strictMono : StrictMono arsinh := sinhOrderIso.symm.strictMono #align real.arsinh_strict_mono Real.arsinh_strictMono @[simp] theorem arsinh_inj : arsinh x = arsinh y ↔ x = y := arsinh_injective.eq_iff #align real.arsinh_inj Real.arsinh_inj @[simp] theorem arsinh_le_arsinh : arsinh x ≀ arsinh y ↔ x ≀ y := sinhOrderIso.symm.le_iff_le #align real.arsinh_le_arsinh Real.arsinh_le_arsinh @[gcongr] protected alias ⟨_, GCongr.arsinh_le_arsinh⟩ := arsinh_le_arsinh @[simp] theorem arsinh_lt_arsinh : arsinh x < arsinh y ↔ x < y := sinhOrderIso.symm.lt_iff_lt #align real.arsinh_lt_arsinh Real.arsinh_lt_arsinh @[simp] theorem arsinh_eq_zero_iff : arsinh x = 0 ↔ x = 0 := arsinh_injective.eq_iff' arsinh_zero #align real.arsinh_eq_zero_iff Real.arsinh_eq_zero_iff @[simp]
Mathlib/Analysis/SpecialFunctions/Arsinh.lean
164
164
theorem arsinh_nonneg_iff : 0 ≀ arsinh x ↔ 0 ≀ x := by
rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
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}
Mathlib/Combinatorics/SimpleGraph/Density.lean
57
58
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]
1
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.Nat.Factorial.Cast #align_import data.nat.choose.cast from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" open Nat variable (K : Type*) [DivisionRing K] [CharZero K] namespace Nat theorem cast_choose {a b : β„•} (h : a ≀ b) : (b.choose a : K) = b ! / (a ! * (b - a)!) := by have : βˆ€ {n : β„•}, (n ! : K) β‰  0 := Nat.cast_ne_zero.2 (factorial_ne_zero _) rw [eq_div_iff_mul_eq (mul_ne_zero this this)] rw_mod_cast [← mul_assoc, choose_mul_factorial_mul_factorial h] #align nat.cast_choose Nat.cast_choose
Mathlib/Data/Nat/Choose/Cast.lean
31
32
theorem cast_add_choose {a b : β„•} : ((a + b).choose a : K) = (a + b)! / (a ! * b !) := by
rw [cast_choose K (_root_.le_add_right le_rfl), add_tsub_cancel_left]
1
import Mathlib.Data.Nat.Defs import Mathlib.Tactic.GCongr.Core import Mathlib.Tactic.Common import Mathlib.Tactic.Monotonicity.Attr #align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" namespace Nat def factorial : β„• β†’ β„• | 0 => 1 | succ n => succ n * factorial n #align nat.factorial Nat.factorial scoped notation:10000 n "!" => Nat.factorial n section DescFactorial def descFactorial (n : β„•) : β„• β†’ β„• | 0 => 1 | k + 1 => (n - k) * descFactorial n k #align nat.desc_factorial Nat.descFactorial @[simp] theorem descFactorial_zero (n : β„•) : n.descFactorial 0 = 1 := rfl #align nat.desc_factorial_zero Nat.descFactorial_zero @[simp] theorem descFactorial_succ (n k : β„•) : n.descFactorial (k + 1) = (n - k) * n.descFactorial k := rfl #align nat.desc_factorial_succ Nat.descFactorial_succ
Mathlib/Data/Nat/Factorial/Basic.lean
340
341
theorem zero_descFactorial_succ (k : β„•) : (0 : β„•).descFactorial (k + 1) = 0 := by
rw [descFactorial_succ, Nat.zero_sub, Nat.zero_mul]
1
import Mathlib.Algebra.Order.Monoid.Defs import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Util.AssertExists #align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce" open Function universe u variable {Ξ± : Type u} class OrderedAddCommGroup (Ξ± : Type u) extends AddCommGroup Ξ±, PartialOrder Ξ± where protected add_le_add_left : βˆ€ a b : Ξ±, a ≀ b β†’ βˆ€ c : Ξ±, c + a ≀ c + b #align ordered_add_comm_group OrderedAddCommGroup class OrderedCommGroup (Ξ± : Type u) extends CommGroup Ξ±, PartialOrder Ξ± where protected mul_le_mul_left : βˆ€ a b : Ξ±, a ≀ b β†’ βˆ€ c : Ξ±, c * a ≀ c * b #align ordered_comm_group OrderedCommGroup attribute [to_additive] OrderedCommGroup @[to_additive] instance OrderedCommGroup.to_covariantClass_left_le (Ξ± : Type u) [OrderedCommGroup Ξ±] : CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·) where elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a #align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le #align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le -- See note [lower instance priority] @[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid] instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup Ξ±] : OrderedCancelCommMonoid Ξ± := { β€ΉOrderedCommGroup Ξ±β€Ί with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' } #align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid #align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid example (Ξ± : Type u) [OrderedAddCommGroup Ξ±] : CovariantClass Ξ± Ξ± (swap (Β· + Β·)) (Β· < Β·) := IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le Ξ± -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564 -- but without the motivation clearly explained. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_left_le (Ξ± : Type u) [OrderedCommGroup Ξ±] : ContravariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·) where elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le #align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_right_le (Ξ± : Type u) [OrderedCommGroup Ξ±] : ContravariantClass Ξ± Ξ± (swap (Β· * Β·)) (Β· ≀ Β·) where elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le #align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le section Group variable [Group Ξ±] section TypeclassesLeftLE variable [LE Ξ±] [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] {a b c d : Ξ±} @[to_additive (attr := simp) "Uses `left` co(ntra)variant."] theorem Left.inv_le_one_iff : a⁻¹ ≀ 1 ↔ 1 ≀ a := by rw [← mul_le_mul_iff_left a] simp #align left.inv_le_one_iff Left.inv_le_one_iff #align left.neg_nonpos_iff Left.neg_nonpos_iff @[to_additive (attr := simp) "Uses `left` co(ntra)variant."] theorem Left.one_le_inv_iff : 1 ≀ a⁻¹ ↔ a ≀ 1 := by rw [← mul_le_mul_iff_left a] simp #align left.one_le_inv_iff Left.one_le_inv_iff #align left.nonneg_neg_iff Left.nonneg_neg_iff @[to_additive (attr := simp)] theorem le_inv_mul_iff_mul_le : b ≀ a⁻¹ * c ↔ a * b ≀ c := by rw [← mul_le_mul_iff_left a] simp #align le_inv_mul_iff_mul_le le_inv_mul_iff_mul_le #align le_neg_add_iff_add_le le_neg_add_iff_add_le @[to_additive (attr := simp)]
Mathlib/Algebra/Order/Group/Defs.lean
120
121
theorem inv_mul_le_iff_le_mul : b⁻¹ * a ≀ c ↔ a ≀ b * c := by
rw [← mul_le_mul_iff_left b, mul_inv_cancel_left]
1
import Batteries.Data.Sum.Basic import Batteries.Logic open Function namespace Sum @[simp] protected theorem Β«forallΒ» {p : Ξ± βŠ• Ξ² β†’ Prop} : (βˆ€ x, p x) ↔ (βˆ€ a, p (inl a)) ∧ βˆ€ b, p (inr b) := ⟨fun h => ⟨fun _ => h _, fun _ => h _⟩, fun ⟨h₁, hβ‚‚βŸ© => Sum.rec h₁ hβ‚‚βŸ© @[simp] protected theorem Β«existsΒ» {p : Ξ± βŠ• Ξ² β†’ Prop} : (βˆƒ x, p x) ↔ (βˆƒ a, p (inl a)) ∨ βˆƒ b, p (inr b) := ⟨ fun | ⟨inl a, h⟩ => Or.inl ⟨a, h⟩ | ⟨inr b, h⟩ => Or.inr ⟨b, h⟩, fun | Or.inl ⟨a, h⟩ => ⟨inl a, h⟩ | Or.inr ⟨b, h⟩ => ⟨inr b, h⟩⟩ theorem forall_sum {Ξ³ : Ξ± βŠ• Ξ² β†’ Sort _} (p : (βˆ€ ab, Ξ³ ab) β†’ Prop) : (βˆ€ fab, p fab) ↔ (βˆ€ fa fb, p (Sum.rec fa fb)) := by refine ⟨fun h fa fb => h _, fun h fab => ?_⟩ have h1 : fab = Sum.rec (fun a => fab (Sum.inl a)) (fun b => fab (Sum.inr b)) := by ext ab; cases ab <;> rfl rw [h1]; exact h _ _ section get @[simp] theorem inl_getLeft : βˆ€ (x : Ξ± βŠ• Ξ²) (h : x.isLeft), inl (x.getLeft h) = x | inl _, _ => rfl @[simp] theorem inr_getRight : βˆ€ (x : Ξ± βŠ• Ξ²) (h : x.isRight), inr (x.getRight h) = x | inr _, _ => rfl @[simp] theorem getLeft?_eq_none_iff {x : Ξ± βŠ• Ξ²} : x.getLeft? = none ↔ x.isRight := by cases x <;> simp only [getLeft?, isRight, eq_self_iff_true] @[simp] theorem getRight?_eq_none_iff {x : Ξ± βŠ• Ξ²} : x.getRight? = none ↔ x.isLeft := by cases x <;> simp only [getRight?, isLeft, eq_self_iff_true] theorem eq_left_getLeft_of_isLeft : βˆ€ {x : Ξ± βŠ• Ξ²} (h : x.isLeft), x = inl (x.getLeft h) | inl _, _ => rfl @[simp] theorem getLeft_eq_iff (h : x.isLeft) : x.getLeft h = a ↔ x = inl a := by cases x <;> simp at h ⊒ theorem eq_right_getRight_of_isRight : βˆ€ {x : Ξ± βŠ• Ξ²} (h : x.isRight), x = inr (x.getRight h) | inr _, _ => rfl @[simp] theorem getRight_eq_iff (h : x.isRight) : x.getRight h = b ↔ x = inr b := by cases x <;> simp at h ⊒ @[simp] theorem getLeft?_eq_some_iff : x.getLeft? = some a ↔ x = inl a := by cases x <;> simp only [getLeft?, Option.some.injEq, inl.injEq] @[simp] theorem getRight?_eq_some_iff : x.getRight? = some b ↔ x = inr b := by cases x <;> simp only [getRight?, Option.some.injEq, inr.injEq] @[simp] theorem bnot_isLeft (x : Ξ± βŠ• Ξ²) : !x.isLeft = x.isRight := by cases x <;> rfl @[simp] theorem isLeft_eq_false {x : Ξ± βŠ• Ξ²} : x.isLeft = false ↔ x.isRight := by cases x <;> simp theorem not_isLeft {x : Ξ± βŠ• Ξ²} : Β¬x.isLeft ↔ x.isRight := by simp @[simp] theorem bnot_isRight (x : Ξ± βŠ• Ξ²) : !x.isRight = x.isLeft := by cases x <;> rfl @[simp] theorem isRight_eq_false {x : Ξ± βŠ• Ξ²} : x.isRight = false ↔ x.isLeft := by cases x <;> simp
.lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean
81
81
theorem not_isRight {x : Ξ± βŠ• Ξ²} : Β¬x.isRight ↔ x.isLeft := by
simp
1
import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Computability.Primrec import Mathlib.Tactic.Ring import Mathlib.Tactic.Linarith #align_import computability.ackermann from "leanprover-community/mathlib"@"9b2660e1b25419042c8da10bf411aa3c67f14383" open Nat def ack : β„• β†’ β„• β†’ β„• | 0, n => n + 1 | m + 1, 0 => ack m 1 | m + 1, n + 1 => ack m (ack (m + 1) n) #align ack ack @[simp] theorem ack_zero (n : β„•) : ack 0 n = n + 1 := by rw [ack] #align ack_zero ack_zero @[simp]
Mathlib/Computability/Ackermann.lean
74
74
theorem ack_succ_zero (m : β„•) : ack (m + 1) 0 = ack m 1 := by
rw [ack]
1
import Mathlib.Algebra.Group.Prod import Mathlib.Order.Cover #align_import algebra.support from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1" assert_not_exists MonoidWithZero open Set namespace Function variable {Ξ± Ξ² A B M N P G : Type*} section One variable [One M] [One N] [One P] @[to_additive "`support` of a function is the set of points `x` such that `f x β‰  0`."] def mulSupport (f : Ξ± β†’ M) : Set Ξ± := {x | f x β‰  1} #align function.mul_support Function.mulSupport #align function.support Function.support @[to_additive] theorem mulSupport_eq_preimage (f : Ξ± β†’ M) : mulSupport f = f ⁻¹' {1}ᢜ := rfl #align function.mul_support_eq_preimage Function.mulSupport_eq_preimage #align function.support_eq_preimage Function.support_eq_preimage @[to_additive] theorem nmem_mulSupport {f : Ξ± β†’ M} {x : Ξ±} : x βˆ‰ mulSupport f ↔ f x = 1 := not_not #align function.nmem_mul_support Function.nmem_mulSupport #align function.nmem_support Function.nmem_support @[to_additive] theorem compl_mulSupport {f : Ξ± β†’ M} : (mulSupport f)ᢜ = { x | f x = 1 } := ext fun _ => nmem_mulSupport #align function.compl_mul_support Function.compl_mulSupport #align function.compl_support Function.compl_support @[to_additive (attr := simp)] theorem mem_mulSupport {f : Ξ± β†’ M} {x : Ξ±} : x ∈ mulSupport f ↔ f x β‰  1 := Iff.rfl #align function.mem_mul_support Function.mem_mulSupport #align function.mem_support Function.mem_support @[to_additive (attr := simp)] theorem mulSupport_subset_iff {f : Ξ± β†’ M} {s : Set Ξ±} : mulSupport f βŠ† s ↔ βˆ€ x, f x β‰  1 β†’ x ∈ s := Iff.rfl #align function.mul_support_subset_iff Function.mulSupport_subset_iff #align function.support_subset_iff Function.support_subset_iff @[to_additive] theorem mulSupport_subset_iff' {f : Ξ± β†’ M} {s : Set Ξ±} : mulSupport f βŠ† s ↔ βˆ€ x βˆ‰ s, f x = 1 := forall_congr' fun _ => not_imp_comm #align function.mul_support_subset_iff' Function.mulSupport_subset_iff' #align function.support_subset_iff' Function.support_subset_iff' @[to_additive] theorem mulSupport_eq_iff {f : Ξ± β†’ M} {s : Set Ξ±} : mulSupport f = s ↔ (βˆ€ x, x ∈ s β†’ f x β‰  1) ∧ βˆ€ x, x βˆ‰ s β†’ f x = 1 := by simp (config := { contextual := true }) only [ext_iff, mem_mulSupport, ne_eq, iff_def, not_imp_comm, and_comm, forall_and] #align function.mul_support_eq_iff Function.mulSupport_eq_iff #align function.support_eq_iff Function.support_eq_iff @[to_additive] theorem ext_iff_mulSupport {f g : Ξ± β†’ M} : f = g ↔ f.mulSupport = g.mulSupport ∧ βˆ€ x ∈ f.mulSupport, f x = g x := ⟨fun h ↦ h β–Έ ⟨rfl, fun _ _ ↦ rfl⟩, fun ⟨h₁, hβ‚‚βŸ© ↦ funext fun x ↦ by if hx : x ∈ f.mulSupport then exact hβ‚‚ x hx else rw [nmem_mulSupport.1 hx, nmem_mulSupport.1 (mt (Set.ext_iff.1 h₁ x).2 hx)]⟩ @[to_additive] theorem mulSupport_update_of_ne_one [DecidableEq Ξ±] (f : Ξ± β†’ M) (x : Ξ±) {y : M} (hy : y β‰  1) : mulSupport (update f x y) = insert x (mulSupport f) := by ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*] @[to_additive] theorem mulSupport_update_one [DecidableEq Ξ±] (f : Ξ± β†’ M) (x : Ξ±) : mulSupport (update f x 1) = mulSupport f \ {x} := by ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*] @[to_additive]
Mathlib/Algebra/Group/Support.lean
98
100
theorem mulSupport_update_eq_ite [DecidableEq Ξ±] [DecidableEq M] (f : Ξ± β†’ M) (x : Ξ±) (y : M) : mulSupport (update f x y) = if y = 1 then mulSupport f \ {x} else insert x (mulSupport f) := by
rcases eq_or_ne y 1 with rfl | hy <;> simp [mulSupport_update_one, mulSupport_update_of_ne_one, *]
1
import Mathlib.Algebra.FreeNonUnitalNonAssocAlgebra import Mathlib.Algebra.Lie.NonUnitalNonAssocAlgebra import Mathlib.Algebra.Lie.UniversalEnveloping import Mathlib.GroupTheory.GroupAction.Ring #align_import algebra.lie.free from "leanprover-community/mathlib"@"841ac1a3d9162bf51c6327812ecb6e5e71883ac4" universe u v w noncomputable section variable (R : Type u) (X : Type v) [CommRing R] local notation "lib" => FreeNonUnitalNonAssocAlgebra local notation "lib.lift" => FreeNonUnitalNonAssocAlgebra.lift local notation "lib.of" => FreeNonUnitalNonAssocAlgebra.of local notation "lib.lift_of_apply" => FreeNonUnitalNonAssocAlgebra.lift_of_apply local notation "lib.lift_comp_of" => FreeNonUnitalNonAssocAlgebra.lift_comp_of namespace FreeLieAlgebra inductive Rel : lib R X β†’ lib R X β†’ Prop | lie_self (a : lib R X) : Rel (a * a) 0 | leibniz_lie (a b c : lib R X) : Rel (a * (b * c)) (a * b * c + b * (a * c)) | smul (t : R) {a b : lib R X} : Rel a b β†’ Rel (t β€’ a) (t β€’ b) | add_right {a b : lib R X} (c : lib R X) : Rel a b β†’ Rel (a + c) (b + c) | mul_left (a : lib R X) {b c : lib R X} : Rel b c β†’ Rel (a * b) (a * c) | mul_right {a b : lib R X} (c : lib R X) : Rel a b β†’ Rel (a * c) (b * c) #align free_lie_algebra.rel FreeLieAlgebra.Rel variable {R X} theorem Rel.addLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a + b) (a + c) := by rw [add_comm _ b, add_comm _ c]; exact h.add_right _ #align free_lie_algebra.rel.add_left FreeLieAlgebra.Rel.addLeft theorem Rel.neg {a b : lib R X} (h : Rel R X a b) : Rel R X (-a) (-b) := by simpa only [neg_one_smul] using h.smul (-1) #align free_lie_algebra.rel.neg FreeLieAlgebra.Rel.neg theorem Rel.subLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a - b) (a - c) := by simpa only [sub_eq_add_neg] using h.neg.addLeft a #align free_lie_algebra.rel.sub_left FreeLieAlgebra.Rel.subLeft
Mathlib/Algebra/Lie/Free.lean
99
100
theorem Rel.subRight {a b : lib R X} (c : lib R X) (h : Rel R X a b) : Rel R X (a - c) (b - c) := by
simpa only [sub_eq_add_neg] using h.add_right (-c)
1
import Mathlib.Algebra.Group.Equiv.Basic import Mathlib.Algebra.Group.Aut import Mathlib.Data.ZMod.Defs import Mathlib.Tactic.Ring #align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33" open MulOpposite universe u v class Shelf (Ξ± : Type u) where act : Ξ± β†’ Ξ± β†’ Ξ± self_distrib : βˆ€ {x y z : Ξ±}, act x (act y z) = act (act x y) (act x z) #align shelf Shelf class UnitalShelf (Ξ± : Type u) extends Shelf Ξ±, One Ξ± := (one_act : βˆ€ a : Ξ±, act 1 a = a) (act_one : βˆ€ a : Ξ±, act a 1 = a) #align unital_shelf UnitalShelf @[ext] structure ShelfHom (S₁ : Type*) (Sβ‚‚ : Type*) [Shelf S₁] [Shelf Sβ‚‚] where toFun : S₁ β†’ Sβ‚‚ map_act' : βˆ€ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y) #align shelf_hom ShelfHom #align shelf_hom.ext_iff ShelfHom.ext_iff #align shelf_hom.ext ShelfHom.ext class Rack (Ξ± : Type u) extends Shelf Ξ± where invAct : Ξ± β†’ Ξ± β†’ Ξ± left_inv : βˆ€ x, Function.LeftInverse (invAct x) (act x) right_inv : βˆ€ x, Function.RightInverse (invAct x) (act x) #align rack Rack scoped[Quandles] infixr:65 " β—ƒ " => Shelf.act scoped[Quandles] infixr:65 " ◃⁻¹ " => Rack.invAct scoped[Quandles] infixr:25 " β†’β—ƒ " => ShelfHom open Quandles namespace Rack variable {R : Type*} [Rack R] -- Porting note: No longer a need for `Rack.self_distrib` export Shelf (self_distrib) -- porting note, changed name to `act'` to not conflict with `Shelf.act` def act' (x : R) : R ≃ R where toFun := Shelf.act x invFun := invAct x left_inv := left_inv x right_inv := right_inv x #align rack.act Rack.act' @[simp] theorem act'_apply (x y : R) : act' x y = x β—ƒ y := rfl #align rack.act_apply Rack.act'_apply @[simp] theorem act'_symm_apply (x y : R) : (act' x).symm y = x ◃⁻¹ y := rfl #align rack.act_symm_apply Rack.act'_symm_apply @[simp] theorem invAct_apply (x y : R) : (act' x)⁻¹ y = x ◃⁻¹ y := rfl #align rack.inv_act_apply Rack.invAct_apply @[simp] theorem invAct_act_eq (x y : R) : x ◃⁻¹ x β—ƒ y = y := left_inv x y #align rack.inv_act_act_eq Rack.invAct_act_eq @[simp] theorem act_invAct_eq (x y : R) : x β—ƒ x ◃⁻¹ y = y := right_inv x y #align rack.act_inv_act_eq Rack.act_invAct_eq theorem left_cancel (x : R) {y y' : R} : x β—ƒ y = x β—ƒ y' ↔ y = y' := by constructor Β· apply (act' x).injective rintro rfl rfl #align rack.left_cancel Rack.left_cancel theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by constructor Β· apply (act' x).symm.injective rintro rfl rfl #align rack.left_cancel_inv Rack.left_cancel_inv theorem self_distrib_inv {x y z : R} : x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z := by rw [← left_cancel (x ◃⁻¹ y), right_inv, ← left_cancel x, right_inv, self_distrib] repeat' rw [right_inv] #align rack.self_distrib_inv Rack.self_distrib_inv theorem ad_conj {R : Type*} [Rack R] (x y : R) : act' (x β—ƒ y) = act' x * act' y * (act' x)⁻¹ := by rw [eq_mul_inv_iff_mul_eq]; ext z apply self_distrib.symm #align rack.ad_conj Rack.ad_conj instance oppositeRack : Rack Rᡐᡒᡖ where act x y := op (invAct (unop x) (unop y)) self_distrib := by intro x y z induction x using MulOpposite.rec' induction y using MulOpposite.rec' induction z using MulOpposite.rec' simp only [op_inj, unop_op, op_unop] rw [self_distrib_inv] invAct x y := op (Shelf.act (unop x) (unop y)) left_inv := MulOpposite.rec' fun x => MulOpposite.rec' fun y => by simp right_inv := MulOpposite.rec' fun x => MulOpposite.rec' fun y => by simp #align rack.opposite_rack Rack.oppositeRack @[simp] theorem op_act_op_eq {x y : R} : op x β—ƒ op y = op (x ◃⁻¹ y) := rfl #align rack.op_act_op_eq Rack.op_act_op_eq @[simp] theorem op_invAct_op_eq {x y : R} : op x ◃⁻¹ op y = op (x β—ƒ y) := rfl #align rack.op_inv_act_op_eq Rack.op_invAct_op_eq @[simp]
Mathlib/Algebra/Quandle.lean
283
283
theorem self_act_act_eq {x y : R} : (x β—ƒ x) β—ƒ y = x β—ƒ y := by
rw [← right_inv x y, ← self_distrib]
1
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian import Mathlib.RingTheory.ChainOfDivisors import Mathlib.RingTheory.DedekindDomain.Basic import Mathlib.RingTheory.FractionalIdeal.Operations #align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e" variable (R A K : Type*) [CommRing R] [CommRing A] [Field K] open scoped nonZeroDivisors Polynomial section Inverse namespace FractionalIdeal variable {R₁ : Type*} [CommRing R₁] [IsDomain R₁] [Algebra R₁ K] [IsFractionRing R₁ K] variable {I J : FractionalIdeal R₁⁰ K} noncomputable instance : Inv (FractionalIdeal R₁⁰ K) := ⟨fun I => 1 / I⟩ theorem inv_eq : I⁻¹ = 1 / I := rfl #align fractional_ideal.inv_eq FractionalIdeal.inv_eq theorem inv_zero' : (0 : FractionalIdeal R₁⁰ K)⁻¹ = 0 := div_zero #align fractional_ideal.inv_zero' FractionalIdeal.inv_zero' theorem inv_nonzero {J : FractionalIdeal R₁⁰ K} (h : J β‰  0) : J⁻¹ = ⟨(1 : FractionalIdeal R₁⁰ K) / J, fractional_div_of_nonzero h⟩ := div_nonzero h #align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero theorem coe_inv_of_nonzero {J : FractionalIdeal R₁⁰ K} (h : J β‰  0) : (↑J⁻¹ : Submodule R₁ K) = IsLocalization.coeSubmodule K ⊀ / (J : Submodule R₁ K) := by simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top] #align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero variable {K} theorem mem_inv_iff (hI : I β‰  0) {x : K} : x ∈ I⁻¹ ↔ βˆ€ y ∈ I, x * y ∈ (1 : FractionalIdeal R₁⁰ K) := mem_div_iff_of_nonzero hI #align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff theorem inv_anti_mono (hI : I β‰  0) (hJ : J β‰  0) (hIJ : I ≀ J) : J⁻¹ ≀ I⁻¹ := by -- Porting note: in Lean3, introducing `x` would just give `x ∈ J⁻¹ β†’ x ∈ I⁻¹`, but -- in Lean4, it goes all the way down to the subtypes intro x simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI] exact fun h y hy => h y (hIJ hy) #align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono theorem le_self_mul_inv {I : FractionalIdeal R₁⁰ K} (hI : I ≀ (1 : FractionalIdeal R₁⁰ K)) : I ≀ I * I⁻¹ := le_self_mul_one_div hI #align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv variable (K) theorem coe_ideal_le_self_mul_inv (I : Ideal R₁) : (I : FractionalIdeal R₁⁰ K) ≀ I * (I : FractionalIdeal R₁⁰ K)⁻¹ := le_self_mul_inv coeIdeal_le_one #align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv theorem right_inverse_eq (I J : FractionalIdeal R₁⁰ K) (h : I * J = 1) : J = I⁻¹ := by have hI : I β‰  0 := ne_zero_of_mul_eq_one I J h suffices h' : I * (1 / I) = 1 from congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl apply le_antisymm Β· apply mul_le.mpr _ intro x hx y hy rw [mul_comm] exact (mem_div_iff_of_nonzero hI).mp hy x hx rw [← h] apply mul_left_mono I apply (le_div_iff_of_nonzero hI).mpr _ intro y hy x hx rw [mul_comm] exact mul_mem_mul hx hy #align fractional_ideal.right_inverse_eq FractionalIdeal.right_inverse_eq theorem mul_inv_cancel_iff {I : FractionalIdeal R₁⁰ K} : I * I⁻¹ = 1 ↔ βˆƒ J, I * J = 1 := ⟨fun h => ⟨I⁻¹, h⟩, fun ⟨J, hJ⟩ => by rwa [← right_inverse_eq K I J hJ]⟩ #align fractional_ideal.mul_inv_cancel_iff FractionalIdeal.mul_inv_cancel_iff theorem mul_inv_cancel_iff_isUnit {I : FractionalIdeal R₁⁰ K} : I * I⁻¹ = 1 ↔ IsUnit I := (mul_inv_cancel_iff K).trans isUnit_iff_exists_inv.symm #align fractional_ideal.mul_inv_cancel_iff_is_unit FractionalIdeal.mul_inv_cancel_iff_isUnit variable {K' : Type*} [Field K'] [Algebra R₁ K'] [IsFractionRing R₁ K'] @[simp]
Mathlib/RingTheory/DedekindDomain/Ideal.lean
136
137
theorem map_inv (I : FractionalIdeal R₁⁰ K) (h : K ≃ₐ[R₁] K') : I⁻¹.map (h : K →ₐ[R₁] K') = (I.map h)⁻¹ := by
rw [inv_eq, map_div, map_one, inv_eq]
1
import Mathlib.Order.Interval.Set.UnorderedInterval import Mathlib.Algebra.Order.Interval.Set.Monoid import Mathlib.Data.Set.Pointwise.Basic import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Group.MinMax #align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Interval Pointwise variable {Ξ± : Type*} namespace Set section OrderedAddCommGroup variable [OrderedAddCommGroup Ξ±] (a b c : Ξ±) @[simp] theorem preimage_const_add_Ici : (fun x => a + x) ⁻¹' Ici b = Ici (b - a) := ext fun _x => sub_le_iff_le_add'.symm #align set.preimage_const_add_Ici Set.preimage_const_add_Ici @[simp] theorem preimage_const_add_Ioi : (fun x => a + x) ⁻¹' Ioi b = Ioi (b - a) := ext fun _x => sub_lt_iff_lt_add'.symm #align set.preimage_const_add_Ioi Set.preimage_const_add_Ioi @[simp] theorem preimage_const_add_Iic : (fun x => a + x) ⁻¹' Iic b = Iic (b - a) := ext fun _x => le_sub_iff_add_le'.symm #align set.preimage_const_add_Iic Set.preimage_const_add_Iic @[simp] theorem preimage_const_add_Iio : (fun x => a + x) ⁻¹' Iio b = Iio (b - a) := ext fun _x => lt_sub_iff_add_lt'.symm #align set.preimage_const_add_Iio Set.preimage_const_add_Iio @[simp] theorem preimage_const_add_Icc : (fun x => a + x) ⁻¹' Icc b c = Icc (b - a) (c - a) := by simp [← Ici_inter_Iic] #align set.preimage_const_add_Icc Set.preimage_const_add_Icc @[simp] theorem preimage_const_add_Ico : (fun x => a + x) ⁻¹' Ico b c = Ico (b - a) (c - a) := by simp [← Ici_inter_Iio] #align set.preimage_const_add_Ico Set.preimage_const_add_Ico @[simp] theorem preimage_const_add_Ioc : (fun x => a + x) ⁻¹' Ioc b c = Ioc (b - a) (c - a) := by simp [← Ioi_inter_Iic] #align set.preimage_const_add_Ioc Set.preimage_const_add_Ioc @[simp] theorem preimage_const_add_Ioo : (fun x => a + x) ⁻¹' Ioo b c = Ioo (b - a) (c - a) := by simp [← Ioi_inter_Iio] #align set.preimage_const_add_Ioo Set.preimage_const_add_Ioo @[simp] theorem preimage_add_const_Ici : (fun x => x + a) ⁻¹' Ici b = Ici (b - a) := ext fun _x => sub_le_iff_le_add.symm #align set.preimage_add_const_Ici Set.preimage_add_const_Ici @[simp] theorem preimage_add_const_Ioi : (fun x => x + a) ⁻¹' Ioi b = Ioi (b - a) := ext fun _x => sub_lt_iff_lt_add.symm #align set.preimage_add_const_Ioi Set.preimage_add_const_Ioi @[simp] theorem preimage_add_const_Iic : (fun x => x + a) ⁻¹' Iic b = Iic (b - a) := ext fun _x => le_sub_iff_add_le.symm #align set.preimage_add_const_Iic Set.preimage_add_const_Iic @[simp] theorem preimage_add_const_Iio : (fun x => x + a) ⁻¹' Iio b = Iio (b - a) := ext fun _x => lt_sub_iff_add_lt.symm #align set.preimage_add_const_Iio Set.preimage_add_const_Iio @[simp] theorem preimage_add_const_Icc : (fun x => x + a) ⁻¹' Icc b c = Icc (b - a) (c - a) := by simp [← Ici_inter_Iic] #align set.preimage_add_const_Icc Set.preimage_add_const_Icc @[simp] theorem preimage_add_const_Ico : (fun x => x + a) ⁻¹' Ico b c = Ico (b - a) (c - a) := by simp [← Ici_inter_Iio] #align set.preimage_add_const_Ico Set.preimage_add_const_Ico @[simp] theorem preimage_add_const_Ioc : (fun x => x + a) ⁻¹' Ioc b c = Ioc (b - a) (c - a) := by simp [← Ioi_inter_Iic] #align set.preimage_add_const_Ioc Set.preimage_add_const_Ioc @[simp] theorem preimage_add_const_Ioo : (fun x => x + a) ⁻¹' Ioo b c = Ioo (b - a) (c - a) := by simp [← Ioi_inter_Iio] #align set.preimage_add_const_Ioo Set.preimage_add_const_Ioo @[simp] theorem preimage_neg_Ici : -Ici a = Iic (-a) := ext fun _x => le_neg #align set.preimage_neg_Ici Set.preimage_neg_Ici @[simp] theorem preimage_neg_Iic : -Iic a = Ici (-a) := ext fun _x => neg_le #align set.preimage_neg_Iic Set.preimage_neg_Iic @[simp] theorem preimage_neg_Ioi : -Ioi a = Iio (-a) := ext fun _x => lt_neg #align set.preimage_neg_Ioi Set.preimage_neg_Ioi @[simp] theorem preimage_neg_Iio : -Iio a = Ioi (-a) := ext fun _x => neg_lt #align set.preimage_neg_Iio Set.preimage_neg_Iio @[simp] theorem preimage_neg_Icc : -Icc a b = Icc (-b) (-a) := by simp [← Ici_inter_Iic, inter_comm] #align set.preimage_neg_Icc Set.preimage_neg_Icc @[simp]
Mathlib/Data/Set/Pointwise/Interval.lean
241
242
theorem preimage_neg_Ico : -Ico a b = Ioc (-b) (-a) := by
simp [← Ici_inter_Iio, ← Ioi_inter_Iic, inter_comm]
1
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b β‰  0 ∧ b β‰  1 ∧ b β‰  -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp]
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
64
64
theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by
rw [logb, logb, log_abs]
1
import Mathlib.Control.Monad.Basic import Mathlib.Control.Monad.Writer import Mathlib.Init.Control.Lawful #align_import control.monad.cont from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31" universe u v w uβ‚€ u₁ vβ‚€ v₁ structure MonadCont.Label (Ξ± : Type w) (m : Type u β†’ Type v) (Ξ² : Type u) where apply : Ξ± β†’ m Ξ² #align monad_cont.label MonadCont.Label def MonadCont.goto {Ξ± Ξ²} {m : Type u β†’ Type v} (f : MonadCont.Label Ξ± m Ξ²) (x : Ξ±) := f.apply x #align monad_cont.goto MonadCont.goto class MonadCont (m : Type u β†’ Type v) where callCC : βˆ€ {Ξ± Ξ²}, (MonadCont.Label Ξ± m Ξ² β†’ m Ξ±) β†’ m Ξ± #align monad_cont MonadCont open MonadCont class LawfulMonadCont (m : Type u β†’ Type v) [Monad m] [MonadCont m] extends LawfulMonad m : Prop where callCC_bind_right {Ξ± Ο‰ Ξ³} (cmd : m Ξ±) (next : Label Ο‰ m Ξ³ β†’ Ξ± β†’ m Ο‰) : (callCC fun f => cmd >>= next f) = cmd >>= fun x => callCC fun f => next f x callCC_bind_left {Ξ±} (Ξ²) (x : Ξ±) (dead : Label Ξ± m Ξ² β†’ Ξ² β†’ m Ξ±) : (callCC fun f : Label Ξ± m Ξ² => goto f x >>= dead f) = pure x callCC_dummy {Ξ± Ξ²} (dummy : m Ξ±) : (callCC fun _ : Label Ξ± m Ξ² => dummy) = dummy #align is_lawful_monad_cont LawfulMonadCont export LawfulMonadCont (callCC_bind_right callCC_bind_left callCC_dummy) def ContT (r : Type u) (m : Type u β†’ Type v) (Ξ± : Type w) := (Ξ± β†’ m r) β†’ m r #align cont_t ContT abbrev Cont (r : Type u) (Ξ± : Type w) := ContT r id Ξ± #align cont Cont variable {m : Type u β†’ Type v} [Monad m] def ExceptT.mkLabel {Ξ± Ξ² Ξ΅} : Label (Except.{u, u} Ξ΅ Ξ±) m Ξ² β†’ Label Ξ± (ExceptT Ξ΅ m) Ξ² | ⟨f⟩ => ⟨fun a => monadLift <| f (Except.ok a)⟩ #align except_t.mk_label ExceptTβ‚“.mkLabel theorem ExceptT.goto_mkLabel {Ξ± Ξ² Ξ΅ : Type _} (x : Label (Except.{u, u} Ξ΅ Ξ±) m Ξ²) (i : Ξ±) : goto (ExceptT.mkLabel x) i = ExceptT.mk (Except.ok <$> goto x (Except.ok i)) := by cases x; rfl #align except_t.goto_mk_label ExceptTβ‚“.goto_mkLabel nonrec def ExceptT.callCC {Ξ΅} [MonadCont m] {Ξ± Ξ² : Type _} (f : Label Ξ± (ExceptT Ξ΅ m) Ξ² β†’ ExceptT Ξ΅ m Ξ±) : ExceptT Ξ΅ m Ξ± := ExceptT.mk (callCC fun x : Label _ m Ξ² => ExceptT.run <| f (ExceptT.mkLabel x)) #align except_t.call_cc ExceptTβ‚“.callCC instance {Ξ΅} [MonadCont m] : MonadCont (ExceptT Ξ΅ m) where callCC := ExceptT.callCC instance {Ξ΅} [MonadCont m] [LawfulMonadCont m] : LawfulMonadCont (ExceptT Ξ΅ m) where callCC_bind_right := by intros; simp only [callCC, ExceptT.callCC, ExceptT.run_bind, callCC_bind_right]; ext dsimp congr with ⟨⟩ <;> simp [ExceptT.bindCont, @callCC_dummy m _] callCC_bind_left := by intros simp only [callCC, ExceptT.callCC, ExceptT.goto_mkLabel, map_eq_bind_pure_comp, Function.comp, ExceptT.run_bind, ExceptT.run_mk, bind_assoc, pure_bind, @callCC_bind_left m _] ext; rfl callCC_dummy := by intros; simp only [callCC, ExceptT.callCC, @callCC_dummy m _]; ext; rfl def OptionT.mkLabel {Ξ± Ξ²} : Label (Option.{u} Ξ±) m Ξ² β†’ Label Ξ± (OptionT m) Ξ² | ⟨f⟩ => ⟨fun a => monadLift <| f (some a)⟩ #align option_t.mk_label OptionTβ‚“.mkLabel theorem OptionT.goto_mkLabel {Ξ± Ξ² : Type _} (x : Label (Option.{u} Ξ±) m Ξ²) (i : Ξ±) : goto (OptionT.mkLabel x) i = OptionT.mk (goto x (some i) >>= fun a => pure (some a)) := rfl #align option_t.goto_mk_label OptionTβ‚“.goto_mkLabel nonrec def OptionT.callCC [MonadCont m] {Ξ± Ξ² : Type _} (f : Label Ξ± (OptionT m) Ξ² β†’ OptionT m Ξ±) : OptionT m Ξ± := OptionT.mk (callCC fun x : Label _ m Ξ² => OptionT.run <| f (OptionT.mkLabel x) : m (Option Ξ±)) #align option_t.call_cc OptionTβ‚“.callCC instance [MonadCont m] : MonadCont (OptionT m) where callCC := OptionT.callCC instance [MonadCont m] [LawfulMonadCont m] : LawfulMonadCont (OptionT m) where callCC_bind_right := by intros; simp only [callCC, OptionT.callCC, OptionT.run_bind, callCC_bind_right]; ext dsimp congr with ⟨⟩ <;> simp [@callCC_dummy m _] callCC_bind_left := by intros; simp only [callCC, OptionT.callCC, OptionT.goto_mkLabel, OptionT.run_bind, OptionT.run_mk, bind_assoc, pure_bind, @callCC_bind_left m _] ext; rfl callCC_dummy := by intros; simp only [callCC, OptionT.callCC, @callCC_dummy m _]; ext; rfl def WriterT.mkLabel {Ξ± Ξ² Ο‰} [EmptyCollection Ο‰] : Label (Ξ± Γ— Ο‰) m Ξ² β†’ Label Ξ± (WriterT Ο‰ m) Ξ² | ⟨f⟩ => ⟨fun a => monadLift <| f (a, βˆ…)⟩ def WriterT.mkLabel' {Ξ± Ξ² Ο‰} [Monoid Ο‰] : Label (Ξ± Γ— Ο‰) m Ξ² β†’ Label Ξ± (WriterT Ο‰ m) Ξ² | ⟨f⟩ => ⟨fun a => monadLift <| f (a, 1)⟩ #align writer_t.mk_label WriterTβ‚“.mkLabel'
Mathlib/Control/Monad/Cont.lean
193
194
theorem WriterT.goto_mkLabel {Ξ± Ξ² Ο‰ : Type _} [EmptyCollection Ο‰] (x : Label (Ξ± Γ— Ο‰) m Ξ²) (i : Ξ±) : goto (WriterT.mkLabel x) i = monadLift (goto x (i, βˆ…)) := by
cases x; rfl
1
import Mathlib.CategoryTheory.Subobject.Lattice #align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d" universe v u noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite variable {C : Type u} [Category.{v} C] {X Y Z : C} namespace CategoryTheory namespace Limits section Kernel variable [HasZeroMorphisms C] (f : X ⟢ Y) [HasKernel f] abbrev kernelSubobject : Subobject X := Subobject.mk (kernel.ΞΉ f) #align category_theory.limits.kernel_subobject CategoryTheory.Limits.kernelSubobject def kernelSubobjectIso : (kernelSubobject f : C) β‰… kernel f := Subobject.underlyingIso (kernel.ΞΉ f) #align category_theory.limits.kernel_subobject_iso CategoryTheory.Limits.kernelSubobjectIso @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobject_arrow : (kernelSubobjectIso f).hom ≫ kernel.ΞΉ f = (kernelSubobject f).arrow := by simp [kernelSubobjectIso] #align category_theory.limits.kernel_subobject_arrow CategoryTheory.Limits.kernelSubobject_arrow @[reassoc (attr := simp), elementwise (attr := simp)]
Mathlib/CategoryTheory/Subobject/Limits.lean
104
106
theorem kernelSubobject_arrow' : (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ΞΉ f := by
simp [kernelSubobjectIso]
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 section variable {ΞΉ : Type*} [Fintype ΞΉ] theorem isBoundedLinearMap_prod_multilinear {E : ΞΉ β†’ Type*} [βˆ€ i, NormedAddCommGroup (E i)] [βˆ€ i, NormedSpace π•œ (E i)] : IsBoundedLinearMap π•œ fun p : ContinuousMultilinearMap π•œ E F Γ— ContinuousMultilinearMap π•œ E G => p.1.prod p.2 where map_add p₁ pβ‚‚ := by ext : 1; rfl map_smul c p := by ext : 1; rfl bound := by refine ⟨1, zero_lt_one, fun p ↦ ?_⟩ rw [one_mul] apply ContinuousMultilinearMap.opNorm_le_bound _ (norm_nonneg _) _ intro m rw [ContinuousMultilinearMap.prod_apply, norm_prod_le_iff] constructor Β· exact (p.1.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_fst_le p) <| by positivity) Β· exact (p.2.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_snd_le p) <| by positivity) #align is_bounded_linear_map_prod_multilinear isBoundedLinearMap_prod_multilinear theorem isBoundedLinearMap_continuousMultilinearMap_comp_linear (g : G β†’L[π•œ] E) : IsBoundedLinearMap π•œ fun f : ContinuousMultilinearMap π•œ (fun _ : ΞΉ => E) F => f.compContinuousLinearMap fun _ => g := by refine IsLinearMap.with_bound ⟨fun f₁ fβ‚‚ => by ext; rfl, fun c f => by ext; rfl⟩ (β€–gβ€– ^ Fintype.card ΞΉ) fun f => ?_ apply ContinuousMultilinearMap.opNorm_le_bound _ _ _ Β· apply_rules [mul_nonneg, pow_nonneg, norm_nonneg] intro m calc β€–f (g ∘ m)β€– ≀ β€–fβ€– * ∏ i, β€–g (m i)β€– := f.le_opNorm _ _ ≀ β€–fβ€– * ∏ i, β€–gβ€– * β€–m iβ€– := by apply mul_le_mul_of_nonneg_left _ (norm_nonneg _) exact Finset.prod_le_prod (fun i _ => norm_nonneg _) fun i _ => g.le_opNorm _ _ = β€–gβ€– ^ Fintype.card ΞΉ * β€–fβ€– * ∏ i, β€–m iβ€– := by simp only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ] ring #align is_bounded_linear_map_continuous_multilinear_map_comp_linear isBoundedLinearMap_continuousMultilinearMap_comp_linear end section BilinearMap namespace ContinuousLinearMap variable {R : Type*} variable {π•œβ‚‚ π•œ' : Type*} [NontriviallyNormedField π•œ'] [NontriviallyNormedField π•œβ‚‚] variable {M : Type*} [TopologicalSpace M] variable {σ₁₂ : π•œ β†’+* π•œβ‚‚} variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace π•œβ‚‚ G'] [NormedSpace π•œ' G'] variable [SMulCommClass π•œβ‚‚ π•œ' G'] section Semiring variable [Semiring R] [AddCommMonoid M] [Module R M] {ρ₁₂ : R β†’+* π•œ'} theorem map_addβ‚‚ (f : M β†’SL[ρ₁₂] F β†’SL[σ₁₂] G') (x x' : M) (y : F) : f (x + x') y = f x y + f x' y := by rw [f.map_add, add_apply] #align continuous_linear_map.map_addβ‚‚ ContinuousLinearMap.map_addβ‚‚ theorem map_zeroβ‚‚ (f : M β†’SL[ρ₁₂] F β†’SL[σ₁₂] G') (y : F) : f 0 y = 0 := by rw [f.map_zero, zero_apply] #align continuous_linear_map.map_zeroβ‚‚ ContinuousLinearMap.map_zeroβ‚‚
Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean
293
294
theorem map_smulβ‚›β‚—β‚‚ (f : M β†’SL[ρ₁₂] F β†’SL[σ₁₂] G') (c : R) (x : M) (y : F) : f (c β€’ x) y = ρ₁₂ c β€’ f x y := by
rw [f.map_smulβ‚›β‚—, smul_apply]
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]
Mathlib/Computability/TMToPartrec.lean
183
183
theorem id_eval (v) : id.eval v = pure v := by
simp [id]
1
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots import Mathlib.FieldTheory.Finite.Trace import Mathlib.Algebra.Group.AddChar import Mathlib.Data.ZMod.Units import Mathlib.Analysis.Complex.Polynomial #align_import number_theory.legendre_symbol.add_character from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" universe u v namespace AddChar section Additive -- The domain and target of our additive characters. Now we restrict to a ring in the domain. variable {R : Type u} [CommRing R] {R' : Type v} [CommMonoid R'] lemma val_mem_rootsOfUnity (Ο† : AddChar R R') (a : R) (h : 0 < ringChar R) : (Ο†.val_isUnit a).unit ∈ rootsOfUnity (ringChar R).toPNat' R' := by simp only [mem_rootsOfUnity', IsUnit.unit_spec, Nat.toPNat'_coe, h, ↓reduceIte, ← map_nsmul_eq_pow, nsmul_eq_mul, CharP.cast_eq_zero, zero_mul, map_zero_eq_one] def IsPrimitive (ψ : AddChar R R') : Prop := βˆ€ a : R, a β‰  0 β†’ IsNontrivial (mulShift ψ a) #align add_char.is_primitive AddChar.IsPrimitive lemma IsPrimitive.compMulHom_of_isPrimitive {R'' : Type*} [CommMonoid R''] {Ο† : AddChar R R'} {f : R' β†’* R''} (hΟ† : Ο†.IsPrimitive) (hf : Function.Injective f) : (f.compAddChar Ο†).IsPrimitive := by intro a a_ne_zero obtain ⟨r, ne_one⟩ := hΟ† a a_ne_zero rw [mulShift_apply] at ne_one simp only [IsNontrivial, mulShift_apply, f.coe_compAddChar, Function.comp_apply] exact ⟨r, fun H ↦ ne_one <| hf <| f.map_one β–Έ H⟩ theorem to_mulShift_inj_of_isPrimitive {ψ : AddChar R R'} (hψ : IsPrimitive ψ) : Function.Injective ψ.mulShift := by intro a b h apply_fun fun x => x * mulShift ψ (-b) at h simp only [mulShift_mul, mulShift_zero, add_right_neg] at h have hβ‚‚ := hψ (a + -b) rw [h, isNontrivial_iff_ne_trivial, ← sub_eq_add_neg, sub_ne_zero] at hβ‚‚ exact not_not.mp fun h => hβ‚‚ h rfl #align add_char.to_mul_shift_inj_of_is_primitive AddChar.to_mulShift_inj_of_isPrimitive -- `AddCommGroup.equiv_direct_sum_zmod_of_fintype` -- gives the structure theorem for finite abelian groups. -- This could be used to show that the map above is a bijection. -- We leave this for a later occasion. theorem IsNontrivial.isPrimitive {F : Type u} [Field F] {ψ : AddChar F R'} (hψ : IsNontrivial ψ) : IsPrimitive ψ := by intro a ha cases' hψ with x h use a⁻¹ * x rwa [mulShift_apply, mul_inv_cancel_leftβ‚€ ha] #align add_char.is_nontrivial.is_primitive AddChar.IsNontrivial.isPrimitive lemma not_isPrimitive_mulShift [Finite R] (e : AddChar R R') {r : R} (hr : Β¬ IsUnit r) : Β¬ IsPrimitive (e.mulShift r) := by simp only [IsPrimitive, not_forall] simp only [isUnit_iff_mem_nonZeroDivisors_of_finite, mem_nonZeroDivisors_iff, not_forall] at hr rcases hr with ⟨x, h, h'⟩ exact ⟨x, h', by simp only [mulShift_mulShift, mul_comm r, h, mulShift_zero, not_ne_iff, isNontrivial_iff_ne_trivial]⟩ -- Porting note(#5171): this linter isn't ported yet. -- can't prove that they always exist (referring to providing an `Inhabited` instance) -- @[nolint has_nonempty_instance] structure PrimitiveAddChar (R : Type u) [CommRing R] (R' : Type v) [Field R'] where n : β„•+ char : AddChar R (CyclotomicField n R') prim : IsPrimitive char #align add_char.primitive_add_char AddChar.PrimitiveAddChar #align add_char.primitive_add_char.n AddChar.PrimitiveAddChar.n #align add_char.primitive_add_char.char AddChar.PrimitiveAddChar.char #align add_char.primitive_add_char.prim AddChar.PrimitiveAddChar.prim section ZModChar variable {C : Type v} [CommMonoid C] section ZModCharDef def zmodChar (n : β„•+) {ΞΆ : C} (hΞΆ : ΞΆ ^ (n : β„•) = 1) : AddChar (ZMod n) C where toFun a := ΞΆ ^ a.val map_zero_eq_one' := by simp only [ZMod.val_zero, pow_zero] map_add_eq_mul' x y := by simp only [ZMod.val_add, ← pow_eq_pow_mod _ hΞΆ, ← pow_add] #align add_char.zmod_char AddChar.zmodChar theorem zmodChar_apply {n : β„•+} {ΞΆ : C} (hΞΆ : ΞΆ ^ (n : β„•) = 1) (a : ZMod n) : zmodChar n hΞΆ a = ΞΆ ^ a.val := rfl #align add_char.zmod_char_apply AddChar.zmodChar_apply
Mathlib/NumberTheory/LegendreSymbol/AddCharacter.lean
169
171
theorem zmodChar_apply' {n : β„•+} {ΞΆ : C} (hΞΆ : ΞΆ ^ (n : β„•) = 1) (a : β„•) : zmodChar n hΞΆ a = ΞΆ ^ a := by
rw [pow_eq_pow_mod a hΞΆ, zmodChar_apply, ZMod.val_natCast a]
1
import Mathlib.Topology.MetricSpace.ProperSpace import Mathlib.Topology.MetricSpace.Cauchy open Set Filter Bornology open scoped ENNReal Uniformity Topology Pointwise universe u v w variable {Ξ± : Type u} {Ξ² : Type v} {X ΞΉ : Type*} variable [PseudoMetricSpace Ξ±] namespace Metric #align metric.bounded Bornology.IsBounded section Bounded variable {x : Ξ±} {s t : Set Ξ±} {r : ℝ} #noalign metric.bounded_iff_is_bounded #align metric.bounded_empty Bornology.isBounded_empty #align metric.bounded_iff_mem_bounded Bornology.isBounded_iff_forall_mem #align metric.bounded.mono Bornology.IsBounded.subset theorem isBounded_closedBall : IsBounded (closedBall x r) := isBounded_iff.2 ⟨r + r, fun y hy z hz => calc dist y z ≀ dist y x + dist z x := dist_triangle_right _ _ _ _ ≀ r + r := add_le_add hy hz⟩ #align metric.bounded_closed_ball Metric.isBounded_closedBall theorem isBounded_ball : IsBounded (ball x r) := isBounded_closedBall.subset ball_subset_closedBall #align metric.bounded_ball Metric.isBounded_ball theorem isBounded_sphere : IsBounded (sphere x r) := isBounded_closedBall.subset sphere_subset_closedBall #align metric.bounded_sphere Metric.isBounded_sphere theorem isBounded_iff_subset_closedBall (c : Ξ±) : IsBounded s ↔ βˆƒ r, s βŠ† closedBall c r := ⟨fun h ↦ (isBounded_iff.1 (h.insert c)).imp fun _r hr _x hx ↦ hr (.inr hx) (mem_insert _ _), fun ⟨_r, hr⟩ ↦ isBounded_closedBall.subset hr⟩ #align metric.bounded_iff_subset_ball Metric.isBounded_iff_subset_closedBall theorem _root_.Bornology.IsBounded.subset_closedBall (h : IsBounded s) (c : Ξ±) : βˆƒ r, s βŠ† closedBall c r := (isBounded_iff_subset_closedBall c).1 h #align metric.bounded.subset_ball Bornology.IsBounded.subset_closedBall theorem _root_.Bornology.IsBounded.subset_ball_lt (h : IsBounded s) (a : ℝ) (c : Ξ±) : βˆƒ r, a < r ∧ s βŠ† ball c r := let ⟨r, hr⟩ := h.subset_closedBall c ⟨max r a + 1, (le_max_right _ _).trans_lt (lt_add_one _), hr.trans <| closedBall_subset_ball <| (le_max_left _ _).trans_lt (lt_add_one _)⟩ theorem _root_.Bornology.IsBounded.subset_ball (h : IsBounded s) (c : Ξ±) : βˆƒ r, s βŠ† ball c r := (h.subset_ball_lt 0 c).imp fun _ ↦ And.right theorem isBounded_iff_subset_ball (c : Ξ±) : IsBounded s ↔ βˆƒ r, s βŠ† ball c r := ⟨(IsBounded.subset_ball Β· c), fun ⟨_r, hr⟩ ↦ isBounded_ball.subset hr⟩ theorem _root_.Bornology.IsBounded.subset_closedBall_lt (h : IsBounded s) (a : ℝ) (c : Ξ±) : βˆƒ r, a < r ∧ s βŠ† closedBall c r := let ⟨r, har, hr⟩ := h.subset_ball_lt a c ⟨r, har, hr.trans ball_subset_closedBall⟩ #align metric.bounded.subset_ball_lt Bornology.IsBounded.subset_closedBall_lt theorem isBounded_closure_of_isBounded (h : IsBounded s) : IsBounded (closure s) := let ⟨C, h⟩ := isBounded_iff.1 h isBounded_iff.2 ⟨C, fun _a ha _b hb => isClosed_Iic.closure_subset <| map_mem_closureβ‚‚ continuous_dist ha hb h⟩ #align metric.bounded_closure_of_bounded Metric.isBounded_closure_of_isBounded protected theorem _root_.Bornology.IsBounded.closure (h : IsBounded s) : IsBounded (closure s) := isBounded_closure_of_isBounded h #align metric.bounded.closure Bornology.IsBounded.closure @[simp] theorem isBounded_closure_iff : IsBounded (closure s) ↔ IsBounded s := ⟨fun h => h.subset subset_closure, fun h => h.closure⟩ #align metric.bounded_closure_iff Metric.isBounded_closure_iff #align metric.bounded_union Bornology.isBounded_union #align metric.bounded.union Bornology.IsBounded.union #align metric.bounded_bUnion Bornology.isBounded_biUnion #align metric.bounded.prod Bornology.IsBounded.prod theorem hasBasis_cobounded_compl_closedBall (c : Ξ±) : (cobounded Ξ±).HasBasis (fun _ ↦ True) (fun r ↦ (closedBall c r)ᢜ) := ⟨compl_surjective.forall.2 fun _ ↦ (isBounded_iff_subset_closedBall c).trans <| by simp⟩ theorem hasBasis_cobounded_compl_ball (c : Ξ±) : (cobounded Ξ±).HasBasis (fun _ ↦ True) (fun r ↦ (ball c r)ᢜ) := ⟨compl_surjective.forall.2 fun _ ↦ (isBounded_iff_subset_ball c).trans <| by simp⟩ @[simp] theorem comap_dist_right_atTop (c : Ξ±) : comap (dist Β· c) atTop = cobounded Ξ± := (atTop_basis.comap _).eq_of_same_basis <| by simpa only [compl_def, mem_ball, not_lt] using hasBasis_cobounded_compl_ball c @[simp] theorem comap_dist_left_atTop (c : Ξ±) : comap (dist c) atTop = cobounded Ξ± := by simpa only [dist_comm _ c] using comap_dist_right_atTop c @[simp] theorem tendsto_dist_right_atTop_iff (c : Ξ±) {f : Ξ² β†’ Ξ±} {l : Filter Ξ²} : Tendsto (fun x ↦ dist (f x) c) l atTop ↔ Tendsto f l (cobounded Ξ±) := by rw [← comap_dist_right_atTop c, tendsto_comap_iff, Function.comp_def] @[simp]
Mathlib/Topology/MetricSpace/Bounded.lean
142
144
theorem tendsto_dist_left_atTop_iff (c : Ξ±) {f : Ξ² β†’ Ξ±} {l : Filter Ξ²} : Tendsto (fun x ↦ dist c (f x)) l atTop ↔ Tendsto f l (cobounded Ξ±) := by
simp only [dist_comm c, tendsto_dist_right_atTop_iff]
1
import Mathlib.Data.Finset.Pointwise #align_import combinatorics.additive.e_transform from "leanprover-community/mathlib"@"207c92594599a06e7c134f8d00a030a83e6c7259" open MulOpposite open Pointwise variable {Ξ± : Type*} [DecidableEq Ξ±] namespace Finset section Group variable [Group Ξ±] (e : Ξ±) (x : Finset Ξ± Γ— Finset Ξ±) @[to_additive (attr := simps) "An **e-transform**. Turns `(s, t)` into `(s ∩ s +α΅₯ e, t βˆͺ -e +α΅₯ t)`. This reduces the sum of the two sets."] def mulETransformLeft : Finset Ξ± Γ— Finset Ξ± := (x.1 ∩ op e β€’ x.1, x.2 βˆͺ e⁻¹ β€’ x.2) #align finset.mul_e_transform_left Finset.mulETransformLeft #align finset.add_e_transform_left Finset.addETransformLeft @[to_additive (attr := simps) "An **e-transform**. Turns `(s, t)` into `(s βˆͺ s +α΅₯ e, t ∩ -e +α΅₯ t)`. This reduces the sum of the two sets."] def mulETransformRight : Finset Ξ± Γ— Finset Ξ± := (x.1 βˆͺ op e β€’ x.1, x.2 ∩ e⁻¹ β€’ x.2) #align finset.mul_e_transform_right Finset.mulETransformRight #align finset.add_e_transform_right Finset.addETransformRight @[to_additive (attr := simp)] theorem mulETransformLeft_one : mulETransformLeft 1 x = x := by simp [mulETransformLeft] #align finset.mul_e_transform_left_one Finset.mulETransformLeft_one #align finset.add_e_transform_left_zero Finset.addETransformLeft_zero @[to_additive (attr := simp)]
Mathlib/Combinatorics/Additive/ETransform.lean
137
137
theorem mulETransformRight_one : mulETransformRight 1 x = x := by
simp [mulETransformRight]
1
import Mathlib.Topology.PartialHomeomorph import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Data.Real.Sqrt #align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Set Metric Pointwise variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] noncomputable section @[simps (config := .lemmasOnly)] def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where toFun x := (√(1 + β€–xβ€– ^ 2))⁻¹ β€’ x invFun y := (√(1 - β€–(y : E)β€– ^ 2))⁻¹ β€’ (y : E) source := univ target := ball 0 1 map_source' x _ := by have : 0 < 1 + β€–xβ€– ^ 2 := by positivity rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ← _root_.div_eq_inv_mul, div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ← abs_norm x, ← sq_lt_sq, abs_norm, Real.sq_sqrt this.le] exact lt_one_add _ map_target' _ _ := trivial left_inv' x _ := by field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs, Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, ← Real.sqrt_div (zero_lt_one_add_norm_sq x).le] right_inv' y hy := by have : 0 < 1 - β€–yβ€– ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le, ← Real.sqrt_div this.le] open_source := isOpen_univ open_target := isOpen_ball continuousOn_toFun := by suffices Continuous fun (x:E) => (√(1 + β€–xβ€– ^ 2))⁻¹ from (this.smul continuous_id).continuousOn refine Continuous.invβ‚€ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity) continuity continuousOn_invFun := by have : βˆ€ y ∈ ball (0 : E) 1, √(1 - β€–(y : E)β€– ^ 2) β‰  0 := fun y hy ↦ by rw [Real.sqrt_ne_zero'] nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] exact ContinuousOn.smul (ContinuousOn.invβ‚€ (continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id @[simp] theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_apply] @[simp] theorem PartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_symm_apply] @[simps! (config := .lemmasOnly)] def Homeomorph.unitBall : E β‰ƒβ‚œ ball (0 : E) 1 := (Homeomorph.Set.univ _).symm.trans PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget #align homeomorph_unit_ball Homeomorph.unitBall @[simp] theorem Homeomorph.coe_unitBall_apply_zero : (Homeomorph.unitBall (0 : E) : E) = 0 := PartialHomeomorph.univUnitBall_apply_zero #align coe_homeomorph_unit_ball_apply_zero Homeomorph.coe_unitBall_apply_zero variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P] namespace PartialHomeomorph @[simps!] def unitBallBall (c : P) (r : ℝ) (hr : 0 < r) : PartialHomeomorph E P := ((Homeomorph.smulOfNeZero r hr.ne').trans (IsometryEquiv.vaddConst c).toHomeomorph).toPartialHomeomorphOfImageEq (ball 0 1) isOpen_ball (ball c r) <| by change (IsometryEquiv.vaddConst c) ∘ (r β€’ Β·) '' ball (0 : E) 1 = ball c r rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball] simp [abs_of_pos hr] def univBall (c : P) (r : ℝ) : PartialHomeomorph E P := if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl else (IsometryEquiv.vaddConst c).toHomeomorph.toPartialHomeomorph @[simp] theorem univBall_source (c : P) (r : ℝ) : (univBall c r).source = univ := by unfold univBall; split_ifs <;> rfl theorem univBall_target (c : P) {r : ℝ} (hr : 0 < r) : (univBall c r).target = ball c r := by rw [univBall, dif_pos hr]; rfl theorem ball_subset_univBall_target (c : P) (r : ℝ) : ball c r βŠ† (univBall c r).target := by by_cases hr : 0 < r Β· rw [univBall_target c hr] Β· rw [univBall, dif_neg hr] exact subset_univ _ @[simp] theorem univBall_apply_zero (c : P) (r : ℝ) : univBall c r 0 = c := by unfold univBall; split_ifs <;> simp @[simp] theorem univBall_symm_apply_center (c : P) (r : ℝ) : (univBall c r).symm c = 0 := by have : 0 ∈ (univBall c r).source := by simp simpa only [univBall_apply_zero] using (univBall c r).left_inv this @[continuity]
Mathlib/Analysis/NormedSpace/HomeomorphBall.lean
149
150
theorem continuous_univBall (c : P) (r : ℝ) : Continuous (univBall c r) := by
simpa [continuous_iff_continuousOn_univ] using (univBall c r).continuousOn
1
import Mathlib.Order.Interval.Set.OrdConnected import Mathlib.Order.Antisymmetrization #align_import order.cover from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" open Set OrderDual variable {Ξ± Ξ² : Type*} section WeaklyCovers section LT variable [LT Ξ±] {a b : Ξ±} def CovBy (a b : Ξ±) : Prop := a < b ∧ βˆ€ ⦃c⦄, a < c β†’ Β¬c < b #align covby CovBy infixl:50 " β‹– " => CovBy theorem CovBy.lt (h : a β‹– b) : a < b := h.1 #align covby.lt CovBy.lt
Mathlib/Order/Cover.lean
233
234
theorem not_covBy_iff (h : a < b) : Β¬a β‹– b ↔ βˆƒ c, a < c ∧ c < b := by
simp_rw [CovBy, h, true_and_iff, not_forall, exists_prop, not_not]
1
import Mathlib.CategoryTheory.Monoidal.Functor #align_import category_theory.monoidal.End from "leanprover-community/mathlib"@"85075bccb68ab7fa49fb05db816233fb790e4fe9" universe v u namespace CategoryTheory variable (C : Type u) [Category.{v} C] def endofunctorMonoidalCategory : MonoidalCategory (C β₯€ C) where tensorObj F G := F β‹™ G whiskerLeft X _ _ F := whiskerLeft X F whiskerRight F X := whiskerRight F X tensorHom Ξ± Ξ² := Ξ± β—« Ξ² tensorUnit := 𝟭 C associator F G H := Functor.associator F G H leftUnitor F := Functor.leftUnitor F rightUnitor F := Functor.rightUnitor F #align category_theory.endofunctor_monoidal_category CategoryTheory.endofunctorMonoidalCategory open CategoryTheory.MonoidalCategory attribute [local instance] endofunctorMonoidalCategory @[simp] theorem endofunctorMonoidalCategory_tensorUnit_obj (X : C) : (πŸ™_ (C β₯€ C)).obj X = X := rfl @[simp] theorem endofunctorMonoidalCategory_tensorUnit_map {X Y : C} (f : X ⟢ Y) : (πŸ™_ (C β₯€ C)).map f = f := rfl @[simp] theorem endofunctorMonoidalCategory_tensorObj_obj (F G : C β₯€ C) (X : C) : (F βŠ— G).obj X = G.obj (F.obj X) := rfl @[simp] theorem endofunctorMonoidalCategory_tensorObj_map (F G : C β₯€ C) {X Y : C} (f : X ⟢ Y) : (F βŠ— G).map f = G.map (F.map f) := rfl @[simp] theorem endofunctorMonoidalCategory_tensorMap_app {F G H K : C β₯€ C} {Ξ± : F ⟢ G} {Ξ² : H ⟢ K} (X : C) : (Ξ± βŠ— Ξ²).app X = Ξ².app (F.obj X) ≫ K.map (Ξ±.app X) := rfl @[simp] theorem endofunctorMonoidalCategory_whiskerLeft_app {F H K : C β₯€ C} {Ξ² : H ⟢ K} (X : C) : (F ◁ Ξ²).app X = Ξ².app (F.obj X) := rfl @[simp] theorem endofunctorMonoidalCategory_whiskerRight_app {F G H : C β₯€ C} {Ξ± : F ⟢ G} (X : C) : (Ξ± β–· H).app X = H.map (Ξ±.app X) := rfl @[simp] theorem endofunctorMonoidalCategory_associator_hom_app (F G H : C β₯€ C) (X : C) : (Ξ±_ F G H).hom.app X = πŸ™ _ := rfl @[simp] theorem endofunctorMonoidalCategory_associator_inv_app (F G H : C β₯€ C) (X : C) : (Ξ±_ F G H).inv.app X = πŸ™ _ := rfl @[simp] theorem endofunctorMonoidalCategory_leftUnitor_hom_app (F : C β₯€ C) (X : C) : (Ξ»_ F).hom.app X = πŸ™ _ := rfl @[simp] theorem endofunctorMonoidalCategory_leftUnitor_inv_app (F : C β₯€ C) (X : C) : (Ξ»_ F).inv.app X = πŸ™ _ := rfl @[simp] theorem endofunctorMonoidalCategory_rightUnitor_hom_app (F : C β₯€ C) (X : C) : (ρ_ F).hom.app X = πŸ™ _ := rfl @[simp] theorem endofunctorMonoidalCategory_rightUnitor_inv_app (F : C β₯€ C) (X : C) : (ρ_ F).inv.app X = πŸ™ _ := rfl @[simps!] def tensoringRightMonoidal [MonoidalCategory.{v} C] : MonoidalFunctor C (C β₯€ C) := { tensoringRight C with Ξ΅ := (rightUnitorNatIso C).inv ΞΌ := fun X Y => (isoWhiskerRight (curriedAssociatorNatIso C) ((evaluation C (C β₯€ C)).obj X β‹™ (evaluation C C).obj Y)).hom } #align category_theory.tensoring_right_monoidal CategoryTheory.tensoringRightMonoidal variable {C} variable {M : Type*} [Category M] [MonoidalCategory M] (F : MonoidalFunctor M (C β₯€ C)) @[reassoc (attr := simp)] theorem ΞΌ_hom_inv_app (i j : M) (X : C) : (F.ΞΌ i j).app X ≫ (F.ΞΌIso i j).inv.app X = πŸ™ _ := (F.ΞΌIso i j).hom_inv_id_app X #align category_theory.ΞΌ_hom_inv_app CategoryTheory.ΞΌ_hom_inv_app @[reassoc (attr := simp)] theorem ΞΌ_inv_hom_app (i j : M) (X : C) : (F.ΞΌIso i j).inv.app X ≫ (F.ΞΌ i j).app X = πŸ™ _ := (F.ΞΌIso i j).inv_hom_id_app X #align category_theory.ΞΌ_inv_hom_app CategoryTheory.ΞΌ_inv_hom_app @[reassoc (attr := simp)] theorem Ξ΅_hom_inv_app (X : C) : F.Ξ΅.app X ≫ F.Ξ΅Iso.inv.app X = πŸ™ _ := F.Ξ΅Iso.hom_inv_id_app X #align category_theory.Ξ΅_hom_inv_app CategoryTheory.Ξ΅_hom_inv_app @[reassoc (attr := simp)] theorem Ξ΅_inv_hom_app (X : C) : F.Ξ΅Iso.inv.app X ≫ F.Ξ΅.app X = πŸ™ _ := F.Ξ΅Iso.inv_hom_id_app X #align category_theory.Ξ΅_inv_hom_app CategoryTheory.Ξ΅_inv_hom_app @[reassoc (attr := simp)] theorem Ξ΅_naturality {X Y : C} (f : X ⟢ Y) : F.Ξ΅.app X ≫ (F.obj (πŸ™_ M)).map f = f ≫ F.Ξ΅.app Y := (F.Ξ΅.naturality f).symm #align category_theory.Ξ΅_naturality CategoryTheory.Ξ΅_naturality @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Monoidal/End.lean
129
131
theorem Ξ΅_inv_naturality {X Y : C} (f : X ⟢ Y) : (MonoidalFunctor.Ξ΅Iso F).inv.app X ≫ (πŸ™_ (C β₯€ C)).map f = F.Ξ΅Iso.inv.app X ≫ f := by
aesop_cat
1
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.constructions.prod.integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open scoped Classical Topology ENNReal MeasureTheory open Set Function Real ENNReal open MeasureTheory MeasurableSpace MeasureTheory.Measure open TopologicalSpace open Filter hiding prod_eq map variable {Ξ± Ξ±' Ξ² Ξ²' Ξ³ E : Type*} variable [MeasurableSpace Ξ±] [MeasurableSpace Ξ±'] [MeasurableSpace Ξ²] [MeasurableSpace Ξ²'] variable [MeasurableSpace Ξ³] variable {ΞΌ ΞΌ' : Measure Ξ±} {Ξ½ Ξ½' : Measure Ξ²} {Ο„ : Measure Ξ³} variable [NormedAddCommGroup E] theorem measurableSet_integrable [SigmaFinite Ξ½] ⦃f : Ξ± β†’ Ξ² β†’ E⦄ (hf : StronglyMeasurable (uncurry f)) : MeasurableSet {x | Integrable (f x) Ξ½} := by simp_rw [Integrable, hf.of_uncurry_left.aestronglyMeasurable, true_and_iff] exact measurableSet_lt (Measurable.lintegral_prod_right hf.ennnorm) measurable_const #align measurable_set_integrable measurableSet_integrable section variable [NormedSpace ℝ E] theorem MeasureTheory.StronglyMeasurable.integral_prod_right [SigmaFinite Ξ½] ⦃f : Ξ± β†’ Ξ² β†’ E⦄ (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y βˆ‚Ξ½ := by by_cases hE : CompleteSpace E; swap; Β· simp [integral, hE, stronglyMeasurable_const] borelize E haveI : SeparableSpace (range (uncurry f) βˆͺ {0} : Set E) := hf.separableSpace_range_union_singleton let s : β„• β†’ SimpleFunc (Ξ± Γ— Ξ²) E := SimpleFunc.approxOn _ hf.measurable (range (uncurry f) βˆͺ {0}) 0 (by simp) let s' : β„• β†’ Ξ± β†’ SimpleFunc Ξ² E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left let f' : β„• β†’ Ξ± β†’ E := fun n => {x | Integrable (f x) Ξ½}.indicator fun x => (s' n x).integral Ξ½ have hf' : βˆ€ n, StronglyMeasurable (f' n) := by intro n; refine StronglyMeasurable.indicator ?_ (measurableSet_integrable hf) have : βˆ€ x, ((s' n x).range.filter fun x => x β‰  0) βŠ† (s n).range := by intro x; refine Finset.Subset.trans (Finset.filter_subset _ _) ?_; intro y simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩ simp only [SimpleFunc.integral_eq_sum_of_subset (this _)] refine Finset.stronglyMeasurable_sum _ fun x _ => ?_ refine (Measurable.ennreal_toReal ?_).stronglyMeasurable.smul_const _ simp only [s', SimpleFunc.coe_comp, preimage_comp] apply measurable_measure_prod_mk_left exact (s n).measurableSet_fiber x have h2f' : Tendsto f' atTop (𝓝 fun x : Ξ± => ∫ y : Ξ², f x y βˆ‚Ξ½) := by rw [tendsto_pi_nhds]; intro x by_cases hfx : Integrable (f x) Ξ½ Β· have (n) : Integrable (s' n x) Ξ½ := by apply (hfx.norm.add hfx.norm).mono' (s' n x).aestronglyMeasurable filter_upwards with y simp_rw [s', SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n simp only [f', hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem, mem_setOf_eq] refine tendsto_integral_of_dominated_convergence (fun y => β€–f x yβ€– + β€–f x yβ€–) (fun n => (s' n x).aestronglyMeasurable) (hfx.norm.add hfx.norm) ?_ ?_ Β· refine fun n => eventually_of_forall fun y => SimpleFunc.norm_approxOn_zero_le ?_ ?_ (x, y) n -- Porting note: Lean 3 solved the following two subgoals on its own Β· exact hf.measurable Β· simp Β· refine eventually_of_forall fun y => SimpleFunc.tendsto_approxOn ?_ ?_ ?_ -- Porting note: Lean 3 solved the following two subgoals on its own Β· exact hf.measurable.of_uncurry_left Β· simp apply subset_closure simp [-uncurry_apply_pair] Β· simp [f', hfx, integral_undef] exact stronglyMeasurable_of_tendsto _ hf' h2f' #align measure_theory.strongly_measurable.integral_prod_right MeasureTheory.StronglyMeasurable.integral_prod_right
Mathlib/MeasureTheory/Constructions/Prod/Integral.lean
127
129
theorem MeasureTheory.StronglyMeasurable.integral_prod_right' [SigmaFinite Ξ½] ⦃f : Ξ± Γ— Ξ² β†’ E⦄ (hf : StronglyMeasurable f) : StronglyMeasurable fun x => ∫ y, f (x, y) βˆ‚Ξ½ := by
rw [← uncurry_curry f] at hf; exact hf.integral_prod_right
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] 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] #align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc @[simp] theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo ↑a ↑b := by simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map] #align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo @[simp] theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc ↑a ↑b := map_valEmbedding_Icc _ _ #align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc, ← map_valEmbedding_Icc, card_map] #align fin.card_Icc Fin.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico, ← map_valEmbedding_Ico, card_map] #align fin.card_Ico Fin.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc, ← map_valEmbedding_Ioc, card_map] #align fin.card_Ioc Fin.card_Ioc @[simp]
Mathlib/Order/Interval/Finset/Fin.lean
119
120
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [← Nat.card_Ioo, ← map_valEmbedding_Ioo, card_map]
1
import Batteries.Data.Sum.Basic import Batteries.Logic open Function namespace Sum @[simp] protected theorem Β«forallΒ» {p : Ξ± βŠ• Ξ² β†’ Prop} : (βˆ€ x, p x) ↔ (βˆ€ a, p (inl a)) ∧ βˆ€ b, p (inr b) := ⟨fun h => ⟨fun _ => h _, fun _ => h _⟩, fun ⟨h₁, hβ‚‚βŸ© => Sum.rec h₁ hβ‚‚βŸ© @[simp] protected theorem Β«existsΒ» {p : Ξ± βŠ• Ξ² β†’ Prop} : (βˆƒ x, p x) ↔ (βˆƒ a, p (inl a)) ∨ βˆƒ b, p (inr b) := ⟨ fun | ⟨inl a, h⟩ => Or.inl ⟨a, h⟩ | ⟨inr b, h⟩ => Or.inr ⟨b, h⟩, fun | Or.inl ⟨a, h⟩ => ⟨inl a, h⟩ | Or.inr ⟨b, h⟩ => ⟨inr b, h⟩⟩ theorem forall_sum {Ξ³ : Ξ± βŠ• Ξ² β†’ Sort _} (p : (βˆ€ ab, Ξ³ ab) β†’ Prop) : (βˆ€ fab, p fab) ↔ (βˆ€ fa fb, p (Sum.rec fa fb)) := by refine ⟨fun h fa fb => h _, fun h fab => ?_⟩ have h1 : fab = Sum.rec (fun a => fab (Sum.inl a)) (fun b => fab (Sum.inr b)) := by ext ab; cases ab <;> rfl rw [h1]; exact h _ _ theorem inl.inj_iff : (inl a : Ξ± βŠ• Ξ²) = inl b ↔ a = b := ⟨inl.inj, congrArg _⟩ theorem inr.inj_iff : (inr a : Ξ± βŠ• Ξ²) = inr b ↔ a = b := ⟨inr.inj, congrArg _⟩ theorem inl_ne_inr : inl a β‰  inr b := nofun theorem inr_ne_inl : inr b β‰  inl a := nofun @[simp] theorem elim_comp_inl (f : Ξ± β†’ Ξ³) (g : Ξ² β†’ Ξ³) : Sum.elim f g ∘ inl = f := rfl @[simp] theorem elim_comp_inr (f : Ξ± β†’ Ξ³) (g : Ξ² β†’ Ξ³) : Sum.elim f g ∘ inr = g := rfl @[simp] theorem elim_inl_inr : @Sum.elim Ξ± Ξ² _ inl inr = id := funext fun x => Sum.casesOn x (fun _ => rfl) fun _ => rfl theorem comp_elim (f : Ξ³ β†’ Ξ΄) (g : Ξ± β†’ Ξ³) (h : Ξ² β†’ Ξ³) : f ∘ Sum.elim g h = Sum.elim (f ∘ g) (f ∘ h) := funext fun x => Sum.casesOn x (fun _ => rfl) fun _ => rfl @[simp] theorem elim_comp_inl_inr (f : Ξ± βŠ• Ξ² β†’ Ξ³) : Sum.elim (f ∘ inl) (f ∘ inr) = f := funext fun x => Sum.casesOn x (fun _ => rfl) fun _ => rfl
.lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean
116
118
theorem elim_eq_iff {u u' : Ξ± β†’ Ξ³} {v v' : Ξ² β†’ Ξ³} : Sum.elim u v = Sum.elim u' v' ↔ u = u' ∧ v = v' := by
simp [funext_iff]
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
.lake/packages/batteries/Batteries/Data/AssocList.lean
55
56
theorem length_toList (l : AssocList Ξ± Ξ²) : l.toList.length = l.length := by
induction l <;> simp_all
1
import Mathlib.Algebra.Group.Defs import Mathlib.Algebra.GroupWithZero.Defs import Mathlib.Data.Int.Cast.Defs import Mathlib.Tactic.Spread import Mathlib.Util.AssertExists #align_import algebra.ring.defs from "leanprover-community/mathlib"@"76de8ae01554c3b37d66544866659ff174e66e1f" universe u v w x variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {R : Type x} open Function class Distrib (R : Type*) extends Mul R, Add R where protected left_distrib : βˆ€ a b c : R, a * (b + c) = a * b + a * c protected right_distrib : βˆ€ a b c : R, (a + b) * c = a * c + b * c #align distrib Distrib class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where protected left_distrib : βˆ€ a b c : R, a * (b + c) = a * b + a * c #align left_distrib_class LeftDistribClass class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where protected right_distrib : βˆ€ a b c : R, (a + b) * c = a * c + b * c #align right_distrib_class RightDistribClass -- see Note [lower instance priority] instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R := ⟨Distrib.left_distrib⟩ #align distrib.left_distrib_class Distrib.leftDistribClass -- see Note [lower instance priority] instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] : RightDistribClass R := ⟨Distrib.right_distrib⟩ #align distrib.right_distrib_class Distrib.rightDistribClass theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) : a * (b + c) = a * b + a * c := LeftDistribClass.left_distrib a b c #align left_distrib left_distrib alias mul_add := left_distrib #align mul_add mul_add theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) : (a + b) * c = a * c + b * c := RightDistribClass.right_distrib a b c #align right_distrib right_distrib alias add_mul := right_distrib #align add_mul add_mul theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) : (a + b + c) * d = a * d + b * d + c * d := by simp [right_distrib] #align distrib_three_right distrib_three_right class NonUnitalNonAssocSemiring (Ξ± : Type u) extends AddCommMonoid Ξ±, Distrib Ξ±, MulZeroClass Ξ± #align non_unital_non_assoc_semiring NonUnitalNonAssocSemiring class NonUnitalSemiring (Ξ± : Type u) extends NonUnitalNonAssocSemiring Ξ±, SemigroupWithZero Ξ± #align non_unital_semiring NonUnitalSemiring class NonAssocSemiring (Ξ± : Type u) extends NonUnitalNonAssocSemiring Ξ±, MulZeroOneClass Ξ±, AddCommMonoidWithOne Ξ± #align non_assoc_semiring NonAssocSemiring class NonUnitalNonAssocRing (Ξ± : Type u) extends AddCommGroup Ξ±, NonUnitalNonAssocSemiring Ξ± #align non_unital_non_assoc_ring NonUnitalNonAssocRing class NonUnitalRing (Ξ± : Type*) extends NonUnitalNonAssocRing Ξ±, NonUnitalSemiring Ξ± #align non_unital_ring NonUnitalRing class NonAssocRing (Ξ± : Type*) extends NonUnitalNonAssocRing Ξ±, NonAssocSemiring Ξ±, AddCommGroupWithOne Ξ± #align non_assoc_ring NonAssocRing class Semiring (Ξ± : Type u) extends NonUnitalSemiring Ξ±, NonAssocSemiring Ξ±, MonoidWithZero Ξ± #align semiring Semiring class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R #align ring Ring section DistribMulOneClass variable [Add Ξ±] [MulOneClass Ξ±] theorem add_one_mul [RightDistribClass Ξ±] (a b : Ξ±) : (a + 1) * b = a * b + b := by rw [add_mul, one_mul] #align add_one_mul add_one_mul theorem mul_add_one [LeftDistribClass Ξ±] (a b : Ξ±) : a * (b + 1) = a * b + a := by rw [mul_add, mul_one] #align mul_add_one mul_add_one
Mathlib/Algebra/Ring/Defs.lean
164
165
theorem one_add_mul [RightDistribClass Ξ±] (a b : Ξ±) : (1 + a) * b = b + a * b := by
rw [add_mul, one_mul]
1
import Mathlib.Topology.Category.TopCat.Limits.Products #align_import topology.category.Top.limits.pullbacks from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace open CategoryTheory open CategoryTheory.Limits universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] section Pullback variable {X Y Z : TopCat.{u}} abbrev pullbackFst (f : X ⟢ Z) (g : Y ⟢ Z) : TopCat.of { p : X Γ— Y // f p.1 = g p.2 } ⟢ X := ⟨Prod.fst ∘ Subtype.val, by apply Continuous.comp <;> set_option tactic.skipAssignedInstances false in continuity⟩ #align Top.pullback_fst TopCat.pullbackFst lemma pullbackFst_apply (f : X ⟢ Z) (g : Y ⟢ Z) (x) : pullbackFst f g x = x.1.1 := rfl abbrev pullbackSnd (f : X ⟢ Z) (g : Y ⟢ Z) : TopCat.of { p : X Γ— Y // f p.1 = g p.2 } ⟢ Y := ⟨Prod.snd ∘ Subtype.val, by apply Continuous.comp <;> set_option tactic.skipAssignedInstances false in continuity⟩ #align Top.pullback_snd TopCat.pullbackSnd lemma pullbackSnd_apply (f : X ⟢ Z) (g : Y ⟢ Z) (x) : pullbackSnd f g x = x.1.2 := rfl def pullbackCone (f : X ⟢ Z) (g : Y ⟢ Z) : PullbackCone f g := PullbackCone.mk (pullbackFst f g) (pullbackSnd f g) (by dsimp [pullbackFst, pullbackSnd, Function.comp_def] ext ⟨x, h⟩ -- Next 2 lines were -- `rw [comp_apply, ContinuousMap.coe_mk, comp_apply, ContinuousMap.coe_mk]` -- `exact h` before leanprover/lean4#2644 rw [comp_apply, comp_apply] congr!) #align Top.pullback_cone TopCat.pullbackCone def pullbackConeIsLimit (f : X ⟢ Z) (g : Y ⟢ Z) : IsLimit (pullbackCone f g) := PullbackCone.isLimitAux' _ (by intro S constructor; swap Β· exact { toFun := fun x => ⟨⟨S.fst x, S.snd x⟩, by simpa using ConcreteCategory.congr_hom S.condition x⟩ continuous_toFun := by apply Continuous.subtype_mk <| Continuous.prod_mk ?_ ?_ Β· exact (PullbackCone.fst S)|>.continuous_toFun Β· exact (PullbackCone.snd S)|>.continuous_toFun } refine ⟨?_, ?_, ?_⟩ Β· delta pullbackCone ext a -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp_apply, ContinuousMap.coe_mk] Β· delta pullbackCone ext a -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp_apply, ContinuousMap.coe_mk] Β· intro m h₁ hβ‚‚ -- Porting note: used to be ext x apply ContinuousMap.ext; intro x apply Subtype.ext apply Prod.ext Β· simpa using ConcreteCategory.congr_hom h₁ x Β· simpa using ConcreteCategory.congr_hom hβ‚‚ x) #align Top.pullback_cone_is_limit TopCat.pullbackConeIsLimit def pullbackIsoProdSubtype (f : X ⟢ Z) (g : Y ⟢ Z) : pullback f g β‰… TopCat.of { p : X Γ— Y // f p.1 = g p.2 } := (limit.isLimit _).conePointUniqueUpToIso (pullbackConeIsLimit f g) #align Top.pullback_iso_prod_subtype TopCat.pullbackIsoProdSubtype @[reassoc (attr := simp)] theorem pullbackIsoProdSubtype_inv_fst (f : X ⟢ Z) (g : Y ⟢ Z) : (pullbackIsoProdSubtype f g).inv ≫ pullback.fst = pullbackFst f g := by simp [pullbackCone, pullbackIsoProdSubtype] #align Top.pullback_iso_prod_subtype_inv_fst TopCat.pullbackIsoProdSubtype_inv_fst theorem pullbackIsoProdSubtype_inv_fst_apply (f : X ⟢ Z) (g : Y ⟢ Z) (x : { p : X Γ— Y // f p.1 = g p.2 }) : (pullback.fst : pullback f g ⟢ _) ((pullbackIsoProdSubtype f g).inv x) = (x : X Γ— Y).fst := ConcreteCategory.congr_hom (pullbackIsoProdSubtype_inv_fst f g) x #align Top.pullback_iso_prod_subtype_inv_fst_apply TopCat.pullbackIsoProdSubtype_inv_fst_apply @[reassoc (attr := simp)] theorem pullbackIsoProdSubtype_inv_snd (f : X ⟢ Z) (g : Y ⟢ Z) : (pullbackIsoProdSubtype f g).inv ≫ pullback.snd = pullbackSnd f g := by simp [pullbackCone, pullbackIsoProdSubtype] #align Top.pullback_iso_prod_subtype_inv_snd TopCat.pullbackIsoProdSubtype_inv_snd theorem pullbackIsoProdSubtype_inv_snd_apply (f : X ⟢ Z) (g : Y ⟢ Z) (x : { p : X Γ— Y // f p.1 = g p.2 }) : (pullback.snd : pullback f g ⟢ _) ((pullbackIsoProdSubtype f g).inv x) = (x : X Γ— Y).snd := ConcreteCategory.congr_hom (pullbackIsoProdSubtype_inv_snd f g) x #align Top.pullback_iso_prod_subtype_inv_snd_apply TopCat.pullbackIsoProdSubtype_inv_snd_apply
Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean
126
128
theorem pullbackIsoProdSubtype_hom_fst (f : X ⟢ Z) (g : Y ⟢ Z) : (pullbackIsoProdSubtype f g).hom ≫ pullbackFst f g = pullback.fst := by
rw [← Iso.eq_inv_comp, pullbackIsoProdSubtype_inv_fst]
1
import Mathlib.Order.ConditionallyCompleteLattice.Basic import Mathlib.Order.LatticeIntervals import Mathlib.Order.Interval.Set.OrdConnected #align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" open scoped Classical open Set variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±) section InfSet variable [Preorder Ξ±] [InfSet Ξ±] noncomputable def subsetInfSet [Inhabited s] : InfSet s where sInf t := if ht : t.Nonempty ∧ BddBelow t ∧ sInf ((↑) '' t : Set Ξ±) ∈ s then ⟨sInf ((↑) '' t : Set Ξ±), ht.2.2⟩ else default #align subset_has_Inf subsetInfSet attribute [local instance] subsetInfSet @[simp] theorem subset_sInf_def [Inhabited s] : @sInf s _ = fun t => if ht : t.Nonempty ∧ BddBelow t ∧ sInf ((↑) '' t : Set Ξ±) ∈ s then ⟨sInf ((↑) '' t : Set Ξ±), ht.2.2⟩ else default := rfl #align subset_Inf_def subset_sInf_def theorem subset_sInf_of_within [Inhabited s] {t : Set s} (h' : t.Nonempty) (h'' : BddBelow t) (h : sInf ((↑) '' t : Set Ξ±) ∈ s) : sInf ((↑) '' t : Set Ξ±) = (@sInf s _ t : Ξ±) := by simp [dif_pos, h, h', h''] #align subset_Inf_of_within subset_sInf_of_within
Mathlib/Order/CompleteLatticeIntervals.lean
102
104
theorem subset_sInf_emptyset [Inhabited s] : sInf (βˆ… : Set s) = default := by
simp [sInf]
1
import Mathlib.Algebra.FreeNonUnitalNonAssocAlgebra import Mathlib.Algebra.Lie.NonUnitalNonAssocAlgebra import Mathlib.Algebra.Lie.UniversalEnveloping import Mathlib.GroupTheory.GroupAction.Ring #align_import algebra.lie.free from "leanprover-community/mathlib"@"841ac1a3d9162bf51c6327812ecb6e5e71883ac4" universe u v w noncomputable section variable (R : Type u) (X : Type v) [CommRing R] local notation "lib" => FreeNonUnitalNonAssocAlgebra local notation "lib.lift" => FreeNonUnitalNonAssocAlgebra.lift local notation "lib.of" => FreeNonUnitalNonAssocAlgebra.of local notation "lib.lift_of_apply" => FreeNonUnitalNonAssocAlgebra.lift_of_apply local notation "lib.lift_comp_of" => FreeNonUnitalNonAssocAlgebra.lift_comp_of namespace FreeLieAlgebra inductive Rel : lib R X β†’ lib R X β†’ Prop | lie_self (a : lib R X) : Rel (a * a) 0 | leibniz_lie (a b c : lib R X) : Rel (a * (b * c)) (a * b * c + b * (a * c)) | smul (t : R) {a b : lib R X} : Rel a b β†’ Rel (t β€’ a) (t β€’ b) | add_right {a b : lib R X} (c : lib R X) : Rel a b β†’ Rel (a + c) (b + c) | mul_left (a : lib R X) {b c : lib R X} : Rel b c β†’ Rel (a * b) (a * c) | mul_right {a b : lib R X} (c : lib R X) : Rel a b β†’ Rel (a * c) (b * c) #align free_lie_algebra.rel FreeLieAlgebra.Rel variable {R X}
Mathlib/Algebra/Lie/Free.lean
87
88
theorem Rel.addLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a + b) (a + c) := by
rw [add_comm _ b, add_comm _ c]; exact h.add_right _
1
import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Logic.Encodable.Lattice noncomputable section open Filter Finset Function Encodable open scoped Topology variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M} variable {G : Type*} [CommGroup G] {g g' : G} -- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead section Nat section Monoid namespace HasProd @[to_additive "If `f : β„• β†’ M` has sum `m`, then the partial sums `βˆ‘ i ∈ range n, f i` converge to `m`."] theorem tendsto_prod_nat {f : β„• β†’ M} (h : HasProd f m) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := h.comp tendsto_finset_range #align has_sum.tendsto_sum_nat HasSum.tendsto_sum_nat @[to_additive "If `f : β„• β†’ M` is summable, then the partial sums `βˆ‘ i ∈ range n, f i` converge to `βˆ‘' i, f i`."] theorem Multipliable.tendsto_prod_tprod_nat {f : β„• β†’ M} (h : Multipliable f) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) := tendsto_prod_nat h.hasProd section tprod variable [T2Space M] {Ξ± Ξ² Ξ³ : Type*} section UniformGroup variable [UniformSpace G] [UniformGroup G] @[to_additive] theorem cauchySeq_finset_iff_nat_tprod_vanishing {f : β„• β†’ G} : (CauchySeq fun s : Finset β„• ↦ ∏ n ∈ s, f n) ↔ βˆ€ e ∈ 𝓝 (1 : G), βˆƒ N : β„•, βˆ€ t βŠ† {n | N ≀ n}, (∏' n : t, f n) ∈ e := by refine cauchySeq_finset_iff_tprod_vanishing.trans ⟨fun vanish e he ↦ ?_, fun vanish e he ↦ ?_⟩ Β· obtain ⟨s, hs⟩ := vanish e he refine ⟨if h : s.Nonempty then s.max' h + 1 else 0, fun t ht ↦ hs _ <| Set.disjoint_left.mpr ?_⟩ split_ifs at ht with h Β· exact fun m hmt hms ↦ (s.le_max' _ hms).not_lt (Nat.succ_le_iff.mp <| ht hmt) Β· exact fun _ _ hs ↦ h ⟨_, hs⟩ Β· obtain ⟨N, hN⟩ := vanish e he exact ⟨range N, fun t ht ↦ hN _ fun n hnt ↦ le_of_not_lt fun h ↦ Set.disjoint_left.mp ht hnt (mem_range.mpr h)⟩ variable [CompleteSpace G] @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean
290
292
theorem multipliable_iff_nat_tprod_vanishing {f : β„• β†’ G} : Multipliable f ↔ βˆ€ e ∈ 𝓝 1, βˆƒ N : β„•, βˆ€ t βŠ† {n | N ≀ n}, (∏' n : t, f n) ∈ e := by
rw [multipliable_iff_cauchySeq_finset, cauchySeq_finset_iff_nat_tprod_vanishing]
1
import Mathlib.Order.UpperLower.Basic import Mathlib.Data.Finset.Preimage #align_import combinatorics.young.young_diagram from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Function @[ext] structure YoungDiagram where cells : Finset (β„• Γ— β„•) isLowerSet : IsLowerSet (cells : Set (β„• Γ— β„•)) #align young_diagram YoungDiagram namespace YoungDiagram instance : SetLike YoungDiagram (β„• Γ— β„•) where -- Porting note (#11215): TODO: figure out how to do this correctly coe := fun y => y.cells coe_injective' ΞΌ Ξ½ h := by rwa [YoungDiagram.ext_iff, ← Finset.coe_inj] @[simp] theorem mem_cells {ΞΌ : YoungDiagram} (c : β„• Γ— β„•) : c ∈ ΞΌ.cells ↔ c ∈ ΞΌ := Iff.rfl #align young_diagram.mem_cells YoungDiagram.mem_cells @[simp] theorem mem_mk (c : β„• Γ— β„•) (cells) (isLowerSet) : c ∈ YoungDiagram.mk cells isLowerSet ↔ c ∈ cells := Iff.rfl #align young_diagram.mem_mk YoungDiagram.mem_mk instance decidableMem (ΞΌ : YoungDiagram) : DecidablePred (Β· ∈ ΞΌ) := inferInstanceAs (DecidablePred (Β· ∈ ΞΌ.cells)) #align young_diagram.decidable_mem YoungDiagram.decidableMem theorem up_left_mem (ΞΌ : YoungDiagram) {i1 i2 j1 j2 : β„•} (hi : i1 ≀ i2) (hj : j1 ≀ j2) (hcell : (i2, j2) ∈ ΞΌ) : (i1, j1) ∈ ΞΌ := ΞΌ.isLowerSet (Prod.mk_le_mk.mpr ⟨hi, hj⟩) hcell #align young_diagram.up_left_mem YoungDiagram.up_left_mem protected abbrev card (ΞΌ : YoungDiagram) : β„• := ΞΌ.cells.card #align young_diagram.card YoungDiagram.card section Rows def row (ΞΌ : YoungDiagram) (i : β„•) : Finset (β„• Γ— β„•) := ΞΌ.cells.filter fun c => c.fst = i #align young_diagram.row YoungDiagram.row theorem mem_row_iff {ΞΌ : YoungDiagram} {i : β„•} {c : β„• Γ— β„•} : c ∈ ΞΌ.row i ↔ c ∈ ΞΌ ∧ c.fst = i := by simp [row] #align young_diagram.mem_row_iff YoungDiagram.mem_row_iff theorem mk_mem_row_iff {ΞΌ : YoungDiagram} {i j : β„•} : (i, j) ∈ ΞΌ.row i ↔ (i, j) ∈ ΞΌ := by simp [row] #align young_diagram.mk_mem_row_iff YoungDiagram.mk_mem_row_iff protected theorem exists_not_mem_row (ΞΌ : YoungDiagram) (i : β„•) : βˆƒ j, (i, j) βˆ‰ ΞΌ := by obtain ⟨j, hj⟩ := Infinite.exists_not_mem_finset (ΞΌ.cells.preimage (Prod.mk i) fun _ _ _ _ h => by cases h rfl) rw [Finset.mem_preimage] at hj exact ⟨j, hj⟩ #align young_diagram.exists_not_mem_row YoungDiagram.exists_not_mem_row def rowLen (ΞΌ : YoungDiagram) (i : β„•) : β„• := Nat.find <| ΞΌ.exists_not_mem_row i #align young_diagram.row_len YoungDiagram.rowLen theorem mem_iff_lt_rowLen {ΞΌ : YoungDiagram} {i j : β„•} : (i, j) ∈ ΞΌ ↔ j < ΞΌ.rowLen i := by rw [rowLen, Nat.lt_find_iff] push_neg exact ⟨fun h _ hmj => ΞΌ.up_left_mem (by rfl) hmj h, fun h => h _ (by rfl)⟩ #align young_diagram.mem_iff_lt_row_len YoungDiagram.mem_iff_lt_rowLen theorem row_eq_prod {ΞΌ : YoungDiagram} {i : β„•} : ΞΌ.row i = {i} Γ—Λ’ Finset.range (ΞΌ.rowLen i) := by ext ⟨a, b⟩ simp only [Finset.mem_product, Finset.mem_singleton, Finset.mem_range, mem_row_iff, mem_iff_lt_rowLen, and_comm, and_congr_right_iff] rintro rfl rfl #align young_diagram.row_eq_prod YoungDiagram.row_eq_prod
Mathlib/Combinatorics/Young/YoungDiagram.lean
321
322
theorem rowLen_eq_card (ΞΌ : YoungDiagram) {i : β„•} : ΞΌ.rowLen i = (ΞΌ.row i).card := by
simp [row_eq_prod]
1
import Mathlib.Data.ENNReal.Inv #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal section iSup @[simp] theorem iSup_eq_zero {ΞΉ : Sort*} {f : ΞΉ β†’ ℝβ‰₯0∞} : ⨆ i, f i = 0 ↔ βˆ€ i, f i = 0 := iSup_eq_bot #align ennreal.supr_eq_zero ENNReal.iSup_eq_zero @[simp]
Mathlib/Data/ENNReal/Real.lean
676
676
theorem iSup_zero_eq_zero {ΞΉ : Sort*} : ⨆ _ : ΞΉ, (0 : ℝβ‰₯0∞) = 0 := by
simp
1
import Mathlib.Data.Finset.Lattice import Mathlib.Data.Multiset.Powerset #align_import data.finset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Finset open Function Multiset variable {Ξ± : Type*} {s t : Finset Ξ±} section Powerset def powerset (s : Finset Ξ±) : Finset (Finset Ξ±) := ⟨(s.1.powerset.pmap Finset.mk) fun _t h => nodup_of_le (mem_powerset.1 h) s.nodup, s.nodup.powerset.pmap fun _a _ha _b _hb => congr_arg Finset.val⟩ #align finset.powerset Finset.powerset @[simp] theorem mem_powerset {s t : Finset Ξ±} : s ∈ powerset t ↔ s βŠ† t := by cases s simp [powerset, mem_mk, mem_pmap, mk.injEq, mem_powerset, exists_prop, exists_eq_right, ← val_le_iff] #align finset.mem_powerset Finset.mem_powerset @[simp, norm_cast] theorem coe_powerset (s : Finset Ξ±) : (s.powerset : Set (Finset Ξ±)) = ((↑) : Finset Ξ± β†’ Set Ξ±) ⁻¹' (s : Set Ξ±).powerset := by ext simp #align finset.coe_powerset Finset.coe_powerset -- Porting note: remove @[simp], simp can prove it theorem empty_mem_powerset (s : Finset Ξ±) : βˆ… ∈ powerset s := mem_powerset.2 (empty_subset _) #align finset.empty_mem_powerset Finset.empty_mem_powerset -- Porting note: remove @[simp], simp can prove it theorem mem_powerset_self (s : Finset Ξ±) : s ∈ powerset s := mem_powerset.2 Subset.rfl #align finset.mem_powerset_self Finset.mem_powerset_self @[aesop safe apply (rule_sets := [finsetNonempty])] theorem powerset_nonempty (s : Finset Ξ±) : s.powerset.Nonempty := βŸ¨βˆ…, empty_mem_powerset _⟩ #align finset.powerset_nonempty Finset.powerset_nonempty @[simp] theorem powerset_mono {s t : Finset Ξ±} : powerset s βŠ† powerset t ↔ s βŠ† t := ⟨fun h => mem_powerset.1 <| h <| mem_powerset_self _, fun st _u h => mem_powerset.2 <| Subset.trans (mem_powerset.1 h) st⟩ #align finset.powerset_mono Finset.powerset_mono theorem powerset_injective : Injective (powerset : Finset Ξ± β†’ Finset (Finset Ξ±)) := (injective_of_le_imp_le _) powerset_mono.1 #align finset.powerset_injective Finset.powerset_injective @[simp] theorem powerset_inj : powerset s = powerset t ↔ s = t := powerset_injective.eq_iff #align finset.powerset_inj Finset.powerset_inj @[simp] theorem powerset_empty : (βˆ… : Finset Ξ±).powerset = {βˆ…} := rfl #align finset.powerset_empty Finset.powerset_empty @[simp]
Mathlib/Data/Finset/Powerset.lean
83
84
theorem powerset_eq_singleton_empty : s.powerset = {βˆ…} ↔ s = βˆ… := by
rw [← powerset_empty, powerset_inj]
1
import Mathlib.Data.Int.AbsoluteValue import Mathlib.LinearAlgebra.Matrix.Determinant.Basic #align_import linear_algebra.matrix.absolute_value from "leanprover-community/mathlib"@"ab0a2959c83b06280ef576bc830d4aa5fe8c8e61" open Matrix namespace Matrix open Equiv Finset variable {R S : Type*} [CommRing R] [Nontrivial R] [LinearOrderedCommRing S] variable {n : Type*} [Fintype n] [DecidableEq n]
Mathlib/LinearAlgebra/Matrix/AbsoluteValue.lean
37
49
theorem det_le {A : Matrix n n R} {abv : AbsoluteValue R S} {x : S} (hx : βˆ€ i j, abv (A i j) ≀ x) : abv A.det ≀ Nat.factorial (Fintype.card n) β€’ x ^ Fintype.card n := calc abv A.det = abv (βˆ‘ Οƒ : Perm n, Perm.sign Οƒ β€’ ∏ i, A (Οƒ i) i) := congr_arg abv (det_apply _) _ ≀ βˆ‘ Οƒ : Perm n, abv (Perm.sign Οƒ β€’ ∏ i, A (Οƒ i) i) := abv.sum_le _ _ _ = βˆ‘ Οƒ : Perm n, ∏ i, abv (A (Οƒ i) i) := (sum_congr rfl fun Οƒ _ => by rw [abv.map_units_int_smul, abv.map_prod]) _ ≀ βˆ‘ _Οƒ : Perm n, ∏ _i : n, x := (sum_le_sum fun _ _ => prod_le_prod (fun _ _ => abv.nonneg _) fun _ _ => hx _ _) _ = βˆ‘ _Οƒ : Perm n, x ^ Fintype.card n := (sum_congr rfl fun _ _ => by rw [prod_const, Finset.card_univ]) _ = Nat.factorial (Fintype.card n) β€’ x ^ Fintype.card n := by
rw [sum_const, Finset.card_univ, Fintype.card_perm]
1
import Mathlib.Topology.MetricSpace.PseudoMetric #align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Bornology open scoped NNReal Uniformity universe u v w variable {Ξ± : Type u} {Ξ² : Type v} {X ΞΉ : Type*} variable [PseudoMetricSpace Ξ±] class MetricSpace (Ξ± : Type u) extends PseudoMetricSpace Ξ± : Type u where eq_of_dist_eq_zero : βˆ€ {x y : Ξ±}, dist x y = 0 β†’ x = y #align metric_space MetricSpace @[ext] theorem MetricSpace.ext {Ξ± : Type*} {m m' : MetricSpace Ξ±} (h : m.toDist = m'.toDist) : m = m' := by cases m; cases m'; congr; ext1; assumption #align metric_space.ext MetricSpace.ext def MetricSpace.ofDistTopology {Ξ± : Type u} [TopologicalSpace Ξ±] (dist : Ξ± β†’ Ξ± β†’ ℝ) (dist_self : βˆ€ x : Ξ±, dist x x = 0) (dist_comm : βˆ€ x y : Ξ±, dist x y = dist y x) (dist_triangle : βˆ€ x y z : Ξ±, dist x z ≀ dist x y + dist y z) (H : βˆ€ s : Set Ξ±, IsOpen s ↔ βˆ€ x ∈ s, βˆƒ Ξ΅ > 0, βˆ€ y, dist x y < Ξ΅ β†’ y ∈ s) (eq_of_dist_eq_zero : βˆ€ x y : Ξ±, dist x y = 0 β†’ x = y) : MetricSpace Ξ± := { PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ } #align metric_space.of_dist_topology MetricSpace.ofDistTopology variable {Ξ³ : Type w} [MetricSpace Ξ³] theorem eq_of_dist_eq_zero {x y : Ξ³} : dist x y = 0 β†’ x = y := MetricSpace.eq_of_dist_eq_zero #align eq_of_dist_eq_zero eq_of_dist_eq_zero @[simp] theorem dist_eq_zero {x y : Ξ³} : dist x y = 0 ↔ x = y := Iff.intro eq_of_dist_eq_zero fun this => this β–Έ dist_self _ #align dist_eq_zero dist_eq_zero @[simp] theorem zero_eq_dist {x y : Ξ³} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero] #align zero_eq_dist zero_eq_dist theorem dist_ne_zero {x y : Ξ³} : dist x y β‰  0 ↔ x β‰  y := by simpa only [not_iff_not] using dist_eq_zero #align dist_ne_zero dist_ne_zero @[simp] theorem dist_le_zero {x y : Ξ³} : dist x y ≀ 0 ↔ x = y := by simpa [le_antisymm_iff, dist_nonneg] using @dist_eq_zero _ _ x y #align dist_le_zero dist_le_zero @[simp] theorem dist_pos {x y : Ξ³} : 0 < dist x y ↔ x β‰  y := by simpa only [not_le] using not_congr dist_le_zero #align dist_pos dist_pos theorem eq_of_forall_dist_le {x y : Ξ³} (h : βˆ€ Ξ΅ > 0, dist x y ≀ Ξ΅) : x = y := eq_of_dist_eq_zero (eq_of_le_of_forall_le_of_dense dist_nonneg h) #align eq_of_forall_dist_le eq_of_forall_dist_le
Mathlib/Topology/MetricSpace/Basic.lean
96
97
theorem eq_of_nndist_eq_zero {x y : Ξ³} : nndist x y = 0 β†’ x = y := by
simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero]
1
import Mathlib.Tactic.CategoryTheory.Reassoc #align_import category_theory.isomorphism from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" universe v u -- morphism levels before object levels. See note [CategoryTheory universes]. namespace CategoryTheory open Category structure Iso {C : Type u} [Category.{v} C] (X Y : C) where hom : X ⟢ Y inv : Y ⟢ X hom_inv_id : hom ≫ inv = πŸ™ X := by aesop_cat inv_hom_id : inv ≫ hom = πŸ™ Y := by aesop_cat #align category_theory.iso CategoryTheory.Iso #align category_theory.iso.hom CategoryTheory.Iso.hom #align category_theory.iso.inv CategoryTheory.Iso.inv #align category_theory.iso.inv_hom_id CategoryTheory.Iso.inv_hom_id #align category_theory.iso.hom_inv_id CategoryTheory.Iso.hom_inv_id attribute [reassoc (attr := simp)] Iso.hom_inv_id Iso.inv_hom_id #align category_theory.iso.hom_inv_id_assoc CategoryTheory.Iso.hom_inv_id_assoc #align category_theory.iso.inv_hom_id_assoc CategoryTheory.Iso.inv_hom_id_assoc infixr:10 " β‰… " => Iso -- type as \cong or \iso variable {C : Type u} [Category.{v} C] {X Y Z : C} class IsIso (f : X ⟢ Y) : Prop where out : βˆƒ inv : Y ⟢ X, f ≫ inv = πŸ™ X ∧ inv ≫ f = πŸ™ Y #align category_theory.is_iso CategoryTheory.IsIso noncomputable def inv (f : X ⟢ Y) [I : IsIso f] : Y ⟢ X := Classical.choose I.1 #align category_theory.inv CategoryTheory.inv namespace IsIso @[simp] theorem hom_inv_id (f : X ⟢ Y) [I : IsIso f] : f ≫ inv f = πŸ™ X := (Classical.choose_spec I.1).left #align category_theory.is_iso.hom_inv_id CategoryTheory.IsIso.hom_inv_id @[simp] theorem inv_hom_id (f : X ⟢ Y) [I : IsIso f] : inv f ≫ f = πŸ™ Y := (Classical.choose_spec I.1).right #align category_theory.is_iso.inv_hom_id CategoryTheory.IsIso.inv_hom_id -- FIXME putting @[reassoc] on the `hom_inv_id` above somehow unfolds `inv` -- This happens even if we make `inv` irreducible! -- I don't understand how this is happening: it is likely a bug. -- attribute [reassoc] hom_inv_id inv_hom_id -- #print hom_inv_id_assoc -- theorem CategoryTheory.IsIso.hom_inv_id_assoc {X Y : C} (f : X ⟢ Y) [I : IsIso f] -- {Z : C} (h : X ⟢ Z), -- f ≫ Classical.choose (_ : Exists fun inv ↦ f ≫ inv = πŸ™ X ∧ inv ≫ f = πŸ™ Y) ≫ h = h := ... @[simp]
Mathlib/CategoryTheory/Iso.lean
290
291
theorem hom_inv_id_assoc (f : X ⟢ Y) [I : IsIso f] {Z} (g : X ⟢ Z) : f ≫ inv f ≫ g = g := by
simp [← Category.assoc]
1
import Mathlib.Data.List.Nodup import Mathlib.Data.List.Zip import Mathlib.Data.Nat.Defs import Mathlib.Data.List.Infix #align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u variable {Ξ± : Type u} open Nat Function namespace List theorem rotate_mod (l : List Ξ±) (n : β„•) : l.rotate (n % l.length) = l.rotate n := by simp [rotate] #align list.rotate_mod List.rotate_mod @[simp] theorem rotate_nil (n : β„•) : ([] : List Ξ±).rotate n = [] := by simp [rotate] #align list.rotate_nil List.rotate_nil @[simp] theorem rotate_zero (l : List Ξ±) : l.rotate 0 = l := by simp [rotate] #align list.rotate_zero List.rotate_zero -- Porting note: removing simp, simp can prove it theorem rotate'_nil (n : β„•) : ([] : List Ξ±).rotate' n = [] := by cases n <;> rfl #align list.rotate'_nil List.rotate'_nil @[simp] theorem rotate'_zero (l : List Ξ±) : l.rotate' 0 = l := by cases l <;> rfl #align list.rotate'_zero List.rotate'_zero theorem rotate'_cons_succ (l : List Ξ±) (a : Ξ±) (n : β„•) : (a :: l : List Ξ±).rotate' n.succ = (l ++ [a]).rotate' n := by simp [rotate'] #align list.rotate'_cons_succ List.rotate'_cons_succ @[simp] theorem length_rotate' : βˆ€ (l : List Ξ±) (n : β„•), (l.rotate' n).length = l.length | [], _ => by simp | a :: l, 0 => rfl | a :: l, n + 1 => by rw [List.rotate', length_rotate' (l ++ [a]) n]; simp #align list.length_rotate' List.length_rotate' theorem rotate'_eq_drop_append_take : βˆ€ {l : List Ξ±} {n : β„•}, n ≀ l.length β†’ l.rotate' n = l.drop n ++ l.take n | [], n, h => by simp [drop_append_of_le_length h] | l, 0, h => by simp [take_append_of_le_length h] | a :: l, n + 1, h => by have hnl : n ≀ l.length := le_of_succ_le_succ h have hnl' : n ≀ (l ++ [a]).length := by rw [length_append, length_cons, List.length]; exact le_of_succ_le h rw [rotate'_cons_succ, rotate'_eq_drop_append_take hnl', drop, take, drop_append_of_le_length hnl, take_append_of_le_length hnl]; simp #align list.rotate'_eq_drop_append_take List.rotate'_eq_drop_append_take theorem rotate'_rotate' : βˆ€ (l : List Ξ±) (n m : β„•), (l.rotate' n).rotate' m = l.rotate' (n + m) | a :: l, 0, m => by simp | [], n, m => by simp | a :: l, n + 1, m => by rw [rotate'_cons_succ, rotate'_rotate' _ n, Nat.add_right_comm, ← rotate'_cons_succ, Nat.succ_eq_add_one] #align list.rotate'_rotate' List.rotate'_rotate' @[simp] theorem rotate'_length (l : List Ξ±) : rotate' l l.length = l := by rw [rotate'_eq_drop_append_take le_rfl]; simp #align list.rotate'_length List.rotate'_length @[simp] theorem rotate'_length_mul (l : List Ξ±) : βˆ€ n : β„•, l.rotate' (l.length * n) = l | 0 => by simp | n + 1 => calc l.rotate' (l.length * (n + 1)) = (l.rotate' (l.length * n)).rotate' (l.rotate' (l.length * n)).length := by simp [-rotate'_length, Nat.mul_succ, rotate'_rotate'] _ = l := by rw [rotate'_length, rotate'_length_mul l n] #align list.rotate'_length_mul List.rotate'_length_mul theorem rotate'_mod (l : List Ξ±) (n : β„•) : l.rotate' (n % l.length) = l.rotate' n := calc l.rotate' (n % l.length) = (l.rotate' (n % l.length)).rotate' ((l.rotate' (n % l.length)).length * (n / l.length)) := by rw [rotate'_length_mul] _ = l.rotate' n := by rw [rotate'_rotate', length_rotate', Nat.mod_add_div] #align list.rotate'_mod List.rotate'_mod theorem rotate_eq_rotate' (l : List Ξ±) (n : β„•) : l.rotate n = l.rotate' n := if h : l.length = 0 then by simp_all [length_eq_zero] else by rw [← rotate'_mod, rotate'_eq_drop_append_take (le_of_lt (Nat.mod_lt _ (Nat.pos_of_ne_zero h)))]; simp [rotate] #align list.rotate_eq_rotate' List.rotate_eq_rotate' theorem rotate_cons_succ (l : List Ξ±) (a : Ξ±) (n : β„•) : (a :: l : List Ξ±).rotate (n + 1) = (l ++ [a]).rotate n := by rw [rotate_eq_rotate', rotate_eq_rotate', rotate'_cons_succ] #align list.rotate_cons_succ List.rotate_cons_succ @[simp] theorem mem_rotate : βˆ€ {l : List Ξ±} {a : Ξ±} {n : β„•}, a ∈ l.rotate n ↔ a ∈ l | [], _, n => by simp | a :: l, _, 0 => by simp | a :: l, _, n + 1 => by simp [rotate_cons_succ, mem_rotate, or_comm] #align list.mem_rotate List.mem_rotate @[simp]
Mathlib/Data/List/Rotate.lean
132
133
theorem length_rotate (l : List Ξ±) (n : β„•) : (l.rotate n).length = l.length := by
rw [rotate_eq_rotate', length_rotate']
1
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : β„•) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : β„•) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : β„•) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n β–Έ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n) theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by rw [iterateFrobeniusEquiv_def, pow_zero, pow_one] theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by rw [iterateFrobeniusEquiv_def, pow_one] @[simp] theorem iterateFrobeniusEquiv_zero : iterateFrobeniusEquiv R p 0 = RingEquiv.refl R := RingEquiv.ext (iterateFrobeniusEquiv_zero_apply R p) @[simp] theorem iterateFrobeniusEquiv_one : iterateFrobeniusEquiv R p 1 = frobeniusEquiv R p := RingEquiv.ext (iterateFrobeniusEquiv_one_apply R p) theorem iterateFrobeniusEquiv_eq_pow : iterateFrobeniusEquiv R p n = frobeniusEquiv R p ^ n := DFunLike.ext' <| show _ = ⇑(RingAut.toPerm _ _) by rw [map_pow, Equiv.Perm.coe_pow]; exact (pow_iterate p n).symm theorem iterateFrobeniusEquiv_symm : (iterateFrobeniusEquiv R p n).symm = (frobeniusEquiv R p).symm ^ n := by rw [iterateFrobeniusEquiv_eq_pow]; exact (inv_pow _ _).symm @[simp] theorem frobeniusEquiv_symm_apply_frobenius (x : R) : (frobeniusEquiv R p).symm (frobenius R p x) = x := leftInverse_surjInv PerfectRing.bijective_frobenius x @[simp] theorem frobenius_apply_frobeniusEquiv_symm (x : R) : frobenius R p ((frobeniusEquiv R p).symm x) = x := surjInv_eq _ _ @[simp] theorem frobenius_comp_frobeniusEquiv_symm : (frobenius R p).comp (frobeniusEquiv R p).symm = RingHom.id R := by ext; simp @[simp]
Mathlib/FieldTheory/Perfect.lean
151
153
theorem frobeniusEquiv_symm_comp_frobenius : ((frobeniusEquiv R p).symm : R β†’+* R).comp (frobenius R p) = RingHom.id R := by
ext; simp
1
import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Combinatorics.Additive.AP.Three.Defs import Mathlib.Combinatorics.Pigeonhole import Mathlib.Data.Complex.ExponentialBounds #align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" open Nat hiding log open Finset Metric Real open scoped Pointwise lemma threeAPFree_frontier {π•œ E : Type*} [LinearOrderedField π•œ] [TopologicalSpace E] [AddCommMonoid E] [Module π•œ E] {s : Set E} (hsβ‚€ : IsClosed s) (hs₁ : StrictConvex π•œ s) : ThreeAPFree (frontier s) := by intro a ha b hb c hc habc obtain rfl : (1 / 2 : π•œ) β€’ a + (1 / 2 : π•œ) β€’ c = b := by rwa [← smul_add, one_div, inv_smul_eq_iffβ‚€ (show (2 : π•œ) β‰  0 by norm_num), two_smul] have := hs₁.eq (hsβ‚€.frontier_subset ha) (hsβ‚€.frontier_subset hc) one_half_pos one_half_pos (add_halves _) hb.2 simp [this, ← add_smul] ring_nf simp #align add_salem_spencer_frontier threeAPFree_frontier lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by obtain rfl | hr := eq_or_ne r 0 Β· rw [sphere_zero] exact threeAPFree_singleton _ Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r) exact (frontier_closedBall _ hr).symm #align add_salem_spencer_sphere threeAPFree_sphere namespace Behrend variable {Ξ± Ξ² : Type*} {n d k N : β„•} {x : Fin n β†’ β„•} def box (n d : β„•) : Finset (Fin n β†’ β„•) := Fintype.piFinset fun _ => range d #align behrend.box Behrend.box theorem mem_box : x ∈ box n d ↔ βˆ€ i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range] #align behrend.mem_box Behrend.mem_box @[simp] theorem card_box : (box n d).card = d ^ n := by simp [box] #align behrend.card_box Behrend.card_box @[simp] theorem box_zero : box (n + 1) 0 = βˆ… := by simp [box] #align behrend.box_zero Behrend.box_zero def sphere (n d k : β„•) : Finset (Fin n β†’ β„•) := (box n d).filter fun x => βˆ‘ i, x i ^ 2 = k #align behrend.sphere Behrend.sphere theorem sphere_zero_subset : sphere n d 0 βŠ† 0 := fun x => by simp [sphere, Function.funext_iff] #align behrend.sphere_zero_subset Behrend.sphere_zero_subset @[simp] theorem sphere_zero_right (n k : β„•) : sphere (n + 1) 0 k = βˆ… := by simp [sphere] #align behrend.sphere_zero_right Behrend.sphere_zero_right theorem sphere_subset_box : sphere n d k βŠ† box n d := filter_subset _ _ #align behrend.sphere_subset_box Behrend.sphere_subset_box theorem norm_of_mem_sphere {x : Fin n β†’ β„•} (hx : x ∈ sphere n d k) : β€–(WithLp.equiv 2 _).symm ((↑) ∘ x : Fin n β†’ ℝ)β€– = βˆšβ†‘k := by rw [EuclideanSpace.norm_eq] dsimp simp_rw [abs_cast, ← cast_pow, ← cast_sum, (mem_filter.1 hx).2] #align behrend.norm_of_mem_sphere Behrend.norm_of_mem_sphere theorem sphere_subset_preimage_metric_sphere : (sphere n d k : Set (Fin n β†’ β„•)) βŠ† (fun x : Fin n β†’ β„• => (WithLp.equiv 2 _).symm ((↑) ∘ x : Fin n β†’ ℝ)) ⁻¹' Metric.sphere (0 : PiLp 2 fun _ : Fin n => ℝ) (βˆšβ†‘k) := fun x hx => by rw [Set.mem_preimage, mem_sphere_zero_iff_norm, norm_of_mem_sphere hx] #align behrend.sphere_subset_preimage_metric_sphere Behrend.sphere_subset_preimage_metric_sphere @[simps] def map (d : β„•) : (Fin n β†’ β„•) β†’+ β„• where toFun a := βˆ‘ i, a i * d ^ (i : β„•) map_zero' := by simp_rw [Pi.zero_apply, zero_mul, sum_const_zero] map_add' a b := by simp_rw [Pi.add_apply, add_mul, sum_add_distrib] #align behrend.map Behrend.map -- @[simp] -- Porting note (#10618): simp can prove this
Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean
147
147
theorem map_zero (d : β„•) (a : Fin 0 β†’ β„•) : map d a = 0 := by
simp [map]
1
import Batteries.Tactic.Lint.Basic import Mathlib.Algebra.Order.Monoid.Unbundled.Basic import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Order import Mathlib.Init.Data.Int.Order set_option autoImplicit true namespace Linarith theorem lt_irrefl {Ξ± : Type u} [Preorder Ξ±] {a : Ξ±} : Β¬a < a := _root_.lt_irrefl a theorem eq_of_eq_of_eq {Ξ±} [OrderedSemiring Ξ±] {a b : Ξ±} (ha : a = 0) (hb : b = 0) : a + b = 0 := by simp [*] theorem le_of_eq_of_le {Ξ±} [OrderedSemiring Ξ±] {a b : Ξ±} (ha : a = 0) (hb : b ≀ 0) : a + b ≀ 0 := by simp [*] theorem lt_of_eq_of_lt {Ξ±} [OrderedSemiring Ξ±] {a b : Ξ±} (ha : a = 0) (hb : b < 0) : a + b < 0 := by simp [*] theorem le_of_le_of_eq {Ξ±} [OrderedSemiring Ξ±] {a b : Ξ±} (ha : a ≀ 0) (hb : b = 0) : a + b ≀ 0 := by simp [*] theorem lt_of_lt_of_eq {Ξ±} [OrderedSemiring Ξ±] {a b : Ξ±} (ha : a < 0) (hb : b = 0) : a + b < 0 := by simp [*] theorem mul_neg {Ξ±} [StrictOrderedRing Ξ±] {a b : Ξ±} (ha : a < 0) (hb : 0 < b) : b * a < 0 := have : (-b)*a > 0 := mul_pos_of_neg_of_neg (neg_neg_of_pos hb) ha neg_of_neg_pos (by simpa) theorem mul_nonpos {Ξ±} [OrderedRing Ξ±] {a b : Ξ±} (ha : a ≀ 0) (hb : 0 < b) : b * a ≀ 0 := have : (-b)*a β‰₯ 0 := mul_nonneg_of_nonpos_of_nonpos (le_of_lt (neg_neg_of_pos hb)) ha by simpa -- used alongside `mul_neg` and `mul_nonpos`, so has the same argument pattern for uniformity @[nolint unusedArguments]
Mathlib/Tactic/Linarith/Lemmas.lean
52
53
theorem mul_eq {Ξ±} [OrderedSemiring Ξ±] {a b : Ξ±} (ha : a = 0) (_ : 0 < b) : b * a = 0 := by
simp [*]
1
import Mathlib.Init.Function #align_import data.option.n_ary from "leanprover-community/mathlib"@"995b47e555f1b6297c7cf16855f1023e355219fb" universe u open Function namespace Option variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*} {f : Ξ± β†’ Ξ² β†’ Ξ³} {a : Option Ξ±} {b : Option Ξ²} {c : Option Ξ³} def mapβ‚‚ (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Option Ξ±) (b : Option Ξ²) : Option Ξ³ := a.bind fun a => b.map <| f a #align option.mapβ‚‚ Option.mapβ‚‚ theorem mapβ‚‚_def {Ξ± Ξ² Ξ³ : Type u} (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Option Ξ±) (b : Option Ξ²) : mapβ‚‚ f a b = f <$> a <*> b := by cases a <;> rfl #align option.mapβ‚‚_def Option.mapβ‚‚_def -- Porting note (#10618): In Lean3, was `@[simp]` but now `simp` can prove it theorem mapβ‚‚_some_some (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Ξ±) (b : Ξ²) : mapβ‚‚ f (some a) (some b) = f a b := rfl #align option.mapβ‚‚_some_some Option.mapβ‚‚_some_some theorem mapβ‚‚_coe_coe (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Ξ±) (b : Ξ²) : mapβ‚‚ f a b = f a b := rfl #align option.mapβ‚‚_coe_coe Option.mapβ‚‚_coe_coe @[simp] theorem mapβ‚‚_none_left (f : Ξ± β†’ Ξ² β†’ Ξ³) (b : Option Ξ²) : mapβ‚‚ f none b = none := rfl #align option.mapβ‚‚_none_left Option.mapβ‚‚_none_left @[simp] theorem mapβ‚‚_none_right (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Option Ξ±) : mapβ‚‚ f a none = none := by cases a <;> rfl #align option.mapβ‚‚_none_right Option.mapβ‚‚_none_right @[simp] theorem mapβ‚‚_coe_left (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Ξ±) (b : Option Ξ²) : mapβ‚‚ f a b = b.map fun b => f a b := rfl #align option.mapβ‚‚_coe_left Option.mapβ‚‚_coe_left -- Porting note: This proof was `rfl` in Lean3, but now is not. @[simp] theorem mapβ‚‚_coe_right (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Option Ξ±) (b : Ξ²) : mapβ‚‚ f a b = a.map fun a => f a b := by cases a <;> rfl #align option.mapβ‚‚_coe_right Option.mapβ‚‚_coe_right -- Porting note: Removed the `@[simp]` tag as membership of an `Option` is no-longer simp-normal. theorem mem_mapβ‚‚_iff {c : Ξ³} : c ∈ mapβ‚‚ f a b ↔ βˆƒ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by simp [mapβ‚‚, bind_eq_some] #align option.mem_mapβ‚‚_iff Option.mem_mapβ‚‚_iff @[simp] theorem mapβ‚‚_eq_none_iff : mapβ‚‚ f a b = none ↔ a = none ∨ b = none := by cases a <;> cases b <;> simp #align option.mapβ‚‚_eq_none_iff Option.mapβ‚‚_eq_none_iff theorem mapβ‚‚_swap (f : Ξ± β†’ Ξ² β†’ Ξ³) (a : Option Ξ±) (b : Option Ξ²) : mapβ‚‚ f a b = mapβ‚‚ (fun a b => f b a) b a := by cases a <;> cases b <;> rfl #align option.mapβ‚‚_swap Option.mapβ‚‚_swap theorem map_mapβ‚‚ (f : Ξ± β†’ Ξ² β†’ Ξ³) (g : Ξ³ β†’ Ξ΄) : (mapβ‚‚ f a b).map g = mapβ‚‚ (fun a b => g (f a b)) a b := by cases a <;> cases b <;> rfl #align option.map_mapβ‚‚ Option.map_mapβ‚‚
Mathlib/Data/Option/NAry.lean
95
96
theorem mapβ‚‚_map_left (f : Ξ³ β†’ Ξ² β†’ Ξ΄) (g : Ξ± β†’ Ξ³) : mapβ‚‚ f (a.map g) b = mapβ‚‚ (fun a b => f (g a) b) a b := by
cases a <;> rfl
1
import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Order.Iterate import Mathlib.Order.SemiconjSup import Mathlib.Tactic.Monotonicity import Mathlib.Topology.Order.MonotoneContinuity #align_import dynamics.circle.rotation_number.translation_number from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open scoped Classical open Filter Set Int Topology open Function hiding Commute structure CircleDeg1Lift extends ℝ β†’o ℝ : Type where map_add_one' : βˆ€ x, toFun (x + 1) = toFun x + 1 #align circle_deg1_lift CircleDeg1Lift namespace CircleDeg1Lift instance : FunLike CircleDeg1Lift ℝ ℝ where coe f := f.toFun coe_injective' | ⟨⟨_, _⟩, _⟩, ⟨⟨_, _⟩, _⟩, rfl => rfl instance : OrderHomClass CircleDeg1Lift ℝ ℝ where map_rel f _ _ h := f.monotone' h @[simp] theorem coe_mk (f h) : ⇑(mk f h) = f := rfl #align circle_deg1_lift.coe_mk CircleDeg1Lift.coe_mk variable (f g : CircleDeg1Lift) @[simp] theorem coe_toOrderHom : ⇑f.toOrderHom = f := rfl protected theorem monotone : Monotone f := f.monotone' #align circle_deg1_lift.monotone CircleDeg1Lift.monotone @[mono] theorem mono {x y} (h : x ≀ y) : f x ≀ f y := f.monotone h #align circle_deg1_lift.mono CircleDeg1Lift.mono theorem strictMono_iff_injective : StrictMono f ↔ Injective f := f.monotone.strictMono_iff_injective #align circle_deg1_lift.strict_mono_iff_injective CircleDeg1Lift.strictMono_iff_injective @[simp] theorem map_add_one : βˆ€ x, f (x + 1) = f x + 1 := f.map_add_one' #align circle_deg1_lift.map_add_one CircleDeg1Lift.map_add_one @[simp] theorem map_one_add (x : ℝ) : f (1 + x) = 1 + f x := by rw [add_comm, map_add_one, add_comm 1] #align circle_deg1_lift.map_one_add CircleDeg1Lift.map_one_add #noalign circle_deg1_lift.coe_inj -- Use `DFunLike.coe_inj` @[ext] theorem ext ⦃f g : CircleDeg1Lift⦄ (h : βˆ€ x, f x = g x) : f = g := DFunLike.ext f g h #align circle_deg1_lift.ext CircleDeg1Lift.ext theorem ext_iff {f g : CircleDeg1Lift} : f = g ↔ βˆ€ x, f x = g x := DFunLike.ext_iff #align circle_deg1_lift.ext_iff CircleDeg1Lift.ext_iff instance : Monoid CircleDeg1Lift where mul f g := { toOrderHom := f.1.comp g.1 map_add_one' := fun x => by simp [map_add_one] } one := ⟨.id, fun _ => rfl⟩ mul_one f := rfl one_mul f := rfl mul_assoc f₁ fβ‚‚ f₃ := DFunLike.coe_injective rfl instance : Inhabited CircleDeg1Lift := ⟨1⟩ @[simp] theorem coe_mul : ⇑(f * g) = f ∘ g := rfl #align circle_deg1_lift.coe_mul CircleDeg1Lift.coe_mul theorem mul_apply (x) : (f * g) x = f (g x) := rfl #align circle_deg1_lift.mul_apply CircleDeg1Lift.mul_apply @[simp] theorem coe_one : ⇑(1 : CircleDeg1Lift) = id := rfl #align circle_deg1_lift.coe_one CircleDeg1Lift.coe_one instance unitsHasCoeToFun : CoeFun CircleDeg1LiftΛ£ fun _ => ℝ β†’ ℝ := ⟨fun f => ⇑(f : CircleDeg1Lift)⟩ #align circle_deg1_lift.units_has_coe_to_fun CircleDeg1Lift.unitsHasCoeToFun #noalign circle_deg1_lift.units_coe -- now LHS = RHS @[simp] theorem units_inv_apply_apply (f : CircleDeg1LiftΛ£) (x : ℝ) : (f⁻¹ : CircleDeg1LiftΛ£) (f x) = x := by simp only [← mul_apply, f.inv_mul, coe_one, id] #align circle_deg1_lift.units_inv_apply_apply CircleDeg1Lift.units_inv_apply_apply @[simp]
Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean
218
219
theorem units_apply_inv_apply (f : CircleDeg1LiftΛ£) (x : ℝ) : f ((f⁻¹ : CircleDeg1LiftΛ£) x) = x := by
simp only [← mul_apply, f.mul_inv, coe_one, id]
1
import Mathlib.Algebra.BigOperators.Group.Finset #align_import data.nat.gcd.big_operators from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace Nat variable {ΞΉ : Type*} theorem coprime_list_prod_left_iff {l : List β„•} {k : β„•} : Coprime l.prod k ↔ βˆ€ n ∈ l, Coprime n k := by induction l <;> simp [Nat.coprime_mul_iff_left, *] theorem coprime_list_prod_right_iff {k : β„•} {l : List β„•} : Coprime k l.prod ↔ βˆ€ n ∈ l, Coprime k n := by simp_rw [coprime_comm (n := k), coprime_list_prod_left_iff] theorem coprime_multiset_prod_left_iff {m : Multiset β„•} {k : β„•} : Coprime m.prod k ↔ βˆ€ n ∈ m, Coprime n k := by induction m using Quotient.inductionOn; simpa using coprime_list_prod_left_iff theorem coprime_multiset_prod_right_iff {k : β„•} {m : Multiset β„•} : Coprime k m.prod ↔ βˆ€ n ∈ m, Coprime k n := by induction m using Quotient.inductionOn; simpa using coprime_list_prod_right_iff theorem coprime_prod_left_iff {t : Finset ΞΉ} {s : ΞΉ β†’ β„•} {x : β„•} : Coprime (∏ i ∈ t, s i) x ↔ βˆ€ i ∈ t, Coprime (s i) x := by simpa using coprime_multiset_prod_left_iff (m := t.val.map s) theorem coprime_prod_right_iff {x : β„•} {t : Finset ΞΉ} {s : ΞΉ β†’ β„•} : Coprime x (∏ i ∈ t, s i) ↔ βˆ€ i ∈ t, Coprime x (s i) := by simpa using coprime_multiset_prod_right_iff (m := t.val.map s) alias ⟨_, Coprime.prod_left⟩ := coprime_prod_left_iff #align nat.coprime_prod_left Nat.Coprime.prod_left alias ⟨_, Coprime.prod_right⟩ := coprime_prod_right_iff #align nat.coprime_prod_right Nat.Coprime.prod_right
Mathlib/Data/Nat/GCD/BigOperators.lean
52
54
theorem coprime_fintype_prod_left_iff [Fintype ΞΉ] {s : ΞΉ β†’ β„•} {x : β„•} : Coprime (∏ i, s i) x ↔ βˆ€ i, Coprime (s i) x := by
simp [coprime_prod_left_iff]
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Polynomial.Degree.Lemmas #align_import data.polynomial.erase_lead from "leanprover-community/mathlib"@"fa256f00ce018e7b40e1dc756e403c86680bf448" noncomputable section open Polynomial open Polynomial Finset namespace Polynomial variable {R : Type*} [Semiring R] {f : R[X]} def eraseLead (f : R[X]) : R[X] := Polynomial.erase f.natDegree f #align polynomial.erase_lead Polynomial.eraseLead section EraseLead theorem eraseLead_support (f : R[X]) : f.eraseLead.support = f.support.erase f.natDegree := by simp only [eraseLead, support_erase] #align polynomial.erase_lead_support Polynomial.eraseLead_support theorem eraseLead_coeff (i : β„•) : f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i := by simp only [eraseLead, coeff_erase] #align polynomial.erase_lead_coeff Polynomial.eraseLead_coeff @[simp] theorem eraseLead_coeff_natDegree : f.eraseLead.coeff f.natDegree = 0 := by simp [eraseLead_coeff] #align polynomial.erase_lead_coeff_nat_degree Polynomial.eraseLead_coeff_natDegree theorem eraseLead_coeff_of_ne (i : β„•) (hi : i β‰  f.natDegree) : f.eraseLead.coeff i = f.coeff i := by simp [eraseLead_coeff, hi] #align polynomial.erase_lead_coeff_of_ne Polynomial.eraseLead_coeff_of_ne @[simp] theorem eraseLead_zero : eraseLead (0 : R[X]) = 0 := by simp only [eraseLead, erase_zero] #align polynomial.erase_lead_zero Polynomial.eraseLead_zero @[simp] theorem eraseLead_add_monomial_natDegree_leadingCoeff (f : R[X]) : f.eraseLead + monomial f.natDegree f.leadingCoeff = f := (add_comm _ _).trans (f.monomial_add_erase _) #align polynomial.erase_lead_add_monomial_nat_degree_leading_coeff Polynomial.eraseLead_add_monomial_natDegree_leadingCoeff @[simp] theorem eraseLead_add_C_mul_X_pow (f : R[X]) : f.eraseLead + C f.leadingCoeff * X ^ f.natDegree = f := by rw [C_mul_X_pow_eq_monomial, eraseLead_add_monomial_natDegree_leadingCoeff] set_option linter.uppercaseLean3 false in #align polynomial.erase_lead_add_C_mul_X_pow Polynomial.eraseLead_add_C_mul_X_pow @[simp] theorem self_sub_monomial_natDegree_leadingCoeff {R : Type*} [Ring R] (f : R[X]) : f - monomial f.natDegree f.leadingCoeff = f.eraseLead := (eq_sub_iff_add_eq.mpr (eraseLead_add_monomial_natDegree_leadingCoeff f)).symm #align polynomial.self_sub_monomial_nat_degree_leading_coeff Polynomial.self_sub_monomial_natDegree_leadingCoeff @[simp] theorem self_sub_C_mul_X_pow {R : Type*} [Ring R] (f : R[X]) : f - C f.leadingCoeff * X ^ f.natDegree = f.eraseLead := by rw [C_mul_X_pow_eq_monomial, self_sub_monomial_natDegree_leadingCoeff] set_option linter.uppercaseLean3 false in #align polynomial.self_sub_C_mul_X_pow Polynomial.self_sub_C_mul_X_pow theorem eraseLead_ne_zero (f0 : 2 ≀ f.support.card) : eraseLead f β‰  0 := by rw [Ne, ← card_support_eq_zero, eraseLead_support] exact (zero_lt_one.trans_le <| (tsub_le_tsub_right f0 1).trans Finset.pred_card_le_card_erase).ne.symm #align polynomial.erase_lead_ne_zero Polynomial.eraseLead_ne_zero theorem lt_natDegree_of_mem_eraseLead_support {a : β„•} (h : a ∈ (eraseLead f).support) : a < f.natDegree := by rw [eraseLead_support, mem_erase] at h exact (le_natDegree_of_mem_supp a h.2).lt_of_ne h.1 #align polynomial.lt_nat_degree_of_mem_erase_lead_support Polynomial.lt_natDegree_of_mem_eraseLead_support theorem ne_natDegree_of_mem_eraseLead_support {a : β„•} (h : a ∈ (eraseLead f).support) : a β‰  f.natDegree := (lt_natDegree_of_mem_eraseLead_support h).ne #align polynomial.ne_nat_degree_of_mem_erase_lead_support Polynomial.ne_natDegree_of_mem_eraseLead_support theorem natDegree_not_mem_eraseLead_support : f.natDegree βˆ‰ (eraseLead f).support := fun h => ne_natDegree_of_mem_eraseLead_support h rfl #align polynomial.nat_degree_not_mem_erase_lead_support Polynomial.natDegree_not_mem_eraseLead_support theorem eraseLead_support_card_lt (h : f β‰  0) : (eraseLead f).support.card < f.support.card := by rw [eraseLead_support] exact card_lt_card (erase_ssubset <| natDegree_mem_support_of_nonzero h) #align polynomial.erase_lead_support_card_lt Polynomial.eraseLead_support_card_lt theorem card_support_eraseLead_add_one (h : f β‰  0) : f.eraseLead.support.card + 1 = f.support.card := by set c := f.support.card with hc cases h₁ : c case zero => by_contra exact h (card_support_eq_zero.mp h₁) case succ => rw [eraseLead_support, card_erase_of_mem (natDegree_mem_support_of_nonzero h), ← hc, h₁] rfl @[simp] theorem card_support_eraseLead : f.eraseLead.support.card = f.support.card - 1 := by by_cases hf : f = 0 Β· rw [hf, eraseLead_zero, support_zero, card_empty] Β· rw [← card_support_eraseLead_add_one hf, add_tsub_cancel_right]
Mathlib/Algebra/Polynomial/EraseLead.lean
132
134
theorem card_support_eraseLead' {c : β„•} (fc : f.support.card = c + 1) : f.eraseLead.support.card = c := by
rw [card_support_eraseLead, fc, add_tsub_cancel_right]
1
import Mathlib.Topology.MetricSpace.Algebra import Mathlib.Analysis.Normed.Field.Basic #align_import analysis.normed.mul_action from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" variable {Ξ± Ξ² : Type*} section SeminormedAddGroup variable [SeminormedAddGroup Ξ±] [SeminormedAddGroup Ξ²] [SMulZeroClass Ξ± Ξ²] variable [BoundedSMul Ξ± Ξ²] theorem norm_smul_le (r : Ξ±) (x : Ξ²) : β€–r β€’ xβ€– ≀ β€–rβ€– * β€–xβ€– := by simpa [smul_zero] using dist_smul_pair r 0 x #align norm_smul_le norm_smul_le theorem nnnorm_smul_le (r : Ξ±) (x : Ξ²) : β€–r β€’ xβ€–β‚Š ≀ β€–rβ€–β‚Š * β€–xβ€–β‚Š := norm_smul_le _ _ #align nnnorm_smul_le nnnorm_smul_le
Mathlib/Analysis/Normed/MulAction.lean
37
38
theorem dist_smul_le (s : Ξ±) (x y : Ξ²) : dist (s β€’ x) (s β€’ y) ≀ β€–sβ€– * dist x y := by
simpa only [dist_eq_norm, sub_zero] using dist_smul_pair s x y
1
import Mathlib.Analysis.LocallyConvex.Basic #align_import analysis.locally_convex.balanced_core_hull from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Pointwise Topology Filter variable {π•œ E ΞΉ : Type*} section balancedHull section SeminormedRing variable [SeminormedRing π•œ] section SMul variable (π•œ) [SMul π•œ E] {s t : Set E} {x : E} def balancedCore (s : Set E) := ⋃₀ { t : Set E | Balanced π•œ t ∧ t βŠ† s } #align balanced_core balancedCore def balancedCoreAux (s : Set E) := β‹‚ (r : π•œ) (_ : 1 ≀ β€–rβ€–), r β€’ s #align balanced_core_aux balancedCoreAux def balancedHull (s : Set E) := ⋃ (r : π•œ) (_ : β€–rβ€– ≀ 1), r β€’ s #align balanced_hull balancedHull variable {π•œ} theorem balancedCore_subset (s : Set E) : balancedCore π•œ s βŠ† s := sUnion_subset fun _ ht => ht.2 #align balanced_core_subset balancedCore_subset theorem balancedCore_empty : balancedCore π•œ (βˆ… : Set E) = βˆ… := eq_empty_of_subset_empty (balancedCore_subset _) #align balanced_core_empty balancedCore_empty
Mathlib/Analysis/LocallyConvex/BalancedCoreHull.lean
81
82
theorem mem_balancedCore_iff : x ∈ balancedCore π•œ s ↔ βˆƒ t, Balanced π•œ t ∧ t βŠ† s ∧ x ∈ t := by
simp_rw [balancedCore, mem_sUnion, mem_setOf_eq, and_assoc]
1
import Mathlib.LinearAlgebra.Projectivization.Basic #align_import linear_algebra.projective_space.independence from "leanprover-community/mathlib"@"1e82f5ec4645f6a92bb9e02fce51e44e3bc3e1fe" open scoped LinearAlgebra.Projectivization variable {ΞΉ K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] {f : ΞΉ β†’ β„™ K V} namespace Projectivization inductive Independent : (ΞΉ β†’ β„™ K V) β†’ Prop | mk (f : ΞΉ β†’ V) (hf : βˆ€ i : ΞΉ, f i β‰  0) (hl : LinearIndependent K f) : Independent fun i => mk K (f i) (hf i) #align projectivization.independent Projectivization.Independent theorem independent_iff : Independent f ↔ LinearIndependent K (Projectivization.rep ∘ f) := by refine ⟨?_, fun h => ?_⟩ Β· rintro ⟨ff, hff, hh⟩ choose a ha using fun i : ΞΉ => exists_smul_eq_mk_rep K (ff i) (hff i) convert hh.units_smul a ext i exact (ha i).symm Β· convert Independent.mk _ _ h Β· simp only [mk_rep, Function.comp_apply] Β· intro i apply rep_nonzero #align projectivization.independent_iff Projectivization.independent_iff theorem independent_iff_completeLattice_independent : Independent f ↔ CompleteLattice.Independent fun i => (f i).submodule := by refine ⟨?_, fun h => ?_⟩ Β· rintro ⟨f, hf, hi⟩ simp only [submodule_mk] exact (CompleteLattice.independent_iff_linearIndependent_of_ne_zero (R := K) hf).mpr hi Β· rw [independent_iff] refine h.linearIndependent (Projectivization.submodule ∘ f) (fun i => ?_) fun i => ?_ Β· simpa only [Function.comp_apply, submodule_eq] using Submodule.mem_span_singleton_self _ Β· exact rep_nonzero (f i) #align projectivization.independent_iff_complete_lattice_independent Projectivization.independent_iff_completeLattice_independent inductive Dependent : (ΞΉ β†’ β„™ K V) β†’ Prop | mk (f : ΞΉ β†’ V) (hf : βˆ€ i : ΞΉ, f i β‰  0) (h : Β¬LinearIndependent K f) : Dependent fun i => mk K (f i) (hf i) #align projectivization.dependent Projectivization.Dependent theorem dependent_iff : Dependent f ↔ Β¬LinearIndependent K (Projectivization.rep ∘ f) := by refine ⟨?_, fun h => ?_⟩ Β· rintro ⟨ff, hff, hh1⟩ contrapose! hh1 choose a ha using fun i : ΞΉ => exists_smul_eq_mk_rep K (ff i) (hff i) convert hh1.units_smul a⁻¹ ext i simp only [← ha, inv_smul_smul, Pi.smul_apply', Pi.inv_apply, Function.comp_apply] Β· convert Dependent.mk _ _ h Β· simp only [mk_rep, Function.comp_apply] Β· exact fun i => rep_nonzero (f i) #align projectivization.dependent_iff Projectivization.dependent_iff theorem dependent_iff_not_independent : Dependent f ↔ Β¬Independent f := by rw [dependent_iff, independent_iff] #align projectivization.dependent_iff_not_independent Projectivization.dependent_iff_not_independent
Mathlib/LinearAlgebra/Projectivization/Independence.lean
103
104
theorem independent_iff_not_dependent : Independent f ↔ Β¬Dependent f := by
rw [dependent_iff_not_independent, Classical.not_not]
1