-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Merged by Bors] - feat(LinearAlgebra/PiTensorProduct): arbitrary tensor product of algebras #9395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
e0a32a0
initial
jjaassoonn 631bfe3
Tensor product of algebra
jjaassoonn 0c4e99e
Merge branch 'master' of https://github.com/leanprover-community/math…
jjaassoonn da25cda
better proof
jjaassoonn 345f1e6
unnecessary import
jjaassoonn 65ec881
missing doc string
jjaassoonn de5d6d2
move file around
jjaassoonn d2261f4
all import
jjaassoonn 82d33c5
make `reindex` dependent
jjaassoonn ad8b7f8
restructure
jjaassoonn 3f79bbd
fix
jjaassoonn 8a91d9b
long line
jjaassoonn d56485b
fix
jjaassoonn d0ab3a8
Update Mathlib/RingTheory/PiTensorProduct.lean
jjaassoonn a7e5617
add commsemiring section
jjaassoonn a45e347
nonAssocNonUnitalRing etc
jjaassoonn 77a20f3
Update PiTensorProduct.lean
jjaassoonn a2364b9
Update TensorPower.lean
jjaassoonn 4a3892a
Update ToTensorPower.lean
jjaassoonn e11b7bf
add map
jjaassoonn aae4fd9
更新 PiTensorProduct.lean
jjaassoonn a0c5203
use LinearMap.mul
jjaassoonn cd003ab
Merge branch 'zjj/tensorProductAlgebra' of https://github.com/leanpro…
jjaassoonn 01f77d2
golf
jjaassoonn 04daa42
Update Mathlib/LinearAlgebra/PiTensorProduct.lean
jjaassoonn e9847be
golf and rename
jjaassoonn 8db5535
Merge branch 'zjj/tensorProductAlgebra' of https://github.com/leanpro…
jjaassoonn fdf208d
fix
jjaassoonn 82c54bc
add map
jjaassoonn d693761
add map2
jjaassoonn 8c94b12
add a lemma
jjaassoonn 61d2c03
add docs
jjaassoonn f4e668a
更新 PiTensorProduct.lean
jjaassoonn 06b91ff
Update Mathlib/LinearAlgebra/PiTensorProduct.lean
jjaassoonn e8a2007
Update Mathlib/LinearAlgebra/PiTensorProduct.lean
jjaassoonn 1cdc122
apply suggestions by @eric-wieser
jjaassoonn deaf515
add a new multilineaar map
jjaassoonn 9edb831
Update Mathlib/LinearAlgebra/Multilinear/Basic.lean
jjaassoonn f9a3f2c
Update Basic.lean
jjaassoonn b4bfd52
use eric's solution
jjaassoonn 6853df3
Merge branch 'zjj/tensorProductAlgebra' of https://github.com/leanpro…
jjaassoonn d5e04c0
Update Mathlib/LinearAlgebra/Multilinear/Basic.lean
jjaassoonn 5ee71ec
better docs
jjaassoonn 6cc50a8
Merge branch 'zjj/tensorProductAlgebra' of https://github.com/leanpro…
jjaassoonn a852f1f
更新 Basic.lean
jjaassoonn 9cad666
更新 Basic.lean
jjaassoonn 499b5a2
Merge branch 'master' into zjj/tensorProductAlgebra
riccardobrasca 4f36f98
Merge remote-tracking branch 'origin/master' into zjj/tensorProductAl…
jjaassoonn ba1f2fa
Update Mathlib/LinearAlgebra/Multilinear/Basic.lean
jjaassoonn 2a0b0c0
docs fix in `PiTensorProduct`
jjaassoonn d9b4dd8
Merge branch 'zjj/tensorProductAlgebra' of https://github.com/leanpro…
jjaassoonn 278fcca
induction' -> induction
jjaassoonn d4d9c86
long line
jjaassoonn bcf2d0c
add apply
jjaassoonn c2680cd
revert apply_
jjaassoonn 8487d12
golf
eric-wieser 9aa02c4
fix instance names
eric-wieser fea8428
golf some proofs, rename lmul to mul to match RingTheory/TensorProduct
eric-wieser 1d7b385
helper lemmas
eric-wieser 1df8f62
towers of algebras
eric-wieser e060c87
Apply suggestions from code review
jjaassoonn ca1e2dc
Merge remote-tracking branch 'origin/master' into zjj/tensorProductAl…
jjaassoonn ddf6a5a
fix
jjaassoonn b2c5005
fix long line
jjaassoonn d1f91b2
shake fix
jjaassoonn 0f9e789
Update PiTensorProduct.lean
jjaassoonn 39f9f27
Merge remote-tracking branch 'origin/master' into zjj/tensorProductAl…
jjaassoonn d126d3c
Update Mathlib/RingTheory/PiTensorProduct.lean
jjaassoonn de2cf48
apply suggestions from code review
jjaassoonn 57a624a
Update Mathlib/LinearAlgebra/PiTensorProduct.lean
jjaassoonn f990f2b
Merge remote-tracking branch 'origin/master' into zjj/tensorProductAl…
jjaassoonn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,231 @@ | ||
| /- | ||
| Copyright (c) 2024 Jujian Zhang. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Jujian Zhang | ||
| -/ | ||
|
|
||
| import Mathlib.LinearAlgebra.PiTensorProduct | ||
| import Mathlib.Algebra.Algebra.Bilinear | ||
|
|
||
| /-! | ||
| # Tensor product of `R`-algebras and rings | ||
|
|
||
| If `(Aᵢ)` is a family of `R`-algebras then the `R`-tensor product `⨂ᵢ Aᵢ` is an `R`-algebra as well | ||
| with structure map defined by `r ↦ r • 1`. | ||
|
|
||
| In particular if we take `R` to be `ℤ`, then this collapses into the tensor product of rings. | ||
| -/ | ||
|
|
||
| open TensorProduct Function | ||
|
|
||
| variable {ι R' R : Type*} {A : ι → Type*} | ||
|
|
||
| namespace PiTensorProduct | ||
|
|
||
| noncomputable section AddCommMonoidWithOne | ||
|
|
||
| variable [CommSemiring R] [∀ i, AddCommMonoidWithOne (A i)] [∀ i, Module R (A i)] | ||
|
|
||
| instance instOne : One (⨂[R] i, A i) where | ||
| one := tprod R 1 | ||
|
|
||
| lemma one_def : 1 = tprod R (1 : Π i, A i) := rfl | ||
|
|
||
| instance instAddCommMonoidWithOne : AddCommMonoidWithOne (⨂[R] i, A i) where | ||
| __ := inferInstanceAs (AddCommMonoid (⨂[R] i, A i)) | ||
jjaassoonn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| __ := instOne | ||
|
|
||
| end AddCommMonoidWithOne | ||
|
|
||
| noncomputable section NonUnitalNonAssocSemiring | ||
|
|
||
| variable [CommSemiring R] [∀ i, NonUnitalNonAssocSemiring (A i)] | ||
| variable [∀ i, Module R (A i)] [∀ i, SMulCommClass R (A i) (A i)] [∀ i, IsScalarTower R (A i) (A i)] | ||
|
|
||
| attribute [aesop safe] mul_add mul_smul_comm smul_mul_assoc add_mul in | ||
| /-- | ||
| The multiplication in tensor product of rings is induced by `(xᵢ) * (yᵢ) = (xᵢ * yᵢ)` | ||
| -/ | ||
| def mul : (⨂[R] i, A i) →ₗ[R] (⨂[R] i, A i) →ₗ[R] (⨂[R] i, A i) := | ||
| PiTensorProduct.piTensorHomMap₂ <| tprod R fun _ ↦ LinearMap.mul _ _ | ||
|
|
||
| @[simp] lemma mul_tprod_tprod (x y : (i : ι) → A i) : | ||
| mul (tprod R x) (tprod R y) = tprod R (x * y) := by | ||
| simp only [mul, piTensorHomMap₂_tprod_tprod_tprod, LinearMap.mul_apply'] | ||
| rfl | ||
|
|
||
| instance instMul : Mul (⨂[R] i, A i) where | ||
| mul x y := mul x y | ||
|
|
||
| lemma mul_def (x y : ⨂[R] i, A i) : x * y = mul x y := rfl | ||
|
|
||
| @[simp] lemma tprod_mul_tprod (x y : (i : ι) → A i) : | ||
| tprod R x * tprod R y = tprod R (x * y) := | ||
| mul_tprod_tprod x y | ||
|
|
||
| lemma smul_tprod_mul_smul_tprod (r s : R) (x y : Π i, A i) : | ||
| (r • tprod R x) * (s • tprod R y) = (r * s) • tprod R (x * y) := by | ||
| change mul _ _ = _ | ||
| rw [map_smul, map_smul, mul_comm r s, mul_smul] | ||
| simp only [LinearMap.smul_apply, mul_tprod_tprod] | ||
|
|
||
| instance instNonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring (⨂[R] i, A i) where | ||
| __ := instMul | ||
| __ := inferInstanceAs (AddCommMonoid (⨂[R] i, A i)) | ||
| left_distrib _ _ _ := (mul _).map_add _ _ | ||
| right_distrib _ _ _ := mul.map_add₂ _ _ _ | ||
| zero_mul _ := mul.map_zero₂ _ | ||
| mul_zero _ := map_zero (mul _) | ||
|
|
||
| end NonUnitalNonAssocSemiring | ||
|
|
||
| noncomputable section NonAssocSemiring | ||
|
|
||
| variable [CommSemiring R] [∀ i, NonAssocSemiring (A i)] | ||
| variable [∀ i, Module R (A i)] [∀ i, SMulCommClass R (A i) (A i)] [∀ i, IsScalarTower R (A i) (A i)] | ||
|
|
||
| protected lemma one_mul (x : ⨂[R] i, A i) : mul (tprod R 1) x = x := by | ||
| induction x using PiTensorProduct.induction_on with | ||
| | smul_tprod => simp | ||
| | add _ _ h1 h2 => simp [map_add, h1, h2] | ||
|
|
||
| protected lemma mul_one (x : ⨂[R] i, A i) : mul x (tprod R 1) = x := by | ||
| induction x using PiTensorProduct.induction_on with | ||
| | smul_tprod => simp | ||
| | add _ _ h1 h2 => simp [h1, h2] | ||
|
|
||
| instance instNonAssocSemiring : NonAssocSemiring (⨂[R] i, A i) where | ||
| __ := instNonUnitalNonAssocSemiring | ||
| one_mul := PiTensorProduct.one_mul | ||
| mul_one := PiTensorProduct.mul_one | ||
|
|
||
| end NonAssocSemiring | ||
|
|
||
| noncomputable section NonUnitalSemiring | ||
|
|
||
| variable [CommSemiring R] [∀ i, NonUnitalSemiring (A i)] | ||
| variable [∀ i, Module R (A i)] [∀ i, SMulCommClass R (A i) (A i)] [∀ i, IsScalarTower R (A i) (A i)] | ||
|
|
||
| protected lemma mul_assoc (x y z : ⨂[R] i, A i) : mul (mul x y) z = mul x (mul y z) := by | ||
| -- restate as an equality of morphisms so that we can use `ext` | ||
| suffices LinearMap.llcomp R _ _ _ mul ∘ₗ mul = | ||
| (LinearMap.llcomp R _ _ _ LinearMap.lflip <| LinearMap.llcomp R _ _ _ mul.flip ∘ₗ mul).flip by | ||
| exact DFunLike.congr_fun (DFunLike.congr_fun (DFunLike.congr_fun this x) y) z | ||
| ext x y z | ||
| dsimp [← mul_def] | ||
| simpa only [tprod_mul_tprod] using congr_arg (tprod R) (mul_assoc x y z) | ||
|
|
||
| instance instNonUnitalSemiring : NonUnitalSemiring (⨂[R] i, A i) where | ||
| __ := instNonUnitalNonAssocSemiring | ||
| mul_assoc := PiTensorProduct.mul_assoc | ||
|
|
||
| end NonUnitalSemiring | ||
|
|
||
| noncomputable section Semiring | ||
|
|
||
| variable [CommSemiring R'] [CommSemiring R] [∀ i, Semiring (A i)] | ||
| variable [Algebra R' R] [∀ i, Algebra R (A i)] [∀ i, Algebra R' (A i)] | ||
| variable [∀ i, IsScalarTower R' R (A i)] | ||
|
|
||
| instance instSemiring : Semiring (⨂[R] i, A i) where | ||
| __ := instNonUnitalSemiring | ||
| __ := instNonAssocSemiring | ||
|
|
||
| instance instAlgebra : Algebra R' (⨂[R] i, A i) where | ||
| __ := hasSMul' | ||
| toFun := (· • 1) | ||
jjaassoonn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| map_one' := by simp | ||
| map_mul' r s := show (r * s) • 1 = mul (r • 1) (s • 1) by | ||
| rw [LinearMap.map_smul_of_tower, LinearMap.map_smul_of_tower, LinearMap.smul_apply, mul_comm, | ||
| mul_smul] | ||
| congr | ||
| show (1 : ⨂[R] i, A i) = 1 * 1 | ||
| rw [mul_one] | ||
| map_zero' := by simp | ||
| map_add' := by simp [add_smul] | ||
| commutes' r x := by | ||
| simp only [RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk] | ||
| change mul _ _ = mul _ _ | ||
| rw [LinearMap.map_smul_of_tower, LinearMap.map_smul_of_tower, LinearMap.smul_apply] | ||
| change r • (1 * x) = r • (x * 1) | ||
| rw [mul_one, one_mul] | ||
| smul_def' r x := by | ||
| simp only [RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk] | ||
| change _ = mul _ _ | ||
| rw [LinearMap.map_smul_of_tower, LinearMap.smul_apply] | ||
| change _ = r • (1 * x) | ||
| rw [one_mul] | ||
|
|
||
| lemma algebraMap_apply (r : R') (i : ι) [DecidableEq ι] : | ||
| algebraMap R' (⨂[R] i, A i) r = tprod R (Pi.mulSingle i (algebraMap R' (A i) r)) := by | ||
| change r • tprod R 1 = _ | ||
| have : Pi.mulSingle i (algebraMap R' (A i) r) = update (fun i ↦ 1) i (r • 1) := by | ||
| rw [Algebra.algebraMap_eq_smul_one]; rfl | ||
| rw [this, ← smul_one_smul R r (1 : A i), MultilinearMap.map_smul, update_eq_self, smul_one_smul] | ||
| congr | ||
|
|
||
| /-- | ||
| The map `Aᵢ ⟶ ⨂ᵢ Aᵢ` given by `a ↦ 1 ⊗ ... ⊗ a ⊗ 1 ⊗ ...` | ||
| -/ | ||
| @[simps] | ||
| def singleAlgHom [DecidableEq ι] (i : ι) : A i →ₐ[R] ⨂[R] i, A i where | ||
| toFun a := tprod R (MonoidHom.single _ i a) | ||
| map_one' := by simp only [_root_.map_one]; rfl | ||
| map_mul' a a' := by simp | ||
| map_zero' := MultilinearMap.map_update_zero _ _ _ | ||
| map_add' _ _ := MultilinearMap.map_add _ _ _ _ _ | ||
| commutes' r := show tprodCoeff R _ _ = r • tprodCoeff R _ _ by | ||
| rw [Algebra.algebraMap_eq_smul_one] | ||
| erw [smul_tprodCoeff] | ||
| rfl | ||
|
|
||
| /-- | ||
| Lifting a multilinear map to an algebra homomorphism from tensor product | ||
| -/ | ||
| @[simps!] | ||
| def liftAlgHom {S : Type*} [Semiring S] [Algebra R S] | ||
| (f : MultilinearMap R A S) | ||
| (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) : (⨂[R] i, A i) →ₐ[R] S := | ||
| AlgHom.ofLinearMap (lift f) (show lift f (tprod R 1) = 1 by simp [one]) <| | ||
| LinearMap.map_mul_iff _ |>.mpr <| by aesop | ||
|
|
||
| end Semiring | ||
|
|
||
| noncomputable section Ring | ||
|
|
||
| variable [CommRing R] [∀ i, Ring (A i)] [∀ i, Algebra R (A i)] | ||
|
|
||
| instance instRing : Ring (⨂[R] i, A i) where | ||
| __ := instSemiring | ||
| __ := inferInstanceAs <| AddCommGroup (⨂[R] i, A i) | ||
|
|
||
| end Ring | ||
|
|
||
| noncomputable section CommSemiring | ||
|
|
||
| variable [CommSemiring R] [∀ i, CommSemiring (A i)] [∀ i, Algebra R (A i)] | ||
|
|
||
| protected lemma mul_comm (x y : ⨂[R] i, A i) : mul x y = mul y x := by | ||
| suffices mul (R := R) (A := A) = mul.flip from | ||
| DFunLike.congr_fun (DFunLike.congr_fun this x) y | ||
| ext x y | ||
| dsimp | ||
| simp only [mul_tprod_tprod, mul_tprod_tprod, mul_comm x y] | ||
|
|
||
| instance instCommSemiring : CommSemiring (⨂[R] i, A i) where | ||
| __ := instSemiring | ||
| __ := inferInstanceAs <| AddCommMonoid (⨂[R] i, A i) | ||
| mul_comm := PiTensorProduct.mul_comm | ||
|
|
||
| end CommSemiring | ||
|
|
||
| noncomputable section CommRing | ||
jjaassoonn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| variable [CommRing R] [∀ i, CommRing (A i)] [∀ i, Algebra R (A i)] | ||
| instance instCommRing : CommRing (⨂[R] i, A i) where | ||
| __ := instCommSemiring | ||
| __ := inferInstanceAs <| AddCommGroup (⨂[R] i, A i) | ||
|
|
||
| end CommRing | ||
|
|
||
| end PiTensorProduct | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.