Left Termination of the query pattern count(b,f) w.r.t. the given Prolog program could successfully be proven:



PROLOG
  ↳ PrologToPiTRSProof

flatten2(atom1(X), .2(X, {}0)).
flatten2(cons2(atom1(X), U), .2(X, Y)) :- flatten2(U, Y).
flatten2(cons2(cons2(U, V), W), X) :- flatten2(cons2(U, cons2(V, W)), X).
count2(atom1(X), s1(00)).
count2(cons2(atom1(X), Y), s1(Z)) :- count2(Y, Z).
count2(cons2(cons2(U, V), W), Z) :- flatten2(cons2(cons2(U, V), W), X), count2(X, Z).


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


count_2_in_ga2(atom_11(X), s_11(0_0)) -> count_2_out_ga2(atom_11(X), s_11(0_0))
count_2_in_ga2(cons_22(atom_11(X), Y), s_11(Z)) -> if_count_2_in_1_ga4(X, Y, Z, count_2_in_ga2(Y, Z))
count_2_in_ga2(cons_22(cons_22(U, V), W), Z) -> if_count_2_in_2_ga5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
flatten_2_in_ga2(atom_11(X), ._22(X, []_0)) -> flatten_2_out_ga2(atom_11(X), ._22(X, []_0))
flatten_2_in_ga2(cons_22(atom_11(X), U), ._22(X, Y)) -> if_flatten_2_in_1_ga4(X, U, Y, flatten_2_in_ga2(U, Y))
flatten_2_in_ga2(cons_22(cons_22(U, V), W), X) -> if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_out_ga2(cons_22(U, cons_22(V, W)), X)) -> flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)
if_flatten_2_in_1_ga4(X, U, Y, flatten_2_out_ga2(U, Y)) -> flatten_2_out_ga2(cons_22(atom_11(X), U), ._22(X, Y))
if_count_2_in_2_ga5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> if_count_2_in_3_ga6(U, V, W, Z, X, count_2_in_ga2(X, Z))
if_count_2_in_3_ga6(U, V, W, Z, X, count_2_out_ga2(X, Z)) -> count_2_out_ga2(cons_22(cons_22(U, V), W), Z)
if_count_2_in_1_ga4(X, Y, Z, count_2_out_ga2(Y, Z)) -> count_2_out_ga2(cons_22(atom_11(X), Y), s_11(Z))

The argument filtering Pi contains the following mapping:
count_2_in_ga2(x1, x2)  =  count_2_in_ga1(x1)
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
[]_0  =  []_0
cons_22(x1, x2)  =  cons_22(x1, x2)
s_11(x1)  =  s_11(x1)
0_0  =  0_0
count_2_out_ga2(x1, x2)  =  count_2_out_ga1(x2)
if_count_2_in_1_ga4(x1, x2, x3, x4)  =  if_count_2_in_1_ga1(x4)
if_count_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_count_2_in_2_ga1(x5)
flatten_2_in_ga2(x1, x2)  =  flatten_2_in_ga1(x1)
flatten_2_out_ga2(x1, x2)  =  flatten_2_out_ga1(x2)
if_flatten_2_in_1_ga4(x1, x2, x3, x4)  =  if_flatten_2_in_1_ga2(x1, x4)
if_flatten_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flatten_2_in_2_ga1(x5)
if_count_2_in_3_ga6(x1, x2, x3, x4, x5, x6)  =  if_count_2_in_3_ga1(x6)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of PROLOG



↳ PROLOG
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

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

count_2_in_ga2(atom_11(X), s_11(0_0)) -> count_2_out_ga2(atom_11(X), s_11(0_0))
count_2_in_ga2(cons_22(atom_11(X), Y), s_11(Z)) -> if_count_2_in_1_ga4(X, Y, Z, count_2_in_ga2(Y, Z))
count_2_in_ga2(cons_22(cons_22(U, V), W), Z) -> if_count_2_in_2_ga5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
flatten_2_in_ga2(atom_11(X), ._22(X, []_0)) -> flatten_2_out_ga2(atom_11(X), ._22(X, []_0))
flatten_2_in_ga2(cons_22(atom_11(X), U), ._22(X, Y)) -> if_flatten_2_in_1_ga4(X, U, Y, flatten_2_in_ga2(U, Y))
flatten_2_in_ga2(cons_22(cons_22(U, V), W), X) -> if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_out_ga2(cons_22(U, cons_22(V, W)), X)) -> flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)
if_flatten_2_in_1_ga4(X, U, Y, flatten_2_out_ga2(U, Y)) -> flatten_2_out_ga2(cons_22(atom_11(X), U), ._22(X, Y))
if_count_2_in_2_ga5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> if_count_2_in_3_ga6(U, V, W, Z, X, count_2_in_ga2(X, Z))
if_count_2_in_3_ga6(U, V, W, Z, X, count_2_out_ga2(X, Z)) -> count_2_out_ga2(cons_22(cons_22(U, V), W), Z)
if_count_2_in_1_ga4(X, Y, Z, count_2_out_ga2(Y, Z)) -> count_2_out_ga2(cons_22(atom_11(X), Y), s_11(Z))

The argument filtering Pi contains the following mapping:
count_2_in_ga2(x1, x2)  =  count_2_in_ga1(x1)
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
[]_0  =  []_0
cons_22(x1, x2)  =  cons_22(x1, x2)
s_11(x1)  =  s_11(x1)
0_0  =  0_0
count_2_out_ga2(x1, x2)  =  count_2_out_ga1(x2)
if_count_2_in_1_ga4(x1, x2, x3, x4)  =  if_count_2_in_1_ga1(x4)
if_count_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_count_2_in_2_ga1(x5)
flatten_2_in_ga2(x1, x2)  =  flatten_2_in_ga1(x1)
flatten_2_out_ga2(x1, x2)  =  flatten_2_out_ga1(x2)
if_flatten_2_in_1_ga4(x1, x2, x3, x4)  =  if_flatten_2_in_1_ga2(x1, x4)
if_flatten_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flatten_2_in_2_ga1(x5)
if_count_2_in_3_ga6(x1, x2, x3, x4, x5, x6)  =  if_count_2_in_3_ga1(x6)


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

COUNT_2_IN_GA2(cons_22(atom_11(X), Y), s_11(Z)) -> IF_COUNT_2_IN_1_GA4(X, Y, Z, count_2_in_ga2(Y, Z))
COUNT_2_IN_GA2(cons_22(atom_11(X), Y), s_11(Z)) -> COUNT_2_IN_GA2(Y, Z)
COUNT_2_IN_GA2(cons_22(cons_22(U, V), W), Z) -> IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
COUNT_2_IN_GA2(cons_22(cons_22(U, V), W), Z) -> FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X)
FLATTEN_2_IN_GA2(cons_22(atom_11(X), U), ._22(X, Y)) -> IF_FLATTEN_2_IN_1_GA4(X, U, Y, flatten_2_in_ga2(U, Y))
FLATTEN_2_IN_GA2(cons_22(atom_11(X), U), ._22(X, Y)) -> FLATTEN_2_IN_GA2(U, Y)
FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X) -> IF_FLATTEN_2_IN_2_GA5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X) -> FLATTEN_2_IN_GA2(cons_22(U, cons_22(V, W)), X)
IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> IF_COUNT_2_IN_3_GA6(U, V, W, Z, X, count_2_in_ga2(X, Z))
IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> COUNT_2_IN_GA2(X, Z)

The TRS R consists of the following rules:

count_2_in_ga2(atom_11(X), s_11(0_0)) -> count_2_out_ga2(atom_11(X), s_11(0_0))
count_2_in_ga2(cons_22(atom_11(X), Y), s_11(Z)) -> if_count_2_in_1_ga4(X, Y, Z, count_2_in_ga2(Y, Z))
count_2_in_ga2(cons_22(cons_22(U, V), W), Z) -> if_count_2_in_2_ga5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
flatten_2_in_ga2(atom_11(X), ._22(X, []_0)) -> flatten_2_out_ga2(atom_11(X), ._22(X, []_0))
flatten_2_in_ga2(cons_22(atom_11(X), U), ._22(X, Y)) -> if_flatten_2_in_1_ga4(X, U, Y, flatten_2_in_ga2(U, Y))
flatten_2_in_ga2(cons_22(cons_22(U, V), W), X) -> if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_out_ga2(cons_22(U, cons_22(V, W)), X)) -> flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)
if_flatten_2_in_1_ga4(X, U, Y, flatten_2_out_ga2(U, Y)) -> flatten_2_out_ga2(cons_22(atom_11(X), U), ._22(X, Y))
if_count_2_in_2_ga5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> if_count_2_in_3_ga6(U, V, W, Z, X, count_2_in_ga2(X, Z))
if_count_2_in_3_ga6(U, V, W, Z, X, count_2_out_ga2(X, Z)) -> count_2_out_ga2(cons_22(cons_22(U, V), W), Z)
if_count_2_in_1_ga4(X, Y, Z, count_2_out_ga2(Y, Z)) -> count_2_out_ga2(cons_22(atom_11(X), Y), s_11(Z))

The argument filtering Pi contains the following mapping:
count_2_in_ga2(x1, x2)  =  count_2_in_ga1(x1)
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
[]_0  =  []_0
cons_22(x1, x2)  =  cons_22(x1, x2)
s_11(x1)  =  s_11(x1)
0_0  =  0_0
count_2_out_ga2(x1, x2)  =  count_2_out_ga1(x2)
if_count_2_in_1_ga4(x1, x2, x3, x4)  =  if_count_2_in_1_ga1(x4)
if_count_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_count_2_in_2_ga1(x5)
flatten_2_in_ga2(x1, x2)  =  flatten_2_in_ga1(x1)
flatten_2_out_ga2(x1, x2)  =  flatten_2_out_ga1(x2)
if_flatten_2_in_1_ga4(x1, x2, x3, x4)  =  if_flatten_2_in_1_ga2(x1, x4)
if_flatten_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flatten_2_in_2_ga1(x5)
if_count_2_in_3_ga6(x1, x2, x3, x4, x5, x6)  =  if_count_2_in_3_ga1(x6)
FLATTEN_2_IN_GA2(x1, x2)  =  FLATTEN_2_IN_GA1(x1)
IF_FLATTEN_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_FLATTEN_2_IN_2_GA1(x5)
IF_COUNT_2_IN_1_GA4(x1, x2, x3, x4)  =  IF_COUNT_2_IN_1_GA1(x4)
IF_FLATTEN_2_IN_1_GA4(x1, x2, x3, x4)  =  IF_FLATTEN_2_IN_1_GA2(x1, x4)
COUNT_2_IN_GA2(x1, x2)  =  COUNT_2_IN_GA1(x1)
IF_COUNT_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_COUNT_2_IN_2_GA1(x5)
IF_COUNT_2_IN_3_GA6(x1, x2, x3, x4, x5, x6)  =  IF_COUNT_2_IN_3_GA1(x6)

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

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

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

COUNT_2_IN_GA2(cons_22(atom_11(X), Y), s_11(Z)) -> IF_COUNT_2_IN_1_GA4(X, Y, Z, count_2_in_ga2(Y, Z))
COUNT_2_IN_GA2(cons_22(atom_11(X), Y), s_11(Z)) -> COUNT_2_IN_GA2(Y, Z)
COUNT_2_IN_GA2(cons_22(cons_22(U, V), W), Z) -> IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
COUNT_2_IN_GA2(cons_22(cons_22(U, V), W), Z) -> FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X)
FLATTEN_2_IN_GA2(cons_22(atom_11(X), U), ._22(X, Y)) -> IF_FLATTEN_2_IN_1_GA4(X, U, Y, flatten_2_in_ga2(U, Y))
FLATTEN_2_IN_GA2(cons_22(atom_11(X), U), ._22(X, Y)) -> FLATTEN_2_IN_GA2(U, Y)
FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X) -> IF_FLATTEN_2_IN_2_GA5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X) -> FLATTEN_2_IN_GA2(cons_22(U, cons_22(V, W)), X)
IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> IF_COUNT_2_IN_3_GA6(U, V, W, Z, X, count_2_in_ga2(X, Z))
IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> COUNT_2_IN_GA2(X, Z)

The TRS R consists of the following rules:

count_2_in_ga2(atom_11(X), s_11(0_0)) -> count_2_out_ga2(atom_11(X), s_11(0_0))
count_2_in_ga2(cons_22(atom_11(X), Y), s_11(Z)) -> if_count_2_in_1_ga4(X, Y, Z, count_2_in_ga2(Y, Z))
count_2_in_ga2(cons_22(cons_22(U, V), W), Z) -> if_count_2_in_2_ga5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
flatten_2_in_ga2(atom_11(X), ._22(X, []_0)) -> flatten_2_out_ga2(atom_11(X), ._22(X, []_0))
flatten_2_in_ga2(cons_22(atom_11(X), U), ._22(X, Y)) -> if_flatten_2_in_1_ga4(X, U, Y, flatten_2_in_ga2(U, Y))
flatten_2_in_ga2(cons_22(cons_22(U, V), W), X) -> if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_out_ga2(cons_22(U, cons_22(V, W)), X)) -> flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)
if_flatten_2_in_1_ga4(X, U, Y, flatten_2_out_ga2(U, Y)) -> flatten_2_out_ga2(cons_22(atom_11(X), U), ._22(X, Y))
if_count_2_in_2_ga5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> if_count_2_in_3_ga6(U, V, W, Z, X, count_2_in_ga2(X, Z))
if_count_2_in_3_ga6(U, V, W, Z, X, count_2_out_ga2(X, Z)) -> count_2_out_ga2(cons_22(cons_22(U, V), W), Z)
if_count_2_in_1_ga4(X, Y, Z, count_2_out_ga2(Y, Z)) -> count_2_out_ga2(cons_22(atom_11(X), Y), s_11(Z))

The argument filtering Pi contains the following mapping:
count_2_in_ga2(x1, x2)  =  count_2_in_ga1(x1)
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
[]_0  =  []_0
cons_22(x1, x2)  =  cons_22(x1, x2)
s_11(x1)  =  s_11(x1)
0_0  =  0_0
count_2_out_ga2(x1, x2)  =  count_2_out_ga1(x2)
if_count_2_in_1_ga4(x1, x2, x3, x4)  =  if_count_2_in_1_ga1(x4)
if_count_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_count_2_in_2_ga1(x5)
flatten_2_in_ga2(x1, x2)  =  flatten_2_in_ga1(x1)
flatten_2_out_ga2(x1, x2)  =  flatten_2_out_ga1(x2)
if_flatten_2_in_1_ga4(x1, x2, x3, x4)  =  if_flatten_2_in_1_ga2(x1, x4)
if_flatten_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flatten_2_in_2_ga1(x5)
if_count_2_in_3_ga6(x1, x2, x3, x4, x5, x6)  =  if_count_2_in_3_ga1(x6)
FLATTEN_2_IN_GA2(x1, x2)  =  FLATTEN_2_IN_GA1(x1)
IF_FLATTEN_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_FLATTEN_2_IN_2_GA1(x5)
IF_COUNT_2_IN_1_GA4(x1, x2, x3, x4)  =  IF_COUNT_2_IN_1_GA1(x4)
IF_FLATTEN_2_IN_1_GA4(x1, x2, x3, x4)  =  IF_FLATTEN_2_IN_1_GA2(x1, x4)
COUNT_2_IN_GA2(x1, x2)  =  COUNT_2_IN_GA1(x1)
IF_COUNT_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_COUNT_2_IN_2_GA1(x5)
IF_COUNT_2_IN_3_GA6(x1, x2, x3, x4, x5, x6)  =  IF_COUNT_2_IN_3_GA1(x6)

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

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

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

FLATTEN_2_IN_GA2(cons_22(atom_11(X), U), ._22(X, Y)) -> FLATTEN_2_IN_GA2(U, Y)
FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X) -> FLATTEN_2_IN_GA2(cons_22(U, cons_22(V, W)), X)

The TRS R consists of the following rules:

count_2_in_ga2(atom_11(X), s_11(0_0)) -> count_2_out_ga2(atom_11(X), s_11(0_0))
count_2_in_ga2(cons_22(atom_11(X), Y), s_11(Z)) -> if_count_2_in_1_ga4(X, Y, Z, count_2_in_ga2(Y, Z))
count_2_in_ga2(cons_22(cons_22(U, V), W), Z) -> if_count_2_in_2_ga5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
flatten_2_in_ga2(atom_11(X), ._22(X, []_0)) -> flatten_2_out_ga2(atom_11(X), ._22(X, []_0))
flatten_2_in_ga2(cons_22(atom_11(X), U), ._22(X, Y)) -> if_flatten_2_in_1_ga4(X, U, Y, flatten_2_in_ga2(U, Y))
flatten_2_in_ga2(cons_22(cons_22(U, V), W), X) -> if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_out_ga2(cons_22(U, cons_22(V, W)), X)) -> flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)
if_flatten_2_in_1_ga4(X, U, Y, flatten_2_out_ga2(U, Y)) -> flatten_2_out_ga2(cons_22(atom_11(X), U), ._22(X, Y))
if_count_2_in_2_ga5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> if_count_2_in_3_ga6(U, V, W, Z, X, count_2_in_ga2(X, Z))
if_count_2_in_3_ga6(U, V, W, Z, X, count_2_out_ga2(X, Z)) -> count_2_out_ga2(cons_22(cons_22(U, V), W), Z)
if_count_2_in_1_ga4(X, Y, Z, count_2_out_ga2(Y, Z)) -> count_2_out_ga2(cons_22(atom_11(X), Y), s_11(Z))

The argument filtering Pi contains the following mapping:
count_2_in_ga2(x1, x2)  =  count_2_in_ga1(x1)
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
[]_0  =  []_0
cons_22(x1, x2)  =  cons_22(x1, x2)
s_11(x1)  =  s_11(x1)
0_0  =  0_0
count_2_out_ga2(x1, x2)  =  count_2_out_ga1(x2)
if_count_2_in_1_ga4(x1, x2, x3, x4)  =  if_count_2_in_1_ga1(x4)
if_count_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_count_2_in_2_ga1(x5)
flatten_2_in_ga2(x1, x2)  =  flatten_2_in_ga1(x1)
flatten_2_out_ga2(x1, x2)  =  flatten_2_out_ga1(x2)
if_flatten_2_in_1_ga4(x1, x2, x3, x4)  =  if_flatten_2_in_1_ga2(x1, x4)
if_flatten_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flatten_2_in_2_ga1(x5)
if_count_2_in_3_ga6(x1, x2, x3, x4, x5, x6)  =  if_count_2_in_3_ga1(x6)
FLATTEN_2_IN_GA2(x1, x2)  =  FLATTEN_2_IN_GA1(x1)

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
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

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

FLATTEN_2_IN_GA2(cons_22(atom_11(X), U), ._22(X, Y)) -> FLATTEN_2_IN_GA2(U, Y)
FLATTEN_2_IN_GA2(cons_22(cons_22(U, V), W), X) -> FLATTEN_2_IN_GA2(cons_22(U, cons_22(V, W)), X)

R is empty.
The argument filtering Pi contains the following mapping:
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
cons_22(x1, x2)  =  cons_22(x1, x2)
FLATTEN_2_IN_GA2(x1, x2)  =  FLATTEN_2_IN_GA1(x1)

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
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPPoloProof
              ↳ PiDP

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

FLATTEN_2_IN_GA1(cons_22(atom_11(X), U)) -> FLATTEN_2_IN_GA1(U)
FLATTEN_2_IN_GA1(cons_22(cons_22(U, V), W)) -> FLATTEN_2_IN_GA1(cons_22(U, cons_22(V, W)))

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {FLATTEN_2_IN_GA1}.
By using a polynomial ordering, the following set of Dependency Pairs of this DP problem can be strictly oriented.

FLATTEN_2_IN_GA1(cons_22(atom_11(X), U)) -> FLATTEN_2_IN_GA1(U)
The remaining Dependency Pairs were at least non-strictly be oriented.

FLATTEN_2_IN_GA1(cons_22(cons_22(U, V), W)) -> FLATTEN_2_IN_GA1(cons_22(U, cons_22(V, W)))
With the implicit AFS there is no usable rule.

Used ordering: POLO with Polynomial interpretation:


POL(FLATTEN_2_IN_GA1(x1)) = x1   
POL(atom_11(x1)) = 1 + x1   
POL(cons_22(x1, x2)) = x1 + x2   



↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPPoloProof
QDP
                            ↳ QDPSizeChangeProof
              ↳ PiDP

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

FLATTEN_2_IN_GA1(cons_22(cons_22(U, V), W)) -> FLATTEN_2_IN_GA1(cons_22(U, cons_22(V, W)))

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {FLATTEN_2_IN_GA1}.
We used the following order and afs together with the size-change analysis to show that there are no infinite chains for this DP problem.

Order:Homeomorphic Embedding Order

AFS:
cons_22(x1, x2)  =  cons_21(x1)

From the DPs we obtained the following set of size-change graphs:

We oriented the following set of usable rules. none


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

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

IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> COUNT_2_IN_GA2(X, Z)
COUNT_2_IN_GA2(cons_22(atom_11(X), Y), s_11(Z)) -> COUNT_2_IN_GA2(Y, Z)
COUNT_2_IN_GA2(cons_22(cons_22(U, V), W), Z) -> IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))

The TRS R consists of the following rules:

count_2_in_ga2(atom_11(X), s_11(0_0)) -> count_2_out_ga2(atom_11(X), s_11(0_0))
count_2_in_ga2(cons_22(atom_11(X), Y), s_11(Z)) -> if_count_2_in_1_ga4(X, Y, Z, count_2_in_ga2(Y, Z))
count_2_in_ga2(cons_22(cons_22(U, V), W), Z) -> if_count_2_in_2_ga5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))
flatten_2_in_ga2(atom_11(X), ._22(X, []_0)) -> flatten_2_out_ga2(atom_11(X), ._22(X, []_0))
flatten_2_in_ga2(cons_22(atom_11(X), U), ._22(X, Y)) -> if_flatten_2_in_1_ga4(X, U, Y, flatten_2_in_ga2(U, Y))
flatten_2_in_ga2(cons_22(cons_22(U, V), W), X) -> if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_out_ga2(cons_22(U, cons_22(V, W)), X)) -> flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)
if_flatten_2_in_1_ga4(X, U, Y, flatten_2_out_ga2(U, Y)) -> flatten_2_out_ga2(cons_22(atom_11(X), U), ._22(X, Y))
if_count_2_in_2_ga5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> if_count_2_in_3_ga6(U, V, W, Z, X, count_2_in_ga2(X, Z))
if_count_2_in_3_ga6(U, V, W, Z, X, count_2_out_ga2(X, Z)) -> count_2_out_ga2(cons_22(cons_22(U, V), W), Z)
if_count_2_in_1_ga4(X, Y, Z, count_2_out_ga2(Y, Z)) -> count_2_out_ga2(cons_22(atom_11(X), Y), s_11(Z))

The argument filtering Pi contains the following mapping:
count_2_in_ga2(x1, x2)  =  count_2_in_ga1(x1)
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
[]_0  =  []_0
cons_22(x1, x2)  =  cons_22(x1, x2)
s_11(x1)  =  s_11(x1)
0_0  =  0_0
count_2_out_ga2(x1, x2)  =  count_2_out_ga1(x2)
if_count_2_in_1_ga4(x1, x2, x3, x4)  =  if_count_2_in_1_ga1(x4)
if_count_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_count_2_in_2_ga1(x5)
flatten_2_in_ga2(x1, x2)  =  flatten_2_in_ga1(x1)
flatten_2_out_ga2(x1, x2)  =  flatten_2_out_ga1(x2)
if_flatten_2_in_1_ga4(x1, x2, x3, x4)  =  if_flatten_2_in_1_ga2(x1, x4)
if_flatten_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flatten_2_in_2_ga1(x5)
if_count_2_in_3_ga6(x1, x2, x3, x4, x5, x6)  =  if_count_2_in_3_ga1(x6)
COUNT_2_IN_GA2(x1, x2)  =  COUNT_2_IN_GA1(x1)
IF_COUNT_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_COUNT_2_IN_2_GA1(x5)

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
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

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

IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)) -> COUNT_2_IN_GA2(X, Z)
COUNT_2_IN_GA2(cons_22(atom_11(X), Y), s_11(Z)) -> COUNT_2_IN_GA2(Y, Z)
COUNT_2_IN_GA2(cons_22(cons_22(U, V), W), Z) -> IF_COUNT_2_IN_2_GA5(U, V, W, Z, flatten_2_in_ga2(cons_22(cons_22(U, V), W), X))

The TRS R consists of the following rules:

flatten_2_in_ga2(cons_22(cons_22(U, V), W), X) -> if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_in_ga2(cons_22(U, cons_22(V, W)), X))
if_flatten_2_in_2_ga5(U, V, W, X, flatten_2_out_ga2(cons_22(U, cons_22(V, W)), X)) -> flatten_2_out_ga2(cons_22(cons_22(U, V), W), X)
flatten_2_in_ga2(cons_22(atom_11(X), U), ._22(X, Y)) -> if_flatten_2_in_1_ga4(X, U, Y, flatten_2_in_ga2(U, Y))
if_flatten_2_in_1_ga4(X, U, Y, flatten_2_out_ga2(U, Y)) -> flatten_2_out_ga2(cons_22(atom_11(X), U), ._22(X, Y))
flatten_2_in_ga2(atom_11(X), ._22(X, []_0)) -> flatten_2_out_ga2(atom_11(X), ._22(X, []_0))

The argument filtering Pi contains the following mapping:
atom_11(x1)  =  atom_11(x1)
._22(x1, x2)  =  ._22(x1, x2)
[]_0  =  []_0
cons_22(x1, x2)  =  cons_22(x1, x2)
s_11(x1)  =  s_11(x1)
flatten_2_in_ga2(x1, x2)  =  flatten_2_in_ga1(x1)
flatten_2_out_ga2(x1, x2)  =  flatten_2_out_ga1(x2)
if_flatten_2_in_1_ga4(x1, x2, x3, x4)  =  if_flatten_2_in_1_ga2(x1, x4)
if_flatten_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flatten_2_in_2_ga1(x5)
COUNT_2_IN_GA2(x1, x2)  =  COUNT_2_IN_GA1(x1)
IF_COUNT_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_COUNT_2_IN_2_GA1(x5)

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
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ RuleRemovalProof

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

IF_COUNT_2_IN_2_GA1(flatten_2_out_ga1(X)) -> COUNT_2_IN_GA1(X)
COUNT_2_IN_GA1(cons_22(atom_11(X), Y)) -> COUNT_2_IN_GA1(Y)
COUNT_2_IN_GA1(cons_22(cons_22(U, V), W)) -> IF_COUNT_2_IN_2_GA1(flatten_2_in_ga1(cons_22(cons_22(U, V), W)))

The TRS R consists of the following rules:

flatten_2_in_ga1(cons_22(cons_22(U, V), W)) -> if_flatten_2_in_2_ga1(flatten_2_in_ga1(cons_22(U, cons_22(V, W))))
if_flatten_2_in_2_ga1(flatten_2_out_ga1(X)) -> flatten_2_out_ga1(X)
flatten_2_in_ga1(cons_22(atom_11(X), U)) -> if_flatten_2_in_1_ga2(X, flatten_2_in_ga1(U))
if_flatten_2_in_1_ga2(X, flatten_2_out_ga1(Y)) -> flatten_2_out_ga1(._22(X, Y))
flatten_2_in_ga1(atom_11(X)) -> flatten_2_out_ga1(._22(X, []_0))

The set Q consists of the following terms:

flatten_2_in_ga1(x0)
if_flatten_2_in_2_ga1(x0)
if_flatten_2_in_1_ga2(x0, x1)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {COUNT_2_IN_GA1, IF_COUNT_2_IN_2_GA1}.
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 dependency pairs:

COUNT_2_IN_GA1(cons_22(atom_11(X), Y)) -> COUNT_2_IN_GA1(Y)
COUNT_2_IN_GA1(cons_22(cons_22(U, V), W)) -> IF_COUNT_2_IN_2_GA1(flatten_2_in_ga1(cons_22(cons_22(U, V), W)))

Strictly oriented rules of the TRS R:

flatten_2_in_ga1(cons_22(cons_22(U, V), W)) -> if_flatten_2_in_2_ga1(flatten_2_in_ga1(cons_22(U, cons_22(V, W))))
if_flatten_2_in_2_ga1(flatten_2_out_ga1(X)) -> flatten_2_out_ga1(X)
flatten_2_in_ga1(cons_22(atom_11(X), U)) -> if_flatten_2_in_1_ga2(X, flatten_2_in_ga1(U))
flatten_2_in_ga1(atom_11(X)) -> flatten_2_out_ga1(._22(X, []_0))

Used ordering: POLO with Polynomial interpretation:

POL(COUNT_2_IN_GA1(x1)) = 2·x1   
POL(flatten_2_in_ga1(x1)) = 1 + x1   
POL(flatten_2_out_ga1(x1)) = 2·x1   
POL(._22(x1, x2)) = x1 + x2   
POL(if_flatten_2_in_2_ga1(x1)) = 1 + x1   
POL(atom_11(x1)) = 2·x1   
POL([]_0) = 0   
POL(IF_COUNT_2_IN_2_GA1(x1)) = x1   
POL(cons_22(x1, x2)) = 2 + 2·x1 + x2   
POL(if_flatten_2_in_1_ga2(x1, x2)) = 2·x1 + x2   



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

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

IF_COUNT_2_IN_2_GA1(flatten_2_out_ga1(X)) -> COUNT_2_IN_GA1(X)

The TRS R consists of the following rules:

if_flatten_2_in_1_ga2(X, flatten_2_out_ga1(Y)) -> flatten_2_out_ga1(._22(X, Y))

The set Q consists of the following terms:

flatten_2_in_ga1(x0)
if_flatten_2_in_2_ga1(x0)
if_flatten_2_in_1_ga2(x0, x1)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {COUNT_2_IN_GA1, IF_COUNT_2_IN_2_GA1}.
The approximation of the Dependency Graph contains 1 SCC.

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

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

COUNT_2_IN_GA1(cons_22(atom_11(X), Y)) -> COUNT_2_IN_GA1(Y)

The TRS R consists of the following rules:

if_flatten_2_in_1_ga2(X, flatten_2_out_ga1(Y)) -> flatten_2_out_ga1(._22(X, Y))

The set Q consists of the following terms:

flatten_2_in_ga1(x0)
if_flatten_2_in_2_ga1(x0)
if_flatten_2_in_1_ga2(x0, x1)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {COUNT_2_IN_GA1}.
By using the subterm criterion together with the size-change analysis we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: