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



PROLOG
  ↳ PrologToPiTRSProof

flat2({}0, {}0).
flat2(.2({}0, T), R) :- flat2(T, R).
flat2(.2(.2(H, T), TT), .2(H, R)) :- flat2(.2(T, TT), R).


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


flat_2_in_ga2([]_0, []_0) -> flat_2_out_ga2([]_0, []_0)
flat_2_in_ga2(._22([]_0, T), R) -> if_flat_2_in_1_ga3(T, R, flat_2_in_ga2(T, R))
flat_2_in_ga2(._22(._22(H, T), TT), ._22(H, R)) -> if_flat_2_in_2_ga5(H, T, TT, R, flat_2_in_ga2(._22(T, TT), R))
if_flat_2_in_2_ga5(H, T, TT, R, flat_2_out_ga2(._22(T, TT), R)) -> flat_2_out_ga2(._22(._22(H, T), TT), ._22(H, R))
if_flat_2_in_1_ga3(T, R, flat_2_out_ga2(T, R)) -> flat_2_out_ga2(._22([]_0, T), R)

The argument filtering Pi contains the following mapping:
flat_2_in_ga2(x1, x2)  =  flat_2_in_ga1(x1)
[]_0  =  []_0
._22(x1, x2)  =  ._22(x1, x2)
flat_2_out_ga2(x1, x2)  =  flat_2_out_ga1(x2)
if_flat_2_in_1_ga3(x1, x2, x3)  =  if_flat_2_in_1_ga1(x3)
if_flat_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ga2(x1, x5)

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:

flat_2_in_ga2([]_0, []_0) -> flat_2_out_ga2([]_0, []_0)
flat_2_in_ga2(._22([]_0, T), R) -> if_flat_2_in_1_ga3(T, R, flat_2_in_ga2(T, R))
flat_2_in_ga2(._22(._22(H, T), TT), ._22(H, R)) -> if_flat_2_in_2_ga5(H, T, TT, R, flat_2_in_ga2(._22(T, TT), R))
if_flat_2_in_2_ga5(H, T, TT, R, flat_2_out_ga2(._22(T, TT), R)) -> flat_2_out_ga2(._22(._22(H, T), TT), ._22(H, R))
if_flat_2_in_1_ga3(T, R, flat_2_out_ga2(T, R)) -> flat_2_out_ga2(._22([]_0, T), R)

The argument filtering Pi contains the following mapping:
flat_2_in_ga2(x1, x2)  =  flat_2_in_ga1(x1)
[]_0  =  []_0
._22(x1, x2)  =  ._22(x1, x2)
flat_2_out_ga2(x1, x2)  =  flat_2_out_ga1(x2)
if_flat_2_in_1_ga3(x1, x2, x3)  =  if_flat_2_in_1_ga1(x3)
if_flat_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ga2(x1, x5)


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

FLAT_2_IN_GA2(._22([]_0, T), R) -> IF_FLAT_2_IN_1_GA3(T, R, flat_2_in_ga2(T, R))
FLAT_2_IN_GA2(._22([]_0, T), R) -> FLAT_2_IN_GA2(T, R)
FLAT_2_IN_GA2(._22(._22(H, T), TT), ._22(H, R)) -> IF_FLAT_2_IN_2_GA5(H, T, TT, R, flat_2_in_ga2(._22(T, TT), R))
FLAT_2_IN_GA2(._22(._22(H, T), TT), ._22(H, R)) -> FLAT_2_IN_GA2(._22(T, TT), R)

The TRS R consists of the following rules:

flat_2_in_ga2([]_0, []_0) -> flat_2_out_ga2([]_0, []_0)
flat_2_in_ga2(._22([]_0, T), R) -> if_flat_2_in_1_ga3(T, R, flat_2_in_ga2(T, R))
flat_2_in_ga2(._22(._22(H, T), TT), ._22(H, R)) -> if_flat_2_in_2_ga5(H, T, TT, R, flat_2_in_ga2(._22(T, TT), R))
if_flat_2_in_2_ga5(H, T, TT, R, flat_2_out_ga2(._22(T, TT), R)) -> flat_2_out_ga2(._22(._22(H, T), TT), ._22(H, R))
if_flat_2_in_1_ga3(T, R, flat_2_out_ga2(T, R)) -> flat_2_out_ga2(._22([]_0, T), R)

The argument filtering Pi contains the following mapping:
flat_2_in_ga2(x1, x2)  =  flat_2_in_ga1(x1)
[]_0  =  []_0
._22(x1, x2)  =  ._22(x1, x2)
flat_2_out_ga2(x1, x2)  =  flat_2_out_ga1(x2)
if_flat_2_in_1_ga3(x1, x2, x3)  =  if_flat_2_in_1_ga1(x3)
if_flat_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ga2(x1, x5)
FLAT_2_IN_GA2(x1, x2)  =  FLAT_2_IN_GA1(x1)
IF_FLAT_2_IN_1_GA3(x1, x2, x3)  =  IF_FLAT_2_IN_1_GA1(x3)
IF_FLAT_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_GA2(x1, x5)

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:

FLAT_2_IN_GA2(._22([]_0, T), R) -> IF_FLAT_2_IN_1_GA3(T, R, flat_2_in_ga2(T, R))
FLAT_2_IN_GA2(._22([]_0, T), R) -> FLAT_2_IN_GA2(T, R)
FLAT_2_IN_GA2(._22(._22(H, T), TT), ._22(H, R)) -> IF_FLAT_2_IN_2_GA5(H, T, TT, R, flat_2_in_ga2(._22(T, TT), R))
FLAT_2_IN_GA2(._22(._22(H, T), TT), ._22(H, R)) -> FLAT_2_IN_GA2(._22(T, TT), R)

The TRS R consists of the following rules:

flat_2_in_ga2([]_0, []_0) -> flat_2_out_ga2([]_0, []_0)
flat_2_in_ga2(._22([]_0, T), R) -> if_flat_2_in_1_ga3(T, R, flat_2_in_ga2(T, R))
flat_2_in_ga2(._22(._22(H, T), TT), ._22(H, R)) -> if_flat_2_in_2_ga5(H, T, TT, R, flat_2_in_ga2(._22(T, TT), R))
if_flat_2_in_2_ga5(H, T, TT, R, flat_2_out_ga2(._22(T, TT), R)) -> flat_2_out_ga2(._22(._22(H, T), TT), ._22(H, R))
if_flat_2_in_1_ga3(T, R, flat_2_out_ga2(T, R)) -> flat_2_out_ga2(._22([]_0, T), R)

The argument filtering Pi contains the following mapping:
flat_2_in_ga2(x1, x2)  =  flat_2_in_ga1(x1)
[]_0  =  []_0
._22(x1, x2)  =  ._22(x1, x2)
flat_2_out_ga2(x1, x2)  =  flat_2_out_ga1(x2)
if_flat_2_in_1_ga3(x1, x2, x3)  =  if_flat_2_in_1_ga1(x3)
if_flat_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ga2(x1, x5)
FLAT_2_IN_GA2(x1, x2)  =  FLAT_2_IN_GA1(x1)
IF_FLAT_2_IN_1_GA3(x1, x2, x3)  =  IF_FLAT_2_IN_1_GA1(x3)
IF_FLAT_2_IN_2_GA5(x1, x2, x3, x4, x5)  =  IF_FLAT_2_IN_2_GA2(x1, x5)

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

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

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

FLAT_2_IN_GA2(._22(._22(H, T), TT), ._22(H, R)) -> FLAT_2_IN_GA2(._22(T, TT), R)
FLAT_2_IN_GA2(._22([]_0, T), R) -> FLAT_2_IN_GA2(T, R)

The TRS R consists of the following rules:

flat_2_in_ga2([]_0, []_0) -> flat_2_out_ga2([]_0, []_0)
flat_2_in_ga2(._22([]_0, T), R) -> if_flat_2_in_1_ga3(T, R, flat_2_in_ga2(T, R))
flat_2_in_ga2(._22(._22(H, T), TT), ._22(H, R)) -> if_flat_2_in_2_ga5(H, T, TT, R, flat_2_in_ga2(._22(T, TT), R))
if_flat_2_in_2_ga5(H, T, TT, R, flat_2_out_ga2(._22(T, TT), R)) -> flat_2_out_ga2(._22(._22(H, T), TT), ._22(H, R))
if_flat_2_in_1_ga3(T, R, flat_2_out_ga2(T, R)) -> flat_2_out_ga2(._22([]_0, T), R)

The argument filtering Pi contains the following mapping:
flat_2_in_ga2(x1, x2)  =  flat_2_in_ga1(x1)
[]_0  =  []_0
._22(x1, x2)  =  ._22(x1, x2)
flat_2_out_ga2(x1, x2)  =  flat_2_out_ga1(x2)
if_flat_2_in_1_ga3(x1, x2, x3)  =  if_flat_2_in_1_ga1(x3)
if_flat_2_in_2_ga5(x1, x2, x3, x4, x5)  =  if_flat_2_in_2_ga2(x1, x5)
FLAT_2_IN_GA2(x1, x2)  =  FLAT_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
            ↳ PiDP
              ↳ UsableRulesProof
PiDP
                  ↳ PiDPToQDPProof

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

FLAT_2_IN_GA2(._22(._22(H, T), TT), ._22(H, R)) -> FLAT_2_IN_GA2(._22(T, TT), R)
FLAT_2_IN_GA2(._22([]_0, T), R) -> FLAT_2_IN_GA2(T, R)

R is empty.
The argument filtering Pi contains the following mapping:
[]_0  =  []_0
._22(x1, x2)  =  ._22(x1, x2)
FLAT_2_IN_GA2(x1, x2)  =  FLAT_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
            ↳ PiDP
              ↳ UsableRulesProof
                ↳ PiDP
                  ↳ PiDPToQDPProof
QDP
                      ↳ QDPSizeChangeProof

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

FLAT_2_IN_GA1(._22(._22(H, T), TT)) -> FLAT_2_IN_GA1(._22(T, TT))
FLAT_2_IN_GA1(._22([]_0, T)) -> FLAT_2_IN_GA1(T)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {FLAT_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:
[]_0  =  []_0
._22(x1, x2)  =  ._22(x1, x2)

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

We oriented the following set of usable rules. none