<<Gravity.m;<<Gravity2.m;<<GravityPt.m;

(* 11D SUGRA : perturbation *)

(* Vielbein Formalism *)
id={"t","(Subscript[x, 1])","(Subscript[x, 2])","(Subscript[x, 3])","(Subscript[y, 1])","(Subscript[y, 2])","(Subscript[y, 3])","(Subscript[y, 4])","(Subscript[y, 5])","(Subscript[y, 6])","(Subscript[y, 7])"};(* local Lorentz indices *)
dim=Length[id];(* dimension *)
cd={t,(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[y, 1]),(Subscript[y, 2]),(Subscript[y, 3]),(Subscript[y, 4]),(Subscript[y, 5]),(Subscript[y, 6]),(Subscript[y, 7])};(* general coordinates *)
dX={dt,(Subscript[dx, 1]),(Subscript[dx, 2]),(Subscript[dx, 3]),(Subscript[dy, 1]),(Subscript[dy, 2]),(Subscript[dy, 3]),(Subscript[dy, 4]),(Subscript[dy, 5]),(Subscript[dy, 6]),(Subscript[dy, 7])};(* 1-forms of the general coordinates *)
ee=Table[(e^(id[[u]])),{u,1,dim}];(* 1-forms of the vielbein *)
eta=DiagonalMatrix[Join[{-1},Table[1,{u,1,dim-1}]]];(* local flat metric *)
vbPt=(({{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0,  a[t](1+(ϵ/2) hp[t,(Subscript[x, 3])]), 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, a[t]ϵ hc[t,(Subscript[x, 3])], a[t](1-(ϵ/2) hp[t,(Subscript[x, 3])]) , 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, a[t] , 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, b[t], 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, b[t], 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, b[t], 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, b[t], 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, b[t], 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, b[t], 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, b[t]}}));
{tvbPt,ivPt,tivPt,lvbPt,gdPt,guPt}=VielbeinPt[2];
{SdPt,SlPt}=ConnectionPt[2];
{RdPt,RlPt,RcPt,RsPt}=RiemannPt[2];

gdPt // MatrixForm

(* Action up to O((ϵ^3)) *)

Target /: Target[T_]:=Module[{Ps,Ptg,T1,T2},

Ps=Position[T,Derivative[_,_]];
{T1,T2}={0,0};

If[Ps=!={},
Ptg=Drop[Ps[[1]],-2];(* Position of T1 *)
T1=Apply[Part,Join[{T},Ptg]];(* term with derivatives *)
T2=T/T1; (* terms which should be differentiated *)
];

{T1,T2}
];

Target[a[t] ((b[t])^7) hp[t,(Subscript[x, 3])] Derivative[0,2][hp][t,(Subscript[x, 3])]]

PartialDeriv /: PartialDeriv[T1_,T2_]:=Module[{Dr,res},
Dr=T1[[0,0]];(* List of derivatives on T1 *)
res=(((-1))^(Sum[Dr[[i]],{i,1,2}])) (T1 /. {Derivative[_,_][f_]->f})D[T2,{t,Dr[[1]]},{(Subscript[x, 3]),Dr[[2]]}]
];

PartialDeriv[Derivative[0,5][hp][t,(Subscript[x, 3])],a[t] ((b[t])^7) hc[t,(Subscript[x, 3])]]

Action[S0_]:=Module[{S1,S2,Tg,Tfinal,Ps1,Ps2,res},
S1=0;
Do[Tg=Target[S0[[n]]];
    Tfinal=S0[[n]];
    If[Tg=!={0,0},Tfinal=PartialDeriv[Tg[[1]],Tg[[2]]];];
    S1=S1+Tfinal; (* make f[t,(Subscript[x, 3])] Derivative[a,b][g][t,(Subscript[x, 3])] *)
,{n,1,Length[S0]}];
S1=Expand[S1];

S2=0;
Do[Tg=Target[S1[[n]]];
    Tfinal=S1[[n]];
    If[Tg=!={0,0}, 
        Ps1=Position[S1[[n]],f_[t,(Subscript[x, 3])]][[1,1]]; (* f[t,(Subscript[x, 3])] *)
        Ps2=Position[S1[[n]],Derivative[_,_][f_][t,(Subscript[x, 3])]][[1,1]];(* Derivative[a,b][g][t,(Subscript[x, 3])] *)
        If[MemberQ[{{hp,hc},{hp,hp},{hc,hc}},{S1[[n,Ps1,0]],S1[[n,Ps2,0,1]]}],
             Tfinal=PartialDeriv[Tg[[1]],Tg[[2]]];
     ];
  ];
    S2=S2+Tfinal;
,{n,1,Length[S1]}];
S2
];

(* Generate Action for Perturbations *)

rep1={a'[t]->a[t]H[t],a''[t]->a[t]((H[t])^2)+a[t]H'[t],Derivative[3][a][t]->a[t]((H[t])^3)+3a[t]H[t]H'[t]+a[t]H''[t],Derivative[4][a][t]->a[t] ((H[t])^4)+6 a[t] ((H[t])^2) H'[t]+3 a[t] ((H'[t])^2)+4 a[t] H[t] H''[t]+a[t] Derivative[3][H][t],b'[t]->b[t]G[t],b''[t]->b[t]((G[t])^2)+b[t]G'[t],Derivative[3][b][t]->b[t]((G[t])^3)+3b[t]G[t]G'[t]+b[t]G''[t],Derivative[4][b][t]->b[t] ((G[t])^4)+6 b[t] ((G[t])^2) G'[t]+3 b[t] ((G'[t])^2)+4 b[t] G[t] G''[t]+b[t] Derivative[3][G][t]};
rep2=Flatten[Join[Table[{Derivative[i,0][f_][t,(Subscript[x, 3])]->Derivative[i][f][t]},{i,1,4}],Table[{Derivative[i,2][f_][t,(Subscript[x, 3])]->-(k^2)Derivative[i][f][t],Derivative[i,4][f_][t,(Subscript[x, 3])]->(k^4)Derivative[i][f][t]},{i,0,4}]]];
Ptlist={hp[t] ,hc[t]};
rep3=Flatten[Join[{{Γ,ϵ,k,a[t],b[t]}},Outer[Times,Ptlist,Ptlist],Outer[Times,Ptlist,D[Ptlist,t]],Outer[Times,Ptlist,D[Ptlist,{t,2}]],Outer[Times,Ptlist,D[Ptlist,{t,3}]],Outer[Times,Ptlist,D[Ptlist,{t,4}]],Outer[Times,D[Ptlist,t],D[Ptlist,t]],Outer[Times,D[Ptlist,t],D[Ptlist,{t,2}]],Outer[Times,D[Ptlist,t],D[Ptlist,{t,3}]],Outer[Times,D[Ptlist,{t,2}],D[Ptlist,{t,2}]]]];

(* Derive Action (30) *)

S0=Expand[NSProd[{Det[vbPt]},{RsPt},2] /. rep1]

S1=Expand[Action[S0]  /. rep1]

S2=Collect[Expand[S1 //. rep2 /. {f_[t,(Subscript[x, 3])]->f[t]}],rep3]

S3=Collect[Expand[D[(1/2)S2,{ϵ,2}]] ,rep3]

(* 全微分項を使って作用を整理する *)

S4=Collect[Expand[S3-D[((a[t])^3) ((b[t])^7) ( - H[t] (((hp[t])^2)/2) -(1/2) hc[t] hc'[t]-(1/2) hp[t] hp'[t]),t] /. rep1] ,rep3]

Collect[Expand[S4 //. {H'[t]-> ((1-(Sqrt[21]))/2)((H[t])^2),G'[t]->(1/28) (1-(Sqrt[21])) (-7+(Sqrt[21])) ((H[t])^2),G[t]->((-7+(Sqrt[21]))/14)H[t]}],rep3]

(* W^4 part of Action (30) *)

DetvbPt=Expand[Normal[Series[Det[vbPt],{ϵ,0,2}]]];

WlPt=WeylPt[RlPt];

W4part=24(TensorProdPt[{{WlPt,{a1,a2,a3,a4}},{WlPt,{a1,a2,a3,a4}},{WlPt,{a5,a6,a7,a8}},{WlPt,{a5,a6,a7,a8}}},eta,2][[1]]-64TensorProdPt[{{WlPt,{a1, a2, a3, a4}},{WlPt,{a2, a3, a4, a8}},{WlPt,{a5, a6, a7, a8}},{WlPt,{a1, a5, a6, a7}}},eta,2][[1]]+2TensorProdPt[{{WlPt,{a1, a2, a3, a4}},{WlPt,{a1, a2, a5, a6}},{WlPt,{a5, a6, a7, a8}},{WlPt,{a3, a4, a7, a8}}},eta,2][[1]]+16TensorProdPt[{{WlPt,{a1, a3, a2, a4}},{WlPt,{a1, a5, a2, a6}},{WlPt,{a5, a7, a6, a8}},{WlPt,{a3, a7, a4, a8}}},eta,2][[1]]-16TensorProdPt[{{WlPt,{a1, a2, a3, a4}},{WlPt,{a3, a4, a7, a8}},{WlPt,{a1, a5, a6, a7}},{WlPt,{a2, a5, a6, a8}}},eta,2][[1]]-16TensorProdPt[{{WlPt,{a1, a2, a3, a4}},{WlPt,{a3, a4, a7, a8}},{WlPt,{a1, a5, a6, a7}},{WlPt,{a2, a6, a5, a8}}},eta,2][[1]]);

S10=Expand[NSProd[{DetvbPt},{W4part},2] /. rep1]

S11=Collect[Expand[Action[S10]  /. rep1 //. rep2 /. {f_[t,(Subscript[x, 3])]->f[t]}],rep3]

S12=Collect[Expand[D[(1/2)S11,{ϵ,2}]] ,rep3]

S13=Collect[Expand[S12-D[((a[t])^3) ((b[t])^7)(((14336 ((G[t])^4))/675)+(272384/675) ((G[t])^3) H[t]-(351232/675) ((G[t])^2) ((H[t])^2)-(57344/225) G[t] ((H[t])^3)+((78848 ((H[t])^4))/225)+(329728/675) ((G[t])^2) G'[t]+(444416/675) G[t] H[t] G'[t]-(28672/25) ((H[t])^2) G'[t]+(551936/675) ((G'[t])^2)-(329728/675) ((G[t])^2) H'[t]-(444416/675) G[t] H[t] H'[t]+(28672/25) ((H[t])^2) H'[t]-(1103872/675) G'[t] H'[t]+(551936/675) ((H'[t])^2))( hc[t]Derivative[3][hc][t]+hp[t]Derivative[3][hp][t]),t]-D[((a[t])^3) ((b[t])^7)(-(14336/675) ((G[t])^4)-(272384/675) ((G[t])^3) H[t]+(351232/675) ((G[t])^2) ((H[t])^2)+(57344/225) G[t] ((H[t])^3)-((78848 ((H[t])^4))/225)-(329728/675) ((G[t])^2) G'[t]-(444416/675) G[t] H[t] G'[t]+(28672/25) ((H[t])^2) G'[t]-(551936/675) ((G'[t])^2)+(329728/675) ((G[t])^2) H'[t]+(444416/675) G[t] H[t] H'[t]-(28672/25) ((H[t])^2) H'[t]+(1103872/675) G'[t] H'[t]-(551936/675) ((H'[t])^2)) (hc'[t] Derivative[2][hc][t]+hp'[t] Derivative[2][hp][t]),t]-D[((a[t])^3) ((b[t])^7) (((78848 ((G[t])^5))/225)-(28672/225) ((G[t])^4) H[t]+(1691648/225) ((G[t])^3) ((H[t])^2)-(387072/25) ((G[t])^2) ((H[t])^3)+7168 G[t] ((H[t])^4)+((14336 ((H[t])^5))/25)+(982016/675) ((G[t])^3) G'[t]+(551936/45) ((G[t])^2) H[t] G'[t]-(5153792/675) G[t] ((H[t])^2) G'[t]-(1369088/225) ((H[t])^3) G'[t]+(759808/135) G[t] ((G'[t])^2)+(3928064/675) H[t] ((G'[t])^2)-(652288/675) ((G[t])^3) H'[t]-(8164352/675) ((G[t])^2) H[t] H'[t]+(437248/75) G[t] ((H[t])^2) H'[t]+(1627136/225) ((H[t])^3) H'[t]-(2164736/225) G[t] G'[t] H'[t]-(358400/27) H[t] G'[t] H'[t]+(2695168/675) G[t] ((H'[t])^2)+(186368/25) H[t] ((H'[t])^2)+(329728/675) ((G[t])^2) G''[t]+(444416/675) G[t] H[t] G''[t]-(28672/25) ((H[t])^2) G''[t]+(1103872/675) G'[t] G''[t]-(1103872/675) H'[t] G''[t]-(329728/675) ((G[t])^2) H''[t]-(444416/675) G[t] H[t] H''[t]+(28672/25) ((H[t])^2) H''[t]-(1103872/675) G'[t] H''[t]+(1103872/675) H'[t] H''[t]) (hc[t]Derivative[2][hc][t]+hp[t]Derivative[2][hp][t]),t]-D[((a[t])^3) ((b[t])^7)(-(136192/675) ((G[t])^5)+(2035712/675) ((G[t])^4) H[t]-(6716416/675) ((G[t])^3) ((H[t])^2)+(910336/75) ((G[t])^2) ((H[t])^3)-(1232896/225) G[t] ((H[t])^4)+((7168 ((H[t])^5))/15)+(1383424/675) ((G[t])^3) G'[t]-(3361792/675) ((G[t])^2) H[t] G'[t]+(121856/225) G[t] ((H[t])^2) G'[t]+(7168/3) ((H[t])^3) G'[t]+(723968/675) G[t] ((G'[t])^2)-(121856/45) H[t] ((G'[t])^2)-(1383424/675) ((G[t])^3) H'[t]+(3361792/675) ((G[t])^2) H[t] H'[t]-(121856/225) G[t] ((H[t])^2) H'[t]-(7168/3) ((H[t])^3) H'[t]-(1447936/675) G[t] G'[t] H'[t]+(243712/45) H[t] G'[t] H'[t]+(723968/675) G[t] ((H'[t])^2)-(121856/45) H[t] ((H'[t])^2))(1/2) (((hc'[t])^2) +((hp'[t])^2)),t]-D[ ((a[t])^3) ((b[t])^7)(((2369024 ((G[t])^6))/3375)-((55629056 ((G[t])^5) H[t])/3375)+((184721152 ((G[t])^4) ((H[t])^2))/3375)-((190580992 ((G[t])^3) ((H[t])^3))/3375)+((12201728 ((G[t])^2) ((H[t])^4))/1125)+(2619904/375) G[t] ((H[t])^5)-((39424 ((H[t])^6))/125)-(1671936/125) ((G[t])^4) G'[t]+((24715264 ((G[t])^3) H[t] G'[t])/1125)+((32307968 ((G[t])^2) ((H[t])^2) G'[t])/1125)-((39936512 G[t] ((H[t])^3) G'[t])/1125)-((2039296 ((H[t])^4) G'[t])/1125)-((40828928 ((G[t])^2) ((G'[t])^2))/3375)+((85867264 G[t] H[t] ((G'[t])^2))/3375)+(682752/125) ((H[t])^2) ((G'[t])^2)-((535808 ((G'[t])^3))/1125)+(1421056/125) ((G[t])^4) H'[t]-((15898624 ((G[t])^3) H[t] H'[t])/1125)-(4410112/125) ((G[t])^2) ((H[t])^2) H'[t]+((37284352 G[t] ((H[t])^3) H'[t])/1125)+(612864/125) ((H[t])^4) H'[t]+((25905152 ((G[t])^2) G'[t] H'[t])/1125)-((141772288 G[t] H[t] G'[t] H'[t])/3375)-((20962816 ((H[t])^2) G'[t] H'[t])/1125)+((10341632 ((G'[t])^2) H'[t])/3375)-((36886528 ((G[t])^2) ((H'[t])^2))/3375)+((18635008 G[t] H[t] ((H'[t])^2))/1125)+((14818048 ((H[t])^2) ((H'[t])^2))/1125)-((15860992 G'[t] ((H'[t])^2))/3375)+((7126784 ((H'[t])^3))/3375)-(1383424/675) ((G[t])^3) G''[t]+(3361792/675) ((G[t])^2) H[t] G''[t]-(121856/225) G[t] ((H[t])^2) G''[t]-(7168/3) ((H[t])^3) G''[t]-(1447936/675) G[t] G'[t] G''[t]+(243712/45) H[t] G'[t] G''[t]+(1447936/675) G[t] H'[t] G''[t]-(243712/45) H[t] H'[t] G''[t]+(1383424/675) ((G[t])^3) H''[t]-(3361792/675) ((G[t])^2) H[t] H''[t]+(121856/225) G[t] ((H[t])^2) H''[t]+(7168/3) ((H[t])^3) H''[t]+(1447936/675) G[t] G'[t] H''[t]-(243712/45) H[t] G'[t] H''[t]-(1447936/675) G[t] H'[t] H''[t]+(243712/45) H[t] H'[t] H''[t])(hc[t] hc'[t]+hp[t] hp'[t]),t]-D[  ((a[t])^3) ((b[t])^7)(-((17959424 ((G[t])^6) H[t])/1125)+((85958656 ((G[t])^5) ((H[t])^2))/1125)-(57042944/375) ((G[t])^4) ((H[t])^3)+((179228672 ((G[t])^3) ((H[t])^4))/1125)-((101108224 ((G[t])^2) ((H[t])^5))/1125)+(9003008/375) G[t] ((H[t])^6)-((222208 ((H[t])^7))/125)-((53731328 ((G[t])^5) G'[t])/3375)+((164734976 ((G[t])^4) H[t] G'[t])/3375)-((206682112 ((G[t])^3) ((H[t])^2) G'[t])/3375)+(960512/27) ((G[t])^2) ((H[t])^3) G'[t]-((3454976 G[t] ((H[t])^4) G'[t])/1125)-((4673536 ((H[t])^5) G'[t])/1125)-((31811584 ((G[t])^3) ((G'[t])^2))/3375)+((8820224 ((G[t])^2) H[t] ((G'[t])^2))/1125)-((11260928 G[t] ((H[t])^2) ((G'[t])^2))/3375)+(369152/75) ((H[t])^3) ((G'[t])^2)-((16099328 G[t] ((G'[t])^3))/3375)-((3454976 H[t] ((G'[t])^3))/3375)+((47014912 ((G[t])^5) H'[t])/3375)-((135747584 ((G[t])^4) H[t] H'[t])/3375)+((153008128 ((G[t])^3) ((H[t])^2) H'[t])/3375)-(487424/25) ((G[t])^2) ((H[t])^3) H'[t]-((6501376 G[t] ((H[t])^4) H'[t])/1125)+(2336768/375) ((H[t])^5) H'[t]+(437248/25) ((G[t])^3) G'[t] H'[t]-((48914432 ((G[t])^2) H[t] G'[t] H'[t])/3375)+((28292096 G[t] ((H[t])^2) G'[t] H'[t])/3375)-((12802048 ((H[t])^3) G'[t] H'[t])/1125)+((43409408 G[t] ((G'[t])^2) H'[t])/3375)+((15253504 H[t] ((G'[t])^2) H'[t])/3375)-((27216896 ((G[t])^3) ((H'[t])^2))/3375)+(4490752/675) ((G[t])^2) H[t] ((H'[t])^2)-(630784/125) G[t] ((H[t])^2) ((H'[t])^2)+((7264768 ((H[t])^3) ((H'[t])^2))/1125)-((38520832 G[t] G'[t] ((H'[t])^2))/3375)-(4028416/675) H[t] G'[t] ((H'[t])^2)+((11210752 G[t] ((H'[t])^3))/3375)+((2781184 H[t] ((H'[t])^3))/1125)-((6716416 ((G[t])^4) G''[t])/3375)+((22270976 ((G[t])^3) H[t] G''[t])/3375)-((31403008 ((G[t])^2) ((H[t])^2) G''[t])/3375)+((7619584 G[t] ((H[t])^3) G''[t])/1125)-((2336768 ((H[t])^4) G''[t])/1125)-((4594688 ((G[t])^2) G'[t] G''[t])/3375)-((587776 G[t] H[t] G'[t] G''[t])/3375)+((1727488 ((H[t])^2) G'[t] G''[t])/1125)-((4888576 ((G'[t])^2) G''[t])/3375)+((4594688 ((G[t])^2) H'[t] G''[t])/3375)+((587776 G[t] H[t] H'[t] G''[t])/3375)-((1727488 ((H[t])^2) H'[t] G''[t])/1125)+((9777152 G'[t] H'[t] G''[t])/3375)-((4888576 ((H'[t])^2) G''[t])/3375)+((6716416 ((G[t])^4) H''[t])/3375)-((22270976 ((G[t])^3) H[t] H''[t])/3375)+((31403008 ((G[t])^2) ((H[t])^2) H''[t])/3375)-((7619584 G[t] ((H[t])^3) H''[t])/1125)+((2336768 ((H[t])^4) H''[t])/1125)+((4594688 ((G[t])^2) G'[t] H''[t])/3375)+((587776 G[t] H[t] G'[t] H''[t])/3375)-((1727488 ((H[t])^2) G'[t] H''[t])/1125)+((4888576 ((G'[t])^2) H''[t])/3375)-((4594688 ((G[t])^2) H'[t] H''[t])/3375)-((587776 G[t] H[t] H'[t] H''[t])/3375)+((1727488 ((H[t])^2) H'[t] H''[t])/1125)-((9777152 G'[t] H'[t] H''[t])/3375)+((4888576 ((H'[t])^2) H''[t])/3375))(1/2)((hp[t])^2),t]-D[(k^2) a[t] ((b[t])^7)  (-(132608/675) ((G[t])^4)-(422912/675) ((G[t])^3) H[t]+(1716736/675) ((G[t])^2) ((H[t])^2)-(544768/225) G[t] ((H[t])^3)+((157696 ((H[t])^4))/225)-(953344/675) ((G[t])^2) G'[t]+(1211392/675) G[t] H[t] G'[t]-(28672/75) ((H[t])^2) G'[t]-(347648/675) ((G'[t])^2)+(953344/675) ((G[t])^2) H'[t]-(1211392/675) G[t] H[t] H'[t]+(28672/75) ((H[t])^2) H'[t]+(695296/675) G'[t] H'[t]-(347648/675) ((H'[t])^2))(hc[t]hc'[t] +hp[t]hp'[t]),t]-D[(k^2) a[t] ((b[t])^7)  ((5297152/675) ((G[t])^4) H[t]-(19346432/675) ((G[t])^3) ((H[t])^2)+(23597056/675) ((G[t])^2) ((H[t])^3)-(3447808/225) G[t] ((H[t])^4)+((265216 ((H[t])^5))/225)+(5791744/675) ((G[t])^3) G'[t]-(16586752/675) ((G[t])^2) H[t] G'[t]+(3239936/225) G[t] ((H[t])^2) G'[t]+(14336/9) ((H[t])^3) G'[t]-(1777664/675) G[t] ((G'[t])^2)-(1641472/675) H[t] ((G'[t])^2)-(5067776/675) ((G[t])^3) H'[t]+(910336/45) ((G[t])^2) H[t] H'[t]-(6028288/675) G[t] ((H[t])^2) H'[t]-(852992/225) ((H[t])^3) H'[t]+(186368/45) G[t] G'[t] H'[t]+(1347584/225) H[t] G'[t] H'[t]-(1017856/675) G[t] ((H'[t])^2)-(480256/135) H[t] ((H'[t])^2)+(723968/675) ((G[t])^2) G''[t]-(2207744/675) G[t] H[t] G''[t]+(164864/75) ((H[t])^2) G''[t]-(759808/675) G'[t] G''[t]+(759808/675) H'[t] G''[t]-(723968/675) ((G[t])^2) H''[t]+(2207744/675) G[t] H[t] H''[t]-(164864/75) ((H[t])^2) H''[t]+(759808/675) G'[t] H''[t]-(759808/675) H'[t] H''[t])(1/2)(((hc[t])^2)+((hp[t])^2)),t] //. rep1],rep3]

S13 /. {hp[t]->0,hp'[t]->0,hp''[t]->0}

S14=Collect[Simplify[Expand[S13 /. {hp[t]->0,hp'[t]->0,hp''[t]->0} /. {Derivative[4][H][t]->(3/2) (((1-(Sqrt[21])))^4) ((H[t])^5),Derivative[3][H][t]->(3/4) (((1-(Sqrt[21])))^3) ((H[t])^4),H''[t]->(1/2) (((1-(Sqrt[21])))^2) ((H[t])^3),H'[t]-> ((1-(Sqrt[21]))/2)((H[t])^2),Derivative[4][G][t]->(3/28) (((1-(Sqrt[21])))^4) (-7+(Sqrt[21])) ((H[t])^5),Derivative[3][G][t]->(3/56) (((1-(Sqrt[21])))^3) (-7+(Sqrt[21])) ((H[t])^4),G''[t]->(1/28) (((1-(Sqrt[21])))^2) (-7+(Sqrt[21])) ((H[t])^3),G'[t]->(1/28) (1-(Sqrt[21])) (-7+(Sqrt[21])) ((H[t])^2),G[t]->((-7+(Sqrt[21]))/14)H[t]}]],rep3] (* hc only *)

S23=Collect[Simplify[Expand[S12 /. {Derivative[4][H][t]->(3/2) (((1-(Sqrt[21])))^4) ((H[t])^5),Derivative[3][H][t]->(3/4) (((1-(Sqrt[21])))^3) ((H[t])^4),H''[t]->(1/2) (((1-(Sqrt[21])))^2) ((H[t])^3),H'[t]-> ((1-(Sqrt[21]))/2)((H[t])^2),Derivative[4][G][t]->(3/28) (((1-(Sqrt[21])))^4) (-7+(Sqrt[21])) ((H[t])^5),Derivative[3][G][t]->(3/56) (((1-(Sqrt[21])))^3) (-7+(Sqrt[21])) ((H[t])^4),G''[t]->(1/28) (((1-(Sqrt[21])))^2) (-7+(Sqrt[21])) ((H[t])^3),G'[t]->(1/28) (1-(Sqrt[21])) (-7+(Sqrt[21])) ((H[t])^2),G[t]->((-7+(Sqrt[21]))/14)H[t]}]],rep3]

S24=Collect[Simplify[Expand[S23-D[(k^2) a[t] ((b[t])^7) ( (1024/7) (-303+59 (Sqrt[21])) ((H[t])^5) ((hc[t])^2)-(256/7) (-43+25 (Sqrt[21])) ((H[t])^4) hc[t] hc'[t]+(1024/7) (-303+59 (Sqrt[21])) ((H[t])^5) ((hp[t])^2)-(256/7) (-43+25 (Sqrt[21])) ((H[t])^4) hp[t] hp'[t]),t]-D[((a[t])^3) ((b[t])^7) (-((128*8)/7)  (-101+20 (Sqrt[21]))((H[t])^4)  hc[t] Derivative[3][hc][t]-((128*4)/49) (-14105+3097 (Sqrt[21]))((H[t])^5) hc[t] Derivative[2][hc][t]+((8*128)/7) (-101+20 (Sqrt[21]))((H[t])^4) hc'[t] Derivative[2][hc][t]+((128*8)/49)(-791+139 (Sqrt[21])) ((H[t])^5) ((hc'[t])^2) -(1152/245) (-65091+16561 (Sqrt[21]))((H[t])^6) hc[t] hc'[t]-((128*8)/7)  (-101+20 (Sqrt[21]))((H[t])^4)  hp[t] Derivative[3][hp][t]-((128*4)/49) (-14105+3097 (Sqrt[21]))((H[t])^5) hp[t] Derivative[2][hp][t]+((8*128)/7) (-101+20 (Sqrt[21]))((H[t])^4) hp'[t] Derivative[2][hp][t]+((128*8)/49)(-791+139 (Sqrt[21])) ((H[t])^5) ((hp'[t])^2)-(1152/245) (-65091+16561 (Sqrt[21]))((H[t])^6) hp[t] hp'[t]-(10368/49) (-1699+347 (Sqrt[21])) ((H[t])^7) ((hp[t])^2) ),t] //. {a'[t]->a[t]H[t],b'[t]->b[t]G[t],H'[t]-> ((1-(Sqrt[21]))/2)((H[t])^2),H''[t]->(1/2) (((1-(Sqrt[21])))^2) ((H[t])^3),G[t]->((-7+(Sqrt[21]))/14)H[t]}]],rep3]

Expand[S14-S24 /. {hp[t]->0,hp'[t]->0,hp''[t]->0}] (* check hc, hp is different *)

S25=S24 /. {H[t]->H0[t],hp[t]->hp0[t],hp'[t]->hp0'[t],hp''[t]->hp0''[t],hc[t]->hc0[t],hc'[t]->hc0'[t],hc''[t]->hc0''[t]}

(* Expand S4 up to O((Γ^2)) *)

hp[t_]:=hp0[t]+Γ hp1[t];
hc[t_]:=hc0[t]+Γ hc1[t];
H[t_]:=H0[t]+Γ H1[t];
G[t_]:=G0[t]+Γ G1[t];

solsugra={Derivative[4][H0][t]->(3/2) (((1-(Sqrt[21])))^4) ((H0[t])^5),Derivative[3][H0][t]->(3/4) (((1-(Sqrt[21])))^3) ((H0[t])^4),H0''[t]->(1/2) (((1-(Sqrt[21])))^2) ((H0[t])^3),H0'[t]-> ((1-(Sqrt[21]))/2)((H0[t])^2),Derivative[4][G0][t]->(3/28) (((1-(Sqrt[21])))^4) (-7+(Sqrt[21])) ((H0[t])^5),Derivative[3][G0][t]->(3/56) (((1-(Sqrt[21])))^3) (-7+(Sqrt[21])) ((H0[t])^4),G0''[t]->(1/28) (((1-(Sqrt[21])))^2) (-7+(Sqrt[21])) ((H0[t])^3),G0'[t]->(1/28) (1-(Sqrt[21])) (-7+(Sqrt[21])) ((H0[t])^2),G0[t]->((-7+(Sqrt[21]))/14)H0[t]};

S5=Collect[Normal[Series[Expand[S4 //. solsugra],{Γ,0,1}]],rep3]

(* eq. (53) *)

S6=Collect[FullSimplify[S5 /. {Γ->0}],{k,a[t],b[t]}]

S7=Collect[Simplify[D[S5,Γ]],rep3]

rep5={H1''[t]-> (((((-1+(Sqrt[21]))/2)))^2)(56 ((13824 (477087-97732 (Sqrt[21])))/(8575 )))((H0[t])^9),G1''[t]->((-7+(Sqrt[21]))/14)(((((-1+(Sqrt[21]))/2)))^2)(56 ((20736 (200843-34423 (Sqrt[21])))/(8575 )))((H0[t])^9),H1'[t]-> ((-1+(Sqrt[21]))/2)(-7 ((13824 (477087-97732 (Sqrt[21])))/(8575 )))((H0[t])^8),G1'[t]->((-7+(Sqrt[21]))/14)((-1+(Sqrt[21]))/2)(-7 ((20736 (200843-34423 (Sqrt[21])))/(8575 )))((H0[t])^8),H1[t]-> ((13824 (477087-97732 (Sqrt[21])))/8575)((H0[t])^7),G1[t]->((-7+(Sqrt[21]))/14)( ((20736 (200843-34423 (Sqrt[21])))/(8575 )))((H0[t])^7)};

S8=Collect[Simplify[Expand[S7 //. rep5]],rep3]

(* S8 + S15 *)

S30=Collect[Simplify[Expand[S8+S25]],rep3]