Hi, I've got a similar problem before, and it is due (to my understanding) to the fact that cadabra uses the notation
∂ab
to denote
$\partial{a}\partial{b}.$
I solved my problem by adding a dummy symbol that can be then set to one after the simplification (if it is still around), I used the symbol I in the ex2
below
{a,b,c}::Indices.
\partial{#}::PartialDerivative.
ex := \partial_{a}{ A^a } + A_a B^a + \partial_{a}{ \partial_{b}{ A^a }} B^b
+ \partial_{a}{ A^b } \partial_{b}{ B^a };
ex2 := \partial_{a}{ A^a } + A_a B^a + \partial_{a}{ I \partial_{b}{ A^a }} B^b
+ \partial_{a}{ A^b } \partial_{b}{ B^a };
rl := \partial_{a}{ A^{b} } -> 0;
substitute(ex, rl);
substitute(ex2, rl);
See the result here
Hope this can be useful.
Update:
Another solution is that you could declare \partial{#}::Derivative.
instead of like a partial derivative. The difference is that Derivative
does not simplify the notation
$\partial{a}\partial{b}$
to
∂ab,
and the substitution works properly.
See the updated code and result