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
rank
int64
0
2.4k
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
66
71
theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by
have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num))
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
80
91
theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by
rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn)
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.Ο‡β‚„_eq_neg_one_pow ZMod.Ο‡β‚„_eq_neg_one_pow
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
95
97
theorem Ο‡β‚„_nat_one_mod_four {n : β„•} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by
rw [Ο‡β‚„_nat_mod_four, hn] rfl
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.Ο‡β‚„_eq_neg_one_pow ZMod.Ο‡β‚„_eq_neg_one_pow theorem Ο‡β‚„_nat_one_mod_four {n : β„•} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_one_mod_four ZMod.Ο‡β‚„_nat_one_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
101
103
theorem Ο‡β‚„_nat_three_mod_four {n : β„•} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by
rw [Ο‡β‚„_nat_mod_four, hn] rfl
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.Ο‡β‚„_eq_neg_one_pow ZMod.Ο‡β‚„_eq_neg_one_pow theorem Ο‡β‚„_nat_one_mod_four {n : β„•} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_one_mod_four ZMod.Ο‡β‚„_nat_one_mod_four theorem Ο‡β‚„_nat_three_mod_four {n : β„•} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_three_mod_four ZMod.Ο‡β‚„_nat_three_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
107
109
theorem Ο‡β‚„_int_one_mod_four {n : β„€} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by
rw [Ο‡β‚„_int_mod_four, hn] rfl
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.Ο‡β‚„_eq_neg_one_pow ZMod.Ο‡β‚„_eq_neg_one_pow theorem Ο‡β‚„_nat_one_mod_four {n : β„•} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_one_mod_four ZMod.Ο‡β‚„_nat_one_mod_four theorem Ο‡β‚„_nat_three_mod_four {n : β„•} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_three_mod_four ZMod.Ο‡β‚„_nat_three_mod_four theorem Ο‡β‚„_int_one_mod_four {n : β„€} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_int_mod_four, hn] rfl #align zmod.Ο‡β‚„_int_one_mod_four ZMod.Ο‡β‚„_int_one_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
113
115
theorem Ο‡β‚„_int_three_mod_four {n : β„€} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by
rw [Ο‡β‚„_int_mod_four, hn] rfl
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.Ο‡β‚„_eq_neg_one_pow ZMod.Ο‡β‚„_eq_neg_one_pow theorem Ο‡β‚„_nat_one_mod_four {n : β„•} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_one_mod_four ZMod.Ο‡β‚„_nat_one_mod_four theorem Ο‡β‚„_nat_three_mod_four {n : β„•} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_three_mod_four ZMod.Ο‡β‚„_nat_three_mod_four theorem Ο‡β‚„_int_one_mod_four {n : β„€} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_int_mod_four, hn] rfl #align zmod.Ο‡β‚„_int_one_mod_four ZMod.Ο‡β‚„_int_one_mod_four theorem Ο‡β‚„_int_three_mod_four {n : β„€} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_int_mod_four, hn] rfl #align zmod.Ο‡β‚„_int_three_mod_four ZMod.Ο‡β‚„_int_three_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
119
121
theorem neg_one_pow_div_two_of_one_mod_four {n : β„•} (hn : n % 4 = 1) : (-1 : β„€) ^ (n / 2) = 1 := by
rw [← Ο‡β‚„_eq_neg_one_pow (Nat.odd_of_mod_four_eq_one hn), ← natCast_mod, hn] rfl
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.Ο‡β‚„_eq_neg_one_pow ZMod.Ο‡β‚„_eq_neg_one_pow theorem Ο‡β‚„_nat_one_mod_four {n : β„•} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_one_mod_four ZMod.Ο‡β‚„_nat_one_mod_four theorem Ο‡β‚„_nat_three_mod_four {n : β„•} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_three_mod_four ZMod.Ο‡β‚„_nat_three_mod_four theorem Ο‡β‚„_int_one_mod_four {n : β„€} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_int_mod_four, hn] rfl #align zmod.Ο‡β‚„_int_one_mod_four ZMod.Ο‡β‚„_int_one_mod_four theorem Ο‡β‚„_int_three_mod_four {n : β„€} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_int_mod_four, hn] rfl #align zmod.Ο‡β‚„_int_three_mod_four ZMod.Ο‡β‚„_int_three_mod_four theorem neg_one_pow_div_two_of_one_mod_four {n : β„•} (hn : n % 4 = 1) : (-1 : β„€) ^ (n / 2) = 1 := by rw [← Ο‡β‚„_eq_neg_one_pow (Nat.odd_of_mod_four_eq_one hn), ← natCast_mod, hn] rfl #align zmod.neg_one_pow_div_two_of_one_mod_four ZMod.neg_one_pow_div_two_of_one_mod_four
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
125
128
theorem neg_one_pow_div_two_of_three_mod_four {n : β„•} (hn : n % 4 = 3) : (-1 : β„€) ^ (n / 2) = -1 := by
rw [← Ο‡β‚„_eq_neg_one_pow (Nat.odd_of_mod_four_eq_three hn), ← natCast_mod, hn] rfl
322
import Mathlib.Data.Int.Range import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.MulChar.Basic #align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace ZMod section QuadCharModP @[simps] def Ο‡β‚„ : MulChar (ZMod 4) β„€ where toFun := (![0, 1, 0, -1] : ZMod 4 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚„ ZMod.Ο‡β‚„ theorem isQuadratic_Ο‡β‚„ : Ο‡β‚„.IsQuadratic := by intro a -- Porting note (#11043): was `decide!` fin_cases a all_goals decide #align zmod.is_quadratic_Ο‡β‚„ ZMod.isQuadratic_Ο‡β‚„ theorem Ο‡β‚„_nat_mod_four (n : β„•) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„•) := by rw [← ZMod.natCast_mod n 4] #align zmod.Ο‡β‚„_nat_mod_four ZMod.Ο‡β‚„_nat_mod_four theorem Ο‡β‚„_int_mod_four (n : β„€) : Ο‡β‚„ n = Ο‡β‚„ (n % 4 : β„€) := by rw [← ZMod.intCast_mod n 4] norm_cast #align zmod.Ο‡β‚„_int_mod_four ZMod.Ο‡β‚„_int_mod_four theorem Ο‡β‚„_int_eq_if_mod_four (n : β„€) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := by have help : βˆ€ m : β„€, 0 ≀ m β†’ m < 4 β†’ Ο‡β‚„ m = if m % 2 = 0 then 0 else if m = 1 then 1 else -1 := by decide rw [← Int.emod_emod_of_dvd n (by decide : (2 : β„€) ∣ 4), ← ZMod.intCast_mod n 4] exact help (n % 4) (Int.emod_nonneg n (by norm_num)) (Int.emod_lt n (by norm_num)) #align zmod.Ο‡β‚„_int_eq_if_mod_four ZMod.Ο‡β‚„_int_eq_if_mod_four theorem Ο‡β‚„_nat_eq_if_mod_four (n : β„•) : Ο‡β‚„ n = if n % 2 = 0 then 0 else if n % 4 = 1 then 1 else -1 := mod_cast Ο‡β‚„_int_eq_if_mod_four n #align zmod.Ο‡β‚„_nat_eq_if_mod_four ZMod.Ο‡β‚„_nat_eq_if_mod_four theorem Ο‡β‚„_eq_neg_one_pow {n : β„•} (hn : n % 2 = 1) : Ο‡β‚„ n = (-1) ^ (n / 2) := by rw [Ο‡β‚„_nat_eq_if_mod_four] simp only [hn, Nat.one_ne_zero, if_false] conv_rhs => -- Porting note: was `nth_rw` arg 2; rw [← Nat.div_add_mod n 4] enter [1, 1, 1]; rw [(by norm_num : 4 = 2 * 2)] rw [mul_assoc, add_comm, Nat.add_mul_div_left _ _ (by norm_num : 0 < 2), pow_add, pow_mul, neg_one_sq, one_pow, mul_one] have help : βˆ€ m : β„•, m < 4 β†’ m % 2 = 1 β†’ ite (m = 1) (1 : β„€) (-1) = (-1) ^ (m / 2) := by decide exact help (n % 4) (Nat.mod_lt n (by norm_num)) ((Nat.mod_mod_of_dvd n (by decide : 2 ∣ 4)).trans hn) #align zmod.Ο‡β‚„_eq_neg_one_pow ZMod.Ο‡β‚„_eq_neg_one_pow theorem Ο‡β‚„_nat_one_mod_four {n : β„•} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_one_mod_four ZMod.Ο‡β‚„_nat_one_mod_four theorem Ο‡β‚„_nat_three_mod_four {n : β„•} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_nat_mod_four, hn] rfl #align zmod.Ο‡β‚„_nat_three_mod_four ZMod.Ο‡β‚„_nat_three_mod_four theorem Ο‡β‚„_int_one_mod_four {n : β„€} (hn : n % 4 = 1) : Ο‡β‚„ n = 1 := by rw [Ο‡β‚„_int_mod_four, hn] rfl #align zmod.Ο‡β‚„_int_one_mod_four ZMod.Ο‡β‚„_int_one_mod_four theorem Ο‡β‚„_int_three_mod_four {n : β„€} (hn : n % 4 = 3) : Ο‡β‚„ n = -1 := by rw [Ο‡β‚„_int_mod_four, hn] rfl #align zmod.Ο‡β‚„_int_three_mod_four ZMod.Ο‡β‚„_int_three_mod_four theorem neg_one_pow_div_two_of_one_mod_four {n : β„•} (hn : n % 4 = 1) : (-1 : β„€) ^ (n / 2) = 1 := by rw [← Ο‡β‚„_eq_neg_one_pow (Nat.odd_of_mod_four_eq_one hn), ← natCast_mod, hn] rfl #align zmod.neg_one_pow_div_two_of_one_mod_four ZMod.neg_one_pow_div_two_of_one_mod_four theorem neg_one_pow_div_two_of_three_mod_four {n : β„•} (hn : n % 4 = 3) : (-1 : β„€) ^ (n / 2) = -1 := by rw [← Ο‡β‚„_eq_neg_one_pow (Nat.odd_of_mod_four_eq_three hn), ← natCast_mod, hn] rfl #align zmod.neg_one_pow_div_two_of_three_mod_four ZMod.neg_one_pow_div_two_of_three_mod_four @[simps] def Ο‡β‚ˆ : MulChar (ZMod 8) β„€ where toFun := (![0, 1, 0, -1, 0, -1, 0, 1] : ZMod 8 β†’ β„€) map_one' := rfl map_mul' := by decide map_nonunit' := by decide #align zmod.Ο‡β‚ˆ ZMod.Ο‡β‚ˆ
Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean
142
146
theorem isQuadratic_Ο‡β‚ˆ : Ο‡β‚ˆ.IsQuadratic := by
intro a -- Porting note: was `decide!` fin_cases a all_goals decide
322
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp]
Mathlib/Data/PNat/Interval.lean
67
72
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map]
323
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp]
Mathlib/Data/PNat/Interval.lean
76
81
theorem card_Ico : (Ico a b).card = b - a := by
rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map]
323
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp]
Mathlib/Data/PNat/Interval.lean
85
90
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map]
323
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioc PNat.card_Ioc @[simp]
Mathlib/Data/PNat/Interval.lean
94
99
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [← Nat.card_Ioo] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map]
323
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioc PNat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioo PNat.card_Ioo @[simp]
Mathlib/Data/PNat/Interval.lean
103
104
theorem card_uIcc : (uIcc a b).card = (b - a : β„€).natAbs + 1 := by
rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map]
323
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioc PNat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioo PNat.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : β„€).natAbs + 1 := by rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map] #align pnat.card_uIcc PNat.card_uIcc -- Porting note: `simpNF` says `simp` can prove this
Mathlib/Data/PNat/Interval.lean
108
109
theorem card_fintype_Icc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [← card_Icc, Fintype.card_ofFinset]
323
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioc PNat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioo PNat.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : β„€).natAbs + 1 := by rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map] #align pnat.card_uIcc PNat.card_uIcc -- Porting note: `simpNF` says `simp` can prove this theorem card_fintype_Icc : Fintype.card (Set.Icc a b) = b + 1 - a := by rw [← card_Icc, Fintype.card_ofFinset] #align pnat.card_fintype_Icc PNat.card_fintype_Icc -- Porting note: `simpNF` says `simp` can prove this
Mathlib/Data/PNat/Interval.lean
113
114
theorem card_fintype_Ico : Fintype.card (Set.Ico a b) = b - a := by
rw [← card_Ico, Fintype.card_ofFinset]
323
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : β„•+) instance instLocallyFiniteOrder : LocallyFiniteOrder β„•+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β„•) b).subtype fun n : β„• => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Icc PNat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ico PNat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioc PNat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map] #align pnat.card_Ioo PNat.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : β„€).natAbs + 1 := by rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map] #align pnat.card_uIcc PNat.card_uIcc -- Porting note: `simpNF` says `simp` can prove this theorem card_fintype_Icc : Fintype.card (Set.Icc a b) = b + 1 - a := by rw [← card_Icc, Fintype.card_ofFinset] #align pnat.card_fintype_Icc PNat.card_fintype_Icc -- Porting note: `simpNF` says `simp` can prove this theorem card_fintype_Ico : Fintype.card (Set.Ico a b) = b - a := by rw [← card_Ico, Fintype.card_ofFinset] #align pnat.card_fintype_Ico PNat.card_fintype_Ico -- Porting note: `simpNF` says `simp` can prove this
Mathlib/Data/PNat/Interval.lean
118
119
theorem card_fintype_Ioc : Fintype.card (Set.Ioc a b) = b - a := by
rw [← card_Ioc, Fintype.card_ofFinset]
323
import Mathlib.Init.Algebra.Classes import Mathlib.Init.Data.Ordering.Basic #align_import init.data.ordering.lemmas from "leanprover-community/lean"@"4bd314f7bd5e0c9e813fc201f1279a23f13f9f1d" universe u namespace Ordering @[simp]
Mathlib/Init/Data/Ordering/Lemmas.lean
20
22
theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by
by_cases c <;> simp [*]
324
import Mathlib.Init.Algebra.Classes import Mathlib.Init.Data.Ordering.Basic #align_import init.data.ordering.lemmas from "leanprover-community/lean"@"4bd314f7bd5e0c9e813fc201f1279a23f13f9f1d" universe u namespace Ordering @[simp] theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by by_cases c <;> simp [*] #align ordering.ite_eq_lt_distrib Ordering.ite_eq_lt_distrib @[simp]
Mathlib/Init/Data/Ordering/Lemmas.lean
26
28
theorem ite_eq_eq_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.eq) = if c then a = Ordering.eq else b = Ordering.eq := by
by_cases c <;> simp [*]
324
import Mathlib.Init.Algebra.Classes import Mathlib.Init.Data.Ordering.Basic #align_import init.data.ordering.lemmas from "leanprover-community/lean"@"4bd314f7bd5e0c9e813fc201f1279a23f13f9f1d" universe u namespace Ordering @[simp] theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by by_cases c <;> simp [*] #align ordering.ite_eq_lt_distrib Ordering.ite_eq_lt_distrib @[simp] theorem ite_eq_eq_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.eq) = if c then a = Ordering.eq else b = Ordering.eq := by by_cases c <;> simp [*] #align ordering.ite_eq_eq_distrib Ordering.ite_eq_eq_distrib @[simp]
Mathlib/Init/Data/Ordering/Lemmas.lean
32
34
theorem ite_eq_gt_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.gt) = if c then a = Ordering.gt else b = Ordering.gt := by
by_cases c <;> simp [*]
324
import Mathlib.Algebra.Group.Semiconj.Defs import Mathlib.Init.Algebra.Classes #align_import algebra.group.commute from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered variable {G M S : Type*} @[to_additive "Two elements additively commute if `a + b = b + a`"] def Commute [Mul S] (a b : S) : Prop := SemiconjBy a b b #align commute Commute #align add_commute AddCommute @[to_additive] theorem commute_iff_eq [Mul S] (a b : S) : Commute a b ↔ a * b = b * a := Iff.rfl namespace Commute @[to_additive] protected theorem all [CommMagma S] (a b : S) : Commute a b := mul_comm a b #align commute.all Commute.allβ‚“ #align add_commute.all AddCommute.allβ‚“ -- not sure why this needs an `β‚“`, maybe instance names not aligned? section Group variable [Group G] {a b : G} @[to_additive] protected theorem mul_inv_cancel (h : Commute a b) : a * b * a⁻¹ = b := by rw [h.eq, mul_inv_cancel_right] #align commute.mul_inv_cancel Commute.mul_inv_cancel #align add_commute.add_neg_cancel AddCommute.add_neg_cancel @[to_additive]
Mathlib/Algebra/Group/Commute/Defs.lean
262
263
theorem mul_inv_cancel_assoc (h : Commute a b) : a * (b * a⁻¹) = b := by
rw [← mul_assoc, h.mul_inv_cancel]
325
import Mathlib.Algebra.Group.Commute.Defs import Mathlib.Algebra.Group.Units import Mathlib.Algebra.GroupWithZero.Defs import Mathlib.Algebra.Order.Monoid.Unbundled.Basic import Mathlib.Tactic.NthRewrite #align_import algebra.regular.basic from "leanprover-community/mathlib"@"5cd3c25312f210fec96ba1edb2aebfb2ccf2010f" variable {R : Type*} section Mul variable [Mul R] @[to_additive "An add-left-regular element is an element `c` such that addition on the left by `c` is injective."] def IsLeftRegular (c : R) := (c * Β·).Injective #align is_left_regular IsLeftRegular #align is_add_left_regular IsAddLeftRegular @[to_additive "An add-right-regular element is an element `c` such that addition on the right by `c` is injective."] def IsRightRegular (c : R) := (Β· * c).Injective #align is_right_regular IsRightRegular #align is_add_right_regular IsAddRightRegular structure IsAddRegular {R : Type*} [Add R] (c : R) : Prop where left : IsAddLeftRegular c -- Porting note: It seems like to_additive is misbehaving right : IsAddRightRegular c #align is_add_regular IsAddRegular structure IsRegular (c : R) : Prop where left : IsLeftRegular c right : IsRightRegular c #align is_regular IsRegular attribute [simp] IsRegular.left IsRegular.right attribute [to_additive] IsRegular @[to_additive] protected theorem MulLECancellable.isLeftRegular [PartialOrder R] {a : R} (ha : MulLECancellable a) : IsLeftRegular a := ha.Injective #align mul_le_cancellable.is_left_regular MulLECancellable.isLeftRegular #align add_le_cancellable.is_add_left_regular AddLECancellable.isAddLeftRegular theorem IsLeftRegular.right_of_commute {a : R} (ca : βˆ€ b, Commute a b) (h : IsLeftRegular a) : IsRightRegular a := fun x y xy => h <| (ca x).trans <| xy.trans <| (ca y).symm #align is_left_regular.right_of_commute IsLeftRegular.right_of_commute
Mathlib/Algebra/Regular/Basic.lean
91
94
theorem IsRightRegular.left_of_commute {a : R} (ca : βˆ€ b, Commute a b) (h : IsRightRegular a) : IsLeftRegular a := by
simp_rw [@Commute.symm_iff R _ a] at ca exact fun x y xy => h <| (ca x).trans <| xy.trans <| (ca y).symm
326
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Regular.Basic #align_import algebra.regular.pow from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" variable {R : Type*} {a b : R} section Monoid variable [Monoid R]
Mathlib/Algebra/Regular/Pow.lean
31
32
theorem IsLeftRegular.pow (n : β„•) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n) := by
simp only [IsLeftRegular, ← mul_left_iterate, rla.iterate n]
327
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Regular.Basic #align_import algebra.regular.pow from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" variable {R : Type*} {a b : R} section Monoid variable [Monoid R] theorem IsLeftRegular.pow (n : β„•) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n) := by simp only [IsLeftRegular, ← mul_left_iterate, rla.iterate n] #align is_left_regular.pow IsLeftRegular.pow
Mathlib/Algebra/Regular/Pow.lean
36
38
theorem IsRightRegular.pow (n : β„•) (rra : IsRightRegular a) : IsRightRegular (a ^ n) := by
rw [IsRightRegular, ← mul_right_iterate] exact rra.iterate n
327
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Regular.Basic #align_import algebra.regular.pow from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" variable {R : Type*} {a b : R} section Monoid variable [Monoid R] theorem IsLeftRegular.pow (n : β„•) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n) := by simp only [IsLeftRegular, ← mul_left_iterate, rla.iterate n] #align is_left_regular.pow IsLeftRegular.pow theorem IsRightRegular.pow (n : β„•) (rra : IsRightRegular a) : IsRightRegular (a ^ n) := by rw [IsRightRegular, ← mul_right_iterate] exact rra.iterate n #align is_right_regular.pow IsRightRegular.pow theorem IsRegular.pow (n : β„•) (ra : IsRegular a) : IsRegular (a ^ n) := ⟨IsLeftRegular.pow n ra.left, IsRightRegular.pow n ra.right⟩ #align is_regular.pow IsRegular.pow
Mathlib/Algebra/Regular/Pow.lean
47
50
theorem IsLeftRegular.pow_iff {n : β„•} (n0 : 0 < n) : IsLeftRegular (a ^ n) ↔ IsLeftRegular a := by
refine ⟨?_, IsLeftRegular.pow n⟩ rw [← Nat.succ_pred_eq_of_pos n0, pow_succ] exact IsLeftRegular.of_mul
327
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Regular.Basic #align_import algebra.regular.pow from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" variable {R : Type*} {a b : R} section Monoid variable [Monoid R] theorem IsLeftRegular.pow (n : β„•) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n) := by simp only [IsLeftRegular, ← mul_left_iterate, rla.iterate n] #align is_left_regular.pow IsLeftRegular.pow theorem IsRightRegular.pow (n : β„•) (rra : IsRightRegular a) : IsRightRegular (a ^ n) := by rw [IsRightRegular, ← mul_right_iterate] exact rra.iterate n #align is_right_regular.pow IsRightRegular.pow theorem IsRegular.pow (n : β„•) (ra : IsRegular a) : IsRegular (a ^ n) := ⟨IsLeftRegular.pow n ra.left, IsRightRegular.pow n ra.right⟩ #align is_regular.pow IsRegular.pow theorem IsLeftRegular.pow_iff {n : β„•} (n0 : 0 < n) : IsLeftRegular (a ^ n) ↔ IsLeftRegular a := by refine ⟨?_, IsLeftRegular.pow n⟩ rw [← Nat.succ_pred_eq_of_pos n0, pow_succ] exact IsLeftRegular.of_mul #align is_left_regular.pow_iff IsLeftRegular.pow_iff
Mathlib/Algebra/Regular/Pow.lean
54
58
theorem IsRightRegular.pow_iff {n : β„•} (n0 : 0 < n) : IsRightRegular (a ^ n) ↔ IsRightRegular a := by
refine ⟨?_, IsRightRegular.pow n⟩ rw [← Nat.succ_pred_eq_of_pos n0, pow_succ'] exact IsRightRegular.of_mul
327
import Mathlib.Algebra.Ring.Semiconj import Mathlib.Algebra.Ring.Units import Mathlib.Algebra.Group.Commute.Defs import Mathlib.Data.Bracket #align_import algebra.ring.commute from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w x variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {R : Type x} open Function namespace Commute @[simp] theorem add_right [Distrib R] {a b c : R} : Commute a b β†’ Commute a c β†’ Commute a (b + c) := SemiconjBy.add_right #align commute.add_right Commute.add_rightβ‚“ -- for some reason mathport expected `Semiring` instead of `Distrib`? @[simp] theorem add_left [Distrib R] {a b c : R} : Commute a c β†’ Commute b c β†’ Commute (a + b) c := SemiconjBy.add_left #align commute.add_left Commute.add_leftβ‚“ -- for some reason mathport expected `Semiring` instead of `Distrib`?
Mathlib/Algebra/Ring/Commute.lean
72
74
theorem mul_self_sub_mul_self_eq [NonUnitalNonAssocRing R] {a b : R} (h : Commute a b) : a * a - b * b = (a + b) * (a - b) := by
rw [add_mul, mul_sub, mul_sub, h.eq, sub_add_sub_cancel]
328
import Mathlib.Algebra.Ring.Semiconj import Mathlib.Algebra.Ring.Units import Mathlib.Algebra.Group.Commute.Defs import Mathlib.Data.Bracket #align_import algebra.ring.commute from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w x variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {R : Type x} open Function namespace Commute @[simp] theorem add_right [Distrib R] {a b c : R} : Commute a b β†’ Commute a c β†’ Commute a (b + c) := SemiconjBy.add_right #align commute.add_right Commute.add_rightβ‚“ -- for some reason mathport expected `Semiring` instead of `Distrib`? @[simp] theorem add_left [Distrib R] {a b c : R} : Commute a c β†’ Commute b c β†’ Commute (a + b) c := SemiconjBy.add_left #align commute.add_left Commute.add_leftβ‚“ -- for some reason mathport expected `Semiring` instead of `Distrib`? theorem mul_self_sub_mul_self_eq [NonUnitalNonAssocRing R] {a b : R} (h : Commute a b) : a * a - b * b = (a + b) * (a - b) := by rw [add_mul, mul_sub, mul_sub, h.eq, sub_add_sub_cancel] #align commute.mul_self_sub_mul_self_eq Commute.mul_self_sub_mul_self_eq
Mathlib/Algebra/Ring/Commute.lean
77
79
theorem mul_self_sub_mul_self_eq' [NonUnitalNonAssocRing R] {a b : R} (h : Commute a b) : a * a - b * b = (a - b) * (a + b) := by
rw [mul_add, sub_mul, sub_mul, h.eq, sub_add_sub_cancel]
328
import Mathlib.Algebra.Ring.Semiconj import Mathlib.Algebra.Ring.Units import Mathlib.Algebra.Group.Commute.Defs import Mathlib.Data.Bracket #align_import algebra.ring.commute from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w x variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {R : Type x} open Function namespace Commute @[simp] theorem add_right [Distrib R] {a b c : R} : Commute a b β†’ Commute a c β†’ Commute a (b + c) := SemiconjBy.add_right #align commute.add_right Commute.add_rightβ‚“ -- for some reason mathport expected `Semiring` instead of `Distrib`? @[simp] theorem add_left [Distrib R] {a b c : R} : Commute a c β†’ Commute b c β†’ Commute (a + b) c := SemiconjBy.add_left #align commute.add_left Commute.add_leftβ‚“ -- for some reason mathport expected `Semiring` instead of `Distrib`? theorem mul_self_sub_mul_self_eq [NonUnitalNonAssocRing R] {a b : R} (h : Commute a b) : a * a - b * b = (a + b) * (a - b) := by rw [add_mul, mul_sub, mul_sub, h.eq, sub_add_sub_cancel] #align commute.mul_self_sub_mul_self_eq Commute.mul_self_sub_mul_self_eq theorem mul_self_sub_mul_self_eq' [NonUnitalNonAssocRing R] {a b : R} (h : Commute a b) : a * a - b * b = (a - b) * (a + b) := by rw [mul_add, sub_mul, sub_mul, h.eq, sub_add_sub_cancel] #align commute.mul_self_sub_mul_self_eq' Commute.mul_self_sub_mul_self_eq'
Mathlib/Algebra/Ring/Commute.lean
82
85
theorem mul_self_eq_mul_self_iff [NonUnitalNonAssocRing R] [NoZeroDivisors R] {a b : R} (h : Commute a b) : a * a = b * b ↔ a = b ∨ a = -b := by
rw [← sub_eq_zero, h.mul_self_sub_mul_self_eq, mul_eq_zero, or_comm, sub_eq_zero, add_eq_zero_iff_eq_neg]
328
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.Normed.Group.Completion #align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" noncomputable section open Set NormedAddGroupHom UniformSpace section Completion variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H] {K : Type*} [SeminormedAddCommGroup K] def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) (Completion H) := .ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map #align normed_add_group_hom.completion NormedAddGroupHom.completion theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) : f.completion x = Completion.map f x := rfl #align normed_add_group_hom.completion_def NormedAddGroupHom.completion_def @[simp] theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) : (f.completion : Completion G β†’ Completion H) = Completion.map f := rfl #align normed_add_group_hom.completion_coe_to_fun NormedAddGroupHom.completion_coe_to_fun -- Porting note: `@[simp]` moved to the next lemma theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) : f.completion g = f g := Completion.map_coe f.uniformContinuous _ #align normed_add_group_hom.completion_coe NormedAddGroupHom.completion_coe @[simp] theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) : Completion.map f g = f g := f.completion_coe g @[simps] def normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ NormedAddGroupHom (Completion G) (Completion H) where toFun := NormedAddGroupHom.completion map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero map_add' f g := toAddMonoidHom_injective <| f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous #align normed_add_group_hom_completion_hom normedAddGroupHomCompletionHom #align normed_add_group_hom_completion_hom_apply normedAddGroupHomCompletionHom_apply @[simp]
Mathlib/Analysis/Normed/Group/HomCompletion.lean
100
104
theorem NormedAddGroupHom.completion_id : (NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by
ext x rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id] rfl
329
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.Normed.Group.Completion #align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" noncomputable section open Set NormedAddGroupHom UniformSpace section Completion variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H] {K : Type*} [SeminormedAddCommGroup K] def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) (Completion H) := .ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map #align normed_add_group_hom.completion NormedAddGroupHom.completion theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) : f.completion x = Completion.map f x := rfl #align normed_add_group_hom.completion_def NormedAddGroupHom.completion_def @[simp] theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) : (f.completion : Completion G β†’ Completion H) = Completion.map f := rfl #align normed_add_group_hom.completion_coe_to_fun NormedAddGroupHom.completion_coe_to_fun -- Porting note: `@[simp]` moved to the next lemma theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) : f.completion g = f g := Completion.map_coe f.uniformContinuous _ #align normed_add_group_hom.completion_coe NormedAddGroupHom.completion_coe @[simp] theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) : Completion.map f g = f g := f.completion_coe g @[simps] def normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ NormedAddGroupHom (Completion G) (Completion H) where toFun := NormedAddGroupHom.completion map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero map_add' f g := toAddMonoidHom_injective <| f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous #align normed_add_group_hom_completion_hom normedAddGroupHomCompletionHom #align normed_add_group_hom_completion_hom_apply normedAddGroupHomCompletionHom_apply @[simp] theorem NormedAddGroupHom.completion_id : (NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by ext x rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id] rfl #align normed_add_group_hom.completion_id NormedAddGroupHom.completion_id
Mathlib/Analysis/Normed/Group/HomCompletion.lean
107
113
theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) : g.completion.comp f.completion = (g.comp f).completion := by
ext x rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def, NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun, Completion.map_comp g.uniformContinuous f.uniformContinuous] rfl
329
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.Normed.Group.Completion #align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" noncomputable section open Set NormedAddGroupHom UniformSpace section Completion variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H] {K : Type*} [SeminormedAddCommGroup K] def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) (Completion H) := .ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map #align normed_add_group_hom.completion NormedAddGroupHom.completion theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) : f.completion x = Completion.map f x := rfl #align normed_add_group_hom.completion_def NormedAddGroupHom.completion_def @[simp] theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) : (f.completion : Completion G β†’ Completion H) = Completion.map f := rfl #align normed_add_group_hom.completion_coe_to_fun NormedAddGroupHom.completion_coe_to_fun -- Porting note: `@[simp]` moved to the next lemma theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) : f.completion g = f g := Completion.map_coe f.uniformContinuous _ #align normed_add_group_hom.completion_coe NormedAddGroupHom.completion_coe @[simp] theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) : Completion.map f g = f g := f.completion_coe g @[simps] def normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ NormedAddGroupHom (Completion G) (Completion H) where toFun := NormedAddGroupHom.completion map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero map_add' f g := toAddMonoidHom_injective <| f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous #align normed_add_group_hom_completion_hom normedAddGroupHomCompletionHom #align normed_add_group_hom_completion_hom_apply normedAddGroupHomCompletionHom_apply @[simp] theorem NormedAddGroupHom.completion_id : (NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by ext x rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id] rfl #align normed_add_group_hom.completion_id NormedAddGroupHom.completion_id theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) : g.completion.comp f.completion = (g.comp f).completion := by ext x rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def, NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun, Completion.map_comp g.uniformContinuous f.uniformContinuous] rfl #align normed_add_group_hom.completion_comp NormedAddGroupHom.completion_comp theorem NormedAddGroupHom.completion_neg (f : NormedAddGroupHom G H) : (-f).completion = -f.completion := map_neg (normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ _) f #align normed_add_group_hom.completion_neg NormedAddGroupHom.completion_neg theorem NormedAddGroupHom.completion_add (f g : NormedAddGroupHom G H) : (f + g).completion = f.completion + g.completion := normedAddGroupHomCompletionHom.map_add f g #align normed_add_group_hom.completion_add NormedAddGroupHom.completion_add theorem NormedAddGroupHom.completion_sub (f g : NormedAddGroupHom G H) : (f - g).completion = f.completion - g.completion := map_sub (normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ _) f g #align normed_add_group_hom.completion_sub NormedAddGroupHom.completion_sub @[simp] theorem NormedAddGroupHom.zero_completion : (0 : NormedAddGroupHom G H).completion = 0 := normedAddGroupHomCompletionHom.map_zero #align normed_add_group_hom.zero_completion NormedAddGroupHom.zero_completion @[simps] -- Porting note: added `@[simps]` def NormedAddCommGroup.toCompl : NormedAddGroupHom G (Completion G) where toFun := (↑) map_add' := Completion.toCompl.map_add bound' := ⟨1, by simp [le_refl]⟩ #align normed_add_comm_group.to_compl NormedAddCommGroup.toCompl open NormedAddCommGroup theorem NormedAddCommGroup.norm_toCompl (x : G) : β€–toCompl xβ€– = β€–xβ€– := Completion.norm_coe x #align normed_add_comm_group.norm_to_compl NormedAddCommGroup.norm_toCompl theorem NormedAddCommGroup.denseRange_toCompl : DenseRange (toCompl : G β†’ Completion G) := Completion.denseInducing_coe.dense #align normed_add_comm_group.dense_range_to_compl NormedAddCommGroup.denseRange_toCompl @[simp]
Mathlib/Analysis/Normed/Group/HomCompletion.lean
155
156
theorem NormedAddGroupHom.completion_toCompl (f : NormedAddGroupHom G H) : f.completion.comp toCompl = toCompl.comp f := by
ext x; simp
329
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.Normed.Group.Completion #align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" noncomputable section open Set NormedAddGroupHom UniformSpace section Completion variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H] {K : Type*} [SeminormedAddCommGroup K] def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) (Completion H) := .ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map #align normed_add_group_hom.completion NormedAddGroupHom.completion theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) : f.completion x = Completion.map f x := rfl #align normed_add_group_hom.completion_def NormedAddGroupHom.completion_def @[simp] theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) : (f.completion : Completion G β†’ Completion H) = Completion.map f := rfl #align normed_add_group_hom.completion_coe_to_fun NormedAddGroupHom.completion_coe_to_fun -- Porting note: `@[simp]` moved to the next lemma theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) : f.completion g = f g := Completion.map_coe f.uniformContinuous _ #align normed_add_group_hom.completion_coe NormedAddGroupHom.completion_coe @[simp] theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) : Completion.map f g = f g := f.completion_coe g @[simps] def normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ NormedAddGroupHom (Completion G) (Completion H) where toFun := NormedAddGroupHom.completion map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero map_add' f g := toAddMonoidHom_injective <| f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous #align normed_add_group_hom_completion_hom normedAddGroupHomCompletionHom #align normed_add_group_hom_completion_hom_apply normedAddGroupHomCompletionHom_apply @[simp] theorem NormedAddGroupHom.completion_id : (NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by ext x rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id] rfl #align normed_add_group_hom.completion_id NormedAddGroupHom.completion_id theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) : g.completion.comp f.completion = (g.comp f).completion := by ext x rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def, NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun, Completion.map_comp g.uniformContinuous f.uniformContinuous] rfl #align normed_add_group_hom.completion_comp NormedAddGroupHom.completion_comp theorem NormedAddGroupHom.completion_neg (f : NormedAddGroupHom G H) : (-f).completion = -f.completion := map_neg (normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ _) f #align normed_add_group_hom.completion_neg NormedAddGroupHom.completion_neg theorem NormedAddGroupHom.completion_add (f g : NormedAddGroupHom G H) : (f + g).completion = f.completion + g.completion := normedAddGroupHomCompletionHom.map_add f g #align normed_add_group_hom.completion_add NormedAddGroupHom.completion_add theorem NormedAddGroupHom.completion_sub (f g : NormedAddGroupHom G H) : (f - g).completion = f.completion - g.completion := map_sub (normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ _) f g #align normed_add_group_hom.completion_sub NormedAddGroupHom.completion_sub @[simp] theorem NormedAddGroupHom.zero_completion : (0 : NormedAddGroupHom G H).completion = 0 := normedAddGroupHomCompletionHom.map_zero #align normed_add_group_hom.zero_completion NormedAddGroupHom.zero_completion @[simps] -- Porting note: added `@[simps]` def NormedAddCommGroup.toCompl : NormedAddGroupHom G (Completion G) where toFun := (↑) map_add' := Completion.toCompl.map_add bound' := ⟨1, by simp [le_refl]⟩ #align normed_add_comm_group.to_compl NormedAddCommGroup.toCompl open NormedAddCommGroup theorem NormedAddCommGroup.norm_toCompl (x : G) : β€–toCompl xβ€– = β€–xβ€– := Completion.norm_coe x #align normed_add_comm_group.norm_to_compl NormedAddCommGroup.norm_toCompl theorem NormedAddCommGroup.denseRange_toCompl : DenseRange (toCompl : G β†’ Completion G) := Completion.denseInducing_coe.dense #align normed_add_comm_group.dense_range_to_compl NormedAddCommGroup.denseRange_toCompl @[simp] theorem NormedAddGroupHom.completion_toCompl (f : NormedAddGroupHom G H) : f.completion.comp toCompl = toCompl.comp f := by ext x; simp #align normed_add_group_hom.completion_to_compl NormedAddGroupHom.completion_toCompl @[simp] theorem NormedAddGroupHom.norm_completion (f : NormedAddGroupHom G H) : β€–f.completionβ€– = β€–fβ€– := le_antisymm (ofLipschitz_norm_le _ _) <| opNorm_le_bound _ (norm_nonneg _) fun x => by simpa using f.completion.le_opNorm x #align normed_add_group_hom.norm_completion NormedAddGroupHom.norm_completion
Mathlib/Analysis/Normed/Group/HomCompletion.lean
165
168
theorem NormedAddGroupHom.ker_le_ker_completion (f : NormedAddGroupHom G H) : (toCompl.comp <| incl f.ker).range ≀ f.completion.ker := by
rintro _ ⟨⟨g, hβ‚€ : f g = 0⟩, rfl⟩ simp [hβ‚€, mem_ker, Completion.coe_zero]
329
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.Normed.Group.Completion #align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" noncomputable section open Set NormedAddGroupHom UniformSpace section Completion variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H] {K : Type*} [SeminormedAddCommGroup K] def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) (Completion H) := .ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map #align normed_add_group_hom.completion NormedAddGroupHom.completion theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) : f.completion x = Completion.map f x := rfl #align normed_add_group_hom.completion_def NormedAddGroupHom.completion_def @[simp] theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) : (f.completion : Completion G β†’ Completion H) = Completion.map f := rfl #align normed_add_group_hom.completion_coe_to_fun NormedAddGroupHom.completion_coe_to_fun -- Porting note: `@[simp]` moved to the next lemma theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) : f.completion g = f g := Completion.map_coe f.uniformContinuous _ #align normed_add_group_hom.completion_coe NormedAddGroupHom.completion_coe @[simp] theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) : Completion.map f g = f g := f.completion_coe g @[simps] def normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ NormedAddGroupHom (Completion G) (Completion H) where toFun := NormedAddGroupHom.completion map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero map_add' f g := toAddMonoidHom_injective <| f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous #align normed_add_group_hom_completion_hom normedAddGroupHomCompletionHom #align normed_add_group_hom_completion_hom_apply normedAddGroupHomCompletionHom_apply @[simp] theorem NormedAddGroupHom.completion_id : (NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by ext x rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id] rfl #align normed_add_group_hom.completion_id NormedAddGroupHom.completion_id theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) : g.completion.comp f.completion = (g.comp f).completion := by ext x rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def, NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun, Completion.map_comp g.uniformContinuous f.uniformContinuous] rfl #align normed_add_group_hom.completion_comp NormedAddGroupHom.completion_comp theorem NormedAddGroupHom.completion_neg (f : NormedAddGroupHom G H) : (-f).completion = -f.completion := map_neg (normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ _) f #align normed_add_group_hom.completion_neg NormedAddGroupHom.completion_neg theorem NormedAddGroupHom.completion_add (f g : NormedAddGroupHom G H) : (f + g).completion = f.completion + g.completion := normedAddGroupHomCompletionHom.map_add f g #align normed_add_group_hom.completion_add NormedAddGroupHom.completion_add theorem NormedAddGroupHom.completion_sub (f g : NormedAddGroupHom G H) : (f - g).completion = f.completion - g.completion := map_sub (normedAddGroupHomCompletionHom : NormedAddGroupHom G H β†’+ _) f g #align normed_add_group_hom.completion_sub NormedAddGroupHom.completion_sub @[simp] theorem NormedAddGroupHom.zero_completion : (0 : NormedAddGroupHom G H).completion = 0 := normedAddGroupHomCompletionHom.map_zero #align normed_add_group_hom.zero_completion NormedAddGroupHom.zero_completion @[simps] -- Porting note: added `@[simps]` def NormedAddCommGroup.toCompl : NormedAddGroupHom G (Completion G) where toFun := (↑) map_add' := Completion.toCompl.map_add bound' := ⟨1, by simp [le_refl]⟩ #align normed_add_comm_group.to_compl NormedAddCommGroup.toCompl open NormedAddCommGroup theorem NormedAddCommGroup.norm_toCompl (x : G) : β€–toCompl xβ€– = β€–xβ€– := Completion.norm_coe x #align normed_add_comm_group.norm_to_compl NormedAddCommGroup.norm_toCompl theorem NormedAddCommGroup.denseRange_toCompl : DenseRange (toCompl : G β†’ Completion G) := Completion.denseInducing_coe.dense #align normed_add_comm_group.dense_range_to_compl NormedAddCommGroup.denseRange_toCompl @[simp] theorem NormedAddGroupHom.completion_toCompl (f : NormedAddGroupHom G H) : f.completion.comp toCompl = toCompl.comp f := by ext x; simp #align normed_add_group_hom.completion_to_compl NormedAddGroupHom.completion_toCompl @[simp] theorem NormedAddGroupHom.norm_completion (f : NormedAddGroupHom G H) : β€–f.completionβ€– = β€–fβ€– := le_antisymm (ofLipschitz_norm_le _ _) <| opNorm_le_bound _ (norm_nonneg _) fun x => by simpa using f.completion.le_opNorm x #align normed_add_group_hom.norm_completion NormedAddGroupHom.norm_completion theorem NormedAddGroupHom.ker_le_ker_completion (f : NormedAddGroupHom G H) : (toCompl.comp <| incl f.ker).range ≀ f.completion.ker := by rintro _ ⟨⟨g, hβ‚€ : f g = 0⟩, rfl⟩ simp [hβ‚€, mem_ker, Completion.coe_zero] #align normed_add_group_hom.ker_le_ker_completion NormedAddGroupHom.ker_le_ker_completion
Mathlib/Analysis/Normed/Group/HomCompletion.lean
171
193
theorem NormedAddGroupHom.ker_completion {f : NormedAddGroupHom G H} {C : ℝ} (h : f.SurjectiveOnWith f.range C) : (f.completion.ker : Set <| Completion G) = closure (toCompl.comp <| incl f.ker).range := by
refine le_antisymm ?_ (closure_minimal f.ker_le_ker_completion f.completion.isClosed_ker) rintro hatg (hatg_in : f.completion hatg = 0) rw [SeminormedAddCommGroup.mem_closure_iff] intro Ξ΅ Ξ΅_pos rcases h.exists_pos with ⟨C', C'_pos, hC'⟩ rcases exists_pos_mul_lt Ξ΅_pos (1 + C' * β€–fβ€–) with ⟨δ, Ξ΄_pos, hδ⟩ obtain ⟨_, ⟨g : G, rfl⟩, hg : β€–hatg - gβ€– < δ⟩ := SeminormedAddCommGroup.mem_closure_iff.mp (Completion.denseInducing_coe.dense hatg) Ξ΄ Ξ΄_pos obtain ⟨g' : G, hgg' : f g' = f g, hfg : β€–g'β€– ≀ C' * β€–f gβ€–βŸ© := hC' (f g) (mem_range_self _ g) have mem_ker : g - g' ∈ f.ker := by rw [f.mem_ker, map_sub, sub_eq_zero.mpr hgg'.symm] refine ⟨_, ⟨⟨g - g', mem_ker⟩, rfl⟩, ?_⟩ have : β€–f gβ€– ≀ β€–fβ€– * Ξ΄ := calc β€–f gβ€– ≀ β€–fβ€– * β€–hatg - gβ€– := by simpa [hatg_in] using f.completion.le_opNorm (hatg - g) _ ≀ β€–fβ€– * Ξ΄ := by gcongr calc β€–hatg - ↑(g - g')β€– = β€–hatg - g + g'β€– := by rw [Completion.coe_sub, sub_add] _ ≀ β€–hatg - gβ€– + β€–(g' : Completion G)β€– := norm_add_le _ _ _ = β€–hatg - gβ€– + β€–g'β€– := by rw [Completion.norm_coe] _ < Ξ΄ + C' * β€–f gβ€– := add_lt_add_of_lt_of_le hg hfg _ ≀ Ξ΄ + C' * (β€–fβ€– * Ξ΄) := by gcongr _ < Ξ΅ := by simpa only [add_mul, one_mul, mul_assoc] using hΞ΄
329
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.Normed.Group.Completion #align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" noncomputable section open Set NormedAddGroupHom UniformSpace section Extension variable {G : Type*} [SeminormedAddCommGroup G] variable {H : Type*} [SeminormedAddCommGroup H] [T0Space H] [CompleteSpace H] def NormedAddGroupHom.extension (f : NormedAddGroupHom G H) : NormedAddGroupHom (Completion G) H := .ofLipschitz (f.toAddMonoidHom.extension f.continuous) <| let _ := MetricSpace.ofT0PseudoMetricSpace H f.lipschitz.completion_extension #align normed_add_group_hom.extension NormedAddGroupHom.extension theorem NormedAddGroupHom.extension_def (f : NormedAddGroupHom G H) (v : G) : f.extension v = Completion.extension f v := rfl #align normed_add_group_hom.extension_def NormedAddGroupHom.extension_def @[simp] theorem NormedAddGroupHom.extension_coe (f : NormedAddGroupHom G H) (v : G) : f.extension v = f v := AddMonoidHom.extension_coe _ f.continuous _ #align normed_add_group_hom.extension_coe NormedAddGroupHom.extension_coe theorem NormedAddGroupHom.extension_coe_to_fun (f : NormedAddGroupHom G H) : (f.extension : Completion G β†’ H) = Completion.extension f := rfl #align normed_add_group_hom.extension_coe_to_fun NormedAddGroupHom.extension_coe_to_fun
Mathlib/Analysis/Normed/Group/HomCompletion.lean
226
230
theorem NormedAddGroupHom.extension_unique (f : NormedAddGroupHom G H) {g : NormedAddGroupHom (Completion G) H} (hg : βˆ€ v, f v = g v) : f.extension = g := by
ext v rw [NormedAddGroupHom.extension_coe_to_fun, Completion.extension_unique f.uniformContinuous g.uniformContinuous fun a => hg a]
329
import Mathlib.CategoryTheory.Limits.Shapes.Equalizers import Mathlib.CategoryTheory.Limits.Shapes.CommSq import Mathlib.CategoryTheory.Limits.Shapes.RegularMono #align_import category_theory.limits.shapes.kernel_pair from "leanprover-community/mathlib"@"f6bab67886fb92c3e2f539cc90a83815f69a189d" universe v u uβ‚‚ namespace CategoryTheory open CategoryTheory CategoryTheory.Category CategoryTheory.Limits variable {C : Type u} [Category.{v} C] variable {R X Y Z : C} (f : X ⟢ Y) (a b : R ⟢ X) abbrev IsKernelPair := IsPullback a b f f #align category_theory.is_kernel_pair CategoryTheory.IsKernelPair namespace IsKernelPair instance : Subsingleton (IsKernelPair f a b) := ⟨fun P Q => by cases P cases Q congr ⟩ theorem id_of_mono [Mono f] : IsKernelPair f (πŸ™ _) (πŸ™ _) := ⟨⟨rfl⟩, ⟨PullbackCone.isLimitMkIdId _⟩⟩ #align category_theory.is_kernel_pair.id_of_mono CategoryTheory.IsKernelPair.id_of_mono instance [Mono f] : Inhabited (IsKernelPair f (πŸ™ _) (πŸ™ _)) := ⟨id_of_mono f⟩ variable {f a b} -- Porting note: `lift` and the two following simp lemmas were introduced to ease the port noncomputable def lift {S : C} (k : IsKernelPair f a b) (p q : S ⟢ X) (w : p ≫ f = q ≫ f) : S ⟢ R := PullbackCone.IsLimit.lift k.isLimit _ _ w @[reassoc (attr := simp)] lemma lift_fst {S : C} (k : IsKernelPair f a b) (p q : S ⟢ X) (w : p ≫ f = q ≫ f) : k.lift p q w ≫ a = p := PullbackCone.IsLimit.lift_fst _ _ _ _ @[reassoc (attr := simp)] lemma lift_snd {S : C} (k : IsKernelPair f a b) (p q : S ⟢ X) (w : p ≫ f = q ≫ f) : k.lift p q w ≫ b = q := PullbackCone.IsLimit.lift_snd _ _ _ _ noncomputable def lift' {S : C} (k : IsKernelPair f a b) (p q : S ⟢ X) (w : p ≫ f = q ≫ f) : { t : S ⟢ R // t ≫ a = p ∧ t ≫ b = q } := ⟨k.lift p q w, by simp⟩ #align category_theory.is_kernel_pair.lift' CategoryTheory.IsKernelPair.lift' theorem cancel_right {f₁ : X ⟢ Y} {fβ‚‚ : Y ⟢ Z} (comm : a ≫ f₁ = b ≫ f₁) (big_k : IsKernelPair (f₁ ≫ fβ‚‚) a b) : IsKernelPair f₁ a b := { w := comm isLimit' := ⟨PullbackCone.isLimitAux' _ fun s => by let s' : PullbackCone (f₁ ≫ fβ‚‚) (f₁ ≫ fβ‚‚) := PullbackCone.mk s.fst s.snd (s.condition_assoc _) refine ⟨big_k.isLimit.lift s', big_k.isLimit.fac _ WalkingCospan.left, big_k.isLimit.fac _ WalkingCospan.right, fun m₁ mβ‚‚ => ?_⟩ apply big_k.isLimit.hom_ext refine (PullbackCone.mk a b ?_ : PullbackCone (f₁ ≫ fβ‚‚) _).equalizer_ext ?_ ?_ Β· apply reassoc_of% comm Β· apply m₁.trans (big_k.isLimit.fac s' WalkingCospan.left).symm Β· apply mβ‚‚.trans (big_k.isLimit.fac s' WalkingCospan.right).symm⟩ } #align category_theory.is_kernel_pair.cancel_right CategoryTheory.IsKernelPair.cancel_right theorem cancel_right_of_mono {f₁ : X ⟢ Y} {fβ‚‚ : Y ⟢ Z} [Mono fβ‚‚] (big_k : IsKernelPair (f₁ ≫ fβ‚‚) a b) : IsKernelPair f₁ a b := cancel_right (by rw [← cancel_mono fβ‚‚, assoc, assoc, big_k.w]) big_k #align category_theory.is_kernel_pair.cancel_right_of_mono CategoryTheory.IsKernelPair.cancel_right_of_mono
Mathlib/CategoryTheory/Limits/Shapes/KernelPair.lean
139
150
theorem comp_of_mono {f₁ : X ⟢ Y} {fβ‚‚ : Y ⟢ Z} [Mono fβ‚‚] (small_k : IsKernelPair f₁ a b) : IsKernelPair (f₁ ≫ fβ‚‚) a b := { w := by
rw [small_k.w_assoc] isLimit' := ⟨by refine PullbackCone.isLimitAux _ (fun s => small_k.lift s.fst s.snd (by rw [← cancel_mono fβ‚‚, assoc, s.condition, assoc])) (by simp) (by simp) ?_ intro s m hm apply small_k.isLimit.hom_ext apply PullbackCone.equalizer_ext small_k.cone _ _ Β· exact (hm WalkingCospan.left).trans (by simp) Β· exact (hm WalkingCospan.right).trans (by simp)⟩ }
330
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Unary variable (xs : Vector Ξ± n) (f₁ : Ξ² β†’ σ₁ β†’ σ₁ Γ— Ξ³) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²) @[simp]
Mathlib/Data/Vector/MapLemmas.lean
27
35
theorem mapAccumr_mapAccumr : mapAccumr f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd s₁ = let m := (mapAccumr (fun x s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by
induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Unary variable (xs : Vector Ξ± n) (f₁ : Ξ² β†’ σ₁ β†’ σ₁ Γ— Ξ³) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²) @[simp] theorem mapAccumr_mapAccumr : mapAccumr f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd s₁ = let m := (mapAccumr (fun x s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
38
40
theorem mapAccumr_map (fβ‚‚ : Ξ± β†’ Ξ²) : (mapAccumr f₁ (map fβ‚‚ xs) s) = (mapAccumr (fun x s => f₁ (fβ‚‚ x) s) xs s) := by
induction xs using Vector.revInductionOn generalizing s <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Unary variable (xs : Vector Ξ± n) (f₁ : Ξ² β†’ σ₁ β†’ σ₁ Γ— Ξ³) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²) @[simp] theorem mapAccumr_mapAccumr : mapAccumr f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd s₁ = let m := (mapAccumr (fun x s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapAccumr_map (fβ‚‚ : Ξ± β†’ Ξ²) : (mapAccumr f₁ (map fβ‚‚ xs) s) = (mapAccumr (fun x s => f₁ (fβ‚‚ x) s) xs s) := by induction xs using Vector.revInductionOn generalizing s <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
43
47
theorem map_mapAccumr (f₁ : Ξ² β†’ Ξ³) : (map f₁ (mapAccumr fβ‚‚ xs s).snd) = (mapAccumr (fun x s => let r := (fβ‚‚ x s); (r.fst, f₁ r.snd) ) xs s).snd := by
induction xs using Vector.revInductionOn generalizing s <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Unary variable (xs : Vector Ξ± n) (f₁ : Ξ² β†’ σ₁ β†’ σ₁ Γ— Ξ³) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²) @[simp] theorem mapAccumr_mapAccumr : mapAccumr f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd s₁ = let m := (mapAccumr (fun x s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapAccumr_map (fβ‚‚ : Ξ± β†’ Ξ²) : (mapAccumr f₁ (map fβ‚‚ xs) s) = (mapAccumr (fun x s => f₁ (fβ‚‚ x) s) xs s) := by induction xs using Vector.revInductionOn generalizing s <;> simp_all @[simp] theorem map_mapAccumr (f₁ : Ξ² β†’ Ξ³) : (map f₁ (mapAccumr fβ‚‚ xs s).snd) = (mapAccumr (fun x s => let r := (fβ‚‚ x s); (r.fst, f₁ r.snd) ) xs s).snd := by induction xs using Vector.revInductionOn generalizing s <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
50
52
theorem map_map (f₁ : Ξ² β†’ Ξ³) (fβ‚‚ : Ξ± β†’ Ξ²) : map f₁ (map fβ‚‚ xs) = map (fun x => f₁ <| fβ‚‚ x) xs := by
induction xs <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp]
Mathlib/Data/Vector/MapLemmas.lean
60
68
theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
71
73
theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by
induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
76
84
theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
87
89
theorem mapβ‚‚_map_right (f₁ : Ξ± β†’ Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ² β†’ Ξ³) : mapβ‚‚ f₁ xs (map fβ‚‚ ys) = mapβ‚‚ (fun x y => f₁ x (fβ‚‚ y)) xs ys := by
induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_right (f₁ : Ξ± β†’ Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ² β†’ Ξ³) : mapβ‚‚ f₁ xs (map fβ‚‚ ys) = mapβ‚‚ (fun x y => f₁ x (fβ‚‚ y)) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
92
100
theorem mapAccumr_mapAccumrβ‚‚ (f₁ : Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumr f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x y s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_right (f₁ : Ξ± β†’ Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ² β†’ Ξ³) : mapβ‚‚ f₁ xs (map fβ‚‚ ys) = mapβ‚‚ (fun x y => f₁ x (fβ‚‚ y)) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumr_mapAccumrβ‚‚ (f₁ : Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumr f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x y s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
103
105
theorem map_mapβ‚‚ (f₁ : Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Ξ³) : map f₁ (mapβ‚‚ fβ‚‚ xs ys) = mapβ‚‚ (fun x y => f₁ <| fβ‚‚ x y) xs ys := by
induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_right (f₁ : Ξ± β†’ Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ² β†’ Ξ³) : mapβ‚‚ f₁ xs (map fβ‚‚ ys) = mapβ‚‚ (fun x y => f₁ x (fβ‚‚ y)) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumr_mapAccumrβ‚‚ (f₁ : Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumr f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x y s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem map_mapβ‚‚ (f₁ : Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Ξ³) : map f₁ (mapβ‚‚ fβ‚‚ xs ys) = mapβ‚‚ (fun x y => f₁ <| fβ‚‚ x y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
108
117
theorem mapAccumrβ‚‚_mapAccumrβ‚‚_left_left (f₁ : Ξ³ β†’ Ξ± β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd xs s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ rβ‚‚.snd x s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_right (f₁ : Ξ± β†’ Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ² β†’ Ξ³) : mapβ‚‚ f₁ xs (map fβ‚‚ ys) = mapβ‚‚ (fun x y => f₁ x (fβ‚‚ y)) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumr_mapAccumrβ‚‚ (f₁ : Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumr f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x y s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem map_mapβ‚‚ (f₁ : Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Ξ³) : map f₁ (mapβ‚‚ fβ‚‚ xs ys) = mapβ‚‚ (fun x y => f₁ <| fβ‚‚ x y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumrβ‚‚_left_left (f₁ : Ξ³ β†’ Ξ± β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd xs s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ rβ‚‚.snd x s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
120
130
theorem mapAccumrβ‚‚_mapAccumrβ‚‚_left_right (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd ys s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ rβ‚‚.snd y s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_right (f₁ : Ξ± β†’ Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ² β†’ Ξ³) : mapβ‚‚ f₁ xs (map fβ‚‚ ys) = mapβ‚‚ (fun x y => f₁ x (fβ‚‚ y)) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumr_mapAccumrβ‚‚ (f₁ : Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumr f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x y s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem map_mapβ‚‚ (f₁ : Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Ξ³) : map f₁ (mapβ‚‚ fβ‚‚ xs ys) = mapβ‚‚ (fun x y => f₁ <| fβ‚‚ x y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumrβ‚‚_left_left (f₁ : Ξ³ β†’ Ξ± β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd xs s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ rβ‚‚.snd x s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumrβ‚‚_left_right (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd ys s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ rβ‚‚.snd y s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
133
142
theorem mapAccumrβ‚‚_mapAccumrβ‚‚_right_left (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ x rβ‚‚.snd s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumr_right (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumr fβ‚‚ ys sβ‚‚).snd s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ y s.snd let r₁ := f₁ x rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapβ‚‚_map_right (f₁ : Ξ± β†’ Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ² β†’ Ξ³) : mapβ‚‚ f₁ xs (map fβ‚‚ ys) = mapβ‚‚ (fun x y => f₁ x (fβ‚‚ y)) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumr_mapAccumrβ‚‚ (f₁ : Ξ³ β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumr f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x y s.snd let r₁ := f₁ rβ‚‚.snd s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem map_mapβ‚‚ (f₁ : Ξ³ β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Ξ³) : map f₁ (mapβ‚‚ fβ‚‚ xs ys) = mapβ‚‚ (fun x y => f₁ <| fβ‚‚ x y) xs ys := by induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumrβ‚‚_left_left (f₁ : Ξ³ β†’ Ξ± β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd xs s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ rβ‚‚.snd x s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumrβ‚‚_left_right (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd ys s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ rβ‚‚.snd y s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp] theorem mapAccumrβ‚‚_mapAccumrβ‚‚_right_left (f₁ : Ξ± β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ xs (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ x rβ‚‚.snd s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
145
154
theorem mapAccumrβ‚‚_mapAccumrβ‚‚_right_right (f₁ : Ξ² β†’ Ξ³ β†’ σ₁ β†’ σ₁ Γ— Ο†) (fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ ys (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).snd s₁) = let m := mapAccumrβ‚‚ (fun x y (s₁, sβ‚‚) => let rβ‚‚ := fβ‚‚ x y sβ‚‚ let r₁ := f₁ y rβ‚‚.snd s₁ ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Bisim variable {xs : Vector Ξ± n}
Mathlib/Data/Vector/MapLemmas.lean
173
183
theorem mapAccumr_bisim {f₁ : Ξ± β†’ σ₁ β†’ σ₁ Γ— Ξ²} {fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (R : σ₁ β†’ Οƒβ‚‚ β†’ Prop) (hβ‚€ : R s₁ sβ‚‚) (hR : βˆ€ {s q} a, R s q β†’ R (f₁ a s).1 (fβ‚‚ a q).1 ∧ (f₁ a s).2 = (fβ‚‚ a q).2) : R (mapAccumr f₁ xs s₁).fst (mapAccumr fβ‚‚ xs sβ‚‚).fst ∧ (mapAccumr f₁ xs s₁).snd = (mapAccumr fβ‚‚ xs sβ‚‚).snd := by
induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ next => exact ⟨hβ‚€, rfl⟩ next xs x ih => rcases (hR x hβ‚€) with ⟨hR, _⟩ simp only [mapAccumr_snoc, ih hR, true_and] congr 1
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Bisim variable {xs : Vector Ξ± n} theorem mapAccumr_bisim {f₁ : Ξ± β†’ σ₁ β†’ σ₁ Γ— Ξ²} {fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (R : σ₁ β†’ Οƒβ‚‚ β†’ Prop) (hβ‚€ : R s₁ sβ‚‚) (hR : βˆ€ {s q} a, R s q β†’ R (f₁ a s).1 (fβ‚‚ a q).1 ∧ (f₁ a s).2 = (fβ‚‚ a q).2) : R (mapAccumr f₁ xs s₁).fst (mapAccumr fβ‚‚ xs sβ‚‚).fst ∧ (mapAccumr f₁ xs s₁).snd = (mapAccumr fβ‚‚ xs sβ‚‚).snd := by induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ next => exact ⟨hβ‚€, rfl⟩ next xs x ih => rcases (hR x hβ‚€) with ⟨hR, _⟩ simp only [mapAccumr_snoc, ih hR, true_and] congr 1
Mathlib/Data/Vector/MapLemmas.lean
185
190
theorem mapAccumr_bisim_tail {f₁ : Ξ± β†’ σ₁ β†’ σ₁ Γ— Ξ²} {fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (h : βˆƒ R : σ₁ β†’ Οƒβ‚‚ β†’ Prop, R s₁ sβ‚‚ ∧ βˆ€ {s q} a, R s q β†’ R (f₁ a s).1 (fβ‚‚ a q).1 ∧ (f₁ a s).2 = (fβ‚‚ a q).2) : (mapAccumr f₁ xs s₁).snd = (mapAccumr fβ‚‚ xs sβ‚‚).snd := by
rcases h with ⟨R, hβ‚€, hR⟩ exact (mapAccumr_bisim R hβ‚€ hR).2
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Bisim variable {xs : Vector Ξ± n} theorem mapAccumr_bisim {f₁ : Ξ± β†’ σ₁ β†’ σ₁ Γ— Ξ²} {fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (R : σ₁ β†’ Οƒβ‚‚ β†’ Prop) (hβ‚€ : R s₁ sβ‚‚) (hR : βˆ€ {s q} a, R s q β†’ R (f₁ a s).1 (fβ‚‚ a q).1 ∧ (f₁ a s).2 = (fβ‚‚ a q).2) : R (mapAccumr f₁ xs s₁).fst (mapAccumr fβ‚‚ xs sβ‚‚).fst ∧ (mapAccumr f₁ xs s₁).snd = (mapAccumr fβ‚‚ xs sβ‚‚).snd := by induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ next => exact ⟨hβ‚€, rfl⟩ next xs x ih => rcases (hR x hβ‚€) with ⟨hR, _⟩ simp only [mapAccumr_snoc, ih hR, true_and] congr 1 theorem mapAccumr_bisim_tail {f₁ : Ξ± β†’ σ₁ β†’ σ₁ Γ— Ξ²} {fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (h : βˆƒ R : σ₁ β†’ Οƒβ‚‚ β†’ Prop, R s₁ sβ‚‚ ∧ βˆ€ {s q} a, R s q β†’ R (f₁ a s).1 (fβ‚‚ a q).1 ∧ (f₁ a s).2 = (fβ‚‚ a q).2) : (mapAccumr f₁ xs s₁).snd = (mapAccumr fβ‚‚ xs sβ‚‚).snd := by rcases h with ⟨R, hβ‚€, hR⟩ exact (mapAccumr_bisim R hβ‚€ hR).2
Mathlib/Data/Vector/MapLemmas.lean
192
203
theorem mapAccumrβ‚‚_bisim {ys : Vector Ξ² n} {f₁ : Ξ± β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— Ξ³} {fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (R : σ₁ β†’ Οƒβ‚‚ β†’ Prop) (hβ‚€ : R s₁ sβ‚‚) (hR : βˆ€ {s q} a b, R s q β†’ R (f₁ a b s).1 (fβ‚‚ a b q).1 ∧ (f₁ a b s).2 = (fβ‚‚ a b q).2) : R (mapAccumrβ‚‚ f₁ xs ys s₁).1 (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).1 ∧ (mapAccumrβ‚‚ f₁ xs ys s₁).2 = (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).2 := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ next => exact ⟨hβ‚€, rfl⟩ next xs ys x y ih => rcases (hR x y hβ‚€) with ⟨hR, _⟩ simp only [mapAccumrβ‚‚_snoc, ih hR, true_and] congr 1
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Bisim variable {xs : Vector Ξ± n} theorem mapAccumr_bisim {f₁ : Ξ± β†’ σ₁ β†’ σ₁ Γ— Ξ²} {fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (R : σ₁ β†’ Οƒβ‚‚ β†’ Prop) (hβ‚€ : R s₁ sβ‚‚) (hR : βˆ€ {s q} a, R s q β†’ R (f₁ a s).1 (fβ‚‚ a q).1 ∧ (f₁ a s).2 = (fβ‚‚ a q).2) : R (mapAccumr f₁ xs s₁).fst (mapAccumr fβ‚‚ xs sβ‚‚).fst ∧ (mapAccumr f₁ xs s₁).snd = (mapAccumr fβ‚‚ xs sβ‚‚).snd := by induction xs using Vector.revInductionOn generalizing s₁ sβ‚‚ next => exact ⟨hβ‚€, rfl⟩ next xs x ih => rcases (hR x hβ‚€) with ⟨hR, _⟩ simp only [mapAccumr_snoc, ih hR, true_and] congr 1 theorem mapAccumr_bisim_tail {f₁ : Ξ± β†’ σ₁ β†’ σ₁ Γ— Ξ²} {fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ²} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (h : βˆƒ R : σ₁ β†’ Οƒβ‚‚ β†’ Prop, R s₁ sβ‚‚ ∧ βˆ€ {s q} a, R s q β†’ R (f₁ a s).1 (fβ‚‚ a q).1 ∧ (f₁ a s).2 = (fβ‚‚ a q).2) : (mapAccumr f₁ xs s₁).snd = (mapAccumr fβ‚‚ xs sβ‚‚).snd := by rcases h with ⟨R, hβ‚€, hR⟩ exact (mapAccumr_bisim R hβ‚€ hR).2 theorem mapAccumrβ‚‚_bisim {ys : Vector Ξ² n} {f₁ : Ξ± β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— Ξ³} {fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (R : σ₁ β†’ Οƒβ‚‚ β†’ Prop) (hβ‚€ : R s₁ sβ‚‚) (hR : βˆ€ {s q} a b, R s q β†’ R (f₁ a b s).1 (fβ‚‚ a b q).1 ∧ (f₁ a b s).2 = (fβ‚‚ a b q).2) : R (mapAccumrβ‚‚ f₁ xs ys s₁).1 (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).1 ∧ (mapAccumrβ‚‚ f₁ xs ys s₁).2 = (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).2 := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ next => exact ⟨hβ‚€, rfl⟩ next xs ys x y ih => rcases (hR x y hβ‚€) with ⟨hR, _⟩ simp only [mapAccumrβ‚‚_snoc, ih hR, true_and] congr 1
Mathlib/Data/Vector/MapLemmas.lean
205
211
theorem mapAccumrβ‚‚_bisim_tail {ys : Vector Ξ² n} {f₁ : Ξ± β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— Ξ³} {fβ‚‚ : Ξ± β†’ Ξ² β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³} {s₁ : σ₁} {sβ‚‚ : Οƒβ‚‚} (h : βˆƒ R : σ₁ β†’ Οƒβ‚‚ β†’ Prop, R s₁ sβ‚‚ ∧ βˆ€ {s q} a b, R s q β†’ R (f₁ a b s).1 (fβ‚‚ a b q).1 ∧ (f₁ a b s).2 = (fβ‚‚ a b q).2) : (mapAccumrβ‚‚ f₁ xs ys s₁).2 = (mapAccumrβ‚‚ fβ‚‚ xs ys sβ‚‚).2 := by
rcases h with ⟨R, hβ‚€, hR⟩ exact (mapAccumrβ‚‚_bisim R hβ‚€ hR).2
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section UnusedInput variable {xs : Vector Ξ± n} {ys : Vector Ξ² n} @[simp]
Mathlib/Data/Vector/MapLemmas.lean
342
347
theorem mapAccumrβ‚‚_unused_input_left [Inhabited Ξ±] (f : Ξ± β†’ Ξ² β†’ Οƒ β†’ Οƒ Γ— Ξ³) (h : βˆ€ a b s, f default b s = f a b s) : mapAccumrβ‚‚ f xs ys s = mapAccumr (fun b s => f default b s) ys s := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s with | nil => rfl | snoc xs ys x y ih => simp [h x y s, ih]
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section UnusedInput variable {xs : Vector Ξ± n} {ys : Vector Ξ² n} @[simp] theorem mapAccumrβ‚‚_unused_input_left [Inhabited Ξ±] (f : Ξ± β†’ Ξ² β†’ Οƒ β†’ Οƒ Γ— Ξ³) (h : βˆ€ a b s, f default b s = f a b s) : mapAccumrβ‚‚ f xs ys s = mapAccumr (fun b s => f default b s) ys s := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s with | nil => rfl | snoc xs ys x y ih => simp [h x y s, ih] @[simp]
Mathlib/Data/Vector/MapLemmas.lean
354
359
theorem mapAccumrβ‚‚_unused_input_right [Inhabited Ξ²] (f : Ξ± β†’ Ξ² β†’ Οƒ β†’ Οƒ Γ— Ξ³) (h : βˆ€ a b s, f a default s = f a b s) : mapAccumrβ‚‚ f xs ys s = mapAccumr (fun a s => f a default s) xs s := by
induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s with | nil => rfl | snoc xs ys x y ih => simp [h x y s, ih]
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Comm variable (xs ys : Vector Ξ± n)
Mathlib/Data/Vector/MapLemmas.lean
369
371
theorem mapβ‚‚_comm (f : Ξ± β†’ Ξ± β†’ Ξ²) (comm : βˆ€ a₁ aβ‚‚, f a₁ aβ‚‚ = f aβ‚‚ a₁) : mapβ‚‚ f xs ys = mapβ‚‚ f ys xs := by
induction xs, ys using Vector.inductionOnβ‚‚ <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Comm variable (xs ys : Vector Ξ± n) theorem mapβ‚‚_comm (f : Ξ± β†’ Ξ± β†’ Ξ²) (comm : βˆ€ a₁ aβ‚‚, f a₁ aβ‚‚ = f aβ‚‚ a₁) : mapβ‚‚ f xs ys = mapβ‚‚ f ys xs := by induction xs, ys using Vector.inductionOnβ‚‚ <;> simp_all
Mathlib/Data/Vector/MapLemmas.lean
373
375
theorem mapAccumrβ‚‚_comm (f : Ξ± β†’ Ξ± β†’ Οƒ β†’ Οƒ Γ— Ξ³) (comm : βˆ€ a₁ aβ‚‚ s, f a₁ aβ‚‚ s = f aβ‚‚ a₁ s) : mapAccumrβ‚‚ f xs ys s = mapAccumrβ‚‚ f ys xs s := by
induction xs, ys using Vector.inductionOnβ‚‚ generalizing s <;> simp_all
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Flip variable (xs : Vector Ξ± n) (ys : Vector Ξ² n)
Mathlib/Data/Vector/MapLemmas.lean
385
387
theorem mapβ‚‚_flip (f : Ξ± β†’ Ξ² β†’ Ξ³) : mapβ‚‚ f xs ys = mapβ‚‚ (flip f) ys xs := by
induction xs, ys using Vector.inductionOnβ‚‚ <;> simp_all[flip]
331
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Flip variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) theorem mapβ‚‚_flip (f : Ξ± β†’ Ξ² β†’ Ξ³) : mapβ‚‚ f xs ys = mapβ‚‚ (flip f) ys xs := by induction xs, ys using Vector.inductionOnβ‚‚ <;> simp_all[flip]
Mathlib/Data/Vector/MapLemmas.lean
389
391
theorem mapAccumrβ‚‚_flip (f : Ξ± β†’ Ξ² β†’ Οƒ β†’ Οƒ Γ— Ξ³) : mapAccumrβ‚‚ f xs ys s = mapAccumrβ‚‚ (flip f) ys xs s := by
induction xs, ys using Vector.inductionOnβ‚‚ <;> simp_all[flip]
331
import Mathlib.Algebra.CharP.Defs import Mathlib.Algebra.FreeAlgebra import Mathlib.RingTheory.Localization.FractionRing #align_import algebra.char_p.algebra from "leanprover-community/mathlib"@"96782a2d6dcded92116d8ac9ae48efb41d46a27c"
Mathlib/Algebra/CharP/Algebra.lean
34
37
theorem charP_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] {f : R β†’+* A} (h : Function.Injective f) (p : β„•) [CharP R p] : CharP A p where cast_eq_zero_iff' x := by
rw [← CharP.cast_eq_zero_iff R p x, ← map_natCast f x, map_eq_zero_iff f h]
332
import Mathlib.Algebra.CharP.Defs import Mathlib.Algebra.FreeAlgebra import Mathlib.RingTheory.Localization.FractionRing #align_import algebra.char_p.algebra from "leanprover-community/mathlib"@"96782a2d6dcded92116d8ac9ae48efb41d46a27c" theorem charP_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] {f : R β†’+* A} (h : Function.Injective f) (p : β„•) [CharP R p] : CharP A p where cast_eq_zero_iff' x := by rw [← CharP.cast_eq_zero_iff R p x, ← map_natCast f x, map_eq_zero_iff f h] theorem charP_of_injective_algebraMap {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (h : Function.Injective (algebraMap R A)) (p : β„•) [CharP R p] : CharP A p := charP_of_injective_ringHom h p #align char_p_of_injective_algebra_map charP_of_injective_algebraMap theorem charP_of_injective_algebraMap' (R A : Type*) [Field R] [Semiring A] [Algebra R A] [Nontrivial A] (p : β„•) [CharP R p] : CharP A p := charP_of_injective_algebraMap (algebraMap R A).injective p #align char_p_of_injective_algebra_map' charP_of_injective_algebraMap' theorem charZero_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] {f : R β†’+* A} (h : Function.Injective f) [CharZero R] : CharZero A where cast_injective _ _ _ := CharZero.cast_injective <| h <| by simpa only [map_natCast f] theorem charZero_of_injective_algebraMap {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (h : Function.Injective (algebraMap R A)) [CharZero R] : CharZero A := charZero_of_injective_ringHom h #align char_zero_of_injective_algebra_map charZero_of_injective_algebraMap
Mathlib/Algebra/CharP/Algebra.lean
64
67
theorem RingHom.charP {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] (f : R β†’+* A) (H : Function.Injective f) (p : β„•) [CharP A p] : CharP R p := by
obtain ⟨q, h⟩ := CharP.exists R exact CharP.eq _ (charP_of_injective_ringHom H q) β€ΉCharP A pβ€Ί β–Έ h
332
import Mathlib.Algebra.CharP.Defs import Mathlib.Algebra.FreeAlgebra import Mathlib.RingTheory.Localization.FractionRing #align_import algebra.char_p.algebra from "leanprover-community/mathlib"@"96782a2d6dcded92116d8ac9ae48efb41d46a27c" theorem charP_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] {f : R β†’+* A} (h : Function.Injective f) (p : β„•) [CharP R p] : CharP A p where cast_eq_zero_iff' x := by rw [← CharP.cast_eq_zero_iff R p x, ← map_natCast f x, map_eq_zero_iff f h] theorem charP_of_injective_algebraMap {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (h : Function.Injective (algebraMap R A)) (p : β„•) [CharP R p] : CharP A p := charP_of_injective_ringHom h p #align char_p_of_injective_algebra_map charP_of_injective_algebraMap theorem charP_of_injective_algebraMap' (R A : Type*) [Field R] [Semiring A] [Algebra R A] [Nontrivial A] (p : β„•) [CharP R p] : CharP A p := charP_of_injective_algebraMap (algebraMap R A).injective p #align char_p_of_injective_algebra_map' charP_of_injective_algebraMap' theorem charZero_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] {f : R β†’+* A} (h : Function.Injective f) [CharZero R] : CharZero A where cast_injective _ _ _ := CharZero.cast_injective <| h <| by simpa only [map_natCast f] theorem charZero_of_injective_algebraMap {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (h : Function.Injective (algebraMap R A)) [CharZero R] : CharZero A := charZero_of_injective_ringHom h #align char_zero_of_injective_algebra_map charZero_of_injective_algebraMap theorem RingHom.charP {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] (f : R β†’+* A) (H : Function.Injective f) (p : β„•) [CharP A p] : CharP R p := by obtain ⟨q, h⟩ := CharP.exists R exact CharP.eq _ (charP_of_injective_ringHom H q) β€ΉCharP A pβ€Ί β–Έ h theorem RingHom.charP_iff {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] (f : R β†’+* A) (H : Function.Injective f) (p : β„•) : CharP R p ↔ CharP A p := ⟨fun _ ↦ charP_of_injective_ringHom H p, fun _ ↦ f.charP H p⟩ -- `CharP.charP_to_charZero A _ (charP_of_injective_algebraMap h 0)` does not work -- here as it would require `Ring A`. section variable (K L : Type*) [Field K] [CommSemiring L] [Nontrivial L] [Algebra K L] theorem Algebra.charP_iff (p : β„•) : CharP K p ↔ CharP L p := (algebraMap K L).charP_iff_charP p #align algebra.char_p_iff Algebra.charP_iff
Mathlib/Algebra/CharP/Algebra.lean
121
123
theorem Algebra.ringChar_eq : ringChar K = ringChar L := by
rw [ringChar.eq_iff, Algebra.charP_iff K L] apply ringChar.charP
332
import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.Algebra.CharP.Algebra #align_import field_theory.splitting_field.construction from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial universe u v w variable {F : Type u} {K : Type v} {L : Type w} namespace Polynomial variable [Field K] [Field L] [Field F] open Polynomial section SplittingField def factor (f : K[X]) : K[X] := if H : βˆƒ g, Irreducible g ∧ g ∣ f then Classical.choose H else X #align polynomial.factor Polynomial.factor
Mathlib/FieldTheory/SplittingField/Construction.lean
55
59
theorem irreducible_factor (f : K[X]) : Irreducible (factor f) := by
rw [factor] split_ifs with H Β· exact (Classical.choose_spec H).1 Β· exact irreducible_X
333
import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.Algebra.CharP.Algebra #align_import field_theory.splitting_field.construction from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial universe u v w variable {F : Type u} {K : Type v} {L : Type w} namespace Polynomial variable [Field K] [Field L] [Field F] open Polynomial section SplittingField def factor (f : K[X]) : K[X] := if H : βˆƒ g, Irreducible g ∧ g ∣ f then Classical.choose H else X #align polynomial.factor Polynomial.factor theorem irreducible_factor (f : K[X]) : Irreducible (factor f) := by rw [factor] split_ifs with H Β· exact (Classical.choose_spec H).1 Β· exact irreducible_X #align polynomial.irreducible_factor Polynomial.irreducible_factor theorem fact_irreducible_factor (f : K[X]) : Fact (Irreducible (factor f)) := ⟨irreducible_factor f⟩ #align polynomial.fact_irreducible_factor Polynomial.fact_irreducible_factor attribute [local instance] fact_irreducible_factor
Mathlib/FieldTheory/SplittingField/Construction.lean
69
72
theorem factor_dvd_of_not_isUnit {f : K[X]} (hf1 : ¬IsUnit f) : factor f ∣ f := by
by_cases hf2 : f = 0; Β· rw [hf2]; exact dvd_zero _ rw [factor, dif_pos (WfDvdMonoid.exists_irreducible_factor hf1 hf2)] exact (Classical.choose_spec <| WfDvdMonoid.exists_irreducible_factor hf1 hf2).2
333
import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.Algebra.CharP.Algebra #align_import field_theory.splitting_field.construction from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial universe u v w variable {F : Type u} {K : Type v} {L : Type w} namespace Polynomial variable [Field K] [Field L] [Field F] open Polynomial section SplittingField def factor (f : K[X]) : K[X] := if H : βˆƒ g, Irreducible g ∧ g ∣ f then Classical.choose H else X #align polynomial.factor Polynomial.factor theorem irreducible_factor (f : K[X]) : Irreducible (factor f) := by rw [factor] split_ifs with H Β· exact (Classical.choose_spec H).1 Β· exact irreducible_X #align polynomial.irreducible_factor Polynomial.irreducible_factor theorem fact_irreducible_factor (f : K[X]) : Fact (Irreducible (factor f)) := ⟨irreducible_factor f⟩ #align polynomial.fact_irreducible_factor Polynomial.fact_irreducible_factor attribute [local instance] fact_irreducible_factor theorem factor_dvd_of_not_isUnit {f : K[X]} (hf1 : Β¬IsUnit f) : factor f ∣ f := by by_cases hf2 : f = 0; Β· rw [hf2]; exact dvd_zero _ rw [factor, dif_pos (WfDvdMonoid.exists_irreducible_factor hf1 hf2)] exact (Classical.choose_spec <| WfDvdMonoid.exists_irreducible_factor hf1 hf2).2 #align polynomial.factor_dvd_of_not_is_unit Polynomial.factor_dvd_of_not_isUnit theorem factor_dvd_of_degree_ne_zero {f : K[X]} (hf : f.degree β‰  0) : factor f ∣ f := factor_dvd_of_not_isUnit (mt degree_eq_zero_of_isUnit hf) #align polynomial.factor_dvd_of_degree_ne_zero Polynomial.factor_dvd_of_degree_ne_zero theorem factor_dvd_of_natDegree_ne_zero {f : K[X]} (hf : f.natDegree β‰  0) : factor f ∣ f := factor_dvd_of_degree_ne_zero (mt natDegree_eq_of_degree_eq_some hf) #align polynomial.factor_dvd_of_nat_degree_ne_zero Polynomial.factor_dvd_of_natDegree_ne_zero def removeFactor (f : K[X]) : Polynomial (AdjoinRoot <| factor f) := map (AdjoinRoot.of f.factor) f /β‚˜ (X - C (AdjoinRoot.root f.factor)) #align polynomial.remove_factor Polynomial.removeFactor
Mathlib/FieldTheory/SplittingField/Construction.lean
88
93
theorem X_sub_C_mul_removeFactor (f : K[X]) (hf : f.natDegree β‰  0) : (X - C (AdjoinRoot.root f.factor)) * f.removeFactor = map (AdjoinRoot.of f.factor) f := by
let ⟨g, hg⟩ := factor_dvd_of_natDegree_ne_zero hf apply (mul_divByMonic_eq_iff_isRoot (R := AdjoinRoot f.factor) (a := AdjoinRoot.root f.factor)).mpr rw [IsRoot.def, eval_map, hg, evalβ‚‚_mul, ← hg, AdjoinRoot.evalβ‚‚_root, zero_mul]
333
import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.Algebra.CharP.Algebra #align_import field_theory.splitting_field.construction from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial universe u v w variable {F : Type u} {K : Type v} {L : Type w} namespace Polynomial variable [Field K] [Field L] [Field F] open Polynomial section SplittingField def factor (f : K[X]) : K[X] := if H : βˆƒ g, Irreducible g ∧ g ∣ f then Classical.choose H else X #align polynomial.factor Polynomial.factor theorem irreducible_factor (f : K[X]) : Irreducible (factor f) := by rw [factor] split_ifs with H Β· exact (Classical.choose_spec H).1 Β· exact irreducible_X #align polynomial.irreducible_factor Polynomial.irreducible_factor theorem fact_irreducible_factor (f : K[X]) : Fact (Irreducible (factor f)) := ⟨irreducible_factor f⟩ #align polynomial.fact_irreducible_factor Polynomial.fact_irreducible_factor attribute [local instance] fact_irreducible_factor theorem factor_dvd_of_not_isUnit {f : K[X]} (hf1 : Β¬IsUnit f) : factor f ∣ f := by by_cases hf2 : f = 0; Β· rw [hf2]; exact dvd_zero _ rw [factor, dif_pos (WfDvdMonoid.exists_irreducible_factor hf1 hf2)] exact (Classical.choose_spec <| WfDvdMonoid.exists_irreducible_factor hf1 hf2).2 #align polynomial.factor_dvd_of_not_is_unit Polynomial.factor_dvd_of_not_isUnit theorem factor_dvd_of_degree_ne_zero {f : K[X]} (hf : f.degree β‰  0) : factor f ∣ f := factor_dvd_of_not_isUnit (mt degree_eq_zero_of_isUnit hf) #align polynomial.factor_dvd_of_degree_ne_zero Polynomial.factor_dvd_of_degree_ne_zero theorem factor_dvd_of_natDegree_ne_zero {f : K[X]} (hf : f.natDegree β‰  0) : factor f ∣ f := factor_dvd_of_degree_ne_zero (mt natDegree_eq_of_degree_eq_some hf) #align polynomial.factor_dvd_of_nat_degree_ne_zero Polynomial.factor_dvd_of_natDegree_ne_zero def removeFactor (f : K[X]) : Polynomial (AdjoinRoot <| factor f) := map (AdjoinRoot.of f.factor) f /β‚˜ (X - C (AdjoinRoot.root f.factor)) #align polynomial.remove_factor Polynomial.removeFactor theorem X_sub_C_mul_removeFactor (f : K[X]) (hf : f.natDegree β‰  0) : (X - C (AdjoinRoot.root f.factor)) * f.removeFactor = map (AdjoinRoot.of f.factor) f := by let ⟨g, hg⟩ := factor_dvd_of_natDegree_ne_zero hf apply (mul_divByMonic_eq_iff_isRoot (R := AdjoinRoot f.factor) (a := AdjoinRoot.root f.factor)).mpr rw [IsRoot.def, eval_map, hg, evalβ‚‚_mul, ← hg, AdjoinRoot.evalβ‚‚_root, zero_mul] set_option linter.uppercaseLean3 false in #align polynomial.X_sub_C_mul_remove_factor Polynomial.X_sub_C_mul_removeFactor
Mathlib/FieldTheory/SplittingField/Construction.lean
97
100
theorem natDegree_removeFactor (f : K[X]) : f.removeFactor.natDegree = f.natDegree - 1 := by
-- Porting note: `(map (AdjoinRoot.of f.factor) f)` was `_` rw [removeFactor, natDegree_divByMonic (map (AdjoinRoot.of f.factor) f) (monic_X_sub_C _), natDegree_map, natDegree_X_sub_C]
333
import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.Algebra.CharP.Algebra #align_import field_theory.splitting_field.construction from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial universe u v w variable {F : Type u} {K : Type v} {L : Type w} namespace Polynomial variable [Field K] [Field L] [Field F] open Polynomial section SplittingField def factor (f : K[X]) : K[X] := if H : βˆƒ g, Irreducible g ∧ g ∣ f then Classical.choose H else X #align polynomial.factor Polynomial.factor theorem irreducible_factor (f : K[X]) : Irreducible (factor f) := by rw [factor] split_ifs with H Β· exact (Classical.choose_spec H).1 Β· exact irreducible_X #align polynomial.irreducible_factor Polynomial.irreducible_factor theorem fact_irreducible_factor (f : K[X]) : Fact (Irreducible (factor f)) := ⟨irreducible_factor f⟩ #align polynomial.fact_irreducible_factor Polynomial.fact_irreducible_factor attribute [local instance] fact_irreducible_factor theorem factor_dvd_of_not_isUnit {f : K[X]} (hf1 : Β¬IsUnit f) : factor f ∣ f := by by_cases hf2 : f = 0; Β· rw [hf2]; exact dvd_zero _ rw [factor, dif_pos (WfDvdMonoid.exists_irreducible_factor hf1 hf2)] exact (Classical.choose_spec <| WfDvdMonoid.exists_irreducible_factor hf1 hf2).2 #align polynomial.factor_dvd_of_not_is_unit Polynomial.factor_dvd_of_not_isUnit theorem factor_dvd_of_degree_ne_zero {f : K[X]} (hf : f.degree β‰  0) : factor f ∣ f := factor_dvd_of_not_isUnit (mt degree_eq_zero_of_isUnit hf) #align polynomial.factor_dvd_of_degree_ne_zero Polynomial.factor_dvd_of_degree_ne_zero theorem factor_dvd_of_natDegree_ne_zero {f : K[X]} (hf : f.natDegree β‰  0) : factor f ∣ f := factor_dvd_of_degree_ne_zero (mt natDegree_eq_of_degree_eq_some hf) #align polynomial.factor_dvd_of_nat_degree_ne_zero Polynomial.factor_dvd_of_natDegree_ne_zero def removeFactor (f : K[X]) : Polynomial (AdjoinRoot <| factor f) := map (AdjoinRoot.of f.factor) f /β‚˜ (X - C (AdjoinRoot.root f.factor)) #align polynomial.remove_factor Polynomial.removeFactor theorem X_sub_C_mul_removeFactor (f : K[X]) (hf : f.natDegree β‰  0) : (X - C (AdjoinRoot.root f.factor)) * f.removeFactor = map (AdjoinRoot.of f.factor) f := by let ⟨g, hg⟩ := factor_dvd_of_natDegree_ne_zero hf apply (mul_divByMonic_eq_iff_isRoot (R := AdjoinRoot f.factor) (a := AdjoinRoot.root f.factor)).mpr rw [IsRoot.def, eval_map, hg, evalβ‚‚_mul, ← hg, AdjoinRoot.evalβ‚‚_root, zero_mul] set_option linter.uppercaseLean3 false in #align polynomial.X_sub_C_mul_remove_factor Polynomial.X_sub_C_mul_removeFactor theorem natDegree_removeFactor (f : K[X]) : f.removeFactor.natDegree = f.natDegree - 1 := by -- Porting note: `(map (AdjoinRoot.of f.factor) f)` was `_` rw [removeFactor, natDegree_divByMonic (map (AdjoinRoot.of f.factor) f) (monic_X_sub_C _), natDegree_map, natDegree_X_sub_C] #align polynomial.nat_degree_remove_factor Polynomial.natDegree_removeFactor
Mathlib/FieldTheory/SplittingField/Construction.lean
103
104
theorem natDegree_removeFactor' {f : K[X]} {n : β„•} (hfn : f.natDegree = n + 1) : f.removeFactor.natDegree = n := by
rw [natDegree_removeFactor, hfn, n.add_sub_cancel]
333
import Mathlib.Algebra.Order.Ring.Int import Mathlib.Data.Nat.SuccPred #align_import data.int.succ_pred from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Order namespace Int -- so that Lean reads `Int.succ` through `SuccOrder.succ` @[instance] abbrev instSuccOrder : SuccOrder β„€ := { SuccOrder.ofSuccLeIff succ fun {_ _} => Iff.rfl with succ := succ } -- so that Lean reads `Int.pred` through `PredOrder.pred` @[instance] abbrev instPredOrder : PredOrder β„€ where pred := pred pred_le _ := (sub_one_lt_of_le le_rfl).le min_of_le_pred ha := ((sub_one_lt_of_le le_rfl).not_le ha).elim le_pred_of_lt {_ _} := le_sub_one_of_lt le_of_pred_lt {_ _} := le_of_sub_one_lt @[simp] theorem succ_eq_succ : Order.succ = succ := rfl #align int.succ_eq_succ Int.succ_eq_succ @[simp] theorem pred_eq_pred : Order.pred = pred := rfl #align int.pred_eq_pred Int.pred_eq_pred theorem pos_iff_one_le {a : β„€} : 0 < a ↔ 1 ≀ a := Order.succ_le_iff.symm #align int.pos_iff_one_le Int.pos_iff_one_le theorem succ_iterate (a : β„€) : βˆ€ n, succ^[n] a = a + n | 0 => (add_zero a).symm | n + 1 => by rw [Function.iterate_succ', Int.ofNat_succ, ← add_assoc] exact congr_arg _ (succ_iterate a n) #align int.succ_iterate Int.succ_iterate theorem pred_iterate (a : β„€) : βˆ€ n, pred^[n] a = a - n | 0 => (sub_zero a).symm | n + 1 => by rw [Function.iterate_succ', Int.ofNat_succ, ← sub_sub] exact congr_arg _ (pred_iterate a n) #align int.pred_iterate Int.pred_iterate instance : IsSuccArchimedean β„€ := ⟨fun {a b} h => ⟨(b - a).toNat, by rw [succ_eq_succ, succ_iterate, toNat_sub_of_le h, ← add_sub_assoc, add_sub_cancel_left]⟩⟩ instance : IsPredArchimedean β„€ := ⟨fun {a b} h => ⟨(b - a).toNat, by rw [pred_eq_pred, pred_iterate, toNat_sub_of_le h, sub_sub_cancel]⟩⟩ protected theorem covBy_iff_succ_eq {m n : β„€} : m β‹– n ↔ m + 1 = n := succ_eq_iff_covBy.symm #align int.covby_iff_succ_eq Int.covBy_iff_succ_eq @[simp]
Mathlib/Data/Int/SuccPred.lean
79
79
theorem sub_one_covBy (z : β„€) : z - 1 β‹– z := by
rw [Int.covBy_iff_succ_eq, sub_add_cancel]
334
import Mathlib.Algebra.Order.Ring.Int import Mathlib.Data.Nat.SuccPred #align_import data.int.succ_pred from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Order namespace Int -- so that Lean reads `Int.succ` through `SuccOrder.succ` @[instance] abbrev instSuccOrder : SuccOrder β„€ := { SuccOrder.ofSuccLeIff succ fun {_ _} => Iff.rfl with succ := succ } -- so that Lean reads `Int.pred` through `PredOrder.pred` @[instance] abbrev instPredOrder : PredOrder β„€ where pred := pred pred_le _ := (sub_one_lt_of_le le_rfl).le min_of_le_pred ha := ((sub_one_lt_of_le le_rfl).not_le ha).elim le_pred_of_lt {_ _} := le_sub_one_of_lt le_of_pred_lt {_ _} := le_of_sub_one_lt @[simp] theorem succ_eq_succ : Order.succ = succ := rfl #align int.succ_eq_succ Int.succ_eq_succ @[simp] theorem pred_eq_pred : Order.pred = pred := rfl #align int.pred_eq_pred Int.pred_eq_pred theorem pos_iff_one_le {a : β„€} : 0 < a ↔ 1 ≀ a := Order.succ_le_iff.symm #align int.pos_iff_one_le Int.pos_iff_one_le theorem succ_iterate (a : β„€) : βˆ€ n, succ^[n] a = a + n | 0 => (add_zero a).symm | n + 1 => by rw [Function.iterate_succ', Int.ofNat_succ, ← add_assoc] exact congr_arg _ (succ_iterate a n) #align int.succ_iterate Int.succ_iterate theorem pred_iterate (a : β„€) : βˆ€ n, pred^[n] a = a - n | 0 => (sub_zero a).symm | n + 1 => by rw [Function.iterate_succ', Int.ofNat_succ, ← sub_sub] exact congr_arg _ (pred_iterate a n) #align int.pred_iterate Int.pred_iterate instance : IsSuccArchimedean β„€ := ⟨fun {a b} h => ⟨(b - a).toNat, by rw [succ_eq_succ, succ_iterate, toNat_sub_of_le h, ← add_sub_assoc, add_sub_cancel_left]⟩⟩ instance : IsPredArchimedean β„€ := ⟨fun {a b} h => ⟨(b - a).toNat, by rw [pred_eq_pred, pred_iterate, toNat_sub_of_le h, sub_sub_cancel]⟩⟩ protected theorem covBy_iff_succ_eq {m n : β„€} : m β‹– n ↔ m + 1 = n := succ_eq_iff_covBy.symm #align int.covby_iff_succ_eq Int.covBy_iff_succ_eq @[simp] theorem sub_one_covBy (z : β„€) : z - 1 β‹– z := by rw [Int.covBy_iff_succ_eq, sub_add_cancel] #align int.sub_one_covby Int.sub_one_covBy @[simp] theorem covBy_add_one (z : β„€) : z β‹– z + 1 := Int.covBy_iff_succ_eq.mpr rfl #align int.covby_add_one Int.covBy_add_one @[simp, norm_cast]
Mathlib/Data/Int/SuccPred.lean
88
90
theorem natCast_covBy {a b : β„•} : (a : β„€) β‹– b ↔ a β‹– b := by
rw [Nat.covBy_iff_succ_eq, Int.covBy_iff_succ_eq] exact Int.natCast_inj
334
import Mathlib.Topology.Sets.Closeds #align_import topology.noetherian_space from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" variable (Ξ± Ξ² : Type*) [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] namespace TopologicalSpace @[mk_iff] class NoetherianSpace : Prop where wellFounded_opens : WellFounded ((Β· > Β·) : Opens Ξ± β†’ Opens Ξ± β†’ Prop) #align topological_space.noetherian_space TopologicalSpace.NoetherianSpace
Mathlib/Topology/NoetherianSpace.lean
53
56
theorem noetherianSpace_iff_opens : NoetherianSpace Ξ± ↔ βˆ€ s : Opens Ξ±, IsCompact (s : Set Ξ±) := by
rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact, CompleteLattice.isSupFiniteCompact_iff_all_elements_compact] exact forall_congr' Opens.isCompactElement_iff
335
import Mathlib.Topology.Sets.Closeds #align_import topology.noetherian_space from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" variable (Ξ± Ξ² : Type*) [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] namespace TopologicalSpace @[mk_iff] class NoetherianSpace : Prop where wellFounded_opens : WellFounded ((Β· > Β·) : Opens Ξ± β†’ Opens Ξ± β†’ Prop) #align topological_space.noetherian_space TopologicalSpace.NoetherianSpace theorem noetherianSpace_iff_opens : NoetherianSpace Ξ± ↔ βˆ€ s : Opens Ξ±, IsCompact (s : Set Ξ±) := by rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact, CompleteLattice.isSupFiniteCompact_iff_all_elements_compact] exact forall_congr' Opens.isCompactElement_iff #align topological_space.noetherian_space_iff_opens TopologicalSpace.noetherianSpace_iff_opens instance (priority := 100) NoetherianSpace.compactSpace [h : NoetherianSpace Ξ±] : CompactSpace Ξ± := ⟨(noetherianSpace_iff_opens Ξ±).mp h ⊀⟩ #align topological_space.noetherian_space.compact_space TopologicalSpace.NoetherianSpace.compactSpace variable {Ξ± Ξ²} protected theorem NoetherianSpace.isCompact [NoetherianSpace Ξ±] (s : Set Ξ±) : IsCompact s := by refine isCompact_iff_finite_subcover.2 fun U hUo hs => ?_ rcases ((noetherianSpace_iff_opens Ξ±).mp β€Ή_β€Ί βŸ¨β‹ƒ i, U i, isOpen_iUnion hUo⟩).elim_finite_subcover U hUo Set.Subset.rfl with ⟨t, ht⟩ exact ⟨t, hs.trans ht⟩ #align topological_space.noetherian_space.is_compact TopologicalSpace.NoetherianSpace.isCompact -- Porting note: fixed NS protected theorem _root_.Inducing.noetherianSpace [NoetherianSpace Ξ±] {i : Ξ² β†’ Ξ±} (hi : Inducing i) : NoetherianSpace Ξ² := (noetherianSpace_iff_opens _).2 fun _ => hi.isCompact_iff.2 (NoetherianSpace.isCompact _) #align topological_space.inducing.noetherian_space Inducing.noetherianSpace instance NoetherianSpace.set [NoetherianSpace Ξ±] (s : Set Ξ±) : NoetherianSpace s := inducing_subtype_val.noetherianSpace #align topological_space.noetherian_space.set TopologicalSpace.NoetherianSpace.set variable (Ξ±) open List in
Mathlib/Topology/NoetherianSpace.lean
87
101
theorem noetherianSpace_TFAE : TFAE [NoetherianSpace Ξ±, WellFounded fun s t : Closeds Ξ± => s < t, βˆ€ s : Set Ξ±, IsCompact s, βˆ€ s : Opens Ξ±, IsCompact (s : Set Ξ±)] := by
tfae_have 1 ↔ 2 Β· refine (noetherianSpace_iff Ξ±).trans (Opens.compl_bijective.2.wellFounded_iff ?_) exact (@OrderIso.compl (Set Ξ±)).lt_iff_lt.symm tfae_have 1 ↔ 4 Β· exact noetherianSpace_iff_opens Ξ± tfae_have 1 β†’ 3 Β· exact @NoetherianSpace.isCompact Ξ± _ tfae_have 3 β†’ 4 Β· exact fun h s => h s tfae_finish
335
import Mathlib.Topology.Sets.Closeds #align_import topology.noetherian_space from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" variable (Ξ± Ξ² : Type*) [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] namespace TopologicalSpace @[mk_iff] class NoetherianSpace : Prop where wellFounded_opens : WellFounded ((Β· > Β·) : Opens Ξ± β†’ Opens Ξ± β†’ Prop) #align topological_space.noetherian_space TopologicalSpace.NoetherianSpace theorem noetherianSpace_iff_opens : NoetherianSpace Ξ± ↔ βˆ€ s : Opens Ξ±, IsCompact (s : Set Ξ±) := by rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact, CompleteLattice.isSupFiniteCompact_iff_all_elements_compact] exact forall_congr' Opens.isCompactElement_iff #align topological_space.noetherian_space_iff_opens TopologicalSpace.noetherianSpace_iff_opens instance (priority := 100) NoetherianSpace.compactSpace [h : NoetherianSpace Ξ±] : CompactSpace Ξ± := ⟨(noetherianSpace_iff_opens Ξ±).mp h ⊀⟩ #align topological_space.noetherian_space.compact_space TopologicalSpace.NoetherianSpace.compactSpace variable {Ξ± Ξ²} protected theorem NoetherianSpace.isCompact [NoetherianSpace Ξ±] (s : Set Ξ±) : IsCompact s := by refine isCompact_iff_finite_subcover.2 fun U hUo hs => ?_ rcases ((noetherianSpace_iff_opens Ξ±).mp β€Ή_β€Ί βŸ¨β‹ƒ i, U i, isOpen_iUnion hUo⟩).elim_finite_subcover U hUo Set.Subset.rfl with ⟨t, ht⟩ exact ⟨t, hs.trans ht⟩ #align topological_space.noetherian_space.is_compact TopologicalSpace.NoetherianSpace.isCompact -- Porting note: fixed NS protected theorem _root_.Inducing.noetherianSpace [NoetherianSpace Ξ±] {i : Ξ² β†’ Ξ±} (hi : Inducing i) : NoetherianSpace Ξ² := (noetherianSpace_iff_opens _).2 fun _ => hi.isCompact_iff.2 (NoetherianSpace.isCompact _) #align topological_space.inducing.noetherian_space Inducing.noetherianSpace instance NoetherianSpace.set [NoetherianSpace Ξ±] (s : Set Ξ±) : NoetherianSpace s := inducing_subtype_val.noetherianSpace #align topological_space.noetherian_space.set TopologicalSpace.NoetherianSpace.set variable (Ξ±) open List in theorem noetherianSpace_TFAE : TFAE [NoetherianSpace Ξ±, WellFounded fun s t : Closeds Ξ± => s < t, βˆ€ s : Set Ξ±, IsCompact s, βˆ€ s : Opens Ξ±, IsCompact (s : Set Ξ±)] := by tfae_have 1 ↔ 2 Β· refine (noetherianSpace_iff Ξ±).trans (Opens.compl_bijective.2.wellFounded_iff ?_) exact (@OrderIso.compl (Set Ξ±)).lt_iff_lt.symm tfae_have 1 ↔ 4 Β· exact noetherianSpace_iff_opens Ξ± tfae_have 1 β†’ 3 Β· exact @NoetherianSpace.isCompact Ξ± _ tfae_have 3 β†’ 4 Β· exact fun h s => h s tfae_finish #align topological_space.noetherian_space_tfae TopologicalSpace.noetherianSpace_TFAE variable {Ξ±} theorem noetherianSpace_iff_isCompact : NoetherianSpace Ξ± ↔ βˆ€ s : Set Ξ±, IsCompact s := (noetherianSpace_TFAE Ξ±).out 0 2 theorem NoetherianSpace.wellFounded_closeds [NoetherianSpace Ξ±] : WellFounded fun s t : Closeds Ξ± => s < t := Iff.mp ((noetherianSpace_TFAE Ξ±).out 0 1) β€Ή_β€Ί instance {Ξ±} : NoetherianSpace (CofiniteTopology Ξ±) := by simp only [noetherianSpace_iff_isCompact, isCompact_iff_ultrafilter_le_nhds, CofiniteTopology.nhds_eq, Ultrafilter.le_sup_iff, Filter.le_principal_iff] intro s f hs rcases f.le_cofinite_or_eq_pure with (hf | ⟨a, rfl⟩) Β· rcases Filter.nonempty_of_mem hs with ⟨a, ha⟩ exact ⟨a, ha, Or.inr hf⟩ Β· exact ⟨a, hs, Or.inl le_rfl⟩ theorem noetherianSpace_of_surjective [NoetherianSpace Ξ±] (f : Ξ± β†’ Ξ²) (hf : Continuous f) (hf' : Function.Surjective f) : NoetherianSpace Ξ² := noetherianSpace_iff_isCompact.2 <| (Set.image_surjective.mpr hf').forall.2 fun s => (NoetherianSpace.isCompact s).image hf #align topological_space.noetherian_space_of_surjective TopologicalSpace.noetherianSpace_of_surjective theorem noetherianSpace_iff_of_homeomorph (f : Ξ± β‰ƒβ‚œ Ξ²) : NoetherianSpace Ξ± ↔ NoetherianSpace Ξ² := ⟨fun _ => noetherianSpace_of_surjective f f.continuous f.surjective, fun _ => noetherianSpace_of_surjective f.symm f.symm.continuous f.symm.surjective⟩ #align topological_space.noetherian_space_iff_of_homeomorph TopologicalSpace.noetherianSpace_iff_of_homeomorph theorem NoetherianSpace.range [NoetherianSpace Ξ±] (f : Ξ± β†’ Ξ²) (hf : Continuous f) : NoetherianSpace (Set.range f) := noetherianSpace_of_surjective (Set.rangeFactorization f) (hf.subtype_mk _) Set.surjective_onto_range #align topological_space.noetherian_space.range TopologicalSpace.NoetherianSpace.range
Mathlib/Topology/NoetherianSpace.lean
139
142
theorem noetherianSpace_set_iff (s : Set Ξ±) : NoetherianSpace s ↔ βˆ€ t, t βŠ† s β†’ IsCompact t := by
simp only [noetherianSpace_iff_isCompact, embedding_subtype_val.isCompact_iff, Subtype.forall_set_subtype]
335
import Mathlib.Topology.Sets.Closeds #align_import topology.noetherian_space from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" variable (Ξ± Ξ² : Type*) [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] namespace TopologicalSpace @[mk_iff] class NoetherianSpace : Prop where wellFounded_opens : WellFounded ((Β· > Β·) : Opens Ξ± β†’ Opens Ξ± β†’ Prop) #align topological_space.noetherian_space TopologicalSpace.NoetherianSpace theorem noetherianSpace_iff_opens : NoetherianSpace Ξ± ↔ βˆ€ s : Opens Ξ±, IsCompact (s : Set Ξ±) := by rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact, CompleteLattice.isSupFiniteCompact_iff_all_elements_compact] exact forall_congr' Opens.isCompactElement_iff #align topological_space.noetherian_space_iff_opens TopologicalSpace.noetherianSpace_iff_opens instance (priority := 100) NoetherianSpace.compactSpace [h : NoetherianSpace Ξ±] : CompactSpace Ξ± := ⟨(noetherianSpace_iff_opens Ξ±).mp h ⊀⟩ #align topological_space.noetherian_space.compact_space TopologicalSpace.NoetherianSpace.compactSpace variable {Ξ± Ξ²} protected theorem NoetherianSpace.isCompact [NoetherianSpace Ξ±] (s : Set Ξ±) : IsCompact s := by refine isCompact_iff_finite_subcover.2 fun U hUo hs => ?_ rcases ((noetherianSpace_iff_opens Ξ±).mp β€Ή_β€Ί βŸ¨β‹ƒ i, U i, isOpen_iUnion hUo⟩).elim_finite_subcover U hUo Set.Subset.rfl with ⟨t, ht⟩ exact ⟨t, hs.trans ht⟩ #align topological_space.noetherian_space.is_compact TopologicalSpace.NoetherianSpace.isCompact -- Porting note: fixed NS protected theorem _root_.Inducing.noetherianSpace [NoetherianSpace Ξ±] {i : Ξ² β†’ Ξ±} (hi : Inducing i) : NoetherianSpace Ξ² := (noetherianSpace_iff_opens _).2 fun _ => hi.isCompact_iff.2 (NoetherianSpace.isCompact _) #align topological_space.inducing.noetherian_space Inducing.noetherianSpace instance NoetherianSpace.set [NoetherianSpace Ξ±] (s : Set Ξ±) : NoetherianSpace s := inducing_subtype_val.noetherianSpace #align topological_space.noetherian_space.set TopologicalSpace.NoetherianSpace.set variable (Ξ±) open List in theorem noetherianSpace_TFAE : TFAE [NoetherianSpace Ξ±, WellFounded fun s t : Closeds Ξ± => s < t, βˆ€ s : Set Ξ±, IsCompact s, βˆ€ s : Opens Ξ±, IsCompact (s : Set Ξ±)] := by tfae_have 1 ↔ 2 Β· refine (noetherianSpace_iff Ξ±).trans (Opens.compl_bijective.2.wellFounded_iff ?_) exact (@OrderIso.compl (Set Ξ±)).lt_iff_lt.symm tfae_have 1 ↔ 4 Β· exact noetherianSpace_iff_opens Ξ± tfae_have 1 β†’ 3 Β· exact @NoetherianSpace.isCompact Ξ± _ tfae_have 3 β†’ 4 Β· exact fun h s => h s tfae_finish #align topological_space.noetherian_space_tfae TopologicalSpace.noetherianSpace_TFAE variable {Ξ±} theorem noetherianSpace_iff_isCompact : NoetherianSpace Ξ± ↔ βˆ€ s : Set Ξ±, IsCompact s := (noetherianSpace_TFAE Ξ±).out 0 2 theorem NoetherianSpace.wellFounded_closeds [NoetherianSpace Ξ±] : WellFounded fun s t : Closeds Ξ± => s < t := Iff.mp ((noetherianSpace_TFAE Ξ±).out 0 1) β€Ή_β€Ί instance {Ξ±} : NoetherianSpace (CofiniteTopology Ξ±) := by simp only [noetherianSpace_iff_isCompact, isCompact_iff_ultrafilter_le_nhds, CofiniteTopology.nhds_eq, Ultrafilter.le_sup_iff, Filter.le_principal_iff] intro s f hs rcases f.le_cofinite_or_eq_pure with (hf | ⟨a, rfl⟩) Β· rcases Filter.nonempty_of_mem hs with ⟨a, ha⟩ exact ⟨a, ha, Or.inr hf⟩ Β· exact ⟨a, hs, Or.inl le_rfl⟩ theorem noetherianSpace_of_surjective [NoetherianSpace Ξ±] (f : Ξ± β†’ Ξ²) (hf : Continuous f) (hf' : Function.Surjective f) : NoetherianSpace Ξ² := noetherianSpace_iff_isCompact.2 <| (Set.image_surjective.mpr hf').forall.2 fun s => (NoetherianSpace.isCompact s).image hf #align topological_space.noetherian_space_of_surjective TopologicalSpace.noetherianSpace_of_surjective theorem noetherianSpace_iff_of_homeomorph (f : Ξ± β‰ƒβ‚œ Ξ²) : NoetherianSpace Ξ± ↔ NoetherianSpace Ξ² := ⟨fun _ => noetherianSpace_of_surjective f f.continuous f.surjective, fun _ => noetherianSpace_of_surjective f.symm f.symm.continuous f.symm.surjective⟩ #align topological_space.noetherian_space_iff_of_homeomorph TopologicalSpace.noetherianSpace_iff_of_homeomorph theorem NoetherianSpace.range [NoetherianSpace Ξ±] (f : Ξ± β†’ Ξ²) (hf : Continuous f) : NoetherianSpace (Set.range f) := noetherianSpace_of_surjective (Set.rangeFactorization f) (hf.subtype_mk _) Set.surjective_onto_range #align topological_space.noetherian_space.range TopologicalSpace.NoetherianSpace.range theorem noetherianSpace_set_iff (s : Set Ξ±) : NoetherianSpace s ↔ βˆ€ t, t βŠ† s β†’ IsCompact t := by simp only [noetherianSpace_iff_isCompact, embedding_subtype_val.isCompact_iff, Subtype.forall_set_subtype] #align topological_space.noetherian_space_set_iff TopologicalSpace.noetherianSpace_set_iff @[simp] theorem noetherian_univ_iff : NoetherianSpace (Set.univ : Set Ξ±) ↔ NoetherianSpace Ξ± := noetherianSpace_iff_of_homeomorph (Homeomorph.Set.univ Ξ±) #align topological_space.noetherian_univ_iff TopologicalSpace.noetherian_univ_iff
Mathlib/Topology/NoetherianSpace.lean
150
155
theorem NoetherianSpace.iUnion {ΞΉ : Type*} (f : ΞΉ β†’ Set Ξ±) [Finite ΞΉ] [hf : βˆ€ i, NoetherianSpace (f i)] : NoetherianSpace (⋃ i, f i) := by
simp_rw [noetherianSpace_set_iff] at hf ⊒ intro t ht rw [← Set.inter_eq_left.mpr ht, Set.inter_iUnion] exact isCompact_iUnion fun i => hf i _ Set.inter_subset_right
335
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero
Mathlib/Data/Nat/Hyperoperation.lean
49
50
theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by
rw [hyperoperation]
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one
Mathlib/Data/Nat/Hyperoperation.lean
53
55
theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by
rw [hyperoperation]
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by rw [hyperoperation] #align hyperoperation_recursion hyperoperation_recursion -- Interesting hyperoperation lemmas @[simp]
Mathlib/Data/Nat/Hyperoperation.lean
60
65
theorem hyperoperation_one : hyperoperation 1 = (Β· + Β·) := by
ext m k induction' k with bn bih Β· rw [Nat.add_zero m, hyperoperation] Β· rw [hyperoperation_recursion, bih, hyperoperation_zero] exact Nat.add_assoc m bn 1
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by rw [hyperoperation] #align hyperoperation_recursion hyperoperation_recursion -- Interesting hyperoperation lemmas @[simp] theorem hyperoperation_one : hyperoperation 1 = (Β· + Β·) := by ext m k induction' k with bn bih Β· rw [Nat.add_zero m, hyperoperation] Β· rw [hyperoperation_recursion, bih, hyperoperation_zero] exact Nat.add_assoc m bn 1 #align hyperoperation_one hyperoperation_one @[simp]
Mathlib/Data/Nat/Hyperoperation.lean
69
78
theorem hyperoperation_two : hyperoperation 2 = (Β· * Β·) := by
ext m k induction' k with bn bih Β· rw [hyperoperation] exact (Nat.mul_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_one, bih] -- Porting note: was `ring` dsimp only nth_rewrite 1 [← mul_one m] rw [← mul_add, add_comm]
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by rw [hyperoperation] #align hyperoperation_recursion hyperoperation_recursion -- Interesting hyperoperation lemmas @[simp] theorem hyperoperation_one : hyperoperation 1 = (Β· + Β·) := by ext m k induction' k with bn bih Β· rw [Nat.add_zero m, hyperoperation] Β· rw [hyperoperation_recursion, bih, hyperoperation_zero] exact Nat.add_assoc m bn 1 #align hyperoperation_one hyperoperation_one @[simp] theorem hyperoperation_two : hyperoperation 2 = (Β· * Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation] exact (Nat.mul_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_one, bih] -- Porting note: was `ring` dsimp only nth_rewrite 1 [← mul_one m] rw [← mul_add, add_comm] #align hyperoperation_two hyperoperation_two @[simp]
Mathlib/Data/Nat/Hyperoperation.lean
82
88
theorem hyperoperation_three : hyperoperation 3 = (Β· ^ Β·) := by
ext m k induction' k with bn bih Β· rw [hyperoperation_ge_three_eq_one] exact (pow_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_two, bih] exact (pow_succ' m bn).symm
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by rw [hyperoperation] #align hyperoperation_recursion hyperoperation_recursion -- Interesting hyperoperation lemmas @[simp] theorem hyperoperation_one : hyperoperation 1 = (Β· + Β·) := by ext m k induction' k with bn bih Β· rw [Nat.add_zero m, hyperoperation] Β· rw [hyperoperation_recursion, bih, hyperoperation_zero] exact Nat.add_assoc m bn 1 #align hyperoperation_one hyperoperation_one @[simp] theorem hyperoperation_two : hyperoperation 2 = (Β· * Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation] exact (Nat.mul_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_one, bih] -- Porting note: was `ring` dsimp only nth_rewrite 1 [← mul_one m] rw [← mul_add, add_comm] #align hyperoperation_two hyperoperation_two @[simp] theorem hyperoperation_three : hyperoperation 3 = (Β· ^ Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation_ge_three_eq_one] exact (pow_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_two, bih] exact (pow_succ' m bn).symm #align hyperoperation_three hyperoperation_three
Mathlib/Data/Nat/Hyperoperation.lean
91
95
theorem hyperoperation_ge_two_eq_self (n m : β„•) : hyperoperation (n + 2) m 1 = m := by
induction' n with nn nih Β· rw [hyperoperation_two] ring Β· rw [hyperoperation_recursion, hyperoperation_ge_three_eq_one, nih]
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by rw [hyperoperation] #align hyperoperation_recursion hyperoperation_recursion -- Interesting hyperoperation lemmas @[simp] theorem hyperoperation_one : hyperoperation 1 = (Β· + Β·) := by ext m k induction' k with bn bih Β· rw [Nat.add_zero m, hyperoperation] Β· rw [hyperoperation_recursion, bih, hyperoperation_zero] exact Nat.add_assoc m bn 1 #align hyperoperation_one hyperoperation_one @[simp] theorem hyperoperation_two : hyperoperation 2 = (Β· * Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation] exact (Nat.mul_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_one, bih] -- Porting note: was `ring` dsimp only nth_rewrite 1 [← mul_one m] rw [← mul_add, add_comm] #align hyperoperation_two hyperoperation_two @[simp] theorem hyperoperation_three : hyperoperation 3 = (Β· ^ Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation_ge_three_eq_one] exact (pow_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_two, bih] exact (pow_succ' m bn).symm #align hyperoperation_three hyperoperation_three theorem hyperoperation_ge_two_eq_self (n m : β„•) : hyperoperation (n + 2) m 1 = m := by induction' n with nn nih Β· rw [hyperoperation_two] ring Β· rw [hyperoperation_recursion, hyperoperation_ge_three_eq_one, nih] #align hyperoperation_ge_two_eq_self hyperoperation_ge_two_eq_self
Mathlib/Data/Nat/Hyperoperation.lean
98
101
theorem hyperoperation_two_two_eq_four (n : β„•) : hyperoperation (n + 1) 2 2 = 4 := by
induction' n with nn nih Β· rw [hyperoperation_one] Β· rw [hyperoperation_recursion, hyperoperation_ge_two_eq_self, nih]
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by rw [hyperoperation] #align hyperoperation_recursion hyperoperation_recursion -- Interesting hyperoperation lemmas @[simp] theorem hyperoperation_one : hyperoperation 1 = (Β· + Β·) := by ext m k induction' k with bn bih Β· rw [Nat.add_zero m, hyperoperation] Β· rw [hyperoperation_recursion, bih, hyperoperation_zero] exact Nat.add_assoc m bn 1 #align hyperoperation_one hyperoperation_one @[simp] theorem hyperoperation_two : hyperoperation 2 = (Β· * Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation] exact (Nat.mul_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_one, bih] -- Porting note: was `ring` dsimp only nth_rewrite 1 [← mul_one m] rw [← mul_add, add_comm] #align hyperoperation_two hyperoperation_two @[simp] theorem hyperoperation_three : hyperoperation 3 = (Β· ^ Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation_ge_three_eq_one] exact (pow_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_two, bih] exact (pow_succ' m bn).symm #align hyperoperation_three hyperoperation_three theorem hyperoperation_ge_two_eq_self (n m : β„•) : hyperoperation (n + 2) m 1 = m := by induction' n with nn nih Β· rw [hyperoperation_two] ring Β· rw [hyperoperation_recursion, hyperoperation_ge_three_eq_one, nih] #align hyperoperation_ge_two_eq_self hyperoperation_ge_two_eq_self theorem hyperoperation_two_two_eq_four (n : β„•) : hyperoperation (n + 1) 2 2 = 4 := by induction' n with nn nih Β· rw [hyperoperation_one] Β· rw [hyperoperation_recursion, hyperoperation_ge_two_eq_self, nih] #align hyperoperation_two_two_eq_four hyperoperation_two_two_eq_four
Mathlib/Data/Nat/Hyperoperation.lean
104
113
theorem hyperoperation_ge_three_one (n : β„•) : βˆ€ k : β„•, hyperoperation (n + 3) 1 k = 1 := by
induction' n with nn nih Β· intro k rw [hyperoperation_three] dsimp rw [one_pow] Β· intro k cases k Β· rw [hyperoperation_ge_three_eq_one] Β· rw [hyperoperation_recursion, nih]
336
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Tactic.Ring #align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" def hyperoperation : β„• β†’ β„• β†’ β„• β†’ β„• | 0, _, k => k + 1 | 1, m, 0 => m | 2, _, 0 => 0 | _ + 3, _, 0 => 1 | n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k) #align hyperoperation hyperoperation -- Basic hyperoperation lemmas @[simp] theorem hyperoperation_zero (m : β„•) : hyperoperation 0 m = Nat.succ := funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one] #align hyperoperation_zero hyperoperation_zero theorem hyperoperation_ge_three_eq_one (n m : β„•) : hyperoperation (n + 3) m 0 = 1 := by rw [hyperoperation] #align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one theorem hyperoperation_recursion (n m k : β„•) : hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by rw [hyperoperation] #align hyperoperation_recursion hyperoperation_recursion -- Interesting hyperoperation lemmas @[simp] theorem hyperoperation_one : hyperoperation 1 = (Β· + Β·) := by ext m k induction' k with bn bih Β· rw [Nat.add_zero m, hyperoperation] Β· rw [hyperoperation_recursion, bih, hyperoperation_zero] exact Nat.add_assoc m bn 1 #align hyperoperation_one hyperoperation_one @[simp] theorem hyperoperation_two : hyperoperation 2 = (Β· * Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation] exact (Nat.mul_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_one, bih] -- Porting note: was `ring` dsimp only nth_rewrite 1 [← mul_one m] rw [← mul_add, add_comm] #align hyperoperation_two hyperoperation_two @[simp] theorem hyperoperation_three : hyperoperation 3 = (Β· ^ Β·) := by ext m k induction' k with bn bih Β· rw [hyperoperation_ge_three_eq_one] exact (pow_zero m).symm Β· rw [hyperoperation_recursion, hyperoperation_two, bih] exact (pow_succ' m bn).symm #align hyperoperation_three hyperoperation_three theorem hyperoperation_ge_two_eq_self (n m : β„•) : hyperoperation (n + 2) m 1 = m := by induction' n with nn nih Β· rw [hyperoperation_two] ring Β· rw [hyperoperation_recursion, hyperoperation_ge_three_eq_one, nih] #align hyperoperation_ge_two_eq_self hyperoperation_ge_two_eq_self theorem hyperoperation_two_two_eq_four (n : β„•) : hyperoperation (n + 1) 2 2 = 4 := by induction' n with nn nih Β· rw [hyperoperation_one] Β· rw [hyperoperation_recursion, hyperoperation_ge_two_eq_self, nih] #align hyperoperation_two_two_eq_four hyperoperation_two_two_eq_four theorem hyperoperation_ge_three_one (n : β„•) : βˆ€ k : β„•, hyperoperation (n + 3) 1 k = 1 := by induction' n with nn nih Β· intro k rw [hyperoperation_three] dsimp rw [one_pow] Β· intro k cases k Β· rw [hyperoperation_ge_three_eq_one] Β· rw [hyperoperation_recursion, nih] #align hyperoperation_ge_three_one hyperoperation_ge_three_one
Mathlib/Data/Nat/Hyperoperation.lean
116
126
theorem hyperoperation_ge_four_zero (n k : β„•) : hyperoperation (n + 4) 0 k = if Even k then 1 else 0 := by
induction' k with kk kih Β· rw [hyperoperation_ge_three_eq_one] simp only [Nat.zero_eq, even_zero, if_true] Β· rw [hyperoperation_recursion] rw [kih] simp_rw [Nat.even_add_one] split_ifs Β· exact hyperoperation_ge_two_eq_self (n + 1) 0 Β· exact hyperoperation_ge_three_eq_one n 0
336
import Mathlib.AlgebraicTopology.DoldKan.Normalized #align_import algebraic_topology.dold_kan.homotopy_equivalence from "leanprover-community/mathlib"@"f951e201d416fb50cc7826171d80aa510ec20747" open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive Simplicial DoldKan noncomputable section namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] (X : SimplicialObject C) noncomputable def homotopyPToId : βˆ€ q : β„•, Homotopy (P q : K[X] ⟢ _) (πŸ™ _) | 0 => Homotopy.refl _ | q + 1 => by refine Homotopy.trans (Homotopy.ofEq ?_) (Homotopy.trans (Homotopy.add (homotopyPToId q) (Homotopy.compLeft (homotopyHΟƒToZero q) (P q))) (Homotopy.ofEq ?_)) Β· simp only [P_succ, comp_add, comp_id] Β· simp only [add_zero, comp_zero] set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.homotopy_P_to_id AlgebraicTopology.DoldKan.homotopyPToId def homotopyQToZero (q : β„•) : Homotopy (Q q : K[X] ⟢ _) 0 := Homotopy.equivSubZero.toFun (homotopyPToId X q).symm set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.homotopy_Q_to_zero AlgebraicTopology.DoldKan.homotopyQToZero
Mathlib/AlgebraicTopology/DoldKan/HomotopyEquivalence.lean
52
58
theorem homotopyPToId_eventually_constant {q n : β„•} (hqn : n < q) : ((homotopyPToId X (q + 1)).hom n (n + 1) : X _[n] ⟢ X _[n + 1]) = (homotopyPToId X q).hom n (n + 1) := by
simp only [homotopyHσToZero, AlternatingFaceMapComplex.obj_X, Nat.add_eq, Homotopy.trans_hom, Homotopy.ofEq_hom, Pi.zero_apply, Homotopy.add_hom, Homotopy.compLeft_hom, add_zero, Homotopy.nullHomotopy'_hom, ComplexShape.down_Rel, hσ'_eq_zero hqn (c_mk (n + 1) n rfl), dite_eq_ite, ite_self, comp_zero, zero_add, homotopyPToId]
337
import Mathlib.Topology.Order.Basic #align_import topology.algebra.order.monotone_convergence from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter Set Function open scoped Classical open Filter Topology variable {Ξ± Ξ² : Type*} class SupConvergenceClass (Ξ± : Type*) [Preorder Ξ±] [TopologicalSpace Ξ±] : Prop where tendsto_coe_atTop_isLUB : βˆ€ (a : Ξ±) (s : Set Ξ±), IsLUB s a β†’ Tendsto (CoeTC.coe : s β†’ Ξ±) atTop (𝓝 a) #align Sup_convergence_class SupConvergenceClass class InfConvergenceClass (Ξ± : Type*) [Preorder Ξ±] [TopologicalSpace Ξ±] : Prop where tendsto_coe_atBot_isGLB : βˆ€ (a : Ξ±) (s : Set Ξ±), IsGLB s a β†’ Tendsto (CoeTC.coe : s β†’ Ξ±) atBot (𝓝 a) #align Inf_convergence_class InfConvergenceClass instance OrderDual.supConvergenceClass [Preorder Ξ±] [TopologicalSpace Ξ±] [InfConvergenceClass Ξ±] : SupConvergenceClass Ξ±α΅’α΅ˆ := βŸ¨β€ΉInfConvergenceClass Ξ±β€Ί.1⟩ #align order_dual.Sup_convergence_class OrderDual.supConvergenceClass instance OrderDual.infConvergenceClass [Preorder Ξ±] [TopologicalSpace Ξ±] [SupConvergenceClass Ξ±] : InfConvergenceClass Ξ±α΅’α΅ˆ := βŸ¨β€ΉSupConvergenceClass Ξ±β€Ί.1⟩ #align order_dual.Inf_convergence_class OrderDual.infConvergenceClass -- see Note [lower instance priority] instance (priority := 100) LinearOrder.supConvergenceClass [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] : SupConvergenceClass Ξ± := by refine ⟨fun a s ha => tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩⟩ Β· rcases ha.exists_between hb with ⟨c, hcs, bc, bca⟩ lift c to s using hcs exact (eventually_ge_atTop c).mono fun x hx => bc.trans_le hx Β· exact eventually_of_forall fun x => (ha.1 x.2).trans_lt hb #align linear_order.Sup_convergence_class LinearOrder.supConvergenceClass -- see Note [lower instance priority] instance (priority := 100) LinearOrder.infConvergenceClass [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] : InfConvergenceClass Ξ± := show InfConvergenceClass Ξ±α΅’α΅ˆα΅’α΅ˆ from OrderDual.infConvergenceClass #align linear_order.Inf_convergence_class LinearOrder.infConvergenceClass section variable {ΞΉ : Type*} [Preorder ΞΉ] [TopologicalSpace Ξ±] section IsLUB variable [Preorder Ξ±] [SupConvergenceClass Ξ±] {f : ΞΉ β†’ Ξ±} {a : Ξ±}
Mathlib/Topology/Order/MonotoneConvergence.lean
96
100
theorem tendsto_atTop_isLUB (h_mono : Monotone f) (ha : IsLUB (Set.range f) a) : Tendsto f atTop (𝓝 a) := by
suffices Tendsto (rangeFactorization f) atTop atTop from (SupConvergenceClass.tendsto_coe_atTop_isLUB _ _ ha).comp this exact h_mono.rangeFactorization.tendsto_atTop_atTop fun b => b.2.imp fun a ha => ha.ge
338
import Mathlib.Topology.Order.Basic #align_import topology.algebra.order.monotone_convergence from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter Set Function open scoped Classical open Filter Topology variable {Ξ± Ξ² : Type*} class SupConvergenceClass (Ξ± : Type*) [Preorder Ξ±] [TopologicalSpace Ξ±] : Prop where tendsto_coe_atTop_isLUB : βˆ€ (a : Ξ±) (s : Set Ξ±), IsLUB s a β†’ Tendsto (CoeTC.coe : s β†’ Ξ±) atTop (𝓝 a) #align Sup_convergence_class SupConvergenceClass class InfConvergenceClass (Ξ± : Type*) [Preorder Ξ±] [TopologicalSpace Ξ±] : Prop where tendsto_coe_atBot_isGLB : βˆ€ (a : Ξ±) (s : Set Ξ±), IsGLB s a β†’ Tendsto (CoeTC.coe : s β†’ Ξ±) atBot (𝓝 a) #align Inf_convergence_class InfConvergenceClass instance OrderDual.supConvergenceClass [Preorder Ξ±] [TopologicalSpace Ξ±] [InfConvergenceClass Ξ±] : SupConvergenceClass Ξ±α΅’α΅ˆ := βŸ¨β€ΉInfConvergenceClass Ξ±β€Ί.1⟩ #align order_dual.Sup_convergence_class OrderDual.supConvergenceClass instance OrderDual.infConvergenceClass [Preorder Ξ±] [TopologicalSpace Ξ±] [SupConvergenceClass Ξ±] : InfConvergenceClass Ξ±α΅’α΅ˆ := βŸ¨β€ΉSupConvergenceClass Ξ±β€Ί.1⟩ #align order_dual.Inf_convergence_class OrderDual.infConvergenceClass -- see Note [lower instance priority] instance (priority := 100) LinearOrder.supConvergenceClass [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] : SupConvergenceClass Ξ± := by refine ⟨fun a s ha => tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩⟩ Β· rcases ha.exists_between hb with ⟨c, hcs, bc, bca⟩ lift c to s using hcs exact (eventually_ge_atTop c).mono fun x hx => bc.trans_le hx Β· exact eventually_of_forall fun x => (ha.1 x.2).trans_lt hb #align linear_order.Sup_convergence_class LinearOrder.supConvergenceClass -- see Note [lower instance priority] instance (priority := 100) LinearOrder.infConvergenceClass [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] : InfConvergenceClass Ξ± := show InfConvergenceClass Ξ±α΅’α΅ˆα΅’α΅ˆ from OrderDual.infConvergenceClass #align linear_order.Inf_convergence_class LinearOrder.infConvergenceClass section variable {ΞΉ : Type*} [Preorder ΞΉ] [TopologicalSpace Ξ±] section IsLUB variable [Preorder Ξ±] [SupConvergenceClass Ξ±] {f : ΞΉ β†’ Ξ±} {a : Ξ±} theorem tendsto_atTop_isLUB (h_mono : Monotone f) (ha : IsLUB (Set.range f) a) : Tendsto f atTop (𝓝 a) := by suffices Tendsto (rangeFactorization f) atTop atTop from (SupConvergenceClass.tendsto_coe_atTop_isLUB _ _ ha).comp this exact h_mono.rangeFactorization.tendsto_atTop_atTop fun b => b.2.imp fun a ha => ha.ge #align tendsto_at_top_is_lub tendsto_atTop_isLUB
Mathlib/Topology/Order/MonotoneConvergence.lean
103
104
theorem tendsto_atBot_isLUB (h_anti : Antitone f) (ha : IsLUB (Set.range f) a) : Tendsto f atBot (𝓝 a) := by
convert tendsto_atTop_isLUB h_anti.dual_left ha using 1
338
import Mathlib.Algebra.Group.Semiconj.Defs import Mathlib.Algebra.Group.Units #align_import algebra.group.semiconj from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered open scoped Int variable {M G : Type*} namespace SemiconjBy section Monoid variable [Monoid M] @[to_additive "If `a` semiconjugates an additive unit `x` to an additive unit `y`, then it semiconjugates `-x` to `-y`."]
Mathlib/Algebra/Group/Semiconj/Units.lean
48
51
theorem units_inv_right {a : M} {x y : MΛ£} (h : SemiconjBy a x y) : SemiconjBy a ↑x⁻¹ ↑y⁻¹ := calc a * ↑x⁻¹ = ↑y⁻¹ * (y * a) * ↑x⁻¹ := by
rw [Units.inv_mul_cancel_left] _ = ↑y⁻¹ * a := by rw [← h.eq, mul_assoc, Units.mul_inv_cancel_right]
339
import Mathlib.Algebra.Group.Semiconj.Defs import Mathlib.Algebra.Group.Units #align_import algebra.group.semiconj from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered open scoped Int variable {M G : Type*} namespace SemiconjBy section Monoid variable [Monoid M] @[to_additive "If `a` semiconjugates an additive unit `x` to an additive unit `y`, then it semiconjugates `-x` to `-y`."] theorem units_inv_right {a : M} {x y : MΛ£} (h : SemiconjBy a x y) : SemiconjBy a ↑x⁻¹ ↑y⁻¹ := calc a * ↑x⁻¹ = ↑y⁻¹ * (y * a) * ↑x⁻¹ := by rw [Units.inv_mul_cancel_left] _ = ↑y⁻¹ * a := by rw [← h.eq, mul_assoc, Units.mul_inv_cancel_right] #align semiconj_by.units_inv_right SemiconjBy.units_inv_right #align add_semiconj_by.add_units_neg_right AddSemiconjBy.addUnits_neg_right @[to_additive (attr := simp)] theorem units_inv_right_iff {a : M} {x y : MΛ£} : SemiconjBy a ↑x⁻¹ ↑y⁻¹ ↔ SemiconjBy a x y := ⟨units_inv_right, units_inv_right⟩ #align semiconj_by.units_inv_right_iff SemiconjBy.units_inv_right_iff #align add_semiconj_by.add_units_neg_right_iff AddSemiconjBy.addUnits_neg_right_iff @[to_additive "If an additive unit `a` semiconjugates `x` to `y`, then `-a` semiconjugates `y` to `x`."]
Mathlib/Algebra/Group/Semiconj/Units.lean
64
67
theorem units_inv_symm_left {a : MΛ£} {x y : M} (h : SemiconjBy (↑a) x y) : SemiconjBy (↑a⁻¹) y x := calc ↑a⁻¹ * y = ↑a⁻¹ * (y * a * ↑a⁻¹) := by
rw [Units.mul_inv_cancel_right] _ = x * ↑a⁻¹ := by rw [← h.eq, ← mul_assoc, Units.inv_mul_cancel_left]
339
import Mathlib.Algebra.GroupWithZero.Units.Basic import Mathlib.Algebra.Group.Semiconj.Units import Mathlib.Init.Classical #align_import algebra.group_with_zero.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" assert_not_exists DenselyOrdered variable {Ξ± Mβ‚€ Gβ‚€ Mβ‚€' Gβ‚€' F F' : Type*} namespace SemiconjBy @[simp]
Mathlib/Algebra/GroupWithZero/Semiconj.lean
24
25
theorem zero_right [MulZeroClass Gβ‚€] (a : Gβ‚€) : SemiconjBy a 0 0 := by
simp only [SemiconjBy, mul_zero, zero_mul]
340
import Mathlib.Algebra.GroupWithZero.Units.Basic import Mathlib.Algebra.Group.Semiconj.Units import Mathlib.Init.Classical #align_import algebra.group_with_zero.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" assert_not_exists DenselyOrdered variable {Ξ± Mβ‚€ Gβ‚€ Mβ‚€' Gβ‚€' F F' : Type*} namespace SemiconjBy @[simp] theorem zero_right [MulZeroClass Gβ‚€] (a : Gβ‚€) : SemiconjBy a 0 0 := by simp only [SemiconjBy, mul_zero, zero_mul] #align semiconj_by.zero_right SemiconjBy.zero_right @[simp]
Mathlib/Algebra/GroupWithZero/Semiconj.lean
29
30
theorem zero_left [MulZeroClass Gβ‚€] (x y : Gβ‚€) : SemiconjBy 0 x y := by
simp only [SemiconjBy, mul_zero, zero_mul]
340
import Mathlib.Algebra.GroupWithZero.Units.Basic import Mathlib.Algebra.Group.Semiconj.Units import Mathlib.Init.Classical #align_import algebra.group_with_zero.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" assert_not_exists DenselyOrdered variable {Ξ± Mβ‚€ Gβ‚€ Mβ‚€' Gβ‚€' F F' : Type*} namespace SemiconjBy @[simp] theorem zero_right [MulZeroClass Gβ‚€] (a : Gβ‚€) : SemiconjBy a 0 0 := by simp only [SemiconjBy, mul_zero, zero_mul] #align semiconj_by.zero_right SemiconjBy.zero_right @[simp] theorem zero_left [MulZeroClass Gβ‚€] (x y : Gβ‚€) : SemiconjBy 0 x y := by simp only [SemiconjBy, mul_zero, zero_mul] #align semiconj_by.zero_left SemiconjBy.zero_left variable [GroupWithZero Gβ‚€] {a x y x' y' : Gβ‚€} @[simp] theorem inv_symm_left_iffβ‚€ : SemiconjBy a⁻¹ x y ↔ SemiconjBy a y x := Classical.by_cases (fun ha : a = 0 => by simp only [ha, inv_zero, SemiconjBy.zero_left]) fun ha => @units_inv_symm_left_iff _ _ (Units.mk0 a ha) _ _ #align semiconj_by.inv_symm_left_iffβ‚€ SemiconjBy.inv_symm_left_iffβ‚€ theorem inv_symm_leftβ‚€ (h : SemiconjBy a x y) : SemiconjBy a⁻¹ y x := SemiconjBy.inv_symm_left_iffβ‚€.2 h #align semiconj_by.inv_symm_leftβ‚€ SemiconjBy.inv_symm_leftβ‚€
Mathlib/Algebra/GroupWithZero/Semiconj.lean
45
54
theorem inv_rightβ‚€ (h : SemiconjBy a x y) : SemiconjBy a x⁻¹ y⁻¹ := by
by_cases ha : a = 0 Β· simp only [ha, zero_left] by_cases hx : x = 0 Β· subst x simp only [SemiconjBy, mul_zero, @eq_comm _ _ (y * a), mul_eq_zero] at h simp [h.resolve_right ha] Β· have := mul_ne_zero ha hx rw [h.eq, mul_ne_zero_iff] at this exact @units_inv_right _ _ _ (Units.mk0 x hx) (Units.mk0 y this.1) h
340
import Mathlib.Algebra.GroupWithZero.Units.Basic import Mathlib.Algebra.Group.Semiconj.Units import Mathlib.Init.Classical #align_import algebra.group_with_zero.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" assert_not_exists DenselyOrdered variable {Ξ± Mβ‚€ Gβ‚€ Mβ‚€' Gβ‚€' F F' : Type*} namespace SemiconjBy @[simp] theorem zero_right [MulZeroClass Gβ‚€] (a : Gβ‚€) : SemiconjBy a 0 0 := by simp only [SemiconjBy, mul_zero, zero_mul] #align semiconj_by.zero_right SemiconjBy.zero_right @[simp] theorem zero_left [MulZeroClass Gβ‚€] (x y : Gβ‚€) : SemiconjBy 0 x y := by simp only [SemiconjBy, mul_zero, zero_mul] #align semiconj_by.zero_left SemiconjBy.zero_left variable [GroupWithZero Gβ‚€] {a x y x' y' : Gβ‚€} @[simp] theorem inv_symm_left_iffβ‚€ : SemiconjBy a⁻¹ x y ↔ SemiconjBy a y x := Classical.by_cases (fun ha : a = 0 => by simp only [ha, inv_zero, SemiconjBy.zero_left]) fun ha => @units_inv_symm_left_iff _ _ (Units.mk0 a ha) _ _ #align semiconj_by.inv_symm_left_iffβ‚€ SemiconjBy.inv_symm_left_iffβ‚€ theorem inv_symm_leftβ‚€ (h : SemiconjBy a x y) : SemiconjBy a⁻¹ y x := SemiconjBy.inv_symm_left_iffβ‚€.2 h #align semiconj_by.inv_symm_leftβ‚€ SemiconjBy.inv_symm_leftβ‚€ theorem inv_rightβ‚€ (h : SemiconjBy a x y) : SemiconjBy a x⁻¹ y⁻¹ := by by_cases ha : a = 0 Β· simp only [ha, zero_left] by_cases hx : x = 0 Β· subst x simp only [SemiconjBy, mul_zero, @eq_comm _ _ (y * a), mul_eq_zero] at h simp [h.resolve_right ha] Β· have := mul_ne_zero ha hx rw [h.eq, mul_ne_zero_iff] at this exact @units_inv_right _ _ _ (Units.mk0 x hx) (Units.mk0 y this.1) h #align semiconj_by.inv_rightβ‚€ SemiconjBy.inv_rightβ‚€ @[simp] theorem inv_right_iffβ‚€ : SemiconjBy a x⁻¹ y⁻¹ ↔ SemiconjBy a x y := ⟨fun h => inv_inv x β–Έ inv_inv y β–Έ h.inv_rightβ‚€, inv_rightβ‚€βŸ© #align semiconj_by.inv_right_iffβ‚€ SemiconjBy.inv_right_iffβ‚€
Mathlib/Algebra/GroupWithZero/Semiconj.lean
62
65
theorem div_right (h : SemiconjBy a x y) (h' : SemiconjBy a x' y') : SemiconjBy a (x / x') (y / y') := by
rw [div_eq_mul_inv, div_eq_mul_inv] exact h.mul_right h'.inv_rightβ‚€
340
import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Algebra.Group.Commute.Units import Mathlib.Tactic.Nontriviality #align_import algebra.group_with_zero.commute from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" #align_import algebra.group_with_zero.power from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" assert_not_exists DenselyOrdered variable {Ξ± Mβ‚€ Gβ‚€ Mβ‚€' Gβ‚€' F F' : Type*} variable [MonoidWithZero Mβ‚€] namespace Ring open scoped Classical
Mathlib/Algebra/GroupWithZero/Commute.lean
27
34
theorem mul_inverse_rev' {a b : Mβ‚€} (h : Commute a b) : inverse (a * b) = inverse b * inverse a := by
by_cases hab : IsUnit (a * b) Β· obtain ⟨⟨a, rfl⟩, b, rfl⟩ := h.isUnit_mul_iff.mp hab rw [← Units.val_mul, inverse_unit, inverse_unit, inverse_unit, ← Units.val_mul, mul_inv_rev] obtain ha | hb := not_and_or.mp (mt h.isUnit_mul_iff.mpr hab) Β· rw [inverse_non_unit _ hab, inverse_non_unit _ ha, mul_zero] Β· rw [inverse_non_unit _ hab, inverse_non_unit _ hb, zero_mul]
341
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)
342
import Mathlib.Tactic.NormNum.Core import Mathlib.Tactic.HaveI import Mathlib.Data.Nat.Cast.Commute import Mathlib.Algebra.Ring.Int import Mathlib.Algebra.GroupWithZero.Invertible import Mathlib.Tactic.ClearExclamation import Mathlib.Data.Nat.Cast.Basic set_option autoImplicit true namespace Mathlib open Lean hiding Rat mkRat open Meta namespace Meta.NormNum open Qq theorem IsInt.raw_refl (n : β„€) : IsInt n n := ⟨rfl⟩ theorem isNat_zero (Ξ±) [AddMonoidWithOne Ξ±] : IsNat (Zero.zero : Ξ±) (nat_lit 0) := ⟨Nat.cast_zero.symm⟩ @[norm_num Zero.zero] def evalZero : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(Zero.zero) => return .isNat sΞ± (mkRawNatLit 0) q(isNat_zero $Ξ±) theorem isNat_one (Ξ±) [AddMonoidWithOne Ξ±] : IsNat (One.one : Ξ±) (nat_lit 1) := ⟨Nat.cast_one.symm⟩ @[norm_num One.one] def evalOne : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(One.one) => return .isNat sΞ± (mkRawNatLit 1) q(isNat_one $Ξ±) theorem isNat_ofNat (Ξ± : Type u_1) [AddMonoidWithOne Ξ±] {a : Ξ±} {n : β„•} (h : n = a) : IsNat a n := ⟨h.symm⟩ @[norm_num OfNat.ofNat _] def evalOfNat : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(@OfNat.ofNat _ $n $oΞ±) => let n : Q(β„•) ← whnf n guard n.isRawNatLit let ⟨a, (pa : Q($n = $e))⟩ ← mkOfNat Ξ± sΞ± n guard <|← isDefEq a e return .isNat sΞ± n q(isNat_ofNat $Ξ± $pa) theorem isNat_intOfNat : {n n' : β„•} β†’ IsNat n n' β†’ IsNat (Int.ofNat n) n' | _, _, ⟨rfl⟩ => ⟨rfl⟩ @[norm_num Int.ofNat _] def evalIntOfNat : NormNumExt where eval {u Ξ±} e := do let .app (.const ``Int.ofNat _) (n : Q(β„•)) ← whnfR e | failure haveI' : u =QL 0 := ⟨⟩; haveI' : $Ξ± =Q Int := ⟨⟩ let sβ„• : Q(AddMonoidWithOne β„•) := q(instAddMonoidWithOneNat) let sβ„€ : Q(AddMonoidWithOne β„€) := q(instAddMonoidWithOne) let ⟨n', p⟩ ← deriveNat n sβ„• haveI' x : $e =Q Int.ofNat $n := ⟨⟩ return .isNat sβ„€ n' q(isNat_intOfNat $p) theorem isNat_natAbs_pos : {n : β„€} β†’ {a : β„•} β†’ IsNat n a β†’ IsNat n.natAbs a | _, _, ⟨rfl⟩ => ⟨rfl⟩ theorem isNat_natAbs_neg : {n : β„€} β†’ {a : β„•} β†’ IsInt n (.negOfNat a) β†’ IsNat n.natAbs a | _, _, ⟨rfl⟩ => ⟨by simp⟩ @[norm_num Int.natAbs (_ : β„€)] def evalIntNatAbs : NormNumExt where eval {u Ξ±} e := do let .app (.const ``Int.natAbs _) (x : Q(β„€)) ← whnfR e | failure haveI' : u =QL 0 := ⟨⟩; haveI' : $Ξ± =Q β„• := ⟨⟩ haveI' : $e =Q Int.natAbs $x := ⟨⟩ let sβ„• : Q(AddMonoidWithOne β„•) := q(instAddMonoidWithOneNat) match ← derive (u := .zero) x with | .isNat _ a p => assumeInstancesCommute; return .isNat sβ„• a q(isNat_natAbs_pos $p) | .isNegNat _ a p => assumeInstancesCommute; return .isNat sβ„• a q(isNat_natAbs_neg $p) | _ => failure
Mathlib/Tactic/NormNum/Basic.lean
104
105
theorem isNat_natCast {R} [AddMonoidWithOne R] (n m : β„•) : IsNat n m β†’ IsNat (n : R) m := by
rintro ⟨⟨⟩⟩; exact ⟨rfl⟩
343
import Mathlib.Tactic.NormNum.Core import Mathlib.Tactic.HaveI import Mathlib.Data.Nat.Cast.Commute import Mathlib.Algebra.Ring.Int import Mathlib.Algebra.GroupWithZero.Invertible import Mathlib.Tactic.ClearExclamation import Mathlib.Data.Nat.Cast.Basic set_option autoImplicit true namespace Mathlib open Lean hiding Rat mkRat open Meta namespace Meta.NormNum open Qq theorem IsInt.raw_refl (n : β„€) : IsInt n n := ⟨rfl⟩ theorem isNat_zero (Ξ±) [AddMonoidWithOne Ξ±] : IsNat (Zero.zero : Ξ±) (nat_lit 0) := ⟨Nat.cast_zero.symm⟩ @[norm_num Zero.zero] def evalZero : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(Zero.zero) => return .isNat sΞ± (mkRawNatLit 0) q(isNat_zero $Ξ±) theorem isNat_one (Ξ±) [AddMonoidWithOne Ξ±] : IsNat (One.one : Ξ±) (nat_lit 1) := ⟨Nat.cast_one.symm⟩ @[norm_num One.one] def evalOne : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(One.one) => return .isNat sΞ± (mkRawNatLit 1) q(isNat_one $Ξ±) theorem isNat_ofNat (Ξ± : Type u_1) [AddMonoidWithOne Ξ±] {a : Ξ±} {n : β„•} (h : n = a) : IsNat a n := ⟨h.symm⟩ @[norm_num OfNat.ofNat _] def evalOfNat : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(@OfNat.ofNat _ $n $oΞ±) => let n : Q(β„•) ← whnf n guard n.isRawNatLit let ⟨a, (pa : Q($n = $e))⟩ ← mkOfNat Ξ± sΞ± n guard <|← isDefEq a e return .isNat sΞ± n q(isNat_ofNat $Ξ± $pa) theorem isNat_intOfNat : {n n' : β„•} β†’ IsNat n n' β†’ IsNat (Int.ofNat n) n' | _, _, ⟨rfl⟩ => ⟨rfl⟩ @[norm_num Int.ofNat _] def evalIntOfNat : NormNumExt where eval {u Ξ±} e := do let .app (.const ``Int.ofNat _) (n : Q(β„•)) ← whnfR e | failure haveI' : u =QL 0 := ⟨⟩; haveI' : $Ξ± =Q Int := ⟨⟩ let sβ„• : Q(AddMonoidWithOne β„•) := q(instAddMonoidWithOneNat) let sβ„€ : Q(AddMonoidWithOne β„€) := q(instAddMonoidWithOne) let ⟨n', p⟩ ← deriveNat n sβ„• haveI' x : $e =Q Int.ofNat $n := ⟨⟩ return .isNat sβ„€ n' q(isNat_intOfNat $p) theorem isNat_natAbs_pos : {n : β„€} β†’ {a : β„•} β†’ IsNat n a β†’ IsNat n.natAbs a | _, _, ⟨rfl⟩ => ⟨rfl⟩ theorem isNat_natAbs_neg : {n : β„€} β†’ {a : β„•} β†’ IsInt n (.negOfNat a) β†’ IsNat n.natAbs a | _, _, ⟨rfl⟩ => ⟨by simp⟩ @[norm_num Int.natAbs (_ : β„€)] def evalIntNatAbs : NormNumExt where eval {u Ξ±} e := do let .app (.const ``Int.natAbs _) (x : Q(β„€)) ← whnfR e | failure haveI' : u =QL 0 := ⟨⟩; haveI' : $Ξ± =Q β„• := ⟨⟩ haveI' : $e =Q Int.natAbs $x := ⟨⟩ let sβ„• : Q(AddMonoidWithOne β„•) := q(instAddMonoidWithOneNat) match ← derive (u := .zero) x with | .isNat _ a p => assumeInstancesCommute; return .isNat sβ„• a q(isNat_natAbs_pos $p) | .isNegNat _ a p => assumeInstancesCommute; return .isNat sβ„• a q(isNat_natAbs_neg $p) | _ => failure theorem isNat_natCast {R} [AddMonoidWithOne R] (n m : β„•) : IsNat n m β†’ IsNat (n : R) m := by rintro ⟨⟨⟩⟩; exact ⟨rfl⟩ @[deprecated (since := "2024-04-17")] alias isNat_cast := isNat_natCast @[norm_num Nat.cast _, NatCast.natCast _] def evalNatCast : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± let .app n (a : Q(β„•)) ← whnfR e | failure guard <|← withNewMCtxDepth <| isDefEq n q(Nat.cast (R := $Ξ±)) let ⟨na, pa⟩ ← deriveNat a q(instAddMonoidWithOneNat) haveI' : $e =Q $a := ⟨⟩ return .isNat sΞ± na q(isNat_natCast $a $na $pa)
Mathlib/Tactic/NormNum/Basic.lean
119
120
theorem isNat_intCast {R} [Ring R] (n : β„€) (m : β„•) : IsNat n m β†’ IsNat (n : R) m := by
rintro ⟨⟨⟩⟩; exact ⟨by simp⟩
343
import Mathlib.Tactic.NormNum.Core import Mathlib.Tactic.HaveI import Mathlib.Data.Nat.Cast.Commute import Mathlib.Algebra.Ring.Int import Mathlib.Algebra.GroupWithZero.Invertible import Mathlib.Tactic.ClearExclamation import Mathlib.Data.Nat.Cast.Basic set_option autoImplicit true namespace Mathlib open Lean hiding Rat mkRat open Meta namespace Meta.NormNum open Qq theorem IsInt.raw_refl (n : β„€) : IsInt n n := ⟨rfl⟩ theorem isNat_zero (Ξ±) [AddMonoidWithOne Ξ±] : IsNat (Zero.zero : Ξ±) (nat_lit 0) := ⟨Nat.cast_zero.symm⟩ @[norm_num Zero.zero] def evalZero : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(Zero.zero) => return .isNat sΞ± (mkRawNatLit 0) q(isNat_zero $Ξ±) theorem isNat_one (Ξ±) [AddMonoidWithOne Ξ±] : IsNat (One.one : Ξ±) (nat_lit 1) := ⟨Nat.cast_one.symm⟩ @[norm_num One.one] def evalOne : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(One.one) => return .isNat sΞ± (mkRawNatLit 1) q(isNat_one $Ξ±) theorem isNat_ofNat (Ξ± : Type u_1) [AddMonoidWithOne Ξ±] {a : Ξ±} {n : β„•} (h : n = a) : IsNat a n := ⟨h.symm⟩ @[norm_num OfNat.ofNat _] def evalOfNat : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± match e with | ~q(@OfNat.ofNat _ $n $oΞ±) => let n : Q(β„•) ← whnf n guard n.isRawNatLit let ⟨a, (pa : Q($n = $e))⟩ ← mkOfNat Ξ± sΞ± n guard <|← isDefEq a e return .isNat sΞ± n q(isNat_ofNat $Ξ± $pa) theorem isNat_intOfNat : {n n' : β„•} β†’ IsNat n n' β†’ IsNat (Int.ofNat n) n' | _, _, ⟨rfl⟩ => ⟨rfl⟩ @[norm_num Int.ofNat _] def evalIntOfNat : NormNumExt where eval {u Ξ±} e := do let .app (.const ``Int.ofNat _) (n : Q(β„•)) ← whnfR e | failure haveI' : u =QL 0 := ⟨⟩; haveI' : $Ξ± =Q Int := ⟨⟩ let sβ„• : Q(AddMonoidWithOne β„•) := q(instAddMonoidWithOneNat) let sβ„€ : Q(AddMonoidWithOne β„€) := q(instAddMonoidWithOne) let ⟨n', p⟩ ← deriveNat n sβ„• haveI' x : $e =Q Int.ofNat $n := ⟨⟩ return .isNat sβ„€ n' q(isNat_intOfNat $p) theorem isNat_natAbs_pos : {n : β„€} β†’ {a : β„•} β†’ IsNat n a β†’ IsNat n.natAbs a | _, _, ⟨rfl⟩ => ⟨rfl⟩ theorem isNat_natAbs_neg : {n : β„€} β†’ {a : β„•} β†’ IsInt n (.negOfNat a) β†’ IsNat n.natAbs a | _, _, ⟨rfl⟩ => ⟨by simp⟩ @[norm_num Int.natAbs (_ : β„€)] def evalIntNatAbs : NormNumExt where eval {u Ξ±} e := do let .app (.const ``Int.natAbs _) (x : Q(β„€)) ← whnfR e | failure haveI' : u =QL 0 := ⟨⟩; haveI' : $Ξ± =Q β„• := ⟨⟩ haveI' : $e =Q Int.natAbs $x := ⟨⟩ let sβ„• : Q(AddMonoidWithOne β„•) := q(instAddMonoidWithOneNat) match ← derive (u := .zero) x with | .isNat _ a p => assumeInstancesCommute; return .isNat sβ„• a q(isNat_natAbs_pos $p) | .isNegNat _ a p => assumeInstancesCommute; return .isNat sβ„• a q(isNat_natAbs_neg $p) | _ => failure theorem isNat_natCast {R} [AddMonoidWithOne R] (n m : β„•) : IsNat n m β†’ IsNat (n : R) m := by rintro ⟨⟨⟩⟩; exact ⟨rfl⟩ @[deprecated (since := "2024-04-17")] alias isNat_cast := isNat_natCast @[norm_num Nat.cast _, NatCast.natCast _] def evalNatCast : NormNumExt where eval {u Ξ±} e := do let sΞ± ← inferAddMonoidWithOne Ξ± let .app n (a : Q(β„•)) ← whnfR e | failure guard <|← withNewMCtxDepth <| isDefEq n q(Nat.cast (R := $Ξ±)) let ⟨na, pa⟩ ← deriveNat a q(instAddMonoidWithOneNat) haveI' : $e =Q $a := ⟨⟩ return .isNat sΞ± na q(isNat_natCast $a $na $pa) theorem isNat_intCast {R} [Ring R] (n : β„€) (m : β„•) : IsNat n m β†’ IsNat (n : R) m := by rintro ⟨⟨⟩⟩; exact ⟨by simp⟩ @[deprecated (since := "2024-04-17")] alias isNat_int_cast := isNat_intCast
Mathlib/Tactic/NormNum/Basic.lean
125
126
theorem isintCast {R} [Ring R] (n m : β„€) : IsInt n m β†’ IsInt (n : R) m := by
rintro ⟨⟨⟩⟩; exact ⟨rfl⟩
343
import Mathlib.Algebra.Group.Units.Hom import Mathlib.Algebra.GroupWithZero.Commute import Mathlib.Algebra.GroupWithZero.Hom import Mathlib.GroupTheory.GroupAction.Units #align_import algebra.group_with_zero.units.lemmas from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" assert_not_exists DenselyOrdered variable {Ξ± Mβ‚€ Gβ‚€ Mβ‚€' Gβ‚€' F F' : Type*} variable [MonoidWithZero Mβ‚€] section MonoidWithZero variable [GroupWithZero Gβ‚€] [Nontrivial Mβ‚€] [MonoidWithZero Mβ‚€'] [FunLike F Gβ‚€ Mβ‚€] [MonoidWithZeroHomClass F Gβ‚€ Mβ‚€] [FunLike F' Gβ‚€ Mβ‚€'] [MonoidWithZeroHomClass F' Gβ‚€ Mβ‚€'] (f : F) {a : Gβ‚€} theorem map_ne_zero : f a β‰  0 ↔ a β‰  0 := ⟨fun hfa ha => hfa <| ha.symm β–Έ map_zero f, fun ha => ((IsUnit.mk0 a ha).map f).ne_zero⟩ #align map_ne_zero map_ne_zero @[simp] theorem map_eq_zero : f a = 0 ↔ a = 0 := not_iff_not.1 (map_ne_zero f) #align map_eq_zero map_eq_zero
Mathlib/Algebra/GroupWithZero/Units/Lemmas.lean
49
52
theorem eq_on_invβ‚€ (f g : F') (h : f a = g a) : f a⁻¹ = g a⁻¹ := by
rcases eq_or_ne a 0 with (rfl | ha) Β· rw [inv_zero, map_zero, map_zero] Β· exact (IsUnit.mk0 a ha).eq_on_inv f g h
344
import Mathlib.Algebra.Group.Units.Hom import Mathlib.Algebra.GroupWithZero.Commute import Mathlib.Algebra.GroupWithZero.Hom import Mathlib.GroupTheory.GroupAction.Units #align_import algebra.group_with_zero.units.lemmas from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" assert_not_exists DenselyOrdered variable {Ξ± Mβ‚€ Gβ‚€ Mβ‚€' Gβ‚€' F F' : Type*} variable [MonoidWithZero Mβ‚€] section GroupWithZero variable [GroupWithZero Gβ‚€] [GroupWithZero Gβ‚€'] [FunLike F Gβ‚€ Gβ‚€'] [MonoidWithZeroHomClass F Gβ‚€ Gβ‚€'] (f : F) (a b : Gβ‚€) @[simp]
Mathlib/Algebra/GroupWithZero/Units/Lemmas.lean
64
68
theorem map_invβ‚€ : f a⁻¹ = (f a)⁻¹ := by
by_cases h : a = 0 Β· simp [h, map_zero f] Β· apply eq_inv_of_mul_eq_one_left rw [← map_mul, inv_mul_cancel h, map_one]
344
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
345