Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

[Merged by Bors] - feat(linear_algebra/trace): dual_tensor_hom is an equivalence + basis-free characterization of the trace #10372

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
da80c7e
feat(linear_algebra/trace): dual_tensor_hom is an equivalence + basis…
antoinelab01 Nov 17, 2021
eadcf9c
fixed typo
antoinelab01 Nov 17, 2021
8451a8b
Update src/linear_algebra/tensor_product_basis.lean
antoinelab01 Nov 17, 2021
082bf6c
Update src/linear_algebra/tensor_product_basis.lean
antoinelab01 Nov 17, 2021
bedb05e
Update src/linear_algebra/trace.lean
antoinelab01 Nov 17, 2021
6888028
added explicit inverse of dual_tensor_hom given a basis + minor changes
antoinelab01 Nov 18, 2021
7733e5a
removed field hypothesis from hom_dual_tensor
antoinelab01 Nov 18, 2021
34a1f82
minor changes
antoinelab01 Nov 18, 2021
1dc515d
Update src/linear_algebra/contraction.lean
antoinelab01 Nov 19, 2021
1bab109
.
antoinelab01 Nov 22, 2021
30bf95e
.
antoinelab01 Nov 22, 2021
3796b08
added lemma for sum of single
antoinelab01 Nov 23, 2021
2d0ca91
fixed line too long
antoinelab01 Nov 23, 2021
80b5403
second version of fintype_sum_single
antoinelab01 Nov 23, 2021
91a59c9
explicit equivalence given basis without field assumption
antoinelab01 Nov 23, 2021
2b7f981
Update src/linear_algebra/contraction.lean
antoinelab01 Nov 23, 2021
f879320
Update src/linear_algebra/contraction.lean
antoinelab01 Nov 23, 2021
97b7318
minor changes
antoinelab01 Nov 23, 2021
7a9be3d
Merge branch 'trace' of https://github.com/leanprover-community/mathl…
antoinelab01 Nov 23, 2021
521ab65
Update src/linear_algebra/contraction.lean
antoinelab01 Nov 23, 2021
f611861
Update src/linear_algebra/contraction.lean
antoinelab01 Nov 29, 2021
f5ce923
breaking some proofs into small lemmas
antoinelab01 Nov 29, 2021
a944d98
Add missing doc string and other minor tidy up
ocfnash Jan 11, 2022
ed5df7b
Update src/linear_algebra/contraction.lean
antoinelab01 Jan 11, 2022
15b9e1d
removed equiv lemmas
antoinelab01 Mar 9, 2022
7f5d67b
.
antoinelab01 Mar 9, 2022
59a0c0e
fixed conflicts
antoinelab01 Mar 9, 2022
e3195fd
fixed error in trace_eq_contract'
antoinelab01 Mar 9, 2022
e32e2de
fixed line too long
antoinelab01 Mar 9, 2022
3d09e9b
fixed linter issues
antoinelab01 Mar 9, 2022
eaa72d0
revert accidental modification of variables
antoinelab01 Mar 10, 2022
52951a5
generalized trace_eq_contract to free modules over commutative rings
antoinelab01 Mar 15, 2022
f21bfb9
fixed decidable_classical issues
antoinelab01 Mar 15, 2022
e2aaa88
integrated hom_dual_tensor in the equivalence
antoinelab01 Apr 5, 2022
f78dcab
modified single_one_smul
antoinelab01 Apr 6, 2022
966e88f
generalized the vector space statements to finite free modules
antoinelab01 Apr 13, 2022
f3654e5
removed trace_same
antoinelab01 Apr 14, 2022
ef1e848
Update src/linear_algebra/contraction.lean
antoinelab01 Apr 19, 2022
63cc7a6
Update src/linear_algebra/trace.lean
antoinelab01 Apr 19, 2022
86cadfc
Update src/linear_algebra/trace.lean
antoinelab01 Apr 19, 2022
7e6ea37
changed name to sum_univ_single
antoinelab01 Apr 19, 2022
ae0d84e
Merge branch 'master' into trace
ocfnash Apr 20, 2022
126dd47
fix issue in representation_theory/basic
antoinelab01 Apr 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/data/matrix/basis.lean
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,15 @@ variables (i j : n) (c : α) (i' j' : n)
@[simp] lemma diag_zero (h : j ≠ i) : diag n α α (std_basis_matrix i j c) = 0 :=
funext $ λ k, if_neg $ λ ⟨e₁, e₂⟩, h (e₂.trans e₁.symm)

@[simp] lemma diag_same : diag n α α (std_basis_matrix i i c) = pi.single i c :=
by { ext j, by_cases hij : i = j; try {rw hij}; simp [hij] }

variable [fintype n]

lemma trace_zero (h : j ≠ i) : trace n α α (std_basis_matrix i j c) = 0 := by simp [h]

lemma trace_same : trace n α α (std_basis_matrix i i c) = c := by simp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the proof is simp, do you really need it? What happens if you remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At any rate this lemma should include std_basis_matrix in its name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I don't really need it.


@[simp] lemma mul_left_apply_same (b : n) (M : matrix n n α) :
(std_basis_matrix i j c ⬝ M) i b = c * M j b :=
by simp [mul_apply, std_basis_matrix]
Expand Down
52 changes: 51 additions & 1 deletion src/linear_algebra/contraction.lean
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/-
Copyright (c) 2020 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
Authors: Oliver Nash, Antoine Labelle
-/
import linear_algebra.dual
import linear_algebra.matrix.to_lin
import linear_algebra.tensor_product_basis
import linear_algebra.free_module.finite.rank

/-!
# Contractions
Expand All @@ -21,8 +24,14 @@ universes u v


section contraction

open tensor_product
open linear_map
open matrix
open_locale tensor_product
open_locale big_operators

section

variables (R : Type u) (M N : Type v)
variables [comm_ring R] [add_comm_group M] [add_comm_group N] [module R M] [module R N]
Expand Down Expand Up @@ -51,4 +60,45 @@ variables {R M N}
dual_tensor_hom R M N (f ⊗ₜ n) m = (f m) • n :=
by { dunfold dual_tensor_hom, rw uncurry_apply, refl, }

/-- As a matrix, `dual_tensor_hom` evaluated on a basis element of `M* ⊗ N` is a matrix with a
single one and zeros elsewhere -/
theorem dual_tensor_hom_basis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
theorem dual_tensor_hom_basis
theorem to_matrix_dual_tensor_hom

{m : Type*} {n : Type*} [fintype m] [fintype n] [decidable_eq m] [decidable_eq n]
(bM : basis m R M) (bN : basis n R N) (j : m) (i : n) :
to_matrix bM bN (dual_tensor_hom R M N (bM.coord j ⊗ₜ bN i)) = std_basis_matrix i j 1 :=
begin
ext i' j',
by_cases hij : (i = i' ∧ j = j');
simp [linear_map.to_matrix_apply, finsupp.single_eq_pi_single, hij],
rw [and_iff_not_or_not, not_not] at hij, cases hij; simp [hij],
end

end

open finite_dimensional
variables (R : Type u) (M N : Type v)
variables [field R] [add_comm_group M] [add_comm_group N] [module R M] [module R N]
variables [finite_dimensional R M]

theorem dual_tensor_hom_surj : function.surjective (dual_tensor_hom R M N) :=
begin
intro f,
have b := fin_basis R M,
use ∑ (i : fin (finrank R M)), (b.dual_basis i) ⊗ₜ f (b i),
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
ext m, simp,
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
nth_rewrite_rhs 0 ←basis.sum_repr b m, simp,
end

variables [finite_dimensional R N]

theorem dual_tensor_hom_inj : function.injective (dual_tensor_hom R M N) :=
(injective_iff_surjective_of_finrank_eq_finrank (by simp)).2 (dual_tensor_hom_surj R M N)

noncomputable def dual_tensor_hom_equiv : (module.dual R M) ⊗[R] N ≃ₗ[R] M →ₗ[R] N :=
linear_equiv.of_bijective (dual_tensor_hom R M N)
(dual_tensor_hom_inj R M N) (dual_tensor_hom_surj R M N)

lemma dual_tensor_hom_equiv_to_lin (f : (module.dual R M) ⊗[R] N):
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
(dual_tensor_hom_equiv R M N) f = (dual_tensor_hom R M N) f := rfl

end contraction
9 changes: 9 additions & 0 deletions src/linear_algebra/tensor_product_basis.lean
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ finsupp.basis_single_one.map
(finsupp_tensor_finsupp R _ _ _ _).trans $
finsupp.lcongr (equiv.refl _) (tensor_product.lid R R)).symm

@[simp]
lemma basis.tensor_product_apply (b : basis ι R M) (c : basis κ R N) (i : ι) (j : κ) :
basis.tensor_product b c (i, j) = b i ⊗ₜ c j :=
by simp [basis.tensor_product]

lemma basis.tensor_product_apply' (b : basis ι R M) (c : basis κ R N) (i : ι × κ) :
(basis.tensor_product b c) i = b i.1 ⊗ₜ c i.2 :=
by { dunfold basis.tensor_product, simp }
antoinelab01 marked this conversation as resolved.
Show resolved Hide resolved

end comm_ring

section field
Expand Down
27 changes: 25 additions & 2 deletions src/linear_algebra/trace.lean
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/-
Copyright (c) 2019 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Patrick Massot, Casper Putz, Anne Baanen
Authors: Johannes Hölzl, Patrick Massot, Casper Putz, Anne Baanen, Antoine Labelle
-/
import linear_algebra.matrix.to_lin
import linear_algebra.matrix.trace

import linear_algebra.contraction
import linear_algebra.tensor_product_basis

/-!
# Trace of a linear map
Expand Down Expand Up @@ -115,6 +116,28 @@ end
section
variables (R : Type u) [field R] {M : Type v} [add_comm_group M] [module R M]

/-- The trace of a linear map correspond to the contraction pairing under the isomorphism
`M →ₗ M ≃ M* ⊗ M`-/
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
lemma trace_eq_contract [finite_dimensional R M] :
antoinelab01 marked this conversation as resolved.
Show resolved Hide resolved
(linear_map.trace R M) ∘ₗ ↑(dual_tensor_hom_equiv R M M) = contract_left R M :=
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
begin
have b := fin_basis R M,
apply basis.ext (basis.tensor_product (b.dual_basis) b),
rintros ⟨i, j⟩,
simp [dual_tensor_hom_equiv_to_lin],
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
rw [trace_eq_matrix_trace R b, dual_tensor_hom_basis],
by_cases hij : i = j,
{ rw [hij, matrix.std_basis_matrix.trace_same], simp },
rw matrix.std_basis_matrix.trace_zero j i (1:R) hij,
simp [finsupp.single_eq_pi_single, hij],
end

/-- The trace of a linear map correspond to the contraction pairing under the isomorphism
`M →ₗ M ≃ M* ⊗ M`-/
lemma trace_eq_contract' [finite_dimensional R M] :
(linear_map.trace R M) = (contract_left R M) ∘ₗ ↑(dual_tensor_hom_equiv R M M).symm :=
by { rw [←trace_eq_contract], ext f, simp }

/-- The trace of the identity endomorphism is the dimension of the vector space -/
@[simp] theorem trace_one : trace R M 1 = (finrank R M : R) :=
begin
Expand Down