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.Order.Filter.SmallSets
import Mathlib.Tactic.Monotonicity
import Mathlib.Topology.Compactness.Compact
import Mathlib.Topology.NhdsSet
import Mathlib.Algebra.Group.Defs
#align_import topology.uniform_space.basic from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c"
open Set Filter Topology
universe u v ua ub uc ud
variable {α : Type ua} {β : Type ub} {γ : Type uc} {δ : Type ud} {ι : Sort*}
def idRel {α : Type*} :=
{ p : α × α | p.1 = p.2 }
#align id_rel idRel
@[simp]
theorem mem_idRel {a b : α} : (a, b) ∈ @idRel α ↔ a = b :=
Iff.rfl
#align mem_id_rel mem_idRel
@[simp]
theorem idRel_subset {s : Set (α × α)} : idRel ⊆ s ↔ ∀ a, (a, a) ∈ s := by
simp [subset_def]
#align id_rel_subset idRel_subset
def compRel (r₁ r₂ : Set (α × α)) :=
{ p : α × α | ∃ z : α, (p.1, z) ∈ r₁ ∧ (z, p.2) ∈ r₂ }
#align comp_rel compRel
@[inherit_doc]
scoped[Uniformity] infixl:62 " ○ " => compRel
open Uniformity
@[simp]
theorem mem_compRel {α : Type u} {r₁ r₂ : Set (α × α)} {x y : α} :
(x, y) ∈ r₁ ○ r₂ ↔ ∃ z, (x, z) ∈ r₁ ∧ (z, y) ∈ r₂ :=
Iff.rfl
#align mem_comp_rel mem_compRel
@[simp]
theorem swap_idRel : Prod.swap '' idRel = @idRel α :=
Set.ext fun ⟨a, b⟩ => by simpa [image_swap_eq_preimage_swap] using eq_comm
#align swap_id_rel swap_idRel
theorem Monotone.compRel [Preorder β] {f g : β → Set (α × α)} (hf : Monotone f) (hg : Monotone g) :
Monotone fun x => f x ○ g x := fun _ _ h _ ⟨z, h₁, h₂⟩ => ⟨z, hf h h₁, hg h h₂⟩
#align monotone.comp_rel Monotone.compRel
@[mono]
theorem compRel_mono {f g h k : Set (α × α)} (h₁ : f ⊆ h) (h₂ : g ⊆ k) : f ○ g ⊆ h ○ k :=
fun _ ⟨z, h, h'⟩ => ⟨z, h₁ h, h₂ h'⟩
#align comp_rel_mono compRel_mono
theorem prod_mk_mem_compRel {a b c : α} {s t : Set (α × α)} (h₁ : (a, c) ∈ s) (h₂ : (c, b) ∈ t) :
(a, b) ∈ s ○ t :=
⟨c, h₁, h₂⟩
#align prod_mk_mem_comp_rel prod_mk_mem_compRel
@[simp]
theorem id_compRel {r : Set (α × α)} : idRel ○ r = r :=
Set.ext fun ⟨a, b⟩ => by simp
#align id_comp_rel id_compRel
theorem compRel_assoc {r s t : Set (α × α)} : r ○ s ○ t = r ○ (s ○ t) := by
ext ⟨a, b⟩; simp only [mem_compRel]; tauto
#align comp_rel_assoc compRel_assoc
theorem left_subset_compRel {s t : Set (α × α)} (h : idRel ⊆ t) : s ⊆ s ○ t := fun ⟨_x, y⟩ xy_in =>
⟨y, xy_in, h <| rfl⟩
#align left_subset_comp_rel left_subset_compRel
theorem right_subset_compRel {s t : Set (α × α)} (h : idRel ⊆ s) : t ⊆ s ○ t := fun ⟨x, _y⟩ xy_in =>
⟨x, h <| rfl, xy_in⟩
#align right_subset_comp_rel right_subset_compRel
theorem subset_comp_self {s : Set (α × α)} (h : idRel ⊆ s) : s ⊆ s ○ s :=
left_subset_compRel h
#align subset_comp_self subset_comp_self
theorem subset_iterate_compRel {s t : Set (α × α)} (h : idRel ⊆ s) (n : ℕ) :
t ⊆ (s ○ ·)^[n] t := by
induction' n with n ihn generalizing t
exacts [Subset.rfl, (right_subset_compRel h).trans ihn]
#align subset_iterate_comp_rel subset_iterate_compRel
def SymmetricRel (V : Set (α × α)) : Prop :=
Prod.swap ⁻¹' V = V
#align symmetric_rel SymmetricRel
def symmetrizeRel (V : Set (α × α)) : Set (α × α) :=
V ∩ Prod.swap ⁻¹' V
#align symmetrize_rel symmetrizeRel
theorem symmetric_symmetrizeRel (V : Set (α × α)) : SymmetricRel (symmetrizeRel V) := by
simp [SymmetricRel, symmetrizeRel, preimage_inter, inter_comm, ← preimage_comp]
#align symmetric_symmetrize_rel symmetric_symmetrizeRel
theorem symmetrizeRel_subset_self (V : Set (α × α)) : symmetrizeRel V ⊆ V :=
sep_subset _ _
#align symmetrize_rel_subset_self symmetrizeRel_subset_self
@[mono]
theorem symmetrize_mono {V W : Set (α × α)} (h : V ⊆ W) : symmetrizeRel V ⊆ symmetrizeRel W :=
inter_subset_inter h <| preimage_mono h
#align symmetrize_mono symmetrize_mono
theorem SymmetricRel.mk_mem_comm {V : Set (α × α)} (hV : SymmetricRel V) {x y : α} :
(x, y) ∈ V ↔ (y, x) ∈ V :=
Set.ext_iff.1 hV (y, x)
#align symmetric_rel.mk_mem_comm SymmetricRel.mk_mem_comm
theorem SymmetricRel.eq {U : Set (α × α)} (hU : SymmetricRel U) : Prod.swap ⁻¹' U = U :=
hU
#align symmetric_rel.eq SymmetricRel.eq
| Mathlib/Topology/UniformSpace/Basic.lean | 237 | 238 | theorem SymmetricRel.inter {U V : Set (α × α)} (hU : SymmetricRel U) (hV : SymmetricRel V) :
SymmetricRel (U ∩ V) := by | rw [SymmetricRel, preimage_inter, hU.eq, hV.eq]
| 1 | 2.718282 | 0 | 0.2 | 5 | 272 |
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.OrdConnected
#align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c"
variable {α β : Type*} [LinearOrder α]
open Function
namespace Set
def projIci (a x : α) : Ici a := ⟨max a x, le_max_left _ _⟩
#align set.proj_Ici Set.projIci
def projIic (b x : α) : Iic b := ⟨min b x, min_le_left _ _⟩
#align set.proj_Iic Set.projIic
def projIcc (a b : α) (h : a ≤ b) (x : α) : Icc a b :=
⟨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)⟩
#align set.proj_Icc Set.projIcc
variable {a b : α} (h : a ≤ b) {x : α}
@[norm_cast]
theorem coe_projIci (a x : α) : (projIci a x : α) = max a x := rfl
#align set.coe_proj_Ici Set.coe_projIci
@[norm_cast]
theorem coe_projIic (b x : α) : (projIic b x : α) = min b x := rfl
#align set.coe_proj_Iic Set.coe_projIic
@[norm_cast]
theorem coe_projIcc (a b : α) (h : a ≤ b) (x : α) : (projIcc a b h x : α) = max a (min b x) := rfl
#align set.coe_proj_Icc Set.coe_projIcc
theorem projIci_of_le (hx : x ≤ a) : projIci a x = ⟨a, le_rfl⟩ := Subtype.ext <| max_eq_left hx
#align set.proj_Ici_of_le Set.projIci_of_le
theorem projIic_of_le (hx : b ≤ x) : projIic b x = ⟨b, le_rfl⟩ := Subtype.ext <| min_eq_left hx
#align set.proj_Iic_of_le Set.projIic_of_le
| Mathlib/Order/Interval/Set/ProjIcc.lean | 72 | 73 | theorem projIcc_of_le_left (hx : x ≤ a) : projIcc a b h x = ⟨a, left_mem_Icc.2 h⟩ := by |
simp [projIcc, hx, hx.trans h]
| 1 | 2.718282 | 0 | 0.083333 | 12 | 241 |
import Mathlib.Data.List.Range
import Mathlib.Algebra.Order.Ring.Nat
variable {α : Type*}
namespace List
@[simp]
| Mathlib/Data/List/Iterate.lean | 21 | 22 | theorem length_iterate (f : α → α) (a : α) (n : ℕ) : length (iterate f a n) = n := by |
induction n generalizing a <;> simp [*]
| 1 | 2.718282 | 0 | 0.166667 | 6 | 264 |
import Mathlib.Topology.Order.LeftRight
import Mathlib.Topology.Order.Monotone
#align_import topology.algebra.order.left_right_lim from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
open Set Filter
open Topology
section
variable {α β : Type*} [LinearOrder α] [TopologicalSpace β]
noncomputable def Function.leftLim (f : α → β) (a : α) : β := by
classical
haveI : Nonempty β := ⟨f a⟩
letI : TopologicalSpace α := Preorder.topology α
exact if 𝓝[<] a = ⊥ ∨ ¬∃ y, Tendsto f (𝓝[<] a) (𝓝 y) then f a else limUnder (𝓝[<] a) f
#align function.left_lim Function.leftLim
noncomputable def Function.rightLim (f : α → β) (a : α) : β :=
@Function.leftLim αᵒᵈ β _ _ f a
#align function.right_lim Function.rightLim
open Function
theorem leftLim_eq_of_tendsto [hα : TopologicalSpace α] [h'α : OrderTopology α] [T2Space β]
{f : α → β} {a : α} {y : β} (h : 𝓝[<] a ≠ ⊥) (h' : Tendsto f (𝓝[<] a) (𝓝 y)) :
leftLim f a = y := by
have h'' : ∃ y, Tendsto f (𝓝[<] a) (𝓝 y) := ⟨y, h'⟩
rw [h'α.topology_eq_generate_intervals] at h h' h''
simp only [leftLim, h, h'', not_true, or_self_iff, if_false]
haveI := neBot_iff.2 h
exact lim_eq h'
#align left_lim_eq_of_tendsto leftLim_eq_of_tendsto
theorem leftLim_eq_of_eq_bot [hα : TopologicalSpace α] [h'α : OrderTopology α] (f : α → β) {a : α}
(h : 𝓝[<] a = ⊥) : leftLim f a = f a := by
rw [h'α.topology_eq_generate_intervals] at h
simp [leftLim, ite_eq_left_iff, h]
#align left_lim_eq_of_eq_bot leftLim_eq_of_eq_bot
theorem rightLim_eq_of_tendsto [TopologicalSpace α] [OrderTopology α] [T2Space β]
{f : α → β} {a : α} {y : β} (h : 𝓝[>] a ≠ ⊥) (h' : Tendsto f (𝓝[>] a) (𝓝 y)) :
Function.rightLim f a = y :=
@leftLim_eq_of_tendsto αᵒᵈ _ _ _ _ _ _ f a y h h'
#align right_lim_eq_of_tendsto rightLim_eq_of_tendsto
theorem rightLim_eq_of_eq_bot [TopologicalSpace α] [OrderTopology α] (f : α → β) {a : α}
(h : 𝓝[>] a = ⊥) : rightLim f a = f a :=
@leftLim_eq_of_eq_bot αᵒᵈ _ _ _ _ _ f a h
end
open Function
namespace Monotone
variable {α β : Type*} [LinearOrder α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β]
[OrderTopology β] {f : α → β} (hf : Monotone f) {x y : α}
theorem leftLim_eq_sSup [TopologicalSpace α] [OrderTopology α] (h : 𝓝[<] x ≠ ⊥) :
leftLim f x = sSup (f '' Iio x) :=
leftLim_eq_of_tendsto h (hf.tendsto_nhdsWithin_Iio x)
#align monotone.left_lim_eq_Sup Monotone.leftLim_eq_sSup
theorem rightLim_eq_sInf [TopologicalSpace α] [OrderTopology α] (h : 𝓝[>] x ≠ ⊥) :
rightLim f x = sInf (f '' Ioi x) :=
rightLim_eq_of_tendsto h (hf.tendsto_nhdsWithin_Ioi x)
#align right_lim_eq_Inf Monotone.rightLim_eq_sInf
| Mathlib/Topology/Order/LeftRightLim.lean | 110 | 122 | theorem leftLim_le (h : x ≤ y) : leftLim f x ≤ f y := by |
letI : TopologicalSpace α := Preorder.topology α
haveI : OrderTopology α := ⟨rfl⟩
rcases eq_or_ne (𝓝[<] x) ⊥ with (h' | h')
· simpa [leftLim, h'] using hf h
haveI A : NeBot (𝓝[<] x) := neBot_iff.2 h'
rw [leftLim_eq_sSup hf h']
refine csSup_le ?_ ?_
· simp only [image_nonempty]
exact (forall_mem_nonempty_iff_neBot.2 A) _ self_mem_nhdsWithin
· simp only [mem_image, mem_Iio, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
intro z hz
exact hf (hz.le.trans h)
| 12 | 162,754.791419 | 2 | 1.75 | 4 | 1,854 |
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {α : Type*}
namespace Set
section LinearOrderedField
variable [LinearOrderedField α] {a : α}
@[simp]
theorem preimage_mul_const_Iio (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iio a = Iio (a / c) :=
ext fun _x => (lt_div_iff h).symm
#align set.preimage_mul_const_Iio Set.preimage_mul_const_Iio
@[simp]
theorem preimage_mul_const_Ioi (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioi a = Ioi (a / c) :=
ext fun _x => (div_lt_iff h).symm
#align set.preimage_mul_const_Ioi Set.preimage_mul_const_Ioi
@[simp]
theorem preimage_mul_const_Iic (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iic a = Iic (a / c) :=
ext fun _x => (le_div_iff h).symm
#align set.preimage_mul_const_Iic Set.preimage_mul_const_Iic
@[simp]
theorem preimage_mul_const_Ici (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ici a = Ici (a / c) :=
ext fun _x => (div_le_iff h).symm
#align set.preimage_mul_const_Ici Set.preimage_mul_const_Ici
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 619 | 620 | theorem preimage_mul_const_Ioo (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c) := by | simp [← Ioi_inter_Iio, h]
| 1 | 2.718282 | 0 | 0.37931 | 29 | 381 |
import Mathlib.Algebra.ContinuedFractions.Basic
import Mathlib.Algebra.GroupWithZero.Basic
#align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
section General
variable {α : Type*} {g : GeneralizedContinuedFraction α} {n : ℕ}
theorem terminatedAt_iff_s_terminatedAt : g.TerminatedAt n ↔ g.s.TerminatedAt n := by rfl
#align generalized_continued_fraction.terminated_at_iff_s_terminated_at GeneralizedContinuedFraction.terminatedAt_iff_s_terminatedAt
| Mathlib/Algebra/ContinuedFractions/Translations.lean | 38 | 38 | theorem terminatedAt_iff_s_none : g.TerminatedAt n ↔ g.s.get? n = none := by | rfl
| 1 | 2.718282 | 0 | 0.052632 | 19 | 240 |
import Mathlib.Data.Finset.Grade
import Mathlib.Order.Interval.Finset.Basic
#align_import data.finset.interval from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
variable {α β : Type*}
namespace Finset
section Decidable
variable [DecidableEq α] (s t : Finset α)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Finset α) where
finsetIcc s t := t.powerset.filter (s ⊆ ·)
finsetIco s t := t.ssubsets.filter (s ⊆ ·)
finsetIoc s t := t.powerset.filter (s ⊂ ·)
finsetIoo s t := t.ssubsets.filter (s ⊂ ·)
finset_mem_Icc s t u := by
rw [mem_filter, mem_powerset]
exact and_comm
finset_mem_Ico s t u := by
rw [mem_filter, mem_ssubsets]
exact and_comm
finset_mem_Ioc s t u := by
rw [mem_filter, mem_powerset]
exact and_comm
finset_mem_Ioo s t u := by
rw [mem_filter, mem_ssubsets]
exact and_comm
theorem Icc_eq_filter_powerset : Icc s t = t.powerset.filter (s ⊆ ·) :=
rfl
#align finset.Icc_eq_filter_powerset Finset.Icc_eq_filter_powerset
theorem Ico_eq_filter_ssubsets : Ico s t = t.ssubsets.filter (s ⊆ ·) :=
rfl
#align finset.Ico_eq_filter_ssubsets Finset.Ico_eq_filter_ssubsets
theorem Ioc_eq_filter_powerset : Ioc s t = t.powerset.filter (s ⊂ ·) :=
rfl
#align finset.Ioc_eq_filter_powerset Finset.Ioc_eq_filter_powerset
theorem Ioo_eq_filter_ssubsets : Ioo s t = t.ssubsets.filter (s ⊂ ·) :=
rfl
#align finset.Ioo_eq_filter_ssubsets Finset.Ioo_eq_filter_ssubsets
theorem Iic_eq_powerset : Iic s = s.powerset :=
filter_true_of_mem fun t _ => empty_subset t
#align finset.Iic_eq_powerset Finset.Iic_eq_powerset
theorem Iio_eq_ssubsets : Iio s = s.ssubsets :=
filter_true_of_mem fun t _ => empty_subset t
#align finset.Iio_eq_ssubsets Finset.Iio_eq_ssubsets
variable {s t}
theorem Icc_eq_image_powerset (h : s ⊆ t) : Icc s t = (t \ s).powerset.image (s ∪ ·) := by
ext u
simp_rw [mem_Icc, mem_image, mem_powerset]
constructor
· rintro ⟨hs, ht⟩
exact ⟨u \ s, sdiff_le_sdiff_right ht, sup_sdiff_cancel_right hs⟩
· rintro ⟨v, hv, rfl⟩
exact ⟨le_sup_left, union_subset h <| hv.trans sdiff_subset⟩
#align finset.Icc_eq_image_powerset Finset.Icc_eq_image_powerset
theorem Ico_eq_image_ssubsets (h : s ⊆ t) : Ico s t = (t \ s).ssubsets.image (s ∪ ·) := by
ext u
simp_rw [mem_Ico, mem_image, mem_ssubsets]
constructor
· rintro ⟨hs, ht⟩
exact ⟨u \ s, sdiff_lt_sdiff_right ht hs, sup_sdiff_cancel_right hs⟩
· rintro ⟨v, hv, rfl⟩
exact ⟨le_sup_left, sup_lt_of_lt_sdiff_left hv h⟩
#align finset.Ico_eq_image_ssubsets Finset.Ico_eq_image_ssubsets
theorem card_Icc_finset (h : s ⊆ t) : (Icc s t).card = 2 ^ (t.card - s.card) := by
rw [← card_sdiff h, ← card_powerset, Icc_eq_image_powerset h, Finset.card_image_iff]
rintro u hu v hv (huv : s ⊔ u = s ⊔ v)
rw [mem_coe, mem_powerset] at hu hv
rw [← (disjoint_sdiff.mono_right hu : Disjoint s u).sup_sdiff_cancel_left, ←
(disjoint_sdiff.mono_right hv : Disjoint s v).sup_sdiff_cancel_left, huv]
#align finset.card_Icc_finset Finset.card_Icc_finset
theorem card_Ico_finset (h : s ⊆ t) : (Ico s t).card = 2 ^ (t.card - s.card) - 1 := by
rw [card_Ico_eq_card_Icc_sub_one, card_Icc_finset h]
#align finset.card_Ico_finset Finset.card_Ico_finset
theorem card_Ioc_finset (h : s ⊆ t) : (Ioc s t).card = 2 ^ (t.card - s.card) - 1 := by
rw [card_Ioc_eq_card_Icc_sub_one, card_Icc_finset h]
#align finset.card_Ioc_finset Finset.card_Ioc_finset
theorem card_Ioo_finset (h : s ⊆ t) : (Ioo s t).card = 2 ^ (t.card - s.card) - 2 := by
rw [card_Ioo_eq_card_Icc_sub_two, card_Icc_finset h]
#align finset.card_Ioo_finset Finset.card_Ioo_finset
| Mathlib/Data/Finset/Interval.lean | 125 | 125 | theorem card_Iic_finset : (Iic s).card = 2 ^ s.card := by | rw [Iic_eq_powerset, card_powerset]
| 1 | 2.718282 | 0 | 0.75 | 8 | 661 |
import Mathlib.SetTheory.Cardinal.ENat
#align_import set_theory.cardinal.basic from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8"
universe u v
open Function Set
namespace Cardinal
variable {α : Type u} {c d : Cardinal.{u}}
noncomputable def toNat : Cardinal →*₀ ℕ :=
ENat.toNat.comp toENat
#align cardinal.to_nat Cardinal.toNat
#align cardinal.to_nat_hom Cardinal.toNat
@[simp] lemma toNat_toENat (a : Cardinal) : ENat.toNat (toENat a) = toNat a := rfl
@[simp]
theorem toNat_ofENat (n : ℕ∞) : toNat n = ENat.toNat n :=
congr_arg ENat.toNat <| toENat_ofENat n
@[simp, norm_cast] theorem toNat_natCast (n : ℕ) : toNat n = n := toNat_ofENat n
@[simp]
lemma toNat_eq_zero : toNat c = 0 ↔ c = 0 ∨ ℵ₀ ≤ c := by
rw [← toNat_toENat, ENat.toNat_eq_zero, toENat_eq_zero, toENat_eq_top]
lemma toNat_ne_zero : toNat c ≠ 0 ↔ c ≠ 0 ∧ c < ℵ₀ := by simp [not_or]
@[simp] lemma toNat_pos : 0 < toNat c ↔ c ≠ 0 ∧ c < ℵ₀ := pos_iff_ne_zero.trans toNat_ne_zero
theorem cast_toNat_of_lt_aleph0 {c : Cardinal} (h : c < ℵ₀) : ↑(toNat c) = c := by
lift c to ℕ using h
rw [toNat_natCast]
#align cardinal.cast_to_nat_of_lt_aleph_0 Cardinal.cast_toNat_of_lt_aleph0
theorem toNat_apply_of_lt_aleph0 {c : Cardinal} (h : c < ℵ₀) :
toNat c = Classical.choose (lt_aleph0.1 h) :=
Nat.cast_injective <| by rw [cast_toNat_of_lt_aleph0 h, ← Classical.choose_spec (lt_aleph0.1 h)]
#align cardinal.to_nat_apply_of_lt_aleph_0 Cardinal.toNat_apply_of_lt_aleph0
| Mathlib/SetTheory/Cardinal/ToNat.lean | 57 | 57 | theorem toNat_apply_of_aleph0_le {c : Cardinal} (h : ℵ₀ ≤ c) : toNat c = 0 := by | simp [h]
| 1 | 2.718282 | 0 | 0.4 | 5 | 391 |
import Mathlib.Data.Finset.Sigma
import Mathlib.Data.Finset.Pairwise
import Mathlib.Data.Finset.Powerset
import Mathlib.Data.Fintype.Basic
import Mathlib.Order.CompleteLatticeIntervals
#align_import order.sup_indep from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d"
variable {α β ι ι' : Type*}
namespace Finset
section Lattice
variable [Lattice α] [OrderBot α]
def SupIndep (s : Finset ι) (f : ι → α) : Prop :=
∀ ⦃t⦄, t ⊆ s → ∀ ⦃i⦄, i ∈ s → i ∉ t → Disjoint (f i) (t.sup f)
#align finset.sup_indep Finset.SupIndep
variable {s t : Finset ι} {f : ι → α} {i : ι}
instance [DecidableEq ι] [DecidableEq α] : Decidable (SupIndep s f) := by
refine @Finset.decidableForallOfDecidableSubsets _ _ _ (?_)
rintro t -
refine @Finset.decidableDforallFinset _ _ _ (?_)
rintro i -
have : Decidable (Disjoint (f i) (sup t f)) := decidable_of_iff' (_ = ⊥) disjoint_iff
infer_instance
theorem SupIndep.subset (ht : t.SupIndep f) (h : s ⊆ t) : s.SupIndep f := fun _ hu _ hi =>
ht (hu.trans h) (h hi)
#align finset.sup_indep.subset Finset.SupIndep.subset
@[simp]
theorem supIndep_empty (f : ι → α) : (∅ : Finset ι).SupIndep f := fun _ _ a ha =>
(not_mem_empty a ha).elim
#align finset.sup_indep_empty Finset.supIndep_empty
theorem supIndep_singleton (i : ι) (f : ι → α) : ({i} : Finset ι).SupIndep f :=
fun s hs j hji hj => by
rw [eq_empty_of_ssubset_singleton ⟨hs, fun h => hj (h hji)⟩, sup_empty]
exact disjoint_bot_right
#align finset.sup_indep_singleton Finset.supIndep_singleton
theorem SupIndep.pairwiseDisjoint (hs : s.SupIndep f) : (s : Set ι).PairwiseDisjoint f :=
fun _ ha _ hb hab =>
sup_singleton.subst <| hs (singleton_subset_iff.2 hb) ha <| not_mem_singleton.2 hab
#align finset.sup_indep.pairwise_disjoint Finset.SupIndep.pairwiseDisjoint
theorem SupIndep.le_sup_iff (hs : s.SupIndep f) (hts : t ⊆ s) (hi : i ∈ s) (hf : ∀ i, f i ≠ ⊥) :
f i ≤ t.sup f ↔ i ∈ t := by
refine ⟨fun h => ?_, le_sup⟩
by_contra hit
exact hf i (disjoint_self.1 <| (hs hts hi hit).mono_right h)
#align finset.sup_indep.le_sup_iff Finset.SupIndep.le_sup_iff
theorem supIndep_iff_disjoint_erase [DecidableEq ι] :
s.SupIndep f ↔ ∀ i ∈ s, Disjoint (f i) ((s.erase i).sup f) :=
⟨fun hs _ hi => hs (erase_subset _ _) hi (not_mem_erase _ _), fun hs _ ht i hi hit =>
(hs i hi).mono_right (sup_mono fun _ hj => mem_erase.2 ⟨ne_of_mem_of_not_mem hj hit, ht hj⟩)⟩
#align finset.sup_indep_iff_disjoint_erase Finset.supIndep_iff_disjoint_erase
theorem SupIndep.image [DecidableEq ι] {s : Finset ι'} {g : ι' → ι} (hs : s.SupIndep (f ∘ g)) :
(s.image g).SupIndep f := by
intro t ht i hi hit
rw [mem_image] at hi
obtain ⟨i, hi, rfl⟩ := hi
haveI : DecidableEq ι' := Classical.decEq _
suffices hts : t ⊆ (s.erase i).image g by
refine (supIndep_iff_disjoint_erase.1 hs i hi).mono_right ((sup_mono hts).trans ?_)
rw [sup_image]
rintro j hjt
obtain ⟨j, hj, rfl⟩ := mem_image.1 (ht hjt)
exact mem_image_of_mem _ (mem_erase.2 ⟨ne_of_apply_ne g (ne_of_mem_of_not_mem hjt hit), hj⟩)
#align finset.sup_indep.image Finset.SupIndep.image
theorem supIndep_map {s : Finset ι'} {g : ι' ↪ ι} : (s.map g).SupIndep f ↔ s.SupIndep (f ∘ g) := by
refine ⟨fun hs t ht i hi hit => ?_, fun hs => ?_⟩
· rw [← sup_map]
exact hs (map_subset_map.2 ht) ((mem_map' _).2 hi) (by rwa [mem_map'])
· classical
rw [map_eq_image]
exact hs.image
#align finset.sup_indep_map Finset.supIndep_map
@[simp]
theorem supIndep_pair [DecidableEq ι] {i j : ι} (hij : i ≠ j) :
({i, j} : Finset ι).SupIndep f ↔ Disjoint (f i) (f j) :=
⟨fun h => h.pairwiseDisjoint (by simp) (by simp) hij,
fun h => by
rw [supIndep_iff_disjoint_erase]
intro k hk
rw [Finset.mem_insert, Finset.mem_singleton] at hk
obtain rfl | rfl := hk
· convert h using 1
rw [Finset.erase_insert, Finset.sup_singleton]
simpa using hij
· convert h.symm using 1
have : ({i, k} : Finset ι).erase k = {i} := by
ext
rw [mem_erase, mem_insert, mem_singleton, mem_singleton, and_or_left, Ne,
not_and_self_iff, or_false_iff, and_iff_right_of_imp]
rintro rfl
exact hij
rw [this, Finset.sup_singleton]⟩
#align finset.sup_indep_pair Finset.supIndep_pair
| Mathlib/Order/SupIndep.lean | 151 | 154 | theorem supIndep_univ_bool (f : Bool → α) :
(Finset.univ : Finset Bool).SupIndep f ↔ Disjoint (f false) (f true) :=
haveI : true ≠ false := by | simp only [Ne, not_false_iff]
(supIndep_pair this).trans disjoint_comm
| 2 | 7.389056 | 1 | 1.6 | 5 | 1,742 |
import Mathlib.Data.Fin.VecNotation
import Mathlib.Logic.Embedding.Set
#align_import logic.equiv.fin from "leanprover-community/mathlib"@"bd835ef554f37ef9b804f0903089211f89cb370b"
assert_not_exists MonoidWithZero
universe u
variable {m n : ℕ}
def finZeroEquiv : Fin 0 ≃ Empty :=
Equiv.equivEmpty _
#align fin_zero_equiv finZeroEquiv
def finZeroEquiv' : Fin 0 ≃ PEmpty.{u} :=
Equiv.equivPEmpty _
#align fin_zero_equiv' finZeroEquiv'
def finOneEquiv : Fin 1 ≃ Unit :=
Equiv.equivPUnit _
#align fin_one_equiv finOneEquiv
def finTwoEquiv : Fin 2 ≃ Bool where
toFun := ![false, true]
invFun b := b.casesOn 0 1
left_inv := Fin.forall_fin_two.2 <| by simp
right_inv := Bool.forall_bool.2 <| by simp
#align fin_two_equiv finTwoEquiv
@[simps (config := .asFn)]
def piFinTwoEquiv (α : Fin 2 → Type u) : (∀ i, α i) ≃ α 0 × α 1 where
toFun f := (f 0, f 1)
invFun p := Fin.cons p.1 <| Fin.cons p.2 finZeroElim
left_inv _ := funext <| Fin.forall_fin_two.2 ⟨rfl, rfl⟩
right_inv := fun _ => rfl
#align pi_fin_two_equiv piFinTwoEquiv
#align pi_fin_two_equiv_symm_apply piFinTwoEquiv_symm_apply
#align pi_fin_two_equiv_apply piFinTwoEquiv_apply
theorem Fin.preimage_apply_01_prod {α : Fin 2 → Type u} (s : Set (α 0)) (t : Set (α 1)) :
(fun f : ∀ i, α i => (f 0, f 1)) ⁻¹' s ×ˢ t =
Set.pi Set.univ (Fin.cons s <| Fin.cons t finZeroElim) := by
ext f
simp [Fin.forall_fin_two]
#align fin.preimage_apply_01_prod Fin.preimage_apply_01_prod
theorem Fin.preimage_apply_01_prod' {α : Type u} (s t : Set α) :
(fun f : Fin 2 → α => (f 0, f 1)) ⁻¹' s ×ˢ t = Set.pi Set.univ ![s, t] :=
@Fin.preimage_apply_01_prod (fun _ => α) s t
#align fin.preimage_apply_01_prod' Fin.preimage_apply_01_prod'
@[simps! (config := .asFn)]
def prodEquivPiFinTwo (α β : Type u) : α × β ≃ ∀ i : Fin 2, ![α, β] i :=
(piFinTwoEquiv (Fin.cons α (Fin.cons β finZeroElim))).symm
#align prod_equiv_pi_fin_two prodEquivPiFinTwo
#align prod_equiv_pi_fin_two_apply prodEquivPiFinTwo_apply
#align prod_equiv_pi_fin_two_symm_apply prodEquivPiFinTwo_symm_apply
@[simps (config := .asFn)]
def finTwoArrowEquiv (α : Type*) : (Fin 2 → α) ≃ α × α :=
{ piFinTwoEquiv fun _ => α with invFun := fun x => ![x.1, x.2] }
#align fin_two_arrow_equiv finTwoArrowEquiv
#align fin_two_arrow_equiv_symm_apply finTwoArrowEquiv_symm_apply
#align fin_two_arrow_equiv_apply finTwoArrowEquiv_apply
def OrderIso.piFinTwoIso (α : Fin 2 → Type u) [∀ i, Preorder (α i)] : (∀ i, α i) ≃o α 0 × α 1 where
toEquiv := piFinTwoEquiv α
map_rel_iff' := Iff.symm Fin.forall_fin_two
#align order_iso.pi_fin_two_iso OrderIso.piFinTwoIso
def OrderIso.finTwoArrowIso (α : Type*) [Preorder α] : (Fin 2 → α) ≃o α × α :=
{ OrderIso.piFinTwoIso fun _ => α with toEquiv := finTwoArrowEquiv α }
#align order_iso.fin_two_arrow_iso OrderIso.finTwoArrowIso
def finSuccEquiv' (i : Fin (n + 1)) : Fin (n + 1) ≃ Option (Fin n) where
toFun := i.insertNth none some
invFun x := x.casesOn' i (Fin.succAbove i)
left_inv x := Fin.succAboveCases i (by simp) (fun j => by simp) x
right_inv x := by cases x <;> dsimp <;> simp
#align fin_succ_equiv' finSuccEquiv'
@[simp]
| Mathlib/Logic/Equiv/Fin.lean | 111 | 112 | theorem finSuccEquiv'_at (i : Fin (n + 1)) : (finSuccEquiv' i) i = none := by |
simp [finSuccEquiv']
| 1 | 2.718282 | 0 | 0.25 | 4 | 298 |
import Mathlib.Algebra.BigOperators.Group.List
import Mathlib.Algebra.Group.Action.Defs
import Mathlib.Algebra.Group.Units
#align_import algebra.free_monoid.basic from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec"
variable {α : Type*} {β : Type*} {γ : Type*} {M : Type*} [Monoid M] {N : Type*} [Monoid N]
@[to_additive "Free nonabelian additive monoid over a given alphabet"]
def FreeMonoid (α) := List α
#align free_monoid FreeMonoid
#align free_add_monoid FreeAddMonoid
namespace FreeMonoid
@[to_additive "The identity equivalence between `FreeAddMonoid α` and `List α`."]
def toList : FreeMonoid α ≃ List α := Equiv.refl _
#align free_monoid.to_list FreeMonoid.toList
#align free_add_monoid.to_list FreeAddMonoid.toList
@[to_additive "The identity equivalence between `List α` and `FreeAddMonoid α`."]
def ofList : List α ≃ FreeMonoid α := Equiv.refl _
#align free_monoid.of_list FreeMonoid.ofList
#align free_add_monoid.of_list FreeAddMonoid.ofList
@[to_additive (attr := simp)]
theorem toList_symm : (@toList α).symm = ofList := rfl
#align free_monoid.to_list_symm FreeMonoid.toList_symm
#align free_add_monoid.to_list_symm FreeAddMonoid.toList_symm
@[to_additive (attr := simp)]
theorem ofList_symm : (@ofList α).symm = toList := rfl
#align free_monoid.of_list_symm FreeMonoid.ofList_symm
#align free_add_monoid.of_list_symm FreeAddMonoid.ofList_symm
@[to_additive (attr := simp)]
theorem toList_ofList (l : List α) : toList (ofList l) = l := rfl
#align free_monoid.to_list_of_list FreeMonoid.toList_ofList
#align free_add_monoid.to_list_of_list FreeAddMonoid.toList_ofList
@[to_additive (attr := simp)]
theorem ofList_toList (xs : FreeMonoid α) : ofList (toList xs) = xs := rfl
#align free_monoid.of_list_to_list FreeMonoid.ofList_toList
#align free_add_monoid.of_list_to_list FreeAddMonoid.ofList_toList
@[to_additive (attr := simp)]
theorem toList_comp_ofList : @toList α ∘ ofList = id := rfl
#align free_monoid.to_list_comp_of_list FreeMonoid.toList_comp_ofList
#align free_add_monoid.to_list_comp_of_list FreeAddMonoid.toList_comp_ofList
@[to_additive (attr := simp)]
theorem ofList_comp_toList : @ofList α ∘ toList = id := rfl
#align free_monoid.of_list_comp_to_list FreeMonoid.ofList_comp_toList
#align free_add_monoid.of_list_comp_to_list FreeAddMonoid.ofList_comp_toList
@[to_additive]
instance : CancelMonoid (FreeMonoid α) where
one := ofList []
mul x y := ofList (toList x ++ toList y)
mul_one := List.append_nil
one_mul := List.nil_append
mul_assoc := List.append_assoc
mul_left_cancel _ _ _ := List.append_cancel_left
mul_right_cancel _ _ _ := List.append_cancel_right
@[to_additive]
instance : Inhabited (FreeMonoid α) := ⟨1⟩
@[to_additive (attr := simp)]
theorem toList_one : toList (1 : FreeMonoid α) = [] := rfl
#align free_monoid.to_list_one FreeMonoid.toList_one
#align free_add_monoid.to_list_zero FreeAddMonoid.toList_zero
@[to_additive (attr := simp)]
theorem ofList_nil : ofList ([] : List α) = 1 := rfl
#align free_monoid.of_list_nil FreeMonoid.ofList_nil
#align free_add_monoid.of_list_nil FreeAddMonoid.ofList_nil
@[to_additive (attr := simp)]
theorem toList_mul (xs ys : FreeMonoid α) : toList (xs * ys) = toList xs ++ toList ys := rfl
#align free_monoid.to_list_mul FreeMonoid.toList_mul
#align free_add_monoid.to_list_add FreeAddMonoid.toList_add
@[to_additive (attr := simp)]
theorem ofList_append (xs ys : List α) : ofList (xs ++ ys) = ofList xs * ofList ys := rfl
#align free_monoid.of_list_append FreeMonoid.ofList_append
#align free_add_monoid.of_list_append FreeAddMonoid.ofList_append
@[to_additive (attr := simp)]
| Mathlib/Algebra/FreeMonoid/Basic.lean | 111 | 112 | theorem toList_prod (xs : List (FreeMonoid α)) : toList xs.prod = (xs.map toList).join := by |
induction xs <;> simp [*, List.join]
| 1 | 2.718282 | 0 | 0 | 1 | 61 |
import Mathlib.Data.Complex.Module
import Mathlib.Data.Complex.Order
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.RealVectorSpace
#align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
assert_not_exists Absorbs
noncomputable section
namespace Complex
variable {z : ℂ}
open ComplexConjugate Topology Filter
instance : Norm ℂ :=
⟨abs⟩
@[simp]
theorem norm_eq_abs (z : ℂ) : ‖z‖ = abs z :=
rfl
#align complex.norm_eq_abs Complex.norm_eq_abs
lemma norm_I : ‖I‖ = 1 := abs_I
theorem norm_exp_ofReal_mul_I (t : ℝ) : ‖exp (t * I)‖ = 1 := by
simp only [norm_eq_abs, abs_exp_ofReal_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.norm_exp_of_real_mul_I Complex.norm_exp_ofReal_mul_I
instance instNormedAddCommGroup : NormedAddCommGroup ℂ :=
AddGroupNorm.toNormedAddCommGroup
{ abs with
map_zero' := map_zero abs
neg' := abs.map_neg
eq_zero_of_map_eq_zero' := fun _ => abs.eq_zero.1 }
instance : NormedField ℂ where
dist_eq _ _ := rfl
norm_mul' := map_mul abs
instance : DenselyNormedField ℂ where
lt_norm_lt r₁ r₂ h₀ hr :=
let ⟨x, h⟩ := exists_between hr
⟨x, by rwa [norm_eq_abs, abs_ofReal, abs_of_pos (h₀.trans_lt h.1)]⟩
instance {R : Type*} [NormedField R] [NormedAlgebra R ℝ] : NormedAlgebra R ℂ where
norm_smul_le r x := by
rw [← algebraMap_smul ℝ r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, ← Real.norm_eq_abs,
norm_algebraMap']
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℂ E]
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedSpace.complexToReal : NormedSpace ℝ E :=
NormedSpace.restrictScalars ℝ ℂ E
#align normed_space.complex_to_real NormedSpace.complexToReal
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedAlgebra.complexToReal {A : Type*} [SeminormedRing A]
[NormedAlgebra ℂ A] : NormedAlgebra ℝ A :=
NormedAlgebra.restrictScalars ℝ ℂ A
theorem dist_eq (z w : ℂ) : dist z w = abs (z - w) :=
rfl
#align complex.dist_eq Complex.dist_eq
theorem dist_eq_re_im (z w : ℂ) : dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by
rw [sq, sq]
rfl
#align complex.dist_eq_re_im Complex.dist_eq_re_im
@[simp]
theorem dist_mk (x₁ y₁ x₂ y₂ : ℝ) :
dist (mk x₁ y₁) (mk x₂ y₂) = √((x₁ - x₂) ^ 2 + (y₁ - y₂) ^ 2) :=
dist_eq_re_im _ _
#align complex.dist_mk Complex.dist_mk
| Mathlib/Analysis/Complex/Basic.lean | 113 | 114 | theorem dist_of_re_eq {z w : ℂ} (h : z.re = w.re) : dist z w = dist z.im w.im := by |
rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq]
| 1 | 2.718282 | 0 | 0.222222 | 9 | 282 |
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Data.Finset.Sym
import Mathlib.Data.Matrix.Basic
#align_import combinatorics.simple_graph.inc_matrix from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496"
open Finset Matrix SimpleGraph Sym2
open Matrix
namespace SimpleGraph
variable (R : Type*) {α : Type*} (G : SimpleGraph α)
noncomputable def incMatrix [Zero R] [One R] : Matrix α (Sym2 α) R := fun a =>
(G.incidenceSet a).indicator 1
#align simple_graph.inc_matrix SimpleGraph.incMatrix
variable {R}
theorem incMatrix_apply [Zero R] [One R] {a : α} {e : Sym2 α} :
G.incMatrix R a e = (G.incidenceSet a).indicator 1 e :=
rfl
#align simple_graph.inc_matrix_apply SimpleGraph.incMatrix_apply
theorem incMatrix_apply' [Zero R] [One R] [DecidableEq α] [DecidableRel G.Adj] {a : α}
{e : Sym2 α} : G.incMatrix R a e = if e ∈ G.incidenceSet a then 1 else 0 := by
unfold incMatrix Set.indicator
convert rfl
#align simple_graph.inc_matrix_apply' SimpleGraph.incMatrix_apply'
section MulZeroOneClass
variable [MulZeroOneClass R] {a b : α} {e : Sym2 α}
theorem incMatrix_apply_mul_incMatrix_apply : G.incMatrix R a e * G.incMatrix R b e =
(G.incidenceSet a ∩ G.incidenceSet b).indicator 1 e := by
classical simp only [incMatrix, Set.indicator_apply, ite_zero_mul_ite_zero, Pi.one_apply, mul_one,
Set.mem_inter_iff]
#align simple_graph.inc_matrix_apply_mul_inc_matrix_apply SimpleGraph.incMatrix_apply_mul_incMatrix_apply
theorem incMatrix_apply_mul_incMatrix_apply_of_not_adj (hab : a ≠ b) (h : ¬G.Adj a b) :
G.incMatrix R a e * G.incMatrix R b e = 0 := by
rw [incMatrix_apply_mul_incMatrix_apply, Set.indicator_of_not_mem]
rw [G.incidenceSet_inter_incidenceSet_of_not_adj h hab]
exact Set.not_mem_empty e
#align simple_graph.inc_matrix_apply_mul_inc_matrix_apply_of_not_adj SimpleGraph.incMatrix_apply_mul_incMatrix_apply_of_not_adj
theorem incMatrix_of_not_mem_incidenceSet (h : e ∉ G.incidenceSet a) : G.incMatrix R a e = 0 := by
rw [incMatrix_apply, Set.indicator_of_not_mem h]
#align simple_graph.inc_matrix_of_not_mem_incidence_set SimpleGraph.incMatrix_of_not_mem_incidenceSet
theorem incMatrix_of_mem_incidenceSet (h : e ∈ G.incidenceSet a) : G.incMatrix R a e = 1 := by
rw [incMatrix_apply, Set.indicator_of_mem h, Pi.one_apply]
#align simple_graph.inc_matrix_of_mem_incidence_set SimpleGraph.incMatrix_of_mem_incidenceSet
variable [Nontrivial R]
| Mathlib/Combinatorics/SimpleGraph/IncMatrix.lean | 102 | 103 | theorem incMatrix_apply_eq_zero_iff : G.incMatrix R a e = 0 ↔ e ∉ G.incidenceSet a := by |
simp only [incMatrix_apply, Set.indicator_apply_eq_zero, Pi.one_apply, one_ne_zero]
| 1 | 2.718282 | 0 | 0.9 | 10 | 784 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
namespace Nat
theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) :
d = a.gcd b :=
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
#align nat.gcd_greatest Nat.gcd_greatest
@[simp]
theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by
simp [gcd_rec m (n + k * m), gcd_rec m n]
#align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right
@[simp]
theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by
simp [gcd_rec m (n + m * k), gcd_rec m n]
#align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right
@[simp]
theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right
@[simp]
theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right
@[simp]
theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_right_right, gcd_comm]
#align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left
@[simp]
theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_left_right, gcd_comm]
#align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left
@[simp]
theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_right_add_right, gcd_comm]
#align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left
@[simp]
theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_left_add_right, gcd_comm]
#align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left
@[simp]
theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n :=
Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1)
#align nat.gcd_add_self_right Nat.gcd_add_self_right
@[simp]
theorem gcd_add_self_left (m n : ℕ) : gcd (m + n) n = gcd m n := by
rw [gcd_comm, gcd_add_self_right, gcd_comm]
#align nat.gcd_add_self_left Nat.gcd_add_self_left
@[simp]
theorem gcd_self_add_left (m n : ℕ) : gcd (m + n) m = gcd n m := by rw [add_comm, gcd_add_self_left]
#align nat.gcd_self_add_left Nat.gcd_self_add_left
@[simp]
theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by
rw [add_comm, gcd_add_self_right]
#align nat.gcd_self_add_right Nat.gcd_self_add_right
@[simp]
theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by
calc
gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m]
_ = gcd n m := by rw [Nat.sub_add_cancel h]
@[simp]
theorem gcd_sub_self_right {m n : ℕ} (h : m ≤ n) : gcd m (n - m) = gcd m n := by
rw [gcd_comm, gcd_sub_self_left h, gcd_comm]
@[simp]
theorem gcd_self_sub_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) n = gcd m n := by
have := Nat.sub_add_cancel h
rw [gcd_comm m n, ← this, gcd_add_self_left (n - m) m]
have : gcd (n - m) n = gcd (n - m) m := by
nth_rw 2 [← Nat.add_sub_cancel' h]
rw [gcd_add_self_right, gcd_comm]
convert this
@[simp]
| Mathlib/Data/Nat/GCD/Basic.lean | 115 | 116 | theorem gcd_self_sub_right {m n : ℕ} (h : m ≤ n) : gcd n (n - m) = gcd n m := by |
rw [gcd_comm, gcd_self_sub_left h, gcd_comm]
| 1 | 2.718282 | 0 | 0.352941 | 17 | 375 |
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition
import Mathlib.LinearAlgebra.FreeModule.Basic
#align_import linear_algebra.free_module.pid from "leanprover-community/mathlib"@"d87199d51218d36a0a42c66c82d147b5a7ff87b3"
universe u v
section Ring
variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M]
variable {ι : Type*} (b : Basis ι R M)
open Submodule.IsPrincipal Submodule
theorem eq_bot_of_generator_maximal_map_eq_zero (b : Basis ι R M) {N : Submodule R M}
{ϕ : M →ₗ[R] R} (hϕ : ∀ ψ : M →ₗ[R] R, ¬N.map ϕ < N.map ψ) [(N.map ϕ).IsPrincipal]
(hgen : generator (N.map ϕ) = (0 : R)) : N = ⊥ := by
rw [Submodule.eq_bot_iff]
intro x hx
refine b.ext_elem fun i ↦ ?_
rw [(eq_bot_iff_generator_eq_zero _).mpr hgen] at hϕ
rw [LinearEquiv.map_zero, Finsupp.zero_apply]
exact
(Submodule.eq_bot_iff _).mp (not_bot_lt_iff.1 <| hϕ (Finsupp.lapply i ∘ₗ ↑b.repr)) _
⟨x, hx, rfl⟩
#align eq_bot_of_generator_maximal_map_eq_zero eq_bot_of_generator_maximal_map_eq_zero
| Mathlib/LinearAlgebra/FreeModule/PID.lean | 72 | 81 | theorem eq_bot_of_generator_maximal_submoduleImage_eq_zero {N O : Submodule R M} (b : Basis ι R O)
(hNO : N ≤ O) {ϕ : O →ₗ[R] R} (hϕ : ∀ ψ : O →ₗ[R] R, ¬ϕ.submoduleImage N < ψ.submoduleImage N)
[(ϕ.submoduleImage N).IsPrincipal] (hgen : generator (ϕ.submoduleImage N) = 0) : N = ⊥ := by |
rw [Submodule.eq_bot_iff]
intro x hx
refine (mk_eq_zero _ _).mp (show (⟨x, hNO hx⟩ : O) = 0 from b.ext_elem fun i ↦ ?_)
rw [(eq_bot_iff_generator_eq_zero _).mpr hgen] at hϕ
rw [LinearEquiv.map_zero, Finsupp.zero_apply]
refine (Submodule.eq_bot_iff _).mp (not_bot_lt_iff.1 <| hϕ (Finsupp.lapply i ∘ₗ ↑b.repr)) _ ?_
exact (LinearMap.mem_submoduleImage_of_le hNO).mpr ⟨x, hx, rfl⟩
| 7 | 1,096.633158 | 2 | 2 | 3 | 2,115 |
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
-- Well-founded definitions are now irreducible by default;
-- as this was implemented before this change,
-- we just set it back to semireducible to avoid needing to change any proofs.
@[semireducible] noncomputable def T : ℤ → R[X]
| 0 => 1
| 1 => X
| (n : ℕ) + 2 => 2 * X * T (n + 1) - T n
| -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1)
termination_by n => Int.natAbs n + Int.natAbs (n - 1)
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[elab_as_elim]
protected theorem induct (motive : ℤ → Prop)
(zero : motive 0)
(one : motive 1)
(add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2))
(neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) :
∀ (a : ℤ), motive a :=
T.induct Unit motive zero one add_two fun n hn hnm => by
simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm
@[simp]
theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n
| (k : ℕ) => T.eq_3 R k
| -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by
linear_combination (norm := ring_nf) T_add_two R (n - 1)
| Mathlib/RingTheory/Polynomial/Chebyshev.lean | 93 | 94 | theorem T_sub_two (n : ℤ) : T R (n - 2) = 2 * X * T R (n - 1) - T R n := by |
linear_combination (norm := ring_nf) T_add_two R (n - 2)
| 1 | 2.718282 | 0 | 0.166667 | 12 | 265 |
import Mathlib.Geometry.Manifold.ContMDiff.Defs
open Set Filter Function
open scoped Topology Manifold
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
-- declare a smooth manifold `M` over the pair `(E, H)`.
{E : Type*}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
[SmoothManifoldWithCorners I M]
-- declare a smooth manifold `M'` over the pair `(E', H')`.
{E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M']
-- declare a manifold `M''` over the pair `(E'', H'')`.
{E'' : Type*}
[NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H'']
{I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
-- declare functions, sets, points and smoothness indices
{e : PartialHomeomorph M H}
{e' : PartialHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
variable {I I'}
section id
variable {c : M'}
theorem contMDiff_const : ContMDiff I I' n fun _ : M => c := by
intro x
refine ⟨continuousWithinAt_const, ?_⟩
simp only [ContDiffWithinAtProp, (· ∘ ·)]
exact contDiffWithinAt_const
#align cont_mdiff_const contMDiff_const
@[to_additive]
| Mathlib/Geometry/Manifold/ContMDiff/Basic.lean | 252 | 253 | theorem contMDiff_one [One M'] : ContMDiff I I' n (1 : M → M') := by |
simp only [Pi.one_def, contMDiff_const]
| 1 | 2.718282 | 0 | 0.833333 | 6 | 725 |
import Mathlib.LinearAlgebra.AffineSpace.Basis
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
#align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Affine Matrix
open Set
universe u₁ u₂ u₃ u₄
variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄}
variable [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P)
noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k :=
fun i j => b.coord j (q i)
#align affine_basis.to_matrix AffineBasis.toMatrix
@[simp]
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
b.toMatrix q i j = b.coord j (q i) := rfl
#align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply
@[simp]
theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by
ext i j
rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply]
#align affine_basis.to_matrix_self AffineBasis.toMatrix_self
variable {ι' : Type*}
| Mathlib/LinearAlgebra/AffineSpace/Matrix.lean | 55 | 56 | theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1 := by |
simp
| 1 | 2.718282 | 0 | 1.428571 | 7 | 1,512 |
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.NaturalTransformation
import Mathlib.CategoryTheory.Monoidal.Opposite
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.CommSq
#align_import category_theory.monoidal.braided from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44"
open CategoryTheory MonoidalCategory
universe v v₁ v₂ v₃ u u₁ u₂ u₃
namespace CategoryTheory
class BraidedCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where
braiding : ∀ X Y : C, X ⊗ Y ≅ Y ⊗ X
braiding_naturality_right :
∀ (X : C) {Y Z : C} (f : Y ⟶ Z),
X ◁ f ≫ (braiding X Z).hom = (braiding X Y).hom ≫ f ▷ X := by
aesop_cat
braiding_naturality_left :
∀ {X Y : C} (f : X ⟶ Y) (Z : C),
f ▷ Z ≫ (braiding Y Z).hom = (braiding X Z).hom ≫ Z ◁ f := by
aesop_cat
hexagon_forward :
∀ X Y Z : C,
(α_ X Y Z).hom ≫ (braiding X (Y ⊗ Z)).hom ≫ (α_ Y Z X).hom =
((braiding X Y).hom ▷ Z) ≫ (α_ Y X Z).hom ≫ (Y ◁ (braiding X Z).hom) := by
aesop_cat
hexagon_reverse :
∀ X Y Z : C,
(α_ X Y Z).inv ≫ (braiding (X ⊗ Y) Z).hom ≫ (α_ Z X Y).inv =
(X ◁ (braiding Y Z).hom) ≫ (α_ X Z Y).inv ≫ ((braiding X Z).hom ▷ Y) := by
aesop_cat
#align category_theory.braided_category CategoryTheory.BraidedCategory
attribute [reassoc (attr := simp)]
BraidedCategory.braiding_naturality_left
BraidedCategory.braiding_naturality_right
attribute [reassoc] BraidedCategory.hexagon_forward BraidedCategory.hexagon_reverse
open Category
open MonoidalCategory
open BraidedCategory
@[inherit_doc]
notation "β_" => BraidedCategory.braiding
namespace BraidedCategory
variable {C : Type u} [Category.{v} C] [MonoidalCategory.{v} C] [BraidedCategory.{v} C]
@[simp, reassoc]
theorem braiding_tensor_left (X Y Z : C) :
(β_ (X ⊗ Y) Z).hom =
(α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫
(β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom := by
apply (cancel_epi (α_ X Y Z).inv).1
apply (cancel_mono (α_ Z X Y).inv).1
simp [hexagon_reverse]
@[simp, reassoc]
theorem braiding_tensor_right (X Y Z : C) :
(β_ X (Y ⊗ Z)).hom =
(α_ X Y Z).inv ≫ (β_ X Y).hom ▷ Z ≫ (α_ Y X Z).hom ≫
Y ◁ (β_ X Z).hom ≫ (α_ Y Z X).inv := by
apply (cancel_epi (α_ X Y Z).hom).1
apply (cancel_mono (α_ Y Z X).hom).1
simp [hexagon_forward]
@[simp, reassoc]
theorem braiding_inv_tensor_left (X Y Z : C) :
(β_ (X ⊗ Y) Z).inv =
(α_ Z X Y).inv ≫ (β_ X Z).inv ▷ Y ≫ (α_ X Z Y).hom ≫
X ◁ (β_ Y Z).inv ≫ (α_ X Y Z).inv :=
eq_of_inv_eq_inv (by simp)
@[simp, reassoc]
theorem braiding_inv_tensor_right (X Y Z : C) :
(β_ X (Y ⊗ Z)).inv =
(α_ Y Z X).hom ≫ Y ◁ (β_ X Z).inv ≫ (α_ Y X Z).inv ≫
(β_ X Y).inv ▷ Z ≫ (α_ X Y Z).hom :=
eq_of_inv_eq_inv (by simp)
@[reassoc (attr := simp)]
theorem braiding_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
(f ⊗ g) ≫ (braiding Y Y').hom = (braiding X X').hom ≫ (g ⊗ f) := by
rw [tensorHom_def' f g, tensorHom_def g f]
simp_rw [Category.assoc, braiding_naturality_left, braiding_naturality_right_assoc]
@[reassoc (attr := simp)]
theorem braiding_inv_naturality_right (X : C) {Y Z : C} (f : Y ⟶ Z) :
X ◁ f ≫ (β_ Z X).inv = (β_ Y X).inv ≫ f ▷ X :=
CommSq.w <| .vert_inv <| .mk <| braiding_naturality_left f X
@[reassoc (attr := simp)]
theorem braiding_inv_naturality_left {X Y : C} (f : X ⟶ Y) (Z : C) :
f ▷ Z ≫ (β_ Z Y).inv = (β_ Z X).inv ≫ Z ◁ f :=
CommSq.w <| .vert_inv <| .mk <| braiding_naturality_right Z f
@[reassoc (attr := simp)]
theorem braiding_inv_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
(f ⊗ g) ≫ (β_ Y' Y).inv = (β_ X' X).inv ≫ (g ⊗ f) :=
CommSq.w <| .vert_inv <| .mk <| braiding_naturality g f
@[reassoc]
| Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean | 146 | 153 | theorem yang_baxter (X Y Z : C) :
(α_ X Y Z).inv ≫ (β_ X Y).hom ▷ Z ≫ (α_ Y X Z).hom ≫
Y ◁ (β_ X Z).hom ≫ (α_ Y Z X).inv ≫ (β_ Y Z).hom ▷ X ≫ (α_ Z Y X).hom =
X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫
(α_ Z X Y).hom ≫ Z ◁ (β_ X Y).hom := by |
rw [← braiding_tensor_right_assoc X Y Z, ← cancel_mono (α_ Z Y X).inv]
repeat rw [assoc]
rw [Iso.hom_inv_id, comp_id, ← braiding_naturality_right, braiding_tensor_right]
| 3 | 20.085537 | 1 | 0.8 | 5 | 706 |
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Tactic.GCongr
#align_import order.filter.archimedean from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {α R : Type*}
open Filter Set Function
@[simp]
theorem Nat.comap_cast_atTop [StrictOrderedSemiring R] [Archimedean R] :
comap ((↑) : ℕ → R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Nat.cast_le) exists_nat_ge
#align nat.comap_coe_at_top Nat.comap_cast_atTop
theorem tendsto_natCast_atTop_iff [StrictOrderedSemiring R] [Archimedean R] {f : α → ℕ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop :=
tendsto_atTop_embedding (fun _ _ => Nat.cast_le) exists_nat_ge
#align tendsto_coe_nat_at_top_iff tendsto_natCast_atTop_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_iff := tendsto_natCast_atTop_iff
theorem tendsto_natCast_atTop_atTop [OrderedSemiring R] [Archimedean R] :
Tendsto ((↑) : ℕ → R) atTop atTop :=
Nat.mono_cast.tendsto_atTop_atTop exists_nat_ge
#align tendsto_coe_nat_at_top_at_top tendsto_natCast_atTop_atTop
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_atTop := tendsto_natCast_atTop_atTop
theorem Filter.Eventually.natCast_atTop [OrderedSemiring R] [Archimedean R] {p : R → Prop}
(h : ∀ᶠ (x:R) in atTop, p x) : ∀ᶠ (n:ℕ) in atTop, p n :=
tendsto_natCast_atTop_atTop.eventually h
@[deprecated (since := "2024-04-17")]
alias Filter.Eventually.nat_cast_atTop := Filter.Eventually.natCast_atTop
@[simp] theorem Int.comap_cast_atTop [StrictOrderedRing R] [Archimedean R] :
comap ((↑) : ℤ → R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Int.cast_le) fun r =>
let ⟨n, hn⟩ := exists_nat_ge r; ⟨n, mod_cast hn⟩
#align int.comap_coe_at_top Int.comap_cast_atTop
@[simp]
theorem Int.comap_cast_atBot [StrictOrderedRing R] [Archimedean R] :
comap ((↑) : ℤ → R) atBot = atBot :=
comap_embedding_atBot (fun _ _ => Int.cast_le) fun r =>
let ⟨n, hn⟩ := exists_nat_ge (-r)
⟨-n, by simpa [neg_le] using hn⟩
#align int.comap_coe_at_bot Int.comap_cast_atBot
theorem tendsto_intCast_atTop_iff [StrictOrderedRing R] [Archimedean R] {f : α → ℤ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop := by
rw [← @Int.comap_cast_atTop R, tendsto_comap_iff]; rfl
#align tendsto_coe_int_at_top_iff tendsto_intCast_atTop_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_int_cast_atTop_iff := tendsto_intCast_atTop_iff
| Mathlib/Order/Filter/Archimedean.lean | 77 | 79 | theorem tendsto_intCast_atBot_iff [StrictOrderedRing R] [Archimedean R] {f : α → ℤ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atBot ↔ Tendsto f l atBot := by |
rw [← @Int.comap_cast_atBot R, tendsto_comap_iff]; rfl
| 1 | 2.718282 | 0 | 0 | 4 | 221 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
theorem aeval_T (x : A) (n : ℤ) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, eval₂_eq_eval_map, map_T]
#align polynomial.chebyshev.aeval_T Polynomial.Chebyshev.aeval_T
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 34 | 35 | theorem aeval_U (x : A) (n : ℤ) : aeval x (U R n) = (U A n).eval x := by |
rw [aeval_def, eval₂_eq_eval_map, map_U]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 568 |
import Mathlib.Algebra.MvPolynomial.Derivation
import Mathlib.Algebra.MvPolynomial.Variables
#align_import data.mv_polynomial.pderiv from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
universe u v
namespace MvPolynomial
open Set Function Finsupp
variable {R : Type u} {σ : Type v} {a a' a₁ a₂ : R} {s : σ →₀ ℕ}
section PDeriv
variable [CommSemiring R]
def pderiv (i : σ) : Derivation R (MvPolynomial σ R) (MvPolynomial σ R) :=
letI := Classical.decEq σ
mkDerivation R <| Pi.single i 1
#align mv_polynomial.pderiv MvPolynomial.pderiv
theorem pderiv_def [DecidableEq σ] (i : σ) : pderiv i = mkDerivation R (Pi.single i 1) := by
unfold pderiv; congr!
#align mv_polynomial.pderiv_def MvPolynomial.pderiv_def
@[simp]
theorem pderiv_monomial {i : σ} :
pderiv i (monomial s a) = monomial (s - single i 1) (a * s i) := by
classical
simp only [pderiv_def, mkDerivation_monomial, Finsupp.smul_sum, smul_eq_mul, ← smul_mul_assoc,
← (monomial _).map_smul]
refine (Finset.sum_eq_single i (fun j _ hne => ?_) fun hi => ?_).trans ?_
· simp [Pi.single_eq_of_ne hne]
· rw [Finsupp.not_mem_support_iff] at hi; simp [hi]
· simp
#align mv_polynomial.pderiv_monomial MvPolynomial.pderiv_monomial
theorem pderiv_C {i : σ} : pderiv i (C a) = 0 :=
derivation_C _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_C MvPolynomial.pderiv_C
theorem pderiv_one {i : σ} : pderiv i (1 : MvPolynomial σ R) = 0 := pderiv_C
#align mv_polynomial.pderiv_one MvPolynomial.pderiv_one
@[simp]
theorem pderiv_X [DecidableEq σ] (i j : σ) :
pderiv i (X j : MvPolynomial σ R) = Pi.single (f := fun j => _) i 1 j := by
rw [pderiv_def, mkDerivation_X]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_X MvPolynomial.pderiv_X
@[simp]
theorem pderiv_X_self (i : σ) : pderiv i (X i : MvPolynomial σ R) = 1 := by classical simp
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_X_self MvPolynomial.pderiv_X_self
@[simp]
theorem pderiv_X_of_ne {i j : σ} (h : j ≠ i) : pderiv i (X j : MvPolynomial σ R) = 0 := by
classical simp [h]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.pderiv_X_of_ne MvPolynomial.pderiv_X_of_ne
theorem pderiv_eq_zero_of_not_mem_vars {i : σ} {f : MvPolynomial σ R} (h : i ∉ f.vars) :
pderiv i f = 0 :=
derivation_eq_zero_of_forall_mem_vars fun _ hj => pderiv_X_of_ne <| ne_of_mem_of_not_mem hj h
#align mv_polynomial.pderiv_eq_zero_of_not_mem_vars MvPolynomial.pderiv_eq_zero_of_not_mem_vars
| Mathlib/Algebra/MvPolynomial/PDeriv.lean | 111 | 112 | theorem pderiv_monomial_single {i : σ} {n : ℕ} : pderiv i (monomial (single i n) a) =
monomial (single i (n - 1)) (a * n) := by | simp
| 1 | 2.718282 | 0 | 0.222222 | 9 | 283 |
import Mathlib.Algebra.MonoidAlgebra.Support
import Mathlib.Algebra.Polynomial.Basic
import Mathlib.Algebra.Regular.Basic
import Mathlib.Data.Nat.Choose.Sum
#align_import data.polynomial.coeff from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c"
set_option linter.uppercaseLean3 false
noncomputable section
open Finsupp Finset AddMonoidAlgebra
open Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ}
variable [Semiring R] {p q r : R[X]}
section Coeff
@[simp]
theorem coeff_add (p q : R[X]) (n : ℕ) : coeff (p + q) n = coeff p n + coeff q n := by
rcases p with ⟨⟩
rcases q with ⟨⟩
simp_rw [← ofFinsupp_add, coeff]
exact Finsupp.add_apply _ _ _
#align polynomial.coeff_add Polynomial.coeff_add
set_option linter.deprecated false in
@[simp]
| Mathlib/Algebra/Polynomial/Coeff.lean | 49 | 49 | theorem coeff_bit0 (p : R[X]) (n : ℕ) : coeff (bit0 p) n = bit0 (coeff p n) := by | simp [bit0]
| 1 | 2.718282 | 0 | 1.125 | 8 | 1,203 |
import Mathlib.Data.List.Chain
#align_import data.list.destutter from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
variable {α : Type*} (l : List α) (R : α → α → Prop) [DecidableRel R] {a b : α}
namespace List
@[simp]
theorem destutter'_nil : destutter' R a [] = [a] :=
rfl
#align list.destutter'_nil List.destutter'_nil
theorem destutter'_cons :
(b :: l).destutter' R a = if R a b then a :: destutter' R b l else destutter' R a l :=
rfl
#align list.destutter'_cons List.destutter'_cons
variable {R}
@[simp]
theorem destutter'_cons_pos (h : R b a) : (a :: l).destutter' R b = b :: l.destutter' R a := by
rw [destutter', if_pos h]
#align list.destutter'_cons_pos List.destutter'_cons_pos
@[simp]
| Mathlib/Data/List/Destutter.lean | 53 | 54 | theorem destutter'_cons_neg (h : ¬R b a) : (a :: l).destutter' R b = l.destutter' R b := by |
rw [destutter', if_neg h]
| 1 | 2.718282 | 0 | 1.142857 | 7 | 1,214 |
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le
#align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp
theorem ker_sup_ker_le_ker_comp_of_commute {f g : M →ₗ[R] M} (h : Commute f g) :
ker f ⊔ ker g ≤ ker (f ∘ₗ g) := by
refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩
rw [← mul_eq_comp, h.eq, mul_eq_comp]
exact ker_le_ker_comp f g
@[simp]
theorem ker_le_comap {p : Submodule R₂ M₂} (f : M →ₛₗ[τ₁₂] M₂) :
ker f ≤ p.comap f :=
fun x hx ↦ by simp [mem_ker.mp hx]
theorem disjoint_ker {f : F} {p : Submodule R M} :
Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0 := by
simp [disjoint_def]
#align linear_map.disjoint_ker LinearMap.disjoint_ker
theorem ker_eq_bot' {f : F} : ker f = ⊥ ↔ ∀ m, f m = 0 → m = 0 := by
simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊤)
#align linear_map.ker_eq_bot' LinearMap.ker_eq_bot'
theorem ker_eq_bot_of_inverse {τ₂₁ : R₂ →+* R} [RingHomInvPair τ₁₂ τ₂₁] {f : M →ₛₗ[τ₁₂] M₂}
{g : M₂ →ₛₗ[τ₂₁] M} (h : (g.comp f : M →ₗ[R] M) = id) : ker f = ⊥ :=
ker_eq_bot'.2 fun m hm => by rw [← id_apply (R := R) m, ← h, comp_apply, hm, g.map_zero]
#align linear_map.ker_eq_bot_of_inverse LinearMap.ker_eq_bot_of_inverse
theorem le_ker_iff_map [RingHomSurjective τ₁₂] {f : F} {p : Submodule R M} :
p ≤ ker f ↔ map f p = ⊥ := by rw [ker, eq_bot_iff, map_le_iff_le_comap]
#align linear_map.le_ker_iff_map LinearMap.le_ker_iff_map
| Mathlib/Algebra/Module/Submodule/Ker.lean | 125 | 126 | theorem ker_codRestrict {τ₂₁ : R₂ →+* R} (p : Submodule R M) (f : M₂ →ₛₗ[τ₂₁] M) (hf) :
ker (codRestrict p f hf) = ker f := by | rw [ker, comap_codRestrict, Submodule.map_bot]; rfl
| 1 | 2.718282 | 0 | 0.142857 | 7 | 255 |
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]
| Mathlib/Data/Finset/Option.lean | 87 | 87 | theorem card_insertNone (s : Finset α) : s.insertNone.card = s.card + 1 := by | simp [insertNone]
| 1 | 2.718282 | 0 | 0 | 5 | 120 |
import Mathlib.FieldTheory.Finite.Basic
import Mathlib.Order.Filter.Cofinite
#align_import number_theory.fermat_psp from "leanprover-community/mathlib"@"c0439b4877c24a117bfdd9e32faf62eee9b115eb"
namespace Nat
def ProbablePrime (n b : ℕ) : Prop :=
n ∣ b ^ (n - 1) - 1
#align fermat_psp.probable_prime Nat.ProbablePrime
def FermatPsp (n b : ℕ) : Prop :=
ProbablePrime n b ∧ ¬n.Prime ∧ 1 < n
#align fermat_psp Nat.FermatPsp
instance decidableProbablePrime (n b : ℕ) : Decidable (ProbablePrime n b) :=
Nat.decidable_dvd _ _
#align fermat_psp.decidable_probable_prime Nat.decidableProbablePrime
instance decidablePsp (n b : ℕ) : Decidable (FermatPsp n b) :=
And.decidable
#align fermat_psp.decidable_psp Nat.decidablePsp
| Mathlib/NumberTheory/FermatPsp.lean | 75 | 99 | theorem coprime_of_probablePrime {n b : ℕ} (h : ProbablePrime n b) (h₁ : 1 ≤ n) (h₂ : 1 ≤ b) :
Nat.Coprime n b := by |
by_cases h₃ : 2 ≤ n
· -- To prove that `n` is coprime with `b`, we need to show that for all prime factors of `n`,
-- we can derive a contradiction if `n` divides `b`.
apply Nat.coprime_of_dvd
-- If `k` is a prime number that divides both `n` and `b`, then we know that `n = m * k` and
-- `b = j * k` for some natural numbers `m` and `j`. We substitute these into the hypothesis.
rintro k hk ⟨m, rfl⟩ ⟨j, rfl⟩
-- Because prime numbers do not divide 1, it suffices to show that `k ∣ 1` to prove a
-- contradiction
apply Nat.Prime.not_dvd_one hk
-- Since `n` divides `b ^ (n - 1) - 1`, `k` also divides `b ^ (n - 1) - 1`
replace h := dvd_of_mul_right_dvd h
-- Because `k` divides `b ^ (n - 1) - 1`, if we can show that `k` also divides `b ^ (n - 1)`,
-- then we know `k` divides 1.
rw [Nat.dvd_add_iff_right h, Nat.sub_add_cancel (Nat.one_le_pow _ _ h₂)]
-- Since `k` divides `b`, `k` also divides any power of `b` except `b ^ 0`. Therefore, it
-- suffices to show that `n - 1` isn't zero. However, we know that `n - 1` isn't zero because we
-- assumed `2 ≤ n` when doing `by_cases`.
refine dvd_of_mul_right_dvd (dvd_pow_self (k * j) ?_)
omega
-- If `n = 1`, then it follows trivially that `n` is coprime with `b`.
· rw [show n = 1 by omega]
norm_num
| 23 | 9,744,803,446.248903 | 2 | 1.5 | 4 | 1,688 |
import Mathlib.Order.Cover
import Mathlib.Order.Interval.Finset.Defs
#align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
assert_not_exists MonoidWithZero
assert_not_exists Finset.sum
open Function OrderDual
open FinsetInterval
variable {ι α : Type*}
namespace Finset
section Preorder
variable [Preorder α]
section LocallyFiniteOrder
variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α}
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by
rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc]
#align finset.nonempty_Icc Finset.nonempty_Icc
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico]
#align finset.nonempty_Ico Finset.nonempty_Ico
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc]
#align finset.nonempty_Ioc Finset.nonempty_Ioc
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo]
#align finset.nonempty_Ioo Finset.nonempty_Ioo
@[simp]
theorem Icc_eq_empty_iff : Icc a b = ∅ ↔ ¬a ≤ b := by
rw [← coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff]
#align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff
@[simp]
theorem Ico_eq_empty_iff : Ico a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff]
#align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff
@[simp]
theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff]
#align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem Ioo_eq_empty_iff [DenselyOrdered α] : Ioo a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff]
#align finset.Ioo_eq_empty_iff Finset.Ioo_eq_empty_iff
alias ⟨_, Icc_eq_empty⟩ := Icc_eq_empty_iff
#align finset.Icc_eq_empty Finset.Icc_eq_empty
alias ⟨_, Ico_eq_empty⟩ := Ico_eq_empty_iff
#align finset.Ico_eq_empty Finset.Ico_eq_empty
alias ⟨_, Ioc_eq_empty⟩ := Ioc_eq_empty_iff
#align finset.Ioc_eq_empty Finset.Ioc_eq_empty
@[simp]
theorem Ioo_eq_empty (h : ¬a < b) : Ioo a b = ∅ :=
eq_empty_iff_forall_not_mem.2 fun _ hx => h ((mem_Ioo.1 hx).1.trans (mem_Ioo.1 hx).2)
#align finset.Ioo_eq_empty Finset.Ioo_eq_empty
@[simp]
theorem Icc_eq_empty_of_lt (h : b < a) : Icc a b = ∅ :=
Icc_eq_empty h.not_le
#align finset.Icc_eq_empty_of_lt Finset.Icc_eq_empty_of_lt
@[simp]
theorem Ico_eq_empty_of_le (h : b ≤ a) : Ico a b = ∅ :=
Ico_eq_empty h.not_lt
#align finset.Ico_eq_empty_of_le Finset.Ico_eq_empty_of_le
@[simp]
theorem Ioc_eq_empty_of_le (h : b ≤ a) : Ioc a b = ∅ :=
Ioc_eq_empty h.not_lt
#align finset.Ioc_eq_empty_of_le Finset.Ioc_eq_empty_of_le
@[simp]
theorem Ioo_eq_empty_of_le (h : b ≤ a) : Ioo a b = ∅ :=
Ioo_eq_empty h.not_lt
#align finset.Ioo_eq_empty_of_le Finset.Ioo_eq_empty_of_le
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := by simp only [mem_Icc, true_and_iff, le_rfl]
#align finset.left_mem_Icc Finset.left_mem_Icc
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Ico : a ∈ Ico a b ↔ a < b := by simp only [mem_Ico, true_and_iff, le_refl]
#align finset.left_mem_Ico Finset.left_mem_Ico
-- porting note (#10618): simp can prove this
-- @[simp]
theorem right_mem_Icc : b ∈ Icc a b ↔ a ≤ b := by simp only [mem_Icc, and_true_iff, le_rfl]
#align finset.right_mem_Icc Finset.right_mem_Icc
-- porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Basic.lean | 149 | 149 | theorem right_mem_Ioc : b ∈ Ioc a b ↔ a < b := by | simp only [mem_Ioc, and_true_iff, le_rfl]
| 1 | 2.718282 | 0 | 0 | 12 | 11 |
import Mathlib.Computability.Halting
import Mathlib.Computability.TuringMachine
import Mathlib.Data.Num.Lemmas
import Mathlib.Tactic.DeriveFintype
#align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8"
open Function (update)
open Relation
namespace Turing
namespace ToPartrec
inductive Code
| zero'
| succ
| tail
| cons : Code → Code → Code
| comp : Code → Code → Code
| case : Code → Code → Code
| fix : Code → Code
deriving DecidableEq, Inhabited
#align turing.to_partrec.code Turing.ToPartrec.Code
#align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero'
#align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ
#align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail
#align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons
#align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp
#align turing.to_partrec.code.case Turing.ToPartrec.Code.case
#align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix
def Code.eval : Code → List ℕ →. List ℕ
| Code.zero' => fun v => pure (0 :: v)
| Code.succ => fun v => pure [v.headI.succ]
| Code.tail => fun v => pure v.tail
| Code.cons f fs => fun v => do
let n ← Code.eval f v
let ns ← Code.eval fs v
pure (n.headI :: ns)
| Code.comp f g => fun v => g.eval v >>= f.eval
| Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail)
| Code.fix f =>
PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail
#align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval
namespace Code
@[simp]
theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval]
@[simp]
| Mathlib/Computability/TMToPartrec.lean | 143 | 143 | theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by | simp [eval]
| 1 | 2.718282 | 0 | 0.285714 | 14 | 314 |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.ZMod.Basic
#align_import data.zmod.parity from "leanprover-community/mathlib"@"048240e809f04e2bde02482ab44bc230744cc6c9"
namespace ZMod
theorem eq_zero_iff_even {n : ℕ} : (n : ZMod 2) = 0 ↔ Even n :=
(CharP.cast_eq_zero_iff (ZMod 2) 2 n).trans even_iff_two_dvd.symm
#align zmod.eq_zero_iff_even ZMod.eq_zero_iff_even
| Mathlib/Data/ZMod/Parity.lean | 28 | 29 | theorem eq_one_iff_odd {n : ℕ} : (n : ZMod 2) = 1 ↔ Odd n := by |
rw [← @Nat.cast_one (ZMod 2), ZMod.eq_iff_modEq_nat, Nat.odd_iff, Nat.ModEq]
| 1 | 2.718282 | 0 | 0.5 | 2 | 436 |
import Mathlib.Algebra.Group.Indicator
import Mathlib.Algebra.Group.Submonoid.Basic
import Mathlib.Data.Set.Finite
#align_import data.finsupp.defs from "leanprover-community/mathlib"@"842328d9df7e96fd90fc424e115679c15fb23a71"
noncomputable section
open Finset Function
variable {α β γ ι M M' N P G H R S : Type*}
structure Finsupp (α : Type*) (M : Type*) [Zero M] where
support : Finset α
toFun : α → M
mem_support_toFun : ∀ a, a ∈ support ↔ toFun a ≠ 0
#align finsupp Finsupp
#align finsupp.support Finsupp.support
#align finsupp.to_fun Finsupp.toFun
#align finsupp.mem_support_to_fun Finsupp.mem_support_toFun
@[inherit_doc]
infixr:25 " →₀ " => Finsupp
namespace Finsupp
section Basic
variable [Zero M]
instance instFunLike : FunLike (α →₀ M) α M :=
⟨toFun, by
rintro ⟨s, f, hf⟩ ⟨t, g, hg⟩ (rfl : f = g)
congr
ext a
exact (hf _).trans (hg _).symm⟩
#align finsupp.fun_like Finsupp.instFunLike
instance instCoeFun : CoeFun (α →₀ M) fun _ => α → M :=
inferInstance
#align finsupp.has_coe_to_fun Finsupp.instCoeFun
@[ext]
theorem ext {f g : α →₀ M} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext _ _ h
#align finsupp.ext Finsupp.ext
#align finsupp.ext_iff DFunLike.ext_iff
lemma ne_iff {f g : α →₀ M} : f ≠ g ↔ ∃ a, f a ≠ g a := DFunLike.ne_iff
#align finsupp.coe_fn_inj DFunLike.coe_fn_eq
#align finsupp.coe_fn_injective DFunLike.coe_injective
#align finsupp.congr_fun DFunLike.congr_fun
@[simp, norm_cast]
theorem coe_mk (f : α → M) (s : Finset α) (h : ∀ a, a ∈ s ↔ f a ≠ 0) : ⇑(⟨s, f, h⟩ : α →₀ M) = f :=
rfl
#align finsupp.coe_mk Finsupp.coe_mk
instance instZero : Zero (α →₀ M) :=
⟨⟨∅, 0, fun _ => ⟨fun h ↦ (not_mem_empty _ h).elim, fun H => (H rfl).elim⟩⟩⟩
#align finsupp.has_zero Finsupp.instZero
@[simp, norm_cast] lemma coe_zero : ⇑(0 : α →₀ M) = 0 := rfl
#align finsupp.coe_zero Finsupp.coe_zero
theorem zero_apply {a : α} : (0 : α →₀ M) a = 0 :=
rfl
#align finsupp.zero_apply Finsupp.zero_apply
@[simp]
theorem support_zero : (0 : α →₀ M).support = ∅ :=
rfl
#align finsupp.support_zero Finsupp.support_zero
instance instInhabited : Inhabited (α →₀ M) :=
⟨0⟩
#align finsupp.inhabited Finsupp.instInhabited
@[simp]
theorem mem_support_iff {f : α →₀ M} : ∀ {a : α}, a ∈ f.support ↔ f a ≠ 0 :=
@(f.mem_support_toFun)
#align finsupp.mem_support_iff Finsupp.mem_support_iff
@[simp, norm_cast]
theorem fun_support_eq (f : α →₀ M) : Function.support f = f.support :=
Set.ext fun _x => mem_support_iff.symm
#align finsupp.fun_support_eq Finsupp.fun_support_eq
theorem not_mem_support_iff {f : α →₀ M} {a} : a ∉ f.support ↔ f a = 0 :=
not_iff_comm.1 mem_support_iff.symm
#align finsupp.not_mem_support_iff Finsupp.not_mem_support_iff
@[simp, norm_cast]
theorem coe_eq_zero {f : α →₀ M} : (f : α → M) = 0 ↔ f = 0 := by rw [← coe_zero, DFunLike.coe_fn_eq]
#align finsupp.coe_eq_zero Finsupp.coe_eq_zero
theorem ext_iff' {f g : α →₀ M} : f = g ↔ f.support = g.support ∧ ∀ x ∈ f.support, f x = g x :=
⟨fun h => h ▸ ⟨rfl, fun _ _ => rfl⟩, fun ⟨h₁, h₂⟩ =>
ext fun a => by
classical
exact if h : a ∈ f.support then h₂ a h else by
have hf : f a = 0 := not_mem_support_iff.1 h
have hg : g a = 0 := by rwa [h₁, not_mem_support_iff] at h
rw [hf, hg]⟩
#align finsupp.ext_iff' Finsupp.ext_iff'
@[simp]
theorem support_eq_empty {f : α →₀ M} : f.support = ∅ ↔ f = 0 :=
mod_cast @Function.support_eq_empty_iff _ _ _ f
#align finsupp.support_eq_empty Finsupp.support_eq_empty
theorem support_nonempty_iff {f : α →₀ M} : f.support.Nonempty ↔ f ≠ 0 := by
simp only [Finsupp.support_eq_empty, Finset.nonempty_iff_ne_empty, Ne]
#align finsupp.support_nonempty_iff Finsupp.support_nonempty_iff
#align finsupp.nonzero_iff_exists Finsupp.ne_iff
theorem card_support_eq_zero {f : α →₀ M} : card f.support = 0 ↔ f = 0 := by simp
#align finsupp.card_support_eq_zero Finsupp.card_support_eq_zero
instance instDecidableEq [DecidableEq α] [DecidableEq M] : DecidableEq (α →₀ M) := fun f g =>
decidable_of_iff (f.support = g.support ∧ ∀ a ∈ f.support, f a = g a) ext_iff'.symm
#align finsupp.decidable_eq Finsupp.instDecidableEq
theorem finite_support (f : α →₀ M) : Set.Finite (Function.support f) :=
f.fun_support_eq.symm ▸ f.support.finite_toSet
#align finsupp.finite_support Finsupp.finite_support
| Mathlib/Data/Finsupp/Defs.lean | 220 | 222 | theorem support_subset_iff {s : Set α} {f : α →₀ M} :
↑f.support ⊆ s ↔ ∀ a ∉ s, f a = 0 := by |
simp only [Set.subset_def, mem_coe, mem_support_iff]; exact forall_congr' fun a => not_imp_comm
| 1 | 2.718282 | 0 | 0.2 | 5 | 268 |
import Mathlib.Algebra.Quaternion
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.quaternion from "leanprover-community/mathlib"@"07992a1d1f7a4176c6d3f160209608be4e198566"
@[inherit_doc] scoped[Quaternion] notation "ℍ" => Quaternion ℝ
open scoped RealInnerProductSpace
namespace Quaternion
instance : Inner ℝ ℍ :=
⟨fun a b => (a * star b).re⟩
theorem inner_self (a : ℍ) : ⟪a, a⟫ = normSq a :=
rfl
#align quaternion.inner_self Quaternion.inner_self
theorem inner_def (a b : ℍ) : ⟪a, b⟫ = (a * star b).re :=
rfl
#align quaternion.inner_def Quaternion.inner_def
noncomputable instance : NormedAddCommGroup ℍ :=
@InnerProductSpace.Core.toNormedAddCommGroup ℝ ℍ _ _ _
{ toInner := inferInstance
conj_symm := fun x y => by simp [inner_def, mul_comm]
nonneg_re := fun x => normSq_nonneg
definite := fun x => normSq_eq_zero.1
add_left := fun x y z => by simp only [inner_def, add_mul, add_re]
smul_left := fun x y r => by simp [inner_def] }
noncomputable instance : InnerProductSpace ℝ ℍ :=
InnerProductSpace.ofCore _
theorem normSq_eq_norm_mul_self (a : ℍ) : normSq a = ‖a‖ * ‖a‖ := by
rw [← inner_self, real_inner_self_eq_norm_mul_norm]
#align quaternion.norm_sq_eq_norm_sq Quaternion.normSq_eq_norm_mul_self
instance : NormOneClass ℍ :=
⟨by rw [norm_eq_sqrt_real_inner, inner_self, normSq.map_one, Real.sqrt_one]⟩
@[simp, norm_cast]
theorem norm_coe (a : ℝ) : ‖(a : ℍ)‖ = ‖a‖ := by
rw [norm_eq_sqrt_real_inner, inner_self, normSq_coe, Real.sqrt_sq_eq_abs, Real.norm_eq_abs]
#align quaternion.norm_coe Quaternion.norm_coe
@[simp, norm_cast]
theorem nnnorm_coe (a : ℝ) : ‖(a : ℍ)‖₊ = ‖a‖₊ :=
Subtype.ext <| norm_coe a
#align quaternion.nnnorm_coe Quaternion.nnnorm_coe
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
theorem norm_star (a : ℍ) : ‖star a‖ = ‖a‖ := by
simp_rw [norm_eq_sqrt_real_inner, inner_self, normSq_star]
#align quaternion.norm_star Quaternion.norm_star
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
theorem nnnorm_star (a : ℍ) : ‖star a‖₊ = ‖a‖₊ :=
Subtype.ext <| norm_star a
#align quaternion.nnnorm_star Quaternion.nnnorm_star
noncomputable instance : NormedDivisionRing ℍ where
dist_eq _ _ := rfl
norm_mul' a b := by
simp only [norm_eq_sqrt_real_inner, inner_self, normSq.map_mul]
exact Real.sqrt_mul normSq_nonneg _
-- Porting note: added `noncomputable`
noncomputable instance : NormedAlgebra ℝ ℍ where
norm_smul_le := norm_smul_le
toAlgebra := Quaternion.algebra
instance : CstarRing ℍ where
norm_star_mul_self {x} := (norm_mul _ _).trans <| congr_arg (· * ‖x‖) (norm_star x)
@[coe] def coeComplex (z : ℂ) : ℍ := ⟨z.re, z.im, 0, 0⟩
instance : Coe ℂ ℍ := ⟨coeComplex⟩
@[simp, norm_cast]
theorem coeComplex_re (z : ℂ) : (z : ℍ).re = z.re :=
rfl
#align quaternion.coe_complex_re Quaternion.coeComplex_re
@[simp, norm_cast]
theorem coeComplex_imI (z : ℂ) : (z : ℍ).imI = z.im :=
rfl
#align quaternion.coe_complex_im_i Quaternion.coeComplex_imI
@[simp, norm_cast]
theorem coeComplex_imJ (z : ℂ) : (z : ℍ).imJ = 0 :=
rfl
#align quaternion.coe_complex_im_j Quaternion.coeComplex_imJ
@[simp, norm_cast]
theorem coeComplex_imK (z : ℂ) : (z : ℍ).imK = 0 :=
rfl
#align quaternion.coe_complex_im_k Quaternion.coeComplex_imK
@[simp, norm_cast]
theorem coeComplex_add (z w : ℂ) : ↑(z + w) = (z + w : ℍ) := by ext <;> simp
#align quaternion.coe_complex_add Quaternion.coeComplex_add
@[simp, norm_cast]
theorem coeComplex_mul (z w : ℂ) : ↑(z * w) = (z * w : ℍ) := by ext <;> simp
#align quaternion.coe_complex_mul Quaternion.coeComplex_mul
@[simp, norm_cast]
theorem coeComplex_zero : ((0 : ℂ) : ℍ) = 0 :=
rfl
#align quaternion.coe_complex_zero Quaternion.coeComplex_zero
@[simp, norm_cast]
theorem coeComplex_one : ((1 : ℂ) : ℍ) = 1 :=
rfl
#align quaternion.coe_complex_one Quaternion.coeComplex_one
@[simp, norm_cast, nolint simpNF] -- Porting note (#10959): simp cannot prove this
| Mathlib/Analysis/Quaternion.lean | 150 | 150 | theorem coe_real_complex_mul (r : ℝ) (z : ℂ) : (r • z : ℍ) = ↑r * ↑z := by | ext <;> simp
| 1 | 2.718282 | 0 | 0 | 6 | 50 |
import Mathlib.Algebra.Star.Basic
import Mathlib.Data.Set.Finite
import Mathlib.Data.Set.Pointwise.Basic
#align_import algebra.star.pointwise from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e"
namespace Set
open Pointwise
local postfix:max "⋆" => star
variable {α : Type*} {s t : Set α} {a : α}
protected def star [Star α] : Star (Set α) := ⟨preimage Star.star⟩
#align set.has_star Set.star
scoped[Pointwise] attribute [instance] Set.star
@[simp]
theorem star_empty [Star α] : (∅ : Set α)⋆ = ∅ := rfl
#align set.star_empty Set.star_empty
@[simp]
theorem star_univ [Star α] : (univ : Set α)⋆ = univ := rfl
#align set.star_univ Set.star_univ
@[simp]
theorem nonempty_star [InvolutiveStar α] {s : Set α} : s⋆.Nonempty ↔ s.Nonempty :=
star_involutive.surjective.nonempty_preimage
#align set.nonempty_star Set.nonempty_star
theorem Nonempty.star [InvolutiveStar α] {s : Set α} (h : s.Nonempty) : s⋆.Nonempty :=
nonempty_star.2 h
#align set.nonempty.star Set.Nonempty.star
@[simp]
theorem mem_star [Star α] : a ∈ s⋆ ↔ a⋆ ∈ s := Iff.rfl
#align set.mem_star Set.mem_star
theorem star_mem_star [InvolutiveStar α] : a⋆ ∈ s⋆ ↔ a ∈ s := by simp only [mem_star, star_star]
#align set.star_mem_star Set.star_mem_star
@[simp]
theorem star_preimage [Star α] : Star.star ⁻¹' s = s⋆ := rfl
#align set.star_preimage Set.star_preimage
@[simp]
theorem image_star [InvolutiveStar α] : Star.star '' s = s⋆ := by
simp only [← star_preimage]
rw [image_eq_preimage_of_inverse] <;> intro <;> simp only [star_star]
#align set.image_star Set.image_star
@[simp]
theorem inter_star [Star α] : (s ∩ t)⋆ = s⋆ ∩ t⋆ := preimage_inter
#align set.inter_star Set.inter_star
@[simp]
theorem union_star [Star α] : (s ∪ t)⋆ = s⋆ ∪ t⋆ := preimage_union
#align set.union_star Set.union_star
@[simp]
theorem iInter_star {ι : Sort*} [Star α] (s : ι → Set α) : (⋂ i, s i)⋆ = ⋂ i, (s i)⋆ :=
preimage_iInter
#align set.Inter_star Set.iInter_star
@[simp]
theorem iUnion_star {ι : Sort*} [Star α] (s : ι → Set α) : (⋃ i, s i)⋆ = ⋃ i, (s i)⋆ :=
preimage_iUnion
#align set.Union_star Set.iUnion_star
@[simp]
theorem compl_star [Star α] : sᶜ⋆ = s⋆ᶜ := preimage_compl
#align set.compl_star Set.compl_star
@[simp]
instance [InvolutiveStar α] : InvolutiveStar (Set α) where
star := Star.star
star_involutive s := by simp only [← star_preimage, preimage_preimage, star_star, preimage_id']
@[simp]
theorem star_subset_star [InvolutiveStar α] {s t : Set α} : s⋆ ⊆ t⋆ ↔ s ⊆ t :=
Equiv.star.surjective.preimage_subset_preimage_iff
#align set.star_subset_star Set.star_subset_star
| Mathlib/Algebra/Star/Pointwise.lean | 107 | 108 | theorem star_subset [InvolutiveStar α] {s t : Set α} : s⋆ ⊆ t ↔ s ⊆ t⋆ := by |
rw [← star_subset_star, star_star]
| 1 | 2.718282 | 0 | 0.5 | 4 | 487 |
import Mathlib.Analysis.Calculus.Conformal.NormedSpace
import Mathlib.Analysis.InnerProductSpace.ConformalLinearMap
#align_import analysis.calculus.conformal.inner_product from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
variable {E F : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F]
variable [InnerProductSpace ℝ E] [InnerProductSpace ℝ F]
open RealInnerProductSpace
| Mathlib/Analysis/Calculus/Conformal/InnerProduct.lean | 29 | 31 | theorem conformalAt_iff' {f : E → F} {x : E} : ConformalAt f x ↔
∃ c : ℝ, 0 < c ∧ ∀ u v : E, ⟪fderiv ℝ f x u, fderiv ℝ f x v⟫ = c * ⟪u, v⟫ := by |
rw [conformalAt_iff_isConformalMap_fderiv, isConformalMap_iff]
| 1 | 2.718282 | 0 | 0 | 2 | 189 |
import Mathlib.Data.Int.Interval
import Mathlib.Data.Int.SuccPred
import Mathlib.Data.Int.ConditionallyCompleteOrder
import Mathlib.Topology.Instances.Discrete
import Mathlib.Topology.MetricSpace.Bounded
import Mathlib.Order.Filter.Archimedean
#align_import topology.instances.int from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open Metric Set Filter
namespace Int
instance : Dist ℤ :=
⟨fun x y => dist (x : ℝ) y⟩
theorem dist_eq (x y : ℤ) : dist x y = |(x : ℝ) - y| := rfl
#align int.dist_eq Int.dist_eq
theorem dist_eq' (m n : ℤ) : dist m n = |m - n| := by rw [dist_eq]; norm_cast
@[norm_cast, simp]
theorem dist_cast_real (x y : ℤ) : dist (x : ℝ) y = dist x y :=
rfl
#align int.dist_cast_real Int.dist_cast_real
theorem pairwise_one_le_dist : Pairwise fun m n : ℤ => 1 ≤ dist m n := by
intro m n hne
rw [dist_eq]; norm_cast; rwa [← zero_add (1 : ℤ), Int.add_one_le_iff, abs_pos, sub_ne_zero]
#align int.pairwise_one_le_dist Int.pairwise_one_le_dist
theorem uniformEmbedding_coe_real : UniformEmbedding ((↑) : ℤ → ℝ) :=
uniformEmbedding_bot_of_pairwise_le_dist zero_lt_one pairwise_one_le_dist
#align int.uniform_embedding_coe_real Int.uniformEmbedding_coe_real
theorem closedEmbedding_coe_real : ClosedEmbedding ((↑) : ℤ → ℝ) :=
closedEmbedding_of_pairwise_le_dist zero_lt_one pairwise_one_le_dist
#align int.closed_embedding_coe_real Int.closedEmbedding_coe_real
instance : MetricSpace ℤ := Int.uniformEmbedding_coe_real.comapMetricSpace _
theorem preimage_ball (x : ℤ) (r : ℝ) : (↑) ⁻¹' ball (x : ℝ) r = ball x r := rfl
#align int.preimage_ball Int.preimage_ball
theorem preimage_closedBall (x : ℤ) (r : ℝ) : (↑) ⁻¹' closedBall (x : ℝ) r = closedBall x r := rfl
#align int.preimage_closed_ball Int.preimage_closedBall
theorem ball_eq_Ioo (x : ℤ) (r : ℝ) : ball x r = Ioo ⌊↑x - r⌋ ⌈↑x + r⌉ := by
rw [← preimage_ball, Real.ball_eq_Ioo, preimage_Ioo]
#align int.ball_eq_Ioo Int.ball_eq_Ioo
| Mathlib/Topology/Instances/Int.lean | 66 | 67 | theorem closedBall_eq_Icc (x : ℤ) (r : ℝ) : closedBall x r = Icc ⌈↑x - r⌉ ⌊↑x + r⌋ := by |
rw [← preimage_closedBall, Real.closedBall_eq_Icc, preimage_Icc]
| 1 | 2.718282 | 0 | 0.333333 | 6 | 327 |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Expand
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.ZMod.Basic
#align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
open MvPolynomial
open Finset hiding map
open Finsupp (single)
--attribute [-simp] coe_eval₂_hom
variable (p : ℕ)
variable (R : Type*) [CommRing R] [DecidableEq R]
noncomputable def wittPolynomial (n : ℕ) : MvPolynomial ℕ R :=
∑ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i)
#align witt_polynomial wittPolynomial
theorem wittPolynomial_eq_sum_C_mul_X_pow (n : ℕ) :
wittPolynomial p R n = ∑ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by
apply sum_congr rfl
rintro i -
rw [monomial_eq, Finsupp.prod_single_index]
rw [pow_zero]
set_option linter.uppercaseLean3 false in
#align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow
-- Notation with ring of coefficients explicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W_" => wittPolynomial p
-- Notation with ring of coefficients implicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W" => wittPolynomial p _
open Witt
open MvPolynomial
section
variable {R} {S : Type*} [CommRing S]
@[simp]
theorem map_wittPolynomial (f : R →+* S) (n : ℕ) : map f (W n) = W n := by
rw [wittPolynomial, map_sum, wittPolynomial]
refine sum_congr rfl fun i _ => ?_
rw [map_monomial, RingHom.map_pow, map_natCast]
#align map_witt_polynomial map_wittPolynomial
variable (R)
@[simp]
theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : ℕ) :
constantCoeff (wittPolynomial p R n) = 0 := by
simp only [wittPolynomial, map_sum, constantCoeff_monomial]
rw [sum_eq_zero]
rintro i _
rw [if_neg]
rw [Finsupp.single_eq_zero]
exact ne_of_gt (pow_pos hp.1.pos _)
#align constant_coeff_witt_polynomial constantCoeff_wittPolynomial
@[simp]
theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by
simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self]
#align witt_polynomial_zero wittPolynomial_zero
@[simp]
theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton,
one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero]
#align witt_polynomial_one wittPolynomial_one
theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : ℕ → A) (n : ℕ) :
aeval f (W_ R n) = ∑ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by
simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index]
#align aeval_witt_polynomial aeval_wittPolynomial
@[simp]
theorem wittPolynomial_zmod_self (n : ℕ) :
W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow]
rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0,
zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl]
intro k hk
rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ']
congr
rw [mem_range] at hk
rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm]
#align witt_polynomial_zmod_self wittPolynomial_zmod_self
end
noncomputable def xInTermsOfW [Invertible (p : R)] : ℕ → MvPolynomial ℕ R
| n => (X n - ∑ i : Fin n,
C ((p : R) ^ (i : ℕ)) * xInTermsOfW i ^ p ^ (n - (i : ℕ))) * C ((⅟ p : R) ^ n)
set_option linter.uppercaseLean3 false in
#align X_in_terms_of_W xInTermsOfW
| Mathlib/RingTheory/WittVector/WittPolynomial.lean | 211 | 213 | theorem xInTermsOfW_eq [Invertible (p : R)] {n : ℕ} : xInTermsOfW p R n =
(X n - ∑ i ∈ range n, C ((p: R) ^ i) * xInTermsOfW p R i ^ p ^ (n - i)) * C ((⅟p : R) ^ n) := by |
rw [xInTermsOfW, ← Fin.sum_univ_eq_sum_range]
| 1 | 2.718282 | 0 | 1.181818 | 11 | 1,247 |
import Mathlib.MeasureTheory.PiSystem
import Mathlib.Order.OmegaCompletePartialOrder
import Mathlib.Topology.Constructions
import Mathlib.MeasureTheory.MeasurableSpace.Basic
open Set
namespace MeasureTheory
variable {ι : Type _} {α : ι → Type _}
section cylinder
def cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : Set (∀ i, α i) :=
(fun (f : ∀ i, α i) (i : s) ↦ f i) ⁻¹' S
@[simp]
theorem mem_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) (f : ∀ i, α i) :
f ∈ cylinder s S ↔ (fun i : s ↦ f i) ∈ S :=
mem_preimage
@[simp]
theorem cylinder_empty (s : Finset ι) : cylinder s (∅ : Set (∀ i : s, α i)) = ∅ := by
rw [cylinder, preimage_empty]
@[simp]
theorem cylinder_univ (s : Finset ι) : cylinder s (univ : Set (∀ i : s, α i)) = univ := by
rw [cylinder, preimage_univ]
@[simp]
theorem cylinder_eq_empty_iff [h_nonempty : Nonempty (∀ i, α i)] (s : Finset ι)
(S : Set (∀ i : s, α i)) :
cylinder s S = ∅ ↔ S = ∅ := by
refine ⟨fun h ↦ ?_, fun h ↦ by (rw [h]; exact cylinder_empty _)⟩
by_contra hS
rw [← Ne, ← nonempty_iff_ne_empty] at hS
let f := hS.some
have hf : f ∈ S := hS.choose_spec
classical
let f' : ∀ i, α i := fun i ↦ if hi : i ∈ s then f ⟨i, hi⟩ else h_nonempty.some i
have hf' : f' ∈ cylinder s S := by
rw [mem_cylinder]
simpa only [f', Finset.coe_mem, dif_pos]
rw [h] at hf'
exact not_mem_empty _ hf'
theorem inter_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i))
[DecidableEq ι] :
cylinder s₁ S₁ ∩ cylinder s₂ S₂ =
cylinder (s₁ ∪ s₂)
((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∩
(fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by
ext1 f; simp only [mem_inter_iff, mem_cylinder, mem_setOf_eq]; rfl
theorem inter_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) :
cylinder s S₁ ∩ cylinder s S₂ = cylinder s (S₁ ∩ S₂) := by
classical rw [inter_cylinder]; rfl
theorem union_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i))
[DecidableEq ι] :
cylinder s₁ S₁ ∪ cylinder s₂ S₂ =
cylinder (s₁ ∪ s₂)
((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∪
(fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by
ext1 f; simp only [mem_union, mem_cylinder, mem_setOf_eq]; rfl
theorem union_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) :
cylinder s S₁ ∪ cylinder s S₂ = cylinder s (S₁ ∪ S₂) := by
classical rw [union_cylinder]; rfl
| Mathlib/MeasureTheory/Constructions/Cylinders.lean | 209 | 211 | theorem compl_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) :
(cylinder s S)ᶜ = cylinder s (Sᶜ) := by |
ext1 f; simp only [mem_compl_iff, mem_cylinder]
| 1 | 2.718282 | 0 | 0.6875 | 16 | 636 |
import Mathlib.Data.DFinsupp.Order
#align_import data.dfinsupp.multiset from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
open Function
variable {α : Type*} {β : α → Type*}
namespace Multiset
variable [DecidableEq α] {s t : Multiset α}
def toDFinsupp : Multiset α →+ Π₀ _ : α, ℕ where
toFun s :=
{ toFun := fun n ↦ s.count n
support' := Trunc.mk ⟨s, fun i ↦ (em (i ∈ s)).imp_right Multiset.count_eq_zero_of_not_mem⟩ }
map_zero' := rfl
map_add' _ _ := DFinsupp.ext fun _ ↦ Multiset.count_add _ _ _
#align multiset.to_dfinsupp Multiset.toDFinsupp
@[simp]
theorem toDFinsupp_apply (s : Multiset α) (a : α) : Multiset.toDFinsupp s a = s.count a :=
rfl
#align multiset.to_dfinsupp_apply Multiset.toDFinsupp_apply
@[simp]
theorem toDFinsupp_support (s : Multiset α) : s.toDFinsupp.support = s.toFinset :=
Finset.filter_true_of_mem fun _ hx ↦ count_ne_zero.mpr <| Multiset.mem_toFinset.1 hx
#align multiset.to_dfinsupp_support Multiset.toDFinsupp_support
@[simp]
theorem toDFinsupp_replicate (a : α) (n : ℕ) :
toDFinsupp (Multiset.replicate n a) = DFinsupp.single a n := by
ext i
dsimp [toDFinsupp]
simp [count_replicate, eq_comm]
#align multiset.to_dfinsupp_replicate Multiset.toDFinsupp_replicate
@[simp]
| Mathlib/Data/DFinsupp/Multiset.lean | 75 | 76 | theorem toDFinsupp_singleton (a : α) : toDFinsupp {a} = DFinsupp.single a 1 := by |
rw [← replicate_one, toDFinsupp_replicate]
| 1 | 2.718282 | 0 | 0.5 | 2 | 460 |
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Algebra.Group.Basic
#align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
universe u
open Nat
namespace Int
variable {R : Type u} [AddGroupWithOne R]
@[simp, norm_cast squash]
theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) :=
AddGroupWithOne.intCast_negSucc n
#align int.cast_neg_succ_of_nat Int.cast_negSuccₓ
-- expected `n` to be implicit, and `HasLiftT`
@[simp, norm_cast]
theorem cast_zero : ((0 : ℤ) : R) = 0 :=
(AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero
#align int.cast_zero Int.cast_zeroₓ
-- type had `HasLiftT`
-- This lemma competes with `Int.ofNat_eq_natCast` to come later
@[simp high, nolint simpNF, norm_cast]
theorem cast_natCast (n : ℕ) : ((n : ℤ) : R) = n :=
AddGroupWithOne.intCast_ofNat _
#align int.cast_coe_nat Int.cast_natCastₓ
-- expected `n` to be implicit, and `HasLiftT`
#align int.cast_of_nat Int.cast_natCastₓ
-- See note [no_index around OfNat.ofNat]
@[simp, norm_cast]
| Mathlib/Data/Int/Cast/Basic.lean | 74 | 76 | theorem cast_ofNat (n : ℕ) [n.AtLeastTwo] :
((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by |
simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n
| 1 | 2.718282 | 0 | 0 | 2 | 74 |
import Mathlib.Algebra.FreeNonUnitalNonAssocAlgebra
import Mathlib.Algebra.Lie.NonUnitalNonAssocAlgebra
import Mathlib.Algebra.Lie.UniversalEnveloping
import Mathlib.GroupTheory.GroupAction.Ring
#align_import algebra.lie.free from "leanprover-community/mathlib"@"841ac1a3d9162bf51c6327812ecb6e5e71883ac4"
universe u v w
noncomputable section
variable (R : Type u) (X : Type v) [CommRing R]
local notation "lib" => FreeNonUnitalNonAssocAlgebra
local notation "lib.lift" => FreeNonUnitalNonAssocAlgebra.lift
local notation "lib.of" => FreeNonUnitalNonAssocAlgebra.of
local notation "lib.lift_of_apply" => FreeNonUnitalNonAssocAlgebra.lift_of_apply
local notation "lib.lift_comp_of" => FreeNonUnitalNonAssocAlgebra.lift_comp_of
namespace FreeLieAlgebra
inductive Rel : lib R X → lib R X → Prop
| lie_self (a : lib R X) : Rel (a * a) 0
| leibniz_lie (a b c : lib R X) : Rel (a * (b * c)) (a * b * c + b * (a * c))
| smul (t : R) {a b : lib R X} : Rel a b → Rel (t • a) (t • b)
| add_right {a b : lib R X} (c : lib R X) : Rel a b → Rel (a + c) (b + c)
| mul_left (a : lib R X) {b c : lib R X} : Rel b c → Rel (a * b) (a * c)
| mul_right {a b : lib R X} (c : lib R X) : Rel a b → Rel (a * c) (b * c)
#align free_lie_algebra.rel FreeLieAlgebra.Rel
variable {R X}
theorem Rel.addLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a + b) (a + c) := by
rw [add_comm _ b, add_comm _ c]; exact h.add_right _
#align free_lie_algebra.rel.add_left FreeLieAlgebra.Rel.addLeft
theorem Rel.neg {a b : lib R X} (h : Rel R X a b) : Rel R X (-a) (-b) := by
simpa only [neg_one_smul] using h.smul (-1)
#align free_lie_algebra.rel.neg FreeLieAlgebra.Rel.neg
| Mathlib/Algebra/Lie/Free.lean | 95 | 96 | theorem Rel.subLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a - b) (a - c) := by |
simpa only [sub_eq_add_neg] using h.neg.addLeft a
| 1 | 2.718282 | 0 | 0.2 | 5 | 274 |
import Mathlib.Data.List.Forall2
import Mathlib.Data.Set.Pairwise.Basic
import Mathlib.Init.Data.Fin.Basic
#align_import data.list.nodup from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
universe u v
open Nat Function
variable {α : Type u} {β : Type v} {l l₁ l₂ : List α} {r : α → α → Prop} {a b : α}
namespace List
@[simp]
theorem forall_mem_ne {a : α} {l : List α} : (∀ a' : α, a' ∈ l → ¬a = a') ↔ a ∉ l :=
⟨fun h m => h _ m rfl, fun h _ m e => h (e.symm ▸ m)⟩
#align list.forall_mem_ne List.forall_mem_ne
@[simp]
theorem nodup_nil : @Nodup α [] :=
Pairwise.nil
#align list.nodup_nil List.nodup_nil
@[simp]
| Mathlib/Data/List/Nodup.lean | 39 | 40 | theorem nodup_cons {a : α} {l : List α} : Nodup (a :: l) ↔ a ∉ l ∧ Nodup l := by |
simp only [Nodup, pairwise_cons, forall_mem_ne]
| 1 | 2.718282 | 0 | 1 | 2 | 874 |
import Mathlib.CategoryTheory.Monoidal.Mon_
#align_import category_theory.monoidal.Mod_ from "leanprover-community/mathlib"@"33085c9739c41428651ac461a323fde9a2688d9b"
universe v₁ v₂ u₁ u₂
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
variable {C}
structure Mod_ (A : Mon_ C) where
X : C
act : A.X ⊗ X ⟶ X
one_act : (A.one ▷ X) ≫ act = (λ_ X).hom := by aesop_cat
assoc : (A.mul ▷ X) ≫ act = (α_ A.X A.X X).hom ≫ (A.X ◁ act) ≫ act := by aesop_cat
set_option linter.uppercaseLean3 false in
#align Mod_ Mod_
attribute [reassoc (attr := simp)] Mod_.one_act Mod_.assoc
namespace Mod_
variable {A : Mon_ C} (M : Mod_ A)
theorem assoc_flip :
(A.X ◁ M.act) ≫ M.act = (α_ A.X A.X M.X).inv ≫ (A.mul ▷ M.X) ≫ M.act := by simp
set_option linter.uppercaseLean3 false in
#align Mod_.assoc_flip Mod_.assoc_flip
@[ext]
structure Hom (M N : Mod_ A) where
hom : M.X ⟶ N.X
act_hom : M.act ≫ hom = (A.X ◁ hom) ≫ N.act := by aesop_cat
set_option linter.uppercaseLean3 false in
#align Mod_.hom Mod_.Hom
attribute [reassoc (attr := simp)] Hom.act_hom
@[simps]
def id (M : Mod_ A) : Hom M M where hom := 𝟙 M.X
set_option linter.uppercaseLean3 false in
#align Mod_.id Mod_.id
instance homInhabited (M : Mod_ A) : Inhabited (Hom M M) :=
⟨id M⟩
set_option linter.uppercaseLean3 false in
#align Mod_.hom_inhabited Mod_.homInhabited
@[simps]
def comp {M N O : Mod_ A} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom
set_option linter.uppercaseLean3 false in
#align Mod_.comp Mod_.comp
instance : Category (Mod_ A) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added because `Hom.ext` is not triggered automatically
-- See https://github.com/leanprover-community/mathlib4/issues/5229
@[ext]
lemma hom_ext {M N : Mod_ A} (f₁ f₂ : M ⟶ N) (h : f₁.hom = f₂.hom) : f₁ = f₂ :=
Hom.ext _ _ h
@[simp]
| Mathlib/CategoryTheory/Monoidal/Mod_.lean | 81 | 82 | theorem id_hom' (M : Mod_ A) : (𝟙 M : M ⟶ M).hom = 𝟙 M.X := by |
rfl
| 1 | 2.718282 | 0 | 0 | 2 | 172 |
import Mathlib.GroupTheory.Sylow
import Mathlib.GroupTheory.Transfer
#align_import group_theory.schur_zassenhaus from "leanprover-community/mathlib"@"d57133e49cf06508700ef69030cd099917e0f0de"
namespace Subgroup
section SchurZassenhausAbelian
open MulOpposite MulAction Subgroup.leftTransversals MemLeftTransversals
variable {G : Type*} [Group G] (H : Subgroup G) [IsCommutative H] [FiniteIndex H]
(α β : leftTransversals (H : Set G))
def QuotientDiff :=
Quotient
(Setoid.mk (fun α β => diff (MonoidHom.id H) α β = 1)
⟨fun α => diff_self (MonoidHom.id H) α, fun h => by rw [← diff_inv, h, inv_one],
fun h h' => by rw [← diff_mul_diff, h, h', one_mul]⟩)
#align subgroup.quotient_diff Subgroup.QuotientDiff
instance : Inhabited H.QuotientDiff := by
dsimp [QuotientDiff] -- Porting note: Added `dsimp`
infer_instance
theorem smul_diff_smul' [hH : Normal H] (g : Gᵐᵒᵖ) :
diff (MonoidHom.id H) (g • α) (g • β) =
⟨g.unop⁻¹ * (diff (MonoidHom.id H) α β : H) * g.unop,
hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩ := by
letI := H.fintypeQuotientOfFiniteIndex
let ϕ : H →* H :=
{ toFun := fun h =>
⟨g.unop⁻¹ * h * g.unop,
hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩
map_one' := by rw [Subtype.ext_iff, coe_mk, coe_one, mul_one, inv_mul_self]
map_mul' := fun h₁ h₂ => by
simp only [Subtype.ext_iff, coe_mk, coe_mul, mul_assoc, mul_inv_cancel_left] }
refine (Fintype.prod_equiv (MulAction.toPerm g).symm _ _ fun x ↦ ?_).trans (map_prod ϕ _ _).symm
simp only [ϕ, smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, mul_inv_rev, mul_assoc,
MonoidHom.id_apply, toPerm_symm_apply, MonoidHom.coe_mk, OneHom.coe_mk]
#align subgroup.smul_diff_smul' Subgroup.smul_diff_smul'
variable {H} [Normal H]
noncomputable instance : MulAction G H.QuotientDiff where
smul g :=
Quotient.map' (fun α => op g⁻¹ • α) fun α β h =>
Subtype.ext
(by
rwa [smul_diff_smul', coe_mk, coe_one, mul_eq_one_iff_eq_inv, mul_right_eq_self, ←
coe_one, ← Subtype.ext_iff])
mul_smul g₁ g₂ q :=
Quotient.inductionOn' q fun T =>
congr_arg Quotient.mk'' (by rw [mul_inv_rev]; exact mul_smul (op g₁⁻¹) (op g₂⁻¹) T)
one_smul q :=
Quotient.inductionOn' q fun T =>
congr_arg Quotient.mk'' (by rw [inv_one]; apply one_smul Gᵐᵒᵖ T)
theorem smul_diff' (h : H) :
diff (MonoidHom.id H) α (op (h : G) • β) = diff (MonoidHom.id H) α β * h ^ H.index := by
letI := H.fintypeQuotientOfFiniteIndex
rw [diff, diff, index_eq_card, ← Finset.card_univ, ← Finset.prod_const, ← Finset.prod_mul_distrib]
refine Finset.prod_congr rfl fun q _ => ?_
simp_rw [Subtype.ext_iff, MonoidHom.id_apply, coe_mul, mul_assoc, mul_right_inj]
rw [smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, MulOpposite.unop_op, mul_left_inj,
← Subtype.ext_iff, Equiv.apply_eq_iff_eq, inv_smul_eq_iff]
exact self_eq_mul_right.mpr ((QuotientGroup.eq_one_iff _).mpr h.2)
#align subgroup.smul_diff' Subgroup.smul_diff'
| Mathlib/GroupTheory/SchurZassenhaus.lean | 92 | 99 | theorem eq_one_of_smul_eq_one (hH : Nat.Coprime (Nat.card H) H.index) (α : H.QuotientDiff)
(h : H) : h • α = α → h = 1 :=
Quotient.inductionOn' α fun α hα =>
(powCoprime hH).injective <|
calc
h ^ H.index = diff (MonoidHom.id H) (op ((h⁻¹ : H) : G) • α) α := by |
rw [← diff_inv, smul_diff', diff_self, one_mul, inv_pow, inv_inv]
_ = 1 ^ H.index := (Quotient.exact' hα).trans (one_pow H.index).symm
| 2 | 7.389056 | 1 | 1.666667 | 3 | 1,783 |
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Data.Nat.Cast.Order
#align_import algebra.order.invertible from "leanprover-community/mathlib"@"ee0c179cd3c8a45aa5bffbf1b41d8dbede452865"
variable {α : Type*} [LinearOrderedSemiring α] {a : α}
@[simp]
| Mathlib/Algebra/Order/Invertible.lean | 19 | 21 | theorem invOf_pos [Invertible a] : 0 < ⅟ a ↔ 0 < a :=
haveI : 0 < a * ⅟ a := by | simp only [mul_invOf_self, zero_lt_one]
⟨fun h => pos_of_mul_pos_left this h.le, fun h => pos_of_mul_pos_right this h.le⟩
| 2 | 7.389056 | 1 | 0.5 | 4 | 441 |
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E]
def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop :=
IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ
#align interval_integrable IntervalIntegrable
section
variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ}
theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
#align interval_integrable_iff intervalIntegrable_iff
theorem IntervalIntegrable.def' (h : IntervalIntegrable f μ a b) : IntegrableOn f (Ι a b) μ :=
intervalIntegrable_iff.mp h
#align interval_integrable.def IntervalIntegrable.def'
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
#align interval_integrable_iff_integrable_Ioc_of_le intervalIntegrable_iff_integrableOn_Ioc_of_le
theorem intervalIntegrable_iff' [NoAtoms μ] :
IntervalIntegrable f μ a b ↔ IntegrableOn f (uIcc a b) μ := by
rw [intervalIntegrable_iff, ← Icc_min_max, uIoc, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff' intervalIntegrable_iff'
theorem intervalIntegrable_iff_integrableOn_Icc_of_le {f : ℝ → E} {a b : ℝ} (hab : a ≤ b)
{μ : Measure ℝ} [NoAtoms μ] : IntervalIntegrable f μ a b ↔ IntegrableOn f (Icc a b) μ := by
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff_integrable_Icc_of_le intervalIntegrable_iff_integrableOn_Icc_of_le
theorem intervalIntegrable_iff_integrableOn_Ico_of_le [NoAtoms μ] (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ico a b) μ := by
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ico]
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 112 | 114 | theorem intervalIntegrable_iff_integrableOn_Ioo_of_le [NoAtoms μ] (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioo a b) μ := by |
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioo]
| 1 | 2.718282 | 0 | 0.3 | 10 | 319 |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 46 | 46 | theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by | simp [expNegInvGlue, hx]
| 1 | 2.718282 | 0 | 1.166667 | 6 | 1,237 |
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]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean | 107 | 108 | theorem natCast_mul_eq_nsmul (x : ℝ) (n : ℕ) : ↑((n : ℝ) * x) = n • (↑x : Angle) := by |
simpa only [nsmul_eq_mul] using coeHom.map_nsmul x n
| 1 | 2.718282 | 0 | 0.5 | 6 | 425 |
import Mathlib.Order.Filter.AtTopBot
#align_import order.filter.indicator_function from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {α β M E : Type*}
open Set Filter
@[to_additive]
theorem Monotone.mulIndicator_eventuallyEq_iUnion {ι} [Preorder ι] [One β] (s : ι → Set α)
(hs : Monotone s) (f : α → β) (a : α) :
(fun i => mulIndicator (s i) f a) =ᶠ[atTop] fun _ ↦ mulIndicator (⋃ i, s i) f a := by
classical exact hs.piecewise_eventually_eq_iUnion f 1 a
@[to_additive]
theorem Monotone.tendsto_mulIndicator {ι} [Preorder ι] [One β] (s : ι → Set α) (hs : Monotone s)
(f : α → β) (a : α) :
Tendsto (fun i => mulIndicator (s i) f a) atTop (pure <| mulIndicator (⋃ i, s i) f a) :=
tendsto_pure.2 <| hs.mulIndicator_eventuallyEq_iUnion s f a
#align monotone.tendsto_indicator Monotone.tendsto_indicator
@[to_additive]
| Mathlib/Order/Filter/IndicatorFunction.lean | 76 | 79 | theorem Antitone.mulIndicator_eventuallyEq_iInter {ι} [Preorder ι] [One β] (s : ι → Set α)
(hs : Antitone s) (f : α → β) (a : α) :
(fun i => mulIndicator (s i) f a) =ᶠ[atTop] fun _ ↦ mulIndicator (⋂ i, s i) f a := by |
classical exact hs.piecewise_eventually_eq_iInter f 1 a
| 1 | 2.718282 | 0 | 0.333333 | 3 | 344 |
import Mathlib.Computability.Halting
import Mathlib.Computability.TuringMachine
import Mathlib.Data.Num.Lemmas
import Mathlib.Tactic.DeriveFintype
#align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8"
open Function (update)
open Relation
namespace Turing
namespace ToPartrec
inductive Code
| zero'
| succ
| tail
| cons : Code → Code → Code
| comp : Code → Code → Code
| case : Code → Code → Code
| fix : Code → Code
deriving DecidableEq, Inhabited
#align turing.to_partrec.code Turing.ToPartrec.Code
#align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero'
#align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ
#align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail
#align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons
#align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp
#align turing.to_partrec.code.case Turing.ToPartrec.Code.case
#align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix
def Code.eval : Code → List ℕ →. List ℕ
| Code.zero' => fun v => pure (0 :: v)
| Code.succ => fun v => pure [v.headI.succ]
| Code.tail => fun v => pure v.tail
| Code.cons f fs => fun v => do
let n ← Code.eval f v
let ns ← Code.eval fs v
pure (n.headI :: ns)
| Code.comp f g => fun v => g.eval v >>= f.eval
| Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail)
| Code.fix f =>
PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail
#align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval
namespace Code
@[simp]
theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval]
@[simp]
theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by simp [eval]
@[simp]
theorem tail_eval : tail.eval = fun v => pure v.tail := by simp [eval]
@[simp]
theorem cons_eval (f fs) : (cons f fs).eval = fun v => do {
let n ← Code.eval f v
let ns ← Code.eval fs v
pure (n.headI :: ns) } := by simp [eval]
@[simp]
theorem comp_eval (f g) : (comp f g).eval = fun v => g.eval v >>= f.eval := by simp [eval]
@[simp]
theorem case_eval (f g) :
(case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) := by
simp [eval]
@[simp]
theorem fix_eval (f) : (fix f).eval =
PFun.fix fun v => (f.eval v).map fun v =>
if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail := by
simp [eval]
def nil : Code :=
tail.comp succ
#align turing.to_partrec.code.nil Turing.ToPartrec.Code.nil
@[simp]
theorem nil_eval (v) : nil.eval v = pure [] := by simp [nil]
#align turing.to_partrec.code.nil_eval Turing.ToPartrec.Code.nil_eval
def id : Code :=
tail.comp zero'
#align turing.to_partrec.code.id Turing.ToPartrec.Code.id
@[simp]
theorem id_eval (v) : id.eval v = pure v := by simp [id]
#align turing.to_partrec.code.id_eval Turing.ToPartrec.Code.id_eval
def head : Code :=
cons id nil
#align turing.to_partrec.code.head Turing.ToPartrec.Code.head
@[simp]
theorem head_eval (v) : head.eval v = pure [v.headI] := by simp [head]
#align turing.to_partrec.code.head_eval Turing.ToPartrec.Code.head_eval
def zero : Code :=
cons zero' nil
#align turing.to_partrec.code.zero Turing.ToPartrec.Code.zero
@[simp]
theorem zero_eval (v) : zero.eval v = pure [0] := by simp [zero]
#align turing.to_partrec.code.zero_eval Turing.ToPartrec.Code.zero_eval
def pred : Code :=
case zero head
#align turing.to_partrec.code.pred Turing.ToPartrec.Code.pred
@[simp]
| Mathlib/Computability/TMToPartrec.lean | 211 | 212 | theorem pred_eval (v) : pred.eval v = pure [v.headI.pred] := by |
simp [pred]; cases v.headI <;> simp
| 1 | 2.718282 | 0 | 0.285714 | 14 | 314 |
import Mathlib.Combinatorics.SimpleGraph.Connectivity
#align_import combinatorics.simple_graph.prod from "leanprover-community/mathlib"@"2985fa3c31a27274aed06c433510bc14b73d6488"
variable {α β γ : Type*}
namespace SimpleGraph
-- Porting note: pruned variables to keep things out of local contexts, which
-- can impact how generalization works, or what aesop does.
variable {G : SimpleGraph α} {H : SimpleGraph β}
def boxProd (G : SimpleGraph α) (H : SimpleGraph β) : SimpleGraph (α × β) where
Adj x y := G.Adj x.1 y.1 ∧ x.2 = y.2 ∨ H.Adj x.2 y.2 ∧ x.1 = y.1
symm x y := by simp [and_comm, or_comm, eq_comm, adj_comm]
loopless x := by simp
#align simple_graph.box_prod SimpleGraph.boxProd
infixl:70 " □ " => boxProd
set_option autoImplicit true in
@[simp]
theorem boxProd_adj : (G □ H).Adj x y ↔ G.Adj x.1 y.1 ∧ x.2 = y.2 ∨ H.Adj x.2 y.2 ∧ x.1 = y.1 :=
Iff.rfl
#align simple_graph.box_prod_adj SimpleGraph.boxProd_adj
set_option autoImplicit true in
--@[simp] Porting note (#10618): `simp` can prove
theorem boxProd_adj_left : (G □ H).Adj (a₁, b) (a₂, b) ↔ G.Adj a₁ a₂ := by
simp only [boxProd_adj, and_true, SimpleGraph.irrefl, false_and, or_false]
#align simple_graph.box_prod_adj_left SimpleGraph.boxProd_adj_left
set_option autoImplicit true in
--@[simp] Porting note (#10618): `simp` can prove
| Mathlib/Combinatorics/SimpleGraph/Prod.lean | 65 | 66 | theorem boxProd_adj_right : (G □ H).Adj (a, b₁) (a, b₂) ↔ H.Adj b₁ b₂ := by |
simp only [boxProd_adj, SimpleGraph.irrefl, false_and, and_true, false_or]
| 1 | 2.718282 | 0 | 0.333333 | 3 | 334 |
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E]
def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop :=
IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ
#align interval_integrable IntervalIntegrable
section
variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ}
theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
#align interval_integrable_iff intervalIntegrable_iff
theorem IntervalIntegrable.def' (h : IntervalIntegrable f μ a b) : IntegrableOn f (Ι a b) μ :=
intervalIntegrable_iff.mp h
#align interval_integrable.def IntervalIntegrable.def'
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 93 | 95 | theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ := by |
rw [intervalIntegrable_iff, uIoc_of_le hab]
| 1 | 2.718282 | 0 | 0.3 | 10 | 319 |
import Mathlib.MeasureTheory.Function.LpOrder
#align_import measure_theory.function.l1_space from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f"
noncomputable section
open scoped Classical
open Topology ENNReal MeasureTheory NNReal
open Set Filter TopologicalSpace ENNReal EMetric MeasureTheory
variable {α β γ δ : Type*} {m : MeasurableSpace α} {μ ν : Measure α} [MeasurableSpace δ]
variable [NormedAddCommGroup β]
variable [NormedAddCommGroup γ]
namespace MeasureTheory
theorem lintegral_nnnorm_eq_lintegral_edist (f : α → β) :
∫⁻ a, ‖f a‖₊ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [edist_eq_coe_nnnorm]
#align measure_theory.lintegral_nnnorm_eq_lintegral_edist MeasureTheory.lintegral_nnnorm_eq_lintegral_edist
theorem lintegral_norm_eq_lintegral_edist (f : α → β) :
∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by
simp only [ofReal_norm_eq_coe_nnnorm, edist_eq_coe_nnnorm]
#align measure_theory.lintegral_norm_eq_lintegral_edist MeasureTheory.lintegral_norm_eq_lintegral_edist
theorem lintegral_edist_triangle {f g h : α → β} (hf : AEStronglyMeasurable f μ)
(hh : AEStronglyMeasurable h μ) :
(∫⁻ a, edist (f a) (g a) ∂μ) ≤ (∫⁻ a, edist (f a) (h a) ∂μ) + ∫⁻ a, edist (g a) (h a) ∂μ := by
rw [← lintegral_add_left' (hf.edist hh)]
refine lintegral_mono fun a => ?_
apply edist_triangle_right
#align measure_theory.lintegral_edist_triangle MeasureTheory.lintegral_edist_triangle
| Mathlib/MeasureTheory/Function/L1Space.lean | 83 | 83 | theorem lintegral_nnnorm_zero : (∫⁻ _ : α, ‖(0 : β)‖₊ ∂μ) = 0 := by | simp
| 1 | 2.718282 | 0 | 0.3 | 10 | 320 |
import Mathlib.Data.Sigma.Basic
import Mathlib.Algebra.Order.Ring.Nat
#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
variable {α : Type*}
inductive Lists'.{u} (α : Type u) : Bool → Type u
| atom : α → Lists' α false
| nil : Lists' α true
| cons' {b} : Lists' α b → Lists' α true → Lists' α true
deriving DecidableEq
#align lists' Lists'
compile_inductive% Lists'
def Lists (α : Type*) :=
Σb, Lists' α b
#align lists Lists
namespace Lists'
instance [Inhabited α] : ∀ b, Inhabited (Lists' α b)
| true => ⟨nil⟩
| false => ⟨atom default⟩
def cons : Lists α → Lists' α true → Lists' α true
| ⟨_, a⟩, l => cons' a l
#align lists'.cons Lists'.cons
@[simp]
def toList : ∀ {b}, Lists' α b → List (Lists α)
| _, atom _ => []
| _, nil => []
| _, cons' a l => ⟨_, a⟩ :: l.toList
#align lists'.to_list Lists'.toList
-- Porting note (#10618): removed @[simp]
-- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
theorem toList_cons (a : Lists α) (l) : toList (cons a l) = a :: l.toList := by simp
#align lists'.to_list_cons Lists'.toList_cons
@[simp]
def ofList : List (Lists α) → Lists' α true
| [] => nil
| a :: l => cons a (ofList l)
#align lists'.of_list Lists'.ofList
@[simp]
| Mathlib/SetTheory/Lists.lean | 99 | 99 | theorem to_ofList (l : List (Lists α)) : toList (ofList l) = l := by | induction l <;> simp [*]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 567 |
import Mathlib.Geometry.RingedSpace.PresheafedSpace
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.Topology.Sheaves.Stalks
#align_import algebraic_geometry.stalks from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
noncomputable section
universe v u v' u'
open Opposite CategoryTheory CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits
AlgebraicGeometry TopologicalSpace
variable {C : Type u} [Category.{v} C] [HasColimits C]
-- Porting note: no tidy tactic
-- attribute [local tidy] tactic.auto_cases_opens
-- this could be replaced by
-- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens
-- but it doesn't appear to be needed here.
open TopCat.Presheaf
namespace AlgebraicGeometry.PresheafedSpace
abbrev stalk (X : PresheafedSpace C) (x : X) : C :=
X.presheaf.stalk x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk AlgebraicGeometry.PresheafedSpace.stalk
def stalkMap {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (x : X) :
Y.stalk (α.base x) ⟶ X.stalk x :=
(stalkFunctor C (α.base x)).map α.c ≫ X.presheaf.stalkPushforward C α.base x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map AlgebraicGeometry.PresheafedSpace.stalkMap
@[elementwise, reassoc]
theorem stalkMap_germ {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (U : Opens Y)
(x : (Opens.map α.base).obj U) :
Y.presheaf.germ ⟨α.base x.1, x.2⟩ ≫ stalkMap α ↑x = α.c.app (op U) ≫ X.presheaf.germ x := by
rw [stalkMap, stalkFunctor_map_germ_assoc, stalkPushforward_germ]
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map_germ AlgebraicGeometry.PresheafedSpace.stalkMap_germ
@[simp, elementwise, reassoc]
theorem stalkMap_germ' {X Y : PresheafedSpace.{_, _, v} C}
(α : X ⟶ Y) (U : Opens Y) (x : X) (hx : α.base x ∈ U) :
Y.presheaf.germ ⟨α.base x, hx⟩ ≫ stalkMap α x = α.c.app (op U) ≫
X.presheaf.germ (U := (Opens.map α.base).obj U) ⟨x, hx⟩ :=
PresheafedSpace.stalkMap_germ α U ⟨x, hx⟩
section Restrict
def restrictStalkIso {U : TopCat} (X : PresheafedSpace.{_, _, v} C) {f : U ⟶ (X : TopCat.{v})}
(h : OpenEmbedding f) (x : U) : (X.restrict h).stalk x ≅ X.stalk (f x) :=
haveI := initial_of_adjunction (h.isOpenMap.adjunctionNhds x)
Final.colimitIso (h.isOpenMap.functorNhds x).op ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf)
-- As a left adjoint, the functor `h.is_open_map.functor_nhds x` is initial.
-- Typeclass resolution knows that the opposite of an initial functor is final. The result
-- follows from the general fact that postcomposing with a final functor doesn't change colimits.
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.restrict_stalk_iso AlgebraicGeometry.PresheafedSpace.restrictStalkIso
-- Porting note (#11119): removed `simp` attribute, for left hand side is not in simple normal form.
@[elementwise, reassoc]
theorem restrictStalkIso_hom_eq_germ {U : TopCat} (X : PresheafedSpace.{_, _, v} C)
{f : U ⟶ (X : TopCat.{v})} (h : OpenEmbedding f) (V : Opens U) (x : U) (hx : x ∈ V) :
(X.restrict h).presheaf.germ ⟨x, hx⟩ ≫ (restrictStalkIso X h x).hom =
X.presheaf.germ ⟨f x, show f x ∈ h.isOpenMap.functor.obj V from ⟨x, hx, rfl⟩⟩ :=
colimit.ι_pre ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf) (h.isOpenMap.functorNhds x).op
(op ⟨V, hx⟩)
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.restrict_stalk_iso_hom_eq_germ AlgebraicGeometry.PresheafedSpace.restrictStalkIso_hom_eq_germ
-- We intentionally leave `simp` off the lemmas generated by `elementwise` and `reassoc`,
-- as the simpNF linter claims they never apply.
@[simp, elementwise, reassoc]
| Mathlib/Geometry/RingedSpace/Stalks.lean | 99 | 104 | theorem restrictStalkIso_inv_eq_germ {U : TopCat} (X : PresheafedSpace.{_, _, v} C)
{f : U ⟶ (X : TopCat.{v})} (h : OpenEmbedding f) (V : Opens U) (x : U) (hx : x ∈ V) :
X.presheaf.germ ⟨f x, show f x ∈ h.isOpenMap.functor.obj V from ⟨x, hx, rfl⟩⟩ ≫
(restrictStalkIso X h x).inv =
(X.restrict h).presheaf.germ ⟨x, hx⟩ := by |
rw [← restrictStalkIso_hom_eq_germ, Category.assoc, Iso.hom_inv_id, Category.comp_id]
| 1 | 2.718282 | 0 | 0.875 | 8 | 765 |
import Mathlib.Data.Fin.Tuple.Basic
import Mathlib.Data.List.Join
#align_import data.list.of_fn from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b"
universe u
variable {α : Type u}
open Nat
namespace List
#noalign list.length_of_fn_aux
@[simp]
theorem length_ofFn_go {n} (f : Fin n → α) (i j h) : length (ofFn.go f i j h) = i := by
induction i generalizing j <;> simp_all [ofFn.go]
@[simp]
theorem length_ofFn {n} (f : Fin n → α) : length (ofFn f) = n := by
simp [ofFn, length_ofFn_go]
#align list.length_of_fn List.length_ofFn
#noalign list.nth_of_fn_aux
theorem get_ofFn_go {n} (f : Fin n → α) (i j h) (k) (hk) :
get (ofFn.go f i j h) ⟨k, hk⟩ = f ⟨j + k, by simp at hk; omega⟩ := by
let i+1 := i
cases k <;> simp [ofFn.go, get_ofFn_go (i := i)]
congr 2; omega
-- Porting note (#10756): new theorem
@[simp]
theorem get_ofFn {n} (f : Fin n → α) (i) : get (ofFn f) i = f (Fin.cast (by simp) i) := by
cases i; simp [ofFn, get_ofFn_go]
@[simp]
theorem get?_ofFn {n} (f : Fin n → α) (i) : get? (ofFn f) i = ofFnNthVal f i :=
if h : i < (ofFn f).length
then by
rw [get?_eq_get h, get_ofFn]
· simp only [length_ofFn] at h; simp [ofFnNthVal, h]
else by
rw [ofFnNthVal, dif_neg] <;>
simpa using h
#align list.nth_of_fn List.get?_ofFn
set_option linter.deprecated false in
@[deprecated get_ofFn (since := "2023-01-17")]
theorem nthLe_ofFn {n} (f : Fin n → α) (i : Fin n) :
nthLe (ofFn f) i ((length_ofFn f).symm ▸ i.2) = f i := by
simp [nthLe]
#align list.nth_le_of_fn List.nthLe_ofFn
set_option linter.deprecated false in
@[simp, deprecated get_ofFn (since := "2023-01-17")]
theorem nthLe_ofFn' {n} (f : Fin n → α) {i : ℕ} (h : i < (ofFn f).length) :
nthLe (ofFn f) i h = f ⟨i, length_ofFn f ▸ h⟩ :=
nthLe_ofFn f ⟨i, length_ofFn f ▸ h⟩
#align list.nth_le_of_fn' List.nthLe_ofFn'
@[simp]
theorem map_ofFn {β : Type*} {n : ℕ} (f : Fin n → α) (g : α → β) :
map g (ofFn f) = ofFn (g ∘ f) :=
ext_get (by simp) fun i h h' => by simp
#align list.map_of_fn List.map_ofFn
-- Porting note: we don't have Array' in mathlib4
--
-- theorem array_eq_of_fn {n} (a : Array' n α) : a.toList = ofFn a.read :=
-- by
-- suffices ∀ {m h l}, DArray.revIterateAux a (fun i => cons) m h l =
-- ofFnAux (DArray.read a) m h l
-- from this
-- intros; induction' m with m IH generalizing l; · rfl
-- simp only [DArray.revIterateAux, of_fn_aux, IH]
-- #align list.array_eq_of_fn List.array_eq_of_fn
@[congr]
theorem ofFn_congr {m n : ℕ} (h : m = n) (f : Fin m → α) :
ofFn f = ofFn fun i : Fin n => f (Fin.cast h.symm i) := by
subst h
simp_rw [Fin.cast_refl, id]
#align list.of_fn_congr List.ofFn_congr
@[simp]
theorem ofFn_zero (f : Fin 0 → α) : ofFn f = [] :=
ext_get (by simp) (fun i hi₁ hi₂ => by contradiction)
#align list.of_fn_zero List.ofFn_zero
@[simp]
theorem ofFn_succ {n} (f : Fin (succ n) → α) : ofFn f = f 0 :: ofFn fun i => f i.succ :=
ext_get (by simp) (fun i hi₁ hi₂ => by
cases i
· simp; rfl
· simp)
#align list.of_fn_succ List.ofFn_succ
theorem ofFn_succ' {n} (f : Fin (succ n) → α) :
ofFn f = (ofFn fun i => f (Fin.castSucc i)).concat (f (Fin.last _)) := by
induction' n with n IH
· rw [ofFn_zero, concat_nil, ofFn_succ, ofFn_zero]
rfl
· rw [ofFn_succ, IH, ofFn_succ, concat_cons, Fin.castSucc_zero]
congr
#align list.of_fn_succ' List.ofFn_succ'
@[simp]
| Mathlib/Data/List/OfFn.lean | 135 | 136 | theorem ofFn_eq_nil_iff {n : ℕ} {f : Fin n → α} : ofFn f = [] ↔ n = 0 := by |
cases n <;> simp only [ofFn_zero, ofFn_succ, eq_self_iff_true, Nat.succ_ne_zero]
| 1 | 2.718282 | 0 | 0.6 | 10 | 535 |
import Mathlib.Algebra.Algebra.Hom
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72"
universe uR uS uT uA u₄
variable {R : Type uR} [Semiring R]
variable {S : Type uS} [CommSemiring S]
variable {T : Type uT}
variable {A : Type uA} [Semiring A] [Algebra S A]
namespace RingQuot
inductive Rel (r : R → R → Prop) : R → R → Prop
| of ⦃x y : R⦄ (h : r x y) : Rel r x y
| add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c)
| mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c)
| mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c)
#align ring_quot.rel RingQuot.Rel
theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by
rw [add_comm a b, add_comm a c]
exact Rel.add_left h
#align ring_quot.rel.add_right RingQuot.Rel.add_right
| Mathlib/Algebra/RingQuot.lean | 67 | 68 | theorem Rel.neg {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b : R⦄ (h : Rel r a b) :
Rel r (-a) (-b) := by | simp only [neg_eq_neg_one_mul a, neg_eq_neg_one_mul b, Rel.mul_right h]
| 1 | 2.718282 | 0 | 0.5 | 6 | 490 |
import Mathlib.MeasureTheory.Measure.AEMeasurable
#align_import dynamics.ergodic.measure_preserving from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
variable {α β γ δ : Type*} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
[MeasurableSpace δ]
namespace MeasureTheory
open Measure Function Set
variable {μa : Measure α} {μb : Measure β} {μc : Measure γ} {μd : Measure δ}
structure MeasurePreserving (f : α → β)
(μa : Measure α := by volume_tac) (μb : Measure β := by volume_tac) : Prop where
protected measurable : Measurable f
protected map_eq : map f μa = μb
#align measure_theory.measure_preserving MeasureTheory.MeasurePreserving
#align measure_theory.measure_preserving.measurable MeasureTheory.MeasurePreserving.measurable
#align measure_theory.measure_preserving.map_eq MeasureTheory.MeasurePreserving.map_eq
protected theorem _root_.Measurable.measurePreserving
{f : α → β} (h : Measurable f) (μa : Measure α) : MeasurePreserving f μa (map f μa) :=
⟨h, rfl⟩
#align measurable.measure_preserving Measurable.measurePreserving
namespace MeasurePreserving
protected theorem id (μ : Measure α) : MeasurePreserving id μ μ :=
⟨measurable_id, map_id⟩
#align measure_theory.measure_preserving.id MeasureTheory.MeasurePreserving.id
protected theorem aemeasurable {f : α → β} (hf : MeasurePreserving f μa μb) : AEMeasurable f μa :=
hf.1.aemeasurable
#align measure_theory.measure_preserving.ae_measurable MeasureTheory.MeasurePreserving.aemeasurable
@[nontriviality]
theorem of_isEmpty [IsEmpty β] (f : α → β) (μa : Measure α) (μb : Measure β) :
MeasurePreserving f μa μb :=
⟨measurable_of_subsingleton_codomain _, Subsingleton.elim _ _⟩
theorem symm (e : α ≃ᵐ β) {μa : Measure α} {μb : Measure β} (h : MeasurePreserving e μa μb) :
MeasurePreserving e.symm μb μa :=
⟨e.symm.measurable, by
rw [← h.map_eq, map_map e.symm.measurable e.measurable, e.symm_comp_self, map_id]⟩
#align measure_theory.measure_preserving.symm MeasureTheory.MeasurePreserving.symm
theorem restrict_preimage {f : α → β} (hf : MeasurePreserving f μa μb) {s : Set β}
(hs : MeasurableSet s) : MeasurePreserving f (μa.restrict (f ⁻¹' s)) (μb.restrict s) :=
⟨hf.measurable, by rw [← hf.map_eq, restrict_map hf.measurable hs]⟩
#align measure_theory.measure_preserving.restrict_preimage MeasureTheory.MeasurePreserving.restrict_preimage
theorem restrict_preimage_emb {f : α → β} (hf : MeasurePreserving f μa μb)
(h₂ : MeasurableEmbedding f) (s : Set β) :
MeasurePreserving f (μa.restrict (f ⁻¹' s)) (μb.restrict s) :=
⟨hf.measurable, by rw [← hf.map_eq, h₂.restrict_map]⟩
#align measure_theory.measure_preserving.restrict_preimage_emb MeasureTheory.MeasurePreserving.restrict_preimage_emb
theorem restrict_image_emb {f : α → β} (hf : MeasurePreserving f μa μb) (h₂ : MeasurableEmbedding f)
(s : Set α) : MeasurePreserving f (μa.restrict s) (μb.restrict (f '' s)) := by
simpa only [Set.preimage_image_eq _ h₂.injective] using hf.restrict_preimage_emb h₂ (f '' s)
#align measure_theory.measure_preserving.restrict_image_emb MeasureTheory.MeasurePreserving.restrict_image_emb
| Mathlib/Dynamics/Ergodic/MeasurePreserving.lean | 92 | 94 | theorem aemeasurable_comp_iff {f : α → β} (hf : MeasurePreserving f μa μb)
(h₂ : MeasurableEmbedding f) {g : β → γ} : AEMeasurable (g ∘ f) μa ↔ AEMeasurable g μb := by |
rw [← hf.map_eq, h₂.aemeasurable_map_iff]
| 1 | 2.718282 | 0 | 0 | 2 | 184 |
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)]
theorem imageSubobject_arrow' :
(imageSubobjectIso f).inv ≫ (imageSubobject f).arrow = image.ι f := by simp [imageSubobjectIso]
#align category_theory.limits.image_subobject_arrow' CategoryTheory.Limits.imageSubobject_arrow'
def factorThruImageSubobject : X ⟶ imageSubobject f :=
factorThruImage f ≫ (imageSubobjectIso f).inv
#align category_theory.limits.factor_thru_image_subobject CategoryTheory.Limits.factorThruImageSubobject
instance [HasEqualizers C] : Epi (factorThruImageSubobject f) := by
dsimp [factorThruImageSubobject]
apply epi_comp
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem imageSubobject_arrow_comp : factorThruImageSubobject f ≫ (imageSubobject f).arrow = f := by
simp [factorThruImageSubobject, imageSubobject_arrow]
#align category_theory.limits.image_subobject_arrow_comp CategoryTheory.Limits.imageSubobject_arrow_comp
theorem imageSubobject_arrow_comp_eq_zero [HasZeroMorphisms C] {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z}
[HasImage f] [Epi (factorThruImageSubobject f)] (h : f ≫ g = 0) :
(imageSubobject f).arrow ≫ g = 0 :=
zero_of_epi_comp (factorThruImageSubobject f) <| by simp [h]
#align category_theory.limits.image_subobject_arrow_comp_eq_zero CategoryTheory.Limits.imageSubobject_arrow_comp_eq_zero
theorem imageSubobject_factors_comp_self {W : C} (k : W ⟶ X) : (imageSubobject f).Factors (k ≫ f) :=
⟨k ≫ factorThruImage f, by simp⟩
#align category_theory.limits.image_subobject_factors_comp_self CategoryTheory.Limits.imageSubobject_factors_comp_self
@[simp]
theorem factorThruImageSubobject_comp_self {W : C} (k : W ⟶ X) (h) :
(imageSubobject f).factorThru (k ≫ f) h = k ≫ factorThruImageSubobject f := by
ext
simp
#align category_theory.limits.factor_thru_image_subobject_comp_self CategoryTheory.Limits.factorThruImageSubobject_comp_self
@[simp]
theorem factorThruImageSubobject_comp_self_assoc {W W' : C} (k : W ⟶ W') (k' : W' ⟶ X) (h) :
(imageSubobject f).factorThru (k ≫ k' ≫ f) h = k ≫ k' ≫ factorThruImageSubobject f := by
ext
simp
#align category_theory.limits.factor_thru_image_subobject_comp_self_assoc CategoryTheory.Limits.factorThruImageSubobject_comp_self_assoc
theorem imageSubobject_comp_le {X' : C} (h : X' ⟶ X) (f : X ⟶ Y) [HasImage f] [HasImage (h ≫ f)] :
imageSubobject (h ≫ f) ≤ imageSubobject f :=
Subobject.mk_le_mk_of_comm (image.preComp h f) (by simp)
#align category_theory.limits.image_subobject_comp_le CategoryTheory.Limits.imageSubobject_comp_le
section
open ZeroObject
variable [HasZeroMorphisms C] [HasZeroObject C]
@[simp]
theorem imageSubobject_zero_arrow : (imageSubobject (0 : X ⟶ Y)).arrow = 0 := by
rw [← imageSubobject_arrow]
simp
#align category_theory.limits.image_subobject_zero_arrow CategoryTheory.Limits.imageSubobject_zero_arrow
@[simp]
theorem imageSubobject_zero {A B : C} : imageSubobject (0 : A ⟶ B) = ⊥ :=
Subobject.eq_of_comm (imageSubobjectIso _ ≪≫ imageZero ≪≫ Subobject.botCoeIsoZero.symm) (by simp)
#align category_theory.limits.image_subobject_zero CategoryTheory.Limits.imageSubobject_zero
end
section
variable [HasEqualizers C]
attribute [local instance] epi_comp
instance imageSubobject_comp_le_epi_of_epi {X' : C} (h : X' ⟶ X) [Epi h] (f : X ⟶ Y) [HasImage f]
[HasImage (h ≫ f)] : Epi (Subobject.ofLE _ _ (imageSubobject_comp_le h f)) := by
rw [ofLE_mk_le_mk_of_comm (image.preComp h f)]
· infer_instance
· simp
#align category_theory.limits.image_subobject_comp_le_epi_of_epi CategoryTheory.Limits.imageSubobject_comp_le_epi_of_epi
end
section
variable [HasEqualizers C]
def imageSubobjectCompIso (f : X ⟶ Y) [HasImage f] {Y' : C} (h : Y ⟶ Y') [IsIso h] :
(imageSubobject (f ≫ h) : C) ≅ (imageSubobject f : C) :=
imageSubobjectIso _ ≪≫ (image.compIso _ _).symm ≪≫ (imageSubobjectIso _).symm
#align category_theory.limits.image_subobject_comp_iso CategoryTheory.Limits.imageSubobjectCompIso
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 412 | 415 | theorem imageSubobjectCompIso_hom_arrow (f : X ⟶ Y) [HasImage f] {Y' : C} (h : Y ⟶ Y') [IsIso h] :
(imageSubobjectCompIso f h).hom ≫ (imageSubobject f).arrow =
(imageSubobject (f ≫ h)).arrow ≫ inv h := by |
simp [imageSubobjectCompIso]
| 1 | 2.718282 | 0 | 0.263158 | 19 | 308 |
import Mathlib.Analysis.BoxIntegral.Partition.SubboxInduction
import Mathlib.Analysis.BoxIntegral.Partition.Split
#align_import analysis.box_integral.partition.filter from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open Set Function Filter Metric Finset Bool
open scoped Classical
open Topology Filter NNReal
noncomputable section
namespace BoxIntegral
variable {ι : Type*} [Fintype ι] {I J : Box ι} {c c₁ c₂ : ℝ≥0} {r r₁ r₂ : (ι → ℝ) → Ioi (0 : ℝ)}
{π π₁ π₂ : TaggedPrepartition I}
open TaggedPrepartition
@[ext]
structure IntegrationParams : Type where
(bRiemann bHenstock bDistortion : Bool)
#align box_integral.integration_params BoxIntegral.IntegrationParams
variable {l l₁ l₂ : IntegrationParams}
namespace IntegrationParams
def equivProd : IntegrationParams ≃ Bool × Boolᵒᵈ × Boolᵒᵈ where
toFun l := ⟨l.1, OrderDual.toDual l.2, OrderDual.toDual l.3⟩
invFun l := ⟨l.1, OrderDual.ofDual l.2.1, OrderDual.ofDual l.2.2⟩
left_inv _ := rfl
right_inv _ := rfl
#align box_integral.integration_params.equiv_prod BoxIntegral.IntegrationParams.equivProd
instance : PartialOrder IntegrationParams :=
PartialOrder.lift equivProd equivProd.injective
def isoProd : IntegrationParams ≃o Bool × Boolᵒᵈ × Boolᵒᵈ :=
⟨equivProd, Iff.rfl⟩
#align box_integral.integration_params.iso_prod BoxIntegral.IntegrationParams.isoProd
instance : BoundedOrder IntegrationParams :=
isoProd.symm.toGaloisInsertion.liftBoundedOrder
instance : Inhabited IntegrationParams :=
⟨⊥⟩
instance : DecidableRel ((· ≤ ·) : IntegrationParams → IntegrationParams → Prop) :=
fun _ _ => And.decidable
instance : DecidableEq IntegrationParams :=
fun x y => decidable_of_iff _ (IntegrationParams.ext_iff x y).symm
def Riemann : IntegrationParams where
bRiemann := true
bHenstock := true
bDistortion := false
set_option linter.uppercaseLean3 false in
#align box_integral.integration_params.Riemann BoxIntegral.IntegrationParams.Riemann
def Henstock : IntegrationParams :=
⟨false, true, false⟩
set_option linter.uppercaseLean3 false in
#align box_integral.integration_params.Henstock BoxIntegral.IntegrationParams.Henstock
def McShane : IntegrationParams :=
⟨false, false, false⟩
set_option linter.uppercaseLean3 false in
#align box_integral.integration_params.McShane BoxIntegral.IntegrationParams.McShane
def GP : IntegrationParams := ⊥
set_option linter.uppercaseLean3 false in
#align box_integral.integration_params.GP BoxIntegral.IntegrationParams.GP
theorem henstock_le_riemann : Henstock ≤ Riemann := by trivial
set_option linter.uppercaseLean3 false in
#align box_integral.integration_params.Henstock_le_Riemann BoxIntegral.IntegrationParams.henstock_le_riemann
theorem henstock_le_mcShane : Henstock ≤ McShane := by trivial
set_option linter.uppercaseLean3 false in
#align box_integral.integration_params.Henstock_le_McShane BoxIntegral.IntegrationParams.henstock_le_mcShane
theorem gp_le : GP ≤ l :=
bot_le
set_option linter.uppercaseLean3 false in
#align box_integral.integration_params.GP_le BoxIntegral.IntegrationParams.gp_le
structure MemBaseSet (l : IntegrationParams) (I : Box ι) (c : ℝ≥0) (r : (ι → ℝ) → Ioi (0 : ℝ))
(π : TaggedPrepartition I) : Prop where
protected isSubordinate : π.IsSubordinate r
protected isHenstock : l.bHenstock → π.IsHenstock
protected distortion_le : l.bDistortion → π.distortion ≤ c
protected exists_compl : l.bDistortion → ∃ π' : Prepartition I,
π'.iUnion = ↑I \ π.iUnion ∧ π'.distortion ≤ c
#align box_integral.integration_params.mem_base_set BoxIntegral.IntegrationParams.MemBaseSet
def RCond {ι : Type*} (l : IntegrationParams) (r : (ι → ℝ) → Ioi (0 : ℝ)) : Prop :=
l.bRiemann → ∀ x, r x = r 0
#align box_integral.integration_params.r_cond BoxIntegral.IntegrationParams.RCond
def toFilterDistortion (l : IntegrationParams) (I : Box ι) (c : ℝ≥0) :
Filter (TaggedPrepartition I) :=
⨅ (r : (ι → ℝ) → Ioi (0 : ℝ)) (_ : l.RCond r), 𝓟 { π | l.MemBaseSet I c r π }
#align box_integral.integration_params.to_filter_distortion BoxIntegral.IntegrationParams.toFilterDistortion
def toFilter (l : IntegrationParams) (I : Box ι) : Filter (TaggedPrepartition I) :=
⨆ c : ℝ≥0, l.toFilterDistortion I c
#align box_integral.integration_params.to_filter BoxIntegral.IntegrationParams.toFilter
def toFilterDistortioniUnion (l : IntegrationParams) (I : Box ι) (c : ℝ≥0) (π₀ : Prepartition I) :=
l.toFilterDistortion I c ⊓ 𝓟 { π | π.iUnion = π₀.iUnion }
#align box_integral.integration_params.to_filter_distortion_Union BoxIntegral.IntegrationParams.toFilterDistortioniUnion
def toFilteriUnion (l : IntegrationParams) (I : Box ι) (π₀ : Prepartition I) :=
⨆ c : ℝ≥0, l.toFilterDistortioniUnion I c π₀
#align box_integral.integration_params.to_filter_Union BoxIntegral.IntegrationParams.toFilteriUnion
| Mathlib/Analysis/BoxIntegral/Partition/Filter.lean | 347 | 349 | theorem rCond_of_bRiemann_eq_false {ι} (l : IntegrationParams) (hl : l.bRiemann = false)
{r : (ι → ℝ) → Ioi (0 : ℝ)} : l.RCond r := by |
simp [RCond, hl]
| 1 | 2.718282 | 0 | 0 | 3 | 87 |
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.MkIffOfInductiveProp
#align_import data.sum.basic from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc"
universe u v w x
variable {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {γ δ : Type*}
namespace Sum
#align sum.forall Sum.forall
#align sum.exists Sum.exists
theorem exists_sum {γ : α ⊕ β → Sort*} (p : (∀ ab, γ ab) → Prop) :
(∃ fab, p fab) ↔ (∃ fa fb, p (Sum.rec fa fb)) := by
rw [← not_forall_not, forall_sum]
simp
theorem inl_injective : Function.Injective (inl : α → Sum α β) := fun _ _ ↦ inl.inj
#align sum.inl_injective Sum.inl_injective
theorem inr_injective : Function.Injective (inr : β → Sum α β) := fun _ _ ↦ inr.inj
#align sum.inr_injective Sum.inr_injective
theorem sum_rec_congr (P : α ⊕ β → Sort*) (f : ∀ i, P (inl i)) (g : ∀ i, P (inr i))
{x y : α ⊕ β} (h : x = y) :
@Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by cases h; rfl
#align sum.inl.inj_iff Sum.inl.inj_iff
#align sum.inr.inj_iff Sum.inr.inj_iff
#align sum.inl_ne_inr Sum.inl_ne_inr
#align sum.inr_ne_inl Sum.inr_ne_inl
#align sum.elim Sum.elim
#align sum.elim_inl Sum.elim_inl
#align sum.elim_inr Sum.elim_inr
#align sum.elim_comp_inl Sum.elim_comp_inl
#align sum.elim_comp_inr Sum.elim_comp_inr
#align sum.elim_inl_inr Sum.elim_inl_inr
#align sum.comp_elim Sum.comp_elim
#align sum.elim_comp_inl_inr Sum.elim_comp_inl_inr
#align sum.map Sum.map
#align sum.map_inl Sum.map_inl
#align sum.map_inr Sum.map_inr
#align sum.map_map Sum.map_map
#align sum.map_comp_map Sum.map_comp_map
#align sum.map_id_id Sum.map_id_id
#align sum.elim_map Sum.elim_map
#align sum.elim_comp_map Sum.elim_comp_map
#align sum.is_left_map Sum.isLeft_map
#align sum.is_right_map Sum.isRight_map
#align sum.get_left_map Sum.getLeft?_map
#align sum.get_right_map Sum.getRight?_map
open Function (update update_eq_iff update_comp_eq_of_injective update_comp_eq_of_forall_ne)
@[simp]
theorem update_elim_inl [DecidableEq α] [DecidableEq (Sum α β)] {f : α → γ} {g : β → γ} {i : α}
{x : γ} : update (Sum.elim f g) (inl i) x = Sum.elim (update f i x) g :=
update_eq_iff.2 ⟨by simp, by simp (config := { contextual := true })⟩
#align sum.update_elim_inl Sum.update_elim_inl
@[simp]
theorem update_elim_inr [DecidableEq β] [DecidableEq (Sum α β)] {f : α → γ} {g : β → γ} {i : β}
{x : γ} : update (Sum.elim f g) (inr i) x = Sum.elim f (update g i x) :=
update_eq_iff.2 ⟨by simp, by simp (config := { contextual := true })⟩
#align sum.update_elim_inr Sum.update_elim_inr
@[simp]
theorem update_inl_comp_inl [DecidableEq α] [DecidableEq (Sum α β)] {f : Sum α β → γ} {i : α}
{x : γ} : update f (inl i) x ∘ inl = update (f ∘ inl) i x :=
update_comp_eq_of_injective _ inl_injective _ _
#align sum.update_inl_comp_inl Sum.update_inl_comp_inl
@[simp]
| Mathlib/Data/Sum/Basic.lean | 132 | 134 | theorem update_inl_apply_inl [DecidableEq α] [DecidableEq (Sum α β)] {f : Sum α β → γ} {i j : α}
{x : γ} : update f (inl i) x (inl j) = update (f ∘ inl) i x j := by |
rw [← update_inl_comp_inl, Function.comp_apply]
| 1 | 2.718282 | 0 | 0.142857 | 7 | 254 |
import Mathlib.Algebra.ContinuedFractions.Basic
import Mathlib.Algebra.GroupWithZero.Basic
#align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
section General
variable {α : Type*} {g : GeneralizedContinuedFraction α} {n : ℕ}
| Mathlib/Algebra/ContinuedFractions/Translations.lean | 35 | 35 | theorem terminatedAt_iff_s_terminatedAt : g.TerminatedAt n ↔ g.s.TerminatedAt n := by | rfl
| 1 | 2.718282 | 0 | 0.052632 | 19 | 240 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Order.WithBot
#align_import data.set.image from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29"
universe u v
open Function Set
namespace Set
variable {α β γ : Type*} {ι ι' : Sort*}
section Image
variable {f : α → β} {s t : Set α}
-- Porting note: `Set.image` is already defined in `Init.Set`
#align set.image Set.image
@[deprecated mem_image (since := "2024-03-23")]
theorem mem_image_iff_bex {f : α → β} {s : Set α} {y : β} :
y ∈ f '' s ↔ ∃ (x : _) (_ : x ∈ s), f x = y :=
bex_def.symm
#align set.mem_image_iff_bex Set.mem_image_iff_bex
theorem image_eta (f : α → β) : f '' s = (fun x => f x) '' s :=
rfl
#align set.image_eta Set.image_eta
theorem _root_.Function.Injective.mem_set_image {f : α → β} (hf : Injective f) {s : Set α} {a : α} :
f a ∈ f '' s ↔ a ∈ s :=
⟨fun ⟨_, hb, Eq⟩ => hf Eq ▸ hb, mem_image_of_mem f⟩
#align function.injective.mem_set_image Function.Injective.mem_set_image
theorem forall_mem_image {f : α → β} {s : Set α} {p : β → Prop} :
(∀ y ∈ f '' s, p y) ↔ ∀ ⦃x⦄, x ∈ s → p (f x) := by simp
#align set.ball_image_iff Set.forall_mem_image
theorem exists_mem_image {f : α → β} {s : Set α} {p : β → Prop} :
(∃ y ∈ f '' s, p y) ↔ ∃ x ∈ s, p (f x) := by simp
#align set.bex_image_iff Set.exists_mem_image
@[deprecated (since := "2024-02-21")] alias ball_image_iff := forall_mem_image
@[deprecated (since := "2024-02-21")] alias bex_image_iff := exists_mem_image
@[deprecated (since := "2024-02-21")] alias ⟨_, ball_image_of_ball⟩ := forall_mem_image
#align set.ball_image_of_ball Set.ball_image_of_ball
@[deprecated forall_mem_image (since := "2024-02-21")]
theorem mem_image_elim {f : α → β} {s : Set α} {C : β → Prop} (h : ∀ x : α, x ∈ s → C (f x)) :
∀ {y : β}, y ∈ f '' s → C y := forall_mem_image.2 h _
#align set.mem_image_elim Set.mem_image_elim
@[deprecated forall_mem_image (since := "2024-02-21")]
theorem mem_image_elim_on {f : α → β} {s : Set α} {C : β → Prop} {y : β} (h_y : y ∈ f '' s)
(h : ∀ x : α, x ∈ s → C (f x)) : C y := forall_mem_image.2 h _ h_y
#align set.mem_image_elim_on Set.mem_image_elim_on
-- Porting note: used to be `safe`
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
ext x
exact exists_congr fun a ↦ and_congr_right fun ha ↦ by rw [h a ha]
#align set.image_congr Set.image_congr
theorem image_congr' {f g : α → β} {s : Set α} (h : ∀ x : α, f x = g x) : f '' s = g '' s :=
image_congr fun x _ => h x
#align set.image_congr' Set.image_congr'
@[gcongr]
lemma image_mono (h : s ⊆ t) : f '' s ⊆ f '' t := by
rintro - ⟨a, ha, rfl⟩; exact mem_image_of_mem f (h ha)
theorem image_comp (f : β → γ) (g : α → β) (a : Set α) : f ∘ g '' a = f '' (g '' a) := by aesop
#align set.image_comp Set.image_comp
theorem image_comp_eq {g : β → γ} : image (g ∘ f) = image g ∘ image f := by ext; simp
theorem image_image (g : β → γ) (f : α → β) (s : Set α) : g '' (f '' s) = (fun x => g (f x)) '' s :=
(image_comp g f s).symm
#align set.image_image Set.image_image
| Mathlib/Data/Set/Image.lean | 273 | 275 | theorem image_comm {β'} {f : β → γ} {g : α → β} {f' : α → β'} {g' : β' → γ}
(h_comm : ∀ a, f (g a) = g' (f' a)) : (s.image g).image f = (s.image f').image g' := by |
simp_rw [image_image, h_comm]
| 1 | 2.718282 | 0 | 0.666667 | 15 | 590 |
import Mathlib.Analysis.SpecialFunctions.Complex.Log
#align_import analysis.special_functions.pow.complex from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open scoped Classical
open Real Topology Filter ComplexConjugate Finset Set
namespace Complex
noncomputable def cpow (x y : ℂ) : ℂ :=
if x = 0 then if y = 0 then 1 else 0 else exp (log x * y)
#align complex.cpow Complex.cpow
noncomputable instance : Pow ℂ ℂ :=
⟨cpow⟩
@[simp]
theorem cpow_eq_pow (x y : ℂ) : cpow x y = x ^ y :=
rfl
#align complex.cpow_eq_pow Complex.cpow_eq_pow
theorem cpow_def (x y : ℂ) : x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) :=
rfl
#align complex.cpow_def Complex.cpow_def
theorem cpow_def_of_ne_zero {x : ℂ} (hx : x ≠ 0) (y : ℂ) : x ^ y = exp (log x * y) :=
if_neg hx
#align complex.cpow_def_of_ne_zero Complex.cpow_def_of_ne_zero
@[simp]
theorem cpow_zero (x : ℂ) : x ^ (0 : ℂ) = 1 := by simp [cpow_def]
#align complex.cpow_zero Complex.cpow_zero
@[simp]
theorem cpow_eq_zero_iff (x y : ℂ) : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by
simp only [cpow_def]
split_ifs <;> simp [*, exp_ne_zero]
#align complex.cpow_eq_zero_iff Complex.cpow_eq_zero_iff
@[simp]
theorem zero_cpow {x : ℂ} (h : x ≠ 0) : (0 : ℂ) ^ x = 0 := by simp [cpow_def, *]
#align complex.zero_cpow Complex.zero_cpow
theorem zero_cpow_eq_iff {x : ℂ} {a : ℂ} : (0 : ℂ) ^ x = a ↔ x ≠ 0 ∧ a = 0 ∨ x = 0 ∧ a = 1 := by
constructor
· intro hyp
simp only [cpow_def, eq_self_iff_true, if_true] at hyp
by_cases h : x = 0
· subst h
simp only [if_true, eq_self_iff_true] at hyp
right
exact ⟨rfl, hyp.symm⟩
· rw [if_neg h] at hyp
left
exact ⟨h, hyp.symm⟩
· rintro (⟨h, rfl⟩ | ⟨rfl, rfl⟩)
· exact zero_cpow h
· exact cpow_zero _
#align complex.zero_cpow_eq_iff Complex.zero_cpow_eq_iff
| Mathlib/Analysis/SpecialFunctions/Pow/Complex.lean | 75 | 76 | theorem eq_zero_cpow_iff {x : ℂ} {a : ℂ} : a = (0 : ℂ) ^ x ↔ x ≠ 0 ∧ a = 0 ∨ x = 0 ∧ a = 1 := by |
rw [← zero_cpow_eq_iff, eq_comm]
| 1 | 2.718282 | 0 | 0.636364 | 11 | 551 |
import Mathlib.CategoryTheory.EpiMono
import Mathlib.CategoryTheory.Functor.FullyFaithful
import Mathlib.Tactic.PPWithUniv
import Mathlib.Data.Set.Defs
#align_import category_theory.types from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
namespace CategoryTheory
-- morphism levels before object levels. See note [CategoryTheory universes].
universe v v' w u u'
@[to_additive existing CategoryTheory.types]
instance types : LargeCategory (Type u) where
Hom a b := a → b
id a := id
comp f g := g ∘ f
#align category_theory.types CategoryTheory.types
theorem types_hom {α β : Type u} : (α ⟶ β) = (α → β) :=
rfl
#align category_theory.types_hom CategoryTheory.types_hom
-- porting note (#10688): this lemma was not here in Lean 3. Lean 3 `ext` would solve this goal
-- because of its "if all else fails, apply all `ext` lemmas" policy,
-- which apparently we want to move away from.
@[ext] theorem types_ext {α β : Type u} (f g : α ⟶ β) (h : ∀ a : α, f a = g a) : f = g := by
funext x
exact h x
theorem types_id (X : Type u) : 𝟙 X = id :=
rfl
#align category_theory.types_id CategoryTheory.types_id
theorem types_comp {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z) : f ≫ g = g ∘ f :=
rfl
#align category_theory.types_comp CategoryTheory.types_comp
@[simp]
theorem types_id_apply (X : Type u) (x : X) : (𝟙 X : X → X) x = x :=
rfl
#align category_theory.types_id_apply CategoryTheory.types_id_apply
@[simp]
theorem types_comp_apply {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) : (f ≫ g) x = g (f x) :=
rfl
#align category_theory.types_comp_apply CategoryTheory.types_comp_apply
@[simp]
theorem hom_inv_id_apply {X Y : Type u} (f : X ≅ Y) (x : X) : f.inv (f.hom x) = x :=
congr_fun f.hom_inv_id x
#align category_theory.hom_inv_id_apply CategoryTheory.hom_inv_id_apply
@[simp]
theorem inv_hom_id_apply {X Y : Type u} (f : X ≅ Y) (y : Y) : f.hom (f.inv y) = y :=
congr_fun f.inv_hom_id y
#align category_theory.inv_hom_id_apply CategoryTheory.inv_hom_id_apply
-- Unfortunately without this wrapper we can't use `CategoryTheory` idioms, such as `IsIso f`.
abbrev asHom {α β : Type u} (f : α → β) : α ⟶ β :=
f
#align category_theory.as_hom CategoryTheory.asHom
@[inherit_doc]
scoped notation "↾" f:200 => CategoryTheory.asHom f
section
-- We verify the expected type checking behaviour of `asHom`
variable (α β γ : Type u) (f : α → β) (g : β → γ)
example : α → γ :=
↾f ≫ ↾g
example [IsIso (↾f)] : Mono (↾f) := by infer_instance
example [IsIso (↾f)] : ↾f ≫ inv (↾f) = 𝟙 α := by simp
end
namespace FunctorToTypes
variable {C : Type u} [Category.{v} C] (F G H : C ⥤ Type w) {X Y Z : C}
variable (σ : F ⟶ G) (τ : G ⟶ H)
@[simp]
| Mathlib/CategoryTheory/Types.lean | 152 | 153 | theorem map_comp_apply (f : X ⟶ Y) (g : Y ⟶ Z) (a : F.obj X) :
(F.map (f ≫ g)) a = (F.map g) ((F.map f) a) := by | simp [types_comp]
| 1 | 2.718282 | 0 | 0.8 | 5 | 702 |
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset
import Mathlib.Data.Finite.Card
import Mathlib.GroupTheory.Finiteness
import Mathlib.GroupTheory.GroupAction.Quotient
#align_import group_theory.index from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
namespace Subgroup
open Cardinal
variable {G : Type*} [Group G] (H K L : Subgroup G)
@[to_additive "The index of a subgroup as a natural number,
and returns 0 if the index is infinite."]
noncomputable def index : ℕ :=
Nat.card (G ⧸ H)
#align subgroup.index Subgroup.index
#align add_subgroup.index AddSubgroup.index
@[to_additive "The relative index of a subgroup as a natural number,
and returns 0 if the relative index is infinite."]
noncomputable def relindex : ℕ :=
(H.subgroupOf K).index
#align subgroup.relindex Subgroup.relindex
#align add_subgroup.relindex AddSubgroup.relindex
@[to_additive]
theorem index_comap_of_surjective {G' : Type*} [Group G'] {f : G' →* G}
(hf : Function.Surjective f) : (H.comap f).index = H.index := by
letI := QuotientGroup.leftRel H
letI := QuotientGroup.leftRel (H.comap f)
have key : ∀ x y : G', Setoid.r x y ↔ Setoid.r (f x) (f y) := by
simp only [QuotientGroup.leftRel_apply]
exact fun x y => iff_of_eq (congr_arg (· ∈ H) (by rw [f.map_mul, f.map_inv]))
refine Cardinal.toNat_congr (Equiv.ofBijective (Quotient.map' f fun x y => (key x y).mp) ⟨?_, ?_⟩)
· simp_rw [← Quotient.eq''] at key
refine Quotient.ind' fun x => ?_
refine Quotient.ind' fun y => ?_
exact (key x y).mpr
· refine Quotient.ind' fun x => ?_
obtain ⟨y, hy⟩ := hf x
exact ⟨y, (Quotient.map'_mk'' f _ y).trans (congr_arg Quotient.mk'' hy)⟩
#align subgroup.index_comap_of_surjective Subgroup.index_comap_of_surjective
#align add_subgroup.index_comap_of_surjective AddSubgroup.index_comap_of_surjective
@[to_additive]
theorem index_comap {G' : Type*} [Group G'] (f : G' →* G) :
(H.comap f).index = H.relindex f.range :=
Eq.trans (congr_arg index (by rfl))
((H.subgroupOf f.range).index_comap_of_surjective f.rangeRestrict_surjective)
#align subgroup.index_comap Subgroup.index_comap
#align add_subgroup.index_comap AddSubgroup.index_comap
@[to_additive]
theorem relindex_comap {G' : Type*} [Group G'] (f : G' →* G) (K : Subgroup G') :
relindex (comap f H) K = relindex H (map f K) := by
rw [relindex, subgroupOf, comap_comap, index_comap, ← f.map_range, K.subtype_range]
#align subgroup.relindex_comap Subgroup.relindex_comap
#align add_subgroup.relindex_comap AddSubgroup.relindex_comap
variable {H K L}
@[to_additive relindex_mul_index]
theorem relindex_mul_index (h : H ≤ K) : H.relindex K * K.index = H.index :=
((mul_comm _ _).trans (Cardinal.toNat_mul _ _).symm).trans
(congr_arg Cardinal.toNat (Equiv.cardinal_eq (quotientEquivProdOfLE h))).symm
#align subgroup.relindex_mul_index Subgroup.relindex_mul_index
#align add_subgroup.relindex_mul_index AddSubgroup.relindex_mul_index
@[to_additive]
theorem index_dvd_of_le (h : H ≤ K) : K.index ∣ H.index :=
dvd_of_mul_left_eq (H.relindex K) (relindex_mul_index h)
#align subgroup.index_dvd_of_le Subgroup.index_dvd_of_le
#align add_subgroup.index_dvd_of_le AddSubgroup.index_dvd_of_le
@[to_additive]
theorem relindex_dvd_index_of_le (h : H ≤ K) : H.relindex K ∣ H.index :=
dvd_of_mul_right_eq K.index (relindex_mul_index h)
#align subgroup.relindex_dvd_index_of_le Subgroup.relindex_dvd_index_of_le
#align add_subgroup.relindex_dvd_index_of_le AddSubgroup.relindex_dvd_index_of_le
@[to_additive]
theorem relindex_subgroupOf (hKL : K ≤ L) :
(H.subgroupOf L).relindex (K.subgroupOf L) = H.relindex K :=
((index_comap (H.subgroupOf L) (inclusion hKL)).trans (congr_arg _ (inclusion_range hKL))).symm
#align subgroup.relindex_subgroup_of Subgroup.relindex_subgroupOf
#align add_subgroup.relindex_add_subgroup_of AddSubgroup.relindex_addSubgroupOf
variable (H K L)
@[to_additive relindex_mul_relindex]
theorem relindex_mul_relindex (hHK : H ≤ K) (hKL : K ≤ L) :
H.relindex K * K.relindex L = H.relindex L := by
rw [← relindex_subgroupOf hKL]
exact relindex_mul_index fun x hx => hHK hx
#align subgroup.relindex_mul_relindex Subgroup.relindex_mul_relindex
#align add_subgroup.relindex_mul_relindex AddSubgroup.relindex_mul_relindex
@[to_additive]
theorem inf_relindex_right : (H ⊓ K).relindex K = H.relindex K := by
rw [relindex, relindex, inf_subgroupOf_right]
#align subgroup.inf_relindex_right Subgroup.inf_relindex_right
#align add_subgroup.inf_relindex_right AddSubgroup.inf_relindex_right
@[to_additive]
| Mathlib/GroupTheory/Index.lean | 140 | 141 | theorem inf_relindex_left : (H ⊓ K).relindex H = K.relindex H := by |
rw [inf_comm, inf_relindex_right]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 611 |
import Mathlib.Algebra.BigOperators.Module
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Order.Filter.ModEq
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Data.List.TFAE
import Mathlib.Analysis.NormedSpace.Basic
#align_import analysis.specific_limits.normed from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Set Function Filter Finset Metric Asymptotics
open scoped Classical
open Topology Nat uniformity NNReal ENNReal
variable {α : Type*} {β : Type*} {ι : Type*}
theorem tendsto_norm_atTop_atTop : Tendsto (norm : ℝ → ℝ) atTop atTop :=
tendsto_abs_atTop_atTop
#align tendsto_norm_at_top_at_top tendsto_norm_atTop_atTop
theorem summable_of_absolute_convergence_real {f : ℕ → ℝ} :
(∃ r, Tendsto (fun n ↦ ∑ i ∈ range n, |f i|) atTop (𝓝 r)) → Summable f
| ⟨r, hr⟩ => by
refine .of_norm ⟨r, (hasSum_iff_tendsto_nat_of_nonneg ?_ _).2 ?_⟩
· exact fun i ↦ norm_nonneg _
· simpa only using hr
#align summable_of_absolute_convergence_real summable_of_absolute_convergence_real
theorem tendsto_norm_zero' {𝕜 : Type*} [NormedAddCommGroup 𝕜] :
Tendsto (norm : 𝕜 → ℝ) (𝓝[≠] 0) (𝓝[>] 0) :=
tendsto_norm_zero.inf <| tendsto_principal_principal.2 fun _ hx ↦ norm_pos_iff.2 hx
#align tendsto_norm_zero' tendsto_norm_zero'
namespace NormedField
theorem tendsto_norm_inverse_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] :
Tendsto (fun x : 𝕜 ↦ ‖x⁻¹‖) (𝓝[≠] 0) atTop :=
(tendsto_inv_zero_atTop.comp tendsto_norm_zero').congr fun x ↦ (norm_inv x).symm
#align normed_field.tendsto_norm_inverse_nhds_within_0_at_top NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop
theorem tendsto_norm_zpow_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] {m : ℤ}
(hm : m < 0) :
Tendsto (fun x : 𝕜 ↦ ‖x ^ m‖) (𝓝[≠] 0) atTop := by
rcases neg_surjective m with ⟨m, rfl⟩
rw [neg_lt_zero] at hm; lift m to ℕ using hm.le; rw [Int.natCast_pos] at hm
simp only [norm_pow, zpow_neg, zpow_natCast, ← inv_pow]
exact (tendsto_pow_atTop hm.ne').comp NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop
#align normed_field.tendsto_norm_zpow_nhds_within_0_at_top NormedField.tendsto_norm_zpow_nhdsWithin_0_atTop
theorem tendsto_zero_smul_of_tendsto_zero_of_bounded {ι 𝕜 𝔸 : Type*} [NormedDivisionRing 𝕜]
[NormedAddCommGroup 𝔸] [Module 𝕜 𝔸] [BoundedSMul 𝕜 𝔸] {l : Filter ι} {ε : ι → 𝕜} {f : ι → 𝔸}
(hε : Tendsto ε l (𝓝 0)) (hf : Filter.IsBoundedUnder (· ≤ ·) l (norm ∘ f)) :
Tendsto (ε • f) l (𝓝 0) := by
rw [← isLittleO_one_iff 𝕜] at hε ⊢
simpa using IsLittleO.smul_isBigO hε (hf.isBigO_const (one_ne_zero : (1 : 𝕜) ≠ 0))
#align normed_field.tendsto_zero_smul_of_tendsto_zero_of_bounded NormedField.tendsto_zero_smul_of_tendsto_zero_of_bounded
@[simp]
theorem continuousAt_zpow {𝕜 : Type*} [NontriviallyNormedField 𝕜] {m : ℤ} {x : 𝕜} :
ContinuousAt (fun x ↦ x ^ m) x ↔ x ≠ 0 ∨ 0 ≤ m := by
refine ⟨?_, continuousAt_zpow₀ _ _⟩
contrapose!; rintro ⟨rfl, hm⟩ hc
exact not_tendsto_atTop_of_tendsto_nhds (hc.tendsto.mono_left nhdsWithin_le_nhds).norm
(tendsto_norm_zpow_nhdsWithin_0_atTop hm)
#align normed_field.continuous_at_zpow NormedField.continuousAt_zpow
@[simp]
| Mathlib/Analysis/SpecificLimits/Normed.lean | 90 | 92 | theorem continuousAt_inv {𝕜 : Type*} [NontriviallyNormedField 𝕜] {x : 𝕜} :
ContinuousAt Inv.inv x ↔ x ≠ 0 := by |
simpa [(zero_lt_one' ℤ).not_le] using @continuousAt_zpow _ _ (-1) x
| 1 | 2.718282 | 0 | 1.333333 | 6 | 1,379 |
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Finset.Image
import Mathlib.Data.Multiset.Fold
#align_import data.finset.fold from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
namespace Finset
open Multiset
variable {α β γ : Type*}
section Fold
variable (op : β → β → β) [hc : Std.Commutative op] [ha : Std.Associative op]
local notation a " * " b => op a b
def fold (b : β) (f : α → β) (s : Finset α) : β :=
(s.1.map f).fold op b
#align finset.fold Finset.fold
variable {op} {f : α → β} {b : β} {s : Finset α} {a : α}
@[simp]
theorem fold_empty : (∅ : Finset α).fold op b f = b :=
rfl
#align finset.fold_empty Finset.fold_empty
@[simp]
theorem fold_cons (h : a ∉ s) : (cons a s h).fold op b f = f a * s.fold op b f := by
dsimp only [fold]
rw [cons_val, Multiset.map_cons, fold_cons_left]
#align finset.fold_cons Finset.fold_cons
@[simp]
theorem fold_insert [DecidableEq α] (h : a ∉ s) :
(insert a s).fold op b f = f a * s.fold op b f := by
unfold fold
rw [insert_val, ndinsert_of_not_mem h, Multiset.map_cons, fold_cons_left]
#align finset.fold_insert Finset.fold_insert
@[simp]
theorem fold_singleton : ({a} : Finset α).fold op b f = f a * b :=
rfl
#align finset.fold_singleton Finset.fold_singleton
@[simp]
| Mathlib/Data/Finset/Fold.lean | 68 | 69 | theorem fold_map {g : γ ↪ α} {s : Finset γ} : (s.map g).fold op b f = s.fold op b (f ∘ g) := by |
simp only [fold, map, Multiset.map_map]
| 1 | 2.718282 | 0 | 0.909091 | 11 | 789 |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.units from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Int
theorem isUnit_iff_abs_eq {x : ℤ} : IsUnit x ↔ abs x = 1 := by
rw [isUnit_iff_natAbs_eq, abs_eq_natAbs, ← Int.ofNat_one, natCast_inj]
#align int.is_unit_iff_abs_eq Int.isUnit_iff_abs_eq
theorem isUnit_sq {a : ℤ} (ha : IsUnit a) : a ^ 2 = 1 := by rw [sq, isUnit_mul_self ha]
#align int.is_unit_sq Int.isUnit_sq
@[simp]
theorem units_sq (u : ℤˣ) : u ^ 2 = 1 := by
rw [Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one, isUnit_sq u.isUnit]
#align int.units_sq Int.units_sq
alias units_pow_two := units_sq
#align int.units_pow_two Int.units_pow_two
@[simp]
theorem units_mul_self (u : ℤˣ) : u * u = 1 := by rw [← sq, units_sq]
#align int.units_mul_self Int.units_mul_self
@[simp]
| Mathlib/Data/Int/Order/Units.lean | 37 | 37 | theorem units_inv_eq_self (u : ℤˣ) : u⁻¹ = u := by | rw [inv_eq_iff_mul_eq_one, units_mul_self]
| 1 | 2.718282 | 0 | 0.222222 | 9 | 285 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {𝕜 E : Type*} [LinearOrderedField 𝕜] [TopologicalSpace E]
[AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : 𝕜) • a + (1 / 2 : 𝕜) • c = b := by
rwa [← smul_add, one_div, inv_smul_eq_iff₀ (show (2 : 𝕜) ≠ 0 by norm_num), two_smul]
have :=
hs₁.eq (hs₀.frontier_subset ha) (hs₀.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, ← add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
· rw [sphere_zero]
exact threeAPFree_singleton _
· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {α β : Type*} {n d k N : ℕ} {x : Fin n → ℕ}
def box (n d : ℕ) : Finset (Fin n → ℕ) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x ∈ box n d ↔ ∀ i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = ∅ := by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : ℕ) : Finset (Fin n → ℕ) :=
(box n d).filter fun x => ∑ i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 ⊆ 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
theorem sphere_zero_right (n k : ℕ) : sphere (n + 1) 0 k = ∅ := by simp [sphere]
#align behrend.sphere_zero_right Behrend.sphere_zero_right
theorem sphere_subset_box : sphere n d k ⊆ box n d :=
filter_subset _ _
#align behrend.sphere_subset_box Behrend.sphere_subset_box
theorem norm_of_mem_sphere {x : Fin n → ℕ} (hx : x ∈ sphere n d k) :
‖(WithLp.equiv 2 _).symm ((↑) ∘ x : Fin n → ℝ)‖ = √↑k := by
rw [EuclideanSpace.norm_eq]
dsimp
simp_rw [abs_cast, ← cast_pow, ← cast_sum, (mem_filter.1 hx).2]
#align behrend.norm_of_mem_sphere Behrend.norm_of_mem_sphere
theorem sphere_subset_preimage_metric_sphere : (sphere n d k : Set (Fin n → ℕ)) ⊆
(fun x : Fin n → ℕ => (WithLp.equiv 2 _).symm ((↑) ∘ x : Fin n → ℝ)) ⁻¹'
Metric.sphere (0 : PiLp 2 fun _ : Fin n => ℝ) (√↑k) :=
fun x hx => by rw [Set.mem_preimage, mem_sphere_zero_iff_norm, norm_of_mem_sphere hx]
#align behrend.sphere_subset_preimage_metric_sphere Behrend.sphere_subset_preimage_metric_sphere
@[simps]
def map (d : ℕ) : (Fin n → ℕ) →+ ℕ where
toFun a := ∑ i, a i * d ^ (i : ℕ)
map_zero' := by simp_rw [Pi.zero_apply, zero_mul, sum_const_zero]
map_add' a b := by simp_rw [Pi.add_apply, add_mul, sum_add_distrib]
#align behrend.map Behrend.map
-- @[simp] -- Porting note (#10618): simp can prove this
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 147 | 147 | theorem map_zero (d : ℕ) (a : Fin 0 → ℕ) : map d a = 0 := by | simp [map]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
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)
theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def]
@[simp]
theorem smeval_C : (C r).smeval x = r • x ^ 0 := by
simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index]
@[simp]
| Mathlib/Algebra/Polynomial/Smeval.lean | 61 | 63 | theorem smeval_monomial (n : ℕ) :
(monomial n r).smeval x = r • x ^ n := by |
simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index]
| 1 | 2.718282 | 0 | 0.333333 | 9 | 368 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "ℤ[i]" => GaussianInt
namespace GaussianInt
instance : Repr ℤ[i] :=
⟨fun x _ => "⟨" ++ repr x.re ++ ", " ++ repr x.im ++ "⟩"⟩
instance instCommRing : CommRing ℤ[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : ℤ[i] →+* ℂ :=
Zsqrtd.lift ⟨I, by simp⟩
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe ℤ[i] ℂ :=
⟨toComplex⟩
theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂
@[simp]
theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) := by
rw [toComplex_def₂, toComplex_def₂]
exact congr_arg₂ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
theorem toComplex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by
cases x; cases y; simp [toComplex_def₂]
#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
lemma toComplex_injective : Function.Injective GaussianInt.toComplex :=
fun ⦃_ _⦄ ↦ toComplex_inj.mp
@[simp]
theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
rw [← toComplex_zero, toComplex_inj]
#align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
@[simp]
theorem intCast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = Complex.normSq (x : ℂ) := by
rw [Zsqrtd.norm, normSq]; simp
#align gaussian_int.nat_cast_real_norm GaussianInt.intCast_real_norm
@[deprecated (since := "2024-04-17")]
alias int_cast_real_norm := intCast_real_norm
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 162 | 163 | theorem intCast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = Complex.normSq (x : ℂ) := by |
cases x; rw [Zsqrtd.norm, normSq]; simp
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Range
#align_import data.list.nat_antidiagonal from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
open List Function Nat
namespace List
namespace Nat
def antidiagonal (n : ℕ) : List (ℕ × ℕ) :=
(range (n + 1)).map fun i ↦ (i, n - i)
#align list.nat.antidiagonal List.Nat.antidiagonal
@[simp]
theorem mem_antidiagonal {n : ℕ} {x : ℕ × ℕ} : x ∈ antidiagonal n ↔ x.1 + x.2 = n := by
rw [antidiagonal, mem_map]; constructor
· rintro ⟨i, hi, rfl⟩
rw [mem_range, Nat.lt_succ_iff] at hi
exact Nat.add_sub_cancel' hi
· rintro rfl
refine ⟨x.fst, ?_, ?_⟩
· rw [mem_range]
omega
· exact Prod.ext rfl (by simp only [Nat.add_sub_cancel_left])
#align list.nat.mem_antidiagonal List.Nat.mem_antidiagonal
@[simp]
| Mathlib/Data/List/NatAntidiagonal.lean | 52 | 53 | theorem length_antidiagonal (n : ℕ) : (antidiagonal n).length = n + 1 := by |
rw [antidiagonal, length_map, length_range]
| 1 | 2.718282 | 0 | 1.666667 | 6 | 1,790 |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Int.GCD
import Mathlib.RingTheory.Coprime.Basic
#align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
universe u v
section IsCoprime
variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I}
section
theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n = 1 := by
constructor
· rintro ⟨a, b, h⟩
have : 1 = m * a + n * b := by rwa [mul_comm m, mul_comm n, eq_comm]
exact Nat.dvd_one.mp (Int.gcd_dvd_iff.mpr ⟨a, b, this⟩)
· rw [← Int.ofNat_inj, IsCoprime, Int.gcd_eq_gcd_ab, mul_comm m, mul_comm n, Nat.cast_one]
intro h
exact ⟨_, _, h⟩
| Mathlib/RingTheory/Coprime/Lemmas.lean | 42 | 43 | theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n := by |
rw [Int.isCoprime_iff_gcd_eq_one, Int.gcd_natCast_natCast]
| 1 | 2.718282 | 0 | 1.111111 | 18 | 1,195 |
import Mathlib.CategoryTheory.Subobject.Lattice
#align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite
variable {C : Type u} [Category.{v} C] {X Y Z : C}
namespace CategoryTheory
namespace Limits
section Kernel
variable [HasZeroMorphisms C] (f : X ⟶ Y) [HasKernel f]
abbrev kernelSubobject : Subobject X :=
Subobject.mk (kernel.ι f)
#align category_theory.limits.kernel_subobject CategoryTheory.Limits.kernelSubobject
def kernelSubobjectIso : (kernelSubobject f : C) ≅ kernel f :=
Subobject.underlyingIso (kernel.ι f)
#align category_theory.limits.kernel_subobject_iso CategoryTheory.Limits.kernelSubobjectIso
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem kernelSubobject_arrow :
(kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow := by
simp [kernelSubobjectIso]
#align category_theory.limits.kernel_subobject_arrow CategoryTheory.Limits.kernelSubobject_arrow
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem kernelSubobject_arrow' :
(kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f := by
simp [kernelSubobjectIso]
#align category_theory.limits.kernel_subobject_arrow' CategoryTheory.Limits.kernelSubobject_arrow'
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem kernelSubobject_arrow_comp : (kernelSubobject f).arrow ≫ f = 0 := by
rw [← kernelSubobject_arrow]
simp only [Category.assoc, kernel.condition, comp_zero]
#align category_theory.limits.kernel_subobject_arrow_comp CategoryTheory.Limits.kernelSubobject_arrow_comp
theorem kernelSubobject_factors {W : C} (h : W ⟶ X) (w : h ≫ f = 0) :
(kernelSubobject f).Factors h :=
⟨kernel.lift _ h w, by simp⟩
#align category_theory.limits.kernel_subobject_factors CategoryTheory.Limits.kernelSubobject_factors
theorem kernelSubobject_factors_iff {W : C} (h : W ⟶ X) :
(kernelSubobject f).Factors h ↔ h ≫ f = 0 :=
⟨fun w => by
rw [← Subobject.factorThru_arrow _ _ w, Category.assoc, kernelSubobject_arrow_comp,
comp_zero],
kernelSubobject_factors f h⟩
#align category_theory.limits.kernel_subobject_factors_iff CategoryTheory.Limits.kernelSubobject_factors_iff
def factorThruKernelSubobject {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : W ⟶ kernelSubobject f :=
(kernelSubobject f).factorThru h (kernelSubobject_factors f h w)
#align category_theory.limits.factor_thru_kernel_subobject CategoryTheory.Limits.factorThruKernelSubobject
@[simp]
theorem factorThruKernelSubobject_comp_arrow {W : C} (h : W ⟶ X) (w : h ≫ f = 0) :
factorThruKernelSubobject f h w ≫ (kernelSubobject f).arrow = h := by
dsimp [factorThruKernelSubobject]
simp
#align category_theory.limits.factor_thru_kernel_subobject_comp_arrow CategoryTheory.Limits.factorThruKernelSubobject_comp_arrow
@[simp]
theorem factorThruKernelSubobject_comp_kernelSubobjectIso {W : C} (h : W ⟶ X) (w : h ≫ f = 0) :
factorThruKernelSubobject f h w ≫ (kernelSubobjectIso f).hom = kernel.lift f h w :=
(cancel_mono (kernel.ι f)).1 <| by simp
#align category_theory.limits.factor_thru_kernel_subobject_comp_kernel_subobject_iso CategoryTheory.Limits.factorThruKernelSubobject_comp_kernelSubobjectIso
section
variable {f} {X' Y' : C} {f' : X' ⟶ Y'} [HasKernel f']
def kernelSubobjectMap (sq : Arrow.mk f ⟶ Arrow.mk f') :
(kernelSubobject f : C) ⟶ (kernelSubobject f' : C) :=
Subobject.factorThru _ ((kernelSubobject f).arrow ≫ sq.left)
(kernelSubobject_factors _ _ (by simp [sq.w]))
#align category_theory.limits.kernel_subobject_map CategoryTheory.Limits.kernelSubobjectMap
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem kernelSubobjectMap_arrow (sq : Arrow.mk f ⟶ Arrow.mk f') :
kernelSubobjectMap sq ≫ (kernelSubobject f').arrow = (kernelSubobject f).arrow ≫ sq.left := by
simp [kernelSubobjectMap]
#align category_theory.limits.kernel_subobject_map_arrow CategoryTheory.Limits.kernelSubobjectMap_arrow
@[simp]
theorem kernelSubobjectMap_id : kernelSubobjectMap (𝟙 (Arrow.mk f)) = 𝟙 _ := by aesop_cat
#align category_theory.limits.kernel_subobject_map_id CategoryTheory.Limits.kernelSubobjectMap_id
@[simp]
theorem kernelSubobjectMap_comp {X'' Y'' : C} {f'' : X'' ⟶ Y''} [HasKernel f'']
(sq : Arrow.mk f ⟶ Arrow.mk f') (sq' : Arrow.mk f' ⟶ Arrow.mk f'') :
kernelSubobjectMap (sq ≫ sq') = kernelSubobjectMap sq ≫ kernelSubobjectMap sq' := by
aesop_cat
#align category_theory.limits.kernel_subobject_map_comp CategoryTheory.Limits.kernelSubobjectMap_comp
@[reassoc]
theorem kernel_map_comp_kernelSubobjectIso_inv (sq : Arrow.mk f ⟶ Arrow.mk f') :
kernel.map f f' sq.1 sq.2 sq.3.symm ≫ (kernelSubobjectIso _).inv =
(kernelSubobjectIso _).inv ≫ kernelSubobjectMap sq := by aesop_cat
#align category_theory.limits.kernel_map_comp_kernel_subobject_iso_inv CategoryTheory.Limits.kernel_map_comp_kernelSubobjectIso_inv
@[reassoc]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 181 | 184 | theorem kernelSubobjectIso_comp_kernel_map (sq : Arrow.mk f ⟶ Arrow.mk f') :
(kernelSubobjectIso _).hom ≫ kernel.map f f' sq.1 sq.2 sq.3.symm =
kernelSubobjectMap sq ≫ (kernelSubobjectIso _).hom := by |
simp [← Iso.comp_inv_eq, kernel_map_comp_kernelSubobjectIso_inv]
| 1 | 2.718282 | 0 | 0.263158 | 19 | 308 |
import Mathlib.Order.Filter.Ultrafilter
import Mathlib.Order.Filter.Germ
#align_import order.filter.filter_product from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"
universe u v
variable {α : Type u} {β : Type v} {φ : Ultrafilter α}
open scoped Classical
namespace Filter
local notation3 "∀* "(...)", "r:(scoped p => Filter.Eventually p (Ultrafilter.toFilter φ)) => r
namespace Germ
open Ultrafilter
local notation "β*" => Germ (φ : Filter α) β
instance instGroupWithZero [GroupWithZero β] : GroupWithZero β* where
__ := instDivInvMonoid
__ := instMonoidWithZero
mul_inv_cancel f := inductionOn f fun f hf ↦ coe_eq.2 <| (φ.em fun y ↦ f y = 0).elim
(fun H ↦ (hf <| coe_eq.2 H).elim) fun H ↦ H.mono fun x ↦ mul_inv_cancel
inv_zero := coe_eq.2 <| by simp only [Function.comp, inv_zero, EventuallyEq.rfl]
instance instDivisionSemiring [DivisionSemiring β] : DivisionSemiring β* where
toSemiring := instSemiring
__ := instGroupWithZero
nnqsmul := _
instance instDivisionRing [DivisionRing β] : DivisionRing β* where
__ := instRing
__ := instDivisionSemiring
qsmul := _
instance instSemifield [Semifield β] : Semifield β* where
__ := instCommSemiring
__ := instDivisionSemiring
instance instField [Field β] : Field β* where
__ := instCommRing
__ := instDivisionRing
| Mathlib/Order/Filter/FilterProduct.lean | 65 | 66 | theorem coe_lt [Preorder β] {f g : α → β} : (f : β*) < g ↔ ∀* x, f x < g x := by |
simp only [lt_iff_le_not_le, eventually_and, coe_le, eventually_not, EventuallyLE]
| 1 | 2.718282 | 0 | 0.333333 | 3 | 340 |
import Mathlib.Data.Int.AbsoluteValue
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
#align_import linear_algebra.matrix.absolute_value from "leanprover-community/mathlib"@"ab0a2959c83b06280ef576bc830d4aa5fe8c8e61"
open Matrix
namespace Matrix
open Equiv Finset
variable {R S : Type*} [CommRing R] [Nontrivial R] [LinearOrderedCommRing S]
variable {n : Type*} [Fintype n] [DecidableEq n]
| Mathlib/LinearAlgebra/Matrix/AbsoluteValue.lean | 37 | 49 | theorem det_le {A : Matrix n n R} {abv : AbsoluteValue R S} {x : S} (hx : ∀ i j, abv (A i j) ≤ x) :
abv A.det ≤ Nat.factorial (Fintype.card n) • x ^ Fintype.card n :=
calc
abv A.det = abv (∑ σ : Perm n, Perm.sign σ • ∏ i, A (σ i) i) := congr_arg abv (det_apply _)
_ ≤ ∑ σ : Perm n, abv (Perm.sign σ • ∏ i, A (σ i) i) := abv.sum_le _ _
_ = ∑ σ : Perm n, ∏ i, abv (A (σ i) i) :=
(sum_congr rfl fun σ _ => by rw [abv.map_units_int_smul, abv.map_prod])
_ ≤ ∑ _σ : Perm n, ∏ _i : n, x :=
(sum_le_sum fun _ _ => prod_le_prod (fun _ _ => abv.nonneg _) fun _ _ => hx _ _)
_ = ∑ _σ : Perm n, x ^ Fintype.card n :=
(sum_congr rfl fun _ _ => by rw [prod_const, Finset.card_univ])
_ = Nat.factorial (Fintype.card n) • x ^ Fintype.card n := by |
rw [sum_const, Finset.card_univ, Fintype.card_perm]
| 1 | 2.718282 | 0 | 1.333333 | 3 | 1,399 |
import Mathlib.Order.Filter.Lift
import Mathlib.Topology.Defs.Filter
#align_import topology.basic from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40"
noncomputable section
open Set Filter
universe u v w x
def TopologicalSpace.ofClosed {X : Type u} (T : Set (Set X)) (empty_mem : ∅ ∈ T)
(sInter_mem : ∀ A, A ⊆ T → ⋂₀ A ∈ T)
(union_mem : ∀ A, A ∈ T → ∀ B, B ∈ T → A ∪ B ∈ T) : TopologicalSpace X where
IsOpen X := Xᶜ ∈ T
isOpen_univ := by simp [empty_mem]
isOpen_inter s t hs ht := by simpa only [compl_inter] using union_mem sᶜ hs tᶜ ht
isOpen_sUnion s hs := by
simp only [Set.compl_sUnion]
exact sInter_mem (compl '' s) fun z ⟨y, hy, hz⟩ => hz ▸ hs y hy
#align topological_space.of_closed TopologicalSpace.ofClosed
section TopologicalSpace
variable {X : Type u} {Y : Type v} {ι : Sort w} {α β : Type*}
{x : X} {s s₁ s₂ t : Set X} {p p₁ p₂ : X → Prop}
open Topology
lemma isOpen_mk {p h₁ h₂ h₃} : IsOpen[⟨p, h₁, h₂, h₃⟩] s ↔ p s := Iff.rfl
#align is_open_mk isOpen_mk
@[ext]
protected theorem TopologicalSpace.ext :
∀ {f g : TopologicalSpace X}, IsOpen[f] = IsOpen[g] → f = g
| ⟨_, _, _, _⟩, ⟨_, _, _, _⟩, rfl => rfl
#align topological_space_eq TopologicalSpace.ext
section
variable [TopologicalSpace X]
end
protected theorem TopologicalSpace.ext_iff {t t' : TopologicalSpace X} :
t = t' ↔ ∀ s, IsOpen[t] s ↔ IsOpen[t'] s :=
⟨fun h s => h ▸ Iff.rfl, fun h => by ext; exact h _⟩
#align topological_space_eq_iff TopologicalSpace.ext_iff
theorem isOpen_fold {t : TopologicalSpace X} : t.IsOpen s = IsOpen[t] s :=
rfl
#align is_open_fold isOpen_fold
variable [TopologicalSpace X]
theorem isOpen_iUnion {f : ι → Set X} (h : ∀ i, IsOpen (f i)) : IsOpen (⋃ i, f i) :=
isOpen_sUnion (forall_mem_range.2 h)
#align is_open_Union isOpen_iUnion
theorem isOpen_biUnion {s : Set α} {f : α → Set X} (h : ∀ i ∈ s, IsOpen (f i)) :
IsOpen (⋃ i ∈ s, f i) :=
isOpen_iUnion fun i => isOpen_iUnion fun hi => h i hi
#align is_open_bUnion isOpen_biUnion
| Mathlib/Topology/Basic.lean | 115 | 116 | theorem IsOpen.union (h₁ : IsOpen s₁) (h₂ : IsOpen s₂) : IsOpen (s₁ ∪ s₂) := by |
rw [union_eq_iUnion]; exact isOpen_iUnion (Bool.forall_bool.2 ⟨h₂, h₁⟩)
| 1 | 2.718282 | 0 | 0.333333 | 3 | 343 |
import Mathlib.Tactic.Ring.Basic
import Mathlib.Tactic.TryThis
import Mathlib.Tactic.Conv
import Mathlib.Util.Qq
set_option autoImplicit true
-- In this file we would like to be able to use multi-character auto-implicits.
set_option relaxedAutoImplicit true
namespace Mathlib.Tactic
open Lean hiding Rat
open Qq Meta
namespace RingNF
open Ring
inductive RingMode where
| SOP
| raw
deriving Inhabited, BEq, Repr
structure Config where
red := TransparencyMode.reducible
recursive := true
mode := RingMode.SOP
deriving Inhabited, BEq, Repr
declare_config_elab elabConfig Config
structure Context where
ctx : Simp.Context
simp : Simp.Result → SimpM Simp.Result
abbrev M := ReaderT Context AtomM
def rewrite (parent : Expr) (root := true) : M Simp.Result :=
fun nctx rctx s ↦ do
let pre : Simp.Simproc := fun e =>
try
guard <| root || parent != e -- recursion guard
let e ← withReducible <| whnf e
guard e.isApp -- all interesting ring expressions are applications
let ⟨u, α, e⟩ ← inferTypeQ' e
let sα ← synthInstanceQ (q(CommSemiring $α) : Q(Type u))
let c ← mkCache sα
let ⟨a, _, pa⟩ ← match ← isAtomOrDerivable sα c e rctx s with
| none => eval sα c e rctx s -- `none` indicates that `eval` will find something algebraic.
| some none => failure -- No point rewriting atoms
| some (some r) => pure r -- Nothing algebraic for `eval` to use, but `norm_num` simplifies.
let r ← nctx.simp { expr := a, proof? := pa }
if ← withReducible <| isDefEq r.expr e then return .done { expr := r.expr }
pure (.done r)
catch _ => pure <| .continue
let post := Simp.postDefault #[]
(·.1) <$> Simp.main parent nctx.ctx (methods := { pre, post })
variable [CommSemiring R]
theorem add_assoc_rev (a b c : R) : a + (b + c) = a + b + c := (add_assoc ..).symm
theorem mul_assoc_rev (a b c : R) : a * (b * c) = a * b * c := (mul_assoc ..).symm
theorem mul_neg {R} [Ring R] (a b : R) : a * -b = -(a * b) := by simp
theorem add_neg {R} [Ring R] (a b : R) : a + -b = a - b := (sub_eq_add_neg ..).symm
theorem nat_rawCast_0 : (Nat.rawCast 0 : R) = 0 := by simp
theorem nat_rawCast_1 : (Nat.rawCast 1 : R) = 1 := by simp
theorem nat_rawCast_2 [Nat.AtLeastTwo n] : (Nat.rawCast n : R) = OfNat.ofNat n := rfl
theorem int_rawCast_neg {R} [Ring R] : (Int.rawCast (.negOfNat n) : R) = -Nat.rawCast n := by simp
theorem rat_rawCast_pos {R} [DivisionRing R] :
(Rat.rawCast (.ofNat n) d : R) = Nat.rawCast n / Nat.rawCast d := by simp
| Mathlib/Tactic/Ring/RingNF.lean | 126 | 127 | theorem rat_rawCast_neg {R} [DivisionRing R] :
(Rat.rawCast (.negOfNat n) d : R) = Int.rawCast (.negOfNat n) / Nat.rawCast d := by | simp
| 1 | 2.718282 | 0 | 0 | 6 | 217 |
import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace
#align_import geometry.manifold.vector_bundle.fiberwise_linear from "leanprover-community/mathlib"@"be2c24f56783935652cefffb4bfca7e4b25d167e"
noncomputable section
open Set TopologicalSpace
open scoped Manifold Topology
variable {𝕜 B F : Type*} [TopologicalSpace B]
variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup F] [NormedSpace 𝕜 F]
namespace FiberwiseLinear
variable {φ φ' : B → F ≃L[𝕜] F} {U U' : Set B}
def partialHomeomorph (φ : B → F ≃L[𝕜] F) (hU : IsOpen U)
(hφ : ContinuousOn (fun x => φ x : B → F →L[𝕜] F) U)
(h2φ : ContinuousOn (fun x => (φ x).symm : B → F →L[𝕜] F) U) :
PartialHomeomorph (B × F) (B × F) where
toFun x := (x.1, φ x.1 x.2)
invFun x := (x.1, (φ x.1).symm x.2)
source := U ×ˢ univ
target := U ×ˢ univ
map_source' _x hx := mk_mem_prod hx.1 (mem_univ _)
map_target' _x hx := mk_mem_prod hx.1 (mem_univ _)
left_inv' _ _ := Prod.ext rfl (ContinuousLinearEquiv.symm_apply_apply _ _)
right_inv' _ _ := Prod.ext rfl (ContinuousLinearEquiv.apply_symm_apply _ _)
open_source := hU.prod isOpen_univ
open_target := hU.prod isOpen_univ
continuousOn_toFun :=
have : ContinuousOn (fun p : B × F => ((φ p.1 : F →L[𝕜] F), p.2)) (U ×ˢ univ) :=
hφ.prod_map continuousOn_id
continuousOn_fst.prod (isBoundedBilinearMap_apply.continuous.comp_continuousOn this)
continuousOn_invFun :=
haveI : ContinuousOn (fun p : B × F => (((φ p.1).symm : F →L[𝕜] F), p.2)) (U ×ˢ univ) :=
h2φ.prod_map continuousOn_id
continuousOn_fst.prod (isBoundedBilinearMap_apply.continuous.comp_continuousOn this)
#align fiberwise_linear.local_homeomorph FiberwiseLinear.partialHomeomorph
theorem trans_partialHomeomorph_apply (hU : IsOpen U)
(hφ : ContinuousOn (fun x => φ x : B → F →L[𝕜] F) U)
(h2φ : ContinuousOn (fun x => (φ x).symm : B → F →L[𝕜] F) U) (hU' : IsOpen U')
(hφ' : ContinuousOn (fun x => φ' x : B → F →L[𝕜] F) U')
(h2φ' : ContinuousOn (fun x => (φ' x).symm : B → F →L[𝕜] F) U') (b : B) (v : F) :
(FiberwiseLinear.partialHomeomorph φ hU hφ h2φ ≫ₕ
FiberwiseLinear.partialHomeomorph φ' hU' hφ' h2φ')
⟨b, v⟩ =
⟨b, φ' b (φ b v)⟩ :=
rfl
#align fiberwise_linear.trans_local_homeomorph_apply FiberwiseLinear.trans_partialHomeomorph_apply
| Mathlib/Geometry/Manifold/VectorBundle/FiberwiseLinear.lean | 74 | 82 | theorem source_trans_partialHomeomorph (hU : IsOpen U)
(hφ : ContinuousOn (fun x => φ x : B → F →L[𝕜] F) U)
(h2φ : ContinuousOn (fun x => (φ x).symm : B → F →L[𝕜] F) U) (hU' : IsOpen U')
(hφ' : ContinuousOn (fun x => φ' x : B → F →L[𝕜] F) U')
(h2φ' : ContinuousOn (fun x => (φ' x).symm : B → F →L[𝕜] F) U') :
(FiberwiseLinear.partialHomeomorph φ hU hφ h2φ ≫ₕ
FiberwiseLinear.partialHomeomorph φ' hU' hφ' h2φ').source =
(U ∩ U') ×ˢ univ := by |
dsimp only [FiberwiseLinear.partialHomeomorph]; mfld_set_tac
| 1 | 2.718282 | 0 | 0 | 2 | 187 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {𝕜 E : Type*} [LinearOrderedField 𝕜] [TopologicalSpace E]
[AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : 𝕜) • a + (1 / 2 : 𝕜) • c = b := by
rwa [← smul_add, one_div, inv_smul_eq_iff₀ (show (2 : 𝕜) ≠ 0 by norm_num), two_smul]
have :=
hs₁.eq (hs₀.frontier_subset ha) (hs₀.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, ← add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
· rw [sphere_zero]
exact threeAPFree_singleton _
· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {α β : Type*} {n d k N : ℕ} {x : Fin n → ℕ}
def box (n d : ℕ) : Finset (Fin n → ℕ) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x ∈ box n d ↔ ∀ i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = ∅ := by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : ℕ) : Finset (Fin n → ℕ) :=
(box n d).filter fun x => ∑ i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 ⊆ 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
theorem sphere_zero_right (n k : ℕ) : sphere (n + 1) 0 k = ∅ := by simp [sphere]
#align behrend.sphere_zero_right Behrend.sphere_zero_right
theorem sphere_subset_box : sphere n d k ⊆ box n d :=
filter_subset _ _
#align behrend.sphere_subset_box Behrend.sphere_subset_box
theorem norm_of_mem_sphere {x : Fin n → ℕ} (hx : x ∈ sphere n d k) :
‖(WithLp.equiv 2 _).symm ((↑) ∘ x : Fin n → ℝ)‖ = √↑k := by
rw [EuclideanSpace.norm_eq]
dsimp
simp_rw [abs_cast, ← cast_pow, ← cast_sum, (mem_filter.1 hx).2]
#align behrend.norm_of_mem_sphere Behrend.norm_of_mem_sphere
theorem sphere_subset_preimage_metric_sphere : (sphere n d k : Set (Fin n → ℕ)) ⊆
(fun x : Fin n → ℕ => (WithLp.equiv 2 _).symm ((↑) ∘ x : Fin n → ℝ)) ⁻¹'
Metric.sphere (0 : PiLp 2 fun _ : Fin n => ℝ) (√↑k) :=
fun x hx => by rw [Set.mem_preimage, mem_sphere_zero_iff_norm, norm_of_mem_sphere hx]
#align behrend.sphere_subset_preimage_metric_sphere Behrend.sphere_subset_preimage_metric_sphere
@[simps]
def map (d : ℕ) : (Fin n → ℕ) →+ ℕ where
toFun a := ∑ i, a i * d ^ (i : ℕ)
map_zero' := by simp_rw [Pi.zero_apply, zero_mul, sum_const_zero]
map_add' a b := by simp_rw [Pi.add_apply, add_mul, sum_add_distrib]
#align behrend.map Behrend.map
-- @[simp] -- Porting note (#10618): simp can prove this
theorem map_zero (d : ℕ) (a : Fin 0 → ℕ) : map d a = 0 := by simp [map]
#align behrend.map_zero Behrend.map_zero
theorem map_succ (a : Fin (n + 1) → ℕ) :
map d a = a 0 + (∑ x : Fin n, a x.succ * d ^ (x : ℕ)) * d := by
simp [map, Fin.sum_univ_succ, _root_.pow_succ, ← mul_assoc, ← sum_mul]
#align behrend.map_succ Behrend.map_succ
theorem map_succ' (a : Fin (n + 1) → ℕ) : map d a = a 0 + map d (a ∘ Fin.succ) * d :=
map_succ _
#align behrend.map_succ' Behrend.map_succ'
theorem map_monotone (d : ℕ) : Monotone (map d : (Fin n → ℕ) → ℕ) := fun x y h => by
dsimp; exact sum_le_sum fun i _ => Nat.mul_le_mul_right _ <| h i
#align behrend.map_monotone Behrend.map_monotone
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 163 | 164 | theorem map_mod (a : Fin n.succ → ℕ) : map d a % d = a 0 % d := by |
rw [map_succ, Nat.add_mul_mod_self_right]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing
import Mathlib.AlgebraicGeometry.OpenImmersion
#align_import algebraic_geometry.gluing from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1"
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open TopologicalSpace CategoryTheory Opposite
open CategoryTheory.Limits AlgebraicGeometry.PresheafedSpace
open CategoryTheory.GlueData
namespace AlgebraicGeometry
namespace Scheme
-- Porting note(#5171): @[nolint has_nonempty_instance]; linter not ported yet
structure GlueData extends CategoryTheory.GlueData Scheme where
f_open : ∀ i j, IsOpenImmersion (f i j)
#align algebraic_geometry.Scheme.glue_data AlgebraicGeometry.Scheme.GlueData
attribute [instance] GlueData.f_open
namespace OpenCover
variable {X : Scheme.{u}} (𝒰 : OpenCover.{u} X)
def gluedCoverT' (x y z : 𝒰.J) :
pullback (pullback.fst : pullback (𝒰.map x) (𝒰.map y) ⟶ _)
(pullback.fst : pullback (𝒰.map x) (𝒰.map z) ⟶ _) ⟶
pullback (pullback.fst : pullback (𝒰.map y) (𝒰.map z) ⟶ _)
(pullback.fst : pullback (𝒰.map y) (𝒰.map x) ⟶ _) := by
refine (pullbackRightPullbackFstIso _ _ _).hom ≫ ?_
refine ?_ ≫ (pullbackSymmetry _ _).hom
refine ?_ ≫ (pullbackRightPullbackFstIso _ _ _).inv
refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (𝟙 _) (𝟙 _) ?_ ?_
· simp [pullback.condition]
· simp
#align algebraic_geometry.Scheme.open_cover.glued_cover_t' AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'
@[simp, reassoc]
theorem gluedCoverT'_fst_fst (x y z : 𝒰.J) :
𝒰.gluedCoverT' x y z ≫ pullback.fst ≫ pullback.fst = pullback.fst ≫ pullback.snd := by
delta gluedCoverT'; simp
#align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_fst
@[simp, reassoc]
theorem gluedCoverT'_fst_snd (x y z : 𝒰.J) :
gluedCoverT' 𝒰 x y z ≫ pullback.fst ≫ pullback.snd = pullback.snd ≫ pullback.snd := by
delta gluedCoverT'; simp
#align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_snd AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_snd
@[simp, reassoc]
theorem gluedCoverT'_snd_fst (x y z : 𝒰.J) :
gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.fst = pullback.fst ≫ pullback.snd := by
delta gluedCoverT'; simp
#align algebraic_geometry.Scheme.open_cover.glued_cover_t'_snd_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_snd_fst
@[simp, reassoc]
| Mathlib/AlgebraicGeometry/Gluing.lean | 314 | 316 | theorem gluedCoverT'_snd_snd (x y z : 𝒰.J) :
gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.snd = pullback.fst ≫ pullback.fst := by |
delta gluedCoverT'; simp
| 1 | 2.718282 | 0 | 0.142857 | 7 | 256 |
import Mathlib.Algebra.Algebra.Hom
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72"
universe uR uS uT uA u₄
variable {R : Type uR} [Semiring R]
variable {S : Type uS} [CommSemiring S]
variable {T : Type uT}
variable {A : Type uA} [Semiring A] [Algebra S A]
namespace RingQuot
inductive Rel (r : R → R → Prop) : R → R → Prop
| of ⦃x y : R⦄ (h : r x y) : Rel r x y
| add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c)
| mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c)
| mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c)
#align ring_quot.rel RingQuot.Rel
theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by
rw [add_comm a b, add_comm a c]
exact Rel.add_left h
#align ring_quot.rel.add_right RingQuot.Rel.add_right
theorem Rel.neg {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b : R⦄ (h : Rel r a b) :
Rel r (-a) (-b) := by simp only [neg_eq_neg_one_mul a, neg_eq_neg_one_mul b, Rel.mul_right h]
#align ring_quot.rel.neg RingQuot.Rel.neg
theorem Rel.sub_left {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r a b) :
Rel r (a - c) (b - c) := by simp only [sub_eq_add_neg, h.add_left]
#align ring_quot.rel.sub_left RingQuot.Rel.sub_left
| Mathlib/Algebra/RingQuot.lean | 75 | 76 | theorem Rel.sub_right {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) :
Rel r (a - b) (a - c) := by | simp only [sub_eq_add_neg, h.neg.add_right]
| 1 | 2.718282 | 0 | 0.5 | 6 | 490 |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Rat.Cast.Order
import Mathlib.Order.Partition.Finpartition
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
#align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1"
open Finset
variable {𝕜 ι κ α β : Type*}
namespace Rel
section Asymmetric
variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α}
{t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜}
def interedges (s : Finset α) (t : Finset β) : Finset (α × β) :=
(s ×ˢ t).filter fun e ↦ r e.1 e.2
#align rel.interedges Rel.interedges
def edgeDensity (s : Finset α) (t : Finset β) : ℚ :=
(interedges r s t).card / (s.card * t.card)
#align rel.edge_density Rel.edgeDensity
variable {r}
theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by
rw [interedges, mem_filter, Finset.mem_product, and_assoc]
#align rel.mem_interedges_iff Rel.mem_interedges_iff
theorem mk_mem_interedges_iff : (a, b) ∈ interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b :=
mem_interedges_iff
#align rel.mk_mem_interedges_iff Rel.mk_mem_interedges_iff
@[simp]
theorem interedges_empty_left (t : Finset β) : interedges r ∅ t = ∅ := by
rw [interedges, Finset.empty_product, filter_empty]
#align rel.interedges_empty_left Rel.interedges_empty_left
theorem interedges_mono (hs : s₂ ⊆ s₁) (ht : t₂ ⊆ t₁) : interedges r s₂ t₂ ⊆ interedges r s₁ t₁ :=
fun x ↦ by
simp_rw [mem_interedges_iff]
exact fun h ↦ ⟨hs h.1, ht h.2.1, h.2.2⟩
#align rel.interedges_mono Rel.interedges_mono
variable (r)
theorem card_interedges_add_card_interedges_compl (s : Finset α) (t : Finset β) :
(interedges r s t).card + (interedges (fun x y ↦ ¬r x y) s t).card = s.card * t.card := by
classical
rw [← card_product, interedges, interedges, ← card_union_of_disjoint, filter_union_filter_neg_eq]
exact disjoint_filter.2 fun _ _ ↦ Classical.not_not.2
#align rel.card_interedges_add_card_interedges_compl Rel.card_interedges_add_card_interedges_compl
theorem interedges_disjoint_left {s s' : Finset α} (hs : Disjoint s s') (t : Finset β) :
Disjoint (interedges r s t) (interedges r s' t) := by
rw [Finset.disjoint_left] at hs ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact hs hx.1 hy.1
#align rel.interedges_disjoint_left Rel.interedges_disjoint_left
theorem interedges_disjoint_right (s : Finset α) {t t' : Finset β} (ht : Disjoint t t') :
Disjoint (interedges r s t) (interedges r s t') := by
rw [Finset.disjoint_left] at ht ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact ht hx.2.1 hy.2.1
#align rel.interedges_disjoint_right Rel.interedges_disjoint_right
section DecidableEq
variable [DecidableEq α] [DecidableEq β]
lemma interedges_eq_biUnion :
interedges r s t = s.biUnion (fun x ↦ (t.filter (r x)).map ⟨(x, ·), Prod.mk.inj_left x⟩) := by
ext ⟨x, y⟩; simp [mem_interedges_iff]
theorem interedges_biUnion_left (s : Finset ι) (t : Finset β) (f : ι → Finset α) :
interedges r (s.biUnion f) t = s.biUnion fun a ↦ interedges r (f a) t := by
ext
simp only [mem_biUnion, mem_interedges_iff, exists_and_right, ← and_assoc]
#align rel.interedges_bUnion_left Rel.interedges_biUnion_left
theorem interedges_biUnion_right (s : Finset α) (t : Finset ι) (f : ι → Finset β) :
interedges r s (t.biUnion f) = t.biUnion fun b ↦ interedges r s (f b) := by
ext a
simp only [mem_interedges_iff, mem_biUnion]
exact ⟨fun ⟨x₁, ⟨x₂, x₃, x₄⟩, x₅⟩ ↦ ⟨x₂, x₃, x₁, x₄, x₅⟩,
fun ⟨x₂, x₃, x₁, x₄, x₅⟩ ↦ ⟨x₁, ⟨x₂, x₃, x₄⟩, x₅⟩⟩
#align rel.interedges_bUnion_right Rel.interedges_biUnion_right
| Mathlib/Combinatorics/SimpleGraph/Density.lean | 123 | 126 | theorem interedges_biUnion (s : Finset ι) (t : Finset κ) (f : ι → Finset α) (g : κ → Finset β) :
interedges r (s.biUnion f) (t.biUnion g) =
(s ×ˢ t).biUnion fun ab ↦ interedges r (f ab.1) (g ab.2) := by |
simp_rw [product_biUnion, interedges_biUnion_left, interedges_biUnion_right]
| 1 | 2.718282 | 0 | 0.785714 | 14 | 695 |
import Batteries.Data.List.Basic
import Batteries.Data.List.Lemmas
open Nat
namespace List
section countP
variable (p q : α → Bool)
@[simp] theorem countP_nil : countP p [] = 0 := rfl
protected theorem countP_go_eq_add (l) : countP.go p l n = n + countP.go p l 0 := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
unfold countP.go
rw [ih (n := n + 1), ih (n := n), ih (n := 1)]
if h : p head then simp [h, Nat.add_assoc] else simp [h]
@[simp] theorem countP_cons_of_pos (l) (pa : p a) : countP p (a :: l) = countP p l + 1 := by
have : countP.go p (a :: l) 0 = countP.go p l 1 := show cond .. = _ by rw [pa]; rfl
unfold countP
rw [this, Nat.add_comm, List.countP_go_eq_add]
@[simp] theorem countP_cons_of_neg (l) (pa : ¬p a) : countP p (a :: l) = countP p l := by
simp [countP, countP.go, pa]
theorem countP_cons (a : α) (l) : countP p (a :: l) = countP p l + if p a then 1 else 0 := by
by_cases h : p a <;> simp [h]
theorem length_eq_countP_add_countP (l) : length l = countP p l + countP (fun a => ¬p a) l := by
induction l with
| nil => rfl
| cons x h ih =>
if h : p x then
rw [countP_cons_of_pos _ _ h, countP_cons_of_neg _ _ _, length, ih]
· rw [Nat.add_assoc, Nat.add_comm _ 1, Nat.add_assoc]
· simp only [h, not_true_eq_false, decide_False, not_false_eq_true]
else
rw [countP_cons_of_pos (fun a => ¬p a) _ _, countP_cons_of_neg _ _ h, length, ih]
· rfl
· simp only [h, not_false_eq_true, decide_True]
theorem countP_eq_length_filter (l) : countP p l = length (filter p l) := by
induction l with
| nil => rfl
| cons x l ih =>
if h : p x
then rw [countP_cons_of_pos p l h, ih, filter_cons_of_pos l h, length]
else rw [countP_cons_of_neg p l h, ih, filter_cons_of_neg l h]
theorem countP_le_length : countP p l ≤ l.length := by
simp only [countP_eq_length_filter]
apply length_filter_le
@[simp] theorem countP_append (l₁ l₂) : countP p (l₁ ++ l₂) = countP p l₁ + countP p l₂ := by
simp only [countP_eq_length_filter, filter_append, length_append]
theorem countP_pos : 0 < countP p l ↔ ∃ a ∈ l, p a := by
simp only [countP_eq_length_filter, length_pos_iff_exists_mem, mem_filter, exists_prop]
| .lake/packages/batteries/Batteries/Data/List/Count.lean | 78 | 79 | theorem countP_eq_zero : countP p l = 0 ↔ ∀ a ∈ l, ¬p a := by |
simp only [countP_eq_length_filter, length_eq_zero, filter_eq_nil]
| 1 | 2.718282 | 0 | 0.8 | 10 | 703 |
import Mathlib.LinearAlgebra.Dimension.DivisionRing
import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition
noncomputable section
universe u v v' v''
variable {K : Type u} {V V₁ : Type v} {V' V'₁ : Type v'} {V'' : Type v''}
open Cardinal Basis Submodule Function Set
namespace LinearMap
section Ring
variable [Ring K] [AddCommGroup V] [Module K V] [AddCommGroup V₁] [Module K V₁]
variable [AddCommGroup V'] [Module K V']
abbrev rank (f : V →ₗ[K] V') : Cardinal :=
Module.rank K (LinearMap.range f)
#align linear_map.rank LinearMap.rank
theorem rank_le_range (f : V →ₗ[K] V') : rank f ≤ Module.rank K V' :=
rank_submodule_le _
#align linear_map.rank_le_range LinearMap.rank_le_range
theorem rank_le_domain (f : V →ₗ[K] V₁) : rank f ≤ Module.rank K V :=
rank_range_le _
#align linear_map.rank_le_domain LinearMap.rank_le_domain
@[simp]
| Mathlib/LinearAlgebra/Dimension/LinearMap.lean | 46 | 47 | theorem rank_zero [Nontrivial K] : rank (0 : V →ₗ[K] V') = 0 := by |
rw [rank, LinearMap.range_zero, rank_bot]
| 1 | 2.718282 | 0 | 0.2 | 5 | 277 |
import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.NormedSpace.WithLp
open Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal
noncomputable section
variable (p : ℝ≥0∞) (𝕜 α β : Type*)
namespace WithLp
section DistNorm
section EDist
variable [EDist α] [EDist β]
open scoped Classical in
instance instProdEDist : EDist (WithLp p (α × β)) where
edist f g :=
if _hp : p = 0 then
(if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1)
else if p = ∞ then
edist f.fst g.fst ⊔ edist f.snd g.snd
else
(edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal)
variable {p α β}
variable (x y : WithLp p (α × β)) (x' : α × β)
@[simp]
| Mathlib/Analysis/NormedSpace/ProdLp.lean | 161 | 164 | theorem prod_edist_eq_card (f g : WithLp 0 (α × β)) :
edist f g =
(if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1) := by |
convert if_pos rfl
| 1 | 2.718282 | 0 | 0.5 | 6 | 431 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {α : Type*} {β : Type*}
local notation "𝕎" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace WittVector
private def ghostFun : 𝕎 R → ℕ → R := fun x n => aeval x.coeff (W_ ℤ n)
section GhostFun
variable (x y : WittVector p R)
-- The following lemmas are not `@[simp]` because they will be bundled in `ghostMap` later on.
@[local simp]
| Mathlib/RingTheory/WittVector/Basic.lean | 183 | 185 | theorem matrix_vecEmpty_coeff {R} (i j) :
@coeff p R (Matrix.vecEmpty i) j = (Matrix.vecEmpty i : ℕ → R) j := by |
rcases i with ⟨_ | _ | _ | _ | i_val, ⟨⟩⟩
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
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]
| Mathlib/Data/Multiset/FinsetOps.lean | 79 | 80 | theorem length_ndinsert_of_not_mem {a : α} {s : Multiset α} (h : a ∉ s) :
card (ndinsert a s) = card s + 1 := by | simp [h]
| 1 | 2.718282 | 0 | 0.4 | 5 | 392 |
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]
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]
#align matrix.transvection_mul_apply_same Matrix.transvection_mul_apply_same
@[simp]
theorem mul_transvection_apply_same (a : n) (c : R) (M : Matrix n n R) :
(M * transvection i j c) a j = M a j + c * M a i := by
simp [transvection, Matrix.mul_add, mul_comm]
#align matrix.mul_transvection_apply_same Matrix.mul_transvection_apply_same
@[simp]
theorem transvection_mul_apply_of_ne (a b : n) (ha : a ≠ i) (c : R) (M : Matrix n n R) :
(transvection i j c * M) a b = M a b := by simp [transvection, Matrix.add_mul, ha]
#align matrix.transvection_mul_apply_of_ne Matrix.transvection_mul_apply_of_ne
@[simp]
theorem mul_transvection_apply_of_ne (a b : n) (hb : b ≠ j) (c : R) (M : Matrix n n R) :
(M * transvection i j c) a b = M a b := by simp [transvection, Matrix.mul_add, hb]
#align matrix.mul_transvection_apply_of_ne Matrix.mul_transvection_apply_of_ne
@[simp]
theorem det_transvection_of_ne (h : i ≠ j) (c : R) : det (transvection i j c) = 1 := by
rw [← updateRow_eq_transvection i j, det_updateRow_add_smul_self _ h, det_one]
#align matrix.det_transvection_of_ne Matrix.det_transvection_of_ne
end
variable (R n)
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure TransvectionStruct where
(i j : n)
hij : i ≠ j
c : R
#align matrix.transvection_struct Matrix.TransvectionStruct
instance [Nontrivial n] : Nonempty (TransvectionStruct n R) := by
choose x y hxy using exists_pair_ne n
exact ⟨⟨x, y, hxy, 0⟩⟩
namespace TransvectionStruct
variable {R n}
def toMatrix (t : TransvectionStruct n R) : Matrix n n R :=
transvection t.i t.j t.c
#align matrix.transvection_struct.to_matrix Matrix.TransvectionStruct.toMatrix
@[simp]
theorem toMatrix_mk (i j : n) (hij : i ≠ j) (c : R) :
TransvectionStruct.toMatrix ⟨i, j, hij, c⟩ = transvection i j c :=
rfl
#align matrix.transvection_struct.to_matrix_mk Matrix.TransvectionStruct.toMatrix_mk
@[simp]
protected theorem det [Fintype n] (t : TransvectionStruct n R) : det t.toMatrix = 1 :=
det_transvection_of_ne _ _ t.hij _
#align matrix.transvection_struct.det Matrix.TransvectionStruct.det
@[simp]
theorem det_toMatrix_prod [Fintype n] (L : List (TransvectionStruct n 𝕜)) :
det (L.map toMatrix).prod = 1 := by
induction' L with t L IH
· simp
· simp [IH]
#align matrix.transvection_struct.det_to_matrix_prod Matrix.TransvectionStruct.det_toMatrix_prod
@[simps]
protected def inv (t : TransvectionStruct n R) : TransvectionStruct n R where
i := t.i
j := t.j
hij := t.hij
c := -t.c
#align matrix.transvection_struct.inv Matrix.TransvectionStruct.inv
section
variable [Fintype n]
theorem inv_mul (t : TransvectionStruct n R) : t.inv.toMatrix * t.toMatrix = 1 := by
rcases t with ⟨_, _, t_hij⟩
simp [toMatrix, transvection_mul_transvection_same, t_hij]
#align matrix.transvection_struct.inv_mul Matrix.TransvectionStruct.inv_mul
| Mathlib/LinearAlgebra/Matrix/Transvection.lean | 210 | 212 | theorem mul_inv (t : TransvectionStruct n R) : t.toMatrix * t.inv.toMatrix = 1 := by |
rcases t with ⟨_, _, t_hij⟩
simp [toMatrix, transvection_mul_transvection_same, t_hij]
| 2 | 7.389056 | 1 | 0.666667 | 12 | 572 |
import Mathlib.MeasureTheory.MeasurableSpace.Defs
open Set Function
open scoped MeasureTheory
namespace MeasurableSpace
variable {α : Type*}
def invariants [m : MeasurableSpace α] (f : α → α) : MeasurableSpace α :=
{ m ⊓ ⟨fun s ↦ f ⁻¹' s = s, by simp, by simp, fun f hf ↦ by simp [hf]⟩ with
MeasurableSet' := fun s ↦ MeasurableSet[m] s ∧ f ⁻¹' s = s }
variable [MeasurableSpace α]
theorem measurableSet_invariants {f : α → α} {s : Set α} :
MeasurableSet[invariants f] s ↔ MeasurableSet s ∧ f ⁻¹' s = s :=
.rfl
@[simp]
theorem invariants_id : invariants (id : α → α) = ‹MeasurableSpace α› :=
ext fun _ ↦ ⟨And.left, fun h ↦ ⟨h, rfl⟩⟩
theorem invariants_le (f : α → α) : invariants f ≤ ‹MeasurableSpace α› := fun _ ↦ And.left
theorem inf_le_invariants_comp (f g : α → α) :
invariants f ⊓ invariants g ≤ invariants (f ∘ g) := fun s hs ↦
⟨hs.1.1, by rw [preimage_comp, hs.1.2, hs.2.2]⟩
theorem le_invariants_iterate (f : α → α) (n : ℕ) :
invariants f ≤ invariants (f^[n]) := by
induction n with
| zero => simp [invariants_le]
| succ n ihn => exact le_trans (le_inf ihn le_rfl) (inf_le_invariants_comp _ _)
variable {β : Type*} [MeasurableSpace β]
| Mathlib/MeasureTheory/MeasurableSpace/Invariants.lean | 58 | 60 | theorem measurable_invariants_dom {f : α → α} {g : α → β} :
Measurable[invariants f] g ↔ Measurable g ∧ ∀ s, MeasurableSet s → (g ∘ f) ⁻¹' s = g ⁻¹' s := by |
simp only [Measurable, ← forall_and]; rfl
| 1 | 2.718282 | 0 | 0.5 | 2 | 428 |
import Mathlib.MeasureTheory.Measure.Dirac
set_option autoImplicit true
open Set
open scoped ENNReal Classical
variable [MeasurableSpace α] [MeasurableSpace β] {s : Set α}
noncomputable section
namespace MeasureTheory.Measure
def count : Measure α :=
sum dirac
#align measure_theory.measure.count MeasureTheory.Measure.count
theorem le_count_apply : ∑' _ : s, (1 : ℝ≥0∞) ≤ count s :=
calc
(∑' _ : s, 1 : ℝ≥0∞) = ∑' i, indicator s 1 i := tsum_subtype s 1
_ ≤ ∑' i, dirac i s := ENNReal.tsum_le_tsum fun _ => le_dirac_apply
_ ≤ count s := le_sum_apply _ _
#align measure_theory.measure.le_count_apply MeasureTheory.Measure.le_count_apply
theorem count_apply (hs : MeasurableSet s) : count s = ∑' i : s, 1 := by
simp only [count, sum_apply, hs, dirac_apply', ← tsum_subtype s (1 : α → ℝ≥0∞), Pi.one_apply]
#align measure_theory.measure.count_apply MeasureTheory.Measure.count_apply
-- @[simp] -- Porting note (#10618): simp can prove this
| Mathlib/MeasureTheory/Measure/Count.lean | 44 | 44 | theorem count_empty : count (∅ : Set α) = 0 := by | rw [count_apply MeasurableSet.empty, tsum_empty]
| 1 | 2.718282 | 0 | 1.1 | 10 | 1,189 |
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section EDist
variable [EDist α] {x y : α} {s t : Set α}
theorem le_einfsep_iff {d} :
d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by
simp_rw [einfsep, le_iInf_iff]
#align set.le_einfsep_iff Set.le_einfsep_iff
theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by
simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop]
#align set.einfsep_zero Set.einfsep_zero
theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by
rw [pos_iff_ne_zero, Ne, einfsep_zero]
simp only [not_forall, not_exists, not_lt, exists_prop, not_and]
#align set.einfsep_pos Set.einfsep_pos
| Mathlib/Topology/MetricSpace/Infsep.lean | 64 | 66 | theorem einfsep_top :
s.einfsep = ∞ ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → edist x y = ∞ := by |
simp_rw [einfsep, iInf_eq_top]
| 1 | 2.718282 | 0 | 0.25 | 12 | 302 |
import Mathlib.Algebra.ContinuedFractions.Basic
import Mathlib.Algebra.GroupWithZero.Basic
#align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
section General
variable {α : Type*} {g : GeneralizedContinuedFraction α} {n : ℕ}
theorem terminatedAt_iff_s_terminatedAt : g.TerminatedAt n ↔ g.s.TerminatedAt n := by rfl
#align generalized_continued_fraction.terminated_at_iff_s_terminated_at GeneralizedContinuedFraction.terminatedAt_iff_s_terminatedAt
theorem terminatedAt_iff_s_none : g.TerminatedAt n ↔ g.s.get? n = none := by rfl
#align generalized_continued_fraction.terminated_at_iff_s_none GeneralizedContinuedFraction.terminatedAt_iff_s_none
theorem part_num_none_iff_s_none : g.partialNumerators.get? n = none ↔ g.s.get? n = none := by
cases s_nth_eq : g.s.get? n <;> simp [partialNumerators, s_nth_eq]
#align generalized_continued_fraction.part_num_none_iff_s_none GeneralizedContinuedFraction.part_num_none_iff_s_none
theorem terminatedAt_iff_part_num_none : g.TerminatedAt n ↔ g.partialNumerators.get? n = none := by
rw [terminatedAt_iff_s_none, part_num_none_iff_s_none]
#align generalized_continued_fraction.terminated_at_iff_part_num_none GeneralizedContinuedFraction.terminatedAt_iff_part_num_none
| Mathlib/Algebra/ContinuedFractions/Translations.lean | 49 | 50 | theorem part_denom_none_iff_s_none : g.partialDenominators.get? n = none ↔ g.s.get? n = none := by |
cases s_nth_eq : g.s.get? n <;> simp [partialDenominators, s_nth_eq]
| 1 | 2.718282 | 0 | 0.052632 | 19 | 240 |
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u w
open CategoryTheory CategoryTheory.Limits
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
open scoped Classical
noncomputable section
section
variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g]
theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g :=
imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp)
#align image_le_kernel image_le_kernel
def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) :=
Subobject.ofLE _ _ (image_le_kernel _ _ w)
#align image_to_kernel imageToKernel
instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by
dsimp only [imageToKernel]
infer_instance
@[simp]
theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) :
Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w :=
rfl
#align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel
attribute [local instance] ConcreteCategory.instFunLike
-- Porting note: removed elementwise attribute which does not seem to be helpful here
-- a more suitable lemma is added below
@[reassoc (attr := simp)]
| Mathlib/Algebra/Homology/ImageToKernel.lean | 68 | 70 | theorem imageToKernel_arrow (w : f ≫ g = 0) :
imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by |
simp [imageToKernel]
| 1 | 2.718282 | 0 | 0.888889 | 9 | 768 |
import Mathlib.Algebra.Module.Defs
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.FreeModule.Basic
import Mathlib.LinearAlgebra.TensorProduct.Tower
#align_import algebra.module.projective from "leanprover-community/mathlib"@"405ea5cee7a7070ff8fb8dcb4cfb003532e34bce"
universe u v
open LinearMap hiding id
open Finsupp
class Module.Projective (R : Type*) [Semiring R] (P : Type*) [AddCommMonoid P] [Module R P] :
Prop where
out : ∃ s : P →ₗ[R] P →₀ R, Function.LeftInverse (Finsupp.total P P R id) s
#align module.projective Module.Projective
namespace Module
section Semiring
variable {R : Type*} [Semiring R] {P : Type*} [AddCommMonoid P] [Module R P] {M : Type*}
[AddCommMonoid M] [Module R M] {N : Type*} [AddCommMonoid N] [Module R N]
theorem projective_def :
Projective R P ↔ ∃ s : P →ₗ[R] P →₀ R, Function.LeftInverse (Finsupp.total P P R id) s :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
#align module.projective_def Module.projective_def
| Mathlib/Algebra/Module/Projective.lean | 92 | 94 | theorem projective_def' :
Projective R P ↔ ∃ s : P →ₗ[R] P →₀ R, Finsupp.total P P R id ∘ₗ s = .id := by |
simp_rw [projective_def, DFunLike.ext_iff, Function.LeftInverse, comp_apply, id_apply]
| 1 | 2.718282 | 0 | 1.333333 | 3 | 1,371 |
import Mathlib.Analysis.Calculus.FDeriv.Bilinear
#align_import analysis.calculus.fderiv.mul from "leanprover-community/mathlib"@"d608fc5d4e69d4cc21885913fb573a88b0deb521"
open scoped Classical
open Filter Asymptotics ContinuousLinearMap Set Metric Topology NNReal 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']
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}
section ContinuousMultilinearApplyConst
variable {ι : Type*} [Fintype ι]
{M : ι → Type*} [∀ i, NormedAddCommGroup (M i)] [∀ i, NormedSpace 𝕜 (M i)]
{H : Type*} [NormedAddCommGroup H] [NormedSpace 𝕜 H]
{c : E → ContinuousMultilinearMap 𝕜 M H}
{c' : E →L[𝕜] ContinuousMultilinearMap 𝕜 M H}
@[fun_prop]
theorem HasStrictFDerivAt.continuousMultilinear_apply_const (hc : HasStrictFDerivAt c c' x)
(u : ∀ i, M i) : HasStrictFDerivAt (fun y ↦ (c y) u) (c'.flipMultilinear u) x :=
(ContinuousMultilinearMap.apply 𝕜 M H u).hasStrictFDerivAt.comp x hc
@[fun_prop]
theorem HasFDerivWithinAt.continuousMultilinear_apply_const (hc : HasFDerivWithinAt c c' s x)
(u : ∀ i, M i) :
HasFDerivWithinAt (fun y ↦ (c y) u) (c'.flipMultilinear u) s x :=
(ContinuousMultilinearMap.apply 𝕜 M H u).hasFDerivAt.comp_hasFDerivWithinAt x hc
@[fun_prop]
theorem HasFDerivAt.continuousMultilinear_apply_const (hc : HasFDerivAt c c' x) (u : ∀ i, M i) :
HasFDerivAt (fun y ↦ (c y) u) (c'.flipMultilinear u) x :=
(ContinuousMultilinearMap.apply 𝕜 M H u).hasFDerivAt.comp x hc
@[fun_prop]
theorem DifferentiableWithinAt.continuousMultilinear_apply_const
(hc : DifferentiableWithinAt 𝕜 c s x) (u : ∀ i, M i) :
DifferentiableWithinAt 𝕜 (fun y ↦ (c y) u) s x :=
(hc.hasFDerivWithinAt.continuousMultilinear_apply_const u).differentiableWithinAt
@[fun_prop]
theorem DifferentiableAt.continuousMultilinear_apply_const (hc : DifferentiableAt 𝕜 c x)
(u : ∀ i, M i) :
DifferentiableAt 𝕜 (fun y ↦ (c y) u) x :=
(hc.hasFDerivAt.continuousMultilinear_apply_const u).differentiableAt
@[fun_prop]
theorem DifferentiableOn.continuousMultilinear_apply_const (hc : DifferentiableOn 𝕜 c s)
(u : ∀ i, M i) : DifferentiableOn 𝕜 (fun y ↦ (c y) u) s :=
fun x hx ↦ (hc x hx).continuousMultilinear_apply_const u
@[fun_prop]
theorem Differentiable.continuousMultilinear_apply_const (hc : Differentiable 𝕜 c) (u : ∀ i, M i) :
Differentiable 𝕜 fun y ↦ (c y) u := fun x ↦ (hc x).continuousMultilinear_apply_const u
theorem fderivWithin_continuousMultilinear_apply_const (hxs : UniqueDiffWithinAt 𝕜 s x)
(hc : DifferentiableWithinAt 𝕜 c s x) (u : ∀ i, M i) :
fderivWithin 𝕜 (fun y ↦ (c y) u) s x = ((fderivWithin 𝕜 c s x).flipMultilinear u) :=
(hc.hasFDerivWithinAt.continuousMultilinear_apply_const u).fderivWithin hxs
theorem fderiv_continuousMultilinear_apply_const (hc : DifferentiableAt 𝕜 c x) (u : ∀ i, M i) :
(fderiv 𝕜 (fun y ↦ (c y) u) x) = (fderiv 𝕜 c x).flipMultilinear u :=
(hc.hasFDerivAt.continuousMultilinear_apply_const u).fderiv
| Mathlib/Analysis/Calculus/FDeriv/Mul.lean | 224 | 227 | theorem fderivWithin_continuousMultilinear_apply_const_apply (hxs : UniqueDiffWithinAt 𝕜 s x)
(hc : DifferentiableWithinAt 𝕜 c s x) (u : ∀ i, M i) (m : E) :
(fderivWithin 𝕜 (fun y ↦ (c y) u) s x) m = (fderivWithin 𝕜 c s x) m u := by |
simp [fderivWithin_continuousMultilinear_apply_const hxs hc]
| 1 | 2.718282 | 0 | 0.375 | 8 | 376 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {α : Type*} {β : Type*}
local notation "𝕎" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x =>
⟨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R →+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;>
ext ⟨i, k⟩ <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac
#align witt_vector.map_fun.mul WittVector.mapFun.mul
theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac
#align witt_vector.map_fun.neg WittVector.mapFun.neg
theorem nsmul (n : ℕ) (x : WittVector p R) : mapFun f (n • x) = n • mapFun f x := by map_fun_tac
#align witt_vector.map_fun.nsmul WittVector.mapFun.nsmul
theorem zsmul (z : ℤ) (x : WittVector p R) : mapFun f (z • x) = z • mapFun f x := by map_fun_tac
#align witt_vector.map_fun.zsmul WittVector.mapFun.zsmul
| Mathlib/RingTheory/WittVector/Basic.lean | 126 | 126 | theorem pow (n : ℕ) : mapFun f (x ^ n) = mapFun f x ^ n := by | map_fun_tac
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.Order.Fin
import Mathlib.Order.PiLex
import Mathlib.Order.Interval.Set.Basic
#align_import data.fin.tuple.basic from "leanprover-community/mathlib"@"ef997baa41b5c428be3fb50089a7139bf4ee886b"
assert_not_exists MonoidWithZero
universe u v
namespace Fin
variable {m n : ℕ}
open Function
section Tuple
example (α : Fin 0 → Sort u) : Unique (∀ i : Fin 0, α i) := by infer_instance
theorem tuple0_le {α : Fin 0 → Type*} [∀ i, Preorder (α i)] (f g : ∀ i, α i) : f ≤ g :=
finZeroElim
#align fin.tuple0_le Fin.tuple0_le
variable {α : Fin (n + 1) → Type u} (x : α 0) (q : ∀ i, α i) (p : ∀ i : Fin n, α i.succ) (i : Fin n)
(y : α i.succ) (z : α 0)
def tail (q : ∀ i, α i) : ∀ i : Fin n, α i.succ := fun i ↦ q i.succ
#align fin.tail Fin.tail
theorem tail_def {n : ℕ} {α : Fin (n + 1) → Type*} {q : ∀ i, α i} :
(tail fun k : Fin (n + 1) ↦ q k) = fun k : Fin n ↦ q k.succ :=
rfl
#align fin.tail_def Fin.tail_def
def cons (x : α 0) (p : ∀ i : Fin n, α i.succ) : ∀ i, α i := fun j ↦ Fin.cases x p j
#align fin.cons Fin.cons
@[simp]
theorem tail_cons : tail (cons x p) = p := by
simp (config := { unfoldPartialApp := true }) [tail, cons]
#align fin.tail_cons Fin.tail_cons
@[simp]
theorem cons_succ : cons x p i.succ = p i := by simp [cons]
#align fin.cons_succ Fin.cons_succ
@[simp]
theorem cons_zero : cons x p 0 = x := by simp [cons]
#align fin.cons_zero Fin.cons_zero
@[simp]
| Mathlib/Data/Fin/Tuple/Basic.lean | 86 | 88 | theorem cons_one {α : Fin (n + 2) → Type*} (x : α 0) (p : ∀ i : Fin n.succ, α i.succ) :
cons x p 1 = p 0 := by |
rw [← cons_succ x p]; rfl
| 1 | 2.718282 | 0 | 0.875 | 8 | 761 |
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Transvection
import Mathlib.MeasureTheory.Group.LIntegral
import Mathlib.MeasureTheory.Integral.Marginal
import Mathlib.MeasureTheory.Measure.Stieltjes
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
#align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
assert_not_exists MeasureTheory.integral
noncomputable section
open scoped Classical
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ENNReal (ofReal)
open scoped ENNReal NNReal Topology
section regionBetween
variable {α : Type*}
def regionBetween (f g : α → ℝ) (s : Set α) : Set (α × ℝ) :=
{ p : α × ℝ | p.1 ∈ s ∧ p.2 ∈ Ioo (f p.1) (g p.1) }
#align region_between regionBetween
| Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean | 449 | 450 | theorem regionBetween_subset (f g : α → ℝ) (s : Set α) : regionBetween f g s ⊆ s ×ˢ univ := by |
simpa only [prod_univ, regionBetween, Set.preimage, setOf_subset_setOf] using fun a => And.left
| 1 | 2.718282 | 0 | 0.909091 | 22 | 790 |
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Data.SetLike.Fintype
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.PGroup
import Mathlib.GroupTheory.NoncommPiCoprod
import Mathlib.Order.Atoms.Finite
import Mathlib.Data.Set.Lattice
#align_import group_theory.sylow from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
open Fintype MulAction Subgroup
section InfiniteSylow
variable (p : ℕ) (G : Type*) [Group G]
structure Sylow extends Subgroup G where
isPGroup' : IsPGroup p toSubgroup
is_maximal' : ∀ {Q : Subgroup G}, IsPGroup p Q → toSubgroup ≤ Q → Q = toSubgroup
#align sylow Sylow
variable {p} {G}
namespace Sylow
attribute [coe] Sylow.toSubgroup
-- Porting note: Changed to `CoeOut`
instance : CoeOut (Sylow p G) (Subgroup G) :=
⟨Sylow.toSubgroup⟩
-- Porting note: syntactic tautology
-- @[simp]
-- theorem toSubgroup_eq_coe {P : Sylow p G} : P.toSubgroup = ↑P :=
-- rfl
#noalign sylow.to_subgroup_eq_coe
@[ext]
| Mathlib/GroupTheory/Sylow.lean | 76 | 76 | theorem ext {P Q : Sylow p G} (h : (P : Subgroup G) = Q) : P = Q := by | cases P; cases Q; congr
| 1 | 2.718282 | 0 | 0.8 | 5 | 700 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.