Left Termination of the query pattern flat(f,b) w.r.t. the given Prolog program could not be shown:



PROLOG
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof

right2(tree3(X, XS1, XS2), XS2).
flat2(niltree0, nil0).
flat2(tree3(X, niltree0, XS), cons2(X, YS)) :- right2(tree3(X, niltree0, XS), ZS), flat2(ZS, YS).
flat2(tree3(X, tree3(Y, YS1, YS2), XS), ZS) :- flat2(tree3(Y, YS1, tree3(X, YS2, XS)), ZS).


With regard to the inferred argument filtering the predicates were used in the following modes:
flat2: (f,b) (b,b)
Transforming PROLOG into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:


flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag1(x1)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag2(x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag1(x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag1(x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg2(x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg1(x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg1(x7)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of PROLOG



↳ PROLOG
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof
  ↳ PrologToPiTRSProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag1(x1)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag2(x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag1(x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag1(x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg2(x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg1(x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg1(x7)


Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_AG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_AG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_GG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_GG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag1(x1)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag2(x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag1(x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag1(x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg2(x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg1(x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg1(x7)
IF_FLAT_2_IN_3_GG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_GG1(x7)
IF_FLAT_2_IN_3_AG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_AG1(x7)
IF_FLAT_2_IN_2_AG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_AG1(x5)
IF_FLAT_2_IN_2_GG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_GG1(x5)
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG2(x3, x4)
RIGHT_2_IN_GA2(x1, x2)  =  RIGHT_2_IN_GA1(x1)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG2(x3, x4)

We have to consider all (P,R,Pi)-chains

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_AG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_AG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_GG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_GG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag1(x1)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag2(x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag1(x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag1(x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg2(x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg1(x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg1(x7)
IF_FLAT_2_IN_3_GG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_GG1(x7)
IF_FLAT_2_IN_3_AG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_AG1(x7)
IF_FLAT_2_IN_2_AG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_AG1(x5)
IF_FLAT_2_IN_2_GG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_GG1(x5)
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG2(x3, x4)
RIGHT_2_IN_GA2(x1, x2)  =  RIGHT_2_IN_GA1(x1)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG2(x3, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph contains 1 SCC with 6 less nodes.

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
PiDP
              ↳ UsableRulesProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag1(x1)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag2(x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag1(x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag1(x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg2(x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg1(x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg1(x7)
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG2(x3, x4)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG2(x3, x4)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting we can delete all non-usable rules from R.

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
PiDP
                  ↳ PiDPToQDPProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)

The argument filtering Pi contains the following mapping:
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
cons_22(x1, x2)  =  cons_22(x1, x2)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG2(x3, x4)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG2(x3, x4)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem into ordinary QDP problem by application of Pi.

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
                ↳ PiDP
                  ↳ PiDPToQDPProof
QDP
                      ↳ RuleRemovalProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_GG2(tree_3, cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG2(YS, right_2_in_ga1(tree_3))
FLAT_2_IN_AG1(cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG2(YS, right_2_in_ga1(tree_3))
IF_FLAT_2_IN_1_AG2(YS, right_2_out_ga) -> FLAT_2_IN_AG1(YS)
FLAT_2_IN_GG2(tree_3, ZS) -> FLAT_2_IN_GG2(tree_3, ZS)
IF_FLAT_2_IN_1_GG2(YS, right_2_out_ga) -> FLAT_2_IN_AG1(YS)
FLAT_2_IN_AG1(ZS) -> FLAT_2_IN_GG2(tree_3, ZS)

The TRS R consists of the following rules:

right_2_in_ga1(tree_3) -> right_2_out_ga

The set Q consists of the following terms:

right_2_in_ga1(x0)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {IF_FLAT_2_IN_1_GG2, FLAT_2_IN_GG2, IF_FLAT_2_IN_1_AG2, FLAT_2_IN_AG1}.
By using a polynomial ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.

Strictly oriented rules of the TRS R:

right_2_in_ga1(tree_3) -> right_2_out_ga

Used ordering: POLO with Polynomial interpretation:

POL(FLAT_2_IN_AG1(x1)) = 1 + x1   
POL(FLAT_2_IN_GG2(x1, x2)) = x1 + x2   
POL(IF_FLAT_2_IN_1_GG2(x1, x2)) = x1 + x2   
POL(tree_3) = 1   
POL(IF_FLAT_2_IN_1_AG2(x1, x2)) = x1 + x2   
POL(right_2_in_ga1(x1)) = 2·x1   
POL(right_2_out_ga) = 1   
POL(cons_22(x1, x2)) = 1 + x1 + x2   



↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
                ↳ PiDP
                  ↳ PiDPToQDPProof
                    ↳ QDP
                      ↳ RuleRemovalProof
QDP
                          ↳ DependencyGraphProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_GG2(tree_3, cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG2(YS, right_2_in_ga1(tree_3))
FLAT_2_IN_AG1(cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG2(YS, right_2_in_ga1(tree_3))
IF_FLAT_2_IN_1_AG2(YS, right_2_out_ga) -> FLAT_2_IN_AG1(YS)
FLAT_2_IN_GG2(tree_3, ZS) -> FLAT_2_IN_GG2(tree_3, ZS)
IF_FLAT_2_IN_1_GG2(YS, right_2_out_ga) -> FLAT_2_IN_AG1(YS)
FLAT_2_IN_AG1(ZS) -> FLAT_2_IN_GG2(tree_3, ZS)

R is empty.
The set Q consists of the following terms:

right_2_in_ga1(x0)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {IF_FLAT_2_IN_1_GG2, FLAT_2_IN_GG2, IF_FLAT_2_IN_1_AG2, FLAT_2_IN_AG1}.
The approximation of the Dependency Graph contains 1 SCC with 5 less nodes.

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
                ↳ PiDP
                  ↳ PiDPToQDPProof
                    ↳ QDP
                      ↳ RuleRemovalProof
                        ↳ QDP
                          ↳ DependencyGraphProof
QDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_GG2(tree_3, ZS) -> FLAT_2_IN_GG2(tree_3, ZS)

R is empty.
The set Q consists of the following terms:

right_2_in_ga1(x0)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {FLAT_2_IN_GG2}.
With regard to the inferred argument filtering the predicates were used in the following modes:
flat2: (f,b) (b,b)
Transforming PROLOG into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag2(x1, x2)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag3(x1, x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga1(x1)
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag3(x1, x3, x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag2(x6, x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg2(x1, x2)
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg3(x1, x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg3(x1, x3, x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg2(x6, x7)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of PROLOG



↳ PROLOG
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag2(x1, x2)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag3(x1, x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga1(x1)
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag3(x1, x3, x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag2(x6, x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg2(x1, x2)
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg3(x1, x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg3(x1, x3, x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg2(x6, x7)


Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_AG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_AG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_GG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_GG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag2(x1, x2)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag3(x1, x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga1(x1)
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag3(x1, x3, x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag2(x6, x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg2(x1, x2)
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg3(x1, x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg3(x1, x3, x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg2(x6, x7)
IF_FLAT_2_IN_3_GG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_GG2(x6, x7)
IF_FLAT_2_IN_3_AG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_AG2(x6, x7)
IF_FLAT_2_IN_2_AG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_AG3(x1, x3, x5)
IF_FLAT_2_IN_2_GG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_GG3(x1, x3, x5)
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG3(x1, x3, x4)
RIGHT_2_IN_GA2(x1, x2)  =  RIGHT_2_IN_GA1(x1)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG3(x1, x3, x4)

We have to consider all (P,R,Pi)-chains

↳ PROLOG
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_AG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_AG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> RIGHT_2_IN_GA2(tree_33(X, niltree_0, XS), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> IF_FLAT_2_IN_2_GG5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> IF_FLAT_2_IN_3_GG7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag2(x1, x2)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag3(x1, x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga1(x1)
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag3(x1, x3, x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag2(x6, x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg2(x1, x2)
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg3(x1, x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg3(x1, x3, x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg2(x6, x7)
IF_FLAT_2_IN_3_GG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_GG2(x6, x7)
IF_FLAT_2_IN_3_AG7(x1, x2, x3, x4, x5, x6, x7)  =  IF_FLAT_2_IN_3_AG2(x6, x7)
IF_FLAT_2_IN_2_AG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_AG3(x1, x3, x5)
IF_FLAT_2_IN_2_GG5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_GG3(x1, x3, x5)
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG3(x1, x3, x4)
RIGHT_2_IN_GA2(x1, x2)  =  RIGHT_2_IN_GA1(x1)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG3(x1, x3, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph contains 1 SCC with 6 less nodes.

↳ PROLOG
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
PiDP
              ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

flat_2_in_ag2(niltree_0, nil_0) -> flat_2_out_ag2(niltree_0, nil_0)
flat_2_in_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_ag4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)
if_flat_2_in_1_ag4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
flat_2_in_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
flat_2_in_gg2(niltree_0, nil_0) -> flat_2_out_gg2(niltree_0, nil_0)
flat_2_in_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> if_flat_2_in_1_gg4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
if_flat_2_in_1_gg4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_in_ag2(ZS, YS))
if_flat_2_in_2_gg5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_gg2(tree_33(X, niltree_0, XS), cons_22(X, YS))
flat_2_in_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_in_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS))
if_flat_2_in_3_gg7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_gg2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_3_ag7(X, Y, YS1, YS2, XS, ZS, flat_2_out_gg2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)) -> flat_2_out_ag2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS)
if_flat_2_in_2_ag5(X, XS, YS, ZS, flat_2_out_ag2(ZS, YS)) -> flat_2_out_ag2(tree_33(X, niltree_0, XS), cons_22(X, YS))

The argument filtering Pi contains the following mapping:
flat_2_in_ag2(x1, x2)  =  flat_2_in_ag1(x2)
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
nil_0  =  nil_0
cons_22(x1, x2)  =  cons_22(x1, x2)
flat_2_out_ag2(x1, x2)  =  flat_2_out_ag2(x1, x2)
if_flat_2_in_1_ag4(x1, x2, x3, x4)  =  if_flat_2_in_1_ag3(x1, x3, x4)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga1(x1)
if_flat_2_in_2_ag5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ag3(x1, x3, x5)
if_flat_2_in_3_ag7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_ag2(x6, x7)
flat_2_in_gg2(x1, x2)  =  flat_2_in_gg2(x1, x2)
flat_2_out_gg2(x1, x2)  =  flat_2_out_gg2(x1, x2)
if_flat_2_in_1_gg4(x1, x2, x3, x4)  =  if_flat_2_in_1_gg3(x1, x3, x4)
if_flat_2_in_2_gg5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_gg3(x1, x3, x5)
if_flat_2_in_3_gg7(x1, x2, x3, x4, x5, x6, x7)  =  if_flat_2_in_3_gg2(x6, x7)
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG3(x1, x3, x4)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG3(x1, x3, x4)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting we can delete all non-usable rules from R.

↳ PROLOG
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
PiDP

Pi DP problem:
The TRS P consists of the following rules:

FLAT_2_IN_GG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
FLAT_2_IN_AG2(tree_33(X, niltree_0, XS), cons_22(X, YS)) -> IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_in_ga2(tree_33(X, niltree_0, XS), ZS))
IF_FLAT_2_IN_1_AG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_GG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)
IF_FLAT_2_IN_1_GG4(X, XS, YS, right_2_out_ga2(tree_33(X, niltree_0, XS), ZS)) -> FLAT_2_IN_AG2(ZS, YS)
FLAT_2_IN_AG2(tree_33(X, tree_33(Y, YS1, YS2), XS), ZS) -> FLAT_2_IN_GG2(tree_33(Y, YS1, tree_33(X, YS2, XS)), ZS)

The TRS R consists of the following rules:

right_2_in_ga2(tree_33(X, XS1, XS2), XS2) -> right_2_out_ga2(tree_33(X, XS1, XS2), XS2)

The argument filtering Pi contains the following mapping:
tree_33(x1, x2, x3)  =  tree_3
niltree_0  =  niltree_0
cons_22(x1, x2)  =  cons_22(x1, x2)
right_2_in_ga2(x1, x2)  =  right_2_in_ga1(x1)
right_2_out_ga2(x1, x2)  =  right_2_out_ga1(x1)
FLAT_2_IN_GG2(x1, x2)  =  FLAT_2_IN_GG2(x1, x2)
IF_FLAT_2_IN_1_GG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_GG3(x1, x3, x4)
FLAT_2_IN_AG2(x1, x2)  =  FLAT_2_IN_AG1(x2)
IF_FLAT_2_IN_1_AG4(x1, x2, x3, x4)  =  IF_FLAT_2_IN_1_AG3(x1, x3, x4)

We have to consider all (P,R,Pi)-chains