Skip to content

Commit 89a18ed

Browse files
committed
chore: move dualDistribEquiv (leanprover-community#41535)
This is in prevision of leanprover-community#41479 redefining it in terms of `homTensorHomEquiv`. Extracted by Claude Opus from leanprover-community#41479 Assisted-by: Claude Opus 4.8
1 parent 6972320 commit 89a18ed

3 files changed

Lines changed: 78 additions & 66 deletions

File tree

Mathlib/LinearAlgebra/BilinearForm/TensorProduct.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Eric Wieser
66
module
77

88
public import Mathlib.LinearAlgebra.BilinearForm.Hom
9+
public import Mathlib.LinearAlgebra.Contraction
910
public import Mathlib.LinearAlgebra.Dual.Lemmas
1011
public import Mathlib.LinearAlgebra.TensorProduct.Tower
1112
public import Mathlib.RingTheory.TensorProduct.Finite

Mathlib/LinearAlgebra/Contraction.lean

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,80 @@ theorem homTensorHomEquiv_apply (x : (M →ₗ[R] P) ⊗[R] (N →ₗ[R] Q)) :
274274
end CommSemiring
275275

276276
end HomTensorHom
277+
278+
namespace TensorProduct
279+
280+
open LinearMap Module
281+
282+
variable {R M N : Type*} {ι κ : Type*}
283+
variable [DecidableEq ι] [DecidableEq κ]
284+
variable [Fintype ι] [Fintype κ]
285+
286+
attribute [local ext] TensorProduct.ext
287+
288+
variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N]
289+
variable [Module R M] [Module R N]
290+
291+
/-- An inverse to `TensorProduct.dualDistrib` given bases.
292+
-/
293+
noncomputable def dualDistribInvOfBasis (b : Basis ι R M) (c : Basis κ R N) :
294+
Dual R (M ⊗[R] N) →ₗ[R] Dual R M ⊗[R] Dual R N :=
295+
∑ i, ∑ j,
296+
(ringLmapEquivSelf R ℕ _).symm (b.dualBasis i ⊗ₜ c.dualBasis j) ∘ₗ
297+
applyₗ (c j) ∘ₗ applyₗ (b i) ∘ₗ lcurry (.id R) M N R
298+
299+
@[simp]
300+
theorem dualDistribInvOfBasis_apply (b : Basis ι R M) (c : Basis κ R N) (f : Dual R (M ⊗[R] N)) :
301+
dualDistribInvOfBasis b c f = ∑ i, ∑ j, f (b i ⊗ₜ c j) • b.dualBasis i ⊗ₜ c.dualBasis j := by
302+
simp [dualDistribInvOfBasis]
303+
304+
theorem dualDistrib_dualDistribInvOfBasis_left_inverse (b : Basis ι R M) (c : Basis κ R N) :
305+
comp (dualDistrib R M N) (dualDistribInvOfBasis b c) = LinearMap.id := by
306+
apply (b.tensorProduct c).dualBasis.ext
307+
rintro ⟨i, j⟩
308+
apply (b.tensorProduct c).ext
309+
rintro ⟨i', j'⟩
310+
simp only [dualDistrib, Basis.coe_dualBasis, coe_comp, Function.comp_apply,
311+
dualDistribInvOfBasis_apply, Basis.coord_apply, Basis.tensorProduct_repr_tmul_apply,
312+
Basis.repr_self, _root_.map_sum, map_smul, homTensorHomMap_apply, compRight_apply,
313+
Basis.tensorProduct_apply, LinearMap.coe_sum, Finset.sum_apply, smul_apply, LinearEquiv.coe_coe,
314+
map_tmul, lid_tmul, smul_eq_mul, id_coe, id_eq]
315+
rw [Finset.sum_eq_single i, Finset.sum_eq_single j]
316+
· simpa using mul_comm _ _
317+
all_goals { intros; simp [*] at * }
318+
319+
theorem dualDistrib_dualDistribInvOfBasis_right_inverse (b : Basis ι R M) (c : Basis κ R N) :
320+
comp (dualDistribInvOfBasis b c) (dualDistrib R M N) = LinearMap.id := by
321+
apply (b.dualBasis.tensorProduct c.dualBasis).ext
322+
rintro ⟨i, j⟩
323+
simp only [Basis.tensorProduct_apply, Basis.coe_dualBasis, coe_comp, Function.comp_apply,
324+
dualDistribInvOfBasis_apply, dualDistrib_apply, Basis.coord_apply, Basis.repr_self,
325+
id_coe, id_eq]
326+
rw [Finset.sum_eq_single i, Finset.sum_eq_single j]
327+
· simp
328+
all_goals { intros; simp [*] at * }
329+
330+
/-- A linear equivalence between `Dual M ⊗ Dual N` and `Dual (M ⊗ N)` given bases for `M` and `N`.
331+
It sends `f ⊗ g` to the composition of `TensorProduct.map f g` with the natural
332+
isomorphism `R ⊗ R ≃ R`.
333+
-/
334+
@[simps!]
335+
noncomputable def dualDistribEquivOfBasis (b : Basis ι R M) (c : Basis κ R N) :
336+
Dual R M ⊗[R] Dual R N ≃ₗ[R] Dual R (M ⊗[R] N) := by
337+
refine LinearEquiv.ofLinear (dualDistrib R M N) (dualDistribInvOfBasis b c) ?_ ?_
338+
· exact dualDistrib_dualDistribInvOfBasis_left_inverse _ _
339+
· exact dualDistrib_dualDistribInvOfBasis_right_inverse _ _
340+
341+
variable (R M N)
342+
variable [Module.Finite R M] [Module.Finite R N] [Module.Free R M] [Module.Free R N]
343+
344+
/--
345+
A linear equivalence between `Dual M ⊗ Dual N` and `Dual (M ⊗ N)` when `M` and `N` are finite free
346+
modules. It sends `f ⊗ g` to the composition of `TensorProduct.map f g` with the natural
347+
isomorphism `R ⊗ R ≃ R`.
348+
-/
349+
@[simp]
350+
noncomputable def dualDistribEquiv : Dual R M ⊗[R] Dual R N ≃ₗ[R] Dual R (M ⊗[R] N) :=
351+
dualDistribEquivOfBasis (Module.Free.chooseBasis R M) (Module.Free.chooseBasis R N)
352+
353+
end TensorProduct

Mathlib/LinearAlgebra/Dual/Lemmas.lean

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,70 +1126,4 @@ theorem dualDistrib_apply (f : Dual A M) (g : Dual R N) (m : M) (n : N) :
11261126

11271127
end AlgebraTensorModule
11281128

1129-
variable {R M N}
1130-
variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N]
1131-
variable [Module R M] [Module R N]
1132-
1133-
/-- An inverse to `TensorProduct.dualDistrib` given bases.
1134-
-/
1135-
noncomputable def dualDistribInvOfBasis (b : Basis ι R M) (c : Basis κ R N) :
1136-
Dual R (M ⊗[R] N) →ₗ[R] Dual R M ⊗[R] Dual R N :=
1137-
∑ i, ∑ j,
1138-
(ringLmapEquivSelf R ℕ _).symm (b.dualBasis i ⊗ₜ c.dualBasis j) ∘ₗ
1139-
applyₗ (c j) ∘ₗ applyₗ (b i) ∘ₗ lcurry (.id R) M N R
1140-
1141-
@[simp]
1142-
theorem dualDistribInvOfBasis_apply (b : Basis ι R M) (c : Basis κ R N) (f : Dual R (M ⊗[R] N)) :
1143-
dualDistribInvOfBasis b c f = ∑ i, ∑ j, f (b i ⊗ₜ c j) • b.dualBasis i ⊗ₜ c.dualBasis j := by
1144-
simp [dualDistribInvOfBasis]
1145-
1146-
theorem dualDistrib_dualDistribInvOfBasis_left_inverse (b : Basis ι R M) (c : Basis κ R N) :
1147-
comp (dualDistrib R M N) (dualDistribInvOfBasis b c) = LinearMap.id := by
1148-
apply (b.tensorProduct c).dualBasis.ext
1149-
rintro ⟨i, j⟩
1150-
apply (b.tensorProduct c).ext
1151-
rintro ⟨i', j'⟩
1152-
simp only [dualDistrib, Basis.coe_dualBasis, coe_comp, Function.comp_apply,
1153-
dualDistribInvOfBasis_apply, Basis.coord_apply, Basis.tensorProduct_repr_tmul_apply,
1154-
Basis.repr_self, _root_.map_sum, map_smul, homTensorHomMap_apply, compRight_apply,
1155-
Basis.tensorProduct_apply, LinearMap.coe_sum, Finset.sum_apply, smul_apply, LinearEquiv.coe_coe,
1156-
map_tmul, lid_tmul, smul_eq_mul, id_coe, id_eq]
1157-
rw [Finset.sum_eq_single i, Finset.sum_eq_single j]
1158-
· simpa using mul_comm _ _
1159-
all_goals { intros; simp [*] at * }
1160-
1161-
theorem dualDistrib_dualDistribInvOfBasis_right_inverse (b : Basis ι R M) (c : Basis κ R N) :
1162-
comp (dualDistribInvOfBasis b c) (dualDistrib R M N) = LinearMap.id := by
1163-
apply (b.dualBasis.tensorProduct c.dualBasis).ext
1164-
rintro ⟨i, j⟩
1165-
simp only [Basis.tensorProduct_apply, Basis.coe_dualBasis, coe_comp, Function.comp_apply,
1166-
dualDistribInvOfBasis_apply, dualDistrib_apply, Basis.coord_apply, Basis.repr_self,
1167-
id_coe, id_eq]
1168-
rw [Finset.sum_eq_single i, Finset.sum_eq_single j]
1169-
· simp
1170-
all_goals { intros; simp [*] at * }
1171-
1172-
/-- A linear equivalence between `Dual M ⊗ Dual N` and `Dual (M ⊗ N)` given bases for `M` and `N`.
1173-
It sends `f ⊗ g` to the composition of `TensorProduct.map f g` with the natural
1174-
isomorphism `R ⊗ R ≃ R`.
1175-
-/
1176-
@[simps!]
1177-
noncomputable def dualDistribEquivOfBasis (b : Basis ι R M) (c : Basis κ R N) :
1178-
Dual R M ⊗[R] Dual R N ≃ₗ[R] Dual R (M ⊗[R] N) := by
1179-
refine LinearEquiv.ofLinear (dualDistrib R M N) (dualDistribInvOfBasis b c) ?_ ?_
1180-
· exact dualDistrib_dualDistribInvOfBasis_left_inverse _ _
1181-
· exact dualDistrib_dualDistribInvOfBasis_right_inverse _ _
1182-
1183-
variable (R M N)
1184-
variable [Module.Finite R M] [Module.Finite R N] [Module.Free R M] [Module.Free R N]
1185-
1186-
/--
1187-
A linear equivalence between `Dual M ⊗ Dual N` and `Dual (M ⊗ N)` when `M` and `N` are finite free
1188-
modules. It sends `f ⊗ g` to the composition of `TensorProduct.map f g` with the natural
1189-
isomorphism `R ⊗ R ≃ R`.
1190-
-/
1191-
@[simp]
1192-
noncomputable def dualDistribEquiv : Dual R M ⊗[R] Dual R N ≃ₗ[R] Dual R (M ⊗[R] N) :=
1193-
dualDistribEquivOfBasis (Module.Free.chooseBasis R M) (Module.Free.chooseBasis R N)
1194-
11951129
end TensorProduct

0 commit comments

Comments
 (0)