Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
Copyright (c) 2021 Eric Wieser. All rights reserved. | |
Released under Apache 2.0 license as described in the file LICENSE. | |
Authors: Eric Wieser | |
-/ | |
import linear_algebra.pi_tensor_product | |
import logic.equiv.fin | |
import algebra.direct_sum.algebra | |
/-! | |
# Tensor power of a semimodule over a commutative semirings | |
We define the `n`th tensor power of `M` as the n-ary tensor product indexed by `fin n` of `M`, | |
`β¨[R] (i : fin n), M`. This is a special case of `pi_tensor_product`. | |
This file introduces the notation `β¨[R]^n M` for `tensor_power R n M`, which in turn is an | |
abbreviation for `β¨[R] i : fin n, M`. | |
## Main definitions: | |
* `tensor_power.ghas_one` | |
* `tensor_power.ghas_mul` | |
## TODO | |
Show `direct_sum.galgebra R (Ξ» i, β¨[R]^i M)` and `algebra R (β¨ n : β, β¨[R]^n M)`. | |
## Implementation notes | |
In this file we use `β1` and `β*` as local notation for the graded multiplicative structure on | |
tensor powers. Elsewhere, using `1` and `*` on `graded_monoid` should be preferred. | |
-/ | |
open_locale tensor_product | |
/-- Homogenous tensor powers $M^{\otimes n}$. `β¨[R]^n M` is a shorthand for | |
`β¨[R] (i : fin n), M`. -/ | |
@[reducible] protected def tensor_power (R : Type*) (n : β) (M : Type*) | |
[comm_semiring R] [add_comm_monoid M] [module R M] : Type* := | |
β¨[R] i : fin n, M | |
variables {R : Type*} {M : Type*} [comm_semiring R] [add_comm_monoid M] [module R M] | |
localized "notation `β¨[`:100 R `]^`:80 n:max := tensor_power R n" | |
in tensor_product | |
namespace tensor_power | |
open_locale tensor_product direct_sum | |
open pi_tensor_product | |
/-- As a graded monoid, `β¨[R]^i M` has a `1 : β¨[R]^0 M`. -/ | |
instance ghas_one : graded_monoid.ghas_one (Ξ» i, β¨[R]^i M) := | |
{ one := tprod R fin.elim0 } | |
local notation `β1` := @graded_monoid.ghas_one.one β (Ξ» i, β¨[R]^i M) _ _ | |
lemma ghas_one_def : β1 = tprod R fin.elim0 := rfl | |
/-- A variant of `pi_tensor_prod.tmul_equiv` with the result indexed by `fin (n + m)`. -/ | |
def mul_equiv {n m : β} : (β¨[R]^n M) β[R] (β¨[R]^m M) ββ[R] β¨[R]^(n + m) M := | |
(tmul_equiv R M).trans (reindex R M fin_sum_fin_equiv) | |
/-- As a graded monoid, `β¨[R]^i M` has a `(*) : β¨[R]^i M β β¨[R]^j M β β¨[R]^(i + j) M`. -/ | |
instance ghas_mul : graded_monoid.ghas_mul (Ξ» i, β¨[R]^i M) := | |
{ mul := Ξ» i j a b, mul_equiv (a ββ b) } | |
local infix `β*`:70 := @graded_monoid.ghas_mul.mul β (Ξ» i, β¨[R]^i M) _ _ _ _ | |
lemma ghas_mul_def {i j} (a : β¨[R]^i M) (b : β¨[R]^j M) : a β* b = mul_equiv (a ββ b) := rfl | |
end tensor_power | |