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
complexity_score
float64
2.72
139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000B
diff_level
int64
0
2
file_diff_level
float64
0
2
theorem_same_file
int64
1
32
rank_file
int64
0
2.51k
import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.Polynomial.CancelLeads import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.FieldDivision #align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3" namespace Polynomial open Polynomial variable {R : Type*} [CommRing R] [IsDomain R] section NormalizedGCDMonoid variable [NormalizedGCDMonoid R] def content (p : R[X]) : R := p.support.gcd p.coeff #align polynomial.content Polynomial.content theorem content_dvd_coeff {p : R[X]} (n : ℕ) : p.content ∣ p.coeff n := by by_cases h : n ∈ p.support · apply Finset.gcd_dvd h rw [mem_support_iff, Classical.not_not] at h rw [h] apply dvd_zero #align polynomial.content_dvd_coeff Polynomial.content_dvd_coeff @[simp] theorem content_C {r : R} : (C r).content = normalize r := by rw [content] by_cases h0 : r = 0 · simp [h0] have h : (C r).support = {0} := support_monomial _ h0 simp [h] set_option linter.uppercaseLean3 false in #align polynomial.content_C Polynomial.content_C @[simp] theorem content_zero : content (0 : R[X]) = 0 := by rw [← C_0, content_C, normalize_zero] #align polynomial.content_zero Polynomial.content_zero @[simp] theorem content_one : content (1 : R[X]) = 1 := by rw [← C_1, content_C, normalize_one] #align polynomial.content_one Polynomial.content_one theorem content_X_mul {p : R[X]} : content (X * p) = content p := by rw [content, content, Finset.gcd_def, Finset.gcd_def] refine congr rfl ?_ have h : (X * p).support = p.support.map ⟨Nat.succ, Nat.succ_injective⟩ := by ext a simp only [exists_prop, Finset.mem_map, Function.Embedding.coeFn_mk, Ne, mem_support_iff] cases' a with a · simp [coeff_X_mul_zero, Nat.succ_ne_zero] rw [mul_comm, coeff_mul_X] constructor · intro h use a · rintro ⟨b, ⟨h1, h2⟩⟩ rw [← Nat.succ_injective h2] apply h1 rw [h] simp only [Finset.map_val, Function.comp_apply, Function.Embedding.coeFn_mk, Multiset.map_map] refine congr (congr rfl ?_) rfl ext a rw [mul_comm] simp [coeff_mul_X] set_option linter.uppercaseLean3 false in #align polynomial.content_X_mul Polynomial.content_X_mul @[simp] theorem content_X_pow {k : ℕ} : content ((X : R[X]) ^ k) = 1 := by induction' k with k hi · simp rw [pow_succ', content_X_mul, hi] set_option linter.uppercaseLean3 false in #align polynomial.content_X_pow Polynomial.content_X_pow @[simp]
Mathlib/RingTheory/Polynomial/Content.lean
142
142
theorem content_X : content (X : R[X]) = 1 := by
rw [← mul_one X, content_X_mul, content_one]
1
2.718282
0
1.2
15
1,288
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
2.718282
0
0.777778
9
688
import Mathlib.Algebra.MonoidAlgebra.Degree import Mathlib.Algebra.MvPolynomial.Rename import Mathlib.Algebra.Order.BigOperators.Ring.Finset #align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set Function Finsupp AddMonoidAlgebra universe u v w variable {R : Type u} {S : Type v} namespace MvPolynomial variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ} section CommSemiring variable [CommSemiring R] {p q : MvPolynomial σ R} section Degrees def degrees (p : MvPolynomial σ R) : Multiset σ := letI := Classical.decEq σ p.support.sup fun s : σ →₀ ℕ => toMultiset s #align mv_polynomial.degrees MvPolynomial.degrees theorem degrees_def [DecidableEq σ] (p : MvPolynomial σ R) : p.degrees = p.support.sup fun s : σ →₀ ℕ => Finsupp.toMultiset s := by rw [degrees]; convert rfl #align mv_polynomial.degrees_def MvPolynomial.degrees_def theorem degrees_monomial (s : σ →₀ ℕ) (a : R) : degrees (monomial s a) ≤ toMultiset s := by classical refine (supDegree_single s a).trans_le ?_ split_ifs exacts [bot_le, le_rfl] #align mv_polynomial.degrees_monomial MvPolynomial.degrees_monomial theorem degrees_monomial_eq (s : σ →₀ ℕ) (a : R) (ha : a ≠ 0) : degrees (monomial s a) = toMultiset s := by classical exact (supDegree_single s a).trans (if_neg ha) #align mv_polynomial.degrees_monomial_eq MvPolynomial.degrees_monomial_eq theorem degrees_C (a : R) : degrees (C a : MvPolynomial σ R) = 0 := Multiset.le_zero.1 <| degrees_monomial _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_C MvPolynomial.degrees_C theorem degrees_X' (n : σ) : degrees (X n : MvPolynomial σ R) ≤ {n} := le_trans (degrees_monomial _ _) <| le_of_eq <| toMultiset_single _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_X' MvPolynomial.degrees_X' @[simp] theorem degrees_X [Nontrivial R] (n : σ) : degrees (X n : MvPolynomial σ R) = {n} := (degrees_monomial_eq _ (1 : R) one_ne_zero).trans (toMultiset_single _ _) set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_X MvPolynomial.degrees_X @[simp] theorem degrees_zero : degrees (0 : MvPolynomial σ R) = 0 := by rw [← C_0] exact degrees_C 0 #align mv_polynomial.degrees_zero MvPolynomial.degrees_zero @[simp] theorem degrees_one : degrees (1 : MvPolynomial σ R) = 0 := degrees_C 1 #align mv_polynomial.degrees_one MvPolynomial.degrees_one theorem degrees_add [DecidableEq σ] (p q : MvPolynomial σ R) : (p + q).degrees ≤ p.degrees ⊔ q.degrees := by simp_rw [degrees_def]; exact supDegree_add_le #align mv_polynomial.degrees_add MvPolynomial.degrees_add theorem degrees_sum {ι : Type*} [DecidableEq σ] (s : Finset ι) (f : ι → MvPolynomial σ R) : (∑ i ∈ s, f i).degrees ≤ s.sup fun i => (f i).degrees := by simp_rw [degrees_def]; exact supDegree_sum_le #align mv_polynomial.degrees_sum MvPolynomial.degrees_sum theorem degrees_mul (p q : MvPolynomial σ R) : (p * q).degrees ≤ p.degrees + q.degrees := by classical simp_rw [degrees_def] exact supDegree_mul_le (map_add _) #align mv_polynomial.degrees_mul MvPolynomial.degrees_mul
Mathlib/Algebra/MvPolynomial/Degrees.lean
144
146
theorem degrees_prod {ι : Type*} (s : Finset ι) (f : ι → MvPolynomial σ R) : (∏ i ∈ s, f i).degrees ≤ ∑ i ∈ s, (f i).degrees := by
classical exact supDegree_prod_le (map_zero _) (map_add _)
1
2.718282
0
0.846154
13
743
import Mathlib.Data.Finset.Lattice #align_import combinatorics.set_family.compression.down from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" variable {α : Type*} [DecidableEq α] {𝒜 ℬ : Finset (Finset α)} {s : Finset α} {a : α} namespace Finset def nonMemberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) := 𝒜.filter fun s => a ∉ s #align finset.non_member_subfamily Finset.nonMemberSubfamily def memberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) := (𝒜.filter fun s => a ∈ s).image fun s => erase s a #align finset.member_subfamily Finset.memberSubfamily @[simp]
Mathlib/Combinatorics/SetFamily/Compression/Down.lean
56
57
theorem mem_nonMemberSubfamily : s ∈ 𝒜.nonMemberSubfamily a ↔ s ∈ 𝒜 ∧ a ∉ s := by
simp [nonMemberSubfamily]
1
2.718282
0
1.3125
16
1,367
import Mathlib.Algebra.ContinuedFractions.Basic import Mathlib.Algebra.GroupWithZero.Basic #align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction section WithDivisionRing variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : ℕ} [DivisionRing K] theorem nth_cont_eq_succ_nth_cont_aux : g.continuants n = g.continuantsAux (n + 1) := rfl #align generalized_continued_fraction.nth_cont_eq_succ_nth_cont_aux GeneralizedContinuedFraction.nth_cont_eq_succ_nth_cont_aux theorem num_eq_conts_a : g.numerators n = (g.continuants n).a := rfl #align generalized_continued_fraction.num_eq_conts_a GeneralizedContinuedFraction.num_eq_conts_a theorem denom_eq_conts_b : g.denominators n = (g.continuants n).b := rfl #align generalized_continued_fraction.denom_eq_conts_b GeneralizedContinuedFraction.denom_eq_conts_b theorem convergent_eq_num_div_denom : g.convergents n = g.numerators n / g.denominators n := rfl #align generalized_continued_fraction.convergent_eq_num_div_denom GeneralizedContinuedFraction.convergent_eq_num_div_denom theorem convergent_eq_conts_a_div_conts_b : g.convergents n = (g.continuants n).a / (g.continuants n).b := rfl #align generalized_continued_fraction.convergent_eq_conts_a_div_conts_b GeneralizedContinuedFraction.convergent_eq_conts_a_div_conts_b theorem exists_conts_a_of_num {A : K} (nth_num_eq : g.numerators n = A) : ∃ conts, g.continuants n = conts ∧ conts.a = A := by simpa #align generalized_continued_fraction.exists_conts_a_of_num GeneralizedContinuedFraction.exists_conts_a_of_num theorem exists_conts_b_of_denom {B : K} (nth_denom_eq : g.denominators n = B) : ∃ conts, g.continuants n = conts ∧ conts.b = B := by simpa #align generalized_continued_fraction.exists_conts_b_of_denom GeneralizedContinuedFraction.exists_conts_b_of_denom @[simp] theorem zeroth_continuant_aux_eq_one_zero : g.continuantsAux 0 = ⟨1, 0⟩ := rfl #align generalized_continued_fraction.zeroth_continuant_aux_eq_one_zero GeneralizedContinuedFraction.zeroth_continuant_aux_eq_one_zero @[simp] theorem first_continuant_aux_eq_h_one : g.continuantsAux 1 = ⟨g.h, 1⟩ := rfl #align generalized_continued_fraction.first_continuant_aux_eq_h_one GeneralizedContinuedFraction.first_continuant_aux_eq_h_one @[simp] theorem zeroth_continuant_eq_h_one : g.continuants 0 = ⟨g.h, 1⟩ := rfl #align generalized_continued_fraction.zeroth_continuant_eq_h_one GeneralizedContinuedFraction.zeroth_continuant_eq_h_one @[simp] theorem zeroth_numerator_eq_h : g.numerators 0 = g.h := rfl #align generalized_continued_fraction.zeroth_numerator_eq_h GeneralizedContinuedFraction.zeroth_numerator_eq_h @[simp] theorem zeroth_denominator_eq_one : g.denominators 0 = 1 := rfl #align generalized_continued_fraction.zeroth_denominator_eq_one GeneralizedContinuedFraction.zeroth_denominator_eq_one @[simp] theorem zeroth_convergent_eq_h : g.convergents 0 = g.h := by simp [convergent_eq_num_div_denom, num_eq_conts_a, denom_eq_conts_b, div_one] #align generalized_continued_fraction.zeroth_convergent_eq_h GeneralizedContinuedFraction.zeroth_convergent_eq_h theorem second_continuant_aux_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) : g.continuantsAux 2 = ⟨gp.b * g.h + gp.a, gp.b⟩ := by simp [zeroth_s_eq, continuantsAux, nextContinuants, nextDenominator, nextNumerator] #align generalized_continued_fraction.second_continuant_aux_eq GeneralizedContinuedFraction.second_continuant_aux_eq theorem first_continuant_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) : g.continuants 1 = ⟨gp.b * g.h + gp.a, gp.b⟩ := by simp [nth_cont_eq_succ_nth_cont_aux] -- Porting note (#10959): simp used to work here, but now it can't figure out that 1 + 1 = 2 convert second_continuant_aux_eq zeroth_s_eq #align generalized_continued_fraction.first_continuant_eq GeneralizedContinuedFraction.first_continuant_eq theorem first_numerator_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) : g.numerators 1 = gp.b * g.h + gp.a := by simp [num_eq_conts_a, first_continuant_eq zeroth_s_eq] #align generalized_continued_fraction.first_numerator_eq GeneralizedContinuedFraction.first_numerator_eq theorem first_denominator_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) : g.denominators 1 = gp.b := by simp [denom_eq_conts_b, first_continuant_eq zeroth_s_eq] #align generalized_continued_fraction.first_denominator_eq GeneralizedContinuedFraction.first_denominator_eq @[simp] theorem zeroth_convergent'_aux_eq_zero {s : Stream'.Seq <| Pair K} : convergents'Aux s 0 = (0 : K) := rfl #align generalized_continued_fraction.zeroth_convergent'_aux_eq_zero GeneralizedContinuedFraction.zeroth_convergent'_aux_eq_zero @[simp] theorem zeroth_convergent'_eq_h : g.convergents' 0 = g.h := by simp [convergents'] #align generalized_continued_fraction.zeroth_convergent'_eq_h GeneralizedContinuedFraction.zeroth_convergent'_eq_h
Mathlib/Algebra/ContinuedFractions/Translations.lean
180
181
theorem convergents'Aux_succ_none {s : Stream'.Seq (Pair K)} (h : s.head = none) (n : ℕ) : convergents'Aux s (n + 1) = 0 := by
simp [convergents'Aux, h, convergents'Aux.match_1]
1
2.718282
0
0.052632
19
240
import Mathlib.Mathport.Rename import Mathlib.Tactic.Lemma import Mathlib.Tactic.TypeStar #align_import data.option.defs from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" namespace Option #align option.lift_or_get Option.liftOrGet protected def traverse.{u, v} {F : Type u → Type v} [Applicative F] {α : Type*} {β : Type u} (f : α → F β) : Option α → F (Option β) | none => pure none | some x => some <$> f x #align option.traverse Option.traverse #align option.maybe Option.sequence #align option.mmap Option.mapM #align option.melim Option.elimM #align option.mget_or_else Option.getDM variable {α : Type*} {β : Type*} -- Porting note: Would need to add the attribute directly in `Init.Prelude`. -- attribute [inline] Option.isSome Option.isNone protected def elim' (b : β) (f : α → β) : Option α → β | some a => f a | none => b #align option.elim Option.elim' @[simp] theorem elim'_none (b : β) (f : α → β) : Option.elim' b f none = b := rfl @[simp] theorem elim'_some {a : α} (b : β) (f : α → β) : Option.elim' b f (some a) = f a := rfl -- Porting note: this lemma was introduced because it is necessary -- in `CategoryTheory.Category.PartialFun` lemma elim'_eq_elim {α β : Type*} (b : β) (f : α → β) (a : Option α) : Option.elim' b f a = Option.elim a b f := by cases a <;> rfl theorem mem_some_iff {α : Type*} {a b : α} : a ∈ some b ↔ b = a := by simp #align option.mem_some_iff Option.mem_some_iff @[inline] def decidableEqNone {o : Option α} : Decidable (o = none) := decidable_of_decidable_of_iff isNone_iff_eq_none #align option.decidable_eq_none Option.decidableEqNone instance decidableForallMem {p : α → Prop} [DecidablePred p] : ∀ o : Option α, Decidable (∀ a ∈ o, p a) | none => isTrue (by simp [false_imp_iff]) | some a => if h : p a then isTrue fun o e ↦ some_inj.1 e ▸ h else isFalse <| mt (fun H ↦ H _ rfl) h instance decidableExistsMem {p : α → Prop} [DecidablePred p] : ∀ o : Option α, Decidable (∃ a ∈ o, p a) | none => isFalse fun ⟨a, ⟨h, _⟩⟩ ↦ by cases h | some a => if h : p a then isTrue <| ⟨_, rfl, h⟩ else isFalse fun ⟨_, ⟨rfl, hn⟩⟩ ↦ h hn abbrev iget [Inhabited α] : Option α → α | some x => x | none => default #align option.iget Option.iget theorem iget_some [Inhabited α] {a : α} : (some a).iget = a := rfl #align option.iget_some Option.iget_some @[simp]
Mathlib/Data/Option/Defs.lean
96
97
theorem mem_toList {a : α} {o : Option α} : a ∈ toList o ↔ a ∈ o := by
cases o <;> simp [toList, eq_comm]
1
2.718282
0
0
2
8
import Mathlib.Algebra.GroupWithZero.Units.Lemmas import Mathlib.Data.Rat.Cast.Defs #align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441" variable {F ι α β : Type*} namespace Rat open Rat section WithDivRing variable [DivisionRing α] @[simp, norm_cast] theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by refine ⟨fun h => ?_, congr_arg _⟩ have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0 have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0 rw [mk'_eq_divInt, mk'_eq_divInt] at h ⊢ rw [cast_divInt_of_ne_zero, cast_divInt_of_ne_zero] at h <;> simp [d₁0, d₂0] at h ⊢ rwa [eq_div_iff_mul_eq d₂a, division_def, mul_assoc, (d₁.cast_commute (d₂ : α)).inv_left₀.eq, ← mul_assoc, ← division_def, eq_comm, eq_div_iff_mul_eq d₁a, eq_comm, ← Int.cast_natCast d₁, ← Int.cast_mul, ← Int.cast_natCast d₂, ← Int.cast_mul, Int.cast_inj, ← mkRat_eq_iff d₁0 d₂0] at h #align rat.cast_inj Rat.cast_inj theorem cast_injective [CharZero α] : Function.Injective ((↑) : ℚ → α) | _, _ => cast_inj.1 #align rat.cast_injective Rat.cast_injective @[simp]
Mathlib/Data/Rat/Cast/CharZero.lean
46
46
theorem cast_eq_zero [CharZero α] {n : ℚ} : (n : α) = 0 ↔ n = 0 := by
rw [← cast_zero, cast_inj]
1
2.718282
0
0
3
196
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
Mathlib/CategoryTheory/Idempotents/Karoubi.lean
97
98
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]
1
2.718282
0
0.625
8
543
import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Analysis.Calculus.Deriv.ZPow import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.SpecialFunctions.NonIntegrable import Mathlib.Analysis.Analytic.Basic #align_import measure_theory.integral.circle_integral from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" variable {E : Type*} [NormedAddCommGroup E] noncomputable section open scoped Real NNReal Interval Pointwise Topology open Complex MeasureTheory TopologicalSpace Metric Function Set Filter Asymptotics def circleMap (c : ℂ) (R : ℝ) : ℝ → ℂ := fun θ => c + R * exp (θ * I) #align circle_map circleMap theorem periodic_circleMap (c : ℂ) (R : ℝ) : Periodic (circleMap c R) (2 * π) := fun θ => by simp [circleMap, add_mul, exp_periodic _] #align periodic_circle_map periodic_circleMap theorem Set.Countable.preimage_circleMap {s : Set ℂ} (hs : s.Countable) (c : ℂ) {R : ℝ} (hR : R ≠ 0) : (circleMap c R ⁻¹' s).Countable := show (((↑) : ℝ → ℂ) ⁻¹' ((· * I) ⁻¹' (exp ⁻¹' ((R * ·) ⁻¹' ((c + ·) ⁻¹' s))))).Countable from (((hs.preimage (add_right_injective _)).preimage <| mul_right_injective₀ <| ofReal_ne_zero.2 hR).preimage_cexp.preimage <| mul_left_injective₀ I_ne_zero).preimage ofReal_injective #align set.countable.preimage_circle_map Set.Countable.preimage_circleMap @[simp] theorem circleMap_sub_center (c : ℂ) (R : ℝ) (θ : ℝ) : circleMap c R θ - c = circleMap 0 R θ := by simp [circleMap] #align circle_map_sub_center circleMap_sub_center theorem circleMap_zero (R θ : ℝ) : circleMap 0 R θ = R * exp (θ * I) := zero_add _ #align circle_map_zero circleMap_zero @[simp] theorem abs_circleMap_zero (R : ℝ) (θ : ℝ) : abs (circleMap 0 R θ) = |R| := by simp [circleMap] #align abs_circle_map_zero abs_circleMap_zero theorem circleMap_mem_sphere' (c : ℂ) (R : ℝ) (θ : ℝ) : circleMap c R θ ∈ sphere c |R| := by simp #align circle_map_mem_sphere' circleMap_mem_sphere' theorem circleMap_mem_sphere (c : ℂ) {R : ℝ} (hR : 0 ≤ R) (θ : ℝ) : circleMap c R θ ∈ sphere c R := by simpa only [_root_.abs_of_nonneg hR] using circleMap_mem_sphere' c R θ #align circle_map_mem_sphere circleMap_mem_sphere theorem circleMap_mem_closedBall (c : ℂ) {R : ℝ} (hR : 0 ≤ R) (θ : ℝ) : circleMap c R θ ∈ closedBall c R := sphere_subset_closedBall (circleMap_mem_sphere c hR θ) #align circle_map_mem_closed_ball circleMap_mem_closedBall theorem circleMap_not_mem_ball (c : ℂ) (R : ℝ) (θ : ℝ) : circleMap c R θ ∉ ball c R := by simp [dist_eq, le_abs_self] #align circle_map_not_mem_ball circleMap_not_mem_ball theorem circleMap_ne_mem_ball {c : ℂ} {R : ℝ} {w : ℂ} (hw : w ∈ ball c R) (θ : ℝ) : circleMap c R θ ≠ w := (ne_of_mem_of_not_mem hw (circleMap_not_mem_ball _ _ _)).symm #align circle_map_ne_mem_ball circleMap_ne_mem_ball @[simp] theorem range_circleMap (c : ℂ) (R : ℝ) : range (circleMap c R) = sphere c |R| := calc range (circleMap c R) = c +ᵥ R • range fun θ : ℝ => exp (θ * I) := by simp (config := { unfoldPartialApp := true }) only [← image_vadd, ← image_smul, ← range_comp, vadd_eq_add, circleMap, Function.comp_def, real_smul] _ = sphere c |R| := by rw [Complex.range_exp_mul_I, smul_sphere R 0 zero_le_one] simp #align range_circle_map range_circleMap @[simp]
Mathlib/MeasureTheory/Integral/CircleIntegral.lean
153
154
theorem image_circleMap_Ioc (c : ℂ) (R : ℝ) : circleMap c R '' Ioc 0 (2 * π) = sphere c |R| := by
rw [← range_circleMap, ← (periodic_circleMap c R).image_Ioc Real.two_pi_pos 0, zero_add]
1
2.718282
0
0.333333
9
352
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
Mathlib/Data/Nat/Choose/Multinomial.lean
102
104
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]
1
2.718282
0
0.777778
9
694
import Mathlib.MeasureTheory.OuterMeasure.Basic open Filter Set open scoped ENNReal namespace MeasureTheory variable {α β F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α] {μ : F} {s t : Set α} def ae (μ : F) : Filter α := .ofCountableUnion (μ · = 0) (fun _S hSc ↦ (measure_sUnion_null_iff hSc).2) fun _t ht _s hs ↦ measure_mono_null hs ht #align measure_theory.measure.ae MeasureTheory.ae notation3 "∀ᵐ "(...)" ∂"μ", "r:(scoped p => Filter.Eventually p <| MeasureTheory.ae μ) => r notation3 "∃ᵐ "(...)" ∂"μ", "r:(scoped P => Filter.Frequently P <| MeasureTheory.ae μ) => r notation:50 f " =ᵐ[" μ:50 "] " g:50 => Filter.EventuallyEq (MeasureTheory.ae μ) f g notation:50 f " ≤ᵐ[" μ:50 "] " g:50 => Filter.EventuallyLE (MeasureTheory.ae μ) f g theorem mem_ae_iff {s : Set α} : s ∈ ae μ ↔ μ sᶜ = 0 := Iff.rfl #align measure_theory.mem_ae_iff MeasureTheory.mem_ae_iff theorem ae_iff {p : α → Prop} : (∀ᵐ a ∂μ, p a) ↔ μ { a | ¬p a } = 0 := Iff.rfl #align measure_theory.ae_iff MeasureTheory.ae_iff theorem compl_mem_ae_iff {s : Set α} : sᶜ ∈ ae μ ↔ μ s = 0 := by simp only [mem_ae_iff, compl_compl] #align measure_theory.compl_mem_ae_iff MeasureTheory.compl_mem_ae_iff theorem frequently_ae_iff {p : α → Prop} : (∃ᵐ a ∂μ, p a) ↔ μ { a | p a } ≠ 0 := not_congr compl_mem_ae_iff #align measure_theory.frequently_ae_iff MeasureTheory.frequently_ae_iff theorem frequently_ae_mem_iff {s : Set α} : (∃ᵐ a ∂μ, a ∈ s) ↔ μ s ≠ 0 := not_congr compl_mem_ae_iff #align measure_theory.frequently_ae_mem_iff MeasureTheory.frequently_ae_mem_iff theorem measure_zero_iff_ae_nmem {s : Set α} : μ s = 0 ↔ ∀ᵐ a ∂μ, a ∉ s := compl_mem_ae_iff.symm #align measure_theory.measure_zero_iff_ae_nmem MeasureTheory.measure_zero_iff_ae_nmem theorem ae_of_all {p : α → Prop} (μ : F) : (∀ a, p a) → ∀ᵐ a ∂μ, p a := eventually_of_forall #align measure_theory.ae_of_all MeasureTheory.ae_of_all instance instCountableInterFilter : CountableInterFilter (ae μ) := by unfold ae; infer_instance #align measure_theory.measure.ae.countable_Inter_filter MeasureTheory.instCountableInterFilter theorem ae_all_iff {ι : Sort*} [Countable ι] {p : α → ι → Prop} : (∀ᵐ a ∂μ, ∀ i, p a i) ↔ ∀ i, ∀ᵐ a ∂μ, p a i := eventually_countable_forall #align measure_theory.ae_all_iff MeasureTheory.ae_all_iff theorem all_ae_of {ι : Sort*} {p : α → ι → Prop} (hp : ∀ᵐ a ∂μ, ∀ i, p a i) (i : ι) : ∀ᵐ a ∂μ, p a i := by filter_upwards [hp] with a ha using ha i lemma ae_iff_of_countable [Countable α] {p : α → Prop} : (∀ᵐ x ∂μ, p x) ↔ ∀ x, μ {x} ≠ 0 → p x := by rw [ae_iff, measure_null_iff_singleton] exacts [forall_congr' fun _ ↦ not_imp_comm, Set.to_countable _] theorem ae_ball_iff {ι : Type*} {S : Set ι} (hS : S.Countable) {p : α → ∀ i ∈ S, Prop} : (∀ᵐ x ∂μ, ∀ i (hi : i ∈ S), p x i hi) ↔ ∀ i (hi : i ∈ S), ∀ᵐ x ∂μ, p x i hi := eventually_countable_ball hS #align measure_theory.ae_ball_iff MeasureTheory.ae_ball_iff theorem ae_eq_refl (f : α → β) : f =ᵐ[μ] f := EventuallyEq.rfl #align measure_theory.ae_eq_refl MeasureTheory.ae_eq_refl theorem ae_eq_symm {f g : α → β} (h : f =ᵐ[μ] g) : g =ᵐ[μ] f := h.symm #align measure_theory.ae_eq_symm MeasureTheory.ae_eq_symm theorem ae_eq_trans {f g h : α → β} (h₁ : f =ᵐ[μ] g) (h₂ : g =ᵐ[μ] h) : f =ᵐ[μ] h := h₁.trans h₂ #align measure_theory.ae_eq_trans MeasureTheory.ae_eq_trans theorem ae_le_of_ae_lt {β : Type*} [Preorder β] {f g : α → β} (h : ∀ᵐ x ∂μ, f x < g x) : f ≤ᵐ[μ] g := h.mono fun _ ↦ le_of_lt #align measure_theory.ae_le_of_ae_lt MeasureTheory.ae_le_of_ae_lt @[simp] theorem ae_eq_empty : s =ᵐ[μ] (∅ : Set α) ↔ μ s = 0 := eventuallyEq_empty.trans <| by simp only [ae_iff, Classical.not_not, setOf_mem_eq] #align measure_theory.ae_eq_empty MeasureTheory.ae_eq_empty -- Porting note: The priority should be higher than `eventuallyEq_univ`. @[simp high] theorem ae_eq_univ : s =ᵐ[μ] (univ : Set α) ↔ μ sᶜ = 0 := eventuallyEq_univ #align measure_theory.ae_eq_univ MeasureTheory.ae_eq_univ
Mathlib/MeasureTheory/OuterMeasure/AE.lean
148
151
theorem ae_le_set : s ≤ᵐ[μ] t ↔ μ (s \ t) = 0 := calc s ≤ᵐ[μ] t ↔ ∀ᵐ x ∂μ, x ∈ s → x ∈ t := Iff.rfl _ ↔ μ (s \ t) = 0 := by
simp [ae_iff]; rfl
1
2.718282
0
0
3
73
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Data.Matrix.Basis import Mathlib.Data.Matrix.DMatrix import Mathlib.RingTheory.MatrixAlgebra #align_import ring_theory.polynomial_algebra from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" universe u v w open Polynomial TensorProduct open Algebra.TensorProduct (algHomOfLinearMapTensorProduct includeLeft) noncomputable section variable (R A : Type*) variable [CommSemiring R] variable [Semiring A] [Algebra R A] namespace PolyEquivTensor -- Porting note: was `@[simps apply_apply]` @[simps! apply_apply] def toFunBilinear : A →ₗ[A] R[X] →ₗ[R] A[X] := LinearMap.toSpanSingleton A _ (aeval (Polynomial.X : A[X])).toLinearMap #align poly_equiv_tensor.to_fun_bilinear PolyEquivTensor.toFunBilinear theorem toFunBilinear_apply_eq_sum (a : A) (p : R[X]) : toFunBilinear R A a p = p.sum fun n r => monomial n (a * algebraMap R A r) := by simp only [toFunBilinear_apply_apply, aeval_def, eval₂_eq_sum, Polynomial.sum, Finset.smul_sum] congr with i : 1 rw [← Algebra.smul_def, ← C_mul', mul_smul_comm, C_mul_X_pow_eq_monomial, ← Algebra.commutes, ← Algebra.smul_def, smul_monomial] #align poly_equiv_tensor.to_fun_bilinear_apply_eq_sum PolyEquivTensor.toFunBilinear_apply_eq_sum def toFunLinear : A ⊗[R] R[X] →ₗ[R] A[X] := TensorProduct.lift (toFunBilinear R A) #align poly_equiv_tensor.to_fun_linear PolyEquivTensor.toFunLinear @[simp] theorem toFunLinear_tmul_apply (a : A) (p : R[X]) : toFunLinear R A (a ⊗ₜ[R] p) = toFunBilinear R A a p := rfl #align poly_equiv_tensor.to_fun_linear_tmul_apply PolyEquivTensor.toFunLinear_tmul_apply -- We apparently need to provide the decidable instance here -- in order to successfully rewrite by this lemma. theorem toFunLinear_mul_tmul_mul_aux_1 (p : R[X]) (k : ℕ) (h : Decidable ¬p.coeff k = 0) (a : A) : ite (¬coeff p k = 0) (a * (algebraMap R A) (coeff p k)) 0 = a * (algebraMap R A) (coeff p k) := by classical split_ifs <;> simp [*] #align poly_equiv_tensor.to_fun_linear_mul_tmul_mul_aux_1 PolyEquivTensor.toFunLinear_mul_tmul_mul_aux_1 theorem toFunLinear_mul_tmul_mul_aux_2 (k : ℕ) (a₁ a₂ : A) (p₁ p₂ : R[X]) : a₁ * a₂ * (algebraMap R A) ((p₁ * p₂).coeff k) = (Finset.antidiagonal k).sum fun x => a₁ * (algebraMap R A) (coeff p₁ x.1) * (a₂ * (algebraMap R A) (coeff p₂ x.2)) := by simp_rw [mul_assoc, Algebra.commutes, ← Finset.mul_sum, mul_assoc, ← Finset.mul_sum] congr simp_rw [Algebra.commutes (coeff p₂ _), coeff_mul, map_sum, RingHom.map_mul] #align poly_equiv_tensor.to_fun_linear_mul_tmul_mul_aux_2 PolyEquivTensor.toFunLinear_mul_tmul_mul_aux_2 theorem toFunLinear_mul_tmul_mul (a₁ a₂ : A) (p₁ p₂ : R[X]) : (toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) = (toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * (toFunLinear R A) (a₂ ⊗ₜ[R] p₂) := by classical simp only [toFunLinear_tmul_apply, toFunBilinear_apply_eq_sum] ext k simp_rw [coeff_sum, coeff_monomial, sum_def, Finset.sum_ite_eq', mem_support_iff, Ne] conv_rhs => rw [coeff_mul] simp_rw [finset_sum_coeff, coeff_monomial, Finset.sum_ite_eq', mem_support_iff, Ne, mul_ite, mul_zero, ite_mul, zero_mul] simp_rw [← ite_zero_mul (¬coeff p₁ _ = 0) (a₁ * (algebraMap R A) (coeff p₁ _))] simp_rw [← mul_ite_zero (¬coeff p₂ _ = 0) _ (_ * _)] simp_rw [toFunLinear_mul_tmul_mul_aux_1, toFunLinear_mul_tmul_mul_aux_2] #align poly_equiv_tensor.to_fun_linear_mul_tmul_mul PolyEquivTensor.toFunLinear_mul_tmul_mul
Mathlib/RingTheory/PolynomialAlgebra.lean
109
111
theorem toFunLinear_one_tmul_one : toFunLinear R A (1 ⊗ₜ[R] 1) = 1 := by
rw [toFunLinear_tmul_apply, toFunBilinear_apply_apply, Polynomial.aeval_one, one_smul]
1
2.718282
0
0.833333
6
728
import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Combinatorics.Additive.AP.Three.Defs import Mathlib.Combinatorics.Pigeonhole import Mathlib.Data.Complex.ExponentialBounds #align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" open Nat hiding log open Finset Metric Real open scoped Pointwise lemma threeAPFree_frontier {𝕜 E : Type*} [LinearOrderedField 𝕜] [TopologicalSpace E] [AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) : ThreeAPFree (frontier s) := by intro a ha b hb c hc habc obtain rfl : (1 / 2 : 𝕜) • a + (1 / 2 : 𝕜) • c = b := by rwa [← smul_add, one_div, inv_smul_eq_iff₀ (show (2 : 𝕜) ≠ 0 by norm_num), two_smul] have := hs₁.eq (hs₀.frontier_subset ha) (hs₀.frontier_subset hc) one_half_pos one_half_pos (add_halves _) hb.2 simp [this, ← add_smul] ring_nf simp #align add_salem_spencer_frontier threeAPFree_frontier lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by obtain rfl | hr := eq_or_ne r 0 · rw [sphere_zero] exact threeAPFree_singleton _ · convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r) exact (frontier_closedBall _ hr).symm #align add_salem_spencer_sphere threeAPFree_sphere namespace Behrend variable {α β : Type*} {n d k N : ℕ} {x : Fin n → ℕ} def box (n d : ℕ) : Finset (Fin n → ℕ) := Fintype.piFinset fun _ => range d #align behrend.box Behrend.box theorem mem_box : x ∈ box n d ↔ ∀ i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range] #align behrend.mem_box Behrend.mem_box @[simp] theorem card_box : (box n d).card = d ^ n := by simp [box] #align behrend.card_box Behrend.card_box @[simp]
Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean
105
105
theorem box_zero : box (n + 1) 0 = ∅ := by
simp [box]
1
2.718282
0
0.125
8
252
import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Data.Nat.SuccPred #align_import set_theory.ordinal.arithmetic from "leanprover-community/mathlib"@"31b269b60935483943542d547a6dd83a66b37dc7" assert_not_exists Field assert_not_exists Module noncomputable section open Function Cardinal Set Equiv Order open scoped Classical open Cardinal Ordinal universe u v w namespace Ordinal variable {α : Type*} {β : Type*} {γ : Type*} {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} @[simp] theorem lift_add (a b : Ordinal.{v}) : lift.{u} (a + b) = lift.{u} a + lift.{u} b := Quotient.inductionOn₂ a b fun ⟨_α, _r, _⟩ ⟨_β, _s, _⟩ => Quotient.sound ⟨(RelIso.preimage Equiv.ulift _).trans (RelIso.sumLexCongr (RelIso.preimage Equiv.ulift _) (RelIso.preimage Equiv.ulift _)).symm⟩ #align ordinal.lift_add Ordinal.lift_add @[simp] theorem lift_succ (a : Ordinal.{v}) : lift.{u} (succ a) = succ (lift.{u} a) := by rw [← add_one_eq_succ, lift_add, lift_one] rfl #align ordinal.lift_succ Ordinal.lift_succ instance add_contravariantClass_le : ContravariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· ≤ ·) := ⟨fun a b c => inductionOn a fun α r hr => inductionOn b fun β₁ s₁ hs₁ => inductionOn c fun β₂ s₂ hs₂ ⟨f⟩ => ⟨have fl : ∀ a, f (Sum.inl a) = Sum.inl a := fun a => by simpa only [InitialSeg.trans_apply, InitialSeg.leAdd_apply] using @InitialSeg.eq _ _ _ _ _ ((InitialSeg.leAdd r s₁).trans f) (InitialSeg.leAdd r s₂) a have : ∀ b, { b' // f (Sum.inr b) = Sum.inr b' } := by intro b; cases e : f (Sum.inr b) · rw [← fl] at e have := f.inj' e contradiction · exact ⟨_, rfl⟩ let g (b) := (this b).1 have fr : ∀ b, f (Sum.inr b) = Sum.inr (g b) := fun b => (this b).2 ⟨⟨⟨g, fun x y h => by injection f.inj' (by rw [fr, fr, h] : f (Sum.inr x) = f (Sum.inr y))⟩, @fun a b => by -- Porting note: -- `relEmbedding.coe_fn_to_embedding` & `initial_seg.coe_fn_to_rel_embedding` -- → `InitialSeg.coe_coe_fn` simpa only [Sum.lex_inr_inr, fr, InitialSeg.coe_coe_fn, Embedding.coeFn_mk] using @RelEmbedding.map_rel_iff _ _ _ _ f.toRelEmbedding (Sum.inr a) (Sum.inr b)⟩, fun a b H => by rcases f.init (by rw [fr] <;> exact Sum.lex_inr_inr.2 H) with ⟨a' | a', h⟩ · rw [fl] at h cases h · rw [fr] at h exact ⟨a', Sum.inr.inj h⟩⟩⟩⟩ #align ordinal.add_contravariant_class_le Ordinal.add_contravariantClass_le theorem add_left_cancel (a) {b c : Ordinal} : a + b = a + c ↔ b = c := by simp only [le_antisymm_iff, add_le_add_iff_left] #align ordinal.add_left_cancel Ordinal.add_left_cancel private theorem add_lt_add_iff_left' (a) {b c : Ordinal} : a + b < a + c ↔ b < c := by rw [← not_le, ← not_le, add_le_add_iff_left] instance add_covariantClass_lt : CovariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· < ·) := ⟨fun a _b _c => (add_lt_add_iff_left' a).2⟩ #align ordinal.add_covariant_class_lt Ordinal.add_covariantClass_lt instance add_contravariantClass_lt : ContravariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· < ·) := ⟨fun a _b _c => (add_lt_add_iff_left' a).1⟩ #align ordinal.add_contravariant_class_lt Ordinal.add_contravariantClass_lt instance add_swap_contravariantClass_lt : ContravariantClass Ordinal.{u} Ordinal.{u} (swap (· + ·)) (· < ·) := ⟨fun _a _b _c => lt_imp_lt_of_le_imp_le fun h => add_le_add_right h _⟩ #align ordinal.add_swap_contravariant_class_lt Ordinal.add_swap_contravariantClass_lt theorem add_le_add_iff_right {a b : Ordinal} : ∀ n : ℕ, a + n ≤ b + n ↔ a ≤ b | 0 => by simp | n + 1 => by simp only [natCast_succ, add_succ, add_succ, succ_le_succ_iff, add_le_add_iff_right] #align ordinal.add_le_add_iff_right Ordinal.add_le_add_iff_right
Mathlib/SetTheory/Ordinal/Arithmetic.lean
145
146
theorem add_right_cancel {a b : Ordinal} (n : ℕ) : a + n = b + n ↔ a = b := by
simp only [le_antisymm_iff, add_le_add_iff_right]
1
2.718282
0
0.333333
3
349
import Mathlib.Algebra.PUnitInstances import Mathlib.Tactic.Abel import Mathlib.Tactic.Ring import Mathlib.Order.Hom.Lattice #align_import algebra.ring.boolean_ring from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open scoped symmDiff variable {α β γ : Type*} class BooleanRing (α) extends Ring α where mul_self : ∀ a : α, a * a = a #align boolean_ring BooleanRing section BooleanRing variable [BooleanRing α] (a b : α) instance : Std.IdempotentOp (α := α) (· * ·) := ⟨BooleanRing.mul_self⟩ @[simp] theorem mul_self : a * a = a := BooleanRing.mul_self _ #align mul_self mul_self @[simp] theorem add_self : a + a = 0 := by have : a + a = a + a + (a + a) := calc a + a = (a + a) * (a + a) := by rw [mul_self] _ = a * a + a * a + (a * a + a * a) := by rw [add_mul, mul_add] _ = a + a + (a + a) := by rw [mul_self] rwa [self_eq_add_left] at this #align add_self add_self @[simp] theorem neg_eq : -a = a := calc -a = -a + 0 := by rw [add_zero] _ = -a + -a + a := by rw [← neg_add_self, add_assoc] _ = a := by rw [add_self, zero_add] #align neg_eq neg_eq
Mathlib/Algebra/Ring/BooleanRing.lean
83
86
theorem add_eq_zero' : a + b = 0 ↔ a = b := calc a + b = 0 ↔ a = -b := add_eq_zero_iff_eq_neg _ ↔ a = b := by
rw [neg_eq]
1
2.718282
0
0.833333
6
724
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat import Mathlib.RepresentationTheory.GroupCohomology.Basic import Mathlib.RepresentationTheory.Invariants universe v u noncomputable section open CategoryTheory Limits Representation variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G) namespace groupCohomology section IsMulCocycle section variable {G M : Type*} [Mul G] [CommGroup M] [SMul G M] def IsMulOneCocycle (f : G → M) : Prop := ∀ g h : G, f (g * h) = g • f h * f g def IsMulTwoCocycle (f : G × G → M) : Prop := ∀ g h j : G, f (g * h, j) * f (g, h) = g • (f (h, j)) * f (g, h * j) end section variable {G M : Type*} [Monoid G] [CommGroup M] [MulAction G M]
Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean
524
526
theorem map_one_of_isMulOneCocycle {f : G → M} (hf : IsMulOneCocycle f) : f 1 = 1 := by
simpa only [mul_one, one_smul, self_eq_mul_right] using hf 1 1
1
2.718282
0
0.333333
9
355
import Mathlib.Analysis.Convex.Basic import Mathlib.Analysis.Convex.Hull import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Topology.Bornology.Absorbs #align_import analysis.locally_convex.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set open Pointwise Topology variable {𝕜 𝕝 E : Type*} {ι : Sort*} {κ : ι → Sort*} section SeminormedRing variable [SeminormedRing 𝕜] section SMul variable [SMul 𝕜 E] {s t u v A B : Set E} variable (𝕜) def Balanced (A : Set E) := ∀ a : 𝕜, ‖a‖ ≤ 1 → a • A ⊆ A #align balanced Balanced variable {𝕜} lemma absorbs_iff_norm : Absorbs 𝕜 A B ↔ ∃ r, ∀ c : 𝕜, r ≤ ‖c‖ → B ⊆ c • A := Filter.atTop_basis.cobounded_of_norm.eventually_iff.trans <| by simp only [true_and]; rfl alias ⟨_, Absorbs.of_norm⟩ := absorbs_iff_norm lemma Absorbs.exists_pos (h : Absorbs 𝕜 A B) : ∃ r > 0, ∀ c : 𝕜, r ≤ ‖c‖ → B ⊆ c • A := let ⟨r, hr₁, hr⟩ := (Filter.atTop_basis' 1).cobounded_of_norm.eventually_iff.1 h ⟨r, one_pos.trans_le hr₁, hr⟩ theorem balanced_iff_smul_mem : Balanced 𝕜 s ↔ ∀ ⦃a : 𝕜⦄, ‖a‖ ≤ 1 → ∀ ⦃x : E⦄, x ∈ s → a • x ∈ s := forall₂_congr fun _a _ha => smul_set_subset_iff #align balanced_iff_smul_mem balanced_iff_smul_mem alias ⟨Balanced.smul_mem, _⟩ := balanced_iff_smul_mem #align balanced.smul_mem Balanced.smul_mem
Mathlib/Analysis/LocallyConvex/Basic.lean
81
82
theorem balanced_iff_closedBall_smul : Balanced 𝕜 s ↔ Metric.closedBall (0 : 𝕜) 1 • s ⊆ s := by
simp [balanced_iff_smul_mem, smul_subset_iff]
1
2.718282
0
0
1
219
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.deriv.add from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter ENNReal open Filter Asymptotics Set variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L : Filter 𝕜} section Add nonrec theorem HasDerivAtFilter.add (hf : HasDerivAtFilter f f' x L) (hg : HasDerivAtFilter g g' x L) : HasDerivAtFilter (fun y => f y + g y) (f' + g') x L := by simpa using (hf.add hg).hasDerivAtFilter #align has_deriv_at_filter.add HasDerivAtFilter.add nonrec theorem HasStrictDerivAt.add (hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) : HasStrictDerivAt (fun y => f y + g y) (f' + g') x := by simpa using (hf.add hg).hasStrictDerivAt #align has_strict_deriv_at.add HasStrictDerivAt.add nonrec theorem HasDerivWithinAt.add (hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (fun y => f y + g y) (f' + g') s x := hf.add hg #align has_deriv_within_at.add HasDerivWithinAt.add nonrec theorem HasDerivAt.add (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) : HasDerivAt (fun x => f x + g x) (f' + g') x := hf.add hg #align has_deriv_at.add HasDerivAt.add theorem derivWithin_add (hxs : UniqueDiffWithinAt 𝕜 s x) (hf : DifferentiableWithinAt 𝕜 f s x) (hg : DifferentiableWithinAt 𝕜 g s x) : derivWithin (fun y => f y + g y) s x = derivWithin f s x + derivWithin g s x := (hf.hasDerivWithinAt.add hg.hasDerivWithinAt).derivWithin hxs #align deriv_within_add derivWithin_add @[simp] theorem deriv_add (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : deriv (fun y => f y + g y) x = deriv f x + deriv g x := (hf.hasDerivAt.add hg.hasDerivAt).deriv #align deriv_add deriv_add -- Porting note (#10756): new theorem theorem HasStrictDerivAt.add_const (c : F) (hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (fun y ↦ f y + c) f' x := add_zero f' ▸ hf.add (hasStrictDerivAt_const x c) theorem HasDerivAtFilter.add_const (hf : HasDerivAtFilter f f' x L) (c : F) : HasDerivAtFilter (fun y => f y + c) f' x L := add_zero f' ▸ hf.add (hasDerivAtFilter_const x L c) #align has_deriv_at_filter.add_const HasDerivAtFilter.add_const nonrec theorem HasDerivWithinAt.add_const (hf : HasDerivWithinAt f f' s x) (c : F) : HasDerivWithinAt (fun y => f y + c) f' s x := hf.add_const c #align has_deriv_within_at.add_const HasDerivWithinAt.add_const nonrec theorem HasDerivAt.add_const (hf : HasDerivAt f f' x) (c : F) : HasDerivAt (fun x => f x + c) f' x := hf.add_const c #align has_deriv_at.add_const HasDerivAt.add_const theorem derivWithin_add_const (hxs : UniqueDiffWithinAt 𝕜 s x) (c : F) : derivWithin (fun y => f y + c) s x = derivWithin f s x := by simp only [derivWithin, fderivWithin_add_const hxs] #align deriv_within_add_const derivWithin_add_const theorem deriv_add_const (c : F) : deriv (fun y => f y + c) x = deriv f x := by simp only [deriv, fderiv_add_const] #align deriv_add_const deriv_add_const @[simp] theorem deriv_add_const' (c : F) : (deriv fun y => f y + c) = deriv f := funext fun _ => deriv_add_const c #align deriv_add_const' deriv_add_const' -- Porting note (#10756): new theorem theorem HasStrictDerivAt.const_add (c : F) (hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (fun y ↦ c + f y) f' x := zero_add f' ▸ (hasStrictDerivAt_const x c).add hf theorem HasDerivAtFilter.const_add (c : F) (hf : HasDerivAtFilter f f' x L) : HasDerivAtFilter (fun y => c + f y) f' x L := zero_add f' ▸ (hasDerivAtFilter_const x L c).add hf #align has_deriv_at_filter.const_add HasDerivAtFilter.const_add nonrec theorem HasDerivWithinAt.const_add (c : F) (hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (fun y => c + f y) f' s x := hf.const_add c #align has_deriv_within_at.const_add HasDerivWithinAt.const_add nonrec theorem HasDerivAt.const_add (c : F) (hf : HasDerivAt f f' x) : HasDerivAt (fun x => c + f x) f' x := hf.const_add c #align has_deriv_at.const_add HasDerivAt.const_add
Mathlib/Analysis/Calculus/Deriv/Add.lean
131
133
theorem derivWithin_const_add (hxs : UniqueDiffWithinAt 𝕜 s x) (c : F) : derivWithin (fun y => c + f y) s x = derivWithin f s x := by
simp only [derivWithin, fderivWithin_const_add hxs]
1
2.718282
0
0
8
26
import Mathlib.Data.Finset.Option import Mathlib.Data.PFun import Mathlib.Data.Part #align_import data.finset.pimage from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α β : Type*} namespace Part def toFinset (o : Part α) [Decidable o.Dom] : Finset α := o.toOption.toFinset #align part.to_finset Part.toFinset @[simp] theorem mem_toFinset {o : Part α} [Decidable o.Dom] {x : α} : x ∈ o.toFinset ↔ x ∈ o := by simp [toFinset] #align part.mem_to_finset Part.mem_toFinset @[simp]
Mathlib/Data/Finset/PImage.lean
39
40
theorem toFinset_none [Decidable (none : Part α).Dom] : none.toFinset = (∅ : Finset α) := by
simp [toFinset]
1
2.718282
0
0
3
101
import Mathlib.Tactic.TFAE import Mathlib.Topology.ContinuousOn #align_import topology.inseparable from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Set Filter Function Topology List variable {X Y Z α ι : Type*} {π : ι → Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] [∀ i, TopologicalSpace (π i)] {x y z : X} {s : Set X} {f g : X → Y} theorem specializes_TFAE (x y : X) : TFAE [x ⤳ y, pure x ≤ 𝓝 y, ∀ s : Set X , IsOpen s → y ∈ s → x ∈ s, ∀ s : Set X , IsClosed s → x ∈ s → y ∈ s, y ∈ closure ({ x } : Set X), closure ({ y } : Set X) ⊆ closure { x }, ClusterPt y (pure x)] := by tfae_have 1 → 2 · exact (pure_le_nhds _).trans tfae_have 2 → 3 · exact fun h s hso hy => h (hso.mem_nhds hy) tfae_have 3 → 4 · exact fun h s hsc hx => of_not_not fun hy => h sᶜ hsc.isOpen_compl hy hx tfae_have 4 → 5 · exact fun h => h _ isClosed_closure (subset_closure <| mem_singleton _) tfae_have 6 ↔ 5 · exact isClosed_closure.closure_subset_iff.trans singleton_subset_iff tfae_have 5 ↔ 7 · rw [mem_closure_iff_clusterPt, principal_singleton] tfae_have 5 → 1 · refine fun h => (nhds_basis_opens _).ge_iff.2 ?_ rintro s ⟨hy, ho⟩ rcases mem_closure_iff.1 h s ho hy with ⟨z, hxs, rfl : z = x⟩ exact ho.mem_nhds hxs tfae_finish #align specializes_tfae specializes_TFAE theorem specializes_iff_nhds : x ⤳ y ↔ 𝓝 x ≤ 𝓝 y := Iff.rfl #align specializes_iff_nhds specializes_iff_nhds theorem Specializes.not_disjoint (h : x ⤳ y) : ¬Disjoint (𝓝 x) (𝓝 y) := fun hd ↦ absurd (hd.mono_right h) <| by simp [NeBot.ne'] theorem specializes_iff_pure : x ⤳ y ↔ pure x ≤ 𝓝 y := (specializes_TFAE x y).out 0 1 #align specializes_iff_pure specializes_iff_pure alias ⟨Specializes.nhds_le_nhds, _⟩ := specializes_iff_nhds #align specializes.nhds_le_nhds Specializes.nhds_le_nhds alias ⟨Specializes.pure_le_nhds, _⟩ := specializes_iff_pure #align specializes.pure_le_nhds Specializes.pure_le_nhds
Mathlib/Topology/Inseparable.lean
95
96
theorem ker_nhds_eq_specializes : (𝓝 x).ker = {y | y ⤳ x} := by
ext; simp [specializes_iff_pure, le_def]
1
2.718282
0
1
2
1,094
import Mathlib.LinearAlgebra.Quotient import Mathlib.Algebra.Category.ModuleCat.Basic #align_import algebra.category.Module.epi_mono from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v u open CategoryTheory namespace ModuleCat variable {R : Type u} [Ring R] {X Y : ModuleCat.{v} R} (f : X ⟶ Y) variable {M : Type v} [AddCommGroup M] [Module R M] theorem ker_eq_bot_of_mono [Mono f] : LinearMap.ker f = ⊥ := LinearMap.ker_eq_bot_of_cancel fun u v => (@cancel_mono _ _ _ _ _ f _ (↟u) (↟v)).1 set_option linter.uppercaseLean3 false in #align Module.ker_eq_bot_of_mono ModuleCat.ker_eq_bot_of_mono theorem range_eq_top_of_epi [Epi f] : LinearMap.range f = ⊤ := LinearMap.range_eq_top_of_cancel fun u v => (@cancel_epi _ _ _ _ _ f _ (↟u) (↟v)).1 set_option linter.uppercaseLean3 false in #align Module.range_eq_top_of_epi ModuleCat.range_eq_top_of_epi theorem mono_iff_ker_eq_bot : Mono f ↔ LinearMap.ker f = ⊥ := ⟨fun hf => ker_eq_bot_of_mono _, fun hf => ConcreteCategory.mono_of_injective _ <| by convert LinearMap.ker_eq_bot.1 hf⟩ set_option linter.uppercaseLean3 false in #align Module.mono_iff_ker_eq_bot ModuleCat.mono_iff_ker_eq_bot theorem mono_iff_injective : Mono f ↔ Function.Injective f := by rw [mono_iff_ker_eq_bot, LinearMap.ker_eq_bot] set_option linter.uppercaseLean3 false in #align Module.mono_iff_injective ModuleCat.mono_iff_injective theorem epi_iff_range_eq_top : Epi f ↔ LinearMap.range f = ⊤ := ⟨fun _ => range_eq_top_of_epi _, fun hf => ConcreteCategory.epi_of_surjective _ <| LinearMap.range_eq_top.1 hf⟩ set_option linter.uppercaseLean3 false in #align Module.epi_iff_range_eq_top ModuleCat.epi_iff_range_eq_top
Mathlib/Algebra/Category/ModuleCat/EpiMono.lean
55
56
theorem epi_iff_surjective : Epi f ↔ Function.Surjective f := by
rw [epi_iff_range_eq_top, LinearMap.range_eq_top]
1
2.718282
0
0
2
18
import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.RingTheory.MvPolynomial.Basic #align_import field_theory.mv_polynomial from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f" noncomputable section open scoped Classical open Set LinearMap Submodule namespace MvPolynomial universe u variable {σ : Type u} {K : Type u} [Field K] open scoped Classical
Mathlib/FieldTheory/MvPolynomial.lean
54
55
theorem rank_mvPolynomial : Module.rank K (MvPolynomial σ K) = Cardinal.mk (σ →₀ ℕ) := by
rw [← Cardinal.lift_inj, ← (basisMonomials σ K).mk_eq_rank]
1
2.718282
0
1
2
864
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S ℕ] [MulActionWithZero R S] (x : S) def smul_pow : ℕ → R → S := fun n r => r • x^n irreducible_def smeval : S := p.sum (smul_pow x)
Mathlib/Algebra/Polynomial/Smeval.lean
54
54
theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by
rw [smeval_def]
1
2.718282
0
0.333333
9
368
import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.Monoidal.Free.Coherence #align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe" open CategoryTheory Category Iso namespace CategoryTheory.MonoidalCategory variable {C : Type*} [Category C] [MonoidalCategory C] -- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf> @[reassoc] theorem leftUnitor_tensor'' (X Y : C) : (α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y := by coherence #align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor'' @[reassoc] theorem leftUnitor_tensor' (X Y : C) : (λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y) := by coherence #align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor' @[reassoc] theorem leftUnitor_tensor_inv' (X Y : C) : (λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by coherence #align category_theory.monoidal_category.left_unitor_tensor_inv CategoryTheory.MonoidalCategory.leftUnitor_tensor_inv' @[reassoc] theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by coherence #align category_theory.monoidal_category.id_tensor_right_unitor_inv CategoryTheory.MonoidalCategory.id_tensor_rightUnitor_inv @[reassoc] theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by coherence #align category_theory.monoidal_category.left_unitor_inv_tensor_id CategoryTheory.MonoidalCategory.leftUnitor_inv_tensor_id @[reassoc] theorem pentagon_inv_inv_hom (W X Y Z : C) : (α_ W (X ⊗ Y) Z).inv ≫ ((α_ W X Y).inv ⊗ 𝟙 Z) ≫ (α_ (W ⊗ X) Y Z).hom = (𝟙 W ⊗ (α_ X Y Z).hom) ≫ (α_ W X (Y ⊗ Z)).inv := by coherence #align category_theory.monoidal_category.pentagon_inv_inv_hom CategoryTheory.MonoidalCategory.pentagon_inv_inv_hom theorem unitors_equal : (λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom := by coherence #align category_theory.monoidal_category.unitors_equal CategoryTheory.MonoidalCategory.unitors_equal
Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean
67
68
theorem unitors_inv_equal : (λ_ (𝟙_ C)).inv = (ρ_ (𝟙_ C)).inv := by
coherence
1
2.718282
0
0
10
21
import Mathlib.MeasureTheory.Integral.Bochner import Mathlib.MeasureTheory.Group.Measure #align_import measure_theory.group.integration from "leanprover-community/mathlib"@"ec247d43814751ffceb33b758e8820df2372bf6f" namespace MeasureTheory open Measure TopologicalSpace open scoped ENNReal variable {𝕜 M α G E F : Type*} [MeasurableSpace G] variable [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] variable {μ : Measure G} {f : G → E} {g : G} section MeasurableMul variable [Group G] [MeasurableMul G] @[to_additive "Translating a function by left-addition does not change its integral with respect to a left-invariant measure."] -- Porting note: was `@[simp]` theorem integral_mul_left_eq_self [IsMulLeftInvariant μ] (f : G → E) (g : G) : (∫ x, f (g * x) ∂μ) = ∫ x, f x ∂μ := by have h_mul : MeasurableEmbedding fun x => g * x := (MeasurableEquiv.mulLeft g).measurableEmbedding rw [← h_mul.integral_map, map_mul_left_eq_self] #align measure_theory.integral_mul_left_eq_self MeasureTheory.integral_mul_left_eq_self #align measure_theory.integral_add_left_eq_self MeasureTheory.integral_add_left_eq_self @[to_additive "Translating a function by right-addition does not change its integral with respect to a right-invariant measure."] -- Porting note: was `@[simp]` theorem integral_mul_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) : (∫ x, f (x * g) ∂μ) = ∫ x, f x ∂μ := by have h_mul : MeasurableEmbedding fun x => x * g := (MeasurableEquiv.mulRight g).measurableEmbedding rw [← h_mul.integral_map, map_mul_right_eq_self] #align measure_theory.integral_mul_right_eq_self MeasureTheory.integral_mul_right_eq_self #align measure_theory.integral_add_right_eq_self MeasureTheory.integral_add_right_eq_self @[to_additive] -- Porting note: was `@[simp]` theorem integral_div_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) : (∫ x, f (x / g) ∂μ) = ∫ x, f x ∂μ := by simp_rw [div_eq_mul_inv] -- Porting note: was `simp_rw` rw [integral_mul_right_eq_self f g⁻¹] #align measure_theory.integral_div_right_eq_self MeasureTheory.integral_div_right_eq_self #align measure_theory.integral_sub_right_eq_self MeasureTheory.integral_sub_right_eq_self @[to_additive "If some left-translate of a function negates it, then the integral of the function with respect to a left-invariant measure is 0."]
Mathlib/MeasureTheory/Group/Integral.lean
92
94
theorem integral_eq_zero_of_mul_left_eq_neg [IsMulLeftInvariant μ] (hf' : ∀ x, f (g * x) = -f x) : ∫ x, f x ∂μ = 0 := by
simp_rw [← self_eq_neg ℝ E, ← integral_neg, ← hf', integral_mul_left_eq_self]
1
2.718282
0
0.75
8
660
import Mathlib.Data.Multiset.Dedup #align_import data.multiset.finset_ops from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" namespace Multiset open List variable {α : Type*} [DecidableEq α] {s : Multiset α} def ndinsert (a : α) (s : Multiset α) : Multiset α := Quot.liftOn s (fun l => (l.insert a : Multiset α)) fun _ _ p => Quot.sound (p.insert a) #align multiset.ndinsert Multiset.ndinsert @[simp] theorem coe_ndinsert (a : α) (l : List α) : ndinsert a l = (insert a l : List α) := rfl #align multiset.coe_ndinsert Multiset.coe_ndinsert @[simp, nolint simpNF] -- Porting note (#10675): dsimp can not prove this theorem ndinsert_zero (a : α) : ndinsert a 0 = {a} := rfl #align multiset.ndinsert_zero Multiset.ndinsert_zero @[simp] theorem ndinsert_of_mem {a : α} {s : Multiset α} : a ∈ s → ndinsert a s = s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_mem h #align multiset.ndinsert_of_mem Multiset.ndinsert_of_mem @[simp] theorem ndinsert_of_not_mem {a : α} {s : Multiset α} : a ∉ s → ndinsert a s = a ::ₘ s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_not_mem h #align multiset.ndinsert_of_not_mem Multiset.ndinsert_of_not_mem @[simp] theorem mem_ndinsert {a b : α} {s : Multiset α} : a ∈ ndinsert b s ↔ a = b ∨ a ∈ s := Quot.inductionOn s fun _ => mem_insert_iff #align multiset.mem_ndinsert Multiset.mem_ndinsert @[simp] theorem le_ndinsert_self (a : α) (s : Multiset α) : s ≤ ndinsert a s := Quot.inductionOn s fun _ => (sublist_insert _ _).subperm #align multiset.le_ndinsert_self Multiset.le_ndinsert_self -- Porting note: removing @[simp], simp can prove it theorem mem_ndinsert_self (a : α) (s : Multiset α) : a ∈ ndinsert a s := mem_ndinsert.2 (Or.inl rfl) #align multiset.mem_ndinsert_self Multiset.mem_ndinsert_self theorem mem_ndinsert_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ ndinsert b s := mem_ndinsert.2 (Or.inr h) #align multiset.mem_ndinsert_of_mem Multiset.mem_ndinsert_of_mem @[simp] theorem length_ndinsert_of_mem {a : α} {s : Multiset α} (h : a ∈ s) : card (ndinsert a s) = card s := by simp [h] #align multiset.length_ndinsert_of_mem Multiset.length_ndinsert_of_mem @[simp] theorem length_ndinsert_of_not_mem {a : α} {s : Multiset α} (h : a ∉ s) : card (ndinsert a s) = card s + 1 := by simp [h] #align multiset.length_ndinsert_of_not_mem Multiset.length_ndinsert_of_not_mem theorem dedup_cons {a : α} {s : Multiset α} : dedup (a ::ₘ s) = ndinsert a (dedup s) := by by_cases h : a ∈ s <;> simp [h] #align multiset.dedup_cons Multiset.dedup_cons theorem Nodup.ndinsert (a : α) : Nodup s → Nodup (ndinsert a s) := Quot.inductionOn s fun _ => Nodup.insert #align multiset.nodup.ndinsert Multiset.Nodup.ndinsert theorem ndinsert_le {a : α} {s t : Multiset α} : ndinsert a s ≤ t ↔ s ≤ t ∧ a ∈ t := ⟨fun h => ⟨le_trans (le_ndinsert_self _ _) h, mem_of_le h (mem_ndinsert_self _ _)⟩, fun ⟨l, m⟩ => if h : a ∈ s then by simp [h, l] else by rw [ndinsert_of_not_mem h, ← cons_erase m, cons_le_cons_iff, ← le_cons_of_not_mem h, cons_erase m]; exact l⟩ #align multiset.ndinsert_le Multiset.ndinsert_le theorem attach_ndinsert (a : α) (s : Multiset α) : (s.ndinsert a).attach = ndinsert ⟨a, mem_ndinsert_self a s⟩ (s.attach.map fun p => ⟨p.1, mem_ndinsert_of_mem p.2⟩) := have eq : ∀ h : ∀ p : { x // x ∈ s }, p.1 ∈ s, (fun p : { x // x ∈ s } => ⟨p.val, h p⟩ : { x // x ∈ s } → { x // x ∈ s }) = id := fun h => funext fun p => Subtype.eq rfl have : ∀ (t) (eq : s.ndinsert a = t), t.attach = ndinsert ⟨a, eq ▸ mem_ndinsert_self a s⟩ (s.attach.map fun p => ⟨p.1, eq ▸ mem_ndinsert_of_mem p.2⟩) := by intro t ht by_cases h : a ∈ s · rw [ndinsert_of_mem h] at ht subst ht rw [eq, map_id, ndinsert_of_mem (mem_attach _ _)] · rw [ndinsert_of_not_mem h] at ht subst ht simp [attach_cons, h] this _ rfl #align multiset.attach_ndinsert Multiset.attach_ndinsert @[simp] theorem disjoint_ndinsert_left {a : α} {s t : Multiset α} : Disjoint (ndinsert a s) t ↔ a ∉ t ∧ Disjoint s t := Iff.trans (by simp [Disjoint]) disjoint_cons_left #align multiset.disjoint_ndinsert_left Multiset.disjoint_ndinsert_left @[simp]
Mathlib/Data/Multiset/FinsetOps.lean
127
129
theorem disjoint_ndinsert_right {a : α} {s t : Multiset α} : Disjoint s (ndinsert a t) ↔ a ∉ s ∧ Disjoint s t := by
rw [disjoint_comm, disjoint_ndinsert_left]; tauto
1
2.718282
0
0.4
5
392
import Mathlib.Algebra.Order.Monoid.Defs import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Util.AssertExists #align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce" open Function universe u variable {α : Type u} class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b #align ordered_add_comm_group OrderedAddCommGroup class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b #align ordered_comm_group OrderedCommGroup attribute [to_additive] OrderedCommGroup @[to_additive] instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] : CovariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a #align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le #align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le -- See note [lower instance priority] @[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid] instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] : OrderedCancelCommMonoid α := { ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' } #align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid #align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) := IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564 -- but without the motivation clearly explained. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le #align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (swap (· * ·)) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le #align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le section Group variable [Group α] section TypeclassesLeftLE variable [LE α] [CovariantClass α α (· * ·) (· ≤ ·)] {a b c d : α} @[to_additive (attr := simp) "Uses `left` co(ntra)variant."] theorem Left.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a := by rw [← mul_le_mul_iff_left a] simp #align left.inv_le_one_iff Left.inv_le_one_iff #align left.neg_nonpos_iff Left.neg_nonpos_iff @[to_additive (attr := simp) "Uses `left` co(ntra)variant."] theorem Left.one_le_inv_iff : 1 ≤ a⁻¹ ↔ a ≤ 1 := by rw [← mul_le_mul_iff_left a] simp #align left.one_le_inv_iff Left.one_le_inv_iff #align left.nonneg_neg_iff Left.nonneg_neg_iff @[to_additive (attr := simp)] theorem le_inv_mul_iff_mul_le : b ≤ a⁻¹ * c ↔ a * b ≤ c := by rw [← mul_le_mul_iff_left a] simp #align le_inv_mul_iff_mul_le le_inv_mul_iff_mul_le #align le_neg_add_iff_add_le le_neg_add_iff_add_le @[to_additive (attr := simp)] theorem inv_mul_le_iff_le_mul : b⁻¹ * a ≤ c ↔ a ≤ b * c := by rw [← mul_le_mul_iff_left b, mul_inv_cancel_left] #align inv_mul_le_iff_le_mul inv_mul_le_iff_le_mul #align neg_add_le_iff_le_add neg_add_le_iff_le_add @[to_additive neg_le_iff_add_nonneg'] theorem inv_le_iff_one_le_mul' : a⁻¹ ≤ b ↔ 1 ≤ a * b := (mul_le_mul_iff_left a).symm.trans <| by rw [mul_inv_self] #align inv_le_iff_one_le_mul' inv_le_iff_one_le_mul' #align neg_le_iff_add_nonneg' neg_le_iff_add_nonneg' @[to_additive] theorem le_inv_iff_mul_le_one_left : a ≤ b⁻¹ ↔ b * a ≤ 1 := (mul_le_mul_iff_left b).symm.trans <| by rw [mul_inv_self] #align le_inv_iff_mul_le_one_left le_inv_iff_mul_le_one_left #align le_neg_iff_add_nonpos_left le_neg_iff_add_nonpos_left @[to_additive]
Mathlib/Algebra/Order/Group/Defs.lean
138
139
theorem le_inv_mul_iff_le : 1 ≤ b⁻¹ * a ↔ b ≤ a := by
rw [← mul_le_mul_iff_left b, mul_one, mul_inv_cancel_left]
1
2.718282
0
0.4
25
400
import Mathlib.Analysis.NormedSpace.PiLp import Mathlib.Analysis.InnerProductSpace.PiL2 #align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped NNReal Matrix namespace Matrix variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n] section LinfLinf section SeminormedAddCommGroup variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n α) := Pi.seminormedAddCommGroup #align matrix.seminormed_add_comm_group Matrix.seminormedAddCommGroup attribute [local instance] Matrix.seminormedAddCommGroup -- Porting note (#10756): new theorem (along with all the uses of this lemma below) theorem norm_def (A : Matrix m n α) : ‖A‖ = ‖fun i j => A i j‖ := rfl lemma norm_eq_sup_sup_nnnorm (A : Matrix m n α) : ‖A‖ = Finset.sup Finset.univ fun i ↦ Finset.sup Finset.univ fun j ↦ ‖A i j‖₊ := by simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def] -- Porting note (#10756): new theorem (along with all the uses of this lemma below) theorem nnnorm_def (A : Matrix m n α) : ‖A‖₊ = ‖fun i j => A i j‖₊ := rfl
Mathlib/Analysis/Matrix.lean
90
91
theorem norm_le_iff {r : ℝ} (hr : 0 ≤ r) {A : Matrix m n α} : ‖A‖ ≤ r ↔ ∀ i j, ‖A i j‖ ≤ r := by
simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr]
1
2.718282
0
0.533333
15
509
import Mathlib.Analysis.Quaternion import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series #align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm #align quaternion.exp_coe Quaternion.exp_coe theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf theorem expSeries_odd_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n + 1) (fun _ => q) = (((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) / ‖q‖) • q := by rw [expSeries_apply_eq] obtain rfl | hq0 := eq_or_ne q 0 · simp have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq have hqn := norm_ne_zero_iff.mpr hq0 let k : ℝ := ↑(2 * n + 1)! calc k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2] _ = k⁻¹ • ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) • q := ?_ _ = ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, ← coe_mul_eq_smul] norm_cast · rw [smul_smul] congr 1 simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn] ring theorem hasSum_expSeries_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) {c s : ℝ} (hc : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) c) (hs : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) s) : HasSum (fun n => expSeries ℝ (Quaternion ℝ) n fun _ => q) (↑c + (s / ‖q‖) • q) := by replace hc := hasSum_coe.mpr hc replace hs := (hs.div_const ‖q‖).smul_const q refine HasSum.even_add_odd ?_ ?_ · convert hc using 1 ext n : 1 rw [expSeries_even_of_imaginary hq] · convert hs using 1 ext n : 1 rw [expSeries_odd_of_imaginary hq] #align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary theorem exp_of_re_eq_zero (q : Quaternion ℝ) (hq : q.re = 0) : exp ℝ q = ↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q := by rw [exp_eq_tsum] refine HasSum.tsum_eq ?_ simp_rw [← expSeries_apply_eq] exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _) #align quaternion.exp_of_re_eq_zero Quaternion.exp_of_re_eq_zero theorem exp_eq (q : Quaternion ℝ) : exp ℝ q = exp ℝ q.re • (↑(Real.cos ‖q.im‖) + (Real.sin ‖q.im‖ / ‖q.im‖) • q.im) := by rw [← exp_of_re_eq_zero q.im q.im_re, ← coe_mul_eq_smul, ← exp_coe, ← exp_add_of_commute, re_add_im] exact Algebra.commutes q.re (_ : ℍ[ℝ]) #align quaternion.exp_eq Quaternion.exp_eq
Mathlib/Analysis/NormedSpace/QuaternionExponential.lean
114
114
theorem re_exp (q : ℍ[ℝ]) : (exp ℝ q).re = exp ℝ q.re * Real.cos ‖q - q.re‖ := by
simp [exp_eq]
1
2.718282
0
1.375
8
1,470
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]
Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean
89
89
theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by
simp [toComplex_def]
1
2.718282
0
0.090909
11
243
import Mathlib.CategoryTheory.Monoidal.Types.Symmetric import Mathlib.CategoryTheory.Monoidal.Types.Coyoneda import Mathlib.CategoryTheory.Monoidal.Center import Mathlib.Tactic.ApplyFun #align_import category_theory.enriched.basic from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4" universe w v u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Opposite open MonoidalCategory variable (V : Type v) [Category.{w} V] [MonoidalCategory V] class EnrichedCategory (C : Type u₁) where Hom : C → C → V id (X : C) : 𝟙_ V ⟶ Hom X X comp (X Y Z : C) : Hom X Y ⊗ Hom Y Z ⟶ Hom X Z id_comp (X Y : C) : (λ_ (Hom X Y)).inv ≫ id X ▷ _ ≫ comp X X Y = 𝟙 _ := by aesop_cat comp_id (X Y : C) : (ρ_ (Hom X Y)).inv ≫ _ ◁ id Y ≫ comp X Y Y = 𝟙 _ := by aesop_cat assoc (W X Y Z : C) : (α_ _ _ _).inv ≫ comp W X Y ▷ _ ≫ comp W Y Z = _ ◁ comp X Y Z ≫ comp W X Z := by aesop_cat #align category_theory.enriched_category CategoryTheory.EnrichedCategory notation X " ⟶[" V "] " Y:10 => (EnrichedCategory.Hom X Y : V) variable {C : Type u₁} [EnrichedCategory V C] def eId (X : C) : 𝟙_ V ⟶ X ⟶[V] X := EnrichedCategory.id X #align category_theory.e_id CategoryTheory.eId def eComp (X Y Z : C) : ((X ⟶[V] Y) ⊗ Y ⟶[V] Z) ⟶ X ⟶[V] Z := EnrichedCategory.comp X Y Z #align category_theory.e_comp CategoryTheory.eComp @[reassoc (attr := simp)] theorem e_id_comp (X Y : C) : (λ_ (X ⟶[V] Y)).inv ≫ eId V X ▷ _ ≫ eComp V X X Y = 𝟙 (X ⟶[V] Y) := EnrichedCategory.id_comp X Y #align category_theory.e_id_comp CategoryTheory.e_id_comp @[reassoc (attr := simp)] theorem e_comp_id (X Y : C) : (ρ_ (X ⟶[V] Y)).inv ≫ _ ◁ eId V Y ≫ eComp V X Y Y = 𝟙 (X ⟶[V] Y) := EnrichedCategory.comp_id X Y #align category_theory.e_comp_id CategoryTheory.e_comp_id @[reassoc (attr := simp)] theorem e_assoc (W X Y Z : C) : (α_ _ _ _).inv ≫ eComp V W X Y ▷ _ ≫ eComp V W Y Z = _ ◁ eComp V X Y Z ≫ eComp V W X Z := EnrichedCategory.assoc W X Y Z #align category_theory.e_assoc CategoryTheory.e_assoc @[reassoc]
Mathlib/CategoryTheory/Enriched/Basic.lean
98
101
theorem e_assoc' (W X Y Z : C) : (α_ _ _ _).hom ≫ _ ◁ eComp V X Y Z ≫ eComp V W X Z = eComp V W X Y ▷ _ ≫ eComp V W Y Z := by
rw [← e_assoc V W X Y Z, Iso.hom_inv_id_assoc]
1
2.718282
0
0
1
19
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
Mathlib/Order/Interval/Set/OrdConnectedComponent.lean
77
79
theorem ordConnectedComponent_inter (s t : Set α) (x : α) : ordConnectedComponent (s ∩ t) x = ordConnectedComponent s x ∩ ordConnectedComponent t x := by
simp [ordConnectedComponent, setOf_and]
1
2.718282
0
0.571429
7
519
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 theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp #align option.forall_mem_map Option.forall_mem_map theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp #align option.exists_mem_map Option.exists_mem_map theorem coe_get {o : Option α} (h : o.isSome) : ((Option.get _ h : α) : Option α) = o := Option.some_get h #align option.coe_get Option.coe_get theorem eq_of_mem_of_mem {a : α} {o1 o2 : Option α} (h1 : a ∈ o1) (h2 : a ∈ o2) : o1 = o2 := h1.trans h2.symm #align option.eq_of_mem_of_mem Option.eq_of_mem_of_mem theorem Mem.leftUnique : Relator.LeftUnique ((· ∈ ·) : α → Option α → Prop) := fun _ _ _=> mem_unique #align option.mem.left_unique Option.Mem.leftUnique theorem some_injective (α : Type*) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp #align option.some_injective Option.some_injective theorem map_injective {f : α → β} (Hf : Function.Injective f) : Function.Injective (Option.map f) | none, none, _ => rfl | some a₁, some a₂, H => by rw [Hf (Option.some.inj H)] #align option.map_injective Option.map_injective @[simp] theorem map_comp_some (f : α → β) : Option.map f ∘ some = some ∘ f := rfl #align option.map_comp_some Option.map_comp_some @[simp] theorem none_bind' (f : α → Option β) : none.bind f = none := rfl #align option.none_bind' Option.none_bind' @[simp] theorem some_bind' (a : α) (f : α → Option β) : (some a).bind f = f a := rfl #align option.some_bind' Option.some_bind'
Mathlib/Data/Option/Basic.lean
101
103
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} : x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b := by
cases x <;> simp
1
2.718282
0
0
8
110
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 CoheytingAlgebra variable [CoheytingAlgebra α] (a : α) @[simp] theorem symmDiff_top' : a ∆ ⊤ = ¬a := by simp [symmDiff] #align symm_diff_top' symmDiff_top' @[simp]
Mathlib/Order/SymmDiff.lean
347
347
theorem top_symmDiff' : ⊤ ∆ a = ¬a := by
simp [symmDiff]
1
2.718282
0
0.181818
22
266
import Mathlib.Algebra.IsPrimePow import Mathlib.NumberTheory.ArithmeticFunction import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import number_theory.von_mangoldt from "leanprover-community/mathlib"@"c946d6097a6925ad16d7ec55677bbc977f9846de" namespace ArithmeticFunction open Finset Nat open scoped ArithmeticFunction noncomputable def log : ArithmeticFunction ℝ := ⟨fun n => Real.log n, by simp⟩ #align nat.arithmetic_function.log ArithmeticFunction.log @[simp] theorem log_apply {n : ℕ} : log n = Real.log n := rfl #align nat.arithmetic_function.log_apply ArithmeticFunction.log_apply noncomputable def vonMangoldt : ArithmeticFunction ℝ := ⟨fun n => if IsPrimePow n then Real.log (minFac n) else 0, if_neg not_isPrimePow_zero⟩ #align nat.arithmetic_function.von_mangoldt ArithmeticFunction.vonMangoldt @[inherit_doc] scoped[ArithmeticFunction] notation "Λ" => ArithmeticFunction.vonMangoldt @[inherit_doc] scoped[ArithmeticFunction.vonMangoldt] notation "Λ" => ArithmeticFunction.vonMangoldt theorem vonMangoldt_apply {n : ℕ} : Λ n = if IsPrimePow n then Real.log (minFac n) else 0 := rfl #align nat.arithmetic_function.von_mangoldt_apply ArithmeticFunction.vonMangoldt_apply @[simp] theorem vonMangoldt_apply_one : Λ 1 = 0 := by simp [vonMangoldt_apply] #align nat.arithmetic_function.von_mangoldt_apply_one ArithmeticFunction.vonMangoldt_apply_one @[simp] theorem vonMangoldt_nonneg {n : ℕ} : 0 ≤ Λ n := by rw [vonMangoldt_apply] split_ifs · exact Real.log_nonneg (one_le_cast.2 (Nat.minFac_pos n)) rfl #align nat.arithmetic_function.von_mangoldt_nonneg ArithmeticFunction.vonMangoldt_nonneg theorem vonMangoldt_apply_pow {n k : ℕ} (hk : k ≠ 0) : Λ (n ^ k) = Λ n := by simp only [vonMangoldt_apply, isPrimePow_pow_iff hk, pow_minFac hk] #align nat.arithmetic_function.von_mangoldt_apply_pow ArithmeticFunction.vonMangoldt_apply_pow
Mathlib/NumberTheory/VonMangoldt.lean
94
95
theorem vonMangoldt_apply_prime {p : ℕ} (hp : p.Prime) : Λ p = Real.log p := by
rw [vonMangoldt_apply, Prime.minFac_eq hp, if_pos hp.prime.isPrimePow]
1
2.718282
0
0.636364
11
552
import Mathlib.Algebra.Order.Group.Nat import Mathlib.Data.List.Rotate import Mathlib.GroupTheory.Perm.Support #align_import group_theory.perm.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace List variable {α β : Type*} section FormPerm variable [DecidableEq α] (l : List α) open Equiv Equiv.Perm def formPerm : Equiv.Perm α := (zipWith Equiv.swap l l.tail).prod #align list.form_perm List.formPerm @[simp] theorem formPerm_nil : formPerm ([] : List α) = 1 := rfl #align list.form_perm_nil List.formPerm_nil @[simp] theorem formPerm_singleton (x : α) : formPerm [x] = 1 := rfl #align list.form_perm_singleton List.formPerm_singleton @[simp] theorem formPerm_cons_cons (x y : α) (l : List α) : formPerm (x :: y :: l) = swap x y * formPerm (y :: l) := prod_cons #align list.form_perm_cons_cons List.formPerm_cons_cons theorem formPerm_pair (x y : α) : formPerm [x, y] = swap x y := rfl #align list.form_perm_pair List.formPerm_pair theorem mem_or_mem_of_zipWith_swap_prod_ne : ∀ {l l' : List α} {x : α}, (zipWith swap l l').prod x ≠ x → x ∈ l ∨ x ∈ l' | [], _, _ => by simp | _, [], _ => by simp | a::l, b::l', x => fun hx ↦ if h : (zipWith swap l l').prod x = x then (eq_or_eq_of_swap_apply_ne_self (by simpa [h] using hx)).imp (by rintro rfl; exact .head _) (by rintro rfl; exact .head _) else (mem_or_mem_of_zipWith_swap_prod_ne h).imp (.tail _) (.tail _) theorem zipWith_swap_prod_support' (l l' : List α) : { x | (zipWith swap l l').prod x ≠ x } ≤ l.toFinset ⊔ l'.toFinset := fun _ h ↦ by simpa using mem_or_mem_of_zipWith_swap_prod_ne h #align list.zip_with_swap_prod_support' List.zipWith_swap_prod_support' theorem zipWith_swap_prod_support [Fintype α] (l l' : List α) : (zipWith swap l l').prod.support ≤ l.toFinset ⊔ l'.toFinset := by intro x hx have hx' : x ∈ { x | (zipWith swap l l').prod x ≠ x } := by simpa using hx simpa using zipWith_swap_prod_support' _ _ hx' #align list.zip_with_swap_prod_support List.zipWith_swap_prod_support theorem support_formPerm_le' : { x | formPerm l x ≠ x } ≤ l.toFinset := by refine (zipWith_swap_prod_support' l l.tail).trans ?_ simpa [Finset.subset_iff] using tail_subset l #align list.support_form_perm_le' List.support_formPerm_le' theorem support_formPerm_le [Fintype α] : support (formPerm l) ≤ l.toFinset := by intro x hx have hx' : x ∈ { x | formPerm l x ≠ x } := by simpa using hx simpa using support_formPerm_le' _ hx' #align list.support_form_perm_le List.support_formPerm_le variable {l} {x : α}
Mathlib/GroupTheory/Perm/List.lean
108
109
theorem mem_of_formPerm_apply_ne (h : l.formPerm x ≠ x) : x ∈ l := by
simpa [or_iff_left_of_imp mem_of_mem_tail] using mem_or_mem_of_zipWith_swap_prod_ne h
1
2.718282
0
0.7
10
641
import Mathlib.Analysis.NormedSpace.IndicatorFunction import Mathlib.MeasureTheory.Function.EssSup import Mathlib.MeasureTheory.Function.AEEqFun import Mathlib.MeasureTheory.Function.SpecialFunctions.Basic #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" noncomputable section set_option linter.uppercaseLean3 false open TopologicalSpace MeasureTheory Filter open scoped NNReal ENNReal Topology variable {α E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α} [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] namespace MeasureTheory section ℒp section ℒpSpaceDefinition def snorm' {_ : MeasurableSpace α} (f : α → F) (q : ℝ) (μ : Measure α) : ℝ≥0∞ := (∫⁻ a, (‖f a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) #align measure_theory.snorm' MeasureTheory.snorm' def snormEssSup {_ : MeasurableSpace α} (f : α → F) (μ : Measure α) := essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ #align measure_theory.snorm_ess_sup MeasureTheory.snormEssSup def snorm {_ : MeasurableSpace α} (f : α → F) (p : ℝ≥0∞) (μ : Measure α) : ℝ≥0∞ := if p = 0 then 0 else if p = ∞ then snormEssSup f μ else snorm' f (ENNReal.toReal p) μ #align measure_theory.snorm MeasureTheory.snorm theorem snorm_eq_snorm' (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) {f : α → F} : snorm f p μ = snorm' f (ENNReal.toReal p) μ := by simp [snorm, hp_ne_zero, hp_ne_top] #align measure_theory.snorm_eq_snorm' MeasureTheory.snorm_eq_snorm' theorem snorm_eq_lintegral_rpow_nnnorm (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) {f : α → F} : snorm f p μ = (∫⁻ x, (‖f x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by rw [snorm_eq_snorm' hp_ne_zero hp_ne_top, snorm'] #align measure_theory.snorm_eq_lintegral_rpow_nnnorm MeasureTheory.snorm_eq_lintegral_rpow_nnnorm theorem snorm_one_eq_lintegral_nnnorm {f : α → F} : snorm f 1 μ = ∫⁻ x, ‖f x‖₊ ∂μ := by simp_rw [snorm_eq_lintegral_rpow_nnnorm one_ne_zero ENNReal.coe_ne_top, ENNReal.one_toReal, one_div_one, ENNReal.rpow_one] #align measure_theory.snorm_one_eq_lintegral_nnnorm MeasureTheory.snorm_one_eq_lintegral_nnnorm @[simp]
Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean
102
102
theorem snorm_exponent_top {f : α → F} : snorm f ∞ μ = snormEssSup f μ := by
simp [snorm]
1
2.718282
0
0.4
5
402
import Mathlib.Init.Function #align_import data.option.n_ary from "leanprover-community/mathlib"@"995b47e555f1b6297c7cf16855f1023e355219fb" universe u open Function namespace Option variable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ} def map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ := a.bind fun a => b.map <| f a #align option.map₂ Option.map₂ theorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) : map₂ f a b = f <$> a <*> b := by cases a <;> rfl #align option.map₂_def Option.map₂_def -- Porting note (#10618): In Lean3, was `@[simp]` but now `simp` can prove it theorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl #align option.map₂_some_some Option.map₂_some_some theorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl #align option.map₂_coe_coe Option.map₂_coe_coe @[simp] theorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl #align option.map₂_none_left Option.map₂_none_left @[simp] theorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl #align option.map₂_none_right Option.map₂_none_right @[simp] theorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b := rfl #align option.map₂_coe_left Option.map₂_coe_left -- Porting note: This proof was `rfl` in Lean3, but now is not. @[simp] theorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) : map₂ f a b = a.map fun a => f a b := by cases a <;> rfl #align option.map₂_coe_right Option.map₂_coe_right -- Porting note: Removed the `@[simp]` tag as membership of an `Option` is no-longer simp-normal.
Mathlib/Data/Option/NAry.lean
78
79
theorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by
simp [map₂, bind_eq_some]
1
2.718282
0
0
14
191
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : ℕ+) instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioc PNat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioo PNat.card_Ioo @[simp]
Mathlib/Data/PNat/Interval.lean
103
104
theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := by
rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map]
1
2.718282
0
1
8
948
import Mathlib.AlgebraicGeometry.AffineScheme import Mathlib.AlgebraicGeometry.Pullbacks import Mathlib.CategoryTheory.MorphismProperty.Limits import Mathlib.Data.List.TFAE #align_import algebraic_geometry.morphisms.basic from "leanprover-community/mathlib"@"434e2fd21c1900747afc6d13d8be7f4eedba7218" set_option linter.uppercaseLean3 false universe u open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite noncomputable section namespace AlgebraicGeometry def AffineTargetMorphismProperty := ∀ ⦃X Y : Scheme⦄ (_ : X ⟶ Y) [IsAffine Y], Prop #align algebraic_geometry.affine_target_morphism_property AlgebraicGeometry.AffineTargetMorphismProperty protected def Scheme.isIso : MorphismProperty Scheme := @IsIso Scheme _ #align algebraic_geometry.Scheme.is_iso AlgebraicGeometry.Scheme.isIso protected def Scheme.affineTargetIsIso : AffineTargetMorphismProperty := fun _ _ f _ => IsIso f #align algebraic_geometry.Scheme.affine_target_is_iso AlgebraicGeometry.Scheme.affineTargetIsIso instance : Inhabited AffineTargetMorphismProperty := ⟨Scheme.affineTargetIsIso⟩ def AffineTargetMorphismProperty.toProperty (P : AffineTargetMorphismProperty) : MorphismProperty Scheme := fun _ _ f => ∃ h, @P _ _ f h #align algebraic_geometry.affine_target_morphism_property.to_property AlgebraicGeometry.AffineTargetMorphismProperty.toProperty theorem AffineTargetMorphismProperty.toProperty_apply (P : AffineTargetMorphismProperty) {X Y : Scheme} (f : X ⟶ Y) [i : IsAffine Y] : P.toProperty f ↔ P f := by delta AffineTargetMorphismProperty.toProperty; simp [*] #align algebraic_geometry.affine_target_morphism_property.to_property_apply AlgebraicGeometry.AffineTargetMorphismProperty.toProperty_apply
Mathlib/AlgebraicGeometry/Morphisms/Basic.lean
99
101
theorem affine_cancel_left_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso) {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso f] [IsAffine Z] : P (f ≫ g) ↔ P g := by
rw [← P.toProperty_apply, ← P.toProperty_apply, hP.cancel_left_isIso]
1
2.718282
0
0.6
5
533
import Mathlib.CategoryTheory.Limits.Creates import Mathlib.CategoryTheory.Comma.Over import Mathlib.CategoryTheory.IsConnected #align_import category_theory.limits.constructions.over.connected from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31" universe v u -- morphism levels before object levels. See note [CategoryTheory universes]. noncomputable section open CategoryTheory CategoryTheory.Limits variable {J : Type v} [SmallCategory J] variable {C : Type u} [Category.{v} C] variable {X : C} namespace CategoryTheory.Over namespace CreatesConnected def natTransInOver {B : C} (F : J ⥤ Over B) : F ⋙ forget B ⟶ (CategoryTheory.Functor.const J).obj B where app j := (F.obj j).hom #align category_theory.over.creates_connected.nat_trans_in_over CategoryTheory.Over.CreatesConnected.natTransInOver @[simps] def raiseCone [IsConnected J] {B : C} {F : J ⥤ Over B} (c : Cone (F ⋙ forget B)) : Cone F where pt := Over.mk (c.π.app (Classical.arbitrary J) ≫ (F.obj (Classical.arbitrary J)).hom) π := { app := fun j => Over.homMk (c.π.app j) (nat_trans_from_is_connected (c.π ≫ natTransInOver F) j _) naturality := by intro X Y f apply CommaMorphism.ext · simpa using (c.w f).symm · simp } #align category_theory.over.creates_connected.raise_cone CategoryTheory.Over.CreatesConnected.raiseCone
Mathlib/CategoryTheory/Limits/Constructions/Over/Connected.lean
60
62
theorem raised_cone_lowers_to_original [IsConnected J] {B : C} {F : J ⥤ Over B} (c : Cone (F ⋙ forget B)) : (forget B).mapCone (raiseCone c) = c := by
aesop_cat
1
2.718282
0
0
1
111
import Mathlib.Data.Matrix.Basis import Mathlib.Data.Matrix.DMatrix import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.Tactic.FieldSimp #align_import linear_algebra.matrix.transvection from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6" universe u₁ u₂ namespace Matrix open Matrix variable (n p : Type*) (R : Type u₂) {𝕜 : Type*} [Field 𝕜] variable [DecidableEq n] [DecidableEq p] variable [CommRing R] section Transvection variable {R n} (i j : n) def transvection (c : R) : Matrix n n R := 1 + Matrix.stdBasisMatrix i j c #align matrix.transvection Matrix.transvection @[simp] theorem transvection_zero : transvection i j (0 : R) = 1 := by simp [transvection] #align matrix.transvection_zero Matrix.transvection_zero section theorem updateRow_eq_transvection [Finite n] (c : R) : updateRow (1 : Matrix n n R) i ((1 : Matrix n n R) i + c • (1 : Matrix n n R) j) = transvection i j c := by cases nonempty_fintype n ext a b by_cases ha : i = a · by_cases hb : j = b · simp only [updateRow_self, transvection, ha, hb, Pi.add_apply, StdBasisMatrix.apply_same, one_apply_eq, Pi.smul_apply, mul_one, Algebra.id.smul_eq_mul, add_apply] · simp only [updateRow_self, transvection, ha, hb, StdBasisMatrix.apply_of_ne, Pi.add_apply, Ne, not_false_iff, Pi.smul_apply, and_false_iff, one_apply_ne, Algebra.id.smul_eq_mul, mul_zero, add_apply] · simp only [updateRow_ne, transvection, ha, Ne.symm ha, StdBasisMatrix.apply_of_ne, add_zero, Algebra.id.smul_eq_mul, Ne, not_false_iff, DMatrix.add_apply, Pi.smul_apply, mul_zero, false_and_iff, add_apply] #align matrix.update_row_eq_transvection Matrix.updateRow_eq_transvection variable [Fintype n] theorem transvection_mul_transvection_same (h : i ≠ j) (c d : R) : transvection i j c * transvection i j d = transvection i j (c + d) := by simp [transvection, Matrix.add_mul, Matrix.mul_add, h, h.symm, add_smul, add_assoc, stdBasisMatrix_add] #align matrix.transvection_mul_transvection_same Matrix.transvection_mul_transvection_same @[simp]
Mathlib/LinearAlgebra/Matrix/Transvection.lean
120
121
theorem transvection_mul_apply_same (b : n) (c : R) (M : Matrix n n R) : (transvection i j c * M) i b = M i b + c * M j b := by
simp [transvection, Matrix.add_mul]
1
2.718282
0
0.666667
12
572
import Mathlib.Algebra.BigOperators.Group.Multiset import Mathlib.Data.Multiset.Dedup #align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" assert_not_exists MonoidWithZero assert_not_exists MulAction universe v variable {α : Type*} {β : Type v} {γ δ : Type*} namespace Multiset def join : Multiset (Multiset α) → Multiset α := sum #align multiset.join Multiset.join theorem coe_join : ∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join | [] => rfl | l :: L => by exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L) #align multiset.coe_join Multiset.coe_join @[simp] theorem join_zero : @join α 0 = 0 := rfl #align multiset.join_zero Multiset.join_zero @[simp] theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S := sum_cons _ _ #align multiset.join_cons Multiset.join_cons @[simp] theorem join_add (S T) : @join α (S + T) = join S + join T := sum_add _ _ #align multiset.join_add Multiset.join_add @[simp] theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a := sum_singleton _ #align multiset.singleton_join Multiset.singleton_join @[simp] theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s := Multiset.induction_on S (by simp) <| by simp (config := { contextual := true }) [or_and_right, exists_or] #align multiset.mem_join Multiset.mem_join @[simp] theorem card_join (S) : card (@join α S) = sum (map card S) := Multiset.induction_on S (by simp) (by simp) #align multiset.card_join Multiset.card_join @[simp] theorem map_join (f : α → β) (S : Multiset (Multiset α)) : map f (join S) = join (map (map f) S) := by induction S using Multiset.induction with | empty => simp | cons _ _ ih => simp [ih] @[to_additive (attr := simp)] theorem prod_join [CommMonoid α] {S : Multiset (Multiset α)} : prod (join S) = prod (map prod S) := by induction S using Multiset.induction with | empty => simp | cons _ _ ih => simp [ih] theorem rel_join {r : α → β → Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by induction h with | zero => simp | cons hab hst ih => simpa using hab.add ih #align multiset.rel_join Multiset.rel_join section Bind variable (a : α) (s t : Multiset α) (f g : α → Multiset β) def bind (s : Multiset α) (f : α → Multiset β) : Multiset β := (s.map f).join #align multiset.bind Multiset.bind @[simp] theorem coe_bind (l : List α) (f : α → List β) : (@bind α β l fun a => f a) = l.bind f := by rw [List.bind, ← coe_join, List.map_map] rfl #align multiset.coe_bind Multiset.coe_bind @[simp] theorem zero_bind : bind 0 f = 0 := rfl #align multiset.zero_bind Multiset.zero_bind @[simp] theorem cons_bind : (a ::ₘ s).bind f = f a + s.bind f := by simp [bind] #align multiset.cons_bind Multiset.cons_bind @[simp] theorem singleton_bind : bind {a} f = f a := by simp [bind] #align multiset.singleton_bind Multiset.singleton_bind @[simp] theorem add_bind : (s + t).bind f = s.bind f + t.bind f := by simp [bind] #align multiset.add_bind Multiset.add_bind @[simp] theorem bind_zero : s.bind (fun _ => 0 : α → Multiset β) = 0 := by simp [bind, join, nsmul_zero] #align multiset.bind_zero Multiset.bind_zero @[simp] theorem bind_add : (s.bind fun a => f a + g a) = s.bind f + s.bind g := by simp [bind, join] #align multiset.bind_add Multiset.bind_add @[simp] theorem bind_cons (f : α → β) (g : α → Multiset β) : (s.bind fun a => f a ::ₘ g a) = map f s + s.bind g := Multiset.induction_on s (by simp) (by simp (config := { contextual := true }) [add_comm, add_left_comm, add_assoc]) #align multiset.bind_cons Multiset.bind_cons @[simp] theorem bind_singleton (f : α → β) : (s.bind fun x => ({f x} : Multiset β)) = map f s := Multiset.induction_on s (by rw [zero_bind, map_zero]) (by simp [singleton_add]) #align multiset.bind_singleton Multiset.bind_singleton @[simp] theorem mem_bind {b s} {f : α → Multiset β} : b ∈ bind s f ↔ ∃ a ∈ s, b ∈ f a := by simp [bind] #align multiset.mem_bind Multiset.mem_bind @[simp] theorem card_bind : card (s.bind f) = (s.map (card ∘ f)).sum := by simp [bind] #align multiset.card_bind Multiset.card_bind
Mathlib/Data/Multiset/Bind.lean
166
167
theorem bind_congr {f g : α → Multiset β} {m : Multiset α} : (∀ a ∈ m, f a = g a) → bind m f = bind m g := by
simp (config := { contextual := true }) [bind]
1
2.718282
0
0.384615
13
382
import Mathlib.RingTheory.HahnSeries.Multiplication import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.Data.Finsupp.PWO #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical open Pointwise Polynomial noncomputable section variable {Γ : Type*} {R : Type*} namespace HahnSeries section Semiring variable [Semiring R] @[simps] def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where toFun f := PowerSeries.mk f.coeff invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩ left_inv f := by ext simp right_inv f := by ext simp map_add' f g := by ext simp map_mul' f g := by ext n simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support] classical refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <| sum_filter_ne_zero _ ext m simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter, mem_support] rintro h rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)] #align hahn_series.to_power_series HahnSeries.toPowerSeries theorem coeff_toPowerSeries {f : HahnSeries ℕ R} {n : ℕ} : PowerSeries.coeff R n (toPowerSeries f) = f.coeff n := PowerSeries.coeff_mk _ _ #align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : ℕ} : (HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f := rfl #align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm variable (Γ R) [StrictOrderedSemiring Γ] def ofPowerSeries : PowerSeries R →+* HahnSeries Γ R := (HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Γ) Nat.strictMono_cast.injective fun _ _ => Nat.cast_le).comp (RingEquiv.toRingHom toPowerSeries.symm) #align hahn_series.of_power_series HahnSeries.ofPowerSeries variable {Γ} {R} theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Γ R) := embDomain_injective.comp toPowerSeries.symm.injective #align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective theorem ofPowerSeries_apply (x : PowerSeries R) : ofPowerSeries Γ R x = HahnSeries.embDomain ⟨⟨((↑) : ℕ → Γ), Nat.strictMono_cast.injective⟩, by simp only [Function.Embedding.coeFn_mk] exact Nat.cast_le⟩ (toPowerSeries.symm x) := rfl #align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : ℕ) : (ofPowerSeries Γ R x).coeff n = PowerSeries.coeff R n x := by simp [ofPowerSeries_apply] #align hahn_series.of_power_series_apply_coeff HahnSeries.ofPowerSeries_apply_coeff @[simp] theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by ext n simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq, single_coeff] split_ifs with hn · subst hn convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> simp · rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_C] intro simp (config := { contextual := true }) [Ne.symm hn] #align hahn_series.of_power_series_C HahnSeries.ofPowerSeries_C @[simp] theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by ext n simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk] split_ifs with hn · rw [hn] convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 1 <;> simp · rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_X] intro simp (config := { contextual := true }) [Ne.symm hn] #align hahn_series.of_power_series_X HahnSeries.ofPowerSeries_X
Mathlib/RingTheory/HahnSeries/PowerSeries.lean
145
147
theorem ofPowerSeries_X_pow {R} [Semiring R] (n : ℕ) : ofPowerSeries Γ R (PowerSeries.X ^ n) = single (n : Γ) 1 := by
simp
1
2.718282
0
1
4
852
import Batteries.Data.Fin.Basic namespace Fin attribute [norm_cast] val_last protected theorem le_antisymm_iff {x y : Fin n} : x = y ↔ x ≤ y ∧ y ≤ x := Fin.ext_iff.trans Nat.le_antisymm_iff protected theorem le_antisymm {x y : Fin n} (h1 : x ≤ y) (h2 : y ≤ x) : x = y := Fin.le_antisymm_iff.2 ⟨h1, h2⟩ @[simp] theorem coe_clamp (n m : Nat) : (clamp n m : Nat) = min n m := rfl @[simp] theorem size_enum (n) : (enum n).size = n := Array.size_ofFn .. @[simp] theorem enum_zero : (enum 0) = #[] := by simp [enum, Array.ofFn, Array.ofFn.go] @[simp] theorem getElem_enum (i) (h : i < (enum n).size) : (enum n)[i] = ⟨i, size_enum n ▸ h⟩ := Array.getElem_ofFn .. @[simp] theorem length_list (n) : (list n).length = n := by simp [list] @[simp] theorem get_list (i : Fin (list n).length) : (list n).get i = i.cast (length_list n) := by cases i; simp only [list]; rw [← Array.getElem_eq_data_get, getElem_enum, cast_mk] @[simp] theorem list_zero : list 0 = [] := by simp [list] theorem list_succ (n) : list (n+1) = 0 :: (list n).map Fin.succ := by apply List.ext_get; simp; intro i; cases i <;> simp theorem list_succ_last (n) : list (n+1) = (list n).map castSucc ++ [last n] := by rw [list_succ] induction n with | zero => rfl | succ n ih => rw [list_succ, List.map_cons castSucc, ih] simp [Function.comp_def, succ_castSucc] theorem list_reverse (n) : (list n).reverse = (list n).map rev := by induction n with | zero => rfl | succ n ih => conv => lhs; rw [list_succ_last] conv => rhs; rw [list_succ] simp [List.reverse_map, ih, Function.comp_def, rev_succ] theorem foldl_loop_lt (f : α → Fin n → α) (x) (h : m < n) : foldl.loop n f x m = foldl.loop n f (f x ⟨m, h⟩) (m+1) := by rw [foldl.loop, dif_pos h]
.lake/packages/batteries/Batteries/Data/Fin/Lemmas.lean
63
64
theorem foldl_loop_eq (f : α → Fin n → α) (x) : foldl.loop n f x n = x := by
rw [foldl.loop, dif_neg (Nat.lt_irrefl _)]
1
2.718282
0
1.090909
11
1,186
import Mathlib.MeasureTheory.Measure.Typeclasses open scoped ENNReal namespace MeasureTheory variable {α : Type*} noncomputable def Measure.trim {m m0 : MeasurableSpace α} (μ : @Measure α m0) (hm : m ≤ m0) : @Measure α m := @OuterMeasure.toMeasure α m μ.toOuterMeasure (hm.trans (le_toOuterMeasure_caratheodory μ)) #align measure_theory.measure.trim MeasureTheory.Measure.trim @[simp] theorem trim_eq_self [MeasurableSpace α] {μ : Measure α} : μ.trim le_rfl = μ := by simp [Measure.trim] #align measure_theory.trim_eq_self MeasureTheory.trim_eq_self variable {m m0 : MeasurableSpace α} {μ : Measure α} {s : Set α} theorem toOuterMeasure_trim_eq_trim_toOuterMeasure (μ : Measure α) (hm : m ≤ m0) : @Measure.toOuterMeasure _ m (μ.trim hm) = @OuterMeasure.trim _ m μ.toOuterMeasure := by rw [Measure.trim, toMeasure_toOuterMeasure (ms := m)] #align measure_theory.to_outer_measure_trim_eq_trim_to_outer_measure MeasureTheory.toOuterMeasure_trim_eq_trim_toOuterMeasure @[simp]
Mathlib/MeasureTheory/Measure/Trim.lean
49
50
theorem zero_trim (hm : m ≤ m0) : (0 : Measure α).trim hm = (0 : @Measure α m) := by
simp [Measure.trim, @OuterMeasure.toMeasure_zero _ m]
1
2.718282
0
0.888889
9
766
import Mathlib.Data.Countable.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Order.Disjointed import Mathlib.MeasureTheory.OuterMeasure.Defs #align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set Function Filter open scoped Classical NNReal Topology ENNReal namespace MeasureTheory section OuterMeasureClass variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α] {μ : F} {s t : Set α} @[simp] theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ #align measure_theory.measure_empty MeasureTheory.measure_empty @[mono, gcongr] theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t := OuterMeasureClass.measure_mono μ h #align measure_theory.measure_mono MeasureTheory.measure_mono theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 := eq_bot_mono (measure_mono h) ht #align measure_theory.measure_mono_null MeasureTheory.measure_mono_null theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t := hs.bot_lt.trans_le (measure_mono h) theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _ calc μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed] _ ≤ ∑' i, μ (disjointed t i) := OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _) _ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset #align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) : μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by have := hI.to_subtype rw [biUnion_eq_iUnion] apply measure_iUnion_le #align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le theorem measure_biUnion_finset_le (I : Finset ι) (s : ι → Set α) : μ (⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ (s i) := (measure_biUnion_le μ I.countable_toSet s).trans_eq <| I.tsum_subtype (μ <| s ·) #align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le theorem measure_iUnion_fintype_le [Fintype ι] (μ : F) (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑ i, μ (s i) := by simpa using measure_biUnion_finset_le Finset.univ s #align measure_theory.measure_Union_fintype_le MeasureTheory.measure_iUnion_fintype_le theorem measure_union_le (s t : Set α) : μ (s ∪ t) ≤ μ s + μ t := by simpa [union_eq_iUnion] using measure_iUnion_fintype_le μ (cond · s t) #align measure_theory.measure_union_le MeasureTheory.measure_union_le theorem measure_le_inter_add_diff (μ : F) (s t : Set α) : μ s ≤ μ (s ∩ t) + μ (s \ t) := by simpa using measure_union_le (s ∩ t) (s \ t) theorem measure_diff_null (ht : μ t = 0) : μ (s \ t) = μ s := (measure_mono diff_subset).antisymm <| calc μ s ≤ μ (s ∩ t) + μ (s \ t) := measure_le_inter_add_diff _ _ _ _ ≤ μ t + μ (s \ t) := by gcongr; apply inter_subset_right _ = μ (s \ t) := by simp [ht] #align measure_theory.measure_diff_null MeasureTheory.measure_diff_null theorem measure_biUnion_null_iff {I : Set ι} (hI : I.Countable) {s : ι → Set α} : μ (⋃ i ∈ I, s i) = 0 ↔ ∀ i ∈ I, μ (s i) = 0 := by refine ⟨fun h i hi ↦ measure_mono_null (subset_biUnion_of_mem hi) h, fun h ↦ ?_⟩ have _ := hI.to_subtype simpa [h] using measure_iUnion_le (μ := μ) fun x : I ↦ s x #align measure_theory.measure_bUnion_null_iff MeasureTheory.measure_biUnion_null_iff theorem measure_sUnion_null_iff {S : Set (Set α)} (hS : S.Countable) : μ (⋃₀ S) = 0 ↔ ∀ s ∈ S, μ s = 0 := by rw [sUnion_eq_biUnion, measure_biUnion_null_iff hS] #align measure_theory.measure_sUnion_null_iff MeasureTheory.measure_sUnion_null_iff @[simp] theorem measure_iUnion_null_iff {ι : Sort*} [Countable ι] {s : ι → Set α} : μ (⋃ i, s i) = 0 ↔ ∀ i, μ (s i) = 0 := by rw [← sUnion_range, measure_sUnion_null_iff (countable_range s), forall_mem_range] #align measure_theory.measure_Union_null_iff MeasureTheory.measure_iUnion_null_iff alias ⟨_, measure_iUnion_null⟩ := measure_iUnion_null_iff #align measure_theory.measure_Union_null MeasureTheory.measure_iUnion_null @[simp]
Mathlib/MeasureTheory/OuterMeasure/Basic.lean
125
126
theorem measure_union_null_iff : μ (s ∪ t) = 0 ↔ μ s = 0 ∧ μ t = 0 := by
simp [union_eq_iUnion, and_comm]
1
2.718282
0
0.5
10
470
import Mathlib.Data.Countable.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Order.Disjointed import Mathlib.MeasureTheory.OuterMeasure.Defs #align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set Function Filter open scoped Classical NNReal Topology ENNReal namespace MeasureTheory section OuterMeasureClass variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α] {μ : F} {s t : Set α} @[simp] theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ #align measure_theory.measure_empty MeasureTheory.measure_empty @[mono, gcongr] theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t := OuterMeasureClass.measure_mono μ h #align measure_theory.measure_mono MeasureTheory.measure_mono theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 := eq_bot_mono (measure_mono h) ht #align measure_theory.measure_mono_null MeasureTheory.measure_mono_null theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t := hs.bot_lt.trans_le (measure_mono h) theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _ calc μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed] _ ≤ ∑' i, μ (disjointed t i) := OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _) _ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset #align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) : μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by have := hI.to_subtype rw [biUnion_eq_iUnion] apply measure_iUnion_le #align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le theorem measure_biUnion_finset_le (I : Finset ι) (s : ι → Set α) : μ (⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ (s i) := (measure_biUnion_le μ I.countable_toSet s).trans_eq <| I.tsum_subtype (μ <| s ·) #align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le
Mathlib/MeasureTheory/OuterMeasure/Basic.lean
84
86
theorem measure_iUnion_fintype_le [Fintype ι] (μ : F) (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑ i, μ (s i) := by
simpa using measure_biUnion_finset_le Finset.univ s
1
2.718282
0
0.5
10
470
import Mathlib.Algebra.Order.Floor import Mathlib.Topology.Algebra.Order.Group import Mathlib.Topology.Order.Basic #align_import topology.algebra.order.floor from "leanprover-community/mathlib"@"84dc0bd6619acaea625086d6f53cb35cdd554219" open Filter Function Int Set Topology variable {α β γ : Type*} [LinearOrderedRing α] [FloorRing α] theorem tendsto_floor_atTop : Tendsto (floor : α → ℤ) atTop atTop := floor_mono.tendsto_atTop_atTop fun b => ⟨(b + 1 : ℤ), by rw [floor_intCast]; exact (lt_add_one _).le⟩ #align tendsto_floor_at_top tendsto_floor_atTop theorem tendsto_floor_atBot : Tendsto (floor : α → ℤ) atBot atBot := floor_mono.tendsto_atBot_atBot fun b => ⟨b, (floor_intCast _).le⟩ #align tendsto_floor_at_bot tendsto_floor_atBot theorem tendsto_ceil_atTop : Tendsto (ceil : α → ℤ) atTop atTop := ceil_mono.tendsto_atTop_atTop fun b => ⟨b, (ceil_intCast _).ge⟩ #align tendsto_ceil_at_top tendsto_ceil_atTop theorem tendsto_ceil_atBot : Tendsto (ceil : α → ℤ) atBot atBot := ceil_mono.tendsto_atBot_atBot fun b => ⟨(b - 1 : ℤ), by rw [ceil_intCast]; exact (sub_one_lt _).le⟩ #align tendsto_ceil_at_bot tendsto_ceil_atBot variable [TopologicalSpace α] theorem continuousOn_floor (n : ℤ) : ContinuousOn (fun x => floor x : α → α) (Ico n (n + 1) : Set α) := (continuousOn_congr <| floor_eq_on_Ico' n).mpr continuousOn_const #align continuous_on_floor continuousOn_floor theorem continuousOn_ceil (n : ℤ) : ContinuousOn (fun x => ceil x : α → α) (Ioc (n - 1) n : Set α) := (continuousOn_congr <| ceil_eq_on_Ioc' n).mpr continuousOn_const #align continuous_on_ceil continuousOn_ceil section OrderClosedTopology variable [OrderClosedTopology α] -- Porting note (#10756): new theorem theorem tendsto_floor_right_pure_floor (x : α) : Tendsto (floor : α → ℤ) (𝓝[≥] x) (pure ⌊x⌋) := tendsto_pure.2 <| mem_of_superset (Ico_mem_nhdsWithin_Ici' <| lt_floor_add_one x) fun _y hy => floor_eq_on_Ico _ _ ⟨(floor_le x).trans hy.1, hy.2⟩ -- Porting note (#10756): new theorem
Mathlib/Topology/Algebra/Order/Floor.lean
74
75
theorem tendsto_floor_right_pure (n : ℤ) : Tendsto (floor : α → ℤ) (𝓝[≥] n) (pure n) := by
simpa only [floor_intCast] using tendsto_floor_right_pure_floor (n : α)
1
2.718282
0
0.5
6
492
import Mathlib.MeasureTheory.Decomposition.SignedHahn import Mathlib.MeasureTheory.Measure.MutuallySingular #align_import measure_theory.decomposition.jordan from "leanprover-community/mathlib"@"70a4f2197832bceab57d7f41379b2592d1110570" noncomputable section open scoped Classical MeasureTheory ENNReal NNReal variable {α β : Type*} [MeasurableSpace α] namespace MeasureTheory @[ext] structure JordanDecomposition (α : Type*) [MeasurableSpace α] where (posPart negPart : Measure α) [posPart_finite : IsFiniteMeasure posPart] [negPart_finite : IsFiniteMeasure negPart] mutuallySingular : posPart ⟂ₘ negPart #align measure_theory.jordan_decomposition MeasureTheory.JordanDecomposition #align measure_theory.jordan_decomposition.pos_part MeasureTheory.JordanDecomposition.posPart #align measure_theory.jordan_decomposition.neg_part MeasureTheory.JordanDecomposition.negPart #align measure_theory.jordan_decomposition.pos_part_finite MeasureTheory.JordanDecomposition.posPart_finite #align measure_theory.jordan_decomposition.neg_part_finite MeasureTheory.JordanDecomposition.negPart_finite #align measure_theory.jordan_decomposition.mutually_singular MeasureTheory.JordanDecomposition.mutuallySingular attribute [instance] JordanDecomposition.posPart_finite attribute [instance] JordanDecomposition.negPart_finite namespace JordanDecomposition open Measure VectorMeasure variable (j : JordanDecomposition α) instance instZero : Zero (JordanDecomposition α) where zero := ⟨0, 0, MutuallySingular.zero_right⟩ #align measure_theory.jordan_decomposition.has_zero MeasureTheory.JordanDecomposition.instZero instance instInhabited : Inhabited (JordanDecomposition α) where default := 0 #align measure_theory.jordan_decomposition.inhabited MeasureTheory.JordanDecomposition.instInhabited instance instInvolutiveNeg : InvolutiveNeg (JordanDecomposition α) where neg j := ⟨j.negPart, j.posPart, j.mutuallySingular.symm⟩ neg_neg _ := JordanDecomposition.ext _ _ rfl rfl #align measure_theory.jordan_decomposition.has_involutive_neg MeasureTheory.JordanDecomposition.instInvolutiveNeg instance instSMul : SMul ℝ≥0 (JordanDecomposition α) where smul r j := ⟨r • j.posPart, r • j.negPart, MutuallySingular.smul _ (MutuallySingular.smul _ j.mutuallySingular.symm).symm⟩ #align measure_theory.jordan_decomposition.has_smul MeasureTheory.JordanDecomposition.instSMul instance instSMulReal : SMul ℝ (JordanDecomposition α) where smul r j := if 0 ≤ r then r.toNNReal • j else -((-r).toNNReal • j) #align measure_theory.jordan_decomposition.has_smul_real MeasureTheory.JordanDecomposition.instSMulReal @[simp] theorem zero_posPart : (0 : JordanDecomposition α).posPart = 0 := rfl #align measure_theory.jordan_decomposition.zero_pos_part MeasureTheory.JordanDecomposition.zero_posPart @[simp] theorem zero_negPart : (0 : JordanDecomposition α).negPart = 0 := rfl #align measure_theory.jordan_decomposition.zero_neg_part MeasureTheory.JordanDecomposition.zero_negPart @[simp] theorem neg_posPart : (-j).posPart = j.negPart := rfl #align measure_theory.jordan_decomposition.neg_pos_part MeasureTheory.JordanDecomposition.neg_posPart @[simp] theorem neg_negPart : (-j).negPart = j.posPart := rfl #align measure_theory.jordan_decomposition.neg_neg_part MeasureTheory.JordanDecomposition.neg_negPart @[simp] theorem smul_posPart (r : ℝ≥0) : (r • j).posPart = r • j.posPart := rfl #align measure_theory.jordan_decomposition.smul_pos_part MeasureTheory.JordanDecomposition.smul_posPart @[simp] theorem smul_negPart (r : ℝ≥0) : (r • j).negPart = r • j.negPart := rfl #align measure_theory.jordan_decomposition.smul_neg_part MeasureTheory.JordanDecomposition.smul_negPart theorem real_smul_def (r : ℝ) (j : JordanDecomposition α) : r • j = if 0 ≤ r then r.toNNReal • j else -((-r).toNNReal • j) := rfl #align measure_theory.jordan_decomposition.real_smul_def MeasureTheory.JordanDecomposition.real_smul_def @[simp] theorem coe_smul (r : ℝ≥0) : (r : ℝ) • j = r • j := by -- Porting note: replaced `show` rw [real_smul_def, if_pos (NNReal.coe_nonneg r), Real.toNNReal_coe] #align measure_theory.jordan_decomposition.coe_smul MeasureTheory.JordanDecomposition.coe_smul theorem real_smul_nonneg (r : ℝ) (hr : 0 ≤ r) : r • j = r.toNNReal • j := dif_pos hr #align measure_theory.jordan_decomposition.real_smul_nonneg MeasureTheory.JordanDecomposition.real_smul_nonneg theorem real_smul_neg (r : ℝ) (hr : r < 0) : r • j = -((-r).toNNReal • j) := dif_neg (not_le.2 hr) #align measure_theory.jordan_decomposition.real_smul_neg MeasureTheory.JordanDecomposition.real_smul_neg
Mathlib/MeasureTheory/Decomposition/Jordan.lean
148
150
theorem real_smul_posPart_nonneg (r : ℝ) (hr : 0 ≤ r) : (r • j).posPart = r.toNNReal • j.posPart := by
rw [real_smul_def, ← smul_posPart, if_pos hr]
1
2.718282
0
0.333333
6
360
import Mathlib.Data.PFunctor.Univariate.M #align_import data.qpf.univariate.basic from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7" universe u class QPF (F : Type u → Type u) [Functor F] where P : PFunctor.{u} abs : ∀ {α}, P α → F α repr : ∀ {α}, F α → P α abs_repr : ∀ {α} (x : F α), abs (repr x) = x abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p #align qpf QPF namespace QPF variable {F : Type u → Type u} [Functor F] [q : QPF F] open Functor (Liftp Liftr) def corecF {α : Type _} (g : α → F α) : α → q.P.M := PFunctor.M.corec fun x => repr (g x) set_option linter.uppercaseLean3 false in #align qpf.corecF QPF.corecF
Mathlib/Data/QPF/Univariate/Basic.lean
377
379
theorem corecF_eq {α : Type _} (g : α → F α) (x : α) : PFunctor.M.dest (corecF g x) = q.P.map (corecF g) (repr (g x)) := by
rw [corecF, PFunctor.M.dest_corec]
1
2.718282
0
1.571429
7
1,701
import Mathlib.Data.List.Infix #align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" -- Make sure we don't import algebra assert_not_exists Monoid variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ) namespace List def rdrop : List α := l.take (l.length - n) #align list.rdrop List.rdrop @[simp]
Mathlib/Data/List/DropRight.lean
47
47
theorem rdrop_nil : rdrop ([] : List α) n = [] := by
simp [rdrop]
1
2.718282
0
0.631579
19
550
import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.degree.lemmas from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f" noncomputable section open Polynomial open Finsupp Finset namespace Polynomial universe u v w variable {R : Type u} {S : Type v} {ι : Type w} {a b : R} {m n : ℕ} section Semiring variable [Semiring R] {p q r : R[X]} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} {a : R} theorem degree_mul_C (a0 : a ≠ 0) : (p * C a).degree = p.degree := by rw [degree_mul, degree_C a0, add_zero] set_option linter.uppercaseLean3 false in #align polynomial.degree_mul_C Polynomial.degree_mul_C theorem degree_C_mul (a0 : a ≠ 0) : (C a * p).degree = p.degree := by rw [degree_mul, degree_C a0, zero_add] set_option linter.uppercaseLean3 false in #align polynomial.degree_C_mul Polynomial.degree_C_mul
Mathlib/Algebra/Polynomial/Degree/Lemmas.lean
366
367
theorem natDegree_mul_C (a0 : a ≠ 0) : (p * C a).natDegree = p.natDegree := by
simp only [natDegree, degree_mul_C a0]
1
2.718282
0
0.857143
14
751
import Mathlib.Algebra.ModEq import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Order.Archimedean import Mathlib.Algebra.Periodic import Mathlib.Data.Int.SuccPred import Mathlib.GroupTheory.QuotientGroup import Mathlib.Order.Circular import Mathlib.Data.List.TFAE import Mathlib.Data.Set.Lattice #align_import algebra.order.to_interval_mod from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec" noncomputable section section LinearOrderedAddCommGroup variable {α : Type*} [LinearOrderedAddCommGroup α] [hα : Archimedean α] {p : α} (hp : 0 < p) {a b c : α} {n : ℤ} def toIcoDiv (a b : α) : ℤ := (existsUnique_sub_zsmul_mem_Ico hp b a).choose #align to_Ico_div toIcoDiv theorem sub_toIcoDiv_zsmul_mem_Ico (a b : α) : b - toIcoDiv hp a b • p ∈ Set.Ico a (a + p) := (existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.1 #align sub_to_Ico_div_zsmul_mem_Ico sub_toIcoDiv_zsmul_mem_Ico theorem toIcoDiv_eq_of_sub_zsmul_mem_Ico (h : b - n • p ∈ Set.Ico a (a + p)) : toIcoDiv hp a b = n := ((existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.2 _ h).symm #align to_Ico_div_eq_of_sub_zsmul_mem_Ico toIcoDiv_eq_of_sub_zsmul_mem_Ico def toIocDiv (a b : α) : ℤ := (existsUnique_sub_zsmul_mem_Ioc hp b a).choose #align to_Ioc_div toIocDiv theorem sub_toIocDiv_zsmul_mem_Ioc (a b : α) : b - toIocDiv hp a b • p ∈ Set.Ioc a (a + p) := (existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.1 #align sub_to_Ioc_div_zsmul_mem_Ioc sub_toIocDiv_zsmul_mem_Ioc theorem toIocDiv_eq_of_sub_zsmul_mem_Ioc (h : b - n • p ∈ Set.Ioc a (a + p)) : toIocDiv hp a b = n := ((existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.2 _ h).symm #align to_Ioc_div_eq_of_sub_zsmul_mem_Ioc toIocDiv_eq_of_sub_zsmul_mem_Ioc def toIcoMod (a b : α) : α := b - toIcoDiv hp a b • p #align to_Ico_mod toIcoMod def toIocMod (a b : α) : α := b - toIocDiv hp a b • p #align to_Ioc_mod toIocMod theorem toIcoMod_mem_Ico (a b : α) : toIcoMod hp a b ∈ Set.Ico a (a + p) := sub_toIcoDiv_zsmul_mem_Ico hp a b #align to_Ico_mod_mem_Ico toIcoMod_mem_Ico theorem toIcoMod_mem_Ico' (b : α) : toIcoMod hp 0 b ∈ Set.Ico 0 p := by convert toIcoMod_mem_Ico hp 0 b exact (zero_add p).symm #align to_Ico_mod_mem_Ico' toIcoMod_mem_Ico' theorem toIocMod_mem_Ioc (a b : α) : toIocMod hp a b ∈ Set.Ioc a (a + p) := sub_toIocDiv_zsmul_mem_Ioc hp a b #align to_Ioc_mod_mem_Ioc toIocMod_mem_Ioc theorem left_le_toIcoMod (a b : α) : a ≤ toIcoMod hp a b := (Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).1 #align left_le_to_Ico_mod left_le_toIcoMod theorem left_lt_toIocMod (a b : α) : a < toIocMod hp a b := (Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).1 #align left_lt_to_Ioc_mod left_lt_toIocMod theorem toIcoMod_lt_right (a b : α) : toIcoMod hp a b < a + p := (Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).2 #align to_Ico_mod_lt_right toIcoMod_lt_right theorem toIocMod_le_right (a b : α) : toIocMod hp a b ≤ a + p := (Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).2 #align to_Ioc_mod_le_right toIocMod_le_right @[simp] theorem self_sub_toIcoDiv_zsmul (a b : α) : b - toIcoDiv hp a b • p = toIcoMod hp a b := rfl #align self_sub_to_Ico_div_zsmul self_sub_toIcoDiv_zsmul @[simp] theorem self_sub_toIocDiv_zsmul (a b : α) : b - toIocDiv hp a b • p = toIocMod hp a b := rfl #align self_sub_to_Ioc_div_zsmul self_sub_toIocDiv_zsmul @[simp] theorem toIcoDiv_zsmul_sub_self (a b : α) : toIcoDiv hp a b • p - b = -toIcoMod hp a b := by rw [toIcoMod, neg_sub] #align to_Ico_div_zsmul_sub_self toIcoDiv_zsmul_sub_self @[simp] theorem toIocDiv_zsmul_sub_self (a b : α) : toIocDiv hp a b • p - b = -toIocMod hp a b := by rw [toIocMod, neg_sub] #align to_Ioc_div_zsmul_sub_self toIocDiv_zsmul_sub_self @[simp] theorem toIcoMod_sub_self (a b : α) : toIcoMod hp a b - b = -toIcoDiv hp a b • p := by rw [toIcoMod, sub_sub_cancel_left, neg_smul] #align to_Ico_mod_sub_self toIcoMod_sub_self @[simp]
Mathlib/Algebra/Order/ToIntervalMod.lean
138
139
theorem toIocMod_sub_self (a b : α) : toIocMod hp a b - b = -toIocDiv hp a b • p := by
rw [toIocMod, sub_sub_cancel_left, neg_smul]
1
2.718282
0
0.2
5
281
import Mathlib.Algebra.BigOperators.WithTop import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Data.ENNReal.Basic #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} section OperationsAndInfty variable {α : Type*} @[simp] theorem add_eq_top : a + b = ∞ ↔ a = ∞ ∨ b = ∞ := WithTop.add_eq_top #align ennreal.add_eq_top ENNReal.add_eq_top @[simp] theorem add_lt_top : a + b < ∞ ↔ a < ∞ ∧ b < ∞ := WithTop.add_lt_top #align ennreal.add_lt_top ENNReal.add_lt_top theorem toNNReal_add {r₁ r₂ : ℝ≥0∞} (h₁ : r₁ ≠ ∞) (h₂ : r₂ ≠ ∞) : (r₁ + r₂).toNNReal = r₁.toNNReal + r₂.toNNReal := by lift r₁ to ℝ≥0 using h₁ lift r₂ to ℝ≥0 using h₂ rfl #align ennreal.to_nnreal_add ENNReal.toNNReal_add theorem not_lt_top {x : ℝ≥0∞} : ¬x < ∞ ↔ x = ∞ := by rw [lt_top_iff_ne_top, Classical.not_not] #align ennreal.not_lt_top ENNReal.not_lt_top theorem add_ne_top : a + b ≠ ∞ ↔ a ≠ ∞ ∧ b ≠ ∞ := by simpa only [lt_top_iff_ne_top] using add_lt_top #align ennreal.add_ne_top ENNReal.add_ne_top theorem mul_top' : a * ∞ = if a = 0 then 0 else ∞ := by convert WithTop.mul_top' a #align ennreal.mul_top ENNReal.mul_top' -- Porting note: added because `simp` no longer uses `WithTop` lemmas for `ℝ≥0∞` @[simp] theorem mul_top (h : a ≠ 0) : a * ∞ = ∞ := WithTop.mul_top h theorem top_mul' : ∞ * a = if a = 0 then 0 else ∞ := by convert WithTop.top_mul' a #align ennreal.top_mul ENNReal.top_mul' -- Porting note: added because `simp` no longer uses `WithTop` lemmas for `ℝ≥0∞` @[simp] theorem top_mul (h : a ≠ 0) : ∞ * a = ∞ := WithTop.top_mul h theorem top_mul_top : ∞ * ∞ = ∞ := WithTop.top_mul_top #align ennreal.top_mul_top ENNReal.top_mul_top -- Porting note (#11215): TODO: assume `n ≠ 0` instead of `0 < n` -- Porting note (#11215): TODO: generalize to `WithTop` theorem top_pow {n : ℕ} (h : 0 < n) : ∞ ^ n = ∞ := Nat.le_induction (pow_one _) (fun m _ hm => by rw [pow_succ, hm, top_mul_top]) _ (Nat.succ_le_of_lt h) #align ennreal.top_pow ENNReal.top_pow theorem mul_eq_top : a * b = ∞ ↔ a ≠ 0 ∧ b = ∞ ∨ a = ∞ ∧ b ≠ 0 := WithTop.mul_eq_top_iff #align ennreal.mul_eq_top ENNReal.mul_eq_top theorem mul_lt_top : a ≠ ∞ → b ≠ ∞ → a * b < ∞ := WithTop.mul_lt_top #align ennreal.mul_lt_top ENNReal.mul_lt_top
Mathlib/Data/ENNReal/Operations.lean
235
235
theorem mul_ne_top : a ≠ ∞ → b ≠ ∞ → a * b ≠ ∞ := by
simpa only [lt_top_iff_ne_top] using mul_lt_top
1
2.718282
0
0.666667
12
570
import Mathlib.Data.Multiset.Bind import Mathlib.Control.Traversable.Lemmas import Mathlib.Control.Traversable.Instances #align_import data.multiset.functor from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" universe u namespace Multiset open List instance functor : Functor Multiset where map := @map @[simp] theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.map f := rfl #align multiset.fmap_def Multiset.fmap_def instance : LawfulFunctor Multiset where id_map := by simp comp_map := by simp map_const {_ _} := rfl open LawfulTraversable CommApplicative variable {F : Type u → Type u} [Applicative F] [CommApplicative F] variable {α' β' : Type u} (f : α' → F β') def traverse : Multiset α' → F (Multiset β') := by refine Quotient.lift (Functor.map Coe.coe ∘ Traversable.traverse f) ?_ introv p; unfold Function.comp induction p with | nil => rfl | @cons x l₁ l₂ _ h => have : Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₁ = Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₂ := by rw [h] simpa [functor_norm] using this | swap x y l => have : (fun a b (l : List β') ↦ (↑(a :: b :: l) : Multiset β')) <$> f y <*> f x = (fun a b l ↦ ↑(a :: b :: l)) <$> f x <*> f y := by rw [CommApplicative.commutative_map] congr funext a b l simpa [flip] using Perm.swap a b l simp [(· ∘ ·), this, functor_norm, Coe.coe] | trans => simp [*] #align multiset.traverse Multiset.traverse instance : Monad Multiset := { Multiset.functor with pure := fun x ↦ {x} bind := @bind } @[simp] theorem pure_def {α} : (pure : α → Multiset α) = singleton := rfl #align multiset.pure_def Multiset.pure_def @[simp] theorem bind_def {α β} : (· >>= ·) = @bind α β := rfl #align multiset.bind_def Multiset.bind_def instance : LawfulMonad Multiset := LawfulMonad.mk' (bind_pure_comp := fun _ _ ↦ by simp only [pure_def, bind_def, bind_singleton, fmap_def]) (id_map := fun _ ↦ by simp only [fmap_def, id_eq, map_id']) (pure_bind := fun _ _ ↦ by simp only [pure_def, bind_def, singleton_bind]) (bind_assoc := @bind_assoc) open Functor open Traversable LawfulTraversable @[simp] theorem lift_coe {α β : Type*} (x : List α) (f : List α → β) (h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x := Quotient.lift_mk _ _ _ #align multiset.lift_coe Multiset.lift_coe @[simp]
Mathlib/Data/Multiset/Functor.lean
97
99
theorem map_comp_coe {α β} (h : α → β) : Functor.map h ∘ Coe.coe = (Coe.coe ∘ Functor.map h : List α → Multiset β) := by
funext; simp only [Function.comp_apply, Coe.coe, fmap_def, map_coe, List.map_eq_map]
1
2.718282
0
1.5
6
1,568
import Mathlib.Algebra.Group.Int import Mathlib.GroupTheory.GroupAction.Opposite import Mathlib.Logic.Function.Iterate #align_import algebra.hom.iterate from "leanprover-community/mathlib"@"792a2a264169d64986541c6f8f7e3bbb6acb6295" assert_not_exists DenselyOrdered assert_not_exists Ring open Function variable {M : Type*} {N : Type*} {G : Type*} {H : Type*} theorem hom_coe_pow {F : Type*} [Monoid F] (c : F → M → M) (h1 : c 1 = id) (hmul : ∀ f g, c (f * g) = c f ∘ c g) (f : F) : ∀ n, c (f ^ n) = (c f)^[n] | 0 => by rw [pow_zero, h1] rfl | n + 1 => by rw [pow_succ, iterate_succ, hmul, hom_coe_pow c h1 hmul f n] #align hom_coe_pow hom_coe_pow @[to_additive (attr := simp)] theorem iterate_map_mul {M F : Type*} [Mul M] [FunLike F M M] [MulHomClass F M M] (f : F) (n : ℕ) (x y : M) : f^[n] (x * y) = f^[n] x * f^[n] y := Function.Semiconj₂.iterate (map_mul f) n x y @[to_additive (attr := simp)] theorem iterate_map_one {M F : Type*} [One M] [FunLike F M M] [OneHomClass F M M] (f : F) (n : ℕ) : f^[n] 1 = 1 := iterate_fixed (map_one f) n @[to_additive (attr := simp)] theorem iterate_map_inv {M F : Type*} [Group M] [FunLike F M M] [MonoidHomClass F M M] (f : F) (n : ℕ) (x : M) : f^[n] x⁻¹ = (f^[n] x)⁻¹ := Commute.iterate_left (map_inv f) n x @[to_additive (attr := simp)] theorem iterate_map_div {M F : Type*} [Group M] [FunLike F M M] [MonoidHomClass F M M] (f : F) (n : ℕ) (x y : M) : f^[n] (x / y) = f^[n] x / f^[n] y := Semiconj₂.iterate (map_div f) n x y @[to_additive (attr := simp)] theorem iterate_map_pow {M F : Type*} [Monoid M] [FunLike F M M] [MonoidHomClass F M M] (f : F) (n : ℕ) (x : M) (k : ℕ) : f^[n] (x ^ k) = f^[n] x ^ k := Commute.iterate_left (map_pow f · k) n x @[to_additive (attr := simp)] theorem iterate_map_zpow {M F : Type*} [Group M] [FunLike F M M] [MonoidHomClass F M M] (f : F) (n : ℕ) (x : M) (k : ℤ) : f^[n] (x ^ k) = f^[n] x ^ k := Commute.iterate_left (map_zpow f · k) n x --what should be the namespace for this section? section Monoid variable [Monoid G] (a : G) (n : ℕ) @[to_additive (attr := simp)] theorem smul_iterate [MulAction G H] : (a • · : H → H)^[n] = (a ^ n • ·) := funext fun b => Nat.recOn n (by rw [iterate_zero, id, pow_zero, one_smul]) fun n ih => by rw [iterate_succ', comp_apply, ih, pow_succ', mul_smul] #align smul_iterate smul_iterate #align vadd_iterate vadd_iterate @[to_additive] lemma smul_iterate_apply [MulAction G H] {b : H} : (a • ·)^[n] b = a ^ n • b := by rw [smul_iterate] @[to_additive (attr := simp)] theorem mul_left_iterate : (a * ·)^[n] = (a ^ n * ·) := smul_iterate a n #align mul_left_iterate mul_left_iterate #align add_left_iterate add_left_iterate @[to_additive (attr := simp)] theorem mul_right_iterate : (· * a)^[n] = (· * a ^ n) := smul_iterate (MulOpposite.op a) n #align mul_right_iterate mul_right_iterate #align add_right_iterate add_right_iterate @[to_additive]
Mathlib/Algebra/GroupPower/IterateHom.lean
111
111
theorem mul_right_iterate_apply_one : (· * a)^[n] 1 = a ^ n := by
simp [mul_right_iterate]
1
2.718282
0
0
1
119
import Mathlib.Data.DFinsupp.Interval import Mathlib.Data.DFinsupp.Multiset import Mathlib.Order.Interval.Finset.Nat #align_import data.multiset.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset DFinsupp Function open Pointwise variable {α : Type*} namespace Multiset variable [DecidableEq α] (s t : Multiset α) instance instLocallyFiniteOrder : LocallyFiniteOrder (Multiset α) := LocallyFiniteOrder.ofIcc (Multiset α) (fun s t => (Finset.Icc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding) fun s t x => by simp theorem Icc_eq : Finset.Icc s t = (Finset.Icc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding := rfl #align multiset.Icc_eq Multiset.Icc_eq theorem uIcc_eq : uIcc s t = (uIcc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding := (Icc_eq _ _).trans <| by simp [uIcc] #align multiset.uIcc_eq Multiset.uIcc_eq theorem card_Icc : (Finset.Icc s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) := by simp_rw [Icc_eq, Finset.card_map, DFinsupp.card_Icc, Nat.card_Icc, Multiset.toDFinsupp_apply, toDFinsupp_support] #align multiset.card_Icc Multiset.card_Icc
Mathlib/Data/Multiset/Interval.lean
62
64
theorem card_Ico : (Finset.Ico s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) - 1 := by
rw [Finset.card_Ico_eq_card_Icc_sub_one, card_Icc]
1
2.718282
0
0.333333
6
338
import Mathlib.Algebra.Homology.QuasiIso #align_import category_theory.preadditive.projective_resolution from "leanprover-community/mathlib"@"324a7502510e835cdbd3de1519b6c66b51fb2467" universe v u namespace CategoryTheory open Category Limits ChainComplex HomologicalComplex variable {C : Type u} [Category.{v} C] open Projective variable [HasZeroObject C] [HasZeroMorphisms C] -- porting note (#5171): removed @[nolint has_nonempty_instance] structure ProjectiveResolution (Z : C) where complex : ChainComplex C ℕ projective : ∀ n, Projective (complex.X n) := by infer_instance [hasHomology : ∀ i, complex.HasHomology i] π : complex ⟶ (ChainComplex.single₀ C).obj Z quasiIso : QuasiIso π := by infer_instance set_option linter.uppercaseLean3 false in #align category_theory.ProjectiveResolution CategoryTheory.ProjectiveResolution open ProjectiveResolution in attribute [instance] projective hasHomology ProjectiveResolution.quasiIso class HasProjectiveResolution (Z : C) : Prop where out : Nonempty (ProjectiveResolution Z) #align category_theory.has_projective_resolution CategoryTheory.HasProjectiveResolution variable (C) class HasProjectiveResolutions : Prop where out : ∀ Z : C, HasProjectiveResolution Z #align category_theory.has_projective_resolutions CategoryTheory.HasProjectiveResolutions attribute [instance 100] HasProjectiveResolutions.out namespace ProjectiveResolution variable {C} variable {Z : C} (P : ProjectiveResolution Z) lemma complex_exactAt_succ (n : ℕ) : P.complex.ExactAt (n + 1) := by rw [← quasiIsoAt_iff_exactAt' P.π (n + 1) (exactAt_succ_single_obj _ _)] infer_instance lemma exact_succ (n : ℕ): (ShortComplex.mk _ _ (P.complex.d_comp_d (n + 2) (n + 1) n)).Exact := ((HomologicalComplex.exactAt_iff' _ (n + 2) (n + 1) n) (by simp only [prev]; rfl) (by simp)).1 (P.complex_exactAt_succ n) @[simp] theorem π_f_succ (n : ℕ) : P.π.f (n + 1) = 0 := (isZero_single_obj_X _ _ _ _ (by simp)).eq_of_tgt _ _ set_option linter.uppercaseLean3 false in #align category_theory.ProjectiveResolution.π_f_succ CategoryTheory.ProjectiveResolution.π_f_succ @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Preadditive/ProjectiveResolution.lean
95
97
theorem complex_d_comp_π_f_zero : P.complex.d 1 0 ≫ P.π.f 0 = 0 := by
rw [← P.π.comm 1 0, single_obj_d, comp_zero]
1
2.718282
0
0
2
32
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
Mathlib/Algebra/Polynomial/Lifts.lean
69
70
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]
1
2.718282
0
1
13
1,139
import Mathlib.Algebra.Group.Defs import Mathlib.Data.Int.Defs import Mathlib.Data.Rat.Init import Mathlib.Order.Basic import Mathlib.Tactic.Common #align_import data.rat.defs from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" -- TODO: If `Inv` was defined earlier than `Algebra.Group.Defs`, we could have -- assert_not_exists Monoid assert_not_exists MonoidWithZero assert_not_exists Lattice assert_not_exists PNat assert_not_exists Nat.dvd_mul open Function namespace Rat variable {q : ℚ} -- Porting note: the definition of `ℚ` has changed; in mathlib3 this was a field. theorem pos (a : ℚ) : 0 < a.den := Nat.pos_of_ne_zero a.den_nz #align rat.pos Rat.pos #align rat.of_int Rat.ofInt lemma mk'_num_den (q : ℚ) : mk' q.num q.den q.den_nz q.reduced = q := rfl @[simp] theorem ofInt_eq_cast (n : ℤ) : ofInt n = Int.cast n := rfl #align rat.of_int_eq_cast Rat.ofInt_eq_cast -- TODO: Replace `Rat.ofNat_num`/`Rat.ofNat_den` in Batteries -- See note [no_index around OfNat.ofNat] @[simp] lemma num_ofNat (n : ℕ) : num (no_index (OfNat.ofNat n)) = OfNat.ofNat n := rfl @[simp] lemma den_ofNat (n : ℕ) : den (no_index (OfNat.ofNat n)) = 1 := rfl @[simp, norm_cast] lemma num_natCast (n : ℕ) : num n = n := rfl #align rat.coe_nat_num Rat.num_natCast @[simp, norm_cast] lemma den_natCast (n : ℕ) : den n = 1 := rfl #align rat.coe_nat_denom Rat.den_natCast -- TODO: Replace `intCast_num`/`intCast_den` the names in Batteries @[simp, norm_cast] lemma num_intCast (n : ℤ) : (n : ℚ).num = n := rfl #align rat.coe_int_num Rat.num_intCast @[simp, norm_cast] lemma den_intCast (n : ℤ) : (n : ℚ).den = 1 := rfl #align rat.coe_int_denom Rat.den_intCast @[deprecated (since := "2024-04-29")] alias coe_int_num := num_intCast @[deprecated (since := "2024-04-29")] alias coe_int_den := den_intCast lemma intCast_injective : Injective (Int.cast : ℤ → ℚ) := fun _ _ ↦ congr_arg num lemma natCast_injective : Injective (Nat.cast : ℕ → ℚ) := intCast_injective.comp fun _ _ ↦ Int.natCast_inj.1 -- We want to use these lemmas earlier than the lemmas simp can prove them with @[simp, nolint simpNF, norm_cast] lemma natCast_inj {m n : ℕ} : (m : ℚ) = n ↔ m = n := natCast_injective.eq_iff @[simp, nolint simpNF, norm_cast] lemma intCast_eq_zero {n : ℤ} : (n : ℚ) = 0 ↔ n = 0 := intCast_inj @[simp, nolint simpNF, norm_cast] lemma natCast_eq_zero {n : ℕ} : (n : ℚ) = 0 ↔ n = 0 := natCast_inj @[simp, nolint simpNF, norm_cast] lemma intCast_eq_one {n : ℤ} : (n : ℚ) = 1 ↔ n = 1 := intCast_inj @[simp, nolint simpNF, norm_cast] lemma natCast_eq_one {n : ℕ} : (n : ℚ) = 1 ↔ n = 1 := natCast_inj #noalign rat.mk_pnat #noalign rat.mk_pnat_eq #noalign rat.zero_mk_pnat -- Porting note (#11215): TODO Should this be namespaced? #align rat.mk_nat mkRat lemma mkRat_eq_divInt (n d) : mkRat n d = n /. d := rfl #align rat.mk_nat_eq Rat.mkRat_eq_divInt #align rat.mk_zero Rat.divInt_zero #align rat.zero_mk_nat Rat.zero_mkRat #align rat.zero_mk Rat.zero_divInt @[simp] lemma mk'_zero (d) (h : d ≠ 0) (w) : mk' 0 d h w = 0 := by congr; simp_all @[simp] lemma num_eq_zero {q : ℚ} : q.num = 0 ↔ q = 0 := by induction q constructor · rintro rfl exact mk'_zero _ _ _ · exact congr_arg num lemma num_ne_zero {q : ℚ} : q.num ≠ 0 ↔ q ≠ 0 := num_eq_zero.not #align rat.num_ne_zero_of_ne_zero Rat.num_ne_zero @[simp] lemma den_ne_zero (q : ℚ) : q.den ≠ 0 := q.den_pos.ne' #noalign rat.nonneg @[simp] lemma num_nonneg : 0 ≤ q.num ↔ 0 ≤ q := by simp [Int.le_iff_lt_or_eq, instLE, Rat.blt, Int.not_lt]; tauto #align rat.num_nonneg_iff_zero_le Rat.num_nonneg @[simp]
Mathlib/Data/Rat/Defs.lean
127
128
theorem divInt_eq_zero {a b : ℤ} (b0 : b ≠ 0) : a /. b = 0 ↔ a = 0 := by
rw [← zero_divInt b, divInt_eq_iff b0 b0, Int.zero_mul, Int.mul_eq_zero, or_iff_left b0]
1
2.718282
0
0
1
16
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.NormedSpace.FiniteDimension #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Function Set Filter open scoped Topology Filter variable {E X : Type*} structure ContDiffBump (c : E) where (rIn rOut : ℝ) rIn_pos : 0 < rIn rIn_lt_rOut : rIn < rOut #align cont_diff_bump ContDiffBump #align cont_diff_bump.r ContDiffBump.rIn set_option linter.uppercaseLean3 false in #align cont_diff_bump.R ContDiffBump.rOut #align cont_diff_bump.r_pos ContDiffBump.rIn_pos set_option linter.uppercaseLean3 false in #align cont_diff_bump.r_lt_R ContDiffBump.rIn_lt_rOut -- Porting note(#5171): linter not yet ported; was @[nolint has_nonempty_instance] structure ContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where toFun : ℝ → E → ℝ mem_Icc : ∀ (R : ℝ) (x : E), toFun R x ∈ Icc (0 : ℝ) 1 symmetric : ∀ (R : ℝ) (x : E), toFun R (-x) = toFun R x smooth : ContDiffOn ℝ ⊤ (uncurry toFun) (Ioi (1 : ℝ) ×ˢ (univ : Set E)) eq_one : ∀ R : ℝ, 1 < R → ∀ x : E, ‖x‖ ≤ 1 → toFun R x = 1 support : ∀ R : ℝ, 1 < R → Function.support (toFun R) = Metric.ball (0 : E) R #align cont_diff_bump_base ContDiffBumpBase class HasContDiffBump (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] : Prop where out : Nonempty (ContDiffBumpBase E) #align has_cont_diff_bump HasContDiffBump def someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] [hb : HasContDiffBump E] : ContDiffBumpBase E := Nonempty.some hb.out #align some_cont_diff_bump_base someContDiffBumpBase namespace ContDiffBump theorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut := f.rIn_pos.trans f.rIn_lt_rOut set_option linter.uppercaseLean3 false in #align cont_diff_bump.R_pos ContDiffBump.rOut_pos theorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn := by rw [one_lt_div f.rIn_pos] exact f.rIn_lt_rOut set_option linter.uppercaseLean3 false in #align cont_diff_bump.one_lt_R_div_r ContDiffBump.one_lt_rOut_div_rIn instance (c : E) : Inhabited (ContDiffBump c) := ⟨⟨1, 2, zero_lt_one, one_lt_two⟩⟩ variable [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup X] [NormedSpace ℝ X] [HasContDiffBump E] {c : E} (f : ContDiffBump c) {x : E} {n : ℕ∞} @[coe] def toFun {c : E} (f : ContDiffBump c) : E → ℝ := (someContDiffBumpBase E).toFun (f.rOut / f.rIn) ∘ fun x ↦ (f.rIn⁻¹ • (x - c)) #align cont_diff_bump.to_fun ContDiffBump.toFun instance : CoeFun (ContDiffBump c) fun _ => E → ℝ := ⟨toFun⟩ protected theorem apply (x : E) : f x = (someContDiffBumpBase E).toFun (f.rOut / f.rIn) (f.rIn⁻¹ • (x - c)) := rfl #align cont_diff_bump.def ContDiffBump.apply protected theorem sub (x : E) : f (c - x) = f (c + x) := by simp [f.apply, ContDiffBumpBase.symmetric] #align cont_diff_bump.sub ContDiffBump.sub protected theorem neg (f : ContDiffBump (0 : E)) (x : E) : f (-x) = f x := by simp_rw [← zero_sub, f.sub, zero_add] #align cont_diff_bump.neg ContDiffBump.neg open Metric theorem one_of_mem_closedBall (hx : x ∈ closedBall c f.rIn) : f x = 1 := by apply ContDiffBumpBase.eq_one _ _ f.one_lt_rOut_div_rIn simpa only [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg f.rIn_pos.le, ← div_eq_inv_mul, div_le_one f.rIn_pos] using mem_closedBall_iff_norm.1 hx #align cont_diff_bump.one_of_mem_closed_ball ContDiffBump.one_of_mem_closedBall theorem nonneg : 0 ≤ f x := (ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).1 #align cont_diff_bump.nonneg ContDiffBump.nonneg theorem nonneg' (x : E) : 0 ≤ f x := f.nonneg #align cont_diff_bump.nonneg' ContDiffBump.nonneg' theorem le_one : f x ≤ 1 := (ContDiffBumpBase.mem_Icc (someContDiffBumpBase E) _ _).2 #align cont_diff_bump.le_one ContDiffBump.le_one theorem support_eq : Function.support f = Metric.ball c f.rOut := by simp only [toFun, support_comp_eq_preimage, ContDiffBumpBase.support _ _ f.one_lt_rOut_div_rIn] ext x simp only [mem_ball_iff_norm, sub_zero, norm_smul, mem_preimage, Real.norm_eq_abs, abs_inv, abs_of_pos f.rIn_pos, ← div_eq_inv_mul, div_lt_div_right f.rIn_pos] #align cont_diff_bump.support_eq ContDiffBump.support_eq
Mathlib/Analysis/Calculus/BumpFunction/Basic.lean
179
180
theorem tsupport_eq : tsupport f = closedBall c f.rOut := by
simp_rw [tsupport, f.support_eq, closure_ball _ f.rOut_pos.ne']
1
2.718282
0
1
4
1,090
import Mathlib.Data.Finset.Card #align_import data.finset.option from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" variable {α β : Type*} open Function namespace Finset def insertNone : Finset α ↪o Finset (Option α) := (OrderEmbedding.ofMapLEIff fun s => cons none (s.map Embedding.some) <| by simp) fun s t => by rw [le_iff_subset, cons_subset_cons, map_subset_map, le_iff_subset] #align finset.insert_none Finset.insertNone @[simp] theorem mem_insertNone {s : Finset α} : ∀ {o : Option α}, o ∈ insertNone s ↔ ∀ a ∈ o, a ∈ s | none => iff_of_true (Multiset.mem_cons_self _ _) fun a h => by cases h | some a => Multiset.mem_cons.trans <| by simp #align finset.mem_insert_none Finset.mem_insertNone lemma forall_mem_insertNone {s : Finset α} {p : Option α → Prop} : (∀ a ∈ insertNone s, p a) ↔ p none ∧ ∀ a ∈ s, p a := by simp [Option.forall] theorem some_mem_insertNone {s : Finset α} {a : α} : some a ∈ insertNone s ↔ a ∈ s := by simp #align finset.some_mem_insert_none Finset.some_mem_insertNone lemma none_mem_insertNone {s : Finset α} : none ∈ insertNone s := by simp @[aesop safe apply (rule_sets := [finsetNonempty])] lemma insertNone_nonempty {s : Finset α} : insertNone s |>.Nonempty := ⟨none, none_mem_insertNone⟩ @[simp] theorem card_insertNone (s : Finset α) : s.insertNone.card = s.card + 1 := by simp [insertNone] #align finset.card_insert_none Finset.card_insertNone def eraseNone : Finset (Option α) →o Finset α := (Finset.mapEmbedding (Equiv.optionIsSomeEquiv α).toEmbedding).toOrderHom.comp ⟨Finset.subtype _, subtype_mono⟩ #align finset.erase_none Finset.eraseNone @[simp]
Mathlib/Data/Finset/Option.lean
98
99
theorem mem_eraseNone {s : Finset (Option α)} {x : α} : x ∈ eraseNone s ↔ some x ∈ s := by
simp [eraseNone]
1
2.718282
0
0
5
120
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def'
Mathlib/NumberTheory/Bernoulli.lean
78
80
theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by
rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range]
1
2.718282
0
1.272727
11
1,346
import Mathlib.Algebra.Algebra.Operations import Mathlib.Data.Fintype.Lattice import Mathlib.RingTheory.Coprime.Lemmas #align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" assert_not_exists Basis -- See `RingTheory.Ideal.Basis` assert_not_exists Submodule.hasQuotient -- See `RingTheory.Ideal.QuotientOperations` universe u v w x open Pointwise namespace Submodule variable {R : Type u} {M : Type v} {M' F G : Type*} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M'] open Pointwise instance hasSMul' : SMul (Ideal R) (Submodule R M) := ⟨Submodule.map₂ (LinearMap.lsmul R M)⟩ #align submodule.has_smul' Submodule.hasSMul' protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I • J = I * J := rfl #align ideal.smul_eq_mul Ideal.smul_eq_mul variable (R M) in def _root_.Module.annihilator : Ideal R := LinearMap.ker (LinearMap.lsmul R M) theorem _root_.Module.mem_annihilator {r} : r ∈ Module.annihilator R M ↔ ∀ m : M, r • m = 0 := ⟨fun h ↦ (congr($h ·)), (LinearMap.ext ·)⟩ theorem _root_.LinearMap.annihilator_le_of_injective (f : M →ₗ[R] M') (hf : Function.Injective f) : Module.annihilator R M' ≤ Module.annihilator R M := fun x h ↦ by rw [Module.mem_annihilator] at h ⊢; exact fun m ↦ hf (by rw [map_smul, h, f.map_zero]) theorem _root_.LinearMap.annihilator_le_of_surjective (f : M →ₗ[R] M') (hf : Function.Surjective f) : Module.annihilator R M ≤ Module.annihilator R M' := fun x h ↦ by rw [Module.mem_annihilator] at h ⊢ intro m; obtain ⟨m, rfl⟩ := hf m rw [← map_smul, h, f.map_zero] theorem _root_.LinearEquiv.annihilator_eq (e : M ≃ₗ[R] M') : Module.annihilator R M = Module.annihilator R M' := (e.annihilator_le_of_surjective e.surjective).antisymm (e.annihilator_le_of_injective e.injective) abbrev annihilator (N : Submodule R M) : Ideal R := Module.annihilator R N #align submodule.annihilator Submodule.annihilator theorem annihilator_top : (⊤ : Submodule R M).annihilator = Module.annihilator R M := topEquiv.annihilator_eq variable {I J : Ideal R} {N P : Submodule R M}
Mathlib/RingTheory/Ideal/Operations.lean
74
75
theorem mem_annihilator {r} : r ∈ N.annihilator ↔ ∀ n ∈ N, r • n = (0 : M) := by
simp_rw [annihilator, Module.mem_annihilator, Subtype.forall, Subtype.ext_iff]; rfl
1
2.718282
0
0.5
4
467
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : ∀ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : ∀ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : ∀ {n}, (n ≠ 0) → shiftLeft' true m n ≠ 0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n ≠ 0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n ≠ 0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n ≠ 0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊢ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊢ cases b; · exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF] theorem size_shiftLeft {m} (h : m ≠ 0) (n) : size (m <<< n) = size m + n := by simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false] #align nat.size_shiftl Nat.size_shiftLeft theorem lt_size_self (n : ℕ) : n < 2 ^ size n := by rw [← one_shiftLeft] have : ∀ {n}, n = 0 → n < 1 <<< (size n) := by simp apply binaryRec _ _ n · apply this rfl intro b n IH by_cases h : bit b n = 0 · apply this h rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val] exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH) #align nat.lt_size_self Nat.lt_size_self theorem size_le {m n : ℕ} : size m ≤ n ↔ m < 2 ^ n := ⟨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by rw [← one_shiftLeft]; revert n apply binaryRec _ _ m · intro n simp · intro b m IH n h by_cases e : bit b m = 0 · simp [e] rw [size_bit e] cases' n with n · exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h)) · apply succ_le_succ (IH _) apply Nat.lt_of_mul_lt_mul_left (a := 2) simp only [← bit0_val, shiftLeft_succ] at * exact lt_of_le_of_lt (bit0_le_bit b rfl.le) h⟩ #align nat.size_le Nat.size_le
Mathlib/Data/Nat/Size.lean
137
138
theorem lt_size {m n : ℕ} : m < size n ↔ 2 ^ m ≤ n := by
rw [← not_lt, Decidable.iff_not_comm, not_lt, size_le]
1
2.718282
0
0.666667
9
569
import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Integral.CircleIntegral #align_import measure_theory.integral.torus_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" variable {n : ℕ} variable {E : Type*} [NormedAddCommGroup E] noncomputable section open Complex Set MeasureTheory Function Filter TopologicalSpace open scoped Real -- Porting note: notation copied from `./DivergenceTheorem` local macro:arg t:term:max noWs "ⁿ⁺¹" : term => `(Fin (n + 1) → $t) local macro:arg t:term:max noWs "ⁿ" : term => `(Fin n → $t) local macro:arg t:term:max noWs "⁰" : term => `(Fin 0 → $t) local macro:arg t:term:max noWs "¹" : term => `(Fin 1 → $t) def torusMap (c : ℂⁿ) (R : ℝⁿ) : ℝⁿ → ℂⁿ := fun θ i => c i + R i * exp (θ i * I) #align torus_map torusMap theorem torusMap_sub_center (c : ℂⁿ) (R : ℝⁿ) (θ : ℝⁿ) : torusMap c R θ - c = torusMap 0 R θ := by ext1 i; simp [torusMap] #align torus_map_sub_center torusMap_sub_center theorem torusMap_eq_center_iff {c : ℂⁿ} {R : ℝⁿ} {θ : ℝⁿ} : torusMap c R θ = c ↔ R = 0 := by simp [funext_iff, torusMap, exp_ne_zero] #align torus_map_eq_center_iff torusMap_eq_center_iff @[simp] theorem torusMap_zero_radius (c : ℂⁿ) : torusMap c 0 = const ℝⁿ c := funext fun _ ↦ torusMap_eq_center_iff.2 rfl #align torus_map_zero_radius torusMap_zero_radius def TorusIntegrable (f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) : Prop := IntegrableOn (fun θ : ℝⁿ => f (torusMap c R θ)) (Icc (0 : ℝⁿ) fun _ => 2 * π) volume #align torus_integrable TorusIntegrable variable [NormedSpace ℂ E] [CompleteSpace E] {f g : (Fin n → ℂ) → E} {c : Fin n → ℂ} {R : Fin n → ℝ} def torusIntegral (f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) := ∫ θ : ℝⁿ in Icc (0 : ℝⁿ) fun _ => 2 * π, (∏ i, R i * exp (θ i * I) * I : ℂ) • f (torusMap c R θ) #align torus_integral torusIntegral @[inherit_doc torusIntegral] notation3"∯ "(...)" in ""T("c", "R")"", "r:(scoped f => torusIntegral f c R) => r theorem torusIntegral_radius_zero (hn : n ≠ 0) (f : ℂⁿ → E) (c : ℂⁿ) : (∯ x in T(c, 0), f x) = 0 := by simp only [torusIntegral, Pi.zero_apply, ofReal_zero, mul_zero, zero_mul, Fin.prod_const, zero_pow hn, zero_smul, integral_zero] #align torus_integral_radius_zero torusIntegral_radius_zero
Mathlib/MeasureTheory/Integral/TorusIntegral.lean
166
167
theorem torusIntegral_neg (f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) : (∯ x in T(c, R), -f x) = -∯ x in T(c, R), f x := by
simp [torusIntegral, integral_neg]
1
2.718282
0
0.428571
7
406
import Mathlib.Geometry.Euclidean.Sphere.Basic #align_import geometry.euclidean.sphere.second_inter from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open RealInnerProductSpace namespace EuclideanGeometry variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] def Sphere.secondInter (s : Sphere P) (p : P) (v : V) : P := (-2 * ⟪v, p -ᵥ s.center⟫ / ⟪v, v⟫) • v +ᵥ p #align euclidean_geometry.sphere.second_inter EuclideanGeometry.Sphere.secondInter @[simp] theorem Sphere.secondInter_dist (s : Sphere P) (p : P) (v : V) : dist (s.secondInter p v) s.center = dist p s.center := by rw [Sphere.secondInter] by_cases hv : v = 0; · simp [hv] rw [dist_smul_vadd_eq_dist _ _ hv] exact Or.inr rfl #align euclidean_geometry.sphere.second_inter_dist EuclideanGeometry.Sphere.secondInter_dist @[simp] theorem Sphere.secondInter_mem {s : Sphere P} {p : P} (v : V) : s.secondInter p v ∈ s ↔ p ∈ s := by simp_rw [mem_sphere, Sphere.secondInter_dist] #align euclidean_geometry.sphere.second_inter_mem EuclideanGeometry.Sphere.secondInter_mem variable (V) @[simp] theorem Sphere.secondInter_zero (s : Sphere P) (p : P) : s.secondInter p (0 : V) = p := by simp [Sphere.secondInter] #align euclidean_geometry.sphere.second_inter_zero EuclideanGeometry.Sphere.secondInter_zero variable {V} theorem Sphere.secondInter_eq_self_iff {s : Sphere P} {p : P} {v : V} : s.secondInter p v = p ↔ ⟪v, p -ᵥ s.center⟫ = 0 := by refine ⟨fun hp => ?_, fun hp => ?_⟩ · by_cases hv : v = 0 · simp [hv] rwa [Sphere.secondInter, eq_comm, eq_vadd_iff_vsub_eq, vsub_self, eq_comm, smul_eq_zero, or_iff_left hv, div_eq_zero_iff, inner_self_eq_zero, or_iff_left hv, mul_eq_zero, or_iff_right (by norm_num : (-2 : ℝ) ≠ 0)] at hp · rw [Sphere.secondInter, hp, mul_zero, zero_div, zero_smul, zero_vadd] #align euclidean_geometry.sphere.second_inter_eq_self_iff EuclideanGeometry.Sphere.secondInter_eq_self_iff theorem Sphere.eq_or_eq_secondInter_of_mem_mk'_span_singleton_iff_mem {s : Sphere P} {p : P} (hp : p ∈ s) {v : V} {p' : P} (hp' : p' ∈ AffineSubspace.mk' p (ℝ ∙ v)) : p' = p ∨ p' = s.secondInter p v ↔ p' ∈ s := by refine ⟨fun h => ?_, fun h => ?_⟩ · rcases h with (h | h) · rwa [h] · rwa [h, Sphere.secondInter_mem] · rw [AffineSubspace.mem_mk'_iff_vsub_mem, Submodule.mem_span_singleton] at hp' rcases hp' with ⟨r, hr⟩ rw [eq_comm, ← eq_vadd_iff_vsub_eq] at hr subst hr by_cases hv : v = 0 · simp [hv] rw [Sphere.secondInter] rw [mem_sphere] at h hp rw [← hp, dist_smul_vadd_eq_dist _ _ hv] at h rcases h with (h | h) <;> simp [h] #align euclidean_geometry.sphere.eq_or_eq_second_inter_of_mem_mk'_span_singleton_iff_mem EuclideanGeometry.Sphere.eq_or_eq_secondInter_of_mem_mk'_span_singleton_iff_mem @[simp] theorem Sphere.secondInter_smul (s : Sphere P) (p : P) (v : V) {r : ℝ} (hr : r ≠ 0) : s.secondInter p (r • v) = s.secondInter p v := by simp_rw [Sphere.secondInter, real_inner_smul_left, inner_smul_right, smul_smul, div_mul_eq_div_div] rw [mul_comm, ← mul_div_assoc, ← mul_div_assoc, mul_div_cancel_left₀ _ hr, mul_comm, mul_assoc, mul_div_cancel_left₀ _ hr, mul_comm] #align euclidean_geometry.sphere.second_inter_smul EuclideanGeometry.Sphere.secondInter_smul @[simp]
Mathlib/Geometry/Euclidean/Sphere/SecondInter.lean
113
115
theorem Sphere.secondInter_neg (s : Sphere P) (p : P) (v : V) : s.secondInter p (-v) = s.secondInter p v := by
rw [← neg_one_smul ℝ v, s.secondInter_smul p v (by norm_num : (-1 : ℝ) ≠ 0)]
1
2.718282
0
1.25
8
1,314
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]
Mathlib/Algebra/Polynomial/Eval.lean
73
73
theorem eval₂_X : X.eval₂ f x = x := by
simp [eval₂_eq_sum]
1
2.718282
0
0.6
15
534
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.Fintype.Fin import Mathlib.GroupTheory.GroupAction.Pi import Mathlib.Logic.Equiv.Fin #align_import algebra.big_operators.fin from "leanprover-community/mathlib"@"cc5dd6244981976cc9da7afc4eee5682b037a013" open Finset variable {α : Type*} {β : Type*} namespace Fin @[to_additive] theorem prod_ofFn [CommMonoid β] {n : ℕ} (f : Fin n → β) : (List.ofFn f).prod = ∏ i, f i := by simp [prod_eq_multiset_prod] #align fin.prod_of_fn Fin.prod_ofFn #align fin.sum_of_fn Fin.sum_ofFn @[to_additive]
Mathlib/Algebra/BigOperators/Fin.lean
52
54
theorem prod_univ_def [CommMonoid β] {n : ℕ} (f : Fin n → β) : ∏ i, f i = ((List.finRange n).map f).prod := by
rw [← List.ofFn_eq_map, prod_ofFn]
1
2.718282
0
0.333333
12
353
import Mathlib.Analysis.Calculus.TangentCone import Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics #align_import analysis.calculus.fderiv.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] @[mk_iff hasFDerivAtFilter_iff_isLittleO] structure HasFDerivAtFilter (f : E → F) (f' : E →L[𝕜] F) (x : E) (L : Filter E) : Prop where of_isLittleO :: isLittleO : (fun x' => f x' - f x - f' (x' - x)) =o[L] fun x' => x' - x #align has_fderiv_at_filter HasFDerivAtFilter @[fun_prop] def HasFDerivWithinAt (f : E → F) (f' : E →L[𝕜] F) (s : Set E) (x : E) := HasFDerivAtFilter f f' x (𝓝[s] x) #align has_fderiv_within_at HasFDerivWithinAt @[fun_prop] def HasFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) := HasFDerivAtFilter f f' x (𝓝 x) #align has_fderiv_at HasFDerivAt @[fun_prop] def HasStrictFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) := (fun p : E × E => f p.1 - f p.2 - f' (p.1 - p.2)) =o[𝓝 (x, x)] fun p : E × E => p.1 - p.2 #align has_strict_fderiv_at HasStrictFDerivAt variable (𝕜) @[fun_prop] def DifferentiableWithinAt (f : E → F) (s : Set E) (x : E) := ∃ f' : E →L[𝕜] F, HasFDerivWithinAt f f' s x #align differentiable_within_at DifferentiableWithinAt @[fun_prop] def DifferentiableAt (f : E → F) (x : E) := ∃ f' : E →L[𝕜] F, HasFDerivAt f f' x #align differentiable_at DifferentiableAt irreducible_def fderivWithin (f : E → F) (s : Set E) (x : E) : E →L[𝕜] F := if 𝓝[s \ {x}] x = ⊥ then 0 else if h : ∃ f', HasFDerivWithinAt f f' s x then Classical.choose h else 0 #align fderiv_within fderivWithin irreducible_def fderiv (f : E → F) (x : E) : E →L[𝕜] F := if h : ∃ f', HasFDerivAt f f' x then Classical.choose h else 0 #align fderiv fderiv @[fun_prop] def DifferentiableOn (f : E → F) (s : Set E) := ∀ x ∈ s, DifferentiableWithinAt 𝕜 f s x #align differentiable_on DifferentiableOn @[fun_prop] def Differentiable (f : E → F) := ∀ x, DifferentiableAt 𝕜 f x #align differentiable Differentiable variable {𝕜} variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E}
Mathlib/Analysis/Calculus/FDeriv/Basic.lean
216
217
theorem fderivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : fderivWithin 𝕜 f s x = 0 := by
rw [fderivWithin, if_pos h]
1
2.718282
0
1.333333
6
1,387
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]
Mathlib/CategoryTheory/Idempotents/Karoubi.lean
94
94
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]
1
2.718282
0
0.625
8
543
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : ℕ) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : ℕ) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : ℕ) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : ℕ} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≤ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≤ n := tsub_eq_zero_iff_le.mp this le_antisymm ‹n ≤ m› ‹m ≤ n› #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : ℕ} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : ℕ} (h : n ≤ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le
Mathlib/Data/Nat/Dist.lean
49
50
theorem dist_eq_sub_of_le_right {n m : ℕ} (h : m ≤ n) : dist n m = n - m := by
rw [dist_comm]; apply dist_eq_sub_of_le h
1
2.718282
0
0.266667
15
309
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec" open Real noncomputable section namespace Real -- Porting note: can't derive `NormedAddCommGroup, Inhabited` def Angle : Type := AddCircle (2 * π) #align real.angle Real.Angle namespace Angle -- Porting note (#10754): added due to missing instances due to no deriving instance : NormedAddCommGroup Angle := inferInstanceAs (NormedAddCommGroup (AddCircle (2 * π))) -- Porting note (#10754): added due to missing instances due to no deriving instance : Inhabited Angle := inferInstanceAs (Inhabited (AddCircle (2 * π))) -- Porting note (#10754): added due to missing instances due to no deriving -- also, without this, a plain `QuotientAddGroup.mk` -- causes coerced terms to be of type `ℝ ⧸ AddSubgroup.zmultiples (2 * π)` @[coe] protected def coe (r : ℝ) : Angle := QuotientAddGroup.mk r instance : Coe ℝ Angle := ⟨Angle.coe⟩ instance : CircularOrder Real.Angle := QuotientAddGroup.circularOrder (hp' := ⟨by norm_num [pi_pos]⟩) @[continuity] theorem continuous_coe : Continuous ((↑) : ℝ → Angle) := continuous_quotient_mk' #align real.angle.continuous_coe Real.Angle.continuous_coe def coeHom : ℝ →+ Angle := QuotientAddGroup.mk' _ #align real.angle.coe_hom Real.Angle.coeHom @[simp] theorem coe_coeHom : (coeHom : ℝ → Angle) = ((↑) : ℝ → Angle) := rfl #align real.angle.coe_coe_hom Real.Angle.coe_coeHom @[elab_as_elim] protected theorem induction_on {p : Angle → Prop} (θ : Angle) (h : ∀ x : ℝ, p x) : p θ := Quotient.inductionOn' θ h #align real.angle.induction_on Real.Angle.induction_on @[simp] theorem coe_zero : ↑(0 : ℝ) = (0 : Angle) := rfl #align real.angle.coe_zero Real.Angle.coe_zero @[simp] theorem coe_add (x y : ℝ) : ↑(x + y : ℝ) = (↑x + ↑y : Angle) := rfl #align real.angle.coe_add Real.Angle.coe_add @[simp] theorem coe_neg (x : ℝ) : ↑(-x : ℝ) = -(↑x : Angle) := rfl #align real.angle.coe_neg Real.Angle.coe_neg @[simp] theorem coe_sub (x y : ℝ) : ↑(x - y : ℝ) = (↑x - ↑y : Angle) := rfl #align real.angle.coe_sub Real.Angle.coe_sub theorem coe_nsmul (n : ℕ) (x : ℝ) : ↑(n • x : ℝ) = n • (↑x : Angle) := rfl #align real.angle.coe_nsmul Real.Angle.coe_nsmul theorem coe_zsmul (z : ℤ) (x : ℝ) : ↑(z • x : ℝ) = z • (↑x : Angle) := rfl #align real.angle.coe_zsmul Real.Angle.coe_zsmul @[simp, norm_cast] theorem natCast_mul_eq_nsmul (x : ℝ) (n : ℕ) : ↑((n : ℝ) * x) = n • (↑x : Angle) := by simpa only [nsmul_eq_mul] using coeHom.map_nsmul x n #align real.angle.coe_nat_mul_eq_nsmul Real.Angle.natCast_mul_eq_nsmul @[simp, norm_cast] theorem intCast_mul_eq_zsmul (x : ℝ) (n : ℤ) : ↑((n : ℝ) * x : ℝ) = n • (↑x : Angle) := by simpa only [zsmul_eq_mul] using coeHom.map_zsmul x n #align real.angle.coe_int_mul_eq_zsmul Real.Angle.intCast_mul_eq_zsmul @[deprecated (since := "2024-05-25")] alias coe_nat_mul_eq_nsmul := natCast_mul_eq_nsmul @[deprecated (since := "2024-05-25")] alias coe_int_mul_eq_zsmul := intCast_mul_eq_zsmul theorem angle_eq_iff_two_pi_dvd_sub {ψ θ : ℝ} : (θ : Angle) = ψ ↔ ∃ k : ℤ, θ - ψ = 2 * π * k := by simp only [QuotientAddGroup.eq, AddSubgroup.zmultiples_eq_closure, AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm] -- Porting note: added `rw`, `simp [Angle.coe, QuotientAddGroup.eq]` doesn't fire otherwise rw [Angle.coe, Angle.coe, QuotientAddGroup.eq] simp only [AddSubgroup.zmultiples_eq_closure, AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm] #align real.angle.angle_eq_iff_two_pi_dvd_sub Real.Angle.angle_eq_iff_two_pi_dvd_sub @[simp] theorem coe_two_pi : ↑(2 * π : ℝ) = (0 : Angle) := angle_eq_iff_two_pi_dvd_sub.2 ⟨1, by rw [sub_zero, Int.cast_one, mul_one]⟩ #align real.angle.coe_two_pi Real.Angle.coe_two_pi @[simp] theorem neg_coe_pi : -(π : Angle) = π := by rw [← coe_neg, angle_eq_iff_two_pi_dvd_sub] use -1 simp [two_mul, sub_eq_add_neg] #align real.angle.neg_coe_pi Real.Angle.neg_coe_pi @[simp] theorem two_nsmul_coe_div_two (θ : ℝ) : (2 : ℕ) • (↑(θ / 2) : Angle) = θ := by rw [← coe_nsmul, two_nsmul, add_halves] #align real.angle.two_nsmul_coe_div_two Real.Angle.two_nsmul_coe_div_two @[simp]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
146
147
theorem two_zsmul_coe_div_two (θ : ℝ) : (2 : ℤ) • (↑(θ / 2) : Angle) = θ := by
rw [← coe_zsmul, two_zsmul, add_halves]
1
2.718282
0
0.5
6
425
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ι α β : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm α} {p : α → Prop} {x y z : α} def SameCycle (f : Perm α) (x y : α) : Prop := ∃ i : ℤ, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm α) (x : α) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm α) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y → SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y → SameCycle f y z → SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm α) : Setoid α where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y → SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y → (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
132
133
theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by
rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm]
1
2.718282
0
0
7
112
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import measure_theory.function.simple_func from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" noncomputable section open Set hiding restrict restrict_apply open Filter ENNReal open Function (support) open scoped Classical open Topology NNReal ENNReal MeasureTheory namespace MeasureTheory variable {α β γ δ : Type*} structure SimpleFunc.{u, v} (α : Type u) [MeasurableSpace α] (β : Type v) where toFun : α → β measurableSet_fiber' : ∀ x, MeasurableSet (toFun ⁻¹' {x}) finite_range' : (Set.range toFun).Finite #align measure_theory.simple_func MeasureTheory.SimpleFunc #align measure_theory.simple_func.to_fun MeasureTheory.SimpleFunc.toFun #align measure_theory.simple_func.measurable_set_fiber' MeasureTheory.SimpleFunc.measurableSet_fiber' #align measure_theory.simple_func.finite_range' MeasureTheory.SimpleFunc.finite_range' local infixr:25 " →ₛ " => SimpleFunc namespace SimpleFunc section Measurable variable [MeasurableSpace α] attribute [coe] toFun instance instCoeFun : CoeFun (α →ₛ β) fun _ => α → β := ⟨toFun⟩ #align measure_theory.simple_func.has_coe_to_fun MeasureTheory.SimpleFunc.instCoeFun theorem coe_injective ⦃f g : α →ₛ β⦄ (H : (f : α → β) = g) : f = g := by cases f; cases g; congr #align measure_theory.simple_func.coe_injective MeasureTheory.SimpleFunc.coe_injective @[ext] theorem ext {f g : α →ₛ β} (H : ∀ a, f a = g a) : f = g := coe_injective <| funext H #align measure_theory.simple_func.ext MeasureTheory.SimpleFunc.ext theorem finite_range (f : α →ₛ β) : (Set.range f).Finite := f.finite_range' #align measure_theory.simple_func.finite_range MeasureTheory.SimpleFunc.finite_range theorem measurableSet_fiber (f : α →ₛ β) (x : β) : MeasurableSet (f ⁻¹' {x}) := f.measurableSet_fiber' x #align measure_theory.simple_func.measurable_set_fiber MeasureTheory.SimpleFunc.measurableSet_fiber -- @[simp] -- Porting note (#10618): simp can prove this theorem apply_mk (f : α → β) (h h') (x : α) : SimpleFunc.mk f h h' x = f x := rfl #align measure_theory.simple_func.apply_mk MeasureTheory.SimpleFunc.apply_mk def ofFinite [Finite α] [MeasurableSingletonClass α] (f : α → β) : α →ₛ β where toFun := f measurableSet_fiber' x := (toFinite (f ⁻¹' {x})).measurableSet finite_range' := Set.finite_range f @[deprecated (since := "2024-02-05")] alias ofFintype := ofFinite def ofIsEmpty [IsEmpty α] : α →ₛ β := ofFinite isEmptyElim #align measure_theory.simple_func.of_is_empty MeasureTheory.SimpleFunc.ofIsEmpty protected def range (f : α →ₛ β) : Finset β := f.finite_range.toFinset #align measure_theory.simple_func.range MeasureTheory.SimpleFunc.range @[simp] theorem mem_range {f : α →ₛ β} {b} : b ∈ f.range ↔ b ∈ range f := Finite.mem_toFinset _ #align measure_theory.simple_func.mem_range MeasureTheory.SimpleFunc.mem_range theorem mem_range_self (f : α →ₛ β) (x : α) : f x ∈ f.range := mem_range.2 ⟨x, rfl⟩ #align measure_theory.simple_func.mem_range_self MeasureTheory.SimpleFunc.mem_range_self @[simp] theorem coe_range (f : α →ₛ β) : (↑f.range : Set β) = Set.range f := f.finite_range.coe_toFinset #align measure_theory.simple_func.coe_range MeasureTheory.SimpleFunc.coe_range theorem mem_range_of_measure_ne_zero {f : α →ₛ β} {x : β} {μ : Measure α} (H : μ (f ⁻¹' {x}) ≠ 0) : x ∈ f.range := let ⟨a, ha⟩ := nonempty_of_measure_ne_zero H mem_range.2 ⟨a, ha⟩ #align measure_theory.simple_func.mem_range_of_measure_ne_zero MeasureTheory.SimpleFunc.mem_range_of_measure_ne_zero theorem forall_mem_range {f : α →ₛ β} {p : β → Prop} : (∀ y ∈ f.range, p y) ↔ ∀ x, p (f x) := by simp only [mem_range, Set.forall_mem_range] #align measure_theory.simple_func.forall_mem_range MeasureTheory.SimpleFunc.forall_mem_range
Mathlib/MeasureTheory/Function/SimpleFunc.lean
129
130
theorem exists_range_iff {f : α →ₛ β} {p : β → Prop} : (∃ y ∈ f.range, p y) ↔ ∃ x, p (f x) := by
simpa only [mem_range, exists_prop] using Set.exists_range_iff
1
2.718282
0
0
3
48
import Mathlib.Tactic.NormNum import Mathlib.Tactic.TryThis import Mathlib.Util.AtomM set_option autoImplicit true namespace Mathlib.Tactic.Abel open Lean Elab Meta Tactic Qq initialize registerTraceClass `abel initialize registerTraceClass `abel.detail structure Context where α : Expr univ : Level α0 : Expr isGroup : Bool inst : Expr def mkContext (e : Expr) : MetaM Context := do let α ← inferType e let c ← synthInstance (← mkAppM ``AddCommMonoid #[α]) let cg ← synthInstance? (← mkAppM ``AddCommGroup #[α]) let u ← mkFreshLevelMVar _ ← isDefEq (.sort (.succ u)) (← inferType α) let α0 ← Expr.ofNat α 0 match cg with | some cg => return ⟨α, u, α0, true, cg⟩ | _ => return ⟨α, u, α0, false, c⟩ abbrev M := ReaderT Context AtomM def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr → Expr := mkAppN (((@Expr.const n [c.univ]).app c.α).app inst) def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do return c.app n (← synthInstance ((Expr.const inst [c.univ]).app c.α)) l def addG : Name → Name | .str p s => .str p (s ++ "g") | n => n def iapp (n : Name) (xs : Array Expr) : M Expr := do let c ← read return c.app (if c.isGroup then addG n else n) c.inst xs def term {α} [AddCommMonoid α] (n : ℕ) (x a : α) : α := n • x + a def termg {α} [AddCommGroup α] (n : ℤ) (x a : α) : α := n • x + a def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a] def intToExpr (n : ℤ) : M Expr := do Expr.ofInt (mkConst (if (← read).isGroup then ``Int else ``Nat) []) n inductive NormalExpr : Type | zero (e : Expr) : NormalExpr | nterm (e : Expr) (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : NormalExpr deriving Inhabited def NormalExpr.e : NormalExpr → Expr | .zero e => e | .nterm e .. => e instance : Coe NormalExpr Expr where coe := NormalExpr.e def NormalExpr.term' (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : M NormalExpr := return .nterm (← mkTerm n.1 x.2 a) n x a def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (← read).α0 open NormalExpr theorem const_add_term {α} [AddCommMonoid α] (k n x a a') (h : k + a = a') : k + @term α _ n x a = term n x a' := by simp [h.symm, term, add_comm, add_assoc] theorem const_add_termg {α} [AddCommGroup α] (k n x a a') (h : k + a = a') : k + @termg α _ n x a = termg n x a' := by simp [h.symm, termg, add_comm, add_assoc] theorem term_add_const {α} [AddCommMonoid α] (n x a k a') (h : a + k = a') : @term α _ n x a + k = term n x a' := by simp [h.symm, term, add_assoc] theorem term_add_constg {α} [AddCommGroup α] (n x a k a') (h : a + k = a') : @termg α _ n x a + k = termg n x a' := by simp [h.symm, termg, add_assoc] theorem term_add_term {α} [AddCommMonoid α] (n₁ x a₁ n₂ a₂ n' a') (h₁ : n₁ + n₂ = n') (h₂ : a₁ + a₂ = a') : @term α _ n₁ x a₁ + @term α _ n₂ x a₂ = term n' x a' := by simp [h₁.symm, h₂.symm, term, add_nsmul, add_assoc, add_left_comm] theorem term_add_termg {α} [AddCommGroup α] (n₁ x a₁ n₂ a₂ n' a') (h₁ : n₁ + n₂ = n') (h₂ : a₁ + a₂ = a') : @termg α _ n₁ x a₁ + @termg α _ n₂ x a₂ = termg n' x a' := by simp only [termg, h₁.symm, add_zsmul, h₂.symm] exact add_add_add_comm (n₁ • x) a₁ (n₂ • x) a₂ theorem zero_term {α} [AddCommMonoid α] (x a) : @term α _ 0 x a = a := by simp [term, zero_nsmul, one_nsmul]
Mathlib/Tactic/Abel.lean
157
158
theorem zero_termg {α} [AddCommGroup α] (x a) : @termg α _ 0 x a = a := by
simp [termg, zero_zsmul]
1
2.718282
0
0.125
8
249
import Mathlib.Topology.PartialHomeomorph import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Data.Real.Sqrt #align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Set Metric Pointwise variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] noncomputable section @[simps (config := .lemmasOnly)] def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where toFun x := (√(1 + ‖x‖ ^ 2))⁻¹ • x invFun y := (√(1 - ‖(y : E)‖ ^ 2))⁻¹ • (y : E) source := univ target := ball 0 1 map_source' x _ := by have : 0 < 1 + ‖x‖ ^ 2 := by positivity rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ← _root_.div_eq_inv_mul, div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ← abs_norm x, ← sq_lt_sq, abs_norm, Real.sq_sqrt this.le] exact lt_one_add _ map_target' _ _ := trivial left_inv' x _ := by field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs, Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, ← Real.sqrt_div (zero_lt_one_add_norm_sq x).le] right_inv' y hy := by have : 0 < 1 - ‖y‖ ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le, ← Real.sqrt_div this.le] open_source := isOpen_univ open_target := isOpen_ball continuousOn_toFun := by suffices Continuous fun (x:E) => (√(1 + ‖x‖ ^ 2))⁻¹ from (this.smul continuous_id).continuousOn refine Continuous.inv₀ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity) continuity continuousOn_invFun := by have : ∀ y ∈ ball (0 : E) 1, √(1 - ‖(y : E)‖ ^ 2) ≠ 0 := fun y hy ↦ by rw [Real.sqrt_ne_zero'] nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] exact ContinuousOn.smul (ContinuousOn.inv₀ (continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id @[simp] theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_apply] @[simp] theorem PartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_symm_apply] @[simps! (config := .lemmasOnly)] def Homeomorph.unitBall : E ≃ₜ ball (0 : E) 1 := (Homeomorph.Set.univ _).symm.trans PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget #align homeomorph_unit_ball Homeomorph.unitBall @[simp] theorem Homeomorph.coe_unitBall_apply_zero : (Homeomorph.unitBall (0 : E) : E) = 0 := PartialHomeomorph.univUnitBall_apply_zero #align coe_homeomorph_unit_ball_apply_zero Homeomorph.coe_unitBall_apply_zero variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P] namespace PartialHomeomorph @[simps!] def unitBallBall (c : P) (r : ℝ) (hr : 0 < r) : PartialHomeomorph E P := ((Homeomorph.smulOfNeZero r hr.ne').trans (IsometryEquiv.vaddConst c).toHomeomorph).toPartialHomeomorphOfImageEq (ball 0 1) isOpen_ball (ball c r) <| by change (IsometryEquiv.vaddConst c) ∘ (r • ·) '' ball (0 : E) 1 = ball c r rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball] simp [abs_of_pos hr] def univBall (c : P) (r : ℝ) : PartialHomeomorph E P := if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl else (IsometryEquiv.vaddConst c).toHomeomorph.toPartialHomeomorph @[simp]
Mathlib/Analysis/NormedSpace/HomeomorphBall.lean
127
128
theorem univBall_source (c : P) (r : ℝ) : (univBall c r).source = univ := by
unfold univBall; split_ifs <;> rfl
1
2.718282
0
0.375
8
380
import Mathlib.MeasureTheory.OuterMeasure.Basic open Filter Set open scoped ENNReal namespace MeasureTheory variable {α β F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α] {μ : F} {s t : Set α} def ae (μ : F) : Filter α := .ofCountableUnion (μ · = 0) (fun _S hSc ↦ (measure_sUnion_null_iff hSc).2) fun _t ht _s hs ↦ measure_mono_null hs ht #align measure_theory.measure.ae MeasureTheory.ae notation3 "∀ᵐ "(...)" ∂"μ", "r:(scoped p => Filter.Eventually p <| MeasureTheory.ae μ) => r notation3 "∃ᵐ "(...)" ∂"μ", "r:(scoped P => Filter.Frequently P <| MeasureTheory.ae μ) => r notation:50 f " =ᵐ[" μ:50 "] " g:50 => Filter.EventuallyEq (MeasureTheory.ae μ) f g notation:50 f " ≤ᵐ[" μ:50 "] " g:50 => Filter.EventuallyLE (MeasureTheory.ae μ) f g theorem mem_ae_iff {s : Set α} : s ∈ ae μ ↔ μ sᶜ = 0 := Iff.rfl #align measure_theory.mem_ae_iff MeasureTheory.mem_ae_iff theorem ae_iff {p : α → Prop} : (∀ᵐ a ∂μ, p a) ↔ μ { a | ¬p a } = 0 := Iff.rfl #align measure_theory.ae_iff MeasureTheory.ae_iff
Mathlib/MeasureTheory/OuterMeasure/AE.lean
79
79
theorem compl_mem_ae_iff {s : Set α} : sᶜ ∈ ae μ ↔ μ s = 0 := by
simp only [mem_ae_iff, compl_compl]
1
2.718282
0
0
3
73
import Mathlib.Data.Finsupp.Basic import Mathlib.Data.List.AList #align_import data.finsupp.alist from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" namespace AList variable {α M : Type*} [Zero M] open List noncomputable def lookupFinsupp (l : AList fun _x : α => M) : α →₀ M where support := by haveI := Classical.decEq α; haveI := Classical.decEq M exact (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset toFun a := haveI := Classical.decEq α (l.lookup a).getD 0 mem_support_toFun a := by classical simp_rw [@mem_toFinset _ _, List.mem_keys, List.mem_filter, ← mem_lookup_iff] cases lookup a l <;> simp #align alist.lookup_finsupp AList.lookupFinsupp @[simp]
Mathlib/Data/Finsupp/AList.lean
76
78
theorem lookupFinsupp_apply [DecidableEq α] (l : AList fun _x : α => M) (a : α) : l.lookupFinsupp a = (l.lookup a).getD 0 := by
convert rfl; congr
1
2.718282
0
0.777778
9
691
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs #align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F := (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv iteratedDeriv def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F := (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv_within iteratedDerivWithin variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜} theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by ext x rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ] #align iterated_deriv_within_univ iteratedDerivWithin_univ theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x = (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 := rfl #align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s = (ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by ext x; rfl #align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_eq_equiv_comp : iteratedFDerivWithin 𝕜 n f s = ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm, Function.id_comp] #align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} : (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m = (∏ i, m i) • iteratedDerivWithin n f s x := by rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ] simp #align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod
Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean
107
109
theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin : ‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by
rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map]
1
2.718282
0
0.727273
11
649
import Mathlib.Order.Cover import Mathlib.Order.Interval.Finset.Defs #align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d" assert_not_exists MonoidWithZero assert_not_exists Finset.sum open Function OrderDual open FinsetInterval variable {ι α : Type*} namespace Finset section Preorder variable [Preorder α] section LocallyFiniteOrder variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α} @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc] #align finset.nonempty_Icc Finset.nonempty_Icc @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico] #align finset.nonempty_Ico Finset.nonempty_Ico @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc] #align finset.nonempty_Ioc Finset.nonempty_Ioc -- TODO: This is nonsense. A locally finite order is never densely ordered @[simp] theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo] #align finset.nonempty_Ioo Finset.nonempty_Ioo @[simp] theorem Icc_eq_empty_iff : Icc a b = ∅ ↔ ¬a ≤ b := by rw [← coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff] #align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff @[simp] theorem Ico_eq_empty_iff : Ico a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff] #align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff @[simp] theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff] #align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff -- TODO: This is nonsense. A locally finite order is never densely ordered @[simp] theorem Ioo_eq_empty_iff [DenselyOrdered α] : Ioo a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff] #align finset.Ioo_eq_empty_iff Finset.Ioo_eq_empty_iff alias ⟨_, Icc_eq_empty⟩ := Icc_eq_empty_iff #align finset.Icc_eq_empty Finset.Icc_eq_empty alias ⟨_, Ico_eq_empty⟩ := Ico_eq_empty_iff #align finset.Ico_eq_empty Finset.Ico_eq_empty alias ⟨_, Ioc_eq_empty⟩ := Ioc_eq_empty_iff #align finset.Ioc_eq_empty Finset.Ioc_eq_empty @[simp] theorem Ioo_eq_empty (h : ¬a < b) : Ioo a b = ∅ := eq_empty_iff_forall_not_mem.2 fun _ hx => h ((mem_Ioo.1 hx).1.trans (mem_Ioo.1 hx).2) #align finset.Ioo_eq_empty Finset.Ioo_eq_empty @[simp] theorem Icc_eq_empty_of_lt (h : b < a) : Icc a b = ∅ := Icc_eq_empty h.not_le #align finset.Icc_eq_empty_of_lt Finset.Icc_eq_empty_of_lt @[simp] theorem Ico_eq_empty_of_le (h : b ≤ a) : Ico a b = ∅ := Ico_eq_empty h.not_lt #align finset.Ico_eq_empty_of_le Finset.Ico_eq_empty_of_le @[simp] theorem Ioc_eq_empty_of_le (h : b ≤ a) : Ioc a b = ∅ := Ioc_eq_empty h.not_lt #align finset.Ioc_eq_empty_of_le Finset.Ioc_eq_empty_of_le @[simp] theorem Ioo_eq_empty_of_le (h : b ≤ a) : Ioo a b = ∅ := Ioo_eq_empty h.not_lt #align finset.Ioo_eq_empty_of_le Finset.Ioo_eq_empty_of_le -- porting note (#10618): simp can prove this -- @[simp]
Mathlib/Order/Interval/Finset/Basic.lean
134
134
theorem left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := by
simp only [mem_Icc, true_and_iff, le_rfl]
1
2.718282
0
0
12
11
import Mathlib.Init.Function import Mathlib.Init.Order.Defs #align_import data.bool.basic from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" namespace Bool @[deprecated (since := "2024-06-07")] alias decide_True := decide_true_eq_true #align bool.to_bool_true decide_true_eq_true @[deprecated (since := "2024-06-07")] alias decide_False := decide_false_eq_false #align bool.to_bool_false decide_false_eq_false #align bool.to_bool_coe Bool.decide_coe @[deprecated (since := "2024-06-07")] alias coe_decide := decide_eq_true_iff #align bool.coe_to_bool decide_eq_true_iff @[deprecated decide_eq_true_iff (since := "2024-06-07")] alias of_decide_iff := decide_eq_true_iff #align bool.of_to_bool_iff decide_eq_true_iff #align bool.tt_eq_to_bool_iff true_eq_decide_iff #align bool.ff_eq_to_bool_iff false_eq_decide_iff @[deprecated (since := "2024-06-07")] alias decide_not := decide_not #align bool.to_bool_not decide_not #align bool.to_bool_and Bool.decide_and #align bool.to_bool_or Bool.decide_or #align bool.to_bool_eq decide_eq_decide @[deprecated (since := "2024-06-07")] alias not_false' := false_ne_true #align bool.not_ff Bool.false_ne_true @[deprecated (since := "2024-06-07")] alias eq_iff_eq_true_iff := eq_iff_iff #align bool.default_bool Bool.default_bool theorem dichotomy (b : Bool) : b = false ∨ b = true := by cases b <;> simp #align bool.dichotomy Bool.dichotomy theorem forall_bool' {p : Bool → Prop} (b : Bool) : (∀ x, p x) ↔ p b ∧ p !b := ⟨fun h ↦ ⟨h _, h _⟩, fun ⟨h₁, h₂⟩ x ↦ by cases b <;> cases x <;> assumption⟩ @[simp] theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true := forall_bool' false #align bool.forall_bool Bool.forall_bool theorem exists_bool' {p : Bool → Prop} (b : Bool) : (∃ x, p x) ↔ p b ∨ p !b := ⟨fun ⟨x, hx⟩ ↦ by cases x <;> cases b <;> first | exact .inl ‹_› | exact .inr ‹_›, fun h ↦ by cases h <;> exact ⟨_, ‹_›⟩⟩ @[simp] theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true := exists_bool' false #align bool.exists_bool Bool.exists_bool #align bool.decidable_forall_bool Bool.instDecidableForallOfDecidablePred #align bool.decidable_exists_bool Bool.instDecidableExistsOfDecidablePred #align bool.cond_eq_ite Bool.cond_eq_ite #align bool.cond_to_bool Bool.cond_decide #align bool.cond_bnot Bool.cond_not theorem not_ne_id : not ≠ id := fun h ↦ false_ne_true <| congrFun h true #align bool.bnot_ne_id Bool.not_ne_id #align bool.coe_bool_iff Bool.coe_iff_coe @[deprecated (since := "2024-06-07")] alias eq_true_of_ne_false := eq_true_of_ne_false #align bool.eq_tt_of_ne_ff eq_true_of_ne_false @[deprecated (since := "2024-06-07")] alias eq_false_of_ne_true := eq_false_of_ne_true #align bool.eq_ff_of_ne_tt eq_true_of_ne_false #align bool.bor_comm Bool.or_comm #align bool.bor_assoc Bool.or_assoc #align bool.bor_left_comm Bool.or_left_comm
Mathlib/Data/Bool/Basic.lean
99
99
theorem or_inl {a b : Bool} (H : a) : a || b := by
simp [H]
1
2.718282
0
0
6
186
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} @[simp] theorem reduceOption_cons_of_some (x : α) (l : List (Option α)) : reduceOption (some x :: l) = x :: l.reduceOption := by simp only [reduceOption, filterMap, id, eq_self_iff_true, and_self_iff] #align list.reduce_option_cons_of_some List.reduceOption_cons_of_some @[simp]
Mathlib/Data/List/ReduceOption.lean
25
26
theorem reduceOption_cons_of_none (l : List (Option α)) : reduceOption (none :: l) = l.reduceOption := by
simp only [reduceOption, filterMap, id]
1
2.718282
0
0.615385
13
540
import Mathlib.Analysis.Convex.StrictConvexBetween import Mathlib.Geometry.Euclidean.Basic #align_import geometry.euclidean.sphere.basic from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open RealInnerProductSpace namespace EuclideanGeometry variable {V : Type*} (P : Type*) open FiniteDimensional @[ext] structure Sphere [MetricSpace P] where center : P radius : ℝ #align euclidean_geometry.sphere EuclideanGeometry.Sphere variable {P} section MetricSpace variable [MetricSpace P] instance [Nonempty P] : Nonempty (Sphere P) := ⟨⟨Classical.arbitrary P, 0⟩⟩ instance : Coe (Sphere P) (Set P) := ⟨fun s => Metric.sphere s.center s.radius⟩ instance : Membership P (Sphere P) := ⟨fun p s => p ∈ (s : Set P)⟩ theorem Sphere.mk_center (c : P) (r : ℝ) : (⟨c, r⟩ : Sphere P).center = c := rfl #align euclidean_geometry.sphere.mk_center EuclideanGeometry.Sphere.mk_center theorem Sphere.mk_radius (c : P) (r : ℝ) : (⟨c, r⟩ : Sphere P).radius = r := rfl #align euclidean_geometry.sphere.mk_radius EuclideanGeometry.Sphere.mk_radius @[simp] theorem Sphere.mk_center_radius (s : Sphere P) : (⟨s.center, s.radius⟩ : Sphere P) = s := by ext <;> rfl #align euclidean_geometry.sphere.mk_center_radius EuclideanGeometry.Sphere.mk_center_radius #noalign euclidean_geometry.sphere.coe_def @[simp] theorem Sphere.coe_mk (c : P) (r : ℝ) : ↑(⟨c, r⟩ : Sphere P) = Metric.sphere c r := rfl #align euclidean_geometry.sphere.coe_mk EuclideanGeometry.Sphere.coe_mk -- @[simp] -- Porting note: simp-normal form is `Sphere.mem_coe'` theorem Sphere.mem_coe {p : P} {s : Sphere P} : p ∈ (s : Set P) ↔ p ∈ s := Iff.rfl #align euclidean_geometry.sphere.mem_coe EuclideanGeometry.Sphere.mem_coe @[simp] theorem Sphere.mem_coe' {p : P} {s : Sphere P} : dist p s.center = s.radius ↔ p ∈ s := Iff.rfl theorem mem_sphere {p : P} {s : Sphere P} : p ∈ s ↔ dist p s.center = s.radius := Iff.rfl #align euclidean_geometry.mem_sphere EuclideanGeometry.mem_sphere theorem mem_sphere' {p : P} {s : Sphere P} : p ∈ s ↔ dist s.center p = s.radius := Metric.mem_sphere' #align euclidean_geometry.mem_sphere' EuclideanGeometry.mem_sphere' theorem subset_sphere {ps : Set P} {s : Sphere P} : ps ⊆ s ↔ ∀ p ∈ ps, p ∈ s := Iff.rfl #align euclidean_geometry.subset_sphere EuclideanGeometry.subset_sphere theorem dist_of_mem_subset_sphere {p : P} {ps : Set P} {s : Sphere P} (hp : p ∈ ps) (hps : ps ⊆ (s : Set P)) : dist p s.center = s.radius := mem_sphere.1 (Sphere.mem_coe.1 (Set.mem_of_mem_of_subset hp hps)) #align euclidean_geometry.dist_of_mem_subset_sphere EuclideanGeometry.dist_of_mem_subset_sphere theorem dist_of_mem_subset_mk_sphere {p c : P} {ps : Set P} {r : ℝ} (hp : p ∈ ps) (hps : ps ⊆ ↑(⟨c, r⟩ : Sphere P)) : dist p c = r := dist_of_mem_subset_sphere hp hps #align euclidean_geometry.dist_of_mem_subset_mk_sphere EuclideanGeometry.dist_of_mem_subset_mk_sphere theorem Sphere.ne_iff {s₁ s₂ : Sphere P} : s₁ ≠ s₂ ↔ s₁.center ≠ s₂.center ∨ s₁.radius ≠ s₂.radius := by rw [← not_and_or, ← Sphere.ext_iff] #align euclidean_geometry.sphere.ne_iff EuclideanGeometry.Sphere.ne_iff theorem Sphere.center_eq_iff_eq_of_mem {s₁ s₂ : Sphere P} {p : P} (hs₁ : p ∈ s₁) (hs₂ : p ∈ s₂) : s₁.center = s₂.center ↔ s₁ = s₂ := by refine ⟨fun h => Sphere.ext _ _ h ?_, fun h => h ▸ rfl⟩ rw [mem_sphere] at hs₁ hs₂ rw [← hs₁, ← hs₂, h] #align euclidean_geometry.sphere.center_eq_iff_eq_of_mem EuclideanGeometry.Sphere.center_eq_iff_eq_of_mem theorem Sphere.center_ne_iff_ne_of_mem {s₁ s₂ : Sphere P} {p : P} (hs₁ : p ∈ s₁) (hs₂ : p ∈ s₂) : s₁.center ≠ s₂.center ↔ s₁ ≠ s₂ := (Sphere.center_eq_iff_eq_of_mem hs₁ hs₂).not #align euclidean_geometry.sphere.center_ne_iff_ne_of_mem EuclideanGeometry.Sphere.center_ne_iff_ne_of_mem
Mathlib/Geometry/Euclidean/Sphere/Basic.lean
136
138
theorem dist_center_eq_dist_center_of_mem_sphere {p₁ p₂ : P} {s : Sphere P} (hp₁ : p₁ ∈ s) (hp₂ : p₂ ∈ s) : dist p₁ s.center = dist p₂ s.center := by
rw [mem_sphere.1 hp₁, mem_sphere.1 hp₂]
1
2.718282
0
0.2
5
280
import Mathlib.Analysis.SpecialFunctions.Pow.Complex import Qq #align_import analysis.special_functions.pow.real from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" noncomputable section open scoped Classical open Real ComplexConjugate open Finset Set namespace Real variable {x y z : ℝ} noncomputable def rpow (x y : ℝ) := ((x : ℂ) ^ (y : ℂ)).re #align real.rpow Real.rpow noncomputable instance : Pow ℝ ℝ := ⟨rpow⟩ @[simp] theorem rpow_eq_pow (x y : ℝ) : rpow x y = x ^ y := rfl #align real.rpow_eq_pow Real.rpow_eq_pow theorem rpow_def (x y : ℝ) : x ^ y = ((x : ℂ) ^ (y : ℂ)).re := rfl #align real.rpow_def Real.rpow_def theorem rpow_def_of_nonneg {x : ℝ} (hx : 0 ≤ x) (y : ℝ) : x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) := by simp only [rpow_def, Complex.cpow_def]; split_ifs <;> simp_all [(Complex.ofReal_log hx).symm, -Complex.ofReal_mul, -RCLike.ofReal_mul, (Complex.ofReal_mul _ _).symm, Complex.exp_ofReal_re, Complex.ofReal_eq_zero] #align real.rpow_def_of_nonneg Real.rpow_def_of_nonneg theorem rpow_def_of_pos {x : ℝ} (hx : 0 < x) (y : ℝ) : x ^ y = exp (log x * y) := by rw [rpow_def_of_nonneg (le_of_lt hx), if_neg (ne_of_gt hx)] #align real.rpow_def_of_pos Real.rpow_def_of_pos theorem exp_mul (x y : ℝ) : exp (x * y) = exp x ^ y := by rw [rpow_def_of_pos (exp_pos _), log_exp] #align real.exp_mul Real.exp_mul @[simp, norm_cast] theorem rpow_intCast (x : ℝ) (n : ℤ) : x ^ (n : ℝ) = x ^ n := by simp only [rpow_def, ← Complex.ofReal_zpow, Complex.cpow_intCast, Complex.ofReal_intCast, Complex.ofReal_re] #align real.rpow_int_cast Real.rpow_intCast @[deprecated (since := "2024-04-17")] alias rpow_int_cast := rpow_intCast @[simp, norm_cast] theorem rpow_natCast (x : ℝ) (n : ℕ) : x ^ (n : ℝ) = x ^ n := by simpa using rpow_intCast x n #align real.rpow_nat_cast Real.rpow_natCast @[deprecated (since := "2024-04-17")] alias rpow_nat_cast := rpow_natCast @[simp]
Mathlib/Analysis/SpecialFunctions/Pow/Real.lean
80
80
theorem exp_one_rpow (x : ℝ) : exp 1 ^ x = exp x := by
rw [← exp_mul, one_mul]
1
2.718282
0
0.384615
13
383
import Mathlib.Data.Finset.Prod import Mathlib.Data.Sym.Basic import Mathlib.Data.Sym.Sym2.Init import Mathlib.Data.SetLike.Basic #align_import data.sym.sym2 from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" assert_not_exists MonoidWithZero open Finset Function Sym universe u variable {α β γ : Type*} namespace Sym2 @[aesop (rule_sets := [Sym2]) [safe [constructors, cases], norm]] inductive Rel (α : Type u) : α × α → α × α → Prop | refl (x y : α) : Rel _ (x, y) (x, y) | swap (x y : α) : Rel _ (x, y) (y, x) #align sym2.rel Sym2.Rel #align sym2.rel.refl Sym2.Rel.refl #align sym2.rel.swap Sym2.Rel.swap attribute [refl] Rel.refl @[symm] theorem Rel.symm {x y : α × α} : Rel α x y → Rel α y x := by aesop (rule_sets := [Sym2]) #align sym2.rel.symm Sym2.Rel.symm @[trans] theorem Rel.trans {x y z : α × α} (a : Rel α x y) (b : Rel α y z) : Rel α x z := by aesop (rule_sets := [Sym2]) #align sym2.rel.trans Sym2.Rel.trans theorem Rel.is_equivalence : Equivalence (Rel α) := { refl := fun (x, y) ↦ Rel.refl x y, symm := Rel.symm, trans := Rel.trans } #align sym2.rel.is_equivalence Sym2.Rel.is_equivalence def Rel.setoid (α : Type u) : Setoid (α × α) := ⟨Rel α, Rel.is_equivalence⟩ #align sym2.rel.setoid Sym2.Rel.setoid @[simp]
Mathlib/Data/Sym/Sym2.lean
88
89
theorem rel_iff' {p q : α × α} : Rel α p q ↔ p = q ∨ p = q.swap := by
aesop (rule_sets := [Sym2])
1
2.718282
0
0
4
173
import Mathlib.CategoryTheory.Limits.Types import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.CategoryTheory.ConcreteCategory.Basic import Mathlib.Tactic.CategoryTheory.Elementwise import Mathlib.Data.Set.Subsingleton #align_import category_theory.limits.shapes.types from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" universe v u open CategoryTheory Limits namespace CategoryTheory.Limits.Types example : HasProducts.{v} (Type v) := inferInstance example [UnivLE.{v, u}] : HasProducts.{v} (Type u) := inferInstance -- This shortcut instance is required in `Mathlib.CategoryTheory.Closed.Types`, -- although I don't understand why, and wish it wasn't. instance : HasProducts.{v} (Type v) := inferInstance @[simp 1001] theorem pi_lift_π_apply {β : Type v} [Small.{u} β] (f : β → Type u) {P : Type u} (s : ∀ b, P ⟶ f b) (b : β) (x : P) : (Pi.π f b : (piObj f) → f b) (@Pi.lift β _ _ f _ P s x) = s b x := congr_fun (limit.lift_π (Fan.mk P s) ⟨b⟩) x #align category_theory.limits.types.pi_lift_π_apply CategoryTheory.Limits.Types.pi_lift_π_apply theorem pi_lift_π_apply' {β : Type v} (f : β → Type v) {P : Type v} (s : ∀ b, P ⟶ f b) (b : β) (x : P) : (Pi.π f b : (piObj f) → f b) (@Pi.lift β _ _ f _ P s x) = s b x := by simp #align category_theory.limits.types.pi_lift_π_apply' CategoryTheory.Limits.Types.pi_lift_π_apply' @[simp 1001] theorem pi_map_π_apply {β : Type v} [Small.{u} β] {f g : β → Type u} (α : ∀ j, f j ⟶ g j) (b : β) (x) : (Pi.π g b : ∏ᶜ g → g b) (Pi.map α x) = α b ((Pi.π f b : ∏ᶜ f → f b) x) := Limit.map_π_apply.{v, u} _ _ _ #align category_theory.limits.types.pi_map_π_apply CategoryTheory.Limits.Types.pi_map_π_apply
Mathlib/CategoryTheory/Limits/Shapes/Types.lean
82
84
theorem pi_map_π_apply' {β : Type v} {f g : β → Type v} (α : ∀ j, f j ⟶ g j) (b : β) (x) : (Pi.π g b : ∏ᶜ g → g b) (Pi.map α x) = α b ((Pi.π f b : ∏ᶜ f → f b) x) := by
simp
1
2.718282
0
0
2
63
import Mathlib.CategoryTheory.Limits.HasLimits import Mathlib.CategoryTheory.Limits.Shapes.Equalizers #align_import category_theory.limits.shapes.wide_equalizers from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section namespace CategoryTheory.Limits open CategoryTheory universe w v u u₂ variable {J : Type w} inductive WalkingParallelFamily (J : Type w) : Type w | zero : WalkingParallelFamily J | one : WalkingParallelFamily J #align category_theory.limits.walking_parallel_family CategoryTheory.Limits.WalkingParallelFamily open WalkingParallelFamily instance : DecidableEq (WalkingParallelFamily J) | zero, zero => isTrue rfl | zero, one => isFalse fun t => WalkingParallelFamily.noConfusion t | one, zero => isFalse fun t => WalkingParallelFamily.noConfusion t | one, one => isTrue rfl instance : Inhabited (WalkingParallelFamily J) := ⟨zero⟩ inductive WalkingParallelFamily.Hom (J : Type w) : WalkingParallelFamily J → WalkingParallelFamily J → Type w | id : ∀ X : WalkingParallelFamily.{w} J, WalkingParallelFamily.Hom J X X | line : J → WalkingParallelFamily.Hom J zero one deriving DecidableEq #align category_theory.limits.walking_parallel_family.hom CategoryTheory.Limits.WalkingParallelFamily.Hom instance (J : Type v) : Inhabited (WalkingParallelFamily.Hom J zero zero) where default := Hom.id _ open WalkingParallelFamily.Hom def WalkingParallelFamily.Hom.comp : ∀ {X Y Z : WalkingParallelFamily J} (_ : WalkingParallelFamily.Hom J X Y) (_ : WalkingParallelFamily.Hom J Y Z), WalkingParallelFamily.Hom J X Z | _, _, _, id _, h => h | _, _, _, line j, id one => line j #align category_theory.limits.walking_parallel_family.hom.comp CategoryTheory.Limits.WalkingParallelFamily.Hom.comp -- attribute [local tidy] tactic.case_bash Porting note: no tidy, no local instance WalkingParallelFamily.category : SmallCategory (WalkingParallelFamily J) where Hom := WalkingParallelFamily.Hom J id := WalkingParallelFamily.Hom.id comp := WalkingParallelFamily.Hom.comp assoc f g h := by cases f <;> cases g <;> cases h <;> aesop_cat comp_id f := by cases f <;> aesop_cat #align category_theory.limits.walking_parallel_family.category CategoryTheory.Limits.WalkingParallelFamily.category @[simp] theorem WalkingParallelFamily.hom_id (X : WalkingParallelFamily J) : WalkingParallelFamily.Hom.id X = 𝟙 X := rfl #align category_theory.limits.walking_parallel_family.hom_id CategoryTheory.Limits.WalkingParallelFamily.hom_id variable {C : Type u} [Category.{v} C] variable {X Y : C} (f : J → (X ⟶ Y)) def parallelFamily : WalkingParallelFamily J ⥤ C where obj x := WalkingParallelFamily.casesOn x X Y map {x y} h := match x, y, h with | _, _, Hom.id _ => 𝟙 _ | _, _, line j => f j map_comp := by rintro _ _ _ ⟨⟩ ⟨⟩ <;> · aesop_cat #align category_theory.limits.parallel_family CategoryTheory.Limits.parallelFamily @[simp] theorem parallelFamily_obj_zero : (parallelFamily f).obj zero = X := rfl #align category_theory.limits.parallel_family_obj_zero CategoryTheory.Limits.parallelFamily_obj_zero @[simp] theorem parallelFamily_obj_one : (parallelFamily f).obj one = Y := rfl #align category_theory.limits.parallel_family_obj_one CategoryTheory.Limits.parallelFamily_obj_one @[simp] theorem parallelFamily_map_left {j : J} : (parallelFamily f).map (line j) = f j := rfl #align category_theory.limits.parallel_family_map_left CategoryTheory.Limits.parallelFamily_map_left @[simps!] def diagramIsoParallelFamily (F : WalkingParallelFamily J ⥤ C) : F ≅ parallelFamily fun j => F.map (line j) := NatIso.ofComponents (fun j => eqToIso <| by cases j <;> aesop_cat) <| by rintro _ _ (_|_) <;> aesop_cat #align category_theory.limits.diagram_iso_parallel_family CategoryTheory.Limits.diagramIsoParallelFamily @[simps!] def walkingParallelFamilyEquivWalkingParallelPair : WalkingParallelFamily.{w} (ULift Bool) ≌ WalkingParallelPair where functor := parallelFamily fun p => cond p.down WalkingParallelPairHom.left WalkingParallelPairHom.right inverse := parallelPair (line (ULift.up true)) (line (ULift.up false)) unitIso := NatIso.ofComponents (fun X => eqToIso (by cases X <;> rfl)) (by rintro _ _ (_|⟨_|_⟩) <;> aesop_cat) counitIso := NatIso.ofComponents (fun X => eqToIso (by cases X <;> rfl)) (by rintro _ _ (_|_|_) <;> aesop_cat) functor_unitIso_comp := by rintro (_|_) <;> aesop_cat #align category_theory.limits.walking_parallel_family_equiv_walking_parallel_pair CategoryTheory.Limits.walkingParallelFamilyEquivWalkingParallelPair abbrev Trident := Cone (parallelFamily f) #align category_theory.limits.trident CategoryTheory.Limits.Trident abbrev Cotrident := Cocone (parallelFamily f) #align category_theory.limits.cotrident CategoryTheory.Limits.Cotrident variable {f} abbrev Trident.ι (t : Trident f) := t.π.app zero #align category_theory.limits.trident.ι CategoryTheory.Limits.Trident.ι abbrev Cotrident.π (t : Cotrident f) := t.ι.app one #align category_theory.limits.cotrident.π CategoryTheory.Limits.Cotrident.π @[simp] theorem Trident.ι_eq_app_zero (t : Trident f) : t.ι = t.π.app zero := rfl #align category_theory.limits.trident.ι_eq_app_zero CategoryTheory.Limits.Trident.ι_eq_app_zero @[simp] theorem Cotrident.π_eq_app_one (t : Cotrident f) : t.π = t.ι.app one := rfl #align category_theory.limits.cotrident.π_eq_app_one CategoryTheory.Limits.Cotrident.π_eq_app_one @[reassoc (attr := simp)] theorem Trident.app_zero (s : Trident f) (j : J) : s.π.app zero ≫ f j = s.π.app one := by rw [← s.w (line j), parallelFamily_map_left] #align category_theory.limits.trident.app_zero CategoryTheory.Limits.Trident.app_zero @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Limits/Shapes/WideEqualizers.lean
223
224
theorem Cotrident.app_one (s : Cotrident f) (j : J) : f j ≫ s.ι.app one = s.ι.app zero := by
rw [← s.w (line j), parallelFamily_map_left]
1
2.718282
0
0
2
10
import Mathlib.Mathport.Rename #align_import init.data.list.instances from "leanprover-community/lean"@"9af482290ef68e8aaa5ead01aa7b09b7be7019fd" universe u v w namespace List variable {α : Type u} {β : Type v} {γ : Type w} -- Porting note (#10618): simp can prove this -- @[simp] theorem bind_singleton (f : α → List β) (x : α) : [x].bind f = f x := append_nil (f x) #align list.bind_singleton List.bind_singleton @[simp] theorem bind_singleton' (l : List α) : (l.bind fun x => [x]) = l := by induction l <;> simp [*] #align list.bind_singleton' List.bind_singleton' theorem map_eq_bind {α β} (f : α → β) (l : List α) : map f l = l.bind fun x => [f x] := by simp only [← map_singleton] rw [← bind_singleton' l, bind_map, bind_singleton'] #align list.map_eq_bind List.map_eq_bind
Mathlib/Init/Data/List/Instances.lean
35
36
theorem bind_assoc {α β} (l : List α) (f : α → List β) (g : β → List γ) : (l.bind f).bind g = l.bind fun x => (f x).bind g := by
induction l <;> simp [*]
1
2.718282
0
0.5
2
461
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
Mathlib/Data/Ordmap/Ordset.lean
144
145
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
1
2.718282
0
0.571429
7
520
import Mathlib.MeasureTheory.Measure.NullMeasurable import Mathlib.MeasureTheory.MeasurableSpace.Basic import Mathlib.Topology.Algebra.Order.LiminfLimsup #align_import measure_theory.measure.measure_space from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set open Filter hiding map open Function MeasurableSpace open scoped Classical symmDiff open Topology Filter ENNReal NNReal Interval MeasureTheory variable {α β γ δ ι R R' : Type*} namespace MeasureTheory section variable {m : MeasurableSpace α} {μ μ₁ μ₂ : Measure α} {s s₁ s₂ t : Set α} instance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae μ) := ⟨fun _s hs => let ⟨t, hst, htm, htμ⟩ := exists_measurable_superset_of_null hs ⟨tᶜ, compl_mem_ae_iff.2 htμ, htm.compl, compl_subset_comm.1 hst⟩⟩ #align measure_theory.ae_is_measurably_generated MeasureTheory.ae_isMeasurablyGenerated theorem ae_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} : (∀ᵐ x ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ x ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ x ∂μ, x ∈ Ioc b a → P x := by simp only [uIoc_eq_union, mem_union, or_imp, eventually_and] #align measure_theory.ae_uIoc_iff MeasureTheory.ae_uIoc_iff theorem measure_union (hd : Disjoint s₁ s₂) (h : MeasurableSet s₂) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ := measure_union₀ h.nullMeasurableSet hd.aedisjoint #align measure_theory.measure_union MeasureTheory.measure_union theorem measure_union' (hd : Disjoint s₁ s₂) (h : MeasurableSet s₁) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ := measure_union₀' h.nullMeasurableSet hd.aedisjoint #align measure_theory.measure_union' MeasureTheory.measure_union' theorem measure_inter_add_diff (s : Set α) (ht : MeasurableSet t) : μ (s ∩ t) + μ (s \ t) = μ s := measure_inter_add_diff₀ _ ht.nullMeasurableSet #align measure_theory.measure_inter_add_diff MeasureTheory.measure_inter_add_diff theorem measure_diff_add_inter (s : Set α) (ht : MeasurableSet t) : μ (s \ t) + μ (s ∩ t) = μ s := (add_comm _ _).trans (measure_inter_add_diff s ht) #align measure_theory.measure_diff_add_inter MeasureTheory.measure_diff_add_inter theorem measure_union_add_inter (s : Set α) (ht : MeasurableSet t) : μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by rw [← measure_inter_add_diff (s ∪ t) ht, Set.union_inter_cancel_right, union_diff_right, ← measure_inter_add_diff s ht] ac_rfl #align measure_theory.measure_union_add_inter MeasureTheory.measure_union_add_inter theorem measure_union_add_inter' (hs : MeasurableSet s) (t : Set α) : μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by rw [union_comm, inter_comm, measure_union_add_inter t hs, add_comm] #align measure_theory.measure_union_add_inter' MeasureTheory.measure_union_add_inter' lemma measure_symmDiff_eq (hs : MeasurableSet s) (ht : MeasurableSet t) : μ (s ∆ t) = μ (s \ t) + μ (t \ s) := by simpa only [symmDiff_def, sup_eq_union] using measure_union disjoint_sdiff_sdiff (ht.diff hs) lemma measure_symmDiff_le (s t u : Set α) : μ (s ∆ u) ≤ μ (s ∆ t) + μ (t ∆ u) := le_trans (μ.mono <| symmDiff_triangle s t u) (measure_union_le (s ∆ t) (t ∆ u)) theorem measure_add_measure_compl (h : MeasurableSet s) : μ s + μ sᶜ = μ univ := measure_add_measure_compl₀ h.nullMeasurableSet #align measure_theory.measure_add_measure_compl MeasureTheory.measure_add_measure_compl theorem measure_biUnion₀ {s : Set β} {f : β → Set α} (hs : s.Countable) (hd : s.Pairwise (AEDisjoint μ on f)) (h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) := by haveI := hs.toEncodable rw [biUnion_eq_iUnion] exact measure_iUnion₀ (hd.on_injective Subtype.coe_injective fun x => x.2) fun x => h x x.2 #align measure_theory.measure_bUnion₀ MeasureTheory.measure_biUnion₀ theorem measure_biUnion {s : Set β} {f : β → Set α} (hs : s.Countable) (hd : s.PairwiseDisjoint f) (h : ∀ b ∈ s, MeasurableSet (f b)) : μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) := measure_biUnion₀ hs hd.aedisjoint fun b hb => (h b hb).nullMeasurableSet #align measure_theory.measure_bUnion MeasureTheory.measure_biUnion theorem measure_sUnion₀ {S : Set (Set α)} (hs : S.Countable) (hd : S.Pairwise (AEDisjoint μ)) (h : ∀ s ∈ S, NullMeasurableSet s μ) : μ (⋃₀ S) = ∑' s : S, μ s := by rw [sUnion_eq_biUnion, measure_biUnion₀ hs hd h] #align measure_theory.measure_sUnion₀ MeasureTheory.measure_sUnion₀
Mathlib/MeasureTheory/Measure/MeasureSpace.lean
170
172
theorem measure_sUnion {S : Set (Set α)} (hs : S.Countable) (hd : S.Pairwise Disjoint) (h : ∀ s ∈ S, MeasurableSet s) : μ (⋃₀ S) = ∑' s : S, μ s := by
rw [sUnion_eq_biUnion, measure_biUnion hs hd h]
1
2.718282
0
0.333333
6
331
import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Polynomial.Eval import Mathlib.GroupTheory.GroupAction.Ring #align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821" noncomputable section open Finset open Polynomial namespace Polynomial universe u v w y z variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ} section Derivative section Semiring variable [Semiring R] def derivative : R[X] →ₗ[R] R[X] where toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1) map_add' p q := by dsimp only rw [sum_add_index] <;> simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul, RingHom.map_zero] map_smul' a p := by dsimp; rw [sum_smul_index] <;> simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul, RingHom.map_zero, sum] #align polynomial.derivative Polynomial.derivative theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) := rfl #align polynomial.derivative_apply Polynomial.derivative_apply theorem coeff_derivative (p : R[X]) (n : ℕ) : coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by rw [derivative_apply] simp only [coeff_X_pow, coeff_sum, coeff_C_mul] rw [sum, Finset.sum_eq_single (n + 1)] · simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast · intro b cases b · intros rw [Nat.cast_zero, mul_zero, zero_mul] · intro _ H rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero] · rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one, mem_support_iff] intro h push_neg at h simp [h] #align polynomial.coeff_derivative Polynomial.coeff_derivative -- Porting note (#10618): removed `simp`: `simp` can prove it. theorem derivative_zero : derivative (0 : R[X]) = 0 := derivative.map_zero #align polynomial.derivative_zero Polynomial.derivative_zero theorem iterate_derivative_zero {k : ℕ} : derivative^[k] (0 : R[X]) = 0 := iterate_map_zero derivative k #align polynomial.iterate_derivative_zero Polynomial.iterate_derivative_zero @[simp] theorem derivative_monomial (a : R) (n : ℕ) : derivative (monomial n a) = monomial (n - 1) (a * n) := by rw [derivative_apply, sum_monomial_index, C_mul_X_pow_eq_monomial] simp #align polynomial.derivative_monomial Polynomial.derivative_monomial theorem derivative_C_mul_X (a : R) : derivative (C a * X) = C a := by simp [C_mul_X_eq_monomial, derivative_monomial, Nat.cast_one, mul_one] set_option linter.uppercaseLean3 false in #align polynomial.derivative_C_mul_X Polynomial.derivative_C_mul_X theorem derivative_C_mul_X_pow (a : R) (n : ℕ) : derivative (C a * X ^ n) = C (a * n) * X ^ (n - 1) := by rw [C_mul_X_pow_eq_monomial, C_mul_X_pow_eq_monomial, derivative_monomial] set_option linter.uppercaseLean3 false in #align polynomial.derivative_C_mul_X_pow Polynomial.derivative_C_mul_X_pow theorem derivative_C_mul_X_sq (a : R) : derivative (C a * X ^ 2) = C (a * 2) * X := by rw [derivative_C_mul_X_pow, Nat.cast_two, pow_one] set_option linter.uppercaseLean3 false in #align polynomial.derivative_C_mul_X_sq Polynomial.derivative_C_mul_X_sq @[simp] theorem derivative_X_pow (n : ℕ) : derivative (X ^ n : R[X]) = C (n : R) * X ^ (n - 1) := by convert derivative_C_mul_X_pow (1 : R) n <;> simp set_option linter.uppercaseLean3 false in #align polynomial.derivative_X_pow Polynomial.derivative_X_pow -- Porting note (#10618): removed `simp`: `simp` can prove it.
Mathlib/Algebra/Polynomial/Derivative.lean
115
116
theorem derivative_X_sq : derivative (X ^ 2 : R[X]) = C 2 * X := by
rw [derivative_X_pow, Nat.cast_two, pow_one]
1
2.718282
0
0.3
10
317
import Mathlib.Data.Finsupp.Multiset import Mathlib.Order.Bounded import Mathlib.SetTheory.Cardinal.PartENat import Mathlib.SetTheory.Ordinal.Principal import Mathlib.Tactic.Linarith #align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Set Cardinal Equiv Order Ordinal open scoped Classical universe u v w namespace Cardinal section UsingOrdinals theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩ · rw [← Ordinal.le_zero, ord_le] at h simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h · rw [ord_le] at h ⊢ rwa [← @add_one_of_aleph0_le (card a), ← card_succ] rw [← ord_le, ← le_succ_of_isLimit, ord_le] · exact co.trans h · rw [ord_aleph0] exact omega_isLimit #align cardinal.ord_is_limit Cardinal.ord_isLimit theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α := Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2 section aleph def alephIdx.initialSeg : @InitialSeg Cardinal Ordinal (· < ·) (· < ·) := @RelEmbedding.collapse Cardinal Ordinal (· < ·) (· < ·) _ Cardinal.ord.orderEmbedding.ltEmbedding #align cardinal.aleph_idx.initial_seg Cardinal.alephIdx.initialSeg def alephIdx : Cardinal → Ordinal := alephIdx.initialSeg #align cardinal.aleph_idx Cardinal.alephIdx @[simp] theorem alephIdx.initialSeg_coe : (alephIdx.initialSeg : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.initial_seg_coe Cardinal.alephIdx.initialSeg_coe @[simp] theorem alephIdx_lt {a b} : alephIdx a < alephIdx b ↔ a < b := alephIdx.initialSeg.toRelEmbedding.map_rel_iff #align cardinal.aleph_idx_lt Cardinal.alephIdx_lt @[simp] theorem alephIdx_le {a b} : alephIdx a ≤ alephIdx b ↔ a ≤ b := by rw [← not_lt, ← not_lt, alephIdx_lt] #align cardinal.aleph_idx_le Cardinal.alephIdx_le theorem alephIdx.init {a b} : b < alephIdx a → ∃ c, alephIdx c = b := alephIdx.initialSeg.init #align cardinal.aleph_idx.init Cardinal.alephIdx.init def alephIdx.relIso : @RelIso Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) := @RelIso.ofSurjective Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) alephIdx.initialSeg.{u} <| (InitialSeg.eq_or_principal alephIdx.initialSeg.{u}).resolve_right fun ⟨o, e⟩ => by have : ∀ c, alephIdx c < o := fun c => (e _).2 ⟨_, rfl⟩ refine Ordinal.inductionOn o ?_ this; intro α r _ h let s := ⨆ a, invFun alephIdx (Ordinal.typein r a) apply (lt_succ s).not_le have I : Injective.{u+2, u+2} alephIdx := alephIdx.initialSeg.toEmbedding.injective simpa only [typein_enum, leftInverse_invFun I (succ s)] using le_ciSup (Cardinal.bddAbove_range.{u, u} fun a : α => invFun alephIdx (Ordinal.typein r a)) (Ordinal.enum r _ (h (succ s))) #align cardinal.aleph_idx.rel_iso Cardinal.alephIdx.relIso @[simp] theorem alephIdx.relIso_coe : (alephIdx.relIso : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.rel_iso_coe Cardinal.alephIdx.relIso_coe @[simp]
Mathlib/SetTheory/Cardinal/Ordinal.lean
146
147
theorem type_cardinal : @type Cardinal (· < ·) _ = Ordinal.univ.{u, u + 1} := by
rw [Ordinal.univ_id]; exact Quotient.sound ⟨alephIdx.relIso⟩
1
2.718282
0
1
8
1,056
import Mathlib.CategoryTheory.Subobject.Lattice #align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d" universe v u noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite variable {C : Type u} [Category.{v} C] {X Y Z : C} namespace CategoryTheory namespace Limits section Image variable (f : X ⟶ Y) [HasImage f] abbrev imageSubobject : Subobject Y := Subobject.mk (image.ι f) #align category_theory.limits.image_subobject CategoryTheory.Limits.imageSubobject def imageSubobjectIso : (imageSubobject f : C) ≅ image f := Subobject.underlyingIso (image.ι f) #align category_theory.limits.image_subobject_iso CategoryTheory.Limits.imageSubobjectIso @[reassoc (attr := simp)] theorem imageSubobject_arrow : (imageSubobjectIso f).hom ≫ image.ι f = (imageSubobject f).arrow := by simp [imageSubobjectIso] #align category_theory.limits.image_subobject_arrow CategoryTheory.Limits.imageSubobject_arrow @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Subobject/Limits.lean
314
315
theorem imageSubobject_arrow' : (imageSubobjectIso f).inv ≫ (imageSubobject f).arrow = image.ι f := by
simp [imageSubobjectIso]
1
2.718282
0
0.263158
19
308
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
2.718282
0
0.5
10
472
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.HasseDeriv #align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section namespace Polynomial open Polynomial variable {R : Type*} [Semiring R] (r : R) (f : R[X]) def taylor (r : R) : R[X] →ₗ[R] R[X] where toFun f := f.comp (X + C r) map_add' f g := add_comp map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply] #align polynomial.taylor Polynomial.taylor theorem taylor_apply : taylor r f = f.comp (X + C r) := rfl #align polynomial.taylor_apply Polynomial.taylor_apply @[simp] theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp] set_option linter.uppercaseLean3 false in #align polynomial.taylor_X Polynomial.taylor_X @[simp] theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp] set_option linter.uppercaseLean3 false in #align polynomial.taylor_C Polynomial.taylor_C @[simp] theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by ext simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp, Function.comp_apply, LinearMap.coe_comp] #align polynomial.taylor_zero' Polynomial.taylor_zero' theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply] #align polynomial.taylor_zero Polynomial.taylor_zero @[simp] theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [← C_1, taylor_C] #align polynomial.taylor_one Polynomial.taylor_one @[simp]
Mathlib/Algebra/Polynomial/Taylor.lean
70
71
theorem taylor_monomial (i : ℕ) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by
simp [taylor_apply]
1
2.718282
0
0.466667
15
415
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]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
80
80
theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by
simp [volume_val]
1
2.718282
0
0.909091
22
790
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]
Mathlib/Data/Vector/MapLemmas.lean
76
84
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
1
2.718282
0
0.333333
24
337
import Mathlib.Topology.MetricSpace.PseudoMetric #align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Bornology open scoped NNReal Uniformity universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y #align metric_space MetricSpace @[ext] theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) : m = m' := by cases m; cases m'; congr; ext1; assumption #align metric_space.ext MetricSpace.ext def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) (eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α := { PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ } #align metric_space.of_dist_topology MetricSpace.ofDistTopology variable {γ : Type w} [MetricSpace γ] theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y := MetricSpace.eq_of_dist_eq_zero #align eq_of_dist_eq_zero eq_of_dist_eq_zero @[simp] theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y := Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _ #align dist_eq_zero dist_eq_zero @[simp] theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero] #align zero_eq_dist zero_eq_dist theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by simpa only [not_iff_not] using dist_eq_zero #align dist_ne_zero dist_ne_zero @[simp] theorem dist_le_zero {x y : γ} : dist x y ≤ 0 ↔ x = y := by simpa [le_antisymm_iff, dist_nonneg] using @dist_eq_zero _ _ x y #align dist_le_zero dist_le_zero @[simp] theorem dist_pos {x y : γ} : 0 < dist x y ↔ x ≠ y := by simpa only [not_le] using not_congr dist_le_zero #align dist_pos dist_pos theorem eq_of_forall_dist_le {x y : γ} (h : ∀ ε > 0, dist x y ≤ ε) : x = y := eq_of_dist_eq_zero (eq_of_le_of_forall_le_of_dense dist_nonneg h) #align eq_of_forall_dist_le eq_of_forall_dist_le theorem eq_of_nndist_eq_zero {x y : γ} : nndist x y = 0 → x = y := by simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero] #align eq_of_nndist_eq_zero eq_of_nndist_eq_zero @[simp] theorem nndist_eq_zero {x y : γ} : nndist x y = 0 ↔ x = y := by simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero] #align nndist_eq_zero nndist_eq_zero @[simp] theorem zero_eq_nndist {x y : γ} : 0 = nndist x y ↔ x = y := by simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, zero_eq_dist] #align zero_eq_nndist zero_eq_nndist namespace Metric variable {x : γ} {s : Set γ} @[simp] theorem closedBall_zero : closedBall x 0 = {x} := Set.ext fun _ => dist_le_zero #align metric.closed_ball_zero Metric.closedBall_zero @[simp] theorem sphere_zero : sphere x 0 = {x} := Set.ext fun _ => dist_eq_zero #align metric.sphere_zero Metric.sphere_zero theorem subsingleton_closedBall (x : γ) {r : ℝ} (hr : r ≤ 0) : (closedBall x r).Subsingleton := by rcases hr.lt_or_eq with (hr | rfl) · rw [closedBall_eq_empty.2 hr] exact subsingleton_empty · rw [closedBall_zero] exact subsingleton_singleton #align metric.subsingleton_closed_ball Metric.subsingleton_closedBall theorem subsingleton_sphere (x : γ) {r : ℝ} (hr : r ≤ 0) : (sphere x r).Subsingleton := (subsingleton_closedBall x hr).anti sphere_subset_closedBall #align metric.subsingleton_sphere Metric.subsingleton_sphere -- see Note [lower instance priority] instance (priority := 100) _root_.MetricSpace.instT0Space : T0Space γ where t0 _ _ h := eq_of_dist_eq_zero <| Metric.inseparable_iff.1 h #align metric_space.to_separated MetricSpace.instT0Space
Mathlib/Topology/MetricSpace/Basic.lean
140
144
theorem uniformEmbedding_iff' [MetricSpace β] {f : γ → β} : UniformEmbedding f ↔ (∀ ε > 0, ∃ δ > 0, ∀ {a b : γ}, dist a b < δ → dist (f a) (f b) < ε) ∧ ∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, dist (f a) (f b) < ε → dist a b < δ := by
rw [uniformEmbedding_iff_uniformInducing, uniformInducing_iff, uniformContinuous_iff]
1
2.718282
0
0.166667
12
258