(0) Obligation:

Clauses:

flatten(atom(X), Y) :- ','(!, eq(Y, .(X, []))).
flatten(L, Y) :- ','(head(L, atom(H)), ','(!, ','(eq(Y, .(H, Z)), ','(tail(L, T), flatten(T, Z))))).
flatten(L, X) :- ','(head(L, cons(U, V)), ','(tail(L, W), flatten(cons(U, cons(V, W)), X))).
head(nil, X1).
head(cons(H, X2), H).
tail(nil, nil).
tail(cons(X3, T), T).
eq(X, X).

Queries:

flatten(g,a).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

flatten19(.(T18, T20), X16) :- flatten19(T20, X30).
flatten1(atom(T7), .(T7, [])).
flatten1(nil, .(T12, .(T18, T20))) :- flatten19(T20, X30).
flatten1(cons(atom(T28), T29), .(T28, T27)) :- flatten1(T29, T27).
flatten1(cons(cons(T37, T38), T39), T32) :- flatten1(cons(T37, cons(T38, T39)), T32).

Queries:

flatten1(g,a).

(3) PrologToPiTRSProof (SOUND transformation)

We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
flatten1_in: (b,f)
flatten19_in: (f,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x1, x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x1, x2, x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x1, x2, x3, x5)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x1, x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x1, x2, x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x1, x2, x3, x5)

(5) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → U2_GA(T12, T18, T20, flatten19_in_aa(T20, X30))
FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → FLATTEN19_IN_AA(T20, X30)
FLATTEN19_IN_AA(.(T18, T20), X16) → U1_AA(T18, T20, X16, flatten19_in_aa(T20, X30))
FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → U3_GA(T28, T29, T27, flatten1_in_ga(T29, T27))
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → U4_GA(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x1, x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x1, x2, x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x1, x2, x3, x5)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA
U1_AA(x1, x2, x3, x4)  =  U1_AA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x1, x2, x4)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x1, x2, x3, x5)

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

(6) Obligation:

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

FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → U2_GA(T12, T18, T20, flatten19_in_aa(T20, X30))
FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → FLATTEN19_IN_AA(T20, X30)
FLATTEN19_IN_AA(.(T18, T20), X16) → U1_AA(T18, T20, X16, flatten19_in_aa(T20, X30))
FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → U3_GA(T28, T29, T27, flatten1_in_ga(T29, T27))
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → U4_GA(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x1, x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x1, x2, x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x1, x2, x3, x5)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA
U1_AA(x1, x2, x3, x4)  =  U1_AA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x1, x2, x4)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x1, x2, x3, x5)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 5 less nodes.

(8) Complex Obligation (AND)

(9) Obligation:

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

FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x1, x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x1, x2, x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x1, x2, x3, x5)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA

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

(10) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(11) Obligation:

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

FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x2)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA

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

(12) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(13) Obligation:

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

FLATTEN19_IN_AAFLATTEN19_IN_AA

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(14) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

s = FLATTEN19_IN_AA evaluates to t =FLATTEN19_IN_AA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Matcher: [ ]
  • Semiunifier: [ ]




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from FLATTEN19_IN_AA to FLATTEN19_IN_AA.



(15) FALSE

(16) Obligation:

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

FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x1, x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x1, x2, x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x1, x2, x3, x5)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)

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

(17) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(18) Obligation:

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

FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)

R is empty.
The argument filtering Pi contains the following mapping:
atom(x1)  =  atom(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)

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

(19) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(20) Obligation:

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

FLATTEN1_IN_GA(cons(cons(T37, T38), T39)) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)))
FLATTEN1_IN_GA(cons(atom(T28), T29)) → FLATTEN1_IN_GA(T29)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(21) UsableRulesReductionPairsProof (EQUIVALENT transformation)

By using the usable rules with reduction pair processor [LPAR04] with a polynomial ordering [POLO], all dependency pairs and the corresponding usable rules [FROCOS05] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.

The following dependency pairs can be deleted:

FLATTEN1_IN_GA(cons(cons(T37, T38), T39)) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)))
FLATTEN1_IN_GA(cons(atom(T28), T29)) → FLATTEN1_IN_GA(T29)
No rules are removed from R.

Used ordering: POLO with Polynomial interpretation [POLO]:

POL(FLATTEN1_IN_GA(x1)) = 2·x1   
POL(atom(x1)) = x1   
POL(cons(x1, x2)) = 2 + 2·x1 + x2   

(22) Obligation:

Q DP problem:
P is empty.
R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(23) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(24) TRUE

(25) PrologToPiTRSProof (SOUND transformation)

We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
flatten1_in: (b,f)
flatten19_in: (f,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(26) Obligation:

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

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)

(27) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → U2_GA(T12, T18, T20, flatten19_in_aa(T20, X30))
FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → FLATTEN19_IN_AA(T20, X30)
FLATTEN19_IN_AA(.(T18, T20), X16) → U1_AA(T18, T20, X16, flatten19_in_aa(T20, X30))
FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → U3_GA(T28, T29, T27, flatten1_in_ga(T29, T27))
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → U4_GA(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA
U1_AA(x1, x2, x3, x4)  =  U1_AA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x5)

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

(28) Obligation:

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

FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → U2_GA(T12, T18, T20, flatten19_in_aa(T20, X30))
FLATTEN1_IN_GA(nil, .(T12, .(T18, T20))) → FLATTEN19_IN_AA(T20, X30)
FLATTEN19_IN_AA(.(T18, T20), X16) → U1_AA(T18, T20, X16, flatten19_in_aa(T20, X30))
FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → U3_GA(T28, T29, T27, flatten1_in_ga(T29, T27))
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → U4_GA(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA
U1_AA(x1, x2, x3, x4)  =  U1_AA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x5)

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

(29) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 5 less nodes.

(30) Complex Obligation (AND)

(31) Obligation:

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

FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA

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

(32) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(33) Obligation:

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

FLATTEN19_IN_AA(.(T18, T20), X16) → FLATTEN19_IN_AA(T20, X30)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x2)
FLATTEN19_IN_AA(x1, x2)  =  FLATTEN19_IN_AA

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

(34) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(35) Obligation:

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

FLATTEN19_IN_AAFLATTEN19_IN_AA

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(36) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

s = FLATTEN19_IN_AA evaluates to t =FLATTEN19_IN_AA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Matcher: [ ]
  • Semiunifier: [ ]




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from FLATTEN19_IN_AA to FLATTEN19_IN_AA.



(37) FALSE

(38) Obligation:

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

FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)

The TRS R consists of the following rules:

flatten1_in_ga(atom(T7), .(T7, [])) → flatten1_out_ga(atom(T7), .(T7, []))
flatten1_in_ga(nil, .(T12, .(T18, T20))) → U2_ga(T12, T18, T20, flatten19_in_aa(T20, X30))
flatten19_in_aa(.(T18, T20), X16) → U1_aa(T18, T20, X16, flatten19_in_aa(T20, X30))
U1_aa(T18, T20, X16, flatten19_out_aa(T20, X30)) → flatten19_out_aa(.(T18, T20), X16)
U2_ga(T12, T18, T20, flatten19_out_aa(T20, X30)) → flatten1_out_ga(nil, .(T12, .(T18, T20)))
flatten1_in_ga(cons(atom(T28), T29), .(T28, T27)) → U3_ga(T28, T29, T27, flatten1_in_ga(T29, T27))
flatten1_in_ga(cons(cons(T37, T38), T39), T32) → U4_ga(T37, T38, T39, T32, flatten1_in_ga(cons(T37, cons(T38, T39)), T32))
U4_ga(T37, T38, T39, T32, flatten1_out_ga(cons(T37, cons(T38, T39)), T32)) → flatten1_out_ga(cons(cons(T37, T38), T39), T32)
U3_ga(T28, T29, T27, flatten1_out_ga(T29, T27)) → flatten1_out_ga(cons(atom(T28), T29), .(T28, T27))

The argument filtering Pi contains the following mapping:
flatten1_in_ga(x1, x2)  =  flatten1_in_ga(x1)
atom(x1)  =  atom(x1)
flatten1_out_ga(x1, x2)  =  flatten1_out_ga(x2)
nil  =  nil
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
flatten19_in_aa(x1, x2)  =  flatten19_in_aa
U1_aa(x1, x2, x3, x4)  =  U1_aa(x4)
flatten19_out_aa(x1, x2)  =  flatten19_out_aa(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
U4_ga(x1, x2, x3, x4, x5)  =  U4_ga(x5)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)

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

(39) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(40) Obligation:

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

FLATTEN1_IN_GA(cons(cons(T37, T38), T39), T32) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)), T32)
FLATTEN1_IN_GA(cons(atom(T28), T29), .(T28, T27)) → FLATTEN1_IN_GA(T29, T27)

R is empty.
The argument filtering Pi contains the following mapping:
atom(x1)  =  atom(x1)
.(x1, x2)  =  .(x2)
cons(x1, x2)  =  cons(x1, x2)
FLATTEN1_IN_GA(x1, x2)  =  FLATTEN1_IN_GA(x1)

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

(41) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(42) Obligation:

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

FLATTEN1_IN_GA(cons(cons(T37, T38), T39)) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)))
FLATTEN1_IN_GA(cons(atom(T28), T29)) → FLATTEN1_IN_GA(T29)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(43) UsableRulesReductionPairsProof (EQUIVALENT transformation)

By using the usable rules with reduction pair processor [LPAR04] with a polynomial ordering [POLO], all dependency pairs and the corresponding usable rules [FROCOS05] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.

The following dependency pairs can be deleted:

FLATTEN1_IN_GA(cons(cons(T37, T38), T39)) → FLATTEN1_IN_GA(cons(T37, cons(T38, T39)))
FLATTEN1_IN_GA(cons(atom(T28), T29)) → FLATTEN1_IN_GA(T29)
No rules are removed from R.

Used ordering: POLO with Polynomial interpretation [POLO]:

POL(FLATTEN1_IN_GA(x1)) = 2·x1   
POL(atom(x1)) = x1   
POL(cons(x1, x2)) = 2 + 2·x1 + x2   

(44) Obligation:

Q DP problem:
P is empty.
R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(45) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(46) TRUE