(0) Obligation:

Clauses:

hidden_flatten([], L, L).
hidden_flatten(.(.(H, T), L), S, F) :- ','(!, ','(hidden_flatten(L, S, Lf), hidden_flatten(.(H, T), Lf, F))).
hidden_flatten(.(H, T), S, .(H, L)) :- hidden_flatten(T, S, L).

Query: hidden_flatten(g,a,a)

(1) CutEliminatorProof (SOUND transformation)

Eliminated all cuts by simply ignoring them[PROLOG].

(2) Obligation:

Clauses:

hidden_flatten([], L, L).
hidden_flatten(.(.(H, T), L), S, F) :- ','(hidden_flatten(L, S, Lf), hidden_flatten(.(H, T), Lf, F)).
hidden_flatten(.(H, T), S, .(H, L)) :- hidden_flatten(T, S, L).

Query: hidden_flatten(g,a,a)

(3) PrologToPiTRSProof (SOUND transformation)

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

hidden_flatten_in_gaa([], L, L) → hidden_flatten_out_gaa([], L, L)
hidden_flatten_in_gaa(.(.(H, T), L), S, F) → U1_gaa(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
hidden_flatten_in_gaa(.(H, T), S, .(H, L)) → U3_gaa(H, T, S, L, hidden_flatten_in_gaa(T, S, L))
U3_gaa(H, T, S, L, hidden_flatten_out_gaa(T, S, L)) → hidden_flatten_out_gaa(.(H, T), S, .(H, L))
U1_gaa(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → U2_gaa(H, T, L, S, F, hidden_flatten_in_gaa(.(H, T), Lf, F))
U2_gaa(H, T, L, S, F, hidden_flatten_out_gaa(.(H, T), Lf, F)) → hidden_flatten_out_gaa(.(.(H, T), L), S, F)

The argument filtering Pi contains the following mapping:
hidden_flatten_in_gaa(x1, x2, x3)  =  hidden_flatten_in_gaa(x1)
[]  =  []
hidden_flatten_out_gaa(x1, x2, x3)  =  hidden_flatten_out_gaa
.(x1, x2)  =  .(x1, x2)
U1_gaa(x1, x2, x3, x4, x5, x6)  =  U1_gaa(x1, x2, x6)
U3_gaa(x1, x2, x3, x4, x5)  =  U3_gaa(x5)
U2_gaa(x1, x2, x3, x4, x5, x6)  =  U2_gaa(x6)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

hidden_flatten_in_gaa([], L, L) → hidden_flatten_out_gaa([], L, L)
hidden_flatten_in_gaa(.(.(H, T), L), S, F) → U1_gaa(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
hidden_flatten_in_gaa(.(H, T), S, .(H, L)) → U3_gaa(H, T, S, L, hidden_flatten_in_gaa(T, S, L))
U3_gaa(H, T, S, L, hidden_flatten_out_gaa(T, S, L)) → hidden_flatten_out_gaa(.(H, T), S, .(H, L))
U1_gaa(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → U2_gaa(H, T, L, S, F, hidden_flatten_in_gaa(.(H, T), Lf, F))
U2_gaa(H, T, L, S, F, hidden_flatten_out_gaa(.(H, T), Lf, F)) → hidden_flatten_out_gaa(.(.(H, T), L), S, F)

The argument filtering Pi contains the following mapping:
hidden_flatten_in_gaa(x1, x2, x3)  =  hidden_flatten_in_gaa(x1)
[]  =  []
hidden_flatten_out_gaa(x1, x2, x3)  =  hidden_flatten_out_gaa
.(x1, x2)  =  .(x1, x2)
U1_gaa(x1, x2, x3, x4, x5, x6)  =  U1_gaa(x1, x2, x6)
U3_gaa(x1, x2, x3, x4, x5)  =  U3_gaa(x5)
U2_gaa(x1, x2, x3, x4, x5, x6)  =  U2_gaa(x6)

(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:

HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L), S, F) → U1_GAA(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L), S, F) → HIDDEN_FLATTEN_IN_GAA(L, S, Lf)
HIDDEN_FLATTEN_IN_GAA(.(H, T), S, .(H, L)) → U3_GAA(H, T, S, L, hidden_flatten_in_gaa(T, S, L))
HIDDEN_FLATTEN_IN_GAA(.(H, T), S, .(H, L)) → HIDDEN_FLATTEN_IN_GAA(T, S, L)
U1_GAA(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → U2_GAA(H, T, L, S, F, hidden_flatten_in_gaa(.(H, T), Lf, F))
U1_GAA(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → HIDDEN_FLATTEN_IN_GAA(.(H, T), Lf, F)

The TRS R consists of the following rules:

hidden_flatten_in_gaa([], L, L) → hidden_flatten_out_gaa([], L, L)
hidden_flatten_in_gaa(.(.(H, T), L), S, F) → U1_gaa(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
hidden_flatten_in_gaa(.(H, T), S, .(H, L)) → U3_gaa(H, T, S, L, hidden_flatten_in_gaa(T, S, L))
U3_gaa(H, T, S, L, hidden_flatten_out_gaa(T, S, L)) → hidden_flatten_out_gaa(.(H, T), S, .(H, L))
U1_gaa(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → U2_gaa(H, T, L, S, F, hidden_flatten_in_gaa(.(H, T), Lf, F))
U2_gaa(H, T, L, S, F, hidden_flatten_out_gaa(.(H, T), Lf, F)) → hidden_flatten_out_gaa(.(.(H, T), L), S, F)

The argument filtering Pi contains the following mapping:
hidden_flatten_in_gaa(x1, x2, x3)  =  hidden_flatten_in_gaa(x1)
[]  =  []
hidden_flatten_out_gaa(x1, x2, x3)  =  hidden_flatten_out_gaa
.(x1, x2)  =  .(x1, x2)
U1_gaa(x1, x2, x3, x4, x5, x6)  =  U1_gaa(x1, x2, x6)
U3_gaa(x1, x2, x3, x4, x5)  =  U3_gaa(x5)
U2_gaa(x1, x2, x3, x4, x5, x6)  =  U2_gaa(x6)
HIDDEN_FLATTEN_IN_GAA(x1, x2, x3)  =  HIDDEN_FLATTEN_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4, x5, x6)  =  U1_GAA(x1, x2, x6)
U3_GAA(x1, x2, x3, x4, x5)  =  U3_GAA(x5)
U2_GAA(x1, x2, x3, x4, x5, x6)  =  U2_GAA(x6)

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

(6) Obligation:

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

HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L), S, F) → U1_GAA(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L), S, F) → HIDDEN_FLATTEN_IN_GAA(L, S, Lf)
HIDDEN_FLATTEN_IN_GAA(.(H, T), S, .(H, L)) → U3_GAA(H, T, S, L, hidden_flatten_in_gaa(T, S, L))
HIDDEN_FLATTEN_IN_GAA(.(H, T), S, .(H, L)) → HIDDEN_FLATTEN_IN_GAA(T, S, L)
U1_GAA(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → U2_GAA(H, T, L, S, F, hidden_flatten_in_gaa(.(H, T), Lf, F))
U1_GAA(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → HIDDEN_FLATTEN_IN_GAA(.(H, T), Lf, F)

The TRS R consists of the following rules:

hidden_flatten_in_gaa([], L, L) → hidden_flatten_out_gaa([], L, L)
hidden_flatten_in_gaa(.(.(H, T), L), S, F) → U1_gaa(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
hidden_flatten_in_gaa(.(H, T), S, .(H, L)) → U3_gaa(H, T, S, L, hidden_flatten_in_gaa(T, S, L))
U3_gaa(H, T, S, L, hidden_flatten_out_gaa(T, S, L)) → hidden_flatten_out_gaa(.(H, T), S, .(H, L))
U1_gaa(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → U2_gaa(H, T, L, S, F, hidden_flatten_in_gaa(.(H, T), Lf, F))
U2_gaa(H, T, L, S, F, hidden_flatten_out_gaa(.(H, T), Lf, F)) → hidden_flatten_out_gaa(.(.(H, T), L), S, F)

The argument filtering Pi contains the following mapping:
hidden_flatten_in_gaa(x1, x2, x3)  =  hidden_flatten_in_gaa(x1)
[]  =  []
hidden_flatten_out_gaa(x1, x2, x3)  =  hidden_flatten_out_gaa
.(x1, x2)  =  .(x1, x2)
U1_gaa(x1, x2, x3, x4, x5, x6)  =  U1_gaa(x1, x2, x6)
U3_gaa(x1, x2, x3, x4, x5)  =  U3_gaa(x5)
U2_gaa(x1, x2, x3, x4, x5, x6)  =  U2_gaa(x6)
HIDDEN_FLATTEN_IN_GAA(x1, x2, x3)  =  HIDDEN_FLATTEN_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4, x5, x6)  =  U1_GAA(x1, x2, x6)
U3_GAA(x1, x2, x3, x4, x5)  =  U3_GAA(x5)
U2_GAA(x1, x2, x3, x4, x5, x6)  =  U2_GAA(x6)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 2 less nodes.

(8) Obligation:

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

U1_GAA(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → HIDDEN_FLATTEN_IN_GAA(.(H, T), Lf, F)
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L), S, F) → U1_GAA(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L), S, F) → HIDDEN_FLATTEN_IN_GAA(L, S, Lf)
HIDDEN_FLATTEN_IN_GAA(.(H, T), S, .(H, L)) → HIDDEN_FLATTEN_IN_GAA(T, S, L)

The TRS R consists of the following rules:

hidden_flatten_in_gaa([], L, L) → hidden_flatten_out_gaa([], L, L)
hidden_flatten_in_gaa(.(.(H, T), L), S, F) → U1_gaa(H, T, L, S, F, hidden_flatten_in_gaa(L, S, Lf))
hidden_flatten_in_gaa(.(H, T), S, .(H, L)) → U3_gaa(H, T, S, L, hidden_flatten_in_gaa(T, S, L))
U3_gaa(H, T, S, L, hidden_flatten_out_gaa(T, S, L)) → hidden_flatten_out_gaa(.(H, T), S, .(H, L))
U1_gaa(H, T, L, S, F, hidden_flatten_out_gaa(L, S, Lf)) → U2_gaa(H, T, L, S, F, hidden_flatten_in_gaa(.(H, T), Lf, F))
U2_gaa(H, T, L, S, F, hidden_flatten_out_gaa(.(H, T), Lf, F)) → hidden_flatten_out_gaa(.(.(H, T), L), S, F)

The argument filtering Pi contains the following mapping:
hidden_flatten_in_gaa(x1, x2, x3)  =  hidden_flatten_in_gaa(x1)
[]  =  []
hidden_flatten_out_gaa(x1, x2, x3)  =  hidden_flatten_out_gaa
.(x1, x2)  =  .(x1, x2)
U1_gaa(x1, x2, x3, x4, x5, x6)  =  U1_gaa(x1, x2, x6)
U3_gaa(x1, x2, x3, x4, x5)  =  U3_gaa(x5)
U2_gaa(x1, x2, x3, x4, x5, x6)  =  U2_gaa(x6)
HIDDEN_FLATTEN_IN_GAA(x1, x2, x3)  =  HIDDEN_FLATTEN_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4, x5, x6)  =  U1_GAA(x1, x2, x6)

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

(9) PiDPToQDPProof (SOUND transformation)

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

(10) Obligation:

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

U1_GAA(H, T, hidden_flatten_out_gaa) → HIDDEN_FLATTEN_IN_GAA(.(H, T))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L)) → U1_GAA(H, T, hidden_flatten_in_gaa(L))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L)) → HIDDEN_FLATTEN_IN_GAA(L)
HIDDEN_FLATTEN_IN_GAA(.(H, T)) → HIDDEN_FLATTEN_IN_GAA(T)

The TRS R consists of the following rules:

hidden_flatten_in_gaa([]) → hidden_flatten_out_gaa
hidden_flatten_in_gaa(.(.(H, T), L)) → U1_gaa(H, T, hidden_flatten_in_gaa(L))
hidden_flatten_in_gaa(.(H, T)) → U3_gaa(hidden_flatten_in_gaa(T))
U3_gaa(hidden_flatten_out_gaa) → hidden_flatten_out_gaa
U1_gaa(H, T, hidden_flatten_out_gaa) → U2_gaa(hidden_flatten_in_gaa(.(H, T)))
U2_gaa(hidden_flatten_out_gaa) → hidden_flatten_out_gaa

The set Q consists of the following terms:

hidden_flatten_in_gaa(x0)
U3_gaa(x0)
U1_gaa(x0, x1, x2)
U2_gaa(x0)

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

(11) 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.

No dependency pairs are removed.

The following rules are removed from R:

hidden_flatten_in_gaa([]) → hidden_flatten_out_gaa
Used ordering: POLO with Polynomial interpretation [POLO]:

POL(.(x1, x2)) = x1 + x2   
POL(HIDDEN_FLATTEN_IN_GAA(x1)) = x1   
POL(U1_GAA(x1, x2, x3)) = x1 + x2 + x3   
POL(U1_gaa(x1, x2, x3)) = x1 + x2 + x3   
POL(U2_gaa(x1)) = x1   
POL(U3_gaa(x1)) = x1   
POL([]) = 2   
POL(hidden_flatten_in_gaa(x1)) = x1   
POL(hidden_flatten_out_gaa) = 0   

(12) Obligation:

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

U1_GAA(H, T, hidden_flatten_out_gaa) → HIDDEN_FLATTEN_IN_GAA(.(H, T))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L)) → U1_GAA(H, T, hidden_flatten_in_gaa(L))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L)) → HIDDEN_FLATTEN_IN_GAA(L)
HIDDEN_FLATTEN_IN_GAA(.(H, T)) → HIDDEN_FLATTEN_IN_GAA(T)

The TRS R consists of the following rules:

hidden_flatten_in_gaa(.(.(H, T), L)) → U1_gaa(H, T, hidden_flatten_in_gaa(L))
hidden_flatten_in_gaa(.(H, T)) → U3_gaa(hidden_flatten_in_gaa(T))
U3_gaa(hidden_flatten_out_gaa) → hidden_flatten_out_gaa
U1_gaa(H, T, hidden_flatten_out_gaa) → U2_gaa(hidden_flatten_in_gaa(.(H, T)))
U2_gaa(hidden_flatten_out_gaa) → hidden_flatten_out_gaa

The set Q consists of the following terms:

hidden_flatten_in_gaa(x0)
U3_gaa(x0)
U1_gaa(x0, x1, x2)
U2_gaa(x0)

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

(13) MRRProof (EQUIVALENT transformation)

By using the rule removal processor [LPAR04] with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

U1_GAA(H, T, hidden_flatten_out_gaa) → HIDDEN_FLATTEN_IN_GAA(.(H, T))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L)) → U1_GAA(H, T, hidden_flatten_in_gaa(L))
HIDDEN_FLATTEN_IN_GAA(.(.(H, T), L)) → HIDDEN_FLATTEN_IN_GAA(L)
HIDDEN_FLATTEN_IN_GAA(.(H, T)) → HIDDEN_FLATTEN_IN_GAA(T)

Strictly oriented rules of the TRS R:

hidden_flatten_in_gaa(.(.(H, T), L)) → U1_gaa(H, T, hidden_flatten_in_gaa(L))
hidden_flatten_in_gaa(.(H, T)) → U3_gaa(hidden_flatten_in_gaa(T))
U3_gaa(hidden_flatten_out_gaa) → hidden_flatten_out_gaa
U1_gaa(H, T, hidden_flatten_out_gaa) → U2_gaa(hidden_flatten_in_gaa(.(H, T)))
U2_gaa(hidden_flatten_out_gaa) → hidden_flatten_out_gaa

Used ordering: Knuth-Bendix order [KBO] with precedence:
U2gaa1 > HIDDENFLATTENINGAA1 > U1GAA3 > hiddenflatteningaa1 > hiddenflattenoutgaa > U3gaa1 > U1gaa3 > .2

and weight map:

hidden_flatten_out_gaa=3
hidden_flatten_in_gaa_1=2
U3_gaa_1=1
U2_gaa_1=0
HIDDEN_FLATTEN_IN_GAA_1=2
._2=0
U1_gaa_3=0
U1_GAA_3=0

The variable weight is 1

(14) Obligation:

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

hidden_flatten_in_gaa(x0)
U3_gaa(x0)
U1_gaa(x0, x1, x2)
U2_gaa(x0)

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

(15) PisEmptyProof (EQUIVALENT transformation)

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

(16) YES