Imports
/- Copyright (c) 2026 Andrea Pari. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrea Pari -/ module public import Physlib.Relativity.Tensors.Contraction.CrossToSlot public import Physlib.Relativity.Tensors.UnitTensor public import Physlib.Relativity.Tensors.Evaluation

Contraction against the unit tensor

i. Overview

The unit tensor is the identity for slot contraction: contracting any slot of t against unitTensor for that slot's color returns t, the slot relabelled to the survivor tail. That is what collapses "raise then lower" to the identity, a metric contracted against its dual becoming the unit tensor and then contracting away.

crossToEnd_unitTensor is proved by decomposing t along its last slot (eq_sum_evalT) and transporting to an arbitrary slot with the transposition swap i (last). On it the round trip against a matched pair is assembled in both conventions, and a pair collapsing in both orders makes the two contractions mutually inverse, which crossToSlotEquiv bundles as a linear equivalence between the two color assignments.

Since unitTensor is RCLike-valued, this material sits over an [RCLike k] variable block, apart from the CommRing crossToEnd/crossToSlot algebra.

ii. Key results

    TensorSpecies.Tensor.crossToEnd_unitTensor : the unit tensor is an identity for crossToEnd at any named slot.

    TensorSpecies.Tensor.crossToEnd_round_trip_of_unit_slot : two contractions against a pair that collapses to the unit tensor return the original tensor, in result-to-end form.

    TensorSpecies.Tensor.crossToSlot_raise_lower_round_trip : the round trip in result-to-slot form, every color propositional.

    TensorSpecies.Tensor.crossToSlotEquiv : raising and lowering a named index against a pair that collapses in both orders, as a linear equivalence.

iii. Table of contents

    A. The unit tensor as a slot-contraction identity

    B. Round trips against a matched pair

    C. Raising and lowering as an equivalence

iv. References

@[expose] public sectionattribute [-simp] LinearEquiv.cast_apply

A. The unit tensor as a slot-contraction identity

Contracting a named slot against unitTensor returns the tensor unchanged, the slot carried to the survivor tail by move_last.

Cross-contracting the last slot of the product E ⊗ B (with B rank one) against the unit tensor for that slot's color returns E ⊗ B unchanged, the contracted slot carried to the end. The rank-one spectator case that seeds crossToEnd_unitTensor_slot.

k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))(permT (nV, .funPredPredAbove nV + 1, (Fin.cast Fin.cast ) id id) ) ((permT (Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) id) ) ((prodT E) B)) = (permT id ) ((prodT E) B) erw [k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))(permT ((Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) id) nV, .funPredPredAbove nV + 1, (Fin.cast Fin.cast ) id id) ) ((prodT E) B) = (permT id ) ((prodT E) B)k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))(permT ((Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) id) nV, .funPredPredAbove nV + 1, (Fin.cast Fin.cast ) id id) ) ((prodT E) B) = (permT id ) ((prodT E) B) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))(Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) id) nV, .funPredPredAbove nV + 1, (Fin.cast Fin.cast ) id id = idk:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))(prodT E) B = (prodT E) B k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))(Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) id) nV, .funPredPredAbove nV + 1, (Fin.cast Fin.cast ) id id = id k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)((Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) id) nV, .funPredPredAbove nV + 1, (Fin.cast Fin.cast ) id id) i = id i k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) ((Fin.cast (Fin.cast nV, )).predPredAbove (Fin.cast (Fin.cast nV + 1, )) (Fin.cast (Fin.cast (nV, .succSuccAbove nV + 1, i))) ) = i k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)(Fin.append (Fin.castAdd (Nat.succ 0)) (Fin.natAdd nV id) ((Fin.cast (Fin.cast nV, )).predPredAbove (Fin.cast (Fin.cast nV + 1, )) (Fin.cast (Fin.cast (nV, .succSuccAbove nV + 1, i))) )) = i k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)(Fin.append (Fin.castAdd 1) (Fin.natAdd nV) i) = i k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)j:Fin nV(Fin.append (Fin.castAdd 1) (Fin.natAdd nV) (Fin.castAdd 1 j)) = (Fin.castAdd 1 j)k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)j:Fin 1(Fin.append (Fin.castAdd 1) (Fin.natAdd nV) (Fin.natAdd nV j)) = (Fin.natAdd nV j) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)j:Fin nV(Fin.append (Fin.castAdd 1) (Fin.natAdd nV) (Fin.castAdd 1 j)) = (Fin.castAdd 1 j)k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))i:Fin (nV + 1)j:Fin 1(Fin.append (Fin.castAdd 1) (Fin.natAdd nV) (Fin.natAdd nV j)) = (Fin.natAdd nV j) All goals completed! 🐙 k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnV:cE:Fin nV CcB:CE:S.Tensor cEB:S.Tensor ![cB]hij:0 1 S.τ (Fin.append ![cB] ![S.τ cB, cB] 0) = Fin.append ![cB] ![S.τ cB, cB] 1key:(contrT (nV + 1) nV, nV + 1, ) ((prodT E) ((prodT B) (unitTensor cB))) = (permT id ) ((prodT E) ((permT id ) B))(prodT E) B = (prodT E) B All goals completed! 🐙

The boundary case of crossToEnd_unitTensor, proved by spectator decomposition along the last slot (eq_sum_evalT). The last slot is threaded as a variable i with hilast : i = last nA so that crossToEnd_unitTensor can apply it at the image of i under its transposition without a dependent rewrite of the slot index.

k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univ(permT (Fin.append (Fin.castAdd 1 fun x => x) (Fin.natAdd nA)) ) ((permT id ) ((prodT ((evalT (Fin.last nA) i) t1)) ((basis ![cA (Fin.last nA)]) (ComponentIdx.single.symm i)))) = (permT (Fin.append (Fin.last nA).succAbove fun x => Fin.last nA) ) ((permT id ) ((prodT ((evalT (Fin.last nA) i) t1)) ((basis ![cA (Fin.last nA)]) (ComponentIdx.single.symm i)))) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univ(permT (id Fin.append (Fin.castAdd 1 fun x => x) (Fin.natAdd nA)) ) ((prodT ((evalT (Fin.last nA) i) t1)) ((basis ![cA (Fin.last nA)]) (ComponentIdx.single.symm i))) = (permT (id Fin.append (Fin.last nA).succAbove fun x => Fin.last nA) ) ((prodT ((evalT (Fin.last nA) i) t1)) ((basis ![cA (Fin.last nA)]) (ComponentIdx.single.symm i))) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)(id Fin.append (Fin.castAdd 1 fun x => x) (Fin.natAdd nA)) x = (id Fin.append (Fin.last nA).succAbove fun x => Fin.last nA) x k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)j:Fin nA(id Fin.append (Fin.castAdd 1 fun x => x) (Fin.natAdd nA)) (Fin.castAdd 1 j) = (id Fin.append (Fin.last nA).succAbove fun x => Fin.last nA) (Fin.castAdd 1 j)k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)j:Fin 1(id Fin.append (Fin.castAdd 1 fun x => x) (Fin.natAdd nA)) (Fin.natAdd nA j) = (id Fin.append (Fin.last nA).succAbove fun x => Fin.last nA) (Fin.natAdd nA j) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)j:Fin nA(id Fin.append (Fin.castAdd 1 fun x => x) (Fin.natAdd nA)) (Fin.castAdd 1 j) = (id Fin.append (Fin.last nA).succAbove fun x => Fin.last nA) (Fin.castAdd 1 j) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)j:Fin nAFin.castAdd 1 j = j.castSucc All goals completed! 🐙 k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)j:Fin 1(id Fin.append (Fin.castAdd 1 fun x => x) (Fin.natAdd nA)) (Fin.natAdd nA j) = (id Fin.append (Fin.last nA).succAbove fun x => Fin.last nA) (Fin.natAdd nA j) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)j:Fin 1id (Fin.natAdd nA j) = id (Fin.last nA) exact Fin.ext (k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Ct1:S.Tensor cAi:basisIdx (cA (Fin.last nA))x✝:i Finset.univx:Fin (nA + 1)j:Fin 1(id (Fin.natAdd nA j)) = (id (Fin.last nA)) All goals completed! 🐙)

Contracting slot i of t1 against the unit tensor for that slot's color returns t1, the contracted slot relabelled by move_last i. The unit tensor acts as an identity for crossToEnd at any named slot.

All goals completed! 🐙 k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:cA:Fin (nA + 1) Cc:Ci:Fin (nA + 1)hc:cA i = ct1:S.Tensor cAτ:Fin (nA + 1) Fin (nA + 1) := (Equiv.swap i (Fin.last nA))hτdef:τ = (Equiv.swap i (Fin.last nA))hτbij:Function.Bijective τhτi:τ i = Fin.last nAhself: (x : Fin (nA + 1)), τ (τ x) = xτ':Fin nA Fin nAhτ':(τ i).succAbove τ' = τ i.succAbovehre2:IsReindexing cA (cA τ) τhre:IsReindexing (cA τ) cA τht1:(permT τ hre) ((permT τ hre2) t1) = t1x:Fin (nA + 1)a:Fin 1(τ (Fin.append (τ i).succAbove fun x => τ i) Fin.append (Fin.castAdd 1 τ') (Fin.natAdd nA)) (Fin.natAdd nA a) = Fin.append i.succAbove (fun x => i) (Fin.natAdd nA a) All goals completed! 🐙

B. Round trips against a matched pair

When two rank-2 tensors collapse to the unit tensor after their shared index is contracted, contracting a slot first against one and then against the other returns the original tensor.

The color list crossToEnd produces from a matched rank-2 pair M : ![a, d], M' : ![b, e] is the color list ![S.τ e, e] of unitTensor e, via the identity slot map: the reindexing carried by the collapse hypothesis M · M' = δ of the round trips below. Only the surviving colors a and e enter, and a equals S.τ e only propositionally, so a pair whose colors match propositionally enters with no transport.

lemma IsReindexing.unitTensor_pair {a b d e : C} (h : S.τ e = a) : IsReindexing (![S.τ e, e] : Fin 2 C) (Fin.append ((![a, d] : Fin 2 C) (Fin.last 1).succAbove) ((![b, e] : Fin 2 C) (0 : Fin 2).succAbove)) (id : Fin 2 Fin 2) := IsReindexing.on_id.mpr (fun j => k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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✝a:Cb:Cd:Ce:Ch:S.τ e = aj:Fin (Nat.succ 1)![S.τ e, e] j = Fin.append (![a, d] (Fin.last 1).succAbove) (![b, e] Fin.succAbove 0) j k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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✝a:Cb:Cd:Ce:Ch:S.τ e = a![S.τ e, e] ((fun i => i) 0, ) = Fin.append (![a, d] (Fin.last 1).succAbove) (![b, e] Fin.succAbove 0) ((fun i => i) 0, )k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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✝a:Cb:Cd:Ce:Ch:S.τ e = a![S.τ e, e] ((fun i => i) 1, ) = Fin.append (![a, d] (Fin.last 1).succAbove) (![b, e] Fin.succAbove 0) ((fun i => i) 1, ) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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✝a:Cb:Cd:Ce:Ch:S.τ e = a![S.τ e, e] ((fun i => i) 0, ) = Fin.append (![a, d] (Fin.last 1).succAbove) (![b, e] Fin.succAbove 0) ((fun i => i) 0, )k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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✝a:Cb:Cd:Ce:Ch:S.τ e = a![S.τ e, e] ((fun i => i) 1, ) = Fin.append (![a, d] (Fin.last 1).succAbove) (![b, e] Fin.succAbove 0) ((fun i => i) 1, ) first | k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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✝a:Cb:Cd:Ce:Ch:S.τ e = a![S.τ e, e] ((fun i => i) 1, ) = Fin.append (![a, d] (Fin.last 1).succAbove) (![b, e] Fin.succAbove 0) ((fun i => i) 1, ) | All goals completed! 🐙)

Round trip of two contractions against a matched pair, in result-to-end form. Contracting slot i of t against M₁, then contracting the surviving M₁-index (deposited at slot j) against M₂, returns t up to the cycle that moves the round-tripped slot from the end back to i, whenever M₁ and M₂ collapse to the unit tensor. The last slot is threaded as a variable j with hj : j = last nA so that a caller can apply it at a propositionally-last slot without a dependent rewrite of the slot index.

k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(permT id ) ((permT (Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x)) ) (((crossToEnd i (id 0) ) t) (unitTensor (c i)))) = (permT (Fin.append i.succAbove fun x => i) ) t -- The `id`-spelled map leaves the composite slot proof type-correct only at default -- transparency, so `rw`/`simp` cannot key on it; `erw` matches up to defeq. erw [k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(permT id ) ((permT (Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x)) ) ((permT (Fin.append i.succAbove fun x => i) ) t)) = (permT (Fin.append i.succAbove fun x => i) ) tk:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(permT id ) ((permT (Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x)) ) ((permT (Fin.append i.succAbove fun x => i) ) t)) = (permT (Fin.append i.succAbove fun x => i) ) t erw [k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(permT (Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) ) ((permT (Fin.append i.succAbove fun x => i) ) t) = (permT (Fin.append i.succAbove fun x => i) ) t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(permT ((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) ) t = (permT (Fin.append i.succAbove fun x => i) ) tk:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(permT ((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) ) t = (permT (Fin.append i.succAbove fun x => i) ) t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id = Fin.append i.succAbove fun x => ik:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor ct = t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor c(Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id = Fin.append i.succAbove fun x => i k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor cx:Fin (nA + 1)((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) x = Fin.append i.succAbove (fun x => i) x k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor cx:Fin (nA + 1)a:Fin nA((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) (Fin.castAdd 1 a) = Fin.append i.succAbove (fun x => i) (Fin.castAdd 1 a)k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor cx:Fin (nA + 1)a:Fin 1((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) (Fin.natAdd nA a) = Fin.append i.succAbove (fun x => i) (Fin.natAdd nA a) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor cx:Fin (nA + 1)a:Fin nA((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) (Fin.castAdd 1 a) = Fin.append i.succAbove (fun x => i) (Fin.castAdd 1 a) All goals completed! 🐙 k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor cx:Fin (nA + 1)a:Fin 1((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) (Fin.natAdd nA a) = Fin.append i.succAbove (fun x => i) (Fin.natAdd nA a) k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor cx:Fin (nA + 1)((Fin.append i.succAbove fun x => i) Fin.append (Fin.castAdd 1) (Fin.natAdd nA fun x => x) id) (Fin.natAdd nA ((fun i => i) 0, )) = Fin.append i.succAbove (fun x => i) (Fin.natAdd nA ((fun i => i) 0, )) All goals completed! 🐙 k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor ct = t All goals completed! 🐙

Round trip for crossToSlot at an arbitrary slot, with the colors in their composite form. The general-color statement crossToSlot_raise_lower_round_trip is obtained from this by substituting its three color equalities.

k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor chcycle:(Equiv.symm (i.cycleIcc (Fin.last nA))) i = Fin.last nAhcycle_succAbove: (a : Fin nA), (Equiv.symm (i.cycleIcc (Fin.last nA))) (i.succAbove a) = Fin.castAdd 1 ahpl:((crossToEnd i 0 ) ((permT (Equiv.symm (i.cycleIcc (Fin.last nA))) ) (((crossToEnd i 0 ) t) M₁))) M₂ = (permT (Fin.append (Fin.castAdd 1 id) (Fin.natAdd nA)) ) (((crossToEnd ((Equiv.symm (i.cycleIcc (Fin.last nA))) i) 0 ) (((crossToEnd i 0 ) t) M₁)) M₂)x:Fin (nA + 1)((Fin.append i.succAbove fun x => i) id (Equiv.symm (i.cycleIcc (Fin.last nA)))) x = id x All goals completed! 🐙 k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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 bnA:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)M₁:S.Tensor ![S.τ (c i), d]M₂:S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M₁) M₂ = (permT id ) (unitTensor (c i))t:S.Tensor chcycle:(Equiv.symm (i.cycleIcc (Fin.last nA))) i = Fin.last nAhcycle_succAbove: (a : Fin nA), (Equiv.symm (i.cycleIcc (Fin.last nA))) (i.succAbove a) = Fin.castAdd 1 ahpl:((crossToEnd i 0 ) ((permT (Equiv.symm (i.cycleIcc (Fin.last nA))) ) (((crossToEnd i 0 ) t) M₁))) M₂ = (permT (Fin.append (Fin.castAdd 1 id) (Fin.natAdd nA)) ) (((crossToEnd ((Equiv.symm (i.cycleIcc (Fin.last nA))) i) 0 ) (((crossToEnd i 0 ) t) M₁)) M₂)t = t All goals completed! 🐙

Raising then lowering a named index, with every color threaded propositionally. For a rank-2 metric M : ![a, d] and an inverse M' : ![b, e] collapsing to the unit tensor (M · M' = δ), at any rank and any slot i: contracting slot i with M, then contracting the result with M', is the identity up to the Function.update color reindex.

No color is pinned to a composite. ha : τ (c i) = a places the metric's contracted slot, hb : τ d = b the inverse's, and he : c i = e the surviving one, so a caller whose metric and inverse sit at literal colors supplies them directly, with no transporting permT on either factor. Lowering then raising is this same statement with M and M' exchanged and the reversed collapse M' · M = δ; neither collapse follows from the other here.

k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hM:((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)t:S.Tensor cS.τ d = b; All goals completed! 🐙 : S.τ (Function.update c i d i) = b) M' (crossToSlot (S := S) i (0 : Fin 2) ha M t) = permT (id : Fin (nA + 1) Fin (nA + 1)) (IsReindexing.update_update_of_eq i he) t := k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hM:((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)t:S.Tensor c(crossToSlot i 0 M') ((crossToSlot i 0 ha M) t) = (permT id ) t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = ehb:S.τ d = bM':S.Tensor ![b, e]t:S.Tensor cM:S.Tensor ![S.τ (c i), d]hM:((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)(crossToSlot i 0 M') ((crossToSlot i 0 M) t) = (permT id ) t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Cd:Ce:Ci:Fin (nA + 1)he:c i = et:S.Tensor cM:S.Tensor ![S.τ (c i), d]M':S.Tensor ![S.τ d, e]hM:((crossToEnd (Fin.last 1) 0 ) M) M' = (permT id ) (unitTensor e)(crossToSlot i 0 M') ((crossToSlot i 0 M) t) = (permT id ) t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Cd:Ci:Fin (nA + 1)t:S.Tensor cM:S.Tensor ![S.τ (c i), d]M':S.Tensor ![S.τ d, c i]hM:((crossToEnd (Fin.last 1) 0 ) M) M' = (permT id ) (unitTensor (c i))(crossToSlot i 0 M') ((crossToSlot i 0 M) t) = (permT id ) t All goals completed! 🐙

C. Raising and lowering as an equivalence

Both collapse orders are hypotheses here and each is used once: M · M' = δ gives one round trip by section B, M' · M = δ the other through injectivity of the lowering half.

Lowering undoes raising: crossToSlot_raise_lower_round_trip with the color cast absorbed into crossToSlotInv.

include hMM' inlemma crossToSlotInv_crossToSlot (t : Tensor S c) : crossToSlotInv i he hb M' (crossToSlot i (0 : Fin 2) ha M t) = t := k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hMM':((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)t:S.Tensor c(crossToSlotInv i he hb M') ((crossToSlot i 0 ha M) t) = t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hMM':((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)t:S.Tensor c(permT id ) ((crossToSlot i 0 M') ((crossToSlot i 0 ha M) t)) = t -- Unfolding `crossToSlotInv` leaves the inner slot proof at the clean color `b` where the goal -- wants the composite `![b, e] 0`, so `rw` cannot key on the round trip; `erw` matches. erw [k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hMM':((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)t:S.Tensor c(permT id ) ((permT id ) t) = t k:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hMM':((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)t:S.Tensor c(permT (id id) ) t = tk:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hMM':((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)t:S.Tensor c(permT (id id) ) t = t All goals completed! 🐙

Raising undoes lowering. The reversed collapse M' · M = δ is the round trip at the color list Function.update c i d with the pair exchanged, which gives the lowering half a left inverse and hence injectivity; that upgrades crossToSlotInv_crossToSlot to a two-sided inverse.

include hMM' hM'M ink:Typeinst✝⁵:RCLike kC:TypeG:Typeinst✝⁴:Group GV:C Typeinst✝³:(c : C) AddCommGroup (V c)inst✝²:(c : C) Module k (V c)basisIdx:C Typeinst✝¹:(c : C) Fintype (basisIdx c)inst✝:(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:c:Fin (nA + 1) Ca:Cb:Cd:Ce:Ci:Fin (nA + 1)he:c i = eha:S.τ (c i) = ahb:S.τ d = bM:S.Tensor ![a, d]M':S.Tensor ![b, e]hMM':((crossToEnd (Fin.last 1) 0 hb) M) M' = (permT id ) (unitTensor e)hM'M:((crossToEnd (Fin.last 1) 0 ) M') M = (permT id ) (unitTensor d)t:S.Tensor (Function.update c i d)hswap: (t : S.Tensor (Function.update c i d)), (crossToSlot i 0 M) ((crossToSlot i 0 M') t) = (permT id ) thgi:Function.Injective (crossToSlot i 0 M')hinj:Function.Injective (crossToSlotInv i he hb M')(crossToSlot i 0 ha M) ((crossToSlotInv i he hb M') t) = t All goals completed! 🐙