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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.