# Problem with substitution

Hi. I'm trying to compactify a la Kaluza-Klein a very simple term

$$L = H{\Sigma \Sigma} \theta \partial{\Pi}{\partial^{\Pi}{\theta}},$$
where the capital Greek indices are in five dimensions, $H$ and $\theta$ are the fields (and so far I don't care about the position of the indices).

## Definitions

{\Lambda,\Theta,\Sigma,\Xi,\Gamma,\Delta,\Pi,\Omega}::Indices(full,position=independent);
{\mu,\nu,\rho,\sigma,\gamma,\lambda}::Indices(space1,position=independent);
\partial{#}::PartialDerivative;
H_{\Pi? \Sigma?}::Symmetric;


## The spliting of indices

fourterm:= a k/4 (H_{\Sigma \Sigma} \theta \partial_{\Pi}{\partial^{\Pi}{\theta}});
split_index(_, $\Sigma,\sigma,4$, repeat=True);


So far so good, but I would like to substitute the different components of $H$ according to the Kaluza-Klein ansatz.

## Substitutions

Htoh:= H_{\mu? \nu?} -> (e^{2 \alpha \phi} h_{\mu? \nu?} + e^{2 \beta \phi} A_{\mu?} A_{\nu?});
Htot:= H_t -> e^{2 \alpha \phi} h_t;
HtoA:= H_{\mu? 4} -> e^{2 \beta \phi} A_{\mu?};
HtoS:= H_{4 4} -> e^{2 \beta \phi};


when I execute the line

substitute(fourterm, HtoS);


the result is Ok. However, if I ask to substitute the tensor component,

substitute(fourterm, Htoh);


I get the message:

"""
RuntimeError: substitute: Index error in replacement rule. Free indices in different terms in a sum do not match.

At:
<string>(2): <module>
"""


### Questions

• Do you reprodure the error?
• What can I do to solve it?
• It seems that is due to the presence of the sum on the substitution.... If I ask to substitute a monomial it does it without problems. However, I've done complicated substitutions with the commend.

Set up

Running Debian buster (up to date).

+1 vote

Should probably go in a FAQ: if you write e^{a} this gets interpreted as a tensor e with one contravariant index a. To write exponentials, use \exp{...} instead, or e**{...} if you really want the e.
Understand! However, the substitution $HtoS$ does work. In addition, I've been trying to implement your suggestion, but Cadabra2 started to crash. I'll let you know later!
The HtoS rule works because you are allowed to change the number of free indices in a substitution rule (a thing with a -> arrow). Had you written it with an equals sign, Cadabra would have complained.
After a reboot of the machine (which had an upgrade) and run your suggestion---with \exp{...}---, it seems to works perfect! Thank you Kasper!