Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | num_lines int64 1 150 | complexity_score float64 2.72 139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000B | diff_level int64 0 2 | file_diff_level float64 0 2 | theorem_same_file int64 1 32 | rank_file int64 0 2.51k |
|---|---|---|---|---|---|---|---|---|---|---|---|
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 39 | 55 | theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by |
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
| 14 | 1,202,604.284165 | 2 | 1.375 | 8 | 1,470 |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 59 | 78 | theorem expSeries_odd_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n + 1) (fun _ => q) =
(((-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) / βqβ) β’ q := by |
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
Β· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : β := β(2 * n + 1)!
calc
kβ»ΒΉ β’ q ^ (2 * n + 1) = kβ»ΒΉ β’ ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = kβ»ΒΉ β’ ((-1 : β) ^ n * βqβ ^ (2 * n)) β’ q := ?_
_ = ((-1 : β) ^ n * βqβ ^ (2 * n + 1) / k / βqβ) β’ q := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, β coe_mul_eq_smul]
norm_cast
Β· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
| 17 | 24,154,952.753575 | 2 | 1.375 | 8 | 1,470 |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
theorem expSeries_odd_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n + 1) (fun _ => q) =
(((-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) / βqβ) β’ q := by
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
Β· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : β := β(2 * n + 1)!
calc
kβ»ΒΉ β’ q ^ (2 * n + 1) = kβ»ΒΉ β’ ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = kβ»ΒΉ β’ ((-1 : β) ^ n * βqβ ^ (2 * n)) β’ q := ?_
_ = ((-1 : β) ^ n * βqβ ^ (2 * n + 1) / k / βqβ) β’ q := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, β coe_mul_eq_smul]
norm_cast
Β· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 82 | 94 | theorem hasSum_expSeries_of_imaginary {q : Quaternion β} (hq : q.re = 0) {c s : β}
(hc : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) c)
(hs : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) s) :
HasSum (fun n => expSeries β (Quaternion β) n fun _ => q) (βc + (s / βqβ) β’ q) := by |
replace hc := hasSum_coe.mpr hc
replace hs := (hs.div_const βqβ).smul_const q
refine HasSum.even_add_odd ?_ ?_
Β· convert hc using 1
ext n : 1
rw [expSeries_even_of_imaginary hq]
Β· convert hs using 1
ext n : 1
rw [expSeries_odd_of_imaginary hq]
| 9 | 8,103.083928 | 2 | 1.375 | 8 | 1,470 |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
theorem expSeries_odd_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n + 1) (fun _ => q) =
(((-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) / βqβ) β’ q := by
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
Β· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : β := β(2 * n + 1)!
calc
kβ»ΒΉ β’ q ^ (2 * n + 1) = kβ»ΒΉ β’ ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = kβ»ΒΉ β’ ((-1 : β) ^ n * βqβ ^ (2 * n)) β’ q := ?_
_ = ((-1 : β) ^ n * βqβ ^ (2 * n + 1) / k / βqβ) β’ q := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, β coe_mul_eq_smul]
norm_cast
Β· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
theorem hasSum_expSeries_of_imaginary {q : Quaternion β} (hq : q.re = 0) {c s : β}
(hc : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) c)
(hs : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) s) :
HasSum (fun n => expSeries β (Quaternion β) n fun _ => q) (βc + (s / βqβ) β’ q) := by
replace hc := hasSum_coe.mpr hc
replace hs := (hs.div_const βqβ).smul_const q
refine HasSum.even_add_odd ?_ ?_
Β· convert hc using 1
ext n : 1
rw [expSeries_even_of_imaginary hq]
Β· convert hs using 1
ext n : 1
rw [expSeries_odd_of_imaginary hq]
#align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 98 | 103 | theorem exp_of_re_eq_zero (q : Quaternion β) (hq : q.re = 0) :
exp β q = β(Real.cos βqβ) + (Real.sin βqβ / βqβ) β’ q := by |
rw [exp_eq_tsum]
refine HasSum.tsum_eq ?_
simp_rw [β expSeries_apply_eq]
exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
| 4 | 54.59815 | 2 | 1.375 | 8 | 1,470 |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
theorem expSeries_odd_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n + 1) (fun _ => q) =
(((-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) / βqβ) β’ q := by
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
Β· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : β := β(2 * n + 1)!
calc
kβ»ΒΉ β’ q ^ (2 * n + 1) = kβ»ΒΉ β’ ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = kβ»ΒΉ β’ ((-1 : β) ^ n * βqβ ^ (2 * n)) β’ q := ?_
_ = ((-1 : β) ^ n * βqβ ^ (2 * n + 1) / k / βqβ) β’ q := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, β coe_mul_eq_smul]
norm_cast
Β· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
theorem hasSum_expSeries_of_imaginary {q : Quaternion β} (hq : q.re = 0) {c s : β}
(hc : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) c)
(hs : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) s) :
HasSum (fun n => expSeries β (Quaternion β) n fun _ => q) (βc + (s / βqβ) β’ q) := by
replace hc := hasSum_coe.mpr hc
replace hs := (hs.div_const βqβ).smul_const q
refine HasSum.even_add_odd ?_ ?_
Β· convert hc using 1
ext n : 1
rw [expSeries_even_of_imaginary hq]
Β· convert hs using 1
ext n : 1
rw [expSeries_odd_of_imaginary hq]
#align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary
theorem exp_of_re_eq_zero (q : Quaternion β) (hq : q.re = 0) :
exp β q = β(Real.cos βqβ) + (Real.sin βqβ / βqβ) β’ q := by
rw [exp_eq_tsum]
refine HasSum.tsum_eq ?_
simp_rw [β expSeries_apply_eq]
exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
#align quaternion.exp_of_re_eq_zero Quaternion.exp_of_re_eq_zero
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 107 | 111 | theorem exp_eq (q : Quaternion β) :
exp β q = exp β q.re β’ (β(Real.cos βq.imβ) + (Real.sin βq.imβ / βq.imβ) β’ q.im) := by |
rw [β exp_of_re_eq_zero q.im q.im_re, β coe_mul_eq_smul, β exp_coe, β exp_add_of_commute,
re_add_im]
exact Algebra.commutes q.re (_ : β[β])
| 3 | 20.085537 | 1 | 1.375 | 8 | 1,470 |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
theorem expSeries_odd_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n + 1) (fun _ => q) =
(((-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) / βqβ) β’ q := by
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
Β· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : β := β(2 * n + 1)!
calc
kβ»ΒΉ β’ q ^ (2 * n + 1) = kβ»ΒΉ β’ ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = kβ»ΒΉ β’ ((-1 : β) ^ n * βqβ ^ (2 * n)) β’ q := ?_
_ = ((-1 : β) ^ n * βqβ ^ (2 * n + 1) / k / βqβ) β’ q := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, β coe_mul_eq_smul]
norm_cast
Β· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
theorem hasSum_expSeries_of_imaginary {q : Quaternion β} (hq : q.re = 0) {c s : β}
(hc : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) c)
(hs : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) s) :
HasSum (fun n => expSeries β (Quaternion β) n fun _ => q) (βc + (s / βqβ) β’ q) := by
replace hc := hasSum_coe.mpr hc
replace hs := (hs.div_const βqβ).smul_const q
refine HasSum.even_add_odd ?_ ?_
Β· convert hc using 1
ext n : 1
rw [expSeries_even_of_imaginary hq]
Β· convert hs using 1
ext n : 1
rw [expSeries_odd_of_imaginary hq]
#align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary
theorem exp_of_re_eq_zero (q : Quaternion β) (hq : q.re = 0) :
exp β q = β(Real.cos βqβ) + (Real.sin βqβ / βqβ) β’ q := by
rw [exp_eq_tsum]
refine HasSum.tsum_eq ?_
simp_rw [β expSeries_apply_eq]
exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
#align quaternion.exp_of_re_eq_zero Quaternion.exp_of_re_eq_zero
theorem exp_eq (q : Quaternion β) :
exp β q = exp β q.re β’ (β(Real.cos βq.imβ) + (Real.sin βq.imβ / βq.imβ) β’ q.im) := by
rw [β exp_of_re_eq_zero q.im q.im_re, β coe_mul_eq_smul, β exp_coe, β exp_add_of_commute,
re_add_im]
exact Algebra.commutes q.re (_ : β[β])
#align quaternion.exp_eq Quaternion.exp_eq
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 114 | 114 | theorem re_exp (q : β[β]) : (exp β q).re = exp β q.re * Real.cos βq - q.reβ := by | simp [exp_eq]
| 1 | 2.718282 | 0 | 1.375 | 8 | 1,470 |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
theorem expSeries_odd_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n + 1) (fun _ => q) =
(((-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) / βqβ) β’ q := by
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
Β· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : β := β(2 * n + 1)!
calc
kβ»ΒΉ β’ q ^ (2 * n + 1) = kβ»ΒΉ β’ ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = kβ»ΒΉ β’ ((-1 : β) ^ n * βqβ ^ (2 * n)) β’ q := ?_
_ = ((-1 : β) ^ n * βqβ ^ (2 * n + 1) / k / βqβ) β’ q := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, β coe_mul_eq_smul]
norm_cast
Β· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
theorem hasSum_expSeries_of_imaginary {q : Quaternion β} (hq : q.re = 0) {c s : β}
(hc : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) c)
(hs : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) s) :
HasSum (fun n => expSeries β (Quaternion β) n fun _ => q) (βc + (s / βqβ) β’ q) := by
replace hc := hasSum_coe.mpr hc
replace hs := (hs.div_const βqβ).smul_const q
refine HasSum.even_add_odd ?_ ?_
Β· convert hc using 1
ext n : 1
rw [expSeries_even_of_imaginary hq]
Β· convert hs using 1
ext n : 1
rw [expSeries_odd_of_imaginary hq]
#align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary
theorem exp_of_re_eq_zero (q : Quaternion β) (hq : q.re = 0) :
exp β q = β(Real.cos βqβ) + (Real.sin βqβ / βqβ) β’ q := by
rw [exp_eq_tsum]
refine HasSum.tsum_eq ?_
simp_rw [β expSeries_apply_eq]
exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
#align quaternion.exp_of_re_eq_zero Quaternion.exp_of_re_eq_zero
theorem exp_eq (q : Quaternion β) :
exp β q = exp β q.re β’ (β(Real.cos βq.imβ) + (Real.sin βq.imβ / βq.imβ) β’ q.im) := by
rw [β exp_of_re_eq_zero q.im q.im_re, β coe_mul_eq_smul, β exp_coe, β exp_add_of_commute,
re_add_im]
exact Algebra.commutes q.re (_ : β[β])
#align quaternion.exp_eq Quaternion.exp_eq
theorem re_exp (q : β[β]) : (exp β q).re = exp β q.re * Real.cos βq - q.reβ := by simp [exp_eq]
#align quaternion.re_exp Quaternion.re_exp
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 117 | 118 | theorem im_exp (q : β[β]) : (exp β q).im = (exp β q.re * (Real.sin βq.imβ / βq.imβ)) β’ q.im := by |
simp [exp_eq, smul_smul]
| 1 | 2.718282 | 0 | 1.375 | 8 | 1,470 |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : β) : exp β (r : β[β]) = β(exp β r) :=
(map_exp β (algebraMap β β[β]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n) (fun _ => q) =
β((-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : β := β(2 * n)!
calc
kβ»ΒΉ β’ q ^ (2 * n) = kβ»ΒΉ β’ (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = kβ»ΒΉ β’ β((-1 : β) ^ n * βqβ ^ (2 * n)) := ?_
_ = β((-1 : β) ^ n * βqβ ^ (2 * n) / k) := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
Β· rw [β coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
theorem expSeries_odd_of_imaginary {q : Quaternion β} (hq : q.re = 0) (n : β) :
expSeries β (Quaternion β) (2 * n + 1) (fun _ => q) =
(((-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) / βqβ) β’ q := by
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
Β· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : β := β(2 * n + 1)!
calc
kβ»ΒΉ β’ q ^ (2 * n + 1) = kβ»ΒΉ β’ ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = kβ»ΒΉ β’ ((-1 : β) ^ n * βqβ ^ (2 * n)) β’ q := ?_
_ = ((-1 : β) ^ n * βqβ ^ (2 * n + 1) / k / βqβ) β’ q := ?_
Β· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, β coe_mul_eq_smul]
norm_cast
Β· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
theorem hasSum_expSeries_of_imaginary {q : Quaternion β} (hq : q.re = 0) {c s : β}
(hc : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n) / (2 * n)!) c)
(hs : HasSum (fun n => (-1 : β) ^ n * βqβ ^ (2 * n + 1) / (2 * n + 1)!) s) :
HasSum (fun n => expSeries β (Quaternion β) n fun _ => q) (βc + (s / βqβ) β’ q) := by
replace hc := hasSum_coe.mpr hc
replace hs := (hs.div_const βqβ).smul_const q
refine HasSum.even_add_odd ?_ ?_
Β· convert hc using 1
ext n : 1
rw [expSeries_even_of_imaginary hq]
Β· convert hs using 1
ext n : 1
rw [expSeries_odd_of_imaginary hq]
#align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary
theorem exp_of_re_eq_zero (q : Quaternion β) (hq : q.re = 0) :
exp β q = β(Real.cos βqβ) + (Real.sin βqβ / βqβ) β’ q := by
rw [exp_eq_tsum]
refine HasSum.tsum_eq ?_
simp_rw [β expSeries_apply_eq]
exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
#align quaternion.exp_of_re_eq_zero Quaternion.exp_of_re_eq_zero
theorem exp_eq (q : Quaternion β) :
exp β q = exp β q.re β’ (β(Real.cos βq.imβ) + (Real.sin βq.imβ / βq.imβ) β’ q.im) := by
rw [β exp_of_re_eq_zero q.im q.im_re, β coe_mul_eq_smul, β exp_coe, β exp_add_of_commute,
re_add_im]
exact Algebra.commutes q.re (_ : β[β])
#align quaternion.exp_eq Quaternion.exp_eq
theorem re_exp (q : β[β]) : (exp β q).re = exp β q.re * Real.cos βq - q.reβ := by simp [exp_eq]
#align quaternion.re_exp Quaternion.re_exp
theorem im_exp (q : β[β]) : (exp β q).im = (exp β q.re * (Real.sin βq.imβ / βq.imβ)) β’ q.im := by
simp [exp_eq, smul_smul]
#align quaternion.im_exp Quaternion.im_exp
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 121 | 135 | theorem normSq_exp (q : β[β]) : normSq (exp β q) = exp β q.re ^ 2 :=
calc
normSq (exp β q) =
normSq (exp β q.re β’ (β(Real.cos βq.imβ) + (Real.sin βq.imβ / βq.imβ) β’ q.im)) := by |
rw [exp_eq]
_ = exp β q.re ^ 2 * normSq (β(Real.cos βq.imβ) + (Real.sin βq.imβ / βq.imβ) β’ q.im) := by
rw [normSq_smul]
_ = exp β q.re ^ 2 * (Real.cos βq.imβ ^ 2 + Real.sin βq.imβ ^ 2) := by
congr 1
obtain hv | hv := eq_or_ne βq.imβ 0
Β· simp [hv]
rw [normSq_add, normSq_smul, star_smul, coe_mul_eq_smul, smul_re, smul_re, star_re, im_re,
smul_zero, smul_zero, mul_zero, add_zero, div_pow, normSq_coe,
normSq_eq_norm_mul_self, β sq, div_mul_cancelβ _ (pow_ne_zero _ hv)]
_ = exp β q.re ^ 2 := by rw [Real.cos_sq_add_sin_sq, mul_one]
| 11 | 59,874.141715 | 2 | 1.375 | 8 | 1,470 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
| Mathlib/Data/List/GetD.lean | 38 | 44 | theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by |
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
| 6 | 403.428793 | 2 | 1.375 | 8 | 1,471 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
@[simp]
| Mathlib/Data/List/GetD.lean | 47 | 53 | theorem getD_map {n : β} (f : Ξ± β Ξ²) : (map f l).getD n (f d) = f (l.getD n d) := by |
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
cases n
Β· rfl
Β· simp [ih]
| 6 | 403.428793 | 2 | 1.375 | 8 | 1,471 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
@[simp]
theorem getD_map {n : β} (f : Ξ± β Ξ²) : (map f l).getD n (f d) = f (l.getD n d) := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
cases n
Β· rfl
Β· simp [ih]
#align list.nthd_eq_nth_le List.getD_eq_get
| Mathlib/Data/List/GetD.lean | 57 | 63 | theorem getD_eq_default {n : β} (hn : l.length β€ n) : l.getD n d = d := by |
induction l generalizing n with
| nil => exact getD_nil
| cons head tail ih =>
cases n
Β· simp at hn
Β· exact ih (Nat.le_of_succ_le_succ hn)
| 6 | 403.428793 | 2 | 1.375 | 8 | 1,471 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
@[simp]
theorem getD_map {n : β} (f : Ξ± β Ξ²) : (map f l).getD n (f d) = f (l.getD n d) := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
cases n
Β· rfl
Β· simp [ih]
#align list.nthd_eq_nth_le List.getD_eq_get
theorem getD_eq_default {n : β} (hn : l.length β€ n) : l.getD n d = d := by
induction l generalizing n with
| nil => exact getD_nil
| cons head tail ih =>
cases n
Β· simp at hn
Β· exact ih (Nat.le_of_succ_le_succ hn)
#align list.nthd_eq_default List.getD_eq_defaultβ -- argument order
def decidableGetDNilNe (a : Ξ±) : DecidablePred fun i : β => getD ([] : List Ξ±) i a β a :=
fun _ => isFalse fun H => H getD_nil
#align list.decidable_nthd_nil_ne List.decidableGetDNilNeβ -- argument order
@[simp]
| Mathlib/Data/List/GetD.lean | 73 | 73 | theorem getD_singleton_default_eq (n : β) : [d].getD n d = d := by | cases n <;> simp
| 1 | 2.718282 | 0 | 1.375 | 8 | 1,471 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
@[simp]
theorem getD_map {n : β} (f : Ξ± β Ξ²) : (map f l).getD n (f d) = f (l.getD n d) := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
cases n
Β· rfl
Β· simp [ih]
#align list.nthd_eq_nth_le List.getD_eq_get
theorem getD_eq_default {n : β} (hn : l.length β€ n) : l.getD n d = d := by
induction l generalizing n with
| nil => exact getD_nil
| cons head tail ih =>
cases n
Β· simp at hn
Β· exact ih (Nat.le_of_succ_le_succ hn)
#align list.nthd_eq_default List.getD_eq_defaultβ -- argument order
def decidableGetDNilNe (a : Ξ±) : DecidablePred fun i : β => getD ([] : List Ξ±) i a β a :=
fun _ => isFalse fun H => H getD_nil
#align list.decidable_nthd_nil_ne List.decidableGetDNilNeβ -- argument order
@[simp]
theorem getD_singleton_default_eq (n : β) : [d].getD n d = d := by cases n <;> simp
#align list.nthd_singleton_default_eq List.getD_singleton_default_eqβ -- argument order
@[simp]
| Mathlib/Data/List/GetD.lean | 77 | 80 | theorem getD_replicate_default_eq (r n : β) : (replicate r d).getD n d = d := by |
induction r generalizing n with
| zero => simp
| succ n ih => cases n <;> simp [ih]
| 3 | 20.085537 | 1 | 1.375 | 8 | 1,471 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
@[simp]
theorem getD_map {n : β} (f : Ξ± β Ξ²) : (map f l).getD n (f d) = f (l.getD n d) := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
cases n
Β· rfl
Β· simp [ih]
#align list.nthd_eq_nth_le List.getD_eq_get
theorem getD_eq_default {n : β} (hn : l.length β€ n) : l.getD n d = d := by
induction l generalizing n with
| nil => exact getD_nil
| cons head tail ih =>
cases n
Β· simp at hn
Β· exact ih (Nat.le_of_succ_le_succ hn)
#align list.nthd_eq_default List.getD_eq_defaultβ -- argument order
def decidableGetDNilNe (a : Ξ±) : DecidablePred fun i : β => getD ([] : List Ξ±) i a β a :=
fun _ => isFalse fun H => H getD_nil
#align list.decidable_nthd_nil_ne List.decidableGetDNilNeβ -- argument order
@[simp]
theorem getD_singleton_default_eq (n : β) : [d].getD n d = d := by cases n <;> simp
#align list.nthd_singleton_default_eq List.getD_singleton_default_eqβ -- argument order
@[simp]
theorem getD_replicate_default_eq (r n : β) : (replicate r d).getD n d = d := by
induction r generalizing n with
| zero => simp
| succ n ih => cases n <;> simp [ih]
#align list.nthd_replicate_default_eq List.getD_replicate_default_eqβ -- argument order
| Mathlib/Data/List/GetD.lean | 83 | 86 | theorem getD_append (l l' : List Ξ±) (d : Ξ±) (n : β) (h : n < l.length) :
(l ++ l').getD n d = l.getD n d := by |
rw [getD_eq_get _ _ (Nat.lt_of_lt_of_le h (length_append _ _ βΈ Nat.le_add_right _ _)),
get_append _ h, getD_eq_get]
| 2 | 7.389056 | 1 | 1.375 | 8 | 1,471 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
@[simp]
theorem getD_map {n : β} (f : Ξ± β Ξ²) : (map f l).getD n (f d) = f (l.getD n d) := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
cases n
Β· rfl
Β· simp [ih]
#align list.nthd_eq_nth_le List.getD_eq_get
theorem getD_eq_default {n : β} (hn : l.length β€ n) : l.getD n d = d := by
induction l generalizing n with
| nil => exact getD_nil
| cons head tail ih =>
cases n
Β· simp at hn
Β· exact ih (Nat.le_of_succ_le_succ hn)
#align list.nthd_eq_default List.getD_eq_defaultβ -- argument order
def decidableGetDNilNe (a : Ξ±) : DecidablePred fun i : β => getD ([] : List Ξ±) i a β a :=
fun _ => isFalse fun H => H getD_nil
#align list.decidable_nthd_nil_ne List.decidableGetDNilNeβ -- argument order
@[simp]
theorem getD_singleton_default_eq (n : β) : [d].getD n d = d := by cases n <;> simp
#align list.nthd_singleton_default_eq List.getD_singleton_default_eqβ -- argument order
@[simp]
theorem getD_replicate_default_eq (r n : β) : (replicate r d).getD n d = d := by
induction r generalizing n with
| zero => simp
| succ n ih => cases n <;> simp [ih]
#align list.nthd_replicate_default_eq List.getD_replicate_default_eqβ -- argument order
theorem getD_append (l l' : List Ξ±) (d : Ξ±) (n : β) (h : n < l.length) :
(l ++ l').getD n d = l.getD n d := by
rw [getD_eq_get _ _ (Nat.lt_of_lt_of_le h (length_append _ _ βΈ Nat.le_add_right _ _)),
get_append _ h, getD_eq_get]
#align list.nthd_append List.getD_appendβ -- argument order
| Mathlib/Data/List/GetD.lean | 89 | 99 | theorem getD_append_right (l l' : List Ξ±) (d : Ξ±) (n : β) (h : l.length β€ n) :
(l ++ l').getD n d = l'.getD (n - l.length) d := by |
cases Nat.lt_or_ge n (l ++ l').length with
| inl h' =>
rw [getD_eq_get (l ++ l') d h', get_append_right, getD_eq_get]
Β· rw [length_append] at h'
exact Nat.sub_lt_left_of_lt_add h h'
Β· exact Nat.not_lt_of_le h
| inr h' =>
rw [getD_eq_default _ _ h', getD_eq_default]
rwa [Nat.le_sub_iff_add_le' h, β length_append]
| 9 | 8,103.083928 | 2 | 1.375 | 8 | 1,471 |
import Mathlib.Data.List.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.Nat.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Util.AssertExists
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
namespace List
universe u v
variable {Ξ± : Type u} {Ξ² : Type v} (l : List Ξ±) (x : Ξ±) (xs : List Ξ±) (n : β)
section getD
variable (d : Ξ±)
#align list.nthd_nil List.getD_nilβ -- argument order
#align list.nthd_cons_zero List.getD_cons_zeroβ -- argument order
#align list.nthd_cons_succ List.getD_cons_succβ -- argument order
theorem getD_eq_get {n : β} (hn : n < l.length) : l.getD n d = l.get β¨n, hnβ© := by
induction l generalizing n with
| nil => simp at hn
| cons head tail ih =>
cases n
Β· exact getD_cons_zero
Β· exact ih _
@[simp]
theorem getD_map {n : β} (f : Ξ± β Ξ²) : (map f l).getD n (f d) = f (l.getD n d) := by
induction l generalizing n with
| nil => rfl
| cons head tail ih =>
cases n
Β· rfl
Β· simp [ih]
#align list.nthd_eq_nth_le List.getD_eq_get
theorem getD_eq_default {n : β} (hn : l.length β€ n) : l.getD n d = d := by
induction l generalizing n with
| nil => exact getD_nil
| cons head tail ih =>
cases n
Β· simp at hn
Β· exact ih (Nat.le_of_succ_le_succ hn)
#align list.nthd_eq_default List.getD_eq_defaultβ -- argument order
def decidableGetDNilNe (a : Ξ±) : DecidablePred fun i : β => getD ([] : List Ξ±) i a β a :=
fun _ => isFalse fun H => H getD_nil
#align list.decidable_nthd_nil_ne List.decidableGetDNilNeβ -- argument order
@[simp]
theorem getD_singleton_default_eq (n : β) : [d].getD n d = d := by cases n <;> simp
#align list.nthd_singleton_default_eq List.getD_singleton_default_eqβ -- argument order
@[simp]
theorem getD_replicate_default_eq (r n : β) : (replicate r d).getD n d = d := by
induction r generalizing n with
| zero => simp
| succ n ih => cases n <;> simp [ih]
#align list.nthd_replicate_default_eq List.getD_replicate_default_eqβ -- argument order
theorem getD_append (l l' : List Ξ±) (d : Ξ±) (n : β) (h : n < l.length) :
(l ++ l').getD n d = l.getD n d := by
rw [getD_eq_get _ _ (Nat.lt_of_lt_of_le h (length_append _ _ βΈ Nat.le_add_right _ _)),
get_append _ h, getD_eq_get]
#align list.nthd_append List.getD_appendβ -- argument order
theorem getD_append_right (l l' : List Ξ±) (d : Ξ±) (n : β) (h : l.length β€ n) :
(l ++ l').getD n d = l'.getD (n - l.length) d := by
cases Nat.lt_or_ge n (l ++ l').length with
| inl h' =>
rw [getD_eq_get (l ++ l') d h', get_append_right, getD_eq_get]
Β· rw [length_append] at h'
exact Nat.sub_lt_left_of_lt_add h h'
Β· exact Nat.not_lt_of_le h
| inr h' =>
rw [getD_eq_default _ _ h', getD_eq_default]
rwa [Nat.le_sub_iff_add_le' h, β length_append]
#align list.nthd_append_right List.getD_append_rightβ -- argument order
| Mathlib/Data/List/GetD.lean | 102 | 105 | theorem getD_eq_getD_get? (n : β) : l.getD n d = (l.get? n).getD d := by |
cases Nat.lt_or_ge n l.length with
| inl h => rw [getD_eq_get _ _ h, get?_eq_get h, Option.getD_some]
| inr h => rw [getD_eq_default _ _ h, get?_eq_none.mpr h, Option.getD_none]
| 3 | 20.085537 | 1 | 1.375 | 8 | 1,471 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 61 | 62 | theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by | apply h.inv'
| 1 | 2.718282 | 0 | 1.375 | 8 | 1,472 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 66 | 72 | theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a βΆ b) : reverse f = reverse g β f = g := by |
constructor
Β· rintro h
simpa using congr_arg Quiver.reverse h
Β· rintro h
congr
| 5 | 148.413159 | 2 | 1.375 | 8 | 1,472 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a βΆ b) : reverse f = reverse g β f = g := by
constructor
Β· rintro h
simpa using congr_arg Quiver.reverse h
Β· rintro h
congr
#align quiver.reverse_inj Quiver.reverse_inj
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 75 | 77 | theorem eq_reverse_iff [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b)
(g : b βΆ a) : f = reverse g β reverse f = g := by |
rw [β reverse_inj, reverse_reverse]
| 1 | 2.718282 | 0 | 1.375 | 8 | 1,472 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a βΆ b) : reverse f = reverse g β f = g := by
constructor
Β· rintro h
simpa using congr_arg Quiver.reverse h
Β· rintro h
congr
#align quiver.reverse_inj Quiver.reverse_inj
theorem eq_reverse_iff [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b)
(g : b βΆ a) : f = reverse g β reverse f = g := by
rw [β reverse_inj, reverse_reverse]
#align quiver.eq_reverse_iff Quiver.eq_reverse_iff
instance : HasReverse (Symmetrify V) :=
β¨fun e => e.swapβ©
instance :
HasInvolutiveReverse
(Symmetrify V) where
toHasReverse := β¨fun e β¦ e.swapβ©
inv' e := congr_fun Sum.swap_swap_eq e
@[simp]
theorem symmetrify_reverse {a b : Symmetrify V} (e : a βΆ b) : reverse e = e.swap :=
rfl
#align quiver.symmetrify_reverse Quiver.symmetrify_reverse
section Paths
abbrev Hom.toPos {X Y : V} (f : X βΆ Y) : (Quiver.symmetrifyQuiver V).Hom X Y :=
Sum.inl f
#align quiver.hom.to_pos Quiver.Hom.toPos
abbrev Hom.toNeg {X Y : V} (f : X βΆ Y) : (Quiver.symmetrifyQuiver V).Hom Y X :=
Sum.inr f
#align quiver.hom.to_neg Quiver.Hom.toNeg
@[simp]
def Path.reverse [HasReverse V] {a : V} : β {b}, Path a b β Path b a
| _, Path.nil => Path.nil
| _, Path.cons p e => (Quiver.reverse e).toPath.comp p.reverse
#align quiver.path.reverse Quiver.Path.reverse
@[simp]
theorem Path.reverse_toPath [HasReverse V] {a b : V} (f : a βΆ b) :
f.toPath.reverse = (Quiver.reverse f).toPath :=
rfl
#align quiver.path.reverse_to_path Quiver.Path.reverse_toPath
@[simp]
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 150 | 154 | theorem Path.reverse_comp [HasReverse V] {a b c : V} (p : Path a b) (q : Path b c) :
(p.comp q).reverse = q.reverse.comp p.reverse := by |
induction' q with _ _ _ _ h
Β· simp
Β· simp [h]
| 3 | 20.085537 | 1 | 1.375 | 8 | 1,472 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a βΆ b) : reverse f = reverse g β f = g := by
constructor
Β· rintro h
simpa using congr_arg Quiver.reverse h
Β· rintro h
congr
#align quiver.reverse_inj Quiver.reverse_inj
theorem eq_reverse_iff [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b)
(g : b βΆ a) : f = reverse g β reverse f = g := by
rw [β reverse_inj, reverse_reverse]
#align quiver.eq_reverse_iff Quiver.eq_reverse_iff
instance : HasReverse (Symmetrify V) :=
β¨fun e => e.swapβ©
instance :
HasInvolutiveReverse
(Symmetrify V) where
toHasReverse := β¨fun e β¦ e.swapβ©
inv' e := congr_fun Sum.swap_swap_eq e
@[simp]
theorem symmetrify_reverse {a b : Symmetrify V} (e : a βΆ b) : reverse e = e.swap :=
rfl
#align quiver.symmetrify_reverse Quiver.symmetrify_reverse
section Paths
abbrev Hom.toPos {X Y : V} (f : X βΆ Y) : (Quiver.symmetrifyQuiver V).Hom X Y :=
Sum.inl f
#align quiver.hom.to_pos Quiver.Hom.toPos
abbrev Hom.toNeg {X Y : V} (f : X βΆ Y) : (Quiver.symmetrifyQuiver V).Hom Y X :=
Sum.inr f
#align quiver.hom.to_neg Quiver.Hom.toNeg
@[simp]
def Path.reverse [HasReverse V] {a : V} : β {b}, Path a b β Path b a
| _, Path.nil => Path.nil
| _, Path.cons p e => (Quiver.reverse e).toPath.comp p.reverse
#align quiver.path.reverse Quiver.Path.reverse
@[simp]
theorem Path.reverse_toPath [HasReverse V] {a b : V} (f : a βΆ b) :
f.toPath.reverse = (Quiver.reverse f).toPath :=
rfl
#align quiver.path.reverse_to_path Quiver.Path.reverse_toPath
@[simp]
theorem Path.reverse_comp [HasReverse V] {a b c : V} (p : Path a b) (q : Path b c) :
(p.comp q).reverse = q.reverse.comp p.reverse := by
induction' q with _ _ _ _ h
Β· simp
Β· simp [h]
#align quiver.path.reverse_comp Quiver.Path.reverse_comp
@[simp]
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 158 | 163 | theorem Path.reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (p : Path a b) :
p.reverse.reverse = p := by |
induction' p with _ _ _ _ h
Β· simp
Β· rw [Path.reverse, Path.reverse_comp, h, Path.reverse_toPath, Quiver.reverse_reverse]
rfl
| 4 | 54.59815 | 2 | 1.375 | 8 | 1,472 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a βΆ b) : reverse f = reverse g β f = g := by
constructor
Β· rintro h
simpa using congr_arg Quiver.reverse h
Β· rintro h
congr
#align quiver.reverse_inj Quiver.reverse_inj
theorem eq_reverse_iff [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b)
(g : b βΆ a) : f = reverse g β reverse f = g := by
rw [β reverse_inj, reverse_reverse]
#align quiver.eq_reverse_iff Quiver.eq_reverse_iff
instance : HasReverse (Symmetrify V) :=
β¨fun e => e.swapβ©
instance :
HasInvolutiveReverse
(Symmetrify V) where
toHasReverse := β¨fun e β¦ e.swapβ©
inv' e := congr_fun Sum.swap_swap_eq e
@[simp]
theorem symmetrify_reverse {a b : Symmetrify V} (e : a βΆ b) : reverse e = e.swap :=
rfl
#align quiver.symmetrify_reverse Quiver.symmetrify_reverse
namespace Symmetrify
def of : Prefunctor V (Symmetrify V) where
obj := id
map := Sum.inl
#align quiver.symmetrify.of Quiver.Symmetrify.of
variable {V' : Type*} [Quiver.{v' + 1} V']
def lift [HasReverse V'] (Ο : Prefunctor V V') :
Prefunctor (Symmetrify V) V' where
obj := Ο.obj
map f := match f with
| Sum.inl g => Ο.map g
| Sum.inr g => reverse (Ο.map g)
#align quiver.symmetrify.lift Quiver.Symmetrify.lift
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 188 | 194 | theorem lift_spec [HasReverse V'] (Ο : Prefunctor V V') :
Symmetrify.of.comp (Symmetrify.lift Ο) = Ο := by |
fapply Prefunctor.ext
Β· rintro X
rfl
Β· rintro X Y f
rfl
| 5 | 148.413159 | 2 | 1.375 | 8 | 1,472 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a βΆ b) : reverse f = reverse g β f = g := by
constructor
Β· rintro h
simpa using congr_arg Quiver.reverse h
Β· rintro h
congr
#align quiver.reverse_inj Quiver.reverse_inj
theorem eq_reverse_iff [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b)
(g : b βΆ a) : f = reverse g β reverse f = g := by
rw [β reverse_inj, reverse_reverse]
#align quiver.eq_reverse_iff Quiver.eq_reverse_iff
instance : HasReverse (Symmetrify V) :=
β¨fun e => e.swapβ©
instance :
HasInvolutiveReverse
(Symmetrify V) where
toHasReverse := β¨fun e β¦ e.swapβ©
inv' e := congr_fun Sum.swap_swap_eq e
@[simp]
theorem symmetrify_reverse {a b : Symmetrify V} (e : a βΆ b) : reverse e = e.swap :=
rfl
#align quiver.symmetrify_reverse Quiver.symmetrify_reverse
namespace Symmetrify
def of : Prefunctor V (Symmetrify V) where
obj := id
map := Sum.inl
#align quiver.symmetrify.of Quiver.Symmetrify.of
variable {V' : Type*} [Quiver.{v' + 1} V']
def lift [HasReverse V'] (Ο : Prefunctor V V') :
Prefunctor (Symmetrify V) V' where
obj := Ο.obj
map f := match f with
| Sum.inl g => Ο.map g
| Sum.inr g => reverse (Ο.map g)
#align quiver.symmetrify.lift Quiver.Symmetrify.lift
theorem lift_spec [HasReverse V'] (Ο : Prefunctor V V') :
Symmetrify.of.comp (Symmetrify.lift Ο) = Ο := by
fapply Prefunctor.ext
Β· rintro X
rfl
Β· rintro X Y f
rfl
#align quiver.symmetrify.lift_spec Quiver.Symmetrify.lift_spec
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 197 | 204 | theorem lift_reverse [h : HasInvolutiveReverse V']
(Ο : Prefunctor V V') {X Y : Symmetrify V} (f : X βΆ Y) :
(Symmetrify.lift Ο).map (Quiver.reverse f) = Quiver.reverse ((Symmetrify.lift Ο).map f) := by |
dsimp [Symmetrify.lift]; cases f
Β· simp only
rfl
Β· simp only [reverse_reverse]
rfl
| 5 | 148.413159 | 2 | 1.375 | 8 | 1,472 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
β¨fun a b : V β¦ Sum (a βΆ b) (b βΆ a)β©
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : β {a b : V}, (a βΆ b) β (b βΆ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a βΆ b) β (b βΆ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : β {a b : V} (f : a βΆ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b) :
reverse (reverse f) = f := by apply h.inv'
#align quiver.reverse_reverse Quiver.reverse_reverse
@[simp]
theorem reverse_inj [h : HasInvolutiveReverse V] {a b : V}
(f g : a βΆ b) : reverse f = reverse g β f = g := by
constructor
Β· rintro h
simpa using congr_arg Quiver.reverse h
Β· rintro h
congr
#align quiver.reverse_inj Quiver.reverse_inj
theorem eq_reverse_iff [h : HasInvolutiveReverse V] {a b : V} (f : a βΆ b)
(g : b βΆ a) : f = reverse g β reverse f = g := by
rw [β reverse_inj, reverse_reverse]
#align quiver.eq_reverse_iff Quiver.eq_reverse_iff
instance : HasReverse (Symmetrify V) :=
β¨fun e => e.swapβ©
instance :
HasInvolutiveReverse
(Symmetrify V) where
toHasReverse := β¨fun e β¦ e.swapβ©
inv' e := congr_fun Sum.swap_swap_eq e
@[simp]
theorem symmetrify_reverse {a b : Symmetrify V} (e : a βΆ b) : reverse e = e.swap :=
rfl
#align quiver.symmetrify_reverse Quiver.symmetrify_reverse
namespace Symmetrify
def of : Prefunctor V (Symmetrify V) where
obj := id
map := Sum.inl
#align quiver.symmetrify.of Quiver.Symmetrify.of
variable {V' : Type*} [Quiver.{v' + 1} V']
def lift [HasReverse V'] (Ο : Prefunctor V V') :
Prefunctor (Symmetrify V) V' where
obj := Ο.obj
map f := match f with
| Sum.inl g => Ο.map g
| Sum.inr g => reverse (Ο.map g)
#align quiver.symmetrify.lift Quiver.Symmetrify.lift
theorem lift_spec [HasReverse V'] (Ο : Prefunctor V V') :
Symmetrify.of.comp (Symmetrify.lift Ο) = Ο := by
fapply Prefunctor.ext
Β· rintro X
rfl
Β· rintro X Y f
rfl
#align quiver.symmetrify.lift_spec Quiver.Symmetrify.lift_spec
theorem lift_reverse [h : HasInvolutiveReverse V']
(Ο : Prefunctor V V') {X Y : Symmetrify V} (f : X βΆ Y) :
(Symmetrify.lift Ο).map (Quiver.reverse f) = Quiver.reverse ((Symmetrify.lift Ο).map f) := by
dsimp [Symmetrify.lift]; cases f
Β· simp only
rfl
Β· simp only [reverse_reverse]
rfl
#align quiver.symmetrify.lift_reverse Quiver.Symmetrify.lift_reverse
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 208 | 219 | theorem lift_unique [HasReverse V'] (Ο : V β₯€q V') (Ξ¦ : Symmetrify V β₯€q V') (hΞ¦ : (of βq Ξ¦) = Ο)
(hΞ¦inv : β {X Y : Symmetrify V} (f : X βΆ Y),
Ξ¦.map (Quiver.reverse f) = Quiver.reverse (Ξ¦.map f)) :
Ξ¦ = Symmetrify.lift Ο := by |
subst_vars
fapply Prefunctor.ext
Β· rintro X
rfl
Β· rintro X Y f
cases f
Β· rfl
· exact hΦinv (Sum.inl _)
| 8 | 2,980.957987 | 2 | 1.375 | 8 | 1,472 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 57 | 64 | theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by |
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
| 4 | 54.59815 | 2 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 67 | 75 | theorem cycleType_eq {Ο : Perm Ξ±} (l : List (Perm Ξ±)) (h0 : l.prod = Ο)
(h1 : β Ο : Perm Ξ±, Ο β l β Ο.IsCycle) (h2 : l.Pairwise Disjoint) :
Ο.cycleType = l.map (Finset.card β support) := by |
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
Β· simp [List.dedup_eq_self.mpr hl, (Β· β Β·)]
Β· simpa using h1
Β· simpa [hl] using h2
Β· simp [hl, h0]
| 6 | 403.428793 | 2 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
theorem cycleType_eq {Ο : Perm Ξ±} (l : List (Perm Ξ±)) (h0 : l.prod = Ο)
(h1 : β Ο : Perm Ξ±, Ο β l β Ο.IsCycle) (h2 : l.Pairwise Disjoint) :
Ο.cycleType = l.map (Finset.card β support) := by
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
Β· simp [List.dedup_eq_self.mpr hl, (Β· β Β·)]
Β· simpa using h1
Β· simpa [hl] using h2
Β· simp [hl, h0]
#align equiv.perm.cycle_type_eq Equiv.Perm.cycleType_eq
@[simp] -- Porting note: new attr
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 79 | 80 | theorem cycleType_eq_zero {Ο : Perm Ξ±} : Ο.cycleType = 0 β Ο = 1 := by |
simp [cycleType_def, cycleFactorsFinset_eq_empty_iff]
| 1 | 2.718282 | 0 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
theorem cycleType_eq {Ο : Perm Ξ±} (l : List (Perm Ξ±)) (h0 : l.prod = Ο)
(h1 : β Ο : Perm Ξ±, Ο β l β Ο.IsCycle) (h2 : l.Pairwise Disjoint) :
Ο.cycleType = l.map (Finset.card β support) := by
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
Β· simp [List.dedup_eq_self.mpr hl, (Β· β Β·)]
Β· simpa using h1
Β· simpa [hl] using h2
Β· simp [hl, h0]
#align equiv.perm.cycle_type_eq Equiv.Perm.cycleType_eq
@[simp] -- Porting note: new attr
theorem cycleType_eq_zero {Ο : Perm Ξ±} : Ο.cycleType = 0 β Ο = 1 := by
simp [cycleType_def, cycleFactorsFinset_eq_empty_iff]
#align equiv.perm.cycle_type_eq_zero Equiv.Perm.cycleType_eq_zero
@[simp] -- Porting note: new attr
theorem cycleType_one : (1 : Perm Ξ±).cycleType = 0 := cycleType_eq_zero.2 rfl
#align equiv.perm.cycle_type_one Equiv.Perm.cycleType_one
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 87 | 88 | theorem card_cycleType_eq_zero {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 0 β Ο = 1 := by |
rw [card_eq_zero, cycleType_eq_zero]
| 1 | 2.718282 | 0 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
theorem cycleType_eq {Ο : Perm Ξ±} (l : List (Perm Ξ±)) (h0 : l.prod = Ο)
(h1 : β Ο : Perm Ξ±, Ο β l β Ο.IsCycle) (h2 : l.Pairwise Disjoint) :
Ο.cycleType = l.map (Finset.card β support) := by
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
Β· simp [List.dedup_eq_self.mpr hl, (Β· β Β·)]
Β· simpa using h1
Β· simpa [hl] using h2
Β· simp [hl, h0]
#align equiv.perm.cycle_type_eq Equiv.Perm.cycleType_eq
@[simp] -- Porting note: new attr
theorem cycleType_eq_zero {Ο : Perm Ξ±} : Ο.cycleType = 0 β Ο = 1 := by
simp [cycleType_def, cycleFactorsFinset_eq_empty_iff]
#align equiv.perm.cycle_type_eq_zero Equiv.Perm.cycleType_eq_zero
@[simp] -- Porting note: new attr
theorem cycleType_one : (1 : Perm Ξ±).cycleType = 0 := cycleType_eq_zero.2 rfl
#align equiv.perm.cycle_type_one Equiv.Perm.cycleType_one
theorem card_cycleType_eq_zero {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 0 β Ο = 1 := by
rw [card_eq_zero, cycleType_eq_zero]
#align equiv.perm.card_cycle_type_eq_zero Equiv.Perm.card_cycleType_eq_zero
theorem card_cycleType_pos {Ο : Perm Ξ±} : 0 < Multiset.card Ο.cycleType β Ο β 1 :=
pos_iff_ne_zero.trans card_cycleType_eq_zero.not
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 94 | 98 | theorem two_le_of_mem_cycleType {Ο : Perm Ξ±} {n : β} (h : n β Ο.cycleType) : 2 β€ n := by |
simp only [cycleType_def, β Finset.mem_def, Function.comp_apply, Multiset.mem_map,
mem_cycleFactorsFinset_iff] at h
obtain β¨_, β¨hc, -β©, rflβ© := h
exact hc.two_le_card_support
| 4 | 54.59815 | 2 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
theorem cycleType_eq {Ο : Perm Ξ±} (l : List (Perm Ξ±)) (h0 : l.prod = Ο)
(h1 : β Ο : Perm Ξ±, Ο β l β Ο.IsCycle) (h2 : l.Pairwise Disjoint) :
Ο.cycleType = l.map (Finset.card β support) := by
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
Β· simp [List.dedup_eq_self.mpr hl, (Β· β Β·)]
Β· simpa using h1
Β· simpa [hl] using h2
Β· simp [hl, h0]
#align equiv.perm.cycle_type_eq Equiv.Perm.cycleType_eq
@[simp] -- Porting note: new attr
theorem cycleType_eq_zero {Ο : Perm Ξ±} : Ο.cycleType = 0 β Ο = 1 := by
simp [cycleType_def, cycleFactorsFinset_eq_empty_iff]
#align equiv.perm.cycle_type_eq_zero Equiv.Perm.cycleType_eq_zero
@[simp] -- Porting note: new attr
theorem cycleType_one : (1 : Perm Ξ±).cycleType = 0 := cycleType_eq_zero.2 rfl
#align equiv.perm.cycle_type_one Equiv.Perm.cycleType_one
theorem card_cycleType_eq_zero {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 0 β Ο = 1 := by
rw [card_eq_zero, cycleType_eq_zero]
#align equiv.perm.card_cycle_type_eq_zero Equiv.Perm.card_cycleType_eq_zero
theorem card_cycleType_pos {Ο : Perm Ξ±} : 0 < Multiset.card Ο.cycleType β Ο β 1 :=
pos_iff_ne_zero.trans card_cycleType_eq_zero.not
theorem two_le_of_mem_cycleType {Ο : Perm Ξ±} {n : β} (h : n β Ο.cycleType) : 2 β€ n := by
simp only [cycleType_def, β Finset.mem_def, Function.comp_apply, Multiset.mem_map,
mem_cycleFactorsFinset_iff] at h
obtain β¨_, β¨hc, -β©, rflβ© := h
exact hc.two_le_card_support
#align equiv.perm.two_le_of_mem_cycle_type Equiv.Perm.two_le_of_mem_cycleType
theorem one_lt_of_mem_cycleType {Ο : Perm Ξ±} {n : β} (h : n β Ο.cycleType) : 1 < n :=
two_le_of_mem_cycleType h
#align equiv.perm.one_lt_of_mem_cycle_type Equiv.Perm.one_lt_of_mem_cycleType
theorem IsCycle.cycleType {Ο : Perm Ξ±} (hΟ : IsCycle Ο) : Ο.cycleType = [Ο.support.card] :=
cycleType_eq [Ο] (mul_one Ο) (fun _Ο hΟ => (congr_arg IsCycle (List.mem_singleton.mp hΟ)).mpr hΟ)
(List.pairwise_singleton Disjoint Ο)
#align equiv.perm.is_cycle.cycle_type Equiv.Perm.IsCycle.cycleType
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 110 | 119 | theorem card_cycleType_eq_one {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 1 β Ο.IsCycle := by |
rw [card_eq_one]
simp_rw [cycleType_def, Multiset.map_eq_singleton, β Finset.singleton_val, Finset.val_inj,
cycleFactorsFinset_eq_singleton_iff]
constructor
Β· rintro β¨_, _, β¨h, -β©, -β©
exact h
Β· intro h
use Ο.support.card, Ο
simp [h]
| 9 | 8,103.083928 | 2 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
theorem cycleType_eq {Ο : Perm Ξ±} (l : List (Perm Ξ±)) (h0 : l.prod = Ο)
(h1 : β Ο : Perm Ξ±, Ο β l β Ο.IsCycle) (h2 : l.Pairwise Disjoint) :
Ο.cycleType = l.map (Finset.card β support) := by
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
Β· simp [List.dedup_eq_self.mpr hl, (Β· β Β·)]
Β· simpa using h1
Β· simpa [hl] using h2
Β· simp [hl, h0]
#align equiv.perm.cycle_type_eq Equiv.Perm.cycleType_eq
@[simp] -- Porting note: new attr
theorem cycleType_eq_zero {Ο : Perm Ξ±} : Ο.cycleType = 0 β Ο = 1 := by
simp [cycleType_def, cycleFactorsFinset_eq_empty_iff]
#align equiv.perm.cycle_type_eq_zero Equiv.Perm.cycleType_eq_zero
@[simp] -- Porting note: new attr
theorem cycleType_one : (1 : Perm Ξ±).cycleType = 0 := cycleType_eq_zero.2 rfl
#align equiv.perm.cycle_type_one Equiv.Perm.cycleType_one
theorem card_cycleType_eq_zero {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 0 β Ο = 1 := by
rw [card_eq_zero, cycleType_eq_zero]
#align equiv.perm.card_cycle_type_eq_zero Equiv.Perm.card_cycleType_eq_zero
theorem card_cycleType_pos {Ο : Perm Ξ±} : 0 < Multiset.card Ο.cycleType β Ο β 1 :=
pos_iff_ne_zero.trans card_cycleType_eq_zero.not
theorem two_le_of_mem_cycleType {Ο : Perm Ξ±} {n : β} (h : n β Ο.cycleType) : 2 β€ n := by
simp only [cycleType_def, β Finset.mem_def, Function.comp_apply, Multiset.mem_map,
mem_cycleFactorsFinset_iff] at h
obtain β¨_, β¨hc, -β©, rflβ© := h
exact hc.two_le_card_support
#align equiv.perm.two_le_of_mem_cycle_type Equiv.Perm.two_le_of_mem_cycleType
theorem one_lt_of_mem_cycleType {Ο : Perm Ξ±} {n : β} (h : n β Ο.cycleType) : 1 < n :=
two_le_of_mem_cycleType h
#align equiv.perm.one_lt_of_mem_cycle_type Equiv.Perm.one_lt_of_mem_cycleType
theorem IsCycle.cycleType {Ο : Perm Ξ±} (hΟ : IsCycle Ο) : Ο.cycleType = [Ο.support.card] :=
cycleType_eq [Ο] (mul_one Ο) (fun _Ο hΟ => (congr_arg IsCycle (List.mem_singleton.mp hΟ)).mpr hΟ)
(List.pairwise_singleton Disjoint Ο)
#align equiv.perm.is_cycle.cycle_type Equiv.Perm.IsCycle.cycleType
theorem card_cycleType_eq_one {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 1 β Ο.IsCycle := by
rw [card_eq_one]
simp_rw [cycleType_def, Multiset.map_eq_singleton, β Finset.singleton_val, Finset.val_inj,
cycleFactorsFinset_eq_singleton_iff]
constructor
Β· rintro β¨_, _, β¨h, -β©, -β©
exact h
Β· intro h
use Ο.support.card, Ο
simp [h]
#align equiv.perm.card_cycle_type_eq_one Equiv.Perm.card_cycleType_eq_one
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 122 | 126 | theorem Disjoint.cycleType {Ο Ο : Perm Ξ±} (h : Disjoint Ο Ο) :
(Ο * Ο).cycleType = Ο.cycleType + Ο.cycleType := by |
rw [cycleType_def, cycleType_def, cycleType_def, h.cycleFactorsFinset_mul_eq_union, β
Multiset.map_add, Finset.union_val, Multiset.add_eq_union_iff_disjoint.mpr _]
exact Finset.disjoint_val.2 h.disjoint_cycleFactorsFinset
| 3 | 20.085537 | 1 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {Ξ± : Type*} [Fintype Ξ±]
section CycleType
variable [DecidableEq Ξ±]
def cycleType (Ο : Perm Ξ±) : Multiset β :=
Ο.cycleFactorsFinset.1.map (Finset.card β support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (Ο : Perm Ξ±) :
Ο.cycleType = Ο.cycleFactorsFinset.1.map (Finset.card β support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {Ο : Perm Ξ±} (s : Finset (Perm Ξ±)) (h1 : β f : Perm Ξ±, f β s β f.IsCycle)
(h2 : (s : Set (Perm Ξ±)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = Ο) :
Ο.cycleType = s.1.map (Finset.card β support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact β¨h1, h2, h0β©
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
theorem cycleType_eq {Ο : Perm Ξ±} (l : List (Perm Ξ±)) (h0 : l.prod = Ο)
(h1 : β Ο : Perm Ξ±, Ο β l β Ο.IsCycle) (h2 : l.Pairwise Disjoint) :
Ο.cycleType = l.map (Finset.card β support) := by
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
Β· simp [List.dedup_eq_self.mpr hl, (Β· β Β·)]
Β· simpa using h1
Β· simpa [hl] using h2
Β· simp [hl, h0]
#align equiv.perm.cycle_type_eq Equiv.Perm.cycleType_eq
@[simp] -- Porting note: new attr
theorem cycleType_eq_zero {Ο : Perm Ξ±} : Ο.cycleType = 0 β Ο = 1 := by
simp [cycleType_def, cycleFactorsFinset_eq_empty_iff]
#align equiv.perm.cycle_type_eq_zero Equiv.Perm.cycleType_eq_zero
@[simp] -- Porting note: new attr
theorem cycleType_one : (1 : Perm Ξ±).cycleType = 0 := cycleType_eq_zero.2 rfl
#align equiv.perm.cycle_type_one Equiv.Perm.cycleType_one
theorem card_cycleType_eq_zero {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 0 β Ο = 1 := by
rw [card_eq_zero, cycleType_eq_zero]
#align equiv.perm.card_cycle_type_eq_zero Equiv.Perm.card_cycleType_eq_zero
theorem card_cycleType_pos {Ο : Perm Ξ±} : 0 < Multiset.card Ο.cycleType β Ο β 1 :=
pos_iff_ne_zero.trans card_cycleType_eq_zero.not
theorem two_le_of_mem_cycleType {Ο : Perm Ξ±} {n : β} (h : n β Ο.cycleType) : 2 β€ n := by
simp only [cycleType_def, β Finset.mem_def, Function.comp_apply, Multiset.mem_map,
mem_cycleFactorsFinset_iff] at h
obtain β¨_, β¨hc, -β©, rflβ© := h
exact hc.two_le_card_support
#align equiv.perm.two_le_of_mem_cycle_type Equiv.Perm.two_le_of_mem_cycleType
theorem one_lt_of_mem_cycleType {Ο : Perm Ξ±} {n : β} (h : n β Ο.cycleType) : 1 < n :=
two_le_of_mem_cycleType h
#align equiv.perm.one_lt_of_mem_cycle_type Equiv.Perm.one_lt_of_mem_cycleType
theorem IsCycle.cycleType {Ο : Perm Ξ±} (hΟ : IsCycle Ο) : Ο.cycleType = [Ο.support.card] :=
cycleType_eq [Ο] (mul_one Ο) (fun _Ο hΟ => (congr_arg IsCycle (List.mem_singleton.mp hΟ)).mpr hΟ)
(List.pairwise_singleton Disjoint Ο)
#align equiv.perm.is_cycle.cycle_type Equiv.Perm.IsCycle.cycleType
theorem card_cycleType_eq_one {Ο : Perm Ξ±} : Multiset.card Ο.cycleType = 1 β Ο.IsCycle := by
rw [card_eq_one]
simp_rw [cycleType_def, Multiset.map_eq_singleton, β Finset.singleton_val, Finset.val_inj,
cycleFactorsFinset_eq_singleton_iff]
constructor
Β· rintro β¨_, _, β¨h, -β©, -β©
exact h
Β· intro h
use Ο.support.card, Ο
simp [h]
#align equiv.perm.card_cycle_type_eq_one Equiv.Perm.card_cycleType_eq_one
theorem Disjoint.cycleType {Ο Ο : Perm Ξ±} (h : Disjoint Ο Ο) :
(Ο * Ο).cycleType = Ο.cycleType + Ο.cycleType := by
rw [cycleType_def, cycleType_def, cycleType_def, h.cycleFactorsFinset_mul_eq_union, β
Multiset.map_add, Finset.union_val, Multiset.add_eq_union_iff_disjoint.mpr _]
exact Finset.disjoint_val.2 h.disjoint_cycleFactorsFinset
#align equiv.perm.disjoint.cycle_type Equiv.Perm.Disjoint.cycleType
@[simp] -- Porting note: new attr
theorem cycleType_inv (Ο : Perm Ξ±) : Οβ»ΒΉ.cycleType = Ο.cycleType :=
cycle_induction_on (P := fun Ο : Perm Ξ± => Οβ»ΒΉ.cycleType = Ο.cycleType) Ο rfl
(fun Ο hΟ => by simp only [hΟ.cycleType, hΟ.inv.cycleType, support_inv])
fun Ο Ο hΟΟ _ hΟ hΟ => by
simp only [mul_inv_rev, hΟΟ.cycleType, hΟΟ.symm.inv_left.inv_right.cycleType, hΟ, hΟ,
add_comm]
#align equiv.perm.cycle_type_inv Equiv.Perm.cycleType_inv
@[simp] -- Porting note: new attr
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 139 | 144 | theorem cycleType_conj {Ο Ο : Perm Ξ±} : (Ο * Ο * Οβ»ΒΉ).cycleType = Ο.cycleType := by |
induction Ο using cycle_induction_on with
| base_one => simp
| base_cycles Ο hΟ => rw [hΟ.cycleType, hΟ.conj.cycleType, card_support_conj]
| induction_disjoint Ο Ο hd _ hΟ hΟ =>
rw [β conj_mul, hd.cycleType, (hd.conj _).cycleType, hΟ, hΟ]
| 5 | 148.413159 | 2 | 1.375 | 8 | 1,473 |
import Mathlib.Algebra.Polynomial.Degree.Lemmas
open Polynomial
namespace Mathlib.Tactic.ComputeDegree
section recursion_lemmas
variable {R : Type*}
section semiring
variable [Semiring R]
theorem natDegree_C_le (a : R) : natDegree (C a) β€ 0 := (natDegree_C a).le
theorem natDegree_natCast_le (n : β) : natDegree (n : R[X]) β€ 0 := (natDegree_natCast _).le
theorem natDegree_zero_le : natDegree (0 : R[X]) β€ 0 := natDegree_zero.le
theorem natDegree_one_le : natDegree (1 : R[X]) β€ 0 := natDegree_one.le
@[deprecated (since := "2024-04-17")]
alias natDegree_nat_cast_le := natDegree_natCast_le
| Mathlib/Tactic/ComputeDegree.lean | 101 | 103 | theorem coeff_add_of_eq {n : β} {a b : R} {f g : R[X]}
(h_add_left : f.coeff n = a) (h_add_right : g.coeff n = b) :
(f + g).coeff n = a + b := by | subst βΉ_βΊ βΉ_βΊ; apply coeff_add
| 1 | 2.718282 | 0 | 1.4 | 5 | 1,474 |
import Mathlib.Algebra.Polynomial.Degree.Lemmas
open Polynomial
namespace Mathlib.Tactic.ComputeDegree
section recursion_lemmas
variable {R : Type*}
section semiring
variable [Semiring R]
theorem natDegree_C_le (a : R) : natDegree (C a) β€ 0 := (natDegree_C a).le
theorem natDegree_natCast_le (n : β) : natDegree (n : R[X]) β€ 0 := (natDegree_natCast _).le
theorem natDegree_zero_le : natDegree (0 : R[X]) β€ 0 := natDegree_zero.le
theorem natDegree_one_le : natDegree (1 : R[X]) β€ 0 := natDegree_one.le
@[deprecated (since := "2024-04-17")]
alias natDegree_nat_cast_le := natDegree_natCast_le
theorem coeff_add_of_eq {n : β} {a b : R} {f g : R[X]}
(h_add_left : f.coeff n = a) (h_add_right : g.coeff n = b) :
(f + g).coeff n = a + b := by subst βΉ_βΊ βΉ_βΊ; apply coeff_add
| Mathlib/Tactic/ComputeDegree.lean | 105 | 115 | theorem coeff_mul_add_of_le_natDegree_of_eq_ite {d df dg : β} {a b : R} {f g : R[X]}
(h_mul_left : natDegree f β€ df) (h_mul_right : natDegree g β€ dg)
(h_mul_left : f.coeff df = a) (h_mul_right : g.coeff dg = b) (ddf : df + dg β€ d) :
(f * g).coeff d = if d = df + dg then a * b else 0 := by |
split_ifs with h
Β· subst h_mul_left h_mul_right h
exact coeff_mul_of_natDegree_le βΉ_βΊ βΉ_βΊ
Β· apply coeff_eq_zero_of_natDegree_lt
apply lt_of_le_of_lt ?_ (lt_of_le_of_ne ddf ?_)
Β· exact natDegree_mul_le_of_le βΉ_βΊ βΉ_βΊ
Β· exact ne_comm.mp h
| 7 | 1,096.633158 | 2 | 1.4 | 5 | 1,474 |
import Mathlib.Algebra.Polynomial.Degree.Lemmas
open Polynomial
namespace Mathlib.Tactic.ComputeDegree
section recursion_lemmas
variable {R : Type*}
section semiring
variable [Semiring R]
theorem natDegree_C_le (a : R) : natDegree (C a) β€ 0 := (natDegree_C a).le
theorem natDegree_natCast_le (n : β) : natDegree (n : R[X]) β€ 0 := (natDegree_natCast _).le
theorem natDegree_zero_le : natDegree (0 : R[X]) β€ 0 := natDegree_zero.le
theorem natDegree_one_le : natDegree (1 : R[X]) β€ 0 := natDegree_one.le
@[deprecated (since := "2024-04-17")]
alias natDegree_nat_cast_le := natDegree_natCast_le
theorem coeff_add_of_eq {n : β} {a b : R} {f g : R[X]}
(h_add_left : f.coeff n = a) (h_add_right : g.coeff n = b) :
(f + g).coeff n = a + b := by subst βΉ_βΊ βΉ_βΊ; apply coeff_add
theorem coeff_mul_add_of_le_natDegree_of_eq_ite {d df dg : β} {a b : R} {f g : R[X]}
(h_mul_left : natDegree f β€ df) (h_mul_right : natDegree g β€ dg)
(h_mul_left : f.coeff df = a) (h_mul_right : g.coeff dg = b) (ddf : df + dg β€ d) :
(f * g).coeff d = if d = df + dg then a * b else 0 := by
split_ifs with h
Β· subst h_mul_left h_mul_right h
exact coeff_mul_of_natDegree_le βΉ_βΊ βΉ_βΊ
Β· apply coeff_eq_zero_of_natDegree_lt
apply lt_of_le_of_lt ?_ (lt_of_le_of_ne ddf ?_)
Β· exact natDegree_mul_le_of_le βΉ_βΊ βΉ_βΊ
Β· exact ne_comm.mp h
| Mathlib/Tactic/ComputeDegree.lean | 117 | 126 | theorem coeff_pow_of_natDegree_le_of_eq_ite' {m n o : β} {a : R} {p : R[X]}
(h_pow : natDegree p β€ n) (h_exp : m * n β€ o) (h_pow_bas : coeff p n = a) :
coeff (p ^ m) o = if o = m * n then a ^ m else 0 := by |
split_ifs with h
Β· subst h h_pow_bas
exact coeff_pow_of_natDegree_le βΉ_βΊ
Β· apply coeff_eq_zero_of_natDegree_lt
apply lt_of_le_of_lt ?_ (lt_of_le_of_ne βΉ_βΊ ?_)
Β· exact natDegree_pow_le_of_le m βΉ_βΊ
Β· exact Iff.mp ne_comm h
| 7 | 1,096.633158 | 2 | 1.4 | 5 | 1,474 |
import Mathlib.Algebra.Polynomial.Degree.Lemmas
open Polynomial
namespace Mathlib.Tactic.ComputeDegree
section recursion_lemmas
variable {R : Type*}
section semiring
variable [Semiring R]
theorem natDegree_C_le (a : R) : natDegree (C a) β€ 0 := (natDegree_C a).le
theorem natDegree_natCast_le (n : β) : natDegree (n : R[X]) β€ 0 := (natDegree_natCast _).le
theorem natDegree_zero_le : natDegree (0 : R[X]) β€ 0 := natDegree_zero.le
theorem natDegree_one_le : natDegree (1 : R[X]) β€ 0 := natDegree_one.le
@[deprecated (since := "2024-04-17")]
alias natDegree_nat_cast_le := natDegree_natCast_le
theorem coeff_add_of_eq {n : β} {a b : R} {f g : R[X]}
(h_add_left : f.coeff n = a) (h_add_right : g.coeff n = b) :
(f + g).coeff n = a + b := by subst βΉ_βΊ βΉ_βΊ; apply coeff_add
theorem coeff_mul_add_of_le_natDegree_of_eq_ite {d df dg : β} {a b : R} {f g : R[X]}
(h_mul_left : natDegree f β€ df) (h_mul_right : natDegree g β€ dg)
(h_mul_left : f.coeff df = a) (h_mul_right : g.coeff dg = b) (ddf : df + dg β€ d) :
(f * g).coeff d = if d = df + dg then a * b else 0 := by
split_ifs with h
Β· subst h_mul_left h_mul_right h
exact coeff_mul_of_natDegree_le βΉ_βΊ βΉ_βΊ
Β· apply coeff_eq_zero_of_natDegree_lt
apply lt_of_le_of_lt ?_ (lt_of_le_of_ne ddf ?_)
Β· exact natDegree_mul_le_of_le βΉ_βΊ βΉ_βΊ
Β· exact ne_comm.mp h
theorem coeff_pow_of_natDegree_le_of_eq_ite' {m n o : β} {a : R} {p : R[X]}
(h_pow : natDegree p β€ n) (h_exp : m * n β€ o) (h_pow_bas : coeff p n = a) :
coeff (p ^ m) o = if o = m * n then a ^ m else 0 := by
split_ifs with h
Β· subst h h_pow_bas
exact coeff_pow_of_natDegree_le βΉ_βΊ
Β· apply coeff_eq_zero_of_natDegree_lt
apply lt_of_le_of_lt ?_ (lt_of_le_of_ne βΉ_βΊ ?_)
Β· exact natDegree_pow_le_of_le m βΉ_βΊ
Β· exact Iff.mp ne_comm h
theorem natDegree_smul_le_of_le {n : β} {a : R} {f : R[X]} (hf : natDegree f β€ n) :
natDegree (a β’ f) β€ n :=
(natDegree_smul_le a f).trans hf
theorem degree_smul_le_of_le {n : β} {a : R} {f : R[X]} (hf : degree f β€ n) :
degree (a β’ f) β€ n :=
(degree_smul_le a f).trans hf
theorem coeff_smul {n : β} {a : R} {f : R[X]} : (a β’ f).coeff n = a * f.coeff n := rfl
section congr_lemmas
| Mathlib/Tactic/ComputeDegree.lean | 150 | 155 | theorem natDegree_eq_of_le_of_coeff_ne_zero' {deg m o : β} {c : R} {p : R[X]}
(h_natDeg_le : natDegree p β€ m) (coeff_eq : coeff p o = c)
(coeff_ne_zero : c β 0) (deg_eq_deg : m = deg) (coeff_eq_deg : o = deg) :
natDegree p = deg := by |
subst coeff_eq deg_eq_deg coeff_eq_deg
exact natDegree_eq_of_le_of_coeff_ne_zero βΉ_βΊ βΉ_βΊ
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,474 |
import Mathlib.Algebra.Polynomial.Degree.Lemmas
open Polynomial
namespace Mathlib.Tactic.ComputeDegree
section recursion_lemmas
variable {R : Type*}
section semiring
variable [Semiring R]
theorem natDegree_C_le (a : R) : natDegree (C a) β€ 0 := (natDegree_C a).le
theorem natDegree_natCast_le (n : β) : natDegree (n : R[X]) β€ 0 := (natDegree_natCast _).le
theorem natDegree_zero_le : natDegree (0 : R[X]) β€ 0 := natDegree_zero.le
theorem natDegree_one_le : natDegree (1 : R[X]) β€ 0 := natDegree_one.le
@[deprecated (since := "2024-04-17")]
alias natDegree_nat_cast_le := natDegree_natCast_le
theorem coeff_add_of_eq {n : β} {a b : R} {f g : R[X]}
(h_add_left : f.coeff n = a) (h_add_right : g.coeff n = b) :
(f + g).coeff n = a + b := by subst βΉ_βΊ βΉ_βΊ; apply coeff_add
theorem coeff_mul_add_of_le_natDegree_of_eq_ite {d df dg : β} {a b : R} {f g : R[X]}
(h_mul_left : natDegree f β€ df) (h_mul_right : natDegree g β€ dg)
(h_mul_left : f.coeff df = a) (h_mul_right : g.coeff dg = b) (ddf : df + dg β€ d) :
(f * g).coeff d = if d = df + dg then a * b else 0 := by
split_ifs with h
Β· subst h_mul_left h_mul_right h
exact coeff_mul_of_natDegree_le βΉ_βΊ βΉ_βΊ
Β· apply coeff_eq_zero_of_natDegree_lt
apply lt_of_le_of_lt ?_ (lt_of_le_of_ne ddf ?_)
Β· exact natDegree_mul_le_of_le βΉ_βΊ βΉ_βΊ
Β· exact ne_comm.mp h
theorem coeff_pow_of_natDegree_le_of_eq_ite' {m n o : β} {a : R} {p : R[X]}
(h_pow : natDegree p β€ n) (h_exp : m * n β€ o) (h_pow_bas : coeff p n = a) :
coeff (p ^ m) o = if o = m * n then a ^ m else 0 := by
split_ifs with h
Β· subst h h_pow_bas
exact coeff_pow_of_natDegree_le βΉ_βΊ
Β· apply coeff_eq_zero_of_natDegree_lt
apply lt_of_le_of_lt ?_ (lt_of_le_of_ne βΉ_βΊ ?_)
Β· exact natDegree_pow_le_of_le m βΉ_βΊ
Β· exact Iff.mp ne_comm h
theorem natDegree_smul_le_of_le {n : β} {a : R} {f : R[X]} (hf : natDegree f β€ n) :
natDegree (a β’ f) β€ n :=
(natDegree_smul_le a f).trans hf
theorem degree_smul_le_of_le {n : β} {a : R} {f : R[X]} (hf : degree f β€ n) :
degree (a β’ f) β€ n :=
(degree_smul_le a f).trans hf
theorem coeff_smul {n : β} {a : R} {f : R[X]} : (a β’ f).coeff n = a * f.coeff n := rfl
section congr_lemmas
theorem natDegree_eq_of_le_of_coeff_ne_zero' {deg m o : β} {c : R} {p : R[X]}
(h_natDeg_le : natDegree p β€ m) (coeff_eq : coeff p o = c)
(coeff_ne_zero : c β 0) (deg_eq_deg : m = deg) (coeff_eq_deg : o = deg) :
natDegree p = deg := by
subst coeff_eq deg_eq_deg coeff_eq_deg
exact natDegree_eq_of_le_of_coeff_ne_zero βΉ_βΊ βΉ_βΊ
| Mathlib/Tactic/ComputeDegree.lean | 157 | 165 | theorem degree_eq_of_le_of_coeff_ne_zero' {deg m o : WithBot β} {c : R} {p : R[X]}
(h_deg_le : degree p β€ m) (coeff_eq : coeff p (WithBot.unbot' 0 deg) = c)
(coeff_ne_zero : c β 0) (deg_eq_deg : m = deg) (coeff_eq_deg : o = deg) :
degree p = deg := by |
subst coeff_eq coeff_eq_deg deg_eq_deg
rcases eq_or_ne m β₯ with rfl|hh
Β· exact bot_unique h_deg_le
Β· obtain β¨m, rflβ© := WithBot.ne_bot_iff_exists.mp hh
exact degree_eq_of_le_of_coeff_ne_zero βΉ_βΊ βΉ_βΊ
| 5 | 148.413159 | 2 | 1.4 | 5 | 1,474 |
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Reflective
#align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open PrimeSpectrum
namespace AlgebraicGeometry
open Opposite
open CategoryTheory
open StructureSheaf
open Spec (structureSheaf)
open TopologicalSpace
open AlgebraicGeometry.LocallyRingedSpace
open TopCat.Presheaf
open TopCat.Presheaf.SheafCondition
namespace LocallyRingedSpace
variable (X : LocallyRingedSpace.{u})
def ΞToStalk (x : X) : Ξ.obj (op X) βΆ X.presheaf.stalk x :=
X.presheaf.germ (β¨x, trivialβ© : (β€ : Opens X))
#align algebraic_geometry.LocallyRingedSpace.Ξ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΞToStalk
def toΞSpecFun : X β PrimeSpectrum (Ξ.obj (op X)) := fun x =>
comap (X.ΞToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x))
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΞSpecFun
| Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean | 77 | 79 | theorem not_mem_prime_iff_unit_in_stalk (r : Ξ.obj (op X)) (x : X) :
r β (X.toΞSpecFun x).asIdeal β IsUnit (X.ΞToStalk x r) := by |
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
| 1 | 2.718282 | 0 | 1.4 | 5 | 1,475 |
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Reflective
#align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open PrimeSpectrum
namespace AlgebraicGeometry
open Opposite
open CategoryTheory
open StructureSheaf
open Spec (structureSheaf)
open TopologicalSpace
open AlgebraicGeometry.LocallyRingedSpace
open TopCat.Presheaf
open TopCat.Presheaf.SheafCondition
namespace LocallyRingedSpace
variable (X : LocallyRingedSpace.{u})
def ΞToStalk (x : X) : Ξ.obj (op X) βΆ X.presheaf.stalk x :=
X.presheaf.germ (β¨x, trivialβ© : (β€ : Opens X))
#align algebraic_geometry.LocallyRingedSpace.Ξ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΞToStalk
def toΞSpecFun : X β PrimeSpectrum (Ξ.obj (op X)) := fun x =>
comap (X.ΞToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x))
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΞSpecFun
theorem not_mem_prime_iff_unit_in_stalk (r : Ξ.obj (op X)) (x : X) :
r β (X.toΞSpecFun x).asIdeal β IsUnit (X.ΞToStalk x r) := by
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
#align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk
| Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean | 84 | 87 | theorem toΞSpec_preim_basicOpen_eq (r : Ξ.obj (op X)) :
X.toΞSpecFun β»ΒΉ' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by |
ext
erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,475 |
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Reflective
#align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open PrimeSpectrum
namespace AlgebraicGeometry
open Opposite
open CategoryTheory
open StructureSheaf
open Spec (structureSheaf)
open TopologicalSpace
open AlgebraicGeometry.LocallyRingedSpace
open TopCat.Presheaf
open TopCat.Presheaf.SheafCondition
namespace LocallyRingedSpace
variable (X : LocallyRingedSpace.{u})
def ΞToStalk (x : X) : Ξ.obj (op X) βΆ X.presheaf.stalk x :=
X.presheaf.germ (β¨x, trivialβ© : (β€ : Opens X))
#align algebraic_geometry.LocallyRingedSpace.Ξ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΞToStalk
def toΞSpecFun : X β PrimeSpectrum (Ξ.obj (op X)) := fun x =>
comap (X.ΞToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x))
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΞSpecFun
theorem not_mem_prime_iff_unit_in_stalk (r : Ξ.obj (op X)) (x : X) :
r β (X.toΞSpecFun x).asIdeal β IsUnit (X.ΞToStalk x r) := by
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
#align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk
theorem toΞSpec_preim_basicOpen_eq (r : Ξ.obj (op X)) :
X.toΞSpecFun β»ΒΉ' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by
ext
erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_preim_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΞSpec_preim_basicOpen_eq
| Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean | 91 | 95 | theorem toΞSpec_continuous : Continuous X.toΞSpecFun := by |
rw [isTopologicalBasis_basic_opens.continuous_iff]
rintro _ β¨r, rflβ©
erw [X.toΞSpec_preim_basicOpen_eq r]
exact (X.toRingedSpace.basicOpen r).2
| 4 | 54.59815 | 2 | 1.4 | 5 | 1,475 |
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Reflective
#align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open PrimeSpectrum
namespace AlgebraicGeometry
open Opposite
open CategoryTheory
open StructureSheaf
open Spec (structureSheaf)
open TopologicalSpace
open AlgebraicGeometry.LocallyRingedSpace
open TopCat.Presheaf
open TopCat.Presheaf.SheafCondition
namespace LocallyRingedSpace
variable (X : LocallyRingedSpace.{u})
def ΞToStalk (x : X) : Ξ.obj (op X) βΆ X.presheaf.stalk x :=
X.presheaf.germ (β¨x, trivialβ© : (β€ : Opens X))
#align algebraic_geometry.LocallyRingedSpace.Ξ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΞToStalk
def toΞSpecFun : X β PrimeSpectrum (Ξ.obj (op X)) := fun x =>
comap (X.ΞToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x))
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΞSpecFun
theorem not_mem_prime_iff_unit_in_stalk (r : Ξ.obj (op X)) (x : X) :
r β (X.toΞSpecFun x).asIdeal β IsUnit (X.ΞToStalk x r) := by
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
#align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk
theorem toΞSpec_preim_basicOpen_eq (r : Ξ.obj (op X)) :
X.toΞSpecFun β»ΒΉ' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by
ext
erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_preim_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΞSpec_preim_basicOpen_eq
theorem toΞSpec_continuous : Continuous X.toΞSpecFun := by
rw [isTopologicalBasis_basic_opens.continuous_iff]
rintro _ β¨r, rflβ©
erw [X.toΞSpec_preim_basicOpen_eq r]
exact (X.toRingedSpace.basicOpen r).2
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_continuous AlgebraicGeometry.LocallyRingedSpace.toΞSpec_continuous
@[simps]
def toΞSpecBase : X.toTopCat βΆ Spec.topObj (Ξ.obj (op X)) where
toFun := X.toΞSpecFun
continuous_toFun := X.toΞSpec_continuous
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_base AlgebraicGeometry.LocallyRingedSpace.toΞSpecBase
-- These lemmas have always been bad (#7657), but lean4#2644 made `simp` start noticing
attribute [nolint simpNF] AlgebraicGeometry.LocallyRingedSpace.toΞSpecBase_apply
variable (r : Ξ.obj (op X))
abbrev toΞSpecMapBasicOpen : Opens X :=
(Opens.map X.toΞSpecBase).obj (basicOpen r)
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toΞSpecMapBasicOpen
theorem toΞSpecMapBasicOpen_eq : X.toΞSpecMapBasicOpen r = X.toRingedSpace.basicOpen r :=
Opens.ext (X.toΞSpec_preim_basicOpen_eq r)
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_map_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΞSpecMapBasicOpen_eq
abbrev toToΞSpecMapBasicOpen :
X.presheaf.obj (op β€) βΆ X.presheaf.obj (op <| X.toΞSpecMapBasicOpen r) :=
X.presheaf.map (X.toΞSpecMapBasicOpen r).leTop.op
#align algebraic_geometry.LocallyRingedSpace.to_to_Ξ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toToΞSpecMapBasicOpen
| Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean | 128 | 134 | theorem isUnit_res_toΞSpecMapBasicOpen : IsUnit (X.toToΞSpecMapBasicOpen r r) := by |
convert
(X.presheaf.map <| (eqToHom <| X.toΞSpecMapBasicOpen_eq r).op).isUnit_map
(X.toRingedSpace.isUnit_res_basicOpen r)
-- Porting note: `rw [comp_apply]` to `erw [comp_apply]`
erw [β comp_apply, β Functor.map_comp]
congr
| 6 | 403.428793 | 2 | 1.4 | 5 | 1,475 |
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Reflective
#align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open PrimeSpectrum
namespace AlgebraicGeometry
open Opposite
open CategoryTheory
open StructureSheaf
open Spec (structureSheaf)
open TopologicalSpace
open AlgebraicGeometry.LocallyRingedSpace
open TopCat.Presheaf
open TopCat.Presheaf.SheafCondition
namespace LocallyRingedSpace
variable (X : LocallyRingedSpace.{u})
def ΞToStalk (x : X) : Ξ.obj (op X) βΆ X.presheaf.stalk x :=
X.presheaf.germ (β¨x, trivialβ© : (β€ : Opens X))
#align algebraic_geometry.LocallyRingedSpace.Ξ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΞToStalk
def toΞSpecFun : X β PrimeSpectrum (Ξ.obj (op X)) := fun x =>
comap (X.ΞToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x))
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΞSpecFun
theorem not_mem_prime_iff_unit_in_stalk (r : Ξ.obj (op X)) (x : X) :
r β (X.toΞSpecFun x).asIdeal β IsUnit (X.ΞToStalk x r) := by
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
#align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk
theorem toΞSpec_preim_basicOpen_eq (r : Ξ.obj (op X)) :
X.toΞSpecFun β»ΒΉ' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by
ext
erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_preim_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΞSpec_preim_basicOpen_eq
theorem toΞSpec_continuous : Continuous X.toΞSpecFun := by
rw [isTopologicalBasis_basic_opens.continuous_iff]
rintro _ β¨r, rflβ©
erw [X.toΞSpec_preim_basicOpen_eq r]
exact (X.toRingedSpace.basicOpen r).2
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_continuous AlgebraicGeometry.LocallyRingedSpace.toΞSpec_continuous
@[simps]
def toΞSpecBase : X.toTopCat βΆ Spec.topObj (Ξ.obj (op X)) where
toFun := X.toΞSpecFun
continuous_toFun := X.toΞSpec_continuous
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_base AlgebraicGeometry.LocallyRingedSpace.toΞSpecBase
-- These lemmas have always been bad (#7657), but lean4#2644 made `simp` start noticing
attribute [nolint simpNF] AlgebraicGeometry.LocallyRingedSpace.toΞSpecBase_apply
variable (r : Ξ.obj (op X))
abbrev toΞSpecMapBasicOpen : Opens X :=
(Opens.map X.toΞSpecBase).obj (basicOpen r)
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toΞSpecMapBasicOpen
theorem toΞSpecMapBasicOpen_eq : X.toΞSpecMapBasicOpen r = X.toRingedSpace.basicOpen r :=
Opens.ext (X.toΞSpec_preim_basicOpen_eq r)
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_map_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΞSpecMapBasicOpen_eq
abbrev toToΞSpecMapBasicOpen :
X.presheaf.obj (op β€) βΆ X.presheaf.obj (op <| X.toΞSpecMapBasicOpen r) :=
X.presheaf.map (X.toΞSpecMapBasicOpen r).leTop.op
#align algebraic_geometry.LocallyRingedSpace.to_to_Ξ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toToΞSpecMapBasicOpen
theorem isUnit_res_toΞSpecMapBasicOpen : IsUnit (X.toToΞSpecMapBasicOpen r r) := by
convert
(X.presheaf.map <| (eqToHom <| X.toΞSpecMapBasicOpen_eq r).op).isUnit_map
(X.toRingedSpace.isUnit_res_basicOpen r)
-- Porting note: `rw [comp_apply]` to `erw [comp_apply]`
erw [β comp_apply, β Functor.map_comp]
congr
#align algebraic_geometry.LocallyRingedSpace.is_unit_res_to_Ξ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.isUnit_res_toΞSpecMapBasicOpen
def toΞSpecCApp :
(structureSheaf <| Ξ.obj <| op X).val.obj (op <| basicOpen r) βΆ
X.presheaf.obj (op <| X.toΞSpecMapBasicOpen r) :=
IsLocalization.Away.lift r (isUnit_res_toΞSpecMapBasicOpen _ r)
#align algebraic_geometry.LocallyRingedSpace.to_Ξ_Spec_c_app AlgebraicGeometry.LocallyRingedSpace.toΞSpecCApp
| Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean | 146 | 160 | theorem toΞSpecCApp_iff
(f :
(structureSheaf <| Ξ.obj <| op X).val.obj (op <| basicOpen r) βΆ
X.presheaf.obj (op <| X.toΞSpecMapBasicOpen r)) :
toOpen _ (basicOpen r) β« f = X.toToΞSpecMapBasicOpen r β f = X.toΞSpecCApp r := by |
-- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp`
-- created instance manually. This replaces the `pick_goal` tactics
have loc_inst := IsLocalization.to_basicOpen (Ξ.obj (op X)) r
rw [β @IsLocalization.Away.AwayMap.lift_comp _ _ _ _ _ _ _ r loc_inst _
(X.isUnit_res_toΞSpecMapBasicOpen r)]
--pick_goal 5; exact is_localization.to_basic_open _ r
constructor
Β· intro h
exact IsLocalization.ringHom_ext (Submonoid.powers r) h
apply congr_arg
| 10 | 22,026.465795 | 2 | 1.4 | 5 | 1,475 |
import Batteries.Data.HashMap.Basic
import Batteries.Data.Array.Lemmas
import Batteries.Data.Nat.Lemmas
namespace Batteries.HashMap
namespace Imp
attribute [-simp] Bool.not_eq_true
namespace Buckets
@[ext] protected theorem ext : β {bβ bβ : Buckets Ξ± Ξ²}, bβ.1.data = bβ.1.data β bβ = bβ
| β¨β¨_β©, _β©, β¨β¨_β©, _β©, rfl => rfl
theorem update_data (self : Buckets Ξ± Ξ²) (i d h) :
(self.update i d h).1.data = self.1.data.set i.toNat d := rfl
| .lake/packages/batteries/Batteries/Data/HashMap/WF.lean | 23 | 27 | theorem exists_of_update (self : Buckets Ξ± Ξ²) (i d h) :
β lβ lβ, self.1.data = lβ ++ self.1[i] :: lβ β§ List.length lβ = i.toNat β§
(self.update i d h).1.data = lβ ++ d :: lβ := by |
simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get]
exact List.exists_of_set' h
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,476 |
import Batteries.Data.HashMap.Basic
import Batteries.Data.Array.Lemmas
import Batteries.Data.Nat.Lemmas
namespace Batteries.HashMap
namespace Imp
attribute [-simp] Bool.not_eq_true
namespace Buckets
@[ext] protected theorem ext : β {bβ bβ : Buckets Ξ± Ξ²}, bβ.1.data = bβ.1.data β bβ = bβ
| β¨β¨_β©, _β©, β¨β¨_β©, _β©, rfl => rfl
theorem update_data (self : Buckets Ξ± Ξ²) (i d h) :
(self.update i d h).1.data = self.1.data.set i.toNat d := rfl
theorem exists_of_update (self : Buckets Ξ± Ξ²) (i d h) :
β lβ lβ, self.1.data = lβ ++ self.1[i] :: lβ β§ List.length lβ = i.toNat β§
(self.update i d h).1.data = lβ ++ d :: lβ := by
simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get]
exact List.exists_of_set' h
| .lake/packages/batteries/Batteries/Data/HashMap/WF.lean | 29 | 33 | theorem update_update (self : Buckets Ξ± Ξ²) (i d d' h h') :
(self.update i d h).update i d' h' = self.update i d' h := by |
simp only [update, Array.uset, Array.data_length]
congr 1
rw [Array.set_set]
| 3 | 20.085537 | 1 | 1.4 | 5 | 1,476 |
import Batteries.Data.HashMap.Basic
import Batteries.Data.Array.Lemmas
import Batteries.Data.Nat.Lemmas
namespace Batteries.HashMap
namespace Imp
attribute [-simp] Bool.not_eq_true
namespace Buckets
@[ext] protected theorem ext : β {bβ bβ : Buckets Ξ± Ξ²}, bβ.1.data = bβ.1.data β bβ = bβ
| β¨β¨_β©, _β©, β¨β¨_β©, _β©, rfl => rfl
theorem update_data (self : Buckets Ξ± Ξ²) (i d h) :
(self.update i d h).1.data = self.1.data.set i.toNat d := rfl
theorem exists_of_update (self : Buckets Ξ± Ξ²) (i d h) :
β lβ lβ, self.1.data = lβ ++ self.1[i] :: lβ β§ List.length lβ = i.toNat β§
(self.update i d h).1.data = lβ ++ d :: lβ := by
simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get]
exact List.exists_of_set' h
theorem update_update (self : Buckets Ξ± Ξ²) (i d d' h h') :
(self.update i d h).update i d' h' = self.update i d' h := by
simp only [update, Array.uset, Array.data_length]
congr 1
rw [Array.set_set]
theorem size_eq (data : Buckets Ξ± Ξ²) :
size data = .sum (data.1.data.map (Β·.toList.length)) := rfl
| .lake/packages/batteries/Batteries/Data/HashMap/WF.lean | 38 | 40 | theorem mk_size (h) : (mk n h : Buckets Ξ± Ξ²).size = 0 := by |
simp only [mk, mkArray, size_eq]; clear h
induction n <;> simp [*]
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,476 |
import Batteries.Data.HashMap.Basic
import Batteries.Data.Array.Lemmas
import Batteries.Data.Nat.Lemmas
namespace Batteries.HashMap
namespace Imp
attribute [-simp] Bool.not_eq_true
namespace Buckets
@[ext] protected theorem ext : β {bβ bβ : Buckets Ξ± Ξ²}, bβ.1.data = bβ.1.data β bβ = bβ
| β¨β¨_β©, _β©, β¨β¨_β©, _β©, rfl => rfl
theorem update_data (self : Buckets Ξ± Ξ²) (i d h) :
(self.update i d h).1.data = self.1.data.set i.toNat d := rfl
theorem exists_of_update (self : Buckets Ξ± Ξ²) (i d h) :
β lβ lβ, self.1.data = lβ ++ self.1[i] :: lβ β§ List.length lβ = i.toNat β§
(self.update i d h).1.data = lβ ++ d :: lβ := by
simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get]
exact List.exists_of_set' h
theorem update_update (self : Buckets Ξ± Ξ²) (i d d' h h') :
(self.update i d h).update i d' h' = self.update i d' h := by
simp only [update, Array.uset, Array.data_length]
congr 1
rw [Array.set_set]
theorem size_eq (data : Buckets Ξ± Ξ²) :
size data = .sum (data.1.data.map (Β·.toList.length)) := rfl
theorem mk_size (h) : (mk n h : Buckets Ξ± Ξ²).size = 0 := by
simp only [mk, mkArray, size_eq]; clear h
induction n <;> simp [*]
| .lake/packages/batteries/Batteries/Data/HashMap/WF.lean | 42 | 46 | theorem WF.mk' [BEq Ξ±] [Hashable Ξ±] (h) : (Buckets.mk n h : Buckets Ξ± Ξ²).WF := by |
refine β¨fun _ h => ?_, fun i h => ?_β©
Β· simp only [Buckets.mk, mkArray, List.mem_replicate, ne_eq] at h
simp [h, List.Pairwise.nil]
Β· simp [Buckets.mk, empty', mkArray, Array.getElem_eq_data_get, AssocList.All]
| 4 | 54.59815 | 2 | 1.4 | 5 | 1,476 |
import Batteries.Data.HashMap.Basic
import Batteries.Data.Array.Lemmas
import Batteries.Data.Nat.Lemmas
namespace Batteries.HashMap
namespace Imp
attribute [-simp] Bool.not_eq_true
namespace Buckets
@[ext] protected theorem ext : β {bβ bβ : Buckets Ξ± Ξ²}, bβ.1.data = bβ.1.data β bβ = bβ
| β¨β¨_β©, _β©, β¨β¨_β©, _β©, rfl => rfl
theorem update_data (self : Buckets Ξ± Ξ²) (i d h) :
(self.update i d h).1.data = self.1.data.set i.toNat d := rfl
theorem exists_of_update (self : Buckets Ξ± Ξ²) (i d h) :
β lβ lβ, self.1.data = lβ ++ self.1[i] :: lβ β§ List.length lβ = i.toNat β§
(self.update i d h).1.data = lβ ++ d :: lβ := by
simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get]
exact List.exists_of_set' h
theorem update_update (self : Buckets Ξ± Ξ²) (i d d' h h') :
(self.update i d h).update i d' h' = self.update i d' h := by
simp only [update, Array.uset, Array.data_length]
congr 1
rw [Array.set_set]
theorem size_eq (data : Buckets Ξ± Ξ²) :
size data = .sum (data.1.data.map (Β·.toList.length)) := rfl
theorem mk_size (h) : (mk n h : Buckets Ξ± Ξ²).size = 0 := by
simp only [mk, mkArray, size_eq]; clear h
induction n <;> simp [*]
theorem WF.mk' [BEq Ξ±] [Hashable Ξ±] (h) : (Buckets.mk n h : Buckets Ξ± Ξ²).WF := by
refine β¨fun _ h => ?_, fun i h => ?_β©
Β· simp only [Buckets.mk, mkArray, List.mem_replicate, ne_eq] at h
simp [h, List.Pairwise.nil]
Β· simp [Buckets.mk, empty', mkArray, Array.getElem_eq_data_get, AssocList.All]
| .lake/packages/batteries/Batteries/Data/HashMap/WF.lean | 48 | 64 | theorem WF.update [BEq Ξ±] [Hashable Ξ±] {buckets : Buckets Ξ± Ξ²} {i d h} (H : buckets.WF)
(hβ : β [PartialEquivBEq Ξ±] [LawfulHashable Ξ±],
(buckets.1[i].toList.Pairwise fun a b => Β¬(a.1 == b.1)) β
d.toList.Pairwise fun a b => Β¬(a.1 == b.1))
(hβ : (buckets.1[i].All fun k _ => ((hash k).toUSize % buckets.1.size).toNat = i.toNat) β
d.All fun k _ => ((hash k).toUSize % buckets.1.size).toNat = i.toNat) :
(buckets.update i d h).WF := by |
refine β¨fun l hl => ?_, fun i hi p hp => ?_β©
Β· exact match List.mem_or_eq_of_mem_set hl with
| .inl hl => H.1 _ hl
| .inr rfl => hβ (H.1 _ (Array.getElem_mem_data ..))
Β· revert hp
simp only [Array.getElem_eq_data_get, update_data, List.get_set, Array.data_length, update_size]
split <;> intro hp
Β· next eq => exact eq βΈ hβ (H.2 _ _) _ hp
Β· simp only [update_size, Array.data_length] at hi
exact H.2 i hi _ hp
| 10 | 22,026.465795 | 2 | 1.4 | 5 | 1,476 |
import Mathlib.Algebra.Homology.Linear
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
import Mathlib.Tactic.Abel
#align_import algebra.homology.homotopy from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Category Limits HomologicalComplex
variable {ΞΉ : Type*}
variable {V : Type u} [Category.{v} V] [Preadditive V]
variable {c : ComplexShape ΞΉ} {C D E : HomologicalComplex V c}
variable (f g : C βΆ D) (h k : D βΆ E) (i : ΞΉ)
section
def dNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => C.d i (c.next i) β« f (c.next i) i) fun _ _ =>
Preadditive.comp_add _ _ _ _ _ _
#align d_next dNext
def fromNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.xNext i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => f (c.next i) i) fun _ _ => rfl
#align from_next fromNext
@[simp]
theorem dNext_eq_dFrom_fromNext (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) :
dNext i f = C.dFrom i β« fromNext i f :=
rfl
#align d_next_eq_d_from_from_next dNext_eq_dFrom_fromNext
| Mathlib/Algebra/Homology/Homotopy.lean | 51 | 54 | theorem dNext_eq (f : β i j, C.X i βΆ D.X j) {i i' : ΞΉ} (w : c.Rel i i') :
dNext i f = C.d i i' β« f i' i := by |
obtain rfl := c.next_eq' w
rfl
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,477 |
import Mathlib.Algebra.Homology.Linear
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
import Mathlib.Tactic.Abel
#align_import algebra.homology.homotopy from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Category Limits HomologicalComplex
variable {ΞΉ : Type*}
variable {V : Type u} [Category.{v} V] [Preadditive V]
variable {c : ComplexShape ΞΉ} {C D E : HomologicalComplex V c}
variable (f g : C βΆ D) (h k : D βΆ E) (i : ΞΉ)
section
def dNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => C.d i (c.next i) β« f (c.next i) i) fun _ _ =>
Preadditive.comp_add _ _ _ _ _ _
#align d_next dNext
def fromNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.xNext i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => f (c.next i) i) fun _ _ => rfl
#align from_next fromNext
@[simp]
theorem dNext_eq_dFrom_fromNext (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) :
dNext i f = C.dFrom i β« fromNext i f :=
rfl
#align d_next_eq_d_from_from_next dNext_eq_dFrom_fromNext
theorem dNext_eq (f : β i j, C.X i βΆ D.X j) {i i' : ΞΉ} (w : c.Rel i i') :
dNext i f = C.d i i' β« f i' i := by
obtain rfl := c.next_eq' w
rfl
#align d_next_eq dNext_eq
lemma dNext_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel i (c.next i)) :
dNext i f = 0 := by
dsimp [dNext]
rw [shape _ _ _ hi, zero_comp]
@[simp 1100]
theorem dNext_comp_left (f : C βΆ D) (g : β i j, D.X i βΆ E.X j) (i : ΞΉ) :
(dNext i fun i j => f.f i β« g i j) = f.f i β« dNext i g :=
(f.comm_assoc _ _ _).symm
#align d_next_comp_left dNext_comp_left
@[simp 1100]
theorem dNext_comp_right (f : β i j, C.X i βΆ D.X j) (g : D βΆ E) (i : ΞΉ) :
(dNext i fun i j => f i j β« g.f j) = dNext i f β« g.f i :=
(assoc _ _ _).symm
#align d_next_comp_right dNext_comp_right
def prevD (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.X j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j) β« D.d (c.prev j) j) fun _ _ =>
Preadditive.add_comp _ _ _ _ _ _
#align prev_d prevD
lemma prevD_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel (c.prev i) i) :
prevD i f = 0 := by
dsimp [prevD]
rw [shape _ _ _ hi, comp_zero]
def toPrev (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.xPrev j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j)) fun _ _ => rfl
#align to_prev toPrev
@[simp]
theorem prevD_eq_toPrev_dTo (f : β i j, C.X i βΆ D.X j) (j : ΞΉ) :
prevD j f = toPrev j f β« D.dTo j :=
rfl
#align prev_d_eq_to_prev_d_to prevD_eq_toPrev_dTo
| Mathlib/Algebra/Homology/Homotopy.lean | 96 | 99 | theorem prevD_eq (f : β i j, C.X i βΆ D.X j) {j j' : ΞΉ} (w : c.Rel j' j) :
prevD j f = f j j' β« D.d j' j := by |
obtain rfl := c.prev_eq' w
rfl
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,477 |
import Mathlib.Algebra.Homology.Linear
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
import Mathlib.Tactic.Abel
#align_import algebra.homology.homotopy from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Category Limits HomologicalComplex
variable {ΞΉ : Type*}
variable {V : Type u} [Category.{v} V] [Preadditive V]
variable {c : ComplexShape ΞΉ} {C D E : HomologicalComplex V c}
variable (f g : C βΆ D) (h k : D βΆ E) (i : ΞΉ)
section
def dNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => C.d i (c.next i) β« f (c.next i) i) fun _ _ =>
Preadditive.comp_add _ _ _ _ _ _
#align d_next dNext
def fromNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.xNext i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => f (c.next i) i) fun _ _ => rfl
#align from_next fromNext
@[simp]
theorem dNext_eq_dFrom_fromNext (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) :
dNext i f = C.dFrom i β« fromNext i f :=
rfl
#align d_next_eq_d_from_from_next dNext_eq_dFrom_fromNext
theorem dNext_eq (f : β i j, C.X i βΆ D.X j) {i i' : ΞΉ} (w : c.Rel i i') :
dNext i f = C.d i i' β« f i' i := by
obtain rfl := c.next_eq' w
rfl
#align d_next_eq dNext_eq
lemma dNext_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel i (c.next i)) :
dNext i f = 0 := by
dsimp [dNext]
rw [shape _ _ _ hi, zero_comp]
@[simp 1100]
theorem dNext_comp_left (f : C βΆ D) (g : β i j, D.X i βΆ E.X j) (i : ΞΉ) :
(dNext i fun i j => f.f i β« g i j) = f.f i β« dNext i g :=
(f.comm_assoc _ _ _).symm
#align d_next_comp_left dNext_comp_left
@[simp 1100]
theorem dNext_comp_right (f : β i j, C.X i βΆ D.X j) (g : D βΆ E) (i : ΞΉ) :
(dNext i fun i j => f i j β« g.f j) = dNext i f β« g.f i :=
(assoc _ _ _).symm
#align d_next_comp_right dNext_comp_right
def prevD (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.X j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j) β« D.d (c.prev j) j) fun _ _ =>
Preadditive.add_comp _ _ _ _ _ _
#align prev_d prevD
lemma prevD_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel (c.prev i) i) :
prevD i f = 0 := by
dsimp [prevD]
rw [shape _ _ _ hi, comp_zero]
def toPrev (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.xPrev j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j)) fun _ _ => rfl
#align to_prev toPrev
@[simp]
theorem prevD_eq_toPrev_dTo (f : β i j, C.X i βΆ D.X j) (j : ΞΉ) :
prevD j f = toPrev j f β« D.dTo j :=
rfl
#align prev_d_eq_to_prev_d_to prevD_eq_toPrev_dTo
theorem prevD_eq (f : β i j, C.X i βΆ D.X j) {j j' : ΞΉ} (w : c.Rel j' j) :
prevD j f = f j j' β« D.d j' j := by
obtain rfl := c.prev_eq' w
rfl
#align prev_d_eq prevD_eq
@[simp 1100]
theorem prevD_comp_left (f : C βΆ D) (g : β i j, D.X i βΆ E.X j) (j : ΞΉ) :
(prevD j fun i j => f.f i β« g i j) = f.f j β« prevD j g :=
assoc _ _ _
#align prev_d_comp_left prevD_comp_left
@[simp 1100]
| Mathlib/Algebra/Homology/Homotopy.lean | 109 | 112 | theorem prevD_comp_right (f : β i j, C.X i βΆ D.X j) (g : D βΆ E) (j : ΞΉ) :
(prevD j fun i j => f i j β« g.f j) = prevD j f β« g.f j := by |
dsimp [prevD]
simp only [assoc, g.comm]
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,477 |
import Mathlib.Algebra.Homology.Linear
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
import Mathlib.Tactic.Abel
#align_import algebra.homology.homotopy from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Category Limits HomologicalComplex
variable {ΞΉ : Type*}
variable {V : Type u} [Category.{v} V] [Preadditive V]
variable {c : ComplexShape ΞΉ} {C D E : HomologicalComplex V c}
variable (f g : C βΆ D) (h k : D βΆ E) (i : ΞΉ)
section
def dNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => C.d i (c.next i) β« f (c.next i) i) fun _ _ =>
Preadditive.comp_add _ _ _ _ _ _
#align d_next dNext
def fromNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.xNext i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => f (c.next i) i) fun _ _ => rfl
#align from_next fromNext
@[simp]
theorem dNext_eq_dFrom_fromNext (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) :
dNext i f = C.dFrom i β« fromNext i f :=
rfl
#align d_next_eq_d_from_from_next dNext_eq_dFrom_fromNext
theorem dNext_eq (f : β i j, C.X i βΆ D.X j) {i i' : ΞΉ} (w : c.Rel i i') :
dNext i f = C.d i i' β« f i' i := by
obtain rfl := c.next_eq' w
rfl
#align d_next_eq dNext_eq
lemma dNext_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel i (c.next i)) :
dNext i f = 0 := by
dsimp [dNext]
rw [shape _ _ _ hi, zero_comp]
@[simp 1100]
theorem dNext_comp_left (f : C βΆ D) (g : β i j, D.X i βΆ E.X j) (i : ΞΉ) :
(dNext i fun i j => f.f i β« g i j) = f.f i β« dNext i g :=
(f.comm_assoc _ _ _).symm
#align d_next_comp_left dNext_comp_left
@[simp 1100]
theorem dNext_comp_right (f : β i j, C.X i βΆ D.X j) (g : D βΆ E) (i : ΞΉ) :
(dNext i fun i j => f i j β« g.f j) = dNext i f β« g.f i :=
(assoc _ _ _).symm
#align d_next_comp_right dNext_comp_right
def prevD (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.X j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j) β« D.d (c.prev j) j) fun _ _ =>
Preadditive.add_comp _ _ _ _ _ _
#align prev_d prevD
lemma prevD_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel (c.prev i) i) :
prevD i f = 0 := by
dsimp [prevD]
rw [shape _ _ _ hi, comp_zero]
def toPrev (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.xPrev j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j)) fun _ _ => rfl
#align to_prev toPrev
@[simp]
theorem prevD_eq_toPrev_dTo (f : β i j, C.X i βΆ D.X j) (j : ΞΉ) :
prevD j f = toPrev j f β« D.dTo j :=
rfl
#align prev_d_eq_to_prev_d_to prevD_eq_toPrev_dTo
theorem prevD_eq (f : β i j, C.X i βΆ D.X j) {j j' : ΞΉ} (w : c.Rel j' j) :
prevD j f = f j j' β« D.d j' j := by
obtain rfl := c.prev_eq' w
rfl
#align prev_d_eq prevD_eq
@[simp 1100]
theorem prevD_comp_left (f : C βΆ D) (g : β i j, D.X i βΆ E.X j) (j : ΞΉ) :
(prevD j fun i j => f.f i β« g i j) = f.f j β« prevD j g :=
assoc _ _ _
#align prev_d_comp_left prevD_comp_left
@[simp 1100]
theorem prevD_comp_right (f : β i j, C.X i βΆ D.X j) (g : D βΆ E) (j : ΞΉ) :
(prevD j fun i j => f i j β« g.f j) = prevD j f β« g.f j := by
dsimp [prevD]
simp only [assoc, g.comm]
#align prev_d_comp_right prevD_comp_right
| Mathlib/Algebra/Homology/Homotopy.lean | 115 | 121 | theorem dNext_nat (C D : ChainComplex V β) (i : β) (f : β i j, C.X i βΆ D.X j) :
dNext i f = C.d i (i - 1) β« f (i - 1) i := by |
dsimp [dNext]
cases i
Β· simp only [shape, ChainComplex.next_nat_zero, ComplexShape.down_Rel, Nat.one_ne_zero,
not_false_iff, zero_comp]
Β· congr <;> simp
| 5 | 148.413159 | 2 | 1.4 | 5 | 1,477 |
import Mathlib.Algebra.Homology.Linear
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
import Mathlib.Tactic.Abel
#align_import algebra.homology.homotopy from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Category Limits HomologicalComplex
variable {ΞΉ : Type*}
variable {V : Type u} [Category.{v} V] [Preadditive V]
variable {c : ComplexShape ΞΉ} {C D E : HomologicalComplex V c}
variable (f g : C βΆ D) (h k : D βΆ E) (i : ΞΉ)
section
def dNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => C.d i (c.next i) β« f (c.next i) i) fun _ _ =>
Preadditive.comp_add _ _ _ _ _ _
#align d_next dNext
def fromNext (i : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.xNext i βΆ D.X i) :=
AddMonoidHom.mk' (fun f => f (c.next i) i) fun _ _ => rfl
#align from_next fromNext
@[simp]
theorem dNext_eq_dFrom_fromNext (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) :
dNext i f = C.dFrom i β« fromNext i f :=
rfl
#align d_next_eq_d_from_from_next dNext_eq_dFrom_fromNext
theorem dNext_eq (f : β i j, C.X i βΆ D.X j) {i i' : ΞΉ} (w : c.Rel i i') :
dNext i f = C.d i i' β« f i' i := by
obtain rfl := c.next_eq' w
rfl
#align d_next_eq dNext_eq
lemma dNext_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel i (c.next i)) :
dNext i f = 0 := by
dsimp [dNext]
rw [shape _ _ _ hi, zero_comp]
@[simp 1100]
theorem dNext_comp_left (f : C βΆ D) (g : β i j, D.X i βΆ E.X j) (i : ΞΉ) :
(dNext i fun i j => f.f i β« g i j) = f.f i β« dNext i g :=
(f.comm_assoc _ _ _).symm
#align d_next_comp_left dNext_comp_left
@[simp 1100]
theorem dNext_comp_right (f : β i j, C.X i βΆ D.X j) (g : D βΆ E) (i : ΞΉ) :
(dNext i fun i j => f i j β« g.f j) = dNext i f β« g.f i :=
(assoc _ _ _).symm
#align d_next_comp_right dNext_comp_right
def prevD (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.X j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j) β« D.d (c.prev j) j) fun _ _ =>
Preadditive.add_comp _ _ _ _ _ _
#align prev_d prevD
lemma prevD_eq_zero (f : β i j, C.X i βΆ D.X j) (i : ΞΉ) (hi : Β¬ c.Rel (c.prev i) i) :
prevD i f = 0 := by
dsimp [prevD]
rw [shape _ _ _ hi, comp_zero]
def toPrev (j : ΞΉ) : (β i j, C.X i βΆ D.X j) β+ (C.X j βΆ D.xPrev j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j)) fun _ _ => rfl
#align to_prev toPrev
@[simp]
theorem prevD_eq_toPrev_dTo (f : β i j, C.X i βΆ D.X j) (j : ΞΉ) :
prevD j f = toPrev j f β« D.dTo j :=
rfl
#align prev_d_eq_to_prev_d_to prevD_eq_toPrev_dTo
theorem prevD_eq (f : β i j, C.X i βΆ D.X j) {j j' : ΞΉ} (w : c.Rel j' j) :
prevD j f = f j j' β« D.d j' j := by
obtain rfl := c.prev_eq' w
rfl
#align prev_d_eq prevD_eq
@[simp 1100]
theorem prevD_comp_left (f : C βΆ D) (g : β i j, D.X i βΆ E.X j) (j : ΞΉ) :
(prevD j fun i j => f.f i β« g i j) = f.f j β« prevD j g :=
assoc _ _ _
#align prev_d_comp_left prevD_comp_left
@[simp 1100]
theorem prevD_comp_right (f : β i j, C.X i βΆ D.X j) (g : D βΆ E) (j : ΞΉ) :
(prevD j fun i j => f i j β« g.f j) = prevD j f β« g.f j := by
dsimp [prevD]
simp only [assoc, g.comm]
#align prev_d_comp_right prevD_comp_right
theorem dNext_nat (C D : ChainComplex V β) (i : β) (f : β i j, C.X i βΆ D.X j) :
dNext i f = C.d i (i - 1) β« f (i - 1) i := by
dsimp [dNext]
cases i
Β· simp only [shape, ChainComplex.next_nat_zero, ComplexShape.down_Rel, Nat.one_ne_zero,
not_false_iff, zero_comp]
Β· congr <;> simp
#align d_next_nat dNext_nat
| Mathlib/Algebra/Homology/Homotopy.lean | 124 | 130 | theorem prevD_nat (C D : CochainComplex V β) (i : β) (f : β i j, C.X i βΆ D.X j) :
prevD i f = f i (i - 1) β« D.d (i - 1) i := by |
dsimp [prevD]
cases i
Β· simp only [shape, CochainComplex.prev_nat_zero, ComplexShape.up_Rel, Nat.one_ne_zero,
not_false_iff, comp_zero]
Β· congr <;> simp
| 5 | 148.413159 | 2 | 1.4 | 5 | 1,477 |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Combinatorics.Enumerative.Composition
#align_import analysis.analytic.composition from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
variable {π : Type*} {E F G H : Type*}
open Filter List
open scoped Topology Classical NNReal ENNReal
section Topological
variable [CommRing π] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]
variable [Module π E] [Module π F] [Module π G]
variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]
namespace FormalMultilinearSeries
variable [TopologicalAddGroup E] [ContinuousConstSMul π E]
variable [TopologicalAddGroup F] [ContinuousConstSMul π F]
variable [TopologicalAddGroup G] [ContinuousConstSMul π G]
def applyComposition (p : FormalMultilinearSeries π E F) {n : β} (c : Composition n) :
(Fin n β E) β Fin c.length β F := fun v i => p (c.blocksFun i) (v β c.embedding i)
#align formal_multilinear_series.apply_composition FormalMultilinearSeries.applyComposition
| Mathlib/Analysis/Analytic/Composition.lean | 106 | 114 | theorem applyComposition_ones (p : FormalMultilinearSeries π E F) (n : β) :
p.applyComposition (Composition.ones n) = fun v i =>
p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by |
funext v i
apply p.congr (Composition.ones_blocksFun _ _)
intro j hjn hj1
obtain rfl : j = 0 := by omega
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk]
| 6 | 403.428793 | 2 | 1.4 | 5 | 1,478 |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Combinatorics.Enumerative.Composition
#align_import analysis.analytic.composition from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
variable {π : Type*} {E F G H : Type*}
open Filter List
open scoped Topology Classical NNReal ENNReal
section Topological
variable [CommRing π] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]
variable [Module π E] [Module π F] [Module π G]
variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]
namespace FormalMultilinearSeries
variable [TopologicalAddGroup E] [ContinuousConstSMul π E]
variable [TopologicalAddGroup F] [ContinuousConstSMul π F]
variable [TopologicalAddGroup G] [ContinuousConstSMul π G]
def applyComposition (p : FormalMultilinearSeries π E F) {n : β} (c : Composition n) :
(Fin n β E) β Fin c.length β F := fun v i => p (c.blocksFun i) (v β c.embedding i)
#align formal_multilinear_series.apply_composition FormalMultilinearSeries.applyComposition
theorem applyComposition_ones (p : FormalMultilinearSeries π E F) (n : β) :
p.applyComposition (Composition.ones n) = fun v i =>
p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by
funext v i
apply p.congr (Composition.ones_blocksFun _ _)
intro j hjn hj1
obtain rfl : j = 0 := by omega
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk]
#align formal_multilinear_series.apply_composition_ones FormalMultilinearSeries.applyComposition_ones
| Mathlib/Analysis/Analytic/Composition.lean | 117 | 127 | theorem applyComposition_single (p : FormalMultilinearSeries π E F) {n : β} (hn : 0 < n)
(v : Fin n β E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by |
ext j
refine p.congr (by simp) fun i hi1 hi2 => ?_
dsimp
congr 1
convert Composition.single_embedding hn β¨i, hi2β© using 1
cases' j with j_val j_property
have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)
congr!
simp
| 9 | 8,103.083928 | 2 | 1.4 | 5 | 1,478 |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Combinatorics.Enumerative.Composition
#align_import analysis.analytic.composition from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
variable {π : Type*} {E F G H : Type*}
open Filter List
open scoped Topology Classical NNReal ENNReal
section Topological
variable [CommRing π] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]
variable [Module π E] [Module π F] [Module π G]
variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]
namespace FormalMultilinearSeries
variable [TopologicalAddGroup E] [ContinuousConstSMul π E]
variable [TopologicalAddGroup F] [ContinuousConstSMul π F]
variable [TopologicalAddGroup G] [ContinuousConstSMul π G]
def applyComposition (p : FormalMultilinearSeries π E F) {n : β} (c : Composition n) :
(Fin n β E) β Fin c.length β F := fun v i => p (c.blocksFun i) (v β c.embedding i)
#align formal_multilinear_series.apply_composition FormalMultilinearSeries.applyComposition
theorem applyComposition_ones (p : FormalMultilinearSeries π E F) (n : β) :
p.applyComposition (Composition.ones n) = fun v i =>
p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by
funext v i
apply p.congr (Composition.ones_blocksFun _ _)
intro j hjn hj1
obtain rfl : j = 0 := by omega
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk]
#align formal_multilinear_series.apply_composition_ones FormalMultilinearSeries.applyComposition_ones
theorem applyComposition_single (p : FormalMultilinearSeries π E F) {n : β} (hn : 0 < n)
(v : Fin n β E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by
ext j
refine p.congr (by simp) fun i hi1 hi2 => ?_
dsimp
congr 1
convert Composition.single_embedding hn β¨i, hi2β© using 1
cases' j with j_val j_property
have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)
congr!
simp
#align formal_multilinear_series.apply_composition_single FormalMultilinearSeries.applyComposition_single
@[simp]
| Mathlib/Analysis/Analytic/Composition.lean | 131 | 134 | theorem removeZero_applyComposition (p : FormalMultilinearSeries π E F) {n : β}
(c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by |
ext v i
simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,478 |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Combinatorics.Enumerative.Composition
#align_import analysis.analytic.composition from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
variable {π : Type*} {E F G H : Type*}
open Filter List
open scoped Topology Classical NNReal ENNReal
section Topological
variable [CommRing π] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]
variable [Module π E] [Module π F] [Module π G]
variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]
namespace FormalMultilinearSeries
variable [TopologicalAddGroup E] [ContinuousConstSMul π E]
variable [TopologicalAddGroup F] [ContinuousConstSMul π F]
variable [TopologicalAddGroup G] [ContinuousConstSMul π G]
def applyComposition (p : FormalMultilinearSeries π E F) {n : β} (c : Composition n) :
(Fin n β E) β Fin c.length β F := fun v i => p (c.blocksFun i) (v β c.embedding i)
#align formal_multilinear_series.apply_composition FormalMultilinearSeries.applyComposition
theorem applyComposition_ones (p : FormalMultilinearSeries π E F) (n : β) :
p.applyComposition (Composition.ones n) = fun v i =>
p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by
funext v i
apply p.congr (Composition.ones_blocksFun _ _)
intro j hjn hj1
obtain rfl : j = 0 := by omega
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk]
#align formal_multilinear_series.apply_composition_ones FormalMultilinearSeries.applyComposition_ones
theorem applyComposition_single (p : FormalMultilinearSeries π E F) {n : β} (hn : 0 < n)
(v : Fin n β E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by
ext j
refine p.congr (by simp) fun i hi1 hi2 => ?_
dsimp
congr 1
convert Composition.single_embedding hn β¨i, hi2β© using 1
cases' j with j_val j_property
have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)
congr!
simp
#align formal_multilinear_series.apply_composition_single FormalMultilinearSeries.applyComposition_single
@[simp]
theorem removeZero_applyComposition (p : FormalMultilinearSeries π E F) {n : β}
(c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by
ext v i
simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]
#align formal_multilinear_series.remove_zero_apply_composition FormalMultilinearSeries.removeZero_applyComposition
| Mathlib/Analysis/Analytic/Composition.lean | 140 | 162 | theorem applyComposition_update (p : FormalMultilinearSeries π E F) {n : β} (c : Composition n)
(j : Fin n) (v : Fin n β E) (z : E) :
p.applyComposition c (Function.update v j z) =
Function.update (p.applyComposition c v) (c.index j)
(p (c.blocksFun (c.index j))
(Function.update (v β c.embedding (c.index j)) (c.invEmbedding j) z)) := by |
ext k
by_cases h : k = c.index j
Β· rw [h]
let r : Fin (c.blocksFun (c.index j)) β Fin n := c.embedding (c.index j)
simp only [Function.update_same]
change p (c.blocksFun (c.index j)) (Function.update v j z β r) = _
let j' := c.invEmbedding j
suffices B : Function.update v j z β r = Function.update (v β r) j' z by rw [B]
suffices C : Function.update v (r j') z β r = Function.update (v β r) j' z by
convert C; exact (c.embedding_comp_inv j).symm
exact Function.update_comp_eq_of_injective _ (c.embedding _).injective _ _
Β· simp only [h, Function.update_eq_self, Function.update_noteq, Ne, not_false_iff]
let r : Fin (c.blocksFun k) β Fin n := c.embedding k
change p (c.blocksFun k) (Function.update v j z β r) = p (c.blocksFun k) (v β r)
suffices B : Function.update v j z β r = v β r by rw [B]
apply Function.update_comp_eq_of_not_mem_range
rwa [c.mem_range_embedding_iff']
| 17 | 24,154,952.753575 | 2 | 1.4 | 5 | 1,478 |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Combinatorics.Enumerative.Composition
#align_import analysis.analytic.composition from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
variable {π : Type*} {E F G H : Type*}
open Filter List
open scoped Topology Classical NNReal ENNReal
section Topological
variable [CommRing π] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]
variable [Module π E] [Module π F] [Module π G]
variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]
namespace FormalMultilinearSeries
variable [TopologicalAddGroup E] [ContinuousConstSMul π E]
variable [TopologicalAddGroup F] [ContinuousConstSMul π F]
variable [TopologicalAddGroup G] [ContinuousConstSMul π G]
def applyComposition (p : FormalMultilinearSeries π E F) {n : β} (c : Composition n) :
(Fin n β E) β Fin c.length β F := fun v i => p (c.blocksFun i) (v β c.embedding i)
#align formal_multilinear_series.apply_composition FormalMultilinearSeries.applyComposition
theorem applyComposition_ones (p : FormalMultilinearSeries π E F) (n : β) :
p.applyComposition (Composition.ones n) = fun v i =>
p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by
funext v i
apply p.congr (Composition.ones_blocksFun _ _)
intro j hjn hj1
obtain rfl : j = 0 := by omega
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk]
#align formal_multilinear_series.apply_composition_ones FormalMultilinearSeries.applyComposition_ones
theorem applyComposition_single (p : FormalMultilinearSeries π E F) {n : β} (hn : 0 < n)
(v : Fin n β E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by
ext j
refine p.congr (by simp) fun i hi1 hi2 => ?_
dsimp
congr 1
convert Composition.single_embedding hn β¨i, hi2β© using 1
cases' j with j_val j_property
have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)
congr!
simp
#align formal_multilinear_series.apply_composition_single FormalMultilinearSeries.applyComposition_single
@[simp]
theorem removeZero_applyComposition (p : FormalMultilinearSeries π E F) {n : β}
(c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by
ext v i
simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]
#align formal_multilinear_series.remove_zero_apply_composition FormalMultilinearSeries.removeZero_applyComposition
theorem applyComposition_update (p : FormalMultilinearSeries π E F) {n : β} (c : Composition n)
(j : Fin n) (v : Fin n β E) (z : E) :
p.applyComposition c (Function.update v j z) =
Function.update (p.applyComposition c v) (c.index j)
(p (c.blocksFun (c.index j))
(Function.update (v β c.embedding (c.index j)) (c.invEmbedding j) z)) := by
ext k
by_cases h : k = c.index j
Β· rw [h]
let r : Fin (c.blocksFun (c.index j)) β Fin n := c.embedding (c.index j)
simp only [Function.update_same]
change p (c.blocksFun (c.index j)) (Function.update v j z β r) = _
let j' := c.invEmbedding j
suffices B : Function.update v j z β r = Function.update (v β r) j' z by rw [B]
suffices C : Function.update v (r j') z β r = Function.update (v β r) j' z by
convert C; exact (c.embedding_comp_inv j).symm
exact Function.update_comp_eq_of_injective _ (c.embedding _).injective _ _
Β· simp only [h, Function.update_eq_self, Function.update_noteq, Ne, not_false_iff]
let r : Fin (c.blocksFun k) β Fin n := c.embedding k
change p (c.blocksFun k) (Function.update v j z β r) = p (c.blocksFun k) (v β r)
suffices B : Function.update v j z β r = v β r by rw [B]
apply Function.update_comp_eq_of_not_mem_range
rwa [c.mem_range_embedding_iff']
#align formal_multilinear_series.apply_composition_update FormalMultilinearSeries.applyComposition_update
@[simp]
| Mathlib/Analysis/Analytic/Composition.lean | 166 | 169 | theorem compContinuousLinearMap_applyComposition {n : β} (p : FormalMultilinearSeries π F G)
(f : E βL[π] F) (c : Composition n) (v : Fin n β E) :
(p.compContinuousLinearMap f).applyComposition c v = p.applyComposition c (f β v) := by |
simp (config := {unfoldPartialApp := true}) [applyComposition]; rfl
| 1 | 2.718282 | 0 | 1.4 | 5 | 1,478 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
| Mathlib/Data/List/Cycle.lean | 54 | 58 | theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by |
cases' xs with z zs
Β· rfl
Β· exact if_neg h
| 3 | 20.085537 | 1 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
| Mathlib/Data/List/Cycle.lean | 62 | 73 | theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by |
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
| 10 | 22,026.465795 | 2 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
#align list.next_or_eq_next_or_of_mem_of_ne List.nextOr_eq_nextOr_of_mem_of_ne
| Mathlib/Data/List/Cycle.lean | 76 | 84 | theorem mem_of_nextOr_ne {xs : List Ξ±} {x d : Ξ±} (h : nextOr xs x d β d) : x β xs := by |
induction' xs with y ys IH
Β· simp at h
cases' ys with z zs
Β· simp at h
Β· by_cases hx : x = y
Β· simp [hx]
Β· rw [nextOr_cons_of_ne _ _ _ _ hx] at h
simpa [hx] using IH h
| 8 | 2,980.957987 | 2 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
#align list.next_or_eq_next_or_of_mem_of_ne List.nextOr_eq_nextOr_of_mem_of_ne
theorem mem_of_nextOr_ne {xs : List Ξ±} {x d : Ξ±} (h : nextOr xs x d β d) : x β xs := by
induction' xs with y ys IH
Β· simp at h
cases' ys with z zs
Β· simp at h
Β· by_cases hx : x = y
Β· simp [hx]
Β· rw [nextOr_cons_of_ne _ _ _ _ hx] at h
simpa [hx] using IH h
#align list.mem_of_next_or_ne List.mem_of_nextOr_ne
| Mathlib/Data/List/Cycle.lean | 87 | 91 | theorem nextOr_concat {xs : List Ξ±} {x : Ξ±} (d : Ξ±) (h : x β xs) : nextOr (xs ++ [x]) x d = d := by |
induction' xs with z zs IH
Β· simp
Β· obtain β¨hz, hzsβ© := not_or.mp (mt mem_cons.2 h)
rw [cons_append, nextOr_cons_of_ne _ _ _ _ hz, IH hzs]
| 4 | 54.59815 | 2 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
#align list.next_or_eq_next_or_of_mem_of_ne List.nextOr_eq_nextOr_of_mem_of_ne
theorem mem_of_nextOr_ne {xs : List Ξ±} {x d : Ξ±} (h : nextOr xs x d β d) : x β xs := by
induction' xs with y ys IH
Β· simp at h
cases' ys with z zs
Β· simp at h
Β· by_cases hx : x = y
Β· simp [hx]
Β· rw [nextOr_cons_of_ne _ _ _ _ hx] at h
simpa [hx] using IH h
#align list.mem_of_next_or_ne List.mem_of_nextOr_ne
theorem nextOr_concat {xs : List Ξ±} {x : Ξ±} (d : Ξ±) (h : x β xs) : nextOr (xs ++ [x]) x d = d := by
induction' xs with z zs IH
Β· simp
Β· obtain β¨hz, hzsβ© := not_or.mp (mt mem_cons.2 h)
rw [cons_append, nextOr_cons_of_ne _ _ _ _ hz, IH hzs]
#align list.next_or_concat List.nextOr_concat
| Mathlib/Data/List/Cycle.lean | 94 | 106 | theorem nextOr_mem {xs : List Ξ±} {x d : Ξ±} (hd : d β xs) : nextOr xs x d β xs := by |
revert hd
suffices β xs' : List Ξ±, (β x β xs, x β xs') β d β xs' β nextOr xs x d β xs' by
exact this xs fun _ => id
intro xs' hxs' hd
induction' xs with y ys ih
Β· exact hd
cases' ys with z zs
Β· exact hd
rw [nextOr]
split_ifs with h
Β· exact hxs' _ (mem_cons_of_mem _ (mem_cons_self _ _))
Β· exact ih fun _ h => hxs' _ (mem_cons_of_mem _ h)
| 12 | 162,754.791419 | 2 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
#align list.next_or_eq_next_or_of_mem_of_ne List.nextOr_eq_nextOr_of_mem_of_ne
theorem mem_of_nextOr_ne {xs : List Ξ±} {x d : Ξ±} (h : nextOr xs x d β d) : x β xs := by
induction' xs with y ys IH
Β· simp at h
cases' ys with z zs
Β· simp at h
Β· by_cases hx : x = y
Β· simp [hx]
Β· rw [nextOr_cons_of_ne _ _ _ _ hx] at h
simpa [hx] using IH h
#align list.mem_of_next_or_ne List.mem_of_nextOr_ne
theorem nextOr_concat {xs : List Ξ±} {x : Ξ±} (d : Ξ±) (h : x β xs) : nextOr (xs ++ [x]) x d = d := by
induction' xs with z zs IH
Β· simp
Β· obtain β¨hz, hzsβ© := not_or.mp (mt mem_cons.2 h)
rw [cons_append, nextOr_cons_of_ne _ _ _ _ hz, IH hzs]
#align list.next_or_concat List.nextOr_concat
theorem nextOr_mem {xs : List Ξ±} {x d : Ξ±} (hd : d β xs) : nextOr xs x d β xs := by
revert hd
suffices β xs' : List Ξ±, (β x β xs, x β xs') β d β xs' β nextOr xs x d β xs' by
exact this xs fun _ => id
intro xs' hxs' hd
induction' xs with y ys ih
Β· exact hd
cases' ys with z zs
Β· exact hd
rw [nextOr]
split_ifs with h
Β· exact hxs' _ (mem_cons_of_mem _ (mem_cons_self _ _))
Β· exact ih fun _ h => hxs' _ (mem_cons_of_mem _ h)
#align list.next_or_mem List.nextOr_mem
def next (l : List Ξ±) (x : Ξ±) (h : x β l) : Ξ± :=
nextOr l x (l.get β¨0, length_pos_of_mem hβ©)
#align list.next List.next
def prev : β l : List Ξ±, β x β l, Ξ±
| [], _, h => by simp at h
| [y], _, _ => y
| y :: z :: xs, x, h =>
if hx : x = y then getLast (z :: xs) (cons_ne_nil _ _)
else if x = z then y else prev (z :: xs) x (by simpa [hx] using h)
#align list.prev List.prev
variable (l : List Ξ±) (x : Ξ±)
@[simp]
theorem next_singleton (x y : Ξ±) (h : x β [y]) : next [y] x h = y :=
rfl
#align list.next_singleton List.next_singleton
@[simp]
theorem prev_singleton (x y : Ξ±) (h : x β [y]) : prev [y] x h = y :=
rfl
#align list.prev_singleton List.prev_singleton
| Mathlib/Data/List/Cycle.lean | 154 | 155 | theorem next_cons_cons_eq' (y z : Ξ±) (h : x β y :: z :: l) (hx : x = y) :
next (y :: z :: l) x h = z := by | rw [next, nextOr, if_pos hx]
| 1 | 2.718282 | 0 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
#align list.next_or_eq_next_or_of_mem_of_ne List.nextOr_eq_nextOr_of_mem_of_ne
theorem mem_of_nextOr_ne {xs : List Ξ±} {x d : Ξ±} (h : nextOr xs x d β d) : x β xs := by
induction' xs with y ys IH
Β· simp at h
cases' ys with z zs
Β· simp at h
Β· by_cases hx : x = y
Β· simp [hx]
Β· rw [nextOr_cons_of_ne _ _ _ _ hx] at h
simpa [hx] using IH h
#align list.mem_of_next_or_ne List.mem_of_nextOr_ne
theorem nextOr_concat {xs : List Ξ±} {x : Ξ±} (d : Ξ±) (h : x β xs) : nextOr (xs ++ [x]) x d = d := by
induction' xs with z zs IH
Β· simp
Β· obtain β¨hz, hzsβ© := not_or.mp (mt mem_cons.2 h)
rw [cons_append, nextOr_cons_of_ne _ _ _ _ hz, IH hzs]
#align list.next_or_concat List.nextOr_concat
theorem nextOr_mem {xs : List Ξ±} {x d : Ξ±} (hd : d β xs) : nextOr xs x d β xs := by
revert hd
suffices β xs' : List Ξ±, (β x β xs, x β xs') β d β xs' β nextOr xs x d β xs' by
exact this xs fun _ => id
intro xs' hxs' hd
induction' xs with y ys ih
Β· exact hd
cases' ys with z zs
Β· exact hd
rw [nextOr]
split_ifs with h
Β· exact hxs' _ (mem_cons_of_mem _ (mem_cons_self _ _))
Β· exact ih fun _ h => hxs' _ (mem_cons_of_mem _ h)
#align list.next_or_mem List.nextOr_mem
def next (l : List Ξ±) (x : Ξ±) (h : x β l) : Ξ± :=
nextOr l x (l.get β¨0, length_pos_of_mem hβ©)
#align list.next List.next
def prev : β l : List Ξ±, β x β l, Ξ±
| [], _, h => by simp at h
| [y], _, _ => y
| y :: z :: xs, x, h =>
if hx : x = y then getLast (z :: xs) (cons_ne_nil _ _)
else if x = z then y else prev (z :: xs) x (by simpa [hx] using h)
#align list.prev List.prev
variable (l : List Ξ±) (x : Ξ±)
@[simp]
theorem next_singleton (x y : Ξ±) (h : x β [y]) : next [y] x h = y :=
rfl
#align list.next_singleton List.next_singleton
@[simp]
theorem prev_singleton (x y : Ξ±) (h : x β [y]) : prev [y] x h = y :=
rfl
#align list.prev_singleton List.prev_singleton
theorem next_cons_cons_eq' (y z : Ξ±) (h : x β y :: z :: l) (hx : x = y) :
next (y :: z :: l) x h = z := by rw [next, nextOr, if_pos hx]
#align list.next_cons_cons_eq' List.next_cons_cons_eq'
@[simp]
theorem next_cons_cons_eq (z : Ξ±) (h : x β x :: z :: l) : next (x :: z :: l) x h = z :=
next_cons_cons_eq' l x x z h rfl
#align list.next_cons_cons_eq List.next_cons_cons_eq
| Mathlib/Data/List/Cycle.lean | 163 | 169 | theorem next_ne_head_ne_getLast (h : x β l) (y : Ξ±) (h : x β y :: l) (hy : x β y)
(hx : x β getLast (y :: l) (cons_ne_nil _ _)) :
next (y :: l) x h = next l x (by simpa [hy] using h) := by |
rw [next, next, nextOr_cons_of_ne _ _ _ _ hy, nextOr_eq_nextOr_of_mem_of_ne]
Β· rwa [getLast_cons] at hx
exact ne_nil_of_mem (by assumption)
Β· rwa [getLast_cons] at hx
| 4 | 54.59815 | 2 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
#align list.next_or_eq_next_or_of_mem_of_ne List.nextOr_eq_nextOr_of_mem_of_ne
theorem mem_of_nextOr_ne {xs : List Ξ±} {x d : Ξ±} (h : nextOr xs x d β d) : x β xs := by
induction' xs with y ys IH
Β· simp at h
cases' ys with z zs
Β· simp at h
Β· by_cases hx : x = y
Β· simp [hx]
Β· rw [nextOr_cons_of_ne _ _ _ _ hx] at h
simpa [hx] using IH h
#align list.mem_of_next_or_ne List.mem_of_nextOr_ne
theorem nextOr_concat {xs : List Ξ±} {x : Ξ±} (d : Ξ±) (h : x β xs) : nextOr (xs ++ [x]) x d = d := by
induction' xs with z zs IH
Β· simp
Β· obtain β¨hz, hzsβ© := not_or.mp (mt mem_cons.2 h)
rw [cons_append, nextOr_cons_of_ne _ _ _ _ hz, IH hzs]
#align list.next_or_concat List.nextOr_concat
theorem nextOr_mem {xs : List Ξ±} {x d : Ξ±} (hd : d β xs) : nextOr xs x d β xs := by
revert hd
suffices β xs' : List Ξ±, (β x β xs, x β xs') β d β xs' β nextOr xs x d β xs' by
exact this xs fun _ => id
intro xs' hxs' hd
induction' xs with y ys ih
Β· exact hd
cases' ys with z zs
Β· exact hd
rw [nextOr]
split_ifs with h
Β· exact hxs' _ (mem_cons_of_mem _ (mem_cons_self _ _))
Β· exact ih fun _ h => hxs' _ (mem_cons_of_mem _ h)
#align list.next_or_mem List.nextOr_mem
def next (l : List Ξ±) (x : Ξ±) (h : x β l) : Ξ± :=
nextOr l x (l.get β¨0, length_pos_of_mem hβ©)
#align list.next List.next
def prev : β l : List Ξ±, β x β l, Ξ±
| [], _, h => by simp at h
| [y], _, _ => y
| y :: z :: xs, x, h =>
if hx : x = y then getLast (z :: xs) (cons_ne_nil _ _)
else if x = z then y else prev (z :: xs) x (by simpa [hx] using h)
#align list.prev List.prev
variable (l : List Ξ±) (x : Ξ±)
@[simp]
theorem next_singleton (x y : Ξ±) (h : x β [y]) : next [y] x h = y :=
rfl
#align list.next_singleton List.next_singleton
@[simp]
theorem prev_singleton (x y : Ξ±) (h : x β [y]) : prev [y] x h = y :=
rfl
#align list.prev_singleton List.prev_singleton
theorem next_cons_cons_eq' (y z : Ξ±) (h : x β y :: z :: l) (hx : x = y) :
next (y :: z :: l) x h = z := by rw [next, nextOr, if_pos hx]
#align list.next_cons_cons_eq' List.next_cons_cons_eq'
@[simp]
theorem next_cons_cons_eq (z : Ξ±) (h : x β x :: z :: l) : next (x :: z :: l) x h = z :=
next_cons_cons_eq' l x x z h rfl
#align list.next_cons_cons_eq List.next_cons_cons_eq
theorem next_ne_head_ne_getLast (h : x β l) (y : Ξ±) (h : x β y :: l) (hy : x β y)
(hx : x β getLast (y :: l) (cons_ne_nil _ _)) :
next (y :: l) x h = next l x (by simpa [hy] using h) := by
rw [next, next, nextOr_cons_of_ne _ _ _ _ hy, nextOr_eq_nextOr_of_mem_of_ne]
Β· rwa [getLast_cons] at hx
exact ne_nil_of_mem (by assumption)
Β· rwa [getLast_cons] at hx
#align list.next_ne_head_ne_last List.next_ne_head_ne_getLast
| Mathlib/Data/List/Cycle.lean | 172 | 177 | theorem next_cons_concat (y : Ξ±) (hy : x β y) (hx : x β l)
(h : x β y :: l ++ [x] := mem_append_right _ (mem_singleton_self x)) :
next (y :: l ++ [x]) x h = y := by |
rw [next, nextOr_concat]
Β· rfl
Β· simp [hy, hx]
| 3 | 20.085537 | 1 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
open List
def Cycle (Ξ± : Type*) : Type _ :=
Quotient (IsRotated.setoid Ξ±)
#align cycle Cycle
namespace Cycle
variable {Ξ± : Type*}
-- Porting note (#11445): new definition
@[coe] def ofList : List Ξ± β Cycle Ξ± :=
Quot.mk _
instance : Coe (List Ξ±) (Cycle Ξ±) :=
β¨ofListβ©
@[simp]
theorem coe_eq_coe {lβ lβ : List Ξ±} : (lβ : Cycle Ξ±) = (lβ : Cycle Ξ±) β lβ ~r lβ :=
@Quotient.eq _ (IsRotated.setoid _) _ _
#align cycle.coe_eq_coe Cycle.coe_eq_coe
@[simp]
theorem mk_eq_coe (l : List Ξ±) : Quot.mk _ l = (l : Cycle Ξ±) :=
rfl
#align cycle.mk_eq_coe Cycle.mk_eq_coe
@[simp]
theorem mk''_eq_coe (l : List Ξ±) : Quotient.mk'' l = (l : Cycle Ξ±) :=
rfl
#align cycle.mk'_eq_coe Cycle.mk''_eq_coe
theorem coe_cons_eq_coe_append (l : List Ξ±) (a : Ξ±) :
(β(a :: l) : Cycle Ξ±) = (β(l ++ [a]) : Cycle Ξ±) :=
Quot.sound β¨1, by rw [rotate_cons_succ, rotate_zero]β©
#align cycle.coe_cons_eq_coe_append Cycle.coe_cons_eq_coe_append
def nil : Cycle Ξ± :=
([] : List Ξ±)
#align cycle.nil Cycle.nil
@[simp]
theorem coe_nil : β([] : List Ξ±) = @nil Ξ± :=
rfl
#align cycle.coe_nil Cycle.coe_nil
@[simp]
theorem coe_eq_nil (l : List Ξ±) : (l : Cycle Ξ±) = nil β l = [] :=
coe_eq_coe.trans isRotated_nil_iff
#align cycle.coe_eq_nil Cycle.coe_eq_nil
instance : EmptyCollection (Cycle Ξ±) :=
β¨nilβ©
@[simp]
theorem empty_eq : β
= @nil Ξ± :=
rfl
#align cycle.empty_eq Cycle.empty_eq
instance : Inhabited (Cycle Ξ±) :=
β¨nilβ©
@[elab_as_elim]
theorem induction_on {C : Cycle Ξ± β Prop} (s : Cycle Ξ±) (H0 : C nil)
(HI : β (a) (l : List Ξ±), C βl β C β(a :: l)) : C s :=
Quotient.inductionOn' s fun l => by
refine List.recOn l ?_ ?_ <;> simp
assumption'
#align cycle.induction_on Cycle.induction_on
def Mem (a : Ξ±) (s : Cycle Ξ±) : Prop :=
Quot.liftOn s (fun l => a β l) fun _ _ e => propext <| e.mem_iff
#align cycle.mem Cycle.Mem
instance : Membership Ξ± (Cycle Ξ±) :=
β¨Memβ©
@[simp]
theorem mem_coe_iff {a : Ξ±} {l : List Ξ±} : a β (βl : Cycle Ξ±) β a β l :=
Iff.rfl
#align cycle.mem_coe_iff Cycle.mem_coe_iff
@[simp]
theorem not_mem_nil : β a, a β @nil Ξ± :=
List.not_mem_nil
#align cycle.not_mem_nil Cycle.not_mem_nil
instance [DecidableEq Ξ±] : DecidableEq (Cycle Ξ±) := fun sβ sβ =>
Quotient.recOnSubsingletonβ' sβ sβ fun _ _ => decidable_of_iff' _ Quotient.eq''
instance [DecidableEq Ξ±] (x : Ξ±) (s : Cycle Ξ±) : Decidable (x β s) :=
Quotient.recOnSubsingleton' s fun l => show Decidable (x β l) from inferInstance
nonrec def reverse (s : Cycle Ξ±) : Cycle Ξ± :=
Quot.map reverse (fun _ _ => IsRotated.reverse) s
#align cycle.reverse Cycle.reverse
@[simp]
theorem reverse_coe (l : List Ξ±) : (l : Cycle Ξ±).reverse = l.reverse :=
rfl
#align cycle.reverse_coe Cycle.reverse_coe
@[simp]
theorem mem_reverse_iff {a : Ξ±} {s : Cycle Ξ±} : a β s.reverse β a β s :=
Quot.inductionOn s fun _ => mem_reverse
#align cycle.mem_reverse_iff Cycle.mem_reverse_iff
@[simp]
theorem reverse_reverse (s : Cycle Ξ±) : s.reverse.reverse = s :=
Quot.inductionOn s fun _ => by simp
#align cycle.reverse_reverse Cycle.reverse_reverse
@[simp]
theorem reverse_nil : nil.reverse = @nil Ξ± :=
rfl
#align cycle.reverse_nil Cycle.reverse_nil
def length (s : Cycle Ξ±) : β :=
Quot.liftOn s List.length fun _ _ e => e.perm.length_eq
#align cycle.length Cycle.length
@[simp]
theorem length_coe (l : List Ξ±) : length (l : Cycle Ξ±) = l.length :=
rfl
#align cycle.length_coe Cycle.length_coe
@[simp]
theorem length_nil : length (@nil Ξ±) = 0 :=
rfl
#align cycle.length_nil Cycle.length_nil
@[simp]
theorem length_reverse (s : Cycle Ξ±) : s.reverse.length = s.length :=
Quot.inductionOn s List.length_reverse
#align cycle.length_reverse Cycle.length_reverse
def Subsingleton (s : Cycle Ξ±) : Prop :=
s.length β€ 1
#align cycle.subsingleton Cycle.Subsingleton
theorem subsingleton_nil : Subsingleton (@nil Ξ±) := Nat.zero_le _
#align cycle.subsingleton_nil Cycle.subsingleton_nil
theorem length_subsingleton_iff {s : Cycle Ξ±} : Subsingleton s β length s β€ 1 :=
Iff.rfl
#align cycle.length_subsingleton_iff Cycle.length_subsingleton_iff
@[simp]
| Mathlib/Data/List/Cycle.lean | 601 | 602 | theorem subsingleton_reverse_iff {s : Cycle Ξ±} : s.reverse.Subsingleton β s.Subsingleton := by |
simp [length_subsingleton_iff]
| 1 | 2.718282 | 0 | 1.4 | 10 | 1,479 |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
open List
def Cycle (Ξ± : Type*) : Type _ :=
Quotient (IsRotated.setoid Ξ±)
#align cycle Cycle
namespace Cycle
variable {Ξ± : Type*}
-- Porting note (#11445): new definition
@[coe] def ofList : List Ξ± β Cycle Ξ± :=
Quot.mk _
instance : Coe (List Ξ±) (Cycle Ξ±) :=
β¨ofListβ©
@[simp]
theorem coe_eq_coe {lβ lβ : List Ξ±} : (lβ : Cycle Ξ±) = (lβ : Cycle Ξ±) β lβ ~r lβ :=
@Quotient.eq _ (IsRotated.setoid _) _ _
#align cycle.coe_eq_coe Cycle.coe_eq_coe
@[simp]
theorem mk_eq_coe (l : List Ξ±) : Quot.mk _ l = (l : Cycle Ξ±) :=
rfl
#align cycle.mk_eq_coe Cycle.mk_eq_coe
@[simp]
theorem mk''_eq_coe (l : List Ξ±) : Quotient.mk'' l = (l : Cycle Ξ±) :=
rfl
#align cycle.mk'_eq_coe Cycle.mk''_eq_coe
theorem coe_cons_eq_coe_append (l : List Ξ±) (a : Ξ±) :
(β(a :: l) : Cycle Ξ±) = (β(l ++ [a]) : Cycle Ξ±) :=
Quot.sound β¨1, by rw [rotate_cons_succ, rotate_zero]β©
#align cycle.coe_cons_eq_coe_append Cycle.coe_cons_eq_coe_append
def nil : Cycle Ξ± :=
([] : List Ξ±)
#align cycle.nil Cycle.nil
@[simp]
theorem coe_nil : β([] : List Ξ±) = @nil Ξ± :=
rfl
#align cycle.coe_nil Cycle.coe_nil
@[simp]
theorem coe_eq_nil (l : List Ξ±) : (l : Cycle Ξ±) = nil β l = [] :=
coe_eq_coe.trans isRotated_nil_iff
#align cycle.coe_eq_nil Cycle.coe_eq_nil
instance : EmptyCollection (Cycle Ξ±) :=
β¨nilβ©
@[simp]
theorem empty_eq : β
= @nil Ξ± :=
rfl
#align cycle.empty_eq Cycle.empty_eq
instance : Inhabited (Cycle Ξ±) :=
β¨nilβ©
@[elab_as_elim]
theorem induction_on {C : Cycle Ξ± β Prop} (s : Cycle Ξ±) (H0 : C nil)
(HI : β (a) (l : List Ξ±), C βl β C β(a :: l)) : C s :=
Quotient.inductionOn' s fun l => by
refine List.recOn l ?_ ?_ <;> simp
assumption'
#align cycle.induction_on Cycle.induction_on
def Mem (a : Ξ±) (s : Cycle Ξ±) : Prop :=
Quot.liftOn s (fun l => a β l) fun _ _ e => propext <| e.mem_iff
#align cycle.mem Cycle.Mem
instance : Membership Ξ± (Cycle Ξ±) :=
β¨Memβ©
@[simp]
theorem mem_coe_iff {a : Ξ±} {l : List Ξ±} : a β (βl : Cycle Ξ±) β a β l :=
Iff.rfl
#align cycle.mem_coe_iff Cycle.mem_coe_iff
@[simp]
theorem not_mem_nil : β a, a β @nil Ξ± :=
List.not_mem_nil
#align cycle.not_mem_nil Cycle.not_mem_nil
instance [DecidableEq Ξ±] : DecidableEq (Cycle Ξ±) := fun sβ sβ =>
Quotient.recOnSubsingletonβ' sβ sβ fun _ _ => decidable_of_iff' _ Quotient.eq''
instance [DecidableEq Ξ±] (x : Ξ±) (s : Cycle Ξ±) : Decidable (x β s) :=
Quotient.recOnSubsingleton' s fun l => show Decidable (x β l) from inferInstance
nonrec def reverse (s : Cycle Ξ±) : Cycle Ξ± :=
Quot.map reverse (fun _ _ => IsRotated.reverse) s
#align cycle.reverse Cycle.reverse
@[simp]
theorem reverse_coe (l : List Ξ±) : (l : Cycle Ξ±).reverse = l.reverse :=
rfl
#align cycle.reverse_coe Cycle.reverse_coe
@[simp]
theorem mem_reverse_iff {a : Ξ±} {s : Cycle Ξ±} : a β s.reverse β a β s :=
Quot.inductionOn s fun _ => mem_reverse
#align cycle.mem_reverse_iff Cycle.mem_reverse_iff
@[simp]
theorem reverse_reverse (s : Cycle Ξ±) : s.reverse.reverse = s :=
Quot.inductionOn s fun _ => by simp
#align cycle.reverse_reverse Cycle.reverse_reverse
@[simp]
theorem reverse_nil : nil.reverse = @nil Ξ± :=
rfl
#align cycle.reverse_nil Cycle.reverse_nil
def length (s : Cycle Ξ±) : β :=
Quot.liftOn s List.length fun _ _ e => e.perm.length_eq
#align cycle.length Cycle.length
@[simp]
theorem length_coe (l : List Ξ±) : length (l : Cycle Ξ±) = l.length :=
rfl
#align cycle.length_coe Cycle.length_coe
@[simp]
theorem length_nil : length (@nil Ξ±) = 0 :=
rfl
#align cycle.length_nil Cycle.length_nil
@[simp]
theorem length_reverse (s : Cycle Ξ±) : s.reverse.length = s.length :=
Quot.inductionOn s List.length_reverse
#align cycle.length_reverse Cycle.length_reverse
def Subsingleton (s : Cycle Ξ±) : Prop :=
s.length β€ 1
#align cycle.subsingleton Cycle.Subsingleton
theorem subsingleton_nil : Subsingleton (@nil Ξ±) := Nat.zero_le _
#align cycle.subsingleton_nil Cycle.subsingleton_nil
theorem length_subsingleton_iff {s : Cycle Ξ±} : Subsingleton s β length s β€ 1 :=
Iff.rfl
#align cycle.length_subsingleton_iff Cycle.length_subsingleton_iff
@[simp]
theorem subsingleton_reverse_iff {s : Cycle Ξ±} : s.reverse.Subsingleton β s.Subsingleton := by
simp [length_subsingleton_iff]
#align cycle.subsingleton_reverse_iff Cycle.subsingleton_reverse_iff
| Mathlib/Data/List/Cycle.lean | 605 | 610 | theorem Subsingleton.congr {s : Cycle Ξ±} (h : Subsingleton s) :
β β¦xβ¦ (_hx : x β s) β¦yβ¦ (_hy : y β s), x = y := by |
induction' s using Quot.inductionOn with l
simp only [length_subsingleton_iff, length_coe, mk_eq_coe, le_iff_lt_or_eq, Nat.lt_add_one_iff,
length_eq_zero, length_eq_one, Nat.not_lt_zero, false_or_iff] at h
rcases h with (rfl | β¨z, rflβ©) <;> simp
| 4 | 54.59815 | 2 | 1.4 | 10 | 1,479 |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Data.Finset.Pointwise
import Mathlib.Tactic.GCongr
#align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd"
open Nat
open NNRat Pointwise
namespace Finset
variable {Ξ± : Type*} [CommGroup Ξ±] [DecidableEq Ξ±] {A B C : Finset Ξ±}
@[to_additive card_sub_mul_le_card_sub_mul_card_sub
"**Ruzsa's triangle inequality**. Subtraction version."]
| Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean | 45 | 56 | theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A / B).card * (B / C).card := by |
rw [β card_product (A / B), β mul_one ((A / B) ΓΛ’ (B / C)).card]
refine card_mul_le_card_mul (fun b ac β¦ ac.1 * ac.2 = b) (fun x hx β¦ ?_)
fun x _ β¦ card_le_one_iff.2 fun hu hv β¦
((mem_bipartiteBelow _).1 hu).2.symm.trans ?_
obtain β¨a, ha, c, hc, rflβ© := mem_div.1 hx
refine card_le_card_of_inj_on (fun b β¦ (a / b, b / c)) (fun b hb β¦ ?_) fun bβ _ bβ _ h β¦ ?_
Β· rw [mem_bipartiteAbove]
exact β¨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _β©
Β· exact div_right_injective (Prod.ext_iff.1 h).1
Β· exact ((mem_bipartiteBelow _).1 hv).2
| 10 | 22,026.465795 | 2 | 1.4 | 5 | 1,480 |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Data.Finset.Pointwise
import Mathlib.Tactic.GCongr
#align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd"
open Nat
open NNRat Pointwise
namespace Finset
variable {Ξ± : Type*} [CommGroup Ξ±] [DecidableEq Ξ±] {A B C : Finset Ξ±}
@[to_additive card_sub_mul_le_card_sub_mul_card_sub
"**Ruzsa's triangle inequality**. Subtraction version."]
theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A / B).card * (B / C).card := by
rw [β card_product (A / B), β mul_one ((A / B) ΓΛ’ (B / C)).card]
refine card_mul_le_card_mul (fun b ac β¦ ac.1 * ac.2 = b) (fun x hx β¦ ?_)
fun x _ β¦ card_le_one_iff.2 fun hu hv β¦
((mem_bipartiteBelow _).1 hu).2.symm.trans ?_
obtain β¨a, ha, c, hc, rflβ© := mem_div.1 hx
refine card_le_card_of_inj_on (fun b β¦ (a / b, b / c)) (fun b hb β¦ ?_) fun bβ _ bβ _ h β¦ ?_
Β· rw [mem_bipartiteAbove]
exact β¨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _β©
Β· exact div_right_injective (Prod.ext_iff.1 h).1
Β· exact ((mem_bipartiteBelow _).1 hv).2
#align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div
#align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub
@[to_additive card_sub_mul_le_card_add_mul_card_add
"**Ruzsa's triangle inequality**. Sub-add-add version."]
| Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean | 63 | 66 | theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A * B).card * (B * C).card := by |
rw [β div_inv_eq_mul, β card_inv B, β card_inv (B * C), mul_inv, β div_eq_mul_inv]
exact card_div_mul_le_card_div_mul_card_div _ _ _
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,480 |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Data.Finset.Pointwise
import Mathlib.Tactic.GCongr
#align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd"
open Nat
open NNRat Pointwise
namespace Finset
variable {Ξ± : Type*} [CommGroup Ξ±] [DecidableEq Ξ±] {A B C : Finset Ξ±}
@[to_additive card_sub_mul_le_card_sub_mul_card_sub
"**Ruzsa's triangle inequality**. Subtraction version."]
theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A / B).card * (B / C).card := by
rw [β card_product (A / B), β mul_one ((A / B) ΓΛ’ (B / C)).card]
refine card_mul_le_card_mul (fun b ac β¦ ac.1 * ac.2 = b) (fun x hx β¦ ?_)
fun x _ β¦ card_le_one_iff.2 fun hu hv β¦
((mem_bipartiteBelow _).1 hu).2.symm.trans ?_
obtain β¨a, ha, c, hc, rflβ© := mem_div.1 hx
refine card_le_card_of_inj_on (fun b β¦ (a / b, b / c)) (fun b hb β¦ ?_) fun bβ _ bβ _ h β¦ ?_
Β· rw [mem_bipartiteAbove]
exact β¨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _β©
Β· exact div_right_injective (Prod.ext_iff.1 h).1
Β· exact ((mem_bipartiteBelow _).1 hv).2
#align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div
#align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub
@[to_additive card_sub_mul_le_card_add_mul_card_add
"**Ruzsa's triangle inequality**. Sub-add-add version."]
theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A * B).card * (B * C).card := by
rw [β div_inv_eq_mul, β card_inv B, β card_inv (B * C), mul_inv, β div_eq_mul_inv]
exact card_div_mul_le_card_div_mul_card_div _ _ _
#align finset.card_div_mul_le_card_mul_mul_card_mul Finset.card_div_mul_le_card_mul_mul_card_mul
#align finset.card_sub_mul_le_card_add_mul_card_add Finset.card_sub_mul_le_card_add_mul_card_add
@[to_additive card_add_mul_le_card_sub_mul_card_add
"**Ruzsa's triangle inequality**. Add-sub-sub version."]
| Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean | 73 | 76 | theorem card_mul_mul_le_card_div_mul_card_mul (A B C : Finset Ξ±) :
(A * C).card * B.card β€ (A / B).card * (B * C).card := by |
rw [β div_inv_eq_mul, β div_inv_eq_mul B]
exact card_div_mul_le_card_div_mul_card_div _ _ _
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,480 |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Data.Finset.Pointwise
import Mathlib.Tactic.GCongr
#align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd"
open Nat
open NNRat Pointwise
namespace Finset
variable {Ξ± : Type*} [CommGroup Ξ±] [DecidableEq Ξ±] {A B C : Finset Ξ±}
@[to_additive card_sub_mul_le_card_sub_mul_card_sub
"**Ruzsa's triangle inequality**. Subtraction version."]
theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A / B).card * (B / C).card := by
rw [β card_product (A / B), β mul_one ((A / B) ΓΛ’ (B / C)).card]
refine card_mul_le_card_mul (fun b ac β¦ ac.1 * ac.2 = b) (fun x hx β¦ ?_)
fun x _ β¦ card_le_one_iff.2 fun hu hv β¦
((mem_bipartiteBelow _).1 hu).2.symm.trans ?_
obtain β¨a, ha, c, hc, rflβ© := mem_div.1 hx
refine card_le_card_of_inj_on (fun b β¦ (a / b, b / c)) (fun b hb β¦ ?_) fun bβ _ bβ _ h β¦ ?_
Β· rw [mem_bipartiteAbove]
exact β¨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _β©
Β· exact div_right_injective (Prod.ext_iff.1 h).1
Β· exact ((mem_bipartiteBelow _).1 hv).2
#align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div
#align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub
@[to_additive card_sub_mul_le_card_add_mul_card_add
"**Ruzsa's triangle inequality**. Sub-add-add version."]
theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A * B).card * (B * C).card := by
rw [β div_inv_eq_mul, β card_inv B, β card_inv (B * C), mul_inv, β div_eq_mul_inv]
exact card_div_mul_le_card_div_mul_card_div _ _ _
#align finset.card_div_mul_le_card_mul_mul_card_mul Finset.card_div_mul_le_card_mul_mul_card_mul
#align finset.card_sub_mul_le_card_add_mul_card_add Finset.card_sub_mul_le_card_add_mul_card_add
@[to_additive card_add_mul_le_card_sub_mul_card_add
"**Ruzsa's triangle inequality**. Add-sub-sub version."]
theorem card_mul_mul_le_card_div_mul_card_mul (A B C : Finset Ξ±) :
(A * C).card * B.card β€ (A / B).card * (B * C).card := by
rw [β div_inv_eq_mul, β div_inv_eq_mul B]
exact card_div_mul_le_card_div_mul_card_div _ _ _
#align finset.card_mul_mul_le_card_div_mul_card_mul Finset.card_mul_mul_le_card_div_mul_card_mul
#align finset.card_add_mul_le_card_sub_mul_card_add Finset.card_add_mul_le_card_sub_mul_card_add
@[to_additive card_add_mul_le_card_add_mul_card_sub
"**Ruzsa's triangle inequality**. Add-add-sub version."]
| Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean | 83 | 86 | theorem card_mul_mul_le_card_mul_mul_card_div (A B C : Finset Ξ±) :
(A * C).card * B.card β€ (A * B).card * (B / C).card := by |
rw [β div_inv_eq_mul, div_eq_mul_inv B]
exact card_div_mul_le_card_mul_mul_card_mul _ _ _
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,480 |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Data.Finset.Pointwise
import Mathlib.Tactic.GCongr
#align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd"
open Nat
open NNRat Pointwise
namespace Finset
variable {Ξ± : Type*} [CommGroup Ξ±] [DecidableEq Ξ±] {A B C : Finset Ξ±}
@[to_additive card_sub_mul_le_card_sub_mul_card_sub
"**Ruzsa's triangle inequality**. Subtraction version."]
theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A / B).card * (B / C).card := by
rw [β card_product (A / B), β mul_one ((A / B) ΓΛ’ (B / C)).card]
refine card_mul_le_card_mul (fun b ac β¦ ac.1 * ac.2 = b) (fun x hx β¦ ?_)
fun x _ β¦ card_le_one_iff.2 fun hu hv β¦
((mem_bipartiteBelow _).1 hu).2.symm.trans ?_
obtain β¨a, ha, c, hc, rflβ© := mem_div.1 hx
refine card_le_card_of_inj_on (fun b β¦ (a / b, b / c)) (fun b hb β¦ ?_) fun bβ _ bβ _ h β¦ ?_
Β· rw [mem_bipartiteAbove]
exact β¨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _β©
Β· exact div_right_injective (Prod.ext_iff.1 h).1
Β· exact ((mem_bipartiteBelow _).1 hv).2
#align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div
#align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub
@[to_additive card_sub_mul_le_card_add_mul_card_add
"**Ruzsa's triangle inequality**. Sub-add-add version."]
theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset Ξ±) :
(A / C).card * B.card β€ (A * B).card * (B * C).card := by
rw [β div_inv_eq_mul, β card_inv B, β card_inv (B * C), mul_inv, β div_eq_mul_inv]
exact card_div_mul_le_card_div_mul_card_div _ _ _
#align finset.card_div_mul_le_card_mul_mul_card_mul Finset.card_div_mul_le_card_mul_mul_card_mul
#align finset.card_sub_mul_le_card_add_mul_card_add Finset.card_sub_mul_le_card_add_mul_card_add
@[to_additive card_add_mul_le_card_sub_mul_card_add
"**Ruzsa's triangle inequality**. Add-sub-sub version."]
theorem card_mul_mul_le_card_div_mul_card_mul (A B C : Finset Ξ±) :
(A * C).card * B.card β€ (A / B).card * (B * C).card := by
rw [β div_inv_eq_mul, β div_inv_eq_mul B]
exact card_div_mul_le_card_div_mul_card_div _ _ _
#align finset.card_mul_mul_le_card_div_mul_card_mul Finset.card_mul_mul_le_card_div_mul_card_mul
#align finset.card_add_mul_le_card_sub_mul_card_add Finset.card_add_mul_le_card_sub_mul_card_add
@[to_additive card_add_mul_le_card_add_mul_card_sub
"**Ruzsa's triangle inequality**. Add-add-sub version."]
theorem card_mul_mul_le_card_mul_mul_card_div (A B C : Finset Ξ±) :
(A * C).card * B.card β€ (A * B).card * (B / C).card := by
rw [β div_inv_eq_mul, div_eq_mul_inv B]
exact card_div_mul_le_card_mul_mul_card_mul _ _ _
#align finset.card_mul_mul_le_card_mul_mul_card_div Finset.card_mul_mul_le_card_mul_mul_card_div
#align finset.card_add_mul_le_card_add_mul_card_sub Finset.card_add_mul_le_card_add_mul_card_sub
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
@[to_additive]
| Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean | 92 | 118 | theorem mul_pluennecke_petridis (C : Finset Ξ±)
(hA : β A' β A, (A * B).card * A'.card β€ (A' * B).card * A.card) :
(A * B * C).card * A.card β€ (A * B).card * (A * C).card := by |
induction' C using Finset.induction_on with x C _ ih
Β· simp
set A' := A β© (A * C / {x}) with hA'
set C' := insert x C with hC'
have hβ : A' * {x} = A * {x} β© (A * C) := by
rw [hA', inter_mul_singleton, (isUnit_singleton x).div_mul_cancel]
have hβ : A * B * C' = A * B * C βͺ (A * B * {x}) \ (A' * B * {x}) := by
rw [hC', insert_eq, union_comm, mul_union]
refine (sup_sdiff_eq_sup ?_).symm
rw [mul_right_comm, mul_right_comm A, hβ]
exact mul_subset_mul_right inter_subset_right
have hβ : A' * B * {x} β A * B * {x} :=
mul_subset_mul_right (mul_subset_mul_right inter_subset_left)
have hβ : (A * B * C').card β€ (A * B * C).card + (A * B).card - (A' * B).card := by
rw [hβ]
refine (card_union_le _ _).trans_eq ?_
rw [card_sdiff hβ, β add_tsub_assoc_of_le (card_le_card hβ), card_mul_singleton,
card_mul_singleton]
refine (mul_le_mul_right' hβ _).trans ?_
rw [tsub_mul, add_mul]
refine (tsub_le_tsub (add_le_add_right ih _) <| hA _ inter_subset_left).trans_eq ?_
rw [β mul_add, β mul_tsub, β hA', hC', insert_eq, mul_union, β card_mul_singleton A x, β
card_mul_singleton A' x, add_comm (card _), hβ,
eq_tsub_of_add_eq (card_union_add_card_inter _ _)]
| 24 | 26,489,122,129.84347 | 2 | 1.4 | 5 | 1,480 |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FormalMultilinearSeries
#align_import analysis.calculus.cont_diff_def from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
noncomputable section
open scoped Classical
open NNReal Topology Filter
local notation "β" => (β€ : ββ)
open Set Fin Filter Function
universe u uE uF uG uX
variable {π : Type u} [NontriviallyNormedField π] {E : Type uE} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace π F] {G : Type uG}
[NormedAddCommGroup G] [NormedSpace π G] {X : Type uX} [NormedAddCommGroup X] [NormedSpace π X]
{s sβ t u : Set E} {f fβ : E β F} {g : F β G} {x xβ : E} {c : F} {m n : ββ}
{p : E β FormalMultilinearSeries π E F}
structure HasFTaylorSeriesUpToOn (n : ββ) (f : E β F) (p : E β FormalMultilinearSeries π E F)
(s : Set E) : Prop where
zero_eq : β x β s, (p x 0).uncurry0 = f x
protected fderivWithin : β m : β, (m : ββ) < n β β x β s,
HasFDerivWithinAt (p Β· m) (p x m.succ).curryLeft s x
cont : β m : β, (m : ββ) β€ n β ContinuousOn (p Β· m) s
#align has_ftaylor_series_up_to_on HasFTaylorSeriesUpToOn
| Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 196 | 199 | theorem HasFTaylorSeriesUpToOn.zero_eq' (h : HasFTaylorSeriesUpToOn n f p s) {x : E} (hx : x β s) :
p x 0 = (continuousMultilinearCurryFin0 π E F).symm (f x) := by |
rw [β h.zero_eq x hx]
exact (p x 0).uncurry0_curry0.symm
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,481 |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FormalMultilinearSeries
#align_import analysis.calculus.cont_diff_def from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
noncomputable section
open scoped Classical
open NNReal Topology Filter
local notation "β" => (β€ : ββ)
open Set Fin Filter Function
universe u uE uF uG uX
variable {π : Type u} [NontriviallyNormedField π] {E : Type uE} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace π F] {G : Type uG}
[NormedAddCommGroup G] [NormedSpace π G] {X : Type uX} [NormedAddCommGroup X] [NormedSpace π X]
{s sβ t u : Set E} {f fβ : E β F} {g : F β G} {x xβ : E} {c : F} {m n : ββ}
{p : E β FormalMultilinearSeries π E F}
structure HasFTaylorSeriesUpToOn (n : ββ) (f : E β F) (p : E β FormalMultilinearSeries π E F)
(s : Set E) : Prop where
zero_eq : β x β s, (p x 0).uncurry0 = f x
protected fderivWithin : β m : β, (m : ββ) < n β β x β s,
HasFDerivWithinAt (p Β· m) (p x m.succ).curryLeft s x
cont : β m : β, (m : ββ) β€ n β ContinuousOn (p Β· m) s
#align has_ftaylor_series_up_to_on HasFTaylorSeriesUpToOn
theorem HasFTaylorSeriesUpToOn.zero_eq' (h : HasFTaylorSeriesUpToOn n f p s) {x : E} (hx : x β s) :
p x 0 = (continuousMultilinearCurryFin0 π E F).symm (f x) := by
rw [β h.zero_eq x hx]
exact (p x 0).uncurry0_curry0.symm
#align has_ftaylor_series_up_to_on.zero_eq' HasFTaylorSeriesUpToOn.zero_eq'
| Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 204 | 208 | theorem HasFTaylorSeriesUpToOn.congr (h : HasFTaylorSeriesUpToOn n f p s)
(hβ : β x β s, fβ x = f x) : HasFTaylorSeriesUpToOn n fβ p s := by |
refine β¨fun x hx => ?_, h.fderivWithin, h.contβ©
rw [hβ x hx]
exact h.zero_eq x hx
| 3 | 20.085537 | 1 | 1.4 | 5 | 1,481 |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FormalMultilinearSeries
#align_import analysis.calculus.cont_diff_def from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
noncomputable section
open scoped Classical
open NNReal Topology Filter
local notation "β" => (β€ : ββ)
open Set Fin Filter Function
universe u uE uF uG uX
variable {π : Type u} [NontriviallyNormedField π] {E : Type uE} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace π F] {G : Type uG}
[NormedAddCommGroup G] [NormedSpace π G] {X : Type uX} [NormedAddCommGroup X] [NormedSpace π X]
{s sβ t u : Set E} {f fβ : E β F} {g : F β G} {x xβ : E} {c : F} {m n : ββ}
{p : E β FormalMultilinearSeries π E F}
structure HasFTaylorSeriesUpToOn (n : ββ) (f : E β F) (p : E β FormalMultilinearSeries π E F)
(s : Set E) : Prop where
zero_eq : β x β s, (p x 0).uncurry0 = f x
protected fderivWithin : β m : β, (m : ββ) < n β β x β s,
HasFDerivWithinAt (p Β· m) (p x m.succ).curryLeft s x
cont : β m : β, (m : ββ) β€ n β ContinuousOn (p Β· m) s
#align has_ftaylor_series_up_to_on HasFTaylorSeriesUpToOn
theorem HasFTaylorSeriesUpToOn.zero_eq' (h : HasFTaylorSeriesUpToOn n f p s) {x : E} (hx : x β s) :
p x 0 = (continuousMultilinearCurryFin0 π E F).symm (f x) := by
rw [β h.zero_eq x hx]
exact (p x 0).uncurry0_curry0.symm
#align has_ftaylor_series_up_to_on.zero_eq' HasFTaylorSeriesUpToOn.zero_eq'
theorem HasFTaylorSeriesUpToOn.congr (h : HasFTaylorSeriesUpToOn n f p s)
(hβ : β x β s, fβ x = f x) : HasFTaylorSeriesUpToOn n fβ p s := by
refine β¨fun x hx => ?_, h.fderivWithin, h.contβ©
rw [hβ x hx]
exact h.zero_eq x hx
#align has_ftaylor_series_up_to_on.congr HasFTaylorSeriesUpToOn.congr
theorem HasFTaylorSeriesUpToOn.mono (h : HasFTaylorSeriesUpToOn n f p s) {t : Set E} (hst : t β s) :
HasFTaylorSeriesUpToOn n f p t :=
β¨fun x hx => h.zero_eq x (hst hx), fun m hm x hx => (h.fderivWithin m hm x (hst hx)).mono hst,
fun m hm => (h.cont m hm).mono hstβ©
#align has_ftaylor_series_up_to_on.mono HasFTaylorSeriesUpToOn.mono
theorem HasFTaylorSeriesUpToOn.of_le (h : HasFTaylorSeriesUpToOn n f p s) (hmn : m β€ n) :
HasFTaylorSeriesUpToOn m f p s :=
β¨h.zero_eq, fun k hk x hx => h.fderivWithin k (lt_of_lt_of_le hk hmn) x hx, fun k hk =>
h.cont k (le_trans hk hmn)β©
#align has_ftaylor_series_up_to_on.of_le HasFTaylorSeriesUpToOn.of_le
| Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 223 | 226 | theorem HasFTaylorSeriesUpToOn.continuousOn (h : HasFTaylorSeriesUpToOn n f p s) :
ContinuousOn f s := by |
have := (h.cont 0 bot_le).congr fun x hx => (h.zero_eq' hx).symm
rwa [β (continuousMultilinearCurryFin0 π E F).symm.comp_continuousOn_iff]
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,481 |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FormalMultilinearSeries
#align_import analysis.calculus.cont_diff_def from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
noncomputable section
open scoped Classical
open NNReal Topology Filter
local notation "β" => (β€ : ββ)
open Set Fin Filter Function
universe u uE uF uG uX
variable {π : Type u} [NontriviallyNormedField π] {E : Type uE} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace π F] {G : Type uG}
[NormedAddCommGroup G] [NormedSpace π G] {X : Type uX} [NormedAddCommGroup X] [NormedSpace π X]
{s sβ t u : Set E} {f fβ : E β F} {g : F β G} {x xβ : E} {c : F} {m n : ββ}
{p : E β FormalMultilinearSeries π E F}
structure HasFTaylorSeriesUpToOn (n : ββ) (f : E β F) (p : E β FormalMultilinearSeries π E F)
(s : Set E) : Prop where
zero_eq : β x β s, (p x 0).uncurry0 = f x
protected fderivWithin : β m : β, (m : ββ) < n β β x β s,
HasFDerivWithinAt (p Β· m) (p x m.succ).curryLeft s x
cont : β m : β, (m : ββ) β€ n β ContinuousOn (p Β· m) s
#align has_ftaylor_series_up_to_on HasFTaylorSeriesUpToOn
theorem HasFTaylorSeriesUpToOn.zero_eq' (h : HasFTaylorSeriesUpToOn n f p s) {x : E} (hx : x β s) :
p x 0 = (continuousMultilinearCurryFin0 π E F).symm (f x) := by
rw [β h.zero_eq x hx]
exact (p x 0).uncurry0_curry0.symm
#align has_ftaylor_series_up_to_on.zero_eq' HasFTaylorSeriesUpToOn.zero_eq'
theorem HasFTaylorSeriesUpToOn.congr (h : HasFTaylorSeriesUpToOn n f p s)
(hβ : β x β s, fβ x = f x) : HasFTaylorSeriesUpToOn n fβ p s := by
refine β¨fun x hx => ?_, h.fderivWithin, h.contβ©
rw [hβ x hx]
exact h.zero_eq x hx
#align has_ftaylor_series_up_to_on.congr HasFTaylorSeriesUpToOn.congr
theorem HasFTaylorSeriesUpToOn.mono (h : HasFTaylorSeriesUpToOn n f p s) {t : Set E} (hst : t β s) :
HasFTaylorSeriesUpToOn n f p t :=
β¨fun x hx => h.zero_eq x (hst hx), fun m hm x hx => (h.fderivWithin m hm x (hst hx)).mono hst,
fun m hm => (h.cont m hm).mono hstβ©
#align has_ftaylor_series_up_to_on.mono HasFTaylorSeriesUpToOn.mono
theorem HasFTaylorSeriesUpToOn.of_le (h : HasFTaylorSeriesUpToOn n f p s) (hmn : m β€ n) :
HasFTaylorSeriesUpToOn m f p s :=
β¨h.zero_eq, fun k hk x hx => h.fderivWithin k (lt_of_lt_of_le hk hmn) x hx, fun k hk =>
h.cont k (le_trans hk hmn)β©
#align has_ftaylor_series_up_to_on.of_le HasFTaylorSeriesUpToOn.of_le
theorem HasFTaylorSeriesUpToOn.continuousOn (h : HasFTaylorSeriesUpToOn n f p s) :
ContinuousOn f s := by
have := (h.cont 0 bot_le).congr fun x hx => (h.zero_eq' hx).symm
rwa [β (continuousMultilinearCurryFin0 π E F).symm.comp_continuousOn_iff]
#align has_ftaylor_series_up_to_on.continuous_on HasFTaylorSeriesUpToOn.continuousOn
| Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 229 | 237 | theorem hasFTaylorSeriesUpToOn_zero_iff :
HasFTaylorSeriesUpToOn 0 f p s β ContinuousOn f s β§ β x β s, (p x 0).uncurry0 = f x := by |
refine β¨fun H => β¨H.continuousOn, H.zero_eqβ©, fun H =>
β¨H.2, fun m hm => False.elim (not_le.2 hm bot_le), fun m hm β¦ ?_β©β©
obtain rfl : m = 0 := mod_cast hm.antisymm (zero_le _)
have : EqOn (p Β· 0) ((continuousMultilinearCurryFin0 π E F).symm β f) s := fun x hx β¦
(continuousMultilinearCurryFin0 π E F).eq_symm_apply.2 (H.2 x hx)
rw [continuousOn_congr this, LinearIsometryEquiv.comp_continuousOn_iff]
exact H.1
| 7 | 1,096.633158 | 2 | 1.4 | 5 | 1,481 |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FormalMultilinearSeries
#align_import analysis.calculus.cont_diff_def from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
noncomputable section
open scoped Classical
open NNReal Topology Filter
local notation "β" => (β€ : ββ)
open Set Fin Filter Function
universe u uE uF uG uX
variable {π : Type u} [NontriviallyNormedField π] {E : Type uE} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace π F] {G : Type uG}
[NormedAddCommGroup G] [NormedSpace π G] {X : Type uX} [NormedAddCommGroup X] [NormedSpace π X]
{s sβ t u : Set E} {f fβ : E β F} {g : F β G} {x xβ : E} {c : F} {m n : ββ}
{p : E β FormalMultilinearSeries π E F}
structure HasFTaylorSeriesUpToOn (n : ββ) (f : E β F) (p : E β FormalMultilinearSeries π E F)
(s : Set E) : Prop where
zero_eq : β x β s, (p x 0).uncurry0 = f x
protected fderivWithin : β m : β, (m : ββ) < n β β x β s,
HasFDerivWithinAt (p Β· m) (p x m.succ).curryLeft s x
cont : β m : β, (m : ββ) β€ n β ContinuousOn (p Β· m) s
#align has_ftaylor_series_up_to_on HasFTaylorSeriesUpToOn
theorem HasFTaylorSeriesUpToOn.zero_eq' (h : HasFTaylorSeriesUpToOn n f p s) {x : E} (hx : x β s) :
p x 0 = (continuousMultilinearCurryFin0 π E F).symm (f x) := by
rw [β h.zero_eq x hx]
exact (p x 0).uncurry0_curry0.symm
#align has_ftaylor_series_up_to_on.zero_eq' HasFTaylorSeriesUpToOn.zero_eq'
theorem HasFTaylorSeriesUpToOn.congr (h : HasFTaylorSeriesUpToOn n f p s)
(hβ : β x β s, fβ x = f x) : HasFTaylorSeriesUpToOn n fβ p s := by
refine β¨fun x hx => ?_, h.fderivWithin, h.contβ©
rw [hβ x hx]
exact h.zero_eq x hx
#align has_ftaylor_series_up_to_on.congr HasFTaylorSeriesUpToOn.congr
theorem HasFTaylorSeriesUpToOn.mono (h : HasFTaylorSeriesUpToOn n f p s) {t : Set E} (hst : t β s) :
HasFTaylorSeriesUpToOn n f p t :=
β¨fun x hx => h.zero_eq x (hst hx), fun m hm x hx => (h.fderivWithin m hm x (hst hx)).mono hst,
fun m hm => (h.cont m hm).mono hstβ©
#align has_ftaylor_series_up_to_on.mono HasFTaylorSeriesUpToOn.mono
theorem HasFTaylorSeriesUpToOn.of_le (h : HasFTaylorSeriesUpToOn n f p s) (hmn : m β€ n) :
HasFTaylorSeriesUpToOn m f p s :=
β¨h.zero_eq, fun k hk x hx => h.fderivWithin k (lt_of_lt_of_le hk hmn) x hx, fun k hk =>
h.cont k (le_trans hk hmn)β©
#align has_ftaylor_series_up_to_on.of_le HasFTaylorSeriesUpToOn.of_le
theorem HasFTaylorSeriesUpToOn.continuousOn (h : HasFTaylorSeriesUpToOn n f p s) :
ContinuousOn f s := by
have := (h.cont 0 bot_le).congr fun x hx => (h.zero_eq' hx).symm
rwa [β (continuousMultilinearCurryFin0 π E F).symm.comp_continuousOn_iff]
#align has_ftaylor_series_up_to_on.continuous_on HasFTaylorSeriesUpToOn.continuousOn
theorem hasFTaylorSeriesUpToOn_zero_iff :
HasFTaylorSeriesUpToOn 0 f p s β ContinuousOn f s β§ β x β s, (p x 0).uncurry0 = f x := by
refine β¨fun H => β¨H.continuousOn, H.zero_eqβ©, fun H =>
β¨H.2, fun m hm => False.elim (not_le.2 hm bot_le), fun m hm β¦ ?_β©β©
obtain rfl : m = 0 := mod_cast hm.antisymm (zero_le _)
have : EqOn (p Β· 0) ((continuousMultilinearCurryFin0 π E F).symm β f) s := fun x hx β¦
(continuousMultilinearCurryFin0 π E F).eq_symm_apply.2 (H.2 x hx)
rw [continuousOn_congr this, LinearIsometryEquiv.comp_continuousOn_iff]
exact H.1
#align has_ftaylor_series_up_to_on_zero_iff hasFTaylorSeriesUpToOn_zero_iff
| Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 240 | 250 | theorem hasFTaylorSeriesUpToOn_top_iff :
HasFTaylorSeriesUpToOn β f p s β β n : β, HasFTaylorSeriesUpToOn n f p s := by |
constructor
Β· intro H n; exact H.of_le le_top
Β· intro H
constructor
Β· exact (H 0).zero_eq
Β· intro m _
apply (H m.succ).fderivWithin m (WithTop.coe_lt_coe.2 (lt_add_one m))
Β· intro m _
apply (H m).cont m le_rfl
| 9 | 8,103.083928 | 2 | 1.4 | 5 | 1,481 |
import Mathlib.Topology.Separation
import Mathlib.Topology.NoetherianSpace
#align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
open TopologicalSpace
variable {Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] {f : Ξ± β Ξ²}
def IsQuasiSeparated (s : Set Ξ±) : Prop :=
β U V : Set Ξ±, U β s β IsOpen U β IsCompact U β V β s β IsOpen V β IsCompact V β IsCompact (U β© V)
#align is_quasi_separated IsQuasiSeparated
@[mk_iff]
class QuasiSeparatedSpace (Ξ± : Type*) [TopologicalSpace Ξ±] : Prop where
inter_isCompact :
β U V : Set Ξ±, IsOpen U β IsCompact U β IsOpen V β IsCompact V β IsCompact (U β© V)
#align quasi_separated_space QuasiSeparatedSpace
| Mathlib/Topology/QuasiSeparated.lean | 53 | 56 | theorem isQuasiSeparated_univ_iff {Ξ± : Type*} [TopologicalSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) β QuasiSeparatedSpace Ξ± := by |
rw [quasiSeparatedSpace_iff]
simp [IsQuasiSeparated]
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,482 |
import Mathlib.Topology.Separation
import Mathlib.Topology.NoetherianSpace
#align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
open TopologicalSpace
variable {Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] {f : Ξ± β Ξ²}
def IsQuasiSeparated (s : Set Ξ±) : Prop :=
β U V : Set Ξ±, U β s β IsOpen U β IsCompact U β V β s β IsOpen V β IsCompact V β IsCompact (U β© V)
#align is_quasi_separated IsQuasiSeparated
@[mk_iff]
class QuasiSeparatedSpace (Ξ± : Type*) [TopologicalSpace Ξ±] : Prop where
inter_isCompact :
β U V : Set Ξ±, IsOpen U β IsCompact U β IsOpen V β IsCompact V β IsCompact (U β© V)
#align quasi_separated_space QuasiSeparatedSpace
theorem isQuasiSeparated_univ_iff {Ξ± : Type*} [TopologicalSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) β QuasiSeparatedSpace Ξ± := by
rw [quasiSeparatedSpace_iff]
simp [IsQuasiSeparated]
#align is_quasi_separated_univ_iff isQuasiSeparated_univ_iff
theorem isQuasiSeparated_univ {Ξ± : Type*} [TopologicalSpace Ξ±] [QuasiSeparatedSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) :=
isQuasiSeparated_univ_iff.mpr inferInstance
#align is_quasi_separated_univ isQuasiSeparated_univ
| Mathlib/Topology/QuasiSeparated.lean | 64 | 86 | theorem IsQuasiSeparated.image_of_embedding {s : Set Ξ±} (H : IsQuasiSeparated s) (h : Embedding f) :
IsQuasiSeparated (f '' s) := by |
intro U V hU hU' hU'' hV hV' hV''
convert
(H (f β»ΒΉ' U) (f β»ΒΉ' V)
?_ (h.continuous.1 _ hU') ?_ ?_ (h.continuous.1 _ hV') ?_).image h.continuous
Β· symm
rw [β Set.preimage_inter, Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact Set.inter_subset_left.trans (hU.trans (Set.image_subset_range _ _))
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hU hx
Β· rw [h.isCompact_iff]
convert hU''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hU.trans (Set.image_subset_range _ _)
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hV hx
Β· rw [h.isCompact_iff]
convert hV''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hV.trans (Set.image_subset_range _ _)
| 21 | 1,318,815,734.483215 | 2 | 1.4 | 5 | 1,482 |
import Mathlib.Topology.Separation
import Mathlib.Topology.NoetherianSpace
#align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
open TopologicalSpace
variable {Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] {f : Ξ± β Ξ²}
def IsQuasiSeparated (s : Set Ξ±) : Prop :=
β U V : Set Ξ±, U β s β IsOpen U β IsCompact U β V β s β IsOpen V β IsCompact V β IsCompact (U β© V)
#align is_quasi_separated IsQuasiSeparated
@[mk_iff]
class QuasiSeparatedSpace (Ξ± : Type*) [TopologicalSpace Ξ±] : Prop where
inter_isCompact :
β U V : Set Ξ±, IsOpen U β IsCompact U β IsOpen V β IsCompact V β IsCompact (U β© V)
#align quasi_separated_space QuasiSeparatedSpace
theorem isQuasiSeparated_univ_iff {Ξ± : Type*} [TopologicalSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) β QuasiSeparatedSpace Ξ± := by
rw [quasiSeparatedSpace_iff]
simp [IsQuasiSeparated]
#align is_quasi_separated_univ_iff isQuasiSeparated_univ_iff
theorem isQuasiSeparated_univ {Ξ± : Type*} [TopologicalSpace Ξ±] [QuasiSeparatedSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) :=
isQuasiSeparated_univ_iff.mpr inferInstance
#align is_quasi_separated_univ isQuasiSeparated_univ
theorem IsQuasiSeparated.image_of_embedding {s : Set Ξ±} (H : IsQuasiSeparated s) (h : Embedding f) :
IsQuasiSeparated (f '' s) := by
intro U V hU hU' hU'' hV hV' hV''
convert
(H (f β»ΒΉ' U) (f β»ΒΉ' V)
?_ (h.continuous.1 _ hU') ?_ ?_ (h.continuous.1 _ hV') ?_).image h.continuous
Β· symm
rw [β Set.preimage_inter, Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact Set.inter_subset_left.trans (hU.trans (Set.image_subset_range _ _))
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hU hx
Β· rw [h.isCompact_iff]
convert hU''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hU.trans (Set.image_subset_range _ _)
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hV hx
Β· rw [h.isCompact_iff]
convert hV''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hV.trans (Set.image_subset_range _ _)
#align is_quasi_separated.image_of_embedding IsQuasiSeparated.image_of_embedding
| Mathlib/Topology/QuasiSeparated.lean | 89 | 96 | theorem OpenEmbedding.isQuasiSeparated_iff (h : OpenEmbedding f) {s : Set Ξ±} :
IsQuasiSeparated s β IsQuasiSeparated (f '' s) := by |
refine β¨fun hs => hs.image_of_embedding h.toEmbedding, ?_β©
intro H U V hU hU' hU'' hV hV' hV''
rw [h.toEmbedding.isCompact_iff, Set.image_inter h.inj]
exact
H (f '' U) (f '' V) (Set.image_subset _ hU) (h.isOpenMap _ hU') (hU''.image h.continuous)
(Set.image_subset _ hV) (h.isOpenMap _ hV') (hV''.image h.continuous)
| 6 | 403.428793 | 2 | 1.4 | 5 | 1,482 |
import Mathlib.Topology.Separation
import Mathlib.Topology.NoetherianSpace
#align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
open TopologicalSpace
variable {Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] {f : Ξ± β Ξ²}
def IsQuasiSeparated (s : Set Ξ±) : Prop :=
β U V : Set Ξ±, U β s β IsOpen U β IsCompact U β V β s β IsOpen V β IsCompact V β IsCompact (U β© V)
#align is_quasi_separated IsQuasiSeparated
@[mk_iff]
class QuasiSeparatedSpace (Ξ± : Type*) [TopologicalSpace Ξ±] : Prop where
inter_isCompact :
β U V : Set Ξ±, IsOpen U β IsCompact U β IsOpen V β IsCompact V β IsCompact (U β© V)
#align quasi_separated_space QuasiSeparatedSpace
theorem isQuasiSeparated_univ_iff {Ξ± : Type*} [TopologicalSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) β QuasiSeparatedSpace Ξ± := by
rw [quasiSeparatedSpace_iff]
simp [IsQuasiSeparated]
#align is_quasi_separated_univ_iff isQuasiSeparated_univ_iff
theorem isQuasiSeparated_univ {Ξ± : Type*} [TopologicalSpace Ξ±] [QuasiSeparatedSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) :=
isQuasiSeparated_univ_iff.mpr inferInstance
#align is_quasi_separated_univ isQuasiSeparated_univ
theorem IsQuasiSeparated.image_of_embedding {s : Set Ξ±} (H : IsQuasiSeparated s) (h : Embedding f) :
IsQuasiSeparated (f '' s) := by
intro U V hU hU' hU'' hV hV' hV''
convert
(H (f β»ΒΉ' U) (f β»ΒΉ' V)
?_ (h.continuous.1 _ hU') ?_ ?_ (h.continuous.1 _ hV') ?_).image h.continuous
Β· symm
rw [β Set.preimage_inter, Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact Set.inter_subset_left.trans (hU.trans (Set.image_subset_range _ _))
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hU hx
Β· rw [h.isCompact_iff]
convert hU''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hU.trans (Set.image_subset_range _ _)
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hV hx
Β· rw [h.isCompact_iff]
convert hV''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hV.trans (Set.image_subset_range _ _)
#align is_quasi_separated.image_of_embedding IsQuasiSeparated.image_of_embedding
theorem OpenEmbedding.isQuasiSeparated_iff (h : OpenEmbedding f) {s : Set Ξ±} :
IsQuasiSeparated s β IsQuasiSeparated (f '' s) := by
refine β¨fun hs => hs.image_of_embedding h.toEmbedding, ?_β©
intro H U V hU hU' hU'' hV hV' hV''
rw [h.toEmbedding.isCompact_iff, Set.image_inter h.inj]
exact
H (f '' U) (f '' V) (Set.image_subset _ hU) (h.isOpenMap _ hU') (hU''.image h.continuous)
(Set.image_subset _ hV) (h.isOpenMap _ hV') (hV''.image h.continuous)
#align open_embedding.is_quasi_separated_iff OpenEmbedding.isQuasiSeparated_iff
| Mathlib/Topology/QuasiSeparated.lean | 99 | 103 | theorem isQuasiSeparated_iff_quasiSeparatedSpace (s : Set Ξ±) (hs : IsOpen s) :
IsQuasiSeparated s β QuasiSeparatedSpace s := by |
rw [β isQuasiSeparated_univ_iff]
convert (hs.openEmbedding_subtype_val.isQuasiSeparated_iff (s := Set.univ)).symm
simp
| 3 | 20.085537 | 1 | 1.4 | 5 | 1,482 |
import Mathlib.Topology.Separation
import Mathlib.Topology.NoetherianSpace
#align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
open TopologicalSpace
variable {Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] {f : Ξ± β Ξ²}
def IsQuasiSeparated (s : Set Ξ±) : Prop :=
β U V : Set Ξ±, U β s β IsOpen U β IsCompact U β V β s β IsOpen V β IsCompact V β IsCompact (U β© V)
#align is_quasi_separated IsQuasiSeparated
@[mk_iff]
class QuasiSeparatedSpace (Ξ± : Type*) [TopologicalSpace Ξ±] : Prop where
inter_isCompact :
β U V : Set Ξ±, IsOpen U β IsCompact U β IsOpen V β IsCompact V β IsCompact (U β© V)
#align quasi_separated_space QuasiSeparatedSpace
theorem isQuasiSeparated_univ_iff {Ξ± : Type*} [TopologicalSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) β QuasiSeparatedSpace Ξ± := by
rw [quasiSeparatedSpace_iff]
simp [IsQuasiSeparated]
#align is_quasi_separated_univ_iff isQuasiSeparated_univ_iff
theorem isQuasiSeparated_univ {Ξ± : Type*} [TopologicalSpace Ξ±] [QuasiSeparatedSpace Ξ±] :
IsQuasiSeparated (Set.univ : Set Ξ±) :=
isQuasiSeparated_univ_iff.mpr inferInstance
#align is_quasi_separated_univ isQuasiSeparated_univ
theorem IsQuasiSeparated.image_of_embedding {s : Set Ξ±} (H : IsQuasiSeparated s) (h : Embedding f) :
IsQuasiSeparated (f '' s) := by
intro U V hU hU' hU'' hV hV' hV''
convert
(H (f β»ΒΉ' U) (f β»ΒΉ' V)
?_ (h.continuous.1 _ hU') ?_ ?_ (h.continuous.1 _ hV') ?_).image h.continuous
Β· symm
rw [β Set.preimage_inter, Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact Set.inter_subset_left.trans (hU.trans (Set.image_subset_range _ _))
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hU hx
Β· rw [h.isCompact_iff]
convert hU''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hU.trans (Set.image_subset_range _ _)
Β· intro x hx
rw [β h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hV hx
Β· rw [h.isCompact_iff]
convert hV''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hV.trans (Set.image_subset_range _ _)
#align is_quasi_separated.image_of_embedding IsQuasiSeparated.image_of_embedding
theorem OpenEmbedding.isQuasiSeparated_iff (h : OpenEmbedding f) {s : Set Ξ±} :
IsQuasiSeparated s β IsQuasiSeparated (f '' s) := by
refine β¨fun hs => hs.image_of_embedding h.toEmbedding, ?_β©
intro H U V hU hU' hU'' hV hV' hV''
rw [h.toEmbedding.isCompact_iff, Set.image_inter h.inj]
exact
H (f '' U) (f '' V) (Set.image_subset _ hU) (h.isOpenMap _ hU') (hU''.image h.continuous)
(Set.image_subset _ hV) (h.isOpenMap _ hV') (hV''.image h.continuous)
#align open_embedding.is_quasi_separated_iff OpenEmbedding.isQuasiSeparated_iff
theorem isQuasiSeparated_iff_quasiSeparatedSpace (s : Set Ξ±) (hs : IsOpen s) :
IsQuasiSeparated s β QuasiSeparatedSpace s := by
rw [β isQuasiSeparated_univ_iff]
convert (hs.openEmbedding_subtype_val.isQuasiSeparated_iff (s := Set.univ)).symm
simp
#align is_quasi_separated_iff_quasi_separated_space isQuasiSeparated_iff_quasiSeparatedSpace
| Mathlib/Topology/QuasiSeparated.lean | 106 | 109 | theorem IsQuasiSeparated.of_subset {s t : Set Ξ±} (ht : IsQuasiSeparated t) (h : s β t) :
IsQuasiSeparated s := by |
intro U V hU hU' hU'' hV hV' hV''
exact ht U V (hU.trans h) hU' hU'' (hV.trans h) hV' hV''
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,482 |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.lemmas from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
open Function Nat
namespace Int
variable {a b : β€} {n : β}
| Mathlib/Data/Int/Order/Lemmas.lean | 28 | 30 | theorem natAbs_eq_iff_mul_self_eq {a b : β€} : a.natAbs = b.natAbs β a * a = b * b := by |
rw [β abs_eq_iff_mul_self_eq, abs_eq_natAbs, abs_eq_natAbs]
exact Int.natCast_inj.symm
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,483 |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.lemmas from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
open Function Nat
namespace Int
variable {a b : β€} {n : β}
theorem natAbs_eq_iff_mul_self_eq {a b : β€} : a.natAbs = b.natAbs β a * a = b * b := by
rw [β abs_eq_iff_mul_self_eq, abs_eq_natAbs, abs_eq_natAbs]
exact Int.natCast_inj.symm
#align int.nat_abs_eq_iff_mul_self_eq Int.natAbs_eq_iff_mul_self_eq
#align int.eq_nat_abs_iff_mul_eq_zero Int.eq_natAbs_iff_mul_eq_zero
| Mathlib/Data/Int/Order/Lemmas.lean | 35 | 37 | theorem natAbs_lt_iff_mul_self_lt {a b : β€} : a.natAbs < b.natAbs β a * a < b * b := by |
rw [β abs_lt_iff_mul_self_lt, abs_eq_natAbs, abs_eq_natAbs]
exact Int.ofNat_lt.symm
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,483 |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.lemmas from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
open Function Nat
namespace Int
variable {a b : β€} {n : β}
theorem natAbs_eq_iff_mul_self_eq {a b : β€} : a.natAbs = b.natAbs β a * a = b * b := by
rw [β abs_eq_iff_mul_self_eq, abs_eq_natAbs, abs_eq_natAbs]
exact Int.natCast_inj.symm
#align int.nat_abs_eq_iff_mul_self_eq Int.natAbs_eq_iff_mul_self_eq
#align int.eq_nat_abs_iff_mul_eq_zero Int.eq_natAbs_iff_mul_eq_zero
theorem natAbs_lt_iff_mul_self_lt {a b : β€} : a.natAbs < b.natAbs β a * a < b * b := by
rw [β abs_lt_iff_mul_self_lt, abs_eq_natAbs, abs_eq_natAbs]
exact Int.ofNat_lt.symm
#align int.nat_abs_lt_iff_mul_self_lt Int.natAbs_lt_iff_mul_self_lt
| Mathlib/Data/Int/Order/Lemmas.lean | 40 | 42 | theorem natAbs_le_iff_mul_self_le {a b : β€} : a.natAbs β€ b.natAbs β a * a β€ b * b := by |
rw [β abs_le_iff_mul_self_le, abs_eq_natAbs, abs_eq_natAbs]
exact Int.ofNat_le.symm
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,483 |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.lemmas from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
open Function Nat
namespace Int
variable {a b : β€} {n : β}
theorem natAbs_eq_iff_mul_self_eq {a b : β€} : a.natAbs = b.natAbs β a * a = b * b := by
rw [β abs_eq_iff_mul_self_eq, abs_eq_natAbs, abs_eq_natAbs]
exact Int.natCast_inj.symm
#align int.nat_abs_eq_iff_mul_self_eq Int.natAbs_eq_iff_mul_self_eq
#align int.eq_nat_abs_iff_mul_eq_zero Int.eq_natAbs_iff_mul_eq_zero
theorem natAbs_lt_iff_mul_self_lt {a b : β€} : a.natAbs < b.natAbs β a * a < b * b := by
rw [β abs_lt_iff_mul_self_lt, abs_eq_natAbs, abs_eq_natAbs]
exact Int.ofNat_lt.symm
#align int.nat_abs_lt_iff_mul_self_lt Int.natAbs_lt_iff_mul_self_lt
theorem natAbs_le_iff_mul_self_le {a b : β€} : a.natAbs β€ b.natAbs β a * a β€ b * b := by
rw [β abs_le_iff_mul_self_le, abs_eq_natAbs, abs_eq_natAbs]
exact Int.ofNat_le.symm
#align int.nat_abs_le_iff_mul_self_le Int.natAbs_le_iff_mul_self_le
| Mathlib/Data/Int/Order/Lemmas.lean | 45 | 50 | theorem dvd_div_of_mul_dvd {a b c : β€} (h : a * b β£ c) : b β£ c / a := by |
rcases eq_or_ne a 0 with (rfl | ha)
Β· simp only [Int.ediv_zero, Int.dvd_zero]
rcases h with β¨d, rflβ©
refine β¨d, ?_β©
rw [mul_assoc, Int.mul_ediv_cancel_left _ ha]
| 5 | 148.413159 | 2 | 1.4 | 5 | 1,483 |
import Mathlib.Algebra.Order.Ring.Abs
#align_import data.int.order.lemmas from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
open Function Nat
namespace Int
variable {a b : β€} {n : β}
theorem natAbs_eq_iff_mul_self_eq {a b : β€} : a.natAbs = b.natAbs β a * a = b * b := by
rw [β abs_eq_iff_mul_self_eq, abs_eq_natAbs, abs_eq_natAbs]
exact Int.natCast_inj.symm
#align int.nat_abs_eq_iff_mul_self_eq Int.natAbs_eq_iff_mul_self_eq
#align int.eq_nat_abs_iff_mul_eq_zero Int.eq_natAbs_iff_mul_eq_zero
theorem natAbs_lt_iff_mul_self_lt {a b : β€} : a.natAbs < b.natAbs β a * a < b * b := by
rw [β abs_lt_iff_mul_self_lt, abs_eq_natAbs, abs_eq_natAbs]
exact Int.ofNat_lt.symm
#align int.nat_abs_lt_iff_mul_self_lt Int.natAbs_lt_iff_mul_self_lt
theorem natAbs_le_iff_mul_self_le {a b : β€} : a.natAbs β€ b.natAbs β a * a β€ b * b := by
rw [β abs_le_iff_mul_self_le, abs_eq_natAbs, abs_eq_natAbs]
exact Int.ofNat_le.symm
#align int.nat_abs_le_iff_mul_self_le Int.natAbs_le_iff_mul_self_le
theorem dvd_div_of_mul_dvd {a b c : β€} (h : a * b β£ c) : b β£ c / a := by
rcases eq_or_ne a 0 with (rfl | ha)
Β· simp only [Int.ediv_zero, Int.dvd_zero]
rcases h with β¨d, rflβ©
refine β¨d, ?_β©
rw [mul_assoc, Int.mul_ediv_cancel_left _ ha]
#align int.dvd_div_of_mul_dvd Int.dvd_div_of_mul_dvd
lemma pow_right_injective (h : 1 < a.natAbs) : Injective ((a ^ Β·) : β β β€) := by
refine (?_ : Injective (natAbs β (a ^ Β· : β β β€))).of_comp
convert Nat.pow_right_injective h using 2
rw [Function.comp_apply, natAbs_pow]
#align int.pow_right_injective Int.pow_right_injective
| Mathlib/Data/Int/Order/Lemmas.lean | 62 | 68 | theorem eq_zero_of_abs_lt_dvd {m x : β€} (h1 : m β£ x) (h2 : |x| < m) : x = 0 := by |
obtain rfl | hm := eq_or_ne m 0
Β· exact Int.zero_dvd.1 h1
rcases h1 with β¨d, rflβ©
apply mul_eq_zero_of_right
rw [β abs_lt_one_iff, β mul_lt_iff_lt_one_right (abs_pos.mpr hm), β abs_mul]
exact lt_of_lt_of_le h2 (le_abs_self m)
| 6 | 403.428793 | 2 | 1.4 | 5 | 1,483 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Infix
#align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open List.Perm
universe u
namespace List
section Sorted
variable {Ξ± : Type u} {r : Ξ± β Ξ± β Prop} {a : Ξ±} {l : List Ξ±}
def Sorted :=
@Pairwise
#align list.sorted List.Sorted
instance decidableSorted [DecidableRel r] (l : List Ξ±) : Decidable (Sorted r l) :=
List.instDecidablePairwise _
#align list.decidable_sorted List.decidableSorted
protected theorem Sorted.le_of_lt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· < Β·)) :
l.Sorted (Β· β€ Β·) :=
h.imp le_of_lt
protected theorem Sorted.lt_of_le [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β€ Β·))
(hβ : l.Nodup) : l.Sorted (Β· < Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) hβ
protected theorem Sorted.ge_of_gt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· > Β·)) :
l.Sorted (Β· β₯ Β·) :=
h.imp le_of_lt
protected theorem Sorted.gt_of_ge [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β₯ Β·))
(hβ : l.Nodup) : l.Sorted (Β· > Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) <| by simp_rw [ne_comm]; exact hβ
@[simp]
theorem sorted_nil : Sorted r [] :=
Pairwise.nil
#align list.sorted_nil List.sorted_nil
theorem Sorted.of_cons : Sorted r (a :: l) β Sorted r l :=
Pairwise.of_cons
#align list.sorted.of_cons List.Sorted.of_cons
theorem Sorted.tail {r : Ξ± β Ξ± β Prop} {l : List Ξ±} (h : Sorted r l) : Sorted r l.tail :=
Pairwise.tail h
#align list.sorted.tail List.Sorted.tail
theorem rel_of_sorted_cons {a : Ξ±} {l : List Ξ±} : Sorted r (a :: l) β β b β l, r a b :=
rel_of_pairwise_cons
#align list.rel_of_sorted_cons List.rel_of_sorted_cons
| Mathlib/Data/List/Sort.lean | 80 | 85 | theorem Sorted.head!_le [Inhabited Ξ±] [Preorder Ξ±] {a : Ξ±} {l : List Ξ±} (h : Sorted (Β· < Β·) l)
(ha : a β l) : l.head! β€ a := by |
rw [β List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
Β· exact le_rfl
Β· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
| 4 | 54.59815 | 2 | 1.4 | 5 | 1,484 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Infix
#align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open List.Perm
universe u
namespace List
section Sorted
variable {Ξ± : Type u} {r : Ξ± β Ξ± β Prop} {a : Ξ±} {l : List Ξ±}
def Sorted :=
@Pairwise
#align list.sorted List.Sorted
instance decidableSorted [DecidableRel r] (l : List Ξ±) : Decidable (Sorted r l) :=
List.instDecidablePairwise _
#align list.decidable_sorted List.decidableSorted
protected theorem Sorted.le_of_lt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· < Β·)) :
l.Sorted (Β· β€ Β·) :=
h.imp le_of_lt
protected theorem Sorted.lt_of_le [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β€ Β·))
(hβ : l.Nodup) : l.Sorted (Β· < Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) hβ
protected theorem Sorted.ge_of_gt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· > Β·)) :
l.Sorted (Β· β₯ Β·) :=
h.imp le_of_lt
protected theorem Sorted.gt_of_ge [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β₯ Β·))
(hβ : l.Nodup) : l.Sorted (Β· > Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) <| by simp_rw [ne_comm]; exact hβ
@[simp]
theorem sorted_nil : Sorted r [] :=
Pairwise.nil
#align list.sorted_nil List.sorted_nil
theorem Sorted.of_cons : Sorted r (a :: l) β Sorted r l :=
Pairwise.of_cons
#align list.sorted.of_cons List.Sorted.of_cons
theorem Sorted.tail {r : Ξ± β Ξ± β Prop} {l : List Ξ±} (h : Sorted r l) : Sorted r l.tail :=
Pairwise.tail h
#align list.sorted.tail List.Sorted.tail
theorem rel_of_sorted_cons {a : Ξ±} {l : List Ξ±} : Sorted r (a :: l) β β b β l, r a b :=
rel_of_pairwise_cons
#align list.rel_of_sorted_cons List.rel_of_sorted_cons
theorem Sorted.head!_le [Inhabited Ξ±] [Preorder Ξ±] {a : Ξ±} {l : List Ξ±} (h : Sorted (Β· < Β·) l)
(ha : a β l) : l.head! β€ a := by
rw [β List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
Β· exact le_rfl
Β· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
| Mathlib/Data/List/Sort.lean | 87 | 92 | theorem Sorted.le_head! [Inhabited Ξ±] [Preorder Ξ±] {a : Ξ±} {l : List Ξ±} (h : Sorted (Β· > Β·) l)
(ha : a β l) : a β€ l.head! := by |
rw [β List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
Β· exact le_rfl
Β· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
| 4 | 54.59815 | 2 | 1.4 | 5 | 1,484 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Infix
#align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open List.Perm
universe u
namespace List
section Sorted
variable {Ξ± : Type u} {r : Ξ± β Ξ± β Prop} {a : Ξ±} {l : List Ξ±}
def Sorted :=
@Pairwise
#align list.sorted List.Sorted
instance decidableSorted [DecidableRel r] (l : List Ξ±) : Decidable (Sorted r l) :=
List.instDecidablePairwise _
#align list.decidable_sorted List.decidableSorted
protected theorem Sorted.le_of_lt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· < Β·)) :
l.Sorted (Β· β€ Β·) :=
h.imp le_of_lt
protected theorem Sorted.lt_of_le [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β€ Β·))
(hβ : l.Nodup) : l.Sorted (Β· < Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) hβ
protected theorem Sorted.ge_of_gt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· > Β·)) :
l.Sorted (Β· β₯ Β·) :=
h.imp le_of_lt
protected theorem Sorted.gt_of_ge [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β₯ Β·))
(hβ : l.Nodup) : l.Sorted (Β· > Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) <| by simp_rw [ne_comm]; exact hβ
@[simp]
theorem sorted_nil : Sorted r [] :=
Pairwise.nil
#align list.sorted_nil List.sorted_nil
theorem Sorted.of_cons : Sorted r (a :: l) β Sorted r l :=
Pairwise.of_cons
#align list.sorted.of_cons List.Sorted.of_cons
theorem Sorted.tail {r : Ξ± β Ξ± β Prop} {l : List Ξ±} (h : Sorted r l) : Sorted r l.tail :=
Pairwise.tail h
#align list.sorted.tail List.Sorted.tail
theorem rel_of_sorted_cons {a : Ξ±} {l : List Ξ±} : Sorted r (a :: l) β β b β l, r a b :=
rel_of_pairwise_cons
#align list.rel_of_sorted_cons List.rel_of_sorted_cons
theorem Sorted.head!_le [Inhabited Ξ±] [Preorder Ξ±] {a : Ξ±} {l : List Ξ±} (h : Sorted (Β· < Β·) l)
(ha : a β l) : l.head! β€ a := by
rw [β List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
Β· exact le_rfl
Β· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
theorem Sorted.le_head! [Inhabited Ξ±] [Preorder Ξ±] {a : Ξ±} {l : List Ξ±} (h : Sorted (Β· > Β·) l)
(ha : a β l) : a β€ l.head! := by
rw [β List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
Β· exact le_rfl
Β· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
@[simp]
theorem sorted_cons {a : Ξ±} {l : List Ξ±} : Sorted r (a :: l) β (β b β l, r a b) β§ Sorted r l :=
pairwise_cons
#align list.sorted_cons List.sorted_cons
protected theorem Sorted.nodup {r : Ξ± β Ξ± β Prop} [IsIrrefl Ξ± r] {l : List Ξ±} (h : Sorted r l) :
Nodup l :=
Pairwise.nodup h
#align list.sorted.nodup List.Sorted.nodup
| Mathlib/Data/List/Sort.lean | 104 | 120 | theorem eq_of_perm_of_sorted [IsAntisymm Ξ± r] {lβ lβ : List Ξ±} (hp : lβ ~ lβ) (hsβ : Sorted r lβ)
(hsβ : Sorted r lβ) : lβ = lβ := by |
induction' hsβ with a lβ hβ hsβ IH generalizing lβ
Β· exact hp.nil_eq
Β· have : a β lβ := hp.subset (mem_cons_self _ _)
rcases append_of_mem this with β¨uβ, vβ, rflβ©
have hp' := (perm_cons a).1 (hp.trans perm_middle)
obtain rfl := IH hp' (hsβ.sublist <| by simp)
change a :: uβ ++ vβ = uβ ++ ([a] ++ vβ)
rw [β append_assoc]
congr
have : β x β uβ, x = a := fun x m =>
antisymm ((pairwise_append.1 hsβ).2.2 _ m a (mem_cons_self _ _)) (hβ _ (by simp [m]))
rw [(@eq_replicate _ a (length uβ + 1) (a :: uβ)).2,
(@eq_replicate _ a (length uβ + 1) (uβ ++ [a])).2] <;>
constructor <;>
simp [iff_true_intro this, or_comm]
| 15 | 3,269,017.372472 | 2 | 1.4 | 5 | 1,484 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Infix
#align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open List.Perm
universe u
namespace List
section Sorted
variable {Ξ± : Type u} {r : Ξ± β Ξ± β Prop} {a : Ξ±} {l : List Ξ±}
def Sorted :=
@Pairwise
#align list.sorted List.Sorted
instance decidableSorted [DecidableRel r] (l : List Ξ±) : Decidable (Sorted r l) :=
List.instDecidablePairwise _
#align list.decidable_sorted List.decidableSorted
protected theorem Sorted.le_of_lt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· < Β·)) :
l.Sorted (Β· β€ Β·) :=
h.imp le_of_lt
protected theorem Sorted.lt_of_le [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β€ Β·))
(hβ : l.Nodup) : l.Sorted (Β· < Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) hβ
protected theorem Sorted.ge_of_gt [Preorder Ξ±] {l : List Ξ±} (h : l.Sorted (Β· > Β·)) :
l.Sorted (Β· β₯ Β·) :=
h.imp le_of_lt
protected theorem Sorted.gt_of_ge [PartialOrder Ξ±] {l : List Ξ±} (hβ : l.Sorted (Β· β₯ Β·))
(hβ : l.Nodup) : l.Sorted (Β· > Β·) :=
hβ.impβ (fun _ _ => lt_of_le_of_ne) <| by simp_rw [ne_comm]; exact hβ
@[simp]
theorem sorted_nil : Sorted r [] :=
Pairwise.nil
#align list.sorted_nil List.sorted_nil
theorem Sorted.of_cons : Sorted r (a :: l) β Sorted r l :=
Pairwise.of_cons
#align list.sorted.of_cons List.Sorted.of_cons
theorem Sorted.tail {r : Ξ± β Ξ± β Prop} {l : List Ξ±} (h : Sorted r l) : Sorted r l.tail :=
Pairwise.tail h
#align list.sorted.tail List.Sorted.tail
theorem rel_of_sorted_cons {a : Ξ±} {l : List Ξ±} : Sorted r (a :: l) β β b β l, r a b :=
rel_of_pairwise_cons
#align list.rel_of_sorted_cons List.rel_of_sorted_cons
theorem Sorted.head!_le [Inhabited Ξ±] [Preorder Ξ±] {a : Ξ±} {l : List Ξ±} (h : Sorted (Β· < Β·) l)
(ha : a β l) : l.head! β€ a := by
rw [β List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
Β· exact le_rfl
Β· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
theorem Sorted.le_head! [Inhabited Ξ±] [Preorder Ξ±] {a : Ξ±} {l : List Ξ±} (h : Sorted (Β· > Β·) l)
(ha : a β l) : a β€ l.head! := by
rw [β List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
Β· exact le_rfl
Β· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
@[simp]
theorem sorted_cons {a : Ξ±} {l : List Ξ±} : Sorted r (a :: l) β (β b β l, r a b) β§ Sorted r l :=
pairwise_cons
#align list.sorted_cons List.sorted_cons
protected theorem Sorted.nodup {r : Ξ± β Ξ± β Prop} [IsIrrefl Ξ± r] {l : List Ξ±} (h : Sorted r l) :
Nodup l :=
Pairwise.nodup h
#align list.sorted.nodup List.Sorted.nodup
theorem eq_of_perm_of_sorted [IsAntisymm Ξ± r] {lβ lβ : List Ξ±} (hp : lβ ~ lβ) (hsβ : Sorted r lβ)
(hsβ : Sorted r lβ) : lβ = lβ := by
induction' hsβ with a lβ hβ hsβ IH generalizing lβ
Β· exact hp.nil_eq
Β· have : a β lβ := hp.subset (mem_cons_self _ _)
rcases append_of_mem this with β¨uβ, vβ, rflβ©
have hp' := (perm_cons a).1 (hp.trans perm_middle)
obtain rfl := IH hp' (hsβ.sublist <| by simp)
change a :: uβ ++ vβ = uβ ++ ([a] ++ vβ)
rw [β append_assoc]
congr
have : β x β uβ, x = a := fun x m =>
antisymm ((pairwise_append.1 hsβ).2.2 _ m a (mem_cons_self _ _)) (hβ _ (by simp [m]))
rw [(@eq_replicate _ a (length uβ + 1) (a :: uβ)).2,
(@eq_replicate _ a (length uβ + 1) (uβ ++ [a])).2] <;>
constructor <;>
simp [iff_true_intro this, or_comm]
#align list.eq_of_perm_of_sorted List.eq_of_perm_of_sorted
| Mathlib/Data/List/Sort.lean | 123 | 126 | theorem sublist_of_subperm_of_sorted [IsAntisymm Ξ± r] {lβ lβ : List Ξ±} (hp : lβ <+~ lβ)
(hsβ : lβ.Sorted r) (hsβ : lβ.Sorted r) : lβ <+ lβ := by |
let β¨_, h, h'β© := hp
rwa [β eq_of_perm_of_sorted h (hsβ.sublist h') hsβ]
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,484 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Infix
#align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open List.Perm
universe u
namespace List
section sort
variable {Ξ± : Type u} (r : Ξ± β Ξ± β Prop) [DecidableRel r]
local infixl:50 " βΌ " => r
section InsertionSort
@[simp]
def orderedInsert (a : Ξ±) : List Ξ± β List Ξ±
| [] => [a]
| b :: l => if a βΌ b then a :: b :: l else b :: orderedInsert a l
#align list.ordered_insert List.orderedInsert
@[simp]
def insertionSort : List Ξ± β List Ξ±
| [] => []
| b :: l => orderedInsert r b (insertionSort l)
#align list.insertion_sort List.insertionSort
@[simp]
theorem orderedInsert_nil (a : Ξ±) : [].orderedInsert r a = [a] :=
rfl
#align list.ordered_insert_nil List.orderedInsert_nil
theorem orderedInsert_length : β (L : List Ξ±) (a : Ξ±), (L.orderedInsert r a).length = L.length + 1
| [], a => rfl
| hd :: tl, a => by
dsimp [orderedInsert]
split_ifs <;> simp [orderedInsert_length tl]
#align list.ordered_insert_length List.orderedInsert_length
theorem orderedInsert_eq_take_drop (a : Ξ±) :
β l : List Ξ±,
l.orderedInsert r a = (l.takeWhile fun b => Β¬a βΌ b) ++ a :: l.dropWhile fun b => Β¬a βΌ b
| [] => rfl
| b :: l => by
dsimp only [orderedInsert]
split_ifs with h <;> simp [takeWhile, dropWhile, *, orderedInsert_eq_take_drop a l]
#align list.ordered_insert_eq_take_drop List.orderedInsert_eq_take_drop
theorem insertionSort_cons_eq_take_drop (a : Ξ±) (l : List Ξ±) :
insertionSort r (a :: l) =
((insertionSort r l).takeWhile fun b => Β¬a βΌ b) ++
a :: (insertionSort r l).dropWhile fun b => Β¬a βΌ b :=
orderedInsert_eq_take_drop r a _
#align list.insertion_sort_cons_eq_take_drop List.insertionSort_cons_eq_take_drop
@[simp]
theorem mem_orderedInsert {a b : Ξ±} {l : List Ξ±} :
a β orderedInsert r b l β a = b β¨ a β l :=
match l with
| [] => by simp [orderedInsert]
| x :: xs => by
rw [orderedInsert]
split_ifs
Β· simp [orderedInsert]
Β· rw [mem_cons, mem_cons, mem_orderedInsert, or_left_comm]
section Correctness
open Perm
theorem perm_orderedInsert (a) : β l : List Ξ±, orderedInsert r a l ~ a :: l
| [] => Perm.refl _
| b :: l => by
by_cases h : a βΌ b
Β· simp [orderedInsert, h]
Β· simpa [orderedInsert, h] using ((perm_orderedInsert a l).cons _).trans (Perm.swap _ _ _)
#align list.perm_ordered_insert List.perm_orderedInsert
| Mathlib/Data/List/Sort.lean | 273 | 275 | theorem orderedInsert_count [DecidableEq Ξ±] (L : List Ξ±) (a b : Ξ±) :
count a (L.orderedInsert r b) = count a L + if a = b then 1 else 0 := by |
rw [(L.perm_orderedInsert r b).count_eq, count_cons]
| 1 | 2.718282 | 0 | 1.4 | 5 | 1,484 |
import Mathlib.Order.Interval.Finset.Fin
#align_import data.fintype.fin from "leanprover-community/mathlib"@"759575657f189ccb424b990164c8b1fa9f55cdfe"
open Finset
open Fintype
namespace Fin
variable {Ξ± Ξ² : Type*} {n : β}
| Mathlib/Data/Fintype/Fin.lean | 25 | 27 | theorem map_valEmbedding_univ : (Finset.univ : Finset (Fin n)).map Fin.valEmbedding = Iio n := by |
ext
simp [orderIsoSubtype.symm.surjective.exists, OrderIso.symm]
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,485 |
import Mathlib.Order.Interval.Finset.Fin
#align_import data.fintype.fin from "leanprover-community/mathlib"@"759575657f189ccb424b990164c8b1fa9f55cdfe"
open Finset
open Fintype
namespace Fin
variable {Ξ± Ξ² : Type*} {n : β}
theorem map_valEmbedding_univ : (Finset.univ : Finset (Fin n)).map Fin.valEmbedding = Iio n := by
ext
simp [orderIsoSubtype.symm.surjective.exists, OrderIso.symm]
#align fin.map_subtype_embedding_univ Fin.map_valEmbedding_univ
@[simp]
theorem Ioi_zero_eq_map : Ioi (0 : Fin n.succ) = univ.map (Fin.succEmb _) :=
coe_injective <| by ext; simp [pos_iff_ne_zero]
#align fin.Ioi_zero_eq_map Fin.Ioi_zero_eq_map
@[simp]
theorem Iio_last_eq_map : Iio (Fin.last n) = Finset.univ.map Fin.castSuccEmb :=
coe_injective <| by ext; simp [lt_def]
#align fin.Iio_last_eq_map Fin.Iio_last_eq_map
@[simp]
| Mathlib/Data/Fintype/Fin.lean | 41 | 51 | theorem Ioi_succ (i : Fin n) : Ioi i.succ = (Ioi i).map (Fin.succEmb _) := by |
ext i
simp only [mem_filter, mem_Ioi, mem_map, mem_univ, true_and_iff, Function.Embedding.coeFn_mk,
exists_true_left]
constructor
Β· refine cases ?_ ?_ i
Β· rintro β¨β¨β©β©
Β· intro i hi
exact β¨i, succ_lt_succ_iff.mp hi, rflβ©
Β· rintro β¨i, hi, rflβ©
simpa
| 10 | 22,026.465795 | 2 | 1.4 | 5 | 1,485 |
import Mathlib.Order.Interval.Finset.Fin
#align_import data.fintype.fin from "leanprover-community/mathlib"@"759575657f189ccb424b990164c8b1fa9f55cdfe"
open Finset
open Fintype
namespace Fin
variable {Ξ± Ξ² : Type*} {n : β}
theorem map_valEmbedding_univ : (Finset.univ : Finset (Fin n)).map Fin.valEmbedding = Iio n := by
ext
simp [orderIsoSubtype.symm.surjective.exists, OrderIso.symm]
#align fin.map_subtype_embedding_univ Fin.map_valEmbedding_univ
@[simp]
theorem Ioi_zero_eq_map : Ioi (0 : Fin n.succ) = univ.map (Fin.succEmb _) :=
coe_injective <| by ext; simp [pos_iff_ne_zero]
#align fin.Ioi_zero_eq_map Fin.Ioi_zero_eq_map
@[simp]
theorem Iio_last_eq_map : Iio (Fin.last n) = Finset.univ.map Fin.castSuccEmb :=
coe_injective <| by ext; simp [lt_def]
#align fin.Iio_last_eq_map Fin.Iio_last_eq_map
@[simp]
theorem Ioi_succ (i : Fin n) : Ioi i.succ = (Ioi i).map (Fin.succEmb _) := by
ext i
simp only [mem_filter, mem_Ioi, mem_map, mem_univ, true_and_iff, Function.Embedding.coeFn_mk,
exists_true_left]
constructor
Β· refine cases ?_ ?_ i
Β· rintro β¨β¨β©β©
Β· intro i hi
exact β¨i, succ_lt_succ_iff.mp hi, rflβ©
Β· rintro β¨i, hi, rflβ©
simpa
#align fin.Ioi_succ Fin.Ioi_succ
@[simp]
| Mathlib/Data/Fintype/Fin.lean | 55 | 58 | theorem Iio_castSucc (i : Fin n) : Iio (castSucc i) = (Iio i).map Fin.castSuccEmb := by |
apply Finset.map_injective Fin.valEmbedding
rw [Finset.map_map, Fin.map_valEmbedding_Iio]
exact (Fin.map_valEmbedding_Iio i).symm
| 3 | 20.085537 | 1 | 1.4 | 5 | 1,485 |
import Mathlib.Order.Interval.Finset.Fin
#align_import data.fintype.fin from "leanprover-community/mathlib"@"759575657f189ccb424b990164c8b1fa9f55cdfe"
open Finset
open Fintype
namespace Fin
variable {Ξ± Ξ² : Type*} {n : β}
theorem map_valEmbedding_univ : (Finset.univ : Finset (Fin n)).map Fin.valEmbedding = Iio n := by
ext
simp [orderIsoSubtype.symm.surjective.exists, OrderIso.symm]
#align fin.map_subtype_embedding_univ Fin.map_valEmbedding_univ
@[simp]
theorem Ioi_zero_eq_map : Ioi (0 : Fin n.succ) = univ.map (Fin.succEmb _) :=
coe_injective <| by ext; simp [pos_iff_ne_zero]
#align fin.Ioi_zero_eq_map Fin.Ioi_zero_eq_map
@[simp]
theorem Iio_last_eq_map : Iio (Fin.last n) = Finset.univ.map Fin.castSuccEmb :=
coe_injective <| by ext; simp [lt_def]
#align fin.Iio_last_eq_map Fin.Iio_last_eq_map
@[simp]
theorem Ioi_succ (i : Fin n) : Ioi i.succ = (Ioi i).map (Fin.succEmb _) := by
ext i
simp only [mem_filter, mem_Ioi, mem_map, mem_univ, true_and_iff, Function.Embedding.coeFn_mk,
exists_true_left]
constructor
Β· refine cases ?_ ?_ i
Β· rintro β¨β¨β©β©
Β· intro i hi
exact β¨i, succ_lt_succ_iff.mp hi, rflβ©
Β· rintro β¨i, hi, rflβ©
simpa
#align fin.Ioi_succ Fin.Ioi_succ
@[simp]
theorem Iio_castSucc (i : Fin n) : Iio (castSucc i) = (Iio i).map Fin.castSuccEmb := by
apply Finset.map_injective Fin.valEmbedding
rw [Finset.map_map, Fin.map_valEmbedding_Iio]
exact (Fin.map_valEmbedding_Iio i).symm
#align fin.Iio_cast_succ Fin.Iio_castSucc
| Mathlib/Data/Fintype/Fin.lean | 61 | 64 | theorem card_filter_univ_succ' (p : Fin (n + 1) β Prop) [DecidablePred p] :
(univ.filter p).card = ite (p 0) 1 0 + (univ.filter (p β Fin.succ)).card := by |
rw [Fin.univ_succ, filter_cons, card_disjUnion, filter_map, card_map]
split_ifs <;> simp
| 2 | 7.389056 | 1 | 1.4 | 5 | 1,485 |
import Mathlib.Order.Interval.Finset.Fin
#align_import data.fintype.fin from "leanprover-community/mathlib"@"759575657f189ccb424b990164c8b1fa9f55cdfe"
open Finset
open Fintype
namespace Fin
variable {Ξ± Ξ² : Type*} {n : β}
theorem map_valEmbedding_univ : (Finset.univ : Finset (Fin n)).map Fin.valEmbedding = Iio n := by
ext
simp [orderIsoSubtype.symm.surjective.exists, OrderIso.symm]
#align fin.map_subtype_embedding_univ Fin.map_valEmbedding_univ
@[simp]
theorem Ioi_zero_eq_map : Ioi (0 : Fin n.succ) = univ.map (Fin.succEmb _) :=
coe_injective <| by ext; simp [pos_iff_ne_zero]
#align fin.Ioi_zero_eq_map Fin.Ioi_zero_eq_map
@[simp]
theorem Iio_last_eq_map : Iio (Fin.last n) = Finset.univ.map Fin.castSuccEmb :=
coe_injective <| by ext; simp [lt_def]
#align fin.Iio_last_eq_map Fin.Iio_last_eq_map
@[simp]
theorem Ioi_succ (i : Fin n) : Ioi i.succ = (Ioi i).map (Fin.succEmb _) := by
ext i
simp only [mem_filter, mem_Ioi, mem_map, mem_univ, true_and_iff, Function.Embedding.coeFn_mk,
exists_true_left]
constructor
Β· refine cases ?_ ?_ i
Β· rintro β¨β¨β©β©
Β· intro i hi
exact β¨i, succ_lt_succ_iff.mp hi, rflβ©
Β· rintro β¨i, hi, rflβ©
simpa
#align fin.Ioi_succ Fin.Ioi_succ
@[simp]
theorem Iio_castSucc (i : Fin n) : Iio (castSucc i) = (Iio i).map Fin.castSuccEmb := by
apply Finset.map_injective Fin.valEmbedding
rw [Finset.map_map, Fin.map_valEmbedding_Iio]
exact (Fin.map_valEmbedding_Iio i).symm
#align fin.Iio_cast_succ Fin.Iio_castSucc
theorem card_filter_univ_succ' (p : Fin (n + 1) β Prop) [DecidablePred p] :
(univ.filter p).card = ite (p 0) 1 0 + (univ.filter (p β Fin.succ)).card := by
rw [Fin.univ_succ, filter_cons, card_disjUnion, filter_map, card_map]
split_ifs <;> simp
#align fin.card_filter_univ_succ' Fin.card_filter_univ_succ'
theorem card_filter_univ_succ (p : Fin (n + 1) β Prop) [DecidablePred p] :
(univ.filter p).card =
if p 0 then (univ.filter (p β Fin.succ)).card + 1 else (univ.filter (p β Fin.succ)).card :=
(card_filter_univ_succ' p).trans (by split_ifs <;> simp [add_comm 1])
#align fin.card_filter_univ_succ Fin.card_filter_univ_succ
| Mathlib/Data/Fintype/Fin.lean | 73 | 78 | theorem card_filter_univ_eq_vector_get_eq_count [DecidableEq Ξ±] (a : Ξ±) (v : Vector Ξ± n) :
(univ.filter fun i => a = v.get i).card = v.toList.count a := by |
induction' v with n x xs hxs
Β· simp
Β· simp_rw [card_filter_univ_succ', Vector.get_cons_zero, Vector.toList_cons, Function.comp,
Vector.get_cons_succ, hxs, List.count_cons, add_comm (ite (a = x) 1 0)]
| 4 | 54.59815 | 2 | 1.4 | 5 | 1,485 |
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.NormTrace
#align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
open Finset NumberField Algebra FiniteDimensional
namespace RingOfIntegers
variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
noncomputable def norm [IsSeparable K L] : π L β* π K :=
RingOfIntegers.restrict_monoidHom
((Algebra.norm K).comp (algebraMap (π L) L : (π L) β* L))
fun x => isIntegral_norm K x.2
#align ring_of_integers.norm RingOfIntegers.norm
@[simp] lemma coe_norm [IsSeparable K L] (x : π L) :
norm K x = Algebra.norm K (x : L) := rfl
theorem coe_algebraMap_norm [IsSeparable K L] (x : π L) :
(algebraMap (π K) (π L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) :=
rfl
#align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm
theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : π K) :
algebraMap _ K (norm K (algebraMap (π K) (π L) x)) =
Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl
#align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap
| Mathlib/NumberTheory/NumberField/Norm.lean | 65 | 69 | theorem norm_algebraMap [IsSeparable K L] (x : π K) :
norm K (algebraMap (π K) (π L) x) = x ^ finrank K L := by |
rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap,
RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap,
RingOfIntegers.coe_eq_algebraMap, map_pow]
| 3 | 20.085537 | 1 | 1.4 | 5 | 1,486 |
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.NormTrace
#align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
open Finset NumberField Algebra FiniteDimensional
namespace RingOfIntegers
variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
noncomputable def norm [IsSeparable K L] : π L β* π K :=
RingOfIntegers.restrict_monoidHom
((Algebra.norm K).comp (algebraMap (π L) L : (π L) β* L))
fun x => isIntegral_norm K x.2
#align ring_of_integers.norm RingOfIntegers.norm
@[simp] lemma coe_norm [IsSeparable K L] (x : π L) :
norm K x = Algebra.norm K (x : L) := rfl
theorem coe_algebraMap_norm [IsSeparable K L] (x : π L) :
(algebraMap (π K) (π L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) :=
rfl
#align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm
theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : π K) :
algebraMap _ K (norm K (algebraMap (π K) (π L) x)) =
Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl
#align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap
theorem norm_algebraMap [IsSeparable K L] (x : π K) :
norm K (algebraMap (π K) (π L) x) = x ^ finrank K L := by
rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap,
RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap,
RingOfIntegers.coe_eq_algebraMap, map_pow]
#align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
| Mathlib/NumberTheory/NumberField/Norm.lean | 72 | 85 | theorem isUnit_norm_of_isGalois [IsGalois K L] {x : π L} : IsUnit (norm K x) β IsUnit x := by |
classical
refine β¨fun hx => ?_, IsUnit.map _β©
replace hx : IsUnit (algebraMap (π K) (π L) <| norm K x) := hx.map (algebraMap (π K) <| π L)
refine @isUnit_of_mul_isUnit_right (π L) _
β¨(univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x,
prod_mem fun Ο _ => x.2.map (Ο : L β+* L).toIntAlgHomβ© _ ?_
convert hx using 1
ext
convert_to ((univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x) *
β Ο β {(AlgEquiv.refl : L ββ[K] L)}, Ο x = _
Β· rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul,
RingOfIntegers.map_mk]
Β· rw [prod_sdiff <| subset_univ _, β norm_eq_prod_automorphisms, coe_algebraMap_norm]
| 13 | 442,413.392009 | 2 | 1.4 | 5 | 1,486 |
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.NormTrace
#align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
open Finset NumberField Algebra FiniteDimensional
namespace RingOfIntegers
variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
noncomputable def norm [IsSeparable K L] : π L β* π K :=
RingOfIntegers.restrict_monoidHom
((Algebra.norm K).comp (algebraMap (π L) L : (π L) β* L))
fun x => isIntegral_norm K x.2
#align ring_of_integers.norm RingOfIntegers.norm
@[simp] lemma coe_norm [IsSeparable K L] (x : π L) :
norm K x = Algebra.norm K (x : L) := rfl
theorem coe_algebraMap_norm [IsSeparable K L] (x : π L) :
(algebraMap (π K) (π L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) :=
rfl
#align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm
theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : π K) :
algebraMap _ K (norm K (algebraMap (π K) (π L) x)) =
Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl
#align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap
theorem norm_algebraMap [IsSeparable K L] (x : π K) :
norm K (algebraMap (π K) (π L) x) = x ^ finrank K L := by
rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap,
RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap,
RingOfIntegers.coe_eq_algebraMap, map_pow]
#align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : π L} : IsUnit (norm K x) β IsUnit x := by
classical
refine β¨fun hx => ?_, IsUnit.map _β©
replace hx : IsUnit (algebraMap (π K) (π L) <| norm K x) := hx.map (algebraMap (π K) <| π L)
refine @isUnit_of_mul_isUnit_right (π L) _
β¨(univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x,
prod_mem fun Ο _ => x.2.map (Ο : L β+* L).toIntAlgHomβ© _ ?_
convert hx using 1
ext
convert_to ((univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x) *
β Ο β {(AlgEquiv.refl : L ββ[K] L)}, Ο x = _
Β· rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul,
RingOfIntegers.map_mk]
Β· rw [prod_sdiff <| subset_univ _, β norm_eq_prod_automorphisms, coe_algebraMap_norm]
#align ring_of_integers.is_unit_norm_of_is_galois RingOfIntegers.isUnit_norm_of_isGalois
| Mathlib/NumberTheory/NumberField/Norm.lean | 90 | 99 | theorem dvd_norm [IsGalois K L] (x : π L) : x β£ algebraMap (π K) (π L) (norm K x) := by |
classical
have hint :
IsIntegral β€ (β Ο β univ.erase (AlgEquiv.refl : L ββ[K] L), Ο x) :=
IsIntegral.prod _ (fun Ο _ =>
((RingOfIntegers.isIntegral_coe x).map Ο))
refine β¨β¨_, hintβ©, ?_β©
ext
rw [coe_algebraMap_norm K x, norm_eq_prod_automorphisms]
simp [β Finset.mul_prod_erase _ _ (mem_univ AlgEquiv.refl)]
| 9 | 8,103.083928 | 2 | 1.4 | 5 | 1,486 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.