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
goals
listlengths
0
224
goals_before
listlengths
0
221
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")]
Mathlib/Data/List/OfFn.lean
75
77
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]
[ " (ofFn.go f i j h).length = i", " (ofFn.go f 0 j h).length = 0", " (ofFn.go f (n✝ + 1) j h).length = n✝ + 1", " (ofFn f).length = n", " j + k < n", " (ofFn.go f i j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨0, hk⟩ = f ⟨j + 0,...
[ " (ofFn.go f i j h).length = i", " (ofFn.go f 0 j h).length = 0", " (ofFn.go f (n✝ + 1) j h).length = n✝ + 1", " (ofFn f).length = n", " j + k < n", " (ofFn.go f i j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨k, hk⟩ = f ⟨j + k, ⋯⟩", " (ofFn.go f (i + 1) j h).get ⟨0, hk⟩ = f ⟨j + 0,...
import Mathlib.Data.ENNReal.Real #align_import data.real.conjugate_exponents from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open scoped ENNReal namespace Real @[mk_iff] structure IsConjExponent (p q : ℝ) : Prop where one_lt : 1 < p inv_add_inv_conj : p⁻¹ + q⁻¹ = 1 #align real.is_conjugate_exponent Real.IsConjExponent def conjExponent (p : ℝ) : ℝ := p / (p - 1) #align real.conjugate_exponent Real.conjExponent variable {a b p q : ℝ} (h : p.IsConjExponent q) namespace IsConjExponent theorem pos : 0 < p := lt_trans zero_lt_one h.one_lt #align real.is_conjugate_exponent.pos Real.IsConjExponent.pos theorem nonneg : 0 ≤ p := le_of_lt h.pos #align real.is_conjugate_exponent.nonneg Real.IsConjExponent.nonneg theorem ne_zero : p ≠ 0 := ne_of_gt h.pos #align real.is_conjugate_exponent.ne_zero Real.IsConjExponent.ne_zero theorem sub_one_pos : 0 < p - 1 := sub_pos.2 h.one_lt #align real.is_conjugate_exponent.sub_one_pos Real.IsConjExponent.sub_one_pos theorem sub_one_ne_zero : p - 1 ≠ 0 := ne_of_gt h.sub_one_pos #align real.is_conjugate_exponent.sub_one_ne_zero Real.IsConjExponent.sub_one_ne_zero protected lemma inv_pos : 0 < p⁻¹ := inv_pos.2 h.pos protected lemma inv_nonneg : 0 ≤ p⁻¹ := h.inv_pos.le protected lemma inv_ne_zero : p⁻¹ ≠ 0 := h.inv_pos.ne' theorem one_div_pos : 0 < 1 / p := _root_.one_div_pos.2 h.pos #align real.is_conjugate_exponent.one_div_pos Real.IsConjExponent.one_div_pos theorem one_div_nonneg : 0 ≤ 1 / p := le_of_lt h.one_div_pos #align real.is_conjugate_exponent.one_div_nonneg Real.IsConjExponent.one_div_nonneg theorem one_div_ne_zero : 1 / p ≠ 0 := ne_of_gt h.one_div_pos #align real.is_conjugate_exponent.one_div_ne_zero Real.IsConjExponent.one_div_ne_zero theorem conj_eq : q = p / (p - 1) := by have := h.inv_add_inv_conj rw [← eq_sub_iff_add_eq', inv_eq_iff_eq_inv] at this field_simp [this, h.ne_zero] #align real.is_conjugate_exponent.conj_eq Real.IsConjExponent.conj_eq lemma conjExponent_eq : conjExponent p = q := h.conj_eq.symm #align real.is_conjugate_exponent.conjugate_eq Real.IsConjExponent.conjExponent_eq lemma one_sub_inv : 1 - p⁻¹ = q⁻¹ := sub_eq_of_eq_add' h.inv_add_inv_conj.symm lemma inv_sub_one : p⁻¹ - 1 = -q⁻¹ := by rw [← h.inv_add_inv_conj, sub_add_cancel_left] theorem sub_one_mul_conj : (p - 1) * q = p := mul_comm q (p - 1) ▸ (eq_div_iff h.sub_one_ne_zero).1 h.conj_eq #align real.is_conjugate_exponent.sub_one_mul_conj Real.IsConjExponent.sub_one_mul_conj theorem mul_eq_add : p * q = p + q := by simpa only [sub_mul, sub_eq_iff_eq_add, one_mul] using h.sub_one_mul_conj #align real.is_conjugate_exponent.mul_eq_add Real.IsConjExponent.mul_eq_add @[symm] protected lemma symm : q.IsConjExponent p where one_lt := by simpa only [h.conj_eq] using (one_lt_div h.sub_one_pos).mpr (sub_one_lt p) inv_add_inv_conj := by simpa [add_comm] using h.inv_add_inv_conj #align real.is_conjugate_exponent.symm Real.IsConjExponent.symm
Mathlib/Data/Real/ConjExponents.lean
110
112
theorem div_conj_eq_sub_one : p / q = p - 1 := by
field_simp [h.symm.ne_zero] rw [h.sub_one_mul_conj]
[ " q = p / (p - 1)", " p⁻¹ - 1 = -q⁻¹", " p * q = p + q", " 1 < q", " q⁻¹ + p⁻¹ = 1", " p / q = p - 1", " p = (p - 1) * q" ]
[ " q = p / (p - 1)", " p⁻¹ - 1 = -q⁻¹", " p * q = p + q", " 1 < q", " q⁻¹ + p⁻¹ = 1", " p / q = p - 1" ]
import Mathlib.Algebra.Group.Defs import Mathlib.Algebra.Group.Prod import Mathlib.Data.PNat.Basic import Mathlib.GroupTheory.GroupAction.Prod variable {M : Type*} class PNatPowAssoc (M : Type*) [Mul M] [Pow M ℕ+] : Prop where protected ppow_add : ∀ (k n : ℕ+) (x : M), x ^ (k + n) = x ^ k * x ^ n protected ppow_one : ∀ (x : M), x ^ (1 : ℕ+) = x section Mul variable [Mul M] [Pow M ℕ+] [PNatPowAssoc M] theorem ppow_add (k n : ℕ+) (x : M) : x ^ (k + n) = x ^ k * x ^ n := PNatPowAssoc.ppow_add k n x @[simp] theorem ppow_one (x : M) : x ^ (1 : ℕ+) = x := PNatPowAssoc.ppow_one x theorem ppow_mul_assoc (k m n : ℕ+) (x : M) : (x ^ k * x ^ m) * x ^ n = x ^ k * (x ^ m * x ^ n) := by simp only [← ppow_add, add_assoc] theorem ppow_mul_comm (m n : ℕ+) (x : M) : x ^ m * x ^ n = x ^ n * x ^ m := by simp only [← ppow_add, add_comm] theorem ppow_mul (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ m) ^ n := by refine PNat.recOn n ?_ fun k hk ↦ ?_ · rw [ppow_one, mul_one] · rw [ppow_add, ppow_one, mul_add, ppow_add, mul_one, hk]
Mathlib/Algebra/Group/PNatPowAssoc.lean
72
74
theorem ppow_mul' (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ n) ^ m := by
rw [mul_comm] exact ppow_mul x n m
[ " x ^ k * x ^ m * x ^ n = x ^ k * (x ^ m * x ^ n)", " x ^ m * x ^ n = x ^ n * x ^ m", " x ^ (m * n) = (x ^ m) ^ n", " x ^ (m * 1) = (x ^ m) ^ 1", " x ^ (m * (k + 1)) = (x ^ m) ^ (k + 1)", " x ^ (m * n) = (x ^ n) ^ m", " x ^ (n * m) = (x ^ n) ^ m" ]
[ " x ^ k * x ^ m * x ^ n = x ^ k * (x ^ m * x ^ n)", " x ^ m * x ^ n = x ^ n * x ^ m", " x ^ (m * n) = (x ^ m) ^ n", " x ^ (m * 1) = (x ^ m) ^ 1", " x ^ (m * (k + 1)) = (x ^ m) ^ (k + 1)", " x ^ (m * n) = (x ^ n) ^ m" ]
import Mathlib.Analysis.SpecialFunctions.Exponential import Mathlib.Combinatorics.Derangements.Finite import Mathlib.Order.Filter.Basic #align_import combinatorics.derangements.exponential from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter NormedSpace open scoped Topology
Mathlib/Combinatorics/Derangements/Exponential.lean
24
52
theorem numDerangements_tendsto_inv_e : Tendsto (fun n => (numDerangements n : ℝ) / n.factorial) atTop (𝓝 (Real.exp (-1))) := by
-- we show that d(n)/n! is the partial sum of exp(-1), but offset by 1. -- this isn't entirely obvious, since we have to ensure that asc_factorial and -- factorial interact in the right way, e.g., that k ≤ n always let s : ℕ → ℝ := fun n => ∑ k ∈ Finset.range n, (-1 : ℝ) ^ k / k.factorial suffices ∀ n : ℕ, (numDerangements n : ℝ) / n.factorial = s (n + 1) by simp_rw [this] -- shift the function by 1, and then use the fact that the partial sums -- converge to the infinite sum rw [tendsto_add_atTop_iff_nat (f := fun n => ∑ k ∈ Finset.range n, (-1 : ℝ) ^ k / k.factorial) 1] apply HasSum.tendsto_sum_nat -- there's no specific lemma for ℝ that ∑ x^k/k! sums to exp(x), but it's -- true in more general fields, so use that lemma rw [Real.exp_eq_exp_ℝ] exact expSeries_div_hasSum_exp ℝ (-1 : ℝ) intro n rw [← Int.cast_natCast, numDerangements_sum] push_cast rw [Finset.sum_div] -- get down to individual terms refine Finset.sum_congr (refl _) ?_ intro k hk have h_le : k ≤ n := Finset.mem_range_succ_iff.mp hk rw [Nat.ascFactorial_eq_div, add_tsub_cancel_of_le h_le] push_cast [Nat.factorial_dvd_factorial h_le] field_simp [Nat.factorial_ne_zero] ring
[ " Tendsto (fun n => ↑(numDerangements n) / ↑n.factorial) atTop (𝓝 (-1).exp)", " Tendsto (fun n => s (n + 1)) atTop (𝓝 (-1).exp)", " Tendsto (fun n => ∑ k ∈ Finset.range n, (-1) ^ k / ↑k.factorial) atTop (𝓝 (-1).exp)", " HasSum (fun i => (-1) ^ i / ↑i.factorial) (-1).exp", " HasSum (fun i => (-1) ^ i / ↑i...
[ " Tendsto (fun n => ↑(numDerangements n) / ↑n.factorial) atTop (𝓝 (-1).exp)" ]
import Mathlib.Data.List.OfFn import Mathlib.Data.List.Nodup import Mathlib.Data.List.Infix #align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" open List.Perm universe u namespace List section Sorted variable {α : Type u} {r : α → α → Prop} {a : α} {l : List α} def Sorted := @Pairwise #align list.sorted List.Sorted instance decidableSorted [DecidableRel r] (l : List α) : Decidable (Sorted r l) := List.instDecidablePairwise _ #align list.decidable_sorted List.decidableSorted protected theorem Sorted.le_of_lt [Preorder α] {l : List α} (h : l.Sorted (· < ·)) : l.Sorted (· ≤ ·) := h.imp le_of_lt protected theorem Sorted.lt_of_le [PartialOrder α] {l : List α} (h₁ : l.Sorted (· ≤ ·)) (h₂ : l.Nodup) : l.Sorted (· < ·) := h₁.imp₂ (fun _ _ => lt_of_le_of_ne) h₂ protected theorem Sorted.ge_of_gt [Preorder α] {l : List α} (h : l.Sorted (· > ·)) : l.Sorted (· ≥ ·) := h.imp le_of_lt protected theorem Sorted.gt_of_ge [PartialOrder α] {l : List α} (h₁ : l.Sorted (· ≥ ·)) (h₂ : l.Nodup) : l.Sorted (· > ·) := h₁.imp₂ (fun _ _ => lt_of_le_of_ne) <| by simp_rw [ne_comm]; exact h₂ @[simp] theorem sorted_nil : Sorted r [] := Pairwise.nil #align list.sorted_nil List.sorted_nil theorem Sorted.of_cons : Sorted r (a :: l) → Sorted r l := Pairwise.of_cons #align list.sorted.of_cons List.Sorted.of_cons theorem Sorted.tail {r : α → α → Prop} {l : List α} (h : Sorted r l) : Sorted r l.tail := Pairwise.tail h #align list.sorted.tail List.Sorted.tail theorem rel_of_sorted_cons {a : α} {l : List α} : Sorted r (a :: l) → ∀ b ∈ l, r a b := rel_of_pairwise_cons #align list.rel_of_sorted_cons List.rel_of_sorted_cons theorem Sorted.head!_le [Inhabited α] [Preorder α] {a : α} {l : List α} (h : Sorted (· < ·) l) (ha : a ∈ l) : l.head! ≤ a := by rw [← List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha cases ha · exact le_rfl · exact le_of_lt (rel_of_sorted_cons h a (by assumption)) theorem Sorted.le_head! [Inhabited α] [Preorder α] {a : α} {l : List α} (h : Sorted (· > ·) l) (ha : a ∈ l) : a ≤ l.head! := by rw [← List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha cases ha · exact le_rfl · exact le_of_lt (rel_of_sorted_cons h a (by assumption)) @[simp] theorem sorted_cons {a : α} {l : List α} : Sorted r (a :: l) ↔ (∀ b ∈ l, r a b) ∧ Sorted r l := pairwise_cons #align list.sorted_cons List.sorted_cons protected theorem Sorted.nodup {r : α → α → Prop} [IsIrrefl α r] {l : List α} (h : Sorted r l) : Nodup l := Pairwise.nodup h #align list.sorted.nodup List.Sorted.nodup
Mathlib/Data/List/Sort.lean
104
120
theorem eq_of_perm_of_sorted [IsAntisymm α r] {l₁ l₂ : List α} (hp : l₁ ~ l₂) (hs₁ : Sorted r l₁) (hs₂ : Sorted r l₂) : l₁ = l₂ := by
induction' hs₁ with a l₁ h₁ hs₁ IH generalizing l₂ · exact hp.nil_eq · have : a ∈ l₂ := hp.subset (mem_cons_self _ _) rcases append_of_mem this with ⟨u₂, v₂, rfl⟩ have hp' := (perm_cons a).1 (hp.trans perm_middle) obtain rfl := IH hp' (hs₂.sublist <| by simp) change a :: u₂ ++ v₂ = u₂ ++ ([a] ++ v₂) rw [← append_assoc] congr have : ∀ x ∈ u₂, x = a := fun x m => antisymm ((pairwise_append.1 hs₂).2.2 _ m a (mem_cons_self _ _)) (h₁ _ (by simp [m])) rw [(@eq_replicate _ a (length u₂ + 1) (a :: u₂)).2, (@eq_replicate _ a (length u₂ + 1) (u₂ ++ [a])).2] <;> constructor <;> simp [iff_true_intro this, or_comm]
[ " Pairwise (fun x x_1 => x_1 ≠ x) l", " Pairwise (fun x x_1 => x ≠ x_1) l", " l.head! ≤ a", " l.head! ≤ l.head!", " a ∈ l.tail", " a ≤ l.head!", " l₁ = l₂", " [] = l₂", " a :: l₁ = l₂", " a :: l₁ = u₂ ++ a :: v₂", " u₂ ++ v₂ <+ u₂ ++ a :: v₂", " a :: (u₂ ++ v₂) = u₂ ++ a :: v₂", " a :: u₂ ++...
[ " Pairwise (fun x x_1 => x_1 ≠ x) l", " Pairwise (fun x x_1 => x ≠ x_1) l", " l.head! ≤ a", " l.head! ≤ l.head!", " a ∈ l.tail", " a ≤ l.head!", " l₁ = l₂" ]
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open Function Filter Set open scoped Topology namespace Real variable {x y : ℝ} -- @[pp_nodot] is no longer needed def arsinh (x : ℝ) := log (x + √(1 + x ^ 2)) #align real.arsinh Real.arsinh theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by apply exp_log rw [← neg_lt_iff_pos_add'] apply lt_sqrt_of_sq_lt simp #align real.exp_arsinh Real.exp_arsinh @[simp] theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh] #align real.arsinh_zero Real.arsinh_zero @[simp]
Mathlib/Analysis/SpecialFunctions/Arsinh.lean
69
73
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh] apply eq_inv_of_mul_eq_one_left rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right] exact add_nonneg zero_le_one (sq_nonneg _)
[ " rexp x.arsinh = x + √(1 + x ^ 2)", " 0 < x + √(1 + x ^ 2)", " -x < √(1 + x ^ 2)", " (-x) ^ 2 < 1 + x ^ 2", " arsinh 0 = 0", " (-x).arsinh = -x.arsinh", " -x + √(1 + (-x) ^ 2) = (x + √(1 + x ^ 2))⁻¹", " (-x + √(1 + (-x) ^ 2)) * (x + √(1 + x ^ 2)) = 1", " 0 ≤ 1 + x ^ 2" ]
[ " rexp x.arsinh = x + √(1 + x ^ 2)", " 0 < x + √(1 + x ^ 2)", " -x < √(1 + x ^ 2)", " (-x) ^ 2 < 1 + x ^ 2", " arsinh 0 = 0", " (-x).arsinh = -x.arsinh" ]
import Mathlib.Algebra.Order.Floor import Mathlib.Data.Rat.Cast.Order import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Ring #align_import data.rat.floor from "leanprover-community/mathlib"@"e1bccd6e40ae78370f01659715d3c948716e3b7e" open Int namespace Rat variable {α : Type*} [LinearOrderedField α] [FloorRing α] protected theorem floor_def' (a : ℚ) : a.floor = a.num / a.den := by rw [Rat.floor] split · next h => simp [h] · next => rfl protected theorem le_floor {z : ℤ} : ∀ {r : ℚ}, z ≤ Rat.floor r ↔ (z : ℚ) ≤ r | ⟨n, d, h, c⟩ => by simp only [Rat.floor_def'] rw [mk'_eq_divInt] have h' := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h) conv => rhs rw [intCast_eq_divInt, Rat.divInt_le_divInt zero_lt_one h', mul_one] exact Int.le_ediv_iff_mul_le h' #align rat.le_floor Rat.le_floor instance : FloorRing ℚ := (FloorRing.ofFloor ℚ Rat.floor) fun _ _ => Rat.le_floor.symm protected theorem floor_def {q : ℚ} : ⌊q⌋ = q.num / q.den := Rat.floor_def' q #align rat.floor_def Rat.floor_def theorem floor_int_div_nat_eq_div {n : ℤ} {d : ℕ} : ⌊(↑n : ℚ) / (↑d : ℚ)⌋ = n / (↑d : ℤ) := by rw [Rat.floor_def] obtain rfl | hd := @eq_zero_or_pos _ _ d · simp set q := (n : ℚ) / d with q_eq obtain ⟨c, n_eq_c_mul_num, d_eq_c_mul_denom⟩ : ∃ c, n = c * q.num ∧ (d : ℤ) = c * q.den := by rw [q_eq] exact mod_cast @Rat.exists_eq_mul_div_num_and_eq_mul_div_den n d (mod_cast hd.ne') rw [n_eq_c_mul_num, d_eq_c_mul_denom] refine (Int.mul_ediv_mul_of_pos _ _ <| pos_of_mul_pos_left ?_ <| Int.natCast_nonneg q.den).symm rwa [← d_eq_c_mul_denom, Int.natCast_pos] #align rat.floor_int_div_nat_eq_div Rat.floor_int_div_nat_eq_div @[simp, norm_cast] theorem floor_cast (x : ℚ) : ⌊(x : α)⌋ = ⌊x⌋ := floor_eq_iff.2 (mod_cast floor_eq_iff.1 (Eq.refl ⌊x⌋)) #align rat.floor_cast Rat.floor_cast @[simp, norm_cast] theorem ceil_cast (x : ℚ) : ⌈(x : α)⌉ = ⌈x⌉ := by rw [← neg_inj, ← floor_neg, ← floor_neg, ← Rat.cast_neg, Rat.floor_cast] #align rat.ceil_cast Rat.ceil_cast @[simp, norm_cast]
Mathlib/Data/Rat/Floor.lean
80
82
theorem round_cast (x : ℚ) : round (x : α) = round x := by
have : ((x + 1 / 2 : ℚ) : α) = x + 1 / 2 := by simp rw [round_eq, round_eq, ← this, floor_cast]
[ " a.floor = a.num / ↑a.den", " (if a.den = 1 then a.num else a.num / ↑a.den) = a.num / ↑a.den", " a.num = a.num / ↑a.den", " a.num / ↑a.den = a.num / ↑a.den", " z ≤ { num := n, den := d, den_nz := h, reduced := c }.floor ↔ ↑z ≤ { num := n, den := d, den_nz := h, reduced := c }", " z ≤ n / ↑d ↔ ↑z ≤ { num ...
[ " a.floor = a.num / ↑a.den", " (if a.den = 1 then a.num else a.num / ↑a.den) = a.num / ↑a.den", " a.num = a.num / ↑a.den", " a.num / ↑a.den = a.num / ↑a.den", " z ≤ { num := n, den := d, den_nz := h, reduced := c }.floor ↔ ↑z ≤ { num := n, den := d, den_nz := h, reduced := c }", " z ≤ n / ↑d ↔ ↑z ≤ { num ...
import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.MvPolynomial.Basic #align_import ring_theory.mv_polynomial.weighted_homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set Function Finset Finsupp AddMonoidAlgebra variable {R M : Type*} [CommSemiring R] namespace MvPolynomial variable {σ : Type*} section AddCommMonoid variable [AddCommMonoid M] def weightedDegree (w : σ → M) : (σ →₀ ℕ) →+ M := (Finsupp.total σ M ℕ w).toAddMonoidHom #align mv_polynomial.weighted_degree' MvPolynomial.weightedDegree
Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean
68
70
theorem weightedDegree_apply (w : σ → M) (f : σ →₀ ℕ): weightedDegree w f = Finsupp.sum f (fun i c => c • w i) := by
rfl
[ " (weightedDegree w) f = f.sum fun i c => c • w i" ]
[ " (weightedDegree w) f = f.sum fun i c => c • w i" ]
import Mathlib.Topology.UniformSpace.UniformConvergence import Mathlib.Topology.UniformSpace.Equicontinuity import Mathlib.Topology.Separation import Mathlib.Topology.Support #align_import topology.uniform_space.compact from "leanprover-community/mathlib"@"735b22f8f9ff9792cf4212d7cb051c4c994bc685" open scoped Classical open Uniformity Topology Filter UniformSpace Set variable {α β γ : Type*} [UniformSpace α] [UniformSpace β] theorem nhdsSet_diagonal_eq_uniformity [CompactSpace α] : 𝓝ˢ (diagonal α) = 𝓤 α := by refine nhdsSet_diagonal_le_uniformity.antisymm ?_ have : (𝓤 (α × α)).HasBasis (fun U => U ∈ 𝓤 α) fun U => (fun p : (α × α) × α × α => ((p.1.1, p.2.1), p.1.2, p.2.2)) ⁻¹' U ×ˢ U := by rw [uniformity_prod_eq_comap_prod] exact (𝓤 α).basis_sets.prod_self.comap _ refine (isCompact_diagonal.nhdsSet_basis_uniformity this).ge_iff.2 fun U hU => ?_ exact mem_of_superset hU fun ⟨x, y⟩ hxy => mem_iUnion₂.2 ⟨(x, x), rfl, refl_mem_uniformity hU, hxy⟩ #align nhds_set_diagonal_eq_uniformity nhdsSet_diagonal_eq_uniformity theorem compactSpace_uniformity [CompactSpace α] : 𝓤 α = ⨆ x, 𝓝 (x, x) := nhdsSet_diagonal_eq_uniformity.symm.trans (nhdsSet_diagonal _) #align compact_space_uniformity compactSpace_uniformity
Mathlib/Topology/UniformSpace/Compact.lean
69
75
theorem unique_uniformity_of_compact [t : TopologicalSpace γ] [CompactSpace γ] {u u' : UniformSpace γ} (h : u.toTopologicalSpace = t) (h' : u'.toTopologicalSpace = t) : u = u' := by
refine UniformSpace.ext ?_ have : @CompactSpace γ u.toTopologicalSpace := by rwa [h] have : @CompactSpace γ u'.toTopologicalSpace := by rwa [h'] rw [@compactSpace_uniformity _ u, compactSpace_uniformity, h, h']
[ " 𝓝ˢ (diagonal α) = 𝓤 α", " 𝓤 α ≤ 𝓝ˢ (diagonal α)", " (𝓤 (α × α)).HasBasis (fun U => U ∈ 𝓤 α) fun U => (fun p => ((p.1.1, p.2.1), p.1.2, p.2.2)) ⁻¹' U ×ˢ U", " (Filter.comap (fun p => ((p.1.1, p.2.1), p.1.2, p.2.2)) (𝓤 α ×ˢ 𝓤 α)).HasBasis (fun U => U ∈ 𝓤 α) fun U =>\n (fun p => ((p.1.1, p.2.1), p....
[ " 𝓝ˢ (diagonal α) = 𝓤 α", " 𝓤 α ≤ 𝓝ˢ (diagonal α)", " (𝓤 (α × α)).HasBasis (fun U => U ∈ 𝓤 α) fun U => (fun p => ((p.1.1, p.2.1), p.1.2, p.2.2)) ⁻¹' U ×ˢ U", " (Filter.comap (fun p => ((p.1.1, p.2.1), p.1.2, p.2.2)) (𝓤 α ×ˢ 𝓤 α)).HasBasis (fun U => U ∈ 𝓤 α) fun U =>\n (fun p => ((p.1.1, p.2.1), p....
import Mathlib.Logic.Function.Iterate import Mathlib.Order.Monotone.Basic #align_import order.iterate from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f" open Function open Function (Commute) namespace Monotone variable {α : Type*} [Preorder α] {f : α → α} {x y : ℕ → α} theorem seq_le_seq (hf : Monotone f) (n : ℕ) (h₀ : x 0 ≤ y 0) (hx : ∀ k < n, x (k + 1) ≤ f (x k)) (hy : ∀ k < n, f (y k) ≤ y (k + 1)) : x n ≤ y n := by induction' n with n ihn · exact h₀ · refine (hx _ n.lt_succ_self).trans ((hf <| ihn ?_ ?_).trans (hy _ n.lt_succ_self)) · exact fun k hk => hx _ (hk.trans n.lt_succ_self) · exact fun k hk => hy _ (hk.trans n.lt_succ_self) #align monotone.seq_le_seq Monotone.seq_le_seq theorem seq_pos_lt_seq_of_lt_of_le (hf : Monotone f) {n : ℕ} (hn : 0 < n) (h₀ : x 0 ≤ y 0) (hx : ∀ k < n, x (k + 1) < f (x k)) (hy : ∀ k < n, f (y k) ≤ y (k + 1)) : x n < y n := by induction' n with n ihn · exact hn.false.elim suffices x n ≤ y n from (hx n n.lt_succ_self).trans_le ((hf this).trans <| hy n n.lt_succ_self) cases n with | zero => exact h₀ | succ n => refine (ihn n.zero_lt_succ (fun k hk => hx _ ?_) fun k hk => hy _ ?_).le <;> exact hk.trans n.succ.lt_succ_self #align monotone.seq_pos_lt_seq_of_lt_of_le Monotone.seq_pos_lt_seq_of_lt_of_le theorem seq_pos_lt_seq_of_le_of_lt (hf : Monotone f) {n : ℕ} (hn : 0 < n) (h₀ : x 0 ≤ y 0) (hx : ∀ k < n, x (k + 1) ≤ f (x k)) (hy : ∀ k < n, f (y k) < y (k + 1)) : x n < y n := hf.dual.seq_pos_lt_seq_of_lt_of_le hn h₀ hy hx #align monotone.seq_pos_lt_seq_of_le_of_lt Monotone.seq_pos_lt_seq_of_le_of_lt
Mathlib/Order/Iterate.lean
68
71
theorem seq_lt_seq_of_lt_of_le (hf : Monotone f) (n : ℕ) (h₀ : x 0 < y 0) (hx : ∀ k < n, x (k + 1) < f (x k)) (hy : ∀ k < n, f (y k) ≤ y (k + 1)) : x n < y n := by
cases n exacts [h₀, hf.seq_pos_lt_seq_of_lt_of_le (Nat.zero_lt_succ _) h₀.le hx hy]
[ " x n ≤ y n", " x 0 ≤ y 0", " x (n + 1) ≤ y (n + 1)", " ∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)", " ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)", " x n < y n", " x 0 < y 0", " x (n + 1) < y (n + 1)", " k < n + 1 + 1", " x (n✝ + 1) < y (n✝ + 1)" ]
[ " x n ≤ y n", " x 0 ≤ y 0", " x (n + 1) ≤ y (n + 1)", " ∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)", " ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)", " x n < y n", " x 0 < y 0", " x (n + 1) < y (n + 1)", " k < n + 1 + 1" ]
import Mathlib.Algebra.Algebra.Tower import Mathlib.Algebra.Polynomial.AlgebraMap #align_import ring_theory.polynomial.tower from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" open Polynomial variable (R A B : Type*) namespace Polynomial section Semiring variable [CommSemiring R] [CommSemiring A] [Semiring B] variable [Algebra R A] [Algebra A B] [Algebra R B] variable [IsScalarTower R A B] variable {R B} @[simp]
Mathlib/RingTheory/Polynomial/Tower.lean
37
38
theorem aeval_map_algebraMap (x : B) (p : R[X]) : aeval x (map (algebraMap R A) p) = aeval x p := by
rw [aeval_def, aeval_def, eval₂_map, IsScalarTower.algebraMap_eq R A B]
[ " (aeval x) (map (algebraMap R A) p) = (aeval x) p" ]
[ " (aeval x) (map (algebraMap R A) p) = (aeval x) p" ]
import Mathlib.GroupTheory.OrderOfElement import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.Ideal.Quotient #align_import algebra.char_p.quotient from "leanprover-community/mathlib"@"85e3c05a94b27c84dc6f234cf88326d5e0096ec3" universe u v namespace CharP theorem quotient (R : Type u) [CommRing R] (p : ℕ) [hp1 : Fact p.Prime] (hp2 : ↑p ∈ nonunits R) : CharP (R ⧸ (Ideal.span ({(p : R)} : Set R) : Ideal R)) p := have hp0 : (p : R ⧸ (Ideal.span {(p : R)} : Ideal R)) = 0 := map_natCast (Ideal.Quotient.mk (Ideal.span {(p : R)} : Ideal R)) p ▸ Ideal.Quotient.eq_zero_iff_mem.2 (Ideal.subset_span <| Set.mem_singleton _) ringChar.of_eq <| Or.resolve_left ((Nat.dvd_prime hp1.1).1 <| ringChar.dvd hp0) fun h1 => hp2 <| isUnit_iff_dvd_one.2 <| Ideal.mem_span_singleton.1 <| Ideal.Quotient.eq_zero_iff_mem.1 <| @Subsingleton.elim _ (@CharOne.subsingleton _ _ (ringChar.of_eq h1)) _ _ #align char_p.quotient CharP.quotient theorem quotient' {R : Type*} [CommRing R] (p : ℕ) [CharP R p] (I : Ideal R) (h : ∀ x : ℕ, (x : R) ∈ I → (x : R) = 0) : CharP (R ⧸ I) p := ⟨fun x => by rw [← cast_eq_zero_iff R p x, ← map_natCast (Ideal.Quotient.mk I)] refine Ideal.Quotient.eq.trans (?_ : ↑x - 0 ∈ I ↔ _) rw [sub_zero] exact ⟨h x, fun h' => h'.symm ▸ I.zero_mem⟩⟩ #align char_p.quotient' CharP.quotient'
Mathlib/Algebra/CharP/Quotient.lean
47
51
theorem quotient_iff {R : Type*} [CommRing R] (n : ℕ) [CharP R n] (I : Ideal R) : CharP (R ⧸ I) n ↔ ∀ x : ℕ, ↑x ∈ I → (x : R) = 0 := by
refine ⟨fun _ x hx => ?_, CharP.quotient' n I⟩ rw [CharP.cast_eq_zero_iff R n, ← CharP.cast_eq_zero_iff (R ⧸ I) n _] exact (Submodule.Quotient.mk_eq_zero I).mpr hx
[ " ↑x = 0 ↔ p ∣ x", " (Ideal.Quotient.mk I) ↑x = 0 ↔ ↑x = 0", " ↑x - 0 ∈ I ↔ ↑x = 0", " ↑x ∈ I ↔ ↑x = 0", " CharP (R ⧸ I) n ↔ ∀ (x : ℕ), ↑x ∈ I → ↑x = 0", " ↑x = 0" ]
[ " ↑x = 0 ↔ p ∣ x", " (Ideal.Quotient.mk I) ↑x = 0 ↔ ↑x = 0", " ↑x - 0 ∈ I ↔ ↑x = 0", " ↑x ∈ I ↔ ↑x = 0", " CharP (R ⧸ I) n ↔ ∀ (x : ℕ), ↑x ∈ I → ↑x = 0" ]
import Mathlib.Order.Interval.Set.Monotone import Mathlib.Topology.MetricSpace.Basic import Mathlib.Topology.MetricSpace.Bounded import Mathlib.Topology.Order.MonotoneConvergence #align_import analysis.box_integral.box.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Metric Filter noncomputable section open scoped Classical open NNReal Topology namespace BoxIntegral variable {ι : Type*} structure Box (ι : Type*) where (lower upper : ι → ℝ) lower_lt_upper : ∀ i, lower i < upper i #align box_integral.box BoxIntegral.Box attribute [simp] Box.lower_lt_upper namespace Box variable (I J : Box ι) {x y : ι → ℝ} instance : Inhabited (Box ι) := ⟨⟨0, 1, fun _ ↦ zero_lt_one⟩⟩ theorem lower_le_upper : I.lower ≤ I.upper := fun i ↦ (I.lower_lt_upper i).le #align box_integral.box.lower_le_upper BoxIntegral.Box.lower_le_upper theorem lower_ne_upper (i) : I.lower i ≠ I.upper i := (I.lower_lt_upper i).ne #align box_integral.box.lower_ne_upper BoxIntegral.Box.lower_ne_upper instance : Membership (ι → ℝ) (Box ι) := ⟨fun x I ↦ ∀ i, x i ∈ Ioc (I.lower i) (I.upper i)⟩ -- Porting note: added @[coe] def toSet (I : Box ι) : Set (ι → ℝ) := { x | x ∈ I } instance : CoeTC (Box ι) (Set <| ι → ℝ) := ⟨toSet⟩ @[simp] theorem mem_mk {l u x : ι → ℝ} {H} : x ∈ mk l u H ↔ ∀ i, x i ∈ Ioc (l i) (u i) := Iff.rfl #align box_integral.box.mem_mk BoxIntegral.Box.mem_mk @[simp, norm_cast] theorem mem_coe : x ∈ (I : Set (ι → ℝ)) ↔ x ∈ I := Iff.rfl #align box_integral.box.mem_coe BoxIntegral.Box.mem_coe theorem mem_def : x ∈ I ↔ ∀ i, x i ∈ Ioc (I.lower i) (I.upper i) := Iff.rfl #align box_integral.box.mem_def BoxIntegral.Box.mem_def theorem mem_univ_Ioc {I : Box ι} : (x ∈ pi univ fun i ↦ Ioc (I.lower i) (I.upper i)) ↔ x ∈ I := mem_univ_pi #align box_integral.box.mem_univ_Ioc BoxIntegral.Box.mem_univ_Ioc theorem coe_eq_pi : (I : Set (ι → ℝ)) = pi univ fun i ↦ Ioc (I.lower i) (I.upper i) := Set.ext fun _ ↦ mem_univ_Ioc.symm #align box_integral.box.coe_eq_pi BoxIntegral.Box.coe_eq_pi @[simp] theorem upper_mem : I.upper ∈ I := fun i ↦ right_mem_Ioc.2 <| I.lower_lt_upper i #align box_integral.box.upper_mem BoxIntegral.Box.upper_mem theorem exists_mem : ∃ x, x ∈ I := ⟨_, I.upper_mem⟩ #align box_integral.box.exists_mem BoxIntegral.Box.exists_mem theorem nonempty_coe : Set.Nonempty (I : Set (ι → ℝ)) := I.exists_mem #align box_integral.box.nonempty_coe BoxIntegral.Box.nonempty_coe @[simp] theorem coe_ne_empty : (I : Set (ι → ℝ)) ≠ ∅ := I.nonempty_coe.ne_empty #align box_integral.box.coe_ne_empty BoxIntegral.Box.coe_ne_empty @[simp] theorem empty_ne_coe : ∅ ≠ (I : Set (ι → ℝ)) := I.coe_ne_empty.symm #align box_integral.box.empty_ne_coe BoxIntegral.Box.empty_ne_coe instance : LE (Box ι) := ⟨fun I J ↦ ∀ ⦃x⦄, x ∈ I → x ∈ J⟩ theorem le_def : I ≤ J ↔ ∀ x ∈ I, x ∈ J := Iff.rfl #align box_integral.box.le_def BoxIntegral.Box.le_def theorem le_TFAE : List.TFAE [I ≤ J, (I : Set (ι → ℝ)) ⊆ J, Icc I.lower I.upper ⊆ Icc J.lower J.upper, J.lower ≤ I.lower ∧ I.upper ≤ J.upper] := by tfae_have 1 ↔ 2 · exact Iff.rfl tfae_have 2 → 3 · intro h simpa [coe_eq_pi, closure_pi_set, lower_ne_upper] using closure_mono h tfae_have 3 ↔ 4 · exact Icc_subset_Icc_iff I.lower_le_upper tfae_have 4 → 2 · exact fun h x hx i ↦ Ioc_subset_Ioc (h.1 i) (h.2 i) (hx i) tfae_finish #align box_integral.box.le_tfae BoxIntegral.Box.le_TFAE variable {I J} @[simp, norm_cast] theorem coe_subset_coe : (I : Set (ι → ℝ)) ⊆ J ↔ I ≤ J := Iff.rfl #align box_integral.box.coe_subset_coe BoxIntegral.Box.coe_subset_coe theorem le_iff_bounds : I ≤ J ↔ J.lower ≤ I.lower ∧ I.upper ≤ J.upper := (le_TFAE I J).out 0 3 #align box_integral.box.le_iff_bounds BoxIntegral.Box.le_iff_bounds
Mathlib/Analysis/BoxIntegral/Box/Basic.lean
181
185
theorem injective_coe : Injective ((↑) : Box ι → Set (ι → ℝ)) := by
rintro ⟨l₁, u₁, h₁⟩ ⟨l₂, u₂, h₂⟩ h simp only [Subset.antisymm_iff, coe_subset_coe, le_iff_bounds] at h congr exacts [le_antisymm h.2.1 h.1.1, le_antisymm h.1.2 h.2.2]
[ " [I ≤ J, ↑I ⊆ ↑J, Icc I.lower I.upper ⊆ Icc J.lower J.upper, J.lower ≤ I.lower ∧ I.upper ≤ J.upper].TFAE", " I ≤ J ↔ ↑I ⊆ ↑J", " ↑I ⊆ ↑J → Icc I.lower I.upper ⊆ Icc J.lower J.upper", " Icc I.lower I.upper ⊆ Icc J.lower J.upper", " Icc I.lower I.upper ⊆ Icc J.lower J.upper ↔ J.lower ≤ I.lower ∧ I.upper ≤ J....
[ " [I ≤ J, ↑I ⊆ ↑J, Icc I.lower I.upper ⊆ Icc J.lower J.upper, J.lower ≤ I.lower ∧ I.upper ≤ J.upper].TFAE", " I ≤ J ↔ ↑I ⊆ ↑J", " ↑I ⊆ ↑J → Icc I.lower I.upper ⊆ Icc J.lower J.upper", " Icc I.lower I.upper ⊆ Icc J.lower J.upper", " Icc I.lower I.upper ⊆ Icc J.lower J.upper ↔ J.lower ≤ I.lower ∧ I.upper ≤ J....
import Mathlib.Data.Matrix.Basis import Mathlib.RingTheory.TensorProduct.Basic #align_import ring_theory.matrix_algebra from "leanprover-community/mathlib"@"6c351a8fb9b06e5a542fdf427bfb9f46724f9453" suppress_compilation universe u v w open TensorProduct open TensorProduct open Algebra.TensorProduct open Matrix variable {R : Type u} [CommSemiring R] variable {A : Type v} [Semiring A] [Algebra R A] variable {n : Type w} variable (R A n) namespace MatrixEquivTensor def toFunBilinear : A →ₗ[R] Matrix n n R →ₗ[R] Matrix n n A := (Algebra.lsmul R R (Matrix n n A)).toLinearMap.compl₂ (Algebra.linearMap R A).mapMatrix #align matrix_equiv_tensor.to_fun_bilinear MatrixEquivTensor.toFunBilinear @[simp] theorem toFunBilinear_apply (a : A) (m : Matrix n n R) : toFunBilinear R A n a m = a • m.map (algebraMap R A) := rfl #align matrix_equiv_tensor.to_fun_bilinear_apply MatrixEquivTensor.toFunBilinear_apply def toFunLinear : A ⊗[R] Matrix n n R →ₗ[R] Matrix n n A := TensorProduct.lift (toFunBilinear R A n) #align matrix_equiv_tensor.to_fun_linear MatrixEquivTensor.toFunLinear variable [DecidableEq n] [Fintype n] def toFunAlgHom : A ⊗[R] Matrix n n R →ₐ[R] Matrix n n A := algHomOfLinearMapTensorProduct (toFunLinear R A n) (by intros simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_mul] ext dsimp simp_rw [Matrix.mul_apply, Matrix.smul_apply, Matrix.map_apply, smul_eq_mul, Finset.mul_sum, _root_.mul_assoc, Algebra.left_comm]) (by simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_one (algebraMap R A) (map_zero _) (map_one _), one_smul]) #align matrix_equiv_tensor.to_fun_alg_hom MatrixEquivTensor.toFunAlgHom @[simp] theorem toFunAlgHom_apply (a : A) (m : Matrix n n R) : toFunAlgHom R A n (a ⊗ₜ m) = a • m.map (algebraMap R A) := rfl #align matrix_equiv_tensor.to_fun_alg_hom_apply MatrixEquivTensor.toFunAlgHom_apply def invFun (M : Matrix n n A) : A ⊗[R] Matrix n n R := ∑ p : n × n, M p.1 p.2 ⊗ₜ stdBasisMatrix p.1 p.2 1 #align matrix_equiv_tensor.inv_fun MatrixEquivTensor.invFun @[simp] theorem invFun_zero : invFun R A n 0 = 0 := by simp [invFun] #align matrix_equiv_tensor.inv_fun_zero MatrixEquivTensor.invFun_zero @[simp] theorem invFun_add (M N : Matrix n n A) : invFun R A n (M + N) = invFun R A n M + invFun R A n N := by simp [invFun, add_tmul, Finset.sum_add_distrib] #align matrix_equiv_tensor.inv_fun_add MatrixEquivTensor.invFun_add @[simp] theorem invFun_smul (a : A) (M : Matrix n n A) : invFun R A n (a • M) = a ⊗ₜ 1 * invFun R A n M := by simp [invFun, Finset.mul_sum] #align matrix_equiv_tensor.inv_fun_smul MatrixEquivTensor.invFun_smul @[simp] theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by dsimp [invFun] simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole] congr conv_rhs => rw [matrix_eq_sum_std_basis M] convert Finset.sum_product (β := Matrix n n R); simp #align matrix_equiv_tensor.inv_fun_algebra_map MatrixEquivTensor.invFun_algebraMap theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul, mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply, Pi.smul_def] convert Finset.sum_product (β := Matrix n n A) conv_lhs => rw [matrix_eq_sum_std_basis M] refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_ simp only [stdBasisMatrix, smul_apply, Matrix.map_apply] split_ifs <;> aesop #align matrix_equiv_tensor.right_inv MatrixEquivTensor.right_inv
Mathlib/RingTheory/MatrixAlgebra.lean
124
130
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
induction M using TensorProduct.induction_on with | zero => simp | tmul a m => simp | add x y hx hy => rw [map_add] conv_rhs => rw [← hx, ← hy, ← invFun_add]
[ " ∀ (a₁ a₂ : A) (b₁ b₂ : Matrix n n R),\n (toFunLinear R A n) ((a₁ * a₂) ⊗ₜ[R] (b₁ * b₂)) =\n (toFunLinear R A n) (a₁ ⊗ₜ[R] b₁) * (toFunLinear R A n) (a₂ ⊗ₜ[R] b₂)", " (toFunLinear R A n) ((a₁✝ * a₂✝) ⊗ₜ[R] (b₁✝ * b₂✝)) =\n (toFunLinear R A n) (a₁✝ ⊗ₜ[R] b₁✝) * (toFunLinear R A n) (a₂✝ ⊗ₜ[R] b₂✝)", "...
[ " ∀ (a₁ a₂ : A) (b₁ b₂ : Matrix n n R),\n (toFunLinear R A n) ((a₁ * a₂) ⊗ₜ[R] (b₁ * b₂)) =\n (toFunLinear R A n) (a₁ ⊗ₜ[R] b₁) * (toFunLinear R A n) (a₂ ⊗ₜ[R] b₂)", " (toFunLinear R A n) ((a₁✝ * a₂✝) ⊗ₜ[R] (b₁✝ * b₂✝)) =\n (toFunLinear R A n) (a₁✝ ⊗ₜ[R] b₁✝) * (toFunLinear R A n) (a₂✝ ⊗ₜ[R] b₂✝)", "...
import Mathlib.RingTheory.DedekindDomain.Dvr import Mathlib.RingTheory.DedekindDomain.Ideal #align_import ring_theory.dedekind_domain.pid from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940" variable {R : Type*} [CommRing R] open Ideal open UniqueFactorizationMonoid open scoped nonZeroDivisors open UniqueFactorizationMonoid theorem Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne {P : Ideal R} (hP : P.IsPrime) [IsDedekindDomain R] {x : R} (x_mem : x ∈ P) (hxP2 : x ∉ P ^ 2) (hxQ : ∀ Q : Ideal R, IsPrime Q → Q ≠ P → x ∉ Q) : P = Ideal.span {x} := by letI := Classical.decEq (Ideal R) have hx0 : x ≠ 0 := by rintro rfl exact hxP2 (zero_mem _) by_cases hP0 : P = ⊥ · subst hP0 -- Porting note: was `simpa using hxP2` but that hypothesis didn't even seem relevant in Lean 3 rwa [eq_comm, span_singleton_eq_bot, ← mem_bot] have hspan0 : span ({x} : Set R) ≠ ⊥ := mt Ideal.span_singleton_eq_bot.mp hx0 have span_le := (Ideal.span_singleton_le_iff_mem _).mpr x_mem refine associated_iff_eq.mp ((associated_iff_normalizedFactors_eq_normalizedFactors hP0 hspan0).mpr (le_antisymm ((dvd_iff_normalizedFactors_le_normalizedFactors hP0 hspan0).mp ?_) ?_)) · rwa [Ideal.dvd_iff_le, Ideal.span_singleton_le_iff_mem] simp only [normalizedFactors_irreducible (Ideal.prime_of_isPrime hP0 hP).irreducible, normalize_eq, Multiset.le_iff_count, Multiset.count_singleton] intro Q split_ifs with hQ · subst hQ refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;> simp only [Ideal.span_singleton_le_iff_mem, pow_one] <;> assumption by_cases hQp : IsPrime Q · refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;> -- Porting note: included `zero_add` in the simp arguments simp only [Ideal.span_singleton_le_iff_mem, zero_add, pow_one, pow_zero, one_eq_top, Submodule.mem_top] exact hxQ _ hQp hQ · exact (Multiset.count_eq_zero.mpr fun hQi => hQp (isPrime_of_prime (irreducible_iff_prime.mp (irreducible_of_normalized_factor _ hQi)))).le #align ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne -- Porting note: replaced three implicit coercions of `I` with explicit `(I : Submodule R A)` theorem FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] {S : Submonoid R} [IsLocalization S A] (I : (FractionalIdeal S A)ˣ) {v : A} (hv : v ∈ (↑I⁻¹ : FractionalIdeal S A)) (h : Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v}) = ⊤) : Submodule.IsPrincipal (I : Submodule R A) := by have hinv := I.mul_inv set J := Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v}) have hJ : IsLocalization.coeSubmodule A J = ↑I * Submodule.span R {v} := by -- Porting note: had to insert `val_eq_coe` into this rewrite. -- Arguably this is because `Subtype.ext_iff` is breaking the `FractionalIdeal` API. rw [Subtype.ext_iff, val_eq_coe, coe_mul, val_eq_coe, coe_one] at hinv apply Submodule.map_comap_eq_self rw [← Submodule.one_eq_range, ← hinv] exact Submodule.mul_le_mul_right ((Submodule.span_singleton_le_iff_mem _ _).2 hv) have : (1 : A) ∈ ↑I * Submodule.span R {v} := by rw [← hJ, h, IsLocalization.coeSubmodule_top, Submodule.mem_one] exact ⟨1, (algebraMap R _).map_one⟩ obtain ⟨w, hw, hvw⟩ := Submodule.mem_mul_span_singleton.1 this refine ⟨⟨w, ?_⟩⟩ rw [← FractionalIdeal.coe_spanSingleton S, ← inv_inv I, eq_comm] refine congr_arg coeToSubmodule (Units.eq_inv_of_mul_eq_one_left (le_antisymm ?_ ?_)) · conv_rhs => rw [← hinv, mul_comm] apply FractionalIdeal.mul_le_mul_left (FractionalIdeal.spanSingleton_le_iff_mem.mpr hw) · rw [FractionalIdeal.one_le, ← hvw, mul_comm] exact FractionalIdeal.mul_mem_mul hv (FractionalIdeal.mem_spanSingleton_self _ _) #align fractional_ideal.is_principal_of_unit_of_comap_mul_span_singleton_eq_top FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top
Mathlib/RingTheory/DedekindDomain/PID.lean
109
168
theorem FractionalIdeal.isPrincipal.of_finite_maximals_of_inv {A : Type*} [CommRing A] [Algebra R A] {S : Submonoid R} [IsLocalization S A] (hS : S ≤ R⁰) (hf : {I : Ideal R | I.IsMaximal}.Finite) (I I' : FractionalIdeal S A) (hinv : I * I' = 1) : Submodule.IsPrincipal (I : Submodule R A) := by
have hinv' := hinv rw [Subtype.ext_iff, val_eq_coe, coe_mul] at hinv let s := hf.toFinset haveI := Classical.decEq (Ideal R) have coprime : ∀ M ∈ s, ∀ M' ∈ s.erase M, M ⊔ M' = ⊤ := by simp_rw [Finset.mem_erase, hf.mem_toFinset] rintro M hM M' ⟨hne, hM'⟩ exact Ideal.IsMaximal.coprime_of_ne hM hM' hne.symm have nle : ∀ M ∈ s, ¬⨅ M' ∈ s.erase M, M' ≤ M := fun M hM => left_lt_sup.1 ((hf.mem_toFinset.1 hM).ne_top.lt_top.trans_eq (Ideal.sup_iInf_eq_top <| coprime M hM).symm) have : ∀ M ∈ s, ∃ a ∈ I, ∃ b ∈ I', a * b ∉ IsLocalization.coeSubmodule A M := by intro M hM; by_contra! h obtain ⟨x, hx, hxM⟩ := SetLike.exists_of_lt ((IsLocalization.coeSubmodule_strictMono hS (hf.mem_toFinset.1 hM).ne_top.lt_top).trans_eq hinv.symm) exact hxM (Submodule.map₂_le.2 h hx) choose! a ha b hb hm using this choose! u hu hum using fun M hM => SetLike.not_le_iff_exists.1 (nle M hM) let v := ∑ M ∈ s, u M • b M have hv : v ∈ I' := Submodule.sum_mem _ fun M hM => Submodule.smul_mem _ _ <| hb M hM refine FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top (Units.mkOfMulEqOne I I' hinv') hv (of_not_not fun h => ?_) obtain ⟨M, hM, hJM⟩ := Ideal.exists_le_maximal _ h replace hM := hf.mem_toFinset.2 hM have : ∀ a ∈ I, ∀ b ∈ I', ∃ c, algebraMap R _ c = a * b := by intro a ha b hb; have hi := hinv.le obtain ⟨c, -, hc⟩ := hi (Submodule.mul_mem_mul ha hb) exact ⟨c, hc⟩ have hmem : a M * v ∈ IsLocalization.coeSubmodule A M := by obtain ⟨c, hc⟩ := this _ (ha M hM) v hv refine IsLocalization.coeSubmodule_mono _ hJM ⟨c, ?_, hc⟩ have := Submodule.mul_mem_mul (ha M hM) (Submodule.mem_span_singleton_self v) rwa [← hc] at this simp_rw [v, Finset.mul_sum, mul_smul_comm] at hmem rw [← s.add_sum_erase _ hM, Submodule.add_mem_iff_left] at hmem · refine hm M hM ?_ obtain ⟨c, hc : algebraMap R A c = a M * b M⟩ := this _ (ha M hM) _ (hb M hM) rw [← hc] at hmem ⊢ rw [Algebra.smul_def, ← _root_.map_mul] at hmem obtain ⟨d, hdM, he⟩ := hmem rw [IsLocalization.injective _ hS he] at hdM -- Note: #8386 had to specify the value of `f` exact Submodule.mem_map_of_mem (f := Algebra.linearMap _ _) (((hf.mem_toFinset.1 hM).isPrime.mem_or_mem hdM).resolve_left <| hum M hM) · refine Submodule.sum_mem _ fun M' hM' => ?_ rw [Finset.mem_erase] at hM' obtain ⟨c, hc⟩ := this _ (ha M hM) _ (hb M' hM'.2) rw [← hc, Algebra.smul_def, ← _root_.map_mul] specialize hu M' hM'.2 simp_rw [Ideal.mem_iInf, Finset.mem_erase] at hu -- Note: #8386 had to specify the value of `f` exact Submodule.mem_map_of_mem (f := Algebra.linearMap _ _) (M.mul_mem_right _ <| hu M ⟨hM'.1.symm, hM⟩)
[ " P = span {x}", " x ≠ 0", " False", " ⊥ = span {x}", " P ∣ span {x}", " normalizedFactors (span {x}) ≤ normalizedFactors P", " ∀ (a : Ideal R), Multiset.count a (normalizedFactors (span {x})) ≤ if a = P then 1 else 0", " Multiset.count Q (normalizedFactors (span {x})) ≤ if Q = P then 1 else 0", " M...
[ " P = span {x}", " x ≠ 0", " False", " ⊥ = span {x}", " P ∣ span {x}", " normalizedFactors (span {x}) ≤ normalizedFactors P", " ∀ (a : Ideal R), Multiset.count a (normalizedFactors (span {x})) ≤ if a = P then 1 else 0", " Multiset.count Q (normalizedFactors (span {x})) ≤ if Q = P then 1 else 0", " M...
import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Functor.EpiMono #align_import category_theory.adjunction.evaluation from "leanprover-community/mathlib"@"937c692d73f5130c7fecd3fd32e81419f4e04eb7" namespace CategoryTheory open CategoryTheory.Limits universe v₁ v₂ u₁ u₂ variable {C : Type u₁} [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D] noncomputable section section variable [∀ a b : C, HasCoproductsOfShape (a ⟶ b) D] @[simps] def evaluationLeftAdjoint (c : C) : D ⥤ C ⥤ D where obj d := { obj := fun t => ∐ fun _ : c ⟶ t => d map := fun f => Sigma.desc fun g => (Sigma.ι fun _ => d) <| g ≫ f} map {_ d₂} f := { app := fun e => Sigma.desc fun h => f ≫ Sigma.ι (fun _ => d₂) h naturality := by intros dsimp ext simp } #align category_theory.evaluation_left_adjoint CategoryTheory.evaluationLeftAdjoint @[simps! unit_app counit_app_app] def evaluationAdjunctionRight (c : C) : evaluationLeftAdjoint D c ⊣ (evaluation _ _).obj c := Adjunction.mkOfHomEquiv { homEquiv := fun d F => { toFun := fun f => Sigma.ι (fun _ => d) (𝟙 _) ≫ f.app c invFun := fun f => { app := fun e => Sigma.desc fun h => f ≫ F.map h naturality := by intros dsimp ext simp } left_inv := by intro f ext x dsimp ext g simp only [colimit.ι_desc, Cofan.mk_ι_app, Category.assoc, ← f.naturality, evaluationLeftAdjoint_obj_map, colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Discrete.natTrans_app, Category.id_comp] right_inv := fun f => by dsimp simp } -- This used to be automatic before leanprover/lean4#2644 homEquiv_naturality_right := by intros; dsimp; simp } #align category_theory.evaluation_adjunction_right CategoryTheory.evaluationAdjunctionRight instance evaluationIsRightAdjoint (c : C) : ((evaluation _ D).obj c).IsRightAdjoint := ⟨_, ⟨evaluationAdjunctionRight _ _⟩⟩ #align category_theory.evaluation_is_right_adjoint CategoryTheory.evaluationIsRightAdjoint
Mathlib/CategoryTheory/Adjunction/Evaluation.lean
81
86
theorem NatTrans.mono_iff_mono_app {F G : C ⥤ D} (η : F ⟶ G) : Mono η ↔ ∀ c, Mono (η.app c) := by
constructor · intro h c exact (inferInstance : Mono (((evaluation _ _).obj c).map η)) · intro _ apply NatTrans.mono_of_mono_app
[ " ∀ ⦃X Y : C⦄ (f_1 : X ⟶ Y),\n ((fun d =>\n { obj := fun t => ∐ fun x => d, map := fun {X Y} f => Sigma.desc fun g => Sigma.ι (fun x => d) (g ≫ f),\n map_id := ⋯, map_comp := ⋯ })\n x✝).map\n f_1 ≫\n (fun e => Sigma.desc fun h => f ≫ Sigma.ι (fun x => ...
[ " ∀ ⦃X Y : C⦄ (f_1 : X ⟶ Y),\n ((fun d =>\n { obj := fun t => ∐ fun x => d, map := fun {X Y} f => Sigma.desc fun g => Sigma.ι (fun x => d) (g ≫ f),\n map_id := ⋯, map_comp := ⋯ })\n x✝).map\n f_1 ≫\n (fun e => Sigma.desc fun h => f ≫ Sigma.ι (fun x => ...
import Mathlib.Algebra.Algebra.RestrictScalars import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.RCLike.Basic #align_import analysis.normed_space.extend from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open RCLike open ComplexConjugate variable {𝕜 : Type*} [RCLike 𝕜] {F : Type*} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F] namespace LinearMap variable [Module ℝ F] [IsScalarTower ℝ 𝕜 F] noncomputable def extendTo𝕜' (fr : F →ₗ[ℝ] ℝ) : F →ₗ[𝕜] 𝕜 := by let fc : F → 𝕜 := fun x => (fr x : 𝕜) - (I : 𝕜) * fr ((I : 𝕜) • x) have add : ∀ x y : F, fc (x + y) = fc x + fc y := by intro x y simp only [fc, smul_add, LinearMap.map_add, ofReal_add] rw [mul_add] abel have A : ∀ (c : ℝ) (x : F), (fr ((c : 𝕜) • x) : 𝕜) = (c : 𝕜) * (fr x : 𝕜) := by intro c x rw [← ofReal_mul] congr 1 rw [RCLike.ofReal_alg, smul_assoc, fr.map_smul, Algebra.id.smul_eq_mul, one_smul] have smul_ℝ : ∀ (c : ℝ) (x : F), fc ((c : 𝕜) • x) = (c : 𝕜) * fc x := by intro c x dsimp only [fc] rw [A c x, smul_smul, mul_comm I (c : 𝕜), ← smul_smul, A, mul_sub] ring have smul_I : ∀ x : F, fc ((I : 𝕜) • x) = (I : 𝕜) * fc x := by intro x dsimp only [fc] cases' @I_mul_I_ax 𝕜 _ with h h · simp [h] rw [mul_sub, ← mul_assoc, smul_smul, h] simp only [neg_mul, LinearMap.map_neg, one_mul, one_smul, mul_neg, ofReal_neg, neg_smul, sub_neg_eq_add, add_comm] have smul_𝕜 : ∀ (c : 𝕜) (x : F), fc (c • x) = c • fc x := by intro c x rw [← re_add_im c, add_smul, add_smul, add, smul_ℝ, ← smul_smul, smul_ℝ, smul_I, ← mul_assoc] rfl exact { toFun := fc map_add' := add map_smul' := smul_𝕜 } #align linear_map.extend_to_𝕜' LinearMap.extendTo𝕜' theorem extendTo𝕜'_apply (fr : F →ₗ[ℝ] ℝ) (x : F) : fr.extendTo𝕜' x = (fr x : 𝕜) - (I : 𝕜) * (fr ((I : 𝕜) • x) : 𝕜) := rfl #align linear_map.extend_to_𝕜'_apply LinearMap.extendTo𝕜'_apply @[simp] theorem extendTo𝕜'_apply_re (fr : F →ₗ[ℝ] ℝ) (x : F) : re (fr.extendTo𝕜' x : 𝕜) = fr x := by simp only [extendTo𝕜'_apply, map_sub, zero_mul, mul_zero, sub_zero, rclike_simps] #align linear_map.extend_to_𝕜'_apply_re LinearMap.extendTo𝕜'_apply_re
Mathlib/Analysis/NormedSpace/Extend.lean
93
99
theorem norm_extendTo𝕜'_apply_sq (fr : F →ₗ[ℝ] ℝ) (x : F) : ‖(fr.extendTo𝕜' x : 𝕜)‖ ^ 2 = fr (conj (fr.extendTo𝕜' x : 𝕜) • x) := calc ‖(fr.extendTo𝕜' x : 𝕜)‖ ^ 2 = re (conj (fr.extendTo𝕜' x) * fr.extendTo𝕜' x : 𝕜) := by
rw [RCLike.conj_mul, ← ofReal_pow, ofReal_re] _ = fr (conj (fr.extendTo𝕜' x : 𝕜) • x) := by rw [← smul_eq_mul, ← map_smul, extendTo𝕜'_apply_re]
[ " F →ₗ[𝕜] 𝕜", " ∀ (x y : F), fc (x + y) = fc x + fc y", " fc (x + y) = fc x + fc y", " ↑(fr x) + ↑(fr y) - I * (↑(fr (I • x)) + ↑(fr (I • y))) = ↑(fr x) - I * ↑(fr (I • x)) + (↑(fr y) - I * ↑(fr (I • y)))", " ↑(fr x) + ↑(fr y) - (I * ↑(fr (I • x)) + I * ↑(fr (I • y))) =\n ↑(fr x) - I * ↑(fr (I • x)) + ...
[ " F →ₗ[𝕜] 𝕜", " ∀ (x y : F), fc (x + y) = fc x + fc y", " fc (x + y) = fc x + fc y", " ↑(fr x) + ↑(fr y) - I * (↑(fr (I • x)) + ↑(fr (I • y))) = ↑(fr x) - I * ↑(fr (I • x)) + (↑(fr y) - I * ↑(fr (I • y)))", " ↑(fr x) + ↑(fr y) - (I * ↑(fr (I • x)) + I * ↑(fr (I • y))) =\n ↑(fr x) - I * ↑(fr (I • x)) + ...
import Batteries.Data.Array.Lemmas import Batteries.Tactic.Lint.Misc namespace Batteries structure UFNode where parent : Nat rank : Nat namespace UnionFind def panicWith (v : α) (msg : String) : α := @panic α ⟨v⟩ msg @[simp] theorem panicWith_eq (v : α) (msg) : panicWith v msg = v := rfl def parentD (arr : Array UFNode) (i : Nat) : Nat := if h : i < arr.size then (arr.get ⟨i, h⟩).parent else i def rankD (arr : Array UFNode) (i : Nat) : Nat := if h : i < arr.size then (arr.get ⟨i, h⟩).rank else 0 theorem parentD_eq {arr : Array UFNode} {i} : parentD arr i.1 = (arr.get i).parent := dif_pos _ theorem parentD_eq' {arr : Array UFNode} {i} (h) : parentD arr i = (arr.get ⟨i, h⟩).parent := dif_pos _ theorem rankD_eq {arr : Array UFNode} {i} : rankD arr i.1 = (arr.get i).rank := dif_pos _ theorem rankD_eq' {arr : Array UFNode} {i} (h) : rankD arr i = (arr.get ⟨i, h⟩).rank := dif_pos _ theorem parentD_of_not_lt : ¬i < arr.size → parentD arr i = i := (dif_neg ·) theorem lt_of_parentD : parentD arr i ≠ i → i < arr.size := Decidable.not_imp_comm.1 parentD_of_not_lt theorem parentD_set {arr : Array UFNode} {x v i} : parentD (arr.set x v) i = if x.1 = i then v.parent else parentD arr i := by rw [parentD]; simp [Array.get_eq_getElem, parentD] split <;> [split <;> simp [Array.get_set, *]; split <;> [(subst i; cases ‹¬_› x.2); rfl]]
.lake/packages/batteries/Batteries/Data/UnionFind/Basic.lean
52
55
theorem rankD_set {arr : Array UFNode} {x v i} : rankD (arr.set x v) i = if x.1 = i then v.rank else rankD arr i := by
rw [rankD]; simp [Array.get_eq_getElem, rankD] split <;> [split <;> simp [Array.get_set, *]; split <;> [(subst i; cases ‹¬_› x.2); rfl]]
[ " parentD (arr.set x v) i = if ↑x = i then v.parent else parentD arr i", " (if h : i < (arr.set x v).size then ((arr.set x v).get ⟨i, h⟩).parent else i) =\n if ↑x = i then v.parent else parentD arr i", " (if h : i < arr.size then (arr.set x v)[i].parent else i) =\n if ↑x = i then v.parent else if h : i < ...
[ " parentD (arr.set x v) i = if ↑x = i then v.parent else parentD arr i", " (if h : i < (arr.set x v).size then ((arr.set x v).get ⟨i, h⟩).parent else i) =\n if ↑x = i then v.parent else parentD arr i", " (if h : i < arr.size then (arr.set x v)[i].parent else i) =\n if ↑x = i then v.parent else if h : i < ...
import Mathlib.Combinatorics.SetFamily.Shadow #align_import combinatorics.set_family.compression.uv from "leanprover-community/mathlib"@"6f8ab7de1c4b78a68ab8cf7dd83d549eb78a68a1" open Finset variable {α : Type*} theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) : { x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by rintro a ha b hb hab have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by dsimp at hab rw [hab] rwa [sdiff_sdiff_comm, ha.1.symm.sup_sdiff_cancel_right, sdiff_sdiff_comm, hb.1.symm.sup_sdiff_cancel_right, sdiff_sup_cancel ha.2, sdiff_sup_cancel hb.2] at h #align sup_sdiff_inj_on sup_sdiff_injOn -- The namespace is here to distinguish from other compressions. namespace UV section GeneralizedBooleanAlgebra variable [GeneralizedBooleanAlgebra α] [DecidableRel (@Disjoint α _ _)] [DecidableRel ((· ≤ ·) : α → α → Prop)] {s : Finset α} {u v a b : α} def compress (u v a : α) : α := if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a #align uv.compress UV.compress theorem compress_of_disjoint_of_le (hua : Disjoint u a) (hva : v ≤ a) : compress u v a = (a ⊔ u) \ v := if_pos ⟨hua, hva⟩ #align uv.compress_of_disjoint_of_le UV.compress_of_disjoint_of_le
Mathlib/Combinatorics/SetFamily/Compression/UV.lean
90
94
theorem compress_of_disjoint_of_le' (hva : Disjoint v a) (hua : u ≤ a) : compress u v ((a ⊔ v) \ u) = a := by
rw [compress_of_disjoint_of_le disjoint_sdiff_self_right (le_sdiff.2 ⟨(le_sup_right : v ≤ a ⊔ v), hva.mono_right hua⟩), sdiff_sup_cancel (le_sup_of_le_left hua), hva.symm.sup_sdiff_cancel_right]
[ " Set.InjOn (fun x => (x ⊔ u) \\ v) {x | Disjoint u x ∧ v ≤ x}", " a = b", " ((a ⊔ u) \\ v) \\ u ⊔ v = ((b ⊔ u) \\ v) \\ u ⊔ v", " compress u v ((a ⊔ v) \\ u) = a" ]
[ " Set.InjOn (fun x => (x ⊔ u) \\ v) {x | Disjoint u x ∧ v ≤ x}", " a = b", " ((a ⊔ u) \\ v) \\ u ⊔ v = ((b ⊔ u) \\ v) \\ u ⊔ v", " compress u v ((a ⊔ v) \\ u) = a" ]
import Mathlib.LinearAlgebra.Isomorphisms import Mathlib.LinearAlgebra.Projection import Mathlib.Order.JordanHolder import Mathlib.Order.CompactlyGenerated.Intervals import Mathlib.LinearAlgebra.FiniteDimensional #align_import ring_theory.simple_module from "leanprover-community/mathlib"@"cce7f68a7eaadadf74c82bbac20721cdc03a1cc1" variable {ι : Type*} (R S : Type*) [Ring R] [Ring S] (M : Type*) [AddCommGroup M] [Module R M] abbrev IsSimpleModule := IsSimpleOrder (Submodule R M) #align is_simple_module IsSimpleModule abbrev IsSemisimpleModule := ComplementedLattice (Submodule R M) #align is_semisimple_module IsSemisimpleModule abbrev IsSemisimpleRing := IsSemisimpleModule R R theorem RingEquiv.isSemisimpleRing (e : R ≃+* S) [IsSemisimpleRing R] : IsSemisimpleRing S := (Submodule.orderIsoMapComap e.toSemilinearEquiv).complementedLattice -- Making this an instance causes the linter to complain of "dangerous instances" theorem IsSimpleModule.nontrivial [IsSimpleModule R M] : Nontrivial M := ⟨⟨0, by have h : (⊥ : Submodule R M) ≠ ⊤ := bot_ne_top contrapose! h ext x simp [Submodule.mem_bot, Submodule.mem_top, h x]⟩⟩ #align is_simple_module.nontrivial IsSimpleModule.nontrivial variable {m : Submodule R M} {N : Type*} [AddCommGroup N] [Module R N] {R S M} theorem LinearMap.isSimpleModule_iff_of_bijective [Module S N] {σ : R →+* S} [RingHomSurjective σ] (l : M →ₛₗ[σ] N) (hl : Function.Bijective l) : IsSimpleModule R M ↔ IsSimpleModule S N := (Submodule.orderIsoMapComapOfBijective l hl).isSimpleOrder_iff theorem IsSimpleModule.congr (l : M ≃ₗ[R] N) [IsSimpleModule R N] : IsSimpleModule R M := (Submodule.orderIsoMapComap l).isSimpleOrder #align is_simple_module.congr IsSimpleModule.congr theorem isSimpleModule_iff_isAtom : IsSimpleModule R m ↔ IsAtom m := by rw [← Set.isSimpleOrder_Iic_iff_isAtom] exact m.mapIic.isSimpleOrder_iff #align is_simple_module_iff_is_atom isSimpleModule_iff_isAtom theorem isSimpleModule_iff_isCoatom : IsSimpleModule R (M ⧸ m) ↔ IsCoatom m := by rw [← Set.isSimpleOrder_Ici_iff_isCoatom] apply OrderIso.isSimpleOrder_iff exact Submodule.comapMkQRelIso m #align is_simple_module_iff_is_coatom isSimpleModule_iff_isCoatom theorem covBy_iff_quot_is_simple {A B : Submodule R M} (hAB : A ≤ B) : A ⋖ B ↔ IsSimpleModule R (B ⧸ Submodule.comap B.subtype A) := by set f : Submodule R B ≃o Set.Iic B := B.mapIic with hf rw [covBy_iff_coatom_Iic hAB, isSimpleModule_iff_isCoatom, ← OrderIso.isCoatom_iff f, hf] simp [-OrderIso.isCoatom_iff, Submodule.map_comap_subtype, inf_eq_right.2 hAB] #align covby_iff_quot_is_simple covBy_iff_quot_is_simple namespace IsSimpleModule @[simp] theorem isAtom [IsSimpleModule R m] : IsAtom m := isSimpleModule_iff_isAtom.1 ‹_› #align is_simple_module.is_atom IsSimpleModule.isAtom variable [IsSimpleModule R M] (R) open LinearMap theorem span_singleton_eq_top {m : M} (hm : m ≠ 0) : Submodule.span R {m} = ⊤ := (eq_bot_or_eq_top _).resolve_left fun h ↦ hm (h.le <| Submodule.mem_span_singleton_self m) instance (S : Submodule R M) : S.IsPrincipal where principal' := by obtain rfl | rfl := eq_bot_or_eq_top S · exact ⟨0, Submodule.span_zero.symm⟩ have := IsSimpleModule.nontrivial R M have ⟨m, hm⟩ := exists_ne (0 : M) exact ⟨m, (span_singleton_eq_top R hm).symm⟩
Mathlib/RingTheory/SimpleModule.lean
125
127
theorem toSpanSingleton_surjective {m : M} (hm : m ≠ 0) : Function.Surjective (toSpanSingleton R M m) := by
rw [← range_eq_top, ← span_singleton_eq_range, span_singleton_eq_top R hm]
[ " ∃ y, 0 ≠ y", " ⊥ = ⊤", " x ∈ ⊥ ↔ x ∈ ⊤", " IsSimpleModule R ↥m ↔ IsAtom m", " IsSimpleModule R ↥m ↔ IsSimpleOrder ↑(Set.Iic m)", " IsSimpleModule R (M ⧸ m) ↔ IsCoatom m", " IsSimpleModule R (M ⧸ m) ↔ IsSimpleOrder ↑(Set.Ici m)", " Submodule R (M ⧸ m) ≃o ↑(Set.Ici m)", " A ⋖ B ↔ IsSimpleModule R (↥...
[ " ∃ y, 0 ≠ y", " ⊥ = ⊤", " x ∈ ⊥ ↔ x ∈ ⊤", " IsSimpleModule R ↥m ↔ IsAtom m", " IsSimpleModule R ↥m ↔ IsSimpleOrder ↑(Set.Iic m)", " IsSimpleModule R (M ⧸ m) ↔ IsCoatom m", " IsSimpleModule R (M ⧸ m) ↔ IsSimpleOrder ↑(Set.Ici m)", " Submodule R (M ⧸ m) ≃o ↑(Set.Ici m)", " A ⋖ B ↔ IsSimpleModule R (↥...
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section NegOneSquare -- This could be formulated for a general integer `a` in place of `-1`, -- but it would not directly specialize to `-1`, -- because `((-1 : ℤ) : ZMod n)` is not the same as `(-1 : ZMod n)`. theorem ZMod.isSquare_neg_one_of_dvd {m n : ℕ} (hd : m ∣ n) (hs : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod m) := by let f : ZMod n →+* ZMod m := ZMod.castHom hd _ rw [← RingHom.map_one f, ← RingHom.map_neg] exact hs.map f #align zmod.is_square_neg_one_of_dvd ZMod.isSquare_neg_one_of_dvd
Mathlib/NumberTheory/SumTwoSquares.lean
86
94
theorem ZMod.isSquare_neg_one_mul {m n : ℕ} (hc : m.Coprime n) (hm : IsSquare (-1 : ZMod m)) (hn : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod (m * n)) := by
have : IsSquare (-1 : ZMod m × ZMod n) := by rw [show (-1 : ZMod m × ZMod n) = ((-1 : ZMod m), (-1 : ZMod n)) from rfl] obtain ⟨x, hx⟩ := hm obtain ⟨y, hy⟩ := hn rw [hx, hy] exact ⟨(x, y), rfl⟩ simpa only [RingEquiv.map_neg_one] using this.map (ZMod.chineseRemainder hc).symm
[ " IsSquare (-1)", " IsSquare (f (-1))", " IsSquare (-1, -1)", " IsSquare (x * x, y * y)" ]
[ " IsSquare (-1)", " IsSquare (f (-1))" ]
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -φ := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : φ * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * φ = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : φ + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - φ = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = φ := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : φ - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2) - φ ^ (n + 1) = φ ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : φ ^ 2 = φ + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < φ := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : φ ≠ 0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < φ := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : φ < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num theorem goldConj_neg : ψ < 0 := by linarith [one_sub_goldConj, one_lt_gold] #align gold_conj_neg goldConj_neg theorem goldConj_ne_zero : ψ ≠ 0 := ne_of_lt goldConj_neg #align gold_conj_ne_zero goldConj_ne_zero theorem neg_one_lt_goldConj : -1 < ψ := by rw [neg_lt, ← inv_gold] exact inv_lt_one one_lt_gold #align neg_one_lt_gold_conj neg_one_lt_goldConj theorem gold_irrational : Irrational φ := by have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_add 1 have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num) convert this norm_num field_simp #align gold_irrational gold_irrational theorem goldConj_irrational : Irrational ψ := by have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_sub 1 have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num) convert this norm_num field_simp #align gold_conj_irrational goldConj_irrational section Fibrec variable {α : Type*} [CommSemiring α] def fibRec : LinearRecurrence α where order := 2 coeffs := ![1, 1] #align fib_rec fibRec
Mathlib/Data/Real/GoldenRatio.lean
187
192
theorem fib_isSol_fibRec : fibRec.IsSolution (fun x => x.fib : ℕ → α) := by
rw [fibRec] intro n simp only rw [Nat.fib_add_two, add_comm] simp [Finset.sum_fin_eq_sum_range, Finset.sum_range_succ']
[ " φ⁻¹ = -ψ", " 0 < 1", " 0 < 5", " 2 * 2 = 5 - 1", " ψ⁻¹ = -φ", " -ψ = φ⁻¹", " φ * ψ = -1", " (1 + √5) * (1 - √5) = -(2 * 2)", " 1 ^ 2 - √5 ^ 2 = -(2 * 2)", " ψ * φ = -1", " φ + ψ = 1", " (1 + √5) / 2 + (1 - √5) / 2 = 1", " 1 - φ = ψ", " 1 - ψ = φ", " φ - ψ = √5", " φ ^ (n + 2) - φ ^ (...
[ " φ⁻¹ = -ψ", " 0 < 1", " 0 < 5", " 2 * 2 = 5 - 1", " ψ⁻¹ = -φ", " -ψ = φ⁻¹", " φ * ψ = -1", " (1 + √5) * (1 - √5) = -(2 * 2)", " 1 ^ 2 - √5 ^ 2 = -(2 * 2)", " ψ * φ = -1", " φ + ψ = 1", " (1 + √5) / 2 + (1 - √5) / 2 = 1", " 1 - φ = ψ", " 1 - ψ = φ", " φ - ψ = √5", " φ ^ (n + 2) - φ ^ (...
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Group.Int import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Ring.Rat import Mathlib.Data.PNat.Defs #align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11" namespace Rat open Rat theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by cases' e : a /. b with n d h c rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.dvd_of_dvd_mul_right ?_ have := congr_arg Int.natAbs e simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this] #align rat.num_dvd Rat.num_dvd theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b := by by_cases b0 : b = 0; · simp [b0] cases' e : a /. b with n d h c rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_ rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp #align rat.denom_dvd Rat.den_dvd theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) : ∃ c : ℤ, n = c * q.num ∧ d = c * q.den := by obtain rfl | hn := eq_or_ne n 0 · simp [qdf] have : q.num * d = n * ↑q.den := by refine (divInt_eq_iff ?_ hd).mp ?_ · exact Int.natCast_ne_zero.mpr (Rat.den_nz _) · rwa [num_divInt_den] have hqdn : q.num ∣ n := by rw [qdf] exact Rat.num_dvd _ hd refine ⟨n / q.num, ?_, ?_⟩ · rw [Int.ediv_mul_cancel hqdn] · refine Int.eq_mul_div_of_mul_eq_mul_of_dvd_left ?_ hqdn this rw [qdf] exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn) #align rat.num_denom_mk Rat.num_den_mk #noalign rat.mk_pnat_num #noalign rat.mk_pnat_denom theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d := by have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast] rcases d with ((_ | _) | _) <;> rw [← Int.div_eq_ediv_of_dvd] <;> simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd, Int.zero_ediv, Int.ofNat_dvd_left, Nat.gcd_dvd_left, this] #align rat.num_mk Rat.num_mk theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d := by have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast] rcases d with ((_ | _) | _) <;> simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd, if_neg (Nat.cast_add_one_ne_zero _), this] #align rat.denom_mk Rat.den_mk #noalign rat.mk_pnat_denom_dvd theorem add_den_dvd (q₁ q₂ : ℚ) : (q₁ + q₂).den ∣ q₁.den * q₂.den := by rw [add_def, normalize_eq] apply Nat.div_dvd_of_dvd apply Nat.gcd_dvd_right #align rat.add_denom_dvd Rat.add_den_dvd theorem mul_den_dvd (q₁ q₂ : ℚ) : (q₁ * q₂).den ∣ q₁.den * q₂.den := by rw [mul_def, normalize_eq] apply Nat.div_dvd_of_dvd apply Nat.gcd_dvd_right #align rat.mul_denom_dvd Rat.mul_den_dvd
Mathlib/Data/Rat/Lemmas.lean
93
95
theorem mul_num (q₁ q₂ : ℚ) : (q₁ * q₂).num = q₁.num * q₂.num / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) := by
rw [mul_def, normalize_eq]
[ " (a /. b).num ∣ a", " { num := n, den := d, den_nz := h, reduced := c }.num ∣ a", " n.natAbs ∣ a.natAbs * d", " ↑(a /. b).den ∣ b", " ↑{ num := n, den := d, den_nz := h, reduced := c }.den ∣ b", " d ∣ n.natAbs * b.natAbs", " ↑d ∣ a * ↑d", " ∃ c, n = c * q.num ∧ d = c * ↑q.den", " ∃ c, 0 = c * q.num...
[ " (a /. b).num ∣ a", " { num := n, den := d, den_nz := h, reduced := c }.num ∣ a", " n.natAbs ∣ a.natAbs * d", " ↑(a /. b).den ∣ b", " ↑{ num := n, den := d, den_nz := h, reduced := c }.den ∣ b", " d ∣ n.natAbs * b.natAbs", " ↑d ∣ a * ↑d", " ∃ c, n = c * q.num ∧ d = c * ↑q.den", " ∃ c, 0 = c * q.num...
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Group.Int import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Ring.Rat import Mathlib.Data.PNat.Defs #align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11" namespace Rat open Rat
Mathlib/Data/Rat/Lemmas.lean
24
30
theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by
cases' e : a /. b with n d h c rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.dvd_of_dvd_mul_right ?_ have := congr_arg Int.natAbs e simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
[ " (a /. b).num ∣ a", " { num := n, den := d, den_nz := h, reduced := c }.num ∣ a", " n.natAbs ∣ a.natAbs * d" ]
[ " (a /. b).num ∣ a" ]
import Mathlib.Data.ENat.Lattice import Mathlib.Order.OrderIsoNat import Mathlib.Tactic.TFAE #align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b" open List hiding le_antisymm open OrderDual universe u v variable {α β : Type*} namespace Set section LT variable [LT α] [LT β] (s t : Set α) def subchain : Set (List α) := { l | l.Chain' (· < ·) ∧ ∀ i ∈ l, i ∈ s } #align set.subchain Set.subchain @[simp] -- porting note: new `simp` theorem nil_mem_subchain : [] ∈ s.subchain := ⟨trivial, fun _ ↦ nofun⟩ #align set.nil_mem_subchain Set.nil_mem_subchain variable {s} {l : List α} {a : α} theorem cons_mem_subchain_iff : (a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm, and_assoc] #align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff @[simp] -- Porting note (#10756): new lemma + `simp`
Mathlib/Order/Height.lean
77
77
theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by
simp [cons_mem_subchain_iff]
[ " a :: l ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b", " [a] ∈ s.subchain ↔ a ∈ s" ]
[ " a :: l ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b", " [a] ∈ s.subchain ↔ a ∈ s" ]
import Mathlib.RingTheory.Polynomial.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import data.polynomial.expand from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821" universe u v w open Polynomial open Finset namespace Polynomial section CommSemiring variable (R : Type u) [CommSemiring R] {S : Type v} [CommSemiring S] (p q : ℕ) noncomputable def expand : R[X] →ₐ[R] R[X] := { (eval₂RingHom C (X ^ p) : R[X] →+* R[X]) with commutes' := fun _ => eval₂_C _ _ } #align polynomial.expand Polynomial.expand theorem coe_expand : (expand R p : R[X] → R[X]) = eval₂ C (X ^ p) := rfl #align polynomial.coe_expand Polynomial.coe_expand variable {R} theorem expand_eq_comp_X_pow {f : R[X]} : expand R p f = f.comp (X ^ p) := rfl theorem expand_eq_sum {f : R[X]} : expand R p f = f.sum fun e a => C a * (X ^ p) ^ e := by simp [expand, eval₂] #align polynomial.expand_eq_sum Polynomial.expand_eq_sum @[simp] theorem expand_C (r : R) : expand R p (C r) = C r := eval₂_C _ _ set_option linter.uppercaseLean3 false in #align polynomial.expand_C Polynomial.expand_C @[simp] theorem expand_X : expand R p X = X ^ p := eval₂_X _ _ set_option linter.uppercaseLean3 false in #align polynomial.expand_X Polynomial.expand_X @[simp] theorem expand_monomial (r : R) : expand R p (monomial q r) = monomial (q * p) r := by simp_rw [← smul_X_eq_monomial, AlgHom.map_smul, AlgHom.map_pow, expand_X, mul_comm, pow_mul] #align polynomial.expand_monomial Polynomial.expand_monomial theorem expand_expand (f : R[X]) : expand R p (expand R q f) = expand R (p * q) f := Polynomial.induction_on f (fun r => by simp_rw [expand_C]) (fun f g ihf ihg => by simp_rw [AlgHom.map_add, ihf, ihg]) fun n r _ => by simp_rw [AlgHom.map_mul, expand_C, AlgHom.map_pow, expand_X, AlgHom.map_pow, expand_X, pow_mul] #align polynomial.expand_expand Polynomial.expand_expand theorem expand_mul (f : R[X]) : expand R (p * q) f = expand R p (expand R q f) := (expand_expand p q f).symm #align polynomial.expand_mul Polynomial.expand_mul @[simp] theorem expand_zero (f : R[X]) : expand R 0 f = C (eval 1 f) := by simp [expand] #align polynomial.expand_zero Polynomial.expand_zero @[simp] theorem expand_one (f : R[X]) : expand R 1 f = f := Polynomial.induction_on f (fun r => by rw [expand_C]) (fun f g ihf ihg => by rw [AlgHom.map_add, ihf, ihg]) fun n r _ => by rw [AlgHom.map_mul, expand_C, AlgHom.map_pow, expand_X, pow_one] #align polynomial.expand_one Polynomial.expand_one theorem expand_pow (f : R[X]) : expand R (p ^ q) f = (expand R p)^[q] f := Nat.recOn q (by rw [pow_zero, expand_one, Function.iterate_zero, id]) fun n ih => by rw [Function.iterate_succ_apply', pow_succ', expand_mul, ih] #align polynomial.expand_pow Polynomial.expand_pow
Mathlib/Algebra/Polynomial/Expand.lean
95
97
theorem derivative_expand (f : R[X]) : Polynomial.derivative (expand R p f) = expand R p (Polynomial.derivative f) * (p * (X ^ (p - 1) : R[X])) := by
rw [coe_expand, derivative_eval₂_C, derivative_pow, C_eq_natCast, derivative_X, mul_one]
[ " (expand R p) f = f.sum fun e a => C a * (X ^ p) ^ e", " (expand R p) ((monomial q) r) = (monomial (q * p)) r", " (expand R p) ((expand R q) (C r)) = (expand R (p * q)) (C r)", " (expand R p) ((expand R q) (f + g)) = (expand R (p * q)) (f + g)", " (expand R p) ((expand R q) (C r * X ^ (n + 1))) = (expand R...
[ " (expand R p) f = f.sum fun e a => C a * (X ^ p) ^ e", " (expand R p) ((monomial q) r) = (monomial (q * p)) r", " (expand R p) ((expand R q) (C r)) = (expand R (p * q)) (C r)", " (expand R p) ((expand R q) (f + g)) = (expand R (p * q)) (f + g)", " (expand R p) ((expand R q) (C r * X ^ (n + 1))) = (expand R...
import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.Calculus.Deriv.Mul import Mathlib.Analysis.Calculus.LocalExtr.Basic #align_import analysis.calculus.darboux from "leanprover-community/mathlib"@"61b5e2755ccb464b68d05a9acf891ae04992d09d" open Filter Set open scoped Topology Classical variable {a b : ℝ} {f f' : ℝ → ℝ}
Mathlib/Analysis/Calculus/Darboux.lean
28
60
theorem exists_hasDerivWithinAt_eq_of_gt_of_lt (hab : a ≤ b) (hf : ∀ x ∈ Icc a b, HasDerivWithinAt f (f' x) (Icc a b) x) {m : ℝ} (hma : f' a < m) (hmb : m < f' b) : m ∈ f' '' Ioo a b := by
rcases hab.eq_or_lt with (rfl | hab') · exact (lt_asymm hma hmb).elim set g : ℝ → ℝ := fun x => f x - m * x have hg : ∀ x ∈ Icc a b, HasDerivWithinAt g (f' x - m) (Icc a b) x := by intro x hx simpa using (hf x hx).sub ((hasDerivWithinAt_id x _).const_mul m) obtain ⟨c, cmem, hc⟩ : ∃ c ∈ Icc a b, IsMinOn g (Icc a b) c := isCompact_Icc.exists_isMinOn (nonempty_Icc.2 <| hab) fun x hx => (hg x hx).continuousWithinAt have cmem' : c ∈ Ioo a b := by rcases cmem.1.eq_or_lt with (rfl | hac) -- Show that `c` can't be equal to `a` · refine absurd (sub_nonneg.1 <| nonneg_of_mul_nonneg_right ?_ (sub_pos.2 hab')) (not_le_of_lt hma) have : b - a ∈ posTangentConeAt (Icc a b) a := mem_posTangentConeAt_of_segment_subset (segment_eq_Icc hab ▸ Subset.refl _) simpa only [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply] using hc.localize.hasFDerivWithinAt_nonneg (hg a (left_mem_Icc.2 hab)) this rcases cmem.2.eq_or_gt with (rfl | hcb) -- Show that `c` can't be equal to `b` · refine absurd (sub_nonpos.1 <| nonpos_of_mul_nonneg_right ?_ (sub_lt_zero.2 hab')) (not_le_of_lt hmb) have : a - b ∈ posTangentConeAt (Icc a b) b := mem_posTangentConeAt_of_segment_subset (by rw [segment_symm, segment_eq_Icc hab]) simpa only [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply] using hc.localize.hasFDerivWithinAt_nonneg (hg b (right_mem_Icc.2 hab)) this exact ⟨hac, hcb⟩ use c, cmem' rw [← sub_eq_zero] have : Icc a b ∈ 𝓝 c := by rwa [← mem_interior_iff_mem_nhds, interior_Icc] exact (hc.isLocalMin this).hasDerivAt_eq_zero ((hg c cmem).hasDerivAt this)
[ " m ∈ f' '' Ioo a b", " m ∈ f' '' Ioo a a", " ∀ x ∈ Icc a b, HasDerivWithinAt g (f' x - m) (Icc a b) x", " HasDerivWithinAt g (f' x - m) (Icc a b) x", " c ∈ Ioo a b", " a ∈ Ioo a b", " 0 ≤ (b - a) * (f' a - m)", " b ∈ Ioo a b", " 0 ≤ (a - b) * (f' b - m)", " segment ℝ b a ⊆ Icc a b", " f' c = m"...
[ " m ∈ f' '' Ioo a b" ]
import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α} {s t : Set α} namespace MeasureTheory section NormedAddCommGroup variable (μ) variable {f g : α → E} noncomputable def average (f : α → E) := ∫ x, f x ∂(μ univ)⁻¹ • μ #align measure_theory.average MeasureTheory.average notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r @[simp] theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero] #align measure_theory.average_zero MeasureTheory.average_zero @[simp] theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by rw [average, smul_zero, integral_zero_measure] #align measure_theory.average_zero_measure MeasureTheory.average_zero_measure @[simp] theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ := integral_neg f #align measure_theory.average_neg MeasureTheory.average_neg theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ := rfl #align measure_theory.average_eq' MeasureTheory.average_eq' theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by rw [average_eq', integral_smul_measure, ENNReal.toReal_inv] #align measure_theory.average_eq MeasureTheory.average_eq theorem average_eq_integral [IsProbabilityMeasure μ] (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by rw [average, measure_univ, inv_one, one_smul] #align measure_theory.average_eq_integral MeasureTheory.average_eq_integral @[simp] theorem measure_smul_average [IsFiniteMeasure μ] (f : α → E) : (μ univ).toReal • ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by rcases eq_or_ne μ 0 with hμ | hμ · rw [hμ, integral_zero_measure, average_zero_measure, smul_zero] · rw [average_eq, smul_inv_smul₀] refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne' rwa [Ne, measure_univ_eq_zero] #align measure_theory.measure_smul_average MeasureTheory.measure_smul_average theorem setAverage_eq (f : α → E) (s : Set α) : ⨍ x in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ x in s, f x ∂μ := by rw [average_eq, restrict_apply_univ] #align measure_theory.set_average_eq MeasureTheory.setAverage_eq theorem setAverage_eq' (f : α → E) (s : Set α) : ⨍ x in s, f x ∂μ = ∫ x, f x ∂(μ s)⁻¹ • μ.restrict s := by simp only [average_eq', restrict_apply_univ] #align measure_theory.set_average_eq' MeasureTheory.setAverage_eq' variable {μ} theorem average_congr {f g : α → E} (h : f =ᵐ[μ] g) : ⨍ x, f x ∂μ = ⨍ x, g x ∂μ := by simp only [average_eq, integral_congr_ae h] #align measure_theory.average_congr MeasureTheory.average_congr theorem setAverage_congr (h : s =ᵐ[μ] t) : ⨍ x in s, f x ∂μ = ⨍ x in t, f x ∂μ := by simp only [setAverage_eq, setIntegral_congr_set_ae h, measure_congr h] #align measure_theory.set_average_congr MeasureTheory.setAverage_congr
Mathlib/MeasureTheory/Integral/Average.lean
369
370
theorem setAverage_congr_fun (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : ⨍ x in s, f x ∂μ = ⨍ x in s, g x ∂μ := by
simp only [average_eq, setIntegral_congr_ae hs h]
[ " ⨍ (x : α), 0 ∂μ = 0", " ⨍ (x : α), f x ∂0 = 0", " ⨍ (x : α), f x ∂μ = (μ univ).toReal⁻¹ • ∫ (x : α), f x ∂μ", " ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ", " (μ univ).toReal • ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ", " (μ univ).toReal ≠ 0", " μ univ ≠ 0", " ⨍ (x : α) in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ (x ...
[ " ⨍ (x : α), 0 ∂μ = 0", " ⨍ (x : α), f x ∂0 = 0", " ⨍ (x : α), f x ∂μ = (μ univ).toReal⁻¹ • ∫ (x : α), f x ∂μ", " ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ", " (μ univ).toReal • ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ", " (μ univ).toReal ≠ 0", " μ univ ≠ 0", " ⨍ (x : α) in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ (x ...
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH · simp · simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S → R) : trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH · simp · simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S → Tropical R) : untrop (∏ i ∈ s, f i) = ∑ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement
Mathlib/Algebra/Tropical/BigOperators.lean
78
82
theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by
induction' l with hd tl IH · simp · simp [List.minimum_cons, ← IH]
[ " trop l.sum = (map trop l).prod", " trop [].sum = (map trop []).prod", " trop (hd :: tl).sum = (map trop (hd :: tl)).prod", " ∀ (a : List R), trop (sum ⟦a⟧) = (map trop ⟦a⟧).prod", " trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i)", " ∏ i ∈ s, trop (f i) = (Multiset.map trop (Multiset.map f s.val)).prod", " ...
[ " trop l.sum = (map trop l).prod", " trop [].sum = (map trop []).prod", " trop (hd :: tl).sum = (map trop (hd :: tl)).prod", " ∀ (a : List R), trop (sum ⟦a⟧) = (map trop ⟦a⟧).prod", " trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i)", " ∏ i ∈ s, trop (f i) = (Multiset.map trop (Multiset.map f s.val)).prod", " ...
import Mathlib.NumberTheory.Divisors import Mathlib.Data.Nat.Digits import Mathlib.Data.Nat.MaxPowDiv import Mathlib.Data.Nat.Multiplicity import Mathlib.Tactic.IntervalCases #align_import number_theory.padics.padic_val from "leanprover-community/mathlib"@"60fa54e778c9e85d930efae172435f42fb0d71f7" universe u open Nat open Rat open multiplicity def padicValNat (p : ℕ) (n : ℕ) : ℕ := if h : p ≠ 1 ∧ 0 < n then (multiplicity p n).get (multiplicity.finite_nat_iff.2 h) else 0 #align padic_val_nat padicValNat namespace padicValNat open multiplicity variable {p : ℕ} @[simp] protected theorem zero : padicValNat p 0 = 0 := by simp [padicValNat] #align padic_val_nat.zero padicValNat.zero @[simp] protected theorem one : padicValNat p 1 = 0 := by unfold padicValNat split_ifs · simp · rfl #align padic_val_nat.one padicValNat.one @[simp]
Mathlib/NumberTheory/Padics/PadicVal.lean
101
104
theorem self (hp : 1 < p) : padicValNat p p = 1 := by
have neq_one : ¬p = 1 ↔ True := iff_of_true hp.ne' trivial have eq_zero_false : p = 0 ↔ False := iff_false_intro (zero_lt_one.trans hp).ne' simp [padicValNat, neq_one, eq_zero_false]
[ " padicValNat p 0 = 0", " padicValNat p 1 = 0", " (if h : p ≠ 1 ∧ 0 < 1 then (multiplicity p 1).get ⋯ else 0) = 0", " (multiplicity p 1).get ⋯ = 0", " 0 = 0", " padicValNat p p = 1" ]
[ " padicValNat p 0 = 0", " padicValNat p 1 = 0", " (if h : p ≠ 1 ∧ 0 < 1 then (multiplicity p 1).get ⋯ else 0) = 0", " (multiplicity p 1).get ⋯ = 0", " 0 = 0", " padicValNat p p = 1" ]
import Mathlib.CategoryTheory.Balanced import Mathlib.CategoryTheory.LiftingProperties.Basic #align_import category_theory.limits.shapes.strong_epi from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" universe v u namespace CategoryTheory variable {C : Type u} [Category.{v} C] variable {P Q : C} class StrongEpi (f : P ⟶ Q) : Prop where epi : Epi f llp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Mono z], HasLiftingProperty f z #align category_theory.strong_epi CategoryTheory.StrongEpi #align category_theory.strong_epi.epi CategoryTheory.StrongEpi.epi theorem StrongEpi.mk' {f : P ⟶ Q} [Epi f] (hf : ∀ (X Y : C) (z : X ⟶ Y) (_ : Mono z) (u : P ⟶ X) (v : Q ⟶ Y) (sq : CommSq u f z v), sq.HasLift) : StrongEpi f := { epi := inferInstance llp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩ } #align category_theory.strong_epi.mk' CategoryTheory.StrongEpi.mk' class StrongMono (f : P ⟶ Q) : Prop where mono : Mono f rlp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Epi z], HasLiftingProperty z f #align category_theory.strong_mono CategoryTheory.StrongMono theorem StrongMono.mk' {f : P ⟶ Q} [Mono f] (hf : ∀ (X Y : C) (z : X ⟶ Y) (_ : Epi z) (u : X ⟶ P) (v : Y ⟶ Q) (sq : CommSq u z f v), sq.HasLift) : StrongMono f where mono := inferInstance rlp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩ #align category_theory.strong_mono.mk' CategoryTheory.StrongMono.mk' attribute [instance 100] StrongEpi.llp attribute [instance 100] StrongMono.rlp instance (priority := 100) epi_of_strongEpi (f : P ⟶ Q) [StrongEpi f] : Epi f := StrongEpi.epi #align category_theory.epi_of_strong_epi CategoryTheory.epi_of_strongEpi instance (priority := 100) mono_of_strongMono (f : P ⟶ Q) [StrongMono f] : Mono f := StrongMono.mono #align category_theory.mono_of_strong_mono CategoryTheory.mono_of_strongMono section variable {R : C} (f : P ⟶ Q) (g : Q ⟶ R)
Mathlib/CategoryTheory/Limits/Shapes/StrongEpi.lean
98
102
theorem strongEpi_comp [StrongEpi f] [StrongEpi g] : StrongEpi (f ≫ g) := { epi := epi_comp _ _ llp := by
intros infer_instance }
[ " ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [inst : Mono z], HasLiftingProperty (f ≫ g) z", " HasLiftingProperty (f ≫ g) z✝" ]
[ " ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [inst : Mono z], HasLiftingProperty (f ≫ g) z" ]
import Mathlib.Combinatorics.Quiver.Basic import Mathlib.Logic.Lemmas #align_import combinatorics.quiver.path from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" open Function universe v v₁ v₂ u u₁ u₂ namespace Quiver inductive Path {V : Type u} [Quiver.{v} V] (a : V) : V → Sort max (u + 1) v | nil : Path a a | cons : ∀ {b c : V}, Path a b → (b ⟶ c) → Path a c #align quiver.path Quiver.Path -- See issue lean4#2049 compile_inductive% Path def Hom.toPath {V} [Quiver V] {a b : V} (e : a ⟶ b) : Path a b := Path.nil.cons e #align quiver.hom.to_path Quiver.Hom.toPath namespace Path variable {V : Type u} [Quiver V] {a b c d : V} lemma nil_ne_cons (p : Path a b) (e : b ⟶ a) : Path.nil ≠ p.cons e := fun h => by injection h #align quiver.path.nil_ne_cons Quiver.Path.nil_ne_cons lemma cons_ne_nil (p : Path a b) (e : b ⟶ a) : p.cons e ≠ Path.nil := fun h => by injection h #align quiver.path.cons_ne_nil Quiver.Path.cons_ne_nil lemma obj_eq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : b = c := by injection h #align quiver.path.obj_eq_of_cons_eq_cons Quiver.Path.obj_eq_of_cons_eq_cons lemma heq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : HEq p p' := by injection h #align quiver.path.heq_of_cons_eq_cons Quiver.Path.heq_of_cons_eq_cons lemma hom_heq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : HEq e e' := by injection h #align quiver.path.hom_heq_of_cons_eq_cons Quiver.Path.hom_heq_of_cons_eq_cons def length {a : V} : ∀ {b : V}, Path a b → ℕ | _, nil => 0 | _, cons p _ => p.length + 1 #align quiver.path.length Quiver.Path.length instance {a : V} : Inhabited (Path a a) := ⟨nil⟩ @[simp] theorem length_nil {a : V} : (nil : Path a a).length = 0 := rfl #align quiver.path.length_nil Quiver.Path.length_nil @[simp] theorem length_cons (a b c : V) (p : Path a b) (e : b ⟶ c) : (p.cons e).length = p.length + 1 := rfl #align quiver.path.length_cons Quiver.Path.length_cons
Mathlib/Combinatorics/Quiver/Path.lean
81
84
theorem eq_of_length_zero (p : Path a b) (hzero : p.length = 0) : a = b := by
cases p · rfl · cases Nat.succ_ne_zero _ hzero
[ " False", " b = c", " HEq p p'", " HEq e e'", " a = b", " a = a" ]
[ " False", " b = c", " HEq p p'", " HEq e e'", " a = b" ]
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Calculus.FDeriv.Linear import Mathlib.Analysis.Calculus.FDeriv.Comp #align_import analysis.calculus.fderiv.equiv from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] 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} namespace ContinuousLinearEquiv variable (iso : E ≃L[𝕜] F) @[fun_prop] protected theorem hasStrictFDerivAt : HasStrictFDerivAt iso (iso : E →L[𝕜] F) x := iso.toContinuousLinearMap.hasStrictFDerivAt #align continuous_linear_equiv.has_strict_fderiv_at ContinuousLinearEquiv.hasStrictFDerivAt @[fun_prop] protected theorem hasFDerivWithinAt : HasFDerivWithinAt iso (iso : E →L[𝕜] F) s x := iso.toContinuousLinearMap.hasFDerivWithinAt #align continuous_linear_equiv.has_fderiv_within_at ContinuousLinearEquiv.hasFDerivWithinAt @[fun_prop] protected theorem hasFDerivAt : HasFDerivAt iso (iso : E →L[𝕜] F) x := iso.toContinuousLinearMap.hasFDerivAtFilter #align continuous_linear_equiv.has_fderiv_at ContinuousLinearEquiv.hasFDerivAt @[fun_prop] protected theorem differentiableAt : DifferentiableAt 𝕜 iso x := iso.hasFDerivAt.differentiableAt #align continuous_linear_equiv.differentiable_at ContinuousLinearEquiv.differentiableAt @[fun_prop] protected theorem differentiableWithinAt : DifferentiableWithinAt 𝕜 iso s x := iso.differentiableAt.differentiableWithinAt #align continuous_linear_equiv.differentiable_within_at ContinuousLinearEquiv.differentiableWithinAt protected theorem fderiv : fderiv 𝕜 iso x = iso := iso.hasFDerivAt.fderiv #align continuous_linear_equiv.fderiv ContinuousLinearEquiv.fderiv protected theorem fderivWithin (hxs : UniqueDiffWithinAt 𝕜 s x) : fderivWithin 𝕜 iso s x = iso := iso.toContinuousLinearMap.fderivWithin hxs #align continuous_linear_equiv.fderiv_within ContinuousLinearEquiv.fderivWithin @[fun_prop] protected theorem differentiable : Differentiable 𝕜 iso := fun _ => iso.differentiableAt #align continuous_linear_equiv.differentiable ContinuousLinearEquiv.differentiable @[fun_prop] protected theorem differentiableOn : DifferentiableOn 𝕜 iso s := iso.differentiable.differentiableOn #align continuous_linear_equiv.differentiable_on ContinuousLinearEquiv.differentiableOn theorem comp_differentiableWithinAt_iff {f : G → E} {s : Set G} {x : G} : DifferentiableWithinAt 𝕜 (iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x := by refine ⟨fun H => ?_, fun H => iso.differentiable.differentiableAt.comp_differentiableWithinAt x H⟩ have : DifferentiableWithinAt 𝕜 (iso.symm ∘ iso ∘ f) s x := iso.symm.differentiable.differentiableAt.comp_differentiableWithinAt x H rwa [← Function.comp.assoc iso.symm iso f, iso.symm_comp_self] at this #align continuous_linear_equiv.comp_differentiable_within_at_iff ContinuousLinearEquiv.comp_differentiableWithinAt_iff theorem comp_differentiableAt_iff {f : G → E} {x : G} : DifferentiableAt 𝕜 (iso ∘ f) x ↔ DifferentiableAt 𝕜 f x := by rw [← differentiableWithinAt_univ, ← differentiableWithinAt_univ, iso.comp_differentiableWithinAt_iff] #align continuous_linear_equiv.comp_differentiable_at_iff ContinuousLinearEquiv.comp_differentiableAt_iff
Mathlib/Analysis/Calculus/FDeriv/Equiv.lean
110
113
theorem comp_differentiableOn_iff {f : G → E} {s : Set G} : DifferentiableOn 𝕜 (iso ∘ f) s ↔ DifferentiableOn 𝕜 f s := by
rw [DifferentiableOn, DifferentiableOn] simp only [iso.comp_differentiableWithinAt_iff]
[ " DifferentiableWithinAt 𝕜 (⇑iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x", " DifferentiableWithinAt 𝕜 f s x", " DifferentiableAt 𝕜 (⇑iso ∘ f) x ↔ DifferentiableAt 𝕜 f x", " DifferentiableOn 𝕜 (⇑iso ∘ f) s ↔ DifferentiableOn 𝕜 f s", " (∀ x ∈ s, DifferentiableWithinAt 𝕜 (⇑iso ∘ f) s x) ↔ ∀ x ∈ s, Di...
[ " DifferentiableWithinAt 𝕜 (⇑iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x", " DifferentiableWithinAt 𝕜 f s x", " DifferentiableAt 𝕜 (⇑iso ∘ f) x ↔ DifferentiableAt 𝕜 f x", " DifferentiableOn 𝕜 (⇑iso ∘ f) s ↔ DifferentiableOn 𝕜 f s" ]
import Mathlib.LinearAlgebra.Matrix.Adjugate import Mathlib.RingTheory.PolynomialAlgebra #align_import linear_algebra.matrix.charpoly.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section universe u v w namespace Matrix open Finset Matrix Polynomial variable {R S : Type*} [CommRing R] [CommRing S] variable {m n : Type*} [DecidableEq m] [DecidableEq n] [Fintype m] [Fintype n] variable (M₁₁ : Matrix m m R) (M₁₂ : Matrix m n R) (M₂₁ : Matrix n m R) (M₂₂ M : Matrix n n R) variable (i j : n) def charmatrix (M : Matrix n n R) : Matrix n n R[X] := Matrix.scalar n (X : R[X]) - (C : R →+* R[X]).mapMatrix M #align charmatrix Matrix.charmatrix theorem charmatrix_apply : charmatrix M i j = (Matrix.diagonal fun _ : n => X) i j - C (M i j) := rfl #align charmatrix_apply Matrix.charmatrix_apply @[simp] theorem charmatrix_apply_eq : charmatrix M i i = (X : R[X]) - C (M i i) := by simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, map_apply, diagonal_apply_eq] #align charmatrix_apply_eq Matrix.charmatrix_apply_eq @[simp]
Mathlib/LinearAlgebra/Matrix/Charpoly/Basic.lean
62
64
theorem charmatrix_apply_ne (h : i ≠ j) : charmatrix M i j = -C (M i j) := by
simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, diagonal_apply_ne _ h, map_apply, sub_eq_neg_self]
[ " M.charmatrix i i = X - C (M i i)", " M.charmatrix i j = -C (M i j)" ]
[ " M.charmatrix i i = X - C (M i i)", " M.charmatrix i j = -C (M i j)" ]
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Field.Rat import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Field.Rat import Mathlib.Combinatorics.Enumerative.DoubleCounting import Mathlib.Combinatorics.SetFamily.Shadow #align_import combinatorics.set_family.lym from "leanprover-community/mathlib"@"861a26926586cd46ff80264d121cdb6fa0e35cc1" open Finset Nat open FinsetFamily variable {𝕜 α : Type*} [LinearOrderedField 𝕜] namespace Finset section LocalLYM variable [DecidableEq α] [Fintype α] {𝒜 : Finset (Finset α)} {r : ℕ} theorem card_mul_le_card_shadow_mul (h𝒜 : (𝒜 : Set (Finset α)).Sized r) : 𝒜.card * r ≤ (∂ 𝒜).card * (Fintype.card α - r + 1) := by let i : DecidableRel ((· ⊆ ·) : Finset α → Finset α → Prop) := fun _ _ => Classical.dec _ refine card_mul_le_card_mul' (· ⊆ ·) (fun s hs => ?_) (fun s hs => ?_) · rw [← h𝒜 hs, ← card_image_of_injOn s.erase_injOn] refine card_le_card ?_ simp_rw [image_subset_iff, mem_bipartiteBelow] exact fun a ha => ⟨erase_mem_shadow hs ha, erase_subset _ _⟩ refine le_trans ?_ tsub_tsub_le_tsub_add rw [← (Set.Sized.shadow h𝒜) hs, ← card_compl, ← card_image_of_injOn (insert_inj_on' _)] refine card_le_card fun t ht => ?_ -- Porting note: commented out the following line -- infer_instance rw [mem_bipartiteAbove] at ht have : ∅ ∉ 𝒜 := by rw [← mem_coe, h𝒜.empty_mem_iff, coe_eq_singleton] rintro rfl rw [shadow_singleton_empty] at hs exact not_mem_empty s hs have h := exists_eq_insert_iff.2 ⟨ht.2, by rw [(sized_shadow_iff this).1 (Set.Sized.shadow h𝒜) ht.1, (Set.Sized.shadow h𝒜) hs]⟩ rcases h with ⟨a, ha, rfl⟩ exact mem_image_of_mem _ (mem_compl.2 ha) #align finset.card_mul_le_card_shadow_mul Finset.card_mul_le_card_shadow_mul
Mathlib/Combinatorics/SetFamily/LYM.lean
92
110
theorem card_div_choose_le_card_shadow_div_choose (hr : r ≠ 0) (h𝒜 : (𝒜 : Set (Finset α)).Sized r) : (𝒜.card : 𝕜) / (Fintype.card α).choose r ≤ (∂ 𝒜).card / (Fintype.card α).choose (r - 1) := by
obtain hr' | hr' := lt_or_le (Fintype.card α) r · rw [choose_eq_zero_of_lt hr', cast_zero, div_zero] exact div_nonneg (cast_nonneg _) (cast_nonneg _) replace h𝒜 := card_mul_le_card_shadow_mul h𝒜 rw [div_le_div_iff] <;> norm_cast · cases' r with r · exact (hr rfl).elim rw [tsub_add_eq_add_tsub hr', add_tsub_add_eq_tsub_right] at h𝒜 apply le_of_mul_le_mul_right _ (pos_iff_ne_zero.2 hr) convert Nat.mul_le_mul_right ((Fintype.card α).choose r) h𝒜 using 1 · simp [mul_assoc, Nat.choose_succ_right_eq] exact Or.inl (mul_comm _ _) · simp only [mul_assoc, choose_succ_right_eq, mul_eq_mul_left_iff] exact Or.inl (mul_comm _ _) · exact Nat.choose_pos hr' · exact Nat.choose_pos (r.pred_le.trans hr')
[ " 𝒜.card * r ≤ (∂ 𝒜).card * (Fintype.card α - r + 1)", " r ≤ (bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s).card", " (image s.erase s).card ≤ (bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s).card", " image s.erase s ⊆ bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s", " ∀ x ∈ s, s.erase x ∈ ∂ 𝒜 ∧ s.erase...
[ " 𝒜.card * r ≤ (∂ 𝒜).card * (Fintype.card α - r + 1)", " r ≤ (bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s).card", " (image s.erase s).card ≤ (bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s).card", " image s.erase s ⊆ bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s", " ∀ x ∈ s, s.erase x ∈ ∂ 𝒜 ∧ s.erase...
import Mathlib.CategoryTheory.EffectiveEpi.Basic import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks import Mathlib.Tactic.ApplyFun namespace CategoryTheory open Limits variable {C : Type*} [Category C] noncomputable def effectiveEpiStructIsColimitDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C) (c : Cofan X) (hc : IsColimit c) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π] : EffectiveEpiStruct (hc.desc (Cofan.mk B π)) where desc e h := EffectiveEpiFamily.desc X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e) (fun a₁ a₂ g₁ g₂ hg ↦ by simp only [← Category.assoc] exact h (g₁ ≫ c.ι.app ⟨a₁⟩) (g₂ ≫ c.ι.app ⟨a₂⟩) (by simpa)) fac e h := hc.hom_ext (fun ⟨j⟩ ↦ (by simp)) uniq e _ m hm := EffectiveEpiFamily.uniq X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e) (fun _ _ _ _ hg ↦ (by simp [← hm, reassoc_of% hg])) m (fun _ ↦ (by simp [← hm])) noncomputable def effectiveEpiStructDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [HasCoproduct X] [EffectiveEpiFamily X π] : EffectiveEpiStruct (Sigma.desc π) := by simpa [coproductIsCoproduct] using effectiveEpiStructIsColimitDescOfEffectiveEpiFamily X _ (coproductIsCoproduct _) π instance {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [HasCoproduct X] [EffectiveEpiFamily X π] : EffectiveEpi (Sigma.desc π) := ⟨⟨effectiveEpiStructDescOfEffectiveEpiFamily X π⟩⟩ example {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π] [HasCoproduct X] : Epi (Sigma.desc π) := inferInstance
Mathlib/CategoryTheory/EffectiveEpi/Coproduct.lean
61
93
theorem effectiveEpiFamilyStructOfEffectiveEpiDesc_aux {B : C} {α : Type*} {X : α → C} {π : (a : α) → X a ⟶ B} [HasCoproduct X] [∀ {Z : C} (g : Z ⟶ ∐ X) (a : α), HasPullback g (Sigma.ι X a)] [∀ {Z : C} (g : Z ⟶ ∐ X), HasCoproduct fun a ↦ pullback g (Sigma.ι X a)] [∀ {Z : C} (g : Z ⟶ ∐ X), Epi (Sigma.desc fun a ↦ pullback.fst (f := g) (g := (Sigma.ι X a)))] {W : C} {e : (a : α) → X a ⟶ W} (h : ∀ {Z : C} (a₁ a₂ : α) (g₁ : Z ⟶ X a₁) (g₂ : Z ⟶ X a₂), g₁ ≫ π a₁ = g₂ ≫ π a₂ → g₁ ≫ e a₁ = g₂ ≫ e a₂) {Z : C} {g₁ g₂ : Z ⟶ ∐ fun b ↦ X b} (hg : g₁ ≫ Sigma.desc π = g₂ ≫ Sigma.desc π) : g₁ ≫ Sigma.desc e = g₂ ≫ Sigma.desc e := by
apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := g₁) (g := (Sigma.ι X a))) ≫ ·) using (fun a b ↦ (cancel_epi _).mp) ext a simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] rw [← Category.assoc, pullback.condition] simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ g₂) (g := (Sigma.ι X a))) ≫ ·) using (fun a b ↦ (cancel_epi _).mp) ext b simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] simp only [← Category.assoc] rw [(Category.assoc _ _ g₂), pullback.condition] simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] rw [← Category.assoc] apply h apply_fun (pullback.fst (f := g₁) (g := (Sigma.ι X a)) ≫ ·) at hg rw [← Category.assoc, pullback.condition] at hg simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] at hg apply_fun ((Sigma.ι (fun a ↦ pullback _ _) b) ≫ (Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ g₂) (g := (Sigma.ι X a))) ≫ ·) at hg simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] at hg simp only [← Category.assoc] at hg rw [(Category.assoc _ _ g₂), pullback.condition] at hg simpa using hg
[ " g₁ ≫ (fun a => c.ι.app { as := a } ≫ e) a₁ = g₂ ≫ (fun a => c.ι.app { as := a } ≫ e) a₂", " (g₁ ≫ c.ι.app { as := a₁ }) ≫ e = (g₂ ≫ c.ι.app { as := a₂ }) ≫ e", " (g₁ ≫ c.ι.app { as := a₁ }) ≫ hc.desc (Cofan.mk B π) = (g₂ ≫ c.ι.app { as := a₂ }) ≫ hc.desc (Cofan.mk B π)", " c.ι.app { as := j } ≫\n hc.de...
[ " g₁ ≫ (fun a => c.ι.app { as := a } ≫ e) a₁ = g₂ ≫ (fun a => c.ι.app { as := a } ≫ e) a₂", " (g₁ ≫ c.ι.app { as := a₁ }) ≫ e = (g₂ ≫ c.ι.app { as := a₂ }) ≫ e", " (g₁ ≫ c.ι.app { as := a₁ }) ≫ hc.desc (Cofan.mk B π) = (g₂ ≫ c.ι.app { as := a₂ }) ≫ hc.desc (Cofan.mk B π)", " c.ι.app { as := j } ≫\n hc.de...
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp] theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x noncomputable def toDualRight : N ≃ₗ[R] Dual R M := toDualLeft p.flip @[simp] theorem toDualRight_apply (a : N) : p.toDualRight a = p.flip a := rfl @[simp]
Mathlib/LinearAlgebra/PerfectPairing.lean
85
89
theorem apply_apply_toDualRight_symm (x : M) (f : Dual R M) : (p x) (p.toDualRight.symm f) = f x := by
have h := LinearEquiv.apply_symm_apply p.toDualRight f rw [toDualRight_apply] at h exact congrFun (congrArg DFunLike.coe h) x
[ " x = y", " { toLin := toLin✝, bijectiveLeft := bijectiveLeft✝, bijectiveRight := bijectiveRight✝ } = y", " { toLin := toLin✝¹, bijectiveLeft := bijectiveLeft✝¹, bijectiveRight := bijectiveRight✝¹ } =\n { toLin := toLin✝, bijectiveLeft := bijectiveLeft✝, bijectiveRight := bijectiveRight✝ }", " (p (p.toDual...
[ " x = y", " { toLin := toLin✝, bijectiveLeft := bijectiveLeft✝, bijectiveRight := bijectiveRight✝ } = y", " { toLin := toLin✝¹, bijectiveLeft := bijectiveLeft✝¹, bijectiveRight := bijectiveRight✝¹ } =\n { toLin := toLin✝, bijectiveLeft := bijectiveLeft✝, bijectiveRight := bijectiveRight✝ }", " (p (p.toDual...
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Analysis.Analytic.Constructions import Mathlib.Topology.Algebra.Module.FiniteDimension variable {𝕜 E A B : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [CommSemiring A] {z : E} {s : Set E} section MvPolynomial open MvPolynomial variable [NormedCommRing B] [NormedAlgebra 𝕜 B] [Algebra A B] {σ : Type*} {f : E → σ → B}
Mathlib/Analysis/Analytic/Polynomial.lean
47
52
theorem AnalyticAt.aeval_mvPolynomial (hf : ∀ i, AnalyticAt 𝕜 (f · i) z) (p : MvPolynomial σ A) : AnalyticAt 𝕜 (fun x ↦ aeval (f x) p) z := by
apply p.induction_on (fun k ↦ ?_) (fun p q hp hq ↦ ?_) fun p i hp ↦ ?_ -- `refine` doesn't work · simp_rw [aeval_C]; apply analyticAt_const · simp_rw [map_add]; exact hp.add hq · simp_rw [map_mul, aeval_X]; exact hp.mul (hf i)
[ " AnalyticAt 𝕜 (fun x => (aeval (f x)) p) z", " AnalyticAt 𝕜 (fun x => (aeval (f x)) (C k)) z", " AnalyticAt 𝕜 (fun x => (algebraMap A B) k) z", " AnalyticAt 𝕜 (fun x => (aeval (f x)) (p + q)) z", " AnalyticAt 𝕜 (fun x => (aeval (f x)) p + (aeval (f x)) q) z", " AnalyticAt 𝕜 (fun x => (aeval (f x)) ...
[ " AnalyticAt 𝕜 (fun x => (aeval (f x)) p) z" ]
import Mathlib.Order.Filter.Cofinite import Mathlib.Order.Hom.CompleteLattice #align_import order.liminf_limsup from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780" set_option autoImplicit true open Filter Set Function variable {α β γ ι ι' : Type*} namespace Filter section Relation def IsBounded (r : α → α → Prop) (f : Filter α) := ∃ b, ∀ᶠ x in f, r x b #align filter.is_bounded Filter.IsBounded def IsBoundedUnder (r : α → α → Prop) (f : Filter β) (u : β → α) := (map u f).IsBounded r #align filter.is_bounded_under Filter.IsBoundedUnder variable {r : α → α → Prop} {f g : Filter α} theorem isBounded_iff : f.IsBounded r ↔ ∃ s ∈ f.sets, ∃ b, s ⊆ { x | r x b } := Iff.intro (fun ⟨b, hb⟩ => ⟨{ a | r a b }, hb, b, Subset.refl _⟩) fun ⟨_, hs, b, hb⟩ => ⟨b, mem_of_superset hs hb⟩ #align filter.is_bounded_iff Filter.isBounded_iff theorem isBoundedUnder_of {f : Filter β} {u : β → α} : (∃ b, ∀ x, r (u x) b) → f.IsBoundedUnder r u | ⟨b, hb⟩ => ⟨b, show ∀ᶠ x in f, r (u x) b from eventually_of_forall hb⟩ #align filter.is_bounded_under_of Filter.isBoundedUnder_of
Mathlib/Order/LiminfLimsup.lean
77
77
theorem isBounded_bot : IsBounded r ⊥ ↔ Nonempty α := by
simp [IsBounded, exists_true_iff_nonempty]
[ " IsBounded r ⊥ ↔ Nonempty α" ]
[ " IsBounded r ⊥ ↔ Nonempty α" ]
import Mathlib.Algebra.GroupWithZero.Units.Lemmas import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Fintype.BigOperators #align_import data.sign from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c" -- Porting note (#11081): cannot automatically derive Fintype, added manually inductive SignType | zero | neg | pos deriving DecidableEq, Inhabited #align sign_type SignType -- Porting note: these lemmas are autogenerated by the inductive definition and are not -- in simple form due to the below `x_eq_x` lemmas attribute [nolint simpNF] SignType.zero.sizeOf_spec attribute [nolint simpNF] SignType.neg.sizeOf_spec attribute [nolint simpNF] SignType.pos.sizeOf_spec namespace SignType -- Porting note: Added Fintype SignType manually instance : Fintype SignType := Fintype.ofMultiset (zero :: neg :: pos :: List.nil) (fun x ↦ by cases x <;> simp) instance : Zero SignType := ⟨zero⟩ instance : One SignType := ⟨pos⟩ instance : Neg SignType := ⟨fun s => match s with | neg => pos | zero => zero | pos => neg⟩ @[simp] theorem zero_eq_zero : zero = 0 := rfl #align sign_type.zero_eq_zero SignType.zero_eq_zero @[simp] theorem neg_eq_neg_one : neg = -1 := rfl #align sign_type.neg_eq_neg_one SignType.neg_eq_neg_one @[simp] theorem pos_eq_one : pos = 1 := rfl #align sign_type.pos_eq_one SignType.pos_eq_one instance : Mul SignType := ⟨fun x y => match x with | neg => -y | zero => zero | pos => y⟩ protected inductive LE : SignType → SignType → Prop | of_neg (a) : SignType.LE neg a | zero : SignType.LE zero zero | of_pos (a) : SignType.LE a pos #align sign_type.le SignType.LE instance : LE SignType := ⟨SignType.LE⟩ instance LE.decidableRel : DecidableRel SignType.LE := fun a b => by cases a <;> cases b <;> first | exact isTrue (by constructor)| exact isFalse (by rintro ⟨_⟩) instance decidableEq : DecidableEq SignType := fun a b => by cases a <;> cases b <;> first | exact isTrue (by constructor)| exact isFalse (by rintro ⟨_⟩) private lemma mul_comm : ∀ (a b : SignType), a * b = b * a := by rintro ⟨⟩ ⟨⟩ <;> rfl private lemma mul_assoc : ∀ (a b c : SignType), (a * b) * c = a * (b * c) := by rintro ⟨⟩ ⟨⟩ ⟨⟩ <;> rfl instance : CommGroupWithZero SignType where zero := 0 one := 1 mul := (· * ·) inv := id mul_zero a := by cases a <;> rfl zero_mul a := by cases a <;> rfl mul_one a := by cases a <;> rfl one_mul a := by cases a <;> rfl mul_inv_cancel a ha := by cases a <;> trivial mul_comm := mul_comm mul_assoc := mul_assoc exists_pair_ne := ⟨0, 1, by rintro ⟨_⟩⟩ inv_zero := rfl private lemma le_antisymm (a b : SignType) (_ : a ≤ b) (_: b ≤ a) : a = b := by cases a <;> cases b <;> trivial private lemma le_trans (a b c : SignType) (_ : a ≤ b) (_: b ≤ c) : a ≤ c := by cases a <;> cases b <;> cases c <;> tauto instance : LinearOrder SignType where le := (· ≤ ·) le_refl a := by cases a <;> constructor le_total a b := by cases a <;> cases b <;> first | left; constructor | right; constructor le_antisymm := le_antisymm le_trans := le_trans decidableLE := LE.decidableRel decidableEq := SignType.decidableEq instance : BoundedOrder SignType where top := 1 le_top := LE.of_pos bot := -1 bot_le := LE.of_neg instance : HasDistribNeg SignType := { neg_neg := fun x => by cases x <;> rfl neg_mul := fun x y => by cases x <;> cases y <;> rfl mul_neg := fun x y => by cases x <;> cases y <;> rfl } def fin3Equiv : SignType ≃* Fin 3 where toFun a := match a with | 0 => ⟨0, by simp⟩ | 1 => ⟨1, by simp⟩ | -1 => ⟨2, by simp⟩ invFun a := match a with | ⟨0, _⟩ => 0 | ⟨1, _⟩ => 1 | ⟨2, _⟩ => -1 left_inv a := by cases a <;> rfl right_inv a := match a with | ⟨0, _⟩ => by simp | ⟨1, _⟩ => by simp | ⟨2, _⟩ => by simp map_mul' a b := by cases a <;> cases b <;> rfl #align sign_type.fin3_equiv SignType.fin3Equiv section CaseBashing -- Porting note: a lot of these thms used to use decide! which is not implemented yet
Mathlib/Data/Sign.lean
162
162
theorem nonneg_iff {a : SignType} : 0 ≤ a ↔ a = 0 ∨ a = 1 := by
cases a <;> decide
[ " x ∈ ↑[zero, neg, pos]", " zero ∈ ↑[zero, neg, pos]", " neg ∈ ↑[zero, neg, pos]", " pos ∈ ↑[zero, neg, pos]", " Decidable (a.LE b)", " Decidable (SignType.zero.LE b)", " Decidable (neg.LE b)", " Decidable (pos.LE b)", " Decidable (SignType.zero.LE SignType.zero)", " SignType.zero.LE SignType.zero...
[ " x ∈ ↑[zero, neg, pos]", " zero ∈ ↑[zero, neg, pos]", " neg ∈ ↑[zero, neg, pos]", " pos ∈ ↑[zero, neg, pos]", " Decidable (a.LE b)", " Decidable (SignType.zero.LE b)", " Decidable (neg.LE b)", " Decidable (pos.LE b)", " Decidable (SignType.zero.LE SignType.zero)", " SignType.zero.LE SignType.zero...
import Mathlib.LinearAlgebra.Quotient #align_import linear_algebra.isomorphisms from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d" universe u v variable {R M M₂ M₃ : Type*} variable [Ring R] [AddCommGroup M] [AddCommGroup M₂] [AddCommGroup M₃] variable [Module R M] [Module R M₂] [Module R M₃] variable (f : M →ₗ[R] M₂) namespace LinearMap open Submodule section IsomorphismLaws noncomputable def quotKerEquivRange : (M ⧸ LinearMap.ker f) ≃ₗ[R] LinearMap.range f := (LinearEquiv.ofInjective (f.ker.liftQ f <| le_rfl) <| ker_eq_bot.mp <| Submodule.ker_liftQ_eq_bot _ _ _ (le_refl (LinearMap.ker f))).trans (LinearEquiv.ofEq _ _ <| Submodule.range_liftQ _ _ _) #align linear_map.quot_ker_equiv_range LinearMap.quotKerEquivRange noncomputable def quotKerEquivOfSurjective (f : M →ₗ[R] M₂) (hf : Function.Surjective f) : (M ⧸ LinearMap.ker f) ≃ₗ[R] M₂ := f.quotKerEquivRange.trans (LinearEquiv.ofTop (LinearMap.range f) (LinearMap.range_eq_top.2 hf)) #align linear_map.quot_ker_equiv_of_surjective LinearMap.quotKerEquivOfSurjective @[simp] theorem quotKerEquivRange_apply_mk (x : M) : (f.quotKerEquivRange (Submodule.Quotient.mk x) : M₂) = f x := rfl #align linear_map.quot_ker_equiv_range_apply_mk LinearMap.quotKerEquivRange_apply_mk @[simp] theorem quotKerEquivRange_symm_apply_image (x : M) (h : f x ∈ LinearMap.range f) : f.quotKerEquivRange.symm ⟨f x, h⟩ = f.ker.mkQ x := f.quotKerEquivRange.symm_apply_apply (f.ker.mkQ x) #align linear_map.quot_ker_equiv_range_symm_apply_image LinearMap.quotKerEquivRange_symm_apply_image -- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out abbrev subToSupQuotient (p p' : Submodule R M) : { x // x ∈ p } →ₗ[R] { x // x ∈ p ⊔ p' } ⧸ comap (Submodule.subtype (p ⊔ p')) p' := (comap (p ⊔ p').subtype p').mkQ.comp (Submodule.inclusion le_sup_left) -- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out
Mathlib/LinearAlgebra/Isomorphisms.lean
67
70
theorem comap_leq_ker_subToSupQuotient (p p' : Submodule R M) : comap (Submodule.subtype p) (p ⊓ p') ≤ ker (subToSupQuotient p p') := by
rw [LinearMap.ker_comp, Submodule.inclusion, comap_codRestrict, ker_mkQ, map_comap_subtype] exact comap_mono (inf_le_inf_right _ le_sup_left)
[ " comap p.subtype (p ⊓ p') ≤ ker (subToSupQuotient p p')", " comap p.subtype (p ⊓ p') ≤ comap p.subtype ((p ⊔ p') ⊓ p')" ]
[ " comap p.subtype (p ⊓ p') ≤ ker (subToSupQuotient p p')" ]
import Mathlib.Probability.Kernel.Composition import Mathlib.MeasureTheory.Integral.SetIntegral #align_import probability.kernel.integral_comp_prod from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113" noncomputable section open scoped Topology ENNReal MeasureTheory ProbabilityTheory open Set Function Real ENNReal MeasureTheory Filter ProbabilityTheory ProbabilityTheory.kernel variable {α β γ E : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ} [NormedAddCommGroup E] {κ : kernel α β} [IsSFiniteKernel κ] {η : kernel (α × β) γ} [IsSFiniteKernel η] {a : α} namespace ProbabilityTheory theorem hasFiniteIntegral_prod_mk_left (a : α) {s : Set (β × γ)} (h2s : (κ ⊗ₖ η) a s ≠ ∞) : HasFiniteIntegral (fun b => (η (a, b) (Prod.mk b ⁻¹' s)).toReal) (κ a) := by let t := toMeasurable ((κ ⊗ₖ η) a) s simp_rw [HasFiniteIntegral, ennnorm_eq_ofReal toReal_nonneg] calc ∫⁻ b, ENNReal.ofReal (η (a, b) (Prod.mk b ⁻¹' s)).toReal ∂κ a _ ≤ ∫⁻ b, η (a, b) (Prod.mk b ⁻¹' t) ∂κ a := by refine lintegral_mono_ae ?_ filter_upwards [ae_kernel_lt_top a h2s] with b hb rw [ofReal_toReal hb.ne] exact measure_mono (preimage_mono (subset_toMeasurable _ _)) _ ≤ (κ ⊗ₖ η) a t := le_compProd_apply _ _ _ _ _ = (κ ⊗ₖ η) a s := measure_toMeasurable s _ < ⊤ := h2s.lt_top #align probability_theory.has_finite_integral_prod_mk_left ProbabilityTheory.hasFiniteIntegral_prod_mk_left theorem integrable_kernel_prod_mk_left (a : α) {s : Set (β × γ)} (hs : MeasurableSet s) (h2s : (κ ⊗ₖ η) a s ≠ ∞) : Integrable (fun b => (η (a, b) (Prod.mk b ⁻¹' s)).toReal) (κ a) := by constructor · exact (measurable_kernel_prod_mk_left' hs a).ennreal_toReal.aestronglyMeasurable · exact hasFiniteIntegral_prod_mk_left a h2s #align probability_theory.integrable_kernel_prod_mk_left ProbabilityTheory.integrable_kernel_prod_mk_left theorem _root_.MeasureTheory.AEStronglyMeasurable.integral_kernel_compProd [NormedSpace ℝ E] ⦃f : β × γ → E⦄ (hf : AEStronglyMeasurable f ((κ ⊗ₖ η) a)) : AEStronglyMeasurable (fun x => ∫ y, f (x, y) ∂η (a, x)) (κ a) := ⟨fun x => ∫ y, hf.mk f (x, y) ∂η (a, x), hf.stronglyMeasurable_mk.integral_kernel_prod_right'', by filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with _ hx using integral_congr_ae hx⟩ #align measure_theory.ae_strongly_measurable.integral_kernel_comp_prod MeasureTheory.AEStronglyMeasurable.integral_kernel_compProd theorem _root_.MeasureTheory.AEStronglyMeasurable.compProd_mk_left {δ : Type*} [TopologicalSpace δ] {f : β × γ → δ} (hf : AEStronglyMeasurable f ((κ ⊗ₖ η) a)) : ∀ᵐ x ∂κ a, AEStronglyMeasurable (fun y => f (x, y)) (η (a, x)) := by filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with x hx using ⟨fun y => hf.mk f (x, y), hf.stronglyMeasurable_mk.comp_measurable measurable_prod_mk_left, hx⟩ #align measure_theory.ae_strongly_measurable.comp_prod_mk_left MeasureTheory.AEStronglyMeasurable.compProd_mk_left
Mathlib/Probability/Kernel/IntegralCompProd.lean
88
104
theorem hasFiniteIntegral_compProd_iff ⦃f : β × γ → E⦄ (h1f : StronglyMeasurable f) : HasFiniteIntegral f ((κ ⊗ₖ η) a) ↔ (∀ᵐ x ∂κ a, HasFiniteIntegral (fun y => f (x, y)) (η (a, x))) ∧ HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂η (a, x)) (κ a) := by
simp only [HasFiniteIntegral] rw [kernel.lintegral_compProd _ _ _ h1f.ennnorm] have : ∀ x, ∀ᵐ y ∂η (a, x), 0 ≤ ‖f (x, y)‖ := fun x => eventually_of_forall fun y => norm_nonneg _ simp_rw [integral_eq_lintegral_of_nonneg_ae (this _) (h1f.norm.comp_measurable measurable_prod_mk_left).aestronglyMeasurable, ennnorm_eq_ofReal toReal_nonneg, ofReal_norm_eq_coe_nnnorm] have : ∀ {p q r : Prop} (_ : r → p), (r ↔ p ∧ q) ↔ p → (r ↔ q) := fun {p q r} h1 => by rw [← and_congr_right_iff, and_iff_right_of_imp h1] rw [this] · intro h2f; rw [lintegral_congr_ae] filter_upwards [h2f] with x hx rw [ofReal_toReal]; rw [← lt_top_iff_ne_top]; exact hx · intro h2f; refine ae_lt_top ?_ h2f.ne; exact h1f.ennnorm.lintegral_kernel_prod_right''
[ " HasFiniteIntegral (fun b => ((η (a, b)) (Prod.mk b ⁻¹' s)).toReal) (κ a)", " ∫⁻ (a_1 : β), ENNReal.ofReal ((η (a, a_1)) (Prod.mk a_1 ⁻¹' s)).toReal ∂κ a < ⊤", " ∫⁻ (b : β), ENNReal.ofReal ((η (a, b)) (Prod.mk b ⁻¹' s)).toReal ∂κ a ≤ ∫⁻ (b : β), (η (a, b)) (Prod.mk b ⁻¹' t) ∂κ a", " ∀ᵐ (a_1 : β) ∂κ a, ENNRea...
[ " HasFiniteIntegral (fun b => ((η (a, b)) (Prod.mk b ⁻¹' s)).toReal) (κ a)", " ∫⁻ (a_1 : β), ENNReal.ofReal ((η (a, a_1)) (Prod.mk a_1 ⁻¹' s)).toReal ∂κ a < ⊤", " ∫⁻ (b : β), ENNReal.ofReal ((η (a, b)) (Prod.mk b ⁻¹' s)).toReal ∂κ a ≤ ∫⁻ (b : β), (η (a, b)) (Prod.mk b ⁻¹' t) ∂κ a", " ∀ᵐ (a_1 : β) ∂κ a, ENNRea...
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1)
Mathlib/RingTheory/PowerSeries/Derivative.lean
41
43
theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by
rw [derivativeFun, coeff_mk]
[ " (coeff R n) f.derivativeFun = (coeff R (n + 1)) f * (↑n + 1)" ]
[ " (coeff R n) f.derivativeFun = (coeff R (n + 1)) f * (↑n + 1)" ]
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
[ " Unique ((i : Fin 0) → α i)", " tail (cons x p) = p", " cons x p i.succ = p i", " cons x p 0 = x", " cons x p 1 = p 0", " cons x p 1 = cons x p (succ 0)" ]
[ " Unique ((i : Fin 0) → α i)", " tail (cons x p) = p", " cons x p i.succ = p i", " cons x p 0 = x", " cons x p 1 = p 0" ]
import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.Algebra.Order.LiminfLimsup import Mathlib.Topology.Instances.NNReal import Mathlib.Topology.EMetricSpace.Lipschitz import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.Order.T5 #align_import topology.instances.ennreal from "leanprover-community/mathlib"@"ec4b2eeb50364487f80421c0b4c41328a611f30d" noncomputable section open Set Filter Metric Function open scoped Classical Topology ENNReal NNReal Filter variable {α : Type*} {β : Type*} {γ : Type*} namespace ENNReal variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} {x y z : ℝ≥0∞} {ε ε₁ ε₂ : ℝ≥0∞} {s : Set ℝ≥0∞} section TopologicalSpace open TopologicalSpace instance : TopologicalSpace ℝ≥0∞ := Preorder.topology ℝ≥0∞ instance : OrderTopology ℝ≥0∞ := ⟨rfl⟩ -- short-circuit type class inference instance : T2Space ℝ≥0∞ := inferInstance instance : T5Space ℝ≥0∞ := inferInstance instance : T4Space ℝ≥0∞ := inferInstance instance : SecondCountableTopology ℝ≥0∞ := orderIsoUnitIntervalBirational.toHomeomorph.embedding.secondCountableTopology instance : MetrizableSpace ENNReal := orderIsoUnitIntervalBirational.toHomeomorph.embedding.metrizableSpace theorem embedding_coe : Embedding ((↑) : ℝ≥0 → ℝ≥0∞) := coe_strictMono.embedding_of_ordConnected <| by rw [range_coe']; exact ordConnected_Iio #align ennreal.embedding_coe ENNReal.embedding_coe theorem isOpen_ne_top : IsOpen { a : ℝ≥0∞ | a ≠ ∞ } := isOpen_ne #align ennreal.is_open_ne_top ENNReal.isOpen_ne_top theorem isOpen_Ico_zero : IsOpen (Ico 0 b) := by rw [ENNReal.Ico_eq_Iio] exact isOpen_Iio #align ennreal.is_open_Ico_zero ENNReal.isOpen_Ico_zero theorem openEmbedding_coe : OpenEmbedding ((↑) : ℝ≥0 → ℝ≥0∞) := ⟨embedding_coe, by rw [range_coe']; exact isOpen_Iio⟩ #align ennreal.open_embedding_coe ENNReal.openEmbedding_coe theorem coe_range_mem_nhds : range ((↑) : ℝ≥0 → ℝ≥0∞) ∈ 𝓝 (r : ℝ≥0∞) := IsOpen.mem_nhds openEmbedding_coe.isOpen_range <| mem_range_self _ #align ennreal.coe_range_mem_nhds ENNReal.coe_range_mem_nhds @[norm_cast] theorem tendsto_coe {f : Filter α} {m : α → ℝ≥0} {a : ℝ≥0} : Tendsto (fun a => (m a : ℝ≥0∞)) f (𝓝 ↑a) ↔ Tendsto m f (𝓝 a) := embedding_coe.tendsto_nhds_iff.symm #align ennreal.tendsto_coe ENNReal.tendsto_coe theorem continuous_coe : Continuous ((↑) : ℝ≥0 → ℝ≥0∞) := embedding_coe.continuous #align ennreal.continuous_coe ENNReal.continuous_coe theorem continuous_coe_iff {α} [TopologicalSpace α] {f : α → ℝ≥0} : (Continuous fun a => (f a : ℝ≥0∞)) ↔ Continuous f := embedding_coe.continuous_iff.symm #align ennreal.continuous_coe_iff ENNReal.continuous_coe_iff theorem nhds_coe {r : ℝ≥0} : 𝓝 (r : ℝ≥0∞) = (𝓝 r).map (↑) := (openEmbedding_coe.map_nhds_eq r).symm #align ennreal.nhds_coe ENNReal.nhds_coe theorem tendsto_nhds_coe_iff {α : Type*} {l : Filter α} {x : ℝ≥0} {f : ℝ≥0∞ → α} : Tendsto f (𝓝 ↑x) l ↔ Tendsto (f ∘ (↑) : ℝ≥0 → α) (𝓝 x) l := by rw [nhds_coe, tendsto_map'_iff] #align ennreal.tendsto_nhds_coe_iff ENNReal.tendsto_nhds_coe_iff theorem continuousAt_coe_iff {α : Type*} [TopologicalSpace α] {x : ℝ≥0} {f : ℝ≥0∞ → α} : ContinuousAt f ↑x ↔ ContinuousAt (f ∘ (↑) : ℝ≥0 → α) x := tendsto_nhds_coe_iff #align ennreal.continuous_at_coe_iff ENNReal.continuousAt_coe_iff theorem nhds_coe_coe {r p : ℝ≥0} : 𝓝 ((r : ℝ≥0∞), (p : ℝ≥0∞)) = (𝓝 (r, p)).map fun p : ℝ≥0 × ℝ≥0 => (↑p.1, ↑p.2) := ((openEmbedding_coe.prod openEmbedding_coe).map_nhds_eq (r, p)).symm #align ennreal.nhds_coe_coe ENNReal.nhds_coe_coe theorem continuous_ofReal : Continuous ENNReal.ofReal := (continuous_coe_iff.2 continuous_id).comp continuous_real_toNNReal #align ennreal.continuous_of_real ENNReal.continuous_ofReal theorem tendsto_ofReal {f : Filter α} {m : α → ℝ} {a : ℝ} (h : Tendsto m f (𝓝 a)) : Tendsto (fun a => ENNReal.ofReal (m a)) f (𝓝 (ENNReal.ofReal a)) := (continuous_ofReal.tendsto a).comp h #align ennreal.tendsto_of_real ENNReal.tendsto_ofReal
Mathlib/Topology/Instances/ENNReal.lean
116
120
theorem tendsto_toNNReal {a : ℝ≥0∞} (ha : a ≠ ∞) : Tendsto ENNReal.toNNReal (𝓝 a) (𝓝 a.toNNReal) := by
lift a to ℝ≥0 using ha rw [nhds_coe, tendsto_map'_iff] exact tendsto_id
[ " (range ofNNReal).OrdConnected", " (Iio ⊤).OrdConnected", " IsOpen (Ico 0 b)", " IsOpen (Iio b)", " IsOpen (range ofNNReal)", " IsOpen (Iio ⊤)", " Tendsto f (𝓝 ↑x) l ↔ Tendsto (f ∘ ofNNReal) (𝓝 x) l", " Tendsto ENNReal.toNNReal (𝓝 a) (𝓝 a.toNNReal)", " Tendsto ENNReal.toNNReal (𝓝 ↑a) (𝓝 (↑a)....
[ " (range ofNNReal).OrdConnected", " (Iio ⊤).OrdConnected", " IsOpen (Ico 0 b)", " IsOpen (Iio b)", " IsOpen (range ofNNReal)", " IsOpen (Iio ⊤)", " Tendsto f (𝓝 ↑x) l ↔ Tendsto (f ∘ ofNNReal) (𝓝 x) l", " Tendsto ENNReal.toNNReal (𝓝 a) (𝓝 a.toNNReal)" ]
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]
Mathlib/Computability/TMToPartrec.lean
140
140
theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by
simp [eval]
[ " zero'.eval = fun v => pure (0 :: v)" ]
[ " zero'.eval = fun v => pure (0 :: v)" ]
import Mathlib.Data.Fintype.List #align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49" assert_not_exists MonoidWithZero open List def Cycle (α : Type*) : Type _ := Quotient (IsRotated.setoid α) #align cycle Cycle namespace Cycle variable {α : Type*} -- Porting note (#11445): new definition @[coe] def ofList : List α → Cycle α := Quot.mk _ instance : Coe (List α) (Cycle α) := ⟨ofList⟩ @[simp] theorem coe_eq_coe {l₁ l₂ : List α} : (l₁ : Cycle α) = (l₂ : Cycle α) ↔ l₁ ~r l₂ := @Quotient.eq _ (IsRotated.setoid _) _ _ #align cycle.coe_eq_coe Cycle.coe_eq_coe @[simp] theorem mk_eq_coe (l : List α) : Quot.mk _ l = (l : Cycle α) := rfl #align cycle.mk_eq_coe Cycle.mk_eq_coe @[simp] theorem mk''_eq_coe (l : List α) : Quotient.mk'' l = (l : Cycle α) := rfl #align cycle.mk'_eq_coe Cycle.mk''_eq_coe theorem coe_cons_eq_coe_append (l : List α) (a : α) : (↑(a :: l) : Cycle α) = (↑(l ++ [a]) : Cycle α) := Quot.sound ⟨1, by rw [rotate_cons_succ, rotate_zero]⟩ #align cycle.coe_cons_eq_coe_append Cycle.coe_cons_eq_coe_append def nil : Cycle α := ([] : List α) #align cycle.nil Cycle.nil @[simp] theorem coe_nil : ↑([] : List α) = @nil α := rfl #align cycle.coe_nil Cycle.coe_nil @[simp] theorem coe_eq_nil (l : List α) : (l : Cycle α) = nil ↔ l = [] := coe_eq_coe.trans isRotated_nil_iff #align cycle.coe_eq_nil Cycle.coe_eq_nil instance : EmptyCollection (Cycle α) := ⟨nil⟩ @[simp] theorem empty_eq : ∅ = @nil α := rfl #align cycle.empty_eq Cycle.empty_eq instance : Inhabited (Cycle α) := ⟨nil⟩ @[elab_as_elim] theorem induction_on {C : Cycle α → Prop} (s : Cycle α) (H0 : C nil) (HI : ∀ (a) (l : List α), C ↑l → C ↑(a :: l)) : C s := Quotient.inductionOn' s fun l => by refine List.recOn l ?_ ?_ <;> simp assumption' #align cycle.induction_on Cycle.induction_on def Mem (a : α) (s : Cycle α) : Prop := Quot.liftOn s (fun l => a ∈ l) fun _ _ e => propext <| e.mem_iff #align cycle.mem Cycle.Mem instance : Membership α (Cycle α) := ⟨Mem⟩ @[simp] theorem mem_coe_iff {a : α} {l : List α} : a ∈ (↑l : Cycle α) ↔ a ∈ l := Iff.rfl #align cycle.mem_coe_iff Cycle.mem_coe_iff @[simp] theorem not_mem_nil : ∀ a, a ∉ @nil α := List.not_mem_nil #align cycle.not_mem_nil Cycle.not_mem_nil instance [DecidableEq α] : DecidableEq (Cycle α) := fun s₁ s₂ => Quotient.recOnSubsingleton₂' s₁ s₂ fun _ _ => decidable_of_iff' _ Quotient.eq'' instance [DecidableEq α] (x : α) (s : Cycle α) : Decidable (x ∈ s) := Quotient.recOnSubsingleton' s fun l => show Decidable (x ∈ l) from inferInstance nonrec def reverse (s : Cycle α) : Cycle α := Quot.map reverse (fun _ _ => IsRotated.reverse) s #align cycle.reverse Cycle.reverse @[simp] theorem reverse_coe (l : List α) : (l : Cycle α).reverse = l.reverse := rfl #align cycle.reverse_coe Cycle.reverse_coe @[simp] theorem mem_reverse_iff {a : α} {s : Cycle α} : a ∈ s.reverse ↔ a ∈ s := Quot.inductionOn s fun _ => mem_reverse #align cycle.mem_reverse_iff Cycle.mem_reverse_iff @[simp] theorem reverse_reverse (s : Cycle α) : s.reverse.reverse = s := Quot.inductionOn s fun _ => by simp #align cycle.reverse_reverse Cycle.reverse_reverse @[simp] theorem reverse_nil : nil.reverse = @nil α := rfl #align cycle.reverse_nil Cycle.reverse_nil def length (s : Cycle α) : ℕ := Quot.liftOn s List.length fun _ _ e => e.perm.length_eq #align cycle.length Cycle.length @[simp] theorem length_coe (l : List α) : length (l : Cycle α) = l.length := rfl #align cycle.length_coe Cycle.length_coe @[simp] theorem length_nil : length (@nil α) = 0 := rfl #align cycle.length_nil Cycle.length_nil @[simp] theorem length_reverse (s : Cycle α) : s.reverse.length = s.length := Quot.inductionOn s List.length_reverse #align cycle.length_reverse Cycle.length_reverse def Subsingleton (s : Cycle α) : Prop := s.length ≤ 1 #align cycle.subsingleton Cycle.Subsingleton theorem subsingleton_nil : Subsingleton (@nil α) := Nat.zero_le _ #align cycle.subsingleton_nil Cycle.subsingleton_nil theorem length_subsingleton_iff {s : Cycle α} : Subsingleton s ↔ length s ≤ 1 := Iff.rfl #align cycle.length_subsingleton_iff Cycle.length_subsingleton_iff @[simp] theorem subsingleton_reverse_iff {s : Cycle α} : s.reverse.Subsingleton ↔ s.Subsingleton := by simp [length_subsingleton_iff] #align cycle.subsingleton_reverse_iff Cycle.subsingleton_reverse_iff
Mathlib/Data/List/Cycle.lean
605
610
theorem Subsingleton.congr {s : Cycle α} (h : Subsingleton s) : ∀ ⦃x⦄ (_hx : x ∈ s) ⦃y⦄ (_hy : y ∈ s), x = y := by
induction' s using Quot.inductionOn with l simp only [length_subsingleton_iff, length_coe, mk_eq_coe, le_iff_lt_or_eq, Nat.lt_add_one_iff, length_eq_zero, length_eq_one, Nat.not_lt_zero, false_or_iff] at h rcases h with (rfl | ⟨z, rfl⟩) <;> simp
[ " (a :: l).rotate 1 = l ++ [a]", " C (Quotient.mk'' l)", " C (Quotient.mk'' [])", " ∀ (head : α) (tail : List α), C (Quotient.mk'' tail) → C (Quotient.mk'' (head :: tail))", " ∀ (head : α) (tail : List α), C ↑tail → C ↑(head :: tail)", " (reverse (Quot.mk Setoid.r x✝)).reverse = Quot.mk Setoid.r x✝", " ...
[ " (a :: l).rotate 1 = l ++ [a]", " C (Quotient.mk'' l)", " C (Quotient.mk'' [])", " ∀ (head : α) (tail : List α), C (Quotient.mk'' tail) → C (Quotient.mk'' (head :: tail))", " ∀ (head : α) (tail : List α), C ↑tail → C ↑(head :: tail)", " (reverse (Quot.mk Setoid.r x✝)).reverse = Quot.mk Setoid.r x✝", " ...
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian import Mathlib.RingTheory.ChainOfDivisors import Mathlib.RingTheory.DedekindDomain.Basic import Mathlib.RingTheory.FractionalIdeal.Operations #align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e" variable (R A K : Type*) [CommRing R] [CommRing A] [Field K] open scoped nonZeroDivisors Polynomial section Inverse namespace FractionalIdeal variable {R₁ : Type*} [CommRing R₁] [IsDomain R₁] [Algebra R₁ K] [IsFractionRing R₁ K] variable {I J : FractionalIdeal R₁⁰ K} noncomputable instance : Inv (FractionalIdeal R₁⁰ K) := ⟨fun I => 1 / I⟩ theorem inv_eq : I⁻¹ = 1 / I := rfl #align fractional_ideal.inv_eq FractionalIdeal.inv_eq theorem inv_zero' : (0 : FractionalIdeal R₁⁰ K)⁻¹ = 0 := div_zero #align fractional_ideal.inv_zero' FractionalIdeal.inv_zero' theorem inv_nonzero {J : FractionalIdeal R₁⁰ K} (h : J ≠ 0) : J⁻¹ = ⟨(1 : FractionalIdeal R₁⁰ K) / J, fractional_div_of_nonzero h⟩ := div_nonzero h #align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero theorem coe_inv_of_nonzero {J : FractionalIdeal R₁⁰ K} (h : J ≠ 0) : (↑J⁻¹ : Submodule R₁ K) = IsLocalization.coeSubmodule K ⊤ / (J : Submodule R₁ K) := by simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top] #align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero variable {K} theorem mem_inv_iff (hI : I ≠ 0) {x : K} : x ∈ I⁻¹ ↔ ∀ y ∈ I, x * y ∈ (1 : FractionalIdeal R₁⁰ K) := mem_div_iff_of_nonzero hI #align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff theorem inv_anti_mono (hI : I ≠ 0) (hJ : J ≠ 0) (hIJ : I ≤ J) : J⁻¹ ≤ I⁻¹ := by -- Porting note: in Lean3, introducing `x` would just give `x ∈ J⁻¹ → x ∈ I⁻¹`, but -- in Lean4, it goes all the way down to the subtypes intro x simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI] exact fun h y hy => h y (hIJ hy) #align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono theorem le_self_mul_inv {I : FractionalIdeal R₁⁰ K} (hI : I ≤ (1 : FractionalIdeal R₁⁰ K)) : I ≤ I * I⁻¹ := le_self_mul_one_div hI #align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv variable (K) theorem coe_ideal_le_self_mul_inv (I : Ideal R₁) : (I : FractionalIdeal R₁⁰ K) ≤ I * (I : FractionalIdeal R₁⁰ K)⁻¹ := le_self_mul_inv coeIdeal_le_one #align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv theorem right_inverse_eq (I J : FractionalIdeal R₁⁰ K) (h : I * J = 1) : J = I⁻¹ := by have hI : I ≠ 0 := ne_zero_of_mul_eq_one I J h suffices h' : I * (1 / I) = 1 from congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl apply le_antisymm · apply mul_le.mpr _ intro x hx y hy rw [mul_comm] exact (mem_div_iff_of_nonzero hI).mp hy x hx rw [← h] apply mul_left_mono I apply (le_div_iff_of_nonzero hI).mpr _ intro y hy x hx rw [mul_comm] exact mul_mem_mul hx hy #align fractional_ideal.right_inverse_eq FractionalIdeal.right_inverse_eq theorem mul_inv_cancel_iff {I : FractionalIdeal R₁⁰ K} : I * I⁻¹ = 1 ↔ ∃ J, I * J = 1 := ⟨fun h => ⟨I⁻¹, h⟩, fun ⟨J, hJ⟩ => by rwa [← right_inverse_eq K I J hJ]⟩ #align fractional_ideal.mul_inv_cancel_iff FractionalIdeal.mul_inv_cancel_iff theorem mul_inv_cancel_iff_isUnit {I : FractionalIdeal R₁⁰ K} : I * I⁻¹ = 1 ↔ IsUnit I := (mul_inv_cancel_iff K).trans isUnit_iff_exists_inv.symm #align fractional_ideal.mul_inv_cancel_iff_is_unit FractionalIdeal.mul_inv_cancel_iff_isUnit variable {K' : Type*} [Field K'] [Algebra R₁ K'] [IsFractionRing R₁ K'] @[simp] theorem map_inv (I : FractionalIdeal R₁⁰ K) (h : K ≃ₐ[R₁] K') : I⁻¹.map (h : K →ₐ[R₁] K') = (I.map h)⁻¹ := by rw [inv_eq, map_div, map_one, inv_eq] #align fractional_ideal.map_inv FractionalIdeal.map_inv open Submodule Submodule.IsPrincipal @[simp] theorem spanSingleton_inv (x : K) : (spanSingleton R₁⁰ x)⁻¹ = spanSingleton _ x⁻¹ := one_div_spanSingleton x #align fractional_ideal.span_singleton_inv FractionalIdeal.spanSingleton_inv -- @[simp] -- Porting note: not in simpNF form theorem spanSingleton_div_spanSingleton (x y : K) : spanSingleton R₁⁰ x / spanSingleton R₁⁰ y = spanSingleton R₁⁰ (x / y) := by rw [div_spanSingleton, mul_comm, spanSingleton_mul_spanSingleton, div_eq_mul_inv] #align fractional_ideal.span_singleton_div_span_singleton FractionalIdeal.spanSingleton_div_spanSingleton
Mathlib/RingTheory/DedekindDomain/Ideal.lean
153
155
theorem spanSingleton_div_self {x : K} (hx : x ≠ 0) : spanSingleton R₁⁰ x / spanSingleton R₁⁰ x = 1 := by
rw [spanSingleton_div_spanSingleton, div_self hx, spanSingleton_one]
[ " ↑J⁻¹ = IsLocalization.coeSubmodule K ⊤ / ↑J", " J⁻¹ ≤ I⁻¹", " x ∈ (fun a => ↑a) J⁻¹ → x ∈ (fun a => ↑a) I⁻¹", " (∀ y ∈ J, x * y ∈ 1) → ∀ y ∈ I, x * y ∈ 1", " J = I⁻¹", " I * (1 / I) = 1", " I * (1 / I) ≤ 1", " ∀ i ∈ I, ∀ j ∈ 1 / I, i * j ∈ 1", " x * y ∈ 1", " y * x ∈ 1", " 1 ≤ I * (1 / I)", ...
[ " ↑J⁻¹ = IsLocalization.coeSubmodule K ⊤ / ↑J", " J⁻¹ ≤ I⁻¹", " x ∈ (fun a => ↑a) J⁻¹ → x ∈ (fun a => ↑a) I⁻¹", " (∀ y ∈ J, x * y ∈ 1) → ∀ y ∈ I, x * y ∈ 1", " J = I⁻¹", " I * (1 / I) = 1", " I * (1 / I) ≤ 1", " ∀ i ∈ I, ∀ j ∈ 1 / I, i * j ∈ 1", " x * y ∈ 1", " y * x ∈ 1", " 1 ≤ I * (1 / I)", ...
import Mathlib.Data.Nat.Prime import Mathlib.Tactic.NormNum.Basic #align_import data.nat.prime_norm_num from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" open Nat Qq Lean Meta namespace Mathlib.Meta.NormNum theorem not_prime_mul_of_ble (a b n : ℕ) (h : a * b = n) (h₁ : a.ble 1 = false) (h₂ : b.ble 1 = false) : ¬ n.Prime := not_prime_mul' h (ble_eq_false.mp h₁).ne' (ble_eq_false.mp h₂).ne' def deriveNotPrime (n d : ℕ) (en : Q(ℕ)) : Q(¬ Nat.Prime $en) := Id.run <| do let d' : ℕ := n / d let prf : Q($d * $d' = $en) := (q(Eq.refl $en) : Expr) let r : Q(Nat.ble $d 1 = false) := (q(Eq.refl false) : Expr) let r' : Q(Nat.ble $d' 1 = false) := (q(Eq.refl false) : Expr) return q(not_prime_mul_of_ble _ _ _ $prf $r $r') def MinFacHelper (n k : ℕ) : Prop := 2 < k ∧ k % 2 = 1 ∧ k ≤ minFac n theorem MinFacHelper.one_lt {n k : ℕ} (h : MinFacHelper n k) : 1 < n := by have : 2 < minFac n := h.1.trans_le h.2.2 obtain rfl | h := n.eq_zero_or_pos · contradiction rcases (succ_le_of_lt h).eq_or_lt with rfl|h · simp_all exact h theorem minFacHelper_0 (n : ℕ) (h1 : Nat.ble (nat_lit 2) n = true) (h2 : nat_lit 1 = n % (nat_lit 2)) : MinFacHelper n (nat_lit 3) := by refine ⟨by norm_num, by norm_num, ?_⟩ refine (le_minFac'.mpr λ p hp hpn ↦ ?_).resolve_left (Nat.ne_of_gt (Nat.le_of_ble_eq_true h1)) rcases hp.eq_or_lt with rfl|h · simp [(Nat.dvd_iff_mod_eq_zero ..).1 hpn] at h2 · exact h
Mathlib/Tactic/NormNum/Prime.lean
67
82
theorem minFacHelper_1 {n k k' : ℕ} (e : k + 2 = k') (h : MinFacHelper n k) (np : minFac n ≠ k) : MinFacHelper n k' := by
rw [← e] refine ⟨Nat.lt_add_right _ h.1, ?_, ?_⟩ · rw [add_mod, mod_self, add_zero, mod_mod] exact h.2.1 rcases h.2.2.eq_or_lt with rfl|h2 · exact (np rfl).elim rcases (succ_le_of_lt h2).eq_or_lt with h2|h2 · refine ((h.1.trans_le h.2.2).ne ?_).elim have h3 : 2 ∣ minFac n := by rw [Nat.dvd_iff_mod_eq_zero, ← h2, succ_eq_add_one, add_mod, h.2.1] rw [dvd_prime <| minFac_prime h.one_lt.ne'] at h3 norm_num at h3 exact h3 exact h2
[ " 1 < n", " 1 < 0", " 1 < succ 0", " MinFacHelper n 3", " 2 < 3", " 3 % 2 = 1", " 3 ≤ n.minFac", " 3 ≤ p", " 3 ≤ 2", " MinFacHelper n k'", " MinFacHelper n (k + 2)", " (k + 2) % 2 = 1", " k % 2 = 1", " k + 2 ≤ n.minFac", " n.minFac + 2 ≤ n.minFac", " 2 = n.minFac", " 2 ∣ n.minFac" ]
[ " 1 < n", " 1 < 0", " 1 < succ 0", " MinFacHelper n 3", " 2 < 3", " 3 % 2 = 1", " 3 ≤ n.minFac", " 3 ≤ p", " 3 ≤ 2", " MinFacHelper n k'" ]
import Mathlib.Combinatorics.Quiver.Basic import Mathlib.Combinatorics.Quiver.Path #align_import combinatorics.quiver.cast from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e" universe v v₁ v₂ u u₁ u₂ variable {U : Type*} [Quiver.{u + 1} U] namespace Quiver def Hom.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : u' ⟶ v' := Eq.ndrec (motive := (· ⟶ v')) (Eq.ndrec e hv) hu #align quiver.hom.cast Quiver.Hom.cast theorem Hom.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : e.cast hu hv = _root_.cast (by {rw [hu, hv]}) e := by subst_vars rfl #align quiver.hom.cast_eq_cast Quiver.Hom.cast_eq_cast @[simp] theorem Hom.cast_rfl_rfl {u v : U} (e : u ⟶ v) : e.cast rfl rfl = e := rfl #align quiver.hom.cast_rfl_rfl Quiver.Hom.cast_rfl_rfl @[simp] theorem Hom.cast_cast {u v u' v' u'' v'' : U} (e : u ⟶ v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (e.cast hu hv).cast hu' hv' = e.cast (hu.trans hu') (hv.trans hv') := by subst_vars rfl #align quiver.hom.cast_cast Quiver.Hom.cast_cast
Mathlib/Combinatorics/Quiver/Cast.lean
57
60
theorem Hom.cast_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : HEq (e.cast hu hv) e := by
subst_vars rfl
[ " (u ⟶ v) = (u' ⟶ v')", " cast hu hv e = _root_.cast ⋯ e", " cast ⋯ ⋯ e = _root_.cast ⋯ e", " cast hu' hv' (cast hu hv e) = cast ⋯ ⋯ e", " cast ⋯ ⋯ (cast ⋯ ⋯ e) = cast ⋯ ⋯ e", " HEq (cast hu hv e) e", " HEq (cast ⋯ ⋯ e) e" ]
[ " (u ⟶ v) = (u' ⟶ v')", " cast hu hv e = _root_.cast ⋯ e", " cast ⋯ ⋯ e = _root_.cast ⋯ e", " cast hu' hv' (cast hu hv e) = cast ⋯ ⋯ e", " cast ⋯ ⋯ (cast ⋯ ⋯ e) = cast ⋯ ⋯ e", " HEq (cast hu hv e) e" ]
import Mathlib.Geometry.Manifold.Diffeomorph import Mathlib.Geometry.Manifold.Instances.Real import Mathlib.Geometry.Manifold.PartitionOfUnity #align_import geometry.manifold.whitney_embedding from "leanprover-community/mathlib"@"86c29aefdba50b3f33e86e52e3b2f51a0d8f0282" universe uι uE uH uM variable {ι : Type uι} {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {H : Type uH} [TopologicalSpace H] {I : ModelWithCorners ℝ E H} {M : Type uM} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] open Function Filter FiniteDimensional Set open scoped Topology Manifold Classical Filter noncomputable section namespace SmoothBumpCovering variable [T2Space M] [hi : Fintype ι] {s : Set M} (f : SmoothBumpCovering ι I M s) def embeddingPiTangent : C^∞⟮I, M; 𝓘(ℝ, ι → E × ℝ), ι → E × ℝ⟯ where val x i := (f i x • extChartAt I (f.c i) x, f i x) property := contMDiff_pi_space.2 fun i => ((f i).smooth_smul contMDiffOn_extChartAt).prod_mk_space (f i).smooth #align smooth_bump_covering.embedding_pi_tangent SmoothBumpCovering.embeddingPiTangent @[local simp] theorem embeddingPiTangent_coe : ⇑f.embeddingPiTangent = fun x i => (f i x • extChartAt I (f.c i) x, f i x) := rfl #align smooth_bump_covering.embedding_pi_tangent_coe SmoothBumpCovering.embeddingPiTangent_coe theorem embeddingPiTangent_injOn : InjOn f.embeddingPiTangent s := by intro x hx y _ h simp only [embeddingPiTangent_coe, funext_iff] at h obtain ⟨h₁, h₂⟩ := Prod.mk.inj_iff.1 (h (f.ind x hx)) rw [f.apply_ind x hx] at h₂ rw [← h₂, f.apply_ind x hx, one_smul, one_smul] at h₁ have := f.mem_extChartAt_source_of_eq_one h₂.symm exact (extChartAt I (f.c _)).injOn (f.mem_extChartAt_ind_source x hx) this h₁ #align smooth_bump_covering.embedding_pi_tangent_inj_on SmoothBumpCovering.embeddingPiTangent_injOn theorem embeddingPiTangent_injective (f : SmoothBumpCovering ι I M) : Injective f.embeddingPiTangent := injective_iff_injOn_univ.2 f.embeddingPiTangent_injOn #align smooth_bump_covering.embedding_pi_tangent_injective SmoothBumpCovering.embeddingPiTangent_injective theorem comp_embeddingPiTangent_mfderiv (x : M) (hx : x ∈ s) : ((ContinuousLinearMap.fst ℝ E ℝ).comp (@ContinuousLinearMap.proj ℝ _ ι (fun _ => E × ℝ) _ _ (fun _ => inferInstance) (f.ind x hx))).comp (mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) = mfderiv I I (chartAt H (f.c (f.ind x hx))) x := by set L := (ContinuousLinearMap.fst ℝ E ℝ).comp (@ContinuousLinearMap.proj ℝ _ ι (fun _ => E × ℝ) _ _ (fun _ => inferInstance) (f.ind x hx)) have := L.hasMFDerivAt.comp x f.embeddingPiTangent.smooth.mdifferentiableAt.hasMFDerivAt convert hasMFDerivAt_unique this _ refine (hasMFDerivAt_extChartAt I (f.mem_chartAt_ind_source x hx)).congr_of_eventuallyEq ?_ refine (f.eventuallyEq_one x hx).mono fun y hy => ?_ simp only [L, embeddingPiTangent_coe, ContinuousLinearMap.coe_comp', (· ∘ ·), ContinuousLinearMap.coe_fst', ContinuousLinearMap.proj_apply] rw [hy, Pi.one_apply, one_smul] #align smooth_bump_covering.comp_embedding_pi_tangent_mfderiv SmoothBumpCovering.comp_embeddingPiTangent_mfderiv theorem embeddingPiTangent_ker_mfderiv (x : M) (hx : x ∈ s) : LinearMap.ker (mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) = ⊥ := by apply bot_unique rw [← (mdifferentiable_chart I (f.c (f.ind x hx))).ker_mfderiv_eq_bot (f.mem_chartAt_ind_source x hx), ← comp_embeddingPiTangent_mfderiv] exact LinearMap.ker_le_ker_comp _ _ #align smooth_bump_covering.embedding_pi_tangent_ker_mfderiv SmoothBumpCovering.embeddingPiTangent_ker_mfderiv theorem embeddingPiTangent_injective_mfderiv (x : M) (hx : x ∈ s) : Injective (mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) := LinearMap.ker_eq_bot.1 (f.embeddingPiTangent_ker_mfderiv x hx) #align smooth_bump_covering.embedding_pi_tangent_injective_mfderiv SmoothBumpCovering.embeddingPiTangent_injective_mfderiv
Mathlib/Geometry/Manifold/WhitneyEmbedding.lean
118
133
theorem exists_immersion_euclidean [Finite ι] (f : SmoothBumpCovering ι I M) : ∃ (n : ℕ) (e : M → EuclideanSpace ℝ (Fin n)), Smooth I (𝓡 n) e ∧ Injective e ∧ ∀ x : M, Injective (mfderiv I (𝓡 n) e x) := by
cases nonempty_fintype ι set F := EuclideanSpace ℝ (Fin <| finrank ℝ (ι → E × ℝ)) letI : IsNoetherian ℝ (E × ℝ) := IsNoetherian.iff_fg.2 inferInstance letI : FiniteDimensional ℝ (ι → E × ℝ) := IsNoetherian.iff_fg.1 inferInstance set eEF : (ι → E × ℝ) ≃L[ℝ] F := ContinuousLinearEquiv.ofFinrankEq finrank_euclideanSpace_fin.symm refine ⟨_, eEF ∘ f.embeddingPiTangent, eEF.toDiffeomorph.smooth.comp f.embeddingPiTangent.smooth, eEF.injective.comp f.embeddingPiTangent_injective, fun x => ?_⟩ rw [mfderiv_comp _ eEF.differentiableAt.mdifferentiableAt f.embeddingPiTangent.smooth.mdifferentiableAt, eEF.mfderiv_eq] exact eEF.injective.comp (f.embeddingPiTangent_injective_mfderiv _ trivial)
[ " InjOn (⇑f.embeddingPiTangent) s", " x = y", " ((ContinuousLinearMap.fst ℝ E ℝ).comp (ContinuousLinearMap.proj (f.ind x hx))).comp\n (mfderiv I 𝓘(ℝ, ι → E × ℝ) (⇑f.embeddingPiTangent) x) =\n mfderiv I I (↑(chartAt H (f.c (f.ind x hx)))) x", " L.comp (mfderiv I 𝓘(ℝ, ι → E × ℝ) (⇑f.embeddingPiTangent...
[ " InjOn (⇑f.embeddingPiTangent) s", " x = y", " ((ContinuousLinearMap.fst ℝ E ℝ).comp (ContinuousLinearMap.proj (f.ind x hx))).comp\n (mfderiv I 𝓘(ℝ, ι → E × ℝ) (⇑f.embeddingPiTangent) x) =\n mfderiv I I (↑(chartAt H (f.c (f.ind x hx)))) x", " L.comp (mfderiv I 𝓘(ℝ, ι → E × ℝ) (⇑f.embeddingPiTangent...
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.Set.Basic import Mathlib.Data.Setoid.Basic import Mathlib.GroupTheory.Coset #align_import group_theory.double_coset from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" -- Porting note: removed import -- import Mathlib.Tactic.Group variable {G : Type*} [Group G] {α : Type*} [Mul α] (J : Subgroup G) (g : G) open MulOpposite open scoped Pointwise namespace Doset def doset (a : α) (s t : Set α) : Set α := s * {a} * t #align doset Doset.doset lemma doset_eq_image2 (a : α) (s t : Set α) : doset a s t = Set.image2 (· * a * ·) s t := by simp_rw [doset, Set.mul_singleton, ← Set.image2_mul, Set.image2_image_left]
Mathlib/GroupTheory/DoubleCoset.lean
44
45
theorem mem_doset {s t : Set α} {a b : α} : b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y := by
simp only [doset_eq_image2, Set.mem_image2, eq_comm]
[ " doset a s t = Set.image2 (fun x x_1 => x * a * x_1) s t", " b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y" ]
[ " doset a s t = Set.image2 (fun x x_1 => x * a * x_1) s t", " b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y" ]
import Mathlib.Algebra.GroupWithZero.Commute import Mathlib.Algebra.Ring.Commute #align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441" variable {α β : Type*} namespace Nat section Commute variable [NonAssocSemiring α]
Mathlib/Data/Nat/Cast/Commute.lean
24
27
theorem cast_commute (n : ℕ) (x : α) : Commute (n : α) x := by
induction n with | zero => rw [Nat.cast_zero]; exact Commute.zero_left x | succ n ihn => rw [Nat.cast_succ]; exact ihn.add_left (Commute.one_left x)
[ " Commute (↑n) x", " Commute (↑0) x", " Commute 0 x", " Commute (↑(n + 1)) x", " Commute (↑n + 1) x" ]
[ " Commute (↑n) x" ]
import Mathlib.RingTheory.IntegrallyClosed import Mathlib.RingTheory.Trace import Mathlib.RingTheory.Norm #align_import ring_theory.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" universe u v w z open scoped Matrix open Matrix FiniteDimensional Fintype Polynomial Finset IntermediateField namespace Algebra variable (A : Type u) {B : Type v} (C : Type z) {ι : Type w} [DecidableEq ι] variable [CommRing A] [CommRing B] [Algebra A B] [CommRing C] [Algebra A C] section Discr -- Porting note: using `[DecidableEq ι]` instead of `by classical...` did not work in -- mathlib3. noncomputable def discr (A : Type u) {B : Type v} [CommRing A] [CommRing B] [Algebra A B] [Fintype ι] (b : ι → B) := (traceMatrix A b).det #align algebra.discr Algebra.discr theorem discr_def [Fintype ι] (b : ι → B) : discr A b = (traceMatrix A b).det := rfl variable {A C} in theorem discr_eq_discr_of_algEquiv [Fintype ι] (b : ι → B) (f : B ≃ₐ[A] C) : Algebra.discr A b = Algebra.discr A (f ∘ b) := by rw [discr_def]; congr; ext simp_rw [traceMatrix_apply, traceForm_apply, Function.comp, ← map_mul f, trace_eq_of_algEquiv] #align algebra.discr_def Algebra.discr_def variable {ι' : Type*} [Fintype ι'] [Fintype ι] [DecidableEq ι'] section Field variable (K : Type u) {L : Type v} (E : Type z) [Field K] [Field L] [Field E] variable [Algebra K L] [Algebra K E] variable [Module.Finite K L] [IsAlgClosed E] theorem discr_not_zero_of_basis [IsSeparable K L] (b : Basis ι K L) : discr K b ≠ 0 := by rw [discr_def, traceMatrix_of_basis, ← LinearMap.BilinForm.nondegenerate_iff_det_ne_zero] exact traceForm_nondegenerate _ _ #align algebra.discr_not_zero_of_basis Algebra.discr_not_zero_of_basis theorem discr_isUnit_of_basis [IsSeparable K L] (b : Basis ι K L) : IsUnit (discr K b) := IsUnit.mk0 _ (discr_not_zero_of_basis _ _) #align algebra.discr_is_unit_of_basis Algebra.discr_isUnit_of_basis variable (b : ι → L) (pb : PowerBasis K L)
Mathlib/RingTheory/Discriminant.lean
154
157
theorem discr_eq_det_embeddingsMatrixReindex_pow_two [IsSeparable K L] (e : ι ≃ (L →ₐ[K] E)) : algebraMap K E (discr K b) = (embeddingsMatrixReindex K E b e).det ^ 2 := by
rw [discr_def, RingHom.map_det, RingHom.mapMatrix_apply, traceMatrix_eq_embeddingsMatrixReindex_mul_trans, det_mul, det_transpose, pow_two]
[ " discr A b = discr A (⇑f ∘ b)", " (traceMatrix A b).det = discr A (⇑f ∘ b)", " traceMatrix A b = traceMatrix A (⇑f ∘ b)", " traceMatrix A b i✝ j✝ = traceMatrix A (⇑f ∘ b) i✝ j✝", " discr K ⇑b ≠ 0", " (traceForm K L).Nondegenerate", " (algebraMap K E) (discr K b) = (embeddingsMatrixReindex K E b e).det ...
[ " discr A b = discr A (⇑f ∘ b)", " (traceMatrix A b).det = discr A (⇑f ∘ b)", " traceMatrix A b = traceMatrix A (⇑f ∘ b)", " traceMatrix A b i✝ j✝ = traceMatrix A (⇑f ∘ b) i✝ j✝", " discr K ⇑b ≠ 0", " (traceForm K L).Nondegenerate", " (algebraMap K E) (discr K b) = (embeddingsMatrixReindex K E b e).det ...
import Mathlib.ModelTheory.Quotients import Mathlib.Order.Filter.Germ import Mathlib.Order.Filter.Ultrafilter #align_import model_theory.ultraproducts from "leanprover-community/mathlib"@"f1ae620609496a37534c2ab3640b641d5be8b6f0" universe u v variable {α : Type*} (M : α → Type*) (u : Ultrafilter α) open FirstOrder Filter open Filter namespace FirstOrder namespace Language open Structure variable {L : Language.{u, v}} [∀ a, L.Structure (M a)] namespace Ultraproduct instance setoidPrestructure : L.Prestructure ((u : Filter α).productSetoid M) := { (u : Filter α).productSetoid M with toStructure := { funMap := fun {n} f x a => funMap f fun i => x i a RelMap := fun {n} r x => ∀ᶠ a : α in u, RelMap r fun i => x i a } fun_equiv := fun {n} f x y xy => by refine mem_of_superset (iInter_mem.2 xy) fun a ha => ?_ simp only [Set.mem_iInter, Set.mem_setOf_eq] at ha simp only [Set.mem_setOf_eq, ha] rel_equiv := fun {n} r x y xy => by rw [← iff_eq_eq] refine ⟨fun hx => ?_, fun hy => ?_⟩ · refine mem_of_superset (inter_mem hx (iInter_mem.2 xy)) ?_ rintro a ⟨ha1, ha2⟩ simp only [Set.mem_iInter, Set.mem_setOf_eq] at * rw [← funext ha2] exact ha1 · refine mem_of_superset (inter_mem hy (iInter_mem.2 xy)) ?_ rintro a ⟨ha1, ha2⟩ simp only [Set.mem_iInter, Set.mem_setOf_eq] at * rw [funext ha2] exact ha1 } #align first_order.language.ultraproduct.setoid_prestructure FirstOrder.Language.Ultraproduct.setoidPrestructure variable {M} {u} instance «structure» : L.Structure ((u : Filter α).Product M) := Language.quotientStructure set_option linter.uppercaseLean3 false in #align first_order.language.ultraproduct.Structure FirstOrder.Language.Ultraproduct.structure theorem funMap_cast {n : ℕ} (f : L.Functions n) (x : Fin n → ∀ a, M a) : (funMap f fun i => (x i : (u : Filter α).Product M)) = (fun a => funMap f fun i => x i a : (u : Filter α).Product M) := by apply funMap_quotient_mk' #align first_order.language.ultraproduct.fun_map_cast FirstOrder.Language.Ultraproduct.funMap_cast
Mathlib/ModelTheory/Ultraproducts.lean
83
91
theorem term_realize_cast {β : Type*} (x : β → ∀ a, M a) (t : L.Term β) : (t.realize fun i => (x i : (u : Filter α).Product M)) = (fun a => t.realize fun i => x i a : (u : Filter α).Product M) := by
convert @Term.realize_quotient_mk' L _ ((u : Filter α).productSetoid M) (Ultraproduct.setoidPrestructure M u) _ t x using 2 ext a induction t with | var => rfl | func _ _ t_ih => simp only [Term.realize, t_ih]; rfl
[ " funMap f x ≈ funMap f y", " a ∈ {x_1 | (fun a => funMap f x a = funMap f y a) x_1}", " RelMap r x = RelMap r y", " RelMap r x ↔ RelMap r y", " RelMap r y", " {x_1 | (fun a => RelMap r fun i => x i a) x_1} ∩ ⋂ i, {x_1 | (fun a => x i a = y i a) x_1} ⊆\n {x | (fun a => RelMap r fun i => y i a) x}", "...
[ " funMap f x ≈ funMap f y", " a ∈ {x_1 | (fun a => funMap f x a = funMap f y a) x_1}", " RelMap r x = RelMap r y", " RelMap r x ↔ RelMap r y", " RelMap r y", " {x_1 | (fun a => RelMap r fun i => x i a) x_1} ∩ ⋂ i, {x_1 | (fun a => x i a = y i a) x_1} ⊆\n {x | (fun a => RelMap r fun i => y i a) x}", "...
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Order.Interval.Set.IsoIoo import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.UrysohnsBounded #align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" section TietzeExtensionClass universe u u₁ u₂ v w -- TODO: define *absolute retracts* and then prove they satisfy Tietze extension. -- Then make instances of that instead and remove this class. class TietzeExtension (Y : Type v) [TopologicalSpace Y] : Prop where exists_restrict_eq' {X : Type u} [TopologicalSpace X] [NormalSpace X] (s : Set X) (hs : IsClosed s) (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f variable {X₁ : Type u₁} [TopologicalSpace X₁] variable {X : Type u} [TopologicalSpace X] [NormalSpace X] {s : Set X} (hs : IsClosed s) variable {e : X₁ → X} (he : ClosedEmbedding e) variable {Y : Type v} [TopologicalSpace Y] [TietzeExtension.{u, v} Y] theorem ContinuousMap.exists_restrict_eq (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f := TietzeExtension.exists_restrict_eq' s hs f #align continuous_map.exists_restrict_eq_of_closed ContinuousMap.exists_restrict_eq theorem ContinuousMap.exists_extension (f : C(X₁, Y)) : ∃ (g : C(X, Y)), g.comp ⟨e, he.continuous⟩ = f := by let e' : X₁ ≃ₜ Set.range e := Homeomorph.ofEmbedding _ he.toEmbedding obtain ⟨g, hg⟩ := (f.comp e'.symm).exists_restrict_eq he.isClosed_range exact ⟨g, by ext x; simpa using congr($(hg) ⟨e' x, x, rfl⟩)⟩ theorem ContinuousMap.exists_extension' (f : C(X₁, Y)) : ∃ (g : C(X, Y)), g ∘ e = f := f.exists_extension he |>.imp fun g hg ↦ by ext x; congrm($(hg) x) #align continuous_map.exists_extension_of_closed_embedding ContinuousMap.exists_extension'
Mathlib/Topology/TietzeExtension.lean
96
100
theorem ContinuousMap.exists_forall_mem_restrict_eq {Y : Type v} [TopologicalSpace Y] (f : C(s, Y)) {t : Set Y} (hf : ∀ x, f x ∈ t) [ht : TietzeExtension.{u, v} t] : ∃ (g : C(X, Y)), (∀ x, g x ∈ t) ∧ g.restrict s = f := by
obtain ⟨g, hg⟩ := mk _ (map_continuous f |>.codRestrict hf) |>.exists_restrict_eq hs exact ⟨comp ⟨Subtype.val, by continuity⟩ g, by simp, by ext x; congrm(($(hg) x : Y))⟩
[ " ∃ g, g.comp { toFun := e, continuous_toFun := ⋯ } = f", " g.comp { toFun := e, continuous_toFun := ⋯ } = f", " (g.comp { toFun := e, continuous_toFun := ⋯ }) x = f x", " ⇑g ∘ e = ⇑f", " (⇑g ∘ e) x = f x", " ∃ g, (∀ (x : X), g x ∈ t) ∧ restrict s g = f", " Continuous Subtype.val", " ∀ (x : X), ({ toF...
[ " ∃ g, g.comp { toFun := e, continuous_toFun := ⋯ } = f", " g.comp { toFun := e, continuous_toFun := ⋯ } = f", " (g.comp { toFun := e, continuous_toFun := ⋯ }) x = f x", " ⇑g ∘ e = ⇑f", " (⇑g ∘ e) x = f x", " ∃ g, (∀ (x : X), g x ∈ t) ∧ restrict s g = f" ]
import Mathlib.Data.Rat.Cast.Defs import Mathlib.Algebra.Field.Basic #align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441" namespace Rat variable {α : Type*} [DivisionRing α] -- Porting note: rewrote proof @[simp] theorem cast_inv_nat (n : ℕ) : ((n⁻¹ : ℚ) : α) = (n : α)⁻¹ := by cases' n with n · simp rw [cast_def, inv_natCast_num, inv_natCast_den, if_neg n.succ_ne_zero, Int.sign_eq_one_of_pos (Nat.cast_pos.mpr n.succ_pos), Int.cast_one, one_div] #align rat.cast_inv_nat Rat.cast_inv_nat -- Porting note: proof got a lot easier - is this still the intended statement? @[simp] theorem cast_inv_int (n : ℤ) : ((n⁻¹ : ℚ) : α) = (n : α)⁻¹ := by cases' n with n n · simp [ofInt_eq_cast, cast_inv_nat] · simp only [ofInt_eq_cast, Int.cast_negSucc, ← Nat.cast_succ, cast_neg, inv_neg, cast_inv_nat] #align rat.cast_inv_int Rat.cast_inv_int @[simp, norm_cast]
Mathlib/Data/Rat/Cast/Lemmas.lean
44
51
theorem cast_nnratCast {K} [DivisionRing K] (q : ℚ≥0) : ((q : ℚ) : K) = (q : K) := by
rw [Rat.cast_def, NNRat.cast_def, NNRat.cast_def] have hn := @num_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den on_goal 1 => have hd := @den_div_eq_of_coprime q.num q.den ?hdp q.coprime_num_den case hdp => simpa only [Nat.cast_pos] using q.den_pos simp only [Int.cast_natCast, Nat.cast_inj] at hn hd rw [hn, hd, Int.cast_natCast]
[ " ↑(↑n)⁻¹ = (↑n)⁻¹", " ↑(↑0)⁻¹ = (↑0)⁻¹", " ↑(↑(n + 1))⁻¹ = (↑(n + 1))⁻¹", " ↑(↑(Int.ofNat n))⁻¹ = (↑(Int.ofNat n))⁻¹", " ↑(↑(Int.negSucc n))⁻¹ = (↑(Int.negSucc n))⁻¹", " ↑↑q = ↑q", " ↑(↑q.num / ↑q.den).num / ↑(↑q.num / ↑q.den).den = ↑q.num / ↑q.den", " 0 < ↑q.den" ]
[ " ↑(↑n)⁻¹ = (↑n)⁻¹", " ↑(↑0)⁻¹ = (↑0)⁻¹", " ↑(↑(n + 1))⁻¹ = (↑(n + 1))⁻¹", " ↑(↑(Int.ofNat n))⁻¹ = (↑(Int.ofNat n))⁻¹", " ↑(↑(Int.negSucc n))⁻¹ = (↑(Int.negSucc n))⁻¹", " ↑↑q = ↑q" ]
import Mathlib.RingTheory.PrincipalIdealDomain #align_import ring_theory.ideal.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" variable {R : Type*} [CommRing R] namespace Ideal open Submodule variable (R) in def isPrincipalSubmonoid : Submonoid (Ideal R) where carrier := {I | IsPrincipal I} mul_mem' := by rintro _ _ ⟨x, rfl⟩ ⟨y, rfl⟩ exact ⟨x * y, Ideal.span_singleton_mul_span_singleton x y⟩ one_mem' := ⟨1, one_eq_span⟩ theorem mem_isPrincipalSubmonoid_iff {I : Ideal R} : I ∈ isPrincipalSubmonoid R ↔ IsPrincipal I := Iff.rfl theorem span_singleton_mem_isPrincipalSubmonoid (a : R) : span {a} ∈ isPrincipalSubmonoid R := mem_isPrincipalSubmonoid_iff.mpr ⟨a, rfl⟩ variable [IsDomain R] variable (R) in noncomputable def associatesEquivIsPrincipal : Associates R ≃ {I : Ideal R // IsPrincipal I} where toFun := Quotient.lift (fun x ↦ ⟨span {x}, x, rfl⟩) (fun _ _ _ ↦ by simpa [span_singleton_eq_span_singleton]) invFun I := Associates.mk I.2.generator left_inv := Quotient.ind fun _ ↦ by simpa using Ideal.span_singleton_eq_span_singleton.mp (@Ideal.span_singleton_generator _ _ _ ⟨_, rfl⟩) right_inv I := by simp only [Quotient.lift_mk, span_singleton_generator, Subtype.coe_eta] @[simp] theorem associatesEquivIsPrincipal_apply (x : R) : associatesEquivIsPrincipal R (Associates.mk x) = span {x} := rfl @[simp] theorem associatesEquivIsPrincipal_symm_apply {I : Ideal R} (hI : IsPrincipal I) : (associatesEquivIsPrincipal R).symm ⟨I, hI⟩ = Associates.mk hI.generator := rfl
Mathlib/RingTheory/Ideal/IsPrincipal.lean
67
72
theorem associatesEquivIsPrincipal_mul (x y : Associates R) : (associatesEquivIsPrincipal R (x * y) : Ideal R) = (associatesEquivIsPrincipal R x) * (associatesEquivIsPrincipal R y) := by
rw [← Associates.quot_out x, ← Associates.quot_out y] simp_rw [Associates.mk_mul_mk, ← Associates.quotient_mk_eq_mk, associatesEquivIsPrincipal_apply, span_singleton_mul_span_singleton]
[ " ∀ {a b : Ideal R}, a ∈ {I | IsPrincipal I} → b ∈ {I | IsPrincipal I} → a * b ∈ {I | IsPrincipal I}", " Submodule.span R {x} * Submodule.span R {y} ∈ {I | IsPrincipal I}", " (fun x => ⟨span {x}, ⋯⟩) x✝² = (fun x => ⟨span {x}, ⋯⟩) x✝¹", " (fun I => Associates.mk (IsPrincipal.generator ↑I)) (Quotient.lift (fun...
[ " ∀ {a b : Ideal R}, a ∈ {I | IsPrincipal I} → b ∈ {I | IsPrincipal I} → a * b ∈ {I | IsPrincipal I}", " Submodule.span R {x} * Submodule.span R {y} ∈ {I | IsPrincipal I}", " (fun x => ⟨span {x}, ⋯⟩) x✝² = (fun x => ⟨span {x}, ⋯⟩) x✝¹", " (fun I => Associates.mk (IsPrincipal.generator ↑I)) (Quotient.lift (fun...
import Mathlib.Data.Finsupp.Multiset import Mathlib.Order.Bounded import Mathlib.SetTheory.Cardinal.PartENat import Mathlib.SetTheory.Ordinal.Principal import Mathlib.Tactic.Linarith #align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Set Cardinal Equiv Order Ordinal open scoped Classical universe u v w namespace Cardinal section UsingOrdinals theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩ · rw [← Ordinal.le_zero, ord_le] at h simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h · rw [ord_le] at h ⊢ rwa [← @add_one_of_aleph0_le (card a), ← card_succ] rw [← ord_le, ← le_succ_of_isLimit, ord_le] · exact co.trans h · rw [ord_aleph0] exact omega_isLimit #align cardinal.ord_is_limit Cardinal.ord_isLimit theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α := Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2 section aleph def alephIdx.initialSeg : @InitialSeg Cardinal Ordinal (· < ·) (· < ·) := @RelEmbedding.collapse Cardinal Ordinal (· < ·) (· < ·) _ Cardinal.ord.orderEmbedding.ltEmbedding #align cardinal.aleph_idx.initial_seg Cardinal.alephIdx.initialSeg def alephIdx : Cardinal → Ordinal := alephIdx.initialSeg #align cardinal.aleph_idx Cardinal.alephIdx @[simp] theorem alephIdx.initialSeg_coe : (alephIdx.initialSeg : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.initial_seg_coe Cardinal.alephIdx.initialSeg_coe @[simp] theorem alephIdx_lt {a b} : alephIdx a < alephIdx b ↔ a < b := alephIdx.initialSeg.toRelEmbedding.map_rel_iff #align cardinal.aleph_idx_lt Cardinal.alephIdx_lt @[simp] theorem alephIdx_le {a b} : alephIdx a ≤ alephIdx b ↔ a ≤ b := by rw [← not_lt, ← not_lt, alephIdx_lt] #align cardinal.aleph_idx_le Cardinal.alephIdx_le theorem alephIdx.init {a b} : b < alephIdx a → ∃ c, alephIdx c = b := alephIdx.initialSeg.init #align cardinal.aleph_idx.init Cardinal.alephIdx.init def alephIdx.relIso : @RelIso Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) := @RelIso.ofSurjective Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) alephIdx.initialSeg.{u} <| (InitialSeg.eq_or_principal alephIdx.initialSeg.{u}).resolve_right fun ⟨o, e⟩ => by have : ∀ c, alephIdx c < o := fun c => (e _).2 ⟨_, rfl⟩ refine Ordinal.inductionOn o ?_ this; intro α r _ h let s := ⨆ a, invFun alephIdx (Ordinal.typein r a) apply (lt_succ s).not_le have I : Injective.{u+2, u+2} alephIdx := alephIdx.initialSeg.toEmbedding.injective simpa only [typein_enum, leftInverse_invFun I (succ s)] using le_ciSup (Cardinal.bddAbove_range.{u, u} fun a : α => invFun alephIdx (Ordinal.typein r a)) (Ordinal.enum r _ (h (succ s))) #align cardinal.aleph_idx.rel_iso Cardinal.alephIdx.relIso @[simp] theorem alephIdx.relIso_coe : (alephIdx.relIso : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.rel_iso_coe Cardinal.alephIdx.relIso_coe @[simp] theorem type_cardinal : @type Cardinal (· < ·) _ = Ordinal.univ.{u, u + 1} := by rw [Ordinal.univ_id]; exact Quotient.sound ⟨alephIdx.relIso⟩ #align cardinal.type_cardinal Cardinal.type_cardinal @[simp] theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by simpa only [card_type, card_univ] using congr_arg card type_cardinal #align cardinal.mk_cardinal Cardinal.mk_cardinal def Aleph'.relIso := Cardinal.alephIdx.relIso.symm #align cardinal.aleph'.rel_iso Cardinal.Aleph'.relIso def aleph' : Ordinal → Cardinal := Aleph'.relIso #align cardinal.aleph' Cardinal.aleph' @[simp] theorem aleph'.relIso_coe : (Aleph'.relIso : Ordinal → Cardinal) = aleph' := rfl #align cardinal.aleph'.rel_iso_coe Cardinal.aleph'.relIso_coe @[simp] theorem aleph'_lt {o₁ o₂ : Ordinal} : aleph' o₁ < aleph' o₂ ↔ o₁ < o₂ := Aleph'.relIso.map_rel_iff #align cardinal.aleph'_lt Cardinal.aleph'_lt @[simp] theorem aleph'_le {o₁ o₂ : Ordinal} : aleph' o₁ ≤ aleph' o₂ ↔ o₁ ≤ o₂ := le_iff_le_iff_lt_iff_lt.2 aleph'_lt #align cardinal.aleph'_le Cardinal.aleph'_le @[simp] theorem aleph'_alephIdx (c : Cardinal) : aleph' c.alephIdx = c := Cardinal.alephIdx.relIso.toEquiv.symm_apply_apply c #align cardinal.aleph'_aleph_idx Cardinal.aleph'_alephIdx @[simp] theorem alephIdx_aleph' (o : Ordinal) : (aleph' o).alephIdx = o := Cardinal.alephIdx.relIso.toEquiv.apply_symm_apply o #align cardinal.aleph_idx_aleph' Cardinal.alephIdx_aleph' @[simp]
Mathlib/SetTheory/Cardinal/Ordinal.lean
198
200
theorem aleph'_zero : aleph' 0 = 0 := by
rw [← nonpos_iff_eq_zero, ← aleph'_alephIdx 0, aleph'_le] apply Ordinal.zero_le
[ " c.ord.IsLimit", " ℵ₀ = 0", " c.ord ≤ a", " c ≤ a.card", " ℵ₀ ≤ a.card", " ℵ₀ ≤ (succ a).card", " ℵ₀.ord.IsLimit", " ω.IsLimit", " a.alephIdx ≤ b.alephIdx ↔ a ≤ b", " False", " ∀ (α : Type u) (r : α → α → Prop) [inst : IsWellOrder α r], (∀ (c : Cardinal.{u}), c.alephIdx < type r) → False", " ...
[ " c.ord.IsLimit", " ℵ₀ = 0", " c.ord ≤ a", " c ≤ a.card", " ℵ₀ ≤ a.card", " ℵ₀ ≤ (succ a).card", " ℵ₀.ord.IsLimit", " ω.IsLimit", " a.alephIdx ≤ b.alephIdx ↔ a ≤ b", " False", " ∀ (α : Type u) (r : α → α → Prop) [inst : IsWellOrder α r], (∀ (c : Cardinal.{u}), c.alephIdx < type r) → False", " ...
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp] theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs] #align real.logb_abs Real.logb_abs @[simp] theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by rw [← logb_abs x, ← logb_abs (-x), abs_neg] #align real.logb_neg_eq_logb Real.logb_neg_eq_logb theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by simp_rw [logb, log_mul hx hy, add_div] #align real.logb_mul Real.logb_mul theorem logb_div (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x / y) = logb b x - logb b y := by simp_rw [logb, log_div hx hy, sub_div] #align real.logb_div Real.logb_div @[simp] theorem logb_inv (x : ℝ) : logb b x⁻¹ = -logb b x := by simp [logb, neg_div] #align real.logb_inv Real.logb_inv theorem inv_logb (a b : ℝ) : (logb a b)⁻¹ = logb b a := by simp_rw [logb, inv_div] #align real.inv_logb Real.inv_logb theorem inv_logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a * b) c)⁻¹ = (logb a c)⁻¹ + (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_mul h₁ h₂ #align real.inv_logb_mul_base Real.inv_logb_mul_base theorem inv_logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a / b) c)⁻¹ = (logb a c)⁻¹ - (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_div h₁ h₂ #align real.inv_logb_div_base Real.inv_logb_div_base theorem logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a * b) c = ((logb a c)⁻¹ + (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_mul_base h₁ h₂ c, inv_inv] #align real.logb_mul_base Real.logb_mul_base theorem logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a / b) c = ((logb a c)⁻¹ - (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_div_base h₁ h₂ c, inv_inv] #align real.logb_div_base Real.logb_div_base theorem mul_logb {a b c : ℝ} (h₁ : b ≠ 0) (h₂ : b ≠ 1) (h₃ : b ≠ -1) : logb a b * logb b c = logb a c := by unfold logb rw [mul_comm, div_mul_div_cancel _ (log_ne_zero.mpr ⟨h₁, h₂, h₃⟩)] #align real.mul_logb Real.mul_logb theorem div_logb {a b c : ℝ} (h₁ : c ≠ 0) (h₂ : c ≠ 1) (h₃ : c ≠ -1) : logb a c / logb b c = logb a b := div_div_div_cancel_left' _ _ <| log_ne_zero.mpr ⟨h₁, h₂, h₃⟩ #align real.div_logb Real.div_logb
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
116
117
theorem logb_rpow_eq_mul_logb_of_pos (hx : 0 < x) : logb b (x ^ y) = y * logb b x := by
rw [logb, log_rpow hx, logb, mul_div_assoc]
[ " b.logb 0 = 0", " b.logb 1 = 0", " False", " b.logb |x| = b.logb x", " b.logb (-x) = b.logb x", " b.logb (x * y) = b.logb x + b.logb y", " b.logb (x / y) = b.logb x - b.logb y", " b.logb x⁻¹ = -b.logb x", " (a.logb b)⁻¹ = b.logb a", " ((a * b).logb c)⁻¹ = (a.logb c)⁻¹ + (b.logb c)⁻¹", " c.logb ...
[ " b.logb 0 = 0", " b.logb 1 = 0", " False", " b.logb |x| = b.logb x", " b.logb (-x) = b.logb x", " b.logb (x * y) = b.logb x + b.logb y", " b.logb (x / y) = b.logb x - b.logb y", " b.logb x⁻¹ = -b.logb x", " (a.logb b)⁻¹ = b.logb a", " ((a * b).logb c)⁻¹ = (a.logb c)⁻¹ + (b.logb c)⁻¹", " c.logb ...
import Mathlib.Algebra.CharZero.Lemmas import Mathlib.Algebra.GroupWithZero.Commute import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Ring.Pow import Mathlib.Algebra.Ring.Int #align_import algebra.order.field.power from "leanprover-community/mathlib"@"acb3d204d4ee883eb686f45d486a2a6811a01329" variable {α : Type*} open Function Int section LinearOrderedField variable [LinearOrderedField α] {a b c d : α} {n : ℤ} #noalign zpow_bit0_nonneg #noalign zpow_bit0_pos #noalign zpow_bit0_pos_iff #noalign zpow_bit1_neg_iff #noalign zpow_bit1_nonneg_iff #noalign zpow_bit1_nonpos_iff #noalign zpow_bit1_pos_iff protected theorem Even.zpow_nonneg (hn : Even n) (a : α) : 0 ≤ a ^ n := by obtain ⟨k, rfl⟩ := hn; rw [zpow_add' (by simp [em'])]; exact mul_self_nonneg _ #align even.zpow_nonneg Even.zpow_nonneg lemma zpow_two_nonneg (a : α) : 0 ≤ a ^ (2 : ℤ) := even_two.zpow_nonneg _ #align zpow_two_nonneg zpow_two_nonneg lemma zpow_neg_two_nonneg (a : α) : 0 ≤ a ^ (-2 : ℤ) := even_neg_two.zpow_nonneg _ #align zpow_neg_two_nonneg zpow_neg_two_nonneg protected lemma Even.zpow_pos (hn : Even n) (ha : a ≠ 0) : 0 < a ^ n := (hn.zpow_nonneg _).lt_of_ne' (zpow_ne_zero _ ha) #align even.zpow_pos Even.zpow_pos lemma zpow_two_pos_of_ne_zero (ha : a ≠ 0) : 0 < a ^ (2 : ℤ) := even_two.zpow_pos ha #align zpow_two_pos_of_ne_zero zpow_two_pos_of_ne_zero theorem Even.zpow_pos_iff (hn : Even n) (h : n ≠ 0) : 0 < a ^ n ↔ a ≠ 0 := by obtain ⟨k, rfl⟩ := hn rw [zpow_add' (by simp [em']), mul_self_pos, zpow_ne_zero_iff (by simpa using h)] #align even.zpow_pos_iff Even.zpow_pos_iff theorem Odd.zpow_neg_iff (hn : Odd n) : a ^ n < 0 ↔ a < 0 := by refine ⟨lt_imp_lt_of_le_imp_le (zpow_nonneg · _), fun ha ↦ ?_⟩ obtain ⟨k, rfl⟩ := hn rw [zpow_add_one₀ ha.ne] exact mul_neg_of_pos_of_neg (Even.zpow_pos (even_two_mul _) ha.ne) ha #align odd.zpow_neg_iff Odd.zpow_neg_iff protected lemma Odd.zpow_nonneg_iff (hn : Odd n) : 0 ≤ a ^ n ↔ 0 ≤ a := le_iff_le_iff_lt_iff_lt.2 hn.zpow_neg_iff #align odd.zpow_nonneg_iff Odd.zpow_nonneg_iff theorem Odd.zpow_nonpos_iff (hn : Odd n) : a ^ n ≤ 0 ↔ a ≤ 0 := by rw [le_iff_lt_or_eq, le_iff_lt_or_eq, hn.zpow_neg_iff, zpow_eq_zero_iff] rintro rfl exact Int.odd_iff_not_even.1 hn even_zero #align odd.zpow_nonpos_iff Odd.zpow_nonpos_iff lemma Odd.zpow_pos_iff (hn : Odd n) : 0 < a ^ n ↔ 0 < a := lt_iff_lt_of_le_iff_le hn.zpow_nonpos_iff #align odd.zpow_pos_iff Odd.zpow_pos_iff alias ⟨_, Odd.zpow_neg⟩ := Odd.zpow_neg_iff #align odd.zpow_neg Odd.zpow_neg alias ⟨_, Odd.zpow_nonpos⟩ := Odd.zpow_nonpos_iff #align odd.zpow_nonpos Odd.zpow_nonpos
Mathlib/Algebra/Order/Field/Power.lean
181
182
theorem Even.zpow_abs {p : ℤ} (hp : Even p) (a : α) : |a| ^ p = a ^ p := by
cases' abs_choice a with h h <;> simp only [h, hp.neg_zpow _]
[ " 0 ≤ a ^ n", " 0 ≤ a ^ (k + k)", " a ≠ 0 ∨ k + k ≠ 0 ∨ k = 0 ∧ k = 0", " 0 ≤ a ^ k * a ^ k", " 0 < a ^ n ↔ a ≠ 0", " 0 < a ^ (k + k) ↔ a ≠ 0", " k ≠ 0", " a ^ n < 0 ↔ a < 0", " a ^ n < 0", " a ^ (2 * k + 1) < 0", " a ^ (2 * k) * a < 0", " a ^ n ≤ 0 ↔ a ≤ 0", " n ≠ 0", " False", " |a| ^ ...
[ " 0 ≤ a ^ n", " 0 ≤ a ^ (k + k)", " a ≠ 0 ∨ k + k ≠ 0 ∨ k = 0 ∧ k = 0", " 0 ≤ a ^ k * a ^ k", " 0 < a ^ n ↔ a ≠ 0", " 0 < a ^ (k + k) ↔ a ≠ 0", " k ≠ 0", " a ^ n < 0 ↔ a < 0", " a ^ n < 0", " a ^ (2 * k + 1) < 0", " a ^ (2 * k) * a < 0", " a ^ n ≤ 0 ↔ a ≤ 0", " n ≠ 0", " False", " |a| ^ ...
import Mathlib.Algebra.Polynomial.Eval import Mathlib.Analysis.Asymptotics.Asymptotics import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Topology.Algebra.Order.LiminfLimsup #align_import analysis.asymptotics.superpolynomial_decay from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" namespace Asymptotics open Topology Polynomial open Filter def SuperpolynomialDecay {α β : Type*} [TopologicalSpace β] [CommSemiring β] (l : Filter α) (k : α → β) (f : α → β) := ∀ n : ℕ, Tendsto (fun a : α => k a ^ n * f a) l (𝓝 0) #align asymptotics.superpolynomial_decay Asymptotics.SuperpolynomialDecay variable {α β : Type*} {l : Filter α} {k : α → β} {f g g' : α → β} section LinearOrderedCommRing variable [TopologicalSpace β] [LinearOrderedCommRing β] [OrderTopology β] variable (l k f) theorem superpolynomialDecay_iff_abs_tendsto_zero : SuperpolynomialDecay l k f ↔ ∀ n : ℕ, Tendsto (fun a : α => |k a ^ n * f a|) l (𝓝 0) := ⟨fun h z => (tendsto_zero_iff_abs_tendsto_zero _).1 (h z), fun h z => (tendsto_zero_iff_abs_tendsto_zero _).2 (h z)⟩ #align asymptotics.superpolynomial_decay_iff_abs_tendsto_zero Asymptotics.superpolynomialDecay_iff_abs_tendsto_zero theorem superpolynomialDecay_iff_superpolynomialDecay_abs : SuperpolynomialDecay l k f ↔ SuperpolynomialDecay l (fun a => |k a|) fun a => |f a| := (superpolynomialDecay_iff_abs_tendsto_zero l k f).trans (by simp_rw [SuperpolynomialDecay, abs_mul, abs_pow]) #align asymptotics.superpolynomial_decay_iff_superpolynomial_decay_abs Asymptotics.superpolynomialDecay_iff_superpolynomialDecay_abs variable {l k f}
Mathlib/Analysis/Asymptotics/SuperpolynomialDecay.lean
176
185
theorem SuperpolynomialDecay.trans_eventually_abs_le (hf : SuperpolynomialDecay l k f) (hfg : abs ∘ g ≤ᶠ[l] abs ∘ f) : SuperpolynomialDecay l k g := by
rw [superpolynomialDecay_iff_abs_tendsto_zero] at hf ⊢ refine fun z => tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (hf z) (eventually_of_forall fun x => abs_nonneg _) (hfg.mono fun x hx => ?_) calc |k x ^ z * g x| = |k x ^ z| * |g x| := abs_mul (k x ^ z) (g x) _ ≤ |k x ^ z| * |f x| := by gcongr _ * ?_; exact hx _ = |k x ^ z * f x| := (abs_mul (k x ^ z) (f x)).symm
[ " (∀ (n : ℕ), Tendsto (fun a => |k a ^ n * f a|) l (𝓝 0)) ↔ SuperpolynomialDecay l (fun a => |k a|) fun a => |f a|", " SuperpolynomialDecay l k g", " ∀ (n : ℕ), Tendsto (fun a => |k a ^ n * g a|) l (𝓝 0)", " |k x ^ z * g x| ≤ |k x ^ z * f x|", " |k x ^ z| * |g x| ≤ |k x ^ z| * |f x|", " |g x| ≤ |f x|" ]
[ " (∀ (n : ℕ), Tendsto (fun a => |k a ^ n * f a|) l (𝓝 0)) ↔ SuperpolynomialDecay l (fun a => |k a|) fun a => |f a|", " SuperpolynomialDecay l k g" ]
import Mathlib.CategoryTheory.Adjunction.Basic import Mathlib.CategoryTheory.Conj #align_import category_theory.adjunction.mates from "leanprover-community/mathlib"@"cea27692b3fdeb328a2ddba6aabf181754543184" universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄ namespace CategoryTheory open Category variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D] section Square variable {E : Type u₃} {F : Type u₄} [Category.{v₃} E] [Category.{v₄} F] variable {G : C ⥤ E} {H : D ⥤ F} {L₁ : C ⥤ D} {R₁ : D ⥤ C} {L₂ : E ⥤ F} {R₂ : F ⥤ E} variable (adj₁ : L₁ ⊣ R₁) (adj₂ : L₂ ⊣ R₂) def transferNatTrans : (G ⋙ L₂ ⟶ L₁ ⋙ H) ≃ (R₁ ⋙ G ⟶ H ⋙ R₂) where toFun h := { app := fun X => adj₂.unit.app _ ≫ R₂.map (h.app _ ≫ H.map (adj₁.counit.app _)) naturality := fun X Y f => by dsimp rw [assoc, ← R₂.map_comp, assoc, ← H.map_comp, ← adj₁.counit_naturality, H.map_comp, ← Functor.comp_map L₁, ← h.naturality_assoc] simp } invFun h := { app := fun X => L₂.map (G.map (adj₁.unit.app _) ≫ h.app _) ≫ adj₂.counit.app _ naturality := fun X Y f => by dsimp rw [← L₂.map_comp_assoc, ← G.map_comp_assoc, ← adj₁.unit_naturality, G.map_comp_assoc, ← Functor.comp_map, h.naturality] simp } left_inv h := by ext X dsimp simp only [L₂.map_comp, assoc, adj₂.counit_naturality, adj₂.left_triangle_components_assoc, ← Functor.comp_map G L₂, h.naturality_assoc, Functor.comp_map L₁, ← H.map_comp, adj₁.left_triangle_components] dsimp simp only [id_comp, ← Functor.comp_map, ← Functor.comp_obj, NatTrans.naturality_assoc] simp only [Functor.comp_obj, Functor.comp_map, ← Functor.map_comp] have : Prefunctor.map L₁.toPrefunctor (NatTrans.app adj₁.unit X) ≫ NatTrans.app adj₁.counit (Prefunctor.obj L₁.toPrefunctor X) = 𝟙 _ := by simp simp [this] -- See library note [dsimp, simp]. right_inv h := by ext X dsimp simp [-Functor.comp_map, ← Functor.comp_map H, Functor.comp_map R₁, -NatTrans.naturality, ← h.naturality, -Functor.map_comp, ← Functor.map_comp_assoc G, R₂.map_comp] #align category_theory.transfer_nat_trans CategoryTheory.transferNatTrans theorem transferNatTrans_counit (f : G ⋙ L₂ ⟶ L₁ ⋙ H) (Y : D) : L₂.map ((transferNatTrans adj₁ adj₂ f).app _) ≫ adj₂.counit.app _ = f.app _ ≫ H.map (adj₁.counit.app Y) := by erw [Functor.map_comp] simp #align category_theory.transfer_nat_trans_counit CategoryTheory.transferNatTrans_counit
Mathlib/CategoryTheory/Adjunction/Mates.lean
118
124
theorem unit_transferNatTrans (f : G ⋙ L₂ ⟶ L₁ ⋙ H) (X : C) : G.map (adj₁.unit.app X) ≫ (transferNatTrans adj₁ adj₂ f).app _ = adj₂.unit.app _ ≫ R₂.map (f.app _) := by
dsimp [transferNatTrans] rw [← adj₂.unit_naturality_assoc, ← R₂.map_comp, ← Functor.comp_map G L₂, f.naturality_assoc, Functor.comp_map, ← H.map_comp] dsimp; simp
[ " (R₁ ⋙ G).map f ≫\n (fun X => adj₂.unit.app (G.obj (R₁.obj X)) ≫ R₂.map (h.app (R₁.obj X) ≫ H.map (adj₁.counit.app X))) Y =\n (fun X => adj₂.unit.app (G.obj (R₁.obj X)) ≫ R₂.map (h.app (R₁.obj X) ≫ H.map (adj₁.counit.app X))) X ≫\n (H ⋙ R₂).map f", " G.map (R₁.map f) ≫ adj₂.unit.app (G.obj (R₁.obj Y...
[ " (R₁ ⋙ G).map f ≫\n (fun X => adj₂.unit.app (G.obj (R₁.obj X)) ≫ R₂.map (h.app (R₁.obj X) ≫ H.map (adj₁.counit.app X))) Y =\n (fun X => adj₂.unit.app (G.obj (R₁.obj X)) ≫ R₂.map (h.app (R₁.obj X) ≫ H.map (adj₁.counit.app X))) X ≫\n (H ⋙ R₂).map f", " G.map (R₁.map f) ≫ adj₂.unit.app (G.obj (R₁.obj Y...
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.Dynamics.PeriodicPts import Mathlib.Data.Set.Pointwise.SMul namespace MulAction open Pointwise variable {α : Type*} variable {G : Type*} [Group G] [MulAction G α] variable {M : Type*} [Monoid M] [MulAction M α] section FixedPoints variable (α) in @[to_additive (attr := simp) "In an additive group action, the points fixed by `g` are also fixed by `g⁻¹`"] theorem fixedBy_inv (g : G) : fixedBy α g⁻¹ = fixedBy α g := by ext rw [mem_fixedBy, mem_fixedBy, inv_smul_eq_iff, eq_comm] @[to_additive] theorem smul_mem_fixedBy_iff_mem_fixedBy {a : α} {g : G} : g • a ∈ fixedBy α g ↔ a ∈ fixedBy α g := by rw [mem_fixedBy, smul_left_cancel_iff] rfl @[to_additive]
Mathlib/GroupTheory/GroupAction/FixedPoints.lean
71
73
theorem smul_inv_mem_fixedBy_iff_mem_fixedBy {a : α} {g : G} : g⁻¹ • a ∈ fixedBy α g ↔ a ∈ fixedBy α g := by
rw [← fixedBy_inv, smul_mem_fixedBy_iff_mem_fixedBy, fixedBy_inv]
[ " fixedBy α g⁻¹ = fixedBy α g", " x✝ ∈ fixedBy α g⁻¹ ↔ x✝ ∈ fixedBy α g", " g • a ∈ fixedBy α g ↔ a ∈ fixedBy α g", " g • a = a ↔ a ∈ fixedBy α g", " g⁻¹ • a ∈ fixedBy α g ↔ a ∈ fixedBy α g" ]
[ " fixedBy α g⁻¹ = fixedBy α g", " x✝ ∈ fixedBy α g⁻¹ ↔ x✝ ∈ fixedBy α g", " g • a ∈ fixedBy α g ↔ a ∈ fixedBy α g", " g • a = a ↔ a ∈ fixedBy α g", " g⁻¹ • a ∈ fixedBy α g ↔ a ∈ fixedBy α g" ]
import Mathlib.Algebra.Associated import Mathlib.Algebra.Ring.Regular import Mathlib.Tactic.Common #align_import algebra.gcd_monoid.basic from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11" variable {α : Type*} -- Porting note: mathlib3 had a `@[protect_proj]` here, but adding `protected` to all the fields -- adds unnecessary clutter to later code class NormalizationMonoid (α : Type*) [CancelCommMonoidWithZero α] where normUnit : α → αˣ normUnit_zero : normUnit 0 = 1 normUnit_mul : ∀ {a b}, a ≠ 0 → b ≠ 0 → normUnit (a * b) = normUnit a * normUnit b normUnit_coe_units : ∀ u : αˣ, normUnit u = u⁻¹ #align normalization_monoid NormalizationMonoid export NormalizationMonoid (normUnit normUnit_zero normUnit_mul normUnit_coe_units) attribute [simp] normUnit_coe_units normUnit_zero normUnit_mul section NormalizationMonoid variable [CancelCommMonoidWithZero α] [NormalizationMonoid α] @[simp] theorem normUnit_one : normUnit (1 : α) = 1 := normUnit_coe_units 1 #align norm_unit_one normUnit_one -- Porting note (#11083): quite slow. Improve performance? def normalize : α →*₀ α where toFun x := x * normUnit x map_zero' := by simp only [normUnit_zero] exact mul_one (0:α) map_one' := by dsimp only; rw [normUnit_one, one_mul]; rfl map_mul' x y := (by_cases fun hx : x = 0 => by dsimp only; rw [hx, zero_mul, zero_mul, zero_mul]) fun hx => (by_cases fun hy : y = 0 => by dsimp only; rw [hy, mul_zero, zero_mul, mul_zero]) fun hy => by simp only [normUnit_mul hx hy, Units.val_mul]; simp only [mul_assoc, mul_left_comm y] #align normalize normalize theorem associated_normalize (x : α) : Associated x (normalize x) := ⟨_, rfl⟩ #align associated_normalize associated_normalize theorem normalize_associated (x : α) : Associated (normalize x) x := (associated_normalize _).symm #align normalize_associated normalize_associated theorem associated_normalize_iff {x y : α} : Associated x (normalize y) ↔ Associated x y := ⟨fun h => h.trans (normalize_associated y), fun h => h.trans (associated_normalize y)⟩ #align associated_normalize_iff associated_normalize_iff theorem normalize_associated_iff {x y : α} : Associated (normalize x) y ↔ Associated x y := ⟨fun h => (associated_normalize _).trans h, fun h => (normalize_associated _).trans h⟩ #align normalize_associated_iff normalize_associated_iff theorem Associates.mk_normalize (x : α) : Associates.mk (normalize x) = Associates.mk x := Associates.mk_eq_mk_iff_associated.2 (normalize_associated _) #align associates.mk_normalize Associates.mk_normalize @[simp] theorem normalize_apply (x : α) : normalize x = x * normUnit x := rfl #align normalize_apply normalize_apply -- Porting note (#10618): `simp` can prove this -- @[simp] theorem normalize_zero : normalize (0 : α) = 0 := normalize.map_zero #align normalize_zero normalize_zero -- Porting note (#10618): `simp` can prove this -- @[simp] theorem normalize_one : normalize (1 : α) = 1 := normalize.map_one #align normalize_one normalize_one theorem normalize_coe_units (u : αˣ) : normalize (u : α) = 1 := by simp #align normalize_coe_units normalize_coe_units theorem normalize_eq_zero {x : α} : normalize x = 0 ↔ x = 0 := ⟨fun hx => (associated_zero_iff_eq_zero x).1 <| hx ▸ associated_normalize _, by rintro rfl; exact normalize_zero⟩ #align normalize_eq_zero normalize_eq_zero theorem normalize_eq_one {x : α} : normalize x = 1 ↔ IsUnit x := ⟨fun hx => isUnit_iff_exists_inv.2 ⟨_, hx⟩, fun ⟨u, hu⟩ => hu ▸ normalize_coe_units u⟩ #align normalize_eq_one normalize_eq_one -- Porting note (#11083): quite slow. Improve performance? @[simp] theorem normUnit_mul_normUnit (a : α) : normUnit (a * normUnit a) = 1 := by nontriviality α using Subsingleton.elim a 0 obtain rfl | h := eq_or_ne a 0 · rw [normUnit_zero, zero_mul, normUnit_zero] · rw [normUnit_mul h (Units.ne_zero _), normUnit_coe_units, mul_inv_eq_one] #align norm_unit_mul_norm_unit normUnit_mul_normUnit
Mathlib/Algebra/GCDMonoid/Basic.lean
169
169
theorem normalize_idem (x : α) : normalize (normalize x) = normalize x := by
simp
[ " (fun x => x * ↑(normUnit x)) 0 = 0", " 0 * ↑1 = 0", " { toFun := fun x => x * ↑(normUnit x), map_zero' := ⋯ }.toFun 1 = 1", " 1 * ↑(normUnit 1) = 1", " ↑1 = 1", " { toFun := fun x => x * ↑(normUnit x), map_zero' := ⋯ }.toFun (x * y) =\n { toFun := fun x => x * ↑(normUnit x), map_zero' := ⋯ }.toFun x ...
[ " (fun x => x * ↑(normUnit x)) 0 = 0", " 0 * ↑1 = 0", " { toFun := fun x => x * ↑(normUnit x), map_zero' := ⋯ }.toFun 1 = 1", " 1 * ↑(normUnit 1) = 1", " ↑1 = 1", " { toFun := fun x => x * ↑(normUnit x), map_zero' := ⋯ }.toFun (x * y) =\n { toFun := fun x => x * ↑(normUnit x), map_zero' := ⋯ }.toFun x ...
import Mathlib.Algebra.Order.Group.Nat import Mathlib.Data.Finset.Antidiagonal import Mathlib.Data.Finset.Card import Mathlib.Data.Multiset.NatAntidiagonal #align_import data.finset.nat_antidiagonal from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function namespace Finset namespace Nat instance instHasAntidiagonal : HasAntidiagonal ℕ where antidiagonal n := ⟨Multiset.Nat.antidiagonal n, Multiset.Nat.nodup_antidiagonal n⟩ mem_antidiagonal {n} {xy} := by rw [mem_def, Multiset.Nat.mem_antidiagonal] lemma antidiagonal_eq_map (n : ℕ) : antidiagonal n = (range (n + 1)).map ⟨fun i ↦ (i, n - i), fun _ _ h ↦ (Prod.ext_iff.1 h).1⟩ := rfl lemma antidiagonal_eq_map' (n : ℕ) : antidiagonal n = (range (n + 1)).map ⟨fun i ↦ (n - i, i), fun _ _ h ↦ (Prod.ext_iff.1 h).2⟩ := by rw [← map_swap_antidiagonal, antidiagonal_eq_map, map_map]; rfl lemma antidiagonal_eq_image (n : ℕ) : antidiagonal n = (range (n + 1)).image fun i ↦ (i, n - i) := by simp only [antidiagonal_eq_map, map_eq_image, Function.Embedding.coeFn_mk] lemma antidiagonal_eq_image' (n : ℕ) : antidiagonal n = (range (n + 1)).image fun i ↦ (n - i, i) := by simp only [antidiagonal_eq_map', map_eq_image, Function.Embedding.coeFn_mk] @[simp]
Mathlib/Data/Finset/NatAntidiagonal.lean
58
58
theorem card_antidiagonal (n : ℕ) : (antidiagonal n).card = n + 1 := by
simp [antidiagonal]
[ " xy ∈ (fun n => { val := Multiset.Nat.antidiagonal n, nodup := ⋯ }) n ↔ xy.1 + xy.2 = n", " antidiagonal n = map { toFun := fun i => (n - i, i), inj' := ⋯ } (range (n + 1))", " map ({ toFun := fun i => (i, n - i), inj' := ⋯ }.trans { toFun := Prod.swap, inj' := ⋯ }) (range (n + 1)) =\n map { toFun := fun i ...
[ " xy ∈ (fun n => { val := Multiset.Nat.antidiagonal n, nodup := ⋯ }) n ↔ xy.1 + xy.2 = n", " antidiagonal n = map { toFun := fun i => (n - i, i), inj' := ⋯ } (range (n + 1))", " map ({ toFun := fun i => (i, n - i), inj' := ⋯ }.trans { toFun := Prod.swap, inj' := ⋯ }) (range (n + 1)) =\n map { toFun := fun i ...
import Mathlib.Topology.Order #align_import topology.maps from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d" open Set Filter Function open TopologicalSpace Topology Filter variable {X : Type*} {Y : Type*} {Z : Type*} {ι : Type*} {f : X → Y} {g : Y → Z} section Inducing variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] theorem inducing_induced (f : X → Y) : @Inducing X Y (TopologicalSpace.induced f ‹_›) _ f := @Inducing.mk _ _ (TopologicalSpace.induced f ‹_›) _ _ rfl theorem inducing_id : Inducing (@id X) := ⟨induced_id.symm⟩ #align inducing_id inducing_id protected theorem Inducing.comp (hg : Inducing g) (hf : Inducing f) : Inducing (g ∘ f) := ⟨by rw [hf.induced, hg.induced, induced_compose]⟩ #align inducing.comp Inducing.comp theorem Inducing.of_comp_iff (hg : Inducing g) : Inducing (g ∘ f) ↔ Inducing f := by refine ⟨fun h ↦ ?_, hg.comp⟩ rw [inducing_iff, hg.induced, induced_compose, h.induced] #align inducing.inducing_iff Inducing.of_comp_iff theorem inducing_of_inducing_compose (hf : Continuous f) (hg : Continuous g) (hgf : Inducing (g ∘ f)) : Inducing f := ⟨le_antisymm (by rwa [← continuous_iff_le_induced]) (by rw [hgf.induced, ← induced_compose] exact induced_mono hg.le_induced)⟩ #align inducing_of_inducing_compose inducing_of_inducing_compose theorem inducing_iff_nhds : Inducing f ↔ ∀ x, 𝓝 x = comap f (𝓝 (f x)) := (inducing_iff _).trans (induced_iff_nhds_eq f) #align inducing_iff_nhds inducing_iff_nhds namespace Inducing theorem nhds_eq_comap (hf : Inducing f) : ∀ x : X, 𝓝 x = comap f (𝓝 <| f x) := inducing_iff_nhds.1 hf #align inducing.nhds_eq_comap Inducing.nhds_eq_comap theorem basis_nhds {p : ι → Prop} {s : ι → Set Y} (hf : Inducing f) {x : X} (h_basis : (𝓝 (f x)).HasBasis p s) : (𝓝 x).HasBasis p (preimage f ∘ s) := hf.nhds_eq_comap x ▸ h_basis.comap f theorem nhdsSet_eq_comap (hf : Inducing f) (s : Set X) : 𝓝ˢ s = comap f (𝓝ˢ (f '' s)) := by simp only [nhdsSet, sSup_image, comap_iSup, hf.nhds_eq_comap, iSup_image] #align inducing.nhds_set_eq_comap Inducing.nhdsSet_eq_comap theorem map_nhds_eq (hf : Inducing f) (x : X) : (𝓝 x).map f = 𝓝[range f] f x := hf.induced.symm ▸ map_nhds_induced_eq x #align inducing.map_nhds_eq Inducing.map_nhds_eq theorem map_nhds_of_mem (hf : Inducing f) (x : X) (h : range f ∈ 𝓝 (f x)) : (𝓝 x).map f = 𝓝 (f x) := hf.induced.symm ▸ map_nhds_induced_of_mem h #align inducing.map_nhds_of_mem Inducing.map_nhds_of_mem -- Porting note (#10756): new lemma
Mathlib/Topology/Maps.lean
112
115
theorem mapClusterPt_iff (hf : Inducing f) {x : X} {l : Filter X} : MapClusterPt (f x) l f ↔ ClusterPt x l := by
delta MapClusterPt ClusterPt rw [← Filter.push_pull', ← hf.nhds_eq_comap, map_neBot_iff]
[ " inst✝² = TopologicalSpace.induced (g ∘ f) inst✝", " Inducing (g ∘ f) ↔ Inducing f", " Inducing f", " inst✝² ≤ induced f inst✝¹", " induced f inst✝¹ ≤ inst✝²", " induced f inst✝¹ ≤ induced f (induced g inst✝)", " 𝓝ˢ s = comap f (𝓝ˢ (f '' s))", " MapClusterPt (f x) l f ↔ ClusterPt x l", " (𝓝 (f x...
[ " inst✝² = TopologicalSpace.induced (g ∘ f) inst✝", " Inducing (g ∘ f) ↔ Inducing f", " Inducing f", " inst✝² ≤ induced f inst✝¹", " induced f inst✝¹ ≤ inst✝²", " induced f inst✝¹ ≤ induced f (induced g inst✝)", " 𝓝ˢ s = comap f (𝓝ˢ (f '' s))", " MapClusterPt (f x) l f ↔ ClusterPt x l" ]
import Mathlib.Algebra.Category.ModuleCat.EpiMono import Mathlib.Algebra.Category.ModuleCat.Kernels import Mathlib.CategoryTheory.Subobject.WellPowered import Mathlib.CategoryTheory.Subobject.Limits #align_import algebra.category.Module.subobject from "leanprover-community/mathlib"@"6d584f1709bedbed9175bd9350df46599bdd7213" open CategoryTheory open CategoryTheory.Subobject open CategoryTheory.Limits open ModuleCat universe v u namespace ModuleCat set_option linter.uppercaseLean3 false -- `Module` variable {R : Type u} [Ring R] (M : ModuleCat.{v} R) noncomputable def subobjectModule : Subobject M ≃o Submodule R M := OrderIso.symm { invFun := fun S => LinearMap.range S.arrow toFun := fun N => Subobject.mk (↾N.subtype) right_inv := fun S => Eq.symm (by fapply eq_mk_of_comm · apply LinearEquiv.toModuleIso'Left apply LinearEquiv.ofBijective (LinearMap.codRestrict (LinearMap.range S.arrow) S.arrow _) constructor · simp [← LinearMap.ker_eq_bot, LinearMap.ker_codRestrict] rw [ker_eq_bot_of_mono] · rw [← LinearMap.range_eq_top, LinearMap.range_codRestrict, Submodule.comap_subtype_self] exact LinearMap.mem_range_self _ · apply LinearMap.ext intro x rfl) left_inv := fun N => by -- Porting note: The type of `↾N.subtype` was ambiguous. Not entirely sure, I made the right -- choice here convert congr_arg LinearMap.range (underlyingIso_arrow (↾N.subtype : of R { x // x ∈ N } ⟶ M)) using 1 · have : -- Porting note: added the `.toLinearEquiv.toLinearMap` (underlyingIso (↾N.subtype : of R _ ⟶ M)).inv = (underlyingIso (↾N.subtype : of R _ ⟶ M)).symm.toLinearEquiv.toLinearMap := by apply LinearMap.ext intro x rfl rw [this, comp_def, LinearEquiv.range_comp] · exact (Submodule.range_subtype _).symm map_rel_iff' := fun {S T} => by refine ⟨fun h => ?_, fun h => mk_le_mk_of_comm (↟(Submodule.inclusion h)) rfl⟩ convert LinearMap.range_comp_le_range (ofMkLEMk _ _ h) (↾T.subtype) · simpa only [← comp_def, ofMkLEMk_comp] using (Submodule.range_subtype _).symm · exact (Submodule.range_subtype _).symm } #align Module.subobject_Module ModuleCat.subobjectModule instance wellPowered_moduleCat : WellPowered (ModuleCat.{v} R) := ⟨fun M => ⟨⟨_, ⟨(subobjectModule M).toEquiv⟩⟩⟩⟩ #align Module.well_powered_Module ModuleCat.wellPowered_moduleCat attribute [local instance] hasKernels_moduleCat noncomputable def toKernelSubobject {M N : ModuleCat.{v} R} {f : M ⟶ N} : LinearMap.ker f →ₗ[R] kernelSubobject f := (kernelSubobjectIso f ≪≫ ModuleCat.kernelIsoKer f).inv #align Module.to_kernel_subobject ModuleCat.toKernelSubobject @[simp]
Mathlib/Algebra/Category/ModuleCat/Subobject.lean
89
96
theorem toKernelSubobject_arrow {M N : ModuleCat R} {f : M ⟶ N} (x : LinearMap.ker f) : (kernelSubobject f).arrow (toKernelSubobject x) = x.1 := by
-- Porting note: The whole proof was just `simp [toKernelSubobject]`. suffices ((arrow ((kernelSubobject f))) ∘ (kernelSubobjectIso f ≪≫ kernelIsoKer f).inv) x = x by convert this rw [Iso.trans_inv, ← coe_comp, Category.assoc] simp only [Category.assoc, kernelSubobject_arrow', kernelIsoKer_inv_kernel_ι] aesop_cat
[ " (fun S => LinearMap.range S.arrow) ((fun N => Subobject.mk (↾N.subtype)) N) = N", " (fun S => LinearMap.range S.arrow) ((fun N => Subobject.mk (↾N.subtype)) N) =\n LinearMap.range ((underlyingIso (↾N.subtype)).inv ≫ (Subobject.mk (↾N.subtype)).arrow)", " (underlyingIso (↾N.subtype)).inv = ↑(underlyingIso (...
[ " (fun S => LinearMap.range S.arrow) ((fun N => Subobject.mk (↾N.subtype)) N) = N", " (fun S => LinearMap.range S.arrow) ((fun N => Subobject.mk (↾N.subtype)) N) =\n LinearMap.range ((underlyingIso (↾N.subtype)).inv ≫ (Subobject.mk (↾N.subtype)).arrow)", " (underlyingIso (↾N.subtype)).inv = ↑(underlyingIso (...
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 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] #align set.image_comm Set.image_comm theorem _root_.Function.Semiconj.set_image {f : α → β} {ga : α → α} {gb : β → β} (h : Function.Semiconj f ga gb) : Function.Semiconj (image f) (image ga) (image gb) := fun _ => image_comm h #align function.semiconj.set_image Function.Semiconj.set_image theorem _root_.Function.Commute.set_image {f g : α → α} (h : Function.Commute f g) : Function.Commute (image f) (image g) := Function.Semiconj.set_image h #align function.commute.set_image Function.Commute.set_image @[gcongr]
Mathlib/Data/Set/Image.lean
291
293
theorem image_subset {a b : Set α} (f : α → β) (h : a ⊆ b) : f '' a ⊆ f '' b := by
simp only [subset_def, mem_image] exact fun x => fun ⟨w, h1, h2⟩ => ⟨w, h h1, h2⟩
[ " (∀ y ∈ f '' s, p y) ↔ ∀ ⦃x : α⦄, x ∈ s → p (f x)", " (∃ y ∈ f '' s, p y) ↔ ∃ x ∈ s, p (f x)", " f '' s = g '' s", " x ∈ f '' s ↔ x ∈ g '' s", " f a = x ↔ g a = x", " f '' s ⊆ f '' t", " f a ∈ f '' t", " f ∘ g '' a = f '' (g '' a)", " image (g ∘ f) = image g ∘ image f", " x✝ ∈ g ∘ f '' x✝¹ ↔ x✝ ∈...
[ " (∀ y ∈ f '' s, p y) ↔ ∀ ⦃x : α⦄, x ∈ s → p (f x)", " (∃ y ∈ f '' s, p y) ↔ ∃ x ∈ s, p (f x)", " f '' s = g '' s", " x ∈ f '' s ↔ x ∈ g '' s", " f a = x ↔ g a = x", " f '' s ⊆ f '' t", " f a ∈ f '' t", " f ∘ g '' a = f '' (g '' a)", " image (g ∘ f) = image g ∘ image f", " x✝ ∈ g ∘ f '' x✝¹ ↔ x✝ ∈...
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Coxeter.Basic namespace CoxeterSystem open List Matrix Function Classical variable {B : Type*} variable {W : Type*} [Group W] variable {M : CoxeterMatrix B} (cs : CoxeterSystem M W) local prefix:100 "s" => cs.simple local prefix:100 "π" => cs.wordProd private theorem exists_word_with_prod (w : W) : ∃ n ω, ω.length = n ∧ π ω = w := by rcases cs.wordProd_surjective w with ⟨ω, rfl⟩ use ω.length, ω noncomputable def length (w : W) : ℕ := Nat.find (cs.exists_word_with_prod w) local prefix:100 "ℓ" => cs.length theorem exists_reduced_word (w : W) : ∃ ω, ω.length = ℓ w ∧ w = π ω := by have := Nat.find_spec (cs.exists_word_with_prod w) tauto theorem length_wordProd_le (ω : List B) : ℓ (π ω) ≤ ω.length := Nat.find_min' (cs.exists_word_with_prod (π ω)) ⟨ω, by tauto⟩ @[simp] theorem length_one : ℓ (1 : W) = 0 := Nat.eq_zero_of_le_zero (cs.length_wordProd_le []) @[simp] theorem length_eq_zero_iff {w : W} : ℓ w = 0 ↔ w = 1 := by constructor · intro h rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩ have : ω = [] := eq_nil_of_length_eq_zero (hω.trans h) rw [this, wordProd_nil] · rintro rfl exact cs.length_one @[simp] theorem length_inv (w : W) : ℓ (w⁻¹) = ℓ w := by apply Nat.le_antisymm · rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩ have := cs.length_wordProd_le (List.reverse ω) rwa [wordProd_reverse, length_reverse, hω] at this · rcases cs.exists_reduced_word w⁻¹ with ⟨ω, hω, h'ω⟩ have := cs.length_wordProd_le (List.reverse ω) rwa [wordProd_reverse, length_reverse, ← h'ω, hω, inv_inv] at this theorem length_mul_le (w₁ w₂ : W) : ℓ (w₁ * w₂) ≤ ℓ w₁ + ℓ w₂ := by rcases cs.exists_reduced_word w₁ with ⟨ω₁, hω₁, rfl⟩ rcases cs.exists_reduced_word w₂ with ⟨ω₂, hω₂, rfl⟩ have := cs.length_wordProd_le (ω₁ ++ ω₂) simpa [hω₁, hω₂, wordProd_append] using this theorem length_mul_ge_length_sub_length (w₁ w₂ : W) : ℓ w₁ - ℓ w₂ ≤ ℓ (w₁ * w₂) := by simpa [Nat.sub_le_of_le_add] using cs.length_mul_le (w₁ * w₂) w₂⁻¹ theorem length_mul_ge_length_sub_length' (w₁ w₂ : W) : ℓ w₂ - ℓ w₁ ≤ ℓ (w₁ * w₂) := by simpa [Nat.sub_le_of_le_add, add_comm] using cs.length_mul_le w₁⁻¹ (w₁ * w₂) theorem length_mul_ge_max (w₁ w₂ : W) : max (ℓ w₁ - ℓ w₂) (ℓ w₂ - ℓ w₁) ≤ ℓ (w₁ * w₂) := max_le_iff.mpr ⟨length_mul_ge_length_sub_length _ _ _, length_mul_ge_length_sub_length' _ _ _⟩ def lengthParity : W →* Multiplicative (ZMod 2) := cs.lift ⟨fun _ ↦ Multiplicative.ofAdd 1, by simp_rw [CoxeterMatrix.IsLiftable, ← ofAdd_add, (by decide : (1 + 1 : ZMod 2) = 0)] simp⟩ theorem lengthParity_simple (i : B): cs.lengthParity (s i) = Multiplicative.ofAdd 1 := cs.lift_apply_simple _ _ theorem lengthParity_comp_simple : cs.lengthParity ∘ cs.simple = fun _ ↦ Multiplicative.ofAdd 1 := funext cs.lengthParity_simple theorem lengthParity_eq_ofAdd_length (w : W) : cs.lengthParity w = Multiplicative.ofAdd (↑(ℓ w)) := by rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩ rw [← hω, wordProd, map_list_prod, List.map_map, lengthParity_comp_simple, map_const', prod_replicate, ← ofAdd_nsmul, nsmul_one] theorem length_mul_mod_two (w₁ w₂ : W) : ℓ (w₁ * w₂) % 2 = (ℓ w₁ + ℓ w₂) % 2 := by rw [← ZMod.natCast_eq_natCast_iff', Nat.cast_add] simpa only [lengthParity_eq_ofAdd_length, ofAdd_add] using map_mul cs.lengthParity w₁ w₂ @[simp] theorem length_simple (i : B) : ℓ (s i) = 1 := by apply Nat.le_antisymm · simpa using cs.length_wordProd_le [i] · by_contra! length_lt_one have : cs.lengthParity (s i) = Multiplicative.ofAdd 0 := by rw [lengthParity_eq_ofAdd_length, Nat.lt_one_iff.mp length_lt_one, Nat.cast_zero] have : Multiplicative.ofAdd (0 : ZMod 2) = Multiplicative.ofAdd 1 := this.symm.trans (cs.lengthParity_simple i) contradiction theorem length_eq_one_iff {w : W} : ℓ w = 1 ↔ ∃ i : B, w = s i := by constructor · intro h rcases cs.exists_reduced_word w with ⟨ω, hω, rfl⟩ rcases List.length_eq_one.mp (hω.trans h) with ⟨i, rfl⟩ exact ⟨i, cs.wordProd_singleton i⟩ · rintro ⟨i, rfl⟩ exact cs.length_simple i
Mathlib/GroupTheory/Coxeter/Length.lean
161
169
theorem length_mul_simple_ne (w : W) (i : B) : ℓ (w * s i) ≠ ℓ w := by
intro eq have length_mod_two := cs.length_mul_mod_two w (s i) rw [eq, length_simple] at length_mod_two rcases Nat.mod_two_eq_zero_or_one (ℓ w) with even | odd · rw [even, Nat.succ_mod_two_eq_one_iff.mpr even] at length_mod_two contradiction · rw [odd, Nat.succ_mod_two_eq_zero_iff.mpr odd] at length_mod_two contradiction
[ " ∃ n ω, ω.length = n ∧ cs.wordProd ω = w", " ∃ n ω_1, ω_1.length = n ∧ cs.wordProd ω_1 = cs.wordProd ω", " ∃ ω, ω.length = cs.length w ∧ w = cs.wordProd ω", " ω.length = ω.length ∧ cs.wordProd ω = cs.wordProd ω", " cs.length w = 0 ↔ w = 1", " cs.length w = 0 → w = 1", " w = 1", " cs.wordProd ω = 1", ...
[ " ∃ n ω, ω.length = n ∧ cs.wordProd ω = w", " ∃ n ω_1, ω_1.length = n ∧ cs.wordProd ω_1 = cs.wordProd ω", " ∃ ω, ω.length = cs.length w ∧ w = cs.wordProd ω", " ω.length = ω.length ∧ cs.wordProd ω = cs.wordProd ω", " cs.length w = 0 ↔ w = 1", " cs.length w = 0 → w = 1", " w = 1", " cs.wordProd ω = 1", ...
import Mathlib.Logic.Encodable.Lattice import Mathlib.MeasureTheory.MeasurableSpace.Defs #align_import measure_theory.pi_system from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" open MeasurableSpace Set open scoped Classical open MeasureTheory def IsPiSystem {α} (C : Set (Set α)) : Prop := ∀ᵉ (s ∈ C) (t ∈ C), (s ∩ t : Set α).Nonempty → s ∩ t ∈ C #align is_pi_system IsPiSystem theorem IsPiSystem.singleton {α} (S : Set α) : IsPiSystem ({S} : Set (Set α)) := by intro s h_s t h_t _ rw [Set.mem_singleton_iff.1 h_s, Set.mem_singleton_iff.1 h_t, Set.inter_self, Set.mem_singleton_iff] #align is_pi_system.singleton IsPiSystem.singleton theorem IsPiSystem.insert_empty {α} {S : Set (Set α)} (h_pi : IsPiSystem S) : IsPiSystem (insert ∅ S) := by intro s hs t ht hst cases' hs with hs hs · simp [hs] · cases' ht with ht ht · simp [ht] · exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst) #align is_pi_system.insert_empty IsPiSystem.insert_empty theorem IsPiSystem.insert_univ {α} {S : Set (Set α)} (h_pi : IsPiSystem S) : IsPiSystem (insert Set.univ S) := by intro s hs t ht hst cases' hs with hs hs · cases' ht with ht ht <;> simp [hs, ht] · cases' ht with ht ht · simp [hs, ht] · exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst) #align is_pi_system.insert_univ IsPiSystem.insert_univ theorem IsPiSystem.comap {α β} {S : Set (Set β)} (h_pi : IsPiSystem S) (f : α → β) : IsPiSystem { s : Set α | ∃ t ∈ S, f ⁻¹' t = s } := by rintro _ ⟨s, hs_mem, rfl⟩ _ ⟨t, ht_mem, rfl⟩ hst rw [← Set.preimage_inter] at hst ⊢ exact ⟨s ∩ t, h_pi s hs_mem t ht_mem (nonempty_of_nonempty_preimage hst), rfl⟩ #align is_pi_system.comap IsPiSystem.comap theorem isPiSystem_iUnion_of_directed_le {α ι} (p : ι → Set (Set α)) (hp_pi : ∀ n, IsPiSystem (p n)) (hp_directed : Directed (· ≤ ·) p) : IsPiSystem (⋃ n, p n) := by intro t1 ht1 t2 ht2 h rw [Set.mem_iUnion] at ht1 ht2 ⊢ cases' ht1 with n ht1 cases' ht2 with m ht2 obtain ⟨k, hpnk, hpmk⟩ : ∃ k, p n ≤ p k ∧ p m ≤ p k := hp_directed n m exact ⟨k, hp_pi k t1 (hpnk ht1) t2 (hpmk ht2) h⟩ #align is_pi_system_Union_of_directed_le isPiSystem_iUnion_of_directed_le theorem isPiSystem_iUnion_of_monotone {α ι} [SemilatticeSup ι] (p : ι → Set (Set α)) (hp_pi : ∀ n, IsPiSystem (p n)) (hp_mono : Monotone p) : IsPiSystem (⋃ n, p n) := isPiSystem_iUnion_of_directed_le p hp_pi (Monotone.directed_le hp_mono) #align is_pi_system_Union_of_monotone isPiSystem_iUnion_of_monotone section Order variable {α : Type*} {ι ι' : Sort*} [LinearOrder α] theorem isPiSystem_image_Iio (s : Set α) : IsPiSystem (Iio '' s) := by rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ - exact ⟨a ⊓ b, inf_ind a b ha hb, Iio_inter_Iio.symm⟩ #align is_pi_system_image_Iio isPiSystem_image_Iio theorem isPiSystem_Iio : IsPiSystem (range Iio : Set (Set α)) := @image_univ α _ Iio ▸ isPiSystem_image_Iio univ #align is_pi_system_Iio isPiSystem_Iio theorem isPiSystem_image_Ioi (s : Set α) : IsPiSystem (Ioi '' s) := @isPiSystem_image_Iio αᵒᵈ _ s #align is_pi_system_image_Ioi isPiSystem_image_Ioi theorem isPiSystem_Ioi : IsPiSystem (range Ioi : Set (Set α)) := @image_univ α _ Ioi ▸ isPiSystem_image_Ioi univ #align is_pi_system_Ioi isPiSystem_Ioi theorem isPiSystem_image_Iic (s : Set α) : IsPiSystem (Iic '' s) := by rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ - exact ⟨a ⊓ b, inf_ind a b ha hb, Iic_inter_Iic.symm⟩ theorem isPiSystem_Iic : IsPiSystem (range Iic : Set (Set α)) := @image_univ α _ Iic ▸ isPiSystem_image_Iic univ #align is_pi_system_Iic isPiSystem_Iic theorem isPiSystem_image_Ici (s : Set α) : IsPiSystem (Ici '' s) := @isPiSystem_image_Iic αᵒᵈ _ s theorem isPiSystem_Ici : IsPiSystem (range Ici : Set (Set α)) := @image_univ α _ Ici ▸ isPiSystem_image_Ici univ #align is_pi_system_Ici isPiSystem_Ici
Mathlib/MeasureTheory/PiSystem.lean
164
170
theorem isPiSystem_Ixx_mem {Ixx : α → α → Set α} {p : α → α → Prop} (Hne : ∀ {a b}, (Ixx a b).Nonempty → p a b) (Hi : ∀ {a₁ b₁ a₂ b₂}, Ixx a₁ b₁ ∩ Ixx a₂ b₂ = Ixx (max a₁ a₂) (min b₁ b₂)) (s t : Set α) : IsPiSystem { S | ∃ᵉ (l ∈ s) (u ∈ t), p l u ∧ Ixx l u = S } := by
rintro _ ⟨l₁, hls₁, u₁, hut₁, _, rfl⟩ _ ⟨l₂, hls₂, u₂, hut₂, _, rfl⟩ simp only [Hi] exact fun H => ⟨l₁ ⊔ l₂, sup_ind l₁ l₂ hls₁ hls₂, u₁ ⊓ u₂, inf_ind u₁ u₂ hut₁ hut₂, Hne H, rfl⟩
[ " IsPiSystem {S}", " s ∩ t ∈ {S}", " IsPiSystem (insert ∅ S)", " s ∩ t ∈ insert ∅ S", " IsPiSystem (insert univ S)", " s ∩ t ∈ insert univ S", " IsPiSystem {s | ∃ t ∈ S, f ⁻¹' t = s}", " f ⁻¹' s ∩ f ⁻¹' t ∈ {s | ∃ t ∈ S, f ⁻¹' t = s}", " f ⁻¹' (s ∩ t) ∈ {s | ∃ t ∈ S, f ⁻¹' t = s}", " IsPiSystem (⋃...
[ " IsPiSystem {S}", " s ∩ t ∈ {S}", " IsPiSystem (insert ∅ S)", " s ∩ t ∈ insert ∅ S", " IsPiSystem (insert univ S)", " s ∩ t ∈ insert univ S", " IsPiSystem {s | ∃ t ∈ S, f ⁻¹' t = s}", " f ⁻¹' s ∩ f ⁻¹' t ∈ {s | ∃ t ∈ S, f ⁻¹' t = s}", " f ⁻¹' (s ∩ t) ∈ {s | ∃ t ∈ S, f ⁻¹' t = s}", " IsPiSystem (⋃...
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]
[ " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f [[a, b]] μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f (Icc a b) μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ico a b) μ", " Interva...
[ " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f [[a, b]] μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f (Icc a b) μ", " IntervalIntegrable f μ a b ↔ IntegrableOn f (Ico a b) μ", " Interva...
import Mathlib.Algebra.Order.Group.Abs import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Group.OrderIso import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Data.Int.Cast.Lemmas import Mathlib.Order.Interval.Set.Basic import Mathlib.Logic.Pairwise #align_import data.set.intervals.group from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" variable {α : Type*} namespace Set section PairwiseDisjoint section OrderedCommGroup variable [OrderedCommGroup α] (a b : α) @[to_additive]
Mathlib/Algebra/Order/Interval/Set/Group.lean
171
183
theorem pairwise_disjoint_Ioc_mul_zpow : Pairwise (Disjoint on fun n : ℤ => Ioc (a * b ^ n) (a * b ^ (n + 1))) := by
simp (config := { unfoldPartialApp := true }) only [Function.onFun] simp_rw [Set.disjoint_iff] intro m n hmn x hx apply hmn have hb : 1 < b := by have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_le hx.1.2 rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this have i1 := hx.1.1.trans_le hx.2.2 have i2 := hx.2.1.trans_le hx.1.2 rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2 exact le_antisymm i1 i2
[ " Pairwise (Disjoint on fun n => Ioc (a * b ^ n) (a * b ^ (n + 1)))", " Pairwise fun x y => Disjoint (Ioc (a * b ^ x) (a * b ^ (x + 1))) (Ioc (a * b ^ y) (a * b ^ (y + 1)))", " Pairwise fun x y => Ioc (a * b ^ x) (a * b ^ (x + 1)) ∩ Ioc (a * b ^ y) (a * b ^ (y + 1)) ⊆ ∅", " x ∈ ∅", " m = n", " 1 < b" ]
[ " Pairwise (Disjoint on fun n => Ioc (a * b ^ n) (a * b ^ (n + 1)))" ]
import Mathlib.MeasureTheory.Function.AEEqFun.DomAct import Mathlib.MeasureTheory.Function.LpSpace set_option autoImplicit true open MeasureTheory Filter open scoped ENNReal namespace DomMulAct variable {M N α E : Type*} [MeasurableSpace M] [MeasurableSpace N] [MeasurableSpace α] [NormedAddCommGroup E] {μ : MeasureTheory.Measure α} {p : ℝ≥0∞} section SMul variable [SMul M α] [SMulInvariantMeasure M α μ] [MeasurableSMul M α] @[to_additive] instance : SMul Mᵈᵐᵃ (Lp E p μ) where smul c f := Lp.compMeasurePreserving (mk.symm c • ·) (measurePreserving_smul _ _) f @[to_additive (attr := simp)] theorem smul_Lp_val (c : Mᵈᵐᵃ) (f : Lp E p μ) : (c • f).1 = c • f.1 := rfl @[to_additive] theorem smul_Lp_ae_eq (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • f =ᵐ[μ] (f <| mk.symm c • ·) := Lp.coeFn_compMeasurePreserving _ _ @[to_additive] theorem mk_smul_toLp (c : M) {f : α → E} (hf : Memℒp f p μ) : mk c • hf.toLp f = (hf.comp_measurePreserving <| measurePreserving_smul c μ).toLp (f <| c • ·) := rfl @[to_additive (attr := simp)] theorem smul_Lp_const [IsFiniteMeasure μ] (c : Mᵈᵐᵃ) (a : E) : c • Lp.const p μ a = Lp.const p μ a := rfl instance [SMul N α] [SMulCommClass M N α] [SMulInvariantMeasure N α μ] [MeasurableSMul N α] : SMulCommClass Mᵈᵐᵃ Nᵈᵐᵃ (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass Mᵈᵐᵃ 𝕜 (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass 𝕜 Mᵈᵐᵃ (Lp E p μ) := .symm _ _ _ -- We don't have a typeclass for additive versions of the next few lemmas -- Should we add `AddDistribAddAction` with `to_additive` both from `MulDistribMulAction` -- and `DistribMulAction`? @[to_additive] theorem smul_Lp_add (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f + g) = c • f + c • g := by rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl attribute [simp] DomAddAct.vadd_Lp_add @[to_additive (attr := simp 1001)] theorem smul_Lp_zero (c : Mᵈᵐᵃ) : c • (0 : Lp E p μ) = 0 := rfl @[to_additive] theorem smul_Lp_neg (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • (-f) = -(c • f) := by rcases f with ⟨⟨_⟩, _⟩; rfl @[to_additive] theorem smul_Lp_sub (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f - g) = c • f - c • g := by rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl instance : DistribSMul Mᵈᵐᵃ (Lp E p μ) where smul_zero _ := rfl smul_add := by rintro _ ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl -- The next few lemmas follow from the `IsometricSMul` instance if `1 ≤ p` @[to_additive (attr := simp)] theorem norm_smul_Lp (c : Mᵈᵐᵃ) (f : Lp E p μ) : ‖c • f‖ = ‖f‖ := Lp.norm_compMeasurePreserving _ _ @[to_additive (attr := simp)] theorem nnnorm_smul_Lp (c : Mᵈᵐᵃ) (f : Lp E p μ) : ‖c • f‖₊ = ‖f‖₊ := NNReal.eq <| Lp.norm_compMeasurePreserving _ _ @[to_additive (attr := simp)]
Mathlib/MeasureTheory/Function/LpSpace/DomAct/Basic.lean
99
100
theorem dist_smul_Lp (c : Mᵈᵐᵃ) (f g : Lp E p μ) : dist (c • f) (c • g) = dist f g := by
simp only [dist, ← smul_Lp_sub, norm_smul_Lp]
[ " ∀ (f g : ↥(Lp E p μ)), c • (f + g) = c • f + c • g", " c • (⟨Quot.mk Setoid.r a✝¹, property✝¹⟩ + ⟨Quot.mk Setoid.r a✝, property✝⟩) =\n c • ⟨Quot.mk Setoid.r a✝¹, property✝¹⟩ + c • ⟨Quot.mk Setoid.r a✝, property✝⟩", " c • -f = -(c • f)", " c • -⟨Quot.mk Setoid.r a✝, property✝⟩ = -(c • ⟨Quot.mk Setoid.r a✝...
[ " ∀ (f g : ↥(Lp E p μ)), c • (f + g) = c • f + c • g", " c • (⟨Quot.mk Setoid.r a✝¹, property✝¹⟩ + ⟨Quot.mk Setoid.r a✝, property✝⟩) =\n c • ⟨Quot.mk Setoid.r a✝¹, property✝¹⟩ + c • ⟨Quot.mk Setoid.r a✝, property✝⟩", " c • -f = -(c • f)", " c • -⟨Quot.mk Setoid.r a✝, property✝⟩ = -(c • ⟨Quot.mk Setoid.r a✝...
import Mathlib.Order.Monotone.Odd import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic #align_import analysis.special_functions.trigonometric.deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section open scoped Classical Topology Filter open Set Filter namespace Complex theorem hasStrictDerivAt_sin (x : ℂ) : HasStrictDerivAt sin (cos x) x := by simp only [cos, div_eq_mul_inv] convert ((((hasStrictDerivAt_id x).neg.mul_const I).cexp.sub ((hasStrictDerivAt_id x).mul_const I).cexp).mul_const I).mul_const (2 : ℂ)⁻¹ using 1 simp only [Function.comp, id] rw [sub_mul, mul_assoc, mul_assoc, I_mul_I, neg_one_mul, neg_neg, mul_one, one_mul, mul_assoc, I_mul_I, mul_neg_one, sub_neg_eq_add, add_comm] #align complex.has_strict_deriv_at_sin Complex.hasStrictDerivAt_sin theorem hasDerivAt_sin (x : ℂ) : HasDerivAt sin (cos x) x := (hasStrictDerivAt_sin x).hasDerivAt #align complex.has_deriv_at_sin Complex.hasDerivAt_sin theorem contDiff_sin {n} : ContDiff ℂ n sin := (((contDiff_neg.mul contDiff_const).cexp.sub (contDiff_id.mul contDiff_const).cexp).mul contDiff_const).div_const _ #align complex.cont_diff_sin Complex.contDiff_sin theorem differentiable_sin : Differentiable ℂ sin := fun x => (hasDerivAt_sin x).differentiableAt #align complex.differentiable_sin Complex.differentiable_sin theorem differentiableAt_sin {x : ℂ} : DifferentiableAt ℂ sin x := differentiable_sin x #align complex.differentiable_at_sin Complex.differentiableAt_sin @[simp] theorem deriv_sin : deriv sin = cos := funext fun x => (hasDerivAt_sin x).deriv #align complex.deriv_sin Complex.deriv_sin
Mathlib/Analysis/SpecialFunctions/Trigonometric/Deriv.lean
68
73
theorem hasStrictDerivAt_cos (x : ℂ) : HasStrictDerivAt cos (-sin x) x := by
simp only [sin, div_eq_mul_inv, neg_mul_eq_neg_mul] convert (((hasStrictDerivAt_id x).mul_const I).cexp.add ((hasStrictDerivAt_id x).neg.mul_const I).cexp).mul_const (2 : ℂ)⁻¹ using 1 simp only [Function.comp, id] ring
[ " HasStrictDerivAt sin x.cos x", " HasStrictDerivAt sin ((cexp (x * I) + cexp (-x * I)) * 2⁻¹) x", " (cexp (x * I) + cexp (-x * I)) * 2⁻¹ = (cexp (-id x * I) * (-1 * I) - cexp (id x * I) * (1 * I)) * I * 2⁻¹", " (cexp (x * I) + cexp (-x * I)) * 2⁻¹ = (cexp (-x * I) * (-1 * I) - cexp (x * I) * (1 * I)) * I * 2...
[ " HasStrictDerivAt sin x.cos x", " HasStrictDerivAt sin ((cexp (x * I) + cexp (-x * I)) * 2⁻¹) x", " (cexp (x * I) + cexp (-x * I)) * 2⁻¹ = (cexp (-id x * I) * (-1 * I) - cexp (id x * I) * (1 * I)) * I * 2⁻¹", " (cexp (x * I) + cexp (-x * I)) * 2⁻¹ = (cexp (-x * I) * (-1 * I) - cexp (x * I) * (1 * I)) * I * 2...
import Mathlib.MeasureTheory.Measure.Content import Mathlib.MeasureTheory.Group.Prod import Mathlib.Topology.Algebra.Group.Compact #align_import measure_theory.measure.haar.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Set Inv Function TopologicalSpace MeasurableSpace open scoped NNReal Classical ENNReal Pointwise Topology namespace MeasureTheory namespace Measure section Group variable {G : Type*} [Group G] namespace haar -- Porting note: Even in `noncomputable section`, a definition with `to_additive` require -- `noncomputable` to generate an additive definition. -- Please refer to leanprover/lean4#2077. @[to_additive addIndex "additive version of `MeasureTheory.Measure.haar.index`"] noncomputable def index (K V : Set G) : ℕ := sInf <| Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } #align measure_theory.measure.haar.index MeasureTheory.Measure.haar.index #align measure_theory.measure.haar.add_index MeasureTheory.Measure.haar.addIndex @[to_additive addIndex_empty] theorem index_empty {V : Set G} : index ∅ V = 0 := by simp only [index, Nat.sInf_eq_zero]; left; use ∅ simp only [Finset.card_empty, empty_subset, mem_setOf_eq, eq_self_iff_true, and_self_iff] #align measure_theory.measure.haar.index_empty MeasureTheory.Measure.haar.index_empty #align measure_theory.measure.haar.add_index_empty MeasureTheory.Measure.haar.addIndex_empty variable [TopologicalSpace G] @[to_additive "additive version of `MeasureTheory.Measure.haar.prehaar`"] noncomputable def prehaar (K₀ U : Set G) (K : Compacts G) : ℝ := (index (K : Set G) U : ℝ) / index K₀ U #align measure_theory.measure.haar.prehaar MeasureTheory.Measure.haar.prehaar #align measure_theory.measure.haar.add_prehaar MeasureTheory.Measure.haar.addPrehaar @[to_additive] theorem prehaar_empty (K₀ : PositiveCompacts G) {U : Set G} : prehaar (K₀ : Set G) U ⊥ = 0 := by rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div] #align measure_theory.measure.haar.prehaar_empty MeasureTheory.Measure.haar.prehaar_empty #align measure_theory.measure.haar.add_prehaar_empty MeasureTheory.Measure.haar.addPrehaar_empty @[to_additive] theorem prehaar_nonneg (K₀ : PositiveCompacts G) {U : Set G} (K : Compacts G) : 0 ≤ prehaar (K₀ : Set G) U K := by apply div_nonneg <;> norm_cast <;> apply zero_le #align measure_theory.measure.haar.prehaar_nonneg MeasureTheory.Measure.haar.prehaar_nonneg #align measure_theory.measure.haar.add_prehaar_nonneg MeasureTheory.Measure.haar.addPrehaar_nonneg @[to_additive "additive version of `MeasureTheory.Measure.haar.haarProduct`"] def haarProduct (K₀ : Set G) : Set (Compacts G → ℝ) := pi univ fun K => Icc 0 <| index (K : Set G) K₀ #align measure_theory.measure.haar.haar_product MeasureTheory.Measure.haar.haarProduct #align measure_theory.measure.haar.add_haar_product MeasureTheory.Measure.haar.addHaarProduct @[to_additive (attr := simp)] theorem mem_prehaar_empty {K₀ : Set G} {f : Compacts G → ℝ} : f ∈ haarProduct K₀ ↔ ∀ K : Compacts G, f K ∈ Icc (0 : ℝ) (index (K : Set G) K₀) := by simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_setOf_eq] #align measure_theory.measure.haar.mem_prehaar_empty MeasureTheory.Measure.haar.mem_prehaar_empty #align measure_theory.measure.haar.mem_add_prehaar_empty MeasureTheory.Measure.haar.mem_addPrehaar_empty @[to_additive "additive version of `MeasureTheory.Measure.haar.clPrehaar`"] def clPrehaar (K₀ : Set G) (V : OpenNhdsOf (1 : G)) : Set (Compacts G → ℝ) := closure <| prehaar K₀ '' { U : Set G | U ⊆ V.1 ∧ IsOpen U ∧ (1 : G) ∈ U } #align measure_theory.measure.haar.cl_prehaar MeasureTheory.Measure.haar.clPrehaar #align measure_theory.measure.haar.cl_add_prehaar MeasureTheory.Measure.haar.clAddPrehaar variable [TopologicalGroup G] @[to_additive addIndex_defined "If `K` is compact and `V` has nonempty interior, then the index `(K : V)` is well-defined, there is a finite set `t` satisfying the desired properties."]
Mathlib/MeasureTheory/Measure/Haar/Basic.lean
171
173
theorem index_defined {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : ∃ n : ℕ, n ∈ Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } := by
rcases compact_covered_by_mul_left_translates hK hV with ⟨t, ht⟩; exact ⟨t.card, t, ht, rfl⟩
[ " index ∅ V = 0", " 0 ∈ Finset.card '' {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V} ∨\n Finset.card '' {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V} = ∅", " 0 ∈ Finset.card '' {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V}", " ∅ ∈ {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V} ∧ ∅.card = 0", " prehaar (↑K₀) U ⊥ = 0", "...
[ " index ∅ V = 0", " 0 ∈ Finset.card '' {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V} ∨\n Finset.card '' {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V} = ∅", " 0 ∈ Finset.card '' {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V}", " ∅ ∈ {t | ∅ ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V} ∧ ∅.card = 0", " prehaar (↑K₀) U ⊥ = 0", "...
import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Computability.Primrec import Mathlib.Tactic.Ring import Mathlib.Tactic.Linarith #align_import computability.ackermann from "leanprover-community/mathlib"@"9b2660e1b25419042c8da10bf411aa3c67f14383" open Nat def ack : ℕ → ℕ → ℕ | 0, n => n + 1 | m + 1, 0 => ack m 1 | m + 1, n + 1 => ack m (ack (m + 1) n) #align ack ack @[simp] theorem ack_zero (n : ℕ) : ack 0 n = n + 1 := by rw [ack] #align ack_zero ack_zero @[simp] theorem ack_succ_zero (m : ℕ) : ack (m + 1) 0 = ack m 1 := by rw [ack] #align ack_succ_zero ack_succ_zero @[simp] theorem ack_succ_succ (m n : ℕ) : ack (m + 1) (n + 1) = ack m (ack (m + 1) n) := by rw [ack] #align ack_succ_succ ack_succ_succ @[simp]
Mathlib/Computability/Ackermann.lean
82
85
theorem ack_one (n : ℕ) : ack 1 n = n + 2 := by
induction' n with n IH · rfl · simp [IH]
[ " ack 0 n = n + 1", " ack (m + 1) 0 = ack m 1", " ack (m + 1) (n + 1) = ack m (ack (m + 1) n)", " ack 1 n = n + 2", " ack 1 0 = 0 + 2", " ack 1 (n + 1) = n + 1 + 2" ]
[ " ack 0 n = n + 1", " ack (m + 1) 0 = ack m 1", " ack (m + 1) (n + 1) = ack m (ack (m + 1) n)", " ack 1 n = n + 2" ]
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 RelPrime variable {α I} [CommMonoid α] [DecompositionMonoid α] {x y z : α} {s : I → α} {t : Finset I} theorem IsRelPrime.prod_left : (∀ i ∈ t, IsRelPrime (s i) x) → IsRelPrime (∏ i ∈ t, s i) x := by classical refine Finset.induction_on t (fun _ ↦ isRelPrime_one_left) fun b t hbt ih H ↦ ?_ rw [Finset.prod_insert hbt] rw [Finset.forall_mem_insert] at H exact H.1.mul_left (ih H.2) theorem IsRelPrime.prod_right : (∀ i ∈ t, IsRelPrime x (s i)) → IsRelPrime x (∏ i ∈ t, s i) := by simpa only [isRelPrime_comm] using IsRelPrime.prod_left (α := α) theorem IsRelPrime.prod_left_iff : IsRelPrime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, IsRelPrime (s i) x := by classical refine Finset.induction_on t (iff_of_true isRelPrime_one_left fun _ ↦ by simp) fun b t hbt ih ↦ ?_ rw [Finset.prod_insert hbt, IsRelPrime.mul_left_iff, ih, Finset.forall_mem_insert] theorem IsRelPrime.prod_right_iff : IsRelPrime x (∏ i ∈ t, s i) ↔ ∀ i ∈ t, IsRelPrime x (s i) := by simpa only [isRelPrime_comm] using IsRelPrime.prod_left_iff (α := α) theorem IsRelPrime.of_prod_left (H1 : IsRelPrime (∏ i ∈ t, s i) x) (i : I) (hit : i ∈ t) : IsRelPrime (s i) x := IsRelPrime.prod_left_iff.1 H1 i hit theorem IsRelPrime.of_prod_right (H1 : IsRelPrime x (∏ i ∈ t, s i)) (i : I) (hit : i ∈ t) : IsRelPrime x (s i) := IsRelPrime.prod_right_iff.1 H1 i hit
Mathlib/RingTheory/Coprime/Lemmas.lean
261
275
theorem Finset.prod_dvd_of_isRelPrime : (t : Set I).Pairwise (IsRelPrime on s) → (∀ i ∈ t, s i ∣ z) → (∏ x ∈ t, s x) ∣ z := by
classical exact Finset.induction_on t (fun _ _ ↦ one_dvd z) (by intro a r har ih Hs Hs1 rw [Finset.prod_insert har] have aux1 : a ∈ (↑(insert a r) : Set I) := Finset.mem_insert_self a r refine (IsRelPrime.prod_right fun i hir ↦ Hs aux1 (Finset.mem_insert_of_mem hir) <| by rintro rfl exact har hir).mul_dvd (Hs1 a aux1) (ih (Hs.mono ?_) fun i hi ↦ Hs1 i <| Finset.mem_insert_of_mem hi) simp only [Finset.coe_insert, Set.subset_insert])
[ " (∀ i ∈ t, IsRelPrime (s i) x) → IsRelPrime (∏ i ∈ t, s i) x", " IsRelPrime (∏ i ∈ insert b t, s i) x", " IsRelPrime (s b * ∏ x ∈ t, s x) x", " (∀ i ∈ t, IsRelPrime x (s i)) → IsRelPrime x (∏ i ∈ t, s i)", " IsRelPrime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, IsRelPrime (s i) x", " x✝ ∈ ∅ → IsRelPrime (s x✝) x", " ...
[ " (∀ i ∈ t, IsRelPrime (s i) x) → IsRelPrime (∏ i ∈ t, s i) x", " IsRelPrime (∏ i ∈ insert b t, s i) x", " IsRelPrime (s b * ∏ x ∈ t, s x) x", " (∀ i ∈ t, IsRelPrime x (s i)) → IsRelPrime x (∏ i ∈ t, s i)", " IsRelPrime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, IsRelPrime (s i) x", " x✝ ∈ ∅ → IsRelPrime (s x✝) x", " ...
import Mathlib.RingTheory.DedekindDomain.Ideal import Mathlib.RingTheory.IsAdjoinRoot #align_import number_theory.kummer_dedekind from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83" variable (R : Type*) {S : Type*} [CommRing R] [CommRing S] [Algebra R S] open Ideal Polynomial DoubleQuot UniqueFactorizationMonoid Algebra RingHom local notation:max R "<" x:max ">" => adjoin R ({x} : Set S) def conductor (x : S) : Ideal S where carrier := {a | ∀ b : S, a * b ∈ R<x>} zero_mem' b := by simpa only [zero_mul] using Subalgebra.zero_mem _ add_mem' ha hb c := by simpa only [add_mul] using Subalgebra.add_mem _ (ha c) (hb c) smul_mem' c a ha b := by simpa only [smul_eq_mul, mul_left_comm, mul_assoc] using ha (c * b) #align conductor conductor variable {R} {x : S} theorem conductor_eq_of_eq {y : S} (h : (R<x> : Set S) = R<y>) : conductor R x = conductor R y := Ideal.ext fun _ => forall_congr' fun _ => Set.ext_iff.mp h _ #align conductor_eq_of_eq conductor_eq_of_eq theorem conductor_subset_adjoin : (conductor R x : Set S) ⊆ R<x> := fun y hy => by simpa only [mul_one] using hy 1 #align conductor_subset_adjoin conductor_subset_adjoin theorem mem_conductor_iff {y : S} : y ∈ conductor R x ↔ ∀ b : S, y * b ∈ R<x> := ⟨fun h => h, fun h => h⟩ #align mem_conductor_iff mem_conductor_iff theorem conductor_eq_top_of_adjoin_eq_top (h : R<x> = ⊤) : conductor R x = ⊤ := by simp only [Ideal.eq_top_iff_one, mem_conductor_iff, h, mem_top, forall_const] #align conductor_eq_top_of_adjoin_eq_top conductor_eq_top_of_adjoin_eq_top theorem conductor_eq_top_of_powerBasis (pb : PowerBasis R S) : conductor R pb.gen = ⊤ := conductor_eq_top_of_adjoin_eq_top pb.adjoin_gen_eq_top #align conductor_eq_top_of_power_basis conductor_eq_top_of_powerBasis open IsLocalization in lemma mem_coeSubmodule_conductor {L} [CommRing L] [Algebra S L] [Algebra R L] [IsScalarTower R S L] [NoZeroSMulDivisors S L] {x : S} {y : L} : y ∈ coeSubmodule L (conductor R x) ↔ ∀ z : S, y * (algebraMap S L) z ∈ Algebra.adjoin R {algebraMap S L x} := by cases subsingleton_or_nontrivial L · rw [Subsingleton.elim (coeSubmodule L _) ⊤, Subsingleton.elim (Algebra.adjoin R _) ⊤]; simp trans ∀ z, y * (algebraMap S L) z ∈ (Algebra.adjoin R {x}).map (IsScalarTower.toAlgHom R S L) · simp only [coeSubmodule, Submodule.mem_map, Algebra.linearMap_apply, Subalgebra.mem_map, IsScalarTower.coe_toAlgHom'] constructor · rintro ⟨y, hy, rfl⟩ z exact ⟨_, hy z, map_mul _ _ _⟩ · intro H obtain ⟨y, _, e⟩ := H 1 rw [_root_.map_one, mul_one] at e subst e simp only [← _root_.map_mul, (NoZeroSMulDivisors.algebraMap_injective S L).eq_iff, exists_eq_right] at H exact ⟨_, H, rfl⟩ · rw [AlgHom.map_adjoin, Set.image_singleton]; rfl variable {I : Ideal R} theorem prod_mem_ideal_map_of_mem_conductor {p : R} {z : S} (hp : p ∈ Ideal.comap (algebraMap R S) (conductor R x)) (hz' : z ∈ I.map (algebraMap R S)) : algebraMap R S p * z ∈ algebraMap R<x> S '' ↑(I.map (algebraMap R R<x>)) := by rw [Ideal.map, Ideal.span, Finsupp.mem_span_image_iff_total] at hz' obtain ⟨l, H, H'⟩ := hz' rw [Finsupp.total_apply] at H' rw [← H', mul_comm, Finsupp.sum_mul] have lem : ∀ {a : R}, a ∈ I → l a • algebraMap R S a * algebraMap R S p ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>) := by intro a ha rw [Algebra.id.smul_eq_mul, mul_assoc, mul_comm, mul_assoc, Set.mem_image] refine Exists.intro (algebraMap R R<x> a * ⟨l a * algebraMap R S p, show l a * algebraMap R S p ∈ R<x> from ?h⟩) ?_ case h => rw [mul_comm] exact mem_conductor_iff.mp (Ideal.mem_comap.mp hp) _ · refine ⟨?_, ?_⟩ · rw [mul_comm] apply Ideal.mul_mem_left (I.map (algebraMap R R<x>)) _ (Ideal.mem_map_of_mem _ ha) · simp only [RingHom.map_mul, mul_comm (algebraMap R S p) (l a)] rfl refine Finset.sum_induction _ (fun u => u ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>)) (fun a b => ?_) ?_ ?_ · rintro ⟨z, hz, rfl⟩ ⟨y, hy, rfl⟩ rw [← RingHom.map_add] exact ⟨z + y, Ideal.add_mem _ (SetLike.mem_coe.mp hz) hy, rfl⟩ · exact ⟨0, SetLike.mem_coe.mpr <| Ideal.zero_mem _, RingHom.map_zero _⟩ · intro y hy exact lem ((Finsupp.mem_supported _ l).mp H hy) #align prod_mem_ideal_map_of_mem_conductor prod_mem_ideal_map_of_mem_conductor
Mathlib/NumberTheory/KummerDedekind.lean
152
186
theorem comap_map_eq_map_adjoin_of_coprime_conductor (hx : (conductor R x).comap (algebraMap R S) ⊔ I = ⊤) (h_alg : Function.Injective (algebraMap R<x> S)) : (I.map (algebraMap R S)).comap (algebraMap R<x> S) = I.map (algebraMap R R<x>) := by
apply le_antisymm · -- This is adapted from [Neukirch1992]. Let `C = (conductor R x)`. The idea of the proof -- is that since `I` and `C ∩ R` are coprime, we have -- `(I * S) ∩ R<x> ⊆ (I + C) * ((I * S) ∩ R<x>) ⊆ I * R<x> + I * C * S ⊆ I * R<x>`. intro y hy obtain ⟨z, hz⟩ := y obtain ⟨p, hp, q, hq, hpq⟩ := Submodule.mem_sup.mp ((Ideal.eq_top_iff_one _).mp hx) have temp : algebraMap R S p * z + algebraMap R S q * z = z := by simp only [← add_mul, ← RingHom.map_add (algebraMap R S), hpq, map_one, one_mul] suffices z ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>) ↔ (⟨z, hz⟩ : R<x>) ∈ I.map (algebraMap R R<x>) by rw [← this, ← temp] obtain ⟨a, ha⟩ := (Set.mem_image _ _ _).mp (prod_mem_ideal_map_of_mem_conductor hp (show z ∈ I.map (algebraMap R S) by rwa [Ideal.mem_comap] at hy)) use a + algebraMap R R<x> q * ⟨z, hz⟩ refine ⟨Ideal.add_mem (I.map (algebraMap R R<x>)) ha.left ?_, by simp only [ha.right, map_add, AlgHom.map_mul, add_right_inj]; rfl⟩ rw [mul_comm] exact Ideal.mul_mem_left (I.map (algebraMap R R<x>)) _ (Ideal.mem_map_of_mem _ hq) refine ⟨fun h => ?_, fun h => (Set.mem_image _ _ _).mpr (Exists.intro ⟨z, hz⟩ ⟨by simp [h], rfl⟩)⟩ obtain ⟨x₁, hx₁, hx₂⟩ := (Set.mem_image _ _ _).mp h have : x₁ = ⟨z, hz⟩ := by apply h_alg simp [hx₂] rfl rwa [← this] · -- The converse inclusion is trivial have : algebraMap R S = (algebraMap _ S).comp (algebraMap R R<x>) := by ext; rfl rw [this, ← Ideal.map_map] apply Ideal.le_comap_map
[ " (a✝ + b✝) * c ∈ adjoin R {x}", " 0 * b ∈ adjoin R {x}", " c • a * b ∈ adjoin R {x}", " y ∈ ↑(adjoin R {x})", " conductor R x = ⊤", " y ∈ coeSubmodule L (conductor R x) ↔ ∀ (z : S), y * (algebraMap S L) z ∈ adjoin R {(algebraMap S L) x}", " y ∈ ⊤ ↔ ∀ (z : S), y * (algebraMap S L) z ∈ ⊤", " y ∈ coeSub...
[ " (a✝ + b✝) * c ∈ adjoin R {x}", " 0 * b ∈ adjoin R {x}", " c • a * b ∈ adjoin R {x}", " y ∈ ↑(adjoin R {x})", " conductor R x = ⊤", " y ∈ coeSubmodule L (conductor R x) ↔ ∀ (z : S), y * (algebraMap S L) z ∈ adjoin R {(algebraMap S L) x}", " y ∈ ⊤ ↔ ∀ (z : S), y * (algebraMap S L) z ∈ ⊤", " y ∈ coeSub...
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.GroupTheory.FreeAbelianGroup import Mathlib.GroupTheory.FreeGroup.IsFreeGroup import Mathlib.LinearAlgebra.Dimension.StrongRankCondition #align_import group_theory.free_abelian_group_finsupp from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" noncomputable section variable {X : Type*} def FreeAbelianGroup.toFinsupp : FreeAbelianGroup X →+ X →₀ ℤ := FreeAbelianGroup.lift fun x => Finsupp.single x (1 : ℤ) #align free_abelian_group.to_finsupp FreeAbelianGroup.toFinsupp def Finsupp.toFreeAbelianGroup : (X →₀ ℤ) →+ FreeAbelianGroup X := Finsupp.liftAddHom fun x => (smulAddHom ℤ (FreeAbelianGroup X)).flip (FreeAbelianGroup.of x) #align finsupp.to_free_abelian_group Finsupp.toFreeAbelianGroup open Finsupp FreeAbelianGroup @[simp] theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) : Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by ext simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul, toFreeAbelianGroup, Finsupp.liftAddHom_apply_single] #align finsupp.to_free_abelian_group_comp_single_add_hom Finsupp.toFreeAbelianGroup_comp_singleAddHom @[simp] theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup : toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by ext x y; simp only [AddMonoidHom.id_comp] rw [AddMonoidHom.comp_assoc, Finsupp.toFreeAbelianGroup_comp_singleAddHom] simp only [toFinsupp, AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul, lift.of, AddMonoidHom.flip_apply, smulAddHom_apply, AddMonoidHom.id_apply] #align free_abelian_group.to_finsupp_comp_to_free_abelian_group FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup @[simp] theorem Finsupp.toFreeAbelianGroup_comp_toFinsupp : toFreeAbelianGroup.comp toFinsupp = AddMonoidHom.id (FreeAbelianGroup X) := by ext rw [toFreeAbelianGroup, toFinsupp, AddMonoidHom.comp_apply, lift.of, liftAddHom_apply_single, AddMonoidHom.flip_apply, smulAddHom_apply, one_smul, AddMonoidHom.id_apply] #align finsupp.to_free_abelian_group_comp_to_finsupp Finsupp.toFreeAbelianGroup_comp_toFinsupp @[simp] theorem Finsupp.toFreeAbelianGroup_toFinsupp {X} (x : FreeAbelianGroup X) : Finsupp.toFreeAbelianGroup (FreeAbelianGroup.toFinsupp x) = x := by rw [← AddMonoidHom.comp_apply, Finsupp.toFreeAbelianGroup_comp_toFinsupp, AddMonoidHom.id_apply] #align finsupp.to_free_abelian_group_to_finsupp Finsupp.toFreeAbelianGroup_toFinsupp namespace FreeAbelianGroup open Finsupp @[simp]
Mathlib/GroupTheory/FreeAbelianGroupFinsupp.lean
82
83
theorem toFinsupp_of (x : X) : toFinsupp (of x) = Finsupp.single x 1 := by
simp only [toFinsupp, lift.of]
[ " toFreeAbelianGroup.comp (singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)", " (toFreeAbelianGroup.comp (singleAddHom x)) 1 = ((smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)) 1", " toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ)", " (((toFinsupp.comp toFreeAbelianGroup).comp (s...
[ " toFreeAbelianGroup.comp (singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)", " (toFreeAbelianGroup.comp (singleAddHom x)) 1 = ((smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)) 1", " toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ)", " (((toFinsupp.comp toFreeAbelianGroup).comp (s...
import Mathlib.MeasureTheory.Group.GeometryOfNumbers import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional local notation "E" K => ({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ) section convexBodySum open ENNReal MeasureTheory Fintype open scoped Real Classical NNReal variable [NumberField K] (B : ℝ) variable {K} noncomputable abbrev convexBodySumFun (x : E K) : ℝ := ∑ w, mult w * normAtPlace w x theorem convexBodySumFun_apply (x : E K) : convexBodySumFun x = ∑ w, mult w * normAtPlace w x := rfl theorem convexBodySumFun_apply' (x : E K) : convexBodySumFun x = ∑ w, ‖x.1 w‖ + 2 * ∑ w, ‖x.2 w‖ := by simp_rw [convexBodySumFun_apply, ← Finset.sum_add_sum_compl {w | IsReal w}.toFinset, Set.toFinset_setOf, Finset.compl_filter, not_isReal_iff_isComplex, ← Finset.subtype_univ, ← Finset.univ.sum_subtype_eq_sum_filter, Finset.mul_sum] congr · ext w rw [mult, if_pos w.prop, normAtPlace_apply_isReal, Nat.cast_one, one_mul] · ext w rw [mult, if_neg (not_isReal_iff_isComplex.mpr w.prop), normAtPlace_apply_isComplex, Nat.cast_ofNat] theorem convexBodySumFun_nonneg (x : E K) : 0 ≤ convexBodySumFun x := Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _)) theorem convexBodySumFun_neg (x : E K) : convexBodySumFun (- x) = convexBodySumFun x := by simp_rw [convexBodySumFun, normAtPlace_neg] theorem convexBodySumFun_add_le (x y : E K) : convexBodySumFun (x + y) ≤ convexBodySumFun x + convexBodySumFun y := by simp_rw [convexBodySumFun, ← Finset.sum_add_distrib, ← mul_add] exact Finset.sum_le_sum fun _ _ ↦ mul_le_mul_of_nonneg_left (normAtPlace_add_le _ x y) (Nat.cast_pos.mpr mult_pos).le
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean
312
314
theorem convexBodySumFun_smul (c : ℝ) (x : E K) : convexBodySumFun (c • x) = |c| * convexBodySumFun x := by
simp_rw [convexBodySumFun, normAtPlace_smul, ← mul_assoc, mul_comm, Finset.mul_sum, mul_assoc]
[ " convexBodySumFun x = ∑ w : { w // w.IsReal }, ‖x.1 w‖ + 2 * ∑ w : { w // w.IsComplex }, ‖x.2 w‖", " ∑ x_1 ∈ Finset.subtype (fun x => x.IsReal) Finset.univ, ↑(↑x_1).mult * (normAtPlace ↑x_1) x +\n ∑ x_1 ∈ Finset.subtype (fun x => x.IsComplex) Finset.univ, ↑(↑x_1).mult * (normAtPlace ↑x_1) x =\n ∑ x_1 ∈ F...
[ " convexBodySumFun x = ∑ w : { w // w.IsReal }, ‖x.1 w‖ + 2 * ∑ w : { w // w.IsComplex }, ‖x.2 w‖", " ∑ x_1 ∈ Finset.subtype (fun x => x.IsReal) Finset.univ, ↑(↑x_1).mult * (normAtPlace ↑x_1) x +\n ∑ x_1 ∈ Finset.subtype (fun x => x.IsComplex) Finset.univ, ↑(↑x_1).mult * (normAtPlace ↑x_1) x =\n ∑ x_1 ∈ F...
import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.RingTheory.Localization.FractionRing #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section CommRing variable [CommRing R] [IsDomain R] {p q : R[X]} section Roots open Multiset Finset noncomputable def roots (p : R[X]) : Multiset R := haveI := Classical.decEq R haveI := Classical.dec (p = 0) if h : p = 0 then ∅ else Classical.choose (exists_multiset_roots h) #align polynomial.roots Polynomial.roots theorem roots_def [DecidableEq R] (p : R[X]) [Decidable (p = 0)] : p.roots = if h : p = 0 then ∅ else Classical.choose (exists_multiset_roots h) := by -- porting noteL `‹_›` doesn't work for instance arguments rename_i iR ip0 obtain rfl := Subsingleton.elim iR (Classical.decEq R) obtain rfl := Subsingleton.elim ip0 (Classical.dec (p = 0)) rfl #align polynomial.roots_def Polynomial.roots_def @[simp] theorem roots_zero : (0 : R[X]).roots = 0 := dif_pos rfl #align polynomial.roots_zero Polynomial.roots_zero theorem card_roots (hp0 : p ≠ 0) : (Multiset.card (roots p) : WithBot ℕ) ≤ degree p := by classical unfold roots rw [dif_neg hp0] exact (Classical.choose_spec (exists_multiset_roots hp0)).1 #align polynomial.card_roots Polynomial.card_roots
Mathlib/Algebra/Polynomial/Roots.lean
76
79
theorem card_roots' (p : R[X]) : Multiset.card p.roots ≤ natDegree p := by
by_cases hp0 : p = 0 · simp [hp0] exact WithBot.coe_le_coe.1 (le_trans (card_roots hp0) (le_of_eq <| degree_eq_natDegree hp0))
[ " p.roots = if h : p = 0 then ∅ else Classical.choose ⋯", " ↑(Multiset.card p.roots) ≤ p.degree", " ↑(Multiset.card (if h : p = 0 then ∅ else Classical.choose ⋯)) ≤ p.degree", " ↑(Multiset.card (Classical.choose ⋯)) ≤ p.degree", " Multiset.card p.roots ≤ p.natDegree" ]
[ " p.roots = if h : p = 0 then ∅ else Classical.choose ⋯", " ↑(Multiset.card p.roots) ≤ p.degree", " ↑(Multiset.card (if h : p = 0 then ∅ else Classical.choose ⋯)) ≤ p.degree", " ↑(Multiset.card (Classical.choose ⋯)) ≤ p.degree", " Multiset.card p.roots ≤ p.natDegree" ]
import Mathlib.Computability.NFA #align_import computability.epsilon_NFA from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33" open Set open Computability -- "ε_NFA" set_option linter.uppercaseLean3 false universe u v structure εNFA (α : Type u) (σ : Type v) where step : σ → Option α → Set σ start : Set σ accept : Set σ #align ε_NFA εNFA variable {α : Type u} {σ σ' : Type v} (M : εNFA α σ) {S : Set σ} {x : List α} {s : σ} {a : α} namespace εNFA inductive εClosure (S : Set σ) : Set σ | base : ∀ s ∈ S, εClosure S s | step : ∀ (s), ∀ t ∈ M.step s none, εClosure S s → εClosure S t #align ε_NFA.ε_closure εNFA.εClosure @[simp] theorem subset_εClosure (S : Set σ) : S ⊆ M.εClosure S := εClosure.base #align ε_NFA.subset_ε_closure εNFA.subset_εClosure @[simp] theorem εClosure_empty : M.εClosure ∅ = ∅ := eq_empty_of_forall_not_mem fun s hs ↦ by induction hs <;> assumption #align ε_NFA.ε_closure_empty εNFA.εClosure_empty @[simp] theorem εClosure_univ : M.εClosure univ = univ := eq_univ_of_univ_subset <| subset_εClosure _ _ #align ε_NFA.ε_closure_univ εNFA.εClosure_univ def stepSet (S : Set σ) (a : α) : Set σ := ⋃ s ∈ S, M.εClosure (M.step s a) #align ε_NFA.step_set εNFA.stepSet variable {M} @[simp] theorem mem_stepSet_iff : s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.εClosure (M.step t a) := by simp_rw [stepSet, mem_iUnion₂, exists_prop] #align ε_NFA.mem_step_set_iff εNFA.mem_stepSet_iff @[simp] theorem stepSet_empty (a : α) : M.stepSet ∅ a = ∅ := by simp_rw [stepSet, mem_empty_iff_false, iUnion_false, iUnion_empty] #align ε_NFA.step_set_empty εNFA.stepSet_empty variable (M) def evalFrom (start : Set σ) : List α → Set σ := List.foldl M.stepSet (M.εClosure start) #align ε_NFA.eval_from εNFA.evalFrom @[simp] theorem evalFrom_nil (S : Set σ) : M.evalFrom S [] = M.εClosure S := rfl #align ε_NFA.eval_from_nil εNFA.evalFrom_nil @[simp] theorem evalFrom_singleton (S : Set σ) (a : α) : M.evalFrom S [a] = M.stepSet (M.εClosure S) a := rfl #align ε_NFA.eval_from_singleton εNFA.evalFrom_singleton @[simp]
Mathlib/Computability/EpsilonNFA.lean
110
112
theorem evalFrom_append_singleton (S : Set σ) (x : List α) (a : α) : M.evalFrom S (x ++ [a]) = M.stepSet (M.evalFrom S x) a := by
rw [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]
[ " False", " s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.εClosure (M.step t (some a))", " M.stepSet ∅ a = ∅", " M.evalFrom S (x ++ [a]) = M.stepSet (M.evalFrom S x) a" ]
[ " False", " s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.εClosure (M.step t (some a))", " M.stepSet ∅ a = ∅", " M.evalFrom S (x ++ [a]) = M.stepSet (M.evalFrom S x) a" ]
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ #align real.deriv_arcsin_aux Real.deriv_arcsin_aux theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x := (deriv_arcsin_aux h₁ h₂).1 #align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasDerivAt arcsin (1 / √(1 - x ^ 2)) x := (hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt #align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x := (deriv_arcsin_aux h₁ h₂).2.of_le le_top #align real.cont_diff_at_arcsin Real.contDiffAt_arcsin theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by rcases eq_or_ne x 1 with (rfl | h') · convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_one_le] · exact (hasDerivAt_arcsin h h').hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by rcases em (x = -1) with (rfl | h') · convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_le_neg_one] · exact (hasDerivAt_arcsin h' h).hasDerivWithinAt #align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
82
90
theorem differentiableWithinAt_arcsin_Ici {x : ℝ} : DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩ rintro h rfl have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using sin_arcsin' have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp) simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
[ " HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x", " 1 - x ^ 2 < 0", " HasStrictDerivAt arcsin 0 x ∧ ContDiffAt ℝ ⊤ arcsin x", " 0 < 1 - x ^ 2", " HasStrictDerivAt arcsin x.arcsin.cos⁻¹ x ∧ ContDiffAt ℝ ⊤ arcsin x", " HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x", " HasDe...
[ " HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x", " 1 - x ^ 2 < 0", " HasStrictDerivAt arcsin 0 x ∧ ContDiffAt ℝ ⊤ arcsin x", " 0 < 1 - x ^ 2", " HasStrictDerivAt arcsin x.arcsin.cos⁻¹ x ∧ ContDiffAt ℝ ⊤ arcsin x", " HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x", " HasDe...
import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.Basic #align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9" namespace Set variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)
Mathlib/Algebra/Order/Interval/Set/Monoid.lean
27
32
theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by
refine ⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩ obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h) rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h exact ⟨a + c, h, by rw [add_right_comm]⟩
[ " BijOn (fun x => x + d) (Ici a) (Ici (a + d))", " x✝ ∈ (fun x => x + d) '' Ici a", " a + d + c ∈ (fun x => x + d) '' Ici a", " (fun x => x + d) (a + c) = a + d + c" ]
[ " BijOn (fun x => x + d) (Ici a) (Ici (a + d))" ]
import Mathlib.Algebra.Group.Pi.Basic import Mathlib.Order.Interval.Set.Basic import Mathlib.Order.Interval.Set.UnorderedInterval import Mathlib.Data.Set.Lattice #align_import data.set.intervals.pi from "leanprover-community/mathlib"@"e4bc74cbaf429d706cb9140902f7ca6c431e75a4" -- Porting note: Added, since dot notation no longer works on `Function.update` open Function variable {ι : Type*} {α : ι → Type*} namespace Set section PiPreorder variable [∀ i, Preorder (α i)] (x y : ∀ i, α i) @[simp] theorem pi_univ_Ici : (pi univ fun i ↦ Ici (x i)) = Ici x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Ici Set.pi_univ_Ici @[simp] theorem pi_univ_Iic : (pi univ fun i ↦ Iic (x i)) = Iic x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Iic Set.pi_univ_Iic @[simp] theorem pi_univ_Icc : (pi univ fun i ↦ Icc (x i) (y i)) = Icc x y := ext fun y ↦ by simp [Pi.le_def, forall_and] #align set.pi_univ_Icc Set.pi_univ_Icc theorem piecewise_mem_Icc {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : ∀ i ∈ s, f₁ i ∈ Icc (g₁ i) (g₂ i)) (h₂ : ∀ i ∉ s, f₂ i ∈ Icc (g₁ i) (g₂ i)) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := ⟨le_piecewise (fun i hi ↦ (h₁ i hi).1) fun i hi ↦ (h₂ i hi).1, piecewise_le (fun i hi ↦ (h₁ i hi).2) fun i hi ↦ (h₂ i hi).2⟩ #align set.piecewise_mem_Icc Set.piecewise_mem_Icc theorem piecewise_mem_Icc' {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : f₁ ∈ Icc g₁ g₂) (h₂ : f₂ ∈ Icc g₁ g₂) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := piecewise_mem_Icc (fun _ _ ↦ ⟨h₁.1 _, h₁.2 _⟩) fun _ _ ↦ ⟨h₂.1 _, h₂.2 _⟩ #align set.piecewise_mem_Icc' Set.piecewise_mem_Icc' variable [DecidableEq ι] open Function (update) theorem pi_univ_Ioc_update_left {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : x i₀ ≤ m) : (pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) = { z | m < z i₀ } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by have : Ioc m (y i₀) = Ioi m ∩ Ioc (x i₀) (y i₀) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, ← inter_assoc, inter_eq_self_of_subset_left (Ioi_subset_Ioi hm)] simp_rw [univ_pi_update i₀ _ _ fun i z ↦ Ioc z (y i), ← pi_inter_compl ({i₀} : Set ι), singleton_pi', ← inter_assoc, this] rfl #align set.pi_univ_Ioc_update_left Set.pi_univ_Ioc_update_left theorem pi_univ_Ioc_update_right {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : m ≤ y i₀) : (pi univ fun i ↦ Ioc (x i) (update y i₀ m i)) = { z | z i₀ ≤ m } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by have : Ioc (x i₀) m = Iic m ∩ Ioc (x i₀) (y i₀) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, inter_left_comm, inter_eq_self_of_subset_left (Iic_subset_Iic.2 hm)] simp_rw [univ_pi_update i₀ y m fun i z ↦ Ioc (x i) z, ← pi_inter_compl ({i₀} : Set ι), singleton_pi', ← inter_assoc, this] rfl #align set.pi_univ_Ioc_update_right Set.pi_univ_Ioc_update_right
Mathlib/Order/Interval/Set/Pi.lean
112
118
theorem disjoint_pi_univ_Ioc_update_left_right {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} : Disjoint (pi univ fun i ↦ Ioc (x i) (update y i₀ m i)) (pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) := by
rw [disjoint_left] rintro z h₁ h₂ refine (h₁ i₀ (mem_univ _)).2.not_lt ?_ simpa only [Function.update_same] using (h₂ i₀ (mem_univ _)).1
[ " (y ∈ univ.pi fun i => Ici (x i)) ↔ y ∈ Ici x", " (y ∈ univ.pi fun i => Iic (x i)) ↔ y ∈ Iic x", " (y ∈ univ.pi fun i => Icc (x i) (y✝ i)) ↔ y ∈ Icc x y✝", " (univ.pi fun i => Ioc (update x i₀ m i) (y i)) = {z | m < z i₀} ∩ univ.pi fun i => Ioc (x i) (y i)", " Ioc m (y i₀) = Ioi m ∩ Ioc (x i₀) (y i₀)", "...
[ " (y ∈ univ.pi fun i => Ici (x i)) ↔ y ∈ Ici x", " (y ∈ univ.pi fun i => Iic (x i)) ↔ y ∈ Iic x", " (y ∈ univ.pi fun i => Icc (x i) (y✝ i)) ↔ y ∈ Icc x y✝", " (univ.pi fun i => Ioc (update x i₀ m i) (y i)) = {z | m < z i₀} ∩ univ.pi fun i => Ioc (x i) (y i)", " Ioc m (y i₀) = Ioi m ∩ Ioc (x i₀) (y i₀)", "...
import Mathlib.Algebra.Module.Card import Mathlib.SetTheory.Cardinal.CountableCover import Mathlib.SetTheory.Cardinal.Continuum import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Topology.MetricSpace.Perfect universe u v open Filter Pointwise Set Function Cardinal open scoped Cardinal Topology theorem continuum_le_cardinal_of_nontriviallyNormedField (𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by rcases this with ⟨f, -, -, f_inj⟩ simpa using lift_mk_le_lift_mk_of_injective f_inj apply Perfect.exists_nat_bool_injection _ univ_nonempty refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩ rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩ have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) := tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc) rw [add_zero] at A have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU rcases B.exists with ⟨n, hn⟩ refine ⟨x + c^n, by simpa using hn, ?_⟩ simp only [ne_eq, add_right_eq_self] apply pow_ne_zero simpa using c_pos theorem continuum_le_cardinal_of_module (𝕜 : Type u) (E : Type v) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nontrivial E] : 𝔠 ≤ #E := by have A : lift.{v} (𝔠 : Cardinal.{u}) ≤ lift.{v} (#𝕜) := by simpa using continuum_le_cardinal_of_nontriviallyNormedField 𝕜 simpa using A.trans (Cardinal.mk_le_of_module 𝕜 E) lemma cardinal_eq_of_mem_nhds_zero {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : s ∈ 𝓝 (0 : E)) : #s = #E := by obtain ⟨c, hc⟩ : ∃ x : 𝕜 , 1 < ‖x‖ := NormedField.exists_lt_norm 𝕜 1 have cn_ne : ∀ n, c^n ≠ 0 := by intro n apply pow_ne_zero rintro rfl simp only [norm_zero] at hc exact lt_irrefl _ (hc.trans zero_lt_one) have A : ∀ (x : E), ∀ᶠ n in (atTop : Filter ℕ), x ∈ c^n • s := by intro x have : Tendsto (fun n ↦ (c^n) ⁻¹ • x) atTop (𝓝 ((0 : 𝕜) • x)) := by have : Tendsto (fun n ↦ (c^n)⁻¹) atTop (𝓝 0) := by simp_rw [← inv_pow] apply tendsto_pow_atTop_nhds_zero_of_norm_lt_one rw [norm_inv] exact inv_lt_one hc exact Tendsto.smul_const this x rw [zero_smul] at this filter_upwards [this hs] with n (hn : (c ^ n)⁻¹ • x ∈ s) exact (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).2 hn have B : ∀ n, #(c^n • s :) = #s := by intro n have : (c^n • s :) ≃ s := { toFun := fun x ↦ ⟨(c^n)⁻¹ • x.1, (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).1 x.2⟩ invFun := fun x ↦ ⟨(c^n) • x.1, smul_mem_smul_set x.2⟩ left_inv := fun x ↦ by simp [smul_smul, mul_inv_cancel (cn_ne n)] right_inv := fun x ↦ by simp [smul_smul, inv_mul_cancel (cn_ne n)] } exact Cardinal.mk_congr this apply (Cardinal.mk_of_countable_eventually_mem A B).symm theorem cardinal_eq_of_mem_nhds {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} {x : E} (hs : s ∈ 𝓝 x) : #s = #E := by let g := Homeomorph.addLeft x let t := g ⁻¹' s have : t ∈ 𝓝 0 := g.continuous.continuousAt.preimage_mem_nhds (by simpa [g] using hs) have A : #t = #E := cardinal_eq_of_mem_nhds_zero 𝕜 this have B : #t = #s := Cardinal.mk_subtype_of_equiv s g.toEquiv rwa [B] at A theorem cardinal_eq_of_isOpen {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : IsOpen s) (h's : s.Nonempty) : #s = #E := by rcases h's with ⟨x, hx⟩ exact cardinal_eq_of_mem_nhds 𝕜 (hs.mem_nhds hx)
Mathlib/Topology/Algebra/Module/Cardinality.lean
119
123
theorem continuum_le_cardinal_of_isOpen {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nontrivial E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : IsOpen s) (h's : s.Nonempty) : 𝔠 ≤ #s := by
simpa [cardinal_eq_of_isOpen 𝕜 hs h's] using continuum_le_cardinal_of_module 𝕜 E
[ " 𝔠 ≤ #𝕜", " ∃ f, range f ⊆ Set.univ ∧ Continuous f ∧ Injective f", " Perfect Set.univ", " ∃ y ∈ U ∩ Set.univ, y ≠ x", " x + c ^ n ∈ U ∩ Set.univ", " x + c ^ n ≠ x", " ¬c ^ n = 0", " c ≠ 0", " 𝔠 ≤ #E", " lift.{v, u} 𝔠 ≤ lift.{v, u} #𝕜", " #↑s = #E", " ∀ (n : ℕ), c ^ n ≠ 0", " c ^ n ≠ 0"...
[ " 𝔠 ≤ #𝕜", " ∃ f, range f ⊆ Set.univ ∧ Continuous f ∧ Injective f", " Perfect Set.univ", " ∃ y ∈ U ∩ Set.univ, y ≠ x", " x + c ^ n ∈ U ∩ Set.univ", " x + c ^ n ≠ x", " ¬c ^ n = 0", " c ≠ 0", " 𝔠 ≤ #E", " lift.{v, u} 𝔠 ≤ lift.{v, u} #𝕜", " #↑s = #E", " ∀ (n : ℕ), c ^ n ≠ 0", " c ^ n ≠ 0"...
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv #align_import linear_algebra.affine_space.midpoint from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open AffineMap AffineEquiv section variable (R : Type*) {V V' P P' : Type*} [Ring R] [Invertible (2 : R)] [AddCommGroup V] [Module R V] [AddTorsor V P] [AddCommGroup V'] [Module R V'] [AddTorsor V' P'] def midpoint (x y : P) : P := lineMap x y (⅟ 2 : R) #align midpoint midpoint variable {R} {x y z : P} @[simp] theorem AffineMap.map_midpoint (f : P →ᵃ[R] P') (a b : P) : f (midpoint R a b) = midpoint R (f a) (f b) := f.apply_lineMap a b _ #align affine_map.map_midpoint AffineMap.map_midpoint @[simp] theorem AffineEquiv.map_midpoint (f : P ≃ᵃ[R] P') (a b : P) : f (midpoint R a b) = midpoint R (f a) (f b) := f.apply_lineMap a b _ #align affine_equiv.map_midpoint AffineEquiv.map_midpoint theorem AffineEquiv.pointReflection_midpoint_left (x y : P) : pointReflection R (midpoint R x y) x = y := by rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul, mul_invOf_self, one_smul, vsub_vadd] #align affine_equiv.point_reflection_midpoint_left AffineEquiv.pointReflection_midpoint_left @[simp] -- Porting note: added variant with `Equiv.pointReflection` for `simp`
Mathlib/LinearAlgebra/AffineSpace/Midpoint.lean
68
71
theorem Equiv.pointReflection_midpoint_left (x y : P) : (Equiv.pointReflection (midpoint R x y)) x = y := by
rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul, mul_invOf_self, one_smul, vsub_vadd]
[ " (pointReflection R (midpoint R x y)) x = y", " (pointReflection (midpoint R x y)) x = y" ]
[ " (pointReflection R (midpoint R x y)) x = y", " (pointReflection (midpoint R x y)) x = y" ]
import Mathlib.Analysis.NormedSpace.Multilinear.Basic import Mathlib.LinearAlgebra.PiTensorProduct universe uι u𝕜 uE uF variable {ι : Type uι} [Fintype ι] variable {𝕜 : Type u𝕜} [NontriviallyNormedField 𝕜] variable {E : ι → Type uE} [∀ i, SeminormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)] variable {F : Type uF} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F] open scoped TensorProduct namespace PiTensorProduct def projectiveSeminormAux : FreeAddMonoid (𝕜 × Π i, E i) → ℝ := List.sum ∘ (List.map (fun p ↦ ‖p.1‖ * ∏ i, ‖p.2 i‖)) theorem projectiveSeminormAux_nonneg (p : FreeAddMonoid (𝕜 × Π i, E i)) : 0 ≤ projectiveSeminormAux p := by simp only [projectiveSeminormAux, Function.comp_apply] refine List.sum_nonneg ?_ intro a simp only [Multiset.map_coe, Multiset.mem_coe, List.mem_map, Prod.exists, forall_exists_index, and_imp] intro x m _ h rw [← h] exact mul_nonneg (norm_nonneg _) (Finset.prod_nonneg (fun _ _ ↦ norm_nonneg _)) theorem projectiveSeminormAux_add_le (p q : FreeAddMonoid (𝕜 × Π i, E i)) : projectiveSeminormAux (p + q) ≤ projectiveSeminormAux p + projectiveSeminormAux q := by simp only [projectiveSeminormAux, Function.comp_apply, Multiset.map_coe, Multiset.sum_coe] erw [List.map_append] rw [List.sum_append] rfl theorem projectiveSeminormAux_smul (p : FreeAddMonoid (𝕜 × Π i, E i)) (a : 𝕜) : projectiveSeminormAux (List.map (fun (y : 𝕜 × Π i, E i) ↦ (a * y.1, y.2)) p) = ‖a‖ * projectiveSeminormAux p := by simp only [projectiveSeminormAux, Function.comp_apply, Multiset.map_coe, List.map_map, Multiset.sum_coe] rw [← smul_eq_mul, List.smul_sum, ← List.comp_map] congr 2 ext x simp only [Function.comp_apply, norm_mul, smul_eq_mul] rw [mul_assoc] theorem bddBelow_projectiveSemiNormAux (x : ⨂[𝕜] i, E i) : BddBelow (Set.range (fun (p : lifts x) ↦ projectiveSeminormAux p.1)) := by existsi 0 rw [mem_lowerBounds] simp only [Set.mem_range, Subtype.exists, exists_prop, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] exact fun p _ ↦ projectiveSeminormAux_nonneg p noncomputable def projectiveSeminorm : Seminorm 𝕜 (⨂[𝕜] i, E i) := by refine Seminorm.ofSMulLE (fun x ↦ iInf (fun (p : lifts x) ↦ projectiveSeminormAux p.1)) ?_ ?_ ?_ · refine le_antisymm ?_ ?_ · refine ciInf_le_of_le (bddBelow_projectiveSemiNormAux (0 : ⨂[𝕜] i, E i)) ⟨0, lifts_zero⟩ ?_ simp only [projectiveSeminormAux, Function.comp_apply] rw [List.sum_eq_zero] intro _ simp only [List.mem_map, Prod.exists, forall_exists_index, and_imp] intro _ _ hxm rw [← FreeAddMonoid.ofList_nil] at hxm exfalso exact List.not_mem_nil _ hxm · letI : Nonempty (lifts 0) := ⟨0, lifts_zero (R := 𝕜) (s := E)⟩ exact le_ciInf (fun p ↦ projectiveSeminormAux_nonneg p.1) · intro x y letI := nonempty_subtype.mpr (nonempty_lifts x); letI := nonempty_subtype.mpr (nonempty_lifts y) exact le_ciInf_add_ciInf (fun p q ↦ ciInf_le_of_le (bddBelow_projectiveSemiNormAux _) ⟨p.1 + q.1, lifts_add p.2 q.2⟩ (projectiveSeminormAux_add_le p.1 q.1)) · intro a x letI := nonempty_subtype.mpr (nonempty_lifts x) rw [Real.mul_iInf_of_nonneg (norm_nonneg _)] refine le_ciInf ?_ intro p rw [← projectiveSeminormAux_smul] exact ciInf_le_of_le (bddBelow_projectiveSemiNormAux _) ⟨(List.map (fun y ↦ (a * y.1, y.2)) p.1), lifts_smul p.2 a⟩ (le_refl _) theorem projectiveSeminorm_apply (x : ⨂[𝕜] i, E i) : projectiveSeminorm x = iInf (fun (p : lifts x) ↦ projectiveSeminormAux p.1) := rfl theorem projectiveSeminorm_tprod_le (m : Π i, E i) : projectiveSeminorm (⨂ₜ[𝕜] i, m i) ≤ ∏ i, ‖m i‖ := by rw [projectiveSeminorm_apply] convert ciInf_le (bddBelow_projectiveSemiNormAux _) ⟨[((1 : 𝕜), m)] ,?_⟩ · simp only [projectiveSeminormAux, Function.comp_apply, List.map_cons, norm_one, one_mul, List.map_nil, List.sum_cons, List.sum_nil, add_zero] · rw [mem_lifts_iff, List.map_singleton, List.sum_singleton, one_smul]
Mathlib/Analysis/NormedSpace/PiTensorProduct/ProjectiveSeminorm.lean
134
153
theorem norm_eval_le_projectiveSeminorm (x : ⨂[𝕜] i, E i) (G : Type*) [SeminormedAddCommGroup G] [NormedSpace 𝕜 G] (f : ContinuousMultilinearMap 𝕜 E G) : ‖lift f.toMultilinearMap x‖ ≤ projectiveSeminorm x * ‖f‖ := by
letI := nonempty_subtype.mpr (nonempty_lifts x) rw [projectiveSeminorm_apply, Real.iInf_mul_of_nonneg (norm_nonneg _), projectiveSeminormAux] refine le_ciInf ?_ intro ⟨p, hp⟩ rw [mem_lifts_iff] at hp conv_lhs => rw [← hp, ← List.sum_map_hom, ← Multiset.sum_coe] refine le_trans (norm_multiset_sum_le _) ?_ simp only [tprodCoeff_eq_smul_tprod, Multiset.map_coe, List.map_map, Multiset.sum_coe, Function.comp_apply] rw [mul_comm, ← smul_eq_mul, List.smul_sum] refine List.Forall₂.sum_le_sum ?_ simp only [smul_eq_mul, List.map_map, List.forall₂_map_right_iff, Function.comp_apply, List.forall₂_map_left_iff, map_smul, lift.tprod, ContinuousMultilinearMap.coe_coe, List.forall₂_same, Prod.forall] intro a m _ rw [norm_smul, ← mul_assoc, mul_comm ‖f‖ _, mul_assoc] exact mul_le_mul_of_nonneg_left (f.le_opNorm _) (norm_nonneg _)
[ " 0 ≤ projectiveSeminormAux p", " 0 ≤ (List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p).sum", " ∀ x ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p, 0 ≤ x", " a ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p → 0 ≤ a", " ∀ (x : 𝕜) (x_1 : (i : ι) → E i), (x, x_1) ∈ p → ‖x‖ * ∏ x : ι, ‖x_1 x‖ = a → 0 ≤ a", ...
[ " 0 ≤ projectiveSeminormAux p", " 0 ≤ (List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p).sum", " ∀ x ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p, 0 ≤ x", " a ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p → 0 ≤ a", " ∀ (x : 𝕜) (x_1 : (i : ι) → E i), (x, x_1) ∈ p → ‖x‖ * ∏ x : ι, ‖x_1 x‖ = a → 0 ≤ a", ...
import Mathlib.Algebra.Order.Group.Abs import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Group.OrderIso import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Data.Int.Cast.Lemmas import Mathlib.Order.Interval.Set.Basic import Mathlib.Logic.Pairwise #align_import data.set.intervals.group from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" variable {α : Type*} namespace Set section LinearOrderedAddCommGroup variable [LinearOrderedAddCommGroup α]
Mathlib/Algebra/Order/Interval/Set/Group.lean
151
157
theorem nonempty_Ico_sdiff {x dx y dy : α} (h : dy < dx) (hx : 0 < dx) : Nonempty ↑(Ico x (x + dx) \ Ico y (y + dy)) := by
cases' lt_or_le x y with h' h' · use x simp [*, not_le.2 h'] · use max x (x + dy) simp [*, le_refl]
[ " Nonempty ↑(Ico x (x + dx) \\ Ico y (y + dy))", " x ∈ Ico x (x + dx) \\ Ico y (y + dy)", " max x (x + dy) ∈ Ico x (x + dx) \\ Ico y (y + dy)" ]
[ " Nonempty ↑(Ico x (x + dx) \\ Ico y (y + dy))" ]
import Mathlib.Topology.PartialHomeomorph import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Data.Real.Sqrt #align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Set Metric Pointwise variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] noncomputable section @[simps (config := .lemmasOnly)] def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where toFun x := (√(1 + ‖x‖ ^ 2))⁻¹ • x invFun y := (√(1 - ‖(y : E)‖ ^ 2))⁻¹ • (y : E) source := univ target := ball 0 1 map_source' x _ := by have : 0 < 1 + ‖x‖ ^ 2 := by positivity rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ← _root_.div_eq_inv_mul, div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ← abs_norm x, ← sq_lt_sq, abs_norm, Real.sq_sqrt this.le] exact lt_one_add _ map_target' _ _ := trivial left_inv' x _ := by field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs, Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, ← Real.sqrt_div (zero_lt_one_add_norm_sq x).le] right_inv' y hy := by have : 0 < 1 - ‖y‖ ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le, ← Real.sqrt_div this.le] open_source := isOpen_univ open_target := isOpen_ball continuousOn_toFun := by suffices Continuous fun (x:E) => (√(1 + ‖x‖ ^ 2))⁻¹ from (this.smul continuous_id).continuousOn refine Continuous.inv₀ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity) continuity continuousOn_invFun := by have : ∀ y ∈ ball (0 : E) 1, √(1 - ‖(y : E)‖ ^ 2) ≠ 0 := fun y hy ↦ by rw [Real.sqrt_ne_zero'] nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] exact ContinuousOn.smul (ContinuousOn.inv₀ (continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id @[simp] theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_apply] @[simp] theorem PartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_symm_apply] @[simps! (config := .lemmasOnly)] def Homeomorph.unitBall : E ≃ₜ ball (0 : E) 1 := (Homeomorph.Set.univ _).symm.trans PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget #align homeomorph_unit_ball Homeomorph.unitBall @[simp] theorem Homeomorph.coe_unitBall_apply_zero : (Homeomorph.unitBall (0 : E) : E) = 0 := PartialHomeomorph.univUnitBall_apply_zero #align coe_homeomorph_unit_ball_apply_zero Homeomorph.coe_unitBall_apply_zero variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P] namespace PartialHomeomorph @[simps!] def unitBallBall (c : P) (r : ℝ) (hr : 0 < r) : PartialHomeomorph E P := ((Homeomorph.smulOfNeZero r hr.ne').trans (IsometryEquiv.vaddConst c).toHomeomorph).toPartialHomeomorphOfImageEq (ball 0 1) isOpen_ball (ball c r) <| by change (IsometryEquiv.vaddConst c) ∘ (r • ·) '' ball (0 : E) 1 = ball c r rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball] simp [abs_of_pos hr] def univBall (c : P) (r : ℝ) : PartialHomeomorph E P := if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl else (IsometryEquiv.vaddConst c).toHomeomorph.toPartialHomeomorph @[simp]
Mathlib/Analysis/NormedSpace/HomeomorphBall.lean
127
128
theorem univBall_source (c : P) (r : ℝ) : (univBall c r).source = univ := by
unfold univBall; split_ifs <;> rfl
[ " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x ∈ ball 0 1", " 0 < 1 + ‖x‖ ^ 2", " ‖x‖ ^ 2 < 1 + ‖x‖ ^ 2", " (fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) ((fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x) = x", " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) ((fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) y) = y", " 0 < 1 - ‖y‖ ^ 2", " ContinuousOn\n ↑{ toFu...
[ " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x ∈ ball 0 1", " 0 < 1 + ‖x‖ ^ 2", " ‖x‖ ^ 2 < 1 + ‖x‖ ^ 2", " (fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) ((fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) x) = x", " (fun x => (√(1 + ‖x‖ ^ 2))⁻¹ • x) ((fun y => (√(1 - ‖y‖ ^ 2))⁻¹ • y) y) = y", " 0 < 1 - ‖y‖ ^ 2", " ContinuousOn\n ↑{ toFu...
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : ℕ → R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp] theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer] theorem descPochhammer_succ_left (n : ℕ) : descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by rw [descPochhammer] theorem monic_descPochhammer (n : ℕ) [Nontrivial R] [NoZeroDivisors R] : Monic <| descPochhammer R n := by induction' n with n hn · simp · have h : leadingCoeff (X - 1 : R[X]) = 1 := leadingCoeff_X_sub_C 1 have : natDegree (X - (1 : R[X])) ≠ 0 := ne_zero_of_eq_one <| natDegree_X_sub_C (1 : R) rw [descPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp this, hn, monic_X, one_mul, one_mul, h, one_pow] section variable {R} {T : Type v} [Ring T] @[simp] theorem descPochhammer_map (f : R →+* T) (n : ℕ) : (descPochhammer R n).map f = descPochhammer T n := by induction' n with n ih · simp · simp [ih, descPochhammer_succ_left, map_comp] end @[simp, norm_cast] theorem descPochhammer_eval_cast (n : ℕ) (k : ℤ) : (((descPochhammer ℤ n).eval k : ℤ) : R) = ((descPochhammer R n).eval k : R) := by rw [← descPochhammer_map (algebraMap ℤ R), eval_map, ← eq_intCast (algebraMap ℤ R)] simp only [algebraMap_int_eq, eq_intCast, eval₂_at_intCast, Nat.cast_id, eq_natCast, Int.cast_id] theorem descPochhammer_eval_zero {n : ℕ} : (descPochhammer R n).eval 0 = if n = 0 then 1 else 0 := by cases n · simp · simp [X_mul, Nat.succ_ne_zero, descPochhammer_succ_left] theorem descPochhammer_zero_eval_zero : (descPochhammer R 0).eval 0 = 1 := by simp @[simp] theorem descPochhammer_ne_zero_eval_zero {n : ℕ} (h : n ≠ 0) : (descPochhammer R n).eval 0 = 0 := by simp [descPochhammer_eval_zero, h]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
301
312
theorem descPochhammer_succ_right (n : ℕ) : descPochhammer R (n + 1) = descPochhammer R n * (X - (n : R[X])) := by
suffices h : descPochhammer ℤ (n + 1) = descPochhammer ℤ n * (X - (n : ℤ[X])) by apply_fun Polynomial.map (algebraMap ℤ R) at h simpa [descPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X, Polynomial.map_intCast] using h induction' n with n ih · simp [descPochhammer] · conv_lhs => rw [descPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← descPochhammer_succ_left, sub_comp, X_comp, natCast_comp] rw [Nat.cast_add, Nat.cast_one, sub_add_eq_sub_sub_swap]
[ " descPochhammer R 1 = X", " descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1)", " (descPochhammer R n).Monic", " (descPochhammer R 0).Monic", " (descPochhammer R (n + 1)).Monic", " map f (descPochhammer R n) = descPochhammer T n", " map f (descPochhammer R 0) = descPochhammer T 0", " m...
[ " descPochhammer R 1 = X", " descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1)", " (descPochhammer R n).Monic", " (descPochhammer R 0).Monic", " (descPochhammer R (n + 1)).Monic", " map f (descPochhammer R n) = descPochhammer T n", " map f (descPochhammer R 0) = descPochhammer T 0", " m...
import Mathlib.Algebra.Polynomial.Eval import Mathlib.LinearAlgebra.Dimension.Constructions #align_import algebra.linear_recurrence from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f" noncomputable section open Finset open Polynomial structure LinearRecurrence (α : Type*) [CommSemiring α] where order : ℕ coeffs : Fin order → α #align linear_recurrence LinearRecurrence instance (α : Type*) [CommSemiring α] : Inhabited (LinearRecurrence α) := ⟨⟨0, default⟩⟩ namespace LinearRecurrence section CommSemiring variable {α : Type*} [CommSemiring α] (E : LinearRecurrence α) def IsSolution (u : ℕ → α) := ∀ n, u (n + E.order) = ∑ i, E.coeffs i * u (n + i) #align linear_recurrence.is_solution LinearRecurrence.IsSolution def mkSol (init : Fin E.order → α) : ℕ → α | n => if h : n < E.order then init ⟨n, h⟩ else ∑ k : Fin E.order, have _ : n - E.order + k < n := by rw [add_comm, ← add_tsub_assoc_of_le (not_lt.mp h), tsub_lt_iff_left] · exact add_lt_add_right k.is_lt n · convert add_le_add (zero_le (k : ℕ)) (not_lt.mp h) simp only [zero_add] E.coeffs k * mkSol init (n - E.order + k) #align linear_recurrence.mk_sol LinearRecurrence.mkSol
Mathlib/Algebra/LinearRecurrence.lean
85
88
theorem is_sol_mkSol (init : Fin E.order → α) : E.IsSolution (E.mkSol init) := by
intro n rw [mkSol] simp
[ " n - E.order + ↑k < n", " ↑k + n < E.order + n", " E.order ≤ ↑k + n", " E.order = 0 + E.order", " E.IsSolution (E.mkSol init)", " E.mkSol init (n + E.order) = ∑ i : Fin E.order, E.coeffs i * E.mkSol init (n + ↑i)", " (if h : n + E.order < E.order then init ⟨n + E.order, h⟩\n else\n ∑ k : Fin E....
[ " n - E.order + ↑k < n", " ↑k + n < E.order + n", " E.order ≤ ↑k + n", " E.order = 0 + E.order", " E.IsSolution (E.mkSol init)" ]
import Mathlib.Analysis.Fourier.AddCircle import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.PSeries import Mathlib.Analysis.Distribution.SchwartzSpace import Mathlib.MeasureTheory.Measure.Lebesgue.Integral #align_import analysis.fourier.poisson_summation from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function hiding comp_apply open Set hiding restrict_apply open Complex hiding abs_of_nonneg open Real open TopologicalSpace Filter MeasureTheory Asymptotics open scoped Real Filter FourierTransform open ContinuousMap theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)} (hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖) (m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by -- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc -- block, but I think it's more legible this way. We start with preliminaries about the integrand. let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩ have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x)) intro K g simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul] have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by intro n; ext1 x have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m)) simpa only [mul_one] using this.int_mul n x -- Now the main argument. First unwind some definitions. calc fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = ∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply, coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul] -- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values. _ = ∫ x in (0:ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by simp_rw [coe_mul, Pi.mul_apply, ← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left] -- Swap sum and integral. _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1 exact funext fun n => neK _ _ _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢ simp_rw [eadd] -- Rearrange sum of interval integrals into an integral over `ℝ`. _ = ∫ x, e x * f x := by suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq apply integrable_of_summable_norm_Icc convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1 simp_rw [mul_comp] at eadd ⊢ simp_rw [eadd] exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _ -- Minor tidying to finish _ = 𝓕 f m := by rw [fourierIntegral_real_eq_integral_exp_smul] congr 1 with x : 1 rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply] congr 2 push_cast ring #align real.fourier_coeff_tsum_comp_add Real.fourierCoeff_tsum_comp_add
Mathlib/Analysis/Fourier/PoissonSummation.lean
107
121
theorem Real.tsum_eq_tsum_fourierIntegral {f : C(ℝ, ℂ)} (h_norm : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict K‖) (h_sum : Summable fun n : ℤ => 𝓕 f n) (x : ℝ) : ∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := by
let F : C(UnitAddCircle, ℂ) := ⟨(f.periodic_tsum_comp_add_zsmul 1).lift, continuous_coinduced_dom.mpr (map_continuous _)⟩ have : Summable (fourierCoeff F) := by convert h_sum exact Real.fourierCoeff_tsum_comp_add h_norm _ convert (has_pointwise_sum_fourier_series_of_summable this x).tsum_eq.symm using 1 · simpa only [F, coe_mk, ← QuotientAddGroup.mk_zero, Periodic.lift_coe, zsmul_one, comp_apply, coe_addRight, zero_add] using (hasSum_apply (summable_of_locally_summable_norm h_norm).hasSum x).tsum_eq · simp_rw [← Real.fourierCoeff_tsum_comp_add h_norm, smul_eq_mul, F, coe_mk]
[ " fourierCoeff ⋯.lift m = 𝓕 ⇑f ↑m", " ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖", " ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖", " ∀ (n : ℤ), e.comp (ContinuousMap.addRight ↑n) = e", " e.comp (ContinuousMap.addRigh...
[ " fourierCoeff ⋯.lift m = 𝓕 ⇑f ↑m", " ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖", " ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖", " ∀ (n : ℤ), e.comp (ContinuousMap.addRight ↑n) = e", " e.comp (ContinuousMap.addRigh...
import Mathlib.Topology.Sheaves.Forget import Mathlib.Topology.Sheaves.SheafCondition.PairwiseIntersections import Mathlib.CategoryTheory.Limits.Shapes.Types #align_import topology.sheaves.sheaf_condition.unique_gluing from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" noncomputable section open TopCat TopCat.Presheaf CategoryTheory CategoryTheory.Limits TopologicalSpace TopologicalSpace.Opens Opposite universe v u x variable {C : Type u} [Category.{v} C] [ConcreteCategory.{v} C] namespace TopCat namespace Presheaf section attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike variable {X : TopCat.{x}} (F : Presheaf C X) {ι : Type x} (U : ι → Opens X) def IsCompatible (sf : ∀ i : ι, F.obj (op (U i))) : Prop := ∀ i j : ι, F.map (infLELeft (U i) (U j)).op (sf i) = F.map (infLERight (U i) (U j)).op (sf j) set_option linter.uppercaseLean3 false in #align Top.presheaf.is_compatible TopCat.Presheaf.IsCompatible def IsGluing (sf : ∀ i : ι, F.obj (op (U i))) (s : F.obj (op (iSup U))) : Prop := ∀ i : ι, F.map (Opens.leSupr U i).op s = sf i set_option linter.uppercaseLean3 false in #align Top.presheaf.is_gluing TopCat.Presheaf.IsGluing def IsSheafUniqueGluing : Prop := ∀ ⦃ι : Type x⦄ (U : ι → Opens X) (sf : ∀ i : ι, F.obj (op (U i))), IsCompatible F U sf → ∃! s : F.obj (op (iSup U)), IsGluing F U sf s set_option linter.uppercaseLean3 false in #align Top.presheaf.is_sheaf_unique_gluing TopCat.Presheaf.IsSheafUniqueGluing end section TypeValued variable {X : TopCat.{x}} {F : Presheaf (Type u) X} {ι : Type x} {U : ι → Opens X} def objPairwiseOfFamily (sf : ∀ i, F.obj (op (U i))) : ∀ i, ((Pairwise.diagram U).op ⋙ F).obj i | ⟨Pairwise.single i⟩ => sf i | ⟨Pairwise.pair i j⟩ => F.map (infLELeft (U i) (U j)).op (sf i) def IsCompatible.sectionPairwise {sf} (h : IsCompatible F U sf) : ((Pairwise.diagram U).op ⋙ F).sections := by refine ⟨objPairwiseOfFamily sf, ?_⟩ let G := (Pairwise.diagram U).op ⋙ F rintro (i|⟨i,j⟩) (i'|⟨i',j'⟩) (_|_|_|_) · exact congr_fun (G.map_id <| op <| Pairwise.single i) _ · rfl · exact (h i' i).symm · exact congr_fun (G.map_id <| op <| Pairwise.pair i j) _
Mathlib/Topology/Sheaves/SheafCondition/UniqueGluing.lean
112
118
theorem isGluing_iff_pairwise {sf s} : IsGluing F U sf s ↔ ∀ i, (F.mapCone (Pairwise.cocone U).op).π.app i s = objPairwiseOfFamily sf i := by
refine ⟨fun h ↦ ?_, fun h i ↦ h (op <| Pairwise.single i)⟩ rintro (i|⟨i,j⟩) · exact h i · rw [← (F.mapCone (Pairwise.cocone U).op).w (op <| Pairwise.Hom.left i j)] exact congr_arg _ (h i)
[ " ↑((Pairwise.diagram U).op ⋙ F).sections", " objPairwiseOfFamily sf ∈ ((Pairwise.diagram U).op ⋙ F).sections", " ((Pairwise.diagram U).op ⋙ F).map { unop := Pairwise.Hom.id_single i }\n (objPairwiseOfFamily sf { unop := Pairwise.single i }) =\n objPairwiseOfFamily sf { unop := Pairwise.single i }", "...
[ " ↑((Pairwise.diagram U).op ⋙ F).sections", " objPairwiseOfFamily sf ∈ ((Pairwise.diagram U).op ⋙ F).sections", " ((Pairwise.diagram U).op ⋙ F).map { unop := Pairwise.Hom.id_single i }\n (objPairwiseOfFamily sf { unop := Pairwise.single i }) =\n objPairwiseOfFamily sf { unop := Pairwise.single i }", "...
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.Enumerative.DoubleCounting import Mathlib.Data.Finset.Pointwise import Mathlib.Tactic.GCongr #align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd" open Nat open NNRat Pointwise namespace Finset variable {α : Type*} [CommGroup α] [DecidableEq α] {A B C : Finset α} @[to_additive card_sub_mul_le_card_sub_mul_card_sub "**Ruzsa's triangle inequality**. Subtraction version."] theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset α) : (A / C).card * B.card ≤ (A / B).card * (B / C).card := by rw [← card_product (A / B), ← mul_one ((A / B) ×ˢ (B / C)).card] refine card_mul_le_card_mul (fun b ac ↦ ac.1 * ac.2 = b) (fun x hx ↦ ?_) fun x _ ↦ card_le_one_iff.2 fun hu hv ↦ ((mem_bipartiteBelow _).1 hu).2.symm.trans ?_ obtain ⟨a, ha, c, hc, rfl⟩ := mem_div.1 hx refine card_le_card_of_inj_on (fun b ↦ (a / b, b / c)) (fun b hb ↦ ?_) fun b₁ _ b₂ _ h ↦ ?_ · rw [mem_bipartiteAbove] exact ⟨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _⟩ · exact div_right_injective (Prod.ext_iff.1 h).1 · exact ((mem_bipartiteBelow _).1 hv).2 #align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div #align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub @[to_additive card_sub_mul_le_card_add_mul_card_add "**Ruzsa's triangle inequality**. Sub-add-add version."]
Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean
63
66
theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset α) : (A / C).card * B.card ≤ (A * B).card * (B * C).card := by
rw [← div_inv_eq_mul, ← card_inv B, ← card_inv (B * C), mul_inv, ← div_eq_mul_inv] exact card_div_mul_le_card_div_mul_card_div _ _ _
[ " (A / C).card * B.card ≤ (A / B).card * (B / C).card", " (A / C).card * B.card ≤ ((A / B) ×ˢ (B / C)).card * 1", " x.1 * x.2 = b✝", " (fun b => (a / b, b / c)) b ∈ bipartiteAbove (fun b ac => ac.1 * ac.2 = b) ((A / B) ×ˢ (B / C)) (a / c)", " (fun b => (a / b, b / c)) b ∈ (A / B) ×ˢ (B / C) ∧\n ((fun b =...
[ " (A / C).card * B.card ≤ (A / B).card * (B / C).card", " (A / C).card * B.card ≤ ((A / B) ×ˢ (B / C)).card * 1", " x.1 * x.2 = b✝", " (fun b => (a / b, b / c)) b ∈ bipartiteAbove (fun b ac => ac.1 * ac.2 = b) ((A / B) ×ˢ (B / C)) (a / c)", " (fun b => (a / b, b / c)) b ∈ (A / B) ×ˢ (B / C) ∧\n ((fun b =...
import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.NormedSpace.Connected import Mathlib.LinearAlgebra.AffineSpace.ContinuousAffineEquiv open Set variable {F : Type*} [AddCommGroup F] [Module ℝ F] [TopologicalSpace F] def AmpleSet (s : Set F) : Prop := ∀ x ∈ s, convexHull ℝ (connectedComponentIn s x) = univ @[simp] theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] : AmpleSet (univ : Set F) := by intro x _ rw [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ, convexHull_univ] @[simp] theorem ampleSet_empty : AmpleSet (∅ : Set F) := fun _ ↦ False.elim namespace AmpleSet theorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s ∪ t) := by intro x hx rcases hx with (h | h) <;> -- The connected component of `x ∈ s` in `s ∪ t` contains the connected component of `x` in `s`, -- hence is also full; similarly for `t`. [have hx := hs x h; have hx := ht x h] <;> rw [← Set.univ_subset_iff, ← hx] <;> apply convexHull_mono <;> apply connectedComponentIn_mono <;> [apply subset_union_left; apply subset_union_right] variable {E : Type*} [AddCommGroup E] [Module ℝ E] [TopologicalSpace E] theorem image {s : Set E} (h : AmpleSet s) (L : E ≃ᵃL[ℝ] F) : AmpleSet (L '' s) := forall_mem_image.mpr fun x hx ↦ calc (convexHull ℝ) (connectedComponentIn (L '' s) (L x)) _ = (convexHull ℝ) (L '' (connectedComponentIn s x)) := .symm <| congrArg _ <| L.toHomeomorph.image_connectedComponentIn hx _ = L '' (convexHull ℝ (connectedComponentIn s x)) := .symm <| L.toAffineMap.image_convexHull _ _ = univ := by rw [h x hx, image_univ, L.surjective.range_eq] theorem image_iff {s : Set E} (L : E ≃ᵃL[ℝ] F) : AmpleSet (L '' s) ↔ AmpleSet s := ⟨fun h ↦ (L.symm_image_image s) ▸ h.image L.symm, fun h ↦ h.image L⟩
Mathlib/Analysis/Convex/AmpleSet.lean
94
96
theorem preimage {s : Set F} (h : AmpleSet s) (L : E ≃ᵃL[ℝ] F) : AmpleSet (L ⁻¹' s) := by
rw [← L.image_symm_eq_preimage] exact h.image L.symm
[ " AmpleSet univ", " (convexHull ℝ) (connectedComponentIn univ x) = univ", " AmpleSet (s ∪ t)", " (convexHull ℝ) (connectedComponentIn (s ∪ t) x) = univ", " (convexHull ℝ) (connectedComponentIn s x) ⊆ (convexHull ℝ) (connectedComponentIn (s ∪ t) x)", " (convexHull ℝ) (connectedComponentIn t x) ⊆ (convexHul...
[ " AmpleSet univ", " (convexHull ℝ) (connectedComponentIn univ x) = univ", " AmpleSet (s ∪ t)", " (convexHull ℝ) (connectedComponentIn (s ∪ t) x) = univ", " (convexHull ℝ) (connectedComponentIn s x) ⊆ (convexHull ℝ) (connectedComponentIn (s ∪ t) x)", " (convexHull ℝ) (connectedComponentIn t x) ⊆ (convexHul...
import Mathlib.MeasureTheory.Group.Arithmetic #align_import measure_theory.group.pointwise from "leanprover-community/mathlib"@"66f7114a1d5cba41c47d417a034bbb2e96cf564a" open Pointwise open Set @[to_additive]
Mathlib/MeasureTheory/Group/Pointwise.lean
24
28
theorem MeasurableSet.const_smul {G α : Type*} [Group G] [MulAction G α] [MeasurableSpace G] [MeasurableSpace α] [MeasurableSMul G α] {s : Set α} (hs : MeasurableSet s) (a : G) : MeasurableSet (a • s) := by
rw [← preimage_smul_inv] exact measurable_const_smul _ hs
[ " MeasurableSet (a • s)", " MeasurableSet ((fun x => a⁻¹ • x) ⁻¹' s)" ]
[ " MeasurableSet (a • s)" ]
import Batteries.Data.List.Lemmas namespace List universe u v variable {α : Type u} {β : Type v} @[simp] theorem eraseIdx_zero (l : List α) : eraseIdx l 0 = tail l := by cases l <;> rfl theorem eraseIdx_eq_take_drop_succ : ∀ (l : List α) (i : Nat), l.eraseIdx i = l.take i ++ l.drop (i + 1) | nil, _ => by simp | a::l, 0 => by simp | a::l, i + 1 => by simp [eraseIdx_eq_take_drop_succ l i] theorem eraseIdx_sublist : ∀ (l : List α) (k : Nat), eraseIdx l k <+ l | [], _ => by simp | a::l, 0 => by simp | a::l, k + 1 => by simp [eraseIdx_sublist l k] theorem eraseIdx_subset (l : List α) (k : Nat) : eraseIdx l k ⊆ l := (eraseIdx_sublist l k).subset @[simp] theorem eraseIdx_eq_self : ∀ {l : List α} {k : Nat}, eraseIdx l k = l ↔ length l ≤ k | [], _ => by simp | a::l, 0 => by simp [(cons_ne_self _ _).symm] | a::l, k + 1 => by simp [eraseIdx_eq_self] alias ⟨_, eraseIdx_of_length_le⟩ := eraseIdx_eq_self theorem eraseIdx_append_of_lt_length {l : List α} {k : Nat} (hk : k < length l) (l' : List α) : eraseIdx (l ++ l') k = eraseIdx l k ++ l' := by rw [eraseIdx_eq_take_drop_succ, take_append_of_le_length, drop_append_of_le_length, eraseIdx_eq_take_drop_succ, append_assoc] all_goals omega theorem eraseIdx_append_of_length_le {l : List α} {k : Nat} (hk : length l ≤ k) (l' : List α) : eraseIdx (l ++ l') k = l ++ eraseIdx l' (k - length l) := by rw [eraseIdx_eq_take_drop_succ, eraseIdx_eq_take_drop_succ, take_append_eq_append_take, drop_append_eq_append_drop, take_all_of_le hk, drop_eq_nil_of_le (by omega), nil_append, append_assoc] congr omega protected theorem IsPrefix.eraseIdx {l l' : List α} (h : l <+: l') (k : Nat) : eraseIdx l k <+: eraseIdx l' k := by rcases h with ⟨t, rfl⟩ if hkl : k < length l then simp [eraseIdx_append_of_lt_length hkl] else rw [Nat.not_lt] at hkl simp [eraseIdx_append_of_length_le hkl, eraseIdx_of_length_le hkl] theorem mem_eraseIdx_iff_get {x : α} : ∀ {l} {k}, x ∈ eraseIdx l k ↔ ∃ i : Fin l.length, ↑i ≠ k ∧ l.get i = x | [], _ => by simp only [eraseIdx, Fin.exists_iff, not_mem_nil, false_iff] rintro ⟨i, h, -⟩ exact Nat.not_lt_zero _ h | a::l, 0 => by simp [Fin.exists_fin_succ, mem_iff_get] | a::l, k+1 => by simp [Fin.exists_fin_succ, mem_eraseIdx_iff_get, @eq_comm _ a, k.succ_ne_zero.symm]
.lake/packages/batteries/Batteries/Data/List/EraseIdx.lean
76
80
theorem mem_eraseIdx_iff_get? {x : α} {l} {k} : x ∈ eraseIdx l k ↔ ∃ i ≠ k, l.get? i = x := by
simp only [mem_eraseIdx_iff_get, Fin.exists_iff, exists_and_left, get_eq_iff, exists_prop] refine exists_congr fun i => and_congr_right' <| and_iff_right_of_imp fun h => ?_ obtain ⟨h, -⟩ := get?_eq_some.1 h exact h
[ " l.eraseIdx 0 = l.tail", " [].eraseIdx 0 = [].tail", " (head✝ :: tail✝).eraseIdx 0 = (head✝ :: tail✝).tail", " [].eraseIdx x✝ = take x✝ [] ++ drop (x✝ + 1) []", " (a :: l).eraseIdx 0 = take 0 (a :: l) ++ drop (0 + 1) (a :: l)", " (a :: l).eraseIdx (i + 1) = take (i + 1) (a :: l) ++ drop (i + 1 + 1) (a ::...
[ " l.eraseIdx 0 = l.tail", " [].eraseIdx 0 = [].tail", " (head✝ :: tail✝).eraseIdx 0 = (head✝ :: tail✝).tail", " [].eraseIdx x✝ = take x✝ [] ++ drop (x✝ + 1) []", " (a :: l).eraseIdx 0 = take 0 (a :: l) ++ drop (0 + 1) (a :: l)", " (a :: l).eraseIdx (i + 1) = take (i + 1) (a :: l) ++ drop (i + 1 + 1) (a ::...
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics import Mathlib.NumberTheory.Liouville.Basic import Mathlib.Topology.Instances.Irrational #align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Filter Metric Real Set open scoped Filter Topology def LiouvilleWith (p x : ℝ) : Prop := ∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p #align liouville_with LiouvilleWith theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by use 2 refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently have hn' : (0 : ℝ) < n := by simpa have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by rw [lt_div_iff hn', Int.cast_add, Int.cast_one]; exact Int.lt_floor_add_one _ refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩ rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add', add_div_eq_mul_add_div _ _ hn'.ne'] gcongr calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le _ < x * n + 2 := by linarith #align liouville_with_one liouvilleWith_one namespace LiouvilleWith variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
Mathlib/NumberTheory/Liouville/LiouvilleWith.lean
76
85
theorem exists_pos (h : LiouvilleWith p x) : ∃ (C : ℝ) (_h₀ : 0 < C), ∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by
rcases h with ⟨C, hC⟩ refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩ refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_ rintro n ⟨hle, m, hne, hlt⟩ refine ⟨hle, m, hne, hlt.trans_le ?_⟩ gcongr apply le_max_left
[ " LiouvilleWith 1 x", " ∃ᶠ (n : ℕ) in atTop, ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " 0 < ↑n", " x < ↑(⌊x * ↑n⌋ + 1) / ↑n", " x * ↑n < ↑⌊x * ↑n⌋ + 1", " |x - ↑(⌊x * ↑n⌋ + 1) / ↑n| < 2 / ↑n ^ 1", " ↑(⌊x * ↑n⌋ + 1) / ↑n < (x * ↑n + 2) / ↑n", "...
[ " LiouvilleWith 1 x", " ∃ᶠ (n : ℕ) in atTop, ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " ∃ m, x ≠ ↑m / ↑n ∧ |x - ↑m / ↑n| < 2 / ↑n ^ 1", " 0 < ↑n", " x < ↑(⌊x * ↑n⌋ + 1) / ↑n", " x * ↑n < ↑⌊x * ↑n⌋ + 1", " |x - ↑(⌊x * ↑n⌋ + 1) / ↑n| < 2 / ↑n ^ 1", " ↑(⌊x * ↑n⌋ + 1) / ↑n < (x * ↑n + 2) / ↑n", "...