# Substitute and dummy indices manipulation

The behaviour described below could be a bug, or due to my ignorance! (I plead guilty)

Inspired in the example of Kaluza--Klein provided by Kasper, I wanted to play around with more general models than General Relativity. In particular I considered a Lagrangian with quadratic terms in the curvature (Gauss--Bonnet)

{\alpha,\beta,\gamma,\lambda,\chi#,\xi,\mu,\nu,\sigma,\rho,\tau}::Indices(position=independent);
D{#}::Derivative;
\partial{#}::PartialDerivative;
g_{\mu \nu}::Metric;
g^{\mu\nu}::InverseMetric;
R_{\mu \nu \sigma \rho}::RiemannTensor;


I define some substitutions

afin_conex:= \Gamma^{\rho?}_{\mu? \nu?} -> 1/2 g^{\rho? \alpha?}(\partial_{\mu?}{g_{\nu? \alpha?}} + \partial_{\nu?}{g_{\mu? \alpha?}}
- \partial_{\alpha?}{g_{\mu? \nu?}}) + K^{\rho?}_{\mu? \nu?};

curv:= R^{\rho? \sigma?}_{\mu? \nu?} -> \partial_{\mu?}{\Gamma^{\rho?}_{\nu?}^{\sigma?}} - \partial_{\nu?}{\Gamma^{\rho?}_{\mu?}^{\sigma?}} +
\Gamma^{\rho?}_{\mu? \chi1} \Gamma^{\chi1}_{\nu?}^{\sigma?} - \Gamma^{\rho?}_{\nu? \chi1} \Gamma^{\chi1}_{\mu?}^{\sigma?};

Lag:= ( R^{\mu \nu}_{\mu \nu} - 4 \Lambda + \phi /24 (R^{\mu \nu}_{\mu \nu} R^{\rho \sigma}_{\rho \sigma}
- 4 R^{\mu \xi}_{\nu \xi} R^{\nu \lambda}_{\mu \lambda} + R^{\mu \nu}_{\rho \sigma} R^{\rho \sigma}_{\mu \nu}));


And try to substitute

substitute( Lag, curv, repeat=True);


The summed indices within the substitution are repeated and I get and error

ConsistencyException: Triple index \chi1 inside a single factor found.

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


Ok, I can by pass this by defining two different curvatures $R$ and $Rp$

afin_conex:= \Gamma^{\rho?}_{\mu? \nu?} -> 1/2 g^{\rho? \alpha?}(\partial_{\mu?}{g_{\nu? \alpha?}} + \partial_{\nu?}{g_{\mu? \alpha?}}
- \partial_{\alpha?}{g_{\mu? \nu?}}) + K^{\rho?}_{\mu? \nu?};

curv:= R^{\rho? \sigma?}_{\mu? \nu?} -> \partial_{\mu?}{\Gamma^{\rho?}_{\nu?}^{\sigma?}} - \partial_{\nu?}{\Gamma^{\rho?}_{\mu?}^{\sigma?}} +
\Gamma^{\rho?}_{\mu? \chi1} \Gamma^{\chi1}_{\nu?}^{\sigma?} - \Gamma^{\rho?}_{\nu? \chi1} \Gamma^{\chi1}_{\mu?}^{\sigma?};

curvp:= Rp^{\rho? \sigma?}_{\mu? \nu?} -> \partial_{\mu?}{\Gamma^{\rho?}_{\nu?}^{\sigma?}} - \partial_{\nu?}{\Gamma^{\rho?}_{\mu?}^{\sigma?}} +
\Gamma^{\rho?}_{\mu? \chi2} \Gamma^{\chi2}_{\nu?}^{\sigma?} - \Gamma^{\rho?}_{\nu? \chi2} \Gamma^{\chi2}_{\mu?}^{\sigma?};

Lag:= ( R^{\mu \nu}_{\mu \nu} - 4 \Lambda + \phi /24 (R^{\mu \nu}_{\mu \nu} Rp^{\rho \sigma}_{\rho \sigma}
- 4 R^{\mu \xi}_{\nu \xi} Rp^{\nu \lambda}_{\mu \lambda} + R^{\mu \nu}_{\rho \sigma} Rp^{\rho \sigma}_{\mu \nu}));


and it works, but the problem persists as I try the next substitution!

Does anyone know what the problem is?

+1 vote

I can't reproduce that problem here with the version currently in github. The substitution works fine.

selected by

I've been working already with the version in github. I'm currently rebuilding cadabra2 to confirm the behaviour. By the way, this behaviour was discovered by two of my collaborators, so we are at least three people confirming the report... but still checking!

Update 1

I confirm that the simplified example I gave works!
(currently running build 1800.8993032f84 dated 2018-05-31)

However, I can confirm the bad behaviour reported above for my research cnb... I'll debug it to see what the problem is and report back.

Thank you Kasper.

It may have something to do with that automatically generated series of indices \chi#. Try sticking in a list of explicit names and see if that makes the problem go away.