Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
num_lines
int64
1
150
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.MvPowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def PowerSeries (R : Type*) := MvPowerSeries Unit R #align power_series PowerSeries namespace PowerSeries open Finsupp (single) variable {R : Type*} section -- Porting note: not available in Lean 4 -- local reducible PowerSeries scoped notation:9000 R "⟦X⟧" => PowerSeries R instance [Inhabited R] : Inhabited R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Zero R] : Zero R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddMonoid R] : AddMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddGroup R] : AddGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Semiring R] : Semiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommSemiring R] : CommSemiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Ring R] : Ring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommRing R] : CommRing R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Nontrivial R] : Nontrivial R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S] [IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ := Pi.isScalarTower instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance end section Semiring variable (R) [Semiring R] def coeff (n : ℕ) : R⟦X⟧ →ₗ[R] R := MvPowerSeries.coeff R (single () n) #align power_series.coeff PowerSeries.coeff def monomial (n : ℕ) : R →ₗ[R] R⟦X⟧ := MvPowerSeries.monomial R (single () n) #align power_series.monomial PowerSeries.monomial variable {R} theorem coeff_def {s : Unit →₀ ℕ} {n : ℕ} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by erw [coeff, ← h, ← Finsupp.unique_single s] #align power_series.coeff_def PowerSeries.coeff_def @[ext] theorem ext {φ ψ : R⟦X⟧} (h : ∀ n, coeff R n φ = coeff R n ψ) : φ = ψ := MvPowerSeries.ext fun n => by rw [← coeff_def] · apply h rfl #align power_series.ext PowerSeries.ext theorem ext_iff {φ ψ : R⟦X⟧} : φ = ψ ↔ ∀ n, coeff R n φ = coeff R n ψ := ⟨fun h n => congr_arg (coeff R n) h, ext⟩ #align power_series.ext_iff PowerSeries.ext_iff instance [Subsingleton R] : Subsingleton R⟦X⟧ := by simp only [subsingleton_iff, ext_iff] exact fun _ _ _ ↦ (subsingleton_iff).mp (by infer_instance) _ _ def mk {R} (f : ℕ → R) : R⟦X⟧ := fun s => f (s ()) #align power_series.mk PowerSeries.mk @[simp] theorem coeff_mk (n : ℕ) (f : ℕ → R) : coeff R n (mk f) = f n := congr_arg f Finsupp.single_eq_same #align power_series.coeff_mk PowerSeries.coeff_mk
Mathlib/RingTheory/PowerSeries/Basic.lean
181
184
theorem coeff_monomial (m n : ℕ) (a : R) : coeff R m (monomial R n a) = if m = n then a else 0 := calc coeff R m (monomial R n a) = _ := MvPowerSeries.coeff_monomial _ _ _ _ = if m = n then a else 0 := by
simp only [Finsupp.unique_single_eq_iff]
1
import Batteries.Data.RBMap.Basic import Batteries.Tactic.SeqFocus namespace Batteries namespace RBNode open RBColor attribute [simp] All theorem All.trivial (H : ∀ {x : α}, p x) : ∀ {t : RBNode α}, t.All p | nil => _root_.trivial | node .. => ⟨H, All.trivial H, All.trivial H⟩ theorem All_and {t : RBNode α} : t.All (fun a => p a ∧ q a) ↔ t.All p ∧ t.All q := by induction t <;> simp [*, and_assoc, and_left_comm] protected theorem cmpLT.flip (h₁ : cmpLT cmp x y) : cmpLT (flip cmp) y x := ⟨have : TransCmp cmp := inferInstanceAs (TransCmp (flip (flip cmp))); h₁.1⟩ theorem cmpLT.trans (h₁ : cmpLT cmp x y) (h₂ : cmpLT cmp y z) : cmpLT cmp x z := ⟨TransCmp.lt_trans h₁.1 h₂.1⟩ theorem cmpLT.trans_l {cmp x y} (H : cmpLT cmp x y) {t : RBNode α} (h : t.All (cmpLT cmp y ·)) : t.All (cmpLT cmp x ·) := h.imp fun h => H.trans h theorem cmpLT.trans_r {cmp x y} (H : cmpLT cmp x y) {a : RBNode α} (h : a.All (cmpLT cmp · x)) : a.All (cmpLT cmp · y) := h.imp fun h => h.trans H theorem cmpEq.lt_congr_left (H : cmpEq cmp x y) : cmpLT cmp x z ↔ cmpLT cmp y z := ⟨fun ⟨h⟩ => ⟨TransCmp.cmp_congr_left H.1 ▸ h⟩, fun ⟨h⟩ => ⟨TransCmp.cmp_congr_left H.1 ▸ h⟩⟩ theorem cmpEq.lt_congr_right (H : cmpEq cmp y z) : cmpLT cmp x y ↔ cmpLT cmp x z := ⟨fun ⟨h⟩ => ⟨TransCmp.cmp_congr_right H.1 ▸ h⟩, fun ⟨h⟩ => ⟨TransCmp.cmp_congr_right H.1 ▸ h⟩⟩ @[simp] theorem reverse_reverse (t : RBNode α) : t.reverse.reverse = t := by induction t <;> simp [*]
.lake/packages/batteries/Batteries/Data/RBMap/WF.lean
51
52
theorem reverse_eq_iff {t t' : RBNode α} : t.reverse = t' ↔ t = t'.reverse := by
constructor <;> rintro rfl <;> simp
1
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -φ := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : φ * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * φ = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : φ + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - φ = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = φ := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : φ - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj
Mathlib/Data/Real/GoldenRatio.lean
87
88
theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2) - φ ^ (n + 1) = φ ^ n := by
rw [goldenRatio]; ring_nf; norm_num; ring
1
import Mathlib.LinearAlgebra.Dimension.Free import Mathlib.Algebra.Module.Torsion #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v v' u₁' w w' variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v} variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*} open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁] variable [Module R M] [Module R M'] [Module R M₁] section Finsupp variable (R M M') variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M'] open Module.Free @[simp] theorem rank_finsupp (ι : Type w) : Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M) rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma, Cardinal.sum_const] #align rank_finsupp rank_finsupp theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by simp [rank_finsupp] #align rank_finsupp' rank_finsupp' -- Porting note, this should not be `@[simp]`, as simp can prove it. -- @[simp] theorem rank_finsupp_self (ι : Type w) : Module.rank R (ι →₀ R) = Cardinal.lift.{u} #ι := by simp [rank_finsupp] #align rank_finsupp_self rank_finsupp_self theorem rank_finsupp_self' {ι : Type u} : Module.rank R (ι →₀ R) = #ι := by simp #align rank_finsupp_self' rank_finsupp_self' @[simp] theorem rank_directSum {ι : Type v} (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)] [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.rank R (⨁ i, M i) = Cardinal.sum fun i => Module.rank R (M i) := by let B i := chooseBasis R (M i) let b : Basis _ R (⨁ i, M i) := DFinsupp.basis fun i => B i simp [← b.mk_eq_rank'', fun i => (B i).mk_eq_rank''] #align rank_direct_sum rank_directSum @[simp] theorem rank_matrix (m : Type v) (n : Type w) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = Cardinal.lift.{max v w u, v} #m * Cardinal.lift.{max v w u, w} #n := by cases nonempty_fintype m cases nonempty_fintype n have h := (Matrix.stdBasis R m n).mk_eq_rank rw [← lift_lift.{max v w u, max v w}, lift_inj] at h simpa using h.symm #align rank_matrix rank_matrix @[simp high] theorem rank_matrix' (m n : Type v) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = Cardinal.lift.{u} (#m * #n) := by rw [rank_matrix, lift_mul, lift_umax.{v, u}] #align rank_matrix' rank_matrix' -- @[simp] -- Porting note (#10618): simp can prove this theorem rank_matrix'' (m n : Type u) [Finite m] [Finite n] : Module.rank R (Matrix m n R) = #m * #n := by simp #align rank_matrix'' rank_matrix'' variable [Module.Finite R M] [Module.Finite R M'] open Fintype namespace FiniteDimensional @[simp] theorem finrank_finsupp {ι : Type v} [Fintype ι] : finrank R (ι →₀ M) = card ι * finrank R M := by rw [finrank, finrank, rank_finsupp, ← mk_toNat_eq_card, toNat_mul, toNat_lift, toNat_lift] @[simp] theorem finrank_finsupp_self {ι : Type v} [Fintype ι] : finrank R (ι →₀ R) = card ι := by rw [finrank, rank_finsupp_self, ← mk_toNat_eq_card, toNat_lift] #align finite_dimensional.finrank_finsupp FiniteDimensional.finrank_finsupp_self @[simp] theorem finrank_directSum {ι : Type v} [Fintype ι] (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)] [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] [∀ i : ι, Module.Finite R (M i)] : finrank R (⨁ i, M i) = ∑ i, finrank R (M i) := by letI := nontrivial_of_invariantBasisNumber R simp only [finrank, fun i => rank_eq_card_chooseBasisIndex R (M i), rank_directSum, ← mk_sigma, mk_toNat_eq_card, card_sigma] #align finite_dimensional.finrank_direct_sum FiniteDimensional.finrank_directSum
Mathlib/LinearAlgebra/Dimension/Constructions.lean
251
252
theorem finrank_matrix (m n : Type*) [Fintype m] [Fintype n] : finrank R (Matrix m n R) = card m * card n := by
simp [finrank]
1
import Mathlib.Algebra.Algebra.Basic import Mathlib.Algebra.Periodic import Mathlib.Topology.Algebra.Order.Field import Mathlib.Topology.Algebra.UniformMulAction import Mathlib.Topology.Algebra.Star import Mathlib.Topology.Instances.Int import Mathlib.Topology.Order.Bornology #align_import topology.instances.real from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" noncomputable section open scoped Classical open Filter Int Metric Set TopologicalSpace Bornology open scoped Topology Uniformity Interval universe u v w variable {α : Type u} {β : Type v} {γ : Type w} instance : NoncompactSpace ℝ := Int.closedEmbedding_coe_real.noncompactSpace theorem Real.uniformContinuous_add : UniformContinuous fun p : ℝ × ℝ => p.1 + p.2 := Metric.uniformContinuous_iff.2 fun _ε ε0 => let ⟨δ, δ0, Hδ⟩ := rat_add_continuous_lemma abs ε0 ⟨δ, δ0, fun h => let ⟨h₁, h₂⟩ := max_lt_iff.1 h Hδ h₁ h₂⟩ #align real.uniform_continuous_add Real.uniformContinuous_add theorem Real.uniformContinuous_neg : UniformContinuous (@Neg.neg ℝ _) := Metric.uniformContinuous_iff.2 fun ε ε0 => ⟨_, ε0, fun h => by rw [dist_comm] at h; simpa only [Real.dist_eq, neg_sub_neg] using h⟩ #align real.uniform_continuous_neg Real.uniformContinuous_neg instance : ContinuousStar ℝ := ⟨continuous_id⟩ instance : UniformAddGroup ℝ := UniformAddGroup.mk' Real.uniformContinuous_add Real.uniformContinuous_neg -- short-circuit type class inference instance : TopologicalAddGroup ℝ := by infer_instance instance : TopologicalRing ℝ := inferInstance instance : TopologicalDivisionRing ℝ := inferInstance instance : ProperSpace ℝ where isCompact_closedBall x r := by rw [Real.closedBall_eq_Icc] apply isCompact_Icc instance : SecondCountableTopology ℝ := secondCountable_of_proper theorem Real.isTopologicalBasis_Ioo_rat : @IsTopologicalBasis ℝ _ (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) b}) := isTopologicalBasis_of_isOpen_of_nhds (by simp (config := { contextual := true }) [isOpen_Ioo]) fun a v hav hv => let ⟨l, u, ⟨hl, hu⟩, h⟩ := mem_nhds_iff_exists_Ioo_subset.mp (IsOpen.mem_nhds hv hav) let ⟨q, hlq, hqa⟩ := exists_rat_btwn hl let ⟨p, hap, hpu⟩ := exists_rat_btwn hu ⟨Ioo q p, by simp only [mem_iUnion] exact ⟨q, p, Rat.cast_lt.1 <| hqa.trans hap, rfl⟩, ⟨hqa, hap⟩, fun a' ⟨hqa', ha'p⟩ => h ⟨hlq.trans hqa', ha'p.trans hpu⟩⟩ #align real.is_topological_basis_Ioo_rat Real.isTopologicalBasis_Ioo_rat @[simp]
Mathlib/Topology/Instances/Real.lean
77
78
theorem Real.cobounded_eq : cobounded ℝ = atBot ⊔ atTop := by
simp only [← comap_dist_right_atTop (0 : ℝ), Real.dist_eq, sub_zero, comap_abs_atTop]
1
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type w} {ι' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section StrongRankCondition variable [StrongRankCondition R] open Submodule -- An auxiliary lemma for `linearIndependent_le_span'`, -- with the additional assumption that the linearly independent family is finite. theorem linearIndependent_le_span_aux' {ι : Type*} [Fintype ι] (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Fintype w] (s : range v ≤ span R w) : Fintype.card ι ≤ Fintype.card w := by -- We construct an injective linear map `(ι → R) →ₗ[R] (w → R)`, -- by thinking of `f : ι → R` as a linear combination of the finite family `v`, -- and expressing that (using the axiom of choice) as a linear combination over `w`. -- We can do this linearly by constructing the map on a basis. fapply card_le_of_injective' R · apply Finsupp.total exact fun i => Span.repr R w ⟨v i, s (mem_range_self i)⟩ · intro f g h apply_fun Finsupp.total w M R (↑) at h simp only [Finsupp.total_total, Submodule.coe_mk, Span.finsupp_total_repr] at h rw [← sub_eq_zero, ← LinearMap.map_sub] at h exact sub_eq_zero.mp (linearIndependent_iff.mp i _ h) #align linear_independent_le_span_aux' linearIndependent_le_span_aux' lemma LinearIndependent.finite_of_le_span_finite {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Finite w] (s : range v ≤ span R w) : Finite ι := letI := Fintype.ofFinite w Fintype.finite <| fintypeOfFinsetCardLe (Fintype.card w) fun t => by let v' := fun x : (t : Set ι) => v x have i' : LinearIndependent R v' := i.comp _ Subtype.val_injective have s' : range v' ≤ span R w := (range_comp_subset_range _ _).trans s simpa using linearIndependent_le_span_aux' v' i' w s' #align linear_independent_fintype_of_le_span_fintype LinearIndependent.finite_of_le_span_finite theorem linearIndependent_le_span' {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Fintype w] (s : range v ≤ span R w) : #ι ≤ Fintype.card w := by haveI : Finite ι := i.finite_of_le_span_finite v w s letI := Fintype.ofFinite ι rw [Cardinal.mk_fintype] simp only [Cardinal.natCast_le] exact linearIndependent_le_span_aux' v i w s #align linear_independent_le_span' linearIndependent_le_span' theorem linearIndependent_le_span {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M) [Fintype w] (s : span R w = ⊤) : #ι ≤ Fintype.card w := by apply linearIndependent_le_span' v i w rw [s] exact le_top #align linear_independent_le_span linearIndependent_le_span
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
236
238
theorem linearIndependent_le_span_finset {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Finset M) (s : span R (w : Set M) = ⊤) : #ι ≤ w.card := by
simpa only [Finset.coe_sort_coe, Fintype.card_coe] using linearIndependent_le_span v i w s
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] theorem hom_inv_id_assoc (f : X ⟶ Y) [I : IsIso f] {Z} (g : X ⟶ Z) : f ≫ inv f ≫ g = g := by simp [← Category.assoc] #align category_theory.is_iso.hom_inv_id_assoc CategoryTheory.IsIso.hom_inv_id_assoc @[simp]
Mathlib/CategoryTheory/Iso.lean
295
296
theorem inv_hom_id_assoc (f : X ⟶ Y) [I : IsIso f] {Z} (g : Y ⟶ Z) : inv f ≫ f ≫ g = g := by
simp [← Category.assoc]
1
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section Ring variable {R : Type u} [Ring R] {S : Type v} [Ring S] (f : R →+* S) def liftsRing (f : R →+* S) : Subring S[X] := RingHom.range (mapRingHom f) #align polynomial.lifts_ring Polynomial.liftsRing
Mathlib/Algebra/Polynomial/Lifts.lean
257
258
theorem lifts_iff_liftsRing (p : S[X]) : p ∈ lifts f ↔ p ∈ liftsRing f := by
simp only [lifts, liftsRing, RingHom.mem_range, RingHom.mem_rangeS]
1
import Mathlib.Data.Vector.Basic #align_import data.vector.mem from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" namespace Vector variable {α β : Type*} {n : ℕ} (a a' : α) @[simp] theorem get_mem (i : Fin n) (v : Vector α n) : v.get i ∈ v.toList := by rw [get_eq_get] exact List.get_mem _ _ _ #align vector.nth_mem Vector.get_mem theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get] exact ⟨fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length] at hi, h⟩, fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length], h⟩⟩ #align vector.mem_iff_nth Vector.mem_iff_get theorem not_mem_nil : a ∉ (Vector.nil : Vector α 0).toList := by unfold Vector.nil dsimp simp #align vector.not_mem_nil Vector.not_mem_nil theorem not_mem_zero (v : Vector α 0) : a ∉ v.toList := (Vector.eq_nil v).symm ▸ not_mem_nil a #align vector.not_mem_zero Vector.not_mem_zero
Mathlib/Data/Vector/Mem.lean
48
49
theorem mem_cons_iff (v : Vector α n) : a' ∈ (a ::ᵥ v).toList ↔ a' = a ∨ a' ∈ v.toList := by
rw [Vector.toList_cons, List.mem_cons]
1
import Mathlib.Algebra.Group.Semiconj.Defs import Mathlib.Algebra.Ring.Defs #align_import algebra.ring.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x} open Function namespace SemiconjBy @[simp] theorem add_right [Distrib R] {a x y x' y' : R} (h : SemiconjBy a x y) (h' : SemiconjBy a x' y') : SemiconjBy a (x + x') (y + y') := by simp only [SemiconjBy, left_distrib, right_distrib, h.eq, h'.eq] #align semiconj_by.add_right SemiconjBy.add_right @[simp] theorem add_left [Distrib R] {a b x y : R} (ha : SemiconjBy a x y) (hb : SemiconjBy b x y) : SemiconjBy (a + b) x y := by simp only [SemiconjBy, left_distrib, right_distrib, ha.eq, hb.eq] #align semiconj_by.add_left SemiconjBy.add_left section variable [Mul R] [HasDistribNeg R] {a x y : R}
Mathlib/Algebra/Ring/Semiconj.lean
48
49
theorem neg_right (h : SemiconjBy a x y) : SemiconjBy a (-x) (-y) := by
simp only [SemiconjBy, h.eq, neg_mul, mul_neg]
1
import Mathlib.Topology.MetricSpace.Antilipschitz #align_import topology.metric_space.isometry from "leanprover-community/mathlib"@"b1859b6d4636fdbb78c5d5cefd24530653cfd3eb" noncomputable section universe u v w variable {ι : Type*} {α : Type u} {β : Type v} {γ : Type w} open Function Set open scoped Topology ENNReal def Isometry [PseudoEMetricSpace α] [PseudoEMetricSpace β] (f : α → β) : Prop := ∀ x1 x2 : α, edist (f x1) (f x2) = edist x1 x2 #align isometry Isometry
Mathlib/Topology/MetricSpace/Isometry.lean
40
42
theorem isometry_iff_nndist_eq [PseudoMetricSpace α] [PseudoMetricSpace β] {f : α → β} : Isometry f ↔ ∀ x y, nndist (f x) (f y) = nndist x y := by
simp only [Isometry, edist_nndist, ENNReal.coe_inj]
1
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation #align_import linear_algebra.clifford_algebra.star from "leanprover-community/mathlib"@"4d66277cfec381260ba05c68f9ae6ce2a118031d" variable {R : Type*} [CommRing R] variable {M : Type*} [AddCommGroup M] [Module R M] variable {Q : QuadraticForm R M} namespace CliffordAlgebra instance instStarRing : StarRing (CliffordAlgebra Q) where star x := reverse (involute x) star_involutive x := by simp only [reverse_involute_commute.eq, reverse_reverse, involute_involute] star_mul x y := by simp only [map_mul, reverse.map_mul] star_add x y := by simp only [map_add] theorem star_def (x : CliffordAlgebra Q) : star x = reverse (involute x) := rfl #align clifford_algebra.star_def CliffordAlgebra.star_def theorem star_def' (x : CliffordAlgebra Q) : star x = involute (reverse x) := reverse_involute _ #align clifford_algebra.star_def' CliffordAlgebra.star_def' @[simp] theorem star_ι (m : M) : star (ι Q m) = -ι Q m := by rw [star_def, involute_ι, map_neg, reverse_ι] #align clifford_algebra.star_ι CliffordAlgebra.star_ι @[simp] theorem star_smul (r : R) (x : CliffordAlgebra Q) : star (r • x) = r • star x := by rw [star_def, star_def, map_smul, map_smul] #align clifford_algebra.star_smul CliffordAlgebra.star_smul @[simp]
Mathlib/LinearAlgebra/CliffordAlgebra/Star.lean
62
64
theorem star_algebraMap (r : R) : star (algebraMap R (CliffordAlgebra Q) r) = algebraMap R (CliffordAlgebra Q) r := by
rw [star_def, involute.commutes, reverse.commutes]
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 Columns def col (μ : YoungDiagram) (j : ℕ) : Finset (ℕ × ℕ) := μ.cells.filter fun c => c.snd = j #align young_diagram.col YoungDiagram.col
Mathlib/Combinatorics/Young/YoungDiagram.lean
347
348
theorem mem_col_iff {μ : YoungDiagram} {j : ℕ} {c : ℕ × ℕ} : c ∈ μ.col j ↔ c ∈ μ ∧ c.snd = j := by
simp [col]
1
import Mathlib.MeasureTheory.Measure.Restrict #align_import measure_theory.measure.mutually_singular from "leanprover-community/mathlib"@"70a4f2197832bceab57d7f41379b2592d1110570" open Set open MeasureTheory NNReal ENNReal namespace MeasureTheory namespace Measure variable {α : Type*} {m0 : MeasurableSpace α} {μ μ₁ μ₂ ν ν₁ ν₂ : Measure α} def MutuallySingular {_ : MeasurableSpace α} (μ ν : Measure α) : Prop := ∃ s : Set α, MeasurableSet s ∧ μ s = 0 ∧ ν sᶜ = 0 #align measure_theory.measure.mutually_singular MeasureTheory.Measure.MutuallySingular @[inherit_doc MeasureTheory.Measure.MutuallySingular] scoped[MeasureTheory] infixl:60 " ⟂ₘ " => MeasureTheory.Measure.MutuallySingular namespace MutuallySingular theorem mk {s t : Set α} (hs : μ s = 0) (ht : ν t = 0) (hst : univ ⊆ s ∪ t) : MutuallySingular μ ν := by use toMeasurable μ s, measurableSet_toMeasurable _ _, (measure_toMeasurable _).trans hs refine measure_mono_null (fun x hx => (hst trivial).resolve_left fun hxs => hx ?_) ht exact subset_toMeasurable _ _ hxs #align measure_theory.measure.mutually_singular.mk MeasureTheory.Measure.MutuallySingular.mk def nullSet (h : μ ⟂ₘ ν) : Set α := h.choose lemma measurableSet_nullSet (h : μ ⟂ₘ ν) : MeasurableSet h.nullSet := h.choose_spec.1 @[simp] lemma measure_nullSet (h : μ ⟂ₘ ν) : μ h.nullSet = 0 := h.choose_spec.2.1 @[simp] lemma measure_compl_nullSet (h : μ ⟂ₘ ν) : ν h.nullSetᶜ = 0 := h.choose_spec.2.2 -- TODO: this is proved by simp, but is not simplified in other contexts without the @[simp] -- attribute. Also, the linter does not complain about that attribute. @[simp] lemma restrict_nullSet (h : μ ⟂ₘ ν) : μ.restrict h.nullSet = 0 := by simp -- TODO: this is proved by simp, but is not simplified in other contexts without the @[simp] -- attribute. Also, the linter does not complain about that attribute. @[simp] lemma restrict_compl_nullSet (h : μ ⟂ₘ ν) : ν.restrict h.nullSetᶜ = 0 := by simp @[simp] theorem zero_right : μ ⟂ₘ 0 := ⟨∅, MeasurableSet.empty, measure_empty, rfl⟩ #align measure_theory.measure.mutually_singular.zero_right MeasureTheory.Measure.MutuallySingular.zero_right @[symm] theorem symm (h : ν ⟂ₘ μ) : μ ⟂ₘ ν := let ⟨i, hi, his, hit⟩ := h ⟨iᶜ, hi.compl, hit, (compl_compl i).symm ▸ his⟩ #align measure_theory.measure.mutually_singular.symm MeasureTheory.Measure.MutuallySingular.symm theorem comm : μ ⟂ₘ ν ↔ ν ⟂ₘ μ := ⟨fun h => h.symm, fun h => h.symm⟩ #align measure_theory.measure.mutually_singular.comm MeasureTheory.Measure.MutuallySingular.comm @[simp] theorem zero_left : 0 ⟂ₘ μ := zero_right.symm #align measure_theory.measure.mutually_singular.zero_left MeasureTheory.Measure.MutuallySingular.zero_left theorem mono_ac (h : μ₁ ⟂ₘ ν₁) (hμ : μ₂ ≪ μ₁) (hν : ν₂ ≪ ν₁) : μ₂ ⟂ₘ ν₂ := let ⟨s, hs, h₁, h₂⟩ := h ⟨s, hs, hμ h₁, hν h₂⟩ #align measure_theory.measure.mutually_singular.mono_ac MeasureTheory.Measure.MutuallySingular.mono_ac theorem mono (h : μ₁ ⟂ₘ ν₁) (hμ : μ₂ ≤ μ₁) (hν : ν₂ ≤ ν₁) : μ₂ ⟂ₘ ν₂ := h.mono_ac hμ.absolutelyContinuous hν.absolutelyContinuous #align measure_theory.measure.mutually_singular.mono MeasureTheory.Measure.MutuallySingular.mono @[simp] lemma self_iff (μ : Measure α) : μ ⟂ₘ μ ↔ μ = 0 := by refine ⟨?_, fun h ↦ by (rw [h]; exact zero_left)⟩ rintro ⟨s, hs, hμs, hμs_compl⟩ suffices μ Set.univ = 0 by rwa [measure_univ_eq_zero] at this rw [← Set.union_compl_self s, measure_union disjoint_compl_right hs.compl, hμs, hμs_compl, add_zero] @[simp] theorem sum_left {ι : Type*} [Countable ι] {μ : ι → Measure α} : sum μ ⟂ₘ ν ↔ ∀ i, μ i ⟂ₘ ν := by refine ⟨fun h i => h.mono (le_sum _ _) le_rfl, fun H => ?_⟩ choose s hsm hsμ hsν using H refine ⟨⋂ i, s i, MeasurableSet.iInter hsm, ?_, ?_⟩ · rw [sum_apply _ (MeasurableSet.iInter hsm), ENNReal.tsum_eq_zero] exact fun i => measure_mono_null (iInter_subset _ _) (hsμ i) · rwa [compl_iInter, measure_iUnion_null_iff] #align measure_theory.measure.mutually_singular.sum_left MeasureTheory.Measure.MutuallySingular.sum_left @[simp] theorem sum_right {ι : Type*} [Countable ι] {ν : ι → Measure α} : μ ⟂ₘ sum ν ↔ ∀ i, μ ⟂ₘ ν i := comm.trans <| sum_left.trans <| forall_congr' fun _ => comm #align measure_theory.measure.mutually_singular.sum_right MeasureTheory.Measure.MutuallySingular.sum_right @[simp]
Mathlib/MeasureTheory/Measure/MutuallySingular.lean
129
130
theorem add_left_iff : μ₁ + μ₂ ⟂ₘ ν ↔ μ₁ ⟂ₘ ν ∧ μ₂ ⟂ₘ ν := by
rw [← sum_cond, sum_left, Bool.forall_bool, cond, cond, and_comm]
1
import Mathlib.Algebra.Order.Group.Abs import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax #align_import algebra.order.group.min_max from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" section variable {α : Type*} [Group α] [LinearOrder α] [CovariantClass α α (· * ·) (· ≤ ·)] -- TODO: This duplicates `oneLePart_div_leOnePart` @[to_additive (attr := simp)]
Mathlib/Algebra/Order/Group/MinMax.lean
22
23
theorem max_one_div_max_inv_one_eq_self (a : α) : max a 1 / max a⁻¹ 1 = a := by
rcases le_total a 1 with (h | h) <;> simp [h]
1
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := ∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
37
39
theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by
simp (config := { contextual := true }) [scaleRoots, coeff_monomial]
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 theorem elim_eq_iff {u u' : α → γ} {v v' : β → γ} : Sum.elim u v = Sum.elim u' v' ↔ u = u' ∧ v = v' := by simp [funext_iff] @[simp] theorem map_map (f' : α' → α'') (g' : β' → β'') (f : α → α') (g : β → β') : ∀ x : Sum α β, (x.map f g).map f' g' = x.map (f' ∘ f) (g' ∘ g) | inl _ => rfl | inr _ => rfl @[simp] theorem map_comp_map (f' : α' → α'') (g' : β' → β'') (f : α → α') (g : β → β') : Sum.map f' g' ∘ Sum.map f g = Sum.map (f' ∘ f) (g' ∘ g) := funext <| map_map f' g' f g @[simp] theorem map_id_id : Sum.map (@id α) (@id β) = id := funext fun x => Sum.recOn x (fun _ => rfl) fun _ => rfl
.lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean
134
136
theorem elim_map {f₁ : α → β} {f₂ : β → ε} {g₁ : γ → δ} {g₂ : δ → ε} {x} : Sum.elim f₂ g₂ (Sum.map f₁ g₁ x) = Sum.elim (f₂ ∘ f₁) (g₂ ∘ g₁) x := by
cases x <;> rfl
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Nat.Choose.Sum import Mathlib.Data.Nat.Factorial.BigOperators import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Finset.Sym import Mathlib.Data.Finsupp.Multiset #align_import data.nat.choose.multinomial from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d" open Finset open scoped Nat namespace Nat variable {α : Type*} (s : Finset α) (f : α → ℕ) {a b : α} (n : ℕ) def multinomial : ℕ := (∑ i ∈ s, f i)! / ∏ i ∈ s, (f i)! #align nat.multinomial Nat.multinomial theorem multinomial_pos : 0 < multinomial s f := Nat.div_pos (le_of_dvd (factorial_pos _) (prod_factorial_dvd_factorial_sum s f)) (prod_factorial_pos s f) #align nat.multinomial_pos Nat.multinomial_pos theorem multinomial_spec : (∏ i ∈ s, (f i)!) * multinomial s f = (∑ i ∈ s, f i)! := Nat.mul_div_cancel' (prod_factorial_dvd_factorial_sum s f) #align nat.multinomial_spec Nat.multinomial_spec @[simp] lemma multinomial_empty : multinomial ∅ f = 1 := by simp [multinomial] #align nat.multinomial_nil Nat.multinomial_empty @[deprecated (since := "2024-06-01")] alias multinomial_nil := multinomial_empty variable {s f} lemma multinomial_cons (ha : a ∉ s) (f : α → ℕ) : multinomial (s.cons a ha) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by rw [multinomial, Nat.div_eq_iff_eq_mul_left _ (prod_factorial_dvd_factorial_sum _ _), prod_cons, multinomial, mul_assoc, mul_left_comm _ (f a)!, Nat.div_mul_cancel (prod_factorial_dvd_factorial_sum _ _), ← mul_assoc, Nat.choose_symm_add, Nat.add_choose_mul_factorial_mul_factorial, Finset.sum_cons] positivity lemma multinomial_insert [DecidableEq α] (ha : a ∉ s) (f : α → ℕ) : multinomial (insert a s) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by rw [← cons_eq_insert _ _ ha, multinomial_cons] #align nat.multinomial_insert Nat.multinomial_insert @[simp] lemma multinomial_singleton (a : α) (f : α → ℕ) : multinomial {a} f = 1 := by rw [← cons_empty, multinomial_cons]; simp #align nat.multinomial_singleton Nat.multinomial_singleton @[simp] theorem multinomial_insert_one [DecidableEq α] (h : a ∉ s) (h₁ : f a = 1) : multinomial (insert a s) f = (s.sum f).succ * multinomial s f := by simp only [multinomial, one_mul, factorial] rw [Finset.sum_insert h, Finset.prod_insert h, h₁, add_comm, ← succ_eq_add_one, factorial_succ] simp only [factorial_one, one_mul, Function.comp_apply, factorial, mul_one, ← one_eq_succ_zero] rw [Nat.mul_div_assoc _ (prod_factorial_dvd_factorial_sum _ _)] #align nat.multinomial_insert_one Nat.multinomial_insert_one theorem multinomial_congr {f g : α → ℕ} (h : ∀ a ∈ s, f a = g a) : multinomial s f = multinomial s g := by simp only [multinomial]; congr 1 · rw [Finset.sum_congr rfl h] · exact Finset.prod_congr rfl fun a ha => by rw [h a ha] #align nat.multinomial_congr Nat.multinomial_congr theorem binomial_eq [DecidableEq α] (h : a ≠ b) : multinomial {a, b} f = (f a + f b)! / ((f a)! * (f b)!) := by simp [multinomial, Finset.sum_pair h, Finset.prod_pair h] #align nat.binomial_eq Nat.binomial_eq
Mathlib/Data/Nat/Choose/Multinomial.lean
107
109
theorem binomial_eq_choose [DecidableEq α] (h : a ≠ b) : multinomial {a, b} f = (f a + f b).choose (f a) := by
simp [binomial_eq h, choose_eq_factorial_div_factorial (Nat.le_add_right _ _)]
1
import Mathlib.Analysis.Analytic.Constructions import Mathlib.Analysis.Calculus.Dslope import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Analytic.Uniqueness #align_import analysis.analytic.isolated_zeros from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" open scoped Classical open Filter Function Nat FormalMultilinearSeries EMetric Set open scoped Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {s : E} {p q : FormalMultilinearSeries 𝕜 𝕜 E} {f g : 𝕜 → E} {n : ℕ} {z z₀ : 𝕜} namespace HasSum variable {a : ℕ → E}
Mathlib/Analysis/Analytic/IsolatedZeros.lean
44
45
theorem hasSum_at_zero (a : ℕ → E) : HasSum (fun n => (0 : 𝕜) ^ n • a n) (a 0) := by
convert hasSum_single (α := E) 0 fun b h ↦ _ <;> simp [*]
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.Prod import Mathlib.SetTheory.Cardinal.Basic import Mathlib.Tactic.FinCases import Mathlib.Tactic.LinearCombination import Mathlib.Lean.Expr.ExtraRecognizers import Mathlib.Data.Set.Subsingleton #align_import linear_algebra.linear_independent from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" noncomputable section open Function Set Submodule open Cardinal universe u' u variable {ι : Type u'} {ι' : Type*} {R : Type*} {K : Type*} variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*} section Module variable {v : ι → M} variable [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M''] variable [Module R M] [Module R M'] [Module R M''] variable {a b : R} {x y : M} variable (R) (v) def LinearIndependent : Prop := LinearMap.ker (Finsupp.total ι M R v) = ⊥ #align linear_independent LinearIndependent open Lean PrettyPrinter.Delaborator SubExpr in @[delab app.LinearIndependent] def delabLinearIndependent : Delab := whenPPOption getPPNotation <| whenNotPPOption getPPAnalysisSkip <| withOptionAtCurrPos `pp.analysis.skip true do let e ← getExpr guard <| e.isAppOfArity ``LinearIndependent 7 let some _ := (e.getArg! 0).coeTypeSet? | failure let optionsPerPos ← if (e.getArg! 3).isLambda then withNaryArg 3 do return (← read).optionsPerPos.setBool (← getPos) pp.funBinderTypes.name true else withNaryArg 0 do return (← read).optionsPerPos.setBool (← getPos) `pp.analysis.namedArg true withTheReader Context ({· with optionsPerPos}) delab variable {R} {v}
Mathlib/LinearAlgebra/LinearIndependent.lean
126
128
theorem linearIndependent_iff : LinearIndependent R v ↔ ∀ l, Finsupp.total ι M R v l = 0 → l = 0 := by
simp [LinearIndependent, LinearMap.ker_eq_bot']
1
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology namespace Real variable {ι : Type*} [Fintype ι] theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by haveI : IsAddLeftInvariant StieltjesFunction.id.measure := ⟨fun a => Eq.symm <| Real.measure_ext_Ioo_rat fun p q => by simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo, sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim, StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩ have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1 rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;> simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero, StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one] conv_rhs => rw [addHaarMeasure_unique StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A] simp only [volume, Basis.addHaar, one_smul] #align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by simp [volume_eq_stieltjes_id] #align real.volume_val Real.volume_val @[simp] theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ico Real.volume_Ico @[simp] theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Icc Real.volume_Icc @[simp] theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioo Real.volume_Ioo @[simp] theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioc Real.volume_Ioc -- @[simp] -- Porting note (#10618): simp can prove this theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp [volume_val] #align real.volume_singleton Real.volume_singleton -- @[simp] -- Porting note (#10618): simp can prove this, after mathlib4#4628 theorem volume_univ : volume (univ : Set ℝ) = ∞ := ENNReal.eq_top_of_forall_nnreal_le fun r => calc (r : ℝ≥0∞) = volume (Icc (0 : ℝ) r) := by simp _ ≤ volume univ := measure_mono (subset_univ _) #align real.volume_univ Real.volume_univ @[simp] theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel_left, two_mul] #align real.volume_ball Real.volume_ball @[simp] theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel_left, two_mul] #align real.volume_closed_ball Real.volume_closedBall @[simp] theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a r) = 2 * r := by rcases eq_or_ne r ∞ with (rfl | hr) · rw [Metric.emetric_ball_top, volume_univ, two_mul, _root_.top_add] · lift r to ℝ≥0 using hr rw [Metric.emetric_ball_nnreal, volume_ball, two_mul, ← NNReal.coe_add, ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul] #align real.volume_emetric_ball Real.volume_emetric_ball @[simp] theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.closedBall a r) = 2 * r := by rcases eq_or_ne r ∞ with (rfl | hr) · rw [EMetric.closedBall_top, volume_univ, two_mul, _root_.top_add] · lift r to ℝ≥0 using hr rw [Metric.emetric_closedBall_nnreal, volume_closedBall, two_mul, ← NNReal.coe_add, ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul] #align real.volume_emetric_closed_ball Real.volume_emetric_closedBall instance noAtoms_volume : NoAtoms (volume : Measure ℝ) := ⟨fun _ => volume_singleton⟩ #align real.has_no_atoms_volume Real.noAtoms_volume @[simp]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
140
141
theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal |b - a| := by
rw [← Icc_min_max, volume_Icc, max_sub_min_eq_abs]
1
import Mathlib.CategoryTheory.Sites.Subsheaf import Mathlib.CategoryTheory.Sites.CompatibleSheafification import Mathlib.CategoryTheory.Sites.LocallyInjective #align_import category_theory.sites.surjective from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v u w v' u' w' open Opposite CategoryTheory CategoryTheory.GrothendieckTopology namespace CategoryTheory variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike variable {A : Type u'} [Category.{v'} A] [ConcreteCategory.{w'} A] namespace Presheaf @[simps (config := .lemmasOnly)] def imageSieve {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : Sieve U where arrows V i := ∃ t : F.obj (op V), f.app _ t = G.map i.op s downward_closed := by rintro V W i ⟨t, ht⟩ j refine ⟨F.map j.op t, ?_⟩ rw [op_comp, G.map_comp, comp_apply, ← ht, elementwise_of% f.naturality] #align category_theory.image_sieve CategoryTheory.Presheaf.imageSieve theorem imageSieve_eq_sieveOfSection {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve f s = (imagePresheaf (whiskerRight f (forget A))).sieveOfSection s := rfl #align category_theory.image_sieve_eq_sieve_of_section CategoryTheory.Presheaf.imageSieve_eq_sieveOfSection theorem imageSieve_whisker_forget {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve (whiskerRight f (forget A)) s = imageSieve f s := rfl #align category_theory.image_sieve_whisker_forget CategoryTheory.Presheaf.imageSieve_whisker_forget theorem imageSieve_app {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : F.obj (op U)) : imageSieve f (f.app _ s) = ⊤ := by ext V i simp only [Sieve.top_apply, iff_true_iff, imageSieve_apply] have := elementwise_of% (f.naturality i.op) exact ⟨F.map i.op s, this s⟩ #align category_theory.image_sieve_app CategoryTheory.Presheaf.imageSieve_app noncomputable def localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U) {V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) : F.obj (op V) := hg.choose @[simp] lemma app_localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U) {V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) : f.app _ (localPreimage f s g hg) = G.map g.op s := hg.choose_spec class IsLocallySurjective {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : Prop where imageSieve_mem {U : C} (s : G.obj (op U)) : imageSieve f s ∈ J U #align category_theory.is_locally_surjective CategoryTheory.Presheaf.IsLocallySurjective lemma imageSieve_mem {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] {U : Cᵒᵖ} (s : G.obj U) : imageSieve f s ∈ J U.unop := IsLocallySurjective.imageSieve_mem _ instance {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] : IsLocallySurjective J (whiskerRight f (forget A)) where imageSieve_mem s := imageSieve_mem J f s theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : IsLocallySurjective J f ↔ (imagePresheaf (whiskerRight f (forget A))).sheafify J = ⊤ := by simp only [Subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj, Set.top_eq_univ, Set.mem_univ, iff_true_iff] exact ⟨fun H _ => H.imageSieve_mem, fun H => ⟨H _⟩⟩ #align category_theory.is_locally_surjective_iff_image_presheaf_sheafify_eq_top CategoryTheory.Presheaf.isLocallySurjective_iff_imagePresheaf_sheafify_eq_top
Mathlib/CategoryTheory/Sites/LocallySurjective.lean
108
110
theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top' {F G : Cᵒᵖ ⥤ Type w} (f : F ⟶ G) : IsLocallySurjective J f ↔ (imagePresheaf f).sheafify J = ⊤ := by
apply isLocallySurjective_iff_imagePresheaf_sheafify_eq_top
1
import Mathlib.CategoryTheory.Sites.Sieves import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer import Mathlib.CategoryTheory.Category.Preorder import Mathlib.Order.Copy import Mathlib.Data.Set.Subsingleton #align_import category_theory.sites.grothendieck from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7" universe v₁ u₁ v u namespace CategoryTheory open CategoryTheory Category variable (C : Type u) [Category.{v} C] structure GrothendieckTopology where sieves : ∀ X : C, Set (Sieve X) top_mem' : ∀ X, ⊤ ∈ sieves X pullback_stable' : ∀ ⦃X Y : C⦄ ⦃S : Sieve X⦄ (f : Y ⟶ X), S ∈ sieves X → S.pullback f ∈ sieves Y transitive' : ∀ ⦃X⦄ ⦃S : Sieve X⦄ (_ : S ∈ sieves X) (R : Sieve X), (∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, S f → R.pullback f ∈ sieves Y) → R ∈ sieves X #align category_theory.grothendieck_topology CategoryTheory.GrothendieckTopology namespace GrothendieckTopology instance : CoeFun (GrothendieckTopology C) fun _ => ∀ X : C, Set (Sieve X) := ⟨sieves⟩ variable {C} variable {X Y : C} {S R : Sieve X} variable (J : GrothendieckTopology C) @[ext] theorem ext {J₁ J₂ : GrothendieckTopology C} (h : (J₁ : ∀ X : C, Set (Sieve X)) = J₂) : J₁ = J₂ := by cases J₁ cases J₂ congr #align category_theory.grothendieck_topology.ext CategoryTheory.GrothendieckTopology.ext @[simp] theorem top_mem (X : C) : ⊤ ∈ J X := J.top_mem' X #align category_theory.grothendieck_topology.top_mem CategoryTheory.GrothendieckTopology.top_mem @[simp] theorem pullback_stable (f : Y ⟶ X) (hS : S ∈ J X) : S.pullback f ∈ J Y := J.pullback_stable' f hS #align category_theory.grothendieck_topology.pullback_stable CategoryTheory.GrothendieckTopology.pullback_stable theorem transitive (hS : S ∈ J X) (R : Sieve X) (h : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, S f → R.pullback f ∈ J Y) : R ∈ J X := J.transitive' hS R h #align category_theory.grothendieck_topology.transitive CategoryTheory.GrothendieckTopology.transitive theorem covering_of_eq_top : S = ⊤ → S ∈ J X := fun h => h.symm ▸ J.top_mem X #align category_theory.grothendieck_topology.covering_of_eq_top CategoryTheory.GrothendieckTopology.covering_of_eq_top theorem superset_covering (Hss : S ≤ R) (sjx : S ∈ J X) : R ∈ J X := by apply J.transitive sjx R fun Y f hf => _ intros Y f hf apply covering_of_eq_top rw [← top_le_iff, ← S.pullback_eq_top_of_mem hf] apply Sieve.pullback_monotone _ Hss #align category_theory.grothendieck_topology.superset_covering CategoryTheory.GrothendieckTopology.superset_covering theorem intersection_covering (rj : R ∈ J X) (sj : S ∈ J X) : R ⊓ S ∈ J X := by apply J.transitive rj _ fun Y f Hf => _ intros Y f hf rw [Sieve.pullback_inter, R.pullback_eq_top_of_mem hf] simp [sj] #align category_theory.grothendieck_topology.intersection_covering CategoryTheory.GrothendieckTopology.intersection_covering @[simp] theorem intersection_covering_iff : R ⊓ S ∈ J X ↔ R ∈ J X ∧ S ∈ J X := ⟨fun h => ⟨J.superset_covering inf_le_left h, J.superset_covering inf_le_right h⟩, fun t => intersection_covering _ t.1 t.2⟩ #align category_theory.grothendieck_topology.intersection_covering_iff CategoryTheory.GrothendieckTopology.intersection_covering_iff theorem bind_covering {S : Sieve X} {R : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, S f → Sieve Y} (hS : S ∈ J X) (hR : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (H : S f), R H ∈ J Y) : Sieve.bind S R ∈ J X := J.transitive hS _ fun _ f hf => superset_covering J (Sieve.le_pullback_bind S R f hf) (hR hf) #align category_theory.grothendieck_topology.bind_covering CategoryTheory.GrothendieckTopology.bind_covering def Covers (S : Sieve X) (f : Y ⟶ X) : Prop := S.pullback f ∈ J Y #align category_theory.grothendieck_topology.covers CategoryTheory.GrothendieckTopology.Covers theorem covers_iff (S : Sieve X) (f : Y ⟶ X) : J.Covers S f ↔ S.pullback f ∈ J Y := Iff.rfl #align category_theory.grothendieck_topology.covers_iff CategoryTheory.GrothendieckTopology.covers_iff
Mathlib/CategoryTheory/Sites/Grothendieck.lean
187
187
theorem covering_iff_covers_id (S : Sieve X) : S ∈ J X ↔ J.Covers S (𝟙 X) := by
simp [covers_iff]
1
import Mathlib.Algebra.Group.Commutator import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Bracket import Mathlib.GroupTheory.Subgroup.Centralizer import Mathlib.Tactic.Group #align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G'] variable (f : F) {g₁ g₂ g₃ g : G}
Mathlib/GroupTheory/Commutator.lean
31
32
theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * g₂ = g₂ * g₁ := by
rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul]
1
import Mathlib.Data.Finset.Fold import Mathlib.Algebra.GCDMonoid.Multiset #align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" #align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d" variable {ι α β γ : Type*} namespace Finset open Multiset variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] section lcm def lcm (s : Finset β) (f : β → α) : α := s.fold GCDMonoid.lcm 1 f #align finset.lcm Finset.lcm variable {s s₁ s₂ : Finset β} {f : β → α} theorem lcm_def : s.lcm f = (s.1.map f).lcm := rfl #align finset.lcm_def Finset.lcm_def @[simp] theorem lcm_empty : (∅ : Finset β).lcm f = 1 := fold_empty #align finset.lcm_empty Finset.lcm_empty @[simp] theorem lcm_dvd_iff {a : α} : s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a := by apply Iff.trans Multiset.lcm_dvd simp only [Multiset.mem_map, and_imp, exists_imp] exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩ #align finset.lcm_dvd_iff Finset.lcm_dvd_iff theorem lcm_dvd {a : α} : (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a := lcm_dvd_iff.2 #align finset.lcm_dvd Finset.lcm_dvd theorem dvd_lcm {b : β} (hb : b ∈ s) : f b ∣ s.lcm f := lcm_dvd_iff.1 dvd_rfl _ hb #align finset.dvd_lcm Finset.dvd_lcm @[simp] theorem lcm_insert [DecidableEq β] {b : β} : (insert b s : Finset β).lcm f = GCDMonoid.lcm (f b) (s.lcm f) := by by_cases h : b ∈ s · rw [insert_eq_of_mem h, (lcm_eq_right_iff (f b) (s.lcm f) (Multiset.normalize_lcm (s.1.map f))).2 (dvd_lcm h)] apply fold_insert h #align finset.lcm_insert Finset.lcm_insert @[simp] theorem lcm_singleton {b : β} : ({b} : Finset β).lcm f = normalize (f b) := Multiset.lcm_singleton #align finset.lcm_singleton Finset.lcm_singleton -- Porting note: Priority changed for `simpNF` @[simp 1100]
Mathlib/Algebra/GCDMonoid/Finset.lean
92
92
theorem normalize_lcm : normalize (s.lcm f) = s.lcm f := by
simp [lcm_def]
1
import Mathlib.Analysis.SpecialFunctions.Complex.Circle import Mathlib.Geometry.Euclidean.Angle.Oriented.Basic #align_import geometry.euclidean.angle.oriented.rotation from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open FiniteDimensional Complex open scoped Real RealInnerProductSpace ComplexConjugate namespace Orientation attribute [local instance] Complex.finrank_real_complex_fact variable {V V' : Type*} variable [NormedAddCommGroup V] [NormedAddCommGroup V'] variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V'] variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2)) local notation "J" => o.rightAngleRotation def rotationAux (θ : Real.Angle) : V →ₗᵢ[ℝ] V := LinearMap.isometryOfInner (Real.Angle.cos θ • LinearMap.id + Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap) (by intro x y simp only [RCLike.conj_to_real, id, LinearMap.smul_apply, LinearMap.add_apply, LinearMap.id_coe, LinearEquiv.coe_coe, LinearIsometryEquiv.coe_toLinearEquiv, Orientation.areaForm_rightAngleRotation_left, Orientation.inner_rightAngleRotation_left, Orientation.inner_rightAngleRotation_right, inner_add_left, inner_smul_left, inner_add_right, inner_smul_right] linear_combination inner (𝕜 := ℝ) x y * θ.cos_sq_add_sin_sq) #align orientation.rotation_aux Orientation.rotationAux @[simp] theorem rotationAux_apply (θ : Real.Angle) (x : V) : o.rotationAux θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x := rfl #align orientation.rotation_aux_apply Orientation.rotationAux_apply def rotation (θ : Real.Angle) : V ≃ₗᵢ[ℝ] V := LinearIsometryEquiv.ofLinearIsometry (o.rotationAux θ) (Real.Angle.cos θ • LinearMap.id - Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap) (by ext x convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1 · simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply, Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap, LinearIsometryEquiv.coe_toLinearEquiv, map_smul, map_sub, LinearMap.coe_comp, LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply, ← mul_smul, add_smul, smul_add, smul_neg, smul_sub, mul_comm, sq] abel · simp) (by ext x convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1 · simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply, Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap, LinearIsometryEquiv.coe_toLinearEquiv, map_add, map_smul, LinearMap.coe_comp, LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply, add_smul, smul_neg, smul_sub, smul_smul] ring_nf abel · simp) #align orientation.rotation Orientation.rotation theorem rotation_apply (θ : Real.Angle) (x : V) : o.rotation θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x := rfl #align orientation.rotation_apply Orientation.rotation_apply theorem rotation_symm_apply (θ : Real.Angle) (x : V) : (o.rotation θ).symm x = Real.Angle.cos θ • x - Real.Angle.sin θ • J x := rfl #align orientation.rotation_symm_apply Orientation.rotation_symm_apply theorem rotation_eq_matrix_toLin (θ : Real.Angle) {x : V} (hx : x ≠ 0) : (o.rotation θ).toLinearMap = Matrix.toLin (o.basisRightAngleRotation x hx) (o.basisRightAngleRotation x hx) !![θ.cos, -θ.sin; θ.sin, θ.cos] := by apply (o.basisRightAngleRotation x hx).ext intro i fin_cases i · rw [Matrix.toLin_self] simp [rotation_apply, Fin.sum_univ_succ] · rw [Matrix.toLin_self] simp [rotation_apply, Fin.sum_univ_succ, add_comm] #align orientation.rotation_eq_matrix_to_lin Orientation.rotation_eq_matrix_toLin @[simp] theorem det_rotation (θ : Real.Angle) : LinearMap.det (o.rotation θ).toLinearMap = 1 := by haveI : Nontrivial V := FiniteDimensional.nontrivial_of_finrank_eq_succ (@Fact.out (finrank ℝ V = 2) _) obtain ⟨x, hx⟩ : ∃ x, x ≠ (0 : V) := exists_ne (0 : V) rw [o.rotation_eq_matrix_toLin θ hx] simpa [sq] using θ.cos_sq_add_sin_sq #align orientation.det_rotation Orientation.det_rotation @[simp] theorem linearEquiv_det_rotation (θ : Real.Angle) : LinearEquiv.det (o.rotation θ).toLinearEquiv = 1 := Units.ext <| by -- Porting note: Lean can't see through `LinearEquiv.coe_det` and needed the rewrite -- in mathlib3 this was just `units.ext <| o.det_rotation θ` simpa only [LinearEquiv.coe_det, Units.val_one] using o.det_rotation θ #align orientation.linear_equiv_det_rotation Orientation.linearEquiv_det_rotation @[simp] theorem rotation_symm (θ : Real.Angle) : (o.rotation θ).symm = o.rotation (-θ) := by ext; simp [o.rotation_apply, o.rotation_symm_apply, sub_eq_add_neg] #align orientation.rotation_symm Orientation.rotation_symm @[simp] theorem rotation_zero : o.rotation 0 = LinearIsometryEquiv.refl ℝ V := by ext; simp [rotation] #align orientation.rotation_zero Orientation.rotation_zero @[simp] theorem rotation_pi : o.rotation π = LinearIsometryEquiv.neg ℝ := by ext x simp [rotation] #align orientation.rotation_pi Orientation.rotation_pi
Mathlib/Geometry/Euclidean/Angle/Oriented/Rotation.lean
151
151
theorem rotation_pi_apply (x : V) : o.rotation π x = -x := by
simp
1
import Mathlib.Topology.ContinuousOn #align_import topology.algebra.order.left_right from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Set Filter Topology section PartialOrder variable {α β : Type*} [TopologicalSpace α] [PartialOrder α] [TopologicalSpace β]
Mathlib/Topology/Order/LeftRight.lean
95
97
theorem continuousWithinAt_Ioi_iff_Ici {a : α} {f : α → β} : ContinuousWithinAt f (Ioi a) a ↔ ContinuousWithinAt f (Ici a) a := by
simp only [← Ici_diff_left, continuousWithinAt_diff_self]
1
import Mathlib.RingTheory.Noetherian import Mathlib.Algebra.DirectSum.Module import Mathlib.Algebra.DirectSum.Finsupp import Mathlib.Algebra.Module.Projective import Mathlib.Algebra.Module.Injective import Mathlib.Algebra.Module.CharacterModule import Mathlib.LinearAlgebra.DirectSum.TensorProduct import Mathlib.LinearAlgebra.FreeModule.Basic import Mathlib.Algebra.Module.Projective #align_import ring_theory.flat from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" universe u v w namespace Module open Function (Surjective) open LinearMap Submodule TensorProduct DirectSum variable (R : Type u) (M : Type v) [CommRing R] [AddCommGroup M] [Module R M] @[mk_iff] class Flat : Prop where out : ∀ ⦃I : Ideal R⦄ (_ : I.FG), Function.Injective (TensorProduct.lift ((lsmul R M).comp I.subtype)) #align module.flat Module.Flat namespace Flat instance self (R : Type u) [CommRing R] : Flat R R := ⟨by intro I _ rw [← Equiv.injective_comp (TensorProduct.rid R I).symm.toEquiv] convert Subtype.coe_injective using 1 ext x simp only [Function.comp_apply, LinearEquiv.coe_toEquiv, rid_symm_apply, comp_apply, mul_one, lift.tmul, Submodule.subtype_apply, Algebra.id.smul_eq_mul, lsmul_apply]⟩ #align module.flat.self Module.Flat.self lemma iff_rTensor_injective : Flat R M ↔ ∀ ⦃I : Ideal R⦄ (_ : I.FG), Function.Injective (rTensor M I.subtype) := by simp [flat_iff, ← lid_comp_rTensor] theorem iff_rTensor_injective' : Flat R M ↔ ∀ I : Ideal R, Function.Injective (rTensor M I.subtype) := by rewrite [Flat.iff_rTensor_injective] refine ⟨fun h I => ?_, fun h I _ => h I⟩ rewrite [injective_iff_map_eq_zero] intro x hx₀ obtain ⟨J, hfg, hle, y, rfl⟩ := Submodule.exists_fg_le_eq_rTensor_inclusion x rewrite [← rTensor_comp_apply] at hx₀ rw [(injective_iff_map_eq_zero _).mp (h hfg) y hx₀, LinearMap.map_zero] @[deprecated (since := "2024-03-29")] alias lTensor_inj_iff_rTensor_inj := LinearMap.lTensor_inj_iff_rTensor_inj theorem iff_lTensor_injective : Module.Flat R M ↔ ∀ ⦃I : Ideal R⦄ (_ : I.FG), Function.Injective (lTensor M I.subtype) := by simpa [← comm_comp_rTensor_comp_comm_eq] using Module.Flat.iff_rTensor_injective R M
Mathlib/RingTheory/Flat/Basic.lean
117
119
theorem iff_lTensor_injective' : Module.Flat R M ↔ ∀ (I : Ideal R), Function.Injective (lTensor M I.subtype) := by
simpa [← comm_comp_rTensor_comp_comm_eq] using Module.Flat.iff_rTensor_injective' R M
1
import Mathlib.Data.Int.Cast.Defs import Mathlib.Tactic.Cases import Mathlib.Algebra.NeZero import Mathlib.Logic.Function.Basic #align_import algebra.char_zero.defs from "leanprover-community/mathlib"@"d6aae1bcbd04b8de2022b9b83a5b5b10e10c777d" class CharZero (R) [AddMonoidWithOne R] : Prop where cast_injective : Function.Injective (Nat.cast : ℕ → R) #align char_zero CharZero variable {R : Type*} theorem charZero_of_inj_zero [AddGroupWithOne R] (H : ∀ n : ℕ, (n : R) = 0 → n = 0) : CharZero R := ⟨@fun m n h => by induction' m with m ih generalizing n · rw [H n] rw [← h, Nat.cast_zero] cases' n with n · apply H rw [h, Nat.cast_zero] simp only [Nat.cast_succ, add_right_cancel_iff] at h rwa [ih]⟩ #align char_zero_of_inj_zero charZero_of_inj_zero namespace Nat variable [AddMonoidWithOne R] [CharZero R] theorem cast_injective : Function.Injective (Nat.cast : ℕ → R) := CharZero.cast_injective #align nat.cast_injective Nat.cast_injective @[simp, norm_cast] theorem cast_inj {m n : ℕ} : (m : R) = n ↔ m = n := cast_injective.eq_iff #align nat.cast_inj Nat.cast_inj @[simp, norm_cast] theorem cast_eq_zero {n : ℕ} : (n : R) = 0 ↔ n = 0 := by rw [← cast_zero, cast_inj] #align nat.cast_eq_zero Nat.cast_eq_zero @[norm_cast] theorem cast_ne_zero {n : ℕ} : (n : R) ≠ 0 ↔ n ≠ 0 := not_congr cast_eq_zero #align nat.cast_ne_zero Nat.cast_ne_zero theorem cast_add_one_ne_zero (n : ℕ) : (n + 1 : R) ≠ 0 := mod_cast n.succ_ne_zero #align nat.cast_add_one_ne_zero Nat.cast_add_one_ne_zero @[simp, norm_cast]
Mathlib/Algebra/CharZero/Defs.lean
92
92
theorem cast_eq_one {n : ℕ} : (n : R) = 1 ↔ n = 1 := by
rw [← cast_one, cast_inj]
1
import Mathlib.CategoryTheory.EpiMono import Mathlib.CategoryTheory.Limits.HasLimits #align_import category_theory.limits.shapes.equalizers from "leanprover-community/mathlib"@"4698e35ca56a0d4fa53aa5639c3364e0a77f4eba" section open CategoryTheory Opposite namespace CategoryTheory.Limits -- attribute [local tidy] tactic.case_bash -- Porting note: no tidy nor cases_bash universe v v₂ u u₂ inductive WalkingParallelPair : Type | zero | one deriving DecidableEq, Inhabited #align category_theory.limits.walking_parallel_pair CategoryTheory.Limits.WalkingParallelPair open WalkingParallelPair inductive WalkingParallelPairHom : WalkingParallelPair → WalkingParallelPair → Type | left : WalkingParallelPairHom zero one | right : WalkingParallelPairHom zero one | id (X : WalkingParallelPair) : WalkingParallelPairHom X X deriving DecidableEq #align category_theory.limits.walking_parallel_pair_hom CategoryTheory.Limits.WalkingParallelPairHom attribute [-simp, nolint simpNF] WalkingParallelPairHom.id.sizeOf_spec instance : Inhabited (WalkingParallelPairHom zero one) where default := WalkingParallelPairHom.left open WalkingParallelPairHom def WalkingParallelPairHom.comp : -- Porting note: changed X Y Z to implicit to match comp fields in precategory ∀ { X Y Z : WalkingParallelPair } (_ : WalkingParallelPairHom X Y) (_ : WalkingParallelPairHom Y Z), WalkingParallelPairHom X Z | _, _, _, id _, h => h | _, _, _, left, id one => left | _, _, _, right, id one => right #align category_theory.limits.walking_parallel_pair_hom.comp CategoryTheory.Limits.WalkingParallelPairHom.comp -- Porting note: adding these since they are simple and aesop couldn't directly prove them theorem WalkingParallelPairHom.id_comp {X Y : WalkingParallelPair} (g : WalkingParallelPairHom X Y) : comp (id X) g = g := rfl theorem WalkingParallelPairHom.comp_id {X Y : WalkingParallelPair} (f : WalkingParallelPairHom X Y) : comp f (id Y) = f := by cases f <;> rfl theorem WalkingParallelPairHom.assoc {X Y Z W : WalkingParallelPair} (f : WalkingParallelPairHom X Y) (g: WalkingParallelPairHom Y Z) (h : WalkingParallelPairHom Z W) : comp (comp f g) h = comp f (comp g h) := by cases f <;> cases g <;> cases h <;> rfl instance walkingParallelPairHomCategory : SmallCategory WalkingParallelPair where Hom := WalkingParallelPairHom id := id comp := comp comp_id := comp_id id_comp := id_comp assoc := assoc #align category_theory.limits.walking_parallel_pair_hom_category CategoryTheory.Limits.walkingParallelPairHomCategory @[simp] theorem walkingParallelPairHom_id (X : WalkingParallelPair) : WalkingParallelPairHom.id X = 𝟙 X := rfl #align category_theory.limits.walking_parallel_pair_hom_id CategoryTheory.Limits.walkingParallelPairHom_id -- Porting note: simpNF asked me to do this because the LHS of the non-primed version reduced @[simp]
Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean
126
127
theorem WalkingParallelPairHom.id.sizeOf_spec' (X : WalkingParallelPair) : (WalkingParallelPairHom._sizeOf_inst X X).sizeOf (𝟙 X) = 1 + sizeOf X := by
cases X <;> rfl
1
import Mathlib.Order.BooleanAlgebra import Mathlib.Logic.Equiv.Basic #align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904" open Function OrderDual variable {ι α β : Type*} {π : ι → Type*} def symmDiff [Sup α] [SDiff α] (a b : α) : α := a \ b ⊔ b \ a #align symm_diff symmDiff def bihimp [Inf α] [HImp α] (a b : α) : α := (b ⇨ a) ⊓ (a ⇨ b) #align bihimp bihimp scoped[symmDiff] infixl:100 " ∆ " => symmDiff scoped[symmDiff] infixl:100 " ⇔ " => bihimp open scoped symmDiff theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a := rfl #align symm_diff_def symmDiff_def theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) := rfl #align bihimp_def bihimp_def theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q := rfl #align symm_diff_eq_xor symmDiff_eq_Xor' @[simp] theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) := (iff_iff_implies_and_implies _ _).symm.trans Iff.comm #align bihimp_iff_iff bihimp_iff_iff @[simp] theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide #align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor section HeytingAlgebra variable [HeytingAlgebra α] (a : α) @[simp] theorem bihimp_bot : a ⇔ ⊥ = aᶜ := by simp [bihimp] #align bihimp_bot bihimp_bot @[simp]
Mathlib/Order/SymmDiff.lean
375
375
theorem bot_bihimp : ⊥ ⇔ a = aᶜ := by
simp [bihimp]
1
import Mathlib.Algebra.Group.Opposite import Mathlib.Algebra.Group.Units.Hom #align_import algebra.group.prod from "leanprover-community/mathlib"@"cd391184c85986113f8c00844cfe6dda1d34be3d" assert_not_exists MonoidWithZero -- TODO: -- assert_not_exists AddMonoidWithOne assert_not_exists DenselyOrdered variable {A : Type*} {B : Type*} {G : Type*} {H : Type*} {M : Type*} {N : Type*} {P : Type*} namespace Prod @[to_additive] instance instMul [Mul M] [Mul N] : Mul (M × N) := ⟨fun p q => ⟨p.1 * q.1, p.2 * q.2⟩⟩ @[to_additive (attr := simp)] theorem fst_mul [Mul M] [Mul N] (p q : M × N) : (p * q).1 = p.1 * q.1 := rfl #align prod.fst_mul Prod.fst_mul #align prod.fst_add Prod.fst_add @[to_additive (attr := simp)] theorem snd_mul [Mul M] [Mul N] (p q : M × N) : (p * q).2 = p.2 * q.2 := rfl #align prod.snd_mul Prod.snd_mul #align prod.snd_add Prod.snd_add @[to_additive (attr := simp)] theorem mk_mul_mk [Mul M] [Mul N] (a₁ a₂ : M) (b₁ b₂ : N) : (a₁, b₁) * (a₂, b₂) = (a₁ * a₂, b₁ * b₂) := rfl #align prod.mk_mul_mk Prod.mk_mul_mk #align prod.mk_add_mk Prod.mk_add_mk @[to_additive (attr := simp)] theorem swap_mul [Mul M] [Mul N] (p q : M × N) : (p * q).swap = p.swap * q.swap := rfl #align prod.swap_mul Prod.swap_mul #align prod.swap_add Prod.swap_add @[to_additive] theorem mul_def [Mul M] [Mul N] (p q : M × N) : p * q = (p.1 * q.1, p.2 * q.2) := rfl #align prod.mul_def Prod.mul_def #align prod.add_def Prod.add_def @[to_additive]
Mathlib/Algebra/Group/Prod.lean
79
81
theorem one_mk_mul_one_mk [Monoid M] [Mul N] (b₁ b₂ : N) : ((1 : M), b₁) * (1, b₂) = (1, b₁ * b₂) := by
rw [mk_mul_mk, mul_one]
1
import Mathlib.Data.Set.Image import Mathlib.Order.Interval.Set.Basic #align_import data.set.intervals.with_bot_top from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" open Set variable {α : Type*} namespace WithTop @[simp] theorem preimage_coe_top : (some : α → WithTop α) ⁻¹' {⊤} = (∅ : Set α) := eq_empty_of_subset_empty fun _ => coe_ne_top #align with_top.preimage_coe_top WithTop.preimage_coe_top variable [Preorder α] {a b : α} theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by ext x rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists] #align with_top.range_coe WithTop.range_coe @[simp] theorem preimage_coe_Ioi : (some : α → WithTop α) ⁻¹' Ioi a = Ioi a := ext fun _ => coe_lt_coe #align with_top.preimage_coe_Ioi WithTop.preimage_coe_Ioi @[simp] theorem preimage_coe_Ici : (some : α → WithTop α) ⁻¹' Ici a = Ici a := ext fun _ => coe_le_coe #align with_top.preimage_coe_Ici WithTop.preimage_coe_Ici @[simp] theorem preimage_coe_Iio : (some : α → WithTop α) ⁻¹' Iio a = Iio a := ext fun _ => coe_lt_coe #align with_top.preimage_coe_Iio WithTop.preimage_coe_Iio @[simp] theorem preimage_coe_Iic : (some : α → WithTop α) ⁻¹' Iic a = Iic a := ext fun _ => coe_le_coe #align with_top.preimage_coe_Iic WithTop.preimage_coe_Iic @[simp] theorem preimage_coe_Icc : (some : α → WithTop α) ⁻¹' Icc a b = Icc a b := by simp [← Ici_inter_Iic] #align with_top.preimage_coe_Icc WithTop.preimage_coe_Icc @[simp] theorem preimage_coe_Ico : (some : α → WithTop α) ⁻¹' Ico a b = Ico a b := by simp [← Ici_inter_Iio] #align with_top.preimage_coe_Ico WithTop.preimage_coe_Ico @[simp] theorem preimage_coe_Ioc : (some : α → WithTop α) ⁻¹' Ioc a b = Ioc a b := by simp [← Ioi_inter_Iic] #align with_top.preimage_coe_Ioc WithTop.preimage_coe_Ioc @[simp] theorem preimage_coe_Ioo : (some : α → WithTop α) ⁻¹' Ioo a b = Ioo a b := by simp [← Ioi_inter_Iio] #align with_top.preimage_coe_Ioo WithTop.preimage_coe_Ioo @[simp] theorem preimage_coe_Iio_top : (some : α → WithTop α) ⁻¹' Iio ⊤ = univ := by rw [← range_coe, preimage_range] #align with_top.preimage_coe_Iio_top WithTop.preimage_coe_Iio_top @[simp] theorem preimage_coe_Ico_top : (some : α → WithTop α) ⁻¹' Ico a ⊤ = Ici a := by simp [← Ici_inter_Iio] #align with_top.preimage_coe_Ico_top WithTop.preimage_coe_Ico_top @[simp]
Mathlib/Order/Interval/Set/WithBotTop.lean
85
86
theorem preimage_coe_Ioo_top : (some : α → WithTop α) ⁻¹' Ioo a ⊤ = Ioi a := by
simp [← Ioi_inter_Iio]
1
import Mathlib.MeasureTheory.PiSystem import Mathlib.Order.OmegaCompletePartialOrder import Mathlib.Topology.Constructions import Mathlib.MeasureTheory.MeasurableSpace.Basic open Set namespace MeasureTheory variable {ι : Type _} {α : ι → Type _} section cylinder def cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : Set (∀ i, α i) := (fun (f : ∀ i, α i) (i : s) ↦ f i) ⁻¹' S @[simp] theorem mem_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) (f : ∀ i, α i) : f ∈ cylinder s S ↔ (fun i : s ↦ f i) ∈ S := mem_preimage @[simp] theorem cylinder_empty (s : Finset ι) : cylinder s (∅ : Set (∀ i : s, α i)) = ∅ := by rw [cylinder, preimage_empty] @[simp] theorem cylinder_univ (s : Finset ι) : cylinder s (univ : Set (∀ i : s, α i)) = univ := by rw [cylinder, preimage_univ] @[simp] theorem cylinder_eq_empty_iff [h_nonempty : Nonempty (∀ i, α i)] (s : Finset ι) (S : Set (∀ i : s, α i)) : cylinder s S = ∅ ↔ S = ∅ := by refine ⟨fun h ↦ ?_, fun h ↦ by (rw [h]; exact cylinder_empty _)⟩ by_contra hS rw [← Ne, ← nonempty_iff_ne_empty] at hS let f := hS.some have hf : f ∈ S := hS.choose_spec classical let f' : ∀ i, α i := fun i ↦ if hi : i ∈ s then f ⟨i, hi⟩ else h_nonempty.some i have hf' : f' ∈ cylinder s S := by rw [mem_cylinder] simpa only [f', Finset.coe_mem, dif_pos] rw [h] at hf' exact not_mem_empty _ hf' theorem inter_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i)) [DecidableEq ι] : cylinder s₁ S₁ ∩ cylinder s₂ S₂ = cylinder (s₁ ∪ s₂) ((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∩ (fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by ext1 f; simp only [mem_inter_iff, mem_cylinder, mem_setOf_eq]; rfl theorem inter_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) : cylinder s S₁ ∩ cylinder s S₂ = cylinder s (S₁ ∩ S₂) := by classical rw [inter_cylinder]; rfl theorem union_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i)) [DecidableEq ι] : cylinder s₁ S₁ ∪ cylinder s₂ S₂ = cylinder (s₁ ∪ s₂) ((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∪ (fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by ext1 f; simp only [mem_union, mem_cylinder, mem_setOf_eq]; rfl theorem union_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) : cylinder s S₁ ∪ cylinder s S₂ = cylinder s (S₁ ∪ S₂) := by classical rw [union_cylinder]; rfl theorem compl_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : (cylinder s S)ᶜ = cylinder s (Sᶜ) := by ext1 f; simp only [mem_compl_iff, mem_cylinder] theorem diff_cylinder_same (s : Finset ι) (S T : Set (∀ i : s, α i)) : cylinder s S \ cylinder s T = cylinder s (S \ T) := by ext1 f; simp only [mem_diff, mem_cylinder] theorem eq_of_cylinder_eq_of_subset [h_nonempty : Nonempty (∀ i, α i)] {I J : Finset ι} {S : Set (∀ i : I, α i)} {T : Set (∀ i : J, α i)} (h_eq : cylinder I S = cylinder J T) (hJI : J ⊆ I) : S = (fun f : ∀ i : I, α i ↦ fun j : J ↦ f ⟨j, hJI j.prop⟩) ⁻¹' T := by rw [Set.ext_iff] at h_eq simp only [mem_cylinder] at h_eq ext1 f simp only [mem_preimage] classical specialize h_eq fun i ↦ if hi : i ∈ I then f ⟨i, hi⟩ else h_nonempty.some i have h_mem : ∀ j : J, ↑j ∈ I := fun j ↦ hJI j.prop simp only [Finset.coe_mem, dite_true, h_mem] at h_eq exact h_eq
Mathlib/MeasureTheory/Constructions/Cylinders.lean
231
235
theorem cylinder_eq_cylinder_union [DecidableEq ι] (I : Finset ι) (S : Set (∀ i : I, α i)) (J : Finset ι) : cylinder I S = cylinder (I ∪ J) ((fun f ↦ fun j : I ↦ f ⟨j, Finset.mem_union_left J j.prop⟩) ⁻¹' S) := by
ext1 f; simp only [mem_cylinder, mem_preimage]
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
Mathlib/Algebra/Lie/Free.lean
91
92
theorem Rel.neg {a b : lib R X} (h : Rel R X a b) : Rel R X (-a) (-b) := by
simpa only [neg_one_smul] using h.smul (-1)
1
import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Group.Int import Mathlib.Data.Nat.Dist import Mathlib.Data.Ordmap.Ordnode import Mathlib.Tactic.Abel import Mathlib.Tactic.Linarith #align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" variable {α : Type*} namespace Ordnode theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 := not_le_of_gt H #align ordnode.not_le_delta Ordnode.not_le_delta theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False := not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta) #align ordnode.delta_lt_false Ordnode.delta_lt_false def realSize : Ordnode α → ℕ | nil => 0 | node _ l _ r => realSize l + realSize r + 1 #align ordnode.real_size Ordnode.realSize def Sized : Ordnode α → Prop | nil => True | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r #align ordnode.sized Ordnode.Sized theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) := ⟨rfl, hl, hr⟩ #align ordnode.sized.node' Ordnode.Sized.node' theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by rw [h.1] #align ordnode.sized.eq_node' Ordnode.Sized.eq_node' theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) : size (@node α s l x r) = size l + size r + 1 := H.1 #align ordnode.sized.size_eq Ordnode.Sized.size_eq @[elab_as_elim] theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil) (H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t := by induction t with | nil => exact H0 | node _ _ _ _ t_ih_l t_ih_r => rw [hl.eq_node'] exact H1 _ _ _ (t_ih_l hl.2.1) (t_ih_r hl.2.2) #align ordnode.sized.induction Ordnode.Sized.induction theorem size_eq_realSize : ∀ {t : Ordnode α}, Sized t → size t = realSize t | nil, _ => rfl | node s l x r, ⟨h₁, h₂, h₃⟩ => by rw [size, h₁, size_eq_realSize h₂, size_eq_realSize h₃]; rfl #align ordnode.size_eq_real_size Ordnode.size_eq_realSize @[simp] theorem Sized.size_eq_zero {t : Ordnode α} (ht : Sized t) : size t = 0 ↔ t = nil := by cases t <;> [simp;simp [ht.1]] #align ordnode.sized.size_eq_zero Ordnode.Sized.size_eq_zero theorem Sized.pos {s l x r} (h : Sized (@node α s l x r)) : 0 < s := by rw [h.1]; apply Nat.le_add_left #align ordnode.sized.pos Ordnode.Sized.pos theorem dual_dual : ∀ t : Ordnode α, dual (dual t) = t | nil => rfl | node s l x r => by rw [dual, dual, dual_dual l, dual_dual r] #align ordnode.dual_dual Ordnode.dual_dual @[simp] theorem size_dual (t : Ordnode α) : size (dual t) = size t := by cases t <;> rfl #align ordnode.size_dual Ordnode.size_dual def BalancedSz (l r : ℕ) : Prop := l + r ≤ 1 ∨ l ≤ delta * r ∧ r ≤ delta * l #align ordnode.balanced_sz Ordnode.BalancedSz instance BalancedSz.dec : DecidableRel BalancedSz := fun _ _ => Or.decidable #align ordnode.balanced_sz.dec Ordnode.BalancedSz.dec def Balanced : Ordnode α → Prop | nil => True | node _ l _ r => BalancedSz (size l) (size r) ∧ Balanced l ∧ Balanced r #align ordnode.balanced Ordnode.Balanced instance Balanced.dec : DecidablePred (@Balanced α) | nil => by unfold Balanced infer_instance | node _ l _ r => by unfold Balanced haveI := Balanced.dec l haveI := Balanced.dec r infer_instance #align ordnode.balanced.dec Ordnode.Balanced.dec @[symm] theorem BalancedSz.symm {l r : ℕ} : BalancedSz l r → BalancedSz r l := Or.imp (by rw [add_comm]; exact id) And.symm #align ordnode.balanced_sz.symm Ordnode.BalancedSz.symm
Mathlib/Data/Ordmap/Ordset.lean
196
197
theorem balancedSz_zero {l : ℕ} : BalancedSz l 0 ↔ l ≤ 1 := by
simp (config := { contextual := true }) [BalancedSz]
1
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology namespace Real variable {ι : Type*} [Fintype ι] theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by haveI : IsAddLeftInvariant StieltjesFunction.id.measure := ⟨fun a => Eq.symm <| Real.measure_ext_Ioo_rat fun p q => by simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo, sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim, StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩ have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1 rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;> simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero, StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one] conv_rhs => rw [addHaarMeasure_unique StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A] simp only [volume, Basis.addHaar, one_smul] #align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by simp [volume_eq_stieltjes_id] #align real.volume_val Real.volume_val @[simp] theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ico Real.volume_Ico @[simp]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
84
84
theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by
simp [volume_val]
1
import Mathlib.Probability.ProbabilityMassFunction.Monad #align_import probability.probability_mass_function.constructions from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d" universe u namespace PMF noncomputable section variable {α β γ : Type*} open scoped Classical open NNReal ENNReal section Map def map (f : α → β) (p : PMF α) : PMF β := bind p (pure ∘ f) #align pmf.map PMF.map variable (f : α → β) (p : PMF α) (b : β) theorem monad_map_eq_map {α β : Type u} (f : α → β) (p : PMF α) : f <$> p = p.map f := rfl #align pmf.monad_map_eq_map PMF.monad_map_eq_map @[simp]
Mathlib/Probability/ProbabilityMassFunction/Constructions.lean
52
52
theorem map_apply : (map f p) b = ∑' a, if b = f a then p a else 0 := by
simp [map]
1
import Mathlib.Control.EquivFunctor import Mathlib.Data.Option.Basic import Mathlib.Data.Subtype import Mathlib.Logic.Equiv.Defs import Mathlib.Tactic.Cases #align_import logic.equiv.option from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u namespace Equiv open Option variable {α β γ : Type*} section RemoveNone variable (e : Option α ≃ Option β) def removeNone_aux (x : α) : β := if h : (e (some x)).isSome then Option.get _ h else Option.get _ <| show (e none).isSome by rw [← Option.ne_none_iff_isSome] intro hn rw [Option.not_isSome_iff_eq_none, ← hn] at h exact Option.some_ne_none _ (e.injective h) -- Porting note: private -- #align equiv.remove_none_aux Equiv.removeNone_aux
Mathlib/Logic/Equiv/Option.lean
89
91
theorem removeNone_aux_some {x : α} (h : ∃ x', e (some x) = some x') : some (removeNone_aux e x) = e (some x) := by
simp [removeNone_aux, Option.isSome_iff_exists.mpr h]
1
import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Normed.Field.InfiniteSum import Mathlib.Data.Nat.Choose.Cast import Mathlib.Data.Finset.NoncommProd import Mathlib.Topology.Algebra.Algebra #align_import analysis.normed_space.exponential from "leanprover-community/mathlib"@"62748956a1ece9b26b33243e2e3a2852176666f5" namespace NormedSpace open Filter RCLike ContinuousMultilinearMap NormedField Asymptotics open scoped Nat Topology ENNReal section TopologicalAlgebra variable (𝕂 𝔸 : Type*) [Field 𝕂] [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] def expSeries : FormalMultilinearSeries 𝕂 𝔸 𝔸 := fun n => (n !⁻¹ : 𝕂) • ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸 #align exp_series NormedSpace.expSeries variable {𝔸} noncomputable def exp (x : 𝔸) : 𝔸 := (expSeries 𝕂 𝔸).sum x #align exp NormedSpace.exp variable {𝕂} theorem expSeries_apply_eq (x : 𝔸) (n : ℕ) : (expSeries 𝕂 𝔸 n fun _ => x) = (n !⁻¹ : 𝕂) • x ^ n := by simp [expSeries] #align exp_series_apply_eq NormedSpace.expSeries_apply_eq theorem expSeries_apply_eq' (x : 𝔸) : (fun n => expSeries 𝕂 𝔸 n fun _ => x) = fun n => (n !⁻¹ : 𝕂) • x ^ n := funext (expSeries_apply_eq x) #align exp_series_apply_eq' NormedSpace.expSeries_apply_eq' theorem expSeries_sum_eq (x : 𝔸) : (expSeries 𝕂 𝔸).sum x = ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n := tsum_congr fun n => expSeries_apply_eq x n #align exp_series_sum_eq NormedSpace.expSeries_sum_eq theorem exp_eq_tsum : exp 𝕂 = fun x : 𝔸 => ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n := funext expSeries_sum_eq #align exp_eq_tsum NormedSpace.exp_eq_tsum theorem expSeries_apply_zero (n : ℕ) : (expSeries 𝕂 𝔸 n fun _ => (0 : 𝔸)) = Pi.single (f := fun _ => 𝔸) 0 1 n := by rw [expSeries_apply_eq] cases' n with n · rw [pow_zero, Nat.factorial_zero, Nat.cast_one, inv_one, one_smul, Pi.single_eq_same] · rw [zero_pow (Nat.succ_ne_zero _), smul_zero, Pi.single_eq_of_ne n.succ_ne_zero] #align exp_series_apply_zero NormedSpace.expSeries_apply_zero @[simp] theorem exp_zero : exp 𝕂 (0 : 𝔸) = 1 := by simp_rw [exp_eq_tsum, ← expSeries_apply_eq, expSeries_apply_zero, tsum_pi_single] #align exp_zero NormedSpace.exp_zero @[simp]
Mathlib/Analysis/NormedSpace/Exponential.lean
150
151
theorem exp_op [T2Space 𝔸] (x : 𝔸) : exp 𝕂 (MulOpposite.op x) = MulOpposite.op (exp 𝕂 x) := by
simp_rw [exp, expSeries_sum_eq, ← MulOpposite.op_pow, ← MulOpposite.op_smul, tsum_op]
1
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector α n) (ys : Vector β n) @[simp] theorem mapAccumr₂_mapAccumr_left (f₁ : γ → β → σ₁ → σ₁ × ζ) (f₂ : α → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr f₂ xs s₂).snd ys s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ x s.snd let r₁ := f₁ r₂.snd y s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map₂_map_left (f₁ : γ → β → ζ) (f₂ : α → γ) : map₂ f₁ (map f₂ xs) ys = map₂ (fun x y => f₁ (f₂ x) y) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr_right (f₁ : α → γ → σ₁ → σ₁ × ζ) (f₂ : β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ xs (mapAccumr f₂ ys s₂).snd s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ y s.snd let r₁ := f₁ x r₂.snd s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map₂_map_right (f₁ : α → γ → ζ) (f₂ : β → γ) : map₂ f₁ xs (map f₂ ys) = map₂ (fun x y => f₁ x (f₂ y)) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr_mapAccumr₂ (f₁ : γ → σ₁ → σ₁ × ζ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr f₁ (mapAccumr₂ f₂ xs ys s₂).snd s₁) = let m := mapAccumr₂ (fun x y s => let r₂ := f₂ x y s.snd let r₁ := f₁ r₂.snd s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map_map₂ (f₁ : γ → ζ) (f₂ : α → β → γ) : map f₁ (map₂ f₂ xs ys) = map₂ (fun x y => f₁ <| f₂ x y) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr₂_left_left (f₁ : γ → α → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd xs s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ r₂.snd x s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr₂_left_right (f₁ : γ → β → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd ys s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ r₂.snd y s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
133
142
theorem mapAccumr₂_mapAccumr₂_right_left (f₁ : α → γ → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ xs (mapAccumr₂ f₂ xs ys s₂).snd s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ x r₂.snd s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
1
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Topology.Algebra.InfiniteSum.Order import Mathlib.Topology.Instances.Real import Mathlib.Topology.Instances.ENNReal #align_import topology.algebra.infinite_sum.real from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" open Filter Finset NNReal Topology variable {α β : Type*} [PseudoMetricSpace α] {f : ℕ → α} {a : α} theorem cauchySeq_of_dist_le_of_summable (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n) (hd : Summable d) : CauchySeq f := by lift d to ℕ → ℝ≥0 using fun n ↦ dist_nonneg.trans (hf n) apply cauchySeq_of_edist_le_of_summable d (α := α) (f := f) · exact_mod_cast hf · exact_mod_cast hd #align cauchy_seq_of_dist_le_of_summable cauchySeq_of_dist_le_of_summable theorem cauchySeq_of_summable_dist (h : Summable fun n ↦ dist (f n) (f n.succ)) : CauchySeq f := cauchySeq_of_dist_le_of_summable _ (fun _ ↦ le_rfl) h #align cauchy_seq_of_summable_dist cauchySeq_of_summable_dist theorem dist_le_tsum_of_dist_le_of_tendsto (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n) (hd : Summable d) {a : α} (ha : Tendsto f atTop (𝓝 a)) (n : ℕ) : dist (f n) a ≤ ∑' m, d (n + m) := by refine le_of_tendsto (tendsto_const_nhds.dist ha) (eventually_atTop.2 ⟨n, fun m hnm ↦ ?_⟩) refine le_trans (dist_le_Ico_sum_of_dist_le hnm fun _ _ ↦ hf _) ?_ rw [sum_Ico_eq_sum_range] refine sum_le_tsum (range _) (fun _ _ ↦ le_trans dist_nonneg (hf _)) ?_ exact hd.comp_injective (add_right_injective n) #align dist_le_tsum_of_dist_le_of_tendsto dist_le_tsum_of_dist_le_of_tendsto theorem dist_le_tsum_of_dist_le_of_tendsto₀ (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n) (hd : Summable d) (ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ tsum d := by simpa only [zero_add] using dist_le_tsum_of_dist_le_of_tendsto d hf hd ha 0 #align dist_le_tsum_of_dist_le_of_tendsto₀ dist_le_tsum_of_dist_le_of_tendsto₀ theorem dist_le_tsum_dist_of_tendsto (h : Summable fun n ↦ dist (f n) (f n.succ)) (ha : Tendsto f atTop (𝓝 a)) (n) : dist (f n) a ≤ ∑' m, dist (f (n + m)) (f (n + m).succ) := show dist (f n) a ≤ ∑' m, (fun x ↦ dist (f x) (f x.succ)) (n + m) from dist_le_tsum_of_dist_le_of_tendsto (fun n ↦ dist (f n) (f n.succ)) (fun _ ↦ le_rfl) h ha n #align dist_le_tsum_dist_of_tendsto dist_le_tsum_dist_of_tendsto
Mathlib/Topology/Algebra/InfiniteSum/Real.lean
60
62
theorem dist_le_tsum_dist_of_tendsto₀ (h : Summable fun n ↦ dist (f n) (f n.succ)) (ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ ∑' n, dist (f n) (f n.succ) := by
simpa only [zero_add] using dist_le_tsum_dist_of_tendsto h ha 0
1
import Mathlib.CategoryTheory.Iso import Mathlib.CategoryTheory.EssentialImage import Mathlib.CategoryTheory.Types import Mathlib.CategoryTheory.Opposites import Mathlib.Data.Rel #align_import category_theory.category.Rel from "leanprover-community/mathlib"@"afad8e438d03f9d89da2914aa06cb4964ba87a18" namespace CategoryTheory universe u -- This file is about Lean 3 declaration "Rel". set_option linter.uppercaseLean3 false def RelCat := Type u #align category_theory.Rel CategoryTheory.RelCat instance RelCat.inhabited : Inhabited RelCat := by unfold RelCat; infer_instance #align category_theory.Rel.inhabited CategoryTheory.RelCat.inhabited instance rel : LargeCategory RelCat where Hom X Y := X → Y → Prop id X x y := x = y comp f g x z := ∃ y, f x y ∧ g y z #align category_theory.rel CategoryTheory.rel namespace RelCat @[ext] theorem hom_ext {X Y : RelCat} (f g : X ⟶ Y) (h : ∀ a b, f a b ↔ g a b) : f = g := funext₂ (fun a b => propext (h a b)) namespace Hom protected theorem rel_id (X : RelCat) : 𝟙 X = (· = ·) := rfl protected theorem rel_comp {X Y Z : RelCat} (f : X ⟶ Y) (g : Y ⟶ Z) : f ≫ g = Rel.comp f g := rfl
Mathlib/CategoryTheory/Category/RelCat.lean
62
63
theorem rel_id_apply₂ (X : RelCat) (x y : X) : (𝟙 X) x y ↔ x = y := by
rw [RelCat.Hom.rel_id]
1
import Batteries.Data.List.Basic import Batteries.Data.List.Lemmas open Nat namespace List section countP variable (p q : α → Bool) @[simp] theorem countP_nil : countP p [] = 0 := rfl protected theorem countP_go_eq_add (l) : countP.go p l n = n + countP.go p l 0 := by induction l generalizing n with | nil => rfl | cons head tail ih => unfold countP.go rw [ih (n := n + 1), ih (n := n), ih (n := 1)] if h : p head then simp [h, Nat.add_assoc] else simp [h] @[simp] theorem countP_cons_of_pos (l) (pa : p a) : countP p (a :: l) = countP p l + 1 := by have : countP.go p (a :: l) 0 = countP.go p l 1 := show cond .. = _ by rw [pa]; rfl unfold countP rw [this, Nat.add_comm, List.countP_go_eq_add] @[simp] theorem countP_cons_of_neg (l) (pa : ¬p a) : countP p (a :: l) = countP p l := by simp [countP, countP.go, pa] theorem countP_cons (a : α) (l) : countP p (a :: l) = countP p l + if p a then 1 else 0 := by by_cases h : p a <;> simp [h] theorem length_eq_countP_add_countP (l) : length l = countP p l + countP (fun a => ¬p a) l := by induction l with | nil => rfl | cons x h ih => if h : p x then rw [countP_cons_of_pos _ _ h, countP_cons_of_neg _ _ _, length, ih] · rw [Nat.add_assoc, Nat.add_comm _ 1, Nat.add_assoc] · simp only [h, not_true_eq_false, decide_False, not_false_eq_true] else rw [countP_cons_of_pos (fun a => ¬p a) _ _, countP_cons_of_neg _ _ h, length, ih] · rfl · simp only [h, not_false_eq_true, decide_True] theorem countP_eq_length_filter (l) : countP p l = length (filter p l) := by induction l with | nil => rfl | cons x l ih => if h : p x then rw [countP_cons_of_pos p l h, ih, filter_cons_of_pos l h, length] else rw [countP_cons_of_neg p l h, ih, filter_cons_of_neg l h] theorem countP_le_length : countP p l ≤ l.length := by simp only [countP_eq_length_filter] apply length_filter_le @[simp] theorem countP_append (l₁ l₂) : countP p (l₁ ++ l₂) = countP p l₁ + countP p l₂ := by simp only [countP_eq_length_filter, filter_append, length_append] theorem countP_pos : 0 < countP p l ↔ ∃ a ∈ l, p a := by simp only [countP_eq_length_filter, length_pos_iff_exists_mem, mem_filter, exists_prop]
.lake/packages/batteries/Batteries/Data/List/Count.lean
78
79
theorem countP_eq_zero : countP p l = 0 ↔ ∀ a ∈ l, ¬p a := by
simp only [countP_eq_length_filter, length_eq_zero, filter_eq_nil]
1
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Algebra.Polynomial.Module.AEval import Mathlib.RingTheory.Derivation.Basic noncomputable section namespace Polynomial section CommSemiring variable {R A : Type*} [CommSemiring R] @[simps] def derivative' : Derivation R R[X] R[X] where toFun := derivative map_add' _ _ := derivative_add map_smul' := derivative_smul map_one_eq_zero' := derivative_one leibniz' f g := by simp [mul_comm, add_comm, derivative_mul] variable [AddCommMonoid A] [Module R A] [Module (Polynomial R) A] @[simp] theorem derivation_C (D : Derivation R R[X] A) (a : R) : D (C a) = 0 := D.map_algebraMap a @[simp] theorem C_smul_derivation_apply (D : Derivation R R[X] A) (a : R) (f : R[X]) : C a • D f = a • D f := by have : C a • D f = D (C a * f) := by simp rw [this, C_mul', D.map_smul] @[ext] theorem derivation_ext {D₁ D₂ : Derivation R R[X] A} (h : D₁ X = D₂ X) : D₁ = D₂ := Derivation.ext fun f => Derivation.eqOn_adjoin (Set.eqOn_singleton.2 h) <| by simp only [adjoin_X, Algebra.coe_top, Set.mem_univ] variable [IsScalarTower R (Polynomial R) A] variable (R) def mkDerivation : A →ₗ[R] Derivation R R[X] A where toFun := fun a ↦ (LinearMap.toSpanSingleton R[X] A a).compDer derivative' map_add' := fun a b ↦ by ext; simp map_smul' := fun t a ↦ by ext; simp lemma mkDerivation_apply (a : A) (f : R[X]) : mkDerivation R a f = derivative f • a := by rfl @[simp]
Mathlib/Algebra/Polynomial/Derivation.lean
67
67
theorem mkDerivation_X (a : A) : mkDerivation R a X = a := by
simp [mkDerivation_apply]
1
import Mathlib.Data.List.Basic #align_import data.list.lattice from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734" open Nat namespace List variable {α : Type*} {l l₁ l₂ : List α} {p : α → Prop} {a : α} variable [DecidableEq α] section Inter @[simp] theorem inter_nil (l : List α) : [] ∩ l = [] := rfl #align list.inter_nil List.inter_nil @[simp] theorem inter_cons_of_mem (l₁ : List α) (h : a ∈ l₂) : (a :: l₁) ∩ l₂ = a :: l₁ ∩ l₂ := by simp [Inter.inter, List.inter, h] #align list.inter_cons_of_mem List.inter_cons_of_mem @[simp] theorem inter_cons_of_not_mem (l₁ : List α) (h : a ∉ l₂) : (a :: l₁) ∩ l₂ = l₁ ∩ l₂ := by simp [Inter.inter, List.inter, h] #align list.inter_cons_of_not_mem List.inter_cons_of_not_mem theorem mem_of_mem_inter_left : a ∈ l₁ ∩ l₂ → a ∈ l₁ := mem_of_mem_filter #align list.mem_of_mem_inter_left List.mem_of_mem_inter_left
Mathlib/Data/List/Lattice.lean
147
147
theorem mem_of_mem_inter_right (h : a ∈ l₁ ∩ l₂) : a ∈ l₂ := by
simpa using of_mem_filter h
1
import Mathlib.Topology.Algebra.InfiniteSum.Basic import Mathlib.Topology.Algebra.UniformGroup noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section TopologicalGroup variable [CommGroup α] [TopologicalSpace α] [TopologicalGroup α] variable {f g : β → α} {a a₁ a₂ : α} -- `by simpa using` speeds up elaboration. Why? @[to_additive] theorem HasProd.inv (h : HasProd f a) : HasProd (fun b ↦ (f b)⁻¹) a⁻¹ := by simpa only using h.map (MonoidHom.id α)⁻¹ continuous_inv #align has_sum.neg HasSum.neg @[to_additive] theorem Multipliable.inv (hf : Multipliable f) : Multipliable fun b ↦ (f b)⁻¹ := hf.hasProd.inv.multipliable #align summable.neg Summable.neg @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/Group.lean
40
41
theorem Multipliable.of_inv (hf : Multipliable fun b ↦ (f b)⁻¹) : Multipliable f := by
simpa only [inv_inv] using hf.inv
1
import Mathlib.Topology.Algebra.Algebra import Mathlib.Topology.ContinuousFunction.Compact import Mathlib.Topology.UrysohnsLemma import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.Units import Mathlib.Topology.Algebra.Module.CharacterSpace #align_import topology.continuous_function.ideals from "leanprover-community/mathlib"@"c2258f7bf086b17eac0929d635403780c39e239f" open scoped NNReal namespace ContinuousMap open TopologicalSpace section TopologicalRing variable {X R : Type*} [TopologicalSpace X] [Semiring R] variable [TopologicalSpace R] [TopologicalSemiring R] variable (R) def idealOfSet (s : Set X) : Ideal C(X, R) where carrier := {f : C(X, R) | ∀ x ∈ sᶜ, f x = 0} add_mem' {f g} hf hg x hx := by simp [hf x hx, hg x hx, coe_add, Pi.add_apply, add_zero] zero_mem' _ _ := rfl smul_mem' c f hf x hx := mul_zero (c x) ▸ congr_arg (fun y => c x * y) (hf x hx) #align continuous_map.ideal_of_set ContinuousMap.idealOfSet theorem idealOfSet_closed [T2Space R] (s : Set X) : IsClosed (idealOfSet R s : Set C(X, R)) := by simp only [idealOfSet, Submodule.coe_set_mk, Set.setOf_forall] exact isClosed_iInter fun x => isClosed_iInter fun _ => isClosed_eq (continuous_eval_const x) continuous_const #align continuous_map.ideal_of_set_closed ContinuousMap.idealOfSet_closed variable {R}
Mathlib/Topology/ContinuousFunction/Ideals.lean
103
105
theorem mem_idealOfSet {s : Set X} {f : C(X, R)} : f ∈ idealOfSet R s ↔ ∀ ⦃x : X⦄, x ∈ sᶜ → f x = 0 := by
convert Iff.rfl
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
Mathlib/Data/Real/Cardinality.lean
78
79
theorem cantorFunctionAux_eq (h : f n = g n) : cantorFunctionAux c f n = cantorFunctionAux c g n := by
simp [cantorFunctionAux, h]
1
import Mathlib.Data.Set.Lattice #align_import data.set.intervals.disjoint from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" universe u v w variable {ι : Sort u} {α : Type v} {β : Type w} open Set open OrderDual (toDual) namespace Set section LinearOrder variable [LinearOrder α] {a₁ a₂ b₁ b₂ : α} @[simp] theorem Ico_disjoint_Ico : Disjoint (Ico a₁ a₂) (Ico b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by simp_rw [Set.disjoint_iff_inter_eq_empty, Ico_inter_Ico, Ico_eq_empty_iff, inf_eq_min, sup_eq_max, not_lt] #align set.Ico_disjoint_Ico Set.Ico_disjoint_Ico @[simp] theorem Ioc_disjoint_Ioc : Disjoint (Ioc a₁ a₂) (Ioc b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by have h : _ ↔ min (toDual a₁) (toDual b₁) ≤ max (toDual a₂) (toDual b₂) := Ico_disjoint_Ico simpa only [dual_Ico] using h #align set.Ioc_disjoint_Ioc Set.Ioc_disjoint_Ioc @[simp] theorem Ioo_disjoint_Ioo [DenselyOrdered α] : Disjoint (Set.Ioo a₁ a₂) (Set.Ioo b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by simp_rw [Set.disjoint_iff_inter_eq_empty, Ioo_inter_Ioo, Ioo_eq_empty_iff, inf_eq_min, sup_eq_max, not_lt] theorem eq_of_Ico_disjoint {x₁ x₂ y₁ y₂ : α} (h : Disjoint (Ico x₁ x₂) (Ico y₁ y₂)) (hx : x₁ < x₂) (h2 : x₂ ∈ Ico y₁ y₂) : y₁ = x₂ := by rw [Ico_disjoint_Ico, min_eq_left (le_of_lt h2.2), le_max_iff] at h apply le_antisymm h2.1 exact h.elim (fun h => absurd hx (not_lt_of_le h)) id #align set.eq_of_Ico_disjoint Set.eq_of_Ico_disjoint @[simp]
Mathlib/Order/Interval/Set/Disjoint.lean
170
172
theorem iUnion_Ico_eq_Iio_self_iff {f : ι → α} {a : α} : ⋃ i, Ico (f i) a = Iio a ↔ ∀ x < a, ∃ i, f i ≤ x := by
simp [← Ici_inter_Iio, ← iUnion_inter, subset_def]
1
import Mathlib.Algebra.Quotient import Mathlib.Algebra.Group.Subgroup.Actions import Mathlib.Algebra.Group.Subgroup.MulOpposite import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.SetTheory.Cardinal.Finite #align_import group_theory.coset from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open Function MulOpposite Set open scoped Pointwise variable {α : Type*} #align left_coset HSMul.hSMul #align left_add_coset HVAdd.hVAdd #noalign right_coset #noalign right_add_coset section CosetSemigroup variable [Semigroup α] @[to_additive leftAddCoset_assoc]
Mathlib/GroupTheory/Coset.lean
105
106
theorem leftCoset_assoc (s : Set α) (a b : α) : a • (b • s) = (a * b) • s := by
simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc]
1
import Mathlib.Topology.Order.IsLUB open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) variable {α β γ : Type*} section ConditionallyCompleteLinearOrder variable [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderClosedTopology β] [Nonempty γ] theorem csSup_mem_closure {s : Set α} (hs : s.Nonempty) (B : BddAbove s) : sSup s ∈ closure s := (isLUB_csSup hs B).mem_closure hs #align cSup_mem_closure csSup_mem_closure theorem csInf_mem_closure {s : Set α} (hs : s.Nonempty) (B : BddBelow s) : sInf s ∈ closure s := (isGLB_csInf hs B).mem_closure hs #align cInf_mem_closure csInf_mem_closure theorem IsClosed.csSup_mem {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddAbove s) : sSup s ∈ s := (isLUB_csSup hs B).mem_of_isClosed hs hc #align is_closed.cSup_mem IsClosed.csSup_mem theorem IsClosed.csInf_mem {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddBelow s) : sInf s ∈ s := (isGLB_csInf hs B).mem_of_isClosed hs hc #align is_closed.cInf_mem IsClosed.csInf_mem theorem IsClosed.isLeast_csInf {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddBelow s) : IsLeast s (sInf s) := ⟨hc.csInf_mem hs B, (isGLB_csInf hs B).1⟩ theorem IsClosed.isGreatest_csSup {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddAbove s) : IsGreatest s (sSup s) := IsClosed.isLeast_csInf (α := αᵒᵈ) hc hs B theorem Monotone.map_csSup_of_continuousAt {f : α → β} {s : Set α} (Cf : ContinuousAt f (sSup s)) (Mf : Monotone f) (ne : s.Nonempty) (H : BddAbove s) : f (sSup s) = sSup (f '' s) := by refine ((isLUB_csSup (ne.image f) (Mf.map_bddAbove H)).unique ?_).symm refine (isLUB_csSup ne H).isLUB_of_tendsto (fun x _ y _ xy => Mf xy) ne ?_ exact Cf.mono_left inf_le_left #align monotone.map_cSup_of_continuous_at Monotone.map_csSup_of_continuousAt
Mathlib/Topology/Order/Monotone.lean
230
232
theorem Monotone.map_ciSup_of_continuousAt {f : α → β} {g : γ → α} (Cf : ContinuousAt f (⨆ i, g i)) (Mf : Monotone f) (H : BddAbove (range g)) : f (⨆ i, g i) = ⨆ i, f (g i) := by
rw [iSup, Mf.map_csSup_of_continuousAt Cf (range_nonempty _) H, ← range_comp, iSup]; rfl
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 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 #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : ℕ) : m ≤ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : ℕ) : m ≤ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : ℕ) : n ≤ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left'
Mathlib/Data/Nat/Dist.lean
63
63
theorem dist_tri_right' (n m : ℕ) : n ≤ m + dist n m := by
rw [dist_comm]; apply dist_tri_right
1
import Mathlib.Combinatorics.SimpleGraph.Connectivity import Mathlib.Data.Nat.Lattice #align_import combinatorics.simple_graph.metric from "leanprover-community/mathlib"@"352ecfe114946c903338006dd3287cb5a9955ff2" namespace SimpleGraph variable {V : Type*} (G : SimpleGraph V) noncomputable def dist (u v : V) : ℕ := sInf (Set.range (Walk.length : G.Walk u v → ℕ)) #align simple_graph.dist SimpleGraph.dist variable {G} protected theorem Reachable.exists_walk_of_dist {u v : V} (hr : G.Reachable u v) : ∃ p : G.Walk u v, p.length = G.dist u v := Nat.sInf_mem (Set.range_nonempty_iff_nonempty.mpr hr) #align simple_graph.reachable.exists_walk_of_dist SimpleGraph.Reachable.exists_walk_of_dist protected theorem Connected.exists_walk_of_dist (hconn : G.Connected) (u v : V) : ∃ p : G.Walk u v, p.length = G.dist u v := (hconn u v).exists_walk_of_dist #align simple_graph.connected.exists_walk_of_dist SimpleGraph.Connected.exists_walk_of_dist theorem dist_le {u v : V} (p : G.Walk u v) : G.dist u v ≤ p.length := Nat.sInf_le ⟨p, rfl⟩ #align simple_graph.dist_le SimpleGraph.dist_le @[simp] theorem dist_eq_zero_iff_eq_or_not_reachable {u v : V} : G.dist u v = 0 ↔ u = v ∨ ¬G.Reachable u v := by simp [dist, Nat.sInf_eq_zero, Reachable] #align simple_graph.dist_eq_zero_iff_eq_or_not_reachable SimpleGraph.dist_eq_zero_iff_eq_or_not_reachable
Mathlib/Combinatorics/SimpleGraph/Metric.lean
74
74
theorem dist_self {v : V} : dist G v v = 0 := by
simp
1
import Mathlib.Order.Filter.Prod #align_import order.filter.n_ary from "leanprover-community/mathlib"@"78f647f8517f021d839a7553d5dc97e79b508dea" open Function Set open Filter namespace Filter variable {α α' β β' γ γ' δ δ' ε ε' : Type*} {m : α → β → γ} {f f₁ f₂ : Filter α} {g g₁ g₂ : Filter β} {h h₁ h₂ : Filter γ} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {u : Set γ} {v : Set δ} {a : α} {b : β} {c : γ} def map₂ (m : α → β → γ) (f : Filter α) (g : Filter β) : Filter γ := ((f ×ˢ g).map (uncurry m)).copy { s | ∃ u ∈ f, ∃ v ∈ g, image2 m u v ⊆ s } fun _ ↦ by simp only [mem_map, mem_prod_iff, image2_subset_iff, prod_subset_iff]; rfl #align filter.map₂ Filter.map₂ @[simp 900] theorem mem_map₂_iff : u ∈ map₂ m f g ↔ ∃ s ∈ f, ∃ t ∈ g, image2 m s t ⊆ u := Iff.rfl #align filter.mem_map₂_iff Filter.mem_map₂_iff theorem image2_mem_map₂ (hs : s ∈ f) (ht : t ∈ g) : image2 m s t ∈ map₂ m f g := ⟨_, hs, _, ht, Subset.rfl⟩ #align filter.image2_mem_map₂ Filter.image2_mem_map₂ theorem map_prod_eq_map₂ (m : α → β → γ) (f : Filter α) (g : Filter β) : Filter.map (fun p : α × β => m p.1 p.2) (f ×ˢ g) = map₂ m f g := by rw [map₂, copy_eq, uncurry_def] #align filter.map_prod_eq_map₂ Filter.map_prod_eq_map₂ theorem map_prod_eq_map₂' (m : α × β → γ) (f : Filter α) (g : Filter β) : Filter.map m (f ×ˢ g) = map₂ (fun a b => m (a, b)) f g := map_prod_eq_map₂ (curry m) f g #align filter.map_prod_eq_map₂' Filter.map_prod_eq_map₂' @[simp]
Mathlib/Order/Filter/NAry.lean
64
65
theorem map₂_mk_eq_prod (f : Filter α) (g : Filter β) : map₂ Prod.mk f g = f ×ˢ g := by
simp only [← map_prod_eq_map₂, map_id']
1
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def χ₄ : MulChar (ZMod 4) ℤ where toFun := (![0, 1, 0, -1] : ZMod 4 → ℤ) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.χ₄ ZMod.χ₄ theorem isQuadratic_χ₄ : χ₄.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_χ₄ ZMod.isQuadratic_χ₄
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
56
56
theorem χ₄_nat_mod_four (n : ℕ) : χ₄ n = χ₄ (n % 4 : ℕ) := by
rw [← ZMod.natCast_mod n 4]
1
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.SesquilinearForm import Mathlib.LinearAlgebra.Matrix.Symmetric #align_import linear_algebra.quadratic_form.basic from "leanprover-community/mathlib"@"d11f435d4e34a6cea0a1797d6b625b0c170be845" universe u v w variable {S T : Type*} variable {R : Type*} {M N : Type*} open LinearMap (BilinForm) section Polar variable [CommRing R] [AddCommGroup M] namespace QuadraticForm def polar (f : M → R) (x y : M) := f (x + y) - f x - f y #align quadratic_form.polar QuadraticForm.polar theorem polar_add (f g : M → R) (x y : M) : polar (f + g) x y = polar f x y + polar g x y := by simp only [polar, Pi.add_apply] abel #align quadratic_form.polar_add QuadraticForm.polar_add theorem polar_neg (f : M → R) (x y : M) : polar (-f) x y = -polar f x y := by simp only [polar, Pi.neg_apply, sub_eq_add_neg, neg_add] #align quadratic_form.polar_neg QuadraticForm.polar_neg theorem polar_smul [Monoid S] [DistribMulAction S R] (f : M → R) (s : S) (x y : M) : polar (s • f) x y = s • polar f x y := by simp only [polar, Pi.smul_apply, smul_sub] #align quadratic_form.polar_smul QuadraticForm.polar_smul
Mathlib/LinearAlgebra/QuadraticForm/Basic.lean
111
112
theorem polar_comm (f : M → R) (x y : M) : polar f x y = polar f y x := by
rw [polar, polar, add_comm, sub_sub, sub_sub, add_comm (f x) (f y)]
1
import Mathlib.Algebra.Field.Defs import Mathlib.Algebra.GroupWithZero.Units.Lemmas import Mathlib.Algebra.Ring.Commute import Mathlib.Algebra.Ring.Invertible import Mathlib.Order.Synonym #align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102" open Function OrderDual Set universe u variable {α β K : Type*} section DivisionSemiring variable [DivisionSemiring α] {a b c d : α} theorem add_div (a b c : α) : (a + b) / c = a / c + b / c := by simp_rw [div_eq_mul_inv, add_mul] #align add_div add_div @[field_simps] theorem div_add_div_same (a b c : α) : a / c + b / c = (a + b) / c := (add_div _ _ _).symm #align div_add_div_same div_add_div_same
Mathlib/Algebra/Field/Basic.lean
37
37
theorem same_add_div (h : b ≠ 0) : (b + a) / b = 1 + a / b := by
rw [← div_self h, add_div]
1
import Mathlib.Data.Countable.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Order.Disjointed import Mathlib.MeasureTheory.OuterMeasure.Defs #align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set Function Filter open scoped Classical NNReal Topology ENNReal namespace MeasureTheory section OuterMeasureClass variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α] {μ : F} {s t : Set α} @[simp] theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ #align measure_theory.measure_empty MeasureTheory.measure_empty @[mono, gcongr] theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t := OuterMeasureClass.measure_mono μ h #align measure_theory.measure_mono MeasureTheory.measure_mono theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 := eq_bot_mono (measure_mono h) ht #align measure_theory.measure_mono_null MeasureTheory.measure_mono_null theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t := hs.bot_lt.trans_le (measure_mono h) theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _ calc μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed] _ ≤ ∑' i, μ (disjointed t i) := OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _) _ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset #align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) : μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by have := hI.to_subtype rw [biUnion_eq_iUnion] apply measure_iUnion_le #align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le theorem measure_biUnion_finset_le (I : Finset ι) (s : ι → Set α) : μ (⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ (s i) := (measure_biUnion_le μ I.countable_toSet s).trans_eq <| I.tsum_subtype (μ <| s ·) #align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le theorem measure_iUnion_fintype_le [Fintype ι] (μ : F) (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑ i, μ (s i) := by simpa using measure_biUnion_finset_le Finset.univ s #align measure_theory.measure_Union_fintype_le MeasureTheory.measure_iUnion_fintype_le theorem measure_union_le (s t : Set α) : μ (s ∪ t) ≤ μ s + μ t := by simpa [union_eq_iUnion] using measure_iUnion_fintype_le μ (cond · s t) #align measure_theory.measure_union_le MeasureTheory.measure_union_le theorem measure_le_inter_add_diff (μ : F) (s t : Set α) : μ s ≤ μ (s ∩ t) + μ (s \ t) := by simpa using measure_union_le (s ∩ t) (s \ t) theorem measure_diff_null (ht : μ t = 0) : μ (s \ t) = μ s := (measure_mono diff_subset).antisymm <| calc μ s ≤ μ (s ∩ t) + μ (s \ t) := measure_le_inter_add_diff _ _ _ _ ≤ μ t + μ (s \ t) := by gcongr; apply inter_subset_right _ = μ (s \ t) := by simp [ht] #align measure_theory.measure_diff_null MeasureTheory.measure_diff_null theorem measure_biUnion_null_iff {I : Set ι} (hI : I.Countable) {s : ι → Set α} : μ (⋃ i ∈ I, s i) = 0 ↔ ∀ i ∈ I, μ (s i) = 0 := by refine ⟨fun h i hi ↦ measure_mono_null (subset_biUnion_of_mem hi) h, fun h ↦ ?_⟩ have _ := hI.to_subtype simpa [h] using measure_iUnion_le (μ := μ) fun x : I ↦ s x #align measure_theory.measure_bUnion_null_iff MeasureTheory.measure_biUnion_null_iff theorem measure_sUnion_null_iff {S : Set (Set α)} (hS : S.Countable) : μ (⋃₀ S) = 0 ↔ ∀ s ∈ S, μ s = 0 := by rw [sUnion_eq_biUnion, measure_biUnion_null_iff hS] #align measure_theory.measure_sUnion_null_iff MeasureTheory.measure_sUnion_null_iff @[simp]
Mathlib/MeasureTheory/OuterMeasure/Basic.lean
116
118
theorem measure_iUnion_null_iff {ι : Sort*} [Countable ι] {s : ι → Set α} : μ (⋃ i, s i) = 0 ↔ ∀ i, μ (s i) = 0 := by
rw [← sUnion_range, measure_sUnion_null_iff (countable_range s), forall_mem_range]
1
import Mathlib.AlgebraicGeometry.AffineScheme import Mathlib.AlgebraicGeometry.Pullbacks import Mathlib.CategoryTheory.MorphismProperty.Limits import Mathlib.Data.List.TFAE #align_import algebraic_geometry.morphisms.basic from "leanprover-community/mathlib"@"434e2fd21c1900747afc6d13d8be7f4eedba7218" set_option linter.uppercaseLean3 false universe u open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite noncomputable section namespace AlgebraicGeometry def AffineTargetMorphismProperty := ∀ ⦃X Y : Scheme⦄ (_ : X ⟶ Y) [IsAffine Y], Prop #align algebraic_geometry.affine_target_morphism_property AlgebraicGeometry.AffineTargetMorphismProperty protected def Scheme.isIso : MorphismProperty Scheme := @IsIso Scheme _ #align algebraic_geometry.Scheme.is_iso AlgebraicGeometry.Scheme.isIso protected def Scheme.affineTargetIsIso : AffineTargetMorphismProperty := fun _ _ f _ => IsIso f #align algebraic_geometry.Scheme.affine_target_is_iso AlgebraicGeometry.Scheme.affineTargetIsIso instance : Inhabited AffineTargetMorphismProperty := ⟨Scheme.affineTargetIsIso⟩ def AffineTargetMorphismProperty.toProperty (P : AffineTargetMorphismProperty) : MorphismProperty Scheme := fun _ _ f => ∃ h, @P _ _ f h #align algebraic_geometry.affine_target_morphism_property.to_property AlgebraicGeometry.AffineTargetMorphismProperty.toProperty
Mathlib/AlgebraicGeometry/Morphisms/Basic.lean
94
96
theorem AffineTargetMorphismProperty.toProperty_apply (P : AffineTargetMorphismProperty) {X Y : Scheme} (f : X ⟶ Y) [i : IsAffine Y] : P.toProperty f ↔ P f := by
delta AffineTargetMorphismProperty.toProperty; simp [*]
1
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed import Mathlib.RingTheory.PowerBasis #align_import ring_theory.is_adjoin_root from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open scoped Polynomial open Polynomial noncomputable section universe u v -- Porting note: this looks like something that should not be here -- -- This class doesn't really make sense on a predicate -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure IsAdjoinRoot {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S] (f : R[X]) : Type max u v where map : R[X] →+* S map_surjective : Function.Surjective map ker_map : RingHom.ker map = Ideal.span {f} algebraMap_eq : algebraMap R S = map.comp Polynomial.C #align is_adjoin_root IsAdjoinRoot -- This class doesn't really make sense on a predicate -- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet. structure IsAdjoinRootMonic {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S] (f : R[X]) extends IsAdjoinRoot S f where Monic : Monic f #align is_adjoin_root_monic IsAdjoinRootMonic section Ring variable {R : Type u} {S : Type v} [CommRing R] [Ring S] {f : R[X]} [Algebra R S] namespace IsAdjoinRoot def root (h : IsAdjoinRoot S f) : S := h.map X #align is_adjoin_root.root IsAdjoinRoot.root theorem subsingleton (h : IsAdjoinRoot S f) [Subsingleton R] : Subsingleton S := h.map_surjective.subsingleton #align is_adjoin_root.subsingleton IsAdjoinRoot.subsingleton theorem algebraMap_apply (h : IsAdjoinRoot S f) (x : R) : algebraMap R S x = h.map (Polynomial.C x) := by rw [h.algebraMap_eq, RingHom.comp_apply] #align is_adjoin_root.algebra_map_apply IsAdjoinRoot.algebraMap_apply @[simp] theorem mem_ker_map (h : IsAdjoinRoot S f) {p} : p ∈ RingHom.ker h.map ↔ f ∣ p := by rw [h.ker_map, Ideal.mem_span_singleton] #align is_adjoin_root.mem_ker_map IsAdjoinRoot.mem_ker_map theorem map_eq_zero_iff (h : IsAdjoinRoot S f) {p} : h.map p = 0 ↔ f ∣ p := by rw [← h.mem_ker_map, RingHom.mem_ker] #align is_adjoin_root.map_eq_zero_iff IsAdjoinRoot.map_eq_zero_iff @[simp] theorem map_X (h : IsAdjoinRoot S f) : h.map X = h.root := rfl set_option linter.uppercaseLean3 false in #align is_adjoin_root.map_X IsAdjoinRoot.map_X @[simp] theorem map_self (h : IsAdjoinRoot S f) : h.map f = 0 := h.map_eq_zero_iff.mpr dvd_rfl #align is_adjoin_root.map_self IsAdjoinRoot.map_self @[simp] theorem aeval_eq (h : IsAdjoinRoot S f) (p : R[X]) : aeval h.root p = h.map p := Polynomial.induction_on p (fun x => by rw [aeval_C, h.algebraMap_apply]) (fun p q ihp ihq => by rw [AlgHom.map_add, RingHom.map_add, ihp, ihq]) fun n x _ => by rw [AlgHom.map_mul, aeval_C, AlgHom.map_pow, aeval_X, RingHom.map_mul, ← h.algebraMap_apply, RingHom.map_pow, map_X] #align is_adjoin_root.aeval_eq IsAdjoinRoot.aeval_eq -- @[simp] -- Porting note (#10618): simp can prove this theorem aeval_root (h : IsAdjoinRoot S f) : aeval h.root f = 0 := by rw [aeval_eq, map_self] #align is_adjoin_root.aeval_root IsAdjoinRoot.aeval_root def repr (h : IsAdjoinRoot S f) (x : S) : R[X] := (h.map_surjective x).choose #align is_adjoin_root.repr IsAdjoinRoot.repr theorem map_repr (h : IsAdjoinRoot S f) (x : S) : h.map (h.repr x) = x := (h.map_surjective x).choose_spec #align is_adjoin_root.map_repr IsAdjoinRoot.map_repr
Mathlib/RingTheory/IsAdjoinRoot.lean
174
175
theorem repr_zero_mem_span (h : IsAdjoinRoot S f) : h.repr 0 ∈ Ideal.span ({f} : Set R[X]) := by
rw [← h.ker_map, RingHom.mem_ker, h.map_repr]
1
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Tactic.NthRewrite #align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" namespace Nat theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) : d = a.gcd b := (dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm #align nat.gcd_greatest Nat.gcd_greatest @[simp] theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by simp [gcd_rec m (n + k * m), gcd_rec m n] #align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right @[simp] theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by simp [gcd_rec m (n + m * k), gcd_rec m n] #align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right @[simp] theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right @[simp] theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right @[simp] theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by rw [gcd_comm, gcd_add_mul_right_right, gcd_comm] #align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left @[simp] theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by rw [gcd_comm, gcd_add_mul_left_right, gcd_comm] #align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left @[simp] theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by rw [gcd_comm, gcd_mul_right_add_right, gcd_comm] #align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left @[simp] theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by rw [gcd_comm, gcd_mul_left_add_right, gcd_comm] #align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left @[simp] theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n := Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1) #align nat.gcd_add_self_right Nat.gcd_add_self_right @[simp]
Mathlib/Data/Nat/GCD/Basic.lean
80
81
theorem gcd_add_self_left (m n : ℕ) : gcd (m + n) n = gcd m n := by
rw [gcd_comm, gcd_add_self_right, gcd_comm]
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)] theorem p_comp {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f := by rw [f.comm, ← assoc, P.idem] #align category_theory.idempotents.karoubi.p_comp CategoryTheory.Idempotents.Karoubi.p_comp @[reassoc (attr := simp)] theorem comp_p {P Q : Karoubi C} (f : Hom P Q) : f.f ≫ Q.p = f.f := by rw [f.comm, assoc, assoc, Q.idem] #align category_theory.idempotents.karoubi.comp_p CategoryTheory.Idempotents.Karoubi.comp_p @[reassoc] theorem p_comm {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f ≫ Q.p := by rw [p_comp, comp_p] #align category_theory.idempotents.karoubi.p_comm CategoryTheory.Idempotents.Karoubi.p_comm theorem comp_proof {P Q R : Karoubi C} (g : Hom Q R) (f : Hom P Q) : f.f ≫ g.f = P.p ≫ (f.f ≫ g.f) ≫ R.p := by rw [assoc, comp_p, ← assoc, p_comp] #align category_theory.idempotents.karoubi.comp_proof CategoryTheory.Idempotents.Karoubi.comp_proof instance : Category (Karoubi C) where Hom := Karoubi.Hom id P := ⟨P.p, by repeat' rw [P.idem]⟩ comp f g := ⟨f.f ≫ g.f, Karoubi.comp_proof g f⟩ @[simp] theorem hom_ext_iff {P Q : Karoubi C} {f g : P ⟶ Q} : f = g ↔ f.f = g.f := by constructor · intro h rw [h] · apply Hom.ext #align category_theory.idempotents.karoubi.hom_ext CategoryTheory.Idempotents.Karoubi.hom_ext_iff -- Porting note: added because `Hom.ext` is not triggered automatically @[ext]
Mathlib/CategoryTheory/Idempotents/Karoubi.lean
117
118
theorem hom_ext {P Q : Karoubi C} (f g : P ⟶ Q) (h : f.f = g.f) : f = g := by
simpa [hom_ext_iff] using h
1
import Mathlib.Data.List.Join #align_import data.list.permutation from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734" -- Make sure we don't import algebra assert_not_exists Monoid open Nat variable {α β : Type*} namespace List theorem permutationsAux2_fst (t : α) (ts : List α) (r : List β) : ∀ (ys : List α) (f : List α → β), (permutationsAux2 t ts r ys f).1 = ys ++ ts | [], f => rfl | y :: ys, f => by simp [permutationsAux2, permutationsAux2_fst t _ _ ys] #align list.permutations_aux2_fst List.permutationsAux2_fst @[simp] theorem permutationsAux2_snd_nil (t : α) (ts : List α) (r : List β) (f : List α → β) : (permutationsAux2 t ts r [] f).2 = r := rfl #align list.permutations_aux2_snd_nil List.permutationsAux2_snd_nil @[simp] theorem permutationsAux2_snd_cons (t : α) (ts : List α) (r : List β) (y : α) (ys : List α) (f : List α → β) : (permutationsAux2 t ts r (y :: ys) f).2 = f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x : List α => f (y :: x)).2 := by simp [permutationsAux2, permutationsAux2_fst t _ _ ys] #align list.permutations_aux2_snd_cons List.permutationsAux2_snd_cons theorem permutationsAux2_append (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) : (permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by induction ys generalizing f <;> simp [*] #align list.permutations_aux2_append List.permutationsAux2_append theorem permutationsAux2_comp_append {t : α} {ts ys : List α} {r : List β} (f : List α → β) : ((permutationsAux2 t [] r ys) fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r ys f).2 := by induction' ys with ys_hd _ ys_ih generalizing f · simp · simp [ys_ih fun xs => f (ys_hd :: xs)] #align list.permutations_aux2_comp_append List.permutationsAux2_comp_append theorem map_permutationsAux2' {α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α) (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) : map g' (permutationsAux2 t ts r ys f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by induction' ys with ys_hd _ ys_ih generalizing f f' · simp · simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq] rw [ys_ih, permutationsAux2_fst] · refine ⟨?_, rfl⟩ simp only [← map_cons, ← map_append]; apply H · intro a; apply H #align list.map_permutations_aux2' List.map_permutationsAux2' theorem map_permutationsAux2 (t : α) (ts : List α) (ys : List α) (f : List α → β) : (permutationsAux2 t ts [] ys id).2.map f = (permutationsAux2 t ts [] ys f).2 := by rw [map_permutationsAux2' id, map_id, map_id] · rfl simp #align list.map_permutations_aux2 List.map_permutationsAux2
Mathlib/Data/List/Permutation.lean
121
124
theorem permutationsAux2_snd_eq (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) : (permutationsAux2 t ts r ys f).2 = ((permutationsAux2 t [] [] ys id).2.map fun x => f (x ++ ts)) ++ r := by
rw [← permutationsAux2_append, map_permutationsAux2, permutationsAux2_comp_append]
1
import Mathlib.Algebra.ContinuedFractions.Basic import Mathlib.Algebra.GroupWithZero.Basic #align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction section General variable {α : Type*} {g : GeneralizedContinuedFraction α} {n : ℕ} theorem terminatedAt_iff_s_terminatedAt : g.TerminatedAt n ↔ g.s.TerminatedAt n := by rfl #align generalized_continued_fraction.terminated_at_iff_s_terminated_at GeneralizedContinuedFraction.terminatedAt_iff_s_terminatedAt theorem terminatedAt_iff_s_none : g.TerminatedAt n ↔ g.s.get? n = none := by rfl #align generalized_continued_fraction.terminated_at_iff_s_none GeneralizedContinuedFraction.terminatedAt_iff_s_none theorem part_num_none_iff_s_none : g.partialNumerators.get? n = none ↔ g.s.get? n = none := by cases s_nth_eq : g.s.get? n <;> simp [partialNumerators, s_nth_eq] #align generalized_continued_fraction.part_num_none_iff_s_none GeneralizedContinuedFraction.part_num_none_iff_s_none theorem terminatedAt_iff_part_num_none : g.TerminatedAt n ↔ g.partialNumerators.get? n = none := by rw [terminatedAt_iff_s_none, part_num_none_iff_s_none] #align generalized_continued_fraction.terminated_at_iff_part_num_none GeneralizedContinuedFraction.terminatedAt_iff_part_num_none
Mathlib/Algebra/ContinuedFractions/Translations.lean
49
50
theorem part_denom_none_iff_s_none : g.partialDenominators.get? n = none ↔ g.s.get? n = none := by
cases s_nth_eq : g.s.get? n <;> simp [partialDenominators, s_nth_eq]
1
import Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing import Mathlib.AlgebraicGeometry.OpenImmersion #align_import algebraic_geometry.gluing from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false noncomputable section universe u open TopologicalSpace CategoryTheory Opposite open CategoryTheory.Limits AlgebraicGeometry.PresheafedSpace open CategoryTheory.GlueData namespace AlgebraicGeometry namespace Scheme -- Porting note(#5171): @[nolint has_nonempty_instance]; linter not ported yet structure GlueData extends CategoryTheory.GlueData Scheme where f_open : ∀ i j, IsOpenImmersion (f i j) #align algebraic_geometry.Scheme.glue_data AlgebraicGeometry.Scheme.GlueData attribute [instance] GlueData.f_open namespace OpenCover variable {X : Scheme.{u}} (𝒰 : OpenCover.{u} X) def gluedCoverT' (x y z : 𝒰.J) : pullback (pullback.fst : pullback (𝒰.map x) (𝒰.map y) ⟶ _) (pullback.fst : pullback (𝒰.map x) (𝒰.map z) ⟶ _) ⟶ pullback (pullback.fst : pullback (𝒰.map y) (𝒰.map z) ⟶ _) (pullback.fst : pullback (𝒰.map y) (𝒰.map x) ⟶ _) := by refine (pullbackRightPullbackFstIso _ _ _).hom ≫ ?_ refine ?_ ≫ (pullbackSymmetry _ _).hom refine ?_ ≫ (pullbackRightPullbackFstIso _ _ _).inv refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (𝟙 _) (𝟙 _) ?_ ?_ · simp [pullback.condition] · simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t' AlgebraicGeometry.Scheme.OpenCover.gluedCoverT' @[simp, reassoc] theorem gluedCoverT'_fst_fst (x y z : 𝒰.J) : 𝒰.gluedCoverT' x y z ≫ pullback.fst ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_fst @[simp, reassoc]
Mathlib/AlgebraicGeometry/Gluing.lean
302
304
theorem gluedCoverT'_fst_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.fst ≫ pullback.snd = pullback.snd ≫ pullback.snd := by
delta gluedCoverT'; simp
1
import Mathlib.Probability.ConditionalProbability import Mathlib.MeasureTheory.Measure.Count #align_import probability.cond_count from "leanprover-community/mathlib"@"117e93f82b5f959f8193857370109935291f0cc4" noncomputable section open ProbabilityTheory open MeasureTheory MeasurableSpace namespace ProbabilityTheory variable {Ω : Type*} [MeasurableSpace Ω] def condCount (s : Set Ω) : Measure Ω := Measure.count[|s] #align probability_theory.cond_count ProbabilityTheory.condCount @[simp]
Mathlib/Probability/CondCount.lean
59
59
theorem condCount_empty_meas : (condCount ∅ : Measure Ω) = 0 := by
simp [condCount]
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)]
Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean
115
117
theorem pullbackIsoProdSubtype_inv_snd (f : X ⟶ Z) (g : Y ⟶ Z) : (pullbackIsoProdSubtype f g).inv ≫ pullback.snd = pullbackSnd f g := by
simp [pullbackCone, pullbackIsoProdSubtype]
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] theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo, ← map_valEmbedding_Ioo, card_map] #align fin.card_Ioo Fin.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := by rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map] #align fin.card_uIcc Fin.card_uIcc -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by rw [← card_Icc, Fintype.card_ofFinset] #align fin.card_fintype_Icc Fin.card_fintypeIcc -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by rw [← card_Ico, Fintype.card_ofFinset] #align fin.card_fintype_Ico Fin.card_fintypeIco -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by rw [← card_Ioc, Fintype.card_ofFinset] #align fin.card_fintype_Ioc Fin.card_fintypeIoc -- Porting note (#10618): simp can prove this -- @[simp]
Mathlib/Order/Interval/Finset/Fin.lean
148
149
theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by
rw [← card_Ioo, Fintype.card_ofFinset]
1
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} #align list.length_enum_from List.enumFrom_length #align list.length_enum List.enum_length @[simp] theorem get?_enumFrom : ∀ n (l : List α) m, get? (enumFrom n l) m = (get? l m).map fun a => (n + m, a) | n, [], m => rfl | n, a :: l, 0 => rfl | n, a :: l, m + 1 => (get?_enumFrom (n + 1) l m).trans <| by rw [Nat.add_right_comm]; rfl #align list.enum_from_nth List.get?_enumFrom @[deprecated (since := "2024-04-06")] alias enumFrom_get? := get?_enumFrom @[simp] theorem get?_enum (l : List α) (n) : get? (enum l) n = (get? l n).map fun a => (n, a) := by rw [enum, get?_enumFrom, Nat.zero_add] #align list.enum_nth List.get?_enum @[deprecated (since := "2024-04-06")] alias enum_get? := get?_enum @[simp] theorem enumFrom_map_snd : ∀ (n) (l : List α), map Prod.snd (enumFrom n l) = l | _, [] => rfl | _, _ :: _ => congr_arg (cons _) (enumFrom_map_snd _ _) #align list.enum_from_map_snd List.enumFrom_map_snd @[simp] theorem enum_map_snd (l : List α) : map Prod.snd (enum l) = l := enumFrom_map_snd _ _ #align list.enum_map_snd List.enum_map_snd @[simp]
Mathlib/Data/List/Enum.lean
48
50
theorem get_enumFrom (l : List α) (n) (i : Fin (l.enumFrom n).length) : (l.enumFrom n).get i = (n + i, l.get (i.cast enumFrom_length)) := by
simp [get_eq_get?]
1
import Mathlib.Order.Filter.Lift import Mathlib.Order.Filter.AtTopBot #align_import order.filter.small_sets from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" open Filter open Filter Set variable {α β : Type*} {ι : Sort*} namespace Filter variable {l l' la : Filter α} {lb : Filter β} def smallSets (l : Filter α) : Filter (Set α) := l.lift' powerset #align filter.small_sets Filter.smallSets theorem smallSets_eq_generate {f : Filter α} : f.smallSets = generate (powerset '' f.sets) := by simp_rw [generate_eq_biInf, smallSets, iInf_image] rfl #align filter.small_sets_eq_generate Filter.smallSets_eq_generate -- TODO: get more properties from the adjunction? -- TODO: is there a general way to get a lower adjoint for the lift of an upper adjoint? theorem bind_smallSets_gc : GaloisConnection (fun L : Filter (Set α) ↦ L.bind principal) smallSets := by intro L l simp_rw [smallSets_eq_generate, le_generate_iff, image_subset_iff] rfl protected theorem HasBasis.smallSets {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis l.smallSets p fun i => 𝒫 s i := h.lift' monotone_powerset #align filter.has_basis.small_sets Filter.HasBasis.smallSets theorem hasBasis_smallSets (l : Filter α) : HasBasis l.smallSets (fun t : Set α => t ∈ l) powerset := l.basis_sets.smallSets #align filter.has_basis_small_sets Filter.hasBasis_smallSets theorem tendsto_smallSets_iff {f : α → Set β} : Tendsto f la lb.smallSets ↔ ∀ t ∈ lb, ∀ᶠ x in la, f x ⊆ t := (hasBasis_smallSets lb).tendsto_right_iff #align filter.tendsto_small_sets_iff Filter.tendsto_smallSets_iff theorem eventually_smallSets {p : Set α → Prop} : (∀ᶠ s in l.smallSets, p s) ↔ ∃ s ∈ l, ∀ t, t ⊆ s → p t := eventually_lift'_iff monotone_powerset #align filter.eventually_small_sets Filter.eventually_smallSets theorem eventually_smallSets' {p : Set α → Prop} (hp : ∀ ⦃s t⦄, s ⊆ t → p t → p s) : (∀ᶠ s in l.smallSets, p s) ↔ ∃ s ∈ l, p s := eventually_smallSets.trans <| exists_congr fun s => Iff.rfl.and ⟨fun H => H s Subset.rfl, fun hs _t ht => hp ht hs⟩ #align filter.eventually_small_sets' Filter.eventually_smallSets' theorem frequently_smallSets {p : Set α → Prop} : (∃ᶠ s in l.smallSets, p s) ↔ ∀ t ∈ l, ∃ s, s ⊆ t ∧ p s := l.hasBasis_smallSets.frequently_iff #align filter.frequently_small_sets Filter.frequently_smallSets theorem frequently_smallSets_mem (l : Filter α) : ∃ᶠ s in l.smallSets, s ∈ l := frequently_smallSets.2 fun t ht => ⟨t, Subset.rfl, ht⟩ #align filter.frequently_small_sets_mem Filter.frequently_smallSets_mem @[simp] lemma tendsto_image_smallSets {f : α → β} : Tendsto (f '' ·) la.smallSets lb.smallSets ↔ Tendsto f la lb := by rw [tendsto_smallSets_iff] refine forall₂_congr fun u hu ↦ ?_ rw [eventually_smallSets' fun s t hst ht ↦ (image_subset _ hst).trans ht] simp only [image_subset_iff, exists_mem_subset_iff, mem_map] alias ⟨_, Tendsto.image_smallSets⟩ := tendsto_image_smallSets theorem HasAntitoneBasis.tendsto_smallSets {ι} [Preorder ι] {s : ι → Set α} (hl : l.HasAntitoneBasis s) : Tendsto s atTop l.smallSets := tendsto_smallSets_iff.2 fun _t ht => hl.eventually_subset ht #align filter.has_antitone_basis.tendsto_small_sets Filter.HasAntitoneBasis.tendsto_smallSets @[mono] theorem monotone_smallSets : Monotone (@smallSets α) := monotone_lift' monotone_id monotone_const #align filter.monotone_small_sets Filter.monotone_smallSets @[simp] theorem smallSets_bot : (⊥ : Filter α).smallSets = pure ∅ := by rw [smallSets, lift'_bot, powerset_empty, principal_singleton] exact monotone_powerset #align filter.small_sets_bot Filter.smallSets_bot @[simp]
Mathlib/Order/Filter/SmallSets.lean
116
117
theorem smallSets_top : (⊤ : Filter α).smallSets = ⊤ := by
rw [smallSets, lift'_top, powerset_univ, principal_univ]
1
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.Data.Complex.Orientation import Mathlib.Tactic.LinearCombination #align_import analysis.inner_product_space.two_dim from "leanprover-community/mathlib"@"cd8fafa2fac98e1a67097e8a91ad9901cfde48af" noncomputable section open scoped RealInnerProductSpace ComplexConjugate open FiniteDimensional lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V := .of_fact_finrank_eq_succ 1 attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two @[deprecated (since := "2024-02-02")] alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two := FiniteDimensional.of_fact_finrank_eq_two variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)] (o : Orientation ℝ E (Fin 2)) namespace Orientation irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by let z : E [⋀^Fin 0]→ₗ[ℝ] ℝ ≃ₗ[ℝ] ℝ := AlternatingMap.constLinearEquivOfIsEmpty.symm let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ := LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm #align orientation.area_form Orientation.areaForm local notation "ω" => o.areaForm theorem areaForm_to_volumeForm (x y : E) : ω x y = o.volumeForm ![x, y] := by simp [areaForm] #align orientation.area_form_to_volume_form Orientation.areaForm_to_volumeForm @[simp] theorem areaForm_apply_self (x : E) : ω x x = 0 := by rw [areaForm_to_volumeForm] refine o.volumeForm.map_eq_zero_of_eq ![x, x] ?_ (?_ : (0 : Fin 2) ≠ 1) · simp · norm_num #align orientation.area_form_apply_self Orientation.areaForm_apply_self theorem areaForm_swap (x y : E) : ω x y = -ω y x := by simp only [areaForm_to_volumeForm] convert o.volumeForm.map_swap ![y, x] (_ : (0 : Fin 2) ≠ 1) · ext i fin_cases i <;> rfl · norm_num #align orientation.area_form_swap Orientation.areaForm_swap @[simp] theorem areaForm_neg_orientation : (-o).areaForm = -o.areaForm := by ext x y simp [areaForm_to_volumeForm] #align orientation.area_form_neg_orientation Orientation.areaForm_neg_orientation def areaForm' : E →L[ℝ] E →L[ℝ] ℝ := LinearMap.toContinuousLinearMap (↑(LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ) ∘ₗ o.areaForm) #align orientation.area_form' Orientation.areaForm' @[simp] theorem areaForm'_apply (x : E) : o.areaForm' x = LinearMap.toContinuousLinearMap (o.areaForm x) := rfl #align orientation.area_form'_apply Orientation.areaForm'_apply theorem abs_areaForm_le (x y : E) : |ω x y| ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.abs_volumeForm_apply_le ![x, y] #align orientation.abs_area_form_le Orientation.abs_areaForm_le
Mathlib/Analysis/InnerProductSpace/TwoDim.lean
146
147
theorem areaForm_le (x y : E) : ω x y ≤ ‖x‖ * ‖y‖ := by
simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.volumeForm_apply_le ![x, y]
1
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp] theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs] #align real.logb_abs Real.logb_abs @[simp] theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by rw [← logb_abs x, ← logb_abs (-x), abs_neg] #align real.logb_neg_eq_logb Real.logb_neg_eq_logb theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by simp_rw [logb, log_mul hx hy, add_div] #align real.logb_mul Real.logb_mul theorem logb_div (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x / y) = logb b x - logb b y := by simp_rw [logb, log_div hx hy, sub_div] #align real.logb_div Real.logb_div @[simp] theorem logb_inv (x : ℝ) : logb b x⁻¹ = -logb b x := by simp [logb, neg_div] #align real.logb_inv Real.logb_inv theorem inv_logb (a b : ℝ) : (logb a b)⁻¹ = logb b a := by simp_rw [logb, inv_div] #align real.inv_logb Real.inv_logb
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
87
89
theorem inv_logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a * b) c)⁻¹ = (logb a c)⁻¹ + (logb b c)⁻¹ := by
simp_rw [inv_logb]; exact logb_mul h₁ h₂
1
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} #align list.length_enum_from List.enumFrom_length #align list.length_enum List.enum_length @[simp] theorem get?_enumFrom : ∀ n (l : List α) m, get? (enumFrom n l) m = (get? l m).map fun a => (n + m, a) | n, [], m => rfl | n, a :: l, 0 => rfl | n, a :: l, m + 1 => (get?_enumFrom (n + 1) l m).trans <| by rw [Nat.add_right_comm]; rfl #align list.enum_from_nth List.get?_enumFrom @[deprecated (since := "2024-04-06")] alias enumFrom_get? := get?_enumFrom @[simp]
Mathlib/Data/List/Enum.lean
30
31
theorem get?_enum (l : List α) (n) : get? (enum l) n = (get? l n).map fun a => (n, a) := by
rw [enum, get?_enumFrom, Nat.zero_add]
1
import Mathlib.Init.Control.Combinators import Mathlib.Data.Option.Defs import Mathlib.Logic.IsEmpty import Mathlib.Logic.Relator import Mathlib.Util.CompileInductive import Aesop #align_import data.option.basic from "leanprover-community/mathlib"@"f340f229b1f461aa1c8ee11e0a172d0a3b301a4a" universe u namespace Option variable {α β γ δ : Type*} theorem coe_def : (fun a ↦ ↑a : α → Option α) = some := rfl #align option.coe_def Option.coe_def theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp #align option.mem_map Option.mem_map -- The simpNF linter says that the LHS can be simplified via `Option.mem_def`. -- However this is a higher priority lemma. -- https://github.com/leanprover/std4/issues/207 @[simp 1100, nolint simpNF] theorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {o : Option α} : f a ∈ o.map f ↔ a ∈ o := by aesop
Mathlib/Data/Option/Basic.lean
57
58
theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by
simp
1
import Batteries.Classes.Order namespace Batteries.PairingHeapImp inductive Heap (α : Type u) where | nil : Heap α | node (a : α) (child sibling : Heap α) : Heap α deriving Repr def Heap.size : Heap α → Nat | .nil => 0 | .node _ c s => c.size + 1 + s.size def Heap.singleton (a : α) : Heap α := .node a .nil .nil def Heap.isEmpty : Heap α → Bool | .nil => true | _ => false @[specialize] def Heap.merge (le : α → α → Bool) : Heap α → Heap α → Heap α | .nil, .nil => .nil | .nil, .node a₂ c₂ _ => .node a₂ c₂ .nil | .node a₁ c₁ _, .nil => .node a₁ c₁ .nil | .node a₁ c₁ _, .node a₂ c₂ _ => if le a₁ a₂ then .node a₁ (.node a₂ c₂ c₁) .nil else .node a₂ (.node a₁ c₁ c₂) .nil @[specialize] def Heap.combine (le : α → α → Bool) : Heap α → Heap α | h₁@(.node _ _ h₂@(.node _ _ s)) => merge le (merge le h₁ h₂) (s.combine le) | h => h @[inline] def Heap.headD (a : α) : Heap α → α | .nil => a | .node a _ _ => a @[inline] def Heap.head? : Heap α → Option α | .nil => none | .node a _ _ => some a @[inline] def Heap.deleteMin (le : α → α → Bool) : Heap α → Option (α × Heap α) | .nil => none | .node a c _ => (a, combine le c) @[inline] def Heap.tail? (le : α → α → Bool) (h : Heap α) : Option (Heap α) := deleteMin le h |>.map (·.snd) @[inline] def Heap.tail (le : α → α → Bool) (h : Heap α) : Heap α := tail? le h |>.getD .nil inductive Heap.NoSibling : Heap α → Prop | nil : NoSibling .nil | node (a c) : NoSibling (.node a c .nil) instance : Decidable (Heap.NoSibling s) := match s with | .nil => isTrue .nil | .node a c .nil => isTrue (.node a c) | .node _ _ (.node _ _ _) => isFalse nofun theorem Heap.noSibling_merge (le) (s₁ s₂ : Heap α) : (s₁.merge le s₂).NoSibling := by unfold merge (split <;> try split) <;> constructor theorem Heap.noSibling_combine (le) (s : Heap α) : (s.combine le).NoSibling := by unfold combine; split · exact noSibling_merge _ _ _ · match s with | nil | node _ _ nil => constructor | node _ _ (node _ _ s) => rename_i h; exact (h _ _ _ _ _ rfl).elim theorem Heap.noSibling_deleteMin {s : Heap α} (eq : s.deleteMin le = some (a, s')) : s'.NoSibling := by cases s with cases eq | node a c => exact noSibling_combine _ _ theorem Heap.noSibling_tail? {s : Heap α} : s.tail? le = some s' → s'.NoSibling := by simp only [Heap.tail?]; intro eq match eq₂ : s.deleteMin le, eq with | some (a, tl), rfl => exact noSibling_deleteMin eq₂ theorem Heap.noSibling_tail (le) (s : Heap α) : (s.tail le).NoSibling := by simp only [Heap.tail] match eq : s.tail? le with | none => cases s with cases eq | nil => constructor | some tl => exact Heap.noSibling_tail? eq theorem Heap.size_merge_node (le) (a₁ : α) (c₁ s₁ : Heap α) (a₂ : α) (c₂ s₂ : Heap α) : (merge le (.node a₁ c₁ s₁) (.node a₂ c₂ s₂)).size = c₁.size + c₂.size + 2 := by unfold merge; dsimp; split <;> simp_arith [size] theorem Heap.size_merge (le) {s₁ s₂ : Heap α} (h₁ : s₁.NoSibling) (h₂ : s₂.NoSibling) : (merge le s₁ s₂).size = s₁.size + s₂.size := by match h₁, h₂ with | .nil, .nil | .nil, .node _ _ | .node _ _, .nil => simp [size] | .node _ _, .node _ _ => unfold merge; dsimp; split <;> simp_arith [size] theorem Heap.size_combine (le) (s : Heap α) : (s.combine le).size = s.size := by unfold combine; split · rename_i a₁ c₁ a₂ c₂ s rw [size_merge le (noSibling_merge _ _ _) (noSibling_combine _ _), size_merge_node, size_combine le s] simp_arith [size] · rfl
.lake/packages/batteries/Batteries/Data/PairingHeap.lean
138
140
theorem Heap.size_deleteMin {s : Heap α} (h : s.NoSibling) (eq : s.deleteMin le = some (a, s')) : s.size = s'.size + 1 := by
cases h with cases eq | node a c => rw [size_combine, size, size]
1
import Mathlib.Algebra.DirectSum.Module import Mathlib.Algebra.Module.Submodule.Basic #align_import algebra.direct_sum.decomposition from "leanprover-community/mathlib"@"4e861f25ba5ceef42ba0712d8ffeb32f38ad6441" variable {ι R M σ : Type*} open DirectSum namespace DirectSum section AddCommMonoid variable [DecidableEq ι] [AddCommMonoid M] variable [SetLike σ M] [AddSubmonoidClass σ M] (ℳ : ι → σ) class Decomposition where decompose' : M → ⨁ i, ℳ i left_inv : Function.LeftInverse (DirectSum.coeAddMonoidHom ℳ) decompose' right_inv : Function.RightInverse (DirectSum.coeAddMonoidHom ℳ) decompose' #align direct_sum.decomposition DirectSum.Decomposition instance : Subsingleton (Decomposition ℳ) := ⟨fun x y ↦ by cases' x with x xl xr cases' y with y yl yr congr exact Function.LeftInverse.eq_rightInverse xr yl⟩ abbrev Decomposition.ofAddHom (decompose : M →+ ⨁ i, ℳ i) (h_left_inv : (DirectSum.coeAddMonoidHom ℳ).comp decompose = .id _) (h_right_inv : decompose.comp (DirectSum.coeAddMonoidHom ℳ) = .id _) : Decomposition ℳ where decompose' := decompose left_inv := DFunLike.congr_fun h_left_inv right_inv := DFunLike.congr_fun h_right_inv noncomputable def IsInternal.chooseDecomposition (h : IsInternal ℳ) : DirectSum.Decomposition ℳ where decompose' := (Equiv.ofBijective _ h).symm left_inv := (Equiv.ofBijective _ h).right_inv right_inv := (Equiv.ofBijective _ h).left_inv variable [Decomposition ℳ] protected theorem Decomposition.isInternal : DirectSum.IsInternal ℳ := ⟨Decomposition.right_inv.injective, Decomposition.left_inv.surjective⟩ #align direct_sum.decomposition.is_internal DirectSum.Decomposition.isInternal def decompose : M ≃ ⨁ i, ℳ i where toFun := Decomposition.decompose' invFun := DirectSum.coeAddMonoidHom ℳ left_inv := Decomposition.left_inv right_inv := Decomposition.right_inv #align direct_sum.decompose DirectSum.decompose protected theorem Decomposition.inductionOn {p : M → Prop} (h_zero : p 0) (h_homogeneous : ∀ {i} (m : ℳ i), p (m : M)) (h_add : ∀ m m' : M, p m → p m' → p (m + m')) : ∀ m, p m := by let ℳ' : ι → AddSubmonoid M := fun i ↦ (⟨⟨ℳ i, fun x y ↦ AddMemClass.add_mem x y⟩, (ZeroMemClass.zero_mem _)⟩ : AddSubmonoid M) haveI t : DirectSum.Decomposition ℳ' := { decompose' := DirectSum.decompose ℳ left_inv := fun _ ↦ (decompose ℳ).left_inv _ right_inv := fun _ ↦ (decompose ℳ).right_inv _ } have mem : ∀ m, m ∈ iSup ℳ' := fun _m ↦ (DirectSum.IsInternal.addSubmonoid_iSup_eq_top ℳ' (Decomposition.isInternal ℳ')).symm ▸ trivial -- Porting note: needs to use @ even though no implicit argument is provided exact fun m ↦ @AddSubmonoid.iSup_induction _ _ _ ℳ' _ _ (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add -- exact fun m ↦ -- AddSubmonoid.iSup_induction ℳ' (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add #align direct_sum.decomposition.induction_on DirectSum.Decomposition.inductionOn @[simp] theorem Decomposition.decompose'_eq : Decomposition.decompose' = decompose ℳ := rfl #align direct_sum.decomposition.decompose'_eq DirectSum.Decomposition.decompose'_eq @[simp] theorem decompose_symm_of {i : ι} (x : ℳ i) : (decompose ℳ).symm (DirectSum.of _ i x) = x := DirectSum.coeAddMonoidHom_of ℳ _ _ #align direct_sum.decompose_symm_of DirectSum.decompose_symm_of @[simp] theorem decompose_coe {i : ι} (x : ℳ i) : decompose ℳ (x : M) = DirectSum.of _ i x := by rw [← decompose_symm_of _, Equiv.apply_symm_apply] #align direct_sum.decompose_coe DirectSum.decompose_coe theorem decompose_of_mem {x : M} {i : ι} (hx : x ∈ ℳ i) : decompose ℳ x = DirectSum.of (fun i ↦ ℳ i) i ⟨x, hx⟩ := decompose_coe _ ⟨x, hx⟩ #align direct_sum.decompose_of_mem DirectSum.decompose_of_mem
Mathlib/Algebra/DirectSum/Decomposition.lean
136
137
theorem decompose_of_mem_same {x : M} {i : ι} (hx : x ∈ ℳ i) : (decompose ℳ x i : M) = x := by
rw [decompose_of_mem _ hx, DirectSum.of_eq_same, Subtype.coe_mk]
1
import Mathlib.Data.Fin.Fin2 import Mathlib.Logic.Function.Basic import Mathlib.Tactic.Common #align_import data.typevec from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" universe u v w @[pp_with_univ] def TypeVec (n : ℕ) := Fin2 n → Type* #align typevec TypeVec instance {n} : Inhabited (TypeVec.{u} n) := ⟨fun _ => PUnit⟩ namespace TypeVec variable {n : ℕ} def Arrow (α β : TypeVec n) := ∀ i : Fin2 n, α i → β i #align typevec.arrow TypeVec.Arrow @[inherit_doc] scoped[MvFunctor] infixl:40 " ⟹ " => TypeVec.Arrow open MvFunctor @[ext]
Mathlib/Data/TypeVec.lean
60
62
theorem Arrow.ext {α β : TypeVec n} (f g : α ⟹ β) : (∀ i, f i = g i) → f = g := by
intro h; funext i; apply h
1
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Induction #align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f" set_option linter.uppercaseLean3 false noncomputable section open Finset AddMonoidAlgebra open Polynomial namespace Polynomial universe u v w y variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {a b : R} {m n : ℕ} section Semiring variable [Semiring R] {p q r : R[X]} section variable [Semiring S] variable (f : R →+* S) (x : S) irreducible_def eval₂ (p : R[X]) : S := p.sum fun e a => f a * x ^ e #align polynomial.eval₂ Polynomial.eval₂ theorem eval₂_eq_sum {f : R →+* S} {x : S} : p.eval₂ f x = p.sum fun e a => f a * x ^ e := by rw [eval₂_def] #align polynomial.eval₂_eq_sum Polynomial.eval₂_eq_sum theorem eval₂_congr {R S : Type*} [Semiring R] [Semiring S] {f g : R →+* S} {s t : S} {φ ψ : R[X]} : f = g → s = t → φ = ψ → eval₂ f s φ = eval₂ g t ψ := by rintro rfl rfl rfl; rfl #align polynomial.eval₂_congr Polynomial.eval₂_congr @[simp] theorem eval₂_at_zero : p.eval₂ f 0 = f (coeff p 0) := by simp (config := { contextual := true }) only [eval₂_eq_sum, zero_pow_eq, mul_ite, mul_zero, mul_one, sum, Classical.not_not, mem_support_iff, sum_ite_eq', ite_eq_left_iff, RingHom.map_zero, imp_true_iff, eq_self_iff_true] #align polynomial.eval₂_at_zero Polynomial.eval₂_at_zero @[simp] theorem eval₂_zero : (0 : R[X]).eval₂ f x = 0 := by simp [eval₂_eq_sum] #align polynomial.eval₂_zero Polynomial.eval₂_zero @[simp] theorem eval₂_C : (C a).eval₂ f x = f a := by simp [eval₂_eq_sum] #align polynomial.eval₂_C Polynomial.eval₂_C @[simp] theorem eval₂_X : X.eval₂ f x = x := by simp [eval₂_eq_sum] #align polynomial.eval₂_X Polynomial.eval₂_X @[simp] theorem eval₂_monomial {n : ℕ} {r : R} : (monomial n r).eval₂ f x = f r * x ^ n := by simp [eval₂_eq_sum] #align polynomial.eval₂_monomial Polynomial.eval₂_monomial @[simp] theorem eval₂_X_pow {n : ℕ} : (X ^ n).eval₂ f x = x ^ n := by rw [X_pow_eq_monomial] convert eval₂_monomial f x (n := n) (r := 1) simp #align polynomial.eval₂_X_pow Polynomial.eval₂_X_pow @[simp] theorem eval₂_add : (p + q).eval₂ f x = p.eval₂ f x + q.eval₂ f x := by simp only [eval₂_eq_sum] apply sum_add_index <;> simp [add_mul] #align polynomial.eval₂_add Polynomial.eval₂_add @[simp] theorem eval₂_one : (1 : R[X]).eval₂ f x = 1 := by rw [← C_1, eval₂_C, f.map_one] #align polynomial.eval₂_one Polynomial.eval₂_one set_option linter.deprecated false in @[simp]
Mathlib/Algebra/Polynomial/Eval.lean
100
100
theorem eval₂_bit0 : (bit0 p).eval₂ f x = bit0 (p.eval₂ f x) := by
rw [bit0, eval₂_add, bit0]
1
import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Order.OrderClosed #align_import topology.algebra.with_zero_topology from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064" open Topology Filter TopologicalSpace Filter Set Function namespace WithZeroTopology variable {α Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] {γ γ₁ γ₂ : Γ₀} {l : Filter α} {f : α → Γ₀} scoped instance (priority := 100) topologicalSpace : TopologicalSpace Γ₀ := nhdsAdjoint 0 <| ⨅ γ ≠ 0, 𝓟 (Iio γ) #align with_zero_topology.topological_space WithZeroTopology.topologicalSpace theorem nhds_eq_update : (𝓝 : Γ₀ → Filter Γ₀) = update pure 0 (⨅ γ ≠ 0, 𝓟 (Iio γ)) := by rw [nhds_nhdsAdjoint, sup_of_le_right] exact le_iInf₂ fun γ hγ ↦ le_principal_iff.2 <| zero_lt_iff.2 hγ #align with_zero_topology.nhds_eq_update WithZeroTopology.nhds_eq_update theorem nhds_zero : 𝓝 (0 : Γ₀) = ⨅ γ ≠ 0, 𝓟 (Iio γ) := by rw [nhds_eq_update, update_same] #align with_zero_topology.nhds_zero WithZeroTopology.nhds_zero theorem hasBasis_nhds_zero : (𝓝 (0 : Γ₀)).HasBasis (fun γ : Γ₀ => γ ≠ 0) Iio := by rw [nhds_zero] refine hasBasis_biInf_principal ?_ ⟨1, one_ne_zero⟩ exact directedOn_iff_directed.2 (Monotone.directed_ge fun a b hab => Iio_subset_Iio hab) #align with_zero_topology.has_basis_nhds_zero WithZeroTopology.hasBasis_nhds_zero theorem Iio_mem_nhds_zero (hγ : γ ≠ 0) : Iio γ ∈ 𝓝 (0 : Γ₀) := hasBasis_nhds_zero.mem_of_mem hγ #align with_zero_topology.Iio_mem_nhds_zero WithZeroTopology.Iio_mem_nhds_zero theorem nhds_zero_of_units (γ : Γ₀ˣ) : Iio ↑γ ∈ 𝓝 (0 : Γ₀) := Iio_mem_nhds_zero γ.ne_zero #align with_zero_topology.nhds_zero_of_units WithZeroTopology.nhds_zero_of_units
Mathlib/Topology/Algebra/WithZeroTopology.lean
78
79
theorem tendsto_zero : Tendsto f l (𝓝 (0 : Γ₀)) ↔ ∀ (γ₀) (_ : γ₀ ≠ 0), ∀ᶠ x in l, f x < γ₀ := by
simp [nhds_zero]
1
import Mathlib.NumberTheory.Zsqrtd.Basic import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.Data.Complex.Basic import Mathlib.Data.Real.Archimedean #align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" open Zsqrtd Complex open scoped ComplexConjugate abbrev GaussianInt : Type := Zsqrtd (-1) #align gaussian_int GaussianInt local notation "ℤ[i]" => GaussianInt namespace GaussianInt instance : Repr ℤ[i] := ⟨fun x _ => "⟨" ++ repr x.re ++ ", " ++ repr x.im ++ "⟩"⟩ instance instCommRing : CommRing ℤ[i] := Zsqrtd.commRing #align gaussian_int.comm_ring GaussianInt.instCommRing section attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily. def toComplex : ℤ[i] →+* ℂ := Zsqrtd.lift ⟨I, by simp⟩ #align gaussian_int.to_complex GaussianInt.toComplex end instance : Coe ℤ[i] ℂ := ⟨toComplex⟩ theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I := rfl #align gaussian_int.to_complex_def GaussianInt.toComplex_def theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [toComplex_def] #align gaussian_int.to_complex_def' GaussianInt.toComplex_def' theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by apply Complex.ext <;> simp [toComplex_def] #align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂ @[simp] theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [toComplex_def] #align gaussian_int.to_real_re GaussianInt.to_real_re @[simp] theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by simp [toComplex_def] #align gaussian_int.to_real_im GaussianInt.to_real_im @[simp] theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [toComplex_def] #align gaussian_int.to_complex_re GaussianInt.toComplex_re @[simp] theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [toComplex_def] #align gaussian_int.to_complex_im GaussianInt.toComplex_im -- Porting note (#10618): @[simp] can prove this theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y := toComplex.map_add _ _ #align gaussian_int.to_complex_add GaussianInt.toComplex_add -- Porting note (#10618): @[simp] can prove this theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y := toComplex.map_mul _ _ #align gaussian_int.to_complex_mul GaussianInt.toComplex_mul -- Porting note (#10618): @[simp] can prove this theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 := toComplex.map_one #align gaussian_int.to_complex_one GaussianInt.toComplex_one -- Porting note (#10618): @[simp] can prove this theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 := toComplex.map_zero #align gaussian_int.to_complex_zero GaussianInt.toComplex_zero -- Porting note (#10618): @[simp] can prove this theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x := toComplex.map_neg _ #align gaussian_int.to_complex_neg GaussianInt.toComplex_neg -- Porting note (#10618): @[simp] can prove this theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y := toComplex.map_sub _ _ #align gaussian_int.to_complex_sub GaussianInt.toComplex_sub @[simp] theorem toComplex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) := by rw [toComplex_def₂, toComplex_def₂] exact congr_arg₂ _ rfl (Int.cast_neg _) #align gaussian_int.to_complex_star GaussianInt.toComplex_star @[simp] theorem toComplex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by cases x; cases y; simp [toComplex_def₂] #align gaussian_int.to_complex_inj GaussianInt.toComplex_inj lemma toComplex_injective : Function.Injective GaussianInt.toComplex := fun ⦃_ _⦄ ↦ toComplex_inj.mp @[simp] theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by rw [← toComplex_zero, toComplex_inj] #align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero @[simp] theorem intCast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = Complex.normSq (x : ℂ) := by rw [Zsqrtd.norm, normSq]; simp #align gaussian_int.nat_cast_real_norm GaussianInt.intCast_real_norm @[deprecated (since := "2024-04-17")] alias int_cast_real_norm := intCast_real_norm @[simp]
Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean
162
163
theorem intCast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = Complex.normSq (x : ℂ) := by
cases x; rw [Zsqrtd.norm, normSq]; simp
1
import Mathlib.Data.Set.Pointwise.Interval import Mathlib.LinearAlgebra.AffineSpace.Basic import Mathlib.LinearAlgebra.BilinearMap import Mathlib.LinearAlgebra.Pi import Mathlib.LinearAlgebra.Prod #align_import linear_algebra.affine_space.affine_map from "leanprover-community/mathlib"@"bd1fc183335ea95a9519a1630bcf901fe9326d83" open Affine structure AffineMap (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*) [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] where toFun : P1 → P2 linear : V1 →ₗ[k] V2 map_vadd' : ∀ (p : P1) (v : V1), toFun (v +ᵥ p) = linear v +ᵥ toFun p #align affine_map AffineMap notation:25 P1 " →ᵃ[" k:25 "] " P2:0 => AffineMap k P1 P2 instance AffineMap.instFunLike (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*) [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] : FunLike (P1 →ᵃ[k] P2) P1 P2 where coe := AffineMap.toFun coe_injective' := fun ⟨f, f_linear, f_add⟩ ⟨g, g_linear, g_add⟩ => fun (h : f = g) => by cases' (AddTorsor.nonempty : Nonempty P1) with p congr with v apply vadd_right_cancel (f p) erw [← f_add, h, ← g_add] #align affine_map.fun_like AffineMap.instFunLike instance AffineMap.hasCoeToFun (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*) [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] : CoeFun (P1 →ᵃ[k] P2) fun _ => P1 → P2 := DFunLike.hasCoeToFun #align affine_map.has_coe_to_fun AffineMap.hasCoeToFun namespace AffineMap variable {k : Type*} {V1 : Type*} {P1 : Type*} {V2 : Type*} {P2 : Type*} {V3 : Type*} {P3 : Type*} {V4 : Type*} {P4 : Type*} [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] [AddCommGroup V3] [Module k V3] [AffineSpace V3 P3] [AddCommGroup V4] [Module k V4] [AffineSpace V4 P4] @[simp] theorem coe_mk (f : P1 → P2) (linear add) : ((mk f linear add : P1 →ᵃ[k] P2) : P1 → P2) = f := rfl #align affine_map.coe_mk AffineMap.coe_mk @[simp] theorem toFun_eq_coe (f : P1 →ᵃ[k] P2) : f.toFun = ⇑f := rfl #align affine_map.to_fun_eq_coe AffineMap.toFun_eq_coe @[simp] theorem map_vadd (f : P1 →ᵃ[k] P2) (p : P1) (v : V1) : f (v +ᵥ p) = f.linear v +ᵥ f p := f.map_vadd' p v #align affine_map.map_vadd AffineMap.map_vadd @[simp]
Mathlib/LinearAlgebra/AffineSpace/AffineMap.lean
135
136
theorem linearMap_vsub (f : P1 →ᵃ[k] P2) (p1 p2 : P1) : f.linear (p1 -ᵥ p2) = f p1 -ᵥ f p2 := by
conv_rhs => rw [← vsub_vadd p1 p2, map_vadd, vadd_vsub]
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 ENNReal variable (μ) {f g : α → ℝ≥0∞} noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ #align measure_theory.laverage MeasureTheory.laverage notation3 "⨍⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => laverage μ r notation3 "⨍⁻ "(...)", "r:60:(scoped f => laverage volume f) => r notation3 "⨍⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => laverage (Measure.restrict μ s) r notation3 (prettyPrint := false) "⨍⁻ "(...)" in "s", "r:60:(scoped f => laverage Measure.restrict volume s f) => r @[simp]
Mathlib/MeasureTheory/Integral/Average.lean
108
108
theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by
rw [laverage, lintegral_zero]
1
import Batteries.Data.List.Count import Batteries.Data.Fin.Lemmas open Nat Function namespace List theorem rel_of_pairwise_cons (p : (a :: l).Pairwise R) : ∀ {a'}, a' ∈ l → R a a' := (pairwise_cons.1 p).1 _ theorem Pairwise.of_cons (p : (a :: l).Pairwise R) : Pairwise R l := (pairwise_cons.1 p).2 theorem Pairwise.tail : ∀ {l : List α} (_p : Pairwise R l), Pairwise R l.tail | [], h => h | _ :: _, h => h.of_cons theorem Pairwise.drop : ∀ {l : List α} {n : Nat}, List.Pairwise R l → List.Pairwise R (l.drop n) | _, 0, h => h | [], _ + 1, _ => List.Pairwise.nil | _ :: _, n + 1, h => Pairwise.drop (n := n) (pairwise_cons.mp h).right theorem Pairwise.imp_of_mem {S : α → α → Prop} (H : ∀ {a b}, a ∈ l → b ∈ l → R a b → S a b) (p : Pairwise R l) : Pairwise S l := by induction p with | nil => constructor | @cons a l r _ ih => constructor · exact fun x h => H (mem_cons_self ..) (mem_cons_of_mem _ h) <| r x h · exact ih fun m m' => H (mem_cons_of_mem _ m) (mem_cons_of_mem _ m') theorem Pairwise.and (hR : Pairwise R l) (hS : Pairwise S l) : l.Pairwise fun a b => R a b ∧ S a b := by induction hR with | nil => simp only [Pairwise.nil] | cons R1 _ IH => simp only [Pairwise.nil, pairwise_cons] at hS ⊢ exact ⟨fun b bl => ⟨R1 b bl, hS.1 b bl⟩, IH hS.2⟩ theorem pairwise_and_iff : l.Pairwise (fun a b => R a b ∧ S a b) ↔ Pairwise R l ∧ Pairwise S l := ⟨fun h => ⟨h.imp fun h => h.1, h.imp fun h => h.2⟩, fun ⟨hR, hS⟩ => hR.and hS⟩ theorem Pairwise.imp₂ (H : ∀ a b, R a b → S a b → T a b) (hR : Pairwise R l) (hS : l.Pairwise S) : l.Pairwise T := (hR.and hS).imp fun ⟨h₁, h₂⟩ => H _ _ h₁ h₂ theorem Pairwise.iff_of_mem {S : α → α → Prop} {l : List α} (H : ∀ {a b}, a ∈ l → b ∈ l → (R a b ↔ S a b)) : Pairwise R l ↔ Pairwise S l := ⟨Pairwise.imp_of_mem fun m m' => (H m m').1, Pairwise.imp_of_mem fun m m' => (H m m').2⟩ theorem Pairwise.iff {S : α → α → Prop} (H : ∀ a b, R a b ↔ S a b) {l : List α} : Pairwise R l ↔ Pairwise S l := Pairwise.iff_of_mem fun _ _ => H .. theorem pairwise_of_forall {l : List α} (H : ∀ x y, R x y) : Pairwise R l := by induction l <;> simp [*] theorem Pairwise.and_mem {l : List α} : Pairwise R l ↔ Pairwise (fun x y => x ∈ l ∧ y ∈ l ∧ R x y) l := Pairwise.iff_of_mem <| by simp (config := { contextual := true }) theorem Pairwise.imp_mem {l : List α} : Pairwise R l ↔ Pairwise (fun x y => x ∈ l → y ∈ l → R x y) l := Pairwise.iff_of_mem <| by simp (config := { contextual := true }) theorem Pairwise.forall_of_forall_of_flip (h₁ : ∀ x ∈ l, R x x) (h₂ : Pairwise R l) (h₃ : l.Pairwise (flip R)) : ∀ ⦃x⦄, x ∈ l → ∀ ⦃y⦄, y ∈ l → R x y := by induction l with | nil => exact forall_mem_nil _ | cons a l ih => rw [pairwise_cons] at h₂ h₃ simp only [mem_cons] rintro x (rfl | hx) y (rfl | hy) · exact h₁ _ (l.mem_cons_self _) · exact h₂.1 _ hy · exact h₃.1 _ hx · exact ih (fun x hx => h₁ _ <| mem_cons_of_mem _ hx) h₂.2 h₃.2 hx hy
.lake/packages/batteries/Batteries/Data/List/Pairwise.lean
104
104
theorem pairwise_singleton (R) (a : α) : Pairwise R [a] := by
simp
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 TypeclassesRightLT variable [LT α] [CovariantClass α α (swap (· * ·)) (· < ·)] {a b c : α} @[to_additive (attr := simp) "Uses `right` co(ntra)variant."] theorem Right.inv_lt_one_iff : a⁻¹ < 1 ↔ 1 < a := by rw [← mul_lt_mul_iff_right a, inv_mul_self, one_mul] #align right.inv_lt_one_iff Right.inv_lt_one_iff #align right.neg_neg_iff Right.neg_neg_iff @[to_additive (attr := simp) Right.neg_pos_iff "Uses `right` co(ntra)variant."] theorem Right.one_lt_inv_iff : 1 < a⁻¹ ↔ a < 1 := by rw [← mul_lt_mul_iff_right a, inv_mul_self, one_mul] #align right.one_lt_inv_iff Right.one_lt_inv_iff #align right.neg_pos_iff Right.neg_pos_iff @[to_additive] theorem inv_lt_iff_one_lt_mul : a⁻¹ < b ↔ 1 < b * a := (mul_lt_mul_iff_right a).symm.trans <| by rw [inv_mul_self] #align inv_lt_iff_one_lt_mul inv_lt_iff_one_lt_mul #align neg_lt_iff_pos_add neg_lt_iff_pos_add @[to_additive] theorem lt_inv_iff_mul_lt_one : a < b⁻¹ ↔ a * b < 1 := (mul_lt_mul_iff_right b).symm.trans <| by rw [inv_mul_self] #align lt_inv_iff_mul_lt_one lt_inv_iff_mul_lt_one #align lt_neg_iff_add_neg lt_neg_iff_add_neg @[to_additive (attr := simp)] theorem mul_inv_lt_iff_lt_mul : a * b⁻¹ < c ↔ a < c * b := by rw [← mul_lt_mul_iff_right b, inv_mul_cancel_right] #align mul_inv_lt_iff_lt_mul mul_inv_lt_iff_lt_mul #align add_neg_lt_iff_lt_add add_neg_lt_iff_lt_add @[to_additive (attr := simp)] theorem lt_mul_inv_iff_mul_lt : c < a * b⁻¹ ↔ c * b < a := (mul_lt_mul_iff_right b).symm.trans <| by rw [inv_mul_cancel_right] #align lt_mul_inv_iff_mul_lt lt_mul_inv_iff_mul_lt #align lt_add_neg_iff_add_lt lt_add_neg_iff_add_lt -- Porting note (#10618): `simp` can prove this @[to_additive]
Mathlib/Algebra/Order/Group/Defs.lean
318
319
theorem inv_mul_lt_one_iff_lt : a * b⁻¹ < 1 ↔ a < b := by
rw [← mul_lt_mul_iff_right b, inv_mul_cancel_right, one_mul]
1
import Mathlib.Algebra.Ring.Defs import Mathlib.Algebra.Group.Ext local macro:max "local_hAdd[" type:term ", " inst:term "]" : term => `(term| (letI := $inst; HAdd.hAdd : $type → $type → $type)) local macro:max "local_hMul[" type:term ", " inst:term "]" : term => `(term| (letI := $inst; HMul.hMul : $type → $type → $type)) universe u variable {R : Type u} @[ext] theorem AddMonoidWithOne.ext ⦃inst₁ inst₂ : AddMonoidWithOne R⦄ (h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂]) (h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one : R)) : inst₁ = inst₂ := by have h_monoid : inst₁.toAddMonoid = inst₂.toAddMonoid := by ext : 1; exact h_add have h_zero' : inst₁.toZero = inst₂.toZero := congrArg (·.toZero) h_monoid have h_one' : inst₁.toOne = inst₂.toOne := congrArg One.mk h_one have h_natCast : inst₁.toNatCast.natCast = inst₂.toNatCast.natCast := by funext n; induction n with | zero => rewrite [inst₁.natCast_zero, inst₂.natCast_zero] exact congrArg (@Zero.zero R) h_zero' | succ n h => rw [inst₁.natCast_succ, inst₂.natCast_succ, h_add] exact congrArg₂ _ h h_one rcases inst₁ with @⟨⟨⟩⟩; rcases inst₂ with @⟨⟨⟩⟩ congr theorem AddCommMonoidWithOne.toAddMonoidWithOne_injective : Function.Injective (@AddCommMonoidWithOne.toAddMonoidWithOne R) := by rintro ⟨⟩ ⟨⟩ _; congr @[ext] theorem AddCommMonoidWithOne.ext ⦃inst₁ inst₂ : AddCommMonoidWithOne R⦄ (h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂]) (h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one : R)) : inst₁ = inst₂ := AddCommMonoidWithOne.toAddMonoidWithOne_injective <| AddMonoidWithOne.ext h_add h_one @[ext] theorem AddGroupWithOne.ext ⦃inst₁ inst₂ : AddGroupWithOne R⦄ (h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂]) (h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one)) : inst₁ = inst₂ := by have : inst₁.toAddMonoidWithOne = inst₂.toAddMonoidWithOne := AddMonoidWithOne.ext h_add h_one have : inst₁.toNatCast = inst₂.toNatCast := congrArg (·.toNatCast) this have h_group : inst₁.toAddGroup = inst₂.toAddGroup := by ext : 1; exact h_add -- Extract equality of necessary substructures from h_group injection h_group with h_group; injection h_group have : inst₁.toIntCast.intCast = inst₂.toIntCast.intCast := by funext n; cases n with | ofNat n => rewrite [Int.ofNat_eq_coe, inst₁.intCast_ofNat, inst₂.intCast_ofNat]; congr | negSucc n => rewrite [inst₁.intCast_negSucc, inst₂.intCast_negSucc]; congr rcases inst₁ with @⟨⟨⟩⟩; rcases inst₂ with @⟨⟨⟩⟩ congr @[ext] theorem AddCommGroupWithOne.ext ⦃inst₁ inst₂ : AddCommGroupWithOne R⦄ (h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂]) (h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one)) : inst₁ = inst₂ := by have : inst₁.toAddCommGroup = inst₂.toAddCommGroup := AddCommGroup.ext h_add have : inst₁.toAddGroupWithOne = inst₂.toAddGroupWithOne := AddGroupWithOne.ext h_add h_one injection this with _ h_addMonoidWithOne; injection h_addMonoidWithOne cases inst₁; cases inst₂ congr -- At present, there is no `NonAssocCommSemiring` in Mathlib. -- At present, there is no `NonAssocCommRing` in Mathlib. namespace CommSemiring
Mathlib/Algebra/Ring/Ext.lean
497
499
theorem toSemiring_injective : Function.Injective (@toSemiring R) := by
rintro ⟨⟩ ⟨⟩ _; congr
1
import Batteries.Classes.Order namespace Batteries.PairingHeapImp inductive Heap (α : Type u) where | nil : Heap α | node (a : α) (child sibling : Heap α) : Heap α deriving Repr def Heap.size : Heap α → Nat | .nil => 0 | .node _ c s => c.size + 1 + s.size def Heap.singleton (a : α) : Heap α := .node a .nil .nil def Heap.isEmpty : Heap α → Bool | .nil => true | _ => false @[specialize] def Heap.merge (le : α → α → Bool) : Heap α → Heap α → Heap α | .nil, .nil => .nil | .nil, .node a₂ c₂ _ => .node a₂ c₂ .nil | .node a₁ c₁ _, .nil => .node a₁ c₁ .nil | .node a₁ c₁ _, .node a₂ c₂ _ => if le a₁ a₂ then .node a₁ (.node a₂ c₂ c₁) .nil else .node a₂ (.node a₁ c₁ c₂) .nil @[specialize] def Heap.combine (le : α → α → Bool) : Heap α → Heap α | h₁@(.node _ _ h₂@(.node _ _ s)) => merge le (merge le h₁ h₂) (s.combine le) | h => h @[inline] def Heap.headD (a : α) : Heap α → α | .nil => a | .node a _ _ => a @[inline] def Heap.head? : Heap α → Option α | .nil => none | .node a _ _ => some a @[inline] def Heap.deleteMin (le : α → α → Bool) : Heap α → Option (α × Heap α) | .nil => none | .node a c _ => (a, combine le c) @[inline] def Heap.tail? (le : α → α → Bool) (h : Heap α) : Option (Heap α) := deleteMin le h |>.map (·.snd) @[inline] def Heap.tail (le : α → α → Bool) (h : Heap α) : Heap α := tail? le h |>.getD .nil inductive Heap.NoSibling : Heap α → Prop | nil : NoSibling .nil | node (a c) : NoSibling (.node a c .nil) instance : Decidable (Heap.NoSibling s) := match s with | .nil => isTrue .nil | .node a c .nil => isTrue (.node a c) | .node _ _ (.node _ _ _) => isFalse nofun theorem Heap.noSibling_merge (le) (s₁ s₂ : Heap α) : (s₁.merge le s₂).NoSibling := by unfold merge (split <;> try split) <;> constructor theorem Heap.noSibling_combine (le) (s : Heap α) : (s.combine le).NoSibling := by unfold combine; split · exact noSibling_merge _ _ _ · match s with | nil | node _ _ nil => constructor | node _ _ (node _ _ s) => rename_i h; exact (h _ _ _ _ _ rfl).elim theorem Heap.noSibling_deleteMin {s : Heap α} (eq : s.deleteMin le = some (a, s')) : s'.NoSibling := by cases s with cases eq | node a c => exact noSibling_combine _ _ theorem Heap.noSibling_tail? {s : Heap α} : s.tail? le = some s' → s'.NoSibling := by simp only [Heap.tail?]; intro eq match eq₂ : s.deleteMin le, eq with | some (a, tl), rfl => exact noSibling_deleteMin eq₂ theorem Heap.noSibling_tail (le) (s : Heap α) : (s.tail le).NoSibling := by simp only [Heap.tail] match eq : s.tail? le with | none => cases s with cases eq | nil => constructor | some tl => exact Heap.noSibling_tail? eq
.lake/packages/batteries/Batteries/Data/PairingHeap.lean
119
121
theorem Heap.size_merge_node (le) (a₁ : α) (c₁ s₁ : Heap α) (a₂ : α) (c₂ s₂ : Heap α) : (merge le (.node a₁ c₁ s₁) (.node a₂ c₂ s₂)).size = c₁.size + c₂.size + 2 := by
unfold merge; dsimp; split <;> simp_arith [size]
1
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Combinatorics.SimpleGraph.Basic import Mathlib.Data.Rat.Cast.Order import Mathlib.Order.Partition.Finpartition import Mathlib.Tactic.GCongr import Mathlib.Tactic.NormNum import Mathlib.Tactic.Positivity import Mathlib.Tactic.Ring #align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1" open Finset variable {𝕜 ι κ α β : Type*} namespace Rel section Asymmetric variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α} {t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜} def interedges (s : Finset α) (t : Finset β) : Finset (α × β) := (s ×ˢ t).filter fun e ↦ r e.1 e.2 #align rel.interedges Rel.interedges def edgeDensity (s : Finset α) (t : Finset β) : ℚ := (interedges r s t).card / (s.card * t.card) #align rel.edge_density Rel.edgeDensity variable {r} theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by rw [interedges, mem_filter, Finset.mem_product, and_assoc] #align rel.mem_interedges_iff Rel.mem_interedges_iff theorem mk_mem_interedges_iff : (a, b) ∈ interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b := mem_interedges_iff #align rel.mk_mem_interedges_iff Rel.mk_mem_interedges_iff @[simp] theorem interedges_empty_left (t : Finset β) : interedges r ∅ t = ∅ := by rw [interedges, Finset.empty_product, filter_empty] #align rel.interedges_empty_left Rel.interedges_empty_left theorem interedges_mono (hs : s₂ ⊆ s₁) (ht : t₂ ⊆ t₁) : interedges r s₂ t₂ ⊆ interedges r s₁ t₁ := fun x ↦ by simp_rw [mem_interedges_iff] exact fun h ↦ ⟨hs h.1, ht h.2.1, h.2.2⟩ #align rel.interedges_mono Rel.interedges_mono variable (r) theorem card_interedges_add_card_interedges_compl (s : Finset α) (t : Finset β) : (interedges r s t).card + (interedges (fun x y ↦ ¬r x y) s t).card = s.card * t.card := by classical rw [← card_product, interedges, interedges, ← card_union_of_disjoint, filter_union_filter_neg_eq] exact disjoint_filter.2 fun _ _ ↦ Classical.not_not.2 #align rel.card_interedges_add_card_interedges_compl Rel.card_interedges_add_card_interedges_compl theorem interedges_disjoint_left {s s' : Finset α} (hs : Disjoint s s') (t : Finset β) : Disjoint (interedges r s t) (interedges r s' t) := by rw [Finset.disjoint_left] at hs ⊢ intro _ hx hy rw [mem_interedges_iff] at hx hy exact hs hx.1 hy.1 #align rel.interedges_disjoint_left Rel.interedges_disjoint_left theorem interedges_disjoint_right (s : Finset α) {t t' : Finset β} (ht : Disjoint t t') : Disjoint (interedges r s t) (interedges r s t') := by rw [Finset.disjoint_left] at ht ⊢ intro _ hx hy rw [mem_interedges_iff] at hx hy exact ht hx.2.1 hy.2.1 #align rel.interedges_disjoint_right Rel.interedges_disjoint_right theorem card_interedges_le_mul (s : Finset α) (t : Finset β) : (interedges r s t).card ≤ s.card * t.card := (card_filter_le _ _).trans (card_product _ _).le #align rel.card_interedges_le_mul Rel.card_interedges_le_mul theorem edgeDensity_nonneg (s : Finset α) (t : Finset β) : 0 ≤ edgeDensity r s t := by apply div_nonneg <;> exact mod_cast Nat.zero_le _ #align rel.edge_density_nonneg Rel.edgeDensity_nonneg theorem edgeDensity_le_one (s : Finset α) (t : Finset β) : edgeDensity r s t ≤ 1 := by apply div_le_one_of_le · exact mod_cast card_interedges_le_mul r s t · exact mod_cast Nat.zero_le _ #align rel.edge_density_le_one Rel.edgeDensity_le_one theorem edgeDensity_add_edgeDensity_compl (hs : s.Nonempty) (ht : t.Nonempty) : edgeDensity r s t + edgeDensity (fun x y ↦ ¬r x y) s t = 1 := by rw [edgeDensity, edgeDensity, div_add_div_same, div_eq_one_iff_eq] · exact mod_cast card_interedges_add_card_interedges_compl r s t · exact mod_cast (mul_pos hs.card_pos ht.card_pos).ne' #align rel.edge_density_add_edge_density_compl Rel.edgeDensity_add_edgeDensity_compl @[simp] theorem edgeDensity_empty_left (t : Finset β) : edgeDensity r ∅ t = 0 := by rw [edgeDensity, Finset.card_empty, Nat.cast_zero, zero_mul, div_zero] #align rel.edge_density_empty_left Rel.edgeDensity_empty_left @[simp]
Mathlib/Combinatorics/SimpleGraph/Density.lean
159
160
theorem edgeDensity_empty_right (s : Finset α) : edgeDensity r s ∅ = 0 := by
rw [edgeDensity, Finset.card_empty, Nat.cast_zero, mul_zero, div_zero]
1
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Reverse import Mathlib.Algebra.Polynomial.Inductions import Mathlib.RingTheory.Localization.Basic #align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Polynomial Function AddMonoidAlgebra Finsupp noncomputable section variable {R : Type*} abbrev LaurentPolynomial (R : Type*) [Semiring R] := AddMonoidAlgebra R ℤ #align laurent_polynomial LaurentPolynomial @[nolint docBlame] scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R open LaurentPolynomial -- Porting note: `ext` no longer applies `Finsupp.ext` automatically @[ext] theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : ∀ a, p a = q a) : p = q := Finsupp.ext h def Polynomial.toLaurent [Semiring R] : R[X] →+* R[T;T⁻¹] := (mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R) #align polynomial.to_laurent Polynomial.toLaurent theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) : toLaurent p = p.toFinsupp.mapDomain (↑) := rfl #align polynomial.to_laurent_apply Polynomial.toLaurent_apply def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] := (mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom #align polynomial.to_laurent_alg Polynomial.toLaurentAlg @[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] : (toLaurentAlg : R[X] → R[T;T⁻¹]) = toLaurent := rfl theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f := rfl #align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply namespace LaurentPolynomial section Semiring variable [Semiring R] theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) := rfl #align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one def C : R →+* R[T;T⁻¹] := singleZeroRingHom set_option linter.uppercaseLean3 false in #align laurent_polynomial.C LaurentPolynomial.C theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) : algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) := rfl #align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C @[simp] lemma C_apply (t : R) (n : ℤ) : C t n = if n = 0 then t else 0 := by rw [← single_eq_C, Finsupp.single_apply]; aesop def T (n : ℤ) : R[T;T⁻¹] := Finsupp.single n 1 set_option linter.uppercaseLean3 false in #align laurent_polynomial.T LaurentPolynomial.T @[simp] lemma T_apply (m n : ℤ) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 := Finsupp.single_apply @[simp] theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_zero LaurentPolynomial.T_zero theorem T_add (m n : ℤ) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by -- Porting note: was `convert single_mul_single.symm` simp [T, single_mul_single] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_add LaurentPolynomial.T_add theorem T_sub (m n : ℤ) : (T (m - n) : R[T;T⁻¹]) = T m * T (-n) := by rw [← T_add, sub_eq_add_neg] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_sub LaurentPolynomial.T_sub @[simp] theorem T_pow (m : ℤ) (n : ℕ) : (T m ^ n : R[T;T⁻¹]) = T (n * m) := by rw [T, T, single_pow n, one_pow, nsmul_eq_mul] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_pow LaurentPolynomial.T_pow @[simp]
Mathlib/Algebra/Polynomial/Laurent.lean
203
204
theorem mul_T_assoc (f : R[T;T⁻¹]) (m n : ℤ) : f * T m * T n = f * T (m + n) := by
simp [← T_add, mul_assoc]
1
import Mathlib.Order.Cover import Mathlib.Order.Interval.Finset.Defs #align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d" assert_not_exists MonoidWithZero assert_not_exists Finset.sum open Function OrderDual open FinsetInterval variable {ι α : Type*} namespace Finset section Preorder variable [Preorder α] section LocallyFiniteOrder variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α} @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc] #align finset.nonempty_Icc Finset.nonempty_Icc @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico] #align finset.nonempty_Ico Finset.nonempty_Ico @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc] #align finset.nonempty_Ioc Finset.nonempty_Ioc -- TODO: This is nonsense. A locally finite order is never densely ordered @[simp] theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo] #align finset.nonempty_Ioo Finset.nonempty_Ioo @[simp] theorem Icc_eq_empty_iff : Icc a b = ∅ ↔ ¬a ≤ b := by rw [← coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff] #align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff @[simp] theorem Ico_eq_empty_iff : Ico a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff] #align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff @[simp] theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff] #align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff -- TODO: This is nonsense. A locally finite order is never densely ordered @[simp] theorem Ioo_eq_empty_iff [DenselyOrdered α] : Ioo a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff] #align finset.Ioo_eq_empty_iff Finset.Ioo_eq_empty_iff alias ⟨_, Icc_eq_empty⟩ := Icc_eq_empty_iff #align finset.Icc_eq_empty Finset.Icc_eq_empty alias ⟨_, Ico_eq_empty⟩ := Ico_eq_empty_iff #align finset.Ico_eq_empty Finset.Ico_eq_empty alias ⟨_, Ioc_eq_empty⟩ := Ioc_eq_empty_iff #align finset.Ioc_eq_empty Finset.Ioc_eq_empty @[simp] theorem Ioo_eq_empty (h : ¬a < b) : Ioo a b = ∅ := eq_empty_iff_forall_not_mem.2 fun _ hx => h ((mem_Ioo.1 hx).1.trans (mem_Ioo.1 hx).2) #align finset.Ioo_eq_empty Finset.Ioo_eq_empty @[simp] theorem Icc_eq_empty_of_lt (h : b < a) : Icc a b = ∅ := Icc_eq_empty h.not_le #align finset.Icc_eq_empty_of_lt Finset.Icc_eq_empty_of_lt @[simp] theorem Ico_eq_empty_of_le (h : b ≤ a) : Ico a b = ∅ := Ico_eq_empty h.not_lt #align finset.Ico_eq_empty_of_le Finset.Ico_eq_empty_of_le @[simp] theorem Ioc_eq_empty_of_le (h : b ≤ a) : Ioc a b = ∅ := Ioc_eq_empty h.not_lt #align finset.Ioc_eq_empty_of_le Finset.Ioc_eq_empty_of_le @[simp] theorem Ioo_eq_empty_of_le (h : b ≤ a) : Ioo a b = ∅ := Ioo_eq_empty h.not_lt #align finset.Ioo_eq_empty_of_le Finset.Ioo_eq_empty_of_le -- porting note (#10618): simp can prove this -- @[simp] theorem left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := by simp only [mem_Icc, true_and_iff, le_rfl] #align finset.left_mem_Icc Finset.left_mem_Icc -- porting note (#10618): simp can prove this -- @[simp] theorem left_mem_Ico : a ∈ Ico a b ↔ a < b := by simp only [mem_Ico, true_and_iff, le_refl] #align finset.left_mem_Ico Finset.left_mem_Ico -- porting note (#10618): simp can prove this -- @[simp]
Mathlib/Order/Interval/Finset/Basic.lean
144
144
theorem right_mem_Icc : b ∈ Icc a b ↔ a ≤ b := by
simp only [mem_Icc, and_true_iff, le_rfl]
1
import Mathlib.LinearAlgebra.Dimension.DivisionRing import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition noncomputable section universe u v v' v'' variable {K : Type u} {V V₁ : Type v} {V' V'₁ : Type v'} {V'' : Type v''} open Cardinal Basis Submodule Function Set namespace LinearMap section Ring variable [Ring K] [AddCommGroup V] [Module K V] [AddCommGroup V₁] [Module K V₁] variable [AddCommGroup V'] [Module K V'] abbrev rank (f : V →ₗ[K] V') : Cardinal := Module.rank K (LinearMap.range f) #align linear_map.rank LinearMap.rank theorem rank_le_range (f : V →ₗ[K] V') : rank f ≤ Module.rank K V' := rank_submodule_le _ #align linear_map.rank_le_range LinearMap.rank_le_range theorem rank_le_domain (f : V →ₗ[K] V₁) : rank f ≤ Module.rank K V := rank_range_le _ #align linear_map.rank_le_domain LinearMap.rank_le_domain @[simp] theorem rank_zero [Nontrivial K] : rank (0 : V →ₗ[K] V') = 0 := by rw [rank, LinearMap.range_zero, rank_bot] #align linear_map.rank_zero LinearMap.rank_zero variable [AddCommGroup V''] [Module K V''] theorem rank_comp_le_left (g : V →ₗ[K] V') (f : V' →ₗ[K] V'') : rank (f.comp g) ≤ rank f := by refine rank_le_of_submodule _ _ ?_ rw [LinearMap.range_comp] exact LinearMap.map_le_range #align linear_map.rank_comp_le_left LinearMap.rank_comp_le_left
Mathlib/LinearAlgebra/Dimension/LinearMap.lean
58
60
theorem lift_rank_comp_le_right (g : V →ₗ[K] V') (f : V' →ₗ[K] V'') : Cardinal.lift.{v'} (rank (f.comp g)) ≤ Cardinal.lift.{v''} (rank g) := by
rw [rank, rank, LinearMap.range_comp]; exact lift_rank_map_le _ _
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 ENNReal variable (μ) {f g : α → ℝ≥0∞} noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ #align measure_theory.laverage MeasureTheory.laverage notation3 "⨍⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => laverage μ r notation3 "⨍⁻ "(...)", "r:60:(scoped f => laverage volume f) => r notation3 "⨍⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => laverage (Measure.restrict μ s) r notation3 (prettyPrint := false) "⨍⁻ "(...)" in "s", "r:60:(scoped f => laverage Measure.restrict volume s f) => r @[simp] theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by rw [laverage, lintegral_zero] #align measure_theory.laverage_zero MeasureTheory.laverage_zero @[simp]
Mathlib/MeasureTheory/Integral/Average.lean
112
112
theorem laverage_zero_measure (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂(0 : Measure α) = 0 := by
simp [laverage]
1
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Topology.Order.ProjIcc #align_import analysis.special_functions.trigonometric.inverse from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Topology Filter open Set Filter open Real namespace Real variable {x y : ℝ} -- @[pp_nodot] Porting note: not implemented noncomputable def arcsin : ℝ → ℝ := Subtype.val ∘ IccExtend (neg_le_self zero_le_one) sinOrderIso.symm #align real.arcsin Real.arcsin theorem arcsin_mem_Icc (x : ℝ) : arcsin x ∈ Icc (-(π / 2)) (π / 2) := Subtype.coe_prop _ #align real.arcsin_mem_Icc Real.arcsin_mem_Icc @[simp] theorem range_arcsin : range arcsin = Icc (-(π / 2)) (π / 2) := by rw [arcsin, range_comp Subtype.val] simp [Icc] #align real.range_arcsin Real.range_arcsin theorem arcsin_le_pi_div_two (x : ℝ) : arcsin x ≤ π / 2 := (arcsin_mem_Icc x).2 #align real.arcsin_le_pi_div_two Real.arcsin_le_pi_div_two theorem neg_pi_div_two_le_arcsin (x : ℝ) : -(π / 2) ≤ arcsin x := (arcsin_mem_Icc x).1 #align real.neg_pi_div_two_le_arcsin Real.neg_pi_div_two_le_arcsin theorem arcsin_projIcc (x : ℝ) : arcsin (projIcc (-1) 1 (neg_le_self zero_le_one) x) = arcsin x := by rw [arcsin, Function.comp_apply, IccExtend_val, Function.comp_apply, IccExtend, Function.comp_apply] #align real.arcsin_proj_Icc Real.arcsin_projIcc theorem sin_arcsin' {x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1) : sin (arcsin x) = x := by simpa [arcsin, IccExtend_of_mem _ _ hx, -OrderIso.apply_symm_apply] using Subtype.ext_iff.1 (sinOrderIso.apply_symm_apply ⟨x, hx⟩) #align real.sin_arcsin' Real.sin_arcsin' theorem sin_arcsin {x : ℝ} (hx₁ : -1 ≤ x) (hx₂ : x ≤ 1) : sin (arcsin x) = x := sin_arcsin' ⟨hx₁, hx₂⟩ #align real.sin_arcsin Real.sin_arcsin theorem arcsin_sin' {x : ℝ} (hx : x ∈ Icc (-(π / 2)) (π / 2)) : arcsin (sin x) = x := injOn_sin (arcsin_mem_Icc _) hx <| by rw [sin_arcsin (neg_one_le_sin _) (sin_le_one _)] #align real.arcsin_sin' Real.arcsin_sin' theorem arcsin_sin {x : ℝ} (hx₁ : -(π / 2) ≤ x) (hx₂ : x ≤ π / 2) : arcsin (sin x) = x := arcsin_sin' ⟨hx₁, hx₂⟩ #align real.arcsin_sin Real.arcsin_sin theorem strictMonoOn_arcsin : StrictMonoOn arcsin (Icc (-1) 1) := (Subtype.strictMono_coe _).comp_strictMonoOn <| sinOrderIso.symm.strictMono.strictMonoOn_IccExtend _ #align real.strict_mono_on_arcsin Real.strictMonoOn_arcsin theorem monotone_arcsin : Monotone arcsin := (Subtype.mono_coe _).comp <| sinOrderIso.symm.monotone.IccExtend _ #align real.monotone_arcsin Real.monotone_arcsin theorem injOn_arcsin : InjOn arcsin (Icc (-1) 1) := strictMonoOn_arcsin.injOn #align real.inj_on_arcsin Real.injOn_arcsin theorem arcsin_inj {x y : ℝ} (hx₁ : -1 ≤ x) (hx₂ : x ≤ 1) (hy₁ : -1 ≤ y) (hy₂ : y ≤ 1) : arcsin x = arcsin y ↔ x = y := injOn_arcsin.eq_iff ⟨hx₁, hx₂⟩ ⟨hy₁, hy₂⟩ #align real.arcsin_inj Real.arcsin_inj @[continuity] theorem continuous_arcsin : Continuous arcsin := continuous_subtype_val.comp sinOrderIso.symm.continuous.Icc_extend' #align real.continuous_arcsin Real.continuous_arcsin theorem continuousAt_arcsin {x : ℝ} : ContinuousAt arcsin x := continuous_arcsin.continuousAt #align real.continuous_at_arcsin Real.continuousAt_arcsin theorem arcsin_eq_of_sin_eq {x y : ℝ} (h₁ : sin x = y) (h₂ : x ∈ Icc (-(π / 2)) (π / 2)) : arcsin y = x := by subst y exact injOn_sin (arcsin_mem_Icc _) h₂ (sin_arcsin' (sin_mem_Icc x)) #align real.arcsin_eq_of_sin_eq Real.arcsin_eq_of_sin_eq @[simp] theorem arcsin_zero : arcsin 0 = 0 := arcsin_eq_of_sin_eq sin_zero ⟨neg_nonpos.2 pi_div_two_pos.le, pi_div_two_pos.le⟩ #align real.arcsin_zero Real.arcsin_zero @[simp] theorem arcsin_one : arcsin 1 = π / 2 := arcsin_eq_of_sin_eq sin_pi_div_two <| right_mem_Icc.2 (neg_le_self pi_div_two_pos.le) #align real.arcsin_one Real.arcsin_one theorem arcsin_of_one_le {x : ℝ} (hx : 1 ≤ x) : arcsin x = π / 2 := by rw [← arcsin_projIcc, projIcc_of_right_le _ hx, Subtype.coe_mk, arcsin_one] #align real.arcsin_of_one_le Real.arcsin_of_one_le theorem arcsin_neg_one : arcsin (-1) = -(π / 2) := arcsin_eq_of_sin_eq (by rw [sin_neg, sin_pi_div_two]) <| left_mem_Icc.2 (neg_le_self pi_div_two_pos.le) #align real.arcsin_neg_one Real.arcsin_neg_one
Mathlib/Analysis/SpecialFunctions/Trigonometric/Inverse.lean
133
134
theorem arcsin_of_le_neg_one {x : ℝ} (hx : x ≤ -1) : arcsin x = -(π / 2) := by
rw [← arcsin_projIcc, projIcc_of_le_left _ hx, Subtype.coe_mk, arcsin_neg_one]
1
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Analysis.NormedSpace.Real #align_import analysis.special_functions.log.basic from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def log (x : ℝ) : ℝ := if hx : x = 0 then 0 else expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ #align real.log Real.log theorem log_of_ne_zero (hx : x ≠ 0) : log x = expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ := dif_neg hx #align real.log_of_ne_zero Real.log_of_ne_zero theorem log_of_pos (hx : 0 < x) : log x = expOrderIso.symm ⟨x, hx⟩ := by rw [log_of_ne_zero hx.ne'] congr exact abs_of_pos hx #align real.log_of_pos Real.log_of_pos theorem exp_log_eq_abs (hx : x ≠ 0) : exp (log x) = |x| := by rw [log_of_ne_zero hx, ← coe_expOrderIso_apply, OrderIso.apply_symm_apply, Subtype.coe_mk] #align real.exp_log_eq_abs Real.exp_log_eq_abs theorem exp_log (hx : 0 < x) : exp (log x) = x := by rw [exp_log_eq_abs hx.ne'] exact abs_of_pos hx #align real.exp_log Real.exp_log theorem exp_log_of_neg (hx : x < 0) : exp (log x) = -x := by rw [exp_log_eq_abs (ne_of_lt hx)] exact abs_of_neg hx #align real.exp_log_of_neg Real.exp_log_of_neg theorem le_exp_log (x : ℝ) : x ≤ exp (log x) := by by_cases h_zero : x = 0 · rw [h_zero, log, dif_pos rfl, exp_zero] exact zero_le_one · rw [exp_log_eq_abs h_zero] exact le_abs_self _ #align real.le_exp_log Real.le_exp_log @[simp] theorem log_exp (x : ℝ) : log (exp x) = x := exp_injective <| exp_log (exp_pos x) #align real.log_exp Real.log_exp theorem surjOn_log : SurjOn log (Ioi 0) univ := fun x _ => ⟨exp x, exp_pos x, log_exp x⟩ #align real.surj_on_log Real.surjOn_log theorem log_surjective : Surjective log := fun x => ⟨exp x, log_exp x⟩ #align real.log_surjective Real.log_surjective @[simp] theorem range_log : range log = univ := log_surjective.range_eq #align real.range_log Real.range_log @[simp] theorem log_zero : log 0 = 0 := dif_pos rfl #align real.log_zero Real.log_zero @[simp] theorem log_one : log 1 = 0 := exp_injective <| by rw [exp_log zero_lt_one, exp_zero] #align real.log_one Real.log_one @[simp] theorem log_abs (x : ℝ) : log |x| = log x := by by_cases h : x = 0 · simp [h] · rw [← exp_eq_exp, exp_log_eq_abs h, exp_log_eq_abs (abs_pos.2 h).ne', abs_abs] #align real.log_abs Real.log_abs @[simp] theorem log_neg_eq_log (x : ℝ) : log (-x) = log x := by rw [← log_abs x, ← log_abs (-x), abs_neg] #align real.log_neg_eq_log Real.log_neg_eq_log
Mathlib/Analysis/SpecialFunctions/Log/Basic.lean
114
115
theorem sinh_log {x : ℝ} (hx : 0 < x) : sinh (log x) = (x - x⁻¹) / 2 := by
rw [sinh_eq, exp_neg, exp_log hx]
1
import Mathlib.Tactic.NormNum import Mathlib.Tactic.TryThis import Mathlib.Util.AtomM set_option autoImplicit true namespace Mathlib.Tactic.Abel open Lean Elab Meta Tactic Qq initialize registerTraceClass `abel initialize registerTraceClass `abel.detail structure Context where α : Expr univ : Level α0 : Expr isGroup : Bool inst : Expr def mkContext (e : Expr) : MetaM Context := do let α ← inferType e let c ← synthInstance (← mkAppM ``AddCommMonoid #[α]) let cg ← synthInstance? (← mkAppM ``AddCommGroup #[α]) let u ← mkFreshLevelMVar _ ← isDefEq (.sort (.succ u)) (← inferType α) let α0 ← Expr.ofNat α 0 match cg with | some cg => return ⟨α, u, α0, true, cg⟩ | _ => return ⟨α, u, α0, false, c⟩ abbrev M := ReaderT Context AtomM def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr → Expr := mkAppN (((@Expr.const n [c.univ]).app c.α).app inst) def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do return c.app n (← synthInstance ((Expr.const inst [c.univ]).app c.α)) l def addG : Name → Name | .str p s => .str p (s ++ "g") | n => n def iapp (n : Name) (xs : Array Expr) : M Expr := do let c ← read return c.app (if c.isGroup then addG n else n) c.inst xs def term {α} [AddCommMonoid α] (n : ℕ) (x a : α) : α := n • x + a def termg {α} [AddCommGroup α] (n : ℤ) (x a : α) : α := n • x + a def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a] def intToExpr (n : ℤ) : M Expr := do Expr.ofInt (mkConst (if (← read).isGroup then ``Int else ``Nat) []) n inductive NormalExpr : Type | zero (e : Expr) : NormalExpr | nterm (e : Expr) (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : NormalExpr deriving Inhabited def NormalExpr.e : NormalExpr → Expr | .zero e => e | .nterm e .. => e instance : Coe NormalExpr Expr where coe := NormalExpr.e def NormalExpr.term' (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : M NormalExpr := return .nterm (← mkTerm n.1 x.2 a) n x a def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (← read).α0 open NormalExpr theorem const_add_term {α} [AddCommMonoid α] (k n x a a') (h : k + a = a') : k + @term α _ n x a = term n x a' := by simp [h.symm, term, add_comm, add_assoc]
Mathlib/Tactic/Abel.lean
132
134
theorem const_add_termg {α} [AddCommGroup α] (k n x a a') (h : k + a = a') : k + @termg α _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.Prod import Mathlib.SetTheory.Cardinal.Basic import Mathlib.Tactic.FinCases import Mathlib.Tactic.LinearCombination import Mathlib.Lean.Expr.ExtraRecognizers import Mathlib.Data.Set.Subsingleton #align_import linear_algebra.linear_independent from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" noncomputable section open Function Set Submodule open Cardinal universe u' u variable {ι : Type u'} {ι' : Type*} {R : Type*} {K : Type*} variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*} section Module variable {v : ι → M} variable [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M''] variable [Module R M] [Module R M'] [Module R M''] variable {a b : R} {x y : M} variable (R) (v) def LinearIndependent : Prop := LinearMap.ker (Finsupp.total ι M R v) = ⊥ #align linear_independent LinearIndependent open Lean PrettyPrinter.Delaborator SubExpr in @[delab app.LinearIndependent] def delabLinearIndependent : Delab := whenPPOption getPPNotation <| whenNotPPOption getPPAnalysisSkip <| withOptionAtCurrPos `pp.analysis.skip true do let e ← getExpr guard <| e.isAppOfArity ``LinearIndependent 7 let some _ := (e.getArg! 0).coeTypeSet? | failure let optionsPerPos ← if (e.getArg! 3).isLambda then withNaryArg 3 do return (← read).optionsPerPos.setBool (← getPos) pp.funBinderTypes.name true else withNaryArg 0 do return (← read).optionsPerPos.setBool (← getPos) `pp.analysis.namedArg true withTheReader Context ({· with optionsPerPos}) delab variable {R} {v} theorem linearIndependent_iff : LinearIndependent R v ↔ ∀ l, Finsupp.total ι M R v l = 0 → l = 0 := by simp [LinearIndependent, LinearMap.ker_eq_bot'] #align linear_independent_iff linearIndependent_iff theorem linearIndependent_iff' : LinearIndependent R v ↔ ∀ s : Finset ι, ∀ g : ι → R, ∑ i ∈ s, g i • v i = 0 → ∀ i ∈ s, g i = 0 := linearIndependent_iff.trans ⟨fun hf s g hg i his => have h := hf (∑ i ∈ s, Finsupp.single i (g i)) <| by simpa only [map_sum, Finsupp.total_single] using hg calc g i = (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single i (g i)) := by { rw [Finsupp.lapply_apply, Finsupp.single_eq_same] } _ = ∑ j ∈ s, (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single j (g j)) := Eq.symm <| Finset.sum_eq_single i (fun j _hjs hji => by rw [Finsupp.lapply_apply, Finsupp.single_eq_of_ne hji]) fun hnis => hnis.elim his _ = (∑ j ∈ s, Finsupp.single j (g j)) i := (map_sum ..).symm _ = 0 := DFunLike.ext_iff.1 h i, fun hf l hl => Finsupp.ext fun i => _root_.by_contradiction fun hni => hni <| hf _ _ hl _ <| Finsupp.mem_support_iff.2 hni⟩ #align linear_independent_iff' linearIndependent_iff' theorem linearIndependent_iff'' : LinearIndependent R v ↔ ∀ (s : Finset ι) (g : ι → R), (∀ i ∉ s, g i = 0) → ∑ i ∈ s, g i • v i = 0 → ∀ i, g i = 0 := by classical exact linearIndependent_iff'.trans ⟨fun H s g hg hv i => if his : i ∈ s then H s g hv i his else hg i his, fun H s g hg i hi => by convert H s (fun j => if j ∈ s then g j else 0) (fun j hj => if_neg hj) (by simp_rw [ite_smul, zero_smul, Finset.sum_extend_by_zero, hg]) i exact (if_pos hi).symm⟩ #align linear_independent_iff'' linearIndependent_iff'' theorem not_linearIndependent_iff : ¬LinearIndependent R v ↔ ∃ s : Finset ι, ∃ g : ι → R, ∑ i ∈ s, g i • v i = 0 ∧ ∃ i ∈ s, g i ≠ 0 := by rw [linearIndependent_iff'] simp only [exists_prop, not_forall] #align not_linear_independent_iff not_linearIndependent_iff theorem Fintype.linearIndependent_iff [Fintype ι] : LinearIndependent R v ↔ ∀ g : ι → R, ∑ i, g i • v i = 0 → ∀ i, g i = 0 := by refine ⟨fun H g => by simpa using linearIndependent_iff'.1 H Finset.univ g, fun H => linearIndependent_iff''.2 fun s g hg hs i => H _ ?_ _⟩ rw [← hs] refine (Finset.sum_subset (Finset.subset_univ _) fun i _ hi => ?_).symm rw [hg i hi, zero_smul] #align fintype.linear_independent_iff Fintype.linearIndependent_iff theorem Fintype.linearIndependent_iff' [Fintype ι] [DecidableEq ι] : LinearIndependent R v ↔ LinearMap.ker (LinearMap.lsum R (fun _ ↦ R) ℕ fun i ↦ LinearMap.id.smulRight (v i)) = ⊥ := by simp [Fintype.linearIndependent_iff, LinearMap.ker_eq_bot', funext_iff] #align fintype.linear_independent_iff' Fintype.linearIndependent_iff'
Mathlib/LinearAlgebra/LinearIndependent.lean
192
194
theorem Fintype.not_linearIndependent_iff [Fintype ι] : ¬LinearIndependent R v ↔ ∃ g : ι → R, ∑ i, g i • v i = 0 ∧ ∃ i, g i ≠ 0 := by
simpa using not_iff_not.2 Fintype.linearIndependent_iff
1
import Mathlib.SetTheory.Cardinal.Ordinal #align_import set_theory.cardinal.continuum from "leanprover-community/mathlib"@"e08a42b2dd544cf11eba72e5fc7bf199d4349925" namespace Cardinal universe u v open Cardinal def continuum : Cardinal.{u} := 2 ^ ℵ₀ #align cardinal.continuum Cardinal.continuum scoped notation "𝔠" => Cardinal.continuum @[simp] theorem two_power_aleph0 : 2 ^ aleph0.{u} = continuum.{u} := rfl #align cardinal.two_power_aleph_0 Cardinal.two_power_aleph0 @[simp] theorem lift_continuum : lift.{v} 𝔠 = 𝔠 := by rw [← two_power_aleph0, lift_two_power, lift_aleph0, two_power_aleph0] #align cardinal.lift_continuum Cardinal.lift_continuum @[simp] theorem continuum_le_lift {c : Cardinal.{u}} : 𝔠 ≤ lift.{v} c ↔ 𝔠 ≤ c := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_le] #align cardinal.continuum_le_lift Cardinal.continuum_le_lift @[simp] theorem lift_le_continuum {c : Cardinal.{u}} : lift.{v} c ≤ 𝔠 ↔ c ≤ 𝔠 := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_le] #align cardinal.lift_le_continuum Cardinal.lift_le_continuum @[simp] theorem continuum_lt_lift {c : Cardinal.{u}} : 𝔠 < lift.{v} c ↔ 𝔠 < c := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_lt] #align cardinal.continuum_lt_lift Cardinal.continuum_lt_lift @[simp] theorem lift_lt_continuum {c : Cardinal.{u}} : lift.{v} c < 𝔠 ↔ c < 𝔠 := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_lt] #align cardinal.lift_lt_continuum Cardinal.lift_lt_continuum theorem aleph0_lt_continuum : ℵ₀ < 𝔠 := cantor ℵ₀ #align cardinal.aleph_0_lt_continuum Cardinal.aleph0_lt_continuum theorem aleph0_le_continuum : ℵ₀ ≤ 𝔠 := aleph0_lt_continuum.le #align cardinal.aleph_0_le_continuum Cardinal.aleph0_le_continuum @[simp] theorem beth_one : beth 1 = 𝔠 := by simpa using beth_succ 0 #align cardinal.beth_one Cardinal.beth_one theorem nat_lt_continuum (n : ℕ) : ↑n < 𝔠 := (nat_lt_aleph0 n).trans aleph0_lt_continuum #align cardinal.nat_lt_continuum Cardinal.nat_lt_continuum
Mathlib/SetTheory/Cardinal/Continuum.lean
90
90
theorem mk_set_nat : #(Set ℕ) = 𝔠 := by
simp
1
import Mathlib.MeasureTheory.Function.AEEqFun.DomAct import Mathlib.MeasureTheory.Function.LpSpace set_option autoImplicit true open MeasureTheory Filter open scoped ENNReal namespace DomMulAct variable {M N α E : Type*} [MeasurableSpace M] [MeasurableSpace N] [MeasurableSpace α] [NormedAddCommGroup E] {μ : MeasureTheory.Measure α} {p : ℝ≥0∞} section SMul variable [SMul M α] [SMulInvariantMeasure M α μ] [MeasurableSMul M α] @[to_additive] instance : SMul Mᵈᵐᵃ (Lp E p μ) where smul c f := Lp.compMeasurePreserving (mk.symm c • ·) (measurePreserving_smul _ _) f @[to_additive (attr := simp)] theorem smul_Lp_val (c : Mᵈᵐᵃ) (f : Lp E p μ) : (c • f).1 = c • f.1 := rfl @[to_additive] theorem smul_Lp_ae_eq (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • f =ᵐ[μ] (f <| mk.symm c • ·) := Lp.coeFn_compMeasurePreserving _ _ @[to_additive] theorem mk_smul_toLp (c : M) {f : α → E} (hf : Memℒp f p μ) : mk c • hf.toLp f = (hf.comp_measurePreserving <| measurePreserving_smul c μ).toLp (f <| c • ·) := rfl @[to_additive (attr := simp)] theorem smul_Lp_const [IsFiniteMeasure μ] (c : Mᵈᵐᵃ) (a : E) : c • Lp.const p μ a = Lp.const p μ a := rfl instance [SMul N α] [SMulCommClass M N α] [SMulInvariantMeasure N α μ] [MeasurableSMul N α] : SMulCommClass Mᵈᵐᵃ Nᵈᵐᵃ (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass Mᵈᵐᵃ 𝕜 (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass 𝕜 Mᵈᵐᵃ (Lp E p μ) := .symm _ _ _ -- We don't have a typeclass for additive versions of the next few lemmas -- Should we add `AddDistribAddAction` with `to_additive` both from `MulDistribMulAction` -- and `DistribMulAction`? @[to_additive] theorem smul_Lp_add (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f + g) = c • f + c • g := by rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl attribute [simp] DomAddAct.vadd_Lp_add @[to_additive (attr := simp 1001)] theorem smul_Lp_zero (c : Mᵈᵐᵃ) : c • (0 : Lp E p μ) = 0 := rfl @[to_additive] theorem smul_Lp_neg (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • (-f) = -(c • f) := by rcases f with ⟨⟨_⟩, _⟩; rfl @[to_additive] theorem smul_Lp_sub (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f - g) = c • f - c • g := by rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl instance : DistribSMul Mᵈᵐᵃ (Lp E p μ) where smul_zero _ := rfl smul_add := by rintro _ ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl -- The next few lemmas follow from the `IsometricSMul` instance if `1 ≤ p` @[to_additive (attr := simp)] theorem norm_smul_Lp (c : Mᵈᵐᵃ) (f : Lp E p μ) : ‖c • f‖ = ‖f‖ := Lp.norm_compMeasurePreserving _ _ @[to_additive (attr := simp)] theorem nnnorm_smul_Lp (c : Mᵈᵐᵃ) (f : Lp E p μ) : ‖c • f‖₊ = ‖f‖₊ := NNReal.eq <| Lp.norm_compMeasurePreserving _ _ @[to_additive (attr := simp)] theorem dist_smul_Lp (c : Mᵈᵐᵃ) (f g : Lp E p μ) : dist (c • f) (c • g) = dist f g := by simp only [dist, ← smul_Lp_sub, norm_smul_Lp] @[to_additive (attr := simp)]
Mathlib/MeasureTheory/Function/LpSpace/DomAct/Basic.lean
103
104
theorem edist_smul_Lp (c : Mᵈᵐᵃ) (f g : Lp E p μ) : edist (c • f) (c • g) = edist f g := by
simp only [Lp.edist_dist, dist_smul_Lp]
1
import Mathlib.Algebra.GeomSum import Mathlib.Order.Filter.Archimedean import Mathlib.Order.Iterate import Mathlib.Topology.Algebra.Algebra import Mathlib.Topology.Algebra.InfiniteSum.Real #align_import analysis.specific_limits.basic from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" noncomputable section open scoped Classical open Set Function Filter Finset Metric open scoped Classical open Topology Nat uniformity NNReal ENNReal variable {α : Type*} {β : Type*} {ι : Type*} theorem tendsto_inverse_atTop_nhds_zero_nat : Tendsto (fun n : ℕ ↦ (n : ℝ)⁻¹) atTop (𝓝 0) := tendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop #align tendsto_inverse_at_top_nhds_0_nat tendsto_inverse_atTop_nhds_zero_nat @[deprecated (since := "2024-01-31")] alias tendsto_inverse_atTop_nhds_0_nat := tendsto_inverse_atTop_nhds_zero_nat theorem tendsto_const_div_atTop_nhds_zero_nat (C : ℝ) : Tendsto (fun n : ℕ ↦ C / n) atTop (𝓝 0) := by simpa only [mul_zero] using tendsto_const_nhds.mul tendsto_inverse_atTop_nhds_zero_nat #align tendsto_const_div_at_top_nhds_0_nat tendsto_const_div_atTop_nhds_zero_nat @[deprecated (since := "2024-01-31")] alias tendsto_const_div_atTop_nhds_0_nat := tendsto_const_div_atTop_nhds_zero_nat theorem tendsto_one_div_atTop_nhds_zero_nat : Tendsto (fun n : ℕ ↦ 1/(n : ℝ)) atTop (𝓝 0) := tendsto_const_div_atTop_nhds_zero_nat 1 @[deprecated (since := "2024-01-31")] alias tendsto_one_div_atTop_nhds_0_nat := tendsto_one_div_atTop_nhds_zero_nat theorem NNReal.tendsto_inverse_atTop_nhds_zero_nat : Tendsto (fun n : ℕ ↦ (n : ℝ≥0)⁻¹) atTop (𝓝 0) := by rw [← NNReal.tendsto_coe] exact _root_.tendsto_inverse_atTop_nhds_zero_nat #align nnreal.tendsto_inverse_at_top_nhds_0_nat NNReal.tendsto_inverse_atTop_nhds_zero_nat @[deprecated (since := "2024-01-31")] alias NNReal.tendsto_inverse_atTop_nhds_0_nat := NNReal.tendsto_inverse_atTop_nhds_zero_nat
Mathlib/Analysis/SpecificLimits/Basic.lean
59
61
theorem NNReal.tendsto_const_div_atTop_nhds_zero_nat (C : ℝ≥0) : Tendsto (fun n : ℕ ↦ C / n) atTop (𝓝 0) := by
simpa using tendsto_const_nhds.mul NNReal.tendsto_inverse_atTop_nhds_zero_nat
1
import Mathlib.Order.Interval.Set.OrdConnected import Mathlib.Data.Set.Lattice #align_import data.set.intervals.ord_connected_component from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open Interval Function OrderDual namespace Set variable {α : Type*} [LinearOrder α] {s t : Set α} {x y z : α} def ordConnectedComponent (s : Set α) (x : α) : Set α := { y | [[x, y]] ⊆ s } #align set.ord_connected_component Set.ordConnectedComponent theorem mem_ordConnectedComponent : y ∈ ordConnectedComponent s x ↔ [[x, y]] ⊆ s := Iff.rfl #align set.mem_ord_connected_component Set.mem_ordConnectedComponent theorem dual_ordConnectedComponent : ordConnectedComponent (ofDual ⁻¹' s) (toDual x) = ofDual ⁻¹' ordConnectedComponent s x := ext <| (Surjective.forall toDual.surjective).2 fun x => by rw [mem_ordConnectedComponent, dual_uIcc] rfl #align set.dual_ord_connected_component Set.dual_ordConnectedComponent theorem ordConnectedComponent_subset : ordConnectedComponent s x ⊆ s := fun _ hy => hy right_mem_uIcc #align set.ord_connected_component_subset Set.ordConnectedComponent_subset theorem subset_ordConnectedComponent {t} [h : OrdConnected s] (hs : x ∈ s) (ht : s ⊆ t) : s ⊆ ordConnectedComponent t x := fun _ hy => (h.uIcc_subset hs hy).trans ht #align set.subset_ord_connected_component Set.subset_ordConnectedComponent @[simp] theorem self_mem_ordConnectedComponent : x ∈ ordConnectedComponent s x ↔ x ∈ s := by rw [mem_ordConnectedComponent, uIcc_self, singleton_subset_iff] #align set.self_mem_ord_connected_component Set.self_mem_ordConnectedComponent @[simp] theorem nonempty_ordConnectedComponent : (ordConnectedComponent s x).Nonempty ↔ x ∈ s := ⟨fun ⟨_, hy⟩ => hy <| left_mem_uIcc, fun h => ⟨x, self_mem_ordConnectedComponent.2 h⟩⟩ #align set.nonempty_ord_connected_component Set.nonempty_ordConnectedComponent @[simp] theorem ordConnectedComponent_eq_empty : ordConnectedComponent s x = ∅ ↔ x ∉ s := by rw [← not_nonempty_iff_eq_empty, nonempty_ordConnectedComponent] #align set.ord_connected_component_eq_empty Set.ordConnectedComponent_eq_empty @[simp] theorem ordConnectedComponent_empty : ordConnectedComponent ∅ x = ∅ := ordConnectedComponent_eq_empty.2 (not_mem_empty x) #align set.ord_connected_component_empty Set.ordConnectedComponent_empty @[simp] theorem ordConnectedComponent_univ : ordConnectedComponent univ x = univ := by simp [ordConnectedComponent] #align set.ord_connected_component_univ Set.ordConnectedComponent_univ theorem ordConnectedComponent_inter (s t : Set α) (x : α) : ordConnectedComponent (s ∩ t) x = ordConnectedComponent s x ∩ ordConnectedComponent t x := by simp [ordConnectedComponent, setOf_and] #align set.ord_connected_component_inter Set.ordConnectedComponent_inter
Mathlib/Order/Interval/Set/OrdConnectedComponent.lean
82
84
theorem mem_ordConnectedComponent_comm : y ∈ ordConnectedComponent s x ↔ x ∈ ordConnectedComponent s y := by
rw [mem_ordConnectedComponent, mem_ordConnectedComponent, uIcc_comm]
1