(0) Obligation:

Clauses:

ap1(nil, X, X).
ap1(cons(H, X), Y, cons(H, Z)) :- ap1(X, Y, Z).
ap2(nil, X, X).
ap2(cons(H, X), Y, cons(H, Z)) :- ap2(X, Y, Z).
perm(nil, nil).
perm(Xs, cons(X, Ys)) :- ','(ap1(X1s, cons(X, X2s), Xs), ','(ap2(X1s, X2s, Zs), perm(Zs, Ys))).

Query: perm(g,a)

(1) PrologToTRSTransformerProof (SOUND transformation)

Transformed Prolog program to TRS.

(2) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

f3_in(nil) → f3_out1(nil)
f3_in(T9) → U1(f24_in(T9), T9)
U1(f24_out1(X13, T12, X14, X15, T13), T9) → f3_out1(cons(T12, T13))
f35_in(cons(T33, T34)) → f35_out1(nil, T33, T34)
f35_in(cons(T42, T43)) → U2(f35_in(T43), cons(T42, T43))
U2(f35_out1(X53, T44, X54), cons(T42, T43)) → f35_out1(cons(T42, X53), T44, X54)
f70_in(nil, T58) → f70_out1(T58)
f70_in(cons(T65, T66), T67) → U3(f70_in(T66, T67), cons(T65, T66), T67)
U3(f70_out1(X82), cons(T65, T66), T67) → f70_out1(cons(T65, X82))
f24_in(T9) → U4(f35_in(T9), T9)
U4(f35_out1(T18, T12, T19), T9) → U5(f36_in(T18, T19), T9, T18, T12, T19)
U5(f36_out1(X15, T20), T9, T18, T12, T19) → f24_out1(T18, T12, T19, X15, T20)
f36_in(T18, T19) → U6(f70_in(T18, T19), T18, T19)
U6(f70_out1(T51), T18, T19) → U7(f3_in(T51), T18, T19, T51)
U7(f3_out1(T20), T18, T19, T51) → f36_out1(T51, T20)

Q is empty.

(3) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LPAR04] we result in the following initial DP problem.

(4) Obligation:

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

F3_IN(T9) → U11(f24_in(T9), T9)
F3_IN(T9) → F24_IN(T9)
F35_IN(cons(T42, T43)) → U21(f35_in(T43), cons(T42, T43))
F35_IN(cons(T42, T43)) → F35_IN(T43)
F70_IN(cons(T65, T66), T67) → U31(f70_in(T66, T67), cons(T65, T66), T67)
F70_IN(cons(T65, T66), T67) → F70_IN(T66, T67)
F24_IN(T9) → U41(f35_in(T9), T9)
F24_IN(T9) → F35_IN(T9)
U41(f35_out1(T18, T12, T19), T9) → U51(f36_in(T18, T19), T9, T18, T12, T19)
U41(f35_out1(T18, T12, T19), T9) → F36_IN(T18, T19)
F36_IN(T18, T19) → U61(f70_in(T18, T19), T18, T19)
F36_IN(T18, T19) → F70_IN(T18, T19)
U61(f70_out1(T51), T18, T19) → U71(f3_in(T51), T18, T19, T51)
U61(f70_out1(T51), T18, T19) → F3_IN(T51)

The TRS R consists of the following rules:

f3_in(nil) → f3_out1(nil)
f3_in(T9) → U1(f24_in(T9), T9)
U1(f24_out1(X13, T12, X14, X15, T13), T9) → f3_out1(cons(T12, T13))
f35_in(cons(T33, T34)) → f35_out1(nil, T33, T34)
f35_in(cons(T42, T43)) → U2(f35_in(T43), cons(T42, T43))
U2(f35_out1(X53, T44, X54), cons(T42, T43)) → f35_out1(cons(T42, X53), T44, X54)
f70_in(nil, T58) → f70_out1(T58)
f70_in(cons(T65, T66), T67) → U3(f70_in(T66, T67), cons(T65, T66), T67)
U3(f70_out1(X82), cons(T65, T66), T67) → f70_out1(cons(T65, X82))
f24_in(T9) → U4(f35_in(T9), T9)
U4(f35_out1(T18, T12, T19), T9) → U5(f36_in(T18, T19), T9, T18, T12, T19)
U5(f36_out1(X15, T20), T9, T18, T12, T19) → f24_out1(T18, T12, T19, X15, T20)
f36_in(T18, T19) → U6(f70_in(T18, T19), T18, T19)
U6(f70_out1(T51), T18, T19) → U7(f3_in(T51), T18, T19, T51)
U7(f3_out1(T20), T18, T19, T51) → f36_out1(T51, T20)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 3 SCCs with 7 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

F70_IN(cons(T65, T66), T67) → F70_IN(T66, T67)

The TRS R consists of the following rules:

f3_in(nil) → f3_out1(nil)
f3_in(T9) → U1(f24_in(T9), T9)
U1(f24_out1(X13, T12, X14, X15, T13), T9) → f3_out1(cons(T12, T13))
f35_in(cons(T33, T34)) → f35_out1(nil, T33, T34)
f35_in(cons(T42, T43)) → U2(f35_in(T43), cons(T42, T43))
U2(f35_out1(X53, T44, X54), cons(T42, T43)) → f35_out1(cons(T42, X53), T44, X54)
f70_in(nil, T58) → f70_out1(T58)
f70_in(cons(T65, T66), T67) → U3(f70_in(T66, T67), cons(T65, T66), T67)
U3(f70_out1(X82), cons(T65, T66), T67) → f70_out1(cons(T65, X82))
f24_in(T9) → U4(f35_in(T9), T9)
U4(f35_out1(T18, T12, T19), T9) → U5(f36_in(T18, T19), T9, T18, T12, T19)
U5(f36_out1(X15, T20), T9, T18, T12, T19) → f24_out1(T18, T12, T19, X15, T20)
f36_in(T18, T19) → U6(f70_in(T18, T19), T18, T19)
U6(f70_out1(T51), T18, T19) → U7(f3_in(T51), T18, T19, T51)
U7(f3_out1(T20), T18, T19, T51) → f36_out1(T51, T20)

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

(8) UsableRulesProof (EQUIVALENT transformation)

We can use the usable rules and reduction pair processor [LPAR04] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its arguments. Then, we can delete all non-usable rules [FROCOS05] from R.

(9) Obligation:

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

F70_IN(cons(T65, T66), T67) → F70_IN(T66, T67)

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

(10) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] 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:

  • F70_IN(cons(T65, T66), T67) → F70_IN(T66, T67)
    The graph contains the following edges 1 > 1, 2 >= 2

(11) YES

(12) Obligation:

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

F35_IN(cons(T42, T43)) → F35_IN(T43)

The TRS R consists of the following rules:

f3_in(nil) → f3_out1(nil)
f3_in(T9) → U1(f24_in(T9), T9)
U1(f24_out1(X13, T12, X14, X15, T13), T9) → f3_out1(cons(T12, T13))
f35_in(cons(T33, T34)) → f35_out1(nil, T33, T34)
f35_in(cons(T42, T43)) → U2(f35_in(T43), cons(T42, T43))
U2(f35_out1(X53, T44, X54), cons(T42, T43)) → f35_out1(cons(T42, X53), T44, X54)
f70_in(nil, T58) → f70_out1(T58)
f70_in(cons(T65, T66), T67) → U3(f70_in(T66, T67), cons(T65, T66), T67)
U3(f70_out1(X82), cons(T65, T66), T67) → f70_out1(cons(T65, X82))
f24_in(T9) → U4(f35_in(T9), T9)
U4(f35_out1(T18, T12, T19), T9) → U5(f36_in(T18, T19), T9, T18, T12, T19)
U5(f36_out1(X15, T20), T9, T18, T12, T19) → f24_out1(T18, T12, T19, X15, T20)
f36_in(T18, T19) → U6(f70_in(T18, T19), T18, T19)
U6(f70_out1(T51), T18, T19) → U7(f3_in(T51), T18, T19, T51)
U7(f3_out1(T20), T18, T19, T51) → f36_out1(T51, T20)

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

(13) UsableRulesProof (EQUIVALENT transformation)

We can use the usable rules and reduction pair processor [LPAR04] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its arguments. Then, we can delete all non-usable rules [FROCOS05] from R.

(14) Obligation:

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

F35_IN(cons(T42, T43)) → F35_IN(T43)

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

(15) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] 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:

  • F35_IN(cons(T42, T43)) → F35_IN(T43)
    The graph contains the following edges 1 > 1

(16) YES

(17) Obligation:

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

F3_IN(T9) → F24_IN(T9)
F24_IN(T9) → U41(f35_in(T9), T9)
U41(f35_out1(T18, T12, T19), T9) → F36_IN(T18, T19)
F36_IN(T18, T19) → U61(f70_in(T18, T19), T18, T19)
U61(f70_out1(T51), T18, T19) → F3_IN(T51)

The TRS R consists of the following rules:

f3_in(nil) → f3_out1(nil)
f3_in(T9) → U1(f24_in(T9), T9)
U1(f24_out1(X13, T12, X14, X15, T13), T9) → f3_out1(cons(T12, T13))
f35_in(cons(T33, T34)) → f35_out1(nil, T33, T34)
f35_in(cons(T42, T43)) → U2(f35_in(T43), cons(T42, T43))
U2(f35_out1(X53, T44, X54), cons(T42, T43)) → f35_out1(cons(T42, X53), T44, X54)
f70_in(nil, T58) → f70_out1(T58)
f70_in(cons(T65, T66), T67) → U3(f70_in(T66, T67), cons(T65, T66), T67)
U3(f70_out1(X82), cons(T65, T66), T67) → f70_out1(cons(T65, X82))
f24_in(T9) → U4(f35_in(T9), T9)
U4(f35_out1(T18, T12, T19), T9) → U5(f36_in(T18, T19), T9, T18, T12, T19)
U5(f36_out1(X15, T20), T9, T18, T12, T19) → f24_out1(T18, T12, T19, X15, T20)
f36_in(T18, T19) → U6(f70_in(T18, T19), T18, T19)
U6(f70_out1(T51), T18, T19) → U7(f3_in(T51), T18, T19, T51)
U7(f3_out1(T20), T18, T19, T51) → f36_out1(T51, T20)

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

(18) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04,JAR06].


The following pairs can be oriented strictly and are deleted.


F24_IN(T9) → U41(f35_in(T9), T9)
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(F24_IN(x1)) = 1 + x1   
POL(F36_IN(x1, x2)) = x1 + x2   
POL(F3_IN(x1)) = 1 + x1   
POL(U2(x1, x2)) = 1 + x1   
POL(U3(x1, x2, x3)) = 1 + x1   
POL(U41(x1, x2)) = x1   
POL(U61(x1, x2, x3)) = x1   
POL(cons(x1, x2)) = 1 + x2   
POL(f35_in(x1)) = x1   
POL(f35_out1(x1, x2, x3)) = x1 + x3   
POL(f70_in(x1, x2)) = x1 + x2   
POL(f70_out1(x1)) = 1 + x1   
POL(nil) = 1   

The following usable rules [FROCOS05] with respect to the argument filtering of the ordering [JAR06] were oriented:

f35_in(cons(T33, T34)) → f35_out1(nil, T33, T34)
f35_in(cons(T42, T43)) → U2(f35_in(T43), cons(T42, T43))
f70_in(nil, T58) → f70_out1(T58)
f70_in(cons(T65, T66), T67) → U3(f70_in(T66, T67), cons(T65, T66), T67)
U2(f35_out1(X53, T44, X54), cons(T42, T43)) → f35_out1(cons(T42, X53), T44, X54)
U3(f70_out1(X82), cons(T65, T66), T67) → f70_out1(cons(T65, X82))

(19) Obligation:

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

F3_IN(T9) → F24_IN(T9)
U41(f35_out1(T18, T12, T19), T9) → F36_IN(T18, T19)
F36_IN(T18, T19) → U61(f70_in(T18, T19), T18, T19)
U61(f70_out1(T51), T18, T19) → F3_IN(T51)

The TRS R consists of the following rules:

f3_in(nil) → f3_out1(nil)
f3_in(T9) → U1(f24_in(T9), T9)
U1(f24_out1(X13, T12, X14, X15, T13), T9) → f3_out1(cons(T12, T13))
f35_in(cons(T33, T34)) → f35_out1(nil, T33, T34)
f35_in(cons(T42, T43)) → U2(f35_in(T43), cons(T42, T43))
U2(f35_out1(X53, T44, X54), cons(T42, T43)) → f35_out1(cons(T42, X53), T44, X54)
f70_in(nil, T58) → f70_out1(T58)
f70_in(cons(T65, T66), T67) → U3(f70_in(T66, T67), cons(T65, T66), T67)
U3(f70_out1(X82), cons(T65, T66), T67) → f70_out1(cons(T65, X82))
f24_in(T9) → U4(f35_in(T9), T9)
U4(f35_out1(T18, T12, T19), T9) → U5(f36_in(T18, T19), T9, T18, T12, T19)
U5(f36_out1(X15, T20), T9, T18, T12, T19) → f24_out1(T18, T12, T19, X15, T20)
f36_in(T18, T19) → U6(f70_in(T18, T19), T18, T19)
U6(f70_out1(T51), T18, T19) → U7(f3_in(T51), T18, T19, T51)
U7(f3_out1(T20), T18, T19, T51) → f36_out1(T51, T20)

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

(20) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 4 less nodes.

(21) TRUE