From dd84aa07484b6daf2d3ffa56d17dc49f22c8a18a Mon Sep 17 00:00:00 2001 From: Monica Omar <2497250a@research.gla.ac.uk> Date: Mon, 26 Feb 2024 12:57:04 +0000 Subject: [PATCH] fix --- src/linear_algebra/my_ips/pos.lean | 10 ++-- src/linear_algebra/my_matrix/basic.lean | 3 +- .../my_matrix/include_block.lean | 49 ++++++++++--------- .../pos_eq_linear_map_is_positive.lean | 2 +- src/linear_algebra/of_norm.lean | 6 +-- src/linear_algebra/pi_direct_sum.lean | 8 ++- 6 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/linear_algebra/my_ips/pos.lean b/src/linear_algebra/my_ips/pos.lean index cb01da9711..466efafc46 100644 --- a/src/linear_algebra/my_ips/pos.lean +++ b/src/linear_algebra/my_ips/pos.lean @@ -360,8 +360,10 @@ begin exact h, } end -lemma ext_inner_left_iff [inner_product_space π•œ E] (x y : E) : - x = y ↔ βˆ€ v : E, βŸͺx, v⟫ = βŸͺy, v⟫ := +lemma ext_inner_left_iff {π•œ E : Type*} + [is_R_or_C π•œ] [normed_add_comm_group E] + [inner_product_space π•œ E] (x y : E) : + x = y ↔ βˆ€ v : E, inner x v = (inner y v : π•œ) := begin split, { intros h v, @@ -398,7 +400,7 @@ begin rw [mul_inv_of_self, one_apply] at ugh, exact ugh, rw ugh, - exact t1.1, exact _inst_4, exact _inst_6, }, + exact t1.1, }, { intro x, by_cases b : β…Ÿ T x = 0, { rw [b, inner_zero_right, map_zero], }, @@ -533,7 +535,7 @@ begin end open_locale big_operators -lemma linear_map.is_positive_iff_eq_sum_rank_one {n : β„•} [inner_product_space π•œ E] +lemma linear_map.is_positive_iff_eq_sum_rank_one {n : β„•} [decidable_eq π•œ] [finite_dimensional π•œ E] (hn : finite_dimensional.finrank π•œ E = n) (T : E β†’β‚—[π•œ] E) : T.is_positive ↔ βˆƒ (m : β„•) (u : fin m β†’ E), diff --git a/src/linear_algebra/my_matrix/basic.lean b/src/linear_algebra/my_matrix/basic.lean index f33be712f4..9dcec91ff3 100644 --- a/src/linear_algebra/my_matrix/basic.lean +++ b/src/linear_algebra/my_matrix/basic.lean @@ -267,7 +267,8 @@ begin simp only [matrix.transpose_apply, matrix.kronecker_map, of_apply], end -lemma matrix.kronecker.conj (x y : matrix n n π•œ) : +lemma matrix.kronecker.conj + {n : Type*} (x y : matrix n n π•œ) : (x βŠ—β‚– y)α΄΄α΅€ = xα΄΄α΅€ βŠ—β‚– yα΄΄α΅€ := by rw [conj, matrix.kronecker_conj_transpose, matrix.kronecker.transpose]; refl diff --git a/src/linear_algebra/my_matrix/include_block.lean b/src/linear_algebra/my_matrix/include_block.lean index 5e84cd7e4c..055735dec3 100644 --- a/src/linear_algebra/my_matrix/include_block.lean +++ b/src/linear_algebra/my_matrix/include_block.lean @@ -98,9 +98,9 @@ linear_map.single i -- { intros h, -- simp only [h, pi.zero_apply, dif_neg, not_false_iff, smul_zero], }, } } -lemma include_block_apply {o : Type*} [fintype o] [decidable_eq o] {m' : o β†’ Type*} +lemma include_block_apply {o : Type*} [decidable_eq o] {m' : o β†’ Type*} {Ξ± : Type*} - [Ξ  i, fintype (m' i)] [Ξ  i, decidable_eq (m' i)] [comm_semiring Ξ±] {i : o} (x : matrix (m' i) (m' i) Ξ±) : + [comm_semiring Ξ±] {i : o} (x : matrix (m' i) (m' i) Ξ±) : (include_block : matrix (m' i) (m' i) Ξ± β†’β‚—[Ξ±] Ξ  j, matrix (m' j) (m' j) Ξ±) x = Ξ» (j : o), dite (i = j) (Ξ» h, eq.mp (by rw [h]) x) (Ξ» _, 0) := begin @@ -224,8 +224,8 @@ lemma is_block_diagonal.eq {k : Type*} [decidable_eq k] block_diagonal' (x.block_diag') = x := hx -lemma is_block_diagonal.add {k : Type*} [fintype k] [decidable_eq k] - {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] +lemma is_block_diagonal.add {k : Type*} [decidable_eq k] + {s : k β†’ Type*} {x y : matrix (Ξ£ i, s i) (Ξ£ i, s i) R} (hx : x.is_block_diagonal) (hy : y.is_block_diagonal) : (x + y).is_block_diagonal := @@ -294,8 +294,8 @@ lemma is_block_diagonal.coe_zero {k : Type*} [fintype k] [decidable_eq k] ((0 : { x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R // x.is_block_diagonal }) : matrix (Ξ£ i, s i) (Ξ£ i, s i) R) = 0 := rfl -lemma is_block_diagonal.smul {k : Type*} [fintype k] [decidable_eq k] - {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] +lemma is_block_diagonal.smul {k : Type*} [decidable_eq k] + {s : k β†’ Type*} {x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R} (hx : x.is_block_diagonal) (Ξ± : R) : (Ξ± β€’ x).is_block_diagonal := begin @@ -342,15 +342,15 @@ begin rw [matrix.is_block_diagonal, block_diag'_block_diagonal'], end -lemma is_block_diagonal_iff {k : Type*} [fintype k] [decidable_eq k] - {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] +lemma is_block_diagonal_iff {k : Type*} [decidable_eq k] + {s : k β†’ Type*} (x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R) : x.is_block_diagonal ↔ βˆƒ y : (Ξ  i, matrix (s i) (s i) R), x = block_diagonal' y := ⟨λ h, ⟨x.block_diag', h.symm⟩, by rintros ⟨y, rfl⟩; exact matrix.is_block_diagonal.block_diagonal' y⟩ -def std_basis_matrix_block_diagonal {k : Type*} [fintype k] [decidable_eq k] - {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] +def std_basis_matrix_block_diagonal {k : Type*} [decidable_eq k] + {s : k β†’ Type*} [Ξ  i, decidable_eq (s i)] (i : k) (j l : s i) (Ξ± : R) : {x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R // x.is_block_diagonal} := ⟨std_basis_matrix ⟨i, j⟩ ⟨i, l⟩ Ξ±, by { @@ -469,7 +469,7 @@ begin end lemma is_block_diagonal.mul {k : Type*} [fintype k] [decidable_eq k] - {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] + {s : k β†’ Type*} [Ξ  i, fintype (s i)] {x y : matrix (Ξ£ i, s i) (Ξ£ i, s i) R} (hx : x.is_block_diagonal) (hy : y.is_block_diagonal) : (x ⬝ y).is_block_diagonal := @@ -495,8 +495,8 @@ lemma is_block_diagonal.one {k : Type*} [decidable_eq k] (1 : matrix (Ξ£ i, s i) (Ξ£ i, s i) R).is_block_diagonal := by simp only [matrix.is_block_diagonal, block_diag'_one, block_diagonal'_one] -@[instance] def is_block_diagonal.has_one {k : Type*} [fintype k] [decidable_eq k] - {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] : +@[instance] def is_block_diagonal.has_one {k : Type*} [decidable_eq k] + {s : k β†’ Type*} [Ξ  i, decidable_eq (s i)] : has_one {x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R // x.is_block_diagonal} := { one := ⟨(1 : matrix (Ξ£ i, s i) (Ξ£ i, s i) R), is_block_diagonal.one⟩ } @@ -625,8 +625,8 @@ x.2 is_block_diagonal.coe_block_diagonal'_block_diag' (x * y), is_block_diagonal.coe_mul, mul_eq_mul], }, } -lemma is_block_diagonal.star {R : Type*} [comm_semiring R] [star_add_monoid R] {k : Type*} [fintype k] [decidable_eq k] - {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] +lemma is_block_diagonal.star {R : Type*} [comm_semiring R] [star_add_monoid R] {k : Type*} [decidable_eq k] + {s : k β†’ Type*} {x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R} (hx : x.is_block_diagonal) : (xα΄΄).is_block_diagonal := begin @@ -705,7 +705,7 @@ end refl, }, } lemma is_block_diagonal.apply_of_ne {R : Type*} [comm_semiring R] {k : Type*} - [fintype k] [decidable_eq k] {s : k β†’ Type*} [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] + [decidable_eq k] {s : k β†’ Type*} {x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R} (hx : x.is_block_diagonal) (i j : Ξ£ i, s i) (h : i.1 β‰  j.1) : x i j = 0 := @@ -745,8 +745,8 @@ end [Ξ  i, fintype (s i)] [Ξ  i, decidable_eq (s i)] : ((Ξ  i, matrix (s i) (s i) R) β†’β‚—[R] (Ξ  i, matrix (s i) (s i) R)) ≃ₐ[R] - { x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R // x.is_block_diagonal } - β†’β‚—[R] { x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R // x.is_block_diagonal } := + ({ x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R // x.is_block_diagonal } + β†’β‚—[R] { x : matrix (Ξ£ i, s i) (Ξ£ i, s i) R // x.is_block_diagonal }) := is_block_diagonal_pi_alg_equiv.symm.to_linear_equiv.inner_conj end matrix @@ -760,14 +760,15 @@ local notation `ℍ_ `i := matrix (s i) (s i) R open matrix lemma tensor_product.assoc_include_block + {k : Type*} [decidable_eq k] {s : k β†’ Type*} {i j : k} : - ↑(tensor_product.assoc R ℍ₂ ℍ₂ ℍ₂).symm βˆ˜β‚— - ((include_block : (ℍ_ i) β†’β‚—[R] ℍ₂) - βŠ—β‚˜ ((include_block : (ℍ_ j) β†’β‚—[R] ℍ₂) βŠ—β‚˜ (include_block : (ℍ_ j) β†’β‚—[R] ℍ₂))) + ↑(tensor_product.assoc R (Ξ  a, matrix (s a) (s a) R) (Ξ  a, matrix (s a) (s a) R) (Ξ  a, matrix (s a) (s a) R)).symm βˆ˜β‚— + ((include_block : (matrix (s i) (s i) R) β†’β‚—[R] Ξ  a, matrix (s a) (s a) R) + βŠ—β‚˜ ((include_block : (matrix (s j) (s j) R) β†’β‚—[R] Ξ  a, matrix (s a) (s a) R) βŠ—β‚˜ (include_block : (matrix (s j) (s j) R) β†’β‚—[R] Ξ  a, matrix (s a) (s a) R))) = - (((include_block : (ℍ_ i) β†’β‚—[R] ℍ₂) - βŠ—β‚˜ ((include_block : (ℍ_ j) β†’β‚—[R] ℍ₂))) βŠ—β‚˜ (include_block : (ℍ_ j) β†’β‚—[R] ℍ₂)) βˆ˜β‚— - ↑(tensor_product.assoc R (ℍ_ i) (ℍ_ j) (ℍ_ j)).symm := + (((include_block : (matrix (s i) (s i) R) β†’β‚—[R] Ξ  a, matrix (s a) (s a) R) + βŠ—β‚˜ ((include_block : (matrix (s j)(s j) R) β†’β‚—[R] Ξ  a, matrix (s a) (s a) R))) βŠ—β‚˜ (include_block : (matrix (s j) (s j) R) β†’β‚—[R] Ξ  a, matrix (s a) (s a) R)) βˆ˜β‚— + ↑(tensor_product.assoc R (matrix (s i) (s i) R) (matrix (s j) (s j) R) (matrix (s j) (s j) R)).symm := begin apply tensor_product.ext_threefold', intros x y z, diff --git a/src/linear_algebra/my_matrix/pos_eq_linear_map_is_positive.lean b/src/linear_algebra/my_matrix/pos_eq_linear_map_is_positive.lean index b79da3f4d1..3d152c24c5 100644 --- a/src/linear_algebra/my_matrix/pos_eq_linear_map_is_positive.lean +++ b/src/linear_algebra/my_matrix/pos_eq_linear_map_is_positive.lean @@ -357,7 +357,7 @@ def linear_map.positive_map (T : (M₁ β†’β‚—[β„‚] M₁) β†’β‚—[β„‚] (Mβ‚‚ β†’ βˆ€ x : M₁ β†’β‚—[β„‚] M₁, x.is_positive β†’ (T x).is_positive /-- a $^*$-homomorphism from $L(M_1)$ to $L(M_2)$ is a positive map -/ -lemma linear_map.positive_map.star_hom {n₁ nβ‚‚ : β„•} +lemma linear_map.positive_map.star_hom {n₁ : β„•} [finite_dimensional β„‚ M₁] [finite_dimensional β„‚ Mβ‚‚] (hn₁ : finite_dimensional.finrank β„‚ M₁ = n₁) (Ο† : star_alg_hom β„‚ (M₁ β†’β‚—[β„‚] M₁) (Mβ‚‚ β†’β‚—[β„‚] Mβ‚‚)) : diff --git a/src/linear_algebra/of_norm.lean b/src/linear_algebra/of_norm.lean index d67e1c20fb..1ee1796ad0 100644 --- a/src/linear_algebra/of_norm.lean +++ b/src/linear_algebra/of_norm.lean @@ -460,20 +460,20 @@ begin simp only [and_iff_right_iff_imp, f.is_linear, implies_true_iff], end -def with_bound (π•œ : Type*) {E : Type*} +def with_bound {E : Type*} [normed_add_comm_group E] {F : Type*} [normed_add_comm_group F] (f : E β†’ F) : Prop := βˆƒ M, 0 < M ∧ βˆ€ x : E, β€–f xβ€– ≀ M * β€–xβ€– lemma is_bounded_linear_map.def {π•œ E : Type*} [nontrivially_normed_field π•œ] [normed_add_comm_group E] [normed_space π•œ E] {F : Type*} [normed_add_comm_group F] [normed_space π•œ F] {f : E β†’ F} : - is_bounded_linear_map π•œ f ↔ (is_linear_map π•œ f ∧ with_bound π•œ f) := + is_bounded_linear_map π•œ f ↔ (is_linear_map π•œ f ∧ with_bound f) := ⟨λ h, ⟨h.1, h.2⟩, Ξ» h, ⟨h.1, h.2⟩⟩ lemma linear_map.with_bound_iff_is_continuous {π•œ E : Type*} [nontrivially_normed_field π•œ] [normed_add_comm_group E] [normed_space π•œ E] {F : Type*} [normed_add_comm_group F] [normed_space π•œ F] {f : E β†’β‚—[π•œ] F} : - with_bound π•œ f ↔ continuous f := + with_bound f ↔ continuous f := begin have := @is_bounded_linear_map_iff_is_continuous_linear_map π•œ _ _ _ _ _ _ _ f, simp only [is_bounded_linear_map.def, is_continuous_linear_map, and.congr_right_iff, diff --git a/src/linear_algebra/pi_direct_sum.lean b/src/linear_algebra/pi_direct_sum.lean index 19bc12d5b2..f994089a46 100644 --- a/src/linear_algebra/pi_direct_sum.lean +++ b/src/linear_algebra/pi_direct_sum.lean @@ -62,8 +62,7 @@ def direct_sum_tensor_to_fun refl, } } lemma direct_sum_tensor_to_fun_apply - {R : Type*} [comm_semiring R] {ι₁ : Type*} {ΞΉβ‚‚ : Type*} [decidable_eq ι₁] - [decidable_eq ΞΉβ‚‚] + {R : Type*} [comm_semiring R] {ι₁ : Type*} {ΞΉβ‚‚ : Type*} {M₁ : ι₁ β†’ Type*} {Mβ‚‚ : ΞΉβ‚‚ β†’ Type*} [Ξ  (i₁ : ι₁), add_comm_group (M₁ i₁)] [Ξ  (iβ‚‚ : ΞΉβ‚‚), add_comm_group (Mβ‚‚ iβ‚‚)] [Ξ  (i₁ : ι₁), module R (M₁ i₁)] [Ξ  (iβ‚‚ : ΞΉβ‚‚), module R (Mβ‚‚ iβ‚‚)] (x : Ξ  i, M₁ i) (y : Ξ  i, Mβ‚‚ i) (i : ι₁ Γ— ΞΉβ‚‚) : @@ -83,7 +82,7 @@ def direct_sum_tensor_inv_fun {R : Type*} [comm_ring R] {ι₁ : Type*} {ΞΉβ‚‚ : map_smul' := Ξ» r x, by { simp only [smul_hom_class.map_smul, pi.smul_apply, ring_hom.id_apply], rw [← finset.smul_sum], } } -lemma function.sum_update_eq_self {R : Type*} {ι₁ : Type*} [decidable_eq ι₁] +lemma function.sum_update_eq_self {ι₁ : Type*} [decidable_eq ι₁] [fintype ι₁] {M₁ : ι₁ β†’ Type*} [Ξ  (i₁ : ι₁), add_comm_group (M₁ i₁)] (x : Ξ  i, M₁ i) : βˆ‘ (x_1 : ι₁), function.update 0 x_1 (x x_1) = x := @@ -122,7 +121,7 @@ begin by { simp only [tensor_product.tmul_sum, tensor_product.sum_tmul], } ... = x βŠ—β‚œ[R] y : _, congr; - exact @function.sum_update_eq_self R _ _ _ _ _ _, }, + exact @function.sum_update_eq_self _ _ _ _ _ _, }, { intros x y hx hy, simp only [map_add, hx, hy], }, end @@ -267,7 +266,6 @@ end [Ξ  i, add_comm_monoid (Ο† i)] [Ξ  i, module R (Ο† i)] [Ξ  i, add_comm_monoid (ψ i)] [Ξ  i, module R (ψ i)] (S : Type*) [fintype ι₁] [decidable_eq ι₁] - [fintype ΞΉβ‚‚] [decidable_eq ΞΉβ‚‚] [semiring S] [Ξ  i, module S (ψ i)] [Ξ  i, smul_comm_class R S (ψ i)] : (Ξ  i : ι₁ Γ— ΞΉβ‚‚, Ο† i.1 β†’β‚—[R] ψ i.2) ≃ₗ[S] (Ξ  i, Ο† i) β†’β‚—[R] (Ξ  i, ψ i) :=