Documentation

Physlib.Relativity.Tensors.Contraction.CrossToEnd

Cross contraction at named slots #

i. Overview #

contrT contracts two slots of a single tensor. Contracting a slot of one tensor against a slot of another (T^{μν} u_ν, g_{μν} v^ν) is prodT then contrT, which leaves every call site to locate the two post-product slots and discharge the distinctness and τ-duality goals.

crossToEnd i j hc performs that contraction at named slots i and j, with hc : S.τ (cA i) = cB j recording their τ-duality. The output color is Fin.append (cA ∘ i.succAbove) (cB ∘ j.succAbove): every slot of cA except i, in order, then every slot of cB except j. These are the survivors. Any slot is reachable: crossToEnd 2 0 _ R u reads as R_{μνρσ} u^ρ. The survivors are appended rather than interleaved, and appending is associative, so both bracketings of a chain produce the same survivor list in the same order.

The complementary convention keeps the replacement index in place. Contracting slot 1 of ![c₀, c₁, c₂, c₃] against a rank-two ![S.τ c₁, d] gives ![c₀, c₂, c₃, d] here and ![c₀, d, c₂, c₃] there; that operation is crossToSlot, built on this substrate in Physlib.Relativity.Tensors.Contraction.CrossToSlot.

ii. Key results #

iii. Table of contents #

iv. References #

A. Slot-addressed cross contraction #

noncomputable def TensorSpecies.Tensor.crossToEnd {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {nA nB : ℕ} {cA : Fin (nA + 1) → C} {cB : Fin (nB + 1) → C} (i : Fin (nA + 1)) (j : Fin (nB + 1)) (hc : S.τ (cA i) = cB j) :

Slot-addressed cross contraction: contract slot i of t1 against slot j of t2. The survivors are t1's slots except i followed by t2's slots except j, so the output color is a clean Fin (nA + nB) → C and a chain composes without recasts.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem TensorSpecies.Tensor.crossToEnd_two {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {cA cB : Fin 2 → C} (h : S.τ (cA (Fin.last 1)) = cB 0) (A : S.Tensor cA) (B : S.Tensor cB) :
    ((crossToEnd (Fin.last 1) 0 h) A) B = (permT id ⋯) ((contrT 2 1 2 ⋯) ((prodT A) B))

    Cross-contracting the last slot of a rank-2 tensor A with the 0-slot of a rank-2 tensor B is a plain contrT of their product on the middle slots 1, 2, up to a color recast. Discharging the slot arithmetic once lets a contrT-level identity lift to crossToEnd by one rewrite.

    B. Component formulas and equivariance #

    crossToEnd i j hc is the curried bilinear map LinearMap.compr₂ prodT post-composed with the linear permT/contrT factors, so additivity, scalar multiplication, and finite sums in either argument are already the generic map_add/map_smul/map_sum and need no lemmas of their own.

    theorem TensorSpecies.Tensor.crossToEnd_basis {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {nA nB : ℕ} {cA : Fin (nA + 1) → C} {cB : Fin (nB + 1) → C} (i : Fin (nA + 1)) (j : Fin (nB + 1)) (hc : S.τ (cA i) = cB j) (φA : ComponentIdx cA) (φB : ComponentIdx cB) :
    ((crossToEnd i j hc) ((basis cA) φA)) ((basis cB) φB) = (S.contr (cA i)) ((b (cA i)) (φA i) ⊗ₜ[k] (b (S.τ (cA i))) ((basisIdxCongr ⋯) (φB j))) • (basis (Fin.append (cA ∘ i.succAbove) (cB ∘ j.succAbove))) (ComponentIdx.prod.symm (fun (m : Fin nA) => φA (i.succAbove m), fun (m : Fin nB) => φB (j.succAbove m)))

    Cross contraction of two basis tensors: the contraction of the two contracted basis vectors times the basis tensor of the surviving labels. These values determine crossToEnd i j hc, a bilinear map in the two tensors.

    theorem TensorSpecies.Tensor.crossToEnd_basis_repr_eq_sum_fin {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {nA nB : ℕ} {cA : Fin (nA + 1) → C} {cB : Fin (nB + 1) → C} (i : Fin (nA + 1)) (j : Fin (nB + 1)) (hc : S.τ (cA i) = cB j) (t1 : S.Tensor cA) (t2 : S.Tensor cB) (φ : ComponentIdx (Fin.append (cA ∘ i.succAbove) (cB ∘ j.succAbove))) :
    ((basis (Fin.append (cA ∘ i.succAbove) (cB ∘ j.succAbove))).repr (((crossToEnd i j hc) t1) t2)) φ = ∑ x₁ : basisIdx (cA i), ∑ x₂ : basisIdx (cB j), ((basis cA).repr t1) ((ComponentIdx.insert i) (x₁, (ComponentIdx.prod φ).1)) * ((basis cB).repr t2) ((ComponentIdx.insert j) (x₂, (ComponentIdx.prod φ).2)) * (S.contr (cA i)) ((b (cA i)) x₁ ⊗ₜ[k] (b (S.τ (cA i))) ((basisIdxCongr ⋯) x₂))

    The component formula for a cross contraction at arbitrary slots and ranks, for any species: each contracted label is summed over its own slot, with the contraction of the two basis vectors as coefficient. The counterpart of contrT_basis_repr_apply_eq_sum_fin for two tensors.

    theorem TensorSpecies.Tensor.crossToEnd_basis_repr_eq_sum_dual {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} [S.HasContrDualBases] {nA nB : ℕ} {cA : Fin (nA + 1) → C} {cB : Fin (nB + 1) → C} (i : Fin (nA + 1)) (j : Fin (nB + 1)) (hc : S.τ (cA i) = cB j) (t1 : S.Tensor cA) (t2 : S.Tensor cB) (φ : ComponentIdx (Fin.append (cA ∘ i.succAbove) (cB ∘ j.succAbove))) :
    ((basis (Fin.append (cA ∘ i.succAbove) (cB ∘ j.succAbove))).repr (((crossToEnd i j hc) t1) t2)) φ = ∑ x : basisIdx (cA i), ((basis cA).repr t1) ((ComponentIdx.insert i) (x, (ComponentIdx.prod φ).1)) * ((basis cB).repr t2) ((ComponentIdx.insert j) ((basisIdxCongr hc) ((HasContrDualBases.contrDualIdxEquiv S (cA i)).symm x), (ComponentIdx.prod φ).2))

    The component formula for a cross contraction at arbitrary slots and ranks, for a species with contraction-dual bases: the contraction coefficient is δ and one sum remains, the contracted label of t2 matched to that of t1 by contrDualIdxEquiv.

    theorem TensorSpecies.Tensor.crossToEnd_pair_basis_repr {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} [S.HasContrDualBases] {c0 c1 c2 c3 : C} (h : S.τ c1 = c2) (t1 : S.Tensor ![c0, c1]) (t2 : S.Tensor ![c2, c3]) (y0 : basisIdx c0) (y3 : basisIdx c3) :

    The component formula for cross-contracting the last slot of a rank-two tensor with the first slot of another. The surviving labels are supplied as a dependent pair, so the formula applies when the species has colour-dependent basis-index types.

    theorem TensorSpecies.Tensor.toMatrix_crossToEnd_pair {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} [S.HasContrDualBases] {c0 c1 c2 c3 : C} (h : S.τ c1 = c2) (t1 : S.Tensor ![c0, c1]) (t2 : S.Tensor ![c2, c3]) :
    (((crossToEnd (Fin.last 1) 0 h) t1) t2).toMatrix = t1.toMatrix * t2.toMatrix.submatrix (fun (x : basisIdx (![c0, c1] 1)) => (HasContrDualBases.dualIdxEquiv h) x) id

    Cross contraction of two rank-two tensors is the product of their component matrices, the middle labels matched by HasContrDualBases.dualIdxEquiv.

    @[simp]
    theorem TensorSpecies.Tensor.crossToEnd_equivariant {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {nA nB : ℕ} {cA : Fin (nA + 1) → C} {cB : Fin (nB + 1) → C} (i : Fin (nA + 1)) (j : Fin (nB + 1)) (hc : S.τ (cA i) = cB j) (g : G) (t1 : S.Tensor cA) (t2 : S.Tensor cB) :
    ((crossToEnd i j hc) (g • t1)) (g • t2) = g • ((crossToEnd i j hc) t1) t2

    Cross contraction is G-equivariant, each of prodT, contrT and permT being so.

    C. Rebracketing the metric chain #

    Both bracketings reduce to one product contracted at its two seams in opposite order, then drop to the pure-tensor level, so the seam permutation never crosses a contraction under whnf; Pure.permP_dropPair_dropPair_congr closes the step.

    theorem TensorSpecies.Tensor.crossToEnd_assoc_rankTwo {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {nA : ℕ} {cA : Fin (nA + 1) → C} {cB cC : Fin 2 → C} (iA : Fin (nA + 1)) (hc1 : S.τ (cA iA) = cB 0) (hc2 : S.τ (cB (Fin.last 1)) = cC 0) (tA : S.Tensor cA) (tB : S.Tensor cB) (tC : S.Tensor cC) :
    ((crossToEnd (Fin.last nA) 0 ⋯) (((crossToEnd iA 0 hc1) tA) tB)) tC = (permT id ⋯) (((crossToEnd iA 0 ⋯) tA) (((crossToEnd (Fin.last 1) 0 hc2) tB) tC))

    Rebracket the chain A —(iA·0)— B —(last·0)— C for rank-two B and C: contracting A·B first and then ·C equals contracting B·C first and then A·, up to the color recast permT id.

    Not full associativity: only A's attachment slot iA is free. B's rank two is what makes the statement possible, the second contraction being addressed at Fin.last nA, the slot B's unique survivor occupies in A·B. Other slots are reached by conjugating with the permT commutators.

    With A := T, B := g, C := g⁻¹ this reassociates (T·g)·g⁻¹ to T·(g·g⁻¹), after which g·g⁻¹ collapses to the unit tensor: the step behind raising then lowering a named index.

    D. Permutation commutators #

    Moving a relabelling of one factor through the slot-addressed contraction. The relabelling σ need not fix the contracted slot, so it carries the contraction from slot i to slot σ i and restricts to the survivors as a map σ' filling the square (σ i).succAbove ∘ σ' = σ ∘ i.succAbove. Taking σ' as an argument rather than deriving it lets a caller supply the survivor map it wants (id, a swap-induced map) instead of an opaque composite.

    theorem TensorSpecies.Tensor.crossToEnd_permT_left {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {nA nB : ℕ} {cA cA' : Fin (nA + 1) → C} {cB : Fin (nB + 1) → C} (i : Fin (nA + 1)) (j : Fin (nB + 1)) (σ : Fin (nA + 1) → Fin (nA + 1)) (σ' : Fin nA → Fin nA) (hσ : IsReindexing cA cA' σ) (hσ' : (σ i).succAbove ∘ σ' = σ ∘ i.succAbove) (hc : S.τ (cA' i) = cB j) (t1 : S.Tensor cA) (t2 : S.Tensor cB) :
    ((crossToEnd i j hc) ((permT σ hσ) t1)) t2 = (permT (Fin.append (Fin.castAdd nB ∘ σ') (Fin.natAdd nA)) ⋯) (((crossToEnd (σ i) j ⋯) t1) t2)

    Left commutator: contracting slot i of permT σ t1 equals contracting slot σ i of t1, then relabelling the survivors by σ'. The square hσ' records how σ' carries the complement of i to the complement of σ i, and implies its bijectivity.

    theorem TensorSpecies.Tensor.crossToEnd_permT_right {k : Type} [CommRing k] {C G : Type} [Group G] {V : C → Type} [(c : C) → AddCommGroup (V c)] [(c : C) → Module k (V c)] {basisIdx : C → Type} [(c : C) → Fintype (basisIdx c)] [(c : C) → DecidableEq (basisIdx c)] {rep : (c : C) → Representation k G (V c)} {b : (c : C) → Module.Basis (basisIdx c) k (V c)} {S : TensorSpecies k C G V basisIdx rep b} {nA nB : ℕ} {cA : Fin (nA + 1) → C} {cB cB' : Fin (nB + 1) → C} (i : Fin (nA + 1)) (j : Fin (nB + 1)) (σ : Fin (nB + 1) → Fin (nB + 1)) (σ' : Fin nB → Fin nB) (hσ : IsReindexing cB cB' σ) (hσ' : (σ j).succAbove ∘ σ' = σ ∘ j.succAbove) (hc : S.τ (cA i) = cB' j) (t1 : S.Tensor cA) (t2 : S.Tensor cB) :
    ((crossToEnd i j hc) t1) ((permT σ hσ) t2) = (permT (Fin.append (Fin.castAdd nB) (Fin.natAdd nA ∘ σ')) ⋯) (((crossToEnd i (σ j) ⋯) t1) t2)

    Right commutator, the mirror of crossToEnd_permT_left: contracting slot j of permT σ t2 equals contracting slot σ j of t2, then relabelling the survivors by σ'.