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.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.GCD.Basic import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Logic.Function.Iterate import Mathlib.Tactic.Ring import Mathlib.Tactic.Zify #align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" namespace Nat -- Porting note: Lean cannot find pp_nodot at the time of this port. -- @[pp_nodot] def fib (n : β„•) : β„• := ((fun p : β„• Γ— β„• => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst #align nat.fib Nat.fib @[simp] theorem fib_zero : fib 0 = 0 := rfl #align nat.fib_zero Nat.fib_zero @[simp] theorem fib_one : fib 1 = 1 := rfl #align nat.fib_one Nat.fib_one @[simp] theorem fib_two : fib 2 = 1 := rfl #align nat.fib_two Nat.fib_two theorem fib_add_two {n : β„•} : fib (n + 2) = fib n + fib (n + 1) := by simp [fib, Function.iterate_succ_apply'] #align nat.fib_add_two Nat.fib_add_two lemma fib_add_one : βˆ€ {n}, n β‰  0 β†’ fib (n + 1) = fib (n - 1) + fib n | _n + 1, _ => fib_add_two theorem fib_le_fib_succ {n : β„•} : fib n ≀ fib (n + 1) := by cases n <;> simp [fib_add_two] #align nat.fib_le_fib_succ Nat.fib_le_fib_succ @[mono] theorem fib_mono : Monotone fib := monotone_nat_of_le_succ fun _ => fib_le_fib_succ #align nat.fib_mono Nat.fib_mono @[simp] lemma fib_eq_zero : βˆ€ {n}, fib n = 0 ↔ n = 0 | 0 => Iff.rfl | 1 => Iff.rfl | n + 2 => by simp [fib_add_two, fib_eq_zero] @[simp] lemma fib_pos {n : β„•} : 0 < fib n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.fib_pos Nat.fib_pos theorem fib_add_two_sub_fib_add_one {n : β„•} : fib (n + 2) - fib (n + 1) = fib n := by rw [fib_add_two, add_tsub_cancel_right] #align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one theorem fib_lt_fib_succ {n : β„•} (hn : 2 ≀ n) : fib n < fib (n + 1) := by rcases exists_add_of_le hn with ⟨n, rfl⟩ rw [← tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos] exact succ_pos n #align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by refine strictMono_nat_of_lt_succ fun n => ?_ rw [add_right_comm] exact fib_lt_fib_succ (self_le_add_left _ _) #align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2) | _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn lemma fib_lt_fib {m : β„•} (hm : 2 ≀ m) : βˆ€ {n}, fib m < fib n ↔ m < n | 0 => by simp [hm] | 1 => by simp [hm] | n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp theorem le_fib_self {n : β„•} (five_le_n : 5 ≀ n) : n ≀ fib n := by induction' five_le_n with n five_le_n IH Β·-- 5 ≀ fib 5 rfl Β· -- n + 1 ≀ fib (n + 1) for 5 ≀ n rw [succ_le_iff] calc n ≀ fib n := IH _ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n) #align nat.le_fib_self Nat.le_fib_self lemma le_fib_add_one : βˆ€ n, n ≀ fib n + 1 | 0 => zero_le_one | 1 => one_le_two | 2 => le_rfl | 3 => le_rfl | 4 => le_rfl | _n + 5 => (le_fib_self le_add_self).trans <| le_succ _
Mathlib/Data/Nat/Fib/Basic.lean
156
161
theorem fib_coprime_fib_succ (n : β„•) : Nat.Coprime (fib n) (fib (n + 1)) := by
induction' n with n ih Β· simp Β· rw [fib_add_two] simp only [coprime_add_self_right] simp [Coprime, ih.symm]
5
148.413159
2
1.181818
11
1,246
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.GCD.Basic import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Logic.Function.Iterate import Mathlib.Tactic.Ring import Mathlib.Tactic.Zify #align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" namespace Nat -- Porting note: Lean cannot find pp_nodot at the time of this port. -- @[pp_nodot] def fib (n : β„•) : β„• := ((fun p : β„• Γ— β„• => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst #align nat.fib Nat.fib @[simp] theorem fib_zero : fib 0 = 0 := rfl #align nat.fib_zero Nat.fib_zero @[simp] theorem fib_one : fib 1 = 1 := rfl #align nat.fib_one Nat.fib_one @[simp] theorem fib_two : fib 2 = 1 := rfl #align nat.fib_two Nat.fib_two theorem fib_add_two {n : β„•} : fib (n + 2) = fib n + fib (n + 1) := by simp [fib, Function.iterate_succ_apply'] #align nat.fib_add_two Nat.fib_add_two lemma fib_add_one : βˆ€ {n}, n β‰  0 β†’ fib (n + 1) = fib (n - 1) + fib n | _n + 1, _ => fib_add_two theorem fib_le_fib_succ {n : β„•} : fib n ≀ fib (n + 1) := by cases n <;> simp [fib_add_two] #align nat.fib_le_fib_succ Nat.fib_le_fib_succ @[mono] theorem fib_mono : Monotone fib := monotone_nat_of_le_succ fun _ => fib_le_fib_succ #align nat.fib_mono Nat.fib_mono @[simp] lemma fib_eq_zero : βˆ€ {n}, fib n = 0 ↔ n = 0 | 0 => Iff.rfl | 1 => Iff.rfl | n + 2 => by simp [fib_add_two, fib_eq_zero] @[simp] lemma fib_pos {n : β„•} : 0 < fib n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.fib_pos Nat.fib_pos theorem fib_add_two_sub_fib_add_one {n : β„•} : fib (n + 2) - fib (n + 1) = fib n := by rw [fib_add_two, add_tsub_cancel_right] #align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one theorem fib_lt_fib_succ {n : β„•} (hn : 2 ≀ n) : fib n < fib (n + 1) := by rcases exists_add_of_le hn with ⟨n, rfl⟩ rw [← tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos] exact succ_pos n #align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by refine strictMono_nat_of_lt_succ fun n => ?_ rw [add_right_comm] exact fib_lt_fib_succ (self_le_add_left _ _) #align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2) | _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn lemma fib_lt_fib {m : β„•} (hm : 2 ≀ m) : βˆ€ {n}, fib m < fib n ↔ m < n | 0 => by simp [hm] | 1 => by simp [hm] | n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp theorem le_fib_self {n : β„•} (five_le_n : 5 ≀ n) : n ≀ fib n := by induction' five_le_n with n five_le_n IH Β·-- 5 ≀ fib 5 rfl Β· -- n + 1 ≀ fib (n + 1) for 5 ≀ n rw [succ_le_iff] calc n ≀ fib n := IH _ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n) #align nat.le_fib_self Nat.le_fib_self lemma le_fib_add_one : βˆ€ n, n ≀ fib n + 1 | 0 => zero_le_one | 1 => one_le_two | 2 => le_rfl | 3 => le_rfl | 4 => le_rfl | _n + 5 => (le_fib_self le_add_self).trans <| le_succ _ theorem fib_coprime_fib_succ (n : β„•) : Nat.Coprime (fib n) (fib (n + 1)) := by induction' n with n ih Β· simp Β· rw [fib_add_two] simp only [coprime_add_self_right] simp [Coprime, ih.symm] #align nat.fib_coprime_fib_succ Nat.fib_coprime_fib_succ
Mathlib/Data/Nat/Fib/Basic.lean
165
171
theorem fib_add (m n : β„•) : fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1) := by
induction' n with n ih generalizing m Β· simp Β· specialize ih (m + 1) rw [add_assoc m 1 n, add_comm 1 n] at ih simp only [fib_add_two, succ_eq_add_one, ih] ring
6
403.428793
2
1.181818
11
1,246
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.GCD.Basic import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Logic.Function.Iterate import Mathlib.Tactic.Ring import Mathlib.Tactic.Zify #align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" namespace Nat -- Porting note: Lean cannot find pp_nodot at the time of this port. -- @[pp_nodot] def fib (n : β„•) : β„• := ((fun p : β„• Γ— β„• => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst #align nat.fib Nat.fib @[simp] theorem fib_zero : fib 0 = 0 := rfl #align nat.fib_zero Nat.fib_zero @[simp] theorem fib_one : fib 1 = 1 := rfl #align nat.fib_one Nat.fib_one @[simp] theorem fib_two : fib 2 = 1 := rfl #align nat.fib_two Nat.fib_two theorem fib_add_two {n : β„•} : fib (n + 2) = fib n + fib (n + 1) := by simp [fib, Function.iterate_succ_apply'] #align nat.fib_add_two Nat.fib_add_two lemma fib_add_one : βˆ€ {n}, n β‰  0 β†’ fib (n + 1) = fib (n - 1) + fib n | _n + 1, _ => fib_add_two theorem fib_le_fib_succ {n : β„•} : fib n ≀ fib (n + 1) := by cases n <;> simp [fib_add_two] #align nat.fib_le_fib_succ Nat.fib_le_fib_succ @[mono] theorem fib_mono : Monotone fib := monotone_nat_of_le_succ fun _ => fib_le_fib_succ #align nat.fib_mono Nat.fib_mono @[simp] lemma fib_eq_zero : βˆ€ {n}, fib n = 0 ↔ n = 0 | 0 => Iff.rfl | 1 => Iff.rfl | n + 2 => by simp [fib_add_two, fib_eq_zero] @[simp] lemma fib_pos {n : β„•} : 0 < fib n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.fib_pos Nat.fib_pos theorem fib_add_two_sub_fib_add_one {n : β„•} : fib (n + 2) - fib (n + 1) = fib n := by rw [fib_add_two, add_tsub_cancel_right] #align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one theorem fib_lt_fib_succ {n : β„•} (hn : 2 ≀ n) : fib n < fib (n + 1) := by rcases exists_add_of_le hn with ⟨n, rfl⟩ rw [← tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos] exact succ_pos n #align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by refine strictMono_nat_of_lt_succ fun n => ?_ rw [add_right_comm] exact fib_lt_fib_succ (self_le_add_left _ _) #align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2) | _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn lemma fib_lt_fib {m : β„•} (hm : 2 ≀ m) : βˆ€ {n}, fib m < fib n ↔ m < n | 0 => by simp [hm] | 1 => by simp [hm] | n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp theorem le_fib_self {n : β„•} (five_le_n : 5 ≀ n) : n ≀ fib n := by induction' five_le_n with n five_le_n IH Β·-- 5 ≀ fib 5 rfl Β· -- n + 1 ≀ fib (n + 1) for 5 ≀ n rw [succ_le_iff] calc n ≀ fib n := IH _ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n) #align nat.le_fib_self Nat.le_fib_self lemma le_fib_add_one : βˆ€ n, n ≀ fib n + 1 | 0 => zero_le_one | 1 => one_le_two | 2 => le_rfl | 3 => le_rfl | 4 => le_rfl | _n + 5 => (le_fib_self le_add_self).trans <| le_succ _ theorem fib_coprime_fib_succ (n : β„•) : Nat.Coprime (fib n) (fib (n + 1)) := by induction' n with n ih Β· simp Β· rw [fib_add_two] simp only [coprime_add_self_right] simp [Coprime, ih.symm] #align nat.fib_coprime_fib_succ Nat.fib_coprime_fib_succ theorem fib_add (m n : β„•) : fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1) := by induction' n with n ih generalizing m Β· simp Β· specialize ih (m + 1) rw [add_assoc m 1 n, add_comm 1 n] at ih simp only [fib_add_two, succ_eq_add_one, ih] ring #align nat.fib_add Nat.fib_add
Mathlib/Data/Nat/Fib/Basic.lean
174
179
theorem fib_two_mul (n : β„•) : fib (2 * n) = fib n * (2 * fib (n + 1) - fib n) := by
cases n Β· simp Β· rw [two_mul, ← add_assoc, fib_add, fib_add_two, two_mul] simp only [← add_assoc, add_tsub_cancel_right] ring
5
148.413159
2
1.181818
11
1,246
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.GCD.Basic import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Logic.Function.Iterate import Mathlib.Tactic.Ring import Mathlib.Tactic.Zify #align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" namespace Nat -- Porting note: Lean cannot find pp_nodot at the time of this port. -- @[pp_nodot] def fib (n : β„•) : β„• := ((fun p : β„• Γ— β„• => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst #align nat.fib Nat.fib @[simp] theorem fib_zero : fib 0 = 0 := rfl #align nat.fib_zero Nat.fib_zero @[simp] theorem fib_one : fib 1 = 1 := rfl #align nat.fib_one Nat.fib_one @[simp] theorem fib_two : fib 2 = 1 := rfl #align nat.fib_two Nat.fib_two theorem fib_add_two {n : β„•} : fib (n + 2) = fib n + fib (n + 1) := by simp [fib, Function.iterate_succ_apply'] #align nat.fib_add_two Nat.fib_add_two lemma fib_add_one : βˆ€ {n}, n β‰  0 β†’ fib (n + 1) = fib (n - 1) + fib n | _n + 1, _ => fib_add_two theorem fib_le_fib_succ {n : β„•} : fib n ≀ fib (n + 1) := by cases n <;> simp [fib_add_two] #align nat.fib_le_fib_succ Nat.fib_le_fib_succ @[mono] theorem fib_mono : Monotone fib := monotone_nat_of_le_succ fun _ => fib_le_fib_succ #align nat.fib_mono Nat.fib_mono @[simp] lemma fib_eq_zero : βˆ€ {n}, fib n = 0 ↔ n = 0 | 0 => Iff.rfl | 1 => Iff.rfl | n + 2 => by simp [fib_add_two, fib_eq_zero] @[simp] lemma fib_pos {n : β„•} : 0 < fib n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.fib_pos Nat.fib_pos theorem fib_add_two_sub_fib_add_one {n : β„•} : fib (n + 2) - fib (n + 1) = fib n := by rw [fib_add_two, add_tsub_cancel_right] #align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one theorem fib_lt_fib_succ {n : β„•} (hn : 2 ≀ n) : fib n < fib (n + 1) := by rcases exists_add_of_le hn with ⟨n, rfl⟩ rw [← tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos] exact succ_pos n #align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by refine strictMono_nat_of_lt_succ fun n => ?_ rw [add_right_comm] exact fib_lt_fib_succ (self_le_add_left _ _) #align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2) | _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn lemma fib_lt_fib {m : β„•} (hm : 2 ≀ m) : βˆ€ {n}, fib m < fib n ↔ m < n | 0 => by simp [hm] | 1 => by simp [hm] | n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp theorem le_fib_self {n : β„•} (five_le_n : 5 ≀ n) : n ≀ fib n := by induction' five_le_n with n five_le_n IH Β·-- 5 ≀ fib 5 rfl Β· -- n + 1 ≀ fib (n + 1) for 5 ≀ n rw [succ_le_iff] calc n ≀ fib n := IH _ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n) #align nat.le_fib_self Nat.le_fib_self lemma le_fib_add_one : βˆ€ n, n ≀ fib n + 1 | 0 => zero_le_one | 1 => one_le_two | 2 => le_rfl | 3 => le_rfl | 4 => le_rfl | _n + 5 => (le_fib_self le_add_self).trans <| le_succ _ theorem fib_coprime_fib_succ (n : β„•) : Nat.Coprime (fib n) (fib (n + 1)) := by induction' n with n ih Β· simp Β· rw [fib_add_two] simp only [coprime_add_self_right] simp [Coprime, ih.symm] #align nat.fib_coprime_fib_succ Nat.fib_coprime_fib_succ theorem fib_add (m n : β„•) : fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1) := by induction' n with n ih generalizing m Β· simp Β· specialize ih (m + 1) rw [add_assoc m 1 n, add_comm 1 n] at ih simp only [fib_add_two, succ_eq_add_one, ih] ring #align nat.fib_add Nat.fib_add theorem fib_two_mul (n : β„•) : fib (2 * n) = fib n * (2 * fib (n + 1) - fib n) := by cases n Β· simp Β· rw [two_mul, ← add_assoc, fib_add, fib_add_two, two_mul] simp only [← add_assoc, add_tsub_cancel_right] ring #align nat.fib_two_mul Nat.fib_two_mul
Mathlib/Data/Nat/Fib/Basic.lean
182
184
theorem fib_two_mul_add_one (n : β„•) : fib (2 * n + 1) = fib (n + 1) ^ 2 + fib n ^ 2 := by
rw [two_mul, fib_add] ring
2
7.389056
1
1.181818
11
1,246
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.GCD.Basic import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Logic.Function.Iterate import Mathlib.Tactic.Ring import Mathlib.Tactic.Zify #align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" namespace Nat -- Porting note: Lean cannot find pp_nodot at the time of this port. -- @[pp_nodot] def fib (n : β„•) : β„• := ((fun p : β„• Γ— β„• => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst #align nat.fib Nat.fib @[simp] theorem fib_zero : fib 0 = 0 := rfl #align nat.fib_zero Nat.fib_zero @[simp] theorem fib_one : fib 1 = 1 := rfl #align nat.fib_one Nat.fib_one @[simp] theorem fib_two : fib 2 = 1 := rfl #align nat.fib_two Nat.fib_two theorem fib_add_two {n : β„•} : fib (n + 2) = fib n + fib (n + 1) := by simp [fib, Function.iterate_succ_apply'] #align nat.fib_add_two Nat.fib_add_two lemma fib_add_one : βˆ€ {n}, n β‰  0 β†’ fib (n + 1) = fib (n - 1) + fib n | _n + 1, _ => fib_add_two theorem fib_le_fib_succ {n : β„•} : fib n ≀ fib (n + 1) := by cases n <;> simp [fib_add_two] #align nat.fib_le_fib_succ Nat.fib_le_fib_succ @[mono] theorem fib_mono : Monotone fib := monotone_nat_of_le_succ fun _ => fib_le_fib_succ #align nat.fib_mono Nat.fib_mono @[simp] lemma fib_eq_zero : βˆ€ {n}, fib n = 0 ↔ n = 0 | 0 => Iff.rfl | 1 => Iff.rfl | n + 2 => by simp [fib_add_two, fib_eq_zero] @[simp] lemma fib_pos {n : β„•} : 0 < fib n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.fib_pos Nat.fib_pos theorem fib_add_two_sub_fib_add_one {n : β„•} : fib (n + 2) - fib (n + 1) = fib n := by rw [fib_add_two, add_tsub_cancel_right] #align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one theorem fib_lt_fib_succ {n : β„•} (hn : 2 ≀ n) : fib n < fib (n + 1) := by rcases exists_add_of_le hn with ⟨n, rfl⟩ rw [← tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos] exact succ_pos n #align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by refine strictMono_nat_of_lt_succ fun n => ?_ rw [add_right_comm] exact fib_lt_fib_succ (self_le_add_left _ _) #align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2) | _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn lemma fib_lt_fib {m : β„•} (hm : 2 ≀ m) : βˆ€ {n}, fib m < fib n ↔ m < n | 0 => by simp [hm] | 1 => by simp [hm] | n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp theorem le_fib_self {n : β„•} (five_le_n : 5 ≀ n) : n ≀ fib n := by induction' five_le_n with n five_le_n IH Β·-- 5 ≀ fib 5 rfl Β· -- n + 1 ≀ fib (n + 1) for 5 ≀ n rw [succ_le_iff] calc n ≀ fib n := IH _ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n) #align nat.le_fib_self Nat.le_fib_self lemma le_fib_add_one : βˆ€ n, n ≀ fib n + 1 | 0 => zero_le_one | 1 => one_le_two | 2 => le_rfl | 3 => le_rfl | 4 => le_rfl | _n + 5 => (le_fib_self le_add_self).trans <| le_succ _ theorem fib_coprime_fib_succ (n : β„•) : Nat.Coprime (fib n) (fib (n + 1)) := by induction' n with n ih Β· simp Β· rw [fib_add_two] simp only [coprime_add_self_right] simp [Coprime, ih.symm] #align nat.fib_coprime_fib_succ Nat.fib_coprime_fib_succ theorem fib_add (m n : β„•) : fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1) := by induction' n with n ih generalizing m Β· simp Β· specialize ih (m + 1) rw [add_assoc m 1 n, add_comm 1 n] at ih simp only [fib_add_two, succ_eq_add_one, ih] ring #align nat.fib_add Nat.fib_add theorem fib_two_mul (n : β„•) : fib (2 * n) = fib n * (2 * fib (n + 1) - fib n) := by cases n Β· simp Β· rw [two_mul, ← add_assoc, fib_add, fib_add_two, two_mul] simp only [← add_assoc, add_tsub_cancel_right] ring #align nat.fib_two_mul Nat.fib_two_mul theorem fib_two_mul_add_one (n : β„•) : fib (2 * n + 1) = fib (n + 1) ^ 2 + fib n ^ 2 := by rw [two_mul, fib_add] ring #align nat.fib_two_mul_add_one Nat.fib_two_mul_add_one
Mathlib/Data/Nat/Fib/Basic.lean
187
194
theorem fib_two_mul_add_two (n : β„•) : fib (2 * n + 2) = fib (n + 1) * (2 * fib n + fib (n + 1)) := by
rw [fib_add_two, fib_two_mul, fib_two_mul_add_one] -- Porting note: A bunch of issues similar to [this zulip thread](https://github.com/leanprover-community/mathlib4/pull/1576) with `zify` have : fib n ≀ 2 * fib (n + 1) := le_trans fib_le_fib_succ (mul_comm 2 _ β–Έ Nat.le_mul_of_pos_right _ two_pos) zify [this] ring
6
403.428793
2
1.181818
11
1,246
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial
Mathlib/RingTheory/WittVector/WittPolynomial.lean
81
86
theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by
apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero]
4
54.59815
2
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
116
119
theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by
rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast]
3
20.085537
1
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
125
132
theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by
simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _)
6
403.428793
2
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
136
137
theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by
simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self]
1
2.718282
0
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
141
143
theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero]
2
7.389056
1
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp] theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero] #align witt_polynomial_one wittPolynomial_one
Mathlib/RingTheory/WittVector/WittPolynomial.lean
146
148
theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : β„• β†’ A) (n : β„•) : aeval f (W_ R n) = βˆ‘ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by
simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index]
1
2.718282
0
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp] theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero] #align witt_polynomial_one wittPolynomial_one theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : β„• β†’ A) (n : β„•) : aeval f (W_ R n) = βˆ‘ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index] #align aeval_witt_polynomial aeval_wittPolynomial @[simp]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
154
163
theorem wittPolynomial_zmod_self (n : β„•) : W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow] rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0, zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl] intro k hk rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ'] congr rw [mem_range] at hk rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm]
8
2,980.957987
2
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp] theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero] #align witt_polynomial_one wittPolynomial_one theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : β„• β†’ A) (n : β„•) : aeval f (W_ R n) = βˆ‘ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index] #align aeval_witt_polynomial aeval_wittPolynomial @[simp] theorem wittPolynomial_zmod_self (n : β„•) : W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by simp only [wittPolynomial_eq_sum_C_mul_X_pow] rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0, zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl] intro k hk rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ'] congr rw [mem_range] at hk rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm] #align witt_polynomial_zmod_self wittPolynomial_zmod_self section PPrime variable [hp : NeZero p]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
170
181
theorem wittPolynomial_vars [CharZero R] (n : β„•) : (wittPolynomial p R n).vars = range (n + 1) := by
have : βˆ€ i, (monomial (Finsupp.single i (p ^ (n - i))) ((p : R) ^ i)).vars = {i} := by intro i refine vars_monomial_single i (pow_ne_zero _ hp.1) ?_ rw [← Nat.cast_pow, Nat.cast_ne_zero] exact pow_ne_zero i hp.1 rw [wittPolynomial, vars_sum_of_disjoint] Β· simp only [this, biUnion_singleton_eq_self] Β· simp only [this] intro a b h apply disjoint_singleton_left.mpr rwa [mem_singleton]
11
59,874.141715
2
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp] theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero] #align witt_polynomial_one wittPolynomial_one theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : β„• β†’ A) (n : β„•) : aeval f (W_ R n) = βˆ‘ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index] #align aeval_witt_polynomial aeval_wittPolynomial @[simp] theorem wittPolynomial_zmod_self (n : β„•) : W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by simp only [wittPolynomial_eq_sum_C_mul_X_pow] rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0, zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl] intro k hk rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ'] congr rw [mem_range] at hk rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm] #align witt_polynomial_zmod_self wittPolynomial_zmod_self section PPrime variable [hp : NeZero p] theorem wittPolynomial_vars [CharZero R] (n : β„•) : (wittPolynomial p R n).vars = range (n + 1) := by have : βˆ€ i, (monomial (Finsupp.single i (p ^ (n - i))) ((p : R) ^ i)).vars = {i} := by intro i refine vars_monomial_single i (pow_ne_zero _ hp.1) ?_ rw [← Nat.cast_pow, Nat.cast_ne_zero] exact pow_ne_zero i hp.1 rw [wittPolynomial, vars_sum_of_disjoint] Β· simp only [this, biUnion_singleton_eq_self] Β· simp only [this] intro a b h apply disjoint_singleton_left.mpr rwa [mem_singleton] #align witt_polynomial_vars wittPolynomial_vars
Mathlib/RingTheory/WittVector/WittPolynomial.lean
184
186
theorem wittPolynomial_vars_subset (n : β„•) : (wittPolynomial p R n).vars βŠ† range (n + 1) := by
rw [← map_wittPolynomial p (Int.castRingHom R), ← wittPolynomial_vars p β„€] apply vars_map
2
7.389056
1
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp] theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero] #align witt_polynomial_one wittPolynomial_one theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : β„• β†’ A) (n : β„•) : aeval f (W_ R n) = βˆ‘ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index] #align aeval_witt_polynomial aeval_wittPolynomial @[simp] theorem wittPolynomial_zmod_self (n : β„•) : W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by simp only [wittPolynomial_eq_sum_C_mul_X_pow] rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0, zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl] intro k hk rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ'] congr rw [mem_range] at hk rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm] #align witt_polynomial_zmod_self wittPolynomial_zmod_self end noncomputable def xInTermsOfW [Invertible (p : R)] : β„• β†’ MvPolynomial β„• R | n => (X n - βˆ‘ i : Fin n, C ((p : R) ^ (i : β„•)) * xInTermsOfW i ^ p ^ (n - (i : β„•))) * C ((β…Ÿ p : R) ^ n) set_option linter.uppercaseLean3 false in #align X_in_terms_of_W xInTermsOfW
Mathlib/RingTheory/WittVector/WittPolynomial.lean
211
213
theorem xInTermsOfW_eq [Invertible (p : R)] {n : β„•} : xInTermsOfW p R n = (X n - βˆ‘ i ∈ range n, C ((p: R) ^ i) * xInTermsOfW p R i ^ p ^ (n - i)) * C ((β…Ÿp : R) ^ n) := by
rw [xInTermsOfW, ← Fin.sum_univ_eq_sum_range]
1
2.718282
0
1.181818
11
1,247
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_evalβ‚‚_hom variable (p : β„•) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : β„•) : MvPolynomial β„• R := βˆ‘ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β„•) : wittPolynomial p R n = βˆ‘ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R β†’+* S) (n : β„•) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β„•) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp] theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero] #align witt_polynomial_one wittPolynomial_one theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : β„• β†’ A) (n : β„•) : aeval f (W_ R n) = βˆ‘ i ∈ range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index] #align aeval_witt_polynomial aeval_wittPolynomial @[simp] theorem wittPolynomial_zmod_self (n : β„•) : W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by simp only [wittPolynomial_eq_sum_C_mul_X_pow] rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0, zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl] intro k hk rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ'] congr rw [mem_range] at hk rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm] #align witt_polynomial_zmod_self wittPolynomial_zmod_self end noncomputable def xInTermsOfW [Invertible (p : R)] : β„• β†’ MvPolynomial β„• R | n => (X n - βˆ‘ i : Fin n, C ((p : R) ^ (i : β„•)) * xInTermsOfW i ^ p ^ (n - (i : β„•))) * C ((β…Ÿ p : R) ^ n) set_option linter.uppercaseLean3 false in #align X_in_terms_of_W xInTermsOfW theorem xInTermsOfW_eq [Invertible (p : R)] {n : β„•} : xInTermsOfW p R n = (X n - βˆ‘ i ∈ range n, C ((p: R) ^ i) * xInTermsOfW p R i ^ p ^ (n - i)) * C ((β…Ÿp : R) ^ n) := by rw [xInTermsOfW, ← Fin.sum_univ_eq_sum_range] set_option linter.uppercaseLean3 false in #align X_in_terms_of_W_eq xInTermsOfW_eq @[simp]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
218
234
theorem constantCoeff_xInTermsOfW [hp : Fact p.Prime] [Invertible (p : R)] (n : β„•) : constantCoeff (xInTermsOfW p R n) = 0 := by
apply Nat.strongInductionOn n; clear n intro n IH rw [xInTermsOfW_eq, mul_comm, RingHom.map_mul, RingHom.map_sub, map_sum, constantCoeff_C, constantCoeff_X, zero_sub, mul_neg, neg_eq_zero] -- Porting note: here, we should be able to do `rw [sum_eq_zero]`, but the goal that -- is created is not what we expect, and the sum is not replaced by zero... -- is it a bug in `rw` tactic? refine Eq.trans (?_ : _ = ((β…Ÿβ†‘p : R) ^ n)* 0) (mul_zero _) congr 1 rw [sum_eq_zero] intro m H rw [mem_range] at H simp only [RingHom.map_mul, RingHom.map_pow, map_natCast, IH m H] rw [zero_pow, mul_zero] exact pow_ne_zero _ hp.1.ne_zero
15
3,269,017.372472
2
1.181818
11
1,247
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±]
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
52
59
theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by
simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel]
3
20.085537
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Triangular def fromBlocksZero₂₁Invertible (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (D : Matrix n n Ξ±) [Invertible A] [Invertible D] : Invertible (fromBlocks A B 0 D) := invertibleOfLeftInverse _ (fromBlocks (β…Ÿ A) (-(β…Ÿ A * B * β…Ÿ D)) 0 (β…Ÿ D)) <| by simp_rw [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, zero_add, add_zero, Matrix.neg_mul, invOf_mul_self, Matrix.mul_invOf_mul_self_cancel, add_right_neg, fromBlocks_one] #align matrix.from_blocks_zero₂₁_invertible Matrix.fromBlocksZero₂₁Invertible def fromBlocksZero₁₂Invertible (A : Matrix m m Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] [Invertible D] : Invertible (fromBlocks A 0 C D) := invertibleOfLeftInverse _ (fromBlocks (β…Ÿ A) 0 (-(β…Ÿ D * C * β…Ÿ A)) (β…Ÿ D)) <| by -- a symmetry argument is more work than just copying the proof simp_rw [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, zero_add, add_zero, Matrix.neg_mul, invOf_mul_self, Matrix.mul_invOf_mul_self_cancel, add_left_neg, fromBlocks_one] #align matrix.from_blocks_zero₁₂_invertible Matrix.fromBlocksZero₁₂Invertible
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
100
104
theorem invOf_fromBlocks_zero₂₁_eq (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (D : Matrix n n Ξ±) [Invertible A] [Invertible D] [Invertible (fromBlocks A B 0 D)] : β…Ÿ (fromBlocks A B 0 D) = fromBlocks (β…Ÿ A) (-(β…Ÿ A * B * β…Ÿ D)) 0 (β…Ÿ D) := by
letI := fromBlocksZero₂₁Invertible A B D convert (rfl : β…Ÿ (fromBlocks A B 0 D) = _)
2
7.389056
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Triangular def fromBlocksZero₂₁Invertible (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (D : Matrix n n Ξ±) [Invertible A] [Invertible D] : Invertible (fromBlocks A B 0 D) := invertibleOfLeftInverse _ (fromBlocks (β…Ÿ A) (-(β…Ÿ A * B * β…Ÿ D)) 0 (β…Ÿ D)) <| by simp_rw [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, zero_add, add_zero, Matrix.neg_mul, invOf_mul_self, Matrix.mul_invOf_mul_self_cancel, add_right_neg, fromBlocks_one] #align matrix.from_blocks_zero₂₁_invertible Matrix.fromBlocksZero₂₁Invertible def fromBlocksZero₁₂Invertible (A : Matrix m m Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] [Invertible D] : Invertible (fromBlocks A 0 C D) := invertibleOfLeftInverse _ (fromBlocks (β…Ÿ A) 0 (-(β…Ÿ D * C * β…Ÿ A)) (β…Ÿ D)) <| by -- a symmetry argument is more work than just copying the proof simp_rw [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, zero_add, add_zero, Matrix.neg_mul, invOf_mul_self, Matrix.mul_invOf_mul_self_cancel, add_left_neg, fromBlocks_one] #align matrix.from_blocks_zero₁₂_invertible Matrix.fromBlocksZero₁₂Invertible theorem invOf_fromBlocks_zero₂₁_eq (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (D : Matrix n n Ξ±) [Invertible A] [Invertible D] [Invertible (fromBlocks A B 0 D)] : β…Ÿ (fromBlocks A B 0 D) = fromBlocks (β…Ÿ A) (-(β…Ÿ A * B * β…Ÿ D)) 0 (β…Ÿ D) := by letI := fromBlocksZero₂₁Invertible A B D convert (rfl : β…Ÿ (fromBlocks A B 0 D) = _) #align matrix.inv_of_from_blocks_zero₂₁_eq Matrix.invOf_fromBlocks_zero₂₁_eq
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
107
111
theorem invOf_fromBlocks_zero₁₂_eq (A : Matrix m m Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] [Invertible D] [Invertible (fromBlocks A 0 C D)] : β…Ÿ (fromBlocks A 0 C D) = fromBlocks (β…Ÿ A) 0 (-(β…Ÿ D * C * β…Ÿ A)) (β…Ÿ D) := by
letI := fromBlocksZero₁₂Invertible A C D convert (rfl : β…Ÿ (fromBlocks A 0 C D) = _)
2
7.389056
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
390
394
theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by
rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one]
2
7.389056
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp]
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
398
401
theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by
haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul]
2
7.389056
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp] theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
406
413
theorem det_fromBlocksβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : (Matrix.fromBlocks A B C D).det = det D * det (A - B * β…Ÿ D * C) := by
have : fromBlocks A B C D = (fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by ext (i j) cases i <;> cases j <;> rfl rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁]
5
148.413159
2
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp] theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁ theorem det_fromBlocksβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : (Matrix.fromBlocks A B C D).det = det D * det (A - B * β…Ÿ D * C) := by have : fromBlocks A B C D = (fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by ext (i j) cases i <;> cases j <;> rfl rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁] #align matrix.det_from_blocksβ‚‚β‚‚ Matrix.det_fromBlocksβ‚‚β‚‚ @[simp]
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
417
420
theorem det_fromBlocks_oneβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) : (Matrix.fromBlocks A B C 1).det = det (A - B * C) := by
haveI : Invertible (1 : Matrix n n Ξ±) := invertibleOne rw [det_fromBlocksβ‚‚β‚‚, invOf_one, Matrix.mul_one, det_one, one_mul]
2
7.389056
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp] theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁ theorem det_fromBlocksβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : (Matrix.fromBlocks A B C D).det = det D * det (A - B * β…Ÿ D * C) := by have : fromBlocks A B C D = (fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by ext (i j) cases i <;> cases j <;> rfl rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁] #align matrix.det_from_blocksβ‚‚β‚‚ Matrix.det_fromBlocksβ‚‚β‚‚ @[simp] theorem det_fromBlocks_oneβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) : (Matrix.fromBlocks A B C 1).det = det (A - B * C) := by haveI : Invertible (1 : Matrix n n Ξ±) := invertibleOne rw [det_fromBlocksβ‚‚β‚‚, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_oneβ‚‚β‚‚ Matrix.det_fromBlocks_oneβ‚‚β‚‚
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
425
430
theorem det_one_add_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 + A * B) = det (1 + B * A) := calc det (1 + A * B) = det (fromBlocks 1 (-A) B 1) := by
rw [det_fromBlocks_oneβ‚‚β‚‚, Matrix.neg_mul, sub_neg_eq_add] _ = det (1 + B * A) := by rw [det_fromBlocks_one₁₁, Matrix.mul_neg, sub_neg_eq_add]
2
7.389056
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp] theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁ theorem det_fromBlocksβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : (Matrix.fromBlocks A B C D).det = det D * det (A - B * β…Ÿ D * C) := by have : fromBlocks A B C D = (fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by ext (i j) cases i <;> cases j <;> rfl rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁] #align matrix.det_from_blocksβ‚‚β‚‚ Matrix.det_fromBlocksβ‚‚β‚‚ @[simp] theorem det_fromBlocks_oneβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) : (Matrix.fromBlocks A B C 1).det = det (A - B * C) := by haveI : Invertible (1 : Matrix n n Ξ±) := invertibleOne rw [det_fromBlocksβ‚‚β‚‚, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_oneβ‚‚β‚‚ Matrix.det_fromBlocks_oneβ‚‚β‚‚ theorem det_one_add_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 + A * B) = det (1 + B * A) := calc det (1 + A * B) = det (fromBlocks 1 (-A) B 1) := by rw [det_fromBlocks_oneβ‚‚β‚‚, Matrix.neg_mul, sub_neg_eq_add] _ = det (1 + B * A) := by rw [det_fromBlocks_one₁₁, Matrix.mul_neg, sub_neg_eq_add] #align matrix.det_one_add_mul_comm Matrix.det_one_add_mul_comm
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
434
435
theorem det_mul_add_one_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (A * B + 1) = det (B * A + 1) := by
rw [add_comm, det_one_add_mul_comm, add_comm]
1
2.718282
0
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp] theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁ theorem det_fromBlocksβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : (Matrix.fromBlocks A B C D).det = det D * det (A - B * β…Ÿ D * C) := by have : fromBlocks A B C D = (fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by ext (i j) cases i <;> cases j <;> rfl rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁] #align matrix.det_from_blocksβ‚‚β‚‚ Matrix.det_fromBlocksβ‚‚β‚‚ @[simp] theorem det_fromBlocks_oneβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) : (Matrix.fromBlocks A B C 1).det = det (A - B * C) := by haveI : Invertible (1 : Matrix n n Ξ±) := invertibleOne rw [det_fromBlocksβ‚‚β‚‚, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_oneβ‚‚β‚‚ Matrix.det_fromBlocks_oneβ‚‚β‚‚ theorem det_one_add_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 + A * B) = det (1 + B * A) := calc det (1 + A * B) = det (fromBlocks 1 (-A) B 1) := by rw [det_fromBlocks_oneβ‚‚β‚‚, Matrix.neg_mul, sub_neg_eq_add] _ = det (1 + B * A) := by rw [det_fromBlocks_one₁₁, Matrix.mul_neg, sub_neg_eq_add] #align matrix.det_one_add_mul_comm Matrix.det_one_add_mul_comm theorem det_mul_add_one_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (A * B + 1) = det (B * A + 1) := by rw [add_comm, det_one_add_mul_comm, add_comm] #align matrix.det_mul_add_one_comm Matrix.det_mul_add_one_comm
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
438
440
theorem det_one_sub_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 - A * B) = det (1 - B * A) := by
rw [sub_eq_add_neg, ← Matrix.neg_mul, det_one_add_mul_comm, Matrix.mul_neg, ← sub_eq_add_neg]
1
2.718282
0
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp] theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁ theorem det_fromBlocksβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : (Matrix.fromBlocks A B C D).det = det D * det (A - B * β…Ÿ D * C) := by have : fromBlocks A B C D = (fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by ext (i j) cases i <;> cases j <;> rfl rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁] #align matrix.det_from_blocksβ‚‚β‚‚ Matrix.det_fromBlocksβ‚‚β‚‚ @[simp] theorem det_fromBlocks_oneβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) : (Matrix.fromBlocks A B C 1).det = det (A - B * C) := by haveI : Invertible (1 : Matrix n n Ξ±) := invertibleOne rw [det_fromBlocksβ‚‚β‚‚, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_oneβ‚‚β‚‚ Matrix.det_fromBlocks_oneβ‚‚β‚‚ theorem det_one_add_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 + A * B) = det (1 + B * A) := calc det (1 + A * B) = det (fromBlocks 1 (-A) B 1) := by rw [det_fromBlocks_oneβ‚‚β‚‚, Matrix.neg_mul, sub_neg_eq_add] _ = det (1 + B * A) := by rw [det_fromBlocks_one₁₁, Matrix.mul_neg, sub_neg_eq_add] #align matrix.det_one_add_mul_comm Matrix.det_one_add_mul_comm theorem det_mul_add_one_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (A * B + 1) = det (B * A + 1) := by rw [add_comm, det_one_add_mul_comm, add_comm] #align matrix.det_mul_add_one_comm Matrix.det_mul_add_one_comm theorem det_one_sub_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 - A * B) = det (1 - B * A) := by rw [sub_eq_add_neg, ← Matrix.neg_mul, det_one_add_mul_comm, Matrix.mul_neg, ← sub_eq_add_neg] #align matrix.det_one_sub_mul_comm Matrix.det_one_sub_mul_comm
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
444
446
theorem det_one_add_col_mul_row (u v : m β†’ Ξ±) : det (1 + col u * row v) = 1 + v ⬝α΅₯ u := by
rw [det_one_add_mul_comm, det_unique, Pi.add_apply, Pi.add_apply, Matrix.one_apply_eq, Matrix.row_mul_col_apply]
2
7.389056
1
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section Det theorem det_fromBlocks₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible A] : (Matrix.fromBlocks A B C D).det = det A * det (D - C * β…Ÿ A * B) := by rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁, det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one] #align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁ @[simp] theorem det_fromBlocks_one₁₁ (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) : (Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by haveI : Invertible (1 : Matrix m m Ξ±) := invertibleOne rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁ theorem det_fromBlocksβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : (Matrix.fromBlocks A B C D).det = det D * det (A - B * β…Ÿ D * C) := by have : fromBlocks A B C D = (fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by ext (i j) cases i <;> cases j <;> rfl rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁] #align matrix.det_from_blocksβ‚‚β‚‚ Matrix.det_fromBlocksβ‚‚β‚‚ @[simp] theorem det_fromBlocks_oneβ‚‚β‚‚ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix n m Ξ±) : (Matrix.fromBlocks A B C 1).det = det (A - B * C) := by haveI : Invertible (1 : Matrix n n Ξ±) := invertibleOne rw [det_fromBlocksβ‚‚β‚‚, invOf_one, Matrix.mul_one, det_one, one_mul] #align matrix.det_from_blocks_oneβ‚‚β‚‚ Matrix.det_fromBlocks_oneβ‚‚β‚‚ theorem det_one_add_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 + A * B) = det (1 + B * A) := calc det (1 + A * B) = det (fromBlocks 1 (-A) B 1) := by rw [det_fromBlocks_oneβ‚‚β‚‚, Matrix.neg_mul, sub_neg_eq_add] _ = det (1 + B * A) := by rw [det_fromBlocks_one₁₁, Matrix.mul_neg, sub_neg_eq_add] #align matrix.det_one_add_mul_comm Matrix.det_one_add_mul_comm theorem det_mul_add_one_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (A * B + 1) = det (B * A + 1) := by rw [add_comm, det_one_add_mul_comm, add_comm] #align matrix.det_mul_add_one_comm Matrix.det_mul_add_one_comm theorem det_one_sub_mul_comm (A : Matrix m n Ξ±) (B : Matrix n m Ξ±) : det (1 - A * B) = det (1 - B * A) := by rw [sub_eq_add_neg, ← Matrix.neg_mul, det_one_add_mul_comm, Matrix.mul_neg, ← sub_eq_add_neg] #align matrix.det_one_sub_mul_comm Matrix.det_one_sub_mul_comm theorem det_one_add_col_mul_row (u v : m β†’ Ξ±) : det (1 + col u * row v) = 1 + v ⬝α΅₯ u := by rw [det_one_add_mul_comm, det_unique, Pi.add_apply, Pi.add_apply, Matrix.one_apply_eq, Matrix.row_mul_col_apply] #align matrix.det_one_add_col_mul_row Matrix.det_one_add_col_mul_row
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
454
459
theorem det_add_col_mul_row {A : Matrix m m Ξ±} (hA : IsUnit A.det) (u v : m β†’ Ξ±) : (A + col u * row v).det = A.det * (1 + row v * A⁻¹ * col u).det := by
nth_rewrite 1 [← Matrix.mul_one A] rwa [← Matrix.mul_nonsing_inv_cancel_left A (col u * row v), ← Matrix.mul_add, det_mul, ← Matrix.mul_assoc, det_one_add_mul_comm, ← Matrix.mul_assoc]
4
54.59815
2
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section StarOrderedRing variable {π•œ : Type*} [CommRing π•œ] [PartialOrder π•œ] [StarRing π•œ] [StarOrderedRing π•œ] scoped infixl:65 " βŠ•α΅₯ " => Sum.elim
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
482
491
theorem schur_complement_eq₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m π•œ} (B : Matrix m n π•œ) (D : Matrix n n π•œ) (x : m β†’ π•œ) (y : n β†’ π•œ) [Invertible A] (hA : A.IsHermitian) : (star (x βŠ•α΅₯ y)) α΅₯* (fromBlocks A B Bα΄΄ D) ⬝α΅₯ (x βŠ•α΅₯ y) = (star (x + (A⁻¹ * B) *α΅₯ y)) α΅₯* A ⬝α΅₯ (x + (A⁻¹ * B) *α΅₯ y) + (star y) α΅₯* (D - Bα΄΄ * A⁻¹ * B) ⬝α΅₯ y := by
simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hA.eq, conjTranspose_nonsing_inv, star_mulVec] abel
4
54.59815
2
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section StarOrderedRing variable {π•œ : Type*} [CommRing π•œ] [PartialOrder π•œ] [StarRing π•œ] [StarOrderedRing π•œ] scoped infixl:65 " βŠ•α΅₯ " => Sum.elim theorem schur_complement_eq₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m π•œ} (B : Matrix m n π•œ) (D : Matrix n n π•œ) (x : m β†’ π•œ) (y : n β†’ π•œ) [Invertible A] (hA : A.IsHermitian) : (star (x βŠ•α΅₯ y)) α΅₯* (fromBlocks A B Bα΄΄ D) ⬝α΅₯ (x βŠ•α΅₯ y) = (star (x + (A⁻¹ * B) *α΅₯ y)) α΅₯* A ⬝α΅₯ (x + (A⁻¹ * B) *α΅₯ y) + (star y) α΅₯* (D - Bα΄΄ * A⁻¹ * B) ⬝α΅₯ y := by simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hA.eq, conjTranspose_nonsing_inv, star_mulVec] abel #align matrix.schur_complement_eq₁₁ Matrix.schur_complement_eq₁₁
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
494
503
theorem schur_complement_eqβ‚‚β‚‚ [Fintype m] [Fintype n] [DecidableEq n] (A : Matrix m m π•œ) (B : Matrix m n π•œ) {D : Matrix n n π•œ} (x : m β†’ π•œ) (y : n β†’ π•œ) [Invertible D] (hD : D.IsHermitian) : (star (x βŠ•α΅₯ y)) α΅₯* (fromBlocks A B Bα΄΄ D) ⬝α΅₯ (x βŠ•α΅₯ y) = (star ((D⁻¹ * Bα΄΄) *α΅₯ x + y)) α΅₯* D ⬝α΅₯ ((D⁻¹ * Bα΄΄) *α΅₯ x + y) + (star x) α΅₯* (A - B * D⁻¹ * Bα΄΄) ⬝α΅₯ x := by
simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hD.eq, conjTranspose_nonsing_inv, star_mulVec] abel
4
54.59815
2
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section StarOrderedRing variable {π•œ : Type*} [CommRing π•œ] [PartialOrder π•œ] [StarRing π•œ] [StarOrderedRing π•œ] scoped infixl:65 " βŠ•α΅₯ " => Sum.elim theorem schur_complement_eq₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m π•œ} (B : Matrix m n π•œ) (D : Matrix n n π•œ) (x : m β†’ π•œ) (y : n β†’ π•œ) [Invertible A] (hA : A.IsHermitian) : (star (x βŠ•α΅₯ y)) α΅₯* (fromBlocks A B Bα΄΄ D) ⬝α΅₯ (x βŠ•α΅₯ y) = (star (x + (A⁻¹ * B) *α΅₯ y)) α΅₯* A ⬝α΅₯ (x + (A⁻¹ * B) *α΅₯ y) + (star y) α΅₯* (D - Bα΄΄ * A⁻¹ * B) ⬝α΅₯ y := by simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hA.eq, conjTranspose_nonsing_inv, star_mulVec] abel #align matrix.schur_complement_eq₁₁ Matrix.schur_complement_eq₁₁ theorem schur_complement_eqβ‚‚β‚‚ [Fintype m] [Fintype n] [DecidableEq n] (A : Matrix m m π•œ) (B : Matrix m n π•œ) {D : Matrix n n π•œ} (x : m β†’ π•œ) (y : n β†’ π•œ) [Invertible D] (hD : D.IsHermitian) : (star (x βŠ•α΅₯ y)) α΅₯* (fromBlocks A B Bα΄΄ D) ⬝α΅₯ (x βŠ•α΅₯ y) = (star ((D⁻¹ * Bα΄΄) *α΅₯ x + y)) α΅₯* D ⬝α΅₯ ((D⁻¹ * Bα΄΄) *α΅₯ x + y) + (star x) α΅₯* (A - B * D⁻¹ * Bα΄΄) ⬝α΅₯ x := by simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hD.eq, conjTranspose_nonsing_inv, star_mulVec] abel #align matrix.schur_complement_eqβ‚‚β‚‚ Matrix.schur_complement_eqβ‚‚β‚‚
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
506
519
theorem IsHermitian.fromBlocks₁₁ [Fintype m] [DecidableEq m] {A : Matrix m m π•œ} (B : Matrix m n π•œ) (D : Matrix n n π•œ) (hA : A.IsHermitian) : (Matrix.fromBlocks A B Bα΄΄ D).IsHermitian ↔ (D - Bα΄΄ * A⁻¹ * B).IsHermitian := by
have hBAB : (Bα΄΄ * A⁻¹ * B).IsHermitian := by apply isHermitian_conjTranspose_mul_mul apply hA.inv rw [isHermitian_fromBlocks_iff] constructor Β· intro h apply IsHermitian.sub h.2.2.2 hBAB Β· intro h refine ⟨hA, rfl, conjTranspose_conjTranspose B, ?_⟩ rw [← sub_add_cancel D] apply IsHermitian.add h hBAB
11
59,874.141715
2
1.1875
16
1,248
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.PosDef #align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af" variable {l m n Ξ± : Type*} namespace Matrix open scoped Matrix section CommRing variable [Fintype l] [Fintype m] [Fintype n] variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [CommRing Ξ±] theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m Ξ±) (B : Matrix m n Ξ±) (C : Matrix l m Ξ±) (D : Matrix l n Ξ±) [Invertible A] : fromBlocks A B C D = fromBlocks 1 0 (C * β…Ÿ A) 1 * fromBlocks A 0 0 (D - C * β…Ÿ A * B) * fromBlocks 1 (β…Ÿ A * B) 0 1 := by simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc, Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel] #align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁ theorem fromBlocks_eq_of_invertibleβ‚‚β‚‚ (A : Matrix l m Ξ±) (B : Matrix l n Ξ±) (C : Matrix n m Ξ±) (D : Matrix n n Ξ±) [Invertible D] : fromBlocks A B C D = fromBlocks 1 (B * β…Ÿ D) 0 1 * fromBlocks (A - B * β…Ÿ D * C) 0 0 D * fromBlocks 1 0 (β…Ÿ D * C) 1 := (Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A #align matrix.from_blocks_eq_of_invertibleβ‚‚β‚‚ Matrix.fromBlocks_eq_of_invertibleβ‚‚β‚‚ section StarOrderedRing variable {π•œ : Type*} [CommRing π•œ] [PartialOrder π•œ] [StarRing π•œ] [StarOrderedRing π•œ] scoped infixl:65 " βŠ•α΅₯ " => Sum.elim theorem schur_complement_eq₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m π•œ} (B : Matrix m n π•œ) (D : Matrix n n π•œ) (x : m β†’ π•œ) (y : n β†’ π•œ) [Invertible A] (hA : A.IsHermitian) : (star (x βŠ•α΅₯ y)) α΅₯* (fromBlocks A B Bα΄΄ D) ⬝α΅₯ (x βŠ•α΅₯ y) = (star (x + (A⁻¹ * B) *α΅₯ y)) α΅₯* A ⬝α΅₯ (x + (A⁻¹ * B) *α΅₯ y) + (star y) α΅₯* (D - Bα΄΄ * A⁻¹ * B) ⬝α΅₯ y := by simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hA.eq, conjTranspose_nonsing_inv, star_mulVec] abel #align matrix.schur_complement_eq₁₁ Matrix.schur_complement_eq₁₁ theorem schur_complement_eqβ‚‚β‚‚ [Fintype m] [Fintype n] [DecidableEq n] (A : Matrix m m π•œ) (B : Matrix m n π•œ) {D : Matrix n n π•œ} (x : m β†’ π•œ) (y : n β†’ π•œ) [Invertible D] (hD : D.IsHermitian) : (star (x βŠ•α΅₯ y)) α΅₯* (fromBlocks A B Bα΄΄ D) ⬝α΅₯ (x βŠ•α΅₯ y) = (star ((D⁻¹ * Bα΄΄) *α΅₯ x + y)) α΅₯* D ⬝α΅₯ ((D⁻¹ * Bα΄΄) *α΅₯ x + y) + (star x) α΅₯* (A - B * D⁻¹ * Bα΄΄) ⬝α΅₯ x := by simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hD.eq, conjTranspose_nonsing_inv, star_mulVec] abel #align matrix.schur_complement_eqβ‚‚β‚‚ Matrix.schur_complement_eqβ‚‚β‚‚ theorem IsHermitian.fromBlocks₁₁ [Fintype m] [DecidableEq m] {A : Matrix m m π•œ} (B : Matrix m n π•œ) (D : Matrix n n π•œ) (hA : A.IsHermitian) : (Matrix.fromBlocks A B Bα΄΄ D).IsHermitian ↔ (D - Bα΄΄ * A⁻¹ * B).IsHermitian := by have hBAB : (Bα΄΄ * A⁻¹ * B).IsHermitian := by apply isHermitian_conjTranspose_mul_mul apply hA.inv rw [isHermitian_fromBlocks_iff] constructor Β· intro h apply IsHermitian.sub h.2.2.2 hBAB Β· intro h refine ⟨hA, rfl, conjTranspose_conjTranspose B, ?_⟩ rw [← sub_add_cancel D] apply IsHermitian.add h hBAB #align matrix.is_hermitian.from_blocks₁₁ Matrix.IsHermitian.fromBlocks₁₁
Mathlib/LinearAlgebra/Matrix/SchurComplement.lean
522
527
theorem IsHermitian.fromBlocksβ‚‚β‚‚ [Fintype n] [DecidableEq n] (A : Matrix m m π•œ) (B : Matrix m n π•œ) {D : Matrix n n π•œ} (hD : D.IsHermitian) : (Matrix.fromBlocks A B Bα΄΄ D).IsHermitian ↔ (A - B * D⁻¹ * Bα΄΄).IsHermitian := by
rw [← isHermitian_submatrix_equiv (Equiv.sumComm n m), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] convert IsHermitian.fromBlocks₁₁ _ _ hD <;> simp
3
20.085537
1
1.1875
16
1,248
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.canonicalEmbedding open NumberField def _root_.NumberField.canonicalEmbedding : K β†’+* ((K β†’+* β„‚) β†’ β„‚) := Pi.ringHom fun Ο† => Ο† theorem _root_.NumberField.canonicalEmbedding_injective [NumberField K] : Function.Injective (NumberField.canonicalEmbedding K) := RingHom.injective _ variable {K} @[simp] theorem apply_at (Ο† : K β†’+* β„‚) (x : K) : (NumberField.canonicalEmbedding K x) Ο† = Ο† x := rfl open scoped ComplexConjugate
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
61
70
theorem conj_apply {x : ((K β†’+* β„‚) β†’ β„‚)} (Ο† : K β†’+* β„‚) (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) : conj (x Ο†) = x (ComplexEmbedding.conjugate Ο†) := by
refine Submodule.span_induction hx ?_ ?_ (fun _ _ hx hy => ?_) (fun a _ hx => ?_) Β· rintro _ ⟨x, rfl⟩ rw [apply_at, apply_at, ComplexEmbedding.conjugate_coe_eq] Β· rw [Pi.zero_apply, Pi.zero_apply, map_zero] Β· rw [Pi.add_apply, Pi.add_apply, map_add, hx, hy] Β· rw [Pi.smul_apply, Complex.real_smul, map_mul, Complex.conj_ofReal] exact congrArg ((a : β„‚) * Β·) hx
7
1,096.633158
2
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.canonicalEmbedding open NumberField def _root_.NumberField.canonicalEmbedding : K β†’+* ((K β†’+* β„‚) β†’ β„‚) := Pi.ringHom fun Ο† => Ο† theorem _root_.NumberField.canonicalEmbedding_injective [NumberField K] : Function.Injective (NumberField.canonicalEmbedding K) := RingHom.injective _ variable {K} @[simp] theorem apply_at (Ο† : K β†’+* β„‚) (x : K) : (NumberField.canonicalEmbedding K x) Ο† = Ο† x := rfl open scoped ComplexConjugate theorem conj_apply {x : ((K β†’+* β„‚) β†’ β„‚)} (Ο† : K β†’+* β„‚) (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) : conj (x Ο†) = x (ComplexEmbedding.conjugate Ο†) := by refine Submodule.span_induction hx ?_ ?_ (fun _ _ hx hy => ?_) (fun a _ hx => ?_) Β· rintro _ ⟨x, rfl⟩ rw [apply_at, apply_at, ComplexEmbedding.conjugate_coe_eq] Β· rw [Pi.zero_apply, Pi.zero_apply, map_zero] Β· rw [Pi.add_apply, Pi.add_apply, map_add, hx, hy] Β· rw [Pi.smul_apply, Complex.real_smul, map_mul, Complex.conj_ofReal] exact congrArg ((a : β„‚) * Β·) hx
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
72
74
theorem nnnorm_eq [NumberField K] (x : K) : β€–canonicalEmbedding K xβ€–β‚Š = Finset.univ.sup (fun Ο† : K β†’+* β„‚ => β€–Ο† xβ€–β‚Š) := by
simp_rw [Pi.nnnorm_def, apply_at]
1
2.718282
0
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.canonicalEmbedding open NumberField def _root_.NumberField.canonicalEmbedding : K β†’+* ((K β†’+* β„‚) β†’ β„‚) := Pi.ringHom fun Ο† => Ο† theorem _root_.NumberField.canonicalEmbedding_injective [NumberField K] : Function.Injective (NumberField.canonicalEmbedding K) := RingHom.injective _ variable {K} @[simp] theorem apply_at (Ο† : K β†’+* β„‚) (x : K) : (NumberField.canonicalEmbedding K x) Ο† = Ο† x := rfl open scoped ComplexConjugate theorem conj_apply {x : ((K β†’+* β„‚) β†’ β„‚)} (Ο† : K β†’+* β„‚) (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) : conj (x Ο†) = x (ComplexEmbedding.conjugate Ο†) := by refine Submodule.span_induction hx ?_ ?_ (fun _ _ hx hy => ?_) (fun a _ hx => ?_) Β· rintro _ ⟨x, rfl⟩ rw [apply_at, apply_at, ComplexEmbedding.conjugate_coe_eq] Β· rw [Pi.zero_apply, Pi.zero_apply, map_zero] Β· rw [Pi.add_apply, Pi.add_apply, map_add, hx, hy] Β· rw [Pi.smul_apply, Complex.real_smul, map_mul, Complex.conj_ofReal] exact congrArg ((a : β„‚) * Β·) hx theorem nnnorm_eq [NumberField K] (x : K) : β€–canonicalEmbedding K xβ€–β‚Š = Finset.univ.sup (fun Ο† : K β†’+* β„‚ => β€–Ο† xβ€–β‚Š) := by simp_rw [Pi.nnnorm_def, apply_at]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
76
85
theorem norm_le_iff [NumberField K] (x : K) (r : ℝ) : β€–canonicalEmbedding K xβ€– ≀ r ↔ βˆ€ Ο† : K β†’+* β„‚, β€–Ο† xβ€– ≀ r := by
obtain hr | hr := lt_or_le r 0 Β· obtain βŸ¨Ο†βŸ© := (inferInstance : Nonempty (K β†’+* β„‚)) refine iff_of_false ?_ ?_ Β· exact (hr.trans_le (norm_nonneg _)).not_le Β· exact fun h => hr.not_le (le_trans (norm_nonneg _) (h Ο†)) Β· lift r to NNReal using hr simp_rw [← coe_nnnorm, nnnorm_eq, NNReal.coe_le_coe, Finset.sup_le_iff, Finset.mem_univ, forall_true_left]
8
2,980.957987
2
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.canonicalEmbedding open NumberField def _root_.NumberField.canonicalEmbedding : K β†’+* ((K β†’+* β„‚) β†’ β„‚) := Pi.ringHom fun Ο† => Ο† theorem _root_.NumberField.canonicalEmbedding_injective [NumberField K] : Function.Injective (NumberField.canonicalEmbedding K) := RingHom.injective _ variable {K} @[simp] theorem apply_at (Ο† : K β†’+* β„‚) (x : K) : (NumberField.canonicalEmbedding K x) Ο† = Ο† x := rfl open scoped ComplexConjugate theorem conj_apply {x : ((K β†’+* β„‚) β†’ β„‚)} (Ο† : K β†’+* β„‚) (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) : conj (x Ο†) = x (ComplexEmbedding.conjugate Ο†) := by refine Submodule.span_induction hx ?_ ?_ (fun _ _ hx hy => ?_) (fun a _ hx => ?_) Β· rintro _ ⟨x, rfl⟩ rw [apply_at, apply_at, ComplexEmbedding.conjugate_coe_eq] Β· rw [Pi.zero_apply, Pi.zero_apply, map_zero] Β· rw [Pi.add_apply, Pi.add_apply, map_add, hx, hy] Β· rw [Pi.smul_apply, Complex.real_smul, map_mul, Complex.conj_ofReal] exact congrArg ((a : β„‚) * Β·) hx theorem nnnorm_eq [NumberField K] (x : K) : β€–canonicalEmbedding K xβ€–β‚Š = Finset.univ.sup (fun Ο† : K β†’+* β„‚ => β€–Ο† xβ€–β‚Š) := by simp_rw [Pi.nnnorm_def, apply_at] theorem norm_le_iff [NumberField K] (x : K) (r : ℝ) : β€–canonicalEmbedding K xβ€– ≀ r ↔ βˆ€ Ο† : K β†’+* β„‚, β€–Ο† xβ€– ≀ r := by obtain hr | hr := lt_or_le r 0 Β· obtain βŸ¨Ο†βŸ© := (inferInstance : Nonempty (K β†’+* β„‚)) refine iff_of_false ?_ ?_ Β· exact (hr.trans_le (norm_nonneg _)).not_le Β· exact fun h => hr.not_le (le_trans (norm_nonneg _) (h Ο†)) Β· lift r to NNReal using hr simp_rw [← coe_nnnorm, nnnorm_eq, NNReal.coe_le_coe, Finset.sup_le_iff, Finset.mem_univ, forall_true_left] variable (K) def integerLattice : Subring ((K β†’+* β„‚) β†’ β„‚) := (RingHom.range (algebraMap (π“ž K) K)).map (canonicalEmbedding K)
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
93
105
theorem integerLattice.inter_ball_finite [NumberField K] (r : ℝ) : ((integerLattice K : Set ((K β†’+* β„‚) β†’ β„‚)) ∩ Metric.closedBall 0 r).Finite := by
obtain hr | _ := lt_or_le r 0 Β· simp [Metric.closedBall_eq_empty.2 hr] Β· have heq : βˆ€ x, canonicalEmbedding K x ∈ Metric.closedBall 0 r ↔ βˆ€ Ο† : K β†’+* β„‚, β€–Ο† xβ€– ≀ r := by intro x; rw [← norm_le_iff, mem_closedBall_zero_iff] convert (Embeddings.finite_of_norm_le K β„‚ r).image (canonicalEmbedding K) ext; constructor Β· rintro ⟨⟨_, ⟨x, rfl⟩, rfl⟩, hx⟩ exact ⟨x, ⟨SetLike.coe_mem x, fun Ο† => (heq _).mp hx Ο†βŸ©, rfl⟩ Β· rintro ⟨x, ⟨hx1, hx2⟩, rfl⟩ exact ⟨⟨x, ⟨⟨x, hx1⟩, rfl⟩, rfl⟩, (heq x).mpr hx2⟩
11
59,874.141715
2
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.canonicalEmbedding open NumberField def _root_.NumberField.canonicalEmbedding : K β†’+* ((K β†’+* β„‚) β†’ β„‚) := Pi.ringHom fun Ο† => Ο† theorem _root_.NumberField.canonicalEmbedding_injective [NumberField K] : Function.Injective (NumberField.canonicalEmbedding K) := RingHom.injective _ variable {K} @[simp] theorem apply_at (Ο† : K β†’+* β„‚) (x : K) : (NumberField.canonicalEmbedding K x) Ο† = Ο† x := rfl open scoped ComplexConjugate theorem conj_apply {x : ((K β†’+* β„‚) β†’ β„‚)} (Ο† : K β†’+* β„‚) (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) : conj (x Ο†) = x (ComplexEmbedding.conjugate Ο†) := by refine Submodule.span_induction hx ?_ ?_ (fun _ _ hx hy => ?_) (fun a _ hx => ?_) Β· rintro _ ⟨x, rfl⟩ rw [apply_at, apply_at, ComplexEmbedding.conjugate_coe_eq] Β· rw [Pi.zero_apply, Pi.zero_apply, map_zero] Β· rw [Pi.add_apply, Pi.add_apply, map_add, hx, hy] Β· rw [Pi.smul_apply, Complex.real_smul, map_mul, Complex.conj_ofReal] exact congrArg ((a : β„‚) * Β·) hx theorem nnnorm_eq [NumberField K] (x : K) : β€–canonicalEmbedding K xβ€–β‚Š = Finset.univ.sup (fun Ο† : K β†’+* β„‚ => β€–Ο† xβ€–β‚Š) := by simp_rw [Pi.nnnorm_def, apply_at] theorem norm_le_iff [NumberField K] (x : K) (r : ℝ) : β€–canonicalEmbedding K xβ€– ≀ r ↔ βˆ€ Ο† : K β†’+* β„‚, β€–Ο† xβ€– ≀ r := by obtain hr | hr := lt_or_le r 0 Β· obtain βŸ¨Ο†βŸ© := (inferInstance : Nonempty (K β†’+* β„‚)) refine iff_of_false ?_ ?_ Β· exact (hr.trans_le (norm_nonneg _)).not_le Β· exact fun h => hr.not_le (le_trans (norm_nonneg _) (h Ο†)) Β· lift r to NNReal using hr simp_rw [← coe_nnnorm, nnnorm_eq, NNReal.coe_le_coe, Finset.sup_le_iff, Finset.mem_univ, forall_true_left] variable (K) def integerLattice : Subring ((K β†’+* β„‚) β†’ β„‚) := (RingHom.range (algebraMap (π“ž K) K)).map (canonicalEmbedding K) theorem integerLattice.inter_ball_finite [NumberField K] (r : ℝ) : ((integerLattice K : Set ((K β†’+* β„‚) β†’ β„‚)) ∩ Metric.closedBall 0 r).Finite := by obtain hr | _ := lt_or_le r 0 Β· simp [Metric.closedBall_eq_empty.2 hr] Β· have heq : βˆ€ x, canonicalEmbedding K x ∈ Metric.closedBall 0 r ↔ βˆ€ Ο† : K β†’+* β„‚, β€–Ο† xβ€– ≀ r := by intro x; rw [← norm_le_iff, mem_closedBall_zero_iff] convert (Embeddings.finite_of_norm_le K β„‚ r).image (canonicalEmbedding K) ext; constructor Β· rintro ⟨⟨_, ⟨x, rfl⟩, rfl⟩, hx⟩ exact ⟨x, ⟨SetLike.coe_mem x, fun Ο† => (heq _).mp hx Ο†βŸ©, rfl⟩ Β· rintro ⟨x, ⟨hx1, hx2⟩, rfl⟩ exact ⟨⟨x, ⟨⟨x, hx1⟩, rfl⟩, rfl⟩, (heq x).mpr hx2⟩ open Module Fintype FiniteDimensional noncomputable def latticeBasis [NumberField K] : Basis (Free.ChooseBasisIndex β„€ (π“ž K)) β„‚ ((K β†’+* β„‚) β†’ β„‚) := by classical -- Let `B` be the canonical basis of `(K β†’+* β„‚) β†’ β„‚`. We prove that the determinant of -- the image by `canonicalEmbedding` of the integral basis of `K` is nonzero. This -- will imply the result. let B := Pi.basisFun β„‚ (K β†’+* β„‚) let e : (K β†’+* β„‚) ≃ Free.ChooseBasisIndex β„€ (π“ž K) := equivOfCardEq ((Embeddings.card K β„‚).trans (finrank_eq_card_basis (integralBasis K))) let M := B.toMatrix (fun i => canonicalEmbedding K (integralBasis K (e i))) suffices M.det β‰  0 by rw [← isUnit_iff_ne_zero, ← Basis.det_apply, ← is_basis_iff_det] at this refine basisOfLinearIndependentOfCardEqFinrank ((linearIndependent_equiv e.symm).mpr this.1) ?_ rw [← finrank_eq_card_chooseBasisIndex, RingOfIntegers.rank, finrank_fintype_fun_eq_card, Embeddings.card] -- In order to prove that the determinant is nonzero, we show that it is equal to the -- square of the discriminant of the integral basis and thus it is not zero let N := Algebra.embeddingsMatrixReindex β„š β„‚ (fun i => integralBasis K (e i)) RingHom.equivRatAlgHom rw [show M = N.transpose by { ext:2; rfl }] rw [Matrix.det_transpose, ← pow_ne_zero_iff two_ne_zero] convert (map_ne_zero_iff _ (algebraMap β„š β„‚).injective).mpr (Algebra.discr_not_zero_of_basis β„š (integralBasis K)) rw [← Algebra.discr_reindex β„š (integralBasis K) e.symm] exact (Algebra.discr_eq_det_embeddingsMatrixReindex_pow_two β„š β„‚ (fun i => integralBasis K (e i)) RingHom.equivRatAlgHom).symm @[simp]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
139
142
theorem latticeBasis_apply [NumberField K] (i : Free.ChooseBasisIndex β„€ (π“ž K)) : latticeBasis K i = (canonicalEmbedding K) (integralBasis K i) := by
simp only [latticeBasis, integralBasis_apply, coe_basisOfLinearIndependentOfCardEqFinrank, Function.comp_apply, Equiv.apply_symm_apply]
2
7.389056
1
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
185
187
theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by
exact RingHom.injective _
1
2.718282
0
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
259
262
theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _
2
7.389056
1
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
264
267
theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp
2
7.389056
1
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
269
272
theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _
2
7.389056
1
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
274
279
theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs]
4
54.59815
2
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
281
284
theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by
rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c β€’ 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one]
2
7.389056
1
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs] theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c β€’ 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
286
288
theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K): normAtPlace w x = β€–x.1 ⟨w, hwβŸ©β€– := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos]
1
2.718282
0
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs] theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c β€’ 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one] theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K): normAtPlace w x = β€–x.1 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
290
293
theorem normAtPlace_apply_isComplex {w : InfinitePlace K} (hw : IsComplex w) (x : E K) : normAtPlace w x = β€–x.2 ⟨w, hwβŸ©β€– := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_neg (not_isReal_iff_isComplex.mpr hw)]
2
7.389056
1
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs] theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c β€’ 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one] theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K): normAtPlace w x = β€–x.1 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos] theorem normAtPlace_apply_isComplex {w : InfinitePlace K} (hw : IsComplex w) (x : E K) : normAtPlace w x = β€–x.2 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_neg (not_isReal_iff_isComplex.mpr hw)] @[simp]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
296
300
theorem normAtPlace_apply (w : InfinitePlace K) (x : K) : normAtPlace w (mixedEmbedding K x) = w x := by
simp_rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, mixedEmbedding, RingHom.prod_apply, Pi.ringHom_apply, norm_embedding_of_isReal, norm_embedding_eq, dite_eq_ite, ite_id]
3
20.085537
1
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs] theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c β€’ 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one] theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K): normAtPlace w x = β€–x.1 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos] theorem normAtPlace_apply_isComplex {w : InfinitePlace K} (hw : IsComplex w) (x : E K) : normAtPlace w x = β€–x.2 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_neg (not_isReal_iff_isComplex.mpr hw)] @[simp] theorem normAtPlace_apply (w : InfinitePlace K) (x : K) : normAtPlace w (mixedEmbedding K x) = w x := by simp_rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, mixedEmbedding, RingHom.prod_apply, Pi.ringHom_apply, norm_embedding_of_isReal, norm_embedding_eq, dite_eq_ite, ite_id]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
302
308
theorem normAtPlace_eq_zero {x : E K} : (βˆ€ w, normAtPlace w x = 0) ↔ x = 0 := by
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ Β· ext w Β· exact norm_eq_zero'.mp (normAtPlace_apply_isReal w.prop _ β–Έ h w.1) Β· exact norm_eq_zero'.mp (normAtPlace_apply_isComplex w.prop _ β–Έ h w.1) Β· simp_rw [h, map_zero, implies_true]
5
148.413159
2
1.1875
16
1,249
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} β†’ ℝ) Γ— ({w : InfinitePlace K // IsComplex w} β†’ β„‚) noncomputable def _root_.NumberField.mixedEmbedding : K β†’+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex Β· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank β„š K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K β„‚, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) β†’*β‚€ ℝ where toFun x := if hw : IsReal w then β€–x.1 ⟨w, hwβŸ©β€– else β€–x.2 ⟨w, not_isReal_iff_isComplex.mp hwβŸ©β€– map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≀ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≀ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c β€’ x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs] theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c β€’ 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one] theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K): normAtPlace w x = β€–x.1 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos] theorem normAtPlace_apply_isComplex {w : InfinitePlace K} (hw : IsComplex w) (x : E K) : normAtPlace w x = β€–x.2 ⟨w, hwβŸ©β€– := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_neg (not_isReal_iff_isComplex.mpr hw)] @[simp] theorem normAtPlace_apply (w : InfinitePlace K) (x : K) : normAtPlace w (mixedEmbedding K x) = w x := by simp_rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, mixedEmbedding, RingHom.prod_apply, Pi.ringHom_apply, norm_embedding_of_isReal, norm_embedding_eq, dite_eq_ite, ite_id] theorem normAtPlace_eq_zero {x : E K} : (βˆ€ w, normAtPlace w x = 0) ↔ x = 0 := by refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ Β· ext w Β· exact norm_eq_zero'.mp (normAtPlace_apply_isReal w.prop _ β–Έ h w.1) Β· exact norm_eq_zero'.mp (normAtPlace_apply_isComplex w.prop _ β–Έ h w.1) Β· simp_rw [h, map_zero, implies_true] variable [NumberField K]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
312
323
theorem nnnorm_eq_sup_normAtPlace (x : E K) : β€–xβ€–β‚Š = univ.sup fun w ↦ ⟨normAtPlace w x, normAtPlace_nonneg w x⟩ := by
rw [show (univ : Finset (InfinitePlace K)) = (univ.image (fun w : {w : InfinitePlace K // IsReal w} ↦ w.1)) βˆͺ (univ.image (fun w : {w : InfinitePlace K // IsComplex w} ↦ w.1)) by ext; simp [isReal_or_isComplex], sup_union, univ.sup_image, univ.sup_image, sup_eq_max, Prod.nnnorm_def', Pi.nnnorm_def, Pi.nnnorm_def] congr Β· ext w simp [normAtPlace_apply_isReal w.prop] Β· ext w simp [normAtPlace_apply_isComplex w.prop]
10
22,026.465795
2
1.1875
16
1,249
import Mathlib.Analysis.Calculus.FDeriv.Add import Mathlib.Analysis.Calculus.FDeriv.Equiv import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.Monotone import Mathlib.Data.Set.Function import Mathlib.Algebra.Group.Basic import Mathlib.Tactic.WLOG #align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped NNReal ENNReal Topology UniformConvergence open Set MeasureTheory Filter -- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context variable {Ξ± : Type*} [LinearOrder Ξ±] {E : Type*} [PseudoEMetricSpace E] noncomputable def eVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) : ℝβ‰₯0∞ := ⨆ p : β„• Γ— { u : β„• β†’ Ξ± // Monotone u ∧ βˆ€ i, u i ∈ s }, βˆ‘ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i)) #align evariation_on eVariationOn def BoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := eVariationOn f s β‰  ∞ #align has_bounded_variation_on BoundedVariationOn def LocallyBoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := βˆ€ a b, a ∈ s β†’ b ∈ s β†’ BoundedVariationOn f (s ∩ Icc a b) #align has_locally_bounded_variation_on LocallyBoundedVariationOn namespace eVariationOn
Mathlib/Analysis/BoundedVariation.lean
83
86
theorem nonempty_monotone_mem {s : Set Ξ±} (hs : s.Nonempty) : Nonempty { u // Monotone u ∧ βˆ€ i : β„•, u i ∈ s } := by
obtain ⟨x, hx⟩ := hs exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩
2
7.389056
1
1.2
5
1,250
import Mathlib.Analysis.Calculus.FDeriv.Add import Mathlib.Analysis.Calculus.FDeriv.Equiv import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.Monotone import Mathlib.Data.Set.Function import Mathlib.Algebra.Group.Basic import Mathlib.Tactic.WLOG #align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped NNReal ENNReal Topology UniformConvergence open Set MeasureTheory Filter -- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context variable {Ξ± : Type*} [LinearOrder Ξ±] {E : Type*} [PseudoEMetricSpace E] noncomputable def eVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) : ℝβ‰₯0∞ := ⨆ p : β„• Γ— { u : β„• β†’ Ξ± // Monotone u ∧ βˆ€ i, u i ∈ s }, βˆ‘ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i)) #align evariation_on eVariationOn def BoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := eVariationOn f s β‰  ∞ #align has_bounded_variation_on BoundedVariationOn def LocallyBoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := βˆ€ a b, a ∈ s β†’ b ∈ s β†’ BoundedVariationOn f (s ∩ Icc a b) #align has_locally_bounded_variation_on LocallyBoundedVariationOn namespace eVariationOn theorem nonempty_monotone_mem {s : Set Ξ±} (hs : s.Nonempty) : Nonempty { u // Monotone u ∧ βˆ€ i : β„•, u i ∈ s } := by obtain ⟨x, hx⟩ := hs exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩ #align evariation_on.nonempty_monotone_mem eVariationOn.nonempty_monotone_mem
Mathlib/Analysis/BoundedVariation.lean
89
94
theorem eq_of_edist_zero_on {f f' : Ξ± β†’ E} {s : Set Ξ±} (h : βˆ€ ⦃x⦄, x ∈ s β†’ edist (f x) (f' x) = 0) : eVariationOn f s = eVariationOn f' s := by
dsimp only [eVariationOn] congr 1 with p : 1 congr 1 with i : 1 rw [edist_congr_right (h <| p.snd.prop.2 (i + 1)), edist_congr_left (h <| p.snd.prop.2 i)]
4
54.59815
2
1.2
5
1,250
import Mathlib.Analysis.Calculus.FDeriv.Add import Mathlib.Analysis.Calculus.FDeriv.Equiv import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.Monotone import Mathlib.Data.Set.Function import Mathlib.Algebra.Group.Basic import Mathlib.Tactic.WLOG #align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped NNReal ENNReal Topology UniformConvergence open Set MeasureTheory Filter -- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context variable {Ξ± : Type*} [LinearOrder Ξ±] {E : Type*} [PseudoEMetricSpace E] noncomputable def eVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) : ℝβ‰₯0∞ := ⨆ p : β„• Γ— { u : β„• β†’ Ξ± // Monotone u ∧ βˆ€ i, u i ∈ s }, βˆ‘ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i)) #align evariation_on eVariationOn def BoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := eVariationOn f s β‰  ∞ #align has_bounded_variation_on BoundedVariationOn def LocallyBoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := βˆ€ a b, a ∈ s β†’ b ∈ s β†’ BoundedVariationOn f (s ∩ Icc a b) #align has_locally_bounded_variation_on LocallyBoundedVariationOn namespace eVariationOn theorem nonempty_monotone_mem {s : Set Ξ±} (hs : s.Nonempty) : Nonempty { u // Monotone u ∧ βˆ€ i : β„•, u i ∈ s } := by obtain ⟨x, hx⟩ := hs exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩ #align evariation_on.nonempty_monotone_mem eVariationOn.nonempty_monotone_mem theorem eq_of_edist_zero_on {f f' : Ξ± β†’ E} {s : Set Ξ±} (h : βˆ€ ⦃x⦄, x ∈ s β†’ edist (f x) (f' x) = 0) : eVariationOn f s = eVariationOn f' s := by dsimp only [eVariationOn] congr 1 with p : 1 congr 1 with i : 1 rw [edist_congr_right (h <| p.snd.prop.2 (i + 1)), edist_congr_left (h <| p.snd.prop.2 i)] #align evariation_on.eq_of_edist_zero_on eVariationOn.eq_of_edist_zero_on theorem eq_of_eqOn {f f' : Ξ± β†’ E} {s : Set Ξ±} (h : EqOn f f' s) : eVariationOn f s = eVariationOn f' s := eq_of_edist_zero_on fun x xs => by rw [h xs, edist_self] #align evariation_on.eq_of_eq_on eVariationOn.eq_of_eqOn theorem sum_le (f : Ξ± β†’ E) {s : Set Ξ±} (n : β„•) {u : β„• β†’ Ξ±} (hu : Monotone u) (us : βˆ€ i, u i ∈ s) : (βˆ‘ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl #align evariation_on.sum_le eVariationOn.sum_le
Mathlib/Analysis/BoundedVariation.lean
107
124
theorem sum_le_of_monotoneOn_Icc (f : Ξ± β†’ E) {s : Set Ξ±} {m n : β„•} {u : β„• β†’ Ξ±} (hu : MonotoneOn u (Icc m n)) (us : βˆ€ i ∈ Icc m n, u i ∈ s) : (βˆ‘ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := by
rcases le_total n m with hnm | hmn Β· simp [Finset.Ico_eq_empty_of_le hnm] let Ο€ := projIcc m n hmn let v i := u (Ο€ i) calc βˆ‘ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) = βˆ‘ i ∈ Finset.Ico m n, edist (f (v (i + 1))) (f (v i)) := Finset.sum_congr rfl fun i hi ↦ by rw [Finset.mem_Ico] at hi simp only [v, Ο€, projIcc_of_mem hmn ⟨hi.1, hi.2.le⟩, projIcc_of_mem hmn ⟨hi.1.trans i.le_succ, hi.2⟩] _ ≀ βˆ‘ i ∈ Finset.range n, edist (f (v (i + 1))) (f (v i)) := Finset.sum_mono_set _ (Nat.Iio_eq_range β–Έ Finset.Ico_subset_Iio_self) _ ≀ eVariationOn f s := sum_le _ _ (fun i j h ↦ hu (Ο€ i).2 (Ο€ j).2 (monotone_projIcc hmn h)) fun i ↦ us _ (Ο€ i).2
15
3,269,017.372472
2
1.2
5
1,250
import Mathlib.Analysis.Calculus.FDeriv.Add import Mathlib.Analysis.Calculus.FDeriv.Equiv import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.Monotone import Mathlib.Data.Set.Function import Mathlib.Algebra.Group.Basic import Mathlib.Tactic.WLOG #align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped NNReal ENNReal Topology UniformConvergence open Set MeasureTheory Filter -- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context variable {Ξ± : Type*} [LinearOrder Ξ±] {E : Type*} [PseudoEMetricSpace E] noncomputable def eVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) : ℝβ‰₯0∞ := ⨆ p : β„• Γ— { u : β„• β†’ Ξ± // Monotone u ∧ βˆ€ i, u i ∈ s }, βˆ‘ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i)) #align evariation_on eVariationOn def BoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := eVariationOn f s β‰  ∞ #align has_bounded_variation_on BoundedVariationOn def LocallyBoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := βˆ€ a b, a ∈ s β†’ b ∈ s β†’ BoundedVariationOn f (s ∩ Icc a b) #align has_locally_bounded_variation_on LocallyBoundedVariationOn namespace eVariationOn theorem nonempty_monotone_mem {s : Set Ξ±} (hs : s.Nonempty) : Nonempty { u // Monotone u ∧ βˆ€ i : β„•, u i ∈ s } := by obtain ⟨x, hx⟩ := hs exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩ #align evariation_on.nonempty_monotone_mem eVariationOn.nonempty_monotone_mem theorem eq_of_edist_zero_on {f f' : Ξ± β†’ E} {s : Set Ξ±} (h : βˆ€ ⦃x⦄, x ∈ s β†’ edist (f x) (f' x) = 0) : eVariationOn f s = eVariationOn f' s := by dsimp only [eVariationOn] congr 1 with p : 1 congr 1 with i : 1 rw [edist_congr_right (h <| p.snd.prop.2 (i + 1)), edist_congr_left (h <| p.snd.prop.2 i)] #align evariation_on.eq_of_edist_zero_on eVariationOn.eq_of_edist_zero_on theorem eq_of_eqOn {f f' : Ξ± β†’ E} {s : Set Ξ±} (h : EqOn f f' s) : eVariationOn f s = eVariationOn f' s := eq_of_edist_zero_on fun x xs => by rw [h xs, edist_self] #align evariation_on.eq_of_eq_on eVariationOn.eq_of_eqOn theorem sum_le (f : Ξ± β†’ E) {s : Set Ξ±} (n : β„•) {u : β„• β†’ Ξ±} (hu : Monotone u) (us : βˆ€ i, u i ∈ s) : (βˆ‘ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl #align evariation_on.sum_le eVariationOn.sum_le theorem sum_le_of_monotoneOn_Icc (f : Ξ± β†’ E) {s : Set Ξ±} {m n : β„•} {u : β„• β†’ Ξ±} (hu : MonotoneOn u (Icc m n)) (us : βˆ€ i ∈ Icc m n, u i ∈ s) : (βˆ‘ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := by rcases le_total n m with hnm | hmn Β· simp [Finset.Ico_eq_empty_of_le hnm] let Ο€ := projIcc m n hmn let v i := u (Ο€ i) calc βˆ‘ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) = βˆ‘ i ∈ Finset.Ico m n, edist (f (v (i + 1))) (f (v i)) := Finset.sum_congr rfl fun i hi ↦ by rw [Finset.mem_Ico] at hi simp only [v, Ο€, projIcc_of_mem hmn ⟨hi.1, hi.2.le⟩, projIcc_of_mem hmn ⟨hi.1.trans i.le_succ, hi.2⟩] _ ≀ βˆ‘ i ∈ Finset.range n, edist (f (v (i + 1))) (f (v i)) := Finset.sum_mono_set _ (Nat.Iio_eq_range β–Έ Finset.Ico_subset_Iio_self) _ ≀ eVariationOn f s := sum_le _ _ (fun i j h ↦ hu (Ο€ i).2 (Ο€ j).2 (monotone_projIcc hmn h)) fun i ↦ us _ (Ο€ i).2 #align evariation_on.sum_le_of_monotone_on_Icc eVariationOn.sum_le_of_monotoneOn_Icc
Mathlib/Analysis/BoundedVariation.lean
127
130
theorem sum_le_of_monotoneOn_Iic (f : Ξ± β†’ E) {s : Set Ξ±} {n : β„•} {u : β„• β†’ Ξ±} (hu : MonotoneOn u (Iic n)) (us : βˆ€ i ≀ n, u i ∈ s) : (βˆ‘ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := by
simpa using sum_le_of_monotoneOn_Icc f (m := 0) (hu.mono Icc_subset_Iic_self) fun i hi ↦ us i hi.2
1
2.718282
0
1.2
5
1,250
import Mathlib.Analysis.Calculus.FDeriv.Add import Mathlib.Analysis.Calculus.FDeriv.Equiv import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.Monotone import Mathlib.Data.Set.Function import Mathlib.Algebra.Group.Basic import Mathlib.Tactic.WLOG #align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped NNReal ENNReal Topology UniformConvergence open Set MeasureTheory Filter -- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context variable {Ξ± : Type*} [LinearOrder Ξ±] {E : Type*} [PseudoEMetricSpace E] noncomputable def eVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) : ℝβ‰₯0∞ := ⨆ p : β„• Γ— { u : β„• β†’ Ξ± // Monotone u ∧ βˆ€ i, u i ∈ s }, βˆ‘ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i)) #align evariation_on eVariationOn def BoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := eVariationOn f s β‰  ∞ #align has_bounded_variation_on BoundedVariationOn def LocallyBoundedVariationOn (f : Ξ± β†’ E) (s : Set Ξ±) := βˆ€ a b, a ∈ s β†’ b ∈ s β†’ BoundedVariationOn f (s ∩ Icc a b) #align has_locally_bounded_variation_on LocallyBoundedVariationOn namespace eVariationOn theorem nonempty_monotone_mem {s : Set Ξ±} (hs : s.Nonempty) : Nonempty { u // Monotone u ∧ βˆ€ i : β„•, u i ∈ s } := by obtain ⟨x, hx⟩ := hs exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩ #align evariation_on.nonempty_monotone_mem eVariationOn.nonempty_monotone_mem theorem eq_of_edist_zero_on {f f' : Ξ± β†’ E} {s : Set Ξ±} (h : βˆ€ ⦃x⦄, x ∈ s β†’ edist (f x) (f' x) = 0) : eVariationOn f s = eVariationOn f' s := by dsimp only [eVariationOn] congr 1 with p : 1 congr 1 with i : 1 rw [edist_congr_right (h <| p.snd.prop.2 (i + 1)), edist_congr_left (h <| p.snd.prop.2 i)] #align evariation_on.eq_of_edist_zero_on eVariationOn.eq_of_edist_zero_on theorem eq_of_eqOn {f f' : Ξ± β†’ E} {s : Set Ξ±} (h : EqOn f f' s) : eVariationOn f s = eVariationOn f' s := eq_of_edist_zero_on fun x xs => by rw [h xs, edist_self] #align evariation_on.eq_of_eq_on eVariationOn.eq_of_eqOn theorem sum_le (f : Ξ± β†’ E) {s : Set Ξ±} (n : β„•) {u : β„• β†’ Ξ±} (hu : Monotone u) (us : βˆ€ i, u i ∈ s) : (βˆ‘ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl #align evariation_on.sum_le eVariationOn.sum_le theorem sum_le_of_monotoneOn_Icc (f : Ξ± β†’ E) {s : Set Ξ±} {m n : β„•} {u : β„• β†’ Ξ±} (hu : MonotoneOn u (Icc m n)) (us : βˆ€ i ∈ Icc m n, u i ∈ s) : (βˆ‘ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := by rcases le_total n m with hnm | hmn Β· simp [Finset.Ico_eq_empty_of_le hnm] let Ο€ := projIcc m n hmn let v i := u (Ο€ i) calc βˆ‘ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) = βˆ‘ i ∈ Finset.Ico m n, edist (f (v (i + 1))) (f (v i)) := Finset.sum_congr rfl fun i hi ↦ by rw [Finset.mem_Ico] at hi simp only [v, Ο€, projIcc_of_mem hmn ⟨hi.1, hi.2.le⟩, projIcc_of_mem hmn ⟨hi.1.trans i.le_succ, hi.2⟩] _ ≀ βˆ‘ i ∈ Finset.range n, edist (f (v (i + 1))) (f (v i)) := Finset.sum_mono_set _ (Nat.Iio_eq_range β–Έ Finset.Ico_subset_Iio_self) _ ≀ eVariationOn f s := sum_le _ _ (fun i j h ↦ hu (Ο€ i).2 (Ο€ j).2 (monotone_projIcc hmn h)) fun i ↦ us _ (Ο€ i).2 #align evariation_on.sum_le_of_monotone_on_Icc eVariationOn.sum_le_of_monotoneOn_Icc theorem sum_le_of_monotoneOn_Iic (f : Ξ± β†’ E) {s : Set Ξ±} {n : β„•} {u : β„• β†’ Ξ±} (hu : MonotoneOn u (Iic n)) (us : βˆ€ i ≀ n, u i ∈ s) : (βˆ‘ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≀ eVariationOn f s := by simpa using sum_le_of_monotoneOn_Icc f (m := 0) (hu.mono Icc_subset_Iic_self) fun i hi ↦ us i hi.2 #align evariation_on.sum_le_of_monotone_on_Iic eVariationOn.sum_le_of_monotoneOn_Iic
Mathlib/Analysis/BoundedVariation.lean
133
136
theorem mono (f : Ξ± β†’ E) {s t : Set Ξ±} (hst : t βŠ† s) : eVariationOn f t ≀ eVariationOn f s := by
apply iSup_le _ rintro ⟨n, ⟨u, hu, ut⟩⟩ exact sum_le f n hu fun i => hst (ut i)
3
20.085537
1
1.2
5
1,250
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
Mathlib/NumberTheory/PythagoreanTriples.lean
32
34
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by
change Fin 4 at z fin_cases z <;> decide
2
7.389056
1
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four
Mathlib/NumberTheory/PythagoreanTriples.lean
37
40
theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by
suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _
3
20.085537
1
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple
Mathlib/NumberTheory/PythagoreanTriples.lean
54
56
theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by
delta PythagoreanTriple rw [add_comm]
2
7.389056
1
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm
Mathlib/NumberTheory/PythagoreanTriples.lean
60
61
theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by
simp only [PythagoreanTriple, zero_mul, zero_add]
1
2.718282
0
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : β„€} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm]
Mathlib/NumberTheory/PythagoreanTriples.lean
73
73
theorem symm : PythagoreanTriple y x z := by
rwa [pythagoreanTriple_comm]
1
2.718282
0
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : β„€} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm] theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm] #align pythagorean_triple.symm PythagoreanTriple.symm
Mathlib/NumberTheory/PythagoreanTriples.lean
78
82
theorem mul (k : β„€) : PythagoreanTriple (k * x) (k * y) (k * z) := calc k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by
ring _ = k ^ 2 * (z * z) := by rw [h.eq] _ = k * z * (k * z) := by ring
3
20.085537
1
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : β„€} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm] theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm] #align pythagorean_triple.symm PythagoreanTriple.symm theorem mul (k : β„€) : PythagoreanTriple (k * x) (k * y) (k * z) := calc k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring _ = k ^ 2 * (z * z) := by rw [h.eq] _ = k * z * (k * z) := by ring #align pythagorean_triple.mul PythagoreanTriple.mul
Mathlib/NumberTheory/PythagoreanTriples.lean
87
93
theorem mul_iff (k : β„€) (hk : k β‰  0) : PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z := by
refine ⟨?_, fun h => h.mul k⟩ simp only [PythagoreanTriple] intro h rw [← mul_left_inj' (mul_ne_zero hk hk)] convert h using 1 <;> ring
5
148.413159
2
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : β„€} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm] theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm] #align pythagorean_triple.symm PythagoreanTriple.symm theorem mul (k : β„€) : PythagoreanTriple (k * x) (k * y) (k * z) := calc k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring _ = k ^ 2 * (z * z) := by rw [h.eq] _ = k * z * (k * z) := by ring #align pythagorean_triple.mul PythagoreanTriple.mul theorem mul_iff (k : β„€) (hk : k β‰  0) : PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z := by refine ⟨?_, fun h => h.mul k⟩ simp only [PythagoreanTriple] intro h rw [← mul_left_inj' (mul_ne_zero hk hk)] convert h using 1 <;> ring #align pythagorean_triple.mul_iff PythagoreanTriple.mul_iff @[nolint unusedArguments] def IsClassified (_ : PythagoreanTriple x y z) := βˆƒ k m n : β„€, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 #align pythagorean_triple.is_classified PythagoreanTriple.IsClassified @[nolint unusedArguments] def IsPrimitiveClassified (_ : PythagoreanTriple x y z) := βˆƒ m n : β„€, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) #align pythagorean_triple.is_primitive_classified PythagoreanTriple.IsPrimitiveClassified
Mathlib/NumberTheory/PythagoreanTriples.lean
120
129
theorem mul_isClassified (k : β„€) (hc : h.IsClassified) : (h.mul k).IsClassified := by
obtain ⟨l, m, n, ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, co⟩⟩ := hc · use k * l, m, n apply And.intro _ co left constructor <;> ring · use k * l, m, n apply And.intro _ co right constructor <;> ring
9
8,103.083928
2
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : β„€} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm] theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm] #align pythagorean_triple.symm PythagoreanTriple.symm theorem mul (k : β„€) : PythagoreanTriple (k * x) (k * y) (k * z) := calc k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring _ = k ^ 2 * (z * z) := by rw [h.eq] _ = k * z * (k * z) := by ring #align pythagorean_triple.mul PythagoreanTriple.mul theorem mul_iff (k : β„€) (hk : k β‰  0) : PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z := by refine ⟨?_, fun h => h.mul k⟩ simp only [PythagoreanTriple] intro h rw [← mul_left_inj' (mul_ne_zero hk hk)] convert h using 1 <;> ring #align pythagorean_triple.mul_iff PythagoreanTriple.mul_iff @[nolint unusedArguments] def IsClassified (_ : PythagoreanTriple x y z) := βˆƒ k m n : β„€, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 #align pythagorean_triple.is_classified PythagoreanTriple.IsClassified @[nolint unusedArguments] def IsPrimitiveClassified (_ : PythagoreanTriple x y z) := βˆƒ m n : β„€, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) #align pythagorean_triple.is_primitive_classified PythagoreanTriple.IsPrimitiveClassified theorem mul_isClassified (k : β„€) (hc : h.IsClassified) : (h.mul k).IsClassified := by obtain ⟨l, m, n, ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, co⟩⟩ := hc Β· use k * l, m, n apply And.intro _ co left constructor <;> ring Β· use k * l, m, n apply And.intro _ co right constructor <;> ring #align pythagorean_triple.mul_is_classified PythagoreanTriple.mul_isClassified
Mathlib/NumberTheory/PythagoreanTriples.lean
132
161
theorem even_odd_of_coprime (hc : Int.gcd x y = 1) : x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 := by
cases' Int.emod_two_eq_zero_or_one x with hx hx <;> cases' Int.emod_two_eq_zero_or_one y with hy hy -- x even, y even Β· exfalso apply Nat.not_coprime_of_dvd_of_dvd (by decide : 1 < 2) _ _ hc Β· apply Int.natCast_dvd.1 apply Int.dvd_of_emod_eq_zero hx Β· apply Int.natCast_dvd.1 apply Int.dvd_of_emod_eq_zero hy -- x even, y odd Β· left exact ⟨hx, hy⟩ -- x odd, y even Β· right exact ⟨hx, hy⟩ -- x odd, y odd Β· exfalso obtain ⟨x0, y0, rfl, rfl⟩ : βˆƒ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 := by cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hx) with x0 hx2 cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hy) with y0 hy2 rw [sub_eq_iff_eq_add] at hx2 hy2 exact ⟨x0, y0, hx2, hy2⟩ apply Int.sq_ne_two_mod_four z rw [show z * z = 4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2 by rw [← h.eq] ring] simp only [Int.add_emod, Int.mul_emod_right, zero_add] decide
28
1,446,257,064,291.475
2
1.2
10
1,251
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β‰  2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : β„€) : z * z % 4 β‰  2 := by suffices Β¬z * z % (4 : β„•) = 2 % (4 : β„•) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : β„€) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : β„€} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : β„€} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm] theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm] #align pythagorean_triple.symm PythagoreanTriple.symm theorem mul (k : β„€) : PythagoreanTriple (k * x) (k * y) (k * z) := calc k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring _ = k ^ 2 * (z * z) := by rw [h.eq] _ = k * z * (k * z) := by ring #align pythagorean_triple.mul PythagoreanTriple.mul theorem mul_iff (k : β„€) (hk : k β‰  0) : PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z := by refine ⟨?_, fun h => h.mul k⟩ simp only [PythagoreanTriple] intro h rw [← mul_left_inj' (mul_ne_zero hk hk)] convert h using 1 <;> ring #align pythagorean_triple.mul_iff PythagoreanTriple.mul_iff @[nolint unusedArguments] def IsClassified (_ : PythagoreanTriple x y z) := βˆƒ k m n : β„€, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 #align pythagorean_triple.is_classified PythagoreanTriple.IsClassified @[nolint unusedArguments] def IsPrimitiveClassified (_ : PythagoreanTriple x y z) := βˆƒ m n : β„€, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) #align pythagorean_triple.is_primitive_classified PythagoreanTriple.IsPrimitiveClassified theorem mul_isClassified (k : β„€) (hc : h.IsClassified) : (h.mul k).IsClassified := by obtain ⟨l, m, n, ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, co⟩⟩ := hc Β· use k * l, m, n apply And.intro _ co left constructor <;> ring Β· use k * l, m, n apply And.intro _ co right constructor <;> ring #align pythagorean_triple.mul_is_classified PythagoreanTriple.mul_isClassified theorem even_odd_of_coprime (hc : Int.gcd x y = 1) : x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 := by cases' Int.emod_two_eq_zero_or_one x with hx hx <;> cases' Int.emod_two_eq_zero_or_one y with hy hy -- x even, y even Β· exfalso apply Nat.not_coprime_of_dvd_of_dvd (by decide : 1 < 2) _ _ hc Β· apply Int.natCast_dvd.1 apply Int.dvd_of_emod_eq_zero hx Β· apply Int.natCast_dvd.1 apply Int.dvd_of_emod_eq_zero hy -- x even, y odd Β· left exact ⟨hx, hy⟩ -- x odd, y even Β· right exact ⟨hx, hy⟩ -- x odd, y odd Β· exfalso obtain ⟨x0, y0, rfl, rfl⟩ : βˆƒ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 := by cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hx) with x0 hx2 cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hy) with y0 hy2 rw [sub_eq_iff_eq_add] at hx2 hy2 exact ⟨x0, y0, hx2, hy2⟩ apply Int.sq_ne_two_mod_four z rw [show z * z = 4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2 by rw [← h.eq] ring] simp only [Int.add_emod, Int.mul_emod_right, zero_add] decide #align pythagorean_triple.even_odd_of_coprime PythagoreanTriple.even_odd_of_coprime
Mathlib/NumberTheory/PythagoreanTriples.lean
164
182
theorem gcd_dvd : (Int.gcd x y : β„€) ∣ z := by
by_cases h0 : Int.gcd x y = 0 Β· have hx : x = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_left h0 have hy : y = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_right h0 have hz : z = 0 := by simpa only [PythagoreanTriple, hx, hy, add_zero, zero_eq_mul, mul_zero, or_self_iff] using h simp only [hz, dvd_zero] obtain ⟨k, x0, y0, _, h2, rfl, rfl⟩ : βˆƒ (k : β„•) (x0 y0 : _), 0 < k ∧ Int.gcd x0 y0 = 1 ∧ x = x0 * k ∧ y = y0 * k := Int.exists_gcd_one' (Nat.pos_of_ne_zero h0) rw [Int.gcd_mul_right, h2, Int.natAbs_ofNat, one_mul] rw [← Int.pow_dvd_pow_iff two_ne_zero, sq z, ← h.eq] rw [(by ring : x0 * k * (x0 * k) + y0 * k * (y0 * k) = (k : β„€) ^ 2 * (x0 * x0 + y0 * y0))] exact dvd_mul_right _ _
18
65,659,969.137331
2
1.2
10
1,251
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic #align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473" open Function variable {Ξ± Ξ² : Type*} section CovariantClassMulLe variable [LinearOrder Ξ±] section Mul variable [Mul Ξ±] @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean
90
94
theorem lt_or_lt_of_mul_lt_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ < aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ < bβ‚‚ := by
contrapose! exact fun h => mul_le_mul' h.1 h.2
2
7.389056
1
1.2
5
1,252
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic #align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473" open Function variable {Ξ± Ξ² : Type*} section CovariantClassMulLe variable [LinearOrder Ξ±] section Mul variable [Mul Ξ±] @[to_additive] theorem lt_or_lt_of_mul_lt_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ < aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ < bβ‚‚ := by contrapose! exact fun h => mul_le_mul' h.1 h.2 #align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul #align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean
99
103
theorem le_or_lt_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ ≀ aβ‚‚ ∨ b₁ < bβ‚‚ := by
contrapose! exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2
2
7.389056
1
1.2
5
1,252
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic #align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473" open Function variable {Ξ± Ξ² : Type*} section CovariantClassMulLe variable [LinearOrder Ξ±] section Mul variable [Mul Ξ±] @[to_additive] theorem lt_or_lt_of_mul_lt_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ < aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ < bβ‚‚ := by contrapose! exact fun h => mul_le_mul' h.1 h.2 #align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul #align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add @[to_additive] theorem le_or_lt_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ ≀ aβ‚‚ ∨ b₁ < bβ‚‚ := by contrapose! exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2 #align le_or_lt_of_mul_le_mul le_or_lt_of_mul_le_mul #align le_or_lt_of_add_le_add le_or_lt_of_add_le_add @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean
108
112
theorem lt_or_le_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ ≀ bβ‚‚ := by
contrapose! exact fun h => mul_lt_mul_of_le_of_lt h.1 h.2
2
7.389056
1
1.2
5
1,252
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic #align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473" open Function variable {Ξ± Ξ² : Type*} section CovariantClassMulLe variable [LinearOrder Ξ±] section Mul variable [Mul Ξ±] @[to_additive] theorem lt_or_lt_of_mul_lt_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ < aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ < bβ‚‚ := by contrapose! exact fun h => mul_le_mul' h.1 h.2 #align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul #align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add @[to_additive] theorem le_or_lt_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ ≀ aβ‚‚ ∨ b₁ < bβ‚‚ := by contrapose! exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2 #align le_or_lt_of_mul_le_mul le_or_lt_of_mul_le_mul #align le_or_lt_of_add_le_add le_or_lt_of_add_le_add @[to_additive] theorem lt_or_le_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ ≀ bβ‚‚ := by contrapose! exact fun h => mul_lt_mul_of_le_of_lt h.1 h.2 #align lt_or_le_of_mul_le_mul lt_or_le_of_mul_le_mul #align lt_or_le_of_add_le_add lt_or_le_of_add_le_add @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean
117
121
theorem le_or_le_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ ≀ aβ‚‚ ∨ b₁ ≀ bβ‚‚ := by
contrapose! exact fun h => mul_lt_mul_of_lt_of_lt h.1 h.2
2
7.389056
1
1.2
5
1,252
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic #align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473" open Function variable {Ξ± Ξ² : Type*} section CovariantClassMulLe variable [LinearOrder Ξ±] section Mul variable [Mul Ξ±] @[to_additive] theorem lt_or_lt_of_mul_lt_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ < aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ < bβ‚‚ := by contrapose! exact fun h => mul_le_mul' h.1 h.2 #align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul #align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add @[to_additive] theorem le_or_lt_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ ≀ aβ‚‚ ∨ b₁ < bβ‚‚ := by contrapose! exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2 #align le_or_lt_of_mul_le_mul le_or_lt_of_mul_le_mul #align le_or_lt_of_add_le_add le_or_lt_of_add_le_add @[to_additive] theorem lt_or_le_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ < aβ‚‚ ∨ b₁ ≀ bβ‚‚ := by contrapose! exact fun h => mul_lt_mul_of_le_of_lt h.1 h.2 #align lt_or_le_of_mul_le_mul lt_or_le_of_mul_le_mul #align lt_or_le_of_add_le_add lt_or_le_of_add_le_add @[to_additive] theorem le_or_le_of_mul_le_mul [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} : a₁ * b₁ ≀ aβ‚‚ * bβ‚‚ β†’ a₁ ≀ aβ‚‚ ∨ b₁ ≀ bβ‚‚ := by contrapose! exact fun h => mul_lt_mul_of_lt_of_lt h.1 h.2 #align le_or_le_of_mul_le_mul le_or_le_of_mul_le_mul #align le_or_le_of_add_le_add le_or_le_of_add_le_add @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean
126
133
theorem mul_lt_mul_iff_of_le_of_le [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· ≀ Β·)] [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (Function.swap (Β· * Β·)) (Β· < Β·)] {a₁ aβ‚‚ b₁ bβ‚‚ : Ξ±} (ha : a₁ ≀ aβ‚‚) (hb : b₁ ≀ bβ‚‚) : a₁ * b₁ < aβ‚‚ * bβ‚‚ ↔ a₁ < aβ‚‚ ∨ b₁ < bβ‚‚ := by
refine ⟨lt_or_lt_of_mul_lt_mul, fun h => ?_⟩ cases' h with ha' hb' · exact mul_lt_mul_of_lt_of_le ha' hb · exact mul_lt_mul_of_le_of_lt ha hb'
4
54.59815
2
1.2
5
1,252
import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Pointwise #align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Metric variable {π•œ : Type*} [RCLike π•œ] {E : Type*} [NormedAddCommGroup E]
Mathlib/Analysis/NormedSpace/RCLike.lean
36
36
theorem RCLike.norm_coe_norm {z : E} : β€–(β€–zβ€– : π•œ)β€– = β€–zβ€– := by
simp
1
2.718282
0
1.2
5
1,253
import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Pointwise #align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Metric variable {π•œ : Type*} [RCLike π•œ] {E : Type*} [NormedAddCommGroup E] theorem RCLike.norm_coe_norm {z : E} : β€–(β€–zβ€– : π•œ)β€– = β€–zβ€– := by simp #align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm variable [NormedSpace π•œ E] @[simp]
Mathlib/Analysis/NormedSpace/RCLike.lean
43
45
theorem norm_smul_inv_norm {x : E} (hx : x β‰  0) : β€–(β€–x‖⁻¹ : π•œ) β€’ xβ€– = 1 := by
have : β€–xβ€– β‰  0 := by simp [hx] field_simp [norm_smul]
2
7.389056
1
1.2
5
1,253
import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Pointwise #align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Metric variable {π•œ : Type*} [RCLike π•œ] {E : Type*} [NormedAddCommGroup E] theorem RCLike.norm_coe_norm {z : E} : β€–(β€–zβ€– : π•œ)β€– = β€–zβ€– := by simp #align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm variable [NormedSpace π•œ E] @[simp] theorem norm_smul_inv_norm {x : E} (hx : x β‰  0) : β€–(β€–x‖⁻¹ : π•œ) β€’ xβ€– = 1 := by have : β€–xβ€– β‰  0 := by simp [hx] field_simp [norm_smul] #align norm_smul_inv_norm norm_smul_inv_norm
Mathlib/Analysis/NormedSpace/RCLike.lean
49
52
theorem norm_smul_inv_norm' {r : ℝ} (r_nonneg : 0 ≀ r) {x : E} (hx : x β‰  0) : β€–((r : π•œ) * (β€–xβ€– : π•œ)⁻¹) β€’ xβ€– = r := by
have : β€–xβ€– β‰  0 := by simp [hx] field_simp [norm_smul, r_nonneg, rclike_simps]
2
7.389056
1
1.2
5
1,253
import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Pointwise #align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Metric variable {π•œ : Type*} [RCLike π•œ] {E : Type*} [NormedAddCommGroup E] theorem RCLike.norm_coe_norm {z : E} : β€–(β€–zβ€– : π•œ)β€– = β€–zβ€– := by simp #align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm variable [NormedSpace π•œ E] @[simp] theorem norm_smul_inv_norm {x : E} (hx : x β‰  0) : β€–(β€–x‖⁻¹ : π•œ) β€’ xβ€– = 1 := by have : β€–xβ€– β‰  0 := by simp [hx] field_simp [norm_smul] #align norm_smul_inv_norm norm_smul_inv_norm theorem norm_smul_inv_norm' {r : ℝ} (r_nonneg : 0 ≀ r) {x : E} (hx : x β‰  0) : β€–((r : π•œ) * (β€–xβ€– : π•œ)⁻¹) β€’ xβ€– = r := by have : β€–xβ€– β‰  0 := by simp [hx] field_simp [norm_smul, r_nonneg, rclike_simps] #align norm_smul_inv_norm' norm_smul_inv_norm'
Mathlib/Analysis/NormedSpace/RCLike.lean
55
75
theorem LinearMap.bound_of_sphere_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E β†’β‚—[π•œ] π•œ) (h : βˆ€ z ∈ sphere (0 : E) r, β€–f zβ€– ≀ c) (z : E) : β€–f zβ€– ≀ c / r * β€–zβ€– := by
by_cases z_zero : z = 0 Β· rw [z_zero] simp only [LinearMap.map_zero, norm_zero, mul_zero] exact le_rfl set z₁ := ((r : π•œ) * (β€–zβ€– : π•œ)⁻¹) β€’ z with hz₁ have norm_f_z₁ : β€–f z₁‖ ≀ c := by apply h rw [mem_sphere_zero_iff_norm] exact norm_smul_inv_norm' r_pos.le z_zero have r_ne_zero : (r : π•œ) β‰  0 := RCLike.ofReal_ne_zero.mpr r_pos.ne' have eq : f z = β€–zβ€– / r * f z₁ := by rw [hz₁, LinearMap.map_smul, smul_eq_mul] rw [← mul_assoc, ← mul_assoc, div_mul_cancelβ‚€ _ r_ne_zero, mul_inv_cancel, one_mul] simp only [z_zero, RCLike.ofReal_eq_zero, norm_eq_zero, Ne, not_false_iff] rw [eq, norm_mul, norm_div, RCLike.norm_coe_norm, RCLike.norm_of_nonneg r_pos.le, div_mul_eq_mul_div, div_mul_eq_mul_div, mul_comm] apply div_le_div _ _ r_pos rfl.ge Β· exact mul_nonneg ((norm_nonneg _).trans norm_f_z₁) (norm_nonneg z) apply mul_le_mul norm_f_z₁ rfl.le (norm_nonneg z) ((norm_nonneg _).trans norm_f_z₁)
19
178,482,300.963187
2
1.2
5
1,253
import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Pointwise #align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Metric variable {π•œ : Type*} [RCLike π•œ] {E : Type*} [NormedAddCommGroup E] theorem RCLike.norm_coe_norm {z : E} : β€–(β€–zβ€– : π•œ)β€– = β€–zβ€– := by simp #align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm variable [NormedSpace π•œ E] @[simp] theorem norm_smul_inv_norm {x : E} (hx : x β‰  0) : β€–(β€–x‖⁻¹ : π•œ) β€’ xβ€– = 1 := by have : β€–xβ€– β‰  0 := by simp [hx] field_simp [norm_smul] #align norm_smul_inv_norm norm_smul_inv_norm theorem norm_smul_inv_norm' {r : ℝ} (r_nonneg : 0 ≀ r) {x : E} (hx : x β‰  0) : β€–((r : π•œ) * (β€–xβ€– : π•œ)⁻¹) β€’ xβ€– = r := by have : β€–xβ€– β‰  0 := by simp [hx] field_simp [norm_smul, r_nonneg, rclike_simps] #align norm_smul_inv_norm' norm_smul_inv_norm' theorem LinearMap.bound_of_sphere_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E β†’β‚—[π•œ] π•œ) (h : βˆ€ z ∈ sphere (0 : E) r, β€–f zβ€– ≀ c) (z : E) : β€–f zβ€– ≀ c / r * β€–zβ€– := by by_cases z_zero : z = 0 Β· rw [z_zero] simp only [LinearMap.map_zero, norm_zero, mul_zero] exact le_rfl set z₁ := ((r : π•œ) * (β€–zβ€– : π•œ)⁻¹) β€’ z with hz₁ have norm_f_z₁ : β€–f z₁‖ ≀ c := by apply h rw [mem_sphere_zero_iff_norm] exact norm_smul_inv_norm' r_pos.le z_zero have r_ne_zero : (r : π•œ) β‰  0 := RCLike.ofReal_ne_zero.mpr r_pos.ne' have eq : f z = β€–zβ€– / r * f z₁ := by rw [hz₁, LinearMap.map_smul, smul_eq_mul] rw [← mul_assoc, ← mul_assoc, div_mul_cancelβ‚€ _ r_ne_zero, mul_inv_cancel, one_mul] simp only [z_zero, RCLike.ofReal_eq_zero, norm_eq_zero, Ne, not_false_iff] rw [eq, norm_mul, norm_div, RCLike.norm_coe_norm, RCLike.norm_of_nonneg r_pos.le, div_mul_eq_mul_div, div_mul_eq_mul_div, mul_comm] apply div_le_div _ _ r_pos rfl.ge Β· exact mul_nonneg ((norm_nonneg _).trans norm_f_z₁) (norm_nonneg z) apply mul_le_mul norm_f_z₁ rfl.le (norm_nonneg z) ((norm_nonneg _).trans norm_f_z₁) #align linear_map.bound_of_sphere_bound LinearMap.bound_of_sphere_bound theorem LinearMap.bound_of_ball_bound' {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E β†’β‚—[π•œ] π•œ) (h : βˆ€ z ∈ closedBall (0 : E) r, β€–f zβ€– ≀ c) (z : E) : β€–f zβ€– ≀ c / r * β€–zβ€– := f.bound_of_sphere_bound r_pos c (fun z hz => h z hz.le) z #align linear_map.bound_of_ball_bound' LinearMap.bound_of_ball_bound'
Mathlib/Analysis/NormedSpace/RCLike.lean
85
93
theorem ContinuousLinearMap.opNorm_bound_of_ball_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E β†’L[π•œ] π•œ) (h : βˆ€ z ∈ closedBall (0 : E) r, β€–f zβ€– ≀ c) : β€–fβ€– ≀ c / r := by
apply ContinuousLinearMap.opNorm_le_bound Β· apply div_nonneg _ r_pos.le exact (norm_nonneg _).trans (h 0 (by simp only [norm_zero, mem_closedBall, dist_zero_left, r_pos.le])) apply LinearMap.bound_of_ball_bound' r_pos exact fun z hz => h z hz
7
1,096.633158
2
1.2
5
1,253
import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.NormedSpace.Connected import Mathlib.LinearAlgebra.AffineSpace.ContinuousAffineEquiv open Set variable {F : Type*} [AddCommGroup F] [Module ℝ F] [TopologicalSpace F] def AmpleSet (s : Set F) : Prop := βˆ€ x ∈ s, convexHull ℝ (connectedComponentIn s x) = univ @[simp]
Mathlib/Analysis/Convex/AmpleSet.lean
53
56
theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] : AmpleSet (univ : Set F) := by
intro x _ rw [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ, convexHull_univ]
2
7.389056
1
1.2
5
1,254
import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.NormedSpace.Connected import Mathlib.LinearAlgebra.AffineSpace.ContinuousAffineEquiv open Set variable {F : Type*} [AddCommGroup F] [Module ℝ F] [TopologicalSpace F] def AmpleSet (s : Set F) : Prop := βˆ€ x ∈ s, convexHull ℝ (connectedComponentIn s x) = univ @[simp] theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] : AmpleSet (univ : Set F) := by intro x _ rw [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ, convexHull_univ] @[simp] theorem ampleSet_empty : AmpleSet (βˆ… : Set F) := fun _ ↦ False.elim namespace AmpleSet
Mathlib/Analysis/Convex/AmpleSet.lean
65
74
theorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s βˆͺ t) := by
intro x hx rcases hx with (h | h) <;> -- The connected component of `x ∈ s` in `s βˆͺ t` contains the connected component of `x` in `s`, -- hence is also full; similarly for `t`. [have hx := hs x h; have hx := ht x h] <;> rw [← Set.univ_subset_iff, ← hx] <;> apply convexHull_mono <;> apply connectedComponentIn_mono <;> [apply subset_union_left; apply subset_union_right]
9
8,103.083928
2
1.2
5
1,254
import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.NormedSpace.Connected import Mathlib.LinearAlgebra.AffineSpace.ContinuousAffineEquiv open Set variable {F : Type*} [AddCommGroup F] [Module ℝ F] [TopologicalSpace F] def AmpleSet (s : Set F) : Prop := βˆ€ x ∈ s, convexHull ℝ (connectedComponentIn s x) = univ @[simp] theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] : AmpleSet (univ : Set F) := by intro x _ rw [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ, convexHull_univ] @[simp] theorem ampleSet_empty : AmpleSet (βˆ… : Set F) := fun _ ↦ False.elim namespace AmpleSet theorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s βˆͺ t) := by intro x hx rcases hx with (h | h) <;> -- The connected component of `x ∈ s` in `s βˆͺ t` contains the connected component of `x` in `s`, -- hence is also full; similarly for `t`. [have hx := hs x h; have hx := ht x h] <;> rw [← Set.univ_subset_iff, ← hx] <;> apply convexHull_mono <;> apply connectedComponentIn_mono <;> [apply subset_union_left; apply subset_union_right] variable {E : Type*} [AddCommGroup E] [Module ℝ E] [TopologicalSpace E]
Mathlib/Analysis/Convex/AmpleSet.lean
79
86
theorem image {s : Set E} (h : AmpleSet s) (L : E ≃ᡃL[ℝ] F) : AmpleSet (L '' s) := forall_mem_image.mpr fun x hx ↦ calc (convexHull ℝ) (connectedComponentIn (L '' s) (L x)) _ = (convexHull ℝ) (L '' (connectedComponentIn s x)) := .symm <| congrArg _ <| L.toHomeomorph.image_connectedComponentIn hx _ = L '' (convexHull ℝ (connectedComponentIn s x)) := .symm <| L.toAffineMap.image_convexHull _ _ = univ := by
rw [h x hx, image_univ, L.surjective.range_eq]
1
2.718282
0
1.2
5
1,254
import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.NormedSpace.Connected import Mathlib.LinearAlgebra.AffineSpace.ContinuousAffineEquiv open Set variable {F : Type*} [AddCommGroup F] [Module ℝ F] [TopologicalSpace F] def AmpleSet (s : Set F) : Prop := βˆ€ x ∈ s, convexHull ℝ (connectedComponentIn s x) = univ @[simp] theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] : AmpleSet (univ : Set F) := by intro x _ rw [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ, convexHull_univ] @[simp] theorem ampleSet_empty : AmpleSet (βˆ… : Set F) := fun _ ↦ False.elim namespace AmpleSet theorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s βˆͺ t) := by intro x hx rcases hx with (h | h) <;> -- The connected component of `x ∈ s` in `s βˆͺ t` contains the connected component of `x` in `s`, -- hence is also full; similarly for `t`. [have hx := hs x h; have hx := ht x h] <;> rw [← Set.univ_subset_iff, ← hx] <;> apply convexHull_mono <;> apply connectedComponentIn_mono <;> [apply subset_union_left; apply subset_union_right] variable {E : Type*} [AddCommGroup E] [Module ℝ E] [TopologicalSpace E] theorem image {s : Set E} (h : AmpleSet s) (L : E ≃ᡃL[ℝ] F) : AmpleSet (L '' s) := forall_mem_image.mpr fun x hx ↦ calc (convexHull ℝ) (connectedComponentIn (L '' s) (L x)) _ = (convexHull ℝ) (L '' (connectedComponentIn s x)) := .symm <| congrArg _ <| L.toHomeomorph.image_connectedComponentIn hx _ = L '' (convexHull ℝ (connectedComponentIn s x)) := .symm <| L.toAffineMap.image_convexHull _ _ = univ := by rw [h x hx, image_univ, L.surjective.range_eq] theorem image_iff {s : Set E} (L : E ≃ᡃL[ℝ] F) : AmpleSet (L '' s) ↔ AmpleSet s := ⟨fun h ↦ (L.symm_image_image s) β–Έ h.image L.symm, fun h ↦ h.image L⟩
Mathlib/Analysis/Convex/AmpleSet.lean
94
96
theorem preimage {s : Set F} (h : AmpleSet s) (L : E ≃ᡃL[ℝ] F) : AmpleSet (L ⁻¹' s) := by
rw [← L.image_symm_eq_preimage] exact h.image L.symm
2
7.389056
1
1.2
5
1,254
import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.NormedSpace.Connected import Mathlib.LinearAlgebra.AffineSpace.ContinuousAffineEquiv open Set variable {F : Type*} [AddCommGroup F] [Module ℝ F] [TopologicalSpace F] def AmpleSet (s : Set F) : Prop := βˆ€ x ∈ s, convexHull ℝ (connectedComponentIn s x) = univ @[simp] theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] : AmpleSet (univ : Set F) := by intro x _ rw [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ, convexHull_univ] @[simp] theorem ampleSet_empty : AmpleSet (βˆ… : Set F) := fun _ ↦ False.elim namespace AmpleSet theorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s βˆͺ t) := by intro x hx rcases hx with (h | h) <;> -- The connected component of `x ∈ s` in `s βˆͺ t` contains the connected component of `x` in `s`, -- hence is also full; similarly for `t`. [have hx := hs x h; have hx := ht x h] <;> rw [← Set.univ_subset_iff, ← hx] <;> apply convexHull_mono <;> apply connectedComponentIn_mono <;> [apply subset_union_left; apply subset_union_right] variable {E : Type*} [AddCommGroup E] [Module ℝ E] [TopologicalSpace E] theorem image {s : Set E} (h : AmpleSet s) (L : E ≃ᡃL[ℝ] F) : AmpleSet (L '' s) := forall_mem_image.mpr fun x hx ↦ calc (convexHull ℝ) (connectedComponentIn (L '' s) (L x)) _ = (convexHull ℝ) (L '' (connectedComponentIn s x)) := .symm <| congrArg _ <| L.toHomeomorph.image_connectedComponentIn hx _ = L '' (convexHull ℝ (connectedComponentIn s x)) := .symm <| L.toAffineMap.image_convexHull _ _ = univ := by rw [h x hx, image_univ, L.surjective.range_eq] theorem image_iff {s : Set E} (L : E ≃ᡃL[ℝ] F) : AmpleSet (L '' s) ↔ AmpleSet s := ⟨fun h ↦ (L.symm_image_image s) β–Έ h.image L.symm, fun h ↦ h.image L⟩ theorem preimage {s : Set F} (h : AmpleSet s) (L : E ≃ᡃL[ℝ] F) : AmpleSet (L ⁻¹' s) := by rw [← L.image_symm_eq_preimage] exact h.image L.symm theorem preimage_iff {s : Set F} (L : E ≃ᡃL[ℝ] F) : AmpleSet (L ⁻¹' s) ↔ AmpleSet s := ⟨fun h ↦ L.image_preimage s β–Έ h.image L, fun h ↦ h.preimage L⟩ open scoped Pointwise theorem vadd [ContinuousAdd E] {s : Set E} (h : AmpleSet s) {y : E} : AmpleSet (y +α΅₯ s) := h.image (ContinuousAffineEquiv.constVAdd ℝ E y) theorem vadd_iff [ContinuousAdd E] {s : Set E} {y : E} : AmpleSet (y +α΅₯ s) ↔ AmpleSet s := AmpleSet.image_iff (ContinuousAffineEquiv.constVAdd ℝ E y) section Codimension
Mathlib/Analysis/Convex/AmpleSet.lean
120
132
theorem of_one_lt_codim [TopologicalAddGroup F] [ContinuousSMul ℝ F] {E : Submodule ℝ F} (hcodim : 1 < Module.rank ℝ (F β§Έ E)) : AmpleSet (Eᢜ : Set F) := fun x hx ↦ by rw [E.connectedComponentIn_eq_self_of_one_lt_codim hcodim hx, eq_univ_iff_forall] intro y by_cases h : y ∈ E Β· obtain ⟨z, hz⟩ : βˆƒ z, z βˆ‰ E := by
rw [← not_forall, ← Submodule.eq_top_iff'] rintro rfl simp [rank_zero_iff.2 inferInstance] at hcodim refine segment_subset_convexHull ?_ ?_ (mem_segment_sub_add y z) <;> simpa [sub_eq_add_neg, Submodule.add_mem_iff_right _ h] Β· exact subset_convexHull ℝ (Eᢜ : Set F) h
6
403.428793
2
1.2
5
1,254
import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed #align_import measure_theory.measure.finite_measure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open MeasureTheory open Set open Filter open BoundedContinuousFunction open scoped Topology ENNReal NNReal BoundedContinuousFunction namespace MeasureTheory namespace FiniteMeasure section FiniteMeasure variable {Ξ© : Type*} [MeasurableSpace Ξ©] def _root_.MeasureTheory.FiniteMeasure (Ξ© : Type*) [MeasurableSpace Ξ©] : Type _ := { ΞΌ : Measure Ξ© // IsFiniteMeasure ΞΌ } #align measure_theory.finite_measure MeasureTheory.FiniteMeasure -- Porting note: as with other subtype synonyms (e.g., `ℝβ‰₯0`, we need a new function for the -- coercion instead of relying on `Subtype.val`. @[coe] def toMeasure : FiniteMeasure Ξ© β†’ Measure Ξ© := Subtype.val instance instCoe : Coe (FiniteMeasure Ξ©) (MeasureTheory.Measure Ξ©) where coe := toMeasure instance isFiniteMeasure (ΞΌ : FiniteMeasure Ξ©) : IsFiniteMeasure (ΞΌ : Measure Ξ©) := ΞΌ.prop #align measure_theory.finite_measure.is_finite_measure MeasureTheory.FiniteMeasure.isFiniteMeasure @[simp] theorem val_eq_toMeasure (Ξ½ : FiniteMeasure Ξ©) : Ξ½.val = (Ξ½ : Measure Ξ©) := rfl #align measure_theory.finite_measure.val_eq_to_measure MeasureTheory.FiniteMeasure.val_eq_toMeasure theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ξ© β†’ Measure Ξ©) := Subtype.coe_injective #align measure_theory.finite_measure.coe_injective MeasureTheory.FiniteMeasure.toMeasure_injective instance instFunLike : FunLike (FiniteMeasure Ξ©) (Set Ξ©) ℝβ‰₯0 where coe ΞΌ s := ((ΞΌ : Measure Ξ©) s).toNNReal coe_injective' ΞΌ Ξ½ h := toMeasure_injective $ Measure.ext fun s _ ↦ by simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s lemma coeFn_def (ΞΌ : FiniteMeasure Ξ©) : ΞΌ = fun s ↦ ((ΞΌ : Measure Ξ©) s).toNNReal := rfl #align measure_theory.finite_measure.coe_fn_eq_to_nnreal_coe_fn_to_measure MeasureTheory.FiniteMeasure.coeFn_def lemma coeFn_mk (ΞΌ : Measure Ξ©) (hΞΌ) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ = fun s ↦ (ΞΌ s).toNNReal := rfl @[simp, norm_cast] lemma mk_apply (ΞΌ : Measure Ξ©) (hΞΌ) (s : Set Ξ©) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ s = (ΞΌ s).toNNReal := rfl @[simp] theorem ennreal_coeFn_eq_coeFn_toMeasure (Ξ½ : FiniteMeasure Ξ©) (s : Set Ξ©) : (Ξ½ s : ℝβ‰₯0∞) = (Ξ½ : Measure Ξ©) s := ENNReal.coe_toNNReal (measure_lt_top (↑ν) s).ne #align measure_theory.finite_measure.ennreal_coe_fn_eq_coe_fn_to_measure MeasureTheory.FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure
Mathlib/MeasureTheory/Measure/FiniteMeasure.lean
168
171
theorem apply_mono (ΞΌ : FiniteMeasure Ξ©) {s₁ sβ‚‚ : Set Ξ©} (h : s₁ βŠ† sβ‚‚) : ΞΌ s₁ ≀ ΞΌ sβ‚‚ := by
change ((ΞΌ : Measure Ξ©) s₁).toNNReal ≀ ((ΞΌ : Measure Ξ©) sβ‚‚).toNNReal have key : (ΞΌ : Measure Ξ©) s₁ ≀ (ΞΌ : Measure Ξ©) sβ‚‚ := (ΞΌ : Measure Ξ©).mono h apply (ENNReal.toNNReal_le_toNNReal (measure_ne_top _ s₁) (measure_ne_top _ sβ‚‚)).mpr key
3
20.085537
1
1.2
5
1,255
import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed #align_import measure_theory.measure.finite_measure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open MeasureTheory open Set open Filter open BoundedContinuousFunction open scoped Topology ENNReal NNReal BoundedContinuousFunction namespace MeasureTheory namespace FiniteMeasure section FiniteMeasure variable {Ξ© : Type*} [MeasurableSpace Ξ©] def _root_.MeasureTheory.FiniteMeasure (Ξ© : Type*) [MeasurableSpace Ξ©] : Type _ := { ΞΌ : Measure Ξ© // IsFiniteMeasure ΞΌ } #align measure_theory.finite_measure MeasureTheory.FiniteMeasure -- Porting note: as with other subtype synonyms (e.g., `ℝβ‰₯0`, we need a new function for the -- coercion instead of relying on `Subtype.val`. @[coe] def toMeasure : FiniteMeasure Ξ© β†’ Measure Ξ© := Subtype.val instance instCoe : Coe (FiniteMeasure Ξ©) (MeasureTheory.Measure Ξ©) where coe := toMeasure instance isFiniteMeasure (ΞΌ : FiniteMeasure Ξ©) : IsFiniteMeasure (ΞΌ : Measure Ξ©) := ΞΌ.prop #align measure_theory.finite_measure.is_finite_measure MeasureTheory.FiniteMeasure.isFiniteMeasure @[simp] theorem val_eq_toMeasure (Ξ½ : FiniteMeasure Ξ©) : Ξ½.val = (Ξ½ : Measure Ξ©) := rfl #align measure_theory.finite_measure.val_eq_to_measure MeasureTheory.FiniteMeasure.val_eq_toMeasure theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ξ© β†’ Measure Ξ©) := Subtype.coe_injective #align measure_theory.finite_measure.coe_injective MeasureTheory.FiniteMeasure.toMeasure_injective instance instFunLike : FunLike (FiniteMeasure Ξ©) (Set Ξ©) ℝβ‰₯0 where coe ΞΌ s := ((ΞΌ : Measure Ξ©) s).toNNReal coe_injective' ΞΌ Ξ½ h := toMeasure_injective $ Measure.ext fun s _ ↦ by simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s lemma coeFn_def (ΞΌ : FiniteMeasure Ξ©) : ΞΌ = fun s ↦ ((ΞΌ : Measure Ξ©) s).toNNReal := rfl #align measure_theory.finite_measure.coe_fn_eq_to_nnreal_coe_fn_to_measure MeasureTheory.FiniteMeasure.coeFn_def lemma coeFn_mk (ΞΌ : Measure Ξ©) (hΞΌ) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ = fun s ↦ (ΞΌ s).toNNReal := rfl @[simp, norm_cast] lemma mk_apply (ΞΌ : Measure Ξ©) (hΞΌ) (s : Set Ξ©) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ s = (ΞΌ s).toNNReal := rfl @[simp] theorem ennreal_coeFn_eq_coeFn_toMeasure (Ξ½ : FiniteMeasure Ξ©) (s : Set Ξ©) : (Ξ½ s : ℝβ‰₯0∞) = (Ξ½ : Measure Ξ©) s := ENNReal.coe_toNNReal (measure_lt_top (↑ν) s).ne #align measure_theory.finite_measure.ennreal_coe_fn_eq_coe_fn_to_measure MeasureTheory.FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure theorem apply_mono (ΞΌ : FiniteMeasure Ξ©) {s₁ sβ‚‚ : Set Ξ©} (h : s₁ βŠ† sβ‚‚) : ΞΌ s₁ ≀ ΞΌ sβ‚‚ := by change ((ΞΌ : Measure Ξ©) s₁).toNNReal ≀ ((ΞΌ : Measure Ξ©) sβ‚‚).toNNReal have key : (ΞΌ : Measure Ξ©) s₁ ≀ (ΞΌ : Measure Ξ©) sβ‚‚ := (ΞΌ : Measure Ξ©).mono h apply (ENNReal.toNNReal_le_toNNReal (measure_ne_top _ s₁) (measure_ne_top _ sβ‚‚)).mpr key #align measure_theory.finite_measure.apply_mono MeasureTheory.FiniteMeasure.apply_mono def mass (ΞΌ : FiniteMeasure Ξ©) : ℝβ‰₯0 := ΞΌ univ #align measure_theory.finite_measure.mass MeasureTheory.FiniteMeasure.mass @[simp] theorem apply_le_mass (ΞΌ : FiniteMeasure Ξ©) (s : Set Ξ©) : ΞΌ s ≀ ΞΌ.mass := by simpa using apply_mono ΞΌ (subset_univ s) @[simp] theorem ennreal_mass {ΞΌ : FiniteMeasure Ξ©} : (ΞΌ.mass : ℝβ‰₯0∞) = (ΞΌ : Measure Ξ©) univ := ennreal_coeFn_eq_coeFn_toMeasure ΞΌ Set.univ #align measure_theory.finite_measure.ennreal_mass MeasureTheory.FiniteMeasure.ennreal_mass instance instZero : Zero (FiniteMeasure Ξ©) where zero := ⟨0, MeasureTheory.isFiniteMeasureZero⟩ #align measure_theory.finite_measure.has_zero MeasureTheory.FiniteMeasure.instZero @[simp, norm_cast] lemma coeFn_zero : ⇑(0 : FiniteMeasure Ξ©) = 0 := rfl #align measure_theory.finite_measure.coe_fn_zero MeasureTheory.FiniteMeasure.coeFn_zero @[simp] theorem zero_mass : (0 : FiniteMeasure Ξ©).mass = 0 := rfl #align measure_theory.finite_measure.zero.mass MeasureTheory.FiniteMeasure.zero_mass @[simp]
Mathlib/MeasureTheory/Measure/FiniteMeasure.lean
200
204
theorem mass_zero_iff (ΞΌ : FiniteMeasure Ξ©) : ΞΌ.mass = 0 ↔ ΞΌ = 0 := by
refine ⟨fun ΞΌ_mass => ?_, fun hΞΌ => by simp only [hΞΌ, zero_mass]⟩ apply toMeasure_injective apply Measure.measure_univ_eq_zero.mp rwa [← ennreal_mass, ENNReal.coe_eq_zero]
4
54.59815
2
1.2
5
1,255
import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed #align_import measure_theory.measure.finite_measure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open MeasureTheory open Set open Filter open BoundedContinuousFunction open scoped Topology ENNReal NNReal BoundedContinuousFunction namespace MeasureTheory namespace FiniteMeasure section FiniteMeasure variable {Ξ© : Type*} [MeasurableSpace Ξ©] def _root_.MeasureTheory.FiniteMeasure (Ξ© : Type*) [MeasurableSpace Ξ©] : Type _ := { ΞΌ : Measure Ξ© // IsFiniteMeasure ΞΌ } #align measure_theory.finite_measure MeasureTheory.FiniteMeasure -- Porting note: as with other subtype synonyms (e.g., `ℝβ‰₯0`, we need a new function for the -- coercion instead of relying on `Subtype.val`. @[coe] def toMeasure : FiniteMeasure Ξ© β†’ Measure Ξ© := Subtype.val instance instCoe : Coe (FiniteMeasure Ξ©) (MeasureTheory.Measure Ξ©) where coe := toMeasure instance isFiniteMeasure (ΞΌ : FiniteMeasure Ξ©) : IsFiniteMeasure (ΞΌ : Measure Ξ©) := ΞΌ.prop #align measure_theory.finite_measure.is_finite_measure MeasureTheory.FiniteMeasure.isFiniteMeasure @[simp] theorem val_eq_toMeasure (Ξ½ : FiniteMeasure Ξ©) : Ξ½.val = (Ξ½ : Measure Ξ©) := rfl #align measure_theory.finite_measure.val_eq_to_measure MeasureTheory.FiniteMeasure.val_eq_toMeasure theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ξ© β†’ Measure Ξ©) := Subtype.coe_injective #align measure_theory.finite_measure.coe_injective MeasureTheory.FiniteMeasure.toMeasure_injective instance instFunLike : FunLike (FiniteMeasure Ξ©) (Set Ξ©) ℝβ‰₯0 where coe ΞΌ s := ((ΞΌ : Measure Ξ©) s).toNNReal coe_injective' ΞΌ Ξ½ h := toMeasure_injective $ Measure.ext fun s _ ↦ by simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s lemma coeFn_def (ΞΌ : FiniteMeasure Ξ©) : ΞΌ = fun s ↦ ((ΞΌ : Measure Ξ©) s).toNNReal := rfl #align measure_theory.finite_measure.coe_fn_eq_to_nnreal_coe_fn_to_measure MeasureTheory.FiniteMeasure.coeFn_def lemma coeFn_mk (ΞΌ : Measure Ξ©) (hΞΌ) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ = fun s ↦ (ΞΌ s).toNNReal := rfl @[simp, norm_cast] lemma mk_apply (ΞΌ : Measure Ξ©) (hΞΌ) (s : Set Ξ©) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ s = (ΞΌ s).toNNReal := rfl @[simp] theorem ennreal_coeFn_eq_coeFn_toMeasure (Ξ½ : FiniteMeasure Ξ©) (s : Set Ξ©) : (Ξ½ s : ℝβ‰₯0∞) = (Ξ½ : Measure Ξ©) s := ENNReal.coe_toNNReal (measure_lt_top (↑ν) s).ne #align measure_theory.finite_measure.ennreal_coe_fn_eq_coe_fn_to_measure MeasureTheory.FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure theorem apply_mono (ΞΌ : FiniteMeasure Ξ©) {s₁ sβ‚‚ : Set Ξ©} (h : s₁ βŠ† sβ‚‚) : ΞΌ s₁ ≀ ΞΌ sβ‚‚ := by change ((ΞΌ : Measure Ξ©) s₁).toNNReal ≀ ((ΞΌ : Measure Ξ©) sβ‚‚).toNNReal have key : (ΞΌ : Measure Ξ©) s₁ ≀ (ΞΌ : Measure Ξ©) sβ‚‚ := (ΞΌ : Measure Ξ©).mono h apply (ENNReal.toNNReal_le_toNNReal (measure_ne_top _ s₁) (measure_ne_top _ sβ‚‚)).mpr key #align measure_theory.finite_measure.apply_mono MeasureTheory.FiniteMeasure.apply_mono def mass (ΞΌ : FiniteMeasure Ξ©) : ℝβ‰₯0 := ΞΌ univ #align measure_theory.finite_measure.mass MeasureTheory.FiniteMeasure.mass @[simp] theorem apply_le_mass (ΞΌ : FiniteMeasure Ξ©) (s : Set Ξ©) : ΞΌ s ≀ ΞΌ.mass := by simpa using apply_mono ΞΌ (subset_univ s) @[simp] theorem ennreal_mass {ΞΌ : FiniteMeasure Ξ©} : (ΞΌ.mass : ℝβ‰₯0∞) = (ΞΌ : Measure Ξ©) univ := ennreal_coeFn_eq_coeFn_toMeasure ΞΌ Set.univ #align measure_theory.finite_measure.ennreal_mass MeasureTheory.FiniteMeasure.ennreal_mass instance instZero : Zero (FiniteMeasure Ξ©) where zero := ⟨0, MeasureTheory.isFiniteMeasureZero⟩ #align measure_theory.finite_measure.has_zero MeasureTheory.FiniteMeasure.instZero @[simp, norm_cast] lemma coeFn_zero : ⇑(0 : FiniteMeasure Ξ©) = 0 := rfl #align measure_theory.finite_measure.coe_fn_zero MeasureTheory.FiniteMeasure.coeFn_zero @[simp] theorem zero_mass : (0 : FiniteMeasure Ξ©).mass = 0 := rfl #align measure_theory.finite_measure.zero.mass MeasureTheory.FiniteMeasure.zero_mass @[simp] theorem mass_zero_iff (ΞΌ : FiniteMeasure Ξ©) : ΞΌ.mass = 0 ↔ ΞΌ = 0 := by refine ⟨fun ΞΌ_mass => ?_, fun hΞΌ => by simp only [hΞΌ, zero_mass]⟩ apply toMeasure_injective apply Measure.measure_univ_eq_zero.mp rwa [← ennreal_mass, ENNReal.coe_eq_zero] #align measure_theory.finite_measure.mass_zero_iff MeasureTheory.FiniteMeasure.mass_zero_iff
Mathlib/MeasureTheory/Measure/FiniteMeasure.lean
207
209
theorem mass_nonzero_iff (ΞΌ : FiniteMeasure Ξ©) : ΞΌ.mass β‰  0 ↔ ΞΌ β‰  0 := by
rw [not_iff_not] exact FiniteMeasure.mass_zero_iff ΞΌ
2
7.389056
1
1.2
5
1,255
import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed #align_import measure_theory.measure.finite_measure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open MeasureTheory open Set open Filter open BoundedContinuousFunction open scoped Topology ENNReal NNReal BoundedContinuousFunction namespace MeasureTheory namespace FiniteMeasure section FiniteMeasure variable {Ξ© : Type*} [MeasurableSpace Ξ©] def _root_.MeasureTheory.FiniteMeasure (Ξ© : Type*) [MeasurableSpace Ξ©] : Type _ := { ΞΌ : Measure Ξ© // IsFiniteMeasure ΞΌ } #align measure_theory.finite_measure MeasureTheory.FiniteMeasure -- Porting note: as with other subtype synonyms (e.g., `ℝβ‰₯0`, we need a new function for the -- coercion instead of relying on `Subtype.val`. @[coe] def toMeasure : FiniteMeasure Ξ© β†’ Measure Ξ© := Subtype.val instance instCoe : Coe (FiniteMeasure Ξ©) (MeasureTheory.Measure Ξ©) where coe := toMeasure instance isFiniteMeasure (ΞΌ : FiniteMeasure Ξ©) : IsFiniteMeasure (ΞΌ : Measure Ξ©) := ΞΌ.prop #align measure_theory.finite_measure.is_finite_measure MeasureTheory.FiniteMeasure.isFiniteMeasure @[simp] theorem val_eq_toMeasure (Ξ½ : FiniteMeasure Ξ©) : Ξ½.val = (Ξ½ : Measure Ξ©) := rfl #align measure_theory.finite_measure.val_eq_to_measure MeasureTheory.FiniteMeasure.val_eq_toMeasure theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ξ© β†’ Measure Ξ©) := Subtype.coe_injective #align measure_theory.finite_measure.coe_injective MeasureTheory.FiniteMeasure.toMeasure_injective instance instFunLike : FunLike (FiniteMeasure Ξ©) (Set Ξ©) ℝβ‰₯0 where coe ΞΌ s := ((ΞΌ : Measure Ξ©) s).toNNReal coe_injective' ΞΌ Ξ½ h := toMeasure_injective $ Measure.ext fun s _ ↦ by simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s lemma coeFn_def (ΞΌ : FiniteMeasure Ξ©) : ΞΌ = fun s ↦ ((ΞΌ : Measure Ξ©) s).toNNReal := rfl #align measure_theory.finite_measure.coe_fn_eq_to_nnreal_coe_fn_to_measure MeasureTheory.FiniteMeasure.coeFn_def lemma coeFn_mk (ΞΌ : Measure Ξ©) (hΞΌ) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ = fun s ↦ (ΞΌ s).toNNReal := rfl @[simp, norm_cast] lemma mk_apply (ΞΌ : Measure Ξ©) (hΞΌ) (s : Set Ξ©) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ s = (ΞΌ s).toNNReal := rfl @[simp] theorem ennreal_coeFn_eq_coeFn_toMeasure (Ξ½ : FiniteMeasure Ξ©) (s : Set Ξ©) : (Ξ½ s : ℝβ‰₯0∞) = (Ξ½ : Measure Ξ©) s := ENNReal.coe_toNNReal (measure_lt_top (↑ν) s).ne #align measure_theory.finite_measure.ennreal_coe_fn_eq_coe_fn_to_measure MeasureTheory.FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure theorem apply_mono (ΞΌ : FiniteMeasure Ξ©) {s₁ sβ‚‚ : Set Ξ©} (h : s₁ βŠ† sβ‚‚) : ΞΌ s₁ ≀ ΞΌ sβ‚‚ := by change ((ΞΌ : Measure Ξ©) s₁).toNNReal ≀ ((ΞΌ : Measure Ξ©) sβ‚‚).toNNReal have key : (ΞΌ : Measure Ξ©) s₁ ≀ (ΞΌ : Measure Ξ©) sβ‚‚ := (ΞΌ : Measure Ξ©).mono h apply (ENNReal.toNNReal_le_toNNReal (measure_ne_top _ s₁) (measure_ne_top _ sβ‚‚)).mpr key #align measure_theory.finite_measure.apply_mono MeasureTheory.FiniteMeasure.apply_mono def mass (ΞΌ : FiniteMeasure Ξ©) : ℝβ‰₯0 := ΞΌ univ #align measure_theory.finite_measure.mass MeasureTheory.FiniteMeasure.mass @[simp] theorem apply_le_mass (ΞΌ : FiniteMeasure Ξ©) (s : Set Ξ©) : ΞΌ s ≀ ΞΌ.mass := by simpa using apply_mono ΞΌ (subset_univ s) @[simp] theorem ennreal_mass {ΞΌ : FiniteMeasure Ξ©} : (ΞΌ.mass : ℝβ‰₯0∞) = (ΞΌ : Measure Ξ©) univ := ennreal_coeFn_eq_coeFn_toMeasure ΞΌ Set.univ #align measure_theory.finite_measure.ennreal_mass MeasureTheory.FiniteMeasure.ennreal_mass instance instZero : Zero (FiniteMeasure Ξ©) where zero := ⟨0, MeasureTheory.isFiniteMeasureZero⟩ #align measure_theory.finite_measure.has_zero MeasureTheory.FiniteMeasure.instZero @[simp, norm_cast] lemma coeFn_zero : ⇑(0 : FiniteMeasure Ξ©) = 0 := rfl #align measure_theory.finite_measure.coe_fn_zero MeasureTheory.FiniteMeasure.coeFn_zero @[simp] theorem zero_mass : (0 : FiniteMeasure Ξ©).mass = 0 := rfl #align measure_theory.finite_measure.zero.mass MeasureTheory.FiniteMeasure.zero_mass @[simp] theorem mass_zero_iff (ΞΌ : FiniteMeasure Ξ©) : ΞΌ.mass = 0 ↔ ΞΌ = 0 := by refine ⟨fun ΞΌ_mass => ?_, fun hΞΌ => by simp only [hΞΌ, zero_mass]⟩ apply toMeasure_injective apply Measure.measure_univ_eq_zero.mp rwa [← ennreal_mass, ENNReal.coe_eq_zero] #align measure_theory.finite_measure.mass_zero_iff MeasureTheory.FiniteMeasure.mass_zero_iff theorem mass_nonzero_iff (ΞΌ : FiniteMeasure Ξ©) : ΞΌ.mass β‰  0 ↔ ΞΌ β‰  0 := by rw [not_iff_not] exact FiniteMeasure.mass_zero_iff ΞΌ #align measure_theory.finite_measure.mass_nonzero_iff MeasureTheory.FiniteMeasure.mass_nonzero_iff @[ext]
Mathlib/MeasureTheory/Measure/FiniteMeasure.lean
213
217
theorem eq_of_forall_toMeasure_apply_eq (ΞΌ Ξ½ : FiniteMeasure Ξ©) (h : βˆ€ s : Set Ξ©, MeasurableSet s β†’ (ΞΌ : Measure Ξ©) s = (Ξ½ : Measure Ξ©) s) : ΞΌ = Ξ½ := by
apply Subtype.ext ext1 s s_mble exact h s s_mble
3
20.085537
1
1.2
5
1,255
import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed #align_import measure_theory.measure.finite_measure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open MeasureTheory open Set open Filter open BoundedContinuousFunction open scoped Topology ENNReal NNReal BoundedContinuousFunction namespace MeasureTheory namespace FiniteMeasure section FiniteMeasure variable {Ξ© : Type*} [MeasurableSpace Ξ©] def _root_.MeasureTheory.FiniteMeasure (Ξ© : Type*) [MeasurableSpace Ξ©] : Type _ := { ΞΌ : Measure Ξ© // IsFiniteMeasure ΞΌ } #align measure_theory.finite_measure MeasureTheory.FiniteMeasure -- Porting note: as with other subtype synonyms (e.g., `ℝβ‰₯0`, we need a new function for the -- coercion instead of relying on `Subtype.val`. @[coe] def toMeasure : FiniteMeasure Ξ© β†’ Measure Ξ© := Subtype.val instance instCoe : Coe (FiniteMeasure Ξ©) (MeasureTheory.Measure Ξ©) where coe := toMeasure instance isFiniteMeasure (ΞΌ : FiniteMeasure Ξ©) : IsFiniteMeasure (ΞΌ : Measure Ξ©) := ΞΌ.prop #align measure_theory.finite_measure.is_finite_measure MeasureTheory.FiniteMeasure.isFiniteMeasure @[simp] theorem val_eq_toMeasure (Ξ½ : FiniteMeasure Ξ©) : Ξ½.val = (Ξ½ : Measure Ξ©) := rfl #align measure_theory.finite_measure.val_eq_to_measure MeasureTheory.FiniteMeasure.val_eq_toMeasure theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ξ© β†’ Measure Ξ©) := Subtype.coe_injective #align measure_theory.finite_measure.coe_injective MeasureTheory.FiniteMeasure.toMeasure_injective instance instFunLike : FunLike (FiniteMeasure Ξ©) (Set Ξ©) ℝβ‰₯0 where coe ΞΌ s := ((ΞΌ : Measure Ξ©) s).toNNReal coe_injective' ΞΌ Ξ½ h := toMeasure_injective $ Measure.ext fun s _ ↦ by simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s lemma coeFn_def (ΞΌ : FiniteMeasure Ξ©) : ΞΌ = fun s ↦ ((ΞΌ : Measure Ξ©) s).toNNReal := rfl #align measure_theory.finite_measure.coe_fn_eq_to_nnreal_coe_fn_to_measure MeasureTheory.FiniteMeasure.coeFn_def lemma coeFn_mk (ΞΌ : Measure Ξ©) (hΞΌ) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ = fun s ↦ (ΞΌ s).toNNReal := rfl @[simp, norm_cast] lemma mk_apply (ΞΌ : Measure Ξ©) (hΞΌ) (s : Set Ξ©) : DFunLike.coe (F := FiniteMeasure Ξ©) ⟨μ, hμ⟩ s = (ΞΌ s).toNNReal := rfl @[simp] theorem ennreal_coeFn_eq_coeFn_toMeasure (Ξ½ : FiniteMeasure Ξ©) (s : Set Ξ©) : (Ξ½ s : ℝβ‰₯0∞) = (Ξ½ : Measure Ξ©) s := ENNReal.coe_toNNReal (measure_lt_top (↑ν) s).ne #align measure_theory.finite_measure.ennreal_coe_fn_eq_coe_fn_to_measure MeasureTheory.FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure theorem apply_mono (ΞΌ : FiniteMeasure Ξ©) {s₁ sβ‚‚ : Set Ξ©} (h : s₁ βŠ† sβ‚‚) : ΞΌ s₁ ≀ ΞΌ sβ‚‚ := by change ((ΞΌ : Measure Ξ©) s₁).toNNReal ≀ ((ΞΌ : Measure Ξ©) sβ‚‚).toNNReal have key : (ΞΌ : Measure Ξ©) s₁ ≀ (ΞΌ : Measure Ξ©) sβ‚‚ := (ΞΌ : Measure Ξ©).mono h apply (ENNReal.toNNReal_le_toNNReal (measure_ne_top _ s₁) (measure_ne_top _ sβ‚‚)).mpr key #align measure_theory.finite_measure.apply_mono MeasureTheory.FiniteMeasure.apply_mono def mass (ΞΌ : FiniteMeasure Ξ©) : ℝβ‰₯0 := ΞΌ univ #align measure_theory.finite_measure.mass MeasureTheory.FiniteMeasure.mass @[simp] theorem apply_le_mass (ΞΌ : FiniteMeasure Ξ©) (s : Set Ξ©) : ΞΌ s ≀ ΞΌ.mass := by simpa using apply_mono ΞΌ (subset_univ s) @[simp] theorem ennreal_mass {ΞΌ : FiniteMeasure Ξ©} : (ΞΌ.mass : ℝβ‰₯0∞) = (ΞΌ : Measure Ξ©) univ := ennreal_coeFn_eq_coeFn_toMeasure ΞΌ Set.univ #align measure_theory.finite_measure.ennreal_mass MeasureTheory.FiniteMeasure.ennreal_mass instance instZero : Zero (FiniteMeasure Ξ©) where zero := ⟨0, MeasureTheory.isFiniteMeasureZero⟩ #align measure_theory.finite_measure.has_zero MeasureTheory.FiniteMeasure.instZero @[simp, norm_cast] lemma coeFn_zero : ⇑(0 : FiniteMeasure Ξ©) = 0 := rfl #align measure_theory.finite_measure.coe_fn_zero MeasureTheory.FiniteMeasure.coeFn_zero @[simp] theorem zero_mass : (0 : FiniteMeasure Ξ©).mass = 0 := rfl #align measure_theory.finite_measure.zero.mass MeasureTheory.FiniteMeasure.zero_mass @[simp] theorem mass_zero_iff (ΞΌ : FiniteMeasure Ξ©) : ΞΌ.mass = 0 ↔ ΞΌ = 0 := by refine ⟨fun ΞΌ_mass => ?_, fun hΞΌ => by simp only [hΞΌ, zero_mass]⟩ apply toMeasure_injective apply Measure.measure_univ_eq_zero.mp rwa [← ennreal_mass, ENNReal.coe_eq_zero] #align measure_theory.finite_measure.mass_zero_iff MeasureTheory.FiniteMeasure.mass_zero_iff theorem mass_nonzero_iff (ΞΌ : FiniteMeasure Ξ©) : ΞΌ.mass β‰  0 ↔ ΞΌ β‰  0 := by rw [not_iff_not] exact FiniteMeasure.mass_zero_iff ΞΌ #align measure_theory.finite_measure.mass_nonzero_iff MeasureTheory.FiniteMeasure.mass_nonzero_iff @[ext] theorem eq_of_forall_toMeasure_apply_eq (ΞΌ Ξ½ : FiniteMeasure Ξ©) (h : βˆ€ s : Set Ξ©, MeasurableSet s β†’ (ΞΌ : Measure Ξ©) s = (Ξ½ : Measure Ξ©) s) : ΞΌ = Ξ½ := by apply Subtype.ext ext1 s s_mble exact h s s_mble #align measure_theory.finite_measure.eq_of_forall_measure_apply_eq MeasureTheory.FiniteMeasure.eq_of_forall_toMeasure_apply_eq
Mathlib/MeasureTheory/Measure/FiniteMeasure.lean
220
223
theorem eq_of_forall_apply_eq (ΞΌ Ξ½ : FiniteMeasure Ξ©) (h : βˆ€ s : Set Ξ©, MeasurableSet s β†’ ΞΌ s = Ξ½ s) : ΞΌ = Ξ½ := by
ext1 s s_mble simpa [ennreal_coeFn_eq_coeFn_toMeasure] using congr_arg ((↑) : ℝβ‰₯0 β†’ ℝβ‰₯0∞) (h s s_mble)
2
7.389056
1
1.2
5
1,255
import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.DirectSum.Internal import Mathlib.RingTheory.GradedAlgebra.Basic #align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3" noncomputable section namespace AddMonoidAlgebra variable {M : Type*} {ΞΉ : Type*} {R : Type*} section variable (R) [CommSemiring R] abbrev gradeBy (f : M β†’ ΞΉ) (i : ΞΉ) : Submodule R R[M] where carrier := { a | βˆ€ m, m ∈ a.support β†’ f m = i } zero_mem' m h := by cases h add_mem' {a b} ha hb m h := by classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m) smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h #align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy abbrev grade (m : M) : Submodule R R[M] := gradeBy R id m #align add_monoid_algebra.grade AddMonoidAlgebra.grade theorem gradeBy_id : gradeBy R (id : M β†’ M) = grade R := rfl #align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id
Mathlib/Algebra/MonoidAlgebra/Grading.lean
63
64
theorem mem_gradeBy_iff (f : M β†’ ΞΉ) (i : ΞΉ) (a : R[M]) : a ∈ gradeBy R f i ↔ (a.support : Set M) βŠ† f ⁻¹' {i} := by
rfl
1
2.718282
0
1.2
5
1,256
import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.DirectSum.Internal import Mathlib.RingTheory.GradedAlgebra.Basic #align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3" noncomputable section namespace AddMonoidAlgebra variable {M : Type*} {ΞΉ : Type*} {R : Type*} section variable (R) [CommSemiring R] abbrev gradeBy (f : M β†’ ΞΉ) (i : ΞΉ) : Submodule R R[M] where carrier := { a | βˆ€ m, m ∈ a.support β†’ f m = i } zero_mem' m h := by cases h add_mem' {a b} ha hb m h := by classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m) smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h #align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy abbrev grade (m : M) : Submodule R R[M] := gradeBy R id m #align add_monoid_algebra.grade AddMonoidAlgebra.grade theorem gradeBy_id : gradeBy R (id : M β†’ M) = grade R := rfl #align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id theorem mem_gradeBy_iff (f : M β†’ ΞΉ) (i : ΞΉ) (a : R[M]) : a ∈ gradeBy R f i ↔ (a.support : Set M) βŠ† f ⁻¹' {i} := by rfl #align add_monoid_algebra.mem_grade_by_iff AddMonoidAlgebra.mem_gradeBy_iff
Mathlib/Algebra/MonoidAlgebra/Grading.lean
67
69
theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.support βŠ† {m} := by
rw [← Finset.coe_subset, Finset.coe_singleton] rfl
2
7.389056
1
1.2
5
1,256
import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.DirectSum.Internal import Mathlib.RingTheory.GradedAlgebra.Basic #align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3" noncomputable section namespace AddMonoidAlgebra variable {M : Type*} {ΞΉ : Type*} {R : Type*} section variable (R) [CommSemiring R] abbrev gradeBy (f : M β†’ ΞΉ) (i : ΞΉ) : Submodule R R[M] where carrier := { a | βˆ€ m, m ∈ a.support β†’ f m = i } zero_mem' m h := by cases h add_mem' {a b} ha hb m h := by classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m) smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h #align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy abbrev grade (m : M) : Submodule R R[M] := gradeBy R id m #align add_monoid_algebra.grade AddMonoidAlgebra.grade theorem gradeBy_id : gradeBy R (id : M β†’ M) = grade R := rfl #align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id theorem mem_gradeBy_iff (f : M β†’ ΞΉ) (i : ΞΉ) (a : R[M]) : a ∈ gradeBy R f i ↔ (a.support : Set M) βŠ† f ⁻¹' {i} := by rfl #align add_monoid_algebra.mem_grade_by_iff AddMonoidAlgebra.mem_gradeBy_iff theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.support βŠ† {m} := by rw [← Finset.coe_subset, Finset.coe_singleton] rfl #align add_monoid_algebra.mem_grade_iff AddMonoidAlgebra.mem_grade_iff
Mathlib/Algebra/MonoidAlgebra/Grading.lean
72
78
theorem mem_grade_iff' (m : M) (a : R[M]) : a ∈ grade R m ↔ a ∈ (LinearMap.range (Finsupp.lsingle m : R β†’β‚—[R] M β†’β‚€ R) : Submodule R R[M]) := by
rw [mem_grade_iff, Finsupp.support_subset_singleton'] apply exists_congr intro r constructor <;> exact Eq.symm
4
54.59815
2
1.2
5
1,256
import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.DirectSum.Internal import Mathlib.RingTheory.GradedAlgebra.Basic #align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3" noncomputable section namespace AddMonoidAlgebra variable {M : Type*} {ΞΉ : Type*} {R : Type*} section variable (R) [CommSemiring R] abbrev gradeBy (f : M β†’ ΞΉ) (i : ΞΉ) : Submodule R R[M] where carrier := { a | βˆ€ m, m ∈ a.support β†’ f m = i } zero_mem' m h := by cases h add_mem' {a b} ha hb m h := by classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m) smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h #align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy abbrev grade (m : M) : Submodule R R[M] := gradeBy R id m #align add_monoid_algebra.grade AddMonoidAlgebra.grade theorem gradeBy_id : gradeBy R (id : M β†’ M) = grade R := rfl #align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id theorem mem_gradeBy_iff (f : M β†’ ΞΉ) (i : ΞΉ) (a : R[M]) : a ∈ gradeBy R f i ↔ (a.support : Set M) βŠ† f ⁻¹' {i} := by rfl #align add_monoid_algebra.mem_grade_by_iff AddMonoidAlgebra.mem_gradeBy_iff theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.support βŠ† {m} := by rw [← Finset.coe_subset, Finset.coe_singleton] rfl #align add_monoid_algebra.mem_grade_iff AddMonoidAlgebra.mem_grade_iff theorem mem_grade_iff' (m : M) (a : R[M]) : a ∈ grade R m ↔ a ∈ (LinearMap.range (Finsupp.lsingle m : R β†’β‚—[R] M β†’β‚€ R) : Submodule R R[M]) := by rw [mem_grade_iff, Finsupp.support_subset_singleton'] apply exists_congr intro r constructor <;> exact Eq.symm #align add_monoid_algebra.mem_grade_iff' AddMonoidAlgebra.mem_grade_iff' theorem grade_eq_lsingle_range (m : M) : grade R m = LinearMap.range (Finsupp.lsingle m : R β†’β‚—[R] M β†’β‚€ R) := Submodule.ext (mem_grade_iff' R m) #align add_monoid_algebra.grade_eq_lsingle_range AddMonoidAlgebra.grade_eq_lsingle_range
Mathlib/Algebra/MonoidAlgebra/Grading.lean
86
89
theorem single_mem_gradeBy {R} [CommSemiring R] (f : M β†’ ΞΉ) (m : M) (r : R) : Finsupp.single m r ∈ gradeBy R f (f m) := by
intro x hx rw [Finset.mem_singleton.mp (Finsupp.support_single_subset hx)]
2
7.389056
1
1.2
5
1,256
import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.DirectSum.Internal import Mathlib.RingTheory.GradedAlgebra.Basic #align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3" noncomputable section namespace AddMonoidAlgebra variable {M : Type*} {ΞΉ : Type*} {R : Type*} section variable (R) [CommSemiring R] abbrev gradeBy (f : M β†’ ΞΉ) (i : ΞΉ) : Submodule R R[M] where carrier := { a | βˆ€ m, m ∈ a.support β†’ f m = i } zero_mem' m h := by cases h add_mem' {a b} ha hb m h := by classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m) smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h #align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy abbrev grade (m : M) : Submodule R R[M] := gradeBy R id m #align add_monoid_algebra.grade AddMonoidAlgebra.grade theorem gradeBy_id : gradeBy R (id : M β†’ M) = grade R := rfl #align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id theorem mem_gradeBy_iff (f : M β†’ ΞΉ) (i : ΞΉ) (a : R[M]) : a ∈ gradeBy R f i ↔ (a.support : Set M) βŠ† f ⁻¹' {i} := by rfl #align add_monoid_algebra.mem_grade_by_iff AddMonoidAlgebra.mem_gradeBy_iff theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.support βŠ† {m} := by rw [← Finset.coe_subset, Finset.coe_singleton] rfl #align add_monoid_algebra.mem_grade_iff AddMonoidAlgebra.mem_grade_iff theorem mem_grade_iff' (m : M) (a : R[M]) : a ∈ grade R m ↔ a ∈ (LinearMap.range (Finsupp.lsingle m : R β†’β‚—[R] M β†’β‚€ R) : Submodule R R[M]) := by rw [mem_grade_iff, Finsupp.support_subset_singleton'] apply exists_congr intro r constructor <;> exact Eq.symm #align add_monoid_algebra.mem_grade_iff' AddMonoidAlgebra.mem_grade_iff' theorem grade_eq_lsingle_range (m : M) : grade R m = LinearMap.range (Finsupp.lsingle m : R β†’β‚—[R] M β†’β‚€ R) := Submodule.ext (mem_grade_iff' R m) #align add_monoid_algebra.grade_eq_lsingle_range AddMonoidAlgebra.grade_eq_lsingle_range theorem single_mem_gradeBy {R} [CommSemiring R] (f : M β†’ ΞΉ) (m : M) (r : R) : Finsupp.single m r ∈ gradeBy R f (f m) := by intro x hx rw [Finset.mem_singleton.mp (Finsupp.support_single_subset hx)] #align add_monoid_algebra.single_mem_grade_by AddMonoidAlgebra.single_mem_gradeBy theorem single_mem_grade {R} [CommSemiring R] (i : M) (r : R) : Finsupp.single i r ∈ grade R i := single_mem_gradeBy _ _ _ #align add_monoid_algebra.single_mem_grade AddMonoidAlgebra.single_mem_grade end open DirectSum instance gradeBy.gradedMonoid [AddMonoid M] [AddMonoid ΞΉ] [CommSemiring R] (f : M β†’+ ΞΉ) : SetLike.GradedMonoid (gradeBy R f : ΞΉ β†’ Submodule R R[M]) where one_mem m h := by rw [one_def] at h obtain rfl : m = 0 := Finset.mem_singleton.1 <| Finsupp.support_single_subset h apply map_zero mul_mem i j a b ha hb c hc := by classical obtain ⟨ma, hma, mb, hmb, rfl⟩ : βˆƒ y ∈ a.support, βˆƒ z ∈ b.support, y + z = c := Finset.mem_add.1 <| support_mul a b hc rw [map_add, ha ma hma, hb mb hmb] #align add_monoid_algebra.grade_by.graded_monoid AddMonoidAlgebra.gradeBy.gradedMonoid instance grade.gradedMonoid [AddMonoid M] [CommSemiring R] : SetLike.GradedMonoid (grade R : M β†’ Submodule R R[M]) := by apply gradeBy.gradedMonoid (AddMonoidHom.id _) #align add_monoid_algebra.grade.graded_monoid AddMonoidAlgebra.grade.gradedMonoid variable [AddMonoid M] [DecidableEq ΞΉ] [AddMonoid ΞΉ] [CommSemiring R] (f : M β†’+ ΞΉ) def decomposeAux : R[M] →ₐ[R] ⨁ i : ΞΉ, gradeBy R f i := AddMonoidAlgebra.lift R M _ { toFun := fun m => DirectSum.of (fun i : ΞΉ => gradeBy R f i) (f (Multiplicative.toAdd m)) ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩ map_one' := DirectSum.of_eq_of_gradedMonoid_eq (by congr 2 <;> simp) map_mul' := fun i j => by symm dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe, OneHom.coe_mk, toAdd_mul] convert DirectSum.of_mul_of (A := (fun i : ΞΉ => gradeBy R f i)) _ _ repeat { rw [ AddMonoidHom.map_add] } simp only [SetLike.coe_gMul] exact Eq.trans (by rw [one_mul]) single_mul_single.symm } #align add_monoid_algebra.decompose_aux AddMonoidAlgebra.decomposeAux
Mathlib/Algebra/MonoidAlgebra/Grading.lean
140
150
theorem decomposeAux_single (m : M) (r : R) : decomposeAux f (Finsupp.single m r) = DirectSum.of (fun i : ι => gradeBy R f i) (f m) ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by
refine (lift_single _ _ _).trans ?_ refine (DirectSum.of_smul R _ _ _).symm.trans ?_ apply DirectSum.of_eq_of_gradedMonoid_eq refine Sigma.subtype_ext rfl ?_ refine (Finsupp.smul_single' _ _ _).trans ?_ rw [mul_one] rfl
7
1,096.633158
2
1.2
5
1,256
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.LinearAlgebra.AffineSpace.Slope #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open Topology Filter TopologicalSpace open Filter Set section NormedField variable {π•œ : Type u} [NontriviallyNormedField π•œ] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] variable {f fβ‚€ f₁ g : π•œ β†’ F} variable {f' fβ‚€' f₁' g' : F} variable {x : π•œ} variable {s t : Set π•œ} variable {L L₁ Lβ‚‚ : Filter π•œ}
Mathlib/Analysis/Calculus/Deriv/Slope.lean
51
63
theorem hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} : HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := calc HasDerivAtFilter f f' x L ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') L (𝓝 0) := by
simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub] _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp _ ↔ Tendsto (fun y ↦ slope f x y - f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := tendsto_congr' <| by refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right rw [inv_smul_smulβ‚€ (sub_ne_zero.2 hy) f'] _ ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl
9
8,103.083928
2
1.2
5
1,257
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.LinearAlgebra.AffineSpace.Slope #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open Topology Filter TopologicalSpace open Filter Set section NormedField variable {π•œ : Type u} [NontriviallyNormedField π•œ] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] variable {f fβ‚€ f₁ g : π•œ β†’ F} variable {f' fβ‚€' f₁' g' : F} variable {x : π•œ} variable {s t : Set π•œ} variable {L L₁ Lβ‚‚ : Filter π•œ} theorem hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} : HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := calc HasDerivAtFilter f f' x L ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') L (𝓝 0) := by simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub] _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp _ ↔ Tendsto (fun y ↦ slope f x y - f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := tendsto_congr' <| by refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right rw [inv_smul_smulβ‚€ (sub_ne_zero.2 hy) f'] _ ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope
Mathlib/Analysis/Calculus/Deriv/Slope.lean
66
69
theorem hasDerivWithinAt_iff_tendsto_slope : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') := by
simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ← inf_assoc, inf_principal.symm] exact hasDerivAtFilter_iff_tendsto_slope
2
7.389056
1
1.2
5
1,257
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.LinearAlgebra.AffineSpace.Slope #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open Topology Filter TopologicalSpace open Filter Set section NormedField variable {π•œ : Type u} [NontriviallyNormedField π•œ] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] variable {f fβ‚€ f₁ g : π•œ β†’ F} variable {f' fβ‚€' f₁' g' : F} variable {x : π•œ} variable {s t : Set π•œ} variable {L L₁ Lβ‚‚ : Filter π•œ} theorem hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} : HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := calc HasDerivAtFilter f f' x L ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') L (𝓝 0) := by simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub] _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp _ ↔ Tendsto (fun y ↦ slope f x y - f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := tendsto_congr' <| by refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right rw [inv_smul_smulβ‚€ (sub_ne_zero.2 hy) f'] _ ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope theorem hasDerivWithinAt_iff_tendsto_slope : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') := by simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ← inf_assoc, inf_principal.symm] exact hasDerivAtFilter_iff_tendsto_slope #align has_deriv_within_at_iff_tendsto_slope hasDerivWithinAt_iff_tendsto_slope
Mathlib/Analysis/Calculus/Deriv/Slope.lean
72
74
theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x βˆ‰ s) : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s] x) (𝓝 f') := by
rw [hasDerivWithinAt_iff_tendsto_slope, diff_singleton_eq_self hs]
1
2.718282
0
1.2
5
1,257
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.LinearAlgebra.AffineSpace.Slope #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open Topology Filter TopologicalSpace open Filter Set section NormedField variable {π•œ : Type u} [NontriviallyNormedField π•œ] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] variable {f fβ‚€ f₁ g : π•œ β†’ F} variable {f' fβ‚€' f₁' g' : F} variable {x : π•œ} variable {s t : Set π•œ} variable {L L₁ Lβ‚‚ : Filter π•œ} theorem hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} : HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := calc HasDerivAtFilter f f' x L ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') L (𝓝 0) := by simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub] _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp _ ↔ Tendsto (fun y ↦ slope f x y - f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := tendsto_congr' <| by refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right rw [inv_smul_smulβ‚€ (sub_ne_zero.2 hy) f'] _ ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope theorem hasDerivWithinAt_iff_tendsto_slope : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') := by simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ← inf_assoc, inf_principal.symm] exact hasDerivAtFilter_iff_tendsto_slope #align has_deriv_within_at_iff_tendsto_slope hasDerivWithinAt_iff_tendsto_slope theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x βˆ‰ s) : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s] x) (𝓝 f') := by rw [hasDerivWithinAt_iff_tendsto_slope, diff_singleton_eq_self hs] #align has_deriv_within_at_iff_tendsto_slope' hasDerivWithinAt_iff_tendsto_slope' theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ↔ Tendsto (slope f x) (𝓝[β‰ ] x) (𝓝 f') := hasDerivAtFilter_iff_tendsto_slope #align has_deriv_at_iff_tendsto_slope hasDerivAt_iff_tendsto_slope
Mathlib/Analysis/Calculus/Deriv/Slope.lean
81
85
theorem hasDerivAt_iff_tendsto_slope_zero : HasDerivAt f f' x ↔ Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[β‰ ] 0) (𝓝 f') := by
have : 𝓝[β‰ ] x = Filter.map (fun t ↦ x + t) (𝓝[β‰ ] 0) := by simp [nhdsWithin, map_add_left_nhds_zero x, Filter.map_inf, add_right_injective x] simp [hasDerivAt_iff_tendsto_slope, this, slope, Function.comp]
3
20.085537
1
1.2
5
1,257
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.LinearAlgebra.AffineSpace.Slope #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open Topology Filter TopologicalSpace open Filter Set section NormedField variable {π•œ : Type u} [NontriviallyNormedField π•œ] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] variable {f fβ‚€ f₁ g : π•œ β†’ F} variable {f' fβ‚€' f₁' g' : F} variable {x : π•œ} variable {s t : Set π•œ} variable {L L₁ Lβ‚‚ : Filter π•œ} theorem hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} : HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := calc HasDerivAtFilter f f' x L ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') L (𝓝 0) := by simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub] _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp _ ↔ Tendsto (fun y ↦ slope f x y - f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := tendsto_congr' <| by refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right rw [inv_smul_smulβ‚€ (sub_ne_zero.2 hy) f'] _ ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') := by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope theorem hasDerivWithinAt_iff_tendsto_slope : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') := by simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ← inf_assoc, inf_principal.symm] exact hasDerivAtFilter_iff_tendsto_slope #align has_deriv_within_at_iff_tendsto_slope hasDerivWithinAt_iff_tendsto_slope theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x βˆ‰ s) : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s] x) (𝓝 f') := by rw [hasDerivWithinAt_iff_tendsto_slope, diff_singleton_eq_self hs] #align has_deriv_within_at_iff_tendsto_slope' hasDerivWithinAt_iff_tendsto_slope' theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ↔ Tendsto (slope f x) (𝓝[β‰ ] x) (𝓝 f') := hasDerivAtFilter_iff_tendsto_slope #align has_deriv_at_iff_tendsto_slope hasDerivAt_iff_tendsto_slope theorem hasDerivAt_iff_tendsto_slope_zero : HasDerivAt f f' x ↔ Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[β‰ ] 0) (𝓝 f') := by have : 𝓝[β‰ ] x = Filter.map (fun t ↦ x + t) (𝓝[β‰ ] 0) := by simp [nhdsWithin, map_add_left_nhds_zero x, Filter.map_inf, add_right_injective x] simp [hasDerivAt_iff_tendsto_slope, this, slope, Function.comp] alias ⟨HasDerivAt.tendsto_slope_zero, _⟩ := hasDerivAt_iff_tendsto_slope_zero theorem HasDerivAt.tendsto_slope_zero_right [PartialOrder π•œ] (h : HasDerivAt f f' x) : Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[>] 0) (𝓝 f') := h.tendsto_slope_zero.mono_left (nhds_right'_le_nhds_ne 0) theorem HasDerivAt.tendsto_slope_zero_left [PartialOrder π•œ] (h : HasDerivAt f f' x) : Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[<] 0) (𝓝 f') := h.tendsto_slope_zero.mono_left (nhds_left'_le_nhds_ne 0)
Mathlib/Analysis/Calculus/Deriv/Slope.lean
99
134
theorem range_derivWithin_subset_closure_span_image (f : π•œ β†’ F) {s t : Set π•œ} (h : s βŠ† closure (s ∩ t)) : range (derivWithin f s) βŠ† closure (Submodule.span π•œ (f '' t)) := by
rintro - ⟨x, rfl⟩ rcases eq_or_neBot (𝓝[s \ {x}] x) with H|H Β· simp [derivWithin, fderivWithin, H] exact subset_closure (zero_mem _) by_cases H' : DifferentiableWithinAt π•œ f s x; swap Β· rw [derivWithin_zero_of_not_differentiableWithinAt H'] exact subset_closure (zero_mem _) have I : (𝓝[(s ∩ t) \ {x}] x).NeBot := by rw [← mem_closure_iff_nhdsWithin_neBot] at H ⊒ have A : closure (s \ {x}) βŠ† closure (closure (s ∩ t) \ {x}) := closure_mono (diff_subset_diff_left h) have B : closure (s ∩ t) \ {x} βŠ† closure ((s ∩ t) \ {x}) := by convert closure_diff; exact closure_singleton.symm simpa using A.trans (closure_mono B) H have : Tendsto (slope f x) (𝓝[(s ∩ t) \ {x}] x) (𝓝 (derivWithin f s x)) := by apply Tendsto.mono_left (hasDerivWithinAt_iff_tendsto_slope.1 H'.hasDerivWithinAt) rw [inter_comm, inter_diff_assoc] exact nhdsWithin_mono _ inter_subset_right rw [← closure_closure, ← Submodule.topologicalClosure_coe] apply mem_closure_of_tendsto this filter_upwards [self_mem_nhdsWithin] with y hy simp only [slope, vsub_eq_sub, SetLike.mem_coe] refine Submodule.smul_mem _ _ (Submodule.sub_mem _ ?_ ?_) Β· apply Submodule.le_topologicalClosure apply Submodule.subset_span exact mem_image_of_mem _ hy.1.2 Β· apply Submodule.closure_subset_topologicalClosure_span suffices A : f x ∈ closure (f '' (s ∩ t)) from closure_mono (image_subset _ inter_subset_right) A apply ContinuousWithinAt.mem_closure_image Β· apply H'.continuousWithinAt.mono inter_subset_left rw [mem_closure_iff_nhdsWithin_neBot] exact I.mono (nhdsWithin_mono _ diff_subset)
33
214,643,579,785,916.06
2
1.2
5
1,257
import Mathlib.Data.List.Sublists import Mathlib.Data.Multiset.Bind #align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {Ξ± : Type*} -- Porting note (#11215): TODO: Write a more efficient version def powersetAux (l : List Ξ±) : List (Multiset Ξ±) := (sublists l).map (↑) #align multiset.powerset_aux Multiset.powersetAux theorem powersetAux_eq_map_coe {l : List Ξ±} : powersetAux l = (sublists l).map (↑) := rfl #align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe @[simp] theorem mem_powersetAux {l : List Ξ±} {s} : s ∈ powersetAux l ↔ s ≀ ↑l := Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm] #align multiset.mem_powerset_aux Multiset.mem_powersetAux def powersetAux' (l : List Ξ±) : List (Multiset Ξ±) := (sublists' l).map (↑) #align multiset.powerset_aux' Multiset.powersetAux'
Mathlib/Data/Multiset/Powerset.lean
45
46
theorem powersetAux_perm_powersetAux' {l : List Ξ±} : powersetAux l ~ powersetAux' l := by
rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _
1
2.718282
0
1.2
5
1,258
import Mathlib.Data.List.Sublists import Mathlib.Data.Multiset.Bind #align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {Ξ± : Type*} -- Porting note (#11215): TODO: Write a more efficient version def powersetAux (l : List Ξ±) : List (Multiset Ξ±) := (sublists l).map (↑) #align multiset.powerset_aux Multiset.powersetAux theorem powersetAux_eq_map_coe {l : List Ξ±} : powersetAux l = (sublists l).map (↑) := rfl #align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe @[simp] theorem mem_powersetAux {l : List Ξ±} {s} : s ∈ powersetAux l ↔ s ≀ ↑l := Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm] #align multiset.mem_powerset_aux Multiset.mem_powersetAux def powersetAux' (l : List Ξ±) : List (Multiset Ξ±) := (sublists' l).map (↑) #align multiset.powerset_aux' Multiset.powersetAux' theorem powersetAux_perm_powersetAux' {l : List Ξ±} : powersetAux l ~ powersetAux' l := by rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _ #align multiset.powerset_aux_perm_powerset_aux' Multiset.powersetAux_perm_powersetAux' @[simp] theorem powersetAux'_nil : powersetAux' (@nil Ξ±) = [0] := rfl #align multiset.powerset_aux'_nil Multiset.powersetAux'_nil @[simp]
Mathlib/Data/Multiset/Powerset.lean
55
57
theorem powersetAux'_cons (a : Ξ±) (l : List Ξ±) : powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l) := by
simp only [powersetAux', sublists'_cons, map_append, List.map_map, append_cancel_left_eq]; rfl
1
2.718282
0
1.2
5
1,258
import Mathlib.Data.List.Sublists import Mathlib.Data.Multiset.Bind #align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {Ξ± : Type*} -- Porting note (#11215): TODO: Write a more efficient version def powersetAux (l : List Ξ±) : List (Multiset Ξ±) := (sublists l).map (↑) #align multiset.powerset_aux Multiset.powersetAux theorem powersetAux_eq_map_coe {l : List Ξ±} : powersetAux l = (sublists l).map (↑) := rfl #align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe @[simp] theorem mem_powersetAux {l : List Ξ±} {s} : s ∈ powersetAux l ↔ s ≀ ↑l := Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm] #align multiset.mem_powerset_aux Multiset.mem_powersetAux def powersetAux' (l : List Ξ±) : List (Multiset Ξ±) := (sublists' l).map (↑) #align multiset.powerset_aux' Multiset.powersetAux' theorem powersetAux_perm_powersetAux' {l : List Ξ±} : powersetAux l ~ powersetAux' l := by rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _ #align multiset.powerset_aux_perm_powerset_aux' Multiset.powersetAux_perm_powersetAux' @[simp] theorem powersetAux'_nil : powersetAux' (@nil Ξ±) = [0] := rfl #align multiset.powerset_aux'_nil Multiset.powersetAux'_nil @[simp] theorem powersetAux'_cons (a : Ξ±) (l : List Ξ±) : powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l) := by simp only [powersetAux', sublists'_cons, map_append, List.map_map, append_cancel_left_eq]; rfl #align multiset.powerset_aux'_cons Multiset.powersetAux'_cons
Mathlib/Data/Multiset/Powerset.lean
60
70
theorem powerset_aux'_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetAux' l₁ ~ powersetAux' lβ‚‚ := by
induction' p with a l₁ lβ‚‚ p IH a b l l₁ lβ‚‚ l₃ _ _ IH₁ IHβ‚‚ Β· simp Β· simp only [powersetAux'_cons] exact IH.append (IH.map _) Β· simp only [powersetAux'_cons, map_append, List.map_map, append_assoc] apply Perm.append_left rw [← append_assoc, ← append_assoc, (by funext s; simp [cons_swap] : cons b ∘ cons a = cons a ∘ cons b)] exact perm_append_comm.append_right _ Β· exact IH₁.trans IHβ‚‚
10
22,026.465795
2
1.2
5
1,258
import Mathlib.Data.List.Sublists import Mathlib.Data.Multiset.Bind #align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {Ξ± : Type*} -- Porting note (#11215): TODO: Write a more efficient version def powersetAux (l : List Ξ±) : List (Multiset Ξ±) := (sublists l).map (↑) #align multiset.powerset_aux Multiset.powersetAux theorem powersetAux_eq_map_coe {l : List Ξ±} : powersetAux l = (sublists l).map (↑) := rfl #align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe @[simp] theorem mem_powersetAux {l : List Ξ±} {s} : s ∈ powersetAux l ↔ s ≀ ↑l := Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm] #align multiset.mem_powerset_aux Multiset.mem_powersetAux def powersetAux' (l : List Ξ±) : List (Multiset Ξ±) := (sublists' l).map (↑) #align multiset.powerset_aux' Multiset.powersetAux' theorem powersetAux_perm_powersetAux' {l : List Ξ±} : powersetAux l ~ powersetAux' l := by rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _ #align multiset.powerset_aux_perm_powerset_aux' Multiset.powersetAux_perm_powersetAux' @[simp] theorem powersetAux'_nil : powersetAux' (@nil Ξ±) = [0] := rfl #align multiset.powerset_aux'_nil Multiset.powersetAux'_nil @[simp] theorem powersetAux'_cons (a : Ξ±) (l : List Ξ±) : powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l) := by simp only [powersetAux', sublists'_cons, map_append, List.map_map, append_cancel_left_eq]; rfl #align multiset.powerset_aux'_cons Multiset.powersetAux'_cons theorem powerset_aux'_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetAux' l₁ ~ powersetAux' lβ‚‚ := by induction' p with a l₁ lβ‚‚ p IH a b l l₁ lβ‚‚ l₃ _ _ IH₁ IHβ‚‚ Β· simp Β· simp only [powersetAux'_cons] exact IH.append (IH.map _) Β· simp only [powersetAux'_cons, map_append, List.map_map, append_assoc] apply Perm.append_left rw [← append_assoc, ← append_assoc, (by funext s; simp [cons_swap] : cons b ∘ cons a = cons a ∘ cons b)] exact perm_append_comm.append_right _ Β· exact IH₁.trans IHβ‚‚ #align multiset.powerset_aux'_perm Multiset.powerset_aux'_perm theorem powersetAux_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetAux l₁ ~ powersetAux lβ‚‚ := powersetAux_perm_powersetAux'.trans <| (powerset_aux'_perm p).trans powersetAux_perm_powersetAux'.symm #align multiset.powerset_aux_perm Multiset.powersetAux_perm --Porting note (#11083): slightly slower implementation due to `map ofList` def powerset (s : Multiset Ξ±) : Multiset (Multiset Ξ±) := Quot.liftOn s (fun l => (powersetAux l : Multiset (Multiset Ξ±))) (fun _ _ h => Quot.sound (powersetAux_perm h)) #align multiset.powerset Multiset.powerset theorem powerset_coe (l : List Ξ±) : @powerset Ξ± l = ((sublists l).map (↑) : List (Multiset Ξ±)) := congr_arg ((↑) : List (Multiset Ξ±) β†’ Multiset (Multiset Ξ±)) powersetAux_eq_map_coe #align multiset.powerset_coe Multiset.powerset_coe @[simp] theorem powerset_coe' (l : List Ξ±) : @powerset Ξ± l = ((sublists' l).map (↑) : List (Multiset Ξ±)) := Quot.sound powersetAux_perm_powersetAux' #align multiset.powerset_coe' Multiset.powerset_coe' @[simp] theorem powerset_zero : @powerset Ξ± 0 = {0} := rfl #align multiset.powerset_zero Multiset.powerset_zero @[simp] theorem powerset_cons (a : Ξ±) (s) : powerset (a ::β‚˜ s) = powerset s + map (cons a) (powerset s) := Quotient.inductionOn s fun l => by simp only [quot_mk_to_coe, cons_coe, powerset_coe', sublists'_cons, map_append, List.map_map, map_coe, coe_add, coe_eq_coe]; rfl #align multiset.powerset_cons Multiset.powerset_cons @[simp] theorem mem_powerset {s t : Multiset Ξ±} : s ∈ powerset t ↔ s ≀ t := Quotient.inductionOnβ‚‚ s t <| by simp [Subperm, and_comm] #align multiset.mem_powerset Multiset.mem_powerset theorem map_single_le_powerset (s : Multiset Ξ±) : s.map singleton ≀ powerset s := Quotient.inductionOn s fun l => by simp only [powerset_coe, quot_mk_to_coe, coe_le, map_coe] show l.map (((↑) : List Ξ± β†’ Multiset Ξ±) ∘ pure) <+~ (sublists l).map (↑) rw [← List.map_map] exact ((map_pure_sublist_sublists _).map _).subperm #align multiset.map_single_le_powerset Multiset.map_single_le_powerset @[simp] theorem card_powerset (s : Multiset Ξ±) : card (powerset s) = 2 ^ card s := Quotient.inductionOn s <| by simp #align multiset.card_powerset Multiset.card_powerset
Mathlib/Data/Multiset/Powerset.lean
125
129
theorem revzip_powersetAux {l : List Ξ±} ⦃x⦄ (h : x ∈ revzip (powersetAux l)) : x.1 + x.2 = ↑l := by
rw [revzip, powersetAux_eq_map_coe, ← map_reverse, zip_map, ← revzip, List.mem_map] at h simp only [Prod.map_apply, Prod.exists] at h rcases h with ⟨l₁, lβ‚‚, h, rfl, rfl⟩ exact Quot.sound (revzip_sublists _ _ _ h)
4
54.59815
2
1.2
5
1,258
import Mathlib.Data.List.Sublists import Mathlib.Data.Multiset.Bind #align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {Ξ± : Type*} -- Porting note (#11215): TODO: Write a more efficient version def powersetAux (l : List Ξ±) : List (Multiset Ξ±) := (sublists l).map (↑) #align multiset.powerset_aux Multiset.powersetAux theorem powersetAux_eq_map_coe {l : List Ξ±} : powersetAux l = (sublists l).map (↑) := rfl #align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe @[simp] theorem mem_powersetAux {l : List Ξ±} {s} : s ∈ powersetAux l ↔ s ≀ ↑l := Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm] #align multiset.mem_powerset_aux Multiset.mem_powersetAux def powersetAux' (l : List Ξ±) : List (Multiset Ξ±) := (sublists' l).map (↑) #align multiset.powerset_aux' Multiset.powersetAux' theorem powersetAux_perm_powersetAux' {l : List Ξ±} : powersetAux l ~ powersetAux' l := by rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _ #align multiset.powerset_aux_perm_powerset_aux' Multiset.powersetAux_perm_powersetAux' @[simp] theorem powersetAux'_nil : powersetAux' (@nil Ξ±) = [0] := rfl #align multiset.powerset_aux'_nil Multiset.powersetAux'_nil @[simp] theorem powersetAux'_cons (a : Ξ±) (l : List Ξ±) : powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l) := by simp only [powersetAux', sublists'_cons, map_append, List.map_map, append_cancel_left_eq]; rfl #align multiset.powerset_aux'_cons Multiset.powersetAux'_cons theorem powerset_aux'_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetAux' l₁ ~ powersetAux' lβ‚‚ := by induction' p with a l₁ lβ‚‚ p IH a b l l₁ lβ‚‚ l₃ _ _ IH₁ IHβ‚‚ Β· simp Β· simp only [powersetAux'_cons] exact IH.append (IH.map _) Β· simp only [powersetAux'_cons, map_append, List.map_map, append_assoc] apply Perm.append_left rw [← append_assoc, ← append_assoc, (by funext s; simp [cons_swap] : cons b ∘ cons a = cons a ∘ cons b)] exact perm_append_comm.append_right _ Β· exact IH₁.trans IHβ‚‚ #align multiset.powerset_aux'_perm Multiset.powerset_aux'_perm theorem powersetAux_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetAux l₁ ~ powersetAux lβ‚‚ := powersetAux_perm_powersetAux'.trans <| (powerset_aux'_perm p).trans powersetAux_perm_powersetAux'.symm #align multiset.powerset_aux_perm Multiset.powersetAux_perm --Porting note (#11083): slightly slower implementation due to `map ofList` def powerset (s : Multiset Ξ±) : Multiset (Multiset Ξ±) := Quot.liftOn s (fun l => (powersetAux l : Multiset (Multiset Ξ±))) (fun _ _ h => Quot.sound (powersetAux_perm h)) #align multiset.powerset Multiset.powerset theorem powerset_coe (l : List Ξ±) : @powerset Ξ± l = ((sublists l).map (↑) : List (Multiset Ξ±)) := congr_arg ((↑) : List (Multiset Ξ±) β†’ Multiset (Multiset Ξ±)) powersetAux_eq_map_coe #align multiset.powerset_coe Multiset.powerset_coe @[simp] theorem powerset_coe' (l : List Ξ±) : @powerset Ξ± l = ((sublists' l).map (↑) : List (Multiset Ξ±)) := Quot.sound powersetAux_perm_powersetAux' #align multiset.powerset_coe' Multiset.powerset_coe' @[simp] theorem powerset_zero : @powerset Ξ± 0 = {0} := rfl #align multiset.powerset_zero Multiset.powerset_zero @[simp] theorem powerset_cons (a : Ξ±) (s) : powerset (a ::β‚˜ s) = powerset s + map (cons a) (powerset s) := Quotient.inductionOn s fun l => by simp only [quot_mk_to_coe, cons_coe, powerset_coe', sublists'_cons, map_append, List.map_map, map_coe, coe_add, coe_eq_coe]; rfl #align multiset.powerset_cons Multiset.powerset_cons @[simp] theorem mem_powerset {s t : Multiset Ξ±} : s ∈ powerset t ↔ s ≀ t := Quotient.inductionOnβ‚‚ s t <| by simp [Subperm, and_comm] #align multiset.mem_powerset Multiset.mem_powerset theorem map_single_le_powerset (s : Multiset Ξ±) : s.map singleton ≀ powerset s := Quotient.inductionOn s fun l => by simp only [powerset_coe, quot_mk_to_coe, coe_le, map_coe] show l.map (((↑) : List Ξ± β†’ Multiset Ξ±) ∘ pure) <+~ (sublists l).map (↑) rw [← List.map_map] exact ((map_pure_sublist_sublists _).map _).subperm #align multiset.map_single_le_powerset Multiset.map_single_le_powerset @[simp] theorem card_powerset (s : Multiset Ξ±) : card (powerset s) = 2 ^ card s := Quotient.inductionOn s <| by simp #align multiset.card_powerset Multiset.card_powerset theorem revzip_powersetAux {l : List Ξ±} ⦃x⦄ (h : x ∈ revzip (powersetAux l)) : x.1 + x.2 = ↑l := by rw [revzip, powersetAux_eq_map_coe, ← map_reverse, zip_map, ← revzip, List.mem_map] at h simp only [Prod.map_apply, Prod.exists] at h rcases h with ⟨l₁, lβ‚‚, h, rfl, rfl⟩ exact Quot.sound (revzip_sublists _ _ _ h) #align multiset.revzip_powerset_aux Multiset.revzip_powersetAux
Mathlib/Data/Multiset/Powerset.lean
132
137
theorem revzip_powersetAux' {l : List Ξ±} ⦃x⦄ (h : x ∈ revzip (powersetAux' l)) : x.1 + x.2 = ↑l := by
rw [revzip, powersetAux', ← map_reverse, zip_map, ← revzip, List.mem_map] at h simp only [Prod.map_apply, Prod.exists] at h rcases h with ⟨l₁, lβ‚‚, h, rfl, rfl⟩ exact Quot.sound (revzip_sublists' _ _ _ h)
4
54.59815
2
1.2
5
1,258
import Mathlib.SetTheory.Ordinal.Arithmetic import Mathlib.Tactic.TFAE import Mathlib.Topology.Order.Monotone #align_import set_theory.ordinal.topology from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da" noncomputable section universe u v open Cardinal Order Topology namespace Ordinal variable {s : Set Ordinal.{u}} {a : Ordinal.{u}} instance : TopologicalSpace Ordinal.{u} := Preorder.topology Ordinal.{u} instance : OrderTopology Ordinal.{u} := ⟨rfl⟩
Mathlib/SetTheory/Ordinal/Topology.lean
41
53
theorem isOpen_singleton_iff : IsOpen ({a} : Set Ordinal) ↔ Β¬IsLimit a := by
refine ⟨fun h ⟨hβ‚€, hsucc⟩ => ?_, fun ha => ?_⟩ Β· obtain ⟨b, c, hbc, hbc'⟩ := (mem_nhds_iff_exists_Ioo_subset' ⟨0, Ordinal.pos_iff_ne_zero.2 hβ‚€βŸ© ⟨_, lt_succ a⟩).1 (h.mem_nhds rfl) have hba := hsucc b hbc.1 exact hba.ne (hbc' ⟨lt_succ b, hba.trans hbc.2⟩) Β· rcases zero_or_succ_or_limit a with (rfl | ⟨b, rfl⟩ | ha') Β· rw [← bot_eq_zero, ← Set.Iic_bot, ← Iio_succ] exact isOpen_Iio Β· rw [← Set.Icc_self, Icc_succ_left, ← Ioo_succ_right] exact isOpen_Ioo Β· exact (ha ha').elim
12
162,754.791419
2
1.2
5
1,259
import Mathlib.SetTheory.Ordinal.Arithmetic import Mathlib.Tactic.TFAE import Mathlib.Topology.Order.Monotone #align_import set_theory.ordinal.topology from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da" noncomputable section universe u v open Cardinal Order Topology namespace Ordinal variable {s : Set Ordinal.{u}} {a : Ordinal.{u}} instance : TopologicalSpace Ordinal.{u} := Preorder.topology Ordinal.{u} instance : OrderTopology Ordinal.{u} := ⟨rfl⟩ theorem isOpen_singleton_iff : IsOpen ({a} : Set Ordinal) ↔ Β¬IsLimit a := by refine ⟨fun h ⟨hβ‚€, hsucc⟩ => ?_, fun ha => ?_⟩ Β· obtain ⟨b, c, hbc, hbc'⟩ := (mem_nhds_iff_exists_Ioo_subset' ⟨0, Ordinal.pos_iff_ne_zero.2 hβ‚€βŸ© ⟨_, lt_succ a⟩).1 (h.mem_nhds rfl) have hba := hsucc b hbc.1 exact hba.ne (hbc' ⟨lt_succ b, hba.trans hbc.2⟩) Β· rcases zero_or_succ_or_limit a with (rfl | ⟨b, rfl⟩ | ha') Β· rw [← bot_eq_zero, ← Set.Iic_bot, ← Iio_succ] exact isOpen_Iio Β· rw [← Set.Icc_self, Icc_succ_left, ← Ioo_succ_right] exact isOpen_Ioo Β· exact (ha ha').elim #align ordinal.is_open_singleton_iff Ordinal.isOpen_singleton_iff -- Porting note (#11215): TODO: generalize to a `SuccOrder` theorem nhds_right' (a : Ordinal) : 𝓝[>] a = βŠ₯ := (covBy_succ a).nhdsWithin_Ioi -- todo: generalize to a `SuccOrder`
Mathlib/SetTheory/Ordinal/Topology.lean
60
61
theorem nhds_left'_eq_nhds_ne (a : Ordinal) : 𝓝[<] a = 𝓝[β‰ ] a := by
rw [← nhds_left'_sup_nhds_right', nhds_right', sup_bot_eq]
1
2.718282
0
1.2
5
1,259