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