Needs["xAct`xTras`"]

$PrePrint=ScreenDollarIndices;
$CovDFormat= "Prefix";
$CVVerbose=False;
$DefInfoQ=False;

EV[x_]:= FullSimplification[][ToCanonical[x]]
DefConstantSymbol[ρ]

DefManifold[S2,2,IndexRange[a,c]]
DefMetric[1,met2[-a,-b],CD2,{";","∇"},PrintAs->"g"]
eps2=epsilon[met2]

FullSimplification[][NoScalar[EulerDensity[CD2]]]

DefTensor[x2[a], {S2}]
AutomaticRules[x2, MakeRule[{Evaluate[ToCanonical[x2[-a]CD2[-b]@x2[a]]], 0}]]
AutomaticRules[x2, MakeRule[{Evaluate[ToCanonical[x2[-a]x2[a]]], 1}]]

DefTensor[y2[-a], {S2}]
IndexSetDelayed[y2[a_], eps2[a,-b] x2[b]]

DefTensor[z2[-a], {S2}]
IndexSetDelayed[z2[a_], CD2[a][x2[b]] y2[-b]]

DefTensor[dz2[-a, -b], {S2}]
dz2[a_, b_] :=Antisymmetrize[CD2[a]@z2[b], {a, b}]

UpValues[x2]
UpValues[y2]
UpValues[z2]
UpValues[dz2]

DownValues[x2]
DownValues[y2]
DownValues[z2]
DownValues[dz2]

Riemann[CD2][-a,-b,-c,-d]
% //RiemannToWeyl
%//EV
%//RicciToEinstein
%//EV
%%%//RicciToSchouten
%//EV

Einstein[CD2][-a,-b]
Ricci[CD2][-a,-b]//EV
Schouten[CD2][-a,-b]//EV
Weyl[CD2][-a,-b,-c,-d]

y2[a]y2[-a]//EV

RicciScalar[CD2][]eps2[-a,-b]
EV[%y2[c]]y2[-c]
% //EV

dz2[-a,-b]eps2[a,b](*-RicciScalar[CD2][]eps2[-a,-b]/4*)
%//EV
%//RiemannToWeyl
% //EV
EV[%y2[c]]y2[-c]
% //EV

DefManifold[S3,3,IndexRange[d,h]]
DefMetric[1,met3[-d,-e],CD3,{";","∇"},PrintAs->"g"]
eps3=epsilon[met3]

(*IndexSetDelayed[Riemann[CD3][a_,b_,c_,d_], ρ^-2Antisymmetrize[met3[a,c]met3[b,d],{a,b}]]*)
(*IndexSetDelayed[Ricci[CD3][a_,b_], met[a,b]]
IndexSetDelayed[RicciScalar[CD3][], 2]*)
IndexSetDelayed[Einstein[CD3][d_,e_], 0]

DefTensor[x3[d], {S3}]
AutomaticRules[x3, MakeRule[{Evaluate[ToCanonical[x3[-d]CD3[-e]@x3[d]]], 0}]]
AutomaticRules[x3, MakeRule[{Evaluate[ToCanonical[x3[-d]x3[d]]], 1}]]

DefTensor[y3[-d, -f], {S3}]
IndexSetDelayed[y3[d_, f_], eps3[d,-e, f] x3[e]]

DefTensor[z3[-d, -f], {S3}]
IndexSetDelayed[z3[d_,f_], CD3[d][x3[e]] y3[-e, f]]

DefTensor[dz3[-d, -e, -f], {S3}]
dz3[d_, e_, f_]:=Antisymmetrize[CD3[d]@z3[e, f]]

UpValues[x3]
UpValues[y3]
UpValues[z3]
UpValues[dz3]

DownValues[x3]
DownValues[y3]
DownValues[z3]
DownValues[dz3]

Riemann[CD3][d,e,f,g]
%//EV
%met3[-e,-g]
%//EV
%met3[-d,-f]
%//EV

y3[d,e]y3[-d,-e]//EV

RicciScalar[CD3][]eps3[-d,-e,-f]
EV[%y3[g, h]]y3[-g, -h]
% //EV

dz3[-d,-e,-f](*eps3[d,e,f]+RicciScalar[CD3][]eps3[-d,-e,-f]/3*)
%//EV
%eps3[d,e,f]
%y3[g, h]
%//EV
%y3[-g, -h]/2
%//EV

DefManifold[S4,4,IndexRange[i,p]]
DefMetric[1,met4[-i,-j],CD4,{";","∇"},PrintAs->"g"]
eps4=epsilon[met4]

FullSimplification[][NoScalar[EulerDensity[CD4]]]

(*IndexSetDelayed[Riemann[CD4][i_,j_,k_,l_], ρ^-2Antisymmetrize[met4[i,k]met4[j,l],{i,j}]]*)
(*IndexSetDelayed[Ricci[CD4][a_,b_], met[a,b]]
IndexSetDelayed[RicciScalar[CD4][], 2]*)
IndexSetDelayed[Einstein[CD4][i_,j_], 0]

DefTensor[x4[i], {S4}]
AutomaticRules[x4, MakeRule[{Evaluate[ToCanonical[x4[-i]CD4[-j]@x4[i]]], 0}]]
AutomaticRules[x4, MakeRule[{Evaluate[ToCanonical[x4[-i]x4[i]]], 1}]]

DefTensor[y4[-i, -k, -l], {S4}]
IndexSetDelayed[y4[i_, k_, l_], eps4[i,-j, k, l] x4[j]]

DefTensor[z4[-i, -k, -l], {S4}]
IndexSetDelayed[z4[i_,k_, l_], CD4[i][x4[j]] y4[-j, k, l]]

DefTensor[dz4[-i, -j, -k, -l], {S4}]
dz4[i_, j_, k_, l_] :=Antisymmetrize[CD4[i]@z4[j, k, l], {i,j,k,l}]

UpValues[y4]
UpValues[x4]
UpValues[z4]
UpValues[dz4]

DownValues[x4]
DownValues[y4]
DownValues[z4]
DownValues[dz4]

Riemann[CD4][i,j,k, l]
%//EV
%met4[-j,-l]
%//EV
%met4[-i,-k]
%//EV

RicciScalar[CD4][]//ToRiemann

y4[i,j, k]y4[-i,-j, -k]//EV

RicciScalar[CD4][]eps4[-i,-j,-k, -l]
EV[%y4[m, n]]y4[-m, -n]
% //EV

GB = NoScalar[EulerDensity[CD4]]
dz4[-i,-j,-k,-l] 
% -  GB eps4[-i,-j,-k,-l]
%//SortCovDs
%//RiemannToWeyl
%//ContractMetric
%//ToCanonical
% //Simplification
(*%//RicciToEinstein*)
(*%//EV*)
(*%eps4[i,j,k, l]*)

%y4[m, n, o]
%//EV
%y4[-m, -n, -o]/6
%//EV

LieD[x4[l]][y4[-i,-j,-k]]
%//EV

LieD[x4[l]][Ricci[CD4][-i,-j]x4[i]x4[j]]
%//EV

( Ricci[CD4][-i,-j])x4[i]x4[j]
%//EV
%//RicciToEinstein
%//EV
%//CD4[-j]
%//EV

FullSimplification[][NoScalar[EulerDensity[CD4]]]

Exp[Pi] - Pi//N
Pi^3//N

Help

?xAct`xTras`*

?xAct`xTensor`*

?xAct`xCoba`*