(0) Obligation:

Clauses:

f(0, Y, 0).
f(s(X), Y, Z) :- ','(f(X, Y, U), f(U, Y, Z)).

Queries:

f(g,a,a).

(1) PrologToPiTRSProof (SOUND transformation)

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

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(2) Obligation:

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

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)

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

F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → U2_GAA(X, Y, Z, U, f_in_gaa(U, Y, Z))
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)
U2_GAA(x1, x2, x3, x4, x5)  =  U2_GAA(x5)

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

(4) Obligation:

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

F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → U2_GAA(X, Y, Z, U, f_in_gaa(U, Y, Z))
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)
U2_GAA(x1, x2, x3, x4, x5)  =  U2_GAA(x5)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

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

(6) Obligation:

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

U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)
F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)

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

(7) PiDPToQDPProof (SOUND transformation)

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

(8) Obligation:

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

U1_GAA(f_out_gaa(U)) → F_IN_GAA(U)
F_IN_GAA(s(X)) → U1_GAA(f_in_gaa(X))
F_IN_GAA(s(X)) → F_IN_GAA(X)

The TRS R consists of the following rules:

f_in_gaa(0) → f_out_gaa(0)
f_in_gaa(s(X)) → U1_gaa(f_in_gaa(X))
U1_gaa(f_out_gaa(U)) → U2_gaa(f_in_gaa(U))
U2_gaa(f_out_gaa(Z)) → f_out_gaa(Z)

The set Q consists of the following terms:

f_in_gaa(x0)
U1_gaa(x0)
U2_gaa(x0)

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

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

U1_GAA(f_out_gaa(U)) → F_IN_GAA(U)
F_IN_GAA(s(X)) → U1_GAA(f_in_gaa(X))
F_IN_GAA(s(X)) → F_IN_GAA(X)
The following rules are removed from R:

f_in_gaa(s(X)) → U1_gaa(f_in_gaa(X))
U1_gaa(f_out_gaa(U)) → U2_gaa(f_in_gaa(U))
U2_gaa(f_out_gaa(Z)) → f_out_gaa(Z)
Used ordering: POLO with Polynomial interpretation [POLO]:

POL(0) = 0   
POL(F_IN_GAA(x1)) = 2 + x1   
POL(U1_GAA(x1)) = 1 + x1   
POL(U1_gaa(x1)) = 2·x1   
POL(U2_gaa(x1)) = 1 + x1   
POL(f_in_gaa(x1)) = 2 + x1   
POL(f_out_gaa(x1)) = 2 + 2·x1   
POL(s(x1)) = 2 + 2·x1   

(10) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

f_in_gaa(0) → f_out_gaa(0)

The set Q consists of the following terms:

f_in_gaa(x0)
U1_gaa(x0)
U2_gaa(x0)

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

(11) PisEmptyProof (EQUIVALENT transformation)

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

(12) TRUE

(13) PrologToPiTRSProof (SOUND transformation)

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

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x1, x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x1, x5)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(14) Obligation:

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

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x1, x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x1, x5)

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

F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → U2_GAA(X, Y, Z, U, f_in_gaa(U, Y, Z))
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x1, x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x1, x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x1, x4)
U2_GAA(x1, x2, x3, x4, x5)  =  U2_GAA(x1, x5)

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

(16) Obligation:

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

F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → U2_GAA(X, Y, Z, U, f_in_gaa(U, Y, Z))
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x1, x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x1, x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x1, x4)
U2_GAA(x1, x2, x3, x4, x5)  =  U2_GAA(x1, x5)

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

(17) DependencyGraphProof (EQUIVALENT transformation)

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

(18) Obligation:

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

U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)
F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x1, x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x1, x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x1, x4)

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:

U1_GAA(X, f_out_gaa(X, U)) → F_IN_GAA(U)
F_IN_GAA(s(X)) → U1_GAA(X, f_in_gaa(X))
F_IN_GAA(s(X)) → F_IN_GAA(X)

The TRS R consists of the following rules:

f_in_gaa(0) → f_out_gaa(0, 0)
f_in_gaa(s(X)) → U1_gaa(X, f_in_gaa(X))
U1_gaa(X, f_out_gaa(X, U)) → U2_gaa(X, f_in_gaa(U))
U2_gaa(X, f_out_gaa(U, Z)) → f_out_gaa(s(X), Z)

The set Q consists of the following terms:

f_in_gaa(x0)
U1_gaa(x0, x1)
U2_gaa(x0, x1)

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