/- Copyright (c) 2024 Joseph Tooby-Smith. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Tooby-Smith -/ import HepLean.SpaceTime.LorentzTensor.IndexNotation.IndexListColor import HepLean.SpaceTime.LorentzTensor.Basic /-! # The structure of a tensor with a string of indices -/ namespace TensorStructure open TensorColor open IndexNotation variable {R : Type} [CommSemiring R] (๐“ฃ : TensorStructure R) variable {d : โ„•} {X Y Y' Z W : Type} [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] [Fintype Y'] [DecidableEq Y'] [Fintype Z] [DecidableEq Z] [Fintype W] [DecidableEq W] {cX cX2 : X โ†’ ๐“ฃ.Color} {cY : Y โ†’ ๐“ฃ.Color} {cZ : Z โ†’ ๐“ฃ.Color} {cW : W โ†’ ๐“ฃ.Color} {cY' : Y' โ†’ ๐“ฃ.Color} {ฮผ ฮฝ ฮท : ๐“ฃ.Color} variable [IndexNotation ๐“ฃ.Color] [Fintype ๐“ฃ.Color] [DecidableEq ๐“ฃ.Color] /-- The structure an tensor with a index specification e.g. `แต˜ยนแตคโ‚‚`. -/ structure TensorIndex (cn : Fin n โ†’ ๐“ฃ.Color) where /-- The underlying tensor. -/ tensor : ๐“ฃ.Tensor cn /-- The list of indices. -/ index : IndexListColor ๐“ฃ.toTensorColor /-- The number of indices matches the number of vector spaces in the tensor. -/ nat_eq : n = index.1.length /-- The equivalence classes of colors of the tensor and the index list agree. -/ quot_eq : ๐“ฃ.colorQuot โˆ˜ index.1.colorMap โˆ˜ Fin.cast nat_eq = ๐“ฃ.colorQuot โˆ˜ cn namespace TensorIndex variable {๐“ฃ : TensorStructure R} [IndexNotation ๐“ฃ.Color] [Fintype ๐“ฃ.Color] [DecidableEq ๐“ฃ.Color] variable {n m : โ„•} {cn : Fin n โ†’ ๐“ฃ.Color} {cm : Fin m โ†’ ๐“ฃ.Color} (T : TensorIndex ๐“ฃ cn) end TensorIndex end TensorStructure